Compare commits

...
23 Commits
Author SHA1 Message Date
yunyingk 8773122a61 Merge pull request #81 from yunyingk/codex/release-v0.10.17
🧪 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.17: Automatic hosecloud integration sync, staging simulation guide, and CLI help completion
2026-09-11 15:09:58 +08:00
gitea c6224407be Release v0.10.17: Automatic hosecloud integration sync, staging simulation guide, and CLI help completion 2026-09-11 15:08:44 +08:00
yunyingk 6812ddd697 Merge pull request #80 from yunyingk/codex/staging-simulation-guide-and-fixes
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Add staging simulation guide and refine hose integration sync
2026-09-11 15:07:17 +08:00
gitea f5bedbbbae Refine staging guidance to recommend rather than enforce
- Change dogmatic rules to strong recommendations
- Emphasize that final decision belongs to the user and direct publish requests must be respected
2026-09-11 15:06:22 +08:00
gitea bdeca88354 Add staging simulation guide and refine hose integration sync
- Add comprehensive reference guide for staging simulation and production rule evolution
- Require latest CLI, skill, and plugin versions with self-update instructions in SKILL.md
- Deduplicate prod hosecloud integrations by corporationId during corps sync-test
- Support key and password fallback in enterprise source config for hose credentials
- Add unit and integration tests covering deduplication and source credential compatibility
2026-09-11 15:04:49 +08:00
yunyingk 0794f319b0 Merge pull request #79 from yunyingk/codex/cli-flow-validation-help
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Complete CLI help coverage for every dispatchable area
2026-09-11 14:57:14 +08:00
gitea b00ba57313 Complete CLI help coverage for every dispatchable area
Areas handled by the dispatcher (`service`, `stop`, `server`) had no help
registry entry, so their `--help` threw "Unknown command" and exited 2 even
though the commands themselves run. Add registry entries for the service
lifecycle and the stop shortcut, and alias `server` to the mcp help.

Global help was a hand-maintained duplicate of HELP_REGISTRY and had already
drifted: it omitted `rules lint/pull/push` and the second `corps bind-test`
usage form. Generate it from the registry instead, which removes ~120 lines
of duplicated usage text and makes the registry the single source of truth.

Only advertise "Run 'seal-use <area> <command> --help'" for areas that
actually have named subcommands, and resolve the `config status` /
`config test-enterprises-dir` aliases.

Add a coverage test that walks KNOWN_AREAS so a future area cannot ship
without a help entry.
2026-09-11 14:53:57 +08:00
yunyingk b5df52875d Merge pull request #77 from yunyingk/codex/update-skill-coverage
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Update skill coverage for recent CLI capabilities
2026-09-11 14:53:55 +08:00
yunyingk bf1888ec90 Merge pull request #78 from yunyingk/codex/sync-test-hosecloud-integrations
Add automatic hosecloud integration sync for test environments
2026-09-11 14:53:20 +08:00
gitea c2d3c119f2 Add automatic hosecloud integration sync for test environments
- Sync hosecloud integrations from prod to test during corps sync-test
- Format outboundName as {corpNamePrefix}(Seal测) capped at 13 chars
- Force assisted mode and reuse existing credentials and apiOrigin
- Skip outbound sync to Hosecloud to preserve production approval flows
- Add unit and integration tests covering naming, mode, and idempotency
2026-09-11 14:52:17 +08:00
gitea 9d74b40991 Update skill coverage for recent CLI capabilities 2026-09-11 14:44:32 +08:00
yunyingk 72b61819a1 Merge pull request #76 from yunyingk/codex/release-v0.10.16
🧪 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.16: Full knowledge sync, semantic versioning and local dev override
2026-09-11 12:25:24 +08:00
gitea 50131d1f4c Release v0.10.16: Full knowledge sync, semantic versioning and local dev override 2026-09-11 12:24:13 +08:00
yunyingk 39ca400322 Merge pull request #75 from yunyingk/codex/sync-test-knowledge-documents
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Add full coverage knowledge document synchronization to sync-test
2026-09-11 12:21:29 +08:00
gitea 718d8b663d Include target test version in sync version name 2026-09-11 12:20:33 +08:00
gitea 93f61a807a Add full coverage knowledge document synchronization to sync-test 2026-09-11 12:17:44 +08:00
yunyingk 43a18d0515 Merge pull request #74 from yunyingk/codex/sync-test-semantic-naming-and-mapping
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Add semantic sync-test naming, rule mapping and rules map command
2026-09-11 12:06:28 +08:00
gitea 3d9e25fd06 Add semantic sync-test naming, rule mapping and rules map command 2026-09-11 12:05:23 +08:00
yunyingk 8db4b87385 Merge pull request #73 from yunyingk/codex/fix-approval-style-preferences-post
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Use POST method for approval style preferences endpoint
2026-09-11 11:51:33 +08:00
gitea 55dcd20d48 Update corps-bind test mock to expect POST for approval style preferences 2026-09-11 11:50:36 +08:00
gitea 112473a2b7 Use POST method for approval style preferences endpoint 2026-09-11 11:48:28 +08:00
yunyingk efadcd0de4 Merge pull request #72 from yunyingk/codex/local-dev-version-override
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
Add local dev binary override and Git-aware versioning
2026-09-11 11:43:23 +08:00
gitea 883690e128 Add local dev binary override and Git-aware versioning 2026-09-11 11:42:12 +08:00
27 changed files with 2548 additions and 468 deletions

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "seal-use",
"version": "0.10.15",
"version": "0.10.17",
"description": "Seal Use tenant operations: approval-run diagnosis, minimal rule remediation, delegation links, Hose/合思 authorization, users, rules, billing, and search.",
"author": {
"name": "yingqing"
+1
View File
@@ -21,6 +21,7 @@ Tests are colocated as `*.test.ts` files in `src/`. OpenAPI source YAML lives in
- `bun run openapi:bundle`: rebuild `dist/openapi.json`.
- `bun run build:binary`: compile the standalone `seal-use` binary to `dist/bin/seal-use` (gitignored).
- `bun run build:plugin`: bundle the MCP server to `dist/mcp/server.js` (tracked, used by `.mcp.json`).
- `bun run dev:override`: compile the host binary with Git dev version metadata, macOS sign, atomically override the Mac global command (`/opt/homebrew/bin/seal-use`), and sync the local Agent Skill.
## Coding Style & Naming Conventions
+45
View File
@@ -7,6 +7,51 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.10.17] - 2026-09-11
### Added & Enhanced
- **Automatic Hosecloud Integration Synchronization for Staging Test**:
- `seal-use corps sync-test` automatically syncs Hosecloud (合思) integrations from production to bound test Seal enterprises.
- Generates standardized outbound name `{企业名前缀}(Seal测)` capped at 13 characters to satisfy platform limits.
- Automatically overrides mode to `assisted` in test environments regardless of production mode.
- Reuses production `apiOrigin` and `customApiUrl`, while extracting credentials directly from local enterprise source config (`appKey`/`appSecurity` with `key`/`password` fallback).
- Automatically deduplicates multiple production integrations belonging to the same enterprise into a single test integration.
- Retains existing `signKey` when updating for idempotency; skips outbound sync to Hosecloud to guarantee zero impact on production approval workflows.
- Added `hosecloudSyncPlan` to `--dry-run` output and `hosecloudSync` result to execution summary.
- **Comprehensive Staging Simulation & Production Rule Evolution Guide**:
- Added `skills/seal-use/references/staging-simulation-workflow.md` covering enterprise pairing, auto-sync, staging simulation validation, and production rule rollout.
- Enhanced `skills/seal-use/SKILL.md` with version verification mandates, self-update instructions (`seal-use update`), and staging-first safety guidelines.
- **Complete Dispatchable Area CLI Help Coverage**:
- Registered missing `service` and `stop` help entries, aliased `server` to `mcp` help, and resolved `config status` aliases.
- Dynamically generated global help from `HELP_REGISTRY`, eliminating drift and redundant usage blocks.
- Only emit subcommand footers for areas that have subcommands.
- Added automated coverage tests across all `KNOWN_AREAS`.
- **Skill Documentation & Routing Expansion**:
- Updated `SKILL.md` and `references/cli.md` covering read-only discovery, rule workspace, analytics/export, async simulation, and knowledge document lifecycle capabilities.
## [0.10.16] - 2026-09-11
### Added & Enhanced
- **Full-Coverage Knowledge Document Synchronization**:
- Extended `seal-use corps sync-test` to synchronize knowledge articles (`api/v1/knowledge/articles`) alongside rules and preferences.
- Natural key matching by title: creates missing documents, updates changed documents, and physically deletes redundant test documents (`DELETE /api/v1/knowledge/articles/:id`) to prevent stale background knowledge from distorting audit simulation.
- Safe scenario fallback: automatically defaults empty `scenarios` to `["audit"]`, preventing backend 400 validation failures.
- Added `deleteApprovalDocument` in Seal API, exported `seal_approval_delete_document` in MCP tools, and updated OpenAPI schema.
- Added `documentsPlan` to `--dry-run` output and structured `documents` execution summary.
- **Semantic Sync Versioning with Target Test Version Visibility**:
- Enhanced published version name format to `Sync from <ProdCorpName> [Prod v<ProdVersion> · #<Iteration> -> Test v<TestVersion>]`.
- Solves the Seal Web UI limitation where custom version names omit the assigned test version number.
- Backward-compatible regex parsing in `computeNextSyncIteration` handles legacy un-numbered, bracketed, and arrow-mapped formats.
- **Cross-Tenant Rule Mapping & Inspection**:
- Tracks bidirectional rule relationships (`versionMapping` and `ruleMapping`) between production source IDs/Codes and test target Codes/IDs.
- Automatically saves lightweight mapping snapshots to `~/.config/seal-use/mappings/<testCorpId>-v<versionNumber>.json`.
- Added `seal-use rules map [--corp <corpId>] [--code <ruleCode>]` command for easy querying and filtering of mapped rule origins.
- **Approval Style Preferences HTTP Method Alignment**:
- Aligned approval style preferences endpoint updates to use `POST` (`api/v1/agent/ai-approval/config`) matching Seal backend contract.
- **Local Dev Binary Override & Git-Aware Versioning**:
- Added `bun run dev:override` to compile host binaries with Git dev version metadata, macOS code sign, atomically override `/opt/homebrew/bin/seal-use`, and sync agent skills.
- CLI version output reports active channel (`dev` vs `release`), commits ahead, dirty state, and commit hash.
## [0.10.15] - 2026-09-11
### Added & Enhanced
+168 -263
View File
@@ -1,83 +1,83 @@
import{createRequire as ZL0}from"node:module";var JL0=Object.create;var{getPrototypeOf:QL0,defineProperty:lD,getOwnPropertyNames:KL0}=Object;var qL0=Object.prototype.hasOwnProperty;function HL0($){return this[$]}var GL0,WL0,OI=($,I,U)=>{var Y=$!=null&&typeof $==="object";if(Y){var J=I?GL0??=new WeakMap:WL0??=new WeakMap,Q=J.get($);if(Q)return Q}U=$!=null?JL0(QL0($)):{};let K=I||!$||!$.__esModule?lD(U,"default",{value:$,enumerable:!0}):U;for(let q of KL0($))if(!qL0.call(K,q))lD(K,q,{get:HL0.bind($,q),enumerable:!0});if(Y)J.set($,K);return K};var O=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);var wL0=($)=>$;function VL0($,I){this[$]=wL0.bind(null,I)}var s8=($,I)=>{for(var U in I)lD($,U,{get:I[U],enumerable:!0,configurable:!0,set:VL0.bind(I,U)})};var r=ZL0(import.meta.url);var kQ=O((Ui)=>{Object.defineProperty(Ui,"__esModule",{value:!0});Ui.regexpCode=Ui.getEsmExportName=Ui.getProperty=Ui.safeStringify=Ui.stringify=Ui.strConcat=Ui.addCodeArg=Ui.str=Ui._=Ui.nil=Ui._Code=Ui.Name=Ui.IDENTIFIER=Ui._CodeOrName=void 0;class kW{}Ui._CodeOrName=kW;Ui.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class UU extends kW{constructor($){super();if(!Ui.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}}}Ui.Name=UU;class n$ extends kW{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((I,U)=>`${I}${U}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((I,U)=>{if(U instanceof UU)I[U.str]=(I[U.str]||0)+1;return I},{})}}Ui._Code=n$;Ui.nil=new n$("");function $i($,...I){let U=[$[0]],Y=0;while(Y<I.length)KT(U,I[Y]),U.push($[++Y]);return new n$(U)}Ui._=$i;var QT=new n$("+");function Ii($,...I){let U=[xQ($[0])],Y=0;while(Y<I.length)U.push(QT),KT(U,I[Y]),U.push(QT,xQ($[++Y]));return yN0(U),new n$(U)}Ui.str=Ii;function KT($,I){if(I instanceof n$)$.push(...I._items);else if(I instanceof UU)$.push(I);else $.push(xN0(I))}Ui.addCodeArg=KT;function yN0($){let I=1;while(I<$.length-1){if($[I]===QT){let U=hN0($[I-1],$[I+1]);if(U!==void 0){$.splice(I-1,3,U);continue}$[I++]="+"}I++}}function hN0($,I){if(I==='""')return $;if($==='""')return I;if(typeof $=="string"){if(I instanceof UU||$[$.length-1]!=='"')return;if(typeof I!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return $.slice(0,-1)+I.slice(1);return}if(typeof I=="string"&&I[0]==='"'&&!($ instanceof UU))return`"${$}${I.slice(1)}`;return}function uN0($,I){return I.emptyStr()?$:$.emptyStr()?I:Ii`${$}${I}`}Ui.strConcat=uN0;function xN0($){return typeof $=="number"||typeof $=="boolean"||$===null?$:xQ(Array.isArray($)?$.join(","):$)}function kN0($){return new n$(xQ($))}Ui.stringify=kN0;function xQ($){return JSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Ui.safeStringify=xQ;function fN0($){return typeof $=="string"&&Ui.IDENTIFIER.test($)?new n$(`.${$}`):$i`[${$}]`}Ui.getProperty=fN0;function iN0($){if(typeof $=="string"&&Ui.IDENTIFIER.test($))return new n$(`${$}`);throw Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}Ui.getEsmExportName=iN0;function bN0($){return new n$($.toString())}Ui.regexpCode=bN0});var WT=O((Ki)=>{Object.defineProperty(Ki,"__esModule",{value:!0});Ki.ValueScope=Ki.ValueScopeName=Ki.Scope=Ki.varKinds=Ki.UsedValueState=void 0;var i6=kQ();class Ji extends Error{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}var iW;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(iW||(Ki.UsedValueState=iW={}));Ki.varKinds={const:new i6.Name("const"),let:new i6.Name("let"),var:new i6.Name("var")};class HT{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return $ instanceof i6.Name?$:this.name($)}name($){return new i6.Name(this._newName($))}_newName($){let I=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){var I,U;if(((U=(I=this._parent)===null||I===void 0?void 0:I._prefixes)===null||U===void 0?void 0:U.has($))||this._prefixes&&!this._prefixes.has($))throw Error(`CodeGen: prefix "${$}" is not allowed in this scope`);return this._names[$]={prefix:$,index:0}}}Ki.Scope=HT;class GT extends i6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:U}){this.value=$,this.scopePath=i6._`.${new i6.Name(I)}[${U}]`}}Ki.ValueScopeName=GT;var $M0=i6._`\n`;class Qi extends HT{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?$M0:i6.nil}}get(){return this._scope}name($){return new GT($,this._newName($))}value($,I){var U;if(I.ref===void 0)throw Error("CodeGen: ref must be passed in value");let Y=this.toName($),{prefix:J}=Y,Q=(U=I.key)!==null&&U!==void 0?U:I.ref,K=this._values[J];if(K){let G=K.get(Q);if(Line truncated
`:""},this._extScope=$,this._scope=new p$.Scope({parent:$}),this._nodes=[new zi]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,I){let U=this._extScope.value($,I);return(this._values[U.prefix]||(this._values[U.prefix]=new Set)).add(U),U}getScopeValue($,I){return this._extScope.getValue($,I)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,I,U,Y){let J=this._scope.toName(I);if(U!==void 0&&Y)this._constants[J.str]=U;return this._leafNode(new Hi($,J,U)),J}const($,I,U){return this._def(p$.varKinds.const,$,I,U)}let($,I,U){return this._def(p$.varKinds.let,$,I,U)}var($,I,U){return this._def(p$.varKinds.var,$,I,U)}assign($,I,U){return this._leafNode(new ZT($,I,U))}add($,I){return this._leafNode(new Gi($,b6.operators.ADD,I))}code($){if(typeof $=="function")$();else if($!==q1.nil)this._leafNode(new Zi($));return this}object(...$){let I=["{"];for(let[U,Y]of $){if(I.length>1)I.push(",");if(I.push(U),U!==Y||this.opts.es5)I.push(":"),(0,q1.addCodeArg)(I,Y)}return I.push("}"),new q1._Code(I)}if($,I,U){if(this._blockNode(new Y5($)),I&&U)this.code(I).else().code(U).endIf();else if(I)this.code(I).endIf();else if(U)throw Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new Y5($))}else(){return this._elseNode(new fQ)}endIf(){return this._endBlockNode(Y5,fQ)}_for($,I){if(this._blockNode($),I)this.code(I).endFor();return this}for($,I){return this._for(new Xi($),I)}forRange($,I,U,Y,J=this.opts.es5?p$.varKinds.var:p$.varKinds.let){let Q=this._scope.toName($);return this._for(new Li(J,Q,I,U),()=>Y(Q))}forOf($,I,U,Y=p$.varKinds.const){let J=this._scope.toName($);if(this.opts.es5){let Q=I instanceof q1.Name?I:this.var("_arr",I);return this.forRange("_i",0,q1._`${Q}.length`,(K)=>{this.var(J,q1._`${Q}[${K}]`),U(J)})}return this._for(new wT("of",Y,J,I),()=>U(J))}forIn($,I,U,Y=this.opts.es5?p$.varKinds.var:p$.varKinds.const){if(this.opts.ownProperties)return this.forOf($,q1._`Object.keys(${I})`,U);let J=this._scope.toName($);return this._for(new wT("in",Y,J,I),()=>U(J))}endFor(){return this._endBlockNode(YU)}label($){return this._leafNode(new Wi($))}break($){return this._leafNode(new wi($))}return($){let I=new nW;if(this._blockNode(I),this.code($),I.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(nW)}try($,I,U){if(!I&&!U)throw Error('CodeGen: "try" without "catch" and "finally"');let Y=new Di;if(this._blockNode(Y),this.code($),I){let J=this.name("e");this._currNode=Y.catch=new pW(J),I(J)}if(U)this._currNode=Y.finally=new cW,this.code(U);return this._endBlockNode(pW,cW)}throw($){return this._leafNode(new Vi($))}block($,I){if(this._blockStarts.push(this._nodes.length),$)this.code($).endBlock(I);return this}endBlock($){let I=this._blockStarts.pop();if(I===void 0)throw Error("CodeGen: not in self-balancing block");let U=this._nodes.length-I;if(U<0||$!==void 0&&U!==$)throw Error(`CodeGen: wrong number of nodes: ${U} vs ${$} expected`);return this._nodes.length=I,this}func($,I=q1.nil,U,Y){if(this._blockNode(new bW($,I,U)),Y)this.code(Y).endFunc();return this}endFunc(){return this._endBlockNode(bW)}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($,I){let U=this._currNode;if(U instanceof $||I&&U instanceof I)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${I?`${$.kind}/${I.kind}`:$.kind}"`)}_elseNode($){let I=this._currNode;if(!(I instanceof Y5))throw Error('CodeGen: "else" without "if"');return this._currNode=I.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let I=this._nodes;I[I.length-1]=$}}b6.CodeGen=Oi;function h7($,I){for(let U in I)$[U]=($[U]||0)+(I[U]||0);return $}function dW($,I){return I instanceof q1._CodeOrName?h7($,I.names):$}function JU($,I,U){if($ instanceof q1.Name)return Y($);if(!J($))return $;return new q1._Code($._items.reduce((Q,K)=>{if(K instanceof q1.Name)K=Y(K);if(K instanceof q1._Code)Q.push(...K._items);else Q.push(K);return Q},[]));function Y(Q){let K=U[Q.str];if(K===void 0||I[Q.str]!==1)return Q;return delete I[Q.str],K}function J(Q){return Q instanceof q1._Code&&Q._items.some((K)=>K instanceof q1.Name&&I[K.str]===1&&U[K.str]!==void 0)}}function JM0($,I){for(let U in I)$[U]=($[U]||0)-(I[U]||0)}function Fi($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:q1._`!${VT($)}`}b6.not=Fi;var QM0=Ni(b6.operators.AND);function KM0(...$){return $.reduce(QM0)}b6.and=KM0;var qM0=Ni(b6.operators.OR);function HM0(...$){return $.reduce(qM0)}b6.or=HM0;function Ni($){return(I,U)=>I===q1.nil?U:U===q1.nil?I:q1._`${VT(I)} ${$} ${VT(U)}`}function VT($){return $ instanceof q1.Name?$:q1._`(${Line truncated
import{createRequire as vL0}from"node:module";var FL0=Object.create;var{getPrototypeOf:OL0,defineProperty:eD,getOwnPropertyNames:NL0}=Object;var ML0=Object.prototype.hasOwnProperty;function AL0($){return this[$]}var PL0,TL0,OI=($,I,U)=>{var Y=$!=null&&typeof $==="object";if(Y){var J=I?PL0??=new WeakMap:TL0??=new WeakMap,Q=J.get($);if(Q)return Q}U=$!=null?FL0(OL0($)):{};let K=I||!$||!$.__esModule?eD(U,"default",{value:$,enumerable:!0}):U;for(let q of NL0($))if(!ML0.call(K,q))eD(K,q,{get:AL0.bind($,q),enumerable:!0});if(Y)J.set($,K);return K};var F=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);var EL0=($)=>$;function BL0($,I){this[$]=EL0.bind(null,I)}var $5=($,I)=>{for(var U in I)eD($,U,{get:I[U],enumerable:!0,configurable:!0,set:BL0.bind(I,U)})};var t=vL0(import.meta.url);var fQ=F((Hb)=>{Object.defineProperty(Hb,"__esModule",{value:!0});Hb.regexpCode=Hb.getEsmExportName=Hb.getProperty=Hb.safeStringify=Hb.stringify=Hb.strConcat=Hb.addCodeArg=Hb.str=Hb._=Hb.nil=Hb._Code=Hb.Name=Hb.IDENTIFIER=Hb._CodeOrName=void 0;class bW{}Hb._CodeOrName=bW;Hb.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class YU extends bW{constructor($){super();if(!Hb.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}}}Hb.Name=YU;class d$ extends bW{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((I,U)=>`${I}${U}`,"")}get names(){var $;return($=this._names)!==null&&$!==void 0?$:this._names=this._items.reduce((I,U)=>{if(U instanceof YU)I[U.str]=(I[U.str]||0)+1;return I},{})}}Hb._Code=d$;Hb.nil=new d$("");function Kb($,...I){let U=[$[0]],Y=0;while(Y<I.length)VT(U,I[Y]),U.push($[++Y]);return new d$(U)}Hb._=Kb;var wT=new d$("+");function qb($,...I){let U=[kQ($[0])],Y=0;while(Y<I.length)U.push(wT),VT(U,I[Y]),U.push(wT,kQ($[++Y]));return oN0(U),new d$(U)}Hb.str=qb;function VT($,I){if(I instanceof d$)$.push(...I._items);else if(I instanceof YU)$.push(I);else $.push(aN0(I))}Hb.addCodeArg=VT;function oN0($){let I=1;while(I<$.length-1){if($[I]===wT){let U=rN0($[I-1],$[I+1]);if(U!==void 0){$.splice(I-1,3,U);continue}$[I++]="+"}I++}}function rN0($,I){if(I==='""')return $;if($==='""')return I;if(typeof $=="string"){if(I instanceof YU||$[$.length-1]!=='"')return;if(typeof I!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return $.slice(0,-1)+I.slice(1);return}if(typeof I=="string"&&I[0]==='"'&&!($ instanceof YU))return`"${$}${I.slice(1)}`;return}function tN0($,I){return I.emptyStr()?$:$.emptyStr()?I:qb`${$}${I}`}Hb.strConcat=tN0;function aN0($){return typeof $=="number"||typeof $=="boolean"||$===null?$:kQ(Array.isArray($)?$.join(","):$)}function sN0($){return new d$(kQ($))}Hb.stringify=sN0;function kQ($){return JSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}Hb.safeStringify=kQ;function eN0($){return typeof $=="string"&&Hb.IDENTIFIER.test($)?new d$(`.${$}`):Kb`[${$}]`}Hb.getProperty=eN0;function $M0($){if(typeof $=="string"&&Hb.IDENTIFIER.test($))return new d$(`${$}`);throw Error(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}Hb.getEsmExportName=$M0;function IM0($){return new d$($.toString())}Hb.regexpCode=IM0});var LT=F((Vb)=>{Object.defineProperty(Vb,"__esModule",{value:!0});Vb.ValueScope=Vb.ValueScopeName=Vb.Scope=Vb.varKinds=Vb.UsedValueState=void 0;var c6=fQ();class Wb extends Error{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}var nW;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(nW||(Vb.UsedValueState=nW={}));Vb.varKinds={const:new c6.Name("const"),let:new c6.Name("let"),var:new c6.Name("var")};class zT{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return $ instanceof c6.Name?$:this.name($)}name($){return new c6.Name(this._newName($))}_newName($){let I=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){var I,U;if(((U=(I=this._parent)===null||I===void 0?void 0:I._prefixes)===null||U===void 0?void 0:U.has($))||this._prefixes&&!this._prefixes.has($))throw Error(`CodeGen: prefix "${$}" is not allowed in this scope`);return this._names[$]={prefix:$,index:0}}}Vb.Scope=zT;class XT extends c6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:U}){this.value=$,this.scopePath=c6._`.${new c6.Name(I)}[${U}]`}}Vb.ValueScopeName=XT;var zM0=c6._`\n`;class wb extends zT{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?zM0:c6.nil}}get(){return this._scope}name($){return new XT($,this._newName($))}value($,I){var U;if(I.ref===void 0)throw Error("CodeGen: ref must be passed in value");let Y=this.toName($),{prefix:J}=Y,Q=(U=I.key)!==null&&U!==void 0?U:I.ref,K=this._values[J];if(K){let G=K.get(Q);if(Line truncated
`:""},this._extScope=$,this._scope=new m$.Scope({parent:$}),this._nodes=[new Nb]}toString(){return this._root.render(this.opts)}name($){return this._scope.name($)}scopeName($){return this._extScope.name($)}scopeValue($,I){let U=this._extScope.value($,I);return(this._values[U.prefix]||(this._values[U.prefix]=new Set)).add(U),U}getScopeValue($,I){return this._extScope.getValue($,I)}scopeRefs($){return this._extScope.scopeRefs($,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def($,I,U,Y){let J=this._scope.toName(I);if(U!==void 0&&Y)this._constants[J.str]=U;return this._leafNode(new zb($,J,U)),J}const($,I,U){return this._def(m$.varKinds.const,$,I,U)}let($,I,U){return this._def(m$.varKinds.let,$,I,U)}var($,I,U){return this._def(m$.varKinds.var,$,I,U)}assign($,I,U){return this._leafNode(new OT($,I,U))}add($,I){return this._leafNode(new Xb($,d6.operators.ADD,I))}code($){if(typeof $=="function")$();else if($!==W1.nil)this._leafNode(new Ob($));return this}object(...$){let I=["{"];for(let[U,Y]of $){if(I.length>1)I.push(",");if(I.push(U),U!==Y||this.opts.es5)I.push(":"),(0,W1.addCodeArg)(I,Y)}return I.push("}"),new W1._Code(I)}if($,I,U){if(this._blockNode(new Q5($)),I&&U)this.code(I).else().code(U).endIf();else if(I)this.code(I).endIf();else if(U)throw Error('CodeGen: "else" body without "then" body');return this}elseIf($){return this._elseNode(new Q5($))}else(){return this._elseNode(new bQ)}endIf(){return this._endBlockNode(Q5,bQ)}_for($,I){if(this._blockNode($),I)this.code(I).endFor();return this}for($,I){return this._for(new Mb($),I)}forRange($,I,U,Y,J=this.opts.es5?m$.varKinds.var:m$.varKinds.let){let Q=this._scope.toName($);return this._for(new Ab(J,Q,I,U),()=>Y(Q))}forOf($,I,U,Y=m$.varKinds.const){let J=this._scope.toName($);if(this.opts.es5){let Q=I instanceof W1.Name?I:this.var("_arr",I);return this.forRange("_i",0,W1._`${Q}.length`,(K)=>{this.var(J,W1._`${Q}[${K}]`),U(J)})}return this._for(new DT("of",Y,J,I),()=>U(J))}forIn($,I,U,Y=this.opts.es5?m$.varKinds.var:m$.varKinds.const){if(this.opts.ownProperties)return this.forOf($,W1._`Object.keys(${I})`,U);let J=this._scope.toName($);return this._for(new DT("in",Y,J,I),()=>U(J))}endFor(){return this._endBlockNode(JU)}label($){return this._leafNode(new Lb($))}break($){return this._leafNode(new Db($))}return($){let I=new cW;if(this._blockNode(I),this.code($),I.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(cW)}try($,I,U){if(!I&&!U)throw Error('CodeGen: "try" without "catch" and "finally"');let Y=new Pb;if(this._blockNode(Y),this.code($),I){let J=this.name("e");this._currNode=Y.catch=new dW(J),I(J)}if(U)this._currNode=Y.finally=new mW,this.code(U);return this._endBlockNode(dW,mW)}throw($){return this._leafNode(new Fb($))}block($,I){if(this._blockStarts.push(this._nodes.length),$)this.code($).endBlock(I);return this}endBlock($){let I=this._blockStarts.pop();if(I===void 0)throw Error("CodeGen: not in self-balancing block");let U=this._nodes.length-I;if(U<0||$!==void 0&&U!==$)throw Error(`CodeGen: wrong number of nodes: ${U} vs ${$} expected`);return this._nodes.length=I,this}func($,I=W1.nil,U,Y){if(this._blockNode(new pW($,I,U)),Y)this.code(Y).endFunc();return this}endFunc(){return this._endBlockNode(pW)}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($,I){let U=this._currNode;if(U instanceof $||I&&U instanceof I)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${I?`${$.kind}/${I.kind}`:$.kind}"`)}_elseNode($){let I=this._currNode;if(!(I instanceof Q5))throw Error('CodeGen: "else" without "if"');return this._currNode=I.else=$,this}get _root(){return this._nodes[0]}get _currNode(){let $=this._nodes;return $[$.length-1]}set _currNode($){let I=this._nodes;I[I.length-1]=$}}d6.CodeGen=Tb;function u7($,I){for(let U in I)$[U]=($[U]||0)+(I[U]||0);return $}function lW($,I){return I instanceof W1._CodeOrName?u7($,I.names):$}function QU($,I,U){if($ instanceof W1.Name)return Y($);if(!J($))return $;return new W1._Code($._items.reduce((Q,K)=>{if(K instanceof W1.Name)K=Y(K);if(K instanceof W1._Code)Q.push(...K._items);else Q.push(K);return Q},[]));function Y(Q){let K=U[Q.str];if(K===void 0||I[Q.str]!==1)return Q;return delete I[Q.str],K}function J(Q){return Q instanceof W1._Code&&Q._items.some((K)=>K instanceof W1.Name&&I[K.str]===1&&U[K.str]!==void 0)}}function FM0($,I){for(let U in I)$[U]=($[U]||0)-(I[U]||0)}function Eb($){return typeof $=="boolean"||typeof $=="number"||$===null?!$:W1._`!${FT($)}`}d6.not=Eb;var OM0=Bb(d6.operators.AND);function NM0(...$){return $.reduce(OM0)}d6.and=NM0;var MM0=Bb(d6.operators.OR);function AM0(...$){return $.reduce(MM0)}d6.or=AM0;function Bb($){return(I,U)=>I===W1.nil?U:U===W1.nil?I:W1._`${FT(I)} ${$} ${FT(U)}`}function FT($){return $ instanceof W1.Name?$:W1._`(${Line truncated
|| (${K} == "string" && ${J} && ${J} == +${J})`).assign(q,t0._`+${J}`);return;case"integer":Y.elseIf(t0._`${K} === "boolean" || ${J} === null
|| (${K} === "string" && ${J} && ${J} == +${J} && !(${J} % 1))`).assign(q,t0._`+${J}`);return;case"boolean":Y.elseIf(t0._`${J} === "false" || ${J} === 0 || ${J} === null`).assign(q,!1).elseIf(t0._`${J} === "true" || ${J} === 1`).assign(q,!0);return;case"null":Y.elseIf(t0._`${J} === "" || ${J} === 0 || ${J} === false`),Y.assign(q,null);return;case"array":Y.elseIf(t0._`${K} === "string" || ${K} === "number"
|| ${K} === "boolean" || ${J} === null`).assign(q,t0._`[${J}]`)}}}function MA0({gen:$,parentData:I,parentDataProperty:U},Y){$.if(t0._`${I} !== undefined`,()=>$.assign(t0._`${I}[${U}]`,Y))}function NT($,I,U,Y=QU.Correct){let J=Y===QU.Correct?t0.operators.EQ:t0.operators.NEQ,Q;switch($){case"null":return t0._`${I} ${J} null`;case"array":Q=t0._`Array.isArray(${I})`;break;case"object":Q=t0._`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":Q=K(t0._`!(${I} % 1) && !isNaN(${I})`);break;case"number":Q=K();break;default:return t0._`typeof ${I} ${J} ${$}`}return Y===QU.Correct?Q:(0,t0.not)(Q);function K(q=t0.nil){return(0,t0.and)(t0._`typeof ${I} == "number"`,q,U?t0._`isFinite(${I})`:t0.nil)}}ti.checkDataType=NT;function MT($,I,U,Y){if($.length===1)return NT($[0],I,U,Y);let J,Q=(0,li.toHash)($);if(Q.array&&Q.object){let K=t0._`typeof ${I} != "object"`;J=Q.null?K:t0._`!${I} || ${K}`,delete Q.null,delete Q.array,delete Q.object}else J=t0.nil;if(Q.number)delete Q.integer;for(let K in Q)J=(0,t0.and)(J,NT(K,I,U,Y));return J}ti.checkDataTypes=MT;var AA0={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:I})=>typeof $=="string"?t0._`{type: ${$}}`:t0._`{type: ${I}}`};function AT($){let I=PA0($);(0,LA0.reportError)(I,AA0)}ti.reportTypeError=AT;function PA0($){let{gen:I,data:U,schema:Y}=$,J=(0,li.schemaRefOrVal)($,Y,"type");return{gen:I,keyword:"type",data:U,schema:Y.type,schemaCode:J,schemaValue:J,parentSchema:Y,params:{},it:$}}});var Ib=O((ei)=>{Object.defineProperty(ei,"__esModule",{value:!0});ei.assignDefaults=void 0;var KU=s0(),jA0=V1();function _A0($,I){let{properties:U,items:Y}=$.schema;if(I==="object"&&U)for(let J in U)si($,J,U[J].default);else if(I==="array"&&Array.isArray(Y))Y.forEach((J,Q)=>si($,Q,J.default))}ei.assignDefaults=_A0;function si($,I,U){let{gen:Y,compositeRule:J,data:Q,opts:K}=$;if(U===void 0)return;let q=KU._`${Q}${(0,KU.getProperty)(I)}`;if(J){(0,jA0.checkStrictMode)($,`default is ignored for: ${q}`);return}let H=KU._`${q} === undefined`;if(K.useDefaults==="empty")H=KU._`${H} || ${q} === null || ${q} === ""`;Y.if(H,KU._`${q} = ${(0,KU.stringify)(U)}`)}});var M$=O((Jb)=>{Object.defineProperty(Jb,"__esModule",{value:!0});Jb.validateUnion=Jb.validateArray=Jb.usePattern=Jb.callValidateCode=Jb.schemaProperties=Jb.allSchemaProperties=Jb.noPropertyInData=Jb.propertyInData=Jb.isOwnProperty=Jb.hasPropFunc=Jb.reportMissingProp=Jb.checkMissingProp=Jb.checkReportMissingProp=void 0;var r1=s0(),PT=V1(),z9=J5(),gA0=V1();function SA0($,I){let{gen:U,data:Y,it:J}=$;U.if(ET(U,Y,I,J.opts.ownProperties),()=>{$.setParams({missingProperty:r1._`${I}`},!0),$.error()})}Jb.checkReportMissingProp=SA0;function yA0({gen:$,data:I,it:{opts:U}},Y,J){return(0,r1.or)(...Y.map((Q)=>(0,r1.and)(ET($,I,Q,U.ownProperties),r1._`${J} = ${Q}`)))}Jb.checkMissingProp=yA0;function hA0($,I){$.setParams({missingProperty:I},!0),$.error()}Jb.reportMissingProp=hA0;function Ub($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:r1._`Object.prototype.hasOwnProperty`})}Jb.hasPropFunc=Ub;function TT($,I,U){return r1._`${Ub($)}.call(${I}, ${U})`}Jb.isOwnProperty=TT;function uA0($,I,U,Y){let J=r1._`${I}${(0,r1.getProperty)(U)} !== undefined`;return Y?r1._`${J} && ${TT($,I,U)}`:J}Jb.propertyInData=uA0;function ET($,I,U,Y){let J=r1._`${I}${(0,r1.getProperty)(U)} === undefined`;return Y?(0,r1.or)(J,(0,r1.not)(TT($,I,U))):J}Jb.noPropertyInData=ET;function Yb($){return $?Object.keys($).filter((I)=>I!=="__proto__"):[]}Jb.allSchemaProperties=Yb;function xA0($,I){return Yb(I).filter((U)=>!(0,PT.alwaysValidSchema)($,I[U]))}Jb.schemaProperties=xA0;function kA0({schemaCode:$,data:I,it:{gen:U,topSchemaRef:Y,schemaPath:J,errorPath:Q},it:K},q,H,G){let W=G?r1._`${$}, ${I}, ${Y}${J}`:I,w=[[z9.default.instancePath,(0,r1.strConcat)(z9.default.instancePath,Q)],[z9.default.parentData,K.parentData],[z9.default.parentDataProperty,K.parentDataProperty],[z9.default.rootData,z9.default.rootData]];if(K.opts.dynamicRef)w.push([z9.default.dynamicAnchors,z9.default.dynamicAnchors]);let V=r1._`${W}, ${U.object(...w)}`;return H!==r1.nil?r1._`${q}.call(${H}, ${V})`:r1._`${q}(${V})`}Jb.callValidateCode=kA0;var fA0=r1._`new RegExp`;function iA0({gen:$,it:{opts:I}},U){let Y=I.unicodeRegExp?"u":"",{regExp:J}=I.code,Q=J(U,Y);return $.scopeValue("pattern",{key:Q.toString(),ref:Q,code:r1._`${J.code==="new RegExp"?fA0:(0,gA0.useFunc)($,J)}(${U}, ${Y})`})}Jb.usePattern=iA0;function bA0($){let{gen:I,data:U,keyword:Y,it:J}=$,Q=I.name("valid");if(J.allErrors){let q=I.let("valid",!0);return K(()=>I.assign(q,!1)),q}return I.var(Q,!0),K(()=>I.break()),Q;function K(q){let H=I.const("len",r1._`${U}.length`);I.forRange("i",0,H,(G)=>{$.subschema({keyword:Y,dataProp:G,dataPropType:PT.Type.Num},Q),I.if((0,r1.not)(Q),q)})}}Jb.validateArray=bA0;function nA0($){let{gen:I,schema:U,keyword:Y,it:J}=$;if(!Array.isArray(U))throw Error("ajv implementation error");if(U.some((H)=>(0,PT.alwaysValidSchema)(J,H))&&!J.opts.unevaluated)return;le Line truncated
|| ${K} === "boolean" || ${J} === null`).assign(q,t0._`[${J}]`)}}}function hA0({gen:$,parentData:I,parentDataProperty:U},Y){$.if(t0._`${I} !== undefined`,()=>$.assign(t0._`${I}[${U}]`,Y))}function BT($,I,U,Y=KU.Correct){let J=Y===KU.Correct?t0.operators.EQ:t0.operators.NEQ,Q;switch($){case"null":return t0._`${I} ${J} null`;case"array":Q=t0._`Array.isArray(${I})`;break;case"object":Q=t0._`${I} && typeof ${I} == "object" && !Array.isArray(${I})`;break;case"integer":Q=K(t0._`!(${I} % 1) && !isNaN(${I})`);break;case"number":Q=K();break;default:return t0._`typeof ${I} ${J} ${$}`}return Y===KU.Correct?Q:(0,t0.not)(Q);function K(q=t0.nil){return(0,t0.and)(t0._`typeof ${I} == "number"`,q,U?t0._`isFinite(${I})`:t0.nil)}}Ui.checkDataType=BT;function vT($,I,U,Y){if($.length===1)return BT($[0],I,U,Y);let J,Q=(0,eb.toHash)($);if(Q.array&&Q.object){let K=t0._`typeof ${I} != "object"`;J=Q.null?K:t0._`!${I} || ${K}`,delete Q.null,delete Q.array,delete Q.object}else J=t0.nil;if(Q.number)delete Q.integer;for(let K in Q)J=(0,t0.and)(J,BT(K,I,U,Y));return J}Ui.checkDataTypes=vT;var uA0={message:({schema:$})=>`must be ${$}`,params:({schema:$,schemaValue:I})=>typeof $=="string"?t0._`{type: ${$}}`:t0._`{type: ${I}}`};function RT($){let I=xA0($);(0,CA0.reportError)(I,uA0)}Ui.reportTypeError=RT;function xA0($){let{gen:I,data:U,schema:Y}=$,J=(0,eb.schemaRefOrVal)($,Y,"type");return{gen:I,keyword:"type",data:U,schema:Y.type,schemaCode:J,schemaValue:J,parentSchema:Y,params:{},it:$}}});var qi=F((Qi)=>{Object.defineProperty(Qi,"__esModule",{value:!0});Qi.assignDefaults=void 0;var qU=a0(),cA0=z1();function dA0($,I){let{properties:U,items:Y}=$.schema;if(I==="object"&&U)for(let J in U)Ji($,J,U[J].default);else if(I==="array"&&Array.isArray(Y))Y.forEach((J,Q)=>Ji($,Q,J.default))}Qi.assignDefaults=dA0;function Ji($,I,U){let{gen:Y,compositeRule:J,data:Q,opts:K}=$;if(U===void 0)return;let q=qU._`${Q}${(0,qU.getProperty)(I)}`;if(J){(0,cA0.checkStrictMode)($,`default is ignored for: ${q}`);return}let H=qU._`${q} === undefined`;if(K.useDefaults==="empty")H=qU._`${H} || ${q} === null || ${q} === ""`;Y.if(H,qU._`${q} = ${(0,qU.stringify)(U)}`)}});var E$=F((Wi)=>{Object.defineProperty(Wi,"__esModule",{value:!0});Wi.validateUnion=Wi.validateArray=Wi.usePattern=Wi.callValidateCode=Wi.schemaProperties=Wi.allSchemaProperties=Wi.noPropertyInData=Wi.propertyInData=Wi.isOwnProperty=Wi.hasPropFunc=Wi.reportMissingProp=Wi.checkMissingProp=Wi.checkReportMissingProp=void 0;var a1=a0(),jT=z1(),z9=K5(),mA0=z1();function lA0($,I){let{gen:U,data:Y,it:J}=$;U.if(_T(U,Y,I,J.opts.ownProperties),()=>{$.setParams({missingProperty:a1._`${I}`},!0),$.error()})}Wi.checkReportMissingProp=lA0;function oA0({gen:$,data:I,it:{opts:U}},Y,J){return(0,a1.or)(...Y.map((Q)=>(0,a1.and)(_T($,I,Q,U.ownProperties),a1._`${J} = ${Q}`)))}Wi.checkMissingProp=oA0;function rA0($,I){$.setParams({missingProperty:I},!0),$.error()}Wi.reportMissingProp=rA0;function Hi($){return $.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:a1._`Object.prototype.hasOwnProperty`})}Wi.hasPropFunc=Hi;function CT($,I,U){return a1._`${Hi($)}.call(${I}, ${U})`}Wi.isOwnProperty=CT;function tA0($,I,U,Y){let J=a1._`${I}${(0,a1.getProperty)(U)} !== undefined`;return Y?a1._`${J} && ${CT($,I,U)}`:J}Wi.propertyInData=tA0;function _T($,I,U,Y){let J=a1._`${I}${(0,a1.getProperty)(U)} === undefined`;return Y?(0,a1.or)(J,(0,a1.not)(CT($,I,U))):J}Wi.noPropertyInData=_T;function Gi($){return $?Object.keys($).filter((I)=>I!=="__proto__"):[]}Wi.allSchemaProperties=Gi;function aA0($,I){return Gi(I).filter((U)=>!(0,jT.alwaysValidSchema)($,I[U]))}Wi.schemaProperties=aA0;function sA0({schemaCode:$,data:I,it:{gen:U,topSchemaRef:Y,schemaPath:J,errorPath:Q},it:K},q,H,G){let W=G?a1._`${$}, ${I}, ${Y}${J}`:I,w=[[z9.default.instancePath,(0,a1.strConcat)(z9.default.instancePath,Q)],[z9.default.parentData,K.parentData],[z9.default.parentDataProperty,K.parentDataProperty],[z9.default.rootData,z9.default.rootData]];if(K.opts.dynamicRef)w.push([z9.default.dynamicAnchors,z9.default.dynamicAnchors]);let V=a1._`${W}, ${U.object(...w)}`;return H!==a1.nil?a1._`${q}.call(${H}, ${V})`:a1._`${q}(${V})`}Wi.callValidateCode=sA0;var eA0=a1._`new RegExp`;function $P0({gen:$,it:{opts:I}},U){let Y=I.unicodeRegExp?"u":"",{regExp:J}=I.code,Q=J(U,Y);return $.scopeValue("pattern",{key:Q.toString(),ref:Q,code:a1._`${J.code==="new RegExp"?eA0:(0,mA0.useFunc)($,J)}(${U}, ${Y})`})}Wi.usePattern=$P0;function IP0($){let{gen:I,data:U,keyword:Y,it:J}=$,Q=I.name("valid");if(J.allErrors){let q=I.let("valid",!0);return K(()=>I.assign(q,!1)),q}return I.var(Q,!0),K(()=>I.break()),Q;function K(q){let H=I.const("len",a1._`${U}.length`);I.forRange("i",0,H,(G)=>{$.subschema({keyword:Y,dataProp:G,dataPropType:jT.Type.Num},Q),I.if((0,a1.not)(Q),q)})}}Wi.validateArray=IP0;function UP0($){let{gen:I,schema:U,keyword:Y,it:J}=$;if(!Array.isArray(U))throw Error("ajv implementation error");if(U.some((H)=>(0,jT.alwaysValidSchema)(J,H))&&!J.opts.unevaluated)return;le Line truncated
missingProperty: ${Y},
depsCount: ${I},
deps: ${U}}`};var qv0={keyword:"dependencies",type:"object",schemaType:"object",error:Ap.error,code($){let[I,U]=Hv0($);Np($,I),Mp($,U)}};function Hv0({schema:$}){let I={},U={};for(let Y in $){if(Y==="__proto__")continue;let J=Array.isArray($[Y])?I:U;J[Y]=$[Y]}return[I,U]}function Np($,I=$.schema){let{gen:U,data:Y,it:J}=$;if(Object.keys(I).length===0)return;let Q=U.let("missing");for(let K in I){let q=I[K];if(q.length===0)continue;let H=(0,Y2.propertyInData)(U,Y,K,J.opts.ownProperties);if($.setParams({property:K,depsCount:q.length,deps:q.join(", ")}),J.allErrors)U.if(H,()=>{for(let G of q)(0,Y2.checkReportMissingProp)($,G)});else U.if(oT._`${H} && (${(0,Y2.checkMissingProp)($,q,Q)})`),(0,Y2.reportMissingProp)($,Q),U.else()}}Ap.validatePropertyDeps=Np;function Mp($,I=$.schema){let{gen:U,data:Y,keyword:J,it:Q}=$,K=U.name("valid");for(let q in I){if((0,Kv0.alwaysValidSchema)(Q,I[q]))continue;U.if((0,Y2.propertyInData)(U,Y,q,Q.opts.ownProperties),()=>{let H=$.subschema({keyword:J,schemaProp:q},K);$.mergeValidEvaluated(H,K)},()=>U.var(K,!0)),$.ok(K)}}Ap.validateSchemaDeps=Mp;Ap.default=qv0});var Rp=O((vp)=>{Object.defineProperty(vp,"__esModule",{value:!0});var Bp=s0(),wv0=V1(),Vv0={message:"property name must be valid",params:({params:$})=>Bp._`{propertyName: ${$.propertyName}}`},Zv0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Vv0,code($){let{gen:I,schema:U,data:Y,it:J}=$;if((0,wv0.alwaysValidSchema)(J,U))return;let Q=I.name("valid");I.forIn("key",Y,(K)=>{$.setParams({propertyName:K}),$.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},Q),I.if((0,Bp.not)(Q),()=>{if($.error(!0),!J.allErrors)I.break()})}),$.ok(Q)}};vp.default=Zv0});var rT=O((Cp)=>{Object.defineProperty(Cp,"__esModule",{value:!0});var Zw=M$(),m$=s0(),Xv0=J5(),zw=V1(),Lv0={message:"must NOT have additional properties",params:({params:$})=>m$._`{additionalProperty: ${$.additionalProperty}}`},Dv0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Lv0,code($){let{gen:I,schema:U,parentSchema:Y,data:J,errsCount:Q,it:K}=$;if(!Q)throw Error("ajv implementation error");let{allErrors:q,opts:H}=K;if(K.props=!0,H.removeAdditional!=="all"&&(0,zw.alwaysValidSchema)(K,U))return;let G=(0,Zw.allSchemaProperties)(Y.properties),W=(0,Zw.allSchemaProperties)(Y.patternProperties);w(),$.ok(m$._`${Q} === ${Xv0.default.errors}`);function w(){I.forIn("key",J,(D)=>{if(!G.length&&!W.length)X(D);else I.if(V(D),()=>X(D))})}function V(D){let F;if(G.length>8){let E=(0,zw.schemaRefOrVal)(K,Y.properties,"properties");F=(0,Zw.isOwnProperty)(I,E,D)}else if(G.length)F=(0,m$.or)(...G.map((E)=>m$._`${D} === ${E}`));else F=m$.nil;if(W.length)F=(0,m$.or)(F,...W.map((E)=>m$._`${(0,Zw.usePattern)($,E)}.test(${D})`));return(0,m$.not)(F)}function Z(D){I.code(m$._`delete ${J}[${D}]`)}function X(D){if(H.removeAdditional==="all"||H.removeAdditional&&U===!1){Z(D);return}if(U===!1){if($.setParams({additionalProperty:D}),$.error(),!q)I.break();return}if(typeof U=="object"&&!(0,zw.alwaysValidSchema)(K,U)){let F=I.name("valid");if(H.removeAdditional==="failing")L(D,F,!1),I.if((0,m$.not)(F),()=>{$.reset(),Z(D)});else if(L(D,F),!q)I.if((0,m$.not)(F),()=>I.break())}}function L(D,F,E){let T={keyword:"additionalProperties",dataProp:D,dataPropType:zw.Type.Str};if(E===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,F)}}};Cp.default=Dv0});var Sp=O((gp)=>{Object.defineProperty(gp,"__esModule",{value:!0});var Fv0=dQ(),jp=M$(),tT=V1(),_p=rT(),Nv0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,parentSchema:Y,data:J,it:Q}=$;if(Q.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)_p.default.code(new Fv0.KeywordCxt(Q,_p.default,"additionalProperties"));let K=(0,jp.allSchemaProperties)(U);for(let w of K)Q.definedProperties.add(w);if(Q.opts.unevaluated&&K.length&&Q.props!==!0)Q.props=tT.mergeEvaluated.props(I,(0,tT.toHash)(K),Q.props);let q=K.filter((w)=>!(0,tT.alwaysValidSchema)(Q,U[w]));if(q.length===0)return;let H=I.name("valid");for(let w of q){if(G(w))W(w);else{if(I.if((0,jp.propertyInData)(I,J,w,Q.opts.ownProperties)),W(w),!Q.allErrors)I.else().var(H,!0);I.endIf()}$.it.definedProperties.add(w),$.ok(H)}function G(w){return Q.opts.useDefaults&&!Q.compositeRule&&U[w].default!==void 0}function W(w){$.subschema({keyword:"properties",schemaProp:w,dataProp:w},H)}}};gp.default=Nv0});var kp=O((xp)=>{Object.defineProperty(xp,"__esModule",{value:!0});var yp=M$(),Xw=s0(),hp=V1(),up=V1(),Av0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,data:Y,parentSchema:J,it:Q}=$,{opts:K}=Q,q=(0,yp.allSchemaProperties)(U),H=q.filter((L)=>(0,hp.alwaysValidSchema)(Q,U[L]));if(q.length===0||H.length===q.length&&(!Q.opts.unevaluated||Q.props===!0))return;let G=K.strictSchema&&!K.allowMatchingProperties&&J.properties,W=I.name("valid");if(Q.props!==!0&&!(Q.props instanceo Line truncated
\x00`,n+=m1(i,2),n+=q.magic,n+=m1(D,2),n+=m1(F,2),n+=m1(S.crc32,4),n+=m1(S.compressedSize,4),n+=m1(S.uncompressedSize,4),n+=m1(G.length,2),n+=m1(E.length,2);var g=cV.LOCAL_FILE_HEADER+n+G+E,f=cV.CENTRAL_FILE_HEADER+m1(p,2)+n+m1(V.length,2)+"\x00\x00\x00\x00"+m1(C,4)+m1(Y,4)+G+E+V;return{fileRecord:g,dirRecord:f}},tu0=function($,I,U,Y,J){var Q="",K=dU.transformTo("string",J(Y));return Q=cV.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+m1($,2)+m1($,2)+m1(I,4)+m1(U,4)+m1(K.length,2)+K,Q},au0=function($){var I="";return I=cV.DATA_DESCRIPTOR+m1($.crc32,4)+m1($.compressedSize,4)+m1($.uncompressedSize,4),I};function e$($,I,U,Y){mU.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=I,this.zipPlatform=U,this.encodeFileName=Y,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}dU.inherits(e$,mU);e$.prototype.push=function($){var I=$.meta.percent||0,U=this.entriesCount,Y=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,mU.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(I+100*(U-Y-1))/U:100}})};e$.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var I=this.streamFiles&&!$.file.dir;if(I){var U=ga($,I,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};e$.prototype.closedSource=function($){this.accumulate=!1;var I=this.streamFiles&&!$.file.dir,U=ga($,I,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),I)this.push({data:au0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};e$.prototype.flush=function(){var $=this.bytesWritten;for(var I=0;I<this.dirRecords.length;I++)this.push({data:this.dirRecords[I],meta:{percent:100}});var U=this.bytesWritten-$,Y=tu0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:Y,meta:{percent:100}})};e$.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};e$.prototype.registerPrevious=function($){this._sources.push($);var I=this;return $.on("data",function(U){I.processChunk(U)}),$.on("end",function(){if(I.closedSource(I.previous.streamInfo),I._sources.length)I.prepareNextSource();else I.end()}),$.on("error",function(U){I.error(U)}),this};e$.prototype.resume=function(){if(!mU.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};e$.prototype.error=function($){var I=this._sources;if(!mU.prototype.error.call(this,$))return!1;for(var U=0;U<I.length;U++)try{I[U].error($)}catch(Y){}return!0};e$.prototype.lock=function(){mU.prototype.lock.call(this);var $=this._sources;for(var I=0;I<$.length;I++)$[I].lock()};Sa.exports=e$});var ha=O((Ix0)=>{var su0=Cv(),eu0=ya(),$x0=function($,I){var U=$||I,Y=su0[U];if(!Y)throw Error(U+" is not a valid compression method !");return Y};Ix0.generateWorker=function($,I,U){var Y=new eu0(I.streamFiles,U,I.platform,I.encodeFileName),J=0;try{$.forEach(function(Q,K){J++;var q=$x0(K.options.compression,I.compression),H=K.options.compressionOptions||I.compressionOptions||{},G=K.dir,W=K.date;K._compressWorker(q,H).withStreamInfo("file",{name:Q,dir:G,date:W,comment:K.comment||"",unixPermissions:K.unixPermissions,dosPermissions:K.dosPermissions}).pipe(Y)}),Y.entriesCount=J}catch(Q){Y.error(Q)}return Y}});var xa=O((IP1,ua)=>{var Yx0=W4(),dV=Q$();function QK($,I){dV.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(I)}Yx0.inherits(QK,dV);QK.prototype._bindStream=function($){var I=this;this._stream=$,$.pause(),$.on("data",function(U){I.push({data:U,meta:{percent:0}})}).on("error",function(U){if(I.isPaused)this.generatedError=U;else I.error(U)}).on("end",function(){if(I.isPaused)I._upstreamEnded=!0;else I.end()})};QK.prototype.pause=function(){if(!dV.prototype.pause.call(this))return!1;return this._stream.pause(),!0};QK.prototype.resume=function(){if(!dV.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};ua.exports=QK});var la=O((UP1,ma)=>{var Jx0=hU(),KK=W4(),ba=Q$(),Qx0=hB(),na=uB(),ka=BV(),Kx0=fr(),qx0=ha(),fa=k2(),Hx0=xa(),pa=function($,I,U){var Y=KK.getTypeOf(I),J,Q=KK.extend(U||{},na);if(Q.date=Q.date||new Date,Q.compression!==null)Q.compression=Q.compression.toUpperCase();if(typeof Q.unixPermissions==="string")Q.unixPermissions=parseInt(Q.unixPermissions,8);if(Q.unixPermissions&&Q.unixPermissions&16384)Q.dir=!0;if(Q.dosPermissions&&Q.dosPermissions&16)Q.dir=!0;if(Q. Line truncated
`)}openNode($,I){let U=this.tos,Y=this._xml;if(U&&this.open)Y.push(">");this._stack.push($),Y.push("<"),Y.push($),ZR(Y,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)xe(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");ZR(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(ue.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,U){if(this.openNode($,I),U!==void 0)this.writeText(U);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("")}}zR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};ke.exports=zR});var XR=O((ef0)=>{var fe=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function sf0($){if(typeof $==="string")return $;if(fe)return fe.decode($);return $.toString()}ef0.bufferToString=sf0});var ce=O((be)=>{Object.defineProperty(be,"__esModule",{value:!0});be.CHAR=`
\r -퟿-�\uD800\uDC00-\uDBFF\uDFFF`;be.S=` \r
`;be.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";be.NAME_CHAR="-"+be.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";be.CHAR_RE=new RegExp("^["+be.CHAR+"]$","u");be.S_RE=new RegExp("^["+be.S+"]+$","u");be.NAME_START_CHAR_RE=new RegExp("^["+be.NAME_START_CHAR+"]$","u");be.NAME_CHAR_RE=new RegExp("^["+be.NAME_CHAR+"]$","u");be.NAME_RE=new RegExp("^["+be.NAME_START_CHAR+"]["+be.NAME_CHAR+"]*$","u");be.NMTOKEN_RE=new RegExp("^["+be.NAME_CHAR+"]+$","u");var LR=9,DR=10,OR=13,FR=32;be.S_LIST=[FR,DR,OR,LR];function Ii0($){return $>=FR&&$<=55295||$===DR||$===OR||$===LR||$>=57344&&$<=65533||$>=65536&&$<=1114111}be.isChar=Ii0;function Ui0($){return $===FR||$===DR||$===OR||$===LR}be.isS=Ui0;function ie($){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}be.isNameStartChar=ie;function Yi0($){return ie($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}be.isNameChar=Yi0});var $00=O((te)=>{Object.defineProperty(te,"__esModule",{value:!0});te.CHAR="\x01-퟿-�\uD800\uDC00-\uDBFF\uDFFF";te.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F-„†-Ÿ";te.S=` \r
`;te.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";te.NAME_CHAR="-"+te.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";te.CHAR_RE=new RegExp("^["+te.CHAR+"]$","u");te.RESTRICTED_CHAR_RE=new RegExp("^["+te.RESTRICTED_CHAR+"]$","u");te.S_RE=new RegExp("^["+te.S+"]+$","u");te.NAME_START_CHAR_RE=new RegExp("^["+te.NAME_START_CHAR+"]$","u");te.NAME_CHAR_RE=new RegExp("^["+te.NAME_CHAR+"]$","u");te.NAME_RE=new RegExp("^["+te.NAME_START_CHAR+"]["+te.NAME_CHAR+"]*$","u");te.NMTOKEN_RE=new RegExp("^["+te.NAME_CHAR+"]+$","u");var de=9,me=10,le=13,oe=32;te.S_LIST=[oe,me,le,de];function Xi0($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}te.isChar=Xi0;function Li0($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}te.isRestrictedChar=Li0;function Di0($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}te.isCharAndNotRestricted=Di0;function Oi0($){return $===oe||$===me||$===le||$===de}te.isS=Oi0;function re($){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}te.isNameStartChar=re;function Fi0($){return re($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}te.isNameChar=Fi0});var Y00=O((U00)=>{Object.defineProperty(U00,"__esModule",{value:!0});U00.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";U00.NC_NAME_CHAR="-"+U00.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";U00.NC_NAME_START_CHAR_RE=new RegExp("^["+U00.NC_NAME_START_CHAR+"]$","u");U00.NC_NAME_CHAR_RE=new RegExp("^["+U00.NC_NAME_CHAR+"]$","u");U00.NC_NAME_RE=new RegExp("^["+U00.NC_NAME_START_CHAR+"]["+U00.NC_NAME_CHAR+"]*$","u");function I00($){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}U00.isNCNameStartChar=I00;function yi0($){return I00($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}U00.isNCNameChar=yi0});var E00=O((T00)=>{Object.defineProperty(T00,"__esModule",{value:!0});var YY=ce(),ii0=$00(),SR=Y00(),d6=YY.isS,bi0=YY.isChar,FK=YY.isNameStartChar,J00=YY.isNameChar,O00=YY.S_LIST,ni0=YY.NAME_RE,pi0=ii0.isChar,ci0=SR.isNCNameStartChar,di0=SR.isNCNameChar,mi0=SR.NC_NAME_RE,NZ="http://www.w3.org/XML/1998/namespace",UY="http://www.w3.org/2000/xmlns/",li0={__proto__:null,xml:NZ,xmlns:UY},oi0={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},K4=-1,C8=-2,Q00=0,ri0=1,MR=2,ti0=3,eU=4,ai0=5,si0=6,ei0=7,AR=8,$b0=9,Ib0=10,Ub0=11,Yb0=12,_6=13,XZ=14,PR=15,Jb0=16,TR=17,Qb0=18,Kb0=19,ER=20,qb0=21,Hb0=22,Gb0=23,K00=24,BR=25,LZ=26,q00=27,Wb0=28,wb0=29,H00=30,Vb0=31,Zb0=32,G3=33,zb0=34,vR=35,NK=36,RR=37,Xb0=38,G00=39,W00=40,Lb0=41,w00=42,Db0=43,Ob0=44,CR=9,I8=10,jR=13,V00=32,Z00=33,F00=34,MK=38,N00=39,DZ=45,OZ=47,Fb0=59,x9=60,$Y=61,y4=62,U6=63,M00=91,IY=93,z00=133,X00=8232,FZ=($)=>$===F00||$===N00,A00=[F00,N00],Nb0=[...A00,M00,y4],Mb0=[...A00,x9,IY],Ab0=[$Y,U6,...O00],Pb0=[...O00,y4,MK,x9];function gR($,I,U){switch(I){case"xml":if(U!==NZ)$.fail(`xml prefix must be bound to ${NZ}.`);break;case"xmlns":if(U!==UY)$.fail(`xmlns prefix must be bound to ${UY}.`);break;default:}switch(U){case UY:$.fail(I===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${UY}.`);break;case NZ:switch(I){case"xml":break;case"":$.fail(`the default namespace may not be set to ${U}.`);break;default:$.fail("may not assign the xml namespace to another prefix.")}break;default:}}function Tb0($,I){for(let U of Object.keys(I))gR($,U,I[U])}var Eb0=($)=>mi0.test($),Bb0=($)=>ni0.test($),W3=0,L00=1,_R=2;T00.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var D00={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 P00{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let I=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,I){this.nameStartCheck=ci0,this.nameCheck=di0,this.isName=Eb0,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},li0);let U=this.opt.additionalNamespaces;if(U!=null)Tb0(this,U),Object.assign Line truncated
`,I=this.i}}captureToChar($){let{i:I}=this,{chunk:U}=this;while(!0){let Y=this.getCode();switch(Y){case C8:this.text+=`${U.slice(I,this.prevI)}
`,I=this.i,Y=I8;break;case K4:return this.text+=U.slice(I),!1;default:}if(Y===$)return this.text+=U.slice(I,this.prevI),!0}}captureNameChars(){let{chunk:$,i:I}=this;while(!0){let U=this.getCode();if(U===K4)return this.name+=$.slice(I),K4;if(!J00(U))return this.name+=$.slice(I,this.prevI),U===C8?I8:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===K4||!d6($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=bi0,this.getCode=this.getCode10;else this.isChar=pi0,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=ri0}sBeginWhitespace(){let $=this.i,I=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(I){case x9:if(this.state=PR,this.text.length!==0)throw Error("no-empty text at start");break;case K4:break;default:this.unget(),this.state=_6,this.xmlDeclPossible=!1}}sDoctype(){var $;let I=this.captureTo(Nb0);switch(I){case y4:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=_6,this.doctype=!0;break}case K4:break;default:if(this.text+=String.fromCodePoint(I),I===M00)this.state=eU;else if(FZ(I))this.state=ti0,this.q=I}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=MR}sDTD(){let $=this.captureTo(Mb0);if($===K4)return;if(this.text+=String.fromCodePoint($),$===IY)this.state=MR;else if($===x9)this.state=si0;else if(FZ($))this.state=ai0,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=eU,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case Z00:this.state=ei0,this.openWakaBang="";break;case U6:this.state=Ub0;break;default:this.state=eU}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),I=this.openWakaBang+=$;if(this.text+=$,I!=="-")this.state=I==="--"?AR:eU,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(DZ))this.text+="-",this.state=$b0}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===DZ?Ib0:AR}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===y4)this.state=eU;else this.fail("malformed comment."),this.state=AR}sDTDPI(){if(this.captureToChar(U6))this.text+="?",this.state=Yb0}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===y4)this.state=eU}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:I}=this;$:while(!0)switch(this.getCode()){case C8:this.entity+=`${I.slice($,this.prevI)}
`,$=this.i;break;case Fb0:{let{entityReturnState:U}=this,Y=this.entity+I.slice($,this.prevI);this.state=U;let J;if(Y==="")this.fail("empty entity name."),J="&;";else J=this.parseEntity(Y),this.entity="";if(U!==_6||this.textHandler!==void 0)this.text+=J;break $}case K4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(FK($))this.state=zb0,this.unget(),this.xmlDeclPossible=!1;else switch($){case OZ:this.state=Db0,this.xmlDeclPossible=!1;break;case Z00:this.state=Jb0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case U6:this.state=Gb0;break;default:this.fail("disallowed character in tag name"),this.state=_6,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=ER,this.openWakaBang="";break;case"--":this.state=TR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=MR,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(DZ))this.state=Qb0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===DZ)this.state=Kb0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=TR}sCommentEnded(){let $=this.getCodeNorm();if($!==y4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=TR;else this.state=_6}sCData(){if(this.captureToChar(IY))this.state=qb0}sCDataEnding(){let $=this.getCodeNorm();if($===IY)this.state=Hb0;else this.text+=`]${String.fromCodePoint($)}`,this.state=ER}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case y4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=_6;break}case IY:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=ER}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=K00;else if($===U6||d6($))this.fail("processing instruction without a target."),this.state=$===U6?LZ:BR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=K00}sPIRest(){let{chunk:$,i:I}=this;while(!0){let U=this.getCodeNorm();if(U===K4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(I,this.prevI);let Y=U===U6;if(Y||d6(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=Y?G3:q00}else this.state=Y?LZ:BR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===U6)this.state=LZ;else if(!d6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(U6))this.state=LZ}sPIEnding(){var $;let I=this.getCodeNorm();if(I===y4){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=_6}else if(I===U6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=BR;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===U6){this.state=G3;return}if($!==K4)this.state=Wb0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Ab0);if($===U6){this.state=G3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(d6($)||$===$Y))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=$===$Y?H00:wb0}sXMLDeclEq(){let $=this.getCodeNorm();if($===U6){this.state=G3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if($!==$Y)this.fail("value required.");this.state=H00}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===U6){this.state=G3,this.fail("XML declaration is incomplete.");return}if(d6($))return;if(!FZ($))this.fail("value must be quoted."),this.q=V00;else this.q=$;this.state=Vb0}sXMLDeclValue(){let $=this.captureTo([this.q,U6]);if($===U6){this.state=G3,this.text="",this.fail("XML declaration is incomplete.");return}if($===K4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=I;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver Line truncated
`;$=this.i,I=W3;break;case K4:if(Y!==void 0)this.text+=U.slice($);break $;default:I=W3}this.forbiddenState=I}handleTextOutsideRoot(){let{i:$}=this,{chunk:I,textHandler:U}=this,Y=!1;$:while(!0){let J=this.getCode();switch(J){case x9:{if(this.state=PR,U!==void 0){let{text:Q}=this,K=I.slice($,this.prevI);if(Q.length!==0)U(Q+K),this.text="";else if(K.length!==0)U(K)}break $}case MK:if(this.state=XZ,this.entityReturnState=_6,U!==void 0)this.text+=I.slice($,this.prevI);Y=!0;break $;case C8:if(U!==void 0)this.text+=`${I.slice($,this.prevI)}
`;$=this.i;break;case K4:if(U!==void 0)this.text+=I.slice($);break $;default:if(!d6(J))Y=!0}}if(!Y)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($,I){var U;let{prefix:Y,local:J}=this.qname($),Q={name:$,prefix:Y,local:J,value:I};if(this.attribList.push(Q),(U=this.attributeHandler)===null||U===void 0||U.call(this,Q),Y==="xmlns"){let K=I.trim();if(this.currentXMLVersion==="1.0"&&K==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[J]=K,gR(this,J,K)}else if($==="xmlns"){let K=I.trim();this.topNS[""]=K,gR(this,"",K)}}pushAttribPlain($,I){var U;let Y={name:$,value:I};this.attribList.push(Y),(U=this.attributeHandler)===null||U===void 0||U.call(this,Y)}end(){var $,I;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:U}=this;while(U.length>0){let J=U.pop();this.fail(`unclosed tag: ${J.name}`)}if(this.state!==Q00&&this.state!==_6)this.fail("unexpected end.");let{text:Y}=this;if(Y.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,Y),this.text="";return this._closed=!0,(I=this.endHandler)===null||I===void 0||I.call(this),this._init(),this}resolve($){var I,U;let Y=this.topNS[$];if(Y!==void 0)return Y;let{tags:J}=this;for(let Q=J.length-1;Q>=0;Q--)if(Y=J[Q].ns[$],Y!==void 0)return Y;if(Y=this.ns[$],Y!==void 0)return Y;return(U=(I=this.opt).resolvePrefix)===null||U===void 0?void 0:U.call(I,$)}qname($){let I=$.indexOf(":");if(I===-1)return{prefix:"",local:$};let U=$.slice(I+1),Y=$.slice(0,I);if(Y===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:Y,local:U}}processAttribsNS(){var $;let{attribList:I}=this,U=this.tag;{let{prefix:Q,local:K}=this.qname(U.name);U.prefix=Q,U.local=K;let q=U.uri=($=this.resolve(Q))!==null&&$!==void 0?$:"";if(Q!==""){if(Q==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(q==="")this.fail(`unbound namespace prefix: ${JSON.stringify(Q)}.`),U.uri=Q}}if(I.length===0)return;let{attributes:Y}=U,J=new Set;for(let Q of I){let{name:K,prefix:q,local:H}=Q,G,W;if(q==="")G=K==="xmlns"?UY:"",W=K;else{if(G=this.resolve(q),G===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(q)}.`),G=q;W=`{${G}}${H}`}if(J.has(W))this.fail(`duplicate attribute: ${W}.`);J.add(W),Q.uri=G,Y[K]=Q}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,I=this.tag.attributes;for(let{name:U,value:Y}of $){if(I[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);I[U]=Y}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:I}=this,U=this.tag;U.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,U),I.push(U),this.state=_6,this.name=""}openSelfClosingTag(){var $,I,U;this.processAttribs();let{tags:Y}=this,J=this.tag;if(J.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,J),(I=this.closeTagHandler)===null||I===void 0||I.call(this,J),(this.tag=(U=Y[Y.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=_6,this.name=""}closeTag(){let{tags:$,name:I}=this;if(this.state=_6,this.name="",I===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,Y=$.length;while(Y-- >0){let J=this.tag=$.pop();if(this.topNS=J.ns,U===null||U===void 0||U(J),J.name===I)break;this.fail("unexpected close tag.")}if(Y===0)this.closedRoot=!0;else if(Y<0)this.fail(`unmatched closing tag: ${I}.`),this.text+=`</${I}>`}parseEntity($){if($[0]!=="#"){let U=this.ENTITIES[$];if(U!==void 0)return U;return this.fail(this.isName($)?"undefined entity.":"disallowed character in entity name."),`&${$};`}let I=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))I=parseInt($.slice(2),16);else if(/^#[0-9]+$/.test($))I=parseInt($.slice(1),10);if(!this.isChar(I))return this.fail("malformed character entity."),`&${$};`;return String.fromCodePoint(I)}}T00.SaxesParser=P00});var AK=O((fP1,B00)=>{var{SaxesParser:Cb0}=E00(),{PassThrough:jb0}=L6(),{bufferToString:_b0}=XR();B00.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new jb0);let I=new Cb0,U;I.on("error",(J)=>{U=J});let Y=[];I.on("opentag",(J)=>Y.push({eventType:"opentag",value:J})),I.on("text",(J)=>Y.push({eventType:"text",value:J})),I.on("closetag",(J)=>Y.push({eventType:"closetag",value:J}));for await(let J of $){if(I.write(_b0(J)),U)throw U;yield Y,Y=[]}}});var X0=O((iP1,v00)=>{var gb0=AK(),Sb0=I6();class JY{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,I){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof JY)$.reset();else if($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}async parse($){for await(let I of $)for(let{eventType:U,value:Y}of I)if(U==="opentag")this.parseOpen(Y);else if(U==="text")this.parseText(Y);else if(U==="closetag"){if(!this.parseClose(Y.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&&((I=$.writeHeaders)!==null&&I!==void 0?I:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}Y90.FormatterOptions=U90});var eZ=O((wB1,H90)=>{var pl0="[object AsyncFunction]",cl0="[object Function]",dl0="[object GeneratorFunction]",ml0="[object Null]",ll0="[object Proxy]",ol0="[object Undefined]",rl0=typeof global=="object"&&global&&global.Object===Object&&global,tl0=typeof self=="object"&&self&&self.Object===Object&&self,al0=rl0||tl0||Function("return this")(),K90=Object.prototype,sl0=K90.hasOwnProperty,q90=K90.toString,Q90=al0.Symbol,D3=Q90?Q90.toStringTag:void 0;function el0($){if($==null)return $===void 0?ol0:ml0;return D3&&D3 in Object($)?$o0($):Io0($)}function $o0($){var I=sl0.call($,D3),U=$[D3];try{$[D3]=void 0;var Y=!0}catch(Q){}var J=q90.call($);if(Y)if(I)$[D3]=U;else delete $[D3];return J}function Io0($){return q90.call($)}function Uo0($){if(!Yo0($))return!1;var I=el0($);return I==cl0||I==dl0||I==pl0||I==ll0}function Yo0($){var I=typeof $;return $!=null&&(I=="object"||I=="function")}H90.exports=Uo0});var p90=O(($z,zY)=>{var Jo0=200,Uj="__lodash_hash_undefined__",Hz=1,N90=2,M90=9007199254740991,Iz="[object Arguments]",rC="[object Array]",Qo0="[object AsyncFunction]",A90="[object Boolean]",P90="[object Date]",T90="[object Error]",E90="[object Function]",Ko0="[object GeneratorFunction]",Uz="[object Map]",B90="[object Number]",qo0="[object Null]",ZY="[object Object]",G90="[object Promise]",Ho0="[object Proxy]",v90="[object RegExp]",Yz="[object Set]",R90="[object String]",Go0="[object Symbol]",Wo0="[object Undefined]",tC="[object WeakMap]",C90="[object ArrayBuffer]",Jz="[object DataView]",wo0="[object Float32Array]",Vo0="[object Float64Array]",Zo0="[object Int8Array]",zo0="[object Int16Array]",Xo0="[object Int32Array]",Lo0="[object Uint8Array]",Do0="[object Uint8ClampedArray]",Oo0="[object Uint16Array]",Fo0="[object Uint32Array]",No0=/[\\^$.*+?()[\]{}|]/g,Mo0=/^\[object .+?Constructor\]$/,Ao0=/^(?:0|[1-9]\d*)$/,a1={};a1[wo0]=a1[Vo0]=a1[Zo0]=a1[zo0]=a1[Xo0]=a1[Lo0]=a1[Do0]=a1[Oo0]=a1[Fo0]=!0;a1[Iz]=a1[rC]=a1[C90]=a1[A90]=a1[Jz]=a1[P90]=a1[T90]=a1[E90]=a1[Uz]=a1[B90]=a1[ZY]=a1[v90]=a1[Yz]=a1[R90]=a1[tC]=!1;var j90=typeof global=="object"&&global&&global.Object===Object&&global,Po0=typeof self=="object"&&self&&self.Object===Object&&self,T5=j90||Po0||Function("return this")(),_90=typeof $z=="object"&&$z&&!$z.nodeType&&$z,W90=_90&&typeof zY=="object"&&zY&&!zY.nodeType&&zY,g90=W90&&W90.exports===_90,mC=g90&&j90.process,w90=function(){try{return mC&&mC.binding&&mC.binding("util")}catch($){}}(),V90=w90&&w90.isTypedArray;function To0($,I){var U=-1,Y=$==null?0:$.length,J=0,Q=[];while(++U<Y){var K=$[U];if(I(K,U,$))Q[J++]=K}return Q}function Eo0($,I){var U=-1,Y=I.length,J=$.length;while(++U<Y)$[J+U]=I[U];return $}function Bo0($,I){var U=-1,Y=$==null?0:$.length;while(++U<Y)if(I($[U],U,$))return!0;return!1}function vo0($,I){var U=-1,Y=Array($);while(++U<$)Y[U]=I(U);return Y}function Ro0($){return function(I){return $(I)}}function Co0($,I){return $.has(I)}function jo0($,I){return $==null?void 0:$[I]}function _o0($){var I=-1,U=Array($.size);return $.forEach(function(Y,J){U[++I]=[J,Y]}),U}function go0($,I){return function(U){return $(I(U))}}function So0($){var I=-1,U=Array($.size);return $.forEach(function(Y){U[++I]=Y}),U}var yo0=Array.prototype,ho0=Function.prototype,Gz=Object.prototype,lC=T5["__core-js_shared__"],S90=ho0.toString,_8=Gz.hasOwnProperty,Z90=function(){var $=/[^.]+$/.exec(lC&&lC.keys&&lC.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),y90=Gz.toString,uo0=RegExp("^"+S90.call(_8).replace(No0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),z90=g90?T5.Buffer:void 0,Qz=T5.Symbol,X90=T5.Uint8Array,h90=Gz.propertyIsEnumerable,xo0=yo0.splice,O3=Qz?Qz.toStringTag:void 0,L90=Object.getOwnPropertySymbols,ko0=z90?z90.isBuffer:void 0,fo0=go0(Object.keys,Object),aC=XY(T5,"DataView"),CK=XY(T5,"Map"),sC=XY(T5,"Promise"),eC=XY(T5,"Set"),$j=XY(T5,"WeakMap"),jK=XY(Object,"create"),io0=M3(aC),bo0=M3(CK),no0=M3(sC),po0=M3(eC),co0=M3($j),D90=Qz?Qz.prototype:void 0,oC=D90?D90.valueOf:void 0;function F3($){var I=-1,U=$==null?0:$.length;this.clear();while(++I<U){var Y=$[I];this.set(Y[0],Y[1])}}function do0(){this.__data__=jK?jK(null):{},this.size=0}function mo0($){var I=this.has($)&&delete this.__data__[$];return this.size-=I?1:0,I}function lo0($){var I=this.__data Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(I)}set headers($){this._headers=$}shouldQuote($,I){let U=I?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(er0.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,I,U){let Y=`${$t0.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:J}=this;if(J.quote!==""){if(Y.indexOf(J.quote)!==-1)return this.quoteField(Y.replace(this.REPLACE_REGEXP,J.escapedQuote))}if(Y.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(I,U))return this.quoteField(Y);return Y}quoteField($){let{quote:I}=this.formatterOptions;return`${I}${$}${I}`}}LY.FieldFormatter=s90});var qj=O((e90)=>{Object.defineProperty(e90,"__esModule",{value:!0});e90.isSyncTransform=void 0;e90.isSyncTransform=($)=>$.length===1});var U70=O((DY)=>{var I70=DY&&DY.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(DY,"__esModule",{value:!0});DY.RowFormatter=void 0;var Ut0=I70(eZ()),Yt0=I70(p90()),Jt0=Kj(),Qt0=qj();class A3{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new Jt0.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((I)=>I[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(Qt0.isSyncTransform($))return(I,U)=>{let Y=null;try{Y=$(I)}catch(J){return U(J)}return U(null,Y)};return(I,U)=>{$(I,U)}}set rowTransform($){if(!Ut0.default($))throw TypeError("The transform should be a function");this._rowTransform=A3.createTransform($)}format($,I){this.callTransformer($,(U,Y)=>{if(U)return I(U);if(!$)return I(null);let J=[];if(Y){let{shouldFormatColumns:Q,headers:K}=this.checkHeaders(Y);if(this.shouldWriteHeaders&&K&&!this.hasWrittenHeaders)J.push(this.formatColumns(K,!0)),this.hasWrittenHeaders=!0;if(Q){let q=this.gatherColumns(Y);J.push(this.formatColumns(q,!1))}}return I(null,J)})}finish($){let I=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));I.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)I.push(this.formatterOptions.rowDelimiter);return $(null,I)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let I=A3.gatherHeaders($);if(this.headers=I,this.fieldFormatter.headers=I,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!Yt0.default(I,$),headers:I}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((I)=>$[I]);if(A3.isRowHashArray($))return this.headers.map((I,U)=>{let Y=$[U];if(Y)return Y[1];return""});if(A3.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((I,U)=>$[U])}callTransformer($,I){if(!this._rowTransform)return I(null,$);return this._rowTransform($,I)}formatColumns($,I){let U=$.map((J,Q)=>this.fieldFormatter.format(J,Q,I)).join(this.formatterOptions.delimiter),{rowCount:Y}=this;if(this.rowCount+=1,Y)return[this.formatterOptions.rowDelimiter,U].join("");return U}}DY.RowFormatter=A3});var Y70=O((Vz)=>{Object.defineProperty(Vz,"__esModule",{value:!0});Vz.FieldFormatter=Vz.RowFormatter=void 0;var Kt0=U70();Object.defineProperty(Vz,"RowFormatter",{enumerable:!0,get:function(){return Kt0.RowFormatter}});var qt0=Kj();Object.defineProperty(Vz,"FieldFormatter",{enumerable:!0,get:function(){return qt0.FieldFormatter}})});var Hj=O((Q70)=>{Object.defineProperty(Q70,"__esModule",{value:!0});Q70.CsvFormatterStream=void 0;var Gt0=r("stream"),Wt0=Y70();class J70 extends Gt0.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new Wt0.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,I,U){let Y=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(J,Q)=>{if(J)return Y=!0,U(J);if(Q)Q.forEach((K)=>{this.push(Buffer.from(K,"utf8"))});return Y=!0,U()})}catch(J){if(Y)throw J;U(J)}}_flush($){this.rowFormatter.finish((I,U)=>{if(I)return $(I);if(U)U.forEach((Y)=>{this.push(Buffer.from(Y,"utf8"))});return $()})}}Q70.CsvFormatterStream=J70});var H70=O((N1)=>{var q70=N1&&N1.__createBinding||(Object.create?function($,I,U,Y){if(Y===void 0)Y=U;Object.defineProperty($,Y,{enumerable:!0,get:function(){return I[U]}})}:function($,I,U,Y){if(Y===void 0)Y=U;$[Y]=I[U]}),wt0=N1&&N1.__setModuleDefault||(Object.create?function($,I){Ob Line truncated
deps: ${U}}`};var Mv0={keyword:"dependencies",type:"object",schemaType:"object",error:Rp.error,code($){let[I,U]=Av0($);Bp($,I),vp($,U)}};function Av0({schema:$}){let I={},U={};for(let Y in $){if(Y==="__proto__")continue;let J=Array.isArray($[Y])?I:U;J[Y]=$[Y]}return[I,U]}function Bp($,I=$.schema){let{gen:U,data:Y,it:J}=$;if(Object.keys(I).length===0)return;let Q=U.let("missing");for(let K in I){let q=I[K];if(q.length===0)continue;let H=(0,J2.propertyInData)(U,Y,K,J.opts.ownProperties);if($.setParams({property:K,depsCount:q.length,deps:q.join(", ")}),J.allErrors)U.if(H,()=>{for(let G of q)(0,J2.checkReportMissingProp)($,G)});else U.if($E._`${H} && (${(0,J2.checkMissingProp)($,q,Q)})`),(0,J2.reportMissingProp)($,Q),U.else()}}Rp.validatePropertyDeps=Bp;function vp($,I=$.schema){let{gen:U,data:Y,keyword:J,it:Q}=$,K=U.name("valid");for(let q in I){if((0,Nv0.alwaysValidSchema)(Q,I[q]))continue;U.if((0,J2.propertyInData)(U,Y,q,Q.opts.ownProperties),()=>{let H=$.subschema({keyword:J,schemaProp:q},K);$.mergeValidEvaluated(H,K)},()=>U.var(K,!0)),$.ok(K)}}Rp.validateSchemaDeps=vp;Rp.default=Mv0});var yp=F((gp)=>{Object.defineProperty(gp,"__esModule",{value:!0});var Sp=a0(),Ev0=z1(),Bv0={message:"property name must be valid",params:({params:$})=>Sp._`{propertyName: ${$.propertyName}}`},vv0={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:Bv0,code($){let{gen:I,schema:U,data:Y,it:J}=$;if((0,Ev0.alwaysValidSchema)(J,U))return;let Q=I.name("valid");I.forIn("key",Y,(K)=>{$.setParams({propertyName:K}),$.subschema({keyword:"propertyNames",data:K,dataTypes:["string"],propertyName:K,compositeRule:!0},Q),I.if((0,Sp.not)(Q),()=>{if($.error(!0),!J.allErrors)I.break()})}),$.ok(Q)}};gp.default=vv0});var IE=F((hp)=>{Object.defineProperty(hp,"__esModule",{value:!0});var Xw=E$(),r$=a0(),jv0=K5(),Lw=z1(),Cv0={message:"must NOT have additional properties",params:({params:$})=>r$._`{additionalProperty: ${$.additionalProperty}}`},_v0={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:Cv0,code($){let{gen:I,schema:U,parentSchema:Y,data:J,errsCount:Q,it:K}=$;if(!Q)throw Error("ajv implementation error");let{allErrors:q,opts:H}=K;if(K.props=!0,H.removeAdditional!=="all"&&(0,Lw.alwaysValidSchema)(K,U))return;let G=(0,Xw.allSchemaProperties)(Y.properties),W=(0,Xw.allSchemaProperties)(Y.patternProperties);w(),$.ok(r$._`${Q} === ${jv0.default.errors}`);function w(){I.forIn("key",J,(D)=>{if(!G.length&&!W.length)X(D);else I.if(V(D),()=>X(D))})}function V(D){let O;if(G.length>8){let E=(0,Lw.schemaRefOrVal)(K,Y.properties,"properties");O=(0,Xw.isOwnProperty)(I,E,D)}else if(G.length)O=(0,r$.or)(...G.map((E)=>r$._`${D} === ${E}`));else O=r$.nil;if(W.length)O=(0,r$.or)(O,...W.map((E)=>r$._`${(0,Xw.usePattern)($,E)}.test(${D})`));return(0,r$.not)(O)}function Z(D){I.code(r$._`delete ${J}[${D}]`)}function X(D){if(H.removeAdditional==="all"||H.removeAdditional&&U===!1){Z(D);return}if(U===!1){if($.setParams({additionalProperty:D}),$.error(),!q)I.break();return}if(typeof U=="object"&&!(0,Lw.alwaysValidSchema)(K,U)){let O=I.name("valid");if(H.removeAdditional==="failing")L(D,O,!1),I.if((0,r$.not)(O),()=>{$.reset(),Z(D)});else if(L(D,O),!q)I.if((0,r$.not)(O),()=>I.break())}}function L(D,O,E){let T={keyword:"additionalProperties",dataProp:D,dataPropType:Lw.Type.Str};if(E===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});$.subschema(T,O)}}};hp.default=_v0});var fp=F((kp)=>{Object.defineProperty(kp,"__esModule",{value:!0});var gv0=mQ(),up=E$(),UE=z1(),xp=IE(),yv0={keyword:"properties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,parentSchema:Y,data:J,it:Q}=$;if(Q.opts.removeAdditional==="all"&&Y.additionalProperties===void 0)xp.default.code(new gv0.KeywordCxt(Q,xp.default,"additionalProperties"));let K=(0,up.allSchemaProperties)(U);for(let w of K)Q.definedProperties.add(w);if(Q.opts.unevaluated&&K.length&&Q.props!==!0)Q.props=UE.mergeEvaluated.props(I,(0,UE.toHash)(K),Q.props);let q=K.filter((w)=>!(0,UE.alwaysValidSchema)(Q,U[w]));if(q.length===0)return;let H=I.name("valid");for(let w of q){if(G(w))W(w);else{if(I.if((0,up.propertyInData)(I,J,w,Q.opts.ownProperties)),W(w),!Q.allErrors)I.else().var(H,!0);I.endIf()}$.it.definedProperties.add(w),$.ok(H)}function G(w){return Q.opts.useDefaults&&!Q.compositeRule&&U[w].default!==void 0}function W(w){$.subschema({keyword:"properties",schemaProp:w,dataProp:w},H)}}};kp.default=yv0});var cp=F((pp)=>{Object.defineProperty(pp,"__esModule",{value:!0});var bp=E$(),Dw=a0(),ip=z1(),np=z1(),uv0={keyword:"patternProperties",type:"object",schemaType:"object",code($){let{gen:I,schema:U,data:Y,parentSchema:J,it:Q}=$,{opts:K}=Q,q=(0,bp.allSchemaProperties)(U),H=q.filter((L)=>(0,ip.alwaysValidSchema)(Q,U[L]));if(q.length===0||H.length===q.length&&(!Q.opts.unevaluated||Q.props===!0))return;let G=K.strictSchema&&!K.allowMatchingProperties&&J.properties,W=I.name("valid");if(Q.props!==!0&&!(Q.props instanceo Line truncated
\x00`,n+=o1(f,2),n+=q.magic,n+=o1(D,2),n+=o1(O,2),n+=o1(g.crc32,4),n+=o1(g.compressedSize,4),n+=o1(g.uncompressedSize,4),n+=o1(G.length,2),n+=o1(E.length,2);var S=rV.LOCAL_FILE_HEADER+n+G+E,b=rV.CENTRAL_FILE_HEADER+o1(p,2)+n+o1(V.length,2)+"\x00\x00\x00\x00"+o1(j,4)+o1(Y,4)+G+E+V;return{fileRecord:S,dirRecord:b}},Zx0=function($,I,U,Y,J){var Q="",K=mU.transformTo("string",J(Y));return Q=rV.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+o1($,2)+o1($,2)+o1(I,4)+o1(U,4)+o1(K.length,2)+K,Q},zx0=function($){var I="";return I=rV.DATA_DESCRIPTOR+o1($.crc32,4)+o1($.compressedSize,4)+o1($.uncompressedSize,4),I};function U8($,I,U,Y){lU.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=I,this.zipPlatform=U,this.encodeFileName=Y,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}mU.inherits(U8,lU);U8.prototype.push=function($){var I=$.meta.percent||0,U=this.entriesCount,Y=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,lU.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(I+100*(U-Y-1))/U:100}})};U8.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var I=this.streamFiles&&!$.file.dir;if(I){var U=xa($,I,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};U8.prototype.closedSource=function($){this.accumulate=!1;var I=this.streamFiles&&!$.file.dir,U=xa($,I,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),I)this.push({data:zx0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};U8.prototype.flush=function(){var $=this.bytesWritten;for(var I=0;I<this.dirRecords.length;I++)this.push({data:this.dirRecords[I],meta:{percent:100}});var U=this.bytesWritten-$,Y=Zx0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:Y,meta:{percent:100}})};U8.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};U8.prototype.registerPrevious=function($){this._sources.push($);var I=this;return $.on("data",function(U){I.processChunk(U)}),$.on("end",function(){if(I.closedSource(I.previous.streamInfo),I._sources.length)I.prepareNextSource();else I.end()}),$.on("error",function(U){I.error(U)}),this};U8.prototype.resume=function(){if(!lU.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};U8.prototype.error=function($){var I=this._sources;if(!lU.prototype.error.call(this,$))return!1;for(var U=0;U<I.length;U++)try{I[U].error($)}catch(Y){}return!0};U8.prototype.lock=function(){lU.prototype.lock.call(this);var $=this._sources;for(var I=0;I<$.length;I++)$[I].lock()};ka.exports=U8});var ba=F((Fx0)=>{var Xx0=hv(),Lx0=fa(),Dx0=function($,I){var U=$||I,Y=Xx0[U];if(!Y)throw Error(U+" is not a valid compression method !");return Y};Fx0.generateWorker=function($,I,U){var Y=new Lx0(I.streamFiles,U,I.platform,I.encodeFileName),J=0;try{$.forEach(function(Q,K){J++;var q=Dx0(K.options.compression,I.compression),H=K.options.compressionOptions||I.compressionOptions||{},G=K.dir,W=K.date;K._compressWorker(q,H).withStreamInfo("file",{name:Q,dir:G,date:W,comment:K.comment||"",unixPermissions:K.unixPermissions,dosPermissions:K.dosPermissions}).pipe(Y)}),Y.entriesCount=J}catch(Q){Y.error(Q)}return Y}});var na=F((EP1,ia)=>{var Nx0=w4(),tV=G$();function qK($,I){tV.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(I)}Nx0.inherits(qK,tV);qK.prototype._bindStream=function($){var I=this;this._stream=$,$.pause(),$.on("data",function(U){I.push({data:U,meta:{percent:0}})}).on("error",function(U){if(I.isPaused)this.generatedError=U;else I.error(U)}).on("end",function(){if(I.isPaused)I._upstreamEnded=!0;else I.end()})};qK.prototype.pause=function(){if(!tV.prototype.pause.call(this))return!1;return this._stream.pause(),!0};qK.prototype.resume=function(){if(!tV.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};ia.exports=qK});var sa=F((BP1,aa)=>{var Mx0=uU(),HK=w4(),ma=G$(),Ax0=iB(),la=nB(),pa=_V(),Px0=cr(),Tx0=ba(),ca=b2(),Ex0=na(),oa=function($,I,U){var Y=HK.getTypeOf(I),J,Q=HK.extend(U||{},la);if(Q.date=Q.date||new Date,Q.compression!==null)Q.compression=Q.compression.toUpperCase();if(typeof Q.unixPermissions==="string")Q.unixPermissions=parseInt(Q.unixPermissions,8);if(Q.unixPermissions&&Q.unixPermissions&16384)Q.dir=!0;if(Q.dosPermissions&&Q.dosPermissions&16)Q.dir=!0;if(Q. Line truncated
`)}openNode($,I){let U=this.tos,Y=this._xml;if(U&&this.open)Y.push(">");this._stack.push($),Y.push("<"),Y.push($),OR(Y,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)ne(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");OR(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(ie.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,U){if(this.openNode($,I),U!==void 0)this.writeText(U);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("")}}NR.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};pe.exports=NR});var MR=F((Lb0)=>{var ce=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Xb0($){if(typeof $==="string")return $;if(ce)return ce.decode($);return $.toString()}Lb0.bufferToString=Xb0});var re=F((me)=>{Object.defineProperty(me,"__esModule",{value:!0});me.CHAR=`
\r -퟿-�\uD800\uDC00-\uDBFF\uDFFF`;me.S=` \r
`;me.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";me.NAME_CHAR="-"+me.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";me.CHAR_RE=new RegExp("^["+me.CHAR+"]$","u");me.S_RE=new RegExp("^["+me.S+"]+$","u");me.NAME_START_CHAR_RE=new RegExp("^["+me.NAME_START_CHAR+"]$","u");me.NAME_CHAR_RE=new RegExp("^["+me.NAME_CHAR+"]$","u");me.NAME_RE=new RegExp("^["+me.NAME_START_CHAR+"]["+me.NAME_CHAR+"]*$","u");me.NMTOKEN_RE=new RegExp("^["+me.NAME_CHAR+"]+$","u");var AR=9,PR=10,TR=13,ER=32;me.S_LIST=[ER,PR,TR,AR];function Fb0($){return $>=ER&&$<=55295||$===PR||$===TR||$===AR||$>=57344&&$<=65533||$>=65536&&$<=1114111}me.isChar=Fb0;function Ob0($){return $===ER||$===PR||$===TR||$===AR}me.isS=Ob0;function de($){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}me.isNameStartChar=de;function Nb0($){return de($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}me.isNameChar=Nb0});var Q00=F((I00)=>{Object.defineProperty(I00,"__esModule",{value:!0});I00.CHAR="\x01-퟿-�\uD800\uDC00-\uDBFF\uDFFF";I00.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F-„†-Ÿ";I00.S=` \r
`;I00.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";I00.NAME_CHAR="-"+I00.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";I00.CHAR_RE=new RegExp("^["+I00.CHAR+"]$","u");I00.RESTRICTED_CHAR_RE=new RegExp("^["+I00.RESTRICTED_CHAR+"]$","u");I00.S_RE=new RegExp("^["+I00.S+"]+$","u");I00.NAME_START_CHAR_RE=new RegExp("^["+I00.NAME_START_CHAR+"]$","u");I00.NAME_CHAR_RE=new RegExp("^["+I00.NAME_CHAR+"]$","u");I00.NAME_RE=new RegExp("^["+I00.NAME_START_CHAR+"]["+I00.NAME_CHAR+"]*$","u");I00.NMTOKEN_RE=new RegExp("^["+I00.NAME_CHAR+"]+$","u");var te=9,ae=10,se=13,ee=32;I00.S_LIST=[ee,ae,se,te];function Sb0($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}I00.isChar=Sb0;function gb0($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}I00.isRestrictedChar=gb0;function yb0($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}I00.isCharAndNotRestricted=yb0;function hb0($){return $===ee||$===ae||$===se||$===te}I00.isS=hb0;function $00($){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}I00.isNameStartChar=$00;function ub0($){return $00($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}I00.isNameChar=ub0});var H00=F((q00)=>{Object.defineProperty(q00,"__esModule",{value:!0});q00.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";q00.NC_NAME_CHAR="-"+q00.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";q00.NC_NAME_START_CHAR_RE=new RegExp("^["+q00.NC_NAME_START_CHAR+"]$","u");q00.NC_NAME_CHAR_RE=new RegExp("^["+q00.NC_NAME_CHAR+"]$","u");q00.NC_NAME_RE=new RegExp("^["+q00.NC_NAME_START_CHAR+"]["+q00.NC_NAME_CHAR+"]*$","u");function K00($){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}q00.isNCNameStartChar=K00;function ab0($){return K00($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}q00.isNCNameChar=ab0});var C00=F((j00)=>{Object.defineProperty(j00,"__esModule",{value:!0});var JY=re(),Yi0=Q00(),fR=H00(),r6=JY.isS,Ji0=JY.isChar,MK=JY.isNameStartChar,G00=JY.isNameChar,P00=JY.S_LIST,Qi0=JY.NAME_RE,Ki0=Yi0.isChar,qi0=fR.isNCNameStartChar,Hi0=fR.isNCNameChar,Gi0=fR.NC_NAME_RE,EZ="http://www.w3.org/XML/1998/namespace",YY="http://www.w3.org/2000/xmlns/",Wi0={__proto__:null,xml:EZ,xmlns:YY},wi0={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},H4=-1,g8=-2,W00=0,Vi0=1,vR=2,Zi0=3,$Y=4,zi0=5,Xi0=6,Li0=7,RR=8,Di0=9,Fi0=10,Oi0=11,Ni0=12,g6=13,NZ=14,jR=15,Mi0=16,CR=17,Ai0=18,Pi0=19,_R=20,Ti0=21,Ei0=22,Bi0=23,w00=24,SR=25,MZ=26,V00=27,vi0=28,Ri0=29,Z00=30,ji0=31,Ci0=32,W3=33,_i0=34,gR=35,AK=36,yR=37,Si0=38,z00=39,X00=40,gi0=41,L00=42,yi0=43,hi0=44,hR=9,J8=10,uR=13,D00=32,F00=33,T00=34,PK=38,E00=39,AZ=45,PZ=47,ui0=59,k9=60,IY=61,y4=62,Y6=63,B00=91,UY=93,O00=133,N00=8232,TZ=($)=>$===T00||$===E00,v00=[T00,E00],xi0=[...v00,B00,y4],ki0=[...v00,k9,UY],fi0=[IY,Y6,...P00],bi0=[...P00,y4,PK,k9];function kR($,I,U){switch(I){case"xml":if(U!==EZ)$.fail(`xml prefix must be bound to ${EZ}.`);break;case"xmlns":if(U!==YY)$.fail(`xmlns prefix must be bound to ${YY}.`);break;default:}switch(U){case YY:$.fail(I===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${YY}.`);break;case EZ:switch(I){case"xml":break;case"":$.fail(`the default namespace may not be set to ${U}.`);break;default:$.fail("may not assign the xml namespace to another prefix.")}break;default:}}function ii0($,I){for(let U of Object.keys(I))kR($,U,I[U])}var ni0=($)=>Gi0.test($),pi0=($)=>Qi0.test($),w3=0,M00=1,xR=2;j00.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var A00={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 R00{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let I=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,I){this.nameStartCheck=qi0,this.nameCheck=Hi0,this.isName=ni0,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},Wi0);let U=this.opt.additionalNamespaces;if(U!=nu Line truncated
`,I=this.i}}captureToChar($){let{i:I}=this,{chunk:U}=this;while(!0){let Y=this.getCode();switch(Y){case g8:this.text+=`${U.slice(I,this.prevI)}
`,I=this.i,Y=J8;break;case H4:return this.text+=U.slice(I),!1;default:}if(Y===$)return this.text+=U.slice(I,this.prevI),!0}}captureNameChars(){let{chunk:$,i:I}=this;while(!0){let U=this.getCode();if(U===H4)return this.name+=$.slice(I),H4;if(!G00(U))return this.name+=$.slice(I,this.prevI),U===g8?J8:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===H4||!r6($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=Ji0,this.getCode=this.getCode10;else this.isChar=Ki0,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=Vi0}sBeginWhitespace(){let $=this.i,I=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(I){case k9:if(this.state=jR,this.text.length!==0)throw Error("no-empty text at start");break;case H4:break;default:this.unget(),this.state=g6,this.xmlDeclPossible=!1}}sDoctype(){var $;let I=this.captureTo(xi0);switch(I){case y4:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=g6,this.doctype=!0;break}case H4:break;default:if(this.text+=String.fromCodePoint(I),I===B00)this.state=$Y;else if(TZ(I))this.state=Zi0,this.q=I}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=vR}sDTD(){let $=this.captureTo(ki0);if($===H4)return;if(this.text+=String.fromCodePoint($),$===UY)this.state=vR;else if($===k9)this.state=Xi0;else if(TZ($))this.state=zi0,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=$Y,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case F00:this.state=Li0,this.openWakaBang="";break;case Y6:this.state=Oi0;break;default:this.state=$Y}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),I=this.openWakaBang+=$;if(this.text+=$,I!=="-")this.state=I==="--"?RR:$Y,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(AZ))this.text+="-",this.state=Di0}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===AZ?Fi0:RR}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===y4)this.state=$Y;else this.fail("malformed comment."),this.state=RR}sDTDPI(){if(this.captureToChar(Y6))this.text+="?",this.state=Ni0}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===y4)this.state=$Y}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:I}=this;$:while(!0)switch(this.getCode()){case g8:this.entity+=`${I.slice($,this.prevI)}
`,$=this.i;break;case ui0:{let{entityReturnState:U}=this,Y=this.entity+I.slice($,this.prevI);this.state=U;let J;if(Y==="")this.fail("empty entity name."),J="&;";else J=this.parseEntity(Y),this.entity="";if(U!==g6||this.textHandler!==void 0)this.text+=J;break $}case H4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(MK($))this.state=_i0,this.unget(),this.xmlDeclPossible=!1;else switch($){case PZ:this.state=yi0,this.xmlDeclPossible=!1;break;case F00:this.state=Mi0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case Y6:this.state=Bi0;break;default:this.fail("disallowed character in tag name"),this.state=g6,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=_R,this.openWakaBang="";break;case"--":this.state=CR,this.openWakaBang="";break;case"DOCTYPE":if(this.state=vR,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(AZ))this.state=Ai0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===AZ)this.state=Pi0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=CR}sCommentEnded(){let $=this.getCodeNorm();if($!==y4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=CR;else this.state=g6}sCData(){if(this.captureToChar(UY))this.state=Ti0}sCDataEnding(){let $=this.getCodeNorm();if($===UY)this.state=Ei0;else this.text+=`]${String.fromCodePoint($)}`,this.state=_R}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case y4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=g6;break}case UY:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=_R}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=w00;else if($===Y6||r6($))this.fail("processing instruction without a target."),this.state=$===Y6?MZ:SR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=w00}sPIRest(){let{chunk:$,i:I}=this;while(!0){let U=this.getCodeNorm();if(U===H4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(I,this.prevI);let Y=U===Y6;if(Y||r6(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=Y?W3:V00}else this.state=Y?MZ:SR;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(U);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===Y6)this.state=MZ;else if(!r6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(Y6))this.state=MZ}sPIEnding(){var $;let I=this.getCodeNorm();if(I===y4){let{piTarget:U}=this;if(U.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:U,body:this.text}),this.piTarget=this.text="",this.state=g6}else if(I===Y6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=SR;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===Y6){this.state=W3;return}if($!==H4)this.state=vi0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(fi0);if($===Y6){this.state=W3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(r6($)||$===IY))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=$===IY?Z00:Ri0}sXMLDeclEq(){let $=this.getCodeNorm();if($===Y6){this.state=W3,this.fail("XML declaration is incomplete.");return}if(r6($))return;if($!==IY)this.fail("value required.");this.state=Z00}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===Y6){this.state=W3,this.fail("XML declaration is incomplete.");return}if(r6($))return;if(!TZ($))this.fail("value must be quoted."),this.q=D00;else this.q=$;this.state=ji0}sXMLDeclValue(){let $=this.captureTo([this.q,Y6]);if($===Y6){this.state=W3,this.text="",this.fail("XML declaration is incomplete.");return}if($===H4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=I;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver Line truncated
`;$=this.i,I=w3;break;case H4:if(Y!==void 0)this.text+=U.slice($);break $;default:I=w3}this.forbiddenState=I}handleTextOutsideRoot(){let{i:$}=this,{chunk:I,textHandler:U}=this,Y=!1;$:while(!0){let J=this.getCode();switch(J){case k9:{if(this.state=jR,U!==void 0){let{text:Q}=this,K=I.slice($,this.prevI);if(Q.length!==0)U(Q+K),this.text="";else if(K.length!==0)U(K)}break $}case PK:if(this.state=NZ,this.entityReturnState=g6,U!==void 0)this.text+=I.slice($,this.prevI);Y=!0;break $;case g8:if(U!==void 0)this.text+=`${I.slice($,this.prevI)}
`;$=this.i;break;case H4:if(U!==void 0)this.text+=I.slice($);break $;default:if(!r6(J))Y=!0}}if(!Y)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($,I){var U;let{prefix:Y,local:J}=this.qname($),Q={name:$,prefix:Y,local:J,value:I};if(this.attribList.push(Q),(U=this.attributeHandler)===null||U===void 0||U.call(this,Q),Y==="xmlns"){let K=I.trim();if(this.currentXMLVersion==="1.0"&&K==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[J]=K,kR(this,J,K)}else if($==="xmlns"){let K=I.trim();this.topNS[""]=K,kR(this,"",K)}}pushAttribPlain($,I){var U;let Y={name:$,value:I};this.attribList.push(Y),(U=this.attributeHandler)===null||U===void 0||U.call(this,Y)}end(){var $,I;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:U}=this;while(U.length>0){let J=U.pop();this.fail(`unclosed tag: ${J.name}`)}if(this.state!==W00&&this.state!==g6)this.fail("unexpected end.");let{text:Y}=this;if(Y.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,Y),this.text="";return this._closed=!0,(I=this.endHandler)===null||I===void 0||I.call(this),this._init(),this}resolve($){var I,U;let Y=this.topNS[$];if(Y!==void 0)return Y;let{tags:J}=this;for(let Q=J.length-1;Q>=0;Q--)if(Y=J[Q].ns[$],Y!==void 0)return Y;if(Y=this.ns[$],Y!==void 0)return Y;return(U=(I=this.opt).resolvePrefix)===null||U===void 0?void 0:U.call(I,$)}qname($){let I=$.indexOf(":");if(I===-1)return{prefix:"",local:$};let U=$.slice(I+1),Y=$.slice(0,I);if(Y===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:Y,local:U}}processAttribsNS(){var $;let{attribList:I}=this,U=this.tag;{let{prefix:Q,local:K}=this.qname(U.name);U.prefix=Q,U.local=K;let q=U.uri=($=this.resolve(Q))!==null&&$!==void 0?$:"";if(Q!==""){if(Q==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(q==="")this.fail(`unbound namespace prefix: ${JSON.stringify(Q)}.`),U.uri=Q}}if(I.length===0)return;let{attributes:Y}=U,J=new Set;for(let Q of I){let{name:K,prefix:q,local:H}=Q,G,W;if(q==="")G=K==="xmlns"?YY:"",W=K;else{if(G=this.resolve(q),G===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(q)}.`),G=q;W=`{${G}}${H}`}if(J.has(W))this.fail(`duplicate attribute: ${W}.`);J.add(W),Q.uri=G,Y[K]=Q}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,I=this.tag.attributes;for(let{name:U,value:Y}of $){if(I[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);I[U]=Y}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:I}=this,U=this.tag;U.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,U),I.push(U),this.state=g6,this.name=""}openSelfClosingTag(){var $,I,U;this.processAttribs();let{tags:Y}=this,J=this.tag;if(J.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,J),(I=this.closeTagHandler)===null||I===void 0||I.call(this,J),(this.tag=(U=Y[Y.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=g6,this.name=""}closeTag(){let{tags:$,name:I}=this;if(this.state=g6,this.name="",I===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,Y=$.length;while(Y-- >0){let J=this.tag=$.pop();if(this.topNS=J.ns,U===null||U===void 0||U(J),J.name===I)break;this.fail("unexpected close tag.")}if(Y===0)this.closedRoot=!0;else if(Y<0)this.fail(`unmatched closing tag: ${I}.`),this.text+=`</${I}>`}parseEntity($){if($[0]!=="#"){let U=this.ENTITIES[$];if(U!==void 0)return U;return this.fail(this.isName($)?"undefined entity.":"disallowed character in entity name."),`&${$};`}let I=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))I=parseInt($.slice(2),16);else if(/^#[0-9]+$/.test($))I=parseInt($.slice(1),10);if(!this.isChar(I))return this.fail("malformed character entity."),`&${$};`;return String.fromCodePoint(I)}}j00.SaxesParser=R00});var TK=F((GT1,_00)=>{var{SaxesParser:mi0}=C00(),{PassThrough:li0}=D6(),{bufferToString:oi0}=MR();_00.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new li0);let I=new mi0,U;I.on("error",(J)=>{U=J});let Y=[];I.on("opentag",(J)=>Y.push({eventType:"opentag",value:J})),I.on("text",(J)=>Y.push({eventType:"text",value:J})),I.on("closetag",(J)=>Y.push({eventType:"closetag",value:J}));for await(let J of $){if(I.write(oi0(J)),U)throw U;yield Y,Y=[]}}});var L0=F((WT1,S00)=>{var ri0=TK(),ti0=U6();class QY{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,I){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof QY)$.reset();else if($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}async parse($){for await(let I of $)for(let{eventType:U,value:Y}of I)if(U==="opentag")this.parseOpen(Y);else if(U==="text")this.parseText(Y);else if(U==="closetag"){if(!this.parseClose(Y.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&&((I=$.writeHeaders)!==null&&I!==void 0?I:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}H90.FormatterOptions=q90});var Jz=F((hB1,Z90)=>{var Ko0="[object AsyncFunction]",qo0="[object Function]",Ho0="[object GeneratorFunction]",Go0="[object Null]",Wo0="[object Proxy]",wo0="[object Undefined]",Vo0=typeof global=="object"&&global&&global.Object===Object&&global,Zo0=typeof self=="object"&&self&&self.Object===Object&&self,zo0=Vo0||Zo0||Function("return this")(),w90=Object.prototype,Xo0=w90.hasOwnProperty,V90=w90.toString,W90=zo0.Symbol,F3=W90?W90.toStringTag:void 0;function Lo0($){if($==null)return $===void 0?wo0:Go0;return F3&&F3 in Object($)?Do0($):Fo0($)}function Do0($){var I=Xo0.call($,F3),U=$[F3];try{$[F3]=void 0;var Y=!0}catch(Q){}var J=V90.call($);if(Y)if(I)$[F3]=U;else delete $[F3];return J}function Fo0($){return V90.call($)}function Oo0($){if(!No0($))return!1;var I=Lo0($);return I==qo0||I==Ho0||I==Ko0||I==Wo0}function No0($){var I=typeof $;return $!=null&&(I=="object"||I=="function")}Z90.exports=Oo0});var o90=F((Qz,XY)=>{var Mo0=200,HC="__lodash_hash_undefined__",Zz=1,E90=2,B90=9007199254740991,Kz="[object Arguments]",IC="[object Array]",Ao0="[object AsyncFunction]",v90="[object Boolean]",R90="[object Date]",j90="[object Error]",C90="[object Function]",Po0="[object GeneratorFunction]",qz="[object Map]",_90="[object Number]",To0="[object Null]",zY="[object Object]",z90="[object Promise]",Eo0="[object Proxy]",S90="[object RegExp]",Hz="[object Set]",g90="[object String]",Bo0="[object Symbol]",vo0="[object Undefined]",UC="[object WeakMap]",y90="[object ArrayBuffer]",Gz="[object DataView]",Ro0="[object Float32Array]",jo0="[object Float64Array]",Co0="[object Int8Array]",_o0="[object Int16Array]",So0="[object Int32Array]",go0="[object Uint8Array]",yo0="[object Uint8ClampedArray]",ho0="[object Uint16Array]",uo0="[object Uint32Array]",xo0=/[\\^$.*+?()[\]{}|]/g,ko0=/^\[object .+?Constructor\]$/,fo0=/^(?:0|[1-9]\d*)$/,e1={};e1[Ro0]=e1[jo0]=e1[Co0]=e1[_o0]=e1[So0]=e1[go0]=e1[yo0]=e1[ho0]=e1[uo0]=!0;e1[Kz]=e1[IC]=e1[y90]=e1[v90]=e1[Gz]=e1[R90]=e1[j90]=e1[C90]=e1[qz]=e1[_90]=e1[zY]=e1[S90]=e1[Hz]=e1[g90]=e1[UC]=!1;var h90=typeof global=="object"&&global&&global.Object===Object&&global,bo0=typeof self=="object"&&self&&self.Object===Object&&self,T5=h90||bo0||Function("return this")(),u90=typeof Qz=="object"&&Qz&&!Qz.nodeType&&Qz,X90=u90&&typeof XY=="object"&&XY&&!XY.nodeType&&XY,x90=X90&&X90.exports===u90,sj=x90&&h90.process,L90=function(){try{return sj&&sj.binding&&sj.binding("util")}catch($){}}(),D90=L90&&L90.isTypedArray;function io0($,I){var U=-1,Y=$==null?0:$.length,J=0,Q=[];while(++U<Y){var K=$[U];if(I(K,U,$))Q[J++]=K}return Q}function no0($,I){var U=-1,Y=I.length,J=$.length;while(++U<Y)$[J+U]=I[U];return $}function po0($,I){var U=-1,Y=$==null?0:$.length;while(++U<Y)if(I($[U],U,$))return!0;return!1}function co0($,I){var U=-1,Y=Array($);while(++U<$)Y[U]=I(U);return Y}function do0($){return function(I){return $(I)}}function mo0($,I){return $.has(I)}function lo0($,I){return $==null?void 0:$[I]}function oo0($){var I=-1,U=Array($.size);return $.forEach(function(Y,J){U[++I]=[J,Y]}),U}function ro0($,I){return function(U){return $(I(U))}}function to0($){var I=-1,U=Array($.size);return $.forEach(function(Y){U[++I]=Y}),U}var ao0=Array.prototype,so0=Function.prototype,zz=Object.prototype,ej=T5["__core-js_shared__"],k90=so0.toString,h8=zz.hasOwnProperty,F90=function(){var $=/[^.]+$/.exec(ej&&ej.keys&&ej.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),f90=zz.toString,eo0=RegExp("^"+k90.call(h8).replace(xo0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),O90=x90?T5.Buffer:void 0,Wz=T5.Symbol,N90=T5.Uint8Array,b90=zz.propertyIsEnumerable,$r0=ao0.splice,O3=Wz?Wz.toStringTag:void 0,M90=Object.getOwnPropertySymbols,Ir0=O90?O90.isBuffer:void 0,Ur0=ro0(Object.keys,Object),YC=LY(T5,"DataView"),_K=LY(T5,"Map"),JC=LY(T5,"Promise"),QC=LY(T5,"Set"),KC=LY(T5,"WeakMap"),SK=LY(Object,"create"),Yr0=A3(YC),Jr0=A3(_K),Qr0=A3(JC),Kr0=A3(QC),qr0=A3(KC),A90=Wz?Wz.prototype:void 0,$C=A90?A90.valueOf:void 0;function N3($){var I=-1,U=$==null?0:$.length;this.clear();while(++I<U){var Y=$[I];this.set(Y[0],Y[1])}}function Hr0(){this.__data__=SK?SK(null):{},this.size=0}function Gr0($){var I=this.has($)&&delete this.__data__[$];return this.size-=I?1:0,I}function Wr0($){var I=this.__data Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(I)}set headers($){this._headers=$}shouldQuote($,I){let U=I?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(Lt0.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,I,U){let Y=`${Dt0.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:J}=this;if(J.quote!==""){if(Y.indexOf(J.quote)!==-1)return this.quoteField(Y.replace(this.REPLACE_REGEXP,J.escapedQuote))}if(Y.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(I,U))return this.quoteField(Y);return Y}quoteField($){let{quote:I}=this.formatterOptions;return`${I}${$}${I}`}}DY.FieldFormatter=Y70});var ZC=F((J70)=>{Object.defineProperty(J70,"__esModule",{value:!0});J70.isSyncTransform=void 0;J70.isSyncTransform=($)=>$.length===1});var q70=F((FY)=>{var K70=FY&&FY.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(FY,"__esModule",{value:!0});FY.RowFormatter=void 0;var Ot0=K70(Jz()),Nt0=K70(o90()),Mt0=VC(),At0=ZC();class P3{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new Mt0.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(P3.isRowHashArray($))return $.map((I)=>I[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(At0.isSyncTransform($))return(I,U)=>{let Y=null;try{Y=$(I)}catch(J){return U(J)}return U(null,Y)};return(I,U)=>{$(I,U)}}set rowTransform($){if(!Ot0.default($))throw TypeError("The transform should be a function");this._rowTransform=P3.createTransform($)}format($,I){this.callTransformer($,(U,Y)=>{if(U)return I(U);if(!$)return I(null);let J=[];if(Y){let{shouldFormatColumns:Q,headers:K}=this.checkHeaders(Y);if(this.shouldWriteHeaders&&K&&!this.hasWrittenHeaders)J.push(this.formatColumns(K,!0)),this.hasWrittenHeaders=!0;if(Q){let q=this.gatherColumns(Y);J.push(this.formatColumns(q,!1))}}return I(null,J)})}finish($){let I=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));I.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)I.push(this.formatterOptions.rowDelimiter);return $(null,I)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let I=P3.gatherHeaders($);if(this.headers=I,this.fieldFormatter.headers=I,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!Nt0.default(I,$),headers:I}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((I)=>$[I]);if(P3.isRowHashArray($))return this.headers.map((I,U)=>{let Y=$[U];if(Y)return Y[1];return""});if(P3.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((I,U)=>$[U])}callTransformer($,I){if(!this._rowTransform)return I(null,$);return this._rowTransform($,I)}formatColumns($,I){let U=$.map((J,Q)=>this.fieldFormatter.format(J,Q,I)).join(this.formatterOptions.delimiter),{rowCount:Y}=this;if(this.rowCount+=1,Y)return[this.formatterOptions.rowDelimiter,U].join("");return U}}FY.RowFormatter=P3});var H70=F((Dz)=>{Object.defineProperty(Dz,"__esModule",{value:!0});Dz.FieldFormatter=Dz.RowFormatter=void 0;var Pt0=q70();Object.defineProperty(Dz,"RowFormatter",{enumerable:!0,get:function(){return Pt0.RowFormatter}});var Tt0=VC();Object.defineProperty(Dz,"FieldFormatter",{enumerable:!0,get:function(){return Tt0.FieldFormatter}})});var zC=F((W70)=>{Object.defineProperty(W70,"__esModule",{value:!0});W70.CsvFormatterStream=void 0;var Bt0=t("stream"),vt0=H70();class G70 extends Bt0.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new vt0.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,I,U){let Y=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(J,Q)=>{if(J)return Y=!0,U(J);if(Q)Q.forEach((K)=>{this.push(Buffer.from(K,"utf8"))});return Y=!0,U()})}catch(J){if(Y)throw J;U(J)}}_flush($){this.rowFormatter.finish((I,U)=>{if(I)return $(I);if(U)U.forEach((Y)=>{this.push(Buffer.from(Y,"utf8"))});return $()})}}W70.CsvFormatterStream=G70});var Z70=F((P1)=>{var V70=P1&&P1.__createBinding||(Object.create?function($,I,U,Y){if(Y===void 0)Y=U;Object.defineProperty($,Y,{enumerable:!0,get:function(){return I[U]}})}:function($,I,U,Y){if(Y===void 0)Y=U;$[Y]=I[U]}),Rt0=P1&&P1.__setModuleDefault||(Object.create?function($,I){Ob Line truncated
`||I===`\r
`}static isTokenCarriageReturn($,I){return $.token===I.carriageReturn}static isTokenComment($,I){return I.supportsComments&&!!$&&$.token===I.comment}static isTokenEscapeCharacter($,I){return $.token===I.escapeChar}static isTokenQuote($,I){return $.token===I.quote}static isTokenDelimiter($,I){return $.token===I.delimiter}}G30.Token=H30});var gj=O((Z30)=>{Object.defineProperty(Z30,"__esModule",{value:!0});Z30.Scanner=void 0;var w30=o9(),Fe0=/((?:\r\n)|\n|\r)/;class V30{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,I=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(I)===-1)return null;let U=I.exec($);if(U==null)return null;let Y=U[1],J=this.cursor+(U.index||0);return new w30.Token({token:Y,startCursor:J,endCursor:J+Y.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:I}=this;if(I<=$)return null;return new w30.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=Fe0.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}}Z30.Scanner=V30});var hz=O((L30)=>{Object.defineProperty(L30,"__esModule",{value:!0});L30.ColumnFormatter=void 0;class X30{constructor($){if($.trim)this.format=(I)=>I.trim();else if($.ltrim)this.format=(I)=>I.trimLeft();else if($.rtrim)this.format=(I)=>I.trimRight();else this.format=(I)=>I}}L30.ColumnFormatter=X30});var Sj=O((N30)=>{Object.defineProperty(N30,"__esModule",{value:!0});N30.NonQuotedColumnParser=void 0;var Ne0=hz(),O30=o9();class F30{constructor($){this.parserOptions=$,this.columnFormatter=new Ne0.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:I}=this,U=[],Y=$.nextCharacterToken;for(;Y;Y=$.nextCharacterToken){if(O30.Token.isTokenDelimiter(Y,I)||O30.Token.isTokenRowDelimiter(Y))break;U.push(Y.token),$.advancePastToken(Y)}return this.columnFormatter.format(U.join(""))}}N30.NonQuotedColumnParser=F30});var yj=O((P30)=>{Object.defineProperty(P30,"__esModule",{value:!0});P30.QuotedColumnParser=void 0;var Me0=hz(),RY=o9();class A30{constructor($){this.parserOptions=$,this.columnFormatter=new Me0.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let I=$.cursor,{foundClosingQuote:U,col:Y}=this.gatherDataBetweenQuotes($);if(!U){if($.advanceTo(I),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),Y}gatherDataBetweenQuotes($){let{parserOptions:I}=this,U=!1,Y=!1,J=[],Q=$.nextCharacterToken;for(;!Y&&Q!==null;Q=$.nextCharacterToken){let K=RY.Token.isTokenQuote(Q,I);if(!U&&K)U=!0;else if(U)if(RY.Token.isTokenEscapeCharacter(Q,I)){$.advancePastToken(Q);let q=$.nextCharacterToken;if(q!==null&&(RY.Token.isTokenQuote(q,I)||RY.Token.isTokenEscapeCharacter(q,I)))J.push(q.token),Q=q;else if(K)Y=!0;else J.push(Q.token)}else if(K)Y=!0;else J.push(Q.token);$.advancePastToken(Q)}return{col:this.columnFormatter.format(J.join("")),foundClosingQuote:Y}}checkForMalformedColumn($){let{parserOptions:I}=this,{nextNonSpaceToken:U}=$;if(U){let Y=RY.Token.isTokenDelimiter(U,I),J=RY.Token.isTokenRowDelimiter(U);if(!(Y||J)){let Q=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${I.escapedDelimiter}' OR new line got: '${U.token}'. at '${Q}`)}$.advanceToToken(U)}else if(!$.hasMoreData)$.advancePastLine()}}P30.QuotedColumnParser=A30});var R30=O((B30)=>{Object.defineProperty(B30,"__esModule",{value:!0});B30.ColumnParser=void 0;var Ae0=Sj(),Pe0=yj(),Te0=o9();class E30{constructor($){this.parserOptions=$,this.quotedColumnParser=new Pe0.QuotedColumnParser($),this.nonQuotedColumnParser=new Ae0.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:I}=$;if(I!==null&&Te0.Token.isTokenQuote(I,this.parserOptions))return $.advanceToToken(I),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}B30.ColumnParser=E30});var hj=O((CY)=>{Object.defineProperty(CY,"__esModule",{value:!0});CY.ColumnFormatter=CY.QuotedColumnParser=CY.NonQuotedColumnParser=CY.ColumnParser=void 0;var Ee0=R30();Object.defineProperty(CY,"ColumnParser",{enumerable:!0,get:function(){return Ee0.ColumnParser}});var Be0=Sj();Object.defineProperty(CY,"NonQuotedColumnParser",{enumerable:!0,get:function(){return Be0.NonQuotedColumnParser}});var ve0=yj();Object.defineProperty(CY,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,k,k,Z,Y);let S=Z.type==="*"?aj:Z.type==="?"?$_:"\\"+Z.type;J=!0,Y=Y.slice(0,Z.reStart)+S+"\\("+k}if(T(),Q)Y+="\\\\";let A=O01[Y.charAt(0)];for(let k=q.length-1;k>-1;k--){let S=q[k],i=Y.slice(0,S.reStart),C=Y.slice(S.reStart,S.reEnd-8),p=Y.slice(S.reEnd),n=Y.slice(S.reEnd-8,S.reEnd)+p,g=i.split(")").length,f=i.split("(").length-g,b=p;for(let B=0;B<f;B++)b=b.replace(/\)[+*?]?/,"");p=b;let Y0=p===""&&I!==sj?"(?:$|\\/)":"";Y=i+C+p+Y0+n}if(Y!==""&&J)Y="(?=.)"+Y;if(A)Y=F()+Y;if(I===sj)return[Y,J];if(U.nocase&&!J)J=$.toUpperCase()!==$.toLowerCase();if(!J)return N01($);let R=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+Y+"$",R),{_glob:$,_src:Y})}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 I=this.options,U=I.noglobstar?aj:I.dot?L01:D01,Y=I.nocase?"i":"",J=$.map((Q)=>{return Q=Q.map((K)=>typeof K==="string"?A01(K):K===g6?g6:K._src).reduce((K,q)=>{if(!(K[K.length-1]===g6&&q===g6))K.push(q);return K},[]),Q.forEach((K,q)=>{if(K!==g6||Q[q-1]===g6)return;if(q===0)if(Q.length>1)Q[q+1]="(?:\\/|"+U+"\\/)?"+Q[q+1];else Q[q]=U;else if(q===Q.length-1)Q[q-1]+="(?:\\/|"+U+")?";else Q[q-1]+="(?:\\/|\\/"+U+"\\/)"+Q[q+1],Q[q+1]=g6}),Q.filter((K)=>K!==g6).join("/")}).join("|");if(J="^(?:"+J+")$",this.negate)J="^(?!"+J+").*$";try{this.regexp=new RegExp(J,Y)}catch(Q){this.regexp=!1}return this.regexp}match($,I=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&I)return!0;let U=this.options;if(ej.sep!=="/")$=$.split(ej.sep).join("/");$=$.split(NI0),this.debug(this.pattern,"split",$);let Y=this.set;this.debug(this.pattern,"set",Y);let J;for(let Q=$.length-1;Q>=0;Q--)if(J=$[Q],J)break;for(let Q=0;Q<Y.length;Q++){let K=Y[Q],q=$;if(U.matchBase&&K.length===1)q=[J];if(this.matchOne(q,K,I)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return H$.defaults($).Minimatch}}H$.Minimatch=kK});var RI0=O((Nv1,vI0)=>{vI0.exports=BI0;var Y_=r("fs"),{EventEmitter:T01}=r("events"),{Minimatch:U_}=PI0(),{resolve:E01}=r("path");function B01($,I){return new Promise((U,Y)=>{Y_.readdir($,{withFileTypes:!0},(J,Q)=>{if(J)switch(J.code){case"ENOTDIR":if(I)Y(J);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:Y(J);break}else U(Q)})})}function TI0($,I){return new Promise((U,Y)=>{(I?Y_.stat:Y_.lstat)($,(Q,K)=>{if(Q)switch(Q.code){case"ENOENT":if(I)U(TI0($,!1));else U(null);break;default:U(null);break}else U(K)})})}async function*EI0($,I,U,Y,J,Q){let K=await B01(I+$,Q);for(let q of K){let H=q.name;if(H===void 0)H=q,Y=!0;let G=$+"/"+H,W=G.slice(1),w=I+"/"+W,V=null;if(Y||U)V=await TI0(w,U);if(!V&&q.name!==void 0)V=q;if(V===null)V={isDirectory:()=>!1};if(V.isDirectory()){if(!J(W))yield{relative:W,absolute:w,stats:V},yield*EI0(G,I,U,Y,J,!1)}else yield{relative:W,absolute:w,stats:V}}}async function*v01($,I,U,Y){yield*EI0("",$,I,U,Y,!0)}function R01($){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 J_ extends T01{constructor($,I,U){super();if(typeof I==="function")U=I,I=null;if(this.options=R01(I||{}),this.matchers=[],this.options.pattern){let Y=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=Y.map((J)=>new U_(J,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let Y=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=Y.map((J)=>new U_(J,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let Y=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=Y.map((J)=>new U_(J,{dot:!0}))}if(this.iterator=v01(E01($||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,U)this._matches=[],this.on("match",(Y)=>this._matches.push(this.options.absolute?Y.absolute:Y.relative)),this.on("error",(Y)=>U(Y)),this.on("end",()=>U(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((I)=>I.match($))}_fileMatches($,I){let U=$+(I?"/":"");return(this.matchers.length===0||this.matchers.some((Y)=>Y.match(U)))&&!this.ignoreMatchers.some((Y)=>Y.match(U))&&(!this.options.nodir||!I)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let I=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,I)){let U=$.value.relative,Y=$.value.absolute;if(this.options.mark&&I)U+="/",Y+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:Y,stat:$.value.stats});else this.emit("match",{relative:U,ab Line truncated
`,y);y=$0===-1?P.length:$0}else if(c!==-1&&P[y]==="/"&&P[y+1]==="*"){let $0=P.indexOf("*/",y);if($0!==-1)y=$0+2,c=P.indexOf("*/",y);else v+=P[y],y++}else v+=P[y],y++;return v}function a8(P){let v=X$(P.toString()),y=v.match(z$);if(!y)y=v.match(f$);if(!y)throw Error(`could not parse args in autoInject
`}static isTokenCarriageReturn($,I){return $.token===I.carriageReturn}static isTokenComment($,I){return I.supportsComments&&!!$&&$.token===I.comment}static isTokenEscapeCharacter($,I){return $.token===I.escapeChar}static isTokenQuote($,I){return $.token===I.quote}static isTokenDelimiter($,I){return $.token===I.delimiter}}z30.Token=Z30});var kC=F((F30)=>{Object.defineProperty(F30,"__esModule",{value:!0});F30.Scanner=void 0;var L30=r9(),ue0=/((?:\r\n)|\n|\r)/;class D30{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,I=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(I)===-1)return null;let U=I.exec($);if(U==null)return null;let Y=U[1],J=this.cursor+(U.index||0);return new L30.Token({token:Y,startCursor:J,endCursor:J+Y.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:I}=this;if(I<=$)return null;return new L30.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=ue0.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}}F30.Scanner=D30});var bz=F((M30)=>{Object.defineProperty(M30,"__esModule",{value:!0});M30.ColumnFormatter=void 0;class N30{constructor($){if($.trim)this.format=(I)=>I.trim();else if($.ltrim)this.format=(I)=>I.trimLeft();else if($.rtrim)this.format=(I)=>I.trimRight();else this.format=(I)=>I}}M30.ColumnFormatter=N30});var fC=F((E30)=>{Object.defineProperty(E30,"__esModule",{value:!0});E30.NonQuotedColumnParser=void 0;var xe0=bz(),P30=r9();class T30{constructor($){this.parserOptions=$,this.columnFormatter=new xe0.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:I}=this,U=[],Y=$.nextCharacterToken;for(;Y;Y=$.nextCharacterToken){if(P30.Token.isTokenDelimiter(Y,I)||P30.Token.isTokenRowDelimiter(Y))break;U.push(Y.token),$.advancePastToken(Y)}return this.columnFormatter.format(U.join(""))}}E30.NonQuotedColumnParser=T30});var bC=F((R30)=>{Object.defineProperty(R30,"__esModule",{value:!0});R30.QuotedColumnParser=void 0;var ke0=bz(),jY=r9();class v30{constructor($){this.parserOptions=$,this.columnFormatter=new ke0.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let I=$.cursor,{foundClosingQuote:U,col:Y}=this.gatherDataBetweenQuotes($);if(!U){if($.advanceTo(I),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),Y}gatherDataBetweenQuotes($){let{parserOptions:I}=this,U=!1,Y=!1,J=[],Q=$.nextCharacterToken;for(;!Y&&Q!==null;Q=$.nextCharacterToken){let K=jY.Token.isTokenQuote(Q,I);if(!U&&K)U=!0;else if(U)if(jY.Token.isTokenEscapeCharacter(Q,I)){$.advancePastToken(Q);let q=$.nextCharacterToken;if(q!==null&&(jY.Token.isTokenQuote(q,I)||jY.Token.isTokenEscapeCharacter(q,I)))J.push(q.token),Q=q;else if(K)Y=!0;else J.push(Q.token)}else if(K)Y=!0;else J.push(Q.token);$.advancePastToken(Q)}return{col:this.columnFormatter.format(J.join("")),foundClosingQuote:Y}}checkForMalformedColumn($){let{parserOptions:I}=this,{nextNonSpaceToken:U}=$;if(U){let Y=jY.Token.isTokenDelimiter(U,I),J=jY.Token.isTokenRowDelimiter(U);if(!(Y||J)){let Q=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${I.escapedDelimiter}' OR new line got: '${U.token}'. at '${Q}`)}$.advanceToToken(U)}else if(!$.hasMoreData)$.advancePastLine()}}R30.QuotedColumnParser=v30});var g30=F((_30)=>{Object.defineProperty(_30,"__esModule",{value:!0});_30.ColumnParser=void 0;var fe0=fC(),be0=bC(),ie0=r9();class C30{constructor($){this.parserOptions=$,this.quotedColumnParser=new be0.QuotedColumnParser($),this.nonQuotedColumnParser=new fe0.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:I}=$;if(I!==null&&ie0.Token.isTokenQuote(I,this.parserOptions))return $.advanceToToken(I),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}_30.ColumnParser=C30});var iC=F((CY)=>{Object.defineProperty(CY,"__esModule",{value:!0});CY.ColumnFormatter=CY.QuotedColumnParser=CY.NonQuotedColumnParser=CY.ColumnParser=void 0;var ne0=g30();Object.defineProperty(CY,"ColumnParser",{enumerable:!0,get:function(){return ne0.ColumnParser}});var pe0=fC();Object.defineProperty(CY,"NonQuotedColumnParser",{enumerable:!0,get:function(){return pe0.NonQuotedColumnParser}});var ce0=bC();Object.defineProperty(CY,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,k,k,Z,Y);let g=Z.type==="*"?Y_:Z.type==="?"?K_:"\\"+Z.type;J=!0,Y=Y.slice(0,Z.reStart)+g+"\\("+k}if(T(),Q)Y+="\\\\";let A=h01[Y.charAt(0)];for(let k=q.length-1;k>-1;k--){let g=q[k],f=Y.slice(0,g.reStart),j=Y.slice(g.reStart,g.reEnd-8),p=Y.slice(g.reEnd),n=Y.slice(g.reEnd-8,g.reEnd)+p,S=f.split(")").length,b=f.split("(").length-S,i=p;for(let B=0;B<b;B++)i=i.replace(/\)[+*?]?/,"");p=i;let U0=p===""&&I!==J_?"(?:$|\\/)":"";Y=f+j+p+U0+n}if(Y!==""&&J)Y="(?=.)"+Y;if(A)Y=O()+Y;if(I===J_)return[Y,J];if(U.nocase&&!J)J=$.toUpperCase()!==$.toLowerCase();if(!J)return x01($);let R=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+Y+"$",R),{_glob:$,_src:Y})}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 I=this.options,U=I.noglobstar?Y_:I.dot?g01:y01,Y=I.nocase?"i":"",J=$.map((Q)=>{return Q=Q.map((K)=>typeof K==="string"?f01(K):K===y6?y6:K._src).reduce((K,q)=>{if(!(K[K.length-1]===y6&&q===y6))K.push(q);return K},[]),Q.forEach((K,q)=>{if(K!==y6||Q[q-1]===y6)return;if(q===0)if(Q.length>1)Q[q+1]="(?:\\/|"+U+"\\/)?"+Q[q+1];else Q[q]=U;else if(q===Q.length-1)Q[q-1]+="(?:\\/|"+U+")?";else Q[q-1]+="(?:\\/|\\/"+U+"\\/)"+Q[q+1],Q[q+1]=y6}),Q.filter((K)=>K!==y6).join("/")}).join("|");if(J="^(?:"+J+")$",this.negate)J="^(?!"+J+").*$";try{this.regexp=new RegExp(J,Y)}catch(Q){this.regexp=!1}return this.regexp}match($,I=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&I)return!0;let U=this.options;if(Q_.sep!=="/")$=$.split(Q_.sep).join("/");$=$.split(EI0),this.debug(this.pattern,"split",$);let Y=this.set;this.debug(this.pattern,"set",Y);let J;for(let Q=$.length-1;Q>=0;Q--)if(J=$[Q],J)break;for(let Q=0;Q<Y.length;Q++){let K=Y[Q],q=$;if(U.matchBase&&K.length===1)q=[J];if(this.matchOne(q,K,I)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return V$.defaults($).Minimatch}}V$.Minimatch=bK});var gI0=F((cv1,SI0)=>{SI0.exports=_I0;var G_=t("fs"),{EventEmitter:i01}=t("events"),{Minimatch:H_}=RI0(),{resolve:n01}=t("path");function p01($,I){return new Promise((U,Y)=>{G_.readdir($,{withFileTypes:!0},(J,Q)=>{if(J)switch(J.code){case"ENOTDIR":if(I)Y(J);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:Y(J);break}else U(Q)})})}function jI0($,I){return new Promise((U,Y)=>{(I?G_.stat:G_.lstat)($,(Q,K)=>{if(Q)switch(Q.code){case"ENOENT":if(I)U(jI0($,!1));else U(null);break;default:U(null);break}else U(K)})})}async function*CI0($,I,U,Y,J,Q){let K=await p01(I+$,Q);for(let q of K){let H=q.name;if(H===void 0)H=q,Y=!0;let G=$+"/"+H,W=G.slice(1),w=I+"/"+W,V=null;if(Y||U)V=await jI0(w,U);if(!V&&q.name!==void 0)V=q;if(V===null)V={isDirectory:()=>!1};if(V.isDirectory()){if(!J(W))yield{relative:W,absolute:w,stats:V},yield*CI0(G,I,U,Y,J,!1)}else yield{relative:W,absolute:w,stats:V}}}async function*c01($,I,U,Y){yield*CI0("",$,I,U,Y,!0)}function d01($){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 W_ extends i01{constructor($,I,U){super();if(typeof I==="function")U=I,I=null;if(this.options=d01(I||{}),this.matchers=[],this.options.pattern){let Y=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=Y.map((J)=>new H_(J,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let Y=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=Y.map((J)=>new H_(J,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let Y=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=Y.map((J)=>new H_(J,{dot:!0}))}if(this.iterator=c01(n01($||"."),this.options.follow,this.options.stat,this._shouldSkipDirectory.bind(this)),this.paused=!1,this.inactive=!1,this.aborted=!1,U)this._matches=[],this.on("match",(Y)=>this._matches.push(this.options.absolute?Y.absolute:Y.relative)),this.on("error",(Y)=>U(Y)),this.on("end",()=>U(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((I)=>I.match($))}_fileMatches($,I){let U=$+(I?"/":"");return(this.matchers.length===0||this.matchers.some((Y)=>Y.match(U)))&&!this.ignoreMatchers.some((Y)=>Y.match(U))&&(!this.options.nodir||!I)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let I=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,I)){let U=$.value.relative,Y=$.value.absolute;if(this.options.mark&&I)U+="/",Y+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:Y,stat:$.value.stats});else this.emit("match",{relative:U,ab Line truncated
`,y);y=$0===-1?P.length:$0}else if(d!==-1&&P[y]==="/"&&P[y+1]==="*"){let $0=P.indexOf("*/",y);if($0!==-1)y=$0+2,d=P.indexOf("*/",y);else v+=P[y],y++}else v+=P[y],y++;return v}function O$(P){let v=P6(P.toString()),y=v.match(f4);if(!y)y=v.match(f6);if(!y)throw Error(`could not parse args in autoInject
Source:
`+v);let[,c]=y;return c.replace(/\s/g,"").split(t8).map(($0)=>$0.replace(i$,"").trim())}function e6(P,v){var y={};return Object.keys(P).forEach((c)=>{var $0=P[c],U0,q0=Z($0),H0=!q0&&$0.length===1||q0&&$0.length===0;if(Array.isArray($0))U0=[...$0],$0=U0.pop(),y[c]=U0.concat(U0.length>0?Z0:$0);else if(H0)y[c]=$0;else{if(U0=a8($0),$0.length===0&&!q0&&U0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!q0)U0.pop();y[c]=U0.concat(Z0)}function Z0(j0,K1){var D1=U0.map((W1)=>j0[W1]);D1.push(K1),D($0)(...D1)}}),_4(y,v)}class P7{constructor(){this.head=this.tail=null,this.length=0}removeLink(P){if(P.prev)P.prev.next=P.next;else this.head=P.next;if(P.next)P.next.prev=P.prev;else this.tail=P.prev;return P.prev=P.next=null,this.length-=1,P}empty(){while(this.head)this.shift();return this}insertAfter(P,v){if(v.prev=P,v.next=P.next,P.next)P.next.prev=v;else this.tail=v;P.next=v,this.length+=1}insertBefore(P,v){if(v.prev=P.prev,v.next=P,P.prev)P.prev.next=v;else this.head=v;P.prev=v,this.length+=1}unshift(P){if(this.head)this.insertBefore(this.head,P);else $$(this,P)}push(P){if(this.tail)this.insertAfter(this.tail,P);else $$(this,P)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var P=this.head;while(P)yield P.data,P=P.next}remove(P){var v=this.head;while(v){var{next:y}=v;if(P(v))this.removeLink(v);v=y}return this}}function $$(P,v){P.length=1,P.head=P.tail=v}function t5(P,v,y){if(v==null)v=1;else if(v===0)throw RangeError("Concurrency must not be zero");var c=D(P),$0=0,U0=[];let q0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function H0(h0,R0){q0[h0].push(R0)}function Z0(h0,R0){let u0=(...w1)=>{j0(h0,u0),R0(...w1)};q0[h0].push(u0)}function j0(h0,R0){if(!h0)return Object.keys(q0).forEach((u0)=>q0[u0]=[]);if(!R0)return q0[h0]=[];q0[h0]=q0[h0].filter((u0)=>u0!==R0)}function K1(h0,...R0){q0[h0].forEach((u0)=>u0(...R0))}var D1=!1;function W1(h0,R0,u0,w1){if(w1!=null&&typeof w1!=="function")throw Error("task callback must be a function");O1.started=!0;var J4,f4;function D$(E7,...fJ){if(E7)return u0?f4(E7):J4();if(fJ.length<=1)return J4(fJ[0]);J4(fJ)}var DI=O1._createTaskItem(h0,u0?D$:w1||D$);if(R0)O1._tasks.unshift(DI);else O1._tasks.push(DI);if(!D1)D1=!0,G(()=>{D1=!1,O1.process()});if(u0||!w1)return new Promise((E7,fJ)=>{J4=E7,f4=fJ})}function L$(h0){return function(R0,...u0){$0-=1;for(var w1=0,J4=h0.length;w1<J4;w1++){var f4=h0[w1],D$=U0.indexOf(f4);if(D$===0)U0.shift();else if(D$>0)U0.splice(D$,1);if(f4.callback(R0,...u0),R0!=null)K1("error",R0,f4.data)}if($0<=O1.concurrency-O1.buffer)K1("unsaturated");if(O1.idle())K1("drain");O1.process()}}function LI(h0){if(h0.length===0&&O1.idle())return G(()=>K1("drain")),!0;return!1}let T7=(h0)=>(R0)=>{if(!R0)return new Promise((u0,w1)=>{Z0(h0,(J4,f4)=>{if(J4)return w1(J4);u0(f4)})});j0(h0),H0(h0,R0)};var kJ=!1,O1={_tasks:new P7,_createTaskItem(h0,R0){return{data:h0,callback:R0}},*[Symbol.iterator](){yield*O1._tasks[Symbol.iterator]()},concurrency:v,payload:y,buffer:v/4,started:!1,paused:!1,push(h0,R0){if(Array.isArray(h0)){if(LI(h0))return;return h0.map((u0)=>W1(u0,!1,!1,R0))}return W1(h0,!1,!1,R0)},pushAsync(h0,R0){if(Array.isArray(h0)){if(LI(h0))return;return h0.map((u0)=>W1(u0,!1,!0,R0))}return W1(h0,!1,!0,R0)},kill(){j0(),O1._tasks.empty()},unshift(h0,R0){if(Array.isArray(h0)){if(LI(h0))return;return h0.map((u0)=>W1(u0,!0,!1,R0))}return W1(h0,!0,!1,R0)},unshiftAsync(h0,R0){if(Array.isArray(h0)){if(LI(h0))return;return h0.map((u0)=>W1(u0,!0,!0,R0))}return W1(h0,!0,!0,R0)},remove(h0){O1._tasks.remove(h0)},process(){if(kJ)return;kJ=!0;while(!O1.paused&&$0<O1.concurrency&&O1._tasks.length){var h0=[],R0=[],u0=O1._tasks.length;if(O1.payload)u0=Math.min(u0,O1.payload);for(var w1=0;w1<u0;w1++){var J4=O1._tasks.shift();h0.push(J4),U0.push(J4),R0.push(J4.data)}if($0+=1,O1._tasks.length===0)K1("empty");if($0===O1.concurrency)K1("saturated");var f4=g(L$(h0));c(R0,f4)}kJ=!1},length(){return O1._tasks.length},running(){return $0},workersList(){return U0},idle(){return O1._tasks.length+$0===0},pause(){O1.paused=!0},resume(){if(O1.paused===!1)return;O1.paused=!1,G(O1.process)}};return Object.defineProperties(O1,{saturated:{writable:!1,value:T7("saturated")},unsaturated:{writable:!1,value:T7("unsaturated")},empty:{writable:!1,value:T7("empty")},drain:{writable:!1,value:T7("drain")},error:{writable:!1,value:T7("error")}}),O1}function E0(P,v){return t5(P,1,v)}function a(P,v,y){return t5(P,v,y)}function N(P,v,y,c){c=k(c);var $0=D(y);return f0(P,(U0,q0,H0)=>{$0(v,U0,(Z0,j0)=>{v=j0,H0(Z0)})},(U0)=>c(U0,v))}var M=F(N,4);function j(...P){var v=P.map(D);return function(...y){var c=this,$0=y[y.length-1];if(typeof $0=="function")y.pop();else $0=q4();return M(v,y,(U0,q0,H0)=>{q0.apply(c,U0.concat((Z0,...j0)=>{H0(Z0,j0)}))},(U0,q0)=>$0(U0,...q0)),$0[m0]}}function u(...P){return j(...P.reverse())}function s(P,v,y,c){return T(b(v),P,y,c)}var m=F(s,4);function e( Line truncated
GFS4: `),console.error($)};if(!V4[J6]){if(Q_=global[J6]||[],fI0(V4,Q_),V4.close=function($){function I(U,Y){return $.call(V4,U,function(J){if(!J)kI0();if(typeof Y==="function")Y.apply(this,arguments)})}return Object.defineProperty(I,dz,{value:$}),I}(V4.close),V4.closeSync=function($){function I(U){$.apply(V4,arguments),kI0()}return Object.defineProperty(I,dz,{value:$}),I}(V4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){B3(V4[J6]),r("assert").equal(V4[J6].length,0)})}var Q_;if(!global[J6])fI0(global,V4[J6]);H_.exports=K_(x01(V4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!V4.__patched)H_.exports=K_(V4),V4.__patched=!0;function K_($){h01($),$.gracefulify=K_,$.createReadStream=R,$.createWriteStream=k;var I=$.readFile;$.readFile=U;function U(C,p,n){if(typeof p==="function")n=p,p=null;return g(C,p,n);function g(f,b,Y0,B){return I(f,b,function(x){if(x&&(x.code==="EMFILE"||x.code==="ENFILE"))gY([g,[f,b,Y0],x,B||Date.now(),Date.now()]);else if(typeof Y0==="function")Y0.apply(this,arguments)})}}var Y=$.writeFile;$.writeFile=J;function J(C,p,n,g){if(typeof n==="function")g=n,n=null;return f(C,p,n,g);function f(b,Y0,B,x,d){return Y(b,Y0,B,function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))gY([f,[b,Y0,B,x],t,d||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}var Q=$.appendFile;if(Q)$.appendFile=K;function K(C,p,n,g){if(typeof n==="function")g=n,n=null;return f(C,p,n,g);function f(b,Y0,B,x,d){return Q(b,Y0,B,function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))gY([f,[b,Y0,B,x],t,d||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}var q=$.copyFile;if(q)$.copyFile=H;function H(C,p,n,g){if(typeof n==="function")g=n,n=0;return f(C,p,n,g);function f(b,Y0,B,x,d){return q(b,Y0,B,function(t){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))gY([f,[b,Y0,B,x],t,d||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}var G=$.readdir;$.readdir=w;var W=/^v[0-5]\./;function w(C,p,n){if(typeof p==="function")n=p,p=null;var g=W.test(process.version)?function(Y0,B,x,d){return G(Y0,f(Y0,B,x,d))}:function(Y0,B,x,d){return G(Y0,B,f(Y0,B,x,d))};return g(C,p,n);function f(b,Y0,B,x){return function(d,t){if(d&&(d.code==="EMFILE"||d.code==="ENFILE"))gY([g,[b,Y0,B],d,x||Date.now(),Date.now()]);else{if(t&&t.sort)t.sort();if(typeof B==="function")B.call(this,d,t)}}}}if(process.version.substr(0,4)==="v0.8"){var V=u01($);F=V.ReadStream,T=V.WriteStream}var Z=$.ReadStream;if(Z)F.prototype=Object.create(Z.prototype),F.prototype.open=E;var X=$.WriteStream;if(X)T.prototype=Object.create(X.prototype),T.prototype.open=A;Object.defineProperty($,"ReadStream",{get:function(){return F},set:function(C){F=C},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return T},set:function(C){T=C},enumerable:!0,configurable:!0});var L=F;Object.defineProperty($,"FileReadStream",{get:function(){return L},set:function(C){L=C},enumerable:!0,configurable:!0});var D=T;Object.defineProperty($,"FileWriteStream",{get:function(){return D},set:function(C){D=C},enumerable:!0,configurable:!0});function F(C,p){if(this instanceof F)return Z.apply(this,arguments),this;else return F.apply(Object.create(F.prototype),arguments)}function E(){var C=this;i(C.path,C.flags,C.mode,function(p,n){if(p){if(C.autoClose)C.destroy();C.emit("error",p)}else C.fd=n,C.emit("open",n),C.read()})}function T(C,p){if(this instanceof T)return X.apply(this,arguments),this;else return T.apply(Object.create(T.prototype),arguments)}function A(){var C=this;i(C.path,C.flags,C.mode,function(p,n){if(p)C.destroy(),C.emit("error",p);else C.fd=n,C.emit("open",n)})}function R(C,p){return new $.ReadStream(C,p)}function k(C,p){return new $.WriteStream(C,p)}var S=$.open;$.open=i;function i(C,p,n,g){if(typeof n==="function")g=n,n=null;return f(C,p,n,g);function f(b,Y0,B,x,d){return S(b,Y0,B,function(t,K0){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))gY([f,[b,Y0,B,x],t,d||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}return $}function gY($){B3("ENQUEUE",$[0].name,$[1]),V4[J6].push($),q_()}var cz;function kI0(){var $=Date.now();for(var I=0;I<V4[J6].length;++I)if(V4[J6][I].length>2)V4[J6][I][3]=$,V4[J6][I][4]=$;q_()}function q_(){if(clearTimeout(cz),cz=void 0,V4[J6].length===0)return;var $=V4[J6].shift(),I=$[0],U=$[1],Y=$[2],J=$[3],Q=$[4];if(J===void 0)B3("RETRY",I.name,U),I.apply(null,U);else if(Date.now()-J>=60000){B3("TIMEOUT",I.name,U);var K=U.pop();if(typeof K==="function")K.call(null,Y)}else{var q=Date.now()-Q,H=Math.max(Q-J,1),G=Math.min(H*1.2,100);if(q>=G)B3("RETRY",I.name,U),I.apply(null,U.concat([J]));else V4[J6].push($)}if(cz===void 0)cz=setTimeout(q_,0)}});var bI0=O((Ev1,G_)=>{function f01($,I){if(!($ instanceof I))throw TypeError("Cannot call a class as a function")}var iI0=M4().Buffer,fK=r("util");function i01($,I,U){$.copy(I,U)}G_.exports=function(){function $(){f01(this,$),this.head=null,this.tail=null,th Line truncated
`+v);let[,d]=y;return d.replace(/\s/g,"").split(F$).map(($0)=>$0.replace(b6,"").trim())}function Y$(P,v){var y={};return Object.keys(P).forEach((d)=>{var $0=P[d],Y0,H0=Z($0),G0=!H0&&$0.length===1||H0&&$0.length===0;if(Array.isArray($0))Y0=[...$0],$0=Y0.pop(),y[d]=Y0.concat(Y0.length>0?z0:$0);else if(G0)y[d]=$0;else{if(Y0=O$($0),$0.length===0&&!H0&&Y0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!H0)Y0.pop();y[d]=Y0.concat(z0)}function z0(S0,G1){var O1=Y0.map((V1)=>S0[V1]);O1.push(G1),D($0)(...O1)}}),F1(y,v)}class T7{constructor(){this.head=this.tail=null,this.length=0}removeLink(P){if(P.prev)P.prev.next=P.next;else this.head=P.next;if(P.next)P.next.prev=P.prev;else this.tail=P.prev;return P.prev=P.next=null,this.length-=1,P}empty(){while(this.head)this.shift();return this}insertAfter(P,v){if(v.prev=P,v.next=P.next,P.next)P.next.prev=v;else this.tail=v;P.next=v,this.length+=1}insertBefore(P,v){if(v.prev=P.prev,v.next=P,P.prev)P.prev.next=v;else this.head=v;P.prev=v,this.length+=1}unshift(P){if(this.head)this.insertBefore(this.head,P);else J$(this,P)}push(P){if(this.tail)this.insertAfter(this.tail,P);else J$(this,P)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var P=this.head;while(P)yield P.data,P=P.next}remove(P){var v=this.head;while(v){var{next:y}=v;if(P(v))this.removeLink(v);v=y}return this}}function J$(P,v){P.length=1,P.head=P.tail=v}function t5(P,v,y){if(v==null)v=1;else if(v===0)throw RangeError("Concurrency must not be zero");var d=D(P),$0=0,Y0=[];let H0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function G0(u0,C0){H0[u0].push(C0)}function z0(u0,C0){let x0=(...Z1)=>{S0(u0,x0),C0(...Z1)};H0[u0].push(x0)}function S0(u0,C0){if(!u0)return Object.keys(H0).forEach((x0)=>H0[x0]=[]);if(!C0)return H0[u0]=[];H0[u0]=H0[u0].filter((x0)=>x0!==C0)}function G1(u0,...C0){H0[u0].forEach((x0)=>x0(...C0))}var O1=!1;function V1(u0,C0,x0,Z1){if(Z1!=null&&typeof Z1!=="function")throw Error("task callback must be a function");N1.started=!0;var K4,b4;function M$(B7,...bJ){if(B7)return x0?b4(B7):K4();if(bJ.length<=1)return K4(bJ[0]);K4(bJ)}var FI=N1._createTaskItem(u0,x0?M$:Z1||M$);if(C0)N1._tasks.unshift(FI);else N1._tasks.push(FI);if(!O1)O1=!0,G(()=>{O1=!1,N1.process()});if(x0||!Z1)return new Promise((B7,bJ)=>{K4=B7,b4=bJ})}function N$(u0){return function(C0,...x0){$0-=1;for(var Z1=0,K4=u0.length;Z1<K4;Z1++){var b4=u0[Z1],M$=Y0.indexOf(b4);if(M$===0)Y0.shift();else if(M$>0)Y0.splice(M$,1);if(b4.callback(C0,...x0),C0!=null)G1("error",C0,b4.data)}if($0<=N1.concurrency-N1.buffer)G1("unsaturated");if(N1.idle())G1("drain");N1.process()}}function DI(u0){if(u0.length===0&&N1.idle())return G(()=>G1("drain")),!0;return!1}let E7=(u0)=>(C0)=>{if(!C0)return new Promise((x0,Z1)=>{z0(u0,(K4,b4)=>{if(K4)return Z1(K4);x0(b4)})});S0(u0),G0(u0,C0)};var fJ=!1,N1={_tasks:new T7,_createTaskItem(u0,C0){return{data:u0,callback:C0}},*[Symbol.iterator](){yield*N1._tasks[Symbol.iterator]()},concurrency:v,payload:y,buffer:v/4,started:!1,paused:!1,push(u0,C0){if(Array.isArray(u0)){if(DI(u0))return;return u0.map((x0)=>V1(x0,!1,!1,C0))}return V1(u0,!1,!1,C0)},pushAsync(u0,C0){if(Array.isArray(u0)){if(DI(u0))return;return u0.map((x0)=>V1(x0,!1,!0,C0))}return V1(u0,!1,!0,C0)},kill(){S0(),N1._tasks.empty()},unshift(u0,C0){if(Array.isArray(u0)){if(DI(u0))return;return u0.map((x0)=>V1(x0,!0,!1,C0))}return V1(u0,!0,!1,C0)},unshiftAsync(u0,C0){if(Array.isArray(u0)){if(DI(u0))return;return u0.map((x0)=>V1(x0,!0,!0,C0))}return V1(u0,!0,!0,C0)},remove(u0){N1._tasks.remove(u0)},process(){if(fJ)return;fJ=!0;while(!N1.paused&&$0<N1.concurrency&&N1._tasks.length){var u0=[],C0=[],x0=N1._tasks.length;if(N1.payload)x0=Math.min(x0,N1.payload);for(var Z1=0;Z1<x0;Z1++){var K4=N1._tasks.shift();u0.push(K4),Y0.push(K4),C0.push(K4.data)}if($0+=1,N1._tasks.length===0)G1("empty");if($0===N1.concurrency)G1("saturated");var b4=S(N$(u0));d(C0,b4)}fJ=!1},length(){return N1._tasks.length},running(){return $0},workersList(){return Y0},idle(){return N1._tasks.length+$0===0},pause(){N1.paused=!0},resume(){if(N1.paused===!1)return;N1.paused=!1,G(N1.process)}};return Object.defineProperties(N1,{saturated:{writable:!1,value:E7("saturated")},unsaturated:{writable:!1,value:E7("unsaturated")},empty:{writable:!1,value:E7("empty")},drain:{writable:!1,value:E7("drain")},error:{writable:!1,value:E7("error")}}),N1}function v0(P,v){return t5(P,1,v)}function a(P,v,y){return t5(P,v,y)}function N(P,v,y,d){d=k(d);var $0=D(y);return k0(P,(Y0,H0,G0)=>{$0(v,Y0,(z0,S0)=>{v=S0,G0(z0)})},(Y0)=>d(Y0,v))}var M=O(N,4);function C(...P){var v=P.map(D);return function(...y){var d=this,$0=y[y.length-1];if(typeof $0=="function")y.pop();else $0=U1();return M(v,y,(Y0,H0,G0)=>{H0.apply(d,Y0.concat((z0,...S0)=>{G0(z0,S0)}))},(Y0,H0)=>$0(Y0,...H0)),$0[R0]}}function u(...P){return C(...P.reverse())}function s(P,v,y,d){return T(i(v),P,y,d)}var m=O(s,4);function e( Line truncated
GFS4: `),console.error($)};if(!Z4[Q6]){if(w_=global[Q6]||[],cI0(Z4,w_),Z4.close=function($){function I(U,Y){return $.call(Z4,U,function(J){if(!J)pI0();if(typeof Y==="function")Y.apply(this,arguments)})}return Object.defineProperty(I,tz,{value:$}),I}(Z4.close),Z4.closeSync=function($){function I(U){$.apply(Z4,arguments),pI0()}return Object.defineProperty(I,tz,{value:$}),I}(Z4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){v3(Z4[Q6]),t("assert").equal(Z4[Q6].length,0)})}var w_;if(!global[Q6])cI0(global,Z4[Q6]);z_.exports=V_($11(Z4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Z4.__patched)z_.exports=V_(Z4),Z4.__patched=!0;function V_($){s01($),$.gracefulify=V_,$.createReadStream=R,$.createWriteStream=k;var I=$.readFile;$.readFile=U;function U(j,p,n){if(typeof p==="function")n=p,p=null;return S(j,p,n);function S(b,i,U0,B){return I(b,i,function(x){if(x&&(x.code==="EMFILE"||x.code==="ENFILE"))gY([S,[b,i,U0],x,B||Date.now(),Date.now()]);else if(typeof U0==="function")U0.apply(this,arguments)})}}var Y=$.writeFile;$.writeFile=J;function J(j,p,n,S){if(typeof n==="function")S=n,n=null;return b(j,p,n,S);function b(i,U0,B,x,c){return Y(i,U0,B,function(r){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))gY([b,[i,U0,B,x],r,c||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}var Q=$.appendFile;if(Q)$.appendFile=K;function K(j,p,n,S){if(typeof n==="function")S=n,n=null;return b(j,p,n,S);function b(i,U0,B,x,c){return Q(i,U0,B,function(r){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))gY([b,[i,U0,B,x],r,c||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}var q=$.copyFile;if(q)$.copyFile=H;function H(j,p,n,S){if(typeof n==="function")S=n,n=0;return b(j,p,n,S);function b(i,U0,B,x,c){return q(i,U0,B,function(r){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))gY([b,[i,U0,B,x],r,c||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}var G=$.readdir;$.readdir=w;var W=/^v[0-5]\./;function w(j,p,n){if(typeof p==="function")n=p,p=null;var S=W.test(process.version)?function(U0,B,x,c){return G(U0,b(U0,B,x,c))}:function(U0,B,x,c){return G(U0,B,b(U0,B,x,c))};return S(j,p,n);function b(i,U0,B,x){return function(c,r){if(c&&(c.code==="EMFILE"||c.code==="ENFILE"))gY([S,[i,U0,B],c,x||Date.now(),Date.now()]);else{if(r&&r.sort)r.sort();if(typeof B==="function")B.call(this,c,r)}}}}if(process.version.substr(0,4)==="v0.8"){var V=e01($);O=V.ReadStream,T=V.WriteStream}var Z=$.ReadStream;if(Z)O.prototype=Object.create(Z.prototype),O.prototype.open=E;var X=$.WriteStream;if(X)T.prototype=Object.create(X.prototype),T.prototype.open=A;Object.defineProperty($,"ReadStream",{get:function(){return O},set:function(j){O=j},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return T},set:function(j){T=j},enumerable:!0,configurable:!0});var L=O;Object.defineProperty($,"FileReadStream",{get:function(){return L},set:function(j){L=j},enumerable:!0,configurable:!0});var D=T;Object.defineProperty($,"FileWriteStream",{get:function(){return D},set:function(j){D=j},enumerable:!0,configurable:!0});function O(j,p){if(this instanceof O)return Z.apply(this,arguments),this;else return O.apply(Object.create(O.prototype),arguments)}function E(){var j=this;f(j.path,j.flags,j.mode,function(p,n){if(p){if(j.autoClose)j.destroy();j.emit("error",p)}else j.fd=n,j.emit("open",n),j.read()})}function T(j,p){if(this instanceof T)return X.apply(this,arguments),this;else return T.apply(Object.create(T.prototype),arguments)}function A(){var j=this;f(j.path,j.flags,j.mode,function(p,n){if(p)j.destroy(),j.emit("error",p);else j.fd=n,j.emit("open",n)})}function R(j,p){return new $.ReadStream(j,p)}function k(j,p){return new $.WriteStream(j,p)}var g=$.open;$.open=f;function f(j,p,n,S){if(typeof n==="function")S=n,n=null;return b(j,p,n,S);function b(i,U0,B,x,c){return g(i,U0,B,function(r,J0){if(r&&(r.code==="EMFILE"||r.code==="ENFILE"))gY([b,[i,U0,B,x],r,c||Date.now(),Date.now()]);else if(typeof x==="function")x.apply(this,arguments)})}}return $}function gY($){v3("ENQUEUE",$[0].name,$[1]),Z4[Q6].push($),Z_()}var rz;function pI0(){var $=Date.now();for(var I=0;I<Z4[Q6].length;++I)if(Z4[Q6][I].length>2)Z4[Q6][I][3]=$,Z4[Q6][I][4]=$;Z_()}function Z_(){if(clearTimeout(rz),rz=void 0,Z4[Q6].length===0)return;var $=Z4[Q6].shift(),I=$[0],U=$[1],Y=$[2],J=$[3],Q=$[4];if(J===void 0)v3("RETRY",I.name,U),I.apply(null,U);else if(Date.now()-J>=60000){v3("TIMEOUT",I.name,U);var K=U.pop();if(typeof K==="function")K.call(null,Y)}else{var q=Date.now()-Q,H=Math.max(Q-J,1),G=Math.min(H*1.2,100);if(q>=G)v3("RETRY",I.name,U),I.apply(null,U.concat([J]));else Z4[Q6].push($)}if(rz===void 0)rz=setTimeout(Z_,0)}});var mI0=F((rv1,X_)=>{function U11($,I){if(!($ instanceof I))throw TypeError("Cannot call a class as a function")}var dI0=A4().Buffer,iK=t("util");function Y11($,I,U){$.copy(I,U)}X_.exports=function(){function $(){U11(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.
*/vU0.exports=function($,I){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var Y="";if(U>4&&$[3]==="\\"){var J=$[2];if((J==="?"||J===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),Y="//"}var Q=$.split(/[/\\]+/);if(I!==!1&&Q[Q.length-1]==="")Q.pop();return Y+Q.join("/")}});var C_=O((xv1,yU0)=>{var CU0=9007199254740991,m11="[object Arguments]",l11="[object Function]",o11="[object GeneratorFunction]",r11=/^(?:0|[1-9]\d*)$/;function jU0($,I,U){switch(U.length){case 0:return $.call(I);case 1:return $.call(I,U[0]);case 2:return $.call(I,U[0],U[1]);case 3:return $.call(I,U[0],U[1],U[2])}return $.apply(I,U)}function t11($,I){var U=-1,Y=Array($);while(++U<$)Y[U]=I(U);return Y}var oK=Object.prototype,rK=oK.hasOwnProperty,_U0=oK.toString,a11=oK.propertyIsEnumerable,RU0=Math.max;function s11($,I){var U=H41($)||q41($)?t11($.length,String):[],Y=U.length,J=!!Y;for(var Q in $)if((I||rK.call($,Q))&&!(J&&(Q=="length"||SU0(Q,Y))))U.push(Q);return U}function e11($,I,U,Y){if($===void 0||B_($,oK[U])&&!rK.call(Y,U))return I;return $}function $41($,I,U){var Y=$[I];if(!(rK.call($,I)&&B_(Y,U))||U===void 0&&!(I in $))$[I]=U}function I41($){if(!R_($))return K41($);var I=Q41($),U=[];for(var Y in $)if(!(Y=="constructor"&&(I||!rK.call($,Y))))U.push(Y);return U}function gU0($,I){return I=RU0(I===void 0?$.length-1:I,0),function(){var U=arguments,Y=-1,J=RU0(U.length-I,0),Q=Array(J);while(++Y<J)Q[Y]=U[I+Y];Y=-1;var K=Array(I+1);while(++Y<I)K[Y]=U[Y];return K[I]=Q,jU0($,this,K)}}function U41($,I,U,Y){U||(U={});var J=-1,Q=I.length;while(++J<Q){var K=I[J],q=Y?Y(U[K],$[K],K,U,$):void 0;$41(U,K,q===void 0?$[K]:q)}return U}function Y41($){return gU0(function(I,U){var Y=-1,J=U.length,Q=J>1?U[J-1]:void 0,K=J>2?U[2]:void 0;if(Q=$.length>3&&typeof Q=="function"?(J--,Q):void 0,K&&J41(U[0],U[1],K))Q=J<3?void 0:Q,J=1;I=Object(I);while(++Y<J){var q=U[Y];if(q)$(I,q,Y,Q)}return I})}function SU0($,I){return I=I==null?CU0:I,!!I&&(typeof $=="number"||r11.test($))&&($>-1&&$%1==0&&$<I)}function J41($,I,U){if(!R_(U))return!1;var Y=typeof I;if(Y=="number"?v_(U)&&SU0(I,U.length):Y=="string"&&(I in U))return B_(U[I],$);return!1}function Q41($){var I=$&&$.constructor,U=typeof I=="function"&&I.prototype||oK;return $===U}function K41($){var I=[];if($!=null)for(var U in Object($))I.push(U);return I}function B_($,I){return $===I||$!==$&&I!==I}function q41($){return G41($)&&rK.call($,"callee")&&(!a11.call($,"callee")||_U0.call($)==m11)}var H41=Array.isArray;function v_($){return $!=null&&w41($.length)&&!W41($)}function G41($){return V41($)&&v_($)}function W41($){var I=R_($)?_U0.call($):"";return I==l11||I==o11}function w41($){return typeof $=="number"&&$>-1&&$%1==0&&$<=CU0}function R_($){var I=typeof $;return!!$&&(I=="object"||I=="function")}function V41($){return!!$&&typeof $=="object"}var Z41=Y41(function($,I,U,Y){U41(I,X41(I),$,Y)}),z41=gU0(function($){return $.push(void 0,e11),jU0(Z41,void 0,$)});function X41($){return v_($)?s11($,!0):I41($)}yU0.exports=z41});var uU0=O((kv1,j_)=>{function L41($,I){if(!($ instanceof I))throw TypeError("Cannot call a class as a function")}var hU0=M4().Buffer,tK=r("util");function D41($,I,U){$.copy(I,U)}j_.exports=function(){function $(){L41(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var Y={data:U,next:null};if(this.length>0)this.tail.next=Y;else this.head=Y;this.tail=Y,++this.length},$.prototype.unshift=function(U){var Y={data:U,next:this.head};if(this.length===0)this.tail=Y;this.head=Y,++this.length},$.prototype.shift=function(){if(this.length===0)return;var U=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,U},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(U){if(this.length===0)return"";var Y=this.head,J=""+Y.data;while(Y=Y.next)J+=U+Y.data;return J},$.prototype.concat=function(U){if(this.length===0)return hU0.alloc(0);var Y=hU0.allocUnsafe(U>>>0),J=this.head,Q=0;while(J)D41(J.data,Y,Q),Q+=J.data.length,J=J.next;return Y},$}();if(tK&&tK.inspect&&tK.inspect.custom)j_.exports.prototype[tK.inspect.custom]=function(){var $=tK.inspect({length:this.length});return this.constructor.name+" "+$}});var __=O((fv1,xU0)=>{var JX=N4();function O41($,I){var U=this,Y=this._readableState&&this._readableState.destroyed,J=this._writableState&&this._writableState.destroyed;if(Y||J){if(I)I($);else if($){if(!this._writableState)JX.nextTick(QX,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,JX.nextTick(QX,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(Q){if(!I&&Q){if(!U._writableState)JX.nextTick(QX,U,Q);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,JX.nextTick(QX,U,Q)}else if(I)I(Q)}),this}function F41(){if(this._readableState)this._readable Line truncated
%s`,R,R,E,Y);var k=E.type==="*"?Xg:E.type==="?"?zg:"\\"+E.type;J=!0,Y=Y.slice(0,E.reStart)+k+"\\("+R}if(X(),Q)Y+="\\\\";var S=!1;switch(Y.charAt(0)){case"[":case".":case"(":S=!0}for(var i=q.length-1;i>-1;i--){var C=q[i],p=Y.slice(0,C.reStart),n=Y.slice(C.reStart,C.reEnd-8),g=Y.slice(C.reEnd-8,C.reEnd),f=Y.slice(C.reEnd);g+=f;var b=p.split("(").length-1,Y0=f;for(L=0;L<b;L++)Y0=Y0.replace(/\)[+*?]?/,"");f=Y0;var B="";if(f===""&&I!==MX)B="$";var x=p+n+f+B+g;Y=x}if(Y!==""&&J)Y="(?=.)"+Y;if(S)Y=V+Y;if(I===MX)return[Y,J];if(!J)return k51($);var d=U.nocase?"i":"";try{var t=new RegExp("^"+Y+"$",d)}catch(K0){return new RegExp("$.")}return t._glob=$,t._src=Y,t}G$.makeRe=function($,I){return new B4($,I||{}).makeRe()};B4.prototype.makeRe=x51;function x51(){if(this.regexp||this.regexp===!1)return this.regexp;var $=this.set;if(!$.length)return this.regexp=!1,this.regexp;var I=this.options,U=I.noglobstar?Xg:I.dot?C51:j51,Y=I.nocase?"i":"",J=$.map(function(Q){return Q.map(function(K){return K===y3?U:typeof K==="string"?f51(K):K._src}).join("\\/")}).join("|");if(J="^(?:"+J+")$",this.negate)J="^(?!"+J+").*$";try{this.regexp=new RegExp(J,Y)}catch(Q){this.regexp=!1}return this.regexp}G$.match=function($,I,U){U=U||{};var Y=new B4(I,U);if($=$.filter(function(J){return Y.match(J)}),Y.options.nonull&&!$.length)$.push(I);return $};B4.prototype.match=function(I,U){if(typeof U>"u")U=this.partial;if(this.debug("match",I,this.pattern),this.comment)return!1;if(this.empty)return I==="";if(I==="/"&&U)return!0;var Y=this.options;if(Hq.sep!=="/")I=I.split(Hq.sep).join("/");I=I.split(wJ0),this.debug(this.pattern,"split",I);var J=this.set;this.debug(this.pattern,"set",J);var Q,K;for(K=I.length-1;K>=0;K--)if(Q=I[K],Q)break;for(K=0;K<J.length;K++){var q=J[K],H=I;if(Y.matchBase&&q.length===1)H=[Q];var G=this.matchOne(H,q,U);if(G){if(Y.flipNegate)return!0;return!this.negate}}if(Y.flipNegate)return!1;return this.negate};B4.prototype.matchOne=function($,I,U){if(I.indexOf(y3)!==-1)return this._matchGlobstar($,I,U,0,0);return this._matchOne($,I,U,0,0)};B4.prototype._matchGlobstar=function($,I,U,Y,J){var Q,K=-1;for(Q=J;Q<I.length;Q++)if(I[Q]===y3){K=Q;break}var q=-1;for(Q=I.length-1;Q>=0;Q--)if(I[Q]===y3){q=Q;break}var H=I.slice(J,K),G=U?I.slice(K+1):I.slice(K+1,q),W=U?[]:I.slice(q+1);if(H.length){var w=$.slice(Y,Y+H.length);if(!this._matchOne(w,H,U,0,0))return!1;Y+=H.length}var V=0;if(W.length){if(W.length+Y>$.length)return!1;var Z=$.length-W.length;if(this._matchOne($,W,U,Z,0))V=W.length;else{if($[$.length-1]!==""||Y+W.length===$.length)return!1;if(Z--,!this._matchOne($,W,U,Z,0))return!1;V=W.length+1}}if(!G.length){var X=!!V;for(Q=Y;Q<$.length-V;Q++){var L=String($[Q]);if(X=!0,L==="."||L===".."||!this.options.dot&&L.charAt(0)===".")return!1}return U||X}var D=[[[],0]],F=D[0],E=0,T=[0];for(var A=0;A<G.length;A++){var R=G[A];if(R===y3)T.push(E),F=[[],0],D.push(F);else F[0].push(R),E++}var k=D.length-1,S=$.length-V;for(var i=0;i<D.length;i++)D[i][1]=S-(T[k--]+D[i][0].length);return!!this._matchGlobStarBodySections($,D,Y,0,U,0,!!V)};B4.prototype._matchGlobStarBodySections=function($,I,U,Y,J,Q,K){var q=I[Y];if(!q){for(var H=U;H<$.length;H++){K=!0;var G=$[H];if(G==="."||G===".."||!this.options.dot&&G.charAt(0)===".")return!1}return K}var W=q[0],w=q[1];while(U<=w){var V=this._matchOne($.slice(0,U+W.length),W,J,U,0);if(V&&Q<this.maxGlobstarRecursion){var Z=this._matchGlobStarBodySections($,I,U+W.length,Y+1,J,Q+1,K);if(Z!==!1)return Z}var G=$[U];if(G==="."||G===".."||!this.options.dot&&G.charAt(0)===".")return!1;U++}return J||null};B4.prototype._matchOne=function($,I,U,Y,J){var Q,K,q,H;for(Q=Y,K=J,q=$.length,H=I.length;Q<q&&K<H;Q++,K++){this.debug("matchOne loop");var G=I[K],W=$[Q];if(this.debug(I,G,W),G===!1||G===y3)return!1;var w;if(typeof G==="string")w=W===G,this.debug("string match",G,W,w);else w=W.match(G),this.debug("pattern match",G,W,w);if(!w)return!1}if(Q===q&&K===H)return!0;else if(Q===q)return U;else if(K===H)return Q===q-1&&$[Q]==="";throw Error("wtf?")};function k51($){return $.replace(/\\(.)/g,"$1")}function f51($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var EX=O((JR1,TX)=>{function zJ0($){return $.charAt(0)==="/"}function XJ0($){var I=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=I.exec($),Y=U[1]||"",J=Boolean(Y&&Y.charAt(1)!==":");return Boolean(U[2]||J)}TX.exports=process.platform==="win32"?XJ0:zJ0;TX.exports.posix=zJ0;TX.exports.win32=XJ0});var Dg=O((r51)=>{r51.setopts=d51;r51.ownProp=LJ0;r51.makeAbs=Gq;r51.finish=m51;r51.mark=l51;r51.isIgnored=OJ0;r51.childrenIgnored=o51;function LJ0($,I){return Object.prototype.hasOwnProperty.call($,I)}var i51=r("fs"),dY=r("path"),b51=PX(),DJ0=EX(),Lg=b51.Minimatch;function n51($,I){return $.localeCompare(I,"en")}function p51($,I){if($.ignore=I.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(c51)}function c51($){var I=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");I=new Lg(U,{dot:!0})}return{matcher Line truncated
*/SU0.exports=function($,I){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var Y="";if(U>4&&$[3]==="\\"){var J=$[2];if((J==="?"||J===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),Y="//"}var Q=$.split(/[/\\]+/);if(I!==!1&&Q[Q.length-1]==="")Q.pop();return Y+Q.join("/")}});var h_=F((qR1,fU0)=>{var yU0=9007199254740991,G41="[object Arguments]",W41="[object Function]",w41="[object GeneratorFunction]",V41=/^(?:0|[1-9]\d*)$/;function hU0($,I,U){switch(U.length){case 0:return $.call(I);case 1:return $.call(I,U[0]);case 2:return $.call(I,U[0],U[1]);case 3:return $.call(I,U[0],U[1],U[2])}return $.apply(I,U)}function Z41($,I){var U=-1,Y=Array($);while(++U<$)Y[U]=I(U);return Y}var tK=Object.prototype,aK=tK.hasOwnProperty,uU0=tK.toString,z41=tK.propertyIsEnumerable,gU0=Math.max;function X41($,I){var U=E41($)||T41($)?Z41($.length,String):[],Y=U.length,J=!!Y;for(var Q in $)if((I||aK.call($,Q))&&!(J&&(Q=="length"||kU0(Q,Y))))U.push(Q);return U}function L41($,I,U,Y){if($===void 0||S_($,tK[U])&&!aK.call(Y,U))return I;return $}function D41($,I,U){var Y=$[I];if(!(aK.call($,I)&&S_(Y,U))||U===void 0&&!(I in $))$[I]=U}function F41($){if(!y_($))return P41($);var I=A41($),U=[];for(var Y in $)if(!(Y=="constructor"&&(I||!aK.call($,Y))))U.push(Y);return U}function xU0($,I){return I=gU0(I===void 0?$.length-1:I,0),function(){var U=arguments,Y=-1,J=gU0(U.length-I,0),Q=Array(J);while(++Y<J)Q[Y]=U[I+Y];Y=-1;var K=Array(I+1);while(++Y<I)K[Y]=U[Y];return K[I]=Q,hU0($,this,K)}}function O41($,I,U,Y){U||(U={});var J=-1,Q=I.length;while(++J<Q){var K=I[J],q=Y?Y(U[K],$[K],K,U,$):void 0;D41(U,K,q===void 0?$[K]:q)}return U}function N41($){return xU0(function(I,U){var Y=-1,J=U.length,Q=J>1?U[J-1]:void 0,K=J>2?U[2]:void 0;if(Q=$.length>3&&typeof Q=="function"?(J--,Q):void 0,K&&M41(U[0],U[1],K))Q=J<3?void 0:Q,J=1;I=Object(I);while(++Y<J){var q=U[Y];if(q)$(I,q,Y,Q)}return I})}function kU0($,I){return I=I==null?yU0:I,!!I&&(typeof $=="number"||V41.test($))&&($>-1&&$%1==0&&$<I)}function M41($,I,U){if(!y_(U))return!1;var Y=typeof I;if(Y=="number"?g_(U)&&kU0(I,U.length):Y=="string"&&(I in U))return S_(U[I],$);return!1}function A41($){var I=$&&$.constructor,U=typeof I=="function"&&I.prototype||tK;return $===U}function P41($){var I=[];if($!=null)for(var U in Object($))I.push(U);return I}function S_($,I){return $===I||$!==$&&I!==I}function T41($){return B41($)&&aK.call($,"callee")&&(!z41.call($,"callee")||uU0.call($)==G41)}var E41=Array.isArray;function g_($){return $!=null&&R41($.length)&&!v41($)}function B41($){return j41($)&&g_($)}function v41($){var I=y_($)?uU0.call($):"";return I==W41||I==w41}function R41($){return typeof $=="number"&&$>-1&&$%1==0&&$<=yU0}function y_($){var I=typeof $;return!!$&&(I=="object"||I=="function")}function j41($){return!!$&&typeof $=="object"}var C41=N41(function($,I,U,Y){O41(I,S41(I),$,Y)}),_41=xU0(function($){return $.push(void 0,L41),hU0(C41,void 0,$)});function S41($){return g_($)?X41($,!0):F41($)}fU0.exports=_41});var iU0=F((HR1,u_)=>{function g41($,I){if(!($ instanceof I))throw TypeError("Cannot call a class as a function")}var bU0=A4().Buffer,sK=t("util");function y41($,I,U){$.copy(I,U)}u_.exports=function(){function $(){g41(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var Y={data:U,next:null};if(this.length>0)this.tail.next=Y;else this.head=Y;this.tail=Y,++this.length},$.prototype.unshift=function(U){var Y={data:U,next:this.head};if(this.length===0)this.tail=Y;this.head=Y,++this.length},$.prototype.shift=function(){if(this.length===0)return;var U=this.head.data;if(this.length===1)this.head=this.tail=null;else this.head=this.head.next;return--this.length,U},$.prototype.clear=function(){this.head=this.tail=null,this.length=0},$.prototype.join=function(U){if(this.length===0)return"";var Y=this.head,J=""+Y.data;while(Y=Y.next)J+=U+Y.data;return J},$.prototype.concat=function(U){if(this.length===0)return bU0.alloc(0);var Y=bU0.allocUnsafe(U>>>0),J=this.head,Q=0;while(J)y41(J.data,Y,Q),Q+=J.data.length,J=J.next;return Y},$}();if(sK&&sK.inspect&&sK.inspect.custom)u_.exports.prototype[sK.inspect.custom]=function(){var $=sK.inspect({length:this.length});return this.constructor.name+" "+$}});var x_=F((GR1,nU0)=>{var GX=M4();function h41($,I){var U=this,Y=this._readableState&&this._readableState.destroyed,J=this._writableState&&this._writableState.destroyed;if(Y||J){if(I)I($);else if($){if(!this._writableState)GX.nextTick(WX,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,GX.nextTick(WX,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(Q){if(!I&&Q){if(!U._writableState)GX.nextTick(WX,U,Q);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,GX.nextTick(WX,U,Q)}else if(I)I(Q)}),this}function u41(){if(this._readableState)this._readable Line truncated
%s`,R,R,E,Y);var k=E.type==="*"?MS:E.type==="?"?NS:"\\"+E.type;J=!0,Y=Y.slice(0,E.reStart)+k+"\\("+R}if(X(),Q)Y+="\\\\";var g=!1;switch(Y.charAt(0)){case"[":case".":case"(":g=!0}for(var f=q.length-1;f>-1;f--){var j=q[f],p=Y.slice(0,j.reStart),n=Y.slice(j.reStart,j.reEnd-8),S=Y.slice(j.reEnd-8,j.reEnd),b=Y.slice(j.reEnd);S+=b;var i=p.split("(").length-1,U0=b;for(L=0;L<i;L++)U0=U0.replace(/\)[+*?]?/,"");b=U0;var B="";if(b===""&&I!==BX)B="$";var x=p+n+b+B+S;Y=x}if(Y!==""&&J)Y="(?=.)"+Y;if(g)Y=V+Y;if(I===BX)return[Y,J];if(!J)return I91($);var c=U.nocase?"i":"";try{var r=new RegExp("^"+Y+"$",c)}catch(J0){return new RegExp("$.")}return r._glob=$,r._src=Y,r}Z$.makeRe=function($,I){return new v4($,I||{}).makeRe()};v4.prototype.makeRe=$91;function $91(){if(this.regexp||this.regexp===!1)return this.regexp;var $=this.set;if(!$.length)return this.regexp=!1,this.regexp;var I=this.options,U=I.noglobstar?MS:I.dot?m51:l51,Y=I.nocase?"i":"",J=$.map(function(Q){return Q.map(function(K){return K===h3?U:typeof K==="string"?U91(K):K._src}).join("\\/")}).join("|");if(J="^(?:"+J+")$",this.negate)J="^(?!"+J+").*$";try{this.regexp=new RegExp(J,Y)}catch(Q){this.regexp=!1}return this.regexp}Z$.match=function($,I,U){U=U||{};var Y=new v4(I,U);if($=$.filter(function(J){return Y.match(J)}),Y.options.nonull&&!$.length)$.push(I);return $};v4.prototype.match=function(I,U){if(typeof U>"u")U=this.partial;if(this.debug("match",I,this.pattern),this.comment)return!1;if(this.empty)return I==="";if(I==="/"&&U)return!0;var Y=this.options;if(Wq.sep!=="/")I=I.split(Wq.sep).join("/");I=I.split(LJ0),this.debug(this.pattern,"split",I);var J=this.set;this.debug(this.pattern,"set",J);var Q,K;for(K=I.length-1;K>=0;K--)if(Q=I[K],Q)break;for(K=0;K<J.length;K++){var q=J[K],H=I;if(Y.matchBase&&q.length===1)H=[Q];var G=this.matchOne(H,q,U);if(G){if(Y.flipNegate)return!0;return!this.negate}}if(Y.flipNegate)return!1;return this.negate};v4.prototype.matchOne=function($,I,U){if(I.indexOf(h3)!==-1)return this._matchGlobstar($,I,U,0,0);return this._matchOne($,I,U,0,0)};v4.prototype._matchGlobstar=function($,I,U,Y,J){var Q,K=-1;for(Q=J;Q<I.length;Q++)if(I[Q]===h3){K=Q;break}var q=-1;for(Q=I.length-1;Q>=0;Q--)if(I[Q]===h3){q=Q;break}var H=I.slice(J,K),G=U?I.slice(K+1):I.slice(K+1,q),W=U?[]:I.slice(q+1);if(H.length){var w=$.slice(Y,Y+H.length);if(!this._matchOne(w,H,U,0,0))return!1;Y+=H.length}var V=0;if(W.length){if(W.length+Y>$.length)return!1;var Z=$.length-W.length;if(this._matchOne($,W,U,Z,0))V=W.length;else{if($[$.length-1]!==""||Y+W.length===$.length)return!1;if(Z--,!this._matchOne($,W,U,Z,0))return!1;V=W.length+1}}if(!G.length){var X=!!V;for(Q=Y;Q<$.length-V;Q++){var L=String($[Q]);if(X=!0,L==="."||L===".."||!this.options.dot&&L.charAt(0)===".")return!1}return U||X}var D=[[[],0]],O=D[0],E=0,T=[0];for(var A=0;A<G.length;A++){var R=G[A];if(R===h3)T.push(E),O=[[],0],D.push(O);else O[0].push(R),E++}var k=D.length-1,g=$.length-V;for(var f=0;f<D.length;f++)D[f][1]=g-(T[k--]+D[f][0].length);return!!this._matchGlobStarBodySections($,D,Y,0,U,0,!!V)};v4.prototype._matchGlobStarBodySections=function($,I,U,Y,J,Q,K){var q=I[Y];if(!q){for(var H=U;H<$.length;H++){K=!0;var G=$[H];if(G==="."||G===".."||!this.options.dot&&G.charAt(0)===".")return!1}return K}var W=q[0],w=q[1];while(U<=w){var V=this._matchOne($.slice(0,U+W.length),W,J,U,0);if(V&&Q<this.maxGlobstarRecursion){var Z=this._matchGlobStarBodySections($,I,U+W.length,Y+1,J,Q+1,K);if(Z!==!1)return Z}var G=$[U];if(G==="."||G===".."||!this.options.dot&&G.charAt(0)===".")return!1;U++}return J||null};v4.prototype._matchOne=function($,I,U,Y,J){var Q,K,q,H;for(Q=Y,K=J,q=$.length,H=I.length;Q<q&&K<H;Q++,K++){this.debug("matchOne loop");var G=I[K],W=$[Q];if(this.debug(I,G,W),G===!1||G===h3)return!1;var w;if(typeof G==="string")w=W===G,this.debug("string match",G,W,w);else w=W.match(G),this.debug("pattern match",G,W,w);if(!w)return!1}if(Q===q&&K===H)return!0;else if(Q===q)return U;else if(K===H)return Q===q-1&&$[Q]==="";throw Error("wtf?")};function I91($){return $.replace(/\\(.)/g,"$1")}function U91($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var CX=F((RR1,jX)=>{function OJ0($){return $.charAt(0)==="/"}function NJ0($){var I=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=I.exec($),Y=U[1]||"",J=Boolean(Y&&Y.charAt(1)!==":");return Boolean(U[2]||J)}jX.exports=process.platform==="win32"?NJ0:OJ0;jX.exports.posix=OJ0;jX.exports.win32=NJ0});var PS=F((V91)=>{V91.setopts=H91;V91.ownProp=MJ0;V91.makeAbs=wq;V91.finish=G91;V91.mark=W91;V91.isIgnored=PJ0;V91.childrenIgnored=w91;function MJ0($,I){return Object.prototype.hasOwnProperty.call($,I)}var Y91=t("fs"),mY=t("path"),J91=RX(),AJ0=CX(),AS=J91.Minimatch;function Q91($,I){return $.localeCompare(I,"en")}function K91($,I){if($.ignore=I.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(q91)}function q91($){var I=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");I=new AS(U,{dot:!0})}return{matcher Line truncated
See: https://github.com/isaacs/node-glob/issues/167`);return new h4($,I).found}function h4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof h4))return new h4($,I);if(J91(this,$,I),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var Y=0;Y<U;Y++)this._process(this.minimatch.set[Y],Y,!1);this._finish()}h4.prototype._finish=function(){if(NJ0.ok(this instanceof h4),this.realpath){var $=this;this.matches.forEach(function(I,U){var Y=$.matches[U]=Object.create(null);for(var J in I)try{J=$._makeAbs(J);var Q=Y91.realpathSync(J,$.realpathCache);Y[Q]=!0}catch(K){if(K.syscall==="stat")Y[$._makeAbs(J)]=!0;else throw K}})}h3.finish(this)};h4.prototype._process=function($,I,U){NJ0.ok(this instanceof h4);var Y=0;while(typeof $[Y]==="string")Y++;var J;switch(Y){case $.length:this._processSimple($.join("/"),I);return;case 0:J=null;break;default:J=$.slice(0,Y).join("/");break}var Q=$.slice(Y),K;if(J===null)K=".";else if(BX(J)||BX($.map(function(G){return typeof G==="string"?G:"[*]"}).join("/"))){if(!J||!BX(J))J="/"+J;K=J}else K=J;var q=this._makeAbs(K);if(Q91(this,K))return;var H=Q[0]===FJ0.GLOBSTAR;if(H)this._processGlobStar(J,K,q,Q,I,U);else this._processReaddir(J,K,q,Q,I,U)};h4.prototype._processReaddir=function($,I,U,Y,J,Q){var K=this._readdir(U,Q);if(!K)return;var q=Y[0],H=!!this.minimatch.negate,G=q._glob,W=this.dot||G.charAt(0)===".",w=[];for(var V=0;V<K.length;V++){var Z=K[V];if(Z.charAt(0)!=="."||W){var X;if(H&&!$)X=!Z.match(q);else X=Z.match(q);if(X)w.push(Z)}}var L=w.length;if(L===0)return;if(Y.length===1&&!this.mark&&!this.stat){if(!this.matches[J])this.matches[J]=Object.create(null);for(var V=0;V<L;V++){var Z=w[V];if($)if($.slice(-1)!=="/")Z=$+"/"+Z;else Z=$+Z;if(Z.charAt(0)==="/"&&!this.nomount)Z=Og.join(this.root,Z);this._emitMatch(J,Z)}return}Y.shift();for(var V=0;V<L;V++){var Z=w[V],D;if($)D=[$,Z];else D=[Z];this._process(D.concat(Y),J,Q)}};h4.prototype._emitMatch=function($,I){if(K91(this,I))return;var U=this._makeAbs(I);if(this.mark)I=this._mark(I);if(this.absolute)I=U;if(this.matches[$][I])return;if(this.nodir){var Y=this.cache[U];if(Y==="DIR"||Array.isArray(Y))return}if(this.matches[$][I]=!0,this.stat)this._stat(I)};h4.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var I,U,Y;try{U=this.fs.lstatSync($)}catch(Q){if(Q.code==="ENOENT")return null}var J=U&&U.isSymbolicLink();if(this.symlinks[$]=J,!J&&U&&!U.isDirectory())this.cache[$]="FILE";else I=this._readdir($,!1);return I};h4.prototype._readdir=function($,I){var U;if(I&&!Fg(this.symlinks,$))return this._readdirInGlobStar($);if(Fg(this.cache,$)){var Y=this.cache[$];if(!Y||Y==="FILE")return null;if(Array.isArray(Y))return Y}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(J){return this._readdirError($,J),null}};h4.prototype._readdirEntries=function($,I){if(!this.mark&&!this.stat)for(var U=0;U<I.length;U++){var Y=I[U];if($==="/")Y=$+Y;else Y=$+"/"+Y;this.cache[Y]=!0}return this.cache[$]=I,I};h4.prototype._readdirError=function($,I){switch(I.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var Y=Error(I.code+" invalid cwd "+this.cwd);throw Y.path=this.cwd,Y.code=I.code,Y}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 I;if(!this.silent)console.error("glob error",I);break}};h4.prototype._processGlobStar=function($,I,U,Y,J,Q){var K=this._readdir(U,Q);if(!K)return;var q=Y.slice(1),H=$?[$]:[],G=H.concat(q);this._process(G,J,!1);var W=K.length,w=this.symlinks[U];if(w&&Q)return;for(var V=0;V<W;V++){var Z=K[V];if(Z.charAt(0)==="."&&!this.dot)continue;var X=H.concat(K[V],q);this._process(X,J,!0);var L=H.concat(K[V],Y);this._process(L,J,!0)}};h4.prototype._processSimple=function($,I){var U=this._stat($);if(!this.matches[I])this.matches[I]=Object.create(null);if(!U)return;if($&&BX($)&&!this.nomount){var Y=/[\/\\]$/.test($);if($.charAt(0)==="/")$=Og.join(this.root,$);else if($=Og.resolve(this.root,$),Y)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(I,$)};h4.prototype._stat=function($){var I=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&Fg(this.cache,I)){var K=this.cache[I];if(Array.isArray(K))K="DIR";if(!U||K==="DIR")return K;if(U&&K==="FILE")return!1}var Y,J=this.statCache[I];if(!J){var Q;try{Q=this.fs.lstatSync(I)}catch(q){if(q&&(q.code==="ENOENT"||q.code==="ENOTDIR"))return this.statCache[I]=!1,!1}if(Q&&Q.isSymbolicLink())try{J=this.fs.statSync(I)}catch(q){J=Q}else J=Q}this.statCache[I]=J;var K=!0;if(J)K=J.isDirectory()?"DIR":"FILE";if(this.cache[I]=this.cache[I]||K,U&&K==="FILE")return!1;return K};h4.prototype._mark=function($){return h3.mark(this,$)};h4.prototype._makeAbs=function($){return h3.makeAbs(this,$)}});var Ng=O((WR1,EJ0)=>{EJ0.exports=TJ0;function TJ0($,I){if($&&I)return TJ0($)(I);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(Y){U[Y]=$[Y]}),U;f Line truncated
`);if($.linkname)I+=sg(" linkpath="+$.linkname+`
`);var U=$.pax;if(U)for(var Y in U)I+=sg(" "+Y+"="+U[Y]+`
`);return Buffer.from(I)};A71.decodePax=function($){var I={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var Y=parseInt($.slice(0,U).toString(),10);if(!Y)return I;var J=$.slice(U+1,Y-1).toString(),Q=J.indexOf("=");if(Q===-1)return I;I[J.slice(0,Q)]=J.slice(Q+1),$=$.slice(Y)}return I};A71.encode=function($){var I=w71(512),U=$.name,Y="";if($.typeflag===5&&U[U.length-1]!=="/")U+="/";if(Buffer.byteLength(U)!==U.length)return null;while(Buffer.byteLength(U)>100){var J=U.indexOf("/");if(J===-1)return null;Y+=Y?"/"+U.slice(0,J):U.slice(0,J),U=U.slice(J+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(Y)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(I.write(U),I.write(J7($.mode&D71,6),100),I.write(J7($.uid,6),108),I.write(J7($.gid,6),116),I.write(J7($.size,11),124),I.write(J7($.mtime.getTime()/1000|0,11),136),I[156]=pQ0+N71($.type),$.linkname)I.write($.linkname,157);if(cQ0.copy(I,Xq),z71.copy(I,eg),$.uname)I.write($.uname,265);if($.gname)I.write($.gname,297);if(I.write(J7($.devmajor||0,6),329),I.write(J7($.devminor||0,6),337),Y)I.write(Y,345);return I.write(J7(mQ0(I),6),148),I};A71.decode=function($,I,U){var Y=$[156]===0?0:$[156]-pQ0,J=rY($,0,100,I),Q=Q7($,100,8),K=Q7($,108,8),q=Q7($,116,8),H=Q7($,124,12),G=Q7($,136,12),W=F71(Y),w=$[157]===0?null:rY($,157,100,I),V=rY($,265,32),Z=rY($,297,32),X=Q7($,329,8),L=Q7($,337,8),D=mQ0($);if(D===256)return null;if(D!==Q7($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(cQ0.compare($,Xq,Xq+6)===0){if($[345])J=rY($,345,155,I)+"/"+J}else if(X71.compare($,Xq,Xq+6)===0&&L71.compare($,eg,eg+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(Y===0&&J&&J[J.length-1]==="/")Y=5;return{name:J,mode:Q,uid:K,gid:q,size:H,mtime:new Date(1000*G),type:W,linkname:w,uname:V,gname:Z,devmajor:X,devminor:L}}});var eQ0=O((dR1,sQ0)=>{var oQ0=r("util"),R71=nQ0(),Lq=$S(),rQ0=L6().Writable,tQ0=L6().PassThrough,aQ0=function(){},lQ0=function($){return $&=511,$&&512-$},C71=function($,I){var U=new SX($,I);return U.end(),U},j71=function($,I){if(I.path)$.name=I.path;if(I.linkpath)$.linkname=I.linkpath;if(I.size)$.size=parseInt(I.size,10);return $.pax=I,$},SX=function($,I){this._parent=$,this.offset=I,tQ0.call(this,{autoDestroy:!1})};oQ0.inherits(SX,tQ0);SX.prototype.destroy=function($){this._parent.destroy($)};var y5=function($){if(!(this instanceof y5))return new y5($);rQ0.call(this,$),$=$||{},this._offset=0,this._buffer=R71(),this._missing=0,this._partial=!1,this._onparse=aQ0,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 I=this,U=I._buffer,Y=function(){I._continue()},J=function(V){if(I._locked=!1,V)return I.destroy(V);if(!I._stream)Y()},Q=function(){I._stream=null;var V=lQ0(I._header.size);if(V)I._parse(V,K);else I._parse(512,w);if(!I._locked)Y()},K=function(){I._buffer.consume(lQ0(I._header.size)),I._parse(512,w),Y()},q=function(){var V=I._header.size;I._paxGlobal=Lq.decodePax(U.slice(0,V)),U.consume(V),Q()},H=function(){var V=I._header.size;if(I._pax=Lq.decodePax(U.slice(0,V)),I._paxGlobal)I._pax=Object.assign({},I._paxGlobal,I._pax);U.consume(V),Q()},G=function(){var V=I._header.size;this._gnuLongPath=Lq.decodeLongPath(U.slice(0,V),$.filenameEncoding),U.consume(V),Q()},W=function(){var V=I._header.size;this._gnuLongLinkPath=Lq.decodeLongPath(U.slice(0,V),$.filenameEncoding),U.consume(V),Q()},w=function(){var V=I._offset,Z;try{Z=I._header=Lq.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(X){I.emit("error",X)}if(U.consume(512),!Z){I._parse(512,w),Y();return}if(Z.type==="gnu-long-path"){I._parse(Z.size,G),Y();return}if(Z.type==="gnu-long-link-path"){I._parse(Z.size,W),Y();return}if(Z.type==="pax-global-header"){I._parse(Z.size,q),Y();return}if(Z.type==="pax-header"){I._parse(Z.size,H),Y();return}if(I._gnuLongPath)Z.name=I._gnuLongPath,I._gnuLongPath=null;if(I._gnuLongLinkPath)Z.linkname=I._gnuLongLinkPath,I._gnuLongLinkPath=null;if(I._pax)I._header=Z=j71(Z,I._pax),I._pax=null;if(I._locked=!0,!Z.size||Z.type==="directory"){I._parse(512,w),I.emit("entry",Z,C71(I,V),J);return}I._stream=new SX(I,V),I.emit("entry",Z,I._stream,J),I._parse(Z.size,Q),Y()};this._onheader=w,this._parse(512,w)};oQ0.inherits(y5,rQ0);y5.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};y5.prototype._parse=function($,I){if(this._destroyed)return;if(this._offset+=$,this._missing=$,I===this._onheader)this._partial=!1;this._onparse=I};y5.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=aQ0,this._overflow)this._write(this._overflow,void 0,$);else $()};y5.prototype._write=function($,I,U){if(this._destroyed)return;var Y=this._stream,J=this._buffer,Q=this._missing;if($.length)this._partial=!0;if($.length<Q){ Line truncated
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship($){if(!this.count)this._writeOpen();let I=`rId${++this.count}`;if($.TargetMode)this.stream.write(`<Relationship Id="${I}" Type="${$.Type}" Target="${r71.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${I}" Type="${$.Type}" Target="${$.Target}"/>`);return I}_writeClose(){this.stream.write("</Relationships>")}}E20.exports=T20});var _20=O((IC1,j20)=>{var v20=I6(),R20=b9(),a71=G4(),s71=SC(),e71=hC();class C20{constructor($,I,U){this.id=U.id,this.count=0,this._worksheet=$,this._workbook=U.workbook,this._sheetRelsWriter=I}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:R20.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let I={Type:R20.VmlDrawing,Target:`../drawings/vmlDrawing${this.id}.vml`};this.vmlRelId=this._sheetRelsWriter.addRelationship(I)}_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($,I){let U=new s71,Y=new v20;U.render(Y,$),this.commentsStream.write(Y.xml);let J=new e71,Q=new v20;J.render(Q,$,I),this.vmlStream.write(Q.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((I)=>{I.refAddress=a71.decodeAddress(I.ref)}),$.forEach((I)=>{this._writeComment(I,this.count),this.count+=1})}}commit(){if(this.count)this._writeClose(),this.commentsStream.end(),this.vmlStream.end()}}j20.exports=C20});var x20=O((UC1,u20)=>{var $31=z4(),I31=b9(),YS=G4(),g20=aE(),S20=V5(),U31=VR(),y20=aw(),JS=ew(),Y31=B20(),J31=_20(),Q31=rE(),n4=new U31,QS=k9(),K31=qC(),q31=HC(),H31=GC(),G31=YC(),W31=IC(),w31=JC(),V31=WC(),Z31=wC(),z31=VC(),X31=ZC(),L31=zC(),D31=XC(),O31=NC(),F31=DC(),N31=LC(),p4={dataValidations:new K31,sheetProperties:new q31,sheetFormatProperties:new H31,columns:new QS({tag:"cols",length:!1,childXform:new G31}),row:new W31,hyperlinks:new QS({tag:"hyperlinks",length:!1,childXform:new w31}),sheetViews:new QS({tag:"sheetViews",length:!1,childXform:new V31}),sheetProtection:new Z31,pageMargins:new z31,pageSeteup:new X31,autoFilter:new L31,picture:new D31,conditionalFormattings:new O31,headerFooter:new F31,rowBreaks:new N31};class h20{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 Y31($),this._sheetCommentsWriter=new J31(this,this._sheetRelsWriter,$),this._dimensions=new S20,this._rowZero=1,this.committed=!1,this.dataValidations=new Q31,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: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof h4))return new h4($,I);if(M91(this,$,I),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var Y=0;Y<U;Y++)this._process(this.minimatch.set[Y],Y,!1);this._finish()}h4.prototype._finish=function(){if(EJ0.ok(this instanceof h4),this.realpath){var $=this;this.matches.forEach(function(I,U){var Y=$.matches[U]=Object.create(null);for(var J in I)try{J=$._makeAbs(J);var Q=N91.realpathSync(J,$.realpathCache);Y[Q]=!0}catch(K){if(K.syscall==="stat")Y[$._makeAbs(J)]=!0;else throw K}})}u3.finish(this)};h4.prototype._process=function($,I,U){EJ0.ok(this instanceof h4);var Y=0;while(typeof $[Y]==="string")Y++;var J;switch(Y){case $.length:this._processSimple($.join("/"),I);return;case 0:J=null;break;default:J=$.slice(0,Y).join("/");break}var Q=$.slice(Y),K;if(J===null)K=".";else if(_X(J)||_X($.map(function(G){return typeof G==="string"?G:"[*]"}).join("/"))){if(!J||!_X(J))J="/"+J;K=J}else K=J;var q=this._makeAbs(K);if(A91(this,K))return;var H=Q[0]===TJ0.GLOBSTAR;if(H)this._processGlobStar(J,K,q,Q,I,U);else this._processReaddir(J,K,q,Q,I,U)};h4.prototype._processReaddir=function($,I,U,Y,J,Q){var K=this._readdir(U,Q);if(!K)return;var q=Y[0],H=!!this.minimatch.negate,G=q._glob,W=this.dot||G.charAt(0)===".",w=[];for(var V=0;V<K.length;V++){var Z=K[V];if(Z.charAt(0)!=="."||W){var X;if(H&&!$)X=!Z.match(q);else X=Z.match(q);if(X)w.push(Z)}}var L=w.length;if(L===0)return;if(Y.length===1&&!this.mark&&!this.stat){if(!this.matches[J])this.matches[J]=Object.create(null);for(var V=0;V<L;V++){var Z=w[V];if($)if($.slice(-1)!=="/")Z=$+"/"+Z;else Z=$+Z;if(Z.charAt(0)==="/"&&!this.nomount)Z=TS.join(this.root,Z);this._emitMatch(J,Z)}return}Y.shift();for(var V=0;V<L;V++){var Z=w[V],D;if($)D=[$,Z];else D=[Z];this._process(D.concat(Y),J,Q)}};h4.prototype._emitMatch=function($,I){if(P91(this,I))return;var U=this._makeAbs(I);if(this.mark)I=this._mark(I);if(this.absolute)I=U;if(this.matches[$][I])return;if(this.nodir){var Y=this.cache[U];if(Y==="DIR"||Array.isArray(Y))return}if(this.matches[$][I]=!0,this.stat)this._stat(I)};h4.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var I,U,Y;try{U=this.fs.lstatSync($)}catch(Q){if(Q.code==="ENOENT")return null}var J=U&&U.isSymbolicLink();if(this.symlinks[$]=J,!J&&U&&!U.isDirectory())this.cache[$]="FILE";else I=this._readdir($,!1);return I};h4.prototype._readdir=function($,I){var U;if(I&&!ES(this.symlinks,$))return this._readdirInGlobStar($);if(ES(this.cache,$)){var Y=this.cache[$];if(!Y||Y==="FILE")return null;if(Array.isArray(Y))return Y}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(J){return this._readdirError($,J),null}};h4.prototype._readdirEntries=function($,I){if(!this.mark&&!this.stat)for(var U=0;U<I.length;U++){var Y=I[U];if($==="/")Y=$+Y;else Y=$+"/"+Y;this.cache[Y]=!0}return this.cache[$]=I,I};h4.prototype._readdirError=function($,I){switch(I.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var Y=Error(I.code+" invalid cwd "+this.cwd);throw Y.path=this.cwd,Y.code=I.code,Y}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 I;if(!this.silent)console.error("glob error",I);break}};h4.prototype._processGlobStar=function($,I,U,Y,J,Q){var K=this._readdir(U,Q);if(!K)return;var q=Y.slice(1),H=$?[$]:[],G=H.concat(q);this._process(G,J,!1);var W=K.length,w=this.symlinks[U];if(w&&Q)return;for(var V=0;V<W;V++){var Z=K[V];if(Z.charAt(0)==="."&&!this.dot)continue;var X=H.concat(K[V],q);this._process(X,J,!0);var L=H.concat(K[V],Y);this._process(L,J,!0)}};h4.prototype._processSimple=function($,I){var U=this._stat($);if(!this.matches[I])this.matches[I]=Object.create(null);if(!U)return;if($&&_X($)&&!this.nomount){var Y=/[\/\\]$/.test($);if($.charAt(0)==="/")$=TS.join(this.root,$);else if($=TS.resolve(this.root,$),Y)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(I,$)};h4.prototype._stat=function($){var I=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&ES(this.cache,I)){var K=this.cache[I];if(Array.isArray(K))K="DIR";if(!U||K==="DIR")return K;if(U&&K==="FILE")return!1}var Y,J=this.statCache[I];if(!J){var Q;try{Q=this.fs.lstatSync(I)}catch(q){if(q&&(q.code==="ENOENT"||q.code==="ENOTDIR"))return this.statCache[I]=!1,!1}if(Q&&Q.isSymbolicLink())try{J=this.fs.statSync(I)}catch(q){J=Q}else J=Q}this.statCache[I]=J;var K=!0;if(J)K=J.isDirectory()?"DIR":"FILE";if(this.cache[I]=this.cache[I]||K,U&&K==="FILE")return!1;return K};h4.prototype._mark=function($){return u3.mark(this,$)};h4.prototype._makeAbs=function($){return u3.makeAbs(this,$)}});var BS=F((yR1,CJ0)=>{CJ0.exports=jJ0;function jJ0($,I){if($&&I)return jJ0($)(I);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(Y){U[Y]=$[Y]}),U;f Line truncated
`);if($.linkname)I+=Jg(" linkpath="+$.linkname+`
`);var U=$.pax;if(U)for(var Y in U)I+=Jg(" "+Y+"="+U[Y]+`
`);return Buffer.from(I)};f71.decodePax=function($){var I={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var Y=parseInt($.slice(0,U).toString(),10);if(!Y)return I;var J=$.slice(U+1,Y-1).toString(),Q=J.indexOf("=");if(Q===-1)return I;I[J.slice(0,Q)]=J.slice(Q+1),$=$.slice(Y)}return I};f71.encode=function($){var I=R71(512),U=$.name,Y="";if($.typeflag===5&&U[U.length-1]!=="/")U+="/";if(Buffer.byteLength(U)!==U.length)return null;while(Buffer.byteLength(U)>100){var J=U.indexOf("/");if(J===-1)return null;Y+=Y?"/"+U.slice(0,J):U.slice(0,J),U=U.slice(J+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(Y)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(I.write(U),I.write(Q7($.mode&y71,6),100),I.write(Q7($.uid,6),108),I.write(Q7($.gid,6),116),I.write(Q7($.size,11),124),I.write(Q7($.mtime.getTime()/1000|0,11),136),I[156]=oQ0+x71($.type),$.linkname)I.write($.linkname,157);if(rQ0.copy(I,Dq),_71.copy(I,Qg),$.uname)I.write($.uname,265);if($.gname)I.write($.gname,297);if(I.write(Q7($.devmajor||0,6),329),I.write(Q7($.devminor||0,6),337),Y)I.write(Y,345);return I.write(Q7(aQ0(I),6),148),I};f71.decode=function($,I,U){var Y=$[156]===0?0:$[156]-oQ0,J=tY($,0,100,I),Q=K7($,100,8),K=K7($,108,8),q=K7($,116,8),H=K7($,124,12),G=K7($,136,12),W=u71(Y),w=$[157]===0?null:tY($,157,100,I),V=tY($,265,32),Z=tY($,297,32),X=K7($,329,8),L=K7($,337,8),D=aQ0($);if(D===256)return null;if(D!==K7($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(rQ0.compare($,Dq,Dq+6)===0){if($[345])J=tY($,345,155,I)+"/"+J}else if(S71.compare($,Dq,Dq+6)===0&&g71.compare($,Qg,Qg+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(Y===0&&J&&J[J.length-1]==="/")Y=5;return{name:J,mode:Q,uid:K,gid:q,size:H,mtime:new Date(1000*G),type:W,linkname:w,uname:V,gname:Z,devmajor:X,devminor:L}}});var J20=F((Xj1,Y20)=>{var eQ0=t("util"),d71=lQ0(),Fq=Kg(),$20=D6().Writable,I20=D6().PassThrough,U20=function(){},sQ0=function($){return $&=511,$&&512-$},m71=function($,I){var U=new kX($,I);return U.end(),U},l71=function($,I){if(I.path)$.name=I.path;if(I.linkpath)$.linkname=I.linkpath;if(I.size)$.size=parseInt(I.size,10);return $.pax=I,$},kX=function($,I){this._parent=$,this.offset=I,I20.call(this,{autoDestroy:!1})};eQ0.inherits(kX,I20);kX.prototype.destroy=function($){this._parent.destroy($)};var y5=function($){if(!(this instanceof y5))return new y5($);$20.call(this,$),$=$||{},this._offset=0,this._buffer=d71(),this._missing=0,this._partial=!1,this._onparse=U20,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 I=this,U=I._buffer,Y=function(){I._continue()},J=function(V){if(I._locked=!1,V)return I.destroy(V);if(!I._stream)Y()},Q=function(){I._stream=null;var V=sQ0(I._header.size);if(V)I._parse(V,K);else I._parse(512,w);if(!I._locked)Y()},K=function(){I._buffer.consume(sQ0(I._header.size)),I._parse(512,w),Y()},q=function(){var V=I._header.size;I._paxGlobal=Fq.decodePax(U.slice(0,V)),U.consume(V),Q()},H=function(){var V=I._header.size;if(I._pax=Fq.decodePax(U.slice(0,V)),I._paxGlobal)I._pax=Object.assign({},I._paxGlobal,I._pax);U.consume(V),Q()},G=function(){var V=I._header.size;this._gnuLongPath=Fq.decodeLongPath(U.slice(0,V),$.filenameEncoding),U.consume(V),Q()},W=function(){var V=I._header.size;this._gnuLongLinkPath=Fq.decodeLongPath(U.slice(0,V),$.filenameEncoding),U.consume(V),Q()},w=function(){var V=I._offset,Z;try{Z=I._header=Fq.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(X){I.emit("error",X)}if(U.consume(512),!Z){I._parse(512,w),Y();return}if(Z.type==="gnu-long-path"){I._parse(Z.size,G),Y();return}if(Z.type==="gnu-long-link-path"){I._parse(Z.size,W),Y();return}if(Z.type==="pax-global-header"){I._parse(Z.size,q),Y();return}if(Z.type==="pax-header"){I._parse(Z.size,H),Y();return}if(I._gnuLongPath)Z.name=I._gnuLongPath,I._gnuLongPath=null;if(I._gnuLongLinkPath)Z.linkname=I._gnuLongLinkPath,I._gnuLongLinkPath=null;if(I._pax)I._header=Z=l71(Z,I._pax),I._pax=null;if(I._locked=!0,!Z.size||Z.type==="directory"){I._parse(512,w),I.emit("entry",Z,m71(I,V),J);return}I._stream=new kX(I,V),I.emit("entry",Z,I._stream,J),I._parse(Z.size,Q),Y()};this._onheader=w,this._parse(512,w)};eQ0.inherits(y5,$20);y5.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};y5.prototype._parse=function($,I){if(this._destroyed)return;if(this._offset+=$,this._missing=$,I===this._onheader)this._partial=!1;this._onparse=I};y5.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=U20,this._overflow)this._write(this._overflow,void 0,$);else $()};y5.prototype._write=function($,I,U){if(this._destroyed)return;var Y=this._stream,J=this._buffer,Q=this._missing;if($.length)this._partial=!0;if($.length<Q){ Line truncated
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship($){if(!this.count)this._writeOpen();let I=`rId${++this.count}`;if($.TargetMode)this.stream.write(`<Relationship Id="${I}" Type="${$.Type}" Target="${V31.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${I}" Type="${$.Type}" Target="${$.Target}"/>`);return I}_writeClose(){this.stream.write("</Relationships>")}}C20.exports=j20});var u20=F((Ej1,h20)=>{var S20=U6(),g20=n9(),z31=W4(),X31=fj(),L31=ij();class y20{constructor($,I,U){this.id=U.id,this.count=0,this._worksheet=$,this._workbook=U.workbook,this._sheetRelsWriter=I}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:g20.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let I={Type:g20.VmlDrawing,Target:`../drawings/vmlDrawing${this.id}.vml`};this.vmlRelId=this._sheetRelsWriter.addRelationship(I)}_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($,I){let U=new X31,Y=new S20;U.render(Y,$),this.commentsStream.write(Y.xml);let J=new L31,Q=new S20;J.render(Q,$,I),this.vmlStream.write(Q.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((I)=>{I.refAddress=z31.decodeAddress(I.ref)}),$.forEach((I)=>{this._writeComment(I,this.count),this.count+=1})}}commit(){if(this.count)this._writeClose(),this.commentsStream.end(),this.vmlStream.end()}}h20.exports=y20});var n20=F((Bj1,i20)=>{var D31=X4(),F31=n9(),Gg=W4(),x20=YB(),k20=V5(),O31=FR(),f20=UV(),Wg=JV(),N31=_20(),M31=u20(),A31=IB(),p4=new O31,wg=f9(),P31=Zj(),T31=zj(),E31=Xj(),B31=Gj(),v31=qj(),R31=Wj(),j31=Lj(),C31=Dj(),_31=Fj(),S31=Oj(),g31=Nj(),y31=Mj(),h31=Bj(),u31=Pj(),x31=Aj(),c4={dataValidations:new P31,sheetProperties:new T31,sheetFormatProperties:new E31,columns:new wg({tag:"cols",length:!1,childXform:new B31}),row:new v31,hyperlinks:new wg({tag:"hyperlinks",length:!1,childXform:new R31}),sheetViews:new wg({tag:"sheetViews",length:!1,childXform:new j31}),sheetProtection:new C31,pageMargins:new _31,pageSeteup:new S31,autoFilter:new g31,picture:new y31,conditionalFormattings:new h31,headerFooter:new u31,rowBreaks:new x31};class b20{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 N31($),this._sheetCommentsWriter=new M31(this,this._sheetRelsWriter,$),this._dimensions=new k20,this._rowZero=1,this.committed=!1,this.dataValidations=new A31,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
`)},PS=TS.getNativePromise();if(TS.isNode&&typeof MutationObserver>"u")ES=global.setImmediate,BS=process.nextTick,p3=TS.isRecentNode?function($){ES.call(global,$)}:function($){BS.call(process,$)};else if(typeof PS==="function"&&typeof PS.resolve==="function")vS=PS.resolve(),p3=function($){vS.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))p3=function(){var $=document.createElement("div"),I={attributes:!0},U=!1,Y=document.createElement("div"),J=new MutationObserver(function(){$.classList.toggle("foo"),U=!1});J.observe(Y,I);var Q=function(){if(U)return;U=!0,Y.classList.toggle("foo")};return function(q){var H=new MutationObserver(function(){H.disconnect(),q()});H.observe($,I),Q()}}();else if(typeof setImmediate<"u")p3=function($){setImmediate($)};else if(typeof setTimeout<"u")p3=function($){setTimeout($,0)};else p3=wI1;var ES,BS,vS;LK0.exports=p3});var FK0=O((zC1,OK0)=>{function VI1($,I,U,Y,J){for(var Q=0;Q<J;++Q)U[Q+Y]=$[Q+I],$[Q+I]=void 0}function H7($){this._capacity=$,this._length=0,this._front=0}H7.prototype._willBeOverCapacity=function($){return this._capacity<$};H7.prototype._pushOne=function($){var I=this.length();this._checkCapacity(I+1);var U=this._front+I&this._capacity-1;this[U]=$,this._length=I+1};H7.prototype.push=function($,I,U){var Y=this.length()+3;if(this._willBeOverCapacity(Y)){this._pushOne($),this._pushOne(I),this._pushOne(U);return}var J=this._front+Y-3;this._checkCapacity(Y);var Q=this._capacity-1;this[J+0&Q]=$,this[J+1&Q]=I,this[J+2&Q]=U,this._length=Y};H7.prototype.shift=function(){var $=this._front,I=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,I};H7.prototype.length=function(){return this._length};H7.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};H7.prototype._resizeTo=function($){var I=this._capacity;this._capacity=$;var U=this._front,Y=this._length,J=U+Y&I-1;VI1(this,0,this,I,J)};OK0.exports=H7});var BK0=O((XC1,RS)=>{var TK0;try{throw Error()}catch($){TK0=$}var ZI1=DK0(),NK0=FK0(),EK0=p1();function c4(){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=ZI1}c4.prototype.setScheduler=function($){var I=this._schedule;return this._schedule=$,this._customScheduler=!0,I};c4.prototype.hasCustomScheduler=function(){return this._customScheduler};c4.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};c4.prototype.disableTrampolineIfNecessary=function(){if(EK0.hasDevTools)this._trampolineEnabled=!1};c4.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};c4.prototype.fatalError=function($,I){if(I)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
`),process.exit(2);else this.throwLater($)};c4.prototype.throwLater=function($,I){if(arguments.length===1)I=$,$=function(){throw I};if(typeof setTimeout<"u")setTimeout(function(){$(I)},0);else try{this._schedule(function(){$(I)})}catch(U){throw Error(`No async scheduler available
`)},jg=Cg.getNativePromise();if(Cg.isNode&&typeof MutationObserver>"u")_g=global.setImmediate,Sg=process.nextTick,c3=Cg.isRecentNode?function($){_g.call(global,$)}:function($){Sg.call(process,$)};else if(typeof jg==="function"&&typeof jg.resolve==="function")gg=jg.resolve(),c3=function($){gg.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))c3=function(){var $=document.createElement("div"),I={attributes:!0},U=!1,Y=document.createElement("div"),J=new MutationObserver(function(){$.classList.toggle("foo"),U=!1});J.observe(Y,I);var Q=function(){if(U)return;U=!0,Y.classList.toggle("foo")};return function(q){var H=new MutationObserver(function(){H.disconnect(),q()});H.observe($,I),Q()}}();else if(typeof setImmediate<"u")c3=function($){setImmediate($)};else if(typeof setTimeout<"u")c3=function($){setTimeout($,0)};else c3=RI1;var _g,Sg,gg;MK0.exports=c3});var TK0=F((kj1,PK0)=>{function jI1($,I,U,Y,J){for(var Q=0;Q<J;++Q)U[Q+Y]=$[Q+I],$[Q+I]=void 0}function G7($){this._capacity=$,this._length=0,this._front=0}G7.prototype._willBeOverCapacity=function($){return this._capacity<$};G7.prototype._pushOne=function($){var I=this.length();this._checkCapacity(I+1);var U=this._front+I&this._capacity-1;this[U]=$,this._length=I+1};G7.prototype.push=function($,I,U){var Y=this.length()+3;if(this._willBeOverCapacity(Y)){this._pushOne($),this._pushOne(I),this._pushOne(U);return}var J=this._front+Y-3;this._checkCapacity(Y);var Q=this._capacity-1;this[J+0&Q]=$,this[J+1&Q]=I,this[J+2&Q]=U,this._length=Y};G7.prototype.shift=function(){var $=this._front,I=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,I};G7.prototype.length=function(){return this._length};G7.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};G7.prototype._resizeTo=function($){var I=this._capacity;this._capacity=$;var U=this._front,Y=this._length,J=U+Y&I-1;jI1(this,0,this,I,J)};PK0.exports=G7});var _K0=F((fj1,yg)=>{var jK0;try{throw Error()}catch($){jK0=$}var CI1=AK0(),EK0=TK0(),CK0=d1();function d4(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new EK0(16),this._normalQueue=new EK0(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var $=this;this.drainQueues=function(){$._drainQueues()},this._schedule=CI1}d4.prototype.setScheduler=function($){var I=this._schedule;return this._schedule=$,this._customScheduler=!0,I};d4.prototype.hasCustomScheduler=function(){return this._customScheduler};d4.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};d4.prototype.disableTrampolineIfNecessary=function(){if(CK0.hasDevTools)this._trampolineEnabled=!1};d4.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};d4.prototype.fatalError=function($,I){if(I)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
`),process.exit(2);else this.throwLater($)};d4.prototype.throwLater=function($,I){if(arguments.length===1)I=$,$=function(){throw I};if(typeof setTimeout<"u")setTimeout(function(){$(I)},0);else try{this._schedule(function(){$(I)})}catch(U){throw Error(`No async scheduler available
See http://goo.gl/MqrFmX
`)}};function MK0($,I,U){this._lateQueue.push($,I,U),this._queueTick()}function AK0($,I,U){this._normalQueue.push($,I,U),this._queueTick()}function PK0($){this._normalQueue._pushOne($),this._queueTick()}if(!EK0.hasDevTools)c4.prototype.invokeLater=MK0,c4.prototype.invoke=AK0,c4.prototype.settlePromises=PK0;else c4.prototype.invokeLater=function($,I,U){if(this._trampolineEnabled)MK0.call(this,$,I,U);else this._schedule(function(){setTimeout(function(){$.call(I,U)},100)})},c4.prototype.invoke=function($,I,U){if(this._trampolineEnabled)AK0.call(this,$,I,U);else this._schedule(function(){$.call(I,U)})},c4.prototype.settlePromises=function($){if(this._trampolineEnabled)PK0.call(this,$);else this._schedule(function(){$._settlePromises()})};c4.prototype._drainQueue=function($){while($.length()>0){var I=$.shift();if(typeof I!=="function"){I._settlePromises();continue}var U=$.shift(),Y=$.shift();I.call(U,Y)}};c4.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};c4.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};c4.prototype._reset=function(){this._isTickUsed=!1};RS.exports=c4;RS.exports.firstLineError=TK0});var u5=O((LC1,CK0)=>{var _S=n3(),zI1=_S.freeze,vK0=p1(),RK0=vK0.inherits,$J=vK0.notEnumerableProp;function IJ($,I){function U(Y){if(!(this instanceof U))return new U(Y);if($J(this,"message",typeof Y==="string"?Y:I),$J(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return RK0(U,Error),U}var CS,jS,XI1=IJ("Warning","warning"),LI1=IJ("CancellationError","cancellation error"),DI1=IJ("TimeoutError","timeout error"),Aq=IJ("AggregateError","aggregate error");try{CS=TypeError,jS=RangeError}catch($){CS=IJ("TypeError","type error"),jS=IJ("RangeError","range error")}var nX="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(c3=0;c3<nX.length;++c3)if(typeof Array.prototype[nX[c3]]==="function")Aq.prototype[nX[c3]]=Array.prototype[nX[c3]];var c3;_S.defineProperty(Aq.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});Aq.prototype.isOperational=!0;var pX=0;Aq.prototype.toString=function(){var $=Array(pX*4+1).join(" "),I=`
`)}};function BK0($,I,U){this._lateQueue.push($,I,U),this._queueTick()}function vK0($,I,U){this._normalQueue.push($,I,U),this._queueTick()}function RK0($){this._normalQueue._pushOne($),this._queueTick()}if(!CK0.hasDevTools)d4.prototype.invokeLater=BK0,d4.prototype.invoke=vK0,d4.prototype.settlePromises=RK0;else d4.prototype.invokeLater=function($,I,U){if(this._trampolineEnabled)BK0.call(this,$,I,U);else this._schedule(function(){setTimeout(function(){$.call(I,U)},100)})},d4.prototype.invoke=function($,I,U){if(this._trampolineEnabled)vK0.call(this,$,I,U);else this._schedule(function(){$.call(I,U)})},d4.prototype.settlePromises=function($){if(this._trampolineEnabled)RK0.call(this,$);else this._schedule(function(){$._settlePromises()})};d4.prototype._drainQueue=function($){while($.length()>0){var I=$.shift();if(typeof I!=="function"){I._settlePromises();continue}var U=$.shift(),Y=$.shift();I.call(U,Y)}};d4.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};d4.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};d4.prototype._reset=function(){this._isTickUsed=!1};yg.exports=d4;yg.exports.firstLineError=jK0});var u5=F((bj1,yK0)=>{var xg=p3(),_I1=xg.freeze,SK0=d1(),gK0=SK0.inherits,IJ=SK0.notEnumerableProp;function UJ($,I){function U(Y){if(!(this instanceof U))return new U(Y);if(IJ(this,"message",typeof Y==="string"?Y:I),IJ(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return gK0(U,Error),U}var hg,ug,SI1=UJ("Warning","warning"),gI1=UJ("CancellationError","cancellation error"),yI1=UJ("TimeoutError","timeout error"),Tq=UJ("AggregateError","aggregate error");try{hg=TypeError,ug=RangeError}catch($){hg=UJ("TypeError","type error"),ug=UJ("RangeError","range error")}var lX="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(d3=0;d3<lX.length;++d3)if(typeof Array.prototype[lX[d3]]==="function")Tq.prototype[lX[d3]]=Array.prototype[lX[d3]];var d3;xg.defineProperty(Tq.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});Tq.prototype.isOperational=!0;var oX=0;Tq.prototype.toString=function(){var $=Array(oX*4+1).join(" "),I=`
`+$+`AggregateError of:
`;pX++,$=Array(pX*4+1).join(" ");for(var U=0;U<this.length;++U){var Y=this[U]===this?"[Circular AggregateError]":this[U]+"",J=Y.split(`
`;oX++,$=Array(oX*4+1).join(" ");for(var U=0;U<this.length;++U){var Y=this[U]===this?"[Circular AggregateError]":this[U]+"",J=Y.split(`
`);for(var Q=0;Q<J.length;++Q)J[Q]=$+J[Q];Y=J.join(`
`),I+=Y+`
`}return pX--,I};function Mq($){if(!(this instanceof Mq))return new Mq($);if($J(this,"name","OperationalError"),$J(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)$J(this,"message",$.message),$J(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}RK0(Mq,Error);var d3=Error.__BluebirdErrorTypes__;if(!d3)d3=zI1({CancellationError:LI1,TimeoutError:DI1,OperationalError:Mq,RejectionError:Mq,AggregateError:Aq}),_S.defineProperty(Error,"__BluebirdErrorTypes__",{value:d3,writable:!1,enumerable:!1,configurable:!1});CK0.exports={Error,TypeError:CS,RangeError:jS,CancellationError:d3.CancellationError,OperationalError:d3.OperationalError,TimeoutError:d3.TimeoutError,AggregateError:d3.AggregateError,Warning:XI1}});var _K0=O((DC1,jK0)=>{jK0.exports=function($,I){var U=p1(),Y=U.errorObj,J=U.isObject;function Q(w,V){if(J(w)){if(w instanceof $)return w;var Z=q(w);if(Z===Y){if(V)V._pushContext();var X=$.reject(Z.e);if(V)V._popContext();return X}else if(typeof Z==="function"){if(G(w)){var X=new $(I);return w._then(X._fulfill,X._reject,void 0,X,null),X}return W(w,Z,V)}}return w}function K(w){return w.then}function q(w){try{return K(w)}catch(V){return Y.e=V,Y}}var H={}.hasOwnProperty;function G(w){try{return H.call(w,"_promise0")}catch(V){return!1}}function W(w,V,Z){var X=new $(I),L=X;if(Z)Z._pushContext();if(X._captureStackTrace(),Z)Z._popContext();var D=!0,F=U.tryCatch(V).call(w,E,T);if(D=!1,X&&F===Y)X._rejectCallback(F.e,!0,!0),X=null;function E(A){if(!X)return;X._resolveCallback(A),X=null}function T(A){if(!X)return;X._rejectCallback(A,D,!0),X=null}return L}return Q}});var SK0=O((OC1,gK0)=>{gK0.exports=function($,I,U,Y,J){var Q=p1(),K=Q.isArray;function q(G){switch(G){case-2:return[];case-3:return{}}}function H(G){var W=this._promise=new $(I);if(G instanceof $)W._propagateFrom(G,3);W._setOnCancel(this),this._values=G,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return Q.inherits(H,J),H.prototype.length=function(){return this._length},H.prototype.promise=function(){return this._promise},H.prototype._init=function G(W,w){var V=U(this._values,this._promise);if(V instanceof $){V=V._target();var Z=V._bitField;if(this._values=V,(Z&50397184)===0)return this._promise._setAsyncGuaranteed(),V._then(G,this._reject,void 0,this,w);else if((Z&33554432)!==0)V=V._value();else if((Z&16777216)!==0)return this._reject(V._reason());else return this._cancel()}if(V=Q.asArray(V),V===null){var X=Y("expecting an array or an iterable object but got "+Q.classString(V)).reason();this._promise._rejectCallback(X,!1);return}if(V.length===0){if(w===-5)this._resolveEmptyArray();else this._resolve(q(w));return}this._iterate(V)},H.prototype._iterate=function(G){var W=this.getActualLength(G.length);this._length=W,this._values=this.shouldCopyValues()?Array(W):this._values;var w=this._promise,V=!1,Z=null;for(var X=0;X<W;++X){var L=U(G[X],w);if(L instanceof $)L=L._target(),Z=L._bitField;else Z=null;if(V){if(Z!==null)L.suppressUnhandledRejections()}else if(Z!==null)if((Z&50397184)===0)L._proxy(this,X),this._values[X]=L;else if((Z&33554432)!==0)V=this._promiseFulfilled(L._value(),X);else if((Z&16777216)!==0)V=this._promiseRejected(L._reason(),X);else V=this._promiseCancelled(X);else V=this._promiseFulfilled(L,X)}if(!V)w._setAsyncGuaranteed()},H.prototype._isResolved=function(){return this._values===null},H.prototype._resolve=function(G){this._values=null,this._promise._fulfill(G)},H.prototype._cancel=function(){if(this._isResolved()||!this._promise._isCancellable())return;this._values=null,this._promise._cancel()},H.prototype._reject=function(G){this._values=null,this._promise._rejectCallback(G,!1)},H.prototype._promiseFulfilled=function(G,W){this._values[W]=G;var w=++this._totalResolved;if(w>=this._length)return this._resolve(this._values),!0;return!1},H.prototype._promiseCancelled=function(){return this._cancel(),!0},H.prototype._promiseRejected=function(G){return this._totalResolved++,this._reject(G),!0},H.prototype._resultCancelled=function(){if(this._isResolved())return;var G=this._values;if(this._cancel(),G instanceof $)G.cancel();else for(var W=0;W<G.length;++W)if(G[W]instanceof $)G[W].cancel()},H.prototype.shouldCopyValues=function(){return!0},H.prototype.getActualLength=function(G){return G},H}});var hK0=O((FC1,yK0)=>{yK0.exports=function($){var I=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function Y(){this._trace=new Y.CapturedTrace(Q())}Y.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},Y.prototype._popContext=function(){if(this._trace!==void 0){var K=U.pop(),q=K._promiseCreated;return K._promiseCreated=null,q}return null};function J(){if(I)return new Y}function Q(){var K=U.length-1;if(K>=0)return U[K];return}return Y.CapturedTrace=null,Y.create=J,Y.deactivateLong Line truncated
`}return oX--,I};function Pq($){if(!(this instanceof Pq))return new Pq($);if(IJ(this,"name","OperationalError"),IJ(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)IJ(this,"message",$.message),IJ(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}gK0(Pq,Error);var m3=Error.__BluebirdErrorTypes__;if(!m3)m3=_I1({CancellationError:gI1,TimeoutError:yI1,OperationalError:Pq,RejectionError:Pq,AggregateError:Tq}),xg.defineProperty(Error,"__BluebirdErrorTypes__",{value:m3,writable:!1,enumerable:!1,configurable:!1});yK0.exports={Error,TypeError:hg,RangeError:ug,CancellationError:m3.CancellationError,OperationalError:m3.OperationalError,TimeoutError:m3.TimeoutError,AggregateError:m3.AggregateError,Warning:SI1}});var uK0=F((ij1,hK0)=>{hK0.exports=function($,I){var U=d1(),Y=U.errorObj,J=U.isObject;function Q(w,V){if(J(w)){if(w instanceof $)return w;var Z=q(w);if(Z===Y){if(V)V._pushContext();var X=$.reject(Z.e);if(V)V._popContext();return X}else if(typeof Z==="function"){if(G(w)){var X=new $(I);return w._then(X._fulfill,X._reject,void 0,X,null),X}return W(w,Z,V)}}return w}function K(w){return w.then}function q(w){try{return K(w)}catch(V){return Y.e=V,Y}}var H={}.hasOwnProperty;function G(w){try{return H.call(w,"_promise0")}catch(V){return!1}}function W(w,V,Z){var X=new $(I),L=X;if(Z)Z._pushContext();if(X._captureStackTrace(),Z)Z._popContext();var D=!0,O=U.tryCatch(V).call(w,E,T);if(D=!1,X&&O===Y)X._rejectCallback(O.e,!0,!0),X=null;function E(A){if(!X)return;X._resolveCallback(A),X=null}function T(A){if(!X)return;X._rejectCallback(A,D,!0),X=null}return L}return Q}});var kK0=F((nj1,xK0)=>{xK0.exports=function($,I,U,Y,J){var Q=d1(),K=Q.isArray;function q(G){switch(G){case-2:return[];case-3:return{}}}function H(G){var W=this._promise=new $(I);if(G instanceof $)W._propagateFrom(G,3);W._setOnCancel(this),this._values=G,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return Q.inherits(H,J),H.prototype.length=function(){return this._length},H.prototype.promise=function(){return this._promise},H.prototype._init=function G(W,w){var V=U(this._values,this._promise);if(V instanceof $){V=V._target();var Z=V._bitField;if(this._values=V,(Z&50397184)===0)return this._promise._setAsyncGuaranteed(),V._then(G,this._reject,void 0,this,w);else if((Z&33554432)!==0)V=V._value();else if((Z&16777216)!==0)return this._reject(V._reason());else return this._cancel()}if(V=Q.asArray(V),V===null){var X=Y("expecting an array or an iterable object but got "+Q.classString(V)).reason();this._promise._rejectCallback(X,!1);return}if(V.length===0){if(w===-5)this._resolveEmptyArray();else this._resolve(q(w));return}this._iterate(V)},H.prototype._iterate=function(G){var W=this.getActualLength(G.length);this._length=W,this._values=this.shouldCopyValues()?Array(W):this._values;var w=this._promise,V=!1,Z=null;for(var X=0;X<W;++X){var L=U(G[X],w);if(L instanceof $)L=L._target(),Z=L._bitField;else Z=null;if(V){if(Z!==null)L.suppressUnhandledRejections()}else if(Z!==null)if((Z&50397184)===0)L._proxy(this,X),this._values[X]=L;else if((Z&33554432)!==0)V=this._promiseFulfilled(L._value(),X);else if((Z&16777216)!==0)V=this._promiseRejected(L._reason(),X);else V=this._promiseCancelled(X);else V=this._promiseFulfilled(L,X)}if(!V)w._setAsyncGuaranteed()},H.prototype._isResolved=function(){return this._values===null},H.prototype._resolve=function(G){this._values=null,this._promise._fulfill(G)},H.prototype._cancel=function(){if(this._isResolved()||!this._promise._isCancellable())return;this._values=null,this._promise._cancel()},H.prototype._reject=function(G){this._values=null,this._promise._rejectCallback(G,!1)},H.prototype._promiseFulfilled=function(G,W){this._values[W]=G;var w=++this._totalResolved;if(w>=this._length)return this._resolve(this._values),!0;return!1},H.prototype._promiseCancelled=function(){return this._cancel(),!0},H.prototype._promiseRejected=function(G){return this._totalResolved++,this._reject(G),!0},H.prototype._resultCancelled=function(){if(this._isResolved())return;var G=this._values;if(this._cancel(),G instanceof $)G.cancel();else for(var W=0;W<G.length;++W)if(G[W]instanceof $)G[W].cancel()},H.prototype.shouldCopyValues=function(){return!0},H.prototype.getActualLength=function(G){return G},H}});var bK0=F((pj1,fK0)=>{fK0.exports=function($){var I=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function Y(){this._trace=new Y.CapturedTrace(Q())}Y.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},Y.prototype._popContext=function(){if(this._trace!==void 0){var K=U.pop(),q=K._promiseCreated;return K._promiseCreated=null,q}return null};function J(){if(I)return new Y}function Q(){var K=U.length-1;if(K>=0)return U[K];return}return Y.CapturedTrace=null,Y.create=J,Y.deactivateLong Line truncated
See http://goo.gl/MqrFmX
`);if(!E0.longStackTraces&&i$()){var a=$.prototype._captureStackTrace,N=$.prototype._attachExtraTrace;E0.longStackTraces=!0,A=function(){if(Y.haveItemsQueued()&&!E0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
`);if(!v0.longStackTraces&&b6()){var a=$.prototype._captureStackTrace,N=$.prototype._attachExtraTrace;v0.longStackTraces=!0,A=function(){if(Y.haveItemsQueued()&&!v0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
See http://goo.gl/MqrFmX
`);$.prototype._captureStackTrace=a,$.prototype._attachExtraTrace=N,I.deactivateLongStackTraces(),Y.enableTrampoline(),E0.longStackTraces=!1},$.prototype._captureStackTrace=K0,$.prototype._attachExtraTrace=W0,I.activateLongStackTraces(),Y.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return E0.longStackTraces&&i$()};var R=function(){try{if(typeof CustomEvent==="function"){var a=new CustomEvent("CustomEvent");return Q.global.dispatchEvent(a),function(N,M){var j=new CustomEvent(N.toLowerCase(),{detail:M,cancelable:!0});return!Q.global.dispatchEvent(j)}}else if(typeof Event==="function"){var a=new Event("CustomEvent");return Q.global.dispatchEvent(a),function(M,j){var u=new Event(M.toLowerCase(),{cancelable:!0});return u.detail=j,!Q.global.dispatchEvent(u)}}else{var a=document.createEvent("CustomEvent");return a.initCustomEvent("testingtheevent",!1,!0,{}),Q.global.dispatchEvent(a),function(M,j){var u=document.createEvent("CustomEvent");return u.initCustomEvent(M.toLowerCase(),!1,!0,j),!Q.global.dispatchEvent(u)}}}catch(N){}return function(){return!1}}(),k=function(){if(Q.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!Q.global)return function(){return!1};return function(a){var N="on"+a.toLowerCase(),M=Q.global[N];if(!M)return!1;return M.apply(Q.global,[].slice.call(arguments,1)),!0}}}();function S(a,N){return{promise:N}}var i={promiseCreated:S,promiseFulfilled:S,promiseRejected:S,promiseResolved:S,promiseCancelled:S,promiseChained:function(a,N,M){return{promise:N,child:M}},warning:function(a,N){return{warning:N}},unhandledRejection:function(a,N,M){return{reason:N,promise:M}},rejectionHandled:S},C=function(a){var N=!1;try{N=k.apply(null,arguments)}catch(j){Y.throwLater(j),N=!0}var M=!1;try{M=R(a,i[a].apply(null,arguments))}catch(j){Y.throwLater(j),M=!0}return M||N};$.config=function(a){if(a=Object(a),"longStackTraces"in a){if(a.longStackTraces)$.longStackTraces();else if(!a.longStackTraces&&$.hasLongStackTraces())A()}if("warnings"in a){var N=a.warnings;if(E0.warnings=!!N,T=E0.warnings,Q.isObject(N)){if("wForgottenReturn"in N)T=!!N.wForgottenReturn}}if("cancellation"in a&&a.cancellation&&!E0.cancellation){if(Y.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=Y0,$.prototype._propagateFrom=B,$.prototype._onCancel=f,$.prototype._setOnCancel=b,$.prototype._attachCancellationCallback=g,$.prototype._execute=n,d=B,E0.cancellation=!0}if("monitoring"in a){if(a.monitoring&&!E0.monitoring)E0.monitoring=!0,$.prototype._fireEvent=C;else if(!a.monitoring&&E0.monitoring)E0.monitoring=!1,$.prototype._fireEvent=p}return $};function p(){return!1}$.prototype._fireEvent=p,$.prototype._execute=function(a,N,M){try{a(N,M)}catch(j){return j}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(a){},$.prototype._attachCancellationCallback=function(a){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(a,N){};function n(a,N,M){var j=this;try{a(N,M,function(u){if(typeof u!=="function")throw TypeError("onCancel must be a function, got: "+Q.toString(u));j._attachCancellationCallback(u)})}catch(u){return u}}function g(a){if(!this._isCancellable())return this;var N=this._onCancel();if(N!==void 0)if(Q.isArray(N))N.push(a);else this._setOnCancel([N,a]);else this._setOnCancel(a)}function f(){return this._onCancelField}function b(a){this._onCancelField=a}function Y0(){this._cancellationParent=void 0,this._onCancelField=void 0}function B(a,N){if((N&1)!==0){this._cancellationParent=a;var M=a._branchesRemainingToCancel;if(M===void 0)M=0;a._branchesRemainingToCancel=M+1}if((N&2)!==0&&a._isBound())this._setBoundTo(a._boundTo)}function x(a,N){if((N&2)!==0&&a._isBound())this._setBoundTo(a._boundTo)}var d=x;function t(){var a=this._boundTo;if(a!==void 0){if(a instanceof $)if(a.isFulfilled())return a.value();else return}return a}function K0(){this._trace=new $$(this._peekContext())}function W0(a,N){if(K(a)){var M=this._trace;if(M!==void 0){if(N)M=M._parent}if(M!==void 0)M.attachExtraTrace(a);else if(!a.__stackCleaned__){var j=q4(a);Q.notEnumerableProp(a,"stack",j.message+`
`+j.stack.join(`
`)),Q.notEnumerableProp(a,"__stackCleaned__",!0)}}}function A0(a,N,M,j,u){if(a===void 0&&N!==null&&T){if(u!==void 0&&u._returnedNonUndefined())return;if((j._bitField&65535)===0)return;if(M)M=M+" ";var s="",m="";if(N._trace){var e=N._trace.stack.split(`
`),J0=S0(e);for(var G0=J0.length-1;G0>=0;--G0){var C0=J0[G0];if(!W.test(C0)){var i0=C0.match(w);if(i0)s="at "+i0[1]+":"+i0[2]+":"+i0[3]+" ";break}}if(J0.length>0){var x0=J0[0];for(var G0=0;G0<e.length;++G0)if(e[G0]===x0){if(G0>0)m=`
`+e[G0-1];break}}}var Q1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+m;j._warn(Q1,!0,N)}}function v0(a,N){var M=a+" is deprecated and will be removed in a future version.";if(N)M+=" Use "+N+" instead.";return L1(M)}function L1(a,N,M){if(!E0.warnings)return;var j=new J(a),u;if(N)M._attachExtraTrace(j);else if(E0.longStackTraces&&(u=$._peekContext()))u.attachExtraTrace(j);else{var s=q4(j);j.stack=s.message+`
`);$.prototype._captureStackTrace=a,$.prototype._attachExtraTrace=N,I.deactivateLongStackTraces(),Y.enableTrampoline(),v0.longStackTraces=!1},$.prototype._captureStackTrace=J0,$.prototype._attachExtraTrace=w0,I.activateLongStackTraces(),Y.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return v0.longStackTraces&&b6()};var R=function(){try{if(typeof CustomEvent==="function"){var a=new CustomEvent("CustomEvent");return Q.global.dispatchEvent(a),function(N,M){var C=new CustomEvent(N.toLowerCase(),{detail:M,cancelable:!0});return!Q.global.dispatchEvent(C)}}else if(typeof Event==="function"){var a=new Event("CustomEvent");return Q.global.dispatchEvent(a),function(M,C){var u=new Event(M.toLowerCase(),{cancelable:!0});return u.detail=C,!Q.global.dispatchEvent(u)}}else{var a=document.createEvent("CustomEvent");return a.initCustomEvent("testingtheevent",!1,!0,{}),Q.global.dispatchEvent(a),function(M,C){var u=document.createEvent("CustomEvent");return u.initCustomEvent(M.toLowerCase(),!1,!0,C),!Q.global.dispatchEvent(u)}}}catch(N){}return function(){return!1}}(),k=function(){if(Q.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!Q.global)return function(){return!1};return function(a){var N="on"+a.toLowerCase(),M=Q.global[N];if(!M)return!1;return M.apply(Q.global,[].slice.call(arguments,1)),!0}}}();function g(a,N){return{promise:N}}var f={promiseCreated:g,promiseFulfilled:g,promiseRejected:g,promiseResolved:g,promiseCancelled:g,promiseChained:function(a,N,M){return{promise:N,child:M}},warning:function(a,N){return{warning:N}},unhandledRejection:function(a,N,M){return{reason:N,promise:M}},rejectionHandled:g},j=function(a){var N=!1;try{N=k.apply(null,arguments)}catch(C){Y.throwLater(C),N=!0}var M=!1;try{M=R(a,f[a].apply(null,arguments))}catch(C){Y.throwLater(C),M=!0}return M||N};$.config=function(a){if(a=Object(a),"longStackTraces"in a){if(a.longStackTraces)$.longStackTraces();else if(!a.longStackTraces&&$.hasLongStackTraces())A()}if("warnings"in a){var N=a.warnings;if(v0.warnings=!!N,T=v0.warnings,Q.isObject(N)){if("wForgottenReturn"in N)T=!!N.wForgottenReturn}}if("cancellation"in a&&a.cancellation&&!v0.cancellation){if(Y.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=U0,$.prototype._propagateFrom=B,$.prototype._onCancel=b,$.prototype._setOnCancel=i,$.prototype._attachCancellationCallback=S,$.prototype._execute=n,c=B,v0.cancellation=!0}if("monitoring"in a){if(a.monitoring&&!v0.monitoring)v0.monitoring=!0,$.prototype._fireEvent=j;else if(!a.monitoring&&v0.monitoring)v0.monitoring=!1,$.prototype._fireEvent=p}return $};function p(){return!1}$.prototype._fireEvent=p,$.prototype._execute=function(a,N,M){try{a(N,M)}catch(C){return C}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(a){},$.prototype._attachCancellationCallback=function(a){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(a,N){};function n(a,N,M){var C=this;try{a(N,M,function(u){if(typeof u!=="function")throw TypeError("onCancel must be a function, got: "+Q.toString(u));C._attachCancellationCallback(u)})}catch(u){return u}}function S(a){if(!this._isCancellable())return this;var N=this._onCancel();if(N!==void 0)if(Q.isArray(N))N.push(a);else this._setOnCancel([N,a]);else this._setOnCancel(a)}function b(){return this._onCancelField}function i(a){this._onCancelField=a}function U0(){this._cancellationParent=void 0,this._onCancelField=void 0}function B(a,N){if((N&1)!==0){this._cancellationParent=a;var M=a._branchesRemainingToCancel;if(M===void 0)M=0;a._branchesRemainingToCancel=M+1}if((N&2)!==0&&a._isBound())this._setBoundTo(a._boundTo)}function x(a,N){if((N&2)!==0&&a._isBound())this._setBoundTo(a._boundTo)}var c=x;function r(){var a=this._boundTo;if(a!==void 0){if(a instanceof $)if(a.isFulfilled())return a.value();else return}return a}function J0(){this._trace=new J$(this._peekContext())}function w0(a,N){if(K(a)){var M=this._trace;if(M!==void 0){if(N)M=M._parent}if(M!==void 0)M.attachExtraTrace(a);else if(!a.__stackCleaned__){var C=U1(a);Q.notEnumerableProp(a,"stack",C.message+`
`+C.stack.join(`
`)),Q.notEnumerableProp(a,"__stackCleaned__",!0)}}}function A0(a,N,M,C,u){if(a===void 0&&N!==null&&T){if(u!==void 0&&u._returnedNonUndefined())return;if((C._bitField&65535)===0)return;if(M)M=M+" ";var s="",m="";if(N._trace){var e=N._trace.stack.split(`
`),K0=Q0(e);for(var W0=K0.length-1;W0>=0;--W0){var _0=K0[W0];if(!W.test(_0)){var i0=_0.match(w);if(i0)s="at "+i0[1]+":"+i0[2]+":"+i0[3]+" ";break}}if(K0.length>0){var f0=K0[0];for(var W0=0;W0<e.length;++W0)if(e[W0]===f0){if(W0>0)m=`
`+e[W0-1];break}}}var H1="a promise was created in a "+M+"handler "+s+"but was not returned from it, see http://goo.gl/rRqMUw"+m;C._warn(H1,!0,N)}}function j0(a,N){var M=a+" is deprecated and will be removed in a future version.";if(N)M+=" Use "+N+" instead.";return q1(M)}function q1(a,N,M){if(!v0.warnings)return;var C=new J(a),u;if(N)M._attachExtraTrace(C);else if(v0.longStackTraces&&(u=$._peekContext()))u.attachExtraTrace(C);else{var s=U1(C);C.stack=s.message+`
`+s.stack.join(`
`)}if(!C("warning",j))_4(j,"",!0)}function f0(a,N){for(var M=0;M<N.length-1;++M)N[M].push("From previous event:"),N[M]=N[M].join(`
`)}if(!j("warning",C))F1(C,"",!0)}function k0(a,N){for(var M=0;M<N.length-1;++M)N[M].push("From previous event:"),N[M]=N[M].join(`
`);if(M<N.length)N[M]=N[M].join(`
`);return a+`
`+N.join(`
`)}function G1(a){for(var N=0;N<a.length;++N)if(a[N].length===0||N+1<a.length&&a[N][0]===a[N+1][0])a.splice(N,1),N--}function N0(a){var N=a[0];for(var M=1;M<a.length;++M){var j=a[M],u=N.length-1,s=N[u],m=-1;for(var e=j.length-1;e>=0;--e)if(j[e]===s){m=e;break}for(var e=m;e>=0;--e){var J0=j[e];if(N[u]===J0)N.pop(),u--;else break}N=j}}function S0(a){var N=[];for(var M=0;M<a.length;++M){var j=a[M],u=j===" (No stack trace)"||V.test(j),s=u&&X$(j);if(u&&!s){if(X&&j.charAt(0)!==" ")j=" "+j;N.push(j)}}return N}function m0(a){var N=a.stack.replace(/\s+$/g,"").split(`
`);for(var M=0;M<N.length;++M){var j=N[M];if(j===" (No stack trace)"||V.test(j))break}if(M>0&&a.name!="SyntaxError")N=N.slice(M);return N}function q4(a){var N=a.stack,M=a.toString();return N=typeof N==="string"&&N.length>0?m0(a):[" (No stack trace)"],{message:M,stack:a.name=="SyntaxError"?N:S0(N)}}function _4(a,N,M){if(typeof console<"u"){var j;if(Q.isObject(a)){var u=a.stack;j=N+Z(u,a)}else j=N+String(a);if(typeof L==="function")L(j,M);else if(typeof console.log==="function"||typeof console.log==="object")console.log(j)}}function z$(a,N,M,j){var u=!1;try{if(typeof N==="function")if(u=!0,a==="rejectionHandled")N(j);else N(M,j)}catch(s){Y.throwLater(s)}if(a==="unhandledRejection"){if(!C(a,M,j)&&!u)_4(M,"Unhandled rejection ")}else C(a,j)}function f$(a){var N;if(typeof a==="function")N="[function "+(a.name||"anonymous")+"]";else{N=a&&typeof a.toString==="function"?a.toString():Q.toString(a);var M=/\[object [a-zA-Z0-9$_]+\]/;if(M.test(N))try{var j=JSON.stringify(a);N=j}catch(u){}if(N.length===0)N="(empty array)"}return"(<"+t8(N)+">, no stack trace)"}function t8(a){var N=41;if(a.length<N)return a;return a.substr(0,N-3)+"..."}function i$(){return typeof t5==="function"}var X$=function(){return!1},a8=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function e6(a){var N=a.match(a8);if(N)return{fileName:N[1],line:parseInt(N[2],10)}}function P7(a,N){if(!i$())return;var M=a.stack.split(`
`),j=N.stack.split(`
`),u=-1,s=-1,m,e;for(var J0=0;J0<M.length;++J0){var G0=e6(M[J0]);if(G0){m=G0.fileName,u=G0.line;break}}for(var J0=0;J0<j.length;++J0){var G0=e6(j[J0]);if(G0){e=G0.fileName,s=G0.line;break}}if(u<0||s<0||!m||!e||m!==e||u>=s)return;X$=function(C0){if(G.test(C0))return!0;var i0=e6(C0);if(i0){if(i0.fileName===m&&(u<=i0.line&&i0.line<=s))return!0}return!1}}function $$(a){this._parent=a,this._promisesCreated=0;var N=this._length=1+(a===void 0?0:a._length);if(t5(this,$$),N>32)this.uncycle()}Q.inherits($$,Error),I.CapturedTrace=$$,$$.prototype.uncycle=function(){var a=this._length;if(a<2)return;var N=[],M={};for(var j=0,u=this;u!==void 0;++j)N.push(u),u=u._parent;a=this._length=j;for(var j=a-1;j>=0;--j){var s=N[j].stack;if(M[s]===void 0)M[s]=j}for(var j=0;j<a;++j){var m=N[j].stack,e=M[m];if(e!==void 0&&e!==j){if(e>0)N[e-1]._parent=void 0,N[e-1]._length=1;N[j]._parent=void 0,N[j]._length=1;var J0=j>0?N[j-1]:this;if(e<a-1)J0._parent=N[e+1],J0._parent.uncycle(),J0._length=J0._parent._length+1;else J0._parent=void 0,J0._length=1;var G0=J0._length+1;for(var C0=j-2;C0>=0;--C0)N[C0]._length=G0,G0++;return}}},$$.prototype.attachExtraTrace=function(a){if(a.__stackCleaned__)return;this.uncycle();var N=q4(a),M=N.message,j=[N.stack],u=this;while(u!==void 0)j.push(S0(u.stack.split(`
`))),u=u._parent;N0(j),G1(j),Q.notEnumerableProp(a,"stack",f0(M,j)),Q.notEnumerableProp(a,"__stackCleaned__",!0)};var t5=function(){var N=/^\s*at\s*/,M=function(m,e){if(typeof m==="string")return m;if(e.name!==void 0&&e.message!==void 0)return e.toString();return f$(e)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,V=N,Z=M;var j=Error.captureStackTrace;return X$=function(m){return G.test(m)},function(m,e){Error.stackTraceLimit+=6,j(m,e),Error.stackTraceLimit-=6}}var u=Error();if(typeof u.stack==="string"&&u.stack.split(`
`)[0].indexOf("stackDetection@")>=0)return V=/@/,Z=M,X=!0,function(e){e.stack=Error().stack};var s;try{throw Error()}catch(m){s="stack"in m}if(!("stack"in u)&&s&&typeof Error.stackTraceLimit==="number")return V=N,Z=M,function(e){Error.stackTraceLimit+=6;try{throw Error()}catch(J0){e.stack=J0.stack}Error.stackTraceLimit-=6};return Z=function(m,e){if(typeof m==="string")return m;if((typeof e==="object"||typeof e==="function")&&e.name!==void 0&&e.message!==void 0)return e.toString();return f$(e)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(L=function(a){console.warn(a)},Q.isNode&&process.stderr.isTTY)L=function(a,N){var M=N?"\x1B[33m":"\x1B[31m";console.warn(M+a+`\x1B[0m
`)};else if(!Q.isNode&&typeof Error().stack==="string")L=function(a,N){console.warn("%c"+a,N?"color: darkorange":"color: red")}}var E0={warnings:F,longStackTraces:!1,cancellation:!1,monitoring:!1};if(E)$.longStackTraces();return{longStackTraces:function(){return E0.longStackTraces},warnings:function(){return E0.warnings},cancellation:function(){return E0.cancellation},monitoring:function(){return E0.monitoring},propagateFromFunction:function(){return d},boundValueFunction:function(){return t},checkForgottenReturns:A0,setBounds:P7,warn:L1,deprecated:v0,CapturedTrace:$$,fireDomEvent:R,fireGlobalEvent:k}}});var fK0=O((MC1,kK0)=>{kK0.exports=function($,I){var U=p1(),Y=$.CancellationError,J=U.errorObj;function Q(w,V,Z){this.promise=w,this.type=V,this.handler=Z,this.called=!1,this.cancelPromise=null}Q.prototype.isFinallyHandler=function(){return this.type===0};function K(w){this.finallyHandler=w}K.prototype._resultCancelled=function(){q(this.finallyHandler)};function q(w,V){if(w.cancelPromise!=null){if(arguments.length>1)w.cancelPromise._reject(V);else w.cancelPromise._cancel();return w.cancelPromise=null,!0}return!1}function H(){return W.call(this,this.promise._target()._settledValue())}function G(w){if(q(this,w))return;return J.e=w,J}function W(w){var V=this.promise,Z=this.handler;if(!this.called){this.called=!0;var X=this.isFinallyHandler()?Z.call(V._boundValue()):Z.call(V._boundValue(),w);if(X!==void 0){V._setReturnedNonUndefined();var L=I(X,V);if(L instanceof $){if(this.cancelPromise!=null){if(L._isCancelled()){var D=new Y("late cancellation observer");return V._attachExtraTrace(D),J.e=D,J}else if(L.isPending())L._attachCancellationCallback(new K(this))}return L._then(H,G,void 0,this,void 0)}}}if(V.isRejected())return q(this),J.e=w,J;else return q(this),w}return $.prototype._passThrough=function(w,V,Z,X){if(typeof w!=="function")return this.then();return this._then(Z,X,void 0,new Q(this,V,w),void 0)},$.prototype.lastly=$.prototype.finally=function(w){return this._passThrough(w,0,W,W)},$.prototype.tap=function(w){return this._passThrough(w,1,W)},Q}});var bK0=O((AC1,iK0)=>{iK0.exports=function($){var I=p1(),U=n3().keys,Y=I.tryCatch,J=I.errorObj;function Q(K,q,H){return function(G){var W=H._boundValue();$:for(var w=0;w<K.length;++w){var V=K[w];if(V===Error||V!=null&&V.prototype instanceof Error){if(G instanceof V)return Y(q).call(W,G)}else if(typeof V==="function"){var Z=Y(V).call(W,G);if(Z===J)return Z;else if(Z)return Y(q).call(W,G)}else if(I.isObject(G)){var X=U(V);for(var L=0;L<X.length;++L){var D=X[L];if(V[D]!=G[D])continue $}return Y(q).call(W,G)}}return $}}return Q}});var gS=O((PC1,cK0)=>{var nK0=p1(),OI1=nK0.maybeWrapAsError,FI1=u5(),NI1=FI1.OperationalError,pK0=n3();function MI1($){return $ instanceof Error&&pK0.getPrototypeOf($)===Error.prototype}var AI1=/^(?:name|message|stack|cause)$/;function PI1($){var I;if(MI1($)){I=new NI1($),I.name=$.name,I.message=$.message,I.stack=$.stack;var U=pK0.keys($);for(var Y=0;Y<U.length;++Y){var J=U[Y];if(!AI1.test(J))I[J]=$[J]}return I}return nK0.markAsOriginatingFromRejection($),$}function TI1($,I){return function(U,Y){if($===null)return;if(U){var J=PI1(OI1(U));$._attachExtraTrace(J),$._reject(J)}else if(!I)$._fulfill(Y);else{var Q=arguments.length,K=Array(Math.max(Q-1,0));for(var q=1;q<Q;++q)K[q-1]=arguments[q];$._fulfill(K)}$=null}}cK0.exports=TI1});var mK0=O((TC1,dK0)=>{dK0.exports=function($,I,U,Y,J){var Q=p1(),K=Q.tryCatch;$.method=function(q){if(typeof q!=="function")throw new $.TypeError("expecting a function but got "+Q.classString(q));return function(){var H=new $(I);H._captureStackTrace(),H._pushContext();var G=K(q).apply(this,arguments),W=H._popContext();return J.checkForgottenReturns(G,W,"Promise.method",H),H._resolveFromSyncValue(G),H}},$.attempt=$.try=function(q){if(typeof q!=="function")return Y("expecting a function but got "+Q.classString(q));var H=new $(I);H._captureStackTrace(),H._pushContext();var G;if(arguments.length>1){J.deprecated("calling Promise.try with more than 1 argument");var W=arguments[1],w=arguments[2];G=Q.isArray(W)?K(q).apply(w,W):K(q).call(w,W)}else G=K(q)();var V=H._popContext();return J.checkForgottenReturns(G,V,"Promise.try",H),H._resolveFromSyncValue(G),H},$.prototype._resolveFromSyncValue=function(q){if(q===Q.errorObj)this._rejectCallback(q.e,!1);else this._resolveCallback(q,!0)}}});var oK0=O((EC1,lK0)=>{lK0.exports=function($,I,U,Y){var J=!1,Q=function(G,W){this._reject(W)},K=function(G,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(Q,Q,null,this,G)},q=function(G,W){if((this._bitField&50397184)===0)this._resolveCallback(W.target)},H=function(G,W){if(!W.promiseRejectionQueued)this._reject(G)};$.prototype.bind=function(G){if(!J)J=!0,$.prototype._propagateFrom=Y.propagateFromFunction(),$.prototype._boundValue=Y.boundValueFunction();var W=U(G),w=new $(I);w._propagateFrom(this,1);var V=this._target();if(w._setBoundTo(W),W instanceof $){var Z={promiseRejectionQueued:!1,promise:w,target:V,bindingPromise:W};V._then(I,K,voi Line truncated
`)}function I1(a){for(var N=0;N<a.length;++N)if(a[N].length===0||N+1<a.length&&a[N][0]===a[N+1][0])a.splice(N,1),N--}function M0(a){var N=a[0];for(var M=1;M<a.length;++M){var C=a[M],u=N.length-1,s=N[u],m=-1;for(var e=C.length-1;e>=0;--e)if(C[e]===s){m=e;break}for(var e=m;e>=0;--e){var K0=C[e];if(N[u]===K0)N.pop(),u--;else break}N=C}}function Q0(a){var N=[];for(var M=0;M<a.length;++M){var C=a[M],u=C===" (No stack trace)"||V.test(C),s=u&&P6(C);if(u&&!s){if(X&&C.charAt(0)!==" ")C=" "+C;N.push(C)}}return N}function R0(a){var N=a.stack.replace(/\s+$/g,"").split(`
`);for(var M=0;M<N.length;++M){var C=N[M];if(C===" (No stack trace)"||V.test(C))break}if(M>0&&a.name!="SyntaxError")N=N.slice(M);return N}function U1(a){var N=a.stack,M=a.toString();return N=typeof N==="string"&&N.length>0?R0(a):[" (No stack trace)"],{message:M,stack:a.name=="SyntaxError"?N:Q0(N)}}function F1(a,N,M){if(typeof console<"u"){var C;if(Q.isObject(a)){var u=a.stack;C=N+Z(u,a)}else C=N+String(a);if(typeof L==="function")L(C,M);else if(typeof console.log==="function"||typeof console.log==="object")console.log(C)}}function f4(a,N,M,C){var u=!1;try{if(typeof N==="function")if(u=!0,a==="rejectionHandled")N(C);else N(M,C)}catch(s){Y.throwLater(s)}if(a==="unhandledRejection"){if(!j(a,M,C)&&!u)F1(M,"Unhandled rejection ")}else j(a,C)}function f6(a){var N;if(typeof a==="function")N="[function "+(a.name||"anonymous")+"]";else{N=a&&typeof a.toString==="function"?a.toString():Q.toString(a);var M=/\[object [a-zA-Z0-9$_]+\]/;if(M.test(N))try{var C=JSON.stringify(a);N=C}catch(u){}if(N.length===0)N="(empty array)"}return"(<"+F$(N)+">, no stack trace)"}function F$(a){var N=41;if(a.length<N)return a;return a.substr(0,N-3)+"..."}function b6(){return typeof t5==="function"}var P6=function(){return!1},O$=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function Y$(a){var N=a.match(O$);if(N)return{fileName:N[1],line:parseInt(N[2],10)}}function T7(a,N){if(!b6())return;var M=a.stack.split(`
`),C=N.stack.split(`
`),u=-1,s=-1,m,e;for(var K0=0;K0<M.length;++K0){var W0=Y$(M[K0]);if(W0){m=W0.fileName,u=W0.line;break}}for(var K0=0;K0<C.length;++K0){var W0=Y$(C[K0]);if(W0){e=W0.fileName,s=W0.line;break}}if(u<0||s<0||!m||!e||m!==e||u>=s)return;P6=function(_0){if(G.test(_0))return!0;var i0=Y$(_0);if(i0){if(i0.fileName===m&&(u<=i0.line&&i0.line<=s))return!0}return!1}}function J$(a){this._parent=a,this._promisesCreated=0;var N=this._length=1+(a===void 0?0:a._length);if(t5(this,J$),N>32)this.uncycle()}Q.inherits(J$,Error),I.CapturedTrace=J$,J$.prototype.uncycle=function(){var a=this._length;if(a<2)return;var N=[],M={};for(var C=0,u=this;u!==void 0;++C)N.push(u),u=u._parent;a=this._length=C;for(var C=a-1;C>=0;--C){var s=N[C].stack;if(M[s]===void 0)M[s]=C}for(var C=0;C<a;++C){var m=N[C].stack,e=M[m];if(e!==void 0&&e!==C){if(e>0)N[e-1]._parent=void 0,N[e-1]._length=1;N[C]._parent=void 0,N[C]._length=1;var K0=C>0?N[C-1]:this;if(e<a-1)K0._parent=N[e+1],K0._parent.uncycle(),K0._length=K0._parent._length+1;else K0._parent=void 0,K0._length=1;var W0=K0._length+1;for(var _0=C-2;_0>=0;--_0)N[_0]._length=W0,W0++;return}}},J$.prototype.attachExtraTrace=function(a){if(a.__stackCleaned__)return;this.uncycle();var N=U1(a),M=N.message,C=[N.stack],u=this;while(u!==void 0)C.push(Q0(u.stack.split(`
`))),u=u._parent;M0(C),I1(C),Q.notEnumerableProp(a,"stack",k0(M,C)),Q.notEnumerableProp(a,"__stackCleaned__",!0)};var t5=function(){var N=/^\s*at\s*/,M=function(m,e){if(typeof m==="string")return m;if(e.name!==void 0&&e.message!==void 0)return e.toString();return f6(e)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,V=N,Z=M;var C=Error.captureStackTrace;return P6=function(m){return G.test(m)},function(m,e){Error.stackTraceLimit+=6,C(m,e),Error.stackTraceLimit-=6}}var u=Error();if(typeof u.stack==="string"&&u.stack.split(`
`)[0].indexOf("stackDetection@")>=0)return V=/@/,Z=M,X=!0,function(e){e.stack=Error().stack};var s;try{throw Error()}catch(m){s="stack"in m}if(!("stack"in u)&&s&&typeof Error.stackTraceLimit==="number")return V=N,Z=M,function(e){Error.stackTraceLimit+=6;try{throw Error()}catch(K0){e.stack=K0.stack}Error.stackTraceLimit-=6};return Z=function(m,e){if(typeof m==="string")return m;if((typeof e==="object"||typeof e==="function")&&e.name!==void 0&&e.message!==void 0)return e.toString();return f6(e)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(L=function(a){console.warn(a)},Q.isNode&&process.stderr.isTTY)L=function(a,N){var M=N?"\x1B[33m":"\x1B[31m";console.warn(M+a+`\x1B[0m
`)};else if(!Q.isNode&&typeof Error().stack==="string")L=function(a,N){console.warn("%c"+a,N?"color: darkorange":"color: red")}}var v0={warnings:O,longStackTraces:!1,cancellation:!1,monitoring:!1};if(E)$.longStackTraces();return{longStackTraces:function(){return v0.longStackTraces},warnings:function(){return v0.warnings},cancellation:function(){return v0.cancellation},monitoring:function(){return v0.monitoring},propagateFromFunction:function(){return c},boundValueFunction:function(){return r},checkForgottenReturns:A0,setBounds:T7,warn:q1,deprecated:j0,CapturedTrace:J$,fireDomEvent:R,fireGlobalEvent:k}}});var cK0=F((dj1,pK0)=>{pK0.exports=function($,I){var U=d1(),Y=$.CancellationError,J=U.errorObj;function Q(w,V,Z){this.promise=w,this.type=V,this.handler=Z,this.called=!1,this.cancelPromise=null}Q.prototype.isFinallyHandler=function(){return this.type===0};function K(w){this.finallyHandler=w}K.prototype._resultCancelled=function(){q(this.finallyHandler)};function q(w,V){if(w.cancelPromise!=null){if(arguments.length>1)w.cancelPromise._reject(V);else w.cancelPromise._cancel();return w.cancelPromise=null,!0}return!1}function H(){return W.call(this,this.promise._target()._settledValue())}function G(w){if(q(this,w))return;return J.e=w,J}function W(w){var V=this.promise,Z=this.handler;if(!this.called){this.called=!0;var X=this.isFinallyHandler()?Z.call(V._boundValue()):Z.call(V._boundValue(),w);if(X!==void 0){V._setReturnedNonUndefined();var L=I(X,V);if(L instanceof $){if(this.cancelPromise!=null){if(L._isCancelled()){var D=new Y("late cancellation observer");return V._attachExtraTrace(D),J.e=D,J}else if(L.isPending())L._attachCancellationCallback(new K(this))}return L._then(H,G,void 0,this,void 0)}}}if(V.isRejected())return q(this),J.e=w,J;else return q(this),w}return $.prototype._passThrough=function(w,V,Z,X){if(typeof w!=="function")return this.then();return this._then(Z,X,void 0,new Q(this,V,w),void 0)},$.prototype.lastly=$.prototype.finally=function(w){return this._passThrough(w,0,W,W)},$.prototype.tap=function(w){return this._passThrough(w,1,W)},Q}});var mK0=F((mj1,dK0)=>{dK0.exports=function($){var I=d1(),U=p3().keys,Y=I.tryCatch,J=I.errorObj;function Q(K,q,H){return function(G){var W=H._boundValue();$:for(var w=0;w<K.length;++w){var V=K[w];if(V===Error||V!=null&&V.prototype instanceof Error){if(G instanceof V)return Y(q).call(W,G)}else if(typeof V==="function"){var Z=Y(V).call(W,G);if(Z===J)return Z;else if(Z)return Y(q).call(W,G)}else if(I.isObject(G)){var X=U(V);for(var L=0;L<X.length;++L){var D=X[L];if(V[D]!=G[D])continue $}return Y(q).call(W,G)}}return $}}return Q}});var kg=F((lj1,rK0)=>{var lK0=d1(),hI1=lK0.maybeWrapAsError,uI1=u5(),xI1=uI1.OperationalError,oK0=p3();function kI1($){return $ instanceof Error&&oK0.getPrototypeOf($)===Error.prototype}var fI1=/^(?:name|message|stack|cause)$/;function bI1($){var I;if(kI1($)){I=new xI1($),I.name=$.name,I.message=$.message,I.stack=$.stack;var U=oK0.keys($);for(var Y=0;Y<U.length;++Y){var J=U[Y];if(!fI1.test(J))I[J]=$[J]}return I}return lK0.markAsOriginatingFromRejection($),$}function iI1($,I){return function(U,Y){if($===null)return;if(U){var J=bI1(hI1(U));$._attachExtraTrace(J),$._reject(J)}else if(!I)$._fulfill(Y);else{var Q=arguments.length,K=Array(Math.max(Q-1,0));for(var q=1;q<Q;++q)K[q-1]=arguments[q];$._fulfill(K)}$=null}}rK0.exports=iI1});var aK0=F((oj1,tK0)=>{tK0.exports=function($,I,U,Y,J){var Q=d1(),K=Q.tryCatch;$.method=function(q){if(typeof q!=="function")throw new $.TypeError("expecting a function but got "+Q.classString(q));return function(){var H=new $(I);H._captureStackTrace(),H._pushContext();var G=K(q).apply(this,arguments),W=H._popContext();return J.checkForgottenReturns(G,W,"Promise.method",H),H._resolveFromSyncValue(G),H}},$.attempt=$.try=function(q){if(typeof q!=="function")return Y("expecting a function but got "+Q.classString(q));var H=new $(I);H._captureStackTrace(),H._pushContext();var G;if(arguments.length>1){J.deprecated("calling Promise.try with more than 1 argument");var W=arguments[1],w=arguments[2];G=Q.isArray(W)?K(q).apply(w,W):K(q).call(w,W)}else G=K(q)();var V=H._popContext();return J.checkForgottenReturns(G,V,"Promise.try",H),H._resolveFromSyncValue(G),H},$.prototype._resolveFromSyncValue=function(q){if(q===Q.errorObj)this._rejectCallback(q.e,!1);else this._resolveCallback(q,!0)}}});var eK0=F((rj1,sK0)=>{sK0.exports=function($,I,U,Y){var J=!1,Q=function(G,W){this._reject(W)},K=function(G,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(Q,Q,null,this,G)},q=function(G,W){if((this._bitField&50397184)===0)this._resolveCallback(W.target)},H=function(G,W){if(!W.promiseRejectionQueued)this._reject(G)};$.prototype.bind=function(G){if(!J)J=!0,$.prototype._propagateFrom=Y.propagateFromFunction(),$.prototype._boundValue=Y.boundValueFunction();var W=U(G),w=new $(I);w._propagateFrom(this,1);var V=this._target();if(w._setBoundTo(W),W instanceof $){var Z={promiseRejectionQueued:!1,promise:w,target:V,bindingPromise:W};V._then(I,K,voi Line truncated
See http://goo.gl/MqrFmX
`);return this._settledValue()},Y=I.prototype.error=I.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()},J=I.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},Q=I.prototype.isRejected=function(){return(this._bitField&16777216)!==0},K=I.prototype.isPending=function(){return(this._bitField&50397184)===0},q=I.prototype.isResolved=function(){return(this._bitField&50331648)!==0};I.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 K.call(this._target())},$.prototype.isRejected=function(){return Q.call(this._target())},$.prototype.isFulfilled=function(){return J.call(this._target())},$.prototype.isResolved=function(){return q.call(this._target())},$.prototype.value=function(){return U.call(this._target())},$.prototype.reason=function(){var H=this._target();return H._unsetRejectionIsUnhandled(),Y.call(H)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=I}});var Uq0=O((CC1,Iq0)=>{Iq0.exports=function($,I,U,Y,J,Q){var K=p1(),q=K.canEvaluate,H=K.tryCatch,G=K.errorObj,W;if(q){var w=function(E){return Function("value","holder",`
`);return this._settledValue()},J=I.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},Q=I.prototype.isRejected=function(){return(this._bitField&16777216)!==0},K=I.prototype.isPending=function(){return(this._bitField&50397184)===0},q=I.prototype.isResolved=function(){return(this._bitField&50331648)!==0};I.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 K.call(this._target())},$.prototype.isRejected=function(){return Q.call(this._target())},$.prototype.isFulfilled=function(){return J.call(this._target())},$.prototype.isResolved=function(){return q.call(this._target())},$.prototype.value=function(){return U.call(this._target())},$.prototype.reason=function(){var H=this._target();return H._unsetRejectionIsUnhandled(),Y.call(H)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=I}});var qq0=F((ej1,Kq0)=>{Kq0.exports=function($,I,U,Y,J,Q){var K=d1(),q=K.canEvaluate,H=K.tryCatch,G=K.errorObj,W;if(q){var w=function(E){return Function("value","holder",`
'use strict';
holder.pIndex = value;
holder.checkFulfillment(this);
@@ -91,7 +91,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof h4))r
promise.cancel();
}
`}).join(`
`),S=T.join(", "),i="Holder$"+E,C=`return function(tryCatch, errorObj, Promise, async) {
`),g=T.join(", "),f="Holder$"+E,j=`return function(tryCatch, errorObj, Promise, async) {
'use strict';
function [TheName](fn) {
[TheProperties]
@@ -129,7 +129,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof h4))r
return [TheName];
}(tryCatch, errorObj, Promise, async);
`;return C=C.replace(/\[TheName\]/g,i).replace(/\[TheTotal\]/g,E).replace(/\[ThePassedArguments\]/g,S).replace(/\[TheProperties\]/g,R).replace(/\[CancellationCode\]/g,k),Function("tryCatch","errorObj","Promise","async",C)(H,G,$,J)},X=[],L=[],D=[];for(var F=0;F<8;++F)X.push(Z(F+1)),L.push(w(F+1)),D.push(V(F+1));W=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&&q){var b=new $(Y);b._captureStackTrace();var A=X[E-1],R=new A(T),k=L;for(var S=0;S<E;++S){var i=U(arguments[S],b);if(i instanceof $){i=i._target();var C=i._bitField;if((C&50397184)===0)i._then(k[S],W,void 0,b,R),D[S](i,R),R.asyncNeeded=!1;else if((C&33554432)!==0)k[S].call(b,i._value(),R);else if((C&16777216)!==0)b._reject(i._reason());else b._cancel()}else k[S].call(b,i,R)}if(!b._isFateSealed()){if(R.asyncNeeded){var p=Q();if(p!==null)R.fn=K.domainBind(p,R.fn)}b._setAsyncGuaranteed(),b._setOnCancel(R)}return b}}var n=arguments.length,g=Array(n);for(var f=0;f<n;++f)g[f]=arguments[f];if(T)g.pop();var b=new I(g).promise();return T!==void 0?b.spread(T):b}}});var Jq0=O((jC1,Yq0)=>{Yq0.exports=function($,I,U,Y,J,Q){var K=$._getDomain,q=p1(),H=q.tryCatch,G=q.errorObj,W=$._async;function w(Z,X,L,D){this.constructor$(Z),this._promise._captureStackTrace();var F=K();this._callback=F===null?X:q.domainBind(F,X),this._preservedValues=D===J?Array(this.length()):null,this._limit=L,this._inFlight=0,this._queue=[],W.invoke(this._asyncInit,this,void 0)}q.inherits(w,I),w.prototype._asyncInit=function(){this._init$(void 0,-2)},w.prototype._init=function(){},w.prototype._promiseFulfilled=function(Z,X){var L=this._values,D=this.length(),F=this._preservedValues,E=this._limit;if(X<0){if(X=X*-1-1,L[X]=Z,E>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(E>=1&&this._inFlight>=E)return L[X]=Z,this._queue.push(X),!1;if(F!==null)F[X]=Z;var T=this._promise,A=this._callback,R=T._boundValue();T._pushContext();var k=H(A).call(R,Z,X,D),S=T._popContext();if(Q.checkForgottenReturns(k,S,F!==null?"Promise.filter":"Promise.map",T),k===G)return this._reject(k.e),!0;var i=Y(k,this._promise);if(i instanceof $){i=i._target();var C=i._bitField;if((C&50397184)===0){if(E>=1)this._inFlight++;return L[X]=i,i._proxy(this,(X+1)*-1),!1}else if((C&33554432)!==0)k=i._value();else if((C&16777216)!==0)return this._reject(i._reason()),!0;else return this._cancel(),!0}L[X]=k}var p=++this._totalResolved;if(p>=D){if(F!==null)this._filter(L,F);else this._resolve(L);return!0}return!1},w.prototype._drainQueue=function(){var Z=this._queue,X=this._limit,L=this._values;while(Z.length>0&&this._inFlight<X){if(this._isResolved())return;var D=Z.pop();this._promiseFulfilled(L[D],D)}},w.prototype._filter=function(Z,X){var L=X.length,D=Array(L),F=0;for(var E=0;E<L;++E)if(Z[E])D[F++]=X[E];D.length=F,this._resolve(D)},w.prototype.preservedValues=function(){return this._preservedValues};function V(Z,X,L,D){if(typeof X!=="function")return U("expecting a function but got "+q.classString(X));var F=0;if(L!==void 0)if(typeof L==="object"&&L!==null){if(typeof L.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+q.classString(L.concurrency)));F=L.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+q.classString(L)));return F=typeof F==="number"&&isFinite(F)&&F>=1?F:0,new w(Z,X,F,D).promise()}$.prototype.map=function(Z,X){return V(this,Z,X,null)},$.map=function(Z,X,L,D){return V(Z,X,L,D)}}});var Kq0=O((_C1,Qq0)=>{var SS=Object.create;if(SS)cX=SS(null),dX=SS(null),cX[" size"]=dX[" size"]=0;var cX,dX;Qq0.exports=function($){var I=p1(),U=I.canEvaluate,Y=I.isIdentifier,J,Q,K=function(Z){return Function("ensureMethod",`
`;return j=j.replace(/\[TheName\]/g,f).replace(/\[TheTotal\]/g,E).replace(/\[ThePassedArguments\]/g,g).replace(/\[TheProperties\]/g,R).replace(/\[CancellationCode\]/g,k),Function("tryCatch","errorObj","Promise","async",j)(H,G,$,J)},X=[],L=[],D=[];for(var O=0;O<8;++O)X.push(Z(O+1)),L.push(w(O+1)),D.push(V(O+1));W=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&&q){var i=new $(Y);i._captureStackTrace();var A=X[E-1],R=new A(T),k=L;for(var g=0;g<E;++g){var f=U(arguments[g],i);if(f instanceof $){f=f._target();var j=f._bitField;if((j&50397184)===0)f._then(k[g],W,void 0,i,R),D[g](f,R),R.asyncNeeded=!1;else if((j&33554432)!==0)k[g].call(i,f._value(),R);else if((j&16777216)!==0)i._reject(f._reason());else i._cancel()}else k[g].call(i,f,R)}if(!i._isFateSealed()){if(R.asyncNeeded){var p=Q();if(p!==null)R.fn=K.domainBind(p,R.fn)}i._setAsyncGuaranteed(),i._setOnCancel(R)}return i}}var n=arguments.length,S=Array(n);for(var b=0;b<n;++b)S[b]=arguments[b];if(T)S.pop();var i=new I(S).promise();return T!==void 0?i.spread(T):i}}});var Gq0=F(($C1,Hq0)=>{Hq0.exports=function($,I,U,Y,J,Q){var K=$._getDomain,q=d1(),H=q.tryCatch,G=q.errorObj,W=$._async;function w(Z,X,L,D){this.constructor$(Z),this._promise._captureStackTrace();var O=K();this._callback=O===null?X:q.domainBind(O,X),this._preservedValues=D===J?Array(this.length()):null,this._limit=L,this._inFlight=0,this._queue=[],W.invoke(this._asyncInit,this,void 0)}q.inherits(w,I),w.prototype._asyncInit=function(){this._init$(void 0,-2)},w.prototype._init=function(){},w.prototype._promiseFulfilled=function(Z,X){var L=this._values,D=this.length(),O=this._preservedValues,E=this._limit;if(X<0){if(X=X*-1-1,L[X]=Z,E>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(E>=1&&this._inFlight>=E)return L[X]=Z,this._queue.push(X),!1;if(O!==null)O[X]=Z;var T=this._promise,A=this._callback,R=T._boundValue();T._pushContext();var k=H(A).call(R,Z,X,D),g=T._popContext();if(Q.checkForgottenReturns(k,g,O!==null?"Promise.filter":"Promise.map",T),k===G)return this._reject(k.e),!0;var f=Y(k,this._promise);if(f instanceof $){f=f._target();var j=f._bitField;if((j&50397184)===0){if(E>=1)this._inFlight++;return L[X]=f,f._proxy(this,(X+1)*-1),!1}else if((j&33554432)!==0)k=f._value();else if((j&16777216)!==0)return this._reject(f._reason()),!0;else return this._cancel(),!0}L[X]=k}var p=++this._totalResolved;if(p>=D){if(O!==null)this._filter(L,O);else this._resolve(L);return!0}return!1},w.prototype._drainQueue=function(){var Z=this._queue,X=this._limit,L=this._values;while(Z.length>0&&this._inFlight<X){if(this._isResolved())return;var D=Z.pop();this._promiseFulfilled(L[D],D)}},w.prototype._filter=function(Z,X){var L=X.length,D=Array(L),O=0;for(var E=0;E<L;++E)if(Z[E])D[O++]=X[E];D.length=O,this._resolve(D)},w.prototype.preservedValues=function(){return this._preservedValues};function V(Z,X,L,D){if(typeof X!=="function")return U("expecting a function but got "+q.classString(X));var O=0;if(L!==void 0)if(typeof L==="object"&&L!==null){if(typeof L.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+q.classString(L.concurrency)));O=L.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+q.classString(L)));return O=typeof O==="number"&&isFinite(O)&&O>=1?O:0,new w(Z,X,O,D).promise()}$.prototype.map=function(Z,X){return V(this,Z,X,null)},$.map=function(Z,X,L,D){return V(Z,X,L,D)}}});var wq0=F((IC1,Wq0)=>{var fg=Object.create;if(fg)rX=fg(null),tX=fg(null),rX[" size"]=tX[" size"]=0;var rX,tX;Wq0.exports=function($){var I=d1(),U=I.canEvaluate,Y=I.isIdentifier,J,Q,K=function(Z){return Function("ensureMethod",`
return function(obj) {
'use strict'
var len = this.length;
@@ -146,26 +146,26 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof h4))r
`.replace(/methodName/g,Z))(G)},q=function(Z){return Function("obj",`
'use strict';
return obj.propertyName;
`.replace("propertyName",Z))},H=function(Z,X,L){var D=L[Z];if(typeof D!=="function"){if(!Y(Z))return null;if(D=X(Z),L[Z]=D,L[" size"]++,L[" size"]>512){var F=Object.keys(L);for(var E=0;E<256;++E)delete L[F[E]];L[" size"]=F.length-256}}return D};J=function(Z){return H(Z,K,cX)},Q=function(Z){return H(Z,q,dX)};function G(Z,X){var L;if(Z!=null)L=Z[X];if(typeof L!=="function"){var D="Object "+I.classString(Z)+" has no method '"+I.toString(X)+"'";throw new $.TypeError(D)}return L}function W(Z){var X=this.pop(),L=G(Z,X);return L.apply(Z,this)}$.prototype.call=function(Z){var X=arguments.length,L=Array(Math.max(X-1,0));for(var D=1;D<X;++D)L[D-1]=arguments[D];if(U){var F=J(Z);if(F!==null)return this._then(F,void 0,void 0,L,void 0)}return L.push(Z),this._then(W,void 0,void 0,L,void 0)};function w(Z){return Z[this]}function V(Z){var X=+this;if(X<0)X=Math.max(0,X+Z.length);return Z[X]}$.prototype.get=function(Z){var X=typeof Z==="number",L;if(!X)if(U){var D=Q(Z);L=D!==null?D:w}else L=w;else L=V;return this._then(L,void 0,void 0,Z,void 0)}}});var Hq0=O((gC1,qq0)=>{qq0.exports=function($,I,U,Y,J,Q){var K=p1(),q=u5().TypeError,H=p1().inherits,G=K.errorObj,W=K.tryCatch,w={};function V(T){setTimeout(function(){throw T},0)}function Z(T){var A=U(T);if(A!==T&&typeof T._isDisposable==="function"&&typeof T._getDisposer==="function"&&T._isDisposable())A._setDisposable(T._getDisposer());return A}function X(T,A){var R=0,k=T.length,S=new $(J);function i(){if(R>=k)return S._fulfill();var C=Z(T[R++]);if(C instanceof $&&C._isDisposable()){try{C=U(C._getDisposer().tryDispose(A),T.promise)}catch(p){return V(p)}if(C instanceof $)return C._then(i,V,null,null,null)}i()}return i(),S}function L(T,A,R){this._data=T,this._promise=A,this._context=R}L.prototype.data=function(){return this._data},L.prototype.promise=function(){return this._promise},L.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return w},L.prototype.tryDispose=function(T){var A=this.resource(),R=this._context;if(R!==void 0)R._pushContext();var k=A!==w?this.doDispose(A,T):null;if(R!==void 0)R._popContext();return this._promise._unsetDisposable(),this._data=null,k},L.isDisposer=function(T){return T!=null&&typeof T.resource==="function"&&typeof T.tryDispose==="function"};function D(T,A,R){this.constructor$(T,A,R)}H(D,L),D.prototype.doDispose=function(T,A){var R=this.data();return R.call(T,T,A)};function F(T){if(L.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 A=0;A<T;++A){var R=this[A];if(R instanceof $)R.cancel()}},$.using=function(){var T=arguments.length;if(T<2)return I("you must pass at least 2 arguments to Promise.using");var A=arguments[T-1];if(typeof A!=="function")return I("expecting a function but got "+K.classString(A));var R,k=!0;if(T===2&&Array.isArray(arguments[0]))R=arguments[0],T=R.length,k=!1;else R=arguments,T--;var S=new E(T);for(var i=0;i<T;++i){var C=R[i];if(L.isDisposer(C)){var p=C;C=C.promise(),C._setDisposable(p)}else{var n=U(C);if(n instanceof $)C=n._then(F,null,null,{resources:S,index:i},void 0)}S[i]=C}var g=Array(S.length);for(var i=0;i<g.length;++i)g[i]=$.resolve(S[i]).reflect();var f=$.all(g).then(function(Y0){for(var B=0;B<Y0.length;++B){var x=Y0[B];if(x.isRejected())return G.e=x.error(),G;else if(!x.isFulfilled()){f.cancel();return}Y0[B]=x.value()}b._pushContext(),A=W(A);var d=k?A.apply(void 0,Y0):A(Y0),t=b._popContext();return Q.checkForgottenReturns(d,t,"Promise.using",b),d}),b=f.lastly(function(){var Y0=new $.PromiseInspection(f);return X(S,Y0)});return S.promise=b,b._setOnCancel(S),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 D(T,this,Y());throw new q}}});var Wq0=O((SC1,Gq0)=>{Gq0.exports=function($,I,U){var Y=p1(),J=$.TimeoutError;function Q(w){this.handle=w}Q.prototype._resultCancelled=function(){clearTimeout(this.handle)};var K=function(w){return q(+this).thenReturn(w)},q=$.delay=function(w,V){var Z,X;if(V!==void 0){if(Z=$.resolve(V)._then(K,null,null,w,void 0),U.cancellation()&&V instanceof $)Z._setOnCancel(V)}else{if(Z=new $(I),X=setTimeout(function(){Z._fulfill()},+w),U.cancellation())Z._setOnCancel(new Q(X));Z._captureStackTrace()}return Z._setAsyncGuaranteed(),Z};$.prototype.delay=function(w){return q(w,this)};var H=function(w,V,Z){var X;if(typeof V!=="string")if(V instanceof Error)X=V;else X=new J("operation timed out");else X=new J(V);if(Y.markAsOriginatingFromRejection(X),w._attachExtraTrace(X),w._reject(X),Z!=null)Z.cancel()};function G(w){return clearTimeout(this.handle),w}f Line truncated
`.replace("propertyName",Z))},H=function(Z,X,L){var D=L[Z];if(typeof D!=="function"){if(!Y(Z))return null;if(D=X(Z),L[Z]=D,L[" size"]++,L[" size"]>512){var O=Object.keys(L);for(var E=0;E<256;++E)delete L[O[E]];L[" size"]=O.length-256}}return D};J=function(Z){return H(Z,K,rX)},Q=function(Z){return H(Z,q,tX)};function G(Z,X){var L;if(Z!=null)L=Z[X];if(typeof L!=="function"){var D="Object "+I.classString(Z)+" has no method '"+I.toString(X)+"'";throw new $.TypeError(D)}return L}function W(Z){var X=this.pop(),L=G(Z,X);return L.apply(Z,this)}$.prototype.call=function(Z){var X=arguments.length,L=Array(Math.max(X-1,0));for(var D=1;D<X;++D)L[D-1]=arguments[D];if(U){var O=J(Z);if(O!==null)return this._then(O,void 0,void 0,L,void 0)}return L.push(Z),this._then(W,void 0,void 0,L,void 0)};function w(Z){return Z[this]}function V(Z){var X=+this;if(X<0)X=Math.max(0,X+Z.length);return Z[X]}$.prototype.get=function(Z){var X=typeof Z==="number",L;if(!X)if(U){var D=Q(Z);L=D!==null?D:w}else L=w;else L=V;return this._then(L,void 0,void 0,Z,void 0)}}});var Zq0=F((UC1,Vq0)=>{Vq0.exports=function($,I,U,Y,J,Q){var K=d1(),q=u5().TypeError,H=d1().inherits,G=K.errorObj,W=K.tryCatch,w={};function V(T){setTimeout(function(){throw T},0)}function Z(T){var A=U(T);if(A!==T&&typeof T._isDisposable==="function"&&typeof T._getDisposer==="function"&&T._isDisposable())A._setDisposable(T._getDisposer());return A}function X(T,A){var R=0,k=T.length,g=new $(J);function f(){if(R>=k)return g._fulfill();var j=Z(T[R++]);if(j instanceof $&&j._isDisposable()){try{j=U(j._getDisposer().tryDispose(A),T.promise)}catch(p){return V(p)}if(j instanceof $)return j._then(f,V,null,null,null)}f()}return f(),g}function L(T,A,R){this._data=T,this._promise=A,this._context=R}L.prototype.data=function(){return this._data},L.prototype.promise=function(){return this._promise},L.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return w},L.prototype.tryDispose=function(T){var A=this.resource(),R=this._context;if(R!==void 0)R._pushContext();var k=A!==w?this.doDispose(A,T):null;if(R!==void 0)R._popContext();return this._promise._unsetDisposable(),this._data=null,k},L.isDisposer=function(T){return T!=null&&typeof T.resource==="function"&&typeof T.tryDispose==="function"};function D(T,A,R){this.constructor$(T,A,R)}H(D,L),D.prototype.doDispose=function(T,A){var R=this.data();return R.call(T,T,A)};function O(T){if(L.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 A=0;A<T;++A){var R=this[A];if(R instanceof $)R.cancel()}},$.using=function(){var T=arguments.length;if(T<2)return I("you must pass at least 2 arguments to Promise.using");var A=arguments[T-1];if(typeof A!=="function")return I("expecting a function but got "+K.classString(A));var R,k=!0;if(T===2&&Array.isArray(arguments[0]))R=arguments[0],T=R.length,k=!1;else R=arguments,T--;var g=new E(T);for(var f=0;f<T;++f){var j=R[f];if(L.isDisposer(j)){var p=j;j=j.promise(),j._setDisposable(p)}else{var n=U(j);if(n instanceof $)j=n._then(O,null,null,{resources:g,index:f},void 0)}g[f]=j}var S=Array(g.length);for(var f=0;f<S.length;++f)S[f]=$.resolve(g[f]).reflect();var b=$.all(S).then(function(U0){for(var B=0;B<U0.length;++B){var x=U0[B];if(x.isRejected())return G.e=x.error(),G;else if(!x.isFulfilled()){b.cancel();return}U0[B]=x.value()}i._pushContext(),A=W(A);var c=k?A.apply(void 0,U0):A(U0),r=i._popContext();return Q.checkForgottenReturns(c,r,"Promise.using",i),c}),i=b.lastly(function(){var U0=new $.PromiseInspection(b);return X(g,U0)});return g.promise=i,i._setOnCancel(g),i},$.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 D(T,this,Y());throw new q}}});var Xq0=F((YC1,zq0)=>{zq0.exports=function($,I,U){var Y=d1(),J=$.TimeoutError;function Q(w){this.handle=w}Q.prototype._resultCancelled=function(){clearTimeout(this.handle)};var K=function(w){return q(+this).thenReturn(w)},q=$.delay=function(w,V){var Z,X;if(V!==void 0){if(Z=$.resolve(V)._then(K,null,null,w,void 0),U.cancellation()&&V instanceof $)Z._setOnCancel(V)}else{if(Z=new $(I),X=setTimeout(function(){Z._fulfill()},+w),U.cancellation())Z._setOnCancel(new Q(X));Z._captureStackTrace()}return Z._setAsyncGuaranteed(),Z};$.prototype.delay=function(w){return q(w,this)};var H=function(w,V,Z){var X;if(typeof V!=="string")if(V instanceof Error)X=V;else X=new J("operation timed out");else X=new J(V);if(Y.markAsOriginatingFromRejection(X),w._attachExtraTrace(X),w._reject(X),Z!=null)Z.cancel()};function G(w){return clearTimeout(this.handle),w}f Line truncated
See http://goo.gl/MqrFmX
`.replace("%s",D)+`From coroutine:
`+this._stack.split(`
`).slice(1,-7).join(`
`)));return}}F=F._target();var E=F._bitField;if((E&50397184)===0)this._yieldedPromise=F,F._proxy(this,null);else if((E&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,F._value());else if((E&16777216)!==0)$._async.invoke(this._promiseRejected,this,F._reason());else this._promiseCancelled()}},$.coroutine=function(X,L){if(typeof X!=="function")throw new q(`generatorFunction must be a function
`)));return}}O=O._target();var E=O._bitField;if((E&50397184)===0)this._yieldedPromise=O,O._proxy(this,null);else if((E&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,O._value());else if((E&16777216)!==0)$._async.invoke(this._promiseRejected,this,O._reason());else this._promiseCancelled()}},$.coroutine=function(X,L){if(typeof X!=="function")throw new q(`generatorFunction must be a function
See http://goo.gl/MqrFmX
`);var D=Object(L).yieldHandler,F=Z,E=Error().stack;return function(){var T=X.apply(this,arguments),A=new F(void 0,void 0,D,E),R=A.promise();return A._generator=T,A._promiseFulfilled(void 0),R}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new q("expecting a function but got "+H.classString(X));w.push(X)},$.spawn=function(X){if(Q.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunction must be a function
`);var D=Object(L).yieldHandler,O=Z,E=Error().stack;return function(){var T=X.apply(this,arguments),A=new O(void 0,void 0,D,E),R=A.promise();return A._generator=T,A._promiseFulfilled(void 0),R}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new q("expecting a function but got "+H.classString(X));w.push(X)},$.spawn=function(X){if(Q.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunction must be a function
See http://goo.gl/MqrFmX
`);var L=new Z(X,this),D=L.promise();return L._run($.spawn),D}}});var zq0=O((hC1,Zq0)=>{Zq0.exports=function($){var I=p1(),U=$._async,Y=I.tryCatch,J=I.errorObj;function Q(H,G){var W=this;if(!I.isArray(H))return K.call(W,H,G);var w=Y(G).apply(W._boundValue(),[null].concat(H));if(w===J)U.throwLater(w.e)}function K(H,G){var W=this,w=W._boundValue(),V=H===void 0?Y(G).call(w,null):Y(G).call(w,null,H);if(V===J)U.throwLater(V.e)}function q(H,G){var W=this;if(!H){var w=Error(H+"");w.cause=H,H=w}var V=Y(G).call(W._boundValue(),H);if(V===J)U.throwLater(V.e)}$.prototype.asCallback=$.prototype.nodeify=function(H,G){if(typeof H=="function"){var W=K;if(G!==void 0&&Object(G).spread)W=Q;this._then(W,q,void 0,this,H)}return this}}});var Lq0=O((uC1,Xq0)=>{Xq0.exports=function($,I){var U={},Y=p1(),J=gS(),Q=Y.withAppended,K=Y.maybeWrapAsError,q=Y.canEvaluate,H=u5().TypeError,G="Async",W={__isPromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],V=new RegExp("^(?:"+w.join("|")+")$"),Z=function(f){return Y.isIdentifier(f)&&f.charAt(0)!=="_"&&f!=="constructor"};function X(f){return!V.test(f)}function L(f){try{return f.__isPromisified__===!0}catch(b){return!1}}function D(f,b,Y0){var B=Y.getDataPropertyOrDefault(f,b+Y0,W);return B?L(B):!1}function F(f,b,Y0){for(var B=0;B<f.length;B+=2){var x=f[B];if(Y0.test(x)){var d=x.replace(Y0,"");for(var t=0;t<f.length;t+=2)if(f[t]===d)throw new H(`Cannot promisify an API that has normal methods with '%s'-suffix
`);var L=new Z(X,this),D=L.promise();return L._run($.spawn),D}}});var Oq0=F((QC1,Fq0)=>{Fq0.exports=function($){var I=d1(),U=$._async,Y=I.tryCatch,J=I.errorObj;function Q(H,G){var W=this;if(!I.isArray(H))return K.call(W,H,G);var w=Y(G).apply(W._boundValue(),[null].concat(H));if(w===J)U.throwLater(w.e)}function K(H,G){var W=this,w=W._boundValue(),V=H===void 0?Y(G).call(w,null):Y(G).call(w,null,H);if(V===J)U.throwLater(V.e)}function q(H,G){var W=this;if(!H){var w=Error(H+"");w.cause=H,H=w}var V=Y(G).call(W._boundValue(),H);if(V===J)U.throwLater(V.e)}$.prototype.asCallback=$.prototype.nodeify=function(H,G){if(typeof H=="function"){var W=K;if(G!==void 0&&Object(G).spread)W=Q;this._then(W,q,void 0,this,H)}return this}}});var Mq0=F((KC1,Nq0)=>{Nq0.exports=function($,I){var U={},Y=d1(),J=kg(),Q=Y.withAppended,K=Y.maybeWrapAsError,q=Y.canEvaluate,H=u5().TypeError,G="Async",W={__isPromisified__:!0},w=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],V=new RegExp("^(?:"+w.join("|")+")$"),Z=function(b){return Y.isIdentifier(b)&&b.charAt(0)!=="_"&&b!=="constructor"};function X(b){return!V.test(b)}function L(b){try{return b.__isPromisified__===!0}catch(i){return!1}}function D(b,i,U0){var B=Y.getDataPropertyOrDefault(b,i+U0,W);return B?L(B):!1}function O(b,i,U0){for(var B=0;B<b.length;B+=2){var x=b[B];if(U0.test(x)){var c=x.replace(U0,"");for(var r=0;r<b.length;r+=2)if(b[r]===c)throw new H(`Cannot promisify an API that has normal methods with '%s'-suffix
See http://goo.gl/MqrFmX
`.replace("%s",b))}}}function E(f,b,Y0,B){var x=Y.inheritedDataKeys(f),d=[];for(var t=0;t<x.length;++t){var K0=x[t],W0=f[K0],A0=B===Z?!0:Z(K0,W0,f);if(typeof W0==="function"&&!L(W0)&&!D(f,K0,b)&&B(K0,W0,f,A0))d.push(K0,W0)}return F(d,b,Y0),d}var T=function(f){return f.replace(/([$])/,"\\$")},A,R=function(f){var b=[f],Y0=Math.max(0,f-1-3);for(var B=f-1;B>=Y0;--B)b.push(B);for(var B=f+1;B<=3;++B)b.push(B);return b},k=function(f){return Y.filledRange(f,"_arg","")},S=function(f){return Y.filledRange(Math.max(f,3),"_arg","")},i=function(f){if(typeof f.length==="number")return Math.max(Math.min(f.length,1024),0);return 0};A=function(f,b,Y0,B,x,d){var t=Math.max(0,i(B)-1),K0=R(t),W0=typeof f==="string"||b===U;function A0(G1){var N0=k(G1).join(", "),S0=G1>0?", ":"",m0;if(W0)m0=`ret = callback.call(this, {{args}}, nodeback); break;
`;else m0=b===void 0?`ret = callback({{args}}, nodeback); break;
`.replace("%s",i))}}}function E(b,i,U0,B){var x=Y.inheritedDataKeys(b),c=[];for(var r=0;r<x.length;++r){var J0=x[r],w0=b[J0],A0=B===Z?!0:Z(J0,w0,b);if(typeof w0==="function"&&!L(w0)&&!D(b,J0,i)&&B(J0,w0,b,A0))c.push(J0,w0)}return O(c,i,U0),c}var T=function(b){return b.replace(/([$])/,"\\$")},A,R=function(b){var i=[b],U0=Math.max(0,b-1-3);for(var B=b-1;B>=U0;--B)i.push(B);for(var B=b+1;B<=3;++B)i.push(B);return i},k=function(b){return Y.filledRange(b,"_arg","")},g=function(b){return Y.filledRange(Math.max(b,3),"_arg","")},f=function(b){if(typeof b.length==="number")return Math.max(Math.min(b.length,1024),0);return 0};A=function(b,i,U0,B,x,c){var r=Math.max(0,f(B)-1),J0=R(r),w0=typeof b==="string"||i===U;function A0(I1){var M0=k(I1).join(", "),Q0=I1>0?", ":"",R0;if(w0)R0=`ret = callback.call(this, {{args}}, nodeback); break;
`;else R0=i===void 0?`ret = callback({{args}}, nodeback); break;
`:`ret = callback.call(receiver, {{args}}, nodeback); break;
`;return m0.replace("{{args}}",N0).replace(", ",S0)}function v0(){var G1="";for(var N0=0;N0<K0.length;++N0)G1+="case "+K0[N0]+":"+A0(K0[N0]);return G1+=`
`;return R0.replace("{{args}}",M0).replace(", ",Q0)}function j0(){var I1="";for(var M0=0;M0<J0.length;++M0)I1+="case "+J0[M0]+":"+A0(J0[M0]);return I1+=`
default:
var args = new Array(len + 1);
var i = 0;
@@ -175,15 +175,15 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof h4))r
args[i] = nodeback;
[CodeForCall]
break;
`.replace("[CodeForCall]",W0?`ret = callback.apply(this, args);
`.replace("[CodeForCall]",w0?`ret = callback.apply(this, args);
`:`ret = callback.apply(receiver, args);
`),G1}var L1=typeof f==="string"?"this != null ? this['"+f+"'] : fn":"fn",f0=`'use strict';
`),I1}var q1=typeof b==="string"?"this != null ? this['"+b+"'] : fn":"fn",k0=`'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 nodeback = nodebackForPromise(promise, `+c+`);
var ret;
var callback = tryCatch([GetFunctionCode]);
switch(len) {
@@ -197,25 +197,25 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof h4))r
};
notEnumerableProp(ret, '__isPromisified__', true);
return ret;
`.replace("[CodeForSwitchCase]",v0()).replace("[GetFunctionCode]",L1);return f0=f0.replace("Parameters",S(t)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",f0)($,B,b,Q,K,J,Y.tryCatch,Y.errorObj,Y.notEnumerableProp,I)};function C(f,b,Y0,B,x,d){var t=function(){return this}(),K0=f;if(typeof K0==="string")f=B;function W0(){var A0=b;if(b===U)A0=this;var v0=new $(I);v0._captureStackTrace();var L1=typeof K0==="string"&&this!==t?this[K0]:f,f0=J(v0,d);try{L1.apply(A0,Q(arguments,f0))}catch(G1){v0._rejectCallback(K(G1),!0,!0)}if(!v0._isFateSealed())v0._setAsyncGuaranteed();return v0}return Y.notEnumerableProp(W0,"__isPromisified__",!0),W0}var p=q?A:C;function n(f,b,Y0,B,x){var d=new RegExp(T(b)+"$"),t=E(f,b,d,Y0);for(var K0=0,W0=t.length;K0<W0;K0+=2){var A0=t[K0],v0=t[K0+1],L1=A0+b;if(B===p)f[L1]=p(A0,U,A0,v0,b,x);else{var f0=B(v0,function(){return p(A0,U,A0,v0,b,x)});Y.notEnumerableProp(f0,"__isPromisified__",!0),f[L1]=f0}}return Y.toFastProperties(f),f}function g(f,b,Y0){return p(f,b,void 0,f,null,Y0)}$.promisify=function(f,b){if(typeof f!=="function")throw new H("expecting a function but got "+Y.classString(f));if(L(f))return f;b=Object(b);var Y0=b.context===void 0?U:b.context,B=!!b.multiArgs,x=g(f,Y0,B);return Y.copyDescriptors(f,x,X),x},$.promisifyAll=function(f,b){if(typeof f!=="function"&&typeof f!=="object")throw new H(`the target of promisifyAll must be an object or a function
`.replace("[CodeForSwitchCase]",j0()).replace("[GetFunctionCode]",q1);return k0=k0.replace("Parameters",g(r)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",k0)($,B,i,Q,K,J,Y.tryCatch,Y.errorObj,Y.notEnumerableProp,I)};function j(b,i,U0,B,x,c){var r=function(){return this}(),J0=b;if(typeof J0==="string")b=B;function w0(){var A0=i;if(i===U)A0=this;var j0=new $(I);j0._captureStackTrace();var q1=typeof J0==="string"&&this!==r?this[J0]:b,k0=J(j0,c);try{q1.apply(A0,Q(arguments,k0))}catch(I1){j0._rejectCallback(K(I1),!0,!0)}if(!j0._isFateSealed())j0._setAsyncGuaranteed();return j0}return Y.notEnumerableProp(w0,"__isPromisified__",!0),w0}var p=q?A:j;function n(b,i,U0,B,x){var c=new RegExp(T(i)+"$"),r=E(b,i,c,U0);for(var J0=0,w0=r.length;J0<w0;J0+=2){var A0=r[J0],j0=r[J0+1],q1=A0+i;if(B===p)b[q1]=p(A0,U,A0,j0,i,x);else{var k0=B(j0,function(){return p(A0,U,A0,j0,i,x)});Y.notEnumerableProp(k0,"__isPromisified__",!0),b[q1]=k0}}return Y.toFastProperties(b),b}function S(b,i,U0){return p(b,i,void 0,b,null,U0)}$.promisify=function(b,i){if(typeof b!=="function")throw new H("expecting a function but got "+Y.classString(b));if(L(b))return b;i=Object(i);var U0=i.context===void 0?U:i.context,B=!!i.multiArgs,x=S(b,U0,B);return Y.copyDescriptors(b,x,X),x},$.promisifyAll=function(b,i){if(typeof b!=="function"&&typeof b!=="object")throw new H(`the target of promisifyAll must be an object or a function
See http://goo.gl/MqrFmX
`);b=Object(b);var Y0=!!b.multiArgs,B=b.suffix;if(typeof B!=="string")B=G;var x=b.filter;if(typeof x!=="function")x=Z;var d=b.promisifier;if(typeof d!=="function")d=p;if(!Y.isIdentifier(B))throw RangeError(`suffix must be a valid identifier
`);i=Object(i);var U0=!!i.multiArgs,B=i.suffix;if(typeof B!=="string")B=G;var x=i.filter;if(typeof x!=="function")x=Z;var c=i.promisifier;if(typeof c!=="function")c=p;if(!Y.isIdentifier(B))throw RangeError(`suffix must be a valid identifier
See http://goo.gl/MqrFmX
`);var t=Y.inheritedDataKeys(f);for(var K0=0;K0<t.length;++K0){var W0=f[t[K0]];if(t[K0]!=="constructor"&&Y.isClass(W0))n(W0.prototype,B,x,d,Y0),n(W0,B,x,d,Y0)}return n(f,B,x,d,Y0)}}});var Oq0=O((xC1,Dq0)=>{Dq0.exports=function($,I,U,Y){var J=p1(),Q=J.isObject,K=n3(),q;if(typeof Map==="function")q=Map;var H=function(){var V=0,Z=0;function X(L,D){this[V]=L,this[V+Z]=D,V++}return function(D){Z=D.size,V=0;var F=Array(D.size*2);return D.forEach(X,F),F}}(),G=function(V){var Z=new q,X=V.length/2|0;for(var L=0;L<X;++L){var D=V[X+L],F=V[L];Z.set(D,F)}return Z};function W(V){var Z=!1,X;if(q!==void 0&&V instanceof q)X=H(V),Z=!0;else{var L=K.keys(V),D=L.length;X=Array(D*2);for(var F=0;F<D;++F){var E=L[F];X[F]=V[E],X[F+D]=E}}this.constructor$(X),this._isMap=Z,this._init$(void 0,-3)}J.inherits(W,I),W.prototype._init=function(){},W.prototype._promiseFulfilled=function(V,Z){this._values[Z]=V;var X=++this._totalResolved;if(X>=this._length){var L;if(this._isMap)L=G(this._values);else{L={};var D=this.length();for(var F=0,E=this.length();F<E;++F)L[this._values[F+D]]=this._values[F]}return this._resolve(L),!0}return!1},W.prototype.shouldCopyValues=function(){return!1},W.prototype.getActualLength=function(V){return V>>1};function w(V){var Z,X=U(V);if(!Q(X))return Y(`cannot await properties of a non-object
`);var r=Y.inheritedDataKeys(b);for(var J0=0;J0<r.length;++J0){var w0=b[r[J0]];if(r[J0]!=="constructor"&&Y.isClass(w0))n(w0.prototype,B,x,c,U0),n(w0,B,x,c,U0)}return n(b,B,x,c,U0)}}});var Pq0=F((qC1,Aq0)=>{Aq0.exports=function($,I,U,Y){var J=d1(),Q=J.isObject,K=p3(),q;if(typeof Map==="function")q=Map;var H=function(){var V=0,Z=0;function X(L,D){this[V]=L,this[V+Z]=D,V++}return function(D){Z=D.size,V=0;var O=Array(D.size*2);return D.forEach(X,O),O}}(),G=function(V){var Z=new q,X=V.length/2|0;for(var L=0;L<X;++L){var D=V[X+L],O=V[L];Z.set(D,O)}return Z};function W(V){var Z=!1,X;if(q!==void 0&&V instanceof q)X=H(V),Z=!0;else{var L=K.keys(V),D=L.length;X=Array(D*2);for(var O=0;O<D;++O){var E=L[O];X[O]=V[E],X[O+D]=E}}this.constructor$(X),this._isMap=Z,this._init$(void 0,-3)}J.inherits(W,I),W.prototype._init=function(){},W.prototype._promiseFulfilled=function(V,Z){this._values[Z]=V;var X=++this._totalResolved;if(X>=this._length){var L;if(this._isMap)L=G(this._values);else{L={};var D=this.length();for(var O=0,E=this.length();O<E;++O)L[this._values[O+D]]=this._values[O]}return this._resolve(L),!0}return!1},W.prototype.shouldCopyValues=function(){return!1},W.prototype.getActualLength=function(V){return V>>1};function w(V){var Z,X=U(V);if(!Q(X))return Y(`cannot await properties of a non-object
See http://goo.gl/MqrFmX
`);else if(X instanceof $)Z=X._then($.props,void 0,void 0,void 0,void 0);else Z=new W(X).promise();if(X instanceof $)Z._propagateFrom(X,2);return Z}$.prototype.props=function(){return w(this)},$.props=function(V){return w(V)}}});var Nq0=O((kC1,Fq0)=>{Fq0.exports=function($,I,U,Y){var J=p1(),Q=function(q){return q.then(function(H){return K(H,q)})};function K(q,H){var G=U(q);if(G instanceof $)return Q(G);else if(q=J.asArray(q),q===null)return Y("expecting an array or an iterable object but got "+J.classString(q));var W=new $(I);if(H!==void 0)W._propagateFrom(H,3);var{_fulfill:w,_reject:V}=W;for(var Z=0,X=q.length;Z<X;++Z){var L=q[Z];if(L===void 0&&!(Z in q))continue;$.cast(L)._then(w,V,void 0,W,null)}return W}$.race=function(q){return K(q,void 0)},$.prototype.race=function(){return K(this,void 0)}}});var Aq0=O((fC1,Mq0)=>{Mq0.exports=function($,I,U,Y,J,Q){var K=$._getDomain,q=p1(),H=q.tryCatch;function G(X,L,D,F){this.constructor$(X);var E=K();if(this._fn=E===null?L:q.domainBind(E,L),D!==void 0)D=$.resolve(D),D._attachCancellationCallback(this);if(this._initialValue=D,this._currentCancellable=null,F===J)this._eachValues=Array(this._length);else if(F===0)this._eachValues=null;else this._eachValues=void 0;this._promise._captureStackTrace(),this._init$(void 0,-5)}q.inherits(G,I),G.prototype._gotAccum=function(X){if(this._eachValues!==void 0&&this._eachValues!==null&&X!==J)this._eachValues.push(X)},G.prototype._eachComplete=function(X){if(this._eachValues!==null)this._eachValues.push(X);return this._eachValues},G.prototype._init=function(){},G.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},G.prototype.shouldCopyValues=function(){return!1},G.prototype._resolve=function(X){this._promise._resolveCallback(X),this._values=null},G.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()},G.prototype._iterate=function(X){this._values=X;var L,D,F=X.length;if(this._initialValue!==void 0)L=this._initialValue,D=0;else L=$.resolve(X[0]),D=1;if(this._currentCancellable=L,!L.isRejected())for(;D<F;++D){var E={accum:null,value:X[D],index:D,length:F,array:this};L=L._then(V,void 0,void 0,E,void 0)}if(this._eachValues!==void 0)L=L._then(this._eachComplete,void 0,void 0,this,void 0);L._then(W,W,void 0,L,this)},$.prototype.reduce=function(X,L){return w(this,X,L,null)},$.reduce=function(X,L,D,F){return w(X,L,D,F)};function W(X,L){if(this.isFulfilled())L._resolve(X);else L._reject(X)}function w(X,L,D,F){if(typeof L!=="function")return U("expecting a function but got "+q.classString(L));var E=new G(X,L,D,F);return E.promise()}function V(X){this.accum=X,this.array._gotAccum(X);var L=Y(this.value,this.array._promise);if(L instanceof $)return this.array._currentCancellable=L,L._then(Z,void 0,void 0,this,void 0);else return Z.call(this,L)}function Z(X){var L=this.array,D=L._promise,F=H(L._fn);D._pushContext();var E;if(L._eachValues!==void 0)E=F.call(D._boundValue(),X,this.index,this.length);else E=F.call(D._boundValue(),this.accum,X,this.index,this.length);if(E instanceof $)L._currentCancellable=E;var T=D._popContext();return Q.checkForgottenReturns(E,T,L._eachValues!==void 0?"Promise.each":"Promise.reduce",D),E}}});var Tq0=O((iC1,Pq0)=>{Pq0.exports=function($,I,U){var Y=$.PromiseInspection,J=p1();function Q(K){this.constructor$(K)}J.inherits(Q,I),Q.prototype._promiseResolved=function(K,q){this._values[K]=q;var H=++this._totalResolved;if(H>=this._length)return this._resolve(this._values),!0;return!1},Q.prototype._promiseFulfilled=function(K,q){var H=new Y;return H._bitField=33554432,H._settledValueField=K,this._promiseResolved(q,H)},Q.prototype._promiseRejected=function(K,q){var H=new Y;return H._bitField=16777216,H._settledValueField=K,this._promiseResolved(q,H)},$.settle=function(K){return U.deprecated(".settle()",".reflect()"),new Q(K).promise()},$.prototype.settle=function(){return $.settle(this)}}});var Bq0=O((bC1,Eq0)=>{Eq0.exports=function($,I,U){var Y=p1(),J=u5().RangeError,Q=u5().AggregateError,K=Y.isArray,q={};function H(W){this.constructor$(W),this._howMany=0,this._unwrap=!1,this._initialized=!1}Y.inherits(H,I),H.prototype._init=function(){if(!this._initialized)return;if(this._howMany===0){this._resolve([]);return}this._init$(void 0,-5);var W=K(this._values);if(!this._isResolved()&&W&&this._howMany>this._canPossiblyFulfill())this._reject(this._getRangeError(this.length()))},H.prototype.init=function(){this._initialized=!0,this._init()},H.prototype.setUnwrap=function(){this._unwrap=!0},H.prototype.howMany=function(){return this._howMany},H.prototype.setHowMany=function(W){this._howMany=W},H.prototype._promiseFulfilled=function(W){if(this._addFulfilled(W),this._fulfilled()===this.howMany()){if(this._values.length=this.howMany(),this.howMany()= Line truncated
`);else if(X instanceof $)Z=X._then($.props,void 0,void 0,void 0,void 0);else Z=new W(X).promise();if(X instanceof $)Z._propagateFrom(X,2);return Z}$.prototype.props=function(){return w(this)},$.props=function(V){return w(V)}}});var Eq0=F((HC1,Tq0)=>{Tq0.exports=function($,I,U,Y){var J=d1(),Q=function(q){return q.then(function(H){return K(H,q)})};function K(q,H){var G=U(q);if(G instanceof $)return Q(G);else if(q=J.asArray(q),q===null)return Y("expecting an array or an iterable object but got "+J.classString(q));var W=new $(I);if(H!==void 0)W._propagateFrom(H,3);var{_fulfill:w,_reject:V}=W;for(var Z=0,X=q.length;Z<X;++Z){var L=q[Z];if(L===void 0&&!(Z in q))continue;$.cast(L)._then(w,V,void 0,W,null)}return W}$.race=function(q){return K(q,void 0)},$.prototype.race=function(){return K(this,void 0)}}});var vq0=F((GC1,Bq0)=>{Bq0.exports=function($,I,U,Y,J,Q){var K=$._getDomain,q=d1(),H=q.tryCatch;function G(X,L,D,O){this.constructor$(X);var E=K();if(this._fn=E===null?L:q.domainBind(E,L),D!==void 0)D=$.resolve(D),D._attachCancellationCallback(this);if(this._initialValue=D,this._currentCancellable=null,O===J)this._eachValues=Array(this._length);else if(O===0)this._eachValues=null;else this._eachValues=void 0;this._promise._captureStackTrace(),this._init$(void 0,-5)}q.inherits(G,I),G.prototype._gotAccum=function(X){if(this._eachValues!==void 0&&this._eachValues!==null&&X!==J)this._eachValues.push(X)},G.prototype._eachComplete=function(X){if(this._eachValues!==null)this._eachValues.push(X);return this._eachValues},G.prototype._init=function(){},G.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},G.prototype.shouldCopyValues=function(){return!1},G.prototype._resolve=function(X){this._promise._resolveCallback(X),this._values=null},G.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()},G.prototype._iterate=function(X){this._values=X;var L,D,O=X.length;if(this._initialValue!==void 0)L=this._initialValue,D=0;else L=$.resolve(X[0]),D=1;if(this._currentCancellable=L,!L.isRejected())for(;D<O;++D){var E={accum:null,value:X[D],index:D,length:O,array:this};L=L._then(V,void 0,void 0,E,void 0)}if(this._eachValues!==void 0)L=L._then(this._eachComplete,void 0,void 0,this,void 0);L._then(W,W,void 0,L,this)},$.prototype.reduce=function(X,L){return w(this,X,L,null)},$.reduce=function(X,L,D,O){return w(X,L,D,O)};function W(X,L){if(this.isFulfilled())L._resolve(X);else L._reject(X)}function w(X,L,D,O){if(typeof L!=="function")return U("expecting a function but got "+q.classString(L));var E=new G(X,L,D,O);return E.promise()}function V(X){this.accum=X,this.array._gotAccum(X);var L=Y(this.value,this.array._promise);if(L instanceof $)return this.array._currentCancellable=L,L._then(Z,void 0,void 0,this,void 0);else return Z.call(this,L)}function Z(X){var L=this.array,D=L._promise,O=H(L._fn);D._pushContext();var E;if(L._eachValues!==void 0)E=O.call(D._boundValue(),X,this.index,this.length);else E=O.call(D._boundValue(),this.accum,X,this.index,this.length);if(E instanceof $)L._currentCancellable=E;var T=D._popContext();return Q.checkForgottenReturns(E,T,L._eachValues!==void 0?"Promise.each":"Promise.reduce",D),E}}});var jq0=F((WC1,Rq0)=>{Rq0.exports=function($,I,U){var Y=$.PromiseInspection,J=d1();function Q(K){this.constructor$(K)}J.inherits(Q,I),Q.prototype._promiseResolved=function(K,q){this._values[K]=q;var H=++this._totalResolved;if(H>=this._length)return this._resolve(this._values),!0;return!1},Q.prototype._promiseFulfilled=function(K,q){var H=new Y;return H._bitField=33554432,H._settledValueField=K,this._promiseResolved(q,H)},Q.prototype._promiseRejected=function(K,q){var H=new Y;return H._bitField=16777216,H._settledValueField=K,this._promiseResolved(q,H)},$.settle=function(K){return U.deprecated(".settle()",".reflect()"),new Q(K).promise()},$.prototype.settle=function(){return $.settle(this)}}});var _q0=F((wC1,Cq0)=>{Cq0.exports=function($,I,U){var Y=d1(),J=u5().RangeError,Q=u5().AggregateError,K=Y.isArray,q={};function H(W){this.constructor$(W),this._howMany=0,this._unwrap=!1,this._initialized=!1}Y.inherits(H,I),H.prototype._init=function(){if(!this._initialized)return;if(this._howMany===0){this._resolve([]);return}this._init$(void 0,-5);var W=K(this._values);if(!this._isResolved()&&W&&this._howMany>this._canPossiblyFulfill())this._reject(this._getRangeError(this.length()))},H.prototype.init=function(){this._initialized=!0,this._init()},H.prototype.setUnwrap=function(){this._unwrap=!0},H.prototype.howMany=function(){return this._howMany},H.prototype.setHowMany=function(W){this._howMany=W},H.prototype._promiseFulfilled=function(W){if(this._addFulfilled(W),this._fulfilled()===this.howMany()){if(this._values.length=this.howMany(),this.howMany()= Line truncated
See http://goo.gl/MqrFmX
`);var V=new H(W),Z=V.promise();return V.setHowMany(w),V.init(),Z}$.some=function(W,w){return G(W,w)},$.prototype.some=function(W){return G(this,W)},$._SomePromiseArray=H}});var Rq0=O((nC1,vq0)=>{vq0.exports=function($,I){var U=$.map;$.prototype.filter=function(Y,J){return U(this,Y,J,I)},$.filter=function(Y,J,Q){return U(Y,J,Q,I)}}});var jq0=O((pC1,Cq0)=>{Cq0.exports=function($,I){var{reduce:U,all:Y}=$;function J(){return Y(this)}function Q(K,q){return U(K,q,I,I)}$.prototype.each=function(K){return U(this,K,I,0)._then(J,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(K){return U(this,K,I,I)},$.each=function(K,q){return U(K,q,I,0)._then(J,void 0,void 0,K,void 0)},$.mapSeries=Q}});var gq0=O((cC1,_q0)=>{_q0.exports=function($){var I=$._SomePromiseArray;function U(Y){var J=new I(Y),Q=J.promise();return J.setHowMany(1),J.setUnwrap(),J.init(),Q}$.any=function(Y){return U(Y)},$.prototype.any=function(){return U(this)}}});var Sq0=O((dC1,yS)=>{yS.exports=function(){var $=function(){return new w(`circular promise resolution chain
`);var V=new H(W),Z=V.promise();return V.setHowMany(w),V.init(),Z}$.some=function(W,w){return G(W,w)},$.prototype.some=function(W){return G(this,W)},$._SomePromiseArray=H}});var gq0=F((VC1,Sq0)=>{Sq0.exports=function($,I){var U=$.map;$.prototype.filter=function(Y,J){return U(this,Y,J,I)},$.filter=function(Y,J,Q){return U(Y,J,Q,I)}}});var hq0=F((ZC1,yq0)=>{yq0.exports=function($,I){var{reduce:U,all:Y}=$;function J(){return Y(this)}function Q(K,q){return U(K,q,I,I)}$.prototype.each=function(K){return U(this,K,I,0)._then(J,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(K){return U(this,K,I,I)},$.each=function(K,q){return U(K,q,I,0)._then(J,void 0,void 0,K,void 0)},$.mapSeries=Q}});var xq0=F((zC1,uq0)=>{uq0.exports=function($){var I=$._SomePromiseArray;function U(Y){var J=new I(Y),Q=J.promise();return J.setHowMany(1),J.setUnwrap(),J.init(),Q}$.any=function(Y){return U(Y)},$.prototype.any=function(){return U(this)}}});var kq0=F((XC1,bg)=>{bg.exports=function(){var $=function(){return new w(`circular promise resolution chain
See http://goo.gl/MqrFmX
`)},I=function(){return new g.PromiseInspection(this._target())},U=function(B){return g.reject(new w(B))};function Y(){}var J={},Q=p1(),K;if(Q.isNode)K=function(){var B=process.domain;if(B===void 0)B=null;return B};else K=function(){return null};Q.notEnumerableProp(g,"_getDomain",K);var q=n3(),H=BK0(),G=new H;q.defineProperty(g,"_async",{value:G});var W=u5(),w=g.TypeError=W.TypeError;g.RangeError=W.RangeError;var V=g.CancellationError=W.CancellationError;g.TimeoutError=W.TimeoutError,g.OperationalError=W.OperationalError,g.RejectionError=W.OperationalError,g.AggregateError=W.AggregateError;var Z=function(){},X={},L={},D=_K0()(g,Z),F=SK0()(g,Z,D,U,Y),E=hK0()(g),T=E.create,A=xK0()(g,E),R=A.CapturedTrace,k=fK0()(g,D),S=bK0()(L),i=gS(),C=Q.errorObj,p=Q.tryCatch;function n(B,x){if(typeof x!=="function")throw new w("expecting a function but got "+Q.classString(x));if(B.constructor!==g)throw new w(`the promise constructor cannot be invoked directly
`)},I=function(){return new S.PromiseInspection(this._target())},U=function(B){return S.reject(new w(B))};function Y(){}var J={},Q=d1(),K;if(Q.isNode)K=function(){var B=process.domain;if(B===void 0)B=null;return B};else K=function(){return null};Q.notEnumerableProp(S,"_getDomain",K);var q=p3(),H=_K0(),G=new H;q.defineProperty(S,"_async",{value:G});var W=u5(),w=S.TypeError=W.TypeError;S.RangeError=W.RangeError;var V=S.CancellationError=W.CancellationError;S.TimeoutError=W.TimeoutError,S.OperationalError=W.OperationalError,S.RejectionError=W.OperationalError,S.AggregateError=W.AggregateError;var Z=function(){},X={},L={},D=uK0()(S,Z),O=kK0()(S,Z,D,U,Y),E=bK0()(S),T=E.create,A=nK0()(S,E),R=A.CapturedTrace,k=cK0()(S,D),g=mK0()(L),f=kg(),j=Q.errorObj,p=Q.tryCatch;function n(B,x){if(typeof x!=="function")throw new w("expecting a function but got "+Q.classString(x));if(B.constructor!==S)throw new w(`the promise constructor cannot be invoked directly
See http://goo.gl/MqrFmX
`)}function g(B){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,B!==Z)n(this,B),this._resolveFromExecutor(B);this._promiseCreated(),this._fireEvent("promiseCreated",this)}g.prototype.toString=function(){return"[object Promise]"},g.prototype.caught=g.prototype.catch=function(B){var x=arguments.length;if(x>1){var d=Array(x-1),t=0,K0;for(K0=0;K0<x-1;++K0){var W0=arguments[K0];if(Q.isObject(W0))d[t++]=W0;else return U("expecting an object but got A catch statement predicate "+Q.classString(W0))}return d.length=t,B=arguments[K0],this.then(void 0,S(d,B,this))}return this.then(void 0,B)},g.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},g.prototype.then=function(B,x){if(A.warnings()&&arguments.length>0&&typeof B!=="function"&&typeof x!=="function"){var d=".then() only accepts functions but was passed: "+Q.classString(B);if(arguments.length>1)d+=", "+Q.classString(x);this._warn(d)}return this._then(B,x,void 0,void 0,void 0)},g.prototype.done=function(B,x){var d=this._then(B,x,void 0,void 0,void 0);d._setIsFinal()},g.prototype.spread=function(B){if(typeof B!=="function")return U("expecting a function but got "+Q.classString(B));return this.all()._then(B,void 0,void 0,X,void 0)},g.prototype.toJSON=function(){var B={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())B.fulfillmentValue=this.value(),B.isFulfilled=!0;else if(this.isRejected())B.rejectionReason=this.reason(),B.isRejected=!0;return B},g.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},g.prototype.error=function(B){return this.caught(Q.originatesFromRejection,B)},g.getNewLibraryCopy=yS.exports,g.is=function(B){return B instanceof g},g.fromNode=g.fromCallback=function(B){var x=new g(Z);x._captureStackTrace();var d=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,t=p(B)(i(x,d));if(t===C)x._rejectCallback(t.e,!0);if(!x._isFateSealed())x._setAsyncGuaranteed();return x},g.all=function(B){return new F(B).promise()},g.cast=function(B){var x=D(B);if(!(x instanceof g))x=new g(Z),x._captureStackTrace(),x._setFulfilled(),x._rejectionHandler0=B;return x},g.resolve=g.fulfilled=g.cast,g.reject=g.rejected=function(B){var x=new g(Z);return x._captureStackTrace(),x._rejectCallback(B,!0),x},g.setScheduler=function(B){if(typeof B!=="function")throw new w("expecting a function but got "+Q.classString(B));return G.setScheduler(B)},g.prototype._then=function(B,x,d,t,K0){var W0=K0!==void 0,A0=W0?K0:new g(Z),v0=this._target(),L1=v0._bitField;if(!W0){if(A0._propagateFrom(this,3),A0._captureStackTrace(),t===void 0&&(this._bitField&2097152)!==0)if((L1&50397184)!==0)t=this._boundValue();else t=v0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,A0)}var f0=K();if((L1&50397184)!==0){var G1,N0,S0=v0._settlePromiseCtx;if((L1&33554432)!==0)N0=v0._rejectionHandler0,G1=B;else if((L1&16777216)!==0)N0=v0._fulfillmentHandler0,G1=x,v0._unsetRejectionIsUnhandled();else S0=v0._settlePromiseLateCancellationObserver,N0=new V("late cancellation observer"),v0._attachExtraTrace(N0),G1=x;G.invoke(S0,v0,{handler:f0===null?G1:typeof G1==="function"&&Q.domainBind(f0,G1),promise:A0,receiver:t,value:N0})}else v0._addCallbacks(B,x,A0,t,f0);return A0},g.prototype._length=function(){return this._bitField&65535},g.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},g.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},g.prototype._setLength=function(B){this._bitField=this._bitField&-65536|B&65535},g.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},g.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},g.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},g.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},g.prototype._isFinal=function(){return(this._bitField&4194304)>0},g.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},g.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},g.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},g.prototype._setAsyncGuaranteed=function(){if(G.hasCustomScheduler())return;this._bitField=this._bitField|134217728},g.prototype._receiverAt=function(B){var x=B===0?this._receiver0:this[B*4-4+3];if(x===J)return;else if(x===void 0&&this._isBound())return this._boundValue();return x},g.prototype._promiseAt=function(B){return this[B*4-4+2]},g.prototype._fulfillmentHandlerAt=function(B){return this[B*4-4+0]},g.prototype._rejectionHandlerAt=function(B){return this[B*4-4+1]},g.prototype._boundValue=function(){},g.prototype._migrateCallback0=function(B){var{_bit Line truncated
`)}function S(B){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,B!==Z)n(this,B),this._resolveFromExecutor(B);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(B){var x=arguments.length;if(x>1){var c=Array(x-1),r=0,J0;for(J0=0;J0<x-1;++J0){var w0=arguments[J0];if(Q.isObject(w0))c[r++]=w0;else return U("expecting an object but got A catch statement predicate "+Q.classString(w0))}return c.length=r,B=arguments[J0],this.then(void 0,g(c,B,this))}return this.then(void 0,B)},S.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},S.prototype.then=function(B,x){if(A.warnings()&&arguments.length>0&&typeof B!=="function"&&typeof x!=="function"){var c=".then() only accepts functions but was passed: "+Q.classString(B);if(arguments.length>1)c+=", "+Q.classString(x);this._warn(c)}return this._then(B,x,void 0,void 0,void 0)},S.prototype.done=function(B,x){var c=this._then(B,x,void 0,void 0,void 0);c._setIsFinal()},S.prototype.spread=function(B){if(typeof B!=="function")return U("expecting a function but got "+Q.classString(B));return this.all()._then(B,void 0,void 0,X,void 0)},S.prototype.toJSON=function(){var B={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())B.fulfillmentValue=this.value(),B.isFulfilled=!0;else if(this.isRejected())B.rejectionReason=this.reason(),B.isRejected=!0;return B},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new O(this).promise()},S.prototype.error=function(B){return this.caught(Q.originatesFromRejection,B)},S.getNewLibraryCopy=bg.exports,S.is=function(B){return B instanceof S},S.fromNode=S.fromCallback=function(B){var x=new S(Z);x._captureStackTrace();var c=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=p(B)(f(x,c));if(r===j)x._rejectCallback(r.e,!0);if(!x._isFateSealed())x._setAsyncGuaranteed();return x},S.all=function(B){return new O(B).promise()},S.cast=function(B){var x=D(B);if(!(x instanceof S))x=new S(Z),x._captureStackTrace(),x._setFulfilled(),x._rejectionHandler0=B;return x},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(B){var x=new S(Z);return x._captureStackTrace(),x._rejectCallback(B,!0),x},S.setScheduler=function(B){if(typeof B!=="function")throw new w("expecting a function but got "+Q.classString(B));return G.setScheduler(B)},S.prototype._then=function(B,x,c,r,J0){var w0=J0!==void 0,A0=w0?J0:new S(Z),j0=this._target(),q1=j0._bitField;if(!w0){if(A0._propagateFrom(this,3),A0._captureStackTrace(),r===void 0&&(this._bitField&2097152)!==0)if((q1&50397184)!==0)r=this._boundValue();else r=j0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,A0)}var k0=K();if((q1&50397184)!==0){var I1,M0,Q0=j0._settlePromiseCtx;if((q1&33554432)!==0)M0=j0._rejectionHandler0,I1=B;else if((q1&16777216)!==0)M0=j0._fulfillmentHandler0,I1=x,j0._unsetRejectionIsUnhandled();else Q0=j0._settlePromiseLateCancellationObserver,M0=new V("late cancellation observer"),j0._attachExtraTrace(M0),I1=x;G.invoke(Q0,j0,{handler:k0===null?I1:typeof I1==="function"&&Q.domainBind(k0,I1),promise:A0,receiver:r,value:M0})}else j0._addCallbacks(B,x,A0,r,k0);return A0},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(B){this._bitField=this._bitField&-65536|B&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(G.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(B){var x=B===0?this._receiver0:this[B*4-4+3];if(x===J)return;else if(x===void 0&&this._isBound())return this._boundValue();return x},S.prototype._promiseAt=function(B){return this[B*4-4+2]},S.prototype._fulfillmentHandlerAt=function(B){return this[B*4-4+0]},S.prototype._rejectionHandlerAt=function(B){return this[B*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(B){var{_bit Line truncated
path = %s
syscall = %s
fstream_type = %s
@@ -225,26 +225,26 @@ fstream_class = %s
fstream_stack =
%s
`,I||"UNKNOWN",Y.stack,Y.path,Y.syscall,Y.fstream_type,Y.fstream_path,Y.fstream_unc_path,Y.fstream_class,Y.fstream_stack.join(`
`));else U.emit("warn",Y)};w7.prototype.info=function($,I){this.emit("info",$,I)};w7.prototype.error=function($,I,U){var Y=VG0($,I,this);if(U)throw Y;else this.emit("error",Y)};function VG0($,I,U){if(!($ instanceof Error))$=Error($);if($.code=$.code||I,$.path=$.path||U.path,$.fstream_type=$.fstream_type||U.type,$.fstream_path=$.fstream_path||U.path,U._path!==U.path)$.fstream_unc_path=$.fstream_unc_path||U._path;if(U.linkpath)$.fstream_linkpath=$.fstream_linkpath||U.linkpath;return $.fstream_class=$.fstream_class||U.constructor.name,$.fstream_stack=$.fstream_stack||Error().stack.split(/\n/).slice(3).map(function(Y){return Y.replace(/^ {4}at /,"")}),$}});var dq=O((Mj1,zG0)=>{zG0.exports=YJ1;function YJ1($){var I=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&I.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var Y=0,J=I.length;Y<J;Y++){U=I[Y];var Q=$[U]||$["is"+U];if(typeof Q==="function")Q=Q.call($);if(Q)return $[U]=!0,$.type=U,U}return null}});var Ny=O((Aj1,XG0)=>{XG0.exports=mq;var JJ1=o6(),QJ1=p0(),Fy=a3();QJ1(mq,Fy);function mq($){var I=this;if(!(I instanceof mq))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);Fy.call(I,$)}mq.prototype._stat=function($){var I=this;JJ1.readlink(I._path,function(U,Y){if(U)return I.error(U);I.linkpath=I.props.linkpath=Y,I.emit("linkpath",Y),Fy.prototype._stat.call(I,$)})};mq.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Ay=O((Pj1,OG0)=>{OG0.exports=i8;var DG0=o6(),KJ1=p0(),lq=r("path"),My=a3(),LG0=r("assert").ok;KJ1(i8,My);function i8($){var I=this;if(!(I instanceof i8))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(I.entries=null,I._index=-1,I._paused=!1,I._length=-1,$.sort)this.sort=$.sort;My.call(this,$)}i8.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,DG0.readdir($._path,function(I,U){if(I)return $.error(I);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",Y);else Y();function Y(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};i8.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 I=lq.resolve($._path,$.entries[$._index]);LG0(I!==$._path),LG0($.entries[$._index]),$._currentEntry=I,DG0[$.props.follow?"stat":"lstat"](I,function(U,Y){if(U)return $.error(U);var J=$._proxy||$;Y.path=I,Y.basename=lq.basename(I),Y.dirname=lq.dirname(I);var Q=$.getChildProps.call(J,Y);Q.path=I,Q.basename=lq.basename(I),Q.dirname=lq.dirname(I);var K=My(Q,Y);$._currentEntry=K,K.on("pause",function(G){if(!$._paused&&!K._disowned)$.pause(G)}),K.on("resume",function(G){if($._paused&&!K._disowned)$.resume(G)}),K.on("stat",function(G){if($.emit("_entryStat",K,G),K._aborted)return;if(K._paused)K.once("resume",function(){$.emit("entryStat",K,G)});else $.emit("entryStat",K,G)}),K.on("ready",function G(){if($._paused)return K.pause($),$.once("resume",G);if(K.type==="Socket")$.emit("socket",K);else $.emitEntry(K)});var q=!1;K.on("close",H),K.on("disown",H);function H(){if(q)return;if(q=!0,$.emit("childEnd",K),$.emit("entryEnd",K),$._currentEntry=null,!$._paused)$._read()}K.on("error",function(G){if(K._swallowErrors)$.warn(G),K.emit("end"),K.emit("close");else $.emit("error",G)}),["child","childEnd","warn"].forEach(function(G){K.on(G,$.emit.bind($,G))})})};i8.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};i8.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}};i8.prototype.pause=function($){var I=this;if(I._paused)return;if($=$||I,I._paused=!0,I._currentEntry&&I._currentEntry.pause)I._currentEntry.pause($);I.emit("pause",$)};i8.prototype.resume=function($){var I=this;if(!I._paused)return;if($=$||I,I._paused=!1,I.emit("resume",$),I._paused)return;if(I._currentEntry){if(I._currentEntry.resume)I._currentEntry.resume($)}else I._read()};i8.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var Py=O((Tj1,AG0)=>{AG0.exports=s3;var qJ1=o6(),HJ1=p0(),FG0=a3(),NG0={EOF:!0},MG0={CLOSE:!0};HJ1(s3,FG0);function s3($){var I=this;if(!(I instanceof s3))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);I._buffer=[],I._bytesEmitted=0,FG0.call(I,$)}s3.prototype._getStream=function(){var $=this,I=$._stream=qJ1.createReadStream($._path,$.pro Line truncated
`));else U.emit("warn",Y)};V7.prototype.info=function($,I){this.emit("info",$,I)};V7.prototype.error=function($,I,U){var Y=DG0($,I,this);if(U)throw Y;else this.emit("error",Y)};function DG0($,I,U){if(!($ instanceof Error))$=Error($);if($.code=$.code||I,$.path=$.path||U.path,$.fstream_type=$.fstream_type||U.type,$.fstream_path=$.fstream_path||U.path,U._path!==U.path)$.fstream_unc_path=$.fstream_unc_path||U._path;if(U.linkpath)$.fstream_linkpath=$.fstream_linkpath||U.linkpath;return $.fstream_class=$.fstream_class||U.constructor.name,$.fstream_stack=$.fstream_stack||Error().stack.split(/\n/).slice(3).map(function(Y){return Y.replace(/^ {4}at /,"")}),$}});var lq=F((dC1,OG0)=>{OG0.exports=NJ1;function NJ1($){var I=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&I.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var Y=0,J=I.length;Y<J;Y++){U=I[Y];var Q=$[U]||$["is"+U];if(typeof Q==="function")Q=Q.call($);if(Q)return $[U]=!0,$.type=U,U}return null}});var By=F((mC1,NG0)=>{NG0.exports=oq;var MJ1=s6(),AJ1=c0(),Ey=s3();AJ1(oq,Ey);function oq($){var I=this;if(!(I instanceof oq))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);Ey.call(I,$)}oq.prototype._stat=function($){var I=this;MJ1.readlink(I._path,function(U,Y){if(U)return I.error(U);I.linkpath=I.props.linkpath=Y,I.emit("linkpath",Y),Ey.prototype._stat.call(I,$)})};oq.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Ry=F((lC1,PG0)=>{PG0.exports=c8;var AG0=s6(),PJ1=c0(),rq=t("path"),vy=s3(),MG0=t("assert").ok;PJ1(c8,vy);function c8($){var I=this;if(!(I instanceof c8))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(I.entries=null,I._index=-1,I._paused=!1,I._length=-1,$.sort)this.sort=$.sort;vy.call(this,$)}c8.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,AG0.readdir($._path,function(I,U){if(I)return $.error(I);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",Y);else Y();function Y(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};c8.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 I=rq.resolve($._path,$.entries[$._index]);MG0(I!==$._path),MG0($.entries[$._index]),$._currentEntry=I,AG0[$.props.follow?"stat":"lstat"](I,function(U,Y){if(U)return $.error(U);var J=$._proxy||$;Y.path=I,Y.basename=rq.basename(I),Y.dirname=rq.dirname(I);var Q=$.getChildProps.call(J,Y);Q.path=I,Q.basename=rq.basename(I),Q.dirname=rq.dirname(I);var K=vy(Q,Y);$._currentEntry=K,K.on("pause",function(G){if(!$._paused&&!K._disowned)$.pause(G)}),K.on("resume",function(G){if($._paused&&!K._disowned)$.resume(G)}),K.on("stat",function(G){if($.emit("_entryStat",K,G),K._aborted)return;if(K._paused)K.once("resume",function(){$.emit("entryStat",K,G)});else $.emit("entryStat",K,G)}),K.on("ready",function G(){if($._paused)return K.pause($),$.once("resume",G);if(K.type==="Socket")$.emit("socket",K);else $.emitEntry(K)});var q=!1;K.on("close",H),K.on("disown",H);function H(){if(q)return;if(q=!0,$.emit("childEnd",K),$.emit("entryEnd",K),$._currentEntry=null,!$._paused)$._read()}K.on("error",function(G){if(K._swallowErrors)$.warn(G),K.emit("end"),K.emit("close");else $.emit("error",G)}),["child","childEnd","warn"].forEach(function(G){K.on(G,$.emit.bind($,G))})})};c8.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};c8.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}};c8.prototype.pause=function($){var I=this;if(I._paused)return;if($=$||I,I._paused=!0,I._currentEntry&&I._currentEntry.pause)I._currentEntry.pause($);I.emit("pause",$)};c8.prototype.resume=function($){var I=this;if(!I._paused)return;if($=$||I,I._paused=!1,I.emit("resume",$),I._paused)return;if(I._currentEntry){if(I._currentEntry.resume)I._currentEntry.resume($)}else I._read()};c8.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var jy=F((oC1,vG0)=>{vG0.exports=e3;var TJ1=s6(),EJ1=c0(),TG0=s3(),EG0={EOF:!0},BG0={CLOSE:!0};EJ1(e3,TG0);function e3($){var I=this;if(!(I instanceof e3))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);I._buffer=[],I._bytesEmitted=0,TG0.call(I,$)}e3.prototype._getStream=function(){var $=this,I=$._stream=TJ1.createReadStream($._path,$.pro Line truncated
expect: `+$.props.size+`
actual: `+$._bytesEmitted)}),I.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(MG0),$._read();else $.emit("close")}),I.on("error",function(U){$.emit("error",U)}),$._read()};s3.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var I=$._buffer;for(var U=0,Y=I.length;U<Y;U++){var J=I[U];if(J===NG0)$.emit("end");else if(J===MG0)$.emit("close");else $.emit("data",J);if($._paused){$._buffer=I.slice(U);return}}$._buffer.length=0}};s3.prototype.pause=function($){var I=this;if(I._paused)return;if($=$||I,I._paused=!0,I._stream)I._stream.pause();I.emit("pause",$)};s3.prototype.resume=function($){var I=this;if(!I._paused)return;if($=$||I,I.emit("resume",$),I._paused=!1,I._stream)I._stream.resume();I._read()}});var EG0=O((Ej1,TG0)=>{TG0.exports=DL;var GJ1=p0(),PG0=a3();GJ1(DL,PG0);function DL($){var I=this;if(!(I instanceof DL))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);PG0.call(I,$)}DL.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Ey=O((Bj1,BG0)=>{BG0.exports=e3;var Ty=a3(),WJ1=dq(),wJ1=p0(),VJ1=o6();wJ1(e3,Ty);function e3($){var I=this;if(!(I instanceof e3))throw Error("ProxyReader must be called as constructor.");I.props=$,I._buffer=[],I.ready=!1,Ty.call(I,$)}e3.prototype._stat=function(){var $=this,I=$.props,U=I.follow?"stat":"lstat";VJ1[U](I.path,function(Y,J){var Q;if(Y||!J)Q="File";else Q=WJ1(J);I[Q]=!0,I.type=$.type=Q,$._old=J,$._addProxy(Ty(I,J))})};e3.prototype._addProxy=function($){var I=this;if(I._proxyTarget)return I.error("proxy already set");I._proxyTarget=$,$._proxy=I,["error","data","end","close","linkpath","entry","entryEnd","child","childEnd","warn","stat"].forEach(function(Y){$.on(Y,I.emit.bind(I,Y))}),I.emit("proxy",$),$.on("ready",function(){I.ready=!0,I.emit("ready")});var U=I._buffer;I._buffer.length=0,U.forEach(function(Y){$[Y[0]].apply($,Y[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((vj1,CG0)=>{CG0.exports=q8;var ZJ1=o6(),zJ1=r("stream").Stream,XJ1=p0(),By=r("path"),vy=dq(),OL=q8.hardLinks={},vG0=LL();XJ1(q8,vG0);var RG0=Ny();function q8($,I){var U=this;if(!(U instanceof q8))return new q8($,I);if(typeof $==="string")$={path:$};var Y,J;if($.type&&typeof $.type==="function")Y=$.type,J=Y;else Y=vy($),J=q8;if(I&&!Y)Y=vy(I),$[Y]=!0,$.type=Y;switch(Y){case"Directory":J=Ay();break;case"Link":case"File":J=Py();break;case"SymbolicLink":J=RG0;break;case"Socket":J=EG0();break;case null:J=Ey();break}if(!(U instanceof J))return new J($);if(vG0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=Y,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=By.resolve($.path),process.platform==="win32"){if(U.path=U._path=U.path.replace(/\?/g,"_"),U._path.length>=260)U._swallowErrors=!0,U._path="\\\\?\\"+U.path.replace(/\//g,"\\")}if(U.basename=$.basename=By.basename(U.path),U.dirname=$.dirname=By.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=LJ1;U._stat(I)}function LJ1($,I){return $===I?0:$.toLowerCase()>I.toLowerCase()?1:$.toLowerCase()<I.toLowerCase()?-1:$>I?1:-1}q8.prototype._stat=function($){var I=this,U=I.props,Y=U.follow?"stat":"lstat";if($)process.nextTick(J.bind(null,null,$));else ZJ1[Y](I._path,J);function J(Q,K){if(Q)return I.error(Q);if(Object.keys(K).forEach(function(Z){U[Z]=K[Z]}),I.size!==void 0&&U.size!==I.size)return I.error("incorrect size");I.size=U.size;var q=vy(U),H=U.hardlinks!==!1;if(H&&q!=="Directory"&&U.nlink&&U.nlink>1){var G=U.dev+":"+U.ino;if(OL[G]===I._path||!OL[G])OL[G]=I._path;else q=I.type=I.props.type="Link",I.Link=I.props.Link=!0,I.linkpath=I.props.linkpath=OL[G],I._stat=I._read=RG0.prototype._read}if(I.type&&I.type!==q)I.error("Unexpected type: "+q);if(I.filter){var W=I._proxy||I;if(!I.filter.call(W,W,U)){if(!I._disowned)I.abort(),I.emit("end"),I.emit("close");return}}var w=["_stat","stat","ready"],V=0;(function Z(){if(I._aborted){I.emit("end"),I.emit("close");return}if(I._paused&&I.type!=="Directory"){I.once("resume",Z);return}var X=w[V++];if(!X)return I._read();I.emit(X,U),Z()})()}};q8.prototype.pipe=function($){var I=this;if(typeof $.add==="function")I.on("entry",function(U){var Y=$.add(U);if(Y===!1)I.pause()});return zJ1.prototype.pipe.apply(this,arguments)};q8.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};q8.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};q8.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var _y=O((Rj1,xG0)=>{x Line truncated
actual: `+$._bytesEmitted)}),I.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(BG0),$._read();else $.emit("close")}),I.on("error",function(U){$.emit("error",U)}),$._read()};e3.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var I=$._buffer;for(var U=0,Y=I.length;U<Y;U++){var J=I[U];if(J===EG0)$.emit("end");else if(J===BG0)$.emit("close");else $.emit("data",J);if($._paused){$._buffer=I.slice(U);return}}$._buffer.length=0}};e3.prototype.pause=function($){var I=this;if(I._paused)return;if($=$||I,I._paused=!0,I._stream)I._stream.pause();I.emit("pause",$)};e3.prototype.resume=function($){var I=this;if(!I._paused)return;if($=$||I,I.emit("resume",$),I._paused=!1,I._stream)I._stream.resume();I._read()}});var CG0=F((rC1,jG0)=>{jG0.exports=AL;var BJ1=c0(),RG0=s3();BJ1(AL,RG0);function AL($){var I=this;if(!(I instanceof AL))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);RG0.call(I,$)}AL.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var _y=F((tC1,_G0)=>{_G0.exports=$I;var Cy=s3(),vJ1=lq(),RJ1=c0(),jJ1=s6();RJ1($I,Cy);function $I($){var I=this;if(!(I instanceof $I))throw Error("ProxyReader must be called as constructor.");I.props=$,I._buffer=[],I.ready=!1,Cy.call(I,$)}$I.prototype._stat=function(){var $=this,I=$.props,U=I.follow?"stat":"lstat";jJ1[U](I.path,function(Y,J){var Q;if(Y||!J)Q="File";else Q=vJ1(J);I[Q]=!0,I.type=$.type=Q,$._old=J,$._addProxy(Cy(I,J))})};$I.prototype._addProxy=function($){var I=this;if(I._proxyTarget)return I.error("proxy already set");I._proxyTarget=$,$._proxy=I,["error","data","end","close","linkpath","entry","entryEnd","child","childEnd","warn","stat"].forEach(function(Y){$.on(Y,I.emit.bind(I,Y))}),I.emit("proxy",$),$.on("ready",function(){I.ready=!0,I.emit("ready")});var U=I._buffer;I._buffer.length=0,U.forEach(function(Y){$[Y[0]].apply($,Y[1])})};$I.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};$I.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var s3=F((aC1,yG0)=>{yG0.exports=W8;var CJ1=s6(),_J1=t("stream").Stream,SJ1=c0(),Sy=t("path"),gy=lq(),PL=W8.hardLinks={},SG0=ML();SJ1(W8,SG0);var gG0=By();function W8($,I){var U=this;if(!(U instanceof W8))return new W8($,I);if(typeof $==="string")$={path:$};var Y,J;if($.type&&typeof $.type==="function")Y=$.type,J=Y;else Y=gy($),J=W8;if(I&&!Y)Y=gy(I),$[Y]=!0,$.type=Y;switch(Y){case"Directory":J=Ry();break;case"Link":case"File":J=jy();break;case"SymbolicLink":J=gG0;break;case"Socket":J=CG0();break;case null:J=_y();break}if(!(U instanceof J))return new J($);if(SG0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=Y,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=Sy.resolve($.path),process.platform==="win32"){if(U.path=U._path=U.path.replace(/\?/g,"_"),U._path.length>=260)U._swallowErrors=!0,U._path="\\\\?\\"+U.path.replace(/\//g,"\\")}if(U.basename=$.basename=Sy.basename(U.path),U.dirname=$.dirname=Sy.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=gJ1;U._stat(I)}function gJ1($,I){return $===I?0:$.toLowerCase()>I.toLowerCase()?1:$.toLowerCase()<I.toLowerCase()?-1:$>I?1:-1}W8.prototype._stat=function($){var I=this,U=I.props,Y=U.follow?"stat":"lstat";if($)process.nextTick(J.bind(null,null,$));else CJ1[Y](I._path,J);function J(Q,K){if(Q)return I.error(Q);if(Object.keys(K).forEach(function(Z){U[Z]=K[Z]}),I.size!==void 0&&U.size!==I.size)return I.error("incorrect size");I.size=U.size;var q=gy(U),H=U.hardlinks!==!1;if(H&&q!=="Directory"&&U.nlink&&U.nlink>1){var G=U.dev+":"+U.ino;if(PL[G]===I._path||!PL[G])PL[G]=I._path;else q=I.type=I.props.type="Link",I.Link=I.props.Link=!0,I.linkpath=I.props.linkpath=PL[G],I._stat=I._read=gG0.prototype._read}if(I.type&&I.type!==q)I.error("Unexpected type: "+q);if(I.filter){var W=I._proxy||I;if(!I.filter.call(W,W,U)){if(!I._disowned)I.abort(),I.emit("end"),I.emit("close");return}}var w=["_stat","stat","ready"],V=0;(function Z(){if(I._aborted){I.emit("end"),I.emit("close");return}if(I._paused&&I.type!=="Directory"){I.once("resume",Z);return}var X=w[V++];if(!X)return I._read();I.emit(X,U),Z()})()}};W8.prototype.pipe=function($){var I=this;if(typeof $.add==="function")I.on("entry",function(U){var Y=$.add(U);if(Y===!1)I.pause()});return _J1.prototype.pipe.apply(this,arguments)};W8.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};W8.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};W8.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var xy=F((sC1,nG0)=>{n Line truncated
expect: `+$.size+`
actual: `+$._bytesWritten);CL.prototype._finish.call($)}});var ny=O((mj1,BW0)=>{BW0.exports=L7;var by=ZJ(),pJ1=dq(),cJ1=p0(),dJ1=vL(),mJ1=r("fs");cJ1(L7,by);function L7($){var I=this;if(!(I instanceof L7))throw Error("ProxyWriter must be called as constructor.");I.props=$,I._needDrain=!1,by.call(I,$)}L7.prototype._stat=function(){var $=this,I=$.props,U=I.follow?"stat":"lstat";mJ1[U](I.path,function(Y,J){var Q;if(Y||!J)Q="File";else Q=pJ1(J);I[Q]=!0,I.type=$.type=Q,$._old=J,$._addProxy(by(I,J))})};L7.prototype._addProxy=function($){var I=this;if(I._proxy)return I.error("proxy already set");I._proxy=$,["ready","error","close","pipe","drain","warn"].forEach(function(Y){$.on(Y,I.emit.bind(I,Y))}),I.emit("proxy",$);var U=I._buffer;if(U.forEach(function(Y){$[Y[0]].apply($,Y[1])}),I._buffer.length=0,I._needsDrain)I.emit("drain")};L7.prototype.add=function($){if(dJ1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};L7.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};L7.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var ZJ=O((lj1,hW0)=>{hW0.exports=y$;var S$=o6(),lJ1=p0(),oJ1=_y(),rJ1=uy(),aq=r("path"),RW0=process.platform==="win32"?0:process.umask(),CW0=dq(),jW0=LL();lJ1(y$,jW0);y$.dirmode=parseInt("0777",8)&~RW0;y$.filemode=parseInt("0666",8)&~RW0;var tJ1=ky(),aJ1=fy(),sJ1=iy(),eJ1=ny();function y$($,I){var U=this;if(typeof $==="string")$={path:$};var Y=CW0($),J=y$;switch(Y){case"Directory":J=tJ1;break;case"File":J=sJ1;break;case"Link":case"SymbolicLink":J=aJ1;break;case null:default:J=eJ1;break}if(!(U instanceof J))return new J($);if(jW0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.type=$.type,U.props=$,U.depth=$.depth||0,U.clobber=$.clobber===!1?$.clobber:!0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=aq.resolve($.path),process.platform==="win32"){if(U.path=U._path=U.path.replace(/\?/g,"_"),U._path.length>=260)U._swallowErrors=!0,U._path="\\\\?\\"+U.path.replace(/\//g,"\\")}if(U.basename=aq.basename($.path),U.dirname=aq.dirname($.path),U.linkpath=$.linkpath||null,$.parent=$.root=null,U.size=$.size,typeof $.mode==="string")$.mode=parseInt($.mode,8);U.readable=!1,U.writable=!0,U._buffer=[],U.ready=!1,U.filter=typeof $.filter==="function"?$.filter:null,U._stat(I)}y$.prototype._create=function(){var $=this;S$[$.props.follow?"stat":"lstat"]($._path,function(I){if(I)return $.warn("Cannot create "+$._path+`
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};y$.prototype._stat=function($){var I=this,U=I.props,Y=U.follow?"stat":"lstat",J=I._proxy||I;if($)Q(null,$);else S$[Y](I._path,Q);function Q(K,q){if(I.filter&&!I.filter.call(J,J,q)){I._aborted=!0,I.emit("end"),I.emit("close");return}if(K||!q)return py(I);I._old=q;var H=CW0(q);if(H!==I.type||I.type==="File"&&q.nlink>1)return oJ1(I._path,function(G){if(G)return I.error(G);I._old=null,py(I)});py(I)}};function py($){rJ1(aq.dirname($._path),y$.dirmode,function(I,U){if(I)return $.error(I);return $._madeDir=U,$._create()})}function _W0($,I,U,Y,J){var Q=I.mode,K=I.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!S$[K])return J();if(typeof Q!=="number")return J();var q=U.mode&parseInt("0777",8);if(Q=Q&parseInt("0777",8),Q===q)return J();S$[K](Y,Q,J)}function gW0($,I,U,Y,J){if(process.platform==="win32")return J();if(!process.getuid||process.getuid()!==0)return J();if(typeof I.uid!=="number"&&typeof I.gid!=="number")return J();if(U.uid===I.uid&&U.gid===I.gid)return J();var Q=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!S$[Q])return J();if(typeof I.uid!=="number")I.uid=U.uid;if(typeof I.gid!=="number")I.gid=U.gid;S$[Q](Y,I.uid,I.gid,J)}function SW0($,I,U,Y,J){if(!S$.utimes||process.platform==="win32")return J();var Q=I.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(Q==="lutimes"&&!S$[Q])Q="utimes";if(!S$[Q])return J();var{atime:K,mtime:q}=U,H=I.atime,G=I.mtime;if(H===void 0)H=K;if(G===void 0)G=q;if(!vW0(H))H=new Date(H);if(!vW0(G))H=new Date(G);if(H.getTime()===K.getTime()&&G.getTime()===q.getTime())return J();S$[Q](Y,H,G,J)}y$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var I=0,U=null,Y=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),Q($._old);else{var J=$.props.follow?"stat":"lstat";S$[J]($._path,function(q,H){if(q)if(q.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(q);Q($._old=H)})}return;function Q(q){I+=3,_W0($,$.props,q,$._path,K("chmod")),gW0($,$.props,q,$._path,K("chown")),SW0($,$.props,q,$._path,K("utimes"))}function K(q){return function(H){if(U)return;if(H)return H.fstream_finish_call=q,$.error(U=H);if(--I>0)return;if(Y)return;if(Y=!0,!$._madeDir)return G();else yW0($,$._path,G);function G(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function yW0($,I,U){var Y=$._madeDir,J=aq.dirname(I);$Q1($,J,function(Q){if(Q)return U(Q);if(J===Y)return U();yW0($,J,U)})}function $Q1($,I,U){var Y={};Object.keys($.props).forEach(function(q){if(Y[q]=$.props[q],q==="mode"&&$.type!=="Directory")Y[q]=Y[q]|parseInt("0111",8)});var J=3,Q=null;S$.stat(I,function(q,H){if(q)return U(Q=q);_W0($,Y,H,I,K),gW0($,Y,H,I,K),SW0($,Y,H,I,K)});function K(q){if(Q)return;if(q)return U(Q=q);if(--J===0)return U()}}y$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};y$.prototype.add=function(){this.error("Can't add to non-Directory type")};y$.prototype.write=function(){return!0};function IQ1($){return Object.prototype.toString.call($)}function vW0($){return typeof $==="object"&&IQ1($)==="[object Date]"}});var oy=O((UQ1)=>{UQ1.Abstract=LL();UQ1.Reader=a3();UQ1.Writer=ZJ();UQ1.File={Reader:Py(),Writer:iy()};UQ1.Dir={Reader:Ay(),Writer:ky()};UQ1.Link={Reader:Ny(),Writer:fy()};UQ1.Proxy={Reader:Ey(),Writer:ny()};UQ1.Reader.Dir=UQ1.DirReader=UQ1.Dir.Reader;UQ1.Reader.File=UQ1.FileReader=UQ1.File.Reader;UQ1.Reader.Link=UQ1.LinkReader=UQ1.Link.Reader;UQ1.Reader.Proxy=UQ1.ProxyReader=UQ1.Proxy.Reader;UQ1.Writer.Dir=UQ1.DirWriter=UQ1.Dir.Writer;UQ1.Writer.File=UQ1.FileWriter=UQ1.File.Writer;UQ1.Writer.Link=UQ1.LinkWriter=UQ1.Link.Writer;UQ1.Writer.Proxy=UQ1.ProxyWriter=UQ1.Proxy.Writer;UQ1.collect=vL()});var xW0=O((Y_1,uW0)=>{uW0.exports=WQ1;var QQ1=qL(),KQ1=oy().Writer,ry=r("path"),qQ1=r("stream"),HQ1=Dy(),GQ1=G7();function WQ1($){$.path=ry.resolve(ry.normalize($.path));var I=new QQ1($),U=new qQ1.Writable({objectMode:!0});U._write=function(J,Q,K){if(J.type=="Directory")return K();var q=ry.join($.path,J.path);if(q.indexOf($.path)!=0)return K();let H=$.getWriter?$.getWriter({path:q}):KQ1({path:q});J.pipe(H).on("error",K).on("close",K)};var Y=HQ1(I,U);return I.once("crx-header",function(J){Y.crxHeader=J}),I.pipe(U).on("finish",function(){Y.emit("close")}),Y.promise=function(){return new GQ1(function(J,Q){Y.on("close",J),Y.on("error",Q)})},Y}});var kW0=O((J_1,jL)=>{var u4=function($){var I=1e7,U=7,Y=9007199254740992,J=V(Y),Q="0123456789abcdefghijklmnopqrstuvwxyz",K=typeof BigInt==="function";function q(N,M,j,u){if(typeof N>"u")return q[0];if(typeof M<"u")return+M===10&&!j?E0(N):i$(N,M,j,u);return E0(N)}function H(N,M){this.value=N,this.sign=M,this.isSmall=!1}H.prototype=Object.create(q.prototype);function G(N){this.value=N,this.sign=N<0,this.isSmall=!0}G.prototype=Object.create(q.prototype);function W(N){th Line truncated
actual: `+$._bytesWritten);yL.prototype._finish.call($)}});var oy=F((L_1,_W0)=>{_W0.exports=D7;var ly=zJ(),KQ1=lq(),qQ1=c0(),HQ1=SL(),GQ1=t("fs");qQ1(D7,ly);function D7($){var I=this;if(!(I instanceof D7))throw Error("ProxyWriter must be called as constructor.");I.props=$,I._needDrain=!1,ly.call(I,$)}D7.prototype._stat=function(){var $=this,I=$.props,U=I.follow?"stat":"lstat";GQ1[U](I.path,function(Y,J){var Q;if(Y||!J)Q="File";else Q=KQ1(J);I[Q]=!0,I.type=$.type=Q,$._old=J,$._addProxy(ly(I,J))})};D7.prototype._addProxy=function($){var I=this;if(I._proxy)return I.error("proxy already set");I._proxy=$,["ready","error","close","pipe","drain","warn"].forEach(function(Y){$.on(Y,I.emit.bind(I,Y))}),I.emit("proxy",$);var U=I._buffer;if(U.forEach(function(Y){$[Y[0]].apply($,Y[1])}),I._buffer.length=0,I._needsDrain)I.emit("drain")};D7.prototype.add=function($){if(HQ1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};D7.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};D7.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var zJ=F((D_1,bW0)=>{bW0.exports=f$;var k$=s6(),WQ1=c0(),wQ1=xy(),VQ1=ny(),eq=t("path"),gW0=process.platform==="win32"?0:process.umask(),yW0=lq(),hW0=ML();WQ1(f$,hW0);f$.dirmode=parseInt("0777",8)&~gW0;f$.filemode=parseInt("0666",8)&~gW0;var ZQ1=cy(),zQ1=dy(),XQ1=my(),LQ1=oy();function f$($,I){var U=this;if(typeof $==="string")$={path:$};var Y=yW0($),J=f$;switch(Y){case"Directory":J=ZQ1;break;case"File":J=XQ1;break;case"Link":case"SymbolicLink":J=zQ1;break;case null:default:J=LQ1;break}if(!(U instanceof J))return new J($);if(hW0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.type=$.type,U.props=$,U.depth=$.depth||0,U.clobber=$.clobber===!1?$.clobber:!0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=eq.resolve($.path),process.platform==="win32"){if(U.path=U._path=U.path.replace(/\?/g,"_"),U._path.length>=260)U._swallowErrors=!0,U._path="\\\\?\\"+U.path.replace(/\//g,"\\")}if(U.basename=eq.basename($.path),U.dirname=eq.dirname($.path),U.linkpath=$.linkpath||null,$.parent=$.root=null,U.size=$.size,typeof $.mode==="string")$.mode=parseInt($.mode,8);U.readable=!1,U.writable=!0,U._buffer=[],U.ready=!1,U.filter=typeof $.filter==="function"?$.filter:null,U._stat(I)}f$.prototype._create=function(){var $=this;k$[$.props.follow?"stat":"lstat"]($._path,function(I){if(I)return $.warn("Cannot create "+$._path+`
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};f$.prototype._stat=function($){var I=this,U=I.props,Y=U.follow?"stat":"lstat",J=I._proxy||I;if($)Q(null,$);else k$[Y](I._path,Q);function Q(K,q){if(I.filter&&!I.filter.call(J,J,q)){I._aborted=!0,I.emit("end"),I.emit("close");return}if(K||!q)return ry(I);I._old=q;var H=yW0(q);if(H!==I.type||I.type==="File"&&q.nlink>1)return wQ1(I._path,function(G){if(G)return I.error(G);I._old=null,ry(I)});ry(I)}};function ry($){VQ1(eq.dirname($._path),f$.dirmode,function(I,U){if(I)return $.error(I);return $._madeDir=U,$._create()})}function uW0($,I,U,Y,J){var Q=I.mode,K=I.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!k$[K])return J();if(typeof Q!=="number")return J();var q=U.mode&parseInt("0777",8);if(Q=Q&parseInt("0777",8),Q===q)return J();k$[K](Y,Q,J)}function xW0($,I,U,Y,J){if(process.platform==="win32")return J();if(!process.getuid||process.getuid()!==0)return J();if(typeof I.uid!=="number"&&typeof I.gid!=="number")return J();if(U.uid===I.uid&&U.gid===I.gid)return J();var Q=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!k$[Q])return J();if(typeof I.uid!=="number")I.uid=U.uid;if(typeof I.gid!=="number")I.gid=U.gid;k$[Q](Y,I.uid,I.gid,J)}function kW0($,I,U,Y,J){if(!k$.utimes||process.platform==="win32")return J();var Q=I.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(Q==="lutimes"&&!k$[Q])Q="utimes";if(!k$[Q])return J();var{atime:K,mtime:q}=U,H=I.atime,G=I.mtime;if(H===void 0)H=K;if(G===void 0)G=q;if(!SW0(H))H=new Date(H);if(!SW0(G))H=new Date(G);if(H.getTime()===K.getTime()&&G.getTime()===q.getTime())return J();k$[Q](Y,H,G,J)}f$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var I=0,U=null,Y=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),Q($._old);else{var J=$.props.follow?"stat":"lstat";k$[J]($._path,function(q,H){if(q)if(q.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(q);Q($._old=H)})}return;function Q(q){I+=3,uW0($,$.props,q,$._path,K("chmod")),xW0($,$.props,q,$._path,K("chown")),kW0($,$.props,q,$._path,K("utimes"))}function K(q){return function(H){if(U)return;if(H)return H.fstream_finish_call=q,$.error(U=H);if(--I>0)return;if(Y)return;if(Y=!0,!$._madeDir)return G();else fW0($,$._path,G);function G(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function fW0($,I,U){var Y=$._madeDir,J=eq.dirname(I);DQ1($,J,function(Q){if(Q)return U(Q);if(J===Y)return U();fW0($,J,U)})}function DQ1($,I,U){var Y={};Object.keys($.props).forEach(function(q){if(Y[q]=$.props[q],q==="mode"&&$.type!=="Directory")Y[q]=Y[q]|parseInt("0111",8)});var J=3,Q=null;k$.stat(I,function(q,H){if(q)return U(Q=q);uW0($,Y,H,I,K),xW0($,Y,H,I,K),kW0($,Y,H,I,K)});function K(q){if(Q)return;if(q)return U(Q=q);if(--J===0)return U()}}f$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};f$.prototype.add=function(){this.error("Can't add to non-Directory type")};f$.prototype.write=function(){return!0};function FQ1($){return Object.prototype.toString.call($)}function SW0($){return typeof $==="object"&&FQ1($)==="[object Date]"}});var $h=F((OQ1)=>{OQ1.Abstract=ML();OQ1.Reader=s3();OQ1.Writer=zJ();OQ1.File={Reader:jy(),Writer:my()};OQ1.Dir={Reader:Ry(),Writer:cy()};OQ1.Link={Reader:By(),Writer:dy()};OQ1.Proxy={Reader:_y(),Writer:oy()};OQ1.Reader.Dir=OQ1.DirReader=OQ1.Dir.Reader;OQ1.Reader.File=OQ1.FileReader=OQ1.File.Reader;OQ1.Reader.Link=OQ1.LinkReader=OQ1.Link.Reader;OQ1.Reader.Proxy=OQ1.ProxyReader=OQ1.Proxy.Reader;OQ1.Writer.Dir=OQ1.DirWriter=OQ1.Dir.Writer;OQ1.Writer.File=OQ1.FileWriter=OQ1.File.Writer;OQ1.Writer.Link=OQ1.LinkWriter=OQ1.Link.Writer;OQ1.Writer.Proxy=OQ1.ProxyWriter=OQ1.Proxy.Writer;OQ1.collect=SL()});var nW0=F((v_1,iW0)=>{iW0.exports=vQ1;var AQ1=VL(),PQ1=$h().Writer,Ih=t("path"),TQ1=t("stream"),EQ1=Py(),BQ1=W7();function vQ1($){$.path=Ih.resolve(Ih.normalize($.path));var I=new AQ1($),U=new TQ1.Writable({objectMode:!0});U._write=function(J,Q,K){if(J.type=="Directory")return K();var q=Ih.join($.path,J.path);if(q.indexOf($.path)!=0)return K();let H=$.getWriter?$.getWriter({path:q}):PQ1({path:q});J.pipe(H).on("error",K).on("close",K)};var Y=EQ1(I,U);return I.once("crx-header",function(J){Y.crxHeader=J}),I.pipe(U).on("finish",function(){Y.emit("close")}),Y.promise=function(){return new BQ1(function(J,Q){Y.on("close",J),Y.on("error",Q)})},Y}});var pW0=F((R_1,hL)=>{var u4=function($){var I=1e7,U=7,Y=9007199254740992,J=V(Y),Q="0123456789abcdefghijklmnopqrstuvwxyz",K=typeof BigInt==="function";function q(N,M,C,u){if(typeof N>"u")return q[0];if(typeof M<"u")return+M===10&&!C?v0(N):b6(N,M,C,u);return v0(N)}function H(N,M){this.value=N,this.sign=M,this.isSmall=!1}H.prototype=Object.create(q.prototype);function G(N){this.value=N,this.sign=N<0,this.isSmall=!0}G.prototype=Object.create(q.prototype);function W(N){th Line truncated
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/var x1=r("fs"),uL=r("os"),x4=r("path"),aW0=r("crypto"),b8={fs:x1.constants,os:uL.constants},Iw0=/XXXXXX/,Uw0=(b8.O_CREAT||b8.fs.O_CREAT)|(b8.O_EXCL||b8.fs.O_EXCL)|(b8.O_RDWR||b8.fs.O_RDWR),yQ1=uL.platform()==="win32",hQ1=b8.EBADF||b8.os.errno.EBADF,uQ1=b8.ENOENT||b8.os.errno.ENOENT,XJ=[],Yw0=x1.rmdirSync.bind(x1),Jw0=!1;function xQ1($,I){return x1.rm($,{recursive:!0},I)}function Qw0($){return x1.rmSync($,{recursive:!0})}function $h($,I){let U=LJ($,I),Y=U[0],J=U[1];lQ1(Y,function(Q,K){if(Q)return J(Q);let q=K.tries;(function H(){try{let G=qw0(K);x1.stat(G,function(W){if(!W){if(q-- >0)return H();return J(Error("Could not get a unique tmp filename, max tries reached "+G))}J(null,G)})}catch(G){J(G)}})()})}function Ih($){let I=LJ($),U=I[0],Y=oQ1(U),J=Y.tries;do{let Q=qw0(Y);try{x1.statSync(Q)}catch(K){return Q}}while(J-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function kQ1($,I){let U=LJ($,I),Y=U[0],J=U[1];$h(Y,function(K,q){if(K)return J(K);x1.open(q,Uw0,Y.mode||384,function(G,W){if(G)return J(G);if(Y.discardDescriptor)return x1.close(W,function(V){return J(V,q,void 0,sy(q,-1,Y,!1))});else{let w=Y.discardDescriptor||Y.detachDescriptor;J(null,q,W,sy(q,w?-1:W,Y,!1))}})})}function fQ1($){let I=LJ($),U=I[0],Y=U.discardDescriptor||U.detachDescriptor,J=Ih(U),Q=x1.openSync(J,Uw0,U.mode||384);if(U.discardDescriptor)x1.closeSync(Q),Q=void 0;return{name:J,fd:Q,removeCallback:sy(J,Y?-1:Q,U,!0)}}function iQ1($,I){let U=LJ($,I),Y=U[0],J=U[1];$h(Y,function(K,q){if(K)return J(K);x1.mkdir(q,Y.mode||448,function(G){if(G)return J(G);J(null,q,Kw0(q,Y,!1))})})}function bQ1($){let I=LJ($),U=I[0],Y=Ih(U);return x1.mkdirSync(Y,U.mode||448),{name:Y,removeCallback:Kw0(Y,U,!0)}}function nQ1($,I){let U=function(Y){if(Y&&!ey(Y))return I(Y);I()};if(0<=$[0])x1.close($[0],function(){x1.unlink($[1],U)});else x1.unlink($[1],U)}function pQ1($){let I=null;try{if(0<=$[0])x1.closeSync($[0])}catch(U){if(!rQ1(U)&&!ey(U))throw U}finally{try{x1.unlinkSync($[1])}catch(U){if(!ey(U))I=U}}if(I!==null)throw I}function sy($,I,U,Y){let J=hL(pQ1,[I,$],Y),Q=hL(nQ1,[I,$],Y,J);if(!U.keep)XJ.unshift(J);return Y?J:Q}function Kw0($,I,U){let Y=I.unsafeCleanup?xQ1:x1.rmdir.bind(x1),J=I.unsafeCleanup?Qw0:Yw0,Q=hL(J,$,U),K=hL(Y,$,U,Q);if(!I.keep)XJ.unshift(Q);return U?Q:K}function hL($,I,U,Y){let J=!1;return function Q(K){if(!J){let q=Y||Q,H=XJ.indexOf(q);if(H>=0)XJ.splice(H,1);if(J=!0,U||$===Yw0||$===Qw0)return $(I);else return $(I,K||function(){})}}}function cQ1(){if(!Jw0)return;while(XJ.length)try{XJ[0]()}catch($){}}function sW0($){let I=[],U=null;try{U=aW0.randomBytes($)}catch(Y){U=aW0.pseudoRandomBytes($)}for(let Y=0;Y<$;Y++)I.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[Y]%62]);return I.join("")}function t6($){return typeof $>"u"}function LJ($,I){if(typeof $==="function")return[{},$];if(t6($))return[{},I];let U={};for(let Y of Object.getOwnPropertyNames($))U[Y]=$[Y];return[U,I]}function dQ1($,I,U){let Y=x4.isAbsolute($)?$:x4.join(I,$);x1.stat(Y,function(J){if(J)x1.realpath(x4.dirname(Y),function(Q,K){if(Q)return U(Q);U(null,x4.join(K,x4.basename(Y)))});else x1.realpath(Y,U)})}function mQ1($,I){let U=x4.isAbsolute($)?$:x4.join(I,$);try{return x1.statSync(U),x1.realpathSync(U)}catch(Y){let J=x1.realpathSync(x4.dirname(U));return x4.join(J,x4.basename(U))}}function qw0($){let I=$.tmpdir;if(!t6($.name))return x4.join(I,$.dir,$.name);if(!t6($.template))return x4.join(I,$.dir,$.template).replace(Iw0,sW0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",sW0(12),$.postfix?"-"+$.postfix:""].join("");return x4.join(I,$.dir,U)}function ay($,I){if(typeof I!=="string")throw Error(`${$} option must be a string, got "${typeof I}".`);if(I.includes(".."))throw Error("Relative value not allowed");return I}function Hw0($){if(!t6($.name)){let I=$.name;if(x4.isAbsolute(I))throw Error(`name option must not contain an absolute path, found "${I}".`);let U=x4.basename(I);if(U===".."||U==="."||U!==I)throw Error(`name option must not contain a path, found "${I}".`)}if(!t6($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(Iw0))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)?"":ay("prefix",$.prefix),$.postfix=t6($.postfix)?"":ay("postfix",$.postfix),$.template=t6($.template)?void 0:ay("template",$.template)}function eW0($,I,U,Y){if(t6(I))return Y(null);dQ1(I,U,function(J,Q){if(J)return Y(J);let K=x4.relative(U,Q);if(K.startsWith("..")||x4.isAbsolute(K))return Y(Error(`${$} option must be relative to "${U}", found "${K}".`));Y(null,K)})}function $w0($,I,U){if(t6(I))return;let Y=mQ1(I,U),J=x4.relative(U,Y);if(J.startsWith("..")||x4.isAbsolute(J))throw ELine truncated
*/var f1=t("fs"),iL=t("os"),x4=t("path"),Uw0=t("crypto"),d8={fs:f1.constants,os:iL.constants},Kw0=/XXXXXX/,qw0=(d8.O_CREAT||d8.fs.O_CREAT)|(d8.O_EXCL||d8.fs.O_EXCL)|(d8.O_RDWR||d8.fs.O_RDWR),aQ1=iL.platform()==="win32",sQ1=d8.EBADF||d8.os.errno.EBADF,eQ1=d8.ENOENT||d8.os.errno.ENOENT,LJ=[],Hw0=f1.rmdirSync.bind(f1),Gw0=!1;function $21($,I){return f1.rm($,{recursive:!0},I)}function Ww0($){return f1.rmSync($,{recursive:!0})}function Kh($,I){let U=DJ($,I),Y=U[0],J=U[1];W21(Y,function(Q,K){if(Q)return J(Q);let q=K.tries;(function H(){try{let G=Vw0(K);f1.stat(G,function(W){if(!W){if(q-- >0)return H();return J(Error("Could not get a unique tmp filename, max tries reached "+G))}J(null,G)})}catch(G){J(G)}})()})}function qh($){let I=DJ($),U=I[0],Y=w21(U),J=Y.tries;do{let Q=Vw0(Y);try{f1.statSync(Q)}catch(K){return Q}}while(J-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function I21($,I){let U=DJ($,I),Y=U[0],J=U[1];Kh(Y,function(K,q){if(K)return J(K);f1.open(q,qw0,Y.mode||384,function(G,W){if(G)return J(G);if(Y.discardDescriptor)return f1.close(W,function(V){return J(V,q,void 0,Jh(q,-1,Y,!1))});else{let w=Y.discardDescriptor||Y.detachDescriptor;J(null,q,W,Jh(q,w?-1:W,Y,!1))}})})}function U21($){let I=DJ($),U=I[0],Y=U.discardDescriptor||U.detachDescriptor,J=qh(U),Q=f1.openSync(J,qw0,U.mode||384);if(U.discardDescriptor)f1.closeSync(Q),Q=void 0;return{name:J,fd:Q,removeCallback:Jh(J,Y?-1:Q,U,!0)}}function Y21($,I){let U=DJ($,I),Y=U[0],J=U[1];Kh(Y,function(K,q){if(K)return J(K);f1.mkdir(q,Y.mode||448,function(G){if(G)return J(G);J(null,q,ww0(q,Y,!1))})})}function J21($){let I=DJ($),U=I[0],Y=qh(U);return f1.mkdirSync(Y,U.mode||448),{name:Y,removeCallback:ww0(Y,U,!0)}}function Q21($,I){let U=function(Y){if(Y&&!Qh(Y))return I(Y);I()};if(0<=$[0])f1.close($[0],function(){f1.unlink($[1],U)});else f1.unlink($[1],U)}function K21($){let I=null;try{if(0<=$[0])f1.closeSync($[0])}catch(U){if(!V21(U)&&!Qh(U))throw U}finally{try{f1.unlinkSync($[1])}catch(U){if(!Qh(U))I=U}}if(I!==null)throw I}function Jh($,I,U,Y){let J=bL(K21,[I,$],Y),Q=bL(Q21,[I,$],Y,J);if(!U.keep)LJ.unshift(J);return Y?J:Q}function ww0($,I,U){let Y=I.unsafeCleanup?$21:f1.rmdir.bind(f1),J=I.unsafeCleanup?Ww0:Hw0,Q=bL(J,$,U),K=bL(Y,$,U,Q);if(!I.keep)LJ.unshift(Q);return U?Q:K}function bL($,I,U,Y){let J=!1;return function Q(K){if(!J){let q=Y||Q,H=LJ.indexOf(q);if(H>=0)LJ.splice(H,1);if(J=!0,U||$===Hw0||$===Ww0)return $(I);else return $(I,K||function(){})}}}function q21(){if(!Gw0)return;while(LJ.length)try{LJ[0]()}catch($){}}function Yw0($){let I=[],U=null;try{U=Uw0.randomBytes($)}catch(Y){U=Uw0.pseudoRandomBytes($)}for(let Y=0;Y<$;Y++)I.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[Y]%62]);return I.join("")}function $$($){return typeof $>"u"}function DJ($,I){if(typeof $==="function")return[{},$];if($$($))return[{},I];let U={};for(let Y of Object.getOwnPropertyNames($))U[Y]=$[Y];return[U,I]}function H21($,I,U){let Y=x4.isAbsolute($)?$:x4.join(I,$);f1.stat(Y,function(J){if(J)f1.realpath(x4.dirname(Y),function(Q,K){if(Q)return U(Q);U(null,x4.join(K,x4.basename(Y)))});else f1.realpath(Y,U)})}function G21($,I){let U=x4.isAbsolute($)?$:x4.join(I,$);try{return f1.statSync(U),f1.realpathSync(U)}catch(Y){let J=f1.realpathSync(x4.dirname(U));return x4.join(J,x4.basename(U))}}function Vw0($){let I=$.tmpdir;if(!$$($.name))return x4.join(I,$.dir,$.name);if(!$$($.template))return x4.join(I,$.dir,$.template).replace(Kw0,Yw0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",Yw0(12),$.postfix?"-"+$.postfix:""].join("");return x4.join(I,$.dir,U)}function Yh($,I){if(typeof I!=="string")throw Error(`${$} option must be a string, got "${typeof I}".`);if(I.includes(".."))throw Error("Relative value not allowed");return I}function Zw0($){if(!$$($.name)){let I=$.name;if(x4.isAbsolute(I))throw Error(`name option must not contain an absolute path, found "${I}".`);let U=x4.basename(I);if(U===".."||U==="."||U!==I)throw Error(`name option must not contain a path, found "${I}".`)}if(!$$($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(Kw0))throw Error(`Invalid template, found "${$.template}".`)}if(!$$($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=$$($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=$$($.prefix)?"":Yh("prefix",$.prefix),$.postfix=$$($.postfix)?"":Yh("postfix",$.postfix),$.template=$$($.template)?void 0:Yh("template",$.template)}function Jw0($,I,U,Y){if($$(I))return Y(null);H21(I,U,function(J,Q){if(J)return Y(J);let K=x4.relative(U,Q);if(K.startsWith("..")||x4.isAbsolute(K))return Y(Error(`${$} option must be relative to "${U}", found "${K}".`));Y(null,K)})}function Qw0($,I,U){if($$(I))return;let Y=G21(I,U),J=x4.relative(U,Y);if(J.startsWith("..")||x4.isAbsolute(J))throw ELine 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 cV0=O((Rq1)=>{var Uu=c5().Buffer;Rq1._dbcs=m5;var W6=-1,pV0=-2,k$=-10,h6=-1000,RJ=Array(256),GH=-1;for(HH=0;HH<256;HH++)RJ[HH]=W6;var HH;function m5($,I){if(this.encodingName=$.encodingName,!$)throw Error("DBCS codec is called without the data.");if(!$.table)throw Error("Encoding '"+this.encodingName+"' has no data.");var U=$.table();this.decodeTables=[],this.decodeTables[0]=RJ.slice(0),this.decodeTableSeq=[];for(var Y=0;Y<U.length;Y++)this._addDecodeChunk(U[Y]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var J=this.decodeTables.length;this.decodeTables.push(RJ.slice(0));var Q=this.decodeTables.length;this.decodeTables.push(RJ.slice(0));var K=this.decodeTables[0];for(var Y=129;Y<=254;Y++){var q=this.decodeTables[h6-K[Y]];for(var H=48;H<=57;H++){if(q[H]===W6)q[H]=h6-J;else if(q[H]>h6)throw Error("gb18030 decode tables conflict at byte 2");var G=this.decodeTables[h6-q[H]];for(var W=129;W<=254;W++){if(G[W]===W6)G[W]=h6-Q;else if(G[W]===h6-Q)continue;else if(G[W]>h6)throw Error("gb18030 decode tables conflict at byte 3");var w=this.decodeTables[h6-G[W]];for(var V=48;V<=57;V++)if(w[V]===W6)w[V]=pV0}}}}this.defaultCharUnicode=I.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var Z={};if($.encodeSkipVals)for(var Y=0;Y<$.encodeSkipVals.length;Y++){var X=$.encodeSkipVals[Y];if(typeof X==="number")Z[X]=!0;else for(var H=X.from;H<=X.to;H++)Z[H]=!0}if(this._fillEncodeTable(0,0,Z),$.encodeAdd){for(var L in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,L))this._setEncodeChar(L.charCodeAt(0),$.encodeAdd[L])}if(this.defCharSB=this.encodeTable[0][I.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===W6)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===W6)this.defCharSB=63}m5.prototype.encoder=HD;m5.prototype.decoder=Yu;m5.prototype._getDecodeTrieNode=function($){var I=[];for(;$>0;$>>>=8)I.push($&255);if(I.length==0)I.push(0);var U=this.decodeTables[0];for(var Y=I.length-1;Y>0;Y--){var J=U[I[Y]];if(J==W6)U[I[Y]]=h6-this.decodeTables.length,this.decodeTables.push(U=RJ.slice(0));else if(J<=h6)U=this.decodeTables[h6-J];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};m5.prototype._addDecodeChunk=function($){var I=parseInt($[0],16),U=this._getDecodeTrieNode(I);I=I&255;for(var Y=1;Y<$.length;Y++){var J=$[Y];if(typeof J==="string")for(var Q=0;Q<J.length;){var K=J.charCodeAt(Q++);if(K>=55296&&K<56320){var q=J.charCodeAt(Q++);if(q>=56320&&q<57344)U[I++]=65536+(K-55296)*1024+(q-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(K>4080&&K<=4095){var H=4095-K+2,G=[];for(var W=0;W<H;W++)G.push(J.charCodeAt(Q++));U[I++]=k$-this.decodeTableSeq.length,this.decodeTableSeq.push(G)}else U[I++]=K}else if(typeof J==="number"){var w=U[I-1]+1;for(var Q=0;Q<J;Q++)U[I++]=w++}else throw Error("Incorrect type '"+typeof J+"' given in "+this.encodingName+" at chunk "+$[0])}if(I>255)throw Error("Incorrect chunk in "+this.encoLine truncated
`)}var AI=($)=>(I,U,Y,J)=>{let Q=Y?{...Y,async:!1}:{async:!1},K=I._zod.run({value:U,issues:[]},Q);if(K instanceof Promise)throw new H8;if(K.issues.length){let q=new(J?.Err??$)(K.issues.map((H)=>P6(H,Q,Z4())));throw rH(q,J?.callee),q}return K.value},rJ=AI(k6),PI=($)=>async(I,U,Y,J)=>{let Q=Y?{...Y,async:!0}:{async:!0},K=I._zod.run({value:U,issues:[]},Q);if(K instanceof Promise)K=await K;if(K.issues.length){let q=new(J?.Err??$)(K.issues.map((H)=>P6(H,Q,Z4())));throw rH(q,J?.callee),q}return K.value},tJ=PI(k6),TI=($)=>(I,U,Y)=>{let J=Y?{...Y,async:!1}:{async:!1},Q=I._zod.run({value:U,issues:[]},J);if(Q instanceof Promise)throw new H8;return Q.issues.length?{success:!1,error:new($??mJ)(Q.issues.map((K)=>P6(K,J,Z4())))}:{success:!0,data:Q.value}},EI=TI(k6),BI=($)=>async(I,U,Y)=>{let J=Y?{...Y,async:!0}:{async:!0},Q=I._zod.run({value:U,issues:[]},J);if(Q instanceof Promise)Q=await Q;return Q.issues.length?{success:!1,error:new $(Q.issues.map((K)=>P6(K,J,Z4())))}:{success:!0,data:Q.value}},aJ=BI(k6),tH=($)=>(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return AI($)(I,U,J)},yx=tH(k6),aH=($)=>(I,U,Y)=>{return AI($)(I,U,Y)},hx=aH(k6),sH=($)=>async(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return PI($)(I,U,J)},ux=sH(k6),eH=($)=>async(I,U,Y)=>{return PI($)(I,U,Y)},xx=eH(k6),$G=($)=>(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return TI($)(I,U,J)},kx=$G(k6),IG=($)=>(I,U,Y)=>{return TI($)(I,U,Y)},fx=IG(k6),UG=($)=>async(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return BI($)(I,U,J)},ix=UG(k6),YG=($)=>async(I,U,Y)=>{return BI($)(I,U,Y)},bx=YG(k6);var I$={};s8(I$,{xid:()=>wO,uuid7:()=>pL0,uuid6:()=>nL0,uuid4:()=>bL0,uuid:()=>C7,uppercase:()=>uO,unicodeEmail:()=>nx,undefined:()=>yO,ulid:()=>WO,time:()=>vO,string:()=>CO,sha512_hex:()=>WD0,sha512_base64url:()=>VD0,sha512_base64:()=>wD0,sha384_hex:()=>qD0,sha384_base64url:()=>GD0,sha384_base64:()=>HD0,sha256_hex:()=>JD0,sha256_base64url:()=>KD0,sha256_base64:()=>QD0,sha1_hex:()=>ID0,sha1_base64url:()=>YD0,sha1_base64:()=>UD0,rfc5322Email:()=>dL0,number:()=>sJ,null:()=>SO,nanoid:()=>ZO,md5_hex:()=>sL0,md5_base64url:()=>$D0,md5_base64:()=>eL0,mac:()=>NO,lowercase:()=>hO,ksuid:()=>VO,ipv6:()=>FO,ipv4:()=>OO,integer:()=>_O,idnEmail:()=>mL0,httpProtocol:()=>TO,html5Email:()=>cL0,hostname:()=>rL0,hex:()=>aL0,guid:()=>XO,extendedDuration:()=>iL0,emoji:()=>DO,email:()=>LO,e164:()=>EO,duration:()=>zO,domain:()=>tL0,datetime:()=>RO,date:()=>BO,cuid2:()=>GO,cuid:()=>HO,cidrv6:()=>AO,cidrv4:()=>MO,browserEmail:()=>lL0,boolean:()=>gO,bigint:()=>jO,base64url:()=>JG,base64:()=>PO});var HO=/^[cC][0-9a-z]{6,}$/,GO=/^[0-9a-z]+$/,WO=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,wO=/^[0-9a-vA-V]{20}$/,VO=/^[A-Za-z0-9]{27}$/,ZO=/^[a-zA-Z0-9_-]{21}$/,zO=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,iL0=/^[-+]?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)?)??$/,XO=/^([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})$/,C7=($)=>{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})$`)},bL0=C7(4),nL0=C7(6),pL0=C7(7),LO=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,cL0=/^[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])?)*$/,dL0=/^(([^<>()\[\]\\.,;:\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,}))$/,nx=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,mL0=nx,lL0=/^[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])?)*$/,oL0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function DO(){return new RegExp(oL0,"u")}var OO=/^(?:(?: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])$/,FO=/^(([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}|:))$/,NO=($)=>{let I=O$($??":");return new RegExp(`^(?:[0-9A-F]{2}${I}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${I}){5}[0-9a-f]{2}$`)},MO=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0Line 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{|}‾��������������������������������������������������������������������������������������������������������������������������������`},hproman8:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¾—¼½ªº«■»±�"},macintosh:{type:"_sbcs",chars:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"},ascii:{type:"_sbcs",chars:"��������������������������������������������������������������������������������������������������������������������������������"},tis620:{type:"_sbcs",chars:"���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"}}});var rV0=F((dq1)=>{var Hu=c5().Buffer;dq1._dbcs=m5;var w6=-1,oV0=-2,p$=-10,x6=-1000,jJ=Array(256),wH=-1;for(WH=0;WH<256;WH++)jJ[WH]=w6;var WH;function m5($,I){if(this.encodingName=$.encodingName,!$)throw Error("DBCS codec is called without the data.");if(!$.table)throw Error("Encoding '"+this.encodingName+"' has no data.");var U=$.table();this.decodeTables=[],this.decodeTables[0]=jJ.slice(0),this.decodeTableSeq=[];for(var Y=0;Y<U.length;Y++)this._addDecodeChunk(U[Y]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var J=this.decodeTables.length;this.decodeTables.push(jJ.slice(0));var Q=this.decodeTables.length;this.decodeTables.push(jJ.slice(0));var K=this.decodeTables[0];for(var Y=129;Y<=254;Y++){var q=this.decodeTables[x6-K[Y]];for(var H=48;H<=57;H++){if(q[H]===w6)q[H]=x6-J;else if(q[H]>x6)throw Error("gb18030 decode tables conflict at byte 2");var G=this.decodeTables[x6-q[H]];for(var W=129;W<=254;W++){if(G[W]===w6)G[W]=x6-Q;else if(G[W]===x6-Q)continue;else if(G[W]>x6)throw Error("gb18030 decode tables conflict at byte 3");var w=this.decodeTables[x6-G[W]];for(var V=48;V<=57;V++)if(w[V]===w6)w[V]=oV0}}}}this.defaultCharUnicode=I.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var Z={};if($.encodeSkipVals)for(var Y=0;Y<$.encodeSkipVals.length;Y++){var X=$.encodeSkipVals[Y];if(typeof X==="number")Z[X]=!0;else for(var H=X.from;H<=X.to;H++)Z[H]=!0}if(this._fillEncodeTable(0,0,Z),$.encodeAdd){for(var L in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,L))this._setEncodeChar(L.charCodeAt(0),$.encodeAdd[L])}if(this.defCharSB=this.encodeTable[0][I.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===w6)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===w6)this.defCharSB=63}m5.prototype.encoder=ZD;m5.prototype.decoder=Gu;m5.prototype._getDecodeTrieNode=function($){var I=[];for(;$>0;$>>>=8)I.push($&255);if(I.length==0)I.push(0);var U=this.decodeTables[0];for(var Y=I.length-1;Y>0;Y--){var J=U[I[Y]];if(J==w6)U[I[Y]]=x6-this.decodeTables.length,this.decodeTables.push(U=jJ.slice(0));else if(J<=x6)U=this.decodeTables[x6-J];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};m5.prototype._addDecodeChunk=function($){var I=parseInt($[0],16),U=this._getDecodeTrieNode(I);I=I&255;for(var Y=1;Y<$.length;Y++){var J=$[Y];if(typeof J==="string")for(var Q=0;Q<J.length;){var K=J.charCodeAt(Q++);if(K>=55296&&K<56320){var q=J.charCodeAt(Q++);if(q>=56320&&q<57344)U[I++]=65536+(K-55296)*1024+(q-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(K>4080&&K<=4095){var H=4095-K+2,G=[];for(var W=0;W<H;W++)G.push(J.charCodeAt(Q++));U[I++]=p$-this.decodeTableSeq.length,this.decodeTableSeq.push(G)}else U[I++]=K}else if(typeof J==="number"){var w=U[I-1]+1;for(var Q=0;Q<J;Q++)U[I++]=w++}else throw Error("Incorrect type '"+typeof J+"' given in "+this.encodingName+" at chunk "+$[0])}if(I>255)throw Error("Incorrect chunk in "+this.encoLine truncated
`)}var PI=($)=>(I,U,Y,J)=>{let Q=Y?{...Y,async:!1}:{async:!1},K=I._zod.run({value:U,issues:[]},Q);if(K instanceof Promise)throw new w8;if(K.issues.length){let q=new(J?.Err??$)(K.issues.map((H)=>E6(H,Q,z4())));throw aH(q,J?.callee),q}return K.value},tJ=PI(n6),TI=($)=>async(I,U,Y,J)=>{let Q=Y?{...Y,async:!0}:{async:!0},K=I._zod.run({value:U,issues:[]},Q);if(K instanceof Promise)K=await K;if(K.issues.length){let q=new(J?.Err??$)(K.issues.map((H)=>E6(H,Q,z4())));throw aH(q,J?.callee),q}return K.value},aJ=TI(n6),EI=($)=>(I,U,Y)=>{let J=Y?{...Y,async:!1}:{async:!1},Q=I._zod.run({value:U,issues:[]},J);if(Q instanceof Promise)throw new w8;return Q.issues.length?{success:!1,error:new($??lJ)(Q.issues.map((K)=>E6(K,J,z4())))}:{success:!0,data:Q.value}},BI=EI(n6),vI=($)=>async(I,U,Y)=>{let J=Y?{...Y,async:!0}:{async:!0},Q=I._zod.run({value:U,issues:[]},J);if(Q instanceof Promise)Q=await Q;return Q.issues.length?{success:!1,error:new $(Q.issues.map((K)=>E6(K,J,z4())))}:{success:!0,data:Q.value}},sJ=vI(n6),sH=($)=>(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return PI($)(I,U,J)},bx=sH(n6),eH=($)=>(I,U,Y)=>{return PI($)(I,U,Y)},ix=eH(n6),$G=($)=>async(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return TI($)(I,U,J)},nx=$G(n6),IG=($)=>async(I,U,Y)=>{return TI($)(I,U,Y)},px=IG(n6),UG=($)=>(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return EI($)(I,U,J)},cx=UG(n6),YG=($)=>(I,U,Y)=>{return EI($)(I,U,Y)},dx=YG(n6),JG=($)=>async(I,U,Y)=>{let J=Y?{...Y,direction:"backward"}:{direction:"backward"};return vI($)(I,U,J)},mx=JG(n6),QG=($)=>async(I,U,Y)=>{return vI($)(I,U,Y)},lx=QG(n6);var Q$={};$5(Q$,{xid:()=>DF,uuid7:()=>YD0,uuid6:()=>UD0,uuid4:()=>ID0,uuid:()=>C7,uppercase:()=>nF,unicodeEmail:()=>ox,undefined:()=>bF,ulid:()=>LF,time:()=>gF,string:()=>hF,sha512_hex:()=>TD0,sha512_base64url:()=>BD0,sha512_base64:()=>ED0,sha384_hex:()=>MD0,sha384_base64url:()=>PD0,sha384_base64:()=>AD0,sha256_hex:()=>FD0,sha256_base64url:()=>ND0,sha256_base64:()=>OD0,sha1_hex:()=>XD0,sha1_base64url:()=>DD0,sha1_base64:()=>LD0,rfc5322Email:()=>QD0,number:()=>eJ,null:()=>fF,nanoid:()=>OF,md5_hex:()=>VD0,md5_base64url:()=>zD0,md5_base64:()=>ZD0,mac:()=>BF,lowercase:()=>iF,ksuid:()=>FF,ipv6:()=>EF,ipv4:()=>TF,integer:()=>xF,idnEmail:()=>KD0,httpProtocol:()=>CF,html5Email:()=>JD0,hostname:()=>GD0,hex:()=>wD0,guid:()=>MF,extendedDuration:()=>$D0,emoji:()=>PF,email:()=>AF,e164:()=>_F,duration:()=>NF,domain:()=>WD0,datetime:()=>yF,date:()=>SF,cuid2:()=>XF,cuid:()=>zF,cidrv6:()=>RF,cidrv4:()=>vF,browserEmail:()=>qD0,boolean:()=>kF,bigint:()=>uF,base64url:()=>KG,base64:()=>jF});var zF=/^[cC][0-9a-z]{6,}$/,XF=/^[0-9a-z]+$/,LF=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,DF=/^[0-9a-vA-V]{20}$/,FF=/^[A-Za-z0-9]{27}$/,OF=/^[a-zA-Z0-9_-]{21}$/,NF=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,$D0=/^[-+]?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)?)??$/,MF=/^([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})$/,C7=($)=>{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})$`)},ID0=C7(4),UD0=C7(6),YD0=C7(7),AF=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,JD0=/^[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])?)*$/,QD0=/^(([^<>()\[\]\\.,;:\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,}))$/,ox=/^[^\s@"]{1,64}@[^\s@]{1,255}$/u,KD0=ox,qD0=/^[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])?)*$/,HD0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function PF(){return new RegExp(HD0,"u")}var TF=/^(?:(?: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])$/,EF=/^(([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}|:))$/,BF=($)=>{let I=A$($??":");return new RegExp(`^(?:[0-9A-F]{2}${I}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${I}){5}[0-9a-f]{2}$`)},vF=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0Line truncated
`).filter((Q)=>Q),Y=Math.min(...U.map((Q)=>Q.length-Q.trimStart().length)),J=U.map((Q)=>Q.slice(Y)).map((Q)=>" ".repeat(this.indent*2)+Q);for(let Q of J)this.content.push(Q)}compile(){let $=Function,I=this?.args,Y=[...(this?.content??[""]).map((J)=>` ${J}`)];return new $(...I,Y.join(`
`))}}var IF={major:4,minor:4,patch:3};var b0=o("$ZodType",($,I)=>{var U;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=IF;let Y=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))Y.unshift($);for(let J of Y)for(let Q of J._zod.onattach)Q($);if(Y.length===0)(U=$._zod).deferred??(U.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let J=(K,q,H)=>{let G=I9(K),W;for(let w of q){if(w._zod.def.when){if(QO(K))continue;if(!w._zod.def.when(K))continue}else if(G)continue;let V=K.issues.length,Z=w._zod.check(K);if(Z instanceof Promise&&H?.async===!1)throw new H8;if(W||Z instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await Z,K.issues.length===V)return;if(!G)G=I9(K,V)});else{if(K.issues.length===V)continue;if(!G)G=I9(K,V)}}if(W)return W.then(()=>{return K});return K},Q=(K,q,H)=>{if(I9(K))return K.aborted=!0,K;let G=J(q,Y,H);if(G instanceof Promise){if(H.async===!1)throw new H8;return G.then((W)=>$._zod.parse(W,H))}return $._zod.parse(G,H)};$._zod.run=(K,q)=>{if(q.skipChecks)return $._zod.parse(K,q);if(q.direction==="backward"){let G=$._zod.parse({value:K.value,issues:[]},{...q,skipChecks:!0});if(G instanceof Promise)return G.then((W)=>{return Q(W,K,q)});return Q(G,K,q)}let H=$._zod.parse(K,q);if(H instanceof Promise){if(q.async===!1)throw new H8;return H.then((G)=>J(G,Y,q))}return J(H,Y,q)}}e0($,"~standard",()=>({validate:(J)=>{try{let Q=EI($,J);return Q.success?{value:Q.data}:{issues:Q.error?.issues}}catch(Q){return aJ($,J).then((K)=>K.success?{value:K.data}:{issues:K.error?.issues})}},vendor:"zod",version:1}))}),j7=o("$ZodString",($,I)=>{b0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??CO($._zod.bag),$._zod.parse=(U,Y)=>{if(I.coerce)try{U.value=String(U.value)}catch(J){}if(typeof U.value==="string")return U;return U.issues.push({expected:"string",code:"invalid_type",input:U.value,inst:$}),U}}),S1=o("$ZodStringFormat",($,I)=>{vI.init($,I),j7.init($,I)}),YF=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=XO),S1.init($,I)}),JF=o("$ZodUUID",($,I)=>{if(I.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(Y===void 0)throw Error(`Invalid UUID version: "${I.version}"`);I.pattern??(I.pattern=C7(Y))}else I.pattern??(I.pattern=C7());S1.init($,I)}),QF=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=LO),S1.init($,I)}),KF=o("$ZodURL",($,I)=>{S1.init($,I),$._zod.check=(U)=>{try{let Y=U.value.trim();if(!I.normalize&&I.protocol?.source===TO.source){if(!/^https?:\/\//i.test(Y)){U.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:U.value,inst:$,continue:!I.abort});return}}let J=new URL(Y);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(J.hostname))U.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:U.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol))U.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:U.value,inst:$,continue:!I.abort})}if(I.normalize)U.value=J.href;else U.value=Y;return}catch(Y){U.issues.push({code:"invalid_format",format:"url",input:U.value,inst:$,continue:!I.abort})}}}),qF=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=DO()),S1.init($,I)}),HF=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=ZO),S1.init($,I)}),GF=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=HO),S1.init($,I)}),WF=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=GO),S1.init($,I)}),wF=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=WO),S1.init($,I)}),VF=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=wO),S1.init($,I)}),ZF=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=VO),S1.init($,I)}),zF=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=RO(I)),S1.init($,I)}),XF=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=BO),S1.init($,I)}),LF=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=vO(I)),S1.init($,I)}),DF=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=zO),S1.init($,I)}),OF=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=OO),S1.init($,I),$._zod.bag.format="ipv4"}),FF=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=FO),S1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(U)=>{try{new URL(`http://[${U.value}]`)}catch{U.issues.push({code:"invalid_format",format:"ipv6",input:U.value,inst:$,continue:!I.abort})}}}),NF=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=NO(I.delimiter)),S1.init($,I),$._zod.bag.format="mac"}),MF=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=MO),S1.init($,I)}),AF=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=AO),S1.init($,I),$._zod.check=(U)=>{let Y=U.value.split("/");try{if(Y.length!==2)throw Error();let[J,Q]=Y;if(!Q)throw Error();let K=Number(Q);if(`${K}`!==Q)throw Error();if(K<0||K>128)throw Error();new URL(`http://[${J}]`)}catch{U.issues.push({code:"invalid_format",format:"cidrv6",input:U.value,inst:$,continue:!I.abort})}}});function PF($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}} Line truncated
`))}}var qO={major:4,minor:4,patch:3};var n0=o("$ZodType",($,I)=>{var U;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=qO;let Y=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))Y.unshift($);for(let J of Y)for(let Q of J._zod.onattach)Q($);if(Y.length===0)(U=$._zod).deferred??(U.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let J=(K,q,H)=>{let G=I9(K),W;for(let w of q){if(w._zod.def.when){if(wF(K))continue;if(!w._zod.def.when(K))continue}else if(G)continue;let V=K.issues.length,Z=w._zod.check(K);if(Z instanceof Promise&&H?.async===!1)throw new w8;if(W||Z instanceof Promise)W=(W??Promise.resolve()).then(async()=>{if(await Z,K.issues.length===V)return;if(!G)G=I9(K,V)});else{if(K.issues.length===V)continue;if(!G)G=I9(K,V)}}if(W)return W.then(()=>{return K});return K},Q=(K,q,H)=>{if(I9(K))return K.aborted=!0,K;let G=J(q,Y,H);if(G instanceof Promise){if(H.async===!1)throw new w8;return G.then((W)=>$._zod.parse(W,H))}return $._zod.parse(G,H)};$._zod.run=(K,q)=>{if(q.skipChecks)return $._zod.parse(K,q);if(q.direction==="backward"){let G=$._zod.parse({value:K.value,issues:[]},{...q,skipChecks:!0});if(G instanceof Promise)return G.then((W)=>{return Q(W,K,q)});return Q(G,K,q)}let H=$._zod.parse(K,q);if(H instanceof Promise){if(q.async===!1)throw new w8;return H.then((G)=>J(G,Y,q))}return J(H,Y,q)}}e0($,"~standard",()=>({validate:(J)=>{try{let Q=BI($,J);return Q.success?{value:Q.data}:{issues:Q.error?.issues}}catch(Q){return sJ($,J).then((K)=>K.success?{value:K.data}:{issues:K.error?.issues})}},vendor:"zod",version:1}))}),_7=o("$ZodString",($,I)=>{n0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??hF($._zod.bag),$._zod.parse=(U,Y)=>{if(I.coerce)try{U.value=String(U.value)}catch(J){}if(typeof U.value==="string")return U;return U.issues.push({expected:"string",code:"invalid_type",input:U.value,inst:$}),U}}),h1=o("$ZodStringFormat",($,I)=>{RI.init($,I),_7.init($,I)}),GO=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=MF),h1.init($,I)}),WO=o("$ZodUUID",($,I)=>{if(I.version){let Y={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(Y===void 0)throw Error(`Invalid UUID version: "${I.version}"`);I.pattern??(I.pattern=C7(Y))}else I.pattern??(I.pattern=C7());h1.init($,I)}),wO=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=AF),h1.init($,I)}),VO=o("$ZodURL",($,I)=>{h1.init($,I),$._zod.check=(U)=>{try{let Y=U.value.trim();if(!I.normalize&&I.protocol?.source===CF.source){if(!/^https?:\/\//i.test(Y)){U.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:U.value,inst:$,continue:!I.abort});return}}let J=new URL(Y);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(J.hostname))U.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:U.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(J.protocol.endsWith(":")?J.protocol.slice(0,-1):J.protocol))U.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:U.value,inst:$,continue:!I.abort})}if(I.normalize)U.value=J.href;else U.value=Y;return}catch(Y){U.issues.push({code:"invalid_format",format:"url",input:U.value,inst:$,continue:!I.abort})}}}),ZO=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=PF()),h1.init($,I)}),zO=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=OF),h1.init($,I)}),XO=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=zF),h1.init($,I)}),LO=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=XF),h1.init($,I)}),DO=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=LF),h1.init($,I)}),FO=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=DF),h1.init($,I)}),OO=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=FF),h1.init($,I)}),NO=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=yF(I)),h1.init($,I)}),MO=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=SF),h1.init($,I)}),AO=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=gF(I)),h1.init($,I)}),PO=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=NF),h1.init($,I)}),TO=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=TF),h1.init($,I),$._zod.bag.format="ipv4"}),EO=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=EF),h1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(U)=>{try{new URL(`http://[${U.value}]`)}catch{U.issues.push({code:"invalid_format",format:"ipv6",input:U.value,inst:$,continue:!I.abort})}}}),BO=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=BF(I.delimiter)),h1.init($,I),$._zod.bag.format="mac"}),vO=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=vF),h1.init($,I)}),RO=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=RF),h1.init($,I),$._zod.check=(U)=>{let Y=U.value.split("/");try{if(Y.length!==2)throw Error();let[J,Q]=Y;if(!Q)throw Error();let K=Number(Q);if(`${K}`!==Q)throw Error();if(K<0||K>128)throw Error();new URL(`http://[${J}]`)}catch{U.issues.push({code:"invalid_format",format:"cidrv6",input:U.value,inst:$,continue:!I.abort})}}});function jO($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}} Line truncated
if (${A}.issues.length) {
if (${R} in input) {
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
@@ -262,7 +262,7 @@ Unsupported type: `+$.type,"ENOTSUP");$._finish()})};y$.prototype._stat=function
newResult[${R}] = ${A}.value;
}
`);else if(!S)Z.write(`
`);else if(!g)Z.write(`
const ${A}_present = ${R} in input;
if (${A}.issues.length) {
payload.issues = payload.issues.concat(${A}.issues.map(iss => ({
@@ -303,153 +303,33 @@ Unsupported type: `+$.type,"ENOTSUP");$._finish()})};y$.prototype._stat=function
newResult[${R}] = ${A}.value;
}
`)}Z.write("payload.value = newResult;"),Z.write("return payload;");let E=Z.compile();return(T,A)=>E(V,T,A)},Q,K=R7,q=!B7.jitless,G=q&&eD.value,W=I.catchall,w;$._zod.parse=(V,Z)=>{w??(w=Y.value);let X=V.value;if(!K(X))return V.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),V;if(q&&G&&Z?.async===!1&&Z.jitless!==!0){if(!Q)Q=J(I.shape);if(V=Q(V,Z),!W)return V;return wk([],X,V,Z,w,$)}return U(V,Z)}});function rx($,I,U,Y){for(let Q of $)if(Q.issues.length===0)return I.value=Q.value,I;let J=$.filter((Q)=>!I9(Q));if(J.length===1)return I.value=J[0].value,J[0];return I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>P6(K,Y,Z4())))}),I}var UQ=o("$ZodUnion",($,I)=>{b0.init($,I),e0($._zod,"optin",()=>I.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),e0($._zod,"optout",()=>I.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),e0($._zod,"values",()=>{if(I.options.every((Y)=>Y._zod.values))return new Set(I.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),e0($._zod,"pattern",()=>{if(I.options.every((Y)=>Y._zod.pattern)){let Y=I.options.map((J)=>J._zod.pattern);return new RegExp(`^(${Y.map((J)=>nJ(J.source)).join("|")})$`)}return});let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let H=q._zod.run({value:Y.value,issues:[]},J);if(H instanceof Promise)K.push(H),Q=!0;else{if(H.issues.length===0)return H;K.push(H)}}if(!Q)return rx(K,Y,$,J);return Promise.all(K).then((q)=>{return rx(q,Y,$,J)})}});function tx($,I,U,Y){let J=$.filter((Q)=>Q.issues.length===0);if(J.length===1)return I.value=J[0].value,I;if(J.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>P6(K,Y,Z4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:[],inclusive:!1});return I}var bF=o("$ZodXor",($,I)=>{UQ.init($,I),I.inclusive=!1;let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let H=q._zod.run({value:Y.value,issues:[]},J);if(H instanceof Promise)K.push(H),Q=!0;else K.push(H)}if(!Q)return tx(K,Y,$,J);return Promise.all(K).then((q)=>{return tx(q,Y,$,J)})}}),nF=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,UQ.init($,I);let U=$._zod.parse;e0($._zod,"propValues",()=>{let J={};for(let Q of I.options){let K=Q._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invalid discriminated union option at index "${I.options.indexOf(Q)}"`);for(let[q,H]of Object.entries(K)){if(!J[q])J[q]=new Set;for(let G of H)J[q].add(G)}}return J});let Y=NI(()=>{let J=I.options,Q=new Map;for(let K of J){let q=K._zod.propValues?.[I.discriminator];if(!q||q.size===0)throw Error(`Invalid discriminated union option at index "${I.options.indexOf(K)}"`);for(let H of q){if(Q.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);Q.set(H,K)}}return Q});$._zod.parse=(J,Q)=>{let K=J.value;if(!R7(K))return J.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),J;let q=Y.value.get(K?.[I.discriminator]);if(q)return q._zod.run(J,Q);if(I.unionFallback||Q.direction==="backward")return U(J,Q);return J.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(Y.value.keys()),input:K,path:[I.discriminator],inst:$}),J}}),pF=o("$ZodIntersection",($,I)=>{b0.init($,I),$._zod.parse=(U,Y)=>{let J=U.value,Q=I.left._zod.run({value:J,issues:[]},Y),K=I.right._zod.run({value:J,issues:[]},Y);if(Q instanceof Promise||K instanceof Promise)return Promise.all([Q,K]).then(([H,G])=>{return ax(U,H,G)});return ax(U,Q,K)}});function UF($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if($9($)&&$9(I)){let U=Object.keys(I),Y=Object.keys($).filter((Q)=>U.indexOf(Q)!==-1),J={...$,...I};for(let Q of Y){let K=UF($[Q],I[Q]);if(!K.valid)return{valid:!1,mergeErrorPath:[Q,...K.mergeErrorPath]};J[Q]=K.data}return{valid:!0,data:J}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let Y=0;Y<$.length;Y++){let J=$[Y],Q=I[Y],K=UF(J,Q);if(!K.valid)return{valid:!1,mergeErrorPath:[Y,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function ax($,I,U){let Y=new Map,J;for(let q of I.issues)if(q.code==="unrecognized_keys"){J??(J=q);for(let H of q.keys){if(!Y.has(H))Y.set(H,{});Y.get(H).l=!0}}else $.issues.push(q);for(let q of U.issues)if(q.code==="unrecognized_keys")for(let H of q.keys){if(!Y.has(H))Y.set(H,{});Y.get(H).r=!0}else $.issues.push(q);let Q=[...Y].filter(([,q])=>q.l&&q.r).map(([q])=>q);if(Q.length&&J)$.issues.push({...J,keys:Q});if(I9($))return $;let K=UF(I.value,U.value);if(!K.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}var zG=o("$ZodTuple",($,I)=>{b0. Line truncated
`)}Z.write("payload.value = newResult;"),Z.write("return payload;");let E=Z.compile();return(T,A)=>E(V,T,A)},Q,K=j7,q=!v7.jitless,G=q&&QF.value,W=I.catchall,w;$._zod.parse=(V,Z)=>{w??(w=Y.value);let X=V.value;if(!K(X))return V.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),V;if(q&&G&&Z?.async===!1&&Z.jitless!==!0){if(!Q)Q=J(I.shape);if(V=Q(V,Z),!W)return V;return Dk([],X,V,Z,w,$)}return U(V,Z)}});function Ik($,I,U,Y){for(let Q of $)if(Q.issues.length===0)return I.value=Q.value,I;let J=$.filter((Q)=>!I9(Q));if(J.length===1)return I.value=J[0].value,J[0];return I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>E6(K,Y,z4())))}),I}var YQ=o("$ZodUnion",($,I)=>{n0.init($,I),e0($._zod,"optin",()=>I.options.some((Y)=>Y._zod.optin==="optional")?"optional":void 0),e0($._zod,"optout",()=>I.options.some((Y)=>Y._zod.optout==="optional")?"optional":void 0),e0($._zod,"values",()=>{if(I.options.every((Y)=>Y._zod.values))return new Set(I.options.flatMap((Y)=>Array.from(Y._zod.values)));return}),e0($._zod,"pattern",()=>{if(I.options.every((Y)=>Y._zod.pattern)){let Y=I.options.map((J)=>J._zod.pattern);return new RegExp(`^(${Y.map((J)=>pJ(J.source)).join("|")})$`)}return});let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let H=q._zod.run({value:Y.value,issues:[]},J);if(H instanceof Promise)K.push(H),Q=!0;else{if(H.issues.length===0)return H;K.push(H)}}if(!Q)return Ik(K,Y,$,J);return Promise.all(K).then((q)=>{return Ik(q,Y,$,J)})}});function Uk($,I,U,Y){let J=$.filter((Q)=>Q.issues.length===0);if(J.length===1)return I.value=J[0].value,I;if(J.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:$.map((Q)=>Q.issues.map((K)=>E6(K,Y,z4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:U,errors:[],inclusive:!1});return I}var lO=o("$ZodXor",($,I)=>{YQ.init($,I),I.inclusive=!1;let U=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(Y,J)=>{if(U)return U(Y,J);let Q=!1,K=[];for(let q of I.options){let H=q._zod.run({value:Y.value,issues:[]},J);if(H instanceof Promise)K.push(H),Q=!0;else K.push(H)}if(!Q)return Uk(K,Y,$,J);return Promise.all(K).then((q)=>{return Uk(q,Y,$,J)})}}),oO=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,YQ.init($,I);let U=$._zod.parse;e0($._zod,"propValues",()=>{let J={};for(let Q of I.options){let K=Q._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invalid discriminated union option at index "${I.options.indexOf(Q)}"`);for(let[q,H]of Object.entries(K)){if(!J[q])J[q]=new Set;for(let G of H)J[q].add(G)}}return J});let Y=MI(()=>{let J=I.options,Q=new Map;for(let K of J){let q=K._zod.propValues?.[I.discriminator];if(!q||q.size===0)throw Error(`Invalid discriminated union option at index "${I.options.indexOf(K)}"`);for(let H of q){if(Q.has(H))throw Error(`Duplicate discriminator value "${String(H)}"`);Q.set(H,K)}}return Q});$._zod.parse=(J,Q)=>{let K=J.value;if(!j7(K))return J.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),J;let q=Y.value.get(K?.[I.discriminator]);if(q)return q._zod.run(J,Q);if(I.unionFallback||Q.direction==="backward")return U(J,Q);return J.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(Y.value.keys()),input:K,path:[I.discriminator],inst:$}),J}}),rO=o("$ZodIntersection",($,I)=>{n0.init($,I),$._zod.parse=(U,Y)=>{let J=U.value,Q=I.left._zod.run({value:J,issues:[]},Y),K=I.right._zod.run({value:J,issues:[]},Y);if(Q instanceof Promise||K instanceof Promise)return Promise.all([Q,K]).then(([H,G])=>{return Yk(U,H,G)});return Yk(U,Q,K)}});function HO($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if($9($)&&$9(I)){let U=Object.keys(I),Y=Object.keys($).filter((Q)=>U.indexOf(Q)!==-1),J={...$,...I};for(let Q of Y){let K=HO($[Q],I[Q]);if(!K.valid)return{valid:!1,mergeErrorPath:[Q,...K.mergeErrorPath]};J[Q]=K.data}return{valid:!0,data:J}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let Y=0;Y<$.length;Y++){let J=$[Y],Q=I[Y],K=HO(J,Q);if(!K.valid)return{valid:!1,mergeErrorPath:[Y,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Yk($,I,U){let Y=new Map,J;for(let q of I.issues)if(q.code==="unrecognized_keys"){J??(J=q);for(let H of q.keys){if(!Y.has(H))Y.set(H,{});Y.get(H).l=!0}}else $.issues.push(q);for(let q of U.issues)if(q.code==="unrecognized_keys")for(let H of q.keys){if(!Y.has(H))Y.set(H,{});Y.get(H).r=!0}else $.issues.push(q);let Q=[...Y].filter(([,q])=>q.l&&q.r).map(([q])=>q);if(Q.length&&J)$.issues.push({...J,keys:Q});if(I9($))return $;let K=HO(I.value,U.value);if(!K.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}var LG=o("$ZodTuple",($,I)=>{n0. Line truncated
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let K of $.seen.entries()){let q=K[1];if(I===K[0]){Q(K);continue}if($.external){let G=$.external.registry.get(K[0])?.id;if(I!==K[0]&&G){Q(K);continue}}if($.metadataRegistry.get(K[0])?.id){Q(K);continue}if(q.cycle){Q(K);continue}if(q.count>1){if($.reused==="ref"){Q(K);continue}}}}function K9($,I){let U=$.seen.get(I);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(q)=>{let H=$.seen.get(q);if(H.ref===null)return;let G=H.def??H.schema,W={...G},w=H.ref;if(H.ref=null,w){Y(w);let Z=$.seen.get(w),X=Z.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))G.allOf=G.allOf??[],G.allOf.push(X);else Object.assign(G,X);if(Object.assign(G,W),q._zod.parent===w)for(let D in G){if(D==="$ref"||D==="allOf")continue;if(!(D in W))delete G[D]}if(X.$ref&&Z.def)for(let D in G){if(D==="$ref"||D==="allOf")continue;if(D in Z.def&&JSON.stringify(G[D])===JSON.stringify(Z.def[D]))delete G[D]}}let V=q._zod.parent;if(V&&V!==w){Y(V);let Z=$.seen.get(V);if(Z?.schema.$ref){if(G.$ref=Z.schema.$ref,Z.def)for(let X in G){if(X==="$ref"||X==="allOf")continue;if(X in Z.def&&JSON.stringify(G[X])===JSON.stringify(Z.def[X]))delete G[X]}}}$.override({zodSchema:q,jsonSchema:G,path:H.path??[]})};for(let q of[...$.seen.entries()].reverse())Y(q[0]);let J={};if($.target==="draft-2020-12")J.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")J.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")J.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let q=$.external.registry.get(I)?.id;if(!q)throw Error("Schema is missing an `id` property");J.$id=$.external.uri(q)}Object.assign(J,U.def??U.schema);let Q=$.metadataRegistry.get(I)?.id;if(Q!==void 0&&J.id===Q)delete J.id;let K=$.external?.defs??{};for(let q of $.seen.entries()){let H=q[1];if(H.def&&H.defId){if(H.def.id===H.defId)delete H.def.id;K[H.defId]=H.def}}if($.external);else if(Object.keys(K).length>0)if($.target==="draft-2020-12")J.$defs=K;else J.definitions=K;try{let q=JSON.parse(JSON.stringify(J));return Object.defineProperty(q,"~standard",{value:{...I["~standard"],jsonSchema:{input:nI(I,"input",$.processors),output:nI(I,"output",$.processors)}},enumerable:!1,writable:!1}),q}catch(q){throw Error("Error converting schema to JSON.")}}function E6($,I){let U=I??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let Y=$._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return E6(Y.element,U);if(Y.type==="set")return E6(Y.valueType,U);if(Y.type==="lazy")return E6(Y.getter(),U);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return E6(Y.innerType,U);if(Y.type==="intersection")return E6(Y.left,U)||E6(Y.right,U);if(Y.type==="record"||Y.type==="map")return E6(Y.keyType,U)||E6(Y.valueType,U);if(Y.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return E6(Y.in,U)||E6(Y.out,U)}if(Y.type==="object"){for(let J in Y.shape)if(E6(Y.shape[J],U))return!0;return!1}if(Y.type==="union"){for(let J of Y.options)if(E6(J,U))return!0;return!1}if(Y.type==="tuple"){for(let J of Y.items)if(E6(J,U))return!0;if(Y.rest&&E6(Y.rest,U))return!0;return!1}return!1}var rM=($,I={})=>(U)=>{let Y=J9({...U,processors:I});return C1($,Y),Q9(Y,$),K9(Y,$)},nI=($,I,U={})=>(Y)=>{let{libraryOptions:J,target:Q}=Y??{},K=J9({...J??{},target:Q,io:I,processors:U});return C1($,K),Q9(K,$),K9(K,$)};var yO0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},tM=($,I,U,Y)=>{let J=U;J.type="string";let{minimum:Q,maximum:K,format:q,patterns:H,contentEncoding:G}=$._zod.bag;if(typeof Q==="number")J.minLength=Q;if(typeof K==="number")J.maxLength=K;if(q){if(J.format=yO0[q]??q,J.format==="")delete J.format;if(q==="time")delete J.format}if(G)J.contentEncoding=G;if(H&&H.size>0){let W=[...H];if(W.length===1)J.pattern=W[0].source;else if(W.length>1)J.allOf=[...W.map((w)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))]}},aM=($,I,U,Y)=>{let J=U,{minimum:Q,maximum:K,format:q,multipleOf:H,exclusiveMaximum:G,exclusiveMinimum:W}=$._zod.bag;if(typeof q==="string"&&q.includes("int"))J.type="integer";else J.type="number";let w=typeof W==="number"&&W>=(Q??Number.NEGATIVE_INFINITY),V=typeof G==="number"&&G<=(K??Number.POSITIVE_INFINITY),Z=I.target==="draft-04"||I.target==="openapi-3.0";if(w)if(Z)J.minimum=W,J.exclusiveMinimum=!0;else J.exclusiveMinimum=W;else if(typeof Q==="number")J.minimum=Q;if(V)if(Z)J.maximum=G,J.exclusiveMaximum=!0;else J.exclusiveMaximum=G;else if(typeof K==="number")J.maximum=K;if(typeof H==="number")J.multipleOf=H},sM=($,I,U,Y)=>{U.type="boolean"},eM=($,I,U,Y)=>{if(I.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},$A=($,I,U,Y)=>{if(I.unrepresentable==Line truncated
`);if($===-1)return null;let I=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),UC0(I)}clear(){this._buffer=void 0}}function UC0($){return pf.parse(JSON.parse($))}function ic($){return JSON.stringify($)+`
`}class ZE{constructor($=bc.stdin,I=bc.stdout){this._stdin=$,this._stdout=I,this._readBuffer=new VE,this._started=!1,this._ondata=(U)=>{this._readBuffer.append(U),this.processReadBuffer()},this._onerror=(U)=>{this.onerror?.(U)}}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((I)=>{let U=ic($);if(this._stdout.write(U))I();else this._stdout.once("drain",I)})}}import{dirname as cu,join as tG1}from"node:path";import{fileURLToPath as aG1}from"node:url";class q5 extends Error{name="KyError";get isKyError(){return!0}}class J$ extends q5{name="HTTPError";response;request;options;data;constructor($,I,U){let Y=$.status||$.status===0?$.status:"",J=$.statusText??"",Q=`${Y} ${J}`.trim(),K=Q?`status code ${Q}`:"an unknown error";super(`Request failed with ${K}: ${I.method} ${I.url}`);this.response=$,this.request=I,this.options=U}}class K2 extends q5{name="NetworkError";request;constructor($,I){super(`Request failed due to a network error: ${$.method} ${$.url}`,I);this.request=$}}class q2 extends Error{name="NonError";value;constructor($){let I="Non-error value was thrown";try{if(typeof $==="string")I=$;else if($&&typeof $==="object"&&"message"in $&&typeof $.message==="string")I=$.message}catch{}super(I);this.value=$}}class XU extends q5{name="ForceRetryError";customDelay;code;customRequest;constructor($){let I=$?.cause?$.cause instanceof Error?$.cause:new q2($.cause):void 0;super($?.code?`Forced retry: ${$.code}`:"Forced retry",I?{cause:I}:void 0);this.customDelay=$?.delay,this.code=$?.code,this.customRequest=$?.request}}class zE extends Error{name="SchemaValidationError";issues;constructor($){super("Response schema validation failed");this.issues=$}}class o$ extends q5{name="TimeoutError";request;constructor($){super(`Request timed out: ${$.method} ${$.url}`);this.request=$}}var XE=(()=>{let $=!1,I=!1,U=typeof globalThis.ReadableStream==="function",Y=typeof globalThis.Request==="function";if(U&&Y)try{I=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type")}catch(J){if(J instanceof Error&&J.message==="unsupported BodyInit type")return!1;throw J}return $&&!I})(),nc=typeof globalThis.AbortController==="function",Nw=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",pc=typeof globalThis.ReadableStream==="function",cc=typeof globalThis.FormData==="function",Mw=["get","post","put","patch","head","delete"],YC0=()=>{return};YC0();var dc={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},LU=2147483647,mc=40,Aw=Symbol("stop");class Pw{options;constructor($){this.options=$}}var lc=($)=>new Pw($),oc={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},rc={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 Tw=new TextEncoder,JC0=($)=>{if(!$)return 0;if($ instanceof FormData){let I=0;for(let[U,Y]of $)I+=mc,I+=Tw.encode(`Content-Disposition: form-data; name="${U}"`).byteLength,I+=typeof Y==="string"?Tw.encode(Y).byteLength:Y.size;return I}if($ instanceof Blob)return $.size;if($ instanceof ArrayBuffer||ArrayBuffer.isView($))return $.byteLength;if(typeof $==="string")return Tw.encode($).byteLength;if($ instanceof URLSearchParams)return Tw.encode($.toString()).byteLength;return 0},tc=($,I,U)=>{let Y,J=0;return $.pipeThrough(new TransformStream({transform(Q,K){if(K.enqueue(Q),Y){J+=Y.byteLength;let q=I===0?0:J/I;if(q>=1)q=1-Number.EPSILON;U?.({percent:q,totalBytes:Math.max(I,J),transferredBytes:J},Y)}Y=Q},flush(){if(Y)J+=Y.byteLength,U?.({percent:1,totalBytes:Math.max(I,J),transferredBytes:J},Y)}}))},ac=($,I)=>{if(!$.body)return $;let U={status:$.status,statusText:$.statusText,headers:$.headers};if($.status===204)return new Response(null,U);let Y=Math.max(0,Number($.headers.get("content-length"))||0);return new Response(tc($.body,Y,I),U)},sc=($,I,U)=>{if(!$.body)return $;let Y=JC0(U??$.body);return new Request($,{duplex:"half",body:tc($.body,Y,I)})};var X8=($)=>$!==null&&typeof $==="object";var QC0=Symbol("replaceOption"),LE=($)=>X8($)&&$[QC0]===!0?{isReplace:!0,value:$.value}:{isReplace:!1,value:$};var G2=(...$)=>{for(let I of $)if( Line truncated
`,{mode:384}),I}function r21($){let I=lw0();for(let U of I){if(!Z$(U))continue;for(let Y of pL(U).filter((J)=>J.endsWith(".json")).filter((J)=>!J.startsWith("example."))){let J=n8(U,Y);try{let Q=dL(J,"utf-8"),K=JSON.parse(Q);if(K&&typeof K==="object"&&K.id===$)return J}catch{}}}return}function O7($,I){let U=r21($);if(!U)throw Error(`Enterprise config not found: ${$}`);let J={...JSON.parse(dL(U,"utf-8")),...I};for(let K of Object.keys(I))if(I[K]===void 0)delete J[K];let Q=Gh.parse(J);return bw0(U,`${JSON.stringify(Q,null,2)}
`,"utf-8"),Q}function FJ($,I,U=[]){let Y=I.corpId?.trim()||void 0,J=I.stateful?I.defaultCorpId?.trim()||void 0:void 0,Q=Y??J;if(Q){let q=$.find((H)=>H.id===Q);if(q)return q;throw Error(`No enterprise config found for ${Q}`)}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 K=$[0];if(K)return K;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{readFileSync as zH1}from"node:fs";import{randomBytes as XH1}from"node:crypto";var tw0=300000,ow0=new Map;function t21($,I){return $.map((U)=>U.trim()).filter(Boolean).map((U)=>I?U:U.toLowerCase())}function a21($,I){return I?$:$.toLowerCase()}function s21($,I,U,Y){let J=a21($,Y),Q=I.filter((K)=>J.includes(K));if(U==="all"&&Q.length!==I.length)return[];return Q}function e21($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function $K1($,I){if(I.fields&&!I.fields.has($.field))return[];let U=e21($.value),Y=[];return U.forEach((J,Q)=>{let K=s21(J,I.keywords,I.matchMode,I.caseSensitive);if(K.length===0)return;let q=Math.max(0,Q-I.contextLines),H=Math.min(U.length,Q+I.contextLines+1),G={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:Q+1,matchedKeywords:K,matchedText:lL(J,I.maxChars),context:{before:I.snippetOnly?[]:U.slice(q,Q).map((W)=>lL(W,I.maxChars)),line:lL(J,I.maxChars),after:I.snippetOnly?[]:U.slice(Q+1,H).map((W)=>lL(W,I.maxChars))},metadata:$.metadata};if(I.snippetOnly)G.context={before:[],line:G.context.line,after:[]};Y.push(G)}),Y}function lL($,I){if(!I||$.length<=I)return $;return`${$.slice(0,Math.max(0,I))}...`}function IK1($){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 rw0($){return $.rules.flatMap((I,U)=>{let Y=`${$.id}:${I.description.slice(0,32)}`,J={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:I.scope,strictness:I.strictness,code:"code"in I?I.code:void 0,index:U};return[{area:"rules",entityType:"rule",entityId:Y,title:`${$.versionName} / ${I.scope}`,field:"history.description",value:I.description,metadata:J},{area:"rules",entityType:"rule",entityId:Y,title:`${$.versionName} / ${I.scope}`,field:"history.scope",value:I.scope,metadata:J}]})}function UK1($){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 YK1($){let I=[];if($.decisionPreferences)for(let[U,Y]of Object.entries($.decisionPreferences))I.push({area:"preferences",entityType:"preference",field:`decisionPreferences.${U}`,value:Y,metadata:{integrationSystem:$.integrationSystem}});return $.integrations.forEach((U,Y)=>{I.push({area:"preferences",entityType:"integration",title:U.outboundName,field:`integrations[${Y}]`,value:U,metadata:{type:U.type,outboundName:U.outboundName,mode:U.mode,corporationId:U.corporationId}})}),I}async function JK1($,I,U){let Y=U.ruleVersionScope??"current",J=[I.id,`ruleVersionScope=${Y}`,`ruleVersionId=${U.ruleVersionId??""}`,`ruleVersionNumber=${U.ruleVersionNumber??""}`,`latestRuleVersion=${U.latestRuleVersion??!1}`,`documentLimit=${U.documentLimit??100}`].join("|"),Q=ow0.get(J);if(!U.refresh&&Q&&Date.now()<Q.expiresAt)return Q;let[K,q,H]=await Promise.all([QK1($,{scope:Y,versionId:U.ruleVersionId,versionNumber:U.ruleVersionNumber,latest:U.latestRuleVersion}),A2($,{limit:U.documentLimit??100}),g1($,I.seal.endpoints.approvalStylePreferences)]),G=Date.now(),W={entries:[...K,...q.articles.flatMap(UK1),...YK1(H)],fetchedAt:G,expiresAt:G+tw0};return ow0.set(J,W),W}async function QK1($,I){if(I.scope==="current")return(await C6($)).rules.flatMap(IK1);if(I.scope==="version"){let Y=await KK1($,I);return rw0(Y)}return(await G5($)).flatMap(rw0)}async function KK1($,I){if(I.versionId)return N2($,I.versionId);let U=await G5($),Y=I.versionNumber?U.find((J)=>J.versionNumber===I.versionNumber):U[0];if(!Y)throw Error(I.versionNumber?`Rule version not found: ${I.versionNumber}`:"No rule versions found");return Y}async function aw0($,I,U){let Y=U.matchMode??"any",J=U.caseSensitive??!1,Q=U.contextLines??3,K=new Set(U.areas??["rules","documents","preferences"]),q=U Line truncated
`,"utf8"),U}function YV0($){return $.map((I,U)=>{let Y;if(typeof I.code==="number")Y=`#${String(I.code).padStart(4,"0")}`;else if(typeof I.code==="string")Y=I.code.startsWith("#")?I.code:`#${I.code}`;else Y=`#${String(U+1).padStart(4,"0")}`;return{id:I.id,code:Y,name:I.name,description:I.description,scope:I.scope,strictness:I.strictness}})}class h$ extends Error{errors;warnings;constructor($,I=[]){super([`材料包校验失败:${$.length} 个错误`,...$.map((U)=>`- ${U}`)].join(`
`));this.errors=$;this.warnings=I;this.name="MaterialPackValidationError"}}import{createHmac as AK1,randomBytes as PK1}from"node:crypto";function TK1($,I,U,Y){return AK1("sha256",Y).update(`${$}.${I}.${JSON.stringify(U)}`).digest("hex")}function Oh($,I){let U=Math.floor(Date.now()/1000),Y=PK1(16).toString("hex");return{Authorization:`Bearer ${I}`,"x-webhook-signature":TK1(U,Y,$,I),"x-webhook-timestamp":String(U),"x-webhook-nonce":Y}}var Hu=OI(PV0(),1),VZ0=OI(wZ0(),1);var VD={maxEntries:1000,maxTotalSize:524288000,maxCompressionRatio:150};async function ZZ0($){return new Promise((I,U)=>{Hu.default.fromBuffer(Buffer.from($),{lazyEntries:!0,autoClose:!0,decodeStrings:!1},(Y,J)=>{if(Y||!J)return U(Y??Error("无法打开 ZIP"));let Q=[];J.readEntry(),J.on("entry",(K)=>{let q=zZ0(K);if(!q.endsWith("/")&&!eq1(q))Q.push({fileName:q,uncompressedSize:K.uncompressedSize,compressedSize:K.compressedSize,raw:K});J.readEntry()}),J.on("end",()=>I(Q)),J.on("error",U)})})}function zZ0($){let I=Buffer.isBuffer($.fileName)?$.fileName:Buffer.from(String($.fileName),"binary"),U=I.toString("utf8");if(!U.includes("�"))return U;let Y=VZ0.default.decode(I,"gbk");if(!Y.includes("�"))return Y;return U}function eq1($){let I=$.split("/").pop()??"";return $.split("/").includes("__MACOSX")||I===".DS_Store"||I.startsWith("._")||I.startsWith(".~")||I.startsWith("~$")}function XZ0($,I){let U=[],Y=MU(I);if($.length>VD.maxEntries)U.push(`文件数超过 ${VD.maxEntries}`);if($.reduce((K,q)=>K+q.uncompressedSize,0)>VD.maxTotalSize)U.push("解压后总大小超过 500MB");for(let K of $){if(K.fileName.startsWith("/")||K.fileName.split("/").includes(".."))U.push(`存在不安全路径: ${K.fileName}`);if(K.compressedSize>0&&K.uncompressedSize/K.compressedSize>VD.maxCompressionRatio)U.push(`压缩比超过 150: ${K.fileName}`);if(K.fileName==="信息表.xlsx")continue;$H1(K,Y,U)}if(!$.find((K)=>K.fileName==="信息表.xlsx"))U.push("ZIP 根目录缺少精确名为「信息表.xlsx」的文件");if($.some((K)=>K.fileName.toLowerCase().endsWith(".zip")))U.push("不允许嵌套 ZIP");if(U.length)throw new h$(U)}function $H1($,I,U){let Y=IH1($.fileName);if(!Y||!I.allowedExtensions.includes(Y))U.push(`附件后缀不在白名单中: ${$.fileName}(允许: ${I.allowedExtensions.join(", ")})`);if($.uncompressedSize<I.minFileSizeBytes)U.push(`附件文件过小: ${$.fileName}(${$.uncompressedSize} B,小于最小值 ${I.minFileSizeBytes} B)`);if(I.maxFileSizeBytes!==void 0&&I.maxFileSizeBytes!==null&&$.uncompressedSize>I.maxFileSizeBytes)U.push(`附件文件过大: ${$.fileName}(${$.uncompressedSize} B,大于最大值 ${I.maxFileSizeBytes} B)`)}function IH1($){let I=$.split("/").pop()??$,U=I.lastIndexOf(".");return U>0?I.slice(U).toLowerCase():""}function Gu($,I){return new Promise((U,Y)=>{Hu.default.fromBuffer(Buffer.from($),{lazyEntries:!0,autoClose:!0,decodeStrings:!1},(J,Q)=>{if(J||!Q)return Y(J??Error("无法打开 ZIP"));Q.readEntry(),Q.on("entry",(K)=>{if(zZ0(K)!==I.fileName)return Q.readEntry();Q.openReadStream(K,(q,H)=>{if(q||!H)return Y(q??Error(`无法读取 ${I.fileName}`));let G=[];H.on("data",(W)=>G.push(W)),H.on("end",()=>U(Buffer.concat(G))),H.on("error",Y)})}),Q.on("error",Y)})})}var DZ0=OI(Jh(),1);function UH1($){return $.startsWith("[附件]")}function OZ0($){return $.startsWith("[附件]")?$.slice(4):$}function YH1($){return OZ0($).toLowerCase().replace(/\s+/g,"_")||"attachment"}function JH1($){if($==null||$==="")return[];return String($).split(/[\n,;,;]/).map((I)=>I.trim()).filter(Boolean)}function Wu($,I){let U=[];for(let[Y,J]of I.entries()){if(!UH1(Y))continue;let Q=$.getCell(J).value,K=JH1(Q);if(!K.length)continue;U.push({key:YH1(Y),label:OZ0(Y),paths:K})}return U}function wu($){let I=new Map;return $.map((U)=>{let Y=(I.get(U.key)??0)+1;return I.set(U.key,Y),Y===1?U:{...U,key:`${U.key}-${Y}`}})}function ZD($,I,U,Y){return{key:$,label:I,type:U,value:Y}}function FZ0($,I,U){return ZD($,I,"TEXT",U==null?"":String(U))}function NZ0($,I,U){return ZD($,I,"AMOUNT",typeof U==="number"?{amount:U,currency:"CNY"}:null)}function MZ0($){if($ instanceof Date)return $.toISOString();if(typeof $==="string"&&$.trim())return $.trim();return null}function QH1($){if($ instanceof Date)return Math.floor($.getTime()/1000);if(typeof $==="string"&&$.trim()){let I=Date.parse($.trim().replace(" ","T"));if(Number.isFinite(I))return Math.floor(I/1000)}return null}function ZH($){let I=new Map;return $.getRow(1).eachCell((U,Y)=>I.set(String(U.value??"").trim(),Y)),I}function qI($,I,U){let Y=I.get(U);return Y?$.getCell(Y).value:void 0}function KH1($,I){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"] Line truncated
`);let F=new FormData,E=await Gu(Y.fileBuffer,D),T=L.split("/").pop()??L;F.append("files",new File([new Uint8Array(E)],T));let A=await fetch(`${J}/api/v1/integrations/webhook/${encodeURIComponent(Q)}/attachments`,{method:"POST",headers:Oh({},U.secret),body:F});if(!A.ok)throw Error(`附件上传失败 ${A.status}: ${await A.text()}`);let R=await A.json();W.set(L,R.attachments?.map((k)=>k.data)??(R.data===void 0?[]:[R.data])),process.stderr.write(`✓ 附件上传成功: ${L}
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let K of $.seen.entries()){let q=K[1];if(I===K[0]){Q(K);continue}if($.external){let G=$.external.registry.get(K[0])?.id;if(I!==K[0]&&G){Q(K);continue}}if($.metadataRegistry.get(K[0])?.id){Q(K);continue}if(q.cycle){Q(K);continue}if(q.count>1){if($.reused==="ref"){Q(K);continue}}}}function K9($,I){let U=$.seen.get(I);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let Y=(q)=>{let H=$.seen.get(q);if(H.ref===null)return;let G=H.def??H.schema,W={...G},w=H.ref;if(H.ref=null,w){Y(w);let Z=$.seen.get(w),X=Z.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))G.allOf=G.allOf??[],G.allOf.push(X);else Object.assign(G,X);if(Object.assign(G,W),q._zod.parent===w)for(let D in G){if(D==="$ref"||D==="allOf")continue;if(!(D in W))delete G[D]}if(X.$ref&&Z.def)for(let D in G){if(D==="$ref"||D==="allOf")continue;if(D in Z.def&&JSON.stringify(G[D])===JSON.stringify(Z.def[D]))delete G[D]}}let V=q._zod.parent;if(V&&V!==w){Y(V);let Z=$.seen.get(V);if(Z?.schema.$ref){if(G.$ref=Z.schema.$ref,Z.def)for(let X in G){if(X==="$ref"||X==="allOf")continue;if(X in Z.def&&JSON.stringify(G[X])===JSON.stringify(Z.def[X]))delete G[X]}}}$.override({zodSchema:q,jsonSchema:G,path:H.path??[]})};for(let q of[...$.seen.entries()].reverse())Y(q[0]);let J={};if($.target==="draft-2020-12")J.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")J.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")J.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let q=$.external.registry.get(I)?.id;if(!q)throw Error("Schema is missing an `id` property");J.$id=$.external.uri(q)}Object.assign(J,U.def??U.schema);let Q=$.metadataRegistry.get(I)?.id;if(Q!==void 0&&J.id===Q)delete J.id;let K=$.external?.defs??{};for(let q of $.seen.entries()){let H=q[1];if(H.def&&H.defId){if(H.def.id===H.defId)delete H.def.id;K[H.defId]=H.def}}if($.external);else if(Object.keys(K).length>0)if($.target==="draft-2020-12")J.$defs=K;else J.definitions=K;try{let q=JSON.parse(JSON.stringify(J));return Object.defineProperty(q,"~standard",{value:{...I["~standard"],jsonSchema:{input:pI(I,"input",$.processors),output:pI(I,"output",$.processors)}},enumerable:!1,writable:!1}),q}catch(q){throw Error("Error converting schema to JSON.")}}function v6($,I){let U=I??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let Y=$._zod.def;if(Y.type==="transform")return!0;if(Y.type==="array")return v6(Y.element,U);if(Y.type==="set")return v6(Y.valueType,U);if(Y.type==="lazy")return v6(Y.getter(),U);if(Y.type==="promise"||Y.type==="optional"||Y.type==="nonoptional"||Y.type==="nullable"||Y.type==="readonly"||Y.type==="default"||Y.type==="prefault")return v6(Y.innerType,U);if(Y.type==="intersection")return v6(Y.left,U)||v6(Y.right,U);if(Y.type==="record"||Y.type==="map")return v6(Y.keyType,U)||v6(Y.valueType,U);if(Y.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return v6(Y.in,U)||v6(Y.out,U)}if(Y.type==="object"){for(let J in Y.shape)if(v6(Y.shape[J],U))return!0;return!1}if(Y.type==="union"){for(let J of Y.options)if(v6(J,U))return!0;return!1}if(Y.type==="tuple"){for(let J of Y.items)if(v6(J,U))return!0;if(Y.rest&&v6(Y.rest,U))return!0;return!1}return!1}var IA=($,I={})=>(U)=>{let Y=J9({...U,processors:I});return S1($,Y),Q9(Y,$),K9(Y,$)},pI=($,I,U={})=>(Y)=>{let{libraryOptions:J,target:Q}=Y??{},K=J9({...J??{},target:Q,io:I,processors:U});return S1($,K),Q9(K,$),K9(K,$)};var oF0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},UA=($,I,U,Y)=>{let J=U;J.type="string";let{minimum:Q,maximum:K,format:q,patterns:H,contentEncoding:G}=$._zod.bag;if(typeof Q==="number")J.minLength=Q;if(typeof K==="number")J.maxLength=K;if(q){if(J.format=oF0[q]??q,J.format==="")delete J.format;if(q==="time")delete J.format}if(G)J.contentEncoding=G;if(H&&H.size>0){let W=[...H];if(W.length===1)J.pattern=W[0].source;else if(W.length>1)J.allOf=[...W.map((w)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:w.source}))]}},YA=($,I,U,Y)=>{let J=U,{minimum:Q,maximum:K,format:q,multipleOf:H,exclusiveMaximum:G,exclusiveMinimum:W}=$._zod.bag;if(typeof q==="string"&&q.includes("int"))J.type="integer";else J.type="number";let w=typeof W==="number"&&W>=(Q??Number.NEGATIVE_INFINITY),V=typeof G==="number"&&G<=(K??Number.POSITIVE_INFINITY),Z=I.target==="draft-04"||I.target==="openapi-3.0";if(w)if(Z)J.minimum=W,J.exclusiveMinimum=!0;else J.exclusiveMinimum=W;else if(typeof Q==="number")J.minimum=Q;if(V)if(Z)J.maximum=G,J.exclusiveMaximum=!0;else J.exclusiveMaximum=G;else if(typeof K==="number")J.maximum=K;if(typeof H==="number")J.multipleOf=H},JA=($,I,U,Y)=>{U.type="boolean"},QA=($,I,U,Y)=>{if(I.unrepresentable==="throw")throw Error("BigInt cannot be represented in JSON Schema")},KA=($,I,U,Y)=>{if(I.unrepresentable==Line truncated
`);if($===-1)return null;let I=this._buffer.toString("utf8",0,$).replace(/\r$/,"");return this._buffer=this._buffer.subarray($+1),Lj0(I)}clear(){this._buffer=void 0}}function Lj0($){return rf.parse(JSON.parse($))}function mc($){return JSON.stringify($)+`
`}class OE{constructor($=lc.stdin,I=lc.stdout){this._stdin=$,this._stdout=I,this._readBuffer=new FE,this._started=!1,this._ondata=(U)=>{this._readBuffer.append(U),this.processReadBuffer()},this._onerror=(U)=>{this.onerror?.(U)}}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((I)=>{let U=mc($);if(this._stdout.write(U))I();else this._stdout.once("drain",I)})}}import{dirname as tu,join as FW1}from"node:path";import{fileURLToPath as OW1}from"node:url";class G5 extends Error{name="KyError";get isKyError(){return!0}}class H$ extends G5{name="HTTPError";response;request;options;data;constructor($,I,U){let Y=$.status||$.status===0?$.status:"",J=$.statusText??"",Q=`${Y} ${J}`.trim(),K=Q?`status code ${Q}`:"an unknown error";super(`Request failed with ${K}: ${I.method} ${I.url}`);this.response=$,this.request=I,this.options=U}}class q2 extends G5{name="NetworkError";request;constructor($,I){super(`Request failed due to a network error: ${$.method} ${$.url}`,I);this.request=$}}class H2 extends Error{name="NonError";value;constructor($){let I="Non-error value was thrown";try{if(typeof $==="string")I=$;else if($&&typeof $==="object"&&"message"in $&&typeof $.message==="string")I=$.message}catch{}super(I);this.value=$}}class LU extends G5{name="ForceRetryError";customDelay;code;customRequest;constructor($){let I=$?.cause?$.cause instanceof Error?$.cause:new H2($.cause):void 0;super($?.code?`Forced retry: ${$.code}`:"Forced retry",I?{cause:I}:void 0);this.customDelay=$?.delay,this.code=$?.code,this.customRequest=$?.request}}class NE extends Error{name="SchemaValidationError";issues;constructor($){super("Response schema validation failed");this.issues=$}}class a$ extends G5{name="TimeoutError";request;constructor($){super(`Request timed out: ${$.method} ${$.url}`);this.request=$}}var ME=(()=>{let $=!1,I=!1,U=typeof globalThis.ReadableStream==="function",Y=typeof globalThis.Request==="function";if(U&&Y)try{I=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return $=!0,"half"}}).headers.has("Content-Type")}catch(J){if(J instanceof Error&&J.message==="unsupported BodyInit type")return!1;throw J}return $&&!I})(),oc=typeof globalThis.AbortController==="function",Aw=typeof globalThis.AbortSignal==="function"&&typeof globalThis.AbortSignal.any==="function",rc=typeof globalThis.ReadableStream==="function",tc=typeof globalThis.FormData==="function",Pw=["get","post","put","patch","head","delete"],Dj0=()=>{return};Dj0();var ac={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*",bytes:"*/*"},DU=2147483647,sc=40,Tw=Symbol("stop");class Ew{options;constructor($){this.options=$}}var ec=($)=>new Ew($),$d={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},Id={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 Bw=new TextEncoder,Fj0=($)=>{if(!$)return 0;if($ instanceof FormData){let I=0;for(let[U,Y]of $)I+=sc,I+=Bw.encode(`Content-Disposition: form-data; name="${U}"`).byteLength,I+=typeof Y==="string"?Bw.encode(Y).byteLength:Y.size;return I}if($ instanceof Blob)return $.size;if($ instanceof ArrayBuffer||ArrayBuffer.isView($))return $.byteLength;if(typeof $==="string")return Bw.encode($).byteLength;if($ instanceof URLSearchParams)return Bw.encode($.toString()).byteLength;return 0},Ud=($,I,U)=>{let Y,J=0;return $.pipeThrough(new TransformStream({transform(Q,K){if(K.enqueue(Q),Y){J+=Y.byteLength;let q=I===0?0:J/I;if(q>=1)q=1-Number.EPSILON;U?.({percent:q,totalBytes:Math.max(I,J),transferredBytes:J},Y)}Y=Q},flush(){if(Y)J+=Y.byteLength,U?.({percent:1,totalBytes:Math.max(I,J),transferredBytes:J},Y)}}))},Yd=($,I)=>{if(!$.body)return $;let U={status:$.status,statusText:$.statusText,headers:$.headers};if($.status===204)return new Response(null,U);let Y=Math.max(0,Number($.headers.get("content-length"))||0);return new Response(Ud($.body,Y,I),U)},Jd=($,I,U)=>{if(!$.body)return $;let Y=Fj0(U??$.body);return new Request($,{duplex:"half",body:Ud($.body,Y,I)})};var F8=($)=>$!==null&&typeof $==="object";var Oj0=Symbol("replaceOption"),AE=($)=>F8($)&&$[Oj0]===!0?{isReplace:!0,value:$.value}:{isReplace:!1,value:$};var W2=(...$)=>{for(let I of $)if( Line truncated
`,{mode:384}),I}function VK1($){let I=sw0();for(let U of I){if(!D$(U))continue;for(let Y of oL(U).filter((J)=>J.endsWith(".json")).filter((J)=>!J.startsWith("example."))){let J=m8(U,Y);try{let Q=tL(J,"utf-8"),K=JSON.parse(Q);if(K&&typeof K==="object"&&K.id===$)return J}catch{}}}return}function O7($,I){let U=VK1($);if(!U)throw Error(`Enterprise config not found: ${$}`);let J={...JSON.parse(tL(U,"utf-8")),...I};for(let K of Object.keys(I))if(I[K]===void 0)delete J[K];let Q=Xh.parse(J);return mw0(U,`${JSON.stringify(Q,null,2)}
`,"utf-8"),Q}function NJ($,I,U=[]){let Y=I.corpId?.trim()||void 0,J=I.stateful?I.defaultCorpId?.trim()||void 0:void 0,Q=Y??J;if(Q){let q=$.find((H)=>H.id===Q);if(q)return q;throw Error(`No enterprise config found for ${Q}`)}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 K=$[0];if(K)return K;throw Error("No enterprise config found. Add a non-example JSON file under one of: "+(U.length?U.join(", "):"the configured enterprise directories"))}import{readFileSync as _H1}from"node:fs";import{randomBytes as SH1}from"node:crypto";var IV0=300000,ew0=new Map;function ZK1($,I){return $.map((U)=>U.trim()).filter(Boolean).map((U)=>I?U:U.toLowerCase())}function zK1($,I){return I?$:$.toLowerCase()}function XK1($,I,U,Y){let J=zK1($,Y),Q=I.filter((K)=>J.includes(K));if(U==="all"&&Q.length!==I.length)return[];return Q}function LK1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function DK1($,I){if(I.fields&&!I.fields.has($.field))return[];let U=LK1($.value),Y=[];return U.forEach((J,Q)=>{let K=XK1(J,I.keywords,I.matchMode,I.caseSensitive);if(K.length===0)return;let q=Math.max(0,Q-I.contextLines),H=Math.min(U.length,Q+I.contextLines+1),G={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:Q+1,matchedKeywords:K,matchedText:sL(J,I.maxChars),context:{before:I.snippetOnly?[]:U.slice(q,Q).map((W)=>sL(W,I.maxChars)),line:sL(J,I.maxChars),after:I.snippetOnly?[]:U.slice(Q+1,H).map((W)=>sL(W,I.maxChars))},metadata:$.metadata};if(I.snippetOnly)G.context={before:[],line:G.context.line,after:[]};Y.push(G)}),Y}function sL($,I){if(!I||$.length<=I)return $;return`${$.slice(0,Math.max(0,I))}...`}function FK1($){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 $V0($){return $.rules.flatMap((I,U)=>{let Y=`${$.id}:${I.description.slice(0,32)}`,J={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:I.scope,strictness:I.strictness,code:"code"in I?I.code:void 0,index:U};return[{area:"rules",entityType:"rule",entityId:Y,title:`${$.versionName} / ${I.scope}`,field:"history.description",value:I.description,metadata:J},{area:"rules",entityType:"rule",entityId:Y,title:`${$.versionName} / ${I.scope}`,field:"history.scope",value:I.scope,metadata:J}]})}function OK1($){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 NK1($){let I=[];if($.decisionPreferences)for(let[U,Y]of Object.entries($.decisionPreferences))I.push({area:"preferences",entityType:"preference",field:`decisionPreferences.${U}`,value:Y,metadata:{integrationSystem:$.integrationSystem}});return $.integrations.forEach((U,Y)=>{I.push({area:"preferences",entityType:"integration",title:U.outboundName,field:`integrations[${Y}]`,value:U,metadata:{type:U.type,outboundName:U.outboundName,mode:U.mode,corporationId:U.corporationId}})}),I}async function MK1($,I,U){let Y=U.ruleVersionScope??"current",J=[I.id,`ruleVersionScope=${Y}`,`ruleVersionId=${U.ruleVersionId??""}`,`ruleVersionNumber=${U.ruleVersionNumber??""}`,`latestRuleVersion=${U.latestRuleVersion??!1}`,`documentLimit=${U.documentLimit??100}`].join("|"),Q=ew0.get(J);if(!U.refresh&&Q&&Date.now()<Q.expiresAt)return Q;let[K,q,H]=await Promise.all([AK1($,{scope:Y,versionId:U.ruleVersionId,versionNumber:U.ruleVersionNumber,latest:U.latestRuleVersion}),O9($,{limit:U.documentLimit??100}),M1($,I.seal.endpoints.approvalStylePreferences)]),G=Date.now(),W={entries:[...K,...q.articles.flatMap(OK1),...NK1(H)],fetchedAt:G,expiresAt:G+IV0};return ew0.set(J,W),W}async function AK1($,I){if(I.scope==="current")return(await _6($)).rules.flatMap(FK1);if(I.scope==="version"){let Y=await PK1($,I);return $V0(Y)}return(await R$($)).flatMap($V0)}async function PK1($,I){if(I.versionId)return P2($,I.versionId);let U=await R$($),Y=I.versionNumber?U.find((J)=>J.versionNumber===I.versionNumber):U[0];if(!Y)throw Error(I.versionNumber?`Rule version not found: ${I.versionNumber}`:"No rule versions found");return Y}async function UV0($,I,U){let Y=U.matchMode??"any",J=U.caseSensitive??!1,Q=U.contextLines??3,K=new Set(U.areas??["rules","documents","preferences"]),q=U Line truncated
`,"utf8"),U}function HV0($){return $.map((I,U)=>{let Y;if(typeof I.code==="number")Y=`#${String(I.code).padStart(4,"0")}`;else if(typeof I.code==="string")Y=I.code.startsWith("#")?I.code:`#${I.code}`;else Y=`#${String(U+1).padStart(4,"0")}`;return{id:I.id,code:Y,name:I.name,description:I.description,scope:I.scope,strictness:I.strictness}})}class b$ extends Error{errors;warnings;constructor($,I=[]){super([`材料包校验失败:${$.length} 个错误`,...$.map((U)=>`- ${U}`)].join(`
`));this.errors=$;this.warnings=I;this.name="MaterialPackValidationError"}}import{createHmac as fK1,randomBytes as bK1}from"node:crypto";function iK1($,I,U,Y){return fK1("sha256",Y).update(`${$}.${I}.${JSON.stringify(U)}`).digest("hex")}function Th($,I){let U=Math.floor(Date.now()/1000),Y=bK1(16).toString("hex");return{Authorization:`Bearer ${I}`,"x-webhook-signature":iK1(U,Y,$,I),"x-webhook-timestamp":String(U),"x-webhook-nonce":Y}}var zu=OI(RV0(),1),DZ0=OI(LZ0(),1);var DD={maxEntries:1000,maxTotalSize:524288000,maxCompressionRatio:150};async function FZ0($){return new Promise((I,U)=>{zu.default.fromBuffer(Buffer.from($),{lazyEntries:!0,autoClose:!0,decodeStrings:!1},(Y,J)=>{if(Y||!J)return U(Y??Error("无法打开 ZIP"));let Q=[];J.readEntry(),J.on("entry",(K)=>{let q=OZ0(K);if(!q.endsWith("/")&&!LH1(q))Q.push({fileName:q,uncompressedSize:K.uncompressedSize,compressedSize:K.compressedSize,raw:K});J.readEntry()}),J.on("end",()=>I(Q)),J.on("error",U)})})}function OZ0($){let I=Buffer.isBuffer($.fileName)?$.fileName:Buffer.from(String($.fileName),"binary"),U=I.toString("utf8");if(!U.includes("�"))return U;let Y=DZ0.default.decode(I,"gbk");if(!Y.includes("�"))return Y;return U}function LH1($){let I=$.split("/").pop()??"";return $.split("/").includes("__MACOSX")||I===".DS_Store"||I.startsWith("._")||I.startsWith(".~")||I.startsWith("~$")}function NZ0($,I){let U=[],Y=AU(I);if($.length>DD.maxEntries)U.push(`文件数超过 ${DD.maxEntries}`);if($.reduce((K,q)=>K+q.uncompressedSize,0)>DD.maxTotalSize)U.push("解压后总大小超过 500MB");for(let K of $){if(K.fileName.startsWith("/")||K.fileName.split("/").includes(".."))U.push(`存在不安全路径: ${K.fileName}`);if(K.compressedSize>0&&K.uncompressedSize/K.compressedSize>DD.maxCompressionRatio)U.push(`压缩比超过 150: ${K.fileName}`);if(K.fileName==="信息表.xlsx")continue;DH1(K,Y,U)}if(!$.find((K)=>K.fileName==="信息表.xlsx"))U.push("ZIP 根目录缺少精确名为「信息表.xlsx」的文件");if($.some((K)=>K.fileName.toLowerCase().endsWith(".zip")))U.push("不允许嵌套 ZIP");if(U.length)throw new b$(U)}function DH1($,I,U){let Y=FH1($.fileName);if(!Y||!I.allowedExtensions.includes(Y))U.push(`附件后缀不在白名单中: ${$.fileName}(允许: ${I.allowedExtensions.join(", ")})`);if($.uncompressedSize<I.minFileSizeBytes)U.push(`附件文件过小: ${$.fileName}(${$.uncompressedSize} B,小于最小值 ${I.minFileSizeBytes} B)`);if(I.maxFileSizeBytes!==void 0&&I.maxFileSizeBytes!==null&&$.uncompressedSize>I.maxFileSizeBytes)U.push(`附件文件过大: ${$.fileName}(${$.uncompressedSize} B,大于最大值 ${I.maxFileSizeBytes} B)`)}function FH1($){let I=$.split("/").pop()??$,U=I.lastIndexOf(".");return U>0?I.slice(U).toLowerCase():""}function Xu($,I){return new Promise((U,Y)=>{zu.default.fromBuffer(Buffer.from($),{lazyEntries:!0,autoClose:!0,decodeStrings:!1},(J,Q)=>{if(J||!Q)return Y(J??Error("无法打开 ZIP"));Q.readEntry(),Q.on("entry",(K)=>{if(OZ0(K)!==I.fileName)return Q.readEntry();Q.openReadStream(K,(q,H)=>{if(q||!H)return Y(q??Error(`无法读取 ${I.fileName}`));let G=[];H.on("data",(W)=>G.push(W)),H.on("end",()=>U(Buffer.concat(G))),H.on("error",Y)})}),Q.on("error",Y)})})}var AZ0=OI(Wh(),1);function OH1($){return $.startsWith("[附件]")}function PZ0($){return $.startsWith("[附件]")?$.slice(4):$}function NH1($){return PZ0($).toLowerCase().replace(/\s+/g,"_")||"attachment"}function MH1($){if($==null||$==="")return[];return String($).split(/[\n,;,;]/).map((I)=>I.trim()).filter(Boolean)}function Lu($,I){let U=[];for(let[Y,J]of I.entries()){if(!OH1(Y))continue;let Q=$.getCell(J).value,K=MH1(Q);if(!K.length)continue;U.push({key:NH1(Y),label:PZ0(Y),paths:K})}return U}function Du($){let I=new Map;return $.map((U)=>{let Y=(I.get(U.key)??0)+1;return I.set(U.key,Y),Y===1?U:{...U,key:`${U.key}-${Y}`}})}function FD($,I,U,Y){return{key:$,label:I,type:U,value:Y}}function TZ0($,I,U){return FD($,I,"TEXT",U==null?"":String(U))}function EZ0($,I,U){return FD($,I,"AMOUNT",typeof U==="number"?{amount:U,currency:"CNY"}:null)}function BZ0($){if($ instanceof Date)return $.toISOString();if(typeof $==="string"&&$.trim())return $.trim();return null}function AH1($){if($ instanceof Date)return Math.floor($.getTime()/1000);if(typeof $==="string"&&$.trim()){let I=Date.parse($.trim().replace(" ","T"));if(Number.isFinite(I))return Math.floor(I/1000)}return null}function XH($){let I=new Map;return $.getRow(1).eachCell((U,Y)=>I.set(String(U.value??"").trim(),Y)),I}function HI($,I,U){let Y=I.get(U);return Y?$.getCell(Y).value:void 0}function PH1($,I){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"] Line truncated
`);let O=new FormData,E=await Xu(Y.fileBuffer,D),T=L.split("/").pop()??L;O.append("files",new File([new Uint8Array(E)],T));let A=await fetch(`${J}/api/v1/integrations/webhook/${encodeURIComponent(Q)}/attachments`,{method:"POST",headers:Th({},U.secret),body:O});if(!A.ok)throw Error(`附件上传失败 ${A.status}: ${await A.text()}`);let R=await A.json();W.set(L,R.attachments?.map((k)=>k.data)??(R.data===void 0?[]:[R.data])),process.stderr.write(`✓ 附件上传成功: ${L}
`)}process.stderr.write(`\uD83D\uDCE4 推送单据: ${H.document.documentId}
`);let V=Vu(H.document,G,W),Z=await fetch(`${J}/api/v1/integrations/webhook/${encodeURIComponent(Q)}/document`,{method:"POST",headers:{"Content-Type":"application/json",...Oh({webhookId:Q,...V},U.secret)},body:JSON.stringify(V)});if(!Z.ok)throw Error(`Webhook 单据推送失败 ${Z.status}: ${await Z.text()}`);K.push({documentId:V.documentId,document:V,pushResult:await Z.json()}),process.stderr.write(`✓ 单据推送成功: ${V.documentId}
`)}return{warnings:[],results:K}}function GI($){return{fileBuffer:GH1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as ZH1}from"node:fs";async function XD($,I,U={}){let J=D4().stateful?"stateful":"stateless",Q="ok",K,q,H;try{let A=await P$($);H={id:A.user.id,name:A.user.name,isAdmin:A.user.isAdmin},q={id:A.tenant.id,name:A.tenant.name,tenantSlug:A.tenant.tenantSlug,corporationName:A.tenant.hoseCorpConfig?.corporationName}}catch(A){Q="error",K=A instanceof Error?A.message:String(A)}let G=[];if(Q==="ok")try{G=await F9($,I.seal.endpoints.approvalStylePreferences)}catch(A){Q="error",K=`读取 Webhook 配置失败: ${A instanceof Error?A.message:String(A)}`}let W=G.length===1,w=G.map((A)=>({id:A.id,name:A.name,mode:A.mode,incomingDocumentWebhookUrl:A.incomingDocumentWebhook.url,outgoingResultWebhookUrl:A.outgoingResultWebhook,autoApprovalRate:A.autoApprovalRate,...W?{isDefault:!0}:{}})),V=W?{id:G[0].id,name:G[0].name,mode:G[0].mode}:null,Z=U.webhook?N9(G,U.webhook):W?G[0]:void 0,X;if(U.filePath)if(!ZH1(U.filePath))X={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let A=GI(U.filePath),R=await HI(A.fileBuffer,A.fileName,Z?.materialPackFilePolicy);X={valid:!0,filePath:U.filePath,fileName:A.fileName,documentCount:R.documents.length,warnings:R.warnings}}catch(A){X={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[A instanceof Error?A.message:String(A)]}}let L=X?X.valid:!0,D=Q==="ok"&&w.length>0&&L,F=J==="stateful"?"":` --corp ${I.id}`,E="",T="";if(Q!=="ok")T=`凭证鉴权异常: ${K}`,E=`seal-use auth diagnose${F}`;else if(w.length===0)T="当前企业尚未配置任何 Webhook 集成通道",E=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${F}`;else if(X&&!X.valid)T=`材料包预检失败: ${X.errors?.join("; ")}`,E=`seal-use webhook material-pack preview ${X.filePath}${F}`;else{T=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${w.length} 个 Webhook 通道,等待载入`;let A=X?.filePath??"<材料包.zip>",R=W?"":` --webhook ${V?V.id:"<webhookIdOrName>"}`;E=`seal-use webhook material-pack push ${A}${R}${F}`}return{ready:D,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:q,user:H},stateMode:J,authStatus:Q,authError:K,activeWebhooks:w,defaultWebhook:V,materialPack:X,statusMessage:T,nextAction:E}}var XH=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:z.object({}),handler:async($)=>P$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:z.object({}),handler:async($)=>Xm($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:z.object({}),handler:async($)=>im($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:z.object({note:z.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>AU($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:z.object({tokenId:z.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>bm($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:z.object({name:z.string().describe("用户姓名"),phone:z.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:z.array(z.string()).optional().describe("权限列表,默认为 []"),departmentIds:z.array(z.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>nm($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>mE($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>bw($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:z.object({keyword:z.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>nw($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>em($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>lE($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 S Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:CJ({id:I?.id,sn:I?.sn??I?.sourceDocumentSN??$.sourceDocumentSN,title:I?.title??I?.name,template:MD(I,["template.name","templateName","form.name","formName","formTitle"]),amount:DD(U,["金额","报销金额","付款金额","合计","价税合计"])??MD(I,["amount","totalAmount","expenseAmount"]),expenseType:DD(U,["费用类型","费用类别","报销类型"]),costCompany:DD(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:DD(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:jH1($),attachments:DJ($,{summary:!0}).attachments,aiResult:PD($),manualResult:wI($)?.value,hints:CJ({amountMentions:RZ0(Y,["金额","合计","税率"],8),partyMentions:RZ0(Y,["买方","卖方","甲方","乙方","收款"],8)})}}function BH1($){let I=[["result.citedRules",l5($,"result.citedRules")],["result.matchedRules",l5($,"result.matchedRules")],["result.ruleResults",l5($,"result.ruleResults")],["result.rules",l5($,"result.rules")],["pipelineData.citedRules",l5($,"pipelineData.citedRules")],["pipelineData.matchedRules",l5($,"pipelineData.matchedRules")]],U=[],Y=new Set;for(let[J,Q]of I)(Array.isArray(Q)?Q:Q&&typeof Q==="object"?Object.values(Q):[]).forEach((q,H)=>{let G=LH(q);if(!G)return;let W=Y4(G.runtimeRuleId)??Y4(G.runtimeId)??Y4(G.id)??Y4(G.ruleId),w=Y4(G.ruleCode)??Y4(G.code)??(W?SH1(W):void 0),V=CJ({runtimeRuleId:W,ruleCode:w,versionNumber:RH1(G.versionNumber)??$.ruleSetVersionNumber,scope:Y4(G.scope),strictness:Y4(G.strictness),appliedAnalysis:G.appliedAnalysis??G.analysis??G.reasoning,checkResult:G.checkResult??G.result??G.decision,findings:G.findings??G.riskPoints??G.evidence,sourcePath:`${J}.${H}`}),Z=JSON.stringify(V);if(!Y.has(Z))Y.add(Z),U.push(V)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function MD($,I){if(!$)return;for(let U of I){let Y=l5($,U);if(Y!==void 0)return Y}return}function vZ0($,I){if(!$)return 0;for(let U of I){let Y=l5($,U);if(Array.isArray(Y))return Y.length;if(Y&&typeof Y==="object")return Object.keys(Y).length;if(typeof Y==="number")return Y}return 0}function l5($,I){return I.split(".").reduce((U,Y)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let J=Number(Y);return Number.isInteger(J)?U[J]:void 0}if(typeof U==="object")return U[Y];return},$)}function vH1($,I,U){let Y=I.split("."),J=$;for(let Q of Y.slice(0,-1)){let K=J[Q];if(!K||typeof K!=="object"||Array.isArray(K))J[Q]={};J=J[Q]}J[Y[Y.length-1]??I]=U}function CJ($){return Object.fromEntries(Object.entries($).filter(([,I])=>I!==void 0))}function LH($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function RH1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function CH1($){let I=[];return Xu($,"document",I),I}function Xu($,I,U){if(Array.isArray($)){$.forEach((K,q)=>Xu(K,`${I}.${q}`,U));return}let Y=LH($);if(!Y)return;let J=Y4(Y.label)??Y4(Y.name)??Y4(Y.title)??Y4(Y.fieldName),Q=Y.value??Y.displayValue??Y.text??Y.content;if(J&&Q!==void 0&&typeof Q!=="object")U.push(CJ({path:I,label:J,value:Q,type:Y4(Y.type)??Y4(Y.fieldType)}));for(let[K,q]of Object.entries(Y)){if(K==="attachments")continue;Xu(q,`${I}.${K}`,U)}}function DD($,I){return $.find((Y)=>{let J=Y4(Y.label)??"";return I.some((Q)=>J.includes(Q))})?.value}function jH1($){let I=[];return AD($.result,"result",I),AD($.document,"document",I),I.slice(0,20)}function AD($,I,U){if(Array.isArray($)){$.forEach((J,Q)=>AD(J,`${I}.${Q}`,U));return}let Y=LH($);if(!Y)return;if(/invoice|发票/i.test(I))U.push(CJ({path:I,fileName:Y4(Y.fileName)??Y4(Y.filename)??Y4(Y.name),buyer:Y.buyer??Y.buyerName??Y.purchaserName,seller:Y.seller??Y.sellerName,amount:Y.amount??Y.totalAmount??Y.total,taxRate:Y.taxRate,category:Y.category??Y.type}));for(let[J,Q]of Object.entries(Y))AD(Q,`${I}.${J}`,U)}function RZ0($,I,U){return $.split(/\r?\n/).filter((Y)=>I.some((J)=>Y.includes(J))).slice(0,U)}function OD($){return $.map((I)=>{let U=WI(I);return{recordId:U.id,tenantId:U.tenantId,agentId:U.agentId,sourceDocumentSN:U.sourceDocumentSN,sourceDocumentId:U.sourceDocumentId,simulationBatchId:U.simulationBatchId,langfuseTraceId:U.langfuseTraceId,langfuseSessionFallback:U.langfuseSessionFallback,ruleSetVersionNumber:U.ruleSetVersionNumber,ruleSetPublishedAt:U.ruleSetPublishedAt,ruleSetPublishedByName:U.ruleSetPublishedByName,resolution:U.langfuseTraceId?"trace":U.langfuseSessionFallback?"session-fallback":"unresolved"}})}function Zu($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function _H1($,I){if(I.recordId&&!I.versionId&&!I.versionNumber&&!I.latest){let U=await i4($,I.recordId);if(!U.ruleSetVersionNumber)throw Er Line truncated
`)}function lH1($){let I=[];if(I.push(`seal-use ${$.area} - ${$.title}`),$.description)I.push($.description);I.push(""),I.push("Usage:");for(let U of $.commands)for(let Y of U.usage)I.push(` ${Y}`);return I.push(""),I.push(`Run 'seal-use ${$.area} <command> --help' for details on a specific command.`),I.join(`
`)}function tZ0(){return`seal-use CLI
Usage:
seal-use version
seal-use mcp
seal-use mcp config
seal-use mcp-config
seal-use skill dump
seal-use skill install [--dir <path>|--local]
seal-use skill status
seal-use http [--port 8787] [--host 127.0.0.1]
seal-use serve [--port 8787]
seal-use openapi
seal-use probe [<corpId>]
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>]
seal-use changelog [--limit <n>]
seal-use tools list
seal-use corps list [--corp <corpId>]
seal-use corps current [--corp <corpId>]
seal-use corps switch <corpId>
seal-use corps mark <corpId> --env <production|test> [--confirm]
seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]
seal-use corps unbind-test [<corpId>] [--confirm]
seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]
seal-use corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-use corps add-seal --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}'
seal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]
seal-use auth diagnose [--corp <corpId>]
seal-use auth hose-link [--corp <corpId>] [--expire 7200]
seal-use delegation list [--corp <corpId>]
seal-use delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]
seal-use delegation revoke <tokenId> [--corp <corpId>]
seal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]
seal-use users search <keyword> [--corp <corpId>]
seal-use users delegation <userIdOrPhone|name> [--note <note>] [--corp <corpId>]
seal-use users reset-password <userId> [--corp <corpId>]
seal-use users get <userId> [--corp <corpId>]
seal-use users delete <userId> [--corp <corpId>]
seal-use contacts departments [<departmentId>] [--corp <corpId>]
seal-use contacts children <departmentId> [--corp <corpId>]
seal-use contacts users <departmentId> [--corp <corpId>]
seal-use contacts sync-time [--corp <corpId>]
seal-use data expenses [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>] [--corp <corpId>]
seal-use data invoices [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>] [--corp <corpId>]
seal-use llm config [--corp <corpId>]
seal-use llm providers [--corp <corpId>]
seal-use permissions available [--corp <corpId>]
seal-use permissions configs [--corp <corpId>]
seal-use billing status [--corp <corpId>]
seal-use billing plans [--corp <corpId>]
seal-use billing features [--corp <corpId>]
seal-use webhook ready [<材料包.zip>] [--webhook <idOrName>] [--corp <corpId>]
seal-use webhook status [<材料包.zip>] [--corp <corpId>]
seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]
seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size 500] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--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] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--corp <corpId>]
seal-use webhook delete <idOrName> [--yes|--dry-run] [--corp <corpId>]
seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.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>]
seal-use deploy hosecloud status [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--dry-run] [--corp <corpId>]
seal-use deploy hosecloud sync <sign-key> [--corp <corpId>]
seal-use preference get [--corp <corpId>]
seal-use preference decision update --json '{"explicitApprove":"..."}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth set --default <medium|high> [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies list [--corp <corpId>]
seal-use preference thinking-depth policies upsert --json '{...}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies remove <policyId> [--dry-run] [--corp <corpId>]
seal-use source config [--corp <corpId>]
seal-use tool <toolName> [--corp <corpId>] [--json '{"key":"value"}']
seal-use rules count [--corp <corpId>]
seal-use rules list [--summary] [--count] [--limit 20] [--offset 0] [--corp <corpId>]
seal-use rules clear [--corp <corpId>] [--dry-run|--yes]
seal-use rules versions [--corp <corpId>]
seal-use rules version <versionId|versionNumber|latest> [--corp <corpId>]
seal-use rules get --corp <corpId> --version <number|latest> --code '#0038'
seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
seal-use rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
seal-use context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
seal-use approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai] [--corp <corpId>]
seal-use approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id] [--corp <corpId>]
seal-use approval-runs count [--status APPROVED] [--corp <corpId>]
seal-use approval-runs export [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>] [--limit <n>] [--downloads] [--out <file>] [--corp <corpId>]
seal-use approval-runs list|search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
seal-use approval-runs pick --sn <documentSN> [--batch <batchId>] [--latest] [--fields recordId,status,aiDecision] [--corp <corpId>]
seal-use approval-runs get <recordId> [--summary] [--fields metadata|document.fields,result.summary] [--full] [--output-file file.json] [--corp <corpId>]
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 analytics insight [--start-date <ISO>] [--end-date <ISO>] [--limit <n>] [--corp <corpId>]
seal-use approval-runs url [--corp <corpId>]
seal-use approval-runs url <recordId> [--corp <corpId>]
seal-use approval-runs url --sourceDocumentSN B26022501 [--corp <corpId>]
seal-use approval-runs bridge [--sourceDocumentSN B26001887] [--corp <corpId>]
seal-use simulation batch-records <batchId> [--corp <corpId>]
seal-use simulation create --mode hosecloud --flow-ids "B26017701,B26022501" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] [--no-wait] [--corp <corpId>]
seal-use simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] [--corp <corpId>]
seal-use simulation create --source-system weaver --request-ids "req-01,req-02" [--corp <corpId>]
seal-use simulation status <batchId> [--corp <corpId>]
seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] [--corp <corpId>]
seal-use simulation clean <batchId> [--corp <corpId>]
seal-use simulation specifications [--integration <sign-key>] [--corp <corpId>]
seal-use simulation approval-definitions [--corp <corpId>]
seal-use simulation list [--limit 50] [--corp <corpId>]
seal-use simulation get <batchId> [--corp <corpId>]
seal-use simulation templates [--corp <corpId>]
seal-use simulation integrations [--corp <corpId>]
seal-use simulation package-upload <材料包.zip> [--corp <corpId>]
`}var rH1=100,tH1=120000,eZ0=["id","code","status","strictness","scope","createdAt","updatedAt"],aH1=200000;function Bu($){return $.map((I)=>typeof I==="string"?I:String(I)).join(" ")}function FH($){if(!$.length)return"";return`${$.join(`
`);let V=Fu(H.document,G,W),Z=await fetch(`${J}/api/v1/integrations/webhook/${encodeURIComponent(Q)}/document`,{method:"POST",headers:{"Content-Type":"application/json",...Th({webhookId:Q,...V},U.secret)},body:JSON.stringify(V)});if(!Z.ok)throw Error(`Webhook 单据推送失败 ${Z.status}: ${await Z.text()}`);K.push({documentId:V.documentId,document:V,pushResult:await Z.json()}),process.stderr.write(`✓ 单据推送成功: ${V.documentId}
`)}return{warnings:[],results:K}}function WI($){return{fileBuffer:BH1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as CH1}from"node:fs";async function ND($,I,U={}){let J=F4().stateful?"stateful":"stateless",Q="ok",K,q,H;try{let A=await v$($);H={id:A.user.id,name:A.user.name,isAdmin:A.user.isAdmin},q={id:A.tenant.id,name:A.tenant.name,tenantSlug:A.tenant.tenantSlug,corporationName:A.tenant.hoseCorpConfig?.corporationName}}catch(A){Q="error",K=A instanceof Error?A.message:String(A)}let G=[];if(Q==="ok")try{G=await N9($,I.seal.endpoints.approvalStylePreferences)}catch(A){Q="error",K=`读取 Webhook 配置失败: ${A instanceof Error?A.message:String(A)}`}let W=G.length===1,w=G.map((A)=>({id:A.id,name:A.name,mode:A.mode,incomingDocumentWebhookUrl:A.incomingDocumentWebhook.url,outgoingResultWebhookUrl:A.outgoingResultWebhook,autoApprovalRate:A.autoApprovalRate,...W?{isDefault:!0}:{}})),V=W?{id:G[0].id,name:G[0].name,mode:G[0].mode}:null,Z=U.webhook?M9(G,U.webhook):W?G[0]:void 0,X;if(U.filePath)if(!CH1(U.filePath))X={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let A=WI(U.filePath),R=await GI(A.fileBuffer,A.fileName,Z?.materialPackFilePolicy);X={valid:!0,filePath:U.filePath,fileName:A.fileName,documentCount:R.documents.length,warnings:R.warnings}}catch(A){X={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[A instanceof Error?A.message:String(A)]}}let L=X?X.valid:!0,D=Q==="ok"&&w.length>0&&L,O=J==="stateful"?"":` --corp ${I.id}`,E="",T="";if(Q!=="ok")T=`凭证鉴权异常: ${K}`,E=`seal-use auth diagnose${O}`;else if(w.length===0)T="当前企业尚未配置任何 Webhook 集成通道",E=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${O}`;else if(X&&!X.valid)T=`材料包预检失败: ${X.errors?.join("; ")}`,E=`seal-use webhook material-pack preview ${X.filePath}${O}`;else{T=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${w.length} 个 Webhook 通道,等待载入`;let A=X?.filePath??"<材料包.zip>",R=W?"":` --webhook ${V?V.id:"<webhookIdOrName>"}`;E=`seal-use webhook material-pack push ${A}${R}${O}`}return{ready:D,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:q,user:H},stateMode:J,authStatus:Q,authError:K,activeWebhooks:w,defaultWebhook:V,materialPack:X,statusMessage:T,nextAction:E}}var DH=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:z.object({}),handler:async($)=>v$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:z.object({}),handler:async($)=>Am($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:z.object({}),handler:async($)=>dm($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:z.object({note:z.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>PU($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:z.object({tokenId:z.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>mm($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:z.object({name:z.string().describe("用户姓名"),phone:z.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:z.array(z.string()).optional().describe("权限列表,默认为 []"),departmentIds:z.array(z.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>lm($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>sE($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>pw($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:z.object({keyword:z.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>cw($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>Jl($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:z.object({userId:z.string().describe("用户 ID (_id)")}),handler:async($,I)=>eE($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 S Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:CJ({id:I?.id,sn:I?.sn??I?.sourceDocumentSN??$.sourceDocumentSN,title:I?.title??I?.name,template:BD(I,["template.name","templateName","form.name","formName","formTitle"]),amount:AD(U,["金额","报销金额","付款金额","合计","价税合计"])??BD(I,["amount","totalAmount","expenseAmount"]),expenseType:AD(U,["费用类型","费用类别","报销类型"]),costCompany:AD(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:AD(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:lH1($),attachments:FJ($,{summary:!0}).attachments,aiResult:RD($),manualResult:VI($)?.value,hints:CJ({amountMentions:gZ0(Y,["金额","合计","税率"],8),partyMentions:gZ0(Y,["买方","卖方","甲方","乙方","收款"],8)})}}function pH1($){let I=[["result.citedRules",l5($,"result.citedRules")],["result.matchedRules",l5($,"result.matchedRules")],["result.ruleResults",l5($,"result.ruleResults")],["result.rules",l5($,"result.rules")],["pipelineData.citedRules",l5($,"pipelineData.citedRules")],["pipelineData.matchedRules",l5($,"pipelineData.matchedRules")]],U=[],Y=new Set;for(let[J,Q]of I)(Array.isArray(Q)?Q:Q&&typeof Q==="object"?Object.values(Q):[]).forEach((q,H)=>{let G=FH(q);if(!G)return;let W=Q4(G.runtimeRuleId)??Q4(G.runtimeId)??Q4(G.id)??Q4(G.ruleId),w=Q4(G.ruleCode)??Q4(G.code)??(W?tH1(W):void 0),V=CJ({runtimeRuleId:W,ruleCode:w,versionNumber:dH1(G.versionNumber)??$.ruleSetVersionNumber,scope:Q4(G.scope),strictness:Q4(G.strictness),appliedAnalysis:G.appliedAnalysis??G.analysis??G.reasoning,checkResult:G.checkResult??G.result??G.decision,findings:G.findings??G.riskPoints??G.evidence,sourcePath:`${J}.${H}`}),Z=JSON.stringify(V);if(!Y.has(Z))Y.add(Z),U.push(V)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function BD($,I){if(!$)return;for(let U of I){let Y=l5($,U);if(Y!==void 0)return Y}return}function SZ0($,I){if(!$)return 0;for(let U of I){let Y=l5($,U);if(Array.isArray(Y))return Y.length;if(Y&&typeof Y==="object")return Object.keys(Y).length;if(typeof Y==="number")return Y}return 0}function l5($,I){return I.split(".").reduce((U,Y)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let J=Number(Y);return Number.isInteger(J)?U[J]:void 0}if(typeof U==="object")return U[Y];return},$)}function cH1($,I,U){let Y=I.split("."),J=$;for(let Q of Y.slice(0,-1)){let K=J[Q];if(!K||typeof K!=="object"||Array.isArray(K))J[Q]={};J=J[Q]}J[Y[Y.length-1]??I]=U}function CJ($){return Object.fromEntries(Object.entries($).filter(([,I])=>I!==void 0))}function FH($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function dH1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function mH1($){let I=[];return Mu($,"document",I),I}function Mu($,I,U){if(Array.isArray($)){$.forEach((K,q)=>Mu(K,`${I}.${q}`,U));return}let Y=FH($);if(!Y)return;let J=Q4(Y.label)??Q4(Y.name)??Q4(Y.title)??Q4(Y.fieldName),Q=Y.value??Y.displayValue??Y.text??Y.content;if(J&&Q!==void 0&&typeof Q!=="object")U.push(CJ({path:I,label:J,value:Q,type:Q4(Y.type)??Q4(Y.fieldType)}));for(let[K,q]of Object.entries(Y)){if(K==="attachments")continue;Mu(q,`${I}.${K}`,U)}}function AD($,I){return $.find((Y)=>{let J=Q4(Y.label)??"";return I.some((Q)=>J.includes(Q))})?.value}function lH1($){let I=[];return vD($.result,"result",I),vD($.document,"document",I),I.slice(0,20)}function vD($,I,U){if(Array.isArray($)){$.forEach((J,Q)=>vD(J,`${I}.${Q}`,U));return}let Y=FH($);if(!Y)return;if(/invoice|发票/i.test(I))U.push(CJ({path:I,fileName:Q4(Y.fileName)??Q4(Y.filename)??Q4(Y.name),buyer:Y.buyer??Y.buyerName??Y.purchaserName,seller:Y.seller??Y.sellerName,amount:Y.amount??Y.totalAmount??Y.total,taxRate:Y.taxRate,category:Y.category??Y.type}));for(let[J,Q]of Object.entries(Y))vD(Q,`${I}.${J}`,U)}function gZ0($,I,U){return $.split(/\r?\n/).filter((Y)=>I.some((J)=>Y.includes(J))).slice(0,U)}function PD($){return $.map((I)=>{let U=wI(I);return{recordId:U.id,tenantId:U.tenantId,agentId:U.agentId,sourceDocumentSN:U.sourceDocumentSN,sourceDocumentId:U.sourceDocumentId,simulationBatchId:U.simulationBatchId,langfuseTraceId:U.langfuseTraceId,langfuseSessionFallback:U.langfuseSessionFallback,ruleSetVersionNumber:U.ruleSetVersionNumber,ruleSetPublishedAt:U.ruleSetPublishedAt,ruleSetPublishedByName:U.ruleSetPublishedByName,resolution:U.langfuseTraceId?"trace":U.langfuseSessionFallback?"session-fallback":"unresolved"}})}function Ou($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function oH1($,I){if(I.recordId&&!I.versionId&&!I.versionNumber&&!I.latest){let U=await i4($,I.recordId);if(!U.ruleSetVersionNumber)throw Er Line truncated
`)}function GG1($){let I=[];if(I.push(`seal-use ${$.area} - ${$.title}`),$.description)I.push($.description);I.push(""),I.push("Usage:");for(let U of $.commands)for(let Y of U.usage)I.push(` ${Y}`);if($.commands.some((U)=>U.name))I.push(""),I.push(`Run 'seal-use ${$.area} <command> --help' for details on a specific command.`);return I.join(`
`)}function Iz0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let I of Uz0)for(let U of I.commands)for(let Y of U.usage)$.push(` ${Y}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var wG1=100,VG1=120000,Qz0=["id","code","status","strictness","scope","createdAt","updatedAt"],ZG1=200000;function Su($){return $.map((I)=>typeof I==="string"?I:String(I)).join(" ")}function MH($){if(!$.length)return"";return`${$.join(`
`)}
`}function NH($){return $.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function B0($,I={}){sH1($,I);let U=`${JSON.stringify($,null,2)}
`;if(I.outputFile){oH1(I.outputFile,U),console.log(JSON.stringify({outputFile:I.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function sH1($,I={}){if(I.allowFull||I.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>aH1)throw new TD(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function $z0($,I){if(I)return;let U=$&&typeof $==="object"?$:{},Y=typeof U.count==="number"?U.count:void 0,J=Array.isArray(U.rules)?U.rules.length:void 0,Q=Buffer.byteLength(JSON.stringify($),"utf-8"),K=Y??J??0;if(K>rH1||Q>tH1)throw new TD(`Rule list is large (${K} rules, ${Q} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`,"seal-use rules list --summary")}function w0($){return{allowFull:F0($.full)===!0,outputFile:h($.outputFile)??h($["output-file"])}}function Iz0($=[]){console.log(sZ0($))}function k1($){let I=p8(),U=D4();return FJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},UI())}function VI($=D4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:YI()}}async function D0($,I,U,Y,J={}){B0(await ZI($,I,U,Y),J)}async function ZI($,I,U,Y){let J=XH.find((q)=>q.name===$);if(!J)throw Error(`Unknown Seal tool: ${$}`);let Q=Object.fromEntries(Object.entries(Y).filter(([,q])=>q!==void 0)),K=J.handler;return K(I,Q,{corp:U})}async function Uz0($,I,U,Y,J){if($==="summary"){let Q=await ZI("seal_approval_runs_summary",U,Y,{date:h(J.options.date),timezone:h(J.options.timezone),limit:d0(J.options.limit),startDate:h(J.options.startDate),endDate:h(J.options.endDate),status:h(J.options.status),taskMode:h(J.options.taskMode),manualApprovalStatus:h(J.options.manualApprovalStatus),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),humanResult:h(J.options.humanResult),query:h(J.options.query)});if(Q?.matched===0&&Q?.total>0)console.error(`提示:在 ${Q.date} 未匹配到记录(该企业共有 ${Q.total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-use approval-runs list --limit 10 查看最近记录。`);B0(Q,w0(J.options));return}if($==="stats"){await D0("seal_approval_runs_stats",U,Y,{since:h(J.options.since),dedupeBy:h(J.options.dedupeBy)??h(J.options["dedupe-by"]),status:h(J.options.status),sourceSystem:h(J.options.sourceSystem)??h(J.options["source-system"]),taskMode:h(J.options.taskMode)??h(J.options["task-mode"])},w0(J.options));return}if($==="count"){await D0("seal_approval_runs_count",U,Y,{status:h(J.options.status),sourceSystem:h(J.options.sourceSystem)??h(J.options["source-system"]),taskMode:h(J.options.taskMode)??h(J.options["task-mode"]),search:h(J.options.search)??h(J.options.query)},w0(J.options));return}if($==="search"||$==="list"){await D0("seal_approval_runs_search",U,Y,{limit:d0(J.options.limit),offset:d0(J.options.offset),startDate:h(J.options.startDate),endDate:h(J.options.endDate),status:h(J.options.status),taskMode:h(J.options.taskMode),manualApprovalStatus:h(J.options.manualApprovalStatus),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),humanResult:h(J.options.humanResult),query:h(J.options.query),includeBridge:F0(J.options.includeBridge)},w0(J.options));return}if($==="bridge"){await D0("seal_approval_run_langfuse_bridge_get",U,Y,{recordId:h(J.options.recordId),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),simulationBatchId:h(J.options.simulationBatchId),limit:d0(J.options.limit)},w0(J.options));return}if($==="pick"){let Q=I??h(J.options.query)??h(J.options.sn);if(!Q)throw Error("Usage: seal-use approval-runs pick --sn <documentSN>");await D0("seal_approval_run_pick",U,Y,{query:Q,sn:h(J.options.sn),batchId:h(J.options.batch)??h(J.options.batchId),latest:F0(J.options.latest),fields:h(J.options.fields),limit:d0(J.options.limit),includeBridge:F0(J.options.includeBridge)},w0(J.options));return}if($==="get"){let Q=J.command[2];if(!Q)throw Error("Missing approval run recordId");await D0("seal_approval_run_get",U,Y,{recordId:Q,fields:h(J.options.fields),summary:F0(J.options.summary)},w0(J.options));return}if($==="cited-rules"){let Q=J.command[2];if(!Q)throw Error("Usage: seal-use approval-runs cited-rules <recordId>");await D0("seal_approval_run_cited_rules_get",U,Y,{recordId:Q},w0(J.options));return}if($==="document-summary"){let Q=J.command[2];if(!Q)throw Error("Usage: seal-use approval-runs document-summary <recordId>");await D0("seal_approval_run_document_summary_get",U,Y,{recordId:Q},w0(J.options));return}if($==="attachments"){if(J.command[2]==="download"){let G=J.command[3];if(!G)throw Error("Usage: seal-use approval-runs attachment Line truncated
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let Q=k1(Y),K=k1(J);if(Q.id===K.id)throw j4(`Cannot bind enterprise '${Q.id}' to itself.`);if(Q.prodCorpId&&Q.prodCorpId!==K.id)throw j4(`Cannot use '${Q.id}' as a production enterprise because it is already registered as a test enterprise for '${Q.prodCorpId}'. Multi-tier chaining is not permitted.`);if(K.testCorpId&&K.testCorpId!==Q.id)throw j4(`Cannot bind '${K.id}' as a test enterprise because it already has a bound test enterprise '${K.testCorpId}'. Multi-tier chaining is not permitted.`);let q=F0(U.options.force)===!0;if(Q.testCorpId&&Q.testCorpId!==K.id||K.prodCorpId&&K.prodCorpId!==Q.id){if(!q)throw o8(`Enterprise binding conflict: production enterprise '${Q.id}' is bound to '${Q.testCorpId??"none"}', and test enterprise '${K.id}' is bound to '${K.prodCorpId??"none"}'. Overwriting an existing binding requires --force and --confirm.`,`seal-use corps bind-test ${Q.id} ${K.id} --confirm --force`)}if(!(F0(U.options.confirm)===!0||F0(U.options.yes)===!0)){let w=q?" --force":"";throw o8(`Refusing to bind test enterprise '${K.name}' (${K.id}) to production enterprise '${Q.name}' (${Q.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${K.id}' as a test environment.`,`seal-use corps bind-test ${Q.id} ${K.id} --confirm${w}`)}if(Q.testCorpId&&Q.testCorpId!==K.id)try{O7(Q.testCorpId,{prodCorpId:void 0})}catch{}if(K.prodCorpId&&K.prodCorpId!==Q.id)try{O7(K.prodCorpId,{testCorpId:void 0})}catch{}let G=O7(Q.id,{environment:"production",testCorpId:K.id}),W=O7(K.id,{environment:"test",prodCorpId:Q.id});B0({success:!0,productionEnterprise:{id:G.id,name:G.name,environment:G.environment,testCorpId:G.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}});return}if($==="unbind-test"){let Y=I??h(U.options.corp),J=k1(Y);if(!J.testCorpId&&!J.prodCorpId){B0({unbound:!1,message:`Enterprise '${J.name}' (${J.id}) does not have an active test enterprise binding.`});return}let Q=J.testCorpId?J.id:J.prodCorpId,K=J.testCorpId?J.testCorpId:J.id;if(!(F0(U.options.confirm)===!0||F0(U.options.yes)===!0))throw o8(`Refusing to unbind production enterprise '${Q}' and test enterprise '${K}' without --confirm.`,`seal-use corps unbind-test ${J.id} --confirm`);O7(Q,{testCorpId:void 0});try{O7(K,{prodCorpId:void 0})}catch{}B0({success:!0,unboundProduction:Q,unboundTest:K});return}if($==="sync-test"){let Y=I??h(U.options.corp),J=k1(Y);if(!J.testCorpId)throw j4(`Production enterprise '${J.name}' (${J.id}) has no bound test enterprise.
Run 'seal-use corps bind-test ${J.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`);let Q=k1(J.testCorpId);if(Q.environment!=="test")throw Error(`Target enterprise '${Q.name}' (${Q.id}) is marked as '${Q.environment}', NOT 'test'. Aborting sync to protect non-test environments.`);let K=await n1(J),q=await n1(Q),H=await g1(K,J.seal.endpoints.approvalStylePreferences),G=await g1(q,Q.seal.endpoints.approvalStylePreferences),W=await C6(K),w=await C6(q),V={...G,tone:H.tone,language:H.language,detailLevel:H.detailLevel,outputFormat:H.outputFormat,examples:H.examples??[],prohibitedPhrases:H.prohibitedPhrases??[],customInstructions:H.customInstructions,decisionPreferences:H.decisionPreferences,thinkingDepthPreference:H.thinkingDepthPreference},Z=h(U.options["version-name"])??h(U.options.versionName),X=new Date().toISOString().slice(0,10),L=Z??`Sync from ${J.name} (${X})`;if(F0(U.options["dry-run"])===!0||F0(U.options.dryRun)===!0){B0({dryRun:!0,source:{id:J.id,name:J.name,environment:J.environment},target:{id:Q.id,name:Q.name,environment:Q.environment},preferencesDiff:{decisionPreferences:{before:G.decisionPreferences,after:H.decisionPreferences},thinkingDepthPreference:{before:G.thinkingDepthPreference,after:H.thinkingDepthPreference}},rulesPlan:{sourceDraftRuleCount:W.rules.length,targetExistingDraftRuleCount:w.rules.length,toDeleteCount:w.rules.length,toCreateCount:W.rules.length,rulesToSync:W.rules.map((A,R)=>({index:R+1,description:A.description,scope:A.scope,strictness:A.strictness}))},publishingPlan:{targetCorpId:Q.id,publishVersionName:L,publishTarget:"test"},productionGuarantees:{prodRulesStayDraft:!0,prodVersionPublished:!1}});return}if(!(F0(U.options.yes)===!0||F0(U.options.confirm)===!0))throw o8(`Refusing to overwrite test enterprise '${Q.name}' (${Q.id}) with preferences and ${W.rules.length} draft rules from production enterprise '${J.name}' (${J.id}) without --yes. This will replace test draft rules and publish a new version on the test enterprise.`,`seal-use corps sync-test ${J.id} --yes`);await W5(q,V,Q.seal.endpoints.approvalStylePreferences);for(let A of w.rules)await PU(q,A.id);let E=[];for(let A of W.rules){let R=await F2(q,{description:A.description,scope:A.scope,strictness:A.strictness});E.push(R)}await cw(q).catch(()=>{return});let T=await M2(q,L);B0({success:!0,syncedAt:new Date().toISOString(),source:{id:J.id,name:J.name,environment:J.environment,draftRulesCount:W.rules.length},target:{id:Q.id,name:Q.name,environment:Q.environment,deletedDraftRulesCount:w.rules.length,createdDraftRulesCount:E.length,publishedVersion:{id:T.version.id,versionNumber:T.version.versionNumber,versionName:T.version.versionName,rulesCount:T.rulesCount}},productionGuarantees:{prodRulesStayDraft:!0,prodVersionPublished:!1}});return}if($==="switch"){let Y=I;if(!Y)throw Error("Usage: seal-use corps switch <corpId>");let J=D4();if(!J.stateful)throw Error("Cannot switch the default enterprise while stateless mode is enabled. Use `seal-use config mode stateful` first.");let Q=k1(Y);JI({...J,stateful:!0,defaultCorpId:Q.id}),B0({current:!0,id:Q.id,name:Q.name});return}if($==="probe-hose"){await UG1(s6(U.json));return}if($==="hose-staffs"){await YG1(s6(U.json));return}if($==="add-hose"){await JG1(s6(U.json));return}if($==="add-seal"){await QG1(s6(U.json));return}if($==="add-link"){let Y=I??h(U.options.link)??h(U.options.url);if(!Y)throw Error("Usage: seal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]");await KG1(Y,h(U.options.name),F0(U.options.overwrite)===!0);return}throw Error(`Unknown corps command: ${$??""}. Run 'seal-use help' for available commands.`)}async function UG1($){let I=M7($,"appKey"),U=M7($,"appSecurity"),Y=c1($,"domain"),J=await NU(I,U,Y),Q=await yw(J.domain,J.openapiToken).catch(()=>[]),K=Q.reduce((q,H)=>q+H.roleDefs.length,0);B0({domain:J.domain,corpId:J.corpId,name:J.corpName??J.corpId,roleCount:K,roleGroups:Q.map((q)=>({id:q.id,name:q.name,roleDefs:q.roleDefs.map((H)=>({id:H.id,name:H.name,sourceType:H.sourceType}))}))})}async function YG1($){let I=M7($,"appKey"),U=M7($,"appSecurity"),Y=c1($,"domain"),J=c1($,"role")??c1($,"roleDefId")??"admin",Q=await NU(I,U,Y),K=await yw(Q.domain,Q.openapiToken),q,H;for(let w of K){for(let V of w.roleDefs)if(V.id===J||V.id===`${Q.corpId}:${J}`){q=V.id,H=V.name;break}if(q)break}if(!q&&(J==="admin"||J==="主管理员"))for(let w of K){for(let V of w.roleDefs)if(V.id.endsWith(":admin")||V.name==="主管理员"){q=V.id,H=V.name;break}if(q)break}if(!q)for(let w of K){for(let V of w.roleDefs)if(V.name.toLowerCase().includes(J.toLowerCase())){q=V.id,H=V.name;break}if(q)break}if(!q)throw Error(`Role not found matching query: '${J}'. Run 'seal-use corps probe-hose' to view all available roles.`);let G=await RE(Q.domain,Q.openapiToken,q),W=await CE(Q.domain,Q.openapiToken,G.staffs);B0({domain:Q.domain,corpId:Q.corpId,corpName:Q.corpName??Q.corpId,roleId:q,roleName:H,count:W.length,staffs:W.map((w)=>( Line truncated
- `);throw Error(`Missing required parameter: staffId. Found ${C.length} candidate administrators:
`}function AH($){return $.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function B0($,I={}){zG1($,I);let U=`${JSON.stringify($,null,2)}
`;if(I.outputFile){WG1(I.outputFile,U),console.log(JSON.stringify({outputFile:I.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function zG1($,I={}){if(I.allowFull||I.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>ZG1)throw new jD(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function Kz0($,I){if(I)return;let U=$&&typeof $==="object"?$:{},Y=typeof U.count==="number"?U.count:void 0,J=Array.isArray(U.rules)?U.rules.length:void 0,Q=Buffer.byteLength(JSON.stringify($),"utf-8"),K=Y??J??0;if(K>wG1||Q>VG1)throw new jD(`Rule list is large (${K} rules, ${Q} bytes). Use "seal-use rules list --summary" or "seal-use rules count"; pass --full only when you really need full descriptions.`,"seal-use rules list --summary")}function V0($){return{allowFull:N0($.full)===!0,outputFile:h($.outputFile)??h($["output-file"])}}function qz0($=[]){console.log(Jz0($))}function b1($){let I=l8(),U=F4();return NJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},YI())}function ZI($=F4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:JI()}}async function F0($,I,U,Y,J={}){B0(await zI($,I,U,Y),J)}async function zI($,I,U,Y){let J=DH.find((q)=>q.name===$);if(!J)throw Error(`Unknown Seal tool: ${$}`);let Q=Object.fromEntries(Object.entries(Y).filter(([,q])=>q!==void 0)),K=J.handler;return K(I,Q,{corp:U})}async function Hz0($,I,U,Y,J){if($==="summary"){let Q=await zI("seal_approval_runs_summary",U,Y,{date:h(J.options.date),timezone:h(J.options.timezone),limit:m0(J.options.limit),startDate:h(J.options.startDate),endDate:h(J.options.endDate),status:h(J.options.status),taskMode:h(J.options.taskMode),manualApprovalStatus:h(J.options.manualApprovalStatus),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),humanResult:h(J.options.humanResult),query:h(J.options.query)});if(Q?.matched===0&&Q?.total>0)console.error(`提示:在 ${Q.date} 未匹配到记录(该企业共有 ${Q.total} 条历史记录)。可使用 --date YYYY-MM-DD 指定日期,或运行 seal-use approval-runs list --limit 10 查看最近记录。`);B0(Q,V0(J.options));return}if($==="stats"){await F0("seal_approval_runs_stats",U,Y,{since:h(J.options.since),dedupeBy:h(J.options.dedupeBy)??h(J.options["dedupe-by"]),status:h(J.options.status),sourceSystem:h(J.options.sourceSystem)??h(J.options["source-system"]),taskMode:h(J.options.taskMode)??h(J.options["task-mode"])},V0(J.options));return}if($==="count"){await F0("seal_approval_runs_count",U,Y,{status:h(J.options.status),sourceSystem:h(J.options.sourceSystem)??h(J.options["source-system"]),taskMode:h(J.options.taskMode)??h(J.options["task-mode"]),search:h(J.options.search)??h(J.options.query)},V0(J.options));return}if($==="search"||$==="list"){await F0("seal_approval_runs_search",U,Y,{limit:m0(J.options.limit),offset:m0(J.options.offset),startDate:h(J.options.startDate),endDate:h(J.options.endDate),status:h(J.options.status),taskMode:h(J.options.taskMode),manualApprovalStatus:h(J.options.manualApprovalStatus),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),humanResult:h(J.options.humanResult),query:h(J.options.query),includeBridge:N0(J.options.includeBridge)},V0(J.options));return}if($==="bridge"){await F0("seal_approval_run_langfuse_bridge_get",U,Y,{recordId:h(J.options.recordId),sourceDocumentSN:h(J.options.sourceDocumentSN),sourceDocumentId:h(J.options.sourceDocumentId),simulationBatchId:h(J.options.simulationBatchId),limit:m0(J.options.limit)},V0(J.options));return}if($==="pick"){let Q=I??h(J.options.query)??h(J.options.sn);if(!Q)throw Error("Usage: seal-use approval-runs pick --sn <documentSN>");await F0("seal_approval_run_pick",U,Y,{query:Q,sn:h(J.options.sn),batchId:h(J.options.batch)??h(J.options.batchId),latest:N0(J.options.latest),fields:h(J.options.fields),limit:m0(J.options.limit),includeBridge:N0(J.options.includeBridge)},V0(J.options));return}if($==="get"){let Q=J.command[2];if(!Q)throw Error("Missing approval run recordId");await F0("seal_approval_run_get",U,Y,{recordId:Q,fields:h(J.options.fields),summary:N0(J.options.summary)},V0(J.options));return}if($==="cited-rules"){let Q=J.command[2];if(!Q)throw Error("Usage: seal-use approval-runs cited-rules <recordId>");await F0("seal_approval_run_cited_rules_get",U,Y,{recordId:Q},V0(J.options));return}if($==="document-summary"){let Q=J.command[2];if(!Q)throw Error("Usage: seal-use approval-runs document-summary <recordId>");await F0("seal_approval_run_document_summary_get",U,Y,{recordId:Q},V0(J.options));return}if($==="attachments"){if(J.command[2]==="download"){let G=J.command[3];if(!G)throw Error("Usage: seal-use approval-runs attachment Line truncated
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let Q=b1(Y),K=b1(J);if(Q.id===K.id)throw _4(`Cannot bind enterprise '${Q.id}' to itself.`);if(Q.prodCorpId&&Q.prodCorpId!==K.id)throw _4(`Cannot use '${Q.id}' as a production enterprise because it is already registered as a test enterprise for '${Q.prodCorpId}'. Multi-tier chaining is not permitted.`);if(K.testCorpId&&K.testCorpId!==Q.id)throw _4(`Cannot bind '${K.id}' as a test enterprise because it already has a bound test enterprise '${K.testCorpId}'. Multi-tier chaining is not permitted.`);let q=N0(U.options.force)===!0;if(Q.testCorpId&&Q.testCorpId!==K.id||K.prodCorpId&&K.prodCorpId!==Q.id){if(!q)throw s8(`Enterprise binding conflict: production enterprise '${Q.id}' is bound to '${Q.testCorpId??"none"}', and test enterprise '${K.id}' is bound to '${K.prodCorpId??"none"}'. Overwriting an existing binding requires --force and --confirm.`,`seal-use corps bind-test ${Q.id} ${K.id} --confirm --force`)}if(!(N0(U.options.confirm)===!0||N0(U.options.yes)===!0)){let w=q?" --force":"";throw s8(`Refusing to bind test enterprise '${K.name}' (${K.id}) to production enterprise '${Q.name}' (${Q.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${K.id}' as a test environment.`,`seal-use corps bind-test ${Q.id} ${K.id} --confirm${w}`)}if(Q.testCorpId&&Q.testCorpId!==K.id)try{O7(Q.testCorpId,{prodCorpId:void 0})}catch{}if(K.prodCorpId&&K.prodCorpId!==Q.id)try{O7(K.prodCorpId,{testCorpId:void 0})}catch{}let G=O7(Q.id,{environment:"production",testCorpId:K.id}),W=O7(K.id,{environment:"test",prodCorpId:Q.id});B0({success:!0,productionEnterprise:{id:G.id,name:G.name,environment:G.environment,testCorpId:G.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}});return}if($==="unbind-test"){let Y=I??h(U.options.corp),J=b1(Y);if(!J.testCorpId&&!J.prodCorpId){B0({unbound:!1,message:`Enterprise '${J.name}' (${J.id}) does not have an active test enterprise binding.`});return}let Q=J.testCorpId?J.id:J.prodCorpId,K=J.testCorpId?J.testCorpId:J.id;if(!(N0(U.options.confirm)===!0||N0(U.options.yes)===!0))throw s8(`Refusing to unbind production enterprise '${Q}' and test enterprise '${K}' without --confirm.`,`seal-use corps unbind-test ${J.id} --confirm`);O7(Q,{testCorpId:void 0});try{O7(K,{prodCorpId:void 0})}catch{}B0({success:!0,unboundProduction:Q,unboundTest:K});return}if($==="sync-test"){let Y=I??h(U.options.corp),J=b1(Y);if(!J.testCorpId)throw _4(`Production enterprise '${J.name}' (${J.id}) has no bound test enterprise.
Run 'seal-use corps bind-test ${J.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`);let Q=b1(J.testCorpId);if(Q.environment!=="test")throw Error(`Target enterprise '${Q.name}' (${Q.id}) is marked as '${Q.environment}', NOT 'test'. Aborting sync to protect non-test environments.`);let K=await c1(J),q=await c1(Q),[H,G,W,w,V,Z,X,L]=await Promise.all([M1(K,J.seal.endpoints.approvalStylePreferences).catch(()=>({})),M1(q,Q.seal.endpoints.approvalStylePreferences).catch(()=>({})),_6(K),_6(q),R$(K).catch(()=>[]),R$(q).catch(()=>[]),O9(K,{limit:100}).catch(()=>({articles:[]})),O9(q,{limit:100}).catch(()=>({articles:[]}))]),D=(X.articles||[]).filter((Q0)=>!Q0.isDeleted),O=(L.articles||[]).filter((Q0)=>!Q0.isDeleted),E=new Map(O.map((Q0)=>[Q0.title.trim(),Q0])),T=[],A=[],R=new Set(D.map((Q0)=>Q0.title.trim()));for(let Q0 of D){let R0=Q0.title.trim(),U1=E.get(R0);if(!U1)T.push(Q0);else{let F1=U1.content!==Q0.content,f4=(U1.purpose??"")!==(Q0.purpose??""),f6=U1.enabled!==Q0.enabled,F$=U1.contentType!==Q0.contentType,b6=(U1.status??"")!==(Q0.status??""),P6=JSON.stringify([...U1.scenarios??[]].sort())!==JSON.stringify([...Q0.scenarios??[]].sort()),O$=JSON.stringify([...U1.tags??[]].sort())!==JSON.stringify([...Q0.tags??[]].sort());if(F1||f4||f6||F$||b6||P6||O$)A.push({testId:U1.id,prodDoc:Q0,reasons:[...F1?["content"]:[],...f4?["purpose"]:[],...f6?["enabled"]:[],...F$?["contentType"]:[],...b6?["status"]:[],...P6?["scenarios"]:[],...O$?["tags"]:[]]})}}let k=O.filter((Q0)=>!R.has(Q0.title.trim())),f=[...V].sort((Q0,R0)=>R0.versionNumber-Q0.versionNumber)[0],j=f?.versionNumber,n=([...Z].sort((Q0,R0)=>R0.versionNumber-Q0.versionNumber)[0]?.versionNumber??0)+1,S=Ez0(J.name,j,Z),i=h(U.options["version-name"])??h(U.options.versionName)??Bz0(J.name,j,S,n),U0={...G,tone:H.tone,language:H.language,detailLevel:H.detailLevel,outputFormat:H.outputFormat,examples:H.examples??[],prohibitedPhrases:H.prohibitedPhrases??[],customInstructions:H.customInstructions,decisionPreferences:H.decisionPreferences,thinkingDepthPreference:H.thinkingDepthPreference};if(N0(U.options["dry-run"])===!0||N0(U.options.dryRun)===!0){B0({dryRun:!0,source:{id:J.id,name:J.name,environment:J.environment,latestPublishedVersion:f?{versionNumber:f.versionNumber,versionName:f.versionName}:null,documentsCount:D.length},target:{id:Q.id,name:Q.name,environment:Q.environment},versionMappingPlan:{sourceProdVersionNumber:j??null,sourceProdVersionName:f?.versionName??null,targetTestExpectedVersionNumber:n,targetTestPublishVersionName:i,iteration:S},preferencesDiff:{decisionPreferences:{before:G.decisionPreferences,after:H.decisionPreferences},thinkingDepthPreference:{before:G.thinkingDepthPreference,after:H.thinkingDepthPreference}},rulesPlan:{sourceDraftRuleCount:W.rules.length,targetExistingDraftRuleCount:w.rules.length,toDeleteCount:w.rules.length,toCreateCount:W.rules.length,rulesToSync:W.rules.map((Q0,R0)=>({index:R0+1,sourceRuleId:Q0.id,sourceRuleCode:Q0.code??R0+1,expectedTargetCode:`rule-${R0+1}`,description:Q0.description,scope:Q0.scope,strictness:Q0.strictness}))},documentsPlan:{sourceDocumentCount:D.length,targetExistingDocumentCount:O.length,toCreateCount:T.length,toCreate:T.map((Q0)=>({title:Q0.title,purpose:Q0.purpose,contentType:Q0.contentType,scenarios:Q0.scenarios})),toUpdateCount:A.length,toUpdate:A.map((Q0)=>({targetDocumentId:Q0.testId,title:Q0.prodDoc.title,reasons:Q0.reasons})),toDeleteCount:k.length,toDelete:k.map((Q0)=>({targetDocumentId:Q0.id,title:Q0.title}))},publishingPlan:{targetCorpId:Q.id,publishVersionName:i,publishTarget:"test"},hosecloudSyncPlan:(()=>{if(J.source.type!=="hose")return{sourceType:J.source.type,skipped:!0,reason:"prod source is not hose; no hosecloud credentials available"};let Q0=(H.integrations??[]).filter((F1)=>F1.type==="hosecloud"),R0=new Set,U1=Q0.filter((F1)=>{let f4=F1.corporationId??J.id;if(R0.has(f4))return!1;return R0.add(f4),!0});return{sourceType:"hose",outboundName:Sz0(J.name),targetMode:"assisted",integrationsCount:U1.length,integrations:U1.map((F1)=>({corporationId:F1.corporationId,apiOrigin:F1.apiOrigin,customApiUrl:F1.customApiUrl}))}})(),productionGuarantees:{prodRulesStayDraft:!0,prodVersionPublished:!1}});return}if(!(N0(U.options.yes)===!0||N0(U.options.confirm)===!0))throw s8(`Refusing to overwrite test enterprise '${Q.name}' (${Q.id}) with preferences, ${W.rules.length} draft rules, and ${D.length} knowledge documents from production enterprise '${J.name}' (${J.id}) without --yes. This will replace test draft rules, synchronize knowledge documents, and publish a new version on the test enterprise.`,`seal-use corps sync-test ${J.id} --yes`);await O8(q,U0,Q.seal.endpoints.approvalStylePreferences);let c=[];for(let Q0 of k)await rw(q,Q0.id),c.push({id:Q0.id,title:Q0.title});let r=[];for(let Q0 of A)await ow(q,Q0.testId,{title:Q0.prodDoc.title,purpose:Q0.prodDoc.purpose,content:Q0.prodDoc.content,contentType:Q0.prodDoc.contentType,status:Q0.prodDoc.status,enabled:Q0.prodDoc.ena Line truncated
- `);throw Error(`Missing required parameter: staffId. Found ${j.length} candidate administrators:
- ${p}
Please specify 'staffId', 'staffName', or 'staffPhone' to explicitly select an account (or pass force:true to bypass).`)}}}if(!L)if(!W&&Q)L=Q;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");let D=c1($,"id")??V,F=Z??V,E=c1($,"sealUrl")??`https://${V.toLowerCase()}.sealai.cc`,T={id:D,name:F,environment:"production",seal:{url:E,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",domain:w,appKey:U,appSecurity:Y,corpId:V,staffId:L},auth:{refreshTtl:300}};if(W)Cw(D),await jJ(T);let A=wh();Xz0(A,{recursive:!0,mode:448});let R=Dz0(A,`${Au(D)}.json`);if(zz0(R)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${R}. Pass "overwrite": true to replace it.`);Lz0(R,`${JSON.stringify(T,null,2)}
`,{mode:384}),B0({id:D,name:F,corpId:V,domain:w,staffId:L,verified:W,path:R})}async function QG1($){let I=M7($,"token"),U=(c1($,"sealUrl")??c1($,"url")??"").replace(/\/+$/,"");if(!U)throw Error("Missing required JSON field: sealUrl");let Y=dZ0($,"expiresIn")??2592000,J=$.force===!0||$.verify===!1?!1:!0,Q=Fz0($),K=J?await qG1(U,I,z2(Q)):void 0;Nz0($,{token:I,sealUrl:U,expiresIn:Y,verify:J,remote:K,custom:Q})}function Fz0($){return{headers:qh.parse($.headers),cookies:Hh.parse($.cookies)}}async function KG1($,I,U){let Y=await jw($),J=X2(Y.sealUrl,Y.token),Q=await P$(J),K={user:Q.user,tenant:Q.tenant};_w(Y.corpId,K.tenant),Nz0({id:Y.corpId,corpId:Y.corpId,name:I,provider:"hosecloud",overwrite:U},{token:Y.token,sealUrl:Y.sealUrl,expiresIn:Y.expiresIn,verify:!0,remote:K})}function Nz0($,I){let{token:U,sealUrl:Y,expiresIn:J,verify:Q,remote:K}=I,q=I.custom??Fz0($),H=K?.user,G=K?.tenant,W=c1($,"tenantSlug")??A7(G?.tenantSlug),w=c1($,"tenantId")??A7(G?.id),V=c1($,"tenantName")??A7(G?.name),Z=c1($,"id")??W??w;if(!Z)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let X=c1($,"staffId")??A7(H?.providerUserId)??A7(H?.id)??"seal",L=c1($,"provider")??A7(H?.provider)??A7(G?.providerConfig?.provider),D=c1($,"corpId")??W??w??Z,F={id:Z,name:c1($,"name")??V??Z,environment:"production",seal:{url:Y,tenantSlug:W,headers:q.headers,cookies:q.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:U,sealUrl:Y,expiresIn:J,staffId:X,corpId:D,tenantId:w,tenantSlug:W,tenantName:V,providerUserId:A7(H?.providerUserId),provider:L},auth:{refreshTtl:300}},E=wh();Xz0(E,{recursive:!0,mode:448});let T=Dz0(E,`${Au(Z)}.json`);if(zz0(T)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${T}. Pass "overwrite": true to replace it.`);Lz0(T,`${JSON.stringify(F,null,2)}
`,{mode:384}),B0({id:Z,name:F.name,tenantId:w,tenantSlug:W,verified:Q,path:T})}async function qG1($,I,U={}){let Y=await HG1(`${$}/api/v1/auth/me`,{...U,authorization:`Bearer ${I}`}),J=vD(Y.data);return{user:vD(J.user??Y.user),tenant:vD(J.tenant??Y.tenant)}}async function HG1($,I={}){let U=await fetch($,{headers:I}),Y=await U.text();if(!U.ok)throw Error(`${U.status} ${Y}`);let J=JSON.parse(Y);return vD(J)}function vD($){return $&&typeof $==="object"&&!Array.isArray($)?$:{}}function A7($){return typeof $==="string"&&$?$:void 0}async function Mz0($,I){let U=await jw($),Y=X2(U.sealUrl,U.token),J=await P$(Y);_w(U.corpId,J.tenant);let Q=await AU(Y,{note:I});B0({tenant:{id:J.tenant.id,name:J.tenant.name,tenantSlug:J.tenant.tenantSlug,corpId:U.corpId},user:{id:J.user.id,name:J.user.name,providerUserId:J.user.providerUserId,isAdmin:J.user.isAdmin},delegation:Q,expiresIn:U.expiresIn})}async function Az0($,I,U,Y,J){if($==="list"){await D0("seal_delegation_list",U,Y,{},w0(J.options));return}if($==="create"){let Q=h(J.options.note)??(I?[I,...J.command.slice(2)].join(" "):void 0);await D0("seal_delegation_create",U,Y,{note:Q},w0(J.options));return}if($==="revoke"){let Q=I??h(J.options.tokenId);if(!Q)throw Error("Usage: seal-use delegation revoke <tokenId>");await D0("seal_delegation_revoke",U,Y,{tokenId:Q},w0(J.options));return}throw Error(`Unknown delegation command: ${$??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as GG1}from"node:fs";async function Pz0($,I,U,Y,J,Q){if(!$||$==="help")throw Error(`Usage: seal-use deploy <system> <action> [options]
Please specify 'staffId', 'staffName', or 'staffPhone' to explicitly select an account (or pass force:true to bypass).`)}}}if(!L)if(!W&&Q)L=Q;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");let D=m1($,"id")??V,O=Z??V,E=m1($,"sealUrl")??`https://${V.toLowerCase()}.sealai.cc`,T={id:D,name:O,environment:"production",seal:{url:E,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",domain:w,appKey:U,appSecurity:Y,corpId:V,staffId:L},auth:{refreshTtl:300}};if(W)_w(D),await _J(T);let A=Dh();Rz0(A,{recursive:!0,mode:448});let R=Cz0(A,`${Ru(D)}.json`);if(vz0(R)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${R}. Pass "overwrite": true to replace it.`);jz0(R,`${JSON.stringify(T,null,2)}
`,{mode:384}),B0({id:D,name:O,corpId:V,domain:w,staffId:L,verified:W,path:R})}async function vG1($){let I=A7($,"token"),U=(m1($,"sealUrl")??m1($,"url")??"").replace(/\/+$/,"");if(!U)throw Error("Missing required JSON field: sealUrl");let Y=tZ0($,"expiresIn")??2592000,J=$.force===!0||$.verify===!1?!1:!0,Q=gz0($),K=J?await jG1(U,I,X2(Q)):void 0;yz0($,{token:I,sealUrl:U,expiresIn:Y,verify:J,remote:K,custom:Q})}function gz0($){return{headers:Zh.parse($.headers),cookies:zh.parse($.cookies)}}async function RG1($,I,U){let Y=await Sw($),J=L2(Y.sealUrl,Y.token),Q=await v$(J),K={user:Q.user,tenant:Q.tenant};gw(Y.corpId,K.tenant),yz0({id:Y.corpId,corpId:Y.corpId,name:I,provider:"hosecloud",overwrite:U},{token:Y.token,sealUrl:Y.sealUrl,expiresIn:Y.expiresIn,verify:!0,remote:K})}function yz0($,I){let{token:U,sealUrl:Y,expiresIn:J,verify:Q,remote:K}=I,q=I.custom??gz0($),H=K?.user,G=K?.tenant,W=m1($,"tenantSlug")??P7(G?.tenantSlug),w=m1($,"tenantId")??P7(G?.id),V=m1($,"tenantName")??P7(G?.name),Z=m1($,"id")??W??w;if(!Z)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let X=m1($,"staffId")??P7(H?.providerUserId)??P7(H?.id)??"seal",L=m1($,"provider")??P7(H?.provider)??P7(G?.providerConfig?.provider),D=m1($,"corpId")??W??w??Z,O={id:Z,name:m1($,"name")??V??Z,environment:"production",seal:{url:Y,tenantSlug:W,headers:q.headers,cookies:q.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:U,sealUrl:Y,expiresIn:J,staffId:X,corpId:D,tenantId:w,tenantSlug:W,tenantName:V,providerUserId:P7(H?.providerUserId),provider:L},auth:{refreshTtl:300}},E=Dh();Rz0(E,{recursive:!0,mode:448});let T=Cz0(E,`${Ru(Z)}.json`);if(vz0(T)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${T}. Pass "overwrite": true to replace it.`);jz0(T,`${JSON.stringify(O,null,2)}
`,{mode:384}),B0({id:Z,name:O.name,tenantId:w,tenantSlug:W,verified:Q,path:T})}async function jG1($,I,U={}){let Y=await CG1(`${$}/api/v1/auth/me`,{...U,authorization:`Bearer ${I}`}),J=gD(Y.data);return{user:gD(J.user??Y.user),tenant:gD(J.tenant??Y.tenant)}}async function CG1($,I={}){let U=await fetch($,{headers:I}),Y=await U.text();if(!U.ok)throw Error(`${U.status} ${Y}`);let J=JSON.parse(Y);return gD(J)}function gD($){return $&&typeof $==="object"&&!Array.isArray($)?$:{}}function P7($){return typeof $==="string"&&$?$:void 0}async function hz0($,I){let U=await Sw($),Y=L2(U.sealUrl,U.token),J=await v$(Y);gw(U.corpId,J.tenant);let Q=await PU(Y,{note:I});B0({tenant:{id:J.tenant.id,name:J.tenant.name,tenantSlug:J.tenant.tenantSlug,corpId:U.corpId},user:{id:J.user.id,name:J.user.name,providerUserId:J.user.providerUserId,isAdmin:J.user.isAdmin},delegation:Q,expiresIn:U.expiresIn})}async function uz0($,I,U,Y,J){if($==="list"){await F0("seal_delegation_list",U,Y,{},V0(J.options));return}if($==="create"){let Q=h(J.options.note)??(I?[I,...J.command.slice(2)].join(" "):void 0);await F0("seal_delegation_create",U,Y,{note:Q},V0(J.options));return}if($==="revoke"){let Q=I??h(J.options.tokenId);if(!Q)throw Error("Usage: seal-use delegation revoke <tokenId>");await F0("seal_delegation_revoke",U,Y,{tokenId:Q},V0(J.options));return}throw Error(`Unknown delegation command: ${$??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as _G1}from"node:fs";async function xz0($,I,U,Y,J,Q){if(!$||$==="help")throw Error(`Usage: seal-use deploy <system> <action> [options]
`+`支持的审批系统与发布目标:
`+` • hosecloud (合思费控): seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>
@@ -457,25 +337,25 @@ Please specify 'staffId', 'staffName', or 'staffPhone' to explicitly select an a
`+` • feishu (飞书审批): 建议使用 Webhook 模式对接
`+` • weaver (泛微 OA): 建议使用 Webhook 模式对接
`+` • helios (汇联易): 建议使用 Webhook 模式对接
`+" • 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 G=$==="maycur"?"每刻报销":"汇联易";throw Error(`${G}发布:目前可通过 Webhook 模式接入。命令:seal-use webhook add --name '${G}' --result-url <url> --corp <corpId>`)}let K=$==="hosecloud",q=$==="hosecloud"?I:$,H=$==="hosecloud"?U:I;if(!K)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(q==="requirements"){await D0("seal_deploy_hosecloud_requirements",Y,J,{},w0(Q.options));return}if(q==="list"){await D0("seal_deploy_hosecloud_list",Y,J,{},w0(Q.options));return}if(q==="get"){let G=H??h(Q.options.signKey)??h(Q.options["sign-key"]);if(!G){let w=((await g1(Y)).integrations??[]).filter((V)=>V.type==="hosecloud");if(w.length===0)throw Error(`当前企业 (${J.name}) 尚未添加合思发布配置。
`+" • 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 G=$==="maycur"?"每刻报销":"汇联易";throw Error(`${G}发布:目前可通过 Webhook 模式接入。命令:seal-use webhook add --name '${G}' --result-url <url> --corp <corpId>`)}let K=$==="hosecloud",q=$==="hosecloud"?I:$,H=$==="hosecloud"?U:I;if(!K)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(q==="requirements"){await F0("seal_deploy_hosecloud_requirements",Y,J,{},V0(Q.options));return}if(q==="list"){await F0("seal_deploy_hosecloud_list",Y,J,{},V0(Q.options));return}if(q==="get"){let G=H??h(Q.options.signKey)??h(Q.options["sign-key"]);if(!G){let w=((await M1(Y)).integrations??[]).filter((V)=>V.type==="hosecloud");if(w.length===0)throw Error(`当前企业 (${J.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${J.id}`);console.error(`Usage: seal-use deploy hosecloud get <sign-key> [--corp ${J.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of w){let Z=V.outboundName??"SealAI 审批",X=V.signKey,L=V.apiOrigin??"production";console.error(` • "${Z}" (signKey: ${X}, 环境: ${L})`),console.error(` \uD83D\uDC49 查看命令: seal-use deploy hosecloud get ${X} --corp ${J.id}
`)}throw new l8("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。",2,w.length===1?`seal-use deploy hosecloud get ${w[0].signKey} --corp ${J.id}`:void 0)}await D0("seal_deploy_hosecloud_get",Y,J,{signKey:G},w0(Q.options));return}if(q==="status"){await D0("seal_deploy_hosecloud_status",Y,J,{},w0(Q.options));return}if(q==="configure"){let G=h(Q.options.input),W=G?JSON.parse(GG1(G,"utf8")):s6(Q.json);if(!W||Object.keys(W).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await D0("seal_deploy_hosecloud_configure",Y,J,{...W,dryRun:F0(Q.options.dryRun)??F0(Q.options["dry-run"])},w0(Q.options));return}if(q==="sync"){let G=H??h(Q.options.signKey)??h(Q.options["sign-key"]),W=F0(Q.options.auto)??F0(Q.options.yes);if(!G){let V=((await g1(Y)).integrations??[]).filter((X)=>X.type==="hosecloud");if(V.length===0)throw Error(`当前企业 (${J.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${J.id}`);let Z=V[0];if(Z&&V.length===1&&W){let X=Z.signKey;console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${X})`),await D0("seal_deploy_hosecloud_sync",Y,J,{signKey:X},w0(Q.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${J.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let L=X.outboundName??"SealAI 审批",D=X.signKey,F=X.apiOrigin??"production";console.error(` • "${L}" (signKey: ${D}, 环境: ${F})`),console.error(` \uD83D\uDC49 同步命令: seal-use deploy hosecloud sync ${D} --corp ${J.id}
`)}throw new a8("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。",2,w.length===1?`seal-use deploy hosecloud get ${w[0].signKey} --corp ${J.id}`:void 0)}await F0("seal_deploy_hosecloud_get",Y,J,{signKey:G},V0(Q.options));return}if(q==="status"){await F0("seal_deploy_hosecloud_status",Y,J,{},V0(Q.options));return}if(q==="configure"){let G=h(Q.options.input),W=G?JSON.parse(_G1(G,"utf8")):U$(Q.json);if(!W||Object.keys(W).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await F0("seal_deploy_hosecloud_configure",Y,J,{...W,dryRun:N0(Q.options.dryRun)??N0(Q.options["dry-run"])},V0(Q.options));return}if(q==="sync"){let G=H??h(Q.options.signKey)??h(Q.options["sign-key"]),W=N0(Q.options.auto)??N0(Q.options.yes);if(!G){let V=((await M1(Y)).integrations??[]).filter((X)=>X.type==="hosecloud");if(V.length===0)throw Error(`当前企业 (${J.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${J.id}`);let Z=V[0];if(Z&&V.length===1&&W){let X=Z.signKey;console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${X})`),await F0("seal_deploy_hosecloud_sync",Y,J,{signKey:X},V0(Q.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${J.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of V){let L=X.outboundName??"SealAI 审批",D=X.signKey,O=X.apiOrigin??"production";console.error(` • "${L}" (signKey: ${D}, 环境: ${O})`),console.error(` \uD83D\uDC49 同步命令: seal-use deploy hosecloud sync ${D} --corp ${J.id}
`)}if(V.length===1)console.error(`\uD83D\uDCA1 提示:若希望单配置自动同步,可附加 --auto 参数:seal-use deploy hosecloud sync --auto --corp ${J.id}
`);throw new l8("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,V.length===1?`seal-use deploy hosecloud sync ${V[0].signKey} --corp ${J.id}`:void 0)}await D0("seal_deploy_hosecloud_sync",Y,J,{signKey:G},w0(Q.options));return}throw Error(`Unknown deploy hosecloud action: ${q??""}. Available: requirements, list, get, status, configure, sync.`)}import{createServer as zG1}from"node:http";import{URL as wG1}from"node:url";var Tz0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.15",description:`Planned HTTP contract for the seal-use wrapped backend API.
`);throw new a8("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,V.length===1?`seal-use deploy hosecloud sync ${V[0].signKey} --corp ${J.id}`:void 0)}await F0("seal_deploy_hosecloud_sync",Y,J,{signKey:G},V0(Q.options));return}throw Error(`Unknown deploy hosecloud action: ${q??""}. Available: requirements, list, get, status, configure, sync.`)}import{createServer as uG1}from"node:http";import{URL as gG1}from"node:url";var kz0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.17",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${I1})</title>
<title>Seal Home API Docs (v${Y1})</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 {
@@ -494,37 +374,47 @@ 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 k4($,I,U,Y){let J=$.handler;return J(I,U,{corp:Y})}async function Bz0($,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"),$.method==="OPTIONS"){I.writeHead(204),I.end();return}let U=$.headers.host||"localhost",Y=$.headers["x-forwarded-proto"]||"http",J=new wG1($.url||"/",`${Y}://${U}`),Q=J.pathname.replace(/\/+$/,"")||"/",K=($.method||"GET").toUpperCase();try{if(K==="GET"&&Q==="/"){o1(I,200,{name:"seal-use",version:I1,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(K==="GET"&&Q==="/docs"){ZG1(I,200,Ez0());return}if(K==="GET"&&Q==="/openapi.json"){o1(I,200,RD());return}if(K==="GET"&&Q==="/health"){o1(I,200,{status:"ok",version:I1,name:"seal-use",timestamp:new Date().toISOString()});return}if(K==="POST"&&(Q==="/shutdown"||Q==="/api/shutdown")){o1(I,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(K==="POST"&&Q==="/api/cli"){let q=await jD($),H=(typeof q?.command==="string"?q.command:"").trim();if(!H){CD(I,400,"Missing 'command' property in request body");return}let G=Ru(H),W=G[0]==="seal-use"||G[0]==="seal-home"||G[0]?.endsWith("/seal-use")||G[0]?.endsWith("/seal-home")?G.slice(1):G,w=await AH(W),V=void 0;try{if(w.stdout.trim().startsWith("{")||w.stdout.trim().startsWith("["))V=JSON.parse(w.stdout)}catch{}o1(I,w.isError?400:200,{success:!w.isError,stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode,data:V});return}if(K==="POST"&&Q.startsWith("/api/tool/")){let q=Q.slice(10).trim(),H=C4(q);if(!H){CD(I,404,`Tool not found: '${q}'`);return}let G=await jD($)||{},W=u6($,J,G),w=k1(W),V=await n1(w),Z={...G};delete Z.corp;let X=await k4(H,V,Z,w);o1(I,200,X);return}if(Q.startsWith("/v1/")){if(await VG1($,I,K,Q,J))return}CD(I,404,`Cannot ${K} ${Q}. Visit /docs for available endpoints.`)}catch(q){let H=q instanceof Error?q.message:String(q);CD(I,500,H)}}async function VG1($,I,U,Y,J){let Q=Object.fromEntries(J.searchParams.entries());if(U==="GET"&&Y==="/v1/corps"){let K=p8(),q=D4();return o1(I,200,{count:K.length,mode:q.stateful?"stateful":"stateless",defaultCorpId:q.defaultCorpId,corps:K.map((H)=>({id:H.id,name:H.name,sourceType:H.source.type,sealUrl:H.seal?.url}))}),!0}if(U==="GET"&&Y==="/v1/whoami"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_whoami"),W=await k4(G,H,{},q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/session"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_session_get"),W=await k4(G,H,{},q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/summary"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_runs_summary"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/stats"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_runs_stats"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/pick"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_run_pick"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/url"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_run_url_get"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(Y.startsWith("/v1/approval-runs/")){let K=Y.slice(18).split("/"),q=K[0],H=K[1];if(q&&!["summary","pick","stats","url","bridge"].includes(q)){let G=u6($,J,Q),W=k1(G),w=await n1(W);if(!H){let V=C4("seal_approval_run_get"),Z=await k4(V,w,{recordId:q,...Q},W);return o1(I,200,Z),!0}if(H==="attachments"){let V=C4("seal_approval_run_attachments_get"),Z=await k4(V,w,{recordId:q,...Q},W);return o1(I,200,Z),!0}if(H==="cited-rules"){let V=C4("seal_approval_run_cited_rules_get"),Z=await k4(V,w,{recordId:q,...Q},W);return o1(I,200,Z),!0}if(H==="document-summary"){let V=C4("seal_approval_run_document_summary_get"),Z=await k4(V,w,{recordId:q,...Q},W);return o1(I,200,Z),!0}if(H==="result"){let V=C4("seal_approval_run_result_get"),Z=await k4(V,w,{recordId:q,...Q},W);return o1(I,200,Z),!0}}}if(U==="GET"&&Y==="/v1/approval-runs"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_runs_search"),W=await k4(G,H,{...Q,limit:Q.limit?Number(Q.limit):void 0,offset:Q.offset?Number(Q.offset):void 0,includeBridge:Q.includeBridge==="true"},q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval/rules"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_approval_rules_list"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(U==="GET"&&Y==="/v1/simulation/batches"){let K=u6($,J,Q),q=k1(K),H=await n1(q),G=C4("seal_simulation_batches_list"),W=await k4(G,H,Q,q);return o1(I,200,W),!0}if(U==="POST"&&Y==="/v1/simulation/create-batch"){let K=await jD($)||{},q=u6($,J,K),H=k1(q),G=await n1Line truncated
\uD83D\uDE80 seal-use HTTP Server (v${I1}) started`),console.error(` URL: http://${U}:${I}`),console.error(` Docs: http://${U}:${I}/docs`),console.error(` OpenAPI: http://${U}:${I}/openapi.json`),console.error(` CLI Exec: POST http://${U}:${I}/api/cli`),console.error(` REST API: http://${U}:${I}/v1/...
`);J(Y)})})}async function vz0($){let I=d0($.options.port)??d0($.options.p),U=h($.options.host)??h($.options.h),Y=await SD({port:I,host:U}),J=()=>{Y.close(()=>{process.exit(0)})};process.on("SIGINT",J),process.on("SIGTERM",J),await new Promise(()=>{})}async function Rz0($,I,U,Y){if($==="config"||$==="get"){await D0("seal_llm_config_get",I,U,{},w0(Y.options));return}if($==="providers"||$==="list"){await D0("seal_llm_providers_list",I,U,{},w0(Y.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}async function Cz0($,I){if($==="config"||$==="json"){Cu();return}await ju()}function Cu(){B0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function jz0($){let I=RD();B0(I,{...w0($.options),allowFull:!0})}async function _z0($,I,U,Y){if($==="available"){await D0("seal_permissions_available_list",I,U,{},w0(Y.options));return}if($==="configs"||$==="list"){await D0("seal_permissions_configs_list",I,U,{},w0(Y.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as gz0}from"node:fs";async function Sz0($,I,U,Y,J,Q,K){if(!$||$==="get"){await D0("seal_preference_get",J,Q,{},w0(K.options));return}if($==="decision"){if(I==="update"||!I){let q=h(K.options.input),H=q?JSON.parse(gz0(q,"utf8")):s6(K.json);if(!H||Object.keys(H).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await D0("seal_preference_decision_update",J,Q,{...H,dryRun:F0(K.options.dryRun)??F0(K.options["dry-run"])},w0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let q=h(K.options.default)??h(K.options.level)??Y;if(q!=="medium"&&q!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await D0("seal_preference_thinking_depth_set",J,Q,{defaultLevel:q,dryRun:F0(K.options.dryRun)??F0(K.options["dry-run"])},w0(K.options));return}if(I==="policies"){if(U==="list"||!U){await D0("seal_preference_thinking_depth_policies_list",J,Q,{},w0(K.options));return}if(U==="upsert"){let q=h(K.options.input),H=q?JSON.parse(gz0(q,"utf8")):s6(K.json);if(!H||!H.id||!H.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await D0("seal_preference_thinking_depth_policies_upsert",J,Q,{...H,dryRun:F0(K.options.dryRun)??F0(K.options["dry-run"])},w0(K.options));return}if(U==="remove"||U==="delete"){let q=Y??h(K.options.id)??h(K.options.policyId);if(!q)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await D0("seal_preference_thinking_depth_policies_remove",J,Q,{policyId:q,dryRun:F0(K.options.dryRun)??F0(K.options["dry-run"])},w0(K.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}async function yz0($={}){let I=p8(),U=D4(),Y=FJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},UI());console.log(`[probe] corp=${Y.id} source=${Y.source.type}`);let J=await jJ(Y);console.log("[probe] seal enterprise"),console.log(JSON.stringify(J,null,2));let Q=await n1(Y),K=await lw(Q,{documentLimit:20,stylePreferencesEndpoint:Y.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:K.rules.rules.length,hasPendingRuleDeletes:K.rules.hasPendingDeletes,documents:K.documents.articles.length,documentsTotal:K.documents.total,stylePreferences:K.stylePreferences.ok?"ok":`error: ${K.stylePreferences.error}`},null,2))}async function hz0($,I,U){let Y=I??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await yz0({corpId:Y})}async function _u($,I,U,Y,J){if($==="count"){await D0("seal_approval_rules_list",U,Y,{countOnly:!0},w0(J.options));return}if($==="list"){if(F0(J.options.count)){await D0("seal_approval_rules_list",U,Y,{countOnly:!0},w0(J.options));return}let Q=d0(J.options.limit),K=d0(J.options.offset);if(F0(J.options.summary)){await D0("seal_approval_rules_list",U,Y,{fields:eZ0,limit:Q,offset:K},w0(J.options));return}let q=await ZI("seal_approval_rules_list",U,Y,{limit:Q,offset:K});$z0(q,F0(J.options.full)===!0),B0(q);return}if($==="clear"){let Q=F0(J.options.yes)===!0,K=F0(J.options.dryRun)??F0(J.options["dry-run"])??!Q;if(!Q&&!K)throw o8("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-use rules clear --corp ${Y.id} --dry-run`);let q=await ZI("seal_approval_rules_clear",U,Y,{dryRun:K,recode:F0(J.options.recode)});if(!Q&&K&&q&&typeof q==="object"){B0({...q,nextCommand:`seal-use rules clear --corp ${Y.id} --yes`},w0(J.options));return}B0(q,w0(J.options));return}if($==="versions"){await D0("seal_approval_rule_versions_list",U,Y,{},w0(J.options));return}if($==="version"){let Q=I??h(J.options.version);if(!Q)throw Error("Usage: seal-use rules version <versionId|versionNumber|l Line truncated
`).filter(Boolean),Q=J.slice(-I);return{logFile:U,lines:Q,totalLines:J.length}}async function FG1($){let I=xD($),U=yu($),Y=PH($);fz0($.stateDir);let J=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):_D),Q=$.host??(process.env.HOST?process.env.HOST:gD);hD(I,`${process.pid}
`,{mode:384}),hD(U,JSON.stringify({pid:process.pid,port:J,host:Q,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),_J(Y,`service starting on http://${Q}:${J} pid=${process.pid}`);let K=null;try{K=await SD({port:J,host:Q,silent:!0}),_J(Y,`service listening pid=${process.pid}`)}catch(H){if(_J(Y,`service failed to bind port ${J}: ${H instanceof Error?H.message:String(H)}`),uD(I)===process.pid)r8(I,{force:!0}),r8(U,{force:!0});throw H}let q=()=>{if(K)K.close(),K=null;if(uD(I)===process.pid)r8(I,{force:!0}),r8(U,{force:!0});_J(Y,`stopped pid=${process.pid}`)};await new Promise((H)=>{let G=!1,W=()=>{if(G)return;G=!0,q(),process.off("SIGTERM",W),process.off("SIGINT",W),H()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function uz0($){fz0($.stateDir);let I=gJ($);if(I.running)return I;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},Y=[...U.args??[],"service","run"];if($.port)Y.push("--port",String($.port));if($.host)Y.push("--host",String($.host));let J=XG1(U.command,Y,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});J.unref();let Q=xD($);return hD(Q,`${J.pid}
`,{mode:384}),_J(PH($),`started pid=${J.pid}`),{started:!0,...gJ($)}}function xz0($,I={}){let U=xD($),Y=yu($),J=uD(U);if(!J||!kz0(J,$.appRoot))return r8(U,{force:!0}),r8(Y,{force:!0}),I.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(J,"SIGTERM"),r8(U,{force:!0}),r8(Y,{force:!0}),_J(PH($),`stop requested pid=${J}`),I.quiet?void 0:{stopped:!0,pid:J}}function kz0($,I){if(!NG1($))return!1;try{let U=LG1("ps",["-p",String($),"-o","command="],{encoding:"utf8"});return(U.includes(I)||U.includes("seal-use")||U.includes("src/cli.ts"))&&U.includes("service")&&U.includes("run")}catch{return!1}}function NG1($){try{return process.kill($,0),!0}catch{return!1}}function xD($){return Su($.stateDir,"service.pid")}function yu($){return Su($.stateDir,"service.json")}function PH($){return Su($.stateDir,"service.log")}function uD($){if(!yD($))return;let I=Number(gu($,"utf8").trim());return Number.isInteger(I)&&I>0?I:void 0}function fz0($){DG1($,{recursive:!0,mode:448})}function _J($,I){hD($,`${new Date().toISOString()} ${I}
`,{flag:"a",mode:384})}var hu=AG1(MG1(),".config","seal-use");async function uu($,I,U){let Y=U?d0(U.options.port)??d0(U.options.p):void 0,J=U?h(U.options.host)??h(U.options.h):void 0,Q=U?d0(U.options.lines)??d0(U.options.n):void 0,K=await zI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:hu,version:I1,launcher:I.launcher,port:Y,host:J},{maxLines:Q});if(K!==void 0)B0(K)}import{existsSync as PG1,readFileSync as iz0}from"node:fs";async function bz0($,I,U,Y,J){if($==="batch-records"||$==="records"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation batch-records <batchId>");await D0("seal_simulation_batch_records_get",U,Y,{batchId:Q,query:h(J.options.query)},w0(J.options));return}if($==="create"||$==="run"){let Q=h(J.options.mode)??h(J.options.sourceSystem)??h(J.options["source-system"])??"hosecloud",K=Q==="material-pack"?"material_pack":Q,q=h(J.options.schemaConfig)??h(J.options["schema-config"]),H=q?JSON.parse(iz0(q,"utf8")):void 0,G=h(J.options.input),W=G?JSON.parse(iz0(G,"utf8")):s6(J.json),w=h(J.options.packageId)??h(J.options["package-id"]),V=w6(J.options.packageIds)??w6(J.options["package-ids"])??(w?[w]:void 0),Z=w6(J.options.flowIds)??w6(J.options["flow-ids"])??w6(J.options.documentSn)??w6(J.options["document-sn"]),X=h(J.options.signKey)??h(J.options["sign-key"])??h(J.options.integration),L=F0(J.options.noWait)??F0(J.options["no-wait"]);await D0("seal_simulation_batch_create",U,Y,{mode:K,sourceSystem:K,flowIds:Z,documentSn:Z,rejectNodeName:h(J.options.rejectNode)??h(J.options["reject-node"])??null,thinkingDepthOverride:h(J.options.thinkingDepth)??h(J.options["thinking-depth"]),skipInvoiceGeneration:F0(J.options.skipInvoiceGeneration)??F0(J.options["skip-invoice-generation"]),skipExpenseExtraction:F0(J.options.skipExpenseExtraction)??F0(J.options["skip-expense-extraction"]),disableAttachmentCache:F0(J.options.disableAttachmentCache)??F0(J.options["disable-attachment-cache"]),signKey:X,packageIds:V,packageId:w,templateId:h(J.options.templateId)??h(J.options["template-id"]),schemaConfig:H,requestIds:w6(J.options.requestIds)??w6(J.options["request-ids"]),workflowTypeId:h(J.options.workflowTypeId)??h(J.options["workflow-type-id"]),flowStatusList:w6(J.options.flowStatusList)?.map(Number)??w6(J.options["flow-status-list"])?.map(Number),businessCodes:w6(J.options.businessCodes)??w6(J.options["business-codes"]),documentType:h(J.options.documentType)??h(J.options["document-type"]),startTime:d0(J.options.startTime)??d0(J.options["start-time"]),endTime:d0(J.options.endTime)??d0(J.options["end-time"]),status:w6(J.options.status),limit:d0(J.options.limit),noWait:L,rawParams:W},w0(J.options));return}if($==="wait"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await D0("seal_simulation_batch_wait",U,Y,{batchId:Q,timeout:h(J.options.timeout),pollInterval:h(J.options.pollInterval)??h(J.options["poll-interval"])},w0(J.options));return}if($==="status"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation status <batchId>");await D0("seal_simulation_batch_status",U,Y,{batchId:Q},w0(J.options));return}if($==="clean"||$==="delete"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation clean <batchId>");await D0("seal_simulation_batch_clean",U,Y,{batchId:Q},w0(J.options));return}if($==="specifications"){let Q=I??h(J.options.integration)??h(J.options.signKey)??h(J.options["sign-key"]);await D0("seal_simulation_specifications_list",U,Y,{signKey:Q},w0(J.options));return}if($==="approval-definitions"||$==="definitions"){await D0("seal_simulation_feishu_approval_definitions_list",U,Y,{},w0(J.options));return}if($==="list"){await D0("seal_simulation_batches_list",U,Y,{limit:d0(J.options.limit)},w0(J.options));return}if($==="get"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation get <batchId>");await D0("seal_simulation_batch_get",U,Y,{batchId:Q},w0(J.options));return}if($==="templates"){await D0("seal_simulation_templates_get",U,Y,{},w0(J.options));return}if($==="integrations"){await D0("seal_simulation_integrations_get",U,Y,{},w0(J.options));return}if($==="package-upload"){let Q=I??h(J.options.file);if(!Q)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!PG1(Q))throw Error(`File not found: ${Q}`);await D0("seal_simulation_material_package_upload",U,Y,{filePath:Q},w0(J.options));return}throw Error(`Unknown simulation command: ${$??""}. Run 'seal-use help' for available commands.`)}import{existsSync as QX0}from"node:fs";import{join as kD}from"node:path";import{existsSync as xu,mkdirSync as ez0,rmSync as hG1,writeFileSync as uG1}from"node:fs";import{homedir as $X0}from"node:os";import{dirname as xG1,join as ku}from"node:path";var nz0=`---
</html>`}async function k4($,I,U,Y){let J=$.handler;return J(I,U,{corp:Y})}async function bz0($,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"),$.method==="OPTIONS"){I.writeHead(204),I.end();return}let U=$.headers.host||"localhost",Y=$.headers["x-forwarded-proto"]||"http",J=new gG1($.url||"/",`${Y}://${U}`),Q=J.pathname.replace(/\/+$/,"")||"/",K=($.method||"GET").toUpperCase();try{if(K==="GET"&&Q==="/"){t1(I,200,{name:"seal-use",version:Y1,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(K==="GET"&&Q==="/docs"){hG1(I,200,fz0());return}if(K==="GET"&&Q==="/openapi.json"){t1(I,200,yD());return}if(K==="GET"&&Q==="/health"){t1(I,200,{status:"ok",version:Y1,name:"seal-use",timestamp:new Date().toISOString()});return}if(K==="POST"&&(Q==="/shutdown"||Q==="/api/shutdown")){t1(I,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(K==="POST"&&Q==="/api/cli"){let q=await uD($),H=(typeof q?.command==="string"?q.command:"").trim();if(!H){hD(I,400,"Missing 'command' property in request body");return}let G=yu(H),W=G[0]==="seal-use"||G[0]==="seal-home"||G[0]?.endsWith("/seal-use")||G[0]?.endsWith("/seal-home")?G.slice(1):G,w=await TH(W),V=void 0;try{if(w.stdout.trim().startsWith("{")||w.stdout.trim().startsWith("["))V=JSON.parse(w.stdout)}catch{}t1(I,w.isError?400:200,{success:!w.isError,stdout:w.stdout,stderr:w.stderr,exitCode:w.exitCode,data:V});return}if(K==="POST"&&Q.startsWith("/api/tool/")){let q=Q.slice(10).trim(),H=C4(q);if(!H){hD(I,404,`Tool not found: '${q}'`);return}let G=await uD($)||{},W=k6($,J,G),w=b1(W),V=await c1(w),Z={...G};delete Z.corp;let X=await k4(H,V,Z,w);t1(I,200,X);return}if(Q.startsWith("/v1/")){if(await yG1($,I,K,Q,J))return}hD(I,404,`Cannot ${K} ${Q}. Visit /docs for available endpoints.`)}catch(q){let H=q instanceof Error?q.message:String(q);hD(I,500,H)}}async function yG1($,I,U,Y,J){let Q=Object.fromEntries(J.searchParams.entries());if(U==="GET"&&Y==="/v1/corps"){let K=l8(),q=F4();return t1(I,200,{count:K.length,mode:q.stateful?"stateful":"stateless",defaultCorpId:q.defaultCorpId,corps:K.map((H)=>({id:H.id,name:H.name,sourceType:H.source.type,sealUrl:H.seal?.url}))}),!0}if(U==="GET"&&Y==="/v1/whoami"){let K=k6($,J,Q),q=b1(K),H=await c1(q),G=C4("seal_whoami"),W=await k4(G,H,{},q);return t1(I,200,W),!0}if(U==="GET"&&Y==="/v1/session"){let K=k6($,J,Q),q=b1(K),H=await c1(q),G=C4("seal_session_get"),W=await k4(G,H,{},q);return t1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/summary"){let K=k6($,J,Q),q=b1(K),H=await c1(q),G=C4("seal_approval_runs_summary"),W=await k4(G,H,Q,q);return t1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/stats"){let K=k6($,J,Q),q=b1(K),H=await c1(q),G=C4("seal_approval_runs_stats"),W=await k4(G,H,Q,q);return t1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/pick"){let K=k6($,J,Q),q=b1(K),H=await c1(q),G=C4("seal_approval_run_pick"),W=await k4(G,H,Q,q);return t1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval-runs/url"){let K=k6($,J,Q),q=b1(K),H=await c1(q),G=C4("seal_approval_run_url_get"),W=await k4(G,H,Q,q);return t1(I,200,W),!0}if(Y.startsWith("/v1/approval-runs/")){let K=Y.slice(18).split("/"),q=K[0],H=K[1];if(q&&!["summary","pick","stats","url","bridge"].includes(q)){let G=k6($,J,Q),W=b1(G),w=await c1(W);if(!H){let V=C4("seal_approval_run_get"),Z=await k4(V,w,{recordId:q,...Q},W);return t1(I,200,Z),!0}if(H==="attachments"){let V=C4("seal_approval_run_attachments_get"),Z=await k4(V,w,{recordId:q,...Q},W);return t1(I,200,Z),!0}if(H==="cited-rules"){let V=C4("seal_approval_run_cited_rules_get"),Z=await k4(V,w,{recordId:q,...Q},W);return t1(I,200,Z),!0}if(H==="document-summary"){let V=C4("seal_approval_run_document_summary_get"),Z=await k4(V,w,{recordId:q,...Q},W);return t1(I,200,Z),!0}if(H==="result"){let V=C4("seal_approval_run_result_get"),Z=await k4(V,w,{recordId:q,...Q},W);return t1(I,200,Z),!0}}}if(U==="GET"&&Y==="/v1/approval-runs"){let K=k6($,J,Q),q=b1(K),H=await c1(q),G=C4("seal_approval_runs_search"),W=await k4(G,H,{...Q,limit:Q.limit?Number(Q.limit):void 0,offset:Q.offset?Number(Q.offset):void 0,includeBridge:Q.includeBridge==="true"},q);return t1(I,200,W),!0}if(U==="GET"&&Y==="/v1/approval/rules"){let K=k6($,J,Q),q=b1(K),H=await c1(q),G=C4("seal_approval_rules_list"),W=await k4(G,H,Q,q);return t1(I,200,W),!0}if(U==="GET"&&Y==="/v1/simulation/batches"){let K=k6($,J,Q),q=b1(K),H=await c1(q),G=C4("seal_simulation_batches_list"),W=await k4(G,H,Q,q);return t1(I,200,W),!0}if(U==="POST"&&Y==="/v1/simulation/create-batch"){let K=await uD($)||{},q=k6($,J,K),H=b1(q),G=await c1Line truncated
\uD83D\uDE80 seal-use HTTP Server (v${Y1}) started`),console.error(` URL: http://${U}:${I}`),console.error(` Docs: http://${U}:${I}/docs`),console.error(` OpenAPI: http://${U}:${I}/openapi.json`),console.error(` CLI Exec: POST http://${U}:${I}/api/cli`),console.error(` REST API: http://${U}:${I}/v1/...
`);J(Y)})})}async function iz0($){let I=m0($.options.port)??m0($.options.p),U=h($.options.host)??h($.options.h),Y=await fD({port:I,host:U}),J=()=>{Y.close(()=>{process.exit(0)})};process.on("SIGINT",J),process.on("SIGTERM",J),await new Promise(()=>{})}async function nz0($,I,U,Y){if($==="config"||$==="get"){await F0("seal_llm_config_get",I,U,{},V0(Y.options));return}if($==="providers"||$==="list"){await F0("seal_llm_providers_list",I,U,{},V0(Y.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}async function pz0($,I){if($==="config"||$==="json"){hu();return}await uu()}function hu(){B0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function cz0($){let I=yD();B0(I,{...V0($.options),allowFull:!0})}async function dz0($,I,U,Y){if($==="available"){await F0("seal_permissions_available_list",I,U,{},V0(Y.options));return}if($==="configs"||$==="list"){await F0("seal_permissions_configs_list",I,U,{},V0(Y.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}import{readFileSync as mz0}from"node:fs";async function lz0($,I,U,Y,J,Q,K){if(!$||$==="get"){await F0("seal_preference_get",J,Q,{},V0(K.options));return}if($==="decision"){if(I==="update"||!I){let q=h(K.options.input),H=q?JSON.parse(mz0(q,"utf8")):U$(K.json);if(!H||Object.keys(H).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await F0("seal_preference_decision_update",J,Q,{...H,dryRun:N0(K.options.dryRun)??N0(K.options["dry-run"])},V0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let q=h(K.options.default)??h(K.options.level)??Y;if(q!=="medium"&&q!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await F0("seal_preference_thinking_depth_set",J,Q,{defaultLevel:q,dryRun:N0(K.options.dryRun)??N0(K.options["dry-run"])},V0(K.options));return}if(I==="policies"){if(U==="list"||!U){await F0("seal_preference_thinking_depth_policies_list",J,Q,{},V0(K.options));return}if(U==="upsert"){let q=h(K.options.input),H=q?JSON.parse(mz0(q,"utf8")):U$(K.json);if(!H||!H.id||!H.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await F0("seal_preference_thinking_depth_policies_upsert",J,Q,{...H,dryRun:N0(K.options.dryRun)??N0(K.options["dry-run"])},V0(K.options));return}if(U==="remove"||U==="delete"){let q=Y??h(K.options.id)??h(K.options.policyId);if(!q)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await F0("seal_preference_thinking_depth_policies_remove",J,Q,{policyId:q,dryRun:N0(K.options.dryRun)??N0(K.options["dry-run"])},V0(K.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}async function oz0($={}){let I=l8(),U=F4(),Y=NJ(I,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},YI());console.log(`[probe] corp=${Y.id} source=${Y.source.type}`);let J=await _J(Y);console.log("[probe] seal enterprise"),console.log(JSON.stringify(J,null,2));let Q=await c1(Y),K=await sw(Q,{documentLimit:20,stylePreferencesEndpoint:Y.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:K.rules.rules.length,hasPendingRuleDeletes:K.rules.hasPendingDeletes,documents:K.documents.articles.length,documentsTotal:K.documents.total,stylePreferences:K.stylePreferences.ok?"ok":`error: ${K.stylePreferences.error}`},null,2))}async function rz0($,I,U){let Y=I??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await oz0({corpId:Y})}async function xu($,I,U,Y,J){if($==="count"){await F0("seal_approval_rules_list",U,Y,{countOnly:!0},V0(J.options));return}if($==="list"){if(N0(J.options.count)){await F0("seal_approval_rules_list",U,Y,{countOnly:!0},V0(J.options));return}let Q=m0(J.options.limit),K=m0(J.options.offset);if(N0(J.options.summary)){await F0("seal_approval_rules_list",U,Y,{fields:Qz0,limit:Q,offset:K},V0(J.options));return}let q=await zI("seal_approval_rules_list",U,Y,{limit:Q,offset:K});Kz0(q,N0(J.options.full)===!0),B0(q);return}if($==="clear"){let Q=N0(J.options.yes)===!0,K=N0(J.options.dryRun)??N0(J.options["dry-run"])??!Q;if(!Q&&!K)throw s8("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-use rules clear --corp ${Y.id} --dry-run`);let q=await zI("seal_approval_rules_clear",U,Y,{dryRun:K,recode:N0(J.options.recode)});if(!Q&&K&&q&&typeof q==="object"){B0({...q,nextCommand:`seal-use rules clear --corp ${Y.id} --yes`},V0(J.options));return}B0(q,V0(J.options));return}if($==="versions"){await F0("seal_approval_rule_versions_list",U,Y,{},V0(J.options));return}if($==="version"){let Q=I??h(J.options.version);if(!Q)throw Error("Usage: seal-use rules version <versionId|versionNumber|l Line truncated
`).filter(Boolean),Q=J.slice(-I);return{logFile:U,lines:Q,totalLines:J.length}}async function iG1($){let I=pD($),U=bu($),Y=EH($);ez0($.stateDir);let J=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):xD),Q=$.host??(process.env.HOST?process.env.HOST:kD);iD(I,`${process.pid}
`,{mode:384}),iD(U,JSON.stringify({pid:process.pid,port:J,host:Q,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),SJ(Y,`service starting on http://${Q}:${J} pid=${process.pid}`);let K=null;try{K=await fD({port:J,host:Q,silent:!0}),SJ(Y,`service listening pid=${process.pid}`)}catch(H){if(SJ(Y,`service failed to bind port ${J}: ${H instanceof Error?H.message:String(H)}`),nD(I)===process.pid)e8(I,{force:!0}),e8(U,{force:!0});throw H}let q=()=>{if(K)K.close(),K=null;if(nD(I)===process.pid)e8(I,{force:!0}),e8(U,{force:!0});SJ(Y,`stopped pid=${process.pid}`)};await new Promise((H)=>{let G=!1,W=()=>{if(G)return;G=!0,q(),process.off("SIGTERM",W),process.off("SIGINT",W),H()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function tz0($){ez0($.stateDir);let I=gJ($);if(I.running)return I;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},Y=[...U.args??[],"service","run"];if($.port)Y.push("--port",String($.port));if($.host)Y.push("--host",String($.host));let J=xG1(U.command,Y,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});J.unref();let Q=pD($);return iD(Q,`${J.pid}
`,{mode:384}),SJ(EH($),`started pid=${J.pid}`),{started:!0,...gJ($)}}function az0($,I={}){let U=pD($),Y=bu($),J=nD(U);if(!J||!sz0(J,$.appRoot))return e8(U,{force:!0}),e8(Y,{force:!0}),I.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(J,"SIGTERM"),e8(U,{force:!0}),e8(Y,{force:!0}),SJ(EH($),`stop requested pid=${J}`),I.quiet?void 0:{stopped:!0,pid:J}}function sz0($,I){if(!nG1($))return!1;try{let U=kG1("ps",["-p",String($),"-o","command="],{encoding:"utf8"});return(U.includes(I)||U.includes("seal-use")||U.includes("src/cli.ts"))&&U.includes("service")&&U.includes("run")}catch{return!1}}function nG1($){try{return process.kill($,0),!0}catch{return!1}}function pD($){return fu($.stateDir,"service.pid")}function bu($){return fu($.stateDir,"service.json")}function EH($){return fu($.stateDir,"service.log")}function nD($){if(!bD($))return;let I=Number(ku($,"utf8").trim());return Number.isInteger(I)&&I>0?I:void 0}function ez0($){fG1($,{recursive:!0,mode:448})}function SJ($,I){iD($,`${new Date().toISOString()} ${I}
`,{flag:"a",mode:384})}var iu=cG1(pG1(),".config","seal-use");async function nu($,I,U){let Y=U?m0(U.options.port)??m0(U.options.p):void 0,J=U?h(U.options.host)??h(U.options.h):void 0,Q=U?m0(U.options.lines)??m0(U.options.n):void 0,K=await XI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:iu,version:Y1,launcher:I.launcher,port:Y,host:J},{maxLines:Q});if(K!==void 0)B0(K)}import{existsSync as dG1,readFileSync as $X0}from"node:fs";async function IX0($,I,U,Y,J){if($==="batch-records"||$==="records"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation batch-records <batchId>");await F0("seal_simulation_batch_records_get",U,Y,{batchId:Q,query:h(J.options.query)},V0(J.options));return}if($==="create"||$==="run"){let Q=h(J.options.mode)??h(J.options.sourceSystem)??h(J.options["source-system"])??"hosecloud",K=Q==="material-pack"?"material_pack":Q,q=h(J.options.schemaConfig)??h(J.options["schema-config"]),H=q?JSON.parse($X0(q,"utf8")):void 0,G=h(J.options.input),W=G?JSON.parse($X0(G,"utf8")):U$(J.json),w=h(J.options.packageId)??h(J.options["package-id"]),V=V6(J.options.packageIds)??V6(J.options["package-ids"])??(w?[w]:void 0),Z=V6(J.options.flowIds)??V6(J.options["flow-ids"])??V6(J.options.documentSn)??V6(J.options["document-sn"]),X=h(J.options.signKey)??h(J.options["sign-key"])??h(J.options.integration),L=N0(J.options.noWait)??N0(J.options["no-wait"]);await F0("seal_simulation_batch_create",U,Y,{mode:K,sourceSystem:K,flowIds:Z,documentSn:Z,rejectNodeName:h(J.options.rejectNode)??h(J.options["reject-node"])??null,thinkingDepthOverride:h(J.options.thinkingDepth)??h(J.options["thinking-depth"]),skipInvoiceGeneration:N0(J.options.skipInvoiceGeneration)??N0(J.options["skip-invoice-generation"]),skipExpenseExtraction:N0(J.options.skipExpenseExtraction)??N0(J.options["skip-expense-extraction"]),disableAttachmentCache:N0(J.options.disableAttachmentCache)??N0(J.options["disable-attachment-cache"]),signKey:X,packageIds:V,packageId:w,templateId:h(J.options.templateId)??h(J.options["template-id"]),schemaConfig:H,requestIds:V6(J.options.requestIds)??V6(J.options["request-ids"]),workflowTypeId:h(J.options.workflowTypeId)??h(J.options["workflow-type-id"]),flowStatusList:V6(J.options.flowStatusList)?.map(Number)??V6(J.options["flow-status-list"])?.map(Number),businessCodes:V6(J.options.businessCodes)??V6(J.options["business-codes"]),documentType:h(J.options.documentType)??h(J.options["document-type"]),startTime:m0(J.options.startTime)??m0(J.options["start-time"]),endTime:m0(J.options.endTime)??m0(J.options["end-time"]),status:V6(J.options.status),limit:m0(J.options.limit),noWait:L,rawParams:W},V0(J.options));return}if($==="wait"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await F0("seal_simulation_batch_wait",U,Y,{batchId:Q,timeout:h(J.options.timeout),pollInterval:h(J.options.pollInterval)??h(J.options["poll-interval"])},V0(J.options));return}if($==="status"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation status <batchId>");await F0("seal_simulation_batch_status",U,Y,{batchId:Q},V0(J.options));return}if($==="clean"||$==="delete"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation clean <batchId>");await F0("seal_simulation_batch_clean",U,Y,{batchId:Q},V0(J.options));return}if($==="specifications"){let Q=I??h(J.options.integration)??h(J.options.signKey)??h(J.options["sign-key"]);await F0("seal_simulation_specifications_list",U,Y,{signKey:Q},V0(J.options));return}if($==="approval-definitions"||$==="definitions"){await F0("seal_simulation_feishu_approval_definitions_list",U,Y,{},V0(J.options));return}if($==="list"){await F0("seal_simulation_batches_list",U,Y,{limit:m0(J.options.limit)},V0(J.options));return}if($==="get"){let Q=I??h(J.options.batchId)??h(J.options["batch-id"]);if(!Q)throw Error("Usage: seal-use simulation get <batchId>");await F0("seal_simulation_batch_get",U,Y,{batchId:Q},V0(J.options));return}if($==="templates"){await F0("seal_simulation_templates_get",U,Y,{},V0(J.options));return}if($==="integrations"){await F0("seal_simulation_integrations_get",U,Y,{},V0(J.options));return}if($==="package-upload"){let Q=I??h(J.options.file);if(!Q)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!dG1(Q))throw Error(`File not found: ${Q}`);await F0("seal_simulation_material_package_upload",U,Y,{filePath:Q},V0(J.options));return}throw Error(`Unknown simulation command: ${$??""}. Run 'seal-use help' for available commands.`)}import{existsSync as OX0}from"node:fs";import{join as cD}from"node:path";import{existsSync as pu,mkdirSync as ZX0,rmSync as YW1,writeFileSync as JW1}from"node:fs";import{homedir as zX0}from"node:os";import{dirname as QW1,join as cu}from"node:path";var UX0=`---
name: seal-use
description: "v0.10.15: 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.17: 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.15
short-description: Seal tenant and Hose approval automation (v0.10.15)
version: 0.10.17
short-description: Seal tenant and Hose approval automation (v0.10.17)
---
# Seal Use (v0.10.15)
# Seal Use (v0.10.17)
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.
## Bootstrap & Installation (环境安装与自愈)
If \`seal-use\` or \`seal_cli\` is not installed on the system, the Agent should automatically install it via:
Agent 必须确保使用最新版本的 \`seal-use\` CLI、Skill 与 Agent 插件。在执行任何配置或业务任务前,优先核验版本状态:
\`\`\`bash
# 国内高速安装(Gitea 镜像源,免代理、秒级完成)
seal-use version
seal-use corps list
\`\`\`
如果 CLI 或 Skill 尚未安装或落后于发布版本,通过以下命令一键安装或升级:
\`\`\`bash
# 方式 1:CLI 自更新(已安装时推荐)
seal-use update
# 方式 2:国内高速一键安装与自愈(Gitea 镜像源,免代理、秒级完成)
curl -fsSL https://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash
# Global / GitHub Direct
# 方式 3:Global / GitHub Direct
curl -fsSL https://raw.githubusercontent.com/yunyingk/seal-use/main/scripts/install.sh | bash
\`\`\`
After installation, verify with:
安装或升级后,验证系统连通性:
\`\`\`bash
seal-use version
seal-use corps list
@@ -541,8 +431,8 @@ seal-use corps list
- Prefer compact commands first: \`pick\`, \`--summary\`, \`--fields\`, \`attachments --summary\`, \`rules count\`, and \`rules list --summary\`.
- Parse JSON stdout. Do not scrape human text.
- Do not hand-edit enterprise configs for normal setup. Use \`seal-use corps ...\`.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For supported configuration writes, prefer the universal \`--dry-run\` preview first (rules clear/push, preferences, thinking-depth policies, HoseCloud configure, and Webhook add/update/delete), then use \`--yes\` only after reviewing its redacted \`changesDiff\`.
- Knowledge document creation is currently irreversible: the upstream API exposes no delete operation. Validate \`contentType\` and \`scenarios\` before creating, and use \`enabled: false\` when the document should be withdrawn.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For supported configuration writes, prefer the universal \`--dry-run\` preview first (rules clear/push, \`corps sync-test\`, preferences, thinking-depth policies, HoseCloud configure, and Webhook add/update/delete), then use \`--yes\` only after reviewing its redacted \`changesDiff\`.
- Knowledge document creation and deletion are now supported. Validate \`contentType\` and \`scenarios\` before creating; use \`enabled: false\` when the document should be withdrawn without deletion. For an explicit deletion, re-read the document and obtain confirmation before using the low-level \`seal_approval_delete_document\` tool.
- For customer-feedback rule remediation, show an exact field-level diff and obtain explicit approval before updating. Default to changing only the narrowest necessary part of \`description\`; preserve \`scope\`, \`strictness\`, and unrelated clauses unless the user explicitly approves otherwise.
- Resolve and lock the target enterprise \`corpId\` before diagnosis or mutation. Never assume the current tenant is the customer tenant. Re-fetch the target rule immediately before updating, then verify the draft and newly published version after writing.
- For date questions, use explicit dates and \`--timezone Asia/Shanghai\`.
@@ -552,20 +442,25 @@ seal-use corps list
- Never treat “Seal 协助/Seal 授权/委托” as a 合思授权入口. They are different links and must use different commands.
- In the default stateless mode, every enterprise command requires \`--corp <corpId>\`. In stateful mode, omitting \`--corp\` uses the configured default enterprise and is unsafe for an explicitly named enterprise.
- For an explicitly named enterprise, first resolve it with \`seal-use corps list\`, then pass its exact \`corpId\` to every command. After creation, verify the returned URL host matches that enterprise's Seal tenant; if the host is the current/default tenant or cannot be verified, do not present the link as the target enterprise's link.
- 生产规则变更建议优先遵循“生产改草稿 -> 同步测试企业 -> 真实单据模拟验证 -> 生产发布投产”安全闭环;Agent 应主动提示并建议在测试环境中验证,但最终操作权与决策权在用户手中,绝不代替用户做决定。若用户明确要求直接在生产环境发布,尊重用户意图并严格执行。
- 测试环境合思模拟安全隔离:\`corps sync-test\` 自动将生产企业合思凭证以 \`assisted\` 模式注入测试企业,名称格式为 \`{企业名前缀}(Seal测)\`。该配置仅保存在测试 Seal 侧,绝对不执行 \`deploy hosecloud sync\`,杜绝向生产合思费控推送 EBot 节点或创建外发 webhook。
## Route By Intent
- 生产规则安全演进、搭配配置与测试模拟闭环: read \`references/staging-simulation-workflow.md\`. 适用于:用户提出规则变更需求/客诉修复、生产与测试企业搭配接入与 1 对 1 绑定、生产环境仅改草稿隔离风险、\`seal-use corps sync-test\` 一键同步测试环境(含合思集成免配同步)、测试环境跑真实单据模拟验证、验证通过后才在生产正式发布的完整安全生命周期。
- First install / zero configuration / “how do I connect my enterprise?” / user supplies app credentials, an assistance link, or F12/Network cURL: read \`references/enterprise-onboarding.md\`. Ask what material the user already has in plain language, then discover all remaining identifiers automatically.
- User-facing Seal tenant assistance link (Seal 协助/Seal 授权/委托): resolve the named enterprise first, then run \`seal-use delegation create --corp <corpId> --note '<enterprise>'\`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (\` \`\`\`text ... \`\`\` \`) AND a hyperlink.
- Packaged customer feedback → approval-rule remediation: read \`references/customer-feedback-rule-remediation.md\`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
- 模拟测试发布闭环: \`seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>\` (合思指定单号) 或 \`--mode material_pack --package-ids ... --schema-config file.json\` (材料包导入), 支持多源系统 \`--source-system <hosecloud|feishu|weaver|helios|maycur|material_pack>\`, \`simulation status <batchId>\` 单次查询状态, \`simulation wait <batchId>\` 轮询等待完成, \`simulation clean <batchId>\` 清理数据, \`simulation specifications\` 列出单据模板, \`simulation list\`/\`get\`/\`batch-records\` 查看批次与记录。创建前确认目标环境为测试环境。
- 测试企业标记、关联与配置规则同步: \`seal-use corps mark <corpId> --env <production|test> --confirm\` (严格标记环境), \`seal-use corps bind-test <prodCorpId> <testCorpId> --confirm\` (严格1对1下挂,禁止多层级串联), \`seal-use corps unbind-test <corpId> --confirm\`, \`seal-use corps sync-test <prodCorpId> [--dry-run|--yes] [--version-name <name>]\` (将正式企业的偏好和草稿规则覆盖同步到测试企业并直接发布成新版本,正式企业规则保持草稿态不发布)。
- 模拟测试发布闭环: \`seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>\` (合思指定单号) 或 \`--mode material_pack --package-ids ... --schema-config file.json\` (材料包导入), 支持多源系统 \`--source-system <hosecloud|feishu|weaver|helios|maycur|material_pack>\`, \`simulation status <batchId>\` 单次查询状态, \`simulation wait <batchId>\` 轮询等待完成, \`simulation clean <batchId>\` 清理数据, \`simulation specifications\` 列出单据模板, \`simulation approval-definitions\` 查询飞书审批定义, \`simulation list\`/\`get\`/\`batch-records\` 查看批次与记录。创建前确认目标环境为测试环境。
- 测试企业标记、关联与配置规则同步: \`seal-use corps mark <corpId> --env <production|test> --confirm\` (严格标记环境), \`seal-use corps bind-test <prodCorpId> <testCorpId> --confirm\` (严格1对1下挂,禁止多层级串联), \`seal-use corps unbind-test <corpId> --confirm\`, \`seal-use corps sync-test <prodCorpId> [--dry-run|--yes] [--version-name <name>]\` (将正式企业的偏好、草稿规则和知识文档覆盖同步到测试企业并自动发布语义版本 \`[Prod vN · #M -> Test vM]\`,输出并本地缓存 \`versionMapping\`/\`ruleMapping\`,正式企业规则保持草稿态不发布), \`seal-use rules map [--corp <corpId>] [--version <v|latest>] [--code <code>]\` (离线毫秒级速查测试与生产规则对照映射)。
- 规则本地工作流: \`seal-use rules pull\` 导出草稿规则,\`rules lint\` 做质量检查,\`rules push --dry-run\` 预览增量更新,确认后用 \`--yes\` 写入;\`rules map\` 查询 \`corps sync-test\` 生成的跨企业规则映射。规则版本与草稿/发布 code 空间的区别详见 \`references/rule-lightweight.md\` 和 \`references/cli.md\`。
- Seal AI 智能审核发布到合思费控: \`seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>\`; read \`references/hose-enterprise-deploy.md\`.
- 审核决策偏好与思考深度: \`seal-use preference get --corp <corpId>\`, \`preference decision update --json '...' --corp <corpId>\`, \`preference thinking-depth set --default <medium|high> --corp <corpId>\`, \`preference thinking-depth policies <list|upsert|remove> --corp <corpId>\`.
- 审核大盘统计与去重分析: \`seal-use approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|id] --corp <corpId>\`, \`seal-use approval-runs count --corp <corpId>\`.
- 审核大盘统计与去重分析: \`seal-use approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id] --corp <corpId>\`, \`approval-runs count\`, \`analytics insight\`, 以及 \`approval-runs export\`(Excel 报表);需要追踪单据时再使用 \`url\` 或 \`bridge\`。
- User-facing 合思 authorization link (合思/易快报授权): \`seal-use auth hose-link --corp <corpId> --expire 7200\`; read \`references/hose-enterprise-auth.md\`. Never use this route when the user says Seal 协助. Always provide BOTH a code block (\` \`\`\`text ... \`\`\` \`) AND a hyperlink.
- Delegation links management: \`seal-use delegation list --corp <corpId>\`, \`create [--note ...] --corp <corpId>\`, \`create --from-link <url> [--note ...]\`, \`revoke <tokenId> --corp <corpId>\`.
- User & Contacts Management (用户搜索、激活与一键代生成授权): \`seal-use users search [keyword] --corp <corpId>\`, \`users delegation <userIdOrPhone> --corp <corpId>\` (仅适用于 Seal 本地创建的账号 \`provider: local\`;对合思同步账号系统拒绝重置密码,需改用 \`auth hose-link\`), \`users activate <userId> --corp <corpId>\`, \`users create --name ... --phone ... --corp <corpId>\`, \`reset-password <userId> --corp <corpId>\`, \`get <userId> --corp <corpId>\`, \`delete <userId> --corp <corpId>\`.
- User & Contacts Management (用户搜索、激活与一键代生成授权): \`seal-use users search [keyword] --corp <corpId>\`, \`users delegation <userIdOrPhone> --corp <corpId>\` (仅适用于 Seal 本地创建的账号 \`provider: local\`;对合思同步账号系统拒绝重置密码,需改用 \`auth hose-link\`), \`users activate <userId> --corp <corpId>\`, \`users create --name ... --phone ... --corp <corpId>\`, \`users reset-password <userId> --corp <corpId>\`, \`users get <userId> --corp <corpId>\`, \`users delete <userId> --corp <corpId>\`.
- 只读业务数据与组织发现: \`seal-use contacts departments|children|users|sync-time --corp <corpId>\`, \`seal-use data expenses|invoices --corp <corpId>\`, \`seal-use analytics insight --corp <corpId>\`, \`seal-use context --corp <corpId>\`, \`seal-use source config --corp <corpId>\`;这些查询优先用于定位企业结构、原始费用/发票和当前审核知识,不要把结果误当成写操作。
- LLM Model Config & Providers: \`seal-use llm config --corp <corpId>\`, \`seal-use llm providers --corp <corpId>\`.
- 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>\`.
@@ -605,6 +500,9 @@ seal-use approval-runs result <recordId> --corp <corpId> --summary
seal-use rules count --corp <corpId>
seal-use rules list --corp <corpId> --summary
seal-use rules lint --corp <corpId> --summary
seal-use rules pull --corp <corpId> --out ./rules.local.json
seal-use rules push --corp <corpId> --file ./rules.local.json --dry-run
seal-use rules map --corp <corpId> --version latest
seal-use rules clear --corp <corpId> --dry-run
seal-use rules clear --corp <corpId> --yes
seal-use rules get --corp <corpId> --version 16 --code '#0038'
@@ -615,6 +513,12 @@ seal-use simulation package-upload <材料包.zip> --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 status <batchId> --corp <corpId>
seal-use simulation approval-definitions --corp <corpId>
seal-use approval-runs export --corp <corpId> --downloads --completed-only
seal-use analytics insight --corp <corpId>
seal-use contacts departments --corp <corpId>
seal-use data invoices --corp <corpId> --limit 20
seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["差旅","发票"],"areas":["rules"],"snippetOnly":true,"maxChars":500,"fields":["id","title","snippet"]}'
\`\`\`
@@ -641,16 +545,17 @@ seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["差旅"
- \`references/hose-enterprise-init.md\`: 合思标准密钥的域名、企业与管理员自动发现,以及多候选管理员的安全选择。
- \`references/hose-enterprise-deploy.md\`: Seal AI 智能审核发布到合思费控(添加/编辑配置、平台自动探测、一键同步与 EBot 节点发布)。
- \`references/approval-attachment-trace.md\`: 附件/发票/OCR/图片争议的 Langfuse 追踪工作流。
- \`references/staging-simulation-workflow.md\`: 生产与测试环境搭配配置、合思集成免配自动同步、单据模拟测试验证与生产规则安全演进闭环指南。
- \`references/cli.md\`: 完整 CLI 命令清单。
## 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 pz0=`interface:
`;var YX0=`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 cz0=`# Rule Lightweight Queries
`;var JX0=`# 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.
@@ -761,7 +666,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 dz0=`# Approval Bad Case Catalog
`;var QX0=`# 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.
@@ -811,7 +716,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 mz0="# 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** with the stable prefix `👉 Next action: seal-use ...`.\n- **`Exit Code`**: `0` on success; `1` runtime/upstream failure, `2` usage/argument error, `10` explicit destructive-operation confirmation required, `11` missing/invalid authentication, and `12` output protection requiring a compact/file/query alternative.\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 test-dir [<path>|--clear]\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 mark <corpId> --env <production|test> [--confirm]\nseal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]\nseal-use corps unbind-test [<corpId>] [--confirm]\nseal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]\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 contacts departments [<departmentId>] [--corp <corpId>]\nseal-use contacts children <departmentId> [--corp <corpId>]\nseal-use contacts users <departmentId> [--corp <corpId>]\nseal-use contacts sync-time [--corp <corpId>]\nseal-use data expenses --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]\nseal-use data invoices --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]\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>] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--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] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--cLine truncated
`;var KX0="# 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 the user-level `~/.config/seal-use/enterprises` directory is loaded. A configured\n `testEnterprisesDir` is loaded first for test-tenant workflows. The current working directory's\n `./enterprises` directory is not loaded implicitly.\n- Set `SEAL_USE_ENTERPRISES_DIR` to use one explicit directory instead. Legacy\n `~/.config/seal-home/enterprises` files are migrated to the primary directory when possible.\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** with the stable prefix `👉 Next action: seal-use ...`.\n- **`Exit Code`**: `0` on success; `1` runtime/upstream failure, `2` usage/argument error, `10` explicit destructive-operation confirmation required, `11` missing/invalid authentication, and `12` output protection requiring a compact/file/query alternative.\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 test-dir [<path>|--clear]\nseal-use config lint <enable|disable|status> [--linter <name>] [--min-score <score>]\nseal-use rules count [--corp <corpId>]\nseal-use rules list [--summary] [--count] [--limit 20] [--offset 0] [--corp <corpId>]\nseal-use rules clear [--corp <corpId>] [--dry-run|--yes]\nseal-use rules versions [--corp <corpId>]\nseal-use rules version <versionId|versionNumber|latest> [--corp <corpId>]\nseal-use rules get --corp <corpId> --version <number|latest> --code '#0038'\nseal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205\nseal-use rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]\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 rules map [--corp <corpId>] [--version <id|num|latest>] [--code <code>]\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 [--check] [--force] [--version <v>]\nseal-use update check\nseal-use update changelog [--limit <n>]\nseal-use changelog [--limit <n>]\nseal-use mcp\nseal-use mcp config\nseal-use mcp-config\nseal-use skill dump\nseal-use skill install [--dir <path>|--local]\nseal-use skill status\nseal-use openapi\nseal-use probe [<corpId>]\nseal-use tools list\nseal-use corps list [--corp <corpId>]\nseal-use corps current [--corp <corpId>]\nseal-use corps switch <corpId>\nseal-use corps mark <corpId> --env <production|test> [--confirm]\nseal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]\nseal-use corps unbind-test [<corpId>] [--confirm]\nseal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]\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 search <keyword> [--corp <corpId>]\nseal-use users delegation <userIdOrPhone|name> [--note <note>] [--corp <corpId>]\nseal-use users activate <userId> [--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 contacts departments [<departmentId>] [--corp <corpId>]\nseal-use contLine 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.
@@ -1032,7 +937,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 rz0=`# Customer Feedback Rule Remediation
`;var GX0=`# 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.
@@ -1198,7 +1103,7 @@ Return a compact report containing:
- New version number and version name, if published
- Verification result
- Whether a regression rerun was performed
`;var tz0="# 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
`;var WX0="# 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.
@@ -1263,7 +1168,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 sz0=`# Hose Enterprise Initialization & Automated Discovery
`;var VX0=`# 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.
@@ -1369,12 +1274,12 @@ seal-use corps hose-staffs --json '{
}'
\`\`\`
* 直接使用指定 ID 完成接入并进行连通性验证。
`;var IX0={"SKILL.md":nz0,"agents/openai.yaml":pz0,"references/rule-lightweight.md":cz0,"references/approval-bad-cases.md":dz0,"references/cli.md":mz0,"references/approval-run-lightweight.md":lz0,"references/approval-attachment-trace.md":oz0,"references/customer-feedback-rule-remediation.md":rz0,"references/enterprise-onboarding.md":tz0,"references/hose-enterprise-auth.md":az0,"references/hose-enterprise-init.md":sz0};function UX0(){return IX0["SKILL.md"]||""}function TH(){return ku($X0(),".agents","skills","seal-use")}function YX0(){return ku($X0(),".agents","skills","seal-home")}function JX0(){let $=YX0();if(xu($))try{return hG1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function fu($=TH()){JX0(),ez0($,{recursive:!0});let I=[];for(let[U,Y]of Object.entries(IX0)){let J=ku($,U);ez0(xG1(J),{recursive:!0}),uG1(J,Y,"utf8"),I.push(U)}return{targetDir:$,files:I}}function iu(){let $=YX0(),I=TH(),U=xu($),Y=xu(I);if(U||Y)return JX0(),fu(I),{synced:!0,targetDir:I};return{synced:!1}}function KX0($,I,U){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${UX0()}
`);return}if($==="install"||$==="init"||$==="sync"){let Y=F0(U.options.local)||F0(U.options.workspace),J=h(U.options.dir)??h(U.options.target)??I,Q=J?J:Y?kD(process.cwd(),".agents","skills","seal-use"):TH(),K=fu(Q);B0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files});return}if($==="status"||$==="get"||!$){let Y=TH(),J=kD(process.cwd(),".agents","skills","seal-use");B0({global:{dir:Y,installed:QX0(kD(Y,"SKILL.md"))},local:{dir:J,installed:QX0(kD(J,"SKILL.md"))}});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}async function qX0($,I){if($==="config"){B0(await jJ(I));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}async function HX0($,I,U,Y){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await D0($,I,U,s6(Y.json),w0(Y.options))}function GX0(){B0(XH.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as kG1,mkdirSync as fG1,renameSync as bu,rmSync as iG1,unlinkSync as zX0,writeFileSync as WX0}from"node:fs";import{dirname as bG1,join as wX0}from"node:path";import{spawnSync as XI}from"node:child_process";function fD($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var XX0="yunyingk/seal-use",BH="yunyingk/seal-home";var nG1="SEAL_USE_GITHUB_REPO",pG1="SEAL_HOME_GITHUB_REPO";async function LX0($,I={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:hu,version:I1,launcher:$.launcher},Y=I.repo||process.env[nG1]?.trim()||process.env[pG1]?.trim()||XX0,J=I.targetVersion?.trim(),Q=J&&J.toLowerCase()!=="latest"?J:void 0;if(Q){let A=Q.replace(/^v/,""),R=DX0(A,I1);if(R<0){B0({updated:!1,currentVersion:I1,targetVersion:A,mode:fD()?"binary":"source",message:`Cannot downgrade seal-use from v${I1} to older version v${A}. Updates must be forward-only.`});return}if(R===0&&!I.force){B0({updated:!1,currentVersion:I1,targetVersion:A,mode:fD()?"binary":"source",message:`seal-use is already at version v${I1}. Use --force to reinstall.`});return}}if(I.changelogOnly){let A=await nu(Y,I.limit??10);B0({currentVersion:I1,totalQueried:A.length,releases:A.map((R)=>({version:R.version,tagName:R.tagName,publishedAt:R.publishedAt,author:R.author,releaseNotes:R.notes,releaseUrl:R.htmlUrl,isCurrent:R.version===I1,isNewer:EH(R.version,I1)}))});return}if(!fD()){if(I.checkOnly){let R=await nu(Y,30),k=R[0],S=k?.version??I1,i=R.find((n)=>n.version===I1),C=EH(S,I1),p=R.filter((n)=>EH(n.version,I1));B0({updated:!1,updateAvailable:C,currentVersion:I1,currentVersionPublishedAt:i?.publishedAt,latestVersion:S,latestVersionPublishedAt:k?.publishedAt,behindCount:p.length,pendingReleases:p.map((n)=>({version:n.version,tagName:n.tagName,publishedAt:n.publishedAt,author:n.author,releaseNotes:n.notes,releaseUrl:n.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 A=gJ(U).running;if(A)await zI("stop",U);try{ZX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(R){console.error(`git pull skipped: ${R instanceof Error?R.message:String(R)}`)}if(ZX0("bun",["install"],{cwd:$.appRoot}),A)await zI("start",U);B0({updated:!0,serviceRestarted:A,version:I1,mode:"source"});return}let K=cG1(),q=dG1(),H=await nu(Y,30),G=Q?H.find((A)=>A.version===Q||A.tagName===Q||A.tagName===`v${Q}`)??await VX0(Y,Q):H[0]??await VX0(Y);if(!G){B0({updated:!1,currentVersion:I1,mode:"binary",message:`Failed to query releases from repository '${Y}'`});return}let W=G.version,w=H.find((A)=>A.version===I1),V=EH(W,I1),Z=V||Boolean(I.force),X=H.filter((A)=>EH(A.version,I1));if(I.checkOnly){B0({updated:!1,updateAvailable:V,currentVersion:I1,currentVersionPublishedAt:w?.publishedAt,latestVersion:W,latestVersionPublishedAt:G.publishedAt,behindCount:X.length,pendingReleases:X.map((A)=>({version:A.version,tagName:A.tagName,publishedAt:A.publishedAt,author:A.author,releaseNotes:A.notes,releaseUrl:A.htmlUrl})),releaseNotes:G.notes,releaseUrl:G.htmlUrl,mode:"binary"});return}if(!Z){B0({updated:!1,currentVersion:I1,currentVersionPublishedAt:w?.publishedAt,latestVersion:W,latestVersionPublishedAt:G.publishedAt,mode:"binary",message:`seal-use is already up to date (v${I1})`});return}let L=mG1(G.assets,K,q);if(!L)throw Error(`No compatible binary found for ${K}-${q} in release v${W}. Available assets: ${G.assets.map((A)=>A.name).join(", ")}`);let D=gJ(U).running;if(D)await zI("stop",U);let F=process.execPath,E=bG1(F),T=wX0(E,`.tmp-update-${Date.now()}`);fG1(T,{recursive:!0});try{let A=wX0(T,L.name);await lG1(L.downloadUrl,A,G.tagName,L.name);let R=A;if(L.name.endsWith(".tar.gz")||L.name.endsWith(".tgz"))R=oG1(A,T,K);else if(L.name.endsWith(".zip"))R=rG1(A,T,K);if(kG1(R,493),process.platform==="darwin")try{XI("/usr/bin/codesig Line truncated
`)}catch{}}async function lG1($,I,U,Y){let J=pu(),Q=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,q=Y||$.split("/").pop()||"";if(J!=="github"){if(K&&q)Q.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${q}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${q}`);if($.startsWith("https://git.ying-qing.cn"))Q.push($)}if(J!=="gitea")if(K&&q){let L=`https://github.com/${XX0}/releases/download/${K}/${q}`;if(!process.env.CI)Q.push(`https://ghfast.top/${L}`,`https://gh.ddlc.top/${L}`);Q.push(L)}else if($.includes("github.com")){if(!process.env.CI)Q.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Q.push($)}else Q.push($);let H=Array.from(new Set(Q)),G,W=6000,w=6000,V=307200,Z=1e4,X=180000;for(let L=0;L<H.length;L++){let D=H[L],F=new AbortController,E="",T=(S)=>{E=S;try{F.abort()}catch{}},A=setTimeout(()=>{T("Connection timed out (no response headers within 6s)")},W),R,k;try{iD(`==> [${L+1}/${H.length}] Downloading via: ${D}`);let S=await fetch(D,{signal:F.signal});if(A)clearTimeout(A),A=void 0;if(!S.ok)throw Error(`HTTP ${S.status} ${S.statusText}`);R=setTimeout(()=>{T("Overall download time exceeded 3 minutes")},X);let i=Number(S.headers.get("content-length"))||0,C=S.body?.getReader();if(!C){let b=Buffer.from(await S.arrayBuffer());if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);WX0(I,b),iD(`✓ Download succeeded (${(b.length/1024/1024).toFixed(1)} MB)`);return}let p=[],n=0,g=0;k=setTimeout(()=>{if(n<V){let b=(n/1024).toFixed(1);T(`Initial transfer too slow (${b} KB < 300 KB in 6s), switching mirror...`)}},w);while(!0){let b=C.read(),Y0,B=new Promise((K0,W0)=>{Y0=setTimeout(()=>{W0(Error("Data transfer stalled (no chunk received for 10s)"))},Z)}),x;try{x=await Promise.race([b,B])}finally{if(Y0)clearTimeout(Y0)}let{done:d,value:t}=x;if(d)break;if(t){if(p.push(t),n+=t.length,k&&n>=V)clearTimeout(k),k=void 0;let K0=Date.now();if(K0-g>200){g=K0;let W0=i?Math.round(n/i*100):0,A0=(n/1048576).toFixed(1),v0=i?(i/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${W0}% (${A0} / ${v0} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let f=Buffer.concat(p);if(f.length<1000)throw Error(`Downloaded content is suspiciously small (${f.length} bytes)`);WX0(I,f),iD(`✓ Download completed successfully (${(f.length/1024/1024).toFixed(1)} MB)`);return}catch(S){if(A)clearTimeout(A);if(k)clearTimeout(k);if(R)clearTimeout(R);let i=E||(S instanceof Error?S.message:String(S));G=Error(i),iD(`
↳ Mirror failed: ${G.message}`)}finally{if(A)clearTimeout(A);if(k)clearTimeout(k);if(R)clearTimeout(R)}}throw Error(`Failed to download asset from all mirrors: ${G?.message}`)}function oG1($,I,U){let Y=XI("tar",["-xzf",$,"-C",I],{stdio:"pipe"});if(Y.status!==0)throw Error(`Failed to extract tar archive: ${Y.stderr.toString()}`);zX0($);let J=U==="windows"?"seal-use.exe":"seal-use",Q=XI("find",[I,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),K=Q.find((q)=>q.endsWith(`/${J}`)||q.endsWith(J));if(K)return K;return Q[0]||$}function rG1($,I,U){let Y=XI("unzip",["-q","-o",$,"-d",I],{stdio:"pipe"});if(Y.status!==0)throw Error(`Failed to extract zip archive: ${Y.stderr.toString()}`);zX0($);let J=U==="windows"?"seal-use.exe":"seal-use",Q=XI("find",[I,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),K=Q.find((q)=>q.endsWith(`/${J}`)||q.endsWith(J));if(K)return K;return Q[0]||$}function DX0($,I){let U=$.replace(/^v/,"").split(".").map((J)=>Number.parseInt(J,10)||0),Y=I.replace(/^v/,"").split(".").map((J)=>Number.parseInt(J,10)||0);for(let J=0;J<Math.max(U.length,Y.length);J++){let Q=U[J]??0,K=Y[J]??0;if(Q>K)return 1;if(Q<K)return-1}return 0}function EH($,I){return DX0($,I)>0}function ZX0($,I,U={}){let Y=XI($,I,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(Y.stdout)console.error(Y.stdout.trimEnd());if(Y.stderr)console.error(Y.stderr.trimEnd());if(Y.status!==0)throw Error(`${$} ${I.join(" ")} failed with status ${Y.status}`)}async function OX0($,I,U,Y,J){if($==="create"){let Q=h(J.options.name)??I,K=h(J.options.phone);if(!Q||!K)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let q=h(J.options.dept)??h(J.options.departmentId);await D0("seal_user_create",U,Y,{name:Q,phone:K,departmentIds:q?[q]:void 0},w0(J.options));return}if($==="reset-password"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users reset-password <userId>");await D0("seal_user_reset_password",U,Y,{userId:Q},w0(J.options));return}if($==="search"||$==="list"){let Q=I??h(J.options.keyword)??h(J.options.query)??"";await D0("seal_user_search",U,Y,{keyword:Q},w0(J.options));return}if($==="get"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users get <userId>");await D0("seal_user_get",U,Y,{userId:Q},w0(J.options));return}if($==="delete"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users delete <userId>");await D0("seal_user_delete",U,Y,{userId:Q},w0(J.options));return}if($==="activate"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users activate <userId>");await D0("seal_user_activate",U,Y,{userId:Q},w0(J.options));return}if($==="delegation"||$==="impersonate"){let Q=I??h(J.options.userId)??h(J.options.phone);if(!Q)throw Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");let K=h(J.options.note);await D0("seal_user_delegation_create",U,Y,{userIdOrPhone:Q,note:K},w0(J.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}import{existsSync as FX0}from"node:fs";async function NX0($,I){if(!FX0($))throw Error(`File not found: ${$}`);let U=GI($);console.log(JSON.stringify(await HI(U.fileBuffer,U.fileName,I),null,2))}async function MX0($,I,U,Y,J){if($==="ready"||$==="status"){let Q=I??h(J.options.file)??h(J.options.input),K=await XD(U,Y,{filePath:Q,webhook:h(J.options.webhook)??h(J.options.selector)});if(console.error(`[webhook-ready] 企业环境: ${K.corp.name} (${K.corp.id}) [${K.stateMode}]`),K.corp.tenant?.name)console.error(`[webhook-ready] 租户信息: ${K.corp.tenant.name} (${K.corp.tenant.id})`);console.error(`[webhook-ready] 凭证状态: ${K.authStatus==="ok"?"OK":`异常 (${K.authError})`}`),console.error(`[webhook-ready] Webhook 通道: ${K.activeWebhooks.length} 个可用`);for(let q of K.activeWebhooks){let H=q.isDefault?" [默认通道]":"";console.error(` - ${q.name} (${q.id}) mode=${q.mode}${H}`)}if(K.materialPack)console.error(`[webhook-ready] 材料包预检: ${K.materialPack.valid?`通过 (${K.materialPack.documentCount} 单)`:`失败 (${K.materialPack.errors?.join("; ")})`}`);if(K.ready)console.error(`\uD83D\uDFE2 ${K.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${K.nextAction}`);else console.error(`\uD83D\uDD34 准备阶段未通过: ${K.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${K.nextAction}`);console.log(JSON.stringify(K,null,2));return}if($==="material-pack"||$==="material-pack-push"){let Q=$==="material-pack-push"?"push":I,K=$==="material-pack-push"?h(J.options.file)??h(J.options.input):J.command[3]??h(J.options.file)??h(J.options.input);if(!K)throw Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");if(!FX0(K))throw Error(`File not found: ${K}`);let q=GI(K);if(Q==="preview"){console.log(JSON.stringify(await HI(q.fileBuffer,q.fileName),null,2));return}if(Q!=="push")throw Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");let H=h(J.options.webhook)??h(J.options.selector),G=await F9(U,Y.seal.endpoints.approvalStylePreferences),W;if(H)W=N9(G,H);else if(G.length===1)W=G[0],console.error(`\uD83D\uDC49 自动锁定唯一可用 Webhook 通道: ${W.name} (${W.id})`);else if(G.length>1){let V=G.map((Z)=>`"${Z.name}" (${Z.id})`).join(", ");throw Error(`当前租户存在多个 Webhook 通道 [${V}],请通过 --webhook <idOrName> 指定目标通道。`)}else throw new l8("当前租户未配置任何 Webhook 集成通道。",1,`seal-use webhook add --name <name> --result-url <url> --corp ${Y.id}`);let w=await zD(q.fileBuffer,q.fileName,{webhookUrl:W.incomingDocumentWebhook.url,secret:W.secret,materialPackFilePolicy:W.materialPackFilePolicy});console.log(JSON.stringify(w,null,2));return}if($==="list"){await D0("seal_webhook_ Line truncated
`;var XX0={"SKILL.md":UX0,"agents/openai.yaml":YX0,"references/rule-lightweight.md":JX0,"references/approval-bad-cases.md":QX0,"references/cli.md":KX0,"references/approval-run-lightweight.md":qX0,"references/approval-attachment-trace.md":HX0,"references/customer-feedback-rule-remediation.md":GX0,"references/enterprise-onboarding.md":WX0,"references/hose-enterprise-auth.md":wX0,"references/hose-enterprise-init.md":VX0};function LX0(){return XX0["SKILL.md"]||""}function BH(){return cu(zX0(),".agents","skills","seal-use")}function DX0(){return cu(zX0(),".agents","skills","seal-home")}function FX0(){let $=DX0();if(pu($))try{return YW1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function du($=BH()){FX0(),ZX0($,{recursive:!0});let I=[];for(let[U,Y]of Object.entries(XX0)){let J=cu($,U);ZX0(QW1(J),{recursive:!0}),JW1(J,Y,"utf8"),I.push(U)}return{targetDir:$,files:I}}function mu(){let $=DX0(),I=BH(),U=pu($),Y=pu(I);if(U||Y)return FX0(),du(I),{synced:!0,targetDir:I};return{synced:!1}}function NX0($,I,U){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${LX0()}
`);return}if($==="install"||$==="init"||$==="sync"){let Y=N0(U.options.local)||N0(U.options.workspace),J=h(U.options.dir)??h(U.options.target)??I,Q=J?J:Y?cD(process.cwd(),".agents","skills","seal-use"):BH(),K=du(Q);B0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files});return}if($==="status"||$==="get"||!$){let Y=BH(),J=cD(process.cwd(),".agents","skills","seal-use");B0({global:{dir:Y,installed:OX0(cD(Y,"SKILL.md"))},local:{dir:J,installed:OX0(cD(J,"SKILL.md"))}});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}async function MX0($,I){if($==="config"){B0(await _J(I));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}async function AX0($,I,U,Y){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await F0($,I,U,U$(Y.json),V0(Y.options))}function PX0(){B0(DH.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as KW1,mkdirSync as qW1,renameSync as lu,rmSync as HW1,unlinkSync as RX0,writeFileSync as TX0}from"node:fs";import{dirname as GW1,join as EX0}from"node:path";import{spawnSync as LI}from"node:child_process";function dD($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let U=$.toLowerCase().replace(/\\/g,"/");return!U.endsWith("/bun")&&!U.endsWith("/bun.exe")&&!U.endsWith("/node")&&!U.endsWith("/node.exe")}var jX0="yunyingk/seal-use",RH="yunyingk/seal-home";var WW1="SEAL_USE_GITHUB_REPO",wW1="SEAL_HOME_GITHUB_REPO";async function CX0($,I={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:iu,version:Y1,launcher:$.launcher},Y=I.repo||process.env[WW1]?.trim()||process.env[wW1]?.trim()||jX0,J=I.targetVersion?.trim(),Q=J&&J.toLowerCase()!=="latest"?J:void 0;if(Q){let A=Q.replace(/^v/,""),R=_X0(A,Y1);if(R<0)if(!uE&&I.force);else{B0({updated:!1,currentVersion:Y1,targetVersion:A,mode:dD()?"binary":"source",message:!uE?`Cannot downgrade seal-use from dev build v${Y1} to release v${A}. Use --force to overwrite.`:`Cannot downgrade seal-use from v${Y1} to older version v${A}. Updates must be forward-only.`});return}if(R===0&&!I.force){B0({updated:!1,currentVersion:Y1,targetVersion:A,mode:dD()?"binary":"source",message:`seal-use is already at version v${Y1}. Use --force to reinstall.`});return}}if(I.changelogOnly){let A=await ou(Y,I.limit??10);B0({currentVersion:Y1,totalQueried:A.length,releases:A.map((R)=>({version:R.version,tagName:R.tagName,publishedAt:R.publishedAt,author:R.author,releaseNotes:R.notes,releaseUrl:R.htmlUrl,isCurrent:R.version===Y1,isNewer:vH(R.version,Y1)}))});return}if(!dD()){if(I.checkOnly){let R=await ou(Y,30),k=R[0],g=k?.version??Y1,f=R.find((n)=>n.version===Y1),j=vH(g,Y1),p=R.filter((n)=>vH(n.version,Y1));B0({updated:!1,updateAvailable:j,currentVersion:Y1,currentVersionPublishedAt:f?.publishedAt,latestVersion:g,latestVersionPublishedAt:k?.publishedAt,behindCount:p.length,pendingReleases:p.map((n)=>({version:n.version,tagName:n.tagName,publishedAt:n.publishedAt,author:n.author,releaseNotes:n.notes,releaseUrl:n.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 A=gJ(U).running;if(A)await XI("stop",U);try{vX0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(R){console.error(`git pull skipped: ${R instanceof Error?R.message:String(R)}`)}if(vX0("bun",["install"],{cwd:$.appRoot}),A)await XI("start",U);B0({updated:!0,serviceRestarted:A,version:Y1,mode:"source"});return}let K=VW1(),q=ZW1(),H=await ou(Y,30),G=Q?H.find((A)=>A.version===Q||A.tagName===Q||A.tagName===`v${Q}`)??await BX0(Y,Q):H[0]??await BX0(Y);if(!G){B0({updated:!1,currentVersion:Y1,mode:"binary",message:`Failed to query releases from repository '${Y}'`});return}let W=G.version,w=H.find((A)=>A.version===Y1),V=vH(W,Y1),Z=V||Boolean(I.force),X=H.filter((A)=>vH(A.version,Y1));if(I.checkOnly){B0({updated:!1,updateAvailable:V,currentVersion:Y1,currentVersionPublishedAt:w?.publishedAt,latestVersion:W,latestVersionPublishedAt:G.publishedAt,behindCount:X.length,pendingReleases:X.map((A)=>({version:A.version,tagName:A.tagName,publishedAt:A.publishedAt,author:A.author,releaseNotes:A.notes,releaseUrl:A.htmlUrl})),releaseNotes:G.notes,releaseUrl:G.htmlUrl,mode:"binary"});return}if(!Z){B0({updated:!1,currentVersion:Y1,currentVersionPublishedAt:w?.publishedAt,latestVersion:W,latestVersionPublishedAt:G.publishedAt,mode:"binary",message:`seal-use is already up to date (v${Y1})`});return}let L=zW1(G.assets,K,q);if(!L)throw Error(`No compatible binary found for ${K}-${q} in release v${W}. Available assets: ${G.assets.map((A)=>A.name).join(", ")}`);let D=gJ(U).running;if(D)await XI("stop",U);let O=process.execPath,E=GW1(O),T=EX0(E,`.tmp-update-${Date.now()}`);qW1(T,{recursive:!0});try{let A=EX0(T,L.name);await XW1(L.downloadUrl,A,G.tagName,L.name);let R=A;if(L.name.endsWith(".tar.gz")||L.name.endsWith(".tgz"))R=LW1 Line truncated
`)}catch{}}async function XW1($,I,U,Y){let J=ru(),Q=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,q=Y||$.split("/").pop()||"";if(J!=="github"){if(K&&q)Q.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${q}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${q}`);if($.startsWith("https://git.ying-qing.cn"))Q.push($)}if(J!=="gitea")if(K&&q){let L=`https://github.com/${jX0}/releases/download/${K}/${q}`;if(!process.env.CI)Q.push(`https://ghfast.top/${L}`,`https://gh.ddlc.top/${L}`);Q.push(L)}else if($.includes("github.com")){if(!process.env.CI)Q.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Q.push($)}else Q.push($);let H=Array.from(new Set(Q)),G,W=6000,w=6000,V=307200,Z=1e4,X=180000;for(let L=0;L<H.length;L++){let D=H[L],O=new AbortController,E="",T=(g)=>{E=g;try{O.abort()}catch{}},A=setTimeout(()=>{T("Connection timed out (no response headers within 6s)")},W),R,k;try{mD(`==> [${L+1}/${H.length}] Downloading via: ${D}`);let g=await fetch(D,{signal:O.signal});if(A)clearTimeout(A),A=void 0;if(!g.ok)throw Error(`HTTP ${g.status} ${g.statusText}`);R=setTimeout(()=>{T("Overall download time exceeded 3 minutes")},X);let f=Number(g.headers.get("content-length"))||0,j=g.body?.getReader();if(!j){let i=Buffer.from(await g.arrayBuffer());if(i.length<1000)throw Error(`Downloaded content is suspiciously small (${i.length} bytes)`);TX0(I,i),mD(`✓ Download succeeded (${(i.length/1024/1024).toFixed(1)} MB)`);return}let p=[],n=0,S=0;k=setTimeout(()=>{if(n<V){let i=(n/1024).toFixed(1);T(`Initial transfer too slow (${i} KB < 300 KB in 6s), switching mirror...`)}},w);while(!0){let i=j.read(),U0,B=new Promise((J0,w0)=>{U0=setTimeout(()=>{w0(Error("Data transfer stalled (no chunk received for 10s)"))},Z)}),x;try{x=await Promise.race([i,B])}finally{if(U0)clearTimeout(U0)}let{done:c,value:r}=x;if(c)break;if(r){if(p.push(r),n+=r.length,k&&n>=V)clearTimeout(k),k=void 0;let J0=Date.now();if(J0-S>200){S=J0;let w0=f?Math.round(n/f*100):0,A0=(n/1048576).toFixed(1),j0=f?(f/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${w0}% (${A0} / ${j0} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let b=Buffer.concat(p);if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);TX0(I,b),mD(`✓ Download completed successfully (${(b.length/1024/1024).toFixed(1)} MB)`);return}catch(g){if(A)clearTimeout(A);if(k)clearTimeout(k);if(R)clearTimeout(R);let f=E||(g instanceof Error?g.message:String(g));G=Error(f),mD(`
↳ Mirror failed: ${G.message}`)}finally{if(A)clearTimeout(A);if(k)clearTimeout(k);if(R)clearTimeout(R)}}throw Error(`Failed to download asset from all mirrors: ${G?.message}`)}function LW1($,I,U){let Y=LI("tar",["-xzf",$,"-C",I],{stdio:"pipe"});if(Y.status!==0)throw Error(`Failed to extract tar archive: ${Y.stderr.toString()}`);RX0($);let J=U==="windows"?"seal-use.exe":"seal-use",Q=LI("find",[I,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),K=Q.find((q)=>q.endsWith(`/${J}`)||q.endsWith(J));if(K)return K;return Q[0]||$}function DW1($,I,U){let Y=LI("unzip",["-q","-o",$,"-d",I],{stdio:"pipe"});if(Y.status!==0)throw Error(`Failed to extract zip archive: ${Y.stderr.toString()}`);RX0($);let J=U==="windows"?"seal-use.exe":"seal-use",Q=LI("find",[I,"-type","f"],{encoding:"utf8"}).stdout.trim().split(`
`).filter(Boolean),K=Q.find((q)=>q.endsWith(`/${J}`)||q.endsWith(J));if(K)return K;return Q[0]||$}function _X0($,I){let U=$.replace(/^v/,"").split(".").map((J)=>Number.parseInt(J,10)||0),Y=I.replace(/^v/,"").split(".").map((J)=>Number.parseInt(J,10)||0);for(let J=0;J<Math.max(U.length,Y.length);J++){let Q=U[J]??0,K=Y[J]??0;if(Q>K)return 1;if(Q<K)return-1}return 0}function vH($,I){return _X0($,I)>0}function vX0($,I,U={}){let Y=LI($,I,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(Y.stdout)console.error(Y.stdout.trimEnd());if(Y.stderr)console.error(Y.stderr.trimEnd());if(Y.status!==0)throw Error(`${$} ${I.join(" ")} failed with status ${Y.status}`)}async function SX0($,I,U,Y,J){if($==="create"){let Q=h(J.options.name)??I,K=h(J.options.phone);if(!Q||!K)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let q=h(J.options.dept)??h(J.options.departmentId);await F0("seal_user_create",U,Y,{name:Q,phone:K,departmentIds:q?[q]:void 0},V0(J.options));return}if($==="reset-password"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users reset-password <userId>");await F0("seal_user_reset_password",U,Y,{userId:Q},V0(J.options));return}if($==="search"||$==="list"){let Q=I??h(J.options.keyword)??h(J.options.query)??"";await F0("seal_user_search",U,Y,{keyword:Q},V0(J.options));return}if($==="get"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users get <userId>");await F0("seal_user_get",U,Y,{userId:Q},V0(J.options));return}if($==="delete"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users delete <userId>");await F0("seal_user_delete",U,Y,{userId:Q},V0(J.options));return}if($==="activate"){let Q=I??h(J.options.userId);if(!Q)throw Error("Usage: seal-use users activate <userId>");await F0("seal_user_activate",U,Y,{userId:Q},V0(J.options));return}if($==="delegation"||$==="impersonate"){let Q=I??h(J.options.userId)??h(J.options.phone);if(!Q)throw Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");let K=h(J.options.note);await F0("seal_user_delegation_create",U,Y,{userIdOrPhone:Q,note:K},V0(J.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}import{existsSync as gX0}from"node:fs";async function yX0($,I){if(!gX0($))throw Error(`File not found: ${$}`);let U=WI($);console.log(JSON.stringify(await GI(U.fileBuffer,U.fileName,I),null,2))}async function hX0($,I,U,Y,J){if($==="ready"||$==="status"){let Q=I??h(J.options.file)??h(J.options.input),K=await ND(U,Y,{filePath:Q,webhook:h(J.options.webhook)??h(J.options.selector)});if(console.error(`[webhook-ready] 企业环境: ${K.corp.name} (${K.corp.id}) [${K.stateMode}]`),K.corp.tenant?.name)console.error(`[webhook-ready] 租户信息: ${K.corp.tenant.name} (${K.corp.tenant.id})`);console.error(`[webhook-ready] 凭证状态: ${K.authStatus==="ok"?"OK":`异常 (${K.authError})`}`),console.error(`[webhook-ready] Webhook 通道: ${K.activeWebhooks.length} 个可用`);for(let q of K.activeWebhooks){let H=q.isDefault?" [默认通道]":"";console.error(` - ${q.name} (${q.id}) mode=${q.mode}${H}`)}if(K.materialPack)console.error(`[webhook-ready] 材料包预检: ${K.materialPack.valid?`通过 (${K.materialPack.documentCount} 单)`:`失败 (${K.materialPack.errors?.join("; ")})`}`);if(K.ready)console.error(`\uD83D\uDFE2 ${K.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${K.nextAction}`);else console.error(`\uD83D\uDD34 准备阶段未通过: ${K.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${K.nextAction}`);console.log(JSON.stringify(K,null,2));return}if($==="material-pack"||$==="material-pack-push"){let Q=$==="material-pack-push"?"push":I,K=$==="material-pack-push"?h(J.options.file)??h(J.options.input):J.command[3]??h(J.options.file)??h(J.options.input);if(!K)throw Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");if(!gX0(K))throw Error(`File not found: ${K}`);let q=WI(K);if(Q==="preview"){console.log(JSON.stringify(await GI(q.fileBuffer,q.fileName),null,2));return}if(Q!=="push")throw Error("Usage: seal-use webhook material-pack <preview|push> <材料包.zip>");let H=h(J.options.webhook)??h(J.options.selector),G=await N9(U,Y.seal.endpoints.approvalStylePreferences),W;if(H)W=M9(G,H);else if(G.length===1)W=G[0],console.error(`\uD83D\uDC49 自动锁定唯一可用 Webhook 通道: ${W.name} (${W.id})`);else if(G.length>1){let V=G.map((Z)=>`"${Z.name}" (${Z.id})`).join(", ");throw Error(`当前租户存在多个 Webhook 通道 [${V}],请通过 --webhook <idOrName> 指定目标通道。`)}else throw new a8("当前租户未配置任何 Webhook 集成通道。",1,`seal-use webhook add --name <name> --result-url <url> --corp ${Y.id}`);let w=await OD(q.fileBuffer,q.fileName,{webhookUrl:W.incomingDocumentWebhook.url,secret:W.secret,materialPackFilePolicy:W.materialPackFilePolicy});console.log(JSON.stringify(w,null,2));return}if($==="list"){await F0("seal_webhook_ Line truncated
`)?"":`
`}`);process.exitCode=$.exitCode}var WW1=Boolean(r.main==r.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&EX0(process.argv[1])===EX0(r5));if(WW1)if(process.argv[2]==="--seal-use-cli"||process.argv[2]==="--seal-home-cli")await GW1();else ju().catch(($)=>{console.error($),process.exitCode=1});export{Ru as tokenizeCommand,ju as startServer,KW1 as resolveMcpEnabled,qW1 as createServer,JW1 as SEAL_MCP_ENABLED_ENV,YW1 as SEAL_CLI_TOOL_NAME,QW1 as LEGACY_SEAL_MCP_ENABLED_ENV};
`}`);process.exitCode=$.exitCode}var SW1=Boolean(t.main==t.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&fX0(process.argv[1])===fX0(r5));if(SW1)if(process.argv[2]==="--seal-use-cli"||process.argv[2]==="--seal-home-cli")await _W1();else uu().catch(($)=>{console.error($),process.exitCode=1});export{yu as tokenizeCommand,uu as startServer,RW1 as resolveMcpEnabled,jW1 as createServer,BW1 as SEAL_MCP_ENABLED_ENV,EW1 as SEAL_CLI_TOOL_NAME,vW1 as LEGACY_SEAL_MCP_ENABLED_ENV};
+13 -1
View File
@@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "seal-use Wrapped API",
"version": "0.10.15",
"version": "0.10.17",
"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": [
@@ -1369,6 +1369,18 @@
}
}
}
},
"delete": {
"tags": [
"Approval Knowledge"
],
"operationId": "deleteApprovalDocument",
"summary": "Delete approval knowledge document",
"responses": {
"200": {
"description": "Deleted document confirmation."
}
}
}
},
"/v1/approval/style-preferences": {
+1 -1
View File
@@ -1,7 +1,7 @@
openapi: 3.1.0
info:
title: seal-use Wrapped API
version: 0.10.15
version: 0.10.17
description: |
Planned HTTP contract for the seal-use wrapped backend API.
+7
View File
@@ -265,6 +265,13 @@ paths:
application/json:
schema:
$ref: ../components/schemas/index.yaml#/ApprovalDocument
delete:
tags: [Approval Knowledge]
operationId: deleteApprovalDocument
summary: Delete approval knowledge document
responses:
"200":
description: Deleted document confirmation.
/v1/approval/style-preferences:
get:
tags: [Approval Knowledge]
+3 -1
View File
@@ -1,6 +1,6 @@
{
"name": "seal-use",
"version": "0.10.15",
"version": "0.10.17",
"type": "module",
"module": "src/server.ts",
"bin": {
@@ -16,6 +16,8 @@
"build:binary": "node scripts/build-binary.mjs",
"build:plugin": "node scripts/build-plugin.mjs",
"bump": "bun run scripts/bump-version.ts",
"dev:override": "bun run scripts/dev-override.ts",
"dev:link": "bun run scripts/dev-override.ts",
"openapi:bundle": "bun run scripts/bundle-openapi.ts",
"openapi:raw": "bun run scripts/generate-raw-openapi.ts",
"test": "bun test"
+91 -9
View File
@@ -1,5 +1,5 @@
import { mkdirSync } from "node:fs";
import { spawn } from "node:child_process";
import { mkdirSync, readFileSync } from "node:fs";
import { spawn, spawnSync } from "node:child_process";
import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url";
@@ -18,14 +18,95 @@ const args = process.argv.slice(2);
const isAll = args.includes("--all") || args.includes("--matrix");
const targetArg = args.find((arg) => arg.startsWith("--target="))?.replace("--target=", "");
const shouldMinify = !args.includes("--no-minify");
const isRelease = args.includes("--release") ||
process.env.SEAL_BUILD_RELEASE === "1" ||
(Boolean(process.env.CI) && process.env.GITHUB_REF_TYPE === "tag");
function getBuildInfo(releaseMode) {
const pkg = JSON.parse(readFileSync(resolve(root, "package.json"), "utf8"));
if (releaseMode) {
return {
version: pkg.version,
channel: "release",
isRelease: true
};
}
try {
const res = spawnSync("git", ["describe", "--tags", "--long", "--dirty", "--always"], {
cwd: root,
encoding: "utf8"
});
if (res.status === 0 && res.stdout) {
const trimmed = res.stdout.trim();
const dirty = trimmed.endsWith("-dirty");
const clean = dirty ? trimmed.slice(0, -6) : trimmed;
const longMatch = clean.match(/^v?(\d+\.\d+\.\d+(?:-[a-zA-Z0-9.]+)?)-(\d+)-g([0-9a-f]+)$/);
let baseVersion = pkg.version;
let commitsAhead = 0;
let commit = "";
if (longMatch) {
baseVersion = longMatch[1];
commitsAhead = Number.parseInt(longMatch[2], 10);
commit = longMatch[3];
} else {
const rev = spawnSync("git", ["rev-parse", "--short", "HEAD"], { cwd: root, encoding: "utf8" });
if (rev.status === 0 && rev.stdout) commit = rev.stdout.trim();
}
const dirtySuffix = dirty ? ".dirty" : "";
const commitSuffix = commit ? `+g${commit}${dirtySuffix}` : dirty ? "+dirty" : "";
const version = `${baseVersion}-dev.${commitsAhead}${commitSuffix}`;
return {
version,
channel: "dev",
isRelease: false,
git: {
baseVersion,
commitsAhead,
commit,
dirty,
describe: trimmed
}
};
}
} catch {
// fallback
}
return {
version: `${pkg.version}-dev.0+local`,
channel: "dev",
isRelease: false
};
}
async function main() {
const startTime = Date.now();
const buildInfo = getBuildInfo(isRelease);
console.log(`[build:binary] version: ${buildInfo.version} (${buildInfo.channel}, isRelease: ${buildInfo.isRelease})`);
const buildEnv = {
...process.env,
SEAL_BUILD_VERSION: buildInfo.version,
SEAL_BUILD_CHANNEL: buildInfo.channel,
SEAL_BUILD_IS_RELEASE: String(buildInfo.isRelease),
...(buildInfo.git ? {
SEAL_BUILD_GIT_BASE: buildInfo.git.baseVersion,
SEAL_BUILD_GIT_COMMITS_AHEAD: String(buildInfo.git.commitsAhead),
SEAL_BUILD_GIT_COMMIT: buildInfo.git.commit,
SEAL_BUILD_GIT_DIRTY: String(buildInfo.git.dirty),
SEAL_BUILD_GIT_DESCRIBE: buildInfo.git.describe
} : {})
};
if (isAll) {
console.log(`[build:binary] compiling ${Object.keys(TARGET_MAP).length} targets in parallel (minify: ${shouldMinify})...`);
await Promise.all(
Object.entries(TARGET_MAP).map(([name, config]) =>
buildTarget(name, config.bunTarget, resolve(root, config.outfile), shouldMinify)
buildTarget(name, config.bunTarget, resolve(root, config.outfile), shouldMinify, buildEnv)
)
);
console.log(`[build:binary] all targets compiled in ${((Date.now() - startTime) / 1000).toFixed(2)}s`);
@@ -34,16 +115,16 @@ async function main() {
if (!config) {
throw new Error(`Unknown target: ${targetArg}. Available targets: ${Object.keys(TARGET_MAP).join(", ")}`);
}
await buildTarget(targetArg, config.bunTarget, resolve(root, config.outfile), shouldMinify);
await buildTarget(targetArg, config.bunTarget, resolve(root, config.outfile), shouldMinify, buildEnv);
} else {
const output = resolve(root, "dist/bin/seal-use");
await buildTarget("host", null, output, shouldMinify);
await buildTarget("host", null, output, shouldMinify, buildEnv);
}
}
async function buildTarget(name, bunTarget, output, minify = true) {
async function buildTarget(name, bunTarget, output, minify = true, buildEnv = process.env) {
mkdirSync(dirname(output), { recursive: true });
const buildArgs = ["build", "--compile"];
const buildArgs = ["build", "--compile", "--env=SEAL_BUILD_*"];
if (minify) {
buildArgs.push("--minify");
}
@@ -53,7 +134,7 @@ async function buildTarget(name, bunTarget, output, minify = true) {
buildArgs.push("--outfile", output, "src/cli.ts");
console.log(`[build:binary] start compiling: ${name} -> ${output}`);
await runAsync(bun, buildArgs);
await runAsync(bun, buildArgs, { env: buildEnv });
if (process.platform === "darwin" && (name.startsWith("darwin") || name === "host")) {
try {
@@ -74,7 +155,8 @@ function runAsync(command, args, options = {}) {
return new Promise((res, rej) => {
const child = spawn(command, args, {
cwd: root,
stdio: options.quiet ? ["ignore", "ignore", "ignore"] : "inherit"
stdio: options.quiet ? ["ignore", "ignore", "ignore"] : "inherit",
env: options.env ?? process.env
});
child.on("error", rej);
child.on("exit", (code) => {
+158
View File
@@ -0,0 +1,158 @@
#!/usr/bin/env bun
import { chmodSync, copyFileSync, existsSync, mkdirSync, rmSync, symlinkSync } from "node:fs";
import { spawnSync } from "node:child_process";
import { homedir } from "node:os";
import { dirname, join, resolve } from "node:path";
import { fileURLToPath } from "node:url";
const root = resolve(dirname(fileURLToPath(import.meta.url)), "..");
function resolveTargetBinaryPath(): string {
// 1. Check which seal-use
try {
const whichRes = spawnSync("which", ["seal-use"], { encoding: "utf8" });
if (whichRes.status === 0 && whichRes.stdout) {
const p = whichRes.stdout.trim();
if (p && existsSync(p)) {
return p;
}
}
} catch {
// ignore
}
// 2. Fallback candidate paths in order of preference
const candidates = [
"/opt/homebrew/bin/seal-use",
"/usr/local/bin/seal-use",
join(homedir(), ".local", "bin", "seal-use"),
join(homedir(), "bin", "seal-use")
];
for (const candidate of candidates) {
const dir = dirname(candidate);
if (existsSync(dir)) {
return candidate;
}
}
const defaultDir = join(homedir(), ".local", "bin");
mkdirSync(defaultDir, { recursive: true });
return join(defaultDir, "seal-use");
}
async function main() {
console.error("==> [dev:override] Building latest host binary from local worktree...");
// 1. Compile host binary with dev metadata
const buildRes = spawnSync("node", ["scripts/build-binary.mjs"], {
cwd: root,
stdio: ["ignore", "inherit", "inherit"]
});
if (buildRes.status !== 0) {
console.error("❌ [dev:override] Build failed.");
process.exit(buildRes.status ?? 1);
}
const localBinary = join(root, "dist", "bin", "seal-use");
if (!existsSync(localBinary)) {
console.error(`❌ [dev:override] Expected binary at ${localBinary} not found.`);
process.exit(1);
}
const targetPath = resolveTargetBinaryPath();
const targetDir = dirname(targetPath);
mkdirSync(targetDir, { recursive: true });
console.error(`==> [dev:override] Installing to global path: ${targetPath}`);
// 2. Check and stop background service if running
let serviceWasRunning = false;
try {
const statusRes = spawnSync(targetPath, ["service", "status"], { encoding: "utf8" });
if (statusRes.status === 0 && statusRes.stdout) {
const parsed = JSON.parse(statusRes.stdout);
if (parsed.running) {
console.error("==> [dev:override] Stopping running background service daemon...");
spawnSync(targetPath, ["service", "stop"], { stdio: "ignore" });
serviceWasRunning = true;
}
}
} catch {
// ignore
}
// 3. Atomically overwrite target binary
const tmpTarget = `${targetPath}.tmp.${Date.now()}`;
copyFileSync(localBinary, tmpTarget);
chmodSync(tmpTarget, 0o755);
if (process.platform === "darwin") {
try {
spawnSync("/usr/bin/codesign", ["--remove-signature", tmpTarget], { stdio: "ignore" });
spawnSync("/usr/bin/codesign", ["--force", "--sign", "-", tmpTarget], { stdio: "ignore" });
} catch {
// ignore
}
}
copyFileSync(tmpTarget, targetPath);
chmodSync(targetPath, 0o755);
try {
rmSync(tmpTarget, { force: true });
} catch {
// ignore
}
// 4. Ensure legacy seal-home symlink exists
const legacyLink = join(targetDir, "seal-home");
if (legacyLink !== targetPath) {
try {
if (existsSync(legacyLink)) rmSync(legacyLink, { force: true });
symlinkSync(targetPath, legacyLink);
} catch {
// ignore
}
}
// 5. Sync Agent Skill to ~/.agents/skills/seal-use
const skillSource = join(root, "skills", "seal-use");
const skillTarget = join(homedir(), ".agents", "skills", "seal-use");
const legacySkill = join(homedir(), ".agents", "skills", "seal-home");
if (existsSync(legacySkill)) {
try {
rmSync(legacySkill, { recursive: true, force: true });
} catch {}
}
if (existsSync(skillSource)) {
try {
const { cpSync } = await import("node:fs");
mkdirSync(dirname(skillTarget), { recursive: true });
cpSync(skillSource, skillTarget, { recursive: true });
console.error(`✓ [dev:override] Synced agent skill to ${skillTarget}`);
} catch (err) {
console.error(`⚠️ [dev:override] Failed to sync agent skill: ${err}`);
}
}
// 6. Restart service daemon if it was previously running
if (serviceWasRunning) {
console.error("==> [dev:override] Restarting background service daemon with new binary...");
spawnSync(targetPath, ["service", "start"], { stdio: "ignore" });
}
// 7. Verify and output
console.error("✨ [dev:override] Success! Active global seal-use binary is now updated:");
const testRes = spawnSync(targetPath, ["v"], { encoding: "utf8" });
if (testRes.status === 0 && testRes.stdout) {
process.stdout.write(testRes.stdout);
} else {
console.error(testRes.stderr || "Failed to verify updated binary");
}
}
main().catch((err) => {
console.error(err);
process.exit(1);
});
+39 -14
View File
@@ -1,28 +1,38 @@
---
name: seal-use
description: "v0.10.15: 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.17: 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.15
short-description: Seal tenant and Hose approval automation (v0.10.15)
version: 0.10.17
short-description: Seal tenant and Hose approval automation (v0.10.17)
---
# Seal Use (v0.10.15)
# Seal Use (v0.10.17)
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.
## Bootstrap & Installation (环境安装与自愈)
If `seal-use` or `seal_cli` is not installed on the system, the Agent should automatically install it via:
Agent 必须确保使用最新版本的 `seal-use` CLI、Skill 与 Agent 插件。在执行任何配置或业务任务前,优先核验版本状态:
```bash
# 国内高速安装(Gitea 镜像源,免代理、秒级完成)
seal-use version
seal-use corps list
```
如果 CLI 或 Skill 尚未安装或落后于发布版本,通过以下命令一键安装或升级:
```bash
# 方式 1:CLI 自更新(已安装时推荐)
seal-use update
# 方式 2:国内高速一键安装与自愈(Gitea 镜像源,免代理、秒级完成)
curl -fsSL https://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash
# Global / GitHub Direct
# 方式 3:Global / GitHub Direct
curl -fsSL https://raw.githubusercontent.com/yunyingk/seal-use/main/scripts/install.sh | bash
```
After installation, verify with:
安装或升级后,验证系统连通性:
```bash
seal-use version
seal-use corps list
@@ -39,8 +49,8 @@ seal-use corps list
- Prefer compact commands first: `pick`, `--summary`, `--fields`, `attachments --summary`, `rules count`, and `rules list --summary`.
- Parse JSON stdout. Do not scrape human text.
- Do not hand-edit enterprise configs for normal setup. Use `seal-use corps ...`.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For supported configuration writes, prefer the universal `--dry-run` preview first (rules clear/push, preferences, thinking-depth policies, HoseCloud configure, and Webhook add/update/delete), then use `--yes` only after reviewing its redacted `changesDiff`.
- Knowledge document creation is currently irreversible: the upstream API exposes no delete operation. Validate `contentType` and `scenarios` before creating, and use `enabled: false` when the document should be withdrawn.
- Before write operations on rules, documents, style preferences, or publishing, fetch current state and confirm the intended mutation with the user. For supported configuration writes, prefer the universal `--dry-run` preview first (rules clear/push, `corps sync-test`, preferences, thinking-depth policies, HoseCloud configure, and Webhook add/update/delete), then use `--yes` only after reviewing its redacted `changesDiff`.
- Knowledge document creation and deletion are now supported. Validate `contentType` and `scenarios` before creating; use `enabled: false` when the document should be withdrawn without deletion. For an explicit deletion, re-read the document and obtain confirmation before using the low-level `seal_approval_delete_document` tool.
- For customer-feedback rule remediation, show an exact field-level diff and obtain explicit approval before updating. Default to changing only the narrowest necessary part of `description`; preserve `scope`, `strictness`, and unrelated clauses unless the user explicitly approves otherwise.
- Resolve and lock the target enterprise `corpId` before diagnosis or mutation. Never assume the current tenant is the customer tenant. Re-fetch the target rule immediately before updating, then verify the draft and newly published version after writing.
- For date questions, use explicit dates and `--timezone Asia/Shanghai`.
@@ -50,20 +60,25 @@ seal-use corps list
- Never treat “Seal 协助/Seal 授权/委托” as a 合思授权入口. They are different links and must use different commands.
- In the default stateless mode, every enterprise command requires `--corp <corpId>`. In stateful mode, omitting `--corp` uses the configured default enterprise and is unsafe for an explicitly named enterprise.
- For an explicitly named enterprise, first resolve it with `seal-use corps list`, then pass its exact `corpId` to every command. After creation, verify the returned URL host matches that enterprise's Seal tenant; if the host is the current/default tenant or cannot be verified, do not present the link as the target enterprise's link.
- 生产规则变更建议优先遵循“生产改草稿 -> 同步测试企业 -> 真实单据模拟验证 -> 生产发布投产”安全闭环;Agent 应主动提示并建议在测试环境中验证,但最终操作权与决策权在用户手中,绝不代替用户做决定。若用户明确要求直接在生产环境发布,尊重用户意图并严格执行。
- 测试环境合思模拟安全隔离:`corps sync-test` 自动将生产企业合思凭证以 `assisted` 模式注入测试企业,名称格式为 `{企业名前缀}(Seal测)`。该配置仅保存在测试 Seal 侧,绝对不执行 `deploy hosecloud sync`,杜绝向生产合思费控推送 EBot 节点或创建外发 webhook。
## Route By Intent
- 生产规则安全演进、搭配配置与测试模拟闭环: read `references/staging-simulation-workflow.md`. 适用于:用户提出规则变更需求/客诉修复、生产与测试企业搭配接入与 1 对 1 绑定、生产环境仅改草稿隔离风险、`seal-use corps sync-test` 一键同步测试环境(含合思集成免配同步)、测试环境跑真实单据模拟验证、验证通过后才在生产正式发布的完整安全生命周期。
- First install / zero configuration / “how do I connect my enterprise?” / user supplies app credentials, an assistance link, or F12/Network cURL: read `references/enterprise-onboarding.md`. Ask what material the user already has in plain language, then discover all remaining identifiers automatically.
- User-facing Seal tenant assistance link (Seal 协助/Seal 授权/委托): resolve the named enterprise first, then run `seal-use delegation create --corp <corpId> --note '<enterprise>'`; verify the returned hostname is that tenant's Seal hostname. Always provide BOTH a code block (` ```text ... ``` `) AND a hyperlink.
- Packaged customer feedback → approval-rule remediation: read `references/customer-feedback-rule-remediation.md`. Use this route for WeChat messages, screenshots, rejection notifications, document numbers, customer complaints, expected approval behavior, rule-only mitigation, exact diffs, or requests to update and publish a rule version.
- 模拟测试发布闭环: `seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>` (合思指定单号) 或 `--mode material_pack --package-ids ... --schema-config file.json` (材料包导入), 支持多源系统 `--source-system <hosecloud|feishu|weaver|helios|maycur|material_pack>`, `simulation status <batchId>` 单次查询状态, `simulation wait <batchId>` 轮询等待完成, `simulation clean <batchId>` 清理数据, `simulation specifications` 列出单据模板, `simulation list`/`get`/`batch-records` 查看批次与记录。创建前确认目标环境为测试环境。
- 测试企业标记、关联与配置规则同步: `seal-use corps mark <corpId> --env <production|test> --confirm` (严格标记环境), `seal-use corps bind-test <prodCorpId> <testCorpId> --confirm` (严格1对1下挂,禁止多层级串联), `seal-use corps unbind-test <corpId> --confirm`, `seal-use corps sync-test <prodCorpId> [--dry-run|--yes] [--version-name <name>]` (将正式企业的偏好和草稿规则覆盖同步到测试企业并直接发布成新版本,正式企业规则保持草稿态不发布)。
- 模拟测试发布闭环: `seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>` (合思指定单号) 或 `--mode material_pack --package-ids ... --schema-config file.json` (材料包导入), 支持多源系统 `--source-system <hosecloud|feishu|weaver|helios|maycur|material_pack>`, `simulation status <batchId>` 单次查询状态, `simulation wait <batchId>` 轮询等待完成, `simulation clean <batchId>` 清理数据, `simulation specifications` 列出单据模板, `simulation approval-definitions` 查询飞书审批定义, `simulation list`/`get`/`batch-records` 查看批次与记录。创建前确认目标环境为测试环境。
- 测试企业标记、关联与配置规则同步: `seal-use corps mark <corpId> --env <production|test> --confirm` (严格标记环境), `seal-use corps bind-test <prodCorpId> <testCorpId> --confirm` (严格1对1下挂,禁止多层级串联), `seal-use corps unbind-test <corpId> --confirm`, `seal-use corps sync-test <prodCorpId> [--dry-run|--yes] [--version-name <name>]` (将正式企业的偏好、草稿规则和知识文档覆盖同步到测试企业并自动发布语义版本 `[Prod vN · #M -> Test vM]`,输出并本地缓存 `versionMapping`/`ruleMapping`,正式企业规则保持草稿态不发布), `seal-use rules map [--corp <corpId>] [--version <v|latest>] [--code <code>]` (离线毫秒级速查测试与生产规则对照映射)。
- 规则本地工作流: `seal-use rules pull` 导出草稿规则,`rules lint` 做质量检查,`rules push --dry-run` 预览增量更新,确认后用 `--yes` 写入;`rules map` 查询 `corps sync-test` 生成的跨企业规则映射。规则版本与草稿/发布 code 空间的区别详见 `references/rule-lightweight.md` 和 `references/cli.md`。
- Seal AI 智能审核发布到合思费控: `seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>`; read `references/hose-enterprise-deploy.md`.
- 审核决策偏好与思考深度: `seal-use preference get --corp <corpId>`, `preference decision update --json '...' --corp <corpId>`, `preference thinking-depth set --default <medium|high> --corp <corpId>`, `preference thinking-depth policies <list|upsert|remove> --corp <corpId>`.
- 审核大盘统计与去重分析: `seal-use approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|id] --corp <corpId>`, `seal-use approval-runs count --corp <corpId>`.
- 审核大盘统计与去重分析: `seal-use approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id] --corp <corpId>`, `approval-runs count`, `analytics insight`, 以及 `approval-runs export`(Excel 报表);需要追踪单据时再使用 `url` 或 `bridge`。
- User-facing 合思 authorization link (合思/易快报授权): `seal-use auth hose-link --corp <corpId> --expire 7200`; read `references/hose-enterprise-auth.md`. Never use this route when the user says Seal 协助. Always provide BOTH a code block (` ```text ... ``` `) AND a hyperlink.
- Delegation links management: `seal-use delegation list --corp <corpId>`, `create [--note ...] --corp <corpId>`, `create --from-link <url> [--note ...]`, `revoke <tokenId> --corp <corpId>`.
- User & Contacts Management (用户搜索、激活与一键代生成授权): `seal-use users search [keyword] --corp <corpId>`, `users delegation <userIdOrPhone> --corp <corpId>` (仅适用于 Seal 本地创建的账号 `provider: local`;对合思同步账号系统拒绝重置密码,需改用 `auth hose-link`), `users activate <userId> --corp <corpId>`, `users create --name ... --phone ... --corp <corpId>`, `reset-password <userId> --corp <corpId>`, `get <userId> --corp <corpId>`, `delete <userId> --corp <corpId>`.
- User & Contacts Management (用户搜索、激活与一键代生成授权): `seal-use users search [keyword] --corp <corpId>`, `users delegation <userIdOrPhone> --corp <corpId>` (仅适用于 Seal 本地创建的账号 `provider: local`;对合思同步账号系统拒绝重置密码,需改用 `auth hose-link`), `users activate <userId> --corp <corpId>`, `users create --name ... --phone ... --corp <corpId>`, `users reset-password <userId> --corp <corpId>`, `users get <userId> --corp <corpId>`, `users delete <userId> --corp <corpId>`.
- 只读业务数据与组织发现: `seal-use contacts departments|children|users|sync-time --corp <corpId>`, `seal-use data expenses|invoices --corp <corpId>`, `seal-use analytics insight --corp <corpId>`, `seal-use context --corp <corpId>`, `seal-use source config --corp <corpId>`;这些查询优先用于定位企业结构、原始费用/发票和当前审核知识,不要把结果误当成写操作。
- LLM Model Config & Providers: `seal-use llm config --corp <corpId>`, `seal-use llm providers --corp <corpId>`.
- 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>`.
@@ -103,6 +118,9 @@ seal-use approval-runs result <recordId> --corp <corpId> --summary
seal-use rules count --corp <corpId>
seal-use rules list --corp <corpId> --summary
seal-use rules lint --corp <corpId> --summary
seal-use rules pull --corp <corpId> --out ./rules.local.json
seal-use rules push --corp <corpId> --file ./rules.local.json --dry-run
seal-use rules map --corp <corpId> --version latest
seal-use rules clear --corp <corpId> --dry-run
seal-use rules clear --corp <corpId> --yes
seal-use rules get --corp <corpId> --version 16 --code '#0038'
@@ -113,6 +131,12 @@ seal-use simulation package-upload <材料包.zip> --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 status <batchId> --corp <corpId>
seal-use simulation approval-definitions --corp <corpId>
seal-use approval-runs export --corp <corpId> --downloads --completed-only
seal-use analytics insight --corp <corpId>
seal-use contacts departments --corp <corpId>
seal-use data invoices --corp <corpId> --limit 20
seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["差旅","发票"],"areas":["rules"],"snippetOnly":true,"maxChars":500,"fields":["id","title","snippet"]}'
```
@@ -139,6 +163,7 @@ seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["差旅"
- `references/hose-enterprise-init.md`: 合思标准密钥的域名、企业与管理员自动发现,以及多候选管理员的安全选择。
- `references/hose-enterprise-deploy.md`: Seal AI 智能审核发布到合思费控(添加/编辑配置、平台自动探测、一键同步与 EBot 节点发布)。
- `references/approval-attachment-trace.md`: 附件/发票/OCR/图片争议的 Langfuse 追踪工作流。
- `references/staging-simulation-workflow.md`: 生产与测试环境搭配配置、合思集成免配自动同步、单据模拟测试验证与生产规则安全演进闭环指南。
- `references/cli.md`: 完整 CLI 命令清单。
## Safety
+55 -7
View File
@@ -9,8 +9,11 @@ seal-use <command>
Enterprise config lookup:
- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.
- Otherwise `./enterprises` and `~/.config/seal-use/enterprises` are merged.
- User-level configs override same-ID local configs.
- Otherwise the user-level `~/.config/seal-use/enterprises` directory is loaded. A configured
`testEnterprisesDir` is loaded first for test-tenant workflows. The current working directory's
`./enterprises` directory is not loaded implicitly.
- Set `SEAL_USE_ENTERPRISES_DIR` to use one explicit directory instead. Legacy
`~/.config/seal-home/enterprises` files are migrated to the primary directory when possible.
Enterprise selection is stateless by default. Commands that access an enterprise require
`--corp <corpId>` unless stateful mode is explicitly enabled:
@@ -39,13 +42,33 @@ 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 count [--corp <corpId>]
seal-use rules list [--summary] [--count] [--limit 20] [--offset 0] [--corp <corpId>]
seal-use rules clear [--corp <corpId>] [--dry-run|--yes]
seal-use rules versions [--corp <corpId>]
seal-use rules version <versionId|versionNumber|latest> [--corp <corpId>]
seal-use rules get --corp <corpId> --version <number|latest> --code '#0038'
seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
seal-use rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
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 map [--corp <corpId>] [--version <id|num|latest>] [--code <code>]
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
seal-use update [--check] [--force] [--version <v>]
seal-use update check
seal-use update changelog [--limit <n>]
seal-use changelog [--limit <n>]
seal-use mcp
seal-use mcp config
seal-use mcp-config
seal-use skill dump
seal-use skill install [--dir <path>|--local]
seal-use skill status
seal-use openapi
seal-use probe [<corpId>]
seal-use tools list
seal-use corps list [--corp <corpId>]
seal-use corps current [--corp <corpId>]
@@ -63,6 +86,9 @@ seal-use delegation list [--corp <corpId>]
seal-use delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]
seal-use delegation revoke <tokenId> [--corp <corpId>]
seal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]
seal-use users search <keyword> [--corp <corpId>]
seal-use users delegation <userIdOrPhone|name> [--note <note>] [--corp <corpId>]
seal-use users activate <userId> [--corp <corpId>]
seal-use users reset-password <userId> [--corp <corpId>]
seal-use users get <userId> [--corp <corpId>]
seal-use users delete <userId> [--corp <corpId>]
@@ -79,14 +105,18 @@ seal-use permissions configs [--corp <corpId>]
seal-use billing status [--corp <corpId>]
seal-use billing plans [--corp <corpId>]
seal-use billing features [--corp <corpId>]
seal-use webhook ready [<材料包.zip>] [--webhook <idOrName>] [--corp <corpId>]
seal-use webhook status [<材料包.zip>] [--corp <corpId>]
seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]
seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--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] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--corp <corpId>]
seal-use webhook delete <idOrName> [--yes|--dry-run] [--corp <corpId>]
seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.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>]
seal-use deploy hosecloud get <sign-key> [--corp <corpId>]
seal-use deploy hosecloud status [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--dry-run] [--corp <corpId>]
seal-use deploy hosecloud sync [<sign-key>] [--auto] [--corp <corpId>]
@@ -96,6 +126,7 @@ seal-use preference thinking-depth set --default <medium|high> [--dry-run] [--co
seal-use preference thinking-depth policies list [--corp <corpId>]
seal-use preference thinking-depth policies upsert --json '{...}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies remove <policyId> [--dry-run] [--corp <corpId>]
seal-use context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
seal-use source config [--corp <corpId>]
seal-use tool <toolName> [--corp <corpId>] [--json '{"key":"value"}']
seal-use approval-runs summary --corp <corpId> [--date YYYY-MM-DD] [--timezone Asia/Shanghai]
@@ -149,6 +180,14 @@ Identity and session:
- `seal-use corps list`
- `seal-use corps current`
Read-only discovery:
- `seal-use contacts departments|children|users|sync-time --corp <corpId>` queries the tenant's organization tree and last directory sync time.
- `seal-use data expenses|invoices --corp <corpId> [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>]` queries paginated raw expense or invoice records.
- `seal-use analytics insight --corp <corpId> [--start-date <ISO>] [--end-date <ISO>] [--limit <n>]` queries risk-tag statistics; omitted dates use the current month.
- `seal-use context --corp <corpId> [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50]` aggregates rules, knowledge documents, and style preferences.
- `seal-use source config --corp <corpId>` resolves the live source-system configuration without changing it.
Test Enterprise Binding & Staging Synchronization:
- **1-to-1 Association**: One production enterprise can only bind at most one test enterprise (`corps bind-test <prodCorpId> <testCorpId>`). Multi-tier chaining is rejected.
@@ -156,12 +195,15 @@ Test Enterprise Binding & Staging Synchronization:
- **Production Safety Guarantee (`corps sync-test`)**:
- In the **Production Enterprise**: Rules remain strictly in **draft state** without publishing any live version.
- In the **Test Enterprise**: Style preferences (`decisionPreferences`, `thinkingDepthPreference`) are updated to match production, test draft rules are cleared and populated with production draft rules, recoded, and immediately **published as a new official version** in the test tenant (`--version-name <name>`).
- `--dry-run` previews the full preference diff and rule sync plan without sending mutations. Execution requires `--yes`.
- **Semantic Version Naming**: Defaults to `Sync from <ProdCorp> [Prod v<N> · #<Iteration>]` tracking production baseline version and test draft iteration without redundant date strings.
- **Rule Mapping & Local Snapshot**: Returns `versionMapping` and `ruleMapping` in CLI stdout and saves persistent snapshot to `~/.config/seal-use/mappings/<testCorpId>-v<N>.json` and `<testCorpId>-latest.json`.
- `--dry-run` previews the full preference diff, version mapping plan, and rule sync plan without sending mutations. Execution requires `--yes`.
Approval rule maintenance:
- `seal-use rules count [--corp <corpId>]`
- `seal-use rules list --summary [--corp <corpId>]`
- `seal-use rules map [--corp <corpId>] [--version <id|num|latest>] [--code <code>]` (reads local sync rule mapping snapshot)
- `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]` incrementally applies the local file: matched IDs are updated, missing local IDs are created, and remote IDs absent from the file are deleted. It does not clear/recreate the whole draft or recode it. Run `--dry-run` first; a local file exported with `rules pull` is preferred.
@@ -188,6 +230,11 @@ Approval run lightweight queries:
Approval knowledge documents & style:
- `seal-use tool seal_approval_documents_list --corp <corpId> --json '{"limit":50}'`
- `seal-use tool seal_approval_document_get --corp <corpId> --json '{"documentId":"doc-id"}'`
- `seal-use tool seal_approval_document_create --corp <corpId> --json '{"title":"标题","purpose":"用途","content":"Markdown 内容","contentType":"policy","scenarios":["audit"]}'`
- `seal-use tool seal_approval_document_update --corp <corpId> --json '{"documentId":"doc-id","enabled":false}'`
- `seal-use tool seal_approval_delete_document --corp <corpId> --json '{"documentId":"doc-id"}'` (删除前必须重新读取并确认)
- `seal-use rules get --corp <corpId> --version <number> --code '#0038'`
- `seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205`
@@ -205,7 +252,7 @@ Webhook integrations:
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. Each Webhook can also store a mutable `materialPackFilePolicy` with `minFileSizeBytes`, optional `maxFileSizeBytes`, and `allowedExtensions`. Update is a patch: omitted policy fields are retained; `allowedExtensions` replaces the complete list; `--clear-max-file-size` removes the upper bound.
All supported configuration writes accept `--dry-run`: rules clear/push, preference updates, thinking-depth policy changes, HoseCloud configure, and Webhook add/update/delete. Preview mode performs read-only discovery and returns JSON with `preview: true`, the exact `targetUrl`, a redacted `changesDiff` (`before`/`after`), and `impactCount`. It never sends the mutation request and does not require `--yes`; use the same command with `--yes` only after reviewing the preview.
All supported configuration writes accept `--dry-run`: rules clear/push, `corps sync-test`, preference updates, thinking-depth policy changes, HoseCloud configure, and Webhook add/update/delete. Preview mode performs read-only discovery and returns JSON with `preview: true`, the exact `targetUrl`, a redacted `changesDiff` (`before`/`after`), and `impactCount`. It never sends the mutation request and does not require `--yes`; use the same command with `--yes` only after reviewing the preview.
Approval runs, simulations, and Langfuse bridge:
@@ -214,6 +261,7 @@ Approval runs, simulations, and Langfuse bridge:
- `seal-use approval-runs bridge --corp <corpId> [--sourceDocumentSN <sn>]`
- `seal-use simulation create --mode hosecloud --flow-ids ... --no-wait --corp <corpId>` returns immediately with an `asyncTicket` (creation is non-blocking by default for compatibility).
- `seal-use simulation status <batchId> --corp <corpId>` performs one non-blocking status check and returns `QUEUED`/`RUNNING`/`COMPLETED`/`FAILED`-style state plus counters.
- `seal-use simulation approval-definitions --corp <corpId>` lists available Feishu approval definitions so an `approvalCode` can be selected before creating a batch.
- `seal-use simulation wait <batchId> --corp <corpId>`
- `seal-use simulation clean <batchId> --corp <corpId>`
- `seal-use simulation list --corp <corpId>`
@@ -352,7 +400,7 @@ Create a document:
`contentType` 必须是 `document`、`video`、`pdf`、`feishu_doc` 或 `policy` 之一;`scenarios` 必填且至少包含一个 `fill`(智能填单)或 `audit`(智能审核)。这里的 `scenarios` 是产品能力开关,不是费用类别或业务场景名。
知识文档创建后当前 API 没有删除接口,创建操作不可逆;请在写入前确认标题、正文、内容类型和能力场景。需要撤下内容时,优先使用更新操作并设置 `enabled: false`(如果上游支持该字段),不要通过试探性创建来验证参数。规则支持删除,但知识文档与规则的生命周期能力并不对称。
知识文档支持通过 `seal_approval_delete_document` 删除,且 `corps sync-test` 会在按标题对账时删除测试企业中多余的文档;删除仍是破坏性写操作,必须在写入前重新读取并确认标题/ID。若只是暂时撤下内容,优先使用更新操作并设置 `enabled: false`。
Update a document:
@@ -0,0 +1,157 @@
# 生产与测试环境搭配配置、模拟测试与生产规则安全演进指南 (Staging Simulation & Rule Evolution)
本文档面向 AI Agent 与运维人员,规范从**生产/测试环境搭配接入**、**配置与合思集成自动同步**、**测试环境单据模拟验证**,到**生产规则安全投产**的端到端标准工作流。
---
## 核心原则 (Core Rules)
1. **强版本基线 (Latest Version Mandate)**:
- 必须确保运行的是最新版本的 `seal-use` CLI、Skill 与 ZCode/Agent 插件。
- 在开始引导或执行任何企业操作前,先执行 `seal-use version` 核验。若版本过旧或缺失新特性,优先运行 `seal-use update` 或重新执行安装脚本:
```bash
# 国内镜像源秒级自愈与升级
curl -fsSL https://git.ying-qing.cn/gitea/seal-use/raw/branch/main/scripts/install.sh | bash
```
2. **测试先行,优先草稿隔离 (Staging-First Recommendation)**:
- 强烈建议生产环境的规则修改优先以草稿态(`draft`)保存,并通过 `seal-use corps sync-test` 自动同步到绑定的测试企业进行模拟验证。
- Agent 应主动向用户建议该安全演进闭环,但**绝不替用户做决定**。最终的操作权在用户手中;若用户明确指示直接在生产企业发布,Agent 必须尊重并遵照用户意图执行。
3. **合思集成安全隔离 (Hosecloud Zero-Impact Sync)**:
- 测试环境进行合思模拟测试,必须在测试企业中保存合思凭证。
- `corps sync-test` 会自动读取本地生产 source 凭证并为测试环境配置 `assisted`(辅助)模式的合思集成,名称格式为 `{企业名前缀}(Seal测)`。
- **严禁向合思执行同步 (`deploy hosecloud sync`)**:测试环境的合思配置只保存在 Seal 端,绝不向合思生产系统推送 EBot 节点或创建真实出站消息,保障生产费控审批流的绝对安全。
---
## 端到端标准演进闭环 (The 4-Stage Lifecycle)
```mermaid
flowchart TD
A["Stage 1: 生产与测试环境接入与绑定"] --> B["Stage 2: 生产规则草稿修改 (Draft Only)"]
B --> C["Stage 3: 一键安全同步测试环境 (corps sync-test)"]
C --> D["Stage 4: 测试环境单据模拟验证 (simulation create)"]
D --> E{"验证是否符合预期?"}
E -- 存在偏差/误伤 --> B
E -- 验证通过 --> F["Stage 5: 生产环境正式发布 (rules publish)"]
```
---
### 第一阶段:生产与测试企业搭配配置 (Pairing & Setup)
1. **发现并列出已有企业**:
```bash
seal-use corps list
```
识别生产企业(`sourceType: "hose"` 或 `"seal"`)与测试企业(如专用的测试环境)。
2. **如果尚未接入企业**:
- 合思标准凭证接入生产企业:`seal-use corps add-hose --json '{"appKey":"...","appSecurity":"...","domain":"..."}'`
- 或通过协助链接接入:`seal-use corps add-link <url>`
3. **环境严格标记与 1 对 1 绑定**:
```bash
# 1. 明确标记企业环境属性
seal-use corps mark <prodCorpId> --env production --confirm
seal-use corps mark <testCorpId> --env test --confirm
# 2. 建立 1 对 1 关联绑定(禁止多层级串联)
seal-use corps bind-test <prodCorpId> <testCorpId> --confirm
```
绑定成功后,执行 `seal-use corps list` 可确认双方已包含 `testCorpId` 与 `prodCorpId` 互斥映射字段。
---
### 第二阶段:生产环境规则安全修改 (Production Draft Mutation)
当用户提出审核规则新增、修改或依据客诉反馈进行修复时,Agent 应遵循以下规范:
1. **锁定目标企业与规则定位**:
```bash
# 查询生产企业当前生效规则与草稿规则
seal-use rules list --corp <prodCorpId> --summary
# 精确读取某条目标规则
seal-use rules get --corp <prodCorpId> --code '<ruleCode>'
```
2. **仅修改草稿(保持生产未发布)**:
- 提取最小修改建议(只改动必要的描述语句,保留 `scope` 与 `strictness`)。
- 使用规则更新或创建接口修改生产企业草稿:
```bash
seal-use tool seal_approval_rules_update --corp <prodCorpId> --json '{"ruleId":"...","description":"..."}'
```
- **最佳安全建议**:修改草稿后,建议先不调用 `seal-use rules publish --corp <prodCorpId>`,而是先引导用户同步至测试企业进行单据模拟验证;若用户明确要求直接投产,则严格遵从用户指示执行发布。
---
### 第三阶段:一键安全同步测试环境 (Staging Auto-Sync)
通过 `corps sync-test` 命令,一键将生产企业的全部变更投影到测试环境:
1. **预览差异 (`--dry-run`)**:
```bash
seal-use corps sync-test <prodCorpId> --dry-run
```
检查输出的 JSON:
- `rulesPlan`:生产草稿规则数、测试待替换规则数。
- `documentsPlan`:知识库文章的新增、更新与多余清理。
- `hosecloudSyncPlan`:合思集成注入计划(显示将自动生成的出站名称与 `assisted` 模式)。
2. **正式同步与发布 (`--yes`)**:
```bash
seal-use corps sync-test <prodCorpId> --yes
```
该命令会在测试企业中全自动完成:
- 更新审核风格与偏好设置;
- 对账知识库文档(覆盖更新已有文档、创建新文档、删除测试环境多余文档);
- 清空测试环境旧草稿规则,灌入生产企业当前草稿规则并重算 code;
- 在测试企业自动发布语义版本(格式形如 `[Prod v22 · #1 -> Test v3]`),并保存本地规则映射快照;
- **自动同步合思集成**:
- 从本地 source 读入 `appKey`/`appSecurity`(兼容 `key`/`password`);
- 截取企业名前缀并附加 `(Seal测)`(严格受控于 13 字符限制,例如 `钰泰半导体(Seal测)`);
- 强制将审批模式设为 `assisted`;
- 自动去重:若生产有多个相同 `corporationId` 的集成(如全自动与辅助),在测试环境自动合并为单条辅助集成;
- **不同步至合思**:仅保存在测试环境 Seal,保证合思生产费控零改动。
3. **速查规则映射**:
```bash
seal-use rules map --corp <testCorpId> --version latest
```
查看生产规则 ID/code 与测试规则 ID/code 的对应关系。
---
### 第四阶段:测试环境模拟验证与投产闭环 (Simulation & Production Release)
1. **核验测试环境合思集成已就绪**:
```bash
seal-use simulation integrations --corp <testCorpId>
```
确认返回的 `hosecloudIntegrations` 中包含目标企业的测试配置项(如 `钰泰半导体(Seal测)`)。
2. **创建模拟测试任务**:
针对目标真实单据号(或客诉单据)在测试环境发起模拟:
```bash
seal-use simulation create --corp <testCorpId> --mode hosecloud --flow-ids "<单号1>,<单号2>"
```
Seal 服务器会自动使用测试环境中保存的合思凭证,直接调用合思 OpenAPI 拉取单据详情,并通过测试环境中刚发布的规则版本执行 AI 预审判断。
3. **轮询并检查判定结果**:
```bash
# 查看状态与进度
seal-use simulation status <batchId> --corp <testCorpId>
# 等待批次完成
seal-use simulation wait <batchId> --corp <testCorpId>
# 获取详细判决与命中规则
seal-use simulation batch-records <batchId> --corp <testCorpId>
```
核对:
- 期望通过的单据是否正确通过;
- 期望拦截或预警的单据是否命中了预期的规则(对照 `rules map`);
- 是否存在规则描述歧义导致的误判。
4. **生产环境最终投产 (Final Production Release)**:
仅当测试环境所有单据的模拟判定结果完全符合预期时,才在生产企业执行正式发布:
```bash
seal-use tool seal_approval_rules_publish --corp <prodCorpId> --json '{"versionName":"审核规则 版本N"}'
```
发布后核实版本状态,完成业务安全闭环。
+19
View File
@@ -37,6 +37,25 @@ describe("CLI version & help handling", () => {
const parsed = JSON.parse(result.stdout.trim());
expect(parsed.name).toBe("seal-use");
expect(parsed.version).toBe(VERSION);
expect(parsed).toHaveProperty("channel");
expect(parsed).toHaveProperty("isRelease");
});
test("version output includes structured dev channel and git information", () => {
const result = runCli(["v"]);
expect(result.status).toBe(0);
const parsed = JSON.parse(result.stdout.trim());
expect(parsed.name).toBe("seal-use");
expect(typeof parsed.channel).toBe("string");
expect(typeof parsed.isRelease).toBe("boolean");
if (!parsed.isRelease) {
expect(parsed.channel).toBe("dev");
if (parsed.git) {
expect(parsed.git).toHaveProperty("baseVersion");
expect(parsed.git).toHaveProperty("commitsAhead");
expect(parsed.git).toHaveProperty("commit");
}
}
});
test("help command prints standard help banner", () => {
+577 -7
View File
@@ -8,7 +8,8 @@ import { runCli } from "../runner.js";
const ORIGINAL_ENV = {
enterprises: process.env.SEAL_USE_ENTERPRISES_DIR,
config: process.env.SEAL_USE_CONFIG_FILE,
tokenStore: process.env.SEAL_USE_TOKEN_STORE
tokenStore: process.env.SEAL_USE_TOKEN_STORE,
mappings: process.env.SEAL_USE_MAPPINGS_DIR
};
const ORIGINAL_FETCH = globalThis.fetch;
const tempDirs: string[] = [];
@@ -17,6 +18,7 @@ afterEach(() => {
restoreEnv("SEAL_USE_ENTERPRISES_DIR", ORIGINAL_ENV.enterprises);
restoreEnv("SEAL_USE_CONFIG_FILE", ORIGINAL_ENV.config);
restoreEnv("SEAL_USE_TOKEN_STORE", ORIGINAL_ENV.tokenStore);
restoreEnv("SEAL_USE_MAPPINGS_DIR", ORIGINAL_ENV.mappings);
globalThis.fetch = ORIGINAL_FETCH;
for (const dir of tempDirs.splice(0)) {
@@ -27,12 +29,15 @@ afterEach(() => {
function setupTestEnv() {
const root = mkdtempSync(join(tmpdir(), "seal-use-bind-test-"));
const enterprises = join(root, "enterprises");
const mappings = join(root, "mappings");
mkdirSync(enterprises, { recursive: true });
mkdirSync(mappings, { recursive: true });
tempDirs.push(root);
process.env.SEAL_USE_ENTERPRISES_DIR = enterprises;
process.env.SEAL_USE_CONFIG_FILE = join(root, "config.json");
process.env.SEAL_USE_TOKEN_STORE = join(root, "tokens.json");
process.env.SEAL_USE_MAPPINGS_DIR = mappings;
const prodCorp: CorpConfig = {
id: "corp-prod",
@@ -251,6 +256,15 @@ describe("corps sync-test", () => {
expect(parsed.rulesPlan.targetExistingDraftRuleCount).toBe(1);
expect(parsed.rulesPlan.toDeleteCount).toBe(1);
expect(parsed.rulesPlan.toCreateCount).toBe(2);
expect(parsed.documentsPlan).toBeDefined();
expect(parsed.documentsPlan.sourceDocumentCount).toBe(2);
expect(parsed.documentsPlan.targetExistingDocumentCount).toBe(2);
expect(parsed.documentsPlan.toCreateCount).toBe(1);
expect(parsed.documentsPlan.toCreate[0].title).toBe("Doc Alpha");
expect(parsed.documentsPlan.toUpdateCount).toBe(1);
expect(parsed.documentsPlan.toUpdate[0].title).toBe("Doc Beta");
expect(parsed.documentsPlan.toDeleteCount).toBe(1);
expect(parsed.documentsPlan.toDelete[0].title).toBe("Doc Gamma Old");
expect(parsed.productionGuarantees.prodRulesStayDraft).toBe(true);
expect(parsed.productionGuarantees.prodVersionPublished).toBe(false);
@@ -299,12 +313,40 @@ describe("corps sync-test", () => {
expect(parsed.target.createdDraftRulesCount).toBe(2);
expect(parsed.target.publishedVersion.versionName).toBe("v1.5-staging");
expect(parsed.target.publishedVersion.versionNumber).toBe(3);
expect(parsed.documents).toBeDefined();
expect(parsed.documents.sourceCount).toBe(2);
expect(parsed.documents.targetExistingCount).toBe(2);
expect(parsed.documents.createdCount).toBe(1);
expect(parsed.documents.created[0].title).toBe("Doc Alpha");
expect(parsed.documents.updatedCount).toBe(1);
expect(parsed.documents.updated[0].title).toBe("Doc Beta");
expect(parsed.documents.deletedCount).toBe(1);
expect(parsed.documents.deleted[0].title).toBe("Doc Gamma Old");
expect(parsed.productionGuarantees.prodRulesStayDraft).toBe(true);
expect(parsed.productionGuarantees.prodVersionPublished).toBe(false);
const patchPref = requests.find((r) => r.method === "PATCH" && r.path.includes("config"));
expect(patchPref).toBeDefined();
expect((patchPref?.body as any).decisionPreferences?.explicitApprove).toBe("Prod approve note");
expect(parsed.versionMapping).toBeDefined();
expect(parsed.versionMapping.sourceProdVersionNumber).toBe(22);
expect(parsed.versionMapping.targetTestVersionNumber).toBe(3);
expect(parsed.ruleMapping).toHaveLength(2);
expect(parsed.ruleMapping[0].sourceRuleId).toBe("prod-rule-1");
expect(parsed.ruleMapping[0].targetRuleCode).toBe("rule-1");
expect(parsed.mappingSavedTo).toBeDefined();
const postPref = requests.find((r) => (r.method === "POST" || r.method === "PATCH") && r.path.includes("config"));
expect(postPref).toBeDefined();
expect((postPref?.body as any).decisionPreferences?.explicitApprove).toBe("Prod approve note");
const deleteDoc = requests.find((r) => r.method === "DELETE" && r.path === "/api/v1/knowledge/articles/test-doc-old");
expect(deleteDoc).toBeDefined();
const patchDoc = requests.find((r) => r.method === "PATCH" && r.path === "/api/v1/knowledge/articles/test-doc-2");
expect(patchDoc).toBeDefined();
expect((patchDoc?.body as any).attributes?.content).toBe("Content Beta Updated");
const postDoc = requests.find((r) => r.method === "POST" && r.path === "/api/v1/knowledge/articles");
expect(postDoc).toBeDefined();
expect((postDoc?.body as any).title).toBe("Doc Alpha");
const deleteRule = requests.find((r) => r.method === "DELETE" && r.path === "/api/v1/rules/test-rule-old");
expect(deleteRule).toBeDefined();
@@ -321,6 +363,408 @@ describe("corps sync-test", () => {
const allPublishCalls = requests.filter((r) => r.path === "/api/v1/rule-set-versions/publish");
expect(allPublishCalls.length).toBe(1);
});
test("sync-test formats semantic version name [Prod v22 · #1 -> Test v3] and rules map inspects local snapshot", async () => {
setupTestEnv();
await runCli(["corps", "bind-test", "corp-prod", "corp-test", "--confirm"]);
const requests: { method: string; path: string; body?: unknown }[] = [];
mockSealSyncRequests({
onMutation: (method, path, body) => requests.push({ method, path, body })
});
const syncResult = await runCli([
"corps",
"sync-test",
"corp-prod",
"--yes"
]);
expect(syncResult.isError).toBe(false);
const parsed = JSON.parse(syncResult.stdout);
expect(parsed.target.publishedVersion.versionName).toBe("Sync from Acme Production [Prod v22 · #1 -> Test v3]");
expect(parsed.versionMapping.sourceProdVersionNumber).toBe(22);
expect(parsed.ruleMapping).toHaveLength(2);
// Verify rules map command
const mapResult = await runCli(["rules", "map", "--corp", "corp-test"]);
expect(mapResult.isError).toBe(false);
const mapParsed = JSON.parse(mapResult.stdout);
expect(mapParsed.matchedRules).toBe(2);
expect(mapParsed.versionMapping.sourceProdVersionNumber).toBe(22);
// Verify filtering rules map by targetCode
const filteredResult = await runCli(["rules", "map", "--corp", "corp-test", "--code", "rule-1"]);
expect(filteredResult.isError).toBe(false);
const filteredParsed = JSON.parse(filteredResult.stdout);
expect(filteredParsed.matchedRules).toBe(1);
expect(filteredParsed.rules[0].targetRuleCode).toBe("rule-1");
});
});
describe("buildTestHosecloudOutboundName", () => {
test("appends (Seal测) suffix, using up to 6 chars of corp name", async () => {
const { buildTestHosecloudOutboundName } = await import("./corps.js");
// Short name — all chars fit
expect(buildTestHosecloudOutboundName("钰泰半导体")).toBe("钰泰半导体(Seal测)");
// Exactly 6-char prefix
expect(buildTestHosecloudOutboundName("美年大健康产业控股")).toBe("美年大健康产(Seal测)");
// Long name — truncated to 6 chars prefix
expect(buildTestHosecloudOutboundName("钰泰半导体股份有限公司")).toBe("钰泰半导体股(Seal测)");
// Total is always ≤ 13 chars
const name = buildTestHosecloudOutboundName("一二三四五六七八九十");
expect([...name].length).toBeLessThanOrEqual(13);
expect(name.endsWith("(Seal测)")).toBe(true);
});
});
describe("sync-test hosecloud integration auto-sync", () => {
function setupHoseTestEnv() {
const root = mkdtempSync(join(tmpdir(), "seal-use-hose-sync-"));
const enterprises = join(root, "enterprises");
const mappings = join(root, "mappings");
mkdirSync(enterprises, { recursive: true });
mkdirSync(mappings, { recursive: true });
tempDirs.push(root);
process.env.SEAL_USE_ENTERPRISES_DIR = enterprises;
process.env.SEAL_USE_CONFIG_FILE = join(root, "config.json");
process.env.SEAL_USE_TOKEN_STORE = join(root, "tokens.json");
process.env.SEAL_USE_MAPPINGS_DIR = mappings;
// Prod corp is hose-sourced (has appKey/appSecurity)
const prodCorp: CorpConfig = {
id: "hose-prod",
name: "钰泰半导体股份有限公司",
environment: "production",
testCorpId: "hose-test",
seal: {
url: "https://hose-prod.sealai.cc",
endpoints: { approvalStylePreferences: "api/v1/agent/ai-approval/config" }
},
source: {
type: "hose",
domain: "https://wx2.ekuaibao.com",
appKey: "test-app-key-123",
appSecurity: "test-app-secret-456",
staffId: "hose-prod:staffid",
corpId: "hose-prod"
},
auth: { refreshTtl: 300 }
};
const testCorp: CorpConfig = {
id: "hose-test",
name: "谢子豪测试环境",
environment: "test",
prodCorpId: "hose-prod",
seal: {
url: "https://hose-test.sealai.cc",
endpoints: { approvalStylePreferences: "api/v1/agent/ai-approval/config" }
},
source: {
type: "seal",
token: "test-token",
sealUrl: "https://hose-test.sealai.cc",
expiresIn: 3600,
staffId: "seal"
},
auth: { refreshTtl: 300 }
};
writeFileSync(join(enterprises, "hose-prod.json"), JSON.stringify(prodCorp, null, 2));
writeFileSync(join(enterprises, "hose-test.json"), JSON.stringify(testCorp, null, 2));
return { root, enterprises };
}
function mockHoseSyncRequests(options: {
prodHosecloudIntegrations?: any[];
testHosecloudIntegrations?: any[];
onConfigWrite?: (isProd: boolean, body: unknown) => void;
} = {}) {
const prodIntegrations = options.prodHosecloudIntegrations ?? [
{
type: "hosecloud",
signKey: "prod-sign-key",
outboundName: "钰泰正式审批",
mode: "fully_automatic",
apiKey: "test-app-key-123",
apiSecret: "test-app-secret-456",
apiOrigin: "custom",
customApiUrl: "https://wx2.ekuaibao.com",
corporationId: "hose-prod"
}
];
const testIntegrations = options.testHosecloudIntegrations ?? [];
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
const requestUrl = typeof input === "string" ? input
: input instanceof URL ? input.toString() : input.url;
const method = (
init?.method ??
(typeof input === "object" && "method" in input ? (input as Request).method : "GET")
).toUpperCase();
const url = new URL(requestUrl);
const isProd = url.host.includes("prod");
let rawBody = typeof init?.body === "string" ? init.body : undefined;
if (!rawBody && typeof input === "object" && "text" in input) {
rawBody = await (input as Request).clone().text().catch(() => "{}");
}
if (url.pathname === "/api/v1/auth/me") {
return jsonResponse({
data: {
user: { id: "user-1", name: isProd ? "Prod User" : "Test User" },
tenant: { id: isProd ? "tenant-prod" : "tenant-test", tenantSlug: isProd ? "hose-prod" : "hose-test" }
}
});
}
// Hose → Seal SSO token exchange (used when prod corp is hose-sourced)
if (url.pathname === "/api/auth/oauth2/session/oem-hosecloud") {
return jsonResponse({ token: "mock-hose-seal-token", expiresIn: 3600 });
}
// Hose openapi token exchange
if (url.pathname === "/api/openapi/v1/auth/getAccessToken") {
return jsonResponse({ value: { accessToken: "mock-hose-openapi-token" } });
}
// Hose provisional auth URL (getProvisionalAuth) — must return a URL with accessToken param
if (url.pathname === "/api/openapi/v1.1/provisional/getProvisionalAuth") {
return jsonResponse({ value: { message: "https://mock.ekuaibao.com/provisional?accessToken=mock-closeapi-token" } });
}
if (url.pathname === "/api/v1/agent/ai-approval/config" && method === "GET") {
return jsonResponse({
data: {
tone: "formal",
language: "zh-CN",
decisionPreferences: { explicitApprove: "", explicitReject: "", exemptApprove: "", review: "" },
thinkingDepthPreference: { defaultLevel: "medium", routingPolicies: [] },
integrations: isProd ? prodIntegrations : testIntegrations
}
});
}
if (url.pathname === "/api/v1/agent/ai-approval/config" && (method === "POST" || method === "PATCH")) {
const body = JSON.parse(rawBody || "{}");
options.onConfigWrite?.(isProd, body);
return jsonResponse({ data: { success: true } });
}
// Minimal stubs for rules/docs/versions
if (url.pathname === "/api/v1/knowledge/articles") {
return jsonResponse({ data: { articles: [], total: 0 } });
}
if (url.pathname === "/api/v1/rules") {
return jsonResponse({ data: { rules: [], hasPendingDeletes: false } });
}
if (url.pathname === "/api/v1/rule-set-versions") {
return jsonResponse({ data: [] });
}
if (url.pathname === "/api/v1/rule-set-versions/publish") {
return jsonResponse({ data: { version: { id: "v1", versionNumber: 1, versionName: "v1", rules: [] }, rulesCount: 0 } });
}
if (url.pathname === "/api/v1/rules/batch-recode") {
return jsonResponse({ data: { success: true } });
}
return jsonResponse({ error: `Unexpected: ${method} ${url.pathname}` }, 404);
}) as typeof fetch;
}
test("hose-sourced prod corp auto-syncs hosecloud integration with assisted mode and naming convention", async () => {
setupHoseTestEnv();
await runCli(["corps", "bind-test", "hose-prod", "hose-test", "--confirm"]);
let capturedTestConfigBody: any;
mockHoseSyncRequests({
onConfigWrite: (isProd, body) => {
if (!isProd) capturedTestConfigBody = body;
}
});
const result = await runCli(["corps", "sync-test", "hose-prod", "--yes"]);
expect(result.isError).toBe(false);
const parsed = JSON.parse(result.stdout);
expect(parsed.hosecloudSync).toBeDefined();
expect(parsed.hosecloudSync.skipped).toBe(false);
expect(parsed.hosecloudSync.synced).toHaveLength(1);
const synced = parsed.hosecloudSync.synced[0];
expect(synced.outboundName).toBe("钰泰半导体股(Seal测)");
expect(synced.corporationId).toBe("hose-prod");
expect(synced.action).toBe("created");
// Verify the written integration has assisted mode regardless of prod mode
expect(capturedTestConfigBody).toBeDefined();
const writtenIntegration = capturedTestConfigBody.integrations?.find((i: any) => i.type === "hosecloud");
expect(writtenIntegration?.mode).toBe("assisted");
expect(writtenIntegration?.apiOrigin).toBe("custom");
expect(writtenIntegration?.customApiUrl).toBe("https://wx2.ekuaibao.com");
expect(writtenIntegration?.outboundName).toBe("钰泰半导体股(Seal测)");
});
test("preserves existing test signKey when re-syncing (idempotent)", async () => {
setupHoseTestEnv();
await runCli(["corps", "bind-test", "hose-prod", "hose-test", "--confirm"]);
const existingSignKey = "existing-test-sign-key";
let capturedBody: any;
mockHoseSyncRequests({
testHosecloudIntegrations: [
{
type: "hosecloud",
signKey: existingSignKey,
outboundName: "钰泰半导体股(Seal测)",
mode: "assisted",
apiKey: "test-app-key-123",
apiSecret: "test-app-secret-456",
apiOrigin: "custom",
customApiUrl: "https://wx2.ekuaibao.com",
corporationId: "hose-prod"
}
],
onConfigWrite: (isProd, body) => {
if (!isProd) capturedBody = body;
}
});
const result = await runCli(["corps", "sync-test", "hose-prod", "--yes"]);
expect(result.isError).toBe(false);
const parsed = JSON.parse(result.stdout);
expect(parsed.hosecloudSync.synced[0].action).toBe("updated");
expect(parsed.hosecloudSync.synced[0].signKey).toBe(existingSignKey);
const writtenIntegration = capturedBody?.integrations?.find((i: any) => i.type === "hosecloud");
expect(writtenIntegration?.signKey).toBe(existingSignKey);
});
test("skips hosecloud sync for non-hose-sourced prod corps", async () => {
const root = mkdtempSync(join(tmpdir(), "seal-use-skip-hose-"));
const enterprises = join(root, "enterprises");
mkdirSync(enterprises, { recursive: true });
tempDirs.push(root);
process.env.SEAL_USE_ENTERPRISES_DIR = enterprises;
process.env.SEAL_USE_CONFIG_FILE = join(root, "config.json");
process.env.SEAL_USE_TOKEN_STORE = join(root, "tokens.json");
process.env.SEAL_USE_MAPPINGS_DIR = join(root, "mappings");
mkdirSync(join(root, "mappings"), { recursive: true });
const sealProd: CorpConfig = {
id: "seal-prod",
name: "Acme Seal Native",
environment: "production",
testCorpId: "seal-test",
seal: { url: "https://seal-prod.sealai.cc", endpoints: { approvalStylePreferences: "api/v1/agent/ai-approval/config" } },
source: { type: "seal", token: "tok", sealUrl: "https://seal-prod.sealai.cc", expiresIn: 3600, staffId: "seal" },
auth: { refreshTtl: 300 }
};
const sealTest: CorpConfig = {
id: "seal-test",
name: "Acme Test",
environment: "test",
prodCorpId: "seal-prod",
seal: { url: "https://seal-test.sealai.cc", endpoints: { approvalStylePreferences: "api/v1/agent/ai-approval/config" } },
source: { type: "seal", token: "tok2", sealUrl: "https://seal-test.sealai.cc", expiresIn: 3600, staffId: "seal" },
auth: { refreshTtl: 300 }
};
writeFileSync(join(enterprises, "seal-prod.json"), JSON.stringify(sealProd, null, 2));
writeFileSync(join(enterprises, "seal-test.json"), JSON.stringify(sealTest, null, 2));
mockHoseSyncRequests({});
const result = await runCli(["corps", "sync-test", "seal-prod", "--yes"]);
expect(result.isError).toBe(false);
const parsed = JSON.parse(result.stdout);
expect(parsed.hosecloudSync.skipped).toBe(true);
expect(parsed.hosecloudSync.reason).toContain("not hose");
});
test("deduplicates multiple prod integrations for the same corporationId into one test integration", async () => {
setupHoseTestEnv();
await runCli(["corps", "bind-test", "hose-prod", "hose-test", "--confirm"]);
let capturedBody: any;
// Prod has TWO integrations for the same corporationId (e.g. assisted and fully_automatic)
mockHoseSyncRequests({
prodHosecloudIntegrations: [
{
type: "hosecloud",
signKey: "prod-assisted-key",
outboundName: "辅助审批",
mode: "assisted",
apiKey: "test-app-key-123",
apiSecret: "test-app-secret-456",
apiOrigin: "wechat",
corporationId: "hose-prod"
},
{
type: "hosecloud",
signKey: "prod-auto-key",
outboundName: "全自动审批",
mode: "fully_automatic",
apiKey: "test-app-key-123",
apiSecret: "test-app-secret-456",
apiOrigin: "wechat",
corporationId: "hose-prod"
}
],
onConfigWrite: (isProd, body) => {
if (!isProd) capturedBody = body;
}
});
const result = await runCli(["corps", "sync-test", "hose-prod", "--yes"]);
expect(result.isError).toBe(false);
const parsed = JSON.parse(result.stdout);
// Synced array should contain exactly 1 entry, not 2
expect(parsed.hosecloudSync.synced).toHaveLength(1);
expect(parsed.hosecloudSync.synced[0].corporationId).toBe("hose-prod");
const writtenIntegrations = (capturedBody?.integrations ?? []).filter((i: any) => i.type === "hosecloud");
expect(writtenIntegrations).toHaveLength(1);
expect(writtenIntegrations[0].mode).toBe("assisted");
expect(writtenIntegrations[0].apiOrigin).toBe("wechat");
});
test("supports key/password fallback in source config when appKey/appSecurity are omitted", async () => {
const { enterprises } = setupHoseTestEnv();
// Overwrite hose-prod.json to use key / password instead of appKey / appSecurity
const prodCorpWithKeyPassword = JSON.parse(readFileSync(join(enterprises, "hose-prod.json"), "utf-8"));
delete prodCorpWithKeyPassword.source.appKey;
delete prodCorpWithKeyPassword.source.appSecurity;
prodCorpWithKeyPassword.source.key = "fallback-key-789";
prodCorpWithKeyPassword.source.password = "fallback-secret-012";
writeFileSync(join(enterprises, "hose-prod.json"), JSON.stringify(prodCorpWithKeyPassword, null, 2));
await runCli(["corps", "bind-test", "hose-prod", "hose-test", "--confirm"]);
let capturedBody: any;
mockHoseSyncRequests({
onConfigWrite: (isProd, body) => {
if (!isProd) capturedBody = body;
}
});
const result = await runCli(["corps", "sync-test", "hose-prod", "--yes"]);
expect(result.isError).toBe(false);
const parsed = JSON.parse(result.stdout);
expect(parsed.hosecloudSync.skipped).toBe(false);
expect(parsed.hosecloudSync.synced).toHaveLength(1);
const writtenIntegration = capturedBody?.integrations?.find((i: any) => i.type === "hosecloud");
expect(writtenIntegration?.apiKey).toBe("fallback-key-789");
expect(writtenIntegration?.apiSecret).toBe("fallback-secret-012");
});
});
describe("corps list & current", () => {
@@ -402,10 +846,101 @@ function mockSealSyncRequests(options: {
});
}
if (url.pathname === "/api/v1/agent/ai-approval/config" && method === "PATCH") {
if (url.pathname === "/api/v1/agent/ai-approval/config" && (method === "POST" || method === "PATCH")) {
const body = JSON.parse(rawBody || "{}");
options.onMutation?.(method, url.pathname, body);
return jsonResponse({ data: { success: true } });
}
if (url.pathname === "/api/v1/knowledge/articles" && method === "GET") {
if (isProd) {
return jsonResponse({
data: {
articles: [
{
id: "prod-doc-1",
title: "Doc Alpha",
purpose: "Purpose Alpha",
content: "Content Alpha",
contentType: "policy",
status: "published",
enabled: true,
scenarios: ["audit"],
tags: []
},
{
id: "prod-doc-2",
title: "Doc Beta",
purpose: "Purpose Beta",
content: "Content Beta Updated",
contentType: "policy",
status: "published",
enabled: true,
scenarios: ["audit"],
tags: []
}
],
total: 2
}
});
} else {
return jsonResponse({
data: {
articles: [
{
id: "test-doc-2",
title: "Doc Beta",
purpose: "Purpose Beta",
content: "Content Beta Old",
contentType: "policy",
status: "published",
enabled: true,
scenarios: ["audit"],
tags: []
},
{
id: "test-doc-old",
title: "Doc Gamma Old",
purpose: "Redundant doc",
content: "To be deleted",
contentType: "policy",
status: "published",
enabled: true,
scenarios: ["audit"],
tags: []
}
],
total: 2
}
});
}
}
if (url.pathname.startsWith("/api/v1/knowledge/articles/") && method === "DELETE") {
options.onMutation?.("DELETE", url.pathname);
return jsonResponse({ data: { success: true } });
}
if (url.pathname.startsWith("/api/v1/knowledge/articles/") && method === "PATCH") {
const body = JSON.parse(rawBody || "{}");
options.onMutation?.("PATCH", url.pathname, body);
return jsonResponse({ data: body });
return jsonResponse({
data: {
id: url.pathname.split("/").pop(),
...body.attributes
}
});
}
if (url.pathname === "/api/v1/knowledge/articles" && method === "POST") {
const body = JSON.parse(rawBody || "{}");
options.onMutation?.("POST", url.pathname, body);
return jsonResponse({
data: {
id: `new-doc-${Date.now()}`,
...body
}
});
}
if (url.pathname === "/api/v1/rules" && method === "GET") {
@@ -452,6 +987,38 @@ function mockSealSyncRequests(options: {
return jsonResponse({ data: { success: true } });
}
if (url.pathname === "/api/v1/rule-set-versions" && method === "GET") {
if (isProd) {
return jsonResponse({
data: [
{
id: "ver-prod-22",
versionNumber: 22,
versionName: "审核规则 版本22",
publishedByName: "周晚容",
rules: [],
publishedAt: 1786961644896,
createdAt: 1786961644896
}
]
});
} else {
return jsonResponse({
data: [
{
id: "ver-test-2",
versionNumber: 2,
versionName: "v1.0-old",
publishedByName: "管理员",
rules: [],
publishedAt: 1783495074421,
createdAt: 1783495074421
}
]
});
}
}
if (url.pathname === "/api/v1/rule-set-versions/publish" && method === "POST") {
const body = JSON.parse(rawBody || "{}");
options.onMutation?.("POST", url.pathname, body);
@@ -461,7 +1028,10 @@ function mockSealSyncRequests(options: {
id: "ver-3",
versionNumber: 3,
versionName: body.versionName ?? "v1.0",
rules: []
rules: [
{ code: "rule-1", description: "Production Rule A", scope: "global", strictness: "strict" },
{ code: "rule-2", description: "Production Rule B", scope: "invoice", strictness: "flexible" }
]
},
rulesCount: 2
}
+374 -16
View File
@@ -1,4 +1,5 @@
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
import { randomBytes } from "node:crypto";
import { join } from "node:path";
import {
assertHoseAssistTenantMatches,
@@ -22,6 +23,11 @@ import { SealCookieMapSchema, SealHeaderMapSchema } from "../../core/config/type
import type { CorpConfig, CorpEnvironment } from "../../core/config/types.js";
import * as api from "../../domains/seal/api.js";
import { getMe } from "../../domains/seal/api.js";
import {
computeNextSyncIteration,
formatSyncVersionName,
saveRuleMappingSnapshot
} from "../../domains/seal/rule-mapping.js";
import { resolveLiveSealEnterpriseConfig } from "../../domains/seal/source.js";
import { selectCorp } from "../helpers.js";
import { confirmationRequired, usageError } from "../errors.js";
@@ -278,11 +284,82 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
const prodClient = await createSealClient(prodCorp);
const testClient = await createSealClient(testCorp);
const prodPref = (await api.getApprovalStylePreferences(prodClient, prodCorp.seal.endpoints.approvalStylePreferences)) as any;
const testPref = (await api.getApprovalStylePreferences(testClient, testCorp.seal.endpoints.approvalStylePreferences)) as any;
const [
prodPref,
testPref,
prodRules,
testRules,
prodVersions,
testVersions,
prodDocsRes,
testDocsRes
] = await Promise.all([
api.getApprovalStylePreferences(prodClient, prodCorp.seal.endpoints.approvalStylePreferences).catch(() => ({} as any)),
api.getApprovalStylePreferences(testClient, testCorp.seal.endpoints.approvalStylePreferences).catch(() => ({} as any)),
api.listApprovalRules(prodClient),
api.listApprovalRules(testClient),
api.listApprovalRuleVersions(prodClient).catch(() => []),
api.listApprovalRuleVersions(testClient).catch(() => []),
api.listApprovalDocuments(prodClient, { limit: 100 }).catch(() => ({ articles: [] })),
api.listApprovalDocuments(testClient, { limit: 100 }).catch(() => ({ articles: [] }))
]);
const prodRules = await api.listApprovalRules(prodClient);
const testRules = await api.listApprovalRules(testClient);
const prodDocs = (prodDocsRes.articles || []).filter((d) => !d.isDeleted);
const testDocs = (testDocsRes.articles || []).filter((d) => !d.isDeleted);
const testDocsByTitle = new Map(testDocs.map((d) => [d.title.trim(), d]));
const docsToCreate = [];
const docsToUpdate = [];
const prodTitles = new Set(prodDocs.map((d) => d.title.trim()));
for (const prodDoc of prodDocs) {
const title = prodDoc.title.trim();
const existing = testDocsByTitle.get(title);
if (!existing) {
docsToCreate.push(prodDoc);
} else {
const contentChanged = existing.content !== prodDoc.content;
const purposeChanged = (existing.purpose ?? "") !== (prodDoc.purpose ?? "");
const enabledChanged = existing.enabled !== prodDoc.enabled;
const contentTypeChanged = existing.contentType !== prodDoc.contentType;
const statusChanged = (existing.status ?? "") !== (prodDoc.status ?? "");
const scenariosChanged = JSON.stringify([...(existing.scenarios ?? [])].sort()) !==
JSON.stringify([...(prodDoc.scenarios ?? [])].sort());
const tagsChanged = JSON.stringify([...(existing.tags ?? [])].sort()) !==
JSON.stringify([...(prodDoc.tags ?? [])].sort());
if (contentChanged || purposeChanged || enabledChanged || contentTypeChanged || statusChanged || scenariosChanged || tagsChanged) {
docsToUpdate.push({
testId: existing.id,
prodDoc,
reasons: [
...(contentChanged ? ["content"] : []),
...(purposeChanged ? ["purpose"] : []),
...(enabledChanged ? ["enabled"] : []),
...(contentTypeChanged ? ["contentType"] : []),
...(statusChanged ? ["status"] : []),
...(scenariosChanged ? ["scenarios"] : []),
...(tagsChanged ? ["tags"] : [])
]
});
}
}
}
const docsToDelete = testDocs.filter(
(td) => !prodTitles.has(td.title.trim())
);
const sortedProdVersions = [...prodVersions].sort((a, b) => b.versionNumber - a.versionNumber);
const latestProd = sortedProdVersions[0];
const prodVersionNumber = latestProd?.versionNumber;
const sortedTestVersions = [...testVersions].sort((a, b) => b.versionNumber - a.versionNumber);
const targetTestExpectedVersionNumber = (sortedTestVersions[0]?.versionNumber ?? 0) + 1;
const nextIteration = computeNextSyncIteration(prodCorp.name, prodVersionNumber, testVersions);
const customVersionName = stringOption(args.options["version-name"]) ?? stringOption(args.options.versionName);
const versionName = customVersionName ?? formatSyncVersionName(prodCorp.name, prodVersionNumber, nextIteration, targetTestExpectedVersionNumber);
const updatedTestPref = {
...testPref,
@@ -297,10 +374,6 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
thinkingDepthPreference: prodPref.thinkingDepthPreference
};
const customVersionName = stringOption(args.options["version-name"]) ?? stringOption(args.options.versionName);
const dateStr = new Date().toISOString().slice(0, 10);
const versionName = customVersionName ?? `Sync from ${prodCorp.name} (${dateStr})`;
const dryRun = booleanOption(args.options["dry-run"]) === true || booleanOption(args.options.dryRun) === true;
if (dryRun) {
printJson({
@@ -308,13 +381,25 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
source: {
id: prodCorp.id,
name: prodCorp.name,
environment: prodCorp.environment
environment: prodCorp.environment,
latestPublishedVersion: latestProd ? {
versionNumber: latestProd.versionNumber,
versionName: latestProd.versionName
} : null,
documentsCount: prodDocs.length
},
target: {
id: testCorp.id,
name: testCorp.name,
environment: testCorp.environment
},
versionMappingPlan: {
sourceProdVersionNumber: prodVersionNumber ?? null,
sourceProdVersionName: latestProd?.versionName ?? null,
targetTestExpectedVersionNumber,
targetTestPublishVersionName: versionName,
iteration: nextIteration
},
preferencesDiff: {
decisionPreferences: {
before: testPref.decisionPreferences,
@@ -332,16 +417,69 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
toCreateCount: prodRules.rules.length,
rulesToSync: prodRules.rules.map((r, idx) => ({
index: idx + 1,
sourceRuleId: r.id,
sourceRuleCode: r.code ?? idx + 1,
expectedTargetCode: `rule-${idx + 1}`,
description: r.description,
scope: r.scope,
strictness: r.strictness
}))
},
documentsPlan: {
sourceDocumentCount: prodDocs.length,
targetExistingDocumentCount: testDocs.length,
toCreateCount: docsToCreate.length,
toCreate: docsToCreate.map((d) => ({
title: d.title,
purpose: d.purpose,
contentType: d.contentType,
scenarios: d.scenarios
})),
toUpdateCount: docsToUpdate.length,
toUpdate: docsToUpdate.map((d) => ({
targetDocumentId: d.testId,
title: d.prodDoc.title,
reasons: d.reasons
})),
toDeleteCount: docsToDelete.length,
toDelete: docsToDelete.map((d) => ({
targetDocumentId: d.id,
title: d.title
}))
},
publishingPlan: {
targetCorpId: testCorp.id,
publishVersionName: versionName,
publishTarget: "test"
},
hosecloudSyncPlan: (() => {
if (prodCorp.source.type !== "hose") {
return {
sourceType: prodCorp.source.type,
skipped: true,
reason: "prod source is not hose; no hosecloud credentials available"
};
}
const rawHose = (prodPref.integrations ?? []).filter((i: any) => i.type === "hosecloud");
const seen = new Set<string>();
const distinct = rawHose.filter((i: any) => {
const cid = i.corporationId ?? prodCorp.id;
if (seen.has(cid)) return false;
seen.add(cid);
return true;
});
return {
sourceType: "hose",
outboundName: buildTestHosecloudOutboundName(prodCorp.name),
targetMode: "assisted",
integrationsCount: distinct.length,
integrations: distinct.map((i: any) => ({
corporationId: i.corporationId,
apiOrigin: i.apiOrigin,
customApiUrl: i.customApiUrl
}))
};
})(),
productionGuarantees: {
prodRulesStayDraft: true,
prodVersionPublished: false
@@ -353,7 +491,7 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
const confirmed = booleanOption(args.options.yes) === true || booleanOption(args.options.confirm) === true;
if (!confirmed) {
throw confirmationRequired(
`Refusing to overwrite test enterprise '${testCorp.name}' (${testCorp.id}) with preferences and ${prodRules.rules.length} draft rules from production enterprise '${prodCorp.name}' (${prodCorp.id}) without --yes. This will replace test draft rules and publish a new version on the test enterprise.`,
`Refusing to overwrite test enterprise '${testCorp.name}' (${testCorp.id}) with preferences, ${prodRules.rules.length} draft rules, and ${prodDocs.length} knowledge documents from production enterprise '${prodCorp.name}' (${prodCorp.id}) without --yes. This will replace test draft rules, synchronize knowledge documents, and publish a new version on the test enterprise.`,
`seal-use corps sync-test ${prodCorp.id} --yes`
);
}
@@ -361,13 +499,50 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
// 1. Update style & decision preferences in test enterprise
await api.updateApprovalStylePreferences(testClient, updatedTestPref, testCorp.seal.endpoints.approvalStylePreferences);
// 2. Clear old draft rules in test enterprise
// 2. Synchronize knowledge documents in test enterprise (full coverage, delete redundant test documents)
const deletedDocs: Array<{ id: string; title: string }> = [];
for (const doc of docsToDelete) {
await api.deleteApprovalDocument(testClient, doc.id);
deletedDocs.push({ id: doc.id, title: doc.title });
}
const updatedDocs: Array<{ id: string; title: string; reasons: string[] }> = [];
for (const item of docsToUpdate) {
await api.updateApprovalDocument(testClient, item.testId, {
title: item.prodDoc.title,
purpose: item.prodDoc.purpose,
content: item.prodDoc.content,
contentType: item.prodDoc.contentType,
status: item.prodDoc.status,
enabled: item.prodDoc.enabled,
scenarios: item.prodDoc.scenarios && item.prodDoc.scenarios.length > 0 ? item.prodDoc.scenarios : ["audit"],
tags: item.prodDoc.tags
});
updatedDocs.push({ id: item.testId, title: item.prodDoc.title, reasons: item.reasons });
}
const createdDocs: Array<{ id: string; title: string }> = [];
for (const doc of docsToCreate) {
const created = await api.createApprovalDocument(testClient, {
title: doc.title,
purpose: doc.purpose,
content: doc.content,
contentType: doc.contentType,
status: doc.status,
enabled: doc.enabled,
scenarios: doc.scenarios && doc.scenarios.length > 0 ? doc.scenarios : ["audit"],
tags: doc.tags
});
createdDocs.push({ id: created.id, title: created.title });
}
// 3. Clear old draft rules in test enterprise
for (const rule of testRules.rules) {
await api.deleteApprovalRule(testClient, rule.id);
}
// 3. Create new draft rules in test enterprise
const createdRules = [];
// 4. Create new draft rules in test enterprise
const createdRules: any[] = [];
for (const rule of prodRules.rules) {
const created = await api.createApprovalRule(testClient, {
description: rule.description,
@@ -377,12 +552,62 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
createdRules.push(created);
}
// 4. Batch recode rules in test enterprise
// 5. Batch recode rules in test enterprise
await api.recodeApprovalRules(testClient).catch(() => undefined);
// 5. Publish new version in test enterprise
// 6. Publish new version in test enterprise
const published = await api.publishApprovalRuleVersion(testClient, versionName);
const publishedRules = published.version.rules ?? [];
const ruleMapping = prodRules.rules.map((prodRule, idx) => {
const testDraft = createdRules[idx];
const publishedRule = publishedRules[idx];
return {
index: idx + 1,
sourceRuleId: prodRule.id,
sourceRuleCode: prodRule.code ?? idx + 1,
targetRuleId: testDraft?.id ?? "",
targetRuleCode: publishedRule?.code ?? `rule-${idx + 1}`,
description: prodRule.description,
scope: prodRule.scope,
strictness: prodRule.strictness
};
});
const versionMapping = {
sourceProdVersionNumber: prodVersionNumber ?? null,
sourceProdVersionName: latestProd?.versionName ?? null,
targetTestVersionNumber: published.version.versionNumber,
targetTestVersionName: published.version.versionName ?? null
};
let mappingSavedTo: string | undefined;
try {
mappingSavedTo = saveRuleMappingSnapshot({
syncedAt: new Date().toISOString(),
source: {
id: prodCorp.id,
name: prodCorp.name,
latestPublishedVersionNumber: prodVersionNumber ?? null,
latestPublishedVersionName: latestProd?.versionName ?? null
},
target: {
id: testCorp.id,
name: testCorp.name,
publishedVersionNumber: published.version.versionNumber,
publishedVersionName: published.version.versionName,
rulesCount: published.rulesCount
},
versionMapping,
ruleMapping
});
} catch {}
// 7. Sync hosecloud integrations from prod to test (hose-source corps only)
const hosecloudSync = await syncHosecloudIntegrationsToTest(prodCorp, testCorp, prodClient, testClient).catch(
(err) => ({ skipped: true, reason: `error: ${err?.message ?? String(err)}` } as HosecloudSyncResult)
);
printJson({
success: true,
syncedAt: new Date().toISOString(),
@@ -390,7 +615,12 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
id: prodCorp.id,
name: prodCorp.name,
environment: prodCorp.environment,
draftRulesCount: prodRules.rules.length
latestPublishedVersion: latestProd ? {
versionNumber: latestProd.versionNumber,
versionName: latestProd.versionName
} : null,
draftRulesCount: prodRules.rules.length,
documentsCount: prodDocs.length
},
target: {
id: testCorp.id,
@@ -405,6 +635,20 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
rulesCount: published.rulesCount
}
},
documents: {
sourceCount: prodDocs.length,
targetExistingCount: testDocs.length,
createdCount: createdDocs.length,
created: createdDocs,
updatedCount: updatedDocs.length,
updated: updatedDocs,
deletedCount: deletedDocs.length,
deleted: deletedDocs
},
versionMapping,
ruleMapping,
...(mappingSavedTo ? { mappingSavedTo } : {}),
hosecloudSync,
productionGuarantees: {
prodRulesStayDraft: true,
prodVersionPublished: false
@@ -467,6 +711,120 @@ export async function handleCorpsCommand(action: string | undefined, maybeName:
throw new Error(`Unknown corps command: ${action ?? ""}. Run 'seal-use help' for available commands.`);
}
// ---------------------------------------------------------------------------
// Hosecloud integration sync helpers
// ---------------------------------------------------------------------------
/**
* Build the outboundName for a test-env hosecloud integration.
* Format: {企业名前7字}(Seal测) — capped at 13 chars total.
*/
export function buildTestHosecloudOutboundName(corpName: string): string {
// "(Seal测)" is 7 chars; leave 6 chars for the corp name prefix.
const suffix = "(Seal测)"
const maxPrefix = 13 - suffix.length // 6
const prefix = [...corpName].slice(0, maxPrefix).join("")
return prefix + suffix
}
interface HosecloudSyncResult {
skipped: boolean
reason?: string
synced?: Array<{ signKey: string; outboundName: string; corporationId: string; action: "created" | "updated" }>
}
/**
* Sync hosecloud integrations from the production Seal enterprise into the
* test Seal enterprise. Rules:
* - Only runs when prodCorp.source.type === "hose" (credentials available locally)
* - outboundName: buildTestHosecloudOutboundName(prodCorp.name)
* - mode: always "assisted"
* - apiKey/apiSecret: from prodCorp.source.appKey / appSecurity
* - apiOrigin/customApiUrl: copied verbatim from the production integration config
* - signKey: existing test integration keeps its key; new ones get a fresh random key
* - Does NOT call syncHosecloudOutbound (no sync to 合思)
*/
async function syncHosecloudIntegrationsToTest(
prodCorp: import("../../core/config/types.js").CorpConfig,
testCorp: import("../../core/config/types.js").CorpConfig,
prodClient: import("ky").KyInstance,
testClient: import("ky").KyInstance
): Promise<HosecloudSyncResult> {
if (prodCorp.source.type !== "hose") {
return { skipped: true, reason: "prod source is not hose; no hosecloud credentials available" }
}
const appKey = (((prodCorp.source as any).appKey ?? (prodCorp.source as any).key) as string | undefined)?.trim()
const appSecurity = (((prodCorp.source as any).appSecurity ?? (prodCorp.source as any).password) as string | undefined)?.trim()
if (!appKey || !appSecurity) {
return { skipped: true, reason: "prod hose source missing appKey/appSecurity (or key/password)" }
}
const [prodPref, testPref] = await Promise.all([
api.getApprovalStylePreferences(prodClient, prodCorp.seal.endpoints.approvalStylePreferences).catch(() => ({} as any)),
api.getApprovalStylePreferences(testClient, testCorp.seal.endpoints.approvalStylePreferences).catch(() => ({} as any))
])
const prodIntegrations: any[] = (prodPref.integrations ?? []).filter((i: any) => i.type === "hosecloud")
if (prodIntegrations.length === 0) {
return { skipped: true, reason: "prod Seal enterprise has no hosecloud integrations configured" }
}
// Deduplicate prod integrations by corporationId:
// Production enterprises may have multiple integrations (e.g. "assisted" + "fully_automatic")
// with the same corporationId. For the test environment, exactly one assisted integration per
// corporationId is needed.
const seenCorpIds = new Set<string>()
const distinctProdIntegrations: any[] = []
for (const item of prodIntegrations) {
const cid = item.corporationId ?? prodCorp.id
if (!seenCorpIds.has(cid)) {
seenCorpIds.add(cid)
distinctProdIntegrations.push(item)
}
}
const testIntegrations: any[] = (testPref.integrations ?? [])
const testByCorpId = new Map<string, any>(
testIntegrations.filter((i: any) => i.type === "hosecloud").map((i: any) => [i.corporationId, i])
)
const outboundName = buildTestHosecloudOutboundName(prodCorp.name)
const synced: HosecloudSyncResult["synced"] = []
const nextHosecloudIntegrations: any[] = distinctProdIntegrations.map((prodInt: any) => {
const existing = testByCorpId.get(prodInt.corporationId)
const signKey = existing?.signKey ?? randomBytes(6).toString("hex")
synced!.push({
signKey,
outboundName,
corporationId: prodInt.corporationId,
action: existing ? "updated" : "created"
})
return {
type: "hosecloud",
signKey,
outboundName,
mode: "assisted",
apiKey: appKey,
apiSecret: appSecurity,
apiOrigin: prodInt.apiOrigin,
...(prodInt.customApiUrl ? { customApiUrl: prodInt.customApiUrl } : {}),
corporationId: prodInt.corporationId
}
})
// Merge: keep non-hosecloud entries + newly built hosecloud entries
const otherIntegrations = testIntegrations.filter((i: any) => i.type !== "hosecloud")
const nextConfig = {
...testPref,
integrations: [...otherIntegrations, ...nextHosecloudIntegrations]
}
await api.updateApprovalStylePreferences(testClient, nextConfig, testCorp.seal.endpoints.approvalStylePreferences)
return { skipped: false, synced }
}
async function probeHoseCorp(input: Record<string, unknown>) {
const appKey = requiredString(input, "appKey");
const appSecurity = requiredString(input, "appSecurity");
+30 -1
View File
@@ -1,5 +1,6 @@
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { filterRuleMapping, loadRuleMappingSnapshot } from "../../domains/seal/rule-mapping.js";
import { runTool, runToolResult } from "../helpers.js";
import { confirmationRequired } from "../errors.js";
import {
@@ -214,5 +215,33 @@ export async function handleRulesCommand(
return;
}
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.`);
if (action === "map") {
const versionSelector = stringOption(args.options.version) ?? maybeName;
const code = stringOption(args.options.code) ?? stringOption(args.options.rule);
const snapshot = loadRuleMappingSnapshot(corp.id, versionSelector);
if (!snapshot) {
const vText = versionSelector ? `version '${versionSelector}'` : "latest version";
printJson({
error: `No local rule mapping found for enterprise '${corp.name}' (${corp.id}) ${vText}. Run 'seal-use corps sync-test <prodCorp> --yes' to synchronize and generate mapping snapshots.`,
corpId: corp.id,
version: versionSelector ?? "latest"
}, outputOptions(args.options));
return;
}
const filtered = filterRuleMapping(snapshot.ruleMapping, code);
printJson({
corpId: corp.id,
syncedAt: snapshot.syncedAt,
source: snapshot.source,
target: snapshot.target,
versionMapping: snapshot.versionMapping,
totalRules: snapshot.ruleMapping.length,
matchedRules: filtered.length,
rules: filtered
}, outputOptions(args.options));
return;
}
throw new Error(`Unknown rules command: ${action ?? ""}. Available: count, list, clear, versions, version, get, search, lint, pull, push, map. Run 'seal-use help' for available commands.`);
}
+15 -9
View File
@@ -3,7 +3,7 @@ import { dirname, join } from "node:path";
import { spawnSync } from "node:child_process";
import { isCompiledBinary } from "../../core/runtime.js";
import { syncGlobalSkillIfPresent } from "../../core/embedded-skill.js";
import { VERSION } from "../../version.js";
import { VERSION, IS_RELEASE } from "../../version.js";
import { runServiceCommand, serviceStatus } from "../service.js";
import { printJson } from "../printer.js";
import { STATE_DIR } from "./service.js";
@@ -46,14 +46,20 @@ export async function handleUpdateCommand(runtime: CliRuntime, options: UpdateOp
const cleanTarget = targetVersion.replace(/^v/, "");
const cmp = compareSemVer(cleanTarget, VERSION);
if (cmp < 0) {
printJson({
updated: false,
currentVersion: VERSION,
targetVersion: cleanTarget,
mode: isCompiledBinary() ? "binary" : "source",
message: `Cannot downgrade seal-use from v${VERSION} to older version v${cleanTarget}. Updates must be forward-only.`
});
return;
if (!IS_RELEASE && options.force) {
// Allow force reinstall/switch from dev build to target release
} else {
printJson({
updated: false,
currentVersion: VERSION,
targetVersion: cleanTarget,
mode: isCompiledBinary() ? "binary" : "source",
message: !IS_RELEASE
? `Cannot downgrade seal-use from dev build v${VERSION} to release v${cleanTarget}. Use --force to overwrite.`
: `Cannot downgrade seal-use from v${VERSION} to older version v${cleanTarget}. Updates must be forward-only.`
});
return;
}
}
if (cmp === 0 && !options.force) {
printJson({
+58 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, test } from "bun:test";
import { extractHelpRequest, renderHelp } from "./help.js";
import { runCli } from "./runner.js";
import { KNOWN_AREAS, runCli } from "./runner.js";
describe("extractHelpRequest", () => {
test("detects global help from empty command or help option", () => {
@@ -126,3 +126,60 @@ describe("CLI help execution via runCli", () => {
expect(result.stderr).toContain("Unknown corps command: unknown-cmd");
});
});
describe("help coverage", () => {
test("every dispatchable area resolves to help without throwing", () => {
for (const area of KNOWN_AREAS) {
expect(() => renderHelp([area])).not.toThrow();
}
});
test("service lifecycle exposes area and command help", () => {
const area = renderHelp(["service"]);
expect(area).toContain("seal-use service - Background HTTP service lifecycle");
expect(area).toContain("seal-use service start");
expect(area).toContain("seal-use service logs");
expect(renderHelp(["service", "logs"])).toContain("seal-use service logs");
});
test("stop shortcut and server alias resolve to help", () => {
expect(renderHelp(["stop"])).toContain("seal-use stop");
expect(renderHelp(["server"])).toContain("seal-use mcp");
});
test("global help is generated from the registry and lists lifecycle commands", () => {
const help = renderHelp([]);
expect(help).toContain("seal-use CLI");
expect(help).toContain("seal-use version");
expect(help).toContain("seal-use service start");
expect(help).toContain("seal-use stop");
});
test("config aliases resolve to the documented commands", () => {
expect(renderHelp(["config", "status"])).toContain("seal-use config get");
expect(renderHelp(["config", "test-enterprises-dir"])).toContain("seal-use config test-dir");
});
test("singleton areas do not advertise a nonexistent subcommand help", () => {
expect(renderHelp(["http"])).not.toContain("<command> --help");
expect(renderHelp(["stop"])).not.toContain("<command> --help");
expect(renderHelp(["corps"])).toContain("Run 'seal-use corps <command> --help'");
});
});
describe("CLI help execution for lifecycle commands", () => {
test("seal-use service --help prints service commands with exitCode 0", async () => {
const result = await runCli(["service", "--help"]);
expect(result.exitCode).toBe(0);
expect(result.isError).toBe(false);
expect(result.stdout).toContain("seal-use service start");
expect(result.stdout).toContain("seal-use service status");
});
test("seal-use stop --help prints stop help with exitCode 0", async () => {
const result = await runCli(["stop", "--help"]);
expect(result.exitCode).toBe(0);
expect(result.isError).toBe(false);
expect(result.stdout).toContain("seal-use stop");
});
});
+72 -125
View File
@@ -462,6 +462,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
},
{
name: "get",
aliases: ["status"],
summary: "Display current global configuration",
usage: ["seal-use config get"]
},
@@ -472,6 +473,7 @@ export const HELP_REGISTRY: AreaHelp[] = [
},
{
name: "test-dir",
aliases: ["test-enterprises-dir"],
summary: "Set or clear global test enterprises directory",
usage: ["seal-use config test-dir [<path>|--clear]"]
},
@@ -802,6 +804,55 @@ export const HELP_REGISTRY: AreaHelp[] = [
}
]
},
{
area: "service",
title: "Background HTTP service lifecycle",
description: "Start, stop, restart, inspect, and read logs from the standalone seal-use HTTP service daemon.",
commands: [
{
name: "start",
summary: "Start the background service daemon",
usage: ["seal-use service start [--port 8787] [--host 127.0.0.1]"]
},
{
name: "stop",
summary: "Stop the background service daemon",
usage: ["seal-use service stop"]
},
{
name: "restart",
summary: "Restart the background service daemon",
usage: ["seal-use service restart [--port 8787] [--host 127.0.0.1]"]
},
{
name: "status",
summary: "Show service daemon status",
usage: ["seal-use service status"]
},
{
name: "logs",
summary: "Print recent service daemon logs",
usage: ["seal-use service logs [--lines 50]"]
},
{
name: "run",
summary: "Run the service in the foreground",
usage: ["seal-use service run [--port 8787] [--host 127.0.0.1]"]
}
]
},
{
area: "stop",
title: "Stop the background service",
description: "Shortcut for stopping the background seal-use HTTP service daemon.",
commands: [
{
name: "",
summary: "Stop the background service daemon",
usage: ["seal-use stop"]
}
]
},
{
area: "openapi",
title: "OpenAPI specification",
@@ -820,7 +871,7 @@ export function extractHelpRequest(args: ParsedArgs): { isHelp: boolean; target:
const hasHelpOption = Boolean(args.options.help || args.options.h);
if (!args.command.length) {
return hasHelpOption ? { isHelp: true, target: [] } : { isHelp: true, target: [] };
return { isHelp: true, target: [] };
}
if (args.command[0] === "help") {
@@ -878,6 +929,7 @@ function normalizeArea(area: string): string {
if (lower === "changelog") return "update";
if (lower === "serve") return "http";
if (lower === "mcp-config") return "mcp";
if (lower === "server") return "mcp";
return lower;
}
@@ -945,132 +997,27 @@ function renderAreaHelp(areaEntry: AreaHelp): string {
lines.push(` ${usage}`);
}
}
lines.push("");
lines.push(`Run 'seal-use ${areaEntry.area} <command> --help' for details on a specific command.`);
if (areaEntry.commands.some((cmd) => cmd.name)) {
lines.push("");
lines.push(`Run 'seal-use ${areaEntry.area} <command> --help' for details on a specific command.`);
}
return lines.join("\n");
}
export function renderGlobalHelp(): string {
return `seal-use CLI
Usage:
seal-use version
seal-use mcp
seal-use mcp config
seal-use mcp-config
seal-use skill dump
seal-use skill install [--dir <path>|--local]
seal-use skill status
seal-use http [--port 8787] [--host 127.0.0.1]
seal-use serve [--port 8787]
seal-use openapi
seal-use probe [<corpId>]
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>]
seal-use changelog [--limit <n>]
seal-use tools list
seal-use corps list [--corp <corpId>]
seal-use corps current [--corp <corpId>]
seal-use corps switch <corpId>
seal-use corps mark <corpId> --env <production|test> [--confirm]
seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]
seal-use corps unbind-test [<corpId>] [--confirm]
seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]
seal-use corps add-hose --json '{"name":"企业名称","domain":"https://app.ekuaibao.com","appKey":"...","appSecurity":"...","proxyStaffBizId":"corpId:staffId"}'
seal-use corps add-seal --json '{"sealUrl":"https://tenant.sealai.cc","token":"seal-bearer-token"}'
seal-use corps add-link <https://.../web/thirdparty.html?...> [--name <customName>] [--overwrite]
seal-use auth diagnose [--corp <corpId>]
seal-use auth hose-link [--corp <corpId>] [--expire 7200]
seal-use delegation list [--corp <corpId>]
seal-use delegation create [--note <note>] [--from-link <url>] [--corp <corpId>]
seal-use delegation revoke <tokenId> [--corp <corpId>]
seal-use users create --name <name> --phone <phone> [--dept <deptId>] [--corp <corpId>]
seal-use users search <keyword> [--corp <corpId>]
seal-use users delegation <userIdOrPhone|name> [--note <note>] [--corp <corpId>]
seal-use users reset-password <userId> [--corp <corpId>]
seal-use users get <userId> [--corp <corpId>]
seal-use users delete <userId> [--corp <corpId>]
seal-use contacts departments [<departmentId>] [--corp <corpId>]
seal-use contacts children <departmentId> [--corp <corpId>]
seal-use contacts users <departmentId> [--corp <corpId>]
seal-use contacts sync-time [--corp <corpId>]
seal-use data expenses [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>] [--corp <corpId>]
seal-use data invoices [--search <text>] [--start-date <ISO|ms>] [--end-date <ISO|ms>] [--offset <n>] [--limit <n>] [--corp <corpId>]
seal-use llm config [--corp <corpId>]
seal-use llm providers [--corp <corpId>]
seal-use permissions available [--corp <corpId>]
seal-use permissions configs [--corp <corpId>]
seal-use billing status [--corp <corpId>]
seal-use billing plans [--corp <corpId>]
seal-use billing features [--corp <corpId>]
seal-use webhook ready [<材料包.zip>] [--webhook <idOrName>] [--corp <corpId>]
seal-use webhook status [<材料包.zip>] [--corp <corpId>]
seal-use webhook list [--query <text>] [--show-secret] [--corp <corpId>]
seal-use webhook get|find <idOrName> [--show-secret] [--corp <corpId>]
seal-use webhook add --name <name> --result-url <url> [--mode assisted|semi_automatic|fully_automatic] [--auto-approval-rate 60] [--secret <secret>] [--min-file-size 500] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--dry-run] [--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] [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.xlsx,...>] [--clear-max-file-size] [--dry-run] [--corp <corpId>]
seal-use webhook delete <idOrName> [--yes|--dry-run] [--corp <corpId>]
seal-use webhook material-pack preview <材料包.zip|信息表.xlsx> [--min-file-size <bytes>] [--max-file-size <bytes>] [--allowed-extensions <.pdf,.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>]
seal-use deploy hosecloud status [--corp <corpId>]
seal-use deploy hosecloud configure --json '{...}' [--dry-run] [--corp <corpId>]
seal-use deploy hosecloud sync <sign-key> [--corp <corpId>]
seal-use preference get [--corp <corpId>]
seal-use preference decision update --json '{\"explicitApprove\":\"...\"}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth set --default <medium|high> [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies list [--corp <corpId>]
seal-use preference thinking-depth policies upsert --json '{...}' [--dry-run] [--corp <corpId>]
seal-use preference thinking-depth policies remove <policyId> [--dry-run] [--corp <corpId>]
seal-use source config [--corp <corpId>]
seal-use tool <toolName> [--corp <corpId>] [--json '{\"key\":\"value\"}']
seal-use rules count [--corp <corpId>]
seal-use rules list [--summary] [--count] [--limit 20] [--offset 0] [--corp <corpId>]
seal-use rules clear [--corp <corpId>] [--dry-run|--yes]
seal-use rules versions [--corp <corpId>]
seal-use rules version <versionId|versionNumber|latest> [--corp <corpId>]
seal-use rules get --corp <corpId> --version <number|latest> --code '#0038'
seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
seal-use rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]
seal-use context [--ruleVersion <versionId|versionNumber|latest>] [--documentLimit 50] [--corp <corpId>]
seal-use approval-runs summary [--date YYYY-MM-DD] [--timezone Asia/Shanghai] [--corp <corpId>]
seal-use approval-runs stats [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id] [--corp <corpId>]
seal-use approval-runs count [--status APPROVED] [--corp <corpId>]
seal-use approval-runs export [--start <YYYY-MM-DD|ms>] [--end <YYYY-MM-DD|ms>] [--limit <n>] [--downloads] [--out <file>] [--corp <corpId>]
seal-use approval-runs list|search [--query text] [--humanResult 驳回] [--manualApprovalStatus TERMINATED] [--startDate ms] [--endDate ms] [--limit 20] [--includeBridge true] [--corp <corpId>]
seal-use approval-runs pick --sn <documentSN> [--batch <batchId>] [--latest] [--fields recordId,status,aiDecision] [--corp <corpId>]
seal-use approval-runs get <recordId> [--summary] [--fields metadata|document.fields,result.summary] [--full] [--output-file file.json] [--corp <corpId>]
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 analytics insight [--start-date <ISO>] [--end-date <ISO>] [--limit <n>] [--corp <corpId>]
seal-use approval-runs url [--corp <corpId>]
seal-use approval-runs url <recordId> [--corp <corpId>]
seal-use approval-runs url --sourceDocumentSN B26022501 [--corp <corpId>]
seal-use approval-runs bridge [--sourceDocumentSN B26001887] [--corp <corpId>]
seal-use simulation batch-records <batchId> [--corp <corpId>]
seal-use simulation create --mode hosecloud --flow-ids \"B26017701,B26022501\" [--reject-node 财务] [--thinking-depth default|medium|high] [--skip-invoice-generation|--skip-invoice-generation false] [--no-wait] [--corp <corpId>]
seal-use simulation create --mode material_pack --package-ids <materialPackageId> [--template-id conference_reimbursement_v1] [--schema-config file.json] [--corp <corpId>]
seal-use simulation create --source-system weaver --request-ids \"req-01,req-02\" [--corp <corpId>]
seal-use simulation status <batchId> [--corp <corpId>]
seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s] [--corp <corpId>]
seal-use simulation clean <batchId> [--corp <corpId>]
seal-use simulation specifications [--integration <sign-key>] [--corp <corpId>]
seal-use simulation approval-definitions [--corp <corpId>]
seal-use simulation list [--limit 50] [--corp <corpId>]
seal-use simulation get <batchId> [--corp <corpId>]
seal-use simulation templates [--corp <corpId>]
seal-use simulation integrations [--corp <corpId>]
seal-use simulation package-upload <材料包.zip> [--corp <corpId>]
`;
const lines: string[] = [];
lines.push("seal-use CLI");
lines.push("");
lines.push("Usage:");
lines.push(" seal-use version");
for (const area of HELP_REGISTRY) {
for (const command of area.commands) {
for (const usage of command.usage) {
lines.push(` ${usage}`);
}
}
}
lines.push("");
lines.push("Run 'seal-use <command> --help' for details on a specific command.");
return lines.join("\n");
}
+3 -6
View File
@@ -4,7 +4,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 { VERSION, VERSION_INFO } from "../version.js";
import { handleApprovalRunsCommand } from "./commands/approval-runs.js";
import { handleAnalyticsCommand } from "./commands/analytics.js";
import { handleAuthCommand } from "./commands/auth.js";
@@ -53,7 +53,7 @@ import {
import type { CliResult, CliRunOptions, CliRuntime } from "./types.js";
const DEFAULT_APP_ROOT = dirname(dirname(dirname(fileURLToPath(import.meta.url))));
const KNOWN_AREAS = new Set([
export const KNOWN_AREAS = new Set([
"config",
"service",
"stop",
@@ -174,10 +174,7 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
Boolean(args.options.v) ||
Boolean(args.options.V)
) {
printJson({
name: "seal-use",
version: VERSION
});
printJson(VERSION_INFO);
return;
}
+13 -5
View File
@@ -215,6 +215,7 @@ export async function createApprovalDocument(
content: string;
contentType?: string;
status?: string;
enabled?: boolean;
scenarios?: string[];
tags?: string[];
}
@@ -225,7 +226,8 @@ export async function createApprovalDocument(
...params,
contentType: params.contentType ?? "policy",
status: params.status ?? "published",
scenarios: params.scenarios ?? [],
enabled: params.enabled ?? true,
scenarios: params.scenarios && params.scenarios.length > 0 ? params.scenarios : ["audit"],
tags: params.tags ?? []
}
}),
@@ -259,6 +261,14 @@ export async function updateApprovalDocument(
);
}
export async function deleteApprovalDocument(
client: KyInstance,
documentId: string
): Promise<{ success: boolean; id: string }> {
await client.delete(`api/v1/knowledge/articles/${documentId}`);
return { success: true, id: documentId };
}
export async function getApprovalStylePreferences(
client: KyInstance,
endpoint = "api/v1/agent/ai-approval/config"
@@ -274,10 +284,8 @@ export async function updateApprovalStylePreferences(
params: Record<string, unknown>,
endpoint = "api/v1/agent/ai-approval/config"
): Promise<ApprovalStylePreferences> {
return unwrap(
await client.patch(endpoint, { json: params }),
ApprovalStylePreferencesSchema
);
await client.post(endpoint, { json: params });
return getApprovalStylePreferences(client, endpoint);
}
export type WebhookMutationPreview = {
+186
View File
@@ -0,0 +1,186 @@
import { afterEach, beforeEach, describe, expect, test } from "bun:test";
import { existsSync, mkdirSync, rmSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import {
computeNextSyncIteration,
filterRuleMapping,
formatSyncVersionName,
getMappingsDir,
loadRuleMappingSnapshot,
RuleMappingSnapshot,
saveRuleMappingSnapshot
} from "./rule-mapping.js";
describe("rule-mapping", () => {
let testDir: string;
const originalEnv = process.env.SEAL_USE_MAPPINGS_DIR;
beforeEach(() => {
testDir = join(tmpdir(), `seal-mappings-test-${Date.now()}-${Math.random().toString(36).slice(2)}`);
mkdirSync(testDir, { recursive: true });
process.env.SEAL_USE_MAPPINGS_DIR = testDir;
});
afterEach(() => {
if (originalEnv) {
process.env.SEAL_USE_MAPPINGS_DIR = originalEnv;
} else {
delete process.env.SEAL_USE_MAPPINGS_DIR;
}
if (existsSync(testDir)) {
rmSync(testDir, { recursive: true, force: true });
}
});
test("getMappingsDir respects custom environment variable", () => {
expect(getMappingsDir()).toBe(testDir);
});
test("saveRuleMappingSnapshot and loadRuleMappingSnapshot round-trip", () => {
const snapshot: RuleMappingSnapshot = {
syncedAt: new Date().toISOString(),
source: {
id: "prod-1",
name: "Acme Corp",
latestPublishedVersionNumber: 22,
latestPublishedVersionName: "Version 22"
},
target: {
id: "test-1",
name: "Acme Test",
publishedVersionNumber: 7,
publishedVersionName: "Sync from Acme Corp [Prod v22 · #1]",
rulesCount: 2
},
versionMapping: {
sourceProdVersionNumber: 22,
sourceProdVersionName: "Version 22",
targetTestVersionNumber: 7,
targetTestVersionName: "Sync from Acme Corp [Prod v22 · #1]"
},
ruleMapping: [
{
index: 1,
sourceRuleId: "src-rule-1",
sourceRuleCode: 10,
targetRuleId: "tgt-rule-1",
targetRuleCode: "rule-1",
description: "No alcohol above 50%",
scope: "all",
strictness: "MUST_FOLLOW"
},
{
index: 2,
sourceRuleId: "src-rule-2",
sourceRuleCode: 11,
targetRuleId: "tgt-rule-2",
targetRuleCode: "rule-2",
description: "Private car mileage limit",
scope: "travel",
strictness: "MUST_FOLLOW"
}
]
};
const savedFile = saveRuleMappingSnapshot(snapshot);
expect(existsSync(savedFile)).toBe(true);
const loadedByVersion = loadRuleMappingSnapshot("test-1", 7);
expect(loadedByVersion).not.toBeNull();
expect(loadedByVersion?.target.publishedVersionNumber).toBe(7);
expect(loadedByVersion?.ruleMapping.length).toBe(2);
expect(loadedByVersion?.ruleMapping[0]!.sourceRuleCode).toBe(10);
expect(loadedByVersion?.ruleMapping[0]!.targetRuleCode).toBe("rule-1");
const loadedByVString = loadRuleMappingSnapshot("test-1", "v7");
expect(loadedByVString?.target.publishedVersionNumber).toBe(7);
const loadedLatest = loadRuleMappingSnapshot("test-1", "latest");
expect(loadedLatest?.target.publishedVersionNumber).toBe(7);
const missing = loadRuleMappingSnapshot("test-1", 999);
expect(missing).toBeNull();
});
test("filterRuleMapping filters by target code, source code, and IDs", () => {
const items = [
{
index: 1,
sourceRuleId: "src-uuid-1",
sourceRuleCode: 14,
targetRuleId: "tgt-uuid-1",
targetRuleCode: "rule-14",
description: "Rule 14 desc",
scope: "scope 1",
strictness: "MUST_FOLLOW"
},
{
index: 2,
sourceRuleId: "src-uuid-2",
sourceRuleCode: 15,
targetRuleId: "tgt-uuid-2",
targetRuleCode: "rule-15",
description: "Rule 15 desc",
scope: "scope 2",
strictness: "SUGGESTION"
}
];
expect(filterRuleMapping(items)).toHaveLength(2);
expect(filterRuleMapping(items, "rule-14")).toHaveLength(1);
expect(filterRuleMapping(items, "rule-14")[0]!.sourceRuleCode).toBe(14);
expect(filterRuleMapping(items, "14")).toHaveLength(1);
expect(filterRuleMapping(items, "#14")).toHaveLength(1);
expect(filterRuleMapping(items, "#rule-15")).toHaveLength(1);
expect(filterRuleMapping(items, "src-uuid-2")).toHaveLength(1);
expect(filterRuleMapping(items, "non-existent")).toHaveLength(0);
});
test("computeNextSyncIteration calculates iteration sequence accurately", () => {
// 1. Initial sync when test enterprise has no history
expect(computeNextSyncIteration("Acme Corp", 22, [])).toBe(1);
// 2. Legacy un-numbered sync exists
expect(
computeNextSyncIteration("Acme Corp", 22, [
{ versionName: "Sync from Acme Corp (2026-09-11)" }
])
).toBe(2);
// 3. Structured iterations exist for same prodVersion (including with target test version)
expect(
computeNextSyncIteration("Acme Corp", 22, [
{ versionName: "Sync from Acme Corp [Prod v22 · #1 -> Test v1]" },
{ versionName: "Sync from Acme Corp [Prod v22 · #2 -> Test v2]" }
])
).toBe(3);
// 4. Production version bumped to 23 -> resets to 1
expect(
computeNextSyncIteration("Acme Corp", 23, [
{ versionName: "Sync from Acme Corp [Prod v22 · #1 -> Test v1]" },
{ versionName: "Sync from Acme Corp [Prod v22 · #2 -> Test v2]" }
])
).toBe(1);
// 5. Production has no published version (draft only)
expect(
computeNextSyncIteration("Acme Corp", undefined, [
{ versionName: "Sync from Acme Corp [Prod draft · #1 -> Test v1]" }
])
).toBe(2);
});
test("formatSyncVersionName formats cleanly with test version mapping", () => {
expect(formatSyncVersionName("Acme Corp", 22, 1, 3)).toBe(
"Sync from Acme Corp [Prod v22 · #1 -> Test v3]"
);
expect(formatSyncVersionName("Acme Corp", 22, 1)).toBe(
"Sync from Acme Corp [Prod v22 · #1]"
);
expect(formatSyncVersionName("Acme Corp", undefined, 1, 5)).toBe(
"Sync from Acme Corp [Prod draft · #1 -> Test v5]"
);
});
});
+154
View File
@@ -0,0 +1,154 @@
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { homedir } from "node:os";
import { join } from "node:path";
export interface RuleMappingItem {
index: number;
sourceRuleId: string;
sourceRuleCode: string | number;
targetRuleId: string;
targetRuleCode: string | number;
description: string;
scope: string;
strictness: string;
}
export interface RuleMappingSnapshot {
syncedAt: string;
source: {
id: string;
name: string;
latestPublishedVersionNumber?: number | null;
latestPublishedVersionName?: string | null;
};
target: {
id: string;
name: string;
publishedVersionNumber: number;
publishedVersionName?: string | null;
rulesCount: number;
};
versionMapping: {
sourceProdVersionNumber: number | null;
sourceProdVersionName: string | null;
targetTestVersionNumber: number;
targetTestVersionName: string | null;
};
ruleMapping: RuleMappingItem[];
}
export function getMappingsDir(): string {
const custom = process.env.SEAL_USE_MAPPINGS_DIR?.trim();
if (custom) return custom;
return join(homedir(), ".config", "seal-use", "mappings");
}
export function saveRuleMappingSnapshot(snapshot: RuleMappingSnapshot): string {
const dir = getMappingsDir();
mkdirSync(dir, { recursive: true, mode: 0o700 });
const versionFile = join(dir, `${snapshot.target.id}-v${snapshot.target.publishedVersionNumber}.json`);
const latestFile = join(dir, `${snapshot.target.id}-latest.json`);
const content = JSON.stringify(snapshot, null, 2);
writeFileSync(versionFile, content, { encoding: "utf-8", mode: 0o600 });
writeFileSync(latestFile, content, { encoding: "utf-8", mode: 0o600 });
return versionFile;
}
export function loadRuleMappingSnapshot(
targetCorpId: string,
versionSelector?: string | number
): RuleMappingSnapshot | null {
const dir = getMappingsDir();
let filename: string;
if (!versionSelector || versionSelector === "latest") {
filename = `${targetCorpId}-latest.json`;
} else {
const vStr = String(versionSelector).replace(/^v/i, "");
filename = `${targetCorpId}-v${vStr}.json`;
}
const filePath = join(dir, filename);
if (!existsSync(filePath)) {
return null;
}
try {
const raw = readFileSync(filePath, "utf-8");
return JSON.parse(raw) as RuleMappingSnapshot;
} catch {
return null;
}
}
export function filterRuleMapping(
mapping: RuleMappingItem[],
codeOrId?: string
): RuleMappingItem[] {
if (!codeOrId) return mapping;
const target = codeOrId.trim().toLowerCase();
return mapping.filter((item) => {
return (
String(item.sourceRuleCode).toLowerCase() === target ||
String(item.targetRuleCode).toLowerCase() === target ||
item.sourceRuleId.toLowerCase() === target ||
item.targetRuleId.toLowerCase() === target ||
`#${item.sourceRuleCode}`.toLowerCase() === target ||
`#${item.targetRuleCode}`.toLowerCase() === target
);
});
}
export function computeNextSyncIteration(
prodCorpName: string,
prodVersionNumber: number | undefined,
testVersions: Array<{ versionName?: string | null }>
): number {
let maxIteration = 0;
const prefixRegex = prodVersionNumber !== undefined
? new RegExp(`\\[Prod v${prodVersionNumber}\\s*·\\s*#(\\d+)(?:[^\\]]*)\\]`)
: /\[Prod draft\s*·\s*#(\d+)(?:[^\]]*)\]/;
for (const tv of testVersions) {
if (!tv.versionName) continue;
const match = tv.versionName.match(prefixRegex);
if (match && match[1]) {
const num = parseInt(match[1], 10);
if (!isNaN(num) && num > maxIteration) {
maxIteration = num;
}
}
}
if (maxIteration > 0) {
return maxIteration + 1;
}
// If no structured tag exists at all, check legacy un-numbered sync versions
const anyStructuredTag = testVersions.some(
(tv) => tv.versionName && /\[Prod v\d+/.test(tv.versionName)
);
if (!anyStructuredTag) {
const legacySyncCount = testVersions.filter(
(tv) => tv.versionName && tv.versionName.includes(`Sync from ${prodCorpName}`)
).length;
if (legacySyncCount > 0) {
return legacySyncCount + 1;
}
}
return 1;
}
export function formatSyncVersionName(
prodCorpName: string,
prodVersionNumber: number | undefined,
iteration: number,
targetTestVersionNumber?: number
): string {
const prodLabel = prodVersionNumber !== undefined ? `Prod v${prodVersionNumber}` : "Prod draft";
const testLabel = targetTestVersionNumber !== undefined ? ` -> Test v${targetTestVersionNumber}` : "";
return `Sync from ${prodCorpName} [${prodLabel} · #${iteration}${testLabel}]`;
}
+11
View File
@@ -847,6 +847,7 @@ export const sealTools = [
content: z.string().describe("正文,通常为 Markdown"),
contentType: z.string().optional(),
status: z.string().optional(),
enabled: z.boolean().optional(),
scenarios: z.array(z.string()).optional(),
tags: z.array(z.string()).optional()
}),
@@ -858,6 +859,7 @@ export const sealTools = [
content: string;
contentType?: string;
status?: string;
enabled?: boolean;
scenarios?: string[];
tags?: string[];
}
@@ -895,6 +897,15 @@ export const sealTools = [
return api.updateApprovalDocument(client, documentId, rest);
}
},
{
name: "seal_approval_delete_document",
description: "删除 Seal 审批知识文档",
parameters: z.object({
documentId: z.string().describe("知识文档 ID")
}),
handler: (client: KyInstance, params: { documentId: string }) =>
api.deleteApprovalDocument(client, params.documentId)
},
{
name: "seal_approval_search",
description: "按关键词组检索 Seal 审批规则、审批文档和审批偏好配置,返回命中位置、字段、行号和前后三行上下文",
+124
View File
@@ -0,0 +1,124 @@
import { describe, expect, test } from "bun:test";
import { formatDevVersion, parseGitDescribe, resolveVersionInfo } from "./version.js";
import { compareSemVer, isNewerVersion } from "./cli/commands/update.js";
describe("Git version parsing and formatting", () => {
test("parses full git describe string with commits ahead and dirty state", () => {
const parsed = parseGitDescribe("v0.10.15-2-ga521a24-dirty");
expect(parsed).toEqual({
baseVersion: "0.10.15",
commitsAhead: 2,
commit: "a521a24",
dirty: true,
describe: "v0.10.15-2-ga521a24-dirty"
});
});
test("parses clean git describe string without dirty suffix", () => {
const parsed = parseGitDescribe("v0.10.15-0-g83ade4d");
expect(parsed).toEqual({
baseVersion: "0.10.15",
commitsAhead: 0,
commit: "83ade4d",
dirty: false,
describe: "v0.10.15-0-g83ade4d"
});
});
test("parses tag-only git describe with dirty status", () => {
const parsed = parseGitDescribe("v0.10.15-dirty");
expect(parsed).toEqual({
baseVersion: "0.10.15",
commitsAhead: 0,
commit: "",
dirty: true,
describe: "v0.10.15-dirty"
});
});
test("parses raw commit hash fallback", () => {
const parsed = parseGitDescribe("83ade4d-dirty", "0.10.15");
expect(parsed).toEqual({
baseVersion: "0.10.15",
commitsAhead: 0,
commit: "83ade4d",
dirty: true,
describe: "83ade4d-dirty"
});
});
test("returns null for empty or invalid describe strings", () => {
expect(parseGitDescribe("")).toBeNull();
expect(parseGitDescribe(" ")).toBeNull();
expect(parseGitDescribe("invalid/string/without/semver")).toBeNull();
});
test("formats dev version according to standard SemVer 2.0 rules", () => {
expect(formatDevVersion("0.10.15", 2, "a521a24", false)).toBe("0.10.15-dev.2+ga521a24");
expect(formatDevVersion("0.10.15", 2, "a521a24", true)).toBe("0.10.15-dev.2+ga521a24.dirty");
expect(formatDevVersion("0.10.15", 0, "83ade4d", false)).toBe("0.10.15-dev.0+g83ade4d");
expect(formatDevVersion("0.10.15", 0, "83ade4d", true)).toBe("0.10.15-dev.0+g83ade4d.dirty");
});
});
describe("resolveVersionInfo configuration modes", () => {
test("resolves inlined environment variables when preset", () => {
const info = resolveVersionInfo({
env: {
SEAL_BUILD_VERSION: "0.10.15-dev.3+g9a7be16",
SEAL_BUILD_CHANNEL: "dev",
SEAL_BUILD_IS_RELEASE: "false",
SEAL_BUILD_GIT_BASE: "0.10.15",
SEAL_BUILD_GIT_COMMITS_AHEAD: "3",
SEAL_BUILD_GIT_COMMIT: "9a7be16",
SEAL_BUILD_GIT_DIRTY: "false",
SEAL_BUILD_GIT_DESCRIBE: "v0.10.15-3-g9a7be16"
}
});
expect(info.name).toBe("seal-use");
expect(info.version).toBe("0.10.15-dev.3+g9a7be16");
expect(info.channel).toBe("dev");
expect(info.isRelease).toBe(false);
expect(info.git).toBeDefined();
expect(info.git?.baseVersion).toBe("0.10.15");
expect(info.git?.commitsAhead).toBe(3);
expect(info.git?.commit).toBe("9a7be16");
expect(info.git?.dirty).toBe(false);
});
test("resolves release mode when SEAL_FORCE_RELEASE is set", () => {
const info = resolveVersionInfo({
env: {
SEAL_FORCE_RELEASE: "1"
}
});
expect(info.name).toBe("seal-use");
expect(info.channel).toBe("release");
expect(info.isRelease).toBe(true);
expect(info.git).toBeUndefined();
});
});
describe("compareSemVer dev version handling", () => {
test("recognizes future release as newer than dev build", () => {
expect(isNewerVersion("0.10.16", "0.10.15-dev.2+ga521a24")).toBe(true);
expect(isNewerVersion("0.11.0", "0.10.15-dev.2+ga521a24")).toBe(true);
expect(isNewerVersion("1.0.0", "0.10.15-dev.2+ga521a24")).toBe(true);
});
test("recognizes base release as older than ahead dev build", () => {
expect(compareSemVer("0.10.15", "0.10.15-dev.2+ga521a24")).toBe(-1);
expect(isNewerVersion("0.10.15", "0.10.15-dev.2+ga521a24")).toBe(false);
});
test("correctly compares dev builds by commits ahead", () => {
expect(compareSemVer("0.10.15-dev.3", "0.10.15-dev.2")).toBe(1);
expect(compareSemVer("0.10.15-dev.1", "0.10.15-dev.2")).toBe(-1);
});
test("identifies older legacy release as downgrade", () => {
expect(compareSemVer("0.3.3", "0.10.15-dev.2+ga521a24")).toBe(-1);
});
});
+173 -1
View File
@@ -1,3 +1,175 @@
import { spawnSync } from "node:child_process";
import packageJson from "../package.json" with { type: "json" };
export const VERSION = packageJson.version;
export interface GitBuildInfo {
baseVersion: string;
commitsAhead: number;
commit: string;
dirty: boolean;
describe: string;
}
export interface VersionInfo {
name: "seal-use";
version: string;
channel: "release" | "dev";
isRelease: boolean;
git?: GitBuildInfo;
}
export function parseGitDescribe(output: string, fallbackVersion = packageJson.version): GitBuildInfo | null {
const trimmed = output.trim();
if (!trimmed) return null;
const dirty = trimmed.endsWith("-dirty");
const clean = dirty ? trimmed.slice(0, -6) : trimmed;
// Format 1: v0.10.15-2-ga521a24
const longMatch = clean.match(/^v?(\d+\.\d+\.\d+(?:-[a-zA-Z0-9.]+)?)-(\d+)-g([0-9a-f]+)$/);
if (longMatch && longMatch[1] && longMatch[2] && longMatch[3]) {
return {
baseVersion: longMatch[1],
commitsAhead: Number.parseInt(longMatch[2], 10),
commit: longMatch[3],
dirty,
describe: trimmed
};
}
// Format 2: v0.10.15
const tagMatch = clean.match(/^v?(\d+\.\d+\.\d+(?:-[a-zA-Z0-9.]+)?)$/);
if (tagMatch && tagMatch[1]) {
return {
baseVersion: tagMatch[1],
commitsAhead: 0,
commit: "",
dirty,
describe: trimmed
};
}
// Format 3: 83ade4d
const commitMatch = clean.match(/^([0-9a-f]{7,40})$/);
if (commitMatch && commitMatch[1]) {
return {
baseVersion: fallbackVersion,
commitsAhead: 0,
commit: commitMatch[1],
dirty,
describe: trimmed
};
}
return null;
}
export function formatDevVersion(baseVersion: string, commitsAhead: number, commit: string, dirty: boolean): string {
const dirtySuffix = dirty ? ".dirty" : "";
const commitSuffix = commit ? `+g${commit}${dirtySuffix}` : dirty ? "+dirty" : "";
return `${baseVersion}-dev.${commitsAhead}${commitSuffix}`;
}
export function resolveVersionInfo(options?: {
env?: Record<string, string | undefined>;
cwd?: string;
}): VersionInfo {
const customEnv = options?.env;
const buildVersion = customEnv?.SEAL_BUILD_VERSION ?? process.env.SEAL_BUILD_VERSION;
const buildIsRelease = customEnv?.SEAL_BUILD_IS_RELEASE ?? process.env.SEAL_BUILD_IS_RELEASE;
const buildChannel = customEnv?.SEAL_BUILD_CHANNEL ?? process.env.SEAL_BUILD_CHANNEL;
const buildGitBase = customEnv?.SEAL_BUILD_GIT_BASE ?? process.env.SEAL_BUILD_GIT_BASE;
const buildGitCommitsAhead = customEnv?.SEAL_BUILD_GIT_COMMITS_AHEAD ?? process.env.SEAL_BUILD_GIT_COMMITS_AHEAD;
const buildGitCommit = customEnv?.SEAL_BUILD_GIT_COMMIT ?? process.env.SEAL_BUILD_GIT_COMMIT;
const buildGitDirty = customEnv?.SEAL_BUILD_GIT_DIRTY ?? process.env.SEAL_BUILD_GIT_DIRTY;
const buildGitDescribe = customEnv?.SEAL_BUILD_GIT_DESCRIBE ?? process.env.SEAL_BUILD_GIT_DESCRIBE;
const forceRelease = customEnv?.SEAL_FORCE_RELEASE ?? process.env.SEAL_FORCE_RELEASE;
const cwd = options?.cwd;
// 1. Check compile-time inlined environment variables
if (buildVersion) {
const isRelease = buildIsRelease === "true";
const channel = (buildChannel as "release" | "dev") || (isRelease ? "release" : "dev");
const result: VersionInfo = {
name: "seal-use",
version: buildVersion,
channel,
isRelease
};
if (buildGitBase) {
result.git = {
baseVersion: buildGitBase,
commitsAhead: Number.parseInt(buildGitCommitsAhead || "0", 10),
commit: buildGitCommit || "",
dirty: buildGitDirty === "true",
describe: buildGitDescribe || buildVersion
};
}
return result;
}
// 2. Explicit force release via environment
if (buildIsRelease === "true" || forceRelease === "1") {
return {
name: "seal-use",
version: packageJson.version,
channel: "release",
isRelease: true
};
}
// 3. Dynamic resolution from git repository in dev mode
try {
const res = spawnSync("git", ["describe", "--tags", "--long", "--dirty", "--always"], {
cwd,
encoding: "utf8",
stdio: ["ignore", "pipe", "ignore"]
});
if (res.status === 0 && res.stdout) {
const gitInfo = parseGitDescribe(res.stdout.trim(), packageJson.version);
if (gitInfo) {
if (!gitInfo.commit) {
const revRes = spawnSync("git", ["rev-parse", "--short", "HEAD"], {
cwd,
encoding: "utf8",
stdio: ["ignore", "pipe", "ignore"]
});
if (revRes.status === 0 && revRes.stdout) {
gitInfo.commit = revRes.stdout.trim();
}
}
const devVersion = formatDevVersion(
gitInfo.baseVersion,
gitInfo.commitsAhead,
gitInfo.commit,
gitInfo.dirty
);
return {
name: "seal-use",
version: devVersion,
channel: "dev",
isRelease: false,
git: gitInfo
};
}
}
} catch {
// Fall back below if git is not installed or error occurs
}
// 4. Default fallback when git is not available
return {
name: "seal-use",
version: `${packageJson.version}-dev.0+local`,
channel: "dev",
isRelease: false
};
}
export const VERSION_INFO = resolveVersionInfo();
export const VERSION = VERSION_INFO.version;
export const IS_RELEASE = VERSION_INFO.isRelease;
export const CHANNEL = VERSION_INFO.channel;