Merge pull request #181 from yunyingk/codex/release-v0.10.39
🧪 CI / 🧪 Test, Type-Check & Build Validation (push) Has been cancelled
🚀 Release / 🚀 Build & Publish GitHub Release (push) Has been cancelled

Release v0.10.39: Standardize 0-based 00xx rule codes, draft-default rules CLI, and documents domain
This commit is contained in:
yunyingk authored and GitHub committed 2026-09-28 11:51:04 +08:00
commit 6e86f8b5f3
33 files changed
+1377 -777

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "seal-use",
"version": "0.10.38",
"version": "0.10.39",
"description": "Seal Use tenant operations: approval-run diagnosis, minimal rule remediation, delegation links, Hose/合思 authorization, users, rules, billing, and search.",
"author": {
"name": "yingqing"
+17
View File
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
## [0.10.39] - 2026-09-28
### Added
- Add first-class `seal-use documents` CLI domain (`list`, `get`, `search`, `create`, `update`, `delete`) with `--content-file` and `--yes` confirmation support.
- Add first-class `seal-use rules create`, `rules update <code>`, `rules delete <code> --yes`, and `rules publish <versionName>` CLI commands with `--description-file` support.
- Support `--version <number|latest>` (and silent `--latest` alias) across `rules count`, `rules list`, `rules get`, `rules search`, `rules lint`, and `rules pull`.
### Changed
- Standardize rule `code` to 0-based 4-digit zero-padded strings (`0000`, `0025`, `0038`) across CLI outputs and skill docs while keeping `25`, `#0025`, and `rule-25` inputs silently compatible.
- Default all `rules` read and lint commands (`count`, `list`, `get`, `search`, `lint`, `pull`) to the current draft, requiring `--version latest` to inspect the latest published version.
- Remove legacy `seal-use tool` and `seal-use tools` CLI passthrough commands in favor of first-class domain commands.
### Fixed
- Remove erroneous `+1` array-index offsets in rule code resolution and mapping so 0-based rule codes and gaps from deleted rules resolve accurately.
- Extract and merge `result.rulesResult` and `result.hitRules` in `approval-runs cited-rules`.
- Prevent global `--version` flag handling in `runner.ts` from intercepting `--version` options passed to subcommands such as `seal-use rules`.
## [0.10.38] - 2026-09-22
### Added
+180 -292
View File
@@ -1,7 +1,7 @@
import{createRequire as Vx0}from"node:module";var Jx0=Object.create;var{getPrototypeOf:Kx0,defineProperty:EE,getOwnPropertyNames:zx0}=Object;var Gx0=Object.prototype.hasOwnProperty;function Hx0($){return this[$]}var Wx0,Xx0,K6=($,Y,U)=>{var I=$!=null&&typeof $==="object";if(I){var Q=Y?Wx0??=new WeakMap:Xx0??=new WeakMap,J=Q.get($);if(J)return J}U=$!=null?Jx0(Kx0($)):{};let K=Y||!$||!$.__esModule?EE(U,"default",{value:$,enumerable:!0}):U;for(let z of zx0($))if(!Gx0.call(K,z))EE(K,z,{get:Hx0.bind($,z),enumerable:!0});if(I)Q.set($,K);return K};var j=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);var Zx0=($)=>$;function qx0($,Y){this[$]=Zx0.bind(null,Y)}var Z8=($,Y)=>{for(var U in Y)EE($,U,{get:Y[U],enumerable:!0,configurable:!0,set:qx0.bind(Y,U)})};var m=($,Y)=>()=>($&&(Y=$($=0)),Y);var K0=Vx0(import.meta.url);var Lx0,zV,Fx0,wx0,Mx0,Ox0,C0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),yr=($,Y)=>{let U={};for(var I in $)zV(U,I,{get:$[I],enumerable:!0});if(Y)zV(U,Symbol.toStringTag,{value:"Module"});return U},Nx0=($,Y,U,I)=>{if(Y&&typeof Y==="object"||typeof Y==="function"){for(var Q=wx0(Y),J=0,K=Q.length,z;J<K;J++)if(z=Q[J],!Ox0.call($,z)&&z!==U)zV($,z,{get:((G)=>Y[G]).bind(null,z),enumerable:!(I=Fx0(Y,z))||I.enumerable})}return $},GV=($,Y,U)=>(U=$!=null?Lx0(Mx0($)):{},Nx0(Y||!$||!$.__esModule?zV(U,"default",{value:$,enumerable:!0}):U,$));var jE=m(()=>{Lx0=Object.create,zV=Object.defineProperty,Fx0=Object.getOwnPropertyDescriptor,wx0=Object.getOwnPropertyNames,Mx0=Object.getPrototypeOf,Ox0=Object.prototype.hasOwnProperty});function xr($){return typeof $==="string"&&kr.has($.replace(/#$/,""))}function fr($,Y){if(!("$schema"in $)||typeof $.$schema!=="string")return"2020-12";let U=$.$schema.replace(/#$/,"");if(Dx0.has(U))return"2020-12";if(kr.has(U))return"2019-09";if(Bx0.has(U)||Ax0.has(U))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${$.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${Y}`)}var Dx0,kr,Bx0,Ax0;var CE=m(()=>{Dx0=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),kr=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Bx0=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Ax0=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});function H0($,Y,U){function I(z,G){if(!z._zod)Object.defineProperty(z,"_zod",{value:{def:G,constr:K,traits:new Set},enumerable:!1});if(z._zod.traits.has($))return;z._zod.traits.add($),Y(z,G);let H=K.prototype,W=Object.keys(H);for(let X=0;X<W.length;X++){let Z=W[X];if(!(Z in z))z[Z]=H[Z].bind(z)}}let Q=U?.Parent??Object;class J extends Q{}Object.defineProperty(J,"name",{value:$});function K(z){var G;let H=U?.Parent?new J:this;I(H,z),(G=H._zod).deferred??(G.deferred=[]);for(let W of H._zod.deferred)W();return H}return Object.defineProperty(K,"init",{value:I}),Object.defineProperty(K,Symbol.hasInstance,{value:(z)=>{if(U?.Parent&&z instanceof U.Parent)return!0;return z?._zod?.traits?.has($)}}),Object.defineProperty(K,"name",{value:$}),K}function a4($){if($)Object.assign(jY,$);return jY}var ur,YG,RE,o5,CY,jY;var RY=m(()=>{YG=Object.freeze({status:"aborted"});RE=Symbol("zod_brand");o5=class o5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};CY=class CY extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(ur=globalThis).__zod_globalConfig??(ur.__zod_globalConfig={});jY=globalThis.__zod_globalConfig});var k0={};Z8(k0,{unwrapMessage:()=>UG,uint8ArrayToHex:()=>ox0,uint8ArrayToBase64url:()=>mx0,uint8ArrayToBase64:()=>cr,stringifyPrimitive:()=>_0,slugify:()=>SE,shallowClone:()=>gE,safeExtend:()=>bx0,required:()=>nx0,randomString:()=>hx0,propertyKeyTypes:()=>JG,promiseAllObject:()=>Sx0,primitiveTypes:()=>yE,prefixIssues:()=>d8,pick:()=>xx0,partial:()=>cx0,parsedType:()=>h0,optionalKeys:()=>kE,omit:()=>fx0,objectClone:()=>Rx0,numKeys:()=>gx0,nullish:()=>V7,normalizeParams:()=>f0,mergeDefs:()=>s9,merge:()=>ix0,jsonStringifyReplacer:()=>oI,joinValues:()=>M0,issue:()=>sI,isPlainObject:()=>F7,isObject:()=>_Y,hexToUint8Array:()=>lx0,getSizableOrigin:()=>KG,getParsedType:()=>yx0,getLengthableOrigin:()=>zG,getEnumValues:()=>IG,getElementAtPath:()=>vx0,floatSafeRemainder:()=>vE,finalizeIssue:()=>R8,extend:()=>ux0,explicitlyAborted:()=>uE,escapeRegex:()=>_$,esc:()=>HV,defineLazy:()=>j1,createTransparentProxy:()=>kx0,cloneDef:()=>_x0,clone:()=>C8,cleanRegex:()=>QG,cleanEnum:()=>dx0,captureStackTrace:()=>WV,cached:()=>rI,base64urlToUint8Array:()=>px0,base64ToUint8Array:()=>ir,assignProp:()=>L7,assertNotEqual:()=>Tx0,assertNever:()=>jx0,assertIs:()=>Ex0,assertEqual:()=>Px0,assert:()=>Cx0,allowsEval:()=>hE,aborted:()=>w7,NUMBER_FORMAT_RANGES:()=>xE,Class:()=>nrLine truncated
`)}var dr=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,oI,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},GG,p8;var cE=m(()=>{RY();$1();GG=H0("$ZodError",dr),p8=H0("$ZodError",dr,{Parent:Error})});var aI=($)=>(Y,U,I,Q)=>{let J=I?{...I,async:!1}:{async:!1},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)throw new o5;if(K.issues.length){let z=new(Q?.Err??$)(K.issues.map((G)=>R8(G,J,a4())));throw WV(z,Q?.callee),z}return K.value},XV,tI=($)=>async(Y,U,I,Q)=>{let J=I?{...I,async:!0}:{async:!0},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)K=await K;if(K.issues.length){let z=new(Q?.Err??$)(K.issues.map((G)=>R8(G,J,a4())));throw WV(z,Q?.callee),z}return K.value},ZV,eI=($)=>(Y,U,I)=>{let Q=I?{...I,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)throw new o5;return J.issues.length?{success:!1,error:new($??GG)(J.issues.map((K)=>R8(K,Q,a4())))}:{success:!0,data:J.value}},nE,$Q=($)=>async(Y,U,I)=>{let Q=I?{...I,async:!0}:{async:!0},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((K)=>R8(K,Q,a4())))}:{success:!0,data:J.value}},dE,qV=($)=>(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return aI($)(Y,U,Q)},sx0,VV=($)=>(Y,U,I)=>{return aI($)(Y,U,I)},ax0,LV=($)=>async(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return tI($)(Y,U,Q)},tx0,FV=($)=>async(Y,U,I)=>{return tI($)(Y,U,I)},ex0,wV=($)=>(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return eI($)(Y,U,Q)},$f0,MV=($)=>(Y,U,I)=>{return eI($)(Y,U,I)},Yf0,OV=($)=>async(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return $Q($)(Y,U,Q)},Uf0,NV=($)=>async(Y,U,I)=>{return $Q($)(Y,U,I)},If0;var pE=m(()=>{RY();cE();$1();XV=aI(p8),ZV=tI(p8),nE=eI(p8),dE=$Q(p8),sx0=qV(p8),ax0=VV(p8),tx0=LV(p8),ex0=FV(p8),$f0=wV(p8),Yf0=MV(p8),Uf0=OV(p8),If0=NV(p8)});var H$={};Z8(H$,{xid:()=>rE,uuid7:()=>zf0,uuid6:()=>Kf0,uuid4:()=>Jf0,uuid:()=>vY,uppercase:()=>Nj,unicodeEmail:()=>mr,undefined:()=>Mj,ulid:()=>oE,time:()=>Xj,string:()=>qj,sha512_hex:()=>Cf0,sha512_base64url:()=>_f0,sha512_base64:()=>Rf0,sha384_hex:()=>Tf0,sha384_base64url:()=>jf0,sha384_base64:()=>Ef0,sha256_hex:()=>Bf0,sha256_base64url:()=>Pf0,sha256_base64:()=>Af0,sha1_hex:()=>Of0,sha1_base64url:()=>Df0,sha1_base64:()=>Nf0,rfc5322Email:()=>Hf0,number:()=>XG,null:()=>wj,nanoid:()=>aE,md5_hex:()=>Ff0,md5_base64url:()=>Mf0,md5_base64:()=>wf0,mac:()=>Qj,lowercase:()=>Oj,ksuid:()=>sE,ipv6:()=>Ij,ipv4:()=>Uj,integer:()=>Lj,idnEmail:()=>Wf0,httpProtocol:()=>Gj,html5Email:()=>Gf0,hostname:()=>qf0,hex:()=>Lf0,guid:()=>eE,extendedDuration:()=>Qf0,emoji:()=>Yj,email:()=>$j,e164:()=>Hj,duration:()=>tE,domain:()=>Vf0,datetime:()=>Zj,date:()=>Wj,cuid2:()=>lE,cuid:()=>mE,cidrv6:()=>Kj,cidrv4:()=>Jj,browserEmail:()=>Xf0,boolean:()=>Fj,bigint:()=>Vj,base64url:()=>DV,base64:()=>zj});function Yj(){return new RegExp(Zf0,"u")}function or($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Xj($){return new RegExp(`^${or($)}$`)}function Zj($){let Y=or({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let I=`${Y}(?:${U.join("|")})`;return new RegExp(`^${lr}T(?:${I})$`)}function ZG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function qG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var mE,lE,oE,rE,sE,aE,tE,Qf0,eE,vY=($)=>{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})$`)},Jf0,Kf0,zf0,$j,Gf0,Hf0,mr,Wf0,Xf0,Zf0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Uj,Ij,Qj=($)=>{let Y=_$($??":");return new RegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Jj,Kj,zj,DV,qf0,Vf0,Gj,Hj,lr="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Wj,qj=($)=>{let Y=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)},Vj,Lj,XG,Fj,wj,Mj,Oj,Nj,Lf0,Ff0,wf0,Mf0,Of0,Nf0,Df0,Bf0,Af0,Pf0,Tf0,Ef0,jf0,Cf0,Rf0,_f0;var BV=m(()=>{$1();mE=/^[cC][0-9a-z]{6,}$/,lE=/^[0-9a-z]+$/,oE=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,rE=/^[0-9a-vA-V]{20}$/,sE=/^[A-Za-z0-9]{27}$/,aE=/^[a-zA-Z0-9_-]{21}$/,tE=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
import{createRequire as Mx0}from"node:module";var Hx0=Object.create;var{getPrototypeOf:Wx0,defineProperty:_E,getOwnPropertyNames:Xx0}=Object;var Zx0=Object.prototype.hasOwnProperty;function qx0($){return this[$]}var Vx0,Lx0,G6=($,Y,U)=>{var I=$!=null&&typeof $==="object";if(I){var Q=Y?Vx0??=new WeakMap:Lx0??=new WeakMap,J=Q.get($);if(J)return J}U=$!=null?Hx0(Wx0($)):{};let K=Y||!$||!$.__esModule?_E(U,"default",{value:$,enumerable:!0}):U;for(let z of Xx0($))if(!Zx0.call(K,z))_E(K,z,{get:qx0.bind($,z),enumerable:!0});if(I)Q.set($,K);return K};var j=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);var Fx0=($)=>$;function wx0($,Y){this[$]=Fx0.bind(null,Y)}var V8=($,Y)=>{for(var U in Y)_E($,U,{get:Y[U],enumerable:!0,configurable:!0,set:wx0.bind(Y,U)})};var m=($,Y)=>()=>($&&(Y=$($=0)),Y);var K0=Mx0(import.meta.url);var Ox0,WV,Nx0,Dx0,Bx0,Ax0,C0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),ir=($,Y)=>{let U={};for(var I in $)WV(U,I,{get:$[I],enumerable:!0});if(Y)WV(U,Symbol.toStringTag,{value:"Module"});return U},Px0=($,Y,U,I)=>{if(Y&&typeof Y==="object"||typeof Y==="function"){for(var Q=Dx0(Y),J=0,K=Q.length,z;J<K;J++)if(z=Q[J],!Ax0.call($,z)&&z!==U)WV($,z,{get:((G)=>Y[G]).bind(null,z),enumerable:!(I=Nx0(Y,z))||I.enumerable})}return $},XV=($,Y,U)=>(U=$!=null?Ox0(Bx0($)):{},Px0(Y||!$||!$.__esModule?WV(U,"default",{value:$,enumerable:!0}):U,$));var vE=m(()=>{Ox0=Object.create,WV=Object.defineProperty,Nx0=Object.getOwnPropertyDescriptor,Dx0=Object.getOwnPropertyNames,Bx0=Object.getPrototypeOf,Ax0=Object.prototype.hasOwnProperty});function nr($){return typeof $==="string"&&cr.has($.replace(/#$/,""))}function dr($,Y){if(!("$schema"in $)||typeof $.$schema!=="string")return"2020-12";let U=$.$schema.replace(/#$/,"");if(Tx0.has(U))return"2020-12";if(cr.has(U))return"2019-09";if(Ex0.has(U)||jx0.has(U))return"draft-7";throw Error(`JSON Schema declares an unsupported dialect ("$schema": "${$.$schema.slice(0,200)}"). The default validator supports JSON Schema 2020-12, 2019-09, draft-07, and draft-06; ${Y}`)}var Tx0,cr,Ex0,jx0;var SE=m(()=>{Tx0=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),cr=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Ex0=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),jx0=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});function H0($,Y,U){function I(z,G){if(!z._zod)Object.defineProperty(z,"_zod",{value:{def:G,constr:K,traits:new Set},enumerable:!1});if(z._zod.traits.has($))return;z._zod.traits.add($),Y(z,G);let H=K.prototype,W=Object.keys(H);for(let X=0;X<W.length;X++){let Z=W[X];if(!(Z in z))z[Z]=H[Z].bind(z)}}let Q=U?.Parent??Object;class J extends Q{}Object.defineProperty(J,"name",{value:$});function K(z){var G;let H=U?.Parent?new J:this;I(H,z),(G=H._zod).deferred??(G.deferred=[]);for(let W of H._zod.deferred)W();return H}return Object.defineProperty(K,"init",{value:I}),Object.defineProperty(K,Symbol.hasInstance,{value:(z)=>{if(U?.Parent&&z instanceof U.Parent)return!0;return z?._zod?.traits?.has($)}}),Object.defineProperty(K,"name",{value:$}),K}function t4($){if($)Object.assign(SY,$);return SY}var pr,JG,hE,s5,hY,SY;var gY=m(()=>{JG=Object.freeze({status:"aborted"});hE=Symbol("zod_brand");s5=class s5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};hY=class hY extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(pr=globalThis).__zod_globalConfig??(pr.__zod_globalConfig={});SY=globalThis.__zod_globalConfig});var x0={};V8(x0,{unwrapMessage:()=>KG,uint8ArrayToHex:()=>tx0,uint8ArrayToBase64url:()=>sx0,uint8ArrayToBase64:()=>or,stringifyPrimitive:()=>h0,slugify:()=>kE,shallowClone:()=>fE,safeExtend:()=>dx0,required:()=>lx0,randomString:()=>xx0,propertyKeyTypes:()=>HG,promiseAllObject:()=>kx0,primitiveTypes:()=>uE,prefixIssues:()=>p8,pick:()=>ix0,partial:()=>mx0,parsedType:()=>y0,optionalKeys:()=>bE,omit:()=>cx0,objectClone:()=>hx0,numKeys:()=>fx0,nullish:()=>F7,normalizeParams:()=>f0,mergeDefs:()=>a9,merge:()=>px0,jsonStringifyReplacer:()=>tI,joinValues:()=>O0,issue:()=>$Q,isPlainObject:()=>M7,isObject:()=>yY,hexToUint8Array:()=>ax0,getSizableOrigin:()=>WG,getParsedType:()=>ux0,getLengthableOrigin:()=>XG,getEnumValues:()=>zG,getElementAtPath:()=>yx0,floatSafeRemainder:()=>yE,finalizeIssue:()=>_8,extend:()=>nx0,explicitlyAborted:()=>nE,escapeRegex:()=>v$,esc:()=>ZV,defineLazy:()=>j1,createTransparentProxy:()=>bx0,cloneDef:()=>gx0,clone:()=>R8,cleanRegex:()=>GG,cleanEnum:()=>ox0,captureStackTrace:()=>qV,cached:()=>eI,base64urlToUint8Array:()=>rx0,base64ToUint8Array:()=>lr,assignProp:()=>w7,assertNotEqual:()=>Rx0,assertNever:()=>vx0,assertIs:()=>_x0,assertEqual:()=>Cx0,assert:()=>Sx0,allowsEval:()=>xE,aborted:()=>O7,NUMBER_FORMAT_RANGES:()=>iE,Class:()=>rrLine truncated
`)}var sr=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,tI,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},ZG,m8;var mE=m(()=>{gY();$1();ZG=H0("$ZodError",sr),m8=H0("$ZodError",sr,{Parent:Error})});var YQ=($)=>(Y,U,I,Q)=>{let J=I?{...I,async:!1}:{async:!1},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)throw new s5;if(K.issues.length){let z=new(Q?.Err??$)(K.issues.map((G)=>_8(G,J,t4())));throw qV(z,Q?.callee),z}return K.value},VV,UQ=($)=>async(Y,U,I,Q)=>{let J=I?{...I,async:!0}:{async:!0},K=Y._zod.run({value:U,issues:[]},J);if(K instanceof Promise)K=await K;if(K.issues.length){let z=new(Q?.Err??$)(K.issues.map((G)=>_8(G,J,t4())));throw qV(z,Q?.callee),z}return K.value},LV,IQ=($)=>(Y,U,I)=>{let Q=I?{...I,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)throw new s5;return J.issues.length?{success:!1,error:new($??ZG)(J.issues.map((K)=>_8(K,Q,t4())))}:{success:!0,data:J.value}},lE,QQ=($)=>async(Y,U,I)=>{let Q=I?{...I,async:!0}:{async:!0},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)J=await J;return J.issues.length?{success:!1,error:new $(J.issues.map((K)=>_8(K,Q,t4())))}:{success:!0,data:J.value}},oE,FV=($)=>(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return YQ($)(Y,U,Q)},$f0,wV=($)=>(Y,U,I)=>{return YQ($)(Y,U,I)},Yf0,MV=($)=>async(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return UQ($)(Y,U,Q)},Uf0,OV=($)=>async(Y,U,I)=>{return UQ($)(Y,U,I)},If0,NV=($)=>(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return IQ($)(Y,U,Q)},Qf0,DV=($)=>(Y,U,I)=>{return IQ($)(Y,U,I)},Jf0,BV=($)=>async(Y,U,I)=>{let Q=I?{...I,direction:"backward"}:{direction:"backward"};return QQ($)(Y,U,Q)},Kf0,AV=($)=>async(Y,U,I)=>{return QQ($)(Y,U,I)},zf0;var rE=m(()=>{gY();mE();$1();VV=YQ(m8),LV=UQ(m8),lE=IQ(m8),oE=QQ(m8),$f0=FV(m8),Yf0=wV(m8),Uf0=MV(m8),If0=OV(m8),Qf0=NV(m8),Jf0=DV(m8),Kf0=BV(m8),zf0=AV(m8)});var W$={};V8(W$,{xid:()=>eE,uuid7:()=>Xf0,uuid6:()=>Wf0,uuid4:()=>Hf0,uuid:()=>kY,uppercase:()=>Pj,unicodeEmail:()=>tr,undefined:()=>Bj,ulid:()=>tE,time:()=>Lj,string:()=>wj,sha512_hex:()=>Sf0,sha512_base64url:()=>gf0,sha512_base64:()=>hf0,sha384_hex:()=>Rf0,sha384_base64url:()=>vf0,sha384_base64:()=>_f0,sha256_hex:()=>Ef0,sha256_base64url:()=>Cf0,sha256_base64:()=>jf0,sha1_hex:()=>Af0,sha1_base64url:()=>Tf0,sha1_base64:()=>Pf0,rfc5322Email:()=>qf0,number:()=>LG,null:()=>Dj,nanoid:()=>Yj,md5_hex:()=>Nf0,md5_base64url:()=>Bf0,md5_base64:()=>Df0,mac:()=>Gj,lowercase:()=>Aj,ksuid:()=>$j,ipv6:()=>zj,ipv4:()=>Kj,integer:()=>Oj,idnEmail:()=>Vf0,httpProtocol:()=>Zj,html5Email:()=>Zf0,hostname:()=>wf0,hex:()=>Of0,guid:()=>Ij,extendedDuration:()=>Gf0,emoji:()=>Jj,email:()=>Qj,e164:()=>qj,duration:()=>Uj,domain:()=>Mf0,datetime:()=>Fj,date:()=>Vj,cuid2:()=>aE,cuid:()=>sE,cidrv6:()=>Wj,cidrv4:()=>Hj,browserEmail:()=>Lf0,boolean:()=>Nj,bigint:()=>Mj,base64url:()=>PV,base64:()=>Xj});function Jj(){return new RegExp(Ff0,"u")}function $s($){return typeof $.precision==="number"?$.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":$.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${$.precision}}`:"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Lj($){return new RegExp(`^${$s($)}$`)}function Fj($){let Y=$s({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let I=`${Y}(?:${U.join("|")})`;return new RegExp(`^${er}T(?:${I})$`)}function FG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function wG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var sE,aE,tE,eE,$j,Yj,Uj,Gf0,Ij,kY=($)=>{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})$`)},Hf0,Wf0,Xf0,Qj,Zf0,qf0,tr,Vf0,Lf0,Ff0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Kj,zj,Gj=($)=>{let Y=v$($??":");return new RegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},Hj,Wj,Xj,PV,wf0,Mf0,Zj,qj,er="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Vj,wj=($)=>{let Y=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)},Mj,Oj,LG,Nj,Dj,Bj,Aj,Pj,Of0,Nf0,Df0,Bf0,Af0,Pf0,Tf0,Ef0,jf0,Cf0,Rf0,_f0,vf0,Sf0,hf0,gf0;var TV=m(()=>{$1();sE=/^[cC][0-9a-z]{6,}$/,aE=/^[0-9a-z]+$/,tE=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,eE=/^[0-9a-vA-V]{20}$/,$j=/^[A-Za-z0-9]{27}$/,Yj=/^[a-zA-Z0-9_-]{21}$/,Uj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
`).filter((J)=>J),I=Math.min(...U.map((J)=>J.length-J.trimStart().length)),Q=U.map((J)=>J.slice(I)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Q)this.content.push(J)}compile(){let $=Function,Y=this?.args,I=[...(this?.content??[""]).map((Q)=>` ${Q}`)];return new $(...Y,I.join(`
`))}}var uj;var bj=m(()=>{uj={major:4,minor:4,patch:3}});function GC($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Zs($){if(!DV.test($))return!1;let Y=$.replace(/[-_]/g,(I)=>I==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return GC(U)}function qs($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[I]=U;if(!I)return!1;let Q=JSON.parse(atob(I));if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(Y&&(!("alg"in Q)||Q.alg!==Y))return!1;return!0}catch{return!1}}function tr($,Y,U){if($.issues.length)Y.issues.push(...d8(U,$.issues));Y.value[U]=$.value}function _V($,Y,U,I,Q,J){let K=U in I;if($.issues.length){if(Q&&J&&!K)return;Y.issues.push(...d8(U,$.issues))}if(!K&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(K)Y.value[U]=void 0}else Y.value[U]=$.value}function Vs($){let Y=Object.keys($.shape);for(let I of Y)if(!$.shape?.[I]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${I}": expected a Zod schema`);let U=kE($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function Ls($,Y,U,I,Q,J){let K=[],z=Q.keySet,G=Q.catchall._zod,H=G.def.type,W=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(z.has(Z))continue;if(H==="never"){K.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},I);if(q instanceof Promise)$.push(q.then((V)=>_V(V,U,Z,Y,W,X)));else _V(q,U,Z,Y,W,X)}if(K.length)U.issues.push({code:"unrecognized_keys",keys:K,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function er($,Y,U,I){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!w7(J));if(Q.length===1)return Y.value=Q[0].value,Q[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>R8(K,I,a4())))}),Y}function $s($,Y,U,I){let Q=$.filter((J)=>J.issues.length===0);if(Q.length===1)return Y.value=Q[0].value,Y;if(Q.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>R8(K,I,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function ij($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(F7($)&&F7(Y)){let U=Object.keys(Y),I=Object.keys($).filter((J)=>U.indexOf(J)!==-1),Q={...$,...Y};for(let J of I){let K=ij($[J],Y[J]);if(!K.valid)return{valid:!1,mergeErrorPath:[J,...K.mergeErrorPath]};Q[J]=K.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let I=0;I<$.length;I++){let Q=$[I],J=Y[I],K=ij(Q,J);if(!K.valid)return{valid:!1,mergeErrorPath:[I,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Ys($,Y,U){let I=new Map,Q;for(let z of Y.issues)if(z.code==="unrecognized_keys"){Q??(Q=z);for(let G of z.keys){if(!I.has(G))I.set(G,{});I.get(G).l=!0}}else $.issues.push(z);for(let z of U.issues)if(z.code==="unrecognized_keys")for(let G of z.keys){if(!I.has(G))I.set(G,{});I.get(G).r=!0}else $.issues.push(z);let J=[...I].filter(([,z])=>z.l&&z.r).map(([z])=>z);if(J.length&&Q)$.issues.push({...Q,keys:J});if(w7($))return $;let K=ij(Y.value,U.value);if(!K.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}function Us($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function Is($,Y,U){if($.issues.length)Y.issues.push(...d8(U,$.issues));Y.value[U]=$.value}function Qs($,Y,U,I,Q){for(let J=0;J<U.length;J++){let K=$[J],z=J<I.length;if(K.issues.length){if(!z&&J>=Q){Y.value.length=J;break}Y.issues.push(...d8(J,K.issues))}Y.value[J]=K.value}for(let J=Y.value.length-1;J>=I.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function Js($,Y,U,I,Q,J,K){if($.issues.length)if(JG.has(typeof I))U.issues.push(...d8(I,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((z)=>R8(z,K,a4()))});if(Y.issues.length)if(JG.has(typeof I))U.issues.push(...d8(I,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:I,issues:Y.issues.map((z)=>R8(z,K,a4()))});U.value.set($.value,Y.value)}function Ks($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function zs($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Gs($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Hs($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function jV($,Y,U){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa Line truncated
`))}}var nj;var dj=m(()=>{nj={major:4,minor:4,patch:3}});function ZC($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function Ms($){if(!PV.test($))return!1;let Y=$.replace(/[-_]/g,(I)=>I==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return ZC(U)}function Os($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[I]=U;if(!I)return!1;let Q=JSON.parse(atob(I));if("typ"in Q&&Q?.typ!=="JWT")return!1;if(!Q.alg)return!1;if(Y&&(!("alg"in Q)||Q.alg!==Y))return!1;return!0}catch{return!1}}function Qs($,Y,U){if($.issues.length)Y.issues.push(...p8(U,$.issues));Y.value[U]=$.value}function hV($,Y,U,I,Q,J){let K=U in I;if($.issues.length){if(Q&&J&&!K)return;Y.issues.push(...p8(U,$.issues))}if(!K&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(K)Y.value[U]=void 0}else Y.value[U]=$.value}function Ns($){let Y=Object.keys($.shape);for(let I of Y)if(!$.shape?.[I]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${I}": expected a Zod schema`);let U=bE($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function Ds($,Y,U,I,Q,J){let K=[],z=Q.keySet,G=Q.catchall._zod,H=G.def.type,W=G.optin==="optional",X=G.optout==="optional";for(let Z in Y){if(Z==="__proto__")continue;if(z.has(Z))continue;if(H==="never"){K.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},I);if(q instanceof Promise)$.push(q.then((V)=>hV(V,U,Z,Y,W,X)));else hV(q,U,Z,Y,W,X)}if(K.length)U.issues.push({code:"unrecognized_keys",keys:K,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function Js($,Y,U,I){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!O7(J));if(Q.length===1)return Y.value=Q[0].value,Q[0];return Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>_8(K,I,t4())))}),Y}function Ks($,Y,U,I){let Q=$.filter((J)=>J.issues.length===0);if(Q.length===1)return Y.value=Q[0].value,Y;if(Q.length===0)Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:$.map((J)=>J.issues.map((K)=>_8(K,I,t4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function pj($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(M7($)&&M7(Y)){let U=Object.keys(Y),I=Object.keys($).filter((J)=>U.indexOf(J)!==-1),Q={...$,...Y};for(let J of I){let K=pj($[J],Y[J]);if(!K.valid)return{valid:!1,mergeErrorPath:[J,...K.mergeErrorPath]};Q[J]=K.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let I=0;I<$.length;I++){let Q=$[I],J=Y[I],K=pj(Q,J);if(!K.valid)return{valid:!1,mergeErrorPath:[I,...K.mergeErrorPath]};U.push(K.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function zs($,Y,U){let I=new Map,Q;for(let z of Y.issues)if(z.code==="unrecognized_keys"){Q??(Q=z);for(let G of z.keys){if(!I.has(G))I.set(G,{});I.get(G).l=!0}}else $.issues.push(z);for(let z of U.issues)if(z.code==="unrecognized_keys")for(let G of z.keys){if(!I.has(G))I.set(G,{});I.get(G).r=!0}else $.issues.push(z);let J=[...I].filter(([,z])=>z.l&&z.r).map(([z])=>z);if(J.length&&Q)$.issues.push({...Q,keys:J});if(O7($))return $;let K=pj(Y.value,U.value);if(!K.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(K.mergeErrorPath)}`);return $.value=K.data,$}function Gs($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function Hs($,Y,U){if($.issues.length)Y.issues.push(...p8(U,$.issues));Y.value[U]=$.value}function Ws($,Y,U,I,Q){for(let J=0;J<U.length;J++){let K=$[J],z=J<I.length;if(K.issues.length){if(!z&&J>=Q){Y.value.length=J;break}Y.issues.push(...p8(J,K.issues))}Y.value[J]=K.value}for(let J=Y.value.length-1;J>=I.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function Xs($,Y,U,I,Q,J,K){if($.issues.length)if(HG.has(typeof I))U.issues.push(...p8(I,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((z)=>_8(z,K,t4()))});if(Y.issues.length)if(HG.has(typeof I))U.issues.push(...p8(I,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:I,issues:Y.issues.map((z)=>_8(z,K,t4()))});U.value.set($.value,Y.value)}function Zs($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function qs($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function Vs($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function Ls($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function _V($,Y,U){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa Line truncated
if (${D}.issues.length) {
if (${P} in input) {
payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
@@ -60,94 +60,94 @@ import{createRequire as Vx0}from"node:module";var Jx0=Object.create;var{getProto
newResult[${P}] = ${D}.value;
}
`)}q.write("payload.value = newResult;"),q.write("return payload;");let N=q.compile();return(O,D)=>N(Z,O,D)},J,K=_Y,z=!jY.jitless,H=z&&hE.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=I.value);let V=Z.value;if(!K(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(z&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!W)return Z;return Ls([],V,Z,q,X,$)}return U(Z,q)}});LG=H0("$ZodUnion",($,Y)=>{V1.init($,Y),j1($._zod,"optin",()=>Y.options.some((I)=>I._zod.optin==="optional")?"optional":void 0),j1($._zod,"optout",()=>Y.options.some((I)=>I._zod.optout==="optional")?"optional":void 0),j1($._zod,"values",()=>{if(Y.options.every((I)=>I._zod.values))return new Set(Y.options.flatMap((I)=>Array.from(I._zod.values)));return}),j1($._zod,"pattern",()=>{if(Y.options.every((I)=>I._zod.pattern)){let I=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${I.map((Q)=>QG(Q.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(I,Q)=>{if(U)return U(I,Q);let J=!1,K=[];for(let z of Y.options){let G=z._zod.run({value:I.value,issues:[]},Q);if(G instanceof Promise)K.push(G),J=!0;else{if(G.issues.length===0)return G;K.push(G)}}if(!J)return er(K,I,$,Q);return Promise.all(K).then((z)=>{return er(z,I,$,Q)})}});EC=H0("$ZodXor",($,Y)=>{LG.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(I,Q)=>{if(U)return U(I,Q);let J=!1,K=[];for(let z of Y.options){let G=z._zod.run({value:I.value,issues:[]},Q);if(G instanceof Promise)K.push(G),J=!0;else K.push(G)}if(!J)return $s(K,I,$,Q);return Promise.all(K).then((z)=>{return $s(z,I,$,Q)})}}),jC=H0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,LG.init($,Y);let U=$._zod.parse;j1($._zod,"propValues",()=>{let Q={};for(let J of Y.options){let K=J._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let[z,G]of Object.entries(K)){if(!Q[z])Q[z]=new Set;for(let H of G)Q[z].add(H)}}return Q});let I=rI(()=>{let Q=Y.options,J=new Map;for(let K of Q){let z=K._zod.propValues?.[Y.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(K)}"`);for(let G of z){if(J.has(G))throw Error(`Duplicate discriminator value "${String(G)}"`);J.set(G,K)}}return J});$._zod.parse=(Q,J)=>{let K=Q.value;if(!_Y(K))return Q.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),Q;let z=I.value.get(K?.[Y.discriminator]);if(z)return z._zod.run(Q,J);if(Y.unionFallback||J.direction==="backward")return U(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(I.value.keys()),input:K,path:[Y.discriminator],inst:$}),Q}}),CC=H0("$ZodIntersection",($,Y)=>{V1.init($,Y),$._zod.parse=(U,I)=>{let Q=U.value,J=Y.left._zod.run({value:Q,issues:[]},I),K=Y.right._zod.run({value:Q,issues:[]},I);if(J instanceof Promise||K instanceof Promise)return Promise.all([J,K]).then(([G,H])=>{return Ys(U,G,H)});return Ys(U,J,K)}});hV=H0("$ZodTuple",($,Y)=>{V1.init($,Y);let U=Y.items;$._zod.parse=(I,Q)=>{let J=I.value;if(!Array.isArray(J))return I.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),I;I.value=[];let K=[],z=Us(U,"optin"),G=Us(U,"optout");if(!Y.rest){if(J.length<z)return I.issues.push({code:"too_small",minimum:z,inclusive:!0,input:J,inst:$,origin:"array"}),I;if(J.length>U.length)I.issues.push({code:"too_big",maximum:U.length,inclusive:!0,input:J,inst:$,origin:"array"})}let H=Array(U.length);for(let W=0;W<U.length;W++){let X=U[W]._zod.run({value:J[W],issues:[]},Q);if(X instanceof Promise)K.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(Y.rest){let W=U.length-1,X=J.slice(U.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)K.push(q.then((V)=>Is(V,I,W)));else Is(q,I,W)}}if(K.length)return Promise.all(K).then(()=>Qs(H,I,U,J,G));return Qs(H,I,U,J,G)}});RC=H0("$ZodRecord",($,Y)=>{V1.init($,Y),$._zod.parse=(U,I)=>{let Q=U.value;if(!F7(Q))return U.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),U;let J=[],K=Y.keyType._zod.values;if(K){U.value={};let z=new Set;for(let H of K)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){z.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},I);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){U.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>R8(q,I,a4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:Q[H],issues:[]},I);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...d8(H,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...d8(H,Z.issues));U.value[X]=Z.value}}let G;for(let H in Q)if(!z.has(H))G=G??[],G.push(H);if(G&&G.length>0)U.issues.push({code:"unrec Line truncated
`)}q.write("payload.value = newResult;"),q.write("return payload;");let N=q.compile();return(O,D)=>N(Z,O,D)},J,K=yY,z=!SY.jitless,H=z&&xE.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=I.value);let V=Z.value;if(!K(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(z&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!W)return Z;return Ds([],V,Z,q,X,$)}return U(Z,q)}});OG=H0("$ZodUnion",($,Y)=>{V1.init($,Y),j1($._zod,"optin",()=>Y.options.some((I)=>I._zod.optin==="optional")?"optional":void 0),j1($._zod,"optout",()=>Y.options.some((I)=>I._zod.optout==="optional")?"optional":void 0),j1($._zod,"values",()=>{if(Y.options.every((I)=>I._zod.values))return new Set(Y.options.flatMap((I)=>Array.from(I._zod.values)));return}),j1($._zod,"pattern",()=>{if(Y.options.every((I)=>I._zod.pattern)){let I=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${I.map((Q)=>GG(Q.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(I,Q)=>{if(U)return U(I,Q);let J=!1,K=[];for(let z of Y.options){let G=z._zod.run({value:I.value,issues:[]},Q);if(G instanceof Promise)K.push(G),J=!0;else{if(G.issues.length===0)return G;K.push(G)}}if(!J)return Js(K,I,$,Q);return Promise.all(K).then((z)=>{return Js(z,I,$,Q)})}});_C=H0("$ZodXor",($,Y)=>{OG.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(I,Q)=>{if(U)return U(I,Q);let J=!1,K=[];for(let z of Y.options){let G=z._zod.run({value:I.value,issues:[]},Q);if(G instanceof Promise)K.push(G),J=!0;else K.push(G)}if(!J)return Ks(K,I,$,Q);return Promise.all(K).then((z)=>{return Ks(z,I,$,Q)})}}),vC=H0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,OG.init($,Y);let U=$._zod.parse;j1($._zod,"propValues",()=>{let Q={};for(let J of Y.options){let K=J._zod.propValues;if(!K||Object.keys(K).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let[z,G]of Object.entries(K)){if(!Q[z])Q[z]=new Set;for(let H of G)Q[z].add(H)}}return Q});let I=eI(()=>{let Q=Y.options,J=new Map;for(let K of Q){let z=K._zod.propValues?.[Y.discriminator];if(!z||z.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(K)}"`);for(let G of z){if(J.has(G))throw Error(`Duplicate discriminator value "${String(G)}"`);J.set(G,K)}}return J});$._zod.parse=(Q,J)=>{let K=Q.value;if(!yY(K))return Q.issues.push({code:"invalid_type",expected:"object",input:K,inst:$}),Q;let z=I.value.get(K?.[Y.discriminator]);if(z)return z._zod.run(Q,J);if(Y.unionFallback||J.direction==="backward")return U(Q,J);return Q.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:Y.discriminator,options:Array.from(I.value.keys()),input:K,path:[Y.discriminator],inst:$}),Q}}),SC=H0("$ZodIntersection",($,Y)=>{V1.init($,Y),$._zod.parse=(U,I)=>{let Q=U.value,J=Y.left._zod.run({value:Q,issues:[]},I),K=Y.right._zod.run({value:Q,issues:[]},I);if(J instanceof Promise||K instanceof Promise)return Promise.all([J,K]).then(([G,H])=>{return zs(U,G,H)});return zs(U,J,K)}});kV=H0("$ZodTuple",($,Y)=>{V1.init($,Y);let U=Y.items;$._zod.parse=(I,Q)=>{let J=I.value;if(!Array.isArray(J))return I.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),I;I.value=[];let K=[],z=Gs(U,"optin"),G=Gs(U,"optout");if(!Y.rest){if(J.length<z)return I.issues.push({code:"too_small",minimum:z,inclusive:!0,input:J,inst:$,origin:"array"}),I;if(J.length>U.length)I.issues.push({code:"too_big",maximum:U.length,inclusive:!0,input:J,inst:$,origin:"array"})}let H=Array(U.length);for(let W=0;W<U.length;W++){let X=U[W]._zod.run({value:J[W],issues:[]},Q);if(X instanceof Promise)K.push(X.then((Z)=>{H[W]=Z}));else H[W]=X}if(Y.rest){let W=U.length-1,X=J.slice(U.length);for(let Z of X){W++;let q=Y.rest._zod.run({value:Z,issues:[]},Q);if(q instanceof Promise)K.push(q.then((V)=>Hs(V,I,W)));else Hs(q,I,W)}}if(K.length)return Promise.all(K).then(()=>Ws(H,I,U,J,G));return Ws(H,I,U,J,G)}});hC=H0("$ZodRecord",($,Y)=>{V1.init($,Y),$._zod.parse=(U,I)=>{let Q=U.value;if(!M7(Q))return U.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),U;let J=[],K=Y.keyType._zod.values;if(K){U.value={};let z=new Set;for(let H of K)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){z.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},I);if(W instanceof Promise)throw Error("Async schemas not supported in object keys currently");if(W.issues.length){U.issues.push({code:"invalid_key",origin:"record",issues:W.issues.map((q)=>_8(q,I,t4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:Q[H],issues:[]},I);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...p8(H,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...p8(H,Z.issues));U.value[X]=Z.value}}let G;for(let H in Q)if(!z.has(H))G=G??[],G.push(H);if(G&&G.length>0)U.issues.push({code:"unrec Line truncated
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let K of $.seen.entries()){let z=K[1];if(Y===K[0]){J(K);continue}if($.external){let H=$.external.registry.get(K[0])?.id;if(Y!==K[0]&&H){J(K);continue}}if($.metadataRegistry.get(K[0])?.id){J(K);continue}if(z.cycle){J(K);continue}if(z.count>1){if($.reused==="ref"){J(K);continue}}}}function B7($,Y){let U=$.seen.get(Y);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let I=(z)=>{let G=$.seen.get(z);if(G.ref===null)return;let H=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){I(X);let q=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(V);else Object.assign(H,V);if(Object.assign(H,W),z._zod.parent===X)for(let M in H){if(M==="$ref"||M==="allOf")continue;if(!(M in W))delete H[M]}if(V.$ref&&q.def)for(let M in H){if(M==="$ref"||M==="allOf")continue;if(M in q.def&&JSON.stringify(H[M])===JSON.stringify(q.def[M]))delete H[M]}}let Z=z._zod.parent;if(Z&&Z!==X){I(Z);let q=$.seen.get(Z);if(q?.schema.$ref){if(H.$ref=q.schema.$ref,q.def)for(let V in H){if(V==="$ref"||V==="allOf")continue;if(V in q.def&&JSON.stringify(H[V])===JSON.stringify(q.def[V]))delete H[V]}}}$.override({zodSchema:z,jsonSchema:H,path:G.path??[]})};for(let z of[...$.seen.entries()].reverse())I(z[0]);let Q={};if($.target==="draft-2020-12")Q.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")Q.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")Q.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let z=$.external.registry.get(Y)?.id;if(!z)throw Error("Schema is missing an `id` property");Q.$id=$.external.uri(z)}Object.assign(Q,U.def??U.schema);let J=$.metadataRegistry.get(Y)?.id;if(J!==void 0&&Q.id===J)delete Q.id;let K=$.external?.defs??{};for(let z of $.seen.entries()){let G=z[1];if(G.def&&G.defId){if(G.def.id===G.defId)delete G.def.id;K[G.defId]=G.def}}if($.external);else if(Object.keys(K).length>0)if($.target==="draft-2020-12")Q.$defs=K;else Q.definitions=K;try{let z=JSON.parse(JSON.stringify(Q));return Object.defineProperty(z,"~standard",{value:{...Y["~standard"],jsonSchema:{input:FQ(Y,"input",$.processors),output:FQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),z}catch(z){throw Error("Error converting schema to JSON.")}}function v8($,Y){let U=Y??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let I=$._zod.def;if(I.type==="transform")return!0;if(I.type==="array")return v8(I.element,U);if(I.type==="set")return v8(I.valueType,U);if(I.type==="lazy")return v8(I.getter(),U);if(I.type==="promise"||I.type==="optional"||I.type==="nonoptional"||I.type==="nullable"||I.type==="readonly"||I.type==="default"||I.type==="prefault")return v8(I.innerType,U);if(I.type==="intersection")return v8(I.left,U)||v8(I.right,U);if(I.type==="record"||I.type==="map")return v8(I.keyType,U)||v8(I.valueType,U);if(I.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return v8(I.in,U)||v8(I.out,U)}if(I.type==="object"){for(let Q in I.shape)if(v8(I.shape[Q],U))return!0;return!1}if(I.type==="union"){for(let Q of I.options)if(v8(Q,U))return!0;return!1}if(I.type==="tuple"){for(let Q of I.items)if(v8(Q,U))return!0;if(I.rest&&v8(I.rest,U))return!0;return!1}return!1}var u_=($,Y={})=>(U)=>{let I=N7({...U,processors:Y});return G4($,I),D7(I,$),B7(I,$)},FQ=($,Y,U={})=>(I)=>{let{libraryOptions:Q,target:J}=I??{},K=N7({...Q??{},target:J,io:Y,processors:U});return G4($,K),D7(K,$),B7(K,$)};var TG=m(()=>{BG()});function kY($,Y){if("_idmap"in $){let I=$,Q=N7({...Y,processors:GL}),J={};for(let G of I._idmap.entries()){let[H,W]=G;G4(W,Q)}let K={},z={registry:I,uri:Y?.uri,defs:J};Q.external=z;for(let G of I._idmap.entries()){let[H,W]=G;D7(Q,W),K[H]=B7(Q,W)}if(Object.keys(J).length>0){let G=Q.target==="draft-2020-12"?"$defs":"definitions";K.__shared={[G]:J}}return{schemas:K}}let U=N7({...Y,processors:GL});return G4($,U),D7(U,$),B7(U,$)}var tu0,b_=($,Y,U,I)=>{let Q=U;Q.type="string";let{minimum:J,maximum:K,format:z,patterns:G,contentEncoding:H}=$._zod.bag;if(typeof J==="number")Q.minLength=J;if(typeof K==="number")Q.maxLength=K;if(z){if(Q.format=tu0[z]??z,Q.format==="")delete Q.format;if(z==="time")delete Q.format}if(H)Q.contentEncoding=H;if(G&&G.size>0){let W=[...G];if(W.length===1)Q.pattern=W[0].source;else if(W.length>1)Q.allOf=[...W.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},i_=($,Y,U,I)=>{let Q=U,{minimum:J,maximum:K,format:z,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeof z==="string"&&z.includes("int"))Q.type="integer";else Q.type="number";let X=typeof W==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeof H==="number"&&H<=(K??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)Q.minimum=W,Q.exclusiveMinimum=!0;else Q.exclusiveMinimuLine truncated
`}function Si0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${$.length})`]};if($.includes(" "))Y.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))Y.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))Y.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))Y.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!vi0.test($)){let U=[...$].filter((I)=>!/[A-Za-z0-9._-]/.test(I)).filter((I,Q,J)=>J.indexOf(I)===Q);return Y.push(`Tool name contains invalid characters: ${U.map((I)=>`"${I}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function hi0($,Y){if(Y.length>0){console.warn(`Tool name validation warning for "${$}":`);for(let U of Y)console.warn(` - ${U}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function kh($){let Y=Si0($);return hi0($,Y.warnings),Y.isValid}function gi0($){return typeof $==="object"&&$!==null&&"_zod"in $}function yi0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function ki0($){if(typeof $!=="object"||$===null)return!1;if(uQ($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((U)=>gi0(U))}function ow($){if($===void 0)return;if(ki0($))return U0($);if(typeof $==="object"&&$!==null&&!uQ($)&&Object.values($).some((Y)=>yi0(Y)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!uQ($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var Wh,Vb0,T1,L1,Lb0,He="2026-07-28",y7,Ze,Mb0,Ob0,Nb0,Le,Fe,Bb0,Sw,si1,ai1,at,Mh,Cb0,Rb0,xQ,i0,Q1,iw,Oe,iQ,cw,Sb0=0,hb0="private",gb0,cb0,gw,Bh,Be,ti1,ei1,ob0,rb0,Ah,yw,NH="2026-07-28",Te,tb0,v$=($)=>mG.safeParse($).success,k7=($)=>lG.safeParse($).success,MH=($)=>EQ.safeParse($).success,mw=($)=>jQ.safeParse($).success,Q3=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Ue="x-mcp-header",eb0,$i0,Yi0,Ui0,fw=-32020,$c1,Ii0,Ie=!1,Zh="draft-2020-12",Ki0,Xi0,Zi0,Qe,qi0,Oi0,Ce=250,Ni0,Di0,Se,he,Bi0,Ai0,ye=60000,Ti0,Ei0,ji0,ke,Sh,_i0,Yc1,xe=10485760,gh=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??xe}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){while(this._buffer){let $=this._buffer.indexOf(`
`);if($===-1)return null;let Y=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return fe(Y)}catch(U){if(U instanceof SyntaxError)continue;throw U}}return null}clear(){this._buffer=void 0}},vi0;var rw=m(()=>{jE();CE();ot();RS();Wh=Symbol.for("mcp.sdk.errorBrands");Vb0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return fQ(this,Y)}static isInstance(Y){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return fQ(this,Y)}constructor(Y,U,I){super(U);this.code=Y,this.errorUri=I,this.name="OAuthError",Vh(this,new.target)}toResponseObject(){let Y={error:this.code,error_description:this.message};if(this.errorUri)Y.error_uri=this.errorUri;return Y}static fromResponse(Y){return new $(Y.error,Y.error_description??Y.error,Y.error_uri)}},T1=function($){return $.NotConnected="NOT_CONNECTED",$.AlreadyConnected="ALREADY_CONNECTED",$.NotInitialized="NOT_INITIALIZED",$.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",$.RequestTimeout="REQUEST_TIMEOUT",$.ConnectionClosed="CONNECTION_CLOSED",$.SendFailed="SEND_FAILED",$.InvalidResult="INVALID_RESULT",$.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",$.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",$.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",$.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",$.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",$.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",$.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",$.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",$.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",$.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",$.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",$}({}),L1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return fQ(this,$)}static isInstance($){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return fQ(this,$)}constructor($,Y,U){super(Y);this.code=$,this.data=U,this.name="SdkError",Vh(this,new.target)}},Lb0=class extends L1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,U){super($,Y,U);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};y7=[He];Ze=["task","inputRequests","requestState"];Ob0=new Set(["const","enum","default","examples"]),Nb0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);Le={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Fe={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Bb0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};si1=Object.keys(Le),ai1=Object.keys(Fe);at={ok:!1,reason:"not-in-era"};Mh={era:"2025-11-25",hasRequestMethod:we,hasNotificationMethod:Me,validateRequest:($,Y)=>hw(Tb0($),Y),validateResult:($,Y)=>hw(Pb0($),Y),validateNotification:($,Y)=>hw(Eb0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>at,validateInputResponse:()=>at,samplingResultVariant:($,Y)=>{let U=qe();return hw($?U.CreateMessageResultWithToolsSchema:U.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let U=Xe($),I=U.structuredContent;if(I===void 0)return U;let Q=typeof I!=="object"||I===null||Array.isArray(I),J=Y!==void 0&&Ve(Y);if(!Q&&!J)return U;return{...U,structuredContent:{result:I}}},decodeResult($,Y){if(Xh(Y)&&"resultType"in Y){let U={...Y};return delete U.resultType,{kind:"complete",result:et(U)}}return{kind:"complete",result:et(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l Line truncated
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let K of $.seen.entries()){let z=K[1];if(Y===K[0]){J(K);continue}if($.external){let H=$.external.registry.get(K[0])?.id;if(Y!==K[0]&&H){J(K);continue}}if($.metadataRegistry.get(K[0])?.id){J(K);continue}if(z.cycle){J(K);continue}if(z.count>1){if($.reused==="ref"){J(K);continue}}}}function P7($,Y){let U=$.seen.get(Y);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let I=(z)=>{let G=$.seen.get(z);if(G.ref===null)return;let H=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){I(X);let q=$.seen.get(X),V=q.schema;if(V.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))H.allOf=H.allOf??[],H.allOf.push(V);else Object.assign(H,V);if(Object.assign(H,W),z._zod.parent===X)for(let M in H){if(M==="$ref"||M==="allOf")continue;if(!(M in W))delete H[M]}if(V.$ref&&q.def)for(let M in H){if(M==="$ref"||M==="allOf")continue;if(M in q.def&&JSON.stringify(H[M])===JSON.stringify(q.def[M]))delete H[M]}}let Z=z._zod.parent;if(Z&&Z!==X){I(Z);let q=$.seen.get(Z);if(q?.schema.$ref){if(H.$ref=q.schema.$ref,q.def)for(let V in H){if(V==="$ref"||V==="allOf")continue;if(V in q.def&&JSON.stringify(H[V])===JSON.stringify(q.def[V]))delete H[V]}}}$.override({zodSchema:z,jsonSchema:H,path:G.path??[]})};for(let z of[...$.seen.entries()].reverse())I(z[0]);let Q={};if($.target==="draft-2020-12")Q.$schema="https://json-schema.org/draft/2020-12/schema";else if($.target==="draft-07")Q.$schema="http://json-schema.org/draft-07/schema#";else if($.target==="draft-04")Q.$schema="http://json-schema.org/draft-04/schema#";else if($.target==="openapi-3.0");if($.external?.uri){let z=$.external.registry.get(Y)?.id;if(!z)throw Error("Schema is missing an `id` property");Q.$id=$.external.uri(z)}Object.assign(Q,U.def??U.schema);let J=$.metadataRegistry.get(Y)?.id;if(J!==void 0&&Q.id===J)delete Q.id;let K=$.external?.defs??{};for(let z of $.seen.entries()){let G=z[1];if(G.def&&G.defId){if(G.def.id===G.defId)delete G.def.id;K[G.defId]=G.def}}if($.external);else if(Object.keys(K).length>0)if($.target==="draft-2020-12")Q.$defs=K;else Q.definitions=K;try{let z=JSON.parse(JSON.stringify(Q));return Object.defineProperty(z,"~standard",{value:{...Y["~standard"],jsonSchema:{input:NQ(Y,"input",$.processors),output:NQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),z}catch(z){throw Error("Error converting schema to JSON.")}}function S8($,Y){let U=Y??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let I=$._zod.def;if(I.type==="transform")return!0;if(I.type==="array")return S8(I.element,U);if(I.type==="set")return S8(I.valueType,U);if(I.type==="lazy")return S8(I.getter(),U);if(I.type==="promise"||I.type==="optional"||I.type==="nonoptional"||I.type==="nullable"||I.type==="readonly"||I.type==="default"||I.type==="prefault")return S8(I.innerType,U);if(I.type==="intersection")return S8(I.left,U)||S8(I.right,U);if(I.type==="record"||I.type==="map")return S8(I.keyType,U)||S8(I.valueType,U);if(I.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return S8(I.in,U)||S8(I.out,U)}if(I.type==="object"){for(let Q in I.shape)if(S8(I.shape[Q],U))return!0;return!1}if(I.type==="union"){for(let Q of I.options)if(S8(Q,U))return!0;return!1}if(I.type==="tuple"){for(let Q of I.items)if(S8(Q,U))return!0;if(I.rest&&S8(I.rest,U))return!0;return!1}return!1}var n_=($,Y={})=>(U)=>{let I=B7({...U,processors:Y});return G4($,I),A7(I,$),P7(I,$)},NQ=($,Y,U={})=>(I)=>{let{libraryOptions:Q,target:J}=I??{},K=B7({...Q??{},target:J,io:Y,processors:U});return G4($,K),A7(K,$),P7(K,$)};var RG=m(()=>{EG()});function iY($,Y){if("_idmap"in $){let I=$,Q=B7({...Y,processors:XL}),J={};for(let G of I._idmap.entries()){let[H,W]=G;G4(W,Q)}let K={},z={registry:I,uri:Y?.uri,defs:J};Q.external=z;for(let G of I._idmap.entries()){let[H,W]=G;A7(Q,W),K[H]=P7(Q,W)}if(Object.keys(J).length>0){let G=Q.target==="draft-2020-12"?"$defs":"definitions";K.__shared={[G]:J}}return{schemas:K}}let U=B7({...Y,processors:XL});return G4($,U),A7(U,$),P7(U,$)}var Ub0,d_=($,Y,U,I)=>{let Q=U;Q.type="string";let{minimum:J,maximum:K,format:z,patterns:G,contentEncoding:H}=$._zod.bag;if(typeof J==="number")Q.minLength=J;if(typeof K==="number")Q.maxLength=K;if(z){if(Q.format=Ub0[z]??z,Q.format==="")delete Q.format;if(z==="time")delete Q.format}if(H)Q.contentEncoding=H;if(G&&G.size>0){let W=[...G];if(W.length===1)Q.pattern=W[0].source;else if(W.length>1)Q.allOf=[...W.map((X)=>({...Y.target==="draft-07"||Y.target==="draft-04"||Y.target==="openapi-3.0"?{type:"string"}:{},pattern:X.source}))]}},p_=($,Y,U,I)=>{let Q=U,{minimum:J,maximum:K,format:z,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeof z==="string"&&z.includes("int"))Q.type="integer";else Q.type="number";let X=typeof W==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeof H==="number"&&H<=(K??Number.POSITIVE_INFINITY),q=Y.target==="draft-04"||Y.target==="openapi-3.0";if(X)if(q)Q.minimum=W,Q.exclusiveMinimum=!0;else Q.exclusiveMinimuLine truncated
`}function ki0($){let Y=[];if($.length===0)return{isValid:!1,warnings:["Tool name cannot be empty"]};if($.length>128)return{isValid:!1,warnings:[`Tool name exceeds maximum length of 128 characters (current: ${$.length})`]};if($.includes(" "))Y.push("Tool name contains spaces, which may cause parsing issues");if($.includes(","))Y.push("Tool name contains commas, which may cause parsing issues");if($.startsWith("-")||$.endsWith("-"))Y.push("Tool name starts or ends with a dash, which may cause parsing issues in some contexts");if($.startsWith(".")||$.endsWith("."))Y.push("Tool name starts or ends with a dot, which may cause parsing issues in some contexts");if(!yi0.test($)){let U=[...$].filter((I)=>!/[A-Za-z0-9._-]/.test(I)).filter((I,Q,J)=>J.indexOf(I)===Q);return Y.push(`Tool name contains invalid characters: ${U.map((I)=>`"${I}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function xi0($,Y){if(Y.length>0){console.warn(`Tool name validation warning for "${$}":`);for(let U of Y)console.warn(` - ${U}`);console.warn("Tool registration will proceed, but this may cause compatibility issues."),console.warn("Consider updating the tool name to conform to the MCP tool naming standard."),console.warn("See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.")}}function bh($){let Y=ki0($);return xi0($,Y.warnings),Y.isValid}function fi0($){return typeof $==="object"&&$!==null&&"_zod"in $}function ui0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function bi0($){if(typeof $!=="object"||$===null)return!1;if(nQ($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((U)=>fi0(U))}function aw($){if($===void 0)return;if(bi0($))return U0($);if(typeof $==="object"&&$!==null&&!nQ($)&&Object.values($).some((Y)=>ui0(Y)))throw TypeError("Raw-shape inputSchema/outputSchema/argsSchema fields must be Zod v4 schemas. Got a Zod v3 field schema. Import from `zod/v4` (or upgrade your zod import), or wrap with `z.object({...})` yourself.");if(!nQ($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var Vh,Mb0,T1,L1,Ob0,Le="2026-07-28",x7,Me,Bb0,Ab0,Pb0,De,Be,Eb0,yw,Uc1,Ic1,Ie,Bh,Sb0,hb0,iQ,i0,Q1,dw,Te,pQ,pw,kb0=0,xb0="private",fb0,mb0,xw,Eh,Ce,Qc1,Jc1,tb0,eb0,jh,fw,PH="2026-07-28",ve,Ui0,S$=($)=>sG.safeParse($).success,f7=($)=>aG.safeParse($).success,BH=($)=>_Q.safeParse($).success,rw=($)=>vQ.safeParse($).success,J3=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",Ge="x-mcp-header",Ii0,Qi0,Ji0,Ki0,iw=-32020,Kc1,zi0,He=!1,Fh="draft-2020-12",Wi0,Li0,Fi0,We,wi0,Ai0,ge=250,Pi0,Ti0,fe,ue,Ei0,ji0,ie=60000,Ri0,_i0,vi0,ce,kh,gi0,zc1,ne=10485760,fh=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??ne}append($){if((this._buffer?.length??0)+$.length>this._maxBufferSize)throw this.clear(),Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`);this._buffer=this._buffer?Buffer.concat([this._buffer,$]):$}readMessage(){while(this._buffer){let $=this._buffer.indexOf(`
`);if($===-1)return null;let Y=this._buffer.toString("utf8",0,$).replace(/\r$/,"");this._buffer=this._buffer.subarray($+1);try{return de(Y)}catch(U){if(U instanceof SyntaxError)continue;throw U}}return null}clear(){this._buffer=void 0}},yi0;var tw=m(()=>{vE();SE();$e();hS();Vh=Symbol.for("mcp.sdk.errorBrands");Mb0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return cQ(this,Y)}static isInstance(Y){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return cQ(this,Y)}constructor(Y,U,I){super(U);this.code=Y,this.errorUri=I,this.name="OAuthError",Mh(this,new.target)}toResponseObject(){let Y={error:this.code,error_description:this.message};if(this.errorUri)Y.error_uri=this.errorUri;return Y}static fromResponse(Y){return new $(Y.error,Y.error_description??Y.error,Y.error_uri)}},T1=function($){return $.NotConnected="NOT_CONNECTED",$.AlreadyConnected="ALREADY_CONNECTED",$.NotInitialized="NOT_INITIALIZED",$.CapabilityNotSupported="CAPABILITY_NOT_SUPPORTED",$.RequestTimeout="REQUEST_TIMEOUT",$.ConnectionClosed="CONNECTION_CLOSED",$.SendFailed="SEND_FAILED",$.InvalidResult="INVALID_RESULT",$.UnsupportedResultType="UNSUPPORTED_RESULT_TYPE",$.InputRequiredRoundsExceeded="INPUT_REQUIRED_ROUNDS_EXCEEDED",$.ListPaginationExceeded="LIST_PAGINATION_EXCEEDED",$.MethodNotSupportedByProtocolVersion="METHOD_NOT_SUPPORTED_BY_PROTOCOL_VERSION",$.EraNegotiationFailed="ERA_NEGOTIATION_FAILED",$.ClientHttpNotImplemented="CLIENT_HTTP_NOT_IMPLEMENTED",$.ClientHttpAuthentication="CLIENT_HTTP_AUTHENTICATION",$.ClientHttpForbidden="CLIENT_HTTP_FORBIDDEN",$.ClientHttpUnexpectedContent="CLIENT_HTTP_UNEXPECTED_CONTENT",$.ClientHttpFailedToOpenStream="CLIENT_HTTP_FAILED_TO_OPEN_STREAM",$.ClientHttpFailedToTerminateSession="CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",$}({}),L1=class extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkError"})}static[Symbol.hasInstance]($){return cQ(this,$)}static isInstance($){if(typeof this!=="function")throw TypeError("isInstance must be called on the class (e.g. `SdkError.isInstance(value)`); for callbacks use `v => SdkError.isInstance(v)`");return cQ(this,$)}constructor($,Y,U){super(Y);this.code=$,this.data=U,this.name="SdkError",Mh(this,new.target)}},Ob0=class extends L1{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.SdkHttpError"})}constructor($,Y,U){super($,Y,U);this.name="SdkHttpError"}get status(){return this.data.status}get statusText(){return this.data.statusText}};x7=[Le];Me=["task","inputRequests","requestState"];Ab0=new Set(["const","enum","default","examples"]),Pb0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);De={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"tasks/get":null,"tasks/result":null,"tasks/list":null,"tasks/cancel":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null},Be={"notifications/cancelled":null,"notifications/progress":null,"notifications/initialized":null,"notifications/roots/list_changed":null,"notifications/tasks/status":null,"notifications/message":null,"notifications/resources/updated":null,"notifications/resources/list_changed":null,"notifications/tools/list_changed":null,"notifications/prompts/list_changed":null,"notifications/elicitation/complete":null},Eb0={ping:null,initialize:null,"completion/complete":null,"logging/setLevel":null,"prompts/get":null,"prompts/list":null,"resources/list":null,"resources/templates/list":null,"resources/read":null,"resources/subscribe":null,"resources/unsubscribe":null,"tools/call":null,"tools/list":null,"sampling/createMessage":null,"elicitation/create":null,"roots/list":null};Uc1=Object.keys(De),Ic1=Object.keys(Be);Ie={ok:!1,reason:"not-in-era"};Bh={era:"2025-11-25",hasRequestMethod:Ae,hasNotificationMethod:Pe,validateRequest:($,Y)=>kw(Rb0($),Y),validateResult:($,Y)=>kw(Cb0($),Y),validateNotification:($,Y)=>kw(_b0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Ie,validateInputResponse:()=>Ie,samplingResultVariant:($,Y)=>{let U=Oe();return kw($?U.CreateMessageResultWithToolsSchema:U.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let U=we($),I=U.structuredContent;if(I===void 0)return U;let Q=typeof I!=="object"||I===null||Array.isArray(I),J=Y!==void 0&&Ne(Y);if(!Q&&!J)return U;return{...U,structuredContent:{result:I}}},decodeResult($,Y){if(Lh(Y)&&"resultType"in Y){let U={...Y};return delete U.resultType,{kind:"complete",result:Je(U)}}return{kind:"complete",result:Je(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l Line truncated
* content-type
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/_i0=C0(($)=>{var Y=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,U=/\\([\u000b\u0020-\u00ff])/g,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=Q;function Q(z){if(!z)throw TypeError("argument string is required");var G=typeof z==="object"?J(z):z;if(typeof G!=="string")throw TypeError("argument string is required to be a string");var H=G.indexOf(";"),W=H!==-1?G.slice(0,H).trim():G.trim();if(!I.test(W))throw TypeError("invalid media type");var X=new K(W.toLowerCase());if(H!==-1){var Z,q,V;Y.lastIndex=H;while(q=Y.exec(G)){if(q.index!==H)throw TypeError("invalid parameter format");if(H+=q[0].length,Z=q[1].toLowerCase(),V=q[2],V.charCodeAt(0)===34){if(V=V.slice(1,-1),V.indexOf("\\")!==-1)V=V.replace(U,"$1")}X.parameters[Z]=V}if(H!==G.length)throw TypeError("invalid parameter format")}return X}function J(z){var G;if(typeof z.getHeader==="function")G=z.getHeader("content-type");else if(typeof z.headers==="object")G=z.headers&&z.headers["content-type"];if(typeof G!=="string")throw TypeError("content-type header is missing from object");return G}function K(z){this.parameters=Object.create(null),this.type=z}}),Yc1=GV(_i0(),1);vi0=/^[A-Za-z0-9._-]{1,128}$/});function xh($){let Y=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return tc0(Y),Y}var sw,ue,F1,v1,Z5,tw,xi0,be,ie,aw,fi0,q5,ui0,bi0,ce,ii0,ew,cQ,BH,nQ,$M,ci0,ne,ni0,di0,pi0,fh,mi0,uh,de,li0,oi0,ri0,si0,ai0,ti0,ei0,$c0,bh,Yc0,Uc0,Ic0,pe,me,le,Qc0,Jc0,Kc0,ih,zc0,oe,Gc0,Hc0,Wc0,Xc0,Zc0,qc0,Vc0,Lc0,re,Fc0,se,ae,te,wc0,ch,Mc0,ee,$00,Y00,Oc0,Nc0,U00,Dc0,Bc0,Ac0,I00,Pc0,Tc0,Q00,Ec0,jc0,Cc0,Rc0,_c0,vc0,Sc0,hc0,gc0,yc0,kc0,xc0,fc0,uc0,bc0,ic0,cc0,nc0,dc0,pc0,mc0,lc0,oc0,J00,rc0,sc0,ac0,tc0,YM=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=xh(sc0.Ajv2020)}_engineFor($){if(this._userAjv)return this.ajv;let Y=fr($,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(Y==="2020-12")return this.ajv;if(Y==="2019-09")return this._ajv2019??=xh(rc0.Ajv2019);return this._ajvDraft7??=xh(J00.Ajv)}getValidator($){let Y=this._engineFor($),U="$id"in $&&typeof $.$id==="string"?Y.getSchema($.$id)??Y.compile($):Y.compile($);return(I)=>{return U(I)?{valid:!0,data:I,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Y.errorsText(U.errors)}}}},qc1;var K00=m(()=>{jE();CE();sw=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.regexpCode=$.getEsmExportName=$.getProperty=$.safeStringify=$.stringify=$.strConcat=$.addCodeArg=$.str=$._=$.nil=$._Code=$.Name=$.IDENTIFIER=$._CodeOrName=void 0;var Y=class{};$._CodeOrName=Y,$.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var U=class extends Y{constructor(F){super();if(!$.IDENTIFIER.test(F))throw Error("CodeGen: name must be a valid identifier");this.str=F}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$.Name=U;var I=class extends Y{constructor(F){super();this._items=typeof F==="string"?[F]:F}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let F=this._items[0];return F===""||F==='""'}get str(){var F;return(F=this._str)!==null&&F!==void 0?F:this._str=this._items.reduce((N,O)=>`${N}${O}`,"")}get names(){var F;return(F=this._names)!==null&&F!==void 0?F:this._names=this._items.reduce((N,O)=>{if(O instanceof U)N[O.str]=(N[O.str]||0)+1;return N},{})}};$._Code=I,$.nil=new I("");function Q(F,...N){let O=[F[0]],D=0;while(D<N.length)z(O,N[D]),O.push(F[++D]);return new I(O)}$._=Q;let J=new I("+");function K(F,...N){let O=[q(F[0])],D=0;while(D<N.length)O.push(J),z(O,N[D]),O.push(J,q(F[++D]));return G(O),new I(O)}$.str=K;function z(F,N){if(N instanceof I)F.push(...N._items);else if(N instanceof U)F.push(N);else F.push(X(N))}$.addCodeArg=z;function G(F){let N=1;while(N<F.length-1){if(F[N]===J){let O=H(F[N-1],F[N+1]);if(O!==void 0){F.splice(N-1,3,O);continue}F[N++]="+"}N++}}function H(F,N){if(N==='""')return F;if(F==='""')return N;if(typeof F=="string"){if(N instanceof U||F[F.length-1]!=='"')return;if(typeof N!="string")return`${F.slice(0,-1)}${N}"`;if(N[0]==='"')return F.slice(0,-1)+N.slice(1);return}if(typeof N=="string"&&N[0]==='"'&&!(F instanceof U))return`"${F}${N.slice(1)}`}function W(F,N){return N.emptyStr()?F:F.emptyStr()?N:K`${F}${N}`}$.strConcat=W;function X(F){return typeof F=="number"||typeof F=="boolean"||F===null?F:q(Array.isArray(F)?F.join(","):F)}function Z(F){return new I(q(F))}$.stringify=Z;function q(F){return JSON.stringify(F).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$.safeStringify=q;function V(F){return typeof F=="string"&&$.IDENTIFIER.test(F)?new I(`.${F}`):Q`[${F}]`}$.getProperty=V;function w(F){if(typeof F=="string"&&$.IDENTIFIER.test(F))return new I(`${F}`);throw Error(`CodeGen: invalid export name: ${F}, use explicit $id name mapping`)}$.getEsmExportName=w;function M(F){return new I(F.Line truncated
`:""},this._extScope=R,this._scope=new U.Scope({parent:R}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name(R){return this._scope.name(R)}scopeName(R){return this._extScope.name(R)}scopeValue(R,o){let e=this._extScope.value(R,o);return(this._values[e.prefix]||(this._values[e.prefix]=new Set)).add(e),e}getScopeValue(R,o){return this._extScope.getValue(R,o)}scopeRefs(R){return this._extScope.scopeRefs(R,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(R,o,e,O0){let E0=this._scope.toName(o);if(e!==void 0&&O0)this._constants[E0.str]=e;return this._leafNode(new K(R,E0,e)),E0}const(R,o,e){return this._def(U.varKinds.const,R,o,e)}let(R,o,e){return this._def(U.varKinds.let,R,o,e)}var(R,o,e){return this._def(U.varKinds.var,R,o,e)}assign(R,o,e){return this._leafNode(new z(R,o,e))}add(R,o){return this._leafNode(new G(R,$.operators.ADD,o))}code(R){if(typeof R=="function")R();else if(R!==Y.nil)this._leafNode(new Z(R));return this}object(...R){let o=["{"];for(let[e,O0]of R){if(o.length>1)o.push(",");if(o.push(e),e!==O0||this.opts.es5)o.push(":"),(0,Y.addCodeArg)(o,O0)}return o.push("}"),new Y._Code(o)}if(R,o,e){if(this._blockNode(new F(R)),o&&e)this.code(o).else().code(e).endIf();else if(o)this.code(o).endIf();else if(e)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(R){return this._elseNode(new F(R))}else(){return this._elseNode(new M)}endIf(){return this._endBlockNode(F,M)}_for(R,o){if(this._blockNode(R),o)this.code(o).endFor();return this}for(R,o){return this._for(new O(R),o)}forRange(R,o,e,O0,E0=this.opts.es5?U.varKinds.var:U.varKinds.let){let y0=this._scope.toName(R);return this._for(new D(E0,y0,o,e),()=>O0(y0))}forOf(R,o,e,O0=U.varKinds.const){let E0=this._scope.toName(R);if(this.opts.es5){let y0=o instanceof Y.Name?o:this.var("_arr",o);return this.forRange("_i",0,Y._`${y0}.length`,(v0)=>{this.var(E0,Y._`${y0}[${v0}]`),e(E0)})}return this._for(new P("of",O0,E0,o),()=>e(E0))}forIn(R,o,e,O0=this.opts.es5?U.varKinds.var:U.varKinds.const){if(this.opts.ownProperties)return this.forOf(R,Y._`Object.keys(${o})`,e);let E0=this._scope.toName(R);return this._for(new P("in",O0,E0,o),()=>e(E0))}endFor(){return this._endBlockNode(N)}label(R){return this._leafNode(new H(R))}break(R){return this._leafNode(new W(R))}return(R){let o=new B;if(this._blockNode(o),this.code(R),o.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(B)}try(R,o,e){if(!o&&!e)throw Error('CodeGen: "try" without "catch" and "finally"');let O0=new E;if(this._blockNode(O0),this.code(R),o){let E0=this.name("e");this._currNode=O0.catch=new C(E0),o(E0)}if(e)this._currNode=O0.finally=new i,this.code(e);return this._endBlockNode(C,i)}throw(R){return this._leafNode(new X(R))}block(R,o){if(this._blockStarts.push(this._nodes.length),R)this.code(R).endBlock(o);return this}endBlock(R){let o=this._blockStarts.pop();if(o===void 0)throw Error("CodeGen: not in self-balancing block");let e=this._nodes.length-o;if(e<0||R!==void 0&&e!==R)throw Error(`CodeGen: wrong number of nodes: ${e} vs ${R} expected`);return this._nodes.length=o,this}func(R,o=Y.nil,e,O0){if(this._blockNode(new T(R,o,e)),O0)this.code(O0).endFunc();return this}endFunc(){return this._endBlockNode(T)}optimize(R=1){while(R-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(R){return this._currNode.nodes.push(R),this}_blockNode(R){this._currNode.nodes.push(R),this._nodes.push(R)}_endBlockNode(R,o){let e=this._currNode;if(e instanceof R||o&&e instanceof o)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${o?`${R.kind}/${o.kind}`:R.kind}"`)}_elseNode(R){let o=this._currNode;if(!(o instanceof F))throw Error('CodeGen: "else" without "if"');return this._currNode=o.else=R,this}get _root(){return this._nodes[0]}get _currNode(){let R=this._nodes;return R[R.length-1]}set _currNode(R){let o=this._nodes;o[o.length-1]=R}};$.CodeGen=x;function g(R,o){for(let e in o)R[e]=(R[e]||0)+(o[e]||0);return R}function b(R,o){return o instanceof Y._CodeOrName?g(R,o.names):R}function c(R,o,e){if(R instanceof Y.Name)return O0(R);if(!E0(R))return R;return new Y._Code(R._items.reduce((y0,v0)=>{if(v0 instanceof Y.Name)v0=O0(v0);if(v0 instanceof Y._Code)y0.push(...v0._items);else y0.push(v0);return y0},[]));function O0(y0){let v0=e[y0.str];if(v0===void 0||o[y0.str]!==1)return y0;return delete o[y0.str],v0}function E0(y0){return y0 instanceof Y._Code&&y0._items.some((v0)=>v0 instanceof Y.Name&&o[v0.str]===1&&e[v0.str]!==void 0)}}function I0(R,o){for(let e in o)R[e]=(R[e]||0)-(o[e]||0)}function k(R){return typeof R=="boolean"||typeof R=="number"||R===null?!R:Y._`!${Y0(R)}`}$.not=k;let p=d($.operators.AND);function a(...R){return R.reduce(p)}$.and=a;let $0=d($.operators.OR);function y(...R){return R.reduce($0)}$.or=y;function d(R){return(o,e)=>o===Y.nil?e:e===Y.nil?o:Y._`${Y0(o)} ${R} ${Y0(e)}`}function Y0(R){return R instanceof Y.Name?R:Y._`(${R})`}}),v1=C0(( Line truncated
*/gi0=C0(($)=>{var Y=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,U=/\\([\u000b\u0020-\u00ff])/g,I=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=Q;function Q(z){if(!z)throw TypeError("argument string is required");var G=typeof z==="object"?J(z):z;if(typeof G!=="string")throw TypeError("argument string is required to be a string");var H=G.indexOf(";"),W=H!==-1?G.slice(0,H).trim():G.trim();if(!I.test(W))throw TypeError("invalid media type");var X=new K(W.toLowerCase());if(H!==-1){var Z,q,V;Y.lastIndex=H;while(q=Y.exec(G)){if(q.index!==H)throw TypeError("invalid parameter format");if(H+=q[0].length,Z=q[1].toLowerCase(),V=q[2],V.charCodeAt(0)===34){if(V=V.slice(1,-1),V.indexOf("\\")!==-1)V=V.replace(U,"$1")}X.parameters[Z]=V}if(H!==G.length)throw TypeError("invalid parameter format")}return X}function J(z){var G;if(typeof z.getHeader==="function")G=z.getHeader("content-type");else if(typeof z.headers==="object")G=z.headers&&z.headers["content-type"];if(typeof G!=="string")throw TypeError("content-type header is missing from object");return G}function K(z){this.parameters=Object.create(null),this.type=z}}),zc1=XV(gi0(),1);yi0=/^[A-Za-z0-9._-]{1,128}$/});function ih($){let Y=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return Un0(Y),Y}var ew,pe,F1,v1,V5,YM,ii0,me,le,$M,ci0,L5,ni0,di0,oe,pi0,UM,mQ,EH,lQ,IM,mi0,re,li0,oi0,ri0,ch,si0,nh,se,ai0,ti0,ei0,$c0,Yc0,Uc0,Ic0,Qc0,dh,Jc0,Kc0,zc0,ae,te,ee,Gc0,Hc0,Wc0,ph,Xc0,$00,Zc0,qc0,Vc0,Lc0,Fc0,wc0,Mc0,Oc0,Y00,Nc0,U00,I00,Q00,Dc0,mh,Bc0,J00,K00,z00,Ac0,Pc0,G00,Tc0,Ec0,jc0,H00,Cc0,Rc0,W00,_c0,vc0,Sc0,hc0,gc0,yc0,kc0,xc0,fc0,uc0,bc0,ic0,cc0,nc0,dc0,pc0,mc0,lc0,oc0,rc0,sc0,ac0,tc0,X00,ec0,$n0,Yn0,Un0,QM=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=ih($n0.Ajv2020)}_engineFor($){if(this._userAjv)return this.ajv;let Y=dr($,"pass a pre-configured Ajv instance to AjvJsonSchemaValidator(ajv) to validate other dialects.");if(Y==="2020-12")return this.ajv;if(Y==="2019-09")return this._ajv2019??=ih(ec0.Ajv2019);return this._ajvDraft7??=ih(X00.Ajv)}getValidator($){let Y=this._engineFor($),U="$id"in $&&typeof $.$id==="string"?Y.getSchema($.$id)??Y.compile($):Y.compile($);return(I)=>{return U(I)?{valid:!0,data:I,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Y.errorsText(U.errors)}}}},Oc1;var Z00=m(()=>{vE();SE();ew=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.regexpCode=$.getEsmExportName=$.getProperty=$.safeStringify=$.stringify=$.strConcat=$.addCodeArg=$.str=$._=$.nil=$._Code=$.Name=$.IDENTIFIER=$._CodeOrName=void 0;var Y=class{};$._CodeOrName=Y,$.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var U=class extends Y{constructor(F){super();if(!$.IDENTIFIER.test(F))throw Error("CodeGen: name must be a valid identifier");this.str=F}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$.Name=U;var I=class extends Y{constructor(F){super();this._items=typeof F==="string"?[F]:F}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let F=this._items[0];return F===""||F==='""'}get str(){var F;return(F=this._str)!==null&&F!==void 0?F:this._str=this._items.reduce((N,O)=>`${N}${O}`,"")}get names(){var F;return(F=this._names)!==null&&F!==void 0?F:this._names=this._items.reduce((N,O)=>{if(O instanceof U)N[O.str]=(N[O.str]||0)+1;return N},{})}};$._Code=I,$.nil=new I("");function Q(F,...N){let O=[F[0]],D=0;while(D<N.length)z(O,N[D]),O.push(F[++D]);return new I(O)}$._=Q;let J=new I("+");function K(F,...N){let O=[q(F[0])],D=0;while(D<N.length)O.push(J),z(O,N[D]),O.push(J,q(F[++D]));return G(O),new I(O)}$.str=K;function z(F,N){if(N instanceof I)F.push(...N._items);else if(N instanceof U)F.push(N);else F.push(X(N))}$.addCodeArg=z;function G(F){let N=1;while(N<F.length-1){if(F[N]===J){let O=H(F[N-1],F[N+1]);if(O!==void 0){F.splice(N-1,3,O);continue}F[N++]="+"}N++}}function H(F,N){if(N==='""')return F;if(F==='""')return N;if(typeof F=="string"){if(N instanceof U||F[F.length-1]!=='"')return;if(typeof N!="string")return`${F.slice(0,-1)}${N}"`;if(N[0]==='"')return F.slice(0,-1)+N.slice(1);return}if(typeof N=="string"&&N[0]==='"'&&!(F instanceof U))return`"${F}${N.slice(1)}`}function W(F,N){return N.emptyStr()?F:F.emptyStr()?N:K`${F}${N}`}$.strConcat=W;function X(F){return typeof F=="number"||typeof F=="boolean"||F===null?F:q(Array.isArray(F)?F.join(","):F)}function Z(F){return new I(q(F))}$.stringify=Z;function q(F){return JSON.stringify(F).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$.safeStringify=q;function V(F){return typeof F=="string"&&$.IDENTIFIER.test(F)?new I(`.${F}`):Q`[${F}]`}$.getProperty=V;function w(F){if(typeof F=="string"&&$.IDENTIFIER.test(F))return new I(`${F}`);throw Error(`CodeGen: invalid export name: ${F}, use explicit $id name mapping`)}$.getEsmExportName=w;function M(F){return neLine truncated
`:""},this._extScope=h,this._scope=new U.Scope({parent:h}),this._nodes=[new w]}toString(){return this._root.render(this.opts)}name(h){return this._scope.name(h)}scopeName(h){return this._extScope.name(h)}scopeValue(h,o){let e=this._extScope.value(h,o);return(this._values[e.prefix]||(this._values[e.prefix]=new Set)).add(e),e}getScopeValue(h,o){return this._extScope.getValue(h,o)}scopeRefs(h){return this._extScope.scopeRefs(h,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(h,o,e,w0){let N0=this._scope.toName(o);if(e!==void 0&&w0)this._constants[N0.str]=e;return this._leafNode(new K(h,N0,e)),N0}const(h,o,e){return this._def(U.varKinds.const,h,o,e)}let(h,o,e){return this._def(U.varKinds.let,h,o,e)}var(h,o,e){return this._def(U.varKinds.var,h,o,e)}assign(h,o,e){return this._leafNode(new z(h,o,e))}add(h,o){return this._leafNode(new G(h,$.operators.ADD,o))}code(h){if(typeof h=="function")h();else if(h!==Y.nil)this._leafNode(new Z(h));return this}object(...h){let o=["{"];for(let[e,w0]of h){if(o.length>1)o.push(",");if(o.push(e),e!==w0||this.opts.es5)o.push(":"),(0,Y.addCodeArg)(o,w0)}return o.push("}"),new Y._Code(o)}if(h,o,e){if(this._blockNode(new F(h)),o&&e)this.code(o).else().code(e).endIf();else if(o)this.code(o).endIf();else if(e)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(h){return this._elseNode(new F(h))}else(){return this._elseNode(new M)}endIf(){return this._endBlockNode(F,M)}_for(h,o){if(this._blockNode(h),o)this.code(o).endFor();return this}for(h,o){return this._for(new O(h),o)}forRange(h,o,e,w0,N0=this.opts.es5?U.varKinds.var:U.varKinds.let){let _0=this._scope.toName(h);return this._for(new D(N0,_0,o,e),()=>w0(_0))}forOf(h,o,e,w0=U.varKinds.const){let N0=this._scope.toName(h);if(this.opts.es5){let _0=o instanceof Y.Name?o:this.var("_arr",o);return this.forRange("_i",0,Y._`${_0}.length`,(v0)=>{this.var(N0,Y._`${_0}[${v0}]`),e(N0)})}return this._for(new P("of",w0,N0,o),()=>e(N0))}forIn(h,o,e,w0=this.opts.es5?U.varKinds.var:U.varKinds.const){if(this.opts.ownProperties)return this.forOf(h,Y._`Object.keys(${o})`,e);let N0=this._scope.toName(h);return this._for(new P("in",w0,N0,o),()=>e(N0))}endFor(){return this._endBlockNode(N)}label(h){return this._leafNode(new H(h))}break(h){return this._leafNode(new W(h))}return(h){let o=new B;if(this._blockNode(o),this.code(h),o.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(B)}try(h,o,e){if(!o&&!e)throw Error('CodeGen: "try" without "catch" and "finally"');let w0=new E;if(this._blockNode(w0),this.code(h),o){let N0=this.name("e");this._currNode=w0.catch=new C(N0),o(N0)}if(e)this._currNode=w0.finally=new i,this.code(e);return this._endBlockNode(C,i)}throw(h){return this._leafNode(new X(h))}block(h,o){if(this._blockStarts.push(this._nodes.length),h)this.code(h).endBlock(o);return this}endBlock(h){let o=this._blockStarts.pop();if(o===void 0)throw Error("CodeGen: not in self-balancing block");let e=this._nodes.length-o;if(e<0||h!==void 0&&e!==h)throw Error(`CodeGen: wrong number of nodes: ${e} vs ${h} expected`);return this._nodes.length=o,this}func(h,o=Y.nil,e,w0){if(this._blockNode(new T(h,o,e)),w0)this.code(w0).endFunc();return this}endFunc(){return this._endBlockNode(T)}optimize(h=1){while(h-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(h){return this._currNode.nodes.push(h),this}_blockNode(h){this._currNode.nodes.push(h),this._nodes.push(h)}_endBlockNode(h,o){let e=this._currNode;if(e instanceof h||o&&e instanceof o)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${o?`${h.kind}/${o.kind}`:h.kind}"`)}_elseNode(h){let o=this._currNode;if(!(o instanceof F))throw Error('CodeGen: "else" without "if"');return this._currNode=o.else=h,this}get _root(){return this._nodes[0]}get _currNode(){let h=this._nodes;return h[h.length-1]}set _currNode(h){let o=this._nodes;o[o.length-1]=h}};$.CodeGen=x;function g(h,o){for(let e in o)h[e]=(h[e]||0)+(o[e]||0);return h}function b(h,o){return o instanceof Y._CodeOrName?g(h,o.names):h}function c(h,o,e){if(h instanceof Y.Name)return w0(h);if(!N0(h))return h;return new Y._Code(h._items.reduce((_0,v0)=>{if(v0 instanceof Y.Name)v0=w0(v0);if(v0 instanceof Y._Code)_0.push(...v0._items);else _0.push(v0);return _0},[]));function w0(_0){let v0=e[_0.str];if(v0===void 0||o[_0.str]!==1)return _0;return delete o[_0.str],v0}function N0(_0){return _0 instanceof Y._Code&&_0._items.some((v0)=>v0 instanceof Y.Name&&o[v0.str]===1&&e[v0.str]!==void 0)}}function I0(h,o){for(let e in o)h[e]=(h[e]||0)-(o[e]||0)}function k(h){return typeof h=="boolean"||typeof h=="number"||h===null?!h:Y._`!${Y0(h)}`}$.not=k;let p=d($.operators.AND);function a(...h){return h.reduce(p)}$.and=a;let $0=d($.operators.OR);function y(...h){return h.reduce($0)}$.or=y;function d(h){return(o,e)=>o===Y.nil?e:e===Y.nil?o:Y._`${Y0(o)} ${h} ${Y0(e)}`}function Y0(h){return h instanceof Y.Name?h:Y._`(${h})`}}),v1=C0(( Line truncated
|| (${C} == "string" && ${B} && ${B} == +${B})`).assign(i,Q._`+${B}`);return;case"integer":T.elseIf(Q._`${C} === "boolean" || ${B} === null
|| (${C} === "string" && ${B} && ${B} == +${B} && !(${B} % 1))`).assign(i,Q._`+${B}`);return;case"boolean":T.elseIf(Q._`${B} === "false" || ${B} === 0 || ${B} === null`).assign(i,!1).elseIf(Q._`${B} === "true" || ${B} === 1`).assign(i,!0);return;case"null":T.elseIf(Q._`${B} === "" || ${B} === 0 || ${B} === false`),T.assign(i,null);return;case"array":T.elseIf(Q._`${C} === "string" || ${C} === "number"
|| ${C} === "boolean" || ${B} === null`).assign(i,Q._`[${B}]`)}}}function q({gen:O,parentData:D,parentDataProperty:P},T){O.if(Q._`${D} !== undefined`,()=>O.assign(Q._`${D}[${P}]`,T))}function V(O,D,P,T=K.Correct){let B=T===K.Correct?Q.operators.EQ:Q.operators.NEQ,E;switch(O){case"null":return Q._`${D} ${B} null`;case"array":E=Q._`Array.isArray(${D})`;break;case"object":E=Q._`${D} && typeof ${D} == "object" && !Array.isArray(${D})`;break;case"integer":E=C(Q._`!(${D} % 1) && !isNaN(${D})`);break;case"number":E=C();break;default:return Q._`typeof ${D} ${B} ${O}`}return T===K.Correct?E:(0,Q.not)(E);function C(i=Q.nil){return(0,Q.and)(Q._`typeof ${D} == "number"`,i,P?Q._`isFinite(${D})`:Q.nil)}}$.checkDataType=V;function w(O,D,P,T){if(O.length===1)return V(O[0],D,P,T);let B,E=(0,J.toHash)(O);if(E.array&&E.object){let C=Q._`typeof ${D} != "object"`;B=E.null?C:Q._`!${D} || ${C}`,delete E.null,delete E.array,delete E.object}else B=Q.nil;if(E.number)delete E.integer;for(let C in E)B=(0,Q.and)(B,V(C,D,P,T));return B}$.checkDataTypes=w;let M={message:({schema:O})=>`must be ${O}`,params:({schema:O,schemaValue:D})=>typeof O=="string"?Q._`{type: ${O}}`:Q._`{type: ${D}}`};function F(O){let D=N(O);(0,I.reportError)(D,M)}$.reportTypeError=F;function N(O){let{gen:D,data:P,schema:T}=O,B=(0,J.schemaRefOrVal)(O,T,"type");return{gen:D,keyword:"type",data:P,schema:T.type,schemaCode:B,schemaValue:B,parentSchema:T,params:{},it:O}}}),fi0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.assignDefaults=void 0;let Y=F1(),U=v1();function I(J,K){let{properties:z,items:G}=J.schema;if(K==="object"&&z)for(let H in z)Q(J,H,z[H].default);else if(K==="array"&&Array.isArray(G))G.forEach((H,W)=>Q(J,W,H.default))}$.assignDefaults=I;function Q(J,K,z){let{gen:G,compositeRule:H,data:W,opts:X}=J;if(z===void 0)return;let Z=Y._`${W}${(0,Y.getProperty)(K)}`;if(H){(0,U.checkStrictMode)(J,`default is ignored for: ${Z}`);return}let q=Y._`${Z} === undefined`;if(X.useDefaults==="empty")q=Y._`${q} || ${Z} === null || ${Z} === ""`;G.if(q,Y._`${Z} = ${(0,Y.stringify)(z)}`)}}),q5=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.validateUnion=$.validateArray=$.usePattern=$.callValidateCode=$.schemaProperties=$.allSchemaProperties=$.noPropertyInData=$.propertyInData=$.isOwnProperty=$.hasPropFunc=$.reportMissingProp=$.checkMissingProp=$.checkReportMissingProp=void 0;let Y=F1(),U=v1(),I=Z5(),Q=v1();function J(O,D){let{gen:P,data:T,it:B}=O;P.if(X(P,T,D,B.opts.ownProperties),()=>{O.setParams({missingProperty:Y._`${D}`},!0),O.error()})}$.checkReportMissingProp=J;function K({gen:O,data:D,it:{opts:P}},T,B){return(0,Y.or)(...T.map((E)=>(0,Y.and)(X(O,D,E,P.ownProperties),Y._`${B} = ${E}`)))}$.checkMissingProp=K;function z(O,D){O.setParams({missingProperty:D},!0),O.error()}$.reportMissingProp=z;function G(O){return O.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Y._`Object.prototype.hasOwnProperty`})}$.hasPropFunc=G;function H(O,D,P){return Y._`${G(O)}.call(${D}, ${P})`}$.isOwnProperty=H;function W(O,D,P,T){let B=Y._`${D}${(0,Y.getProperty)(P)} !== undefined`;return T?Y._`${B} && ${H(O,D,P)}`:B}$.propertyInData=W;function X(O,D,P,T){let B=Y._`${D}${(0,Y.getProperty)(P)} === undefined`;return T?(0,Y.or)(B,(0,Y.not)(H(O,D,P))):B}$.noPropertyInData=X;function Z(O){return O?Object.keys(O).filter((D)=>D!=="__proto__"):[]}$.allSchemaProperties=Z;function q(O,D){return Z(D).filter((P)=>!(0,U.alwaysValidSchema)(O,D[P]))}$.schemaProperties=q;function V({schemaCode:O,data:D,it:{gen:P,topSchemaRef:T,schemaPath:B,errorPath:E},it:C},i,x,g){let b=g?Y._`${O}, ${D}, ${T}${B}`:D,c=[[I.default.instancePath,(0,Y.strConcat)(I.default.instancePath,E)],[I.default.parentData,C.parentData],[I.default.parentDataProperty,C.parentDataProperty],[I.default.rootData,I.default.rootData]];if(C.opts.dynamicRef)c.push([I.default.dynamicAnchors,I.default.dynamicAnchors]);let I0=Y._`${b}, ${P.object(...c)}`;return x!==Y.nil?Y._`${i}.call(${x}, ${I0})`:Y._`${i}(${I0})`}$.callValidateCode=V;let w=Y._`new RegExp`;function M({gen:O,it:{opts:D}},P){let T=D.unicodeRegExp?"u":"",{regExp:B}=D.code,E=B(P,T);return O.scopeValue("pattern",{key:E.toString(),ref:E,code:Y._`${B.code==="new RegExp"?w:(0,Q.useFunc)(O,B)}(${P}, ${T})`})}$.usePattern=M;function F(O){let{gen:D,data:P,keyword:T,it:B}=O,E=D.name("valid");if(B.allErrors){let i=D.let("valid",!0);return C(()=>D.assign(i,!1)),i}return D.var(E,!0),C(()=>D.break()),E;function C(i){let x=D.const("len",Y._`${P}.length`);D.forRange("i",0,x,(g)=>{O.subschema({keyword:T,dataProp:g,dataPropType:U.Type.Num},E),D.if((0,Y.not)(E),i)})}}$.validateArray=F;function N(O){let{gen:D,schema:P,keyword:T,it:B}=O;if(!Array.isArray(P))throw Error("ajv implementation error");if(P.some((i)=>(0,U.alwaysValidSchema)(B,i))&&!B.opts.unevaluated)return;let E=D.let("valid",!1),C=D.name("_valid");D.block(()=>P.forEach((i,x)=>{let g=O.subschema({keyword:T,schemaProp:x,compositeRule:!0},C);if(D.assign(E,Y._`${E} || ${C}`),!O.mergeValidEvaluated(g,C) Line truncated
|| ${C} === "boolean" || ${B} === null`).assign(i,Q._`[${B}]`)}}}function q({gen:O,parentData:D,parentDataProperty:P},T){O.if(Q._`${D} !== undefined`,()=>O.assign(Q._`${D}[${P}]`,T))}function V(O,D,P,T=K.Correct){let B=T===K.Correct?Q.operators.EQ:Q.operators.NEQ,E;switch(O){case"null":return Q._`${D} ${B} null`;case"array":E=Q._`Array.isArray(${D})`;break;case"object":E=Q._`${D} && typeof ${D} == "object" && !Array.isArray(${D})`;break;case"integer":E=C(Q._`!(${D} % 1) && !isNaN(${D})`);break;case"number":E=C();break;default:return Q._`typeof ${D} ${B} ${O}`}return T===K.Correct?E:(0,Q.not)(E);function C(i=Q.nil){return(0,Q.and)(Q._`typeof ${D} == "number"`,i,P?Q._`isFinite(${D})`:Q.nil)}}$.checkDataType=V;function w(O,D,P,T){if(O.length===1)return V(O[0],D,P,T);let B,E=(0,J.toHash)(O);if(E.array&&E.object){let C=Q._`typeof ${D} != "object"`;B=E.null?C:Q._`!${D} || ${C}`,delete E.null,delete E.array,delete E.object}else B=Q.nil;if(E.number)delete E.integer;for(let C in E)B=(0,Q.and)(B,V(C,D,P,T));return B}$.checkDataTypes=w;let M={message:({schema:O})=>`must be ${O}`,params:({schema:O,schemaValue:D})=>typeof O=="string"?Q._`{type: ${O}}`:Q._`{type: ${D}}`};function F(O){let D=N(O);(0,I.reportError)(D,M)}$.reportTypeError=F;function N(O){let{gen:D,data:P,schema:T}=O,B=(0,J.schemaRefOrVal)(O,T,"type");return{gen:D,keyword:"type",data:P,schema:T.type,schemaCode:B,schemaValue:B,parentSchema:T,params:{},it:O}}}),ci0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.assignDefaults=void 0;let Y=F1(),U=v1();function I(J,K){let{properties:z,items:G}=J.schema;if(K==="object"&&z)for(let H in z)Q(J,H,z[H].default);else if(K==="array"&&Array.isArray(G))G.forEach((H,W)=>Q(J,W,H.default))}$.assignDefaults=I;function Q(J,K,z){let{gen:G,compositeRule:H,data:W,opts:X}=J;if(z===void 0)return;let Z=Y._`${W}${(0,Y.getProperty)(K)}`;if(H){(0,U.checkStrictMode)(J,`default is ignored for: ${Z}`);return}let q=Y._`${Z} === undefined`;if(X.useDefaults==="empty")q=Y._`${q} || ${Z} === null || ${Z} === ""`;G.if(q,Y._`${Z} = ${(0,Y.stringify)(z)}`)}}),L5=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.validateUnion=$.validateArray=$.usePattern=$.callValidateCode=$.schemaProperties=$.allSchemaProperties=$.noPropertyInData=$.propertyInData=$.isOwnProperty=$.hasPropFunc=$.reportMissingProp=$.checkMissingProp=$.checkReportMissingProp=void 0;let Y=F1(),U=v1(),I=V5(),Q=v1();function J(O,D){let{gen:P,data:T,it:B}=O;P.if(X(P,T,D,B.opts.ownProperties),()=>{O.setParams({missingProperty:Y._`${D}`},!0),O.error()})}$.checkReportMissingProp=J;function K({gen:O,data:D,it:{opts:P}},T,B){return(0,Y.or)(...T.map((E)=>(0,Y.and)(X(O,D,E,P.ownProperties),Y._`${B} = ${E}`)))}$.checkMissingProp=K;function z(O,D){O.setParams({missingProperty:D},!0),O.error()}$.reportMissingProp=z;function G(O){return O.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Y._`Object.prototype.hasOwnProperty`})}$.hasPropFunc=G;function H(O,D,P){return Y._`${G(O)}.call(${D}, ${P})`}$.isOwnProperty=H;function W(O,D,P,T){let B=Y._`${D}${(0,Y.getProperty)(P)} !== undefined`;return T?Y._`${B} && ${H(O,D,P)}`:B}$.propertyInData=W;function X(O,D,P,T){let B=Y._`${D}${(0,Y.getProperty)(P)} === undefined`;return T?(0,Y.or)(B,(0,Y.not)(H(O,D,P))):B}$.noPropertyInData=X;function Z(O){return O?Object.keys(O).filter((D)=>D!=="__proto__"):[]}$.allSchemaProperties=Z;function q(O,D){return Z(D).filter((P)=>!(0,U.alwaysValidSchema)(O,D[P]))}$.schemaProperties=q;function V({schemaCode:O,data:D,it:{gen:P,topSchemaRef:T,schemaPath:B,errorPath:E},it:C},i,x,g){let b=g?Y._`${O}, ${D}, ${T}${B}`:D,c=[[I.default.instancePath,(0,Y.strConcat)(I.default.instancePath,E)],[I.default.parentData,C.parentData],[I.default.parentDataProperty,C.parentDataProperty],[I.default.rootData,I.default.rootData]];if(C.opts.dynamicRef)c.push([I.default.dynamicAnchors,I.default.dynamicAnchors]);let I0=Y._`${b}, ${P.object(...c)}`;return x!==Y.nil?Y._`${i}.call(${x}, ${I0})`:Y._`${i}(${I0})`}$.callValidateCode=V;let w=Y._`new RegExp`;function M({gen:O,it:{opts:D}},P){let T=D.unicodeRegExp?"u":"",{regExp:B}=D.code,E=B(P,T);return O.scopeValue("pattern",{key:E.toString(),ref:E,code:Y._`${B.code==="new RegExp"?w:(0,Q.useFunc)(O,B)}(${P}, ${T})`})}$.usePattern=M;function F(O){let{gen:D,data:P,keyword:T,it:B}=O,E=D.name("valid");if(B.allErrors){let i=D.let("valid",!0);return C(()=>D.assign(i,!1)),i}return D.var(E,!0),C(()=>D.break()),E;function C(i){let x=D.const("len",Y._`${P}.length`);D.forRange("i",0,x,(g)=>{O.subschema({keyword:T,dataProp:g,dataPropType:U.Type.Num},E),D.if((0,Y.not)(E),i)})}}$.validateArray=F;function N(O){let{gen:D,schema:P,keyword:T,it:B}=O;if(!Array.isArray(P))throw Error("ajv implementation error");if(P.some((i)=>(0,U.alwaysValidSchema)(B,i))&&!B.opts.unevaluated)return;let E=D.let("valid",!1),C=D.name("_valid");D.block(()=>P.forEach((i,x)=>{let g=O.subschema({keyword:T,schemaProp:x,compositeRule:!0},C);if(D.assign(E,Y._`${E} || ${C}`),!O.mergeValidEvaluated(g,C) Line truncated
missingProperty: ${X},
depsCount: ${H},
deps: ${W}}`};let Q={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=J(G);K(G,H),z(G,W)}};function J({schema:G}){let H={},W={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?H:W;Z[X]=G[X]}return[H,W]}function K(G,H=G.schema){let{gen:W,data:X,it:Z}=G;if(Object.keys(H).length===0)return;let q=W.let("missing");for(let V in H){let w=H[V];if(w.length===0)continue;let M=(0,I.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:w.length,deps:w.join(", ")}),Z.allErrors)W.if(M,()=>{for(let F of w)(0,I.checkReportMissingProp)(G,F)});else W.if(Y._`${M} && (${(0,I.checkMissingProp)(G,w,q)})`),(0,I.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=K;function z(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let w in H){if((0,U.alwaysValidSchema)(q,H[w]))continue;W.if((0,I.propertyInData)(W,X,w,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:w},V);G.mergeValidEvaluated(M,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=z,$.default=Q}),zc0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=F1(),U=v1(),I={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:Q})=>Y._`{propertyName: ${Q.propertyName}}`},code(Q){let{gen:J,schema:K,data:z,it:G}=Q;if((0,U.alwaysValidSchema)(G,K))return;let H=J.name("valid");J.forIn("key",z,(W)=>{Q.setParams({propertyName:W}),Q.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),J.if((0,Y.not)(H),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(H)}};$.default=I}),oe=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=q5(),U=F1(),I=Z5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:K})=>U._`{additionalProperty: ${K.additionalProperty}}`},code(K){let{gen:z,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=K;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,Q.alwaysValidSchema)(Z,G))return;let w=(0,Y.allSchemaProperties)(H.properties),M=(0,Y.allSchemaProperties)(H.patternProperties);F(),K.ok(U._`${X} === ${I.default.errors}`);function F(){z.forIn("key",W,(T)=>{if(!w.length&&!M.length)D(T);else z.if(N(T),()=>D(T))})}function N(T){let B;if(w.length>8){let E=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");B=(0,Y.isOwnProperty)(z,E,T)}else if(w.length)B=(0,U.or)(...w.map((E)=>U._`${T} === ${E}`));else B=U.nil;if(M.length)B=(0,U.or)(B,...M.map((E)=>U._`${(0,Y.usePattern)(K,E)}.test(${T})`));return(0,U.not)(B)}function O(T){z.code(U._`delete ${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){O(T);return}if(G===!1){if(K.setParams({additionalProperty:T}),K.error(),!q)z.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let B=z.name("valid");if(V.removeAdditional==="failing")P(T,B,!1),z.if((0,U.not)(B),()=>{K.reset(),O(T)});else if(P(T,B),!q)z.if((0,U.not)(B),()=>z.break())}}function P(T,B,E){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(E===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});K.subschema(C,B)}}};$.default=J}),Gc0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=cQ(),U=q5(),I=v1(),Q=oe(),J={keyword:"properties",type:"object",schemaType:"object",code(K){let{gen:z,schema:G,parentSchema:H,data:W,it:X}=K;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)Q.default.code(new Y.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,U.allSchemaProperties)(G);for(let F of Z)X.definedProperties.add(F);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=I.mergeEvaluated.props(z,(0,I.toHash)(Z),X.props);let q=Z.filter((F)=>!(0,I.alwaysValidSchema)(X,G[F]));if(q.length===0)return;let V=z.name("valid");for(let F of q){if(w(F))M(F);else{if(z.if((0,U.propertyInData)(z,W,F,X.opts.ownProperties)),M(F),!X.allErrors)z.else().var(V,!0);z.endIf()}K.it.definedProperties.add(F),K.ok(V)}function w(F){return X.opts.useDefaults&&!X.compositeRule&&G[F].default!==void 0}function M(F){K.subschema({keyword:"properties",schemaProp:F,dataProp:F},V)}}};$.default=J}),Hc0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=q5(),U=F1(),I=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(K){let{gen:z,schema:G,data:H,parentSchema:W,it:X}=K,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,I.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let w=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,M=z.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,Q.evaluatedPropsToName)(z,X.props);let{props:F}=X;N();function N(){for(let P of q){if(w)O(P);if(X.allErrors) Line truncated
\x00`,x+=D4(E,2),x+=z.magic,x+=D4(M,2),x+=D4(F,2),x+=D4(B.crc32,4),x+=D4(B.compressedSize,4),x+=D4(B.uncompressedSize,4),x+=D4(H.length,2),x+=D4(N.length,2);var g=iO.LOCAL_FILE_HEADER+x+H+N,b=iO.CENTRAL_FILE_HEADER+D4(i,2)+x+D4(Z.length,2)+"\x00\x00\x00\x00"+D4(C,4)+D4(I,4)+H+N+Z;return{fileRecord:g,dirRecord:b}},Xa0=function($,Y,U,I,Q){var J="",K=AJ.transformTo("string",Q(I));return J=iO.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+D4($,2)+D4($,2)+D4(Y,4)+D4(U,4)+D4(K.length,2)+K,J},Za0=function($){var Y="";return Y=iO.DATA_DESCRIPTOR+D4($.crc32,4)+D4($.compressedSize,4)+D4($.uncompressedSize,4),Y};function N5($,Y,U,I){PJ.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=U,this.encodeFileName=I,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}AJ.inherits(N5,PJ);N5.prototype.push=function($){var Y=$.meta.percent||0,U=this.entriesCount,I=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,PJ.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(Y+100*(U-I-1))/U:100}})};N5.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Y=this.streamFiles&&!$.file.dir;if(Y){var U=T90($,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};N5.prototype.closedSource=function($){this.accumulate=!1;var Y=this.streamFiles&&!$.file.dir,U=T90($,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),Y)this.push({data:Za0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};N5.prototype.flush=function(){var $=this.bytesWritten;for(var Y=0;Y<this.dirRecords.length;Y++)this.push({data:this.dirRecords[Y],meta:{percent:100}});var U=this.bytesWritten-$,I=Xa0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:I,meta:{percent:100}})};N5.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};N5.prototype.registerPrevious=function($){this._sources.push($);var Y=this;return $.on("data",function(U){Y.processChunk(U)}),$.on("end",function(){if(Y.closedSource(Y.previous.streamInfo),Y._sources.length)Y.prepareNextSource();else Y.end()}),$.on("error",function(U){Y.error(U)}),this};N5.prototype.resume=function(){if(!PJ.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};N5.prototype.error=function($){var Y=this._sources;if(!PJ.prototype.error.call(this,$))return!1;for(var U=0;U<Y.length;U++)try{Y[U].error($)}catch(I){}return!0};N5.prototype.lock=function(){PJ.prototype.lock.call(this);var $=this._sources;for(var Y=0;Y<$.length;Y++)$[Y].lock()};E90.exports=N5});var C90=j((Fa0)=>{var qa0=Fk(),Va0=j90(),La0=function($,Y){var U=$||Y,I=qa0[U];if(!I)throw Error(U+" is not a valid compression method !");return I};Fa0.generateWorker=function($,Y,U){var I=new Va0(Y.streamFiles,U,Y.platform,Y.encodeFileName),Q=0;try{$.forEach(function(J,K){Q++;var z=La0(K.options.compression,Y.compression),G=K.options.compressionOptions||Y.compressionOptions||{},H=K.dir,W=K.date;K._compressWorker(z,G).withStreamInfo("file",{name:J,dir:H,date:W,comment:K.comment||"",unixPermissions:K.unixPermissions,dosPermissions:K.dosPermissions}).pipe(I)}),I.entriesCount=Q}catch(J){I.error(J)}return I}});var _90=j((Jo1,R90)=>{var Ma0=d4(),cO=V$();function PW($,Y){cO.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Y)}Ma0.inherits(PW,cO);PW.prototype._bindStream=function($){var Y=this;this._stream=$,$.pause(),$.on("data",function(U){Y.push({data:U,meta:{percent:0}})}).on("error",function(U){if(Y.isPaused)this.generatedError=U;else Y.error(U)}).on("end",function(){if(Y.isPaused)Y._upstreamEnded=!0;else Y.end()})};PW.prototype.pause=function(){if(!cO.prototype.pause.call(this))return!1;return this._stream.pause(),!0};PW.prototype.resume=function(){if(!cO.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};R90.exports=PW});var b90=j((Ko1,u90)=>{var Oa0=qJ(),TW=d4(),g90=V$(),Na0=By(),y90=Ay(),v90=AO(),Da0=S$0(),Ba0=C90(),S90=IW(),Aa0=_90(),k90=function($,Y,U){var I=TW.getTypeOf(Y),Q,J=TW.extend(U||{},y90);if(J.date=J.date||new Date,J.compression!==null)J.compression=J.compression.toUpperCase();if(typeof J.unixPermissions==="string")J.unixPermissions=parseInt(J.unixPermissions,8);if(J.unixPermissions&&J.unixPermissions&16384)J.dir=!0;if(J.dosPermissions&&J.dosPermission Line truncated
`)}openNode($,Y){let U=this.tos,I=this._xml;if(U&&this.open)I.push(">");this._stack.push($),I.push("<"),I.push($),ek(I,Y),this.leaf=!0,this.open=!0}addAttribute($,Y){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(Y!==void 0)_70(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");ek(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(R70.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),Y=this._xml;if(this.leaf)Y.push("/>");else Y.push("</"),Y.push($),Y.push(">");this.open=!1,this.leaf=!1}leafNode($,Y,U){if(this.openNode($,Y),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("")}}$x.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};v70.exports=$x});var Yx=j((V01)=>{var S70=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function q01($){if(typeof $==="string")return $;if(S70)return S70.decode($);return $.toString()}V01.bufferToString=q01});var x70=j((g70)=>{Object.defineProperty(g70,"__esModule",{value:!0});g70.CHAR=`
\r -퟿-�\uD800\uDC00-\uDBFF\uDFFF`;g70.S=` \r
`;g70.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";g70.NAME_CHAR="-"+g70.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";g70.CHAR_RE=new RegExp("^["+g70.CHAR+"]$","u");g70.S_RE=new RegExp("^["+g70.S+"]+$","u");g70.NAME_START_CHAR_RE=new RegExp("^["+g70.NAME_START_CHAR+"]$","u");g70.NAME_CHAR_RE=new RegExp("^["+g70.NAME_CHAR+"]$","u");g70.NAME_RE=new RegExp("^["+g70.NAME_START_CHAR+"]["+g70.NAME_CHAR+"]*$","u");g70.NMTOKEN_RE=new RegExp("^["+g70.NAME_CHAR+"]+$","u");var Ux=9,Ix=10,Qx=13,Jx=32;g70.S_LIST=[Jx,Ix,Qx,Ux];function F01($){return $>=Jx&&$<=55295||$===Ix||$===Qx||$===Ux||$>=57344&&$<=65533||$>=65536&&$<=1114111}g70.isChar=F01;function w01($){return $===Jx||$===Ix||$===Qx||$===Ux}g70.isS=w01;function h70($){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}g70.isNameStartChar=h70;function M01($){return h70($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}g70.isNameChar=M01});var l70=j((n70)=>{Object.defineProperty(n70,"__esModule",{value:!0});n70.CHAR="\x01-퟿-�\uD800\uDC00-\uDBFF\uDFFF";n70.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F-„†-Ÿ";n70.S=` \r
`;n70.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";n70.NAME_CHAR="-"+n70.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";n70.CHAR_RE=new RegExp("^["+n70.CHAR+"]$","u");n70.RESTRICTED_CHAR_RE=new RegExp("^["+n70.RESTRICTED_CHAR+"]$","u");n70.S_RE=new RegExp("^["+n70.S+"]+$","u");n70.NAME_START_CHAR_RE=new RegExp("^["+n70.NAME_START_CHAR+"]$","u");n70.NAME_CHAR_RE=new RegExp("^["+n70.NAME_CHAR+"]$","u");n70.NAME_RE=new RegExp("^["+n70.NAME_START_CHAR+"]["+n70.NAME_CHAR+"]*$","u");n70.NMTOKEN_RE=new RegExp("^["+n70.NAME_CHAR+"]+$","u");var f70=9,u70=10,b70=13,i70=32;n70.S_LIST=[i70,u70,b70,f70];function _01($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}n70.isChar=_01;function v01($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}n70.isRestrictedChar=v01;function S01($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}n70.isCharAndNotRestricted=S01;function h01($){return $===i70||$===u70||$===b70||$===f70}n70.isS=h01;function c70($){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}n70.isNameStartChar=c70;function g01($){return c70($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}n70.isNameChar=g01});var s70=j((r70)=>{Object.defineProperty(r70,"__esModule",{value:!0});r70.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";r70.NC_NAME_CHAR="-"+r70.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";r70.NC_NAME_START_CHAR_RE=new RegExp("^["+r70.NC_NAME_START_CHAR+"]$","u");r70.NC_NAME_CHAR_RE=new RegExp("^["+r70.NC_NAME_CHAR+"]$","u");r70.NC_NAME_RE=new RegExp("^["+r70.NC_NAME_START_CHAR+"]["+r70.NC_NAME_CHAR+"]*$","u");function o70($){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}r70.isNCNameStartChar=o70;function r01($){return o70($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}r70.isNCNameChar=r01});var M20=j((w20)=>{Object.defineProperty(w20,"__esModule",{value:!0});var kJ=x70(),Y11=l70(),Ox=s70(),a8=kJ.isS,U11=kJ.isChar,fW=kJ.isNameStartChar,a70=kJ.isNameChar,X20=kJ.S_LIST,I11=kJ.NAME_RE,Q11=Y11.isChar,J11=Ox.isNCNameStartChar,K11=Ox.isNCNameChar,z11=Ox.NC_NAME_RE,wN="http://www.w3.org/XML/1998/namespace",yJ="http://www.w3.org/2000/xmlns/",G11={__proto__:null,xml:wN,xmlns:yJ},H11={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},u4=-1,V9=-2,t70=0,W11=1,zx=2,X11=3,SJ=4,Z11=5,q11=6,V11=7,Gx=8,L11=9,F11=10,w11=11,M11=12,y8=13,ZN=14,Hx=15,O11=16,Wx=17,N11=18,D11=19,Xx=20,B11=21,A11=22,P11=23,e70=24,Zx=25,qN=26,$20=27,T11=28,E11=29,Y20=30,j11=31,C11=32,LU=33,R11=34,qx=35,uW=36,Vx=37,_11=38,U20=39,I20=40,v11=41,Q20=42,S11=43,h11=44,Lx=9,B5=10,Fx=13,J20=32,K20=33,Z20=34,bW=38,q20=39,VN=45,LN=47,g11=59,Q2=60,hJ=61,j6=62,t6=63,V20=91,gJ=93,z20=133,G20=8232,FN=($)=>$===Z20||$===q20,L20=[Z20,q20],y11=[...L20,V20,j6],k11=[...L20,Q2,gJ],x11=[hJ,t6,...X20],f11=[...X20,j6,bW,Q2];function Mx($,Y,U){switch(Y){case"xml":if(U!==wN)$.fail(`xml prefix must be bound to ${wN}.`);break;case"xmlns":if(U!==yJ)$.fail(`xmlns prefix must be bound to ${yJ}.`);break;default:}switch(U){case yJ:$.fail(Y===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${yJ}.`);break;case wN:switch(Y){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 u11($,Y){for(let U of Object.keys(Y))Mx($,U,Y[U])}var b11=($)=>z11.test($),i11=($)=>I11.test($),FU=0,H20=1,wx=2;w20.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var W20={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 F20{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let Y=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,Y){this.nameStartCheck=J11,this.nameCheck=K11,this.isName=b11,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},G11);let U=this.opt.additionalNamesp Line truncated
`,Y=this.i}}captureToChar($){let{i:Y}=this,{chunk:U}=this;while(!0){let I=this.getCode();switch(I){case V9:this.text+=`${U.slice(Y,this.prevI)}
`,Y=this.i,I=B5;break;case u4:return this.text+=U.slice(Y),!1;default:}if(I===$)return this.text+=U.slice(Y,this.prevI),!0}}captureNameChars(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCode();if(U===u4)return this.name+=$.slice(Y),u4;if(!a70(U))return this.name+=$.slice(Y,this.prevI),U===V9?B5:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===u4||!a8($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=U11,this.getCode=this.getCode10;else this.isChar=Q11,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=W11}sBeginWhitespace(){let $=this.i,Y=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(Y){case Q2:if(this.state=Hx,this.text.length!==0)throw Error("no-empty text at start");break;case u4:break;default:this.unget(),this.state=y8,this.xmlDeclPossible=!1}}sDoctype(){var $;let Y=this.captureTo(y11);switch(Y){case j6:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=y8,this.doctype=!0;break}case u4:break;default:if(this.text+=String.fromCodePoint(Y),Y===V20)this.state=SJ;else if(FN(Y))this.state=X11,this.q=Y}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=zx}sDTD(){let $=this.captureTo(k11);if($===u4)return;if(this.text+=String.fromCodePoint($),$===gJ)this.state=zx;else if($===Q2)this.state=q11;else if(FN($))this.state=Z11,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=SJ,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case K20:this.state=V11,this.openWakaBang="";break;case t6:this.state=w11;break;default:this.state=SJ}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),Y=this.openWakaBang+=$;if(this.text+=$,Y!=="-")this.state=Y==="--"?Gx:SJ,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(VN))this.text+="-",this.state=L11}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===VN?F11:Gx}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===j6)this.state=SJ;else this.fail("malformed comment."),this.state=Gx}sDTDPI(){if(this.captureToChar(t6))this.text+="?",this.state=M11}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===j6)this.state=SJ}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:Y}=this;$:while(!0)switch(this.getCode()){case V9:this.entity+=`${Y.slice($,this.prevI)}
`,$=this.i;break;case g11:{let{entityReturnState:U}=this,I=this.entity+Y.slice($,this.prevI);this.state=U;let Q;if(I==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(I),this.entity="";if(U!==y8||this.textHandler!==void 0)this.text+=Q;break $}case u4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(fW($))this.state=R11,this.unget(),this.xmlDeclPossible=!1;else switch($){case LN:this.state=S11,this.xmlDeclPossible=!1;break;case K20:this.state=O11,this.openWakaBang="",this.xmlDeclPossible=!1;break;case t6:this.state=P11;break;default:this.fail("disallowed character in tag name"),this.state=y8,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=Xx,this.openWakaBang="";break;case"--":this.state=Wx,this.openWakaBang="";break;case"DOCTYPE":if(this.state=zx,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(VN))this.state=N11}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===VN)this.state=D11,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=Wx}sCommentEnded(){let $=this.getCodeNorm();if($!==j6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=Wx;else this.state=y8}sCData(){if(this.captureToChar(gJ))this.state=B11}sCDataEnding(){let $=this.getCodeNorm();if($===gJ)this.state=A11;else this.text+=`]${String.fromCodePoint($)}`,this.state=Xx}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case j6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=y8;break}case gJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=Xx}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=e70;else if($===t6||a8($))this.fail("processing instruction without a target."),this.state=$===t6?qN:Zx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=e70}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===u4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let I=U===t6;if(I||a8(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=I?LU:$20}else this.state=I?qN:Zx;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($===t6)this.state=qN;else if(!a8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(t6))this.state=qN}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===j6){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=y8}else if(Y===t6)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=Zx;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===t6){this.state=LU;return}if($!==u4)this.state=T11,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(x11);if($===t6){this.state=LU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(a8($)||$===hJ))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=$===hJ?Y20:E11}sXMLDeclEq(){let $=this.getCodeNorm();if($===t6){this.state=LU,this.fail("XML declaration is incomplete.");return}if(a8($))return;if($!==hJ)this.fail("value required.");this.state=Y20}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===t6){this.state=LU,this.fail("XML declaration is incomplete.");return}if(a8($))return;if(!FN($))this.fail("value must be quoted."),this.q=J20;else this.q=$;this.state=j11}sXMLDeclValue(){let $=this.captureTo([this.q,t6]);if($===t6){this.state=LU,this.text="",this.fail("XML declaration is incomplete.");return}if($===u4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=Y;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver Line truncated
`;$=this.i,Y=FU;break;case u4:if(I!==void 0)this.text+=U.slice($);break $;default:Y=FU}this.forbiddenState=Y}handleTextOutsideRoot(){let{i:$}=this,{chunk:Y,textHandler:U}=this,I=!1;$:while(!0){let Q=this.getCode();switch(Q){case Q2:{if(this.state=Hx,U!==void 0){let{text:J}=this,K=Y.slice($,this.prevI);if(J.length!==0)U(J+K),this.text="";else if(K.length!==0)U(K)}break $}case bW:if(this.state=ZN,this.entityReturnState=y8,U!==void 0)this.text+=Y.slice($,this.prevI);I=!0;break $;case V9:if(U!==void 0)this.text+=`${Y.slice($,this.prevI)}
`;$=this.i;break;case u4:if(U!==void 0)this.text+=Y.slice($);break $;default:if(!a8(Q))I=!0}}if(!I)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($,Y){var U;let{prefix:I,local:Q}=this.qname($),J={name:$,prefix:I,local:Q,value:Y};if(this.attribList.push(J),(U=this.attributeHandler)===null||U===void 0||U.call(this,J),I==="xmlns"){let K=Y.trim();if(this.currentXMLVersion==="1.0"&&K==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[Q]=K,Mx(this,Q,K)}else if($==="xmlns"){let K=Y.trim();this.topNS[""]=K,Mx(this,"",K)}}pushAttribPlain($,Y){var U;let I={name:$,value:Y};this.attribList.push(I),(U=this.attributeHandler)===null||U===void 0||U.call(this,I)}end(){var $,Y;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:U}=this;while(U.length>0){let Q=U.pop();this.fail(`unclosed tag: ${Q.name}`)}if(this.state!==t70&&this.state!==y8)this.fail("unexpected end.");let{text:I}=this;if(I.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,I),this.text="";return this._closed=!0,(Y=this.endHandler)===null||Y===void 0||Y.call(this),this._init(),this}resolve($){var Y,U;let I=this.topNS[$];if(I!==void 0)return I;let{tags:Q}=this;for(let J=Q.length-1;J>=0;J--)if(I=Q[J].ns[$],I!==void 0)return I;if(I=this.ns[$],I!==void 0)return I;return(U=(Y=this.opt).resolvePrefix)===null||U===void 0?void 0:U.call(Y,$)}qname($){let Y=$.indexOf(":");if(Y===-1)return{prefix:"",local:$};let U=$.slice(Y+1),I=$.slice(0,Y);if(I===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:I,local:U}}processAttribsNS(){var $;let{attribList:Y}=this,U=this.tag;{let{prefix:J,local:K}=this.qname(U.name);U.prefix=J,U.local=K;let z=U.uri=($=this.resolve(J))!==null&&$!==void 0?$:"";if(J!==""){if(J==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(z==="")this.fail(`unbound namespace prefix: ${JSON.stringify(J)}.`),U.uri=J}}if(Y.length===0)return;let{attributes:I}=U,Q=new Set;for(let J of Y){let{name:K,prefix:z,local:G}=J,H,W;if(z==="")H=K==="xmlns"?yJ:"",W=K;else{if(H=this.resolve(z),H===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(z)}.`),H=z;W=`{${H}}${G}`}if(Q.has(W))this.fail(`duplicate attribute: ${W}.`);Q.add(W),J.uri=H,I[K]=J}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,Y=this.tag.attributes;for(let{name:U,value:I}of $){if(Y[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);Y[U]=I}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:Y}=this,U=this.tag;U.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,U),Y.push(U),this.state=y8,this.name=""}openSelfClosingTag(){var $,Y,U;this.processAttribs();let{tags:I}=this,Q=this.tag;if(Q.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,Q),(Y=this.closeTagHandler)===null||Y===void 0||Y.call(this,Q),(this.tag=(U=I[I.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=y8,this.name=""}closeTag(){let{tags:$,name:Y}=this;if(this.state=y8,this.name="",Y===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,I=$.length;while(I-- >0){let Q=this.tag=$.pop();if(this.topNS=Q.ns,U===null||U===void 0||U(Q),Q.name===Y)break;this.fail("unexpected close tag.")}if(I===0)this.closedRoot=!0;else if(I<0)this.fail(`unmatched closing tag: ${Y}.`),this.text+=`</${Y}>`}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 Y=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))Y=parseInt($.slice(2),16);else if(/^#[0-9]+$/.test($))Y=parseInt($.slice(1),10);if(!this.isChar(Y))return this.fail("malformed character entity."),`&${$};`;return String.fromCodePoint(Y)}}w20.SaxesParser=F20});var iW=j((no1,O20)=>{var{SaxesParser:d11}=M20(),{PassThrough:p11}=g8(),{bufferToString:m11}=Yx();O20.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new p11);let Y=new d11,U;Y.on("error",(Q)=>{U=Q});let I=[];Y.on("opentag",(Q)=>I.push({eventType:"opentag",value:Q})),Y.on("text",(Q)=>I.push({eventType:"text",value:Q})),Y.on("closetag",(Q)=>I.push({eventType:"closetag",value:Q}));for await(let Q of $){if(Y.write(m11(Q)),U)throw U;yield I,I=[]}}});var g0=j((do1,N20)=>{var l11=iW(),o11=a6();class xJ{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,Y){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof xJ)$.reset();else if($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}async parse($){for await(let Y of $)for(let{eventType:U,value:I}of Y)if(U==="opentag")this.parseOpen(I);else if(U==="text")this.parseText(I);else if(U==="closetag"){if(!this.parseClose(I.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&&((Y=$.writeHeaders)!==null&&Y!==void 0?Y:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}sK0.FormatterOptions=rK0});var sN=j((La1,Yz0)=>{var Q31="[object AsyncFunction]",J31="[object Function]",K31="[object GeneratorFunction]",z31="[object Null]",G31="[object Proxy]",H31="[object Undefined]",W31=typeof global=="object"&&global&&global.Object===Object&&global,X31=typeof self=="object"&&self&&self.Object===Object&&self,Z31=W31||X31||Function("return this")(),eK0=Object.prototype,q31=eK0.hasOwnProperty,$z0=eK0.toString,tK0=Z31.Symbol,AU=tK0?tK0.toStringTag:void 0;function V31($){if($==null)return $===void 0?H31:z31;return AU&&AU in Object($)?L31($):F31($)}function L31($){var Y=q31.call($,AU),U=$[AU];try{$[AU]=void 0;var I=!0}catch(J){}var Q=$z0.call($);if(I)if(Y)$[AU]=U;else delete $[AU];return Q}function F31($){return $z0.call($)}function w31($){if(!M31($))return!1;var Y=V31($);return Y==J31||Y==K31||Y==Q31||Y==G31}function M31($){var Y=typeof $;return $!=null&&(Y=="object"||Y=="function")}Yz0.exports=w31});var kz0=j((aN,lJ)=>{var O31=200,nf="__lodash_hash_undefined__",JD=1,qz0=2,Vz0=9007199254740991,tN="[object Arguments]",yf="[object Array]",N31="[object AsyncFunction]",Lz0="[object Boolean]",Fz0="[object Date]",wz0="[object Error]",Mz0="[object Function]",D31="[object GeneratorFunction]",eN="[object Map]",Oz0="[object Number]",B31="[object Null]",mJ="[object Object]",Uz0="[object Promise]",A31="[object Proxy]",Nz0="[object RegExp]",$D="[object Set]",Dz0="[object String]",P31="[object Symbol]",T31="[object Undefined]",kf="[object WeakMap]",Bz0="[object ArrayBuffer]",YD="[object DataView]",E31="[object Float32Array]",j31="[object Float64Array]",C31="[object Int8Array]",R31="[object Int16Array]",_31="[object Int32Array]",v31="[object Uint8Array]",S31="[object Uint8ClampedArray]",h31="[object Uint16Array]",g31="[object Uint32Array]",y31=/[\\^$.*+?()[\]{}|]/g,k31=/^\[object .+?Constructor\]$/,x31=/^(?:0|[1-9]\d*)$/,j4={};j4[E31]=j4[j31]=j4[C31]=j4[R31]=j4[_31]=j4[v31]=j4[S31]=j4[h31]=j4[g31]=!0;j4[tN]=j4[yf]=j4[Bz0]=j4[Lz0]=j4[YD]=j4[Fz0]=j4[wz0]=j4[Mz0]=j4[eN]=j4[Oz0]=j4[mJ]=j4[Nz0]=j4[$D]=j4[Dz0]=j4[kf]=!1;var Az0=typeof global=="object"&&global&&global.Object===Object&&global,f31=typeof self=="object"&&self&&self.Object===Object&&self,D3=Az0||f31||Function("return this")(),Pz0=typeof aN=="object"&&aN&&!aN.nodeType&&aN,Iz0=Pz0&&typeof lJ=="object"&&lJ&&!lJ.nodeType&&lJ,Tz0=Iz0&&Iz0.exports===Pz0,Sf=Tz0&&Az0.process,Qz0=function(){try{return Sf&&Sf.binding&&Sf.binding("util")}catch($){}}(),Jz0=Qz0&&Qz0.isTypedArray;function u31($,Y){var U=-1,I=$==null?0:$.length,Q=0,J=[];while(++U<I){var K=$[U];if(Y(K,U,$))J[Q++]=K}return J}function b31($,Y){var U=-1,I=Y.length,Q=$.length;while(++U<I)$[Q+U]=Y[U];return $}function i31($,Y){var U=-1,I=$==null?0:$.length;while(++U<I)if(Y($[U],U,$))return!0;return!1}function c31($,Y){var U=-1,I=Array($);while(++U<$)I[U]=Y(U);return I}function n31($){return function(Y){return $(Y)}}function d31($,Y){return $.has(Y)}function p31($,Y){return $==null?void 0:$[Y]}function m31($){var Y=-1,U=Array($.size);return $.forEach(function(I,Q){U[++Y]=[Q,I]}),U}function l31($,Y){return function(U){return $(Y(U))}}function o31($){var Y=-1,U=Array($.size);return $.forEach(function(I){U[++Y]=I}),U}var r31=Array.prototype,s31=Function.prototype,KD=Object.prototype,hf=D3["__core-js_shared__"],Ez0=s31.toString,F9=KD.hasOwnProperty,Kz0=function(){var $=/[^.]+$/.exec(hf&&hf.keys&&hf.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),jz0=KD.toString,a31=RegExp("^"+Ez0.call(F9).replace(y31,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),zz0=Tz0?D3.Buffer:void 0,UD=D3.Symbol,Gz0=D3.Uint8Array,Cz0=KD.propertyIsEnumerable,t31=r31.splice,PU=UD?UD.toStringTag:void 0,Hz0=Object.getOwnPropertySymbols,e31=zz0?zz0.isBuffer:void 0,$71=l31(Object.keys,Object),xf=oJ(D3,"DataView"),oW=oJ(D3,"Map"),ff=oJ(D3,"Promise"),uf=oJ(D3,"Set"),bf=oJ(D3,"WeakMap"),rW=oJ(Object,"create"),Y71=jU(xf),U71=jU(oW),I71=jU(ff),Q71=jU(uf),J71=jU(bf),Wz0=UD?UD.prototype:void 0,gf=Wz0?Wz0.valueOf:void 0;function TU($){var Y=-1,U=$==null?0:$.length;this.clear();while(++Y<U){var I=$[Y];this.set(I[0],I[1])}}function K71(){this.__data__=rW?rW(null):{},this.size=0}function z71($){var Y=this.has($)&&delete this.__data__[$];return this.size-=Y?1:0,Y}function G71($){var Y=this.__data Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(Y)}set headers($){this._headers=$}shouldQuote($,Y){let U=Y?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(V21.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,Y,U){let I=`${L21.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:Q}=this;if(Q.quote!==""){if(I.indexOf(Q.quote)!==-1)return this.quoteField(I.replace(this.REPLACE_REGEXP,Q.escapedQuote))}if(I.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(Y,U))return this.quoteField(I);return I}quoteField($){let{quote:Y}=this.formatterOptions;return`${Y}${$}${Y}`}}rJ.FieldFormatter=pz0});var of=j((mz0)=>{Object.defineProperty(mz0,"__esModule",{value:!0});mz0.isSyncTransform=void 0;mz0.isSyncTransform=($)=>$.length===1});var rz0=j((sJ)=>{var oz0=sJ&&sJ.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(sJ,"__esModule",{value:!0});sJ.RowFormatter=void 0;var w21=oz0(sN()),M21=oz0(kz0()),O21=lf(),N21=of();class CU{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new O21.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(CU.isRowHashArray($))return $.map((Y)=>Y[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(N21.isSyncTransform($))return(Y,U)=>{let I=null;try{I=$(Y)}catch(Q){return U(Q)}return U(null,I)};return(Y,U)=>{$(Y,U)}}set rowTransform($){if(!w21.default($))throw TypeError("The transform should be a function");this._rowTransform=CU.createTransform($)}format($,Y){this.callTransformer($,(U,I)=>{if(U)return Y(U);if(!$)return Y(null);let Q=[];if(I){let{shouldFormatColumns:J,headers:K}=this.checkHeaders(I);if(this.shouldWriteHeaders&&K&&!this.hasWrittenHeaders)Q.push(this.formatColumns(K,!0)),this.hasWrittenHeaders=!0;if(J){let z=this.gatherColumns(I);Q.push(this.formatColumns(z,!1))}}return Y(null,Q)})}finish($){let Y=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));Y.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)Y.push(this.formatterOptions.rowDelimiter);return $(null,Y)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let Y=CU.gatherHeaders($);if(this.headers=Y,this.fieldFormatter.headers=Y,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!M21.default(Y,$),headers:Y}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((Y)=>$[Y]);if(CU.isRowHashArray($))return this.headers.map((Y,U)=>{let I=$[U];if(I)return I[1];return""});if(CU.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((Y,U)=>$[U])}callTransformer($,Y){if(!this._rowTransform)return Y(null,$);return this._rowTransform($,Y)}formatColumns($,Y){let U=$.map((Q,J)=>this.fieldFormatter.format(Q,J,Y)).join(this.formatterOptions.delimiter),{rowCount:I}=this;if(this.rowCount+=1,I)return[this.formatterOptions.rowDelimiter,U].join("");return U}}sJ.RowFormatter=CU});var sz0=j((HD)=>{Object.defineProperty(HD,"__esModule",{value:!0});HD.FieldFormatter=HD.RowFormatter=void 0;var D21=rz0();Object.defineProperty(HD,"RowFormatter",{enumerable:!0,get:function(){return D21.RowFormatter}});var B21=lf();Object.defineProperty(HD,"FieldFormatter",{enumerable:!0,get:function(){return B21.FieldFormatter}})});var rf=j((tz0)=>{Object.defineProperty(tz0,"__esModule",{value:!0});tz0.CsvFormatterStream=void 0;var P21=K0("stream"),T21=sz0();class az0 extends P21.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new T21.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,Y,U){let I=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(Q,J)=>{if(Q)return I=!0,U(Q);if(J)J.forEach((K)=>{this.push(Buffer.from(K,"utf8"))});return I=!0,U()})}catch(Q){if(I)throw Q;U(Q)}}_flush($){this.rowFormatter.finish((Y,U)=>{if(Y)return $(Y);if(U)U.forEach((I)=>{this.push(Buffer.from(I,"utf8"))});return $()})}}tz0.CsvFormatterStream=az0});var YG0=j((t1)=>{var $G0=t1&&t1.__createBinding||(Object.create?function($,Y,U,I){if(I===void 0)I=U;Object.defineProperty($,I,{enumerable:!0,get:function(){return Y[U]}})}:function($,Y,U,I){if(I===void 0)I=U;$[I]=Y[U]}),E21=t1&&t1.__setModuleDefault||(Object.create?function($,Y){O Line truncated
deps: ${W}}`};let Q={keyword:"dependencies",type:"object",schemaType:"object",error:$.error,code(G){let[H,W]=J(G);K(G,H),z(G,W)}};function J({schema:G}){let H={},W={};for(let X in G){if(X==="__proto__")continue;let Z=Array.isArray(G[X])?H:W;Z[X]=G[X]}return[H,W]}function K(G,H=G.schema){let{gen:W,data:X,it:Z}=G;if(Object.keys(H).length===0)return;let q=W.let("missing");for(let V in H){let w=H[V];if(w.length===0)continue;let M=(0,I.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:w.length,deps:w.join(", ")}),Z.allErrors)W.if(M,()=>{for(let F of w)(0,I.checkReportMissingProp)(G,F)});else W.if(Y._`${M} && (${(0,I.checkMissingProp)(G,w,q)})`),(0,I.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=K;function z(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let w in H){if((0,U.alwaysValidSchema)(q,H[w]))continue;W.if((0,I.propertyInData)(W,X,w,q.opts.ownProperties),()=>{let M=G.subschema({keyword:Z,schemaProp:w},V);G.mergeValidEvaluated(M,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=z,$.default=Q}),Xc0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=F1(),U=v1(),I={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:Q})=>Y._`{propertyName: ${Q.propertyName}}`},code(Q){let{gen:J,schema:K,data:z,it:G}=Q;if((0,U.alwaysValidSchema)(G,K))return;let H=J.name("valid");J.forIn("key",z,(W)=>{Q.setParams({propertyName:W}),Q.subschema({keyword:"propertyNames",data:W,dataTypes:["string"],propertyName:W,compositeRule:!0},H),J.if((0,Y.not)(H),()=>{if(Q.error(!0),!G.allErrors)J.break()})}),Q.ok(H)}};$.default=I}),$00=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=L5(),U=F1(),I=V5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:K})=>U._`{additionalProperty: ${K.additionalProperty}}`},code(K){let{gen:z,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=K;if(!X)throw Error("ajv implementation error");let{allErrors:q,opts:V}=Z;if(Z.props=!0,V.removeAdditional!=="all"&&(0,Q.alwaysValidSchema)(Z,G))return;let w=(0,Y.allSchemaProperties)(H.properties),M=(0,Y.allSchemaProperties)(H.patternProperties);F(),K.ok(U._`${X} === ${I.default.errors}`);function F(){z.forIn("key",W,(T)=>{if(!w.length&&!M.length)D(T);else z.if(N(T),()=>D(T))})}function N(T){let B;if(w.length>8){let E=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");B=(0,Y.isOwnProperty)(z,E,T)}else if(w.length)B=(0,U.or)(...w.map((E)=>U._`${T} === ${E}`));else B=U.nil;if(M.length)B=(0,U.or)(B,...M.map((E)=>U._`${(0,Y.usePattern)(K,E)}.test(${T})`));return(0,U.not)(B)}function O(T){z.code(U._`delete ${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){O(T);return}if(G===!1){if(K.setParams({additionalProperty:T}),K.error(),!q)z.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let B=z.name("valid");if(V.removeAdditional==="failing")P(T,B,!1),z.if((0,U.not)(B),()=>{K.reset(),O(T)});else if(P(T,B),!q)z.if((0,U.not)(B),()=>z.break())}}function P(T,B,E){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(E===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});K.subschema(C,B)}}};$.default=J}),Zc0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=mQ(),U=L5(),I=v1(),Q=$00(),J={keyword:"properties",type:"object",schemaType:"object",code(K){let{gen:z,schema:G,parentSchema:H,data:W,it:X}=K;if(X.opts.removeAdditional==="all"&&H.additionalProperties===void 0)Q.default.code(new Y.KeywordCxt(X,Q.default,"additionalProperties"));let Z=(0,U.allSchemaProperties)(G);for(let F of Z)X.definedProperties.add(F);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=I.mergeEvaluated.props(z,(0,I.toHash)(Z),X.props);let q=Z.filter((F)=>!(0,I.alwaysValidSchema)(X,G[F]));if(q.length===0)return;let V=z.name("valid");for(let F of q){if(w(F))M(F);else{if(z.if((0,U.propertyInData)(z,W,F,X.opts.ownProperties)),M(F),!X.allErrors)z.else().var(V,!0);z.endIf()}K.it.definedProperties.add(F),K.ok(V)}function w(F){return X.opts.useDefaults&&!X.compositeRule&&G[F].default!==void 0}function M(F){K.subschema({keyword:"properties",schemaProp:F,dataProp:F},V)}}};$.default=J}),qc0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=L5(),U=F1(),I=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(K){let{gen:z,schema:G,data:H,parentSchema:W,it:X}=K,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,I.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let w=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,M=z.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,Q.evaluatedPropsToName)(z,X.props);let{props:F}=X;N();function N(){for(let P of q){if(w)O(P);if(X.allError Line truncated
\x00`,x+=B4(E,2),x+=z.magic,x+=B4(M,2),x+=B4(F,2),x+=B4(B.crc32,4),x+=B4(B.compressedSize,4),x+=B4(B.uncompressedSize,4),x+=B4(H.length,2),x+=B4(N.length,2);var g=dO.LOCAL_FILE_HEADER+x+H+N,b=dO.CENTRAL_FILE_HEADER+B4(i,2)+x+B4(Z.length,2)+"\x00\x00\x00\x00"+B4(C,4)+B4(I,4)+H+N+Z;return{fileRecord:g,dirRecord:b}},La0=function($,Y,U,I,Q){var J="",K=jJ.transformTo("string",Q(I));return J=dO.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+B4($,2)+B4($,2)+B4(Y,4)+B4(U,4)+B4(K.length,2)+K,J},Fa0=function($){var Y="";return Y=dO.DATA_DESCRIPTOR+B4($.crc32,4)+B4($.compressedSize,4)+B4($.uncompressedSize,4),Y};function B5($,Y,U,I){CJ.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=U,this.encodeFileName=I,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}jJ.inherits(B5,CJ);B5.prototype.push=function($){var Y=$.meta.percent||0,U=this.entriesCount,I=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,CJ.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(Y+100*(U-I-1))/U:100}})};B5.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Y=this.streamFiles&&!$.file.dir;if(Y){var U=v90($,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};B5.prototype.closedSource=function($){this.accumulate=!1;var Y=this.streamFiles&&!$.file.dir,U=v90($,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),Y)this.push({data:Fa0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};B5.prototype.flush=function(){var $=this.bytesWritten;for(var Y=0;Y<this.dirRecords.length;Y++)this.push({data:this.dirRecords[Y],meta:{percent:100}});var U=this.bytesWritten-$,I=La0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:I,meta:{percent:100}})};B5.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};B5.prototype.registerPrevious=function($){this._sources.push($);var Y=this;return $.on("data",function(U){Y.processChunk(U)}),$.on("end",function(){if(Y.closedSource(Y.previous.streamInfo),Y._sources.length)Y.prepareNextSource();else Y.end()}),$.on("error",function(U){Y.error(U)}),this};B5.prototype.resume=function(){if(!CJ.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};B5.prototype.error=function($){var Y=this._sources;if(!CJ.prototype.error.call(this,$))return!1;for(var U=0;U<Y.length;U++)try{Y[U].error($)}catch(I){}return!0};B5.prototype.lock=function(){CJ.prototype.lock.call(this);var $=this._sources;for(var Y=0;Y<$.length;Y++)$[Y].lock()};S90.exports=B5});var g90=j((Na0)=>{var wa0=Nk(),Ma0=h90(),Oa0=function($,Y){var U=$||Y,I=wa0[U];if(!I)throw Error(U+" is not a valid compression method !");return I};Na0.generateWorker=function($,Y,U){var I=new Ma0(Y.streamFiles,U,Y.platform,Y.encodeFileName),Q=0;try{$.forEach(function(J,K){Q++;var z=Oa0(K.options.compression,Y.compression),G=K.options.compressionOptions||Y.compressionOptions||{},H=K.dir,W=K.date;K._compressWorker(z,G).withStreamInfo("file",{name:J,dir:H,date:W,comment:K.comment||"",unixPermissions:K.unixPermissions,dosPermissions:K.dosPermissions}).pipe(I)}),I.entriesCount=Q}catch(J){I.error(J)}return I}});var k90=j((Xo1,y90)=>{var Ba0=p4(),pO=L$();function CW($,Y){pO.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Y)}Ba0.inherits(CW,pO);CW.prototype._bindStream=function($){var Y=this;this._stream=$,$.pause(),$.on("data",function(U){Y.push({data:U,meta:{percent:0}})}).on("error",function(U){if(Y.isPaused)this.generatedError=U;else Y.error(U)}).on("end",function(){if(Y.isPaused)Y._upstreamEnded=!0;else Y.end()})};CW.prototype.pause=function(){if(!pO.prototype.pause.call(this))return!1;return this._stream.pause(),!0};CW.prototype.resume=function(){if(!pO.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};y90.exports=CW});var m90=j((Zo1,p90)=>{var Aa0=wJ(),RW=p4(),b90=L$(),Pa0=Ey(),i90=jy(),x90=EO(),Ta0=f$0(),Ea0=g90(),f90=zW(),ja0=k90(),c90=function($,Y,U){var I=RW.getTypeOf(Y),Q,J=RW.extend(U||{},i90);if(J.date=J.date||new Date,J.compression!==null)J.compression=J.compression.toUpperCase();if(typeof J.unixPermissions==="string")J.unixPermissions=parseInt(J.unixPermissions,8);if(J.unixPermissions&&J.unixPermissions&16384)J.dir=!0;if(J.dosPermissions&&J.dosPermission Line truncated
`)}openNode($,Y){let U=this.tos,I=this._xml;if(U&&this.open)I.push(">");this._stack.push($),I.push("<"),I.push($),Ix(I,Y),this.leaf=!0,this.open=!0}addAttribute($,Y){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(Y!==void 0)k70(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");Ix(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(y70.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),Y=this._xml;if(this.leaf)Y.push("/>");else Y.push("</"),Y.push($),Y.push(">");this.open=!1,this.leaf=!1}leafNode($,Y,U){if(this.openNode($,Y),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("")}}Qx.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};x70.exports=Qx});var Jx=j((M01)=>{var f70=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function w01($){if(typeof $==="string")return $;if(f70)return f70.decode($);return $.toString()}M01.bufferToString=w01});var n70=j((b70)=>{Object.defineProperty(b70,"__esModule",{value:!0});b70.CHAR=`
\r -퟿-�\uD800\uDC00-\uDBFF\uDFFF`;b70.S=` \r
`;b70.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";b70.NAME_CHAR="-"+b70.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";b70.CHAR_RE=new RegExp("^["+b70.CHAR+"]$","u");b70.S_RE=new RegExp("^["+b70.S+"]+$","u");b70.NAME_START_CHAR_RE=new RegExp("^["+b70.NAME_START_CHAR+"]$","u");b70.NAME_CHAR_RE=new RegExp("^["+b70.NAME_CHAR+"]$","u");b70.NAME_RE=new RegExp("^["+b70.NAME_START_CHAR+"]["+b70.NAME_CHAR+"]*$","u");b70.NMTOKEN_RE=new RegExp("^["+b70.NAME_CHAR+"]+$","u");var Kx=9,zx=10,Gx=13,Hx=32;b70.S_LIST=[Hx,zx,Gx,Kx];function N01($){return $>=Hx&&$<=55295||$===zx||$===Gx||$===Kx||$>=57344&&$<=65533||$>=65536&&$<=1114111}b70.isChar=N01;function D01($){return $===Hx||$===zx||$===Gx||$===Kx}b70.isS=D01;function u70($){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}b70.isNameStartChar=u70;function B01($){return u70($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}b70.isNameChar=B01});var e70=j((r70)=>{Object.defineProperty(r70,"__esModule",{value:!0});r70.CHAR="\x01-퟿-�\uD800\uDC00-\uDBFF\uDFFF";r70.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F-„†-Ÿ";r70.S=` \r
`;r70.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";r70.NAME_CHAR="-"+r70.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";r70.CHAR_RE=new RegExp("^["+r70.CHAR+"]$","u");r70.RESTRICTED_CHAR_RE=new RegExp("^["+r70.RESTRICTED_CHAR+"]$","u");r70.S_RE=new RegExp("^["+r70.S+"]+$","u");r70.NAME_START_CHAR_RE=new RegExp("^["+r70.NAME_START_CHAR+"]$","u");r70.NAME_CHAR_RE=new RegExp("^["+r70.NAME_CHAR+"]$","u");r70.NAME_RE=new RegExp("^["+r70.NAME_START_CHAR+"]["+r70.NAME_CHAR+"]*$","u");r70.NMTOKEN_RE=new RegExp("^["+r70.NAME_CHAR+"]+$","u");var d70=9,p70=10,m70=13,l70=32;r70.S_LIST=[l70,p70,m70,d70];function g01($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}r70.isChar=g01;function y01($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}r70.isRestrictedChar=y01;function k01($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}r70.isCharAndNotRestricted=k01;function x01($){return $===l70||$===p70||$===m70||$===d70}r70.isS=x01;function o70($){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}r70.isNameStartChar=o70;function f01($){return o70($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}r70.isNameChar=f01});var U20=j((Y20)=>{Object.defineProperty(Y20,"__esModule",{value:!0});Y20.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";Y20.NC_NAME_CHAR="-"+Y20.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";Y20.NC_NAME_START_CHAR_RE=new RegExp("^["+Y20.NC_NAME_START_CHAR+"]$","u");Y20.NC_NAME_CHAR_RE=new RegExp("^["+Y20.NC_NAME_CHAR+"]$","u");Y20.NC_NAME_RE=new RegExp("^["+Y20.NC_NAME_START_CHAR+"]["+Y20.NC_NAME_CHAR+"]*$","u");function $20($){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}Y20.isNCNameStartChar=$20;function e01($){return $20($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}Y20.isNCNameChar=e01});var P20=j((A20)=>{Object.defineProperty(A20,"__esModule",{value:!0});var bJ=n70(),J11=e70(),Ax=U20(),t8=bJ.isS,K11=bJ.isChar,cW=bJ.isNameStartChar,I20=bJ.isNameChar,w20=bJ.S_LIST,z11=bJ.NAME_RE,G11=J11.isChar,H11=Ax.isNCNameStartChar,W11=Ax.isNCNameChar,X11=Ax.NC_NAME_RE,NN="http://www.w3.org/XML/1998/namespace",uJ="http://www.w3.org/2000/xmlns/",Z11={__proto__:null,xml:NN,xmlns:uJ},q11={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},b4=-1,F9=-2,Q20=0,V11=1,Xx=2,L11=3,kJ=4,F11=5,w11=6,M11=7,Zx=8,O11=9,N11=10,D11=11,B11=12,k8=13,LN=14,qx=15,A11=16,Vx=17,P11=18,T11=19,Lx=20,E11=21,j11=22,C11=23,J20=24,Fx=25,FN=26,K20=27,R11=28,_11=29,z20=30,v11=31,S11=32,NU=33,h11=34,wx=35,nW=36,Mx=37,g11=38,G20=39,H20=40,y11=41,W20=42,k11=43,x11=44,Ox=9,P5=10,Nx=13,X20=32,Z20=33,M20=34,dW=38,O20=39,wN=45,MN=47,f11=59,K2=60,xJ=61,R6=62,$8=63,N20=91,fJ=93,q20=133,V20=8232,ON=($)=>$===M20||$===O20,D20=[M20,O20],u11=[...D20,N20,R6],b11=[...D20,K2,fJ],i11=[xJ,$8,...w20],c11=[...w20,R6,dW,K2];function Bx($,Y,U){switch(Y){case"xml":if(U!==NN)$.fail(`xml prefix must be bound to ${NN}.`);break;case"xmlns":if(U!==uJ)$.fail(`xmlns prefix must be bound to ${uJ}.`);break;default:}switch(U){case uJ:$.fail(Y===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${uJ}.`);break;case NN:switch(Y){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 n11($,Y){for(let U of Object.keys(Y))Bx($,U,Y[U])}var d11=($)=>X11.test($),p11=($)=>z11.test($),DU=0,L20=1,Dx=2;A20.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var F20={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 B20{constructor($){this.opt=$!==null&&$!==void 0?$:{},this.fragmentOpt=!!this.opt.fragment;let Y=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,Y){this.nameStartCheck=H11,this.nameCheck=W11,this.isName=d11,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},Z11);let U=this.opt.additionalNamesp Line truncated
`,Y=this.i}}captureToChar($){let{i:Y}=this,{chunk:U}=this;while(!0){let I=this.getCode();switch(I){case F9:this.text+=`${U.slice(Y,this.prevI)}
`,Y=this.i,I=P5;break;case b4:return this.text+=U.slice(Y),!1;default:}if(I===$)return this.text+=U.slice(Y,this.prevI),!0}}captureNameChars(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCode();if(U===b4)return this.name+=$.slice(Y),b4;if(!I20(U))return this.name+=$.slice(Y,this.prevI),U===F9?P5:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===b4||!t8($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=K11,this.getCode=this.getCode10;else this.isChar=G11,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=V11}sBeginWhitespace(){let $=this.i,Y=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(Y){case K2:if(this.state=qx,this.text.length!==0)throw Error("no-empty text at start");break;case b4:break;default:this.unget(),this.state=k8,this.xmlDeclPossible=!1}}sDoctype(){var $;let Y=this.captureTo(u11);switch(Y){case R6:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=k8,this.doctype=!0;break}case b4:break;default:if(this.text+=String.fromCodePoint(Y),Y===N20)this.state=kJ;else if(ON(Y))this.state=L11,this.q=Y}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=Xx}sDTD(){let $=this.captureTo(b11);if($===b4)return;if(this.text+=String.fromCodePoint($),$===fJ)this.state=Xx;else if($===K2)this.state=w11;else if(ON($))this.state=F11,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=kJ,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case Z20:this.state=M11,this.openWakaBang="";break;case $8:this.state=D11;break;default:this.state=kJ}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),Y=this.openWakaBang+=$;if(this.text+=$,Y!=="-")this.state=Y==="--"?Zx:kJ,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(wN))this.text+="-",this.state=O11}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===wN?N11:Zx}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===R6)this.state=kJ;else this.fail("malformed comment."),this.state=Zx}sDTDPI(){if(this.captureToChar($8))this.text+="?",this.state=B11}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===R6)this.state=kJ}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:Y}=this;$:while(!0)switch(this.getCode()){case F9:this.entity+=`${Y.slice($,this.prevI)}
`,$=this.i;break;case f11:{let{entityReturnState:U}=this,I=this.entity+Y.slice($,this.prevI);this.state=U;let Q;if(I==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(I),this.entity="";if(U!==k8||this.textHandler!==void 0)this.text+=Q;break $}case b4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(cW($))this.state=h11,this.unget(),this.xmlDeclPossible=!1;else switch($){case MN:this.state=k11,this.xmlDeclPossible=!1;break;case Z20:this.state=A11,this.openWakaBang="",this.xmlDeclPossible=!1;break;case $8:this.state=C11;break;default:this.fail("disallowed character in tag name"),this.state=k8,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=Lx,this.openWakaBang="";break;case"--":this.state=Vx,this.openWakaBang="";break;case"DOCTYPE":if(this.state=Xx,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(wN))this.state=P11}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===wN)this.state=T11,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=Vx}sCommentEnded(){let $=this.getCodeNorm();if($!==R6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=Vx;else this.state=k8}sCData(){if(this.captureToChar(fJ))this.state=E11}sCDataEnding(){let $=this.getCodeNorm();if($===fJ)this.state=j11;else this.text+=`]${String.fromCodePoint($)}`,this.state=Lx}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case R6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=k8;break}case fJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=Lx}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=J20;else if($===$8||t8($))this.fail("processing instruction without a target."),this.state=$===$8?FN:Fx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=J20}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===b4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let I=U===$8;if(I||t8(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=I?NU:K20}else this.state=I?FN:Fx;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($===$8)this.state=FN;else if(!t8($))this.text=String.fromCodePoint($)}else if(this.captureToChar($8))this.state=FN}sPIEnding(){var $;let Y=this.getCodeNorm();if(Y===R6){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=k8}else if(Y===$8)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=Fx;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===$8){this.state=NU;return}if($!==b4)this.state=R11,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(i11);if($===$8){this.state=NU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(t8($)||$===xJ))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=$===xJ?z20:_11}sXMLDeclEq(){let $=this.getCodeNorm();if($===$8){this.state=NU,this.fail("XML declaration is incomplete.");return}if(t8($))return;if($!==xJ)this.fail("value required.");this.state=z20}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===$8){this.state=NU,this.fail("XML declaration is incomplete.");return}if(t8($))return;if(!ON($))this.fail("value must be quoted."),this.q=X20;else this.q=$;this.state=v11}sXMLDeclValue(){let $=this.captureTo([this.q,$8]);if($===$8){this.state=NU,this.text="",this.fail("XML declaration is incomplete.");return}if($===b4)return;let Y=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let U=Y;if(this.xmlDecl.version=U,!/^1\.[0-9]+$/.test(U))this.fail("ver Line truncated
`;$=this.i,Y=DU;break;case b4:if(I!==void 0)this.text+=U.slice($);break $;default:Y=DU}this.forbiddenState=Y}handleTextOutsideRoot(){let{i:$}=this,{chunk:Y,textHandler:U}=this,I=!1;$:while(!0){let Q=this.getCode();switch(Q){case K2:{if(this.state=qx,U!==void 0){let{text:J}=this,K=Y.slice($,this.prevI);if(J.length!==0)U(J+K),this.text="";else if(K.length!==0)U(K)}break $}case dW:if(this.state=LN,this.entityReturnState=k8,U!==void 0)this.text+=Y.slice($,this.prevI);I=!0;break $;case F9:if(U!==void 0)this.text+=`${Y.slice($,this.prevI)}
`;$=this.i;break;case b4:if(U!==void 0)this.text+=Y.slice($);break $;default:if(!t8(Q))I=!0}}if(!I)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($,Y){var U;let{prefix:I,local:Q}=this.qname($),J={name:$,prefix:I,local:Q,value:Y};if(this.attribList.push(J),(U=this.attributeHandler)===null||U===void 0||U.call(this,J),I==="xmlns"){let K=Y.trim();if(this.currentXMLVersion==="1.0"&&K==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[Q]=K,Bx(this,Q,K)}else if($==="xmlns"){let K=Y.trim();this.topNS[""]=K,Bx(this,"",K)}}pushAttribPlain($,Y){var U;let I={name:$,value:Y};this.attribList.push(I),(U=this.attributeHandler)===null||U===void 0||U.call(this,I)}end(){var $,Y;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:U}=this;while(U.length>0){let Q=U.pop();this.fail(`unclosed tag: ${Q.name}`)}if(this.state!==Q20&&this.state!==k8)this.fail("unexpected end.");let{text:I}=this;if(I.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,I),this.text="";return this._closed=!0,(Y=this.endHandler)===null||Y===void 0||Y.call(this),this._init(),this}resolve($){var Y,U;let I=this.topNS[$];if(I!==void 0)return I;let{tags:Q}=this;for(let J=Q.length-1;J>=0;J--)if(I=Q[J].ns[$],I!==void 0)return I;if(I=this.ns[$],I!==void 0)return I;return(U=(Y=this.opt).resolvePrefix)===null||U===void 0?void 0:U.call(Y,$)}qname($){let Y=$.indexOf(":");if(Y===-1)return{prefix:"",local:$};let U=$.slice(Y+1),I=$.slice(0,Y);if(I===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:I,local:U}}processAttribsNS(){var $;let{attribList:Y}=this,U=this.tag;{let{prefix:J,local:K}=this.qname(U.name);U.prefix=J,U.local=K;let z=U.uri=($=this.resolve(J))!==null&&$!==void 0?$:"";if(J!==""){if(J==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(z==="")this.fail(`unbound namespace prefix: ${JSON.stringify(J)}.`),U.uri=J}}if(Y.length===0)return;let{attributes:I}=U,Q=new Set;for(let J of Y){let{name:K,prefix:z,local:G}=J,H,W;if(z==="")H=K==="xmlns"?uJ:"",W=K;else{if(H=this.resolve(z),H===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(z)}.`),H=z;W=`{${H}}${G}`}if(Q.has(W))this.fail(`duplicate attribute: ${W}.`);Q.add(W),J.uri=H,I[K]=J}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,Y=this.tag.attributes;for(let{name:U,value:I}of $){if(Y[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);Y[U]=I}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:Y}=this,U=this.tag;U.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,U),Y.push(U),this.state=k8,this.name=""}openSelfClosingTag(){var $,Y,U;this.processAttribs();let{tags:I}=this,Q=this.tag;if(Q.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,Q),(Y=this.closeTagHandler)===null||Y===void 0||Y.call(this,Q),(this.tag=(U=I[I.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=k8,this.name=""}closeTag(){let{tags:$,name:Y}=this;if(this.state=k8,this.name="",Y===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,I=$.length;while(I-- >0){let Q=this.tag=$.pop();if(this.topNS=Q.ns,U===null||U===void 0||U(Q),Q.name===Y)break;this.fail("unexpected close tag.")}if(I===0)this.closedRoot=!0;else if(I<0)this.fail(`unmatched closing tag: ${Y}.`),this.text+=`</${Y}>`}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 Y=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))Y=parseInt($.slice(2),16);else if(/^#[0-9]+$/.test($))Y=parseInt($.slice(1),10);if(!this.isChar(Y))return this.fail("malformed character entity."),`&${$};`;return String.fromCodePoint(Y)}}A20.SaxesParser=B20});var pW=j((ro1,T20)=>{var{SaxesParser:o11}=P20(),{PassThrough:r11}=y8(),{bufferToString:s11}=Jx();T20.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new r11);let Y=new o11,U;Y.on("error",(Q)=>{U=Q});let I=[];Y.on("opentag",(Q)=>I.push({eventType:"opentag",value:Q})),Y.on("text",(Q)=>I.push({eventType:"text",value:Q})),Y.on("closetag",(Q)=>I.push({eventType:"closetag",value:Q}));for await(let Q of $){if(Y.write(s11(Q)),U)throw U;yield I,I=[]}}});var k0=j((so1,E20)=>{var a11=pW(),t11=e6();class iJ{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,Y){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof iJ)$.reset();else if($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}async parse($){for await(let Y of $)for(let{eventType:U,value:I}of Y)if(U==="opentag")this.parseOpen(I);else if(U==="text")this.parseText(I);else if(U==="closetag"){if(!this.parseClose(I.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&&((Y=$.writeHeaders)!==null&&Y!==void 0?Y:!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}Uz0.FormatterOptions=Yz0});var eN=j((Da1,zz0)=>{var G31="[object AsyncFunction]",H31="[object Function]",W31="[object GeneratorFunction]",X31="[object Null]",Z31="[object Proxy]",q31="[object Undefined]",V31=typeof global=="object"&&global&&global.Object===Object&&global,L31=typeof self=="object"&&self&&self.Object===Object&&self,F31=V31||L31||Function("return this")(),Jz0=Object.prototype,w31=Jz0.hasOwnProperty,Kz0=Jz0.toString,Qz0=F31.Symbol,CU=Qz0?Qz0.toStringTag:void 0;function M31($){if($==null)return $===void 0?q31:X31;return CU&&CU in Object($)?O31($):N31($)}function O31($){var Y=w31.call($,CU),U=$[CU];try{$[CU]=void 0;var I=!0}catch(J){}var Q=Kz0.call($);if(I)if(Y)$[CU]=U;else delete $[CU];return Q}function N31($){return Kz0.call($)}function D31($){if(!B31($))return!1;var Y=M31($);return Y==H31||Y==W31||Y==G31||Y==Z31}function B31($){var Y=typeof $;return $!=null&&(Y=="object"||Y=="function")}zz0.exports=D31});var cz0=j(($D,aJ)=>{var A31=200,lf="__lodash_hash_undefined__",GD=1,Oz0=2,Nz0=9007199254740991,YD="[object Arguments]",uf="[object Array]",P31="[object AsyncFunction]",Dz0="[object Boolean]",Bz0="[object Date]",Az0="[object Error]",Pz0="[object Function]",T31="[object GeneratorFunction]",UD="[object Map]",Tz0="[object Number]",E31="[object Null]",sJ="[object Object]",Gz0="[object Promise]",j31="[object Proxy]",Ez0="[object RegExp]",ID="[object Set]",jz0="[object String]",C31="[object Symbol]",R31="[object Undefined]",bf="[object WeakMap]",Cz0="[object ArrayBuffer]",QD="[object DataView]",_31="[object Float32Array]",v31="[object Float64Array]",S31="[object Int8Array]",h31="[object Int16Array]",g31="[object Int32Array]",y31="[object Uint8Array]",k31="[object Uint8ClampedArray]",x31="[object Uint16Array]",f31="[object Uint32Array]",u31=/[\\^$.*+?()[\]{}|]/g,b31=/^\[object .+?Constructor\]$/,i31=/^(?:0|[1-9]\d*)$/,C4={};C4[_31]=C4[v31]=C4[S31]=C4[h31]=C4[g31]=C4[y31]=C4[k31]=C4[x31]=C4[f31]=!0;C4[YD]=C4[uf]=C4[Cz0]=C4[Dz0]=C4[QD]=C4[Bz0]=C4[Az0]=C4[Pz0]=C4[UD]=C4[Tz0]=C4[sJ]=C4[Ez0]=C4[ID]=C4[jz0]=C4[bf]=!1;var Rz0=typeof global=="object"&&global&&global.Object===Object&&global,c31=typeof self=="object"&&self&&self.Object===Object&&self,B3=Rz0||c31||Function("return this")(),_z0=typeof $D=="object"&&$D&&!$D.nodeType&&$D,Hz0=_z0&&typeof aJ=="object"&&aJ&&!aJ.nodeType&&aJ,vz0=Hz0&&Hz0.exports===_z0,kf=vz0&&Rz0.process,Wz0=function(){try{return kf&&kf.binding&&kf.binding("util")}catch($){}}(),Xz0=Wz0&&Wz0.isTypedArray;function n31($,Y){var U=-1,I=$==null?0:$.length,Q=0,J=[];while(++U<I){var K=$[U];if(Y(K,U,$))J[Q++]=K}return J}function d31($,Y){var U=-1,I=Y.length,Q=$.length;while(++U<I)$[Q+U]=Y[U];return $}function p31($,Y){var U=-1,I=$==null?0:$.length;while(++U<I)if(Y($[U],U,$))return!0;return!1}function m31($,Y){var U=-1,I=Array($);while(++U<$)I[U]=Y(U);return I}function l31($){return function(Y){return $(Y)}}function o31($,Y){return $.has(Y)}function r31($,Y){return $==null?void 0:$[Y]}function s31($){var Y=-1,U=Array($.size);return $.forEach(function(I,Q){U[++Y]=[Q,I]}),U}function a31($,Y){return function(U){return $(Y(U))}}function t31($){var Y=-1,U=Array($.size);return $.forEach(function(I){U[++Y]=I}),U}var e31=Array.prototype,$71=Function.prototype,HD=Object.prototype,xf=B3["__core-js_shared__"],Sz0=$71.toString,M9=HD.hasOwnProperty,Zz0=function(){var $=/[^.]+$/.exec(xf&&xf.keys&&xf.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),hz0=HD.toString,Y71=RegExp("^"+Sz0.call(M9).replace(u31,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),qz0=vz0?B3.Buffer:void 0,JD=B3.Symbol,Vz0=B3.Uint8Array,gz0=HD.propertyIsEnumerable,U71=e31.splice,RU=JD?JD.toStringTag:void 0,Lz0=Object.getOwnPropertySymbols,I71=qz0?qz0.isBuffer:void 0,Q71=a31(Object.keys,Object),cf=tJ(B3,"DataView"),tW=tJ(B3,"Map"),nf=tJ(B3,"Promise"),df=tJ(B3,"Set"),pf=tJ(B3,"WeakMap"),eW=tJ(Object,"create"),J71=SU(cf),K71=SU(tW),z71=SU(nf),G71=SU(df),H71=SU(pf),Fz0=JD?JD.prototype:void 0,ff=Fz0?Fz0.valueOf:void 0;function _U($){var Y=-1,U=$==null?0:$.length;this.clear();while(++Y<U){var I=$[Y];this.set(I[0],I[1])}}function W71(){this.__data__=eW?eW(null):{},this.size=0}function X71($){var Y=this.has($)&&delete this.__data__[$];return this.size-=Y?1:0,Y}function Z71($){var Y=this.__data Line truncated
]`;this.ESCAPE_REGEXP=new RegExp(Y)}set headers($){this._headers=$}shouldQuote($,Y){let U=Y?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;if(M21.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,Y,U){let I=`${O21.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:Q}=this;if(Q.quote!==""){if(I.indexOf(Q.quote)!==-1)return this.quoteField(I.replace(this.REPLACE_REGEXP,Q.escapedQuote))}if(I.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(Y,U))return this.quoteField(I);return I}quoteField($){let{quote:Y}=this.formatterOptions;return`${Y}${$}${Y}`}}eJ.FieldFormatter=az0});var tf=j((tz0)=>{Object.defineProperty(tz0,"__esModule",{value:!0});tz0.isSyncTransform=void 0;tz0.isSyncTransform=($)=>$.length===1});var YG0=j(($K)=>{var $G0=$K&&$K.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty($K,"__esModule",{value:!0});$K.RowFormatter=void 0;var D21=$G0(eN()),B21=$G0(cz0()),A21=af(),P21=tf();class hU{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new A21.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(hU.isRowHashArray($))return $.map((Y)=>Y[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(P21.isSyncTransform($))return(Y,U)=>{let I=null;try{I=$(Y)}catch(Q){return U(Q)}return U(null,I)};return(Y,U)=>{$(Y,U)}}set rowTransform($){if(!D21.default($))throw TypeError("The transform should be a function");this._rowTransform=hU.createTransform($)}format($,Y){this.callTransformer($,(U,I)=>{if(U)return Y(U);if(!$)return Y(null);let Q=[];if(I){let{shouldFormatColumns:J,headers:K}=this.checkHeaders(I);if(this.shouldWriteHeaders&&K&&!this.hasWrittenHeaders)Q.push(this.formatColumns(K,!0)),this.hasWrittenHeaders=!0;if(J){let z=this.gatherColumns(I);Q.push(this.formatColumns(z,!1))}}return Y(null,Q)})}finish($){let Y=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return $(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));Y.push(this.formatColumns(this.headers,!0))}if(this.formatterOptions.includeEndRowDelimiter)Y.push(this.formatterOptions.rowDelimiter);return $(null,Y)}checkHeaders($){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let Y=hU.gatherHeaders($);if(this.headers=Y,this.fieldFormatter.headers=Y,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!B21.default(Y,$),headers:Y}}gatherColumns($){if(this.headers===null)throw Error("Headers is currently null");if(!Array.isArray($))return this.headers.map((Y)=>$[Y]);if(hU.isRowHashArray($))return this.headers.map((Y,U)=>{let I=$[U];if(I)return I[1];return""});if(hU.isRowArray($)&&!this.shouldWriteHeaders)return $;return this.headers.map((Y,U)=>$[U])}callTransformer($,Y){if(!this._rowTransform)return Y(null,$);return this._rowTransform($,Y)}formatColumns($,Y){let U=$.map((Q,J)=>this.fieldFormatter.format(Q,J,Y)).join(this.formatterOptions.delimiter),{rowCount:I}=this;if(this.rowCount+=1,I)return[this.formatterOptions.rowDelimiter,U].join("");return U}}$K.RowFormatter=hU});var UG0=j((ZD)=>{Object.defineProperty(ZD,"__esModule",{value:!0});ZD.FieldFormatter=ZD.RowFormatter=void 0;var T21=YG0();Object.defineProperty(ZD,"RowFormatter",{enumerable:!0,get:function(){return T21.RowFormatter}});var E21=af();Object.defineProperty(ZD,"FieldFormatter",{enumerable:!0,get:function(){return E21.FieldFormatter}})});var ef=j((QG0)=>{Object.defineProperty(QG0,"__esModule",{value:!0});QG0.CsvFormatterStream=void 0;var C21=K0("stream"),R21=UG0();class IG0 extends C21.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new R21.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,Y,U){let I=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(Q,J)=>{if(Q)return I=!0,U(Q);if(J)J.forEach((K)=>{this.push(Buffer.from(K,"utf8"))});return I=!0,U()})}catch(Q){if(I)throw Q;U(Q)}}_flush($){this.rowFormatter.finish((Y,U)=>{if(Y)return $(Y);if(U)U.forEach((I)=>{this.push(Buffer.from(I,"utf8"))});return $()})}}QG0.CsvFormatterStream=IG0});var zG0=j((a1)=>{var KG0=a1&&a1.__createBinding||(Object.create?function($,Y,U,I){if(I===void 0)I=U;Object.defineProperty($,I,{enumerable:!0,get:function(){return Y[U]}})}:function($,Y,U,I){if(I===void 0)I=U;$[I]=Y[U]}),_21=a1&&a1.__setModuleDefault||(Object.create?function($,Y){O Line truncated
`||Y===`\r
`}static isTokenCarriageReturn($,Y){return $.token===Y.carriageReturn}static isTokenComment($,Y){return Y.supportsComments&&!!$&&$.token===Y.comment}static isTokenEscapeCharacter($,Y){return $.token===Y.escapeChar}static isTokenQuote($,Y){return $.token===Y.quote}static isTokenDelimiter($,Y){return $.token===Y.delimiter}}UH0.Token=YH0});var Ou=j((KH0)=>{Object.defineProperty(KH0,"__esModule",{value:!0});KH0.Scanner=void 0;var QH0=L2(),gI1=/((?:\r\n)|\n|\r)/;class JH0{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,Y=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(Y)===-1)return null;let U=Y.exec($);if(U==null)return null;let I=U[1],Q=this.cursor+(U.index||0);return new QH0.Token({token:I,startCursor:Q,endCursor:Q+I.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:Y}=this;if(Y<=$)return null;return new QH0.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=gI1.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}}KH0.Scanner=JH0});var SD=j((HH0)=>{Object.defineProperty(HH0,"__esModule",{value:!0});HH0.ColumnFormatter=void 0;class GH0{constructor($){if($.trim)this.format=(Y)=>Y.trim();else if($.ltrim)this.format=(Y)=>Y.trimLeft();else if($.rtrim)this.format=(Y)=>Y.trimRight();else this.format=(Y)=>Y}}HH0.ColumnFormatter=GH0});var Nu=j((qH0)=>{Object.defineProperty(qH0,"__esModule",{value:!0});qH0.NonQuotedColumnParser=void 0;var yI1=SD(),XH0=L2();class ZH0{constructor($){this.parserOptions=$,this.columnFormatter=new yI1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:Y}=this,U=[],I=$.nextCharacterToken;for(;I;I=$.nextCharacterToken){if(XH0.Token.isTokenDelimiter(I,Y)||XH0.Token.isTokenRowDelimiter(I))break;U.push(I.token),$.advancePastToken(I)}return this.columnFormatter.format(U.join(""))}}qH0.NonQuotedColumnParser=ZH0});var Du=j((FH0)=>{Object.defineProperty(FH0,"__esModule",{value:!0});FH0.QuotedColumnParser=void 0;var kI1=SD(),zK=L2();class LH0{constructor($){this.parserOptions=$,this.columnFormatter=new kI1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let Y=$.cursor,{foundClosingQuote:U,col:I}=this.gatherDataBetweenQuotes($);if(!U){if($.advanceTo(Y),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),I}gatherDataBetweenQuotes($){let{parserOptions:Y}=this,U=!1,I=!1,Q=[],J=$.nextCharacterToken;for(;!I&&J!==null;J=$.nextCharacterToken){let K=zK.Token.isTokenQuote(J,Y);if(!U&&K)U=!0;else if(U)if(zK.Token.isTokenEscapeCharacter(J,Y)){$.advancePastToken(J);let z=$.nextCharacterToken;if(z!==null&&(zK.Token.isTokenQuote(z,Y)||zK.Token.isTokenEscapeCharacter(z,Y)))Q.push(z.token),J=z;else if(K)I=!0;else Q.push(J.token)}else if(K)I=!0;else Q.push(J.token);$.advancePastToken(J)}return{col:this.columnFormatter.format(Q.join("")),foundClosingQuote:I}}checkForMalformedColumn($){let{parserOptions:Y}=this,{nextNonSpaceToken:U}=$;if(U){let I=zK.Token.isTokenDelimiter(U,Y),Q=zK.Token.isTokenRowDelimiter(U);if(!(I||Q)){let J=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${Y.escapedDelimiter}' OR new line got: '${U.token}'. at '${J}`)}$.advanceToToken(U)}else if(!$.hasMoreData)$.advancePastLine()}}FH0.QuotedColumnParser=LH0});var DH0=j((OH0)=>{Object.defineProperty(OH0,"__esModule",{value:!0});OH0.ColumnParser=void 0;var xI1=Nu(),fI1=Du(),uI1=L2();class MH0{constructor($){this.parserOptions=$,this.quotedColumnParser=new fI1.QuotedColumnParser($),this.nonQuotedColumnParser=new xI1.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:Y}=$;if(Y!==null&&uI1.Token.isTokenQuote(Y,this.parserOptions))return $.advanceToToken(Y),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}OH0.ColumnParser=MH0});var Bu=j((GK)=>{Object.defineProperty(GK,"__esModule",{value:!0});GK.ColumnFormatter=GK.QuotedColumnParser=GK.NonQuotedColumnParser=GK.ColumnParser=void 0;var bI1=DH0();Object.defineProperty(GK,"ColumnParser",{enumerable:!0,get:function(){return bI1.ColumnParser}});var iI1=Nu();Object.defineProperty(GK,"NonQuotedColumnParser",{enumerable:!0,get:function(){return iI1.NonQuotedColumnParser}});var cI1=Du();Object.defineProperty(GK,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,T,T,q,I);let B=q.type==="*"?xu:q.type==="?"?bu:"\\"+q.type;Q=!0,I=I.slice(0,q.reStart)+B+"\\("+T}if(O(),J)I+="\\\\";let D=hQ1[I.charAt(0)];for(let T=z.length-1;T>-1;T--){let B=z[T],E=I.slice(0,B.reStart),C=I.slice(B.reStart,B.reEnd-8),i=I.slice(B.reEnd),x=I.slice(B.reEnd-8,B.reEnd)+i,g=E.split(")").length,b=E.split("(").length-g,c=i;for(let k=0;k<b;k++)c=c.replace(/\)[+*?]?/,"");i=c;let I0=i===""&&Y!==fu?"(?:$|\\/)":"";I=E+C+i+I0+x}if(I!==""&&Q)I="(?=.)"+I;if(D)I=F()+I;if(Y===fu)return[I,Q];if(U.nocase&&!Q)Q=$.toUpperCase()!==$.toLowerCase();if(!Q)return yQ1($);let P=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+I+"$",P),{_glob:$,_src:I})}catch(T){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 Y=this.options,U=Y.noglobstar?xu:Y.dot?vQ1:SQ1,I=Y.nocase?"i":"",Q=$.map((J)=>{return J=J.map((K)=>typeof K==="string"?xQ1(K):K===k8?k8:K._src).reduce((K,z)=>{if(!(K[K.length-1]===k8&&z===k8))K.push(z);return K},[]),J.forEach((K,z)=>{if(K!==k8||J[z-1]===k8)return;if(z===0)if(J.length>1)J[z+1]="(?:\\/|"+U+"\\/)?"+J[z+1];else J[z]=U;else if(z===J.length-1)J[z-1]+="(?:\\/|"+U+")?";else J[z-1]+="(?:\\/|\\/"+U+"\\/)"+J[z+1],J[z+1]=k8}),J.filter((K)=>K!==k8).join("/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,I)}catch(J){this.regexp=!1}return this.regexp}match($,Y=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&Y)return!0;let U=this.options;if(uu.sep!=="/")$=$.split(uu.sep).join("/");$=$.split(VW0),this.debug(this.pattern,"split",$);let I=this.set;this.debug(this.pattern,"set",I);let Q;for(let J=$.length-1;J>=0;J--)if(Q=$[J],Q)break;for(let J=0;J<I.length;J++){let K=I[J],z=$;if(U.matchBase&&K.length===1)z=[Q];if(this.matchOne(z,K,Y)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return w$.defaults($).Minimatch}}w$.Minimatch=IX});var BW0=j((Pt1,DW0)=>{DW0.exports=NW0;var nu=K0("fs"),{EventEmitter:uQ1}=K0("events"),{Minimatch:cu}=wW0(),{resolve:bQ1}=K0("path");function iQ1($,Y){return new Promise((U,I)=>{nu.readdir($,{withFileTypes:!0},(Q,J)=>{if(Q)switch(Q.code){case"ENOTDIR":if(Y)I(Q);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:I(Q);break}else U(J)})})}function MW0($,Y){return new Promise((U,I)=>{(Y?nu.stat:nu.lstat)($,(J,K)=>{if(J)switch(J.code){case"ENOENT":if(Y)U(MW0($,!1));else U(null);break;default:U(null);break}else U(K)})})}async function*OW0($,Y,U,I,Q,J){let K=await iQ1(Y+$,J);for(let z of K){let G=z.name;if(G===void 0)G=z,I=!0;let H=$+"/"+G,W=H.slice(1),X=Y+"/"+W,Z=null;if(I||U)Z=await MW0(X,U);if(!Z&&z.name!==void 0)Z=z;if(Z===null)Z={isDirectory:()=>!1};if(Z.isDirectory()){if(!Q(W))yield{relative:W,absolute:X,stats:Z},yield*OW0(H,Y,U,I,Q,!1)}else yield{relative:W,absolute:X,stats:Z}}}async function*cQ1($,Y,U,I){yield*OW0("",$,Y,U,I,!0)}function nQ1($){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 du extends uQ1{constructor($,Y,U){super();if(typeof Y==="function")U=Y,Y=null;if(this.options=nQ1(Y||{}),this.matchers=[],this.options.pattern){let I=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=I.map((Q)=>new cu(Q,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let I=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=I.map((Q)=>new cu(Q,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let I=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=I.map((Q)=>new cu(Q,{dot:!0}))}if(this.iterator=cQ1(bQ1($||"."),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",(I)=>this._matches.push(this.options.absolute?I.absolute:I.relative)),this.on("error",(I)=>U(I)),this.on("end",()=>U(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((Y)=>Y.match($))}_fileMatches($,Y){let U=$+(Y?"/":"");return(this.matchers.length===0||this.matchers.some((I)=>I.match(U)))&&!this.ignoreMatchers.some((I)=>I.match(U))&&(!this.options.nodir||!Y)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let Y=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,Y)){let U=$.value.relative,I=$.value.absolute;if(this.options.mark&&Y)U+="/",I+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:I,stat:$.value.stats});else this.emit("match",{relative:U Line truncated
`,r);r=L0===-1?f.length:L0}else if(z0!==-1&&f[r]==="/"&&f[r+1]==="*"){let L0=f.indexOf("*/",r);if(L0!==-1)r=L0+2,z0=f.indexOf("*/",r);else n+=f[r],r++}else n+=f[r],r++;return n}function c0(f){let n=b0(f.toString()),r=n.match(t);if(!r)r=n.match(X0);if(!r)throw Error(`could not parse args in autoInject
`}static isTokenCarriageReturn($,Y){return $.token===Y.carriageReturn}static isTokenComment($,Y){return Y.supportsComments&&!!$&&$.token===Y.comment}static isTokenEscapeCharacter($,Y){return $.token===Y.escapeChar}static isTokenQuote($,Y){return $.token===Y.quote}static isTokenDelimiter($,Y){return $.token===Y.delimiter}}GH0.Token=zH0});var Au=j((ZH0)=>{Object.defineProperty(ZH0,"__esModule",{value:!0});ZH0.Scanner=void 0;var WH0=w2(),fI1=/((?:\r\n)|\n|\r)/;class XH0{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,Y=this.parserOptions.NEXT_TOKEN_REGEXP;if($.search(Y)===-1)return null;let U=Y.exec($);if(U==null)return null;let I=U[1],Q=this.cursor+(U.index||0);return new WH0.Token({token:I,startCursor:Q,endCursor:Q+I.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:Y}=this;if(Y<=$)return null;return new WH0.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=fI1.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}}ZH0.Scanner=XH0});var yD=j((LH0)=>{Object.defineProperty(LH0,"__esModule",{value:!0});LH0.ColumnFormatter=void 0;class VH0{constructor($){if($.trim)this.format=(Y)=>Y.trim();else if($.ltrim)this.format=(Y)=>Y.trimLeft();else if($.rtrim)this.format=(Y)=>Y.trimRight();else this.format=(Y)=>Y}}LH0.ColumnFormatter=VH0});var Pu=j((OH0)=>{Object.defineProperty(OH0,"__esModule",{value:!0});OH0.NonQuotedColumnParser=void 0;var uI1=yD(),wH0=w2();class MH0{constructor($){this.parserOptions=$,this.columnFormatter=new uI1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:Y}=this,U=[],I=$.nextCharacterToken;for(;I;I=$.nextCharacterToken){if(wH0.Token.isTokenDelimiter(I,Y)||wH0.Token.isTokenRowDelimiter(I))break;U.push(I.token),$.advancePastToken(I)}return this.columnFormatter.format(U.join(""))}}OH0.NonQuotedColumnParser=MH0});var Tu=j((BH0)=>{Object.defineProperty(BH0,"__esModule",{value:!0});BH0.QuotedColumnParser=void 0;var bI1=yD(),XK=w2();class DH0{constructor($){this.parserOptions=$,this.columnFormatter=new bI1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let Y=$.cursor,{foundClosingQuote:U,col:I}=this.gatherDataBetweenQuotes($);if(!U){if($.advanceTo(Y),!$.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||""}' in line: at '${$.lineFromCursor.replace(/[\r\n]/g,"\\n'")}'`);return null}return this.checkForMalformedColumn($),I}gatherDataBetweenQuotes($){let{parserOptions:Y}=this,U=!1,I=!1,Q=[],J=$.nextCharacterToken;for(;!I&&J!==null;J=$.nextCharacterToken){let K=XK.Token.isTokenQuote(J,Y);if(!U&&K)U=!0;else if(U)if(XK.Token.isTokenEscapeCharacter(J,Y)){$.advancePastToken(J);let z=$.nextCharacterToken;if(z!==null&&(XK.Token.isTokenQuote(z,Y)||XK.Token.isTokenEscapeCharacter(z,Y)))Q.push(z.token),J=z;else if(K)I=!0;else Q.push(J.token)}else if(K)I=!0;else Q.push(J.token);$.advancePastToken(J)}return{col:this.columnFormatter.format(Q.join("")),foundClosingQuote:I}}checkForMalformedColumn($){let{parserOptions:Y}=this,{nextNonSpaceToken:U}=$;if(U){let I=XK.Token.isTokenDelimiter(U,Y),Q=XK.Token.isTokenRowDelimiter(U);if(!(I||Q)){let J=$.lineFromCursor.substr(0,10).replace(/[\r\n]/g,"\\n'");throw Error(`Parse Error: expected: '${Y.escapedDelimiter}' OR new line got: '${U.token}'. at '${J}`)}$.advanceToToken(U)}else if(!$.hasMoreData)$.advancePastLine()}}BH0.QuotedColumnParser=DH0});var jH0=j((TH0)=>{Object.defineProperty(TH0,"__esModule",{value:!0});TH0.ColumnParser=void 0;var iI1=Pu(),cI1=Tu(),nI1=w2();class PH0{constructor($){this.parserOptions=$,this.quotedColumnParser=new cI1.QuotedColumnParser($),this.nonQuotedColumnParser=new iI1.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:Y}=$;if(Y!==null&&nI1.Token.isTokenQuote(Y,this.parserOptions))return $.advanceToToken(Y),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}TH0.ColumnParser=PH0});var Eu=j((ZK)=>{Object.defineProperty(ZK,"__esModule",{value:!0});ZK.ColumnFormatter=ZK.QuotedColumnParser=ZK.NonQuotedColumnParser=ZK.ColumnParser=void 0;var dI1=jH0();Object.defineProperty(ZK,"ColumnParser",{enumerable:!0,get:function(){return dI1.ColumnParser}});var pI1=Pu();Object.defineProperty(ZK,"NonQuotedColumnParser",{enumerable:!0,get:function(){return pI1.NonQuotedColumnParser}});var mI1=Tu();Object.defineProperty(ZK,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,T,T,q,I);let B=q.type==="*"?iu:q.type==="?"?du:"\\"+q.type;Q=!0,I=I.slice(0,q.reStart)+B+"\\("+T}if(O(),J)I+="\\\\";let D=xQ1[I.charAt(0)];for(let T=z.length-1;T>-1;T--){let B=z[T],E=I.slice(0,B.reStart),C=I.slice(B.reStart,B.reEnd-8),i=I.slice(B.reEnd),x=I.slice(B.reEnd-8,B.reEnd)+i,g=E.split(")").length,b=E.split("(").length-g,c=i;for(let k=0;k<b;k++)c=c.replace(/\)[+*?]?/,"");i=c;let I0=i===""&&Y!==cu?"(?:$|\\/)":"";I=E+C+i+I0+x}if(I!==""&&Q)I="(?=.)"+I;if(D)I=F()+I;if(Y===cu)return[I,Q];if(U.nocase&&!Q)Q=$.toUpperCase()!==$.toLowerCase();if(!Q)return uQ1($);let P=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+I+"$",P),{_glob:$,_src:I})}catch(T){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 Y=this.options,U=Y.noglobstar?iu:Y.dot?yQ1:kQ1,I=Y.nocase?"i":"",Q=$.map((J)=>{return J=J.map((K)=>typeof K==="string"?iQ1(K):K===x8?x8:K._src).reduce((K,z)=>{if(!(K[K.length-1]===x8&&z===x8))K.push(z);return K},[]),J.forEach((K,z)=>{if(K!==x8||J[z-1]===x8)return;if(z===0)if(J.length>1)J[z+1]="(?:\\/|"+U+"\\/)?"+J[z+1];else J[z]=U;else if(z===J.length-1)J[z-1]+="(?:\\/|"+U+")?";else J[z-1]+="(?:\\/|\\/"+U+"\\/)"+J[z+1],J[z+1]=x8}),J.filter((K)=>K!==x8).join("/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,I)}catch(J){this.regexp=!1}return this.regexp}match($,Y=this.partial){if(this.debug("match",$,this.pattern),this.comment)return!1;if(this.empty)return $==="";if($==="/"&&Y)return!0;let U=this.options;if(nu.sep!=="/")$=$.split(nu.sep).join("/");$=$.split(NW0),this.debug(this.pattern,"split",$);let I=this.set;this.debug(this.pattern,"set",I);let Q;for(let J=$.length-1;J>=0;J--)if(Q=$[J],Q)break;for(let J=0;J<I.length;J++){let K=I[J],z=$;if(U.matchBase&&K.length===1)z=[Q];if(this.matchOne(z,K,Y)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return M$.defaults($).Minimatch}}M$.Minimatch=zX});var CW0=j((_t1,jW0)=>{jW0.exports=EW0;var lu=K0("fs"),{EventEmitter:nQ1}=K0("events"),{Minimatch:mu}=AW0(),{resolve:dQ1}=K0("path");function pQ1($,Y){return new Promise((U,I)=>{lu.readdir($,{withFileTypes:!0},(Q,J)=>{if(Q)switch(Q.code){case"ENOTDIR":if(Y)I(Q);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:I(Q);break}else U(J)})})}function PW0($,Y){return new Promise((U,I)=>{(Y?lu.stat:lu.lstat)($,(J,K)=>{if(J)switch(J.code){case"ENOENT":if(Y)U(PW0($,!1));else U(null);break;default:U(null);break}else U(K)})})}async function*TW0($,Y,U,I,Q,J){let K=await pQ1(Y+$,J);for(let z of K){let G=z.name;if(G===void 0)G=z,I=!0;let H=$+"/"+G,W=H.slice(1),X=Y+"/"+W,Z=null;if(I||U)Z=await PW0(X,U);if(!Z&&z.name!==void 0)Z=z;if(Z===null)Z={isDirectory:()=>!1};if(Z.isDirectory()){if(!Q(W))yield{relative:W,absolute:X,stats:Z},yield*TW0(H,Y,U,I,Q,!1)}else yield{relative:W,absolute:X,stats:Z}}}async function*mQ1($,Y,U,I){yield*TW0("",$,Y,U,I,!0)}function lQ1($){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 ou extends nQ1{constructor($,Y,U){super();if(typeof Y==="function")U=Y,Y=null;if(this.options=lQ1(Y||{}),this.matchers=[],this.options.pattern){let I=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=I.map((Q)=>new mu(Q,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let I=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=I.map((Q)=>new mu(Q,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let I=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=I.map((Q)=>new mu(Q,{dot:!0}))}if(this.iterator=mQ1(dQ1($||"."),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",(I)=>this._matches.push(this.options.absolute?I.absolute:I.relative)),this.on("error",(I)=>U(I)),this.on("end",()=>U(null,this._matches));setTimeout(()=>this._next(),0)}_shouldSkipDirectory($){return this.skipMatchers.some((Y)=>Y.match($))}_fileMatches($,Y){let U=$+(Y?"/":"");return(this.matchers.length===0||this.matchers.some((I)=>I.match(U)))&&!this.ignoreMatchers.some((I)=>I.match(U))&&(!this.options.nodir||!Y)}_next(){if(!this.paused&&!this.aborted)this.iterator.next().then(($)=>{if(!$.done){let Y=$.value.stats.isDirectory();if(this._fileMatches($.value.relative,Y)){let U=$.value.relative,I=$.value.absolute;if(this.options.mark&&Y)U+="/",I+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:I,stat:$.value.stats});else this.emit("match",{relative:U Line truncated
`,r);r=L0===-1?f.length:L0}else if(G0!==-1&&f[r]==="/"&&f[r+1]==="*"){let L0=f.indexOf("*/",r);if(L0!==-1)r=L0+2,G0=f.indexOf("*/",r);else n+=f[r],r++}else n+=f[r],r++;return n}function c0(f){let n=b0(f.toString()),r=n.match(t);if(!r)r=n.match(X0);if(!r)throw Error(`could not parse args in autoInject
Source:
`+n);let[,z0]=r;return z0.replace(/\s/g,"").split(F0).map((L0)=>L0.replace(u0,"").trim())}function P1(f,n){var r={};return Object.keys(f).forEach((z0)=>{var L0=f[z0],N0,A0=q(L0),P0=!A0&&L0.length===1||A0&&L0.length===0;if(Array.isArray(L0))N0=[...L0],L0=N0.pop(),r[z0]=N0.concat(N0.length>0?S0:L0);else if(P0)r[z0]=L0;else{if(N0=c0(L0),L0.length===0&&!A0&&N0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!A0)N0.pop();r[z0]=N0.concat(S0)}function S0(Y1,x1){var r1=N0.map((i1)=>Y1[i1]);r1.push(x1),M(L0)(...r1)}}),q1(r,n)}class k1{constructor(){this.head=this.tail=null,this.length=0}removeLink(f){if(f.prev)f.prev.next=f.next;else this.head=f.next;if(f.next)f.next.prev=f.prev;else this.tail=f.prev;return f.prev=f.next=null,this.length-=1,f}empty(){while(this.head)this.shift();return this}insertAfter(f,n){if(n.prev=f,n.next=f.next,f.next)f.next.prev=n;else this.tail=n;f.next=n,this.length+=1}insertBefore(f,n){if(n.prev=f.prev,n.next=f,f.prev)f.prev.next=n;else this.head=n;f.prev=n,this.length+=1}unshift(f){if(this.head)this.insertBefore(this.head,f);else u1(this,f)}push(f){if(this.tail)this.insertAfter(this.tail,f);else u1(this,f)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var f=this.head;while(f)yield f.data,f=f.next}remove(f){var n=this.head;while(n){var{next:r}=n;if(f(n))this.removeLink(n);n=r}return this}}function u1(f,n){f.length=1,f.head=f.tail=n}function b1(f,n,r){if(n==null)n=1;else if(n===0)throw RangeError("Concurrency must not be zero");var z0=M(f),L0=0,N0=[];let A0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function P0(z1,e0){A0[z1].push(e0)}function S0(z1,e0){let G1=(...c1)=>{Y1(z1,G1),e0(...c1)};A0[z1].push(G1)}function Y1(z1,e0){if(!z1)return Object.keys(A0).forEach((G1)=>A0[G1]=[]);if(!e0)return A0[z1]=[];A0[z1]=A0[z1].filter((G1)=>G1!==e0)}function x1(z1,...e0){A0[z1].forEach((G1)=>G1(...e0))}var r1=!1;function i1(z1,e0,G1,c1){if(c1!=null&&typeof c1!=="function")throw Error("task callback must be a function");s1.started=!0;var k4,y6;function R$(EY,...$G){if(EY)return G1?y6(EY):k4();if($G.length<=1)return k4($G[0]);k4($G)}var lI=s1._createTaskItem(z1,G1?R$:c1||R$);if(e0)s1._tasks.unshift(lI);else s1._tasks.push(lI);if(!r1)r1=!0,H(()=>{r1=!1,s1.process()});if(G1||!c1)return new Promise((EY,$G)=>{k4=EY,y6=$G})}function C$(z1){return function(e0,...G1){L0-=1;for(var c1=0,k4=z1.length;c1<k4;c1++){var y6=z1[c1],R$=N0.indexOf(y6);if(R$===0)N0.shift();else if(R$>0)N0.splice(R$,1);if(y6.callback(e0,...G1),e0!=null)x1("error",e0,y6.data)}if(L0<=s1.concurrency-s1.buffer)x1("unsaturated");if(s1.idle())x1("drain");s1.process()}}function mI(z1){if(z1.length===0&&s1.idle())return H(()=>x1("drain")),!0;return!1}let TY=(z1)=>(e0)=>{if(!e0)return new Promise((G1,c1)=>{S0(z1,(k4,y6)=>{if(k4)return c1(k4);G1(y6)})});Y1(z1),P0(z1,e0)};var ez=!1,s1={_tasks:new k1,_createTaskItem(z1,e0){return{data:z1,callback:e0}},*[Symbol.iterator](){yield*s1._tasks[Symbol.iterator]()},concurrency:n,payload:r,buffer:n/4,started:!1,paused:!1,push(z1,e0){if(Array.isArray(z1)){if(mI(z1))return;return z1.map((G1)=>i1(G1,!1,!1,e0))}return i1(z1,!1,!1,e0)},pushAsync(z1,e0){if(Array.isArray(z1)){if(mI(z1))return;return z1.map((G1)=>i1(G1,!1,!0,e0))}return i1(z1,!1,!0,e0)},kill(){Y1(),s1._tasks.empty()},unshift(z1,e0){if(Array.isArray(z1)){if(mI(z1))return;return z1.map((G1)=>i1(G1,!0,!1,e0))}return i1(z1,!0,!1,e0)},unshiftAsync(z1,e0){if(Array.isArray(z1)){if(mI(z1))return;return z1.map((G1)=>i1(G1,!0,!0,e0))}return i1(z1,!0,!0,e0)},remove(z1){s1._tasks.remove(z1)},process(){if(ez)return;ez=!0;while(!s1.paused&&L0<s1.concurrency&&s1._tasks.length){var z1=[],e0=[],G1=s1._tasks.length;if(s1.payload)G1=Math.min(G1,s1.payload);for(var c1=0;c1<G1;c1++){var k4=s1._tasks.shift();z1.push(k4),N0.push(k4),e0.push(k4.data)}if(L0+=1,s1._tasks.length===0)x1("empty");if(L0===s1.concurrency)x1("saturated");var y6=g(C$(z1));z0(e0,y6)}ez=!1},length(){return s1._tasks.length},running(){return L0},workersList(){return N0},idle(){return s1._tasks.length+L0===0},pause(){s1.paused=!0},resume(){if(s1.paused===!1)return;s1.paused=!1,H(s1.process)}};return Object.defineProperties(s1,{saturated:{writable:!1,value:TY("saturated")},unsaturated:{writable:!1,value:TY("unsaturated")},empty:{writable:!1,value:TY("empty")},drain:{writable:!1,value:TY("drain")},error:{writable:!1,value:TY("error")}}),s1}function D0(f,n){return b1(f,1,n)}function Q0(f,n,r){return b1(f,n,r)}function A(f,n,r,z0){z0=T(z0);var L0=M(r);return e(f,(N0,A0,P0)=>{L0(n,N0,(S0,Y1)=>{n=Y1,P0(S0)})},(N0)=>z0(N0,n))}var S=F(A,4);function u(...f){var n=f.map(M);return function(...r){var z0=this,L0=r[r.length-1];if(typeof L0=="function")r.pop();else L0=o0();return S(n,r,(N0,A0,P0)=>{A0.apply(z0,N0.concat((S0,...Y1)=>{P0(S0,Y1)}))},(N0,A0)=>L0(N0,...A0)),L0[v0]}}function s(...f){return u(...f.reverse())}function W0(f,n,r,z0){return O(c(n),f,r,z0)}var J0 Line truncated
GFS4: `),console.error($)};if(!m4[$8]){if(mu=global[$8]||[],SW0(m4,mu),m4.close=function($){function Y(U,I){return $.call(m4,U,function(Q){if(!Q)vW0();if(typeof I==="function")I.apply(this,arguments)})}return Object.defineProperty(Y,cD,{value:$}),Y}(m4.close),m4.closeSync=function($){function Y(U){$.apply(m4,arguments),vW0()}return Object.defineProperty(Y,cD,{value:$}),Y}(m4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){SU(m4[$8]),K0("assert").equal(m4[$8].length,0)})}var mu;if(!global[$8])SW0(global,m4[$8]);ru.exports=lu(tQ1(m4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!m4.__patched)ru.exports=lu(m4),m4.__patched=!0;function lu($){sQ1($),$.gracefulify=lu,$.createReadStream=P,$.createWriteStream=T;var Y=$.readFile;$.readFile=U;function U(C,i,x){if(typeof i==="function")x=i,i=null;return g(C,i,x);function g(b,c,I0,k){return Y(b,c,function(p){if(p&&(p.code==="EMFILE"||p.code==="ENFILE"))XK([g,[b,c,I0],p,k||Date.now(),Date.now()]);else if(typeof I0==="function")I0.apply(this,arguments)})}}var I=$.writeFile;$.writeFile=Q;function Q(C,i,x,g){if(typeof x==="function")g=x,x=null;return b(C,i,x,g);function b(c,I0,k,p,a){return I(c,I0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))XK([b,[c,I0,k,p],$0,a||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}var J=$.appendFile;if(J)$.appendFile=K;function K(C,i,x,g){if(typeof x==="function")g=x,x=null;return b(C,i,x,g);function b(c,I0,k,p,a){return J(c,I0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))XK([b,[c,I0,k,p],$0,a||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}var z=$.copyFile;if(z)$.copyFile=G;function G(C,i,x,g){if(typeof x==="function")g=x,x=0;return b(C,i,x,g);function b(c,I0,k,p,a){return z(c,I0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))XK([b,[c,I0,k,p],$0,a||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}var H=$.readdir;$.readdir=X;var W=/^v[0-5]\./;function X(C,i,x){if(typeof i==="function")x=i,i=null;var g=W.test(process.version)?function(I0,k,p,a){return H(I0,b(I0,k,p,a))}:function(I0,k,p,a){return H(I0,k,b(I0,k,p,a))};return g(C,i,x);function b(c,I0,k,p){return function(a,$0){if(a&&(a.code==="EMFILE"||a.code==="ENFILE"))XK([g,[c,I0,k],a,p||Date.now(),Date.now()]);else{if($0&&$0.sort)$0.sort();if(typeof k==="function")k.call(this,a,$0)}}}}if(process.version.substr(0,4)==="v0.8"){var Z=aQ1($);F=Z.ReadStream,O=Z.WriteStream}var q=$.ReadStream;if(q)F.prototype=Object.create(q.prototype),F.prototype.open=N;var V=$.WriteStream;if(V)O.prototype=Object.create(V.prototype),O.prototype.open=D;Object.defineProperty($,"ReadStream",{get:function(){return F},set:function(C){F=C},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return O},set:function(C){O=C},enumerable:!0,configurable:!0});var w=F;Object.defineProperty($,"FileReadStream",{get:function(){return w},set:function(C){w=C},enumerable:!0,configurable:!0});var M=O;Object.defineProperty($,"FileWriteStream",{get:function(){return M},set:function(C){M=C},enumerable:!0,configurable:!0});function F(C,i){if(this instanceof F)return q.apply(this,arguments),this;else return F.apply(Object.create(F.prototype),arguments)}function N(){var C=this;E(C.path,C.flags,C.mode,function(i,x){if(i){if(C.autoClose)C.destroy();C.emit("error",i)}else C.fd=x,C.emit("open",x),C.read()})}function O(C,i){if(this instanceof O)return V.apply(this,arguments),this;else return O.apply(Object.create(O.prototype),arguments)}function D(){var C=this;E(C.path,C.flags,C.mode,function(i,x){if(i)C.destroy(),C.emit("error",i);else C.fd=x,C.emit("open",x)})}function P(C,i){return new $.ReadStream(C,i)}function T(C,i){return new $.WriteStream(C,i)}var B=$.open;$.open=E;function E(C,i,x,g){if(typeof x==="function")g=x,x=null;return b(C,i,x,g);function b(c,I0,k,p,a){return B(c,I0,k,function($0,y){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))XK([b,[c,I0,k,p],$0,a||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}return $}function XK($){SU("ENQUEUE",$[0].name,$[1]),m4[$8].push($),ou()}var iD;function vW0(){var $=Date.now();for(var Y=0;Y<m4[$8].length;++Y)if(m4[$8][Y].length>2)m4[$8][Y][3]=$,m4[$8][Y][4]=$;ou()}function ou(){if(clearTimeout(iD),iD=void 0,m4[$8].length===0)return;var $=m4[$8].shift(),Y=$[0],U=$[1],I=$[2],Q=$[3],J=$[4];if(Q===void 0)SU("RETRY",Y.name,U),Y.apply(null,U);else if(Date.now()-Q>=60000){SU("TIMEOUT",Y.name,U);var K=U.pop();if(typeof K==="function")K.call(null,I)}else{var z=Date.now()-J,G=Math.max(J-Q,1),H=Math.min(G*1.2,100);if(z>=H)SU("RETRY",Y.name,U),Y.apply(null,U.concat([Q]));else m4[$8].push($)}if(iD===void 0)iD=setTimeout(ou,0)}});var gW0=j((Rt1,su)=>{function $J1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var hW0=H6().Buffer,QX=K0("util");function YJ1($,Y,U){$.copy(Y,U)}su.exports=function(){function $(){$J1(this,$),this.h Line truncated
`+n);let[,G0]=r;return G0.replace(/\s/g,"").split(F0).map((L0)=>L0.replace(u0,"").trim())}function P1(f,n){var r={};return Object.keys(f).forEach((G0)=>{var L0=f[G0],D0,P0=q(L0),E0=!P0&&L0.length===1||P0&&L0.length===0;if(Array.isArray(L0))D0=[...L0],L0=D0.pop(),r[G0]=D0.concat(D0.length>0?g0:L0);else if(E0)r[G0]=L0;else{if(D0=c0(L0),L0.length===0&&!P0&&D0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!P0)D0.pop();r[G0]=D0.concat(g0)}function g0(Y1,x1){var o1=D0.map((i1)=>Y1[i1]);o1.push(x1),M(L0)(...o1)}}),K1(r,n)}class k1{constructor(){this.head=this.tail=null,this.length=0}removeLink(f){if(f.prev)f.prev.next=f.next;else this.head=f.next;if(f.next)f.next.prev=f.prev;else this.tail=f.prev;return f.prev=f.next=null,this.length-=1,f}empty(){while(this.head)this.shift();return this}insertAfter(f,n){if(n.prev=f,n.next=f.next,f.next)f.next.prev=n;else this.tail=n;f.next=n,this.length+=1}insertBefore(f,n){if(n.prev=f.prev,n.next=f,f.prev)f.prev.next=n;else this.head=n;f.prev=n,this.length+=1}unshift(f){if(this.head)this.insertBefore(this.head,f);else u1(this,f)}push(f){if(this.tail)this.insertAfter(this.tail,f);else u1(this,f)}shift(){return this.head&&this.removeLink(this.head)}pop(){return this.tail&&this.removeLink(this.tail)}toArray(){return[...this]}*[Symbol.iterator](){var f=this.head;while(f)yield f.data,f=f.next}remove(f){var n=this.head;while(n){var{next:r}=n;if(f(n))this.removeLink(n);n=r}return this}}function u1(f,n){f.length=1,f.head=f.tail=n}function b1(f,n,r){if(n==null)n=1;else if(n===0)throw RangeError("Concurrency must not be zero");var G0=M(f),L0=0,D0=[];let P0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function E0(G1,e0){P0[G1].push(e0)}function g0(G1,e0){let H1=(...c1)=>{Y1(G1,H1),e0(...c1)};P0[G1].push(H1)}function Y1(G1,e0){if(!G1)return Object.keys(P0).forEach((H1)=>P0[H1]=[]);if(!e0)return P0[G1]=[];P0[G1]=P0[G1].filter((H1)=>H1!==e0)}function x1(G1,...e0){P0[G1].forEach((H1)=>H1(...e0))}var o1=!1;function i1(G1,e0,H1,c1){if(c1!=null&&typeof c1!=="function")throw Error("task callback must be a function");r1.started=!0;var x4,x6;function _$(vY,...QG){if(vY)return H1?x6(vY):x4();if(QG.length<=1)return x4(QG[0]);x4(QG)}var aI=r1._createTaskItem(G1,H1?_$:c1||_$);if(e0)r1._tasks.unshift(aI);else r1._tasks.push(aI);if(!o1)o1=!0,H(()=>{o1=!1,r1.process()});if(H1||!c1)return new Promise((vY,QG)=>{x4=vY,x6=QG})}function R$(G1){return function(e0,...H1){L0-=1;for(var c1=0,x4=G1.length;c1<x4;c1++){var x6=G1[c1],_$=D0.indexOf(x6);if(_$===0)D0.shift();else if(_$>0)D0.splice(_$,1);if(x6.callback(e0,...H1),e0!=null)x1("error",e0,x6.data)}if(L0<=r1.concurrency-r1.buffer)x1("unsaturated");if(r1.idle())x1("drain");r1.process()}}function sI(G1){if(G1.length===0&&r1.idle())return H(()=>x1("drain")),!0;return!1}let _Y=(G1)=>(e0)=>{if(!e0)return new Promise((H1,c1)=>{g0(G1,(x4,x6)=>{if(x4)return c1(x4);H1(x6)})});Y1(G1),E0(G1,e0)};var IG=!1,r1={_tasks:new k1,_createTaskItem(G1,e0){return{data:G1,callback:e0}},*[Symbol.iterator](){yield*r1._tasks[Symbol.iterator]()},concurrency:n,payload:r,buffer:n/4,started:!1,paused:!1,push(G1,e0){if(Array.isArray(G1)){if(sI(G1))return;return G1.map((H1)=>i1(H1,!1,!1,e0))}return i1(G1,!1,!1,e0)},pushAsync(G1,e0){if(Array.isArray(G1)){if(sI(G1))return;return G1.map((H1)=>i1(H1,!1,!0,e0))}return i1(G1,!1,!0,e0)},kill(){Y1(),r1._tasks.empty()},unshift(G1,e0){if(Array.isArray(G1)){if(sI(G1))return;return G1.map((H1)=>i1(H1,!0,!1,e0))}return i1(G1,!0,!1,e0)},unshiftAsync(G1,e0){if(Array.isArray(G1)){if(sI(G1))return;return G1.map((H1)=>i1(H1,!0,!0,e0))}return i1(G1,!0,!0,e0)},remove(G1){r1._tasks.remove(G1)},process(){if(IG)return;IG=!0;while(!r1.paused&&L0<r1.concurrency&&r1._tasks.length){var G1=[],e0=[],H1=r1._tasks.length;if(r1.payload)H1=Math.min(H1,r1.payload);for(var c1=0;c1<H1;c1++){var x4=r1._tasks.shift();G1.push(x4),D0.push(x4),e0.push(x4.data)}if(L0+=1,r1._tasks.length===0)x1("empty");if(L0===r1.concurrency)x1("saturated");var x6=g(R$(G1));G0(e0,x6)}IG=!1},length(){return r1._tasks.length},running(){return L0},workersList(){return D0},idle(){return r1._tasks.length+L0===0},pause(){r1.paused=!0},resume(){if(r1.paused===!1)return;r1.paused=!1,H(r1.process)}};return Object.defineProperties(r1,{saturated:{writable:!1,value:_Y("saturated")},unsaturated:{writable:!1,value:_Y("unsaturated")},empty:{writable:!1,value:_Y("empty")},drain:{writable:!1,value:_Y("drain")},error:{writable:!1,value:_Y("error")}}),r1}function B0(f,n){return b1(f,1,n)}function Q0(f,n,r){return b1(f,n,r)}function A(f,n,r,G0){G0=T(G0);var L0=M(r);return e(f,(D0,P0,E0)=>{L0(n,D0,(g0,Y1)=>{n=Y1,E0(g0)})},(D0)=>G0(D0,n))}var S=F(A,4);function u(...f){var n=f.map(M);return function(...r){var G0=this,L0=r[r.length-1];if(typeof L0=="function")r.pop();else L0=r0();return S(n,r,(D0,P0,E0)=>{P0.apply(G0,D0.concat((g0,...Y1)=>{E0(g0,Y1)}))},(D0,P0)=>L0(D0,...P0)),L0[v0]}}function s(...f){return u(...f.reverse())}function W0(f,n,r,G0){return O(c(n),f,r,G0)}var J0 Line truncated
GFS4: `),console.error($)};if(!l4[U8]){if(su=global[U8]||[],fW0(l4,su),l4.close=function($){function Y(U,I){return $.call(l4,U,function(Q){if(!Q)xW0();if(typeof I==="function")I.apply(this,arguments)})}return Object.defineProperty(Y,pD,{value:$}),Y}(l4.close),l4.closeSync=function($){function Y(U){$.apply(l4,arguments),xW0()}return Object.defineProperty(Y,pD,{value:$}),Y}(l4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){xU(l4[U8]),K0("assert").equal(l4[U8].length,0)})}var su;if(!global[U8])fW0(global,l4[U8]);eu.exports=au(UJ1(l4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!l4.__patched)eu.exports=au(l4),l4.__patched=!0;function au($){$J1($),$.gracefulify=au,$.createReadStream=P,$.createWriteStream=T;var Y=$.readFile;$.readFile=U;function U(C,i,x){if(typeof i==="function")x=i,i=null;return g(C,i,x);function g(b,c,I0,k){return Y(b,c,function(p){if(p&&(p.code==="EMFILE"||p.code==="ENFILE"))LK([g,[b,c,I0],p,k||Date.now(),Date.now()]);else if(typeof I0==="function")I0.apply(this,arguments)})}}var I=$.writeFile;$.writeFile=Q;function Q(C,i,x,g){if(typeof x==="function")g=x,x=null;return b(C,i,x,g);function b(c,I0,k,p,a){return I(c,I0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))LK([b,[c,I0,k,p],$0,a||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}var J=$.appendFile;if(J)$.appendFile=K;function K(C,i,x,g){if(typeof x==="function")g=x,x=null;return b(C,i,x,g);function b(c,I0,k,p,a){return J(c,I0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))LK([b,[c,I0,k,p],$0,a||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}var z=$.copyFile;if(z)$.copyFile=G;function G(C,i,x,g){if(typeof x==="function")g=x,x=0;return b(C,i,x,g);function b(c,I0,k,p,a){return z(c,I0,k,function($0){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))LK([b,[c,I0,k,p],$0,a||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}var H=$.readdir;$.readdir=X;var W=/^v[0-5]\./;function X(C,i,x){if(typeof i==="function")x=i,i=null;var g=W.test(process.version)?function(I0,k,p,a){return H(I0,b(I0,k,p,a))}:function(I0,k,p,a){return H(I0,k,b(I0,k,p,a))};return g(C,i,x);function b(c,I0,k,p){return function(a,$0){if(a&&(a.code==="EMFILE"||a.code==="ENFILE"))LK([g,[c,I0,k],a,p||Date.now(),Date.now()]);else{if($0&&$0.sort)$0.sort();if(typeof k==="function")k.call(this,a,$0)}}}}if(process.version.substr(0,4)==="v0.8"){var Z=YJ1($);F=Z.ReadStream,O=Z.WriteStream}var q=$.ReadStream;if(q)F.prototype=Object.create(q.prototype),F.prototype.open=N;var V=$.WriteStream;if(V)O.prototype=Object.create(V.prototype),O.prototype.open=D;Object.defineProperty($,"ReadStream",{get:function(){return F},set:function(C){F=C},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return O},set:function(C){O=C},enumerable:!0,configurable:!0});var w=F;Object.defineProperty($,"FileReadStream",{get:function(){return w},set:function(C){w=C},enumerable:!0,configurable:!0});var M=O;Object.defineProperty($,"FileWriteStream",{get:function(){return M},set:function(C){M=C},enumerable:!0,configurable:!0});function F(C,i){if(this instanceof F)return q.apply(this,arguments),this;else return F.apply(Object.create(F.prototype),arguments)}function N(){var C=this;E(C.path,C.flags,C.mode,function(i,x){if(i){if(C.autoClose)C.destroy();C.emit("error",i)}else C.fd=x,C.emit("open",x),C.read()})}function O(C,i){if(this instanceof O)return V.apply(this,arguments),this;else return O.apply(Object.create(O.prototype),arguments)}function D(){var C=this;E(C.path,C.flags,C.mode,function(i,x){if(i)C.destroy(),C.emit("error",i);else C.fd=x,C.emit("open",x)})}function P(C,i){return new $.ReadStream(C,i)}function T(C,i){return new $.WriteStream(C,i)}var B=$.open;$.open=E;function E(C,i,x,g){if(typeof x==="function")g=x,x=null;return b(C,i,x,g);function b(c,I0,k,p,a){return B(c,I0,k,function($0,y){if($0&&($0.code==="EMFILE"||$0.code==="ENFILE"))LK([b,[c,I0,k,p],$0,a||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}return $}function LK($){xU("ENQUEUE",$[0].name,$[1]),l4[U8].push($),tu()}var dD;function xW0(){var $=Date.now();for(var Y=0;Y<l4[U8].length;++Y)if(l4[U8][Y].length>2)l4[U8][Y][3]=$,l4[U8][Y][4]=$;tu()}function tu(){if(clearTimeout(dD),dD=void 0,l4[U8].length===0)return;var $=l4[U8].shift(),Y=$[0],U=$[1],I=$[2],Q=$[3],J=$[4];if(Q===void 0)xU("RETRY",Y.name,U),Y.apply(null,U);else if(Date.now()-Q>=60000){xU("TIMEOUT",Y.name,U);var K=U.pop();if(typeof K==="function")K.call(null,I)}else{var z=Date.now()-J,G=Math.max(J-Q,1),H=Math.min(G*1.2,100);if(z>=H)xU("RETRY",Y.name,U),Y.apply(null,U.concat([Q]));else l4[U8].push($)}if(dD===void 0)dD=setTimeout(tu,0)}});var bW0=j((yt1,$b)=>{function QJ1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var uW0=X6().Buffer,GX=K0("util");function JJ1($,Y,U){$.copy(Y,U)}$b.exports=function(){function $(){QJ1(this,$),this.h Line truncated
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*/NX0.exports=function($,Y){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var I="";if(U>4&&$[3]==="\\"){var Q=$[2];if((Q==="?"||Q===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),I="//"}var J=$.split(/[/\\]+/);if(Y!==!1&&J[J.length-1]==="")J.pop();return I+J.join("/")}});var Lb=j((it1,jX0)=>{var BX0=9007199254740991,zK1="[object Arguments]",GK1="[object Function]",HK1="[object GeneratorFunction]",WK1=/^(?:0|[1-9]\d*)$/;function AX0($,Y,U){switch(U.length){case 0:return $.call(Y);case 1:return $.call(Y,U[0]);case 2:return $.call(Y,U[0],U[1]);case 3:return $.call(Y,U[0],U[1],U[2])}return $.apply(Y,U)}function XK1($,Y){var U=-1,I=Array($);while(++U<$)I[U]=Y(U);return I}var qX=Object.prototype,VX=qX.hasOwnProperty,PX0=qX.toString,ZK1=qX.propertyIsEnumerable,DX0=Math.max;function qK1($,Y){var U=AK1($)||BK1($)?XK1($.length,String):[],I=U.length,Q=!!I;for(var J in $)if((Y||VX.call($,J))&&!(Q&&(J=="length"||EX0(J,I))))U.push(J);return U}function VK1($,Y,U,I){if($===void 0||Zb($,qX[U])&&!VX.call(I,U))return Y;return $}function LK1($,Y,U){var I=$[Y];if(!(VX.call($,Y)&&Zb(I,U))||U===void 0&&!(Y in $))$[Y]=U}function FK1($){if(!Vb($))return DK1($);var Y=NK1($),U=[];for(var I in $)if(!(I=="constructor"&&(Y||!VX.call($,I))))U.push(I);return U}function TX0($,Y){return Y=DX0(Y===void 0?$.length-1:Y,0),function(){var U=arguments,I=-1,Q=DX0(U.length-Y,0),J=Array(Q);while(++I<Q)J[I]=U[Y+I];I=-1;var K=Array(Y+1);while(++I<Y)K[I]=U[I];return K[Y]=J,AX0($,this,K)}}function wK1($,Y,U,I){U||(U={});var Q=-1,J=Y.length;while(++Q<J){var K=Y[Q],z=I?I(U[K],$[K],K,U,$):void 0;LK1(U,K,z===void 0?$[K]:z)}return U}function MK1($){return TX0(function(Y,U){var I=-1,Q=U.length,J=Q>1?U[Q-1]:void 0,K=Q>2?U[2]:void 0;if(J=$.length>3&&typeof J=="function"?(Q--,J):void 0,K&&OK1(U[0],U[1],K))J=Q<3?void 0:J,Q=1;Y=Object(Y);while(++I<Q){var z=U[I];if(z)$(Y,z,I,J)}return Y})}function EX0($,Y){return Y=Y==null?BX0:Y,!!Y&&(typeof $=="number"||WK1.test($))&&($>-1&&$%1==0&&$<Y)}function OK1($,Y,U){if(!Vb(U))return!1;var I=typeof Y;if(I=="number"?qb(U)&&EX0(Y,U.length):I=="string"&&(Y in U))return Zb(U[Y],$);return!1}function NK1($){var Y=$&&$.constructor,U=typeof Y=="function"&&Y.prototype||qX;return $===U}function DK1($){var Y=[];if($!=null)for(var U in Object($))Y.push(U);return Y}function Zb($,Y){return $===Y||$!==$&&Y!==Y}function BK1($){return PK1($)&&VX.call($,"callee")&&(!ZK1.call($,"callee")||PX0.call($)==zK1)}var AK1=Array.isArray;function qb($){return $!=null&&EK1($.length)&&!TK1($)}function PK1($){return jK1($)&&qb($)}function TK1($){var Y=Vb($)?PX0.call($):"";return Y==GK1||Y==HK1}function EK1($){return typeof $=="number"&&$>-1&&$%1==0&&$<=BX0}function Vb($){var Y=typeof $;return!!$&&(Y=="object"||Y=="function")}function jK1($){return!!$&&typeof $=="object"}var CK1=MK1(function($,Y,U,I){wK1(Y,_K1(Y),$,I)}),RK1=TX0(function($){return $.push(void 0,VK1),AX0(CK1,void 0,$)});function _K1($){return qb($)?qK1($,!0):FK1($)}jX0.exports=RK1});var RX0=j((ct1,Fb)=>{function vK1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var CX0=H6().Buffer,LX=K0("util");function SK1($,Y,U){$.copy(Y,U)}Fb.exports=function(){function $(){vK1(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var I={data:U,next:null};if(this.length>0)this.tail.next=I;else this.head=I;this.tail=I,++this.length},$.prototype.unshift=function(U){var I={data:U,next:this.head};if(this.length===0)this.tail=I;this.head=I,++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 I=this.head,Q=""+I.data;while(I=I.next)Q+=U+I.data;return Q},$.prototype.concat=function(U){if(this.length===0)return CX0.alloc(0);var I=CX0.allocUnsafe(U>>>0),Q=this.head,J=0;while(Q)SK1(Q.data,I,J),J+=Q.data.length,Q=Q.next;return I},$}();if(LX&&LX.inspect&&LX.inspect.custom)Fb.exports.prototype[LX.inspect.custom]=function(){var $=LX.inspect({length:this.length});return this.constructor.name+" "+$}});var wb=j((nt1,_X0)=>{var YB=G6();function hK1($,Y){var U=this,I=this._readableState&&this._readableState.destroyed,Q=this._writableState&&this._writableState.destroyed;if(I||Q){if(Y)Y($);else if($){if(!this._writableState)YB.nextTick(UB,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,YB.nextTick(UB,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(J){if(!Y&&J){if(!U._writableState)YB.nextTick(UB,U,J);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,YB.nextTick(UB,U,J)}else if(Y)Y(J)}),this}function gK1(){if(this._readableState)this._readabl Line truncated
%s`,P,P,N,I);var T=N.type==="*"?Yi:N.type==="?"?$i:"\\"+N.type;Q=!0,I=I.slice(0,N.reStart)+T+"\\("+P}if(V(),J)I+="\\\\";var B=!1;switch(I.charAt(0)){case"[":case".":case"(":B=!0}for(var E=z.length-1;E>-1;E--){var C=z[E],i=I.slice(0,C.reStart),x=I.slice(C.reStart,C.reEnd-8),g=I.slice(C.reEnd-8,C.reEnd),b=I.slice(C.reEnd);g+=b;var c=i.split("(").length-1,I0=b;for(w=0;w<c;w++)I0=I0.replace(/\)[+*?]?/,"");b=I0;var k="";if(b===""&&Y!==MB)k="$";var p=i+x+b+k+g;I=p}if(I!==""&&Q)I="(?=.)"+I;if(B)I=Z+I;if(Y===MB)return[I,Q];if(!Q)return eW1($);var a=U.nocase?"i":"";try{var $0=new RegExp("^"+I+"$",a)}catch(y){return new RegExp("$.")}return $0._glob=$,$0._src=I,$0}M$.makeRe=function($,Y){return new w6($,Y||{}).makeRe()};w6.prototype.makeRe=tW1;function tW1(){if(this.regexp||this.regexp===!1)return this.regexp;var $=this.set;if(!$.length)return this.regexp=!1,this.regexp;var Y=this.options,U=Y.noglobstar?Yi:Y.dot?dW1:pW1,I=Y.nocase?"i":"",Q=$.map(function(J){return J.map(function(K){return K===iU?U:typeof K==="string"?$X1(K):K._src}).join("\\/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,I)}catch(J){this.regexp=!1}return this.regexp}M$.match=function($,Y,U){U=U||{};var I=new w6(Y,U);if($=$.filter(function(Q){return I.match(Q)}),I.options.nonull&&!$.length)$.push(Y);return $};w6.prototype.match=function(Y,U){if(typeof U>"u")U=this.partial;if(this.debug("match",Y,this.pattern),this.comment)return!1;if(this.empty)return Y==="";if(Y==="/"&&U)return!0;var I=this.options;if(jX.sep!=="/")Y=Y.split(jX.sep).join("/");Y=Y.split(Hq0),this.debug(this.pattern,"split",Y);var Q=this.set;this.debug(this.pattern,"set",Q);var J,K;for(K=Y.length-1;K>=0;K--)if(J=Y[K],J)break;for(K=0;K<Q.length;K++){var z=Q[K],G=Y;if(I.matchBase&&z.length===1)G=[J];var H=this.matchOne(G,z,U);if(H){if(I.flipNegate)return!0;return!this.negate}}if(I.flipNegate)return!1;return this.negate};w6.prototype.matchOne=function($,Y,U){if(Y.indexOf(iU)!==-1)return this._matchGlobstar($,Y,U,0,0);return this._matchOne($,Y,U,0,0)};w6.prototype._matchGlobstar=function($,Y,U,I,Q){var J,K=-1;for(J=Q;J<Y.length;J++)if(Y[J]===iU){K=J;break}var z=-1;for(J=Y.length-1;J>=0;J--)if(Y[J]===iU){z=J;break}var G=Y.slice(Q,K),H=U?Y.slice(K+1):Y.slice(K+1,z),W=U?[]:Y.slice(z+1);if(G.length){var X=$.slice(I,I+G.length);if(!this._matchOne(X,G,U,0,0))return!1;I+=G.length}var Z=0;if(W.length){if(W.length+I>$.length)return!1;var q=$.length-W.length;if(this._matchOne($,W,U,q,0))Z=W.length;else{if($[$.length-1]!==""||I+W.length===$.length)return!1;if(q--,!this._matchOne($,W,U,q,0))return!1;Z=W.length+1}}if(!H.length){var V=!!Z;for(J=I;J<$.length-Z;J++){var w=String($[J]);if(V=!0,w==="."||w===".."||!this.options.dot&&w.charAt(0)===".")return!1}return U||V}var M=[[[],0]],F=M[0],N=0,O=[0];for(var D=0;D<H.length;D++){var P=H[D];if(P===iU)O.push(N),F=[[],0],M.push(F);else F[0].push(P),N++}var T=M.length-1,B=$.length-Z;for(var E=0;E<M.length;E++)M[E][1]=B-(O[T--]+M[E][0].length);return!!this._matchGlobStarBodySections($,M,I,0,U,0,!!Z)};w6.prototype._matchGlobStarBodySections=function($,Y,U,I,Q,J,K){var z=Y[I];if(!z){for(var G=U;G<$.length;G++){K=!0;var H=$[G];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1}return K}var W=z[0],X=z[1];while(U<=X){var Z=this._matchOne($.slice(0,U+W.length),W,Q,U,0);if(Z&&J<this.maxGlobstarRecursion){var q=this._matchGlobStarBodySections($,Y,U+W.length,I+1,Q,J+1,K);if(q!==!1)return q}var H=$[U];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1;U++}return Q||null};w6.prototype._matchOne=function($,Y,U,I,Q){var J,K,z,G;for(J=I,K=Q,z=$.length,G=Y.length;J<z&&K<G;J++,K++){this.debug("matchOne loop");var H=Y[K],W=$[J];if(this.debug(Y,H,W),H===!1||H===iU)return!1;var X;if(typeof H==="string")X=W===H,this.debug("string match",H,W,X);else X=W.match(H),this.debug("pattern match",H,W,X);if(!X)return!1}if(J===z&&K===G)return!0;else if(J===z)return U;else if(K===G)return J===z-1&&$[J]==="";throw Error("wtf?")};function eW1($){return $.replace(/\\(.)/g,"$1")}function $X1($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var BB=j((He1,DB)=>{function Zq0($){return $.charAt(0)==="/"}function qq0($){var Y=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=Y.exec($),I=U[1]||"",Q=Boolean(I&&I.charAt(1)!==":");return Boolean(U[2]||Q)}DB.exports=process.platform==="win32"?qq0:Zq0;DB.exports.posix=Zq0;DB.exports.win32=qq0});var Ii=j((WX1)=>{WX1.setopts=KX1;WX1.ownProp=Vq0;WX1.makeAbs=CX;WX1.finish=zX1;WX1.mark=GX1;WX1.isIgnored=Fq0;WX1.childrenIgnored=HX1;function Vq0($,Y){return Object.prototype.hasOwnProperty.call($,Y)}var YX1=K0("fs"),PK=K0("path"),UX1=NB(),Lq0=BB(),Ui=UX1.Minimatch;function IX1($,Y){return $.localeCompare(Y,"en")}function QX1($,Y){if($.ignore=Y.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(JX1)}function JX1($){var Y=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");Y=new Ui(U,{dot:!0})}return{ma Line truncated
See: https://github.com/isaacs/node-glob/issues/167`);return new C6($,Y).found}function C6($,Y){if(!$)throw Error("must provide pattern");if(typeof Y==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof C6))return new C6($,Y);if(OX1(this,$,Y),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var I=0;I<U;I++)this._process(this.minimatch.set[I],I,!1);this._finish()}C6.prototype._finish=function(){if(Mq0.ok(this instanceof C6),this.realpath){var $=this;this.matches.forEach(function(Y,U){var I=$.matches[U]=Object.create(null);for(var Q in Y)try{Q=$._makeAbs(Q);var J=MX1.realpathSync(Q,$.realpathCache);I[J]=!0}catch(K){if(K.syscall==="stat")I[$._makeAbs(Q)]=!0;else throw K}})}cU.finish(this)};C6.prototype._process=function($,Y,U){Mq0.ok(this instanceof C6);var I=0;while(typeof $[I]==="string")I++;var Q;switch(I){case $.length:this._processSimple($.join("/"),Y);return;case 0:Q=null;break;default:Q=$.slice(0,I).join("/");break}var J=$.slice(I),K;if(Q===null)K=".";else if(AB(Q)||AB($.map(function(H){return typeof H==="string"?H:"[*]"}).join("/"))){if(!Q||!AB(Q))Q="/"+Q;K=Q}else K=Q;var z=this._makeAbs(K);if(NX1(this,K))return;var G=J[0]===wq0.GLOBSTAR;if(G)this._processGlobStar(Q,K,z,J,Y,U);else this._processReaddir(Q,K,z,J,Y,U)};C6.prototype._processReaddir=function($,Y,U,I,Q,J){var K=this._readdir(U,J);if(!K)return;var z=I[0],G=!!this.minimatch.negate,H=z._glob,W=this.dot||H.charAt(0)===".",X=[];for(var Z=0;Z<K.length;Z++){var q=K[Z];if(q.charAt(0)!=="."||W){var V;if(G&&!$)V=!q.match(z);else V=q.match(z);if(V)X.push(q)}}var w=X.length;if(w===0)return;if(I.length===1&&!this.mark&&!this.stat){if(!this.matches[Q])this.matches[Q]=Object.create(null);for(var Z=0;Z<w;Z++){var q=X[Z];if($)if($.slice(-1)!=="/")q=$+"/"+q;else q=$+q;if(q.charAt(0)==="/"&&!this.nomount)q=Qi.join(this.root,q);this._emitMatch(Q,q)}return}I.shift();for(var Z=0;Z<w;Z++){var q=X[Z],M;if($)M=[$,q];else M=[q];this._process(M.concat(I),Q,J)}};C6.prototype._emitMatch=function($,Y){if(DX1(this,Y))return;var U=this._makeAbs(Y);if(this.mark)Y=this._mark(Y);if(this.absolute)Y=U;if(this.matches[$][Y])return;if(this.nodir){var I=this.cache[U];if(I==="DIR"||Array.isArray(I))return}if(this.matches[$][Y]=!0,this.stat)this._stat(Y)};C6.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var Y,U,I;try{U=this.fs.lstatSync($)}catch(J){if(J.code==="ENOENT")return null}var Q=U&&U.isSymbolicLink();if(this.symlinks[$]=Q,!Q&&U&&!U.isDirectory())this.cache[$]="FILE";else Y=this._readdir($,!1);return Y};C6.prototype._readdir=function($,Y){var U;if(Y&&!Ji(this.symlinks,$))return this._readdirInGlobStar($);if(Ji(this.cache,$)){var I=this.cache[$];if(!I||I==="FILE")return null;if(Array.isArray(I))return I}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(Q){return this._readdirError($,Q),null}};C6.prototype._readdirEntries=function($,Y){if(!this.mark&&!this.stat)for(var U=0;U<Y.length;U++){var I=Y[U];if($==="/")I=$+I;else I=$+"/"+I;this.cache[I]=!0}return this.cache[$]=Y,Y};C6.prototype._readdirError=function($,Y){switch(Y.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var I=Error(Y.code+" invalid cwd "+this.cwd);throw I.path=this.cwd,I.code=Y.code,I}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 Y;if(!this.silent)console.error("glob error",Y);break}};C6.prototype._processGlobStar=function($,Y,U,I,Q,J){var K=this._readdir(U,J);if(!K)return;var z=I.slice(1),G=$?[$]:[],H=G.concat(z);this._process(H,Q,!1);var W=K.length,X=this.symlinks[U];if(X&&J)return;for(var Z=0;Z<W;Z++){var q=K[Z];if(q.charAt(0)==="."&&!this.dot)continue;var V=G.concat(K[Z],z);this._process(V,Q,!0);var w=G.concat(K[Z],I);this._process(w,Q,!0)}};C6.prototype._processSimple=function($,Y){var U=this._stat($);if(!this.matches[Y])this.matches[Y]=Object.create(null);if(!U)return;if($&&AB($)&&!this.nomount){var I=/[\/\\]$/.test($);if($.charAt(0)==="/")$=Qi.join(this.root,$);else if($=Qi.resolve(this.root,$),I)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(Y,$)};C6.prototype._stat=function($){var Y=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&Ji(this.cache,Y)){var K=this.cache[Y];if(Array.isArray(K))K="DIR";if(!U||K==="DIR")return K;if(U&&K==="FILE")return!1}var I,Q=this.statCache[Y];if(!Q){var J;try{J=this.fs.lstatSync(Y)}catch(z){if(z&&(z.code==="ENOENT"||z.code==="ENOTDIR"))return this.statCache[Y]=!1,!1}if(J&&J.isSymbolicLink())try{Q=this.fs.statSync(Y)}catch(z){Q=J}else Q=J}this.statCache[Y]=Q;var K=!0;if(Q)K=Q.isDirectory()?"DIR":"FILE";if(this.cache[Y]=this.cache[Y]||K,U&&K==="FILE")return!1;return K};C6.prototype._mark=function($){return cU.mark(this,$)};C6.prototype._makeAbs=function($){return cU.makeAbs(this,$)}});var Ki=j((Le1,Aq0)=>{Aq0.exports=Bq0;function Bq0($,Y){if($&&Y)return Bq0($)(Y);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(I){U[I]=$[I]}),U;f Line truncated
`);if($.linkname)Y+=Qc(" linkpath="+$.linkname+`
`);var U=$.pax;if(U)for(var I in U)Y+=Qc(" "+I+"="+U[I]+`
`);return Buffer.from(Y)};vV1.decodePax=function($){var Y={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var I=parseInt($.slice(0,U).toString(),10);if(!I)return Y;var Q=$.slice(U+1,I-1).toString(),J=Q.indexOf("=");if(J===-1)return Y;Y[Q.slice(0,J)]=Q.slice(J+1),$=$.slice(I)}return Y};vV1.encode=function($){var Y=NV1(512),U=$.name,I="";if($.typeflag===5&&U[U.length-1]!=="/")U+="/";if(Buffer.byteLength(U)!==U.length)return null;while(Buffer.byteLength(U)>100){var Q=U.indexOf("/");if(Q===-1)return null;I+=I?"/"+U.slice(0,Q):U.slice(0,Q),U=U.slice(Q+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(I)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(Y.write(U),Y.write(_2($.mode&EV1,6),100),Y.write(_2($.uid,6),108),Y.write(_2($.gid,6),116),Y.write(_2($.size,11),124),Y.write(_2($.mtime.getTime()/1000|0,11),136),Y[156]=xL0+RV1($.type),$.linkname)Y.write($.linkname,157);if(fL0.copy(Y,dX),AV1.copy(Y,Jc),$.uname)Y.write($.uname,265);if($.gname)Y.write($.gname,297);if(Y.write(_2($.devmajor||0,6),329),Y.write(_2($.devminor||0,6),337),I)Y.write(I,345);return Y.write(_2(bL0(Y),6),148),Y};vV1.decode=function($,Y,U){var I=$[156]===0?0:$[156]-xL0,Q=hK($,0,100,Y),J=v2($,100,8),K=v2($,108,8),z=v2($,116,8),G=v2($,124,12),H=v2($,136,12),W=CV1(I),X=$[157]===0?null:hK($,157,100,Y),Z=hK($,265,32),q=hK($,297,32),V=v2($,329,8),w=v2($,337,8),M=bL0($);if(M===256)return null;if(M!==v2($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(fL0.compare($,dX,dX+6)===0){if($[345])Q=hK($,345,155,Y)+"/"+Q}else if(PV1.compare($,dX,dX+6)===0&&TV1.compare($,Jc,Jc+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(I===0&&Q&&Q[Q.length-1]==="/")I=5;return{name:Q,mode:J,uid:K,gid:z,size:G,mtime:new Date(1000*H),type:W,linkname:X,uname:Z,gname:q,devmajor:V,devminor:w}}});var lL0=j((H04,mL0)=>{var cL0=K0("util"),xV1=kL0(),pX=Kc(),nL0=g8().Writable,dL0=g8().PassThrough,pL0=function(){},iL0=function($){return $&=511,$&&512-$},fV1=function($,Y){var U=new nB($,Y);return U.end(),U},uV1=function($,Y){if(Y.path)$.name=Y.path;if(Y.linkpath)$.linkname=Y.linkpath;if(Y.size)$.size=parseInt(Y.size,10);return $.pax=Y,$},nB=function($,Y){this._parent=$,this.offset=Y,dL0.call(this,{autoDestroy:!1})};cL0.inherits(nB,dL0);nB.prototype.destroy=function($){this._parent.destroy($)};var S3=function($){if(!(this instanceof S3))return new S3($);nL0.call(this,$),$=$||{},this._offset=0,this._buffer=xV1(),this._missing=0,this._partial=!1,this._onparse=pL0,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 Y=this,U=Y._buffer,I=function(){Y._continue()},Q=function(Z){if(Y._locked=!1,Z)return Y.destroy(Z);if(!Y._stream)I()},J=function(){Y._stream=null;var Z=iL0(Y._header.size);if(Z)Y._parse(Z,K);else Y._parse(512,X);if(!Y._locked)I()},K=function(){Y._buffer.consume(iL0(Y._header.size)),Y._parse(512,X),I()},z=function(){var Z=Y._header.size;Y._paxGlobal=pX.decodePax(U.slice(0,Z)),U.consume(Z),J()},G=function(){var Z=Y._header.size;if(Y._pax=pX.decodePax(U.slice(0,Z)),Y._paxGlobal)Y._pax=Object.assign({},Y._paxGlobal,Y._pax);U.consume(Z),J()},H=function(){var Z=Y._header.size;this._gnuLongPath=pX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},W=function(){var Z=Y._header.size;this._gnuLongLinkPath=pX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},X=function(){var Z=Y._offset,q;try{q=Y._header=pX.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(V){Y.emit("error",V)}if(U.consume(512),!q){Y._parse(512,X),I();return}if(q.type==="gnu-long-path"){Y._parse(q.size,H),I();return}if(q.type==="gnu-long-link-path"){Y._parse(q.size,W),I();return}if(q.type==="pax-global-header"){Y._parse(q.size,z),I();return}if(q.type==="pax-header"){Y._parse(q.size,G),I();return}if(Y._gnuLongPath)q.name=Y._gnuLongPath,Y._gnuLongPath=null;if(Y._gnuLongLinkPath)q.linkname=Y._gnuLongLinkPath,Y._gnuLongLinkPath=null;if(Y._pax)Y._header=q=uV1(q,Y._pax),Y._pax=null;if(Y._locked=!0,!q.size||q.type==="directory"){Y._parse(512,X),Y.emit("entry",q,fV1(Y,Z),Q);return}Y._stream=new nB(Y,Z),Y.emit("entry",q,Y._stream,Q),Y._parse(q.size,J),I()};this._onheader=X,this._parse(512,X)};cL0.inherits(S3,nL0);S3.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};S3.prototype._parse=function($,Y){if(this._destroyed)return;if(this._offset+=$,this._missing=$,Y===this._onheader)this._partial=!1;this._onparse=Y};S3.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=pL0,this._overflow)this._write(this._overflow,void 0,$);else $()};S3.prototype._write=function($,Y,U){if(this._destroyed)return;var I=this._stream,Q=this._buffer,J=this._missing;if($.length)this._partial=!0;if($.length<J) Line truncated
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship($){if(!this.count)this._writeOpen();let Y=`rId${++this.count}`;if($.TargetMode)this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${QL1.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${$.Target}"/>`);return Y}_writeClose(){this.stream.write("</Relationships>")}}OF0.exports=MF0});var TF0=j((O04,PF0)=>{var DF0=a6(),BF0=G2(),KL1=n4(),zL1=Of(),GL1=Df();class AF0{constructor($,Y,U){this.id=U.id,this.count=0,this._worksheet=$,this._workbook=U.workbook,this._sheetRelsWriter=Y}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:BF0.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let Y={Type:BF0.VmlDrawing,Target:`../drawings/vmlDrawing${this.id}.vml`};this.vmlRelId=this._sheetRelsWriter.addRelationship(Y)}_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($,Y){let U=new zL1,I=new DF0;U.render(I,$),this.commentsStream.write(I.xml);let Q=new GL1,J=new DF0;Q.render(J,$,Y),this.vmlStream.write(J.xml)}_writeClose(){this.commentsStream.write("</commentList></comments>"),this.vmlStream.write("</xml>")}addComments($){if($&&$.length){if(!this.startedData)this._worksheet.comments=[],this._writeOpen(),this._addRelationships(),this._addCommentRefs(),this.startedData=!0;$.forEach((Y)=>{Y.refAddress=KL1.decodeAddress(Y.ref)}),$.forEach((Y)=>{this._writeComment(Y,this.count),this.count+=1})}}commit(){if(this.count)this._writeClose(),this.commentsStream.end(),this.vmlStream.end()}}PF0.exports=AF0});var vF0=j((N04,_F0)=>{var HL1=U6(),WL1=G2(),Hc=n4(),EF0=fg(),jF0=H3(),XL1=tk(),CF0=oM(),Wc=sM(),ZL1=NF0(),qL1=TF0(),VL1=kg(),b6=new XL1,Xc=J2(),LL1=lx(),FL1=ox(),wL1=rx(),ML1=nx(),OL1=ix(),NL1=dx(),DL1=sx(),BL1=ax(),AL1=tx(),PL1=ex(),TL1=$f(),EL1=Yf(),jL1=Kf(),CL1=If(),RL1=Uf(),i6={dataValidations:new LL1,sheetProperties:new FL1,sheetFormatProperties:new wL1,columns:new Xc({tag:"cols",length:!1,childXform:new ML1}),row:new OL1,hyperlinks:new Xc({tag:"hyperlinks",length:!1,childXform:new NL1}),sheetViews:new Xc({tag:"sheetViews",length:!1,childXform:new DL1}),sheetProtection:new BL1,pageMargins:new AL1,pageSeteup:new PL1,autoFilter:new TL1,picture:new EL1,conditionalFormattings:new jL1,headerFooter:new CL1,rowBreaks:new RL1};class RF0{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 ZL1($),this._sheetCommentsWriter=new qL1(this,this._sheetRelsWriter,$),this._dimensions=new jF0,this._rowZero=1,this.committed=!1,this.dataValidations=new VL1,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
*/EX0.exports=function($,Y){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var I="";if(U>4&&$[3]==="\\"){var Q=$[2];if((Q==="?"||Q===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),I="//"}var J=$.split(/[/\\]+/);if(Y!==!1&&J[J.length-1]==="")J.pop();return I+J.join("/")}});var Ob=j((lt1,hX0)=>{var CX0=9007199254740991,XK1="[object Arguments]",ZK1="[object Function]",qK1="[object GeneratorFunction]",VK1=/^(?:0|[1-9]\d*)$/;function RX0($,Y,U){switch(U.length){case 0:return $.call(Y);case 1:return $.call(Y,U[0]);case 2:return $.call(Y,U[0],U[1]);case 3:return $.call(Y,U[0],U[1],U[2])}return $.apply(Y,U)}function LK1($,Y){var U=-1,I=Array($);while(++U<$)I[U]=Y(U);return I}var wX=Object.prototype,MX=wX.hasOwnProperty,_X0=wX.toString,FK1=wX.propertyIsEnumerable,jX0=Math.max;function wK1($,Y){var U=jK1($)||EK1($)?LK1($.length,String):[],I=U.length,Q=!!I;for(var J in $)if((Y||MX.call($,J))&&!(Q&&(J=="length"||SX0(J,I))))U.push(J);return U}function MK1($,Y,U,I){if($===void 0||Fb($,wX[U])&&!MX.call(I,U))return Y;return $}function OK1($,Y,U){var I=$[Y];if(!(MX.call($,Y)&&Fb(I,U))||U===void 0&&!(Y in $))$[Y]=U}function NK1($){if(!Mb($))return TK1($);var Y=PK1($),U=[];for(var I in $)if(!(I=="constructor"&&(Y||!MX.call($,I))))U.push(I);return U}function vX0($,Y){return Y=jX0(Y===void 0?$.length-1:Y,0),function(){var U=arguments,I=-1,Q=jX0(U.length-Y,0),J=Array(Q);while(++I<Q)J[I]=U[Y+I];I=-1;var K=Array(Y+1);while(++I<Y)K[I]=U[I];return K[Y]=J,RX0($,this,K)}}function DK1($,Y,U,I){U||(U={});var Q=-1,J=Y.length;while(++Q<J){var K=Y[Q],z=I?I(U[K],$[K],K,U,$):void 0;OK1(U,K,z===void 0?$[K]:z)}return U}function BK1($){return vX0(function(Y,U){var I=-1,Q=U.length,J=Q>1?U[Q-1]:void 0,K=Q>2?U[2]:void 0;if(J=$.length>3&&typeof J=="function"?(Q--,J):void 0,K&&AK1(U[0],U[1],K))J=Q<3?void 0:J,Q=1;Y=Object(Y);while(++I<Q){var z=U[I];if(z)$(Y,z,I,J)}return Y})}function SX0($,Y){return Y=Y==null?CX0:Y,!!Y&&(typeof $=="number"||VK1.test($))&&($>-1&&$%1==0&&$<Y)}function AK1($,Y,U){if(!Mb(U))return!1;var I=typeof Y;if(I=="number"?wb(U)&&SX0(Y,U.length):I=="string"&&(Y in U))return Fb(U[Y],$);return!1}function PK1($){var Y=$&&$.constructor,U=typeof Y=="function"&&Y.prototype||wX;return $===U}function TK1($){var Y=[];if($!=null)for(var U in Object($))Y.push(U);return Y}function Fb($,Y){return $===Y||$!==$&&Y!==Y}function EK1($){return CK1($)&&MX.call($,"callee")&&(!FK1.call($,"callee")||_X0.call($)==XK1)}var jK1=Array.isArray;function wb($){return $!=null&&_K1($.length)&&!RK1($)}function CK1($){return vK1($)&&wb($)}function RK1($){var Y=Mb($)?_X0.call($):"";return Y==ZK1||Y==qK1}function _K1($){return typeof $=="number"&&$>-1&&$%1==0&&$<=CX0}function Mb($){var Y=typeof $;return!!$&&(Y=="object"||Y=="function")}function vK1($){return!!$&&typeof $=="object"}var SK1=BK1(function($,Y,U,I){DK1(Y,gK1(Y),$,I)}),hK1=vX0(function($){return $.push(void 0,MK1),RX0(SK1,void 0,$)});function gK1($){return wb($)?wK1($,!0):NK1($)}hX0.exports=hK1});var yX0=j((ot1,Nb)=>{function yK1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var gX0=X6().Buffer,OX=K0("util");function kK1($,Y,U){$.copy(Y,U)}Nb.exports=function(){function $(){yK1(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var I={data:U,next:null};if(this.length>0)this.tail.next=I;else this.head=I;this.tail=I,++this.length},$.prototype.unshift=function(U){var I={data:U,next:this.head};if(this.length===0)this.tail=I;this.head=I,++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 I=this.head,Q=""+I.data;while(I=I.next)Q+=U+I.data;return Q},$.prototype.concat=function(U){if(this.length===0)return gX0.alloc(0);var I=gX0.allocUnsafe(U>>>0),Q=this.head,J=0;while(Q)kK1(Q.data,I,J),J+=Q.data.length,Q=Q.next;return I},$}();if(OX&&OX.inspect&&OX.inspect.custom)Nb.exports.prototype[OX.inspect.custom]=function(){var $=OX.inspect({length:this.length});return this.constructor.name+" "+$}});var Db=j((rt1,kX0)=>{var QB=W6();function xK1($,Y){var U=this,I=this._readableState&&this._readableState.destroyed,Q=this._writableState&&this._writableState.destroyed;if(I||Q){if(Y)Y($);else if($){if(!this._writableState)QB.nextTick(JB,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,QB.nextTick(JB,this,$)}return this}if(this._readableState)this._readableState.destroyed=!0;if(this._writableState)this._writableState.destroyed=!0;return this._destroy($||null,function(J){if(!Y&&J){if(!U._writableState)QB.nextTick(JB,U,J);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,QB.nextTick(JB,U,J)}else if(Y)Y(J)}),this}function fK1(){if(this._readableState)this._readabl Line truncated
%s`,P,P,N,I);var T=N.type==="*"?Ji:N.type==="?"?Qi:"\\"+N.type;Q=!0,I=I.slice(0,N.reStart)+T+"\\("+P}if(V(),J)I+="\\\\";var B=!1;switch(I.charAt(0)){case"[":case".":case"(":B=!0}for(var E=z.length-1;E>-1;E--){var C=z[E],i=I.slice(0,C.reStart),x=I.slice(C.reStart,C.reEnd-8),g=I.slice(C.reEnd-8,C.reEnd),b=I.slice(C.reEnd);g+=b;var c=i.split("(").length-1,I0=b;for(w=0;w<c;w++)I0=I0.replace(/\)[+*?]?/,"");b=I0;var k="";if(b===""&&Y!==DB)k="$";var p=i+x+b+k+g;I=p}if(I!==""&&Q)I="(?=.)"+I;if(B)I=Z+I;if(Y===DB)return[I,Q];if(!Q)return IX1($);var a=U.nocase?"i":"";try{var $0=new RegExp("^"+I+"$",a)}catch(y){return new RegExp("$.")}return $0._glob=$,$0._src=I,$0}O$.makeRe=function($,Y){return new O6($,Y||{}).makeRe()};O6.prototype.makeRe=UX1;function UX1(){if(this.regexp||this.regexp===!1)return this.regexp;var $=this.set;if(!$.length)return this.regexp=!1,this.regexp;var Y=this.options,U=Y.noglobstar?Ji:Y.dot?oW1:rW1,I=Y.nocase?"i":"",Q=$.map(function(J){return J.map(function(K){return K===mU?U:typeof K==="string"?QX1(K):K._src}).join("\\/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,I)}catch(J){this.regexp=!1}return this.regexp}O$.match=function($,Y,U){U=U||{};var I=new O6(Y,U);if($=$.filter(function(Q){return I.match(Q)}),I.options.nonull&&!$.length)$.push(Y);return $};O6.prototype.match=function(Y,U){if(typeof U>"u")U=this.partial;if(this.debug("match",Y,this.pattern),this.comment)return!1;if(this.empty)return Y==="";if(Y==="/"&&U)return!0;var I=this.options;if(vX.sep!=="/")Y=Y.split(vX.sep).join("/");Y=Y.split(Lq0),this.debug(this.pattern,"split",Y);var Q=this.set;this.debug(this.pattern,"set",Q);var J,K;for(K=Y.length-1;K>=0;K--)if(J=Y[K],J)break;for(K=0;K<Q.length;K++){var z=Q[K],G=Y;if(I.matchBase&&z.length===1)G=[J];var H=this.matchOne(G,z,U);if(H){if(I.flipNegate)return!0;return!this.negate}}if(I.flipNegate)return!1;return this.negate};O6.prototype.matchOne=function($,Y,U){if(Y.indexOf(mU)!==-1)return this._matchGlobstar($,Y,U,0,0);return this._matchOne($,Y,U,0,0)};O6.prototype._matchGlobstar=function($,Y,U,I,Q){var J,K=-1;for(J=Q;J<Y.length;J++)if(Y[J]===mU){K=J;break}var z=-1;for(J=Y.length-1;J>=0;J--)if(Y[J]===mU){z=J;break}var G=Y.slice(Q,K),H=U?Y.slice(K+1):Y.slice(K+1,z),W=U?[]:Y.slice(z+1);if(G.length){var X=$.slice(I,I+G.length);if(!this._matchOne(X,G,U,0,0))return!1;I+=G.length}var Z=0;if(W.length){if(W.length+I>$.length)return!1;var q=$.length-W.length;if(this._matchOne($,W,U,q,0))Z=W.length;else{if($[$.length-1]!==""||I+W.length===$.length)return!1;if(q--,!this._matchOne($,W,U,q,0))return!1;Z=W.length+1}}if(!H.length){var V=!!Z;for(J=I;J<$.length-Z;J++){var w=String($[J]);if(V=!0,w==="."||w===".."||!this.options.dot&&w.charAt(0)===".")return!1}return U||V}var M=[[[],0]],F=M[0],N=0,O=[0];for(var D=0;D<H.length;D++){var P=H[D];if(P===mU)O.push(N),F=[[],0],M.push(F);else F[0].push(P),N++}var T=M.length-1,B=$.length-Z;for(var E=0;E<M.length;E++)M[E][1]=B-(O[T--]+M[E][0].length);return!!this._matchGlobStarBodySections($,M,I,0,U,0,!!Z)};O6.prototype._matchGlobStarBodySections=function($,Y,U,I,Q,J,K){var z=Y[I];if(!z){for(var G=U;G<$.length;G++){K=!0;var H=$[G];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1}return K}var W=z[0],X=z[1];while(U<=X){var Z=this._matchOne($.slice(0,U+W.length),W,Q,U,0);if(Z&&J<this.maxGlobstarRecursion){var q=this._matchGlobStarBodySections($,Y,U+W.length,I+1,Q,J+1,K);if(q!==!1)return q}var H=$[U];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1;U++}return Q||null};O6.prototype._matchOne=function($,Y,U,I,Q){var J,K,z,G;for(J=I,K=Q,z=$.length,G=Y.length;J<z&&K<G;J++,K++){this.debug("matchOne loop");var H=Y[K],W=$[J];if(this.debug(Y,H,W),H===!1||H===mU)return!1;var X;if(typeof H==="string")X=W===H,this.debug("string match",H,W,X);else X=W.match(H),this.debug("pattern match",H,W,X);if(!X)return!1}if(J===z&&K===G)return!0;else if(J===z)return U;else if(K===G)return J===z-1&&$[J]==="";throw Error("wtf?")};function IX1($){return $.replace(/\\(.)/g,"$1")}function QX1($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var TB=j((Le1,PB)=>{function Mq0($){return $.charAt(0)==="/"}function Oq0($){var Y=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=Y.exec($),I=U[1]||"",Q=Boolean(I&&I.charAt(1)!==":");return Boolean(U[2]||Q)}PB.exports=process.platform==="win32"?Oq0:Mq0;PB.exports.posix=Mq0;PB.exports.win32=Oq0});var zi=j((VX1)=>{VX1.setopts=WX1;VX1.ownProp=Nq0;VX1.makeAbs=SX;VX1.finish=XX1;VX1.mark=ZX1;VX1.isIgnored=Bq0;VX1.childrenIgnored=qX1;function Nq0($,Y){return Object.prototype.hasOwnProperty.call($,Y)}var JX1=K0("fs"),CK=K0("path"),KX1=AB(),Dq0=TB(),Ki=KX1.Minimatch;function zX1($,Y){return $.localeCompare(Y,"en")}function GX1($,Y){if($.ignore=Y.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(HX1)}function HX1($){var Y=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");Y=new Ki(U,{dot:!0})}return{ma Line truncated
See: https://github.com/isaacs/node-glob/issues/167`);return new _6($,Y).found}function _6($,Y){if(!$)throw Error("must provide pattern");if(typeof Y==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof _6))return new _6($,Y);if(AX1(this,$,Y),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var I=0;I<U;I++)this._process(this.minimatch.set[I],I,!1);this._finish()}_6.prototype._finish=function(){if(Pq0.ok(this instanceof _6),this.realpath){var $=this;this.matches.forEach(function(Y,U){var I=$.matches[U]=Object.create(null);for(var Q in Y)try{Q=$._makeAbs(Q);var J=BX1.realpathSync(Q,$.realpathCache);I[J]=!0}catch(K){if(K.syscall==="stat")I[$._makeAbs(Q)]=!0;else throw K}})}lU.finish(this)};_6.prototype._process=function($,Y,U){Pq0.ok(this instanceof _6);var I=0;while(typeof $[I]==="string")I++;var Q;switch(I){case $.length:this._processSimple($.join("/"),Y);return;case 0:Q=null;break;default:Q=$.slice(0,I).join("/");break}var J=$.slice(I),K;if(Q===null)K=".";else if(EB(Q)||EB($.map(function(H){return typeof H==="string"?H:"[*]"}).join("/"))){if(!Q||!EB(Q))Q="/"+Q;K=Q}else K=Q;var z=this._makeAbs(K);if(PX1(this,K))return;var G=J[0]===Aq0.GLOBSTAR;if(G)this._processGlobStar(Q,K,z,J,Y,U);else this._processReaddir(Q,K,z,J,Y,U)};_6.prototype._processReaddir=function($,Y,U,I,Q,J){var K=this._readdir(U,J);if(!K)return;var z=I[0],G=!!this.minimatch.negate,H=z._glob,W=this.dot||H.charAt(0)===".",X=[];for(var Z=0;Z<K.length;Z++){var q=K[Z];if(q.charAt(0)!=="."||W){var V;if(G&&!$)V=!q.match(z);else V=q.match(z);if(V)X.push(q)}}var w=X.length;if(w===0)return;if(I.length===1&&!this.mark&&!this.stat){if(!this.matches[Q])this.matches[Q]=Object.create(null);for(var Z=0;Z<w;Z++){var q=X[Z];if($)if($.slice(-1)!=="/")q=$+"/"+q;else q=$+q;if(q.charAt(0)==="/"&&!this.nomount)q=Gi.join(this.root,q);this._emitMatch(Q,q)}return}I.shift();for(var Z=0;Z<w;Z++){var q=X[Z],M;if($)M=[$,q];else M=[q];this._process(M.concat(I),Q,J)}};_6.prototype._emitMatch=function($,Y){if(TX1(this,Y))return;var U=this._makeAbs(Y);if(this.mark)Y=this._mark(Y);if(this.absolute)Y=U;if(this.matches[$][Y])return;if(this.nodir){var I=this.cache[U];if(I==="DIR"||Array.isArray(I))return}if(this.matches[$][Y]=!0,this.stat)this._stat(Y)};_6.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var Y,U,I;try{U=this.fs.lstatSync($)}catch(J){if(J.code==="ENOENT")return null}var Q=U&&U.isSymbolicLink();if(this.symlinks[$]=Q,!Q&&U&&!U.isDirectory())this.cache[$]="FILE";else Y=this._readdir($,!1);return Y};_6.prototype._readdir=function($,Y){var U;if(Y&&!Hi(this.symlinks,$))return this._readdirInGlobStar($);if(Hi(this.cache,$)){var I=this.cache[$];if(!I||I==="FILE")return null;if(Array.isArray(I))return I}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(Q){return this._readdirError($,Q),null}};_6.prototype._readdirEntries=function($,Y){if(!this.mark&&!this.stat)for(var U=0;U<Y.length;U++){var I=Y[U];if($==="/")I=$+I;else I=$+"/"+I;this.cache[I]=!0}return this.cache[$]=Y,Y};_6.prototype._readdirError=function($,Y){switch(Y.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var I=Error(Y.code+" invalid cwd "+this.cwd);throw I.path=this.cwd,I.code=Y.code,I}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 Y;if(!this.silent)console.error("glob error",Y);break}};_6.prototype._processGlobStar=function($,Y,U,I,Q,J){var K=this._readdir(U,J);if(!K)return;var z=I.slice(1),G=$?[$]:[],H=G.concat(z);this._process(H,Q,!1);var W=K.length,X=this.symlinks[U];if(X&&J)return;for(var Z=0;Z<W;Z++){var q=K[Z];if(q.charAt(0)==="."&&!this.dot)continue;var V=G.concat(K[Z],z);this._process(V,Q,!0);var w=G.concat(K[Z],I);this._process(w,Q,!0)}};_6.prototype._processSimple=function($,Y){var U=this._stat($);if(!this.matches[Y])this.matches[Y]=Object.create(null);if(!U)return;if($&&EB($)&&!this.nomount){var I=/[\/\\]$/.test($);if($.charAt(0)==="/")$=Gi.join(this.root,$);else if($=Gi.resolve(this.root,$),I)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(Y,$)};_6.prototype._stat=function($){var Y=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&Hi(this.cache,Y)){var K=this.cache[Y];if(Array.isArray(K))K="DIR";if(!U||K==="DIR")return K;if(U&&K==="FILE")return!1}var I,Q=this.statCache[Y];if(!Q){var J;try{J=this.fs.lstatSync(Y)}catch(z){if(z&&(z.code==="ENOENT"||z.code==="ENOTDIR"))return this.statCache[Y]=!1,!1}if(J&&J.isSymbolicLink())try{Q=this.fs.statSync(Y)}catch(z){Q=J}else Q=J}this.statCache[Y]=Q;var K=!0;if(Q)K=Q.isDirectory()?"DIR":"FILE";if(this.cache[Y]=this.cache[Y]||K,U&&K==="FILE")return!1;return K};_6.prototype._mark=function($){return lU.mark(this,$)};_6.prototype._makeAbs=function($){return lU.makeAbs(this,$)}});var Wi=j((De1,Rq0)=>{Rq0.exports=Cq0;function Cq0($,Y){if($&&Y)return Cq0($)(Y);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(I){U[I]=$[I]}),U;f Line truncated
`);if($.linkname)Y+=Gc(" linkpath="+$.linkname+`
`);var U=$.pax;if(U)for(var I in U)Y+=Gc(" "+I+"="+U[I]+`
`);return Buffer.from(Y)};yV1.decodePax=function($){var Y={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var I=parseInt($.slice(0,U).toString(),10);if(!I)return Y;var Q=$.slice(U+1,I-1).toString(),J=Q.indexOf("=");if(J===-1)return Y;Y[Q.slice(0,J)]=Q.slice(J+1),$=$.slice(I)}return Y};yV1.encode=function($){var Y=PV1(512),U=$.name,I="";if($.typeflag===5&&U[U.length-1]!=="/")U+="/";if(Buffer.byteLength(U)!==U.length)return null;while(Buffer.byteLength(U)>100){var Q=U.indexOf("/");if(Q===-1)return null;I+=I?"/"+U.slice(0,Q):U.slice(0,Q),U=U.slice(Q+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(I)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(Y.write(U),Y.write(S2($.mode&_V1,6),100),Y.write(S2($.uid,6),108),Y.write(S2($.gid,6),116),Y.write(S2($.size,11),124),Y.write(S2($.mtime.getTime()/1000|0,11),136),Y[156]=nL0+hV1($.type),$.linkname)Y.write($.linkname,157);if(dL0.copy(Y,oX),jV1.copy(Y,Hc),$.uname)Y.write($.uname,265);if($.gname)Y.write($.gname,297);if(Y.write(S2($.devmajor||0,6),329),Y.write(S2($.devminor||0,6),337),I)Y.write(I,345);return Y.write(S2(mL0(Y),6),148),Y};yV1.decode=function($,Y,U){var I=$[156]===0?0:$[156]-nL0,Q=xK($,0,100,Y),J=h2($,100,8),K=h2($,108,8),z=h2($,116,8),G=h2($,124,12),H=h2($,136,12),W=SV1(I),X=$[157]===0?null:xK($,157,100,Y),Z=xK($,265,32),q=xK($,297,32),V=h2($,329,8),w=h2($,337,8),M=mL0($);if(M===256)return null;if(M!==h2($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(dL0.compare($,oX,oX+6)===0){if($[345])Q=xK($,345,155,Y)+"/"+Q}else if(CV1.compare($,oX,oX+6)===0&&RV1.compare($,Hc,Hc+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(I===0&&Q&&Q[Q.length-1]==="/")I=5;return{name:Q,mode:J,uid:K,gid:z,size:G,mtime:new Date(1000*H),type:W,linkname:X,uname:Z,gname:q,devmajor:V,devminor:w}}});var eL0=j((L04,tL0)=>{var oL0=K0("util"),iV1=cL0(),rX=Wc(),rL0=y8().Writable,sL0=y8().PassThrough,aL0=function(){},lL0=function($){return $&=511,$&&512-$},cV1=function($,Y){var U=new mB($,Y);return U.end(),U},nV1=function($,Y){if(Y.path)$.name=Y.path;if(Y.linkpath)$.linkname=Y.linkpath;if(Y.size)$.size=parseInt(Y.size,10);return $.pax=Y,$},mB=function($,Y){this._parent=$,this.offset=Y,sL0.call(this,{autoDestroy:!1})};oL0.inherits(mB,sL0);mB.prototype.destroy=function($){this._parent.destroy($)};var h3=function($){if(!(this instanceof h3))return new h3($);rL0.call(this,$),$=$||{},this._offset=0,this._buffer=iV1(),this._missing=0,this._partial=!1,this._onparse=aL0,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 Y=this,U=Y._buffer,I=function(){Y._continue()},Q=function(Z){if(Y._locked=!1,Z)return Y.destroy(Z);if(!Y._stream)I()},J=function(){Y._stream=null;var Z=lL0(Y._header.size);if(Z)Y._parse(Z,K);else Y._parse(512,X);if(!Y._locked)I()},K=function(){Y._buffer.consume(lL0(Y._header.size)),Y._parse(512,X),I()},z=function(){var Z=Y._header.size;Y._paxGlobal=rX.decodePax(U.slice(0,Z)),U.consume(Z),J()},G=function(){var Z=Y._header.size;if(Y._pax=rX.decodePax(U.slice(0,Z)),Y._paxGlobal)Y._pax=Object.assign({},Y._paxGlobal,Y._pax);U.consume(Z),J()},H=function(){var Z=Y._header.size;this._gnuLongPath=rX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},W=function(){var Z=Y._header.size;this._gnuLongLinkPath=rX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},X=function(){var Z=Y._offset,q;try{q=Y._header=rX.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(V){Y.emit("error",V)}if(U.consume(512),!q){Y._parse(512,X),I();return}if(q.type==="gnu-long-path"){Y._parse(q.size,H),I();return}if(q.type==="gnu-long-link-path"){Y._parse(q.size,W),I();return}if(q.type==="pax-global-header"){Y._parse(q.size,z),I();return}if(q.type==="pax-header"){Y._parse(q.size,G),I();return}if(Y._gnuLongPath)q.name=Y._gnuLongPath,Y._gnuLongPath=null;if(Y._gnuLongLinkPath)q.linkname=Y._gnuLongLinkPath,Y._gnuLongLinkPath=null;if(Y._pax)Y._header=q=nV1(q,Y._pax),Y._pax=null;if(Y._locked=!0,!q.size||q.type==="directory"){Y._parse(512,X),Y.emit("entry",q,cV1(Y,Z),Q);return}Y._stream=new mB(Y,Z),Y.emit("entry",q,Y._stream,Q),Y._parse(q.size,J),I()};this._onheader=X,this._parse(512,X)};oL0.inherits(h3,rL0);h3.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};h3.prototype._parse=function($,Y){if(this._destroyed)return;if(this._offset+=$,this._missing=$,Y===this._onheader)this._partial=!1;this._onparse=Y};h3.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=aL0,this._overflow)this._write(this._overflow,void 0,$);else $()};h3.prototype._write=function($,Y,U){if(this._destroyed)return;var I=this._stream,Q=this._buffer,J=this._missing;if($.length)this._partial=!0;if($.length<J) Line truncated
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship($){if(!this.count)this._writeOpen();let Y=`rId${++this.count}`;if($.TargetMode)this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${GL1.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${$.Target}"/>`);return Y}_writeClose(){this.stream.write("</Relationships>")}}TF0.exports=PF0});var vF0=j((T04,_F0)=>{var jF0=e6(),CF0=W2(),WL1=d4(),XL1=Af(),ZL1=Tf();class RF0{constructor($,Y,U){this.id=U.id,this.count=0,this._worksheet=$,this._workbook=U.workbook,this._sheetRelsWriter=Y}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:CF0.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let Y={Type:CF0.VmlDrawing,Target:`../drawings/vmlDrawing${this.id}.vml`};this.vmlRelId=this._sheetRelsWriter.addRelationship(Y)}_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($,Y){let U=new XL1,I=new jF0;U.render(I,$),this.commentsStream.write(I.xml);let Q=new ZL1,J=new jF0;Q.render(J,$,Y),this.vmlStream.write(J.xml)}_writeClose(){this.commentsStream.write("</commentList></comments>"),this.vmlStream.write("</xml>")}addComments($){if($&&$.length){if(!this.startedData)this._worksheet.comments=[],this._writeOpen(),this._addRelationships(),this._addCommentRefs(),this.startedData=!0;$.forEach((Y)=>{Y.refAddress=WL1.decodeAddress(Y.ref)}),$.forEach((Y)=>{this._writeComment(Y,this.count),this.count+=1})}}commit(){if(this.count)this._writeClose(),this.commentsStream.end(),this.vmlStream.end()}}_F0.exports=RF0});var xF0=j((E04,kF0)=>{var qL1=Q6(),VL1=W2(),qc=d4(),SF0=cg(),hF0=W3(),LL1=Ux(),gF0=aM(),Vc=eM(),FL1=EF0(),wL1=vF0(),ML1=bg(),c6=new LL1,Lc=z2(),OL1=ax(),NL1=tx(),DL1=ex(),BL1=lx(),AL1=px(),PL1=ox(),TL1=$f(),EL1=Yf(),jL1=Uf(),CL1=If(),RL1=Qf(),_L1=Jf(),vL1=Wf(),SL1=zf(),hL1=Kf(),n6={dataValidations:new OL1,sheetProperties:new NL1,sheetFormatProperties:new DL1,columns:new Lc({tag:"cols",length:!1,childXform:new BL1}),row:new AL1,hyperlinks:new Lc({tag:"hyperlinks",length:!1,childXform:new PL1}),sheetViews:new Lc({tag:"sheetViews",length:!1,childXform:new TL1}),sheetProtection:new EL1,pageMargins:new jL1,pageSeteup:new CL1,autoFilter:new RL1,picture:new _L1,conditionalFormattings:new vL1,headerFooter:new SL1,rowBreaks:new hL1};class yF0{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 FL1($),this._sheetCommentsWriter=new wL1(this,this._sheetRelsWriter,$),this._dimensions=new hF0,this._rowZero=1,this.committed=!1,this.dataValidations=new ML1,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
`)},Rc=_c.getNativePromise();if(_c.isNode&&typeof MutationObserver>"u")vc=global.setImmediate,Sc=process.nextTick,$I=_c.isRecentNode?function($){vc.call(global,$)}:function($){Sc.call(process,$)};else if(typeof Rc==="function"&&typeof Rc.resolve==="function")hc=Rc.resolve(),$I=function($){hc.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))$I=function(){var $=document.createElement("div"),Y={attributes:!0},U=!1,I=document.createElement("div"),Q=new MutationObserver(function(){$.classList.toggle("foo"),U=!1});Q.observe(I,Y);var J=function(){if(U)return;U=!0,I.classList.toggle("foo")};return function(z){var G=new MutationObserver(function(){G.disconnect(),z()});G.observe($,Y),J()}}();else if(typeof setImmediate<"u")$I=function($){setImmediate($)};else if(typeof setTimeout<"u")$I=function($){setTimeout($,0)};else $I=NF1;var vc,Sc,hc;Ww0.exports=$I});var qw0=j((S04,Zw0)=>{function DF1($,Y,U,I,Q){for(var J=0;J<Q;++J)U[J+I]=$[J+Y],$[J+Y]=void 0}function g2($){this._capacity=$,this._length=0,this._front=0}g2.prototype._willBeOverCapacity=function($){return this._capacity<$};g2.prototype._pushOne=function($){var Y=this.length();this._checkCapacity(Y+1);var U=this._front+Y&this._capacity-1;this[U]=$,this._length=Y+1};g2.prototype.push=function($,Y,U){var I=this.length()+3;if(this._willBeOverCapacity(I)){this._pushOne($),this._pushOne(Y),this._pushOne(U);return}var Q=this._front+I-3;this._checkCapacity(I);var J=this._capacity-1;this[Q+0&J]=$,this[Q+1&J]=Y,this[Q+2&J]=U,this._length=I};g2.prototype.shift=function(){var $=this._front,Y=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,Y};g2.prototype.length=function(){return this._length};g2.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};g2.prototype._resizeTo=function($){var Y=this._capacity;this._capacity=$;var U=this._front,I=this._length,Q=U+I&Y-1;DF1(this,0,this,Y,Q)};Zw0.exports=g2});var Nw0=j((h04,gc)=>{var Mw0;try{throw Error()}catch($){Mw0=$}var BF1=Xw0(),Vw0=qw0(),Ow0=M4();function c6(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new Vw0(16),this._normalQueue=new Vw0(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var $=this;this.drainQueues=function(){$._drainQueues()},this._schedule=BF1}c6.prototype.setScheduler=function($){var Y=this._schedule;return this._schedule=$,this._customScheduler=!0,Y};c6.prototype.hasCustomScheduler=function(){return this._customScheduler};c6.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};c6.prototype.disableTrampolineIfNecessary=function(){if(Ow0.hasDevTools)this._trampolineEnabled=!1};c6.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};c6.prototype.fatalError=function($,Y){if(Y)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
`),process.exit(2);else this.throwLater($)};c6.prototype.throwLater=function($,Y){if(arguments.length===1)Y=$,$=function(){throw Y};if(typeof setTimeout<"u")setTimeout(function(){$(Y)},0);else try{this._schedule(function(){$(Y)})}catch(U){throw Error(`No async scheduler available
`)},hc=gc.getNativePromise();if(gc.isNode&&typeof MutationObserver>"u")yc=global.setImmediate,kc=process.nextTick,JI=gc.isRecentNode?function($){yc.call(global,$)}:function($){kc.call(process,$)};else if(typeof hc==="function"&&typeof hc.resolve==="function")xc=hc.resolve(),JI=function($){xc.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))JI=function(){var $=document.createElement("div"),Y={attributes:!0},U=!1,I=document.createElement("div"),Q=new MutationObserver(function(){$.classList.toggle("foo"),U=!1});Q.observe(I,Y);var J=function(){if(U)return;U=!0,I.classList.toggle("foo")};return function(z){var G=new MutationObserver(function(){G.disconnect(),z()});G.observe($,Y),J()}}();else if(typeof setImmediate<"u")JI=function($){setImmediate($)};else if(typeof setTimeout<"u")JI=function($){setTimeout($,0)};else JI=PF1;var yc,kc,xc;Fw0.exports=JI});var Ow0=j((f04,Mw0)=>{function TF1($,Y,U,I,Q){for(var J=0;J<Q;++J)U[J+I]=$[J+Y],$[J+Y]=void 0}function k2($){this._capacity=$,this._length=0,this._front=0}k2.prototype._willBeOverCapacity=function($){return this._capacity<$};k2.prototype._pushOne=function($){var Y=this.length();this._checkCapacity(Y+1);var U=this._front+Y&this._capacity-1;this[U]=$,this._length=Y+1};k2.prototype.push=function($,Y,U){var I=this.length()+3;if(this._willBeOverCapacity(I)){this._pushOne($),this._pushOne(Y),this._pushOne(U);return}var Q=this._front+I-3;this._checkCapacity(I);var J=this._capacity-1;this[Q+0&J]=$,this[Q+1&J]=Y,this[Q+2&J]=U,this._length=I};k2.prototype.shift=function(){var $=this._front,Y=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,Y};k2.prototype.length=function(){return this._length};k2.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};k2.prototype._resizeTo=function($){var Y=this._capacity;this._capacity=$;var U=this._front,I=this._length,Q=U+I&Y-1;TF1(this,0,this,Y,Q)};Mw0.exports=k2});var Ew0=j((u04,fc)=>{var Pw0;try{throw Error()}catch($){Pw0=$}var EF1=ww0(),Nw0=Ow0(),Tw0=O4();function d6(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new Nw0(16),this._normalQueue=new Nw0(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var $=this;this.drainQueues=function(){$._drainQueues()},this._schedule=EF1}d6.prototype.setScheduler=function($){var Y=this._schedule;return this._schedule=$,this._customScheduler=!0,Y};d6.prototype.hasCustomScheduler=function(){return this._customScheduler};d6.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};d6.prototype.disableTrampolineIfNecessary=function(){if(Tw0.hasDevTools)this._trampolineEnabled=!1};d6.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};d6.prototype.fatalError=function($,Y){if(Y)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
`),process.exit(2);else this.throwLater($)};d6.prototype.throwLater=function($,Y){if(arguments.length===1)Y=$,$=function(){throw Y};if(typeof setTimeout<"u")setTimeout(function(){$(Y)},0);else try{this._schedule(function(){$(Y)})}catch(U){throw Error(`No async scheduler available
See http://goo.gl/MqrFmX
`)}};function Lw0($,Y,U){this._lateQueue.push($,Y,U),this._queueTick()}function Fw0($,Y,U){this._normalQueue.push($,Y,U),this._queueTick()}function ww0($){this._normalQueue._pushOne($),this._queueTick()}if(!Ow0.hasDevTools)c6.prototype.invokeLater=Lw0,c6.prototype.invoke=Fw0,c6.prototype.settlePromises=ww0;else c6.prototype.invokeLater=function($,Y,U){if(this._trampolineEnabled)Lw0.call(this,$,Y,U);else this._schedule(function(){setTimeout(function(){$.call(Y,U)},100)})},c6.prototype.invoke=function($,Y,U){if(this._trampolineEnabled)Fw0.call(this,$,Y,U);else this._schedule(function(){$.call(Y,U)})},c6.prototype.settlePromises=function($){if(this._trampolineEnabled)ww0.call(this,$);else this._schedule(function(){$._settlePromises()})};c6.prototype._drainQueue=function($){while($.length()>0){var Y=$.shift();if(typeof Y!=="function"){Y._settlePromises();continue}var U=$.shift(),I=$.shift();Y.call(U,I)}};c6.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};c6.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};c6.prototype._reset=function(){this._isTickUsed=!1};gc.exports=c6;gc.exports.firstLineError=Mw0});var g3=j((g04,Aw0)=>{var xc=eU(),AF1=xc.freeze,Dw0=M4(),Bw0=Dw0.inherits,fK=Dw0.notEnumerableProp;function uK($,Y){function U(I){if(!(this instanceof U))return new U(I);if(fK(this,"message",typeof I==="string"?I:Y),fK(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return Bw0(U,Error),U}var yc,kc,PF1=uK("Warning","warning"),TF1=uK("CancellationError","cancellation error"),EF1=uK("TimeoutError","timeout error"),aX=uK("AggregateError","aggregate error");try{yc=TypeError,kc=RangeError}catch($){yc=uK("TypeError","type error"),kc=uK("RangeError","range error")}var tB="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(YI=0;YI<tB.length;++YI)if(typeof Array.prototype[tB[YI]]==="function")aX.prototype[tB[YI]]=Array.prototype[tB[YI]];var YI;xc.defineProperty(aX.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});aX.prototype.isOperational=!0;var eB=0;aX.prototype.toString=function(){var $=Array(eB*4+1).join(" "),Y=`
`)}};function Dw0($,Y,U){this._lateQueue.push($,Y,U),this._queueTick()}function Bw0($,Y,U){this._normalQueue.push($,Y,U),this._queueTick()}function Aw0($){this._normalQueue._pushOne($),this._queueTick()}if(!Tw0.hasDevTools)d6.prototype.invokeLater=Dw0,d6.prototype.invoke=Bw0,d6.prototype.settlePromises=Aw0;else d6.prototype.invokeLater=function($,Y,U){if(this._trampolineEnabled)Dw0.call(this,$,Y,U);else this._schedule(function(){setTimeout(function(){$.call(Y,U)},100)})},d6.prototype.invoke=function($,Y,U){if(this._trampolineEnabled)Bw0.call(this,$,Y,U);else this._schedule(function(){$.call(Y,U)})},d6.prototype.settlePromises=function($){if(this._trampolineEnabled)Aw0.call(this,$);else this._schedule(function(){$._settlePromises()})};d6.prototype._drainQueue=function($){while($.length()>0){var Y=$.shift();if(typeof Y!=="function"){Y._settlePromises();continue}var U=$.shift(),I=$.shift();Y.call(U,I)}};d6.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};d6.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};d6.prototype._reset=function(){this._isTickUsed=!1};fc.exports=d6;fc.exports.firstLineError=Pw0});var y3=j((b04,Rw0)=>{var ic=QI(),jF1=ic.freeze,jw0=O4(),Cw0=jw0.inherits,cK=jw0.notEnumerableProp;function nK($,Y){function U(I){if(!(this instanceof U))return new U(I);if(cK(this,"message",typeof I==="string"?I:Y),cK(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return Cw0(U,Error),U}var uc,bc,CF1=nK("Warning","warning"),RF1=nK("CancellationError","cancellation error"),_F1=nK("TimeoutError","timeout error"),YZ=nK("AggregateError","aggregate error");try{uc=TypeError,bc=RangeError}catch($){uc=nK("TypeError","type error"),bc=nK("RangeError","range error")}var YA="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(KI=0;KI<YA.length;++KI)if(typeof Array.prototype[YA[KI]]==="function")YZ.prototype[YA[KI]]=Array.prototype[YA[KI]];var KI;ic.defineProperty(YZ.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});YZ.prototype.isOperational=!0;var UA=0;YZ.prototype.toString=function(){var $=Array(UA*4+1).join(" "),Y=`
`+$+`AggregateError of:
`;eB++,$=Array(eB*4+1).join(" ");for(var U=0;U<this.length;++U){var I=this[U]===this?"[Circular AggregateError]":this[U]+"",Q=I.split(`
`;UA++,$=Array(UA*4+1).join(" ");for(var U=0;U<this.length;++U){var I=this[U]===this?"[Circular AggregateError]":this[U]+"",Q=I.split(`
`);for(var J=0;J<Q.length;++J)Q[J]=$+Q[J];I=Q.join(`
`),Y+=I+`
`}return eB--,Y};function sX($){if(!(this instanceof sX))return new sX($);if(fK(this,"name","OperationalError"),fK(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)fK(this,"message",$.message),fK(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}Bw0(sX,Error);var UI=Error.__BluebirdErrorTypes__;if(!UI)UI=AF1({CancellationError:TF1,TimeoutError:EF1,OperationalError:sX,RejectionError:sX,AggregateError:aX}),xc.defineProperty(Error,"__BluebirdErrorTypes__",{value:UI,writable:!1,enumerable:!1,configurable:!1});Aw0.exports={Error,TypeError:yc,RangeError:kc,CancellationError:UI.CancellationError,OperationalError:UI.OperationalError,TimeoutError:UI.TimeoutError,AggregateError:UI.AggregateError,Warning:PF1}});var Tw0=j((y04,Pw0)=>{Pw0.exports=function($,Y){var U=M4(),I=U.errorObj,Q=U.isObject;function J(X,Z){if(Q(X)){if(X instanceof $)return X;var q=z(X);if(q===I){if(Z)Z._pushContext();var V=$.reject(q.e);if(Z)Z._popContext();return V}else if(typeof q==="function"){if(H(X)){var V=new $(Y);return X._then(V._fulfill,V._reject,void 0,V,null),V}return W(X,q,Z)}}return X}function K(X){return X.then}function z(X){try{return K(X)}catch(Z){return I.e=Z,I}}var G={}.hasOwnProperty;function H(X){try{return G.call(X,"_promise0")}catch(Z){return!1}}function W(X,Z,q){var V=new $(Y),w=V;if(q)q._pushContext();if(V._captureStackTrace(),q)q._popContext();var M=!0,F=U.tryCatch(Z).call(X,N,O);if(M=!1,V&&F===I)V._rejectCallback(F.e,!0,!0),V=null;function N(D){if(!V)return;V._resolveCallback(D),V=null}function O(D){if(!V)return;V._rejectCallback(D,M,!0),V=null}return w}return J}});var jw0=j((k04,Ew0)=>{Ew0.exports=function($,Y,U,I,Q){var J=M4(),K=J.isArray;function z(H){switch(H){case-2:return[];case-3:return{}}}function G(H){var W=this._promise=new $(Y);if(H instanceof $)W._propagateFrom(H,3);W._setOnCancel(this),this._values=H,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return J.inherits(G,Q),G.prototype.length=function(){return this._length},G.prototype.promise=function(){return this._promise},G.prototype._init=function H(W,X){var Z=U(this._values,this._promise);if(Z instanceof $){Z=Z._target();var q=Z._bitField;if(this._values=Z,(q&50397184)===0)return this._promise._setAsyncGuaranteed(),Z._then(H,this._reject,void 0,this,X);else if((q&33554432)!==0)Z=Z._value();else if((q&16777216)!==0)return this._reject(Z._reason());else return this._cancel()}if(Z=J.asArray(Z),Z===null){var V=I("expecting an array or an iterable object but got "+J.classString(Z)).reason();this._promise._rejectCallback(V,!1);return}if(Z.length===0){if(X===-5)this._resolveEmptyArray();else this._resolve(z(X));return}this._iterate(Z)},G.prototype._iterate=function(H){var W=this.getActualLength(H.length);this._length=W,this._values=this.shouldCopyValues()?Array(W):this._values;var X=this._promise,Z=!1,q=null;for(var V=0;V<W;++V){var w=U(H[V],X);if(w instanceof $)w=w._target(),q=w._bitField;else q=null;if(Z){if(q!==null)w.suppressUnhandledRejections()}else if(q!==null)if((q&50397184)===0)w._proxy(this,V),this._values[V]=w;else if((q&33554432)!==0)Z=this._promiseFulfilled(w._value(),V);else if((q&16777216)!==0)Z=this._promiseRejected(w._reason(),V);else Z=this._promiseCancelled(V);else Z=this._promiseFulfilled(w,V)}if(!Z)X._setAsyncGuaranteed()},G.prototype._isResolved=function(){return this._values===null},G.prototype._resolve=function(H){this._values=null,this._promise._fulfill(H)},G.prototype._cancel=function(){if(this._isResolved()||!this._promise._isCancellable())return;this._values=null,this._promise._cancel()},G.prototype._reject=function(H){this._values=null,this._promise._rejectCallback(H,!1)},G.prototype._promiseFulfilled=function(H,W){this._values[W]=H;var X=++this._totalResolved;if(X>=this._length)return this._resolve(this._values),!0;return!1},G.prototype._promiseCancelled=function(){return this._cancel(),!0},G.prototype._promiseRejected=function(H){return this._totalResolved++,this._reject(H),!0},G.prototype._resultCancelled=function(){if(this._isResolved())return;var H=this._values;if(this._cancel(),H instanceof $)H.cancel();else for(var W=0;W<H.length;++W)if(H[W]instanceof $)H[W].cancel()},G.prototype.shouldCopyValues=function(){return!0},G.prototype.getActualLength=function(H){return H},G}});var Rw0=j((x04,Cw0)=>{Cw0.exports=function($){var Y=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function I(){this._trace=new I.CapturedTrace(J())}I.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},I.prototype._popContext=function(){if(this._trace!==void 0){var K=U.pop(),z=K._promiseCreated;return K._promiseCreated=null,z}return null};function Q(){if(Y)return new I}function J(){var K=U.length-1;if(K>=0)return U[K];return}return I.CapturedTrace=null,I.create=Q,I.deactivateLong Line truncated
`}return UA--,Y};function $Z($){if(!(this instanceof $Z))return new $Z($);if(cK(this,"name","OperationalError"),cK(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)cK(this,"message",$.message),cK(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}Cw0($Z,Error);var zI=Error.__BluebirdErrorTypes__;if(!zI)zI=jF1({CancellationError:RF1,TimeoutError:_F1,OperationalError:$Z,RejectionError:$Z,AggregateError:YZ}),ic.defineProperty(Error,"__BluebirdErrorTypes__",{value:zI,writable:!1,enumerable:!1,configurable:!1});Rw0.exports={Error,TypeError:uc,RangeError:bc,CancellationError:zI.CancellationError,OperationalError:zI.OperationalError,TimeoutError:zI.TimeoutError,AggregateError:zI.AggregateError,Warning:CF1}});var vw0=j((i04,_w0)=>{_w0.exports=function($,Y){var U=O4(),I=U.errorObj,Q=U.isObject;function J(X,Z){if(Q(X)){if(X instanceof $)return X;var q=z(X);if(q===I){if(Z)Z._pushContext();var V=$.reject(q.e);if(Z)Z._popContext();return V}else if(typeof q==="function"){if(H(X)){var V=new $(Y);return X._then(V._fulfill,V._reject,void 0,V,null),V}return W(X,q,Z)}}return X}function K(X){return X.then}function z(X){try{return K(X)}catch(Z){return I.e=Z,I}}var G={}.hasOwnProperty;function H(X){try{return G.call(X,"_promise0")}catch(Z){return!1}}function W(X,Z,q){var V=new $(Y),w=V;if(q)q._pushContext();if(V._captureStackTrace(),q)q._popContext();var M=!0,F=U.tryCatch(Z).call(X,N,O);if(M=!1,V&&F===I)V._rejectCallback(F.e,!0,!0),V=null;function N(D){if(!V)return;V._resolveCallback(D),V=null}function O(D){if(!V)return;V._rejectCallback(D,M,!0),V=null}return w}return J}});var hw0=j((c04,Sw0)=>{Sw0.exports=function($,Y,U,I,Q){var J=O4(),K=J.isArray;function z(H){switch(H){case-2:return[];case-3:return{}}}function G(H){var W=this._promise=new $(Y);if(H instanceof $)W._propagateFrom(H,3);W._setOnCancel(this),this._values=H,this._length=0,this._totalResolved=0,this._init(void 0,-2)}return J.inherits(G,Q),G.prototype.length=function(){return this._length},G.prototype.promise=function(){return this._promise},G.prototype._init=function H(W,X){var Z=U(this._values,this._promise);if(Z instanceof $){Z=Z._target();var q=Z._bitField;if(this._values=Z,(q&50397184)===0)return this._promise._setAsyncGuaranteed(),Z._then(H,this._reject,void 0,this,X);else if((q&33554432)!==0)Z=Z._value();else if((q&16777216)!==0)return this._reject(Z._reason());else return this._cancel()}if(Z=J.asArray(Z),Z===null){var V=I("expecting an array or an iterable object but got "+J.classString(Z)).reason();this._promise._rejectCallback(V,!1);return}if(Z.length===0){if(X===-5)this._resolveEmptyArray();else this._resolve(z(X));return}this._iterate(Z)},G.prototype._iterate=function(H){var W=this.getActualLength(H.length);this._length=W,this._values=this.shouldCopyValues()?Array(W):this._values;var X=this._promise,Z=!1,q=null;for(var V=0;V<W;++V){var w=U(H[V],X);if(w instanceof $)w=w._target(),q=w._bitField;else q=null;if(Z){if(q!==null)w.suppressUnhandledRejections()}else if(q!==null)if((q&50397184)===0)w._proxy(this,V),this._values[V]=w;else if((q&33554432)!==0)Z=this._promiseFulfilled(w._value(),V);else if((q&16777216)!==0)Z=this._promiseRejected(w._reason(),V);else Z=this._promiseCancelled(V);else Z=this._promiseFulfilled(w,V)}if(!Z)X._setAsyncGuaranteed()},G.prototype._isResolved=function(){return this._values===null},G.prototype._resolve=function(H){this._values=null,this._promise._fulfill(H)},G.prototype._cancel=function(){if(this._isResolved()||!this._promise._isCancellable())return;this._values=null,this._promise._cancel()},G.prototype._reject=function(H){this._values=null,this._promise._rejectCallback(H,!1)},G.prototype._promiseFulfilled=function(H,W){this._values[W]=H;var X=++this._totalResolved;if(X>=this._length)return this._resolve(this._values),!0;return!1},G.prototype._promiseCancelled=function(){return this._cancel(),!0},G.prototype._promiseRejected=function(H){return this._totalResolved++,this._reject(H),!0},G.prototype._resultCancelled=function(){if(this._isResolved())return;var H=this._values;if(this._cancel(),H instanceof $)H.cancel();else for(var W=0;W<H.length;++W)if(H[W]instanceof $)H[W].cancel()},G.prototype.shouldCopyValues=function(){return!0},G.prototype.getActualLength=function(H){return H},G}});var yw0=j((n04,gw0)=>{gw0.exports=function($){var Y=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function I(){this._trace=new I.CapturedTrace(J())}I.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},I.prototype._popContext=function(){if(this._trace!==void 0){var K=U.pop(),z=K._promiseCreated;return K._promiseCreated=null,z}return null};function Q(){if(Y)return new I}function J(){var K=U.length-1;if(K>=0)return U[K];return}return I.CapturedTrace=null,I.create=Q,I.deactivateLong Line truncated
See http://goo.gl/MqrFmX
`);if(!D0.longStackTraces&&u0()){var Q0=$.prototype._captureStackTrace,A=$.prototype._attachExtraTrace;D0.longStackTraces=!0,D=function(){if(I.haveItemsQueued()&&!D0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
`);if(!B0.longStackTraces&&u0()){var Q0=$.prototype._captureStackTrace,A=$.prototype._attachExtraTrace;B0.longStackTraces=!0,D=function(){if(I.haveItemsQueued()&&!B0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
See http://goo.gl/MqrFmX
`);$.prototype._captureStackTrace=Q0,$.prototype._attachExtraTrace=A,Y.deactivateLongStackTraces(),I.enableTrampoline(),D0.longStackTraces=!1},$.prototype._captureStackTrace=y,$.prototype._attachExtraTrace=d,Y.activateLongStackTraces(),I.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return D0.longStackTraces&&u0()};var P=function(){try{if(typeof CustomEvent==="function"){var Q0=new CustomEvent("CustomEvent");return J.global.dispatchEvent(Q0),function(A,S){var u=new CustomEvent(A.toLowerCase(),{detail:S,cancelable:!0});return!J.global.dispatchEvent(u)}}else if(typeof Event==="function"){var Q0=new Event("CustomEvent");return J.global.dispatchEvent(Q0),function(S,u){var s=new Event(S.toLowerCase(),{cancelable:!0});return s.detail=u,!J.global.dispatchEvent(s)}}else{var Q0=document.createEvent("CustomEvent");return Q0.initCustomEvent("testingtheevent",!1,!0,{}),J.global.dispatchEvent(Q0),function(S,u){var s=document.createEvent("CustomEvent");return s.initCustomEvent(S.toLowerCase(),!1,!0,u),!J.global.dispatchEvent(s)}}}catch(A){}return function(){return!1}}(),T=function(){if(J.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!J.global)return function(){return!1};return function(Q0){var A="on"+Q0.toLowerCase(),S=J.global[A];if(!S)return!1;return S.apply(J.global,[].slice.call(arguments,1)),!0}}}();function B(Q0,A){return{promise:A}}var E={promiseCreated:B,promiseFulfilled:B,promiseRejected:B,promiseResolved:B,promiseCancelled:B,promiseChained:function(Q0,A,S){return{promise:A,child:S}},warning:function(Q0,A){return{warning:A}},unhandledRejection:function(Q0,A,S){return{reason:A,promise:S}},rejectionHandled:B},C=function(Q0){var A=!1;try{A=T.apply(null,arguments)}catch(u){I.throwLater(u),A=!0}var S=!1;try{S=P(Q0,E[Q0].apply(null,arguments))}catch(u){I.throwLater(u),S=!0}return S||A};$.config=function(Q0){if(Q0=Object(Q0),"longStackTraces"in Q0){if(Q0.longStackTraces)$.longStackTraces();else if(!Q0.longStackTraces&&$.hasLongStackTraces())D()}if("warnings"in Q0){var A=Q0.warnings;if(D0.warnings=!!A,O=D0.warnings,J.isObject(A)){if("wForgottenReturn"in A)O=!!A.wForgottenReturn}}if("cancellation"in Q0&&Q0.cancellation&&!D0.cancellation){if(I.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=I0,$.prototype._propagateFrom=k,$.prototype._onCancel=b,$.prototype._setOnCancel=c,$.prototype._attachCancellationCallback=g,$.prototype._execute=x,a=k,D0.cancellation=!0}if("monitoring"in Q0){if(Q0.monitoring&&!D0.monitoring)D0.monitoring=!0,$.prototype._fireEvent=C;else if(!Q0.monitoring&&D0.monitoring)D0.monitoring=!1,$.prototype._fireEvent=i}return $};function i(){return!1}$.prototype._fireEvent=i,$.prototype._execute=function(Q0,A,S){try{Q0(A,S)}catch(u){return u}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(Q0){},$.prototype._attachCancellationCallback=function(Q0){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(Q0,A){};function x(Q0,A,S){var u=this;try{Q0(A,S,function(s){if(typeof s!=="function")throw TypeError("onCancel must be a function, got: "+J.toString(s));u._attachCancellationCallback(s)})}catch(s){return s}}function g(Q0){if(!this._isCancellable())return this;var A=this._onCancel();if(A!==void 0)if(J.isArray(A))A.push(Q0);else this._setOnCancel([A,Q0]);else this._setOnCancel(Q0)}function b(){return this._onCancelField}function c(Q0){this._onCancelField=Q0}function I0(){this._cancellationParent=void 0,this._onCancelField=void 0}function k(Q0,A){if((A&1)!==0){this._cancellationParent=Q0;var S=Q0._branchesRemainingToCancel;if(S===void 0)S=0;Q0._branchesRemainingToCancel=S+1}if((A&2)!==0&&Q0._isBound())this._setBoundTo(Q0._boundTo)}function p(Q0,A){if((A&2)!==0&&Q0._isBound())this._setBoundTo(Q0._boundTo)}var a=p;function $0(){var Q0=this._boundTo;if(Q0!==void 0){if(Q0 instanceof $)if(Q0.isFulfilled())return Q0.value();else return}return Q0}function y(){this._trace=new u1(this._peekContext())}function d(Q0,A){if(K(Q0)){var S=this._trace;if(S!==void 0){if(A)S=S._parent}if(S!==void 0)S.attachExtraTrace(Q0);else if(!Q0.__stackCleaned__){var u=o0(Q0);J.notEnumerableProp(Q0,"stack",u.message+`
`);$.prototype._captureStackTrace=Q0,$.prototype._attachExtraTrace=A,Y.deactivateLongStackTraces(),I.enableTrampoline(),B0.longStackTraces=!1},$.prototype._captureStackTrace=y,$.prototype._attachExtraTrace=d,Y.activateLongStackTraces(),I.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return B0.longStackTraces&&u0()};var P=function(){try{if(typeof CustomEvent==="function"){var Q0=new CustomEvent("CustomEvent");return J.global.dispatchEvent(Q0),function(A,S){var u=new CustomEvent(A.toLowerCase(),{detail:S,cancelable:!0});return!J.global.dispatchEvent(u)}}else if(typeof Event==="function"){var Q0=new Event("CustomEvent");return J.global.dispatchEvent(Q0),function(S,u){var s=new Event(S.toLowerCase(),{cancelable:!0});return s.detail=u,!J.global.dispatchEvent(s)}}else{var Q0=document.createEvent("CustomEvent");return Q0.initCustomEvent("testingtheevent",!1,!0,{}),J.global.dispatchEvent(Q0),function(S,u){var s=document.createEvent("CustomEvent");return s.initCustomEvent(S.toLowerCase(),!1,!0,u),!J.global.dispatchEvent(s)}}}catch(A){}return function(){return!1}}(),T=function(){if(J.isNode)return function(){return process.emit.apply(process,arguments)};else{if(!J.global)return function(){return!1};return function(Q0){var A="on"+Q0.toLowerCase(),S=J.global[A];if(!S)return!1;return S.apply(J.global,[].slice.call(arguments,1)),!0}}}();function B(Q0,A){return{promise:A}}var E={promiseCreated:B,promiseFulfilled:B,promiseRejected:B,promiseResolved:B,promiseCancelled:B,promiseChained:function(Q0,A,S){return{promise:A,child:S}},warning:function(Q0,A){return{warning:A}},unhandledRejection:function(Q0,A,S){return{reason:A,promise:S}},rejectionHandled:B},C=function(Q0){var A=!1;try{A=T.apply(null,arguments)}catch(u){I.throwLater(u),A=!0}var S=!1;try{S=P(Q0,E[Q0].apply(null,arguments))}catch(u){I.throwLater(u),S=!0}return S||A};$.config=function(Q0){if(Q0=Object(Q0),"longStackTraces"in Q0){if(Q0.longStackTraces)$.longStackTraces();else if(!Q0.longStackTraces&&$.hasLongStackTraces())D()}if("warnings"in Q0){var A=Q0.warnings;if(B0.warnings=!!A,O=B0.warnings,J.isObject(A)){if("wForgottenReturn"in A)O=!!A.wForgottenReturn}}if("cancellation"in Q0&&Q0.cancellation&&!B0.cancellation){if(I.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=I0,$.prototype._propagateFrom=k,$.prototype._onCancel=b,$.prototype._setOnCancel=c,$.prototype._attachCancellationCallback=g,$.prototype._execute=x,a=k,B0.cancellation=!0}if("monitoring"in Q0){if(Q0.monitoring&&!B0.monitoring)B0.monitoring=!0,$.prototype._fireEvent=C;else if(!Q0.monitoring&&B0.monitoring)B0.monitoring=!1,$.prototype._fireEvent=i}return $};function i(){return!1}$.prototype._fireEvent=i,$.prototype._execute=function(Q0,A,S){try{Q0(A,S)}catch(u){return u}},$.prototype._onCancel=function(){},$.prototype._setOnCancel=function(Q0){},$.prototype._attachCancellationCallback=function(Q0){},$.prototype._captureStackTrace=function(){},$.prototype._attachExtraTrace=function(){},$.prototype._clearCancellationData=function(){},$.prototype._propagateFrom=function(Q0,A){};function x(Q0,A,S){var u=this;try{Q0(A,S,function(s){if(typeof s!=="function")throw TypeError("onCancel must be a function, got: "+J.toString(s));u._attachCancellationCallback(s)})}catch(s){return s}}function g(Q0){if(!this._isCancellable())return this;var A=this._onCancel();if(A!==void 0)if(J.isArray(A))A.push(Q0);else this._setOnCancel([A,Q0]);else this._setOnCancel(Q0)}function b(){return this._onCancelField}function c(Q0){this._onCancelField=Q0}function I0(){this._cancellationParent=void 0,this._onCancelField=void 0}function k(Q0,A){if((A&1)!==0){this._cancellationParent=Q0;var S=Q0._branchesRemainingToCancel;if(S===void 0)S=0;Q0._branchesRemainingToCancel=S+1}if((A&2)!==0&&Q0._isBound())this._setBoundTo(Q0._boundTo)}function p(Q0,A){if((A&2)!==0&&Q0._isBound())this._setBoundTo(Q0._boundTo)}var a=p;function $0(){var Q0=this._boundTo;if(Q0!==void 0){if(Q0 instanceof $)if(Q0.isFulfilled())return Q0.value();else return}return Q0}function y(){this._trace=new u1(this._peekContext())}function d(Q0,A){if(K(Q0)){var S=this._trace;if(S!==void 0){if(A)S=S._parent}if(S!==void 0)S.attachExtraTrace(Q0);else if(!Q0.__stackCleaned__){var u=r0(Q0);J.notEnumerableProp(Q0,"stack",u.message+`
`+u.stack.join(`
`)),J.notEnumerableProp(Q0,"__stackCleaned__",!0)}}}function Y0(Q0,A,S,u,s){if(Q0===void 0&&A!==null&&O){if(s!==void 0&&s._returnedNonUndefined())return;if((u._bitField&65535)===0)return;if(S)S=S+" ";var W0="",J0="";if(A._trace){var Z0=A._trace.stack.split(`
`),w0=y0(Z0);for(var B0=w0.length-1;B0>=0;--B0){var r0=w0[B0];if(!W.test(r0)){var J1=r0.match(X);if(J1)W0="at "+J1[1]+":"+J1[2]+":"+J1[3]+" ";break}}if(w0.length>0){var U1=w0[0];for(var B0=0;B0<Z0.length;++B0)if(Z0[B0]===U1){if(B0>0)J0=`
`+Z0[B0-1];break}}}var B1="a promise was created in a "+S+"handler "+W0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(B1,!0,A)}}function R(Q0,A){var S=Q0+" is deprecated and will be removed in a future version.";if(A)S+=" Use "+A+" instead.";return o(S)}function o(Q0,A,S){if(!D0.warnings)return;var u=new Q(Q0),s;if(A)S._attachExtraTrace(u);else if(D0.longStackTraces&&(s=$._peekContext()))s.attachExtraTrace(u);else{var W0=o0(u);u.stack=W0.message+`
`),M0=_0(Z0);for(var A0=M0.length-1;A0>=0;--A0){var s0=M0[A0];if(!W.test(s0)){var J1=s0.match(X);if(J1)W0="at "+J1[1]+":"+J1[2]+":"+J1[3]+" ";break}}if(M0.length>0){var U1=M0[0];for(var A0=0;A0<Z0.length;++A0)if(Z0[A0]===U1){if(A0>0)J0=`
`+Z0[A0-1];break}}}var B1="a promise was created in a "+S+"handler "+W0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(B1,!0,A)}}function h(Q0,A){var S=Q0+" is deprecated and will be removed in a future version.";if(A)S+=" Use "+A+" instead.";return o(S)}function o(Q0,A,S){if(!B0.warnings)return;var u=new Q(Q0),s;if(A)S._attachExtraTrace(u);else if(B0.longStackTraces&&(s=$._peekContext()))s.attachExtraTrace(u);else{var W0=r0(u);u.stack=W0.message+`
`+W0.stack.join(`
`)}if(!C("warning",u))q1(u,"",!0)}function e(Q0,A){for(var S=0;S<A.length-1;++S)A[S].push("From previous event:"),A[S]=A[S].join(`
`)}if(!C("warning",u))K1(u,"",!0)}function e(Q0,A){for(var S=0;S<A.length-1;++S)A[S].push("From previous event:"),A[S]=A[S].join(`
`);if(S<A.length)A[S]=A[S].join(`
`);return Q0+`
`+A.join(`
`)}function O0(Q0){for(var A=0;A<Q0.length;++A)if(Q0[A].length===0||A+1<Q0.length&&Q0[A][0]===Q0[A+1][0])Q0.splice(A,1),A--}function E0(Q0){var A=Q0[0];for(var S=1;S<Q0.length;++S){var u=Q0[S],s=A.length-1,W0=A[s],J0=-1;for(var Z0=u.length-1;Z0>=0;--Z0)if(u[Z0]===W0){J0=Z0;break}for(var Z0=J0;Z0>=0;--Z0){var w0=u[Z0];if(A[s]===w0)A.pop(),s--;else break}A=u}}function y0(Q0){var A=[];for(var S=0;S<Q0.length;++S){var u=Q0[S],s=u===" (No stack trace)"||Z.test(u),W0=s&&b0(u);if(s&&!W0){if(V&&u.charAt(0)!==" ")u=" "+u;A.push(u)}}return A}function v0(Q0){var A=Q0.stack.replace(/\s+$/g,"").split(`
`);for(var S=0;S<A.length;++S){var u=A[S];if(u===" (No stack trace)"||Z.test(u))break}if(S>0&&Q0.name!="SyntaxError")A=A.slice(S);return A}function o0(Q0){var A=Q0.stack,S=Q0.toString();return A=typeof A==="string"&&A.length>0?v0(Q0):[" (No stack trace)"],{message:S,stack:Q0.name=="SyntaxError"?A:y0(A)}}function q1(Q0,A,S){if(typeof console<"u"){var u;if(J.isObject(Q0)){var s=Q0.stack;u=A+q(s,Q0)}else u=A+String(Q0);if(typeof w==="function")w(u,S);else if(typeof console.log==="function"||typeof console.log==="object")console.log(u)}}function t(Q0,A,S,u){var s=!1;try{if(typeof A==="function")if(s=!0,Q0==="rejectionHandled")A(u);else A(S,u)}catch(W0){I.throwLater(W0)}if(Q0==="unhandledRejection"){if(!C(Q0,S,u)&&!s)q1(S,"Unhandled rejection ")}else C(Q0,u)}function X0(Q0){var A;if(typeof Q0==="function")A="[function "+(Q0.name||"anonymous")+"]";else{A=Q0&&typeof Q0.toString==="function"?Q0.toString():J.toString(Q0);var S=/\[object [a-zA-Z0-9$_]+\]/;if(S.test(A))try{var u=JSON.stringify(Q0);A=u}catch(s){}if(A.length===0)A="(empty array)"}return"(<"+F0(A)+">, no stack trace)"}function F0(Q0){var A=41;if(Q0.length<A)return Q0;return Q0.substr(0,A-3)+"..."}function u0(){return typeof b1==="function"}var b0=function(){return!1},c0=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function P1(Q0){var A=Q0.match(c0);if(A)return{fileName:A[1],line:parseInt(A[2],10)}}function k1(Q0,A){if(!u0())return;var S=Q0.stack.split(`
`)}function w0(Q0){for(var A=0;A<Q0.length;++A)if(Q0[A].length===0||A+1<Q0.length&&Q0[A][0]===Q0[A+1][0])Q0.splice(A,1),A--}function N0(Q0){var A=Q0[0];for(var S=1;S<Q0.length;++S){var u=Q0[S],s=A.length-1,W0=A[s],J0=-1;for(var Z0=u.length-1;Z0>=0;--Z0)if(u[Z0]===W0){J0=Z0;break}for(var Z0=J0;Z0>=0;--Z0){var M0=u[Z0];if(A[s]===M0)A.pop(),s--;else break}A=u}}function _0(Q0){var A=[];for(var S=0;S<Q0.length;++S){var u=Q0[S],s=u===" (No stack trace)"||Z.test(u),W0=s&&b0(u);if(s&&!W0){if(V&&u.charAt(0)!==" ")u=" "+u;A.push(u)}}return A}function v0(Q0){var A=Q0.stack.replace(/\s+$/g,"").split(`
`);for(var S=0;S<A.length;++S){var u=A[S];if(u===" (No stack trace)"||Z.test(u))break}if(S>0&&Q0.name!="SyntaxError")A=A.slice(S);return A}function r0(Q0){var A=Q0.stack,S=Q0.toString();return A=typeof A==="string"&&A.length>0?v0(Q0):[" (No stack trace)"],{message:S,stack:Q0.name=="SyntaxError"?A:_0(A)}}function K1(Q0,A,S){if(typeof console<"u"){var u;if(J.isObject(Q0)){var s=Q0.stack;u=A+q(s,Q0)}else u=A+String(Q0);if(typeof w==="function")w(u,S);else if(typeof console.log==="function"||typeof console.log==="object")console.log(u)}}function t(Q0,A,S,u){var s=!1;try{if(typeof A==="function")if(s=!0,Q0==="rejectionHandled")A(u);else A(S,u)}catch(W0){I.throwLater(W0)}if(Q0==="unhandledRejection"){if(!C(Q0,S,u)&&!s)K1(S,"Unhandled rejection ")}else C(Q0,u)}function X0(Q0){var A;if(typeof Q0==="function")A="[function "+(Q0.name||"anonymous")+"]";else{A=Q0&&typeof Q0.toString==="function"?Q0.toString():J.toString(Q0);var S=/\[object [a-zA-Z0-9$_]+\]/;if(S.test(A))try{var u=JSON.stringify(Q0);A=u}catch(s){}if(A.length===0)A="(empty array)"}return"(<"+F0(A)+">, no stack trace)"}function F0(Q0){var A=41;if(Q0.length<A)return Q0;return Q0.substr(0,A-3)+"..."}function u0(){return typeof b1==="function"}var b0=function(){return!1},c0=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function P1(Q0){var A=Q0.match(c0);if(A)return{fileName:A[1],line:parseInt(A[2],10)}}function k1(Q0,A){if(!u0())return;var S=Q0.stack.split(`
`),u=A.stack.split(`
`),s=-1,W0=-1,J0,Z0;for(var w0=0;w0<S.length;++w0){var B0=P1(S[w0]);if(B0){J0=B0.fileName,s=B0.line;break}}for(var w0=0;w0<u.length;++w0){var B0=P1(u[w0]);if(B0){Z0=B0.fileName,W0=B0.line;break}}if(s<0||W0<0||!J0||!Z0||J0!==Z0||s>=W0)return;b0=function(r0){if(H.test(r0))return!0;var J1=P1(r0);if(J1){if(J1.fileName===J0&&(s<=J1.line&&J1.line<=W0))return!0}return!1}}function u1(Q0){this._parent=Q0,this._promisesCreated=0;var A=this._length=1+(Q0===void 0?0:Q0._length);if(b1(this,u1),A>32)this.uncycle()}J.inherits(u1,Error),Y.CapturedTrace=u1,u1.prototype.uncycle=function(){var Q0=this._length;if(Q0<2)return;var A=[],S={};for(var u=0,s=this;s!==void 0;++u)A.push(s),s=s._parent;Q0=this._length=u;for(var u=Q0-1;u>=0;--u){var W0=A[u].stack;if(S[W0]===void 0)S[W0]=u}for(var u=0;u<Q0;++u){var J0=A[u].stack,Z0=S[J0];if(Z0!==void 0&&Z0!==u){if(Z0>0)A[Z0-1]._parent=void 0,A[Z0-1]._length=1;A[u]._parent=void 0,A[u]._length=1;var w0=u>0?A[u-1]:this;if(Z0<Q0-1)w0._parent=A[Z0+1],w0._parent.uncycle(),w0._length=w0._parent._length+1;else w0._parent=void 0,w0._length=1;var B0=w0._length+1;for(var r0=u-2;r0>=0;--r0)A[r0]._length=B0,B0++;return}}},u1.prototype.attachExtraTrace=function(Q0){if(Q0.__stackCleaned__)return;this.uncycle();var A=o0(Q0),S=A.message,u=[A.stack],s=this;while(s!==void 0)u.push(y0(s.stack.split(`
`))),s=s._parent;E0(u),O0(u),J.notEnumerableProp(Q0,"stack",e(S,u)),J.notEnumerableProp(Q0,"__stackCleaned__",!0)};var b1=function(){var A=/^\s*at\s*/,S=function(J0,Z0){if(typeof J0==="string")return J0;if(Z0.name!==void 0&&Z0.message!==void 0)return Z0.toString();return X0(Z0)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,Z=A,q=S;var u=Error.captureStackTrace;return b0=function(J0){return H.test(J0)},function(J0,Z0){Error.stackTraceLimit+=6,u(J0,Z0),Error.stackTraceLimit-=6}}var s=Error();if(typeof s.stack==="string"&&s.stack.split(`
`)[0].indexOf("stackDetection@")>=0)return Z=/@/,q=S,V=!0,function(Z0){Z0.stack=Error().stack};var W0;try{throw Error()}catch(J0){W0="stack"in J0}if(!("stack"in s)&&W0&&typeof Error.stackTraceLimit==="number")return Z=A,q=S,function(Z0){Error.stackTraceLimit+=6;try{throw Error()}catch(w0){Z0.stack=w0.stack}Error.stackTraceLimit-=6};return q=function(J0,Z0){if(typeof J0==="string")return J0;if((typeof Z0==="object"||typeof Z0==="function")&&Z0.name!==void 0&&Z0.message!==void 0)return Z0.toString();return X0(Z0)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(w=function(Q0){console.warn(Q0)},J.isNode&&process.stderr.isTTY)w=function(Q0,A){var S=A?"\x1B[33m":"\x1B[31m";console.warn(S+Q0+`\x1B[0m
`)};else if(!J.isNode&&typeof Error().stack==="string")w=function(Q0,A){console.warn("%c"+Q0,A?"color: darkorange":"color: red")}}var D0={warnings:F,longStackTraces:!1,cancellation:!1,monitoring:!1};if(N)$.longStackTraces();return{longStackTraces:function(){return D0.longStackTraces},warnings:function(){return D0.warnings},cancellation:function(){return D0.cancellation},monitoring:function(){return D0.monitoring},propagateFromFunction:function(){return a},boundValueFunction:function(){return $0},checkForgottenReturns:Y0,setBounds:k1,warn:o,deprecated:R,CapturedTrace:u1,fireDomEvent:P,fireGlobalEvent:T}}});var hw0=j((u04,Sw0)=>{Sw0.exports=function($,Y){var U=M4(),I=$.CancellationError,Q=U.errorObj;function J(X,Z,q){this.promise=X,this.type=Z,this.handler=q,this.called=!1,this.cancelPromise=null}J.prototype.isFinallyHandler=function(){return this.type===0};function K(X){this.finallyHandler=X}K.prototype._resultCancelled=function(){z(this.finallyHandler)};function z(X,Z){if(X.cancelPromise!=null){if(arguments.length>1)X.cancelPromise._reject(Z);else X.cancelPromise._cancel();return X.cancelPromise=null,!0}return!1}function G(){return W.call(this,this.promise._target()._settledValue())}function H(X){if(z(this,X))return;return Q.e=X,Q}function W(X){var Z=this.promise,q=this.handler;if(!this.called){this.called=!0;var V=this.isFinallyHandler()?q.call(Z._boundValue()):q.call(Z._boundValue(),X);if(V!==void 0){Z._setReturnedNonUndefined();var w=Y(V,Z);if(w instanceof $){if(this.cancelPromise!=null){if(w._isCancelled()){var M=new I("late cancellation observer");return Z._attachExtraTrace(M),Q.e=M,Q}else if(w.isPending())w._attachCancellationCallback(new K(this))}return w._then(G,H,void 0,this,void 0)}}}if(Z.isRejected())return z(this),Q.e=X,Q;else return z(this),X}return $.prototype._passThrough=function(X,Z,q,V){if(typeof X!=="function")return this.then();return this._then(q,V,void 0,new J(this,Z,X),void 0)},$.prototype.lastly=$.prototype.finally=function(X){return this._passThrough(X,0,W,W)},$.prototype.tap=function(X){return this._passThrough(X,1,W)},J}});var yw0=j((b04,gw0)=>{gw0.exports=function($){var Y=M4(),U=eU().keys,I=Y.tryCatch,Q=Y.errorObj;function J(K,z,G){return function(H){var W=G._boundValue();$:for(var X=0;X<K.length;++X){var Z=K[X];if(Z===Error||Z!=null&&Z.prototype instanceof Error){if(H instanceof Z)return I(z).call(W,H)}else if(typeof Z==="function"){var q=I(Z).call(W,H);if(q===Q)return q;else if(q)return I(z).call(W,H)}else if(Y.isObject(H)){var V=U(Z);for(var w=0;w<V.length;++w){var M=V[w];if(Z[M]!=H[M])continue $}return I(z).call(W,H)}}return $}}return J}});var fc=j((i04,fw0)=>{var kw0=M4(),jF1=kw0.maybeWrapAsError,CF1=g3(),RF1=CF1.OperationalError,xw0=eU();function _F1($){return $ instanceof Error&&xw0.getPrototypeOf($)===Error.prototype}var vF1=/^(?:name|message|stack|cause)$/;function SF1($){var Y;if(_F1($)){Y=new RF1($),Y.name=$.name,Y.message=$.message,Y.stack=$.stack;var U=xw0.keys($);for(var I=0;I<U.length;++I){var Q=U[I];if(!vF1.test(Q))Y[Q]=$[Q]}return Y}return kw0.markAsOriginatingFromRejection($),$}function hF1($,Y){return function(U,I){if($===null)return;if(U){var Q=SF1(jF1(U));$._attachExtraTrace(Q),$._reject(Q)}else if(!Y)$._fulfill(I);else{var J=arguments.length,K=Array(Math.max(J-1,0));for(var z=1;z<J;++z)K[z-1]=arguments[z];$._fulfill(K)}$=null}}fw0.exports=hF1});var bw0=j((c04,uw0)=>{uw0.exports=function($,Y,U,I,Q){var J=M4(),K=J.tryCatch;$.method=function(z){if(typeof z!=="function")throw new $.TypeError("expecting a function but got "+J.classString(z));return function(){var G=new $(Y);G._captureStackTrace(),G._pushContext();var H=K(z).apply(this,arguments),W=G._popContext();return Q.checkForgottenReturns(H,W,"Promise.method",G),G._resolveFromSyncValue(H),G}},$.attempt=$.try=function(z){if(typeof z!=="function")return I("expecting a function but got "+J.classString(z));var G=new $(Y);G._captureStackTrace(),G._pushContext();var H;if(arguments.length>1){Q.deprecated("calling Promise.try with more than 1 argument");var W=arguments[1],X=arguments[2];H=J.isArray(W)?K(z).apply(X,W):K(z).call(X,W)}else H=K(z)();var Z=G._popContext();return Q.checkForgottenReturns(H,Z,"Promise.try",G),G._resolveFromSyncValue(H),G},$.prototype._resolveFromSyncValue=function(z){if(z===J.errorObj)this._rejectCallback(z.e,!1);else this._resolveCallback(z,!0)}}});var cw0=j((n04,iw0)=>{iw0.exports=function($,Y,U,I){var Q=!1,J=function(H,W){this._reject(W)},K=function(H,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(J,J,null,this,H)},z=function(H,W){if((this._bitField&50397184)===0)this._resolveCallback(W.target)},G=function(H,W){if(!W.promiseRejectionQueued)this._reject(H)};$.prototype.bind=function(H){if(!Q)Q=!0,$.prototype._propagateFrom=I.propagateFromFunction(),$.prototype._boundValue=I.boundValueFunction();var W=U(H),X=new $(Y);X._propagateFrom(this,1);var Z=this._target();if(X._setBoundTo(W),W instanceof $){var q={promiseRejectionQueued:!1,promise:X,target:Z,bindingPromise:W};Z._then(Y,K,vo Line truncated
`),s=-1,W0=-1,J0,Z0;for(var M0=0;M0<S.length;++M0){var A0=P1(S[M0]);if(A0){J0=A0.fileName,s=A0.line;break}}for(var M0=0;M0<u.length;++M0){var A0=P1(u[M0]);if(A0){Z0=A0.fileName,W0=A0.line;break}}if(s<0||W0<0||!J0||!Z0||J0!==Z0||s>=W0)return;b0=function(s0){if(H.test(s0))return!0;var J1=P1(s0);if(J1){if(J1.fileName===J0&&(s<=J1.line&&J1.line<=W0))return!0}return!1}}function u1(Q0){this._parent=Q0,this._promisesCreated=0;var A=this._length=1+(Q0===void 0?0:Q0._length);if(b1(this,u1),A>32)this.uncycle()}J.inherits(u1,Error),Y.CapturedTrace=u1,u1.prototype.uncycle=function(){var Q0=this._length;if(Q0<2)return;var A=[],S={};for(var u=0,s=this;s!==void 0;++u)A.push(s),s=s._parent;Q0=this._length=u;for(var u=Q0-1;u>=0;--u){var W0=A[u].stack;if(S[W0]===void 0)S[W0]=u}for(var u=0;u<Q0;++u){var J0=A[u].stack,Z0=S[J0];if(Z0!==void 0&&Z0!==u){if(Z0>0)A[Z0-1]._parent=void 0,A[Z0-1]._length=1;A[u]._parent=void 0,A[u]._length=1;var M0=u>0?A[u-1]:this;if(Z0<Q0-1)M0._parent=A[Z0+1],M0._parent.uncycle(),M0._length=M0._parent._length+1;else M0._parent=void 0,M0._length=1;var A0=M0._length+1;for(var s0=u-2;s0>=0;--s0)A[s0]._length=A0,A0++;return}}},u1.prototype.attachExtraTrace=function(Q0){if(Q0.__stackCleaned__)return;this.uncycle();var A=r0(Q0),S=A.message,u=[A.stack],s=this;while(s!==void 0)u.push(_0(s.stack.split(`
`))),s=s._parent;N0(u),w0(u),J.notEnumerableProp(Q0,"stack",e(S,u)),J.notEnumerableProp(Q0,"__stackCleaned__",!0)};var b1=function(){var A=/^\s*at\s*/,S=function(J0,Z0){if(typeof J0==="string")return J0;if(Z0.name!==void 0&&Z0.message!==void 0)return Z0.toString();return X0(Z0)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,Z=A,q=S;var u=Error.captureStackTrace;return b0=function(J0){return H.test(J0)},function(J0,Z0){Error.stackTraceLimit+=6,u(J0,Z0),Error.stackTraceLimit-=6}}var s=Error();if(typeof s.stack==="string"&&s.stack.split(`
`)[0].indexOf("stackDetection@")>=0)return Z=/@/,q=S,V=!0,function(Z0){Z0.stack=Error().stack};var W0;try{throw Error()}catch(J0){W0="stack"in J0}if(!("stack"in s)&&W0&&typeof Error.stackTraceLimit==="number")return Z=A,q=S,function(Z0){Error.stackTraceLimit+=6;try{throw Error()}catch(M0){Z0.stack=M0.stack}Error.stackTraceLimit-=6};return q=function(J0,Z0){if(typeof J0==="string")return J0;if((typeof Z0==="object"||typeof Z0==="function")&&Z0.name!==void 0&&Z0.message!==void 0)return Z0.toString();return X0(Z0)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(w=function(Q0){console.warn(Q0)},J.isNode&&process.stderr.isTTY)w=function(Q0,A){var S=A?"\x1B[33m":"\x1B[31m";console.warn(S+Q0+`\x1B[0m
`)};else if(!J.isNode&&typeof Error().stack==="string")w=function(Q0,A){console.warn("%c"+Q0,A?"color: darkorange":"color: red")}}var B0={warnings:F,longStackTraces:!1,cancellation:!1,monitoring:!1};if(N)$.longStackTraces();return{longStackTraces:function(){return B0.longStackTraces},warnings:function(){return B0.warnings},cancellation:function(){return B0.cancellation},monitoring:function(){return B0.monitoring},propagateFromFunction:function(){return a},boundValueFunction:function(){return $0},checkForgottenReturns:Y0,setBounds:k1,warn:o,deprecated:h,CapturedTrace:u1,fireDomEvent:P,fireGlobalEvent:T}}});var uw0=j((p04,fw0)=>{fw0.exports=function($,Y){var U=O4(),I=$.CancellationError,Q=U.errorObj;function J(X,Z,q){this.promise=X,this.type=Z,this.handler=q,this.called=!1,this.cancelPromise=null}J.prototype.isFinallyHandler=function(){return this.type===0};function K(X){this.finallyHandler=X}K.prototype._resultCancelled=function(){z(this.finallyHandler)};function z(X,Z){if(X.cancelPromise!=null){if(arguments.length>1)X.cancelPromise._reject(Z);else X.cancelPromise._cancel();return X.cancelPromise=null,!0}return!1}function G(){return W.call(this,this.promise._target()._settledValue())}function H(X){if(z(this,X))return;return Q.e=X,Q}function W(X){var Z=this.promise,q=this.handler;if(!this.called){this.called=!0;var V=this.isFinallyHandler()?q.call(Z._boundValue()):q.call(Z._boundValue(),X);if(V!==void 0){Z._setReturnedNonUndefined();var w=Y(V,Z);if(w instanceof $){if(this.cancelPromise!=null){if(w._isCancelled()){var M=new I("late cancellation observer");return Z._attachExtraTrace(M),Q.e=M,Q}else if(w.isPending())w._attachCancellationCallback(new K(this))}return w._then(G,H,void 0,this,void 0)}}}if(Z.isRejected())return z(this),Q.e=X,Q;else return z(this),X}return $.prototype._passThrough=function(X,Z,q,V){if(typeof X!=="function")return this.then();return this._then(q,V,void 0,new J(this,Z,X),void 0)},$.prototype.lastly=$.prototype.finally=function(X){return this._passThrough(X,0,W,W)},$.prototype.tap=function(X){return this._passThrough(X,1,W)},J}});var iw0=j((m04,bw0)=>{bw0.exports=function($){var Y=O4(),U=QI().keys,I=Y.tryCatch,Q=Y.errorObj;function J(K,z,G){return function(H){var W=G._boundValue();$:for(var X=0;X<K.length;++X){var Z=K[X];if(Z===Error||Z!=null&&Z.prototype instanceof Error){if(H instanceof Z)return I(z).call(W,H)}else if(typeof Z==="function"){var q=I(Z).call(W,H);if(q===Q)return q;else if(q)return I(z).call(W,H)}else if(Y.isObject(H)){var V=U(Z);for(var w=0;w<V.length;++w){var M=V[w];if(Z[M]!=H[M])continue $}return I(z).call(W,H)}}return $}}return J}});var cc=j((l04,dw0)=>{var cw0=O4(),vF1=cw0.maybeWrapAsError,SF1=y3(),hF1=SF1.OperationalError,nw0=QI();function gF1($){return $ instanceof Error&&nw0.getPrototypeOf($)===Error.prototype}var yF1=/^(?:name|message|stack|cause)$/;function kF1($){var Y;if(gF1($)){Y=new hF1($),Y.name=$.name,Y.message=$.message,Y.stack=$.stack;var U=nw0.keys($);for(var I=0;I<U.length;++I){var Q=U[I];if(!yF1.test(Q))Y[Q]=$[Q]}return Y}return cw0.markAsOriginatingFromRejection($),$}function xF1($,Y){return function(U,I){if($===null)return;if(U){var Q=kF1(vF1(U));$._attachExtraTrace(Q),$._reject(Q)}else if(!Y)$._fulfill(I);else{var J=arguments.length,K=Array(Math.max(J-1,0));for(var z=1;z<J;++z)K[z-1]=arguments[z];$._fulfill(K)}$=null}}dw0.exports=xF1});var mw0=j((o04,pw0)=>{pw0.exports=function($,Y,U,I,Q){var J=O4(),K=J.tryCatch;$.method=function(z){if(typeof z!=="function")throw new $.TypeError("expecting a function but got "+J.classString(z));return function(){var G=new $(Y);G._captureStackTrace(),G._pushContext();var H=K(z).apply(this,arguments),W=G._popContext();return Q.checkForgottenReturns(H,W,"Promise.method",G),G._resolveFromSyncValue(H),G}},$.attempt=$.try=function(z){if(typeof z!=="function")return I("expecting a function but got "+J.classString(z));var G=new $(Y);G._captureStackTrace(),G._pushContext();var H;if(arguments.length>1){Q.deprecated("calling Promise.try with more than 1 argument");var W=arguments[1],X=arguments[2];H=J.isArray(W)?K(z).apply(X,W):K(z).call(X,W)}else H=K(z)();var Z=G._popContext();return Q.checkForgottenReturns(H,Z,"Promise.try",G),G._resolveFromSyncValue(H),G},$.prototype._resolveFromSyncValue=function(z){if(z===J.errorObj)this._rejectCallback(z.e,!1);else this._resolveCallback(z,!0)}}});var ow0=j((r04,lw0)=>{lw0.exports=function($,Y,U,I){var Q=!1,J=function(H,W){this._reject(W)},K=function(H,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(J,J,null,this,H)},z=function(H,W){if((this._bitField&50397184)===0)this._resolveCallback(W.target)},G=function(H,W){if(!W.promiseRejectionQueued)this._reject(H)};$.prototype.bind=function(H){if(!Q)Q=!0,$.prototype._propagateFrom=I.propagateFromFunction(),$.prototype._boundValue=I.boundValueFunction();var W=U(H),X=new $(Y);X._propagateFrom(this,1);var Z=this._target();if(X._setBoundTo(W),W instanceof $){var q={promiseRejectionQueued:!1,promise:X,target:Z,bindingPromise:W};Z._then(Y,K,vo Line truncated
See http://goo.gl/MqrFmX
`);return this._settledValue()},I=Y.prototype.error=Y.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()},Q=Y.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},J=Y.prototype.isRejected=function(){return(this._bitField&16777216)!==0},K=Y.prototype.isPending=function(){return(this._bitField&50397184)===0},z=Y.prototype.isResolved=function(){return(this._bitField&50331648)!==0};Y.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 J.call(this._target())},$.prototype.isFulfilled=function(){return Q.call(this._target())},$.prototype.isResolved=function(){return z.call(this._target())},$.prototype.value=function(){return U.call(this._target())},$.prototype.reason=function(){var G=this._target();return G._unsetRejectionIsUnhandled(),I.call(G)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=Y}});var sw0=j((l04,rw0)=>{rw0.exports=function($,Y,U,I,Q,J){var K=M4(),z=K.canEvaluate,G=K.tryCatch,H=K.errorObj,W;if(z){var X=function(N){return Function("value","holder",`
`);return this._settledValue()},Q=Y.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0},J=Y.prototype.isRejected=function(){return(this._bitField&16777216)!==0},K=Y.prototype.isPending=function(){return(this._bitField&50397184)===0},z=Y.prototype.isResolved=function(){return(this._bitField&50331648)!==0};Y.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 J.call(this._target())},$.prototype.isFulfilled=function(){return Q.call(this._target())},$.prototype.isResolved=function(){return z.call(this._target())},$.prototype.value=function(){return U.call(this._target())},$.prototype.reason=function(){var G=this._target();return G._unsetRejectionIsUnhandled(),I.call(G)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=Y}});var UM0=j((e04,YM0)=>{YM0.exports=function($,Y,U,I,Q,J){var K=O4(),z=K.canEvaluate,G=K.tryCatch,H=K.errorObj,W;if(z){var X=function(N){return Function("value","holder",`
'use strict';
holder.pIndex = value;
holder.checkFulfillment(this);
@@ -199,7 +199,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof C6))r
return [TheName];
}(tryCatch, errorObj, Promise, async);
`;return C=C.replace(/\[TheName\]/g,E).replace(/\[TheTotal\]/g,N).replace(/\[ThePassedArguments\]/g,B).replace(/\[TheProperties\]/g,P).replace(/\[CancellationCode\]/g,T),Function("tryCatch","errorObj","Promise","async",C)(G,H,$,Q)},V=[],w=[],M=[];for(var F=0;F<8;++F)V.push(q(F+1)),w.push(X(F+1)),M.push(Z(F+1));W=function(N){this._reject(N)}}$.join=function(){var N=arguments.length-1,O;if(N>0&&typeof arguments[N]==="function"){if(O=arguments[N],N<=8&&z){var c=new $(I);c._captureStackTrace();var D=V[N-1],P=new D(O),T=w;for(var B=0;B<N;++B){var E=U(arguments[B],c);if(E instanceof $){E=E._target();var C=E._bitField;if((C&50397184)===0)E._then(T[B],W,void 0,c,P),M[B](E,P),P.asyncNeeded=!1;else if((C&33554432)!==0)T[B].call(c,E._value(),P);else if((C&16777216)!==0)c._reject(E._reason());else c._cancel()}else T[B].call(c,E,P)}if(!c._isFateSealed()){if(P.asyncNeeded){var i=J();if(i!==null)P.fn=K.domainBind(i,P.fn)}c._setAsyncGuaranteed(),c._setOnCancel(P)}return c}}var x=arguments.length,g=Array(x);for(var b=0;b<x;++b)g[b]=arguments[b];if(O)g.pop();var c=new Y(g).promise();return O!==void 0?c.spread(O):c}}});var tw0=j((o04,aw0)=>{aw0.exports=function($,Y,U,I,Q,J){var K=$._getDomain,z=M4(),G=z.tryCatch,H=z.errorObj,W=$._async;function X(q,V,w,M){this.constructor$(q),this._promise._captureStackTrace();var F=K();this._callback=F===null?V:z.domainBind(F,V),this._preservedValues=M===Q?Array(this.length()):null,this._limit=w,this._inFlight=0,this._queue=[],W.invoke(this._asyncInit,this,void 0)}z.inherits(X,Y),X.prototype._asyncInit=function(){this._init$(void 0,-2)},X.prototype._init=function(){},X.prototype._promiseFulfilled=function(q,V){var w=this._values,M=this.length(),F=this._preservedValues,N=this._limit;if(V<0){if(V=V*-1-1,w[V]=q,N>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(N>=1&&this._inFlight>=N)return w[V]=q,this._queue.push(V),!1;if(F!==null)F[V]=q;var O=this._promise,D=this._callback,P=O._boundValue();O._pushContext();var T=G(D).call(P,q,V,M),B=O._popContext();if(J.checkForgottenReturns(T,B,F!==null?"Promise.filter":"Promise.map",O),T===H)return this._reject(T.e),!0;var E=I(T,this._promise);if(E instanceof $){E=E._target();var C=E._bitField;if((C&50397184)===0){if(N>=1)this._inFlight++;return w[V]=E,E._proxy(this,(V+1)*-1),!1}else if((C&33554432)!==0)T=E._value();else if((C&16777216)!==0)return this._reject(E._reason()),!0;else return this._cancel(),!0}w[V]=T}var i=++this._totalResolved;if(i>=M){if(F!==null)this._filter(w,F);else this._resolve(w);return!0}return!1},X.prototype._drainQueue=function(){var q=this._queue,V=this._limit,w=this._values;while(q.length>0&&this._inFlight<V){if(this._isResolved())return;var M=q.pop();this._promiseFulfilled(w[M],M)}},X.prototype._filter=function(q,V){var w=V.length,M=Array(w),F=0;for(var N=0;N<w;++N)if(q[N])M[F++]=V[N];M.length=F,this._resolve(M)},X.prototype.preservedValues=function(){return this._preservedValues};function Z(q,V,w,M){if(typeof V!=="function")return U("expecting a function but got "+z.classString(V));var F=0;if(w!==void 0)if(typeof w==="object"&&w!==null){if(typeof w.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+z.classString(w.concurrency)));F=w.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+z.classString(w)));return F=typeof F==="number"&&isFinite(F)&&F>=1?F:0,new X(q,V,F,M).promise()}$.prototype.map=function(q,V){return Z(this,q,V,null)},$.map=function(q,V,w,M){return Z(q,V,w,M)}}});var $M0=j((r04,ew0)=>{var uc=Object.create;if(uc)$A=uc(null),YA=uc(null),$A[" size"]=YA[" size"]=0;var $A,YA;ew0.exports=function($){var Y=M4(),U=Y.canEvaluate,I=Y.isIdentifier,Q,J,K=function(q){return Function("ensureMethod",`
`;return C=C.replace(/\[TheName\]/g,E).replace(/\[TheTotal\]/g,N).replace(/\[ThePassedArguments\]/g,B).replace(/\[TheProperties\]/g,P).replace(/\[CancellationCode\]/g,T),Function("tryCatch","errorObj","Promise","async",C)(G,H,$,Q)},V=[],w=[],M=[];for(var F=0;F<8;++F)V.push(q(F+1)),w.push(X(F+1)),M.push(Z(F+1));W=function(N){this._reject(N)}}$.join=function(){var N=arguments.length-1,O;if(N>0&&typeof arguments[N]==="function"){if(O=arguments[N],N<=8&&z){var c=new $(I);c._captureStackTrace();var D=V[N-1],P=new D(O),T=w;for(var B=0;B<N;++B){var E=U(arguments[B],c);if(E instanceof $){E=E._target();var C=E._bitField;if((C&50397184)===0)E._then(T[B],W,void 0,c,P),M[B](E,P),P.asyncNeeded=!1;else if((C&33554432)!==0)T[B].call(c,E._value(),P);else if((C&16777216)!==0)c._reject(E._reason());else c._cancel()}else T[B].call(c,E,P)}if(!c._isFateSealed()){if(P.asyncNeeded){var i=J();if(i!==null)P.fn=K.domainBind(i,P.fn)}c._setAsyncGuaranteed(),c._setOnCancel(P)}return c}}var x=arguments.length,g=Array(x);for(var b=0;b<x;++b)g[b]=arguments[b];if(O)g.pop();var c=new Y(g).promise();return O!==void 0?c.spread(O):c}}});var QM0=j(($14,IM0)=>{IM0.exports=function($,Y,U,I,Q,J){var K=$._getDomain,z=O4(),G=z.tryCatch,H=z.errorObj,W=$._async;function X(q,V,w,M){this.constructor$(q),this._promise._captureStackTrace();var F=K();this._callback=F===null?V:z.domainBind(F,V),this._preservedValues=M===Q?Array(this.length()):null,this._limit=w,this._inFlight=0,this._queue=[],W.invoke(this._asyncInit,this,void 0)}z.inherits(X,Y),X.prototype._asyncInit=function(){this._init$(void 0,-2)},X.prototype._init=function(){},X.prototype._promiseFulfilled=function(q,V){var w=this._values,M=this.length(),F=this._preservedValues,N=this._limit;if(V<0){if(V=V*-1-1,w[V]=q,N>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(N>=1&&this._inFlight>=N)return w[V]=q,this._queue.push(V),!1;if(F!==null)F[V]=q;var O=this._promise,D=this._callback,P=O._boundValue();O._pushContext();var T=G(D).call(P,q,V,M),B=O._popContext();if(J.checkForgottenReturns(T,B,F!==null?"Promise.filter":"Promise.map",O),T===H)return this._reject(T.e),!0;var E=I(T,this._promise);if(E instanceof $){E=E._target();var C=E._bitField;if((C&50397184)===0){if(N>=1)this._inFlight++;return w[V]=E,E._proxy(this,(V+1)*-1),!1}else if((C&33554432)!==0)T=E._value();else if((C&16777216)!==0)return this._reject(E._reason()),!0;else return this._cancel(),!0}w[V]=T}var i=++this._totalResolved;if(i>=M){if(F!==null)this._filter(w,F);else this._resolve(w);return!0}return!1},X.prototype._drainQueue=function(){var q=this._queue,V=this._limit,w=this._values;while(q.length>0&&this._inFlight<V){if(this._isResolved())return;var M=q.pop();this._promiseFulfilled(w[M],M)}},X.prototype._filter=function(q,V){var w=V.length,M=Array(w),F=0;for(var N=0;N<w;++N)if(q[N])M[F++]=V[N];M.length=F,this._resolve(M)},X.prototype.preservedValues=function(){return this._preservedValues};function Z(q,V,w,M){if(typeof V!=="function")return U("expecting a function but got "+z.classString(V));var F=0;if(w!==void 0)if(typeof w==="object"&&w!==null){if(typeof w.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+z.classString(w.concurrency)));F=w.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+z.classString(w)));return F=typeof F==="number"&&isFinite(F)&&F>=1?F:0,new X(q,V,F,M).promise()}$.prototype.map=function(q,V){return Z(this,q,V,null)},$.map=function(q,V,w,M){return Z(q,V,w,M)}}});var KM0=j((Y14,JM0)=>{var nc=Object.create;if(nc)IA=nc(null),QA=nc(null),IA[" size"]=QA[" size"]=0;var IA,QA;JM0.exports=function($){var Y=O4(),U=Y.canEvaluate,I=Y.isIdentifier,Q,J,K=function(q){return Function("ensureMethod",`
return function(obj) {
'use strict'
var len = this.length;
@@ -216,7 +216,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof C6))r
`.replace(/methodName/g,q))(H)},z=function(q){return Function("obj",`
'use strict';
return obj.propertyName;
`.replace("propertyName",q))},G=function(q,V,w){var M=w[q];if(typeof M!=="function"){if(!I(q))return null;if(M=V(q),w[q]=M,w[" size"]++,w[" size"]>512){var F=Object.keys(w);for(var N=0;N<256;++N)delete w[F[N]];w[" size"]=F.length-256}}return M};Q=function(q){return G(q,K,$A)},J=function(q){return G(q,z,YA)};function H(q,V){var w;if(q!=null)w=q[V];if(typeof w!=="function"){var M="Object "+Y.classString(q)+" has no method '"+Y.toString(V)+"'";throw new $.TypeError(M)}return w}function W(q){var V=this.pop(),w=H(q,V);return w.apply(q,this)}$.prototype.call=function(q){var V=arguments.length,w=Array(Math.max(V-1,0));for(var M=1;M<V;++M)w[M-1]=arguments[M];if(U){var F=Q(q);if(F!==null)return this._then(F,void 0,void 0,w,void 0)}return w.push(q),this._then(W,void 0,void 0,w,void 0)};function X(q){return q[this]}function Z(q){var V=+this;if(V<0)V=Math.max(0,V+q.length);return q[V]}$.prototype.get=function(q){var V=typeof q==="number",w;if(!V)if(U){var M=J(q);w=M!==null?M:X}else w=X;else w=Z;return this._then(w,void 0,void 0,q,void 0)}}});var UM0=j((s04,YM0)=>{YM0.exports=function($,Y,U,I,Q,J){var K=M4(),z=g3().TypeError,G=M4().inherits,H=K.errorObj,W=K.tryCatch,X={};function Z(O){setTimeout(function(){throw O},0)}function q(O){var D=U(O);if(D!==O&&typeof O._isDisposable==="function"&&typeof O._getDisposer==="function"&&O._isDisposable())D._setDisposable(O._getDisposer());return D}function V(O,D){var P=0,T=O.length,B=new $(Q);function E(){if(P>=T)return B._fulfill();var C=q(O[P++]);if(C instanceof $&&C._isDisposable()){try{C=U(C._getDisposer().tryDispose(D),O.promise)}catch(i){return Z(i)}if(C instanceof $)return C._then(E,Z,null,null,null)}E()}return E(),B}function w(O,D,P){this._data=O,this._promise=D,this._context=P}w.prototype.data=function(){return this._data},w.prototype.promise=function(){return this._promise},w.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return X},w.prototype.tryDispose=function(O){var D=this.resource(),P=this._context;if(P!==void 0)P._pushContext();var T=D!==X?this.doDispose(D,O):null;if(P!==void 0)P._popContext();return this._promise._unsetDisposable(),this._data=null,T},w.isDisposer=function(O){return O!=null&&typeof O.resource==="function"&&typeof O.tryDispose==="function"};function M(O,D,P){this.constructor$(O,D,P)}G(M,w),M.prototype.doDispose=function(O,D){var P=this.data();return P.call(O,O,D)};function F(O){if(w.isDisposer(O))return this.resources[this.index]._setDisposable(O),O.promise();return O}function N(O){this.length=O,this.promise=null,this[O-1]=null}N.prototype._resultCancelled=function(){var O=this.length;for(var D=0;D<O;++D){var P=this[D];if(P instanceof $)P.cancel()}},$.using=function(){var O=arguments.length;if(O<2)return Y("you must pass at least 2 arguments to Promise.using");var D=arguments[O-1];if(typeof D!=="function")return Y("expecting a function but got "+K.classString(D));var P,T=!0;if(O===2&&Array.isArray(arguments[0]))P=arguments[0],O=P.length,T=!1;else P=arguments,O--;var B=new N(O);for(var E=0;E<O;++E){var C=P[E];if(w.isDisposer(C)){var i=C;C=C.promise(),C._setDisposable(i)}else{var x=U(C);if(x instanceof $)C=x._then(F,null,null,{resources:B,index:E},void 0)}B[E]=C}var g=Array(B.length);for(var E=0;E<g.length;++E)g[E]=$.resolve(B[E]).reflect();var b=$.all(g).then(function(I0){for(var k=0;k<I0.length;++k){var p=I0[k];if(p.isRejected())return H.e=p.error(),H;else if(!p.isFulfilled()){b.cancel();return}I0[k]=p.value()}c._pushContext(),D=W(D);var a=T?D.apply(void 0,I0):D(I0),$0=c._popContext();return J.checkForgottenReturns(a,$0,"Promise.using",c),a}),c=b.lastly(function(){var I0=new $.PromiseInspection(b);return V(B,I0)});return B.promise=c,c._setOnCancel(B),c},$.prototype._setDisposable=function(O){this._bitField=this._bitField|131072,this._disposer=O},$.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(O){if(typeof O==="function")return new M(O,this,I());throw new z}}});var QM0=j((a04,IM0)=>{IM0.exports=function($,Y,U){var I=M4(),Q=$.TimeoutError;function J(X){this.handle=X}J.prototype._resultCancelled=function(){clearTimeout(this.handle)};var K=function(X){return z(+this).thenReturn(X)},z=$.delay=function(X,Z){var q,V;if(Z!==void 0){if(q=$.resolve(Z)._then(K,null,null,X,void 0),U.cancellation()&&Z instanceof $)q._setOnCancel(Z)}else{if(q=new $(Y),V=setTimeout(function(){q._fulfill()},+X),U.cancellation())q._setOnCancel(new J(V));q._captureStackTrace()}return q._setAsyncGuaranteed(),q};$.prototype.delay=function(X){return z(X,this)};var G=function(X,Z,q){var V;if(typeof Z!=="string")if(Z instanceof Error)V=Z;else V=new Q("operation timed out");else V=new Q(Z);if(I.markAsOriginatingFromRejection(V),X._attachExtraTrace(V),X._reject(V),q!=null)q.cancel()};function H(X){return clearTimeout(this.handle),X Line truncated
`.replace("propertyName",q))},G=function(q,V,w){var M=w[q];if(typeof M!=="function"){if(!I(q))return null;if(M=V(q),w[q]=M,w[" size"]++,w[" size"]>512){var F=Object.keys(w);for(var N=0;N<256;++N)delete w[F[N]];w[" size"]=F.length-256}}return M};Q=function(q){return G(q,K,IA)},J=function(q){return G(q,z,QA)};function H(q,V){var w;if(q!=null)w=q[V];if(typeof w!=="function"){var M="Object "+Y.classString(q)+" has no method '"+Y.toString(V)+"'";throw new $.TypeError(M)}return w}function W(q){var V=this.pop(),w=H(q,V);return w.apply(q,this)}$.prototype.call=function(q){var V=arguments.length,w=Array(Math.max(V-1,0));for(var M=1;M<V;++M)w[M-1]=arguments[M];if(U){var F=Q(q);if(F!==null)return this._then(F,void 0,void 0,w,void 0)}return w.push(q),this._then(W,void 0,void 0,w,void 0)};function X(q){return q[this]}function Z(q){var V=+this;if(V<0)V=Math.max(0,V+q.length);return q[V]}$.prototype.get=function(q){var V=typeof q==="number",w;if(!V)if(U){var M=J(q);w=M!==null?M:X}else w=X;else w=Z;return this._then(w,void 0,void 0,q,void 0)}}});var GM0=j((U14,zM0)=>{zM0.exports=function($,Y,U,I,Q,J){var K=O4(),z=y3().TypeError,G=O4().inherits,H=K.errorObj,W=K.tryCatch,X={};function Z(O){setTimeout(function(){throw O},0)}function q(O){var D=U(O);if(D!==O&&typeof O._isDisposable==="function"&&typeof O._getDisposer==="function"&&O._isDisposable())D._setDisposable(O._getDisposer());return D}function V(O,D){var P=0,T=O.length,B=new $(Q);function E(){if(P>=T)return B._fulfill();var C=q(O[P++]);if(C instanceof $&&C._isDisposable()){try{C=U(C._getDisposer().tryDispose(D),O.promise)}catch(i){return Z(i)}if(C instanceof $)return C._then(E,Z,null,null,null)}E()}return E(),B}function w(O,D,P){this._data=O,this._promise=D,this._context=P}w.prototype.data=function(){return this._data},w.prototype.promise=function(){return this._promise},w.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return X},w.prototype.tryDispose=function(O){var D=this.resource(),P=this._context;if(P!==void 0)P._pushContext();var T=D!==X?this.doDispose(D,O):null;if(P!==void 0)P._popContext();return this._promise._unsetDisposable(),this._data=null,T},w.isDisposer=function(O){return O!=null&&typeof O.resource==="function"&&typeof O.tryDispose==="function"};function M(O,D,P){this.constructor$(O,D,P)}G(M,w),M.prototype.doDispose=function(O,D){var P=this.data();return P.call(O,O,D)};function F(O){if(w.isDisposer(O))return this.resources[this.index]._setDisposable(O),O.promise();return O}function N(O){this.length=O,this.promise=null,this[O-1]=null}N.prototype._resultCancelled=function(){var O=this.length;for(var D=0;D<O;++D){var P=this[D];if(P instanceof $)P.cancel()}},$.using=function(){var O=arguments.length;if(O<2)return Y("you must pass at least 2 arguments to Promise.using");var D=arguments[O-1];if(typeof D!=="function")return Y("expecting a function but got "+K.classString(D));var P,T=!0;if(O===2&&Array.isArray(arguments[0]))P=arguments[0],O=P.length,T=!1;else P=arguments,O--;var B=new N(O);for(var E=0;E<O;++E){var C=P[E];if(w.isDisposer(C)){var i=C;C=C.promise(),C._setDisposable(i)}else{var x=U(C);if(x instanceof $)C=x._then(F,null,null,{resources:B,index:E},void 0)}B[E]=C}var g=Array(B.length);for(var E=0;E<g.length;++E)g[E]=$.resolve(B[E]).reflect();var b=$.all(g).then(function(I0){for(var k=0;k<I0.length;++k){var p=I0[k];if(p.isRejected())return H.e=p.error(),H;else if(!p.isFulfilled()){b.cancel();return}I0[k]=p.value()}c._pushContext(),D=W(D);var a=T?D.apply(void 0,I0):D(I0),$0=c._popContext();return J.checkForgottenReturns(a,$0,"Promise.using",c),a}),c=b.lastly(function(){var I0=new $.PromiseInspection(b);return V(B,I0)});return B.promise=c,c._setOnCancel(B),c},$.prototype._setDisposable=function(O){this._bitField=this._bitField|131072,this._disposer=O},$.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(O){if(typeof O==="function")return new M(O,this,I());throw new z}}});var WM0=j((I14,HM0)=>{HM0.exports=function($,Y,U){var I=O4(),Q=$.TimeoutError;function J(X){this.handle=X}J.prototype._resultCancelled=function(){clearTimeout(this.handle)};var K=function(X){return z(+this).thenReturn(X)},z=$.delay=function(X,Z){var q,V;if(Z!==void 0){if(q=$.resolve(Z)._then(K,null,null,X,void 0),U.cancellation()&&Z instanceof $)q._setOnCancel(Z)}else{if(q=new $(Y),V=setTimeout(function(){q._fulfill()},+X),U.cancellation())q._setOnCancel(new J(V));q._captureStackTrace()}return q._setAsyncGuaranteed(),q};$.prototype.delay=function(X){return z(X,this)};var G=function(X,Z,q){var V;if(typeof Z!=="string")if(Z instanceof Error)V=Z;else V=new Q("operation timed out");else V=new Q(Z);if(I.markAsOriginatingFromRejection(V),X._attachExtraTrace(V),X._reject(V),q!=null)q.cancel()};function H(X){return clearTimeout(this.handle),X Line truncated
See http://goo.gl/MqrFmX
@@ -229,13 +229,13 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof C6))r
`);var M=Object(w).yieldHandler,F=q,N=Error().stack;return function(){var O=V.apply(this,arguments),D=new F(void 0,void 0,M,N),P=D.promise();return D._generator=O,D._promiseFulfilled(void 0),P}},$.coroutine.addYieldHandler=function(V){if(typeof V!=="function")throw new z("expecting a function but got "+G.classString(V));X.push(V)},$.spawn=function(V){if(J.deprecated("Promise.spawn()","Promise.coroutine()"),typeof V!=="function")return Y(`generatorFunction must be a function
See http://goo.gl/MqrFmX
`);var w=new q(V,this),M=w.promise();return w._run($.spawn),M}}});var GM0=j((e04,zM0)=>{zM0.exports=function($){var Y=M4(),U=$._async,I=Y.tryCatch,Q=Y.errorObj;function J(G,H){var W=this;if(!Y.isArray(G))return K.call(W,G,H);var X=I(H).apply(W._boundValue(),[null].concat(G));if(X===Q)U.throwLater(X.e)}function K(G,H){var W=this,X=W._boundValue(),Z=G===void 0?I(H).call(X,null):I(H).call(X,null,G);if(Z===Q)U.throwLater(Z.e)}function z(G,H){var W=this;if(!G){var X=Error(G+"");X.cause=G,G=X}var Z=I(H).call(W._boundValue(),G);if(Z===Q)U.throwLater(Z.e)}$.prototype.asCallback=$.prototype.nodeify=function(G,H){if(typeof G=="function"){var W=K;if(H!==void 0&&Object(H).spread)W=J;this._then(W,z,void 0,this,G)}return this}}});var WM0=j(($14,HM0)=>{HM0.exports=function($,Y){var U={},I=M4(),Q=fc(),J=I.withAppended,K=I.maybeWrapAsError,z=I.canEvaluate,G=g3().TypeError,H="Async",W={__isPromisified__:!0},X=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],Z=new RegExp("^(?:"+X.join("|")+")$"),q=function(b){return I.isIdentifier(b)&&b.charAt(0)!=="_"&&b!=="constructor"};function V(b){return!Z.test(b)}function w(b){try{return b.__isPromisified__===!0}catch(c){return!1}}function M(b,c,I0){var k=I.getDataPropertyOrDefault(b,c+I0,W);return k?w(k):!1}function F(b,c,I0){for(var k=0;k<b.length;k+=2){var p=b[k];if(I0.test(p)){var a=p.replace(I0,"");for(var $0=0;$0<b.length;$0+=2)if(b[$0]===a)throw new G(`Cannot promisify an API that has normal methods with '%s'-suffix
`);var w=new q(V,this),M=w.promise();return w._run($.spawn),M}}});var VM0=j((J14,qM0)=>{qM0.exports=function($){var Y=O4(),U=$._async,I=Y.tryCatch,Q=Y.errorObj;function J(G,H){var W=this;if(!Y.isArray(G))return K.call(W,G,H);var X=I(H).apply(W._boundValue(),[null].concat(G));if(X===Q)U.throwLater(X.e)}function K(G,H){var W=this,X=W._boundValue(),Z=G===void 0?I(H).call(X,null):I(H).call(X,null,G);if(Z===Q)U.throwLater(Z.e)}function z(G,H){var W=this;if(!G){var X=Error(G+"");X.cause=G,G=X}var Z=I(H).call(W._boundValue(),G);if(Z===Q)U.throwLater(Z.e)}$.prototype.asCallback=$.prototype.nodeify=function(G,H){if(typeof G=="function"){var W=K;if(H!==void 0&&Object(H).spread)W=J;this._then(W,z,void 0,this,G)}return this}}});var FM0=j((K14,LM0)=>{LM0.exports=function($,Y){var U={},I=O4(),Q=cc(),J=I.withAppended,K=I.maybeWrapAsError,z=I.canEvaluate,G=y3().TypeError,H="Async",W={__isPromisified__:!0},X=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],Z=new RegExp("^(?:"+X.join("|")+")$"),q=function(b){return I.isIdentifier(b)&&b.charAt(0)!=="_"&&b!=="constructor"};function V(b){return!Z.test(b)}function w(b){try{return b.__isPromisified__===!0}catch(c){return!1}}function M(b,c,I0){var k=I.getDataPropertyOrDefault(b,c+I0,W);return k?w(k):!1}function F(b,c,I0){for(var k=0;k<b.length;k+=2){var p=b[k];if(I0.test(p)){var a=p.replace(I0,"");for(var $0=0;$0<b.length;$0+=2)if(b[$0]===a)throw new G(`Cannot promisify an API that has normal methods with '%s'-suffix
See http://goo.gl/MqrFmX
`.replace("%s",c))}}}function N(b,c,I0,k){var p=I.inheritedDataKeys(b),a=[];for(var $0=0;$0<p.length;++$0){var y=p[$0],d=b[y],Y0=k===q?!0:q(y,d,b);if(typeof d==="function"&&!w(d)&&!M(b,y,c)&&k(y,d,b,Y0))a.push(y,d)}return F(a,c,I0),a}var O=function(b){return b.replace(/([$])/,"\\$")},D,P=function(b){var c=[b],I0=Math.max(0,b-1-3);for(var k=b-1;k>=I0;--k)c.push(k);for(var k=b+1;k<=3;++k)c.push(k);return c},T=function(b){return I.filledRange(b,"_arg","")},B=function(b){return I.filledRange(Math.max(b,3),"_arg","")},E=function(b){if(typeof b.length==="number")return Math.max(Math.min(b.length,1024),0);return 0};D=function(b,c,I0,k,p,a){var $0=Math.max(0,E(k)-1),y=P($0),d=typeof b==="string"||c===U;function Y0(O0){var E0=T(O0).join(", "),y0=O0>0?", ":"",v0;if(d)v0=`ret = callback.call(this, {{args}}, nodeback); break;
`.replace("%s",c))}}}function N(b,c,I0,k){var p=I.inheritedDataKeys(b),a=[];for(var $0=0;$0<p.length;++$0){var y=p[$0],d=b[y],Y0=k===q?!0:q(y,d,b);if(typeof d==="function"&&!w(d)&&!M(b,y,c)&&k(y,d,b,Y0))a.push(y,d)}return F(a,c,I0),a}var O=function(b){return b.replace(/([$])/,"\\$")},D,P=function(b){var c=[b],I0=Math.max(0,b-1-3);for(var k=b-1;k>=I0;--k)c.push(k);for(var k=b+1;k<=3;++k)c.push(k);return c},T=function(b){return I.filledRange(b,"_arg","")},B=function(b){return I.filledRange(Math.max(b,3),"_arg","")},E=function(b){if(typeof b.length==="number")return Math.max(Math.min(b.length,1024),0);return 0};D=function(b,c,I0,k,p,a){var $0=Math.max(0,E(k)-1),y=P($0),d=typeof b==="string"||c===U;function Y0(w0){var N0=T(w0).join(", "),_0=w0>0?", ":"",v0;if(d)v0=`ret = callback.call(this, {{args}}, nodeback); break;
`;else v0=c===void 0?`ret = callback({{args}}, nodeback); break;
`:`ret = callback.call(receiver, {{args}}, nodeback); break;
`;return v0.replace("{{args}}",E0).replace(", ",y0)}function R(){var O0="";for(var E0=0;E0<y.length;++E0)O0+="case "+y[E0]+":"+Y0(y[E0]);return O0+=`
`;return v0.replace("{{args}}",N0).replace(", ",_0)}function h(){var w0="";for(var N0=0;N0<y.length;++N0)w0+="case "+y[N0]+":"+Y0(y[N0]);return w0+=`
default:
var args = new Array(len + 1);
var i = 0;
@@ -247,7 +247,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof C6))r
break;
`.replace("[CodeForCall]",d?`ret = callback.apply(this, args);
`:`ret = callback.apply(receiver, args);
`),O0}var o=typeof b==="string"?"this != null ? this['"+b+"'] : fn":"fn",e=`'use strict';
`),w0}var o=typeof b==="string"?"this != null ? this['"+b+"'] : fn":"fn",e=`'use strict';
var ret = function (Parameters) {
'use strict';
var len = arguments.length;
@@ -267,25 +267,25 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof C6))r
};
notEnumerableProp(ret, '__isPromisified__', true);
return ret;
`.replace("[CodeForSwitchCase]",R()).replace("[GetFunctionCode]",o);return e=e.replace("Parameters",B($0)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",e)($,k,c,J,K,Q,I.tryCatch,I.errorObj,I.notEnumerableProp,Y)};function C(b,c,I0,k,p,a){var $0=function(){return this}(),y=b;if(typeof y==="string")b=k;function d(){var Y0=c;if(c===U)Y0=this;var R=new $(Y);R._captureStackTrace();var o=typeof y==="string"&&this!==$0?this[y]:b,e=Q(R,a);try{o.apply(Y0,J(arguments,e))}catch(O0){R._rejectCallback(K(O0),!0,!0)}if(!R._isFateSealed())R._setAsyncGuaranteed();return R}return I.notEnumerableProp(d,"__isPromisified__",!0),d}var i=z?D:C;function x(b,c,I0,k,p){var a=new RegExp(O(c)+"$"),$0=N(b,c,a,I0);for(var y=0,d=$0.length;y<d;y+=2){var Y0=$0[y],R=$0[y+1],o=Y0+c;if(k===i)b[o]=i(Y0,U,Y0,R,c,p);else{var e=k(R,function(){return i(Y0,U,Y0,R,c,p)});I.notEnumerableProp(e,"__isPromisified__",!0),b[o]=e}}return I.toFastProperties(b),b}function g(b,c,I0){return i(b,c,void 0,b,null,I0)}$.promisify=function(b,c){if(typeof b!=="function")throw new G("expecting a function but got "+I.classString(b));if(w(b))return b;c=Object(c);var I0=c.context===void 0?U:c.context,k=!!c.multiArgs,p=g(b,I0,k);return I.copyDescriptors(b,p,V),p},$.promisifyAll=function(b,c){if(typeof b!=="function"&&typeof b!=="object")throw new G(`the target of promisifyAll must be an object or a function
`.replace("[CodeForSwitchCase]",h()).replace("[GetFunctionCode]",o);return e=e.replace("Parameters",B($0)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",e)($,k,c,J,K,Q,I.tryCatch,I.errorObj,I.notEnumerableProp,Y)};function C(b,c,I0,k,p,a){var $0=function(){return this}(),y=b;if(typeof y==="string")b=k;function d(){var Y0=c;if(c===U)Y0=this;var h=new $(Y);h._captureStackTrace();var o=typeof y==="string"&&this!==$0?this[y]:b,e=Q(h,a);try{o.apply(Y0,J(arguments,e))}catch(w0){h._rejectCallback(K(w0),!0,!0)}if(!h._isFateSealed())h._setAsyncGuaranteed();return h}return I.notEnumerableProp(d,"__isPromisified__",!0),d}var i=z?D:C;function x(b,c,I0,k,p){var a=new RegExp(O(c)+"$"),$0=N(b,c,a,I0);for(var y=0,d=$0.length;y<d;y+=2){var Y0=$0[y],h=$0[y+1],o=Y0+c;if(k===i)b[o]=i(Y0,U,Y0,h,c,p);else{var e=k(h,function(){return i(Y0,U,Y0,h,c,p)});I.notEnumerableProp(e,"__isPromisified__",!0),b[o]=e}}return I.toFastProperties(b),b}function g(b,c,I0){return i(b,c,void 0,b,null,I0)}$.promisify=function(b,c){if(typeof b!=="function")throw new G("expecting a function but got "+I.classString(b));if(w(b))return b;c=Object(c);var I0=c.context===void 0?U:c.context,k=!!c.multiArgs,p=g(b,I0,k);return I.copyDescriptors(b,p,V),p},$.promisifyAll=function(b,c){if(typeof b!=="function"&&typeof b!=="object")throw new G(`the target of promisifyAll must be an object or a function
See http://goo.gl/MqrFmX
`);c=Object(c);var I0=!!c.multiArgs,k=c.suffix;if(typeof k!=="string")k=H;var p=c.filter;if(typeof p!=="function")p=q;var a=c.promisifier;if(typeof a!=="function")a=i;if(!I.isIdentifier(k))throw RangeError(`suffix must be a valid identifier
See http://goo.gl/MqrFmX
`);var $0=I.inheritedDataKeys(b);for(var y=0;y<$0.length;++y){var d=b[$0[y]];if($0[y]!=="constructor"&&I.isClass(d))x(d.prototype,k,p,a,I0),x(d,k,p,a,I0)}return x(b,k,p,a,I0)}}});var ZM0=j((Y14,XM0)=>{XM0.exports=function($,Y,U,I){var Q=M4(),J=Q.isObject,K=eU(),z;if(typeof Map==="function")z=Map;var G=function(){var Z=0,q=0;function V(w,M){this[Z]=w,this[Z+q]=M,Z++}return function(M){q=M.size,Z=0;var F=Array(M.size*2);return M.forEach(V,F),F}}(),H=function(Z){var q=new z,V=Z.length/2|0;for(var w=0;w<V;++w){var M=Z[V+w],F=Z[w];q.set(M,F)}return q};function W(Z){var q=!1,V;if(z!==void 0&&Z instanceof z)V=G(Z),q=!0;else{var w=K.keys(Z),M=w.length;V=Array(M*2);for(var F=0;F<M;++F){var N=w[F];V[F]=Z[N],V[F+M]=N}}this.constructor$(V),this._isMap=q,this._init$(void 0,-3)}Q.inherits(W,Y),W.prototype._init=function(){},W.prototype._promiseFulfilled=function(Z,q){this._values[q]=Z;var V=++this._totalResolved;if(V>=this._length){var w;if(this._isMap)w=H(this._values);else{w={};var M=this.length();for(var F=0,N=this.length();F<N;++F)w[this._values[F+M]]=this._values[F]}return this._resolve(w),!0}return!1},W.prototype.shouldCopyValues=function(){return!1},W.prototype.getActualLength=function(Z){return Z>>1};function X(Z){var q,V=U(Z);if(!J(V))return I(`cannot await properties of a non-object
`);var $0=I.inheritedDataKeys(b);for(var y=0;y<$0.length;++y){var d=b[$0[y]];if($0[y]!=="constructor"&&I.isClass(d))x(d.prototype,k,p,a,I0),x(d,k,p,a,I0)}return x(b,k,p,a,I0)}}});var MM0=j((z14,wM0)=>{wM0.exports=function($,Y,U,I){var Q=O4(),J=Q.isObject,K=QI(),z;if(typeof Map==="function")z=Map;var G=function(){var Z=0,q=0;function V(w,M){this[Z]=w,this[Z+q]=M,Z++}return function(M){q=M.size,Z=0;var F=Array(M.size*2);return M.forEach(V,F),F}}(),H=function(Z){var q=new z,V=Z.length/2|0;for(var w=0;w<V;++w){var M=Z[V+w],F=Z[w];q.set(M,F)}return q};function W(Z){var q=!1,V;if(z!==void 0&&Z instanceof z)V=G(Z),q=!0;else{var w=K.keys(Z),M=w.length;V=Array(M*2);for(var F=0;F<M;++F){var N=w[F];V[F]=Z[N],V[F+M]=N}}this.constructor$(V),this._isMap=q,this._init$(void 0,-3)}Q.inherits(W,Y),W.prototype._init=function(){},W.prototype._promiseFulfilled=function(Z,q){this._values[q]=Z;var V=++this._totalResolved;if(V>=this._length){var w;if(this._isMap)w=H(this._values);else{w={};var M=this.length();for(var F=0,N=this.length();F<N;++F)w[this._values[F+M]]=this._values[F]}return this._resolve(w),!0}return!1},W.prototype.shouldCopyValues=function(){return!1},W.prototype.getActualLength=function(Z){return Z>>1};function X(Z){var q,V=U(Z);if(!J(V))return I(`cannot await properties of a non-object
See http://goo.gl/MqrFmX
`);else if(V instanceof $)q=V._then($.props,void 0,void 0,void 0,void 0);else q=new W(V).promise();if(V instanceof $)q._propagateFrom(V,2);return q}$.prototype.props=function(){return X(this)},$.props=function(Z){return X(Z)}}});var VM0=j((U14,qM0)=>{qM0.exports=function($,Y,U,I){var Q=M4(),J=function(z){return z.then(function(G){return K(G,z)})};function K(z,G){var H=U(z);if(H instanceof $)return J(H);else if(z=Q.asArray(z),z===null)return I("expecting an array or an iterable object but got "+Q.classString(z));var W=new $(Y);if(G!==void 0)W._propagateFrom(G,3);var{_fulfill:X,_reject:Z}=W;for(var q=0,V=z.length;q<V;++q){var w=z[q];if(w===void 0&&!(q in z))continue;$.cast(w)._then(X,Z,void 0,W,null)}return W}$.race=function(z){return K(z,void 0)},$.prototype.race=function(){return K(this,void 0)}}});var FM0=j((I14,LM0)=>{LM0.exports=function($,Y,U,I,Q,J){var K=$._getDomain,z=M4(),G=z.tryCatch;function H(V,w,M,F){this.constructor$(V);var N=K();if(this._fn=N===null?w:z.domainBind(N,w),M!==void 0)M=$.resolve(M),M._attachCancellationCallback(this);if(this._initialValue=M,this._currentCancellable=null,F===Q)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)}z.inherits(H,Y),H.prototype._gotAccum=function(V){if(this._eachValues!==void 0&&this._eachValues!==null&&V!==Q)this._eachValues.push(V)},H.prototype._eachComplete=function(V){if(this._eachValues!==null)this._eachValues.push(V);return this._eachValues},H.prototype._init=function(){},H.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},H.prototype.shouldCopyValues=function(){return!1},H.prototype._resolve=function(V){this._promise._resolveCallback(V),this._values=null},H.prototype._resultCancelled=function(V){if(V===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()},H.prototype._iterate=function(V){this._values=V;var w,M,F=V.length;if(this._initialValue!==void 0)w=this._initialValue,M=0;else w=$.resolve(V[0]),M=1;if(this._currentCancellable=w,!w.isRejected())for(;M<F;++M){var N={accum:null,value:V[M],index:M,length:F,array:this};w=w._then(Z,void 0,void 0,N,void 0)}if(this._eachValues!==void 0)w=w._then(this._eachComplete,void 0,void 0,this,void 0);w._then(W,W,void 0,w,this)},$.prototype.reduce=function(V,w){return X(this,V,w,null)},$.reduce=function(V,w,M,F){return X(V,w,M,F)};function W(V,w){if(this.isFulfilled())w._resolve(V);else w._reject(V)}function X(V,w,M,F){if(typeof w!=="function")return U("expecting a function but got "+z.classString(w));var N=new H(V,w,M,F);return N.promise()}function Z(V){this.accum=V,this.array._gotAccum(V);var w=I(this.value,this.array._promise);if(w instanceof $)return this.array._currentCancellable=w,w._then(q,void 0,void 0,this,void 0);else return q.call(this,w)}function q(V){var w=this.array,M=w._promise,F=G(w._fn);M._pushContext();var N;if(w._eachValues!==void 0)N=F.call(M._boundValue(),V,this.index,this.length);else N=F.call(M._boundValue(),this.accum,V,this.index,this.length);if(N instanceof $)w._currentCancellable=N;var O=M._popContext();return J.checkForgottenReturns(N,O,w._eachValues!==void 0?"Promise.each":"Promise.reduce",M),N}}});var MM0=j((Q14,wM0)=>{wM0.exports=function($,Y,U){var I=$.PromiseInspection,Q=M4();function J(K){this.constructor$(K)}Q.inherits(J,Y),J.prototype._promiseResolved=function(K,z){this._values[K]=z;var G=++this._totalResolved;if(G>=this._length)return this._resolve(this._values),!0;return!1},J.prototype._promiseFulfilled=function(K,z){var G=new I;return G._bitField=33554432,G._settledValueField=K,this._promiseResolved(z,G)},J.prototype._promiseRejected=function(K,z){var G=new I;return G._bitField=16777216,G._settledValueField=K,this._promiseResolved(z,G)},$.settle=function(K){return U.deprecated(".settle()",".reflect()"),new J(K).promise()},$.prototype.settle=function(){return $.settle(this)}}});var NM0=j((J14,OM0)=>{OM0.exports=function($,Y,U){var I=M4(),Q=g3().RangeError,J=g3().AggregateError,K=I.isArray,z={};function G(W){this.constructor$(W),this._howMany=0,this._unwrap=!1,this._initialized=!1}I.inherits(G,Y),G.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()))},G.prototype.init=function(){this._initialized=!0,this._init()},G.prototype.setUnwrap=function(){this._unwrap=!0},G.prototype.howMany=function(){return this._howMany},G.prototype.setHowMany=function(W){this._howMany=W},G.prototype._promiseFulfilled=function(W){if(this._addFulfilled(W),this._fulfilled()===this.howMany()){if(this._values.length=this.howMany(),this.howMany()= Line truncated
`);else if(V instanceof $)q=V._then($.props,void 0,void 0,void 0,void 0);else q=new W(V).promise();if(V instanceof $)q._propagateFrom(V,2);return q}$.prototype.props=function(){return X(this)},$.props=function(Z){return X(Z)}}});var NM0=j((G14,OM0)=>{OM0.exports=function($,Y,U,I){var Q=O4(),J=function(z){return z.then(function(G){return K(G,z)})};function K(z,G){var H=U(z);if(H instanceof $)return J(H);else if(z=Q.asArray(z),z===null)return I("expecting an array or an iterable object but got "+Q.classString(z));var W=new $(Y);if(G!==void 0)W._propagateFrom(G,3);var{_fulfill:X,_reject:Z}=W;for(var q=0,V=z.length;q<V;++q){var w=z[q];if(w===void 0&&!(q in z))continue;$.cast(w)._then(X,Z,void 0,W,null)}return W}$.race=function(z){return K(z,void 0)},$.prototype.race=function(){return K(this,void 0)}}});var BM0=j((H14,DM0)=>{DM0.exports=function($,Y,U,I,Q,J){var K=$._getDomain,z=O4(),G=z.tryCatch;function H(V,w,M,F){this.constructor$(V);var N=K();if(this._fn=N===null?w:z.domainBind(N,w),M!==void 0)M=$.resolve(M),M._attachCancellationCallback(this);if(this._initialValue=M,this._currentCancellable=null,F===Q)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)}z.inherits(H,Y),H.prototype._gotAccum=function(V){if(this._eachValues!==void 0&&this._eachValues!==null&&V!==Q)this._eachValues.push(V)},H.prototype._eachComplete=function(V){if(this._eachValues!==null)this._eachValues.push(V);return this._eachValues},H.prototype._init=function(){},H.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==void 0?this._eachValues:this._initialValue)},H.prototype.shouldCopyValues=function(){return!1},H.prototype._resolve=function(V){this._promise._resolveCallback(V),this._values=null},H.prototype._resultCancelled=function(V){if(V===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()},H.prototype._iterate=function(V){this._values=V;var w,M,F=V.length;if(this._initialValue!==void 0)w=this._initialValue,M=0;else w=$.resolve(V[0]),M=1;if(this._currentCancellable=w,!w.isRejected())for(;M<F;++M){var N={accum:null,value:V[M],index:M,length:F,array:this};w=w._then(Z,void 0,void 0,N,void 0)}if(this._eachValues!==void 0)w=w._then(this._eachComplete,void 0,void 0,this,void 0);w._then(W,W,void 0,w,this)},$.prototype.reduce=function(V,w){return X(this,V,w,null)},$.reduce=function(V,w,M,F){return X(V,w,M,F)};function W(V,w){if(this.isFulfilled())w._resolve(V);else w._reject(V)}function X(V,w,M,F){if(typeof w!=="function")return U("expecting a function but got "+z.classString(w));var N=new H(V,w,M,F);return N.promise()}function Z(V){this.accum=V,this.array._gotAccum(V);var w=I(this.value,this.array._promise);if(w instanceof $)return this.array._currentCancellable=w,w._then(q,void 0,void 0,this,void 0);else return q.call(this,w)}function q(V){var w=this.array,M=w._promise,F=G(w._fn);M._pushContext();var N;if(w._eachValues!==void 0)N=F.call(M._boundValue(),V,this.index,this.length);else N=F.call(M._boundValue(),this.accum,V,this.index,this.length);if(N instanceof $)w._currentCancellable=N;var O=M._popContext();return J.checkForgottenReturns(N,O,w._eachValues!==void 0?"Promise.each":"Promise.reduce",M),N}}});var PM0=j((W14,AM0)=>{AM0.exports=function($,Y,U){var I=$.PromiseInspection,Q=O4();function J(K){this.constructor$(K)}Q.inherits(J,Y),J.prototype._promiseResolved=function(K,z){this._values[K]=z;var G=++this._totalResolved;if(G>=this._length)return this._resolve(this._values),!0;return!1},J.prototype._promiseFulfilled=function(K,z){var G=new I;return G._bitField=33554432,G._settledValueField=K,this._promiseResolved(z,G)},J.prototype._promiseRejected=function(K,z){var G=new I;return G._bitField=16777216,G._settledValueField=K,this._promiseResolved(z,G)},$.settle=function(K){return U.deprecated(".settle()",".reflect()"),new J(K).promise()},$.prototype.settle=function(){return $.settle(this)}}});var EM0=j((X14,TM0)=>{TM0.exports=function($,Y,U){var I=O4(),Q=y3().RangeError,J=y3().AggregateError,K=I.isArray,z={};function G(W){this.constructor$(W),this._howMany=0,this._unwrap=!1,this._initialized=!1}I.inherits(G,Y),G.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()))},G.prototype.init=function(){this._initialized=!0,this._init()},G.prototype.setUnwrap=function(){this._unwrap=!0},G.prototype.howMany=function(){return this._howMany},G.prototype.setHowMany=function(W){this._howMany=W},G.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 Z=new G(W),q=Z.promise();return Z.setHowMany(X),Z.init(),q}$.some=function(W,X){return H(W,X)},$.prototype.some=function(W){return H(this,W)},$._SomePromiseArray=G}});var BM0=j((K14,DM0)=>{DM0.exports=function($,Y){var U=$.map;$.prototype.filter=function(I,Q){return U(this,I,Q,Y)},$.filter=function(I,Q,J){return U(I,Q,J,Y)}}});var PM0=j((z14,AM0)=>{AM0.exports=function($,Y){var{reduce:U,all:I}=$;function Q(){return I(this)}function J(K,z){return U(K,z,Y,Y)}$.prototype.each=function(K){return U(this,K,Y,0)._then(Q,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(K){return U(this,K,Y,Y)},$.each=function(K,z){return U(K,z,Y,0)._then(Q,void 0,void 0,K,void 0)},$.mapSeries=J}});var EM0=j((G14,TM0)=>{TM0.exports=function($){var Y=$._SomePromiseArray;function U(I){var Q=new Y(I),J=Q.promise();return Q.setHowMany(1),Q.setUnwrap(),Q.init(),J}$.any=function(I){return U(I)},$.prototype.any=function(){return U(this)}}});var jM0=j((H14,bc)=>{bc.exports=function(){var $=function(){return new X(`circular promise resolution chain
`);var Z=new G(W),q=Z.promise();return Z.setHowMany(X),Z.init(),q}$.some=function(W,X){return H(W,X)},$.prototype.some=function(W){return H(this,W)},$._SomePromiseArray=G}});var CM0=j((Z14,jM0)=>{jM0.exports=function($,Y){var U=$.map;$.prototype.filter=function(I,Q){return U(this,I,Q,Y)},$.filter=function(I,Q,J){return U(I,Q,J,Y)}}});var _M0=j((q14,RM0)=>{RM0.exports=function($,Y){var{reduce:U,all:I}=$;function Q(){return I(this)}function J(K,z){return U(K,z,Y,Y)}$.prototype.each=function(K){return U(this,K,Y,0)._then(Q,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(K){return U(this,K,Y,Y)},$.each=function(K,z){return U(K,z,Y,0)._then(Q,void 0,void 0,K,void 0)},$.mapSeries=J}});var SM0=j((V14,vM0)=>{vM0.exports=function($){var Y=$._SomePromiseArray;function U(I){var Q=new Y(I),J=Q.promise();return Q.setHowMany(1),Q.setUnwrap(),Q.init(),J}$.any=function(I){return U(I)},$.prototype.any=function(){return U(this)}}});var hM0=j((L14,dc)=>{dc.exports=function(){var $=function(){return new X(`circular promise resolution chain
See http://goo.gl/MqrFmX
`)},Y=function(){return new g.PromiseInspection(this._target())},U=function(k){return g.reject(new X(k))};function I(){}var Q={},J=M4(),K;if(J.isNode)K=function(){var k=process.domain;if(k===void 0)k=null;return k};else K=function(){return null};J.notEnumerableProp(g,"_getDomain",K);var z=eU(),G=Nw0(),H=new G;z.defineProperty(g,"_async",{value:H});var W=g3(),X=g.TypeError=W.TypeError;g.RangeError=W.RangeError;var Z=g.CancellationError=W.CancellationError;g.TimeoutError=W.TimeoutError,g.OperationalError=W.OperationalError,g.RejectionError=W.OperationalError,g.AggregateError=W.AggregateError;var q=function(){},V={},w={},M=Tw0()(g,q),F=jw0()(g,q,M,U,I),N=Rw0()(g),O=N.create,D=vw0()(g,N),P=D.CapturedTrace,T=hw0()(g,M),B=yw0()(w),E=fc(),C=J.errorObj,i=J.tryCatch;function x(k,p){if(typeof p!=="function")throw new X("expecting a function but got "+J.classString(p));if(k.constructor!==g)throw new X(`the promise constructor cannot be invoked directly
`)},Y=function(){return new g.PromiseInspection(this._target())},U=function(k){return g.reject(new X(k))};function I(){}var Q={},J=O4(),K;if(J.isNode)K=function(){var k=process.domain;if(k===void 0)k=null;return k};else K=function(){return null};J.notEnumerableProp(g,"_getDomain",K);var z=QI(),G=Ew0(),H=new G;z.defineProperty(g,"_async",{value:H});var W=y3(),X=g.TypeError=W.TypeError;g.RangeError=W.RangeError;var Z=g.CancellationError=W.CancellationError;g.TimeoutError=W.TimeoutError,g.OperationalError=W.OperationalError,g.RejectionError=W.OperationalError,g.AggregateError=W.AggregateError;var q=function(){},V={},w={},M=vw0()(g,q),F=hw0()(g,q,M,U,I),N=yw0()(g),O=N.create,D=xw0()(g,N),P=D.CapturedTrace,T=uw0()(g,M),B=iw0()(w),E=cc(),C=J.errorObj,i=J.tryCatch;function x(k,p){if(typeof p!=="function")throw new X("expecting a function but got "+J.classString(p));if(k.constructor!==g)throw new X(`the promise constructor cannot be invoked directly
See http://goo.gl/MqrFmX
`)}function g(k){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,k!==q)x(this,k),this._resolveFromExecutor(k);this._promiseCreated(),this._fireEvent("promiseCreated",this)}g.prototype.toString=function(){return"[object Promise]"},g.prototype.caught=g.prototype.catch=function(k){var p=arguments.length;if(p>1){var a=Array(p-1),$0=0,y;for(y=0;y<p-1;++y){var d=arguments[y];if(J.isObject(d))a[$0++]=d;else return U("expecting an object but got A catch statement predicate "+J.classString(d))}return a.length=$0,k=arguments[y],this.then(void 0,B(a,k,this))}return this.then(void 0,k)},g.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},g.prototype.then=function(k,p){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof p!=="function"){var a=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)a+=", "+J.classString(p);this._warn(a)}return this._then(k,p,void 0,void 0,void 0)},g.prototype.done=function(k,p){var a=this._then(k,p,void 0,void 0,void 0);a._setIsFinal()},g.prototype.spread=function(k){if(typeof k!=="function")return U("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},g.prototype.toJSON=function(){var k={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())k.fulfillmentValue=this.value(),k.isFulfilled=!0;else if(this.isRejected())k.rejectionReason=this.reason(),k.isRejected=!0;return k},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(k){return this.caught(J.originatesFromRejection,k)},g.getNewLibraryCopy=bc.exports,g.is=function(k){return k instanceof g},g.fromNode=g.fromCallback=function(k){var p=new g(q);p._captureStackTrace();var a=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=i(k)(E(p,a));if($0===C)p._rejectCallback($0.e,!0);if(!p._isFateSealed())p._setAsyncGuaranteed();return p},g.all=function(k){return new F(k).promise()},g.cast=function(k){var p=M(k);if(!(p instanceof g))p=new g(q),p._captureStackTrace(),p._setFulfilled(),p._rejectionHandler0=k;return p},g.resolve=g.fulfilled=g.cast,g.reject=g.rejected=function(k){var p=new g(q);return p._captureStackTrace(),p._rejectCallback(k,!0),p},g.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return H.setScheduler(k)},g.prototype._then=function(k,p,a,$0,y){var d=y!==void 0,Y0=d?y:new g(q),R=this._target(),o=R._bitField;if(!d){if(Y0._propagateFrom(this,3),Y0._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((o&50397184)!==0)$0=this._boundValue();else $0=R===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,Y0)}var e=K();if((o&50397184)!==0){var O0,E0,y0=R._settlePromiseCtx;if((o&33554432)!==0)E0=R._rejectionHandler0,O0=k;else if((o&16777216)!==0)E0=R._fulfillmentHandler0,O0=p,R._unsetRejectionIsUnhandled();else y0=R._settlePromiseLateCancellationObserver,E0=new Z("late cancellation observer"),R._attachExtraTrace(E0),O0=p;H.invoke(y0,R,{handler:e===null?O0:typeof O0==="function"&&J.domainBind(e,O0),promise:Y0,receiver:$0,value:E0})}else R._addCallbacks(k,p,Y0,$0,e);return Y0},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(k){this._bitField=this._bitField&-65536|k&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(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},g.prototype._receiverAt=function(k){var p=k===0?this._receiver0:this[k*4-4+3];if(p===Q)return;else if(p===void 0&&this._isBound())return this._boundValue();return p},g.prototype._promiseAt=function(k){return this[k*4-4+2]},g.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},g.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},g.prototype._boundValue=function(){},g.prototype._migrateCallback0=function(k){var{_bitField:p,_fulfillmentHand Line truncated
`)}function g(k){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,k!==q)x(this,k),this._resolveFromExecutor(k);this._promiseCreated(),this._fireEvent("promiseCreated",this)}g.prototype.toString=function(){return"[object Promise]"},g.prototype.caught=g.prototype.catch=function(k){var p=arguments.length;if(p>1){var a=Array(p-1),$0=0,y;for(y=0;y<p-1;++y){var d=arguments[y];if(J.isObject(d))a[$0++]=d;else return U("expecting an object but got A catch statement predicate "+J.classString(d))}return a.length=$0,k=arguments[y],this.then(void 0,B(a,k,this))}return this.then(void 0,k)},g.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},g.prototype.then=function(k,p){if(D.warnings()&&arguments.length>0&&typeof k!=="function"&&typeof p!=="function"){var a=".then() only accepts functions but was passed: "+J.classString(k);if(arguments.length>1)a+=", "+J.classString(p);this._warn(a)}return this._then(k,p,void 0,void 0,void 0)},g.prototype.done=function(k,p){var a=this._then(k,p,void 0,void 0,void 0);a._setIsFinal()},g.prototype.spread=function(k){if(typeof k!=="function")return U("expecting a function but got "+J.classString(k));return this.all()._then(k,void 0,void 0,V,void 0)},g.prototype.toJSON=function(){var k={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())k.fulfillmentValue=this.value(),k.isFulfilled=!0;else if(this.isRejected())k.rejectionReason=this.reason(),k.isRejected=!0;return k},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(k){return this.caught(J.originatesFromRejection,k)},g.getNewLibraryCopy=dc.exports,g.is=function(k){return k instanceof g},g.fromNode=g.fromCallback=function(k){var p=new g(q);p._captureStackTrace();var a=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,$0=i(k)(E(p,a));if($0===C)p._rejectCallback($0.e,!0);if(!p._isFateSealed())p._setAsyncGuaranteed();return p},g.all=function(k){return new F(k).promise()},g.cast=function(k){var p=M(k);if(!(p instanceof g))p=new g(q),p._captureStackTrace(),p._setFulfilled(),p._rejectionHandler0=k;return p},g.resolve=g.fulfilled=g.cast,g.reject=g.rejected=function(k){var p=new g(q);return p._captureStackTrace(),p._rejectCallback(k,!0),p},g.setScheduler=function(k){if(typeof k!=="function")throw new X("expecting a function but got "+J.classString(k));return H.setScheduler(k)},g.prototype._then=function(k,p,a,$0,y){var d=y!==void 0,Y0=d?y:new g(q),h=this._target(),o=h._bitField;if(!d){if(Y0._propagateFrom(this,3),Y0._captureStackTrace(),$0===void 0&&(this._bitField&2097152)!==0)if((o&50397184)!==0)$0=this._boundValue();else $0=h===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,Y0)}var e=K();if((o&50397184)!==0){var w0,N0,_0=h._settlePromiseCtx;if((o&33554432)!==0)N0=h._rejectionHandler0,w0=k;else if((o&16777216)!==0)N0=h._fulfillmentHandler0,w0=p,h._unsetRejectionIsUnhandled();else _0=h._settlePromiseLateCancellationObserver,N0=new Z("late cancellation observer"),h._attachExtraTrace(N0),w0=p;H.invoke(_0,h,{handler:e===null?w0:typeof w0==="function"&&J.domainBind(e,w0),promise:Y0,receiver:$0,value:N0})}else h._addCallbacks(k,p,Y0,$0,e);return Y0},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(k){this._bitField=this._bitField&-65536|k&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(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},g.prototype._receiverAt=function(k){var p=k===0?this._receiver0:this[k*4-4+3];if(p===Q)return;else if(p===void 0&&this._isBound())return this._boundValue();return p},g.prototype._promiseAt=function(k){return this[k*4-4+2]},g.prototype._fulfillmentHandlerAt=function(k){return this[k*4-4+0]},g.prototype._rejectionHandlerAt=function(k){return this[k*4-4+1]},g.prototype._boundValue=function(){},g.prototype._migrateCallback0=function(k){var{_bitField:p,_fulfillmentHand Line truncated
path = %s
syscall = %s
fstream_type = %s
@@ -295,30 +295,30 @@ fstream_class = %s
fstream_stack =
%s
`,Y||"UNKNOWN",I.stack,I.path,I.syscall,I.fstream_type,I.fstream_path,I.fstream_unc_path,I.fstream_class,I.fstream_stack.join(`
`));else U.emit("warn",I)};x2.prototype.info=function($,Y){this.emit("info",$,Y)};x2.prototype.error=function($,Y,U){var I=KN0($,Y,this);if(U)throw I;else this.emit("error",I)};function KN0($,Y,U){if(!($ instanceof Error))$=Error($);if($.code=$.code||Y,$.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(I){return I.replace(/^ {4}at /,"")}),$}});var NZ=j((u14,GN0)=>{GN0.exports=ZO1;function ZO1($){var Y=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&Y.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var I=0,Q=Y.length;I<Q;I++){U=Y[I];var J=$[U]||$["is"+U];if(typeof J==="function")J=J.call($);if(J)return $[U]=!0,$.type=U,U}return null}});var En=j((b14,HN0)=>{HN0.exports=DZ;var qO1=$$(),VO1=W1(),Tn=GI();VO1(DZ,Tn);function DZ($){var Y=this;if(!(Y instanceof DZ))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);Tn.call(Y,$)}DZ.prototype._stat=function($){var Y=this;qO1.readlink(Y._path,function(U,I){if(U)return Y.error(U);Y.linkpath=Y.props.linkpath=I,Y.emit("linkpath",I),Tn.prototype._stat.call(Y,$)})};DZ.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Cn=j((i14,ZN0)=>{ZN0.exports=E9;var XN0=$$(),LO1=W1(),BZ=K0("path"),jn=GI(),WN0=K0("assert").ok;LO1(E9,jn);function E9($){var Y=this;if(!(Y instanceof E9))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(Y.entries=null,Y._index=-1,Y._paused=!1,Y._length=-1,$.sort)this.sort=$.sort;jn.call(this,$)}E9.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,XN0.readdir($._path,function(Y,U){if(Y)return $.error(Y);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",I);else I();function I(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};E9.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 Y=BZ.resolve($._path,$.entries[$._index]);WN0(Y!==$._path),WN0($.entries[$._index]),$._currentEntry=Y,XN0[$.props.follow?"stat":"lstat"](Y,function(U,I){if(U)return $.error(U);var Q=$._proxy||$;I.path=Y,I.basename=BZ.basename(Y),I.dirname=BZ.dirname(Y);var J=$.getChildProps.call(Q,I);J.path=Y,J.basename=BZ.basename(Y),J.dirname=BZ.dirname(Y);var K=jn(J,I);$._currentEntry=K,K.on("pause",function(H){if(!$._paused&&!K._disowned)$.pause(H)}),K.on("resume",function(H){if($._paused&&!K._disowned)$.resume(H)}),K.on("stat",function(H){if($.emit("_entryStat",K,H),K._aborted)return;if(K._paused)K.once("resume",function(){$.emit("entryStat",K,H)});else $.emit("entryStat",K,H)}),K.on("ready",function H(){if($._paused)return K.pause($),$.once("resume",H);if(K.type==="Socket")$.emit("socket",K);else $.emitEntry(K)});var z=!1;K.on("close",G),K.on("disown",G);function G(){if(z)return;if(z=!0,$.emit("childEnd",K),$.emit("entryEnd",K),$._currentEntry=null,!$._paused)$._read()}K.on("error",function(H){if(K._swallowErrors)$.warn(H),K.emit("end"),K.emit("close");else $.emit("error",H)}),["child","childEnd","warn"].forEach(function(H){K.on(H,$.emit.bind($,H))})})};E9.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};E9.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}};E9.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._currentEntry&&Y._currentEntry.pause)Y._currentEntry.pause($);Y.emit("pause",$)};E9.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y._paused=!1,Y.emit("resume",$),Y._paused)return;if(Y._currentEntry){if(Y._currentEntry.resume)Y._currentEntry.resume($)}else Y._read()};E9.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var Rn=j((c14,FN0)=>{FN0.exports=HI;var FO1=$$(),wO1=W1(),qN0=GI(),VN0={EOF:!0},LN0={CLOSE:!0};wO1(HI,qN0);function HI($){var Y=this;if(!(Y instanceof HI))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);Y._buffer=[],Y._bytesEmitted=0,qN0.call(Y,$)}HI.prototype._getStream=function(){var $=this,Y=$._stream=FO1.createReadStream($._path,$.p Line truncated
`));else U.emit("warn",I)};u2.prototype.info=function($,Y){this.emit("info",$,Y)};u2.prototype.error=function($,Y,U){var I=ZN0($,Y,this);if(U)throw I;else this.emit("error",I)};function ZN0($,Y,U){if(!($ instanceof Error))$=Error($);if($.code=$.code||Y,$.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(I){return I.replace(/^ {4}at /,"")}),$}});var PZ=j((p14,VN0)=>{VN0.exports=FO1;function FO1($){var Y=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&Y.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var I=0,Q=Y.length;I<Q;I++){U=Y[I];var J=$[U]||$["is"+U];if(typeof J==="function")J=J.call($);if(J)return $[U]=!0,$.type=U,U}return null}});var _n=j((m14,LN0)=>{LN0.exports=TZ;var wO1=Y$(),MO1=X1(),Rn=qI();MO1(TZ,Rn);function TZ($){var Y=this;if(!(Y instanceof TZ))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);Rn.call(Y,$)}TZ.prototype._stat=function($){var Y=this;wO1.readlink(Y._path,function(U,I){if(U)return Y.error(U);Y.linkpath=Y.props.linkpath=I,Y.emit("linkpath",I),Rn.prototype._stat.call(Y,$)})};TZ.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Sn=j((l14,MN0)=>{MN0.exports=C9;var wN0=Y$(),OO1=X1(),EZ=K0("path"),vn=qI(),FN0=K0("assert").ok;OO1(C9,vn);function C9($){var Y=this;if(!(Y instanceof C9))throw Error("DirReader must be called as constructor.");if($.type!=="Directory"||!$.Directory)throw Error("Non-directory type "+$.type);if(Y.entries=null,Y._index=-1,Y._paused=!1,Y._length=-1,$.sort)this.sort=$.sort;vn.call(this,$)}C9.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,wN0.readdir($._path,function(Y,U){if(Y)return $.error(Y);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",I);else I();function I(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};C9.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 Y=EZ.resolve($._path,$.entries[$._index]);FN0(Y!==$._path),FN0($.entries[$._index]),$._currentEntry=Y,wN0[$.props.follow?"stat":"lstat"](Y,function(U,I){if(U)return $.error(U);var Q=$._proxy||$;I.path=Y,I.basename=EZ.basename(Y),I.dirname=EZ.dirname(Y);var J=$.getChildProps.call(Q,I);J.path=Y,J.basename=EZ.basename(Y),J.dirname=EZ.dirname(Y);var K=vn(J,I);$._currentEntry=K,K.on("pause",function(H){if(!$._paused&&!K._disowned)$.pause(H)}),K.on("resume",function(H){if($._paused&&!K._disowned)$.resume(H)}),K.on("stat",function(H){if($.emit("_entryStat",K,H),K._aborted)return;if(K._paused)K.once("resume",function(){$.emit("entryStat",K,H)});else $.emit("entryStat",K,H)}),K.on("ready",function H(){if($._paused)return K.pause($),$.once("resume",H);if(K.type==="Socket")$.emit("socket",K);else $.emitEntry(K)});var z=!1;K.on("close",G),K.on("disown",G);function G(){if(z)return;if(z=!0,$.emit("childEnd",K),$.emit("entryEnd",K),$._currentEntry=null,!$._paused)$._read()}K.on("error",function(H){if(K._swallowErrors)$.warn(H),K.emit("end"),K.emit("close");else $.emit("error",H)}),["child","childEnd","warn"].forEach(function(H){K.on(H,$.emit.bind($,H))})})};C9.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};C9.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}};C9.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._currentEntry&&Y._currentEntry.pause)Y._currentEntry.pause($);Y.emit("pause",$)};C9.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y._paused=!1,Y.emit("resume",$),Y._paused)return;if(Y._currentEntry){if(Y._currentEntry.resume)Y._currentEntry.resume($)}else Y._read()};C9.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var hn=j((o14,BN0)=>{BN0.exports=VI;var NO1=Y$(),DO1=X1(),ON0=qI(),NN0={EOF:!0},DN0={CLOSE:!0};DO1(VI,ON0);function VI($){var Y=this;if(!(Y instanceof VI))throw Error("FileReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="File"&&$.File))throw Error("Non-file type "+$.type);Y._buffer=[],Y._bytesEmitted=0,ON0.call(Y,$)}VI.prototype._getStream=function(){var $=this,Y=$._stream=NO1.createReadStream($._path,$.p Line truncated
expect: `+$.props.size+`
actual: `+$._bytesEmitted)}),Y.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(LN0),$._read();else $.emit("close")}),Y.on("error",function(U){$.emit("error",U)}),$._read()};HI.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var Y=$._buffer;for(var U=0,I=Y.length;U<I;U++){var Q=Y[U];if(Q===VN0)$.emit("end");else if(Q===LN0)$.emit("close");else $.emit("data",Q);if($._paused){$._buffer=Y.slice(U);return}}$._buffer.length=0}};HI.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._stream)Y._stream.pause();Y.emit("pause",$)};HI.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y.emit("resume",$),Y._paused=!1,Y._stream)Y._stream.resume();Y._read()}});var ON0=j((n14,MN0)=>{MN0.exports=jA;var MO1=W1(),wN0=GI();MO1(jA,wN0);function jA($){var Y=this;if(!(Y instanceof jA))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);wN0.call(Y,$)}jA.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var vn=j((d14,NN0)=>{NN0.exports=WI;var _n=GI(),OO1=NZ(),NO1=W1(),DO1=$$();NO1(WI,_n);function WI($){var Y=this;if(!(Y instanceof WI))throw Error("ProxyReader must be called as constructor.");Y.props=$,Y._buffer=[],Y.ready=!1,_n.call(Y,$)}WI.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";DO1[U](Y.path,function(I,Q){var J;if(I||!Q)J="File";else J=OO1(Q);Y[J]=!0,Y.type=$.type=J,$._old=Q,$._addProxy(_n(Y,Q))})};WI.prototype._addProxy=function($){var Y=this;if(Y._proxyTarget)return Y.error("proxy already set");Y._proxyTarget=$,$._proxy=Y,["error","data","end","close","linkpath","entry","entryEnd","child","childEnd","warn","stat"].forEach(function(I){$.on(I,Y.emit.bind(Y,I))}),Y.emit("proxy",$),$.on("ready",function(){Y.ready=!0,Y.emit("ready")});var U=Y._buffer;Y._buffer.length=0,U.forEach(function(I){$[I[0]].apply($,I[1])})};WI.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};WI.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var GI=j((p14,AN0)=>{AN0.exports=C5;var BO1=$$(),AO1=K0("stream").Stream,PO1=W1(),Sn=K0("path"),hn=NZ(),CA=C5.hardLinks={},DN0=EA();PO1(C5,DN0);var BN0=En();function C5($,Y){var U=this;if(!(U instanceof C5))return new C5($,Y);if(typeof $==="string")$={path:$};var I,Q;if($.type&&typeof $.type==="function")I=$.type,Q=I;else I=hn($),Q=C5;if(Y&&!I)I=hn(Y),$[I]=!0,$.type=I;switch(I){case"Directory":Q=Cn();break;case"Link":case"File":Q=Rn();break;case"SymbolicLink":Q=BN0;break;case"Socket":Q=ON0();break;case null:Q=vn();break}if(!(U instanceof Q))return new Q($);if(DN0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=I,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=Sn.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=Sn.basename(U.path),U.dirname=$.dirname=Sn.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=TO1;U._stat(Y)}function TO1($,Y){return $===Y?0:$.toLowerCase()>Y.toLowerCase()?1:$.toLowerCase()<Y.toLowerCase()?-1:$>Y?1:-1}C5.prototype._stat=function($){var Y=this,U=Y.props,I=U.follow?"stat":"lstat";if($)process.nextTick(Q.bind(null,null,$));else BO1[I](Y._path,Q);function Q(J,K){if(J)return Y.error(J);if(Object.keys(K).forEach(function(q){U[q]=K[q]}),Y.size!==void 0&&U.size!==Y.size)return Y.error("incorrect size");Y.size=U.size;var z=hn(U),G=U.hardlinks!==!1;if(G&&z!=="Directory"&&U.nlink&&U.nlink>1){var H=U.dev+":"+U.ino;if(CA[H]===Y._path||!CA[H])CA[H]=Y._path;else z=Y.type=Y.props.type="Link",Y.Link=Y.props.Link=!0,Y.linkpath=Y.props.linkpath=CA[H],Y._stat=Y._read=BN0.prototype._read}if(Y.type&&Y.type!==z)Y.error("Unexpected type: "+z);if(Y.filter){var W=Y._proxy||Y;if(!Y.filter.call(W,W,U)){if(!Y._disowned)Y.abort(),Y.emit("end"),Y.emit("close");return}}var X=["_stat","stat","ready"],Z=0;(function q(){if(Y._aborted){Y.emit("end"),Y.emit("close");return}if(Y._paused&&Y.type!=="Directory"){Y.once("resume",q);return}var V=X[Z++];if(!V)return Y._read();Y.emit(V,U),q()})()}};C5.prototype.pipe=function($){var Y=this;if(typeof $.add==="function")Y.on("entry",function(U){var I=$.add(U);if(I===!1)Y.pause()});return AO1.prototype.pipe.apply(this,arguments)};C5.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};C5.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};C5.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var xn=j((m14,vN0)=> Line truncated
actual: `+$._bytesEmitted)}),Y.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(DN0),$._read();else $.emit("close")}),Y.on("error",function(U){$.emit("error",U)}),$._read()};VI.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var Y=$._buffer;for(var U=0,I=Y.length;U<I;U++){var Q=Y[U];if(Q===NN0)$.emit("end");else if(Q===DN0)$.emit("close");else $.emit("data",Q);if($._paused){$._buffer=Y.slice(U);return}}$._buffer.length=0}};VI.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._stream)Y._stream.pause();Y.emit("pause",$)};VI.prototype.resume=function($){var Y=this;if(!Y._paused)return;if($=$||Y,Y.emit("resume",$),Y._paused=!1,Y._stream)Y._stream.resume();Y._read()}});var TN0=j((r14,PN0)=>{PN0.exports=_A;var BO1=X1(),AN0=qI();BO1(_A,AN0);function _A($){var Y=this;if(!(Y instanceof _A))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);AN0.call(Y,$)}_A.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var yn=j((s14,EN0)=>{EN0.exports=LI;var gn=qI(),AO1=PZ(),PO1=X1(),TO1=Y$();PO1(LI,gn);function LI($){var Y=this;if(!(Y instanceof LI))throw Error("ProxyReader must be called as constructor.");Y.props=$,Y._buffer=[],Y.ready=!1,gn.call(Y,$)}LI.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";TO1[U](Y.path,function(I,Q){var J;if(I||!Q)J="File";else J=AO1(Q);Y[J]=!0,Y.type=$.type=J,$._old=Q,$._addProxy(gn(Y,Q))})};LI.prototype._addProxy=function($){var Y=this;if(Y._proxyTarget)return Y.error("proxy already set");Y._proxyTarget=$,$._proxy=Y,["error","data","end","close","linkpath","entry","entryEnd","child","childEnd","warn","stat"].forEach(function(I){$.on(I,Y.emit.bind(Y,I))}),Y.emit("proxy",$),$.on("ready",function(){Y.ready=!0,Y.emit("ready")});var U=Y._buffer;Y._buffer.length=0,U.forEach(function(I){$[I[0]].apply($,I[1])})};LI.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};LI.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var qI=j((a14,RN0)=>{RN0.exports=_5;var EO1=Y$(),jO1=K0("stream").Stream,CO1=X1(),kn=K0("path"),xn=PZ(),vA=_5.hardLinks={},jN0=RA();CO1(_5,jN0);var CN0=_n();function _5($,Y){var U=this;if(!(U instanceof _5))return new _5($,Y);if(typeof $==="string")$={path:$};var I,Q;if($.type&&typeof $.type==="function")I=$.type,Q=I;else I=xn($),Q=_5;if(Y&&!I)I=xn(Y),$[I]=!0,$.type=I;switch(I){case"Directory":Q=Sn();break;case"Link":case"File":Q=hn();break;case"SymbolicLink":Q=CN0;break;case"Socket":Q=TN0();break;case null:Q=yn();break}if(!(U instanceof Q))return new Q($);if(jN0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=I,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=kn.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=kn.basename(U.path),U.dirname=$.dirname=kn.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=RO1;U._stat(Y)}function RO1($,Y){return $===Y?0:$.toLowerCase()>Y.toLowerCase()?1:$.toLowerCase()<Y.toLowerCase()?-1:$>Y?1:-1}_5.prototype._stat=function($){var Y=this,U=Y.props,I=U.follow?"stat":"lstat";if($)process.nextTick(Q.bind(null,null,$));else EO1[I](Y._path,Q);function Q(J,K){if(J)return Y.error(J);if(Object.keys(K).forEach(function(q){U[q]=K[q]}),Y.size!==void 0&&U.size!==Y.size)return Y.error("incorrect size");Y.size=U.size;var z=xn(U),G=U.hardlinks!==!1;if(G&&z!=="Directory"&&U.nlink&&U.nlink>1){var H=U.dev+":"+U.ino;if(vA[H]===Y._path||!vA[H])vA[H]=Y._path;else z=Y.type=Y.props.type="Link",Y.Link=Y.props.Link=!0,Y.linkpath=Y.props.linkpath=vA[H],Y._stat=Y._read=CN0.prototype._read}if(Y.type&&Y.type!==z)Y.error("Unexpected type: "+z);if(Y.filter){var W=Y._proxy||Y;if(!Y.filter.call(W,W,U)){if(!Y._disowned)Y.abort(),Y.emit("end"),Y.emit("close");return}}var X=["_stat","stat","ready"],Z=0;(function q(){if(Y._aborted){Y.emit("end"),Y.emit("close");return}if(Y._paused&&Y.type!=="Directory"){Y.once("resume",q);return}var V=X[Z++];if(!V)return Y._read();Y.emit(V,U),q()})()}};_5.prototype.pipe=function($){var Y=this;if(typeof $.add==="function")Y.on("entry",function(U){var I=$.add(U);if(I===!1)Y.pause()});return jO1.prototype.pipe.apply(this,arguments)};_5.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};_5.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};_5.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var cn=j((t14,xN0)=> Line truncated
expect: `+$.size+`
actual: `+$._bytesWritten);uA.prototype._finish.call($)}});var rn=j((W44,ND0)=>{ND0.exports=c2;var on=aK(),tO1=NZ(),eO1=W1(),$N1=xA(),YN1=K0("fs");eO1(c2,on);function c2($){var Y=this;if(!(Y instanceof c2))throw Error("ProxyWriter must be called as constructor.");Y.props=$,Y._needDrain=!1,on.call(Y,$)}c2.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";YN1[U](Y.path,function(I,Q){var J;if(I||!Q)J="File";else J=tO1(Q);Y[J]=!0,Y.type=$.type=J,$._old=Q,$._addProxy(on(Y,Q))})};c2.prototype._addProxy=function($){var Y=this;if(Y._proxy)return Y.error("proxy already set");Y._proxy=$,["ready","error","close","pipe","drain","warn"].forEach(function(I){$.on(I,Y.emit.bind(Y,I))}),Y.emit("proxy",$);var U=Y._buffer;if(U.forEach(function(I){$[I[0]].apply($,I[1])}),Y._buffer.length=0,Y._needsDrain)Y.emit("drain")};c2.prototype.add=function($){if($N1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};c2.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};c2.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var aK=j((X44,RD0)=>{RD0.exports=m$;var p$=$$(),UN1=W1(),IN1=xn(),QN1=nn(),EZ=K0("path"),BD0=process.platform==="win32"?0:process.umask(),AD0=NZ(),PD0=EA();UN1(m$,PD0);m$.dirmode=parseInt("0777",8)&~BD0;m$.filemode=parseInt("0666",8)&~BD0;var JN1=pn(),KN1=mn(),zN1=ln(),GN1=rn();function m$($,Y){var U=this;if(typeof $==="string")$={path:$};var I=AD0($),Q=m$;switch(I){case"Directory":Q=JN1;break;case"File":Q=zN1;break;case"Link":case"SymbolicLink":Q=KN1;break;case null:default:Q=GN1;break}if(!(U instanceof Q))return new Q($);if(PD0.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=EZ.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=EZ.basename($.path),U.dirname=EZ.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(Y)}m$.prototype._create=function(){var $=this;p$[$.props.follow?"stat":"lstat"]($._path,function(Y){if(Y)return $.warn("Cannot create "+$._path+`
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};m$.prototype._stat=function($){var Y=this,U=Y.props,I=U.follow?"stat":"lstat",Q=Y._proxy||Y;if($)J(null,$);else p$[I](Y._path,J);function J(K,z){if(Y.filter&&!Y.filter.call(Q,Q,z)){Y._aborted=!0,Y.emit("end"),Y.emit("close");return}if(K||!z)return sn(Y);Y._old=z;var G=AD0(z);if(G!==Y.type||Y.type==="File"&&z.nlink>1)return IN1(Y._path,function(H){if(H)return Y.error(H);Y._old=null,sn(Y)});sn(Y)}};function sn($){QN1(EZ.dirname($._path),m$.dirmode,function(Y,U){if(Y)return $.error(Y);return $._madeDir=U,$._create()})}function TD0($,Y,U,I,Q){var J=Y.mode,K=Y.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!p$[K])return Q();if(typeof J!=="number")return Q();var z=U.mode&parseInt("0777",8);if(J=J&parseInt("0777",8),J===z)return Q();p$[K](I,J,Q)}function ED0($,Y,U,I,Q){if(process.platform==="win32")return Q();if(!process.getuid||process.getuid()!==0)return Q();if(typeof Y.uid!=="number"&&typeof Y.gid!=="number")return Q();if(U.uid===Y.uid&&U.gid===Y.gid)return Q();var J=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!p$[J])return Q();if(typeof Y.uid!=="number")Y.uid=U.uid;if(typeof Y.gid!=="number")Y.gid=U.gid;p$[J](I,Y.uid,Y.gid,Q)}function jD0($,Y,U,I,Q){if(!p$.utimes||process.platform==="win32")return Q();var J=Y.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(J==="lutimes"&&!p$[J])J="utimes";if(!p$[J])return Q();var{atime:K,mtime:z}=U,G=Y.atime,H=Y.mtime;if(G===void 0)G=K;if(H===void 0)H=z;if(!DD0(G))G=new Date(G);if(!DD0(H))G=new Date(H);if(G.getTime()===K.getTime()&&H.getTime()===z.getTime())return Q();p$[J](I,G,H,Q)}m$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var Y=0,U=null,I=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),J($._old);else{var Q=$.props.follow?"stat":"lstat";p$[Q]($._path,function(z,G){if(z)if(z.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(z);J($._old=G)})}return;function J(z){Y+=3,TD0($,$.props,z,$._path,K("chmod")),ED0($,$.props,z,$._path,K("chown")),jD0($,$.props,z,$._path,K("utimes"))}function K(z){return function(G){if(U)return;if(G)return G.fstream_finish_call=z,$.error(U=G);if(--Y>0)return;if(I)return;if(I=!0,!$._madeDir)return H();else CD0($,$._path,H);function H(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function CD0($,Y,U){var I=$._madeDir,Q=EZ.dirname(Y);HN1($,Q,function(J){if(J)return U(J);if(Q===I)return U();CD0($,Q,U)})}function HN1($,Y,U){var I={};Object.keys($.props).forEach(function(z){if(I[z]=$.props[z],z==="mode"&&$.type!=="Directory")I[z]=I[z]|parseInt("0111",8)});var Q=3,J=null;p$.stat(Y,function(z,G){if(z)return U(J=z);TD0($,I,G,Y,K),ED0($,I,G,Y,K),jD0($,I,G,Y,K)});function K(z){if(J)return;if(z)return U(J=z);if(--Q===0)return U()}}m$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};m$.prototype.add=function(){this.error("Can't add to non-Directory type")};m$.prototype.write=function(){return!0};function WN1($){return Object.prototype.toString.call($)}function DD0($){return typeof $==="object"&&WN1($)==="[object Date]"}});var Yd=j((XN1)=>{XN1.Abstract=EA();XN1.Reader=GI();XN1.Writer=aK();XN1.File={Reader:Rn(),Writer:ln()};XN1.Dir={Reader:Cn(),Writer:pn()};XN1.Link={Reader:En(),Writer:mn()};XN1.Proxy={Reader:vn(),Writer:rn()};XN1.Reader.Dir=XN1.DirReader=XN1.Dir.Reader;XN1.Reader.File=XN1.FileReader=XN1.File.Reader;XN1.Reader.Link=XN1.LinkReader=XN1.Link.Reader;XN1.Reader.Proxy=XN1.ProxyReader=XN1.Proxy.Reader;XN1.Writer.Dir=XN1.DirWriter=XN1.Dir.Writer;XN1.Writer.File=XN1.FileWriter=XN1.File.Writer;XN1.Writer.Link=XN1.LinkWriter=XN1.Link.Writer;XN1.Writer.Proxy=XN1.ProxyWriter=XN1.Proxy.Writer;XN1.collect=xA()});var vD0=j((D44,_D0)=>{_D0.exports=ON1;var VN1=wA(),LN1=Yd().Writer,Ud=K0("path"),FN1=K0("stream"),wN1=An(),MN1=y2();function ON1($){$.path=Ud.resolve(Ud.normalize($.path));var Y=new VN1($),U=new FN1.Writable({objectMode:!0});U._write=function(Q,J,K){if(Q.type=="Directory")return K();var z=Ud.join($.path,Q.path);if(z.indexOf($.path)!=0)return K();let G=$.getWriter?$.getWriter({path:z}):LN1({path:z});Q.pipe(G).on("error",K).on("close",K)};var I=wN1(Y,U);return Y.once("crx-header",function(Q){I.crxHeader=Q}),Y.pipe(U).on("finish",function(){I.emit("close")}),I.promise=function(){return new MN1(function(Q,J){I.on("close",Q),I.on("error",J)})},I}});var SD0=j((B44,bA)=>{var R6=function($){var Y=1e7,U=7,I=9007199254740992,Q=Z(I),J="0123456789abcdefghijklmnopqrstuvwxyz",K=typeof BigInt==="function";function z(A,S,u,s){if(typeof A>"u")return z[0];if(typeof S<"u")return+S===10&&!u?D0(A):u0(A,S,u,s);return D0(A)}function G(A,S){this.value=A,this.sign=S,this.isSmall=!1}G.prototype=Object.create(z.prototype);function H(A){this.value=A,this.sign=A<0,this.isSmall=!0}H.prototype=Object.create(z.prototype);function W(A){ Line truncated
actual: `+$._bytesWritten);cA.prototype._finish.call($)}});var en=j((F44,ED0)=>{ED0.exports=d2;var tn=Yz(),UN1=PZ(),IN1=X1(),QN1=bA(),JN1=K0("fs");IN1(d2,tn);function d2($){var Y=this;if(!(Y instanceof d2))throw Error("ProxyWriter must be called as constructor.");Y.props=$,Y._needDrain=!1,tn.call(Y,$)}d2.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";JN1[U](Y.path,function(I,Q){var J;if(I||!Q)J="File";else J=UN1(Q);Y[J]=!0,Y.type=$.type=J,$._old=Q,$._addProxy(tn(Y,Q))})};d2.prototype._addProxy=function($){var Y=this;if(Y._proxy)return Y.error("proxy already set");Y._proxy=$,["ready","error","close","pipe","drain","warn"].forEach(function(I){$.on(I,Y.emit.bind(Y,I))}),Y.emit("proxy",$);var U=Y._buffer;if(U.forEach(function(I){$[I[0]].apply($,I[1])}),Y._buffer.length=0,Y._needsDrain)Y.emit("drain")};d2.prototype.add=function($){if(QN1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};d2.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};d2.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var Yz=j((w44,yD0)=>{yD0.exports=l$;var m$=Y$(),KN1=X1(),zN1=cn(),GN1=ln(),_Z=K0("path"),CD0=process.platform==="win32"?0:process.umask(),RD0=PZ(),_D0=RA();KN1(l$,_D0);l$.dirmode=parseInt("0777",8)&~CD0;l$.filemode=parseInt("0666",8)&~CD0;var HN1=rn(),WN1=sn(),XN1=an(),ZN1=en();function l$($,Y){var U=this;if(typeof $==="string")$={path:$};var I=RD0($),Q=l$;switch(I){case"Directory":Q=HN1;break;case"File":Q=XN1;break;case"Link":case"SymbolicLink":Q=WN1;break;case null:default:Q=ZN1;break}if(!(U instanceof Q))return new Q($);if(_D0.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=_Z.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=_Z.basename($.path),U.dirname=_Z.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(Y)}l$.prototype._create=function(){var $=this;m$[$.props.follow?"stat":"lstat"]($._path,function(Y){if(Y)return $.warn("Cannot create "+$._path+`
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};l$.prototype._stat=function($){var Y=this,U=Y.props,I=U.follow?"stat":"lstat",Q=Y._proxy||Y;if($)J(null,$);else m$[I](Y._path,J);function J(K,z){if(Y.filter&&!Y.filter.call(Q,Q,z)){Y._aborted=!0,Y.emit("end"),Y.emit("close");return}if(K||!z)return $d(Y);Y._old=z;var G=RD0(z);if(G!==Y.type||Y.type==="File"&&z.nlink>1)return zN1(Y._path,function(H){if(H)return Y.error(H);Y._old=null,$d(Y)});$d(Y)}};function $d($){GN1(_Z.dirname($._path),l$.dirmode,function(Y,U){if(Y)return $.error(Y);return $._madeDir=U,$._create()})}function vD0($,Y,U,I,Q){var J=Y.mode,K=Y.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!m$[K])return Q();if(typeof J!=="number")return Q();var z=U.mode&parseInt("0777",8);if(J=J&parseInt("0777",8),J===z)return Q();m$[K](I,J,Q)}function SD0($,Y,U,I,Q){if(process.platform==="win32")return Q();if(!process.getuid||process.getuid()!==0)return Q();if(typeof Y.uid!=="number"&&typeof Y.gid!=="number")return Q();if(U.uid===Y.uid&&U.gid===Y.gid)return Q();var J=$.props.follow||$.type!=="SymbolicLink"?"chown":"lchown";if(!m$[J])return Q();if(typeof Y.uid!=="number")Y.uid=U.uid;if(typeof Y.gid!=="number")Y.gid=U.gid;m$[J](I,Y.uid,Y.gid,Q)}function hD0($,Y,U,I,Q){if(!m$.utimes||process.platform==="win32")return Q();var J=Y.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(J==="lutimes"&&!m$[J])J="utimes";if(!m$[J])return Q();var{atime:K,mtime:z}=U,G=Y.atime,H=Y.mtime;if(G===void 0)G=K;if(H===void 0)H=z;if(!jD0(G))G=new Date(G);if(!jD0(H))G=new Date(H);if(G.getTime()===K.getTime()&&H.getTime()===z.getTime())return Q();m$[J](I,G,H,Q)}l$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var Y=0,U=null,I=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),J($._old);else{var Q=$.props.follow?"stat":"lstat";m$[Q]($._path,function(z,G){if(z)if(z.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(z);J($._old=G)})}return;function J(z){Y+=3,vD0($,$.props,z,$._path,K("chmod")),SD0($,$.props,z,$._path,K("chown")),hD0($,$.props,z,$._path,K("utimes"))}function K(z){return function(G){if(U)return;if(G)return G.fstream_finish_call=z,$.error(U=G);if(--Y>0)return;if(I)return;if(I=!0,!$._madeDir)return H();else gD0($,$._path,H);function H(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function gD0($,Y,U){var I=$._madeDir,Q=_Z.dirname(Y);qN1($,Q,function(J){if(J)return U(J);if(Q===I)return U();gD0($,Q,U)})}function qN1($,Y,U){var I={};Object.keys($.props).forEach(function(z){if(I[z]=$.props[z],z==="mode"&&$.type!=="Directory")I[z]=I[z]|parseInt("0111",8)});var Q=3,J=null;m$.stat(Y,function(z,G){if(z)return U(J=z);vD0($,I,G,Y,K),SD0($,I,G,Y,K),hD0($,I,G,Y,K)});function K(z){if(J)return;if(z)return U(J=z);if(--Q===0)return U()}}l$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};l$.prototype.add=function(){this.error("Can't add to non-Directory type")};l$.prototype.write=function(){return!0};function VN1($){return Object.prototype.toString.call($)}function jD0($){return typeof $==="object"&&VN1($)==="[object Date]"}});var Jd=j((LN1)=>{LN1.Abstract=RA();LN1.Reader=qI();LN1.Writer=Yz();LN1.File={Reader:hn(),Writer:an()};LN1.Dir={Reader:Sn(),Writer:rn()};LN1.Link={Reader:_n(),Writer:sn()};LN1.Proxy={Reader:yn(),Writer:en()};LN1.Reader.Dir=LN1.DirReader=LN1.Dir.Reader;LN1.Reader.File=LN1.FileReader=LN1.File.Reader;LN1.Reader.Link=LN1.LinkReader=LN1.Link.Reader;LN1.Reader.Proxy=LN1.ProxyReader=LN1.Proxy.Reader;LN1.Writer.Dir=LN1.DirWriter=LN1.Dir.Writer;LN1.Writer.File=LN1.FileWriter=LN1.File.Writer;LN1.Writer.Link=LN1.LinkWriter=LN1.Link.Writer;LN1.Writer.Proxy=LN1.ProxyWriter=LN1.Proxy.Writer;LN1.collect=bA()});var xD0=j((j44,kD0)=>{kD0.exports=AN1;var MN1=NA(),ON1=Jd().Writer,Kd=K0("path"),NN1=K0("stream"),DN1=jn(),BN1=x2();function AN1($){$.path=Kd.resolve(Kd.normalize($.path));var Y=new MN1($),U=new NN1.Writable({objectMode:!0});U._write=function(Q,J,K){if(Q.type=="Directory")return K();var z=Kd.join($.path,Q.path);if(z.indexOf($.path)!=0)return K();let G=$.getWriter?$.getWriter({path:z}):ON1({path:z});Q.pipe(G).on("error",K).on("close",K)};var I=DN1(Y,U);return Y.once("crx-header",function(Q){I.crxHeader=Q}),Y.pipe(U).on("finish",function(){I.emit("close")}),I.promise=function(){return new BN1(function(Q,J){I.on("close",Q),I.on("error",J)})},I}});var fD0=j((C44,nA)=>{var v6=function($){var Y=1e7,U=7,I=9007199254740992,Q=Z(I),J="0123456789abcdefghijklmnopqrstuvwxyz",K=typeof BigInt==="function";function z(A,S,u,s){if(typeof A>"u")return z[0];if(typeof S<"u")return+S===10&&!u?B0(A):u0(A,S,u,s);return B0(A)}function G(A,S){this.value=A,this.sign=S,this.isSmall=!1}G.prototype=Object.create(z.prototype);function H(A){this.value=A,this.sign=A<0,this.isSmall=!0}H.prototype=Object.create(z.prototype);function W(A){ Line truncated
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/var F4=K0("fs"),mA=K0("os"),_6=K0("path"),pD0=K0("crypto"),j9={fs:F4.constants,os:mA.constants},rD0=/XXXXXX/,sD0=(j9.O_CREAT||j9.fs.O_CREAT)|(j9.O_EXCL||j9.fs.O_EXCL)|(j9.O_RDWR||j9.fs.O_RDWR),nN1=mA.platform()==="win32",dN1=j9.EBADF||j9.os.errno.EBADF,pN1=j9.ENOENT||j9.os.errno.ENOENT,eK=[],aD0=F4.rmdirSync.bind(F4),tD0=!1;function mN1($,Y){return F4.rm($,{recursive:!0},Y)}function eD0($){return F4.rmSync($,{recursive:!0})}function zd($,Y){let U=$z($,Y),I=U[0],Q=U[1];UD1(I,function(J,K){if(J)return Q(J);let z=K.tries;(function G(){try{let H=YB0(K);F4.stat(H,function(W){if(!W){if(z-- >0)return G();return Q(Error("Could not get a unique tmp filename, max tries reached "+H))}Q(null,H)})}catch(H){Q(H)}})()})}function Gd($){let Y=$z($),U=Y[0],I=ID1(U),Q=I.tries;do{let J=YB0(I);try{F4.statSync(J)}catch(K){return J}}while(Q-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function lN1($,Y){let U=$z($,Y),I=U[0],Q=U[1];zd(I,function(K,z){if(K)return Q(K);F4.open(z,sD0,I.mode||384,function(H,W){if(H)return Q(H);if(I.discardDescriptor)return F4.close(W,function(Z){return Q(Z,z,void 0,Jd(z,-1,I,!1))});else{let X=I.discardDescriptor||I.detachDescriptor;Q(null,z,W,Jd(z,X?-1:W,I,!1))}})})}function oN1($){let Y=$z($),U=Y[0],I=U.discardDescriptor||U.detachDescriptor,Q=Gd(U),J=F4.openSync(Q,sD0,U.mode||384);if(U.discardDescriptor)F4.closeSync(J),J=void 0;return{name:Q,fd:J,removeCallback:Jd(Q,I?-1:J,U,!0)}}function rN1($,Y){let U=$z($,Y),I=U[0],Q=U[1];zd(I,function(K,z){if(K)return Q(K);F4.mkdir(z,I.mode||448,function(H){if(H)return Q(H);Q(null,z,$B0(z,I,!1))})})}function sN1($){let Y=$z($),U=Y[0],I=Gd(U);return F4.mkdirSync(I,U.mode||448),{name:I,removeCallback:$B0(I,U,!0)}}function aN1($,Y){let U=function(I){if(I&&!Kd(I))return Y(I);Y()};if(0<=$[0])F4.close($[0],function(){F4.unlink($[1],U)});else F4.unlink($[1],U)}function tN1($){let Y=null;try{if(0<=$[0])F4.closeSync($[0])}catch(U){if(!QD1(U)&&!Kd(U))throw U}finally{try{F4.unlinkSync($[1])}catch(U){if(!Kd(U))Y=U}}if(Y!==null)throw Y}function Jd($,Y,U,I){let Q=pA(tN1,[Y,$],I),J=pA(aN1,[Y,$],I,Q);if(!U.keep)eK.unshift(Q);return I?Q:J}function $B0($,Y,U){let I=Y.unsafeCleanup?mN1:F4.rmdir.bind(F4),Q=Y.unsafeCleanup?eD0:aD0,J=pA(Q,$,U),K=pA(I,$,U,J);if(!Y.keep)eK.unshift(J);return U?J:K}function pA($,Y,U,I){let Q=!1;return function J(K){if(!Q){let z=I||J,G=eK.indexOf(z);if(G>=0)eK.splice(G,1);if(Q=!0,U||$===aD0||$===eD0)return $(Y);else return $(Y,K||function(){})}}}function eN1(){if(!tD0)return;while(eK.length)try{eK[0]()}catch($){}}function mD0($){let Y=[],U=null;try{U=pD0.randomBytes($)}catch(I){U=pD0.pseudoRandomBytes($)}for(let I=0;I<$;I++)Y.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[I]%62]);return Y.join("")}function U$($){return typeof $>"u"}function $z($,Y){if(typeof $==="function")return[{},$];if(U$($))return[{},Y];let U={};for(let I of Object.getOwnPropertyNames($))U[I]=$[I];return[U,Y]}function $D1($,Y,U){let I=_6.isAbsolute($)?$:_6.join(Y,$);F4.stat(I,function(Q){if(Q)F4.realpath(_6.dirname(I),function(J,K){if(J)return U(J);U(null,_6.join(K,_6.basename(I)))});else F4.realpath(I,U)})}function YD1($,Y){let U=_6.isAbsolute($)?$:_6.join(Y,$);try{return F4.statSync(U),F4.realpathSync(U)}catch(I){let Q=F4.realpathSync(_6.dirname(U));return _6.join(Q,_6.basename(U))}}function YB0($){let Y=$.tmpdir;if(!U$($.name))return _6.join(Y,$.dir,$.name);if(!U$($.template))return _6.join(Y,$.dir,$.template).replace(rD0,mD0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",mD0(12),$.postfix?"-"+$.postfix:""].join("");return _6.join(Y,$.dir,U)}function Qd($,Y){if(typeof Y!=="string")throw Error(`${$} option must be a string, got "${typeof Y}".`);if(Y.includes(".."))throw Error("Relative value not allowed");return Y}function UB0($){if(!U$($.name)){let Y=$.name;if(_6.isAbsolute(Y))throw Error(`name option must not contain an absolute path, found "${Y}".`);let U=_6.basename(Y);if(U===".."||U==="."||U!==Y)throw Error(`name option must not contain a path, found "${Y}".`)}if(!U$($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(rD0))throw Error(`Invalid template, found "${$.template}".`)}if(!U$($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=U$($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=U$($.prefix)?"":Qd("prefix",$.prefix),$.postfix=U$($.postfix)?"":Qd("postfix",$.postfix),$.template=U$($.template)?void 0:Qd("template",$.template)}function lD0($,Y,U,I){if(U$(Y))return I(null);$D1(Y,U,function(Q,J){if(Q)return I(Q);let K=_6.relative(U,J);if(K.startsWith("..")||_6.isAbsolute(K))return I(Error(`${$} option must be relative to "${U}", found "${K}".`));I(null,K)})}function oD0($,Y,U){if(U$(Y))return;let I=YD1(Y,U),Q=_6.relative(U,I);if(Q.startsWith("..")||_6.isAbsolute(Q))thrLine truncated
*/var w4=K0("fs"),rA=K0("os"),S6=K0("path"),aD0=K0("crypto"),R9={fs:w4.constants,os:rA.constants},YB0=/XXXXXX/,UB0=(R9.O_CREAT||R9.fs.O_CREAT)|(R9.O_EXCL||R9.fs.O_EXCL)|(R9.O_RDWR||R9.fs.O_RDWR),lN1=rA.platform()==="win32",oN1=R9.EBADF||R9.os.errno.EBADF,rN1=R9.ENOENT||R9.os.errno.ENOENT,Iz=[],IB0=w4.rmdirSync.bind(w4),QB0=!1;function sN1($,Y){return w4.rm($,{recursive:!0},Y)}function JB0($){return w4.rmSync($,{recursive:!0})}function Xd($,Y){let U=Qz($,Y),I=U[0],Q=U[1];KD1(I,function(J,K){if(J)return Q(J);let z=K.tries;(function G(){try{let H=zB0(K);w4.stat(H,function(W){if(!W){if(z-- >0)return G();return Q(Error("Could not get a unique tmp filename, max tries reached "+H))}Q(null,H)})}catch(H){Q(H)}})()})}function Zd($){let Y=Qz($),U=Y[0],I=zD1(U),Q=I.tries;do{let J=zB0(I);try{w4.statSync(J)}catch(K){return J}}while(Q-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function aN1($,Y){let U=Qz($,Y),I=U[0],Q=U[1];Xd(I,function(K,z){if(K)return Q(K);w4.open(z,UB0,I.mode||384,function(H,W){if(H)return Q(H);if(I.discardDescriptor)return w4.close(W,function(Z){return Q(Z,z,void 0,Hd(z,-1,I,!1))});else{let X=I.discardDescriptor||I.detachDescriptor;Q(null,z,W,Hd(z,X?-1:W,I,!1))}})})}function tN1($){let Y=Qz($),U=Y[0],I=U.discardDescriptor||U.detachDescriptor,Q=Zd(U),J=w4.openSync(Q,UB0,U.mode||384);if(U.discardDescriptor)w4.closeSync(J),J=void 0;return{name:Q,fd:J,removeCallback:Hd(Q,I?-1:J,U,!0)}}function eN1($,Y){let U=Qz($,Y),I=U[0],Q=U[1];Xd(I,function(K,z){if(K)return Q(K);w4.mkdir(z,I.mode||448,function(H){if(H)return Q(H);Q(null,z,KB0(z,I,!1))})})}function $D1($){let Y=Qz($),U=Y[0],I=Zd(U);return w4.mkdirSync(I,U.mode||448),{name:I,removeCallback:KB0(I,U,!0)}}function YD1($,Y){let U=function(I){if(I&&!Wd(I))return Y(I);Y()};if(0<=$[0])w4.close($[0],function(){w4.unlink($[1],U)});else w4.unlink($[1],U)}function UD1($){let Y=null;try{if(0<=$[0])w4.closeSync($[0])}catch(U){if(!GD1(U)&&!Wd(U))throw U}finally{try{w4.unlinkSync($[1])}catch(U){if(!Wd(U))Y=U}}if(Y!==null)throw Y}function Hd($,Y,U,I){let Q=oA(UD1,[Y,$],I),J=oA(YD1,[Y,$],I,Q);if(!U.keep)Iz.unshift(Q);return I?Q:J}function KB0($,Y,U){let I=Y.unsafeCleanup?sN1:w4.rmdir.bind(w4),Q=Y.unsafeCleanup?JB0:IB0,J=oA(Q,$,U),K=oA(I,$,U,J);if(!Y.keep)Iz.unshift(J);return U?J:K}function oA($,Y,U,I){let Q=!1;return function J(K){if(!Q){let z=I||J,G=Iz.indexOf(z);if(G>=0)Iz.splice(G,1);if(Q=!0,U||$===IB0||$===JB0)return $(Y);else return $(Y,K||function(){})}}}function ID1(){if(!QB0)return;while(Iz.length)try{Iz[0]()}catch($){}}function tD0($){let Y=[],U=null;try{U=aD0.randomBytes($)}catch(I){U=aD0.pseudoRandomBytes($)}for(let I=0;I<$;I++)Y.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[I]%62]);return Y.join("")}function I$($){return typeof $>"u"}function Qz($,Y){if(typeof $==="function")return[{},$];if(I$($))return[{},Y];let U={};for(let I of Object.getOwnPropertyNames($))U[I]=$[I];return[U,Y]}function QD1($,Y,U){let I=S6.isAbsolute($)?$:S6.join(Y,$);w4.stat(I,function(Q){if(Q)w4.realpath(S6.dirname(I),function(J,K){if(J)return U(J);U(null,S6.join(K,S6.basename(I)))});else w4.realpath(I,U)})}function JD1($,Y){let U=S6.isAbsolute($)?$:S6.join(Y,$);try{return w4.statSync(U),w4.realpathSync(U)}catch(I){let Q=w4.realpathSync(S6.dirname(U));return S6.join(Q,S6.basename(U))}}function zB0($){let Y=$.tmpdir;if(!I$($.name))return S6.join(Y,$.dir,$.name);if(!I$($.template))return S6.join(Y,$.dir,$.template).replace(YB0,tD0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",tD0(12),$.postfix?"-"+$.postfix:""].join("");return S6.join(Y,$.dir,U)}function Gd($,Y){if(typeof Y!=="string")throw Error(`${$} option must be a string, got "${typeof Y}".`);if(Y.includes(".."))throw Error("Relative value not allowed");return Y}function GB0($){if(!I$($.name)){let Y=$.name;if(S6.isAbsolute(Y))throw Error(`name option must not contain an absolute path, found "${Y}".`);let U=S6.basename(Y);if(U===".."||U==="."||U!==Y)throw Error(`name option must not contain a path, found "${Y}".`)}if(!I$($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(YB0))throw Error(`Invalid template, found "${$.template}".`)}if(!I$($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=I$($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=I$($.prefix)?"":Gd("prefix",$.prefix),$.postfix=I$($.postfix)?"":Gd("postfix",$.postfix),$.template=I$($.template)?void 0:Gd("template",$.template)}function eD0($,Y,U,I){if(I$(Y))return I(null);QD1(Y,U,function(Q,J){if(Q)return I(Q);let K=S6.relative(U,J);if(K.startsWith("..")||S6.isAbsolute(K))return I(Error(`${$} option must be relative to "${U}", found "${K}".`));I(null,K)})}function $B0($,Y,U){if(I$(Y))return;let I=JD1(Y,U),Q=S6.relative(U,I);if(Q.startsWith("..")||S6.isAbsolute(Q))thrLine truncated
`)}let I=[];Y.forEach((Q,J)=>{let K=$.length+J+1,z=J===0?"⏳ ":"";I.push(`${z}${K}. ${Q}`)});for(let Q=$.length-1;Q>=0;Q--){let J=Q+1;I.push(`${J}. ${$[Q]}`)}return I.join(`
`)}function Od($,Y,U,I,Q){let J=$?.operator||Y?.operator||U?.operator,K=J?.name||J?.id||U?.operatorName||"",z=($?.nodeName||Y?.fromNodeName||Y?.nodeName||U?.nodeName||"").trim();if(z==="合思审批节点"||z==="外部审批节点"||z.includes("合思审批")||z.includes("外部审批"))z="";if((!z||z==="提交人"||z==="审批节点")&&K&&I){let M=I.find((F)=>F.operator?.name===K&&F.nodeName&&F.nodeName.trim()!=="提交人"&&!F.isEbot&&F.rawAction!=="freeflow.reject");if(M?.nodeName)z=M.nodeName.trim()}let H=$?.comment||Y?.reason||U?.rejectComment||"修改";if(H.includes(":")){let M=H.split(":");if(M.length>1)H=M.slice(1).join(":").trim()}let W=H;if(z&&K)W=`${z}(${K}) ❌: ${H}`;else if(K)W=`${K} ❌: ${H}`;else if(z)W=`${z} ❌: ${H}`;else W=H;let X=$?.rejectTargetNodeName||Y?.targetNodeName||"提交人",Z=$?.rejectTargetOperator?.name||Y?.targetOperator?.name||Q?.submitter?.name,q=Z?`${X}(${Z})`:X,V=$?.resubmitRuleText||Y?.resubmitRuleText||(K?`重新提交后由${K}继续审批`:"重新提交后继续审批");return{comment:`${W}
`)}function Ad($,Y,U,I,Q){let J=$?.operator||Y?.operator||U?.operator,K=J?.name||J?.id||U?.operatorName||"",z=($?.nodeName||Y?.fromNodeName||Y?.nodeName||U?.nodeName||"").trim();if(z==="合思审批节点"||z==="外部审批节点"||z.includes("合思审批")||z.includes("外部审批"))z="";if((!z||z==="提交人"||z==="审批节点")&&K&&I){let M=I.find((F)=>F.operator?.name===K&&F.nodeName&&F.nodeName.trim()!=="提交人"&&!F.isEbot&&F.rawAction!=="freeflow.reject");if(M?.nodeName)z=M.nodeName.trim()}let H=$?.comment||Y?.reason||U?.rejectComment||"修改";if(H.includes(":")){let M=H.split(":");if(M.length>1)H=M.slice(1).join(":").trim()}let W=H;if(z&&K)W=`${z}(${K}) ❌: ${H}`;else if(K)W=`${K} ❌: ${H}`;else if(z)W=`${z} ❌: ${H}`;else W=H;let X=$?.rejectTargetNodeName||Y?.targetNodeName||"提交人",Z=$?.rejectTargetOperator?.name||Y?.targetOperator?.name||Q?.submitter?.name,q=Z?`${X}(${Z})`:X,V=$?.resubmitRuleText||Y?.resubmitRuleText||(K?`重新提交后由${K}继续审批`:"重新提交后继续审批");return{comment:`${W}
↳ 驳回至: ${q}
↳ ${V}`,operator:J}}function uB0($){if(!$)return[];let Y=$.pending||[],U=String($.rawState||"").toUpperCase(),I=String($.state||"").toUpperCase(),Q=[];if(Y.length>0)for(let J of Y){let K=J.approver?.name||J.approver?.id||"待定",z=(J.name||$.currentNode||"").trim(),G=z?`${z}(${K})`:K,W=J.type?.toUpperCase()==="PAYING"||z.includes("支付")||U==="PAYING"||I==="支付中"?"待支付":"待审批";Q.push(`${G}: ${W}`)}else if($.currentNode?.trim()){let K=$.currentNode.includes("支付")||U==="PAYING"||I==="支付中"?"待支付":"待审批";Q.push(`${$.currentNode.trim()}: ${K}`)}return Q}function qI($,Y){let U=new Map;if(!$||$.length===0)return U;if(!Y){for(let q of $){let w=(q.result||{}).decision||q.aiDecision||"-";U.set(q.id,{recordId:q.id,sourceDocumentSN:q.sourceDocumentSN,taskMode:q.taskMode,aiDecision:fB0(typeof w==="string"?w:"-"),aiAction:"-",eHumanAction:"-",eHumanComment:"-",auditDrift:!1})}return U}let I=[...$].sort((q,V)=>(Number(q.createdAt)||0)-(Number(V.createdAt)||0)),Q=Y.history||[],J=String(Y.rawState||"").toUpperCase(),K=String(Y.state||"").toUpperCase(),z=J==="DRAFT"||J==="REVOKED"||J==="CANCELED"||J==="CANCELLED"||K==="草稿"||K==="已撤回"||K==="已取消",G=J==="REJECTED"||J==="TERMINATED"||K==="审批驳回"||K==="已驳回",H=!z&&!G&&(J==="PAID"||K==="已支付"||Q.some((q)=>!q.isEbot&&(q.rawAction==="freeflow.pay"||q.action==="支付成功"||q.action==="支付完成"))),W=!z&&!G&&!H&&(J==="PAYING"||K==="支付中"||(Y.pending||[]).some((q)=>q.isCurrent&&(q.type?.toUpperCase()==="PAYING"||q.name?.includes("支付")))||Y.currentNode?.includes("支付")===!0),Z=H||!z&&!G&&!W&&(J==="COMPLETED"||J==="APPROVED"||K==="已完成"||K==="审批通过");for(let q=0;q<I.length;q++){let V=I[q];if(!V)continue;let w=Number(V.createdAt)||0,M=V.document||{},F=V.manualApprovalRecord||V.result?.manualApprovalRecord||M.manualApprovalRecord||{},N=typeof V.sourceExtendData?.nodeId==="string"?String(V.sourceExtendData.nodeId):void 0,O=typeof F.nodeId==="string"?String(F.nodeId):void 0,D=O?decodeURIComponent(O).replace(/^hcnode_/,"").replace(/_r\d+$/,""):void 0,P=N||D,T=P?Q.find((D0)=>D0.nodeId&&(D0.nodeId===P||P.includes(D0.nodeId))):void 0,B=T?.time??w,E=I[q+1],C=E?Number(E.createdAt)||1/0:1/0,i=q===I.length-1,x=Q.find((D0)=>(D0.time??0)>B+5000&&D0.isEbot&&(D0.nodeName?.includes("智能")||D0.nodeName?.includes("AI")||D0.action?.includes("智能")||D0.comment?.includes("AI")||D0.comment?.includes("approval-result"))&&!D0.nodeName?.includes("费用标准检查")&&!D0.nodeName?.includes("标准检查")&&!D0.nodeName?.includes("预算"));if(x){if(i=!1,(x.time??1/0)<C)C=x.time}let g=V.result||{},b=g.decision||V.aiDecision||"-",c=typeof b==="string"?b:"-",I0=c.toUpperCase(),k=I0==="REJECT"||I0==="驳回",p=I0==="APPROVE"||I0==="通过",a=I0==="EXEMPT_APPROVE"||I0==="免审通过"||I0==="备注通过",$0=V.taskMode||V.finalExecutionMode||"",d=String($0).toLowerCase().includes("auto")||V.finalExecutionMode==="automatic"||$0==="automatic"||$0==="fully_automatic",Y0="-";if(p||a)Y0="添加评论";else if(k)Y0=d?"驳回":"添加评论";else if(I0==="REVIEW"||I0==="转交复核")Y0="转交复核";let R=typeof F.status==="object"&&F.status!==null?String(F.status.type||F.status.label||"").toUpperCase():"",o=typeof F.status==="object"&&F.status!==null?String(F.status.sourceStatus||""):"",e=M.manualApprovalStatus||g.manualApprovalStatus||V.manualApprovalStatus,O0=typeof e==="string"?e.toUpperCase():"",E0=O0==="CANCELLED"||O0==="CANCELED"||O0==="已取消"||O0==="已撤回"||O0==="REVOKED"||R==="CANCELLED"||R==="CANCELED"||o.includes("撤回")||o.includes("取消"),y0=O0==="APPROVED"||O0==="已支付/审批完成"||O0==="已通过"||O0==="已完成"||O0==="已支付"||R==="APPROVED",o0=!(o.includes("补偿")||o.includes("已支付"))&&(O0==="TERMINATED"||O0==="REJECTED"||O0==="REJECT"||O0==="已驳回"||O0==="被驳回"||R==="TERMINATED"||R==="REJECTED"||R==="已驳回"||R==="被驳回"),q1=T?1000:60000,t=Q.filter((D0)=>{let Q0=D0.time??0;return Q0>=B-q1&&Q0<C}),X0="-",F0="-",u0=!1,b0,c0,P1=p||a,k1=Q.filter((D0)=>(D0.time??0)>B+5000),u1=k1.some((D0)=>D0.rawAction==="freeflow.retract"||D0.action==="单据撤回"),b1=k1.some((D0)=>D0.rawAction==="freeflow.submit"||D0.action==="提交送审");if(P1&&i&&(u1||b1))u0=!0,b0="AI通过后单据发生撤回/修改重提,后续未经AI复审";if(d&&k)X0="无操作",F0="-";else{let D0=t.filter((S)=>(S.time??0)>=B-1000&&!S.isEbot&&S.rawAction!=="freeflow.submit"&&S.action!=="提交送审"&&!((S.rawAction==="freeflow.comment"||S.action==="发表评论")&&!S.comment)&&!((S.rawAction==="freeflow.print"||S.action==="打印提醒")&&!S.comment)&&!(S.rawAction==="freeflow.carbonCopy"||S.rawAction==="freeflow.cc"||S.action==="抄送通知")),Q0=D0.find((S)=>S.rawAction==="freeflow.retract"||S.action==="单据撤回"),A=D0.find((S)=>S.rawAction==="freeflow.reject"||S.action==="审批驳回");if(!i)if(A||!Y&&o0){X0="审批驳回",u0=!1,b0=void 0;let S=Od(A,void 0,F,Q,Y);F0=S.comme Line truncated
`,{mode:384}),Y}function _d($){let Y=JA0();for(let U of Y){if(!B$(U))continue;for(let I of JP(U).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=R9(U,I);try{let J=zP(Q,"utf-8"),K=JSON.parse(J);if(K&&typeof K==="object"&&K.id===$)return Q}catch{}}}return}function _9($,Y){let U=_d($);if(!U)throw Error(`Enterprise config not found: ${$}`);let Q={...JSON.parse(zP(U,"utf-8")),...Y};for(let K of Object.keys(Y))if(Y[K]===void 0)delete Q[K];let J=xZ.parse(Q);return eB0(U,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var Rd="SEAL_USE_ENTERPRISES_DIR",$A0="SEAL_HOME_ENTERPRISES_DIR",YA0="SEAL_USE_USER_ENTERPRISES_DIR",UA0="SEAL_HOME_USER_ENTERPRISES_DIR",IA0="SEAL_USE_CONFIG_FILE",QA0="SEAL_HOME_CONFIG_FILE",Qz,KP,QP,aB0;var o$=m(()=>{IP();Qz=R9(GP(),".config","seal-use","enterprises"),KP=R9(GP(),".config","seal-home","enterprises"),QP=R9(GP(),".config","seal-use","config.json"),aB0=R9(GP(),".config","seal-home","config.json")});function p2($,Y,U=[]){let I=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=I??Q;if(J){let z=$.find((W)=>W.id===J);if(z)return z;let G=$.find((W)=>W.id.toLowerCase()===J.toLowerCase());if(G)return G;let H=$.find((W)=>W.name.toLowerCase()===J.toLowerCase());if(H)return H;throw Error(`No enterprise config found for ${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-use 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{existsSync as vd,mkdirSync as xB1,readFileSync as fB1,renameSync as uB1,unlinkSync as bB1,writeFileSync as iB1}from"node:fs";import{homedir as cB1}from"node:os";import{dirname as nB1,join as dB1}from"node:path";function uZ(){let $=process.env[pB1]?.trim();if($)return $;return mB1}function zA0($=new Date){return $.toISOString().slice(0,10)}function GA0($=Sd,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function HA0($=uZ()){if(!vd($))return{};try{let Y=fB1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function lB1($,Y){let U={};for(let[I,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},K=!1;for(let[z,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&z>=Y)J[z]=G,K=!0;if(K)U[I]=J}return U}function oB1($,Y=uZ()){let U=nB1(Y);if(!vd(U))xB1(U,{recursive:!0,mode:448});let I=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{iB1(I,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),uB1(I,Y)}catch(Q){try{if(vd(I))bB1(I)}catch{}throw Q}}function WA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=uZ(),I=HA0(U),Q=zA0(Y),J=GA0(Sd,Y),K=lB1(I,J);K[$]=K[$]||{},K[$][Q]=(K[$][Q]??0)+1,oB1(K,U)}catch{}}function rB1($,Y=Sd,U=new Date){let I=new Map;try{let Q=HA0(),J=GA0(Y,U),K=zA0(U),z=$??Object.keys(Q);for(let G of z){let H=Q[G];if(!H){I.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=K&&typeof Z==="number")W+=Z;I.set(G,W)}}catch{if($)for(let Q of $)I.set(Q,0)}return I}function XA0($,Y,U){let I=U??rB1($.map((Q)=>Q.id));return[...$].sort((Q,J)=>{if(Y){if(Q.id===Y&&J.id!==Y)return-1;if(J.id===Y&&Q.id!==Y)return 1}let K=I.get(Q.id)??0,z=I.get(J.id)??0;if(K!==z)return z-K;let G=Q.name??Q.id,H=J.name??J.id,W=G.localeCompare(H,"zh-CN");if(W!==0)return W;return Q.id.localeCompare(J.id)})}var pB1="SEAL_USE_USAGE_FILE",mB1,Sd=7;var HP=m(()=>{mB1=dB1(cB1(),".config","seal-use","usage.json")});var K8={};Z8(K8,{withApprovalRunFilters:()=>MA1,toDate:()=>pd,timestampOf:()=>yd,summarizeSimulationBatch:()=>IA1,summarizeRunBridge:()=>GA1,summarizeRuleVersion:()=>HA1,summarizeApprovalRuns:()=>QA1,summarizeApprovalRunResult:()=>LP,summarizeApprovalRunDocument:()=>wA0,summarizeApprovalRunDetail:()=>KA1,summarizeApprovalRun:()=>dZ,stringifyHumanResultValue:()=>dd,stringFromUnknown:()=>h4,setPath:()=>MA0,scalarIncludes:()=>ZP,runtimeRuleIndex:()=>cd,runtimeRuleIdToCode:()=>BA0,rulesHaveSameContent:()=>VA0,ruleChangedFields:()=>LA0,resolveSealBaseUrl:()=>VA1,resolveRuleVersionSelector:()=>wA1,resolveRuleVersionForLookup:()=>WA1,resolveRuleVersion:()=>kd,resolveManualApprovalStatus:()=>PA0,resolveApprovalRunForUrl:()=>qA1,redactPreviewValue:()=>iZ,redactIntegrationSecrets:()=>$A1,projectApprovalRules:()=>aB1,presentWebhookIntegration:()=>sB1,prepareApprovalRuns:()=>OA1,pickRunFields:()=>FA0,pickRuleFields:()=>qA0,pickApprovalRuns:()=>FA1,pickApprovalRunCandidate:()=>ZA1,parseFieldPaths:()=>JA1,parseDurationMs:()=>eB1,objectContainsScalar:()=>qP,numberFromUnknown:()=>OA0,normalizeUrl:()=>LA1,normalizeRuleStrictness:()=>bd,normalizeRuleCode:()=>WP,mutationPreview:()=>YA1,matchesRunLookup:()=>DA1,localParts:()=>md,localDateKey:()=>BA1,isHumanResultKey:()=>xd,getPath:()=>v9,getConfiguredSealBaseUrl:()=>ZA0,formatRuleCode:()=>Jz,formatLocalDateTime:()=>ud,flattenDocumentFields:()=>NA0,firstPath:()=>cZ,firstByLabel:()=>bZ,findRuleInVersion:()=>XA1,findKeywordLines:()=>gd,findHumanResultValue:()=>VP,filterRunsByHumanResult:()=>AA0,filterRuns:()=>nd,extractHumanResult:()=>wI,extractCitedRules:()=>zA1,countPathCandidates:()=>hd,countBy:()=>fd,compactObject:()=>FI,collectInvoiceSummary:()=>DA0,collectInvoiceObjects:()=>nZ,collectDocumentFields:()=>XP,buildSimulationBatchParams:()=>UA1,buildRulePushPlan:()=>tB1,asRecord:()=>Kz,approvalRu Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:FI({id:Y?.id,sn:Y?.sn??Y?.sourceDocumentSN??$.sourceDocumentSN,title:Y?.title??Y?.name,template:cZ(Y,["template.name","templateName","form.name","formName","formTitle"]),amount:bZ(U,["金额","报销金额","付款金额","合计","价税合计"])??cZ(Y,["amount","totalAmount","expenseAmount"]),expenseType:bZ(U,["费用类型","费用类别","报销类型"]),costCompany:bZ(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:bZ(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:DA0($),attachments:i3($,{summary:!0}).attachments,aiResult:LP($),manualResult:wI($)?.value,hints:FI({amountMentions:gd(I,["金额","合计","税率"],8),partyMentions:gd(I,["买方","卖方","甲方","乙方","收款"],8)})}}function zA1($){let Y=[["result.citedRules",v9($,"result.citedRules")],["result.matchedRules",v9($,"result.matchedRules")],["result.ruleResults",v9($,"result.ruleResults")],["result.rules",v9($,"result.rules")],["pipelineData.citedRules",v9($,"pipelineData.citedRules")],["pipelineData.matchedRules",v9($,"pipelineData.matchedRules")]],U=[],I=new Set;for(let[Q,J]of Y)(Array.isArray(J)?J:J&&typeof J==="object"?Object.values(J):[]).forEach((z,G)=>{let H=Kz(z);if(!H)return;let W=h4(H.runtimeRuleId)??h4(H.runtimeId)??h4(H.id)??h4(H.ruleId),X=h4(H.ruleCode)??h4(H.code)??(W?BA0(W):void 0),Z=FI({runtimeRuleId:W,ruleCode:X,versionNumber:OA0(H.versionNumber)??$.ruleSetVersionNumber,scope:h4(H.scope),strictness:h4(H.strictness),appliedAnalysis:H.appliedAnalysis??H.analysis??H.reasoning,checkResult:H.checkResult??H.result??H.decision,findings:H.findings??H.riskPoints??H.evidence,sourcePath:`${Q}.${G}`}),q=JSON.stringify(Z);if(!I.has(q))I.add(q),U.push(Z)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function cZ($,Y){if(!$)return;for(let U of Y){let I=v9($,U);if(I!==void 0)return I}return}function hd($,Y){if(!$)return 0;for(let U of Y){let I=v9($,U);if(Array.isArray(I))return I.length;if(I&&typeof I==="object")return Object.keys(I).length;if(typeof I==="number")return I}return 0}function v9($,Y){return Y.split(".").reduce((U,I)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let Q=Number(I);return Number.isInteger(Q)?U[Q]:void 0}if(typeof U==="object")return U[I];return},$)}function MA0($,Y,U){let I=Y.split("."),Q=$;for(let J of I.slice(0,-1)){let K=Q[J];if(!K||typeof K!=="object"||Array.isArray(K))Q[J]={};Q=Q[J]}Q[I[I.length-1]??Y]=U}function FI($){return Object.fromEntries(Object.entries($).filter(([,Y])=>Y!==void 0))}function Kz($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function OA0($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function NA0($){let Y=[];return XP($,"document",Y),Y}function XP($,Y,U){if(Array.isArray($)){$.forEach((K,z)=>XP(K,`${Y}.${z}`,U));return}let I=Kz($);if(!I)return;let Q=h4(I.label)??h4(I.name)??h4(I.title)??h4(I.fieldName),J=I.value??I.displayValue??I.text??I.content;if(Q&&J!==void 0&&typeof J!=="object")U.push(FI({path:Y,label:Q,value:J,type:h4(I.type)??h4(I.fieldType)}));for(let[K,z]of Object.entries(I)){if(K==="attachments")continue;XP(z,`${Y}.${K}`,U)}}function bZ($,Y){return $.find((I)=>{let Q=h4(I.label)??"";return Y.some((J)=>Q.includes(J))})?.value}function DA0($){let Y=[];return nZ($.result,"result",Y),nZ($.document,"document",Y),Y.slice(0,20)}function nZ($,Y,U){if(Array.isArray($)){$.forEach((Q,J)=>nZ(Q,`${Y}.${J}`,U));return}let I=Kz($);if(!I)return;if(/invoice|发票/i.test(Y))U.push(FI({path:Y,fileName:h4(I.fileName)??h4(I.filename)??h4(I.name),buyer:I.buyer??I.buyerName??I.purchaserName,seller:I.seller??I.sellerName,amount:I.amount??I.totalAmount??I.total,taxRate:I.taxRate,category:I.category??I.type}));for(let[Q,J]of Object.entries(I))nZ(J,`${Y}.${Q}`,U)}function gd($,Y,U){return $.split(/\r?\n/).filter((I)=>Y.some((Q)=>I.includes(Q))).slice(0,U)}function GA1($){return $.map((Y)=>{let U=dZ(Y);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 HA1($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function WA1($,Y){if(Y.recordId&&!Y.versionId&&!Y.versionNumber&&!Y.latest){let U=await H4($,Y.recordId);if(!U.ruleSetVersionNumber)throw Erro Line truncated
`):[]}function uA1($,Y){let U=Array.from({length:$.length+1},()=>Array(Y.length+1).fill(0));for(let K=$.length-1;K>=0;K-=1)for(let z=Y.length-1;z>=0;z-=1)U[K][z]=$[K]===Y[z]?U[K+1][z+1]+1:Math.max(U[K+1][z],U[K][z+1]);let I=[],Q=0,J=0;while(Q<$.length&&J<Y.length)if($[Q]===Y[J])I.push(` ${$[Q]}`),Q+=1,J+=1;else if(U[Q+1][J]>=U[Q][J+1])I.push(`-${$[Q++]}`);else I.push(`+${Y[J++]}`);while(Q<$.length)I.push(`-${$[Q++]}`);while(J<Y.length)I.push(`+${Y[J++]}`);return I}function bA1($,Y,U,I,Q,J){let K=iA0(I,J),z=iA0(Q,J),G=I?`a/rules/${$}`:"/dev/null",H=Q?`b/rules/${$}`:"/dev/null";return[`diff --git a/rules/${$} b/rules/${$}`,`--- ${G} v${Y.versionNumber}`,`+++ ${H} v${U.versionNumber}`,`@@ -${K.length?1:0},${K.length} +${z.length?1:0},${z.length} @@`,...uA1(K,z)].join(`
`)}function cA0($){return{id:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedAt:$.publishedAt}}function nA0($,Y){let U=new Map;for(let I of $.rules){let Q=pZ(I),J=Y==="stable-id"?pA0(Q):mZ(Q.code??Q.ruleCode);if(!J)throw Error(`Rule version ${$.versionNumber} contains a rule without a ${Y==="stable-id"?"stable rule ID":"code"}.`);if(U.has(J))throw Error(`Rule version ${$.versionNumber} contains duplicate ${Y==="stable-id"?"stable rule ID":"code"}: ${J}`);U.set(J,Q)}return U}function iA1($,Y,U){if(U!=="auto")return U;if([...$.rules,...Y.rules].every((J)=>Boolean(pA0(J))))return"stable-id";if([...$.rules,...Y.rules].every((J)=>Boolean(mZ(pZ(J).code??pZ(J).ruleCode))))return"code";throw Error("Rule snapshots have neither a complete stable-ID mapping nor a complete code mapping.")}function mA0($,Y,U={}){let I=iA1($,Y,U.identityMode??"auto"),Q=nA0($,I),J=nA0(Y,I),K=[...new Set([...Q.keys(),...J.keys()])],z=[],G={added:0,removed:0,modified:0,unchanged:0},H=cA0($),W=cA0(Y);for(let Z of K){let q=Q.get(Z),V=J.get(Z),w=q?MI(q,I):void 0,M=V?MI(V,I):void 0,F=!q?"added":!V?"removed":JSON.stringify(w)!==JSON.stringify(M)?"modified":"unchanged";if(G[F]+=1,F==="unchanged"&&!U.includeUnchanged)continue;let N=F==="modified"?[...new Set([...Object.keys(w??{}),...Object.keys(M??{})])].filter((O)=>JSON.stringify(w?.[O])!==JSON.stringify(M?.[O])):void 0;z.push({status:F,ruleId:Z,identityMode:I,...q?{before:q}:{},...V?{after:V}:{},...N?.length?{changedFields:N}:{},...F!=="unchanged"?{diff:bA1(Z,H,W,q,V,I)}:{}})}let X={from:H,to:W,identityMode:I,counts:G,changes:z,unifiedDiff:z.filter((Z)=>Z.diff).map((Z)=>Z.diff).join(`
`)};if(I==="code"){let Z=K.filter((P)=>Q.has(P)&&J.has(P)).length,q=K.filter((P)=>Q.has(P)&&J.has(P)&&JSON.stringify(MI(Q.get(P),"code"))===JSON.stringify(MI(J.get(P),"code"))).length,V=Q.size,w=J.size,M=Math.min(V,w)?Z/Math.min(V,w):1,F=new Map;for(let[P,T]of Q)F.set(JSON.stringify(MI(T,"code")),P);let N=0;for(let[P,T]of J){let B=F.get(JSON.stringify(MI(T,"code")));if(B&&B!==P)N+=1}let D=(Math.min(V,w)?q/Math.min(V,w):1)>=0.5?"high":q>0||N>0?"ambiguous":"low";X.codeStats={oldCount:V,newCount:w,sameCodeCount:Z,sameCodeUnchanged:q,sameBodyDifferentCode:N,overlapRatio:M,confidence:D,warning:"Published snapshots do not carry stable IDs; code matching can report reorderings as remove/add or modified rules."}}return X}function rd($,Y=20000,U=!1){if(U||$.unifiedDiff.length<=Y)return{...$,truncation:{truncated:!1,maxChars:Y,omittedChars:0,hint:"Use --full only when the complete diff is required."}};let I=$.unifiedDiff.length-Y,Q=`
... [diff truncated: ${I} characters omitted; rerun with --full for the complete diff]`,J=$.changes.map(({before:K,after:z,diff:G,...H})=>({...H,...G?{diff:G.length>Y?`${G.slice(0,Y)}${Q}`:G}:{}}));return{...$,changes:J,unifiedDiff:`${$.unifiedDiff.slice(0,Y)}${Q}`,truncation:{truncated:!0,maxChars:Y,omittedChars:I,hint:"Use --full for the complete diff."}}}var dA0,fA1;var lA0=m(()=>{dA0=["id","ruleId","stableId"],fA1=new Set([...dA0,"runtimeRuleId","runtimeId","tenantId","createdAt","updatedAt","versionId","versionNumber"])});import{existsSync as cA1,mkdirSync as nA1,readFileSync as dA1,renameSync as pA1,writeFileSync as mA1}from"node:fs";import{homedir as lA1}from"node:os";import{join as oA0}from"node:path";function lZ($){if($===void 0||$===null)return;let Y=String($).trim().toLowerCase().replace(/^rule[-_:]?/,"").replace(/^#/,"");if(!Y)return;return/^\d+$/.test(Y)?String(Number(Y)):Y}function OP($){return JSON.stringify([$.description??"",$.scope??"",$.strictness??""])}function rA0(){return process.env.SEAL_USE_RULE_VERSION_SNAPSHOTS_DIR?.trim()||oA0(lA1(),".config","seal-use","rule-version-snapshots")}function oA1($){return $.replace(/[^a-zA-Z0-9._-]/g,"_")}function sA0($,Y){return oA0(rA0(),`${oA1($)}-v${Y}.json`)}function oZ($,Y,U){let I=new Map,Q=new Map;for(let W of U){let X=lZ(W.code);if(X)I.set(X,[...I.get(X)??[],W]);let Z=OP(W);Q.set(Z,[...Q.get(Z)??[],W])}let J=[];for(let W of Y.rules??[]){let X=lZ(W.code),Z=X?I.get(X)??[]:[],q=Q.get(OP(W))??[],V=Z.length===1?Z[0]:q.length===1?q[0]:void 0;if(!V)continue;J.push({stableId:V.id,...W.code!==void 0?{code:W.code}:{},description:W.description,scope:W.scope,strictness:W.strictness})}let K={corpId:$,versionId:Y.id,versionNumber:Y.versionNumber,capturedAt:new Date().toISOString(),rules:J},z=rA0();nA1(z,{recursive:!0,mode:448});let G=sA0($,Y.versionNumber),H=`${G}.${process.pid}.tmp`;return mA1(H,`${JSON.stringify(K,null,2)}
`,{encoding:"utf8",mode:384}),pA1(H,G),G}function rA1($,Y){let U=sA0($,Y.versionNumber);if(!cA1(U))return null;try{return JSON.parse(dA1(U,"utf8"))}catch{return null}}function sd($,Y){let U=rA1($,Y);if(!U?.rules.length)return Y;let I=new Map(U.rules.flatMap((J)=>{let K=lZ(J.code);return K?[[K,J]]:[]})),Q=new Map(U.rules.map((J)=>[OP(J),J]));return{...Y,rules:Y.rules.map((J)=>{if(J.id!==void 0||J.ruleId!==void 0||J.stableId!==void 0)return J;let K=(lZ(J.code)?I.get(lZ(J.code)):void 0)??Q.get(OP(J));return K?{...J,stableId:K.stableId}:J})}}var ad=()=>{};var aA0,E84,sA1,j84;var tA0=m(()=>{z6();aA0=L.object({level:L.enum(["error","warning","info"]),code:L.string(),message:L.string(),snippet:L.string().optional(),suggestion:L.string().optional()}),E84=L.object({score:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(aA0)}),sA1=L.object({ruleId:L.string().optional(),ruleCode:L.string().optional(),ruleName:L.string().optional(),score:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(aA0),description:L.string().optional()}),j84=L.object({linter:L.string(),linterType:L.enum(["builtin","official","custom"]),totalRules:L.number(),healthyCount:L.number(),issueCount:L.number(),overallScore:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(sA1)})});function zz($){let Y=($.description||"").trim(),U=[];if(Y.length<5)U.push({level:"error",code:"TOO_SHORT",message:"规则描述过于简短(少于 5 个字),大模型难以形成明确的判定逻辑",suggestion:"请补充具体的费用类型、核验条件与限制标准"});for(let G of aA1)if(Y.includes(G))U.push({level:"error",code:"VAGUE_WORD",snippet:G,message:`包含主观模糊词 "${G}",容易导致大模型判定标准产生波动与幻觉`,suggestion:`建议移除 "${G}",改为具体的金额上限、枚举范围或刚性判定条件`});let I=tA1.find((G)=>Y.includes(G)),Q=eA1.some((G)=>Y.includes(G));if(I&&!Q)U.push({level:"warning",code:"HANGING_EXCEPTION",snippet:I,message:`包含例外条款 "${I}",但未指定 AI 从何处核验该例外成立的依据`,suggestion:'建议补充明确的凭据来源(例如:"需在【单据备注】中说明原因" 或 "需在【附件】中上传审批截图")'});let J=U.filter((G)=>G.level==="error").length,K=U.filter((G)=>G.level==="warning").length;return{score:Math.max(0,100-J*25-K*10),passed:J===0,issues:U}}var aA1,tA1,eA1;var td=m(()=>{aA1=["原则上","尽量","适当","酌情","一般情况下","尽可能","合理控制","视情况","视具体情况"],tA1=["除非","特殊情况","特殊原因","经批准","经审批","经领导同意","除外","例外"],eA1=["备注","说明","附件","证明","邮件","截图","凭证","审批","单据","发票"]});function eA0($){let Y=($.description||"").trim(),U=[];if(Y.length<5)U.push({level:"error",code:"TOO_SHORT",message:"规则描述过于简短(少于 5 个字),大模型难以形成明确的判定逻辑",suggestion:"请补充具体的费用类型、核验条件与限制标准"});else if(Y.length<10)U.push({level:"warning",code:"SHORT_DESCRIPTION",message:"规则描述偏短(少于 10 个字),可能缺少适用的单据范围或执行细节",suggestion:"建议扩充核验场景、限制标准或异常处理方式"});for(let Z of $P1)if(Y.includes(Z))U.push({level:"error",code:"VAGUE_WORD",snippet:Z,message:`包含主观模糊词 "${Z}",在严格风控模式下容易引起审核判定分歧`,suggestion:`请移除 "${Z}",明确量化标准或枚举具体允许的情形`});let I=YP1.find((Z)=>Y.includes(Z)),Q=UP1.some((Z)=>Y.includes(Z));if(I&&!Q)U.push({level:"error",code:"HANGING_EXCEPTION",snippet:I,message:`包含例外条款 "${I}",但未指定 AI 从何处核验该例外成立的凭证依据`,suggestion:'严格模式要求必须补充明确的核验来源(如:"需在【单据备注】中说明原因" 或 "需在【附件】中提供审批截图")'});let J=/\d+/.test(Y),K=IP1.some((Z)=>Y.includes(Z));if(!J&&!K)U.push({level:"warning",code:"LACKS_EXPLICIT_CONSTRAINT",message:"规则缺乏明确的定量标准(如金额、天数、频次)或绝对刚性边界词(如不得、禁止、仅限)",suggestion:"建议设定具体数值阈值或明确的禁止/准入条件,以便大模型精确判定"});let z=/经(批准|审批|领导同意|领导签字)|审批通过/.test(Y),G=QP1.some((Z)=>Y.includes(Z));if(z&&!G)U.push({level:"warning",code:"AMBIGUOUS_APPROVER",message:"规则提及审批例外,但未明确指定具体的审批角色(如部门总监、直接上级、财务负责人)",suggestion:"建议明确审批人角色(例如:经【部门总监】批准,经【直接上级】邮件确认)"});let H=U.filter((Z)=>Z.level==="error").length,W=U.filter((Z)=>Z.level==="warning").length;return{score:Math.max(0,100-H*30-W*15),passed:H===0,issues:U}}var $P1,YP1,UP1,IP1,QP1;var ed=m(()=>{$P1=["原则上","尽量","适当","酌情","一般情况下","尽可能","合理控制","视情况","视 Line truncated
↳ ${V}`,operator:J}}function pB0($){if(!$)return[];let Y=$.pending||[],U=String($.rawState||"").toUpperCase(),I=String($.state||"").toUpperCase(),Q=[];if(Y.length>0)for(let J of Y){let K=J.approver?.name||J.approver?.id||"待定",z=(J.name||$.currentNode||"").trim(),G=z?`${z}(${K})`:K,W=J.type?.toUpperCase()==="PAYING"||z.includes("支付")||U==="PAYING"||I==="支付中"?"待支付":"待审批";Q.push(`${G}: ${W}`)}else if($.currentNode?.trim()){let K=$.currentNode.includes("支付")||U==="PAYING"||I==="支付中"?"待支付":"待审批";Q.push(`${$.currentNode.trim()}: ${K}`)}return Q}function MI($,Y){let U=new Map;if(!$||$.length===0)return U;if(!Y){for(let q of $){let w=(q.result||{}).decision||q.aiDecision||"-";U.set(q.id,{recordId:q.id,sourceDocumentSN:q.sourceDocumentSN,taskMode:q.taskMode,aiDecision:dB0(typeof w==="string"?w:"-"),aiAction:"-",eHumanAction:"-",eHumanComment:"-",auditDrift:!1})}return U}let I=[...$].sort((q,V)=>(Number(q.createdAt)||0)-(Number(V.createdAt)||0)),Q=Y.history||[],J=String(Y.rawState||"").toUpperCase(),K=String(Y.state||"").toUpperCase(),z=J==="DRAFT"||J==="REVOKED"||J==="CANCELED"||J==="CANCELLED"||K==="草稿"||K==="已撤回"||K==="已取消",G=J==="REJECTED"||J==="TERMINATED"||K==="审批驳回"||K==="已驳回",H=!z&&!G&&(J==="PAID"||K==="已支付"||Q.some((q)=>!q.isEbot&&(q.rawAction==="freeflow.pay"||q.action==="支付成功"||q.action==="支付完成"))),W=!z&&!G&&!H&&(J==="PAYING"||K==="支付中"||(Y.pending||[]).some((q)=>q.isCurrent&&(q.type?.toUpperCase()==="PAYING"||q.name?.includes("支付")))||Y.currentNode?.includes("支付")===!0),Z=H||!z&&!G&&!W&&(J==="COMPLETED"||J==="APPROVED"||K==="已完成"||K==="审批通过");for(let q=0;q<I.length;q++){let V=I[q];if(!V)continue;let w=Number(V.createdAt)||0,M=V.document||{},F=V.manualApprovalRecord||V.result?.manualApprovalRecord||M.manualApprovalRecord||{},N=typeof V.sourceExtendData?.nodeId==="string"?String(V.sourceExtendData.nodeId):void 0,O=typeof F.nodeId==="string"?String(F.nodeId):void 0,D=O?decodeURIComponent(O).replace(/^hcnode_/,"").replace(/_r\d+$/,""):void 0,P=N||D,T=P?Q.find((B0)=>B0.nodeId&&(B0.nodeId===P||P.includes(B0.nodeId))):void 0,B=T?.time??w,E=I[q+1],C=E?Number(E.createdAt)||1/0:1/0,i=q===I.length-1,x=Q.find((B0)=>(B0.time??0)>B+5000&&B0.isEbot&&(B0.nodeName?.includes("智能")||B0.nodeName?.includes("AI")||B0.action?.includes("智能")||B0.comment?.includes("AI")||B0.comment?.includes("approval-result"))&&!B0.nodeName?.includes("费用标准检查")&&!B0.nodeName?.includes("标准检查")&&!B0.nodeName?.includes("预算"));if(x){if(i=!1,(x.time??1/0)<C)C=x.time}let g=V.result||{},b=g.decision||V.aiDecision||"-",c=typeof b==="string"?b:"-",I0=c.toUpperCase(),k=I0==="REJECT"||I0==="驳回",p=I0==="APPROVE"||I0==="通过",a=I0==="EXEMPT_APPROVE"||I0==="免审通过"||I0==="备注通过",$0=V.taskMode||V.finalExecutionMode||"",d=String($0).toLowerCase().includes("auto")||V.finalExecutionMode==="automatic"||$0==="automatic"||$0==="fully_automatic",Y0="-";if(p||a)Y0="添加评论";else if(k)Y0=d?"驳回":"添加评论";else if(I0==="REVIEW"||I0==="转交复核")Y0="转交复核";let h=typeof F.status==="object"&&F.status!==null?String(F.status.type||F.status.label||"").toUpperCase():"",o=typeof F.status==="object"&&F.status!==null?String(F.status.sourceStatus||""):"",e=M.manualApprovalStatus||g.manualApprovalStatus||V.manualApprovalStatus,w0=typeof e==="string"?e.toUpperCase():"",N0=w0==="CANCELLED"||w0==="CANCELED"||w0==="已取消"||w0==="已撤回"||w0==="REVOKED"||h==="CANCELLED"||h==="CANCELED"||o.includes("撤回")||o.includes("取消"),_0=w0==="APPROVED"||w0==="已支付/审批完成"||w0==="已通过"||w0==="已完成"||w0==="已支付"||h==="APPROVED",r0=!(o.includes("补偿")||o.includes("已支付"))&&(w0==="TERMINATED"||w0==="REJECTED"||w0==="REJECT"||w0==="已驳回"||w0==="被驳回"||h==="TERMINATED"||h==="REJECTED"||h==="已驳回"||h==="被驳回"),K1=T?1000:60000,t=Q.filter((B0)=>{let Q0=B0.time??0;return Q0>=B-K1&&Q0<C}),X0="-",F0="-",u0=!1,b0,c0,P1=p||a,k1=Q.filter((B0)=>(B0.time??0)>B+5000),u1=k1.some((B0)=>B0.rawAction==="freeflow.retract"||B0.action==="单据撤回"),b1=k1.some((B0)=>B0.rawAction==="freeflow.submit"||B0.action==="提交送审");if(P1&&i&&(u1||b1))u0=!0,b0="AI通过后单据发生撤回/修改重提,后续未经AI复审";if(d&&k)X0="无操作",F0="-";else{let B0=t.filter((S)=>(S.time??0)>=B-1000&&!S.isEbot&&S.rawAction!=="freeflow.submit"&&S.action!=="提交送审"&&!((S.rawAction==="freeflow.comment"||S.action==="发表评论")&&!S.comment)&&!((S.rawAction==="freeflow.print"||S.action==="打印提醒")&&!S.comment)&&!(S.rawAction==="freeflow.carbonCopy"||S.rawAction==="freeflow.cc"||S.action==="抄送通知")),Q0=B0.find((S)=>S.rawAction==="freeflow.retract"||S.action==="单据撤回"),A=B0.find((S)=>S.rawAction==="freeflow.reject"||S.action==="审批驳回");if(!i)if(A||!Y&&r0){X0="审批驳回",u0=!1,b0=void 0;let S=Ad(A,void 0,F,Q,Y);F0=S.comme Line truncated
`,{mode:384}),Y}function gd($){let Y=XA0();for(let U of Y){if(!A$(U))continue;for(let I of GP(U).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=v9(U,I);try{let J=WP(Q,"utf-8"),K=JSON.parse(J);if(K&&typeof K==="object"&&K.id===$)return Q}catch{}}}return}function S9($,Y){let U=gd($);if(!U)throw Error(`Enterprise config not found: ${$}`);let Q={...JSON.parse(WP(U,"utf-8")),...Y};for(let K of Object.keys(Y))if(Y[K]===void 0)delete Q[K];let J=iZ.parse(Q);return JA0(U,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var hd="SEAL_USE_ENTERPRISES_DIR",KA0="SEAL_HOME_ENTERPRISES_DIR",zA0="SEAL_USE_USER_ENTERPRISES_DIR",GA0="SEAL_HOME_USER_ENTERPRISES_DIR",HA0="SEAL_USE_CONFIG_FILE",WA0="SEAL_HOME_CONFIG_FILE",Gz,HP,zP,IA0;var r$=m(()=>{KP();Gz=v9(XP(),".config","seal-use","enterprises"),HP=v9(XP(),".config","seal-home","enterprises"),zP=v9(XP(),".config","seal-use","config.json"),IA0=v9(XP(),".config","seal-home","config.json")});function l2($,Y,U=[]){let I=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=I??Q;if(J){let z=$.find((W)=>W.id===J);if(z)return z;let G=$.find((W)=>W.id.toLowerCase()===J.toLowerCase());if(G)return G;let H=$.find((W)=>W.name.toLowerCase()===J.toLowerCase());if(H)return H;throw Error(`No enterprise config found for ${J}`)}if(!Y.stateful)throw Error("Stateless mode is enabled. Every enterprise command requires --corp <corpId>. Use `seal-use 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{existsSync as yd,mkdirSync as iB1,readFileSync as cB1,renameSync as nB1,unlinkSync as dB1,writeFileSync as pB1}from"node:fs";import{homedir as mB1}from"node:os";import{dirname as lB1,join as oB1}from"node:path";function nZ(){let $=process.env[rB1]?.trim();if($)return $;return sB1}function qA0($=new Date){return $.toISOString().slice(0,10)}function VA0($=kd,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function LA0($=nZ()){if(!yd($))return{};try{let Y=cB1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function aB1($,Y){let U={};for(let[I,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},K=!1;for(let[z,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&z>=Y)J[z]=G,K=!0;if(K)U[I]=J}return U}function tB1($,Y=nZ()){let U=lB1(Y);if(!yd(U))iB1(U,{recursive:!0,mode:448});let I=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{pB1(I,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),nB1(I,Y)}catch(Q){try{if(yd(I))dB1(I)}catch{}throw Q}}function FA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=nZ(),I=LA0(U),Q=qA0(Y),J=VA0(kd,Y),K=aB1(I,J);K[$]=K[$]||{},K[$][Q]=(K[$][Q]??0)+1,tB1(K,U)}catch{}}function eB1($,Y=kd,U=new Date){let I=new Map;try{let Q=LA0(),J=VA0(Y,U),K=qA0(U),z=$??Object.keys(Q);for(let G of z){let H=Q[G];if(!H){I.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=K&&typeof Z==="number")W+=Z;I.set(G,W)}}catch{if($)for(let Q of $)I.set(Q,0)}return I}function wA0($,Y,U){let I=U??eB1($.map((Q)=>Q.id));return[...$].sort((Q,J)=>{if(Y){if(Q.id===Y&&J.id!==Y)return-1;if(J.id===Y&&Q.id!==Y)return 1}let K=I.get(Q.id)??0,z=I.get(J.id)??0;if(K!==z)return z-K;let G=Q.name??Q.id,H=J.name??J.id,W=G.localeCompare(H,"zh-CN");if(W!==0)return W;return Q.id.localeCompare(J.id)})}var rB1="SEAL_USE_USAGE_FILE",sB1,kd=7;var ZP=m(()=>{sB1=oB1(mB1(),".config","seal-use","usage.json")});var G8={};V8(G8,{withApprovalRunFilters:()=>PA1,toDate:()=>od,timestampOf:()=>ud,summarizeSimulationBatch:()=>zA1,summarizeRunBridge:()=>ZA1,summarizeRuleVersion:()=>qA1,summarizeApprovalRuns:()=>GA1,summarizeApprovalRunResult:()=>wP,summarizeApprovalRunDocument:()=>AA0,summarizeApprovalRunDetail:()=>WA1,summarizeApprovalRun:()=>rZ,stringifyHumanResultValue:()=>ld,stringFromUnknown:()=>Z4,setPath:()=>PA0,scalarIncludes:()=>VP,runtimeRuleIndex:()=>wA1,runtimeRuleIdToCode:()=>CA0,rulesHaveSameContent:()=>NA0,ruleChangedFields:()=>DA0,resolveSealBaseUrl:()=>NA1,resolveRuleVersionSelector:()=>AA1,resolveRuleVersionForLookup:()=>VA1,resolveRuleVersion:()=>bd,resolveManualApprovalStatus:()=>_A0,resolveApprovalRunForUrl:()=>OA1,redactPreviewValue:()=>mZ,redactIntegrationSecrets:()=>QA1,projectApprovalRules:()=>YA1,presentWebhookIntegration:()=>$A1,prepareApprovalRuns:()=>TA1,pickRunFields:()=>BA0,pickRuleFields:()=>OA0,pickApprovalRuns:()=>BA1,pickApprovalRunCandidate:()=>MA1,parseRuleCodeNumber:()=>J$,parseFieldPaths:()=>HA1,parseDurationMs:()=>IA1,objectContainsScalar:()=>LP,numberFromUnknown:()=>TA0,normalizeUrl:()=>DA1,normalizeRuleStrictness:()=>dd,normalizeRuleCode:()=>pZ,mutationPreview:()=>JA1,matchesRunLookup:()=>jA1,localParts:()=>rd,localDateKey:()=>CA1,isHumanResultKey:()=>id,getPath:()=>s$,getConfiguredSealBaseUrl:()=>MA0,formatRuleCode:()=>r2,formatLocalDateTime:()=>nd,flattenDocumentFields:()=>EA0,firstPath:()=>lZ,firstByLabel:()=>dZ,findRuleInVersion:()=>FA1,findRuleInDraft:()=>LA1,findKeywordLines:()=>fd,findHumanResultValue:()=>FP,filterRunsByHumanResult:()=>RA0,filterRuns:()=>md,extractHumanResult:()=>DI,extractCitedRules:()=>XA1,countPathCandidates:()=>xd,countBy:()=>cd,compactObject:()=>o2,collectInvoiceSummary:()=>jA0,collectInvoiceObjects:()=>oZ,collectDocumentFields:()=>qP,buildSimulationBatchParams:()=>KA1, Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:o2({id:Y?.id,sn:Y?.sn??Y?.sourceDocumentSN??$.sourceDocumentSN,title:Y?.title??Y?.name,template:lZ(Y,["template.name","templateName","form.name","formName","formTitle"]),amount:dZ(U,["金额","报销金额","付款金额","合计","价税合计"])??lZ(Y,["amount","totalAmount","expenseAmount"]),expenseType:dZ(U,["费用类型","费用类别","报销类型"]),costCompany:dZ(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:dZ(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:jA0($),attachments:c3($,{summary:!0}).attachments,aiResult:wP($),manualResult:DI($)?.value,hints:o2({amountMentions:fd(I,["金额","合计","税率"],8),partyMentions:fd(I,["买方","卖方","甲方","乙方","收款"],8)})}}function XA1($){let Y=[["result.rulesResult",s$($,"result.rulesResult")],["result.hitRules",s$($,"result.hitRules")],["result.citedRules",s$($,"result.citedRules")],["result.matchedRules",s$($,"result.matchedRules")],["result.ruleResults",s$($,"result.ruleResults")],["result.rules",s$($,"result.rules")],["pipelineData.citedRules",s$($,"pipelineData.citedRules")],["pipelineData.matchedRules",s$($,"pipelineData.matchedRules")]],U=[],I=new Map,Q=new Set;for(let[J,K]of Y)(Array.isArray(K)?K:K&&typeof K==="object"?Object.values(K):[]).forEach((G,H)=>{let W=Hz(G);if(!W)return;let X=Z4(W.runtimeRuleId)??Z4(W.runtimeId)??Z4(W.id)??Z4(W.ruleId),Z=W.ruleCode??W.code,q=J$(Z??X),V=X??(q!==void 0?`rule-${q}`:void 0),w=(q!==void 0?r2(q):void 0)??Z4(W.ruleCode)??Z4(W.code)??(V?CA0(V):void 0),M=o2({code:w,runtimeRuleId:V,ruleCode:w,versionNumber:TA0(W.versionNumber)??$.ruleSetVersionNumber,description:Z4(W.description),scope:Z4(W.scope),strictness:Z4(W.strictness),ruleIntent:Z4(W.ruleIntent),appliedAnalysis:W.appliedAnalysis??W.analysis??W.reasoning,checkResult:W.checkResult??W.result??W.decision,findings:W.findings??W.riskPoints??W.evidence,sourcePath:`${J}.${H}`}),F=V??w;if(F){let O=I.get(F);if(O){for(let[D,P]of Object.entries(M))if(O[D]===void 0&&P!==void 0)O[D]=P;return}I.set(F,M),U.push(M);return}let N=JSON.stringify(M);if(!Q.has(N))Q.add(N),U.push(M)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function lZ($,Y){if(!$)return;for(let U of Y){let I=s$($,U);if(I!==void 0)return I}return}function xd($,Y){if(!$)return 0;for(let U of Y){let I=s$($,U);if(Array.isArray(I))return I.length;if(I&&typeof I==="object")return Object.keys(I).length;if(typeof I==="number")return I}return 0}function s$($,Y){return Y.split(".").reduce((U,I)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let Q=Number(I);return Number.isInteger(Q)?U[Q]:void 0}if(typeof U==="object")return U[I];return},$)}function PA0($,Y,U){let I=Y.split("."),Q=$;for(let J of I.slice(0,-1)){let K=Q[J];if(!K||typeof K!=="object"||Array.isArray(K))Q[J]={};Q=Q[J]}Q[I[I.length-1]??Y]=U}function o2($){return Object.fromEntries(Object.entries($).filter(([,Y])=>Y!==void 0))}function Hz($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function TA0($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function EA0($){let Y=[];return qP($,"document",Y),Y}function qP($,Y,U){if(Array.isArray($)){$.forEach((K,z)=>qP(K,`${Y}.${z}`,U));return}let I=Hz($);if(!I)return;let Q=Z4(I.label)??Z4(I.name)??Z4(I.title)??Z4(I.fieldName),J=I.value??I.displayValue??I.text??I.content;if(Q&&J!==void 0&&typeof J!=="object")U.push(o2({path:Y,label:Q,value:J,type:Z4(I.type)??Z4(I.fieldType)}));for(let[K,z]of Object.entries(I)){if(K==="attachments")continue;qP(z,`${Y}.${K}`,U)}}function dZ($,Y){return $.find((I)=>{let Q=Z4(I.label)??"";return Y.some((J)=>Q.includes(J))})?.value}function jA0($){let Y=[];return oZ($.result,"result",Y),oZ($.document,"document",Y),Y.slice(0,20)}function oZ($,Y,U){if(Array.isArray($)){$.forEach((Q,J)=>oZ(Q,`${Y}.${J}`,U));return}let I=Hz($);if(!I)return;if(/invoice|发票/i.test(Y))U.push(o2({path:Y,fileName:Z4(I.fileName)??Z4(I.filename)??Z4(I.name),buyer:I.buyer??I.buyerName??I.purchaserName,seller:I.seller??I.sellerName,amount:I.amount??I.totalAmount??I.total,taxRate:I.taxRate,category:I.category??I.type}));for(let[Q,J]of Object.entries(I))oZ(J,`${Y}.${Q}`,U)}function fd($,Y,U){return $.split(/\r?\n/).filter((I)=>Y.some((Q)=>I.includes(Q))).slice(0,U)}function ZA1($){return $.map((Y)=>{let U=rZ(Y);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" Line truncated
`):[]}function pA1($,Y){let U=Array.from({length:$.length+1},()=>Array(Y.length+1).fill(0));for(let K=$.length-1;K>=0;K-=1)for(let z=Y.length-1;z>=0;z-=1)U[K][z]=$[K]===Y[z]?U[K+1][z+1]+1:Math.max(U[K+1][z],U[K][z+1]);let I=[],Q=0,J=0;while(Q<$.length&&J<Y.length)if($[Q]===Y[J])I.push(` ${$[Q]}`),Q+=1,J+=1;else if(U[Q+1][J]>=U[Q][J+1])I.push(`-${$[Q++]}`);else I.push(`+${Y[J++]}`);while(Q<$.length)I.push(`-${$[Q++]}`);while(J<Y.length)I.push(`+${Y[J++]}`);return I}function mA1($,Y,U,I,Q,J){let K=lA0(I,J),z=lA0(Q,J),G=I?`a/rules/${$}`:"/dev/null",H=Q?`b/rules/${$}`:"/dev/null";return[`diff --git a/rules/${$} b/rules/${$}`,`--- ${G} v${Y.versionNumber}`,`+++ ${H} v${U.versionNumber}`,`@@ -${K.length?1:0},${K.length} +${z.length?1:0},${z.length} @@`,...pA1(K,z)].join(`
`)}function oA0($){return{id:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedAt:$.publishedAt}}function rA0($,Y){let U=new Map;for(let I of $.rules){let Q=sZ(I),J=Y==="stable-id"?aA0(Q):aZ(Q.code??Q.ruleCode);if(!J)throw Error(`Rule version ${$.versionNumber} contains a rule without a ${Y==="stable-id"?"stable rule ID":"code"}.`);if(U.has(J))throw Error(`Rule version ${$.versionNumber} contains duplicate ${Y==="stable-id"?"stable rule ID":"code"}: ${J}`);U.set(J,Q)}return U}function lA1($,Y,U){if(U!=="auto")return U;if([...$.rules,...Y.rules].every((J)=>Boolean(aA0(J))))return"stable-id";if([...$.rules,...Y.rules].every((J)=>Boolean(aZ(sZ(J).code??sZ(J).ruleCode))))return"code";throw Error("Rule snapshots have neither a complete stable-ID mapping nor a complete code mapping.")}function tA0($,Y,U={}){let I=lA1($,Y,U.identityMode??"auto"),Q=rA0($,I),J=rA0(Y,I),K=[...new Set([...Q.keys(),...J.keys()])],z=[],G={added:0,removed:0,modified:0,unchanged:0},H=oA0($),W=oA0(Y);for(let Z of K){let q=Q.get(Z),V=J.get(Z),w=q?BI(q,I):void 0,M=V?BI(V,I):void 0,F=!q?"added":!V?"removed":JSON.stringify(w)!==JSON.stringify(M)?"modified":"unchanged";if(G[F]+=1,F==="unchanged"&&!U.includeUnchanged)continue;let N=F==="modified"?[...new Set([...Object.keys(w??{}),...Object.keys(M??{})])].filter((O)=>JSON.stringify(w?.[O])!==JSON.stringify(M?.[O])):void 0;z.push({status:F,ruleId:Z,identityMode:I,...q?{before:q}:{},...V?{after:V}:{},...N?.length?{changedFields:N}:{},...F!=="unchanged"?{diff:mA1(Z,H,W,q,V,I)}:{}})}let X={from:H,to:W,identityMode:I,counts:G,changes:z,unifiedDiff:z.filter((Z)=>Z.diff).map((Z)=>Z.diff).join(`
`)};if(I==="code"){let Z=K.filter((P)=>Q.has(P)&&J.has(P)).length,q=K.filter((P)=>Q.has(P)&&J.has(P)&&JSON.stringify(BI(Q.get(P),"code"))===JSON.stringify(BI(J.get(P),"code"))).length,V=Q.size,w=J.size,M=Math.min(V,w)?Z/Math.min(V,w):1,F=new Map;for(let[P,T]of Q)F.set(JSON.stringify(BI(T,"code")),P);let N=0;for(let[P,T]of J){let B=F.get(JSON.stringify(BI(T,"code")));if(B&&B!==P)N+=1}let D=(Math.min(V,w)?q/Math.min(V,w):1)>=0.5?"high":q>0||N>0?"ambiguous":"low";X.codeStats={oldCount:V,newCount:w,sameCodeCount:Z,sameCodeUnchanged:q,sameBodyDifferentCode:N,overlapRatio:M,confidence:D,warning:"Published snapshots do not carry stable IDs; code matching can report reorderings as remove/add or modified rules."}}return X}function td($,Y=20000,U=!1){if(U||$.unifiedDiff.length<=Y)return{...$,truncation:{truncated:!1,maxChars:Y,omittedChars:0,hint:"Use --full only when the complete diff is required."}};let I=$.unifiedDiff.length-Y,Q=`
... [diff truncated: ${I} characters omitted; rerun with --full for the complete diff]`,J=$.changes.map(({before:K,after:z,diff:G,...H})=>({...H,...G?{diff:G.length>Y?`${G.slice(0,Y)}${Q}`:G}:{}}));return{...$,changes:J,unifiedDiff:`${$.unifiedDiff.slice(0,Y)}${Q}`,truncation:{truncated:!0,maxChars:Y,omittedChars:I,hint:"Use --full for the complete diff."}}}var sA0,dA1;var eA0=m(()=>{sA0=["id","ruleId","stableId"],dA1=new Set([...sA0,"runtimeRuleId","runtimeId","tenantId","createdAt","updatedAt","versionId","versionNumber"])});import{existsSync as oA1,mkdirSync as rA1,readFileSync as sA1,renameSync as aA1,writeFileSync as tA1}from"node:fs";import{homedir as eA1}from"node:os";import{join as $P0}from"node:path";function tZ($){if($===void 0||$===null)return;let Y=String($).trim().toLowerCase().replace(/^rule[-_:]?/,"").replace(/^#/,"");if(!Y)return;return/^\d+$/.test(Y)?String(Number(Y)):Y}function DP($){return JSON.stringify([$.description??"",$.scope??"",$.strictness??""])}function YP0(){return process.env.SEAL_USE_RULE_VERSION_SNAPSHOTS_DIR?.trim()||$P0(eA1(),".config","seal-use","rule-version-snapshots")}function $P1($){return $.replace(/[^a-zA-Z0-9._-]/g,"_")}function UP0($,Y){return $P0(YP0(),`${$P1($)}-v${Y}.json`)}function eZ($,Y,U){let I=new Map,Q=new Map;for(let W of U){let X=tZ(W.code);if(X)I.set(X,[...I.get(X)??[],W]);let Z=DP(W);Q.set(Z,[...Q.get(Z)??[],W])}let J=[];for(let W of Y.rules??[]){let X=tZ(W.code),Z=X?I.get(X)??[]:[],q=Q.get(DP(W))??[],V=Z.length===1?Z[0]:q.length===1?q[0]:void 0;if(!V)continue;J.push({stableId:V.id,...W.code!==void 0?{code:W.code}:{},description:W.description,scope:W.scope,strictness:W.strictness})}let K={corpId:$,versionId:Y.id,versionNumber:Y.versionNumber,capturedAt:new Date().toISOString(),rules:J},z=YP0();rA1(z,{recursive:!0,mode:448});let G=UP0($,Y.versionNumber),H=`${G}.${process.pid}.tmp`;return tA1(H,`${JSON.stringify(K,null,2)}
`,{encoding:"utf8",mode:384}),aA1(H,G),G}function YP1($,Y){let U=UP0($,Y.versionNumber);if(!oA1(U))return null;try{return JSON.parse(sA1(U,"utf8"))}catch{return null}}function BP($,Y){let U=YP1($,Y);if(!U?.rules.length)return Y;let I=new Map(U.rules.flatMap((J)=>{let K=tZ(J.code);return K?[[K,J]]:[]})),Q=new Map(U.rules.map((J)=>[DP(J),J]));return{...Y,rules:Y.rules.map((J)=>{if(J.id!==void 0||J.ruleId!==void 0||J.stableId!==void 0)return J;let K=(tZ(J.code)?I.get(tZ(J.code)):void 0)??Q.get(DP(J));return K?{...J,stableId:K.stableId}:J})}}var ed=()=>{};var IP0,S84,UP1,h84;var QP0=m(()=>{H6();IP0=L.object({level:L.enum(["error","warning","info"]),code:L.string(),message:L.string(),snippet:L.string().optional(),suggestion:L.string().optional()}),S84=L.object({score:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(IP0)}),UP1=L.object({ruleId:L.string().optional(),ruleCode:L.string().optional(),ruleName:L.string().optional(),score:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(IP0),description:L.string().optional()}),h84=L.object({linter:L.string(),linterType:L.enum(["builtin","official","custom"]),totalRules:L.number(),healthyCount:L.number(),issueCount:L.number(),overallScore:L.number().min(0).max(100),passed:L.boolean(),issues:L.array(UP1)})});function Wz($){let Y=($.description||"").trim(),U=[];if(Y.length<5)U.push({level:"error",code:"TOO_SHORT",message:"规则描述过于简短(少于 5 个字),大模型难以形成明确的判定逻辑",suggestion:"请补充具体的费用类型、核验条件与限制标准"});for(let G of IP1)if(Y.includes(G))U.push({level:"error",code:"VAGUE_WORD",snippet:G,message:`包含主观模糊词 "${G}",容易导致大模型判定标准产生波动与幻觉`,suggestion:`建议移除 "${G}",改为具体的金额上限、枚举范围或刚性判定条件`});let I=QP1.find((G)=>Y.includes(G)),Q=JP1.some((G)=>Y.includes(G));if(I&&!Q)U.push({level:"warning",code:"HANGING_EXCEPTION",snippet:I,message:`包含例外条款 "${I}",但未指定 AI 从何处核验该例外成立的依据`,suggestion:'建议补充明确的凭据来源(例如:"需在【单据备注】中说明原因" 或 "需在【附件】中上传审批截图")'});let J=U.filter((G)=>G.level==="error").length,K=U.filter((G)=>G.level==="warning").length;return{score:Math.max(0,100-J*25-K*10),passed:J===0,issues:U}}var IP1,QP1,JP1;var $p=m(()=>{IP1=["原则上","尽量","适当","酌情","一般情况下","尽可能","合理控制","视情况","视具体情况"],QP1=["除非","特殊情况","特殊原因","经批准","经审批","经领导同意","除外","例外"],JP1=["备注","说明","附件","证明","邮件","截图","凭证","审批","单据","发票"]});function JP0($){let Y=($.description||"").trim(),U=[];if(Y.length<5)U.push({level:"error",code:"TOO_SHORT",message:"规则描述过于简短(少于 5 个字),大模型难以形成明确的判定逻辑",suggestion:"请补充具体的费用类型、核验条件与限制标准"});else if(Y.length<10)U.push({level:"warning",code:"SHORT_DESCRIPTION",message:"规则描述偏短(少于 10 个字),可能缺少适用的单据范围或执行细节",suggestion:"建议扩充核验场景、限制标准或异常处理方式"});for(let Z of KP1)if(Y.includes(Z))U.push({level:"error",code:"VAGUE_WORD",snippet:Z,message:`包含主观模糊词 "${Z}",在严格风控模式下容易引起审核判定分歧`,suggestion:`请移除 "${Z}",明确量化标准或枚举具体允许的情形`});let I=zP1.find((Z)=>Y.includes(Z)),Q=GP1.some((Z)=>Y.includes(Z));if(I&&!Q)U.push({level:"error",code:"HANGING_EXCEPTION",snippet:I,message:`包含例外条款 "${I}",但未指定 AI 从何处核验该例外成立的凭证依据`,suggestion:'严格模式要求必须补充明确的核验来源(如:"需在【单据备注】中说明原因" 或 "需在【附件】中提供审批截图")'});let J=/\d+/.test(Y),K=HP1.some((Z)=>Y.includes(Z));if(!J&&!K)U.push({level:"warning",code:"LACKS_EXPLICIT_CONSTRAINT",message:"规则缺乏明确的定量标准(如金额、天数、频次)或绝对刚性边界词(如不得、禁止、仅限)",suggestion:"建议设定具体数值阈值或明确的禁止/准入条件,以便大模型精确判定"});let z=/经(批准|审批|领导同意|领导签字)|审批通过/.test(Y),G=WP1.some((Z)=>Y.includes(Z));if(z&&!G)U.push({level:"warning",code:"AMBIGUOUS_APPROVER",message:"规则提及审批例外,但未明确指定具体的审批角色(如部门总监、直接上级、财务负责人)",suggestion:"建议明确审批人角色(例如:经【部门总监】批准,经【直接上级】邮件确认)"});let H=U.filter((Z)=>Z.level==="error").length,W=U.filter((Z)=>Z.level==="warning").length;return{score:Math.max(0,100-H*30-W*15),passed:H===0,issues:U}}var KP1,zP1,GP1,HP1,WP1;var Yp=m(()=>{KP1=["原则上","尽量","适当","酌情","一般情况下","尽可能","合理控制","视情况","视 Line truncated
* ==============================================================================
* Seal 官方标准规则校验器 (Official Standard Rule Linter)
* ==============================================================================
@@ -881,65 +881,66 @@ export function lintRule(rule: RuleLintTarget): RuleLintResult {
}
export default lintRule;
`}});import{homedir as WP1}from"node:os";import{join as Ip}from"node:path";var XP1,A$,P$;var Qp=m(()=>{XP1=Ip(WP1(),".config","seal-use"),A$=Ip(XP1,"linters"),P$=Ip(A$,"official")});import{existsSync as OI,mkdirSync as ZP1,readFileSync as qP1,readdirSync as IP0,rmSync as VP1,unlinkSync as LP1,writeFileSync as FP1}from"node:fs";import{isAbsolute as wP1,join as B8,resolve as MP1}from"node:path";import{pathToFileURL as YP0}from"node:url";function QP0($=P$){let Y=[],U=[];try{if(!OI($))ZP1($,{recursive:!0});let I=Object.keys(Yp);for(let[J,K]of Object.entries(Yp)){let z=B8($,J),G=!0;if(OI(z))try{if(qP1(z,"utf8")===K)G=!1}catch{G=!0}if(G)FP1(z,K,"utf8");Y.push(J)}let Q=IP0($,{withFileTypes:!0});for(let J of Q)if(!I.includes(J.name)){let K=B8($,J.name);try{if(J.isDirectory())VP1(K,{recursive:!0,force:!0});else LP1(K);U.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:U}}function JP0($={syncOfficial:!0}){if($.syncOfficial!==!1)QP0();let Y=[{name:"builtin",type:"builtin",path:B8(P$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:B8(P$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:B8(P$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],U=[A$,NP];for(let I of U)if(OI(I))try{let Q=IP0(I,{withFileTypes:!0});for(let J of Q){if(J.isDirectory())continue;let K=J.name;if(K.endsWith(".ts")||K.endsWith(".js")||K.endsWith(".mjs")){let z=K.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===z))Y.push({name:z,type:"custom",path:B8(I,K),description:`用户自定义规则校验器 (${K})`})}}}catch{}return Y}function OP1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:B8(P$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:B8(P$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(Y==="hlab"||Y==="hlab-sop"||Y==="hlab-rules"||Y==="hlab-standard"||Y==="official/hlab"||Y==="official/hlab.ts")return{path:B8(P$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(wP1(Y)||Y.startsWith("./")||Y.startsWith("../")){let I=MP1(Y);if(OI(I))return{path:I};for(let Q of[".ts",".js",".mjs"])if(OI(`${I}${Q}`))return{path:`${I}${Q}`}}let U=[B8(A$,`${Y}.ts`),B8(A$,`${Y}.js`),B8(A$,`${Y}.mjs`),B8(NP,`${Y}.ts`),B8(NP,`${Y}.js`),B8(NP,`${Y}.mjs`)];for(let I of U)if(OI(I))return{path:I};return{}}async function Jp($){QP0();let Y=OP1($??"builtin");if(Y.isOfficial){let I=Y.officialKind==="strict"?eA0:Y.officialKind==="hlab"?$P0:zz,Q=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&OI(J))try{let z=await import(YP0(J).href),G=z.default??z.lintRule??z.linter??z.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:UP0(G,I)}}catch{}return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:I}}let U=Y.path;if(!U)return console.error(`⚠️ [linter] 未找到自定义校验器 "${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:zz};try{let Q=await import(YP0(U).href),J=Q.default??Q.lintRule??Q.linter??Q.lint;if(typeof J!=="function")return console.error(`⚠️ [linter] 自定义校验器 "${U}" 未导出标准函数 (default / lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:zz};return{name:$??"custom",type:"custom",filePath:U,linter:UP0(J,zz)}}catch(I){return console.error(`⚠️ [linter] 加载自定义校验器脚本 "${U}" 失败(语法错误或依赖缺失: ${I?.message??I}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:zz}}}function UP0($,Y){return async(U,I)=>{try{let Q=await $(U,I);if(Q&&typeof Q==="object"&&typeof Q.score==="number"&&Array.isArray(Q.issues))return Q;return console.error("⚠️ [linter] 自定义校验器返回值格式不符合 RuleLintResult 契约,已回退至内置结果。"),Y(U,I)}catch(Q){return console.error("⚠️ [linter] 自定义校验器执行异常:",Q),Y(U,I)}}}var NP;var KP0=m(()=>{Qp();td();$p();Up();ed();NP=B8(process.cwd(),"linters")});async function Kp($,Y,U){let I=await Y.linter($,U);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:I.score,passed:I.passed,issues:I.issues,description:$.description}}async function zP0($,Y,U,I){let Q=I?.minScore??0,J=I?.level??"all",K=[],z=0;for(let q of $){let V=await Kp(q,Y,U);z+=V.score;let w=V.issues;if(J==="error")w=V.issues.filter((F)=>F.level==="error");else if(J==="warning")w=V.issues.filter((F)=>F.level==="warning"||F.level==="error");let M=w.every((F)=>F.level!=="error");if(I?.summary){if(w.length>0)K.push({...V,passed:M,issues:w})}else K.push({...V,passed:M,issues:w})}let G=$.length,H=G===Line truncated
`,"utf8"),U}function XP0($){return $.map((Y,U)=>{let I;if(typeof Y.code==="number")I=`#${String(Y.code).padStart(4,"0")}`;else if(typeof Y.code==="string")I=Y.code.startsWith("#")?Y.code:`#${Y.code}`;else I=`#${String(U+1).padStart(4,"0")}`;return{id:Y.id,code:I,name:Y.name,description:Y.description,scope:Y.scope,strictness:Y.strictness}})}var ZP0=()=>{};var q$4,V$4,EP1,L$4,jP1,F$4,w$4,qP0,M$4,O$4,VP0,N$4,D$4,B$4,A$4,P$4,T$4,E$4,j$4,C$4,R$4,_$4,v$4,S$4,h$4,g$4,y$4,k$4,x$4,f$4,u$4,b$4,i$4,c$4,n$4,d$4,p$4,Hp,CP1,RP1,LP0,_P1,m$4,l$4,o$4,r$4,s$4,a$4,FP0,t$4,e$4,vP1,wP0,$54,Y54,U54,I54,Q54,J54,K54,z54,G54,H54,W54,X54,Z54,q54,V54,L54,F54,w54,MP0;var OP0=m(()=>{z6();W4();o$();bA0();lA0();ad();zp();ZP0();r$();({presentWebhookIntegration:q$4,getConfiguredSealBaseUrl:V$4,projectApprovalRules:EP1,pickRuleFields:L$4,buildRulePushPlan:jP1,rulesHaveSameContent:F$4,ruleChangedFields:w$4,normalizeRuleStrictness:qP0,parseDurationMs:M$4,redactIntegrationSecrets:O$4,mutationPreview:VP0,redactPreviewValue:N$4,buildSimulationBatchParams:D$4,summarizeSimulationBatch:B$4,summarizeApprovalRun:A$4,summarizeApprovalRuns:P$4,parseFieldPaths:T$4,pickRunFields:E$4,approvalRunMetadata:j$4,summarizeApprovalRunDetail:C$4,summarizeApprovalRunResult:R$4,summarizeApprovalRunDocument:_$4,extractCitedRules:v$4,firstPath:S$4,countPathCandidates:h$4,getPath:g$4,setPath:y$4,compactObject:k$4,asRecord:x$4,numberFromUnknown:f$4,flattenDocumentFields:u$4,collectDocumentFields:b$4,firstByLabel:i$4,collectInvoiceSummary:c$4,collectInvoiceObjects:n$4,findKeywordLines:d$4,summarizeRunBridge:p$4,summarizeRuleVersion:Hp,resolveRuleVersionForLookup:CP1,findRuleInVersion:RP1,normalizeRuleCode:LP0,runtimeRuleIndex:_P1,runtimeRuleIdToCode:m$4,formatRuleCode:l$4,pickApprovalRunCandidate:o$4,resolveApprovalRunForUrl:r$4,resolveSealBaseUrl:s$4,normalizeUrl:a$4,stringFromUnknown:FP0,pickApprovalRuns:t$4,timestampOf:e$4,resolveRuleVersion:vP1,resolveRuleVersionSelector:wP0,filterRuns:$54,scalarIncludes:Y54,objectContainsScalar:U54,filterRunsByHumanResult:I54,withApprovalRunFilters:Q54,resolveManualApprovalStatus:J54,prepareApprovalRuns:K54,approvalRunAliases:z54,extractHumanResult:G54,findHumanResultValue:H54,isHumanResultKey:W54,stringifyHumanResultValue:X54,matchesRunLookup:Z54,countBy:q54,localDateKey:V54,formatLocalDateTime:L54,toDate:F54,localParts:w54}=K8),MP0=[{name:"seal_approval_rules_list",description:"列出 Seal 当前草稿审批规则;返回的 code 属于草稿编号体系,发布版本可能重新编码;支持 countOnly、fields、limit 以避免返回规则正文",parameters:L.object({countOnly:L.boolean().optional().describe("只返回规则数量,不返回规则列表"),fields:L.array(L.enum(["id","code","tenantId","status","strictness","scope","createdAt","updatedAt","description"])).optional().describe("只返回指定字段;不传则返回完整规则"),limit:L.number().int().nonnegative().optional().describe("最多返回多少条规则;0 可配合 fields 或 countOnly 只取数量"),offset:L.number().int().nonnegative().optional().describe("跳过前多少条规则")}),handler:async($,Y)=>{let U=await q6($);return EP1(U,Y)}},{name:"seal_approval_rules_clear",description:"清空 Seal 当前草稿审批规则;用于测试环境导入规则前重置草稿规则集",parameters:L.object({dryRun:L.boolean().optional().describe("只预览将删除的规则数量,不执行删除"),recode:L.boolean().optional().describe("删除后尝试重新编排规则编号;失败会作为 warning 返回")}),handler:async($,Y,U)=>{let I=await q6($);if(Y.dryRun)return{...VP0(U,"api/v1/rules",I.rules,[],I.rules.length),corpId:U.corp.id,corpName:U.corp.name,dryRun:!0,beforeCount:I.rules.length,deleted:0,afterCount:I.rules.length,hasPendingDeletes:I.hasPendingDeletes};let Q=[],J=0;for(let H of I.rules)try{await YJ($,H.id),J+=1}catch(W){Q.push({ruleId:H.id,error:o8(W instanceof Error?W.message:String(W))})}let K=[],z;if(J>0&&Y.recode!==!1){if(z=await SM($),z&&typeof z==="object"&&"ok"in z&&z.ok!==!0)K.push("batch-recode did not complete; current rules were still deleted")}let G=await q6($);return{corpId:U.corp.id,corpName:U.corp.name,dryRun:!1,beforeCount:I.rules.length,deleted:J,failed:Q,afterCount:G.rules.length,hasPendingDeletes:G.hasPendingDeletes,warnings:K,recode:z}}},{name:"seal_approval_rule_create",description:"新建 Seal 草稿审批规则",parameters:L.object({description:L.string().describe("规则描述"),scope:L.string().describe("适用场景"),strictness:L.enum(["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]).describe("严格程度")}),handler:async($,Y)=>bH($,Y)},{name:"seal_approval_rule_update",description:"更新 Seal 草稿审批规则",parameters:L.object({ruleId:L.string().describe("规则 ID"),description:L.string().optional(),scope:L.string().optional(),strictness:L.enum(["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]).optional()}),handler:async($,Y)=>{let U=Y.ruleId;if(U&&(U.startsWith("#")||U.startsWith("rule-")||U.match(/^\d+$/ Line truncated
`)},{...rd(J,20000,Y.full===!0),format:Y.format??"unified"}}},{name:"seal_approval_rule_version_publish",description:"发布 Seal 草稿审批规则为新版本",parameters:L.object({versionName:L.string().describe("版本名称")}),handler:async($,Y,U)=>{let I=await q6($).catch(()=>{return}),Q=await iH($,Y.versionName);if(I)try{oZ(U.corp.id,Q.version,I.rules)}catch{}return Q}},{name:"seal_approval_rule_get",description:"按版本号/code/runtime-id/record-id 定位单条规则;code 只在选定的版本编号体系内有效,避免拉取整版规则快照",parameters:L.object({versionId:L.string().optional().describe("规则版本 ID"),versionNumber:L.number().int().positive().optional().describe("规则版本号"),latest:L.boolean().optional().describe("为 true 时取最新版本"),code:L.string().optional().describe("规则展示编号,如 #0038;没有后端 code 时按版本内序号匹配"),runtimeId:L.string().optional().describe("运行时规则 ID,如 rule-205;按版本内序号匹配"),recordId:L.string().optional().describe("从运行记录推断 ruleSetVersionNumber")}),handler:async($,Y)=>{let U=await CP1($,Y),I=RP1(U,{code:Y.code,runtimeId:Y.runtimeId});if(!I)throw Error(`Rule not found in version ${U.versionNumber}`);return I}},{name:"seal_approval_rules_lint",description:"对 Seal 本地规则文件、草稿审批规则或指定发布版本规则进行质量与可执行性检查(模糊词、悬空例外检测)",parameters:L.object({file:L.string().optional().describe("指定本地规则文件路径进行离线质检(支持 .json),0网络请求、不污染远端草稿"),linter:L.string().optional().describe("指定使用的校验器名称或脚本路径(如 builtin、strict、./my-linter.ts)"),version:L.string().optional().describe("指定要质检的历史发布版本号或 ID(如 16 或 latest),不传默认质检当前草稿"),code:L.string().optional().describe("按规则展示编号过滤(如 #0038)"),ruleId:L.string().optional().describe("按规则 ID 过滤"),minScore:L.number().optional().describe("最低合格质量分阈值(0~100),低于该分值抛出错误以返回非零退出码"),level:L.enum(["all","error","warning"]).default("all").describe("问题报告等级过滤"),summary:L.boolean().optional().describe("为 true 时仅返回存在瑕疵/扣分的规则")}),handler:async($,Y,U)=>{let I=[],Q;if(Y.file){let H=Gp(Y.file);I=XP0(H.rules),Q=H.meta.versionNumber}else if(Y.version){let H=await S8($),W=Number(Y.version),X=isNaN(W)?Y.version==="latest"?H[0]:H.find((Z)=>Z.id===Y.version):H.find((Z)=>Z.versionNumber===W);if(!X)throw Error(`未找到指定的规则版本: ${Y.version}`);Q=X.versionNumber,I=(X.rules??[]).map((Z,q)=>({id:Z.id??Z.runtimeId,code:Z.code??`#${String(q+1).padStart(4,"0")}`,name:Z.name??Z.title,description:Z.description??"",scope:Z.scope,strictness:Z.strictness}))}else I=((await q6($)).rules??[]).map((W,X)=>({id:W.id,code:W.code??`#${String(X+1).padStart(4,"0")}`,name:W.name??W.title,description:W.description??"",scope:W.scope,strictness:W.strictness}));if(Y.code)I=I.filter((H)=>H.code===Y.code||H.code?.replace(/[#\s]/g,"")===Y.code?.replace(/[#\s]/g,""));if(Y.ruleId)I=I.filter((H)=>H.id===Y.ruleId||H.code===Y.ruleId);let J=A4(),K=Y.linter??J.lint?.activeLinter??"builtin",z=await Jp(K),G=await zP0(I,z,{corpId:U?.corp?.id,versionNumber:Q,allRules:I},{minScore:Y.minScore,level:Y.level,summary:Y.summary});if(Y.minScore&&G.overallScore<Y.minScore)throw Error(`[Linter 质量门禁未通过] 综合评分 ${G.overallScore} 低于要求的最低分 ${Y.minScore} 分 (共发现 ${G.issueCount} 条问题规则)。`);return G}},{name:"seal_approval_rules_pull",description:"从 Seal 远端拉取草稿或指定版本规则,保存至本地规则文件(支持离线编辑与本地 Lint,绝不污染远端草稿)",parameters:L.object({version:L.string().optional().describe("指定拉取的历史发布版本号或 ID(如 16 或 latest),不传默认拉取当前草稿规则"),out:L.string().optional().describe("保存的目标本地文件路径,默认为 ./rules.local.json")}),handler:async($,Y,U)=>{let I=Y.out??"./rules.local.json",Q=[],J="draft",K;if(Y.version){let G=await S8($),H=Number(Y.version),W=isNaN(H)?Y.version==="latest"?G[0]:G.find((X)=>X.id===Y.version):G.find((X)=>X.versionNumber===H);if(!W)throw Error(`未找到指定的规则版本: ${Y.version}`);K=W.versionNumber,J=`version:${K}`,Q=(W.rules??[]).map((X,Z)=>({code:X.code?Number(String(X.code).replace(/^#/,""))||Z+1:Z+1,name:X.name??X.title,description:X.description??"",scope:X.scope??"ALL",strictness:X.strictness??"MUST_FOLLOW"}))}else Q=((await q6($)).rules??[]).map((H,W)=>({id:H.id,code:H.code??W+1,name:H.name??H.title,description:H.description??"",scope:H.scope??"ALL",strictness:H.strictness??"MUST_FOLLOW",status:H.status}));return{saved:!0,path:WP0(I,{corpId:U.corp.id,source:J,versionNumber:K,exportedAt:new Date().toISOString(),rulesCount:Q.length,rules: Line truncated
`+"为防止测试单据污染生产审批流,禁止向生产环境重放单据。请指定测试企业 (--target-corp <testCorpId>),或在确有需要时添加 --force。",1,`seal-use webhook replay --target-corp <testCorpId>${U.id!==I.id?` --source-corp ${U.id}`:""}`);return{sourceCorp:U,targetCorp:I}}async function Zp($,Y,U){let I=Y.seal?.endpoints?.approvalStylePreferences??"api/v1/agent/ai-approval/config",Q=await q$($,I);if(U||Q.length>0)return DP0(Q,U,Y.id);if(Y.environment==="test"||Y.id.toLowerCase().includes("test")){console.error(`[webhook-replay] 测试企业「${Y.name}」未配置 Webhook 通道,正在自动创建「(Seal测-回放通道)」...`);let J=(Y.seal.url??Y.source?.sealUrl??`https://${Y.id.toLowerCase()}.sealai.cc`).replace(/\/+$/,"");return await kM($,J,{name:"(Seal测-回放通道)",mode:"assisted",outgoingResultWebhook:`${J}/api/v1/integrations/webhook/replay-mock-callback`},Y.seal.endpoints.approvalStylePreferences)}throw new z4(`当前租户「${Y.name}」未配置任何 Webhook 集成通道。`,1,`seal-use webhook add --name <name> --result-url <url> --corp ${Y.id}`)}async function Hz($){let{query:Y,sourceClient:U,targetClient:I,sourceCorp:Q,targetCorp:J,webhookSelector:K,snPrefix:z,snSuffix:G,docIdPrefix:H,docIdSuffix:W,dryRun:X,fetchFn:Z=fetch}=$,q=[];if(Y.recordId){let P=await H4(U,Y.recordId);q.push(P)}else if(Y.recordIds&&Y.recordIds.length>0)for(let P of Y.recordIds)q.push(await H4(U,P));else if(Y.sn){let T=(await x4(U,{search:Y.sn,sourceDocumentSN:Y.sn,limit:20})).records.find((B)=>B.sourceDocumentSN===Y.sn||B.sourceDocumentId===Y.sn||B.document?.sourceDocumentSN===Y.sn||B.document?.sn===Y.sn);if(!T)throw Error(`在企业「${Q.name}」中未找到单据编号为「${Y.sn}」的审批记录。`);q.push(T)}else if(Y.sns&&Y.sns.length>0)for(let P of Y.sns){let B=(await x4(U,{search:P,sourceDocumentSN:P,limit:20})).records.find((E)=>E.sourceDocumentSN===P||E.sourceDocumentId===P||E.document?.sourceDocumentSN===P||E.document?.sn===P);if(!B)throw Error(`在企业「${Q.name}」中未找到单据编号为「${P}」的审批记录。`);q.push(B)}else if(Y.limit!==void 0){let P=await x4(U,{limit:Y.limit,status:Y.status,startDate:Y.startDate,endDate:Y.endDate});if(!P.records.length)throw Error(`在企业「${Q.name}」中未检索到符合条件的审批记录。`);q=P.records}else throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let V=q.map((P)=>({run:P,doc:Wp(P,{snPrefix:z,snSuffix:G,docIdPrefix:H,docIdSuffix:W})}));if(X){let P={id:"preview-webhook",name:K??"预览目标通道",mode:"assisted",incomingDocumentWebhookUrl:`${J.seal.url}/api/v1/integrations/webhook/preview`};try{let E=await q$(I,J.seal.endpoints.approvalStylePreferences);if(E.length>0){let C=DP0(E,K,J.id);P={id:C.id,name:C.name,mode:C.mode,incomingDocumentWebhookUrl:C.incomingDocumentWebhook.url}}}catch{}let T=V.map(({run:E,doc:C})=>({originalRecord:{id:E.id,sourceSystem:E.sourceSystem,sourceDocumentSN:E.sourceDocumentSN,sourceDocumentId:E.sourceDocumentId},document:C,success:!0})),B=T.length===1;return{dryRun:!0,success:!0,sourceCorp:{id:Q.id,name:Q.name,environment:Q.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:P,totalCount:T.length,successCount:T.length,failureCount:0,originalRecord:B?T[0].originalRecord:void 0,document:B?T[0].document:void 0,records:T}}let w=await Zp(I,J,K),M={id:w.id,name:w.name,mode:w.mode,incomingDocumentWebhookUrl:w.incomingDocumentWebhook.url},F=[],N=0,O=0;for(let{run:P,doc:T}of V){console.error(`[webhook-replay] 正在向 Webhook 通道「${w.name}」推送单据: ${T.documentSN}...`);try{let B=await Xp(w.incomingDocumentWebhook.url,w.secret,T,Z,P6(J.seal));F.push({originalRecord:{id:P.id,sourceSystem:P.sourceSystem,sourceDocumentSN:P.sourceDocumentSN,sourceDocumentId:P.sourceDocumentId},replayedDocument:{documentSN:T.documentSN,documentId:T.documentId,fieldCount:T.fields.length},pushResult:B,success:!0}),N+=1}catch(B){let E=B instanceof Error?B.message:String(B);F.push({originalRecord:{id:P.id,sourceSystem:P.sourceSystem,sourceDocumentSN:P.sourceDocumentSN,sourceDocumentId:P.sourceDocumentId},replayedDocument:{documentSN:T.documentSN,documentId:T.documentId,fieldCount:T.fields.length},error:E,success:!1}),O+=1}}let D=F.length===1;return{success:O===0,dryRun:!1,sourceCorp:{id:Q.id,name:Q.name,environment:Q.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:M,totalCount:F.length,successCount:N,failureCount:O,originalRecord:D?F[0].originalRecord:void 0,replayedDocument:D?F[0].replayedDocument:void 0,pushResult:D?F[0].pushResult:void 0,records:F}}var kP1;var aZ=m(()=>{DP();BP();W4();kP1=new Set(["TEXT","NUMBER","DATE","AMOUNT","PERSON","ATTACHMENT","DATE_RANGE","DEPARTMENT","LIST","CITY","OBJECT"])});var BP0,_5;var Wz=m(()=>{BP0=class BP0 extends Error{errors;warnings;constructor($,Y= Line truncated
`));this.errors=$;this.warnings=Y;this.name="ResourcePackValidationError"}};_5=BP0});var EP0=j((j54,TP0)=>{TP0.exports=PP;function PP(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}PP.prototype.go=function($){if(this.pending<this.max)PP0(this,$);else this.waiting.push($)};PP.prototype.wait=function($){if(this.pending===0)$(this.error);else this.listeners.push($)};PP.prototype.hold=function(){return AP0(this)};function AP0($){$.pending+=1;var Y=!1;return U;function U(Q){if(Y)throw Error("callback called twice");if(Y=!0,$.error=$.error||Q,$.pending-=1,$.waiting.length>0&&$.pending<$.max)PP0($,$.waiting.shift());else if($.pending===0){var J=$.listeners;$.listeners=[],J.forEach(I)}}function I(Q){Q($.error)}}function PP0($,Y){Y(AP0($))}});var RP0=j((bP1)=>{var qp=K0("fs"),Vp=K0("util"),jP0=K0("stream"),CP0=jP0.Readable,fP1=jP0.PassThrough,uP1=EP0(),TP=K0("events").EventEmitter;bP1.BufferSlicer=Zz;bP1.FdSlicer=Xz;Vp.inherits(Xz,TP);function Xz($){TP.call(this),this.fd=$,this.pend=new uP1,this.pend.max=1,this.refCount=0}Xz.prototype.read=function($,Y,U,I,Q){var J=this;J.pend.go(function(K){qp.read(J.fd,$,Y,U,I,function(z,G,H){K(),Q(z,G,H)})})};Xz.prototype.createReadStream=function($){return new tZ(this,$)};Xz.prototype.ref=function(){this.refCount+=1};Xz.prototype.unref=function(){var $=this;if($.refCount-=1,$.refCount<0)throw Error("invalid unref");if($.refCount>0)return;qp.close($.fd,Y);function Y(U){if(U)$.emit("error",U);else $.emit("close")}};Vp.inherits(tZ,CP0);function tZ($,Y){Y=Y||{},CP0.call(this,Y),this.context=$,this.context.ref(),this.start=Y.start||0,this.endOffset=Y.end,this.pos=this.start}tZ.prototype._read=function($){var Y=this,U=Math.min(Y._readableState.highWaterMark,$);if(Y.endOffset!=null)U=Math.min(U,Y.endOffset-Y.pos);if(U<=0){Y.push(null),this._cleanup();return}Y.context.pend.go(function(I){var Q=Buffer.allocUnsafe(U);qp.read(Y.context.fd,Q,0,U,Y.pos,function(J,K){if(J)Y.destroy(J);else if(K===0)Y.push(null),Y._cleanup();else Y.pos+=K,Y.push(Q.slice(0,K));I()})})};tZ.prototype._destroy=function($,Y){this._cleanup(),Y($)};tZ.prototype._cleanup=function(){if(this.context!=null)this.context.unref(),this.context=null};Vp.inherits(Zz,TP);function Zz($){TP.call(this),this.refCount=0,this.buffer=$}Zz.prototype.read=function($,Y,U,I,Q){if(!(0<=Y&&Y<=$.length))throw RangeError("offset outside buffer: 0 <= "+Y+" <= "+$.length);if(I<0)throw RangeError("position is negative: "+I);if(Y+U>$.length)U=$.length-Y;if(I+U>this.buffer.length)U=this.buffer.length-I;if(U<=0){setImmediate(function(){Q(null,0)});return}this.buffer.copy($,Y,I,I+U),setImmediate(function(){Q(null,U)})};Zz.prototype.createReadStream=function($){$=$||{};var Y=new fP1($);Y.start=$.start||0,Y.endOffset=$.end,Y.pos=Y.endOffset||this.buffer.length;var U=this.buffer.slice(Y.start,Y.pos),I=65536,Q=0;while(!0){var J=Q+I;if(J>=U.length){if(Q<U.length)Y.write(U.slice(Q,U.length));break}Y.write(U.slice(Q,J)),Q=J}return Y.end(),Y};Zz.prototype.ref=function(){this.refCount+=1};Zz.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")}});var vP0=j((R54,_P0)=>{var nP1=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462, Line truncated
`}});import{homedir as FP1}from"node:os";import{join as Jp}from"node:path";var wP1,P$,T$;var Kp=m(()=>{wP1=Jp(FP1(),".config","seal-use"),P$=Jp(wP1,"linters"),T$=Jp(P$,"official")});import{existsSync as AI,mkdirSync as MP1,readFileSync as OP1,readdirSync as HP0,rmSync as NP1,unlinkSync as DP1,writeFileSync as BP1}from"node:fs";import{isAbsolute as AP1,join as P8,resolve as PP1}from"node:path";import{pathToFileURL as zP0}from"node:url";function WP0($=T$){let Y=[],U=[];try{if(!AI($))MP1($,{recursive:!0});let I=Object.keys(Ip);for(let[J,K]of Object.entries(Ip)){let z=P8($,J),G=!0;if(AI(z))try{if(OP1(z,"utf8")===K)G=!1}catch{G=!0}if(G)BP1(z,K,"utf8");Y.push(J)}let Q=HP0($,{withFileTypes:!0});for(let J of Q)if(!I.includes(J.name)){let K=P8($,J.name);try{if(J.isDirectory())NP1(K,{recursive:!0,force:!0});else DP1(K);U.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:U}}function XP0($={syncOfficial:!0}){if($.syncOfficial!==!1)WP0();let Y=[{name:"builtin",type:"builtin",path:P8(T$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:P8(T$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:P8(T$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],U=[P$,AP];for(let I of U)if(AI(I))try{let Q=HP0(I,{withFileTypes:!0});for(let J of Q){if(J.isDirectory())continue;let K=J.name;if(K.endsWith(".ts")||K.endsWith(".js")||K.endsWith(".mjs")){let z=K.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===z))Y.push({name:z,type:"custom",path:P8(I,K),description:`用户自定义规则校验器 (${K})`})}}}catch{}return Y}function TP1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:P8(T$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:P8(T$,"strict.ts"),isOfficial:!0,officialKind:"strict"};if(Y==="hlab"||Y==="hlab-sop"||Y==="hlab-rules"||Y==="hlab-standard"||Y==="official/hlab"||Y==="official/hlab.ts")return{path:P8(T$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(AP1(Y)||Y.startsWith("./")||Y.startsWith("../")){let I=PP1(Y);if(AI(I))return{path:I};for(let Q of[".ts",".js",".mjs"])if(AI(`${I}${Q}`))return{path:`${I}${Q}`}}let U=[P8(P$,`${Y}.ts`),P8(P$,`${Y}.js`),P8(P$,`${Y}.mjs`),P8(AP,`${Y}.ts`),P8(AP,`${Y}.js`),P8(AP,`${Y}.mjs`)];for(let I of U)if(AI(I))return{path:I};return{}}async function zp($){WP0();let Y=TP1($??"builtin");if(Y.isOfficial){let I=Y.officialKind==="strict"?JP0:Y.officialKind==="hlab"?KP0:Wz,Q=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&AI(J))try{let z=await import(zP0(J).href),G=z.default??z.lintRule??z.linter??z.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:GP0(G,I)}}catch{}return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:I}}let U=Y.path;if(!U)return console.error(`⚠️ [linter] 未找到自定义校验器 "${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:Wz};try{let Q=await import(zP0(U).href),J=Q.default??Q.lintRule??Q.linter??Q.lint;if(typeof J!=="function")return console.error(`⚠️ [linter] 自定义校验器 "${U}" 未导出标准函数 (default / lintRule),已安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:Wz};return{name:$??"custom",type:"custom",filePath:U,linter:GP0(J,Wz)}}catch(I){return console.error(`⚠️ [linter] 加载自定义校验器脚本 "${U}" 失败(语法错误或依赖缺失: ${I?.message??I}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:Wz}}}function GP0($,Y){return async(U,I)=>{try{let Q=await $(U,I);if(Q&&typeof Q==="object"&&typeof Q.score==="number"&&Array.isArray(Q.issues))return Q;return console.error("⚠️ [linter] 自定义校验器返回值格式不符合 RuleLintResult 契约,已回退至内置结果。"),Y(U,I)}catch(Q){return console.error("⚠️ [linter] 自定义校验器执行异常:",Q),Y(U,I)}}}var AP;var ZP0=m(()=>{Kp();$p();Up();Qp();Yp();AP=P8(process.cwd(),"linters")});async function Gp($,Y,U){let I=await Y.linter($,U);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:I.score,passed:I.passed,issues:I.issues,description:$.description}}async function qP0($,Y,U,I){let Q=I?.minScore??0,J=I?.level??"all",K=[],z=0;for(let q of $){let V=await Gp(q,Y,U);z+=V.score;let w=V.issues;if(J==="error")w=V.issues.filter((F)=>F.level==="error");else if(J==="warning")w=V.issues.filter((F)=>F.level==="warning"||F.level==="error");let M=w.every((F)=>F.level!=="error");if(I?.summary){if(w.length>0)K.push({...V,passed:M,issues:w})}else K.push({...V,passed:M,issues:w})}let G=$.length,H=G===Line truncated
`,"utf8"),U}function MP0($){return $.map((Y,U)=>{let I=FP0(Y.code),Q;if(I!==void 0)Q=String(I).padStart(4,"0");else if(typeof Y.code==="string"&&Y.code.trim())Q=Y.code.trim().replace(/^#/,"");else Q=String(U).padStart(4,"0");return{id:Y.id,code:Q,name:Y.name,description:Y.description,scope:Y.scope,strictness:Y.strictness}})}var OP0=()=>{};var O$4,N$4,NP0,D$4,SP1,B$4,A$4,DP0,P$4,T$4,BP0,E$4,j$4,C$4,R$4,_$4,v$4,S$4,h$4,g$4,y$4,k$4,x$4,f$4,u$4,b$4,i$4,c$4,n$4,d$4,p$4,m$4,l$4,o$4,r$4,s$4,a$4,Xp,hP1,gP1,yP1,d3,Xz,t$4,e$4,PP,$54,Y54,U54,I54,Q54,J54,K54,kP1,Zp,z54,G54,H54,W54,X54,Z54,q54,V54,L54,F54,w54,M54,O54,N54,D54,B54,A54,P54,AP0;var PP0=m(()=>{H6();W4();r$();mA0();eA0();ed();Hp();OP0();a$();({presentWebhookIntegration:O$4,getConfiguredSealBaseUrl:N$4,projectApprovalRules:NP0,pickRuleFields:D$4,buildRulePushPlan:SP1,rulesHaveSameContent:B$4,ruleChangedFields:A$4,normalizeRuleStrictness:DP0,parseDurationMs:P$4,redactIntegrationSecrets:T$4,mutationPreview:BP0,redactPreviewValue:E$4,buildSimulationBatchParams:j$4,summarizeSimulationBatch:C$4,summarizeApprovalRun:R$4,summarizeApprovalRuns:_$4,parseFieldPaths:v$4,pickRunFields:S$4,approvalRunMetadata:h$4,summarizeApprovalRunDetail:g$4,summarizeApprovalRunResult:y$4,summarizeApprovalRunDocument:k$4,extractCitedRules:x$4,firstPath:f$4,countPathCandidates:u$4,getPath:b$4,setPath:i$4,compactObject:c$4,asRecord:n$4,numberFromUnknown:d$4,flattenDocumentFields:p$4,collectDocumentFields:m$4,firstByLabel:l$4,collectInvoiceSummary:o$4,collectInvoiceObjects:r$4,findKeywordLines:s$4,summarizeRunBridge:a$4,summarizeRuleVersion:Xp,resolveRuleVersionForLookup:hP1,findRuleInDraft:gP1,findRuleInVersion:yP1,parseRuleCodeNumber:d3,normalizeRuleCode:Xz,runtimeRuleIndex:t$4,runtimeRuleIdToCode:e$4,formatRuleCode:PP,pickApprovalRunCandidate:$54,resolveApprovalRunForUrl:Y54,resolveSealBaseUrl:U54,normalizeUrl:I54,stringFromUnknown:Q54,pickApprovalRuns:J54,timestampOf:K54,resolveRuleVersion:kP1,resolveRuleVersionSelector:Zp,filterRuns:z54,scalarIncludes:G54,objectContainsScalar:H54,filterRunsByHumanResult:W54,withApprovalRunFilters:X54,resolveManualApprovalStatus:Z54,prepareApprovalRuns:q54,approvalRunAliases:V54,extractHumanResult:L54,findHumanResultValue:F54,isHumanResultKey:w54,stringifyHumanResultValue:M54,matchesRunLookup:O54,countBy:N54,localDateKey:D54,formatLocalDateTime:B54,toDate:A54,localParts:P54}=G8),AP0=[{name:"seal_approval_rules_list",description:"列出 Seal 审批规则(默认当前草稿,传 version='latest' 或版本号则列出对应已发布版本);支持 countOnly、fields、limit",parameters:L.object({version:L.string().optional().describe("可选发布版本号或 'latest';不传则读取当前草稿"),countOnly:L.boolean().optional().describe("只返回规则数量,不返回规则列表"),fields:L.array(L.enum(["id","code","tenantId","status","strictness","scope","createdAt","updatedAt","description"])).optional().describe("只返回指定字段;不传则返回完整规则"),limit:L.number().int().nonnegative().optional().describe("最多返回多少条规则;0 可配合 fields 或 countOnly 只取数量"),offset:L.number().int().nonnegative().optional().describe("跳过前多少条规则")}),handler:async($,Y)=>{if(Y.version){let I=await Zp($,Y.version),Q=(I.rules??[]).map((K)=>({id:K.id??String(K.code),tenantId:K.tenantId??"",code:d3(K.code)??K.code,description:K.description,scope:K.scope,strictness:K.strictness,status:typeof K.status==="string"?K.status:"published",createdAt:K.createdAt??I.publishedAt??I.createdAt??0,updatedAt:K.updatedAt??I.publishedAt??I.createdAt??0}));return{...NP0({rules:Q,hasPendingDeletes:!1},Y),versionNumber:I.versionNumber,versionName:I.versionName??null}}let U=await U6($);return NP0(U,Y)}},{name:"seal_approval_rules_clear",description:"清空 Seal 当前草稿审批规则;用于测试环境导入规则前重置草稿规则集",parameters:L.object({dryRun:L.boolean().optional().describe("只预览将删除的规则数量,不执行删除"),recode:L.boolean().optional().describe("删除后尝试重新编排规则编号;失败会作为 warning 返回")}),handler:async($,Y,U)=>{let I=await U6($);if(Y.dryRun)return{...BP0(U,"api/v1/rules",I.rules,[],I.rules.length),corpId:U.corp.id,corpName:U.corp.name,dryRun:!0,beforeCount:I.rules.length,deleted:0,afterCount:I.rules.length,hasPendingDeletes:I.hasPendingDeletes};let Q=[],J=0;for(let H of I.rules)try{await JJ($,H.id),J+=1}catch(W){Q.push({ruleId:H.id,error:r8(W instanceof Error?W.message:String(W))})}let K=[],z;if(J>0&&Y.recode!==!1){if(z=await yM($),z&&typeof z==="object"&&"ok"in z&&z.ok!==!0)K.push("batch-recode did not complete; current rules were still deleted")}let G=await U6($);return{corpId:U.corp.id,corpName:U.corp.name,dryRun:!1,beforeCount:I.rules.length,deleted:J,failed:Q,afterCount:G.rules.length,hasPendingDeletes:G.hasPendingDeletes,warnings:K,recode:z}}},{name:"seal_approval_rule_create",description:"新建 Seal 草稿审批规则",parameters:L.object({ Line truncated
`)},{...td(J,20000,Y.full===!0),format:Y.format??"unified"}}},{name:"seal_approval_rule_version_publish",description:"发布 Seal 草稿审批规则为新版本",parameters:L.object({versionName:L.string().describe("版本名称")}),handler:async($,Y,U)=>{let I=await U6($).catch(()=>{return}),Q=await pH($,Y.versionName);if(I)try{eZ(U.corp.id,Q.version,I.rules)}catch{}return Q}},{name:"seal_approval_rule_get",description:"按规则编号 code(或规则 ID)获取单条规则详情;默认读取当前草稿(含规则 ID),指定 version 或 recordId 时读取对应发布版本快照",parameters:L.object({versionId:L.string().optional().describe("规则版本 ID"),versionNumber:L.number().int().positive().optional().describe("规则版本号"),latest:L.boolean().optional().describe("为 true 时取最新已发布版本"),code:L.string().optional().describe("规则编号(如 0025)"),runtimeId:L.string().optional().describe("规则编号兼容别名"),ruleId:L.string().optional().describe("规则 ID 兼容别名"),recordId:L.string().optional().describe("从审批运行记录推断所使用的已发布版本")}),handler:async($,Y,U)=>{let I={code:Y.code,runtimeId:Y.runtimeId,ruleId:Y.ruleId},Q=Boolean(Y.versionId||Y.versionNumber||Y.latest||Y.recordId),J=await U6($).catch(()=>{return});if(!Q&&J?.rules){let H=gP1(J.rules,I);if(H)return H}let K=await hP1($,Y).catch((H)=>{if(!Q&&J?.rules)throw Error(`Rule not found in current draft: ${Y.code??Y.runtimeId??Y.ruleId??""}`);throw H}),z=U?.corp?.id?BP(U.corp.id,K):K,G=yP1(z,I,J?.rules);if(!G)throw Error(Q?`Rule not found in version ${z.versionNumber}`:`Rule not found in current draft or version ${z.versionNumber}`);return G}},{name:"seal_approval_rules_lint",description:"对 Seal 本地规则文件、草稿审批规则或指定发布版本规则进行质量与可执行性检查(模糊词、悬空例外检测)",parameters:L.object({file:L.string().optional().describe("指定本地规则文件路径进行离线质检(支持 .json),0网络请求、不污染远端草稿"),linter:L.string().optional().describe("指定使用的校验器名称或脚本路径(如 builtin、strict、./my-linter.ts)"),version:L.string().optional().describe("指定要质检的历史发布版本号或 ID(如 16 或 latest),不传默认质检当前草稿"),code:L.string().optional().describe("按规则编号过滤(如 25)"),ruleId:L.string().optional().describe("按规则 ID 过滤"),minScore:L.number().optional().describe("最低合格质量分阈值(0~100),低于该分值抛出错误以返回非零退出码"),level:L.enum(["all","error","warning"]).default("all").describe("问题报告等级过滤"),summary:L.boolean().optional().describe("为 true 时仅返回存在瑕疵/扣分的规则")}),handler:async($,Y,U)=>{let I=[],Q;if(Y.file){let H=Wp(Y.file);I=MP0(H.rules),Q=H.meta.versionNumber}else if(Y.version){let H=await h8($),W=Number(Y.version),X=isNaN(W)?Y.version==="latest"?H[0]:H.find((Z)=>Z.id===Y.version):H.find((Z)=>Z.versionNumber===W);if(!X)throw Error(`未找到指定的规则版本: ${Y.version}`);Q=X.versionNumber,I=(X.rules??[]).map((Z,q)=>({id:Z.id??Z.runtimeId,code:Xz(Z.code)??PP(q),name:Z.name??Z.title,description:Z.description??"",scope:Z.scope,strictness:Z.strictness}))}else I=((await U6($)).rules??[]).map((W,X)=>({id:W.id,code:Xz(W.code)??PP(X),name:W.name??W.title,description:W.description??"",scope:W.scope,strictness:W.strictness}));if(Y.code){let H=Xz(Y.code);I=I.filter((W)=>Xz(W.code)===H)}if(Y.ruleId){let H=Xz(Y.ruleId);I=I.filter((W)=>W.id===Y.ruleId||H!==void 0&&Xz(W.code)===H)}let J=P4(),K=Y.linter??J.lint?.activeLinter??"builtin",z=await zp(K),G=await qP0(I,z,{corpId:U?.corp?.id,versionNumber:Q,allRules:I},{minScore:Y.minScore,level:Y.level,summary:Y.summary});if(Y.minScore&&G.overallScore<Y.minScore)throw Error(`[Linter 质量门禁未通过] 综合评分 ${G.overallScore} 低于要求的最低分 ${Y.minScore} 分 (共发现 ${G.issueCount} 条问题规则)。`);return G}},{name:"seal_approval_rules_pull",description:"从 Seal 远端拉取草稿或指定版本规则,保存至本地规则文件(支持离线编辑与本地 Lint,绝不污染远端草稿)",parameters:L.object({version:L.string().optional().describe("指定拉取的历史发布版本号或 ID(如 16 或 latest),不传默认拉取当前草稿规则"),out:L.string().optional().describe("保存的目标本地文件路径,默认为 ./rules.local.json")}),handler:async($,Y,U)=>{let I=Y.out??"./rules.local.json",Q=[],J="draft",K;if(Y.version){let G=await h8($),H=Number(Y.version),W=isNaN(H)?Y.version==="latest"?G[0]:G.find((X)=>X.id===Y.version):G.find((X)=>X.versionNumber===H);if(!W)throw Error(`未找到指定的规则版本: ${Y.version}`);K=W.versionNumber,J=`version:${K}`,Q=(W.rules??[]).map((X,Z)=>({code:d3(X.code)??Z,name:X.name??X.title,description:X.description??"",scope:X.scope??"ALL",strictness:X.strictness??"MUST_FOLLOW"}))}else Q=((await Line truncated
\uD83D\uDC49 Next action: 若您已直接修改远端草稿、仅需发布正式版本,请执行 seal-use rules publish "${q}" --corp ${U.corp.id}`)}throw Z}let K=Y.confirm!==!0||Y.dryRun===!0,z=await U6($),G=SP1(z.rules,Q.rules);if(K)return{...BP0(U,"api/v1/rules",z.rules,Q.rules.map((Z)=>({description:Z.description,scope:Z.scope??"ALL",strictness:Z.strictness??"MUST_FOLLOW"})),z.rules.length+Q.rules.length),corpId:U.corp.id,dryRun:!0,localFile:Q.resolvedPath,localRulesCount:Q.rules.length,remoteDraftCount:z.rules.length,changes:G,impactCount:G.created.length+G.updated.length+G.deleted.length,preservedRuleIds:[...G.updated.map((Z)=>Z.id),...G.unchanged.map((Z)=>Z.id)],warning:"Incremental mode preserves matched rule IDs and does not recode the draft rule set.",willPublish:Boolean(Y.publish),message:"Preview mode. Use --yes or confirm=true to apply the listed incremental changes to the remote draft."};for(let Z of G.deleted)await JJ($,Z.id);let H=[];for(let Z of G.created){let q=await dH($,{description:Z.description,scope:Z.scope??"ALL",strictness:DP0(Z.strictness)});H.push({id:q.id,description:q.description,code:q.code})}let W=[];for(let Z of G.updated)await Sg($,Z.id,{description:Z.rule.description,scope:Z.rule.scope??"ALL",strictness:DP0(Z.rule.strictness)}),W.push(Z.id);let X=void 0;if(Y.publish){let Z=new Date().toISOString().slice(0,10).replace(/-/g,""),q=Y.versionName||`v-local-${Z}-${Date.now().toString().slice(-4)}`;X=await pH($,q);try{let V=await U6($);eZ(U.corp.id,X.version,V.rules)}catch{}}return{corpId:U.corp.id,dryRun:!1,localFile:Q.resolvedPath,deletedRules:G.deleted.length,createdRules:H.length,updatedRules:W.length,unchangedRules:G.unchanged.length,preservedRuleIds:[...W,...G.unchanged.map((Z)=>Z.id)],recoded:!1,published:X??!1}}},{name:"seal_approval_documents_list",description:"列出 Seal 审批知识文档",parameters:L.object({scenarios:L.array(L.string()).optional().describe("场景过滤"),offset:L.number().int().nonnegative().optional(),limit:L.number().int().positive().optional()}),handler:async($,Y)=>eY($,Y)},{name:"seal_approval_document_get",description:"获取 Seal 审批知识文档详情",parameters:L.object({documentId:L.string().describe("文档 ID")}),handler:async($,Y)=>N40($,Y.documentId)},{name:"seal_approval_document_create",description:"新建 Seal 审批知识文档",parameters:L.object({title:L.string(),purpose:L.string(),content:L.string().describe("正文,通常为 Markdown"),contentType:L.string().optional(),status:L.string().optional(),enabled:L.boolean().optional(),scenarios:L.array(L.string()).optional(),tags:L.array(L.string()).optional()}),handler:async($,Y)=>kM($,Y)},{name:"seal_approval_document_update",description:"更新 Seal 审批知识文档",parameters:L.object({documentId:L.string(),title:L.string().optional(),purpose:L.string().optional(),content:L.string().optional(),contentType:L.string().optional(),status:L.string().optional(),enabled:L.boolean().optional(),scenarios:L.array(L.string()).optional(),tags:L.array(L.string()).optional()}),handler:async($,Y)=>{let{documentId:U,...I}=Y;return xM($,U,I)}},{name:"seal_approval_delete_document",description:"删除 Seal 审批知识文档",parameters:L.object({documentId:L.string().describe("知识文档 ID")}),handler:($,Y)=>fM($,Y.documentId)},{name:"seal_approval_search",description:"按关键词组检索 Seal 审批规则、审批文档和审批偏好配置,返回命中位置、字段、行号和前后三行上下文",parameters:L.object({keywords:L.array(L.string()).min(1).describe("关键词组"),matchMode:L.enum(["any","all"]).optional().describe("any 命中任一关键词,all 要求同一行命中全部关键词"),areas:L.array(L.enum(["rules","documents","preferences"])).optional().describe("检索范围"),caseSensitive:L.boolean().optional().describe("是否大小写敏感"),contextLines:L.number().int().nonnegative().optional().describe("返回命中行前后几行,默认 3"),documentLimit:L.number().int().positive().optional().describe("缓存刷新时最多拉取文档数,默认 100"),maxResults:L.number().int().positive().optional().describe("最多返回命中数,默认 50"),refresh:L.boolean().optional().describe("是否跳过 5 分钟内存缓存并强制刷新"),ruleVersionScope:L.enum(["current","all","version"]).optional().describe("规则检索范围,默认 current;all 会检索所有已发布历史版本"),ruleVersionId:L.string().optional().describe("ruleVersionScope=version 时指定版本 ID"),ruleVersionNumber:L.number().int().positive().optional().describe("ruleVersionScope=version 时指定版本号"),latestRuleVersion:L.boolean().optional().describe("ruleVersionScope=version 时取最新已发布版本"),snippetOnly:L.boolean().optional().describe("只返回命中行,不返回前后文"),maxChars:L.number().int().positive().optional().describe("每个文本片段最多返回字符数"),fields:L.array(L.string()).optional().describe("只搜索指定字段 Line truncated
`+"为防止测试单据污染生产审批流,禁止向生产环境重放单据。请指定测试企业 (--target-corp <testCorpId>),或在确有需要时添加 --force。",1,`seal-use webhook replay --target-corp <testCorpId>${U.id!==I.id?` --source-corp ${U.id}`:""}`);return{sourceCorp:U,targetCorp:I}}async function Lp($,Y,U){let I=Y.seal?.endpoints?.approvalStylePreferences??"api/v1/agent/ai-approval/config",Q=await V$($,I);if(U||Q.length>0)return EP0(Q,U,Y.id);if(Y.environment==="test"||Y.id.toLowerCase().includes("test")){console.error(`[webhook-replay] 测试企业「${Y.name}」未配置 Webhook 通道,正在自动创建「(Seal测-回放通道)」...`);let J=(Y.seal.url??Y.source?.sealUrl??`https://${Y.id.toLowerCase()}.sealai.cc`).replace(/\/+$/,"");return await uM($,J,{name:"(Seal测-回放通道)",mode:"assisted",outgoingResultWebhook:`${J}/api/v1/integrations/webhook/replay-mock-callback`},Y.seal.endpoints.approvalStylePreferences)}throw new z4(`当前租户「${Y.name}」未配置任何 Webhook 集成通道。`,1,`seal-use webhook add --name <name> --result-url <url> --corp ${Y.id}`)}async function qz($){let{query:Y,sourceClient:U,targetClient:I,sourceCorp:Q,targetCorp:J,webhookSelector:K,snPrefix:z,snSuffix:G,docIdPrefix:H,docIdSuffix:W,dryRun:X,fetchFn:Z=fetch}=$,q=[];if(Y.recordId){let P=await H4(U,Y.recordId);q.push(P)}else if(Y.recordIds&&Y.recordIds.length>0)for(let P of Y.recordIds)q.push(await H4(U,P));else if(Y.sn){let T=(await f4(U,{search:Y.sn,sourceDocumentSN:Y.sn,limit:20})).records.find((B)=>B.sourceDocumentSN===Y.sn||B.sourceDocumentId===Y.sn||B.document?.sourceDocumentSN===Y.sn||B.document?.sn===Y.sn);if(!T)throw Error(`在企业「${Q.name}」中未找到单据编号为「${Y.sn}」的审批记录。`);q.push(T)}else if(Y.sns&&Y.sns.length>0)for(let P of Y.sns){let B=(await f4(U,{search:P,sourceDocumentSN:P,limit:20})).records.find((E)=>E.sourceDocumentSN===P||E.sourceDocumentId===P||E.document?.sourceDocumentSN===P||E.document?.sn===P);if(!B)throw Error(`在企业「${Q.name}」中未找到单据编号为「${P}」的审批记录。`);q.push(B)}else if(Y.limit!==void 0){let P=await f4(U,{limit:Y.limit,status:Y.status,startDate:Y.startDate,endDate:Y.endDate});if(!P.records.length)throw Error(`在企业「${Q.name}」中未检索到符合条件的审批记录。`);q=P.records}else throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let V=q.map((P)=>({run:P,doc:qp(P,{snPrefix:z,snSuffix:G,docIdPrefix:H,docIdSuffix:W})}));if(X){let P={id:"preview-webhook",name:K??"预览目标通道",mode:"assisted",incomingDocumentWebhookUrl:`${J.seal.url}/api/v1/integrations/webhook/preview`};try{let E=await V$(I,J.seal.endpoints.approvalStylePreferences);if(E.length>0){let C=EP0(E,K,J.id);P={id:C.id,name:C.name,mode:C.mode,incomingDocumentWebhookUrl:C.incomingDocumentWebhook.url}}}catch{}let T=V.map(({run:E,doc:C})=>({originalRecord:{id:E.id,sourceSystem:E.sourceSystem,sourceDocumentSN:E.sourceDocumentSN,sourceDocumentId:E.sourceDocumentId},document:C,success:!0})),B=T.length===1;return{dryRun:!0,success:!0,sourceCorp:{id:Q.id,name:Q.name,environment:Q.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:P,totalCount:T.length,successCount:T.length,failureCount:0,originalRecord:B?T[0].originalRecord:void 0,document:B?T[0].document:void 0,records:T}}let w=await Lp(I,J,K),M={id:w.id,name:w.name,mode:w.mode,incomingDocumentWebhookUrl:w.incomingDocumentWebhook.url},F=[],N=0,O=0;for(let{run:P,doc:T}of V){console.error(`[webhook-replay] 正在向 Webhook 通道「${w.name}」推送单据: ${T.documentSN}...`);try{let B=await Vp(w.incomingDocumentWebhook.url,w.secret,T,Z,E6(J.seal));F.push({originalRecord:{id:P.id,sourceSystem:P.sourceSystem,sourceDocumentSN:P.sourceDocumentSN,sourceDocumentId:P.sourceDocumentId},replayedDocument:{documentSN:T.documentSN,documentId:T.documentId,fieldCount:T.fields.length},pushResult:B,success:!0}),N+=1}catch(B){let E=B instanceof Error?B.message:String(B);F.push({originalRecord:{id:P.id,sourceSystem:P.sourceSystem,sourceDocumentSN:P.sourceDocumentSN,sourceDocumentId:P.sourceDocumentId},replayedDocument:{documentSN:T.documentSN,documentId:T.documentId,fieldCount:T.fields.length},error:E,success:!1}),O+=1}}let D=F.length===1;return{success:O===0,dryRun:!1,sourceCorp:{id:Q.id,name:Q.name,environment:Q.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:M,totalCount:F.length,successCount:N,failureCount:O,originalRecord:D?F[0].originalRecord:void 0,replayedDocument:D?F[0].replayedDocument:void 0,pushResult:D?F[0].pushResult:void 0,records:F}}var iP1;var Uq=m(()=>{TP();EP();W4();iP1=new Set(["TEXT","NUMBER","DATE","AMOUNT","PERSON","ATTACHMENT","DATE_RANGE","DEPARTMENT","LIST","CITY","OBJECT"])});var jP0,S5;var Vz=m(()=>{jP0=class jP0 extends Error{errors;warnings;constructor($,Y= Line truncated
`));this.errors=$;this.warnings=Y;this.name="ResourcePackValidationError"}};S5=jP0});var vP0=j((g54,_P0)=>{_P0.exports=CP;function CP(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}CP.prototype.go=function($){if(this.pending<this.max)RP0(this,$);else this.waiting.push($)};CP.prototype.wait=function($){if(this.pending===0)$(this.error);else this.listeners.push($)};CP.prototype.hold=function(){return CP0(this)};function CP0($){$.pending+=1;var Y=!1;return U;function U(Q){if(Y)throw Error("callback called twice");if(Y=!0,$.error=$.error||Q,$.pending-=1,$.waiting.length>0&&$.pending<$.max)RP0($,$.waiting.shift());else if($.pending===0){var J=$.listeners;$.listeners=[],J.forEach(I)}}function I(Q){Q($.error)}}function RP0($,Y){Y(CP0($))}});var gP0=j((pP1)=>{var Fp=K0("fs"),wp=K0("util"),SP0=K0("stream"),hP0=SP0.Readable,nP1=SP0.PassThrough,dP1=vP0(),RP=K0("events").EventEmitter;pP1.BufferSlicer=Fz;pP1.FdSlicer=Lz;wp.inherits(Lz,RP);function Lz($){RP.call(this),this.fd=$,this.pend=new dP1,this.pend.max=1,this.refCount=0}Lz.prototype.read=function($,Y,U,I,Q){var J=this;J.pend.go(function(K){Fp.read(J.fd,$,Y,U,I,function(z,G,H){K(),Q(z,G,H)})})};Lz.prototype.createReadStream=function($){return new Iq(this,$)};Lz.prototype.ref=function(){this.refCount+=1};Lz.prototype.unref=function(){var $=this;if($.refCount-=1,$.refCount<0)throw Error("invalid unref");if($.refCount>0)return;Fp.close($.fd,Y);function Y(U){if(U)$.emit("error",U);else $.emit("close")}};wp.inherits(Iq,hP0);function Iq($,Y){Y=Y||{},hP0.call(this,Y),this.context=$,this.context.ref(),this.start=Y.start||0,this.endOffset=Y.end,this.pos=this.start}Iq.prototype._read=function($){var Y=this,U=Math.min(Y._readableState.highWaterMark,$);if(Y.endOffset!=null)U=Math.min(U,Y.endOffset-Y.pos);if(U<=0){Y.push(null),this._cleanup();return}Y.context.pend.go(function(I){var Q=Buffer.allocUnsafe(U);Fp.read(Y.context.fd,Q,0,U,Y.pos,function(J,K){if(J)Y.destroy(J);else if(K===0)Y.push(null),Y._cleanup();else Y.pos+=K,Y.push(Q.slice(0,K));I()})})};Iq.prototype._destroy=function($,Y){this._cleanup(),Y($)};Iq.prototype._cleanup=function(){if(this.context!=null)this.context.unref(),this.context=null};wp.inherits(Fz,RP);function Fz($){RP.call(this),this.refCount=0,this.buffer=$}Fz.prototype.read=function($,Y,U,I,Q){if(!(0<=Y&&Y<=$.length))throw RangeError("offset outside buffer: 0 <= "+Y+" <= "+$.length);if(I<0)throw RangeError("position is negative: "+I);if(Y+U>$.length)U=$.length-Y;if(I+U>this.buffer.length)U=this.buffer.length-I;if(U<=0){setImmediate(function(){Q(null,0)});return}this.buffer.copy($,Y,I,I+U),setImmediate(function(){Q(null,U)})};Fz.prototype.createReadStream=function($){$=$||{};var Y=new nP1($);Y.start=$.start||0,Y.endOffset=$.end,Y.pos=Y.endOffset||this.buffer.length;var U=this.buffer.slice(Y.start,Y.pos),I=65536,Q=0;while(!0){var J=Q+I;if(J>=U.length){if(Q<U.length)Y.write(U.slice(Q,U.length));break}Y.write(U.slice(Q,J)),Q=J}return Y.end(),Y};Fz.prototype.ref=function(){this.refCount+=1};Fz.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")}});var kP0=j((k54,yP0)=>{var oP1=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462, Line truncated
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�`},ibm864:"cp864",csibm864:"cp864",cp865:{type:"_sbcs",chars:"ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ "},ibm865:"cp865",csibm865:"cp865",cp866:{type:"_sbcs",chars:"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ "},ibm866:"cp866",csibm866:"cp866",cp869:{type:"_sbcs",chars:"������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ■ "},ibm869:"cp869",csibm869:"cp869",cp922:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®‾°±²³´µ·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖרÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ"},ibm922:"cp922",csibm922:"cp922",cp1046:{type:"_sbcs",chars:"ﺈ×÷ﹱˆ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�"},ibm1046:"cp1046",csibm1046:"cp1046",cp1124:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ"},ibm1124:"cp1124",csibm1124:"cp1124",cp1125:{type:"_sbcs",chars:"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ "},ibm1125:"cp1125",csibm1125:"cp1125",cp1129:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"},ibm1129:"cp1129",csibm1129:"cp1129",cp1133:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�"},ibm1133:"cp1133",csibm1133:"cp1133",cp1161:{type:"_sbcs",chars:"��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ "},ibm1161:"cp1161",csibm1161:"cp1161",cp1162:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"},ibm1162:"cp1162",csibm1162:"cp1162",cp1163:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥¦§œ©ª«¬­®¯°±²³Ÿµ·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ"},ibm1163:"cp1163",csiLine truncated
\v\f\r\x0E\x0F\x10ỨỰỲỶỸÝỴ\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ`},georgianacademy:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ"},georgianps:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"},pt154:{type:"_sbcs",chars:"ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя"},viscii:{type:"_sbcs",chars:`\x00\x01Ẳ\x03\x04ẴẪ\x07\b
\v\f\r\x0E\x0F\x10\x11\x12\x13Ỷ\x15\x16\x17\x18Ỹ\x1A\x1B\x1C\x1DỴ\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ`},iso646cn:{type:"_sbcs",chars:`\x00\x01\x02\x03\x04\x05\x06\x07\b
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},iso646jp:{type:"_sbcs",chars:`\x00\x01\x02\x03\x04\x05\x06\x07\b
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},hproman8:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¾—¼½ªº«■»±�"},macintosh:{type:"_sbcs",chars:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"},ascii:{type:"_sbcs",chars:"��������������������������������������������������������������������������������������������������������������������������������"},tis620:{type:"_sbcs",chars:"���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"}}});var HT0=j((iT1)=>{var sp=d3().Buffer;iT1._dbcs=m3;var z8=-1,GT0=-2,t$=-10,b8=-1000,Oz=Array(256),Yq=-1;for($q=0;$q<256;$q++)Oz[$q]=z8;var $q;function m3($,Y){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]=Oz.slice(0),this.decodeTableSeq=[];for(var I=0;I<U.length;I++)this._addDecodeChunk(U[I]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var Q=this.decodeTables.length;this.decodeTables.push(Oz.slice(0));var J=this.decodeTables.length;this.decodeTables.push(Oz.slice(0));var K=this.decodeTables[0];for(var I=129;I<=254;I++){var z=this.decodeTables[b8-K[I]];for(var G=48;G<=57;G++){if(z[G]===z8)z[G]=b8-Q;else if(z[G]>b8)throw Error("gb18030 decode tables conflict at byte 2");var H=this.decodeTables[b8-z[G]];for(var W=129;W<=254;W++){if(H[W]===z8)H[W]=b8-J;else if(H[W]===b8-J)continue;else if(H[W]>b8)throw Error("gb18030 decode tables conflict at byte 3");var X=this.decodeTables[b8-H[W]];for(var Z=48;Z<=57;Z++)if(X[Z]===z8)X[Z]=GT0}}}}this.defaultCharUnicode=Y.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var q={};if($.encodeSkipVals)for(var I=0;I<$.encodeSkipVals.length;I++){var V=$.encodeSkipVals[I];if(typeof V==="number")q[V]=!0;else for(var G=V.from;G<=V.to;G++)q[G]=!0}if(this._fillEncodeTable(0,0,q),$.encodeAdd){for(var w in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,w))this._setEncodeChar(w.charCodeAt(0),$.encodeAdd[w])}if(this.defCharSB=this.encodeTable[0][Y.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===z8)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===z8)this.defCharSB=63}m3.prototype.encoder=fP;m3.prototype.decoder=ap;m3.prototype._getDecodeTrieNode=function($){var Y=[];for(;$>0;$>>>=8)Y.push($&255);if(Y.length==0)Y.push(0);var U=this.decodeTables[0];for(var I=Y.length-1;I>0;I--){var Q=U[Y[I]];if(Q==z8)U[Y[I]]=b8-this.decodeTables.length,this.decodeTables.push(U=Oz.slice(0));else if(Q<=b8)U=this.decodeTables[b8-Q];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};m3.prototype._addDecodeChunk=function($){var Y=parseInt($[0],16),U=this._getDecodeTrieNode(Y);Y=Y&255;for(var I=1;I<$.length;I++){var Q=$[I];if(typeof Q==="string")for(var J=0;J<Q.length;){var K=Q.charCodeAt(J++);if(K>=55296&&K<56320){var z=Q.charCodeAt(J++);if(z>=56320&&z<57344)U[Y++]=65536+(K-55296)*1024+(z-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(K>4080&&K<=4095){var G=4095-K+2,H=[];for(var W=0;W<G;W++)H.push(Q.charCodeAt(J++));U[Y++]=t$-this.decodeTableSeq.length,this.decodeTableSeq.push(H)}else U[Y++]=K}else if(typeof Q==="number"){var X=U[Y-1]+1;for(var J=0;J<Q;J++)U[Y++]=X++}else throw Error("Incorrect type '"+typeof Q+"' given in "+this.encodingName+" at chunk "+$[0])}if(Y>255)throw Error("Incorrect chunk in "+this.encoLine truncated
`;super(Y);this.name="AggregateError",this.errors=$}}ME0.exports={AggregateError:wE0,ArrayIsArray($){return Array.isArray($)},ArrayPrototypeIncludes($,Y){return $.includes(Y)},ArrayPrototypeIndexOf($,Y){return $.indexOf(Y)},ArrayPrototypeJoin($,Y){return $.join(Y)},ArrayPrototypeMap($,Y){return $.map(Y)},ArrayPrototypePop($,Y){return $.pop(Y)},ArrayPrototypePush($,Y){return $.push(Y)},ArrayPrototypeSlice($,Y,U){return $.slice(Y,U)},Error,FunctionPrototypeCall($,Y,...U){return $.call(Y,...U)},FunctionPrototypeSymbolHasInstance($,Y){return Function.prototype[Symbol.hasInstance].call($,Y)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties($,Y){return Object.defineProperties($,Y)},ObjectDefineProperty($,Y,U){return Object.defineProperty($,Y,U)},ObjectGetOwnPropertyDescriptor($,Y){return Object.getOwnPropertyDescriptor($,Y)},ObjectKeys($){return Object.keys($)},ObjectSetPrototypeOf($,Y){return Object.setPrototypeOf($,Y)},Promise,PromisePrototypeCatch($,Y){return $.catch(Y)},PromisePrototypeThen($,Y,U){return $.then(Y,U)},PromiseReject($){return Promise.reject($)},PromiseResolve($){return Promise.resolve($)},ReflectApply:Reflect.apply,RegExpPrototypeTest($,Y){return $.test(Y)},SafeSet:Set,String,StringPrototypeSlice($,Y,U){return $.slice(Y,U)},StringPrototypeToLowerCase($){return $.toLowerCase()},StringPrototypeToUpperCase($){return $.toUpperCase()},StringPrototypeTrim($){return $.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet($,Y,U){return $.set(Y,U)},Boolean,Uint8Array}});var Nm=j((h94,OE0)=>{OE0.exports={format($,...Y){return $.replace(/%([sdifj])/g,function(...[U,I]){let Q=Y.shift();if(I==="f")return Q.toFixed(6);else if(I==="j")return JSON.stringify(Q);else if(I==="s"&&typeof Q==="object")return`${Q.constructor!==Object?Q.constructor.name:""} {}`.trim();else return Q.toString()})},inspect($){switch(typeof $){case"string":if($.includes("'")){if(!$.includes('"'))return`"${$}"`;else if(!$.includes("`")&&!$.includes("${"))return`\`${$}\``}return`'${$}'`;case"number":if(isNaN($))return"NaN";else if(Object.is($,-0))return String($);return $;case"bigint":return`${String($)}n`;case"boolean":case"undefined":return String($);case"object":return"{}"}}}});var P8=j((g94,AE0)=>{var{format:gj1,inspect:dP}=Nm(),{AggregateError:yj1}=b4(),kj1=globalThis.AggregateError||yj1,xj1=Symbol("kIsNodeError"),fj1=["string","function","number","object","Function","Object","boolean","bigint","symbol"],uj1=/^([A-Z][a-z0-9]*)+$/,pP={};function BI($,Y){if(!$)throw new pP.ERR_INTERNAL_ASSERTION(Y)}function NE0($){let Y="",U=$.length,I=$[0]==="-"?1:0;for(;U>=I+4;U-=3)Y=`_${$.slice(U-3,U)}${Y}`;return`${$.slice(0,U)}${Y}`}function bj1($,Y,U){if(typeof Y==="function")return BI(Y.length<=U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${Y.length}).`),Y(...U);let I=(Y.match(/%[dfijoOs]/g)||[]).length;if(BI(I===U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${I}).`),U.length===0)return Y;return gj1(Y,...U)}function G8($,Y,U){if(!U)U=Error;class I extends U{constructor(...Q){super(bj1($,Y,Q))}toString(){return`${this.name} [${$}]: ${this.message}`}}Object.defineProperties(I.prototype,{name:{value:U.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${$}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),I.prototype.code=$,I.prototype[xj1]=!0,pP[$]=I}function DE0($){let Y="__node_internal_"+$.name;return Object.defineProperty($,"name",{value:Y}),$}function ij1($,Y){if($&&Y&&$!==Y){if(Array.isArray(Y.errors))return Y.errors.push($),Y;let U=new kj1([Y,$],Y.message);return U.code=Y.code,U}return $||Y}class BE0 extends Error{constructor($="The operation was aborted",Y=void 0){if(Y!==void 0&&typeof Y!=="object")throw new pP.ERR_INVALID_ARG_TYPE("options","Object",Y);super($,Y);this.code="ABORT_ERR",this.name="AbortError"}}G8("ERR_ASSERTION","%s",Error);G8("ERR_INVALID_ARG_TYPE",($,Y,U)=>{if(BI(typeof $==="string","'name' must be a string"),!Array.isArray(Y))Y=[Y];let I="The ";if($.endsWith(" argument"))I+=`${$} `;else I+=`"${$}" ${$.includes(".")?"property":"argument"} `;I+="must be ";let Q=[],J=[],K=[];for(let G of Y)if(BI(typeof G==="string","All expected entries have to be of type string"),fj1.includes(G))Q.push(G.toLowerCase());else if(uj1.test(G))J.push(G);else BI(G!=="object",'The value "object" should be written as "Object"'),K.push(G);if(J.length>0){let G=Q.indexOf("object");if(G!==-1)Q.splice(Q,G,1),J.push("Object")}if(Q.length>0){switch(Q.length){case 1:I+=`of type ${Q[Line truncated
`);if(Y.linkname)U+=sl(" linkpath="+Y.linkname+`
`);let I=Y.pax;if(I)for(let Q in I)U+=sl(" "+Q+"="+I[Q]+`
`);return d1.from(U)};fg1.decodePax=function(Y){let U={};while(Y.length){let I=0;while(I<Y.length&&Y[I]!==32)I++;let Q=parseInt(d1.toString(Y.subarray(0,I)),10);if(!Q)return U;let J=d1.toString(Y.subarray(I+1,Q-1)),K=J.indexOf("=");if(K===-1)return U;U[J.slice(0,K)]=J.slice(K+1),Y=Y.subarray(Q)}return U};fg1.encode=function(Y){let U=d1.alloc(512),I=Y.name,Q="";if(Y.typeflag===5&&I[I.length-1]!=="/")I+="/";if(d1.byteLength(I)!==I.length)return null;while(d1.byteLength(I)>100){let J=I.indexOf("/");if(J===-1)return null;Q+=Q?"/"+I.slice(0,J):I.slice(0,J),I=I.slice(J+1)}if(d1.byteLength(I)>100||d1.byteLength(Q)>155)return null;if(Y.linkname&&d1.byteLength(Y.linkname)>100)return null;if(d1.write(U,I),d1.write(U,e2(Y.mode&4095,6),100),d1.write(U,e2(Y.uid,6),108),d1.write(U,e2(Y.gid,6),116),kg1(Y.size,U,124),d1.write(U,e2(Y.mtime.getTime()/1000|0,11),136),U[156]=48+gg1(Y.type),Y.linkname)d1.write(U,Y.linkname,157);if(d1.copy(l_0,U,257),d1.copy(jg1,U,263),Y.uname)d1.write(U,Y.uname,265);if(Y.gname)d1.write(U,Y.gname,297);if(d1.write(U,e2(Y.devmajor||0,6),329),d1.write(U,e2(Y.devminor||0,6),337),Q)d1.write(U,Q,345);return d1.write(U,e2(r_0(U),6),148),U};fg1.decode=function(Y,U,I){let Q=Y[156]===0?0:Y[156]-48,J=uz(Y,0,100,U),K=t2(Y,100,8),z=t2(Y,108,8),G=t2(Y,116,8),H=t2(Y,124,12),W=t2(Y,136,12),X=hg1(Q),Z=Y[157]===0?null:uz(Y,157,100,U),q=uz(Y,265,32),V=uz(Y,297,32),w=t2(Y,329,8),M=t2(Y,337,8),F=r_0(Y);if(F===256)return null;if(F!==t2(Y,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(_g1(Y)){if(Y[345])J=uz(Y,345,155,U)+"/"+J}else if(vg1(Y));else if(!I)throw Error("Invalid tar header: unknown format.");if(Q===0&&J&&J[J.length-1]==="/")Q=5;return{name:J,mode:K,uid:z,gid:G,size:H,byteOffset:0,mtime:new Date(1000*W),type:X,linkname:Z,uname:q,gname:V,devmajor:w,devminor:M,pax:null}};function _g1($){return d1.equals(l_0,$.subarray(257,263))}function vg1($){return d1.equals(Cg1,$.subarray(257,263))&&d1.equals(Rg1,$.subarray(263,265))}function Sg1($,Y,U){if(typeof $!=="number")return U;if($=~~$,$>=Y)return Y;if($>=0)return $;if($+=Y,$>=0)return $;return 0}function hg1($){switch($){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}function gg1($){switch($){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}function o_0($,Y,U,I){for(;U<I;U++)if($[U]===Y)return U;return I}function r_0($){let Y=256;for(let U=0;U<148;U++)Y+=$[U];for(let U=156;U<512;U++)Y+=$[U];return Y}function e2($,Y){if($=$.toString(8),$.length>Y)return"7777777777777777777".slice(0,Y)+" ";return"0000000000000000000".slice(0,Y-$.length)+$+" "}function yg1($,Y,U){Y[U]=128;for(let I=11;I>0;I--)Y[U+I]=$&255,$=Math.floor($/256)}function kg1($,Y,U){if($.toString(8).length>11)yg1($,Y,U);else d1.write(Y,e2($,11),U)}function xg1($){let Y;if($[0]===128)Y=!0;else if($[0]===255)Y=!1;else return null;let U=[],I;for(I=$.length-1;I>0;I--){let K=$[I];if(Y)U.push(K);else U.push(255-K)}let Q=0,J=U.length;for(I=0;I<J;I++)Q+=U[I]*Math.pow(256,I);return Y?Q:-1*Q}function t2($,Y,U){if($=$.subarray(Y,Y+U),Y=0,$[Y]&128)return xg1($);else{while(Y<$.length&&$[Y]===32)Y++;let I=Sg1(o_0($,32,Y,$.length),$.length,$.length);while(Y<I&&$[Y]===0)Y++;if(I===Y)return 0;return parseInt(d1.toString($.subarray(Y,I)),8)}}function uz($,Y,U,I){return d1.toString($.subarray(Y,o_0($,0,Y,Y+U)),I)}function sl($){let Y=d1.byteLength($),U=Math.floor(Math.log(Y)/Math.log(10))+1;if(Y+U>=Math.pow(10,U))U++;return Y+U+$}});var Iv0=j((P74,Uv0)=>{var{Writable:dg1,Readable:pg1,getStreamError:s_0}=rl(),mg1=il(),a_0=fz(),bz=al(),lg1=a_0.alloc(0);class t_0{constructor(){this.buffered=0,this.shifted=0,this.queue=new mg1,this._offset=0}push($){this.buffered+=$.byteLength,this.queue.push($)}shiftFirst($){return this.buffered===0?null:this._next($)}shift($){if($>this.buffered)return null;if($===0)return lg1;let Y=this._next($);if($===Y.byteLength)return Y;let U=[Y];while(($-=Y.byteLength)>0)Y=this._next($),U.push(Y);return a_0.concat(U)}_next($){let Y=this.queue.peek(),U=Y.byteLength-this._offset;if($>=U){let I=this._offset?Y.subarray(this._offset,Y.byteLength):Y;return this.queue.shift(),this._offset=0,this.buffered-=U,this.shifted+=U,I}return this.buffered-=$,this.shifted+=$,Y.subarray(this._offset,this._offset+=$)}}class e_0 extends pg1{constructor($,Y,U){super();this.header=Y,this.offset=U,this._parent=$}_read($){if(this.header.size===0)this.push(null);if(this._parent._stream===this)this._parent._update();$(null)}_predestroy(){this._parent.destroy(s_0(this))}_detach(){if(this._parent._stream= Line truncated
\v\f\r\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_\`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������`},hproman8:{type:"_sbcs",chars:"€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¾—¼½ªº«■»±�"},macintosh:{type:"_sbcs",chars:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ"},ascii:{type:"_sbcs",chars:"��������������������������������������������������������������������������������������������������������������������������������"},tis620:{type:"_sbcs",chars:"���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����"}}});var VT0=j((mT1)=>{var ep=m3().Buffer;mT1._dbcs=o3;var H8=-1,qT0=-2,$5=-10,b8=-1000,Az=Array(256),Kq=-1;for(Jq=0;Jq<256;Jq++)Az[Jq]=H8;var Jq;function o3($,Y){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]=Az.slice(0),this.decodeTableSeq=[];for(var I=0;I<U.length;I++)this._addDecodeChunk(U[I]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var Q=this.decodeTables.length;this.decodeTables.push(Az.slice(0));var J=this.decodeTables.length;this.decodeTables.push(Az.slice(0));var K=this.decodeTables[0];for(var I=129;I<=254;I++){var z=this.decodeTables[b8-K[I]];for(var G=48;G<=57;G++){if(z[G]===H8)z[G]=b8-Q;else if(z[G]>b8)throw Error("gb18030 decode tables conflict at byte 2");var H=this.decodeTables[b8-z[G]];for(var W=129;W<=254;W++){if(H[W]===H8)H[W]=b8-J;else if(H[W]===b8-J)continue;else if(H[W]>b8)throw Error("gb18030 decode tables conflict at byte 3");var X=this.decodeTables[b8-H[W]];for(var Z=48;Z<=57;Z++)if(X[Z]===H8)X[Z]=qT0}}}}this.defaultCharUnicode=Y.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var q={};if($.encodeSkipVals)for(var I=0;I<$.encodeSkipVals.length;I++){var V=$.encodeSkipVals[I];if(typeof V==="number")q[V]=!0;else for(var G=V.from;G<=V.to;G++)q[G]=!0}if(this._fillEncodeTable(0,0,q),$.encodeAdd){for(var w in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,w))this._setEncodeChar(w.charCodeAt(0),$.encodeAdd[w])}if(this.defCharSB=this.encodeTable[0][Y.defaultCharSingleByte.charCodeAt(0)],this.defCharSB===H8)this.defCharSB=this.encodeTable[0]["?"];if(this.defCharSB===H8)this.defCharSB=63}o3.prototype.encoder=cP;o3.prototype.decoder=$m;o3.prototype._getDecodeTrieNode=function($){var Y=[];for(;$>0;$>>>=8)Y.push($&255);if(Y.length==0)Y.push(0);var U=this.decodeTables[0];for(var I=Y.length-1;I>0;I--){var Q=U[Y[I]];if(Q==H8)U[Y[I]]=b8-this.decodeTables.length,this.decodeTables.push(U=Az.slice(0));else if(Q<=b8)U=this.decodeTables[b8-Q];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};o3.prototype._addDecodeChunk=function($){var Y=parseInt($[0],16),U=this._getDecodeTrieNode(Y);Y=Y&255;for(var I=1;I<$.length;I++){var Q=$[I];if(typeof Q==="string")for(var J=0;J<Q.length;){var K=Q.charCodeAt(J++);if(K>=55296&&K<56320){var z=Q.charCodeAt(J++);if(z>=56320&&z<57344)U[Y++]=65536+(K-55296)*1024+(z-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(K>4080&&K<=4095){var G=4095-K+2,H=[];for(var W=0;W<G;W++)H.push(Q.charCodeAt(J++));U[Y++]=$5-this.decodeTableSeq.length,this.decodeTableSeq.push(H)}else U[Y++]=K}else if(typeof Q==="number"){var X=U[Y-1]+1;for(var J=0;J<Q;J++)U[Y++]=X++}else throw Error("Incorrect type '"+typeof Q+"' given in "+this.encodingName+" at chunk "+$[0])}if(Y>255)throw Error("Incorrect chunk in "+this.encoLine truncated
`;super(Y);this.name="AggregateError",this.errors=$}}AE0.exports={AggregateError:BE0,ArrayIsArray($){return Array.isArray($)},ArrayPrototypeIncludes($,Y){return $.includes(Y)},ArrayPrototypeIndexOf($,Y){return $.indexOf(Y)},ArrayPrototypeJoin($,Y){return $.join(Y)},ArrayPrototypeMap($,Y){return $.map(Y)},ArrayPrototypePop($,Y){return $.pop(Y)},ArrayPrototypePush($,Y){return $.push(Y)},ArrayPrototypeSlice($,Y,U){return $.slice(Y,U)},Error,FunctionPrototypeCall($,Y,...U){return $.call(Y,...U)},FunctionPrototypeSymbolHasInstance($,Y){return Function.prototype[Symbol.hasInstance].call($,Y)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties($,Y){return Object.defineProperties($,Y)},ObjectDefineProperty($,Y,U){return Object.defineProperty($,Y,U)},ObjectGetOwnPropertyDescriptor($,Y){return Object.getOwnPropertyDescriptor($,Y)},ObjectKeys($){return Object.keys($)},ObjectSetPrototypeOf($,Y){return Object.setPrototypeOf($,Y)},Promise,PromisePrototypeCatch($,Y){return $.catch(Y)},PromisePrototypeThen($,Y,U){return $.then(Y,U)},PromiseReject($){return Promise.reject($)},PromiseResolve($){return Promise.resolve($)},ReflectApply:Reflect.apply,RegExpPrototypeTest($,Y){return $.test(Y)},SafeSet:Set,String,StringPrototypeSlice($,Y,U){return $.slice(Y,U)},StringPrototypeToLowerCase($){return $.toLowerCase()},StringPrototypeToUpperCase($){return $.toUpperCase()},StringPrototypeTrim($){return $.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet($,Y,U){return $.set(Y,U)},Boolean,Uint8Array}});var Am=j((b94,PE0)=>{PE0.exports={format($,...Y){return $.replace(/%([sdifj])/g,function(...[U,I]){let Q=Y.shift();if(I==="f")return Q.toFixed(6);else if(I==="j")return JSON.stringify(Q);else if(I==="s"&&typeof Q==="object")return`${Q.constructor!==Object?Q.constructor.name:""} {}`.trim();else return Q.toString()})},inspect($){switch(typeof $){case"string":if($.includes("'")){if(!$.includes('"'))return`"${$}"`;else if(!$.includes("`")&&!$.includes("${"))return`\`${$}\``}return`'${$}'`;case"number":if(isNaN($))return"NaN";else if(Object.is($,-0))return String($);return $;case"bigint":return`${String($)}n`;case"boolean":case"undefined":return String($);case"object":return"{}"}}}});var E8=j((i94,CE0)=>{var{format:uj1,inspect:oP}=Am(),{AggregateError:bj1}=i4(),ij1=globalThis.AggregateError||bj1,cj1=Symbol("kIsNodeError"),nj1=["string","function","number","object","Function","Object","boolean","bigint","symbol"],dj1=/^([A-Z][a-z0-9]*)+$/,rP={};function EI($,Y){if(!$)throw new rP.ERR_INTERNAL_ASSERTION(Y)}function TE0($){let Y="",U=$.length,I=$[0]==="-"?1:0;for(;U>=I+4;U-=3)Y=`_${$.slice(U-3,U)}${Y}`;return`${$.slice(0,U)}${Y}`}function pj1($,Y,U){if(typeof Y==="function")return EI(Y.length<=U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${Y.length}).`),Y(...U);let I=(Y.match(/%[dfijoOs]/g)||[]).length;if(EI(I===U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${I}).`),U.length===0)return Y;return uj1(Y,...U)}function W8($,Y,U){if(!U)U=Error;class I extends U{constructor(...Q){super(pj1($,Y,Q))}toString(){return`${this.name} [${$}]: ${this.message}`}}Object.defineProperties(I.prototype,{name:{value:U.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${$}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),I.prototype.code=$,I.prototype[cj1]=!0,rP[$]=I}function EE0($){let Y="__node_internal_"+$.name;return Object.defineProperty($,"name",{value:Y}),$}function mj1($,Y){if($&&Y&&$!==Y){if(Array.isArray(Y.errors))return Y.errors.push($),Y;let U=new ij1([Y,$],Y.message);return U.code=Y.code,U}return $||Y}class jE0 extends Error{constructor($="The operation was aborted",Y=void 0){if(Y!==void 0&&typeof Y!=="object")throw new rP.ERR_INVALID_ARG_TYPE("options","Object",Y);super($,Y);this.code="ABORT_ERR",this.name="AbortError"}}W8("ERR_ASSERTION","%s",Error);W8("ERR_INVALID_ARG_TYPE",($,Y,U)=>{if(EI(typeof $==="string","'name' must be a string"),!Array.isArray(Y))Y=[Y];let I="The ";if($.endsWith(" argument"))I+=`${$} `;else I+=`"${$}" ${$.includes(".")?"property":"argument"} `;I+="must be ";let Q=[],J=[],K=[];for(let G of Y)if(EI(typeof G==="string","All expected entries have to be of type string"),nj1.includes(G))Q.push(G.toLowerCase());else if(dj1.test(G))J.push(G);else EI(G!=="object",'The value "object" should be written as "Object"'),K.push(G);if(J.length>0){let G=Q.indexOf("object");if(G!==-1)Q.splice(Q,G,1),J.push("Object")}if(Q.length>0){switch(Q.length){case 1:I+=`of type ${Q[Line truncated
`);if(Y.linkname)U+=el(" linkpath="+Y.linkname+`
`);let I=Y.pax;if(I)for(let Q in I)U+=el(" "+Q+"="+I[Q]+`
`);return d1.from(U)};ng1.decodePax=function(Y){let U={};while(Y.length){let I=0;while(I<Y.length&&Y[I]!==32)I++;let Q=parseInt(d1.toString(Y.subarray(0,I)),10);if(!Q)return U;let J=d1.toString(Y.subarray(I+1,Q-1)),K=J.indexOf("=");if(K===-1)return U;U[J.slice(0,K)]=J.slice(K+1),Y=Y.subarray(Q)}return U};ng1.encode=function(Y){let U=d1.alloc(512),I=Y.name,Q="";if(Y.typeflag===5&&I[I.length-1]!=="/")I+="/";if(d1.byteLength(I)!==I.length)return null;while(d1.byteLength(I)>100){let J=I.indexOf("/");if(J===-1)return null;Q+=Q?"/"+I.slice(0,J):I.slice(0,J),I=I.slice(J+1)}if(d1.byteLength(I)>100||d1.byteLength(Q)>155)return null;if(Y.linkname&&d1.byteLength(Y.linkname)>100)return null;if(d1.write(U,I),d1.write(U,IY(Y.mode&4095,6),100),d1.write(U,IY(Y.uid,6),108),d1.write(U,IY(Y.gid,6),116),ig1(Y.size,U,124),d1.write(U,IY(Y.mtime.getTime()/1000|0,11),136),U[156]=48+ug1(Y.type),Y.linkname)d1.write(U,Y.linkname,157);if(d1.copy(t_0,U,257),d1.copy(Sg1,U,263),Y.uname)d1.write(U,Y.uname,265);if(Y.gname)d1.write(U,Y.gname,297);if(d1.write(U,IY(Y.devmajor||0,6),329),d1.write(U,IY(Y.devminor||0,6),337),Q)d1.write(U,Q,345);return d1.write(U,IY($v0(U),6),148),U};ng1.decode=function(Y,U,I){let Q=Y[156]===0?0:Y[156]-48,J=nz(Y,0,100,U),K=UY(Y,100,8),z=UY(Y,108,8),G=UY(Y,116,8),H=UY(Y,124,12),W=UY(Y,136,12),X=fg1(Q),Z=Y[157]===0?null:nz(Y,157,100,U),q=nz(Y,265,32),V=nz(Y,297,32),w=UY(Y,329,8),M=UY(Y,337,8),F=$v0(Y);if(F===256)return null;if(F!==UY(Y,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(yg1(Y)){if(Y[345])J=nz(Y,345,155,U)+"/"+J}else if(kg1(Y));else if(!I)throw Error("Invalid tar header: unknown format.");if(Q===0&&J&&J[J.length-1]==="/")Q=5;return{name:J,mode:K,uid:z,gid:G,size:H,byteOffset:0,mtime:new Date(1000*W),type:X,linkname:Z,uname:q,gname:V,devmajor:w,devminor:M,pax:null}};function yg1($){return d1.equals(t_0,$.subarray(257,263))}function kg1($){return d1.equals(hg1,$.subarray(257,263))&&d1.equals(gg1,$.subarray(263,265))}function xg1($,Y,U){if(typeof $!=="number")return U;if($=~~$,$>=Y)return Y;if($>=0)return $;if($+=Y,$>=0)return $;return 0}function fg1($){switch($){case 0:return"file";case 1:return"link";case 2:return"symlink";case 3:return"character-device";case 4:return"block-device";case 5:return"directory";case 6:return"fifo";case 7:return"contiguous-file";case 72:return"pax-header";case 55:return"pax-global-header";case 27:return"gnu-long-link-path";case 28:case 30:return"gnu-long-path"}return null}function ug1($){switch($){case"file":return 0;case"link":return 1;case"symlink":return 2;case"character-device":return 3;case"block-device":return 4;case"directory":return 5;case"fifo":return 6;case"contiguous-file":return 7;case"pax-header":return 72}return 0}function e_0($,Y,U,I){for(;U<I;U++)if($[U]===Y)return U;return I}function $v0($){let Y=256;for(let U=0;U<148;U++)Y+=$[U];for(let U=156;U<512;U++)Y+=$[U];return Y}function IY($,Y){if($=$.toString(8),$.length>Y)return"7777777777777777777".slice(0,Y)+" ";return"0000000000000000000".slice(0,Y-$.length)+$+" "}function bg1($,Y,U){Y[U]=128;for(let I=11;I>0;I--)Y[U+I]=$&255,$=Math.floor($/256)}function ig1($,Y,U){if($.toString(8).length>11)bg1($,Y,U);else d1.write(Y,IY($,11),U)}function cg1($){let Y;if($[0]===128)Y=!0;else if($[0]===255)Y=!1;else return null;let U=[],I;for(I=$.length-1;I>0;I--){let K=$[I];if(Y)U.push(K);else U.push(255-K)}let Q=0,J=U.length;for(I=0;I<J;I++)Q+=U[I]*Math.pow(256,I);return Y?Q:-1*Q}function UY($,Y,U){if($=$.subarray(Y,Y+U),Y=0,$[Y]&128)return cg1($);else{while(Y<$.length&&$[Y]===32)Y++;let I=xg1(e_0($,32,Y,$.length),$.length,$.length);while(Y<I&&$[Y]===0)Y++;if(I===Y)return 0;return parseInt(d1.toString($.subarray(Y,I)),8)}}function nz($,Y,U,I){return d1.toString($.subarray(Y,e_0($,0,Y,Y+U)),I)}function el($){let Y=d1.byteLength($),U=Math.floor(Math.log(Y)/Math.log(10))+1;if(Y+U>=Math.pow(10,U))U++;return Y+U+$}});var Gv0=j((v74,zv0)=>{var{Writable:rg1,Readable:sg1,getStreamError:Yv0}=tl(),ag1=dl(),Uv0=cz(),dz=$o(),tg1=Uv0.alloc(0);class Iv0{constructor(){this.buffered=0,this.shifted=0,this.queue=new ag1,this._offset=0}push($){this.buffered+=$.byteLength,this.queue.push($)}shiftFirst($){return this.buffered===0?null:this._next($)}shift($){if($>this.buffered)return null;if($===0)return tg1;let Y=this._next($);if($===Y.byteLength)return Y;let U=[Y];while(($-=Y.byteLength)>0)Y=this._next($),U.push(Y);return Uv0.concat(U)}_next($){let Y=this.queue.peek(),U=Y.byteLength-this._offset;if($>=U){let I=this._offset?Y.subarray(this._offset,Y.byteLength):Y;return this.queue.shift(),this._offset=0,this.buffered-=U,this.shifted+=U,I}return this.buffered-=$,this.shifted+=$,Y.subarray(this._offset,this._offset+=$)}}class Qv0 extends sg1{constructor($,Y,U){super();this.header=Y,this.offset=U,this._parent=$}_read($){if(this.header.size===0)this.push(null);if(this._parent._stream===this)this._parent._update();$(null)}_predestroy(){this._parent.destroy(Yv0(this))}_detach(){if(this._parent._stream= Line truncated
`),I=[await H4($,U.recordId)];else if(U.recordIds&&U.recordIds.length>0)process.stderr.write(`\uD83D\uDD0D 批量查询 ${U.recordIds.length} 条单据记录...
`),I=await Promise.all(U.recordIds.map((F)=>H4($,F)));else{let F=U.limit??10;process.stderr.write(`\uD83D\uDD0D 检索企业「${Y.name}」(${Y.id}) 的线上审核记录 (限制 ${F} 条)...
`);let O=(await x4($,{limit:F,status:U.status,startDate:U.startDate!==void 0?String(U.startDate):void 0,endDate:U.endDate!==void 0?String(U.endDate):void 0})).records??[];if(O.length===0)throw Error("未检索到符合条件的线上审核记录,无法导出 webhook 资源包。");process.stderr.write(`\uD83D\uDCE5 正在拉取 ${O.length} 条审核记录完整详情...
`),I=await Promise.all(O.map((D)=>H4($,D.id)))}let Q=new Map,J=0;for(let F of I){let N=F.document,O=F.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??F.documentId??F.id,D=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,P=[];if(U.includeAttachments!==!1){let B=i3(F,{summary:!1}).attachments,E=new Set;for(let C of B){let i=C.ossSignedUrl??C.url;if(!i)continue;let x=C.fileName??C.fileId??"attachment",g=Ed(x),b=g,c=g.lastIndexOf("."),I0=c>0?g.slice(0,c):g,k=c>0?g.slice(c):"",p=1;while(E.has(b.toLowerCase()))b=`${I0}_${p}${k}`,p++;E.add(b.toLowerCase());try{process.stderr.write(`⬇ 下载单据「${D}」附件: ${x}...
`);let O=(await f4($,{limit:F,status:U.status,startDate:U.startDate!==void 0?String(U.startDate):void 0,endDate:U.endDate!==void 0?String(U.endDate):void 0})).records??[];if(O.length===0)throw Error("未检索到符合条件的线上审核记录,无法导出 webhook 资源包。");process.stderr.write(`\uD83D\uDCE5 正在拉取 ${O.length} 条审核记录完整详情...
`),I=await Promise.all(O.map((D)=>H4($,D.id)))}let Q=new Map,J=0;for(let F of I){let N=F.document,O=F.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??F.documentId??F.id,D=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,P=[];if(U.includeAttachments!==!1){let B=c3(F,{summary:!1}).attachments,E=new Set;for(let C of B){let i=C.ossSignedUrl??C.url;if(!i)continue;let x=C.fileName??C.fileId??"attachment",g=_d(x),b=g,c=g.lastIndexOf("."),I0=c>0?g.slice(0,c):g,k=c>0?g.slice(c):"",p=1;while(E.has(b.toLowerCase()))b=`${I0}_${p}${k}`,p++;E.add(b.toLowerCase());try{process.stderr.write(`⬇ 下载单据「${D}」附件: ${x}...
`);let a=await fetch(i);if(a.ok){let $0=await a.arrayBuffer(),y=Buffer.from($0);P.push({fileName:b,zipPath:`${D}/${b}`,buffer:y,sourceField:C.sourceField??"附件"}),J++}}catch(a){process.stderr.write(`⚠️ [跳过附件] 下载失败 ${x}: ${a}
`)}}}Q.set(D,P)}let K=new Dv0.default.Workbook;K.creator="seal-use",K.created=new Date;let z=new Set;for(let F of Q.values())for(let N of F)z.add(N.sourceField);if(z.size===0)z.add("附件");let G=new Set;for(let F of I){let N=F.document,O=Array.isArray(N?.fields)?N.fields:[];for(let D of O)if(D&&typeof D==="object"){let P=D,T=typeof P.label==="string"?P.label.trim():typeof P.key==="string"?P.key.trim():"",B=typeof P.type==="string"?P.type.toUpperCase():"";if(T&&B!=="ATTACHMENT"&&B!=="LIST")G.add(T)}}let H=["会议编号","会议名称","状态","总金额","报销事由","申请日期"],W=Array.from(G).filter((F)=>!H.includes(F)&&F!=="单据编号"&&F!=="单号"),X=Array.from(z).map((F)=>`[附件]${F}`),Z=[...H,...W,...X],q=K.addWorksheet("主表");q.addRow(Z),q.getRow(1).font={bold:!0};for(let F of I){let N=F.document,O=F.sourceDocumentSN??(typeof N?.sn==="string"?N.sn:void 0)??(typeof N?.sourceDocumentSN==="string"?N.sourceDocumentSN:void 0)??F.id,D=F.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??F.documentId??F.id,P=`${U.docIdPrefix??""}${D}${U.docIdSuffix??""}`,T=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,B=(typeof N?.title==="string"?N.title:void 0)??(typeof N?.name==="string"?N.name:void 0)??T,E="";if(typeof N?.sourceStartTime==="number")E=new Date(N.sourceStartTime*1000).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof F.createdAt==="number")E=new Date(F.createdAt).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof F.createdAt==="string")E=F.createdAt.slice(0,10);let C=new Map,i=Array.isArray(N?.fields)?N.fields:[];for(let I0 of i)if(I0&&typeof I0==="object"){let k=I0,p=typeof k.label==="string"?k.label.trim():typeof k.key==="string"?k.key.trim():"";if(p)C.set(p,k.value)}let x,g=C.get("总金额")??C.get("报销金额")??C.get("total_amount");if(typeof g==="number")x=g;else if(g&&typeof g==="object"&&"amount"in g&&typeof g.amount==="number")x=g.amount;let b=[];b.push(P),b.push(B),b.push(F.status??"已审批"),b.push(x??""),b.push(C.get("报销事由")??C.get("事由")??B),b.push(E);for(let I0 of W){let k=C.get(I0);if(k===void 0||k===null)b.push("");else if(typeof k==="object")if("amount"in k)b.push(k.amount);else b.push(JSON.stringify(k));else b.push(k)}let c=Q.get(P)??[];for(let I0 of z){let k=c.filter((p)=>p.sourceField===I0||z.size===1);if(k.length>0)b.push(k.map((p)=>p.zipPath).join(`
`));else b.push("")}q.addRow(b)}let V=Zy1(U,Y);zy1(Wy1(V),{recursive:!0});let w=await K.xlsx.writeBuffer();process.stderr.write(`\uD83D\uDCE6 正在压缩生成 Webhook 资源包: ${V}...
`),await new Promise((F,N)=>{let O=Ky1(V),D=new Uo({zlib:{level:9}});O.on("close",()=>F()),D.on("error",(P)=>N(P)),D.pipe(O),D.append(Buffer.from(w),{name:"信息表.xlsx"});for(let P of Q.values())for(let T of P)D.append(T.buffer,{name:T.zipPath});D.finalize()});let M=Gy1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:I.length,attachmentCount:J,fileSizeBytes:M.size,exportedAt:new Date().toISOString(),nextAction:`seal-use webhook resource-pack push ${V} --corp <targetCorpId>`}}var Dv0;var Io=m(()=>{Ov0();W4();kZ();Dv0=K6(gZ(),1)});import{readFileSync as qy1}from"node:fs";function Vy1($){let Y=new URL($),U=Y.pathname.match(/\/webhook\/([^/]+)/);if(!U)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:U[1]}}function Ly1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Fy1($,Y){if(!$.length)return;let U=new Set($.map((J)=>{let K=J.fileName.split("/")[0],z=K.indexOf("@");return z>=0?K.slice(0,z):K}).filter((J)=>J!=="信息表.xlsx")),I=[];for(let J of Y){let K=J.document.documentId;if((J.documentAttachments.length>0||Object.values(J.expenseAttachments).some((G)=>G.length>0)||Object.values(J.personAttachments).some((G)=>G.length>0))&&!U.has(K))I.push(`Excel 会议编号「${K}」声明了附件,但在 ZIP 中找不到对应的根目录「${K}/」或「${K}@.../」。`)}let Q=new Set(Y.map((J)=>J.document.documentId));for(let J of U)if(!Q.has(J))I.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(I.length)throw new _5(I)}async function Bv0($,Y,U){let I=[],Q=$;if(Ly1($,Y)){I=await ST0($),gT0(I,U);let G=I.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await Im($,G)}let J=await iT0(Q);Fy1(I,J);let K=cT0(I,J),z=J.map((G)=>G.document);return{entries:I,parsed:J,plans:K,documents:z,fileBuffer:$}}async function bI($,Y,U){let I=await Bv0($,Y,U),Q=I.parsed.map((J,K)=>Hm(J.document,I.plans[K],new Map));return{warnings:[],documents:Q,attachmentPlan:I.plans}}async function gT($,Y,U){let I=await Bv0($,Y,U.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=Vy1(U.webhookUrl),K=[];for(let z=0;z<I.parsed.length;z+=1){let G=I.parsed[z],H=I.plans[z],W=new Map,X=[...H.categoryFields,...Object.values(H.personAttachments).flat(),...Object.values(H.expenseAttachments).flat()];for(let V of X)for(let w of V.paths){if(W.has(w))continue;let M=I.entries.find((T)=>T.fileName===w);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${w}
`);let F=new FormData,N=await Im(I.fileBuffer,M),O=w.split("/").pop()??w;F.append("files",new File([new Uint8Array(N)],O));let D=await fetch(`${Q}/api/v1/integrations/webhook/${encodeURIComponent(J)}/attachments`,{method:"POST",headers:{...U.customHeaders??{},...rZ({},U.secret)},body:F});if(!D.ok)throw Error(`附件上传失败 ${D.status}: ${await D.text()}`);let P=await D.json();W.set(w,P.attachments?.map((T)=>T.data)??(P.data===void 0?[]:[P.data])),process.stderr.write(`✓ 附件上传成功: ${w}
`)}}}Q.set(D,P)}let K=new Ev0.default.Workbook;K.creator="seal-use",K.created=new Date;let z=new Set;for(let F of Q.values())for(let N of F)z.add(N.sourceField);if(z.size===0)z.add("附件");let G=new Set;for(let F of I){let N=F.document,O=Array.isArray(N?.fields)?N.fields:[];for(let D of O)if(D&&typeof D==="object"){let P=D,T=typeof P.label==="string"?P.label.trim():typeof P.key==="string"?P.key.trim():"",B=typeof P.type==="string"?P.type.toUpperCase():"";if(T&&B!=="ATTACHMENT"&&B!=="LIST")G.add(T)}}let H=["会议编号","会议名称","状态","总金额","报销事由","申请日期"],W=Array.from(G).filter((F)=>!H.includes(F)&&F!=="单据编号"&&F!=="单号"),X=Array.from(z).map((F)=>`[附件]${F}`),Z=[...H,...W,...X],q=K.addWorksheet("主表");q.addRow(Z),q.getRow(1).font={bold:!0};for(let F of I){let N=F.document,O=F.sourceDocumentSN??(typeof N?.sn==="string"?N.sn:void 0)??(typeof N?.sourceDocumentSN==="string"?N.sourceDocumentSN:void 0)??F.id,D=F.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??F.documentId??F.id,P=`${U.docIdPrefix??""}${D}${U.docIdSuffix??""}`,T=`${U.docIdPrefix??""}${O}${U.docIdSuffix??""}`,B=(typeof N?.title==="string"?N.title:void 0)??(typeof N?.name==="string"?N.name:void 0)??T,E="";if(typeof N?.sourceStartTime==="number")E=new Date(N.sourceStartTime*1000).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof F.createdAt==="number")E=new Date(F.createdAt).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof F.createdAt==="string")E=F.createdAt.slice(0,10);let C=new Map,i=Array.isArray(N?.fields)?N.fields:[];for(let I0 of i)if(I0&&typeof I0==="object"){let k=I0,p=typeof k.label==="string"?k.label.trim():typeof k.key==="string"?k.key.trim():"";if(p)C.set(p,k.value)}let x,g=C.get("总金额")??C.get("报销金额")??C.get("total_amount");if(typeof g==="number")x=g;else if(g&&typeof g==="object"&&"amount"in g&&typeof g.amount==="number")x=g.amount;let b=[];b.push(P),b.push(B),b.push(F.status??"已审批"),b.push(x??""),b.push(C.get("报销事由")??C.get("事由")??B),b.push(E);for(let I0 of W){let k=C.get(I0);if(k===void 0||k===null)b.push("");else if(typeof k==="object")if("amount"in k)b.push(k.amount);else b.push(JSON.stringify(k));else b.push(k)}let c=Q.get(P)??[];for(let I0 of z){let k=c.filter((p)=>p.sourceField===I0||z.size===1);if(k.length>0)b.push(k.map((p)=>p.zipPath).join(`
`));else b.push("")}q.addRow(b)}let V=wy1(U,Y);Zy1(Ly1(V),{recursive:!0});let w=await K.xlsx.writeBuffer();process.stderr.write(`\uD83D\uDCE6 正在压缩生成 Webhook 资源包: ${V}...
`),await new Promise((F,N)=>{let O=Xy1(V),D=new Jo({zlib:{level:9}});O.on("close",()=>F()),D.on("error",(P)=>N(P)),D.pipe(O),D.append(Buffer.from(w),{name:"信息表.xlsx"});for(let P of Q.values())for(let T of P)D.append(T.buffer,{name:T.zipPath});D.finalize()});let M=qy1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:I.length,attachmentCount:J,fileSizeBytes:M.size,exportedAt:new Date().toISOString(),nextAction:`seal-use webhook resource-pack push ${V} --corp <targetCorpId>`}}var Ev0;var Ko=m(()=>{Pv0();W4();bZ();Ev0=G6(fZ(),1)});import{readFileSync as My1}from"node:fs";function Oy1($){let Y=new URL($),U=Y.pathname.match(/\/webhook\/([^/]+)/);if(!U)throw Error("Webhook URL 必须包含 /webhook/{webhookId}/document");return{baseUrl:`${Y.protocol}//${Y.host}`,webhookId:U[1]}}function Ny1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function Dy1($,Y){if(!$.length)return;let U=new Set($.map((J)=>{let K=J.fileName.split("/")[0],z=K.indexOf("@");return z>=0?K.slice(0,z):K}).filter((J)=>J!=="信息表.xlsx")),I=[];for(let J of Y){let K=J.document.documentId;if((J.documentAttachments.length>0||Object.values(J.expenseAttachments).some((G)=>G.length>0)||Object.values(J.personAttachments).some((G)=>G.length>0))&&!U.has(K))I.push(`Excel 会议编号「${K}」声明了附件,但在 ZIP 中找不到对应的根目录「${K}/」或「${K}@.../」。`)}let Q=new Set(Y.map((J)=>J.document.documentId));for(let J of U)if(!Q.has(J))I.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(I.length)throw new S5(I)}async function jv0($,Y,U){let I=[],Q=$;if(Ny1($,Y)){I=await xT0($),uT0(I,U);let G=I.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await Km($,G)}let J=await mT0(Q);Dy1(I,J);let K=lT0(I,J),z=J.map((G)=>G.document);return{entries:I,parsed:J,plans:K,documents:z,fileBuffer:$}}async function dI($,Y,U){let I=await jv0($,Y,U),Q=I.parsed.map((J,K)=>Zm(J.document,I.plans[K],new Map));return{warnings:[],documents:Q,attachmentPlan:I.plans}}async function fT($,Y,U){let I=await jv0($,Y,U.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=Oy1(U.webhookUrl),K=[];for(let z=0;z<I.parsed.length;z+=1){let G=I.parsed[z],H=I.plans[z],W=new Map,X=[...H.categoryFields,...Object.values(H.personAttachments).flat(),...Object.values(H.expenseAttachments).flat()];for(let V of X)for(let w of V.paths){if(W.has(w))continue;let M=I.entries.find((T)=>T.fileName===w);if(!M)continue;process.stderr.write(`⬆ 上传附件: ${w}
`);let F=new FormData,N=await Km(I.fileBuffer,M),O=w.split("/").pop()??w;F.append("files",new File([new Uint8Array(N)],O));let D=await fetch(`${Q}/api/v1/integrations/webhook/${encodeURIComponent(J)}/attachments`,{method:"POST",headers:{...U.customHeaders??{},...$q({},U.secret)},body:F});if(!D.ok)throw Error(`附件上传失败 ${D.status}: ${await D.text()}`);let P=await D.json();W.set(w,P.attachments?.map((T)=>T.data)??(P.data===void 0?[]:[P.data])),process.stderr.write(`✓ 附件上传成功: ${w}
`)}process.stderr.write(`\uD83D\uDCE4 推送单据: ${G.document.documentId}
`);let Z=Hm(G.document,H,W),q=await fetch(`${Q}/api/v1/integrations/webhook/${encodeURIComponent(J)}/document`,{method:"POST",headers:{...U.customHeaders??{},"Content-Type":"application/json",...rZ({webhookId:J,...Z},U.secret)},body:JSON.stringify(Z)});if(!q.ok)throw Error(`Webhook 单据推送失败 ${q.status}: ${await q.text()}`);K.push({documentId:Z.documentId,document:Z,pushResult:await q.json()}),process.stderr.write(`✓ 单据推送成功: ${Z.documentId}
`)}return{warnings:[],results:K}}function iI($){return{fileBuffer:qy1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}var Qo=m(()=>{DP();Wm();Gm();Qm();Wz();Io()});import{existsSync as wy1}from"node:fs";async function yT($,Y,U={}){let Q=A4().stateful?"stateful":"stateless",J="ok",K,z,G;try{let D=await o6($);G={id:D.user.id,name:D.user.name,isAdmin:D.user.isAdmin},z={id:D.tenant.id,name:D.tenant.name,tenantSlug:D.tenant.tenantSlug,corporationName:D.tenant.hoseCorpConfig?.corporationName}}catch(D){J="error",K=D instanceof Error?D.message:String(D)}let H=[];if(J==="ok")try{H=await q$($,Y.seal.endpoints.approvalStylePreferences)}catch(D){J="error",K=`读取 Webhook 配置失败: ${D instanceof Error?D.message:String(D)}`}let W=H.length===1,X=H.map((D)=>({id:D.id,name:D.name,mode:D.mode,incomingDocumentWebhookUrl:D.incomingDocumentWebhook.url,outgoingResultWebhookUrl:D.outgoingResultWebhook,autoApprovalRate:D.autoApprovalRate,...W?{isDefault:!0}:{}})),Z=W?{id:H[0].id,name:H[0].name,mode:H[0].mode}:null,q=U.webhook?b7(H,U.webhook):W?H[0]:void 0,V;if(U.filePath)if(!wy1(U.filePath))V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let D=iI(U.filePath),P=await bI(D.fileBuffer,D.fileName,q?.materialPackFilePolicy);V={valid:!0,filePath:U.filePath,fileName:D.fileName,documentCount:P.documents.length,warnings:P.warnings}}catch(D){V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[D instanceof Error?D.message:String(D)]}}let w=V?V.valid:!0,M=J==="ok"&&X.length>0&&w,F=Q==="stateful"?"":` --corp ${Y.id}`,N="",O="";if(J!=="ok")O=`凭证鉴权异常: ${K}`,N=`seal-use auth diagnose${F}`;else if(X.length===0)O="当前企业尚未配置任何 Webhook 集成通道",N=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${F}`;else if(V&&!V.valid)O=`资源包预检失败: ${V.errors?.join("; ")}`,N=`seal-use webhook resource-pack preview ${V.filePath}${F}`;else{O=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${X.length} 个 Webhook 通道,等待载入`;let D=V?.filePath??"<资源包.zip>",P=W?"":` --webhook ${Z?Z.id:"<webhookIdOrName>"}`;N=`seal-use webhook resource-pack push ${D}${P}${F}`}return{ready:M,corp:{id:Y.id,name:Y.name,sourceType:Y.source.type,tenant:z,user:G},stateMode:Q,authStatus:J,authError:K,activeWebhooks:X,defaultWebhook:Z,resourcePack:V,materialPack:V,statusMessage:O,nextAction:N}}var Av0=m(()=>{o$();W4();Qo()});var Jo=m(()=>{Wz();eQ();DP();Qm();Gm();Wm();Qo();Av0();Io()});var vq,My1,E24,j24,C24,R24,_24,v24,S24,h24,Ko,g24,y24,k24,x24,f24,u24,b24,i24,c24,n24,d24,p24,m24,l24,o24,r24,s24,a24,t24,e24,$Y4,YY4,UY4,IY4,QY4,JY4,KY4,zY4,GY4,HY4,WY4,XY4,ZY4,qY4,VY4,LY4,FY4,wY4,MY4,OY4,NY4,DY4,BY4,AY4,PY4,TY4,EY4,jY4,CY4,RY4,_Y4,vY4,SY4,hY4,gY4,yY4,kY4,xY4,fY4,uY4,Pv0;var Tv0=m(()=>{z6();W4();o$();f6();aZ();Jo();eQ();r$();({presentWebhookIntegration:vq,getConfiguredSealBaseUrl:My1,projectApprovalRules:E24,pickRuleFields:j24,buildRulePushPlan:C24,rulesHaveSameContent:R24,ruleChangedFields:_24,normalizeRuleStrictness:v24,parseDurationMs:S24,redactIntegrationSecrets:h24,mutationPreview:Ko,redactPreviewValue:g24,buildSimulationBatchParams:y24,summarizeSimulationBatch:k24,summarizeApprovalRun:x24,summarizeApprovalRuns:f24,parseFieldPaths:u24,pickRunFields:b24,approvalRunMetadata:i24,summarizeApprovalRunDetail:c24,summarizeApprovalRunResult:n24,summarizeApprovalRunDocument:d24,extractCitedRules:p24,firstPath:m24,countPathCandidates:l24,getPath:o24,setPath:r24,compactObject:s24,asRecord:a24,numberFromUnknown:t24,flattenDocumentFields:e24,collectDocumentFields:$Y4,firstByLabel:YY4,collectInvoiceSummary:UY4,collectInvoiceObjects:IY4,findKeywordLines:QY4,summarizeRunBridge:JY4,summarizeRuleVersion:KY4,resolveRuleVersionForLookup:zY4,findRuleInVersion:GY4,normalizeRuleCode:HY4,runtimeRuleIndex:WY4,runtimeRuleIdToCode:XY4,formatRuleCode:ZY4,pickApprovalRunCandidate:qY4,resolveApprovalRunForUrl:VY4,resolveSealBaseUrl:LY4,normalizeUrl:FY4,stringFromUnknown:wY4,pickApprovalRuns:MY4,timestampOf:OY4,resolveRuleVersion:NY4,resolveRuleVersionSelector:DY4,filterRuns:BY4,scalarIncludes:AY4,objectContainsScalar:PY4,filterRunsByHumanResult:TY4,withApprovalRunFilters:EY4,resolveManualApprovalStatus:jY4,prepareApprovalRuns:CY4,approvalRunAliases:RY4,extractHumanResult:_Y4,findHumanResultValue:vY4,isHumanResultKey:SY4,stringifyHumanResultValue:hY4,matchesRunLookup:gY4,countBy:yY4,localDateKey:kY4,formatLocalDateTime:xY4,toDate:fY4,localParts:uY4}=K8),Pv0=[{name:"seal_webhook_list",description:"列出当前 Seal 租户的 Webhook 集成,可按 ID、名称或 URL 查找",parameters:L.object({query:L.string().optional().describe("按集成 ID、名称或 URL 做本地包含匹配"),includeSecret:L.boolean().optional().describe("是否返回 Webhook secret;默认遮罩")} Line truncated
`);let Z=Zm(G.document,H,W),q=await fetch(`${Q}/api/v1/integrations/webhook/${encodeURIComponent(J)}/document`,{method:"POST",headers:{...U.customHeaders??{},"Content-Type":"application/json",...$q({webhookId:J,...Z},U.secret)},body:JSON.stringify(Z)});if(!q.ok)throw Error(`Webhook 单据推送失败 ${q.status}: ${await q.text()}`);K.push({documentId:Z.documentId,document:Z,pushResult:await q.json()}),process.stderr.write(`✓ 单据推送成功: ${Z.documentId}
`)}return{warnings:[],results:K}}function pI($){return{fileBuffer:My1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}var zo=m(()=>{TP();qm();Xm();zm();Vz();Ko()});import{existsSync as By1}from"node:fs";async function uT($,Y,U={}){let Q=P4().stateful?"stateful":"stateless",J="ok",K,z,G;try{let D=await s6($);G={id:D.user.id,name:D.user.name,isAdmin:D.user.isAdmin},z={id:D.tenant.id,name:D.tenant.name,tenantSlug:D.tenant.tenantSlug,corporationName:D.tenant.hoseCorpConfig?.corporationName}}catch(D){J="error",K=D instanceof Error?D.message:String(D)}let H=[];if(J==="ok")try{H=await V$($,Y.seal.endpoints.approvalStylePreferences)}catch(D){J="error",K=`读取 Webhook 配置失败: ${D instanceof Error?D.message:String(D)}`}let W=H.length===1,X=H.map((D)=>({id:D.id,name:D.name,mode:D.mode,incomingDocumentWebhookUrl:D.incomingDocumentWebhook.url,outgoingResultWebhookUrl:D.outgoingResultWebhook,autoApprovalRate:D.autoApprovalRate,...W?{isDefault:!0}:{}})),Z=W?{id:H[0].id,name:H[0].name,mode:H[0].mode}:null,q=U.webhook?c7(H,U.webhook):W?H[0]:void 0,V;if(U.filePath)if(!By1(U.filePath))V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let D=pI(U.filePath),P=await dI(D.fileBuffer,D.fileName,q?.materialPackFilePolicy);V={valid:!0,filePath:U.filePath,fileName:D.fileName,documentCount:P.documents.length,warnings:P.warnings}}catch(D){V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[D instanceof Error?D.message:String(D)]}}let w=V?V.valid:!0,M=J==="ok"&&X.length>0&&w,F=Q==="stateful"?"":` --corp ${Y.id}`,N="",O="";if(J!=="ok")O=`凭证鉴权异常: ${K}`,N=`seal-use auth diagnose${F}`;else if(X.length===0)O="当前企业尚未配置任何 Webhook 集成通道",N=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${F}`;else if(V&&!V.valid)O=`资源包预检失败: ${V.errors?.join("; ")}`,N=`seal-use webhook resource-pack preview ${V.filePath}${F}`;else{O=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${X.length} 个 Webhook 通道,等待载入`;let D=V?.filePath??"<资源包.zip>",P=W?"":` --webhook ${Z?Z.id:"<webhookIdOrName>"}`;N=`seal-use webhook resource-pack push ${D}${P}${F}`}return{ready:M,corp:{id:Y.id,name:Y.name,sourceType:Y.source.type,tenant:z,user:G},stateMode:Q,authStatus:J,authError:K,activeWebhooks:X,defaultWebhook:Z,resourcePack:V,materialPack:V,statusMessage:O,nextAction:N}}var Cv0=m(()=>{r$();W4();zo()});var Go=m(()=>{Vz();IJ();TP();zm();Xm();qm();zo();Cv0();Ko()});var kq,Ay1,h24,g24,y24,k24,x24,f24,u24,b24,Ho,i24,c24,n24,d24,p24,m24,l24,o24,r24,s24,a24,t24,e24,$Y4,YY4,UY4,IY4,QY4,JY4,KY4,zY4,GY4,HY4,WY4,XY4,ZY4,qY4,VY4,LY4,FY4,wY4,MY4,OY4,NY4,DY4,BY4,AY4,PY4,TY4,EY4,jY4,CY4,RY4,_Y4,vY4,SY4,hY4,gY4,yY4,kY4,xY4,fY4,uY4,bY4,iY4,cY4,nY4,dY4,pY4,mY4,Rv0;var _v0=m(()=>{H6();W4();r$();b6();Uq();Go();IJ();a$();({presentWebhookIntegration:kq,getConfiguredSealBaseUrl:Ay1,projectApprovalRules:h24,pickRuleFields:g24,buildRulePushPlan:y24,rulesHaveSameContent:k24,ruleChangedFields:x24,normalizeRuleStrictness:f24,parseDurationMs:u24,redactIntegrationSecrets:b24,mutationPreview:Ho,redactPreviewValue:i24,buildSimulationBatchParams:c24,summarizeSimulationBatch:n24,summarizeApprovalRun:d24,summarizeApprovalRuns:p24,parseFieldPaths:m24,pickRunFields:l24,approvalRunMetadata:o24,summarizeApprovalRunDetail:r24,summarizeApprovalRunResult:s24,summarizeApprovalRunDocument:a24,extractCitedRules:t24,firstPath:e24,countPathCandidates:$Y4,getPath:YY4,setPath:UY4,compactObject:IY4,asRecord:QY4,numberFromUnknown:JY4,flattenDocumentFields:KY4,collectDocumentFields:zY4,firstByLabel:GY4,collectInvoiceSummary:HY4,collectInvoiceObjects:WY4,findKeywordLines:XY4,summarizeRunBridge:ZY4,summarizeRuleVersion:qY4,resolveRuleVersionForLookup:VY4,findRuleInVersion:LY4,normalizeRuleCode:FY4,runtimeRuleIndex:wY4,runtimeRuleIdToCode:MY4,formatRuleCode:OY4,pickApprovalRunCandidate:NY4,resolveApprovalRunForUrl:DY4,resolveSealBaseUrl:BY4,normalizeUrl:AY4,stringFromUnknown:PY4,pickApprovalRuns:TY4,timestampOf:EY4,resolveRuleVersion:jY4,resolveRuleVersionSelector:CY4,filterRuns:RY4,scalarIncludes:_Y4,objectContainsScalar:vY4,filterRunsByHumanResult:SY4,withApprovalRunFilters:hY4,resolveManualApprovalStatus:gY4,prepareApprovalRuns:yY4,approvalRunAliases:kY4,extractHumanResult:xY4,findHumanResultValue:fY4,isHumanResultKey:uY4,stringifyHumanResultValue:bY4,matchesRunLookup:iY4,countBy:cY4,localDateKey:nY4,formatLocalDateTime:dY4,toDate:pY4,localParts:mY4}=G8),Rv0=[{name:"seal_webhook_list",description:"列出当前 Seal 租户的 Webhook 集成,可按 ID、名称或 URL 查找",parameters:L.object({query:L.string().optional().describe("按集成 ID、名称或 URL 做本地包含匹配"),includeSecret:L.boolean().optional().describe("是否返回 Webhook secret;默认遮罩")} Line truncated
`+`• 身份主体:${T}${B}
`+`• 权限范围:持有该链接者在 Seal AI 中拥有该用户的完整操作权限(含系统设置与规则编辑)
`+`• 时效性:换票凭证有效时间 ${q} 秒(${Math.round(q/60)} 分钟),在浏览器打开后将保留 30 天会话
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:W?K:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:K,documentUrl:K,ssoUrl:V,expiresIn:Z?q:void 0,identity:w,warning:M,hoseDomain:J.type==="hose"?Cy1(J.domain):void 0,recordId:Q.id,sourceDocumentSN:Q.sourceDocumentSN,sourceDocumentId:Q.sourceDocumentId,sourceSystem:Q.sourceSystem,missing:{hoseDocumentUrl:!K?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:L.object({query:L.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:L.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:L.string().optional().describe("模拟批次 ID"),latest:L.boolean().optional().describe("只返回最新一条匹配记录"),fields:L.union([L.string(),L.array(L.string())]).optional().describe("限制返回字段"),limit:L.number().int().positive().max(100).optional(),maxScan:L.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:L.boolean().optional()}),handler:async($,Y,U)=>{let I=Y.sn??Y.query;if(!I)throw Error("query or sn is required");let Q=await _y1($,{query:I,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),J=await Promise.all(Q.records.map((X)=>H4($,X.id))),K=jv0(Y.fields),z=J.map((X)=>Ty1(X,K)),G=J.find((X)=>X.ruleSetVersionNumber!==void 0)?.ruleSetVersionNumber,H=G===void 0?"latest":String(G),W=G===void 0?'"latestRuleVersion":true':`"ruleVersionNumber":${G}`;return{query:I,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:Q.total,scanned:Q.scanned,matched:z.length,records:z,next:{getSummary:`seal-use approval-runs get <recordId> --summary --corp ${U.corp.id}`,getRuleVersion:`seal-use rules version ${H} --corp ${U.corp.id}`,searchRuleVersion:`seal-use tool seal_approval_search --corp ${U.corp.id} --json '{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version",${W}}'`,getVersionContext:`seal-use tool seal_approval_context_get --corp ${U.corp.id} --json '{${W}}'`},...Y.includeBridge?{bridge:zo(J)}:{}}}},{name:"seal_approval_run_langfuse_bridge_get",description:"从 Seal approval run 中抽取 Langfuse 定位信息;优先返回 _langfuseTraceId,没有时给出 hosecloud-{sourceDocumentSN} session 回退",parameters:L.object({recordId:L.string().optional(),sourceDocumentSN:L.string().optional(),sourceDocumentId:L.string().optional(),simulationBatchId:L.string().optional(),limit:L.number().int().positive().max(100).optional()}),handler:async($,Y)=>{let I=(Y.simulationBatchId?await bM($,Y.simulationBatchId):(await x4($,{limit:Y.limit??50,search:Y.sourceDocumentSN??Y.sourceDocumentId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId})).records).filter((Q)=>yy1(Q,{recordId:Y.recordId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId}));return{count:I.length,records:I.map(Ev0),bridge:zo(I)}}},{name:"seal_approval_runs_stats",description:"统计审核记录状态分布、来源系统分布及按单号/ID去重统计",parameters:L.object({since:L.string().optional().describe("时间范围,如 3months, 7days, 24hours"),dedupeBy:L.enum(["sourceDocumentSN","sourceDocumentId","id"]).default("sourceDocumentSN").describe("去重字段"),status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional()}),handler:async($,Y)=>{let U=await x4($,{limit:1000,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode}),I=Y.dedupeBy??"sourceDocumentSN",Q=U.records,J={},K={},z=new Set;for(let H of Q){let W=H.status??"unknown";J[W]=(J[W]??0)+1;let X=H.sourceSystem??"unknown";K[X]=(K[X]??0)+1;let Z=H[I];if(Z)z.add(String(Z))}let G=Math.max(0,Q.length-z.size);return{total:Q.length,dedupeBy:I,unique:z.size,duplicateRuns:G,dedupeNote:G>0?`存在 ${G} 笔重复运行记录 (同一单据重跑或修改重推)`:"全部单据唯一,无重复记录",byStatus:J,bySourceSystem:K}}},{name:"seal_approval_runs_count",description:"统计符合条件的审核记录总数",parameters:L.object({status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional(),search:L.string().optional(),startDate:L.string().optional().describe("起始时间戳(毫秒)或日期字符串"),endDate:L.string().optional().describe("结束时间戳(毫秒)或日期字符串")}),handler:async($,Y)=>{let U=await x4($,{limit:1,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode,search:Y.search,startDate:d2(Y.startDate,!1),endDate:d2(Y.endDate,!0)});return{total:U.total??U.records.l Line truncated
`)}function ty1($){let Y=[];if(Y.push(`seal-use ${$.area} - ${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");let U=new Map;for(let Q of $.commands){let J=Q.group??"",K=U.get(J)??[];K.push(Q),U.set(J,K)}let I=[...$.groupOrder??[],...[...U.keys()].filter((Q)=>!$.groupOrder?.includes(Q))];for(let Q of I){let J=U.get(Q);if(!J)continue;if(Q)Y.push(""),Y.push(`${Q}:`);for(let K of J)for(let z of K.usage)Y.push(` ${z}`)}if($.commands.some((Q)=>Q.name))Y.push(""),Y.push(`Run 'seal-use ${$.area} <command> --help' for details on a specific command.`);return Y.join(`
`)}function iv0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of cv0)for(let U of Y.commands)for(let I of U.usage)$.push(` ${I}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var cv0;var Vo=m(()=>{K$();cv0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",groupOrder:["企业接入","发现与选择","企业配置","测试配对与验证","Hose 专属能力"],commands:[{name:"list",group:"发现与选择",summary:"List configured enterprises sorted by 7-day usage frequency",usage:["seal-use corps list [query] [--all] [--limit <n>] [--env <production|test>] [--strict] [--corp <corpId>]"],options:[{flag:"--all",description:"Display all configured enterprises without the default 10-item limit"},{flag:"--limit <n>",description:"Maximum number of enterprises to display (defaults to 10)"},{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}]},{name:"search",aliases:["find"],group:"发现与选择",summary:"Search configured enterprises with intelligent soft fuzzy matching",usage:["seal-use corps search <query> [--env <production|test>] [--strict]"],options:[{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}],description:"Searches enterprise ID, name, staff ID, domain, tenant slug, environment, or bindings. Uses soft search by default (case-insensitive, Chinese homophones, front/back nasal vowels, initials, typo/missing letter tolerance)."},{name:"get",aliases:["show"],group:"发现与选择",summary:"Get rich details and configuration of an enterprise",usage:["seal-use corps get <corpId>"],description:"Retrieves complete enterprise details (URLs, tenant slugs, custom headers/cookies, staff IDs, relations, config file path) with sensitive secrets safely redacted."},{name:"current",group:"发现与选择",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",group:"发现与选择",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",group:"企业配置",summary:"Mark enterprise environment as production or test",usage:["seal-use corps mark <corpId> --env <production|test> [--confirm]"],options:[{flag:"--env <production|test>",description:"Target environment: 'production' or 'test' (required)"},{flag:"--confirm",description:"Confirm the environment update (required)"}],description:"Explicitly updates an enterprise's environment tag. Requires --confirm to prevent accidental changes."},{name:"rename",group:"企业配置",summary:"Rename an enterprise display name",usage:["seal-use corps rename <corpId> --name <newName>"],options:[{flag:"--name <newName>",description:"New human-readable enterprise name (required)"}],description:"Safely updates the display name of a configured enterprise without modifying underlying files manually."},{name:"bind-test",group:"测试配对与验证",summary:"Bind a production enterprise to a test enterprise (1-to-1 association)",usage:["seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]","seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"],options:[{flag:"--confirm",description:"Explicitly confirm binding and tag test environment (required)"},{flag:"--force",description:"Force re-binding if the production enterprise is already bound"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Establishes a strict 1-to-1 association between a production enterprise and a test enterprise. Automatically marks the test enterprise with environment 'test'."},{name:"unbind-test",group:"测试配对与验证",summary:"Unbind a production and test enterprise association",usage:["seal-use corps unbind-test [<corpId>] [--confirm]"],options:[{flag:"--confirm",description:"Explicitly confirm unbinding both sides (required)"},{flag:"--corp <corpId>",description:"Specify enterprise ID or name"}],description:"Removes the 1-to-1 test association from both the production enterprise and the test enterprise."},{name:"sync-test",group:"测试配对与验证",summary:"Synchronize rules and preferences from production to test enterprise",usage:["seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]"],options:[{flag:"--dry-run",description:"Preview sync diff without making network mutations (default)"},{flag:"--yes",description:"Execute synchronization and publish new rule version on test enterprise"},{flag:"--version-name <name>",description:"Custom version name for published test rule version"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Overwrites test enterprise decision preferences with production preferences, syncs production draft rules to test enterprise, and immediately publishes a new versi Line truncated
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:W?K:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:K,documentUrl:K,ssoUrl:V,expiresIn:Z?q:void 0,identity:w,warning:M,hoseDomain:J.type==="hose"?hy1(J.domain):void 0,recordId:Q.id,sourceDocumentSN:Q.sourceDocumentSN,sourceDocumentId:Q.sourceDocumentId,sourceSystem:Q.sourceSystem,missing:{hoseDocumentUrl:!K?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:L.object({query:L.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:L.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:L.string().optional().describe("模拟批次 ID"),latest:L.boolean().optional().describe("只返回最新一条匹配记录"),fields:L.union([L.string(),L.array(L.string())]).optional().describe("限制返回字段"),limit:L.number().int().positive().max(100).optional(),maxScan:L.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:L.boolean().optional()}),handler:async($,Y,U)=>{let I=Y.sn??Y.query;if(!I)throw Error("query or sn is required");let Q=await yy1($,{query:I,sn:Y.sn,batchId:Y.batchId,latest:Y.latest,limit:Y.latest?1:Y.limit??20,maxScan:Y.maxScan??1000}),J=await Promise.all(Q.records.map((W)=>H4($,W.id))),K=Sv0(Y.fields),z=J.map((W)=>_y1(W,K)),G=J.find((W)=>W.ruleSetVersionNumber!==void 0)?.ruleSetVersionNumber,H=G===void 0?"latest":String(G);return{query:I,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:Q.total,scanned:Q.scanned,matched:z.length,records:z,next:{getSummary:`seal-use approval-runs get <recordId> --summary --corp ${U.corp.id}`,getRuleVersion:`seal-use rules version ${H} --corp ${U.corp.id}`,searchRuleVersion:`seal-use rules search <keyword> --version ${H} --corp ${U.corp.id}`,getVersionContext:`seal-use context --ruleVersion ${H} --corp ${U.corp.id}`},...Y.includeBridge?{bridge:Wo(J)}:{}}}},{name:"seal_approval_run_langfuse_bridge_get",description:"从 Seal approval run 中抽取 Langfuse 定位信息;优先返回 _langfuseTraceId,没有时给出 hosecloud-{sourceDocumentSN} session 回退",parameters:L.object({recordId:L.string().optional(),sourceDocumentSN:L.string().optional(),sourceDocumentId:L.string().optional(),simulationBatchId:L.string().optional(),limit:L.number().int().positive().max(100).optional()}),handler:async($,Y)=>{let I=(Y.simulationBatchId?await nM($,Y.simulationBatchId):(await f4($,{limit:Y.limit??50,search:Y.sourceDocumentSN??Y.sourceDocumentId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId})).records).filter((Q)=>by1(Q,{recordId:Y.recordId,sourceDocumentSN:Y.sourceDocumentSN,sourceDocumentId:Y.sourceDocumentId}));return{count:I.length,records:I.map(vv0),bridge:Wo(I)}}},{name:"seal_approval_runs_stats",description:"统计审核记录状态分布、来源系统分布及按单号/ID去重统计",parameters:L.object({since:L.string().optional().describe("时间范围,如 3months, 7days, 24hours"),dedupeBy:L.enum(["sourceDocumentSN","sourceDocumentId","id"]).default("sourceDocumentSN").describe("去重字段"),status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional()}),handler:async($,Y)=>{let U=await f4($,{limit:1000,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode}),I=Y.dedupeBy??"sourceDocumentSN",Q=U.records,J={},K={},z=new Set;for(let H of Q){let W=H.status??"unknown";J[W]=(J[W]??0)+1;let X=H.sourceSystem??"unknown";K[X]=(K[X]??0)+1;let Z=H[I];if(Z)z.add(String(Z))}let G=Math.max(0,Q.length-z.size);return{total:Q.length,dedupeBy:I,unique:z.size,duplicateRuns:G,dedupeNote:G>0?`存在 ${G} 笔重复运行记录 (同一单据重跑或修改重推)`:"全部单据唯一,无重复记录",byStatus:J,bySourceSystem:K}}},{name:"seal_approval_runs_count",description:"统计符合条件的审核记录总数",parameters:L.object({status:L.string().optional(),sourceSystem:L.string().optional(),taskMode:L.string().optional(),search:L.string().optional(),startDate:L.string().optional().describe("起始时间戳(毫秒)或日期字符串"),endDate:L.string().optional().describe("结束时间戳(毫秒)或日期字符串")}),handler:async($,Y)=>{let U=await f4($,{limit:1,status:Y.status,sourceSystem:Y.sourceSystem,taskMode:Y.taskMode,search:Y.search,startDate:m2(Y.startDate,!1),endDate:m2(Y.endDate,!0)});return{total:U.total??U.records.length}}}]});import{readFileSync as iy1}from"node:fs";var $I4,YI4,UI4,II4,QI4,JI4,KI4,zI4,xv0,GI4,HI4,WI4,cy1,ny1,dy1,XI4,ZI4,qI4,VI4,LI4,FI4,wI4,MI4,OI4,NI4,DI4,BI Line truncated
`)}function Uk1($){let Y=[];if(Y.push(`seal-use ${$.area} - ${$.title}`),$.description)Y.push($.description);Y.push(""),Y.push("Usage:");let U=new Map;for(let Q of $.commands){let J=Q.group??"",K=U.get(J)??[];K.push(Q),U.set(J,K)}let I=[...$.groupOrder??[],...[...U.keys()].filter((Q)=>!$.groupOrder?.includes(Q))];for(let Q of I){let J=U.get(Q);if(!J)continue;if(Q)Y.push(""),Y.push(`${Q}:`);for(let K of J)for(let z of K.usage)Y.push(` ${z}`)}if($.commands.some((Q)=>Q.name))Y.push(""),Y.push(`Run 'seal-use ${$.area} <command> --help' for details on a specific command.`);return Y.join(`
`)}function pv0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of mv0)for(let U of Y.commands)for(let I of U.usage)$.push(` ${I}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var mv0;var Oo=m(()=>{n8();mv0=[{area:"corps",title:"Enterprise and tenant management",description:"Manage enterprise configurations, environment modes, test bindings, and syncing.",groupOrder:["企业接入","发现与选择","企业配置","测试配对与验证","Hose 专属能力"],commands:[{name:"list",group:"发现与选择",summary:"List configured enterprises sorted by 7-day usage frequency",usage:["seal-use corps list [query] [--all] [--limit <n>] [--env <production|test>] [--strict] [--corp <corpId>]"],options:[{flag:"--all",description:"Display all configured enterprises without the default 10-item limit"},{flag:"--limit <n>",description:"Maximum number of enterprises to display (defaults to 10)"},{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}]},{name:"search",aliases:["find"],group:"发现与选择",summary:"Search configured enterprises with intelligent soft fuzzy matching",usage:["seal-use corps search <query> [--env <production|test>] [--strict]"],options:[{flag:"--env <production|test>",description:"Filter enterprises by environment ('production' or 'test')"},{flag:"--strict",description:"Use strict exact substring matching instead of default soft fuzzy search"}],description:"Searches enterprise ID, name, staff ID, domain, tenant slug, environment, or bindings. Uses soft search by default (case-insensitive, Chinese homophones, front/back nasal vowels, initials, typo/missing letter tolerance)."},{name:"get",aliases:["show"],group:"发现与选择",summary:"Get rich details and configuration of an enterprise",usage:["seal-use corps get <corpId>"],description:"Retrieves complete enterprise details (URLs, tenant slugs, custom headers/cookies, staff IDs, relations, config file path) with sensitive secrets safely redacted."},{name:"current",group:"发现与选择",summary:"Show active enterprise in stateful mode",usage:["seal-use corps current [--corp <corpId>]"]},{name:"switch",group:"发现与选择",summary:"Switch default active enterprise",usage:["seal-use corps switch <corpId>"]},{name:"mark",group:"企业配置",summary:"Mark enterprise environment as production or test",usage:["seal-use corps mark <corpId> --env <production|test> [--confirm]"],options:[{flag:"--env <production|test>",description:"Target environment: 'production' or 'test' (required)"},{flag:"--confirm",description:"Confirm the environment update (required)"}],description:"Explicitly updates an enterprise's environment tag. Requires --confirm to prevent accidental changes."},{name:"rename",group:"企业配置",summary:"Rename an enterprise display name",usage:["seal-use corps rename <corpId> --name <newName>"],options:[{flag:"--name <newName>",description:"New human-readable enterprise name (required)"}],description:"Safely updates the display name of a configured enterprise without modifying underlying files manually."},{name:"bind-test",group:"测试配对与验证",summary:"Bind a production enterprise to a test enterprise (1-to-1 association)",usage:["seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]","seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"],options:[{flag:"--confirm",description:"Explicitly confirm binding and tag test environment (required)"},{flag:"--force",description:"Force re-binding if the production enterprise is already bound"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Establishes a strict 1-to-1 association between a production enterprise and a test enterprise. Automatically marks the test enterprise with environment 'test'."},{name:"unbind-test",group:"测试配对与验证",summary:"Unbind a production and test enterprise association",usage:["seal-use corps unbind-test [<corpId>] [--confirm]"],options:[{flag:"--confirm",description:"Explicitly confirm unbinding both sides (required)"},{flag:"--corp <corpId>",description:"Specify enterprise ID or name"}],description:"Removes the 1-to-1 test association from both the production enterprise and the test enterprise."},{name:"sync-test",group:"测试配对与验证",summary:"Synchronize rules and preferences from production to test enterprise",usage:["seal-use corps sync-test [<prodCorpId>] [--dry-run] [--yes] [--version-name <name>]"],options:[{flag:"--dry-run",description:"Preview sync diff without making network mutations (default)"},{flag:"--yes",description:"Execute synchronization and publish new rule version on test enterprise"},{flag:"--version-name <name>",description:"Custom version name for published test rule version"},{flag:"--corp <corpId>",description:"Specify production enterprise ID or name"}],description:"Overwrites test enterprise decision preferences with production preferences, syncs production draft rules to test enterprise, and immediately publishes a new versi Line truncated
`)}
`}function j0($,Y={}){Ik1($,Y);let U=`${JSON.stringify($,null,2)}
`;if(Y.outputFile){ey1(Y.outputFile,U),console.log(JSON.stringify({outputFile:Y.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function Ik1($,Y={}){if(Y.allowFull||Y.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>Uk1)throw new sZ(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function mv0($,Y){if(Y)return;let U=$&&typeof $==="object"?$:{},I=typeof U.count==="number"?U.count:void 0,Q=Array.isArray(U.rules)?U.rules.length:void 0,J=Buffer.byteLength(JSON.stringify($),"utf-8"),K=I??Q??0;if(K>$k1||J>Yk1)throw new sZ(`Rule list is large (${K} rules, ${J} bytes). Use "seal-use rules list --summary", "seal-use rules count", or --output-file; pass --full only when you really need full descriptions.`,"seal-use rules list --summary")}function T0($){return{allowFull:G0($.full)===!0,outputFile:h($.outputFile)??h($["output-file"])}}function lv0($=[]){console.log(dv0($))}var $k1=100,Yk1=120000,pv0,Uk1=200000;var o1=m(()=>{q4();K$();Vo();pv0=["code","status","strictness","scope","updatedAt"]});var Fo={};Z8(Fo,{selectCorp:()=>M1,runToolResult:()=>T$,runTool:()=>x0,globalConfigSummary:()=>$Y});function M1($){let Y=I$(),U=A4(),I=p2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},c3());return WA0(I.id),I}function $Y($=A4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:VI()}}async function x0($,Y,U,I,Q={}){j0(await T$($,Y,U,I),Q)}async function T$($,Y,U,I){let Q=Sq.find((z)=>z.name===$);if(!Q)throw Error(`Unknown Seal tool: ${$}`);let J=Object.fromEntries(Object.entries(I).filter(([,z])=>z!==void 0)),K=Q.handler;return K(Y,J,{corp:U})}var O4=m(()=>{o$();HP();hq();o1()});import{existsSync as ov0}from"node:fs";async function rv0($,Y){if(!ov0($))throw Error(`File not found: ${$}`);let U=iI($);j0(await bI(U.fileBuffer,U.fileName,Y))}async function iT($,Y,U,I,Q){if($==="ready"||$==="status"){let J=Y??h(Q.options.file)??h(Q.options.input),K=await yT(U,I,{filePath:J,webhook:h(Q.options.webhook)??h(Q.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 z of K.activeWebhooks){let G=z.isDefault?" [默认通道]":"";console.error(` - ${z.name} (${z.id}) mode=${z.mode}${G}`)}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}`);j0(K,T0(Q.options));return}if($==="replay"){let J=Y??h(Q.options.recordId)??h(Q.options["record-id"])??h(Q.options.id),K=h(Q.options.recordIds)??h(Q.options["record-ids"]),z=K?K.split(",").map((c)=>c.trim()).filter(Boolean):void 0,G=h(Q.options.sn)??h(Q.options.documentSn)??h(Q.options["document-sn"]),H=h(Q.options.sns)??h(Q.options["document-sns"]),W=H?H.split(",").map((c)=>c.trim()).filter(Boolean):void 0,X=s0(Q.options.limit),Z=h(Q.options.status),q=h(Q.options.startDate)??h(Q.options["start-date"]),V=h(Q.options.endDate)??h(Q.options["end-date"]);if(!J&&!z&&!G&&!W&&X===void 0)throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let w=h(Q.options.sourceCorp)??h(Q.options["source-corp"])??h(Q.options.prodCorp)??h(Q.options["prod-corp"]),M=h(Q.options.targetCorp)??h(Q.options["target-corp"])??h(Q.options.testCorp)??h(Q.options["test-corp"]),F=G0(Q.options.force)===!0,{sourceCorp:N,targetCorp:O}=AP({sourceCorpId:w,targetCorpId:M,activeCorp:I,force:F},M1),D=N.id===I.id?U:await A1(N),P=O.id===I.id?U:await A1(O),T=h(Q.options.webhook)??h(Q.options.selector),B=h(Q.options.snSuffix)??h(Q.options["sn-suffix"]),E=h(Q.options.snPrefix)??h(Q.options["sn-prefix"]),C=h(Q.options.docIdSuffix)??h(Q.options["doc-id-suffix"]),i=h(Q.options.docIdPrefix)??h(Q.options["doc-id-prefix"]),x=G0(Q.options.dryRun)??G0(Q.options["dry-run"]),b=await Hz({query:{recordId:J,recordIds:z,sn:G,sns:W,limit:X,status:Z,startDate:q,endDate:V},sourceClient:D,targetClient:P,sourceCorp:N,targetCorp:O,webhookSelector:T,snPrefix:E,snSuffix:B,docIdPrefix:i,docIdSuffix:C,dryRun:x});if(x){console.error(`[webhook-replay] 预Line truncated
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let J=M1(I),K=M1(Q);if(J.id===K.id)throw P4(`Cannot bind enterprise '${J.id}' to itself.`);if(J.prodCorpId&&J.prodCorpId!==K.id)throw P4(`Cannot use '${J.id}' as a production enterprise because it is already registered as a test enterprise for '${J.prodCorpId}'. Multi-tier chaining is not permitted.`);if(K.testCorpId&&K.testCorpId!==J.id)throw P4(`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 z=G0(U.options.force)===!0;if(J.testCorpId&&J.testCorpId!==K.id||K.prodCorpId&&K.prodCorpId!==J.id){if(!z)throw u8(`Enterprise binding conflict: production enterprise '${J.id}' is bound to '${J.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 ${J.id} ${K.id} --confirm --force`)}if(!(G0(U.options.confirm)===!0||G0(U.options.yes)===!0)){let X=z?" --force":"";throw u8(`Refusing to bind test enterprise '${K.name}' (${K.id}) to production enterprise '${J.name}' (${J.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${K.id}' as a test environment.`,`seal-use corps bind-test ${J.id} ${K.id} --confirm${X}`)}if(J.testCorpId&&J.testCorpId!==K.id)try{_9(J.testCorpId,{prodCorpId:void 0})}catch{}if(K.prodCorpId&&K.prodCorpId!==J.id)try{_9(K.prodCorpId,{testCorpId:void 0})}catch{}let H=_9(J.id,{environment:"production",testCorpId:K.id}),W=_9(K.id,{environment:"test",prodCorpId:J.id});return j0({success:!0,productionEnterprise:{id:H.id,name:H.name,environment:H.environment,testCorpId:H.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}}),!0}if($==="unbind-test"){let I=Y??h(U.options.corp),Q=M1(I);if(!Q.testCorpId&&!Q.prodCorpId)return j0({unbound:!1,message:`Enterprise '${Q.name}' (${Q.id}) does not have an active test enterprise binding.`}),!0;let J=Q.testCorpId?Q.id:Q.prodCorpId,K=Q.testCorpId?Q.testCorpId:Q.id;if(!(G0(U.options.confirm)===!0||G0(U.options.yes)===!0))throw u8(`Refusing to unbind production enterprise '${J}' and test enterprise '${K}' without --confirm.`,`seal-use corps unbind-test ${Q.id} --confirm`);_9(J,{testCorpId:void 0});try{_9(K,{prodCorpId:void 0})}catch{}return j0({success:!0,unboundProduction:J,unboundTest:K}),!0}return!1}var YS0=m(()=>{o$();O4();K$();q4();o1()});function cT($){let Y;try{Y=new URL($.trim())}catch{throw Error("Invalid Seal delegate link: expected a valid HTTPS URL")}if(Y.protocol!=="https:")throw Error("Invalid Seal delegate link: expected HTTPS");let U=Y.hostname.toLowerCase();if(!U.endsWith(US0))throw Error(`Invalid Seal delegate link: expected host ending in ${US0}, got ${U}`);let I=Y.pathname.replace(/\/+$/,"");if(I!==IS0)throw Error(`Invalid Seal delegate link: expected path ${IS0}, got ${I}`);let Q=Y.searchParams.get("token");if(!Q)throw Error("Invalid Seal delegate link: token query parameter is required");return{sealUrl:Y.origin,delegateToken:Q}}async function QS0($){let Y=typeof $==="string"?cT($):$;return(await T6(Y.sealUrl,void 0).post("api/v1/delegation/preview",{json:{token:Y.delegateToken}}).json()).data}async function JS0($){let Y=typeof $==="string"?cT($):$,U=Y.sealUrl,I=T6(U,void 0),Q=await I.post("api/v1/delegation/consume",{json:{token:Y.delegateToken}}),J=Q.headers.get("set-cookie")??"",K=typeof Q.headers.getSetCookie==="function"?Q.headers.getSetCookie():[J],z="";for(let M of K)if(M&&M.includes("session_token=")){z=(M.split(";")[0]??"").trim();break}let G;try{G=await I.get("api/auth/get-session",{headers:z?{cookie:z}:{}}).json()}catch{}let H=G?.session?.token;if(!H&&z){let M=z.match(/session_token=([^.;]+)/);if(M?.[1])H=decodeURIComponent(M[1])}if(!H)throw Error("Seal delegate exchange did not return a session token");let W=86400;if(G?.session?.expiresAt){let M=new Date(G.session.expiresAt).getTime();if(Number.isFinite(M)){let F=Math.floor((M-Date.now())/1000);if(F>0)W=F}}let Z=await T6(U,H).get("api/v1/auth/me").json(),q=Z.data&&typeof Z.data==="object"?Z.data:Z,V=q.user??G?.user??{},w=q.tenant??{};return{sealUrl:U,token:H,expiresIn:W,user:V,tenant:w}}function nT($){let Y=[],U=0,I="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),G=K.pathname.replace(/\/+$/,"");if(z.endsWith(".ekuaibao.com")||z.endsWith(".hosecloud.com")||z==="ekuaibao.com"||z==="hosecloud.com")U+=40,I="host is Hose domain";if(G==="/web/thirdparty.html")U+=40,I+="; path is /web/thirdparty.html";if(K.searchParams.has("accessToken"))U+=10,I+="; has accessToken";if(K.searchParams.has("ekbCorpId"))U+=10,I+="; has ekbCorpId"}catch{U=0}if(U>0)Y.push({kind:"hose",score:U,reason:I});let Q=0,J="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),G=K.pathname.replace(/\/+$/,"");if(z.endsWith(".sealai.cc"))Q+=40,J="host ends with .sealai.cc";if(G==="/delegate")Q+=40,J+="; path is /delegate";if( Line truncated
`,{mode:384}),{config:U,path:Q}}var Oo=m(()=>{o$();IP()});function No($){return new Date($).toISOString().replace(/\.\d{3}Z$/,"Z")}function dT($){let Y=new Date($);if(Number.isNaN(Y.getTime()))return $;return No(Y.getTime())}function J5($){return typeof $==="string"&&$?$:void 0}function Hk1($){return{headers:jd.parse($.headers),cookies:Cd.parse($.cookies)}}async function Wk1($,Y,U={}){let I=await o6(T6($,Y,U));return{user:I.user??{},tenant:I.tenant??{}}}async function KS0($){let Y=$.sealUrl.replace(/\/+$/,""),U=$.expiresIn??2592000,I=$.force===!0||$.verify===!1?!1:!0,Q=Hk1($),J=I?await Wk1(Y,$.token,P6(Q)):void 0,K=GS0($,{token:$.token,sealUrl:Y,expiresIn:U,expiresAt:$.expiresAt,verify:I,remote:J,custom:Q}),z=$.tenantId??J5(J?.tenant.id),G=$.tenantSlug??J5(J?.tenant.tenantSlug);return{...K,verified:I,tenantId:z,tenantSlug:G}}function zS0($){let Y=J5($.session.tenant.tenantSlug),U=J5($.session.tenant.id),I=Y??U??"seal-delegate";return{...GS0({id:I,corpId:I,name:$.name,provider:"seal",overwrite:$.overwrite},{token:$.session.token,sealUrl:$.session.sealUrl,expiresIn:$.session.expiresIn,verify:!0,remote:{user:$.session.user,tenant:$.session.tenant}}),tenantId:U,tenantSlug:Y}}function GS0($,Y){let U=Y.remote?.user,I=Y.remote?.tenant,Q=$.tenantSlug??J5(I?.tenantSlug),J=$.tenantId??J5(I?.id),K=$.tenantName??J5(I?.name),z=$.id??Q??J;if(!z)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let G=Y.expiresAt?dT(Y.expiresAt):No(Date.now()+Y.expiresIn*1000),H=$.staffId??J5(U?.providerUserId)??J5(U?.id)??"seal",W=$.provider??J5(U?.provider)??J5(I?.providerConfig?.provider),X=$.corpId??Q??J??z,Z={id:z,name:$.name??K??z,environment:"production",seal:{url:Y.sealUrl,tenantSlug:Q,headers:Y.custom?.headers,cookies:Y.custom?.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:Y.token,sealUrl:Y.sealUrl,expiresIn:Y.expiresIn,expiresAt:G,staffId:H,corpId:X,tenantId:J,tenantSlug:Q,tenantName:K,providerUserId:J5(U?.providerUserId),provider:W},auth:{refreshTtl:300}};return kq(Z,{overwrite:$.overwrite===!0})}var Do=m(()=>{Oo();IP();f6();W4()});async function dz($){let[Y,U]=await Promise.all([D10($),A1($)]),I=await o6(U);return{...Y,tenantId:I.tenant.id,tenantSlug:I.tenant.tenantSlug??Y.tenantSlug,tenantName:I.tenant.name,raw:{...typeof Y.raw==="object"&&Y.raw!==null?Y.raw:{},user:{id:I.user.id,name:I.user.name,isAdmin:I.user.isAdmin,providerUserId:I.user.providerUserId,hosecloudStaff:I.user.hosecloudStaff},tenant:I.tenant}}}var pT=m(()=>{f6();Lg();W4()});async function HS0($){let Y=await aQ($.appKey,$.appSecurity,$.domain),U=await BM(Y.domain,Y.openapiToken).catch(()=>[]);return{...Y,roleCount:U.reduce((I,Q)=>I+Q.roleDefs.length,0),roleGroups:U.map((I)=>({id:I.id,name:I.name,roleDefs:I.roleDefs.map((Q)=>({id:Q.id,name:Q.name,sourceType:Q.sourceType}))}))}}async function WS0($){let Y=await aQ($.appKey,$.appSecurity,$.domain),U=$.role??$.roleDefId??"admin",I=await BM(Y.domain,Y.openapiToken),Q,J;for(let G of I){for(let H of G.roleDefs)if(H.id===U||H.id===`${Y.corpId}:${U}`){Q=H.id,J=H.name;break}if(Q)break}if(!Q&&(U==="admin"||U==="主管理员"))for(let G of I){for(let H of G.roleDefs)if(H.id.endsWith(":admin")||H.name==="主管理员"){Q=H.id,J=H.name;break}if(Q)break}if(!Q)for(let G of I){for(let H of G.roleDefs)if(H.name.toLowerCase().includes(U.toLowerCase())){Q=H.id,J=H.name;break}if(Q)break}if(!Q)throw Error(`Role not found matching query: '${U}'. Run 'seal-use corps probe-hose' to view all available roles.`);let K=await Xg(Y.domain,Y.openapiToken,Q),z=await Zg(Y.domain,Y.openapiToken,K.staffs);return{domain:Y.domain,corpId:Y.corpId,corpName:Y.corpName??Y.corpId,roleId:Q,roleName:J,staffs:z}}async function xq($){let Y=$.domain,U=$.staffId??$.proxyStaffBizId,I=$.force===!0,Q=I||$.verify===!1?!1:!0,J=Y,K=$.corpId??$.corporationId,z=$.name,G;if(!J||!K||!U){let V=await aQ($.appKey,$.appSecurity,Y);J=V.domain,K=K??V.corpId,z=z??V.corpName,G=V.openapiToken}let H=U;if(!H&&G&&J){let V=$.role??"admin",w=await BM(J,G).catch(()=>[]),M;for(let F of w){for(let N of F.roleDefs)if(N.id.endsWith(`:${V}`)||N.name===V||N.id===V){M=N.id;break}if(M)break}if(!M)M=w.find((F)=>F.roleDefs.some((N)=>N.id.endsWith(":admin")))?.roleDefs.find((F)=>F.id.endsWith(":admin"))?.id;if(M){let F=await Xg(J,G,M).catch(()=>({staffs:[]})),N=await Zg(J,G,F.staffs).catch(()=>[]);if($.staffName||$.staffPhone){let O=N.filter((D)=>{if($.staffName&&D.name!==$.staffName&&!D.name.includes($.staffName))return!1;if($.staffPhone&&(!D.cellphone||!D.cellphone.includes($.staffPhone)))return!1;return!0});if(O.length===1&&O[0])H=O[0].id;else if(O.length>1)throw Error(`Multiple staff members matched '${$.staffName??$.staffPhone}': ${O.map((D)=>`${D.name}(${D.id})`).join(", ")}. Please specify exact staffId.`);else throw Error(`No staff member found matching '${$.staffName??$.staffPhone}' under role ${M}. Run 'seal-use corps hose-staffs' to view candidates.`)}else if(!I){let O=N.map( Line truncated
`+"\uD83D\uDCA1 说明:此能力专属于合思 (Hose) 子域,用于将临时会话提权为标准 OpenAPI 开发者接入。需要企业管理员已在合思开放平台创建应用并生成 appKey/appSecurity。",I);if(U.keyId||U.appKey){let Q=$.find((J)=>U.keyId&&J.id===U.keyId||U.appKey&&J.appKey===U.appKey);if(!Q)throw new cI(`指定的合思密钥不存在,请从上述候选列表中选择正确的 appKey 或 keyId。
`}function j0($,Y={}){zk1($,Y);let U=`${JSON.stringify($,null,2)}
`;if(Y.outputFile){Ik1(Y.outputFile,U),console.log(JSON.stringify({outputFile:Y.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function zk1($,Y={}){if(Y.allowFull||Y.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>Kk1)throw new Yq(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function sv0($,Y){if(Y)return;let U=$&&typeof $==="object"?$:{},I=typeof U.count==="number"?U.count:void 0,Q=Array.isArray(U.rules)?U.rules.length:void 0,J=Buffer.byteLength(JSON.stringify($),"utf-8"),K=I??Q??0;if(K>Qk1||J>Jk1)throw new Yq(`Rule list is large (${K} rules, ${J} bytes). Use "seal-use rules list --summary", "seal-use rules count", or --output-file; pass --full only when you really need full descriptions.`,"seal-use rules list --summary")}function T0($){return{allowFull:z0($.full)===!0,outputFile:R($.outputFile)??R($["output-file"])}}function av0($=[]){console.log(ov0($))}var Qk1=100,Jk1=120000,rv0,Kk1=200000;var e1=m(()=>{V4();n8();Oo();rv0=["code","status","strictness","scope","updatedAt"]});var Do={};V8(Do,{selectCorp:()=>M1,runToolResult:()=>E$,runTool:()=>R0,globalConfigSummary:()=>QY});function M1($){let Y=Q$(),U=P4(),I=l2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},n3());return FA0(I.id),I}function QY($=P4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:OI()}}async function R0($,Y,U,I,Q={}){j0(await E$($,Y,U,I),Q)}async function E$($,Y,U,I){let Q=Xo.find((z)=>z.name===$);if(!Q)throw Error(`Unknown Seal tool: ${$}`);let J=Object.fromEntries(Object.entries(I).filter(([,z])=>z!==void 0)),K=Q.handler;return K(Y,J,{corp:U})}var N4=m(()=>{r$();ZP();Zo();e1()});import{existsSync as tv0}from"node:fs";async function ev0($,Y){if(!tv0($))throw Error(`File not found: ${$}`);let U=pI($);j0(await dI(U.fileBuffer,U.fileName,Y))}async function pT($,Y,U,I,Q){if($==="ready"||$==="status"){let J=Y??R(Q.options.file)??R(Q.options.input),K=await uT(U,I,{filePath:J,webhook:R(Q.options.webhook)??R(Q.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 z of K.activeWebhooks){let G=z.isDefault?" [默认通道]":"";console.error(` - ${z.name} (${z.id}) mode=${z.mode}${G}`)}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}`);j0(K,T0(Q.options));return}if($==="replay"){let J=Y??R(Q.options.recordId)??R(Q.options["record-id"])??R(Q.options.id),K=R(Q.options.recordIds)??R(Q.options["record-ids"]),z=K?K.split(",").map((c)=>c.trim()).filter(Boolean):void 0,G=R(Q.options.sn)??R(Q.options.documentSn)??R(Q.options["document-sn"]),H=R(Q.options.sns)??R(Q.options["document-sns"]),W=H?H.split(",").map((c)=>c.trim()).filter(Boolean):void 0,X=l0(Q.options.limit),Z=R(Q.options.status),q=R(Q.options.startDate)??R(Q.options["start-date"]),V=R(Q.options.endDate)??R(Q.options["end-date"]);if(!J&&!z&&!G&&!W&&X===void 0)throw Error("Usage: seal-use webhook replay <recordId> [--sn <documentSN>] [--limit <n>] [--status <status>] [--webhook <idOrName>] [--source-corp <corpId>] [--target-corp <corpId>] [--dry-run]");let w=R(Q.options.sourceCorp)??R(Q.options["source-corp"])??R(Q.options.prodCorp)??R(Q.options["prod-corp"]),M=R(Q.options.targetCorp)??R(Q.options["target-corp"])??R(Q.options.testCorp)??R(Q.options["test-corp"]),F=z0(Q.options.force)===!0,{sourceCorp:N,targetCorp:O}=jP({sourceCorpId:w,targetCorpId:M,activeCorp:I,force:F},M1),D=N.id===I.id?U:await A1(N),P=O.id===I.id?U:await A1(O),T=R(Q.options.webhook)??R(Q.options.selector),B=R(Q.options.snSuffix)??R(Q.options["sn-suffix"]),E=R(Q.options.snPrefix)??R(Q.options["sn-prefix"]),C=R(Q.options.docIdSuffix)??R(Q.options["doc-id-suffix"]),i=R(Q.options.docIdPrefix)??R(Q.options["doc-id-prefix"]),x=z0(Q.options.dryRun)??z0(Q.options["dry-run"]),b=await qz({query:{recordId:J,recordIds:z,sn:G,sns:W,limit:X,status:Z,startDate:q,endDate:V},sourceClient:D,targetClient:P,sourceCorp:N,targetCorp:O,webhookSelector:T,snPrefix:E,snSuffix:B,docIdPrefix:i,docIdSuffix:C,dryRun:x});if(x){console.error(`[webhook-replay] 预Line truncated
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let J=M1(I),K=M1(Q);if(J.id===K.id)throw T4(`Cannot bind enterprise '${J.id}' to itself.`);if(J.prodCorpId&&J.prodCorpId!==K.id)throw T4(`Cannot use '${J.id}' as a production enterprise because it is already registered as a test enterprise for '${J.prodCorpId}'. Multi-tier chaining is not permitted.`);if(K.testCorpId&&K.testCorpId!==J.id)throw T4(`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 z=z0(U.options.force)===!0;if(J.testCorpId&&J.testCorpId!==K.id||K.prodCorpId&&K.prodCorpId!==J.id){if(!z)throw p6(`Enterprise binding conflict: production enterprise '${J.id}' is bound to '${J.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 ${J.id} ${K.id} --confirm --force`)}if(!(z0(U.options.confirm)===!0||z0(U.options.yes)===!0)){let X=z?" --force":"";throw p6(`Refusing to bind test enterprise '${K.name}' (${K.id}) to production enterprise '${J.name}' (${J.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${K.id}' as a test environment.`,`seal-use corps bind-test ${J.id} ${K.id} --confirm${X}`)}if(J.testCorpId&&J.testCorpId!==K.id)try{S9(J.testCorpId,{prodCorpId:void 0})}catch{}if(K.prodCorpId&&K.prodCorpId!==J.id)try{S9(K.prodCorpId,{testCorpId:void 0})}catch{}let H=S9(J.id,{environment:"production",testCorpId:K.id}),W=S9(K.id,{environment:"test",prodCorpId:J.id});return j0({success:!0,productionEnterprise:{id:H.id,name:H.name,environment:H.environment,testCorpId:H.testCorpId},testEnterprise:{id:W.id,name:W.name,environment:W.environment,prodCorpId:W.prodCorpId}}),!0}if($==="unbind-test"){let I=Y??R(U.options.corp),Q=M1(I);if(!Q.testCorpId&&!Q.prodCorpId)return j0({unbound:!1,message:`Enterprise '${Q.name}' (${Q.id}) does not have an active test enterprise binding.`}),!0;let J=Q.testCorpId?Q.id:Q.prodCorpId,K=Q.testCorpId?Q.testCorpId:Q.id;if(!(z0(U.options.confirm)===!0||z0(U.options.yes)===!0))throw p6(`Refusing to unbind production enterprise '${J}' and test enterprise '${K}' without --confirm.`,`seal-use corps unbind-test ${Q.id} --confirm`);S9(J,{testCorpId:void 0});try{S9(K,{prodCorpId:void 0})}catch{}return j0({success:!0,unboundProduction:J,unboundTest:K}),!0}return!1}var JS0=m(()=>{r$();N4();n8();V4();e1()});function mT($){let Y;try{Y=new URL($.trim())}catch{throw Error("Invalid Seal delegate link: expected a valid HTTPS URL")}if(Y.protocol!=="https:")throw Error("Invalid Seal delegate link: expected HTTPS");let U=Y.hostname.toLowerCase();if(!U.endsWith(KS0))throw Error(`Invalid Seal delegate link: expected host ending in ${KS0}, got ${U}`);let I=Y.pathname.replace(/\/+$/,"");if(I!==zS0)throw Error(`Invalid Seal delegate link: expected path ${zS0}, got ${I}`);let Q=Y.searchParams.get("token");if(!Q)throw Error("Invalid Seal delegate link: token query parameter is required");return{sealUrl:Y.origin,delegateToken:Q}}async function GS0($){let Y=typeof $==="string"?mT($):$;return(await j6(Y.sealUrl,void 0).post("api/v1/delegation/preview",{json:{token:Y.delegateToken}}).json()).data}async function HS0($){let Y=typeof $==="string"?mT($):$,U=Y.sealUrl,I=j6(U,void 0),Q=await I.post("api/v1/delegation/consume",{json:{token:Y.delegateToken}}),J=Q.headers.get("set-cookie")??"",K=typeof Q.headers.getSetCookie==="function"?Q.headers.getSetCookie():[J],z="";for(let M of K)if(M&&M.includes("session_token=")){z=(M.split(";")[0]??"").trim();break}let G;try{G=await I.get("api/auth/get-session",{headers:z?{cookie:z}:{}}).json()}catch{}let H=G?.session?.token;if(!H&&z){let M=z.match(/session_token=([^.;]+)/);if(M?.[1])H=decodeURIComponent(M[1])}if(!H)throw Error("Seal delegate exchange did not return a session token");let W=86400;if(G?.session?.expiresAt){let M=new Date(G.session.expiresAt).getTime();if(Number.isFinite(M)){let F=Math.floor((M-Date.now())/1000);if(F>0)W=F}}let Z=await j6(U,H).get("api/v1/auth/me").json(),q=Z.data&&typeof Z.data==="object"?Z.data:Z,V=q.user??G?.user??{},w=q.tenant??{};return{sealUrl:U,token:H,expiresIn:W,user:V,tenant:w}}function lT($){let Y=[],U=0,I="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),G=K.pathname.replace(/\/+$/,"");if(z.endsWith(".ekuaibao.com")||z.endsWith(".hosecloud.com")||z==="ekuaibao.com"||z==="hosecloud.com")U+=40,I="host is Hose domain";if(G==="/web/thirdparty.html")U+=40,I+="; path is /web/thirdparty.html";if(K.searchParams.has("accessToken"))U+=10,I+="; has accessToken";if(K.searchParams.has("ekbCorpId"))U+=10,I+="; has ekbCorpId"}catch{U=0}if(U>0)Y.push({kind:"hose",score:U,reason:I});let Q=0,J="";try{let K=new URL($.trim()),z=K.hostname.toLowerCase(),G=K.pathname.replace(/\/+$/,"");if(z.endsWith(".sealai.cc"))Q+=40,J="host ends with .sealai.cc";if(G==="/delegate")Q+=40,J+="; path is /delegate";if( Line truncated
`,{mode:384}),{config:U,path:Q}}var Po=m(()=>{r$();KP()});function To($){return new Date($).toISOString().replace(/\.\d{3}Z$/,"Z")}function oT($){let Y=new Date($);if(Number.isNaN(Y.getTime()))return $;return To(Y.getTime())}function z5($){return typeof $==="string"&&$?$:void 0}function qk1($){return{headers:vd.parse($.headers),cookies:Sd.parse($.cookies)}}async function Vk1($,Y,U={}){let I=await s6(j6($,Y,U));return{user:I.user??{},tenant:I.tenant??{}}}async function WS0($){let Y=$.sealUrl.replace(/\/+$/,""),U=$.expiresIn??2592000,I=$.force===!0||$.verify===!1?!1:!0,Q=qk1($),J=I?await Vk1(Y,$.token,E6(Q)):void 0,K=ZS0($,{token:$.token,sealUrl:Y,expiresIn:U,expiresAt:$.expiresAt,verify:I,remote:J,custom:Q}),z=$.tenantId??z5(J?.tenant.id),G=$.tenantSlug??z5(J?.tenant.tenantSlug);return{...K,verified:I,tenantId:z,tenantSlug:G}}function XS0($){let Y=z5($.session.tenant.tenantSlug),U=z5($.session.tenant.id),I=Y??U??"seal-delegate";return{...ZS0({id:I,corpId:I,name:$.name,provider:"seal",overwrite:$.overwrite},{token:$.session.token,sealUrl:$.session.sealUrl,expiresIn:$.session.expiresIn,verify:!0,remote:{user:$.session.user,tenant:$.session.tenant}}),tenantId:U,tenantSlug:Y}}function ZS0($,Y){let U=Y.remote?.user,I=Y.remote?.tenant,Q=$.tenantSlug??z5(I?.tenantSlug),J=$.tenantId??z5(I?.id),K=$.tenantName??z5(I?.name),z=$.id??Q??J;if(!z)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let G=Y.expiresAt?oT(Y.expiresAt):To(Date.now()+Y.expiresIn*1000),H=$.staffId??z5(U?.providerUserId)??z5(U?.id)??"seal",W=$.provider??z5(U?.provider)??z5(I?.providerConfig?.provider),X=$.corpId??Q??J??z,Z={id:z,name:$.name??K??z,environment:"production",seal:{url:Y.sealUrl,tenantSlug:Q,headers:Y.custom?.headers,cookies:Y.custom?.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:Y.token,sealUrl:Y.sealUrl,expiresIn:Y.expiresIn,expiresAt:G,staffId:H,corpId:X,tenantId:J,tenantSlug:Q,tenantName:K,providerUserId:z5(U?.providerUserId),provider:W},auth:{refreshTtl:300}};return uq(Z,{overwrite:$.overwrite===!0})}var Eo=m(()=>{Po();KP();b6();W4()});async function oz($){let[Y,U]=await Promise.all([j10($),A1($)]),I=await s6(U);return{...Y,tenantId:I.tenant.id,tenantSlug:I.tenant.tenantSlug??Y.tenantSlug,tenantName:I.tenant.name,raw:{...typeof Y.raw==="object"&&Y.raw!==null?Y.raw:{},user:{id:I.user.id,name:I.user.name,isAdmin:I.user.isAdmin,providerUserId:I.user.providerUserId,hosecloudStaff:I.user.hosecloudStaff},tenant:I.tenant}}}var rT=m(()=>{b6();Og();W4()});async function qS0($){let Y=await YJ($.appKey,$.appSecurity,$.domain),U=await TM(Y.domain,Y.openapiToken).catch(()=>[]);return{...Y,roleCount:U.reduce((I,Q)=>I+Q.roleDefs.length,0),roleGroups:U.map((I)=>({id:I.id,name:I.name,roleDefs:I.roleDefs.map((Q)=>({id:Q.id,name:Q.name,sourceType:Q.sourceType}))}))}}async function VS0($){let Y=await YJ($.appKey,$.appSecurity,$.domain),U=$.role??$.roleDefId??"admin",I=await TM(Y.domain,Y.openapiToken),Q,J;for(let G of I){for(let H of G.roleDefs)if(H.id===U||H.id===`${Y.corpId}:${U}`){Q=H.id,J=H.name;break}if(Q)break}if(!Q&&(U==="admin"||U==="主管理员"))for(let G of I){for(let H of G.roleDefs)if(H.id.endsWith(":admin")||H.name==="主管理员"){Q=H.id,J=H.name;break}if(Q)break}if(!Q)for(let G of I){for(let H of G.roleDefs)if(H.name.toLowerCase().includes(U.toLowerCase())){Q=H.id,J=H.name;break}if(Q)break}if(!Q)throw Error(`Role not found matching query: '${U}'. Run 'seal-use corps probe-hose' to view all available roles.`);let K=await Lg(Y.domain,Y.openapiToken,Q),z=await Fg(Y.domain,Y.openapiToken,K.staffs);return{domain:Y.domain,corpId:Y.corpId,corpName:Y.corpName??Y.corpId,roleId:Q,roleName:J,staffs:z}}async function bq($){let Y=$.domain,U=$.staffId??$.proxyStaffBizId,I=$.force===!0,Q=I||$.verify===!1?!1:!0,J=Y,K=$.corpId??$.corporationId,z=$.name,G;if(!J||!K||!U){let V=await YJ($.appKey,$.appSecurity,Y);J=V.domain,K=K??V.corpId,z=z??V.corpName,G=V.openapiToken}let H=U;if(!H&&G&&J){let V=$.role??"admin",w=await TM(J,G).catch(()=>[]),M;for(let F of w){for(let N of F.roleDefs)if(N.id.endsWith(`:${V}`)||N.name===V||N.id===V){M=N.id;break}if(M)break}if(!M)M=w.find((F)=>F.roleDefs.some((N)=>N.id.endsWith(":admin")))?.roleDefs.find((F)=>F.id.endsWith(":admin"))?.id;if(M){let F=await Lg(J,G,M).catch(()=>({staffs:[]})),N=await Fg(J,G,F.staffs).catch(()=>[]);if($.staffName||$.staffPhone){let O=N.filter((D)=>{if($.staffName&&D.name!==$.staffName&&!D.name.includes($.staffName))return!1;if($.staffPhone&&(!D.cellphone||!D.cellphone.includes($.staffPhone)))return!1;return!0});if(O.length===1&&O[0])H=O[0].id;else if(O.length>1)throw Error(`Multiple staff members matched '${$.staffName??$.staffPhone}': ${O.map((D)=>`${D.name}(${D.id})`).join(", ")}. Please specify exact staffId.`);else throw Error(`No staff member found matching '${$.staffName??$.staffPhone}' under role ${M}. Run 'seal-use corps hose-staffs' to view candidates.`)}else if(!I){let O=N.map( Line truncated
`+"\uD83D\uDCA1 说明:此能力专属于合思 (Hose) 子域,用于将临时会话提权为标准 OpenAPI 开发者接入。需要企业管理员已在合思开放平台创建应用并生成 appKey/appSecurity。",I);if(U.keyId||U.appKey){let Q=$.find((J)=>U.keyId&&J.id===U.keyId||U.appKey&&J.appKey===U.appKey);if(!Q)throw new mI(`指定的合思密钥不存在,请从上述候选列表中选择正确的 appKey 或 keyId。
`+`当前企业存在以下 ${$.length} 套候选密钥:
`+$.map((J)=>` • "${J.name||"未命名应用"}" (appKey: ${J.appKey}, keyId: ${J.id}, 状态: ${J.active?"\uD83D\uDFE2 启用":"⚪ 停用"})`).join(`
`),`${I} --app-key ${$[0].appKey}`);return Q}if($.length===1)return $[0];throw new cI(`
`),`${I} --app-key ${$[0].appKey}`);return Q}if($.length===1)return $[0];throw new mI(`
ℹ️ [合思子域提权] 合思企业 [${Y}] 存在多套 (${$.length} 套) OpenAPI 应用密钥凭据:
${$.map((Q,J)=>` [${J+1}] "${Q.name||"未命名应用"}" (appKey: ${Q.appKey}, keyId: ${Q.id}, 状态: ${Q.active?"\uD83D\uDFE2 启用":"⚪ 停用"})`).join(`
`)}
\uD83D\uDC49 为确保权限提权绑定正确的业务应用,请显式指定要使用的密钥套件:
在命令后追加 --app-key <key> 或 --key-id <id> 参数。
`,`${I} --app-key ${$[0].appKey}`)}async function VS0($){let Y=await Vg($.link),U=qS0(Y.keys,Y.corpId,$,'seal-use corps add-link "<url>" --elevate-hose');if($.dryRun)return{result:Y,selectedKey:U,dryRun:!0};let I=await xq({domain:Y.baseUrl,appKey:U.appKey,appSecurity:U.appSecurity,corpId:Y.corpId,name:$.name??Y.corpName,staffId:Y.staffId,overwrite:$.overwrite,force:$.force});return{result:Y,selectedKey:U,saved:I,dryRun:!1}}async function LS0($){let Y=await Vg($.link);if(!$.save)return{result:Y,reveal:$.reveal===!0};let U=qS0(Y.keys,Y.corpId,$,'seal-use corps hose-extract-keys "<url>" --save'),I=await xq({domain:Y.baseUrl,appKey:U.appKey,appSecurity:U.appSecurity,corpId:Y.corpId,name:$.name??Y.corpName,staffId:Y.staffId,overwrite:$.overwrite,force:$.force});return{result:Y,selectedKey:U,saved:I,reveal:$.reveal===!0}}function FS0($,Y){return{id:$.id,name:$.name||"-",appKey:$.appKey,appSecurity:Y?$.appSecurity:gH($.appSecurity),active:$.active,createTime:$.createTime,updateTime:$.updateTime}}var cI;var wS0=m(()=>{l8();lT();cI=class cI extends Error{nextAction;constructor($,Y){super($);this.name="HoseKeySelectionError",this.nextAction=Y}}});function MS0($){if(!$)return;if($.length<=8)return"****";return`${$.slice(0,4)}...${$.slice(-4)}`}function OS0($){if($.source.type==="hose")return u7($,$.source);return $.seal.url??$.source.sealUrl}function NS0($){if($.type==="hose"){let Y=$.appKey??$.key;return{type:"hose",provider:$.provider??"hosecloud",domain:$.domain,corpId:$.corpId,staffId:$.staffId,appKey:MS0(Y),hasAppSecurity:Boolean($.appSecurity??$.password),hasCloseToken:Boolean($.closeToken),closeTokenExpiresIn:$.closeToken?$.expiresIn:void 0,closeTokenExpiresAt:$.closeToken?$.expiresAt:void 0,credentialMode:$.closeToken?"web-session":"persistent",sealUrl:$.sealUrl}}if($.type==="seal")return{type:"seal",provider:$.provider??"seal",tenantId:$.tenantId,tenantSlug:$.tenantSlug,tenantName:$.tenantName,providerUserId:$.providerUserId,staffId:$.staffId,corpId:$.corpId,sealUrl:$.sealUrl,hasToken:Boolean($.token),tokenMasked:MS0($.token),expiresIn:$.expiresIn,expiresAt:$.expiresAt};throw Error(`Unsupported enterprise source type: ${$.type}`)}function Bo($){if(!$)return"未绑定手机";let Y=$.trim();if(Y.length===11)return`${Y.slice(0,3)}****${Y.slice(7)}`;if(Y.length>=7)return`${Y.slice(0,3)}****${Y.slice(-4)}`;if(Y.length>4)return`${Y.slice(0,2)}****${Y.slice(-2)}`;return Y}var oT=m(()=>{l8()});async function DS0($,Y,U){if($==="probe-hose"){let I=E8(U.json),Q=await HS0({appKey:t3(I,"appKey"),appSecurity:t3(I,"appSecurity"),domain:h6(I,"domain")});return j0({domain:Q.domain,corpId:Q.corpId,name:Q.corpName??Q.corpId,roleCount:Q.roleCount,roleGroups:Q.roleGroups}),!0}if($==="hose-staffs"){let I=E8(U.json),Q=await WS0({appKey:t3(I,"appKey"),appSecurity:t3(I,"appSecurity"),domain:h6(I,"domain"),role:h6(I,"role"),roleDefId:h6(I,"roleDefId")});return j0({domain:Q.domain,corpId:Q.corpId,corpName:Q.corpName,roleId:Q.roleId,roleName:Q.roleName,count:Q.staffs.length,staffs:Q.staffs.map((J)=>({id:J.id,name:J.name,cellphone:Bo(J.cellphone),active:J.active,authState:J.authState,userId:J.userId,email:J.email}))}),!0}if($==="add-hose-persistent"||$==="add-hose"){let Q={...E8(U.json),...U.options.staffName?{staffName:h(U.options.staffName)}:{},...U.options["staff-name"]?{staffName:h(U.options["staff-name"])}:{},...U.options.staffPhone?{staffPhone:h(U.options.staffPhone)}:{},...U.options["staff-phone"]?{staffPhone:h(U.options["staff-phone"])}:{},...U.options.name?{name:h(U.options.name)}:{},...U.options.domain?{domain:h(U.options.domain)}:{},...U.options.corpId?{corpId:h(U.options.corpId)}:{},...U.options["corp-id"]?{corpId:h(U.options["corp-id"])}:{},...U.options.appKey?{appKey:h(U.options.appKey)}:{},...U.options["app-key"]?{appKey:h(U.options["app-key"])}:{},...U.options.appSecurity?{appSecurity:h(U.options.appSecurity)}:{},...U.options["app-security"]?{appSecurity:h(U.options["app-security"])}:{},...U.options.force!==void 0?{force:G0(U.options.force)}:{},...U.options.overwrite!==void 0?{overwrite:G0(U.options.overwrite)}:{}},J=await xq({...Q,appKey:t3(Q,"appKey"),appSecurity:t3(Q,"appSecurity")});return j0({id:J.config.id,name:J.config.name,corpId:J.config.source.type==="hose"?J.config.source.corpId:void 0,domain:J.domain,staffId:J.staffId,verified:J.verified,path:J.path}),!0}if($==="add-hose-web-session"){let Q={...E8(U.json),...U.options.name?{name:h(U.options.name)}:{},...U.options.domain?{baseUrl:h(U.options.domain)}:{},...U.options["base-url"]?{baseUrl:h(U.options["base-url"])}:{},...U.options.corpId?{corpId:h(U.options.corpId)}:{},...U.options["corp-id"]?{corpId:h(U.options["corp-id"])}:{},...U.options.staffId?{staffId:h(U.options.staffId)}:{},...U.options["staff-id"]?{staffId:h(U.options["staff-id"])}:{},...U.options.accessToken?{accessToken:h(U.options.accessToken)}:{},...U.options["access-token"]?{accessToken:h(U.options["access-token"])}:{},...U.options.overwrite!==void 0?{overwrite:G0(U.options.overwrite)}:{},...U.optio Line truncated
`,`${I} --app-key ${$[0].appKey}`)}async function MS0($){let Y=await Mg($.link),U=wS0(Y.keys,Y.corpId,$,'seal-use corps add-link "<url>" --elevate-hose');if($.dryRun)return{result:Y,selectedKey:U,dryRun:!0};let I=await bq({domain:Y.baseUrl,appKey:U.appKey,appSecurity:U.appSecurity,corpId:Y.corpId,name:$.name??Y.corpName,staffId:Y.staffId,overwrite:$.overwrite,force:$.force});return{result:Y,selectedKey:U,saved:I,dryRun:!1}}async function OS0($){let Y=await Mg($.link);if(!$.save)return{result:Y,reveal:$.reveal===!0};let U=wS0(Y.keys,Y.corpId,$,'seal-use corps hose-extract-keys "<url>" --save'),I=await bq({domain:Y.baseUrl,appKey:U.appKey,appSecurity:U.appSecurity,corpId:Y.corpId,name:$.name??Y.corpName,staffId:Y.staffId,overwrite:$.overwrite,force:$.force});return{result:Y,selectedKey:U,saved:I,reveal:$.reveal===!0}}function NS0($,Y){return{id:$.id,name:$.name||"-",appKey:$.appKey,appSecurity:Y?$.appSecurity:fH($.appSecurity),active:$.active,createTime:$.createTime,updateTime:$.updateTime}}var mI;var DS0=m(()=>{o8();aT();mI=class mI extends Error{nextAction;constructor($,Y){super($);this.name="HoseKeySelectionError",this.nextAction=Y}}});function BS0($){if(!$)return;if($.length<=8)return"****";return`${$.slice(0,4)}...${$.slice(-4)}`}function AS0($){if($.source.type==="hose")return i7($,$.source);return $.seal.url??$.source.sealUrl}function PS0($){if($.type==="hose"){let Y=$.appKey??$.key;return{type:"hose",provider:$.provider??"hosecloud",domain:$.domain,corpId:$.corpId,staffId:$.staffId,appKey:BS0(Y),hasAppSecurity:Boolean($.appSecurity??$.password),hasCloseToken:Boolean($.closeToken),closeTokenExpiresIn:$.closeToken?$.expiresIn:void 0,closeTokenExpiresAt:$.closeToken?$.expiresAt:void 0,credentialMode:$.closeToken?"web-session":"persistent",sealUrl:$.sealUrl}}if($.type==="seal")return{type:"seal",provider:$.provider??"seal",tenantId:$.tenantId,tenantSlug:$.tenantSlug,tenantName:$.tenantName,providerUserId:$.providerUserId,staffId:$.staffId,corpId:$.corpId,sealUrl:$.sealUrl,hasToken:Boolean($.token),tokenMasked:BS0($.token),expiresIn:$.expiresIn,expiresAt:$.expiresAt};throw Error(`Unsupported enterprise source type: ${$.type}`)}function jo($){if(!$)return"未绑定手机";let Y=$.trim();if(Y.length===11)return`${Y.slice(0,3)}****${Y.slice(7)}`;if(Y.length>=7)return`${Y.slice(0,3)}****${Y.slice(-4)}`;if(Y.length>4)return`${Y.slice(0,2)}****${Y.slice(-2)}`;return Y}var tT=m(()=>{o8()});async function TS0($,Y,U){if($==="probe-hose"){let I=L6(U.json),Q=await qS0({appKey:$7(I,"appKey"),appSecurity:$7(I,"appSecurity"),domain:y6(I,"domain")});return j0({domain:Q.domain,corpId:Q.corpId,name:Q.corpName??Q.corpId,roleCount:Q.roleCount,roleGroups:Q.roleGroups}),!0}if($==="hose-staffs"){let I=L6(U.json),Q=await VS0({appKey:$7(I,"appKey"),appSecurity:$7(I,"appSecurity"),domain:y6(I,"domain"),role:y6(I,"role"),roleDefId:y6(I,"roleDefId")});return j0({domain:Q.domain,corpId:Q.corpId,corpName:Q.corpName,roleId:Q.roleId,roleName:Q.roleName,count:Q.staffs.length,staffs:Q.staffs.map((J)=>({id:J.id,name:J.name,cellphone:jo(J.cellphone),active:J.active,authState:J.authState,userId:J.userId,email:J.email}))}),!0}if($==="add-hose-persistent"||$==="add-hose"){let Q={...L6(U.json),...U.options.staffName?{staffName:R(U.options.staffName)}:{},...U.options["staff-name"]?{staffName:R(U.options["staff-name"])}:{},...U.options.staffPhone?{staffPhone:R(U.options.staffPhone)}:{},...U.options["staff-phone"]?{staffPhone:R(U.options["staff-phone"])}:{},...U.options.name?{name:R(U.options.name)}:{},...U.options.domain?{domain:R(U.options.domain)}:{},...U.options.corpId?{corpId:R(U.options.corpId)}:{},...U.options["corp-id"]?{corpId:R(U.options["corp-id"])}:{},...U.options.appKey?{appKey:R(U.options.appKey)}:{},...U.options["app-key"]?{appKey:R(U.options["app-key"])}:{},...U.options.appSecurity?{appSecurity:R(U.options.appSecurity)}:{},...U.options["app-security"]?{appSecurity:R(U.options["app-security"])}:{},...U.options.force!==void 0?{force:z0(U.options.force)}:{},...U.options.overwrite!==void 0?{overwrite:z0(U.options.overwrite)}:{}},J=await bq({...Q,appKey:$7(Q,"appKey"),appSecurity:$7(Q,"appSecurity")});return j0({id:J.config.id,name:J.config.name,corpId:J.config.source.type==="hose"?J.config.source.corpId:void 0,domain:J.domain,staffId:J.staffId,verified:J.verified,path:J.path}),!0}if($==="add-hose-web-session"){let Q={...L6(U.json),...U.options.name?{name:R(U.options.name)}:{},...U.options.domain?{baseUrl:R(U.options.domain)}:{},...U.options["base-url"]?{baseUrl:R(U.options["base-url"])}:{},...U.options.corpId?{corpId:R(U.options.corpId)}:{},...U.options["corp-id"]?{corpId:R(U.options["corp-id"])}:{},...U.options.staffId?{staffId:R(U.options.staffId)}:{},...U.options["staff-id"]?{staffId:R(U.options["staff-id"])}:{},...U.options.accessToken?{accessToken:R(U.options.accessToken)}:{},...U.options["access-token"]?{accessToken:R(U.options["access-token"])}:{},...U.options.overwrite!==void 0?{overwrite:z0(U.options.overwrite)}:{},...U.optio Line truncated
`);else console.error(`⚠️ [合思子域提权] 正在以明文展示合思 (Hose) appSecurity 接入密码,请妥善保管敏感凭据。
`);j0({provider:"hose",capability:"privilege-elevation",corpId:I.corpId,corpName:I.corpName??I.corpId,baseUrl:I.baseUrl,staffId:I.staffId,keyCount:I.keys.length,keys:I.keys.map((J)=>FS0(J,Q))})}async function rT($,Y){let U=M1($),I=Y.reveal===!0;if(U.source.type!=="hose")throw new z4(`【合思子域专享能力】当前企业「${U.name}」(id: ${U.id}) 为原生 Seal (${U.source.type}) 租户,非合思 (Hose/合思云/易快报) 渠道企业。
`);j0({provider:"hose",capability:"privilege-elevation",corpId:I.corpId,corpName:I.corpName??I.corpId,baseUrl:I.baseUrl,staffId:I.staffId,keyCount:I.keys.length,keys:I.keys.map((J)=>NS0(J,Q))})}async function eT($,Y){let U=M1($),I=Y.reveal===!0;if(U.source.type!=="hose")throw new z4(`【合思子域专享能力】当前企业「${U.name}」(id: ${U.id}) 为原生 Seal (${U.source.type}) 租户,非合思 (Hose/合思云/易快报) 渠道企业。
`+"OpenAPI 密钥查询与提权能力专属于合思生态租户(用于从合思协助链接或合思凭据中提取开发者密钥提升权限等级),非合思渠道企业不支持此能力。",2);let Q=U.source.appKey??U.source.key,J=U.source.appSecurity??U.source.password;if(!I)console.error(`\uD83D\uDCA1 [合思子域] 接入密码默认脱敏,附加 --reveal (或 -r) 可查看完整 appSecurity 明文。
`);else console.error(`⚠️ [合思子域] 正在以明文展示合思 appSecurity 接入密码,请妥善保管敏感凭据。
`);j0({provider:"hose",capability:"privilege-elevation",corpId:U.id,corpName:U.name,domain:U.source.domain,staffId:U.source.staffId,appKey:Q??"-",appSecurity:J?I?J:gH(J):"-",active:!0})}var BS0=m(()=>{l8();Mo();Do();ZS0();lT();wS0();K$();O4();q4();o1();oT()});var PS0,TS0,sT,AS0,r4;var K5=m(()=>{PS0=/^[\uD800-\uDBFF]$/,TS0=/^[\uDC00-\uDFFF]$/,sT=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;(function($){$[$.Unknown=0.0000000000001]="Unknown",$[$.Rule=0.000000000001]="Rule",$[$.DICT=0.00000002]="DICT",$[$.Surname=1]="Surname",$[$.Custom=1]="Custom"})(AS0||(AS0={}));r4={Normal:1,Surname:10,Custom:100}});function YY($){var Y;return $.length-(((Y=$.match(sT))===null||Y===void 0?void 0:Y.length)||0)}function E$($){if(sT.lastIndex=0,!sT.test($))return $.split("");let Y=[],U=0;while(U<$.length){let I=$[U];if(PS0.test(I)&&TS0.test($[U+1]))Y.push($.substring(U,U+2)),U+=2;else Y.push(I),U+=1}return Y}class pz{constructor(){this.NumberDICT=[],this.StringDICT=new Map}get($){if($.length>1)return this.StringDICT.get($);else{let Y=$.charCodeAt(0);return this.NumberDICT[Y]}}set($,Y){if($.length>1)this.StringDICT.set($,Y);else{let U=$.charCodeAt(0);this.NumberDICT[U]=Y}}clear(){this.NumberDICT=[],this.StringDICT.clear()}}var u9=m(()=>{K5()});function Vk1(){let $={零一:"líng yī",〇一:"líng yī",十一:"shí yī",一十:"yī shí",第一:"dì yī",一十一:"yī shí yī"};for(let Y in ES0)for(let U in jS0){let I=`${Y}${U}`,Q=`${ES0[Y]} ${jS0[U]}`;$[I]=Q}return $}var RS0,_S0,vS0,SS0,hS0,ES0,jS0,CS0,gS0,Ao,yS0,kS0;var Po=m(()=>{K5();u9();RS0=["zh","ch","sh","z","c","s","b","p","m","f","d","t","n","l","g","k","h","j","q","x","r","y","w",""],_S0=["j","q","x"],vS0=["uān","uán","uǎn","uàn","uan","uē","ué","uě","uè","ue","ūn","ún","ǔn","ùn","un","ū","ú","ǔ","ù","u"],SS0={uān:"üān",uán:"üán",uǎn:"üǎn",uàn:"üàn",uan:"üan",uē:"üē",ué:"üé",uě:"üě",uè:"üè",ue:"üe",ūn:"ǖn",ún:"ǘn",ǔn:"ǚn",ùn:"ǜn",un:"ün",ū:"ǖ",ú:"ǘ",ǔ:"ǚ",ù:"ǜ",u:"ü"},hS0=["ia","ian","iang","iao","ie","iu","iong","ua","uai","uan","uang","ue","ui","uo","üan","üe","van","ve"],ES0={一:"yì",二:"èr",三:"sān",四:"sì",五:"wǔ",六:"liù",七:"qī",八:"bā",九:"jiǔ",十:"shí",百:"bǎi",千:"qiān",万:"wàn",亿:"yì",单:"dān",两:"liǎng",双:"shuāng",多:"duō",几:"jǐ",十一:"shí yī",零一:"líng yī",第一:"dì yī",一十:"yī shí",一十一:"yī shí yī"},jS0={重:"chóng",行:"háng",斗:"dǒu",更:"gēng"};CS0=Vk1(),gS0=Object.keys(CS0).map(($)=>({zh:$,pinyin:CS0[$],probability:0.000000000001,length:YY($),priority:r4.Normal,dict:Symbol("rule")})),Ao={不:{bú:[4]},一:{yí:[4],yì:[1,2,3]}},yS0={不:["的","而","之","后","也","还","地"],一:["的","而","之","后","也","还","是"]},kS0=Object.keys(Ao)});var xS0,g5;var aT=m(()=>{u9();xS0={"bǎng páng pāng":["膀"],líng:["〇","伶","凌","刢","囹","坽","夌","姈","婈","孁","岺","彾","掕","昤","朎","柃","棂","櫺","欞","泠","淩","澪","灵","燯","爧","狑","玲","琌","瓴","皊","砱","祾","秢","竛","笭","紷","綾","绫","羐","羚","翎","聆","舲","苓","菱","蓤","蔆","蕶","蛉","衑","裬","詅","跉","軨","輘","酃","醽","鈴","錂","铃","閝","陵","零","霊","霗","霛","霝","靈","駖","魿","鯪","鲮","鴒","鸰","鹷","麢","齡","齢","龄","龗","㥄"],yī:["一","乊","伊","依","医","吚","咿","噫","壱","壹","夁","嫛","嬄","弌","揖","撎","檹","毉","洢","渏","漪","瑿","畩","祎","禕","稦","繄","蛜","衤","譩","辷","郼","醫","銥","铱","鷖","鹥","黟","黳"],"dīng zhēng":["丁"],"kǎo qiǎo yú":["丂"],qī:["七","倛","僛","凄","嘁","墄","娸","悽","慼","慽","戚","捿","柒","桤","桼","棲","榿","欺","沏","淒","漆","紪","緀","萋","褄","諆","迉","郪","鏚","霋","魌","鶈"],shàng:["丄","尙","尚","恦","緔","绱"],xià:["丅","下","乤","圷","夏","夓","懗","梺","疜","睱","罅","鎼","鏬"],hǎn:["丆","喊","浫","罕","豃","㘎"],"wàn mò":["万"],zhàng:["丈","仗","墇","嶂","帐","帳","幛","扙","杖","涱","痮","瘬","瘴","瞕","粀","胀","脹","賬","账","障"],sān:["三","厁","叁","弎","毵","毶","毿","犙","鬖"],"shàng shǎng shang":["上"],"qí jī":["丌","其","奇"],"bù fǒu":["不"],"yǔ yù yú":["与"],miǎn:["丏","偭","免","冕","勉","勔","喕","娩","愐","汅","沔","湎","睌","緬","缅","腼","葂","靦","鮸","\uD867\uDF83"],gài:["丐","乢","匃","匄","戤","概","槩","槪","溉","漑","瓂","葢","鈣","钙","\uD872\uDFBF"],chǒu:["丑","丒","侴","吜","杽","瞅","矁","醜","魗"],zhuān:["专","叀","嫥","専","專","瑼","甎","砖","磗","磚","蟤","諯","鄟","顓","颛","鱄","䏝"],"qiě jū":["且"],pī:["丕","伓","伾","噼","坯","岯","憵","批","披","炋","狉","狓","砒","磇","礔","礕","秛","秠","耚","豾","邳","鈚","鉟","銔","錃","錍","霹","駓","髬","魾","\uD873\uDCF5"],shì:["世","丗","亊","事","仕","侍","冟","势","勢" Line truncated
`);j0({provider:"hose",capability:"privilege-elevation",corpId:U.id,corpName:U.name,domain:U.source.domain,staffId:U.source.staffId,appKey:Q??"-",appSecurity:J?I?J:fH(J):"-",active:!0})}var ES0=m(()=>{o8();Ao();Eo();FS0();aT();DS0();n8();N4();V4();e1();tT()});var CS0,RS0,$E,jS0,s4;var G5=m(()=>{CS0=/^[\uD800-\uDBFF]$/,RS0=/^[\uDC00-\uDFFF]$/,$E=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;(function($){$[$.Unknown=0.0000000000001]="Unknown",$[$.Rule=0.000000000001]="Rule",$[$.DICT=0.00000002]="DICT",$[$.Surname=1]="Surname",$[$.Custom=1]="Custom"})(jS0||(jS0={}));s4={Normal:1,Surname:10,Custom:100}});function JY($){var Y;return $.length-(((Y=$.match($E))===null||Y===void 0?void 0:Y.length)||0)}function j$($){if($E.lastIndex=0,!$E.test($))return $.split("");let Y=[],U=0;while(U<$.length){let I=$[U];if(CS0.test(I)&&RS0.test($[U+1]))Y.push($.substring(U,U+2)),U+=2;else Y.push(I),U+=1}return Y}class rz{constructor(){this.NumberDICT=[],this.StringDICT=new Map}get($){if($.length>1)return this.StringDICT.get($);else{let Y=$.charCodeAt(0);return this.NumberDICT[Y]}}set($,Y){if($.length>1)this.StringDICT.set($,Y);else{let U=$.charCodeAt(0);this.NumberDICT[U]=Y}}clear(){this.NumberDICT=[],this.StringDICT.clear()}}var b9=m(()=>{G5()});function Mk1(){let $={零一:"líng yī",〇一:"líng yī",十一:"shí yī",一十:"yī shí",第一:"dì yī",一十一:"yī shí yī"};for(let Y in _S0)for(let U in vS0){let I=`${Y}${U}`,Q=`${_S0[Y]} ${vS0[U]}`;$[I]=Q}return $}var hS0,gS0,yS0,kS0,xS0,_S0,vS0,SS0,fS0,Co,uS0,bS0;var Ro=m(()=>{G5();b9();hS0=["zh","ch","sh","z","c","s","b","p","m","f","d","t","n","l","g","k","h","j","q","x","r","y","w",""],gS0=["j","q","x"],yS0=["uān","uán","uǎn","uàn","uan","uē","ué","uě","uè","ue","ūn","ún","ǔn","ùn","un","ū","ú","ǔ","ù","u"],kS0={uān:"üān",uán:"üán",uǎn:"üǎn",uàn:"üàn",uan:"üan",uē:"üē",ué:"üé",uě:"üě",uè:"üè",ue:"üe",ūn:"ǖn",ún:"ǘn",ǔn:"ǚn",ùn:"ǜn",un:"ün",ū:"ǖ",ú:"ǘ",ǔ:"ǚ",ù:"ǜ",u:"ü"},xS0=["ia","ian","iang","iao","ie","iu","iong","ua","uai","uan","uang","ue","ui","uo","üan","üe","van","ve"],_S0={一:"yì",二:"èr",三:"sān",四:"sì",五:"wǔ",六:"liù",七:"qī",八:"bā",九:"jiǔ",十:"shí",百:"bǎi",千:"qiān",万:"wàn",亿:"yì",单:"dān",两:"liǎng",双:"shuāng",多:"duō",几:"jǐ",十一:"shí yī",零一:"líng yī",第一:"dì yī",一十:"yī shí",一十一:"yī shí yī"},vS0={重:"chóng",行:"háng",斗:"dǒu",更:"gēng"};SS0=Mk1(),fS0=Object.keys(SS0).map(($)=>({zh:$,pinyin:SS0[$],probability:0.000000000001,length:JY($),priority:s4.Normal,dict:Symbol("rule")})),Co={不:{bú:[4]},一:{yí:[4],yì:[1,2,3]}},uS0={不:["的","而","之","后","也","还","地"],一:["的","而","之","后","也","还","是"]},bS0=Object.keys(Co)});var iS0,k5;var YE=m(()=>{b9();iS0={"bǎng páng pāng":["膀"],líng:["〇","伶","凌","刢","囹","坽","夌","姈","婈","孁","岺","彾","掕","昤","朎","柃","棂","櫺","欞","泠","淩","澪","灵","燯","爧","狑","玲","琌","瓴","皊","砱","祾","秢","竛","笭","紷","綾","绫","羐","羚","翎","聆","舲","苓","菱","蓤","蔆","蕶","蛉","衑","裬","詅","跉","軨","輘","酃","醽","鈴","錂","铃","閝","陵","零","霊","霗","霛","霝","靈","駖","魿","鯪","鲮","鴒","鸰","鹷","麢","齡","齢","龄","龗","㥄"],yī:["一","乊","伊","依","医","吚","咿","噫","壱","壹","夁","嫛","嬄","弌","揖","撎","檹","毉","洢","渏","漪","瑿","畩","祎","禕","稦","繄","蛜","衤","譩","辷","郼","醫","銥","铱","鷖","鹥","黟","黳"],"dīng zhēng":["丁"],"kǎo qiǎo yú":["丂"],qī:["七","倛","僛","凄","嘁","墄","娸","悽","慼","慽","戚","捿","柒","桤","桼","棲","榿","欺","沏","淒","漆","紪","緀","萋","褄","諆","迉","郪","鏚","霋","魌","鶈"],shàng:["丄","尙","尚","恦","緔","绱"],xià:["丅","下","乤","圷","夏","夓","懗","梺","疜","睱","罅","鎼","鏬"],hǎn:["丆","喊","浫","罕","豃","㘎"],"wàn mò":["万"],zhàng:["丈","仗","墇","嶂","帐","帳","幛","扙","杖","涱","痮","瘬","瘴","瞕","粀","胀","脹","賬","账","障"],sān:["三","厁","叁","弎","毵","毶","毿","犙","鬖"],"shàng shǎng shang":["上"],"qí jī":["丌","其","奇"],"bù fǒu":["不"],"yǔ yù yú":["与"],miǎn:["丏","偭","免","冕","勉","勔","喕","娩","愐","汅","沔","湎","睌","緬","缅","腼","葂","靦","鮸","\uD867\uDF83"],gài:["丐","乢","匃","匄","戤","概","槩","槪","溉","漑","瓂","葢","鈣","钙","\uD872\uDFBF"],chǒu:["丑","丒","侴","吜","杽","瞅","矁","醜","魗"],zhuān:["专","叀","嫥","専","專","瑼","甎","砖","磗","磚","蟤","諯","鄟","顓","颛","鱄","䏝"],"qiě jū":["且"],pī:["丕","伓","伾","噼","坯","岯","憵","批","披","炋","狉","狓","砒","磇","礔","礕","秛","秠","耚","豾","邳","鈚","鉟","銔","錃","錍","霹","駓","髬","魾","\uD873\uDCF5"],shì:["世","丗","亊","事","仕","侍","冟","势","勢" Line truncated
`+`\uD83D\uDC49 查看全部请添加: seal-use corps list --all
`+"\uD83D\uDC49 检索指定企业请使用: seal-use corps search <keyword>")}return j0(F.map((N)=>({id:N.id,name:N.name,environment:N.environment??"production",sourceType:N.source.type,provider:N.source.provider??N.source.type,staffId:N.source.staffId,testCorpId:N.testCorpId,prodCorpId:N.prodCorpId,current:N.id===H}))),!0}if($==="get"||$==="show"){let I=Y??h(U.options.corp);if(!I)throw P4("Usage: seal-use corps get <corpId>");let Q=M1(I),J=_d(Q.id),K=OS0(Q);return j0({id:Q.id,name:Q.name,environment:Q.environment??"production",configFile:J,seal:{url:K,tenantSlug:Q.seal.tenantSlug??Q.source.tenantSlug,customHeaderNames:Q.seal.headers?Object.keys(Q.seal.headers):[],customCookieNames:Q.seal.cookies?Object.keys(Q.seal.cookies):[],endpoints:Q.seal.endpoints},source:NS0(Q.source),relations:{testCorpId:Q.testCorpId,prodCorpId:Q.prodCorpId},auth:{refreshTtl:Q.auth.refreshTtl}}),!0}if($==="current"){let I=M1(h(U.options.corp));return j0({id:I.id,name:I.name,environment:I.environment??"production",sourceType:I.source.type,provider:I.source.provider??I.source.type,staffId:I.source.staffId,testCorpId:I.testCorpId,prodCorpId:I.prodCorpId}),!0}if($==="mark"||$==="mark-test"||$==="mark-prod"){let I=Y??h(U.options.corp);if(!I)throw P4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");let Q=M1(I),J=$==="mark-test"?"test":$==="mark-prod"?"production":h(U.options.env)??h(U.options.environment);if(J!=="production"&&J!=="test")throw P4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");if(!(G0(U.options.confirm)===!0||G0(U.options.yes)===!0))throw u8(`Refusing to change environment tag of enterprise '${Q.name}' (${Q.id}) to '${J}' without --confirm. Marking alters synchronization safety guards.`,`seal-use corps mark ${Q.id} --env ${J} --confirm`);let z=_9(Q.id,{environment:J});return j0({id:z.id,name:z.name,environment:z.environment,testCorpId:z.testCorpId,prodCorpId:z.prodCorpId}),!0}if($==="rename"){let I=Y??h(U.options.corp)??h(U.options.id),Q=h(U.options.name)??h(U.options.to)??(U.command[3]&&!U.command[3].startsWith("-")?U.command[3]:void 0);if(!I||!Q)throw Error("Usage: seal-use corps rename <corpId> --name <newName>");let J=M1(I),K=_9(J.id,{name:Q});return j0({success:!0,id:K.id,name:K.name,previousName:J.name}),!0}if($==="switch"){let I=Y;if(!I)throw Error("Usage: seal-use corps switch <corpId>");let Q=A4();if(!Q.stateful)throw Error("Cannot switch the default enterprise while stateless mode is enabled. Use `seal-use config mode stateful` first.");let J=M1(I);return LI({...Q,stateful:!0,defaultCorpId:J.id}),j0({current:!0,id:J.id,name:J.name}),!0}return!1}var bh0=m(()=>{o$();fh0();HP();O4();K$();q4();o1();oT()});import{existsSync as xk1,mkdirSync as fk1,readFileSync as uk1,writeFileSync as ih0}from"node:fs";import{homedir as bk1}from"node:os";import{join as IE}from"node:path";function ch0(){let $=process.env.SEAL_USE_MAPPINGS_DIR?.trim();if($)return $;return IE(bk1(),".config","seal-use","mappings")}function nh0($){let Y=ch0();fk1(Y,{recursive:!0,mode:448});let U=IE(Y,`${$.target.id}-v${$.target.publishedVersionNumber}.json`),I=IE(Y,`${$.target.id}-latest.json`),Q=JSON.stringify($,null,2);return ih0(U,Q,{encoding:"utf-8",mode:384}),ih0(I,Q,{encoding:"utf-8",mode:384}),U}function dh0($,Y){let U=ch0(),I;if(!Y||Y==="latest")I=`${$}-latest.json`;else{let J=String(Y).replace(/^v/i,"");I=`${$}-v${J}.json`}let Q=IE(U,I);if(!xk1(Q))return null;try{let J=uk1(Q,"utf-8");return JSON.parse(J)}catch{return null}}function ph0($,Y){if(!Y)return $;let U=Y.trim().toLowerCase();return $.filter((I)=>{return String(I.sourceRuleCode).toLowerCase()===U||String(I.targetRuleCode).toLowerCase()===U||I.sourceRuleId.toLowerCase()===U||I.targetRuleId.toLowerCase()===U||`#${I.sourceRuleCode}`.toLowerCase()===U||`#${I.targetRuleCode}`.toLowerCase()===U})}function mh0($,Y,U){let I=0,Q=Y!==void 0?new RegExp(`\\[Prod v${Y}\\s*·\\s*#(\\d+)(?:[^\\]]*)\\]`):/\[Prod draft\s*·\s*#(\d+)(?:[^\]]*)\]/;for(let K of U){if(!K.versionName)continue;let z=K.versionName.match(Q);if(z&&z[1]){let G=parseInt(z[1],10);if(!isNaN(G)&&G>I)I=G}}if(I>0)return I+1;if(!U.some((K)=>K.versionName&&/\[Prod v\d+/.test(K.versionName))){let K=U.filter((z)=>z.versionName&&z.versionName.includes(`Sync from ${$}`)).length;if(K>0)return K+1}return 1}function lh0($,Y,U,I){let Q=Y!==void 0?`Prod v${Y}`:"Prod draft",J=I!==void 0?` -> Test v${I}`:"";return`Sync from ${$} [${Q} · #${U}${J}]`}var yo=()=>{};import{randomBytes as ik1}from"node:crypto";async function QE($,Y,U={}){let I=await A1($),Q=await A1(Y),[J,K,z,G,H,W,X,Z]=await Promise.all([n1(I,$.seal.endpoints.approvalStylePreferences),n1(Q,Y.seal.endpoints.approvalStylePreferences),q6(I),q6(Q),S8(I),S8(Q),oh0(I),oh0(Q)]),q=(X.articles||[]).filter((R)=>!R.isDeleted),V=(Z.articles||[]).filter((R)=>!R.isDeleted),w=new Map(V.map((R)=>[R.title.trim(),R])),M=[],F=[],N=new Set(q.map((R)=>R.title.trim()));for(let R of q){let o=R.title.trim(),e=w.get(o);if(!e){M.push(R);continue}let O0=[["co Line truncated
Run 'seal-use corps bind-test ${Q.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`);let J=M1(Q.testCorpId);if(J.environment!=="test")throw Error(`Target enterprise '${J.name}' (${J.id}) is marked as '${J.environment}', NOT 'test'. Aborting sync to protect non-test environments.`);let K=h(U.options["version-name"])??h(U.options.versionName),z=G0(U.options["dry-run"])===!0||G0(U.options.dryRun)===!0,G=G0(U.options.yes)===!0||G0(U.options.confirm)===!0;if(z)return j0(await QE(Q,J,{versionName:K,dryRun:!0})),!0;if(!G){let H=await QE(Q,J,{versionName:K,execute:!1});throw u8(`Refusing to overwrite test enterprise '${J.name}' (${J.id}) with preferences, ${H.rulesPlan.sourceDraftRuleCount} draft rules, and ${H.documentsPlan.sourceDocumentCount} knowledge documents from production enterprise '${Q.name}' (${Q.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 ${Q.id} --yes`)}return j0(await QE(Q,J,{versionName:K,execute:!0})),!0}if($==="replay-test"){let I=Y??h(U.options.corp)??h(U.options.prodCorp)??h(U.options["prod-corp"]),Q=M1(I),J=G0(U.options.force)===!0,K=G0(U.options.dryRun)??G0(U.options["dry-run"]),z=G0(U.options.yes)===!0||G0(U.options.confirm)===!0,G;if(!Q.testCorpId){if(!J)throw P4(`Production enterprise '${Q.name}' (${Q.id}) has no bound test enterprise.
`+"\uD83D\uDC49 检索指定企业请使用: seal-use corps search <keyword>")}return j0(F.map((N)=>({id:N.id,name:N.name,environment:N.environment??"production",sourceType:N.source.type,provider:N.source.provider??N.source.type,staffId:N.source.staffId,testCorpId:N.testCorpId,prodCorpId:N.prodCorpId,current:N.id===H}))),!0}if($==="get"||$==="show"){let I=Y??R(U.options.corp);if(!I)throw T4("Usage: seal-use corps get <corpId>");let Q=M1(I),J=gd(Q.id),K=AS0(Q);return j0({id:Q.id,name:Q.name,environment:Q.environment??"production",configFile:J,seal:{url:K,tenantSlug:Q.seal.tenantSlug??Q.source.tenantSlug,customHeaderNames:Q.seal.headers?Object.keys(Q.seal.headers):[],customCookieNames:Q.seal.cookies?Object.keys(Q.seal.cookies):[],endpoints:Q.seal.endpoints},source:PS0(Q.source),relations:{testCorpId:Q.testCorpId,prodCorpId:Q.prodCorpId},auth:{refreshTtl:Q.auth.refreshTtl}}),!0}if($==="current"){let I=M1(R(U.options.corp));return j0({id:I.id,name:I.name,environment:I.environment??"production",sourceType:I.source.type,provider:I.source.provider??I.source.type,staffId:I.source.staffId,testCorpId:I.testCorpId,prodCorpId:I.prodCorpId}),!0}if($==="mark"||$==="mark-test"||$==="mark-prod"){let I=Y??R(U.options.corp);if(!I)throw T4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");let Q=M1(I),J=$==="mark-test"?"test":$==="mark-prod"?"production":R(U.options.env)??R(U.options.environment);if(J!=="production"&&J!=="test")throw T4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");if(!(z0(U.options.confirm)===!0||z0(U.options.yes)===!0))throw p6(`Refusing to change environment tag of enterprise '${Q.name}' (${Q.id}) to '${J}' without --confirm. Marking alters synchronization safety guards.`,`seal-use corps mark ${Q.id} --env ${J} --confirm`);let z=S9(Q.id,{environment:J});return j0({id:z.id,name:z.name,environment:z.environment,testCorpId:z.testCorpId,prodCorpId:z.prodCorpId}),!0}if($==="rename"){let I=Y??R(U.options.corp)??R(U.options.id),Q=R(U.options.name)??R(U.options.to)??(U.command[3]&&!U.command[3].startsWith("-")?U.command[3]:void 0);if(!I||!Q)throw Error("Usage: seal-use corps rename <corpId> --name <newName>");let J=M1(I),K=S9(J.id,{name:Q});return j0({success:!0,id:K.id,name:K.name,previousName:J.name}),!0}if($==="switch"){let I=Y;if(!I)throw Error("Usage: seal-use corps switch <corpId>");let Q=P4();if(!Q.stateful)throw Error("Cannot switch the default enterprise while stateless mode is enabled. Use `seal-use config mode stateful` first.");let J=M1(I);return NI({...Q,stateful:!0,defaultCorpId:J.id}),j0({current:!0,id:J.id,name:J.name}),!0}return!1}var dh0=m(()=>{r$();ch0();ZP();N4();n8();V4();e1();tT()});import{existsSync as ik1,mkdirSync as ck1,readFileSync as nk1,writeFileSync as ph0}from"node:fs";import{homedir as dk1}from"node:os";import{join as zE}from"node:path";function mh0(){let $=process.env.SEAL_USE_MAPPINGS_DIR?.trim();if($)return $;return zE(dk1(),".config","seal-use","mappings")}function lh0($){let Y=mh0();ck1(Y,{recursive:!0,mode:448});let U=zE(Y,`${$.target.id}-v${$.target.publishedVersionNumber}.json`),I=zE(Y,`${$.target.id}-latest.json`),Q=JSON.stringify($,null,2);return ph0(U,Q,{encoding:"utf-8",mode:384}),ph0(I,Q,{encoding:"utf-8",mode:384}),U}function oh0($,Y){let U=mh0(),I;if(!Y||Y==="latest")I=`${$}-latest.json`;else{let J=String(Y).replace(/^v/i,"");I=`${$}-v${J}.json`}let Q=zE(U,I);if(!ik1(Q))return null;try{let J=nk1(Q,"utf-8");return JSON.parse(J)}catch{return null}}function bo($){return $.replace(/^0+(?=\d)/,"")}function rh0($,Y){if(!Y)return $;let U=bo(Y.trim().toLowerCase().replace(/^#/,""));return $.filter((I)=>{let Q=String(I.sourceRuleCode).toLowerCase().replace(/^#/,""),J=String(I.targetRuleCode).toLowerCase().replace(/^#/,""),K=bo(J.replace(/^rule-/,"")),z=bo(Q.replace(/^rule-/,""));return Q===U||J===U||z===U||K===U||I.sourceRuleId.toLowerCase()===U||I.targetRuleId.toLowerCase()===U})}function sh0($,Y,U){let I=0,Q=Y!==void 0?new RegExp(`\\[Prod v${Y}\\s*·\\s*#(\\d+)(?:[^\\]]*)\\]`):/\[Prod draft\s*·\s*#(\d+)(?:[^\]]*)\]/;for(let K of U){if(!K.versionName)continue;let z=K.versionName.match(Q);if(z&&z[1]){let G=parseInt(z[1],10);if(!isNaN(G)&&G>I)I=G}}if(I>0)return I+1;if(!U.some((K)=>K.versionName&&/\[Prod v\d+/.test(K.versionName))){let K=U.filter((z)=>z.versionName&&z.versionName.includes(`Sync from ${$}`)).length;if(K>0)return K+1}return 1}function ah0($,Y,U,I){let Q=Y!==void 0?`Prod v${Y}`:"Prod draft",J=I!==void 0?` -> Test v${I}`:"";return`Sync from ${$} [${Q} · #${U}${J}]`}var io=()=>{};import{randomBytes as pk1}from"node:crypto";async function GE($,Y,U={}){let I=await A1($),Q=await A1(Y),[J,K,z,G,H,W,X,Z]=await Promise.all([n1(I,$.seal.endpoints.approvalStylePreferences),n1(Q,Y.seal.endpoints.approvalStylePreferences),U6(I),U6(Q),h8(I),h8(Q),th0(I),th0(Q)]),q=(X.articles||[]).filter((h)=>!h.isDeleted),V=(Z.articles||[]).filter((h)=>!h.isDeleted),w=new Map(V.map((h)=>[h.title.trim(),h])),M=[],F=[],N=new Set(q.map((h)=> Line truncated
Run 'seal-use corps bind-test ${Q.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`);let J=M1(Q.testCorpId);if(J.environment!=="test")throw Error(`Target enterprise '${J.name}' (${J.id}) is marked as '${J.environment}', NOT 'test'. Aborting sync to protect non-test environments.`);let K=R(U.options["version-name"])??R(U.options.versionName),z=z0(U.options["dry-run"])===!0||z0(U.options.dryRun)===!0,G=z0(U.options.yes)===!0||z0(U.options.confirm)===!0;if(z)return j0(await GE(Q,J,{versionName:K,dryRun:!0})),!0;if(!G){let H=await GE(Q,J,{versionName:K,execute:!1});throw p6(`Refusing to overwrite test enterprise '${J.name}' (${J.id}) with preferences, ${H.rulesPlan.sourceDraftRuleCount} draft rules, and ${H.documentsPlan.sourceDocumentCount} knowledge documents from production enterprise '${Q.name}' (${Q.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 ${Q.id} --yes`)}return j0(await GE(Q,J,{versionName:K,execute:!0})),!0}if($==="replay-test"){let I=Y??R(U.options.corp)??R(U.options.prodCorp)??R(U.options["prod-corp"]),Q=M1(I),J=z0(U.options.force)===!0,K=z0(U.options.dryRun)??z0(U.options["dry-run"]),z=z0(U.options.yes)===!0||z0(U.options.confirm)===!0,G;if(!Q.testCorpId){if(!J)throw T4(`Production enterprise '${Q.name}' (${Q.id}) has no bound test enterprise.
Run 'seal-use corps bind-test ${Q.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association,
or add '--force' (or use 'seal-use webhook replay <recordId> --force') if you explicitly intend to replay directly within production.`);G=Q}else if(G=M1(Q.testCorpId),G.environment!=="test"&&!J)throw Error(`Target enterprise '${G.name}' (${G.id}) is marked as '${G.environment}', NOT 'test'. Aborting replay to protect non-test environments (use --force to override).`);if(!K&&!z)throw u8("Refusing to replay approval records without --confirm. Use --dry-run to preview the payload without sending it.",`seal-use corps replay-test ${I??"<prodCorpId>"} --confirm`);let H=h(U.options.recordId)??h(U.options["record-id"])??h(U.options.id),W=h(U.options.recordIds)??h(U.options["record-ids"]),X=W?W.split(",").map((D)=>D.trim()).filter(Boolean):void 0,Z=h(U.options.sn)??h(U.options.documentSn)??h(U.options["document-sn"]),q=h(U.options.sns)??h(U.options["document-sns"]),V=q?q.split(",").map((D)=>D.trim()).filter(Boolean):void 0,w=s0(U.options.limit)??(!H&&!X&&!Z&&!V?1:void 0),M={recordId:H,recordIds:X,sn:Z,sns:V,limit:w,status:h(U.options.status),startDate:h(U.options.startDate)??h(U.options["start-date"]),endDate:h(U.options.endDate)??h(U.options["end-date"])},F=await A1(Q),N=Q.id===G.id?F:await A1(G);console.error(`[corps-replay-test] 正式企业「${Q.name}」(${Q.id}) -> 测试企业「${G.name}」(${G.id})`);let O=await Hz({query:M,sourceClient:F,targetClient:N,sourceCorp:Q,targetCorp:G,webhookSelector:h(U.options.webhook)??h(U.options.selector),snPrefix:h(U.options.snPrefix)??h(U.options["sn-prefix"]),snSuffix:h(U.options.snSuffix)??h(U.options["sn-suffix"]),docIdPrefix:h(U.options.docIdPrefix)??h(U.options["doc-id-prefix"]),docIdSuffix:h(U.options.docIdSuffix)??h(U.options["doc-id-suffix"]),dryRun:K});if(K)return console.error(`[corps-replay-test] 预览模式:已成功从 ${Q.name} 提取单据并转换为 Webhook Payload(未实际推送)。`),j0(O),!0;if(O.success)console.error(`\uD83D\uDFE2 成功重放 ${O.successCount} 条单据(来自「${Q.name}」)至「${G.name}」(${O.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDD34 单据重放部分或全部失败(成功 ${O.successCount} 条,失败 ${O.failureCount} 条)至「${G.name}」`);if(console.error(`\uD83D\uDC49 Next action: seal-use approval-runs list --corp ${G.id} --limit ${O.totalCount}`),j0(O),!O.success)throw new z4(`Approval record replay failed: ${O.failureCount} record(s) failed.`,1);return!0}return!1}var sh0=m(()=>{f6();ko();aZ();O4();K$();q4();o1();ko()});async function ah0($,Y,U){if(await uh0($,Y,U))return;if(await $S0($,Y,U))return;if(await rh0($,Y,U))return;if(await DS0($,Y,U))return;throw Error(`Unknown corps command: ${$??""}. Run 'seal-use help' for available commands.`)}var xo=m(()=>{YS0();BS0();bh0();sh0();oT()});var $g0={};Z8($g0,{handleAuthExtractKeysCommand:()=>bo,handleAuthCommand:()=>zE,formatBeijingIso:()=>uo});async function bo($,Y){let U=$??h(Y.options.link)??h(Y.options.url);if(!U)throw Error("Usage: seal-use auth hose-extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let I=G0(Y.options.reveal)===!0||G0(Y.options.r)===!0||G0(Y.options.plain)===!0,Q=G0(Y.options.save)===!0||G0(Y.options.add)===!0;await fq(U,{reveal:I,save:Q,name:h(Y.options.name),overwrite:G0(Y.options.overwrite)===!0,force:G0(Y.options.force)===!0,appKey:h(Y.options["app-key"])??h(Y.options.appKey),keyId:h(Y.options["key-id"])??h(Y.options.keyId)})}async function zE($,Y,U){let I=U.command[2]?.toLowerCase(),Q=h(U.options["from-link"])??(I==="from-link"?U.command[3]:void 0);if(($==="seal-link"||$==="link"||$==="hose-link"&&Y?.source?.type==="seal")&&Q){let J=h(U.options.note),K=await MM(Q),z=T6(K.sealUrl,K.token),G=await o6(z);OM(K.corpId,G.tenant);let H=await $J(z,{note:J});j0({tenant:{id:G.tenant.id,name:G.tenant.name,tenantSlug:G.tenant.tenantSlug,corpId:K.corpId},user:{id:G.user.id,name:G.user.name,providerUserId:G.user.providerUserId,isAdmin:G.user.isAdmin},delegation:H,expiresIn:K.expiresIn});return}if(!Y)throw Error(`auth ${$??""} requires an enterprise. Provide --corp <id> or select one.`);if($==="check"||$==="diagnose"||$==="status"||$==="test"||$==="doctor"){j0(await dk1(Y));return}if($==="seal-link"||$==="link"||$==="hose-link"&&Y.source?.type==="seal"){let J=await A1(Y);if(I==="list"){await x0("seal_delegation_list",J,Y,{},T0(U.options));return}if(I==="revoke"){let X=U.command[3]??h(U.options.tokenId)??h(U.options.id);if(!X)throw Error("Usage: seal-use auth link revoke <tokenId>");await x0("seal_delegation_revoke",J,Y,{tokenId:X},T0(U.options));return}let K=h(U.options.note)??"CLI generated provisional access link",z=await T$("seal_delegation_create",J,Y,{note:K});if($==="hose-link")console.error(`\uD83D\uDC49 提示: 企业「${Y.name}」源类型为 Seal 原生测试环境,已自动为您生成委托免登直达链接。`);let G=z,H="staffName"in Y.source&&typeof Y.source.staffName==="string"?Y.source.staffName:void 0,W=uo(Date.now()+86400000);j0({id Line truncated
or add '--force' (or use 'seal-use webhook replay <recordId> --force') if you explicitly intend to replay directly within production.`);G=Q}else if(G=M1(Q.testCorpId),G.environment!=="test"&&!J)throw Error(`Target enterprise '${G.name}' (${G.id}) is marked as '${G.environment}', NOT 'test'. Aborting replay to protect non-test environments (use --force to override).`);if(!K&&!z)throw p6("Refusing to replay approval records without --confirm. Use --dry-run to preview the payload without sending it.",`seal-use corps replay-test ${I??"<prodCorpId>"} --confirm`);let H=R(U.options.recordId)??R(U.options["record-id"])??R(U.options.id),W=R(U.options.recordIds)??R(U.options["record-ids"]),X=W?W.split(",").map((D)=>D.trim()).filter(Boolean):void 0,Z=R(U.options.sn)??R(U.options.documentSn)??R(U.options["document-sn"]),q=R(U.options.sns)??R(U.options["document-sns"]),V=q?q.split(",").map((D)=>D.trim()).filter(Boolean):void 0,w=l0(U.options.limit)??(!H&&!X&&!Z&&!V?1:void 0),M={recordId:H,recordIds:X,sn:Z,sns:V,limit:w,status:R(U.options.status),startDate:R(U.options.startDate)??R(U.options["start-date"]),endDate:R(U.options.endDate)??R(U.options["end-date"])},F=await A1(Q),N=Q.id===G.id?F:await A1(G);console.error(`[corps-replay-test] 正式企业「${Q.name}」(${Q.id}) -> 测试企业「${G.name}」(${G.id})`);let O=await qz({query:M,sourceClient:F,targetClient:N,sourceCorp:Q,targetCorp:G,webhookSelector:R(U.options.webhook)??R(U.options.selector),snPrefix:R(U.options.snPrefix)??R(U.options["sn-prefix"]),snSuffix:R(U.options.snSuffix)??R(U.options["sn-suffix"]),docIdPrefix:R(U.options.docIdPrefix)??R(U.options["doc-id-prefix"]),docIdSuffix:R(U.options.docIdSuffix)??R(U.options["doc-id-suffix"]),dryRun:K});if(K)return console.error(`[corps-replay-test] 预览模式:已成功从 ${Q.name} 提取单据并转换为 Webhook Payload(未实际推送)。`),j0(O),!0;if(O.success)console.error(`\uD83D\uDFE2 成功重放 ${O.successCount} 条单据(来自「${Q.name}」)至「${G.name}」(${O.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDD34 单据重放部分或全部失败(成功 ${O.successCount} 条,失败 ${O.failureCount} 条)至「${G.name}」`);if(console.error(`\uD83D\uDC49 Next action: seal-use approval-runs list --corp ${G.id} --limit ${O.totalCount}`),j0(O),!O.success)throw new z4(`Approval record replay failed: ${O.failureCount} record(s) failed.`,1);return!0}return!1}var $g0=m(()=>{b6();co();Uq();N4();n8();V4();e1();co()});async function Yg0($,Y,U){if(await nh0($,Y,U))return;if(await QS0($,Y,U))return;if(await eh0($,Y,U))return;if(await TS0($,Y,U))return;throw Error(`Unknown corps command: ${$??""}. Run 'seal-use help' for available commands.`)}var no=m(()=>{JS0();ES0();dh0();$g0();tT()});var Qg0={};V8(Qg0,{handleAuthExtractKeysCommand:()=>lo,handleAuthCommand:()=>XE,formatBeijingIso:()=>mo});async function lo($,Y){let U=$??R(Y.options.link)??R(Y.options.url);if(!U)throw Error("Usage: seal-use auth hose-extract-keys <https://.../web/thirdparty.html?...> [--reveal] [--save] [--name <customName>] [--overwrite]");let I=z0(Y.options.reveal)===!0||z0(Y.options.r)===!0||z0(Y.options.plain)===!0,Q=z0(Y.options.save)===!0||z0(Y.options.add)===!0;await iq(U,{reveal:I,save:Q,name:R(Y.options.name),overwrite:z0(Y.options.overwrite)===!0,force:z0(Y.options.force)===!0,appKey:R(Y.options["app-key"])??R(Y.options.appKey),keyId:R(Y.options["key-id"])??R(Y.options.keyId)})}async function XE($,Y,U){let I=U.command[2]?.toLowerCase(),Q=R(U.options["from-link"])??(I==="from-link"?U.command[3]:void 0);if(($==="seal-link"||$==="link"||$==="hose-link"&&Y?.source?.type==="seal")&&Q){let J=R(U.options.note),K=await DM(Q),z=j6(K.sealUrl,K.token),G=await s6(z);BM(K.corpId,G.tenant);let H=await QJ(z,{note:J});j0({tenant:{id:G.tenant.id,name:G.tenant.name,tenantSlug:G.tenant.tenantSlug,corpId:K.corpId},user:{id:G.user.id,name:G.user.name,providerUserId:G.user.providerUserId,isAdmin:G.user.isAdmin},delegation:H,expiresIn:K.expiresIn});return}if(!Y)throw Error(`auth ${$??""} requires an enterprise. Provide --corp <id> or select one.`);if($==="check"||$==="diagnose"||$==="status"||$==="test"||$==="doctor"){j0(await ok1(Y));return}if($==="seal-link"||$==="link"||$==="hose-link"&&Y.source?.type==="seal"){let J=await A1(Y);if(I==="list"){await R0("seal_delegation_list",J,Y,{},T0(U.options));return}if(I==="revoke"){let X=U.command[3]??R(U.options.tokenId)??R(U.options.id);if(!X)throw Error("Usage: seal-use auth link revoke <tokenId>");await R0("seal_delegation_revoke",J,Y,{tokenId:X},T0(U.options));return}let K=R(U.options.note)??"CLI generated provisional access link",z=await E$("seal_delegation_create",J,Y,{note:K});if($==="hose-link")console.error(`\uD83D\uDC49 提示: 企业「${Y.name}」源类型为 Seal 原生测试环境,已自动为您生成委托免登直达链接。`);let G=z,H="staffName"in Y.source&&typeof Y.source.staffName==="string"?Y.source.staffName:void 0,W=mo(Date.now()+86400000);j0({id Line truncated
`+`支持的审批系统与发布目标:
`+` • hosecloud (合思费控): seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>
@@ -947,18 +948,18 @@ or add '--force' (or use 'seal-use webhook replay <recordId> --force') if you ex
`+` • 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 H=$==="maycur"?"每刻报销":"汇联易";throw Error(`${H}发布:目前可通过 Webhook 模式接入。命令:seal-use webhook add --name '${H}' --result-url <url> --corp <corpId>`)}let K=$==="hosecloud",z=$==="hosecloud"?Y:$,G=$==="hosecloud"?U:Y;if(!K)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(z==="requirements"){await x0("seal_deploy_hosecloud_requirements",I,Q,{},T0(J.options));return}if(z==="list"){await x0("seal_deploy_hosecloud_list",I,Q,{},T0(J.options));return}if(z==="get"){let H=G??h(J.options.signKey)??h(J.options["sign-key"]);if(!H){let X=((await n1(I)).integrations??[]).filter((Z)=>Z.type==="hosecloud");if(X.length===0)throw Error(`当前企业 (${Q.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 H=$==="maycur"?"每刻报销":"汇联易";throw Error(`${H}发布:目前可通过 Webhook 模式接入。命令:seal-use webhook add --name '${H}' --result-url <url> --corp <corpId>`)}let K=$==="hosecloud",z=$==="hosecloud"?Y:$,G=$==="hosecloud"?U:Y;if(!K)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(z==="requirements"){await R0("seal_deploy_hosecloud_requirements",I,Q,{},T0(J.options));return}if(z==="list"){await R0("seal_deploy_hosecloud_list",I,Q,{},T0(J.options));return}if(z==="get"){let H=G??R(J.options.signKey)??R(J.options["sign-key"]);if(!H){let X=((await n1(I)).integrations??[]).filter((Z)=>Z.type==="hosecloud");if(X.length===0)throw Error(`当前企业 (${Q.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${Q.id}`);console.error(`Usage: seal-use deploy hosecloud get <sign-key> [--corp ${Q.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let Z of X){let q=Z.outboundName??"SealAI 审批",V=Z.signKey,w=Z.apiOrigin??"production";console.error(` • "${q}" (signKey: ${V}, 环境: ${w})`),console.error(` \uD83D\uDC49 查看命令: seal-use deploy hosecloud get ${V} --corp ${Q.id}
`)}throw new z4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。",2,X.length===1?`seal-use deploy hosecloud get ${X[0].signKey} --corp ${Q.id}`:void 0)}await x0("seal_deploy_hosecloud_get",I,Q,{signKey:H},T0(J.options));return}if(z==="status"){await x0("seal_deploy_hosecloud_status",I,Q,{},T0(J.options));return}if(z==="configure"){let H=h(J.options.input),W=H?JSON.parse(ok1(H,"utf8")):E8(J.json);if(!W||Object.keys(W).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await x0("seal_deploy_hosecloud_configure",I,Q,{...W,dryRun:G0(J.options.dryRun)??G0(J.options["dry-run"])},T0(J.options));return}if(z==="sync"){let H=G??h(J.options.signKey)??h(J.options["sign-key"]),W=G0(J.options.auto)??G0(J.options.yes);if(!H){let Z=((await n1(I)).integrations??[]).filter((V)=>V.type==="hosecloud");if(Z.length===0)throw Error(`当前企业 (${Q.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${Q.id}`);let q=Z[0];if(q&&Z.length===1&&W){let V=q.signKey;console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${V})`),await x0("seal_deploy_hosecloud_sync",I,Q,{signKey:V},T0(J.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${Q.id}]
`)}throw new z4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。",2,X.length===1?`seal-use deploy hosecloud get ${X[0].signKey} --corp ${Q.id}`:void 0)}await R0("seal_deploy_hosecloud_get",I,Q,{signKey:H},T0(J.options));return}if(z==="status"){await R0("seal_deploy_hosecloud_status",I,Q,{},T0(J.options));return}if(z==="configure"){let H=R(J.options.input),W=H?JSON.parse(tk1(H,"utf8")):L6(J.json);if(!W||Object.keys(W).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await R0("seal_deploy_hosecloud_configure",I,Q,{...W,dryRun:z0(J.options.dryRun)??z0(J.options["dry-run"])},T0(J.options));return}if(z==="sync"){let H=G??R(J.options.signKey)??R(J.options["sign-key"]),W=z0(J.options.auto)??z0(J.options.yes);if(!H){let Z=((await n1(I)).integrations??[]).filter((V)=>V.type==="hosecloud");if(Z.length===0)throw Error(`当前企业 (${Q.name}) 尚未添加合思发布配置。
`+`\uD83D\uDC49 请先运行配置命令:seal-use deploy hosecloud configure --json '{...}' --corp ${Q.id}`);let q=Z[0];if(q&&Z.length===1&&W){let V=q.signKey;console.error(`ℹ️ [auto] 检测到企业仅有 1 个合思配置,已自动选择 (signKey: ${V})`),await R0("seal_deploy_hosecloud_sync",I,Q,{signKey:V},T0(J.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${Q.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of Z){let w=V.outboundName??"SealAI 审批",M=V.signKey,F=V.apiOrigin??"production";console.error(` • "${w}" (signKey: ${M}, 环境: ${F})`),console.error(` \uD83D\uDC49 同步命令: seal-use deploy hosecloud sync ${M} --corp ${Q.id}
`)}if(Z.length===1)console.error(`\uD83D\uDCA1 提示:若希望单配置自动同步,可附加 --auto 参数:seal-use deploy hosecloud sync --auto --corp ${Q.id}
`);throw new z4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,Z.length===1?`seal-use deploy hosecloud sync ${Z[0].signKey} --corp ${Q.id}`:void 0)}await x0("seal_deploy_hosecloud_sync",I,Q,{signKey:H},T0(J.options));return}throw Error(`Unknown deploy hosecloud action: ${z??""}. Available: requirements, list, get, status, configure, sync.`)}var Zg0=m(()=>{O4();q4();o1();W4();K$()});var Vg0='---\nname: seal-use\ndescription: "v0.10.38: Use for Seal Use enterprise onboarding, Hose/合思 or Seal-native authentication, approval operations, diagnosis, simulation, rules, users, configuration, and search."\nmetadata:\n version: 0.10.38\n short-description: Seal tenant and Hose approval automation (v0.10.38)\n---\n\n# Seal Use\n\nCLI 是主执行通道。机器通道 `stdout` 必须是纯 JSON;诊断日志、进度和下一步建议写入 `stderr`。MCP 默认关闭。\n\n## 时间与输出\n\n- 机器字段保留 ISO 8601 UTC,精确到秒,不要添加毫秒,例如 `2026-09-22T04:56:06Z`。\n- 面向用户解释时间时,换算为 `Asia/Shanghai`,明确标注“北京时间”;审计或消歧时同时保留原始 UTC。\n- 不向用户暴露 Bearer、`accessToken`、`closeToken`、`appSecurity`、原始 cURL 或未脱敏手机号。\n- 不向用户直接暴露底层 UUID、`tenantSlug`、`boundCorpRole` 等内部字段;优先使用企业名称、规则编号 `#xxxx` 和脱敏后的业务信息。\n\n## 企业接入:先识别材料,再选择入口\n\n最终企业来源只有两种:`source.type: "seal"` 和 `source.type: "hose"`。不要把材料格式、认证凭据和最终来源混为一谈。\n\n| 用户材料 | 标准入口 | 最终配置形态 |\n| --- | --- | --- |\n| Hose 开放平台 `appKey + appSecurity` | `corps add-hose-persistent` | Hose 持久化凭据 |\n| Seal URL + Bearer,或 Seal 页面 cURL | `corps add-seal-bearer` | Seal Bearer 会话 |\n| Seal 原生委托链接 | `corps add-link <url>` | Seal 委托会话 |\n| Hose 协助链接 | `corps add-link <url>` | Hose Web Session;加 `--elevate-hose` 才提取长期密钥 |\n| Hose 页面 cURL | 先提取密钥;失败时 `corps add-hose-web-session` | Hose 持久化或 Hose Web Session |\n| 已规范化的 Hose `corpId + accessToken + baseUrl` | `corps add-hose-web-session` | Hose Web Session |\n\n### 凭据边界\n\n- Seal Bearer 只能给 `add-seal-bearer`;Hose `accessToken/accesstoken/closeToken` 不能直接当作 Seal Bearer。\n- Hose Web Session 保存 `closeToken + staffId`,需要调用 Seal 时才通过 SSO 换取运行时 Seal Bearer。\n- Hose 持久化配置保存 `appKey + appSecurity`,适合无人值守、部署和长期同步。\n- 会话有有效期时,Hose source 保存 `expiresIn` 和 UTC 秒级 `expiresAt`。\n- `add-link` 是 URL 混合入口,不接收 cURL:自动识别 Seal 委托链接和 Hose 协助链接。\n- `--elevate-hose` 是唯一明确的 Hose 提权动作。\n\n收到 Hose 管理员 cURL 时,按 Hose 协助链接处理:解析主机、`accesstoken`、企业标识和必要会话信息,优先调用密钥提取路径;无法提取长期密钥时才保存 Web Session。收到 Seal cURL 时,提取 Seal 主机和 `Authorization: Bearer`,走 `add-seal-bearer`。不要盲目执行 cURL,也不要把原文写入文件或日志。\n\n详细来源决策、提权边界和 cURL 处理见 `references/enterprise-onboarding.md`;首次找材料时必须使用 `references/first-time-user.md`。\n\n## 首次接入图文规则\n\n当用户首次接入、询问如何取得材料,或需要用户打开后台找凭据时:\n\n1. 先确认用户手上是 Hose 开放平台凭据、协助链接、Seal 委托链接,还是已登录网页 cURL。\n2. 读取 `references/first-time-user.md`,只渲染与当前路径对应的截图;不能只给纯文字步骤。\n3. 接收材料后由 Agent 自动发现企业、域名和管理员。除非自动发现失败,不要要求用户先填写 `corpId`、`staffId` 或域名。\n\n## `corps` 主线\n\n- 接入:`add-link`、`add-seal-bearer`、`add-hose-persistent`、`add-hose-web-session`\n- 发现:`list`、`search`/`find`、`get`/`show`、`current`、`switch`\n- 维护:`mark`、`rename`\n- 测试闭环:`bind-test`、`unbind-test`、`sync-test`、`replay-test`\n- Hose 专属:`probe-hose`、`hose-staffs`、`hose-extract-keys`、`hose-keys`\n\nHose 专属命令应从命令名或选项中明确可见:`auth hose-*`、`approval-runs hose-flow`、`deploy hosecloud`、`simulation --mode hosecloud`。跨来源入口只有在明确使用 `--elevate-hose`、`--with-flow` 或 `--type hose-document` 时才启用对应 Hose 能力。\n\n生产规则变更遵循:生产改草稿 → 同步测试 → 模拟/回归验证 → 用户确认 → 生产发布。`sync-test`、`replay-test`、规则发布和清空等高风险操作优先 `--dry-run`,正式执行必须显式 `--yes` 或 `--confirm`。\ Line truncated
`);throw new z4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,Z.length===1?`seal-use deploy hosecloud sync ${Z[0].signKey} --corp ${Q.id}`:void 0)}await R0("seal_deploy_hosecloud_sync",I,Q,{signKey:H},T0(J.options));return}throw Error(`Unknown deploy hosecloud action: ${z??""}. Available: requirements, list, get, status, configure, sync.`)}var Fg0=m(()=>{N4();V4();e1();W4();n8()});var Mg0='---\nname: seal-use\ndescription: "v0.10.39: Use for Seal Use enterprise onboarding, Hose/合思 or Seal-native authentication, approval operations, diagnosis, simulation, rules, users, configuration, and search."\nmetadata:\n version: 0.10.39\n short-description: Seal tenant and Hose approval automation (v0.10.39)\n---\n\n# Seal Use\n\nCLI 是主执行通道。机器通道 `stdout` 必须是纯 JSON;诊断日志、进度和下一步建议写入 `stderr`。MCP 默认关闭。\n\n## 时间与输出\n\n- 机器字段保留 ISO 8601 UTC,精确到秒,不要添加毫秒,例如 `2026-09-22T04:56:06Z`。\n- 面向用户解释时间时,换算为 `Asia/Shanghai`,明确标注“北京时间”;审计或消歧时同时保留原始 UTC。\n- 不向用户暴露 Bearer、`accessToken`、`closeToken`、`appSecurity`、原始 cURL 或未脱敏手机号。\n- 不向用户直接暴露底层 UUID、`tenantSlug`、`boundCorpRole` 等内部字段;优先使用企业名称、规则编号(例如 `0038`)和脱敏后的业务信息。\n\n## 企业接入:先识别材料,再选择入口\n\n最终企业来源只有两种:`source.type: "seal"` 和 `source.type: "hose"`。不要把材料格式、认证凭据和最终来源混为一谈。\n\n| 用户材料 | 标准入口 | 最终配置形态 |\n| --- | --- | --- |\n| Hose 开放平台 `appKey + appSecurity` | `corps add-hose-persistent` | Hose 持久化凭据 |\n| Seal URL + Bearer,或 Seal 页面 cURL | `corps add-seal-bearer` | Seal Bearer 会话 |\n| Seal 原生委托链接 | `corps add-link <url>` | Seal 委托会话 |\n| Hose 协助链接 | `corps add-link <url>` | Hose Web Session;加 `--elevate-hose` 才提取长期密钥 |\n| Hose 页面 cURL | 先提取密钥;失败时 `corps add-hose-web-session` | Hose 持久化或 Hose Web Session |\n| 已规范化的 Hose `corpId + accessToken + baseUrl` | `corps add-hose-web-session` | Hose Web Session |\n\n### 凭据边界\n\n- Seal Bearer 只能给 `add-seal-bearer`;Hose `accessToken/accesstoken/closeToken` 不能直接当作 Seal Bearer。\n- Hose Web Session 保存 `closeToken + staffId`,需要调用 Seal 时才通过 SSO 换取运行时 Seal Bearer。\n- Hose 持久化配置保存 `appKey + appSecurity`,适合无人值守、部署和长期同步。\n- 会话有有效期时,Hose source 保存 `expiresIn` 和 UTC 秒级 `expiresAt`。\n- `add-link` 是 URL 混合入口,不接收 cURL:自动识别 Seal 委托链接和 Hose 协助链接。\n- `--elevate-hose` 是唯一明确的 Hose 提权动作。\n\n收到 Hose 管理员 cURL 时,按 Hose 协助链接处理:解析主机、`accesstoken`、企业标识和必要会话信息,优先调用密钥提取路径;无法提取长期密钥时才保存 Web Session。收到 Seal cURL 时,提取 Seal 主机和 `Authorization: Bearer`,走 `add-seal-bearer`。不要盲目执行 cURL,也不要把原文写入文件或日志。\n\n详细来源决策、提权边界和 cURL 处理见 `references/enterprise-onboarding.md`;首次找材料时必须使用 `references/first-time-user.md`。\n\n## 首次接入图文规则\n\n当用户首次接入、询问如何取得材料,或需要用户打开后台找凭据时:\n\n1. 先确认用户手上是 Hose 开放平台凭据、协助链接、Seal 委托链接,还是已登录网页 cURL。\n2. 读取 `references/first-time-user.md`,只渲染与当前路径对应的截图;不能只给纯文字步骤。\n3. 接收材料后由 Agent 自动发现企业、域名和管理员。除非自动发现失败,不要要求用户先填写 `corpId`、`staffId` 或域名。\n\n## `corps` 主线\n\n- 接入:`add-link`、`add-seal-bearer`、`add-hose-persistent`、`add-hose-web-session`\n- 发现:`list`、`search`/`find`、`get`/`show`、`current`、`switch`\n- 维护:`mark`、`rename`\n- 测试闭环:`bind-test`、`unbind-test`、`sync-test`、`replay-test`\n- Hose 专属:`probe-hose`、`hose-staffs`、`hose-extract-keys`、`hose-keys`\n\nHose 专属命令应从命令名或选项中明确可见:`auth hose-*`、`approval-runs hose-flow`、`deploy hosecloud`、`simulation --mode hosecloud`。跨来源入口只有在明确使用 `--elevate-hose`、`--with-flow` 或 `--type hose-document` 时才启用对应 Hose 能力。\n\n生产规则变更遵循:生产改草稿 → 同步测试 → 模拟/回归验证 → 用户确认 → 生产发布。`sync-test`、`replay-test`、规则发布和清空等高风险操作优先 `--dry-run`,正式执行必须显式 `--yes` 或 `--coLine truncated
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 Lg0=()=>{};var Mg0=`# Approval Attachment Trace Investigation
`;var Og0=()=>{};var Bg0=`# Approval Attachment Trace Investigation
Use this workflow when a customer disputes an AI approval finding about an attachment, invoice, receipt, OCR result, or a UI-highlighted audit result.
@@ -1179,7 +1180,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 wg0=()=>{};var Ng0=`# Approval Bad Case Catalog
`;var Dg0=()=>{};var Pg0=`# 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.
@@ -1229,7 +1230,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 Og0=()=>{};var Bg0="# Approval Run Lightweight Queries\n\nUse this reference when the user gives a 合思/易快报单号, source document SN, record ID, simulation batch ID, or asks for an approval decision without needing the full raw run payload.\n\n## Locate A Run By Document Number\n\nPrefer `pick` before broad search + bridge + get.\n\n```bash\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --batch <batchId> --latest\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest --fields recordId,sourceDocumentSN,status,aiDecision,aiSummary\n```\n\nDefault output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.\n\nIf there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.\n\n## Read Compact Run Detail\n\nUse `--summary` for most diagnosis and support questions.\n\n```bash\nseal-use approval-runs get <recordId> --corp <corpId> --summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-use approval-runs get <recordId> --corp <corpId> --fields metadata\nseal-use approval-runs get <recordId> --corp <corpId> --fields document.fields,result.summary\nseal-use approval-runs get <recordId> --corp <corpId> --fields result.summary,result.decision,result.riskPoints\nseal-use approval-runs get <recordId> --corp <corpId> --fields document.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runs get <recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.\n\n## Understand The Case First\n\nBefore pulling the full document, use:\n\n```bash\nseal-use approval-runs document-summary <recordId> --corp <corpId>\n```\n\nThis is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.\n\n## Extract AI-Cited Rules\n\nUse this when the user asks \"AI 用了哪条规则\", \"为什么命中这条\", or needs the rule evidence for a specific run.\n\n```bash\nseal-use approval-runs cited-rules <recordId> --corp <corpId>\n```\n\nReturn and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule, use `rules get --record-id <recordId> --runtime-id rule-205` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\n# 查看附件列表摘要(包含文件名、类型、大小及直链可用性)\nseal-use approval-runs attachments <recordId> --corp <corpId> --summary\n\n# 下载全部附件到本地目录(优先使用 ossSignedUrl 签名直链)\nseal-use approval-runs attachments download <recordId> --all --out-dir ./downloads --corp <corpId>\n\n# 按名称或 fileId 过滤下载单个附件\nseal-use approval-runs attachments download <recordId> --name 发票 --corp <corpId>\n```\n\nThis should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.\n\n## Result Summary\n\nUse:\n\n```bash\nseal-use approval-runs result <recordId> --corp <corpId> --summary\n```\n\nThis is for decision, summary, risk point count, matched rule count, trace ID, and record ID.\n\n## Approval Run Web Links & Auto-Login Links\n\nUse this when the user asks for a link to an approval run or wants to open the run directly in their browser:\n\n```bash\n# 默认推荐:生成 Seal AI 审核详情直达链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-use approval-runs link <recordId> --corp <corpId>\nseal-use approval-runs link --sn <sourceDocumentSN> --corp <corpId>\n\n# 生成合思主系统原始单据页面链接\nseal-use approval-runs link <recordId> --type hose-document --corp <corpId>\n\n# 仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带合思单次临时票据的免登直达链接\nseal-use approval-runs link <recordId> --auto-login [--expire 7200] --corp <corpId>\n```\n\n### 返回字段说明与语义规范\n- `sealResultUrl`: Seal AI 单据智能审核结果页\n- `hoseDocumentUrl`: 合思费控主系统原始报销/借款单详情页\n- `type`: 链接类型,默认为 `seal_result`,指定时可为 `hose_document`\n- `mode`: 鉴权模式,`direct`(原生直接打开)或 `auto_login`(免密换票)\n\n### 免登链接安全与声明规范\n当向用户返回 `--auto-login` 链接时 Line truncated
`;var Ag0=()=>{};var Eg0="# Approval Run Lightweight Queries\n\nUse this reference when the user gives a 合思/易快报单号, source document SN, record ID, simulation batch ID, or asks for an approval decision without needing the full raw run payload.\n\n## Locate A Run By Document Number\n\nPrefer `pick` before broad search + bridge + get.\n\n```bash\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --batch <batchId> --latest\nseal-use approval-runs pick --corp <corpId> --sn <sourceDocumentSN> --latest --fields recordId,sourceDocumentSN,status,aiDecision,aiSummary\n```\n\nDefault output is intentionally small: `recordId`, `sourceDocumentSN`, `sourceDocumentId`, `simulationBatchId`, `status`, `taskMode`, `ruleSetVersionNumber`, `langfuseTraceId`, `manualResult`, `aiDecision`, and `aiSummary`.\n\nIf there are multiple candidates and `--latest` was not used, report the candidates and ask which one to inspect.\n\n## Read Compact Run Detail\n\nUse `--summary` for most diagnosis and support questions.\n\n```bash\nseal-use approval-runs get <recordId> --corp <corpId> --summary\n```\n\nUse `--fields` when the user needs a particular slice.\n\n```bash\nseal-use approval-runs get <recordId> --corp <corpId> --fields metadata\nseal-use approval-runs get <recordId> --corp <corpId> --fields document.fields,result.summary\nseal-use approval-runs get <recordId> --corp <corpId> --fields result.summary,result.decision,result.riskPoints\nseal-use approval-runs get <recordId> --corp <corpId> --fields document.keyFields,result,manualApprovalRecord,ruleSetVersionNumber\n```\n\nAvoid full `approval-runs get <recordId>` unless the user specifically needs raw document fields, pipeline logs, invoice rawData, or signed URLs. Prefer `--output-file` for full payloads.\n\n## Understand The Case First\n\nBefore pulling the full document, use:\n\n```bash\nseal-use approval-runs document-summary <recordId> --corp <corpId>\n```\n\nThis is for quick case reading: template/title, key fields, amount, expense type, cost company, payee, invoice summary, attachment names, AI result, and manual result.\n\n## Extract AI-Cited Rules\n\nUse this when the user asks \"AI 用了哪条规则\", \"为什么命中这条\", or needs the rule evidence for a specific run.\n\n```bash\nseal-use approval-runs cited-rules <recordId> --corp <corpId>\n```\n\nReturn and discuss `code`, `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.\n\nIf the user then wants the full text of one cited rule from that run's snapshot, use `seal-use rules get <code> --record-id <recordId> --corp <corpId>` from `rule-lightweight.md`.\n\n## Attachments Without Raw Payloads\n\nUse:\n\n```bash\n# 查看附件列表摘要(包含文件名、类型、大小及直链可用性)\nseal-use approval-runs attachments <recordId> --corp <corpId> --summary\n\n# 下载全部附件到本地目录(优先使用 ossSignedUrl 签名直链)\nseal-use approval-runs attachments download <recordId> --all --out-dir ./downloads --corp <corpId>\n\n# 按名称或 fileId 过滤下载单个附件\nseal-use approval-runs attachments download <recordId> --name 发票 --corp <corpId>\n```\n\nThis should be enough for file names, file IDs, mime types, positions, invoice/attachment grouping, and links when available. For customer disputes about OCR, receipt/invoice classification, or image content, switch to `approval-attachment-trace.md`.\n\n## Result Summary\n\nUse:\n\n```bash\nseal-use approval-runs result <recordId> --corp <corpId> --summary\n```\n\nThis is for decision, summary, risk point count, matched rule count, trace ID, and record ID.\n\n## Approval Run Web Links & Auto-Login Links\n\nUse this when the user asks for a link to an approval run or wants to open the run directly in their browser:\n\n```bash\n# 默认推荐:生成 Seal AI 审核详情直达链接(无凭证、无越权风险,用户在已有登录状态的浏览器中直接打开)\nseal-use approval-runs link <recordId> --corp <corpId>\nseal-use approval-runs link --sn <sourceDocumentSN> --corp <corpId>\n\n# 生成合思主系统原始单据页面链接\nseal-use approval-runs link <recordId> --type hose-document --corp <corpId>\n\n# 仅当用户明确要求免密/跨浏览器/无登录直达且确认知晓安全风险时:生成携带合思单次临时票据的免登直达链接\nseal-use approval-runs link <recordId> --auto-login [--expire 7200] --corp <corpId>\n```\n\n### 返回字段说明与语义规范\n- `sealResultUrl`: Seal AI 单据智能审核结果页\n- `hoseDocumentUrl`: 合思费控主系统原始报销/借款单详情页\n- `type`: 链接类型,默认为 `seal_result`,指定时可为 `hose_document`\n- `mode`: 鉴权模式,`direct`(原生直接打开)或 `auto_login`(免密换票)\n\n### 免登链接安全与声明规范\nLine truncated
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.
@@ -1352,7 +1353,7 @@ State the target enterprise, target rule code, changed fields, preserved fields,
1. **用户侧隐藏系统内部机器标识**:
- 严禁向用户直接输出系统内部持久化 UUID(如 \`01a00f34-...\`)或无意义哈希;
- 统一使用用户与管理后台唯一认知的业务编号:\`规则 code: #xxxx\`。
- 统一使用用户与管理后台唯一认知的业务编号:\`规则 code: 0016\`。
2. **严格采用系统原生业务术语(Vocabulary Contract)**:
- **适用场景**(对应系统字段 \`scope\`):严禁自创为“适用范围”或“适用模版”;若未修改,必须原样完整呈现其配置值,向用户证明未篡改触发条件;
- **遵守程度**(对应系统字段 \`strictness\`):严禁自创为“执行力度”或“严格度”;一律采用标准纯中文术语:
@@ -1375,7 +1376,7 @@ State the target enterprise, target rule code, changed fields, preserved fields,
---
#### 规则 code: #0016
#### 规则 code: 0016
- **适用场景**:单据模板=对公付款单
- **遵守程度**:必须遵守
@@ -1403,14 +1404,13 @@ Immediately before updating:
## 8. Update and verify the draft
Send only approved fields. For a description-only change:
Send only approved fields. For a description-only change (prefer \`--description-file\` when the rule text contains quotes or multiple lines):
\`\`\`bash
seal-use tool seal_approval_rule_update --corp <corpId> \\
--json '{"ruleId":"<ruleId>","description":"<confirmed description>"}'
seal-use rules update <code> --description-file /tmp/rule-desc.txt --corp <corpId>
\`\`\`
Do not send \`scope\` or \`strictness\` when they are unchanged. Fetch the draft again and verify the exact description, scope, strictness, and draft status before publishing.
Do not pass \`--scope\` or \`--strictness\` when they are unchanged. Fetch the draft again (\`seal-use rules get <code> --corp <corpId>\`) and verify the exact description, scope, strictness, and draft status before publishing.
For a complete local rule-set sync, \`rules push\` is incremental: it matches pulled rules by stable \`id\`, updates only changed fields, creates new entries, and removes entries omitted from the local file. It preserves matched rule IDs and does not recode the whole draft. Preview it with \`rules push --dry-run\` before applying.
@@ -1419,8 +1419,7 @@ For a complete local rule-set sync, \`rules push\` is incremental: it matches pu
Publish only when explicitly authorized:
\`\`\`bash
seal-use tool seal_approval_rule_version_publish --corp <corpId> \\
--json '{"versionName":"<specific business change>"}'
seal-use rules publish "<specific business change>" --corp <corpId>
\`\`\`
Verify after publishing:
@@ -1478,7 +1477,7 @@ Do not automatically rerun or resubmit the customer's production document. Run a
- **根因分类**:严格按 \`CAUSE_CLASSIFIED\` 5 大类输出(如 \`RULE_DEFINITION\`)
- **推理链路比对**:对照说明争议单据的误判逻辑与标杆单据的思考逻辑
3. **规则修改明细与完整前后文对比 (Rule Changes & Full Context)**:
- **规则 code**:标准格式如 \`#0016\`
- **规则 code**:标准格式如 \`0016\`
- **适用场景**:完整呈现修改前与修改后(如有改动需说明)
- **遵守程度**:必须遵守 / 建议遵守 / 提示参考
- **修改前完整描述 (Before)**:原样呈现修改前规则全貌
@@ -1497,7 +1496,7 @@ Do not automatically rerun or resubmit the customer's production document. Run a
- **系统调用凭证账号**:显式说明“周晚容(系统调用凭证账号,由智能助手代执行)”
- **全量规则总数**:核对总数是否变化
- **规则一致性校验**:确认目标规则文本与确认内容 100% 逐字吻合
`;var Tg0=()=>{};var Cg0=`# Enterprise Onboarding
`;var Rg0=()=>{};var Sg0=`# Enterprise Onboarding
本文是企业接入的唯一决策参考:先识别用户材料,再选择标准入口;不要把输入格式、凭据类型和最终来源混为一谈。
@@ -1656,7 +1655,7 @@ seal-use auth check --corp <discovered-id>
\`\`\`
向用户报告:企业中文名、身份来源、凭据模式和验证是否成功;不要回显秘密或无必要的内部 ID。临时会话过期时说明需要重新获取材料;需要无人值守访问时推荐 Hose 开放平台凭据。
`;var jg0=()=>{};var _g0=`# 第一次接入:看图找到材料
`;var vg0=()=>{};var gg0=`# 第一次接入:看图找到材料
> **【Agent 呈现铁律(Mandatory Image Rule)】**:
> 当向用户提供接入指引或引导用户获取材料时,**Agent 必须将本文档中对应的截图主动按顺序渲染到 Markdown 对话中**(使用图片语法 \`![说明](路径)\`),**绝不允许只讲纯文字步骤!** 真实业务用户必须对照图片界面才能准确找到按钮。
@@ -1743,7 +1742,7 @@ macOS 也可以使用 \`Option + Command + I\`;Windows 常见快捷键是 \`F1
## 安全提醒
协助平台、网页登录、SSO 和浏览器 cURL 都可能携带当前用户的访问权限。只把材料交给正在处理本机接入的可信助手,并在接入完成后关闭或刷新该网页会话。不要把原始 cURL、接入密码或完整截图发送到外部渠道。
`;var Rg0=()=>{};var Sg0=`# Hose Enterprise Auth
`;var hg0=()=>{};var kg0=`# Hose Enterprise Auth
Use this reference for Hose/合思 enterprise configuration and user-facing Hose authorization links.
@@ -1812,7 +1811,7 @@ Important:
3. BOTH a code block (\` \`\`\`text ... \`\`\` \`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
- **Dedicated CLI Command**: Use \`seal-use auth hose-link --corp <corpId> [--expire <seconds>] [--force]\`. This command directly generates an independent provisional auth link without reading or mutating internal CLI session cache. It supports \`--expire\` (default 7200, e.g. 86400 for 1 day).
- **Seal AI Platform Direct Link**: Use \`seal-use auth link --corp <corpId> [--note <note>]\`. This generates a 24-hour provisional delegation link for the Seal AI audit platform (\`https://*.sealai.cc\`).
`;var vg0=()=>{};var gg0=`# Seal AI 智能审核发布到合思费控 (HoseCloud Deployment)
`;var yg0=()=>{};var fg0=`# Seal AI 智能审核发布到合思费控 (HoseCloud Deployment)
Use this reference when configuring, deploying, or troubleshooting Seal AI smart approval integrations with Hose/合思费控 (界面路径:【智能审核】 $\\to$ 【发布】 $\\to$ 【合思费控】).
@@ -1910,7 +1909,7 @@ seal-use deploy hosecloud status --corp <corpId>
| \`signKey\` | string | 否 | 随机生成 | 集成配置卡片唯一标识,编辑时传入以更新对应配置 |
| \`apiOrigin\` | string | 否 | 自动探测 | \`production\` / \`custom\` |
| \`customApiUrl\` | string | 否 | - | 专属私有云 API 地址(当 \`apiOrigin=custom\` 时必填) |
`;var hg0=()=>{};var kg0=`# Hose Enterprise Initialization & Automated Discovery
`;var xg0=()=>{};var bg0=`# 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.
@@ -2016,118 +2015,7 @@ seal-use corps hose-staffs --json '{
}'
\`\`\`
* 直接使用指定 ID 完成接入并进行连通性验证。
`;var yg0=()=>{};var fg0=`# 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.
## Draft and Published Rule Codes
\`rules list\` and \`rules pull\` operate on the current draft and therefore return draft \`code\` values. A published version stores a separate snapshot and may recode the same rules; publishing, deleting, or reordering rules can make those published codes differ or drift again. A code such as \`#0038\` is only meaningful together with its version context.
Use the draft \`id\` for current edits and use the approval run's recorded version plus rule text or runtime rule ID for historical investigations. Do not copy a draft code into a report or command that will be interpreted against a published version.
## Count Rules
Use count when only scale or existence matters.
\`\`\`bash
seal-use rules count --corp <corpId>
\`\`\`
Expected shape:
\`\`\`json
{ "count": 191 }
\`\`\`
Tool-layer equivalent:
\`\`\`bash
seal-use tool seal_approval_rules_list --corp <corpId> --json '{"countOnly":true}'
seal-use tool seal_approval_rules_list --corp <corpId> --json '{"fields":["id"],"limit":0}'
\`\`\`
## List Rule Summaries
Use summaries for navigation and selection.
\`\`\`bash
seal-use rules list --corp <corpId> --summary
\`\`\`
Default summary should include only fields such as \`id\`, \`code\`, \`scope\`, \`strictness\`, \`status\`, and \`updatedAt\`. Do not pull \`description\` unless the user needs rule text.
Tool-layer equivalent:
\`\`\`bash
seal-use tool seal_approval_rules_list --corp <corpId> --json '{"fields":["id","code","scope","strictness","status","updatedAt"]}'
\`\`\`
## Clear Draft Rules Before Import
Use this for test tenants when the next step is importing another tenant's rule set. Always preview first unless the user has already confirmed the exact tenant.
\`\`\`bash
seal-use rules clear --corp <corpId> --dry-run
seal-use rules clear --corp <corpId> --yes
\`\`\`
Expected shape:
\`\`\`json
{
"corpId": "xiezihao",
"dryRun": false,
"beforeCount": 49,
"deleted": 49,
"afterCount": 0
}
\`\`\`
Tool-layer equivalent:
\`\`\`bash
seal-use tool seal_approval_rules_clear --corp <corpId> --json '{"dryRun":true}'
seal-use tool seal_approval_rules_clear --corp <corpId> --json '{"dryRun":false}'
\`\`\`
## Get One Historical Rule
Use this when a run used a historical rule version and current rules may differ.
\`\`\`bash
seal-use rules get '#0038' --corp <corpId> --version 16
seal-use rules get '#0038' --corp <corpId> --version latest
\`\`\`
If the user starts from a run and a runtime ID such as \`rule-205\`, resolve against that run:
\`\`\`bash
seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
\`\`\`
Return the single rule text plus \`scope\`, \`strictness\`, \`status\`, \`versionNumber\`, and version metadata. Avoid commands that dump a whole rule version unless the user asks for the full version.
## Search Approval Knowledge Compactly
Prefer scoped and trimmed search:
\`\`\`bash
seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["关键词"],"areas":["rules"],"matchMode":"any","maxResults":20,"snippetOnly":true,"maxChars":500,"fields":["id","title","snippet"]}'
\`\`\`
When investigating historical behavior, search the matching rule version if the API supports it:
\`\`\`bash
seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","versionNumber":16,"snippetOnly":true,"maxChars":500}'
\`\`\`
Use current search only when the question is about current draft/current knowledge, not why a historical run behaved a certain way.
## 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 xg0=()=>{};var bg0="# Seal Approval Rule Linter & Quality Validation\n\nUse this reference when analyzing, validating, or linting Seal AI approval rules to detect vague phrasing, missing exception evidence, or formatting defects before publishing.\n\n## Key Principles\n\n- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled: false`) to avoid unsolicited noise during standard operations.\n- **Doctor Visibility**: `seal-use doctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-use config lint enable`) when disabled.\n- **Explicit Triggering**: `seal-use rules lint` always runs regardless of global configuration.\n- **Draft Hook**: When `seal-use config lint enable` is set, `seal_approval_rule_update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.\n- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.\n\n## CLI Commands\n\n### 1. Lint Current Draft Rules (Whole-RuleSet Scan)\n\n```bash\nseal-use rules lint --corp <corpId>\n```\n\n### 2. Lint Specific Historical Version or Single Rule\n\n```bash\n# Lint rules in published version 16\nseal-use rules lint --version 16 --corp <corpId>\n\n# Lint a specific rule by code (#0038)\nseal-use rules lint --code '#0038' --corp <corpId>\n\n# Summary mode (only show rules with issues)\nseal-use rules lint --summary --corp <corpId>\n```\n\n### 3. Quality Gate for CI / Release\n\n```bash\n# If overall score is below 85, terminates with exit code 1\nseal-use rules lint --min-score 85 --level error --corp <corpId>\n```\n\n### 4. Configure Global Linter Settings\n\n```bash\n# Check status\nseal-use config lint status\n\n# Enable auto lint on rule updates\nseal-use config lint enable --linter builtin --min-score 80\n\n# Disable auto lint\nseal-use config lint disable\n```\n\n## Official Linters\n\n| Linter Name | Scope & Purpose | Aliases |\n| :--- | :--- | :--- |\n| `builtin` | Seal 官方标准校验器:拦截过短描述、主观模糊词与悬空例外条款。 | `default`, `official/builtin` |\n| `strict` | Seal 官方严格风控校验器:强校验字数、刚性定量约束、凭证依据与具体审批人角色。 | `official/strict` |\n| `hlab` | 合思实验室 (HLab) 结构化规则校验器:SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判。 | `hlab-sop`, `hlab-rules`, `hlab-standard`, `official/hlab` |\n\n```bash\n# Inspect available linters\nseal-use rules linters\n\n# Lint rules using HLab SOP standard\nseal-use rules lint --linter hlab --corp <corpId>\n\n# Lint local rule workspace offline with HLab standard\nseal-use rules lint --linter hlab --file ./rules.local.json\n```\n\n## Built-In Detection Rules (`builtin`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `TOO_SHORT` | `error` | Rule description is under 5 characters. | Add concrete conditions and criteria. |\n| `VAGUE_WORD` | `error` | Contains subjective/fuzziness words (`原则上`, `尽量`, `适当`, `酌情`, `一般情况下`, `合理控制`). | Replace with rigid thresholds, enums, or criteria. |\n| `HANGING_EXCEPTION` | `warning` | Exception trigger found (`除非`, `特殊情况`, `经批准`) without verifiable evidence keyword (`备注`, `附件`, `证明`, `邮件`, `截图`). | Specify exact evidence source in invoice/document. |\n\n## HLab SOP Detection Rules (`hlab`)\n\n| Code | Level | Description | Recommendation |\n| :--- | :---: | :--- | :--- |\n| `MISSING_CHECK_METHOD` | `error` | Missing `**检查方法**` section in rule description. | Add `**检查方法**:` specifying fields, vouchers, and normalization logic. |\n| `MISSING_EVAL_STANDARD` | `error` | Missing `**判定标准**` section in rule description. | Add `**判定标准**:` with standard branches. |\n| `INCOMPLETE_TERNARY_BRANCH` | `error` | Incomplete ternary branch under evaluation criteria (missing `PASS`, `FAIL`, or `证据不足`). | Provide complete ternary closure: `- PASS:`, `- FAIL:`, `- 证据不足:`. |\n| `INSUFFICIENT_WITHOUT_MANUAL_REVIEW` | `warning` | `证据不足` branch does not specify escalating to `人工复核`. | Add `转人工复核` at the end of `证据不足` branch. |\n| `DISPOSAL_ACTION_LEAK` | `warning` | Contains whole-bill workflow disposal actions (`驳回单据`, `直接驳回`, `进行提醒`, `退回单据`). | Decouple disposal actions from rule text; rely on rule strictness or platform workflow. |\n| `SCOPE_FALSE_SKIP_PRONE` | `warning` | Scope contains material upload conditions (`若上传了`, `若提供了`, `附件需上传`). | Keep scope pure to business triggers; handle missing materials explicitly in FAIL branch to prevent silent SKIP. |\n| `RISK_SUPPRESSION` | `erroLine truncated
`;var ug0=()=>{};var cg0="# Rule Lightweight Queries\n\nUse this reference when the user wants rule counts, compact rule lists, one rule from draft or a historical version, or approval rule search without dumping hundreds of rule descriptions.\n\n## Draft Default vs. Published Version (`--version latest`)\n\nEvery rule has a 4-digit zero-padded `code` (`0000, 0001, 0025, 0038, ...`).\n\n- **Default = Current Draft (`草稿`)**: When `--version` is omitted, `rules count`, `rules list`, `rules get <code>`, `rules search`, `rules lint`, and `rules pull` **all read the current draft**.\n- **Latest Published Version = `--version latest` (`最新发布`)**: To inspect the latest published version, **always pass `--version latest`** (or `--version <number>` for a specific historical version).\n- Publishing or deleting rules can shift `code` numbers across versions, so a `code` in a historical run must be resolved together with `--version <number>` or `--record-id <recordId>`.\n\n## Count Rules\n\nUse count when only scale or existence matters.\n\n```bash\n# Count current draft rules (default)\nseal-use rules count --corp <corpId>\n\n# Count rules in latest published version\nseal-use rules count --version latest --corp <corpId>\n```\n\nExpected shape:\n\n```json\n{ \"count\": 191 }\n```\n\n## List Rule Summaries\n\nUse summaries for navigation and selection.\n\n```bash\n# List current draft rule summaries (default)\nseal-use rules list --summary --corp <corpId>\n\n# List latest published version rule summaries\nseal-use rules list --version latest --summary --corp <corpId>\n```\n\nDefault summary includes `code`, `status`, `strictness`, `scope`, and `updatedAt`. Do not pull full `description` fields across all rules unless the user needs rule text.\n\n## Get One Rule (Draft or Published Version)\n\nRead a single rule from the current draft (default):\n\n```bash\nseal-use rules get 0038 --corp <corpId>\n```\n\nRead a single rule from the latest published version, a specific published version, or the version used by an approval run:\n\n```bash\nseal-use rules get 0038 --version latest --corp <corpId>\nseal-use rules get 0038 --version 16 --corp <corpId>\nseal-use rules get 0205 --record-id <recordId> --corp <corpId>\n```\n\nReturns `id`, `code`, `ruleCode`, `runtimeRuleId`, `description`, `scope`, `strictness`, `status`, and version metadata when reading from a published version.\n\n## Search Rules Compactly\n\n```bash\n# Search current draft rules (default)\nseal-use rules search <keyword> --maxResults 20 --corp <corpId>\n\n# Search latest published version or a specific historical version\nseal-use rules search <keyword> --version latest --maxResults 20 --corp <corpId>\nseal-use rules search <keyword> --version 16 --maxResults 20 --corp <corpId>\n```\n\n## Clear Draft Rules Before Import\n\nUse this for test tenants when the next step is importing another tenant's rule set. Always preview first unless the user has already confirmed the exact tenant.\n\n```bash\nseal-use rules clear --dry-run --corp <corpId>\nseal-use rules clear --yes --corp <corpId>\n```\n\nExpected shape:\n\n```json\n{\n \"corpId\": \"xiezihao\",\n \"dryRun\": false,\n \"beforeCount\": 49,\n \"deleted\": 49,\n \"afterCount\": 0\n}\n```\n\n## Output Discipline\n\nIf a rule command would return many descriptions or more than about 20 rules, use `rules count`, `rules list --summary`, `rules search`, or `--output-file`. Use `--full` only for deliberate exports.\n";var ig0=()=>{};var dg0="# Seal Approval Rule Linter & Quality Validation\n\nUse this reference when analyzing, validating, or linting Seal AI approval rules to detect vague phrasing, missing exception evidence, or formatting defects before publishing.\n\n## Key Principles\n\n- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled: false`) to avoid unsolicited noise during standard operations.\n- **Doctor Visibility**: `seal-use doctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-use config lint enable`) when disabled.\n- **Explicit Triggering**: `seal-use rules lint` always runs regardless of global configuration.\n- **Draft Hook**: When `seal-use config lint enable` is set, `seal-use rules update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.\n- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.\n\n## CLI Commands\n\n### 1. Lint Current Draft Rules (Whole-RuleSet Scan)\n\n```bash\nseal-use rules lint --corp <corpId>\n```\n\n### 2. Lint Specific Historical Version or Single Rule\n\n```bash\n# Lint rules in published version 16\nseal-use rules lint --version 16 --corp <corpId>\n\n# Lint a specific rule by code\nseal-use rules lint --code 0038 --corp <cor Line truncated
本文档面向 AI Agent 与运维人员,规范从**生产/测试环境搭配接入**、**配置与合思集成自动同步**、**测试环境单据模拟验证**,到**生产规则安全投产**的端到端标准工作流。
@@ -2161,7 +2049,7 @@ flowchart TD
C --> D["Stage 4: 自动化规则回归测试矩阵与模拟验证 (test regression / simulation)"]
D --> E{"回归与模拟是否通过 (safeToPublish)?"}
E -- 存在偏差/翻转误伤 --> B
E -- 验证通过 --> F["Stage 5: 生产环境正式发布 (rules push --publish)"]
E -- 验证通过 --> F["Stage 5: 生产环境正式发布 (rules publish)"]
\`\`\`
---
@@ -2212,18 +2100,18 @@ flowchart TD
1. **锁定目标企业与规则定位**:
\`\`\`bash
# 查询生产企业当前生效规则与草稿规则
seal-use rules list --corp <prodCorpId> --summary
# 精确读取某条目标规则
seal-use rules get <ruleCode> --corp <prodCorpId>
# 查询生产企业当前草稿规则摘要列表
seal-use rules list --summary --corp <prodCorpId>
# 按编号精确读取某条目标草稿规则
seal-use rules get <code> --corp <prodCorpId>
\`\`\`
2. **仅修改草稿(保持生产未发布)**:
- 提取最小修改建议(只改动必要的描述语句,保留 \`scope\` 与 \`strictness\`)。
- 使用规则更新或创建接口修改生产企业草稿:
- 修改生产企业草稿规则(含引号或换行时优先使用 \`--description-file\`):
\`\`\`bash
seal-use tool seal_approval_rule_update --corp <prodCorpId> --json '{"ruleId":"...","description":"..."}'
seal-use rules update <code> --description-file /tmp/rule-desc.txt --corp <prodCorpId>
\`\`\`
- **最佳安全建议**:修改草稿后,建议先不调用 \`seal-use rules push --publish --corp <prodCorpId>\`,而是先引导用户同步至测试企业进行单据模拟验证;若用户明确要求直接投产,则严格遵从用户指示执行发布。
- **最佳安全建议**:修改草稿后,建议先不调用 \`seal-use rules publish\` 直接发布生产,而是先引导用户同步至测试企业进行单据模拟验证;若用户明确要求直接投产,则严格遵从用户指示执行发布。
---
@@ -2339,10 +2227,10 @@ flowchart TD
4. **生产环境最终投产 (Final Production Release)**:
仅当测试环境所有单据的模拟判定结果完全符合预期时,才在生产企业执行正式发布:
\`\`\`bash
seal-use tool seal_approval_rules_publish --corp <prodCorpId> --json '{"versionName":"审核规则 版本N"}'
seal-use rules publish "审核规则 版本N" --corp <prodCorpId>
\`\`\`
发布后核实版本状态,完成业务安全闭环。
`;var ig0=()=>{};var dg0=`# Webhook Resource Pack Workflow (Webhook 资源包)
`;var pg0=()=>{};var og0=`# Webhook Resource Pack Workflow (Webhook 资源包)
A **Webhook resource pack** (webhook 资源包 / 资源包, CLI: \`resource-pack\`, alias: \`pack\`, legacy alias: \`material-pack\`) is a ZIP file that bundles an Excel information sheet (\`信息表.xlsx\`) with attachments organised by document ID. It is designed for exporting online approval runs and transferring them offline across environments or teams to be replayed via inbound Webhooks.
@@ -2471,11 +2359,11 @@ When a push fails because of the attachment policy, the error is actionable and
3. If configuration change is authorized, read the current policy with \`webhook get\`/\`webhook list\`, update only the necessary fields, and verify the returned configuration.
4. Retry the original \`material-pack push\`; it will load the latest saved policy before any upload begins.
The same loop is available through the internal tool registry: read with \`seal-use tool seal_webhook_get\`/\`seal_webhook_list\`, update with \`seal-use tool seal_webhook_update\` and its \`materialPackFilePolicy\` patch, then retry \`seal-use tool seal_webhook_material_pack\` in \`push\` mode. Over MCP these run through \`seal_cli\` (reads) or \`seal_cli_write\` (the update and push, which need user confirmation); no separate \`seal_webhook_*\` MCP tool exists. Set \`maxFileSizeBytes\` to \`null\` to clear the upper bound. \`allowedExtensions\` is a complete replacement list, so include existing allowed suffixes when adding one.
Use \`--clear-max-file-size\` on \`seal-use webhook update\` to remove the upper bound. \`--allowed-extensions\` is a complete replacement list, so include existing allowed suffixes when adding one.
If the assistant lacks permission to update the Webhook or the user does not authorize relaxing the rule, report the block rather than bypassing validation. Since validation happens before the upload loop, a failed attempt does not leave a partially pushed material pack.
The direct local \`material-pack preview\` command and the tool-registry preview use the default or temporary policy. They do not automatically read a selected Webhook's persisted policy. Use \`webhook ready --file --webhook <idOrName>\` or the actual push path when validating against the saved inbound policy.
The direct local \`resource-pack preview\` command uses the default or temporary policy. It does not automatically read a selected Webhook's persisted policy. Use \`seal-use webhook ready <资源包.zip> --webhook <idOrName>\` or the actual push path when validating against the saved inbound policy.
### Error messages reference
@@ -2493,10 +2381,10 @@ The direct local \`material-pack preview\` command and the tool-registry preview
| \`附件后缀不在白名单中\` | Attachment extension is not allowed by the Webhook policy | Add the extension with \`--allowed-extensions\` or convert the file |
| \`附件上传失败 <status>\` | Network/server error during file upload | Check webhook URL, secret, and server availability |
`;var ng0=()=>{};var Xx1="iVBORw0KGgoAAAANSUhEUgAADVgAAAdwCAYAAACUWcTmAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAANWKADAAQAAAABAAAHcAAAAAD4n9OGAABAAElEQVR4AeydB4AdVfX/z246pNAD0hK6dOki0rsU+dMJJVIFRYoUFUFAQUCqgHSkxx8gTRCpFkB6CU06SQi9BEhC+u7/fu7b83J3dt7bt33f5nuStzNz5947M583c+fOvPO9p6Y+mMlEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4kUDsHHrMOWQREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAQigd7jxo8TChEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYIwkogtUc+bXroEVABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABCBQUx9MKERABERABERABERABERABERABERABERABERABERABERABERABESgqwiMHz/eBgwY0FWb13ZFQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQATmcAKKYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwn0npMPXscuAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAj2RwP8+n26vfjbd3vpyho2fPN0+mjLTJs+qs/qaOhvYp8YWGtDLFh/U25YZ3NdWnr+/rTDvgJ6IQcckAhURqKkPVlFOZRIBERABERABERABERABERABERABERABERABERABERABERABERCBDiAwfvx4GzBAP9p2AFpVKQIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiMIcR+GhSnT347lT713tT7eOpM4OYqj5+LEzNEFdZ+MyKU5Zr4jLp9fat/r1ss28NtM0WG2KLzN1nDiOnw53TCUhgNaefATp+ERABERABERABERABERABERABERABERABERABERABERABEehiAhJYdfEXoM2LgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAhUPYFJ08z+7+Updsc7U8OxFARURKqyIKAqCKnqbVYQUdU2CK7iOiuIr4oirLBcgxArfHZZcrDttcwCNnefXlXPRgcgApUQkMCqEkrKIwIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0GEEJLDqMLSqWAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4g8MR7M+2Cp6fY5JmFSFQhRlUQStUVBVUsF0VUCKiSSFZEsKqLkawa5yH/oN5mP195qK0/dPAcQFGHOKcTkMBqTj8DdPwiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0MUEJLDq4i+gCzY/ZcqUuNUBAwZ0wda1SREQAREQAREQAREQAREQAREQAREQAREQAREQARHoHAKd8S501AszbNT/psXIUwWhVDi2IK6qj5GriGRVEE4RlSoVWlUayYry+w2fx0Yst1DnQNNWRKCLCAQ9oUwEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKCaCFz035n20JgZ1stqQowqs9qaWmJVBR1VbRBZkdLLakN0qiCzCtMGgVXMURfW1YQsTHsFEdasMC0UCSWjOIvcbte++6V9MX2mHb7ytzypS6e/+93v7H//+1/uPuy888727W9/O35yMyhRBEoQ4NyXiYAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiECPIXDbbbfZiBEjGh0PP7aSxif90dXzks68G3k8P2VTYznNm67TvAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BoGLHp1lD74zM6qh6kK4qprwqW+YMl9TR1pYHcRWtUFHhZaqLi6TFsJbhflCOYRVtbG818H6+KGOhnr+9v4ku/DlDzrj0Mpug/fz6Xv+bOa//vWvxkcmAi0loAhWLSWm/CIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAt2WAD+sdvQPp/xwy0cjYHbb00A7JgIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAI9msCo5+rt4XdDVKoaIlfVxChVHHCMPtXoyIO4KuSoy0ayqifOFeWJUxVqSCJZfW/hwfbox1/FuqiKHF4zIqt5+39qey+zYEztij/pbwC8p0/NhVc+TddpXgSaIyCBVXOEtF4EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKBqCLz66qudtq/8iPvrX/+607aX3VBniMluvPHG7Ga1LAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiUIJAzT+vi2vqN9m3RA4li0DbCTw5xuyWl+qMIFQWIk8Rpqo+Cq1YDlKokL7m4v2D7IrFOgurwvqwoiaEsIpyKebNHv9wki+FdERaSKlq7fytlrEj73vLHvvoq7gNUkM4q1BPKBTque7tCbbUoH62/tDBrOkyQ1yVfUf/u9/9rmx0qy7b2VZu2H8H4FhXXHFF+3//7/+1siYVq4RATX2wSjIqjwiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BIHx48fbgAEDOqLqHlun/6ja0QfYUQKrKVOmxF3X997R36DqFwEREAEREAEREAEREAEREAEREAEREAER6EwCs074btxcr9Me78zNalvdmEB7vwudNM3ssFvNJs2oi0KqWUE0FQVUUUiF6KreLtx5QVtt0X5lqYz+cIodevfYkKcg1KpHfBXKHvadobbvdxay0R9NsgPveyOsD3KTWiQniLjCNHyYDgqhfq7bcCmbu0+vsttpy0rEUlgqLErfje+8885NBEepwMrXE83Ko16ldbVl3zqjbHqsvj0EZdmoXb5O07YTUASrtjNUDSIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiLQqQQ6M1JXpx5YD96Yj3sZR3ntwcdZyaHNmDHDPv74Y1t00UULo95WUqiL8syaNct69eo4J5EuOqwu3Szff58+fZrsg66RJkiU0MkEGJ4YhzSZCHQmAdpEjHtNbW0Ydb4djHvX9OnTNYBBA0ucWfv169dufNvhK+oxVUydOtXq6upsrrnm6jHHpAMRAREQAREQgbYS8OhV1FN/1VFWc8B5ba2yWJ6+45gxY+ytt96y/v3729JLL22LLbZYbj+H9y4u6ilWUGJm7rnntgUXXDCu/frrr+2LL74okbNxMv3XJZZYonFia5fGjLaad0e3tnSx3JwSNezmZ2ts8vQQTSr8C9KoOA2Sp8ChJvyttQPXG9SsuMqh1VEslIviqTBdf5G5o7iK1NUWHmg/XW1Ru/iF960+aK8QVbE1j2SFwOumtz6zg749lOztbqlQygVSCIuYL2cIqDwPoirepfsy5ZgnLRv5qlydXbUu73cAjqka9h1mCMSw1kbdamv5uPEW/pHAqoXAlF0EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEuppA+oNwR0WZ6upj7Enbf+ONN+yUU06Jh3Tsscfa6quv3pMOLx7Lhx9+aMcff3yc33vvvW3LLbfMPcZbbrnF7rjjjrjuF7/4ha2yyiq5+dLEyZMn24QJE2zhhRe23r1720svvWTnn39+zPLLX/7SlllmmTR77jyORb/61a/iuv3339++973v5eZLE99++2076aSTbNlll7UtttiiojJp+WqZHz16dBQ84XziNnPmTPv00099sUVTHLMGDx6cW2bcuHHRAWSzzTazHXfc0eaZZ56Y7/HHH7eLLroozh933HG21FJL2Zlnnmm77LJLm6+Xb775xr766qvc/ckmzjvvvNFJLZveluWzzz7b3nrzTVty2DDjfG2JTZs2ze677z7bZpttGonSvvzyy4od5bLb4zqqJqHnxxNmWcHZK3skLV/u16fG5huUL2B5cPRUO Line truncated
`,"utf8"),{detected:I,configured:!0,configPath:U,targetDir:Y,action:"created"};let Q={};try{Q=JSON.parse(lg0(U,"utf8"))}catch{Q={entries:[]}}if(!Array.isArray(Q.entries))Q.entries=[];if(Q.entries.findIndex((z)=>z&&typeof z.path==="string"&&z.path===Y)!==-1)return{detected:I,configured:!0,configPath:U,targetDir:Y,action:"already_present"};let K=Q.entries.findIndex((z)=>z&&typeof z.path==="string"&&(z.path==="~/.agents/skills"||z.path==="~/.agents/skills/"));if(K!==-1)return Q.entries[K]={...Q.entries[K],path:Y},no(U,JSON.stringify(Q,null,2)+`
`,"utf8"),{detected:I,configured:!0,configPath:U,targetDir:Y,action:"updated_tilde"};return Q.entries.unshift({path:Y}),no(U,JSON.stringify(Q,null,2)+`
`,"utf8"),{detected:I,configured:!0,configPath:U,targetDir:Y,action:"prepended"}}function lo($){let Y=$?.targetSkillsDir??og0(),U=$?.configFile??rg0(),I=sg0(),Q=!1;if(dq(U))try{let J=JSON.parse(lg0(U,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((K)=>K?.path===Y)}catch{}return{detected:I,configured:Q,configPath:U,targetDir:Y}}var oo=()=>{};import{cpSync as Ox1,existsSync as lz,lstatSync as tg0,mkdirSync as Nx1,realpathSync as UY,rmSync as Dx1,symlinkSync as Bx1,unlinkSync as ag0}from"node:fs";import{homedir as eg0}from"node:os";import{dirname as $y0,join as IY}from"node:path";function Ax1($,Y){let U=Y?.baseHomeDir??eg0(),I=IY(U,$.rootDirName),Q=Y?.sourceSkillDir??IY(U,".agents","skills","seal-use"),J=$y0(Q),K=IY(I,"skills"),z=IY(K,"seal-use");if(!lz(I))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(lz(K)&&lz(J))try{if(UY(K)===UY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}Nx1(K,{recursive:!0});let G;try{G=tg0(z)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if(UY(z)===UY(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:z}}catch{}try{ag0(z)}catch{}}else if(G.isDirectory())Dx1(z,{recursive:!0,force:!0}),H=!0;else ag0(z);let W=process.platform==="win32"?"junction":"dir";try{return Bx1(Q,z,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:z}}catch{try{return Ox1(Q,z,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:z}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:z,error:X?.message||String(X)}}}}function Px1($,Y){let U=Y?.baseHomeDir??eg0(),I=IY(U,$.rootDirName),Q=Y?.sourceSkillDir??IY(U,".agents","skills","seal-use"),J=$y0(Q),K=IY(I,"skills"),z=IY(K,"seal-use");if(!lz(I))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(lz(K)&&lz(J))try{if(UY(K)===UY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}let G;try{G=tg0(z)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if(UY(z)===UY(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:z}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:z}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:z}}function ro($){return Yy0.map((Y)=>Ax1(Y,$))}function so($){return Yy0.map((Y)=>Px1(Y,$))}var Yy0;var ao=m(()=>{Yy0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var to=m(()=>{oo();ao();oo();ao()});import{existsSync as Tx1,mkdirSync as eo,readFileSync as Ex1,rmSync as jx1,writeFileSync as Uy0}from"node:fs";import{homedir as Qy0}from"node:os";import{dirname as Iy0,join as mq}from"node:path";function $r(){return Jy0["SKILL.md"]||""}function Ky0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function zy0($=mq(nI(),"SKILL.md")){try{return Ky0(Ex1($,"utf8"))}catch{return}}function nI(){return mq(Qy0(),".agents","skills","seal-use")}function Rx1(){return mq(Qy0(),".agents","skills","seal-home")}function _x1(){let $=Rx1();if(Tx1($))try{return jx1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function Gy0($=nI()){_x1(),eo($,{recursive:!0});let Y=[];for(let[U,I]of Object.entries(Jy0)){let Q=mq($,U);eo(Iy0(Q),{recursive:!0}),Uy0(Q,I,"utf8"),Y.push(U)}for(let[U,I]of Object.entries(Cx1)){let Q=mq($,U);eo(Iy0(Q),{recursive:!0}),Uy0(Q,I),Y.push(U)}return{targetDir:$,files:Y}}var Jy0,Cx1,mZ4;var lq=m(()=>{co();co();to();Jy0=pg0,Cx1=Object.fromEntries(Object.entries(mg0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));mZ4=Ky0($r())});function Hy0(){return`# Seal Use 系统架构与运行规范白皮书
`;var lg0=()=>{};var Lx1="iVBORw0KGgoAAAANSUhEUgAADVgAAAdwCAYAAACUWcTmAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAANWKADAAQAAAABAAAHcAAAAAD4n9OGAABAAElEQVR4AeydB4AdVfX/z246pNAD0hK6dOki0rsU+dMJJVIFRYoUFUFAQUCqgHSkxx8gTRCpFkB6CU06SQi9BEhC+u7/fu7b83J3dt7bt33f5nuStzNz5947M583c+fOvPO9p6Y+mMlEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4kUDsHHrMOWQREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAQigd7jxo8TChEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYIwkogtUc+bXroEVABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABERABCBQUx9MKERABERABERABERABERABERABERABERABERABERABERABERABESgqwiMHz/eBgwY0FWb13ZFQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQATmcAKKYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwlIYDUnf/s6dhEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYwwlIYDWHnwA6fBEQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQAREQARGYkwn0npMPXscuAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAj2RwP8+n26vfjbd3vpyho2fPN0+mjLTJs+qs/qaOhvYp8YWGtDLFh/U25YZ3NdWnr+/rTDvgJ6IQcckAhURqKkPVlFOZRIBERABERABERABERABERABERABERABERABERABERABERABERCBDiAwfvx4GzBAP9p2AFpVKQIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiMIcR+GhSnT347lT713tT7eOpM4OYqj5+LEzNEFdZ+MyKU5Zr4jLp9fat/r1ss28NtM0WG2KLzN1nDiOnw53TCUhgNaefATp+ERABERABERABERABERABERABERABERABERABERABERABEehiAhJYdfEXoM2LgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAhUPYFJ08z+7+Updsc7U8OxFARURKqyIKAqCKnqbVYQUdU2CK7iOiuIr4oirLBcgxArfHZZcrDttcwCNnefXlXPRgcgApUQkMCqEkrKIwIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0GEEJLDqMLSqWAREQAREQAREQAREQAREQAREQAREQAREQAREQAREYA4g8MR7M+2Cp6fY5JmFSFQhRlUQStUVBVUsF0VUCKiSSFZEsKqLkawa5yH/oN5mP195qK0/dPAcQFGHOKcTkMBqTj8DdPwiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIi0MUEJLDq4i+gCzY/ZcqUuNUBAwZ0wda1SREQAREQAREQAREQAREQAREQAREQAREQAREQARHoHAKd8S501AszbNT/psXIUwWhVDi2IK6qj5GriGRVEE4RlSoVWlUayYry+w2fx0Yst1DnQNNWRKCLCAQ9oUwEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKCaCFz035n20JgZ1stqQowqs9qaWmJVBR1VbRBZkdLLakN0qiCzCtMGgVXMURfW1YQsTHsFEdasMC0UCSWjOIvcbte++6V9MX2mHb7ytzypS6e/+93v7H//+1/uPuy888727W9/O35yMyhRBEoQ4NyXiYAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiECPIXDbbbfZiBEjGh0PP7aSxif90dXzks68G3k8P2VTYznNm67TvAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BoGLHp1lD74zM6qh6kK4qprwqW+YMl9TR1pYHcRWtUFHhZaqLi6TFsJbhflCOYRVtbG818H6+KGOhnr+9v4ku/DlDzrj0Mpug/fz6Xv+bOa//vWvxkcmAi0loAhWLSWm/CIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAt2WAD+sdvQPp/xwy0cjYHbb00A7JgIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAI9msCo5+rt4XdDVKoaIlfVxChVHHCMPtXoyIO4KuSoy0ayqifOFeWJUxVqSCJZfW/hwfbox1/FuqiKHF4zIqt5+39qey+zYEztij/pbwC8p0/NhVc+TddpXgSaIyCBVXOEtF4EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAERKBqCLz66qudtq/8iPvrX/+607aX3VBniMluvPHG7Ga1LAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiIAIiUIJAzT+vi2vqN9m3RA4li0DbCTw5xuyWl+qMIFQWIk8Rpqo+Cq1YDlKokL7m4v2D7IrFOgurwvqwoiaEsIpyKebNHv9wki+FdERaSKlq7fytlrEj73vLHvvoq7gNUkM4q1BPKBTque7tCbbUoH62/tDBrOkyQ1yVfUf/u9/9rmx0qy7b2VZu2H8H4FhXXHFF+3//7/+1siYVq4RATX2wSjIqjwiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAh0BIHx48fbgAEDOqLqHlun/6ja0QfYUQKrKVOmxF3X997R36DqFwEREAEREAEREAEREAEREAEREAEREAER6EwCs074btxcr9Me78zNalvdmEB7vwudNM3ssFvNJs2oi0KqWUE0FQVUUUiF6KreLtx5QVtt0X5lqYz+cIodevfYkKcg1KpHfBXKHvadobbvdxay0R9NsgPveyOsD3KTWiQniLjCNHyYDgqhfq7bcCmbu0+vsttpy0rEUlgqLErfje+8885NBEepwMrXE83Ko16ldbVl3zqjbHqsvj0EZdmoXb5O07YTUASrtjNUDSIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiIgAiLQqQQ6M1JXpx5YD96Yj3sZR3ntwcdZyaHNmDHDPv74Y1t00UULo95WUqiL8syaNct69eo4J5EuOqwu3Szff58+fZrsg66RJkiU0MkEGJ4YhzSZCHQmAdpEjHtNbW0Ydb4djHvX9OnTNYBBA0ucWfv169dufNvhK+oxVUydOtXq6upsrrnm6jHHpAMRAREQAREQgbYS8OhV1FN/1VFWc8B5ba2yWJ6+45gxY+ytt96y/v3729JLL22LLbZYbj+H9y4u6ilWUGJm7rnntgUXXDCu/frrr+2LL74okbNxMv3XJZZYonFia5fGjLaad0e3tnSx3JwSNezmZ2ts8vQQTSr8C9KoOA2Sp8ChJvyttQPXG9SsuMqh1VEslIviqTBdf5G5o7iK1NUWHmg/XW1Ru/iF960+aK8QVbE1j2SFwOumtz6zg749lOztbqlQygVSCIuYL2cIqDwPoirepfsy5ZgnLRv5qlydXbUu73cAjqka9h1mCMSw1kbdamv5uPEW/pHAqoXAlF0EREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEREAEuppA+oNwR0WZ6upj7Enbf+ONN+yUU06Jh3Tsscfa6quv3pMOLx7Lhx9+aMcff3yc33vvvW3LLbfMPcZbbrnF7rjjjrjuF7/4ha2yyiq5+dLEyZMn24QJE2zhhRe23r1720svvWTnn39+zPLLX/7SlllmmTR77jyORb/61a/iuv3339++973v5eZLE99++2076aSTbNlll7UtttiiojJp+WqZHz16dBQ84XziNnPmTPv00099sUVTHLMGDx6cW2bcuHHRAWSzzTazHXfc0eaZZ56Y7/HHH7eLLroozh933HG21FJL2Zlnnmm77LJLm6+Xb775xr766qvc/ckmzjvvvNFJLZveluWzzz7b3nrzTVty2DDjfG2JTZs2ze677z7bZpttGonSvvzyy4od5bLb4zqqJqHnxxNmWcHZK3skLV/u16fG5huUL2B5cPRUO Line truncated
`,"utf8"),{detected:I,configured:!0,configPath:U,targetDir:Y,action:"created"};let Q={};try{Q=JSON.parse(ag0(U,"utf8"))}catch{Q={entries:[]}}if(!Array.isArray(Q.entries))Q.entries=[];if(Q.entries.findIndex((z)=>z&&typeof z.path==="string"&&z.path===Y)!==-1)return{detected:I,configured:!0,configPath:U,targetDir:Y,action:"already_present"};let K=Q.entries.findIndex((z)=>z&&typeof z.path==="string"&&(z.path==="~/.agents/skills"||z.path==="~/.agents/skills/"));if(K!==-1)return Q.entries[K]={...Q.entries[K],path:Y},so(U,JSON.stringify(Q,null,2)+`
`,"utf8"),{detected:I,configured:!0,configPath:U,targetDir:Y,action:"updated_tilde"};return Q.entries.unshift({path:Y}),so(U,JSON.stringify(Q,null,2)+`
`,"utf8"),{detected:I,configured:!0,configPath:U,targetDir:Y,action:"prepended"}}function eo($){let Y=$?.targetSkillsDir??tg0(),U=$?.configFile??eg0(),I=$y0(),Q=!1;if(lq(U))try{let J=JSON.parse(ag0(U,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((K)=>K?.path===Y)}catch{}return{detected:I,configured:Q,configPath:U,targetDir:Y}}var $r=()=>{};import{cpSync as Ax1,existsSync as az,lstatSync as Uy0,mkdirSync as Px1,realpathSync as KY,rmSync as Tx1,symlinkSync as Ex1,unlinkSync as Yy0}from"node:fs";import{homedir as Iy0}from"node:os";import{dirname as Qy0,join as zY}from"node:path";function jx1($,Y){let U=Y?.baseHomeDir??Iy0(),I=zY(U,$.rootDirName),Q=Y?.sourceSkillDir??zY(U,".agents","skills","seal-use"),J=Qy0(Q),K=zY(I,"skills"),z=zY(K,"seal-use");if(!az(I))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(az(K)&&az(J))try{if(KY(K)===KY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}Px1(K,{recursive:!0});let G;try{G=Uy0(z)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if(KY(z)===KY(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:z}}catch{}try{Yy0(z)}catch{}}else if(G.isDirectory())Tx1(z,{recursive:!0,force:!0}),H=!0;else Yy0(z);let W=process.platform==="win32"?"junction":"dir";try{return Ex1(Q,z,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:z}}catch{try{return Ax1(Q,z,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:z}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:z,error:X?.message||String(X)}}}}function Cx1($,Y){let U=Y?.baseHomeDir??Iy0(),I=zY(U,$.rootDirName),Q=Y?.sourceSkillDir??zY(U,".agents","skills","seal-use"),J=Qy0(Q),K=zY(I,"skills"),z=zY(K,"seal-use");if(!az(I))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(az(K)&&az(J))try{if(KY(K)===KY(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:K}}catch{}let G;try{G=Uy0(z)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if(KY(z)===KY(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:z}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:z}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:z}}function Yr($){return Jy0.map((Y)=>jx1(Y,$))}function Ur($){return Jy0.map((Y)=>Cx1(Y,$))}var Jy0;var Ir=m(()=>{Jy0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var Qr=m(()=>{$r();Ir();$r();Ir()});import{existsSync as Rx1,mkdirSync as Jr,readFileSync as _x1,rmSync as vx1,writeFileSync as Ky0}from"node:fs";import{homedir as Gy0}from"node:os";import{dirname as zy0,join as rq}from"node:path";function Kr(){return Hy0["SKILL.md"]||""}function Wy0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function Xy0($=rq(lI(),"SKILL.md")){try{return Wy0(_x1($,"utf8"))}catch{return}}function lI(){return rq(Gy0(),".agents","skills","seal-use")}function hx1(){return rq(Gy0(),".agents","skills","seal-home")}function gx1(){let $=hx1();if(Rx1($))try{return vx1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function Zy0($=lI()){gx1(),Jr($,{recursive:!0});let Y=[];for(let[U,I]of Object.entries(Hy0)){let Q=rq($,U);Jr(zy0(Q),{recursive:!0}),Ky0(Q,I,"utf8"),Y.push(U)}for(let[U,I]of Object.entries(Sx1)){let Q=rq($,U);Jr(zy0(Q),{recursive:!0}),Ky0(Q,I),Y.push(U)}return{targetDir:$,files:Y}}var Hy0,Sx1,eZ4;var sq=m(()=>{ro();ro();Qr();Hy0=rg0,Sx1=Object.fromEntries(Object.entries(sg0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));eZ4=Wy0(Kr())});function qy0(){return`# Seal Use 系统架构与运行规范白皮书
> 本文档由 \`seal-use\` 单文件二进制程序内嵌提供,纯内存只读,未向用户电脑写入任何临时文件。
@@ -2519,14 +2407,14 @@ The direct local \`material-pack preview\` command and the tool-registry preview
| 目录名称 | 类别 | 规范路径 | 作用与生命周期 |
| :--- | :--- | :--- | :--- |
${Yr.map(($)=>`| **${$.name}** | \`${$.category}\` | \`${$.standardPath}\` | ${$.purpose} (${$.retention}) |`).join(`
${zr.map(($)=>`| **${$.name}** | \`${$.category}\` | \`${$.standardPath}\` | ${$.purpose} (${$.retention}) |`).join(`
`)}
---
## 3. 安全与数据隐私保证
${Ur.map(($,Y)=>`### 3.${Y+1} ${$.topic}
${Gr.map(($,Y)=>`### 3.${Y+1} ${$.topic}
- **安全承诺**:${$.guarantee}
- **实现约束**:${$.enforcement}
`).join(`
@@ -2536,7 +2424,7 @@ ${Ur.map(($,Y)=>`### 3.${Y+1} ${$.topic}
## 4. 业务域能力图谱
${Ir.map(($)=>`### \`seal-use ${$.domain}\`
${Hr.map(($)=>`### \`seal-use ${$.domain}\`
* **能力定位**:${$.summary}
* **核心命令**:${$.primaryCommands.map((Y)=>`\`seal-use ${Y}\``).join("、")}
`).join(`
@@ -2549,19 +2437,19 @@ ${Ir.map(($)=>`### \`seal-use ${$.domain}\`
- **环境自检**:运行 \`seal-use doctor\`,一键检查当前运行时版本、本地目录健康度、企业资产接入数量以及守护服务状态。
- **查看企业配置源文件**:运行 \`seal-use corps get <corpId>\`,可直接查看指定企业的本地 JSON 存储绝对路径。
- **查阅完整操作手册**:运行 \`seal-use doctor guide\` 随时在离线状态下查看本文档。
`}var Yr,Ur,Ir;var Qr=m(()=>{Yr=[{name:"配置与状态根目录",category:"config",standardPath:"~/.config/seal-use",purpose:"用户本地持久化配置根目录,存放企业连接元数据、会话缓存与全局状态。",accessMode:"read-write",retention:"persistent"},{name:"企业配置文件目录",category:"config",standardPath:"~/.config/seal-use/enterprises",purpose:"存放各已添加企业的配置 JSON 文件(如 xiezihao.json),存储企业域名、脱敏 Token、员工绑定关系等。",accessMode:"read-write",retention:"persistent"},{name:"全局配置文件",category:"config",standardPath:"~/.config/seal-use/config.json",purpose:"维护全局工作模式(stateful/stateless)、默认激活企业 defaultCorpId 以及 Lint 偏好。",accessMode:"read-write",retention:"persistent"},{name:"会话凭据安全缓存",category:"config",standardPath:"~/.config/seal-use/seal_tokens.json",purpose:"缓存已认证租户的 Bearer Token 与过期时间戳,避免高频调用上游 OAuth 换票接口。",accessMode:"read-write",retention:"cache"},{name:"规则版本映射快照",category:"config",standardPath:"~/.config/seal-use/mappings",purpose:"存储 corps sync-test 生成的生产与测试规则版本/编号对照映射快照,供 rules map 离线毫秒级速查。",accessMode:"read-write",retention:"persistent"},{name:"后台守护服务日志",category:"config",standardPath:"~/.config/seal-use/service.log",purpose:"常驻后台 HTTP 服务守护进程运行输出日志。",accessMode:"read-write",retention:"persistent"},{name:"全局命令行程序",category:"binary",standardPath:"/opt/homebrew/bin/seal-use",purpose:"macOS / Linux 全局独立单文件二进制程序;旧版 seal-home 命令仅保留解析兼容,不再新建全局别名。",accessMode:"executable",retention:"persistent"},{name:"AI Agent 技能主目录",category:"skill",standardPath:"~/.agents/skills/seal-use",purpose:"面向 Antigravity、Codex 等 AI 智能体的标准技能目录,包含 SKILL.md、参考文档与操作规程。",accessMode:"read-write",retention:"persistent"},{name:"报表默认导出目录",category:"export",standardPath:"~/Downloads",purpose:"执行 approval-runs export 等大盘报表命令且未指定 --out 时,默认写入的 Excel 文件路径。",accessMode:"read-write",retention:"persistent"},{name:"系统隔离临时目录",category:"temp",standardPath:"/tmp 或 /var/folders/.../T",purpose:"自动化测试(bun test)生成的隔离工作副本,执行完毕后通过 afterEach 钩子彻底删除,零残留。",accessMode:"transient",retention:"ephemeral"}],Ur=[{topic:"敏感凭据脱敏保护",guarantee:"appSecurity、password 等高危密钥永不回显在 stdout,Session Token 采用掩码处理(如 5oUL...Y%3D)。",enforcement:"CLI 所有展示接口(corps get、corps list、probe 等)均经 formatSafeSourceDetail 脱敏过滤。"},{topic:"正式环境与测试环境严格隔离",guarantee:"正式企业与测试企业必须严格 1 对 1 下挂,禁止多层级级联绑定;环境标记需显式 --confirm 确认。",enforcement:"corps bind-test 与 mark 强制要求 --confirm,缺少时阻断并返回退出码 10(confirmationRequired)。"},{topic:"跨环境规则同步安全基线",guarantee:"corps sync-test 仅将正式企业偏好与规则覆盖同步至测试企业并自动发布,正式企业规则严格维持草稿态永不发布。",enforcement:"规则同步流水线由 sync-test 独占受控,正式环境端仅执行拉取草稿读取操作,零发版变更。"},{topic:"只读诊断无副作用原则",guarantee:"doctor、search、get、list、context、probe 等命令为严格只读操作,不修改用户本地文件系统,零写入污染。",enforcement:"核心领域函数严格分离 Mutation 操作与 Query 操作,Query 路径杜绝写文件与环境篡改。"}],Ir=[{domain:"corps (企业管理)",summary:"多租户接入、智能软搜索、富属性查看、环境标记、测试绑定与配置规则同步",primaryCommands:["corps list","corps search <query>","corps get <corpId>","corps mark","corps bind-test","corps sync-test"]},{domain:"approval-runs (审核大盘)",summary:"AI 审核单据检索、统计分析、引证规则查看、附件全链路追踪、Excel 报表导出、单据直达链接与免登",primaryCommands:["approval-runs list","approval-runs stats","approval-runs get","approval-runs export","approval-runs link"]},{domain:"rules (规则治理)",summary:"审核规则拉取、本地 Lint 质量检查、增量差量推送、离线版本与编号对照映射速查",primaryCommands:["rules pull","rules lint","rules push","rules map","rules count"]},{domain:"preference (决策偏好)",summary:"AI 审核偏好读取与更新、全局与分品类思考深度策略(medium/high)配置",primaryCommands:["preference get","preference decision update","preference thinking-depth set"]},{domain:"simulation (模拟演练)",summary:"合 Line truncated
`)}var Vy0=m(()=>{Qp();K3();o$();lq();HP();Qr()});async function Ly0($,Y){let U=[],I=Y.environment==="test"?"test":"production",Q=I==="test"?Y.prodCorpId:Y.testCorpId,J=I==="test"?"prodParent":"testTarget",K=Q?I==="test"?"已绑定生产母企业 (上游配置与样本源)":"已绑定测试靶场 (下游隔离演练环境)":void 0,z=null,G=null;try{let F=await o6($);if(z=F.user,G=F.tenant,Boolean(z?.isAdmin||z?.permissions?.includes("*")))U.push({id:"auth_identity",name:"身份与权限契约",status:"pass",summary:`已认证为管理员「${z.name??"未知"}」(${z.id??""}),具备完整操作权限`,details:{userId:z.id,userName:z.name,isAdmin:!0,permissionLevel:"超级管理员(具备完整操作权限)",tenantName:G?.name,tenantSlug:G?.tenantSlug,permissions:z.permissions}});else U.push({id:"auth_identity",name:"身份与权限契约",status:"warn",summary:`已认证为普通用户「${z.name??"未知"}」,非超级管理员,部分配置操作可能受限`,details:{userId:z.id,userName:z.name,isAdmin:!1,permissionLevel:"普通用户(部分管理配置受限)",tenantName:G?.name,permissions:z.permissions},recommendation:"建议使用具有管理权限的企业主账号执行规则修改与集成发布"})}catch(F){U.push({id:"auth_identity",name:"身份与权限契约",status:"fail",summary:`鉴权握手失败:${F instanceof Error?F.message:String(F)}`,details:{error:String(F)},recommendation:`请执行 seal-use auth login --corp ${Y.id} 重新登录或更新 Token`})}let H={featureCode:"ai-approval",balance:0,deductionAmount:120,estimatedRuns:0,status:"exhausted"},W={used:0,remaining:0};try{let F=await rY($),N=Array.isArray(F.features)?F.features:[],O=N.find((P)=>P?.code==="ai-approval");if(O){let P=typeof O.balance==="number"?O.balance:0,T=typeof O.deductionAmount==="number"&&O.deductionAmount>0?O.deductionAmount:120,B=Math.floor(P/T);if(H.balance=P,H.deductionAmount=T,H.estimatedRuns=B,P<=0)H.status="exhausted",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"fail",summary:"当前额度已耗尽 (余量 0 点),无法执行审批模拟或回归测试",details:{balance:P,deductionAmount:T,estimatedRuns:B},recommendation:`请前往后台充值补充额度 (可通过 seal-use auth link --corp ${Y.id} 免密直达)`});else if(B<10)H.status="low",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`额度偏低:剩余 ${P} 点 (单笔扣除 ${T} 点),仅可支持约 ${B} 笔审核`,details:{balance:P,deductionAmount:T,estimatedRuns:B},recommendation:`建议补充额度 (可通过 seal-use auth link --corp ${Y.id} 免密直达)`});else H.status="sufficient",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"pass",summary:`额度充裕:剩余 ${P} 点,预估可支持 ${B} 笔审核单据`,details:{balance:P,deductionAmount:T,estimatedRuns:B}})}else U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:"未检索到「ai-approval」功能包额度明细,按默认通道运行",details:{features:N.map((P)=>P?.code)}});let D=N.find((P)=>P?.code==="approval-rules");if(D)W.used=typeof D.used==="number"?D.used:0,W.remaining=typeof D.remaining==="number"?D.remaining:0}catch(F){U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`读取计费状态失败:${F instanceof Error?F.message:String(F)}`,details:{error:String(F)}})}let X={totalCount:0,activeCount:0,quotaUsed:W.used,quotaRemaining:W.remaining};try{let F=await q6($),N=Array.isArray(F.rules)?F.rules:[];if(X.totalCount=N.length,X.activeCount=N.filter((O)=>O.status==="ACTIVE").length,N.length===0)U.push({id:"rules_status",name:"审核规则状态",status:"warn",summary:"当前租户未配置任何审核规则 (规则数为 0)",details:{totalCount:0,activeCount:0},recommendation:I==="test"&&Q?`可运行 seal-use corps sync-test --corp ${Q} 从生产企业同步规则`:"可运行 seal-use rules add 创建基础规则"});else U.push({id:"rules_status",name:"审核规则状态",status:"pass",summary:`审核规则健康:共 ${X.totalCount} 条规则,其中生效活跃 ${X.activeCount} 条`,details:{totalCount:X.totalCount,activeCount:X.activeCount,quotaUsed:W.used,quotaRemaining:W.remaining}})}catch(F){U.push({id:"rules_status",name:"审核规则状态",status:"fail",summary:`拉取规则列表失败:${F instanceof Error?F.message:String(F)}`,details:{error:String(F)}})}let Z={integrationCount:0,hasReplayChannel:!1,activeWebhookId:void 0};try{let F=await q$($);Z.integrationCount=F.length;let N=F.find((O)=>O.name.includes("回放")||O.name.toLowerCase().includes("replay"));if(Z.hasReplayChannel=Boolean(N),Z.activeWebhookId=N?.id??F[0]?.id,F.length===0)U.push({id:"webhook_integrations",name:"单据推送 Webhook 通道",status:"pass",summary:"未配置任何 Webhook 集成通道 (日常审批无影响;若需自动化系统推流或单据重放将自动创建)",details:{integrationCount:0}});else U.push({id:"webhook_integrations",nam Line truncated
`)}var wy0=m(()=>{W4()});var My0={};Z8(My0,{formatTenantDoctorDashboard:()=>Fy0,diagnoseTenantContract:()=>Ly0});var Oy0=m(()=>{wy0()});async function Ny0($,Y,U){let I=($??Y??"").toLowerCase();if(I==="guide"||I==="doc"||I==="knowledge"||I==="book"){console.error(`\uD83D\uDCD6 [Seal Use Doctor] 正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(Hy0());return}if(I==="paths"||I==="dirs"||I==="directories"){let K=Jr();j0(K.directories);return}if(I==="auth"){let{selectCorp:K}=await Promise.resolve().then(() => (O4(),Fo)),{stringOption:z}=await Promise.resolve().then(() => (q4(),qo)),{handleAuthCommand:G}=await Promise.resolve().then(() => (io(),$g0)),H=z(U.options.corp)??(Y&&Y!==I?Y:void 0)??(U.command[2]&&U.command[2]!==I?U.command[2]:void 0),W=K(H);await G("check",W,U);return}if(I==="tenant"||I==="corp"||I==="enterprise"){let{selectCorp:K}=await Promise.resolve().then(() => (O4(),Fo)),{createSealClient:z}=await Promise.resolve().then(() => (f6(),P10)),{stringOption:G}=await Promise.resolve().then(() => (q4(),qo)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (Oy0(),My0)),X=G(U.options.corp)??(Y&&Y!==I?Y:void 0)??(U.command[2]&&U.command[2]!==I?U.command[2]:void 0),Z=K(X),q=await z(Z),V=await H(q,Z);if(!(G0(U.options.quiet)||G0(U.options.silent)))console.error(W(V));j0(V);return}let Q=Jr();if(!(G0(U.options.quiet)||G0(U.options.silent)))console.error(qy0(Q));j0(Q)}var Dy0=m(()=>{Vy0();Qr();q4();o1()});var Ay0;var By0=m(()=>{Ay0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.38",description:"HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-use http`, or the `seal-use service start` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n"},servers:[{url:"http://localhost:8787",description:"Local HTTP adapter (`seal-use http`, or the `seal-use service start` daemon). Loopback-only by default."}],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","x-implementation-status":"implemented",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","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp","x-implementation-status":"planned",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","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp","x-implementation-status":"planned",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","x-implementation-status":"planned",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 i Line truncated
`}var zr,Gr,Hr;var Wr=m(()=>{zr=[{name:"配置与状态根目录",category:"config",standardPath:"~/.config/seal-use",purpose:"用户本地持久化配置根目录,存放企业连接元数据、会话缓存与全局状态。",accessMode:"read-write",retention:"persistent"},{name:"企业配置文件目录",category:"config",standardPath:"~/.config/seal-use/enterprises",purpose:"存放各已添加企业的配置 JSON 文件(如 xiezihao.json),存储企业域名、脱敏 Token、员工绑定关系等。",accessMode:"read-write",retention:"persistent"},{name:"全局配置文件",category:"config",standardPath:"~/.config/seal-use/config.json",purpose:"维护全局工作模式(stateful/stateless)、默认激活企业 defaultCorpId 以及 Lint 偏好。",accessMode:"read-write",retention:"persistent"},{name:"会话凭据安全缓存",category:"config",standardPath:"~/.config/seal-use/seal_tokens.json",purpose:"缓存已认证租户的 Bearer Token 与过期时间戳,避免高频调用上游 OAuth 换票接口。",accessMode:"read-write",retention:"cache"},{name:"规则版本映射快照",category:"config",standardPath:"~/.config/seal-use/mappings",purpose:"存储 corps sync-test 生成的生产与测试规则版本/编号对照映射快照,供 rules map 离线毫秒级速查。",accessMode:"read-write",retention:"persistent"},{name:"后台守护服务日志",category:"config",standardPath:"~/.config/seal-use/service.log",purpose:"常驻后台 HTTP 服务守护进程运行输出日志。",accessMode:"read-write",retention:"persistent"},{name:"全局命令行程序",category:"binary",standardPath:"/opt/homebrew/bin/seal-use",purpose:"macOS / Linux 全局独立单文件二进制程序;旧版 seal-home 命令仅保留解析兼容,不再新建全局别名。",accessMode:"executable",retention:"persistent"},{name:"AI Agent 技能主目录",category:"skill",standardPath:"~/.agents/skills/seal-use",purpose:"面向 Antigravity、Codex 等 AI 智能体的标准技能目录,包含 SKILL.md、参考文档与操作规程。",accessMode:"read-write",retention:"persistent"},{name:"报表默认导出目录",category:"export",standardPath:"~/Downloads",purpose:"执行 approval-runs export 等大盘报表命令且未指定 --out 时,默认写入的 Excel 文件路径。",accessMode:"read-write",retention:"persistent"},{name:"系统隔离临时目录",category:"temp",standardPath:"/tmp 或 /var/folders/.../T",purpose:"自动化测试(bun test)生成的隔离工作副本,执行完毕后通过 afterEach 钩子彻底删除,零残留。",accessMode:"transient",retention:"ephemeral"}],Gr=[{topic:"敏感凭据脱敏保护",guarantee:"appSecurity、password 等高危密钥永不回显在 stdout,Session Token 采用掩码处理(如 5oUL...Y%3D)。",enforcement:"CLI 所有展示接口(corps get、corps list、probe 等)均经 formatSafeSourceDetail 脱敏过滤。"},{topic:"正式环境与测试环境严格隔离",guarantee:"正式企业与测试企业必须严格 1 对 1 下挂,禁止多层级级联绑定;环境标记需显式 --confirm 确认。",enforcement:"corps bind-test 与 mark 强制要求 --confirm,缺少时阻断并返回退出码 10(confirmationRequired)。"},{topic:"跨环境规则同步安全基线",guarantee:"corps sync-test 仅将正式企业偏好与规则覆盖同步至测试企业并自动发布,正式企业规则严格维持草稿态永不发布。",enforcement:"规则同步流水线由 sync-test 独占受控,正式环境端仅执行拉取草稿读取操作,零发版变更。"},{topic:"只读诊断无副作用原则",guarantee:"doctor、search、get、list、context、probe 等命令为严格只读操作,不修改用户本地文件系统,零写入污染。",enforcement:"核心领域函数严格分离 Mutation 操作与 Query 操作,Query 路径杜绝写文件与环境篡改。"}],Hr=[{domain:"corps (企业管理)",summary:"多租户接入、智能软搜索、富属性查看、环境标记、测试绑定与配置规则同步",primaryCommands:["corps list","corps search <query>","corps get <corpId>","corps mark","corps bind-test","corps sync-test"]},{domain:"approval-runs (审核大盘)",summary:"AI 审核单据检索、统计分析、引证规则查看、附件全链路追踪、Excel 报表导出、单据直达链接与免登",primaryCommands:["approval-runs list","approval-runs stats","approval-runs get","approval-runs export","approval-runs link"]},{domain:"rules (规则治理)",summary:"审核规则拉取、本地 Lint 质量检查、增量差量推送、离线版本与编号对照映射速查",primaryCommands:["rules pull","rules lint","rules push","rules map","rules count"]},{domain:"preference (决策偏好)",summary:"AI 审核偏好读取与更新、全局与分品类思考深度策略(medium/high)配置",primaryCommands:["preference get","preference decision update","preference thinking-depth set"]},{domain:"simulation (模拟演练)",summary:"合 Line truncated
`)}var My0=m(()=>{Kp();z3();r$();sq();ZP();Wr()});async function Oy0($,Y){let U=[],I=Y.environment==="test"?"test":"production",Q=I==="test"?Y.prodCorpId:Y.testCorpId,J=I==="test"?"prodParent":"testTarget",K=Q?I==="test"?"已绑定生产母企业 (上游配置与样本源)":"已绑定测试靶场 (下游隔离演练环境)":void 0,z=null,G=null;try{let F=await s6($);if(z=F.user,G=F.tenant,Boolean(z?.isAdmin||z?.permissions?.includes("*")))U.push({id:"auth_identity",name:"身份与权限契约",status:"pass",summary:`已认证为管理员「${z.name??"未知"}」(${z.id??""}),具备完整操作权限`,details:{userId:z.id,userName:z.name,isAdmin:!0,permissionLevel:"超级管理员(具备完整操作权限)",tenantName:G?.name,tenantSlug:G?.tenantSlug,permissions:z.permissions}});else U.push({id:"auth_identity",name:"身份与权限契约",status:"warn",summary:`已认证为普通用户「${z.name??"未知"}」,非超级管理员,部分配置操作可能受限`,details:{userId:z.id,userName:z.name,isAdmin:!1,permissionLevel:"普通用户(部分管理配置受限)",tenantName:G?.name,permissions:z.permissions},recommendation:"建议使用具有管理权限的企业主账号执行规则修改与集成发布"})}catch(F){U.push({id:"auth_identity",name:"身份与权限契约",status:"fail",summary:`鉴权握手失败:${F instanceof Error?F.message:String(F)}`,details:{error:String(F)},recommendation:`请执行 seal-use auth login --corp ${Y.id} 重新登录或更新 Token`})}let H={featureCode:"ai-approval",balance:0,deductionAmount:120,estimatedRuns:0,status:"exhausted"},W={used:0,remaining:0};try{let F=await $U($),N=Array.isArray(F.features)?F.features:[],O=N.find((P)=>P?.code==="ai-approval");if(O){let P=typeof O.balance==="number"?O.balance:0,T=typeof O.deductionAmount==="number"&&O.deductionAmount>0?O.deductionAmount:120,B=Math.floor(P/T);if(H.balance=P,H.deductionAmount=T,H.estimatedRuns=B,P<=0)H.status="exhausted",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"fail",summary:"当前额度已耗尽 (余量 0 点),无法执行审批模拟或回归测试",details:{balance:P,deductionAmount:T,estimatedRuns:B},recommendation:`请前往后台充值补充额度 (可通过 seal-use auth link --corp ${Y.id} 免密直达)`});else if(B<10)H.status="low",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`额度偏低:剩余 ${P} 点 (单笔扣除 ${T} 点),仅可支持约 ${B} 笔审核`,details:{balance:P,deductionAmount:T,estimatedRuns:B},recommendation:`建议补充额度 (可通过 seal-use auth link --corp ${Y.id} 免密直达)`});else H.status="sufficient",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"pass",summary:`额度充裕:剩余 ${P} 点,预估可支持 ${B} 笔审核单据`,details:{balance:P,deductionAmount:T,estimatedRuns:B}})}else U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:"未检索到「ai-approval」功能包额度明细,按默认通道运行",details:{features:N.map((P)=>P?.code)}});let D=N.find((P)=>P?.code==="approval-rules");if(D)W.used=typeof D.used==="number"?D.used:0,W.remaining=typeof D.remaining==="number"?D.remaining:0}catch(F){U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`读取计费状态失败:${F instanceof Error?F.message:String(F)}`,details:{error:String(F)}})}let X={totalCount:0,activeCount:0,quotaUsed:W.used,quotaRemaining:W.remaining};try{let F=await U6($),N=Array.isArray(F.rules)?F.rules:[];if(X.totalCount=N.length,X.activeCount=N.filter((O)=>O.status==="ACTIVE").length,N.length===0)U.push({id:"rules_status",name:"审核规则状态",status:"warn",summary:"当前租户未配置任何审核规则 (规则数为 0)",details:{totalCount:0,activeCount:0},recommendation:I==="test"&&Q?`可运行 seal-use corps sync-test --corp ${Q} 从生产企业同步规则`:"可运行 seal-use rules add 创建基础规则"});else U.push({id:"rules_status",name:"审核规则状态",status:"pass",summary:`审核规则健康:共 ${X.totalCount} 条规则,其中生效活跃 ${X.activeCount} 条`,details:{totalCount:X.totalCount,activeCount:X.activeCount,quotaUsed:W.used,quotaRemaining:W.remaining}})}catch(F){U.push({id:"rules_status",name:"审核规则状态",status:"fail",summary:`拉取规则列表失败:${F instanceof Error?F.message:String(F)}`,details:{error:String(F)}})}let Z={integrationCount:0,hasReplayChannel:!1,activeWebhookId:void 0};try{let F=await V$($);Z.integrationCount=F.length;let N=F.find((O)=>O.name.includes("回放")||O.name.toLowerCase().includes("replay"));if(Z.hasReplayChannel=Boolean(N),Z.activeWebhookId=N?.id??F[0]?.id,F.length===0)U.push({id:"webhook_integrations",name:"单据推送 Webhook 通道",status:"pass",summary:"未配置任何 Webhook 集成通道 (日常审批无影响;若需自动化系统推流或单据重放将自动创建)",details:{integrationCount:0}});else U.push({id:"webhook_integrations",nam Line truncated
`)}var Dy0=m(()=>{W4()});var By0={};V8(By0,{formatTenantDoctorDashboard:()=>Ny0,diagnoseTenantContract:()=>Oy0});var Ay0=m(()=>{Dy0()});async function Py0($,Y,U){let I=($??Y??"").toLowerCase();if(I==="guide"||I==="doc"||I==="knowledge"||I==="book"){console.error(`\uD83D\uDCD6 [Seal Use Doctor] 正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(qy0());return}if(I==="paths"||I==="dirs"||I==="directories"){let K=Xr();j0(K.directories);return}if(I==="auth"){let{selectCorp:K}=await Promise.resolve().then(() => (N4(),Do)),{stringOption:z}=await Promise.resolve().then(() => (V4(),Mo)),{handleAuthCommand:G}=await Promise.resolve().then(() => (oo(),Qg0)),H=z(U.options.corp)??(Y&&Y!==I?Y:void 0)??(U.command[2]&&U.command[2]!==I?U.command[2]:void 0),W=K(H);await G("check",W,U);return}if(I==="tenant"||I==="corp"||I==="enterprise"){let{selectCorp:K}=await Promise.resolve().then(() => (N4(),Do)),{createSealClient:z}=await Promise.resolve().then(() => (b6(),_10)),{stringOption:G}=await Promise.resolve().then(() => (V4(),Mo)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (Ay0(),By0)),X=G(U.options.corp)??(Y&&Y!==I?Y:void 0)??(U.command[2]&&U.command[2]!==I?U.command[2]:void 0),Z=K(X),q=await z(Z),V=await H(q,Z);if(!(z0(U.options.quiet)||z0(U.options.silent)))console.error(W(V));j0(V);return}let Q=Xr();if(!(z0(U.options.quiet)||z0(U.options.silent)))console.error(wy0(Q));j0(Q)}var Ty0=m(()=>{My0();Wr();V4();e1()});import{readFileSync as bx1}from"node:fs";function Ey0($,Y){let U=R($.options.contentFile)??R($.options["content-file"])??R($.options.file)??R($.options.f);if(U)return bx1(U,"utf8");let I=R($.options.content);if(I!==void 0)return I;return typeof Y.content==="string"?Y.content:void 0}async function jy0($,Y,U,I,Q){if(!$||$==="list"){let J=k4(Q.options.scenarios),K=l0(Q.options.limit),z=l0(Q.options.offset);await R0("seal_approval_documents_list",U,I,{scenarios:J,limit:K,offset:z},T0(Q.options));return}if($==="get"){let J=(Y&&!Y.startsWith("-")?Y:void 0)??R(Q.options.documentId)??R(Q.options["document-id"])??R(Q.options.id);if(!J)throw Error("Usage: seal-use documents get <documentId> [--corp <corpId>]");await R0("seal_approval_document_get",U,I,{documentId:J},T0(Q.options));return}if($==="search"){let J=Y??R(Q.options.query);if(!J)throw Error("Usage: seal-use documents search <keyword> [--maxResults 20] [--corp <corpId>]");await R0("seal_approval_search",U,I,{keywords:[J],areas:["documents"],maxResults:l0(Q.options.maxResults),contextLines:l0(Q.options.contextLines),refresh:z0(Q.options.refresh),snippetOnly:z0(Q.options.snippetOnly)??z0(Q.options["snippet-only"]),maxChars:l0(Q.options.maxChars)??l0(Q.options["max-chars"]),fields:k4(Q.options.fields)},T0(Q.options));return}if($==="create"){let J=L6(Q.json),K=R(Q.options.title)??(typeof J.title==="string"?J.title:void 0),z=R(Q.options.purpose)??(typeof J.purpose==="string"?J.purpose:void 0),G=Ey0(Q,J),H=R(Q.options.type)??R(Q.options.contentType)??R(Q.options["content-type"])??(typeof J.contentType==="string"?J.contentType:"policy"),W=R(Q.options.status)??(typeof J.status==="string"?J.status:"published"),X=z0(Q.options.enabled)??(typeof J.enabled==="boolean"?J.enabled:void 0),Z=k4(Q.options.scenarios)??(Array.isArray(J.scenarios)?J.scenarios:["audit"]),q=k4(Q.options.tags)??(Array.isArray(J.tags)?J.tags:void 0);if(!K||!z||G===void 0)throw Error("Usage: seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]");await R0("seal_approval_document_create",U,I,{title:K,purpose:z,content:G,contentType:H,status:W,enabled:X,scenarios:Z,tags:q},T0(Q.options));return}if($==="update"){let J=L6(Q.json),K=(Y&&!Y.startsWith("-")?Y:void 0)??R(Q.options.documentId)??R(Q.options["document-id"])??R(Q.options.id)??(typeof J.documentId==="string"?J.documentId:void 0),z=R(Q.options.title)??(typeof J.title==="string"?J.title:void 0),G=R(Q.options.purpose)??(typeof J.purpose==="string"?J.purpose:void 0),H=Ey0(Q,J),W=R(Q.options.type)??R(Q.options.contentType)??R(Q.options["content-type"])??(typeof J.contentType==="string"?J.contentType:void 0),X=R(Q.options.status)??(typeof J.status==="string"?J.status:void 0),Z=z0(Q.options.enabled)??(typeof J.enabled==="boolean"?J.enabled:void 0),q=k4(Q.options.scenarios)??(Array.isArray(J.scenarios)?J.scenarios:void 0),V=k4(Q.options.tags)??(Array.isArray(J.tags)?J.tags:void 0);if(!K||!(z!==void 0||G!==void 0||H!==void 0||W!==void 0||X!==void 0||Z!==void 0||q!==void 0||V!==void 0))throw Error("Usage: seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]");await R0("seal_approval_document_update",U,I,{documentId:K,title:z,purpose:G,content:H,contentType:W,status:X,enabled:Z,scenarios:q,tags:V},T0(Q.options));return}if($==="delete"){let J=(Y&&!Y.startsWith("-")?Y:void 0)??R(Q.options.documentId)??R(Q.options["document-id"])??R(Q.options.id);if(!J)throw Error("Usage: seal-use documents delete <documentId> --yes [--corp <co Line truncated
the credentials already stored on this machine for the selected enterprise. Keep it bound
to loopback (\`--host 127.0.0.1\`) and do not expose the port to a network or an origin you
do not control.
`}},parameters:{CorpId:{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."},Offset:{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},Limit:{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},RuleId:{name:"ruleId",in:"path",required:!0,schema:{type:"string"},description:"Approval rule ID."},VersionId:{name:"versionId",in:"path",required:!0,schema:{type:"string"},description:"Published rule version ID."},DocumentId:{name:"documentId",in:"path",required:!0,schema:{type:"string"},description:"Approval knowledge document ID."},RecordId:{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-use approval run record ID."},BatchId:{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}},responses:{BadRequest:{description:"Invalid request.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},Unauthorized:{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:{}}}}}},NotFound:{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}},schemas:{ErrorResponse:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}},CorpSummary:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","seal"]},current:{type:"boolean"}}},SwitchCorpRequest:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}},SwitchCorpResponse:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}},SourceConfig:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."},AuthStage:{type:"object",additionalProperties:!0,required:["name","ok"],properties:{name:{type:"string",examples:["hose.openapi","hose.provisional","seal.sso","seal.whoami"]},ok:{type:"boolean"},error:{type:"string"}}},AuthDiagnosis:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}},SealUser:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},tenantId:{type:"string"},name:{type:"string"},isAdmin:{type:"boolean"},permissions:{type:"array",items:{type:"string"}}}},SealTenant:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},name:{type:"string"},tenantSlug:{type:"string"}}},WhoamiResponse:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}},SessionResponse:{type:"object",additionalProperties:!0,required:["user","session"],properties:{user:{$ref:"#/components/schemas/SealUser"},session:{type:"object",additionalProperties:!0}}},ApprovalRule:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}},ApprovalRuleInput:{type:"object",required:["description","scope","strictness"],properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulePatch:{type:"object",additionalProperties:!1,properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulesResponse:{type:"object",required:["rules"],properties:{rules:{type:"array",items:{$ref:"#/components/schemas/ApprovalRule"}},hasPendingDeletes:{type:"boolean"}}},RuleSetVersion:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}},PublishRuleVersionRequest:{type:"object",required:["versionName"],properties:{versionName:{type:"string"}}},ApprovalDocument:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},title:{typ Line truncated
`}},parameters:{CorpId:{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."},Offset:{name:"offset",in:"query",schema:{type:"integer",minimum:0,default:0},description:"Zero-based pagination offset."},Limit:{name:"limit",in:"query",schema:{type:"integer",minimum:1,maximum:100,default:50},description:"Maximum number of records to return."},RuleId:{name:"ruleId",in:"path",required:!0,schema:{type:"string"},description:"Approval rule ID."},VersionId:{name:"versionId",in:"path",required:!0,schema:{type:"string"},description:"Published rule version ID."},DocumentId:{name:"documentId",in:"path",required:!0,schema:{type:"string"},description:"Approval knowledge document ID."},RecordId:{name:"recordId",in:"path",required:!0,schema:{type:"string"},description:"seal-use approval run record ID."},BatchId:{name:"batchId",in:"path",required:!0,schema:{type:"string"},description:"Simulation batch ID."}},responses:{BadRequest:{description:"Invalid request.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}},Unauthorized:{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:{}}}}}},NotFound:{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}},schemas:{ErrorResponse:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}},CorpSummary:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","seal"]},current:{type:"boolean"}}},SwitchCorpRequest:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}},SwitchCorpResponse:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}},SourceConfig:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."},AuthStage:{type:"object",additionalProperties:!0,required:["name","ok"],properties:{name:{type:"string",examples:["hose.openapi","hose.provisional","seal.sso","seal.whoami"]},ok:{type:"boolean"},error:{type:"string"}}},AuthDiagnosis:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}},SealUser:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},tenantId:{type:"string"},name:{type:"string"},isAdmin:{type:"boolean"},permissions:{type:"array",items:{type:"string"}}}},SealTenant:{type:"object",additionalProperties:!0,required:["id","name"],properties:{id:{type:"string"},name:{type:"string"},tenantSlug:{type:"string"}}},WhoamiResponse:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}},SessionResponse:{type:"object",additionalProperties:!0,required:["user","session"],properties:{user:{$ref:"#/components/schemas/SealUser"},session:{type:"object",additionalProperties:!0}}},ApprovalRule:{type:"object",additionalProperties:!0,required:["id","description","scope","strictness"],properties:{id:{type:"string"},description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]},status:{type:"string"}}},ApprovalRuleInput:{type:"object",required:["description","scope","strictness"],properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulePatch:{type:"object",additionalProperties:!1,properties:{description:{type:"string"},scope:{type:"string"},strictness:{type:"string",enum:["MUST_FOLLOW","SHOULD_FOLLOW","SUGGESTION"]}}},ApprovalRulesResponse:{type:"object",required:["rules"],properties:{rules:{type:"array",items:{$ref:"#/components/schemas/ApprovalRule"}},hasPendingDeletes:{type:"boolean"}}},RuleSetVersion:{type:"object",additionalProperties:!0,required:["id","versionNumber","versionName","rules"],properties:{id:{type:"string"},versionNumber:{type:"integer"},versionName:{type:"string"},publishedByName:{type:"string"},rules:{type:"array",items:{type:"object",additionalProperties:!0}}}},PublishRuleVersionRequest:{type:"object",required:["versionName"],properties:{versionName:{type:"string"}}},ApprovalDocument:{type:"object",additionalProperties:!0,required:["id","title","content"],properties:{id:{type:"string"},title:{typ 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${X1})</title>
<title>Seal Home API Docs (v${Z1})</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 {
@@ -2580,23 +2468,23 @@ do not control.
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.101/dist/browser/standalone.js"
></script>
</body>
</html>`}var Ey0=m(()=>{K3()});import{URL as xx1}from"node:url";async function g6($,Y,U,I){let Q=$.handler;return Q(Y,U,{corp:I})}async function jy0($,Y){if(Y.setHeader("Access-Control-Allow-Origin","*"),Y.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS, PATCH"),Y.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, X-Seal-Corp, X-Seal-Home-Session"),$.method==="OPTIONS"){Y.writeHead(204),Y.end();return}let U=$.headers.host||"localhost",I=$.headers["x-forwarded-proto"]||"http",Q=new xx1($.url||"/",`${I}://${U}`),J=Q.pathname.replace(/\/+$/,"")||"/",K=($.method||"GET").toUpperCase();try{if(K==="GET"&&J==="/"){T4(Y,200,{name:"seal-use",version:X1,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"&&J==="/docs"){ux1(Y,200,Ty0());return}if(K==="GET"&&J==="/openapi.json"){T4(Y,200,HE());return}if(K==="GET"&&J==="/health"){T4(Y,200,{status:"ok",version:X1,name:"seal-use",timestamp:new Date().toISOString()});return}if(K==="POST"&&(J==="/shutdown"||J==="/api/shutdown")){T4(Y,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(K==="POST"&&J==="/api/cli"){let z=await XE($),G=(typeof z?.command==="string"?z.command:"").trim();if(!G){WE(Y,400,"Missing 'command' property in request body");return}let H=oq(G),W=H[0]==="seal-use"||H[0]==="seal-home"||H[0]?.endsWith("/seal-use")||H[0]?.endsWith("/seal-home")?H.slice(1):H,X=await rq(W),Z=void 0;try{if(X.stdout.trim().startsWith("{")||X.stdout.trim().startsWith("["))Z=JSON.parse(X.stdout)}catch{}T4(Y,X.isError?400:200,{success:!X.isError,stdout:X.stdout,stderr:X.stderr,exitCode:X.exitCode,data:Z});return}if(K==="POST"&&J.startsWith("/api/tool/")){let z=J.slice(10).trim(),G=N6(z);if(!G){WE(Y,404,`Tool not found: '${z}'`);return}let H=await XE($)||{},W=n8($,Q,H),X=M1(W),Z=await A1(X),q={...H};delete q.corp;let V=await g6(G,Z,q,X);T4(Y,200,V);return}if(J.startsWith("/v1/")){if(await fx1($,Y,K,J,Q))return}WE(Y,404,`Cannot ${K} ${J}. Visit /docs for available endpoints.`)}catch(z){let G=z instanceof Error?z.message:String(z);WE(Y,500,G)}}async function fx1($,Y,U,I,Q){let J=Object.fromEntries(Q.searchParams.entries());if(U==="GET"&&I==="/v1/corps"){let K=I$(),z=A4();return T4(Y,200,{count:K.length,mode:z.stateful?"stateful":"stateless",defaultCorpId:z.defaultCorpId,corps:K.map((G)=>({id:G.id,name:G.name,sourceType:G.source.type,sealUrl:G.seal?.url}))}),!0}if(U==="GET"&&I==="/v1/whoami"){let K=n8($,Q,J),z=M1(K),G=await A1(z),H=N6("seal_whoami"),W=await g6(H,G,{},z);return T4(Y,200,W),!0}if(U==="GET"&&I==="/v1/session"){let K=n8($,Q,J),z=M1(K),G=await A1(z),H=N6("seal_session_get"),W=await g6(H,G,{},z);return T4(Y,200,W),!0}if(U==="GET"&&I==="/v1/approval-runs/summary"){let K=n8($,Q,J),z=M1(K),G=await A1(z),H=N6("seal_approval_runs_summary"),W=await g6(H,G,J,z);return T4(Y,200,W),!0}if(U==="GET"&&I==="/v1/approval-runs/stats"){let K=n8($,Q,J),z=M1(K),G=await A1(z),H=N6("seal_approval_runs_stats"),W=await g6(H,G,J,z);return T4(Y,200,W),!0}if(U==="GET"&&I==="/v1/approval-runs/pick"){let K=n8($,Q,J),z=M1(K),G=await A1(z),H=N6("seal_approval_run_pick"),W=await g6(H,G,J,z);return T4(Y,200,W),!0}if(U==="GET"&&I==="/v1/approval-runs/url"){let K=n8($,Q,J),z=M1(K),G=await A1(z),H=N6("seal_approval_run_url_get"),W=await g6(H,G,J,z);return T4(Y,200,W),!0}if(I.startsWith("/v1/approval-runs/")){let K=I.slice(18).split("/"),z=K[0],G=K[1];if(z&&!["summary","pick","stats","url","bridge"].includes(z)){let H=n8($,Q,J),W=M1(H),X=await A1(W);if(!G){let Z=N6("seal_approval_run_get"),q=await g6(Z,X,{recordId:z,...J},W);return T4(Y,200,q),!0}if(G==="attachments"){let Z=N6("seal_approval_run_attachments_get"),q=await g6(Z,X,{recordId:z,...J},W);return T4(Y,200,q),!0}if(G==="cited-rules"){let Z=N6("seal_approval_run_cited_rules_get"),q=await g6(Z,X,{recordId:z,...J},W);return T4(Y,200,q),!0}if(G==="document-summary"){let Z=N6("seal_approval_run_document_summary_get"),q=await g6(Z,X,{recordId:z,...J},W);return T4(Y,200,q),!0}if(G==="result"){let Z=N6("seal_approval_run_result_get"),q=await g6(Z,X,{recordId:z,...J},W);return T4(Y,200,q),!0}}}if(U==="GET"&&I==="/v1/approval-runs"){let K=n8($,Q,J),z=M1(K),G=await A1(z),H=N6("seal_approval_runs_search"),W=await g6(H,G,{...J,limit:J.limit?Number(J.limit):void 0,offset:J.offset?Number(J.offset):void 0,includeBridge:J.includeBridge==="true"},z);return T4(Y,200,W),!0}if(U==="GET"&&I==="/v1/approval/rules"){let K=n8($,Q,J),z=M1(K),G=await A1(z),H=N6("seal_approval_rules_list"),W=await g6(H,G,J,z);return T4(Y,200,W),!0}if(U==="GET"&&I==="/v1/simulation/batches"){let K=n8($,Q,J),z=M1(K),G=await A1(z),H=N6("seal_simulation_batches_list"),W=await g6(H,G,J,z);return T4(Y,200,W),!0}if(U==="POST"&&I==="/v1/simulation/create-batchLine truncated
\uD83D\uDE80 seal-use HTTP Server (v${X1}) started`),console.error(` URL: http://${U}:${Y}`),console.error(` Docs: http://${U}:${Y}/docs`),console.error(` OpenAPI: http://${U}:${Y}/openapi.json`),console.error(` CLI Exec: POST http://${U}:${Y}/api/cli`),console.error(` REST API: http://${U}:${Y}/v1/...
`);Q(I)})})}var ZE=8787,qE="127.0.0.1";var Gr=m(()=>{Cy0();K3()});async function Ry0($){let Y=s0($.options.port)??s0($.options.p),U=h($.options.host)??h($.options.h),I=await VE({port:Y,host:U}),Q=()=>{I.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var _y0=m(()=>{q4();Gr()});async function vy0($,Y,U,I){if($==="config"||$==="get"){await x0("seal_llm_config_get",Y,U,{},T0(I.options));return}if($==="providers"||$==="list"){await x0("seal_llm_providers_list",Y,U,{},T0(I.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}var Sy0=m(()=>{O4();o1()});async function hy0($,Y){if($==="config"||$==="json"){Hr();return}let{startServer:U}=await ky0().then(() => yy0);U()}function Hr(){j0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var gy0=m(()=>{o1()});function xy0($){let Y=HE();j0(Y,{...T0($.options),allowFull:!0})}var fy0=m(()=>{Kr();o1()});async function uy0($,Y,U,I){if($==="available"){await x0("seal_permissions_available_list",Y,U,{},T0(I.options));return}if($==="configs"||$==="list"){await x0("seal_permissions_configs_list",Y,U,{},T0(I.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}var by0=m(()=>{O4();o1()});import{readFileSync as iy0}from"node:fs";async function cy0($,Y,U,I,Q,J,K){if(!$||$==="get"){await x0("seal_preference_get",Q,J,{},T0(K.options));return}if($==="decision"){if(Y==="update"||!Y){let z=h(K.options.input),G=z?JSON.parse(iy0(z,"utf8")):E8(K.json);if(!G||Object.keys(G).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await x0("seal_preference_decision_update",Q,J,{...G,dryRun:G0(K.options.dryRun)??G0(K.options["dry-run"])},T0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let z=h(K.options.default)??h(K.options.level)??I;if(z!=="medium"&&z!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await x0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:z,dryRun:G0(K.options.dryRun)??G0(K.options["dry-run"])},T0(K.options));return}if(Y==="policies"){if(U==="list"||!U){await x0("seal_preference_thinking_depth_policies_list",Q,J,{},T0(K.options));return}if(U==="upsert"){let z=h(K.options.input),G=z?JSON.parse(iy0(z,"utf8")):E8(K.json);if(!G||!G.id||!G.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await x0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:G0(K.options.dryRun)??G0(K.options["dry-run"])},T0(K.options));return}if(U==="remove"||U==="delete"){let z=I??h(K.options.id)??h(K.options.policyId);if(!z)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await x0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:z,dryRun:G0(K.options.dryRun)??G0(K.options["dry-run"])},T0(K.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}var ny0=m(()=>{O4();q4();o1()});async function dy0($={}){let Y=I$(),U=A4(),I=p2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},c3());console.log(`[probe] corp=${I.id} source=${I.source.type}`);let Q=await dz(I);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await A1(I),K=await uM(J,{documentLimit:20,stylePreferencesEndpoint:I.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))}var py0=m(()=>{o$();f6();pT();W4()});async function my0($,Y,U){let I=Y??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await dy0({corpId:I})}var ly0=m(()=>{py0();q4()});async function Wr($,Y,U,I,Q){if(!U&&!($==="lint"||$==="linters"||$==="linter-list"||$==="map"))throw Error(`rules ${$??""} requires an authenticated enterprise. Run 'seal-use corps list' to select one.`);if($==="count"){await x0("seal_approval_rules_list",U,I,{countOnly:!0},T0(Q.options));return}if($==="list"){if(G0(Q.options.count)){await x0("seal_approval_rules_list",U,I,{countOnly:!0},T0(Q.options));return}let K=s0(Q.options.limit),z=s0(Q.options.offset);if(G0(Q.options.summary)){await x0("seal_approval_rules_list",U,I,{fields:pv0,limit:K,offset:z},T0(Q.options));return}let G=await T$("seal_approval_rules_list",U,I,{limit:K,offset:z}),H=T0(Q.options);mv0(G,H.allowFull===!0||Boolean(H.outputFile)),j0(G,H);return}if($==="clear"){let K=G0(Q.options.yes)===!0,z=G0(Q.options.dryRun)??G0(Q.options["dry-run"])??!K;if(!K&&!z)throw u8("Refusing to clear rules without --ye Line truncated
`).filter(Boolean),J=Q.slice(-Y);return{logFile:U,lines:J,totalLines:Q.length}}async function px1($){let Y=ME($),U=qr($),I=sq($);ty0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):ZE),J=$.host??(process.env.HOST?process.env.HOST:qE);FE(Y,`${process.pid}
`,{mode:384}),FE(U,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),oz(I,`service starting on http://${J}:${Q} pid=${process.pid}`);let K=null;try{K=await VE({port:Q,host:J,silent:!0}),oz(I,`service listening pid=${process.pid}`)}catch(G){if(oz(I,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),wE(Y)===process.pid)b9(Y,{force:!0}),b9(U,{force:!0});throw G}let z=()=>{if(K)K.close(),K=null;if(wE(Y)===process.pid)b9(Y,{force:!0}),b9(U,{force:!0});oz(I,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,z(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function ry0($){ty0($.stateDir);let Y=dI($);if(Y.running)return Y;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},I=[...U.args??[],"service","run"];if($.port)I.push("--port",String($.port));if($.host)I.push("--host",String($.host));let Q=ix1(U.command,I,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=ME($);return FE(J,`${Q.pid}
`,{mode:384}),oz(sq($),`started pid=${Q.pid}`),{started:!0,...dI($)}}function sy0($,Y={}){let U=ME($),I=qr($),Q=wE(U);if(!Q||!ay0(Q,$.appRoot))return b9(U,{force:!0}),b9(I,{force:!0}),Y.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(Q,"SIGTERM"),b9(U,{force:!0}),b9(I,{force:!0}),oz(sq($),`stop requested pid=${Q}`),Y.quiet?void 0:{stopped:!0,pid:Q}}function ay0($,Y){if(!mx1($))return!1;try{let U=cx1("ps",["-p",String($),"-o","command="],{encoding:"utf8"}),I=U.trim().split(/\s+/).filter(Boolean),Q=I.indexOf("service"),J=Q!==-1&&I[Q+1]==="run",K=U.includes(Y)||I.some((z)=>/(^|[\\/])(seal-use|seal-home)(\.exe)?$/.test(z));return J&&K}catch{return!1}}function mx1($){try{return process.kill($,0),!0}catch{return!1}}function ME($){return Zr($.stateDir,"service.pid")}function qr($){return Zr($.stateDir,"service.json")}function sq($){return Zr($.stateDir,"service.log")}function wE($){if(!LE($))return;let Y=Number(Xr($,"utf8").trim());return Number.isInteger(Y)&&Y>0?Y:void 0}function ty0($){nx1($,{recursive:!0,mode:448})}function oz($,Y){FE($,`${new Date().toISOString()} ${Y}
`,{flag:"a",mode:384})}var Vr=m(()=>{Gr()});import{homedir as lx1}from"node:os";import{join as ox1}from"node:path";async function Fr($,Y,U){let I=U?s0(U.options.port)??s0(U.options.p):void 0,Q=U?h(U.options.host)??h(U.options.h):void 0,J=U?s0(U.options.lines)??s0(U.options.n):void 0,K=await $7($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Lr,version:X1,launcher:Y.launcher,port:I,host:Q},{maxLines:J});if(K!==void 0)j0(K)}var Lr;var wr=m(()=>{K3();Vr();o1();q4();Lr=ox1(lx1(),".config","seal-use")});import{existsSync as rx1,readFileSync as ey0}from"node:fs";async function $k0($,Y,U,I,Q){if($==="batch-records"||$==="records"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await x0("seal_simulation_batch_records_get",U,I,{batchId:J,query:h(Q.options.query)},T0(Q.options));return}if($==="create"||$==="run"){let J=h(Q.options.mode)??h(Q.options.sourceSystem)??h(Q.options["source-system"])??"hosecloud",K=J==="material-pack"?"material_pack":J,z=h(Q.options.schemaConfig)??h(Q.options["schema-config"]),G=z?JSON.parse(ey0(z,"utf8")):void 0,H=h(Q.options.input),W=H?JSON.parse(ey0(H,"utf8")):E8(Q.json),X=h(Q.options.packageId)??h(Q.options["package-id"]),Z=n6(Q.options.packageIds)??n6(Q.options["package-ids"])??(X?[X]:void 0),q=n6(Q.options.flowIds)??n6(Q.options["flow-ids"])??n6(Q.options.documentSn)??n6(Q.options["document-sn"]),V=h(Q.options.signKey)??h(Q.options["sign-key"])??h(Q.options.integration),w=G0(Q.options.wait)===!0,M=G0(Q.options.noWait)??G0(Q.options["no-wait"])??(w?!1:!0),F=await T$("seal_simulation_batch_create",U,I,{mode:K,sourceSystem:K,flowIds:q,documentSn:q,rejectNodeName:h(Q.options.rejectNode)??h(Q.options["reject-node"])??null,thinkingDepthOverride:h(Q.options.thinkingDepth)??h(Q.options["thinking-depth"]),skipInvoiceGeneration:G0(Q.options.skipInvoiceGeneration)??G0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:G0(Q.options.skipExpenseExtraction)??G0(Q.options["skip-expense-extraction"]),disableAttachmentCache:G0(Q.options.disableAttachmentCache)??G0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:h(Q.options.templateId)??h(Q.options["template-id"]),schemaConfig:G,requestIds:n6(Q.options.requestIds)??n6(Q.options["request-ids"]),workflowTypeId:h(Q.options.workflowTypeId)??h(Q.options["workflow-type-id"]),flowStatusList:n6(Q.options.flowStatusList)?.map(Number)??n6(Q.options["flow-status-list"])?.map(Number),businessCodes:n6(Q.options.businessCodes)??n6(Q.options["business-codes"]),documentType:h(Q.options.documentType)??h(Q.options["document-type"]),startTime:s0(Q.options.startTime)??s0(Q.options["start-time"]),endTime:s0(Q.options.endTime)??s0(Q.options["end-time"]),status:n6(Q.options.status),limit:s0(Q.options.limit),noWait:M,rawParams:W});if(w&&F&&typeof F==="object"&&"batchId"in F&&typeof F.batchId==="string"){await x0("seal_simulation_batch_wait",U,I,{batchId:F.batchId,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},T0(Q.options));return}j0(F,T0(Q.options));return}if($==="wait"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await x0("seal_simulation_batch_wait",U,I,{batchId:J,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},T0(Q.options));return}if($==="status"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await x0("seal_simulation_batch_status",U,I,{batchId:J},T0(Q.options));return}if($==="clean"||$==="delete"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await x0("seal_simulation_batch_clean",U,I,{batchId:J},T0(Q.options));return}if($==="specifications"){let J=Y??h(Q.options.integration)??h(Q.options.signKey)??h(Q.options["sign-key"]);await x0("seal_simulation_specifications_list",U,I,{signKey:J},T0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await x0("seal_simulation_feishu_approval_definitions_list",U,I,{},T0(Q.options));return}if($==="list"){await x0("seal_simulation_batches_list",U,I,{limit:s0(Q.options.limit)},T0(Q.options));return}if($==="get"){let J=Y??h(Q.options.batchId)??h(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await x0("seal_simulation_batch_get",U,I,{batchId:J},T0(Q.options));return}if($==="templates"){await x0("seal_simulation_templates_get",U,I,{},T0(Q.options));return}if($==="integrations"){await x0("seal_simulation_integrations_get",U,I,{},T0(Q.options));return}if($==="package-upload"){let J=Y??h(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!rx1(J))throw Error(`File not found: ${J}`);await x0("seal_simulation_material_package_upload",U,I,{filePath:J},T0(Q.o Line truncated
`);return}if($==="install"||$==="init"||$==="sync"){let I=G0(U.options.local)||G0(U.options.workspace),Q=h(U.options.dir)??h(U.options.target)??Y,J=Q?Q:I?OE(process.cwd(),".agents","skills","seal-use"):nI(),K=Gy0(J),z=!I&&!Q,G=z?mo():void 0,H=z?ro():void 0;j0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let I=nI(),Q=OE(process.cwd(),".agents","skills","seal-use"),J=lo(),K=so();j0({global:{dir:I,installed:Uk0(OE(I,"SKILL.md"))},local:{dir:Q,installed:Uk0(OE(Q,"SKILL.md"))},antigravity:J,hosts:K});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}var Qk0=m(()=>{to();lq();q4();o1()});async function Jk0($,Y){if($==="config"){j0(await dz(Y));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}var Kk0=m(()=>{pT();o1()});function Mr($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let Y=$.toUpperCase().trim();if(Y==="APPROVE"||Y==="PASS")return"APPROVE";if(Y==="REJECT"||Y==="DENIED")return"REJECT";if(Y==="MANUAL"||Y==="ASSISTED")return"MANUAL";if(Y==="ERROR"||Y==="FAILED")return"ERROR";return Y}async function zk0($){let{sourceCorp:Y,targetCorp:U,sourceClient:I,targetClient:Q,samples:J=10,dryRun:K=!1,pollIntervalMs:z=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw new z4(`重放目标企业「${U.name}」(${U.id}) 的环境为「${U.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${Y.id} <testCorpId>`);let X=await rY(Q),q=(Array.isArray(X.features)?X.features:[]).find((p)=>p?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,w=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=J*w;if(V<M)throw new z4(`测试企业「${U.name}」AI 审批额度不足:当前剩余 ${V} 点,本次回归抽样 ${J} 笔需要约 ${M} 点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${U.id}」充值 AI 审批额度,或降低抽样笔数 (--samples ${Math.max(1,Math.floor(V/w))})`);let F=await x4(I,{limit:J,status:"completed"}),N=Array.isArray(F.records)?F.records:[];if(N.length===0){let p=await x4(I,{limit:J});N=Array.isArray(p.records)?p.records:[]}if(N.length===0)throw new z4(`在母企业「${Y.name}」(${Y.id}) 中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(N=N.slice(0,J),K){let p=N.map((a)=>{let $0=a.sourceDocumentSN??a.id,y=a?.result?.decision??a.aiDecision??a?.decision,d=Mr(y),Y0=a?.result?.summary??a.aiSummary;return{sn:$0,sourceRecordId:a.id,prodDecision:d,prodSummary:Y0,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M},metrics:{sampleCount:p.length,successCount:p.length,failureCount:0,matchCount:p.length,flipCount:0,concordanceRate:1},flips:[],records:p}}let O=await Zp(Q,U,$.webhookSelector),D=[];for(let p of N){let a=Date.now(),$0=p.sourceDocumentSN??p.id,y=Mr(p?.result?.decision??p.aiDecision??p?.decision),d=p?.result?.summary??p.aiSummary;try{let Y0=await H4(I,p.id),R=`${H}${$0}`,o=Wp(Y0,{snPrefix:H,docIdPrefix:H});await Xp(O.incomingDocumentWebhook.url,O.secret,o,W,P6(U.seal));let e=null,O0=Date.now();while(Date.now()-O0<G){await new Promise((X0)=>setTimeout(X0,z));let t=await x4(Q,{sourceDocumentSN:R,limit:1});if(t.records&&t.records.length>0){let X0=t.records[0];if(X0.status==="completed"||X0.status==="failed"){e=X0;break}}}if(!e){D.push({sn:$0,sourceRecordId:p.id,prodDecision:y,prodSummary:d,status:"FAILED",error:`测试租户单据审核超时 (${Math.round(G/1000)}s 未完成)`,durationMs:Date.now()-a});continue}let E0=Mr(e?.result?.decision??e.aiDecision??e?.decision??(e.status==="completed"?"APPROVE":"ERROR")),y0=e?.result?.summary??e.aiSummary,v0=y===E0,o0=v0?"MATCHED":"FLIPPED",q1={sn:$0,sourceRecordId:p.id,prodDecision:y,prodSummary:d,testRecordId:e.id,testDecision:E0,testSummary:y0,status:o0,durationMs:Date.now()-a};if(!v0)q1.diff={from:y,to:E0,reasonDiff:y0&&d&&y0!==d?`生产: ${d.slice(0,60)}... -> 测试: ${y0.slice(0,60)}...`:void 0};D.push(q1)}catch(Y0){D.push({sn:$0,sourceRecordId:p.id,prodDecision:y,prodSummary:d,status:"FAILED",error:Y0 instanceof Error?Y0.message:String(Y0),durationMs:Date.now()-a})}}let P=D.filter((p)=>p.status==="MATCHED"||p.status==="FLIPPED"),T=D.filter((p)=>p.status==="MATCHED"),B=D.filter((p)=>p.status==="FLIPPED"),E=D.filter((p)=>p.status==="FAILED").length,C=T.length,i=B.length,x=C+i,g=x>0?C/x:0,b=i>0,c=b?"REGRESSIONS_DETECTED":"CLEAN",I0=!b&&E===0,k;try{let p=await rY(Q),$0=(Array.isArray(p.features)?p.features:[]).find((y)=>y?.code==="ai-approval");if(typeof $0?.balance==="number")k=$0.balance}catch{}return{ok:!b&&E===0,verdict:c,safeToPublish:I0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M,balanceAfter:k},metrics:{sampleCount:D.length,successCount:P.length,failureCount:E,matchCount:C,flipCount:i,concordanceRate:Number(g.toFixed(4))},flips:B,records:D}}function Gk0($){let{sourceCorp:Y,targetCorp:U,verdict:I,safeToPublish:Q,metrics:J,quota:K,flips:z,records:G}=$,H=I==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":I==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",W=["",`\uD83E\uDDEA [Seal Use Test] 规则回归测试矩阵: 生产「${Y.name}」-> 测试靶场「${U.name}」`,` 判定: ${H} · 准许发布: ${Q?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),` 样本总数: ${J.sampleCount} | 一致通过: ${J.matchCount} | 决策翻转: ${J.flipCount} | 异常失败: ${J.failureCount}`,` 一致率: ${(J.concordanceRate*100).toFixed(1)}% | 消耗预估: ${K.estimatedRequired} 点 (余量: ${K.balanceBefore}${K.balanceAfter!==void 0?` -> ${K.balanceAfter}`:""})`," "+"─".repeat(65)];if(z.length>0){W.push(` ⚠️ 决策翻转清单 (${z.length} 笔单据在新规则下结果改变):`);for(let X of z)if(W.push(` • 单据 [${X.sn}]: 原生产判定「${X.prodDecision}」 ➔ 测试新判定「${X.testDecision}」`),X.diff?.reasonDiff)W.push(` 理由差异: ${X.diff.reasonDiff}`);W.push(" "+"─".repeat(65)),W.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(I==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% Line truncated
`)}var Hk0=m(()=>{BP();W4();aZ()});async function Or($,Y,U){let I=($??Y??"regression").toLowerCase();if(I==="regression"||I==="regress"||I==="matrix"){let Q=h(U.options.corp)??(Y&&Y!==I?Y:void 0),J=M1(Q),K=J,z=J;if(J.environment==="test"){z=J;let O=h(U.options["prod-corp"])??h(U.options.prod)??J.prodCorpId;if(!O)throw new z4(`测试企业「${J.name}」(${J.id}) 未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-use corps bind-test <prodCorpId> ${J.id}`);K=M1(O)}else{K=J;let O=h(U.options["test-corp"])??h(U.options.test)??J.testCorpId;if(!O)throw new z4(`生产企业「${J.name}」(${J.id}) 未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${J.id} <testCorpId>`);z=M1(O)}let G=await A1(K),H=await A1(z),W=s0(U.options.samples)??s0(U.options.limit)??s0(U.options.n)??10,X=G0(U.options["dry-run"]),Z=G0(U.options["fail-on-flips"]),q=s0(U.options["poll-interval"])??2000,V=s0(U.options.timeout)??45000,w=h(U.options["sn-prefix"])??"REG_",M=h(U.options.webhook)??h(U.options.selector),F=await zk0({sourceCorp:K,targetCorp:z,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:w,failOnFlips:Z,webhookSelector:M});if(!(G0(U.options.quiet)||G0(U.options.silent)))console.error(Gk0(F));if(j0(F),Z&&!F.ok)throw new z4(`回归测试发现 ${F.metrics.flipCount} 笔单据决策翻转,已按 --fail-on-flips 策略非零终止。`,1);return}throw new z4(`未知的 test 子命令: "${I}"。
可用子命令: seal-use test regression [--corp <id>] [--samples <N>] [--dry-run]`,2,"seal-use test regression --help")}var Wk0=m(()=>{K$();O4();q4();o1();f6();Hk0()});async function Xk0($,Y,U,I){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await x0($,Y,U,E8(I.json),T0(I.options))}var Zk0=m(()=>{O4();q4();o1()});function qk0(){j0(Sq.map(($)=>({name:$.name,description:$.description})))}var Vk0=m(()=>{hq();o1()});function NE($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.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 Lk0=m(()=>{lq()});import{existsSync as sx1,mkdirSync as ax1,readFileSync as tx1,renameSync as ex1,writeFileSync as $f1}from"node:fs";import{homedir as Yf1}from"node:os";import{dirname as Uf1,join as If1}from"node:path";import{spawn as Qf1}from"node:child_process";function Fk0($){return $.replace(/\.\d+Z$/,"Z")}function wk0(){let $=process.env[Jf1]?.trim();if($)return $;return zf1}function Mk0($=wk0()){if(!sx1($))return null;try{let Y=tx1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&typeof U.latestVersion==="string"&&typeof U.checkedAt==="string")return{...U,checkedAt:Fk0(U.checkedAt)};return null}catch{return null}}function aq($,Y=wk0()){try{let U=Uf1(Y);ax1(U,{recursive:!0,mode:448});let I={checkedAt:Fk0($.checkedAt??new Date().toISOString()),latestVersion:$.latestVersion,publishedAt:$.publishedAt,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;$f1(Q,JSON.stringify(I,null,2),{mode:384}),ex1(Q,Y)}catch{}}function Ok0($,Y=Kf1){if(!$||!$.checkedAt)return!0;let U=new Date($.checkedAt).getTime();if(Number.isNaN(U))return!0;return Date.now()-U>Y}function Nk0($){if(process.env.SEAL_DISABLE_BG_UPDATE==="1"||!1||process.env.CI)return!1;if(!$||!$.command)return!1;try{let Y=$.command,U=[...$.args??[],"update","check","--bg-save"];return Qf1(Y,U,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var Jf1="SEAL_USE_UPDATE_CACHE_FILE",Kf1=86400000,zf1;var Nr=m(()=>{zf1=If1(Yf1(),".config","seal-use","update-cache.json")});import{chmodSync as Gf1,mkdirSync as Hf1,readdirSync as Wf1,realpathSync as Dk0,renameSync as Dr,rmSync as Xf1,unlinkSync as Ek0,writeFileSync as Bk0}from"node:fs";import{basename as Zf1,dirname as qf1,isAbsolute as Vf1,join as AE,relative as Lf1}from"node:path";import{spawn as Ff1,spawnSync as Y7}from"node:child_process";async function Ck0($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Lr,version:X1,launcher:$.launcher},I=Y.repo||process.env[wf1]?.trim()||process.env[Mf1]?.trim()||jk0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=Sk0(D,X1);if(P<0)if(!wg&&Y.force);else{j0({updated:!1,currentVersion:X1,targetVersion:D,mode:NE()?"binary":"source",message:!wg?`Cannot downgrade seal-use from dev build v${X1} to release v${D}. Use --force to overwrite.`:`Cannot downgrade seal-use from v${X1} to older version v${D}. Updates must be forward-only.`});return}if(P===0&&!Y.force){j0({updated:!1,currentVersion:X1,targetVersion:D,mode:NE()?"binary":"source",message:`seal-use is already at version v${X1}. Use --force to reinstall.`});return}}if(Y.changelogOnly){let D=await BE(I,Y.limit??10);j0({currentVersion:X1,totalQueried:D.length,releases:D.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl,isCurrent:P.version===X1,isNewer:k5(P.version,X1)}))});return}if(!NE()){if(Y.checkOnly){let P=await BE(I,30),T=P[0],B=T?.version??X1,E=P.find((x)=>x.version===X1),C=k5(B,X1),i=P.filter((x)=>k5(x.version,X1));if(T?.version)aq({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;j0({updated:!1,updateAvailable:C,currentVersion:X1,currentVersionPublishedAt:E?.publishedAt,latestVersion:B,latestVersionPublishedAt:T?.publishedAt,behindCount:i.length,pendingReleases:i.map((x)=>({version:x.version,tagName:x.tagName,publishedAt:x.publishedAt,author:x.author,releaseNotes:x.notes,releaseUrl:x.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"当前运行的是开发版。正式用户请安装正式版后使用 seal-use update。"});return}let D=dI(U).running;if(D)await $7("stop",U);try{Tk0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`⚠️ 开发版更新同步失败,继续刷新本地依赖: ${P instanceof Error?P.message:String(P)}`)}if(Tk0("bun",["install"],{cwd:$.appRoot}),D)await $7("start",U);j0({updated:!0,serviceRestarted:D,version:X1,mode:"source"});return}if(Af1())try{await Pf1($,Y,U,I,J);return}catch(D){console.error(`⚠️ Homebrew 自动更新失败,回退至原生二进制更新: ${D instanceof Error?D.message:String(D)}`)}let K=Nf1(),z=Df1(),G=await BE(I,30),H=J?G.find((D)=>D.version Line truncated
`)}catch{}}async function jf1($,Y,U,I){let Q=Br(),J=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,z=I||$.split("/").pop()||"";if(Q!=="github"){if(K&&z)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${z}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${z}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(K&&z){let w=`https://github.com/${jk0}/releases/download/${K}/${z}`;if(!process.env.CI)J.push(`https://ghfast.top/${w}`,`https://gh.ddlc.top/${w}`);J.push(w)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let G=Array.from(new Set(J)),H,W=6000,X=6000,Z=307200,q=1e4,V=180000;for(let w=0;w<G.length;w++){let M=G[w],F=new AbortController,N="",O=(B)=>{N=B;try{F.abort()}catch{}},D=setTimeout(()=>{O("Connection timed out (no response headers within 6s)")},W),P,T;try{DE(`==> [${w+1}/${G.length}] Downloading via: ${M}`);let B=await fetch(M,{signal:F.signal});if(D)clearTimeout(D),D=void 0;if(!B.ok)throw Error(`HTTP ${B.status} ${B.statusText}`);P=setTimeout(()=>{O("Overall download time exceeded 3 minutes")},V);let E=Number(B.headers.get("content-length"))||0,C=B.body?.getReader();if(!C){let c=Buffer.from(await B.arrayBuffer());if(c.length<1000)throw Error(`Downloaded content is suspiciously small (${c.length} bytes)`);Bk0(Y,c),DE(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let i=[],x=0,g=0;T=setTimeout(()=>{if(x<Z){let c=(x/1024).toFixed(1);O(`Initial transfer too slow (${c} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let c=C.read(),I0,k=new Promise((y,d)=>{I0=setTimeout(()=>{d(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),p;try{p=await Promise.race([c,k])}finally{if(I0)clearTimeout(I0)}let{done:a,value:$0}=p;if(a)break;if($0){if(i.push($0),x+=$0.length,T&&x>=Z)clearTimeout(T),T=void 0;let y=Date.now();if(y-g>200){g=y;let d=E?Math.round(x/E*100):0,Y0=(x/1048576).toFixed(1),R=E?(E/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${d}% (${Y0} / ${R} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let b=Buffer.concat(i);if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);Bk0(Y,b),DE(`✓ Download completed successfully (${(b.length/1024/1024).toFixed(1)} MB)`);return}catch(B){if(D)clearTimeout(D);if(T)clearTimeout(T);if(P)clearTimeout(P);let E=N||(B instanceof Error?B.message:String(B));H=Error(E),DE(`
↳ Mirror failed: ${H.message}`)}finally{if(D)clearTimeout(D);if(T)clearTimeout(T);if(P)clearTimeout(P)}}throw Error(`Failed to download asset from all mirrors: ${H?.message}`)}function _k0($){let Y;try{Y=Wf1($,{withFileTypes:!0})}catch{return[]}let U=[];for(let I of Y){let Q=AE($,I.name);if(I.isDirectory())U.push(..._k0(Q));else if(I.isFile())U.push(Q)}return U}function vk0($,Y,U){let I=Y==="windows"?"seal-use.exe":"seal-use",Q=_k0($);return Q.find((J)=>Zf1(J)===I)??Q[0]??U}function Cf1($,Y,U){let I=Y7("tar",["-xzf",$,"-C",Y],{stdio:"pipe"});if(I.status!==0)throw Error(`Failed to extract tar archive: ${I.stderr.toString()}`);return Ek0($),vk0(Y,U,$)}function Rf1($,Y,U){let I=Y7("unzip",["-q","-o",$,"-d",Y],{stdio:"pipe"});if(I.status!==0)throw Error(`Failed to extract zip archive: ${I.stderr.toString()}`);return Ek0($),vk0(Y,U,$)}function Sk0($,Y){let U=$.replace(/^v/,"").split(".").map((Q)=>Number.parseInt(Q,10)||0),I=Y.replace(/^v/,"").split(".").map((Q)=>Number.parseInt(Q,10)||0);for(let Q=0;Q<Math.max(U.length,I.length);Q++){let J=U[Q]??0,K=I[Q]??0;if(J>K)return 1;if(J<K)return-1}return 0}function k5($,Y){return Sk0($,Y)>0}function Tk0($,Y,U={}){let I=Y7($,Y,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(I.stdout)console.error(I.stdout.trimEnd());if(I.stderr)console.error(I.stderr.trimEnd());if(I.status!==0)throw Error(`${$} ${Y.join(" ")} failed with status ${I.status}`)}var jk0="yunyingk/seal-use",tq="yunyingk/seal-home",wf1="SEAL_USE_GITHUB_REPO",Mf1="SEAL_HOME_GITHUB_REPO";var hk0=m(()=>{Lk0();lq();Nr();K3();Vr();o1();wr()});async function gk0($,Y,U,I,Q){if($==="create"){let J=h(Q.options.name)??Y,K=h(Q.options.phone);if(!J||!K)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let z=h(Q.options.dept)??h(Q.options.departmentId);await x0("seal_user_create",U,I,{name:J,phone:K,departmentIds:z?[z]:void 0},T0(Q.options));return}if($==="reset-password"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users reset-password <userId>");await x0("seal_user_reset_password",U,I,{userId:J},T0(Q.options));return}if($==="search"||$==="list"){let J=Y??h(Q.options.keyword)??h(Q.options.query)??"";await x0("seal_user_search",U,I,{keyword:J},T0(Q.options));return}if($==="get"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users get <userId>");await x0("seal_user_get",U,I,{userId:J},T0(Q.options));return}if($==="delete"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users delete <userId>");await x0("seal_user_delete",U,I,{userId:J},T0(Q.options));return}if($==="activate"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users activate <userId>");await x0("seal_user_activate",U,I,{userId:J},T0(Q.options));return}if($==="delegation"||$==="impersonate"){let J=Y??h(Q.options.userId)??h(Q.options.phone);if(!J)throw Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");let K=h(Q.options.note);await x0("seal_user_delegation_create",U,I,{userIdOrPhone:J,note:K},T0(Q.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}var yk0=m(()=>{O4();q4();o1()});import{dirname as Ar,join as _f1}from"node:path";import{fileURLToPath as vf1}from"node:url";function yf1($){if(!$.length)return!1;let Y=$[0]?.toLowerCase(),U=$[1]?.toLowerCase();if(Y&&gf1.has(Y))return!0;if((Y==="service"||Y==="daemon")&&U==="run")return!0;return!1}function rq($,Y={}){if(yf1($))return fk0($,Y);let U=xk0.then(()=>fk0($,Y));return xk0=U.then(()=>{return},()=>{return}),U}async function fk0($,Y){let U=[],I=[],Q=console.log,J=console.error,K={appRoot:Y.appRoot??kk0,entryFile:Y.entryFile??_f1(Y.appRoot??kk0,"src","cli.ts"),launcher:Y.launcher};console.log=(...z)=>{U.push(Lo(z))},console.error=(...z)=>{I.push(Lo(z))};try{return await kf1($,K),{stdout:yq(U),stderr:yq(I),isError:!1,exitCode:0}}catch(z){let G=o8(z instanceof Error?z.message:String(z)),H=Gz(z);if(I.push(G),H.nextAction&&!G.includes("Next action:"))I.push(`\uD83D\uDC49 Next action: ${H.nextAction}`);return{stdout:yq(U),stderr:yq(I),isError:!0,exitCode:H.exitCode}}finally{console.log=Q,console.error=J}}async function kf1($,Y){let U=gq($),[I,Q,J]=U.command,K=I?.toLowerCase(),z=K?Sf1.has(K):!1,G=z?"update":K;if(G==="version"||G==="v"||Boolean(U.options.version)||Boolean(U.options.v)||Boolean(U.options.V)){let Z=Mk0(),q=Z?.latestVersion?k5(Z.latestVersion,lY.version):!1,V={...lY,...Z?.latestVersion?{latestVersion:Z.latestVersion,updateAvailable:q,lastCheckedAt:Z.checkedAt}:{}};if(q&&Z?.latestVersion)console.error(`\uD83D\uDCA1 发现新版本可用: v${lY.version} -> v${Z.latestVersion}`),console.error(`\uD83D\uDC49 Next action: seal-use update
`);if(j0(V),Ok0(Z))Nk0(Y.launcher);return}let H=nv0(U);if(H.isHelp){lv0(H.target);return}if(!G||!hf1.has(G))throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`);if(G==="webhook"&&(Q==="resource-pack"||Q==="pack"||Q==="material-pack")&&J==="preview"){let Z=U.command[3]??h(U.options.file)??h(U.options.input);if(!Z)throw Error("Usage: seal-use webhook resource-pack preview <资源包.zip>");await rv0(Z,nz(U.options));return}if(G==="openapi"){xy0(U);return}if(G==="mcp-config"){Hr();return}if(G==="skill"){Ik0(Q,J,U);return}if(G==="mcp"||G==="server"){await hy0(Q,U);return}if(G==="probe"){await my0(Q,J,U);return}if(G==="doctor"){await Ny0(Q,J,U);return}if(G==="test"){await Or(Q,J,U);return}if(G==="config"){Ig0(Q,J,U);return}if(G==="service"){await Fr(Q,Y,U);return}if(G==="stop"){await Fr("stop",Y,U);return}if(G==="http"||G==="serve"){await Ry0(U);return}if(z||G==="changelog"){if(z&&I!=="update")console.error(`⚠️ Notice: '${I}' is an alias for 'seal-use update'. Please use 'seal-use update' instead.`);let Z=Q?.toLowerCase(),q=G==="changelog"||Z==="changelog"||Z==="log"||Z==="history"||G0(U.options.changelog)===!0,V=Z==="check"||G0(U.options.check)===!0||G0(U.options["check-only"])===!0,w=G0(U.options["bg-save"])===!0||G0(U.options["silent-save"])===!0,M=h(U.options.version)??h(U.options.tag)??(!q&&!V&&!w&&Q&&!Q.startsWith("-")?Q:void 0);await Ck0(Y,{checkOnly:V||w,changelogOnly:q,limit:s0(U.options.limit),force:G0(U.options.force),targetVersion:M,repo:h(U.options.repo),bgSave:w});return}if(G==="tools"&&Q==="list"){qk0();return}if(G==="corps"||G==="corp"){if(Q==="regression"||Q==="test-regression"){await Or("regression",J,U);return}await ah0(Q,J,U);return}if(G==="rules"&&Q==="lint"&&(("file"in U.options)||("f"in U.options))){let Z;try{Z=M1(h(U.options.corp))}catch{Z={id:"local",name:"Local Workspace",source:{type:"native"}}}await Wr(Q,J,null,Z,U);return}if(G==="auth"&&(Q==="extract-keys"||Q==="extract-key"||Q==="extract-hose-keys"||Q==="hose-extract-keys")){await bo(J,U);return}if(G==="auth"&&(Q==="link"||Q==="seal-link")&&(("from-link"in U.options)||J==="from-link")){await zE(Q,null,U);return}let W=M1(h(U.options.corp));if(G==="source"){await Jk0(Q,W);return}if(G==="auth"){await zE(Q,W,U);return}let X=await A1(W);if(G==="users"){await gk0(Q,J,X,W,U);return}if(G==="contacts"){await Jg0(Q,J,X,W,U);return}if(G==="data"){await zg0(Q,X,W,U);return}if(G==="llm"){await vy0(Q,X,W,U);return}if(G==="permissions"){await uy0(Q,X,W,U);return}if(G==="billing"){await Yg0(Q,X,W,U);return}if(G==="webhook"||G==="webhooks"){await iT(Q,J,X,W,U);return}if(G==="context"){await Hg0(X,W,U);return}if(G==="rules"){await Wr(Q,J,X,W,U);return}if(G==="approval-runs"){await sv0(Q,J,X,W,U);return}if(G==="analytics"){await tv0(Q,J,X,W,U);return}if(G==="simulation"){await $k0(Q,J,X,W,U);return}if(G==="deploy"){await Xg0(Q,J,U.command[3],X,W,U);return}if(G==="preference"||G==="preferences"){await cy0(Q,J,U.command[3],U.command[4],X,W,U);return}if(G==="tool"){await Xk0(Q,X,W,U);return}throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`)}var kk0,Sf1,hf1,gf1,xk0;var zr=m(()=>{f6();K3();av0();ev0();io();Ug0();Qg0();Kg0();Gg0();Wg0();xo();Zg0();Dy0();_y0();Sy0();gy0();fy0();by0();ny0();ly0();oy0();wr();Yk0();Qk0();Kk0();Wk0();Zk0();Vk0();hk0();Nr();yk0();wo();K$();O4();q4();Vo();o1();kk0=Ar(Ar(Ar(vf1(import.meta.url)))),Sf1=new Set(["update","upgrade","up","self-update","selfupdate"]),hf1=new Set(["config","service","stop","http","serve","update","tools","corps","corp","tool","source","auth","users","contacts","data","llm","permissions","billing","webhook","webhooks","context","rules","approval-runs","analytics","simulation","deploy","preference","preferences","mcp","server","mcp-config","skill","openapi","probe","doctor","changelog","test"]),gf1=new Set(["http","server","web","mcp"]);xk0=Promise.resolve()});function bf1($){let{command:Y}=gq($),U=(Y[0]??"").toLowerCase();return{area:xf1[U]??U,actionTokens:Y.slice(1).map((I)=>I.toLowerCase())}}function uk0($){let Y,U;try{({area:Y,actionTokens:U}=bf1($))}catch{return!1}if(U.length===0&&uf1.has(Y))return!0;if(Y==="tool"){let Q=U[0];return Q!==void 0&&uv0(Q)}let I=ff1[Y];if(!I)return!1;return I.some((Q)=>{let J=Q.split(" ").filter(Boolean);if(J.length===0)return U.length===0;if(J.length>U.length)return!1;return J.every((K,z)=>K===U[z])})}var xf1,ff1,uf1;var bk0=m(()=>{hq();q4();xf1={corp:"corps",webhooks:"webhook",preferences:"preference"},ff1={corps:["list","search","get","current"],rules:["count","list","versions","version","diff","diff-one","get","search","lint","linters","pull","map"],webhook:["ready","status","list","get","resource-pack export","resource-pack preview"],"approval-runs":["summary","stats","count","export","flow","list","search","pick","bridge","get","cited-rules","document-summary","attachments","result","link","url"],simulation:["batch-records","status","wait","specifications","approval-d Line truncated
</html>`}var hy0=m(()=>{z3()});import{URL as cx1}from"node:url";async function k6($,Y,U,I){let Q=$.handler;return Q(Y,U,{corp:I})}async function gy0($,Y){if(Y.setHeader("Access-Control-Allow-Origin","*"),Y.setHeader("Access-Control-Allow-Methods","GET, POST, PUT, DELETE, OPTIONS, PATCH"),Y.setHeader("Access-Control-Allow-Headers","Content-Type, Authorization, X-Seal-Corp, X-Seal-Home-Session"),$.method==="OPTIONS"){Y.writeHead(204),Y.end();return}let U=$.headers.host||"localhost",I=$.headers["x-forwarded-proto"]||"http",Q=new cx1($.url||"/",`${I}://${U}`),J=Q.pathname.replace(/\/+$/,"")||"/",K=($.method||"GET").toUpperCase();try{if(K==="GET"&&J==="/"){E4(Y,200,{name:"seal-use",version:Z1,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"&&J==="/docs"){dx1(Y,200,Sy0());return}if(K==="GET"&&J==="/openapi.json"){E4(Y,200,qE());return}if(K==="GET"&&J==="/health"){E4(Y,200,{status:"ok",version:Z1,name:"seal-use",timestamp:new Date().toISOString()});return}if(K==="POST"&&(J==="/shutdown"||J==="/api/shutdown")){E4(Y,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(K==="POST"&&J==="/api/cli"){let z=await LE($),G=(typeof z?.command==="string"?z.command:"").trim();if(!G){VE(Y,400,"Missing 'command' property in request body");return}let H=aq(G),W=H[0]==="seal-use"||H[0]==="seal-home"||H[0]?.endsWith("/seal-use")||H[0]?.endsWith("/seal-home")?H.slice(1):H,X=await tq(W),Z=void 0;try{if(X.stdout.trim().startsWith("{")||X.stdout.trim().startsWith("["))Z=JSON.parse(X.stdout)}catch{}E4(Y,X.isError?400:200,{success:!X.isError,stdout:X.stdout,stderr:X.stderr,exitCode:X.exitCode,data:Z});return}if(K==="POST"&&J.startsWith("/api/tool/")){let z=J.slice(10).trim(),G=B6(z);if(!G){VE(Y,404,`Tool not found: '${z}'`);return}let H=await LE($)||{},W=d8($,Q,H),X=M1(W),Z=await A1(X),q={...H};delete q.corp;let V=await k6(G,Z,q,X);E4(Y,200,V);return}if(J.startsWith("/v1/")){if(await nx1($,Y,K,J,Q))return}VE(Y,404,`Cannot ${K} ${J}. Visit /docs for available endpoints.`)}catch(z){let G=z instanceof Error?z.message:String(z);VE(Y,500,G)}}async function nx1($,Y,U,I,Q){let J=Object.fromEntries(Q.searchParams.entries());if(U==="GET"&&I==="/v1/corps"){let K=Q$(),z=P4();return E4(Y,200,{count:K.length,mode:z.stateful?"stateful":"stateless",defaultCorpId:z.defaultCorpId,corps:K.map((G)=>({id:G.id,name:G.name,sourceType:G.source.type,sealUrl:G.seal?.url}))}),!0}if(U==="GET"&&I==="/v1/whoami"){let K=d8($,Q,J),z=M1(K),G=await A1(z),H=B6("seal_whoami"),W=await k6(H,G,{},z);return E4(Y,200,W),!0}if(U==="GET"&&I==="/v1/session"){let K=d8($,Q,J),z=M1(K),G=await A1(z),H=B6("seal_session_get"),W=await k6(H,G,{},z);return E4(Y,200,W),!0}if(U==="GET"&&I==="/v1/approval-runs/summary"){let K=d8($,Q,J),z=M1(K),G=await A1(z),H=B6("seal_approval_runs_summary"),W=await k6(H,G,J,z);return E4(Y,200,W),!0}if(U==="GET"&&I==="/v1/approval-runs/stats"){let K=d8($,Q,J),z=M1(K),G=await A1(z),H=B6("seal_approval_runs_stats"),W=await k6(H,G,J,z);return E4(Y,200,W),!0}if(U==="GET"&&I==="/v1/approval-runs/pick"){let K=d8($,Q,J),z=M1(K),G=await A1(z),H=B6("seal_approval_run_pick"),W=await k6(H,G,J,z);return E4(Y,200,W),!0}if(U==="GET"&&I==="/v1/approval-runs/url"){let K=d8($,Q,J),z=M1(K),G=await A1(z),H=B6("seal_approval_run_url_get"),W=await k6(H,G,J,z);return E4(Y,200,W),!0}if(I.startsWith("/v1/approval-runs/")){let K=I.slice(18).split("/"),z=K[0],G=K[1];if(z&&!["summary","pick","stats","url","bridge"].includes(z)){let H=d8($,Q,J),W=M1(H),X=await A1(W);if(!G){let Z=B6("seal_approval_run_get"),q=await k6(Z,X,{recordId:z,...J},W);return E4(Y,200,q),!0}if(G==="attachments"){let Z=B6("seal_approval_run_attachments_get"),q=await k6(Z,X,{recordId:z,...J},W);return E4(Y,200,q),!0}if(G==="cited-rules"){let Z=B6("seal_approval_run_cited_rules_get"),q=await k6(Z,X,{recordId:z,...J},W);return E4(Y,200,q),!0}if(G==="document-summary"){let Z=B6("seal_approval_run_document_summary_get"),q=await k6(Z,X,{recordId:z,...J},W);return E4(Y,200,q),!0}if(G==="result"){let Z=B6("seal_approval_run_result_get"),q=await k6(Z,X,{recordId:z,...J},W);return E4(Y,200,q),!0}}}if(U==="GET"&&I==="/v1/approval-runs"){let K=d8($,Q,J),z=M1(K),G=await A1(z),H=B6("seal_approval_runs_search"),W=await k6(H,G,{...J,limit:J.limit?Number(J.limit):void 0,offset:J.offset?Number(J.offset):void 0,includeBridge:J.includeBridge==="true"},z);return E4(Y,200,W),!0}if(U==="GET"&&I==="/v1/approval/rules"){let K=d8($,Q,J),z=M1(K),G=await A1(z),H=B6("seal_approval_rules_list"),W=await k6(H,G,J,z);return E4(Y,200,W),!0}if(U==="GET"&&I==="/v1/simulation/batches"){let K=d8($,Q,J),z=M1(K),G=await A1(z),H=B6("seal_simulation_batches_list"),W=await k6(H,G,J,z);return E4(Y,200,W),!0}if(U==="POST"&&I==="/v1/simulation/create-batchLine truncated
\uD83D\uDE80 seal-use HTTP Server (v${Z1}) started`),console.error(` URL: http://${U}:${Y}`),console.error(` Docs: http://${U}:${Y}/docs`),console.error(` OpenAPI: http://${U}:${Y}/openapi.json`),console.error(` CLI Exec: POST http://${U}:${Y}/api/cli`),console.error(` REST API: http://${U}:${Y}/v1/...
`);Q(I)})})}var FE=8787,wE="127.0.0.1";var Vr=m(()=>{yy0();z3()});async function ky0($){let Y=l0($.options.port)??l0($.options.p),U=R($.options.host)??R($.options.h),I=await ME({port:Y,host:U}),Q=()=>{I.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var xy0=m(()=>{V4();Vr()});async function fy0($,Y,U,I){if($==="config"||$==="get"){await R0("seal_llm_config_get",Y,U,{},T0(I.options));return}if($==="providers"||$==="list"){await R0("seal_llm_providers_list",Y,U,{},T0(I.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}var uy0=m(()=>{N4();e1()});async function by0($,Y){if($==="config"||$==="json"){Lr();return}let{startServer:U}=await ny0().then(() => cy0);U()}function Lr(){j0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var iy0=m(()=>{e1()});function dy0($){let Y=qE();j0(Y,{...T0($.options),allowFull:!0})}var py0=m(()=>{Zr();e1()});async function my0($,Y,U,I){if($==="available"){await R0("seal_permissions_available_list",Y,U,{},T0(I.options));return}if($==="configs"||$==="list"){await R0("seal_permissions_configs_list",Y,U,{},T0(I.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}var ly0=m(()=>{N4();e1()});import{readFileSync as oy0}from"node:fs";async function ry0($,Y,U,I,Q,J,K){if(!$||$==="get"){await R0("seal_preference_get",Q,J,{},T0(K.options));return}if($==="decision"){if(Y==="update"||!Y){let z=R(K.options.input),G=z?JSON.parse(oy0(z,"utf8")):L6(K.json);if(!G||Object.keys(G).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await R0("seal_preference_decision_update",Q,J,{...G,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let z=R(K.options.default)??R(K.options.level)??I;if(z!=="medium"&&z!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await R0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:z,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}if(Y==="policies"){if(U==="list"||!U){await R0("seal_preference_thinking_depth_policies_list",Q,J,{},T0(K.options));return}if(U==="upsert"){let z=R(K.options.input),G=z?JSON.parse(oy0(z,"utf8")):L6(K.json);if(!G||!G.id||!G.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await R0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}if(U==="remove"||U==="delete"){let z=I??R(K.options.id)??R(K.options.policyId);if(!z)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await R0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:z,dryRun:z0(K.options.dryRun)??z0(K.options["dry-run"])},T0(K.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}var sy0=m(()=>{N4();V4();e1()});async function ay0($={}){let Y=Q$(),U=P4(),I=l2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},n3());console.log(`[probe] corp=${I.id} source=${I.source.type}`);let Q=await oz(I);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await A1(I),K=await cM(J,{documentLimit:20,stylePreferencesEndpoint:I.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))}var ty0=m(()=>{r$();b6();rT();W4()});async function ey0($,Y,U){let I=Y??R(U.options.corp)??($&&$!=="--corp"?$:void 0);await ay0({corpId:I})}var $k0=m(()=>{ty0();V4()});import{readFileSync as mx1}from"node:fs";function Yk0($,Y){let U=R($.options.descriptionFile)??R($.options["description-file"]);if(U)return mx1(U,"utf8").trim();let I=R($.options.description)??R($.options.desc);if(I!==void 0)return I;return typeof Y.description==="string"?Y.description:void 0}function GY($,Y){let U=R($.options.version);if(U!==void 0)return U;if(z0($.options.latest))return"latest";if(Y!==void 0&&!Y.startsWith("-"))return Y;return}async function Fr($,Y,U,I,Q){if(!U&&!($==="lint"||$==="linters"||$==="linter-list"||$==="map"))throw Error(`rules ${$??""} requires an authenticated enterprise. Run 'seal-use corps list' to select one.`);if($==="count"){let K=GY(Q);await R0("seal_approval_rules_list",U,I,{version:K,countOnly:!0},T0(Q.options));return}if($==="list"){let K=GY(Q);if(z0(Q.options.count)){await R0("seal_approval_rules_list",U,I,{version:K,countOn Line truncated
`).filter(Boolean),J=Q.slice(-Y);return{logFile:U,lines:J,totalLines:Q.length}}async function ax1($){let Y=BE($),U=Or($),I=eq($);Kk0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):FE),J=$.host??(process.env.HOST?process.env.HOST:wE);NE(Y,`${process.pid}
`,{mode:384}),NE(U,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),tz(I,`service starting on http://${J}:${Q} pid=${process.pid}`);let K=null;try{K=await ME({port:Q,host:J,silent:!0}),tz(I,`service listening pid=${process.pid}`)}catch(G){if(tz(I,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),DE(Y)===process.pid)i9(Y,{force:!0}),i9(U,{force:!0});throw G}let z=()=>{if(K)K.close(),K=null;if(DE(Y)===process.pid)i9(Y,{force:!0}),i9(U,{force:!0});tz(I,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,z(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function Ik0($){Kk0($.stateDir);let Y=oI($);if(Y.running)return Y;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},I=[...U.args??[],"service","run"];if($.port)I.push("--port",String($.port));if($.host)I.push("--host",String($.host));let Q=lx1(U.command,I,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=BE($);return NE(J,`${Q.pid}
`,{mode:384}),tz(eq($),`started pid=${Q.pid}`),{started:!0,...oI($)}}function Qk0($,Y={}){let U=BE($),I=Or($),Q=DE(U);if(!Q||!Jk0(Q,$.appRoot))return i9(U,{force:!0}),i9(I,{force:!0}),Y.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(Q,"SIGTERM"),i9(U,{force:!0}),i9(I,{force:!0}),tz(eq($),`stop requested pid=${Q}`),Y.quiet?void 0:{stopped:!0,pid:Q}}function Jk0($,Y){if(!tx1($))return!1;try{let U=ox1("ps",["-p",String($),"-o","command="],{encoding:"utf8"}),I=U.trim().split(/\s+/).filter(Boolean),Q=I.indexOf("service"),J=Q!==-1&&I[Q+1]==="run",K=U.includes(Y)||I.some((z)=>/(^|[\\/])(seal-use|seal-home)(\.exe)?$/.test(z));return J&&K}catch{return!1}}function tx1($){try{return process.kill($,0),!0}catch{return!1}}function BE($){return Mr($.stateDir,"service.pid")}function Or($){return Mr($.stateDir,"service.json")}function eq($){return Mr($.stateDir,"service.log")}function DE($){if(!OE($))return;let Y=Number(wr($,"utf8").trim());return Number.isInteger(Y)&&Y>0?Y:void 0}function Kk0($){rx1($,{recursive:!0,mode:448})}function tz($,Y){NE($,`${new Date().toISOString()} ${Y}
`,{flag:"a",mode:384})}var Nr=m(()=>{Vr()});import{homedir as ex1}from"node:os";import{join as $f1}from"node:path";async function Br($,Y,U){let I=U?l0(U.options.port)??l0(U.options.p):void 0,Q=U?R(U.options.host)??R(U.options.h):void 0,J=U?l0(U.options.lines)??l0(U.options.n):void 0,K=await U7($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:Dr,version:Z1,launcher:Y.launcher,port:I,host:Q},{maxLines:J});if(K!==void 0)j0(K)}var Dr;var Ar=m(()=>{z3();Nr();e1();V4();Dr=$f1(ex1(),".config","seal-use")});import{existsSync as Yf1,readFileSync as zk0}from"node:fs";async function Gk0($,Y,U,I,Q){if($==="batch-records"||$==="records"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation batch-records <batchId>");await R0("seal_simulation_batch_records_get",U,I,{batchId:J,query:R(Q.options.query)},T0(Q.options));return}if($==="create"||$==="run"){let J=R(Q.options.mode)??R(Q.options.sourceSystem)??R(Q.options["source-system"])??"hosecloud",K=J==="material-pack"?"material_pack":J,z=R(Q.options.schemaConfig)??R(Q.options["schema-config"]),G=z?JSON.parse(zk0(z,"utf8")):void 0,H=R(Q.options.input),W=H?JSON.parse(zk0(H,"utf8")):L6(Q.json),X=R(Q.options.packageId)??R(Q.options["package-id"]),Z=k4(Q.options.packageIds)??k4(Q.options["package-ids"])??(X?[X]:void 0),q=k4(Q.options.flowIds)??k4(Q.options["flow-ids"])??k4(Q.options.documentSn)??k4(Q.options["document-sn"]),V=R(Q.options.signKey)??R(Q.options["sign-key"])??R(Q.options.integration),w=z0(Q.options.wait)===!0,M=z0(Q.options.noWait)??z0(Q.options["no-wait"])??(w?!1:!0),F=await E$("seal_simulation_batch_create",U,I,{mode:K,sourceSystem:K,flowIds:q,documentSn:q,rejectNodeName:R(Q.options.rejectNode)??R(Q.options["reject-node"])??null,thinkingDepthOverride:R(Q.options.thinkingDepth)??R(Q.options["thinking-depth"]),skipInvoiceGeneration:z0(Q.options.skipInvoiceGeneration)??z0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:z0(Q.options.skipExpenseExtraction)??z0(Q.options["skip-expense-extraction"]),disableAttachmentCache:z0(Q.options.disableAttachmentCache)??z0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:R(Q.options.templateId)??R(Q.options["template-id"]),schemaConfig:G,requestIds:k4(Q.options.requestIds)??k4(Q.options["request-ids"]),workflowTypeId:R(Q.options.workflowTypeId)??R(Q.options["workflow-type-id"]),flowStatusList:k4(Q.options.flowStatusList)?.map(Number)??k4(Q.options["flow-status-list"])?.map(Number),businessCodes:k4(Q.options.businessCodes)??k4(Q.options["business-codes"]),documentType:R(Q.options.documentType)??R(Q.options["document-type"]),startTime:l0(Q.options.startTime)??l0(Q.options["start-time"]),endTime:l0(Q.options.endTime)??l0(Q.options["end-time"]),status:k4(Q.options.status),limit:l0(Q.options.limit),noWait:M,rawParams:W});if(w&&F&&typeof F==="object"&&"batchId"in F&&typeof F.batchId==="string"){await R0("seal_simulation_batch_wait",U,I,{batchId:F.batchId,timeout:R(Q.options.timeout),pollInterval:R(Q.options.pollInterval)??R(Q.options["poll-interval"])},T0(Q.options));return}j0(F,T0(Q.options));return}if($==="wait"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await R0("seal_simulation_batch_wait",U,I,{batchId:J,timeout:R(Q.options.timeout),pollInterval:R(Q.options.pollInterval)??R(Q.options["poll-interval"])},T0(Q.options));return}if($==="status"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation status <batchId>");await R0("seal_simulation_batch_status",U,I,{batchId:J},T0(Q.options));return}if($==="clean"||$==="delete"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation clean <batchId>");await R0("seal_simulation_batch_clean",U,I,{batchId:J},T0(Q.options));return}if($==="specifications"){let J=Y??R(Q.options.integration)??R(Q.options.signKey)??R(Q.options["sign-key"]);await R0("seal_simulation_specifications_list",U,I,{signKey:J},T0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await R0("seal_simulation_feishu_approval_definitions_list",U,I,{},T0(Q.options));return}if($==="list"){await R0("seal_simulation_batches_list",U,I,{limit:l0(Q.options.limit)},T0(Q.options));return}if($==="get"){let J=Y??R(Q.options.batchId)??R(Q.options["batch-id"]);if(!J)throw Error("Usage: seal-use simulation get <batchId>");await R0("seal_simulation_batch_get",U,I,{batchId:J},T0(Q.options));return}if($==="templates"){await R0("seal_simulation_templates_get",U,I,{},T0(Q.options));return}if($==="integrations"){await R0("seal_simulation_integrations_get",U,I,{},T0(Q.options));return}if($==="package-upload"){let J=Y??R(Q.options.file);if(!J)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!Yf1(J))throw Error(`File not found: ${J}`);await R0("seal_simulation_material_package_upload",U,I,{filePath:J},T0(Q.o Line truncated
`);return}if($==="install"||$==="init"||$==="sync"){let I=z0(U.options.local)||z0(U.options.workspace),Q=R(U.options.dir)??R(U.options.target)??Y,J=Q?Q:I?AE(process.cwd(),".agents","skills","seal-use"):lI(),K=Zy0(J),z=!I&&!Q,G=z?to():void 0,H=z?Yr():void 0;j0({installed:!0,targetDir:K.targetDir,fileCount:K.files.length,files:K.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let I=lI(),Q=AE(process.cwd(),".agents","skills","seal-use"),J=eo(),K=Ur();j0({global:{dir:I,installed:Wk0(AE(I,"SKILL.md"))},local:{dir:Q,installed:Wk0(AE(Q,"SKILL.md"))},antigravity:J,hosts:K});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}var Zk0=m(()=>{Qr();sq();V4();e1()});async function qk0($,Y){if($==="config"){j0(await oz(Y));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}var Vk0=m(()=>{rT();e1()});function Pr($){if(typeof $!=="string"||!$.trim())return"UNKNOWN";let Y=$.toUpperCase().trim();if(Y==="APPROVE"||Y==="PASS")return"APPROVE";if(Y==="REJECT"||Y==="DENIED")return"REJECT";if(Y==="MANUAL"||Y==="ASSISTED")return"MANUAL";if(Y==="ERROR"||Y==="FAILED")return"ERROR";return Y}async function Lk0($){let{sourceCorp:Y,targetCorp:U,sourceClient:I,targetClient:Q,samples:J=10,dryRun:K=!1,pollIntervalMs:z=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw new z4(`重放目标企业「${U.name}」(${U.id}) 的环境为「${U.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${Y.id} <testCorpId>`);let X=await $U(Q),q=(Array.isArray(X.features)?X.features:[]).find((p)=>p?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,w=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,M=J*w;if(V<M)throw new z4(`测试企业「${U.name}」AI 审批额度不足:当前剩余 ${V} 点,本次回归抽样 ${J} 笔需要约 ${M} 点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${U.id}」充值 AI 审批额度,或降低抽样笔数 (--samples ${Math.max(1,Math.floor(V/w))})`);let F=await f4(I,{limit:J,status:"completed"}),N=Array.isArray(F.records)?F.records:[];if(N.length===0){let p=await f4(I,{limit:J});N=Array.isArray(p.records)?p.records:[]}if(N.length===0)throw new z4(`在母企业「${Y.name}」(${Y.id}) 中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(N=N.slice(0,J),K){let p=N.map((a)=>{let $0=a.sourceDocumentSN??a.id,y=a?.result?.decision??a.aiDecision??a?.decision,d=Pr(y),Y0=a?.result?.summary??a.aiSummary;return{sn:$0,sourceRecordId:a.id,prodDecision:d,prodSummary:Y0,status:"DRY_RUN"}});return{ok:!0,verdict:"DRY_RUN",safeToPublish:!0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M},metrics:{sampleCount:p.length,successCount:p.length,failureCount:0,matchCount:p.length,flipCount:0,concordanceRate:1},flips:[],records:p}}let O=await Lp(Q,U,$.webhookSelector),D=[];for(let p of N){let a=Date.now(),$0=p.sourceDocumentSN??p.id,y=Pr(p?.result?.decision??p.aiDecision??p?.decision),d=p?.result?.summary??p.aiSummary;try{let Y0=await H4(I,p.id),h=`${H}${$0}`,o=qp(Y0,{snPrefix:H,docIdPrefix:H});await Vp(O.incomingDocumentWebhook.url,O.secret,o,W,E6(U.seal));let e=null,w0=Date.now();while(Date.now()-w0<G){await new Promise((X0)=>setTimeout(X0,z));let t=await f4(Q,{sourceDocumentSN:h,limit:1});if(t.records&&t.records.length>0){let X0=t.records[0];if(X0.status==="completed"||X0.status==="failed"){e=X0;break}}}if(!e){D.push({sn:$0,sourceRecordId:p.id,prodDecision:y,prodSummary:d,status:"FAILED",error:`测试租户单据审核超时 (${Math.round(G/1000)}s 未完成)`,durationMs:Date.now()-a});continue}let N0=Pr(e?.result?.decision??e.aiDecision??e?.decision??(e.status==="completed"?"APPROVE":"ERROR")),_0=e?.result?.summary??e.aiSummary,v0=y===N0,r0=v0?"MATCHED":"FLIPPED",K1={sn:$0,sourceRecordId:p.id,prodDecision:y,prodSummary:d,testRecordId:e.id,testDecision:N0,testSummary:_0,status:r0,durationMs:Date.now()-a};if(!v0)K1.diff={from:y,to:N0,reasonDiff:_0&&d&&_0!==d?`生产: ${d.slice(0,60)}... -> 测试: ${_0.slice(0,60)}...`:void 0};D.push(K1)}catch(Y0){D.push({sn:$0,sourceRecordId:p.id,prodDecision:y,prodSummary:d,status:"FAILED",error:Y0 instanceof Error?Y0.message:String(Y0),durationMs:Date.now()-a})}}let P=D.filter((p)=>p.status==="MATCHED"||p.status==="FLIPPED"),T=D.filter((p)=>p.status==="MATCHED"),B=D.filter((p)=>p.status==="FLIPPED"),E=D.filter((p)=>p.status==="FAILED").length,C=T.length,i=B.length,x=C+i,g=x>0?C/x:0,b=i>0,c=b?"REGRESSIONS_DETECTED":"CLEAN",I0=!b&&E===0,k;try{let p=await $U(Q),$0=(Array.isArray(p.features)?p.features:[]).find((y)=>y?.code==="ai-approval");if(typeof $0?.balance==="number")k=$0.balance}catch{}return{ok:!b&&E===0,verdict:c,safeToPublish:I0,timestamp:new Date().toISOString(),sourceCorp:{id:Y.id,name:Y.name,environment:Y.environment??"production"},targetCorp:{id:U.id,name:U.name,environment:U.environment??"test"},quota:{featureCode:"ai-approval",balanceBefore:V,deductionAmount:w,estimatedRequired:M,balanceAfter:k},metrics:{sampleCount:D.length,successCount:P.length,failureCount:E,matchCount:C,flipCount:i,concordanceRate:Number(g.toFixed(4))},flips:B,records:D}}function Fk0($){let{sourceCorp:Y,targetCorp:U,verdict:I,safeToPublish:Q,metrics:J,quota:K,flips:z,records:G}=$,H=I==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":I==="DRY_RUN"?"⚪ 预演模式 (DRY-RUN)":"\uD83D\uDD34 发现决策翻转 (REGRESSIONS_DETECTED)",W=["",`\uD83E\uDDEA [Seal Use Test] 规则回归测试矩阵: 生产「${Y.name}」-> 测试靶场「${U.name}」`,` 判定: ${H} · 准许发布: ${Q?"YES (可安全上线)":"NO (存在行为偏离/待复核)"}`," "+"─".repeat(65),` 样本总数: ${J.sampleCount} | 一致通过: ${J.matchCount} | 决策翻转: ${J.flipCount} | 异常失败: ${J.failureCount}`,` 一致率: ${(J.concordanceRate*100).toFixed(1)}% | 消耗预估: ${K.estimatedRequired} 点 (余量: ${K.balanceBefore}${K.balanceAfter!==void 0?` -> ${K.balanceAfter}`:""})`," "+"─".repeat(65)];if(z.length>0){W.push(` ⚠️ 决策翻转清单 (${z.length} 笔单据在新规则下结果改变):`);for(let X of z)if(W.push(` • 单据 [${X.sn}]: 原生产判定「${X.prodDecision}」 ➔ 测试新判定「${X.testDecision}」`),X.diff?.reasonDiff)W.push(` 理由差异: ${X.diff.reasonDiff}`);W.push(" "+"─".repeat(65)),W.push(" \uD83D\uDC49 建议: 请检查上述翻转单据是否符合预期修正。若为意外误杀,请调整测试环境规则后再次回归。")}else if(I==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% Line truncated
`)}var wk0=m(()=>{EP();W4();Uq()});async function Tr($,Y,U){let I=($??Y??"regression").toLowerCase();if(I==="regression"||I==="regress"||I==="matrix"){let Q=R(U.options.corp)??(Y&&Y!==I?Y:void 0),J=M1(Q),K=J,z=J;if(J.environment==="test"){z=J;let O=R(U.options["prod-corp"])??R(U.options.prod)??J.prodCorpId;if(!O)throw new z4(`测试企业「${J.name}」(${J.id}) 未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-use corps bind-test <prodCorpId> ${J.id}`);K=M1(O)}else{K=J;let O=R(U.options["test-corp"])??R(U.options.test)??J.testCorpId;if(!O)throw new z4(`生产企业「${J.name}」(${J.id}) 未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${J.id} <testCorpId>`);z=M1(O)}let G=await A1(K),H=await A1(z),W=l0(U.options.samples)??l0(U.options.limit)??l0(U.options.n)??10,X=z0(U.options["dry-run"]),Z=z0(U.options["fail-on-flips"]),q=l0(U.options["poll-interval"])??2000,V=l0(U.options.timeout)??45000,w=R(U.options["sn-prefix"])??"REG_",M=R(U.options.webhook)??R(U.options.selector),F=await Lk0({sourceCorp:K,targetCorp:z,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:w,failOnFlips:Z,webhookSelector:M});if(!(z0(U.options.quiet)||z0(U.options.silent)))console.error(Fk0(F));if(j0(F),Z&&!F.ok)throw new z4(`回归测试发现 ${F.metrics.flipCount} 笔单据决策翻转,已按 --fail-on-flips 策略非零终止。`,1);return}throw new z4(`未知的 test 子命令: "${I}"。
可用子命令: seal-use test regression [--corp <id>] [--samples <N>] [--dry-run]`,2,"seal-use test regression --help")}var Mk0=m(()=>{n8();N4();V4();e1();b6();wk0()});function PE($=process.execPath,Y=import.meta.url){if(Y.includes("/$bunfs/")||Y.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 Ok0=m(()=>{sq()});import{existsSync as Uf1,mkdirSync as If1,readFileSync as Qf1,renameSync as Jf1,writeFileSync as Kf1}from"node:fs";import{homedir as zf1}from"node:os";import{dirname as Gf1,join as Hf1}from"node:path";import{spawn as Wf1}from"node:child_process";function Nk0($){return $.replace(/\.\d+Z$/,"Z")}function Dk0(){let $=process.env[Xf1]?.trim();if($)return $;return qf1}function Bk0($=Dk0()){if(!Uf1($))return null;try{let Y=Qf1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&typeof U.latestVersion==="string"&&typeof U.checkedAt==="string")return{...U,checkedAt:Nk0(U.checkedAt)};return null}catch{return null}}function $V($,Y=Dk0()){try{let U=Gf1(Y);If1(U,{recursive:!0,mode:448});let I={checkedAt:Nk0($.checkedAt??new Date().toISOString()),latestVersion:$.latestVersion,publishedAt:$.publishedAt,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;Kf1(Q,JSON.stringify(I,null,2),{mode:384}),Jf1(Q,Y)}catch{}}function Ak0($,Y=Zf1){if(!$||!$.checkedAt)return!0;let U=new Date($.checkedAt).getTime();if(Number.isNaN(U))return!0;return Date.now()-U>Y}function Pk0($){if(process.env.SEAL_DISABLE_BG_UPDATE==="1"||!1||process.env.CI)return!1;if(!$||!$.command)return!1;try{let Y=$.command,U=[...$.args??[],"update","check","--bg-save"];return Wf1(Y,U,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var Xf1="SEAL_USE_UPDATE_CACHE_FILE",Zf1=86400000,qf1;var Er=m(()=>{qf1=Hf1(zf1(),".config","seal-use","update-cache.json")});import{chmodSync as Vf1,mkdirSync as Lf1,readdirSync as Ff1,realpathSync as Tk0,renameSync as jr,rmSync as wf1,unlinkSync as _k0,writeFileSync as Ek0}from"node:fs";import{basename as Mf1,dirname as Of1,isAbsolute as Nf1,join as jE,relative as Df1}from"node:path";import{spawn as Bf1,spawnSync as I7}from"node:child_process";async function Sk0($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:Dr,version:Z1,launcher:$.launcher},I=Y.repo||process.env[Af1]?.trim()||process.env[Pf1]?.trim()||vk0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=kk0(D,Z1);if(P<0)if(!Dg&&Y.force);else{j0({updated:!1,currentVersion:Z1,targetVersion:D,mode:PE()?"binary":"source",message:!Dg?`Cannot downgrade seal-use from dev build v${Z1} to release v${D}. Use --force to overwrite.`:`Cannot downgrade seal-use from v${Z1} to older version v${D}. Updates must be forward-only.`});return}if(P===0&&!Y.force){j0({updated:!1,currentVersion:Z1,targetVersion:D,mode:PE()?"binary":"source",message:`seal-use is already at version v${Z1}. Use --force to reinstall.`});return}}if(Y.changelogOnly){let D=await EE(I,Y.limit??10);j0({currentVersion:Z1,totalQueried:D.length,releases:D.map((P)=>({version:P.version,tagName:P.tagName,publishedAt:P.publishedAt,author:P.author,releaseNotes:P.notes,releaseUrl:P.htmlUrl,isCurrent:P.version===Z1,isNewer:f5(P.version,Z1)}))});return}if(!PE()){if(Y.checkOnly){let P=await EE(I,30),T=P[0],B=T?.version??Z1,E=P.find((x)=>x.version===Z1),C=f5(B,Z1),i=P.filter((x)=>f5(x.version,Z1));if(T?.version)$V({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;j0({updated:!1,updateAvailable:C,currentVersion:Z1,currentVersionPublishedAt:E?.publishedAt,latestVersion:B,latestVersionPublishedAt:T?.publishedAt,behindCount:i.length,pendingReleases:i.map((x)=>({version:x.version,tagName:x.tagName,publishedAt:x.publishedAt,author:x.author,releaseNotes:x.notes,releaseUrl:x.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"当前运行的是开发版。正式用户请安装正式版后使用 seal-use update。"});return}let D=oI(U).running;if(D)await U7("stop",U);try{Rk0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`⚠️ 开发版更新同步失败,继续刷新本地依赖: ${P instanceof Error?P.message:String(P)}`)}if(Rk0("bun",["install"],{cwd:$.appRoot}),D)await U7("start",U);j0({updated:!0,serviceRestarted:D,version:Z1,mode:"source"});return}if(Rf1())try{await _f1($,Y,U,I,J);return}catch(D){console.error(`⚠️ Homebrew 自动更新失败,回退至原生二进制更新: ${D instanceof Error?D.message:String(D)}`)}let K=Ef1(),z=jf1(),G=await EE(I,30),H=J?G.find((D)=>D.version===J||D.tagName===J||D.tagName===`v${J}`)??await CE(I,J):G[0]??await CE(I);if(!H){j0({updated:!1,currentVersion:Z1,mode:"binary",message:`Failed to query releases from repository '${I}'`});return}let W=H.version,X=G.find((D)=>D.version===Z1),Z=f5(W,Z1),q=Z||Boolean(Y.forc Line truncated
`)}catch{}}async function hf1($,Y,U,I){let Q=Cr(),J=[],K=U?U.startsWith("v")?U:`v${U}`:void 0,z=I||$.split("/").pop()||"";if(Q!=="github"){if(K&&z)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${K}/${z}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${K}/${z}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(K&&z){let w=`https://github.com/${vk0}/releases/download/${K}/${z}`;if(!process.env.CI)J.push(`https://ghfast.top/${w}`,`https://gh.ddlc.top/${w}`);J.push(w)}else if($.includes("github.com")){if(!process.env.CI)J.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);J.push($)}else J.push($);let G=Array.from(new Set(J)),H,W=6000,X=6000,Z=307200,q=1e4,V=180000;for(let w=0;w<G.length;w++){let M=G[w],F=new AbortController,N="",O=(B)=>{N=B;try{F.abort()}catch{}},D=setTimeout(()=>{O("Connection timed out (no response headers within 6s)")},W),P,T;try{TE(`==> [${w+1}/${G.length}] Downloading via: ${M}`);let B=await fetch(M,{signal:F.signal});if(D)clearTimeout(D),D=void 0;if(!B.ok)throw Error(`HTTP ${B.status} ${B.statusText}`);P=setTimeout(()=>{O("Overall download time exceeded 3 minutes")},V);let E=Number(B.headers.get("content-length"))||0,C=B.body?.getReader();if(!C){let c=Buffer.from(await B.arrayBuffer());if(c.length<1000)throw Error(`Downloaded content is suspiciously small (${c.length} bytes)`);Ek0(Y,c),TE(`✓ Download succeeded (${(c.length/1024/1024).toFixed(1)} MB)`);return}let i=[],x=0,g=0;T=setTimeout(()=>{if(x<Z){let c=(x/1024).toFixed(1);O(`Initial transfer too slow (${c} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let c=C.read(),I0,k=new Promise((y,d)=>{I0=setTimeout(()=>{d(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),p;try{p=await Promise.race([c,k])}finally{if(I0)clearTimeout(I0)}let{done:a,value:$0}=p;if(a)break;if($0){if(i.push($0),x+=$0.length,T&&x>=Z)clearTimeout(T),T=void 0;let y=Date.now();if(y-g>200){g=y;let d=E?Math.round(x/E*100):0,Y0=(x/1048576).toFixed(1),h=E?(E/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${d}% (${Y0} / ${h} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let b=Buffer.concat(i);if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);Ek0(Y,b),TE(`✓ Download completed successfully (${(b.length/1024/1024).toFixed(1)} MB)`);return}catch(B){if(D)clearTimeout(D);if(T)clearTimeout(T);if(P)clearTimeout(P);let E=N||(B instanceof Error?B.message:String(B));H=Error(E),TE(`
↳ Mirror failed: ${H.message}`)}finally{if(D)clearTimeout(D);if(T)clearTimeout(T);if(P)clearTimeout(P)}}throw Error(`Failed to download asset from all mirrors: ${H?.message}`)}function gk0($){let Y;try{Y=Ff1($,{withFileTypes:!0})}catch{return[]}let U=[];for(let I of Y){let Q=jE($,I.name);if(I.isDirectory())U.push(...gk0(Q));else if(I.isFile())U.push(Q)}return U}function yk0($,Y,U){let I=Y==="windows"?"seal-use.exe":"seal-use",Q=gk0($);return Q.find((J)=>Mf1(J)===I)??Q[0]??U}function gf1($,Y,U){let I=I7("tar",["-xzf",$,"-C",Y],{stdio:"pipe"});if(I.status!==0)throw Error(`Failed to extract tar archive: ${I.stderr.toString()}`);return _k0($),yk0(Y,U,$)}function yf1($,Y,U){let I=I7("unzip",["-q","-o",$,"-d",Y],{stdio:"pipe"});if(I.status!==0)throw Error(`Failed to extract zip archive: ${I.stderr.toString()}`);return _k0($),yk0(Y,U,$)}function kk0($,Y){let U=$.replace(/^v/,"").split(".").map((Q)=>Number.parseInt(Q,10)||0),I=Y.replace(/^v/,"").split(".").map((Q)=>Number.parseInt(Q,10)||0);for(let Q=0;Q<Math.max(U.length,I.length);Q++){let J=U[Q]??0,K=I[Q]??0;if(J>K)return 1;if(J<K)return-1}return 0}function f5($,Y){return kk0($,Y)>0}function Rk0($,Y,U={}){let I=I7($,Y,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(I.stdout)console.error(I.stdout.trimEnd());if(I.stderr)console.error(I.stderr.trimEnd());if(I.status!==0)throw Error(`${$} ${Y.join(" ")} failed with status ${I.status}`)}var vk0="yunyingk/seal-use",YV="yunyingk/seal-home",Af1="SEAL_USE_GITHUB_REPO",Pf1="SEAL_HOME_GITHUB_REPO";var xk0=m(()=>{Ok0();sq();Er();z3();Nr();e1();Ar()});async function fk0($,Y,U,I,Q){if($==="create"){let J=R(Q.options.name)??Y,K=R(Q.options.phone);if(!J||!K)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let z=R(Q.options.dept)??R(Q.options.departmentId);await R0("seal_user_create",U,I,{name:J,phone:K,departmentIds:z?[z]:void 0},T0(Q.options));return}if($==="reset-password"){let J=Y??R(Q.options.userId);if(!J)throw Error("Usage: seal-use users reset-password <userId>");await R0("seal_user_reset_password",U,I,{userId:J},T0(Q.options));return}if($==="search"||$==="list"){let J=Y??R(Q.options.keyword)??R(Q.options.query)??"";await R0("seal_user_search",U,I,{keyword:J},T0(Q.options));return}if($==="get"){let J=Y??R(Q.options.userId);if(!J)throw Error("Usage: seal-use users get <userId>");await R0("seal_user_get",U,I,{userId:J},T0(Q.options));return}if($==="delete"){let J=Y??R(Q.options.userId);if(!J)throw Error("Usage: seal-use users delete <userId>");await R0("seal_user_delete",U,I,{userId:J},T0(Q.options));return}if($==="activate"){let J=Y??R(Q.options.userId);if(!J)throw Error("Usage: seal-use users activate <userId>");await R0("seal_user_activate",U,I,{userId:J},T0(Q.options));return}if($==="delegation"||$==="impersonate"){let J=Y??R(Q.options.userId)??R(Q.options.phone);if(!J)throw Error("Usage: seal-use users delegation <userIdOrPhone> [--note <note>]");let K=R(Q.options.note);await R0("seal_user_delegation_create",U,I,{userIdOrPhone:J,note:K},T0(Q.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}var uk0=m(()=>{N4();V4();e1()});import{dirname as Rr,join as kf1}from"node:path";import{fileURLToPath as xf1}from"node:url";function if1($){if(!$.length)return!1;let Y=$[0]?.toLowerCase(),U=$[1]?.toLowerCase();if(Y&&bf1.has(Y))return!0;if((Y==="service"||Y==="daemon")&&U==="run")return!0;return!1}function tq($,Y={}){if(if1($))return ck0($,Y);let U=ik0.then(()=>ck0($,Y));return ik0=U.then(()=>{return},()=>{return}),U}async function ck0($,Y){let U=[],I=[],Q=console.log,J=console.error,K={appRoot:Y.appRoot??bk0,entryFile:Y.entryFile??kf1(Y.appRoot??bk0,"src","cli.ts"),launcher:Y.launcher};console.log=(...z)=>{U.push(No(z))},console.error=(...z)=>{I.push(No(z))};try{return await cf1($,K),{stdout:fq(U),stderr:fq(I),isError:!1,exitCode:0}}catch(z){let G=r8(z instanceof Error?z.message:String(z)),H=Zz(z);if(I.push(G),H.nextAction&&!G.includes("Next action:"))I.push(`\uD83D\uDC49 Next action: ${H.nextAction}`);return{stdout:fq(U),stderr:fq(I),isError:!0,exitCode:H.exitCode}}finally{console.log=Q,console.error=J}}async function cf1($,Y){let U=xq($),[I,Q,J]=U.command,K=I?.toLowerCase(),z=K?ff1.has(K):!1,G=z?"update":K;if(G==="version"||G==="v"||!G&&(Boolean(U.options.version)||Boolean(U.options.v)||Boolean(U.options.V))){let Z=Bk0(),q=Z?.latestVersion?f5(Z.latestVersion,tY.version):!1,V={...tY,...Z?.latestVersion?{latestVersion:Z.latestVersion,updateAvailable:q,lastCheckedAt:Z.checkedAt}:{}};if(q&&Z?.latestVersion)console.error(`\uD83D\uDCA1 发现新版本可用: v${tY.version} -> v${Z.latestVersion}`),console.error(`\uD83D\uDC49 Next action: seal-use update
`);if(j0(V),Ak0(Z))Pk0(Y.launcher);return}let H=lv0(U);if(H.isHelp){av0(H.target);return}if(!G||!uf1.has(G))throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`);if(G==="webhook"&&(Q==="resource-pack"||Q==="pack"||Q==="material-pack")&&J==="preview"){let Z=U.command[3]??R(U.options.file)??R(U.options.input);if(!Z)throw Error("Usage: seal-use webhook resource-pack preview <资源包.zip>");await ev0(Z,lz(U.options));return}if(G==="openapi"){dy0(U);return}if(G==="mcp-config"){Lr();return}if(G==="skill"){Xk0(Q,J,U);return}if(G==="mcp"||G==="server"){await by0(Q,U);return}if(G==="probe"){await ey0(Q,J,U);return}if(G==="doctor"){await Py0(Q,J,U);return}if(G==="test"){await Tr(Q,J,U);return}if(G==="config"){zg0(Q,J,U);return}if(G==="service"){await Br(Q,Y,U);return}if(G==="stop"){await Br("stop",Y,U);return}if(G==="http"||G==="serve"){await ky0(U);return}if(z||G==="changelog"){if(z&&I!=="update")console.error(`⚠️ Notice: '${I}' is an alias for 'seal-use update'. Please use 'seal-use update' instead.`);let Z=Q?.toLowerCase(),q=G==="changelog"||Z==="changelog"||Z==="log"||Z==="history"||z0(U.options.changelog)===!0,V=Z==="check"||z0(U.options.check)===!0||z0(U.options["check-only"])===!0,w=z0(U.options["bg-save"])===!0||z0(U.options["silent-save"])===!0,M=R(U.options.version)??R(U.options.tag)??(!q&&!V&&!w&&Q&&!Q.startsWith("-")?Q:void 0);await Sk0(Y,{checkOnly:V||w,changelogOnly:q,limit:l0(U.options.limit),force:z0(U.options.force),targetVersion:M,repo:R(U.options.repo),bgSave:w});return}if(G==="corps"||G==="corp"){if(Q==="regression"||Q==="test-regression"){await Tr("regression",J,U);return}await Yg0(Q,J,U);return}if(G==="rules"&&Q==="lint"&&(("file"in U.options)||("f"in U.options))){let Z;try{Z=M1(R(U.options.corp))}catch{Z={id:"local",name:"Local Workspace",source:{type:"native"}}}await Fr(Q,J,null,Z,U);return}if(G==="auth"&&(Q==="extract-keys"||Q==="extract-key"||Q==="extract-hose-keys"||Q==="hose-extract-keys")){await lo(J,U);return}if(G==="auth"&&(Q==="link"||Q==="seal-link")&&(("from-link"in U.options)||J==="from-link")){await XE(Q,null,U);return}let W=M1(R(U.options.corp));if(G==="source"){await qk0(Q,W);return}if(G==="auth"){await XE(Q,W,U);return}let X=await A1(W);if(G==="users"){await fk0(Q,J,X,W,U);return}if(G==="contacts"){await Hg0(Q,J,X,W,U);return}if(G==="data"){await Xg0(Q,X,W,U);return}if(G==="llm"){await fy0(Q,X,W,U);return}if(G==="permissions"){await my0(Q,X,W,U);return}if(G==="billing"){await Jg0(Q,X,W,U);return}if(G==="webhook"||G==="webhooks"){await pT(Q,J,X,W,U);return}if(G==="context"){await qg0(X,W,U);return}if(G==="documents"){await jy0(Q,J,X,W,U);return}if(G==="rules"){await Fr(Q,J,X,W,U);return}if(G==="approval-runs"){await $S0(Q,J,X,W,U);return}if(G==="analytics"){await US0(Q,J,X,W,U);return}if(G==="simulation"){await Gk0(Q,J,X,W,U);return}if(G==="deploy"){await Lg0(Q,J,U.command[3],X,W,U);return}if(G==="preference"||G==="preferences"){await ry0(Q,J,U.command[3],U.command[4],X,W,U);return}throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`)}var bk0,ff1,uf1,bf1,ik0;var qr=m(()=>{b6();z3();YS0();IS0();oo();Kg0();Gg0();Wg0();Zg0();Vg0();no();Fg0();Ty0();Cy0();xy0();uy0();iy0();py0();ly0();sy0();$k0();Uk0();Ar();Hk0();Zk0();Vk0();Mk0();xk0();Er();uk0();Bo();n8();N4();V4();Oo();e1();bk0=Rr(Rr(Rr(xf1(import.meta.url)))),ff1=new Set(["update","upgrade","up","self-update","selfupdate"]),uf1=new Set(["config","service","stop","http","serve","update","corps","corp","source","auth","users","contacts","data","llm","permissions","billing","webhook","webhooks","context","documents","rules","approval-runs","analytics","simulation","deploy","preference","preferences","mcp","server","mcp-config","skill","openapi","probe","doctor","changelog","test"]),bf1=new Set(["http","server","web","mcp"]);ik0=Promise.resolve()});function mf1($){let{command:Y}=xq($),U=(Y[0]??"").toLowerCase();return{area:nf1[U]??U,actionTokens:Y.slice(1).map((I)=>I.toLowerCase())}}function nk0($){let Y,U;try{({area:Y,actionTokens:U}=mf1($))}catch{return!1}if(U.length===0&&pf1.has(Y))return!0;let I=df1[Y];if(!I)return!1;return I.some((Q)=>{let J=Q.split(" ").filter(Boolean);if(J.length===0)return U.length===0;if(J.length>U.length)return!1;return J.every((K,z)=>K===U[z])})}var nf1,df1,pf1;var dk0=m(()=>{V4();nf1={corp:"corps",webhooks:"webhook",preferences:"preference"},df1={corps:["list","search","get","current"],rules:["count","list","versions","version","diff","get","search","lint","linters","pull","map"],documents:["list","get","search"],webhook:["ready","status","list","get","resource-pack export","resource-pack preview"],"approval-runs":["summary","stats","count","export","flow","list","search","pick","bridge","get","cited-rules","document-summary","attachments","result","link","url"],simulation:["batch-records","status","wait","specifications","approval-definitions","list","get","templates","integrations"],deploy:["hosecloud requi Line truncated
`)?"":`
`}`);process.exitCode=$.exitCode}var U7,nk0,TE="seal_cli",YV="seal_cli_write",dk0="SEAL_USE_MCP_ENABLED",pk0="SEAL_HOME_MCP_ENABLED",nf1;var ky0=m(async()=>{D00();P00();z6();zr();bk0();K$();K3();U7=if1(import.meta.url),nk0=U7.includes("/dist/mcp/")||U7.includes("\\dist\\mcp\\")?eq(eq(eq(U7))):eq(eq(U7));nf1=Boolean(K0.main==K0.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&ik0(process.argv[1])===ik0(U7));if(nf1)if(process.argv[2]==="--seal-use-cli")await cf1();else try{ok0()}catch($){console.error($),process.exitCode=1}});await ky0();export{oq as tokenizeCommand,ok0 as startServer,mk0 as resolveMcpEnabled,lk0 as createServer,dk0 as SEAL_MCP_ENABLED_ENV,YV as SEAL_CLI_WRITE_TOOL_NAME,TE as SEAL_CLI_TOOL_NAME,pk0 as LEGACY_SEAL_MCP_ENABLED_ENV};
`}`);process.exitCode=$.exitCode}var Q7,lk0,RE="seal_cli",QV="seal_cli_write",ok0="SEAL_USE_MCP_ENABLED",rk0="SEAL_HOME_MCP_ENABLED",rf1;var ny0=m(async()=>{j00();_00();H6();qr();dk0();n8();z3();Q7=lf1(import.meta.url),lk0=Q7.includes("/dist/mcp/")||Q7.includes("\\dist\\mcp\\")?UV(UV(UV(Q7))):UV(UV(Q7));rf1=Boolean(K0.main==K0.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&pk0(process.argv[1])===pk0(Q7));if(rf1)if(process.argv[2]==="--seal-use-cli")await of1();else try{tk0()}catch($){console.error($),process.exitCode=1}});await ny0();export{aq as tokenizeCommand,tk0 as startServer,sk0 as resolveMcpEnabled,ak0 as createServer,ok0 as SEAL_MCP_ENABLED_ENV,QV as SEAL_CLI_WRITE_TOOL_NAME,RE as SEAL_CLI_TOOL_NAME,rk0 as LEGACY_SEAL_MCP_ENABLED_ENV};
+1 -1
View File
@@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "seal-use Wrapped API",
"version": "0.10.38",
"version": "0.10.39",
"description": "HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter\n(`seal-use http`, or the `seal-use service start` daemon; default http://127.0.0.1:8787).\n\nThese endpoints describe the stable wrapped API for frontend developers and agents. They are\nnot the raw downstream Seal endpoints: seal-use is responsible for enterprise selection,\nsource authentication, response compaction, and diagnostics-friendly fields.\n\nEvery operation declares `x-implementation-status`, so a caller can tell what the running\nadapter actually serves:\n\n- `implemented` — routed by `src/http/routes.ts` today. `src/http/openapi-implementation.test.ts`\n fails when an `implemented` operation has no matching route.\n- `planned` — contract-only, designed but not routed yet. Calling it returns 404.\n\nThe same capabilities are reachable through the CLI, and through the optional MCP server when\nit is enabled.\n"
},
"servers": [
+1 -1
View File
@@ -1,7 +1,7 @@
openapi: 3.1.0
info:
title: seal-use Wrapped API
version: 0.10.38
version: 0.10.39
description: |
HTTP contract for the seal-use wrapped backend API, served by the local HTTP adapter
(`seal-use http`, or the `seal-use service start` daemon; default http://127.0.0.1:8787).
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "seal-use",
"version": "0.10.38",
"version": "0.10.39",
"private": true,
"description": "Seal tenant operations toolkit: approval-run diagnosis, rule remediation, Hose/合思 auth, plus a CLI and an optional MCP server.",
"license": "MIT",
+6 -6
View File
@@ -1,9 +1,9 @@
---
name: seal-use
description: "v0.10.38: Use for Seal Use enterprise onboarding, Hose/合思 or Seal-native authentication, approval operations, diagnosis, simulation, rules, users, configuration, and search."
description: "v0.10.39: Use for Seal Use enterprise onboarding, Hose/合思 or Seal-native authentication, approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
version: 0.10.38
short-description: Seal tenant and Hose approval automation (v0.10.38)
version: 0.10.39
short-description: Seal tenant and Hose approval automation (v0.10.39)
---
# Seal Use
@@ -15,7 +15,7 @@ CLI 是主执行通道。机器通道 `stdout` 必须是纯 JSON;诊断日志
- 机器字段保留 ISO 8601 UTC,精确到秒,不要添加毫秒,例如 `2026-09-22T04:56:06Z`。
- 面向用户解释时间时,换算为 `Asia/Shanghai`,明确标注“北京时间”;审计或消歧时同时保留原始 UTC。
- 不向用户暴露 Bearer、`accessToken`、`closeToken`、`appSecurity`、原始 cURL 或未脱敏手机号。
- 不向用户直接暴露底层 UUID、`tenantSlug`、`boundCorpRole` 等内部字段;优先使用企业名称、规则编号 `#xxxx` 和脱敏后的业务信息。
- 不向用户直接暴露底层 UUID、`tenantSlug`、`boundCorpRole` 等内部字段;优先使用企业名称、规则编号(例如 `0038`)和脱敏后的业务信息。
## 企业接入:先识别材料,再选择入口
@@ -72,7 +72,7 @@ Hose 专属命令应从命令名或选项中明确可见:`auth hose-*`、`appr
| `scope` | 适用场景 |
| `strictness` | 遵守程度 |
| `MUST_FOLLOW` / `SHOULD_FOLLOW` / `SUGGESTION` | 必须遵守 / 建议遵守 / 提示参考 |
| `code` | 规则编号,例如 `#0038` |
| `code` | 规则编号,例如 `0038` |
| `status` | 启用状态:已启用 / 已停用 / 草稿 |
| `description` | 规则内容 / 审核要求 |
@@ -93,7 +93,7 @@ Hose 专属命令应从命令名或选项中明确可见:`auth hose-*`、`appr
| 按单号、SN、record ID 查审批、结论、引用规则或直达链接 | `references/approval-run-lightweight.md` | 明确涉及附件/OCR/发票争议时,转读 `approval-attachment-trace.md` |
| CLI 参数、退出码或命令语法 | `references/cli.md` | 只查业务流程时不要加载本文件 |
| Webhook 资源包(ZIP/Excel 结构、附件校验、策略配置) | `references/webhook-resource-pack.md` | 只查命令语法时读 `cli.md`,不要加载本文件 |
| 规则数量、摘要列表、历史规则或知识搜索 | `references/rule-lightweight.md` | 需要质量评分/模糊表述检查时,改读 `rule-lint.md` |
| 规则数量、摘要列表、历史规则、制度文档(`documents`)或知识搜索 | `references/rule-lightweight.md` | 需要质量评分/模糊表述检查时,改读 `rule-lint.md` |
| 规则质量评分、lint、发布前质检 | `references/rule-lint.md` | 不要把 lint 问题直接当成客诉根因 |
| 客诉、截图/通知、预期业务行为,并要求诊断或修改规则 | `references/customer-feedback-rule-remediation.md` | 只有该流程明确要求附件追踪或测试发布时,才追加对应 reference |
| 附件、发票、收据、OCR 或界面高亮结论争议 | `references/approval-attachment-trace.md` | 先完成追踪和归因后,才读 `approval-bad-cases.md` 做案例对照 |
@@ -53,9 +53,9 @@ Use this when the user asks "AI 用了哪条规则", "为什么命中这条", or
seal-use approval-runs cited-rules <recordId> --corp <corpId>
```
Return and discuss `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.
Return and discuss `code`, `runtimeRuleId`, `ruleCode`, `versionNumber`, `scope`, `strictness`, `appliedAnalysis`, `checkResult`, and `findings` when present.
If the user then wants the full text of one cited rule, use `rules get --record-id <recordId> --runtime-id rule-205` from `rule-lightweight.md`.
If the user then wants the full text of one cited rule from that run's snapshot, use `seal-use rules get <code> --record-id <recordId> --corp <corpId>` from `rule-lightweight.md`.
## Attachments Without Raw Payloads
+62 -122
View File
@@ -42,21 +42,29 @@ 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 count [--version <number|latest>] [--corp <corpId>]
seal-use rules list [--version <number|latest>] [--summary] [--limit 20] [--offset 0] [--output-file <path>] [--corp <corpId>]
seal-use rules get <code> [--version <number|latest>] [--record-id <recordId>] [--corp <corpId>]
seal-use rules search <keyword> [--version <number|latest>] [--maxResults 20] [--corp <corpId>]
seal-use rules create --description <text> --scope <scope> [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--description-file <path>] [--corp <corpId>]
seal-use rules update <code> [--description <text>|--description-file <path>] [--scope <scope>] [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--corp <corpId>]
seal-use rules delete <code> --yes [--corp <corpId>]
seal-use rules publish <versionName> [--corp <corpId>]
seal-use rules versions [--corp <corpId>]
seal-use rules version <versionId|versionNumber|latest> [--corp <corpId>]
seal-use rules diff <fromVersion> <toVersion> [--rule-id <stableRuleId>|--code <code>] [--include-unchanged] [--full] [--corp <corpId>]
seal-use rules diff-one <fromVersion> <toVersion> <ruleId> [--full] [--corp <corpId>]
seal-use rules get '#0038' --corp <corpId> [--version <number|latest>]
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 version <versionNumber|latest> [--corp <corpId>]
seal-use rules diff <fromVersion> <toVersion> [--code <code>] [--include-unchanged] [--full] [--corp <corpId>]
seal-use rules lint [--file <path>] [--linter <name|path>] [--version <number|latest>] [--code <code>] [--min-score <score>] [--level all|error|warning] [--summary] [--corp <corpId>]
seal-use rules linters [--corp <corpId>]
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 rules pull [--version <number|latest>] [--out <file>] [--corp <corpId>]
seal-use rules push [--file <path>] [--publish] [--version-name <name>] [--dry-run|--yes] [--corp <corpId>]
seal-use rules clear [--dry-run|--yes] [--corp <corpId>]
seal-use rules map [--version <number|latest>] [--code <code>] [--corp <corpId>]
seal-use documents list [--scenarios <audit,fill>] [--limit 50] [--offset 0] [--corp <corpId>]
seal-use documents get <documentId> [--corp <corpId>]
seal-use documents search <keyword> [--maxResults 20] [--corp <corpId>]
seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]
seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]
seal-use documents delete <documentId> --yes [--corp <corpId>]
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]
@@ -76,7 +84,6 @@ seal-use doctor guide
seal-use doctor paths
seal-use test regression [--corp <corpId>] [--samples <N>] [--dry-run] [--fail-on-flips]
seal-use probe [<corpId>]
seal-use tools list
seal-use corps list [query] [--env <production|test>] [--limit <n>] [--all] [--strict] [--corp <corpId>]
seal-use corps search <query> [--env <production|test>] [--strict]
seal-use corps get <corpId>
@@ -146,7 +153,6 @@ seal-use preference thinking-depth policies upsert --json '{...}' [--dry-run] [-
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]
seal-use approval-runs stats --corp <corpId> [--since 3months] [--dedupe-by sourceDocumentSN|sourceDocumentId|id]
seal-use analytics insight --corp <corpId> [--start-date <ISO>] [--end-date <ISO>] [--limit <n>]
@@ -274,23 +280,30 @@ Test Enterprise Binding, Staging Synchronization & Automated Regression Testing:
Approval rule maintenance:
- `seal-use rules count [--corp <corpId>]`
- `seal-use rules list --summary [--corp <corpId>]`
- `seal-use rules diff <fromVersion> <toVersion> [--rule-id <stableRuleId>|--code <code>] [--include-unchanged] [--full] [--corp <corpId>]` (uses a locally persisted stable ID map when available, otherwise falls back to code, and returns structured changes plus a Git-style `unifiedDiff`; oversized output is truncated only when it exceeds the safety limit)
- `seal-use rules diff-one <fromVersion> <toVersion> <ruleId> [--full] [--corp <corpId>]` (single-rule view; use `--code` with `rules diff` for snapshots without stable IDs)
- `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 count [--version <number|latest>] [--corp <corpId>]`
- `seal-use rules list [--version <number|latest>] [--summary] [--limit 20] [--offset 0] [--output-file <path>] [--corp <corpId>]`
- `seal-use rules get <code> [--version <number|latest>] [--record-id <recordId>] [--corp <corpId>]`
- `seal-use rules search <keyword> [--version <number|latest>] [--maxResults 20] [--corp <corpId>]`
- `seal-use rules create --description <text> --scope <scope> [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--description-file <path>] [--corp <corpId>]`
- `seal-use rules update <code> [--description <text>|--description-file <path>] [--scope <scope>] [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--corp <corpId>]`
- `seal-use rules delete <code> --yes [--corp <corpId>]`
- `seal-use rules publish <versionName> [--corp <corpId>]`
- `seal-use rules versions [--corp <corpId>]`
- `seal-use rules version <versionNumber|latest> [--corp <corpId>]`
- `seal-use rules diff <fromVersion> <toVersion> [--code <code>] [--include-unchanged] [--full] [--corp <corpId>]` (returns structured changes plus a Git-style `unifiedDiff`; oversized output is truncated only when it exceeds the safety limit)
- `seal-use rules lint [--file <path>] [--linter <name|path>] [--version <number|latest>] [--code <code>] [--min-score <score>] [--level all|error|warning] [--summary] [--corp <corpId>]`
- `seal-use rules linters [--corp <corpId>]` (lists official and custom linters with directory specs: `~/.config/seal-use/linters` and `official/`)
- `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.
- `seal-use rules clear [--corp <corpId>] [--dry-run|--yes]`
- `seal-use rules pull [--version <number|latest>] [--out <file>] [--corp <corpId>]`
- `seal-use rules push [--file <path>] [--publish] [--version-name <name>] [--dry-run|--yes] [--corp <corpId>]` 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.
- `seal-use rules clear [--dry-run|--yes] [--corp <corpId>]`
- `seal-use rules map [--version <number|latest>] [--code <code>] [--corp <corpId>]` (reads local sync rule mapping snapshot)
Rule identity and versioning:
Rule identity and versioning (Draft by default vs. `--version latest`):
- `rules list` and `rules pull` read the current **draft** rule set. Their `code` values belong to the draft code space.
- A published version has its own snapshot and code space. Publishing can recode rules, so a published `code` may differ from the draft `code`, and codes can shift again after later edits and publishes.
- Published snapshots currently omit stable IDs. The publish flow therefore persists a local code-to-draft-ID map under `~/.config/seal-use/rule-version-snapshots/`; `rules diff` hydrates that map when available and otherwise matches by normalized code. Code fallback can make reorderings look like remove/add or modified rules, and the response includes a confidence warning.
- `rules get <ruleCode> --version ...` interprets the rule number inside that selected published version, while `rules get --record-id ... --runtime-id ...` resolves the version recorded on the run. The legacy `--code` form remains accepted for compatibility.
- **Default = Current Draft**: Whenever `--version` is omitted, `rules count`, `rules list`, `rules get <code>`, `rules search`, `rules lint`, and `rules pull` **always read the current draft**.
- **Latest Published Version = `--version latest`**: To inspect the latest published version, you **must explicitly pass `--version latest`** (or `--version <number>` for a specific historical version, or `rules version latest` for the full version snapshot).
- In Seal, every rule has a 4-digit zero-padded `code` (`0000, 0001, 0025, 0038, ...`).
- A published version has its own snapshot and `code` space. Publishing or deleting rules can shift `code` numbers across versions, so always pair `code` with `--version` or `--record-id` when inspecting historical approval runs.
Approval run lightweight queries:
@@ -304,15 +317,16 @@ Approval run lightweight queries:
- `seal-use approval-runs attachments download <recordId> [--all] [--name <name>] [--out-dir <dir>] --corp <corpId>`
- `seal-use approval-runs result <recordId> --corp <corpId> --summary`
Approval knowledge documents & style:
Approval knowledge documents:
- `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 '#0038' --corp <corpId> [--version <number|latest>]`
- `seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205`
- `seal-use documents list [--scenarios <audit,fill>] [--limit 50] [--offset 0] [--corp <corpId>]`
- `seal-use documents get <documentId> [--corp <corpId>]`
- `seal-use documents search <keyword> [--maxResults 20] [--corp <corpId>]`
- `seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]`
- `seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]`
- `seal-use documents delete <documentId> --yes [--corp <corpId>]` (删除前必须重新读取并确认;若只是暂时撤下内容,优先使用 `documents update <documentId> --enabled false`)
`--type` 必须是 `document`、`video`、`pdf`、`feishu_doc` 或 `policy`(默认)之一;`--scenarios` 至少包含一个 `fill`(智能填单)或 `audit`(智能审核,默认)。这里的 `scenarios` 是产品能力开关,不是费用类别或业务场景名。
Webhook integrations:
@@ -371,28 +385,32 @@ seal-use auth check --corp <corpId>
The diagnostic stages are `hose.openapi`, `hose.provisional`, `seal.sso`, and `seal.whoami`. Tokens are omitted from output.
Search approval content:
Search approval rules or knowledge documents:
```bash
seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["关键词"],"matchMode":"any","maxResults":20}'
seal-use rules search <keyword> --maxResults 20 --corp <corpId>
seal-use documents search <keyword> --maxResults 20 --corp <corpId>
```
Get aggregated approval context:
```bash
seal-use tool seal_approval_context_get --corp <corpId> --json '{"documentLimit":20}'
seal-use context --documentLimit 20 --corp <corpId>
```
Create a draft approval rule:
Create, update, and publish approval rules:
```bash
seal-use tool seal_approval_rule_create --corp <corpId> --json '{"description":"规则描述","scope":"适用场景","strictness":"SHOULD_FOLLOW"}'
seal-use rules create --description "规则描述" --scope "适用场景" --strictness SHOULD_FOLLOW --corp <corpId>
seal-use rules update 25 --description "更新后的规则描述" --corp <corpId>
seal-use rules publish "版本名称" --corp <corpId>
```
Update an approval document:
Create and update an approval knowledge document:
```bash
seal-use tool seal_approval_document_update --corp <corpId> --json '{"documentId":"doc-id","content":"Markdown 内容"}'
seal-use documents create --title "标题" --purpose "用途" --content-file ./policy.md --type policy --scenarios audit --corp <corpId>
seal-use documents update <documentId> --content-file ./policy.md --corp <corpId>
```
Summarize one local date:
@@ -431,84 +449,6 @@ seal-use simulation templates --corp <corpId>
seal-use simulation integrations --corp <corpId>
```
## Write Operation Payloads
Create a rule:
```json
{
"description": "规则描述",
"scope": "适用场景",
"strictness": "MUST_FOLLOW | SHOULD_FOLLOW | SUGGESTION"
}
```
Update a rule:
```json
{
"ruleId": "rule-id",
"description": "可选",
"scope": "可选",
"strictness": "SHOULD_FOLLOW"
}
```
Publish a rule version:
```json
{
"versionName": "版本名称"
}
```
Create a document:
```json
{
"title": "标题",
"purpose": "用途",
"content": "Markdown 内容",
"contentType": "policy",
"status": "published",
"scenarios": ["audit"],
"tags": ["标签"]
}
```
`contentType` 必须是 `document`、`video`、`pdf`、`feishu_doc` 或 `policy` 之一;`scenarios` 必填且至少包含一个 `fill`(智能填单)或 `audit`(智能审核)。这里的 `scenarios` 是产品能力开关,不是费用类别或业务场景名。
知识文档支持通过 `seal_approval_delete_document` 删除,且 `corps sync-test` 会在按标题对账时删除测试企业中多余的文档;删除仍是破坏性写操作,必须在写入前重新读取并确认标题/ID。若只是暂时撤下内容,优先使用更新操作并设置 `enabled: false`。
Update a document:
```json
{
"documentId": "doc-id",
"title": "可选",
"purpose": "可选",
"content": "可选",
"enabled": true,
"scenarios": ["可选"],
"tags": ["可选"]
}
```
Update style preferences:
```json
{
"tone": "可选",
"language": "可选",
"detailLevel": "可选",
"outputFormat": "可选",
"examples": ["可选"],
"prohibitedPhrases": ["可选"],
"customInstructions": "可选"
}
```
## Failure Handling
- CLI commands are short-lived processes. In-memory auth/search caches only live for that single process. Use `seal-use service restart` after updates so the optional local service picks up new code.
@@ -121,7 +121,7 @@ State the target enterprise, target rule code, changed fields, preserved fields,
1. **用户侧隐藏系统内部机器标识**:
- 严禁向用户直接输出系统内部持久化 UUID(如 `01a00f34-...`)或无意义哈希;
- 统一使用用户与管理后台唯一认知的业务编号:`规则 code: #xxxx`。
- 统一使用用户与管理后台唯一认知的业务编号:`规则 code: 0016`。
2. **严格采用系统原生业务术语(Vocabulary Contract)**:
- **适用场景**(对应系统字段 `scope`):严禁自创为“适用范围”或“适用模版”;若未修改,必须原样完整呈现其配置值,向用户证明未篡改触发条件;
- **遵守程度**(对应系统字段 `strictness`):严禁自创为“执行力度”或“严格度”;一律采用标准纯中文术语:
@@ -144,7 +144,7 @@ State the target enterprise, target rule code, changed fields, preserved fields,
---
#### 规则 code: #0016
#### 规则 code: 0016
- **适用场景**:单据模板=对公付款单
- **遵守程度**:必须遵守
@@ -172,14 +172,13 @@ Immediately before updating:
## 8. Update and verify the draft
Send only approved fields. For a description-only change:
Send only approved fields. For a description-only change (prefer `--description-file` when the rule text contains quotes or multiple lines):
```bash
seal-use tool seal_approval_rule_update --corp <corpId> \
--json '{"ruleId":"<ruleId>","description":"<confirmed description>"}'
seal-use rules update <code> --description-file /tmp/rule-desc.txt --corp <corpId>
```
Do not send `scope` or `strictness` when they are unchanged. Fetch the draft again and verify the exact description, scope, strictness, and draft status before publishing.
Do not pass `--scope` or `--strictness` when they are unchanged. Fetch the draft again (`seal-use rules get <code> --corp <corpId>`) and verify the exact description, scope, strictness, and draft status before publishing.
For a complete local rule-set sync, `rules push` is incremental: it matches pulled rules by stable `id`, updates only changed fields, creates new entries, and removes entries omitted from the local file. It preserves matched rule IDs and does not recode the whole draft. Preview it with `rules push --dry-run` before applying.
@@ -188,8 +187,7 @@ For a complete local rule-set sync, `rules push` is incremental: it matches pull
Publish only when explicitly authorized:
```bash
seal-use tool seal_approval_rule_version_publish --corp <corpId> \
--json '{"versionName":"<specific business change>"}'
seal-use rules publish "<specific business change>" --corp <corpId>
```
Verify after publishing:
@@ -247,7 +245,7 @@ Do not automatically rerun or resubmit the customer's production document. Run a
- **根因分类**:严格按 `CAUSE_CLASSIFIED` 5 大类输出(如 `RULE_DEFINITION`)
- **推理链路比对**:对照说明争议单据的误判逻辑与标杆单据的思考逻辑
3. **规则修改明细与完整前后文对比 (Rule Changes & Full Context)**:
- **规则 code**:标准格式如 `#0016`
- **规则 code**:标准格式如 `0016`
- **适用场景**:完整呈现修改前与修改后(如有改动需说明)
- **遵守程度**:必须遵守 / 建议遵守 / 提示参考
- **修改前完整描述 (Before)**:原样呈现修改前规则全貌
+44 -58
View File
@@ -1,19 +1,25 @@
# 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.
Use this reference when the user wants rule counts, compact rule lists, one rule from draft or a historical version, or approval rule search without dumping hundreds of rule descriptions.
## Draft and Published Rule Codes
## Draft Default vs. Published Version (`--version latest`)
`rules list` and `rules pull` operate on the current draft and therefore return draft `code` values. A published version stores a separate snapshot and may recode the same rules; publishing, deleting, or reordering rules can make those published codes differ or drift again. A code such as `#0038` is only meaningful together with its version context.
Every rule has a 4-digit zero-padded `code` (`0000, 0001, 0025, 0038, ...`).
Use the draft `id` for current edits and use the approval run's recorded version plus rule text or runtime rule ID for historical investigations. Do not copy a draft code into a report or command that will be interpreted against a published version.
- **Default = Current Draft (`草稿`)**: When `--version` is omitted, `rules count`, `rules list`, `rules get <code>`, `rules search`, `rules lint`, and `rules pull` **all read the current draft**.
- **Latest Published Version = `--version latest` (`最新发布`)**: To inspect the latest published version, **always pass `--version latest`** (or `--version <number>` for a specific historical version).
- Publishing or deleting rules can shift `code` numbers across versions, so a `code` in a historical run must be resolved together with `--version <number>` or `--record-id <recordId>`.
## Count Rules
Use count when only scale or existence matters.
```bash
# Count current draft rules (default)
seal-use rules count --corp <corpId>
# Count rules in latest published version
seal-use rules count --version latest --corp <corpId>
```
Expected shape:
@@ -22,27 +28,47 @@ Expected shape:
{ "count": 191 }
```
Tool-layer equivalent:
```bash
seal-use tool seal_approval_rules_list --corp <corpId> --json '{"countOnly":true}'
seal-use tool seal_approval_rules_list --corp <corpId> --json '{"fields":["id"],"limit":0}'
```
## List Rule Summaries
Use summaries for navigation and selection.
```bash
seal-use rules list --corp <corpId> --summary
# List current draft rule summaries (default)
seal-use rules list --summary --corp <corpId>
# List latest published version rule summaries
seal-use rules list --version latest --summary --corp <corpId>
```
Default summary should include only fields such as `id`, `code`, `scope`, `strictness`, `status`, and `updatedAt`. Do not pull `description` unless the user needs rule text.
Default summary includes `code`, `status`, `strictness`, `scope`, and `updatedAt`. Do not pull full `description` fields across all rules unless the user needs rule text.
Tool-layer equivalent:
## Get One Rule (Draft or Published Version)
Read a single rule from the current draft (default):
```bash
seal-use tool seal_approval_rules_list --corp <corpId> --json '{"fields":["id","code","scope","strictness","status","updatedAt"]}'
seal-use rules get 0038 --corp <corpId>
```
Read a single rule from the latest published version, a specific published version, or the version used by an approval run:
```bash
seal-use rules get 0038 --version latest --corp <corpId>
seal-use rules get 0038 --version 16 --corp <corpId>
seal-use rules get 0205 --record-id <recordId> --corp <corpId>
```
Returns `id`, `code`, `ruleCode`, `runtimeRuleId`, `description`, `scope`, `strictness`, `status`, and version metadata when reading from a published version.
## Search Rules Compactly
```bash
# Search current draft rules (default)
seal-use rules search <keyword> --maxResults 20 --corp <corpId>
# Search latest published version or a specific historical version
seal-use rules search <keyword> --version latest --maxResults 20 --corp <corpId>
seal-use rules search <keyword> --version 16 --maxResults 20 --corp <corpId>
```
## Clear Draft Rules Before Import
@@ -50,8 +76,8 @@ seal-use tool seal_approval_rules_list --corp <corpId> --json '{"fields":["id","
Use this for test tenants when the next step is importing another tenant's rule set. Always preview first unless the user has already confirmed the exact tenant.
```bash
seal-use rules clear --corp <corpId> --dry-run
seal-use rules clear --corp <corpId> --yes
seal-use rules clear --dry-run --corp <corpId>
seal-use rules clear --yes --corp <corpId>
```
Expected shape:
@@ -66,46 +92,6 @@ Expected shape:
}
```
Tool-layer equivalent:
```bash
seal-use tool seal_approval_rules_clear --corp <corpId> --json '{"dryRun":true}'
seal-use tool seal_approval_rules_clear --corp <corpId> --json '{"dryRun":false}'
```
## Get One Historical Rule
Use this when a run used a historical rule version and current rules may differ.
```bash
seal-use rules get '#0038' --corp <corpId> --version 16
seal-use rules get '#0038' --corp <corpId> --version latest
```
If the user starts from a run and a runtime ID such as `rule-205`, resolve against that run:
```bash
seal-use rules get --corp <corpId> --record-id <recordId> --runtime-id rule-205
```
Return the single rule text plus `scope`, `strictness`, `status`, `versionNumber`, and version metadata. Avoid commands that dump a whole rule version unless the user asks for the full version.
## Search Approval Knowledge Compactly
Prefer scoped and trimmed search:
```bash
seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["关键词"],"areas":["rules"],"matchMode":"any","maxResults":20,"snippetOnly":true,"maxChars":500,"fields":["id","title","snippet"]}'
```
When investigating historical behavior, search the matching rule version if the API supports it:
```bash
seal-use tool seal_approval_search --corp <corpId> --json '{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","versionNumber":16,"snippetOnly":true,"maxChars":500}'
```
Use current search only when the question is about current draft/current knowledge, not why a historical run behaved a certain way.
## 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.
If a rule command would return many descriptions or more than about 20 rules, use `rules count`, `rules list --summary`, `rules search`, or `--output-file`. Use `--full` only for deliberate exports.
+3 -3
View File
@@ -7,7 +7,7 @@ Use this reference when analyzing, validating, or linting Seal AI approval rules
- **Default State**: Linter is **disabled by default** in global configuration (`lint.enabled: false`) to avoid unsolicited noise during standard operations.
- **Doctor Visibility**: `seal-use doctor` audits the rule linter configuration state and active linter name in its health checks, and surfaces a one-click hint (`seal-use config lint enable`) when disabled.
- **Explicit Triggering**: `seal-use rules lint` always runs regardless of global configuration.
- **Draft Hook**: When `seal-use config lint enable` is set, `seal_approval_rule_update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.
- **Draft Hook**: When `seal-use config lint enable` is set, `seal-use rules update` outputs real-time diagnostic warnings to `stderr` without mutating `stdout` payloads.
- **Fault-Tolerant Fallback**: If a custom `.ts` linter file has syntax errors, runtime exceptions, or is missing, the engine logs a warning to `stderr` and **silently falls back to the built-in heuristic linter without failing**.
## CLI Commands
@@ -24,8 +24,8 @@ seal-use rules lint --corp <corpId>
# Lint rules in published version 16
seal-use rules lint --version 16 --corp <corpId>
# Lint a specific rule by code (#0038)
seal-use rules lint --code '#0038' --corp <corpId>
# Lint a specific rule by code
seal-use rules lint --code 0038 --corp <corpId>
# Summary mode (only show rules with issues)
seal-use rules lint --summary --corp <corpId>
@@ -32,7 +32,7 @@ flowchart TD
C --> D["Stage 4: 自动化规则回归测试矩阵与模拟验证 (test regression / simulation)"]
D --> E{"回归与模拟是否通过 (safeToPublish)?"}
E -- 存在偏差/翻转误伤 --> B
E -- 验证通过 --> F["Stage 5: 生产环境正式发布 (rules push --publish)"]
E -- 验证通过 --> F["Stage 5: 生产环境正式发布 (rules publish)"]
```
---
@@ -83,18 +83,18 @@ flowchart TD
1. **锁定目标企业与规则定位**:
```bash
# 查询生产企业当前生效规则与草稿规则
seal-use rules list --corp <prodCorpId> --summary
# 精确读取某条目标规则
seal-use rules get <ruleCode> --corp <prodCorpId>
# 查询生产企业当前草稿规则摘要列表
seal-use rules list --summary --corp <prodCorpId>
# 按编号精确读取某条目标草稿规则
seal-use rules get <code> --corp <prodCorpId>
```
2. **仅修改草稿(保持生产未发布)**:
- 提取最小修改建议(只改动必要的描述语句,保留 `scope` 与 `strictness`)。
- 使用规则更新或创建接口修改生产企业草稿:
- 修改生产企业草稿规则(含引号或换行时优先使用 `--description-file`):
```bash
seal-use tool seal_approval_rule_update --corp <prodCorpId> --json '{"ruleId":"...","description":"..."}'
seal-use rules update <code> --description-file /tmp/rule-desc.txt --corp <prodCorpId>
```
- **最佳安全建议**:修改草稿后,建议先不调用 `seal-use rules push --publish --corp <prodCorpId>`,而是先引导用户同步至测试企业进行单据模拟验证;若用户明确要求直接投产,则严格遵从用户指示执行发布。
- **最佳安全建议**:修改草稿后,建议先不调用 `seal-use rules publish` 直接发布生产,而是先引导用户同步至测试企业进行单据模拟验证;若用户明确要求直接投产,则严格遵从用户指示执行发布。
---
@@ -210,6 +210,6 @@ flowchart TD
4. **生产环境最终投产 (Final Production Release)**:
仅当测试环境所有单据的模拟判定结果完全符合预期时,才在生产企业执行正式发布:
```bash
seal-use tool seal_approval_rules_publish --corp <prodCorpId> --json '{"versionName":"审核规则 版本N"}'
seal-use rules publish "审核规则 版本N" --corp <prodCorpId>
```
发布后核实版本状态,完成业务安全闭环。
@@ -127,11 +127,11 @@ When a push fails because of the attachment policy, the error is actionable and
3. If configuration change is authorized, read the current policy with `webhook get`/`webhook list`, update only the necessary fields, and verify the returned configuration.
4. Retry the original `material-pack push`; it will load the latest saved policy before any upload begins.
The same loop is available through the internal tool registry: read with `seal-use tool seal_webhook_get`/`seal_webhook_list`, update with `seal-use tool seal_webhook_update` and its `materialPackFilePolicy` patch, then retry `seal-use tool seal_webhook_material_pack` in `push` mode. Over MCP these run through `seal_cli` (reads) or `seal_cli_write` (the update and push, which need user confirmation); no separate `seal_webhook_*` MCP tool exists. Set `maxFileSizeBytes` to `null` to clear the upper bound. `allowedExtensions` is a complete replacement list, so include existing allowed suffixes when adding one.
Use `--clear-max-file-size` on `seal-use webhook update` to remove the upper bound. `--allowed-extensions` is a complete replacement list, so include existing allowed suffixes when adding one.
If the assistant lacks permission to update the Webhook or the user does not authorize relaxing the rule, report the block rather than bypassing validation. Since validation happens before the upload loop, a failed attempt does not leave a partially pushed material pack.
The direct local `material-pack preview` command and the tool-registry preview use the default or temporary policy. They do not automatically read a selected Webhook's persisted policy. Use `webhook ready --file --webhook <idOrName>` or the actual push path when validating against the saved inbound policy.
The direct local `resource-pack preview` command uses the default or temporary policy. It does not automatically read a selected Webhook's persisted policy. Use `seal-use webhook ready <资源包.zip> --webhook <idOrName>` or the actual push path when validating against the saved inbound policy.
### Error messages reference
+20 -4
View File
@@ -97,12 +97,28 @@ describe("CLI version & help handling", () => {
expect(JSON.parse(result.stdout)).toMatchObject({ id: "corp-a" });
});
test("keeps the fine-grained tool command reachable in stateless mode", () => {
test("keeps the documents domain reachable in stateless mode", () => {
const env = makeConfigEnv();
const result = runCli(["tool", "unknown-tool", "--corp", "corp-a"], env);
const result = runCli(["documents", "get", "--corp", "corp-a"], env);
expect(result.status).toBe(1);
expect(result.stderr).toContain("Unknown Seal tool: unknown-tool");
expect(result.status).toBe(2);
expect(result.stderr).toContain("Usage: seal-use documents get <documentId>");
});
test("requires --yes confirmation on documents delete", () => {
const env = makeConfigEnv();
const result = runCli(["documents", "delete", "doc-123", "--corp", "corp-a"], env);
expect(result.status).toBe(10);
expect(result.stderr).toContain("Refusing to delete document 'doc-123' without --yes.");
});
test("does not hijack --version option when passed to subcommands like rules", () => {
const env = makeConfigEnv();
const result = runCli(["rules", "get", "--version", "latest", "--corp", "corp-a"], env);
expect(result.status).toBe(2);
expect(result.stderr).toContain("Usage: seal-use rules get <code>");
});
test("can enable stateful mode and select a default corp", () => {
+234
View File
@@ -0,0 +1,234 @@
import { readFileSync } from "node:fs";
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { confirmationRequired } from "../errors.js";
import { runTool } from "../helpers.js";
import {
booleanOption,
jsonObject,
numberOption,
splitOption,
stringOption
} from "../parser.js";
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
function readContentInput(args: ParsedArgs, payload: Record<string, unknown>): string | undefined {
const filePath =
stringOption(args.options.contentFile) ??
stringOption(args.options["content-file"]) ??
stringOption(args.options.file) ??
stringOption(args.options.f);
if (filePath) {
return readFileSync(filePath, "utf8");
}
const direct = stringOption(args.options.content);
if (direct !== undefined) return direct;
return typeof payload.content === "string" ? payload.content : undefined;
}
export async function handleDocumentsCommand(
action: string | undefined,
maybeName: string | undefined,
client: Awaited<ReturnType<typeof createSealClient>>,
corp: CorpConfig,
args: ParsedArgs
) {
if (!action || action === "list") {
const scenarios = splitOption(args.options.scenarios);
const limit = numberOption(args.options.limit);
const offset = numberOption(args.options.offset);
await runTool(
"seal_approval_documents_list",
client,
corp,
{ scenarios, limit, offset },
outputOptions(args.options)
);
return;
}
if (action === "get") {
const documentId =
(maybeName && !maybeName.startsWith("-") ? maybeName : undefined) ??
stringOption(args.options.documentId) ??
stringOption(args.options["document-id"]) ??
stringOption(args.options.id);
if (!documentId) {
throw new Error("Usage: seal-use documents get <documentId> [--corp <corpId>]");
}
await runTool(
"seal_approval_document_get",
client,
corp,
{ documentId },
outputOptions(args.options)
);
return;
}
if (action === "search") {
const keyword = maybeName ?? stringOption(args.options.query);
if (!keyword) {
throw new Error("Usage: seal-use documents search <keyword> [--maxResults 20] [--corp <corpId>]");
}
await runTool(
"seal_approval_search",
client,
corp,
{
keywords: [keyword],
areas: ["documents"],
maxResults: numberOption(args.options.maxResults),
contextLines: numberOption(args.options.contextLines),
refresh: booleanOption(args.options.refresh),
snippetOnly: booleanOption(args.options.snippetOnly) ?? booleanOption(args.options["snippet-only"]),
maxChars: numberOption(args.options.maxChars) ?? numberOption(args.options["max-chars"]),
fields: splitOption(args.options.fields)
},
outputOptions(args.options)
);
return;
}
if (action === "create") {
const payload = jsonObject(args.json);
const title = stringOption(args.options.title) ?? (typeof payload.title === "string" ? payload.title : undefined);
const purpose = stringOption(args.options.purpose) ?? (typeof payload.purpose === "string" ? payload.purpose : undefined);
const content = readContentInput(args, payload);
const contentType =
stringOption(args.options.type) ??
stringOption(args.options.contentType) ??
stringOption(args.options["content-type"]) ??
(typeof payload.contentType === "string" ? payload.contentType : "policy");
const status =
stringOption(args.options.status) ??
(typeof payload.status === "string" ? payload.status : "published");
const enabled =
booleanOption(args.options.enabled) ??
(typeof payload.enabled === "boolean" ? payload.enabled : undefined);
const scenarios =
splitOption(args.options.scenarios) ??
(Array.isArray(payload.scenarios) ? (payload.scenarios as string[]) : ["audit"]);
const tags =
splitOption(args.options.tags) ??
(Array.isArray(payload.tags) ? (payload.tags as string[]) : undefined);
if (!title || !purpose || content === undefined) {
throw new Error(
"Usage: seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]"
);
}
await runTool(
"seal_approval_document_create",
client,
corp,
{
title,
purpose,
content,
contentType,
status,
enabled,
scenarios,
tags
},
outputOptions(args.options)
);
return;
}
if (action === "update") {
const payload = jsonObject(args.json);
const documentId =
(maybeName && !maybeName.startsWith("-") ? maybeName : undefined) ??
stringOption(args.options.documentId) ??
stringOption(args.options["document-id"]) ??
stringOption(args.options.id) ??
(typeof payload.documentId === "string" ? payload.documentId : undefined);
const title = stringOption(args.options.title) ?? (typeof payload.title === "string" ? payload.title : undefined);
const purpose = stringOption(args.options.purpose) ?? (typeof payload.purpose === "string" ? payload.purpose : undefined);
const content = readContentInput(args, payload);
const contentType =
stringOption(args.options.type) ??
stringOption(args.options.contentType) ??
stringOption(args.options["content-type"]) ??
(typeof payload.contentType === "string" ? payload.contentType : undefined);
const status =
stringOption(args.options.status) ??
(typeof payload.status === "string" ? payload.status : undefined);
const enabled =
booleanOption(args.options.enabled) ??
(typeof payload.enabled === "boolean" ? payload.enabled : undefined);
const scenarios =
splitOption(args.options.scenarios) ??
(Array.isArray(payload.scenarios) ? (payload.scenarios as string[]) : undefined);
const tags =
splitOption(args.options.tags) ??
(Array.isArray(payload.tags) ? (payload.tags as string[]) : undefined);
const hasChanges =
title !== undefined ||
purpose !== undefined ||
content !== undefined ||
contentType !== undefined ||
status !== undefined ||
enabled !== undefined ||
scenarios !== undefined ||
tags !== undefined;
if (!documentId || !hasChanges) {
throw new Error(
"Usage: seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]"
);
}
await runTool(
"seal_approval_document_update",
client,
corp,
{
documentId,
title,
purpose,
content,
contentType,
status,
enabled,
scenarios,
tags
},
outputOptions(args.options)
);
return;
}
if (action === "delete") {
const documentId =
(maybeName && !maybeName.startsWith("-") ? maybeName : undefined) ??
stringOption(args.options.documentId) ??
stringOption(args.options["document-id"]) ??
stringOption(args.options.id);
if (!documentId) {
throw new Error("Usage: seal-use documents delete <documentId> --yes [--corp <corpId>]");
}
const confirmed = booleanOption(args.options.yes) === true || booleanOption(args.options.confirm) === true;
if (!confirmed) {
throw confirmationRequired(
`Refusing to delete document '${documentId}' without --yes.`,
`seal-use documents delete ${documentId} --corp ${corp.id} --yes`
);
}
await runTool(
"seal_approval_delete_document",
client,
corp,
{ documentId },
outputOptions(args.options)
);
return;
}
throw new Error(`Unknown documents command: ${action}. Available: list, get, search, create, update, delete.`);
}
+146 -21
View File
@@ -1,3 +1,4 @@
import { readFileSync } from "node:fs";
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";
@@ -10,6 +11,7 @@ import { runTool, runToolResult } from "../helpers.js";
import { confirmationRequired } from "../errors.js";
import {
booleanOption,
jsonObject,
numberOption,
parseRuleVersionSelector,
ruleVersionGetOptions,
@@ -25,6 +27,26 @@ import {
} from "../printer.js";
import type { ParsedArgs } from "../types.js";
function readDescriptionInput(args: ParsedArgs, payload: Record<string, unknown>): string | undefined {
const filePath =
stringOption(args.options.descriptionFile) ??
stringOption(args.options["description-file"]);
if (filePath) {
return readFileSync(filePath, "utf8").trim();
}
const direct = stringOption(args.options.description) ?? stringOption(args.options.desc);
if (direct !== undefined) return direct;
return typeof payload.description === "string" ? payload.description : undefined;
}
function resolveVersionOption(args: ParsedArgs, fallback?: string): string | undefined {
const explicit = stringOption(args.options.version);
if (explicit !== undefined) return explicit;
if (booleanOption(args.options.latest)) return "latest";
if ( fallback !== undefined && !fallback.startsWith("-") ) return fallback;
return undefined;
}
export async function handleRulesCommand(
action: string | undefined,
maybeName: string | undefined,
@@ -39,13 +61,15 @@ export async function handleRulesCommand(
}
if (action === "count") {
await runTool("seal_approval_rules_list", client!, corp, { countOnly: true }, outputOptions(args.options));
const version = resolveVersionOption(args);
await runTool("seal_approval_rules_list", client!, corp, { version, countOnly: true }, outputOptions(args.options));
return;
}
if (action === "list") {
const version = resolveVersionOption(args);
if (booleanOption(args.options.count)) {
await runTool("seal_approval_rules_list", client!, corp, { countOnly: true }, outputOptions(args.options));
await runTool("seal_approval_rules_list", client!, corp, { version, countOnly: true }, outputOptions(args.options));
return;
}
@@ -57,6 +81,7 @@ export async function handleRulesCommand(
client!,
corp,
{
version,
fields: RULE_SUMMARY_FIELDS,
limit,
offset
@@ -66,7 +91,7 @@ export async function handleRulesCommand(
return;
}
const result = await runToolResult("seal_approval_rules_list", client!, corp, { limit, offset });
const result = await runToolResult("seal_approval_rules_list", client!, corp, { version, limit, offset });
const output = outputOptions(args.options);
protectLargeRuleListOutput(result, output.allowFull === true || Boolean(output.outputFile));
printJson(result, output);
@@ -106,8 +131,8 @@ export async function handleRulesCommand(
}
if (action === "version") {
const version = maybeName ?? stringOption(args.options.version);
if (!version) throw new Error("Usage: seal-use rules version <versionId|versionNumber|latest>");
const version = resolveVersionOption(args, maybeName);
if (!version) throw new Error("Usage: seal-use rules version <versionNumber|latest>");
await runTool(
"seal_approval_rule_version_get",
client!,
@@ -118,11 +143,11 @@ export async function handleRulesCommand(
return;
}
if (action === "diff" || action === "diff-one" || action === "rule-diff") {
if (action === "diff") {
const from = stringOption(args.options.from) ?? maybeName;
const to = stringOption(args.options.to) ?? args.command[3];
if (!from || !to) {
throw new Error("Usage: seal-use rules diff <fromVersion> <toVersion> [--rule-id <stableRuleId>|--code <code>] [--full]");
throw new Error("Usage: seal-use rules diff <fromVersion> <toVersion> [--code <code>] [--full]");
}
const singleSelector = args.command[4];
await runTool(
@@ -132,8 +157,8 @@ export async function handleRulesCommand(
{
from,
to,
ruleId: stringOption(args.options.ruleId) ?? stringOption(args.options["rule-id"]) ?? (action !== "diff" ? singleSelector : undefined),
code: stringOption(args.options.code),
ruleId: stringOption(args.options.ruleId) ?? stringOption(args.options["rule-id"]),
code: stringOption(args.options.code) ?? singleSelector,
includeUnchanged: booleanOption(args.options.includeUnchanged) ?? booleanOption(args.options["include-unchanged"]),
full: booleanOption(args.options.full),
format: stringOption(args.options.format)
@@ -144,16 +169,23 @@ export async function handleRulesCommand(
}
if (action === "get") {
const rawCode = stringOption(args.options.code) ?? (maybeName && !maybeName.startsWith("-") ? maybeName : undefined);
const code = rawCode ? (rawCode.startsWith("#") || rawCode.startsWith("rule-") ? rawCode : (rawCode.match(/^\d+$/) ? `#${rawCode.padStart(4, "0")}` : rawCode)) : undefined;
const target =
(maybeName && !maybeName.startsWith("-") ? maybeName : undefined) ??
stringOption(args.options.code) ??
stringOption(args.options.runtimeId) ??
stringOption(args.options["runtime-id"]) ??
stringOption(args.options.ruleId) ??
stringOption(args.options["rule-id"]);
if (!target) {
throw new Error("Usage: seal-use rules get <code> [--version <number|latest>] [--record-id <recordId>] [--corp <corpId>]");
}
await runTool(
"seal_approval_rule_get",
client!,
corp,
{
...ruleVersionGetOptions(stringOption(args.options.version)),
code,
runtimeId: stringOption(args.options.runtimeId) ?? stringOption(args.options["runtime-id"]) ?? (maybeName?.startsWith("rule-") ? maybeName : undefined),
...ruleVersionGetOptions(resolveVersionOption(args)),
code: target,
recordId: stringOption(args.options.recordId) ?? stringOption(args.options["record-id"])
},
outputOptions(args.options)
@@ -161,9 +193,102 @@ export async function handleRulesCommand(
return;
}
if (action === "create") {
const payload = jsonObject(args.json);
const description = readDescriptionInput(args, payload);
const scope = stringOption(args.options.scope) ?? (typeof payload.scope === "string" ? payload.scope : undefined);
const strictness =
stringOption(args.options.strictness) ??
(typeof payload.strictness === "string" ? payload.strictness : "MUST_FOLLOW");
if (!description || !scope) {
throw new Error("Usage: seal-use rules create --description <text> --scope <scope> [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--description-file <path>] [--corp <corpId>]");
}
await runTool(
"seal_approval_rule_create",
client!,
corp,
{ description, scope, strictness },
outputOptions(args.options)
);
return;
}
if (action === "update") {
const payload = jsonObject(args.json);
const ruleId =
(maybeName && !maybeName.startsWith("-") ? maybeName : undefined) ??
stringOption(args.options.ruleId) ??
stringOption(args.options["rule-id"]) ??
stringOption(args.options.code) ??
(typeof payload.ruleId === "string" ? payload.ruleId : undefined);
const description = readDescriptionInput(args, payload);
const scope = stringOption(args.options.scope) ?? (typeof payload.scope === "string" ? payload.scope : undefined);
const strictness =
stringOption(args.options.strictness) ??
(typeof payload.strictness === "string" ? payload.strictness : undefined);
if (!ruleId || (description === undefined && scope === undefined && strictness === undefined)) {
throw new Error("Usage: seal-use rules update <code> [--description <text>|--description-file <path>] [--scope <scope>] [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--corp <corpId>]");
}
await runTool(
"seal_approval_rule_update",
client!,
corp,
{ ruleId, description, scope, strictness },
outputOptions(args.options)
);
return;
}
if (action === "delete") {
const ruleId =
(maybeName && !maybeName.startsWith("-") ? maybeName : undefined) ??
stringOption(args.options.ruleId) ??
stringOption(args.options["rule-id"]) ??
stringOption(args.options.code);
if (!ruleId) {
throw new Error("Usage: seal-use rules delete <code> --yes [--corp <corpId>]");
}
const confirmed = booleanOption(args.options.yes) === true || booleanOption(args.options.confirm) === true;
if (!confirmed) {
throw confirmationRequired(
`Refusing to delete rule '${ruleId}' without --yes.`,
`seal-use rules delete ${ruleId} --corp ${corp.id} --yes`
);
}
await runTool(
"seal_approval_rule_delete",
client!,
corp,
{ ruleId },
outputOptions(args.options)
);
return;
}
if (action === "publish") {
const payload = jsonObject(args.json);
const versionName =
(maybeName && !maybeName.startsWith("-") ? maybeName : undefined) ??
stringOption(args.options.versionName) ??
stringOption(args.options["version-name"]) ??
stringOption(args.options.name) ??
(typeof payload.versionName === "string" ? payload.versionName : undefined);
if (!versionName) {
throw new Error("Usage: seal-use rules publish <versionName> [--corp <corpId>]");
}
await runTool(
"seal_approval_rule_version_publish",
client!,
corp,
{ versionName },
outputOptions(args.options)
);
return;
}
if (action === "search") {
const keyword = maybeName ?? stringOption(args.options.query);
if (!keyword) throw new Error("Usage: seal-use rules search <keyword> [--version <versionId|versionNumber|latest>]");
if (!keyword) throw new Error("Usage: seal-use rules search <keyword> [--version <number|latest>] [--maxResults 20] [--corp <corpId>]");
await runTool(
"seal_approval_search",
client!,
@@ -177,7 +302,7 @@ export async function handleRulesCommand(
snippetOnly: booleanOption(args.options.snippetOnly) ?? booleanOption(args.options["snippet-only"]),
maxChars: numberOption(args.options.maxChars) ?? numberOption(args.options["max-chars"]),
fields: splitOption(args.options.fields),
...ruleVersionSearchOptions(stringOption(args.options.version))
...ruleVersionSearchOptions(resolveVersionOption(args))
},
outputOptions(args.options)
);
@@ -185,7 +310,7 @@ export async function handleRulesCommand(
}
if (action === "pull") {
const version = stringOption(args.options.version) ?? maybeName;
const version = resolveVersionOption(args, maybeName);
const out = stringOption(args.options.out) ?? stringOption(args.options.file) ?? stringOption(args.options.f);
await runTool(
"seal_approval_rules_pull",
@@ -249,9 +374,9 @@ export async function handleRulesCommand(
{
file: stringOption(args.options.file) ?? stringOption(args.options.f),
linter: stringOption(args.options.linter),
version: stringOption(args.options.version),
version: resolveVersionOption(args),
code: stringOption(args.options.code),
ruleId: stringOption(args.options.rule) ?? maybeName,
ruleId: stringOption(args.options.rule) ?? (maybeName && !maybeName.startsWith("-") ? maybeName : undefined),
minScore: numberOption(args.options.minScore) ?? numberOption(args.options["min-score"]),
level: stringOption(args.options.level),
summary: booleanOption(args.options.summary)
@@ -273,7 +398,7 @@ export async function handleRulesCommand(
}
if (action === "map") {
const versionSelector = stringOption(args.options.version) ?? maybeName;
const versionSelector = resolveVersionOption(args, maybeName);
const code = stringOption(args.options.code) ?? stringOption(args.options.rule);
const snapshot = loadRuleMappingSnapshot(corp.id, versionSelector);
if (!snapshot) {
@@ -300,5 +425,5 @@ export async function handleRulesCommand(
return;
}
throw new Error(`Unknown rules command: ${action ?? ""}. Available: count, list, clear, versions, version, diff, get, search, lint, linters, pull, push, map. Run 'seal-use help' for available commands.`);
throw new Error(`Unknown rules command: ${action ?? ""}. Available: count, list, get, search, create, update, delete, publish, versions, version, diff, lint, linters, pull, push, clear, map. Run 'seal-use help' for available commands.`);
}
-16
View File
@@ -1,16 +0,0 @@
import type { CorpConfig } from "../../core/config/types.js";
import type { createSealClient } from "../../core/http/factory.js";
import { runTool } from "../helpers.js";
import { jsonObject } from "../parser.js";
import { outputOptions } from "../printer.js";
import type { ParsedArgs } from "../types.js";
export async function handleToolCommand(
action: string | undefined,
client: Awaited<ReturnType<typeof createSealClient>>,
corp: CorpConfig,
args: ParsedArgs
) {
if (!action) throw new Error("Usage: seal-use tool <toolName> [--json '{...}']");
await runTool(action, client, corp, jsonObject(args.json), outputOptions(args.options));
}
-6
View File
@@ -1,6 +0,0 @@
import { sealTools } from "../../domains/seal/tools.js";
import { printJson } from "../printer.js";
export function handleToolsListCommand() {
printJson(sealTools.map((tool) => ({ name: tool.name, description: tool.description })));
}
+84 -55
View File
@@ -253,18 +253,19 @@ export const HELP_REGISTRY: AreaHelp[] = [
{
area: "rules",
title: "Approval rules management",
description: "Query, search, version, lint, import, and export approval audit rules.",
description: "Query, search, edit, publish, version, lint, import, and export approval audit rules. Read commands default to the current draft; pass --version latest (or --version <number>) to inspect published versions.",
commands: [
{
name: "count",
summary: "Count total rules in current enterprise",
usage: ["seal-use rules count [--corp <corpId>]"]
summary: "Count approval rules (defaults to current draft; pass --version latest for latest published version)",
usage: ["seal-use rules count [--version <number|latest>] [--corp <corpId>]"]
},
{
name: "list",
summary: "List approval rules with optional pagination and summary",
usage: ["seal-use rules list [--summary] [--count] [--limit 20] [--offset 0] [--output-file <path>] [--corp <corpId>]"],
summary: "List approval rules (defaults to current draft; pass --version latest for latest published version)",
usage: ["seal-use rules list [--version <number|latest>] [--summary] [--limit 20] [--offset 0] [--output-file <path>] [--corp <corpId>]"],
options: [
{ flag: "--version <number|latest>", description: "Read from a published version instead of current draft ('latest' for latest published version)" },
{ flag: "--summary", description: "Output compact summary fields (code, status, strictness, scope, updatedAt)" },
{ flag: "--limit <n>", description: "Number of rules to fetch (default: 20)" },
{ flag: "--offset <n>", description: "Offset index for pagination" },
@@ -273,9 +274,36 @@ export const HELP_REGISTRY: AreaHelp[] = [
]
},
{
name: "clear",
summary: "Clear all draft rules from enterprise",
usage: ["seal-use rules clear [--corp <corpId>] [--dry-run|--yes]"]
name: "get",
summary: "Get single rule by code (defaults to current draft; pass --version latest or --record-id for published snapshots)",
usage: [
"seal-use rules get <code> [--version <number|latest>] [--record-id <recordId>] [--corp <corpId>]"
]
},
{
name: "search",
summary: "Search rules by keyword (defaults to current draft; pass --version latest for latest published version)",
usage: ["seal-use rules search <keyword> [--version <number|latest>] [--maxResults 20] [--corp <corpId>]"]
},
{
name: "create",
summary: "Create a new draft approval rule",
usage: ["seal-use rules create --description <text> --scope <scope> [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--description-file <path>] [--corp <corpId>]"]
},
{
name: "update",
summary: "Update a draft approval rule by code",
usage: ["seal-use rules update <code> [--description <text>|--description-file <path>] [--scope <scope>] [--strictness <MUST_FOLLOW|SHOULD_FOLLOW|SUGGESTION>] [--corp <corpId>]"]
},
{
name: "delete",
summary: "Delete a draft approval rule by code",
usage: ["seal-use rules delete <code> --yes [--corp <corpId>]"]
},
{
name: "publish",
summary: "Publish current draft rules as a new formal version",
usage: ["seal-use rules publish <versionName> [--corp <corpId>]"]
},
{
name: "versions",
@@ -284,45 +312,24 @@ export const HELP_REGISTRY: AreaHelp[] = [
},
{
name: "version",
summary: "Inspect a specific rule version",
usage: ["seal-use rules version <versionId|versionNumber|latest> [--corp <corpId>]"]
summary: "Inspect a specific published rule version",
usage: ["seal-use rules version <versionNumber|latest> [--corp <corpId>]"]
},
{
name: "diff",
summary: "Compare two published rule versions by persisted ID or code",
usage: ["seal-use rules diff <fromVersion> <toVersion> [--rule-id <stableRuleId>|--code <code>] [--include-unchanged] [--full] [--corp <corpId>]"],
summary: "Compare two published rule versions",
usage: ["seal-use rules diff <fromVersion> <toVersion> [--code <code>] [--include-unchanged] [--full] [--corp <corpId>]"],
options: [
{ flag: "--rule-id <id>", description: "Compare only one stable rule ID" },
{ flag: "--code <code>", description: "Compare only one rule code when stable ID mapping is unavailable" },
{ flag: "--code <code>", description: "Compare only one rule code" },
{ flag: "--include-unchanged", description: "Include unchanged rules in the structured changes list" },
{ flag: "--full", description: "Expand an oversized diff; small diffs are returned in full by default" },
{ flag: "--format unified|json", description: "Return unified diff text together with structured metadata" }
],
description: "Uses locally persisted draft IDs when available and otherwise falls back to code. Output is truncated only when the total diff exceeds the safety limit; use --full to expand it."
},
{
name: "diff-one",
summary: "Inspect one rule change",
usage: ["seal-use rules diff-one <fromVersion> <toVersion> <ruleId> [--full] [--corp <corpId>]"],
description: "Single-rule alias for rules diff; use --code when the published snapshots have no stable ID."
},
{
name: "get",
summary: "Get single rule by rule code or record ID",
usage: [
"seal-use rules get <ruleCode> [--version <number|latest>] [--corp <corpId>]",
"seal-use rules get --record-id <recordId> --runtime-id rule-205 [--corp <corpId>]"
]
},
{
name: "search",
summary: "Search rules by keyword",
usage: ["seal-use rules search <keyword> [--version <versionId|versionNumber|latest>] [--maxResults 20] [--corp <corpId>]"]
},
{
name: "lint",
summary: "Lint rule text or rule file using builtin or custom linter",
usage: ["seal-use rules lint [--file <path>] [--linter <name|path>] [--version <id|num|latest>] [--code <code>] [--rule <ruleId>] [--min-score <score>] [--level all|error|warning] [--summary] [--corp <corpId>]"]
usage: ["seal-use rules lint [--file <path>] [--linter <name|path>] [--version <number|latest>] [--code <code>] [--min-score <score>] [--level all|error|warning] [--summary] [--corp <corpId>]"]
},
{
name: "linters",
@@ -332,17 +339,22 @@ export const HELP_REGISTRY: AreaHelp[] = [
{
name: "pull",
summary: "Export rules to local JSON file",
usage: ["seal-use rules pull [--version <id|num|latest>] [--out <file>] [--corp <corpId>]"]
usage: ["seal-use rules pull [--version <number|latest>] [--out <file>] [--corp <corpId>]"]
},
{
name: "push",
summary: "Push rules from local JSON file to enterprise draft space",
usage: ["seal-use rules push --file <path> [--publish] [--version-name <name>] [--dry-run|--yes] [--corp <corpId>]"]
usage: ["seal-use rules push [--file <path>] [--publish] [--version-name <name>] [--dry-run|--yes] [--corp <corpId>]"]
},
{
name: "clear",
summary: "Clear all draft rules from enterprise",
usage: ["seal-use rules clear [--dry-run|--yes] [--corp <corpId>]"]
},
{
name: "map",
summary: "Inspect locally synced production/test rule code mappings",
usage: ["seal-use rules map [--version <id|num|latest>] [--code <code>] [--corp <corpId>]"]
usage: ["seal-use rules map [--version <number|latest>] [--code <code>] [--corp <corpId>]"]
}
]
},
@@ -1038,26 +1050,43 @@ export const HELP_REGISTRY: AreaHelp[] = [
]
},
{
area: "tool",
title: "Direct low-level tool invocation",
description: "Execute individual Seal tools directly.",
commands: [
{
name: "",
summary: "Invoke a tool directly",
usage: ["seal-use tool <toolName> [--corp <corpId>] [--json '{\"key\":\"value\"}']"]
}
]
},
{
area: "tools",
title: "Available tools listing",
description: "List all executable domain tools.",
area: "documents",
title: "Approval knowledge documents",
description: "List, inspect, search, create, update, and delete approval knowledge articles and policy documents.",
commands: [
{
name: "list",
summary: "List all available domain tools",
usage: ["seal-use tools list"]
summary: "List approval knowledge documents",
usage: ["seal-use documents list [--scenarios <audit,fill>] [--limit 50] [--offset 0] [--corp <corpId>]"]
},
{
name: "get",
summary: "Get approval knowledge document details by ID",
usage: ["seal-use documents get <documentId> [--corp <corpId>]"]
},
{
name: "search",
summary: "Search approval knowledge documents by keyword",
usage: ["seal-use documents search <keyword> [--maxResults 20] [--corp <corpId>]"]
},
{
name: "create",
summary: "Create a new approval knowledge document",
usage: [
"seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]"
]
},
{
name: "update",
summary: "Update an approval knowledge document by ID",
usage: [
"seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]"
]
},
{
name: "delete",
summary: "Delete an approval knowledge document by ID",
usage: ["seal-use documents delete <documentId> --yes [--corp <corpId>]"]
}
]
},
+10 -14
View File
@@ -53,6 +53,9 @@ describe("CLI read-only classification", () => {
["corps", "list"],
["corp", "list"],
["corp", "get", "corp-a"],
["documents", "list", "--corp", "corp-a"],
["documents", "get", "doc-1", "--corp", "corp-a"],
["documents", "search", "差旅", "--corp", "corp-a"],
["approval-runs", "get", "01a09dac-c688-767b-8eb4-37b945095585"],
["approval-runs", "list", "--corp", "corp-a"],
["deploy", "hosecloud", "status", "--corp", "corp-a"],
@@ -72,8 +75,15 @@ describe("CLI read-only classification", () => {
["corps", "switch", "corp-a"],
["corps", "extract-keys", "corp-a"],
["corps", "sync-test", "corp-a"],
["rules", "create"],
["rules", "update", "25"],
["rules", "delete", "25"],
["rules", "publish", "v1"],
["rules", "push"],
["rules", "clear"],
["documents", "create"],
["documents", "update", "doc-1"],
["documents", "delete", "doc-1"],
["simulation", "create", "--mode", "hosecloud"],
["deploy", "hosecloud", "sync", "sign-key"],
["deploy", "hosecloud", "configure"],
@@ -92,9 +102,6 @@ describe("CLI read-only classification", () => {
["auth", "keys"],
["analytics", "analyze", "record-1"],
["tool", "seal_approval_rule_create", "--json", "{}"],
["tool", "seal_webhook_delete", "--json", "{}"],
["tool", "seal_insight_record_analyze", "--json", "{}"],
["tool"],
["totally-unknown", "list"],
[]
]) {
@@ -102,17 +109,6 @@ describe("CLI read-only classification", () => {
}
});
test("routes `seal-use tool` through the tool registry's own classification", () => {
for (const command of [
["tool", "seal_approval_search", "--json", "{}"],
["tool", "seal_approval_rules_list", "--corp", "corp-a"],
["tool", "seal_whoami"],
["tool", "seal_approval_run_flow_get", "--json", '{"sn":"B26002352"}']
]) {
expect({ command, readOnly: isReadOnlyCliCommand(command) }).toEqual({ command, readOnly: true });
}
});
test("matches whole tokens, so a read prefix cannot smuggle a mutation", () => {
for (const command of [
["corps", "listing"],
+2 -10
View File
@@ -1,4 +1,3 @@
import { isReadOnlySealTool } from "../domains/seal/tools.js";
import { parseArgs } from "./parser.js";
/**
@@ -29,7 +28,8 @@ const AREA_ALIASES: Record<string, string> = {
*/
const READ_ONLY_COMMANDS: Record<string, string[]> = {
corps: ["list", "search", "get", "current"],
rules: ["count", "list", "versions", "version", "diff", "diff-one", "get", "search", "lint", "linters", "pull", "map"],
rules: ["count", "list", "versions", "version", "diff", "get", "search", "lint", "linters", "pull", "map"],
documents: ["list", "get", "search"],
webhook: ["ready", "status", "list", "get", "resource-pack export", "resource-pack preview"],
"approval-runs": [
"summary",
@@ -78,7 +78,6 @@ const READ_ONLY_COMMANDS: Record<string, string[]> = {
// mutation despite reading like a query. See SEAL_MUTATING_TOOLS.
analytics: ["insight", "risks", "performance", "export"],
source: ["config"],
tools: ["list"],
skill: ["dump", "status"],
service: ["status", "logs"],
doctor: ["", "guide", "paths", "tenant", "auth"],
@@ -112,13 +111,6 @@ export function isReadOnlyCliCommand(argv: string[]): boolean {
if (actionTokens.length === 0 && TOP_LEVEL_READ_ONLY.has(area)) return true;
// `seal-use tool <name>` reaches the internal tool registry, which carries its own exhaustive
// read/write classification. Delegating to it keeps the two from drifting apart.
if (area === "tool") {
const toolName = actionTokens[0];
return toolName !== undefined && isReadOnlySealTool(toolName);
}
const allowed = READ_ONLY_COMMANDS[area];
if (!allowed) return false;
+8 -17
View File
@@ -16,6 +16,7 @@ import { handleContextCommand } from "./commands/context.js";
import { handleCorpsCommand } from "./commands/corps.js";
import { handleDeployCommand } from "./commands/deploy.js";
import { handleDoctorCommand } from "./commands/doctor.js";
import { handleDocumentsCommand } from "./commands/documents.js";
import { handleHttpCommand } from "./commands/http.js";
import { handleLlmCommand } from "./commands/llm.js";
import { handleMcpCommand, printMcpConfig } from "./commands/mcp.js";
@@ -29,8 +30,6 @@ import { handleSimulationCommand } from "./commands/simulation.js";
import { handleSkillCommand } from "./commands/skill.js";
import { handleSourceCommand } from "./commands/source.js";
import { handleTestCommand } from "./commands/test.js";
import { handleToolCommand } from "./commands/tool.js";
import { handleToolsListCommand } from "./commands/tools.js";
import { handleUpdateCommand, isNewerVersion } from "./commands/update.js";
import { isUpdateCacheExpired, loadUpdateCache, triggerBackgroundUpdateCheck } from "../core/update-cache.js";
import { handleUsersCommand } from "./commands/users.js";
@@ -74,10 +73,8 @@ export const KNOWN_AREAS = new Set([
"http",
"serve",
"update",
"tools",
"corps",
"corp",
"tool",
"source",
"auth",
"users",
@@ -89,6 +86,7 @@ export const KNOWN_AREAS = new Set([
"webhook",
"webhooks",
"context",
"documents",
"rules",
"approval-runs",
"analytics",
@@ -189,9 +187,7 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
if (
area === "version" ||
area === "v" ||
Boolean(args.options.version) ||
Boolean(args.options.v) ||
Boolean(args.options.V)
(!area && (Boolean(args.options.version) || Boolean(args.options.v) || Boolean(args.options.V)))
) {
const cache = loadUpdateCache();
const isUpgrade = cache?.latestVersion ? isNewerVersion(cache.latestVersion, VERSION_INFO.version) : false;
@@ -335,11 +331,6 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
return;
}
if (area === "tools" && action === "list") {
handleToolsListCommand();
return;
}
if (area === "corps" || area === "corp") {
if (action === "regression" || action === "test-regression") {
await handleTestCommand("regression", maybeName, args);
@@ -435,6 +426,11 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
return;
}
if (area === "documents") {
await handleDocumentsCommand(action, maybeName, client, corp, args);
return;
}
if (area === "rules") {
await handleRulesCommand(action, maybeName, client, corp, args);
return;
@@ -465,10 +461,5 @@ async function dispatch(argv: string[], runtime: CliRuntime) {
return;
}
if (area === "tool") {
await handleToolCommand(action, client, corp, args);
return;
}
throw new Error(`Unknown command: ${args.command.join(" ")}. Run 'seal-use help' for available commands.`);
}
+14 -6
View File
@@ -83,20 +83,28 @@ export function loadRuleMappingSnapshot(
}
}
function stripLeadingZeros(val: string): string {
return val.replace(/^0+(?=\d)/, "");
}
export function filterRuleMapping(
mapping: RuleMappingItem[],
codeOrId?: string
): RuleMappingItem[] {
if (!codeOrId) return mapping;
const target = codeOrId.trim().toLowerCase();
const target = stripLeadingZeros(codeOrId.trim().toLowerCase().replace(/^#/, ""));
return mapping.filter((item) => {
const srcCode = String(item.sourceRuleCode).toLowerCase().replace(/^#/, "");
const tgtCode = String(item.targetRuleCode).toLowerCase().replace(/^#/, "");
const tgtShort = stripLeadingZeros(tgtCode.replace(/^rule-/, ""));
const srcShort = stripLeadingZeros(srcCode.replace(/^rule-/, ""));
return (
String(item.sourceRuleCode).toLowerCase() === target ||
String(item.targetRuleCode).toLowerCase() === target ||
srcCode === target ||
tgtCode === target ||
srcShort === target ||
tgtShort === target ||
item.sourceRuleId.toLowerCase() === target ||
item.targetRuleId.toLowerCase() === target ||
`#${item.sourceRuleCode}`.toLowerCase() === target ||
`#${item.targetRuleCode}`.toLowerCase() === target
item.targetRuleId.toLowerCase() === target
);
});
}
+8 -8
View File
@@ -46,7 +46,7 @@ describe("rules-local workspace", () => {
const parsed = parseLocalRulesContent(raw);
expect(parsed.rules.length).toBe(1);
expect(parsed.rules[0]!.description).toBe("打车必须备注起止地点");
expect(parsed.rules[0]!.code).toBe(1);
expect(parsed.rules[0]!.code).toBe(0);
});
test("rejects invalid format or empty description", () => {
@@ -79,15 +79,15 @@ describe("rules-local workspace", () => {
test("converts local rules to lint targets", () => {
const targets = localRulesToLintTargets([
{ code: 1, description: "规则一", name: "R1" },
{ code: "0002", description: "规则二" },
{ description: "规则三" }
{ code: 0, description: "规则零", name: "R0" },
{ code: "0001", description: "规则一" },
{ description: "规则二" }
]);
expect(targets[0]!.code).toBe("#0001");
expect(targets[0]!.name).toBe("R1");
expect(targets[1]!.code).toBe("#0002");
expect(targets[2]!.code).toBe("#0003");
expect(targets[0]!.code).toBe("0000");
expect(targets[0]!.name).toBe("R0");
expect(targets[1]!.code).toBe("0001");
expect(targets[2]!.code).toBe("0002");
});
});
+22 -9
View File
@@ -68,6 +68,15 @@ export function parseLocalRulesContent(rawText: string): {
throw new Error("本地规则文件格式错误: 顶层必须为规则数组或包含 'rules' 数组的对象");
}
function parseCodeNumber(value: unknown): number | undefined {
if (typeof value === "number" && Number.isInteger(value) && value >= 0) return value;
if (typeof value !== "string") return undefined;
const match = value.trim().match(/^(?:#|rule[-_:]?)?(\d+)$/i);
if (!match?.[1]) return undefined;
const num = Number(match[1]);
return Number.isInteger(num) && num >= 0 ? num : undefined;
}
function normalizeRuleItems(items: unknown[]): LocalRuleItem[] {
return items.map((item, idx) => {
if (!item || typeof item !== "object") {
@@ -79,10 +88,13 @@ function normalizeRuleItems(items: unknown[]): LocalRuleItem[] {
throw new Error(`第 ${idx + 1} 条规则缺少有效的 'description' (规则描述) 字段`);
}
const parsedCode = parseCodeNumber(r.code);
const code =
typeof r.code === "number" || typeof r.code === "string"
? r.code
: idx + 1;
parsedCode !== undefined
? parsedCode
: typeof r.code === "string" && r.code.trim()
? r.code.trim()
: idx;
return {
...r,
@@ -132,13 +144,14 @@ export function saveLocalRulesFile(
*/
export function localRulesToLintTargets(rules: LocalRuleItem[]): RuleLintTarget[] {
return rules.map((r, idx) => {
let codeStr: string | undefined;
if (typeof r.code === "number") {
codeStr = `#${String(r.code).padStart(4, "0")}`;
} else if (typeof r.code === "string") {
codeStr = r.code.startsWith("#") ? r.code : `#${r.code}`;
const parsedCode = parseCodeNumber(r.code);
let codeStr: string;
if (parsedCode !== undefined) {
codeStr = String(parsedCode).padStart(4, "0");
} else if (typeof r.code === "string" && r.code.trim()) {
codeStr = r.code.trim().replace(/^#/, "");
} else {
codeStr = `#${String(idx + 1).padStart(4, "0")}`;
codeStr = String(idx).padStart(4, "0");
}
return {
+35 -12
View File
@@ -92,6 +92,35 @@ export async function syncTestEnterprise(
};
if (options.dryRun || options.execute === false) {
const testSignatureSet = new Set(
testRules.rules.map((r) => JSON.stringify([r.description ?? "", r.scope ?? "", r.strictness ?? ""]))
);
const allSyncItems = prodRules.rules.map((rule, index) => {
const code = rule.code ?? index;
const sig = JSON.stringify([rule.description ?? "", rule.scope ?? "", rule.strictness ?? ""]);
const existingAtIndex = testRules.rules[index];
const isUnchanged =
(existingAtIndex &&
existingAtIndex.description === rule.description &&
existingAtIndex.scope === rule.scope &&
existingAtIndex.strictness === rule.strictness) ||
testSignatureSet.has(sig);
return {
index,
sourceRuleId: rule.id,
sourceRuleCode: code,
expectedTargetCode: `rule-${code}`,
description: rule.description,
scope: rule.scope,
strictness: rule.strictness,
unchanged: isUnchanged
};
});
const changedRules = allSyncItems
.filter((item) => !item.unchanged)
.map(({ unchanged, ...rest }) => rest);
const unchangedCount = allSyncItems.length - changedRules.length;
return {
dryRun: true as const,
source: {
@@ -118,15 +147,9 @@ export async function syncTestEnterprise(
targetExistingDraftRuleCount: testRules.rules.length,
toDeleteCount: testRules.rules.length,
toCreateCount: prodRules.rules.length,
rulesToSync: prodRules.rules.map((rule, index) => ({
index: index + 1,
sourceRuleId: rule.id,
sourceRuleCode: rule.code ?? index + 1,
expectedTargetCode: `rule-${index + 1}`,
description: rule.description,
scope: rule.scope,
strictness: rule.strictness
}))
unchangedCount,
changedCount: changedRules.length,
rulesToSync: changedRules
},
documentsPlan: {
sourceDocumentCount: prodDocs.length,
@@ -194,11 +217,11 @@ export async function syncTestEnterprise(
try { savePublishedRuleVersionSnapshot(testCorp.id, published.version, createdRules); } catch {}
const publishedRules = published.version.rules ?? [];
const ruleMapping = prodRules.rules.map((prodRule, index) => ({
index: index + 1,
index,
sourceRuleId: prodRule.id,
sourceRuleCode: prodRule.code ?? index + 1,
sourceRuleCode: prodRule.code ?? index,
targetRuleId: createdRules[index]?.id ?? "",
targetRuleCode: publishedRules[index]?.code ?? `rule-${index + 1}`,
targetRuleCode: publishedRules[index]?.code ?? `rule-${prodRule.code ?? index}`,
description: prodRule.description,
scope: prodRule.scope,
strictness: prodRule.strictness
+180 -5
View File
@@ -194,7 +194,7 @@ describe("sealTools", () => {
expect(result.rules).toEqual([
{
id: "rule-1",
code: "#0029",
code: "0029",
status: "active",
strictness: "MUST_FOLLOW",
scope: "travel"
@@ -590,8 +590,9 @@ describe("sealTools", () => {
expect(result.count).toBe(1);
expect(result.rules[0]).toMatchObject({
code: "0038",
runtimeRuleId: "rule-38",
ruleCode: "#0038",
ruleCode: "0038",
versionNumber: 16,
scope: "travel",
strictness: "MUST_FOLLOW",
@@ -847,17 +848,143 @@ describe("sealTools", () => {
const handler = tool!.handler as ToolHandler;
const result = await handler(
fakeRulesClient(),
{ versionNumber: 16, code: "#0044" },
{ versionNumber: 16, code: "44" },
fakeContext()
) as { ruleCode?: string; description?: string; versionNumber?: number };
) as { code?: number; ruleCode?: string; runtimeRuleId?: string; description?: string; versionNumber?: number };
expect(result).toMatchObject({
ruleCode: "#0044",
code: "0044",
ruleCode: "0044",
runtimeRuleId: "rule-44",
description: "Second published rule",
versionNumber: 16
});
});
test("approval rule get defaults to current draft and handles 0-based codes without +1 offset", async () => {
const tool = sealTools.find((item) => item.name === "seal_approval_rule_get");
expect(tool).toBeDefined();
const handler = tool!.handler as ToolHandler;
const client = fakeZeroBasedRulesClient();
// Draft lookup for code 0
const draftZero = await handler(client, { code: "0" }, fakeContext()) as Record<string, unknown>;
expect(draftZero).toMatchObject({
id: "uuid-0",
code: "0000",
ruleCode: "0000",
runtimeRuleId: "rule-0",
description: "Draft rule zero",
status: "active"
});
// Draft lookup for code 25 (sitting at array index 24 because code 12 was deleted)
const draft25 = await handler(client, { code: "25" }, fakeContext()) as Record<string, unknown>;
expect(draft25).toMatchObject({
id: "uuid-25",
code: "0025",
ruleCode: "0025",
runtimeRuleId: "rule-25",
description: "Draft rule twenty-five"
});
// Version lookup for code 0 and code 25 (never returns rule-24 when asking for 25)
const versionZero = await handler(client, { versionNumber: 9, code: "0000" }, fakeContext()) as Record<string, unknown>;
expect(versionZero).toMatchObject({
id: "uuid-0",
code: "0000",
ruleCode: "0000",
runtimeRuleId: "rule-0",
description: "Published rule zero",
versionNumber: 9
});
const version25 = await handler(client, { versionNumber: 9, code: "0025" }, fakeContext()) as Record<string, unknown>;
expect(version25).toMatchObject({
id: "uuid-25",
code: "0025",
ruleCode: "0025",
runtimeRuleId: "rule-25",
description: "Published rule twenty-five",
versionNumber: 9
});
});
test("approval run cited-rules extracts and merges result.rulesResult and result.hitRules", async () => {
const tool = sealTools.find((item) => item.name === "seal_approval_run_cited_rules_get");
expect(tool).toBeDefined();
const handler = tool!.handler as ToolHandler;
const mockClient = {
get: () => ({
json: async () => ({
data: {
id: "run-cited-1",
sourceDocumentSN: "BX20260928001",
ruleSetVersionNumber: 12,
result: {
hitRules: [
{
id: "rule-0",
description: "Rule zero description",
scope: "差旅报销单",
strictness: "MUST_FOLLOW"
},
{
id: "rule-25",
description: "Rule 25 description",
scope: "对公付款单",
strictness: "SHOULD_FOLLOW"
}
],
rulesResult: [
{
id: "rule-0",
ruleIntent: "Check hotel invoice",
appliedAnalysis: "Invoice matches",
checkResult: "PASS",
findings: []
},
{
id: "rule-25",
ruleIntent: "Check contract attachment",
appliedAnalysis: "Missing contract",
checkResult: "FAIL",
findings: ["未上传合同附件"]
}
]
}
}
})
})
} as unknown as KyInstance;
const res = await handler(mockClient, { recordId: "run-cited-1" }, fakeContext()) as {
count: number;
rules: Array<Record<string, unknown>>;
};
expect(res.count).toBe(2);
expect(res.rules[0]).toMatchObject({
code: "0000",
runtimeRuleId: "rule-0",
ruleCode: "0000",
description: "Rule zero description",
scope: "差旅报销单",
strictness: "MUST_FOLLOW",
checkResult: "PASS"
});
expect(res.rules[1]).toMatchObject({
code: "0025",
runtimeRuleId: "rule-25",
ruleCode: "0025",
description: "Rule 25 description",
scope: "对公付款单",
strictness: "SHOULD_FOLLOW",
checkResult: "FAIL",
findings: ["未上传合同附件"]
});
});
test("deploy hosecloud configure saves integration and rejects missing customApiUrl", async () => {
const tool = sealTools.find((item) => item.name === "seal_deploy_hosecloud_configure");
expect(tool).toBeDefined();
@@ -1269,3 +1396,51 @@ function fakeDeployClient(): KyInstance {
}
} as unknown as KyInstance;
}
function fakeZeroBasedRulesClient(): KyInstance {
// Simulate 0-based rules with a deleted rule gap (code 12 missing, so code 25 is at array index 24)
const draftRules = Array.from({ length: 26 }, (_, i) => i)
.filter((code) => code !== 12)
.map((code) => ({
id: `uuid-${code}`,
tenantId: "tenant-1",
code,
description: code === 0 ? "Draft rule zero" : code === 25 ? "Draft rule twenty-five" : `Draft rule ${code}`,
scope: "travel",
strictness: "MUST_FOLLOW",
status: "active",
createdAt: 1780898164536,
updatedAt: 1780898164536
}));
const versionRules = Array.from({ length: 26 }, (_, i) => i)
.filter((code) => code !== 12)
.map((code) => ({
code: `rule-${code}`,
description: code === 0 ? "Published rule zero" : code === 25 ? "Published rule twenty-five" : `Published rule ${code}`,
scope: "travel",
strictness: "MUST_FOLLOW"
}));
return {
get: (url: string) => ({
json: async () => ({
data: url === "api/v1/rule-set-versions"
? [
{
id: "version-9",
versionNumber: 9,
versionName: "v9",
publishedByName: "Tester",
rules: versionRules
}
]
: {
hasPendingDeletes: false,
rules: draftRules
}
})
})
} as unknown as KyInstance;
}
+2 -5
View File
@@ -682,9 +682,6 @@ export const approvalRunsTools = [
const projected = records.map((record) => pickApprovalRunCandidate(record, fields));
const nextRuleVersionNumber = records.find((record) => record.ruleSetVersionNumber !== undefined)?.ruleSetVersionNumber;
const nextRuleVersionSelector = nextRuleVersionNumber === undefined ? "latest" : String(nextRuleVersionNumber);
const nextRuleVersionPayload = nextRuleVersionNumber === undefined
? '"latestRuleVersion":true'
: `"ruleVersionNumber":${nextRuleVersionNumber}`;
return {
query,
@@ -698,8 +695,8 @@ export const approvalRunsTools = [
next: {
getSummary: `seal-use approval-runs get <recordId> --summary --corp ${context.corp.id}`,
getRuleVersion: `seal-use rules version ${nextRuleVersionSelector} --corp ${context.corp.id}`,
searchRuleVersion: `seal-use tool seal_approval_search --corp ${context.corp.id} --json '{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version",${nextRuleVersionPayload}}'`,
getVersionContext: `seal-use tool seal_approval_context_get --corp ${context.corp.id} --json '{${nextRuleVersionPayload}}'`
searchRuleVersion: `seal-use rules search <keyword> --version ${nextRuleVersionSelector} --corp ${context.corp.id}`,
getVersionContext: `seal-use context --ruleVersion ${nextRuleVersionSelector} --corp ${context.corp.id}`
},
...(params.includeBridge ? { bridge: summarizeRunBridge(records) } : {})
};
+143 -37
View File
@@ -95,7 +95,12 @@ export function projectApprovalRules(
return {
count,
hasPendingDeletes: data.hasPendingDeletes,
rules: fields ? rules.map((rule) => pickRuleFields(rule, fields)) : rules
rules: fields
? rules.map((rule) => pickRuleFields(rule, fields))
: rules.map((rule) => {
const codeNum = parseRuleCodeNumber(rule.code);
return codeNum !== undefined ? { ...rule, code: formatRuleCode(codeNum) } : rule;
})
};
}
@@ -104,15 +109,8 @@ export function pickRuleFields(rule: ApprovalRule, fields: readonly RuleField[])
for (const field of fields) {
if (rule[field] !== undefined) {
if (field === "code") {
const val = rule.code;
if (typeof val === "number") {
output.code = formatRuleCode(val) as never;
} else if (typeof val === "string") {
const digits = val.match(/\d+/)?.[0];
output.code = (digits ? formatRuleCode(Number(digits)) : val) as never;
} else {
output.code = val as never;
}
const codeNum = parseRuleCodeNumber(rule.code);
output.code = (codeNum !== undefined ? formatRuleCode(codeNum) : rule.code) as never;
} else {
output[field] = rule[field] as never;
}
@@ -597,6 +595,8 @@ export function summarizeApprovalRunDocument(record: ApprovalRun) {
export function extractCitedRules(record: ApprovalRun) {
const candidates: Array<[string, unknown]> = [
["result.rulesResult", getPath(record, "result.rulesResult")],
["result.hitRules", getPath(record, "result.hitRules")],
["result.citedRules", getPath(record, "result.citedRules")],
["result.matchedRules", getPath(record, "result.matchedRules")],
["result.ruleResults", getPath(record, "result.ruleResults")],
@@ -605,6 +605,7 @@ export function extractCitedRules(record: ApprovalRun) {
["pipelineData.matchedRules", getPath(record, "pipelineData.matchedRules")]
];
const rules: Array<Record<string, unknown>> = [];
const byIdentity = new Map<string, Record<string, unknown>>();
const seen = new Set<string>();
for (const [path, value] of candidates) {
@@ -616,19 +617,49 @@ export function extractCitedRules(record: ApprovalRun) {
items.forEach((item, index) => {
const object = asRecord(item);
if (!object) return;
const runtimeRuleId = stringFromUnknown(object.runtimeRuleId) ?? stringFromUnknown(object.runtimeId) ?? stringFromUnknown(object.id) ?? stringFromUnknown(object.ruleId);
const ruleCode = stringFromUnknown(object.ruleCode) ?? stringFromUnknown(object.code) ?? (runtimeRuleId ? runtimeRuleIdToCode(runtimeRuleId) : undefined);
const rawRuntimeId =
stringFromUnknown(object.runtimeRuleId) ??
stringFromUnknown(object.runtimeId) ??
stringFromUnknown(object.id) ??
stringFromUnknown(object.ruleId);
const rawCode = object.ruleCode ?? object.code;
const codeNum = parseRuleCodeNumber(rawCode ?? rawRuntimeId);
const runtimeRuleId =
rawRuntimeId ?? (codeNum !== undefined ? `rule-${codeNum}` : undefined);
const ruleCode =
(codeNum !== undefined ? formatRuleCode(codeNum) : undefined) ??
stringFromUnknown(object.ruleCode) ??
stringFromUnknown(object.code) ??
(runtimeRuleId ? runtimeRuleIdToCode(runtimeRuleId) : undefined);
const output = compactObject({
code: ruleCode,
runtimeRuleId,
ruleCode,
versionNumber: numberFromUnknown(object.versionNumber) ?? record.ruleSetVersionNumber,
description: stringFromUnknown(object.description),
scope: stringFromUnknown(object.scope),
strictness: stringFromUnknown(object.strictness),
ruleIntent: stringFromUnknown(object.ruleIntent),
appliedAnalysis: object.appliedAnalysis ?? object.analysis ?? object.reasoning,
checkResult: object.checkResult ?? object.result ?? object.decision,
findings: object.findings ?? object.riskPoints ?? object.evidence,
sourcePath: `${path}.${index}`
});
const identityKey = runtimeRuleId ?? ruleCode;
if (identityKey) {
const existing = byIdentity.get(identityKey);
if (existing) {
for (const [k, v] of Object.entries(output)) {
if (existing[k] === undefined && v !== undefined) {
existing[k] = v;
}
}
return;
}
byIdentity.set(identityKey, output);
rules.push(output);
return;
}
const key = JSON.stringify(output);
if (!seen.has(key)) {
seen.add(key);
@@ -838,30 +869,95 @@ export async function resolveRuleVersionForLookup(
return resolveRuleVersion(client, params);
}
export function findRuleInDraft(
rules: ApprovalRule[],
selector: { code?: string; runtimeId?: string; ruleId?: string }
) {
const rawTarget = selector.ruleId ?? selector.code ?? selector.runtimeId;
if (!rawTarget || !rawTarget.trim()) {
throw new Error("Usage: seal-use rules get <code> [--version <number|latest>] [--record-id <recordId>]");
}
const trimmed = rawTarget.trim();
const targetCodeNum = parseRuleCodeNumber(trimmed);
const rule = rules.find((item) => {
if (item.id === trimmed) return true;
if (targetCodeNum !== undefined) {
const itemCodeNum = parseRuleCodeNumber(item.code);
if (itemCodeNum !== undefined && itemCodeNum === targetCodeNum) return true;
}
return false;
});
if (!rule) return undefined;
const codeNum = parseRuleCodeNumber(rule.code);
const formattedCode = codeNum !== undefined ? formatRuleCode(codeNum) : normalizeRuleCode(rule.code);
return compactObject({
id: rule.id,
code: formattedCode ?? rule.code,
ruleCode: formattedCode,
runtimeRuleId: codeNum !== undefined ? `rule-${codeNum}` : undefined,
description: rule.description,
scope: rule.scope,
strictness: rule.strictness,
status: rule.status,
createdAt: rule.createdAt,
updatedAt: rule.updatedAt
});
}
export function findRuleInVersion(
version: RuleSetVersion,
selector: { code?: string; runtimeId?: string }
selector: { code?: string; runtimeId?: string; ruleId?: string },
draftRules?: ApprovalRule[]
) {
const normalizedCode = normalizeRuleCode(selector.code);
const runtimeIndex = runtimeRuleIndex(selector.runtimeId);
const index = normalizedCode ? Number(normalizedCode.slice(1)) : runtimeIndex;
if (!index || index < 1) {
throw new Error("Pass --code '#0038' or --runtime-id rule-205");
const rawTarget = selector.ruleId ?? selector.code ?? selector.runtimeId;
if (!rawTarget || !rawTarget.trim()) {
throw new Error("Usage: seal-use rules get <code> [--version <number|latest>] [--record-id <recordId>]");
}
const trimmed = rawTarget.trim();
const targetCodeNum = parseRuleCodeNumber(trimmed);
const normalizedTarget = normalizeRuleCode(trimmed);
const rule = version.rules.find((item, itemIndex) => {
const rule = version.rules.find((item) => {
const object = item as Record<string, unknown>;
const itemCode = normalizeRuleCode(stringFromUnknown(object.code) ?? stringFromUnknown(object.ruleCode));
return itemCode === normalizedCode || itemIndex + 1 === index;
const itemId = stringFromUnknown(object.id) ?? stringFromUnknown(object.ruleId) ?? stringFromUnknown(object.stableId);
if (itemId && itemId === trimmed) return true;
const rawItemCode = object.code ?? object.ruleCode ?? object.runtimeRuleId ?? object.runtimeId;
const itemCodeNum = parseRuleCodeNumber(rawItemCode);
if (targetCodeNum !== undefined && itemCodeNum !== undefined) {
return itemCodeNum === targetCodeNum;
}
const itemCode = normalizeRuleCode(rawItemCode);
return Boolean(itemCode && normalizedTarget && itemCode === normalizedTarget);
});
if (!rule) return undefined;
const object = rule as Record<string, unknown>;
const position = version.rules.indexOf(rule) + 1;
const rawItemCode = object.code ?? object.ruleCode ?? object.runtimeRuleId ?? object.runtimeId;
const codeNum = parseRuleCodeNumber(rawItemCode);
const matchedDraft = draftRules?.find((d) => {
if (codeNum !== undefined && parseRuleCodeNumber(d.code) === codeNum) return true;
return d.description === rule.description && d.scope === rule.scope && d.strictness === rule.strictness;
});
const resolvedId =
stringFromUnknown(object.id) ??
stringFromUnknown(object.ruleId) ??
stringFromUnknown(object.stableId) ??
matchedDraft?.id;
const formattedCode =
codeNum !== undefined
? formatRuleCode(codeNum)
: normalizeRuleCode(rawItemCode);
return compactObject({
runtimeRuleId: stringFromUnknown(object.runtimeRuleId) ?? `rule-${position}`,
ruleCode: normalizeRuleCode(stringFromUnknown(object.code) ?? stringFromUnknown(object.ruleCode)) ?? formatRuleCode(position),
id: resolvedId,
code: formattedCode ?? rawItemCode,
runtimeRuleId:
stringFromUnknown(object.runtimeRuleId) ??
(codeNum !== undefined ? `rule-${codeNum}` : stringFromUnknown(object.code)),
ruleCode: formattedCode,
versionId: version.id,
versionNumber: version.versionNumber,
versionName: version.versionName,
@@ -870,29 +966,39 @@ export function findRuleInVersion(
description: rule.description,
scope: rule.scope,
strictness: rule.strictness,
status: stringFromUnknown(object.status)
status: stringFromUnknown(object.status) ?? matchedDraft?.status
});
}
export function normalizeRuleCode(value?: string) {
if (!value) return undefined;
const digits = value.match(/\d+/)?.[0];
return digits ? formatRuleCode(Number(digits)) : value;
export function parseRuleCodeNumber(value: unknown): number | undefined {
if (typeof value === "number" && Number.isInteger(value) && value >= 0) {
return value;
}
if (typeof value !== "string") return undefined;
const trimmed = value.trim();
const match = trimmed.match(/^(?:#|rule[-_:]?)?(\d+)$/i);
if (!match?.[1]) return undefined;
const num = Number(match[1]);
return Number.isInteger(num) && num >= 0 ? num : undefined;
}
export function runtimeRuleIndex(value?: string) {
if (!value) return undefined;
const match = value.match(/(\d+)$/);
return match ? Number(match[1]) : undefined;
export function normalizeRuleCode(value?: unknown) {
const codeNum = parseRuleCodeNumber(value);
if (codeNum !== undefined) return formatRuleCode(codeNum);
return typeof value === "string" && value.trim() ? value.trim() : undefined;
}
export function runtimeRuleIndex(value?: unknown) {
return parseRuleCodeNumber(value);
}
export function runtimeRuleIdToCode(value: string) {
const index = runtimeRuleIndex(value);
return index ? formatRuleCode(index) : undefined;
const index = parseRuleCodeNumber(value);
return index !== undefined ? formatRuleCode(index) : undefined;
}
export function formatRuleCode(value: number) {
return `#${String(value).padStart(4, "0")}`;
return String(value).padStart(4, "0");
}
export function pickApprovalRunCandidate(record: ApprovalRun, fields: string[]) {
+123 -37
View File
@@ -100,7 +100,9 @@ const {
summarizeRunBridge,
summarizeRuleVersion,
resolveRuleVersionForLookup,
findRuleInDraft,
findRuleInVersion,
parseRuleCodeNumber,
normalizeRuleCode,
runtimeRuleIndex,
runtimeRuleIdToCode,
@@ -137,8 +139,9 @@ const {
export const rulesTools = [
{
name: "seal_approval_rules_list",
description: "列出 Seal 当前草稿审批规则;返回的 code 属于草稿编号体系,发布版本可能重新编码;支持 countOnly、fields、limit 以避免返回规则正文",
description: "列出 Seal 审批规则(默认当前草稿,传 version='latest' 或版本号则列出对应已发布版本);支持 countOnly、fields、limit",
parameters: z.object({
version: z.string().optional().describe("可选发布版本号或 'latest';不传则读取当前草稿"),
countOnly: z.boolean().optional().describe("只返回规则数量,不返回规则列表"),
fields: z.array(z.enum([
"id",
@@ -157,12 +160,33 @@ export const rulesTools = [
handler: async (
client: KyInstance,
params: {
version?: string;
countOnly?: boolean;
fields?: RuleField[];
limit?: number;
offset?: number;
}
) => {
if (params.version) {
const ver = await resolveRuleVersionSelector(client, params.version);
const mappedRules: ApprovalRule[] = (ver.rules ?? []).map((r) => ({
id: (r as ApprovalRule).id ?? String(r.code),
tenantId: (r as ApprovalRule).tenantId ?? "",
code: parseRuleCodeNumber(r.code) ?? (r.code as unknown as number),
description: r.description,
scope: r.scope,
strictness: r.strictness,
status: typeof r.status === "string" ? r.status : "published",
createdAt: (r as ApprovalRule).createdAt ?? ver.publishedAt ?? ver.createdAt ?? 0,
updatedAt: (r as ApprovalRule).updatedAt ?? ver.publishedAt ?? ver.createdAt ?? 0
}));
const projected = projectApprovalRules({ rules: mappedRules, hasPendingDeletes: false }, params);
return {
...projected,
versionNumber: ver.versionNumber,
versionName: ver.versionName ?? null
};
}
const data = await api.listApprovalRules(client);
return projectApprovalRules(data, params);
}
@@ -247,13 +271,17 @@ export const rulesTools = [
handler: async (
client: KyInstance,
params: { description: string; scope: string; strictness: string }
) => api.createApprovalRule(client, params)
) => {
const created = await api.createApprovalRule(client, params);
const codeNum = parseRuleCodeNumber(created?.code);
return codeNum !== undefined ? { ...created, code: formatRuleCode(codeNum) } : created;
}
},
{
name: "seal_approval_rule_update",
description: "更新 Seal 草稿审批规则",
parameters: z.object({
ruleId: z.string().describe("规则 ID"),
ruleId: z.string().describe("规则 ID 或规则编号 code"),
description: z.string().optional(),
scope: z.string().optional(),
strictness: z.enum(["MUST_FOLLOW", "SHOULD_FOLLOW", "SUGGESTION"]).optional()
@@ -262,20 +290,18 @@ export const rulesTools = [
client: KyInstance,
params: { ruleId: string; description?: string; scope?: string; strictness?: string }
) => {
let resolvedRuleId = params.ruleId;
if (resolvedRuleId && (resolvedRuleId.startsWith("#") || resolvedRuleId.startsWith("rule-") || resolvedRuleId.match(/^\d+$/))) {
let resolvedRuleId = params.ruleId.trim();
const targetCodeNum = parseRuleCodeNumber(resolvedRuleId);
if (targetCodeNum !== undefined) {
const draftData = await api.listApprovalRules(client).catch(() => undefined);
if (draftData?.rules) {
const normalizedInput = normalizeRuleCode(resolvedRuleId);
const runtimeIdx = runtimeRuleIndex(resolvedRuleId);
const targetIndex = normalizedInput ? Number(normalizedInput.slice(1)) : runtimeIdx;
const matched = draftData.rules.find((r, idx) => {
const code = normalizeRuleCode(stringFromUnknown((r as any).code) ?? stringFromUnknown((r as any).ruleCode));
return code === normalizedInput || (targetIndex !== undefined && idx + 1 === targetIndex);
});
if (matched) {
resolvedRuleId = matched.id;
const matched = draftData.rules.find(
(r) => r.id === resolvedRuleId || parseRuleCodeNumber(r.code) === targetCodeNum
);
if (!matched) {
throw new Error(`未在当前草稿中找到编号为 ${params.ruleId} 的规则`);
}
resolvedRuleId = matched.id;
}
}
const { ruleId, ...rest } = params;
@@ -286,7 +312,7 @@ export const rulesTools = [
const globalConfig = loadGlobalConfig();
if (globalConfig.lint?.enabled) {
const loaded = await loadRuleLinter(globalConfig.lint.activeLinter);
const lintResult = await lintSingleRule({ id: ruleId, description: params.description }, loaded);
const lintResult = await lintSingleRule({ id: resolvedRuleId, description: params.description }, loaded);
if (lintResult.issues.length > 0) {
console.error(`⚠️ [Linter 质检提醒] 规则质量评分: ${lintResult.score}/100 (发现 ${lintResult.issues.length} 处潜在风险):`);
for (const issue of lintResult.issues) {
@@ -302,18 +328,33 @@ export const rulesTools = [
}
}
return result;
const codeNum = parseRuleCodeNumber(result?.code);
return codeNum !== undefined ? { ...result, code: formatRuleCode(codeNum) } : result;
}
},
{
name: "seal_approval_rule_delete",
description: "删除 Seal 草稿审批规则",
parameters: z.object({
ruleId: z.string().describe("规则 ID")
ruleId: z.string().describe("规则 ID 或规则编号 code")
}),
handler: async (client: KyInstance, params: { ruleId: string }) => {
await api.deleteApprovalRule(client, params.ruleId);
return { success: true };
let resolvedRuleId = params.ruleId.trim();
const targetCodeNum = parseRuleCodeNumber(resolvedRuleId);
if (targetCodeNum !== undefined) {
const draftData = await api.listApprovalRules(client).catch(() => undefined);
if (draftData?.rules) {
const matched = draftData.rules.find(
(r) => r.id === resolvedRuleId || parseRuleCodeNumber(r.code) === targetCodeNum
);
if (!matched) {
throw new Error(`未在当前草稿中找到编号为 ${params.ruleId} 的规则`);
}
resolvedRuleId = matched.id;
}
}
await api.deleteApprovalRule(client, resolvedRuleId);
return { success: true, ruleId: resolvedRuleId };
}
},
{
@@ -422,14 +463,15 @@ export const rulesTools = [
},
{
name: "seal_approval_rule_get",
description: "按版本号/code/runtime-id/record-id 定位单条规则;code 只在选定的版本编号体系内有效,避免拉取整版规则快照",
description: "按规则编号 code(或规则 ID)获取单条规则详情;默认读取当前草稿(含规则 ID),指定 version 或 recordId 时读取对应发布版本快照",
parameters: z.object({
versionId: z.string().optional().describe("规则版本 ID"),
versionNumber: z.number().int().positive().optional().describe("规则版本号"),
latest: z.boolean().optional().describe("为 true 时取最新版本"),
code: z.string().optional().describe("规则展示编号,如 #0038;没有后端 code 时按版本内序号匹配"),
runtimeId: z.string().optional().describe("运行时规则 ID,如 rule-205;按版本内序号匹配"),
recordId: z.string().optional().describe("从运行记录推断 ruleSetVersionNumber")
latest: z.boolean().optional().describe("为 true 时取最新已发布版本"),
code: z.string().optional().describe("规则编号(如 0025)"),
runtimeId: z.string().optional().describe("规则编号兼容别名"),
ruleId: z.string().optional().describe("规则 ID 兼容别名"),
recordId: z.string().optional().describe("从审批运行记录推断所使用的已发布版本")
}),
handler: async (
client: KyInstance,
@@ -439,16 +481,45 @@ export const rulesTools = [
latest?: boolean;
code?: string;
runtimeId?: string;
ruleId?: string;
recordId?: string;
}
},
context: ToolContext
) => {
const version = await resolveRuleVersionForLookup(client, params);
const rule = findRuleInVersion(version, {
const selector = {
code: params.code,
runtimeId: params.runtimeId
runtimeId: params.runtimeId,
ruleId: params.ruleId
};
const explicitVersion = Boolean(
params.versionId || params.versionNumber || params.latest || params.recordId
);
const draftData = await api.listApprovalRules(client).catch(() => undefined);
if (!explicitVersion && draftData?.rules) {
const draftMatch = findRuleInDraft(draftData.rules, selector);
if (draftMatch) {
return draftMatch;
}
}
const rawVersion = await resolveRuleVersionForLookup(client, params).catch((err) => {
if (!explicitVersion && draftData?.rules) {
throw new Error(`Rule not found in current draft: ${params.code ?? params.runtimeId ?? params.ruleId ?? ""}`);
}
throw err;
});
const version = context?.corp?.id
? hydrateRuleVersionStableIds(context.corp.id, rawVersion)
: rawVersion;
const rule = findRuleInVersion(version, selector, draftData?.rules);
if (!rule) {
throw new Error(`Rule not found in version ${version.versionNumber}`);
throw new Error(
explicitVersion
? `Rule not found in version ${version.versionNumber}`
: `Rule not found in current draft or version ${version.versionNumber}`
);
}
return rule;
}
@@ -460,7 +531,7 @@ export const rulesTools = [
file: z.string().optional().describe("指定本地规则文件路径进行离线质检(支持 .json),0网络请求、不污染远端草稿"),
linter: z.string().optional().describe("指定使用的校验器名称或脚本路径(如 builtin、strict、./my-linter.ts)"),
version: z.string().optional().describe("指定要质检的历史发布版本号或 ID(如 16 或 latest),不传默认质检当前草稿"),
code: z.string().optional().describe("按规则展示编号过滤(如 #0038)"),
code: z.string().optional().describe("按规则编号过滤(如 25)"),
ruleId: z.string().optional().describe("按规则 ID 过滤"),
minScore: z.number().optional().describe("最低合格质量分阈值(0~100),低于该分值抛出错误以返回非零退出码"),
level: z.enum(["all", "error", "warning"]).default("all").describe("问题报告等级过滤"),
@@ -502,7 +573,7 @@ export const rulesTools = [
versionNumber = version.versionNumber;
targets = (version.rules ?? []).map((r, idx) => ({
id: (r as any).id ?? (r as any).runtimeId,
code: (r as any).code ?? `#${String(idx + 1).padStart(4, "0")}`,
code: normalizeRuleCode((r as any).code) ?? formatRuleCode(idx),
name: (r as any).name ?? (r as any).title,
description: r.description ?? "",
scope: (r as any).scope,
@@ -512,7 +583,7 @@ export const rulesTools = [
const draftData = await api.listApprovalRules(client);
targets = (draftData.rules ?? []).map((r, idx) => ({
id: r.id,
code: (r as any).code ?? `#${String(idx + 1).padStart(4, "0")}`,
code: normalizeRuleCode((r as any).code) ?? formatRuleCode(idx),
name: (r as any).name ?? (r as any).title,
description: r.description ?? "",
scope: r.scope,
@@ -521,12 +592,16 @@ export const rulesTools = [
}
if (params.code) {
const normalizedFilter = normalizeRuleCode(params.code);
targets = targets.filter(
(r) => r.code === params.code || r.code?.replace(/[#\s]/g, "") === params.code?.replace(/[#\s]/g, "")
(r) => normalizeRuleCode(r.code) === normalizedFilter
);
}
if (params.ruleId) {
targets = targets.filter((r) => r.id === params.ruleId || r.code === params.ruleId);
const normalizedRuleFilter = normalizeRuleCode(params.ruleId);
targets = targets.filter(
(r) => r.id === params.ruleId || (normalizedRuleFilter !== undefined && normalizeRuleCode(r.code) === normalizedRuleFilter)
);
}
const globalConfig = loadGlobalConfig();
@@ -584,7 +659,7 @@ export const rulesTools = [
versionNumber = targetVersion.versionNumber;
source = `version:${versionNumber}`;
rules = (targetVersion.rules ?? []).map((r, idx) => ({
code: (r as any).code ? Number(String((r as any).code).replace(/^#/, "")) || idx + 1 : idx + 1,
code: parseRuleCodeNumber((r as any).code) ?? idx,
name: (r as any).name ?? (r as any).title,
description: r.description ?? "",
scope: (r as any).scope ?? "ALL",
@@ -594,7 +669,7 @@ export const rulesTools = [
const draftData = await api.listApprovalRules(client);
rules = (draftData.rules ?? []).map((r, idx) => ({
id: r.id,
code: r.code ?? idx + 1,
code: parseRuleCodeNumber(r.code) ?? idx,
name: (r as any).name ?? (r as any).title,
description: r.description ?? "",
scope: r.scope ?? "ALL",
@@ -644,7 +719,18 @@ export const rulesTools = [
context: ToolContext
) => {
const filePath = params.file ?? "./rules.local.json";
const local = loadLocalRulesFile(filePath);
let local: ReturnType<typeof loadLocalRulesFile>;
try {
local = loadLocalRulesFile(filePath);
} catch (err) {
if (params.publish && !params.file) {
const suggestedName = params.versionName ?? "新版本";
throw new Error(
`${err instanceof Error ? err.message : String(err)}\n👉 Next action: 若您已直接修改远端草稿、仅需发布正式版本,请执行 seal-use rules publish "${suggestedName}" --corp ${context.corp.id}`
);
}
throw err;
}
const isConfirmed = params.confirm === true;
// Fail closed: without an explicit confirm the push always previews, even when dryRun=false.
const isDryRun = !isConfirmed || params.dryRun === true;
+3
View File
@@ -377,6 +377,9 @@ export const simulationTools = [
const timeoutMs = parseDurationMs(params.timeout ?? "10m");
const pollIntervalMs = parseDurationMs(params.pollInterval ?? "2s");
const startedAt = Date.now();
console.error(
`⏳ [Simulation] 批次 ${params.batchId} 正在轮询等待结果(单据及附件解析预计耗时 1~3 分钟;若命令转入后台可等待完成通知,或随时执行 seal-use simulation status ${params.batchId} 查看进度)...`
);
while (true) {
const batch = await api.getSimulationBatch(client, params.batchId);
const status = (batch.status ?? "").toLowerCase();
+7 -8
View File
@@ -15,13 +15,12 @@ import {
describe("seal-use MCP server", () => {
test("tokenizes quoted JSON without invoking a shell", () => {
expect(tokenizeCommand(
`seal-use tool seal_approval_search --json '{"keywords":["差旅 发票"]}' --corp corp-a`
`seal-use rules search "差旅 发票" --corp corp-a`
)).toEqual([
"seal-use",
"tool",
"seal_approval_search",
"--json",
'{"keywords":["差旅 发票"]}',
"rules",
"search",
"差旅 发票",
"--corp",
"corp-a"
]);
@@ -125,14 +124,14 @@ describe("seal-use MCP server", () => {
for (const command of [
"seal-use corps mark corp-a --env production --confirm",
"seal-use rules push",
"seal-use rules create --description test --scope all",
"seal-use documents create --title t --purpose p --content c",
"seal-use simulation create --mode hosecloud",
"seal-use deploy hosecloud sync sign-key",
"seal-use users reset-password corp-a:u1",
"seal-use webhook replay",
"seal-use update",
"seal-use mcp",
"seal-use tool seal_approval_rule_create --json '{}'",
"seal-use tool seal_webhook_replay --json '{}'",
"seal-use totally-unknown-area list",
""
]) {
@@ -142,7 +141,7 @@ describe("seal-use MCP server", () => {
// Read-only commands must get past the policy; `version` is a top-level command with no
// registry row, and `corp` is an area alias the CLI dispatches as `corps`.
for (const command of ["seal-use version", "seal-use corps list", "seal-use corp list", "seal-use tool seal_approval_search --json '{}'"]) {
for (const command of ["seal-use version", "seal-use corps list", "seal-use corp list", "seal-use documents list --corp corp-a"]) {
const allowed = await callRead(command);
expect({ command, refusedByPolicy: allowed.text.includes("only runs read-only commands") }).toEqual({
command,