Split corps command by domain

This commit is contained in:
gitea committed 2026-09-22 14:25:06 +08:00
1 parent 1987b45336
commit f5be38d112
7 files changed
+2034 -2333

No files matched your search

+181 -181
View File
@@ -1,7 +1,7 @@
import{createRequire as ey0}from"node:module";var py0=Object.create;var{getPrototypeOf:dy0,defineProperty:Xj,getOwnPropertyNames:my0}=Object;var ly0=Object.prototype.hasOwnProperty;function oy0($){return this[$]}var ry0,sy0,J6=($,Y,U)=>{var z=$!=null&&typeof $==="object";if(z){var Q=Y?ry0??=new WeakMap:sy0??=new WeakMap,J=Q.get($);if(J)return J}U=$!=null?py0(dy0($)):{};let I=Y||!$||!$.__esModule?Xj(U,"default",{value:$,enumerable:!0}):U;for(let K of my0($))if(!ly0.call(I,K))Xj(I,K,{get:oy0.bind($,K),enumerable:!0});if(z)Q.set($,I);return I};var E=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);var ay0=($)=>$;function ty0($,Y){this[$]=ay0.bind(null,Y)}var B8=($,Y)=>{for(var U in Y)Xj($,U,{get:Y[U],enumerable:!0,configurable:!0,set:ty0.bind(Y,U)})};var m=($,Y)=>()=>($&&(Y=$($=0)),Y);var I0=ey0(import.meta.url);var $k0,tq,Yk0,Uk0,zk0,Qk0,C0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),qr=($,Y)=>{let U={};for(var z in $)tq(U,z,{get:$[z],enumerable:!0});if(Y)tq(U,Symbol.toStringTag,{value:"Module"});return U},Jk0=($,Y,U,z)=>{if(Y&&typeof Y==="object"||typeof Y==="function"){for(var Q=Uk0(Y),J=0,I=Q.length,K;J<I;J++)if(K=Q[J],!Qk0.call($,K)&&K!==U)tq($,K,{get:((G)=>Y[G]).bind(null,K),enumerable:!(z=Yk0(Y,K))||z.enumerable})}return $},eq=($,Y,U)=>(U=$!=null?$k0(zk0($)):{},Jk0(Y||!$||!$.__esModule?tq(U,"default",{value:$,enumerable:!0}):U,$));var Zj=m(()=>{$k0=Object.create,tq=Object.defineProperty,Yk0=Object.getOwnPropertyDescriptor,Uk0=Object.getOwnPropertyNames,zk0=Object.getPrototypeOf,Qk0=Object.prototype.hasOwnProperty});function Lr($){return typeof $==="string"&&Vr.has($.replace(/#$/,""))}function Fr($,Y){if(!("$schema"in $)||typeof $.$schema!=="string")return"2020-12";let U=$.$schema.replace(/#$/,"");if(Ik0.has(U))return"2020-12";if(Vr.has(U))return"2019-09";if(Kk0.has(U)||Gk0.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 Ik0,Vr,Kk0,Gk0;var qj=m(()=>{Ik0=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),Vr=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Kk0=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Gk0=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});function W0($,Y,U){function z(K,G){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:G,constr:I,traits:new Set},enumerable:!1});if(K._zod.traits.has($))return;K._zod.traits.add($),Y(K,G);let H=I.prototype,W=Object.keys(H);for(let X=0;X<W.length;X++){let Z=W[X];if(!(Z in K))K[Z]=H[Z].bind(K)}}let Q=U?.Parent??Object;class J extends Q{}Object.defineProperty(J,"name",{value:$});function I(K){var G;let H=U?.Parent?new J:this;z(H,K),(G=H._zod).deferred??(G.deferred=[]);for(let W of H._zod.deferred)W();return H}return Object.defineProperty(I,"init",{value:z}),Object.defineProperty(I,Symbol.hasInstance,{value:(K)=>{if(U?.Parent&&K instanceof U.Parent)return!0;return K?._zod?.traits?.has($)}}),Object.defineProperty(I,"name",{value:$}),I}function a4($){if($)Object.assign(TY,$);return TY}var Or,sK,Vj,n5,jY,TY;var EY=m(()=>{sK=Object.freeze({status:"aborted"});Vj=Symbol("zod_brand");n5=class n5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};jY=class jY extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(Or=globalThis).__zod_globalConfig??(Or.__zod_globalConfig={});TY=globalThis.__zod_globalConfig});var y0={};B8(y0,{unwrapMessage:()=>aK,uint8ArrayToHex:()=>Sk0,uint8ArrayToBase64url:()=>vk0,uint8ArrayToBase64:()=>Nr,stringifyPrimitive:()=>v0,slugify:()=>Oj,shallowClone:()=>Mj,safeExtend:()=>Tk0,required:()=>Ck0,randomString:()=>wk0,propertyKeyTypes:()=>$G,promiseAllObject:()=>Ok0,primitiveTypes:()=>Nj,prefixIssues:()=>f8,pick:()=>Ak0,partial:()=>Ek0,parsedType:()=>S0,optionalKeys:()=>Dj,omit:()=>Bk0,objectClone:()=>Vk0,numKeys:()=>Mk0,nullish:()=>H7,normalizeParams:()=>u0,mergeDefs:()=>p9,merge:()=>jk0,jsonStringifyReplacer:()=>dz,joinValues:()=>M0,issue:()=>lz,isPlainObject:()=>X7,isObject:()=>CY,hexToUint8Array:()=>hk0,getSizableOrigin:()=>YG,getParsedType:()=>Nk0,getLengthableOrigin:()=>UG,getEnumValues:()=>tK,getElementAtPath:()=>Fk0,floatSafeRemainder:()=>Fj,finalizeIssue:()=>T8,extend:()=>Pk0,explicitlyAborted:()=>Pj,escapeRegex:()=>A$,esc:()=>$V,defineLazy:()=>E1,createTransparentProxy:()=>Dk0,cloneDef:()=>Lk0,clone:()=>P8,cleanRegex:()=>eK,cleanEnum:()=>Rk0,captureStackTrace:()=>YV,cached:()=>mz,base64urlToUint8Array:()=>_k0,base64ToUint8Array:()=>Mr,assignProp:()=>W7,assertNotEqual:()=>Wk0,assertNever:()=>Zk0,assertIs:()=>Xk0,assertEqual:()=>Hk0,assert:()=>qk0,allowsEval:()=>wj,aborted:()=>Z7,NUMBER_FORMAT_RANGES:()=>Aj,Class:()=>DrLine truncated
`)}var Ar=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,dz,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},zG,u8;var Ej=m(()=>{EY();Y1();zG=W0("$ZodError",Ar),u8=W0("$ZodError",Ar,{Parent:Error})});var oz=($)=>(Y,U,z,Q)=>{let J=z?{...z,async:!1}:{async:!1},I=Y._zod.run({value:U,issues:[]},J);if(I instanceof Promise)throw new n5;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>T8(G,J,a4())));throw YV(K,Q?.callee),K}return I.value},UV,rz=($)=>async(Y,U,z,Q)=>{let J=z?{...z,async:!0}:{async:!0},I=Y._zod.run({value:U,issues:[]},J);if(I instanceof Promise)I=await I;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>T8(G,J,a4())));throw YV(K,Q?.callee),K}return I.value},zV,sz=($)=>(Y,U,z)=>{let Q=z?{...z,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)throw new n5;return J.issues.length?{success:!1,error:new($??zG)(J.issues.map((I)=>T8(I,Q,a4())))}:{success:!0,data:J.value}},Cj,az=($)=>async(Y,U,z)=>{let Q=z?{...z,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((I)=>T8(I,Q,a4())))}:{success:!0,data:J.value}},Rj,QV=($)=>(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return oz($)(Y,U,Q)},yk0,JV=($)=>(Y,U,z)=>{return oz($)(Y,U,z)},kk0,IV=($)=>async(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return rz($)(Y,U,Q)},xk0,KV=($)=>async(Y,U,z)=>{return rz($)(Y,U,z)},fk0,GV=($)=>(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return sz($)(Y,U,Q)},uk0,HV=($)=>(Y,U,z)=>{return sz($)(Y,U,z)},bk0,WV=($)=>async(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return az($)(Y,U,Q)},ik0,XV=($)=>async(Y,U,z)=>{return az($)(Y,U,z)},nk0;var _j=m(()=>{EY();Ej();Y1();UV=oz(u8),zV=rz(u8),Cj=sz(u8),Rj=az(u8),yk0=QV(u8),kk0=JV(u8),xk0=IV(u8),fk0=KV(u8),uk0=GV(u8),bk0=HV(u8),ik0=WV(u8),nk0=XV(u8)});var U$={};B8(U$,{xid:()=>gj,uuid7:()=>mk0,uuid6:()=>dk0,uuid4:()=>pk0,uuid:()=>RY,uppercase:()=>JE,unicodeEmail:()=>Pr,undefined:()=>zE,ulid:()=>Sj,time:()=>sj,string:()=>tj,sha512_hex:()=>qx0,sha512_base64url:()=>Lx0,sha512_base64:()=>Vx0,sha384_hex:()=>Wx0,sha384_base64url:()=>Zx0,sha384_base64:()=>Xx0,sha256_hex:()=>Kx0,sha256_base64url:()=>Hx0,sha256_base64:()=>Gx0,sha1_hex:()=>Qx0,sha1_base64url:()=>Ix0,sha1_base64:()=>Jx0,rfc5322Email:()=>ok0,number:()=>IG,null:()=>UE,nanoid:()=>kj,md5_hex:()=>Yx0,md5_base64url:()=>zx0,md5_base64:()=>Ux0,mac:()=>cj,lowercase:()=>QE,ksuid:()=>yj,ipv6:()=>nj,ipv4:()=>ij,integer:()=>$E,idnEmail:()=>rk0,httpProtocol:()=>lj,html5Email:()=>lk0,hostname:()=>tk0,hex:()=>$x0,guid:()=>fj,extendedDuration:()=>ck0,emoji:()=>bj,email:()=>uj,e164:()=>oj,duration:()=>xj,domain:()=>ek0,datetime:()=>aj,date:()=>rj,cuid2:()=>hj,cuid:()=>vj,cidrv6:()=>dj,cidrv4:()=>pj,browserEmail:()=>sk0,boolean:()=>YE,bigint:()=>ej,base64url:()=>ZV,base64:()=>mj});function bj(){return new RegExp(ak0,"u")}function jr($){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 sj($){return new RegExp(`^${jr($)}$`)}function aj($){let Y=jr({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let z=`${Y}(?:${U.join("|")})`;return new RegExp(`^${Tr}T(?:${z})$`)}function KG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function GG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var vj,hj,Sj,gj,yj,kj,xj,ck0,fj,RY=($)=>{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})$`)},pk0,dk0,mk0,uj,lk0,ok0,Pr,rk0,sk0,ak0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ij,nj,cj=($)=>{let Y=A$($??":");return new RegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},pj,dj,mj,ZV,tk0,ek0,lj,oj,Tr="(?:(?:\\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])))",rj,tj=($)=>{let Y=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)},ej,$E,IG,YE,UE,zE,QE,JE,$x0,Yx0,Ux0,zx0,Qx0,Jx0,Ix0,Kx0,Gx0,Hx0,Wx0,Xx0,Zx0,qx0,Vx0,Lx0;var qV=m(()=>{Y1();vj=/^[cC][0-9a-z]{6,}$/,hj=/^[0-9a-z]+$/,Sj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,gj=/^[0-9a-vA-V]{20}$/,yj=/^[A-Za-z0-9]{27}$/,kj=/^[a-zA-Z0-9_-]{21}$/,xj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
import{createRequire as Xk0}from"node:module";var Uk0=Object.create;var{getPrototypeOf:zk0,defineProperty:Vj,getOwnPropertyNames:Qk0}=Object;var Jk0=Object.prototype.hasOwnProperty;function Ik0($){return this[$]}var Kk0,Gk0,J6=($,Y,U)=>{var z=$!=null&&typeof $==="object";if(z){var Q=Y?Kk0??=new WeakMap:Gk0??=new WeakMap,J=Q.get($);if(J)return J}U=$!=null?Uk0(zk0($)):{};let I=Y||!$||!$.__esModule?Vj(U,"default",{value:$,enumerable:!0}):U;for(let K of Qk0($))if(!Jk0.call(I,K))Vj(I,K,{get:Ik0.bind($,K),enumerable:!0});if(z)Q.set($,I);return I};var E=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports);var Hk0=($)=>$;function Wk0($,Y){this[$]=Hk0.bind(null,Y)}var P8=($,Y)=>{for(var U in Y)Vj($,U,{get:Y[U],enumerable:!0,configurable:!0,set:Wk0.bind(Y,U)})};var m=($,Y)=>()=>($&&(Y=$($=0)),Y);var I0=Xk0(import.meta.url);var Zk0,eq,qk0,Vk0,Lk0,Fk0,C0=($,Y)=>()=>(Y||$((Y={exports:{}}).exports,Y),Y.exports),Fr=($,Y)=>{let U={};for(var z in $)eq(U,z,{get:$[z],enumerable:!0});if(Y)eq(U,Symbol.toStringTag,{value:"Module"});return U},wk0=($,Y,U,z)=>{if(Y&&typeof Y==="object"||typeof Y==="function"){for(var Q=Vk0(Y),J=0,I=Q.length,K;J<I;J++)if(K=Q[J],!Fk0.call($,K)&&K!==U)eq($,K,{get:((G)=>Y[G]).bind(null,K),enumerable:!(z=qk0(Y,K))||z.enumerable})}return $},$V=($,Y,U)=>(U=$!=null?Zk0(Lk0($)):{},wk0(Y||!$||!$.__esModule?eq(U,"default",{value:$,enumerable:!0}):U,$));var Lj=m(()=>{Zk0=Object.create,eq=Object.defineProperty,qk0=Object.getOwnPropertyDescriptor,Vk0=Object.getOwnPropertyNames,Lk0=Object.getPrototypeOf,Fk0=Object.prototype.hasOwnProperty});function Or($){return typeof $==="string"&&wr.has($.replace(/#$/,""))}function Mr($,Y){if(!("$schema"in $)||typeof $.$schema!=="string")return"2020-12";let U=$.$schema.replace(/#$/,"");if(Ok0.has(U))return"2020-12";if(wr.has(U))return"2019-09";if(Mk0.has(U)||Nk0.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 Ok0,wr,Mk0,Nk0;var Fj=m(()=>{Ok0=new Set(["https://json-schema.org/draft/2020-12/schema","http://json-schema.org/draft/2020-12/schema"]),wr=new Set(["https://json-schema.org/draft/2019-09/schema","http://json-schema.org/draft/2019-09/schema"]),Mk0=new Set(["https://json-schema.org/draft-07/schema","http://json-schema.org/draft-07/schema"]),Nk0=new Set(["https://json-schema.org/draft-06/schema","http://json-schema.org/draft-06/schema"])});function W0($,Y,U){function z(K,G){if(!K._zod)Object.defineProperty(K,"_zod",{value:{def:G,constr:I,traits:new Set},enumerable:!1});if(K._zod.traits.has($))return;K._zod.traits.add($),Y(K,G);let H=I.prototype,W=Object.keys(H);for(let X=0;X<W.length;X++){let Z=W[X];if(!(Z in K))K[Z]=H[Z].bind(K)}}let Q=U?.Parent??Object;class J extends Q{}Object.defineProperty(J,"name",{value:$});function I(K){var G;let H=U?.Parent?new J:this;z(H,K),(G=H._zod).deferred??(G.deferred=[]);for(let W of H._zod.deferred)W();return H}return Object.defineProperty(I,"init",{value:z}),Object.defineProperty(I,Symbol.hasInstance,{value:(K)=>{if(U?.Parent&&K instanceof U.Parent)return!0;return K?._zod?.traits?.has($)}}),Object.defineProperty(I,"name",{value:$}),I}function a4($){if($)Object.assign(TY,$);return TY}var Nr,sK,wj,c5,jY,TY;var EY=m(()=>{sK=Object.freeze({status:"aborted"});wj=Symbol("zod_brand");c5=class c5 extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};jY=class jY extends Error{constructor($){super(`Encountered unidirectional transform during encode: ${$}`);this.name="ZodEncodeError"}};(Nr=globalThis).__zod_globalConfig??(Nr.__zod_globalConfig={});TY=globalThis.__zod_globalConfig});var k0={};P8(k0,{unwrapMessage:()=>aK,uint8ArrayToHex:()=>pk0,uint8ArrayToBase64url:()=>ck0,uint8ArrayToBase64:()=>Ar,stringifyPrimitive:()=>v0,slugify:()=>Nj,shallowClone:()=>Bj,safeExtend:()=>xk0,required:()=>bk0,randomString:()=>_k0,propertyKeyTypes:()=>$G,promiseAllObject:()=>Rk0,primitiveTypes:()=>Aj,prefixIssues:()=>b8,pick:()=>gk0,partial:()=>uk0,parsedType:()=>S0,optionalKeys:()=>Pj,omit:()=>yk0,objectClone:()=>jk0,numKeys:()=>vk0,nullish:()=>W7,normalizeParams:()=>f0,mergeDefs:()=>m9,merge:()=>fk0,jsonStringifyReplacer:()=>pz,joinValues:()=>M0,issue:()=>lz,isPlainObject:()=>Z7,isObject:()=>CY,hexToUint8Array:()=>dk0,getSizableOrigin:()=>YG,getParsedType:()=>hk0,getLengthableOrigin:()=>UG,getEnumValues:()=>tK,getElementAtPath:()=>Ck0,floatSafeRemainder:()=>Mj,finalizeIssue:()=>j8,extend:()=>kk0,explicitlyAborted:()=>Ej,escapeRegex:()=>A$,esc:()=>YV,defineLazy:()=>E1,createTransparentProxy:()=>Sk0,cloneDef:()=>Ek0,clone:()=>T8,cleanRegex:()=>eK,cleanEnum:()=>ik0,captureStackTrace:()=>UV,cached:()=>mz,base64urlToUint8Array:()=>nk0,base64ToUint8Array:()=>Br,assignProp:()=>X7,assertNotEqual:()=>Bk0,assertNever:()=>Pk0,assertIs:()=>Ak0,assertEqual:()=>Dk0,assert:()=>Tk0,allowsEval:()=>Dj,aborted:()=>q7,NUMBER_FORMAT_RANGES:()=>Tj,Class:()=>PrLine truncated
`)}var Tr=($,Y)=>{$.name="$ZodError",Object.defineProperty($,"_zod",{value:$._zod,enumerable:!1}),Object.defineProperty($,"issues",{value:Y,enumerable:!1}),$.message=JSON.stringify(Y,pz,2),Object.defineProperty($,"toString",{value:()=>$.message,enumerable:!1})},zG,i8;var _j=m(()=>{EY();$1();zG=W0("$ZodError",Tr),i8=W0("$ZodError",Tr,{Parent:Error})});var oz=($)=>(Y,U,z,Q)=>{let J=z?{...z,async:!1}:{async:!1},I=Y._zod.run({value:U,issues:[]},J);if(I instanceof Promise)throw new c5;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>j8(G,J,a4())));throw UV(K,Q?.callee),K}return I.value},zV,rz=($)=>async(Y,U,z,Q)=>{let J=z?{...z,async:!0}:{async:!0},I=Y._zod.run({value:U,issues:[]},J);if(I instanceof Promise)I=await I;if(I.issues.length){let K=new(Q?.Err??$)(I.issues.map((G)=>j8(G,J,a4())));throw UV(K,Q?.callee),K}return I.value},QV,sz=($)=>(Y,U,z)=>{let Q=z?{...z,async:!1}:{async:!1},J=Y._zod.run({value:U,issues:[]},Q);if(J instanceof Promise)throw new c5;return J.issues.length?{success:!1,error:new($??zG)(J.issues.map((I)=>j8(I,Q,a4())))}:{success:!0,data:J.value}},vj,az=($)=>async(Y,U,z)=>{let Q=z?{...z,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((I)=>j8(I,Q,a4())))}:{success:!0,data:J.value}},hj,JV=($)=>(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return oz($)(Y,U,Q)},lk0,IV=($)=>(Y,U,z)=>{return oz($)(Y,U,z)},ok0,KV=($)=>async(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return rz($)(Y,U,Q)},rk0,GV=($)=>async(Y,U,z)=>{return rz($)(Y,U,z)},sk0,HV=($)=>(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return sz($)(Y,U,Q)},ak0,WV=($)=>(Y,U,z)=>{return sz($)(Y,U,z)},tk0,XV=($)=>async(Y,U,z)=>{let Q=z?{...z,direction:"backward"}:{direction:"backward"};return az($)(Y,U,Q)},ek0,ZV=($)=>async(Y,U,z)=>{return az($)(Y,U,z)},$x0;var Sj=m(()=>{EY();_j();$1();zV=oz(i8),QV=rz(i8),vj=sz(i8),hj=az(i8),lk0=JV(i8),ok0=IV(i8),rk0=KV(i8),sk0=GV(i8),ak0=HV(i8),tk0=WV(i8),ek0=XV(i8),$x0=ZV(i8)});var z$={};P8(z$,{xid:()=>xj,uuid7:()=>Qx0,uuid6:()=>zx0,uuid4:()=>Ux0,uuid:()=>RY,uppercase:()=>GE,unicodeEmail:()=>Er,undefined:()=>IE,ulid:()=>kj,time:()=>ej,string:()=>YE,sha512_hex:()=>Tx0,sha512_base64url:()=>Ex0,sha512_base64:()=>jx0,sha384_hex:()=>Bx0,sha384_base64url:()=>Px0,sha384_base64:()=>Ax0,sha256_hex:()=>Mx0,sha256_base64url:()=>Dx0,sha256_base64:()=>Nx0,sha1_hex:()=>Fx0,sha1_base64url:()=>Ox0,sha1_base64:()=>wx0,rfc5322Email:()=>Ix0,number:()=>IG,null:()=>JE,nanoid:()=>uj,md5_hex:()=>qx0,md5_base64url:()=>Lx0,md5_base64:()=>Vx0,mac:()=>mj,lowercase:()=>KE,ksuid:()=>fj,ipv6:()=>pj,ipv4:()=>dj,integer:()=>zE,idnEmail:()=>Kx0,httpProtocol:()=>sj,html5Email:()=>Jx0,hostname:()=>Wx0,hex:()=>Zx0,guid:()=>ij,extendedDuration:()=>Yx0,emoji:()=>cj,email:()=>nj,e164:()=>aj,duration:()=>bj,domain:()=>Xx0,datetime:()=>$E,date:()=>tj,cuid2:()=>yj,cuid:()=>gj,cidrv6:()=>oj,cidrv4:()=>lj,browserEmail:()=>Gx0,boolean:()=>QE,bigint:()=>UE,base64url:()=>qV,base64:()=>rj});function cj(){return new RegExp(Hx0,"u")}function Rr($){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 ej($){return new RegExp(`^${Rr($)}$`)}function $E($){let Y=Rr({precision:$.precision}),U=["Z"];if($.local)U.push("");if($.offset)U.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let z=`${Y}(?:${U.join("|")})`;return new RegExp(`^${Cr}T(?:${z})$`)}function KG($,Y){return new RegExp(`^[A-Za-z0-9+/]{${$}}${Y}$`)}function GG($){return new RegExp(`^[A-Za-z0-9_-]{${$}}$`)}var gj,yj,kj,xj,fj,uj,bj,Yx0,ij,RY=($)=>{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})$`)},Ux0,zx0,Qx0,nj,Jx0,Ix0,Er,Kx0,Gx0,Hx0="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dj,pj,mj=($)=>{let Y=A$($??":");return new RegExp(`^(?:[0-9A-F]{2}${Y}){5}[0-9A-F]{2}$|^(?:[0-9a-f]{2}${Y}){5}[0-9a-f]{2}$`)},lj,oj,rj,qV,Wx0,Xx0,sj,aj,Cr="(?:(?:\\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])))",tj,YE=($)=>{let Y=$?`[\\s\\S]{${$?.minimum??0},${$?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${Y}$`)},UE,zE,IG,QE,JE,IE,KE,GE,Zx0,qx0,Vx0,Lx0,Fx0,wx0,Ox0,Mx0,Nx0,Dx0,Bx0,Ax0,Px0,Tx0,jx0,Ex0;var VV=m(()=>{$1();gj=/^[cC][0-9a-z]{6,}$/,yj=/^[0-9a-z]+$/,kj=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,xj=/^[0-9a-vA-V]{20}$/,fj=/^[A-Za-z0-9]{27}$/,uj=/^[a-zA-Z0-9_-]{21}$/,bj=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\dLine truncated
`).filter((J)=>J),z=Math.min(...U.map((J)=>J.length-J.trimStart().length)),Q=U.map((J)=>J.slice(z)).map((J)=>" ".repeat(this.indent*2)+J);for(let J of Q)this.content.push(J)}compile(){let $=Function,Y=this?.args,z=[...(this?.content??[""]).map((Q)=>` ${Q}`)];return new $(...Y,z.join(`
`))}}var PE;var TE=m(()=>{PE={major:4,minor:4,patch:3}});function lE($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function pr($){if(!ZV.test($))return!1;let Y=$.replace(/[-_]/g,(z)=>z==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return lE(U)}function dr($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[z]=U;if(!z)return!1;let Q=JSON.parse(atob(z));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 _r($,Y,U){if($.issues.length)Y.issues.push(...f8(U,$.issues));Y.value[U]=$.value}function DV($,Y,U,z,Q,J){let I=U in z;if($.issues.length){if(Q&&J&&!I)return;Y.issues.push(...f8(U,$.issues))}if(!I&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(I)Y.value[U]=void 0}else Y.value[U]=$.value}function mr($){let Y=Object.keys($.shape);for(let z of Y)if(!$.shape?.[z]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${z}": expected a Zod schema`);let U=Dj($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function lr($,Y,U,z,Q,J){let I=[],K=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(K.has(Z))continue;if(H==="never"){I.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},z);if(q instanceof Promise)$.push(q.then((V)=>DV(V,U,Z,Y,W,X)));else DV(q,U,Z,Y,W,X)}if(I.length)U.issues.push({code:"unrecognized_keys",keys:I,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function vr($,Y,U,z){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!Z7(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((I)=>T8(I,z,a4())))}),Y}function hr($,Y,U,z){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((I)=>T8(I,z,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function jE($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(X7($)&&X7(Y)){let U=Object.keys(Y),z=Object.keys($).filter((J)=>U.indexOf(J)!==-1),Q={...$,...Y};for(let J of z){let I=jE($[J],Y[J]);if(!I.valid)return{valid:!1,mergeErrorPath:[J,...I.mergeErrorPath]};Q[J]=I.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let z=0;z<$.length;z++){let Q=$[z],J=Y[z],I=jE(Q,J);if(!I.valid)return{valid:!1,mergeErrorPath:[z,...I.mergeErrorPath]};U.push(I.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function Sr($,Y,U){let z=new Map,Q;for(let K of Y.issues)if(K.code==="unrecognized_keys"){Q??(Q=K);for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).l=!0}}else $.issues.push(K);for(let K of U.issues)if(K.code==="unrecognized_keys")for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).r=!0}else $.issues.push(K);let J=[...z].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Q)$.issues.push({...Q,keys:J});if(Z7($))return $;let I=jE(Y.value,U.value);if(!I.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(I.mergeErrorPath)}`);return $.value=I.data,$}function gr($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function yr($,Y,U){if($.issues.length)Y.issues.push(...f8(U,$.issues));Y.value[U]=$.value}function kr($,Y,U,z,Q){for(let J=0;J<U.length;J++){let I=$[J],K=J<z.length;if(I.issues.length){if(!K&&J>=Q){Y.value.length=J;break}Y.issues.push(...f8(J,I.issues))}Y.value[J]=I.value}for(let J=Y.value.length-1;J>=z.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function xr($,Y,U,z,Q,J,I){if($.issues.length)if($G.has(typeof z))U.issues.push(...f8(z,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((K)=>T8(K,I,a4()))});if(Y.issues.length)if($G.has(typeof z))U.issues.push(...f8(z,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:z,issues:Y.issues.map((K)=>T8(K,I,a4()))});U.value.set($.value,Y.value)}function fr($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function ur($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function br($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function ir($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function wV($,Y,U){if($.issues.length)return $.aborted=!0,$;return Y._zod.run({value:$.value,issues:$.issues,fa Line truncated
`))}}var EE;var CE=m(()=>{EE={major:4,minor:4,patch:3}});function sE($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}function lr($){if(!qV.test($))return!1;let Y=$.replace(/[-_]/g,(z)=>z==="-"?"+":"/"),U=Y.padEnd(Math.ceil(Y.length/4)*4,"=");return sE(U)}function or($,Y=null){try{let U=$.split(".");if(U.length!==3)return!1;let[z]=U;if(!z)return!1;let Q=JSON.parse(atob(z));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 Sr($,Y,U){if($.issues.length)Y.issues.push(...b8(U,$.issues));Y.value[U]=$.value}function BV($,Y,U,z,Q,J){let I=U in z;if($.issues.length){if(Q&&J&&!I)return;Y.issues.push(...b8(U,$.issues))}if(!I&&!Q){if(!$.issues.length)Y.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[U]});return}if($.value===void 0){if(I)Y.value[U]=void 0}else Y.value[U]=$.value}function rr($){let Y=Object.keys($.shape);for(let z of Y)if(!$.shape?.[z]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${z}": expected a Zod schema`);let U=Pj($.shape);return{...$,keys:Y,keySet:new Set(Y),numKeys:Y.length,optionalKeys:new Set(U)}}function sr($,Y,U,z,Q,J){let I=[],K=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(K.has(Z))continue;if(H==="never"){I.push(Z);continue}let q=G.run({value:Y[Z],issues:[]},z);if(q instanceof Promise)$.push(q.then((V)=>BV(V,U,Z,Y,W,X)));else BV(q,U,Z,Y,W,X)}if(I.length)U.issues.push({code:"unrecognized_keys",keys:I,input:Y,inst:J});if(!$.length)return U;return Promise.all($).then(()=>{return U})}function gr($,Y,U,z){for(let J of $)if(J.issues.length===0)return Y.value=J.value,Y;let Q=$.filter((J)=>!q7(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((I)=>j8(I,z,a4())))}),Y}function yr($,Y,U,z){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((I)=>j8(I,z,a4())))});else Y.issues.push({code:"invalid_union",input:Y.value,inst:U,errors:[],inclusive:!1});return Y}function RE($,Y){if($===Y)return{valid:!0,data:$};if($ instanceof Date&&Y instanceof Date&&+$===+Y)return{valid:!0,data:$};if(Z7($)&&Z7(Y)){let U=Object.keys(Y),z=Object.keys($).filter((J)=>U.indexOf(J)!==-1),Q={...$,...Y};for(let J of z){let I=RE($[J],Y[J]);if(!I.valid)return{valid:!1,mergeErrorPath:[J,...I.mergeErrorPath]};Q[J]=I.data}return{valid:!0,data:Q}}if(Array.isArray($)&&Array.isArray(Y)){if($.length!==Y.length)return{valid:!1,mergeErrorPath:[]};let U=[];for(let z=0;z<$.length;z++){let Q=$[z],J=Y[z],I=RE(Q,J);if(!I.valid)return{valid:!1,mergeErrorPath:[z,...I.mergeErrorPath]};U.push(I.data)}return{valid:!0,data:U}}return{valid:!1,mergeErrorPath:[]}}function kr($,Y,U){let z=new Map,Q;for(let K of Y.issues)if(K.code==="unrecognized_keys"){Q??(Q=K);for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).l=!0}}else $.issues.push(K);for(let K of U.issues)if(K.code==="unrecognized_keys")for(let G of K.keys){if(!z.has(G))z.set(G,{});z.get(G).r=!0}else $.issues.push(K);let J=[...z].filter(([,K])=>K.l&&K.r).map(([K])=>K);if(J.length&&Q)$.issues.push({...Q,keys:J});if(q7($))return $;let I=RE(Y.value,U.value);if(!I.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(I.mergeErrorPath)}`);return $.value=I.data,$}function xr($,Y){for(let U=$.length-1;U>=0;U--)if($[U]._zod[Y]!=="optional")return U+1;return 0}function fr($,Y,U){if($.issues.length)Y.issues.push(...b8(U,$.issues));Y.value[U]=$.value}function ur($,Y,U,z,Q){for(let J=0;J<U.length;J++){let I=$[J],K=J<z.length;if(I.issues.length){if(!K&&J>=Q){Y.value.length=J;break}Y.issues.push(...b8(J,I.issues))}Y.value[J]=I.value}for(let J=Y.value.length-1;J>=z.length;J--)if(U[J]._zod.optout==="optional"&&Y.value[J]===void 0)Y.value.length=J;else break;return Y}function br($,Y,U,z,Q,J,I){if($.issues.length)if($G.has(typeof z))U.issues.push(...b8(z,$.issues));else U.issues.push({code:"invalid_key",origin:"map",input:Q,inst:J,issues:$.issues.map((K)=>j8(K,I,a4()))});if(Y.issues.length)if($G.has(typeof z))U.issues.push(...b8(z,Y.issues));else U.issues.push({origin:"map",code:"invalid_element",input:Q,inst:J,key:z,issues:Y.issues.map((K)=>j8(K,I,a4()))});U.value.set($.value,Y.value)}function ir($,Y){if($.issues.length)Y.issues.push(...$.issues);Y.value.add($.value)}function nr($,Y){if(Y===void 0&&($.issues.length||$.fallback))return{issues:[],value:void 0};return $}function cr($,Y){if($.value===void 0)$.value=Y.defaultValue;return $}function dr($,Y){if(!$.issues.length&&$.value===void 0)$.issues.push({code:"invalid_type",expected:"nonoptional",input:$.value,inst:Y});return $}function MV($,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 => ({
@@ -19,7 +19,7 @@ import{createRequire as ey0}from"node:module";var py0=Object.create;var{getProto
newResult[${P}] = ${D}.value;
}
`);else if(!A)q.write(`
`);else if(!B)q.write(`
const ${D}_present = ${P} in input;
if (${D}.issues.length) {
payload.issues = payload.issues.concat(${D}.issues.map(iss => ({
@@ -60,108 +60,108 @@ import{createRequire as ey0}from"node:module";var py0=Object.create;var{getProto
newResult[${P}] = ${D}.value;
}
`)}q.write("payload.value = newResult;"),q.write("return payload;");let M=q.compile();return(N,D)=>M(Z,N,D)},J,I=CY,K=!TY.jitless,H=K&&wj.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=z.value);let V=Z.value;if(!I(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(K&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!W)return Z;return lr([],V,Z,q,X,$)}return U(Z,q)}});WG=W0("$ZodUnion",($,Y)=>{V1.init($,Y),E1($._zod,"optin",()=>Y.options.some((z)=>z._zod.optin==="optional")?"optional":void 0),E1($._zod,"optout",()=>Y.options.some((z)=>z._zod.optout==="optional")?"optional":void 0),E1($._zod,"values",()=>{if(Y.options.every((z)=>z._zod.values))return new Set(Y.options.flatMap((z)=>Array.from(z._zod.values)));return}),E1($._zod,"pattern",()=>{if(Y.options.every((z)=>z._zod.pattern)){let z=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${z.map((Q)=>eK(Q.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(U)return U(z,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else{if(G.issues.length===0)return G;I.push(G)}}if(!J)return vr(I,z,$,Q);return Promise.all(I).then((K)=>{return vr(K,z,$,Q)})}});XC=W0("$ZodXor",($,Y)=>{WG.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(U)return U(z,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else I.push(G)}if(!J)return hr(I,z,$,Q);return Promise.all(I).then((K)=>{return hr(K,z,$,Q)})}}),ZC=W0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,WG.init($,Y);let U=$._zod.parse;E1($._zod,"propValues",()=>{let Q={};for(let J of Y.options){let I=J._zod.propValues;if(!I||Object.keys(I).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let[K,G]of Object.entries(I)){if(!Q[K])Q[K]=new Set;for(let H of G)Q[K].add(H)}}return Q});let z=mz(()=>{let Q=Y.options,J=new Map;for(let I of Q){let K=I._zod.propValues?.[Y.discriminator];if(!K||K.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(I)}"`);for(let G of K){if(J.has(G))throw Error(`Duplicate discriminator value "${String(G)}"`);J.set(G,I)}}return J});$._zod.parse=(Q,J)=>{let I=Q.value;if(!CY(I))return Q.issues.push({code:"invalid_type",expected:"object",input:I,inst:$}),Q;let K=z.value.get(I?.[Y.discriminator]);if(K)return K._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(z.value.keys()),input:I,path:[Y.discriminator],inst:$}),Q}}),qC=W0("$ZodIntersection",($,Y)=>{V1.init($,Y),$._zod.parse=(U,z)=>{let Q=U.value,J=Y.left._zod.run({value:Q,issues:[]},z),I=Y.right._zod.run({value:Q,issues:[]},z);if(J instanceof Promise||I instanceof Promise)return Promise.all([J,I]).then(([G,H])=>{return Sr(U,G,H)});return Sr(U,J,I)}});PV=W0("$ZodTuple",($,Y)=>{V1.init($,Y);let U=Y.items;$._zod.parse=(z,Q)=>{let J=z.value;if(!Array.isArray(J))return z.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),z;z.value=[];let I=[],K=gr(U,"optin"),G=gr(U,"optout");if(!Y.rest){if(J.length<K)return z.issues.push({code:"too_small",minimum:K,inclusive:!0,input:J,inst:$,origin:"array"}),z;if(J.length>U.length)z.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)I.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)I.push(q.then((V)=>yr(V,z,W)));else yr(q,z,W)}}if(I.length)return Promise.all(I).then(()=>kr(H,z,U,J,G));return kr(H,z,U,J,G)}});VC=W0("$ZodRecord",($,Y)=>{V1.init($,Y),$._zod.parse=(U,z)=>{let Q=U.value;if(!X7(Q))return U.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),U;let J=[],I=Y.keyType._zod.values;if(I){U.value={};let K=new Set;for(let H of I)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){K.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},z);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)=>T8(q,z,a4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:Q[H],issues:[]},z);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...f8(H,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...f8(H,Z.issues));U.value[X]=Z.value}}let G;for(let H in Q)if(!K.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(M,D)=>N(Z,M,D)},J,I=CY,K=!TY.jitless,H=K&&Dj.value,W=Y.catchall,X;$._zod.parse=(Z,q)=>{X??(X=z.value);let V=Z.value;if(!I(V))return Z.issues.push({expected:"object",code:"invalid_type",input:V,inst:$}),Z;if(K&&H&&q?.async===!1&&q.jitless!==!0){if(!J)J=Q(Y.shape);if(Z=J(Z,q),!W)return Z;return sr([],V,Z,q,X,$)}return U(Z,q)}});WG=W0("$ZodUnion",($,Y)=>{V1.init($,Y),E1($._zod,"optin",()=>Y.options.some((z)=>z._zod.optin==="optional")?"optional":void 0),E1($._zod,"optout",()=>Y.options.some((z)=>z._zod.optout==="optional")?"optional":void 0),E1($._zod,"values",()=>{if(Y.options.every((z)=>z._zod.values))return new Set(Y.options.flatMap((z)=>Array.from(z._zod.values)));return}),E1($._zod,"pattern",()=>{if(Y.options.every((z)=>z._zod.pattern)){let z=Y.options.map((Q)=>Q._zod.pattern);return new RegExp(`^(${z.map((Q)=>eK(Q.source)).join("|")})$`)}return});let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(U)return U(z,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else{if(G.issues.length===0)return G;I.push(G)}}if(!J)return gr(I,z,$,Q);return Promise.all(I).then((K)=>{return gr(K,z,$,Q)})}});VC=W0("$ZodXor",($,Y)=>{WG.init($,Y),Y.inclusive=!1;let U=Y.options.length===1?Y.options[0]._zod.run:null;$._zod.parse=(z,Q)=>{if(U)return U(z,Q);let J=!1,I=[];for(let K of Y.options){let G=K._zod.run({value:z.value,issues:[]},Q);if(G instanceof Promise)I.push(G),J=!0;else I.push(G)}if(!J)return yr(I,z,$,Q);return Promise.all(I).then((K)=>{return yr(K,z,$,Q)})}}),LC=W0("$ZodDiscriminatedUnion",($,Y)=>{Y.inclusive=!1,WG.init($,Y);let U=$._zod.parse;E1($._zod,"propValues",()=>{let Q={};for(let J of Y.options){let I=J._zod.propValues;if(!I||Object.keys(I).length===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(J)}"`);for(let[K,G]of Object.entries(I)){if(!Q[K])Q[K]=new Set;for(let H of G)Q[K].add(H)}}return Q});let z=mz(()=>{let Q=Y.options,J=new Map;for(let I of Q){let K=I._zod.propValues?.[Y.discriminator];if(!K||K.size===0)throw Error(`Invalid discriminated union option at index "${Y.options.indexOf(I)}"`);for(let G of K){if(J.has(G))throw Error(`Duplicate discriminator value "${String(G)}"`);J.set(G,I)}}return J});$._zod.parse=(Q,J)=>{let I=Q.value;if(!CY(I))return Q.issues.push({code:"invalid_type",expected:"object",input:I,inst:$}),Q;let K=z.value.get(I?.[Y.discriminator]);if(K)return K._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(z.value.keys()),input:I,path:[Y.discriminator],inst:$}),Q}}),FC=W0("$ZodIntersection",($,Y)=>{V1.init($,Y),$._zod.parse=(U,z)=>{let Q=U.value,J=Y.left._zod.run({value:Q,issues:[]},z),I=Y.right._zod.run({value:Q,issues:[]},z);if(J instanceof Promise||I instanceof Promise)return Promise.all([J,I]).then(([G,H])=>{return kr(U,G,H)});return kr(U,J,I)}});TV=W0("$ZodTuple",($,Y)=>{V1.init($,Y);let U=Y.items;$._zod.parse=(z,Q)=>{let J=z.value;if(!Array.isArray(J))return z.issues.push({input:J,inst:$,expected:"tuple",code:"invalid_type"}),z;z.value=[];let I=[],K=xr(U,"optin"),G=xr(U,"optout");if(!Y.rest){if(J.length<K)return z.issues.push({code:"too_small",minimum:K,inclusive:!0,input:J,inst:$,origin:"array"}),z;if(J.length>U.length)z.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)I.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)I.push(q.then((V)=>fr(V,z,W)));else fr(q,z,W)}}if(I.length)return Promise.all(I).then(()=>ur(H,z,U,J,G));return ur(H,z,U,J,G)}});wC=W0("$ZodRecord",($,Y)=>{V1.init($,Y),$._zod.parse=(U,z)=>{let Q=U.value;if(!Z7(Q))return U.issues.push({expected:"record",code:"invalid_type",input:Q,inst:$}),U;let J=[],I=Y.keyType._zod.values;if(I){U.value={};let K=new Set;for(let H of I)if(typeof H==="string"||typeof H==="number"||typeof H==="symbol"){K.add(typeof H==="number"?H.toString():H);let W=Y.keyType._zod.run({value:H,issues:[]},z);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)=>j8(q,z,a4())),input:H,path:[H],inst:$});continue}let X=W.value,Z=Y.valueType._zod.run({value:Q[H],issues:[]},z);if(Z instanceof Promise)J.push(Z.then((q)=>{if(q.issues.length)U.issues.push(...b8(H,q.issues));U.value[X]=q.value}));else{if(Z.issues.length)U.issues.push(...b8(H,Z.issues));U.value[X]=Z.value}}let G;for(let H in Q)if(!K.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 I of $.seen.entries()){let K=I[1];if(Y===I[0]){J(I);continue}if($.external){let H=$.external.registry.get(I[0])?.id;if(Y!==I[0]&&H){J(I);continue}}if($.metadataRegistry.get(I[0])?.id){J(I);continue}if(K.cycle){J(I);continue}if(K.count>1){if($.reused==="ref"){J(I);continue}}}}function O7($,Y){let U=$.seen.get(Y);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let z=(K)=>{let G=$.seen.get(K);if(G.ref===null)return;let H=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){z(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),K._zod.parent===X)for(let w in H){if(w==="$ref"||w==="allOf")continue;if(!(w in W))delete H[w]}if(V.$ref&&q.def)for(let w in H){if(w==="$ref"||w==="allOf")continue;if(w in q.def&&JSON.stringify(H[w])===JSON.stringify(q.def[w]))delete H[w]}}let Z=K._zod.parent;if(Z&&Z!==X){z(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:K,jsonSchema:H,path:G.path??[]})};for(let K of[...$.seen.entries()].reverse())z(K[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 K=$.external.registry.get(Y)?.id;if(!K)throw Error("Schema is missing an `id` property");Q.$id=$.external.uri(K)}Object.assign(Q,U.def??U.schema);let J=$.metadataRegistry.get(Y)?.id;if(J!==void 0&&Q.id===J)delete Q.id;let I=$.external?.defs??{};for(let K of $.seen.entries()){let G=K[1];if(G.def&&G.defId){if(G.def.id===G.defId)delete G.def.id;I[G.defId]=G.def}}if($.external);else if(Object.keys(I).length>0)if($.target==="draft-2020-12")Q.$defs=I;else Q.definitions=I;try{let K=JSON.parse(JSON.stringify(Q));return Object.defineProperty(K,"~standard",{value:{...Y["~standard"],jsonSchema:{input:qQ(Y,"input",$.processors),output:qQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throw Error("Error converting schema to JSON.")}}function E8($,Y){let U=Y??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let z=$._zod.def;if(z.type==="transform")return!0;if(z.type==="array")return E8(z.element,U);if(z.type==="set")return E8(z.valueType,U);if(z.type==="lazy")return E8(z.getter(),U);if(z.type==="promise"||z.type==="optional"||z.type==="nonoptional"||z.type==="nullable"||z.type==="readonly"||z.type==="default"||z.type==="prefault")return E8(z.innerType,U);if(z.type==="intersection")return E8(z.left,U)||E8(z.right,U);if(z.type==="record"||z.type==="map")return E8(z.keyType,U)||E8(z.valueType,U);if(z.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return E8(z.in,U)||E8(z.out,U)}if(z.type==="object"){for(let Q in z.shape)if(E8(z.shape[Q],U))return!0;return!1}if(z.type==="union"){for(let Q of z.options)if(E8(Q,U))return!0;return!1}if(z.type==="tuple"){for(let Q of z.items)if(E8(Q,U))return!0;if(z.rest&&E8(z.rest,U))return!0;return!1}return!1}var P_=($,Y={})=>(U)=>{let z=L7({...U,processors:Y});return I4($,z),F7(z,$),O7(z,$)},qQ=($,Y,U={})=>(z)=>{let{libraryOptions:Q,target:J}=z??{},I=L7({...Q??{},target:J,io:Y,processors:U});return I4($,I),F7(I,$),O7(I,$)};var NG=m(()=>{OG()});function gY($,Y){if("_idmap"in $){let z=$,Q=L7({...Y,processors:eV}),J={};for(let G of z._idmap.entries()){let[H,W]=G;I4(W,Q)}let I={},K={registry:z,uri:Y?.uri,defs:J};Q.external=K;for(let G of z._idmap.entries()){let[H,W]=G;F7(Q,W),I[H]=O7(Q,W)}if(Object.keys(J).length>0){let G=Q.target==="draft-2020-12"?"$defs":"definitions";I.__shared={[G]:J}}return{schemas:I}}let U=L7({...Y,processors:eV});return I4($,U),F7(U,$),O7(U,$)}var xf0,T_=($,Y,U,z)=>{let Q=U;Q.type="string";let{minimum:J,maximum:I,format:K,patterns:G,contentEncoding:H}=$._zod.bag;if(typeof J==="number")Q.minLength=J;if(typeof I==="number")Q.maxLength=I;if(K){if(Q.format=xf0[K]??K,Q.format==="")delete Q.format;if(K==="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}))]}},j_=($,Y,U,z)=>{let Q=U,{minimum:J,maximum:I,format:K,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeof K==="string"&&K.includes("int"))Q.type="integer";else Q.type="number";let X=typeof W==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeof H==="number"&&H<=(I??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 Ob0($){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(!Fb0.test($)){let U=[...$].filter((z)=>!/[A-Za-z0-9._-]/.test(z)).filter((z,Q,J)=>J.indexOf(z)===Q);return Y.push(`Tool name contains invalid characters: ${U.map((z)=>`"${z}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function wb0($,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 DS($){let Y=Ob0($);return wb0($,Y.warnings),Y.isValid}function Mb0($){return typeof $==="object"&&$!==null&&"_zod"in $}function Nb0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function Db0($){if(typeof $!=="object"||$===null)return!1;if(kQ($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((U)=>Mb0(U))}function uO($){if($===void 0)return;if(Db0($))return U0($);if(typeof $==="object"&&$!==null&&!kQ($)&&Object.values($).some((Y)=>Nb0(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(!kQ($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var rh,ef0,B1,L1,$u0,it="2026-07-28",_7,pt,zu0,Qu0,Ju0,lt,ot,Ku0,BO,Ub1,zb1,Rt,zS,qu0,Vu0,gQ,c0,J1,hO,at,fQ,SO,Ou0=0,wu0="private",Mu0,Eu0,TO,KS,$e,Qb1,Jb1,Su0,gu0,GS,jO,LH="2026-07-28",ze,xu0,B$=($)=>iG.safeParse($).success,v7=($)=>nG.safeParse($).success,qH=($)=>BQ.safeParse($).success,xO=($)=>PQ.safeParse($).success,t9=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",gt="x-mcp-header",fu0,uu0,bu0,iu0,RO=-32020,Ib1,nu0,yt=!1,ah="draft-2020-12",du0,su0,au0,kt,tu0,Qb0,Ie=250,Jb0,Ib0,We,Xe,Kb0,Gb0,qe=60000,Wb0,Xb0,Zb0,Ve,OS,Lb0,Kb1,Le=10485760,MS=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??Le}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}},Fb0;var bO=m(()=>{Zj();qj();jt();Vh();rh=Symbol.for("mcp.sdk.errorBrands");ef0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return yQ(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 yQ(this,Y)}constructor(Y,U,z){super(U);this.code=Y,this.errorUri=z,this.name="OAuthError",eh(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)}},B1=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 yQ(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 yQ(this,$)}constructor($,Y,U){super(Y);this.code=$,this.data=U,this.name="SdkError",eh(this,new.target)}},$u0=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}};_7=[it];pt=["task","inputRequests","requestState"];Qu0=new Set(["const","enum","default","examples"]),Ju0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);lt={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},ot={"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},Ku0={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};Ub1=Object.keys(lt),zb1=Object.keys(ot);Rt={ok:!1,reason:"not-in-era"};zS={era:"2025-11-25",hasRequestMethod:rt,hasNotificationMethod:st,validateRequest:($,Y)=>PO(Wu0($),Y),validateResult:($,Y)=>PO(Hu0($),Y),validateNotification:($,Y)=>PO(Xu0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>Rt,validateInputResponse:()=>Rt,samplingResultVariant:($,Y)=>{let U=dt();return PO($?U.CreateMessageResultWithToolsSchema:U.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let U=ct($),z=U.structuredContent;if(z===void 0)return U;let Q=typeof z!=="object"||z===null||Array.isArray(z),J=Y!==void 0&&mt(Y);if(!Q&&!J)return U;return{...U,structuredContent:{result:z}}},decodeResult($,Y){if(sh(Y)&&"resultType"in Y){let U={...Y};return delete U.resultType,{kind:"complete",result:vt(U)}}return{kind:"complete",result:vt(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 I of $.seen.entries()){let K=I[1];if(Y===I[0]){J(I);continue}if($.external){let H=$.external.registry.get(I[0])?.id;if(Y!==I[0]&&H){J(I);continue}}if($.metadataRegistry.get(I[0])?.id){J(I);continue}if(K.cycle){J(I);continue}if(K.count>1){if($.reused==="ref"){J(I);continue}}}}function O7($,Y){let U=$.seen.get(Y);if(!U)throw Error("Unprocessed schema. This is a bug in Zod.");let z=(K)=>{let G=$.seen.get(K);if(G.ref===null)return;let H=G.def??G.schema,W={...H},X=G.ref;if(G.ref=null,X){z(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),K._zod.parent===X)for(let O in H){if(O==="$ref"||O==="allOf")continue;if(!(O in W))delete H[O]}if(V.$ref&&q.def)for(let O in H){if(O==="$ref"||O==="allOf")continue;if(O in q.def&&JSON.stringify(H[O])===JSON.stringify(q.def[O]))delete H[O]}}let Z=K._zod.parent;if(Z&&Z!==X){z(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:K,jsonSchema:H,path:G.path??[]})};for(let K of[...$.seen.entries()].reverse())z(K[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 K=$.external.registry.get(Y)?.id;if(!K)throw Error("Schema is missing an `id` property");Q.$id=$.external.uri(K)}Object.assign(Q,U.def??U.schema);let J=$.metadataRegistry.get(Y)?.id;if(J!==void 0&&Q.id===J)delete Q.id;let I=$.external?.defs??{};for(let K of $.seen.entries()){let G=K[1];if(G.def&&G.defId){if(G.def.id===G.defId)delete G.def.id;I[G.defId]=G.def}}if($.external);else if(Object.keys(I).length>0)if($.target==="draft-2020-12")Q.$defs=I;else Q.definitions=I;try{let K=JSON.parse(JSON.stringify(Q));return Object.defineProperty(K,"~standard",{value:{...Y["~standard"],jsonSchema:{input:qQ(Y,"input",$.processors),output:qQ(Y,"output",$.processors)}},enumerable:!1,writable:!1}),K}catch(K){throw Error("Error converting schema to JSON.")}}function C8($,Y){let U=Y??{seen:new Set};if(U.seen.has($))return!1;U.seen.add($);let z=$._zod.def;if(z.type==="transform")return!0;if(z.type==="array")return C8(z.element,U);if(z.type==="set")return C8(z.valueType,U);if(z.type==="lazy")return C8(z.getter(),U);if(z.type==="promise"||z.type==="optional"||z.type==="nonoptional"||z.type==="nullable"||z.type==="readonly"||z.type==="default"||z.type==="prefault")return C8(z.innerType,U);if(z.type==="intersection")return C8(z.left,U)||C8(z.right,U);if(z.type==="record"||z.type==="map")return C8(z.keyType,U)||C8(z.valueType,U);if(z.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;return C8(z.in,U)||C8(z.out,U)}if(z.type==="object"){for(let Q in z.shape)if(C8(z.shape[Q],U))return!0;return!1}if(z.type==="union"){for(let Q of z.options)if(C8(Q,U))return!0;return!1}if(z.type==="tuple"){for(let Q of z.items)if(C8(Q,U))return!0;if(z.rest&&C8(z.rest,U))return!0;return!1}return!1}var E_=($,Y={})=>(U)=>{let z=F7({...U,processors:Y});return K4($,z),w7(z,$),O7(z,$)},qQ=($,Y,U={})=>(z)=>{let{libraryOptions:Q,target:J}=z??{},I=F7({...Q??{},target:J,io:Y,processors:U});return K4($,I),w7(I,$),O7(I,$)};var NG=m(()=>{wG()});function gY($,Y){if("_idmap"in $){let z=$,Q=F7({...Y,processors:$L}),J={};for(let G of z._idmap.entries()){let[H,W]=G;K4(W,Q)}let I={},K={registry:z,uri:Y?.uri,defs:J};Q.external=K;for(let G of z._idmap.entries()){let[H,W]=G;w7(Q,W),I[H]=O7(Q,W)}if(Object.keys(J).length>0){let G=Q.target==="draft-2020-12"?"$defs":"definitions";I.__shared={[G]:J}}return{schemas:I}}let U=F7({...Y,processors:$L});return K4($,U),w7(U,$),O7(U,$)}var rf0,C_=($,Y,U,z)=>{let Q=U;Q.type="string";let{minimum:J,maximum:I,format:K,patterns:G,contentEncoding:H}=$._zod.bag;if(typeof J==="number")Q.minLength=J;if(typeof I==="number")Q.maxLength=I;if(K){if(Q.format=rf0[K]??K,Q.format==="")delete Q.format;if(K==="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}))]}},R_=($,Y,U,z)=>{let Q=U,{minimum:J,maximum:I,format:K,multipleOf:G,exclusiveMaximum:H,exclusiveMinimum:W}=$._zod.bag;if(typeof K==="string"&&K.includes("int"))Q.type="integer";else Q.type="number";let X=typeof W==="number"&&W>=(J??Number.NEGATIVE_INFINITY),Z=typeof H==="number"&&H<=(I??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 Rb0($){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(!Cb0.test($)){let U=[...$].filter((z)=>!/[A-Za-z0-9._-]/.test(z)).filter((z,Q,J)=>J.indexOf(z)===Q);return Y.push(`Tool name contains invalid characters: ${U.map((z)=>`"${z}"`).join(", ")}`,"Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)"),{isValid:!1,warnings:Y}}return{isValid:!0,warnings:Y}}function _b0($,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 PS($){let Y=Rb0($);return _b0($,Y.warnings),Y.isValid}function vb0($){return typeof $==="object"&&$!==null&&"_zod"in $}function hb0($){return typeof $==="object"&&$!==null&&!("_zod"in $)&&"_def"in $&&typeof $._def?.typeName==="string"}function Sb0($){if(typeof $!=="object"||$===null)return!1;if(kQ($))return!1;let Y=Object.getPrototypeOf($);if(Y!==Object.prototype&&Y!==null)return!1;return Object.values($).every((U)=>vb0(U))}function bw($){if($===void 0)return;if(Sb0($))return U0($);if(typeof $==="object"&&$!==null&&!kQ($)&&Object.values($).some((Y)=>hb0(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(!kQ($))throw TypeError("inputSchema/outputSchema/argsSchema must be a Standard Schema (e.g. z.object({...})) or a raw Zod shape ({ field: z.string() }).");return $}var th,Xu0,P1,L1,Zu0,dt="2026-07-28",v7,lt,Lu0,Fu0,wu0,st,at,Mu0,Pw,Zb1,qb1,ht,IS,Tu0,ju0,gQ,c0,J1,Sw,$e,fQ,gw,Ru0=0,_u0="private",vu0,uu0,jw,WS,ze,Vb1,Lb1,pu0,mu0,XS,Ew,LH="2026-07-28",Ie,ru0,P$=($)=>iG.safeParse($).success,h7=($)=>nG.safeParse($).success,qH=($)=>AQ.safeParse($).success,fw=($)=>PQ.safeParse($).success,$3=($)=>typeof $==="object"&&$!==null&&!Array.isArray($)&&$.resultType==="input_required",xt="x-mcp-header",su0,au0,tu0,eu0,_w=-32020,Fb1,$b0,ft=!1,$S="draft-2020-12",zb0,Gb0,Hb0,ut,Wb0,Fb0,He=250,wb0,Ob0,qe,Ve,Mb0,Nb0,Fe=60000,Bb0,Ab0,Pb0,we,NS,Eb0,wb1,Oe=10485760,BS=class{_buffer;_maxBufferSize;constructor($){this._maxBufferSize=$?.maxBufferSize??Oe}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 Me(Y)}catch(U){if(U instanceof SyntaxError)continue;throw U}}return null}clear(){this._buffer=void 0}},Cb0;var iw=m(()=>{Lj();Fj();Rt();wh();th=Symbol.for("mcp.sdk.errorBrands");Xu0=class $ extends Error{static{Object.defineProperty(this,"mcpBrand",{value:"mcp.OAuthError"})}static[Symbol.hasInstance](Y){return yQ(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 yQ(this,Y)}constructor(Y,U,z){super(U);this.code=Y,this.errorUri=z,this.name="OAuthError",US(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)}},P1=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 yQ(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 yQ(this,$)}constructor($,Y,U){super(Y);this.code=$,this.data=U,this.name="SdkError",US(this,new.target)}},Zu0=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}};v7=[dt];lt=["task","inputRequests","requestState"];Fu0=new Set(["const","enum","default","examples"]),wu0=new Set(["properties","patternProperties","$defs","definitions","dependentSchemas","dependencies"]);st={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},at={"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},Mu0={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};Zb1=Object.keys(st),qb1=Object.keys(at);ht={ok:!1,reason:"not-in-era"};IS={era:"2025-11-25",hasRequestMethod:tt,hasNotificationMethod:et,validateRequest:($,Y)=>Tw(Bu0($),Y),validateResult:($,Y)=>Tw(Du0($),Y),validateNotification:($,Y)=>Tw(Au0($),Y),hasInputRequestMethod:()=>!1,validateInputRequest:()=>ht,validateInputResponse:()=>ht,samplingResultVariant:($,Y)=>{let U=ot();return Tw($?U.CreateMessageResultWithToolsSchema:U.CreateMessageResultSchema,Y)},outboundEnvelope:($)=>{return},validateEnvelopeMeta:($)=>[],projectCallToolResult($,Y){let U=mt($),z=U.structuredContent;if(z===void 0)return U;let Q=typeof z!=="object"||z===null||Array.isArray(z),J=Y!==void 0&&rt(Y);if(!Q&&!J)return U;return{...U,structuredContent:{result:z}}},decodeResult($,Y){if(eh(Y)&&"resultType"in Y){let U={...Y};return delete U.resultType,{kind:"complete",result:gt(U)}}return{kind:"complete",result:gt(Y)}},encodeResult($,Y){if($!=="tools/list")return Y;l Line truncated
* content-type
* Copyright(c) 2015 Douglas Christopher Wilson
* MIT Licensed
*/Lb0=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,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=Q;function Q(K){if(!K)throw TypeError("argument string is required");var G=typeof K==="object"?J(K):K;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(!z.test(W))throw TypeError("invalid media type");var X=new I(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(K){var G;if(typeof K.getHeader==="function")G=K.getHeader("content-type");else if(typeof K.headers==="object")G=K.headers&&K.headers["content-type"];if(typeof G!=="string")throw TypeError("content-type header is missing from object");return G}function I(K){this.parameters=Object.create(null),this.type=K}}),Kb1=eq(Lb0(),1);Fb0=/^[A-Za-z0-9._-]{1,128}$/});function AS($){let Y=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return xi0(Y),Y}var iO,Oe,F1,v1,Q5,cO,Ab0,we,Me,nO,Bb0,J5,Pb0,Tb0,Ne,jb0,pO,uQ,OH,bQ,dO,Eb0,De,Cb0,Rb0,_b0,BS,vb0,PS,Ae,hb0,Sb0,gb0,yb0,kb0,xb0,fb0,ub0,TS,bb0,ib0,nb0,Be,Pe,Te,cb0,pb0,db0,jS,mb0,je,lb0,ob0,rb0,sb0,ab0,tb0,eb0,$i0,Ee,Yi0,Ce,Re,_e,Ui0,ES,zi0,ve,he,Se,Qi0,Ji0,ge,Ii0,Ki0,Gi0,ye,Hi0,Wi0,ke,Xi0,Zi0,qi0,Vi0,Li0,Fi0,Oi0,wi0,Mi0,Ni0,Di0,Ai0,Bi0,Pi0,Ti0,ji0,Ei0,Ci0,Ri0,_i0,vi0,hi0,Si0,xe,gi0,yi0,ki0,xi0,mO=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=AS(yi0.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??=AS(gi0.Ajv2019);return this._ajvDraft7??=AS(xe.Ajv)}getValidator($){let Y=this._engineFor($),U="$id"in $&&typeof $.$id==="string"?Y.getSchema($.$id)??Y.compile($):Y.compile($);return(z)=>{return U(z)?{valid:!0,data:z,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Y.errorsText(U.errors)}}}},Mb1;var fe=m(()=>{Zj();qj();iO=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(O){super();if(!$.IDENTIFIER.test(O))throw Error("CodeGen: name must be a valid identifier");this.str=O}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$.Name=U;var z=class extends Y{constructor(O){super();this._items=typeof O==="string"?[O]:O}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let O=this._items[0];return O===""||O==='""'}get str(){var O;return(O=this._str)!==null&&O!==void 0?O:this._str=this._items.reduce((M,N)=>`${M}${N}`,"")}get names(){var O;return(O=this._names)!==null&&O!==void 0?O:this._names=this._items.reduce((M,N)=>{if(N instanceof U)M[N.str]=(M[N.str]||0)+1;return M},{})}};$._Code=z,$.nil=new z("");function Q(O,...M){let N=[O[0]],D=0;while(D<M.length)K(N,M[D]),N.push(O[++D]);return new z(N)}$._=Q;let J=new z("+");function I(O,...M){let N=[q(O[0])],D=0;while(D<M.length)N.push(J),K(N,M[D]),N.push(J,q(O[++D]));return G(N),new z(N)}$.str=I;function K(O,M){if(M instanceof z)O.push(...M._items);else if(M instanceof U)O.push(M);else O.push(X(M))}$.addCodeArg=K;function G(O){let M=1;while(M<O.length-1){if(O[M]===J){let N=H(O[M-1],O[M+1]);if(N!==void 0){O.splice(M-1,3,N);continue}O[M++]="+"}M++}}function H(O,M){if(M==='""')return O;if(O==='""')return M;if(typeof O=="string"){if(M instanceof U||O[O.length-1]!=='"')return;if(typeof M!="string")return`${O.slice(0,-1)}${M}"`;if(M[0]==='"')return O.slice(0,-1)+M.slice(1);return}if(typeof M=="string"&&M[0]==='"'&&!(O instanceof U))return`"${O}${M.slice(1)}`}function W(O,M){return M.emptyStr()?O:O.emptyStr()?M:I`${O}${M}`}$.strConcat=W;function X(O){return typeof O=="number"||typeof O=="boolean"||O===null?O:q(Array.isArray(O)?O.join(","):O)}function Z(O){return new z(q(O))}$.stringify=Z;function q(O){return JSON.stringify(O).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$.safeStringify=q;function V(O){return typeof O=="string"&&$.IDENTIFIER.test(O)?new z(`.${O}`):Q`[${O}]`}$.getProperty=V;function F(O){if(typeof O=="string"&&$.IDENTIFIER.test(O))return new z(`${O}`);throw Error(`CodeGen: invalid export name: ${O}, use explicit $id name mapping`)}$.getEsmExportName=F;function w(O){return new z(O.toStringLine truncated
`:""},this._extScope=y,this._scope=new U.Scope({parent:y}),this._nodes=[new F]}toString(){return this._root.render(this.opts)}name(y){return this._scope.name(y)}scopeName(y){return this._extScope.name(y)}scopeValue(y,r){let $0=this._extScope.value(y,r);return(this._values[$0.prefix]||(this._values[$0.prefix]=new Set)).add($0),$0}getScopeValue(y,r){return this._extScope.getValue(y,r)}scopeRefs(y){return this._extScope.scopeRefs(y,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(y,r,$0,N0){let j0=this._scope.toName(r);if($0!==void 0&&N0)this._constants[j0.str]=$0;return this._leafNode(new I(y,j0,$0)),j0}const(y,r,$0){return this._def(U.varKinds.const,y,r,$0)}let(y,r,$0){return this._def(U.varKinds.let,y,r,$0)}var(y,r,$0){return this._def(U.varKinds.var,y,r,$0)}assign(y,r,$0){return this._leafNode(new K(y,r,$0))}add(y,r){return this._leafNode(new G(y,$.operators.ADD,r))}code(y){if(typeof y=="function")y();else if(y!==Y.nil)this._leafNode(new Z(y));return this}object(...y){let r=["{"];for(let[$0,N0]of y){if(r.length>1)r.push(",");if(r.push($0),$0!==N0||this.opts.es5)r.push(":"),(0,Y.addCodeArg)(r,N0)}return r.push("}"),new Y._Code(r)}if(y,r,$0){if(this._blockNode(new O(y)),r&&$0)this.code(r).else().code($0).endIf();else if(r)this.code(r).endIf();else if($0)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(y){return this._elseNode(new O(y))}else(){return this._elseNode(new w)}endIf(){return this._endBlockNode(O,w)}_for(y,r){if(this._blockNode(y),r)this.code(r).endFor();return this}for(y,r){return this._for(new N(y),r)}forRange(y,r,$0,N0,j0=this.opts.es5?U.varKinds.var:U.varKinds.let){let _0=this._scope.toName(y);return this._for(new D(j0,_0,r,$0),()=>N0(_0))}forOf(y,r,$0,N0=U.varKinds.const){let j0=this._scope.toName(y);if(this.opts.es5){let _0=r instanceof Y.Name?r:this.var("_arr",r);return this.forRange("_i",0,Y._`${_0}.length`,(G0)=>{this.var(j0,Y._`${_0}[${G0}]`),$0(j0)})}return this._for(new P("of",N0,j0,r),()=>$0(j0))}forIn(y,r,$0,N0=this.opts.es5?U.varKinds.var:U.varKinds.const){if(this.opts.ownProperties)return this.forOf(y,Y._`Object.keys(${r})`,$0);let j0=this._scope.toName(y);return this._for(new P("in",N0,j0,r),()=>$0(j0))}endFor(){return this._endBlockNode(M)}label(y){return this._leafNode(new H(y))}break(y){return this._leafNode(new W(y))}return(y){let r=new A;if(this._blockNode(r),this.code(y),r.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(A)}try(y,r,$0){if(!r&&!$0)throw Error('CodeGen: "try" without "catch" and "finally"');let N0=new j;if(this._blockNode(N0),this.code(y),r){let j0=this.name("e");this._currNode=N0.catch=new C(j0),r(j0)}if($0)this._currNode=N0.finally=new b,this.code($0);return this._endBlockNode(C,b)}throw(y){return this._leafNode(new X(y))}block(y,r){if(this._blockStarts.push(this._nodes.length),y)this.code(y).endBlock(r);return this}endBlock(y){let r=this._blockStarts.pop();if(r===void 0)throw Error("CodeGen: not in self-balancing block");let $0=this._nodes.length-r;if($0<0||y!==void 0&&$0!==y)throw Error(`CodeGen: wrong number of nodes: ${$0} vs ${y} expected`);return this._nodes.length=r,this}func(y,r=Y.nil,$0,N0){if(this._blockNode(new T(y,r,$0)),N0)this.code(N0).endFunc();return this}endFunc(){return this._endBlockNode(T)}optimize(y=1){while(y-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(y){return this._currNode.nodes.push(y),this}_blockNode(y){this._currNode.nodes.push(y),this._nodes.push(y)}_endBlockNode(y,r){let $0=this._currNode;if($0 instanceof y||r&&$0 instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${y.kind}/${r.kind}`:y.kind}"`)}_elseNode(y){let r=this._currNode;if(!(r instanceof O))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=y,this}get _root(){return this._nodes[0]}get _currNode(){let y=this._nodes;return y[y.length-1]}set _currNode(y){let r=this._nodes;r[r.length-1]=y}};$.CodeGen=k;function S(y,r){for(let $0 in r)y[$0]=(y[$0]||0)+(r[$0]||0);return y}function i(y,r){return r instanceof Y._CodeOrName?S(y,r.names):y}function n(y,r,$0){if(y instanceof Y.Name)return N0(y);if(!j0(y))return y;return new Y._Code(y._items.reduce((_0,G0)=>{if(G0 instanceof Y.Name)G0=N0(G0);if(G0 instanceof Y._Code)_0.push(...G0._items);else _0.push(G0);return _0},[]));function N0(_0){let G0=$0[_0.str];if(G0===void 0||r[_0.str]!==1)return _0;return delete r[_0.str],G0}function j0(_0){return _0 instanceof Y._Code&&_0._items.some((G0)=>G0 instanceof Y.Name&&r[G0.str]===1&&$0[G0.str]!==void 0)}}function z0(y,r){for(let $0 in r)y[$0]=(y[$0]||0)-(r[$0]||0)}function x(y){return typeof y=="boolean"||typeof y=="number"||y===null?!y:Y._`!${Y0(y)}`}$.not=x;let d=p($.operators.AND);function t(...y){return y.reduce(d)}$.and=t;let e=p($.operators.OR);function g(...y){return y.reduce(e)}$.or=g;function p(y){return(r,$0)=>r===Y.nil?$0:$0===Y.nil?r:Y._`${Y0(r)} ${y} ${Y0($0)}`}function Line truncated
|| (${C} == "string" && ${A} && ${A} == +${A})`).assign(b,Q._`+${A}`);return;case"integer":T.elseIf(Q._`${C} === "boolean" || ${A} === null
|| (${C} === "string" && ${A} && ${A} == +${A} && !(${A} % 1))`).assign(b,Q._`+${A}`);return;case"boolean":T.elseIf(Q._`${A} === "false" || ${A} === 0 || ${A} === null`).assign(b,!1).elseIf(Q._`${A} === "true" || ${A} === 1`).assign(b,!0);return;case"null":T.elseIf(Q._`${A} === "" || ${A} === 0 || ${A} === false`),T.assign(b,null);return;case"array":T.elseIf(Q._`${C} === "string" || ${C} === "number"
|| ${C} === "boolean" || ${A} === null`).assign(b,Q._`[${A}]`)}}}function q({gen:N,parentData:D,parentDataProperty:P},T){N.if(Q._`${D} !== undefined`,()=>N.assign(Q._`${D}[${P}]`,T))}function V(N,D,P,T=I.Correct){let A=T===I.Correct?Q.operators.EQ:Q.operators.NEQ,j;switch(N){case"null":return Q._`${D} ${A} null`;case"array":j=Q._`Array.isArray(${D})`;break;case"object":j=Q._`${D} && typeof ${D} == "object" && !Array.isArray(${D})`;break;case"integer":j=C(Q._`!(${D} % 1) && !isNaN(${D})`);break;case"number":j=C();break;default:return Q._`typeof ${D} ${A} ${N}`}return T===I.Correct?j:(0,Q.not)(j);function C(b=Q.nil){return(0,Q.and)(Q._`typeof ${D} == "number"`,b,P?Q._`isFinite(${D})`:Q.nil)}}$.checkDataType=V;function F(N,D,P,T){if(N.length===1)return V(N[0],D,P,T);let A,j=(0,J.toHash)(N);if(j.array&&j.object){let C=Q._`typeof ${D} != "object"`;A=j.null?C:Q._`!${D} || ${C}`,delete j.null,delete j.array,delete j.object}else A=Q.nil;if(j.number)delete j.integer;for(let C in j)A=(0,Q.and)(A,V(C,D,P,T));return A}$.checkDataTypes=F;let w={message:({schema:N})=>`must be ${N}`,params:({schema:N,schemaValue:D})=>typeof N=="string"?Q._`{type: ${N}}`:Q._`{type: ${D}}`};function O(N){let D=M(N);(0,z.reportError)(D,w)}$.reportTypeError=O;function M(N){let{gen:D,data:P,schema:T}=N,A=(0,J.schemaRefOrVal)(N,T,"type");return{gen:D,keyword:"type",data:P,schema:T.type,schemaCode:A,schemaValue:A,parentSchema:T,params:{},it:N}}}),Bb0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.assignDefaults=void 0;let Y=F1(),U=v1();function z(J,I){let{properties:K,items:G}=J.schema;if(I==="object"&&K)for(let H in K)Q(J,H,K[H].default);else if(I==="array"&&Array.isArray(G))G.forEach((H,W)=>Q(J,W,H.default))}$.assignDefaults=z;function Q(J,I,K){let{gen:G,compositeRule:H,data:W,opts:X}=J;if(K===void 0)return;let Z=Y._`${W}${(0,Y.getProperty)(I)}`;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)(K)}`)}}),J5=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(),z=Q5(),Q=v1();function J(N,D){let{gen:P,data:T,it:A}=N;P.if(X(P,T,D,A.opts.ownProperties),()=>{N.setParams({missingProperty:Y._`${D}`},!0),N.error()})}$.checkReportMissingProp=J;function I({gen:N,data:D,it:{opts:P}},T,A){return(0,Y.or)(...T.map((j)=>(0,Y.and)(X(N,D,j,P.ownProperties),Y._`${A} = ${j}`)))}$.checkMissingProp=I;function K(N,D){N.setParams({missingProperty:D},!0),N.error()}$.reportMissingProp=K;function G(N){return N.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Y._`Object.prototype.hasOwnProperty`})}$.hasPropFunc=G;function H(N,D,P){return Y._`${G(N)}.call(${D}, ${P})`}$.isOwnProperty=H;function W(N,D,P,T){let A=Y._`${D}${(0,Y.getProperty)(P)} !== undefined`;return T?Y._`${A} && ${H(N,D,P)}`:A}$.propertyInData=W;function X(N,D,P,T){let A=Y._`${D}${(0,Y.getProperty)(P)} === undefined`;return T?(0,Y.or)(A,(0,Y.not)(H(N,D,P))):A}$.noPropertyInData=X;function Z(N){return N?Object.keys(N).filter((D)=>D!=="__proto__"):[]}$.allSchemaProperties=Z;function q(N,D){return Z(D).filter((P)=>!(0,U.alwaysValidSchema)(N,D[P]))}$.schemaProperties=q;function V({schemaCode:N,data:D,it:{gen:P,topSchemaRef:T,schemaPath:A,errorPath:j},it:C},b,k,S){let i=S?Y._`${N}, ${D}, ${T}${A}`:D,n=[[z.default.instancePath,(0,Y.strConcat)(z.default.instancePath,j)],[z.default.parentData,C.parentData],[z.default.parentDataProperty,C.parentDataProperty],[z.default.rootData,z.default.rootData]];if(C.opts.dynamicRef)n.push([z.default.dynamicAnchors,z.default.dynamicAnchors]);let z0=Y._`${i}, ${P.object(...n)}`;return k!==Y.nil?Y._`${b}.call(${k}, ${z0})`:Y._`${b}(${z0})`}$.callValidateCode=V;let F=Y._`new RegExp`;function w({gen:N,it:{opts:D}},P){let T=D.unicodeRegExp?"u":"",{regExp:A}=D.code,j=A(P,T);return N.scopeValue("pattern",{key:j.toString(),ref:j,code:Y._`${A.code==="new RegExp"?F:(0,Q.useFunc)(N,A)}(${P}, ${T})`})}$.usePattern=w;function O(N){let{gen:D,data:P,keyword:T,it:A}=N,j=D.name("valid");if(A.allErrors){let b=D.let("valid",!0);return C(()=>D.assign(b,!1)),b}return D.var(j,!0),C(()=>D.break()),j;function C(b){let k=D.const("len",Y._`${P}.length`);D.forRange("i",0,k,(S)=>{N.subschema({keyword:T,dataProp:S,dataPropType:U.Type.Num},j),D.if((0,Y.not)(j),b)})}}$.validateArray=O;function M(N){let{gen:D,schema:P,keyword:T,it:A}=N;if(!Array.isArray(P))throw Error("ajv implementation error");if(P.some((b)=>(0,U.alwaysValidSchema)(A,b))&&!A.opts.unevaluated)return;let j=D.let("valid",!1),C=D.name("_valid");D.block(()=>P.forEach((b,k)=>{let S=N.subschema({keyword:T,schemaProp:k,compositeRule:!0},C);if(D.assign(j,Y._`${j} || ${C}`),!N.mergeValidEvaluated(S,C) Line truncated
*/Eb0=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,z=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;$.parse=Q;function Q(K){if(!K)throw TypeError("argument string is required");var G=typeof K==="object"?J(K):K;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(!z.test(W))throw TypeError("invalid media type");var X=new I(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(K){var G;if(typeof K.getHeader==="function")G=K.getHeader("content-type");else if(typeof K.headers==="object")G=K.headers&&K.headers["content-type"];if(typeof G!=="string")throw TypeError("content-type header is missing from object");return G}function I(K){this.parameters=Object.create(null),this.type=K}}),wb1=$V(Eb0(),1);Cb0=/^[A-Za-z0-9._-]{1,128}$/});function TS($){let Y=new $({strict:!1,validateFormats:!0,validateSchema:!1,allErrors:!0});return ri0(Y),Y}var nw,Ne,F1,v1,I5,dw,gb0,De,Be,cw,yb0,K5,kb0,xb0,Ae,fb0,pw,uQ,wH,bQ,mw,ub0,Pe,bb0,ib0,nb0,jS,cb0,ES,Te,db0,pb0,mb0,lb0,ob0,rb0,sb0,ab0,CS,tb0,eb0,$i0,je,Ee,Ce,Yi0,Ui0,zi0,RS,Qi0,Re,Ji0,Ii0,Ki0,Gi0,Hi0,Wi0,Xi0,Zi0,_e,qi0,ve,he,Se,Vi0,_S,Li0,ge,ye,ke,Fi0,wi0,xe,Oi0,Mi0,Ni0,fe,Di0,Bi0,ue,Ai0,Pi0,Ti0,ji0,Ei0,Ci0,Ri0,_i0,vi0,hi0,Si0,gi0,yi0,ki0,xi0,fi0,ui0,bi0,ii0,ni0,ci0,di0,pi0,be,mi0,li0,oi0,ri0,lw=class{_ajv;_ajvDraft7;_ajv2019;_userAjv;constructor($){this._userAjv=$!==void 0,this._ajv=$}get ajv(){return this._ajv??=TS(li0.Ajv2020)}_engineFor($){if(this._userAjv)return this.ajv;let Y=Mr($,"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??=TS(mi0.Ajv2019);return this._ajvDraft7??=TS(be.Ajv)}getValidator($){let Y=this._engineFor($),U="$id"in $&&typeof $.$id==="string"?Y.getSchema($.$id)??Y.compile($):Y.compile($);return(z)=>{return U(z)?{valid:!0,data:z,errorMessage:void 0}:{valid:!1,data:void 0,errorMessage:Y.errorsText(U.errors)}}}},Rb1;var ie=m(()=>{Lj();Fj();nw=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(w){super();if(!$.IDENTIFIER.test(w))throw Error("CodeGen: name must be a valid identifier");this.str=w}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}};$.Name=U;var z=class extends Y{constructor(w){super();this._items=typeof w==="string"?[w]:w}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;let w=this._items[0];return w===""||w==='""'}get str(){var w;return(w=this._str)!==null&&w!==void 0?w:this._str=this._items.reduce((N,M)=>`${N}${M}`,"")}get names(){var w;return(w=this._names)!==null&&w!==void 0?w:this._names=this._items.reduce((N,M)=>{if(M instanceof U)N[M.str]=(N[M.str]||0)+1;return N},{})}};$._Code=z,$.nil=new z("");function Q(w,...N){let M=[w[0]],D=0;while(D<N.length)K(M,N[D]),M.push(w[++D]);return new z(M)}$._=Q;let J=new z("+");function I(w,...N){let M=[q(w[0])],D=0;while(D<N.length)M.push(J),K(M,N[D]),M.push(J,q(w[++D]));return G(M),new z(M)}$.str=I;function K(w,N){if(N instanceof z)w.push(...N._items);else if(N instanceof U)w.push(N);else w.push(X(N))}$.addCodeArg=K;function G(w){let N=1;while(N<w.length-1){if(w[N]===J){let M=H(w[N-1],w[N+1]);if(M!==void 0){w.splice(N-1,3,M);continue}w[N++]="+"}N++}}function H(w,N){if(N==='""')return w;if(w==='""')return N;if(typeof w=="string"){if(N instanceof U||w[w.length-1]!=='"')return;if(typeof N!="string")return`${w.slice(0,-1)}${N}"`;if(N[0]==='"')return w.slice(0,-1)+N.slice(1);return}if(typeof N=="string"&&N[0]==='"'&&!(w instanceof U))return`"${w}${N.slice(1)}`}function W(w,N){return N.emptyStr()?w:w.emptyStr()?N:I`${w}${N}`}$.strConcat=W;function X(w){return typeof w=="number"||typeof w=="boolean"||w===null?w:q(Array.isArray(w)?w.join(","):w)}function Z(w){return new z(q(w))}$.stringify=Z;function q(w){return JSON.stringify(w).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}$.safeStringify=q;function V(w){return typeof w=="string"&&$.IDENTIFIER.test(w)?new z(`.${w}`):Q`[${w}]`}$.getProperty=V;function F(w){if(typeof w=="string"&&$.IDENTIFIER.test(w))return new z(`${w}`);throw Error(`CodeGen: invalid export name: ${w}, use explicit $id name mapping`)}$.getEsmExportName=F;function O(w){return new z(w.toStringLine truncated
`:""},this._extScope=y,this._scope=new U.Scope({parent:y}),this._nodes=[new F]}toString(){return this._root.render(this.opts)}name(y){return this._scope.name(y)}scopeName(y){return this._extScope.name(y)}scopeValue(y,r){let $0=this._extScope.value(y,r);return(this._values[$0.prefix]||(this._values[$0.prefix]=new Set)).add($0),$0}getScopeValue(y,r){return this._extScope.getValue(y,r)}scopeRefs(y){return this._extScope.scopeRefs(y,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(y,r,$0,N0){let j0=this._scope.toName(r);if($0!==void 0&&N0)this._constants[j0.str]=$0;return this._leafNode(new I(y,j0,$0)),j0}const(y,r,$0){return this._def(U.varKinds.const,y,r,$0)}let(y,r,$0){return this._def(U.varKinds.let,y,r,$0)}var(y,r,$0){return this._def(U.varKinds.var,y,r,$0)}assign(y,r,$0){return this._leafNode(new K(y,r,$0))}add(y,r){return this._leafNode(new G(y,$.operators.ADD,r))}code(y){if(typeof y=="function")y();else if(y!==Y.nil)this._leafNode(new Z(y));return this}object(...y){let r=["{"];for(let[$0,N0]of y){if(r.length>1)r.push(",");if(r.push($0),$0!==N0||this.opts.es5)r.push(":"),(0,Y.addCodeArg)(r,N0)}return r.push("}"),new Y._Code(r)}if(y,r,$0){if(this._blockNode(new w(y)),r&&$0)this.code(r).else().code($0).endIf();else if(r)this.code(r).endIf();else if($0)throw Error('CodeGen: "else" body without "then" body');return this}elseIf(y){return this._elseNode(new w(y))}else(){return this._elseNode(new O)}endIf(){return this._endBlockNode(w,O)}_for(y,r){if(this._blockNode(y),r)this.code(r).endFor();return this}for(y,r){return this._for(new M(y),r)}forRange(y,r,$0,N0,j0=this.opts.es5?U.varKinds.var:U.varKinds.let){let _0=this._scope.toName(y);return this._for(new D(j0,_0,r,$0),()=>N0(_0))}forOf(y,r,$0,N0=U.varKinds.const){let j0=this._scope.toName(y);if(this.opts.es5){let _0=r instanceof Y.Name?r:this.var("_arr",r);return this.forRange("_i",0,Y._`${_0}.length`,(G0)=>{this.var(j0,Y._`${_0}[${G0}]`),$0(j0)})}return this._for(new P("of",N0,j0,r),()=>$0(j0))}forIn(y,r,$0,N0=this.opts.es5?U.varKinds.var:U.varKinds.const){if(this.opts.ownProperties)return this.forOf(y,Y._`Object.keys(${r})`,$0);let j0=this._scope.toName(y);return this._for(new P("in",N0,j0,r),()=>$0(j0))}endFor(){return this._endBlockNode(N)}label(y){return this._leafNode(new H(y))}break(y){return this._leafNode(new W(y))}return(y){let r=new B;if(this._blockNode(r),this.code(y),r.nodes.length!==1)throw Error('CodeGen: "return" should have one node');return this._endBlockNode(B)}try(y,r,$0){if(!r&&!$0)throw Error('CodeGen: "try" without "catch" and "finally"');let N0=new j;if(this._blockNode(N0),this.code(y),r){let j0=this.name("e");this._currNode=N0.catch=new C(j0),r(j0)}if($0)this._currNode=N0.finally=new b,this.code($0);return this._endBlockNode(C,b)}throw(y){return this._leafNode(new X(y))}block(y,r){if(this._blockStarts.push(this._nodes.length),y)this.code(y).endBlock(r);return this}endBlock(y){let r=this._blockStarts.pop();if(r===void 0)throw Error("CodeGen: not in self-balancing block");let $0=this._nodes.length-r;if($0<0||y!==void 0&&$0!==y)throw Error(`CodeGen: wrong number of nodes: ${$0} vs ${y} expected`);return this._nodes.length=r,this}func(y,r=Y.nil,$0,N0){if(this._blockNode(new T(y,r,$0)),N0)this.code(N0).endFunc();return this}endFunc(){return this._endBlockNode(T)}optimize(y=1){while(y-- >0)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(y){return this._currNode.nodes.push(y),this}_blockNode(y){this._currNode.nodes.push(y),this._nodes.push(y)}_endBlockNode(y,r){let $0=this._currNode;if($0 instanceof y||r&&$0 instanceof r)return this._nodes.pop(),this;throw Error(`CodeGen: not in block "${r?`${y.kind}/${r.kind}`:y.kind}"`)}_elseNode(y){let r=this._currNode;if(!(r instanceof w))throw Error('CodeGen: "else" without "if"');return this._currNode=r.else=y,this}get _root(){return this._nodes[0]}get _currNode(){let y=this._nodes;return y[y.length-1]}set _currNode(y){let r=this._nodes;r[r.length-1]=y}};$.CodeGen=k;function S(y,r){for(let $0 in r)y[$0]=(y[$0]||0)+(r[$0]||0);return y}function i(y,r){return r instanceof Y._CodeOrName?S(y,r.names):y}function n(y,r,$0){if(y instanceof Y.Name)return N0(y);if(!j0(y))return y;return new Y._Code(y._items.reduce((_0,G0)=>{if(G0 instanceof Y.Name)G0=N0(G0);if(G0 instanceof Y._Code)_0.push(...G0._items);else _0.push(G0);return _0},[]));function N0(_0){let G0=$0[_0.str];if(G0===void 0||r[_0.str]!==1)return _0;return delete r[_0.str],G0}function j0(_0){return _0 instanceof Y._Code&&_0._items.some((G0)=>G0 instanceof Y.Name&&r[G0.str]===1&&$0[G0.str]!==void 0)}}function z0(y,r){for(let $0 in r)y[$0]=(y[$0]||0)-(r[$0]||0)}function x(y){return typeof y=="boolean"||typeof y=="number"||y===null?!y:Y._`!${Y0(y)}`}$.not=x;let p=d($.operators.AND);function t(...y){return y.reduce(p)}$.and=t;let e=d($.operators.OR);function g(...y){return y.reduce(e)}$.or=g;function d(y){return(r,$0)=>r===Y.nil?$0:$0===Y.nil?r:Y._`${Y0(r)} ${y} ${Y0($0)}`}function Line truncated
|| (${C} == "string" && ${B} && ${B} == +${B})`).assign(b,Q._`+${B}`);return;case"integer":T.elseIf(Q._`${C} === "boolean" || ${B} === null
|| (${C} === "string" && ${B} && ${B} == +${B} && !(${B} % 1))`).assign(b,Q._`+${B}`);return;case"boolean":T.elseIf(Q._`${B} === "false" || ${B} === 0 || ${B} === null`).assign(b,!1).elseIf(Q._`${B} === "true" || ${B} === 1`).assign(b,!0);return;case"null":T.elseIf(Q._`${B} === "" || ${B} === 0 || ${B} === false`),T.assign(b,null);return;case"array":T.elseIf(Q._`${C} === "string" || ${C} === "number"
|| ${C} === "boolean" || ${B} === null`).assign(b,Q._`[${B}]`)}}}function q({gen:M,parentData:D,parentDataProperty:P},T){M.if(Q._`${D} !== undefined`,()=>M.assign(Q._`${D}[${P}]`,T))}function V(M,D,P,T=I.Correct){let B=T===I.Correct?Q.operators.EQ:Q.operators.NEQ,j;switch(M){case"null":return Q._`${D} ${B} null`;case"array":j=Q._`Array.isArray(${D})`;break;case"object":j=Q._`${D} && typeof ${D} == "object" && !Array.isArray(${D})`;break;case"integer":j=C(Q._`!(${D} % 1) && !isNaN(${D})`);break;case"number":j=C();break;default:return Q._`typeof ${D} ${B} ${M}`}return T===I.Correct?j:(0,Q.not)(j);function C(b=Q.nil){return(0,Q.and)(Q._`typeof ${D} == "number"`,b,P?Q._`isFinite(${D})`:Q.nil)}}$.checkDataType=V;function F(M,D,P,T){if(M.length===1)return V(M[0],D,P,T);let B,j=(0,J.toHash)(M);if(j.array&&j.object){let C=Q._`typeof ${D} != "object"`;B=j.null?C:Q._`!${D} || ${C}`,delete j.null,delete j.array,delete j.object}else B=Q.nil;if(j.number)delete j.integer;for(let C in j)B=(0,Q.and)(B,V(C,D,P,T));return B}$.checkDataTypes=F;let O={message:({schema:M})=>`must be ${M}`,params:({schema:M,schemaValue:D})=>typeof M=="string"?Q._`{type: ${M}}`:Q._`{type: ${D}}`};function w(M){let D=N(M);(0,z.reportError)(D,O)}$.reportTypeError=w;function N(M){let{gen:D,data:P,schema:T}=M,B=(0,J.schemaRefOrVal)(M,T,"type");return{gen:D,keyword:"type",data:P,schema:T.type,schemaCode:B,schemaValue:B,parentSchema:T,params:{},it:M}}}),yb0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0}),$.assignDefaults=void 0;let Y=F1(),U=v1();function z(J,I){let{properties:K,items:G}=J.schema;if(I==="object"&&K)for(let H in K)Q(J,H,K[H].default);else if(I==="array"&&Array.isArray(G))G.forEach((H,W)=>Q(J,W,H.default))}$.assignDefaults=z;function Q(J,I,K){let{gen:G,compositeRule:H,data:W,opts:X}=J;if(K===void 0)return;let Z=Y._`${W}${(0,Y.getProperty)(I)}`;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)(K)}`)}}),K5=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(),z=I5(),Q=v1();function J(M,D){let{gen:P,data:T,it:B}=M;P.if(X(P,T,D,B.opts.ownProperties),()=>{M.setParams({missingProperty:Y._`${D}`},!0),M.error()})}$.checkReportMissingProp=J;function I({gen:M,data:D,it:{opts:P}},T,B){return(0,Y.or)(...T.map((j)=>(0,Y.and)(X(M,D,j,P.ownProperties),Y._`${B} = ${j}`)))}$.checkMissingProp=I;function K(M,D){M.setParams({missingProperty:D},!0),M.error()}$.reportMissingProp=K;function G(M){return M.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:Y._`Object.prototype.hasOwnProperty`})}$.hasPropFunc=G;function H(M,D,P){return Y._`${G(M)}.call(${D}, ${P})`}$.isOwnProperty=H;function W(M,D,P,T){let B=Y._`${D}${(0,Y.getProperty)(P)} !== undefined`;return T?Y._`${B} && ${H(M,D,P)}`:B}$.propertyInData=W;function X(M,D,P,T){let B=Y._`${D}${(0,Y.getProperty)(P)} === undefined`;return T?(0,Y.or)(B,(0,Y.not)(H(M,D,P))):B}$.noPropertyInData=X;function Z(M){return M?Object.keys(M).filter((D)=>D!=="__proto__"):[]}$.allSchemaProperties=Z;function q(M,D){return Z(D).filter((P)=>!(0,U.alwaysValidSchema)(M,D[P]))}$.schemaProperties=q;function V({schemaCode:M,data:D,it:{gen:P,topSchemaRef:T,schemaPath:B,errorPath:j},it:C},b,k,S){let i=S?Y._`${M}, ${D}, ${T}${B}`:D,n=[[z.default.instancePath,(0,Y.strConcat)(z.default.instancePath,j)],[z.default.parentData,C.parentData],[z.default.parentDataProperty,C.parentDataProperty],[z.default.rootData,z.default.rootData]];if(C.opts.dynamicRef)n.push([z.default.dynamicAnchors,z.default.dynamicAnchors]);let z0=Y._`${i}, ${P.object(...n)}`;return k!==Y.nil?Y._`${b}.call(${k}, ${z0})`:Y._`${b}(${z0})`}$.callValidateCode=V;let F=Y._`new RegExp`;function O({gen:M,it:{opts:D}},P){let T=D.unicodeRegExp?"u":"",{regExp:B}=D.code,j=B(P,T);return M.scopeValue("pattern",{key:j.toString(),ref:j,code:Y._`${B.code==="new RegExp"?F:(0,Q.useFunc)(M,B)}(${P}, ${T})`})}$.usePattern=O;function w(M){let{gen:D,data:P,keyword:T,it:B}=M,j=D.name("valid");if(B.allErrors){let b=D.let("valid",!0);return C(()=>D.assign(b,!1)),b}return D.var(j,!0),C(()=>D.break()),j;function C(b){let k=D.const("len",Y._`${P}.length`);D.forRange("i",0,k,(S)=>{M.subschema({keyword:T,dataProp:S,dataPropType:U.Type.Num},j),D.if((0,Y.not)(j),b)})}}$.validateArray=w;function N(M){let{gen:D,schema:P,keyword:T,it:B}=M;if(!Array.isArray(P))throw Error("ajv implementation error");if(P.some((b)=>(0,U.alwaysValidSchema)(B,b))&&!B.opts.unevaluated)return;let j=D.let("valid",!1),C=D.name("_valid");D.block(()=>P.forEach((b,k)=>{let S=M.subschema({keyword:T,schemaProp:k,compositeRule:!0},C);if(D.assign(j,Y._`${j} || ${C}`),!M.mergeValidEvaluated(S,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);I(G,H),K(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 I(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 F=H[V];if(F.length===0)continue;let w=(0,z.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)W.if(w,()=>{for(let O of F)(0,z.checkReportMissingProp)(G,O)});else W.if(Y._`${w} && (${(0,z.checkMissingProp)(G,F,q)})`),(0,z.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=I;function K(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let F in H){if((0,U.alwaysValidSchema)(q,H[F]))continue;W.if((0,z.propertyInData)(W,X,F,q.opts.ownProperties),()=>{let w=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(w,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=K,$.default=Q}),mb0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=F1(),U=v1(),z={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:I,data:K,it:G}=Q;if((0,U.alwaysValidSchema)(G,I))return;let H=J.name("valid");J.forIn("key",K,(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=z}),je=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=J5(),U=F1(),z=Q5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:I})=>U._`{additionalProperty: ${I.additionalProperty}}`},code(I){let{gen:K,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=I;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 F=(0,Y.allSchemaProperties)(H.properties),w=(0,Y.allSchemaProperties)(H.patternProperties);O(),I.ok(U._`${X} === ${z.default.errors}`);function O(){K.forIn("key",W,(T)=>{if(!F.length&&!w.length)D(T);else K.if(M(T),()=>D(T))})}function M(T){let A;if(F.length>8){let j=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");A=(0,Y.isOwnProperty)(K,j,T)}else if(F.length)A=(0,U.or)(...F.map((j)=>U._`${T} === ${j}`));else A=U.nil;if(w.length)A=(0,U.or)(A,...w.map((j)=>U._`${(0,Y.usePattern)(I,j)}.test(${T})`));return(0,U.not)(A)}function N(T){K.code(U._`delete ${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){N(T);return}if(G===!1){if(I.setParams({additionalProperty:T}),I.error(),!q)K.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let A=K.name("valid");if(V.removeAdditional==="failing")P(T,A,!1),K.if((0,U.not)(A),()=>{I.reset(),N(T)});else if(P(T,A),!q)K.if((0,U.not)(A),()=>K.break())}}function P(T,A,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});I.subschema(C,A)}}};$.default=J}),lb0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=uQ(),U=J5(),z=v1(),Q=je(),J={keyword:"properties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,parentSchema:H,data:W,it:X}=I;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 O of Z)X.definedProperties.add(O);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=z.mergeEvaluated.props(K,(0,z.toHash)(Z),X.props);let q=Z.filter((O)=>!(0,z.alwaysValidSchema)(X,G[O]));if(q.length===0)return;let V=K.name("valid");for(let O of q){if(F(O))w(O);else{if(K.if((0,U.propertyInData)(K,W,O,X.opts.ownProperties)),w(O),!X.allErrors)K.else().var(V,!0);K.endIf()}I.it.definedProperties.add(O),I.ok(V)}function F(O){return X.opts.useDefaults&&!X.compositeRule&&G[O].default!==void 0}function w(O){I.subschema({keyword:"properties",schemaProp:O,dataProp:O},V)}}};$.default=J}),ob0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=J5(),U=F1(),z=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,data:H,parentSchema:W,it:X}=I,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,z.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,w=K.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,Q.evaluatedPropsToName)(K,X.props);let{props:O}=X;M();function M(){for(let P of q){if(F)N(P);if(X.allErrors) Line truncated
\x00`,k+=N4(j,2),k+=K.magic,k+=N4(w,2),k+=N4(O,2),k+=N4(A.crc32,4),k+=N4(A.compressedSize,4),k+=N4(A.uncompressedSize,4),k+=N4(H.length,2),k+=N4(M.length,2);var S=_M.LOCAL_FILE_HEADER+k+H+M,i=_M.CENTRAL_FILE_HEADER+N4(b,2)+k+N4(Z.length,2)+"\x00\x00\x00\x00"+N4(C,4)+N4(z,4)+H+M+Z;return{fileRecord:S,dirRecord:i}},sr0=function($,Y,U,z,Q){var J="",I=NJ.transformTo("string",Q(z));return J=_M.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+N4($,2)+N4($,2)+N4(Y,4)+N4(U,4)+N4(I.length,2)+I,J},ar0=function($){var Y="";return Y=_M.DATA_DESCRIPTOR+N4($.crc32,4)+N4($.compressedSize,4)+N4($.uncompressedSize,4),Y};function Z5($,Y,U,z){DJ.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=U,this.encodeFileName=z,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}NJ.inherits(Z5,DJ);Z5.prototype.push=function($){var Y=$.meta.percent||0,U=this.entriesCount,z=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,DJ.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(Y+100*(U-z-1))/U:100}})};Z5.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Y=this.streamFiles&&!$.file.dir;if(Y){var U=z90($,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};Z5.prototype.closedSource=function($){this.accumulate=!1;var Y=this.streamFiles&&!$.file.dir,U=z90($,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),Y)this.push({data:ar0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};Z5.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-$,z=sr0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:z,meta:{percent:100}})};Z5.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};Z5.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};Z5.prototype.resume=function(){if(!DJ.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};Z5.prototype.error=function($){var Y=this._sources;if(!DJ.prototype.error.call(this,$))return!1;for(var U=0;U<Y.length;U++)try{Y[U].error($)}catch(z){}return!0};Z5.prototype.lock=function(){DJ.prototype.lock.call(this);var $=this._sources;for(var Y=0;Y<$.length;Y++)$[Y].lock()};Q90.exports=Z5});var I90=E((Ys0)=>{var tr0=Uk(),er0=J90(),$s0=function($,Y){var U=$||Y,z=tr0[U];if(!z)throw Error(U+" is not a valid compression method !");return z};Ys0.generateWorker=function($,Y,U){var z=new er0(Y.streamFiles,U,Y.platform,Y.encodeFileName),Q=0;try{$.forEach(function(J,I){Q++;var K=$s0(I.options.compression,Y.compression),G=I.options.compressionOptions||Y.compressionOptions||{},H=I.dir,W=I.date;I._compressWorker(K,G).withStreamInfo("file",{name:J,dir:H,date:W,comment:I.comment||"",unixPermissions:I.unixPermissions,dosPermissions:I.dosPermissions}).pipe(z)}),z.entriesCount=Q}catch(J){z.error(J)}return z}});var G90=E((Hm1,K90)=>{var zs0=c4(),vM=K$();function NW($,Y){vM.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Y)}zs0.inherits(NW,vM);NW.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()})};NW.prototype.pause=function(){if(!vM.prototype.pause.call(this))return!1;return this._stream.pause(),!0};NW.prototype.resume=function(){if(!vM.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};K90.exports=NW});var w90=E((Wm1,O90)=>{var Qs0=WJ(),DW=c4(),Z90=K$(),Js0=Gy(),q90=Hy(),H90=ZM(),Is0=W$0(),Ks0=I90(),W90=eH(),Gs0=G90(),V90=function($,Y,U){var z=DW.getTypeOf(Y),Q,J=DW.extend(U||{},q90);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,z=this._xml;if(U&&this.open)z.push(">");this._stack.push($),z.push("<"),z.push($),uk(z,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)G70(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");uk(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(K70.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("")}}bk.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};H70.exports=bk});var ik=E((et0)=>{var W70=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function tt0($){if(typeof $==="string")return $;if(W70)return W70.decode($);return $.toString()}et0.bufferToString=tt0});var L70=E((Z70)=>{Object.defineProperty(Z70,"__esModule",{value:!0});Z70.CHAR=`
\r -퟿-�\uD800\uDC00-\uDBFF\uDFFF`;Z70.S=` \r
`;Z70.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";Z70.NAME_CHAR="-"+Z70.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";Z70.CHAR_RE=new RegExp("^["+Z70.CHAR+"]$","u");Z70.S_RE=new RegExp("^["+Z70.S+"]+$","u");Z70.NAME_START_CHAR_RE=new RegExp("^["+Z70.NAME_START_CHAR+"]$","u");Z70.NAME_CHAR_RE=new RegExp("^["+Z70.NAME_CHAR+"]$","u");Z70.NAME_RE=new RegExp("^["+Z70.NAME_START_CHAR+"]["+Z70.NAME_CHAR+"]*$","u");Z70.NMTOKEN_RE=new RegExp("^["+Z70.NAME_CHAR+"]+$","u");var nk=9,ck=10,pk=13,dk=32;Z70.S_LIST=[dk,ck,pk,nk];function Ye0($){return $>=dk&&$<=55295||$===ck||$===pk||$===nk||$>=57344&&$<=65533||$>=65536&&$<=1114111}Z70.isChar=Ye0;function Ue0($){return $===dk||$===ck||$===pk||$===nk}Z70.isS=Ue0;function X70($){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}Z70.isNameStartChar=X70;function ze0($){return X70($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}Z70.isNameChar=ze0});var T70=E((D70)=>{Object.defineProperty(D70,"__esModule",{value:!0});D70.CHAR="\x01-퟿-�\uD800\uDC00-\uDBFF\uDFFF";D70.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F-„†-Ÿ";D70.S=` \r
`;D70.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";D70.NAME_CHAR="-"+D70.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";D70.CHAR_RE=new RegExp("^["+D70.CHAR+"]$","u");D70.RESTRICTED_CHAR_RE=new RegExp("^["+D70.RESTRICTED_CHAR+"]$","u");D70.S_RE=new RegExp("^["+D70.S+"]+$","u");D70.NAME_START_CHAR_RE=new RegExp("^["+D70.NAME_START_CHAR+"]$","u");D70.NAME_CHAR_RE=new RegExp("^["+D70.NAME_CHAR+"]$","u");D70.NAME_RE=new RegExp("^["+D70.NAME_START_CHAR+"]["+D70.NAME_CHAR+"]*$","u");D70.NMTOKEN_RE=new RegExp("^["+D70.NAME_CHAR+"]+$","u");var F70=9,O70=10,w70=13,M70=32;D70.S_LIST=[M70,O70,w70,F70];function Le0($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}D70.isChar=Le0;function Fe0($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}D70.isRestrictedChar=Fe0;function Oe0($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}D70.isCharAndNotRestricted=Oe0;function we0($){return $===M70||$===O70||$===w70||$===F70}D70.isS=we0;function N70($){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}D70.isNameStartChar=N70;function Me0($){return N70($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}D70.isNameChar=Me0});var C70=E((E70)=>{Object.defineProperty(E70,"__esModule",{value:!0});E70.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";E70.NC_NAME_CHAR="-"+E70.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";E70.NC_NAME_START_CHAR_RE=new RegExp("^["+E70.NC_NAME_START_CHAR+"]$","u");E70.NC_NAME_CHAR_RE=new RegExp("^["+E70.NC_NAME_CHAR+"]$","u");E70.NC_NAME_RE=new RegExp("^["+E70.NC_NAME_START_CHAR+"]["+E70.NC_NAME_CHAR+"]*$","u");function j70($){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}E70.isNCNameStartChar=j70;function ge0($){return j70($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}E70.isNCNameChar=ge0});var s70=E((r70)=>{Object.defineProperty(r70,"__esModule",{value:!0});var SJ=L70(),be0=T70(),Jx=C70(),d8=SJ.isS,ie0=SJ.isChar,gW=SJ.isNameStartChar,R70=SJ.isNameChar,c70=SJ.S_LIST,ne0=SJ.NAME_RE,ce0=be0.isChar,pe0=Jx.isNCNameStartChar,de0=Jx.isNCNameChar,me0=Jx.NC_NAME_RE,IN="http://www.w3.org/XML/1998/namespace",hJ="http://www.w3.org/2000/xmlns/",le0={__proto__:null,xml:IN,xmlns:hJ},oe0={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},k4=-1,H9=-2,_70=0,re0=1,lk=2,se0=3,RJ=4,ae0=5,te0=6,ee0=7,ok=8,$01=9,Y01=10,U01=11,z01=12,_8=13,YN=14,rk=15,Q01=16,sk=17,J01=18,I01=19,ak=20,K01=21,G01=22,H01=23,v70=24,tk=25,UN=26,h70=27,W01=28,X01=29,S70=30,Z01=31,q01=32,qU=33,V01=34,ek=35,yW=36,$x=37,L01=38,g70=39,y70=40,F01=41,k70=42,O01=43,w01=44,Yx=9,V5=10,Ux=13,x70=32,f70=33,p70=34,kW=38,d70=39,zN=45,QN=47,M01=59,Y2=60,_J=61,j6=62,r6=63,m70=91,vJ=93,u70=133,b70=8232,JN=($)=>$===p70||$===d70,l70=[p70,d70],N01=[...l70,m70,j6],D01=[...l70,Y2,vJ],A01=[_J,r6,...c70],B01=[...c70,j6,kW,Y2];function Qx($,Y,U){switch(Y){case"xml":if(U!==IN)$.fail(`xml prefix must be bound to ${IN}.`);break;case"xmlns":if(U!==hJ)$.fail(`xmlns prefix must be bound to ${hJ}.`);break;default:}switch(U){case hJ:$.fail(Y===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${hJ}.`);break;case IN: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 P01($,Y){for(let U of Object.keys(Y))Qx($,U,Y[U])}var T01=($)=>me0.test($),j01=($)=>ne0.test($),VU=0,i70=1,zx=2;r70.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var n70={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 o70{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=pe0,this.nameCheck=de0,this.isName=T01,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},le0);let U=this.opt.additionalNamesp Line truncated
`,Y=this.i}}captureToChar($){let{i:Y}=this,{chunk:U}=this;while(!0){let z=this.getCode();switch(z){case H9:this.text+=`${U.slice(Y,this.prevI)}
`,Y=this.i,z=V5;break;case k4:return this.text+=U.slice(Y),!1;default:}if(z===$)return this.text+=U.slice(Y,this.prevI),!0}}captureNameChars(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCode();if(U===k4)return this.name+=$.slice(Y),k4;if(!R70(U))return this.name+=$.slice(Y,this.prevI),U===H9?V5:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===k4||!d8($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=ie0,this.getCode=this.getCode10;else this.isChar=ce0,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=re0}sBeginWhitespace(){let $=this.i,Y=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(Y){case Y2:if(this.state=rk,this.text.length!==0)throw Error("no-empty text at start");break;case k4:break;default:this.unget(),this.state=_8,this.xmlDeclPossible=!1}}sDoctype(){var $;let Y=this.captureTo(N01);switch(Y){case j6:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=_8,this.doctype=!0;break}case k4:break;default:if(this.text+=String.fromCodePoint(Y),Y===m70)this.state=RJ;else if(JN(Y))this.state=se0,this.q=Y}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=lk}sDTD(){let $=this.captureTo(D01);if($===k4)return;if(this.text+=String.fromCodePoint($),$===vJ)this.state=lk;else if($===Y2)this.state=te0;else if(JN($))this.state=ae0,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=RJ,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case f70:this.state=ee0,this.openWakaBang="";break;case r6:this.state=U01;break;default:this.state=RJ}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),Y=this.openWakaBang+=$;if(this.text+=$,Y!=="-")this.state=Y==="--"?ok:RJ,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(zN))this.text+="-",this.state=$01}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===zN?Y01:ok}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===j6)this.state=RJ;else this.fail("malformed comment."),this.state=ok}sDTDPI(){if(this.captureToChar(r6))this.text+="?",this.state=z01}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===j6)this.state=RJ}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:Y}=this;$:while(!0)switch(this.getCode()){case H9:this.entity+=`${Y.slice($,this.prevI)}
`,$=this.i;break;case M01:{let{entityReturnState:U}=this,z=this.entity+Y.slice($,this.prevI);this.state=U;let Q;if(z==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(z),this.entity="";if(U!==_8||this.textHandler!==void 0)this.text+=Q;break $}case k4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(gW($))this.state=V01,this.unget(),this.xmlDeclPossible=!1;else switch($){case QN:this.state=O01,this.xmlDeclPossible=!1;break;case f70:this.state=Q01,this.openWakaBang="",this.xmlDeclPossible=!1;break;case r6:this.state=H01;break;default:this.fail("disallowed character in tag name"),this.state=_8,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=ak,this.openWakaBang="";break;case"--":this.state=sk,this.openWakaBang="";break;case"DOCTYPE":if(this.state=lk,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(zN))this.state=J01}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===zN)this.state=I01,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=sk}sCommentEnded(){let $=this.getCodeNorm();if($!==j6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=sk;else this.state=_8}sCData(){if(this.captureToChar(vJ))this.state=K01}sCDataEnding(){let $=this.getCodeNorm();if($===vJ)this.state=G01;else this.text+=`]${String.fromCodePoint($)}`,this.state=ak}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case j6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=_8;break}case vJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=ak}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=v70;else if($===r6||d8($))this.fail("processing instruction without a target."),this.state=$===r6?UN:tk;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=v70}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===k4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let z=U===r6;if(z||d8(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=z?qU:h70}else this.state=z?UN:tk;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($===r6)this.state=UN;else if(!d8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(r6))this.state=UN}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=_8}else if(Y===r6)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=tk;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===r6){this.state=qU;return}if($!==k4)this.state=W01,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(A01);if($===r6){this.state=qU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(d8($)||$===_J))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=$===_J?S70:X01}sXMLDeclEq(){let $=this.getCodeNorm();if($===r6){this.state=qU,this.fail("XML declaration is incomplete.");return}if(d8($))return;if($!==_J)this.fail("value required.");this.state=S70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===r6){this.state=qU,this.fail("XML declaration is incomplete.");return}if(d8($))return;if(!JN($))this.fail("value must be quoted."),this.q=x70;else this.q=$;this.state=Z01}sXMLDeclValue(){let $=this.captureTo([this.q,r6]);if($===r6){this.state=qU,this.text="",this.fail("XML declaration is incomplete.");return}if($===k4)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=VU;break;case k4:if(z!==void 0)this.text+=U.slice($);break $;default:Y=VU}this.forbiddenState=Y}handleTextOutsideRoot(){let{i:$}=this,{chunk:Y,textHandler:U}=this,z=!1;$:while(!0){let Q=this.getCode();switch(Q){case Y2:{if(this.state=rk,U!==void 0){let{text:J}=this,I=Y.slice($,this.prevI);if(J.length!==0)U(J+I),this.text="";else if(I.length!==0)U(I)}break $}case kW:if(this.state=YN,this.entityReturnState=_8,U!==void 0)this.text+=Y.slice($,this.prevI);z=!0;break $;case H9:if(U!==void 0)this.text+=`${Y.slice($,this.prevI)}
`;$=this.i;break;case k4:if(U!==void 0)this.text+=Y.slice($);break $;default:if(!d8(Q))z=!0}}if(!z)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:z,local:Q}=this.qname($),J={name:$,prefix:z,local:Q,value:Y};if(this.attribList.push(J),(U=this.attributeHandler)===null||U===void 0||U.call(this,J),z==="xmlns"){let I=Y.trim();if(this.currentXMLVersion==="1.0"&&I==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[Q]=I,Qx(this,Q,I)}else if($==="xmlns"){let I=Y.trim();this.topNS[""]=I,Qx(this,"",I)}}pushAttribPlain($,Y){var U;let z={name:$,value:Y};this.attribList.push(z),(U=this.attributeHandler)===null||U===void 0||U.call(this,z)}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!==_70&&this.state!==_8)this.fail("unexpected end.");let{text:z}=this;if(z.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,z),this.text="";return this._closed=!0,(Y=this.endHandler)===null||Y===void 0||Y.call(this),this._init(),this}resolve($){var Y,U;let z=this.topNS[$];if(z!==void 0)return z;let{tags:Q}=this;for(let J=Q.length-1;J>=0;J--)if(z=Q[J].ns[$],z!==void 0)return z;if(z=this.ns[$],z!==void 0)return z;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),z=$.slice(0,Y);if(z===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:z,local:U}}processAttribsNS(){var $;let{attribList:Y}=this,U=this.tag;{let{prefix:J,local:I}=this.qname(U.name);U.prefix=J,U.local=I;let K=U.uri=($=this.resolve(J))!==null&&$!==void 0?$:"";if(J!==""){if(J==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(K==="")this.fail(`unbound namespace prefix: ${JSON.stringify(J)}.`),U.uri=J}}if(Y.length===0)return;let{attributes:z}=U,Q=new Set;for(let J of Y){let{name:I,prefix:K,local:G}=J,H,W;if(K==="")H=I==="xmlns"?hJ:"",W=I;else{if(H=this.resolve(K),H===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(K)}.`),H=K;W=`{${H}}${G}`}if(Q.has(W))this.fail(`duplicate attribute: ${W}.`);Q.add(W),J.uri=H,z[I]=J}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,Y=this.tag.attributes;for(let{name:U,value:z}of $){if(Y[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);Y[U]=z}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=_8,this.name=""}openSelfClosingTag(){var $,Y,U;this.processAttribs();let{tags:z}=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=z[z.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=_8,this.name=""}closeTag(){let{tags:$,name:Y}=this;if(this.state=_8,this.name="",Y===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,z=$.length;while(z-- >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(z===0)this.closedRoot=!0;else if(z<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)}}r70.SaxesParser=o70});var xW=E((lm1,a70)=>{var{SaxesParser:R01}=s70(),{PassThrough:_01}=R8(),{bufferToString:v01}=ik();a70.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new _01);let Y=new R01,U;Y.on("error",(Q)=>{U=Q});let z=[];Y.on("opentag",(Q)=>z.push({eventType:"opentag",value:Q})),Y.on("text",(Q)=>z.push({eventType:"text",value:Q})),Y.on("closetag",(Q)=>z.push({eventType:"closetag",value:Q}));for await(let Q of $){if(Y.write(v01(Q)),U)throw U;yield z,z=[]}}});var g0=E((om1,t70)=>{var h01=xW(),S01=o6();class gJ{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,Y){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof gJ)$.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:z}of Y)if(U==="opentag")this.parseOpen(z);else if(U==="text")this.parseText(z);else if(U==="closetag"){if(!this.parseClose(z.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}`}}CI0.FormatterOptions=EI0});var uN=E((Mr1,SI0)=>{var c51="[object AsyncFunction]",p51="[object Function]",d51="[object GeneratorFunction]",m51="[object Null]",l51="[object Proxy]",o51="[object Undefined]",r51=typeof global=="object"&&global&&global.Object===Object&&global,s51=typeof self=="object"&&self&&self.Object===Object&&self,a51=r51||s51||Function("return this")(),vI0=Object.prototype,t51=vI0.hasOwnProperty,hI0=vI0.toString,_I0=a51.Symbol,DU=_I0?_I0.toStringTag:void 0;function e51($){if($==null)return $===void 0?o51:m51;return DU&&DU in Object($)?$91($):Y91($)}function $91($){var Y=t51.call($,DU),U=$[DU];try{$[DU]=void 0;var z=!0}catch(J){}var Q=hI0.call($);if(z)if(Y)$[DU]=U;else delete $[DU];return Q}function Y91($){return hI0.call($)}function U91($){if(!z91($))return!1;var Y=e51($);return Y==p51||Y==d51||Y==c51||Y==l51}function z91($){var Y=typeof $;return $!=null&&(Y=="object"||Y=="function")}SI0.exports=U91});var VK0=E((bN,pJ)=>{var Q91=200,Cf="__lodash_hash_undefined__",oN=1,dI0=2,mI0=9007199254740991,iN="[object Arguments]",Df="[object Array]",J91="[object AsyncFunction]",lI0="[object Boolean]",oI0="[object Date]",rI0="[object Error]",sI0="[object Function]",I91="[object GeneratorFunction]",nN="[object Map]",aI0="[object Number]",K91="[object Null]",cJ="[object Object]",gI0="[object Promise]",G91="[object Proxy]",tI0="[object RegExp]",cN="[object Set]",eI0="[object String]",H91="[object Symbol]",W91="[object Undefined]",Af="[object WeakMap]",$K0="[object ArrayBuffer]",pN="[object DataView]",X91="[object Float32Array]",Z91="[object Float64Array]",q91="[object Int8Array]",V91="[object Int16Array]",L91="[object Int32Array]",F91="[object Uint8Array]",O91="[object Uint8ClampedArray]",w91="[object Uint16Array]",M91="[object Uint32Array]",N91=/[\\^$.*+?()[\]{}|]/g,D91=/^\[object .+?Constructor\]$/,A91=/^(?:0|[1-9]\d*)$/,T4={};T4[X91]=T4[Z91]=T4[q91]=T4[V91]=T4[L91]=T4[F91]=T4[O91]=T4[w91]=T4[M91]=!0;T4[iN]=T4[Df]=T4[$K0]=T4[lI0]=T4[pN]=T4[oI0]=T4[rI0]=T4[sI0]=T4[nN]=T4[aI0]=T4[cJ]=T4[tI0]=T4[cN]=T4[eI0]=T4[Af]=!1;var YK0=typeof global=="object"&&global&&global.Object===Object&&global,B91=typeof self=="object"&&self&&self.Object===Object&&self,V3=YK0||B91||Function("return this")(),UK0=typeof bN=="object"&&bN&&!bN.nodeType&&bN,yI0=UK0&&typeof pJ=="object"&&pJ&&!pJ.nodeType&&pJ,zK0=yI0&&yI0.exports===UK0,wf=zK0&&YK0.process,kI0=function(){try{return wf&&wf.binding&&wf.binding("util")}catch($){}}(),xI0=kI0&&kI0.isTypedArray;function P91($,Y){var U=-1,z=$==null?0:$.length,Q=0,J=[];while(++U<z){var I=$[U];if(Y(I,U,$))J[Q++]=I}return J}function T91($,Y){var U=-1,z=Y.length,Q=$.length;while(++U<z)$[Q+U]=Y[U];return $}function j91($,Y){var U=-1,z=$==null?0:$.length;while(++U<z)if(Y($[U],U,$))return!0;return!1}function E91($,Y){var U=-1,z=Array($);while(++U<$)z[U]=Y(U);return z}function C91($){return function(Y){return $(Y)}}function R91($,Y){return $.has(Y)}function _91($,Y){return $==null?void 0:$[Y]}function v91($){var Y=-1,U=Array($.size);return $.forEach(function(z,Q){U[++Y]=[Q,z]}),U}function h91($,Y){return function(U){return $(Y(U))}}function S91($){var Y=-1,U=Array($.size);return $.forEach(function(z){U[++Y]=z}),U}var g91=Array.prototype,y91=Function.prototype,rN=Object.prototype,Mf=V3["__core-js_shared__"],QK0=y91.toString,X9=rN.hasOwnProperty,fI0=function(){var $=/[^.]+$/.exec(Mf&&Mf.keys&&Mf.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),JK0=rN.toString,k91=RegExp("^"+QK0.call(X9).replace(N91,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),uI0=zK0?V3.Buffer:void 0,dN=V3.Symbol,bI0=V3.Uint8Array,IK0=rN.propertyIsEnumerable,x91=g91.splice,AU=dN?dN.toStringTag:void 0,iI0=Object.getOwnPropertySymbols,f91=uI0?uI0.isBuffer:void 0,u91=h91(Object.keys,Object),Bf=dJ(V3,"DataView"),pW=dJ(V3,"Map"),Pf=dJ(V3,"Promise"),Tf=dJ(V3,"Set"),jf=dJ(V3,"WeakMap"),dW=dJ(Object,"create"),b91=TU(Bf),i91=TU(pW),n91=TU(Pf),c91=TU(Tf),p91=TU(jf),nI0=dN?dN.prototype:void 0,Nf=nI0?nI0.valueOf:void 0;function BU($){var Y=-1,U=$==null?0:$.length;this.clear();while(++Y<U){var z=$[Y];this.set(z[0],z[1])}}function d91(){this.__data__=dW?dW(null):{},this.size=0}function m91($){var Y=this.has($)&&delete this.__data__[$];return this.size-=Y?1:0,Y}function l91($){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(e31.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,Y,U){let z=`${$71.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:Q}=this;if(Q.quote!==""){if(z.indexOf(Q.quote)!==-1)return this.quoteField(z.replace(this.REPLACE_REGEXP,Q.escapedQuote))}if(z.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(Y,U))return this.quoteField(z);return z}quoteField($){let{quote:Y}=this.formatterOptions;return`${Y}${$}${Y}`}}mJ.FieldFormatter=BK0});var Sf=E((PK0)=>{Object.defineProperty(PK0,"__esModule",{value:!0});PK0.isSyncTransform=void 0;PK0.isSyncTransform=($)=>$.length===1});var EK0=E((lJ)=>{var jK0=lJ&&lJ.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(lJ,"__esModule",{value:!0});lJ.RowFormatter=void 0;var U71=jK0(uN()),z71=jK0(VK0()),Q71=hf(),J71=Sf();class jU{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new Q71.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(jU.isRowHashArray($))return $.map((Y)=>Y[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(J71.isSyncTransform($))return(Y,U)=>{let z=null;try{z=$(Y)}catch(Q){return U(Q)}return U(null,z)};return(Y,U)=>{$(Y,U)}}set rowTransform($){if(!U71.default($))throw TypeError("The transform should be a function");this._rowTransform=jU.createTransform($)}format($,Y){this.callTransformer($,(U,z)=>{if(U)return Y(U);if(!$)return Y(null);let Q=[];if(z){let{shouldFormatColumns:J,headers:I}=this.checkHeaders(z);if(this.shouldWriteHeaders&&I&&!this.hasWrittenHeaders)Q.push(this.formatColumns(I,!0)),this.hasWrittenHeaders=!0;if(J){let K=this.gatherColumns(z);Q.push(this.formatColumns(K,!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=jU.gatherHeaders($);if(this.headers=Y,this.fieldFormatter.headers=Y,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!z71.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(jU.isRowHashArray($))return this.headers.map((Y,U)=>{let z=$[U];if(z)return z[1];return""});if(jU.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:z}=this;if(this.rowCount+=1,z)return[this.formatterOptions.rowDelimiter,U].join("");return U}}lJ.RowFormatter=jU});var CK0=E((tN)=>{Object.defineProperty(tN,"__esModule",{value:!0});tN.FieldFormatter=tN.RowFormatter=void 0;var I71=EK0();Object.defineProperty(tN,"RowFormatter",{enumerable:!0,get:function(){return I71.RowFormatter}});var K71=hf();Object.defineProperty(tN,"FieldFormatter",{enumerable:!0,get:function(){return K71.FieldFormatter}})});var gf=E((_K0)=>{Object.defineProperty(_K0,"__esModule",{value:!0});_K0.CsvFormatterStream=void 0;var H71=I0("stream"),W71=CK0();class RK0 extends H71.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new W71.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,Y,U){let z=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(Q,J)=>{if(Q)return z=!0,U(Q);if(J)J.forEach((I)=>{this.push(Buffer.from(I,"utf8"))});return z=!0,U()})}catch(Q){if(z)throw Q;U(Q)}}_flush($){this.rowFormatter.finish((Y,U)=>{if(Y)return $(Y);if(U)U.forEach((z)=>{this.push(Buffer.from(z,"utf8"))});return $()})}}_K0.CsvFormatterStream=RK0});var SK0=E((a1)=>{var hK0=a1&&a1.__createBinding||(Object.create?function($,Y,U,z){if(z===void 0)z=U;Object.defineProperty($,z,{enumerable:!0,get:function(){return Y[U]}})}:function($,Y,U,z){if(z===void 0)z=U;$[z]=Y[U]}),X71=a1&&a1.__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);I(G,H),K(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 I(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 F=H[V];if(F.length===0)continue;let O=(0,z.propertyInData)(W,X,V,Z.opts.ownProperties);if(G.setParams({property:V,depsCount:F.length,deps:F.join(", ")}),Z.allErrors)W.if(O,()=>{for(let w of F)(0,z.checkReportMissingProp)(G,w)});else W.if(Y._`${O} && (${(0,z.checkMissingProp)(G,F,q)})`),(0,z.reportMissingProp)(G,q),W.else()}}$.validatePropertyDeps=I;function K(G,H=G.schema){let{gen:W,data:X,keyword:Z,it:q}=G,V=W.name("valid");for(let F in H){if((0,U.alwaysValidSchema)(q,H[F]))continue;W.if((0,z.propertyInData)(W,X,F,q.opts.ownProperties),()=>{let O=G.subschema({keyword:Z,schemaProp:F},V);G.mergeValidEvaluated(O,V)},()=>W.var(V,!0)),G.ok(V)}}$.validateSchemaDeps=K,$.default=Q}),Qi0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=F1(),U=v1(),z={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:I,data:K,it:G}=Q;if((0,U.alwaysValidSchema)(G,I))return;let H=J.name("valid");J.forIn("key",K,(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=z}),Re=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=K5(),U=F1(),z=I5(),Q=v1(),J={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:I})=>U._`{additionalProperty: ${I.additionalProperty}}`},code(I){let{gen:K,schema:G,parentSchema:H,data:W,errsCount:X,it:Z}=I;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 F=(0,Y.allSchemaProperties)(H.properties),O=(0,Y.allSchemaProperties)(H.patternProperties);w(),I.ok(U._`${X} === ${z.default.errors}`);function w(){K.forIn("key",W,(T)=>{if(!F.length&&!O.length)D(T);else K.if(N(T),()=>D(T))})}function N(T){let B;if(F.length>8){let j=(0,Q.schemaRefOrVal)(Z,H.properties,"properties");B=(0,Y.isOwnProperty)(K,j,T)}else if(F.length)B=(0,U.or)(...F.map((j)=>U._`${T} === ${j}`));else B=U.nil;if(O.length)B=(0,U.or)(B,...O.map((j)=>U._`${(0,Y.usePattern)(I,j)}.test(${T})`));return(0,U.not)(B)}function M(T){K.code(U._`delete ${W}[${T}]`)}function D(T){if(V.removeAdditional==="all"||V.removeAdditional&&G===!1){M(T);return}if(G===!1){if(I.setParams({additionalProperty:T}),I.error(),!q)K.break();return}if(typeof G=="object"&&!(0,Q.alwaysValidSchema)(Z,G)){let B=K.name("valid");if(V.removeAdditional==="failing")P(T,B,!1),K.if((0,U.not)(B),()=>{I.reset(),M(T)});else if(P(T,B),!q)K.if((0,U.not)(B),()=>K.break())}}function P(T,B,j){let C={keyword:"additionalProperties",dataProp:T,dataPropType:Q.Type.Str};if(j===!1)Object.assign(C,{compositeRule:!0,createErrors:!1,allErrors:!1});I.subschema(C,B)}}};$.default=J}),Ji0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=uQ(),U=K5(),z=v1(),Q=Re(),J={keyword:"properties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,parentSchema:H,data:W,it:X}=I;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 w of Z)X.definedProperties.add(w);if(X.opts.unevaluated&&Z.length&&X.props!==!0)X.props=z.mergeEvaluated.props(K,(0,z.toHash)(Z),X.props);let q=Z.filter((w)=>!(0,z.alwaysValidSchema)(X,G[w]));if(q.length===0)return;let V=K.name("valid");for(let w of q){if(F(w))O(w);else{if(K.if((0,U.propertyInData)(K,W,w,X.opts.ownProperties)),O(w),!X.allErrors)K.else().var(V,!0);K.endIf()}I.it.definedProperties.add(w),I.ok(V)}function F(w){return X.opts.useDefaults&&!X.compositeRule&&G[w].default!==void 0}function O(w){I.subschema({keyword:"properties",schemaProp:w,dataProp:w},V)}}};$.default=J}),Ii0=C0(($)=>{Object.defineProperty($,"__esModule",{value:!0});let Y=K5(),U=F1(),z=v1(),Q=v1(),J={keyword:"patternProperties",type:"object",schemaType:"object",code(I){let{gen:K,schema:G,data:H,parentSchema:W,it:X}=I,{opts:Z}=X,q=(0,Y.allSchemaProperties)(G),V=q.filter((P)=>(0,z.alwaysValidSchema)(X,G[P]));if(q.length===0||V.length===q.length&&(!X.opts.unevaluated||X.props===!0))return;let F=Z.strictSchema&&!Z.allowMatchingProperties&&W.properties,O=K.name("valid");if(X.props!==!0&&!(X.props instanceof U.Name))X.props=(0,Q.evaluatedPropsToName)(K,X.props);let{props:w}=X;N();function N(){for(let P of q){if(F)M(P);if(X.allErrors) Line truncated
\x00`,k+=B4(j,2),k+=K.magic,k+=B4(O,2),k+=B4(w,2),k+=B4(B.crc32,4),k+=B4(B.compressedSize,4),k+=B4(B.uncompressedSize,4),k+=B4(H.length,2),k+=B4(N.length,2);var S=vM.LOCAL_FILE_HEADER+k+H+N,i=vM.CENTRAL_FILE_HEADER+B4(b,2)+k+B4(Z.length,2)+"\x00\x00\x00\x00"+B4(C,4)+B4(z,4)+H+N+Z;return{fileRecord:S,dirRecord:i}},Gs0=function($,Y,U,z,Q){var J="",I=NJ.transformTo("string",Q(z));return J=vM.CENTRAL_DIRECTORY_END+"\x00\x00\x00\x00"+B4($,2)+B4($,2)+B4(Y,4)+B4(U,4)+B4(I.length,2)+I,J},Hs0=function($){var Y="";return Y=vM.DATA_DESCRIPTOR+B4($.crc32,4)+B4($.compressedSize,4)+B4($.uncompressedSize,4),Y};function V5($,Y,U,z){DJ.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=Y,this.zipPlatform=U,this.encodeFileName=z,this.streamFiles=$,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}NJ.inherits(V5,DJ);V5.prototype.push=function($){var Y=$.meta.percent||0,U=this.entriesCount,z=this._sources.length;if(this.accumulate)this.contentBuffer.push($);else this.bytesWritten+=$.data.length,DJ.prototype.push.call(this,{data:$.data,meta:{currentFile:this.currentFile,percent:U?(Y+100*(U-z-1))/U:100}})};V5.prototype.openedSource=function($){this.currentSourceOffset=this.bytesWritten,this.currentFile=$.file.name;var Y=this.streamFiles&&!$.file.dir;if(Y){var U=I90($,Y,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:U.fileRecord,meta:{percent:0}})}else this.accumulate=!0};V5.prototype.closedSource=function($){this.accumulate=!1;var Y=this.streamFiles&&!$.file.dir,U=I90($,Y,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(U.dirRecord),Y)this.push({data:Hs0($),meta:{percent:100}});else{this.push({data:U.fileRecord,meta:{percent:0}});while(this.contentBuffer.length)this.push(this.contentBuffer.shift())}this.currentFile=null};V5.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-$,z=Gs0(this.dirRecords.length,U,$,this.zipComment,this.encodeFileName);this.push({data:z,meta:{percent:100}})};V5.prototype.prepareNextSource=function(){if(this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused)this.previous.pause();else this.previous.resume()};V5.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};V5.prototype.resume=function(){if(!DJ.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};V5.prototype.error=function($){var Y=this._sources;if(!DJ.prototype.error.call(this,$))return!1;for(var U=0;U<Y.length;U++)try{Y[U].error($)}catch(z){}return!0};V5.prototype.lock=function(){DJ.prototype.lock.call(this);var $=this._sources;for(var Y=0;Y<$.length;Y++)$[Y].lock()};K90.exports=V5});var H90=E((qs0)=>{var Ws0=Jk(),Xs0=G90(),Zs0=function($,Y){var U=$||Y,z=Ws0[U];if(!z)throw Error(U+" is not a valid compression method !");return z};qs0.generateWorker=function($,Y,U){var z=new Xs0(Y.streamFiles,U,Y.platform,Y.encodeFileName),Q=0;try{$.forEach(function(J,I){Q++;var K=Zs0(I.options.compression,Y.compression),G=I.options.compressionOptions||Y.compressionOptions||{},H=I.dir,W=I.date;I._compressWorker(K,G).withStreamInfo("file",{name:J,dir:H,date:W,comment:I.comment||"",unixPermissions:I.unixPermissions,dosPermissions:I.dosPermissions}).pipe(z)}),z.entriesCount=Q}catch(J){z.error(J)}return z}});var X90=E((Mm1,W90)=>{var Ls0=d4(),hM=G$();function NW($,Y){hM.call(this,"Nodejs stream input adapter for "+$),this._upstreamEnded=!1,this._bindStream(Y)}Ls0.inherits(NW,hM);NW.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()})};NW.prototype.pause=function(){if(!hM.prototype.pause.call(this))return!1;return this._stream.pause(),!0};NW.prototype.resume=function(){if(!hM.prototype.resume.call(this))return!1;if(this._upstreamEnded)this.end();else this._stream.resume();return!0};W90.exports=NW});var D90=E((Nm1,N90)=>{var Fs0=WJ(),DW=d4(),L90=G$(),ws0=Xy(),F90=Zy(),Z90=qM(),Os0=q$0(),Ms0=H90(),q90=eH(),Ns0=X90(),w90=function($,Y,U){var z=DW.getTypeOf(Y),Q,J=DW.extend(U||{},F90);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,z=this._xml;if(U&&this.open)z.push(">");this._stack.push($),z.push("<"),z.push($),nk(z,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)X70(this._xml,$,Y)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");nk(this._xml,$)}writeText($){let Y=this._xml;if(this.open)Y.push(">"),this.open=!1;this.leaf=!1,Y.push(W70.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("")}}ck.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};Z70.exports=ck});var dk=E((Xe0)=>{var q70=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function We0($){if(typeof $==="string")return $;if(q70)return q70.decode($);return $.toString()}Xe0.bufferToString=We0});var O70=E((L70)=>{Object.defineProperty(L70,"__esModule",{value:!0});L70.CHAR=`
\r -퟿-�\uD800\uDC00-\uDBFF\uDFFF`;L70.S=` \r
`;L70.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";L70.NAME_CHAR="-"+L70.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";L70.CHAR_RE=new RegExp("^["+L70.CHAR+"]$","u");L70.S_RE=new RegExp("^["+L70.S+"]+$","u");L70.NAME_START_CHAR_RE=new RegExp("^["+L70.NAME_START_CHAR+"]$","u");L70.NAME_CHAR_RE=new RegExp("^["+L70.NAME_CHAR+"]$","u");L70.NAME_RE=new RegExp("^["+L70.NAME_START_CHAR+"]["+L70.NAME_CHAR+"]*$","u");L70.NMTOKEN_RE=new RegExp("^["+L70.NAME_CHAR+"]+$","u");var pk=9,mk=10,lk=13,ok=32;L70.S_LIST=[ok,mk,lk,pk];function qe0($){return $>=ok&&$<=55295||$===mk||$===lk||$===pk||$>=57344&&$<=65533||$>=65536&&$<=1114111}L70.isChar=qe0;function Ve0($){return $===ok||$===mk||$===lk||$===pk}L70.isS=Ve0;function V70($){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}L70.isNameStartChar=V70;function Le0($){return V70($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}L70.isNameChar=Le0});var C70=E((P70)=>{Object.defineProperty(P70,"__esModule",{value:!0});P70.CHAR="\x01-퟿-�\uD800\uDC00-\uDBFF\uDFFF";P70.RESTRICTED_CHAR="\x01-\b\v\f\x0E-\x1F-„†-Ÿ";P70.S=` \r
`;P70.NAME_START_CHAR=":A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";P70.NAME_CHAR="-"+P70.NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";P70.CHAR_RE=new RegExp("^["+P70.CHAR+"]$","u");P70.RESTRICTED_CHAR_RE=new RegExp("^["+P70.RESTRICTED_CHAR+"]$","u");P70.S_RE=new RegExp("^["+P70.S+"]+$","u");P70.NAME_START_CHAR_RE=new RegExp("^["+P70.NAME_START_CHAR+"]$","u");P70.NAME_CHAR_RE=new RegExp("^["+P70.NAME_CHAR+"]$","u");P70.NAME_RE=new RegExp("^["+P70.NAME_START_CHAR+"]["+P70.NAME_CHAR+"]*$","u");P70.NMTOKEN_RE=new RegExp("^["+P70.NAME_CHAR+"]+$","u");var M70=9,N70=10,D70=13,B70=32;P70.S_LIST=[B70,N70,D70,M70];function Ee0($){return $>=1&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}P70.isChar=Ee0;function Ce0($){return $>=1&&$<=8||$===11||$===12||$>=14&&$<=31||$>=127&&$<=132||$>=134&&$<=159}P70.isRestrictedChar=Ce0;function Re0($){return $===9||$===10||$===13||$>31&&$<127||$===133||$>159&&$<=55295||$>=57344&&$<=65533||$>=65536&&$<=1114111}P70.isCharAndNotRestricted=Re0;function _e0($){return $===B70||$===N70||$===D70||$===M70}P70.isS=_e0;function A70($){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}P70.isNameStartChar=A70;function ve0($){return A70($)||$>=48&&$<=57||$===45||$===46||$===183||$>=768&&$<=879||$>=8255&&$<=8256}P70.isNameChar=ve0});var v70=E((_70)=>{Object.defineProperty(_70,"__esModule",{value:!0});_70.NC_NAME_START_CHAR="A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\uD800\uDC00-\uDB7F\uDFFF";_70.NC_NAME_CHAR="-"+_70.NC_NAME_START_CHAR+".0-9·̀-ͯ‿-⁀";_70.NC_NAME_START_CHAR_RE=new RegExp("^["+_70.NC_NAME_START_CHAR+"]$","u");_70.NC_NAME_CHAR_RE=new RegExp("^["+_70.NC_NAME_CHAR+"]$","u");_70.NC_NAME_RE=new RegExp("^["+_70.NC_NAME_START_CHAR+"]["+_70.NC_NAME_CHAR+"]*$","u");function R70($){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}_70.isNCNameStartChar=R70;function me0($){return R70($)||($===45||$===46||$>=48&&$<=57||$===183||$>=768&&$<=879||$>=8255&&$<=8256)}_70.isNCNameChar=me0});var e70=E((t70)=>{Object.defineProperty(t70,"__esModule",{value:!0});var SJ=O70(),te0=C70(),Gx=v70(),m8=SJ.isS,ee0=SJ.isChar,gW=SJ.isNameStartChar,h70=SJ.isNameChar,m70=SJ.S_LIST,$01=SJ.NAME_RE,Y01=te0.isChar,U01=Gx.isNCNameStartChar,z01=Gx.isNCNameChar,Q01=Gx.NC_NAME_RE,KN="http://www.w3.org/XML/1998/namespace",hJ="http://www.w3.org/2000/xmlns/",J01={__proto__:null,xml:KN,xmlns:hJ},I01={__proto__:null,amp:"&",gt:">",lt:"<",quot:'"',apos:"'"},f4=-1,W9=-2,S70=0,K01=1,sk=2,G01=3,RJ=4,H01=5,W01=6,X01=7,ak=8,Z01=9,q01=10,V01=11,L01=12,h8=13,UN=14,tk=15,F01=16,ek=17,w01=18,O01=19,$x=20,M01=21,N01=22,D01=23,g70=24,Yx=25,zN=26,y70=27,B01=28,A01=29,k70=30,P01=31,T01=32,qU=33,j01=34,Ux=35,yW=36,zx=37,E01=38,x70=39,f70=40,C01=41,u70=42,R01=43,_01=44,Qx=9,F5=10,Jx=13,b70=32,i70=33,l70=34,kW=38,o70=39,QN=45,JN=47,v01=59,Y2=60,_J=61,j6=62,r6=63,r70=91,vJ=93,n70=133,c70=8232,IN=($)=>$===l70||$===o70,s70=[l70,o70],h01=[...s70,r70,j6],S01=[...s70,Y2,vJ],g01=[_J,r6,...m70],y01=[...m70,j6,kW,Y2];function Kx($,Y,U){switch(Y){case"xml":if(U!==KN)$.fail(`xml prefix must be bound to ${KN}.`);break;case"xmlns":if(U!==hJ)$.fail(`xmlns prefix must be bound to ${hJ}.`);break;default:}switch(U){case hJ:$.fail(Y===""?`the default namespace may not be set to ${U}.`:`may not assign a prefix (even "xmlns") to the URI ${hJ}.`);break;case KN: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 k01($,Y){for(let U of Object.keys(Y))Kx($,U,Y[U])}var x01=($)=>Q01.test($),f01=($)=>$01.test($),VU=0,d70=1,Ix=2;t70.EVENTS=["xmldecl","text","processinginstruction","doctype","comment","opentagstart","attribute","opentag","closetag","cdata","error","end","ready"];var p70={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 a70{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=U01,this.nameCheck=z01,this.isName=x01,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},J01);let U=this.opt.additionalNamesp Line truncated
`,Y=this.i}}captureToChar($){let{i:Y}=this,{chunk:U}=this;while(!0){let z=this.getCode();switch(z){case W9:this.text+=`${U.slice(Y,this.prevI)}
`,Y=this.i,z=F5;break;case f4:return this.text+=U.slice(Y),!1;default:}if(z===$)return this.text+=U.slice(Y,this.prevI),!0}}captureNameChars(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCode();if(U===f4)return this.name+=$.slice(Y),f4;if(!h70(U))return this.name+=$.slice(Y,this.prevI),U===W9?F5:U}}skipSpaces(){while(!0){let $=this.getCodeNorm();if($===f4||!m8($))return $}}setXMLVersion($){if(this.currentXMLVersion=$,$==="1.0")this.isChar=ee0,this.getCode=this.getCode10;else this.isChar=Y01,this.getCode=this.getCode11}sBegin(){if(this.chunk.charCodeAt(0)===65279)this.i++,this.column++;this.state=K01}sBeginWhitespace(){let $=this.i,Y=this.skipSpaces();if(this.prevI!==$)this.xmlDeclPossible=!1;switch(Y){case Y2:if(this.state=tk,this.text.length!==0)throw Error("no-empty text at start");break;case f4:break;default:this.unget(),this.state=h8,this.xmlDeclPossible=!1}}sDoctype(){var $;let Y=this.captureTo(h01);switch(Y){case j6:{($=this.doctypeHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=h8,this.doctype=!0;break}case f4:break;default:if(this.text+=String.fromCodePoint(Y),Y===r70)this.state=RJ;else if(IN(Y))this.state=G01,this.q=Y}}sDoctypeQuote(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.q=null,this.state=sk}sDTD(){let $=this.captureTo(S01);if($===f4)return;if(this.text+=String.fromCodePoint($),$===vJ)this.state=sk;else if($===Y2)this.state=W01;else if(IN($))this.state=H01,this.q=$}sDTDQuoted(){let $=this.q;if(this.captureToChar($))this.text+=String.fromCodePoint($),this.state=RJ,this.q=null}sDTDOpenWaka(){let $=this.getCodeNorm();switch(this.text+=String.fromCodePoint($),$){case i70:this.state=X01,this.openWakaBang="";break;case r6:this.state=V01;break;default:this.state=RJ}}sDTDOpenWakaBang(){let $=String.fromCodePoint(this.getCodeNorm()),Y=this.openWakaBang+=$;if(this.text+=$,Y!=="-")this.state=Y==="--"?ak:RJ,this.openWakaBang=""}sDTDComment(){if(this.captureToChar(QN))this.text+="-",this.state=Z01}sDTDCommentEnding(){let $=this.getCodeNorm();this.text+=String.fromCodePoint($),this.state=$===QN?q01:ak}sDTDCommentEnded(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===j6)this.state=RJ;else this.fail("malformed comment."),this.state=ak}sDTDPI(){if(this.captureToChar(r6))this.text+="?",this.state=L01}sDTDPIEnding(){let $=this.getCodeNorm();if(this.text+=String.fromCodePoint($),$===j6)this.state=RJ}sText(){if(this.tags.length!==0)this.handleTextInRoot();else this.handleTextOutsideRoot()}sEntity(){let{i:$}=this,{chunk:Y}=this;$:while(!0)switch(this.getCode()){case W9:this.entity+=`${Y.slice($,this.prevI)}
`,$=this.i;break;case v01:{let{entityReturnState:U}=this,z=this.entity+Y.slice($,this.prevI);this.state=U;let Q;if(z==="")this.fail("empty entity name."),Q="&;";else Q=this.parseEntity(z),this.entity="";if(U!==h8||this.textHandler!==void 0)this.text+=Q;break $}case f4:this.entity+=Y.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(gW($))this.state=j01,this.unget(),this.xmlDeclPossible=!1;else switch($){case JN:this.state=R01,this.xmlDeclPossible=!1;break;case i70:this.state=F01,this.openWakaBang="",this.xmlDeclPossible=!1;break;case r6:this.state=D01;break;default:this.fail("disallowed character in tag name"),this.state=h8,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=$x,this.openWakaBang="";break;case"--":this.state=ek,this.openWakaBang="";break;case"DOCTYPE":if(this.state=sk,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(QN))this.state=w01}sCommentEnding(){var $;let Y=this.getCodeNorm();if(Y===QN)this.state=O01,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(Y)}`,this.state=ek}sCommentEnded(){let $=this.getCodeNorm();if($!==j6)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=ek;else this.state=h8}sCData(){if(this.captureToChar(vJ))this.state=M01}sCDataEnding(){let $=this.getCodeNorm();if($===vJ)this.state=N01;else this.text+=`]${String.fromCodePoint($)}`,this.state=$x}sCDataEnding2(){var $;let Y=this.getCodeNorm();switch(Y){case j6:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=h8;break}case vJ:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(Y)}`,this.state=$x}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=g70;else if($===r6||m8($))this.fail("processing instruction without a target."),this.state=$===r6?zN:Yx;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=g70}sPIRest(){let{chunk:$,i:Y}=this;while(!0){let U=this.getCodeNorm();if(U===f4){this.piTarget+=$.slice(Y);return}if(!this.nameCheck(U)){this.piTarget+=$.slice(Y,this.prevI);let z=U===r6;if(z||m8(U))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=z?qU:y70}else this.state=z?zN:Yx;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($===r6)this.state=zN;else if(!m8($))this.text=String.fromCodePoint($)}else if(this.captureToChar(r6))this.state=zN}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=h8}else if(Y===r6)this.text+="?";else this.text+=`?${String.fromCodePoint(Y)}`,this.state=Yx;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===r6){this.state=qU;return}if($!==f4)this.state=B01,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(g01);if($===r6){this.state=qU,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(m8($)||$===_J))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=$===_J?k70:A01}sXMLDeclEq(){let $=this.getCodeNorm();if($===r6){this.state=qU,this.fail("XML declaration is incomplete.");return}if(m8($))return;if($!==_J)this.fail("value required.");this.state=k70}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===r6){this.state=qU,this.fail("XML declaration is incomplete.");return}if(m8($))return;if(!IN($))this.fail("value must be quoted."),this.q=b70;else this.q=$;this.state=P01}sXMLDeclValue(){let $=this.captureTo([this.q,r6]);if($===r6){this.state=qU,this.text="",this.fail("XML declaration is incomplete.");return}if($===f4)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=VU;break;case f4:if(z!==void 0)this.text+=U.slice($);break $;default:Y=VU}this.forbiddenState=Y}handleTextOutsideRoot(){let{i:$}=this,{chunk:Y,textHandler:U}=this,z=!1;$:while(!0){let Q=this.getCode();switch(Q){case Y2:{if(this.state=tk,U!==void 0){let{text:J}=this,I=Y.slice($,this.prevI);if(J.length!==0)U(J+I),this.text="";else if(I.length!==0)U(I)}break $}case kW:if(this.state=UN,this.entityReturnState=h8,U!==void 0)this.text+=Y.slice($,this.prevI);z=!0;break $;case W9:if(U!==void 0)this.text+=`${Y.slice($,this.prevI)}
`;$=this.i;break;case f4:if(U!==void 0)this.text+=Y.slice($);break $;default:if(!m8(Q))z=!0}}if(!z)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:z,local:Q}=this.qname($),J={name:$,prefix:z,local:Q,value:Y};if(this.attribList.push(J),(U=this.attributeHandler)===null||U===void 0||U.call(this,J),z==="xmlns"){let I=Y.trim();if(this.currentXMLVersion==="1.0"&&I==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[Q]=I,Kx(this,Q,I)}else if($==="xmlns"){let I=Y.trim();this.topNS[""]=I,Kx(this,"",I)}}pushAttribPlain($,Y){var U;let z={name:$,value:Y};this.attribList.push(z),(U=this.attributeHandler)===null||U===void 0||U.call(this,z)}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!==S70&&this.state!==h8)this.fail("unexpected end.");let{text:z}=this;if(z.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,z),this.text="";return this._closed=!0,(Y=this.endHandler)===null||Y===void 0||Y.call(this),this._init(),this}resolve($){var Y,U;let z=this.topNS[$];if(z!==void 0)return z;let{tags:Q}=this;for(let J=Q.length-1;J>=0;J--)if(z=Q[J].ns[$],z!==void 0)return z;if(z=this.ns[$],z!==void 0)return z;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),z=$.slice(0,Y);if(z===""||U===""||U.includes(":"))this.fail(`malformed name: ${$}.`);return{prefix:z,local:U}}processAttribsNS(){var $;let{attribList:Y}=this,U=this.tag;{let{prefix:J,local:I}=this.qname(U.name);U.prefix=J,U.local=I;let K=U.uri=($=this.resolve(J))!==null&&$!==void 0?$:"";if(J!==""){if(J==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(K==="")this.fail(`unbound namespace prefix: ${JSON.stringify(J)}.`),U.uri=J}}if(Y.length===0)return;let{attributes:z}=U,Q=new Set;for(let J of Y){let{name:I,prefix:K,local:G}=J,H,W;if(K==="")H=I==="xmlns"?hJ:"",W=I;else{if(H=this.resolve(K),H===void 0)this.fail(`unbound namespace prefix: ${JSON.stringify(K)}.`),H=K;W=`{${H}}${G}`}if(Q.has(W))this.fail(`duplicate attribute: ${W}.`);Q.add(W),J.uri=H,z[I]=J}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,Y=this.tag.attributes;for(let{name:U,value:z}of $){if(Y[U]!==void 0)this.fail(`duplicate attribute: ${U}.`);Y[U]=z}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=h8,this.name=""}openSelfClosingTag(){var $,Y,U;this.processAttribs();let{tags:z}=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=z[z.length-1])!==null&&U!==void 0?U:null)===null)this.closedRoot=!0;this.state=h8,this.name=""}closeTag(){let{tags:$,name:Y}=this;if(this.state=h8,this.name="",Y===""){this.fail("weird empty close tag."),this.text+="</>";return}let U=this.closeTagHandler,z=$.length;while(z-- >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(z===0)this.closedRoot=!0;else if(z<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)}}t70.SaxesParser=a70});var xW=E((zl1,$20)=>{var{SaxesParser:i01}=e70(),{PassThrough:n01}=v8(),{bufferToString:c01}=dk();$20.exports=async function*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(new n01);let Y=new i01,U;Y.on("error",(Q)=>{U=Q});let z=[];Y.on("opentag",(Q)=>z.push({eventType:"opentag",value:Q})),Y.on("text",(Q)=>z.push({eventType:"text",value:Q})),Y.on("closetag",(Q)=>z.push({eventType:"closetag",value:Q}));for await(let Q of $){if(Y.write(c01(Q)),U)throw U;yield z,z=[]}}});var g0=E((Ql1,Y20)=>{var d01=xW(),p01=o6();class gJ{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,Y){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($ instanceof gJ)$.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:z}of Y)if(U==="opentag")this.parseOpen(z);else if(U==="text")this.parseText(z);else if(U==="closetag"){if(!this.parseClose(z.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}`}}vI0.FormatterOptions=_I0});var bN=E((Rr1,kI0)=>{var Y91="[object AsyncFunction]",U91="[object Function]",z91="[object GeneratorFunction]",Q91="[object Null]",J91="[object Proxy]",I91="[object Undefined]",K91=typeof global=="object"&&global&&global.Object===Object&&global,G91=typeof self=="object"&&self&&self.Object===Object&&self,H91=K91||G91||Function("return this")(),gI0=Object.prototype,W91=gI0.hasOwnProperty,yI0=gI0.toString,SI0=H91.Symbol,DU=SI0?SI0.toStringTag:void 0;function X91($){if($==null)return $===void 0?I91:Q91;return DU&&DU in Object($)?Z91($):q91($)}function Z91($){var Y=W91.call($,DU),U=$[DU];try{$[DU]=void 0;var z=!0}catch(J){}var Q=yI0.call($);if(z)if(Y)$[DU]=U;else delete $[DU];return Q}function q91($){return yI0.call($)}function V91($){if(!L91($))return!1;var Y=X91($);return Y==U91||Y==z91||Y==Y91||Y==J91}function L91($){var Y=typeof $;return $!=null&&(Y=="object"||Y=="function")}kI0.exports=V91});var wK0=E((iN,dJ)=>{var F91=200,vf="__lodash_hash_undefined__",rN=1,oI0=2,rI0=9007199254740991,nN="[object Arguments]",Pf="[object Array]",w91="[object AsyncFunction]",sI0="[object Boolean]",aI0="[object Date]",tI0="[object Error]",eI0="[object Function]",O91="[object GeneratorFunction]",cN="[object Map]",$K0="[object Number]",M91="[object Null]",cJ="[object Object]",xI0="[object Promise]",N91="[object Proxy]",YK0="[object RegExp]",dN="[object Set]",UK0="[object String]",D91="[object Symbol]",B91="[object Undefined]",Tf="[object WeakMap]",zK0="[object ArrayBuffer]",pN="[object DataView]",A91="[object Float32Array]",P91="[object Float64Array]",T91="[object Int8Array]",j91="[object Int16Array]",E91="[object Int32Array]",C91="[object Uint8Array]",R91="[object Uint8ClampedArray]",_91="[object Uint16Array]",v91="[object Uint32Array]",h91=/[\\^$.*+?()[\]{}|]/g,S91=/^\[object .+?Constructor\]$/,g91=/^(?:0|[1-9]\d*)$/,j4={};j4[A91]=j4[P91]=j4[T91]=j4[j91]=j4[E91]=j4[C91]=j4[R91]=j4[_91]=j4[v91]=!0;j4[nN]=j4[Pf]=j4[zK0]=j4[sI0]=j4[pN]=j4[aI0]=j4[tI0]=j4[eI0]=j4[cN]=j4[$K0]=j4[cJ]=j4[YK0]=j4[dN]=j4[UK0]=j4[Tf]=!1;var QK0=typeof global=="object"&&global&&global.Object===Object&&global,y91=typeof self=="object"&&self&&self.Object===Object&&self,w3=QK0||y91||Function("return this")(),JK0=typeof iN=="object"&&iN&&!iN.nodeType&&iN,fI0=JK0&&typeof dJ=="object"&&dJ&&!dJ.nodeType&&dJ,IK0=fI0&&fI0.exports===JK0,Df=IK0&&QK0.process,uI0=function(){try{return Df&&Df.binding&&Df.binding("util")}catch($){}}(),bI0=uI0&&uI0.isTypedArray;function k91($,Y){var U=-1,z=$==null?0:$.length,Q=0,J=[];while(++U<z){var I=$[U];if(Y(I,U,$))J[Q++]=I}return J}function x91($,Y){var U=-1,z=Y.length,Q=$.length;while(++U<z)$[Q+U]=Y[U];return $}function f91($,Y){var U=-1,z=$==null?0:$.length;while(++U<z)if(Y($[U],U,$))return!0;return!1}function u91($,Y){var U=-1,z=Array($);while(++U<$)z[U]=Y(U);return z}function b91($){return function(Y){return $(Y)}}function i91($,Y){return $.has(Y)}function n91($,Y){return $==null?void 0:$[Y]}function c91($){var Y=-1,U=Array($.size);return $.forEach(function(z,Q){U[++Y]=[Q,z]}),U}function d91($,Y){return function(U){return $(Y(U))}}function p91($){var Y=-1,U=Array($.size);return $.forEach(function(z){U[++Y]=z}),U}var m91=Array.prototype,l91=Function.prototype,sN=Object.prototype,Bf=w3["__core-js_shared__"],KK0=l91.toString,Z9=sN.hasOwnProperty,iI0=function(){var $=/[^.]+$/.exec(Bf&&Bf.keys&&Bf.keys.IE_PROTO||"");return $?"Symbol(src)_1."+$:""}(),GK0=sN.toString,o91=RegExp("^"+KK0.call(Z9).replace(h91,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),nI0=IK0?w3.Buffer:void 0,mN=w3.Symbol,cI0=w3.Uint8Array,HK0=sN.propertyIsEnumerable,r91=m91.splice,BU=mN?mN.toStringTag:void 0,dI0=Object.getOwnPropertySymbols,s91=nI0?nI0.isBuffer:void 0,a91=d91(Object.keys,Object),jf=pJ(w3,"DataView"),dW=pJ(w3,"Map"),Ef=pJ(w3,"Promise"),Cf=pJ(w3,"Set"),Rf=pJ(w3,"WeakMap"),pW=pJ(Object,"create"),t91=TU(jf),e91=TU(dW),$31=TU(Ef),Y31=TU(Cf),U31=TU(Rf),pI0=mN?mN.prototype:void 0,Af=pI0?pI0.valueOf:void 0;function AU($){var Y=-1,U=$==null?0:$.length;this.clear();while(++Y<U){var z=$[Y];this.set(z[0],z[1])}}function z31(){this.__data__=pW?pW(null):{},this.size=0}function Q31($){var Y=this.has($)&&delete this.__data__[$];return this.size-=Y?1:0,Y}function J31($){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(X71.default(U))return U;if(Array.isArray(U))return U[$];if(this._headers!==null)return U[this._headers[$]];return!1}format($,Y,U){let z=`${Z71.default($)?"":$}`.replace(/\0/g,""),{formatterOptions:Q}=this;if(Q.quote!==""){if(z.indexOf(Q.quote)!==-1)return this.quoteField(z.replace(this.REPLACE_REGEXP,Q.escapedQuote))}if(z.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(Y,U))return this.quoteField(z);return z}quoteField($){let{quote:Y}=this.formatterOptions;return`${Y}${$}${Y}`}}mJ.FieldFormatter=jK0});var kf=E((EK0)=>{Object.defineProperty(EK0,"__esModule",{value:!0});EK0.isSyncTransform=void 0;EK0.isSyncTransform=($)=>$.length===1});var _K0=E((lJ)=>{var RK0=lJ&&lJ.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(lJ,"__esModule",{value:!0});lJ.RowFormatter=void 0;var V71=RK0(bN()),L71=RK0(wK0()),F71=yf(),w71=kf();class jU{constructor($){if(this.rowCount=0,this.formatterOptions=$,this.fieldFormatter=new F71.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(jU.isRowHashArray($))return $.map((Y)=>Y[0]);if(Array.isArray($))return $;return Object.keys($)}static createTransform($){if(w71.isSyncTransform($))return(Y,U)=>{let z=null;try{z=$(Y)}catch(Q){return U(Q)}return U(null,z)};return(Y,U)=>{$(Y,U)}}set rowTransform($){if(!V71.default($))throw TypeError("The transform should be a function");this._rowTransform=jU.createTransform($)}format($,Y){this.callTransformer($,(U,z)=>{if(U)return Y(U);if(!$)return Y(null);let Q=[];if(z){let{shouldFormatColumns:J,headers:I}=this.checkHeaders(z);if(this.shouldWriteHeaders&&I&&!this.hasWrittenHeaders)Q.push(this.formatColumns(I,!0)),this.hasWrittenHeaders=!0;if(J){let K=this.gatherColumns(z);Q.push(this.formatColumns(K,!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=jU.gatherHeaders($);if(this.headers=Y,this.fieldFormatter.headers=Y,!this.shouldWriteHeaders)return{shouldFormatColumns:!0,headers:null};return{shouldFormatColumns:!L71.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(jU.isRowHashArray($))return this.headers.map((Y,U)=>{let z=$[U];if(z)return z[1];return""});if(jU.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:z}=this;if(this.rowCount+=1,z)return[this.formatterOptions.rowDelimiter,U].join("");return U}}lJ.RowFormatter=jU});var vK0=E((eN)=>{Object.defineProperty(eN,"__esModule",{value:!0});eN.FieldFormatter=eN.RowFormatter=void 0;var O71=_K0();Object.defineProperty(eN,"RowFormatter",{enumerable:!0,get:function(){return O71.RowFormatter}});var M71=yf();Object.defineProperty(eN,"FieldFormatter",{enumerable:!0,get:function(){return M71.FieldFormatter}})});var xf=E((SK0)=>{Object.defineProperty(SK0,"__esModule",{value:!0});SK0.CsvFormatterStream=void 0;var D71=I0("stream"),B71=vK0();class hK0 extends D71.Transform{constructor($){super({writableObjectMode:$.objectMode});this.hasWrittenBOM=!1,this.formatterOptions=$,this.rowFormatter=new B71.RowFormatter($),this.hasWrittenBOM=!$.writeBOM}transform($){return this.rowFormatter.rowTransform=$,this}_transform($,Y,U){let z=!1;try{if(!this.hasWrittenBOM)this.push(this.formatterOptions.BOM),this.hasWrittenBOM=!0;this.rowFormatter.format($,(Q,J)=>{if(Q)return z=!0,U(Q);if(J)J.forEach((I)=>{this.push(Buffer.from(I,"utf8"))});return z=!0,U()})}catch(Q){if(z)throw Q;U(Q)}}_flush($){this.rowFormatter.finish((Y,U)=>{if(Y)return $(Y);if(U)U.forEach((z)=>{this.push(Buffer.from(z,"utf8"))});return $()})}}SK0.CsvFormatterStream=hK0});var kK0=E((t1)=>{var yK0=t1&&t1.__createBinding||(Object.create?function($,Y,U,z){if(z===void 0)z=U;Object.defineProperty($,z,{enumerable:!0,get:function(){return Y[U]}})}:function($,Y,U,z){if(z===void 0)z=U;$[z]=Y[U]}),A71=t1&&t1.__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}}gG0.Token=SG0});var Ju=E((fG0)=>{Object.defineProperty(fG0,"__esModule",{value:!0});fG0.Scanner=void 0;var kG0=Z2(),MU1=/((?:\r\n)|\n|\r)/;class xG0{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 z=U[1],Q=this.cursor+(U.index||0);return new kG0.Token({token:z,startCursor:Q,endCursor:Q+z.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:Y}=this;if(Y<=$)return null;return new kG0.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=MU1.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}}fG0.Scanner=xG0});var DD=E((iG0)=>{Object.defineProperty(iG0,"__esModule",{value:!0});iG0.ColumnFormatter=void 0;class bG0{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}}iG0.ColumnFormatter=bG0});var Iu=E((dG0)=>{Object.defineProperty(dG0,"__esModule",{value:!0});dG0.NonQuotedColumnParser=void 0;var NU1=DD(),cG0=Z2();class pG0{constructor($){this.parserOptions=$,this.columnFormatter=new NU1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:Y}=this,U=[],z=$.nextCharacterToken;for(;z;z=$.nextCharacterToken){if(cG0.Token.isTokenDelimiter(z,Y)||cG0.Token.isTokenRowDelimiter(z))break;U.push(z.token),$.advancePastToken(z)}return this.columnFormatter.format(U.join(""))}}dG0.NonQuotedColumnParser=pG0});var Ku=E((oG0)=>{Object.defineProperty(oG0,"__esModule",{value:!0});oG0.QuotedColumnParser=void 0;var DU1=DD(),QI=Z2();class lG0{constructor($){this.parserOptions=$,this.columnFormatter=new DU1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let Y=$.cursor,{foundClosingQuote:U,col:z}=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($),z}gatherDataBetweenQuotes($){let{parserOptions:Y}=this,U=!1,z=!1,Q=[],J=$.nextCharacterToken;for(;!z&&J!==null;J=$.nextCharacterToken){let I=QI.Token.isTokenQuote(J,Y);if(!U&&I)U=!0;else if(U)if(QI.Token.isTokenEscapeCharacter(J,Y)){$.advancePastToken(J);let K=$.nextCharacterToken;if(K!==null&&(QI.Token.isTokenQuote(K,Y)||QI.Token.isTokenEscapeCharacter(K,Y)))Q.push(K.token),J=K;else if(I)z=!0;else Q.push(J.token)}else if(I)z=!0;else Q.push(J.token);$.advancePastToken(J)}return{col:this.columnFormatter.format(Q.join("")),foundClosingQuote:z}}checkForMalformedColumn($){let{parserOptions:Y}=this,{nextNonSpaceToken:U}=$;if(U){let z=QI.Token.isTokenDelimiter(U,Y),Q=QI.Token.isTokenRowDelimiter(U);if(!(z||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()}}oG0.QuotedColumnParser=lG0});var eG0=E((aG0)=>{Object.defineProperty(aG0,"__esModule",{value:!0});aG0.ColumnParser=void 0;var AU1=Iu(),BU1=Ku(),PU1=Z2();class sG0{constructor($){this.parserOptions=$,this.quotedColumnParser=new BU1.QuotedColumnParser($),this.nonQuotedColumnParser=new AU1.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:Y}=$;if(Y!==null&&PU1.Token.isTokenQuote(Y,this.parserOptions))return $.advanceToToken(Y),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}aG0.ColumnParser=sG0});var Gu=E((JI)=>{Object.defineProperty(JI,"__esModule",{value:!0});JI.ColumnFormatter=JI.QuotedColumnParser=JI.NonQuotedColumnParser=JI.ColumnParser=void 0;var TU1=eG0();Object.defineProperty(JI,"ColumnParser",{enumerable:!0,get:function(){return TU1.ColumnParser}});var jU1=Iu();Object.defineProperty(JI,"NonQuotedColumnParser",{enumerable:!0,get:function(){return jU1.NonQuotedColumnParser}});var EU1=Ku();Object.defineProperty(JI,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,T,T,q,z);let A=q.type==="*"?Bu:q.type==="?"?ju:"\\"+q.type;Q=!0,z=z.slice(0,q.reStart)+A+"\\("+T}if(N(),J)z+="\\\\";let D=wz1[z.charAt(0)];for(let T=K.length-1;T>-1;T--){let A=K[T],j=z.slice(0,A.reStart),C=z.slice(A.reStart,A.reEnd-8),b=z.slice(A.reEnd),k=z.slice(A.reEnd-8,A.reEnd)+b,S=j.split(")").length,i=j.split("(").length-S,n=b;for(let x=0;x<i;x++)n=n.replace(/\)[+*?]?/,"");b=n;let z0=b===""&&Y!==Pu?"(?:$|\\/)":"";z=j+C+b+z0+k}if(z!==""&&Q)z="(?=.)"+z;if(D)z=O()+z;if(Y===Pu)return[z,Q];if(U.nocase&&!Q)Q=$.toUpperCase()!==$.toLowerCase();if(!Q)return Nz1($);let P=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+z+"$",P),{_glob:$,_src:z})}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?Bu:Y.dot?Fz1:Oz1,z=Y.nocase?"i":"",Q=$.map((J)=>{return J=J.map((I)=>typeof I==="string"?Az1(I):I===v8?v8:I._src).reduce((I,K)=>{if(!(I[I.length-1]===v8&&K===v8))I.push(K);return I},[]),J.forEach((I,K)=>{if(I!==v8||J[K-1]===v8)return;if(K===0)if(J.length>1)J[K+1]="(?:\\/|"+U+"\\/)?"+J[K+1];else J[K]=U;else if(K===J.length-1)J[K-1]+="(?:\\/|"+U+")?";else J[K-1]+="(?:\\/|\\/"+U+"\\/)"+J[K+1],J[K+1]=v8}),J.filter((I)=>I!==v8).join("/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,z)}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(Tu.sep!=="/")$=$.split(Tu.sep).join("/");$=$.split(mH0),this.debug(this.pattern,"split",$);let z=this.set;this.debug(this.pattern,"set",z);let Q;for(let J=$.length-1;J>=0;J--)if(Q=$[J],Q)break;for(let J=0;J<z.length;J++){let I=z[J],K=$;if(U.matchBase&&I.length===1)K=[Q];if(this.matchOne(K,I,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=eW});var $W0=E((Cs1,eH0)=>{eH0.exports=tH0;var Ru=I0("fs"),{EventEmitter:Pz1}=I0("events"),{Minimatch:Cu}=rH0(),{resolve:Tz1}=I0("path");function jz1($,Y){return new Promise((U,z)=>{Ru.readdir($,{withFileTypes:!0},(Q,J)=>{if(Q)switch(Q.code){case"ENOTDIR":if(Y)z(Q);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:z(Q);break}else U(J)})})}function sH0($,Y){return new Promise((U,z)=>{(Y?Ru.stat:Ru.lstat)($,(J,I)=>{if(J)switch(J.code){case"ENOENT":if(Y)U(sH0($,!1));else U(null);break;default:U(null);break}else U(I)})})}async function*aH0($,Y,U,z,Q,J){let I=await jz1(Y+$,J);for(let K of I){let G=K.name;if(G===void 0)G=K,z=!0;let H=$+"/"+G,W=H.slice(1),X=Y+"/"+W,Z=null;if(z||U)Z=await sH0(X,U);if(!Z&&K.name!==void 0)Z=K;if(Z===null)Z={isDirectory:()=>!1};if(Z.isDirectory()){if(!Q(W))yield{relative:W,absolute:X,stats:Z},yield*aH0(H,Y,U,z,Q,!1)}else yield{relative:W,absolute:X,stats:Z}}}async function*Ez1($,Y,U,z){yield*aH0("",$,Y,U,z,!0)}function Cz1($){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 _u extends Pz1{constructor($,Y,U){super();if(typeof Y==="function")U=Y,Y=null;if(this.options=Cz1(Y||{}),this.matchers=[],this.options.pattern){let z=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=z.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 z=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=z.map((Q)=>new Cu(Q,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let z=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=z.map((Q)=>new Cu(Q,{dot:!0}))}if(this.iterator=Ez1(Tz1($||"."),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",(z)=>this._matches.push(this.options.absolute?z.absolute:z.relative)),this.on("error",(z)=>U(z)),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((z)=>z.match(U)))&&!this.ignoreMatchers.some((z)=>z.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,z=$.value.absolute;if(this.options.mark&&Y)U+="/",z+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:z,stat:$.value.stats});else this.emit("match",{relative:U Line truncated
`,o);o=O0===-1?f.length:O0}else if(K0!==-1&&f[o]==="/"&&f[o+1]==="*"){let O0=f.indexOf("*/",o);if(O0!==-1)o=O0+2,K0=f.indexOf("*/",o);else c+=f[o],o++}else c+=f[o],o++;return c}function n0(f){let c=i0(f.toString()),o=c.match(s);if(!o)o=c.match(H0);if(!o)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}}xG0.Token=kG0});var Gu=E((iG0)=>{Object.defineProperty(iG0,"__esModule",{value:!0});iG0.Scanner=void 0;var uG0=Z2(),vU1=/((?:\r\n)|\n|\r)/;class bG0{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 z=U[1],Q=this.cursor+(U.index||0);return new uG0.Token({token:z,startCursor:Q,endCursor:Q+z.length-1})}get nextCharacterToken(){let{cursor:$,lineLength:Y}=this;if(Y<=$)return null;return new uG0.Token({token:this.line[$],startCursor:$,endCursor:$})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let $=vU1.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}}iG0.Scanner=bG0});var BD=E((dG0)=>{Object.defineProperty(dG0,"__esModule",{value:!0});dG0.ColumnFormatter=void 0;class cG0{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}}dG0.ColumnFormatter=cG0});var Hu=E((oG0)=>{Object.defineProperty(oG0,"__esModule",{value:!0});oG0.NonQuotedColumnParser=void 0;var hU1=BD(),mG0=Z2();class lG0{constructor($){this.parserOptions=$,this.columnFormatter=new hU1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let{parserOptions:Y}=this,U=[],z=$.nextCharacterToken;for(;z;z=$.nextCharacterToken){if(mG0.Token.isTokenDelimiter(z,Y)||mG0.Token.isTokenRowDelimiter(z))break;U.push(z.token),$.advancePastToken(z)}return this.columnFormatter.format(U.join(""))}}oG0.NonQuotedColumnParser=lG0});var Wu=E((aG0)=>{Object.defineProperty(aG0,"__esModule",{value:!0});aG0.QuotedColumnParser=void 0;var SU1=BD(),QI=Z2();class sG0{constructor($){this.parserOptions=$,this.columnFormatter=new SU1.ColumnFormatter($)}parse($){if(!$.hasMoreCharacters)return null;let Y=$.cursor,{foundClosingQuote:U,col:z}=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($),z}gatherDataBetweenQuotes($){let{parserOptions:Y}=this,U=!1,z=!1,Q=[],J=$.nextCharacterToken;for(;!z&&J!==null;J=$.nextCharacterToken){let I=QI.Token.isTokenQuote(J,Y);if(!U&&I)U=!0;else if(U)if(QI.Token.isTokenEscapeCharacter(J,Y)){$.advancePastToken(J);let K=$.nextCharacterToken;if(K!==null&&(QI.Token.isTokenQuote(K,Y)||QI.Token.isTokenEscapeCharacter(K,Y)))Q.push(K.token),J=K;else if(I)z=!0;else Q.push(J.token)}else if(I)z=!0;else Q.push(J.token);$.advancePastToken(J)}return{col:this.columnFormatter.format(Q.join("")),foundClosingQuote:z}}checkForMalformedColumn($){let{parserOptions:Y}=this,{nextNonSpaceToken:U}=$;if(U){let z=QI.Token.isTokenDelimiter(U,Y),Q=QI.Token.isTokenRowDelimiter(U);if(!(z||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()}}aG0.QuotedColumnParser=sG0});var UH0=E(($H0)=>{Object.defineProperty($H0,"__esModule",{value:!0});$H0.ColumnParser=void 0;var gU1=Hu(),yU1=Wu(),kU1=Z2();class eG0{constructor($){this.parserOptions=$,this.quotedColumnParser=new yU1.QuotedColumnParser($),this.nonQuotedColumnParser=new gU1.NonQuotedColumnParser($)}parse($){let{nextNonSpaceToken:Y}=$;if(Y!==null&&kU1.Token.isTokenQuote(Y,this.parserOptions))return $.advanceToToken(Y),this.quotedColumnParser.parse($);return this.nonQuotedColumnParser.parse($)}}$H0.ColumnParser=eG0});var Xu=E((JI)=>{Object.defineProperty(JI,"__esModule",{value:!0});JI.ColumnFormatter=JI.QuotedColumnParser=JI.NonQuotedColumnParser=JI.ColumnParser=void 0;var xU1=UH0();Object.defineProperty(JI,"ColumnParser",{enumerable:!0,get:function(){return xU1.ColumnParser}});var fU1=Hu();Object.defineProperty(JI,"NonQuotedColumnParser",{enumerable:!0,get:function(){return fU1.NonQuotedColumnParser}});var uU1=Wu();Object.defineProperty(JI,"QuotedColumnParser",{enumerable:!0,get:function(){re Line truncated
%s`,T,T,q,z);let B=q.type==="*"?ju:q.type==="?"?Ru:"\\"+q.type;Q=!0,z=z.slice(0,q.reStart)+B+"\\("+T}if(M(),J)z+="\\\\";let D=_z1[z.charAt(0)];for(let T=K.length-1;T>-1;T--){let B=K[T],j=z.slice(0,B.reStart),C=z.slice(B.reStart,B.reEnd-8),b=z.slice(B.reEnd),k=z.slice(B.reEnd-8,B.reEnd)+b,S=j.split(")").length,i=j.split("(").length-S,n=b;for(let x=0;x<i;x++)n=n.replace(/\)[+*?]?/,"");b=n;let z0=b===""&&Y!==Eu?"(?:$|\\/)":"";z=j+C+b+z0+k}if(z!==""&&Q)z="(?=.)"+z;if(D)z=w()+z;if(Y===Eu)return[z,Q];if(U.nocase&&!Q)Q=$.toUpperCase()!==$.toLowerCase();if(!Q)return hz1($);let P=U.nocase?"i":"";try{return Object.assign(new RegExp("^"+z+"$",P),{_glob:$,_src:z})}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?ju:Y.dot?Cz1:Rz1,z=Y.nocase?"i":"",Q=$.map((J)=>{return J=J.map((I)=>typeof I==="string"?gz1(I):I===S8?S8:I._src).reduce((I,K)=>{if(!(I[I.length-1]===S8&&K===S8))I.push(K);return I},[]),J.forEach((I,K)=>{if(I!==S8||J[K-1]===S8)return;if(K===0)if(J.length>1)J[K+1]="(?:\\/|"+U+"\\/)?"+J[K+1];else J[K]=U;else if(K===J.length-1)J[K-1]+="(?:\\/|"+U+")?";else J[K-1]+="(?:\\/|\\/"+U+"\\/)"+J[K+1],J[K+1]=S8}),J.filter((I)=>I!==S8).join("/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,z)}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(Cu.sep!=="/")$=$.split(Cu.sep).join("/");$=$.split(rH0),this.debug(this.pattern,"split",$);let z=this.set;this.debug(this.pattern,"set",z);let Q;for(let J=$.length-1;J>=0;J--)if(Q=$[J],Q)break;for(let J=0;J<z.length;J++){let I=z[J],K=$;if(U.matchBase&&I.length===1)K=[Q];if(this.matchOne(K,I,Y)){if(U.flipNegate)return!0;return!this.negate}}if(U.flipNegate)return!1;return this.negate}static defaults($){return X$.defaults($).Minimatch}}X$.Minimatch=eW});var zW0=E((fs1,UW0)=>{UW0.exports=YW0;var hu=I0("fs"),{EventEmitter:kz1}=I0("events"),{Minimatch:vu}=tH0(),{resolve:xz1}=I0("path");function fz1($,Y){return new Promise((U,z)=>{hu.readdir($,{withFileTypes:!0},(Q,J)=>{if(Q)switch(Q.code){case"ENOTDIR":if(Y)z(Q);else U([]);break;case"ENOTSUP":case"ENOENT":case"ENAMETOOLONG":case"UNKNOWN":U([]);break;case"ELOOP":default:z(Q);break}else U(J)})})}function eH0($,Y){return new Promise((U,z)=>{(Y?hu.stat:hu.lstat)($,(J,I)=>{if(J)switch(J.code){case"ENOENT":if(Y)U(eH0($,!1));else U(null);break;default:U(null);break}else U(I)})})}async function*$W0($,Y,U,z,Q,J){let I=await fz1(Y+$,J);for(let K of I){let G=K.name;if(G===void 0)G=K,z=!0;let H=$+"/"+G,W=H.slice(1),X=Y+"/"+W,Z=null;if(z||U)Z=await eH0(X,U);if(!Z&&K.name!==void 0)Z=K;if(Z===null)Z={isDirectory:()=>!1};if(Z.isDirectory()){if(!Q(W))yield{relative:W,absolute:X,stats:Z},yield*$W0(H,Y,U,z,Q,!1)}else yield{relative:W,absolute:X,stats:Z}}}async function*uz1($,Y,U,z){yield*$W0("",$,Y,U,z,!0)}function bz1($){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 Su extends kz1{constructor($,Y,U){super();if(typeof Y==="function")U=Y,Y=null;if(this.options=bz1(Y||{}),this.matchers=[],this.options.pattern){let z=Array.isArray(this.options.pattern)?this.options.pattern:[this.options.pattern];this.matchers=z.map((Q)=>new vu(Q,{dot:this.options.dot,noglobstar:this.options.noglobstar,matchBase:this.options.matchBase,nocase:this.options.nocase}))}if(this.ignoreMatchers=[],this.options.ignore){let z=Array.isArray(this.options.ignore)?this.options.ignore:[this.options.ignore];this.ignoreMatchers=z.map((Q)=>new vu(Q,{dot:!0}))}if(this.skipMatchers=[],this.options.skip){let z=Array.isArray(this.options.skip)?this.options.skip:[this.options.skip];this.skipMatchers=z.map((Q)=>new vu(Q,{dot:!0}))}if(this.iterator=uz1(xz1($||"."),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",(z)=>this._matches.push(this.options.absolute?z.absolute:z.relative)),this.on("error",(z)=>U(z)),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((z)=>z.match(U)))&&!this.ignoreMatchers.some((z)=>z.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,z=$.value.absolute;if(this.options.mark&&Y)U+="/",z+="/";if(this.options.stat)this.emit("match",{relative:U,absolute:z,stat:$.value.stats});else this.emit("match",{relative:U Line truncated
`,o);o=w0===-1?f.length:w0}else if(K0!==-1&&f[o]==="/"&&f[o+1]==="*"){let w0=f.indexOf("*/",o);if(w0!==-1)o=w0+2,K0=f.indexOf("*/",o);else c+=f[o],o++}else c+=f[o],o++;return c}function n0(f){let c=i0(f.toString()),o=c.match(a);if(!o)o=c.match(X0);if(!o)throw Error(`could not parse args in autoInject
Source:
`+c);let[,K0]=o;return K0.replace(/\s/g,"").split(F0).map((O0)=>O0.replace(b0,"").trim())}function w1(f,c){var o={};return Object.keys(f).forEach((K0)=>{var O0=f[K0],D0,P0=q(O0),T0=!P0&&O0.length===1||P0&&O0.length===0;if(Array.isArray(O0))D0=[...O0],O0=D0.pop(),o[K0]=D0.concat(D0.length>0?h0:O0);else if(T0)o[K0]=O0;else{if(D0=n0(O0),O0.length===0&&!P0&&D0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!P0)D0.pop();o[K0]=D0.concat(h0)}function h0(U1,x1){var l1=D0.map((i1)=>U1[i1]);l1.push(x1),w(O0)(...l1)}}),e0(o,c)}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,c){if(c.prev=f,c.next=f.next,f.next)f.next.prev=c;else this.tail=c;f.next=c,this.length+=1}insertBefore(f,c){if(c.prev=f.prev,c.next=f,f.prev)f.prev.next=c;else this.head=c;f.prev=c,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 c=this.head;while(c){var{next:o}=c;if(f(c))this.removeLink(c);c=o}return this}}function u1(f,c){f.length=1,f.head=f.tail=c}function b1(f,c,o){if(c==null)c=1;else if(c===0)throw RangeError("Concurrency must not be zero");var K0=w(f),O0=0,D0=[];let P0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function T0(G1,$1){P0[G1].push($1)}function h0(G1,$1){let H1=(...n1)=>{U1(G1,H1),$1(...n1)};P0[G1].push(H1)}function U1(G1,$1){if(!G1)return Object.keys(P0).forEach((H1)=>P0[H1]=[]);if(!$1)return P0[G1]=[];P0[G1]=P0[G1].filter((H1)=>H1!==$1)}function x1(G1,...$1){P0[G1].forEach((H1)=>H1(...$1))}var l1=!1;function i1(G1,$1,H1,n1){if(n1!=null&&typeof n1!=="function")throw Error("task callback must be a function");o1.started=!0;var g4,S6;function D$(PY,...rK){if(PY)return H1?S6(PY):g4();if(rK.length<=1)return g4(rK[0]);g4(rK)}var pz=o1._createTaskItem(G1,H1?D$:n1||D$);if($1)o1._tasks.unshift(pz);else o1._tasks.push(pz);if(!l1)l1=!0,H(()=>{l1=!1,o1.process()});if(H1||!n1)return new Promise((PY,rK)=>{g4=PY,S6=rK})}function N$(G1){return function($1,...H1){O0-=1;for(var n1=0,g4=G1.length;n1<g4;n1++){var S6=G1[n1],D$=D0.indexOf(S6);if(D$===0)D0.shift();else if(D$>0)D0.splice(D$,1);if(S6.callback($1,...H1),$1!=null)x1("error",$1,S6.data)}if(O0<=o1.concurrency-o1.buffer)x1("unsaturated");if(o1.idle())x1("drain");o1.process()}}function cz(G1){if(G1.length===0&&o1.idle())return H(()=>x1("drain")),!0;return!1}let BY=(G1)=>($1)=>{if(!$1)return new Promise((H1,n1)=>{h0(G1,(g4,S6)=>{if(g4)return n1(g4);H1(S6)})});U1(G1),T0(G1,$1)};var oK=!1,o1={_tasks:new k1,_createTaskItem(G1,$1){return{data:G1,callback:$1}},*[Symbol.iterator](){yield*o1._tasks[Symbol.iterator]()},concurrency:c,payload:o,buffer:c/4,started:!1,paused:!1,push(G1,$1){if(Array.isArray(G1)){if(cz(G1))return;return G1.map((H1)=>i1(H1,!1,!1,$1))}return i1(G1,!1,!1,$1)},pushAsync(G1,$1){if(Array.isArray(G1)){if(cz(G1))return;return G1.map((H1)=>i1(H1,!1,!0,$1))}return i1(G1,!1,!0,$1)},kill(){U1(),o1._tasks.empty()},unshift(G1,$1){if(Array.isArray(G1)){if(cz(G1))return;return G1.map((H1)=>i1(H1,!0,!1,$1))}return i1(G1,!0,!1,$1)},unshiftAsync(G1,$1){if(Array.isArray(G1)){if(cz(G1))return;return G1.map((H1)=>i1(H1,!0,!0,$1))}return i1(G1,!0,!0,$1)},remove(G1){o1._tasks.remove(G1)},process(){if(oK)return;oK=!0;while(!o1.paused&&O0<o1.concurrency&&o1._tasks.length){var G1=[],$1=[],H1=o1._tasks.length;if(o1.payload)H1=Math.min(H1,o1.payload);for(var n1=0;n1<H1;n1++){var g4=o1._tasks.shift();G1.push(g4),D0.push(g4),$1.push(g4.data)}if(O0+=1,o1._tasks.length===0)x1("empty");if(O0===o1.concurrency)x1("saturated");var S6=S(N$(G1));K0($1,S6)}oK=!1},length(){return o1._tasks.length},running(){return O0},workersList(){return D0},idle(){return o1._tasks.length+O0===0},pause(){o1.paused=!0},resume(){if(o1.paused===!1)return;o1.paused=!1,H(o1.process)}};return Object.defineProperties(o1,{saturated:{writable:!1,value:BY("saturated")},unsaturated:{writable:!1,value:BY("unsaturated")},empty:{writable:!1,value:BY("empty")},drain:{writable:!1,value:BY("drain")},error:{writable:!1,value:BY("error")}}),o1}function A0(f,c){return b1(f,1,c)}function Q0(f,c,o){return b1(f,c,o)}function B(f,c,o,K0){K0=T(K0);var O0=w(o);return $0(f,(D0,P0,T0)=>{O0(c,D0,(h0,U1)=>{c=U1,T0(h0)})},(D0)=>K0(D0,c))}var v=O(B,4);function u(...f){var c=f.map(w);return function(...o){var K0=this,O0=o[o.length-1];if(typeof O0=="function")o.pop();else O0=f0();return v(c,o,(D0,P0,T0)=>{P0.apply(K0,D0.concat((h0,...U1)=>{T0(h0,U1)}))},(D0,P0)=>O0(D0,...P0)),O0[G0]}}function a(...f){return u(...f.reverse())}function Z0(f,c,o,K0){return N(n(c),f,o,K0)}var J Line truncated
GFS4: `),console.error($)};if(!d4[a6]){if(hu=global[a6]||[],WW0(d4,hu),d4.close=function($){function Y(U,z){return $.call(d4,U,function(Q){if(!Q)HW0();if(typeof z==="function")z.apply(this,arguments)})}return Object.defineProperty(Y,vD,{value:$}),Y}(d4.close),d4.closeSync=function($){function Y(U){$.apply(d4,arguments),HW0()}return Object.defineProperty(Y,vD,{value:$}),Y}(d4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){_U(d4[a6]),I0("assert").equal(d4[a6].length,0)})}var hu;if(!global[a6])WW0(global,d4[a6]);yu.exports=Su(xz1(d4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!d4.__patched)yu.exports=Su(d4),d4.__patched=!0;function Su($){yz1($),$.gracefulify=Su,$.createReadStream=P,$.createWriteStream=T;var Y=$.readFile;$.readFile=U;function U(C,b,k){if(typeof b==="function")k=b,b=null;return S(C,b,k);function S(i,n,z0,x){return Y(i,n,function(d){if(d&&(d.code==="EMFILE"||d.code==="ENFILE"))GI([S,[i,n,z0],d,x||Date.now(),Date.now()]);else if(typeof z0==="function")z0.apply(this,arguments)})}}var z=$.writeFile;$.writeFile=Q;function Q(C,b,k,S){if(typeof k==="function")S=k,k=null;return i(C,b,k,S);function i(n,z0,x,d,t){return z(n,z0,x,function(e){if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))GI([i,[n,z0,x,d],e,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}var J=$.appendFile;if(J)$.appendFile=I;function I(C,b,k,S){if(typeof k==="function")S=k,k=null;return i(C,b,k,S);function i(n,z0,x,d,t){return J(n,z0,x,function(e){if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))GI([i,[n,z0,x,d],e,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}var K=$.copyFile;if(K)$.copyFile=G;function G(C,b,k,S){if(typeof k==="function")S=k,k=0;return i(C,b,k,S);function i(n,z0,x,d,t){return K(n,z0,x,function(e){if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))GI([i,[n,z0,x,d],e,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}var H=$.readdir;$.readdir=X;var W=/^v[0-5]\./;function X(C,b,k){if(typeof b==="function")k=b,b=null;var S=W.test(process.version)?function(z0,x,d,t){return H(z0,i(z0,x,d,t))}:function(z0,x,d,t){return H(z0,x,i(z0,x,d,t))};return S(C,b,k);function i(n,z0,x,d){return function(t,e){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))GI([S,[n,z0,x],t,d||Date.now(),Date.now()]);else{if(e&&e.sort)e.sort();if(typeof x==="function")x.call(this,t,e)}}}}if(process.version.substr(0,4)==="v0.8"){var Z=kz1($);O=Z.ReadStream,N=Z.WriteStream}var q=$.ReadStream;if(q)O.prototype=Object.create(q.prototype),O.prototype.open=M;var V=$.WriteStream;if(V)N.prototype=Object.create(V.prototype),N.prototype.open=D;Object.defineProperty($,"ReadStream",{get:function(){return O},set:function(C){O=C},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return N},set:function(C){N=C},enumerable:!0,configurable:!0});var F=O;Object.defineProperty($,"FileReadStream",{get:function(){return F},set:function(C){F=C},enumerable:!0,configurable:!0});var w=N;Object.defineProperty($,"FileWriteStream",{get:function(){return w},set:function(C){w=C},enumerable:!0,configurable:!0});function O(C,b){if(this instanceof O)return q.apply(this,arguments),this;else return O.apply(Object.create(O.prototype),arguments)}function M(){var C=this;j(C.path,C.flags,C.mode,function(b,k){if(b){if(C.autoClose)C.destroy();C.emit("error",b)}else C.fd=k,C.emit("open",k),C.read()})}function N(C,b){if(this instanceof N)return V.apply(this,arguments),this;else return N.apply(Object.create(N.prototype),arguments)}function D(){var C=this;j(C.path,C.flags,C.mode,function(b,k){if(b)C.destroy(),C.emit("error",b);else C.fd=k,C.emit("open",k)})}function P(C,b){return new $.ReadStream(C,b)}function T(C,b){return new $.WriteStream(C,b)}var A=$.open;$.open=j;function j(C,b,k,S){if(typeof k==="function")S=k,k=null;return i(C,b,k,S);function i(n,z0,x,d,t){return A(n,z0,x,function(e,g){if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))GI([i,[n,z0,x,d],e,t||Date.now(),Date.now()]);else if(typeof d==="function")d.apply(this,arguments)})}}return $}function GI($){_U("ENQUEUE",$[0].name,$[1]),d4[a6].push($),gu()}var _D;function HW0(){var $=Date.now();for(var Y=0;Y<d4[a6].length;++Y)if(d4[a6][Y].length>2)d4[a6][Y][3]=$,d4[a6][Y][4]=$;gu()}function gu(){if(clearTimeout(_D),_D=void 0,d4[a6].length===0)return;var $=d4[a6].shift(),Y=$[0],U=$[1],z=$[2],Q=$[3],J=$[4];if(Q===void 0)_U("RETRY",Y.name,U),Y.apply(null,U);else if(Date.now()-Q>=60000){_U("TIMEOUT",Y.name,U);var I=U.pop();if(typeof I==="function")I.call(null,z)}else{var K=Date.now()-J,G=Math.max(J-Q,1),H=Math.min(G*1.2,100);if(K>=H)_U("RETRY",Y.name,U),Y.apply(null,U.concat([Q]));else d4[a6].push($)}if(_D===void 0)_D=setTimeout(gu,0)}});var ZW0=E((Ss1,ku)=>{function uz1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var XW0=K6().Buffer,$X=I0("util");function bz1($,Y,U){$.copy(Y,U)}ku.exports=function(){function $(){uz1(this,$),this.head=null,this.tail=null,t Line truncated
`+c);let[,K0]=o;return K0.replace(/\s/g,"").split(F0).map((w0)=>w0.replace(b0,"").trim())}function O1(f,c){var o={};return Object.keys(f).forEach((K0)=>{var w0=f[K0],D0,P0=q(w0),T0=!P0&&w0.length===1||P0&&w0.length===0;if(Array.isArray(w0))D0=[...w0],w0=D0.pop(),o[K0]=D0.concat(D0.length>0?h0:w0);else if(T0)o[K0]=w0;else{if(D0=n0(w0),w0.length===0&&!P0&&D0.length===0)throw Error("autoInject task functions require explicit parameters.");if(!P0)D0.pop();o[K0]=D0.concat(h0)}function h0(Y1,x1){var o1=D0.map((i1)=>Y1[i1]);o1.push(x1),O(w0)(...o1)}}),U1(o,c)}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,c){if(c.prev=f,c.next=f.next,f.next)f.next.prev=c;else this.tail=c;f.next=c,this.length+=1}insertBefore(f,c){if(c.prev=f.prev,c.next=f,f.prev)f.prev.next=c;else this.head=c;f.prev=c,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 c=this.head;while(c){var{next:o}=c;if(f(c))this.removeLink(c);c=o}return this}}function u1(f,c){f.length=1,f.head=f.tail=c}function b1(f,c,o){if(c==null)c=1;else if(c===0)throw RangeError("Concurrency must not be zero");var K0=O(f),w0=0,D0=[];let P0={error:[],drain:[],saturated:[],unsaturated:[],empty:[]};function T0(G1,e0){P0[G1].push(e0)}function h0(G1,e0){let H1=(...n1)=>{Y1(G1,H1),e0(...n1)};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,n1){if(n1!=null&&typeof n1!=="function")throw Error("task callback must be a function");r1.started=!0;var k4,S6;function B$(PY,...rK){if(PY)return H1?S6(PY):k4();if(rK.length<=1)return k4(rK[0]);k4(rK)}var dz=r1._createTaskItem(G1,H1?B$:n1||B$);if(e0)r1._tasks.unshift(dz);else r1._tasks.push(dz);if(!o1)o1=!0,H(()=>{o1=!1,r1.process()});if(H1||!n1)return new Promise((PY,rK)=>{k4=PY,S6=rK})}function D$(G1){return function(e0,...H1){w0-=1;for(var n1=0,k4=G1.length;n1<k4;n1++){var S6=G1[n1],B$=D0.indexOf(S6);if(B$===0)D0.shift();else if(B$>0)D0.splice(B$,1);if(S6.callback(e0,...H1),e0!=null)x1("error",e0,S6.data)}if(w0<=r1.concurrency-r1.buffer)x1("unsaturated");if(r1.idle())x1("drain");r1.process()}}function cz(G1){if(G1.length===0&&r1.idle())return H(()=>x1("drain")),!0;return!1}let AY=(G1)=>(e0)=>{if(!e0)return new Promise((H1,n1)=>{h0(G1,(k4,S6)=>{if(k4)return n1(k4);H1(S6)})});Y1(G1),T0(G1,e0)};var oK=!1,r1={_tasks:new k1,_createTaskItem(G1,e0){return{data:G1,callback:e0}},*[Symbol.iterator](){yield*r1._tasks[Symbol.iterator]()},concurrency:c,payload:o,buffer:c/4,started:!1,paused:!1,push(G1,e0){if(Array.isArray(G1)){if(cz(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(cz(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(cz(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(cz(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(oK)return;oK=!0;while(!r1.paused&&w0<r1.concurrency&&r1._tasks.length){var G1=[],e0=[],H1=r1._tasks.length;if(r1.payload)H1=Math.min(H1,r1.payload);for(var n1=0;n1<H1;n1++){var k4=r1._tasks.shift();G1.push(k4),D0.push(k4),e0.push(k4.data)}if(w0+=1,r1._tasks.length===0)x1("empty");if(w0===r1.concurrency)x1("saturated");var S6=S(D$(G1));K0(e0,S6)}oK=!1},length(){return r1._tasks.length},running(){return w0},workersList(){return D0},idle(){return r1._tasks.length+w0===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:AY("saturated")},unsaturated:{writable:!1,value:AY("unsaturated")},empty:{writable:!1,value:AY("empty")},drain:{writable:!1,value:AY("drain")},error:{writable:!1,value:AY("error")}}),r1}function B0(f,c){return b1(f,1,c)}function Q0(f,c,o){return b1(f,c,o)}function A(f,c,o,K0){K0=T(K0);var w0=O(o);return $0(f,(D0,P0,T0)=>{w0(c,D0,(h0,Y1)=>{c=Y1,T0(h0)})},(D0)=>K0(D0,c))}var v=w(A,4);function u(...f){var c=f.map(O);return function(...o){var K0=this,w0=o[o.length-1];if(typeof w0=="function")o.pop();else w0=u0();return v(c,o,(D0,P0,T0)=>{P0.apply(K0,D0.concat((h0,...Y1)=>{T0(h0,Y1)}))},(D0,P0)=>w0(D0,...P0)),w0[G0]}}function s(...f){return u(...f.reverse())}function Z0(f,c,o,K0){return M(n(c),f,o,K0)}var J Line truncated
GFS4: `),console.error($)};if(!m4[a6]){if(yu=global[a6]||[],qW0(m4,yu),m4.close=function($){function Y(U,z){return $.call(m4,U,function(Q){if(!Q)ZW0();if(typeof z==="function")z.apply(this,arguments)})}return Object.defineProperty(Y,hD,{value:$}),Y}(m4.close),m4.closeSync=function($){function Y(U){$.apply(m4,arguments),ZW0()}return Object.defineProperty(Y,hD,{value:$}),Y}(m4.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){_U(m4[a6]),I0("assert").equal(m4[a6].length,0)})}var yu;if(!global[a6])qW0(global,m4[a6]);fu.exports=ku(rz1(m4));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!m4.__patched)fu.exports=ku(m4),m4.__patched=!0;function ku($){lz1($),$.gracefulify=ku,$.createReadStream=P,$.createWriteStream=T;var Y=$.readFile;$.readFile=U;function U(C,b,k){if(typeof b==="function")k=b,b=null;return S(C,b,k);function S(i,n,z0,x){return Y(i,n,function(p){if(p&&(p.code==="EMFILE"||p.code==="ENFILE"))GI([S,[i,n,z0],p,x||Date.now(),Date.now()]);else if(typeof z0==="function")z0.apply(this,arguments)})}}var z=$.writeFile;$.writeFile=Q;function Q(C,b,k,S){if(typeof k==="function")S=k,k=null;return i(C,b,k,S);function i(n,z0,x,p,t){return z(n,z0,x,function(e){if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))GI([i,[n,z0,x,p],e,t||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}var J=$.appendFile;if(J)$.appendFile=I;function I(C,b,k,S){if(typeof k==="function")S=k,k=null;return i(C,b,k,S);function i(n,z0,x,p,t){return J(n,z0,x,function(e){if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))GI([i,[n,z0,x,p],e,t||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}var K=$.copyFile;if(K)$.copyFile=G;function G(C,b,k,S){if(typeof k==="function")S=k,k=0;return i(C,b,k,S);function i(n,z0,x,p,t){return K(n,z0,x,function(e){if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))GI([i,[n,z0,x,p],e,t||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,b,k){if(typeof b==="function")k=b,b=null;var S=W.test(process.version)?function(z0,x,p,t){return H(z0,i(z0,x,p,t))}:function(z0,x,p,t){return H(z0,x,i(z0,x,p,t))};return S(C,b,k);function i(n,z0,x,p){return function(t,e){if(t&&(t.code==="EMFILE"||t.code==="ENFILE"))GI([S,[n,z0,x],t,p||Date.now(),Date.now()]);else{if(e&&e.sort)e.sort();if(typeof x==="function")x.call(this,t,e)}}}}if(process.version.substr(0,4)==="v0.8"){var Z=oz1($);w=Z.ReadStream,M=Z.WriteStream}var q=$.ReadStream;if(q)w.prototype=Object.create(q.prototype),w.prototype.open=N;var V=$.WriteStream;if(V)M.prototype=Object.create(V.prototype),M.prototype.open=D;Object.defineProperty($,"ReadStream",{get:function(){return w},set:function(C){w=C},enumerable:!0,configurable:!0}),Object.defineProperty($,"WriteStream",{get:function(){return M},set:function(C){M=C},enumerable:!0,configurable:!0});var F=w;Object.defineProperty($,"FileReadStream",{get:function(){return F},set:function(C){F=C},enumerable:!0,configurable:!0});var O=M;Object.defineProperty($,"FileWriteStream",{get:function(){return O},set:function(C){O=C},enumerable:!0,configurable:!0});function w(C,b){if(this instanceof w)return q.apply(this,arguments),this;else return w.apply(Object.create(w.prototype),arguments)}function N(){var C=this;j(C.path,C.flags,C.mode,function(b,k){if(b){if(C.autoClose)C.destroy();C.emit("error",b)}else C.fd=k,C.emit("open",k),C.read()})}function M(C,b){if(this instanceof M)return V.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function D(){var C=this;j(C.path,C.flags,C.mode,function(b,k){if(b)C.destroy(),C.emit("error",b);else C.fd=k,C.emit("open",k)})}function P(C,b){return new $.ReadStream(C,b)}function T(C,b){return new $.WriteStream(C,b)}var B=$.open;$.open=j;function j(C,b,k,S){if(typeof k==="function")S=k,k=null;return i(C,b,k,S);function i(n,z0,x,p,t){return B(n,z0,x,function(e,g){if(e&&(e.code==="EMFILE"||e.code==="ENFILE"))GI([i,[n,z0,x,p],e,t||Date.now(),Date.now()]);else if(typeof p==="function")p.apply(this,arguments)})}}return $}function GI($){_U("ENQUEUE",$[0].name,$[1]),m4[a6].push($),xu()}var vD;function ZW0(){var $=Date.now();for(var Y=0;Y<m4[a6].length;++Y)if(m4[a6][Y].length>2)m4[a6][Y][3]=$,m4[a6][Y][4]=$;xu()}function xu(){if(clearTimeout(vD),vD=void 0,m4[a6].length===0)return;var $=m4[a6].shift(),Y=$[0],U=$[1],z=$[2],Q=$[3],J=$[4];if(Q===void 0)_U("RETRY",Y.name,U),Y.apply(null,U);else if(Date.now()-Q>=60000){_U("TIMEOUT",Y.name,U);var I=U.pop();if(typeof I==="function")I.call(null,z)}else{var K=Date.now()-J,G=Math.max(J-Q,1),H=Math.min(G*1.2,100);if(K>=H)_U("RETRY",Y.name,U),Y.apply(null,U.concat([Q]));else m4[a6].push($)}if(vD===void 0)vD=setTimeout(xu,0)}});var LW0=E((cs1,uu)=>{function az1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var VW0=K6().Buffer,$X=I0("util");function tz1($,Y,U){$.copy(Y,U)}uu.exports=function(){function $(){az1(this,$),this.head=null,this.tail=null,t Line truncated
* normalize-path <https://github.com/jonschlinkert/normalize-path>
*
* Copyright (c) 2014-2018, Jon Schlinkert.
* Released under the MIT License.
*/tW0.exports=function($,Y){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var z="";if(U>4&&$[3]==="\\"){var Q=$[2];if((Q==="?"||Q===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),z="//"}var J=$.split(/[/\\]+/);if(Y!==!1&&J[J.length-1]==="")J.pop();return z+J.join("/")}});var Yb=E((ds1,JX0)=>{var $X0=9007199254740991,mQ1="[object Arguments]",lQ1="[object Function]",oQ1="[object GeneratorFunction]",rQ1=/^(?:0|[1-9]\d*)$/;function YX0($,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 sQ1($,Y){var U=-1,z=Array($);while(++U<$)z[U]=Y(U);return z}var HX=Object.prototype,WX=HX.hasOwnProperty,UX0=HX.toString,aQ1=HX.propertyIsEnumerable,eW0=Math.max;function tQ1($,Y){var U=GJ1($)||KJ1($)?sQ1($.length,String):[],z=U.length,Q=!!z;for(var J in $)if((Y||WX.call($,J))&&!(Q&&(J=="length"||QX0(J,z))))U.push(J);return U}function eQ1($,Y,U,z){if($===void 0||tu($,HX[U])&&!WX.call(z,U))return Y;return $}function $J1($,Y,U){var z=$[Y];if(!(WX.call($,Y)&&tu(z,U))||U===void 0&&!(Y in $))$[Y]=U}function YJ1($){if(!$b($))return IJ1($);var Y=JJ1($),U=[];for(var z in $)if(!(z=="constructor"&&(Y||!WX.call($,z))))U.push(z);return U}function zX0($,Y){return Y=eW0(Y===void 0?$.length-1:Y,0),function(){var U=arguments,z=-1,Q=eW0(U.length-Y,0),J=Array(Q);while(++z<Q)J[z]=U[Y+z];z=-1;var I=Array(Y+1);while(++z<Y)I[z]=U[z];return I[Y]=J,YX0($,this,I)}}function UJ1($,Y,U,z){U||(U={});var Q=-1,J=Y.length;while(++Q<J){var I=Y[Q],K=z?z(U[I],$[I],I,U,$):void 0;$J1(U,I,K===void 0?$[I]:K)}return U}function zJ1($){return zX0(function(Y,U){var z=-1,Q=U.length,J=Q>1?U[Q-1]:void 0,I=Q>2?U[2]:void 0;if(J=$.length>3&&typeof J=="function"?(Q--,J):void 0,I&&QJ1(U[0],U[1],I))J=Q<3?void 0:J,Q=1;Y=Object(Y);while(++z<Q){var K=U[z];if(K)$(Y,K,z,J)}return Y})}function QX0($,Y){return Y=Y==null?$X0:Y,!!Y&&(typeof $=="number"||rQ1.test($))&&($>-1&&$%1==0&&$<Y)}function QJ1($,Y,U){if(!$b(U))return!1;var z=typeof Y;if(z=="number"?eu(U)&&QX0(Y,U.length):z=="string"&&(Y in U))return tu(U[Y],$);return!1}function JJ1($){var Y=$&&$.constructor,U=typeof Y=="function"&&Y.prototype||HX;return $===U}function IJ1($){var Y=[];if($!=null)for(var U in Object($))Y.push(U);return Y}function tu($,Y){return $===Y||$!==$&&Y!==Y}function KJ1($){return HJ1($)&&WX.call($,"callee")&&(!aQ1.call($,"callee")||UX0.call($)==mQ1)}var GJ1=Array.isArray;function eu($){return $!=null&&XJ1($.length)&&!WJ1($)}function HJ1($){return ZJ1($)&&eu($)}function WJ1($){var Y=$b($)?UX0.call($):"";return Y==lQ1||Y==oQ1}function XJ1($){return typeof $=="number"&&$>-1&&$%1==0&&$<=$X0}function $b($){var Y=typeof $;return!!$&&(Y=="object"||Y=="function")}function ZJ1($){return!!$&&typeof $=="object"}var qJ1=zJ1(function($,Y,U,z){UJ1(Y,LJ1(Y),$,z)}),VJ1=zX0(function($){return $.push(void 0,eQ1),YX0(qJ1,void 0,$)});function LJ1($){return eu($)?tQ1($,!0):YJ1($)}JX0.exports=VJ1});var KX0=E((ms1,Ub)=>{function FJ1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var IX0=K6().Buffer,XX=I0("util");function OJ1($,Y,U){$.copy(Y,U)}Ub.exports=function(){function $(){FJ1(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var z={data:U,next:null};if(this.length>0)this.tail.next=z;else this.head=z;this.tail=z,++this.length},$.prototype.unshift=function(U){var z={data:U,next:this.head};if(this.length===0)this.tail=z;this.head=z,++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 z=this.head,Q=""+z.data;while(z=z.next)Q+=U+z.data;return Q},$.prototype.concat=function(U){if(this.length===0)return IX0.alloc(0);var z=IX0.allocUnsafe(U>>>0),Q=this.head,J=0;while(Q)OJ1(Q.data,z,J),J+=Q.data.length,Q=Q.next;return z},$}();if(XX&&XX.inspect&&XX.inspect.custom)Ub.exports.prototype[XX.inspect.custom]=function(){var $=XX.inspect({length:this.length});return this.constructor.name+" "+$}});var zb=E((ls1,GX0)=>{var pD=I6();function wJ1($,Y){var U=this,z=this._readableState&&this._readableState.destroyed,Q=this._writableState&&this._writableState.destroyed;if(z||Q){if(Y)Y($);else if($){if(!this._writableState)pD.nextTick(dD,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,pD.nextTick(dD,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)pD.nextTick(dD,U,J);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,pD.nextTick(dD,U,J)}else if(Y)Y(J)}),this}function MJ1(){if(this._readableState)this._readabl Line truncated
%s`,P,P,M,z);var T=M.type==="*"?ib:M.type==="?"?bb:"\\"+M.type;Q=!0,z=z.slice(0,M.reStart)+T+"\\("+P}if(V(),J)z+="\\\\";var A=!1;switch(z.charAt(0)){case"[":case".":case"(":A=!0}for(var j=K.length-1;j>-1;j--){var C=K[j],b=z.slice(0,C.reStart),k=z.slice(C.reStart,C.reEnd-8),S=z.slice(C.reEnd-8,C.reEnd),i=z.slice(C.reEnd);S+=i;var n=b.split("(").length-1,z0=i;for(F=0;F<n;F++)z0=z0.replace(/\)[+*?]?/,"");i=z0;var x="";if(i===""&&Y!==KA)x="$";var d=b+k+i+x+S;z=d}if(z!==""&&Q)z="(?=.)"+z;if(A)z=Z+z;if(Y===KA)return[z,Q];if(!Q)return fH1($);var t=U.nocase?"i":"";try{var e=new RegExp("^"+z+"$",t)}catch(g){return new RegExp("$.")}return e._glob=$,e._src=z,e}X$.makeRe=function($,Y){return new L6($,Y||{}).makeRe()};L6.prototype.makeRe=xH1;function xH1(){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?ib:Y.dot?RH1:_H1,z=Y.nocase?"i":"",Q=$.map(function(J){return J.map(function(I){return I===uU?U:typeof I==="string"?uH1(I):I._src}).join("\\/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,z)}catch(J){this.regexp=!1}return this.regexp}X$.match=function($,Y,U){U=U||{};var z=new L6(Y,U);if($=$.filter(function(Q){return z.match(Q)}),z.options.nonull&&!$.length)$.push(Y);return $};L6.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 z=this.options;if(BX.sep!=="/")Y=Y.split(BX.sep).join("/");Y=Y.split(iZ0),this.debug(this.pattern,"split",Y);var Q=this.set;this.debug(this.pattern,"set",Q);var J,I;for(I=Y.length-1;I>=0;I--)if(J=Y[I],J)break;for(I=0;I<Q.length;I++){var K=Q[I],G=Y;if(z.matchBase&&K.length===1)G=[J];var H=this.matchOne(G,K,U);if(H){if(z.flipNegate)return!0;return!this.negate}}if(z.flipNegate)return!1;return this.negate};L6.prototype.matchOne=function($,Y,U){if(Y.indexOf(uU)!==-1)return this._matchGlobstar($,Y,U,0,0);return this._matchOne($,Y,U,0,0)};L6.prototype._matchGlobstar=function($,Y,U,z,Q){var J,I=-1;for(J=Q;J<Y.length;J++)if(Y[J]===uU){I=J;break}var K=-1;for(J=Y.length-1;J>=0;J--)if(Y[J]===uU){K=J;break}var G=Y.slice(Q,I),H=U?Y.slice(I+1):Y.slice(I+1,K),W=U?[]:Y.slice(K+1);if(G.length){var X=$.slice(z,z+G.length);if(!this._matchOne(X,G,U,0,0))return!1;z+=G.length}var Z=0;if(W.length){if(W.length+z>$.length)return!1;var q=$.length-W.length;if(this._matchOne($,W,U,q,0))Z=W.length;else{if($[$.length-1]!==""||z+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=z;J<$.length-Z;J++){var F=String($[J]);if(V=!0,F==="."||F===".."||!this.options.dot&&F.charAt(0)===".")return!1}return U||V}var w=[[[],0]],O=w[0],M=0,N=[0];for(var D=0;D<H.length;D++){var P=H[D];if(P===uU)N.push(M),O=[[],0],w.push(O);else O[0].push(P),M++}var T=w.length-1,A=$.length-Z;for(var j=0;j<w.length;j++)w[j][1]=A-(N[T--]+w[j][0].length);return!!this._matchGlobStarBodySections($,w,z,0,U,0,!!Z)};L6.prototype._matchGlobStarBodySections=function($,Y,U,z,Q,J,I){var K=Y[z];if(!K){for(var G=U;G<$.length;G++){I=!0;var H=$[G];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1}return I}var W=K[0],X=K[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,z+1,Q,J+1,I);if(q!==!1)return q}var H=$[U];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1;U++}return Q||null};L6.prototype._matchOne=function($,Y,U,z,Q){var J,I,K,G;for(J=z,I=Q,K=$.length,G=Y.length;J<K&&I<G;J++,I++){this.debug("matchOne loop");var H=Y[I],W=$[J];if(this.debug(Y,H,W),H===!1||H===uU)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===K&&I===G)return!0;else if(J===K)return U;else if(I===G)return J===K-1&&$[J]==="";throw Error("wtf?")};function fH1($){return $.replace(/\\(.)/g,"$1")}function uH1($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var XA=E((qa1,WA)=>{function pZ0($){return $.charAt(0)==="/"}function dZ0($){var Y=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=Y.exec($),z=U[1]||"",Q=Boolean(z&&z.charAt(1)!==":");return Boolean(U[2]||Q)}WA.exports=process.platform==="win32"?dZ0:pZ0;WA.exports.posix=pZ0;WA.exports.win32=dZ0});var cb=E((rH1)=>{rH1.setopts=dH1;rH1.ownProp=mZ0;rH1.makeAbs=PX;rH1.finish=mH1;rH1.mark=lH1;rH1.isIgnored=oZ0;rH1.childrenIgnored=oH1;function mZ0($,Y){return Object.prototype.hasOwnProperty.call($,Y)}var bH1=I0("fs"),DI=I0("path"),iH1=HA(),lZ0=XA(),nb=iH1.Minimatch;function nH1($,Y){return $.localeCompare(Y,"en")}function cH1($,Y){if($.ignore=Y.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(pH1)}function pH1($){var Y=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");Y=new nb(U,{dot:!0})}return{matche Line truncated
*/YX0.exports=function($,Y){if(typeof $!=="string")throw TypeError("expected path to be a string");if($==="\\"||$==="/")return"/";var U=$.length;if(U<=1)return $;var z="";if(U>4&&$[3]==="\\"){var Q=$[2];if((Q==="?"||Q===".")&&$.slice(0,2)==="\\\\")$=$.slice(2),z="//"}var J=$.split(/[/\\]+/);if(Y!==!1&&J[J.length-1]==="")J.pop();return z+J.join("/")}});var Qb=E((Ya1,GX0)=>{var zX0=9007199254740991,QJ1="[object Arguments]",JJ1="[object Function]",IJ1="[object GeneratorFunction]",KJ1=/^(?:0|[1-9]\d*)$/;function QX0($,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 GJ1($,Y){var U=-1,z=Array($);while(++U<$)z[U]=Y(U);return z}var HX=Object.prototype,WX=HX.hasOwnProperty,JX0=HX.toString,HJ1=HX.propertyIsEnumerable,UX0=Math.max;function WJ1($,Y){var U=NJ1($)||MJ1($)?GJ1($.length,String):[],z=U.length,Q=!!z;for(var J in $)if((Y||WX.call($,J))&&!(Q&&(J=="length"||KX0(J,z))))U.push(J);return U}function XJ1($,Y,U,z){if($===void 0||Yb($,HX[U])&&!WX.call(z,U))return Y;return $}function ZJ1($,Y,U){var z=$[Y];if(!(WX.call($,Y)&&Yb(z,U))||U===void 0&&!(Y in $))$[Y]=U}function qJ1($){if(!zb($))return OJ1($);var Y=wJ1($),U=[];for(var z in $)if(!(z=="constructor"&&(Y||!WX.call($,z))))U.push(z);return U}function IX0($,Y){return Y=UX0(Y===void 0?$.length-1:Y,0),function(){var U=arguments,z=-1,Q=UX0(U.length-Y,0),J=Array(Q);while(++z<Q)J[z]=U[Y+z];z=-1;var I=Array(Y+1);while(++z<Y)I[z]=U[z];return I[Y]=J,QX0($,this,I)}}function VJ1($,Y,U,z){U||(U={});var Q=-1,J=Y.length;while(++Q<J){var I=Y[Q],K=z?z(U[I],$[I],I,U,$):void 0;ZJ1(U,I,K===void 0?$[I]:K)}return U}function LJ1($){return IX0(function(Y,U){var z=-1,Q=U.length,J=Q>1?U[Q-1]:void 0,I=Q>2?U[2]:void 0;if(J=$.length>3&&typeof J=="function"?(Q--,J):void 0,I&&FJ1(U[0],U[1],I))J=Q<3?void 0:J,Q=1;Y=Object(Y);while(++z<Q){var K=U[z];if(K)$(Y,K,z,J)}return Y})}function KX0($,Y){return Y=Y==null?zX0:Y,!!Y&&(typeof $=="number"||KJ1.test($))&&($>-1&&$%1==0&&$<Y)}function FJ1($,Y,U){if(!zb(U))return!1;var z=typeof Y;if(z=="number"?Ub(U)&&KX0(Y,U.length):z=="string"&&(Y in U))return Yb(U[Y],$);return!1}function wJ1($){var Y=$&&$.constructor,U=typeof Y=="function"&&Y.prototype||HX;return $===U}function OJ1($){var Y=[];if($!=null)for(var U in Object($))Y.push(U);return Y}function Yb($,Y){return $===Y||$!==$&&Y!==Y}function MJ1($){return DJ1($)&&WX.call($,"callee")&&(!HJ1.call($,"callee")||JX0.call($)==QJ1)}var NJ1=Array.isArray;function Ub($){return $!=null&&AJ1($.length)&&!BJ1($)}function DJ1($){return PJ1($)&&Ub($)}function BJ1($){var Y=zb($)?JX0.call($):"";return Y==JJ1||Y==IJ1}function AJ1($){return typeof $=="number"&&$>-1&&$%1==0&&$<=zX0}function zb($){var Y=typeof $;return!!$&&(Y=="object"||Y=="function")}function PJ1($){return!!$&&typeof $=="object"}var TJ1=LJ1(function($,Y,U,z){VJ1(Y,EJ1(Y),$,z)}),jJ1=IX0(function($){return $.push(void 0,XJ1),QX0(TJ1,void 0,$)});function EJ1($){return Ub($)?WJ1($,!0):qJ1($)}GX0.exports=jJ1});var WX0=E((Ua1,Jb)=>{function CJ1($,Y){if(!($ instanceof Y))throw TypeError("Cannot call a class as a function")}var HX0=K6().Buffer,XX=I0("util");function RJ1($,Y,U){$.copy(Y,U)}Jb.exports=function(){function $(){CJ1(this,$),this.head=null,this.tail=null,this.length=0}return $.prototype.push=function(U){var z={data:U,next:null};if(this.length>0)this.tail.next=z;else this.head=z;this.tail=z,++this.length},$.prototype.unshift=function(U){var z={data:U,next:this.head};if(this.length===0)this.tail=z;this.head=z,++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 z=this.head,Q=""+z.data;while(z=z.next)Q+=U+z.data;return Q},$.prototype.concat=function(U){if(this.length===0)return HX0.alloc(0);var z=HX0.allocUnsafe(U>>>0),Q=this.head,J=0;while(Q)RJ1(Q.data,z,J),J+=Q.data.length,Q=Q.next;return z},$}();if(XX&&XX.inspect&&XX.inspect.custom)Jb.exports.prototype[XX.inspect.custom]=function(){var $=XX.inspect({length:this.length});return this.constructor.name+" "+$}});var Ib=E((za1,XX0)=>{var pD=I6();function _J1($,Y){var U=this,z=this._readableState&&this._readableState.destroyed,Q=this._writableState&&this._writableState.destroyed;if(z||Q){if(Y)Y($);else if($){if(!this._writableState)pD.nextTick(mD,this,$);else if(!this._writableState.errorEmitted)this._writableState.errorEmitted=!0,pD.nextTick(mD,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)pD.nextTick(mD,U,J);else if(!U._writableState.errorEmitted)U._writableState.errorEmitted=!0,pD.nextTick(mD,U,J)}else if(Y)Y(J)}),this}function vJ1(){if(this._readableState)this._readabl Line truncated
%s`,P,P,N,z);var T=N.type==="*"?db:N.type==="?"?cb:"\\"+N.type;Q=!0,z=z.slice(0,N.reStart)+T+"\\("+P}if(V(),J)z+="\\\\";var B=!1;switch(z.charAt(0)){case"[":case".":case"(":B=!0}for(var j=K.length-1;j>-1;j--){var C=K[j],b=z.slice(0,C.reStart),k=z.slice(C.reStart,C.reEnd-8),S=z.slice(C.reEnd-8,C.reEnd),i=z.slice(C.reEnd);S+=i;var n=b.split("(").length-1,z0=i;for(F=0;F<n;F++)z0=z0.replace(/\)[+*?]?/,"");i=z0;var x="";if(i===""&&Y!==GB)x="$";var p=b+k+i+x+S;z=p}if(z!==""&&Q)z="(?=.)"+z;if(B)z=Z+z;if(Y===GB)return[z,Q];if(!Q)return sH1($);var t=U.nocase?"i":"";try{var e=new RegExp("^"+z+"$",t)}catch(g){return new RegExp("$.")}return e._glob=$,e._src=z,e}Z$.makeRe=function($,Y){return new L6($,Y||{}).makeRe()};L6.prototype.makeRe=rH1;function rH1(){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?db:Y.dot?iH1:nH1,z=Y.nocase?"i":"",Q=$.map(function(J){return J.map(function(I){return I===uU?U:typeof I==="string"?aH1(I):I._src}).join("\\/")}).join("|");if(Q="^(?:"+Q+")$",this.negate)Q="^(?!"+Q+").*$";try{this.regexp=new RegExp(Q,z)}catch(J){this.regexp=!1}return this.regexp}Z$.match=function($,Y,U){U=U||{};var z=new L6(Y,U);if($=$.filter(function(Q){return z.match(Q)}),z.options.nonull&&!$.length)$.push(Y);return $};L6.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 z=this.options;if(AX.sep!=="/")Y=Y.split(AX.sep).join("/");Y=Y.split(dZ0),this.debug(this.pattern,"split",Y);var Q=this.set;this.debug(this.pattern,"set",Q);var J,I;for(I=Y.length-1;I>=0;I--)if(J=Y[I],J)break;for(I=0;I<Q.length;I++){var K=Q[I],G=Y;if(z.matchBase&&K.length===1)G=[J];var H=this.matchOne(G,K,U);if(H){if(z.flipNegate)return!0;return!this.negate}}if(z.flipNegate)return!1;return this.negate};L6.prototype.matchOne=function($,Y,U){if(Y.indexOf(uU)!==-1)return this._matchGlobstar($,Y,U,0,0);return this._matchOne($,Y,U,0,0)};L6.prototype._matchGlobstar=function($,Y,U,z,Q){var J,I=-1;for(J=Q;J<Y.length;J++)if(Y[J]===uU){I=J;break}var K=-1;for(J=Y.length-1;J>=0;J--)if(Y[J]===uU){K=J;break}var G=Y.slice(Q,I),H=U?Y.slice(I+1):Y.slice(I+1,K),W=U?[]:Y.slice(K+1);if(G.length){var X=$.slice(z,z+G.length);if(!this._matchOne(X,G,U,0,0))return!1;z+=G.length}var Z=0;if(W.length){if(W.length+z>$.length)return!1;var q=$.length-W.length;if(this._matchOne($,W,U,q,0))Z=W.length;else{if($[$.length-1]!==""||z+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=z;J<$.length-Z;J++){var F=String($[J]);if(V=!0,F==="."||F===".."||!this.options.dot&&F.charAt(0)===".")return!1}return U||V}var O=[[[],0]],w=O[0],N=0,M=[0];for(var D=0;D<H.length;D++){var P=H[D];if(P===uU)M.push(N),w=[[],0],O.push(w);else w[0].push(P),N++}var T=O.length-1,B=$.length-Z;for(var j=0;j<O.length;j++)O[j][1]=B-(M[T--]+O[j][0].length);return!!this._matchGlobStarBodySections($,O,z,0,U,0,!!Z)};L6.prototype._matchGlobStarBodySections=function($,Y,U,z,Q,J,I){var K=Y[z];if(!K){for(var G=U;G<$.length;G++){I=!0;var H=$[G];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1}return I}var W=K[0],X=K[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,z+1,Q,J+1,I);if(q!==!1)return q}var H=$[U];if(H==="."||H===".."||!this.options.dot&&H.charAt(0)===".")return!1;U++}return Q||null};L6.prototype._matchOne=function($,Y,U,z,Q){var J,I,K,G;for(J=z,I=Q,K=$.length,G=Y.length;J<K&&I<G;J++,I++){this.debug("matchOne loop");var H=Y[I],W=$[J];if(this.debug(Y,H,W),H===!1||H===uU)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===K&&I===G)return!0;else if(J===K)return U;else if(I===G)return J===K-1&&$[J]==="";throw Error("wtf?")};function sH1($){return $.replace(/\\(.)/g,"$1")}function aH1($){return $.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}});var ZB=E((Aa1,XB)=>{function lZ0($){return $.charAt(0)==="/"}function oZ0($){var Y=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,U=Y.exec($),z=U[1]||"",Q=Boolean(z&&z.charAt(1)!==":");return Boolean(U[2]||Q)}XB.exports=process.platform==="win32"?oZ0:lZ0;XB.exports.posix=lZ0;XB.exports.win32=oZ0});var mb=E((KW1)=>{KW1.setopts=zW1;KW1.ownProp=rZ0;KW1.makeAbs=PX;KW1.finish=QW1;KW1.mark=JW1;KW1.isIgnored=aZ0;KW1.childrenIgnored=IW1;function rZ0($,Y){return Object.prototype.hasOwnProperty.call($,Y)}var tH1=I0("fs"),DI=I0("path"),eH1=WB(),sZ0=ZB(),pb=eH1.Minimatch;function $W1($,Y){return $.localeCompare(Y,"en")}function YW1($,Y){if($.ignore=Y.ignore||[],!Array.isArray($.ignore))$.ignore=[$.ignore];if($.ignore.length)$.ignore=$.ignore.map(UW1)}function UW1($){var Y=null;if($.slice(-3)==="/**"){var U=$.replace(/(\/\*\*)+$/,"");Y=new pb(U,{dot:!0})}return{matche Line truncated
See: https://github.com/isaacs/node-glob/issues/167`);return new E6($,Y).found}function E6($,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 E6))return new E6($,Y);if(QW1(this,$,Y),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var z=0;z<U;z++)this._process(this.minimatch.set[z],z,!1);this._finish()}E6.prototype._finish=function(){if(sZ0.ok(this instanceof E6),this.realpath){var $=this;this.matches.forEach(function(Y,U){var z=$.matches[U]=Object.create(null);for(var Q in Y)try{Q=$._makeAbs(Q);var J=zW1.realpathSync(Q,$.realpathCache);z[J]=!0}catch(I){if(I.syscall==="stat")z[$._makeAbs(Q)]=!0;else throw I}})}bU.finish(this)};E6.prototype._process=function($,Y,U){sZ0.ok(this instanceof E6);var z=0;while(typeof $[z]==="string")z++;var Q;switch(z){case $.length:this._processSimple($.join("/"),Y);return;case 0:Q=null;break;default:Q=$.slice(0,z).join("/");break}var J=$.slice(z),I;if(Q===null)I=".";else if(ZA(Q)||ZA($.map(function(H){return typeof H==="string"?H:"[*]"}).join("/"))){if(!Q||!ZA(Q))Q="/"+Q;I=Q}else I=Q;var K=this._makeAbs(I);if(JW1(this,I))return;var G=J[0]===rZ0.GLOBSTAR;if(G)this._processGlobStar(Q,I,K,J,Y,U);else this._processReaddir(Q,I,K,J,Y,U)};E6.prototype._processReaddir=function($,Y,U,z,Q,J){var I=this._readdir(U,J);if(!I)return;var K=z[0],G=!!this.minimatch.negate,H=K._glob,W=this.dot||H.charAt(0)===".",X=[];for(var Z=0;Z<I.length;Z++){var q=I[Z];if(q.charAt(0)!=="."||W){var V;if(G&&!$)V=!q.match(K);else V=q.match(K);if(V)X.push(q)}}var F=X.length;if(F===0)return;if(z.length===1&&!this.mark&&!this.stat){if(!this.matches[Q])this.matches[Q]=Object.create(null);for(var Z=0;Z<F;Z++){var q=X[Z];if($)if($.slice(-1)!=="/")q=$+"/"+q;else q=$+q;if(q.charAt(0)==="/"&&!this.nomount)q=pb.join(this.root,q);this._emitMatch(Q,q)}return}z.shift();for(var Z=0;Z<F;Z++){var q=X[Z],w;if($)w=[$,q];else w=[q];this._process(w.concat(z),Q,J)}};E6.prototype._emitMatch=function($,Y){if(IW1(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 z=this.cache[U];if(z==="DIR"||Array.isArray(z))return}if(this.matches[$][Y]=!0,this.stat)this._stat(Y)};E6.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var Y,U,z;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};E6.prototype._readdir=function($,Y){var U;if(Y&&!db(this.symlinks,$))return this._readdirInGlobStar($);if(db(this.cache,$)){var z=this.cache[$];if(!z||z==="FILE")return null;if(Array.isArray(z))return z}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(Q){return this._readdirError($,Q),null}};E6.prototype._readdirEntries=function($,Y){if(!this.mark&&!this.stat)for(var U=0;U<Y.length;U++){var z=Y[U];if($==="/")z=$+z;else z=$+"/"+z;this.cache[z]=!0}return this.cache[$]=Y,Y};E6.prototype._readdirError=function($,Y){switch(Y.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var z=Error(Y.code+" invalid cwd "+this.cwd);throw z.path=this.cwd,z.code=Y.code,z}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}};E6.prototype._processGlobStar=function($,Y,U,z,Q,J){var I=this._readdir(U,J);if(!I)return;var K=z.slice(1),G=$?[$]:[],H=G.concat(K);this._process(H,Q,!1);var W=I.length,X=this.symlinks[U];if(X&&J)return;for(var Z=0;Z<W;Z++){var q=I[Z];if(q.charAt(0)==="."&&!this.dot)continue;var V=G.concat(I[Z],K);this._process(V,Q,!0);var F=G.concat(I[Z],z);this._process(F,Q,!0)}};E6.prototype._processSimple=function($,Y){var U=this._stat($);if(!this.matches[Y])this.matches[Y]=Object.create(null);if(!U)return;if($&&ZA($)&&!this.nomount){var z=/[\/\\]$/.test($);if($.charAt(0)==="/")$=pb.join(this.root,$);else if($=pb.resolve(this.root,$),z)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(Y,$)};E6.prototype._stat=function($){var Y=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&db(this.cache,Y)){var I=this.cache[Y];if(Array.isArray(I))I="DIR";if(!U||I==="DIR")return I;if(U&&I==="FILE")return!1}var z,Q=this.statCache[Y];if(!Q){var J;try{J=this.fs.lstatSync(Y)}catch(K){if(K&&(K.code==="ENOENT"||K.code==="ENOTDIR"))return this.statCache[Y]=!1,!1}if(J&&J.isSymbolicLink())try{Q=this.fs.statSync(Y)}catch(K){Q=J}else Q=J}this.statCache[Y]=Q;var I=!0;if(Q)I=Q.isDirectory()?"DIR":"FILE";if(this.cache[Y]=this.cache[Y]||I,U&&I==="FILE")return!1;return I};E6.prototype._mark=function($){return bU.mark(this,$)};E6.prototype._makeAbs=function($){return bU.makeAbs(this,$)}});var mb=E((Ma1,Yq0)=>{Yq0.exports=$q0;function $q0($,Y){if($&&Y)return $q0($)(Y);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(z){U[z]=$[z]}),U;f Line truncated
`);if($.linkname)Y+=pi(" linkpath="+$.linkname+`
`);var U=$.pax;if(U)for(var z in U)Y+=pi(" "+z+"="+U[z]+`
`);return Buffer.from(Y)};Fq1.decodePax=function($){var Y={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var z=parseInt($.slice(0,U).toString(),10);if(!z)return Y;var Q=$.slice(U+1,z-1).toString(),J=Q.indexOf("=");if(J===-1)return Y;Y[Q.slice(0,J)]=Q.slice(J+1),$=$.slice(z)}return Y};Fq1.encode=function($){var Y=Jq1(512),U=$.name,z="";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;z+=z?"/"+U.slice(0,Q):U.slice(0,Q),U=U.slice(Q+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(z)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(Y.write(U),Y.write(E2($.mode&Xq1,6),100),Y.write(E2($.uid,6),108),Y.write(E2($.gid,6),116),Y.write(E2($.size,11),124),Y.write(E2($.mtime.getTime()/1000|0,11),136),Y[156]=LL0+Vq1($.type),$.linkname)Y.write($.linkname,157);if(FL0.copy(Y,bX),Gq1.copy(Y,di),$.uname)Y.write($.uname,265);if($.gname)Y.write($.gname,297);if(Y.write(E2($.devmajor||0,6),329),Y.write(E2($.devminor||0,6),337),z)Y.write(z,345);return Y.write(E2(wL0(Y),6),148),Y};Fq1.decode=function($,Y,U){var z=$[156]===0?0:$[156]-LL0,Q=_I($,0,100,Y),J=C2($,100,8),I=C2($,108,8),K=C2($,116,8),G=C2($,124,12),H=C2($,136,12),W=qq1(z),X=$[157]===0?null:_I($,157,100,Y),Z=_I($,265,32),q=_I($,297,32),V=C2($,329,8),F=C2($,337,8),w=wL0($);if(w===256)return null;if(w!==C2($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(FL0.compare($,bX,bX+6)===0){if($[345])Q=_I($,345,155,Y)+"/"+Q}else if(Hq1.compare($,bX,bX+6)===0&&Wq1.compare($,di,di+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(z===0&&Q&&Q[Q.length-1]==="/")z=5;return{name:Q,mode:J,uid:I,gid:K,size:G,mtime:new Date(1000*H),type:W,linkname:X,uname:Z,gname:q,devmajor:V,devminor:F}}});var TL0=E((qt1,PL0)=>{var NL0=I0("util"),Aq1=VL0(),iX=mi(),DL0=R8().Writable,AL0=R8().PassThrough,BL0=function(){},ML0=function($){return $&=511,$&&512-$},Bq1=function($,Y){var U=new hA($,Y);return U.end(),U},Pq1=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,$},hA=function($,Y){this._parent=$,this.offset=Y,AL0.call(this,{autoDestroy:!1})};NL0.inherits(hA,AL0);hA.prototype.destroy=function($){this._parent.destroy($)};var T3=function($){if(!(this instanceof T3))return new T3($);DL0.call(this,$),$=$||{},this._offset=0,this._buffer=Aq1(),this._missing=0,this._partial=!1,this._onparse=BL0,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,z=function(){Y._continue()},Q=function(Z){if(Y._locked=!1,Z)return Y.destroy(Z);if(!Y._stream)z()},J=function(){Y._stream=null;var Z=ML0(Y._header.size);if(Z)Y._parse(Z,I);else Y._parse(512,X);if(!Y._locked)z()},I=function(){Y._buffer.consume(ML0(Y._header.size)),Y._parse(512,X),z()},K=function(){var Z=Y._header.size;Y._paxGlobal=iX.decodePax(U.slice(0,Z)),U.consume(Z),J()},G=function(){var Z=Y._header.size;if(Y._pax=iX.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=iX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},W=function(){var Z=Y._header.size;this._gnuLongLinkPath=iX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},X=function(){var Z=Y._offset,q;try{q=Y._header=iX.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(V){Y.emit("error",V)}if(U.consume(512),!q){Y._parse(512,X),z();return}if(q.type==="gnu-long-path"){Y._parse(q.size,H),z();return}if(q.type==="gnu-long-link-path"){Y._parse(q.size,W),z();return}if(q.type==="pax-global-header"){Y._parse(q.size,K),z();return}if(q.type==="pax-header"){Y._parse(q.size,G),z();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=Pq1(q,Y._pax),Y._pax=null;if(Y._locked=!0,!q.size||q.type==="directory"){Y._parse(512,X),Y.emit("entry",q,Bq1(Y,Z),Q);return}Y._stream=new hA(Y,Z),Y.emit("entry",q,Y._stream,Q),Y._parse(q.size,J),z()};this._onheader=X,this._parse(512,X)};NL0.inherits(T3,DL0);T3.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};T3.prototype._parse=function($,Y){if(this._destroyed)return;if(this._offset+=$,this._missing=$,Y===this._onheader)this._partial=!1;this._onparse=Y};T3.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=BL0,this._overflow)this._write(this._overflow,void 0,$);else $()};T3.prototype._write=function($,Y,U){if(this._destroyed)return;var z=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="${cq1.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${$.Target}"/>`);return Y}_writeClose(){this.stream.write("</Relationships>")}}aL0.exports=sL0});var zF0=E((Bt1,UF0)=>{var eL0=o6(),$F0=J2(),dq1=n4(),mq1=Jf(),lq1=Kf();class YF0{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:$F0.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let Y={Type:$F0.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 mq1,z=new eL0;U.render(z,$),this.commentsStream.write(z.xml);let Q=new lq1,J=new eL0;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=dq1.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()}}UF0.exports=YF0});var HF0=E((Pt1,GF0)=>{var oq1=Y6(),rq1=J2(),ri=n4(),QF0=Pg(),JF0=U3(),sq1=fk(),IF0=xw(),si=uw(),aq1=tL0(),tq1=zF0(),eq1=Ag(),x6=new sq1,ai=U2(),$V1=Sx(),YV1=gx(),UV1=yx(),zV1=Rx(),QV1=Ex(),JV1=_x(),IV1=kx(),KV1=xx(),GV1=fx(),HV1=ux(),WV1=bx(),XV1=ix(),ZV1=mx(),qV1=cx(),VV1=nx(),f6={dataValidations:new $V1,sheetProperties:new YV1,sheetFormatProperties:new UV1,columns:new ai({tag:"cols",length:!1,childXform:new zV1}),row:new QV1,hyperlinks:new ai({tag:"hyperlinks",length:!1,childXform:new JV1}),sheetViews:new ai({tag:"sheetViews",length:!1,childXform:new IV1}),sheetProtection:new KV1,pageMargins:new GV1,pageSeteup:new HV1,autoFilter:new WV1,picture:new XV1,conditionalFormattings:new ZV1,headerFooter:new qV1,rowBreaks:new VV1};class KF0{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 aq1($),this._sheetCommentsWriter=new tq1(this,this._sheetRelsWriter,$),this._dimensions=new JF0,this._rowZero=1,this.committed=!1,this.dataValidations=new eq1,this._formulae={},this._siFormulae=0,this.conditionalFormatting=[],this.rowBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,outlineLevelCol:0,outlineLevelRow:0},$.properties),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},$.headerFooter),this.pageSetup=Object.assign({},{margins:{left:0.7,right:0.7,top:0.75,bottom:0.75,header:0.3,footer:0.3},orientation:"portrait",horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!!($.pageSetup&&($.pageSetup.fitToWidth||$.pageSetup.fitToHeight)&&!$.pageSetup.scale),pageOrder:"downThenOver",blackAndWhite:!1,draft:!1,cellComments:"None",errors:"displayed",scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},$.pageSetup),this.useSharedStrings=$.useSharedStrings||!1,this._workbook=$.workbook,this.hasComments=!1,this._views=$.views||[],this.autoFilter=$.autoFilter||null,this._media=[],this.sheetProtection=null,this._writeOpenWorksheet(),this.startedData=!1}get Line truncated
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof E6))return new E6($,Y);if(FW1(this,$,Y),this.noprocess)return this;var U=this.minimatch.set.length;this.matches=Array(U);for(var z=0;z<U;z++)this._process(this.minimatch.set[z],z,!1);this._finish()}E6.prototype._finish=function(){if(eZ0.ok(this instanceof E6),this.realpath){var $=this;this.matches.forEach(function(Y,U){var z=$.matches[U]=Object.create(null);for(var Q in Y)try{Q=$._makeAbs(Q);var J=LW1.realpathSync(Q,$.realpathCache);z[J]=!0}catch(I){if(I.syscall==="stat")z[$._makeAbs(Q)]=!0;else throw I}})}bU.finish(this)};E6.prototype._process=function($,Y,U){eZ0.ok(this instanceof E6);var z=0;while(typeof $[z]==="string")z++;var Q;switch(z){case $.length:this._processSimple($.join("/"),Y);return;case 0:Q=null;break;default:Q=$.slice(0,z).join("/");break}var J=$.slice(z),I;if(Q===null)I=".";else if(qB(Q)||qB($.map(function(H){return typeof H==="string"?H:"[*]"}).join("/"))){if(!Q||!qB(Q))Q="/"+Q;I=Q}else I=Q;var K=this._makeAbs(I);if(wW1(this,I))return;var G=J[0]===tZ0.GLOBSTAR;if(G)this._processGlobStar(Q,I,K,J,Y,U);else this._processReaddir(Q,I,K,J,Y,U)};E6.prototype._processReaddir=function($,Y,U,z,Q,J){var I=this._readdir(U,J);if(!I)return;var K=z[0],G=!!this.minimatch.negate,H=K._glob,W=this.dot||H.charAt(0)===".",X=[];for(var Z=0;Z<I.length;Z++){var q=I[Z];if(q.charAt(0)!=="."||W){var V;if(G&&!$)V=!q.match(K);else V=q.match(K);if(V)X.push(q)}}var F=X.length;if(F===0)return;if(z.length===1&&!this.mark&&!this.stat){if(!this.matches[Q])this.matches[Q]=Object.create(null);for(var Z=0;Z<F;Z++){var q=X[Z];if($)if($.slice(-1)!=="/")q=$+"/"+q;else q=$+q;if(q.charAt(0)==="/"&&!this.nomount)q=lb.join(this.root,q);this._emitMatch(Q,q)}return}z.shift();for(var Z=0;Z<F;Z++){var q=X[Z],O;if($)O=[$,q];else O=[q];this._process(O.concat(z),Q,J)}};E6.prototype._emitMatch=function($,Y){if(OW1(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 z=this.cache[U];if(z==="DIR"||Array.isArray(z))return}if(this.matches[$][Y]=!0,this.stat)this._stat(Y)};E6.prototype._readdirInGlobStar=function($){if(this.follow)return this._readdir($,!1);var Y,U,z;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};E6.prototype._readdir=function($,Y){var U;if(Y&&!ob(this.symlinks,$))return this._readdirInGlobStar($);if(ob(this.cache,$)){var z=this.cache[$];if(!z||z==="FILE")return null;if(Array.isArray(z))return z}try{return this._readdirEntries($,this.fs.readdirSync($))}catch(Q){return this._readdirError($,Q),null}};E6.prototype._readdirEntries=function($,Y){if(!this.mark&&!this.stat)for(var U=0;U<Y.length;U++){var z=Y[U];if($==="/")z=$+z;else z=$+"/"+z;this.cache[z]=!0}return this.cache[$]=Y,Y};E6.prototype._readdirError=function($,Y){switch(Y.code){case"ENOTSUP":case"ENOTDIR":var U=this._makeAbs($);if(this.cache[U]="FILE",U===this.cwdAbs){var z=Error(Y.code+" invalid cwd "+this.cwd);throw z.path=this.cwd,z.code=Y.code,z}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}};E6.prototype._processGlobStar=function($,Y,U,z,Q,J){var I=this._readdir(U,J);if(!I)return;var K=z.slice(1),G=$?[$]:[],H=G.concat(K);this._process(H,Q,!1);var W=I.length,X=this.symlinks[U];if(X&&J)return;for(var Z=0;Z<W;Z++){var q=I[Z];if(q.charAt(0)==="."&&!this.dot)continue;var V=G.concat(I[Z],K);this._process(V,Q,!0);var F=G.concat(I[Z],z);this._process(F,Q,!0)}};E6.prototype._processSimple=function($,Y){var U=this._stat($);if(!this.matches[Y])this.matches[Y]=Object.create(null);if(!U)return;if($&&qB($)&&!this.nomount){var z=/[\/\\]$/.test($);if($.charAt(0)==="/")$=lb.join(this.root,$);else if($=lb.resolve(this.root,$),z)$+="/"}if(process.platform==="win32")$=$.replace(/\\/g,"/");this._emitMatch(Y,$)};E6.prototype._stat=function($){var Y=this._makeAbs($),U=$.slice(-1)==="/";if($.length>this.maxLength)return!1;if(!this.stat&&ob(this.cache,Y)){var I=this.cache[Y];if(Array.isArray(I))I="DIR";if(!U||I==="DIR")return I;if(U&&I==="FILE")return!1}var z,Q=this.statCache[Y];if(!Q){var J;try{J=this.fs.lstatSync(Y)}catch(K){if(K&&(K.code==="ENOENT"||K.code==="ENOTDIR"))return this.statCache[Y]=!1,!1}if(J&&J.isSymbolicLink())try{Q=this.fs.statSync(Y)}catch(K){Q=J}else Q=J}this.statCache[Y]=Q;var I=!0;if(Q)I=Q.isDirectory()?"DIR":"FILE";if(this.cache[Y]=this.cache[Y]||I,U&&I==="FILE")return!1;return I};E6.prototype._mark=function($){return bU.mark(this,$)};E6.prototype._makeAbs=function($){return bU.makeAbs(this,$)}});var rb=E((Ra1,Qq0)=>{Qq0.exports=zq0;function zq0($,Y){if($&&Y)return zq0($)(Y);if(typeof $!=="function")throw TypeError("need wrapper function");return Object.keys($).forEach(function(z){U[z]=$[z]}),U;f Line truncated
`);if($.linkname)Y+=li(" linkpath="+$.linkname+`
`);var U=$.pax;if(U)for(var z in U)Y+=li(" "+z+"="+U[z]+`
`);return Buffer.from(Y)};Cq1.decodePax=function($){var Y={};while($.length){var U=0;while(U<$.length&&$[U]!==32)U++;var z=parseInt($.slice(0,U).toString(),10);if(!z)return Y;var Q=$.slice(U+1,z-1).toString(),J=Q.indexOf("=");if(J===-1)return Y;Y[Q.slice(0,J)]=Q.slice(J+1),$=$.slice(z)}return Y};Cq1.encode=function($){var Y=wq1(512),U=$.name,z="";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;z+=z?"/"+U.slice(0,Q):U.slice(0,Q),U=U.slice(Q+1)}if(Buffer.byteLength(U)>100||Buffer.byteLength(z)>155)return null;if($.linkname&&Buffer.byteLength($.linkname)>100)return null;if(Y.write(U),Y.write(E2($.mode&Aq1,6),100),Y.write(E2($.uid,6),108),Y.write(E2($.gid,6),116),Y.write(E2($.size,11),124),Y.write(E2($.mtime.getTime()/1000|0,11),136),Y[156]=OL0+jq1($.type),$.linkname)Y.write($.linkname,157);if(ML0.copy(Y,bX),Nq1.copy(Y,oi),$.uname)Y.write($.uname,265);if($.gname)Y.write($.gname,297);if(Y.write(E2($.devmajor||0,6),329),Y.write(E2($.devminor||0,6),337),z)Y.write(z,345);return Y.write(E2(DL0(Y),6),148),Y};Cq1.decode=function($,Y,U){var z=$[156]===0?0:$[156]-OL0,Q=_I($,0,100,Y),J=C2($,100,8),I=C2($,108,8),K=C2($,116,8),G=C2($,124,12),H=C2($,136,12),W=Tq1(z),X=$[157]===0?null:_I($,157,100,Y),Z=_I($,265,32),q=_I($,297,32),V=C2($,329,8),F=C2($,337,8),O=DL0($);if(O===256)return null;if(O!==C2($,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(ML0.compare($,bX,bX+6)===0){if($[345])Q=_I($,345,155,Y)+"/"+Q}else if(Dq1.compare($,bX,bX+6)===0&&Bq1.compare($,oi,oi+2)===0);else if(!U)throw Error("Invalid tar header: unknown format.");if(z===0&&Q&&Q[Q.length-1]==="/")z=5;return{name:Q,mode:J,uid:I,gid:K,size:G,mtime:new Date(1000*H),type:W,linkname:X,uname:Z,gname:q,devmajor:V,devminor:F}}});var CL0=E((At1,EL0)=>{var AL0=I0("util"),gq1=wL0(),iX=ri(),PL0=v8().Writable,TL0=v8().PassThrough,jL0=function(){},BL0=function($){return $&=511,$&&512-$},yq1=function($,Y){var U=new SB($,Y);return U.end(),U},kq1=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,$},SB=function($,Y){this._parent=$,this.offset=Y,TL0.call(this,{autoDestroy:!1})};AL0.inherits(SB,TL0);SB.prototype.destroy=function($){this._parent.destroy($)};var C3=function($){if(!(this instanceof C3))return new C3($);PL0.call(this,$),$=$||{},this._offset=0,this._buffer=gq1(),this._missing=0,this._partial=!1,this._onparse=jL0,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,z=function(){Y._continue()},Q=function(Z){if(Y._locked=!1,Z)return Y.destroy(Z);if(!Y._stream)z()},J=function(){Y._stream=null;var Z=BL0(Y._header.size);if(Z)Y._parse(Z,I);else Y._parse(512,X);if(!Y._locked)z()},I=function(){Y._buffer.consume(BL0(Y._header.size)),Y._parse(512,X),z()},K=function(){var Z=Y._header.size;Y._paxGlobal=iX.decodePax(U.slice(0,Z)),U.consume(Z),J()},G=function(){var Z=Y._header.size;if(Y._pax=iX.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=iX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},W=function(){var Z=Y._header.size;this._gnuLongLinkPath=iX.decodeLongPath(U.slice(0,Z),$.filenameEncoding),U.consume(Z),J()},X=function(){var Z=Y._offset,q;try{q=Y._header=iX.decode(U.slice(0,512),$.filenameEncoding,$.allowUnknownFormat)}catch(V){Y.emit("error",V)}if(U.consume(512),!q){Y._parse(512,X),z();return}if(q.type==="gnu-long-path"){Y._parse(q.size,H),z();return}if(q.type==="gnu-long-link-path"){Y._parse(q.size,W),z();return}if(q.type==="pax-global-header"){Y._parse(q.size,K),z();return}if(q.type==="pax-header"){Y._parse(q.size,G),z();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=kq1(q,Y._pax),Y._pax=null;if(Y._locked=!0,!q.size||q.type==="directory"){Y._parse(512,X),Y.emit("entry",q,yq1(Y,Z),Q);return}Y._stream=new SB(Y,Z),Y.emit("entry",q,Y._stream,Q),Y._parse(q.size,J),z()};this._onheader=X,this._parse(512,X)};AL0.inherits(C3,PL0);C3.prototype.destroy=function($){if(this._destroyed)return;if(this._destroyed=!0,$)this.emit("error",$);if(this.emit("close"),this._stream)this._stream.emit("close")};C3.prototype._parse=function($,Y){if(this._destroyed)return;if(this._offset+=$,this._missing=$,Y===this._onheader)this._partial=!1;this._onparse=Y};C3.prototype._continue=function(){if(this._destroyed)return;var $=this._cb;if(this._cb=jL0,this._overflow)this._write(this._overflow,void 0,$);else $()};C3.prototype._write=function($,Y,U){if(this._destroyed)return;var z=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="${YV1.xmlEncode($.Target)}" TargetMode="${$.TargetMode}"/>`);else this.stream.write(`<Relationship Id="${Y}" Type="${$.Type}" Target="${$.Target}"/>`);return Y}_writeClose(){this.stream.write("</Relationships>")}}$F0.exports=eL0});var IF0=E((St1,JF0)=>{var UF0=o6(),zF0=J2(),zV1=c4(),QV1=Gf(),JV1=Wf();class QF0{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:zF0.Comments,Target:`../comments${this.id}.xml`};this._sheetRelsWriter.addRelationship($);let Y={Type:zF0.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 QV1,z=new UF0;U.render(z,$),this.commentsStream.write(z.xml);let Q=new JV1,J=new UF0;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=zV1.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()}}JF0.exports=QF0});var ZF0=E((gt1,XF0)=>{var IV1=Y6(),KV1=J2(),ti=c4(),KF0=Eg(),GF0=J3(),GV1=ik(),HF0=fO(),ei=bO(),HV1=YF0(),WV1=IF0(),XV1=Tg(),x6=new GV1,$n=U2(),ZV1=kx(),qV1=xx(),VV1=fx(),LV1=hx(),FV1=_x(),wV1=Sx(),OV1=ux(),MV1=bx(),NV1=ix(),DV1=nx(),BV1=cx(),AV1=dx(),PV1=rx(),TV1=mx(),jV1=px(),f6={dataValidations:new ZV1,sheetProperties:new qV1,sheetFormatProperties:new VV1,columns:new $n({tag:"cols",length:!1,childXform:new LV1}),row:new FV1,hyperlinks:new $n({tag:"hyperlinks",length:!1,childXform:new wV1}),sheetViews:new $n({tag:"sheetViews",length:!1,childXform:new OV1}),sheetProtection:new MV1,pageMargins:new NV1,pageSeteup:new DV1,autoFilter:new BV1,picture:new AV1,conditionalFormattings:new PV1,headerFooter:new TV1,rowBreaks:new jV1};class WF0{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 HV1($),this._sheetCommentsWriter=new WV1(this,this._sheetRelsWriter,$),this._dimensions=new GF0,this._rowZero=1,this.committed=!1,this.dataValidations=new XV1,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
`)},Ln=Fn.getNativePromise();if(Fn.isNode&&typeof MutationObserver>"u")On=global.setImmediate,wn=process.nextTick,tU=Fn.isRecentNode?function($){On.call(global,$)}:function($){wn.call(process,$)};else if(typeof Ln==="function"&&typeof Ln.resolve==="function")Mn=Ln.resolve(),tU=function($){Mn.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))tU=function(){var $=document.createElement("div"),Y={attributes:!0},U=!1,z=document.createElement("div"),Q=new MutationObserver(function(){$.classList.toggle("foo"),U=!1});Q.observe(z,Y);var J=function(){if(U)return;U=!0,z.classList.toggle("foo")};return function(K){var G=new MutationObserver(function(){G.disconnect(),K()});G.observe($,Y),J()}}();else if(typeof setImmediate<"u")tU=function($){setImmediate($)};else if(typeof setTimeout<"u")tU=function($){setTimeout($,0)};else tU=JL1;var On,wn,Mn;nF0.exports=tU});var dF0=E((kt1,pF0)=>{function IL1($,Y,U,z,Q){for(var J=0;J<Q;++J)U[J+z]=$[J+Y],$[J+Y]=void 0}function v2($){this._capacity=$,this._length=0,this._front=0}v2.prototype._willBeOverCapacity=function($){return this._capacity<$};v2.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};v2.prototype.push=function($,Y,U){var z=this.length()+3;if(this._willBeOverCapacity(z)){this._pushOne($),this._pushOne(Y),this._pushOne(U);return}var Q=this._front+z-3;this._checkCapacity(z);var J=this._capacity-1;this[Q+0&J]=$,this[Q+1&J]=Y,this[Q+2&J]=U,this._length=z};v2.prototype.shift=function(){var $=this._front,Y=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,Y};v2.prototype.length=function(){return this._length};v2.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};v2.prototype._resizeTo=function($){var Y=this._capacity;this._capacity=$;var U=this._front,z=this._length,Q=U+z&Y-1;IL1(this,0,this,Y,Q)};pF0.exports=v2});var tF0=E((xt1,Nn)=>{var sF0;try{throw Error()}catch($){sF0=$}var KL1=cF0(),mF0=dF0(),aF0=O4();function u6(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new mF0(16),this._normalQueue=new mF0(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var $=this;this.drainQueues=function(){$._drainQueues()},this._schedule=KL1}u6.prototype.setScheduler=function($){var Y=this._schedule;return this._schedule=$,this._customScheduler=!0,Y};u6.prototype.hasCustomScheduler=function(){return this._customScheduler};u6.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};u6.prototype.disableTrampolineIfNecessary=function(){if(aF0.hasDevTools)this._trampolineEnabled=!1};u6.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};u6.prototype.fatalError=function($,Y){if(Y)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
`)},On=Mn.getNativePromise();if(Mn.isNode&&typeof MutationObserver>"u")Nn=global.setImmediate,Dn=process.nextTick,tU=Mn.isRecentNode?function($){Nn.call(global,$)}:function($){Dn.call(process,$)};else if(typeof On==="function"&&typeof On.resolve==="function")Bn=On.resolve(),tU=function($){Bn.then($)};else if(typeof MutationObserver<"u"&&!(typeof window<"u"&&window.navigator&&(window.navigator.standalone||window.cordova)))tU=function(){var $=document.createElement("div"),Y={attributes:!0},U=!1,z=document.createElement("div"),Q=new MutationObserver(function(){$.classList.toggle("foo"),U=!1});Q.observe(z,Y);var J=function(){if(U)return;U=!0,z.classList.toggle("foo")};return function(K){var G=new MutationObserver(function(){G.disconnect(),K()});G.observe($,Y),J()}}();else if(typeof setImmediate<"u")tU=function($){setImmediate($)};else if(typeof setTimeout<"u")tU=function($){setTimeout($,0)};else tU=wL1;var Nn,Dn,Bn;pF0.exports=tU});var oF0=E((mt1,lF0)=>{function OL1($,Y,U,z,Q){for(var J=0;J<Q;++J)U[J+z]=$[J+Y],$[J+Y]=void 0}function v2($){this._capacity=$,this._length=0,this._front=0}v2.prototype._willBeOverCapacity=function($){return this._capacity<$};v2.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};v2.prototype.push=function($,Y,U){var z=this.length()+3;if(this._willBeOverCapacity(z)){this._pushOne($),this._pushOne(Y),this._pushOne(U);return}var Q=this._front+z-3;this._checkCapacity(z);var J=this._capacity-1;this[Q+0&J]=$,this[Q+1&J]=Y,this[Q+2&J]=U,this._length=z};v2.prototype.shift=function(){var $=this._front,Y=this[$];return this[$]=void 0,this._front=$+1&this._capacity-1,this._length--,Y};v2.prototype.length=function(){return this._length};v2.prototype._checkCapacity=function($){if(this._capacity<$)this._resizeTo(this._capacity<<1)};v2.prototype._resizeTo=function($){var Y=this._capacity;this._capacity=$;var U=this._front,z=this._length,Q=U+z&Y-1;OL1(this,0,this,Y,Q)};lF0.exports=v2});var Yw0=E((lt1,An)=>{var eF0;try{throw Error()}catch($){eF0=$}var ML1=mF0(),rF0=oF0(),$w0=O4();function u6(){this._customScheduler=!1,this._isTickUsed=!1,this._lateQueue=new rF0(16),this._normalQueue=new rF0(16),this._haveDrainedQueues=!1,this._trampolineEnabled=!0;var $=this;this.drainQueues=function(){$._drainQueues()},this._schedule=ML1}u6.prototype.setScheduler=function($){var Y=this._schedule;return this._schedule=$,this._customScheduler=!0,Y};u6.prototype.hasCustomScheduler=function(){return this._customScheduler};u6.prototype.enableTrampoline=function(){this._trampolineEnabled=!0};u6.prototype.disableTrampolineIfNecessary=function(){if($w0.hasDevTools)this._trampolineEnabled=!1};u6.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues};u6.prototype.fatalError=function($,Y){if(Y)process.stderr.write("Fatal "+($ instanceof Error?$.stack:$)+`
`),process.exit(2);else this.throwLater($)};u6.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 lF0($,Y,U){this._lateQueue.push($,Y,U),this._queueTick()}function oF0($,Y,U){this._normalQueue.push($,Y,U),this._queueTick()}function rF0($){this._normalQueue._pushOne($),this._queueTick()}if(!aF0.hasDevTools)u6.prototype.invokeLater=lF0,u6.prototype.invoke=oF0,u6.prototype.settlePromises=rF0;else u6.prototype.invokeLater=function($,Y,U){if(this._trampolineEnabled)lF0.call(this,$,Y,U);else this._schedule(function(){setTimeout(function(){$.call(Y,U)},100)})},u6.prototype.invoke=function($,Y,U){if(this._trampolineEnabled)oF0.call(this,$,Y,U);else this._schedule(function(){$.call(Y,U)})},u6.prototype.settlePromises=function($){if(this._trampolineEnabled)rF0.call(this,$);else this._schedule(function(){$._settlePromises()})};u6.prototype._drainQueue=function($){while($.length()>0){var Y=$.shift();if(typeof Y!=="function"){Y._settlePromises();continue}var U=$.shift(),z=$.shift();Y.call(U,z)}};u6.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};u6.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};u6.prototype._reset=function(){this._isTickUsed=!1};Nn.exports=u6;Nn.exports.firstLineError=sF0});var E3=E((ft1,YO0)=>{var Bn=aU(),GL1=Bn.freeze,eF0=O4(),$O0=eF0.inherits,yI=eF0.notEnumerableProp;function kI($,Y){function U(z){if(!(this instanceof U))return new U(z);if(yI(this,"message",typeof z==="string"?z:Y),yI(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return $O0(U,Error),U}var Dn,An,HL1=kI("Warning","warning"),WL1=kI("CancellationError","cancellation error"),XL1=kI("TimeoutError","timeout error"),lX=kI("AggregateError","aggregate error");try{Dn=TypeError,An=RangeError}catch($){Dn=kI("TypeError","type error"),An=kI("RangeError","range error")}var iA="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(eU=0;eU<iA.length;++eU)if(typeof Array.prototype[iA[eU]]==="function")lX.prototype[iA[eU]]=Array.prototype[iA[eU]];var eU;Bn.defineProperty(lX.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});lX.prototype.isOperational=!0;var nA=0;lX.prototype.toString=function(){var $=Array(nA*4+1).join(" "),Y=`
`)}};function sF0($,Y,U){this._lateQueue.push($,Y,U),this._queueTick()}function aF0($,Y,U){this._normalQueue.push($,Y,U),this._queueTick()}function tF0($){this._normalQueue._pushOne($),this._queueTick()}if(!$w0.hasDevTools)u6.prototype.invokeLater=sF0,u6.prototype.invoke=aF0,u6.prototype.settlePromises=tF0;else u6.prototype.invokeLater=function($,Y,U){if(this._trampolineEnabled)sF0.call(this,$,Y,U);else this._schedule(function(){setTimeout(function(){$.call(Y,U)},100)})},u6.prototype.invoke=function($,Y,U){if(this._trampolineEnabled)aF0.call(this,$,Y,U);else this._schedule(function(){$.call(Y,U)})},u6.prototype.settlePromises=function($){if(this._trampolineEnabled)tF0.call(this,$);else this._schedule(function(){$._settlePromises()})};u6.prototype._drainQueue=function($){while($.length()>0){var Y=$.shift();if(typeof Y!=="function"){Y._settlePromises();continue}var U=$.shift(),z=$.shift();Y.call(U,z)}};u6.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._haveDrainedQueues=!0,this._drainQueue(this._lateQueue)};u6.prototype._queueTick=function(){if(!this._isTickUsed)this._isTickUsed=!0,this._schedule(this.drainQueues)};u6.prototype._reset=function(){this._isTickUsed=!1};An.exports=u6;An.exports.firstLineError=eF0});var _3=E((ot1,Qw0)=>{var jn=aU(),NL1=jn.freeze,Uw0=O4(),zw0=Uw0.inherits,yI=Uw0.notEnumerableProp;function kI($,Y){function U(z){if(!(this instanceof U))return new U(z);if(yI(this,"message",typeof z==="string"?z:Y),yI(this,"name",$),Error.captureStackTrace)Error.captureStackTrace(this,this.constructor);else Error.call(this)}return zw0(U,Error),U}var Pn,Tn,DL1=kI("Warning","warning"),BL1=kI("CancellationError","cancellation error"),AL1=kI("TimeoutError","timeout error"),lX=kI("AggregateError","aggregate error");try{Pn=TypeError,Tn=RangeError}catch($){Pn=kI("TypeError","type error"),Tn=kI("RangeError","range error")}var nB="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" ");for(eU=0;eU<nB.length;++eU)if(typeof Array.prototype[nB[eU]]==="function")lX.prototype[nB[eU]]=Array.prototype[nB[eU]];var eU;jn.defineProperty(lX.prototype,"length",{value:0,configurable:!1,writable:!0,enumerable:!0});lX.prototype.isOperational=!0;var cB=0;lX.prototype.toString=function(){var $=Array(cB*4+1).join(" "),Y=`
`+$+`AggregateError of:
`;nA++,$=Array(nA*4+1).join(" ");for(var U=0;U<this.length;++U){var z=this[U]===this?"[Circular AggregateError]":this[U]+"",Q=z.split(`
`;cB++,$=Array(cB*4+1).join(" ");for(var U=0;U<this.length;++U){var z=this[U]===this?"[Circular AggregateError]":this[U]+"",Q=z.split(`
`);for(var J=0;J<Q.length;++J)Q[J]=$+Q[J];z=Q.join(`
`),Y+=z+`
`}return nA--,Y};function mX($){if(!(this instanceof mX))return new mX($);if(yI(this,"name","OperationalError"),yI(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)yI(this,"message",$.message),yI(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}$O0(mX,Error);var $z=Error.__BluebirdErrorTypes__;if(!$z)$z=GL1({CancellationError:WL1,TimeoutError:XL1,OperationalError:mX,RejectionError:mX,AggregateError:lX}),Bn.defineProperty(Error,"__BluebirdErrorTypes__",{value:$z,writable:!1,enumerable:!1,configurable:!1});YO0.exports={Error,TypeError:Dn,RangeError:An,CancellationError:$z.CancellationError,OperationalError:$z.OperationalError,TimeoutError:$z.TimeoutError,AggregateError:$z.AggregateError,Warning:HL1}});var zO0=E((ut1,UO0)=>{UO0.exports=function($,Y){var U=O4(),z=U.errorObj,Q=U.isObject;function J(X,Z){if(Q(X)){if(X instanceof $)return X;var q=K(X);if(q===z){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 I(X){return X.then}function K(X){try{return I(X)}catch(Z){return z.e=Z,z}}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),F=V;if(q)q._pushContext();if(V._captureStackTrace(),q)q._popContext();var w=!0,O=U.tryCatch(Z).call(X,M,N);if(w=!1,V&&O===z)V._rejectCallback(O.e,!0,!0),V=null;function M(D){if(!V)return;V._resolveCallback(D),V=null}function N(D){if(!V)return;V._rejectCallback(D,w,!0),V=null}return F}return J}});var JO0=E((bt1,QO0)=>{QO0.exports=function($,Y,U,z,Q){var J=O4(),I=J.isArray;function K(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=z("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(K(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 F=U(H[V],X);if(F instanceof $)F=F._target(),q=F._bitField;else q=null;if(Z){if(q!==null)F.suppressUnhandledRejections()}else if(q!==null)if((q&50397184)===0)F._proxy(this,V),this._values[V]=F;else if((q&33554432)!==0)Z=this._promiseFulfilled(F._value(),V);else if((q&16777216)!==0)Z=this._promiseRejected(F._reason(),V);else Z=this._promiseCancelled(V);else Z=this._promiseFulfilled(F,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 KO0=E((it1,IO0)=>{IO0.exports=function($){var Y=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function z(){this._trace=new z.CapturedTrace(J())}z.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},z.prototype._popContext=function(){if(this._trace!==void 0){var I=U.pop(),K=I._promiseCreated;return I._promiseCreated=null,K}return null};function Q(){if(Y)return new z}function J(){var I=U.length-1;if(I>=0)return U[I];return}return z.CapturedTrace=null,z.create=Q,z.deactivateLong Line truncated
`}return cB--,Y};function mX($){if(!(this instanceof mX))return new mX($);if(yI(this,"name","OperationalError"),yI(this,"message",$),this.cause=$,this.isOperational=!0,$ instanceof Error)yI(this,"message",$.message),yI(this,"stack",$.stack);else if(Error.captureStackTrace)Error.captureStackTrace(this,this.constructor)}zw0(mX,Error);var $z=Error.__BluebirdErrorTypes__;if(!$z)$z=NL1({CancellationError:BL1,TimeoutError:AL1,OperationalError:mX,RejectionError:mX,AggregateError:lX}),jn.defineProperty(Error,"__BluebirdErrorTypes__",{value:$z,writable:!1,enumerable:!1,configurable:!1});Qw0.exports={Error,TypeError:Pn,RangeError:Tn,CancellationError:$z.CancellationError,OperationalError:$z.OperationalError,TimeoutError:$z.TimeoutError,AggregateError:$z.AggregateError,Warning:DL1}});var Iw0=E((rt1,Jw0)=>{Jw0.exports=function($,Y){var U=O4(),z=U.errorObj,Q=U.isObject;function J(X,Z){if(Q(X)){if(X instanceof $)return X;var q=K(X);if(q===z){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 I(X){return X.then}function K(X){try{return I(X)}catch(Z){return z.e=Z,z}}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),F=V;if(q)q._pushContext();if(V._captureStackTrace(),q)q._popContext();var O=!0,w=U.tryCatch(Z).call(X,N,M);if(O=!1,V&&w===z)V._rejectCallback(w.e,!0,!0),V=null;function N(D){if(!V)return;V._resolveCallback(D),V=null}function M(D){if(!V)return;V._rejectCallback(D,O,!0),V=null}return F}return J}});var Gw0=E((st1,Kw0)=>{Kw0.exports=function($,Y,U,z,Q){var J=O4(),I=J.isArray;function K(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=z("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(K(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 F=U(H[V],X);if(F instanceof $)F=F._target(),q=F._bitField;else q=null;if(Z){if(q!==null)F.suppressUnhandledRejections()}else if(q!==null)if((q&50397184)===0)F._proxy(this,V),this._values[V]=F;else if((q&33554432)!==0)Z=this._promiseFulfilled(F._value(),V);else if((q&16777216)!==0)Z=this._promiseRejected(F._reason(),V);else Z=this._promiseCancelled(V);else Z=this._promiseFulfilled(F,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 Ww0=E((at1,Hw0)=>{Hw0.exports=function($){var Y=!1,U=[];$.prototype._promiseCreated=function(){},$.prototype._pushContext=function(){},$.prototype._popContext=function(){return null},$._peekContext=$.prototype._peekContext=function(){};function z(){this._trace=new z.CapturedTrace(J())}z.prototype._pushContext=function(){if(this._trace!==void 0)this._trace._promiseCreated=null,U.push(this._trace)},z.prototype._popContext=function(){if(this._trace!==void 0){var I=U.pop(),K=I._promiseCreated;return I._promiseCreated=null,K}return null};function Q(){if(Y)return new z}function J(){var I=U.length-1;if(I>=0)return U[I];return}return z.CapturedTrace=null,z.create=Q,z.deactivateLong Line truncated
See http://goo.gl/MqrFmX
`);if(!A0.longStackTraces&&b0()){var Q0=$.prototype._captureStackTrace,B=$.prototype._attachExtraTrace;A0.longStackTraces=!0,D=function(){if(z.haveItemsQueued()&&!A0.longStackTraces)throw Error(`cannot enable long stack traces after promises have been created
`);if(!B0.longStackTraces&&b0()){var Q0=$.prototype._captureStackTrace,A=$.prototype._attachExtraTrace;B0.longStackTraces=!0,D=function(){if(z.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=B,Y.deactivateLongStackTraces(),z.enableTrampoline(),A0.longStackTraces=!1},$.prototype._captureStackTrace=g,$.prototype._attachExtraTrace=p,Y.activateLongStackTraces(),z.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return A0.longStackTraces&&b0()};var P=function(){try{if(typeof CustomEvent==="function"){var Q0=new CustomEvent("CustomEvent");return J.global.dispatchEvent(Q0),function(B,v){var u=new CustomEvent(B.toLowerCase(),{detail:v,cancelable:!0});return!J.global.dispatchEvent(u)}}else if(typeof Event==="function"){var Q0=new Event("CustomEvent");return J.global.dispatchEvent(Q0),function(v,u){var a=new Event(v.toLowerCase(),{cancelable:!0});return a.detail=u,!J.global.dispatchEvent(a)}}else{var Q0=document.createEvent("CustomEvent");return Q0.initCustomEvent("testingtheevent",!1,!0,{}),J.global.dispatchEvent(Q0),function(v,u){var a=document.createEvent("CustomEvent");return a.initCustomEvent(v.toLowerCase(),!1,!0,u),!J.global.dispatchEvent(a)}}}catch(B){}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 B="on"+Q0.toLowerCase(),v=J.global[B];if(!v)return!1;return v.apply(J.global,[].slice.call(arguments,1)),!0}}}();function A(Q0,B){return{promise:B}}var j={promiseCreated:A,promiseFulfilled:A,promiseRejected:A,promiseResolved:A,promiseCancelled:A,promiseChained:function(Q0,B,v){return{promise:B,child:v}},warning:function(Q0,B){return{warning:B}},unhandledRejection:function(Q0,B,v){return{reason:B,promise:v}},rejectionHandled:A},C=function(Q0){var B=!1;try{B=T.apply(null,arguments)}catch(u){z.throwLater(u),B=!0}var v=!1;try{v=P(Q0,j[Q0].apply(null,arguments))}catch(u){z.throwLater(u),v=!0}return v||B};$.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 B=Q0.warnings;if(A0.warnings=!!B,N=A0.warnings,J.isObject(B)){if("wForgottenReturn"in B)N=!!B.wForgottenReturn}}if("cancellation"in Q0&&Q0.cancellation&&!A0.cancellation){if(z.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=z0,$.prototype._propagateFrom=x,$.prototype._onCancel=i,$.prototype._setOnCancel=n,$.prototype._attachCancellationCallback=S,$.prototype._execute=k,t=x,A0.cancellation=!0}if("monitoring"in Q0){if(Q0.monitoring&&!A0.monitoring)A0.monitoring=!0,$.prototype._fireEvent=C;else if(!Q0.monitoring&&A0.monitoring)A0.monitoring=!1,$.prototype._fireEvent=b}return $};function b(){return!1}$.prototype._fireEvent=b,$.prototype._execute=function(Q0,B,v){try{Q0(B,v)}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,B){};function k(Q0,B,v){var u=this;try{Q0(B,v,function(a){if(typeof a!=="function")throw TypeError("onCancel must be a function, got: "+J.toString(a));u._attachCancellationCallback(a)})}catch(a){return a}}function S(Q0){if(!this._isCancellable())return this;var B=this._onCancel();if(B!==void 0)if(J.isArray(B))B.push(Q0);else this._setOnCancel([B,Q0]);else this._setOnCancel(Q0)}function i(){return this._onCancelField}function n(Q0){this._onCancelField=Q0}function z0(){this._cancellationParent=void 0,this._onCancelField=void 0}function x(Q0,B){if((B&1)!==0){this._cancellationParent=Q0;var v=Q0._branchesRemainingToCancel;if(v===void 0)v=0;Q0._branchesRemainingToCancel=v+1}if((B&2)!==0&&Q0._isBound())this._setBoundTo(Q0._boundTo)}function d(Q0,B){if((B&2)!==0&&Q0._isBound())this._setBoundTo(Q0._boundTo)}var t=d;function e(){var Q0=this._boundTo;if(Q0!==void 0){if(Q0 instanceof $)if(Q0.isFulfilled())return Q0.value();else return}return Q0}function g(){this._trace=new u1(this._peekContext())}function p(Q0,B){if(I(Q0)){var v=this._trace;if(v!==void 0){if(B)v=v._parent}if(v!==void 0)v.attachExtraTrace(Q0);else if(!Q0.__stackCleaned__){var u=f0(Q0);J.notEnumerableProp(Q0,"stack",u.message+`
`);$.prototype._captureStackTrace=Q0,$.prototype._attachExtraTrace=A,Y.deactivateLongStackTraces(),z.enableTrampoline(),B0.longStackTraces=!1},$.prototype._captureStackTrace=g,$.prototype._attachExtraTrace=d,Y.activateLongStackTraces(),z.disableTrampolineIfNecessary()}},$.hasLongStackTraces=function(){return B0.longStackTraces&&b0()};var P=function(){try{if(typeof CustomEvent==="function"){var Q0=new CustomEvent("CustomEvent");return J.global.dispatchEvent(Q0),function(A,v){var u=new CustomEvent(A.toLowerCase(),{detail:v,cancelable:!0});return!J.global.dispatchEvent(u)}}else if(typeof Event==="function"){var Q0=new Event("CustomEvent");return J.global.dispatchEvent(Q0),function(v,u){var s=new Event(v.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(v,u){var s=document.createEvent("CustomEvent");return s.initCustomEvent(v.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(),v=J.global[A];if(!v)return!1;return v.apply(J.global,[].slice.call(arguments,1)),!0}}}();function B(Q0,A){return{promise:A}}var j={promiseCreated:B,promiseFulfilled:B,promiseRejected:B,promiseResolved:B,promiseCancelled:B,promiseChained:function(Q0,A,v){return{promise:A,child:v}},warning:function(Q0,A){return{warning:A}},unhandledRejection:function(Q0,A,v){return{reason:A,promise:v}},rejectionHandled:B},C=function(Q0){var A=!1;try{A=T.apply(null,arguments)}catch(u){z.throwLater(u),A=!0}var v=!1;try{v=P(Q0,j[Q0].apply(null,arguments))}catch(u){z.throwLater(u),v=!0}return v||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,M=B0.warnings,J.isObject(A)){if("wForgottenReturn"in A)M=!!A.wForgottenReturn}}if("cancellation"in Q0&&Q0.cancellation&&!B0.cancellation){if(z.haveItemsQueued())throw Error("cannot enable cancellation after promises are in use");$.prototype._clearCancellationData=z0,$.prototype._propagateFrom=x,$.prototype._onCancel=i,$.prototype._setOnCancel=n,$.prototype._attachCancellationCallback=S,$.prototype._execute=k,t=x,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=b}return $};function b(){return!1}$.prototype._fireEvent=b,$.prototype._execute=function(Q0,A,v){try{Q0(A,v)}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 k(Q0,A,v){var u=this;try{Q0(A,v,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 S(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 i(){return this._onCancelField}function n(Q0){this._onCancelField=Q0}function z0(){this._cancellationParent=void 0,this._onCancelField=void 0}function x(Q0,A){if((A&1)!==0){this._cancellationParent=Q0;var v=Q0._branchesRemainingToCancel;if(v===void 0)v=0;Q0._branchesRemainingToCancel=v+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 t=p;function e(){var Q0=this._boundTo;if(Q0!==void 0){if(Q0 instanceof $)if(Q0.isFulfilled())return Q0.value();else return}return Q0}function g(){this._trace=new u1(this._peekContext())}function d(Q0,A){if(I(Q0)){var v=this._trace;if(v!==void 0){if(A)v=v._parent}if(v!==void 0)v.attachExtraTrace(Q0);else if(!Q0.__stackCleaned__){var u=u0(Q0);J.notEnumerableProp(Q0,"stack",u.message+`
`+u.stack.join(`
`)),J.notEnumerableProp(Q0,"__stackCleaned__",!0)}}}function Y0(Q0,B,v,u,a){if(Q0===void 0&&B!==null&&N){if(a!==void 0&&a._returnedNonUndefined())return;if((u._bitField&65535)===0)return;if(v)v=v+" ";var Z0="",J0="";if(B._trace){var q0=B._trace.stack.split(`
`),w0=_0(q0);for(var B0=w0.length-1;B0>=0;--B0){var r0=w0[B0];if(!W.test(r0)){var I1=r0.match(X);if(I1)Z0="at "+I1[1]+":"+I1[2]+":"+I1[3]+" ";break}}if(w0.length>0){var z1=w0[0];for(var B0=0;B0<q0.length;++B0)if(q0[B0]===z1){if(B0>0)J0=`
`+q0[B0-1];break}}}var A1="a promise was created in a "+v+"handler "+Z0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(A1,!0,B)}}function y(Q0,B){var v=Q0+" is deprecated and will be removed in a future version.";if(B)v+=" Use "+B+" instead.";return r(v)}function r(Q0,B,v){if(!A0.warnings)return;var u=new Q(Q0),a;if(B)v._attachExtraTrace(u);else if(A0.longStackTraces&&(a=$._peekContext()))a.attachExtraTrace(u);else{var Z0=f0(u);u.stack=Z0.message+`
`)),J.notEnumerableProp(Q0,"__stackCleaned__",!0)}}}function Y0(Q0,A,v,u,s){if(Q0===void 0&&A!==null&&M){if(s!==void 0&&s._returnedNonUndefined())return;if((u._bitField&65535)===0)return;if(v)v=v+" ";var Z0="",J0="";if(A._trace){var q0=A._trace.stack.split(`
`),O0=_0(q0);for(var A0=O0.length-1;A0>=0;--A0){var r0=O0[A0];if(!W.test(r0)){var I1=r0.match(X);if(I1)Z0="at "+I1[1]+":"+I1[2]+":"+I1[3]+" ";break}}if(O0.length>0){var z1=O0[0];for(var A0=0;A0<q0.length;++A0)if(q0[A0]===z1){if(A0>0)J0=`
`+q0[A0-1];break}}}var A1="a promise was created in a "+v+"handler "+Z0+"but was not returned from it, see http://goo.gl/rRqMUw"+J0;u._warn(A1,!0,A)}}function y(Q0,A){var v=Q0+" is deprecated and will be removed in a future version.";if(A)v+=" Use "+A+" instead.";return r(v)}function r(Q0,A,v){if(!B0.warnings)return;var u=new Q(Q0),s;if(A)v._attachExtraTrace(u);else if(B0.longStackTraces&&(s=$._peekContext()))s.attachExtraTrace(u);else{var Z0=u0(u);u.stack=Z0.message+`
`+Z0.stack.join(`
`)}if(!C("warning",u))e0(u,"",!0)}function $0(Q0,B){for(var v=0;v<B.length-1;++v)B[v].push("From previous event:"),B[v]=B[v].join(`
`);if(v<B.length)B[v]=B[v].join(`
`)}if(!C("warning",u))U1(u,"",!0)}function $0(Q0,A){for(var v=0;v<A.length-1;++v)A[v].push("From previous event:"),A[v]=A[v].join(`
`);if(v<A.length)A[v]=A[v].join(`
`);return Q0+`
`+B.join(`
`)}function N0(Q0){for(var B=0;B<Q0.length;++B)if(Q0[B].length===0||B+1<Q0.length&&Q0[B][0]===Q0[B+1][0])Q0.splice(B,1),B--}function j0(Q0){var B=Q0[0];for(var v=1;v<Q0.length;++v){var u=Q0[v],a=B.length-1,Z0=B[a],J0=-1;for(var q0=u.length-1;q0>=0;--q0)if(u[q0]===Z0){J0=q0;break}for(var q0=J0;q0>=0;--q0){var w0=u[q0];if(B[a]===w0)B.pop(),a--;else break}B=u}}function _0(Q0){var B=[];for(var v=0;v<Q0.length;++v){var u=Q0[v],a=u===" (No stack trace)"||Z.test(u),Z0=a&&i0(u);if(a&&!Z0){if(V&&u.charAt(0)!==" ")u=" "+u;B.push(u)}}return B}function G0(Q0){var B=Q0.stack.replace(/\s+$/g,"").split(`
`);for(var v=0;v<B.length;++v){var u=B[v];if(u===" (No stack trace)"||Z.test(u))break}if(v>0&&Q0.name!="SyntaxError")B=B.slice(v);return B}function f0(Q0){var B=Q0.stack,v=Q0.toString();return B=typeof B==="string"&&B.length>0?G0(Q0):[" (No stack trace)"],{message:v,stack:Q0.name=="SyntaxError"?B:_0(B)}}function e0(Q0,B,v){if(typeof console<"u"){var u;if(J.isObject(Q0)){var a=Q0.stack;u=B+q(a,Q0)}else u=B+String(Q0);if(typeof F==="function")F(u,v);else if(typeof console.log==="function"||typeof console.log==="object")console.log(u)}}function s(Q0,B,v,u){var a=!1;try{if(typeof B==="function")if(a=!0,Q0==="rejectionHandled")B(u);else B(v,u)}catch(Z0){z.throwLater(Z0)}if(Q0==="unhandledRejection"){if(!C(Q0,v,u)&&!a)e0(v,"Unhandled rejection ")}else C(Q0,u)}function H0(Q0){var B;if(typeof Q0==="function")B="[function "+(Q0.name||"anonymous")+"]";else{B=Q0&&typeof Q0.toString==="function"?Q0.toString():J.toString(Q0);var v=/\[object [a-zA-Z0-9$_]+\]/;if(v.test(B))try{var u=JSON.stringify(Q0);B=u}catch(a){}if(B.length===0)B="(empty array)"}return"(<"+F0(B)+">, no stack trace)"}function F0(Q0){var B=41;if(Q0.length<B)return Q0;return Q0.substr(0,B-3)+"..."}function b0(){return typeof b1==="function"}var i0=function(){return!1},n0=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function w1(Q0){var B=Q0.match(n0);if(B)return{fileName:B[1],line:parseInt(B[2],10)}}function k1(Q0,B){if(!b0())return;var v=Q0.stack.split(`
`),u=B.stack.split(`
`),a=-1,Z0=-1,J0,q0;for(var w0=0;w0<v.length;++w0){var B0=w1(v[w0]);if(B0){J0=B0.fileName,a=B0.line;break}}for(var w0=0;w0<u.length;++w0){var B0=w1(u[w0]);if(B0){q0=B0.fileName,Z0=B0.line;break}}if(a<0||Z0<0||!J0||!q0||J0!==q0||a>=Z0)return;i0=function(r0){if(H.test(r0))return!0;var I1=w1(r0);if(I1){if(I1.fileName===J0&&(a<=I1.line&&I1.line<=Z0))return!0}return!1}}function u1(Q0){this._parent=Q0,this._promisesCreated=0;var B=this._length=1+(Q0===void 0?0:Q0._length);if(b1(this,u1),B>32)this.uncycle()}J.inherits(u1,Error),Y.CapturedTrace=u1,u1.prototype.uncycle=function(){var Q0=this._length;if(Q0<2)return;var B=[],v={};for(var u=0,a=this;a!==void 0;++u)B.push(a),a=a._parent;Q0=this._length=u;for(var u=Q0-1;u>=0;--u){var Z0=B[u].stack;if(v[Z0]===void 0)v[Z0]=u}for(var u=0;u<Q0;++u){var J0=B[u].stack,q0=v[J0];if(q0!==void 0&&q0!==u){if(q0>0)B[q0-1]._parent=void 0,B[q0-1]._length=1;B[u]._parent=void 0,B[u]._length=1;var w0=u>0?B[u-1]:this;if(q0<Q0-1)w0._parent=B[q0+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)B[r0]._length=B0,B0++;return}}},u1.prototype.attachExtraTrace=function(Q0){if(Q0.__stackCleaned__)return;this.uncycle();var B=f0(Q0),v=B.message,u=[B.stack],a=this;while(a!==void 0)u.push(_0(a.stack.split(`
`))),a=a._parent;j0(u),N0(u),J.notEnumerableProp(Q0,"stack",$0(v,u)),J.notEnumerableProp(Q0,"__stackCleaned__",!0)};var b1=function(){var B=/^\s*at\s*/,v=function(J0,q0){if(typeof J0==="string")return J0;if(q0.name!==void 0&&q0.message!==void 0)return q0.toString();return H0(q0)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,Z=B,q=v;var u=Error.captureStackTrace;return i0=function(J0){return H.test(J0)},function(J0,q0){Error.stackTraceLimit+=6,u(J0,q0),Error.stackTraceLimit-=6}}var a=Error();if(typeof a.stack==="string"&&a.stack.split(`
`)[0].indexOf("stackDetection@")>=0)return Z=/@/,q=v,V=!0,function(q0){q0.stack=Error().stack};var Z0;try{throw Error()}catch(J0){Z0="stack"in J0}if(!("stack"in a)&&Z0&&typeof Error.stackTraceLimit==="number")return Z=B,q=v,function(q0){Error.stackTraceLimit+=6;try{throw Error()}catch(w0){q0.stack=w0.stack}Error.stackTraceLimit-=6};return q=function(J0,q0){if(typeof J0==="string")return J0;if((typeof q0==="object"||typeof q0==="function")&&q0.name!==void 0&&q0.message!==void 0)return q0.toString();return H0(q0)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(F=function(Q0){console.warn(Q0)},J.isNode&&process.stderr.isTTY)F=function(Q0,B){var v=B?"\x1B[33m":"\x1B[31m";console.warn(v+Q0+`\x1B[0m
`)};else if(!J.isNode&&typeof Error().stack==="string")F=function(Q0,B){console.warn("%c"+Q0,B?"color: darkorange":"color: red")}}var A0={warnings:O,longStackTraces:!1,cancellation:!1,monitoring:!1};if(M)$.longStackTraces();return{longStackTraces:function(){return A0.longStackTraces},warnings:function(){return A0.warnings},cancellation:function(){return A0.cancellation},monitoring:function(){return A0.monitoring},propagateFromFunction:function(){return t},boundValueFunction:function(){return e},checkForgottenReturns:Y0,setBounds:k1,warn:r,deprecated:y,CapturedTrace:u1,fireDomEvent:P,fireGlobalEvent:T}}});var XO0=E((ct1,WO0)=>{WO0.exports=function($,Y){var U=O4(),z=$.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 I(X){this.finallyHandler=X}I.prototype._resultCancelled=function(){K(this.finallyHandler)};function K(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(K(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 F=Y(V,Z);if(F instanceof $){if(this.cancelPromise!=null){if(F._isCancelled()){var w=new z("late cancellation observer");return Z._attachExtraTrace(w),Q.e=w,Q}else if(F.isPending())F._attachCancellationCallback(new I(this))}return F._then(G,H,void 0,this,void 0)}}}if(Z.isRejected())return K(this),Q.e=X,Q;else return K(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 qO0=E((pt1,ZO0)=>{ZO0.exports=function($){var Y=O4(),U=aU().keys,z=Y.tryCatch,Q=Y.errorObj;function J(I,K,G){return function(H){var W=G._boundValue();$:for(var X=0;X<I.length;++X){var Z=I[X];if(Z===Error||Z!=null&&Z.prototype instanceof Error){if(H instanceof Z)return z(K).call(W,H)}else if(typeof Z==="function"){var q=z(Z).call(W,H);if(q===Q)return q;else if(q)return z(K).call(W,H)}else if(Y.isObject(H)){var V=U(Z);for(var F=0;F<V.length;++F){var w=V[F];if(Z[w]!=H[w])continue $}return z(K).call(W,H)}}return $}}return J}});var Pn=E((dt1,FO0)=>{var VO0=O4(),ZL1=VO0.maybeWrapAsError,qL1=E3(),VL1=qL1.OperationalError,LO0=aU();function LL1($){return $ instanceof Error&&LO0.getPrototypeOf($)===Error.prototype}var FL1=/^(?:name|message|stack|cause)$/;function OL1($){var Y;if(LL1($)){Y=new VL1($),Y.name=$.name,Y.message=$.message,Y.stack=$.stack;var U=LO0.keys($);for(var z=0;z<U.length;++z){var Q=U[z];if(!FL1.test(Q))Y[Q]=$[Q]}return Y}return VO0.markAsOriginatingFromRejection($),$}function wL1($,Y){return function(U,z){if($===null)return;if(U){var Q=OL1(ZL1(U));$._attachExtraTrace(Q),$._reject(Q)}else if(!Y)$._fulfill(z);else{var J=arguments.length,I=Array(Math.max(J-1,0));for(var K=1;K<J;++K)I[K-1]=arguments[K];$._fulfill(I)}$=null}}FO0.exports=wL1});var wO0=E((mt1,OO0)=>{OO0.exports=function($,Y,U,z,Q){var J=O4(),I=J.tryCatch;$.method=function(K){if(typeof K!=="function")throw new $.TypeError("expecting a function but got "+J.classString(K));return function(){var G=new $(Y);G._captureStackTrace(),G._pushContext();var H=I(K).apply(this,arguments),W=G._popContext();return Q.checkForgottenReturns(H,W,"Promise.method",G),G._resolveFromSyncValue(H),G}},$.attempt=$.try=function(K){if(typeof K!=="function")return z("expecting a function but got "+J.classString(K));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)?I(K).apply(X,W):I(K).call(X,W)}else H=I(K)();var Z=G._popContext();return Q.checkForgottenReturns(H,Z,"Promise.try",G),G._resolveFromSyncValue(H),G},$.prototype._resolveFromSyncValue=function(K){if(K===J.errorObj)this._rejectCallback(K.e,!1);else this._resolveCallback(K,!0)}}});var NO0=E((lt1,MO0)=>{MO0.exports=function($,Y,U,z){var Q=!1,J=function(H,W){this._reject(W)},I=function(H,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(J,J,null,this,H)},K=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=z.propagateFromFunction(),$.prototype._boundValue=z.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,I,voi Line truncated
`+A.join(`
`)}function N0(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 j0(Q0){var A=Q0[0];for(var v=1;v<Q0.length;++v){var u=Q0[v],s=A.length-1,Z0=A[s],J0=-1;for(var q0=u.length-1;q0>=0;--q0)if(u[q0]===Z0){J0=q0;break}for(var q0=J0;q0>=0;--q0){var O0=u[q0];if(A[s]===O0)A.pop(),s--;else break}A=u}}function _0(Q0){var A=[];for(var v=0;v<Q0.length;++v){var u=Q0[v],s=u===" (No stack trace)"||Z.test(u),Z0=s&&i0(u);if(s&&!Z0){if(V&&u.charAt(0)!==" ")u=" "+u;A.push(u)}}return A}function G0(Q0){var A=Q0.stack.replace(/\s+$/g,"").split(`
`);for(var v=0;v<A.length;++v){var u=A[v];if(u===" (No stack trace)"||Z.test(u))break}if(v>0&&Q0.name!="SyntaxError")A=A.slice(v);return A}function u0(Q0){var A=Q0.stack,v=Q0.toString();return A=typeof A==="string"&&A.length>0?G0(Q0):[" (No stack trace)"],{message:v,stack:Q0.name=="SyntaxError"?A:_0(A)}}function U1(Q0,A,v){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 F==="function")F(u,v);else if(typeof console.log==="function"||typeof console.log==="object")console.log(u)}}function a(Q0,A,v,u){var s=!1;try{if(typeof A==="function")if(s=!0,Q0==="rejectionHandled")A(u);else A(v,u)}catch(Z0){z.throwLater(Z0)}if(Q0==="unhandledRejection"){if(!C(Q0,v,u)&&!s)U1(v,"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 v=/\[object [a-zA-Z0-9$_]+\]/;if(v.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 b0(){return typeof b1==="function"}var i0=function(){return!1},n0=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function O1(Q0){var A=Q0.match(n0);if(A)return{fileName:A[1],line:parseInt(A[2],10)}}function k1(Q0,A){if(!b0())return;var v=Q0.stack.split(`
`),u=A.stack.split(`
`),s=-1,Z0=-1,J0,q0;for(var O0=0;O0<v.length;++O0){var A0=O1(v[O0]);if(A0){J0=A0.fileName,s=A0.line;break}}for(var O0=0;O0<u.length;++O0){var A0=O1(u[O0]);if(A0){q0=A0.fileName,Z0=A0.line;break}}if(s<0||Z0<0||!J0||!q0||J0!==q0||s>=Z0)return;i0=function(r0){if(H.test(r0))return!0;var I1=O1(r0);if(I1){if(I1.fileName===J0&&(s<=I1.line&&I1.line<=Z0))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=[],v={};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 Z0=A[u].stack;if(v[Z0]===void 0)v[Z0]=u}for(var u=0;u<Q0;++u){var J0=A[u].stack,q0=v[J0];if(q0!==void 0&&q0!==u){if(q0>0)A[q0-1]._parent=void 0,A[q0-1]._length=1;A[u]._parent=void 0,A[u]._length=1;var O0=u>0?A[u-1]:this;if(q0<Q0-1)O0._parent=A[q0+1],O0._parent.uncycle(),O0._length=O0._parent._length+1;else O0._parent=void 0,O0._length=1;var A0=O0._length+1;for(var r0=u-2;r0>=0;--r0)A[r0]._length=A0,A0++;return}}},u1.prototype.attachExtraTrace=function(Q0){if(Q0.__stackCleaned__)return;this.uncycle();var A=u0(Q0),v=A.message,u=[A.stack],s=this;while(s!==void 0)u.push(_0(s.stack.split(`
`))),s=s._parent;j0(u),N0(u),J.notEnumerableProp(Q0,"stack",$0(v,u)),J.notEnumerableProp(Q0,"__stackCleaned__",!0)};var b1=function(){var A=/^\s*at\s*/,v=function(J0,q0){if(typeof J0==="string")return J0;if(q0.name!==void 0&&q0.message!==void 0)return q0.toString();return X0(q0)};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6,Z=A,q=v;var u=Error.captureStackTrace;return i0=function(J0){return H.test(J0)},function(J0,q0){Error.stackTraceLimit+=6,u(J0,q0),Error.stackTraceLimit-=6}}var s=Error();if(typeof s.stack==="string"&&s.stack.split(`
`)[0].indexOf("stackDetection@")>=0)return Z=/@/,q=v,V=!0,function(q0){q0.stack=Error().stack};var Z0;try{throw Error()}catch(J0){Z0="stack"in J0}if(!("stack"in s)&&Z0&&typeof Error.stackTraceLimit==="number")return Z=A,q=v,function(q0){Error.stackTraceLimit+=6;try{throw Error()}catch(O0){q0.stack=O0.stack}Error.stackTraceLimit-=6};return q=function(J0,q0){if(typeof J0==="string")return J0;if((typeof q0==="object"||typeof q0==="function")&&q0.name!==void 0&&q0.message!==void 0)return q0.toString();return X0(q0)},null}([]);if(typeof console<"u"&&typeof console.warn<"u"){if(F=function(Q0){console.warn(Q0)},J.isNode&&process.stderr.isTTY)F=function(Q0,A){var v=A?"\x1B[33m":"\x1B[31m";console.warn(v+Q0+`\x1B[0m
`)};else if(!J.isNode&&typeof Error().stack==="string")F=function(Q0,A){console.warn("%c"+Q0,A?"color: darkorange":"color: red")}}var B0={warnings:w,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 t},boundValueFunction:function(){return e},checkForgottenReturns:Y0,setBounds:k1,warn:r,deprecated:y,CapturedTrace:u1,fireDomEvent:P,fireGlobalEvent:T}}});var Vw0=E((et1,qw0)=>{qw0.exports=function($,Y){var U=O4(),z=$.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 I(X){this.finallyHandler=X}I.prototype._resultCancelled=function(){K(this.finallyHandler)};function K(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(K(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 F=Y(V,Z);if(F instanceof $){if(this.cancelPromise!=null){if(F._isCancelled()){var O=new z("late cancellation observer");return Z._attachExtraTrace(O),Q.e=O,Q}else if(F.isPending())F._attachCancellationCallback(new I(this))}return F._then(G,H,void 0,this,void 0)}}}if(Z.isRejected())return K(this),Q.e=X,Q;else return K(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 Fw0=E(($e1,Lw0)=>{Lw0.exports=function($){var Y=O4(),U=aU().keys,z=Y.tryCatch,Q=Y.errorObj;function J(I,K,G){return function(H){var W=G._boundValue();$:for(var X=0;X<I.length;++X){var Z=I[X];if(Z===Error||Z!=null&&Z.prototype instanceof Error){if(H instanceof Z)return z(K).call(W,H)}else if(typeof Z==="function"){var q=z(Z).call(W,H);if(q===Q)return q;else if(q)return z(K).call(W,H)}else if(Y.isObject(H)){var V=U(Z);for(var F=0;F<V.length;++F){var O=V[F];if(Z[O]!=H[O])continue $}return z(K).call(W,H)}}return $}}return J}});var En=E((Ye1,Mw0)=>{var ww0=O4(),PL1=ww0.maybeWrapAsError,TL1=_3(),jL1=TL1.OperationalError,Ow0=aU();function EL1($){return $ instanceof Error&&Ow0.getPrototypeOf($)===Error.prototype}var CL1=/^(?:name|message|stack|cause)$/;function RL1($){var Y;if(EL1($)){Y=new jL1($),Y.name=$.name,Y.message=$.message,Y.stack=$.stack;var U=Ow0.keys($);for(var z=0;z<U.length;++z){var Q=U[z];if(!CL1.test(Q))Y[Q]=$[Q]}return Y}return ww0.markAsOriginatingFromRejection($),$}function _L1($,Y){return function(U,z){if($===null)return;if(U){var Q=RL1(PL1(U));$._attachExtraTrace(Q),$._reject(Q)}else if(!Y)$._fulfill(z);else{var J=arguments.length,I=Array(Math.max(J-1,0));for(var K=1;K<J;++K)I[K-1]=arguments[K];$._fulfill(I)}$=null}}Mw0.exports=_L1});var Dw0=E((Ue1,Nw0)=>{Nw0.exports=function($,Y,U,z,Q){var J=O4(),I=J.tryCatch;$.method=function(K){if(typeof K!=="function")throw new $.TypeError("expecting a function but got "+J.classString(K));return function(){var G=new $(Y);G._captureStackTrace(),G._pushContext();var H=I(K).apply(this,arguments),W=G._popContext();return Q.checkForgottenReturns(H,W,"Promise.method",G),G._resolveFromSyncValue(H),G}},$.attempt=$.try=function(K){if(typeof K!=="function")return z("expecting a function but got "+J.classString(K));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)?I(K).apply(X,W):I(K).call(X,W)}else H=I(K)();var Z=G._popContext();return Q.checkForgottenReturns(H,Z,"Promise.try",G),G._resolveFromSyncValue(H),G},$.prototype._resolveFromSyncValue=function(K){if(K===J.errorObj)this._rejectCallback(K.e,!1);else this._resolveCallback(K,!0)}}});var Aw0=E((ze1,Bw0)=>{Bw0.exports=function($,Y,U,z){var Q=!1,J=function(H,W){this._reject(W)},I=function(H,W){W.promiseRejectionQueued=!0,W.bindingPromise._then(J,J,null,this,H)},K=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=z.propagateFromFunction(),$.prototype._boundValue=z.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,I,voi Line truncated
See http://goo.gl/MqrFmX
`);return this._settledValue()},z=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},I=Y.prototype.isPending=function(){return(this._bitField&50397184)===0},K=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 I.call(this._target())},$.prototype.isRejected=function(){return J.call(this._target())},$.prototype.isFulfilled=function(){return Q.call(this._target())},$.prototype.isResolved=function(){return K.call(this._target())},$.prototype.value=function(){return U.call(this._target())},$.prototype.reason=function(){var G=this._target();return G._unsetRejectionIsUnhandled(),z.call(G)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=Y}});var CO0=E((at1,EO0)=>{EO0.exports=function($,Y,U,z,Q,J){var I=O4(),K=I.canEvaluate,G=I.tryCatch,H=I.errorObj,W;if(K){var X=function(M){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},I=Y.prototype.isPending=function(){return(this._bitField&50397184)===0},K=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 I.call(this._target())},$.prototype.isRejected=function(){return J.call(this._target())},$.prototype.isFulfilled=function(){return Q.call(this._target())},$.prototype.isResolved=function(){return K.call(this._target())},$.prototype.value=function(){return U.call(this._target())},$.prototype.reason=function(){var G=this._target();return G._unsetRejectionIsUnhandled(),z.call(G)},$.prototype._value=function(){return this._settledValue()},$.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue()},$.PromiseInspection=Y}});var vw0=E((Ke1,_w0)=>{_w0.exports=function($,Y,U,z,Q,J){var I=O4(),K=I.canEvaluate,G=I.tryCatch,H=I.errorObj,W;if(K){var X=function(N){return Function("value","holder",`
'use strict';
holder.pIndex = value;
holder.checkFulfillment(this);
`.replace(/Index/g,M))},Z=function(M){return Function("promise","holder",`
`.replace(/Index/g,N))},Z=function(N){return Function("promise","holder",`
'use strict';
holder.pIndex = promise;
`.replace(/Index/g,M))},q=function(M){var N=Array(M);for(var D=0;D<N.length;++D)N[D]="this.p"+(D+1);var P=N.join(" = ")+" = null;",T=`var promise;
`+N.map(function(b){return`
`.replace(/Index/g,N))},q=function(N){var M=Array(N);for(var D=0;D<M.length;++D)M[D]="this.p"+(D+1);var P=M.join(" = ")+" = null;",T=`var promise;
`+M.map(function(b){return`
promise = `+b+`;
if (promise instanceof Promise) {
promise.cancel();
}
`}).join(`
`),A=N.join(", "),j="Holder$"+M,C=`return function(tryCatch, errorObj, Promise, async) {
`),B=M.join(", "),j="Holder$"+N,C=`return function(tryCatch, errorObj, Promise, async) {
'use strict';
function [TheName](fn) {
[TheProperties]
@@ -199,7 +199,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof E6))r
return [TheName];
}(tryCatch, errorObj, Promise, async);
`;return C=C.replace(/\[TheName\]/g,j).replace(/\[TheTotal\]/g,M).replace(/\[ThePassedArguments\]/g,A).replace(/\[TheProperties\]/g,P).replace(/\[CancellationCode\]/g,T),Function("tryCatch","errorObj","Promise","async",C)(G,H,$,Q)},V=[],F=[],w=[];for(var O=0;O<8;++O)V.push(q(O+1)),F.push(X(O+1)),w.push(Z(O+1));W=function(M){this._reject(M)}}$.join=function(){var M=arguments.length-1,N;if(M>0&&typeof arguments[M]==="function"){if(N=arguments[M],M<=8&&K){var n=new $(z);n._captureStackTrace();var D=V[M-1],P=new D(N),T=F;for(var A=0;A<M;++A){var j=U(arguments[A],n);if(j instanceof $){j=j._target();var C=j._bitField;if((C&50397184)===0)j._then(T[A],W,void 0,n,P),w[A](j,P),P.asyncNeeded=!1;else if((C&33554432)!==0)T[A].call(n,j._value(),P);else if((C&16777216)!==0)n._reject(j._reason());else n._cancel()}else T[A].call(n,j,P)}if(!n._isFateSealed()){if(P.asyncNeeded){var b=J();if(b!==null)P.fn=I.domainBind(b,P.fn)}n._setAsyncGuaranteed(),n._setOnCancel(P)}return n}}var k=arguments.length,S=Array(k);for(var i=0;i<k;++i)S[i]=arguments[i];if(N)S.pop();var n=new Y(S).promise();return N!==void 0?n.spread(N):n}}});var _O0=E((tt1,RO0)=>{RO0.exports=function($,Y,U,z,Q,J){var I=$._getDomain,K=O4(),G=K.tryCatch,H=K.errorObj,W=$._async;function X(q,V,F,w){this.constructor$(q),this._promise._captureStackTrace();var O=I();this._callback=O===null?V:K.domainBind(O,V),this._preservedValues=w===Q?Array(this.length()):null,this._limit=F,this._inFlight=0,this._queue=[],W.invoke(this._asyncInit,this,void 0)}K.inherits(X,Y),X.prototype._asyncInit=function(){this._init$(void 0,-2)},X.prototype._init=function(){},X.prototype._promiseFulfilled=function(q,V){var F=this._values,w=this.length(),O=this._preservedValues,M=this._limit;if(V<0){if(V=V*-1-1,F[V]=q,M>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(M>=1&&this._inFlight>=M)return F[V]=q,this._queue.push(V),!1;if(O!==null)O[V]=q;var N=this._promise,D=this._callback,P=N._boundValue();N._pushContext();var T=G(D).call(P,q,V,w),A=N._popContext();if(J.checkForgottenReturns(T,A,O!==null?"Promise.filter":"Promise.map",N),T===H)return this._reject(T.e),!0;var j=z(T,this._promise);if(j instanceof $){j=j._target();var C=j._bitField;if((C&50397184)===0){if(M>=1)this._inFlight++;return F[V]=j,j._proxy(this,(V+1)*-1),!1}else if((C&33554432)!==0)T=j._value();else if((C&16777216)!==0)return this._reject(j._reason()),!0;else return this._cancel(),!0}F[V]=T}var b=++this._totalResolved;if(b>=w){if(O!==null)this._filter(F,O);else this._resolve(F);return!0}return!1},X.prototype._drainQueue=function(){var q=this._queue,V=this._limit,F=this._values;while(q.length>0&&this._inFlight<V){if(this._isResolved())return;var w=q.pop();this._promiseFulfilled(F[w],w)}},X.prototype._filter=function(q,V){var F=V.length,w=Array(F),O=0;for(var M=0;M<F;++M)if(q[M])w[O++]=V[M];w.length=O,this._resolve(w)},X.prototype.preservedValues=function(){return this._preservedValues};function Z(q,V,F,w){if(typeof V!=="function")return U("expecting a function but got "+K.classString(V));var O=0;if(F!==void 0)if(typeof F==="object"&&F!==null){if(typeof F.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+K.classString(F.concurrency)));O=F.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+K.classString(F)));return O=typeof O==="number"&&isFinite(O)&&O>=1?O:0,new X(q,V,O,w).promise()}$.prototype.map=function(q,V){return Z(this,q,V,null)},$.map=function(q,V,F,w){return Z(q,V,F,w)}}});var hO0=E((et1,vO0)=>{var Tn=Object.create;if(Tn)cA=Tn(null),pA=Tn(null),cA[" size"]=pA[" size"]=0;var cA,pA;vO0.exports=function($){var Y=O4(),U=Y.canEvaluate,z=Y.isIdentifier,Q,J,I=function(q){return Function("ensureMethod",`
`;return C=C.replace(/\[TheName\]/g,j).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=[],F=[],O=[];for(var w=0;w<8;++w)V.push(q(w+1)),F.push(X(w+1)),O.push(Z(w+1));W=function(N){this._reject(N)}}$.join=function(){var N=arguments.length-1,M;if(N>0&&typeof arguments[N]==="function"){if(M=arguments[N],N<=8&&K){var n=new $(z);n._captureStackTrace();var D=V[N-1],P=new D(M),T=F;for(var B=0;B<N;++B){var j=U(arguments[B],n);if(j instanceof $){j=j._target();var C=j._bitField;if((C&50397184)===0)j._then(T[B],W,void 0,n,P),O[B](j,P),P.asyncNeeded=!1;else if((C&33554432)!==0)T[B].call(n,j._value(),P);else if((C&16777216)!==0)n._reject(j._reason());else n._cancel()}else T[B].call(n,j,P)}if(!n._isFateSealed()){if(P.asyncNeeded){var b=J();if(b!==null)P.fn=I.domainBind(b,P.fn)}n._setAsyncGuaranteed(),n._setOnCancel(P)}return n}}var k=arguments.length,S=Array(k);for(var i=0;i<k;++i)S[i]=arguments[i];if(M)S.pop();var n=new Y(S).promise();return M!==void 0?n.spread(M):n}}});var Sw0=E((Ge1,hw0)=>{hw0.exports=function($,Y,U,z,Q,J){var I=$._getDomain,K=O4(),G=K.tryCatch,H=K.errorObj,W=$._async;function X(q,V,F,O){this.constructor$(q),this._promise._captureStackTrace();var w=I();this._callback=w===null?V:K.domainBind(w,V),this._preservedValues=O===Q?Array(this.length()):null,this._limit=F,this._inFlight=0,this._queue=[],W.invoke(this._asyncInit,this,void 0)}K.inherits(X,Y),X.prototype._asyncInit=function(){this._init$(void 0,-2)},X.prototype._init=function(){},X.prototype._promiseFulfilled=function(q,V){var F=this._values,O=this.length(),w=this._preservedValues,N=this._limit;if(V<0){if(V=V*-1-1,F[V]=q,N>=1){if(this._inFlight--,this._drainQueue(),this._isResolved())return!0}}else{if(N>=1&&this._inFlight>=N)return F[V]=q,this._queue.push(V),!1;if(w!==null)w[V]=q;var M=this._promise,D=this._callback,P=M._boundValue();M._pushContext();var T=G(D).call(P,q,V,O),B=M._popContext();if(J.checkForgottenReturns(T,B,w!==null?"Promise.filter":"Promise.map",M),T===H)return this._reject(T.e),!0;var j=z(T,this._promise);if(j instanceof $){j=j._target();var C=j._bitField;if((C&50397184)===0){if(N>=1)this._inFlight++;return F[V]=j,j._proxy(this,(V+1)*-1),!1}else if((C&33554432)!==0)T=j._value();else if((C&16777216)!==0)return this._reject(j._reason()),!0;else return this._cancel(),!0}F[V]=T}var b=++this._totalResolved;if(b>=O){if(w!==null)this._filter(F,w);else this._resolve(F);return!0}return!1},X.prototype._drainQueue=function(){var q=this._queue,V=this._limit,F=this._values;while(q.length>0&&this._inFlight<V){if(this._isResolved())return;var O=q.pop();this._promiseFulfilled(F[O],O)}},X.prototype._filter=function(q,V){var F=V.length,O=Array(F),w=0;for(var N=0;N<F;++N)if(q[N])O[w++]=V[N];O.length=w,this._resolve(O)},X.prototype.preservedValues=function(){return this._preservedValues};function Z(q,V,F,O){if(typeof V!=="function")return U("expecting a function but got "+K.classString(V));var w=0;if(F!==void 0)if(typeof F==="object"&&F!==null){if(typeof F.concurrency!=="number")return $.reject(TypeError("'concurrency' must be a number but it is "+K.classString(F.concurrency)));w=F.concurrency}else return $.reject(TypeError("options argument must be an object but it is "+K.classString(F)));return w=typeof w==="number"&&isFinite(w)&&w>=1?w:0,new X(q,V,w,O).promise()}$.prototype.map=function(q,V){return Z(this,q,V,null)},$.map=function(q,V,F,O){return Z(q,V,F,O)}}});var yw0=E((He1,gw0)=>{var Cn=Object.create;if(Cn)dB=Cn(null),pB=Cn(null),dB[" size"]=pB[" size"]=0;var dB,pB;gw0.exports=function($){var Y=O4(),U=Y.canEvaluate,z=Y.isIdentifier,Q,J,I=function(q){return Function("ensureMethod",`
return function(obj) {
'use strict'
var len = this.length;
@@ -216,23 +216,23 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof E6))r
`.replace(/methodName/g,q))(H)},K=function(q){return Function("obj",`
'use strict';
return obj.propertyName;
`.replace("propertyName",q))},G=function(q,V,F){var w=F[q];if(typeof w!=="function"){if(!z(q))return null;if(w=V(q),F[q]=w,F[" size"]++,F[" size"]>512){var O=Object.keys(F);for(var M=0;M<256;++M)delete F[O[M]];F[" size"]=O.length-256}}return w};Q=function(q){return G(q,I,cA)},J=function(q){return G(q,K,pA)};function H(q,V){var F;if(q!=null)F=q[V];if(typeof F!=="function"){var w="Object "+Y.classString(q)+" has no method '"+Y.toString(V)+"'";throw new $.TypeError(w)}return F}function W(q){var V=this.pop(),F=H(q,V);return F.apply(q,this)}$.prototype.call=function(q){var V=arguments.length,F=Array(Math.max(V-1,0));for(var w=1;w<V;++w)F[w-1]=arguments[w];if(U){var O=Q(q);if(O!==null)return this._then(O,void 0,void 0,F,void 0)}return F.push(q),this._then(W,void 0,void 0,F,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",F;if(!V)if(U){var w=J(q);F=w!==null?w:X}else F=X;else F=Z;return this._then(F,void 0,void 0,q,void 0)}}});var gO0=E(($e1,SO0)=>{SO0.exports=function($,Y,U,z,Q,J){var I=O4(),K=E3().TypeError,G=O4().inherits,H=I.errorObj,W=I.tryCatch,X={};function Z(N){setTimeout(function(){throw N},0)}function q(N){var D=U(N);if(D!==N&&typeof N._isDisposable==="function"&&typeof N._getDisposer==="function"&&N._isDisposable())D._setDisposable(N._getDisposer());return D}function V(N,D){var P=0,T=N.length,A=new $(Q);function j(){if(P>=T)return A._fulfill();var C=q(N[P++]);if(C instanceof $&&C._isDisposable()){try{C=U(C._getDisposer().tryDispose(D),N.promise)}catch(b){return Z(b)}if(C instanceof $)return C._then(j,Z,null,null,null)}j()}return j(),A}function F(N,D,P){this._data=N,this._promise=D,this._context=P}F.prototype.data=function(){return this._data},F.prototype.promise=function(){return this._promise},F.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return X},F.prototype.tryDispose=function(N){var D=this.resource(),P=this._context;if(P!==void 0)P._pushContext();var T=D!==X?this.doDispose(D,N):null;if(P!==void 0)P._popContext();return this._promise._unsetDisposable(),this._data=null,T},F.isDisposer=function(N){return N!=null&&typeof N.resource==="function"&&typeof N.tryDispose==="function"};function w(N,D,P){this.constructor$(N,D,P)}G(w,F),w.prototype.doDispose=function(N,D){var P=this.data();return P.call(N,N,D)};function O(N){if(F.isDisposer(N))return this.resources[this.index]._setDisposable(N),N.promise();return N}function M(N){this.length=N,this.promise=null,this[N-1]=null}M.prototype._resultCancelled=function(){var N=this.length;for(var D=0;D<N;++D){var P=this[D];if(P instanceof $)P.cancel()}},$.using=function(){var N=arguments.length;if(N<2)return Y("you must pass at least 2 arguments to Promise.using");var D=arguments[N-1];if(typeof D!=="function")return Y("expecting a function but got "+I.classString(D));var P,T=!0;if(N===2&&Array.isArray(arguments[0]))P=arguments[0],N=P.length,T=!1;else P=arguments,N--;var A=new M(N);for(var j=0;j<N;++j){var C=P[j];if(F.isDisposer(C)){var b=C;C=C.promise(),C._setDisposable(b)}else{var k=U(C);if(k instanceof $)C=k._then(O,null,null,{resources:A,index:j},void 0)}A[j]=C}var S=Array(A.length);for(var j=0;j<S.length;++j)S[j]=$.resolve(A[j]).reflect();var i=$.all(S).then(function(z0){for(var x=0;x<z0.length;++x){var d=z0[x];if(d.isRejected())return H.e=d.error(),H;else if(!d.isFulfilled()){i.cancel();return}z0[x]=d.value()}n._pushContext(),D=W(D);var t=T?D.apply(void 0,z0):D(z0),e=n._popContext();return J.checkForgottenReturns(t,e,"Promise.using",n),t}),n=i.lastly(function(){var z0=new $.PromiseInspection(i);return V(A,z0)});return A.promise=n,n._setOnCancel(A),n},$.prototype._setDisposable=function(N){this._bitField=this._bitField|131072,this._disposer=N},$.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(N){if(typeof N==="function")return new w(N,this,z());throw new K}}});var kO0=E((Ye1,yO0)=>{yO0.exports=function($,Y,U){var z=O4(),Q=$.TimeoutError;function J(X){this.handle=X}J.prototype._resultCancelled=function(){clearTimeout(this.handle)};var I=function(X){return K(+this).thenReturn(X)},K=$.delay=function(X,Z){var q,V;if(Z!==void 0){if(q=$.resolve(Z)._then(I,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 K(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(z.markAsOriginatingFromRejection(V),X._attachExtraTrace(V),X._reject(V),q!=null)q.cancel()};function H(X){return clearTimeout(this.handle),X}f Line truncated
`.replace("propertyName",q))},G=function(q,V,F){var O=F[q];if(typeof O!=="function"){if(!z(q))return null;if(O=V(q),F[q]=O,F[" size"]++,F[" size"]>512){var w=Object.keys(F);for(var N=0;N<256;++N)delete F[w[N]];F[" size"]=w.length-256}}return O};Q=function(q){return G(q,I,dB)},J=function(q){return G(q,K,pB)};function H(q,V){var F;if(q!=null)F=q[V];if(typeof F!=="function"){var O="Object "+Y.classString(q)+" has no method '"+Y.toString(V)+"'";throw new $.TypeError(O)}return F}function W(q){var V=this.pop(),F=H(q,V);return F.apply(q,this)}$.prototype.call=function(q){var V=arguments.length,F=Array(Math.max(V-1,0));for(var O=1;O<V;++O)F[O-1]=arguments[O];if(U){var w=Q(q);if(w!==null)return this._then(w,void 0,void 0,F,void 0)}return F.push(q),this._then(W,void 0,void 0,F,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",F;if(!V)if(U){var O=J(q);F=O!==null?O:X}else F=X;else F=Z;return this._then(F,void 0,void 0,q,void 0)}}});var xw0=E((We1,kw0)=>{kw0.exports=function($,Y,U,z,Q,J){var I=O4(),K=_3().TypeError,G=O4().inherits,H=I.errorObj,W=I.tryCatch,X={};function Z(M){setTimeout(function(){throw M},0)}function q(M){var D=U(M);if(D!==M&&typeof M._isDisposable==="function"&&typeof M._getDisposer==="function"&&M._isDisposable())D._setDisposable(M._getDisposer());return D}function V(M,D){var P=0,T=M.length,B=new $(Q);function j(){if(P>=T)return B._fulfill();var C=q(M[P++]);if(C instanceof $&&C._isDisposable()){try{C=U(C._getDisposer().tryDispose(D),M.promise)}catch(b){return Z(b)}if(C instanceof $)return C._then(j,Z,null,null,null)}j()}return j(),B}function F(M,D,P){this._data=M,this._promise=D,this._context=P}F.prototype.data=function(){return this._data},F.prototype.promise=function(){return this._promise},F.prototype.resource=function(){if(this.promise().isFulfilled())return this.promise().value();return X},F.prototype.tryDispose=function(M){var D=this.resource(),P=this._context;if(P!==void 0)P._pushContext();var T=D!==X?this.doDispose(D,M):null;if(P!==void 0)P._popContext();return this._promise._unsetDisposable(),this._data=null,T},F.isDisposer=function(M){return M!=null&&typeof M.resource==="function"&&typeof M.tryDispose==="function"};function O(M,D,P){this.constructor$(M,D,P)}G(O,F),O.prototype.doDispose=function(M,D){var P=this.data();return P.call(M,M,D)};function w(M){if(F.isDisposer(M))return this.resources[this.index]._setDisposable(M),M.promise();return M}function N(M){this.length=M,this.promise=null,this[M-1]=null}N.prototype._resultCancelled=function(){var M=this.length;for(var D=0;D<M;++D){var P=this[D];if(P instanceof $)P.cancel()}},$.using=function(){var M=arguments.length;if(M<2)return Y("you must pass at least 2 arguments to Promise.using");var D=arguments[M-1];if(typeof D!=="function")return Y("expecting a function but got "+I.classString(D));var P,T=!0;if(M===2&&Array.isArray(arguments[0]))P=arguments[0],M=P.length,T=!1;else P=arguments,M--;var B=new N(M);for(var j=0;j<M;++j){var C=P[j];if(F.isDisposer(C)){var b=C;C=C.promise(),C._setDisposable(b)}else{var k=U(C);if(k instanceof $)C=k._then(w,null,null,{resources:B,index:j},void 0)}B[j]=C}var S=Array(B.length);for(var j=0;j<S.length;++j)S[j]=$.resolve(B[j]).reflect();var i=$.all(S).then(function(z0){for(var x=0;x<z0.length;++x){var p=z0[x];if(p.isRejected())return H.e=p.error(),H;else if(!p.isFulfilled()){i.cancel();return}z0[x]=p.value()}n._pushContext(),D=W(D);var t=T?D.apply(void 0,z0):D(z0),e=n._popContext();return J.checkForgottenReturns(t,e,"Promise.using",n),t}),n=i.lastly(function(){var z0=new $.PromiseInspection(i);return V(B,z0)});return B.promise=n,n._setOnCancel(B),n},$.prototype._setDisposable=function(M){this._bitField=this._bitField|131072,this._disposer=M},$.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(M){if(typeof M==="function")return new O(M,this,z());throw new K}}});var uw0=E((Xe1,fw0)=>{fw0.exports=function($,Y,U){var z=O4(),Q=$.TimeoutError;function J(X){this.handle=X}J.prototype._resultCancelled=function(){clearTimeout(this.handle)};var I=function(X){return K(+this).thenReturn(X)},K=$.delay=function(X,Z){var q,V;if(Z!==void 0){if(q=$.resolve(Z)._then(I,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 K(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(z.markAsOriginatingFromRejection(V),X._attachExtraTrace(V),X._reject(V),q!=null)q.cancel()};function H(X){return clearTimeout(this.handle),X}f Line truncated
See http://goo.gl/MqrFmX
`.replace("%s",w)+`From coroutine:
`.replace("%s",O)+`From coroutine:
`+this._stack.split(`
`).slice(1,-7).join(`
`)));return}}O=O._target();var M=O._bitField;if((M&50397184)===0)this._yieldedPromise=O,O._proxy(this,null);else if((M&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,O._value());else if((M&16777216)!==0)$._async.invoke(this._promiseRejected,this,O._reason());else this._promiseCancelled()}},$.coroutine=function(V,F){if(typeof V!=="function")throw new K(`generatorFunction must be a function
`)));return}}w=w._target();var N=w._bitField;if((N&50397184)===0)this._yieldedPromise=w,w._proxy(this,null);else if((N&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,w._value());else if((N&16777216)!==0)$._async.invoke(this._promiseRejected,this,w._reason());else this._promiseCancelled()}},$.coroutine=function(V,F){if(typeof V!=="function")throw new K(`generatorFunction must be a function
See http://goo.gl/MqrFmX
`);var w=Object(F).yieldHandler,O=q,M=Error().stack;return function(){var N=V.apply(this,arguments),D=new O(void 0,void 0,w,M),P=D.promise();return D._generator=N,D._promiseFulfilled(void 0),P}},$.coroutine.addYieldHandler=function(V){if(typeof V!=="function")throw new K("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
`);var O=Object(F).yieldHandler,w=q,N=Error().stack;return function(){var M=V.apply(this,arguments),D=new w(void 0,void 0,O,N),P=D.promise();return D._generator=M,D._promiseFulfilled(void 0),P}},$.coroutine.addYieldHandler=function(V){if(typeof V!=="function")throw new K("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 F=new q(V,this),w=F.promise();return F._run($.spawn),w}}});var bO0=E((ze1,uO0)=>{uO0.exports=function($){var Y=O4(),U=$._async,z=Y.tryCatch,Q=Y.errorObj;function J(G,H){var W=this;if(!Y.isArray(G))return I.call(W,G,H);var X=z(H).apply(W._boundValue(),[null].concat(G));if(X===Q)U.throwLater(X.e)}function I(G,H){var W=this,X=W._boundValue(),Z=G===void 0?z(H).call(X,null):z(H).call(X,null,G);if(Z===Q)U.throwLater(Z.e)}function K(G,H){var W=this;if(!G){var X=Error(G+"");X.cause=G,G=X}var Z=z(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=I;if(H!==void 0&&Object(H).spread)W=J;this._then(W,K,void 0,this,G)}return this}}});var nO0=E((Qe1,iO0)=>{iO0.exports=function($,Y){var U={},z=O4(),Q=Pn(),J=z.withAppended,I=z.maybeWrapAsError,K=z.canEvaluate,G=E3().TypeError,H="Async",W={__isPromisified__:!0},X=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],Z=new RegExp("^(?:"+X.join("|")+")$"),q=function(i){return z.isIdentifier(i)&&i.charAt(0)!=="_"&&i!=="constructor"};function V(i){return!Z.test(i)}function F(i){try{return i.__isPromisified__===!0}catch(n){return!1}}function w(i,n,z0){var x=z.getDataPropertyOrDefault(i,n+z0,W);return x?F(x):!1}function O(i,n,z0){for(var x=0;x<i.length;x+=2){var d=i[x];if(z0.test(d)){var t=d.replace(z0,"");for(var e=0;e<i.length;e+=2)if(i[e]===t)throw new G(`Cannot promisify an API that has normal methods with '%s'-suffix
`);var F=new q(V,this),O=F.promise();return F._run($.spawn),O}}});var cw0=E((qe1,nw0)=>{nw0.exports=function($){var Y=O4(),U=$._async,z=Y.tryCatch,Q=Y.errorObj;function J(G,H){var W=this;if(!Y.isArray(G))return I.call(W,G,H);var X=z(H).apply(W._boundValue(),[null].concat(G));if(X===Q)U.throwLater(X.e)}function I(G,H){var W=this,X=W._boundValue(),Z=G===void 0?z(H).call(X,null):z(H).call(X,null,G);if(Z===Q)U.throwLater(Z.e)}function K(G,H){var W=this;if(!G){var X=Error(G+"");X.cause=G,G=X}var Z=z(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=I;if(H!==void 0&&Object(H).spread)W=J;this._then(W,K,void 0,this,G)}return this}}});var pw0=E((Ve1,dw0)=>{dw0.exports=function($,Y){var U={},z=O4(),Q=En(),J=z.withAppended,I=z.maybeWrapAsError,K=z.canEvaluate,G=_3().TypeError,H="Async",W={__isPromisified__:!0},X=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"],Z=new RegExp("^(?:"+X.join("|")+")$"),q=function(i){return z.isIdentifier(i)&&i.charAt(0)!=="_"&&i!=="constructor"};function V(i){return!Z.test(i)}function F(i){try{return i.__isPromisified__===!0}catch(n){return!1}}function O(i,n,z0){var x=z.getDataPropertyOrDefault(i,n+z0,W);return x?F(x):!1}function w(i,n,z0){for(var x=0;x<i.length;x+=2){var p=i[x];if(z0.test(p)){var t=p.replace(z0,"");for(var e=0;e<i.length;e+=2)if(i[e]===t)throw new G(`Cannot promisify an API that has normal methods with '%s'-suffix
See http://goo.gl/MqrFmX
`.replace("%s",n))}}}function M(i,n,z0,x){var d=z.inheritedDataKeys(i),t=[];for(var e=0;e<d.length;++e){var g=d[e],p=i[g],Y0=x===q?!0:q(g,p,i);if(typeof p==="function"&&!F(p)&&!w(i,g,n)&&x(g,p,i,Y0))t.push(g,p)}return O(t,n,z0),t}var N=function(i){return i.replace(/([$])/,"\\$")},D,P=function(i){var n=[i],z0=Math.max(0,i-1-3);for(var x=i-1;x>=z0;--x)n.push(x);for(var x=i+1;x<=3;++x)n.push(x);return n},T=function(i){return z.filledRange(i,"_arg","")},A=function(i){return z.filledRange(Math.max(i,3),"_arg","")},j=function(i){if(typeof i.length==="number")return Math.max(Math.min(i.length,1024),0);return 0};D=function(i,n,z0,x,d,t){var e=Math.max(0,j(x)-1),g=P(e),p=typeof i==="string"||n===U;function Y0(N0){var j0=T(N0).join(", "),_0=N0>0?", ":"",G0;if(p)G0=`ret = callback.call(this, {{args}}, nodeback); break;
`.replace("%s",n))}}}function N(i,n,z0,x){var p=z.inheritedDataKeys(i),t=[];for(var e=0;e<p.length;++e){var g=p[e],d=i[g],Y0=x===q?!0:q(g,d,i);if(typeof d==="function"&&!F(d)&&!O(i,g,n)&&x(g,d,i,Y0))t.push(g,d)}return w(t,n,z0),t}var M=function(i){return i.replace(/([$])/,"\\$")},D,P=function(i){var n=[i],z0=Math.max(0,i-1-3);for(var x=i-1;x>=z0;--x)n.push(x);for(var x=i+1;x<=3;++x)n.push(x);return n},T=function(i){return z.filledRange(i,"_arg","")},B=function(i){return z.filledRange(Math.max(i,3),"_arg","")},j=function(i){if(typeof i.length==="number")return Math.max(Math.min(i.length,1024),0);return 0};D=function(i,n,z0,x,p,t){var e=Math.max(0,j(x)-1),g=P(e),d=typeof i==="string"||n===U;function Y0(N0){var j0=T(N0).join(", "),_0=N0>0?", ":"",G0;if(d)G0=`ret = callback.call(this, {{args}}, nodeback); break;
`;else G0=n===void 0?`ret = callback({{args}}, nodeback); break;
`:`ret = callback.call(receiver, {{args}}, nodeback); break;
`;return G0.replace("{{args}}",j0).replace(", ",_0)}function y(){var N0="";for(var j0=0;j0<g.length;++j0)N0+="case "+g[j0]+":"+Y0(g[j0]);return N0+=`
@@ -245,7 +245,7 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof E6))r
args[i] = nodeback;
[CodeForCall]
break;
`.replace("[CodeForCall]",p?`ret = callback.apply(this, args);
`.replace("[CodeForCall]",d?`ret = callback.apply(this, args);
`:`ret = callback.apply(receiver, args);
`),N0}var r=typeof i==="string"?"this != null ? this['"+i+"'] : fn":"fn",$0=`'use strict';
var ret = function (Parameters) {
@@ -267,25 +267,25 @@ See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof E6))r
};
notEnumerableProp(ret, '__isPromisified__', true);
return ret;
`.replace("[CodeForSwitchCase]",y()).replace("[GetFunctionCode]",r);return $0=$0.replace("Parameters",A(e)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",$0)($,x,n,J,I,Q,z.tryCatch,z.errorObj,z.notEnumerableProp,Y)};function C(i,n,z0,x,d,t){var e=function(){return this}(),g=i;if(typeof g==="string")i=x;function p(){var Y0=n;if(n===U)Y0=this;var y=new $(Y);y._captureStackTrace();var r=typeof g==="string"&&this!==e?this[g]:i,$0=Q(y,t);try{r.apply(Y0,J(arguments,$0))}catch(N0){y._rejectCallback(I(N0),!0,!0)}if(!y._isFateSealed())y._setAsyncGuaranteed();return y}return z.notEnumerableProp(p,"__isPromisified__",!0),p}var b=K?D:C;function k(i,n,z0,x,d){var t=new RegExp(N(n)+"$"),e=M(i,n,t,z0);for(var g=0,p=e.length;g<p;g+=2){var Y0=e[g],y=e[g+1],r=Y0+n;if(x===b)i[r]=b(Y0,U,Y0,y,n,d);else{var $0=x(y,function(){return b(Y0,U,Y0,y,n,d)});z.notEnumerableProp($0,"__isPromisified__",!0),i[r]=$0}}return z.toFastProperties(i),i}function S(i,n,z0){return b(i,n,void 0,i,null,z0)}$.promisify=function(i,n){if(typeof i!=="function")throw new G("expecting a function but got "+z.classString(i));if(F(i))return i;n=Object(n);var z0=n.context===void 0?U:n.context,x=!!n.multiArgs,d=S(i,z0,x);return z.copyDescriptors(i,d,V),d},$.promisifyAll=function(i,n){if(typeof i!=="function"&&typeof i!=="object")throw new G(`the target of promisifyAll must be an object or a function
`.replace("[CodeForSwitchCase]",y()).replace("[GetFunctionCode]",r);return $0=$0.replace("Parameters",B(e)),Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",$0)($,x,n,J,I,Q,z.tryCatch,z.errorObj,z.notEnumerableProp,Y)};function C(i,n,z0,x,p,t){var e=function(){return this}(),g=i;if(typeof g==="string")i=x;function d(){var Y0=n;if(n===U)Y0=this;var y=new $(Y);y._captureStackTrace();var r=typeof g==="string"&&this!==e?this[g]:i,$0=Q(y,t);try{r.apply(Y0,J(arguments,$0))}catch(N0){y._rejectCallback(I(N0),!0,!0)}if(!y._isFateSealed())y._setAsyncGuaranteed();return y}return z.notEnumerableProp(d,"__isPromisified__",!0),d}var b=K?D:C;function k(i,n,z0,x,p){var t=new RegExp(M(n)+"$"),e=N(i,n,t,z0);for(var g=0,d=e.length;g<d;g+=2){var Y0=e[g],y=e[g+1],r=Y0+n;if(x===b)i[r]=b(Y0,U,Y0,y,n,p);else{var $0=x(y,function(){return b(Y0,U,Y0,y,n,p)});z.notEnumerableProp($0,"__isPromisified__",!0),i[r]=$0}}return z.toFastProperties(i),i}function S(i,n,z0){return b(i,n,void 0,i,null,z0)}$.promisify=function(i,n){if(typeof i!=="function")throw new G("expecting a function but got "+z.classString(i));if(F(i))return i;n=Object(n);var z0=n.context===void 0?U:n.context,x=!!n.multiArgs,p=S(i,z0,x);return z.copyDescriptors(i,p,V),p},$.promisifyAll=function(i,n){if(typeof i!=="function"&&typeof i!=="object")throw new G(`the target of promisifyAll must be an object or a function
See http://goo.gl/MqrFmX
`);n=Object(n);var z0=!!n.multiArgs,x=n.suffix;if(typeof x!=="string")x=H;var d=n.filter;if(typeof d!=="function")d=q;var t=n.promisifier;if(typeof t!=="function")t=b;if(!z.isIdentifier(x))throw RangeError(`suffix must be a valid identifier
`);n=Object(n);var z0=!!n.multiArgs,x=n.suffix;if(typeof x!=="string")x=H;var p=n.filter;if(typeof p!=="function")p=q;var t=n.promisifier;if(typeof t!=="function")t=b;if(!z.isIdentifier(x))throw RangeError(`suffix must be a valid identifier
See http://goo.gl/MqrFmX
`);var e=z.inheritedDataKeys(i);for(var g=0;g<e.length;++g){var p=i[e[g]];if(e[g]!=="constructor"&&z.isClass(p))k(p.prototype,x,d,t,z0),k(p,x,d,t,z0)}return k(i,x,d,t,z0)}}});var pO0=E((Je1,cO0)=>{cO0.exports=function($,Y,U,z){var Q=O4(),J=Q.isObject,I=aU(),K;if(typeof Map==="function")K=Map;var G=function(){var Z=0,q=0;function V(F,w){this[Z]=F,this[Z+q]=w,Z++}return function(w){q=w.size,Z=0;var O=Array(w.size*2);return w.forEach(V,O),O}}(),H=function(Z){var q=new K,V=Z.length/2|0;for(var F=0;F<V;++F){var w=Z[V+F],O=Z[F];q.set(w,O)}return q};function W(Z){var q=!1,V;if(K!==void 0&&Z instanceof K)V=G(Z),q=!0;else{var F=I.keys(Z),w=F.length;V=Array(w*2);for(var O=0;O<w;++O){var M=F[O];V[O]=Z[M],V[O+w]=M}}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 F;if(this._isMap)F=H(this._values);else{F={};var w=this.length();for(var O=0,M=this.length();O<M;++O)F[this._values[O+w]]=this._values[O]}return this._resolve(F),!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 z(`cannot await properties of a non-object
`);var e=z.inheritedDataKeys(i);for(var g=0;g<e.length;++g){var d=i[e[g]];if(e[g]!=="constructor"&&z.isClass(d))k(d.prototype,x,p,t,z0),k(d,x,p,t,z0)}return k(i,x,p,t,z0)}}});var lw0=E((Le1,mw0)=>{mw0.exports=function($,Y,U,z){var Q=O4(),J=Q.isObject,I=aU(),K;if(typeof Map==="function")K=Map;var G=function(){var Z=0,q=0;function V(F,O){this[Z]=F,this[Z+q]=O,Z++}return function(O){q=O.size,Z=0;var w=Array(O.size*2);return O.forEach(V,w),w}}(),H=function(Z){var q=new K,V=Z.length/2|0;for(var F=0;F<V;++F){var O=Z[V+F],w=Z[F];q.set(O,w)}return q};function W(Z){var q=!1,V;if(K!==void 0&&Z instanceof K)V=G(Z),q=!0;else{var F=I.keys(Z),O=F.length;V=Array(O*2);for(var w=0;w<O;++w){var N=F[w];V[w]=Z[N],V[w+O]=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 F;if(this._isMap)F=H(this._values);else{F={};var O=this.length();for(var w=0,N=this.length();w<N;++w)F[this._values[w+O]]=this._values[w]}return this._resolve(F),!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 z(`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 mO0=E((Ie1,dO0)=>{dO0.exports=function($,Y,U,z){var Q=O4(),J=function(K){return K.then(function(G){return I(G,K)})};function I(K,G){var H=U(K);if(H instanceof $)return J(H);else if(K=Q.asArray(K),K===null)return z("expecting an array or an iterable object but got "+Q.classString(K));var W=new $(Y);if(G!==void 0)W._propagateFrom(G,3);var{_fulfill:X,_reject:Z}=W;for(var q=0,V=K.length;q<V;++q){var F=K[q];if(F===void 0&&!(q in K))continue;$.cast(F)._then(X,Z,void 0,W,null)}return W}$.race=function(K){return I(K,void 0)},$.prototype.race=function(){return I(this,void 0)}}});var oO0=E((Ke1,lO0)=>{lO0.exports=function($,Y,U,z,Q,J){var I=$._getDomain,K=O4(),G=K.tryCatch;function H(V,F,w,O){this.constructor$(V);var M=I();if(this._fn=M===null?F:K.domainBind(M,F),w!==void 0)w=$.resolve(w),w._attachCancellationCallback(this);if(this._initialValue=w,this._currentCancellable=null,O===Q)this._eachValues=Array(this._length);else if(O===0)this._eachValues=null;else this._eachValues=void 0;this._promise._captureStackTrace(),this._init$(void 0,-5)}K.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 F,w,O=V.length;if(this._initialValue!==void 0)F=this._initialValue,w=0;else F=$.resolve(V[0]),w=1;if(this._currentCancellable=F,!F.isRejected())for(;w<O;++w){var M={accum:null,value:V[w],index:w,length:O,array:this};F=F._then(Z,void 0,void 0,M,void 0)}if(this._eachValues!==void 0)F=F._then(this._eachComplete,void 0,void 0,this,void 0);F._then(W,W,void 0,F,this)},$.prototype.reduce=function(V,F){return X(this,V,F,null)},$.reduce=function(V,F,w,O){return X(V,F,w,O)};function W(V,F){if(this.isFulfilled())F._resolve(V);else F._reject(V)}function X(V,F,w,O){if(typeof F!=="function")return U("expecting a function but got "+K.classString(F));var M=new H(V,F,w,O);return M.promise()}function Z(V){this.accum=V,this.array._gotAccum(V);var F=z(this.value,this.array._promise);if(F instanceof $)return this.array._currentCancellable=F,F._then(q,void 0,void 0,this,void 0);else return q.call(this,F)}function q(V){var F=this.array,w=F._promise,O=G(F._fn);w._pushContext();var M;if(F._eachValues!==void 0)M=O.call(w._boundValue(),V,this.index,this.length);else M=O.call(w._boundValue(),this.accum,V,this.index,this.length);if(M instanceof $)F._currentCancellable=M;var N=w._popContext();return J.checkForgottenReturns(M,N,F._eachValues!==void 0?"Promise.each":"Promise.reduce",w),M}}});var sO0=E((Ge1,rO0)=>{rO0.exports=function($,Y,U){var z=$.PromiseInspection,Q=O4();function J(I){this.constructor$(I)}Q.inherits(J,Y),J.prototype._promiseResolved=function(I,K){this._values[I]=K;var G=++this._totalResolved;if(G>=this._length)return this._resolve(this._values),!0;return!1},J.prototype._promiseFulfilled=function(I,K){var G=new z;return G._bitField=33554432,G._settledValueField=I,this._promiseResolved(K,G)},J.prototype._promiseRejected=function(I,K){var G=new z;return G._bitField=16777216,G._settledValueField=I,this._promiseResolved(K,G)},$.settle=function(I){return U.deprecated(".settle()",".reflect()"),new J(I).promise()},$.prototype.settle=function(){return $.settle(this)}}});var tO0=E((He1,aO0)=>{aO0.exports=function($,Y,U){var z=O4(),Q=E3().RangeError,J=E3().AggregateError,I=z.isArray,K={};function G(W){this.constructor$(W),this._howMany=0,this._unwrap=!1,this._initialized=!1}z.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=I(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 rw0=E((Fe1,ow0)=>{ow0.exports=function($,Y,U,z){var Q=O4(),J=function(K){return K.then(function(G){return I(G,K)})};function I(K,G){var H=U(K);if(H instanceof $)return J(H);else if(K=Q.asArray(K),K===null)return z("expecting an array or an iterable object but got "+Q.classString(K));var W=new $(Y);if(G!==void 0)W._propagateFrom(G,3);var{_fulfill:X,_reject:Z}=W;for(var q=0,V=K.length;q<V;++q){var F=K[q];if(F===void 0&&!(q in K))continue;$.cast(F)._then(X,Z,void 0,W,null)}return W}$.race=function(K){return I(K,void 0)},$.prototype.race=function(){return I(this,void 0)}}});var aw0=E((we1,sw0)=>{sw0.exports=function($,Y,U,z,Q,J){var I=$._getDomain,K=O4(),G=K.tryCatch;function H(V,F,O,w){this.constructor$(V);var N=I();if(this._fn=N===null?F:K.domainBind(N,F),O!==void 0)O=$.resolve(O),O._attachCancellationCallback(this);if(this._initialValue=O,this._currentCancellable=null,w===Q)this._eachValues=Array(this._length);else if(w===0)this._eachValues=null;else this._eachValues=void 0;this._promise._captureStackTrace(),this._init$(void 0,-5)}K.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 F,O,w=V.length;if(this._initialValue!==void 0)F=this._initialValue,O=0;else F=$.resolve(V[0]),O=1;if(this._currentCancellable=F,!F.isRejected())for(;O<w;++O){var N={accum:null,value:V[O],index:O,length:w,array:this};F=F._then(Z,void 0,void 0,N,void 0)}if(this._eachValues!==void 0)F=F._then(this._eachComplete,void 0,void 0,this,void 0);F._then(W,W,void 0,F,this)},$.prototype.reduce=function(V,F){return X(this,V,F,null)},$.reduce=function(V,F,O,w){return X(V,F,O,w)};function W(V,F){if(this.isFulfilled())F._resolve(V);else F._reject(V)}function X(V,F,O,w){if(typeof F!=="function")return U("expecting a function but got "+K.classString(F));var N=new H(V,F,O,w);return N.promise()}function Z(V){this.accum=V,this.array._gotAccum(V);var F=z(this.value,this.array._promise);if(F instanceof $)return this.array._currentCancellable=F,F._then(q,void 0,void 0,this,void 0);else return q.call(this,F)}function q(V){var F=this.array,O=F._promise,w=G(F._fn);O._pushContext();var N;if(F._eachValues!==void 0)N=w.call(O._boundValue(),V,this.index,this.length);else N=w.call(O._boundValue(),this.accum,V,this.index,this.length);if(N instanceof $)F._currentCancellable=N;var M=O._popContext();return J.checkForgottenReturns(N,M,F._eachValues!==void 0?"Promise.each":"Promise.reduce",O),N}}});var ew0=E((Oe1,tw0)=>{tw0.exports=function($,Y,U){var z=$.PromiseInspection,Q=O4();function J(I){this.constructor$(I)}Q.inherits(J,Y),J.prototype._promiseResolved=function(I,K){this._values[I]=K;var G=++this._totalResolved;if(G>=this._length)return this._resolve(this._values),!0;return!1},J.prototype._promiseFulfilled=function(I,K){var G=new z;return G._bitField=33554432,G._settledValueField=I,this._promiseResolved(K,G)},J.prototype._promiseRejected=function(I,K){var G=new z;return G._bitField=16777216,G._settledValueField=I,this._promiseResolved(K,G)},$.settle=function(I){return U.deprecated(".settle()",".reflect()"),new J(I).promise()},$.prototype.settle=function(){return $.settle(this)}}});var YO0=E((Me1,$O0)=>{$O0.exports=function($,Y,U){var z=O4(),Q=_3().RangeError,J=_3().AggregateError,I=z.isArray,K={};function G(W){this.constructor$(W),this._howMany=0,this._unwrap=!1,this._initialized=!1}z.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=I(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 $w0=E((We1,eO0)=>{eO0.exports=function($,Y){var U=$.map;$.prototype.filter=function(z,Q){return U(this,z,Q,Y)},$.filter=function(z,Q,J){return U(z,Q,J,Y)}}});var Uw0=E((Xe1,Yw0)=>{Yw0.exports=function($,Y){var{reduce:U,all:z}=$;function Q(){return z(this)}function J(I,K){return U(I,K,Y,Y)}$.prototype.each=function(I){return U(this,I,Y,0)._then(Q,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(I){return U(this,I,Y,Y)},$.each=function(I,K){return U(I,K,Y,0)._then(Q,void 0,void 0,I,void 0)},$.mapSeries=J}});var Qw0=E((Ze1,zw0)=>{zw0.exports=function($){var Y=$._SomePromiseArray;function U(z){var Q=new Y(z),J=Q.promise();return Q.setHowMany(1),Q.setUnwrap(),Q.init(),J}$.any=function(z){return U(z)},$.prototype.any=function(){return U(this)}}});var Jw0=E((qe1,jn)=>{jn.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 zO0=E((Ne1,UO0)=>{UO0.exports=function($,Y){var U=$.map;$.prototype.filter=function(z,Q){return U(this,z,Q,Y)},$.filter=function(z,Q,J){return U(z,Q,J,Y)}}});var JO0=E((De1,QO0)=>{QO0.exports=function($,Y){var{reduce:U,all:z}=$;function Q(){return z(this)}function J(I,K){return U(I,K,Y,Y)}$.prototype.each=function(I){return U(this,I,Y,0)._then(Q,void 0,void 0,this,void 0)},$.prototype.mapSeries=function(I){return U(this,I,Y,Y)},$.each=function(I,K){return U(I,K,Y,0)._then(Q,void 0,void 0,I,void 0)},$.mapSeries=J}});var KO0=E((Be1,IO0)=>{IO0.exports=function($){var Y=$._SomePromiseArray;function U(z){var Q=new Y(z),J=Q.promise();return Q.setHowMany(1),Q.setUnwrap(),Q.init(),J}$.any=function(z){return U(z)},$.prototype.any=function(){return U(this)}}});var GO0=E((Ae1,Rn)=>{Rn.exports=function(){var $=function(){return new X(`circular promise resolution chain
See http://goo.gl/MqrFmX
`)},Y=function(){return new S.PromiseInspection(this._target())},U=function(x){return S.reject(new X(x))};function z(){}var Q={},J=O4(),I;if(J.isNode)I=function(){var x=process.domain;if(x===void 0)x=null;return x};else I=function(){return null};J.notEnumerableProp(S,"_getDomain",I);var K=aU(),G=tF0(),H=new G;K.defineProperty(S,"_async",{value:H});var W=E3(),X=S.TypeError=W.TypeError;S.RangeError=W.RangeError;var Z=S.CancellationError=W.CancellationError;S.TimeoutError=W.TimeoutError,S.OperationalError=W.OperationalError,S.RejectionError=W.OperationalError,S.AggregateError=W.AggregateError;var q=function(){},V={},F={},w=zO0()(S,q),O=JO0()(S,q,w,U,z),M=KO0()(S),N=M.create,D=HO0()(S,M),P=D.CapturedTrace,T=XO0()(S,w),A=qO0()(F),j=Pn(),C=J.errorObj,b=J.tryCatch;function k(x,d){if(typeof d!=="function")throw new X("expecting a function but got "+J.classString(d));if(x.constructor!==S)throw new X(`the promise constructor cannot be invoked directly
`)},Y=function(){return new S.PromiseInspection(this._target())},U=function(x){return S.reject(new X(x))};function z(){}var Q={},J=O4(),I;if(J.isNode)I=function(){var x=process.domain;if(x===void 0)x=null;return x};else I=function(){return null};J.notEnumerableProp(S,"_getDomain",I);var K=aU(),G=Yw0(),H=new G;K.defineProperty(S,"_async",{value:H});var W=_3(),X=S.TypeError=W.TypeError;S.RangeError=W.RangeError;var Z=S.CancellationError=W.CancellationError;S.TimeoutError=W.TimeoutError,S.OperationalError=W.OperationalError,S.RejectionError=W.OperationalError,S.AggregateError=W.AggregateError;var q=function(){},V={},F={},O=Iw0()(S,q),w=Gw0()(S,q,O,U,z),N=Ww0()(S),M=N.create,D=Zw0()(S,N),P=D.CapturedTrace,T=Vw0()(S,O),B=Fw0()(F),j=En(),C=J.errorObj,b=J.tryCatch;function k(x,p){if(typeof p!=="function")throw new X("expecting a function but got "+J.classString(p));if(x.constructor!==S)throw new X(`the promise constructor cannot be invoked directly
See http://goo.gl/MqrFmX
`)}function S(x){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,x!==q)k(this,x),this._resolveFromExecutor(x);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(x){var d=arguments.length;if(d>1){var t=Array(d-1),e=0,g;for(g=0;g<d-1;++g){var p=arguments[g];if(J.isObject(p))t[e++]=p;else return U("expecting an object but got A catch statement predicate "+J.classString(p))}return t.length=e,x=arguments[g],this.then(void 0,A(t,x,this))}return this.then(void 0,x)},S.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},S.prototype.then=function(x,d){if(D.warnings()&&arguments.length>0&&typeof x!=="function"&&typeof d!=="function"){var t=".then() only accepts functions but was passed: "+J.classString(x);if(arguments.length>1)t+=", "+J.classString(d);this._warn(t)}return this._then(x,d,void 0,void 0,void 0)},S.prototype.done=function(x,d){var t=this._then(x,d,void 0,void 0,void 0);t._setIsFinal()},S.prototype.spread=function(x){if(typeof x!=="function")return U("expecting a function but got "+J.classString(x));return this.all()._then(x,void 0,void 0,V,void 0)},S.prototype.toJSON=function(){var x={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())x.fulfillmentValue=this.value(),x.isFulfilled=!0;else if(this.isRejected())x.rejectionReason=this.reason(),x.isRejected=!0;return x},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new O(this).promise()},S.prototype.error=function(x){return this.caught(J.originatesFromRejection,x)},S.getNewLibraryCopy=jn.exports,S.is=function(x){return x instanceof S},S.fromNode=S.fromCallback=function(x){var d=new S(q);d._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,e=b(x)(j(d,t));if(e===C)d._rejectCallback(e.e,!0);if(!d._isFateSealed())d._setAsyncGuaranteed();return d},S.all=function(x){return new O(x).promise()},S.cast=function(x){var d=w(x);if(!(d instanceof S))d=new S(q),d._captureStackTrace(),d._setFulfilled(),d._rejectionHandler0=x;return d},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(x){var d=new S(q);return d._captureStackTrace(),d._rejectCallback(x,!0),d},S.setScheduler=function(x){if(typeof x!=="function")throw new X("expecting a function but got "+J.classString(x));return H.setScheduler(x)},S.prototype._then=function(x,d,t,e,g){var p=g!==void 0,Y0=p?g:new S(q),y=this._target(),r=y._bitField;if(!p){if(Y0._propagateFrom(this,3),Y0._captureStackTrace(),e===void 0&&(this._bitField&2097152)!==0)if((r&50397184)!==0)e=this._boundValue();else e=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,Y0)}var $0=I();if((r&50397184)!==0){var N0,j0,_0=y._settlePromiseCtx;if((r&33554432)!==0)j0=y._rejectionHandler0,N0=x;else if((r&16777216)!==0)j0=y._fulfillmentHandler0,N0=d,y._unsetRejectionIsUnhandled();else _0=y._settlePromiseLateCancellationObserver,j0=new Z("late cancellation observer"),y._attachExtraTrace(j0),N0=d;H.invoke(_0,y,{handler:$0===null?N0:typeof N0==="function"&&J.domainBind($0,N0),promise:Y0,receiver:e,value:j0})}else y._addCallbacks(x,d,Y0,e,$0);return Y0},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(x){this._bitField=this._bitField&-65536|x&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(x){var d=x===0?this._receiver0:this[x*4-4+3];if(d===Q)return;else if(d===void 0&&this._isBound())return this._boundValue();return d},S.prototype._promiseAt=function(x){return this[x*4-4+2]},S.prototype._fulfillmentHandlerAt=function(x){return this[x*4-4+0]},S.prototype._rejectionHandlerAt=function(x){return this[x*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(x){var{_bitField:d,_fulfillmentHandler0:t,_ Line truncated
`)}function S(x){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,x!==q)k(this,x),this._resolveFromExecutor(x);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(x){var p=arguments.length;if(p>1){var t=Array(p-1),e=0,g;for(g=0;g<p-1;++g){var d=arguments[g];if(J.isObject(d))t[e++]=d;else return U("expecting an object but got A catch statement predicate "+J.classString(d))}return t.length=e,x=arguments[g],this.then(void 0,B(t,x,this))}return this.then(void 0,x)},S.prototype.reflect=function(){return this._then(Y,Y,void 0,this,void 0)},S.prototype.then=function(x,p){if(D.warnings()&&arguments.length>0&&typeof x!=="function"&&typeof p!=="function"){var t=".then() only accepts functions but was passed: "+J.classString(x);if(arguments.length>1)t+=", "+J.classString(p);this._warn(t)}return this._then(x,p,void 0,void 0,void 0)},S.prototype.done=function(x,p){var t=this._then(x,p,void 0,void 0,void 0);t._setIsFinal()},S.prototype.spread=function(x){if(typeof x!=="function")return U("expecting a function but got "+J.classString(x));return this.all()._then(x,void 0,void 0,V,void 0)},S.prototype.toJSON=function(){var x={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())x.fulfillmentValue=this.value(),x.isFulfilled=!0;else if(this.isRejected())x.rejectionReason=this.reason(),x.isRejected=!0;return x},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new w(this).promise()},S.prototype.error=function(x){return this.caught(J.originatesFromRejection,x)},S.getNewLibraryCopy=Rn.exports,S.is=function(x){return x instanceof S},S.fromNode=S.fromCallback=function(x){var p=new S(q);p._captureStackTrace();var t=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,e=b(x)(j(p,t));if(e===C)p._rejectCallback(e.e,!0);if(!p._isFateSealed())p._setAsyncGuaranteed();return p},S.all=function(x){return new w(x).promise()},S.cast=function(x){var p=O(x);if(!(p instanceof S))p=new S(q),p._captureStackTrace(),p._setFulfilled(),p._rejectionHandler0=x;return p},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(x){var p=new S(q);return p._captureStackTrace(),p._rejectCallback(x,!0),p},S.setScheduler=function(x){if(typeof x!=="function")throw new X("expecting a function but got "+J.classString(x));return H.setScheduler(x)},S.prototype._then=function(x,p,t,e,g){var d=g!==void 0,Y0=d?g:new S(q),y=this._target(),r=y._bitField;if(!d){if(Y0._propagateFrom(this,3),Y0._captureStackTrace(),e===void 0&&(this._bitField&2097152)!==0)if((r&50397184)!==0)e=this._boundValue();else e=y===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,Y0)}var $0=I();if((r&50397184)!==0){var N0,j0,_0=y._settlePromiseCtx;if((r&33554432)!==0)j0=y._rejectionHandler0,N0=x;else if((r&16777216)!==0)j0=y._fulfillmentHandler0,N0=p,y._unsetRejectionIsUnhandled();else _0=y._settlePromiseLateCancellationObserver,j0=new Z("late cancellation observer"),y._attachExtraTrace(j0),N0=p;H.invoke(_0,y,{handler:$0===null?N0:typeof N0==="function"&&J.domainBind($0,N0),promise:Y0,receiver:e,value:j0})}else y._addCallbacks(x,p,Y0,e,$0);return Y0},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(x){this._bitField=this._bitField&-65536|x&65535},S.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432,this._fireEvent("promiseFulfilled",this)},S.prototype._setRejected=function(){this._bitField=this._bitField|16777216,this._fireEvent("promiseRejected",this)},S.prototype._setFollowing=function(){this._bitField=this._bitField|67108864,this._fireEvent("promiseResolved",this)},S.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304},S.prototype._isFinal=function(){return(this._bitField&4194304)>0},S.prototype._unsetCancelled=function(){this._bitField=this._bitField&-65537},S.prototype._setCancelled=function(){this._bitField=this._bitField|65536,this._fireEvent("promiseCancelled",this)},S.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608},S.prototype._setAsyncGuaranteed=function(){if(H.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(x){var p=x===0?this._receiver0:this[x*4-4+3];if(p===Q)return;else if(p===void 0&&this._isBound())return this._boundValue();return p},S.prototype._promiseAt=function(x){return this[x*4-4+2]},S.prototype._fulfillmentHandlerAt=function(x){return this[x*4-4+0]},S.prototype._rejectionHandlerAt=function(x){return this[x*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(x){var{_bitField:p,_fulfillmentHandler0:t,_ Line truncated
path = %s
syscall = %s
fstream_type = %s
@@ -295,30 +295,30 @@ fstream_class = %s
fstream_stack =
%s
`,Y||"UNKNOWN",z.stack,z.path,z.syscall,z.fstream_type,z.fstream_path,z.fstream_unc_path,z.fstream_class,z.fstream_stack.join(`
`));else U.emit("warn",z)};g2.prototype.info=function($,Y){this.emit("info",$,Y)};g2.prototype.error=function($,Y,U){var z=fM0($,Y,this);if(U)throw z;else this.emit("error",z)};function fM0($,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(z){return z.replace(/^ {4}at /,"")}),$}});var FZ=E((ce1,bM0)=>{bM0.exports=aO1;function aO1($){var Y=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&Y.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var z=0,Q=Y.length;z<Q;z++){U=Y[z];var J=$[U]||$["is"+U];if(typeof J==="function")J=J.call($);if(J)return $[U]=!0,$.type=U,U}return null}});var qc=E((pe1,iM0)=>{iM0.exports=OZ;var tO1=o8(),eO1=X1(),Zc=Iz();eO1(OZ,Zc);function OZ($){var Y=this;if(!(Y instanceof OZ))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);Zc.call(Y,$)}OZ.prototype._stat=function($){var Y=this;tO1.readlink(Y._path,function(U,z){if(U)return Y.error(U);Y.linkpath=Y.props.linkpath=z,Y.emit("linkpath",z),Zc.prototype._stat.call(Y,$)})};OZ.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Lc=E((de1,pM0)=>{pM0.exports=D9;var cM0=o8(),$w1=X1(),wZ=I0("path"),Vc=Iz(),nM0=I0("assert").ok;$w1(D9,Vc);function D9($){var Y=this;if(!(Y instanceof D9))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;Vc.call(this,$)}D9.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,cM0.readdir($._path,function(Y,U){if(Y)return $.error(Y);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",z);else z();function z(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};D9.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=wZ.resolve($._path,$.entries[$._index]);nM0(Y!==$._path),nM0($.entries[$._index]),$._currentEntry=Y,cM0[$.props.follow?"stat":"lstat"](Y,function(U,z){if(U)return $.error(U);var Q=$._proxy||$;z.path=Y,z.basename=wZ.basename(Y),z.dirname=wZ.dirname(Y);var J=$.getChildProps.call(Q,z);J.path=Y,J.basename=wZ.basename(Y),J.dirname=wZ.dirname(Y);var I=Vc(J,z);$._currentEntry=I,I.on("pause",function(H){if(!$._paused&&!I._disowned)$.pause(H)}),I.on("resume",function(H){if($._paused&&!I._disowned)$.resume(H)}),I.on("stat",function(H){if($.emit("_entryStat",I,H),I._aborted)return;if(I._paused)I.once("resume",function(){$.emit("entryStat",I,H)});else $.emit("entryStat",I,H)}),I.on("ready",function H(){if($._paused)return I.pause($),$.once("resume",H);if(I.type==="Socket")$.emit("socket",I);else $.emitEntry(I)});var K=!1;I.on("close",G),I.on("disown",G);function G(){if(K)return;if(K=!0,$.emit("childEnd",I),$.emit("entryEnd",I),$._currentEntry=null,!$._paused)$._read()}I.on("error",function(H){if(I._swallowErrors)$.warn(H),I.emit("end"),I.emit("close");else $.emit("error",H)}),["child","childEnd","warn"].forEach(function(H){I.on(H,$.emit.bind($,H))})})};D9.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};D9.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}};D9.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",$)};D9.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()};D9.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var Fc=E((me1,oM0)=>{oM0.exports=Kz;var Yw1=o8(),Uw1=X1(),dM0=Iz(),mM0={EOF:!0},lM0={CLOSE:!0};Uw1(Kz,dM0);function Kz($){var Y=this;if(!(Y instanceof Kz))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,dM0.call(Y,$)}Kz.prototype._getStream=function(){var $=this,Y=$._stream=Yw1.createReadStream($._path,$.p Line truncated
`));else U.emit("warn",z)};g2.prototype.info=function($,Y){this.emit("info",$,Y)};g2.prototype.error=function($,Y,U){var z=iM0($,Y,this);if(U)throw z;else this.emit("error",z)};function iM0($,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(z){return z.replace(/^ {4}at /,"")}),$}});var FZ=E((ee1,cM0)=>{cM0.exports=HO1;function HO1($){var Y=["Directory","File","SymbolicLink","Link","BlockDevice","CharacterDevice","FIFO","Socket"],U;if($.type&&Y.indexOf($.type)!==-1)return $[$.type]=!0,$.type;for(var z=0,Q=Y.length;z<Q;z++){U=Y[z];var J=$[U]||$["is"+U];if(typeof J==="function")J=J.call($);if(J)return $[U]=!0,$.type=U,U}return null}});var Fc=E(($04,dM0)=>{dM0.exports=wZ;var WO1=r8(),XO1=X1(),Lc=Iz();XO1(wZ,Lc);function wZ($){var Y=this;if(!(Y instanceof wZ))throw Error("LinkReader must be called as constructor.");if(!($.type==="Link"&&$.Link||$.type==="SymbolicLink"&&$.SymbolicLink))throw Error("Non-link type "+$.type);Lc.call(Y,$)}wZ.prototype._stat=function($){var Y=this;WO1.readlink(Y._path,function(U,z){if(U)return Y.error(U);Y.linkpath=Y.props.linkpath=z,Y.emit("linkpath",z),Lc.prototype._stat.call(Y,$)})};wZ.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Oc=E((Y04,lM0)=>{lM0.exports=B9;var mM0=r8(),ZO1=X1(),OZ=I0("path"),wc=Iz(),pM0=I0("assert").ok;ZO1(B9,wc);function B9($){var Y=this;if(!(Y instanceof B9))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;wc.call(this,$)}B9.prototype._getEntries=function(){var $=this;if($._gotEntries)return;$._gotEntries=!0,mM0.readdir($._path,function(Y,U){if(Y)return $.error(Y);if($.entries=U,$.emit("entries",U),$._paused)$.once("resume",z);else z();function z(){if($._length=$.entries.length,typeof $.sort==="function")$.entries=$.entries.sort($.sort.bind($));$._read()}})};B9.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=OZ.resolve($._path,$.entries[$._index]);pM0(Y!==$._path),pM0($.entries[$._index]),$._currentEntry=Y,mM0[$.props.follow?"stat":"lstat"](Y,function(U,z){if(U)return $.error(U);var Q=$._proxy||$;z.path=Y,z.basename=OZ.basename(Y),z.dirname=OZ.dirname(Y);var J=$.getChildProps.call(Q,z);J.path=Y,J.basename=OZ.basename(Y),J.dirname=OZ.dirname(Y);var I=wc(J,z);$._currentEntry=I,I.on("pause",function(H){if(!$._paused&&!I._disowned)$.pause(H)}),I.on("resume",function(H){if($._paused&&!I._disowned)$.resume(H)}),I.on("stat",function(H){if($.emit("_entryStat",I,H),I._aborted)return;if(I._paused)I.once("resume",function(){$.emit("entryStat",I,H)});else $.emit("entryStat",I,H)}),I.on("ready",function H(){if($._paused)return I.pause($),$.once("resume",H);if(I.type==="Socket")$.emit("socket",I);else $.emitEntry(I)});var K=!1;I.on("close",G),I.on("disown",G);function G(){if(K)return;if(K=!0,$.emit("childEnd",I),$.emit("entryEnd",I),$._currentEntry=null,!$._paused)$._read()}I.on("error",function(H){if(I._swallowErrors)$.warn(H),I.emit("end"),I.emit("close");else $.emit("error",H)}),["child","childEnd","warn"].forEach(function(H){I.on(H,$.emit.bind($,H))})})};B9.prototype.disown=function($){if($.emit("beforeDisown"),$._disowned=!0,$.parent=$.root=null,$===this._currentEntry)this._currentEntry=null;$.emit("disown")};B9.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}};B9.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",$)};B9.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()};B9.prototype.emitEntry=function($){this.emit("entry",$),this.emit("child",$)}});var Mc=E((U04,aM0)=>{aM0.exports=Kz;var qO1=r8(),VO1=X1(),oM0=Iz(),rM0={EOF:!0},sM0={CLOSE:!0};VO1(Kz,oM0);function Kz($){var Y=this;if(!(Y instanceof Kz))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,oM0.call(Y,$)}Kz.prototype._getStream=function(){var $=this,Y=$._stream=qO1.createReadStream($._path,$.p Line truncated
expect: `+$.props.size+`
actual: `+$._bytesEmitted)}),Y.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(lM0),$._read();else $.emit("close")}),Y.on("error",function(U){$.emit("error",U)}),$._read()};Kz.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var Y=$._buffer;for(var U=0,z=Y.length;U<z;U++){var Q=Y[U];if(Q===mM0)$.emit("end");else if(Q===lM0)$.emit("close");else $.emit("data",Q);if($._paused){$._buffer=Y.slice(U);return}}$._buffer.length=0}};Kz.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._stream)Y._stream.pause();Y.emit("pause",$)};Kz.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 aM0=E((le1,sM0)=>{sM0.exports=FB;var zw1=X1(),rM0=Iz();zw1(FB,rM0);function FB($){var Y=this;if(!(Y instanceof FB))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);rM0.call(Y,$)}FB.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var wc=E((oe1,tM0)=>{tM0.exports=Gz;var Oc=Iz(),Qw1=FZ(),Jw1=X1(),Iw1=o8();Jw1(Gz,Oc);function Gz($){var Y=this;if(!(Y instanceof Gz))throw Error("ProxyReader must be called as constructor.");Y.props=$,Y._buffer=[],Y.ready=!1,Oc.call(Y,$)}Gz.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";Iw1[U](Y.path,function(z,Q){var J;if(z||!Q)J="File";else J=Qw1(Q);Y[J]=!0,Y.type=$.type=J,$._old=Q,$._addProxy(Oc(Y,Q))})};Gz.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(z){$.on(z,Y.emit.bind(Y,z))}),Y.emit("proxy",$),$.on("ready",function(){Y.ready=!0,Y.emit("ready")});var U=Y._buffer;Y._buffer.length=0,U.forEach(function(z){$[z[0]].apply($,z[1])})};Gz.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};Gz.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var Iz=E((re1,YN0)=>{YN0.exports=N5;var Kw1=o8(),Gw1=I0("stream").Stream,Hw1=X1(),Mc=I0("path"),Nc=FZ(),OB=N5.hardLinks={},eM0=LB();Hw1(N5,eM0);var $N0=qc();function N5($,Y){var U=this;if(!(U instanceof N5))return new N5($,Y);if(typeof $==="string")$={path:$};var z,Q;if($.type&&typeof $.type==="function")z=$.type,Q=z;else z=Nc($),Q=N5;if(Y&&!z)z=Nc(Y),$[z]=!0,$.type=z;switch(z){case"Directory":Q=Lc();break;case"Link":case"File":Q=Fc();break;case"SymbolicLink":Q=$N0;break;case"Socket":Q=aM0();break;case null:Q=wc();break}if(!(U instanceof Q))return new Q($);if(eM0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=z,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=Mc.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=Mc.basename(U.path),U.dirname=$.dirname=Mc.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=Ww1;U._stat(Y)}function Ww1($,Y){return $===Y?0:$.toLowerCase()>Y.toLowerCase()?1:$.toLowerCase()<Y.toLowerCase()?-1:$>Y?1:-1}N5.prototype._stat=function($){var Y=this,U=Y.props,z=U.follow?"stat":"lstat";if($)process.nextTick(Q.bind(null,null,$));else Kw1[z](Y._path,Q);function Q(J,I){if(J)return Y.error(J);if(Object.keys(I).forEach(function(q){U[q]=I[q]}),Y.size!==void 0&&U.size!==Y.size)return Y.error("incorrect size");Y.size=U.size;var K=Nc(U),G=U.hardlinks!==!1;if(G&&K!=="Directory"&&U.nlink&&U.nlink>1){var H=U.dev+":"+U.ino;if(OB[H]===Y._path||!OB[H])OB[H]=Y._path;else K=Y.type=Y.props.type="Link",Y.Link=Y.props.Link=!0,Y.linkpath=Y.props.linkpath=OB[H],Y._stat=Y._read=$N0.prototype._read}if(Y.type&&Y.type!==K)Y.error("Unexpected type: "+K);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()})()}};N5.prototype.pipe=function($){var Y=this;if(typeof $.add==="function")Y.on("entry",function(U){var z=$.add(U);if(z===!1)Y.pause()});return Gw1.prototype.pipe.apply(this,arguments)};N5.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};N5.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};N5.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var Pc=E((se1,HN0)=> Line truncated
actual: `+$._bytesEmitted)}),Y.on("close",function(){if($._paused||$._buffer.length)$._buffer.push(sM0),$._read();else $.emit("close")}),Y.on("error",function(U){$.emit("error",U)}),$._read()};Kz.prototype._read=function(){var $=this;if($._paused)return;if(!$._stream)return $._getStream();if($._buffer.length){var Y=$._buffer;for(var U=0,z=Y.length;U<z;U++){var Q=Y[U];if(Q===rM0)$.emit("end");else if(Q===sM0)$.emit("close");else $.emit("data",Q);if($._paused){$._buffer=Y.slice(U);return}}$._buffer.length=0}};Kz.prototype.pause=function($){var Y=this;if(Y._paused)return;if($=$||Y,Y._paused=!0,Y._stream)Y._stream.pause();Y.emit("pause",$)};Kz.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 $N0=E((z04,eM0)=>{eM0.exports=wA;var LO1=X1(),tM0=Iz();LO1(wA,tM0);function wA($){var Y=this;if(!(Y instanceof wA))throw Error("SocketReader must be called as constructor.");if(!($.type==="Socket"&&$.Socket))throw Error("Non-socket type "+$.type);tM0.call(Y,$)}wA.prototype._read=function(){var $=this;if($._paused)return;if(!$._ended)$.emit("end"),$.emit("close"),$._ended=!0}});var Dc=E((Q04,YN0)=>{YN0.exports=Gz;var Nc=Iz(),FO1=FZ(),wO1=X1(),OO1=r8();wO1(Gz,Nc);function Gz($){var Y=this;if(!(Y instanceof Gz))throw Error("ProxyReader must be called as constructor.");Y.props=$,Y._buffer=[],Y.ready=!1,Nc.call(Y,$)}Gz.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";OO1[U](Y.path,function(z,Q){var J;if(z||!Q)J="File";else J=FO1(Q);Y[J]=!0,Y.type=$.type=J,$._old=Q,$._addProxy(Nc(Y,Q))})};Gz.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(z){$.on(z,Y.emit.bind(Y,z))}),Y.emit("proxy",$),$.on("ready",function(){Y.ready=!0,Y.emit("ready")});var U=Y._buffer;Y._buffer.length=0,U.forEach(function(z){$[z[0]].apply($,z[1])})};Gz.prototype.pause=function(){return this._proxyTarget?this._proxyTarget.pause():!1};Gz.prototype.resume=function(){return this._proxyTarget?this._proxyTarget.resume():!1}});var Iz=E((J04,QN0)=>{QN0.exports=B5;var MO1=r8(),NO1=I0("stream").Stream,DO1=X1(),Bc=I0("path"),Ac=FZ(),OA=B5.hardLinks={},UN0=FA();DO1(B5,UN0);var zN0=Fc();function B5($,Y){var U=this;if(!(U instanceof B5))return new B5($,Y);if(typeof $==="string")$={path:$};var z,Q;if($.type&&typeof $.type==="function")z=$.type,Q=z;else z=Ac($),Q=B5;if(Y&&!z)z=Ac(Y),$[z]=!0,$.type=z;switch(z){case"Directory":Q=Oc();break;case"Link":case"File":Q=Mc();break;case"SymbolicLink":Q=zN0;break;case"Socket":Q=$N0();break;case null:Q=Dc();break}if(!(U instanceof Q))return new Q($);if(UN0.call(U),!$.path)U.error("Must provide a path",null,!0);if(U.readable=!0,U.writable=!1,U.type=z,U.props=$,U.depth=$.depth=$.depth||0,U.parent=$.parent||null,U.root=$.root||$.parent&&$.parent.root||U,U._path=U.path=Bc.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=Bc.basename(U.path),U.dirname=$.dirname=Bc.dirname(U.path),$.parent=$.root=null,U.size=$.size,U.filter=typeof $.filter==="function"?$.filter:null,$.sort==="alpha")$.sort=BO1;U._stat(Y)}function BO1($,Y){return $===Y?0:$.toLowerCase()>Y.toLowerCase()?1:$.toLowerCase()<Y.toLowerCase()?-1:$>Y?1:-1}B5.prototype._stat=function($){var Y=this,U=Y.props,z=U.follow?"stat":"lstat";if($)process.nextTick(Q.bind(null,null,$));else MO1[z](Y._path,Q);function Q(J,I){if(J)return Y.error(J);if(Object.keys(I).forEach(function(q){U[q]=I[q]}),Y.size!==void 0&&U.size!==Y.size)return Y.error("incorrect size");Y.size=U.size;var K=Ac(U),G=U.hardlinks!==!1;if(G&&K!=="Directory"&&U.nlink&&U.nlink>1){var H=U.dev+":"+U.ino;if(OA[H]===Y._path||!OA[H])OA[H]=Y._path;else K=Y.type=Y.props.type="Link",Y.Link=Y.props.Link=!0,Y.linkpath=Y.props.linkpath=OA[H],Y._stat=Y._read=zN0.prototype._read}if(Y.type&&Y.type!==K)Y.error("Unexpected type: "+K);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()})()}};B5.prototype.pipe=function($){var Y=this;if(typeof $.add==="function")Y.on("entry",function(U){var z=$.add(U);if(z===!1)Y.pause()});return NO1.prototype.pipe.apply(this,arguments)};B5.prototype.pause=function($){if(this._paused=!0,$=$||this,this.emit("pause",$),this._stream)this._stream.pause($)};B5.prototype.resume=function($){if(this._paused=!1,$=$||this,this.emit("resume",$),this._stream)this._stream.resume($);this._read()};B5.prototype._read=function(){this.error("Cannot read unknown type: "+this.type)}});var Ec=E((I04,ZN0)=> Line truncated
expect: `+$.size+`
actual: `+$._bytesWritten);CB.prototype._finish.call($)}});var yc=E((V04,tN0)=>{tN0.exports=u2;var gc=oI(),xw1=FZ(),fw1=X1(),uw1=jB(),bw1=I0("fs");fw1(u2,gc);function u2($){var Y=this;if(!(Y instanceof u2))throw Error("ProxyWriter must be called as constructor.");Y.props=$,Y._needDrain=!1,gc.call(Y,$)}u2.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";bw1[U](Y.path,function(z,Q){var J;if(z||!Q)J="File";else J=xw1(Q);Y[J]=!0,Y.type=$.type=J,$._old=Q,$._addProxy(gc(Y,Q))})};u2.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(z){$.on(z,Y.emit.bind(Y,z))}),Y.emit("proxy",$);var U=Y._buffer;if(U.forEach(function(z){$[z[0]].apply($,z[1])}),Y._buffer.length=0,Y._needsDrain)Y.emit("drain")};u2.prototype.add=function($){if(uw1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};u2.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};u2.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var oI=E((L04,KD0)=>{KD0.exports=u$;var f$=o8(),iw1=X1(),nw1=Pc(),cw1=Rc(),AZ=I0("path"),$D0=process.platform==="win32"?0:process.umask(),YD0=FZ(),UD0=LB();iw1(u$,UD0);u$.dirmode=parseInt("0777",8)&~$D0;u$.filemode=parseInt("0666",8)&~$D0;var pw1=vc(),dw1=hc(),mw1=Sc(),lw1=yc();function u$($,Y){var U=this;if(typeof $==="string")$={path:$};var z=YD0($),Q=u$;switch(z){case"Directory":Q=pw1;break;case"File":Q=mw1;break;case"Link":case"SymbolicLink":Q=dw1;break;case null:default:Q=lw1;break}if(!(U instanceof Q))return new Q($);if(UD0.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=AZ.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=AZ.basename($.path),U.dirname=AZ.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)}u$.prototype._create=function(){var $=this;f$[$.props.follow?"stat":"lstat"]($._path,function(Y){if(Y)return $.warn("Cannot create "+$._path+`
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};u$.prototype._stat=function($){var Y=this,U=Y.props,z=U.follow?"stat":"lstat",Q=Y._proxy||Y;if($)J(null,$);else f$[z](Y._path,J);function J(I,K){if(Y.filter&&!Y.filter.call(Q,Q,K)){Y._aborted=!0,Y.emit("end"),Y.emit("close");return}if(I||!K)return kc(Y);Y._old=K;var G=YD0(K);if(G!==Y.type||Y.type==="File"&&K.nlink>1)return nw1(Y._path,function(H){if(H)return Y.error(H);Y._old=null,kc(Y)});kc(Y)}};function kc($){cw1(AZ.dirname($._path),u$.dirmode,function(Y,U){if(Y)return $.error(Y);return $._madeDir=U,$._create()})}function zD0($,Y,U,z,Q){var J=Y.mode,I=Y.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!f$[I])return Q();if(typeof J!=="number")return Q();var K=U.mode&parseInt("0777",8);if(J=J&parseInt("0777",8),J===K)return Q();f$[I](z,J,Q)}function QD0($,Y,U,z,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(!f$[J])return Q();if(typeof Y.uid!=="number")Y.uid=U.uid;if(typeof Y.gid!=="number")Y.gid=U.gid;f$[J](z,Y.uid,Y.gid,Q)}function JD0($,Y,U,z,Q){if(!f$.utimes||process.platform==="win32")return Q();var J=Y.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(J==="lutimes"&&!f$[J])J="utimes";if(!f$[J])return Q();var{atime:I,mtime:K}=U,G=Y.atime,H=Y.mtime;if(G===void 0)G=I;if(H===void 0)H=K;if(!eN0(G))G=new Date(G);if(!eN0(H))G=new Date(H);if(G.getTime()===I.getTime()&&H.getTime()===K.getTime())return Q();f$[J](z,G,H,Q)}u$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var Y=0,U=null,z=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),J($._old);else{var Q=$.props.follow?"stat":"lstat";f$[Q]($._path,function(K,G){if(K)if(K.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(K);J($._old=G)})}return;function J(K){Y+=3,zD0($,$.props,K,$._path,I("chmod")),QD0($,$.props,K,$._path,I("chown")),JD0($,$.props,K,$._path,I("utimes"))}function I(K){return function(G){if(U)return;if(G)return G.fstream_finish_call=K,$.error(U=G);if(--Y>0)return;if(z)return;if(z=!0,!$._madeDir)return H();else ID0($,$._path,H);function H(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function ID0($,Y,U){var z=$._madeDir,Q=AZ.dirname(Y);ow1($,Q,function(J){if(J)return U(J);if(Q===z)return U();ID0($,Q,U)})}function ow1($,Y,U){var z={};Object.keys($.props).forEach(function(K){if(z[K]=$.props[K],K==="mode"&&$.type!=="Directory")z[K]=z[K]|parseInt("0111",8)});var Q=3,J=null;f$.stat(Y,function(K,G){if(K)return U(J=K);zD0($,z,G,Y,I),QD0($,z,G,Y,I),JD0($,z,G,Y,I)});function I(K){if(J)return;if(K)return U(J=K);if(--Q===0)return U()}}u$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};u$.prototype.add=function(){this.error("Can't add to non-Directory type")};u$.prototype.write=function(){return!0};function rw1($){return Object.prototype.toString.call($)}function eN0($){return typeof $==="object"&&rw1($)==="[object Date]"}});var ic=E((sw1)=>{sw1.Abstract=LB();sw1.Reader=Iz();sw1.Writer=oI();sw1.File={Reader:Fc(),Writer:Sc()};sw1.Dir={Reader:Lc(),Writer:vc()};sw1.Link={Reader:qc(),Writer:hc()};sw1.Proxy={Reader:wc(),Writer:yc()};sw1.Reader.Dir=sw1.DirReader=sw1.Dir.Reader;sw1.Reader.File=sw1.FileReader=sw1.File.Reader;sw1.Reader.Link=sw1.LinkReader=sw1.Link.Reader;sw1.Reader.Proxy=sw1.ProxyReader=sw1.Proxy.Reader;sw1.Writer.Dir=sw1.DirWriter=sw1.Dir.Writer;sw1.Writer.File=sw1.FileWriter=sw1.File.Writer;sw1.Writer.Link=sw1.LinkWriter=sw1.Link.Writer;sw1.Writer.Proxy=sw1.ProxyWriter=sw1.Proxy.Writer;sw1.collect=jB()});var HD0=E((T04,GD0)=>{GD0.exports=QM1;var ew1=IB(),$M1=ic().Writer,nc=I0("path"),YM1=I0("stream"),UM1=Wc(),zM1=h2();function QM1($){$.path=nc.resolve(nc.normalize($.path));var Y=new ew1($),U=new YM1.Writable({objectMode:!0});U._write=function(Q,J,I){if(Q.type=="Directory")return I();var K=nc.join($.path,Q.path);if(K.indexOf($.path)!=0)return I();let G=$.getWriter?$.getWriter({path:K}):$M1({path:K});Q.pipe(G).on("error",I).on("close",I)};var z=UM1(Y,U);return Y.once("crx-header",function(Q){z.crxHeader=Q}),Y.pipe(U).on("finish",function(){z.emit("close")}),z.promise=function(){return new zM1(function(Q,J){z.on("close",Q),z.on("error",J)})},z}});var WD0=E((j04,RB)=>{var C6=function($){var Y=1e7,U=7,z=9007199254740992,Q=Z(z),J="0123456789abcdefghijklmnopqrstuvwxyz",I=typeof BigInt==="function";function K(B,v,u,a){if(typeof B>"u")return K[0];if(typeof v<"u")return+v===10&&!u?A0(B):b0(B,v,u,a);return A0(B)}function G(B,v){this.value=B,this.sign=v,this.isSmall=!1}G.prototype=Object.create(K.prototype);function H(B){this.value=B,this.sign=B<0,this.isSmall=!0}H.prototype=Object.create(K.prototype);function W(B){ Line truncated
actual: `+$._bytesWritten);RA.prototype._finish.call($)}});var fc=E((P04,YD0)=>{YD0.exports=u2;var xc=oI(),rO1=FZ(),sO1=X1(),aO1=EA(),tO1=I0("fs");sO1(u2,xc);function u2($){var Y=this;if(!(Y instanceof u2))throw Error("ProxyWriter must be called as constructor.");Y.props=$,Y._needDrain=!1,xc.call(Y,$)}u2.prototype._stat=function(){var $=this,Y=$.props,U=Y.follow?"stat":"lstat";tO1[U](Y.path,function(z,Q){var J;if(z||!Q)J="File";else J=rO1(Q);Y[J]=!0,Y.type=$.type=J,$._old=Q,$._addProxy(xc(Y,Q))})};u2.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(z){$.on(z,Y.emit.bind(Y,z))}),Y.emit("proxy",$);var U=Y._buffer;if(U.forEach(function(z){$[z[0]].apply($,z[1])}),Y._buffer.length=0,Y._needsDrain)Y.emit("drain")};u2.prototype.add=function($){if(aO1($),!this._proxy)return this._buffer.push(["add",[$]]),this._needDrain=!0,!1;return this._proxy.add($)};u2.prototype.write=function($){if(!this._proxy)return this._buffer.push(["write",[$]]),this._needDrain=!0,!1;return this._proxy.write($)};u2.prototype.end=function($){if(!this._proxy)return this._buffer.push(["end",[$]]),!1;return this._proxy.end($)}});var oI=E((T04,WD0)=>{WD0.exports=b$;var u$=r8(),eO1=X1(),$M1=Ec(),YM1=hc(),BZ=I0("path"),zD0=process.platform==="win32"?0:process.umask(),QD0=FZ(),JD0=FA();eO1(b$,JD0);b$.dirmode=parseInt("0777",8)&~zD0;b$.filemode=parseInt("0666",8)&~zD0;var UM1=gc(),zM1=yc(),QM1=kc(),JM1=fc();function b$($,Y){var U=this;if(typeof $==="string")$={path:$};var z=QD0($),Q=b$;switch(z){case"Directory":Q=UM1;break;case"File":Q=QM1;break;case"Link":case"SymbolicLink":Q=zM1;break;case null:default:Q=JM1;break}if(!(U instanceof Q))return new Q($);if(JD0.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=BZ.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=BZ.basename($.path),U.dirname=BZ.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)}b$.prototype._create=function(){var $=this;u$[$.props.follow?"stat":"lstat"]($._path,function(Y){if(Y)return $.warn("Cannot create "+$._path+`
Unsupported type: `+$.type,"ENOTSUP");$._finish()})};b$.prototype._stat=function($){var Y=this,U=Y.props,z=U.follow?"stat":"lstat",Q=Y._proxy||Y;if($)J(null,$);else u$[z](Y._path,J);function J(I,K){if(Y.filter&&!Y.filter.call(Q,Q,K)){Y._aborted=!0,Y.emit("end"),Y.emit("close");return}if(I||!K)return uc(Y);Y._old=K;var G=QD0(K);if(G!==Y.type||Y.type==="File"&&K.nlink>1)return $M1(Y._path,function(H){if(H)return Y.error(H);Y._old=null,uc(Y)});uc(Y)}};function uc($){YM1(BZ.dirname($._path),b$.dirmode,function(Y,U){if(Y)return $.error(Y);return $._madeDir=U,$._create()})}function ID0($,Y,U,z,Q){var J=Y.mode,I=Y.follow||$.type!=="SymbolicLink"?"chmod":"lchmod";if(!u$[I])return Q();if(typeof J!=="number")return Q();var K=U.mode&parseInt("0777",8);if(J=J&parseInt("0777",8),J===K)return Q();u$[I](z,J,Q)}function KD0($,Y,U,z,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(!u$[J])return Q();if(typeof Y.uid!=="number")Y.uid=U.uid;if(typeof Y.gid!=="number")Y.gid=U.gid;u$[J](z,Y.uid,Y.gid,Q)}function GD0($,Y,U,z,Q){if(!u$.utimes||process.platform==="win32")return Q();var J=Y.follow||$.type!=="SymbolicLink"?"utimes":"lutimes";if(J==="lutimes"&&!u$[J])J="utimes";if(!u$[J])return Q();var{atime:I,mtime:K}=U,G=Y.atime,H=Y.mtime;if(G===void 0)G=I;if(H===void 0)H=K;if(!UD0(G))G=new Date(G);if(!UD0(H))G=new Date(H);if(G.getTime()===I.getTime()&&H.getTime()===K.getTime())return Q();u$[J](z,G,H,Q)}b$.prototype._finish=function(){var $=this;if($._finishing)return;$._finishing=!0;var Y=0,U=null,z=!1;if($._old)$._old.atime=new Date(0),$._old.mtime=new Date(0),J($._old);else{var Q=$.props.follow?"stat":"lstat";u$[Q]($._path,function(K,G){if(K)if(K.code==="ENOENT"&&($.type==="Link"||$.type==="SymbolicLink")&&process.platform==="win32"){$.ready=!0,$.emit("ready"),$.emit("end"),$.emit("close"),$.end=$._finish=function(){};return}else return $.error(K);J($._old=G)})}return;function J(K){Y+=3,ID0($,$.props,K,$._path,I("chmod")),KD0($,$.props,K,$._path,I("chown")),GD0($,$.props,K,$._path,I("utimes"))}function I(K){return function(G){if(U)return;if(G)return G.fstream_finish_call=K,$.error(U=G);if(--Y>0)return;if(z)return;if(z=!0,!$._madeDir)return H();else HD0($,$._path,H);function H(W){if(W)return W.fstream_finish_call="setupMadeDir",$.error(W);$.emit("end"),$.emit("close")}}}};function HD0($,Y,U){var z=$._madeDir,Q=BZ.dirname(Y);IM1($,Q,function(J){if(J)return U(J);if(Q===z)return U();HD0($,Q,U)})}function IM1($,Y,U){var z={};Object.keys($.props).forEach(function(K){if(z[K]=$.props[K],K==="mode"&&$.type!=="Directory")z[K]=z[K]|parseInt("0111",8)});var Q=3,J=null;u$.stat(Y,function(K,G){if(K)return U(J=K);ID0($,z,G,Y,I),KD0($,z,G,Y,I),GD0($,z,G,Y,I)});function I(K){if(J)return;if(K)return U(J=K);if(--Q===0)return U()}}b$.prototype.pipe=function(){this.error("Can't pipe from writable stream")};b$.prototype.add=function(){this.error("Can't add to non-Directory type")};b$.prototype.write=function(){return!0};function KM1($){return Object.prototype.toString.call($)}function UD0($){return typeof $==="object"&&KM1($)==="[object Date]"}});var dc=E((GM1)=>{GM1.Abstract=FA();GM1.Reader=Iz();GM1.Writer=oI();GM1.File={Reader:Mc(),Writer:kc()};GM1.Dir={Reader:Oc(),Writer:gc()};GM1.Link={Reader:Fc(),Writer:yc()};GM1.Proxy={Reader:Dc(),Writer:fc()};GM1.Reader.Dir=GM1.DirReader=GM1.Dir.Reader;GM1.Reader.File=GM1.FileReader=GM1.File.Reader;GM1.Reader.Link=GM1.LinkReader=GM1.Link.Reader;GM1.Reader.Proxy=GM1.ProxyReader=GM1.Proxy.Reader;GM1.Writer.Dir=GM1.DirWriter=GM1.Dir.Writer;GM1.Writer.File=GM1.FileWriter=GM1.File.Writer;GM1.Writer.Link=GM1.LinkWriter=GM1.Link.Writer;GM1.Writer.Proxy=GM1.ProxyWriter=GM1.Proxy.Writer;GM1.collect=EA()});var ZD0=E((y04,XD0)=>{XD0.exports=FM1;var XM1=KA(),ZM1=dc().Writer,pc=I0("path"),qM1=I0("stream"),VM1=qc(),LM1=h2();function FM1($){$.path=pc.resolve(pc.normalize($.path));var Y=new XM1($),U=new qM1.Writable({objectMode:!0});U._write=function(Q,J,I){if(Q.type=="Directory")return I();var K=pc.join($.path,Q.path);if(K.indexOf($.path)!=0)return I();let G=$.getWriter?$.getWriter({path:K}):ZM1({path:K});Q.pipe(G).on("error",I).on("close",I)};var z=VM1(Y,U);return Y.once("crx-header",function(Q){z.crxHeader=Q}),Y.pipe(U).on("finish",function(){z.emit("close")}),z.promise=function(){return new LM1(function(Q,J){z.on("close",Q),z.on("error",J)})},z}});var qD0=E((k04,_A)=>{var C6=function($){var Y=1e7,U=7,z=9007199254740992,Q=Z(z),J="0123456789abcdefghijklmnopqrstuvwxyz",I=typeof BigInt==="function";function K(A,v,u,s){if(typeof A>"u")return K[0];if(typeof v<"u")return+v===10&&!u?B0(A):b0(A,v,u,s);return B0(A)}function G(A,v){this.value=A,this.sign=v,this.isSmall=!1}G.prototype=Object.create(K.prototype);function H(A){this.value=A,this.sign=A<0,this.isSmall=!0}H.prototype=Object.create(K.prototype);function W(A){ Line truncated
* Tmp
*
* Copyright (c) 2011-2017 KARASZI Istvan <github@spam.raszi.hu>
*
* MIT Licensed
*/var V4=I0("fs"),yB=I0("os"),R6=I0("path"),BD0=I0("crypto"),A9={fs:V4.constants,os:yB.constants},ED0=/XXXXXX/,CD0=(A9.O_CREAT||A9.fs.O_CREAT)|(A9.O_EXCL||A9.fs.O_EXCL)|(A9.O_RDWR||A9.fs.O_RDWR),CM1=yB.platform()==="win32",RM1=A9.EBADF||A9.os.errno.EBADF,_M1=A9.ENOENT||A9.os.errno.ENOENT,sI=[],RD0=V4.rmdirSync.bind(V4),_D0=!1;function vM1($,Y){return V4.rm($,{recursive:!0},Y)}function vD0($){return V4.rmSync($,{recursive:!0})}function lc($,Y){let U=aI($,Y),z=U[0],Q=U[1];iM1(z,function(J,I){if(J)return Q(J);let K=I.tries;(function G(){try{let H=SD0(I);V4.stat(H,function(W){if(!W){if(K-- >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 oc($){let Y=aI($),U=Y[0],z=nM1(U),Q=z.tries;do{let J=SD0(z);try{V4.statSync(J)}catch(I){return J}}while(Q-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function hM1($,Y){let U=aI($,Y),z=U[0],Q=U[1];lc(z,function(I,K){if(I)return Q(I);V4.open(K,CD0,z.mode||384,function(H,W){if(H)return Q(H);if(z.discardDescriptor)return V4.close(W,function(Z){return Q(Z,K,void 0,dc(K,-1,z,!1))});else{let X=z.discardDescriptor||z.detachDescriptor;Q(null,K,W,dc(K,X?-1:W,z,!1))}})})}function SM1($){let Y=aI($),U=Y[0],z=U.discardDescriptor||U.detachDescriptor,Q=oc(U),J=V4.openSync(Q,CD0,U.mode||384);if(U.discardDescriptor)V4.closeSync(J),J=void 0;return{name:Q,fd:J,removeCallback:dc(Q,z?-1:J,U,!0)}}function gM1($,Y){let U=aI($,Y),z=U[0],Q=U[1];lc(z,function(I,K){if(I)return Q(I);V4.mkdir(K,z.mode||448,function(H){if(H)return Q(H);Q(null,K,hD0(K,z,!1))})})}function yM1($){let Y=aI($),U=Y[0],z=oc(U);return V4.mkdirSync(z,U.mode||448),{name:z,removeCallback:hD0(z,U,!0)}}function kM1($,Y){let U=function(z){if(z&&!mc(z))return Y(z);Y()};if(0<=$[0])V4.close($[0],function(){V4.unlink($[1],U)});else V4.unlink($[1],U)}function xM1($){let Y=null;try{if(0<=$[0])V4.closeSync($[0])}catch(U){if(!cM1(U)&&!mc(U))throw U}finally{try{V4.unlinkSync($[1])}catch(U){if(!mc(U))Y=U}}if(Y!==null)throw Y}function dc($,Y,U,z){let Q=gB(xM1,[Y,$],z),J=gB(kM1,[Y,$],z,Q);if(!U.keep)sI.unshift(Q);return z?Q:J}function hD0($,Y,U){let z=Y.unsafeCleanup?vM1:V4.rmdir.bind(V4),Q=Y.unsafeCleanup?vD0:RD0,J=gB(Q,$,U),I=gB(z,$,U,J);if(!Y.keep)sI.unshift(J);return U?J:I}function gB($,Y,U,z){let Q=!1;return function J(I){if(!Q){let K=z||J,G=sI.indexOf(K);if(G>=0)sI.splice(G,1);if(Q=!0,U||$===RD0||$===vD0)return $(Y);else return $(Y,I||function(){})}}}function fM1(){if(!_D0)return;while(sI.length)try{sI[0]()}catch($){}}function PD0($){let Y=[],U=null;try{U=BD0.randomBytes($)}catch(z){U=BD0.pseudoRandomBytes($)}for(let z=0;z<$;z++)Y.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[z]%62]);return Y.join("")}function s8($){return typeof $>"u"}function aI($,Y){if(typeof $==="function")return[{},$];if(s8($))return[{},Y];let U={};for(let z of Object.getOwnPropertyNames($))U[z]=$[z];return[U,Y]}function uM1($,Y,U){let z=R6.isAbsolute($)?$:R6.join(Y,$);V4.stat(z,function(Q){if(Q)V4.realpath(R6.dirname(z),function(J,I){if(J)return U(J);U(null,R6.join(I,R6.basename(z)))});else V4.realpath(z,U)})}function bM1($,Y){let U=R6.isAbsolute($)?$:R6.join(Y,$);try{return V4.statSync(U),V4.realpathSync(U)}catch(z){let Q=V4.realpathSync(R6.dirname(U));return R6.join(Q,R6.basename(U))}}function SD0($){let Y=$.tmpdir;if(!s8($.name))return R6.join(Y,$.dir,$.name);if(!s8($.template))return R6.join(Y,$.dir,$.template).replace(ED0,PD0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",PD0(12),$.postfix?"-"+$.postfix:""].join("");return R6.join(Y,$.dir,U)}function pc($,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 gD0($){if(!s8($.name)){let Y=$.name;if(R6.isAbsolute(Y))throw Error(`name option must not contain an absolute path, found "${Y}".`);let U=R6.basename(Y);if(U===".."||U==="."||U!==Y)throw Error(`name option must not contain a path, found "${Y}".`)}if(!s8($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(ED0))throw Error(`Invalid template, found "${$.template}".`)}if(!s8($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=s8($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=s8($.prefix)?"":pc("prefix",$.prefix),$.postfix=s8($.postfix)?"":pc("postfix",$.postfix),$.template=s8($.template)?void 0:pc("template",$.template)}function TD0($,Y,U,z){if(s8(Y))return z(null);uM1(Y,U,function(Q,J){if(Q)return z(Q);let I=R6.relative(U,J);if(I.startsWith("..")||R6.isAbsolute(I))return z(Error(`${$} option must be relative to "${U}", found "${I}".`));z(null,I)})}function jD0($,Y,U){if(s8(Y))return;let z=bM1(Y,U),Q=R6.relative(U,z);if(Q.startsWith("..")||R6.isAbsolute(Q))thrLine truncated
*/var F4=I0("fs"),kA=I0("os"),R6=I0("path"),jD0=I0("crypto"),A9={fs:F4.constants,os:kA.constants},_D0=/XXXXXX/,vD0=(A9.O_CREAT||A9.fs.O_CREAT)|(A9.O_EXCL||A9.fs.O_EXCL)|(A9.O_RDWR||A9.fs.O_RDWR),bM1=kA.platform()==="win32",iM1=A9.EBADF||A9.os.errno.EBADF,nM1=A9.ENOENT||A9.os.errno.ENOENT,sI=[],hD0=F4.rmdirSync.bind(F4),SD0=!1;function cM1($,Y){return F4.rm($,{recursive:!0},Y)}function gD0($){return F4.rmSync($,{recursive:!0})}function sc($,Y){let U=aI($,Y),z=U[0],Q=U[1];eM1(z,function(J,I){if(J)return Q(J);let K=I.tries;(function G(){try{let H=kD0(I);F4.stat(H,function(W){if(!W){if(K-- >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 ac($){let Y=aI($),U=Y[0],z=$N1(U),Q=z.tries;do{let J=kD0(z);try{F4.statSync(J)}catch(I){return J}}while(Q-- >0);throw Error("Could not get a unique tmp filename, max tries reached")}function dM1($,Y){let U=aI($,Y),z=U[0],Q=U[1];sc(z,function(I,K){if(I)return Q(I);F4.open(K,vD0,z.mode||384,function(H,W){if(H)return Q(H);if(z.discardDescriptor)return F4.close(W,function(Z){return Q(Z,K,void 0,oc(K,-1,z,!1))});else{let X=z.discardDescriptor||z.detachDescriptor;Q(null,K,W,oc(K,X?-1:W,z,!1))}})})}function pM1($){let Y=aI($),U=Y[0],z=U.discardDescriptor||U.detachDescriptor,Q=ac(U),J=F4.openSync(Q,vD0,U.mode||384);if(U.discardDescriptor)F4.closeSync(J),J=void 0;return{name:Q,fd:J,removeCallback:oc(Q,z?-1:J,U,!0)}}function mM1($,Y){let U=aI($,Y),z=U[0],Q=U[1];sc(z,function(I,K){if(I)return Q(I);F4.mkdir(K,z.mode||448,function(H){if(H)return Q(H);Q(null,K,yD0(K,z,!1))})})}function lM1($){let Y=aI($),U=Y[0],z=ac(U);return F4.mkdirSync(z,U.mode||448),{name:z,removeCallback:yD0(z,U,!0)}}function oM1($,Y){let U=function(z){if(z&&!rc(z))return Y(z);Y()};if(0<=$[0])F4.close($[0],function(){F4.unlink($[1],U)});else F4.unlink($[1],U)}function rM1($){let Y=null;try{if(0<=$[0])F4.closeSync($[0])}catch(U){if(!YN1(U)&&!rc(U))throw U}finally{try{F4.unlinkSync($[1])}catch(U){if(!rc(U))Y=U}}if(Y!==null)throw Y}function oc($,Y,U,z){let Q=yA(rM1,[Y,$],z),J=yA(oM1,[Y,$],z,Q);if(!U.keep)sI.unshift(Q);return z?Q:J}function yD0($,Y,U){let z=Y.unsafeCleanup?cM1:F4.rmdir.bind(F4),Q=Y.unsafeCleanup?gD0:hD0,J=yA(Q,$,U),I=yA(z,$,U,J);if(!Y.keep)sI.unshift(J);return U?J:I}function yA($,Y,U,z){let Q=!1;return function J(I){if(!Q){let K=z||J,G=sI.indexOf(K);if(G>=0)sI.splice(G,1);if(Q=!0,U||$===hD0||$===gD0)return $(Y);else return $(Y,I||function(){})}}}function sM1(){if(!SD0)return;while(sI.length)try{sI[0]()}catch($){}}function ED0($){let Y=[],U=null;try{U=jD0.randomBytes($)}catch(z){U=jD0.pseudoRandomBytes($)}for(let z=0;z<$;z++)Y.push("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"[U[z]%62]);return Y.join("")}function a8($){return typeof $>"u"}function aI($,Y){if(typeof $==="function")return[{},$];if(a8($))return[{},Y];let U={};for(let z of Object.getOwnPropertyNames($))U[z]=$[z];return[U,Y]}function aM1($,Y,U){let z=R6.isAbsolute($)?$:R6.join(Y,$);F4.stat(z,function(Q){if(Q)F4.realpath(R6.dirname(z),function(J,I){if(J)return U(J);U(null,R6.join(I,R6.basename(z)))});else F4.realpath(z,U)})}function tM1($,Y){let U=R6.isAbsolute($)?$:R6.join(Y,$);try{return F4.statSync(U),F4.realpathSync(U)}catch(z){let Q=F4.realpathSync(R6.dirname(U));return R6.join(Q,R6.basename(U))}}function kD0($){let Y=$.tmpdir;if(!a8($.name))return R6.join(Y,$.dir,$.name);if(!a8($.template))return R6.join(Y,$.dir,$.template).replace(_D0,ED0(6));let U=[$.prefix?$.prefix:"tmp","-",process.pid,"-",ED0(12),$.postfix?"-"+$.postfix:""].join("");return R6.join(Y,$.dir,U)}function lc($,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 xD0($){if(!a8($.name)){let Y=$.name;if(R6.isAbsolute(Y))throw Error(`name option must not contain an absolute path, found "${Y}".`);let U=R6.basename(Y);if(U===".."||U==="."||U!==Y)throw Error(`name option must not contain a path, found "${Y}".`)}if(!a8($.template)){if(typeof $.template!=="string")throw Error(`template option must be a string, got "${typeof $.template}".`);if(!$.template.match(_D0))throw Error(`Invalid template, found "${$.template}".`)}if(!a8($.tries)&&isNaN($.tries)||$.tries<0)throw Error(`Invalid tries, found "${$.tries}".`);$.tries=a8($.name)?$.tries||3:1,$.keep=!!$.keep,$.detachDescriptor=!!$.detachDescriptor,$.discardDescriptor=!!$.discardDescriptor,$.unsafeCleanup=!!$.unsafeCleanup,$.prefix=a8($.prefix)?"":lc("prefix",$.prefix),$.postfix=a8($.postfix)?"":lc("postfix",$.postfix),$.template=a8($.template)?void 0:lc("template",$.template)}function CD0($,Y,U,z){if(a8(Y))return z(null);aM1(Y,U,function(Q,J){if(Q)return z(Q);let I=R6.relative(U,J);if(I.startsWith("..")||R6.isAbsolute(I))return z(Error(`${$} option must be relative to "${U}", found "${I}".`));z(null,I)})}function RD0($,Y,U){if(a8(Y))return;let z=tM1(Y,U),Q=R6.relative(U,z);if(Q.startsWith("..")||R6.isAbsolute(Q))thrLine truncated
`)}let z=[];Y.forEach((Q,J)=>{let I=$.length+J+1,K=J===0?"⏳ ":"";z.push(`${K}${I}. ${Q}`)});for(let Q=$.length-1;Q>=0;Q--){let J=Q+1;z.push(`${J}. ${$[Q]}`)}return z.join(`
`)}function Jp($,Y,U,z,Q){let J=$?.operator||Y?.operator||U?.operator,I=J?.name||J?.id||U?.operatorName||"",K=($?.nodeName||Y?.fromNodeName||Y?.nodeName||U?.nodeName||"").trim();if(K==="合思审批节点"||K==="外部审批节点"||K.includes("合思审批")||K.includes("外部审批"))K="";if((!K||K==="提交人"||K==="审批节点")&&I&&z){let w=z.find((O)=>O.operator?.name===I&&O.nodeName&&O.nodeName.trim()!=="提交人"&&!O.isEbot&&O.rawAction!=="freeflow.reject");if(w?.nodeName)K=w.nodeName.trim()}let H=$?.comment||Y?.reason||U?.rejectComment||"修改";if(H.includes(":")){let w=H.split(":");if(w.length>1)H=w.slice(1).join(":").trim()}let W=H;if(K&&I)W=`${K}(${I}) ❌: ${H}`;else if(I)W=`${I} ❌: ${H}`;else if(K)W=`${K} ❌: ${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||(I?`重新提交后由${I}继续审批`:"重新提交后继续审批");return{comment:`${W}
`)}function Gd($,Y,U,z,Q){let J=$?.operator||Y?.operator||U?.operator,I=J?.name||J?.id||U?.operatorName||"",K=($?.nodeName||Y?.fromNodeName||Y?.nodeName||U?.nodeName||"").trim();if(K==="合思审批节点"||K==="外部审批节点"||K.includes("合思审批")||K.includes("外部审批"))K="";if((!K||K==="提交人"||K==="审批节点")&&I&&z){let O=z.find((w)=>w.operator?.name===I&&w.nodeName&&w.nodeName.trim()!=="提交人"&&!w.isEbot&&w.rawAction!=="freeflow.reject");if(O?.nodeName)K=O.nodeName.trim()}let H=$?.comment||Y?.reason||U?.rejectComment||"修改";if(H.includes(":")){let O=H.split(":");if(O.length>1)H=O.slice(1).join(":").trim()}let W=H;if(K&&I)W=`${K}(${I}) ❌: ${H}`;else if(I)W=`${I} ❌: ${H}`;else if(K)W=`${K} ❌: ${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||(I?`重新提交后由${I}继续审批`:"重新提交后继续审批");return{comment:`${W}
↳ 驳回至: ${q}
↳ ${V}`,operator:J}}function OA0($){if(!$)return[];let Y=$.pending||[],U=String($.rawState||"").toUpperCase(),z=String($.state||"").toUpperCase(),Q=[];if(Y.length>0)for(let J of Y){let I=J.approver?.name||J.approver?.id||"待定",K=(J.name||$.currentNode||"").trim(),G=K?`${K}(${I})`:I,W=J.type?.toUpperCase()==="PAYING"||K.includes("支付")||U==="PAYING"||z==="支付中"?"待支付":"待审批";Q.push(`${G}: ${W}`)}else if($.currentNode?.trim()){let I=$.currentNode.includes("支付")||U==="PAYING"||z==="支付中"?"待支付":"待审批";Q.push(`${$.currentNode.trim()}: ${I}`)}return Q}function Xz($,Y){let U=new Map;if(!$||$.length===0)return U;if(!Y){for(let q of $){let F=(q.result||{}).decision||q.aiDecision||"-";U.set(q.id,{recordId:q.id,sourceDocumentSN:q.sourceDocumentSN,taskMode:q.taskMode,aiDecision:FA0(typeof F==="string"?F:"-"),aiAction:"-",eHumanAction:"-",eHumanComment:"-",auditDrift:!1})}return U}let z=[...$].sort((q,V)=>(Number(q.createdAt)||0)-(Number(V.createdAt)||0)),Q=Y.history||[],J=String(Y.rawState||"").toUpperCase(),I=String(Y.state||"").toUpperCase(),K=J==="DRAFT"||J==="REVOKED"||J==="CANCELED"||J==="CANCELLED"||I==="草稿"||I==="已撤回"||I==="已取消",G=J==="REJECTED"||J==="TERMINATED"||I==="审批驳回"||I==="已驳回",H=!K&&!G&&(J==="PAID"||I==="已支付"||Q.some((q)=>!q.isEbot&&(q.rawAction==="freeflow.pay"||q.action==="支付成功"||q.action==="支付完成"))),W=!K&&!G&&!H&&(J==="PAYING"||I==="支付中"||(Y.pending||[]).some((q)=>q.isCurrent&&(q.type?.toUpperCase()==="PAYING"||q.name?.includes("支付")))||Y.currentNode?.includes("支付")===!0),Z=H||!K&&!G&&!W&&(J==="COMPLETED"||J==="APPROVED"||I==="已完成"||I==="审批通过");for(let q=0;q<z.length;q++){let V=z[q];if(!V)continue;let F=Number(V.createdAt)||0,w=V.document||{},O=V.manualApprovalRecord||V.result?.manualApprovalRecord||w.manualApprovalRecord||{},M=typeof V.sourceExtendData?.nodeId==="string"?String(V.sourceExtendData.nodeId):void 0,N=typeof O.nodeId==="string"?String(O.nodeId):void 0,D=N?decodeURIComponent(N).replace(/^hcnode_/,"").replace(/_r\d+$/,""):void 0,P=M||D,T=P?Q.find((A0)=>A0.nodeId&&(A0.nodeId===P||P.includes(A0.nodeId))):void 0,A=T?.time??F,j=z[q+1],C=j?Number(j.createdAt)||1/0:1/0,b=q===z.length-1,k=Q.find((A0)=>(A0.time??0)>A+5000&&A0.isEbot&&(A0.nodeName?.includes("智能")||A0.nodeName?.includes("AI")||A0.action?.includes("智能")||A0.comment?.includes("AI")||A0.comment?.includes("approval-result"))&&!A0.nodeName?.includes("费用标准检查")&&!A0.nodeName?.includes("标准检查")&&!A0.nodeName?.includes("预算"));if(k){if(b=!1,(k.time??1/0)<C)C=k.time}let S=V.result||{},i=S.decision||V.aiDecision||"-",n=typeof i==="string"?i:"-",z0=n.toUpperCase(),x=z0==="REJECT"||z0==="驳回",d=z0==="APPROVE"||z0==="通过",t=z0==="EXEMPT_APPROVE"||z0==="免审通过"||z0==="备注通过",e=V.taskMode||V.finalExecutionMode||"",p=String(e).toLowerCase().includes("auto")||V.finalExecutionMode==="automatic"||e==="automatic"||e==="fully_automatic",Y0="-";if(d||t)Y0="添加评论";else if(x)Y0=p?"驳回":"添加评论";else if(z0==="REVIEW"||z0==="转交复核")Y0="转交复核";let y=typeof O.status==="object"&&O.status!==null?String(O.status.type||O.status.label||"").toUpperCase():"",r=typeof O.status==="object"&&O.status!==null?String(O.status.sourceStatus||""):"",$0=w.manualApprovalStatus||S.manualApprovalStatus||V.manualApprovalStatus,N0=typeof $0==="string"?$0.toUpperCase():"",j0=N0==="CANCELLED"||N0==="CANCELED"||N0==="已取消"||N0==="已撤回"||N0==="REVOKED"||y==="CANCELLED"||y==="CANCELED"||r.includes("撤回")||r.includes("取消"),_0=N0==="APPROVED"||N0==="已支付/审批完成"||N0==="已通过"||N0==="已完成"||N0==="已支付"||y==="APPROVED",f0=!(r.includes("补偿")||r.includes("已支付"))&&(N0==="TERMINATED"||N0==="REJECTED"||N0==="REJECT"||N0==="已驳回"||N0==="被驳回"||y==="TERMINATED"||y==="REJECTED"||y==="已驳回"||y==="被驳回"),e0=T?1000:60000,s=Q.filter((A0)=>{let Q0=A0.time??0;return Q0>=A-e0&&Q0<C}),H0="-",F0="-",b0=!1,i0,n0,w1=d||t,k1=Q.filter((A0)=>(A0.time??0)>A+5000),u1=k1.some((A0)=>A0.rawAction==="freeflow.retract"||A0.action==="单据撤回"),b1=k1.some((A0)=>A0.rawAction==="freeflow.submit"||A0.action==="提交送审");if(w1&&b&&(u1||b1))b0=!0,i0="AI通过后单据发生撤回/修改重提,后续未经AI复审";if(p&&x)H0="无操作",F0="-";else{let A0=s.filter((v)=>(v.time??0)>=A-1000&&!v.isEbot&&v.rawAction!=="freeflow.submit"&&v.action!=="提交送审"&&!((v.rawAction==="freeflow.comment"||v.action==="发表评论")&&!v.comment)&&!((v.rawAction==="freeflow.print"||v.action==="打印提醒")&&!v.comment)&&!(v.rawAction==="freeflow.carbonCopy"||v.rawAction==="freeflow.cc"||v.action==="抄送通知")),Q0=A0.find((v)=>v.rawAction==="freeflow.retract"||v.action==="单据撤回"),B=A0.find((v)=>v.rawAction==="freeflow.reject"||v.action==="审批驳回");if(!b)if(B||!Y&&f0){H0="审批驳回",b0=!1,i0=void 0;let v=Jp(B,void 0,O,Q,Y);F0=v.commen Line truncated
`,{mode:384}),Y}function wp($){let Y=xA0();for(let U of Y){if(!L$(U))continue;for(let z of oB(U).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=P9(U,z);try{let J=sB(Q,"utf-8"),I=JSON.parse(J);if(I&&typeof I==="object"&&I.id===$)return Q}catch{}}}return}function y3($,Y){let U=wp($);if(!U)throw Error(`Enterprise config not found: ${$}`);let Q={...JSON.parse(sB(U,"utf-8")),...Y};for(let I of Object.keys(Y))if(Y[I]===void 0)delete Q[I];let J=Lp.parse(Q);return vA0(U,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var Op="SEAL_USE_ENTERPRISES_DIR",hA0="SEAL_HOME_ENTERPRISES_DIR",SA0="SEAL_USE_USER_ENTERPRISES_DIR",gA0="SEAL_HOME_USER_ENTERPRISES_DIR",yA0="SEAL_USE_CONFIG_FILE",kA0="SEAL_HOME_CONFIG_FILE",YK,rB,lB,RA0;var k3=m(()=>{Fp();YK=P9(aB(),".config","seal-use","enterprises"),rB=P9(aB(),".config","seal-home","enterprises"),lB=P9(aB(),".config","seal-use","config.json"),RA0=P9(aB(),".config","seal-home","config.json")});function c2($,Y,U=[]){let z=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=z??Q;if(J){let K=$.find((W)=>W.id===J);if(K)return K;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 I=$[0];if(I)return I;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 Mp,mkdirSync as AD1,readFileSync as BD1,renameSync as PD1,unlinkSync as TD1,writeFileSync as jD1}from"node:fs";import{homedir as ED1}from"node:os";import{dirname as CD1,join as RD1}from"node:path";function SZ(){let $=process.env[_D1]?.trim();if($)return $;return vD1}function fA0($=new Date){return $.toISOString().slice(0,10)}function uA0($=Np,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function bA0($=SZ()){if(!Mp($))return{};try{let Y=BD1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function hD1($,Y){let U={};for(let[z,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},I=!1;for(let[K,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&K>=Y)J[K]=G,I=!0;if(I)U[z]=J}return U}function SD1($,Y=SZ()){let U=CD1(Y);if(!Mp(U))AD1(U,{recursive:!0,mode:448});let z=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{jD1(z,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),PD1(z,Y)}catch(Q){try{if(Mp(z))TD1(z)}catch{}throw Q}}function iA0($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=SZ(),z=bA0(U),Q=fA0(Y),J=uA0(Np,Y),I=hD1(z,J);I[$]=I[$]||{},I[$][Q]=(I[$][Q]??0)+1,SD1(I,U)}catch{}}function gD1($,Y=Np,U=new Date){let z=new Map;try{let Q=bA0(),J=uA0(Y,U),I=fA0(U),K=$??Object.keys(Q);for(let G of K){let H=Q[G];if(!H){z.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=I&&typeof Z==="number")W+=Z;z.set(G,W)}}catch{if($)for(let Q of $)z.set(Q,0)}return z}function nA0($,Y,U){let z=U??gD1($.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 I=z.get(Q.id)??0,K=z.get(J.id)??0;if(I!==K)return K-I;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 _D1="SEAL_USE_USAGE_FILE",vD1,Np=7;var eB=m(()=>{vD1=RD1(ED1(),".config","seal-use","usage.json")});function yD1($,Y){return $.map((U)=>U.trim()).filter(Boolean).map((U)=>Y?U:U.toLowerCase())}function kD1($,Y){return Y?$:$.toLowerCase()}function xD1($,Y,U,z){let Q=kD1($,z),J=Y.filter((I)=>Q.includes(I));if(U==="all"&&J.length!==Y.length)return[];return J}function fD1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function uD1($,Y){if(Y.fields&&!Y.fields.has($.field))return[];let U=fD1($.value),z=[];return U.forEach((Q,J)=>{let I=xD1(Q,Y.keywords,Y.matchMode,Y.caseSensitive);if(I.length===0)return;let K=Math.max(0,J-Y.contextLines),G=Math.min(U.length,J+Y.contextLines+1),H={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:J+1,matchedKeywords:I,matchedText:$P(Q,Y.maxChars),context:{before:Y.snippetOnly?[]:U.slice(K,J).map((W)=>$P(W,Y.maxChars)),line:$P(Q,Y.maxChars),after:Y.snippetOnly?[]:U.slice(J+1,G).map((W)=>$P(W,Y.maxChars))},metadata:$.metadata};if(Y.snippetOnly)H.context={before:[],line:H.context.line,after:[]};z.push(H)}),z}function $P($,Y){if(!Y||$.length<=Y)return $;return`${$.slice(0,Math.max(0,Y))}...`}function bD1($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function pA0($){return $.rules.flatMap((Y,U)=>{let z=`${$.id}:${Y.description.slice(0,32)}`,Q={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:Y.scope,strictness:Y.strictness,code:"code"in Y?Y.code:void 0,index:U};return[{area:"rules",entityType:"rule",entityId:z,title:`${$.versionName} / ${Y.scope}`,field:"hi Line truncated
`):[]}function lD1($,Y){let U=Array.from({length:$.length+1},()=>Array(Y.length+1).fill(0));for(let I=$.length-1;I>=0;I-=1)for(let K=Y.length-1;K>=0;K-=1)U[I][K]=$[I]===Y[K]?U[I+1][K+1]+1:Math.max(U[I+1][K],U[I][K+1]);let z=[],Q=0,J=0;while(Q<$.length&&J<Y.length)if($[Q]===Y[J])z.push(` ${$[Q]}`),Q+=1,J+=1;else if(U[Q+1][J]>=U[Q][J+1])z.push(`-${$[Q++]}`);else z.push(`+${Y[J++]}`);while(Q<$.length)z.push(`-${$[Q++]}`);while(J<Y.length)z.push(`+${Y[J++]}`);return z}function oD1($,Y,U,z,Q,J){let I=oA0(z,J),K=oA0(Q,J),G=z?`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}`,`@@ -${I.length?1:0},${I.length} +${K.length?1:0},${K.length} @@`,...lD1(I,K)].join(`
`)}function rA0($){return{id:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedAt:$.publishedAt}}function sA0($,Y){let U=new Map;for(let z of $.rules){let Q=gZ(z),J=Y==="stable-id"?tA0(Q):yZ(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 rD1($,Y,U){if(U!=="auto")return U;if([...$.rules,...Y.rules].every((J)=>Boolean(tA0(J))))return"stable-id";if([...$.rules,...Y.rules].every((J)=>Boolean(yZ(gZ(J).code??gZ(J).ruleCode))))return"code";throw Error("Rule snapshots have neither a complete stable-ID mapping nor a complete code mapping.")}function eA0($,Y,U={}){let z=rD1($,Y,U.identityMode??"auto"),Q=sA0($,z),J=sA0(Y,z),I=[...new Set([...Q.keys(),...J.keys()])],K=[],G={added:0,removed:0,modified:0,unchanged:0},H=rA0($),W=rA0(Y);for(let Z of I){let q=Q.get(Z),V=J.get(Z),F=q?Vz(q,z):void 0,w=V?Vz(V,z):void 0,O=!q?"added":!V?"removed":JSON.stringify(F)!==JSON.stringify(w)?"modified":"unchanged";if(G[O]+=1,O==="unchanged"&&!U.includeUnchanged)continue;let M=O==="modified"?[...new Set([...Object.keys(F??{}),...Object.keys(w??{})])].filter((N)=>JSON.stringify(F?.[N])!==JSON.stringify(w?.[N])):void 0;K.push({status:O,ruleId:Z,identityMode:z,...q?{before:q}:{},...V?{after:V}:{},...M?.length?{changedFields:M}:{},...O!=="unchanged"?{diff:oD1(Z,H,W,q,V,z)}:{}})}let X={from:H,to:W,identityMode:z,counts:G,changes:K,unifiedDiff:K.filter((Z)=>Z.diff).map((Z)=>Z.diff).join(`
`)};if(z==="code"){let Z=I.filter((P)=>Q.has(P)&&J.has(P)).length,q=I.filter((P)=>Q.has(P)&&J.has(P)&&JSON.stringify(Vz(Q.get(P),"code"))===JSON.stringify(Vz(J.get(P),"code"))).length,V=Q.size,F=J.size,w=Math.min(V,F)?Z/Math.min(V,F):1,O=new Map;for(let[P,T]of Q)O.set(JSON.stringify(Vz(T,"code")),P);let M=0;for(let[P,T]of J){let A=O.get(JSON.stringify(Vz(T,"code")));if(A&&A!==P)M+=1}let D=(Math.min(V,F)?q/Math.min(V,F):1)>=0.5?"high":q>0||M>0?"ambiguous":"low";X.codeStats={oldCount:V,newCount:F,sameCodeCount:Z,sameCodeUnchanged:q,sameBodyDifferentCode:M,overlapRatio:w,confidence:D,warning:"Published snapshots do not carry stable IDs; code matching can report reorderings as remove/add or modified rules."}}return X}function Ap($,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 z=$.unifiedDiff.length-Y,Q=`
... [diff truncated: ${z} characters omitted; rerun with --full for the complete diff]`,J=$.changes.map(({before:I,after:K,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:z,hint:"Use --full for the complete diff."}}}var aA0,mD1;var $B0=m(()=>{aA0=["id","ruleId","stableId"],mD1=new Set([...aA0,"runtimeRuleId","runtimeId","tenantId","createdAt","updatedAt","versionId","versionNumber"])});import{existsSync as sD1,mkdirSync as aD1,readFileSync as tD1,renameSync as eD1,writeFileSync as $A1}from"node:fs";import{homedir as YA1}from"node:os";import{join as YB0}from"node:path";function kZ($){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 YP($){return JSON.stringify([$.description??"",$.scope??"",$.strictness??""])}function UB0(){return process.env.SEAL_USE_RULE_VERSION_SNAPSHOTS_DIR?.trim()||YB0(YA1(),".config","seal-use","rule-version-snapshots")}function UA1($){return $.replace(/[^a-zA-Z0-9._-]/g,"_")}function zB0($,Y){return YB0(UB0(),`${UA1($)}-v${Y}.json`)}function xZ($,Y,U){let z=new Map,Q=new Map;for(let W of U){let X=kZ(W.code);if(X)z.set(X,[...z.get(X)??[],W]);let Z=YP(W);Q.set(Z,[...Q.get(Z)??[],W])}let J=[];for(let W of Y.rules??[]){let X=kZ(W.code),Z=X?z.get(X)??[]:[],q=Q.get(YP(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 I={corpId:$,versionId:Y.id,versionNumber:Y.versionNumber,capturedAt:new Date().toISOString(),rules:J},K=UB0();aD1(K,{recursive:!0,mode:448});let G=zB0($,Y.versionNumber),H=`${G}.${process.pid}.tmp`;return $A1(H,`${JSON.stringify(I,null,2)}
`,{encoding:"utf8",mode:384}),eD1(H,G),G}function zA1($,Y){let U=zB0($,Y.versionNumber);if(!sD1(U))return null;try{return JSON.parse(tD1(U,"utf8"))}catch{return null}}function Bp($,Y){let U=zA1($,Y);if(!U?.rules.length)return Y;let z=new Map(U.rules.flatMap((J)=>{let I=kZ(J.code);return I?[[I,J]]:[]})),Q=new Map(U.rules.map((J)=>[YP(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 I=(kZ(J.code)?z.get(kZ(J.code)):void 0)??Q.get(YP(J));return I?{...J,stableId:I.stableId}:J})}}var Pp=()=>{};import{createHmac as QA1,randomBytes as JA1}from"node:crypto";function IA1($,Y,U,z){return QA1("sha256",z).update(`${$}.${Y}.${JSON.stringify(U)}`).digest("hex")}function fZ($,Y){let U=Math.floor(Date.now()/1000),z=JA1(16).toString("hex");return{Authorization:`Bearer ${Y}`,"x-webhook-signature":IA1(U,z,$,Y),"x-webhook-timestamp":String(U),"x-webhook-nonce":z}}var UP=()=>{};function m4($,Y){return new L4($,2,Y)}function A5($,Y){return new L4($,10,Y)}function uZ($){if($ instanceof L4)return{exitCode:$.exitCode,nextAction:$.nextAction};let Y=$ instanceof Error?$.message:String($),U=KA1($);if(U===401||U===403||/(?:^|\s)(?:token|bearer|session) (?:expired|missing|invalid)/i.test(Y))return{exitCode:11};if(/^(?:Usage:|Unknown (?:[a-z0-9_-]+ )?command|Invalid (?:number|boolean|command)|--json must|Missing required JSON field)/i.test(Y))return{exitCode:2};if(/^Refusing to (?:clear|delete)|without --yes|without confirm=true/i.test(Y))return{exitCode:10};return{exitCode:1}}function KA1($){if(!$||typeof $!=="object")return;let Y=$.response;if(!Y||typeof Y!=="object")return;let U=Y.status;return typeof U==="number"?U:void 0}var L4,zP;var F$=m(()=>{L4=class L4 extends Error{exitCode;nextAction;constructor($,Y,U){super($);this.name="CliError",this.exitCode=Y,this.nextAction=U}};zP=class zP extends L4{constructor($,Y){super($,12,Y);this.name="PayloadTooLargeError"}}});function QB0($,Y){let U=$&&typeof $==="object"?$:{},z=typeof U.type==="string"?U.type.toUpperCase().trim():"",Q=typeof U.key==="string"&&U.key.trim()?U.key.trim():typeof U.label==="string"&&U.label.trim()?U.label.trim():`field_${Y}`,J=typeof U.label==="string"&&U.label.trim()?U.label.trim():Q,I=U.value!==void 0?U.value:null;if(z==="LIST"&&Array.isArray(I))I=I.map((G)=>{if(Array.isArray(G))return G.map((H,W)=>QB0(H,W));return G});let K=z;if(!GA1.has(K))if(Array.isArray(I))K="LIST";else if(I&&typeof I==="object")K="OBJECT";else if(typeof I==="number")K="NUMBER";else K="TEXT";return{key:Q,label:J,type:K,value:I}}function Tp($,Y={}){let U=$.document,z=$.sourceDocumentSN??(typeof U?.sn==="string"?U.sn:void 0)??(typeof U?.sourceDocumentSN==="string"?U.sourceDocumentSN:void 0)??$.id,Q=$.sourceDocumentId??(typeof U?.id==="string"?U.id:void 0)??(typeof U?.sourceDocumentId==="string"?U.sourceDocumentId:void 0)??$.documentId??$.id,J=Y.snPrefix??"",I=Y.snSuffix??"",K=Y.docIdPrefix??J,G=Y.docIdSuffix??I,H=`${J}${z}${I}`,W=`${K}${Q}${G}`,X=typeof U?.sourceStartTime==="number"?U.sourceStartTime:typeof $.createdAt==="number"?Math.floor($.createdAt/1000):null,q=(Array.isArray(U?.fields)?U.fields:[]).map((V,F)=>QB0(V,F));return{type:"document",documentId:W,documentSN:H,startTime:X,fields:q}}function HA1($){let Y=new URL($),U=Y.pathname.match(/\/webhook\/([^/]+)/);if(!U)throw Error(`Webhook URL 必须包含 /webhook/{webhookId}/document,收到: ${$}`);let z=U[1],Q=`${Y.protocol}//${Y.host}`,J=`${Q}/api/v1/integrations/webhook/${encodeURIComponent(z)}/document`;return{baseUrl:Q,webhookId:z,documentEndpoint:J}}async function jp($,Y,U,z=fetch,Q={}){let{webhookId:J,documentEndpoint:I}=HA1($),K={...Q,"Content-Type":"application/json",...fZ({webhookId:J,...U},Y)},G=await z(I,{method:"POST",headers:K,body:JSON.stringify(U)});if(!G.ok){let H=await G.text();throw Error(`Webhook 单据推送失败 (${G.status}): ${H}`)}return G.json()}function JB0($,Y,U){if(Y){let z=Y.trim().toLowerCase(),Q=$.find((J)=>J.id.toLowerCase()===z||J.name.toLowerCase()===z||J.incomingDocumentWebhook.id.toLowerCase()===z);if(!Q){let J=$.map((I)=>`"${I.name}" (${I.id})`).join(", ");throw Error(`未找到匹配 "${Y}" 的 Webhook 集成通道。可用通道: [${J}]`)}return Q}if($.length===1)return $[0];if($.length>1){let z=$.find((J)=>J.name.includes("回放")||J.name.toLowerCase().includes("replay"));if(z)return z;let Q=$.map((J)=>`"${J.name}" (${J.id})`).join(", ");throw Error(`当前租户存在多个 Webhook 通道 [${Q}],请通过 --webhook <idOrName> 指定目标通道。`)}throw new L4("当前租户未配置任何 Webhook 集成通道。",1,`seal-use webhook add --name <name> --result-url <url>${U?` --corp ${U}`:""}`)}function QP($,Y){let U,z,{sourceCorpId:Q,targetCorpId:J,activeCorp:I,force:K}=$;if(Q&&J)U=Y(Q),z=Y(J);else if(Q&&!J)if(U=Y(Q),U.testCorpId)z=Y(U.testCorpId);else if(I.id!==U.id&&I.environment==="test")z=I;else z=I;else if(!Q&&J)if(z=Y(J),z.prodCorpId)U=Y(z.prodCorpId);else if(I.id!==z.id)U=I;else U=I;else if(I.environment==="test")if(z=I,I Line truncated
`+"为防止测试单据污染生产审批流,禁止向生产环境重放单据。请指定测试企业 (--target-corp <testCorpId>),或在确有需要时添加 --force。",1,`seal-use webhook replay --target-corp <testCorpId>${U.id!==z.id?` --source-corp ${U.id}`:""}`);return{sourceCorp:U,targetCorp:z}}async function Ep($,Y,U){let z=Y.seal?.endpoints?.approvalStylePreferences??"api/v1/agent/ai-approval/config",Q=await I$($,z);if(U||Q.length>0)return JB0(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 Ew($,J,{name:"(Seal测-回放通道)",mode:"assisted",outgoingResultWebhook:`${J}/api/v1/integrations/webhook/replay-mock-callback`},Y.seal.endpoints.approvalStylePreferences)}throw new L4(`当前租户「${Y.name}」未配置任何 Webhook 集成通道。`,1,`seal-use webhook add --name <name> --result-url <url> --corp ${Y.id}`)}async function UK($){let{query:Y,sourceClient:U,targetClient:z,sourceCorp:Q,targetCorp:J,webhookSelector:I,snPrefix:K,snSuffix:G,docIdPrefix:H,docIdSuffix:W,dryRun:X,fetchFn:Z=fetch}=$,q=[];if(Y.recordId){let P=await W4(U,Y.recordId);q.push(P)}else if(Y.recordIds&&Y.recordIds.length>0)for(let P of Y.recordIds)q.push(await W4(U,P));else if(Y.sn){let T=(await i4(U,{search:Y.sn,sourceDocumentSN:Y.sn,limit:20})).records.find((A)=>A.sourceDocumentSN===Y.sn||A.sourceDocumentId===Y.sn||A.document?.sourceDocumentSN===Y.sn||A.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 A=(await i4(U,{search:P,sourceDocumentSN:P,limit:20})).records.find((j)=>j.sourceDocumentSN===P||j.sourceDocumentId===P||j.document?.sourceDocumentSN===P||j.document?.sn===P);if(!A)throw Error(`在企业「${Q.name}」中未找到单据编号为「${P}」的审批记录。`);q.push(A)}else if(Y.limit!==void 0){let P=await i4(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:Tp(P,{snPrefix:K,snSuffix:G,docIdPrefix:H,docIdSuffix:W})}));if(X){let P={id:"preview-webhook",name:I??"预览目标通道",mode:"assisted",incomingDocumentWebhookUrl:`${J.seal.url}/api/v1/integrations/webhook/preview`};try{let j=await I$(z,J.seal.endpoints.approvalStylePreferences);if(j.length>0){let C=JB0(j,I,J.id);P={id:C.id,name:C.name,mode:C.mode,incomingDocumentWebhookUrl:C.incomingDocumentWebhook.url}}}catch{}let T=V.map(({run:j,doc:C})=>({originalRecord:{id:j.id,sourceSystem:j.sourceSystem,sourceDocumentSN:j.sourceDocumentSN,sourceDocumentId:j.sourceDocumentId},document:C,success:!0})),A=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:A?T[0].originalRecord:void 0,document:A?T[0].document:void 0,records:T}}let F=await Ep(z,J,I),w={id:F.id,name:F.name,mode:F.mode,incomingDocumentWebhookUrl:F.incomingDocumentWebhook.url},O=[],M=0,N=0;for(let{run:P,doc:T}of V){console.error(`[webhook-replay] 正在向 Webhook 通道「${F.name}」推送单据: ${T.documentSN}...`);try{let A=await jp(F.incomingDocumentWebhook.url,F.secret,T,Z,A6(J.seal));O.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:A,success:!0}),M+=1}catch(A){let j=A instanceof Error?A.message:String(A);O.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:j,success:!1}),N+=1}}let D=O.length===1;return{success:N===0,dryRun:!1,sourceCorp:{id:Q.id,name:Q.name,environment:Q.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:w,totalCount:O.length,successCount:M,failureCount:N,originalRecord:D?O[0].originalRecord:void 0,replayedDocument:D?O[0].replayedDocument:void 0,pushResult:D?O[0].pushResult:void 0,records:O}}var GA1;var bZ=m(()=>{UP();F$();P6();GA1=new Set(["TEXT","NUMBER","DATE","AMOUNT","PERSON","ATTACHMENT","DATE_RANGE","DEPARTMENT","LIST","CITY","OBJECT"])});var IB0,w44,WA1,M44;var KB0=m(()=>{P$();IB0=L.object({level:L.enum(["error","warning" Line truncated
↳ ${V}`,operator:J}}function NB0($){if(!$)return[];let Y=$.pending||[],U=String($.rawState||"").toUpperCase(),z=String($.state||"").toUpperCase(),Q=[];if(Y.length>0)for(let J of Y){let I=J.approver?.name||J.approver?.id||"待定",K=(J.name||$.currentNode||"").trim(),G=K?`${K}(${I})`:I,W=J.type?.toUpperCase()==="PAYING"||K.includes("支付")||U==="PAYING"||z==="支付中"?"待支付":"待审批";Q.push(`${G}: ${W}`)}else if($.currentNode?.trim()){let I=$.currentNode.includes("支付")||U==="PAYING"||z==="支付中"?"待支付":"待审批";Q.push(`${$.currentNode.trim()}: ${I}`)}return Q}function Xz($,Y){let U=new Map;if(!$||$.length===0)return U;if(!Y){for(let q of $){let F=(q.result||{}).decision||q.aiDecision||"-";U.set(q.id,{recordId:q.id,sourceDocumentSN:q.sourceDocumentSN,taskMode:q.taskMode,aiDecision:MB0(typeof F==="string"?F:"-"),aiAction:"-",eHumanAction:"-",eHumanComment:"-",auditDrift:!1})}return U}let z=[...$].sort((q,V)=>(Number(q.createdAt)||0)-(Number(V.createdAt)||0)),Q=Y.history||[],J=String(Y.rawState||"").toUpperCase(),I=String(Y.state||"").toUpperCase(),K=J==="DRAFT"||J==="REVOKED"||J==="CANCELED"||J==="CANCELLED"||I==="草稿"||I==="已撤回"||I==="已取消",G=J==="REJECTED"||J==="TERMINATED"||I==="审批驳回"||I==="已驳回",H=!K&&!G&&(J==="PAID"||I==="已支付"||Q.some((q)=>!q.isEbot&&(q.rawAction==="freeflow.pay"||q.action==="支付成功"||q.action==="支付完成"))),W=!K&&!G&&!H&&(J==="PAYING"||I==="支付中"||(Y.pending||[]).some((q)=>q.isCurrent&&(q.type?.toUpperCase()==="PAYING"||q.name?.includes("支付")))||Y.currentNode?.includes("支付")===!0),Z=H||!K&&!G&&!W&&(J==="COMPLETED"||J==="APPROVED"||I==="已完成"||I==="审批通过");for(let q=0;q<z.length;q++){let V=z[q];if(!V)continue;let F=Number(V.createdAt)||0,O=V.document||{},w=V.manualApprovalRecord||V.result?.manualApprovalRecord||O.manualApprovalRecord||{},N=typeof V.sourceExtendData?.nodeId==="string"?String(V.sourceExtendData.nodeId):void 0,M=typeof w.nodeId==="string"?String(w.nodeId):void 0,D=M?decodeURIComponent(M).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??F,j=z[q+1],C=j?Number(j.createdAt)||1/0:1/0,b=q===z.length-1,k=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(k){if(b=!1,(k.time??1/0)<C)C=k.time}let S=V.result||{},i=S.decision||V.aiDecision||"-",n=typeof i==="string"?i:"-",z0=n.toUpperCase(),x=z0==="REJECT"||z0==="驳回",p=z0==="APPROVE"||z0==="通过",t=z0==="EXEMPT_APPROVE"||z0==="免审通过"||z0==="备注通过",e=V.taskMode||V.finalExecutionMode||"",d=String(e).toLowerCase().includes("auto")||V.finalExecutionMode==="automatic"||e==="automatic"||e==="fully_automatic",Y0="-";if(p||t)Y0="添加评论";else if(x)Y0=d?"驳回":"添加评论";else if(z0==="REVIEW"||z0==="转交复核")Y0="转交复核";let y=typeof w.status==="object"&&w.status!==null?String(w.status.type||w.status.label||"").toUpperCase():"",r=typeof w.status==="object"&&w.status!==null?String(w.status.sourceStatus||""):"",$0=O.manualApprovalStatus||S.manualApprovalStatus||V.manualApprovalStatus,N0=typeof $0==="string"?$0.toUpperCase():"",j0=N0==="CANCELLED"||N0==="CANCELED"||N0==="已取消"||N0==="已撤回"||N0==="REVOKED"||y==="CANCELLED"||y==="CANCELED"||r.includes("撤回")||r.includes("取消"),_0=N0==="APPROVED"||N0==="已支付/审批完成"||N0==="已通过"||N0==="已完成"||N0==="已支付"||y==="APPROVED",u0=!(r.includes("补偿")||r.includes("已支付"))&&(N0==="TERMINATED"||N0==="REJECTED"||N0==="REJECT"||N0==="已驳回"||N0==="被驳回"||y==="TERMINATED"||y==="REJECTED"||y==="已驳回"||y==="被驳回"),U1=T?1000:60000,a=Q.filter((B0)=>{let Q0=B0.time??0;return Q0>=B-U1&&Q0<C}),X0="-",F0="-",b0=!1,i0,n0,O1=p||t,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(O1&&b&&(u1||b1))b0=!0,i0="AI通过后单据发生撤回/修改重提,后续未经AI复审";if(d&&x)X0="无操作",F0="-";else{let B0=a.filter((v)=>(v.time??0)>=B-1000&&!v.isEbot&&v.rawAction!=="freeflow.submit"&&v.action!=="提交送审"&&!((v.rawAction==="freeflow.comment"||v.action==="发表评论")&&!v.comment)&&!((v.rawAction==="freeflow.print"||v.action==="打印提醒")&&!v.comment)&&!(v.rawAction==="freeflow.carbonCopy"||v.rawAction==="freeflow.cc"||v.action==="抄送通知")),Q0=B0.find((v)=>v.rawAction==="freeflow.retract"||v.action==="单据撤回"),A=B0.find((v)=>v.rawAction==="freeflow.reject"||v.action==="审批驳回");if(!b)if(A||!Y&&u0){X0="审批驳回",b0=!1,i0=void 0;let v=Gd(A,void 0,w,Q,Y);F0=v.commen Line truncated
`,{mode:384}),Y}function Dd($){let Y=bB0();for(let U of Y){if(!F$(U))continue;for(let z of rA(U).filter((Q)=>Q.endsWith(".json")).filter((Q)=>!Q.startsWith("example."))){let Q=T9(U,z);try{let J=aA(Q,"utf-8"),I=JSON.parse(J);if(I&&typeof I==="object"&&I.id===$)return Q}catch{}}}return}function j9($,Y){let U=Dd($);if(!U)throw Error(`Enterprise config not found: ${$}`);let Q={...JSON.parse(aA(U,"utf-8")),...Y};for(let I of Object.keys(Y))if(Y[I]===void 0)delete Q[I];let J=Od.parse(Q);return gB0(U,`${JSON.stringify(J,null,2)}
`,"utf-8"),J}var Nd="SEAL_USE_ENTERPRISES_DIR",yB0="SEAL_HOME_ENTERPRISES_DIR",kB0="SEAL_USE_USER_ENTERPRISES_DIR",xB0="SEAL_HOME_USER_ENTERPRISES_DIR",fB0="SEAL_USE_CONFIG_FILE",uB0="SEAL_HOME_CONFIG_FILE",YK,sA,oA,hB0;var P5=m(()=>{Md();YK=T9(tA(),".config","seal-use","enterprises"),sA=T9(tA(),".config","seal-home","enterprises"),oA=T9(tA(),".config","seal-use","config.json"),hB0=T9(tA(),".config","seal-home","config.json")});function c2($,Y,U=[]){let z=Y.corpId?.trim()||void 0,Q=Y.stateful?Y.defaultCorpId?.trim()||void 0:void 0,J=z??Q;if(J){let K=$.find((W)=>W.id===J);if(K)return K;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 I=$[0];if(I)return I;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 Bd,mkdirSync as gD1,readFileSync as yD1,renameSync as kD1,unlinkSync as xD1,writeFileSync as fD1}from"node:fs";import{homedir as uD1}from"node:os";import{dirname as bD1,join as iD1}from"node:path";function SZ(){let $=process.env[nD1]?.trim();if($)return $;return cD1}function iB0($=new Date){return $.toISOString().slice(0,10)}function nB0($=Ad,Y=new Date){let U=Y.getTime()-Math.max(0,$-1)*86400000;return new Date(U).toISOString().slice(0,10)}function cB0($=SZ()){if(!Bd($))return{};try{let Y=yD1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&!Array.isArray(U))return U;return{}}catch{return{}}}function dD1($,Y){let U={};for(let[z,Q]of Object.entries($)){if(!Q||typeof Q!=="object")continue;let J={},I=!1;for(let[K,G]of Object.entries(Q))if(typeof G==="number"&&G>0&&K>=Y)J[K]=G,I=!0;if(I)U[z]=J}return U}function pD1($,Y=SZ()){let U=bD1(Y);if(!Bd(U))gD1(U,{recursive:!0,mode:448});let z=`${Y}.${process.pid}.${Date.now()}.${Math.random().toString(16).slice(2,8)}.tmp`;try{fD1(z,JSON.stringify($,null,2),{encoding:"utf-8",mode:384}),kD1(z,Y)}catch(Q){try{if(Bd(z))xD1(z)}catch{}throw Q}}function dB0($,Y=new Date){if(!$||typeof $!=="string")return;try{let U=SZ(),z=cB0(U),Q=iB0(Y),J=nB0(Ad,Y),I=dD1(z,J);I[$]=I[$]||{},I[$][Q]=(I[$][Q]??0)+1,pD1(I,U)}catch{}}function mD1($,Y=Ad,U=new Date){let z=new Map;try{let Q=cB0(),J=nB0(Y,U),I=iB0(U),K=$??Object.keys(Q);for(let G of K){let H=Q[G];if(!H){z.set(G,0);continue}let W=0;for(let[X,Z]of Object.entries(H))if(X>=J&&X<=I&&typeof Z==="number")W+=Z;z.set(G,W)}}catch{if($)for(let Q of $)z.set(Q,0)}return z}function pB0($,Y,U){let z=U??mD1($.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 I=z.get(Q.id)??0,K=z.get(J.id)??0;if(I!==K)return K-I;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 nD1="SEAL_USE_USAGE_FILE",cD1,Ad=7;var $P=m(()=>{cD1=iD1(uD1(),".config","seal-use","usage.json")});function lD1($,Y){return $.map((U)=>U.trim()).filter(Boolean).map((U)=>Y?U:U.toLowerCase())}function oD1($,Y){return Y?$:$.toLowerCase()}function rD1($,Y,U,z){let Q=oD1($,z),J=Y.filter((I)=>Q.includes(I));if(U==="all"&&J.length!==Y.length)return[];return J}function sD1($){if(typeof $==="string")return $.split(/\r?\n/);return JSON.stringify($,null,2).split(/\r?\n/)}function aD1($,Y){if(Y.fields&&!Y.fields.has($.field))return[];let U=sD1($.value),z=[];return U.forEach((Q,J)=>{let I=rD1(Q,Y.keywords,Y.matchMode,Y.caseSensitive);if(I.length===0)return;let K=Math.max(0,J-Y.contextLines),G=Math.min(U.length,J+Y.contextLines+1),H={area:$.area,entityType:$.entityType,entityId:$.entityId,title:$.title,field:$.field,lineNumber:J+1,matchedKeywords:I,matchedText:YP(Q,Y.maxChars),context:{before:Y.snippetOnly?[]:U.slice(K,J).map((W)=>YP(W,Y.maxChars)),line:YP(Q,Y.maxChars),after:Y.snippetOnly?[]:U.slice(J+1,G).map((W)=>YP(W,Y.maxChars))},metadata:$.metadata};if(Y.snippetOnly)H.context={before:[],line:H.context.line,after:[]};z.push(H)}),z}function YP($,Y){if(!Y||$.length<=Y)return $;return`${$.slice(0,Math.max(0,Y))}...`}function tD1($){return[{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"description",value:$.description,metadata:{scope:$.scope,strictness:$.strictness,status:$.status}},{area:"rules",entityType:"rule",entityId:$.id,title:$.scope,field:"scope",value:$.scope,metadata:{strictness:$.strictness,status:$.status}}]}function lB0($){return $.rules.flatMap((Y,U)=>{let z=`${$.id}:${Y.description.slice(0,32)}`,Q={versionId:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedByName:$.publishedByName,publishedAt:$.publishedAt,scope:Y.scope,strictness:Y.strictness,code:"code"in Y?Y.code:void 0,index:U};return[{area:"rules",entityType:"rule",entityId:z,title:`${$.versionName} / ${Y.scope}`,field:"hi Line truncated
`):[]}function JB1($,Y){let U=Array.from({length:$.length+1},()=>Array(Y.length+1).fill(0));for(let I=$.length-1;I>=0;I-=1)for(let K=Y.length-1;K>=0;K-=1)U[I][K]=$[I]===Y[K]?U[I+1][K+1]+1:Math.max(U[I+1][K],U[I][K+1]);let z=[],Q=0,J=0;while(Q<$.length&&J<Y.length)if($[Q]===Y[J])z.push(` ${$[Q]}`),Q+=1,J+=1;else if(U[Q+1][J]>=U[Q][J+1])z.push(`-${$[Q++]}`);else z.push(`+${Y[J++]}`);while(Q<$.length)z.push(`-${$[Q++]}`);while(J<Y.length)z.push(`+${Y[J++]}`);return z}function IB1($,Y,U,z,Q,J){let I=aB0(z,J),K=aB0(Q,J),G=z?`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}`,`@@ -${I.length?1:0},${I.length} +${K.length?1:0},${K.length} @@`,...JB1(I,K)].join(`
`)}function tB0($){return{id:$.id,versionNumber:$.versionNumber,versionName:$.versionName,publishedAt:$.publishedAt}}function eB0($,Y){let U=new Map;for(let z of $.rules){let Q=gZ(z),J=Y==="stable-id"?YA0(Q):yZ(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 KB1($,Y,U){if(U!=="auto")return U;if([...$.rules,...Y.rules].every((J)=>Boolean(YA0(J))))return"stable-id";if([...$.rules,...Y.rules].every((J)=>Boolean(yZ(gZ(J).code??gZ(J).ruleCode))))return"code";throw Error("Rule snapshots have neither a complete stable-ID mapping nor a complete code mapping.")}function UA0($,Y,U={}){let z=KB1($,Y,U.identityMode??"auto"),Q=eB0($,z),J=eB0(Y,z),I=[...new Set([...Q.keys(),...J.keys()])],K=[],G={added:0,removed:0,modified:0,unchanged:0},H=tB0($),W=tB0(Y);for(let Z of I){let q=Q.get(Z),V=J.get(Z),F=q?Vz(q,z):void 0,O=V?Vz(V,z):void 0,w=!q?"added":!V?"removed":JSON.stringify(F)!==JSON.stringify(O)?"modified":"unchanged";if(G[w]+=1,w==="unchanged"&&!U.includeUnchanged)continue;let N=w==="modified"?[...new Set([...Object.keys(F??{}),...Object.keys(O??{})])].filter((M)=>JSON.stringify(F?.[M])!==JSON.stringify(O?.[M])):void 0;K.push({status:w,ruleId:Z,identityMode:z,...q?{before:q}:{},...V?{after:V}:{},...N?.length?{changedFields:N}:{},...w!=="unchanged"?{diff:IB1(Z,H,W,q,V,z)}:{}})}let X={from:H,to:W,identityMode:z,counts:G,changes:K,unifiedDiff:K.filter((Z)=>Z.diff).map((Z)=>Z.diff).join(`
`)};if(z==="code"){let Z=I.filter((P)=>Q.has(P)&&J.has(P)).length,q=I.filter((P)=>Q.has(P)&&J.has(P)&&JSON.stringify(Vz(Q.get(P),"code"))===JSON.stringify(Vz(J.get(P),"code"))).length,V=Q.size,F=J.size,O=Math.min(V,F)?Z/Math.min(V,F):1,w=new Map;for(let[P,T]of Q)w.set(JSON.stringify(Vz(T,"code")),P);let N=0;for(let[P,T]of J){let B=w.get(JSON.stringify(Vz(T,"code")));if(B&&B!==P)N+=1}let D=(Math.min(V,F)?q/Math.min(V,F):1)>=0.5?"high":q>0||N>0?"ambiguous":"low";X.codeStats={oldCount:V,newCount:F,sameCodeCount:Z,sameCodeUnchanged:q,sameBodyDifferentCode:N,overlapRatio:O,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 z=$.unifiedDiff.length-Y,Q=`
... [diff truncated: ${z} characters omitted; rerun with --full for the complete diff]`,J=$.changes.map(({before:I,after:K,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:z,hint:"Use --full for the complete diff."}}}var $A0,QB1;var zA0=m(()=>{$A0=["id","ruleId","stableId"],QB1=new Set([...$A0,"runtimeRuleId","runtimeId","tenantId","createdAt","updatedAt","versionId","versionNumber"])});import{existsSync as GB1,mkdirSync as HB1,readFileSync as WB1,renameSync as XB1,writeFileSync as ZB1}from"node:fs";import{homedir as qB1}from"node:os";import{join as QA0}from"node:path";function kZ($){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 UP($){return JSON.stringify([$.description??"",$.scope??"",$.strictness??""])}function JA0(){return process.env.SEAL_USE_RULE_VERSION_SNAPSHOTS_DIR?.trim()||QA0(qB1(),".config","seal-use","rule-version-snapshots")}function VB1($){return $.replace(/[^a-zA-Z0-9._-]/g,"_")}function IA0($,Y){return QA0(JA0(),`${VB1($)}-v${Y}.json`)}function xZ($,Y,U){let z=new Map,Q=new Map;for(let W of U){let X=kZ(W.code);if(X)z.set(X,[...z.get(X)??[],W]);let Z=UP(W);Q.set(Z,[...Q.get(Z)??[],W])}let J=[];for(let W of Y.rules??[]){let X=kZ(W.code),Z=X?z.get(X)??[]:[],q=Q.get(UP(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 I={corpId:$,versionId:Y.id,versionNumber:Y.versionNumber,capturedAt:new Date().toISOString(),rules:J},K=JA0();HB1(K,{recursive:!0,mode:448});let G=IA0($,Y.versionNumber),H=`${G}.${process.pid}.tmp`;return ZB1(H,`${JSON.stringify(I,null,2)}
`,{encoding:"utf8",mode:384}),XB1(H,G),G}function LB1($,Y){let U=IA0($,Y.versionNumber);if(!GB1(U))return null;try{return JSON.parse(WB1(U,"utf8"))}catch{return null}}function jd($,Y){let U=LB1($,Y);if(!U?.rules.length)return Y;let z=new Map(U.rules.flatMap((J)=>{let I=kZ(J.code);return I?[[I,J]]:[]})),Q=new Map(U.rules.map((J)=>[UP(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 I=(kZ(J.code)?z.get(kZ(J.code)):void 0)??Q.get(UP(J));return I?{...J,stableId:I.stableId}:J})}}var Ed=()=>{};import{createHmac as FB1,randomBytes as wB1}from"node:crypto";function OB1($,Y,U,z){return FB1("sha256",z).update(`${$}.${Y}.${JSON.stringify(U)}`).digest("hex")}function fZ($,Y){let U=Math.floor(Date.now()/1000),z=wB1(16).toString("hex");return{Authorization:`Bearer ${Y}`,"x-webhook-signature":OB1(U,z,$,Y),"x-webhook-timestamp":String(U),"x-webhook-nonce":z}}var zP=()=>{};function S4($,Y){return new X4($,2,Y)}function w$($,Y){return new X4($,10,Y)}function uZ($){if($ instanceof X4)return{exitCode:$.exitCode,nextAction:$.nextAction};let Y=$ instanceof Error?$.message:String($),U=MB1($);if(U===401||U===403||/(?:^|\s)(?:token|bearer|session) (?:expired|missing|invalid)/i.test(Y))return{exitCode:11};if(/^(?:Usage:|Unknown (?:[a-z0-9_-]+ )?command|Invalid (?:number|boolean|command)|--json must|Missing required JSON field)/i.test(Y))return{exitCode:2};if(/^Refusing to (?:clear|delete)|without --yes|without confirm=true/i.test(Y))return{exitCode:10};return{exitCode:1}}function MB1($){if(!$||typeof $!=="object")return;let Y=$.response;if(!Y||typeof Y!=="object")return;let U=Y.status;return typeof U==="number"?U:void 0}var X4,QP;var O8=m(()=>{X4=class X4 extends Error{exitCode;nextAction;constructor($,Y,U){super($);this.name="CliError",this.exitCode=Y,this.nextAction=U}};QP=class QP extends X4{constructor($,Y){super($,12,Y);this.name="PayloadTooLargeError"}}});function KA0($,Y){let U=$&&typeof $==="object"?$:{},z=typeof U.type==="string"?U.type.toUpperCase().trim():"",Q=typeof U.key==="string"&&U.key.trim()?U.key.trim():typeof U.label==="string"&&U.label.trim()?U.label.trim():`field_${Y}`,J=typeof U.label==="string"&&U.label.trim()?U.label.trim():Q,I=U.value!==void 0?U.value:null;if(z==="LIST"&&Array.isArray(I))I=I.map((G)=>{if(Array.isArray(G))return G.map((H,W)=>KA0(H,W));return G});let K=z;if(!NB1.has(K))if(Array.isArray(I))K="LIST";else if(I&&typeof I==="object")K="OBJECT";else if(typeof I==="number")K="NUMBER";else K="TEXT";return{key:Q,label:J,type:K,value:I}}function Cd($,Y={}){let U=$.document,z=$.sourceDocumentSN??(typeof U?.sn==="string"?U.sn:void 0)??(typeof U?.sourceDocumentSN==="string"?U.sourceDocumentSN:void 0)??$.id,Q=$.sourceDocumentId??(typeof U?.id==="string"?U.id:void 0)??(typeof U?.sourceDocumentId==="string"?U.sourceDocumentId:void 0)??$.documentId??$.id,J=Y.snPrefix??"",I=Y.snSuffix??"",K=Y.docIdPrefix??J,G=Y.docIdSuffix??I,H=`${J}${z}${I}`,W=`${K}${Q}${G}`,X=typeof U?.sourceStartTime==="number"?U.sourceStartTime:typeof $.createdAt==="number"?Math.floor($.createdAt/1000):null,q=(Array.isArray(U?.fields)?U.fields:[]).map((V,F)=>KA0(V,F));return{type:"document",documentId:W,documentSN:H,startTime:X,fields:q}}function DB1($){let Y=new URL($),U=Y.pathname.match(/\/webhook\/([^/]+)/);if(!U)throw Error(`Webhook URL 必须包含 /webhook/{webhookId}/document,收到: ${$}`);let z=U[1],Q=`${Y.protocol}//${Y.host}`,J=`${Q}/api/v1/integrations/webhook/${encodeURIComponent(z)}/document`;return{baseUrl:Q,webhookId:z,documentEndpoint:J}}async function Rd($,Y,U,z=fetch,Q={}){let{webhookId:J,documentEndpoint:I}=DB1($),K={...Q,"Content-Type":"application/json",...fZ({webhookId:J,...U},Y)},G=await z(I,{method:"POST",headers:K,body:JSON.stringify(U)});if(!G.ok){let H=await G.text();throw Error(`Webhook 单据推送失败 (${G.status}): ${H}`)}return G.json()}function GA0($,Y,U){if(Y){let z=Y.trim().toLowerCase(),Q=$.find((J)=>J.id.toLowerCase()===z||J.name.toLowerCase()===z||J.incomingDocumentWebhook.id.toLowerCase()===z);if(!Q){let J=$.map((I)=>`"${I.name}" (${I.id})`).join(", ");throw Error(`未找到匹配 "${Y}" 的 Webhook 集成通道。可用通道: [${J}]`)}return Q}if($.length===1)return $[0];if($.length>1){let z=$.find((J)=>J.name.includes("回放")||J.name.toLowerCase().includes("replay"));if(z)return z;let Q=$.map((J)=>`"${J.name}" (${J.id})`).join(", ");throw Error(`当前租户存在多个 Webhook 通道 [${Q}],请通过 --webhook <idOrName> 指定目标通道。`)}throw new X4("当前租户未配置任何 Webhook 集成通道。",1,`seal-use webhook add --name <name> --result-url <url>${U?` --corp ${U}`:""}`)}function JP($,Y){let U,z,{sourceCorpId:Q,targetCorpId:J,activeCorp:I,force:K}=$;if(Q&&J)U=Y(Q),z=Y(J);else if(Q&&!J)if(U=Y(Q),U.testCorpId)z=Y(U.testCorpId);else if(I.id!==U.id&&I.environment==="test")z=I;else z=I;else if(!Q&&J)if(z=Y(J),z.prodCorpId)U=Y(z.prodCorpId);else if(I.id!==z.id)U=I;else U=I;else if(I.environment==="test")if(z=I,I Line truncated
`+"为防止测试单据污染生产审批流,禁止向生产环境重放单据。请指定测试企业 (--target-corp <testCorpId>),或在确有需要时添加 --force。",1,`seal-use webhook replay --target-corp <testCorpId>${U.id!==z.id?` --source-corp ${U.id}`:""}`);return{sourceCorp:U,targetCorp:z}}async function _d($,Y,U){let z=Y.seal?.endpoints?.approvalStylePreferences??"api/v1/agent/ai-approval/config",Q=await K$($,z);if(U||Q.length>0)return GA0(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 CO($,J,{name:"(Seal测-回放通道)",mode:"assisted",outgoingResultWebhook:`${J}/api/v1/integrations/webhook/replay-mock-callback`},Y.seal.endpoints.approvalStylePreferences)}throw new X4(`当前租户「${Y.name}」未配置任何 Webhook 集成通道。`,1,`seal-use webhook add --name <name> --result-url <url> --corp ${Y.id}`)}async function UK($){let{query:Y,sourceClient:U,targetClient:z,sourceCorp:Q,targetCorp:J,webhookSelector:I,snPrefix:K,snSuffix:G,docIdPrefix:H,docIdSuffix:W,dryRun:X,fetchFn:Z=fetch}=$,q=[];if(Y.recordId){let P=await W4(U,Y.recordId);q.push(P)}else if(Y.recordIds&&Y.recordIds.length>0)for(let P of Y.recordIds)q.push(await W4(U,P));else if(Y.sn){let T=(await n4(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 n4(U,{search:P,sourceDocumentSN:P,limit:20})).records.find((j)=>j.sourceDocumentSN===P||j.sourceDocumentId===P||j.document?.sourceDocumentSN===P||j.document?.sn===P);if(!B)throw Error(`在企业「${Q.name}」中未找到单据编号为「${P}」的审批记录。`);q.push(B)}else if(Y.limit!==void 0){let P=await n4(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:Cd(P,{snPrefix:K,snSuffix:G,docIdPrefix:H,docIdSuffix:W})}));if(X){let P={id:"preview-webhook",name:I??"预览目标通道",mode:"assisted",incomingDocumentWebhookUrl:`${J.seal.url}/api/v1/integrations/webhook/preview`};try{let j=await K$(z,J.seal.endpoints.approvalStylePreferences);if(j.length>0){let C=GA0(j,I,J.id);P={id:C.id,name:C.name,mode:C.mode,incomingDocumentWebhookUrl:C.incomingDocumentWebhook.url}}}catch{}let T=V.map(({run:j,doc:C})=>({originalRecord:{id:j.id,sourceSystem:j.sourceSystem,sourceDocumentSN:j.sourceDocumentSN,sourceDocumentId:j.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 F=await _d(z,J,I),O={id:F.id,name:F.name,mode:F.mode,incomingDocumentWebhookUrl:F.incomingDocumentWebhook.url},w=[],N=0,M=0;for(let{run:P,doc:T}of V){console.error(`[webhook-replay] 正在向 Webhook 通道「${F.name}」推送单据: ${T.documentSN}...`);try{let B=await Rd(F.incomingDocumentWebhook.url,F.secret,T,Z,B6(J.seal));w.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 j=B instanceof Error?B.message:String(B);w.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:j,success:!1}),M+=1}}let D=w.length===1;return{success:M===0,dryRun:!1,sourceCorp:{id:Q.id,name:Q.name,environment:Q.environment},targetCorp:{id:J.id,name:J.name,environment:J.environment},targetWebhook:O,totalCount:w.length,successCount:N,failureCount:M,originalRecord:D?w[0].originalRecord:void 0,replayedDocument:D?w[0].replayedDocument:void 0,pushResult:D?w[0].pushResult:void 0,records:w}}var NB1;var bZ=m(()=>{zP();O8();P6();NB1=new Set(["TEXT","NUMBER","DATE","AMOUNT","PERSON","ATTACHMENT","DATE_RANGE","DEPARTMENT","LIST","CITY","OBJECT"])});var HA0,C44,BB1,R44;var WA0=m(()=>{T$();HA0=L.object({level:L.enum(["error","warning" Line truncated
* ==============================================================================
* Seal 官方标准规则校验器 (Official Standard Rule Linter)
* ==============================================================================
@@ -881,69 +881,69 @@ export function lintRule(rule: RuleLintTarget): RuleLintResult {
}
export default lintRule;
`}});import{existsSync as Lz,mkdirSync as PA1,readFileSync as TA1,readdirSync as ZB0,rmSync as jA1,unlinkSync as EA1,writeFileSync as CA1}from"node:fs";import{homedir as RA1}from"node:os";import{isAbsolute as _A1,join as b6,resolve as vA1}from"node:path";import{pathToFileURL as WB0}from"node:url";function qB0($=n$){let Y=[],U=[];try{if(!Lz($))PA1($,{recursive:!0});let z=Object.keys(vp);for(let[J,I]of Object.entries(vp)){let K=b6($,J),G=!0;if(Lz(K))try{if(TA1(K,"utf8")===I)G=!1}catch{G=!0}if(G)CA1(K,I,"utf8");Y.push(J)}let Q=ZB0($,{withFileTypes:!0});for(let J of Q)if(!z.includes(J.name)){let I=b6($,J.name);try{if(J.isDirectory())jA1(I,{recursive:!0,force:!0});else EA1(I);U.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:U}}function VB0($={syncOfficial:!0}){if($.syncOfficial!==!1)qB0();let Y=[{name:"builtin",type:"builtin",path:b6(n$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:b6(n$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:b6(n$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],U=[i$,JP];for(let z of U)if(Lz(z))try{let Q=ZB0(z,{withFileTypes:!0});for(let J of Q){if(J.isDirectory())continue;let I=J.name;if(I.endsWith(".ts")||I.endsWith(".js")||I.endsWith(".mjs")){let K=I.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===K))Y.push({name:K,type:"custom",path:b6(z,I),description:`用户自定义规则校验器 (${I})`})}}}catch{}return Y}function SA1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:b6(n$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:b6(n$,"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:b6(n$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(_A1(Y)||Y.startsWith("./")||Y.startsWith("../")){let z=vA1(Y);if(Lz(z))return{path:z};for(let Q of[".ts",".js",".mjs"])if(Lz(`${z}${Q}`))return{path:`${z}${Q}`}}let U=[b6(i$,`${Y}.ts`),b6(i$,`${Y}.js`),b6(i$,`${Y}.mjs`),b6(JP,`${Y}.ts`),b6(JP,`${Y}.js`),b6(JP,`${Y}.mjs`)];for(let z of U)if(Lz(z))return{path:z};return{}}async function Sp($){qB0();let Y=SA1($??"builtin");if(Y.isOfficial){let z=Y.officialKind==="strict"?GB0:Y.officialKind==="hlab"?HB0:zK,Q=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&Lz(J))try{let K=await import(WB0(J).href),G=K.default??K.lintRule??K.linter??K.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:XB0(G,z)}}catch{}return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:z}}let U=Y.path;if(!U)return console.error(`⚠️ [linter] 未找到自定义校验器 "${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:zK};try{let Q=await import(WB0(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:zK};return{name:$??"custom",type:"custom",filePath:U,linter:XB0(J,zK)}}catch(z){return console.error(`⚠️ [linter] 加载自定义校验器脚本 "${U}" 失败(语法错误或依赖缺失: ${z?.message??z}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:zK}}}function XB0($,Y){return async(U,z)=>{try{let Q=await $(U,z);if(Q&&typeof Q==="object"&&typeof Q.score==="number"&&Array.isArray(Q.issues))return Q;return console.error("⚠️ [linter] 自定义校验器返回值格式不符合 RuleLintResult 契约,已回退至内置结果。"),Y(U,z)}catch(Q){return console.error("⚠️ [linter] 自定义校验器执行异常:",Q),Y(U,z)}}}var i$,hA1="official",n$,JP;var gp=m(()=>{Cp();_p();hp();Rp();i$=b6(RA1(),".config","seal-use","linters"),n$=b6(i$,hA1),JP=b6(process.cwd(),"linters")});async function yp($,Y,U){let z=await Y.linter($,U);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:z.score,passed:z.passed,issues:z.issues,description:$.description}}async function LB0($,Y,U,z){let Q=z?.minScore??0,J=z?.level??"all",I=[],K=0;for(let q of $){let V=await yp(q,Y,U);K+=V.score;let F=V.issues;if(J==="error")F=V.issues.filter((O)=>O.level==="error");else if(J==="warning")F=V.issues.filter((O)=>O.level==="warning"||O.level==="error");let w=F.every((O)=>O.level!=="error");if(z?.summary){if(F.length>0)I.push({...V,passed:w,issues:F})}else I.push({...V,passed:w,issues:F})}let G=$.length,H=G===0?100:Math.round(K/G),W=I.filter((q)=>q.issues.length>0).length,X=G-Line truncated
`,"utf8"),U}function MB0($){return $.map((Y,U)=>{let z;if(typeof Y.code==="number")z=`#${String(Y.code).padStart(4,"0")}`;else if(typeof Y.code==="string")z=Y.code.startsWith("#")?Y.code:`#${Y.code}`;else z=`#${String(U+1).padStart(4,"0")}`;return{id:Y.id,code:z,name:Y.name,description:Y.description,scope:Y.scope,strictness:Y.strictness}})}var NB0=()=>{};var DB0,B5;var QK=m(()=>{DB0=class DB0 extends Error{errors;warnings;constructor($,Y=[]){super([`webhook 资源包校验失败:${$.length} 个错误`,...$.map((U)=>`- ${U}`)].join(`
`));this.errors=$;this.warnings=Y;this.name="ResourcePackValidationError"}};B5=DB0});var TB0=E((l44,PB0)=>{PB0.exports=IP;function IP(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}IP.prototype.go=function($){if(this.pending<this.max)BB0(this,$);else this.waiting.push($)};IP.prototype.wait=function($){if(this.pending===0)$(this.error);else this.listeners.push($)};IP.prototype.hold=function(){return AB0(this)};function AB0($){$.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)BB0($,$.waiting.shift());else if($.pending===0){var J=$.listeners;$.listeners=[],J.forEach(z)}}function z(Q){Q($.error)}}function BB0($,Y){Y(AB0($))}});var CB0=E((nA1)=>{var fp=I0("fs"),up=I0("util"),jB0=I0("stream"),EB0=jB0.Readable,bA1=jB0.PassThrough,iA1=TB0(),KP=I0("events").EventEmitter;nA1.BufferSlicer=IK;nA1.FdSlicer=JK;up.inherits(JK,KP);function JK($){KP.call(this),this.fd=$,this.pend=new iA1,this.pend.max=1,this.refCount=0}JK.prototype.read=function($,Y,U,z,Q){var J=this;J.pend.go(function(I){fp.read(J.fd,$,Y,U,z,function(K,G,H){I(),Q(K,G,H)})})};JK.prototype.createReadStream=function($){return new iZ(this,$)};JK.prototype.ref=function(){this.refCount+=1};JK.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")}};up.inherits(iZ,EB0);function iZ($,Y){Y=Y||{},EB0.call(this,Y),this.context=$,this.context.ref(),this.start=Y.start||0,this.endOffset=Y.end,this.pos=this.start}iZ.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(z){var Q=Buffer.allocUnsafe(U);fp.read(Y.context.fd,Q,0,U,Y.pos,function(J,I){if(J)Y.destroy(J);else if(I===0)Y.push(null),Y._cleanup();else Y.pos+=I,Y.push(Q.slice(0,I));z()})})};iZ.prototype._destroy=function($,Y){this._cleanup(),Y($)};iZ.prototype._cleanup=function(){if(this.context!=null)this.context.unref(),this.context=null};up.inherits(IK,KP);function IK($){KP.call(this),this.refCount=0,this.buffer=$}IK.prototype.read=function($,Y,U,z,Q){if(!(0<=Y&&Y<=$.length))throw RangeError("offset outside buffer: 0 <= "+Y+" <= "+$.length);if(z<0)throw RangeError("position is negative: "+z);if(Y+U>$.length)U=$.length-Y;if(z+U>this.buffer.length)U=this.buffer.length-z;if(U<=0){setImmediate(function(){Q(null,0)});return}this.buffer.copy($,Y,z,z+U),setImmediate(function(){Q(null,U)})};IK.prototype.createReadStream=function($){$=$||{};var Y=new bA1($);Y.start=$.start||0,Y.endOffset=$.end,Y.pos=Y.endOffset||this.buffer.length;var U=this.buffer.slice(Y.start,Y.pos),z=65536,Q=0;while(!0){var J=Q+z;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};IK.prototype.ref=function(){this.refCount+=1};IK.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")}});var _B0=E((r44,RB0)=>{var dA1=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{existsSync as Lz,mkdirSync as kB1,readFileSync as xB1,readdirSync as LA0,rmSync as fB1,unlinkSync as uB1,writeFileSync as bB1}from"node:fs";import{homedir as iB1}from"node:os";import{isAbsolute as nB1,join as b6,resolve as cB1}from"node:path";import{pathToFileURL as qA0}from"node:url";function FA0($=c$){let Y=[],U=[];try{if(!Lz($))kB1($,{recursive:!0});let z=Object.keys(gd);for(let[J,I]of Object.entries(gd)){let K=b6($,J),G=!0;if(Lz(K))try{if(xB1(K,"utf8")===I)G=!1}catch{G=!0}if(G)bB1(K,I,"utf8");Y.push(J)}let Q=LA0($,{withFileTypes:!0});for(let J of Q)if(!z.includes(J.name)){let I=b6($,J.name);try{if(J.isDirectory())fB1(I,{recursive:!0,force:!0});else uB1(I);U.push(J.name)}catch{}}}catch{}return{synced:Y,pruned:U}}function wA0($={syncOfficial:!0}){if($.syncOfficial!==!1)FA0();let Y=[{name:"builtin",type:"builtin",path:b6(c$,"builtin.ts"),description:"Seal 官方标准校验器 (拦截过短描述、主观模糊词与悬空例外条款)"},{name:"strict",type:"official",path:b6(c$,"strict.ts"),description:"Seal 官方严格风控校验器 (强校验字数、刚性定量约束、凭证依据与具体审批人角色)"},{name:"hlab",type:"official",path:b6(c$,"hlab.ts"),description:"合思实验室 (HLab) 结构化规则校验器 (SOP 四段论结构、三元闭环判定、剥离处置动作与防漏判)"}],U=[n$,IP];for(let z of U)if(Lz(z))try{let Q=LA0(z,{withFileTypes:!0});for(let J of Q){if(J.isDirectory())continue;let I=J.name;if(I.endsWith(".ts")||I.endsWith(".js")||I.endsWith(".mjs")){let K=I.replace(/\.(ts|js|mjs)$/,"");if(!Y.some((G)=>G.name===K))Y.push({name:K,type:"custom",path:b6(z,I),description:`用户自定义规则校验器 (${I})`})}}}catch{}return Y}function pB1($){let Y=($||"").trim();if(!Y||Y==="builtin"||Y==="default"||Y==="official/builtin"||Y==="official/builtin.ts")return{path:b6(c$,"builtin.ts"),isOfficial:!0,officialKind:"builtin"};if(Y==="strict"||Y==="official/strict"||Y==="official/strict.ts")return{path:b6(c$,"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:b6(c$,"hlab.ts"),isOfficial:!0,officialKind:"hlab"};if(nB1(Y)||Y.startsWith("./")||Y.startsWith("../")){let z=cB1(Y);if(Lz(z))return{path:z};for(let Q of[".ts",".js",".mjs"])if(Lz(`${z}${Q}`))return{path:`${z}${Q}`}}let U=[b6(n$,`${Y}.ts`),b6(n$,`${Y}.js`),b6(n$,`${Y}.mjs`),b6(IP,`${Y}.ts`),b6(IP,`${Y}.js`),b6(IP,`${Y}.mjs`)];for(let z of U)if(Lz(z))return{path:z};return{}}async function kd($){FA0();let Y=pB1($??"builtin");if(Y.isOfficial){let z=Y.officialKind==="strict"?XA0:Y.officialKind==="hlab"?ZA0:zK,Q=Y.officialKind==="builtin"?"builtin":"official",J=Y.path;if(J&&Lz(J))try{let K=await import(qA0(J).href),G=K.default??K.lintRule??K.linter??K.lint;if(typeof G==="function")return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:VA0(G,z)}}catch{}return{name:Y.officialKind??"builtin",type:Q,filePath:J,linter:z}}let U=Y.path;if(!U)return console.error(`⚠️ [linter] 未找到自定义校验器 "${$}",已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:zK};try{let Q=await import(qA0(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:zK};return{name:$??"custom",type:"custom",filePath:U,linter:VA0(J,zK)}}catch(z){return console.error(`⚠️ [linter] 加载自定义校验器脚本 "${U}" 失败(语法错误或依赖缺失: ${z?.message??z}),已自动安全降级至内置标准校验器。`),{name:"builtin",type:"builtin",linter:zK}}}function VA0($,Y){return async(U,z)=>{try{let Q=await $(U,z);if(Q&&typeof Q==="object"&&typeof Q.score==="number"&&Array.isArray(Q.issues))return Q;return console.error("⚠️ [linter] 自定义校验器返回值格式不符合 RuleLintResult 契约,已回退至内置结果。"),Y(U,z)}catch(Q){return console.error("⚠️ [linter] 自定义校验器执行异常:",Q),Y(U,z)}}}var n$,dB1="official",c$,IP;var xd=m(()=>{vd();Sd();yd();hd();n$=b6(iB1(),".config","seal-use","linters"),c$=b6(n$,dB1),IP=b6(process.cwd(),"linters")});async function fd($,Y,U){let z=await Y.linter($,U);return{ruleId:$.id,ruleCode:$.code,ruleName:$.name,score:z.score,passed:z.passed,issues:z.issues,description:$.description}}async function OA0($,Y,U,z){let Q=z?.minScore??0,J=z?.level??"all",I=[],K=0;for(let q of $){let V=await fd(q,Y,U);K+=V.score;let F=V.issues;if(J==="error")F=V.issues.filter((w)=>w.level==="error");else if(J==="warning")F=V.issues.filter((w)=>w.level==="warning"||w.level==="error");let O=F.every((w)=>w.level!=="error");if(z?.summary){if(F.length>0)I.push({...V,passed:O,issues:F})}else I.push({...V,passed:O,issues:F})}let G=$.length,H=G===0?100:Math.round(K/G),W=I.filter((q)=>q.issues.length>0).length,X=G-Line truncated
`,"utf8"),U}function BA0($){return $.map((Y,U)=>{let z;if(typeof Y.code==="number")z=`#${String(Y.code).padStart(4,"0")}`;else if(typeof Y.code==="string")z=Y.code.startsWith("#")?Y.code:`#${Y.code}`;else z=`#${String(U+1).padStart(4,"0")}`;return{id:Y.id,code:z,name:Y.name,description:Y.description,scope:Y.scope,strictness:Y.strictness}})}var AA0=()=>{};var PA0,T5;var QK=m(()=>{PA0=class PA0 extends Error{errors;warnings;constructor($,Y=[]){super([`webhook 资源包校验失败:${$.length} 个错误`,...$.map((U)=>`- ${U}`)].join(`
`));this.errors=$;this.warnings=Y;this.name="ResourcePackValidationError"}};T5=PA0});var CA0=E((z64,EA0)=>{EA0.exports=KP;function KP(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}KP.prototype.go=function($){if(this.pending<this.max)jA0(this,$);else this.waiting.push($)};KP.prototype.wait=function($){if(this.pending===0)$(this.error);else this.listeners.push($)};KP.prototype.hold=function(){return TA0(this)};function TA0($){$.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)jA0($,$.waiting.shift());else if($.pending===0){var J=$.listeners;$.listeners=[],J.forEach(z)}}function z(Q){Q($.error)}}function jA0($,Y){Y(TA0($))}});var vA0=E(($A1)=>{var id=I0("fs"),nd=I0("util"),RA0=I0("stream"),_A0=RA0.Readable,tB1=RA0.PassThrough,eB1=CA0(),GP=I0("events").EventEmitter;$A1.BufferSlicer=IK;$A1.FdSlicer=JK;nd.inherits(JK,GP);function JK($){GP.call(this),this.fd=$,this.pend=new eB1,this.pend.max=1,this.refCount=0}JK.prototype.read=function($,Y,U,z,Q){var J=this;J.pend.go(function(I){id.read(J.fd,$,Y,U,z,function(K,G,H){I(),Q(K,G,H)})})};JK.prototype.createReadStream=function($){return new iZ(this,$)};JK.prototype.ref=function(){this.refCount+=1};JK.prototype.unref=function(){var $=this;if($.refCount-=1,$.refCount<0)throw Error("invalid unref");if($.refCount>0)return;id.close($.fd,Y);function Y(U){if(U)$.emit("error",U);else $.emit("close")}};nd.inherits(iZ,_A0);function iZ($,Y){Y=Y||{},_A0.call(this,Y),this.context=$,this.context.ref(),this.start=Y.start||0,this.endOffset=Y.end,this.pos=this.start}iZ.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(z){var Q=Buffer.allocUnsafe(U);id.read(Y.context.fd,Q,0,U,Y.pos,function(J,I){if(J)Y.destroy(J);else if(I===0)Y.push(null),Y._cleanup();else Y.pos+=I,Y.push(Q.slice(0,I));z()})})};iZ.prototype._destroy=function($,Y){this._cleanup(),Y($)};iZ.prototype._cleanup=function(){if(this.context!=null)this.context.unref(),this.context=null};nd.inherits(IK,GP);function IK($){GP.call(this),this.refCount=0,this.buffer=$}IK.prototype.read=function($,Y,U,z,Q){if(!(0<=Y&&Y<=$.length))throw RangeError("offset outside buffer: 0 <= "+Y+" <= "+$.length);if(z<0)throw RangeError("position is negative: "+z);if(Y+U>$.length)U=$.length-Y;if(z+U>this.buffer.length)U=this.buffer.length-z;if(U<=0){setImmediate(function(){Q(null,0)});return}this.buffer.copy($,Y,z,z+U),setImmediate(function(){Q(null,U)})};IK.prototype.createReadStream=function($){$=$||{};var Y=new tB1($);Y.start=$.start||0,Y.endOffset=$.end,Y.pos=Y.endOffset||this.buffer.length;var U=this.buffer.slice(Y.start,Y.pos),z=65536,Q=0;while(!0){var J=Q+z;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};IK.prototype.ref=function(){this.refCount+=1};IK.prototype.unref=function(){if(this.refCount-=1,this.refCount<0)throw Error("invalid unref")}});var SA0=E((J64,hA0)=>{var zA1=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 GP0=E((cB1)=>{var Dd=f3().Buffer;cB1._dbcs=b3;var z8=-1,KP0=-2,d$=-10,g8=-1000,qK=Array(256),pZ=-1;for(cZ=0;cZ<256;cZ++)qK[cZ]=z8;var cZ;function b3($,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]=qK.slice(0),this.decodeTableSeq=[];for(var z=0;z<U.length;z++)this._addDecodeChunk(U[z]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var Q=this.decodeTables.length;this.decodeTables.push(qK.slice(0));var J=this.decodeTables.length;this.decodeTables.push(qK.slice(0));var I=this.decodeTables[0];for(var z=129;z<=254;z++){var K=this.decodeTables[g8-I[z]];for(var G=48;G<=57;G++){if(K[G]===z8)K[G]=g8-Q;else if(K[G]>g8)throw Error("gb18030 decode tables conflict at byte 2");var H=this.decodeTables[g8-K[G]];for(var W=129;W<=254;W++){if(H[W]===z8)H[W]=g8-J;else if(H[W]===g8-J)continue;else if(H[W]>g8)throw Error("gb18030 decode tables conflict at byte 3");var X=this.decodeTables[g8-H[W]];for(var Z=48;Z<=57;Z++)if(X[Z]===z8)X[Z]=KP0}}}}this.defaultCharUnicode=Y.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var q={};if($.encodeSkipVals)for(var z=0;z<$.encodeSkipVals.length;z++){var V=$.encodeSkipVals[z];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 F in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,F))this._setEncodeChar(F.charCodeAt(0),$.encodeAdd[F])}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}b3.prototype.encoder=NP;b3.prototype.decoder=Ad;b3.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 z=Y.length-1;z>0;z--){var Q=U[Y[z]];if(Q==z8)U[Y[z]]=g8-this.decodeTables.length,this.decodeTables.push(U=qK.slice(0));else if(Q<=g8)U=this.decodeTables[g8-Q];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};b3.prototype._addDecodeChunk=function($){var Y=parseInt($[0],16),U=this._getDecodeTrieNode(Y);Y=Y&255;for(var z=1;z<$.length;z++){var Q=$[z];if(typeof Q==="string")for(var J=0;J<Q.length;){var I=Q.charCodeAt(J++);if(I>=55296&&I<56320){var K=Q.charCodeAt(J++);if(K>=56320&&K<57344)U[Y++]=65536+(I-55296)*1024+(K-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(I>4080&&I<=4095){var G=4095-I+2,H=[];for(var W=0;W<G;W++)H.push(Q.charCodeAt(J++));U[Y++]=d$-this.decodeTableSeq.length,this.decodeTableSeq.push(H)}else U[Y++]=I}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=$}}OT0.exports={AggregateError:FT0,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 dd=E((e64,wT0)=>{wT0.exports={format($,...Y){return $.replace(/%([sdifj])/g,function(...[U,z]){let Q=Y.shift();if(z==="f")return Q.toFixed(6);else if(z==="j")return JSON.stringify(Q);else if(z==="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 M8=E(($84,AT0)=>{var{format:kT1,inspect:jP}=dd(),{AggregateError:xT1}=x4(),fT1=globalThis.AggregateError||xT1,uT1=Symbol("kIsNodeError"),bT1=["string","function","number","object","Function","Object","boolean","bigint","symbol"],iT1=/^([A-Z][a-z0-9]*)+$/,EP={};function wz($,Y){if(!$)throw new EP.ERR_INTERNAL_ASSERTION(Y)}function MT0($){let Y="",U=$.length,z=$[0]==="-"?1:0;for(;U>=z+4;U-=3)Y=`_${$.slice(U-3,U)}${Y}`;return`${$.slice(0,U)}${Y}`}function nT1($,Y,U){if(typeof Y==="function")return wz(Y.length<=U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${Y.length}).`),Y(...U);let z=(Y.match(/%[dfijoOs]/g)||[]).length;if(wz(z===U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${z}).`),U.length===0)return Y;return kT1(Y,...U)}function Q8($,Y,U){if(!U)U=Error;class z extends U{constructor(...Q){super(nT1($,Y,Q))}toString(){return`${this.name} [${$}]: ${this.message}`}}Object.defineProperties(z.prototype,{name:{value:U.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${$}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),z.prototype.code=$,z.prototype[uT1]=!0,EP[$]=z}function NT0($){let Y="__node_internal_"+$.name;return Object.defineProperty($,"name",{value:Y}),$}function cT1($,Y){if($&&Y&&$!==Y){if(Array.isArray(Y.errors))return Y.errors.push($),Y;let U=new fT1([Y,$],Y.message);return U.code=Y.code,U}return $||Y}class DT0 extends Error{constructor($="The operation was aborted",Y=void 0){if(Y!==void 0&&typeof Y!=="object")throw new EP.ERR_INVALID_ARG_TYPE("options","Object",Y);super($,Y);this.code="ABORT_ERR",this.name="AbortError"}}Q8("ERR_ASSERTION","%s",Error);Q8("ERR_INVALID_ARG_TYPE",($,Y,U)=>{if(wz(typeof $==="string","'name' must be a string"),!Array.isArray(Y))Y=[Y];let z="The ";if($.endsWith(" argument"))z+=`${$} `;else z+=`"${$}" ${$.includes(".")?"property":"argument"} `;z+="must be ";let Q=[],J=[],I=[];for(let G of Y)if(wz(typeof G==="string","All expected entries have to be of type string"),bT1.includes(G))Q.push(G.toLowerCase());else if(iT1.test(G))J.push(G);else wz(G!=="object",'The value "object" should be written as "Object"'),I.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:z+=`of type ${Q[Line truncated
`);if(Y.linkname)U+=Dl(" linkpath="+Y.linkname+`
`);let z=Y.pax;if(z)for(let Q in z)U+=Dl(" "+Q+"="+z[Q]+`
`);return c1.from(U)};bh1.decodePax=function(Y){let U={};while(Y.length){let z=0;while(z<Y.length&&Y[z]!==32)z++;let Q=parseInt(c1.toString(Y.subarray(0,z)),10);if(!Q)return U;let J=c1.toString(Y.subarray(z+1,Q-1)),I=J.indexOf("=");if(I===-1)return U;U[J.slice(0,I)]=J.slice(I+1),Y=Y.subarray(Q)}return U};bh1.encode=function(Y){let U=c1.alloc(512),z=Y.name,Q="";if(Y.typeflag===5&&z[z.length-1]!=="/")z+="/";if(c1.byteLength(z)!==z.length)return null;while(c1.byteLength(z)>100){let J=z.indexOf("/");if(J===-1)return null;Q+=Q?"/"+z.slice(0,J):z.slice(0,J),z=z.slice(J+1)}if(c1.byteLength(z)>100||c1.byteLength(Q)>155)return null;if(Y.linkname&&c1.byteLength(Y.linkname)>100)return null;if(c1.write(U,z),c1.write(U,a2(Y.mode&4095,6),100),c1.write(U,a2(Y.uid,6),108),c1.write(U,a2(Y.gid,6),116),fh1(Y.size,U,124),c1.write(U,a2(Y.mtime.getTime()/1000|0,11),136),U[156]=48+kh1(Y.type),Y.linkname)c1.write(U,Y.linkname,157);if(c1.copy(mR0,U,257),c1.copy(Rh1,U,263),Y.uname)c1.write(U,Y.uname,265);if(Y.gname)c1.write(U,Y.gname,297);if(c1.write(U,a2(Y.devmajor||0,6),329),c1.write(U,a2(Y.devminor||0,6),337),Q)c1.write(U,Q,345);return c1.write(U,a2(oR0(U),6),148),U};bh1.decode=function(Y,U,z){let Q=Y[156]===0?0:Y[156]-48,J=SK(Y,0,100,U),I=s2(Y,100,8),K=s2(Y,108,8),G=s2(Y,116,8),H=s2(Y,124,12),W=s2(Y,136,12),X=yh1(Q),Z=Y[157]===0?null:SK(Y,157,100,U),q=SK(Y,265,32),V=SK(Y,297,32),F=s2(Y,329,8),w=s2(Y,337,8),O=oR0(Y);if(O===256)return null;if(O!==s2(Y,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(hh1(Y)){if(Y[345])J=SK(Y,345,155,U)+"/"+J}else if(Sh1(Y));else if(!z)throw Error("Invalid tar header: unknown format.");if(Q===0&&J&&J[J.length-1]==="/")Q=5;return{name:J,mode:I,uid:K,gid:G,size:H,byteOffset:0,mtime:new Date(1000*W),type:X,linkname:Z,uname:q,gname:V,devmajor:F,devminor:w,pax:null}};function hh1($){return c1.equals(mR0,$.subarray(257,263))}function Sh1($){return c1.equals(_h1,$.subarray(257,263))&&c1.equals(vh1,$.subarray(263,265))}function gh1($,Y,U){if(typeof $!=="number")return U;if($=~~$,$>=Y)return Y;if($>=0)return $;if($+=Y,$>=0)return $;return 0}function yh1($){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 kh1($){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 lR0($,Y,U,z){for(;U<z;U++)if($[U]===Y)return U;return z}function oR0($){let Y=256;for(let U=0;U<148;U++)Y+=$[U];for(let U=156;U<512;U++)Y+=$[U];return Y}function a2($,Y){if($=$.toString(8),$.length>Y)return"7777777777777777777".slice(0,Y)+" ";return"0000000000000000000".slice(0,Y-$.length)+$+" "}function xh1($,Y,U){Y[U]=128;for(let z=11;z>0;z--)Y[U+z]=$&255,$=Math.floor($/256)}function fh1($,Y,U){if($.toString(8).length>11)xh1($,Y,U);else c1.write(Y,a2($,11),U)}function uh1($){let Y;if($[0]===128)Y=!0;else if($[0]===255)Y=!1;else return null;let U=[],z;for(z=$.length-1;z>0;z--){let I=$[z];if(Y)U.push(I);else U.push(255-I)}let Q=0,J=U.length;for(z=0;z<J;z++)Q+=U[z]*Math.pow(256,z);return Y?Q:-1*Q}function s2($,Y,U){if($=$.subarray(Y,Y+U),Y=0,$[Y]&128)return uh1($);else{while(Y<$.length&&$[Y]===32)Y++;let z=gh1(lR0($,32,Y,$.length),$.length,$.length);while(Y<z&&$[Y]===0)Y++;if(z===Y)return 0;return parseInt(c1.toString($.subarray(Y,z)),8)}}function SK($,Y,U,z){return c1.toString($.subarray(Y,lR0($,0,Y,Y+U)),z)}function Dl($){let Y=c1.byteLength($),U=Math.floor(Math.log(Y)/Math.log(10))+1;if(Y+U>=Math.pow(10,U))U++;return Y+U+$}});var U_0=E((p$4,Y_0)=>{var{Writable:mh1,Readable:lh1,getStreamError:rR0}=Nl(),oh1=Zl(),sR0=hK(),gK=Al(),rh1=sR0.alloc(0);class aR0{constructor(){this.buffered=0,this.shifted=0,this.queue=new oh1,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 rh1;let Y=this._next($);if($===Y.byteLength)return Y;let U=[Y];while(($-=Y.byteLength)>0)Y=this._next($),U.push(Y);return sR0.concat(U)}_next($){let Y=this.queue.peek(),U=Y.byteLength-this._offset;if($>=U){let z=this._offset?Y.subarray(this._offset,Y.byteLength):Y;return this.queue.shift(),this._offset=0,this.buffered-=U,this.shifted+=U,z}return this.buffered-=$,this.shifted+=$,Y.subarray(this._offset,this._offset+=$)}}class tR0 extends lh1{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(rR0(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 XP0=E((YP1)=>{var Pp=u3().Buffer;YP1._dbcs=i3;var z8=-1,WP0=-2,m$=-10,k8=-1000,qK=Array(256),dZ=-1;for(cZ=0;cZ<256;cZ++)qK[cZ]=z8;var cZ;function i3($,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]=qK.slice(0),this.decodeTableSeq=[];for(var z=0;z<U.length;z++)this._addDecodeChunk(U[z]);if(typeof $.gb18030==="function"){this.gb18030=$.gb18030();var Q=this.decodeTables.length;this.decodeTables.push(qK.slice(0));var J=this.decodeTables.length;this.decodeTables.push(qK.slice(0));var I=this.decodeTables[0];for(var z=129;z<=254;z++){var K=this.decodeTables[k8-I[z]];for(var G=48;G<=57;G++){if(K[G]===z8)K[G]=k8-Q;else if(K[G]>k8)throw Error("gb18030 decode tables conflict at byte 2");var H=this.decodeTables[k8-K[G]];for(var W=129;W<=254;W++){if(H[W]===z8)H[W]=k8-J;else if(H[W]===k8-J)continue;else if(H[W]>k8)throw Error("gb18030 decode tables conflict at byte 3");var X=this.decodeTables[k8-H[W]];for(var Z=48;Z<=57;Z++)if(X[Z]===z8)X[Z]=WP0}}}}this.defaultCharUnicode=Y.defaultCharUnicode,this.encodeTable=[],this.encodeTableSeq=[];var q={};if($.encodeSkipVals)for(var z=0;z<$.encodeSkipVals.length;z++){var V=$.encodeSkipVals[z];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 F in $.encodeAdd)if(Object.prototype.hasOwnProperty.call($.encodeAdd,F))this._setEncodeChar(F.charCodeAt(0),$.encodeAdd[F])}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}i3.prototype.encoder=DP;i3.prototype.decoder=Tp;i3.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 z=Y.length-1;z>0;z--){var Q=U[Y[z]];if(Q==z8)U[Y[z]]=k8-this.decodeTables.length,this.decodeTables.push(U=qK.slice(0));else if(Q<=k8)U=this.decodeTables[k8-Q];else throw Error("Overwrite byte in "+this.encodingName+", addr: "+$.toString(16))}return U};i3.prototype._addDecodeChunk=function($){var Y=parseInt($[0],16),U=this._getDecodeTrieNode(Y);Y=Y&255;for(var z=1;z<$.length;z++){var Q=$[z];if(typeof Q==="string")for(var J=0;J<Q.length;){var I=Q.charCodeAt(J++);if(I>=55296&&I<56320){var K=Q.charCodeAt(J++);if(K>=56320&&K<57344)U[Y++]=65536+(I-55296)*1024+(K-56320);else throw Error("Incorrect surrogate pair in "+this.encodingName+" at chunk "+$[0])}else if(I>4080&&I<=4095){var G=4095-I+2,H=[];for(var W=0;W<G;W++)H.push(Q.charCodeAt(J++));U[Y++]=m$-this.decodeTableSeq.length,this.decodeTableSeq.push(H)}else U[Y++]=I}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=$}}NT0.exports={AggregateError:MT0,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 op=E((H84,DT0)=>{DT0.exports={format($,...Y){return $.replace(/%([sdifj])/g,function(...[U,z]){let Q=Y.shift();if(z==="f")return Q.toFixed(6);else if(z==="j")return JSON.stringify(Q);else if(z==="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 N8=E((W84,TT0)=>{var{format:oT1,inspect:EP}=op(),{AggregateError:rT1}=u4(),sT1=globalThis.AggregateError||rT1,aT1=Symbol("kIsNodeError"),tT1=["string","function","number","object","Function","Object","boolean","bigint","symbol"],eT1=/^([A-Z][a-z0-9]*)+$/,CP={};function Oz($,Y){if(!$)throw new CP.ERR_INTERNAL_ASSERTION(Y)}function BT0($){let Y="",U=$.length,z=$[0]==="-"?1:0;for(;U>=z+4;U-=3)Y=`_${$.slice(U-3,U)}${Y}`;return`${$.slice(0,U)}${Y}`}function $j1($,Y,U){if(typeof Y==="function")return Oz(Y.length<=U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${Y.length}).`),Y(...U);let z=(Y.match(/%[dfijoOs]/g)||[]).length;if(Oz(z===U.length,`Code: ${$}; The provided arguments length (${U.length}) does not match the required ones (${z}).`),U.length===0)return Y;return oT1(Y,...U)}function Q8($,Y,U){if(!U)U=Error;class z extends U{constructor(...Q){super($j1($,Y,Q))}toString(){return`${this.name} [${$}]: ${this.message}`}}Object.defineProperties(z.prototype,{name:{value:U.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${$}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),z.prototype.code=$,z.prototype[aT1]=!0,CP[$]=z}function AT0($){let Y="__node_internal_"+$.name;return Object.defineProperty($,"name",{value:Y}),$}function Yj1($,Y){if($&&Y&&$!==Y){if(Array.isArray(Y.errors))return Y.errors.push($),Y;let U=new sT1([Y,$],Y.message);return U.code=Y.code,U}return $||Y}class PT0 extends Error{constructor($="The operation was aborted",Y=void 0){if(Y!==void 0&&typeof Y!=="object")throw new CP.ERR_INVALID_ARG_TYPE("options","Object",Y);super($,Y);this.code="ABORT_ERR",this.name="AbortError"}}Q8("ERR_ASSERTION","%s",Error);Q8("ERR_INVALID_ARG_TYPE",($,Y,U)=>{if(Oz(typeof $==="string","'name' must be a string"),!Array.isArray(Y))Y=[Y];let z="The ";if($.endsWith(" argument"))z+=`${$} `;else z+=`"${$}" ${$.includes(".")?"property":"argument"} `;z+="must be ";let Q=[],J=[],I=[];for(let G of Y)if(Oz(typeof G==="string","All expected entries have to be of type string"),tT1.includes(G))Q.push(G.toLowerCase());else if(eT1.test(G))J.push(G);else Oz(G!=="object",'The value "object" should be written as "Object"'),I.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:z+=`of type ${Q[Line truncated
`);if(Y.linkname)U+=Pl(" linkpath="+Y.linkname+`
`);let z=Y.pax;if(z)for(let Q in z)U+=Pl(" "+Q+"="+z[Q]+`
`);return c1.from(U)};th1.decodePax=function(Y){let U={};while(Y.length){let z=0;while(z<Y.length&&Y[z]!==32)z++;let Q=parseInt(c1.toString(Y.subarray(0,z)),10);if(!Q)return U;let J=c1.toString(Y.subarray(z+1,Q-1)),I=J.indexOf("=");if(I===-1)return U;U[J.slice(0,I)]=J.slice(I+1),Y=Y.subarray(Q)}return U};th1.encode=function(Y){let U=c1.alloc(512),z=Y.name,Q="";if(Y.typeflag===5&&z[z.length-1]!=="/")z+="/";if(c1.byteLength(z)!==z.length)return null;while(c1.byteLength(z)>100){let J=z.indexOf("/");if(J===-1)return null;Q+=Q?"/"+z.slice(0,J):z.slice(0,J),z=z.slice(J+1)}if(c1.byteLength(z)>100||c1.byteLength(Q)>155)return null;if(Y.linkname&&c1.byteLength(Y.linkname)>100)return null;if(c1.write(U,z),c1.write(U,a2(Y.mode&4095,6),100),c1.write(U,a2(Y.uid,6),108),c1.write(U,a2(Y.gid,6),116),sh1(Y.size,U,124),c1.write(U,a2(Y.mtime.getTime()/1000|0,11),136),U[156]=48+oh1(Y.type),Y.linkname)c1.write(U,Y.linkname,157);if(c1.copy(rR0,U,257),c1.copy(ih1,U,263),Y.uname)c1.write(U,Y.uname,265);if(Y.gname)c1.write(U,Y.gname,297);if(c1.write(U,a2(Y.devmajor||0,6),329),c1.write(U,a2(Y.devminor||0,6),337),Q)c1.write(U,Q,345);return c1.write(U,a2(aR0(U),6),148),U};th1.decode=function(Y,U,z){let Q=Y[156]===0?0:Y[156]-48,J=SK(Y,0,100,U),I=s2(Y,100,8),K=s2(Y,108,8),G=s2(Y,116,8),H=s2(Y,124,12),W=s2(Y,136,12),X=lh1(Q),Z=Y[157]===0?null:SK(Y,157,100,U),q=SK(Y,265,32),V=SK(Y,297,32),F=s2(Y,329,8),O=s2(Y,337,8),w=aR0(Y);if(w===256)return null;if(w!==s2(Y,148,8))throw Error("Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?");if(dh1(Y)){if(Y[345])J=SK(Y,345,155,U)+"/"+J}else if(ph1(Y));else if(!z)throw Error("Invalid tar header: unknown format.");if(Q===0&&J&&J[J.length-1]==="/")Q=5;return{name:J,mode:I,uid:K,gid:G,size:H,byteOffset:0,mtime:new Date(1000*W),type:X,linkname:Z,uname:q,gname:V,devmajor:F,devminor:O,pax:null}};function dh1($){return c1.equals(rR0,$.subarray(257,263))}function ph1($){return c1.equals(nh1,$.subarray(257,263))&&c1.equals(ch1,$.subarray(263,265))}function mh1($,Y,U){if(typeof $!=="number")return U;if($=~~$,$>=Y)return Y;if($>=0)return $;if($+=Y,$>=0)return $;return 0}function lh1($){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 oh1($){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 sR0($,Y,U,z){for(;U<z;U++)if($[U]===Y)return U;return z}function aR0($){let Y=256;for(let U=0;U<148;U++)Y+=$[U];for(let U=156;U<512;U++)Y+=$[U];return Y}function a2($,Y){if($=$.toString(8),$.length>Y)return"7777777777777777777".slice(0,Y)+" ";return"0000000000000000000".slice(0,Y-$.length)+$+" "}function rh1($,Y,U){Y[U]=128;for(let z=11;z>0;z--)Y[U+z]=$&255,$=Math.floor($/256)}function sh1($,Y,U){if($.toString(8).length>11)rh1($,Y,U);else c1.write(Y,a2($,11),U)}function ah1($){let Y;if($[0]===128)Y=!0;else if($[0]===255)Y=!1;else return null;let U=[],z;for(z=$.length-1;z>0;z--){let I=$[z];if(Y)U.push(I);else U.push(255-I)}let Q=0,J=U.length;for(z=0;z<J;z++)Q+=U[z]*Math.pow(256,z);return Y?Q:-1*Q}function s2($,Y,U){if($=$.subarray(Y,Y+U),Y=0,$[Y]&128)return ah1($);else{while(Y<$.length&&$[Y]===32)Y++;let z=mh1(sR0($,32,Y,$.length),$.length,$.length);while(Y<z&&$[Y]===0)Y++;if(z===Y)return 0;return parseInt(c1.toString($.subarray(Y,z)),8)}}function SK($,Y,U,z){return c1.toString($.subarray(Y,sR0($,0,Y,Y+U)),z)}function Pl($){let Y=c1.byteLength($),U=Math.floor(Math.log(Y)/Math.log(10))+1;if(Y+U>=Math.pow(10,U))U++;return Y+U+$}});var J_0=E(($54,Q_0)=>{var{Writable:QS1,Readable:JS1,getStreamError:tR0}=Al(),IS1=Ll(),eR0=hK(),gK=Tl(),KS1=eR0.alloc(0);class $_0{constructor(){this.buffered=0,this.shifted=0,this.queue=new IS1,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 KS1;let Y=this._next($);if($===Y.byteLength)return Y;let U=[Y];while(($-=Y.byteLength)>0)Y=this._next($),U.push(Y);return eR0.concat(U)}_next($){let Y=this.queue.peek(),U=Y.byteLength-this._offset;if($>=U){let z=this._offset?Y.subarray(this._offset,Y.byteLength):Y;return this.queue.shift(),this._offset=0,this.buffered-=U,this.shifted+=U,z}return this.buffered-=$,this.shifted+=$,Y.subarray(this._offset,this._offset+=$)}}class Y_0 extends JS1{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(tR0(this))}_detach(){if(this._parent._stream= Line truncated
`),z=[await W4($,U.recordId)];else if(U.recordIds&&U.recordIds.length>0)process.stderr.write(`\uD83D\uDD0D 批量查询 ${U.recordIds.length} 条单据记录...
`),z=await Promise.all(U.recordIds.map((O)=>W4($,O)));else{let O=U.limit??10;process.stderr.write(`\uD83D\uDD0D 检索企业「${Y.name}」(${Y.id}) 的线上审核记录 (限制 ${O} 条)...
`);let N=(await i4($,{limit:O,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(N.length===0)throw Error("未检索到符合条件的线上审核记录,无法导出 webhook 资源包。");process.stderr.write(`\uD83D\uDCE5 正在拉取 ${N.length} 条审核记录完整详情...
`),z=await Promise.all(N.map((D)=>W4($,D.id)))}let Q=new Map,J=0;for(let O of z){let M=O.document,N=O.sourceDocumentId??(typeof M?.id==="string"?M.id:void 0)??(typeof M?.sourceDocumentId==="string"?M.sourceDocumentId:void 0)??O.documentId??O.id,D=`${U.docIdPrefix??""}${N}${U.docIdSuffix??""}`,P=[];if(U.includeAttachments!==!1){let A=n2(O,{summary:!1}).attachments,j=new Set;for(let C of A){let b=C.ossSignedUrl??C.url;if(!b)continue;let k=C.fileName??C.fileId??"attachment",S=Zp(k),i=S,n=S.lastIndexOf("."),z0=n>0?S.slice(0,n):S,x=n>0?S.slice(n):"",d=1;while(j.has(i.toLowerCase()))i=`${z0}_${d}${x}`,d++;j.add(i.toLowerCase());try{process.stderr.write(`⬇ 下载单据「${D}」附件: ${k}...
`),z=await Promise.all(U.recordIds.map((w)=>W4($,w)));else{let w=U.limit??10;process.stderr.write(`\uD83D\uDD0D 检索企业「${Y.name}」(${Y.id}) 的线上审核记录 (限制 ${w} 条)...
`);let M=(await n4($,{limit:w,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(M.length===0)throw Error("未检索到符合条件的线上审核记录,无法导出 webhook 资源包。");process.stderr.write(`\uD83D\uDCE5 正在拉取 ${M.length} 条审核记录完整详情...
`),z=await Promise.all(M.map((D)=>W4($,D.id)))}let Q=new Map,J=0;for(let w of z){let N=w.document,M=w.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??w.documentId??w.id,D=`${U.docIdPrefix??""}${M}${U.docIdSuffix??""}`,P=[];if(U.includeAttachments!==!1){let B=n2(w,{summary:!1}).attachments,j=new Set;for(let C of B){let b=C.ossSignedUrl??C.url;if(!b)continue;let k=C.fileName??C.fileId??"attachment",S=Ld(k),i=S,n=S.lastIndexOf("."),z0=n>0?S.slice(0,n):S,x=n>0?S.slice(n):"",p=1;while(j.has(i.toLowerCase()))i=`${z0}_${p}${x}`,p++;j.add(i.toLowerCase());try{process.stderr.write(`⬇ 下载单据「${D}」附件: ${k}...
`);let t=await fetch(b);if(t.ok){let e=await t.arrayBuffer(),g=Buffer.from(e);P.push({fileName:i,zipPath:`${D}/${i}`,buffer:g,sourceField:C.sourceField??"附件"}),J++}}catch(t){process.stderr.write(`⚠️ [跳过附件] 下载失败 ${k}: ${t}
`)}}}Q.set(D,P)}let I=new N_0.default.Workbook;I.creator="seal-use",I.created=new Date;let K=new Set;for(let O of Q.values())for(let M of O)K.add(M.sourceField);if(K.size===0)K.add("附件");let G=new Set;for(let O of z){let M=O.document,N=Array.isArray(M?.fields)?M.fields:[];for(let D of N)if(D&&typeof D==="object"){let P=D,T=typeof P.label==="string"?P.label.trim():typeof P.key==="string"?P.key.trim():"",A=typeof P.type==="string"?P.type.toUpperCase():"";if(T&&A!=="ATTACHMENT"&&A!=="LIST")G.add(T)}}let H=["会议编号","会议名称","状态","总金额","报销事由","申请日期"],W=Array.from(G).filter((O)=>!H.includes(O)&&O!=="单据编号"&&O!=="单号"),X=Array.from(K).map((O)=>`[附件]${O}`),Z=[...H,...W,...X],q=I.addWorksheet("主表");q.addRow(Z),q.getRow(1).font={bold:!0};for(let O of z){let M=O.document,N=O.sourceDocumentSN??(typeof M?.sn==="string"?M.sn:void 0)??(typeof M?.sourceDocumentSN==="string"?M.sourceDocumentSN:void 0)??O.id,D=O.sourceDocumentId??(typeof M?.id==="string"?M.id:void 0)??(typeof M?.sourceDocumentId==="string"?M.sourceDocumentId:void 0)??O.documentId??O.id,P=`${U.docIdPrefix??""}${D}${U.docIdSuffix??""}`,T=`${U.docIdPrefix??""}${N}${U.docIdSuffix??""}`,A=(typeof M?.title==="string"?M.title:void 0)??(typeof M?.name==="string"?M.name:void 0)??T,j="";if(typeof M?.sourceStartTime==="number")j=new Date(M.sourceStartTime*1000).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof O.createdAt==="number")j=new Date(O.createdAt).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof O.createdAt==="string")j=O.createdAt.slice(0,10);let C=new Map,b=Array.isArray(M?.fields)?M.fields:[];for(let z0 of b)if(z0&&typeof z0==="object"){let x=z0,d=typeof x.label==="string"?x.label.trim():typeof x.key==="string"?x.key.trim():"";if(d)C.set(d,x.value)}let k,S=C.get("总金额")??C.get("报销金额")??C.get("total_amount");if(typeof S==="number")k=S;else if(S&&typeof S==="object"&&"amount"in S&&typeof S.amount==="number")k=S.amount;let i=[];i.push(P),i.push(A),i.push(O.status??"已审批"),i.push(k??""),i.push(C.get("报销事由")??C.get("事由")??A),i.push(j);for(let z0 of W){let x=C.get(z0);if(x===void 0||x===null)i.push("");else if(typeof x==="object")if("amount"in x)i.push(x.amount);else i.push(JSON.stringify(x));else i.push(x)}let n=Q.get(P)??[];for(let z0 of K){let x=n.filter((d)=>d.sourceField===z0||K.size===1);if(x.length>0)i.push(x.map((d)=>d.zipPath).join(`
`));else i.push("")}q.addRow(i)}let V=VS1(U,Y);HS1(ZS1(V),{recursive:!0});let F=await I.xlsx.writeBuffer();process.stderr.write(`\uD83D\uDCE6 正在压缩生成 Webhook 资源包: ${V}...
`),await new Promise((O,M)=>{let N=GS1(V),D=new El({zlib:{level:9}});N.on("close",()=>O()),D.on("error",(P)=>M(P)),D.pipe(N),D.append(Buffer.from(F),{name:"信息表.xlsx"});for(let P of Q.values())for(let T of P)D.append(T.buffer,{name:T.zipPath});D.finalize()});let w=WS1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:z.length,attachmentCount:J,fileSizeBytes:w.size,exportedAt:new Date().toISOString(),nextAction:`seal-use webhook resource-pack push ${V} --corp <targetCorpId>`}}var N_0;var Cl=m(()=>{w_0();P6();dB();N_0=J6(_Z(),1)});import{readFileSync as LS1}from"node:fs";function FS1($){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 OS1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function wS1($,Y){if(!$.length)return;let U=new Set($.map((J)=>{let I=J.fileName.split("/")[0],K=I.indexOf("@");return K>=0?I.slice(0,K):I}).filter((J)=>J!=="信息表.xlsx")),z=[];for(let J of Y){let I=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(I))z.push(`Excel 会议编号「${I}」声明了附件,但在 ZIP 中找不到对应的根目录「${I}/」或「${I}@.../」。`)}let Q=new Set(Y.map((J)=>J.document.documentId));for(let J of U)if(!Q.has(J))z.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(z.length)throw new B5(z)}async function D_0($,Y,U){let z=[],Q=$;if(OS1($,Y)){z=await vP0($),SP0(z,U);let G=z.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await Cd($,G)}let J=await bP0(Q);wS1(z,J);let I=iP0(z,J),K=J.map((G)=>G.document);return{entries:z,parsed:J,plans:I,documents:K,fileBuffer:$}}async function kz($,Y,U){let z=await D_0($,Y,U),Q=z.parsed.map((J,I)=>gd(J.document,z.plans[I],new Map));return{warnings:[],documents:Q,attachmentPlan:z.plans}}async function FT($,Y,U){let z=await D_0($,Y,U.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=FS1(U.webhookUrl),I=[];for(let K=0;K<z.parsed.length;K+=1){let G=z.parsed[K],H=z.plans[K],W=new Map,X=[...H.categoryFields,...Object.values(H.personAttachments).flat(),...Object.values(H.expenseAttachments).flat()];for(let V of X)for(let F of V.paths){if(W.has(F))continue;let w=z.entries.find((T)=>T.fileName===F);if(!w)continue;process.stderr.write(`⬆ 上传附件: ${F}
`);let O=new FormData,M=await Cd(z.fileBuffer,w),N=F.split("/").pop()??F;O.append("files",new File([new Uint8Array(M)],N));let D=await fetch(`${Q}/api/v1/integrations/webhook/${encodeURIComponent(J)}/attachments`,{method:"POST",headers:{...U.customHeaders??{},...fZ({},U.secret)},body:O});if(!D.ok)throw Error(`附件上传失败 ${D.status}: ${await D.text()}`);let P=await D.json();W.set(F,P.attachments?.map((T)=>T.data)??(P.data===void 0?[]:[P.data])),process.stderr.write(`✓ 附件上传成功: ${F}
`)}}}Q.set(D,P)}let I=new A_0.default.Workbook;I.creator="seal-use",I.created=new Date;let K=new Set;for(let w of Q.values())for(let N of w)K.add(N.sourceField);if(K.size===0)K.add("附件");let G=new Set;for(let w of z){let N=w.document,M=Array.isArray(N?.fields)?N.fields:[];for(let D of M)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((w)=>!H.includes(w)&&w!=="单据编号"&&w!=="单号"),X=Array.from(K).map((w)=>`[附件]${w}`),Z=[...H,...W,...X],q=I.addWorksheet("主表");q.addRow(Z),q.getRow(1).font={bold:!0};for(let w of z){let N=w.document,M=w.sourceDocumentSN??(typeof N?.sn==="string"?N.sn:void 0)??(typeof N?.sourceDocumentSN==="string"?N.sourceDocumentSN:void 0)??w.id,D=w.sourceDocumentId??(typeof N?.id==="string"?N.id:void 0)??(typeof N?.sourceDocumentId==="string"?N.sourceDocumentId:void 0)??w.documentId??w.id,P=`${U.docIdPrefix??""}${D}${U.docIdSuffix??""}`,T=`${U.docIdPrefix??""}${M}${U.docIdSuffix??""}`,B=(typeof N?.title==="string"?N.title:void 0)??(typeof N?.name==="string"?N.name:void 0)??T,j="";if(typeof N?.sourceStartTime==="number")j=new Date(N.sourceStartTime*1000).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof w.createdAt==="number")j=new Date(w.createdAt).toLocaleDateString("en-CA",{timeZone:"Asia/Shanghai"});else if(typeof w.createdAt==="string")j=w.createdAt.slice(0,10);let C=new Map,b=Array.isArray(N?.fields)?N.fields:[];for(let z0 of b)if(z0&&typeof z0==="object"){let x=z0,p=typeof x.label==="string"?x.label.trim():typeof x.key==="string"?x.key.trim():"";if(p)C.set(p,x.value)}let k,S=C.get("总金额")??C.get("报销金额")??C.get("total_amount");if(typeof S==="number")k=S;else if(S&&typeof S==="object"&&"amount"in S&&typeof S.amount==="number")k=S.amount;let i=[];i.push(P),i.push(B),i.push(w.status??"已审批"),i.push(k??""),i.push(C.get("报销事由")??C.get("事由")??B),i.push(j);for(let z0 of W){let x=C.get(z0);if(x===void 0||x===null)i.push("");else if(typeof x==="object")if("amount"in x)i.push(x.amount);else i.push(JSON.stringify(x));else i.push(x)}let n=Q.get(P)??[];for(let z0 of K){let x=n.filter((p)=>p.sourceField===z0||K.size===1);if(x.length>0)i.push(x.map((p)=>p.zipPath).join(`
`));else i.push("")}q.addRow(i)}let V=jS1(U,Y);DS1(PS1(V),{recursive:!0});let F=await I.xlsx.writeBuffer();process.stderr.write(`\uD83D\uDCE6 正在压缩生成 Webhook 资源包: ${V}...
`),await new Promise((w,N)=>{let M=NS1(V),D=new _l({zlib:{level:9}});M.on("close",()=>w()),D.on("error",(P)=>N(P)),D.pipe(M),D.append(Buffer.from(F),{name:"信息表.xlsx"});for(let P of Q.values())for(let T of P)D.append(T.buffer,{name:T.zipPath});D.finalize()});let O=BS1(V);return{filePath:V,corpId:Y.id,corpName:Y.name,recordCount:z.length,attachmentCount:J,fileSizeBytes:O.size,exportedAt:new Date().toISOString(),nextAction:`seal-use webhook resource-pack push ${V} --corp <targetCorpId>`}}var A_0;var vl=m(()=>{D_0();P6();mA();A_0=J6(_Z(),1)});import{readFileSync as ES1}from"node:fs";function CS1($){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 RS1($,Y){return Y.toLowerCase().endsWith(".zip")||$[0]===80&&$[1]===75&&!Y.toLowerCase().endsWith(".xlsx")}function _S1($,Y){if(!$.length)return;let U=new Set($.map((J)=>{let I=J.fileName.split("/")[0],K=I.indexOf("@");return K>=0?I.slice(0,K):I}).filter((J)=>J!=="信息表.xlsx")),z=[];for(let J of Y){let I=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(I))z.push(`Excel 会议编号「${I}」声明了附件,但在 ZIP 中找不到对应的根目录「${I}/」或「${I}@.../」。`)}let Q=new Set(Y.map((J)=>J.document.documentId));for(let J of U)if(!Q.has(J))z.push(`ZIP 根目录对应的编号「${J}」在信息表中找不到对应的会议编号。`);if(z.length)throw new T5(z)}async function P_0($,Y,U){let z=[],Q=$;if(RS1($,Y)){z=await gP0($),kP0(z,U);let G=z.find((H)=>H.fileName==="信息表.xlsx");if(!G)throw Error("ZIP 根目录缺少信息表.xlsx");Q=await vp($,G)}let J=await cP0(Q);_S1(z,J);let I=dP0(z,J),K=J.map((G)=>G.document);return{entries:z,parsed:J,plans:I,documents:K,fileBuffer:$}}async function kz($,Y,U){let z=await P_0($,Y,U),Q=z.parsed.map((J,I)=>xp(J.document,z.plans[I],new Map));return{warnings:[],documents:Q,attachmentPlan:z.plans}}async function wT($,Y,U){let z=await P_0($,Y,U.materialPackFilePolicy),{baseUrl:Q,webhookId:J}=CS1(U.webhookUrl),I=[];for(let K=0;K<z.parsed.length;K+=1){let G=z.parsed[K],H=z.plans[K],W=new Map,X=[...H.categoryFields,...Object.values(H.personAttachments).flat(),...Object.values(H.expenseAttachments).flat()];for(let V of X)for(let F of V.paths){if(W.has(F))continue;let O=z.entries.find((T)=>T.fileName===F);if(!O)continue;process.stderr.write(`⬆ 上传附件: ${F}
`);let w=new FormData,N=await vp(z.fileBuffer,O),M=F.split("/").pop()??F;w.append("files",new File([new Uint8Array(N)],M));let D=await fetch(`${Q}/api/v1/integrations/webhook/${encodeURIComponent(J)}/attachments`,{method:"POST",headers:{...U.customHeaders??{},...fZ({},U.secret)},body:w});if(!D.ok)throw Error(`附件上传失败 ${D.status}: ${await D.text()}`);let P=await D.json();W.set(F,P.attachments?.map((T)=>T.data)??(P.data===void 0?[]:[P.data])),process.stderr.write(`✓ 附件上传成功: ${F}
`)}process.stderr.write(`\uD83D\uDCE4 推送单据: ${G.document.documentId}
`);let Z=gd(G.document,H,W),q=await fetch(`${Q}/api/v1/integrations/webhook/${encodeURIComponent(J)}/document`,{method:"POST",headers:{...U.customHeaders??{},"Content-Type":"application/json",...fZ({webhookId:J,...Z},U.secret)},body:JSON.stringify(Z)});if(!q.ok)throw Error(`Webhook 单据推送失败 ${q.status}: ${await q.text()}`);I.push({documentId:Z.documentId,document:Z,pushResult:await q.json()}),process.stderr.write(`✓ 单据推送成功: ${Z.documentId}
`)}return{warnings:[],results:I}}function xz($){return{fileBuffer:LS1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}var Rl=m(()=>{UP();yd();Sd();Rd();QK();Cl()});import{existsSync as MS1}from"node:fs";async function OT($,Y,U={}){let Q=v4().stateful?"stateful":"stateless",J="ok",I,K,G;try{let D=await X8($);G={id:D.user.id,name:D.user.name,isAdmin:D.user.isAdmin},K={id:D.tenant.id,name:D.tenant.name,tenantSlug:D.tenant.tenantSlug,corporationName:D.tenant.hoseCorpConfig?.corporationName}}catch(D){J="error",I=D instanceof Error?D.message:String(D)}let H=[];if(J==="ok")try{H=await I$($,Y.seal.endpoints.approvalStylePreferences)}catch(D){J="error",I=`读取 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?x7(H,U.webhook):W?H[0]:void 0,V;if(U.filePath)if(!MS1(U.filePath))V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let D=xz(U.filePath),P=await kz(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 F=V?V.valid:!0,w=J==="ok"&&X.length>0&&F,O=Q==="stateful"?"":` --corp ${Y.id}`,M="",N="";if(J!=="ok")N=`凭证鉴权异常: ${I}`,M=`seal-use auth diagnose${O}`;else if(X.length===0)N="当前企业尚未配置任何 Webhook 集成通道",M=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${O}`;else if(V&&!V.valid)N=`资源包预检失败: ${V.errors?.join("; ")}`,M=`seal-use webhook resource-pack preview ${V.filePath}${O}`;else{N=W?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到 ${X.length} 个 Webhook 通道,等待载入`;let D=V?.filePath??"<资源包.zip>",P=W?"":` --webhook ${Z?Z.id:"<webhookIdOrName>"}`;M=`seal-use webhook resource-pack push ${D}${P}${O}`}return{ready:w,corp:{id:Y.id,name:Y.name,sourceType:Y.source.type,tenant:K,user:G},stateMode:Q,authStatus:J,authError:I,activeWebhooks:X,defaultWebhook:Z,resourcePack:V,materialPack:V,statusMessage:N,nextAction:M}}var A_0=m(()=>{k3();P6();Rl()});var _l=m(()=>{QK();sQ();UP();Rd();Sd();yd();Rl();A_0();Cl()});import{existsSync as B_0,mkdirSync as P_0,statSync as NS1}from"node:fs";import{homedir as DS1}from"node:os";import{dirname as AS1,resolve as wT}from"node:path";function BS1($){if($.outputFile){let I=wT($.outputFile),K=AS1(I);if(!B_0(K))P_0(K,{recursive:!0});return I}let U=($.corpName||$.corpId||"企业").replace(/[/\\?%*:|"<>]/g,"_").trim()||"企业",z=$.dateTag||new Date().toISOString().slice(0,10),Q=`${U}_智能洞察报告_${z}.xlsx`,J;if($.toDownloads)J=wT(DS1(),"Downloads");else J=wT(process.cwd(),"exports");if(!B_0(J))P_0(J,{recursive:!0});return wT(J,Q)}async function MT($,Y,U={}){let z=Y.name||Y.id,Q=Hp({startDate:U.startDate,endDate:U.endDate,force:U.force}),J=new Date().toISOString(),[I,K]=await Promise.all([hw($,{startDate:Q.startDateStr,endDate:Q.endDateStr,limit:U.limit??100}),gw($,{startDate:Q.startDateStr,endDate:Q.endDateStr}).catch(()=>({metrics:{},sankeyData:{nodes:[],links:[]}}))]),G=I.tagStats||[],H=[],W=Math.min(G.length,U.limit??50);for(let C=0;C<W;C++){let b=G[C];if(!b?.tagId)continue;try{let k=await Sw($,{tagId:b.tagId,startDate:Q.startDateStr,endDate:Q.endDateStr});for(let S of k.risks||[])H.push({tagId:b.tagId,tagName:b.tagName||b.tagId,documentSN:S.documentSN||"-",documentType:S.documentType||"-",riskLevel:S.riskLevel||"warning",confidence:S.confidence??0,riskDetails:S.riskDetails||"-",reasoning:S.reasoning||"-",sourceDocumentURL:S.sourceDocumentURL,createdAt:S.createdAt})}catch{}}let X=new T_0.default.Workbook;X.creator="seal-use",X.lastModifiedBy="seal-use",X.created=new Date,X.modified=new Date;let Z={type:"pattern",pattern:"solid",fgColor:{argb:"FF1E293B"}},q={name:"Microsoft YaHei",size:11,bold:!0,color:{argb:"FFFFFFFF"}},V={top:{style:"thin",color:{argb:"FFE2E8F0"}},bottom:{style:"thin",color:{argb:"FFE2E8F0"}},left:{style:"thin",color:{argb:"FFE2E8F0"}},right:{style:"thin",color:{argb:"FFE2E8F0"}}},F=X.addWorksheet("审核效能与决策流向",{views:[{showGridLines:!0}]});F.columns=[{header:"分类",key:"category",width:20},{header:"指标名称",key:"name",width:28},{header:"数值",key:"val",width:22},{header:"环比/趋势",key:"trend",width:18},{header:"说明",key:"desc",width:36}],F.getRow(1).height=28,F.getRow(1).font=q,F.getRow(1).fill=Z,F.getRow(1).alignment={vertical:"middle",horizontal:"center"};let w=K.metrics||{},O=[{c Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:kK({id:Y?.id,sn:Y?.sn??Y?.sourceDocumentSN??$.sourceDocumentSN,title:Y?.title??Y?.name,template:TT(Y,["template.name","templateName","form.name","formName","formTitle"]),amount:DT(U,["金额","报销金额","付款金额","合计","价税合计"])??TT(Y,["amount","totalAmount","expenseAmount"]),expenseType:DT(U,["费用类型","费用类别","报销类型"]),costCompany:DT(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:DT(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:iS1($),attachments:n2($,{summary:!0}).attachments,aiResult:ET($),manualResult:uz($)?.value,hints:kK({amountMentions:R_0(z,["金额","合计","税率"],8),partyMentions:R_0(z,["买方","卖方","甲方","乙方","收款"],8)})}}function xS1($){let Y=[["result.citedRules",m3($,"result.citedRules")],["result.matchedRules",m3($,"result.matchedRules")],["result.ruleResults",m3($,"result.ruleResults")],["result.rules",m3($,"result.rules")],["pipelineData.citedRules",m3($,"pipelineData.citedRules")],["pipelineData.matchedRules",m3($,"pipelineData.matchedRules")]],U=[],z=new Set;for(let[Q,J]of Y)(Array.isArray(J)?J:J&&typeof J==="object"?Object.values(J):[]).forEach((K,G)=>{let H=Pq(K);if(!H)return;let W=w4(H.runtimeRuleId)??w4(H.runtimeId)??w4(H.id)??w4(H.ruleId),X=w4(H.ruleCode)??w4(H.code)??(W?pS1(W):void 0),Z=kK({runtimeRuleId:W,ruleCode:X,versionNumber:uS1(H.versionNumber)??$.ruleSetVersionNumber,scope:w4(H.scope),strictness:w4(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(!z.has(q))z.add(q),U.push(Z)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function TT($,Y){if(!$)return;for(let U of Y){let z=m3($,U);if(z!==void 0)return z}return}function C_0($,Y){if(!$)return 0;for(let U of Y){let z=m3($,U);if(Array.isArray(z))return z.length;if(z&&typeof z==="object")return Object.keys(z).length;if(typeof z==="number")return z}return 0}function m3($,Y){return Y.split(".").reduce((U,z)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let Q=Number(z);return Number.isInteger(Q)?U[Q]:void 0}if(typeof U==="object")return U[z];return},$)}function fS1($,Y,U){let z=Y.split("."),Q=$;for(let J of z.slice(0,-1)){let I=Q[J];if(!I||typeof I!=="object"||Array.isArray(I))Q[J]={};Q=Q[J]}Q[z[z.length-1]??Y]=U}function kK($){return Object.fromEntries(Object.entries($).filter(([,Y])=>Y!==void 0))}function Pq($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function uS1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function bS1($){let Y=[];return Sl($,"document",Y),Y}function Sl($,Y,U){if(Array.isArray($)){$.forEach((I,K)=>Sl(I,`${Y}.${K}`,U));return}let z=Pq($);if(!z)return;let Q=w4(z.label)??w4(z.name)??w4(z.title)??w4(z.fieldName),J=z.value??z.displayValue??z.text??z.content;if(Q&&J!==void 0&&typeof J!=="object")U.push(kK({path:Y,label:Q,value:J,type:w4(z.type)??w4(z.fieldType)}));for(let[I,K]of Object.entries(z)){if(I==="attachments")continue;Sl(K,`${Y}.${I}`,U)}}function DT($,Y){return $.find((z)=>{let Q=w4(z.label)??"";return Y.some((J)=>Q.includes(J))})?.value}function iS1($){let Y=[];return jT($.result,"result",Y),jT($.document,"document",Y),Y.slice(0,20)}function jT($,Y,U){if(Array.isArray($)){$.forEach((Q,J)=>jT(Q,`${Y}.${J}`,U));return}let z=Pq($);if(!z)return;if(/invoice|发票/i.test(Y))U.push(kK({path:Y,fileName:w4(z.fileName)??w4(z.filename)??w4(z.name),buyer:z.buyer??z.buyerName??z.purchaserName,seller:z.seller??z.sellerName,amount:z.amount??z.totalAmount??z.total,taxRate:z.taxRate,category:z.category??z.type}));for(let[Q,J]of Object.entries(z))jT(J,`${Y}.${Q}`,U)}function R_0($,Y,U){return $.split(/\r?\n/).filter((z)=>Y.some((Q)=>z.includes(Q))).slice(0,U)}function AT($){return $.map((Y)=>{let U=fz(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 hl($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function nS1($,Y){if(Y.recordId&&!Y.versionId&&!Y.versionNumber&&!Y.latest){let U=await W4($,Y.recordId);if(!U.ruleSetVersionNumber)throw Er Line truncated
`)},{...Ap(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 z=await X6($).catch(()=>{return}),Q=await xH($,Y.versionName);if(z)try{xZ(U.corp.id,Q.version,z.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 nS1($,Y),z=cS1(U,{code:Y.code,runtimeId:Y.runtimeId});if(!z)throw Error(`Rule not found in version ${U.versionNumber}`);return z}},{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 z=[],Q;if(Y.file){let H=xp(Y.file);z=MB0(H.rules),Q=H.meta.versionNumber}else if(Y.version){let H=await c8($),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,z=(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 z=((await X6($)).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)z=z.filter((H)=>H.code===Y.code||H.code?.replace(/[#\s]/g,"")===Y.code?.replace(/[#\s]/g,""));if(Y.ruleId)z=z.filter((H)=>H.id===Y.ruleId||H.code===Y.ruleId);let J=v4(),I=Y.linter??J.lint?.activeLinter??"builtin",K=await Sp(I),G=await LB0(z,K,{corpId:U?.corp?.id,versionNumber:Q,allRules:z},{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 z=Y.out??"./rules.local.json",Q=[],J="draft",I;if(Y.version){let G=await c8($),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}`);I=W.versionNumber,J=`version:${I}`,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 X6($)).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:wB0(z,{corpId:U.corp.id,source:J,versionNumber:I,exportedAt:new Date().toISOString(),rulesCount:Q.length,rules: Line truncated
`+`• 身份主体:${T}${A}
`);let Z=xp(G.document,H,W),q=await fetch(`${Q}/api/v1/integrations/webhook/${encodeURIComponent(J)}/document`,{method:"POST",headers:{...U.customHeaders??{},"Content-Type":"application/json",...fZ({webhookId:J,...Z},U.secret)},body:JSON.stringify(Z)});if(!q.ok)throw Error(`Webhook 单据推送失败 ${q.status}: ${await q.text()}`);I.push({documentId:Z.documentId,document:Z,pushResult:await q.json()}),process.stderr.write(`✓ 单据推送成功: ${Z.documentId}
`)}return{warnings:[],results:I}}function xz($){return{fileBuffer:ES1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}var hl=m(()=>{zP();fp();kp();hp();QK();vl()});import{existsSync as vS1}from"node:fs";async function OT($,Y,U={}){let Q=h4().stateful?"stateful":"stateless",J="ok",I,K,G;try{let D=await X8($);G={id:D.user.id,name:D.user.name,isAdmin:D.user.isAdmin},K={id:D.tenant.id,name:D.tenant.name,tenantSlug:D.tenant.tenantSlug,corporationName:D.tenant.hoseCorpConfig?.corporationName}}catch(D){J="error",I=D instanceof Error?D.message:String(D)}let H=[];if(J==="ok")try{H=await K$($,Y.seal.endpoints.approvalStylePreferences)}catch(D){J="error",I=`读取 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?x7(H,U.webhook):W?H[0]:void 0,V;if(U.filePath)if(!vS1(U.filePath))V={valid:!1,filePath:U.filePath,fileName:U.filePath.split(/[\\/]/).pop()??U.filePath,documentCount:0,errors:[`文件不存在: ${U.filePath}`]};else try{let D=xz(U.filePath),P=await kz(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 F=V?V.valid:!0,O=J==="ok"&&X.length>0&&F,w=Q==="stateful"?"":` --corp ${Y.id}`,N="",M="";if(J!=="ok")M=`凭证鉴权异常: ${I}`,N=`seal-use auth diagnose${w}`;else if(X.length===0)M="当前企业尚未配置任何 Webhook 集成通道",N=`seal-use webhook add --name "默认入站通道" --result-url "https://your-domain.com/callback"${w}`;else if(V&&!V.valid)M=`资源包预检失败: ${V.errors?.join("; ")}`,N=`seal-use webhook resource-pack preview ${V.filePath}${w}`;else{M=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}${w}`}return{ready:O,corp:{id:Y.id,name:Y.name,sourceType:Y.source.type,tenant:K,user:G},stateMode:Q,authStatus:J,authError:I,activeWebhooks:X,defaultWebhook:Z,resourcePack:V,materialPack:V,statusMessage:M,nextAction:N}}var T_0=m(()=>{P5();P6();hl()});var Sl=m(()=>{QK();sQ();zP();hp();kp();fp();hl();T_0();vl()});import{existsSync as j_0,mkdirSync as E_0,statSync as hS1}from"node:fs";import{homedir as SS1}from"node:os";import{dirname as gS1,resolve as MT}from"node:path";function yS1($){if($.outputFile){let I=MT($.outputFile),K=gS1(I);if(!j_0(K))E_0(K,{recursive:!0});return I}let U=($.corpName||$.corpId||"企业").replace(/[/\\?%*:|"<>]/g,"_").trim()||"企业",z=$.dateTag||new Date().toISOString().slice(0,10),Q=`${U}_智能洞察报告_${z}.xlsx`,J;if($.toDownloads)J=MT(SS1(),"Downloads");else J=MT(process.cwd(),"exports");if(!j_0(J))E_0(J,{recursive:!0});return MT(J,Q)}async function NT($,Y,U={}){let z=Y.name||Y.id,Q=Zd({startDate:U.startDate,endDate:U.endDate,force:U.force}),J=new Date().toISOString(),[I,K]=await Promise.all([SO($,{startDate:Q.startDateStr,endDate:Q.endDateStr,limit:U.limit??100}),yO($,{startDate:Q.startDateStr,endDate:Q.endDateStr}).catch(()=>({metrics:{},sankeyData:{nodes:[],links:[]}}))]),G=I.tagStats||[],H=[],W=Math.min(G.length,U.limit??50);for(let C=0;C<W;C++){let b=G[C];if(!b?.tagId)continue;try{let k=await gO($,{tagId:b.tagId,startDate:Q.startDateStr,endDate:Q.endDateStr});for(let S of k.risks||[])H.push({tagId:b.tagId,tagName:b.tagName||b.tagId,documentSN:S.documentSN||"-",documentType:S.documentType||"-",riskLevel:S.riskLevel||"warning",confidence:S.confidence??0,riskDetails:S.riskDetails||"-",reasoning:S.reasoning||"-",sourceDocumentURL:S.sourceDocumentURL,createdAt:S.createdAt})}catch{}}let X=new C_0.default.Workbook;X.creator="seal-use",X.lastModifiedBy="seal-use",X.created=new Date,X.modified=new Date;let Z={type:"pattern",pattern:"solid",fgColor:{argb:"FF1E293B"}},q={name:"Microsoft YaHei",size:11,bold:!0,color:{argb:"FFFFFFFF"}},V={top:{style:"thin",color:{argb:"FFE2E8F0"}},bottom:{style:"thin",color:{argb:"FFE2E8F0"}},left:{style:"thin",color:{argb:"FFE2E8F0"}},right:{style:"thin",color:{argb:"FFE2E8F0"}}},F=X.addWorksheet("审核效能与决策流向",{views:[{showGridLines:!0}]});F.columns=[{header:"分类",key:"category",width:20},{header:"指标名称",key:"name",width:28},{header:"数值",key:"val",width:22},{header:"环比/趋势",key:"trend",width:18},{header:"说明",key:"desc",width:36}],F.getRow(1).height=28,F.getRow(1).font=q,F.getRow(1).fill=Z,F.getRow(1).alignment={vertical:"middle",horizontal:"center"};let O=K.metrics||{},w=[{c Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:kK({id:Y?.id,sn:Y?.sn??Y?.sourceDocumentSN??$.sourceDocumentSN,title:Y?.title??Y?.name,template:jT(Y,["template.name","templateName","form.name","formName","formTitle"]),amount:BT(U,["金额","报销金额","付款金额","合计","价税合计"])??jT(Y,["amount","totalAmount","expenseAmount"]),expenseType:BT(U,["费用类型","费用类别","报销类型"]),costCompany:BT(U,["费用承担公司","承担公司","成本中心","费用归属"]),payee:BT(U,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:U.slice(0,30)}),invoices:eS1($),attachments:n2($,{summary:!0}).attachments,aiResult:CT($),manualResult:uz($)?.value,hints:kK({amountMentions:h_0(z,["金额","合计","税率"],8),partyMentions:h_0(z,["买方","卖方","甲方","乙方","收款"],8)})}}function rS1($){let Y=[["result.citedRules",l3($,"result.citedRules")],["result.matchedRules",l3($,"result.matchedRules")],["result.ruleResults",l3($,"result.ruleResults")],["result.rules",l3($,"result.rules")],["pipelineData.citedRules",l3($,"pipelineData.citedRules")],["pipelineData.matchedRules",l3($,"pipelineData.matchedRules")]],U=[],z=new Set;for(let[Q,J]of Y)(Array.isArray(J)?J:J&&typeof J==="object"?Object.values(J):[]).forEach((K,G)=>{let H=Pq(K);if(!H)return;let W=M4(H.runtimeRuleId)??M4(H.runtimeId)??M4(H.id)??M4(H.ruleId),X=M4(H.ruleCode)??M4(H.code)??(W?Ug1(W):void 0),Z=kK({runtimeRuleId:W,ruleCode:X,versionNumber:aS1(H.versionNumber)??$.ruleSetVersionNumber,scope:M4(H.scope),strictness:M4(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(!z.has(q))z.add(q),U.push(Z)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:U.length,rules:U}}function jT($,Y){if(!$)return;for(let U of Y){let z=l3($,U);if(z!==void 0)return z}return}function v_0($,Y){if(!$)return 0;for(let U of Y){let z=l3($,U);if(Array.isArray(z))return z.length;if(z&&typeof z==="object")return Object.keys(z).length;if(typeof z==="number")return z}return 0}function l3($,Y){return Y.split(".").reduce((U,z)=>{if(U===void 0||U===null)return;if(Array.isArray(U)){let Q=Number(z);return Number.isInteger(Q)?U[Q]:void 0}if(typeof U==="object")return U[z];return},$)}function sS1($,Y,U){let z=Y.split("."),Q=$;for(let J of z.slice(0,-1)){let I=Q[J];if(!I||typeof I!=="object"||Array.isArray(I))Q[J]={};Q=Q[J]}Q[z[z.length-1]??Y]=U}function kK($){return Object.fromEntries(Object.entries($).filter(([,Y])=>Y!==void 0))}function Pq($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function aS1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function tS1($){let Y=[];return kl($,"document",Y),Y}function kl($,Y,U){if(Array.isArray($)){$.forEach((I,K)=>kl(I,`${Y}.${K}`,U));return}let z=Pq($);if(!z)return;let Q=M4(z.label)??M4(z.name)??M4(z.title)??M4(z.fieldName),J=z.value??z.displayValue??z.text??z.content;if(Q&&J!==void 0&&typeof J!=="object")U.push(kK({path:Y,label:Q,value:J,type:M4(z.type)??M4(z.fieldType)}));for(let[I,K]of Object.entries(z)){if(I==="attachments")continue;kl(K,`${Y}.${I}`,U)}}function BT($,Y){return $.find((z)=>{let Q=M4(z.label)??"";return Y.some((J)=>Q.includes(J))})?.value}function eS1($){let Y=[];return ET($.result,"result",Y),ET($.document,"document",Y),Y.slice(0,20)}function ET($,Y,U){if(Array.isArray($)){$.forEach((Q,J)=>ET(Q,`${Y}.${J}`,U));return}let z=Pq($);if(!z)return;if(/invoice|发票/i.test(Y))U.push(kK({path:Y,fileName:M4(z.fileName)??M4(z.filename)??M4(z.name),buyer:z.buyer??z.buyerName??z.purchaserName,seller:z.seller??z.sellerName,amount:z.amount??z.totalAmount??z.total,taxRate:z.taxRate,category:z.category??z.type}));for(let[Q,J]of Object.entries(z))ET(J,`${Y}.${Q}`,U)}function h_0($,Y,U){return $.split(/\r?\n/).filter((z)=>Y.some((Q)=>z.includes(Q))).slice(0,U)}function AT($){return $.map((Y)=>{let U=fz(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 yl($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function $g1($,Y){if(Y.recordId&&!Y.versionId&&!Y.versionNumber&&!Y.latest){let U=await W4($,Y.recordId);if(!U.ruleSetVersionNumber)throw Er 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 z=await X6($).catch(()=>{return}),Q=await xH($,Y.versionName);if(z)try{xZ(U.corp.id,Q.version,z.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 $g1($,Y),z=Yg1(U,{code:Y.code,runtimeId:Y.runtimeId});if(!z)throw Error(`Rule not found in version ${U.versionNumber}`);return z}},{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 z=[],Q;if(Y.file){let H=bd(Y.file);z=BA0(H.rules),Q=H.meta.versionNumber}else if(Y.version){let H=await d8($),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,z=(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 z=((await X6($)).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)z=z.filter((H)=>H.code===Y.code||H.code?.replace(/[#\s]/g,"")===Y.code?.replace(/[#\s]/g,""));if(Y.ruleId)z=z.filter((H)=>H.id===Y.ruleId||H.code===Y.ruleId);let J=h4(),I=Y.linter??J.lint?.activeLinter??"builtin",K=await kd(I),G=await OA0(z,K,{corpId:U?.corp?.id,versionNumber:Q,allRules:z},{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 z=Y.out??"./rules.local.json",Q=[],J="draft",I;if(Y.version){let G=await d8($),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}`);I=W.versionNumber,J=`version:${I}`,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 X6($)).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:DA0(z,{corpId:U.corp.id,source:J,versionNumber:I,exportedAt:new Date().toISOString(),rulesCount:Q.length,rules: Line truncated
`+`• 身份主体:${T}${B}
`+`• 权限范围:持有该链接者在 Seal AI 中拥有该用户的完整操作权限(含系统设置与规则编辑)
`+`• 时效性:换票凭证有效时间 ${q} 秒(${Math.round(q/60)} 分钟),在浏览器打开后将保留 30 天会话
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:W?I:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:I,documentUrl:I,ssoUrl:V,expiresIn:Z?q:void 0,identity:F,warning:w,hoseDomain:J.type==="hose"?oS1(J.domain):void 0,recordId:Q.id,sourceDocumentSN:Q.sourceDocumentSN,sourceDocumentId:Q.sourceDocumentId,sourceSystem:Q.sourceSystem,missing:{hoseDocumentUrl:!I?"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 z=Y.sn??Y.query;if(!z)throw Error("query or sn is required");let Q=await rS1($,{query:z,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)=>W4($,X.id))),I=E_0(Y.fields),K=J.map((X)=>dS1(X,I)),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:z,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:Q.total,scanned:Q.scanned,matched:K.length,records:K,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:AT(J)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:L.object({batchId:L.string().describe("simulation batch ID"),query:L.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,Y)=>{let U=ul(await Lg($,Y.batchId),Y.query);return{batchId:Y.batchId,count:U.length,records:U.map(fz),bridge:AT(U)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:L.object({mode:L.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:L.array(L.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:L.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:L.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:L.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:L.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:L.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:L.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:L.array(L.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:L.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:L.record(L.string(),L.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:L.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:L.record(L.string(),L.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,Y)=>{let U=Y.mode??"hosecloud",z=Y.signKey;if(U==="hosecloud"&&!z){if(z=(await Og($)).find((K)=>K.signKey)?.signKey,!z)throw Error(" Line truncated
`)}function Qg1($){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??"",I=U.get(J)??[];I.push(Q),U.set(J,I)}let z=[...$.groupOrder??[],...[...U.keys()].filter((Q)=>!$.groupOrder?.includes(Q))];for(let Q of z){let J=U.get(Q);if(!J)continue;if(Q)Y.push(""),Y.push(`${Q}:`);for(let I of J)for(let K of I.usage)Y.push(` ${K}`)}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 m_0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of l_0)for(let U of Y.commands)for(let z of U.usage)$.push(` ${z}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var l_0;var dl=m(()=>{F$();l_0=[{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?I:Z?V:G,type:X,mode:Z?"auto_login":"direct",sealResultUrl:G,hoseDocumentUrl:I,documentUrl:I,ssoUrl:V,expiresIn:Z?q:void 0,identity:F,warning:O,hoseDomain:J.type==="hose"?Ig1(J.domain):void 0,recordId:Q.id,sourceDocumentSN:Q.sourceDocumentSN,sourceDocumentId:Q.sourceDocumentId,sourceSystem:Q.sourceSystem,missing:{hoseDocumentUrl:!I?"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 z=Y.sn??Y.query;if(!z)throw Error("query or sn is required");let Q=await Kg1($,{query:z,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)=>W4($,X.id))),I=__0(Y.fields),K=J.map((X)=>zg1(X,I)),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:z,sourceDocumentSN:Y.sn,simulationBatchId:Y.batchId,latest:Y.latest??!1,total:Q.total,scanned:Q.scanned,matched:K.length,records:K,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:AT(J)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:L.object({batchId:L.string().describe("simulation batch ID"),query:L.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,Y)=>{let U=nl(await Og($,Y.batchId),Y.query);return{batchId:Y.batchId,count:U.length,records:U.map(fz),bridge:AT(U)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:L.object({mode:L.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:L.array(L.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:L.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:L.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:L.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:L.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:L.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:L.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:L.array(L.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:L.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:L.record(L.string(),L.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:L.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:L.record(L.string(),L.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,Y)=>{let U=Y.mode??"hosecloud",z=Y.signKey;if(U==="hosecloud"&&!z){if(z=(await Ng($)).find((K)=>K.signKey)?.signKey,!z)throw Error(" Line truncated
`)}function Fg1($){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??"",I=U.get(J)??[];I.push(Q),U.set(J,I)}let z=[...$.groupOrder??[],...[...U.keys()].filter((Q)=>!$.groupOrder?.includes(Q))];for(let Q of z){let J=U.get(Q);if(!J)continue;if(Q)Y.push(""),Y.push(`${Q}:`);for(let I of J)for(let K of I.usage)Y.push(` ${K}`)}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 r_0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let Y of s_0)for(let U of Y.commands)for(let z of U.usage)$.push(` ${z}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`)}var s_0;var ol=m(()=>{O8();s_0=[{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 Rq($){return $.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function x0($,Y={}){Hg1($,Y);let U=`${JSON.stringify($,null,2)}
`;if(Y.outputFile){Jg1(Y.outputFile,U),console.log(JSON.stringify({outputFile:Y.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function Hg1($,Y={}){if(Y.allowFull||Y.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>Gg1)throw new zP(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function a_0($,Y){if(Y)return;let U=$&&typeof $==="object"?$:{},z=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"),I=z??Q??0;if(I>Ig1||J>Kg1)throw new zP(`Rule list is large (${I} 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 E0($){return{allowFull:X0($.full)===!0,outputFile:h($.outputFile)??h($["output-file"])}}function t_0($=[]){console.log(r_0($))}var Ig1=100,Kg1=120000,s_0,Gg1=200000;var G4=m(()=>{A4();F$();dl();s_0=["code","status","strictness","scope","updatedAt"]});var ll={};B8(ll,{selectCorp:()=>j1,runToolResult:()=>O$,runTool:()=>k0,globalConfigSummary:()=>t2});function j1($){let Y=a8(),U=v4(),z=c2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},g3());return iA0(z.id),z}function t2($=v4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:Zz()}}async function k0($,Y,U,z,Q={}){x0(await O$($,Y,U,z),Q)}async function O$($,Y,U,z){let Q=Bq.find((K)=>K.name===$);if(!Q)throw Error(`Unknown Seal tool: ${$}`);let J=Object.fromEntries(Object.entries(z).filter(([,K])=>K!==void 0)),I=Q.handler;return I(Y,J,{corp:U})}var f4=m(()=>{k3();eB();Tq();G4()});import{existsSync as e_0}from"node:fs";async function $v0($,Y){if(!e_0($))throw Error(`File not found: ${$}`);let U=xz($);console.log(JSON.stringify(await kz(U.fileBuffer,U.fileName,Y),null,2))}async function ST($,Y,U,z,Q){if($==="ready"||$==="status"){let J=Y??h(Q.options.file)??h(Q.options.input),I=await OT(U,z,{filePath:J,webhook:h(Q.options.webhook)??h(Q.options.selector)});if(console.error(`[webhook-ready] 企业环境: ${I.corp.name} (${I.corp.id}) [${I.stateMode}]`),I.corp.tenant?.name)console.error(`[webhook-ready] 租户信息: ${I.corp.tenant.name} (${I.corp.tenant.id})`);console.error(`[webhook-ready] 凭证状态: ${I.authStatus==="ok"?"OK":`异常 (${I.authError})`}`),console.error(`[webhook-ready] Webhook 通道: ${I.activeWebhooks.length} 个可用`);for(let K of I.activeWebhooks){let G=K.isDefault?" [默认通道]":"";console.error(` - ${K.name} (${K.id}) mode=${K.mode}${G}`)}if(I.materialPack)console.error(`[webhook-ready] 材料包预检: ${I.materialPack.valid?`通过 (${I.materialPack.documentCount} 单)`:`失败 (${I.materialPack.errors?.join("; ")})`}`);if(I.ready)console.error(`\uD83D\uDFE2 ${I.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${I.nextAction}`);else console.error(`\uD83D\uDD34 准备阶段未通过: ${I.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${I.nextAction}`);console.log(JSON.stringify(I,null,2));return}if($==="replay"){let J=Y??h(Q.options.recordId)??h(Q.options["record-id"])??h(Q.options.id),I=h(Q.options.recordIds)??h(Q.options["record-ids"]),K=I?I.split(",").map((n)=>n.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((n)=>n.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&&!K&&!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 F=h(Q.options.sourceCorp)??h(Q.options["source-corp"])??h(Q.options.prodCorp)??h(Q.options["prod-corp"]),w=h(Q.options.targetCorp)??h(Q.options["target-corp"])??h(Q.options.testCorp)??h(Q.options["test-corp"]),O=X0(Q.options.force)===!0,{sourceCorp:M,targetCorp:N}=QP({sourceCorpId:F,targetCorpId:w,activeCorp:z,force:O},j1),D=M.id===z.id?U:await P1(M),P=N.id===z.id?U:await P1(N),T=h(Q.options.webhook)??h(Q.options.selector),A=h(Q.options.snSuffix)??h(Q.options["sn-suffix"]),j=h(Q.options.snPrefix)??h(Q.options["sn-prefix"]),C=h(Q.options.docIdSuffix)??h(Q.options["doc-id-suffix"]),b=h(Q.options.docIdPrefix)??h(Q.options["doc-id-prefix"]),k=X0(Q.options.dryRun)??X0(Q.options["dry-run"]),i=await UK({query:{recordId:J,recordIds:K,sn:G,sns:W,limit:X,status:Z,startDate:q,endDate:V},sourceClient:D,targetClient:P,sourceCorp:M,targetCorp:N,webhookSelector:T,snPrefix:j,snSuffix:A,docIdPrefix:b,docIdSuffix:C,dr Line truncated
`+`\uD83D\uDC49 查看全部请添加: seal-use corps list --all
`+"\uD83D\uDC49 检索指定企业请使用: seal-use corps search <keyword>")}x0(O.map((M)=>({id:M.id,name:M.name,environment:M.environment??"production",sourceType:M.source.type,provider:M.source.provider??M.source.type,staffId:M.source.staffId,testCorpId:M.testCorpId,prodCorpId:M.prodCorpId,current:M.id===H})));return}if($==="get"||$==="show"){let z=Y??h(U.options.corp);if(!z)throw m4("Usage: seal-use corps get <corpId>");let Q=j1(z),J=wp(Q.id),I=fg1(Q);x0({id:Q.id,name:Q.name,environment:Q.environment??"production",configFile:J,seal:{url:I,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:ug1(Q.source),relations:{testCorpId:Q.testCorpId,prodCorpId:Q.prodCorpId},auth:{refreshTtl:Q.auth.refreshTtl}});return}if($==="current"){let z=j1(h(U.options.corp));x0({id:z.id,name:z.name,environment:z.environment??"production",sourceType:z.source.type,provider:z.source.provider??z.source.type,staffId:z.source.staffId,testCorpId:z.testCorpId,prodCorpId:z.prodCorpId});return}if($==="mark"||$==="mark-test"||$==="mark-prod"){let z=Y??h(U.options.corp);if(!z)throw m4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");let Q=j1(z),J=$==="mark-test"?"test":$==="mark-prod"?"production":h(U.options.env)??h(U.options.environment);if(J!=="production"&&J!=="test")throw m4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");if(!(X0(U.options.confirm)===!0||X0(U.options.yes)===!0))throw A5(`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 K=y3(Q.id,{environment:J});x0({id:K.id,name:K.name,environment:K.environment,testCorpId:K.testCorpId,prodCorpId:K.prodCorpId});return}if($==="rename"){let z=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(!z||!Q)throw Error("Usage: seal-use corps rename <corpId> --name <newName>");let J=j1(z),I=y3(J.id,{name:Q});x0({success:!0,id:I.id,name:I.name,previousName:J.name});return}if($==="bind-test"){let z,Q;if(Y&&U.command[3])z=Y,Q=U.command[3];else if(Y){let X=h(U.options.corp),Z=h(U.options["test-corp"])??h(U.options.testCorp);if(X)z=X,Q=Y;else if(Z)z=Y,Q=Z}if(!z||!Q)throw m4(`Usage: seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let J=j1(z),I=j1(Q);if(J.id===I.id)throw m4(`Cannot bind enterprise '${J.id}' to itself.`);if(J.prodCorpId&&J.prodCorpId!==I.id)throw m4(`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(I.testCorpId&&I.testCorpId!==J.id)throw m4(`Cannot bind '${I.id}' as a test enterprise because it already has a bound test enterprise '${I.testCorpId}'. Multi-tier chaining is not permitted.`);let K=X0(U.options.force)===!0;if(J.testCorpId&&J.testCorpId!==I.id||I.prodCorpId&&I.prodCorpId!==J.id){if(!K)throw A5(`Enterprise binding conflict: production enterprise '${J.id}' is bound to '${J.testCorpId??"none"}', and test enterprise '${I.id}' is bound to '${I.prodCorpId??"none"}'. Overwriting an existing binding requires --force and --confirm.`,`seal-use corps bind-test ${J.id} ${I.id} --confirm --force`)}if(!(X0(U.options.confirm)===!0||X0(U.options.yes)===!0)){let X=K?" --force":"";throw A5(`Refusing to bind test enterprise '${I.name}' (${I.id}) to production enterprise '${J.name}' (${J.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${I.id}' as a test environment.`,`seal-use corps bind-test ${J.id} ${I.id} --confirm${X}`)}if(J.testCorpId&&J.testCorpId!==I.id)try{y3(J.testCorpId,{prodCorpId:void 0})}catch{}if(I.prodCorpId&&I.prodCorpId!==J.id)try{y3(I.prodCorpId,{testCorpId:void 0})}catch{}let H=y3(J.id,{environment:"production",testCorpId:I.id}),W=y3(I.id,{environment:"test",prodCorpId:J.id});x0({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}});return}if($==="unbind-test"){let z=Y??h(U.options.corp),Q=j1(z);if(!Q.testCorpId&&!Q.prodCorpId){x0({unbound:!1,message:`Enterprise '${Q.name}' (${Q.id}) does not have an active test enterprise binding.`});return}let J=Q.testCorpId?Q.id:Q.prodCorpId,I=Q.testCorpId?Q.testCorpId:Q.id;if(!(X0(U.options.confirm)===!0||X0(U.options.yes)===!0))throw A5(`Refusing to unbind production enterprise '${J}' and test enterprise '${I}' without --confirm.`,`seal-use corps unbind-test ${Q.id} --confirm`);y3(J,{testCorpId:void 0});try{y3(I,{prodCorpId:void 0})}catch{}x0({success:!0,unboundProduction:J,unboundTest:I});return}if($==="sync-test"){let z=Y??h(U.options.corp),Q=j1(z);if(!Q.testCorpId)throw m4(`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.`);let J=j1(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 I=await P1(Q),K=await P1(J),[G,H,W,X,Z,q,V,F]=await Promise.all([r1(I,Q.seal.endpoints.approvalStylePreferences),r1(K,J.seal.endpoints.approvalStylePreferences),X6(I),X6(K),c8(I),c8(K),gh0(I),gh0(K)]),w=(V.articles||[]).filter((G0)=>!G0.isDeleted),O=(F.articles||[]).filter((G0)=>!G0.isDeleted),M=new Map(O.map((G0)=>[G0.title.trim(),G0])),N=[],D=[],P=new Set(w.map((G0)=>G0.title.trim()));for(let G0 of w){let f0=G0.title.trim(),e0=M.get(f0);if(!e0)N.push(G0);else{let s=e0.content!==G0.content,H0=(e0.purpose??"")!==(G0.purpose??""),F0=e0.enabled!==G0.enabled,b0=e0.contentType!==G0.contentType,i0=(e0.status??"")!==(G0.status??""),n0=JSON.stringify([...e0.scenarios??[]].sort())!==JSON.stringify([...G0.scenarios??[]].sort()),w1=JSON.stringify([...e0.tags??[]].sort())!==JSON.stringify([...G0.tags??[]].sort());if(s||H0||F0||b0||i0||n0||w1)D.push({testId:e0.id,prodDoc:G0,reasons:[...s?["content"]:[],...H0?["purpose"]:[],...F0?["enabled"]:[],...b0?["contentType"]:[],...i0?["status"]:[],...n0?["scenarios"]:[],...w1?["tags"]:[]]})}}let T=O.filter((G0)=>!P.has(G0.title.trim())),j=[...Z].sort((G0,f0)=>f0.versionNumber-G0.versionNumber)[0],C=j?.versionNumber,k=([...q].sort((G0,f0)=>f0.versionNumber-G0.versionNumber)[0]?.versionNumber??0)+1,S=vh0(Q.name,C,q),n=h(U.options["version-name"])??h(U.options.versionName)??hh0(Q.name,C,S,k),z0={...H,tone:G.tone,language:G.language,detailLevel:G.detailLevel,outputFormat:G.outputFormat,examples:G.examples??[],prohibitedPhrases:G.prohibitedPhrases??[],customInstructions:G.customInstructions,decisionPreferences:G.decisionPreferences,thinkingDepthPreference:G.thinkingDepthPreference};if(X0(U.options["dry-run"])===!0||X0(U.options.dryRun)===!0){x0({dryRun:!0,source:{id:Q.id,name:Q.name,environment:Q.environment,latestPublishedVersion:j?{versionNumber:j.versionNumber,versionName:j.versionName}:null,documentsCount:w.length},target:{id:J.id,name:J.name,environment:J.environment},versionMappingPlan:{sourceProdVersionNumber:C??null,sourceProdVersionName:j?.versionName??null,targetTestExpectedVersionNumber:k,targetTestPublishVersionName:n,iteration:S},preferencesDiff:{decisionPreferences:{before:H.decisionPreferences,after:G.decisionPreferences},thinkingDepthPreference:{before:H.thinkingDepthPreference,after:G.thinkingDepthPreference}},rulesPlan:{sourceDraftRuleCount:W.rules.length,targetExistingDraftRuleCount:X.rules.length,toDeleteCount:X.rules.length,toCreateCount:W.rules.length,rulesToSync:W.rules.map((G0,f0)=>({index:f0+1,sourceRuleId:G0.id,sourceRuleCode:G0.code??f0+1,expectedTargetCode:`rule-${f0+1}`,description:G0.description,scope:G0.scope,strictness:G0.strictness}))},documentsPlan:{sourceDocumentCount:w.length,targetExistingDocumentCount:O.length,toCreateCount:N.length,toCreate:N.map((G0)=>({title:G0.title,purpose:G0.purpose,contentType:G0.contentType,scenarios:G0.scenarios})),toUpdateCount:D.length,toUpdate:D.map((G0)=>({targetDocumentId:G0.testId,title:G0.prodDoc.title,reasons:G0.reasons})),toDeleteCount:T.length,toDelete:T.map((G0)=>({targetDocumentId:G0.id,title:G0.title}))},publishingPlan:{targetCorpId:J.id,publishVersionName:n,publishTarget:"test"},hosecloudSyncPlan:(()=>{if(Q.source.type!=="hose")return{sourceType:Q.source.type,skipped:!0,reason:"prod source is not hose; no hosecloud credentials available"};let G0=(G.integrations??[]).filter((s)=>s.type==="hosecloud"),f0=new Set,e0=G0.filter((s)=>{let H0=s.corporationId??Q.id;if(f0.has(H0))return!1;return f0.add(H0),!0});return{sourceType:"hose",outboundName:xh0(Q.name),targetMode:"assisted",integrationsCount:e0.length,integrations:e0.map((s)=>({corporationId:s.corporationId,apiOrigin:s.apiOrigin,customApiUrl:s.customApiUrl}))}})(),productionGuarantees:{prodRulesStayDraft:!0,prodVersionPublished:!1}});return}if(!(X0(U.options.yes)===!0||X0(U.options.confirm)===!0))throw A5(`Refusing to overwrite test enterprise '${J.name}' (${J.id}) with preferences, ${W.rules.length} draft rules, and ${w.length} 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`);await s5(K,z0,J.seal.endpoints.approvalStylePreferences);let t=[];for(let G0 of T)await jw(K,G0.id),t.push({id:G0.id,title:G0.title});let e=[];for(let G0 of D)await Tw(K,G0.testId,{title:G0.prodDoc.title,purpose:G0.prodDoc.purpose,content:G0.prodDoc.content,contentType:G0.prodDoc.contentType,status:G0.prodDoc.status,enabled:G0.prodDoc.enabled,scenarios:G0.prodDoc.scenarios&&G0.prodDoc.scenarios.length>0?G0.prodDoc.scenarios:["audit"],tags:G0.prodDoc.tags}),e.push({id:G0.testId,title Line truncated
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=j1(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(!I&&!K)throw A5("Refusing to replay approval records without --confirm. Use --dry-run to preview the payload without sending it.",`seal-use corps replay-test ${z??"<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((S)=>S.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((S)=>S.trim()).filter(Boolean):void 0,F=s0(U.options.limit)??(!H&&!X&&!Z&&!V?1:void 0),w=h(U.options.status),O=h(U.options.startDate)??h(U.options["start-date"]),M=h(U.options.endDate)??h(U.options["end-date"]),N=await P1(Q),D=Q.id===G.id?N:await P1(G),P=h(U.options.webhook)??h(U.options.selector),T=h(U.options.snSuffix)??h(U.options["sn-suffix"]),A=h(U.options.snPrefix)??h(U.options["sn-prefix"]),j=h(U.options.docIdSuffix)??h(U.options["doc-id-suffix"]),C=h(U.options.docIdPrefix)??h(U.options["doc-id-prefix"]),b={recordId:H,recordIds:X,sn:Z,sns:V,limit:F,status:w,startDate:O,endDate:M};console.error(`[corps-replay-test] 正式企业「${Q.name}」(${Q.id}) -> 测试企业「${G.name}」(${G.id})`);let k=await UK({query:b,sourceClient:N,targetClient:D,sourceCorp:Q,targetCorp:G,webhookSelector:P,snPrefix:A,snSuffix:T,docIdPrefix:C,docIdSuffix:j,dryRun:I});if(I){console.error(`[corps-replay-test] 预览模式:已成功从 ${Q.name} 提取单据并转换为 Webhook Payload(未实际推送)。`),console.log(JSON.stringify(k,null,2));return}if(k.success)if(k.totalCount===1&&k.replayedDocument)console.error(`\uD83D\uDFE2 成功重放单据「${k.replayedDocument.documentSN}」至 ${G.name} (${k.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDFE2 成功重放 ${k.successCount} 条单据(来自「${Q.name}」)至「${G.name}」(${k.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDD34 单据重放部分或全部失败(成功 ${k.successCount} 条,失败 ${k.failureCount} 条)至「${G.name}」`);if(console.error(`\uD83D\uDC49 Next action: seal-use approval-runs list --corp ${G.id} --limit ${k.totalCount}`),console.log(JSON.stringify(k,null,2)),!k.success)throw new L4(`Approval record replay failed: ${k.failureCount} record(s) failed.`,1);return}if($==="switch"){let z=Y;if(!z)throw Error("Usage: seal-use corps switch <corpId>");let Q=v4();if(!Q.stateful)throw Error("Cannot switch the default enterprise while stateless mode is enabled. Use `seal-use config mode stateful` first.");let J=j1(z);qz({...Q,stateful:!0,defaultCorpId:J.id}),x0({current:!0,id:J.id,name:J.name});return}if($==="probe-hose"){await ig1(D8(U.json));return}if($==="hose-staffs"){await ng1(D8(U.json));return}if($==="add-hose-persistent"||$==="add-hose"){if($==="add-hose")console.error("⚠️ Notice: 'add-hose' is a compatibility alias; use 'add-hose-persistent' for durable Hose credentials.");let Q={...D8(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:X0(U.options.force)}:{},...U.options.overwrite!==void 0?{overwrite:X0(U.options.overwrite)}:{}};await qo(Q);return}if($==="add-hose-web-session"){let Q={...D8(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:X0(U.options.overwrite)}:{},...U.options["dry-run"]!==void 0?{dryRun:X0(U.options["dry-run"])}:{}};await pg1(Q);return}if($=== Line truncated
`}function Rq($){return $.replace(/([?&](?:accessToken|token|returnToken)=)[^&\s]+/gi,"$1<redacted>").replace(/(Bearer\s+)[A-Za-z0-9._~+/=-]+/gi,"$1<redacted>")}function y0($,Y={}){Dg1($,Y);let U=`${JSON.stringify($,null,2)}
`;if(Y.outputFile){wg1(Y.outputFile,U),console.log(JSON.stringify({outputFile:Y.outputFile,bytes:Buffer.byteLength(U,"utf-8")},null,2));return}console.log(U.trimEnd())}function Dg1($,Y={}){if(Y.allowFull||Y.outputFile)return;let U=Buffer.byteLength(JSON.stringify($),"utf-8");if(U>Ng1)throw new QP(`Output is large (${U} bytes). Use --summary, --fields, --count, or --output-file; pass --full only when you really need the full response.`)}function $v0($,Y){if(Y)return;let U=$&&typeof $==="object"?$:{},z=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"),I=z??Q??0;if(I>Og1||J>Mg1)throw new QP(`Rule list is large (${I} 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 E0($){return{allowFull:H0($.full)===!0,outputFile:h($.outputFile)??h($["output-file"])}}function Yv0($=[]){console.log(t_0($))}var Og1=100,Mg1=120000,e_0,Ng1=200000;var l1=m(()=>{q4();O8();ol();e_0=["code","status","strictness","scope","updatedAt"]});var sl={};P8(sl,{selectCorp:()=>M1,runToolResult:()=>O$,runTool:()=>x0,globalConfigSummary:()=>t2});function M1($){let Y=t8(),U=h4(),z=c2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$},x3());return dB0(z.id),z}function t2($=h4()){return{mode:$.stateful?"stateful":"stateless",stateful:$.stateful,...$.stateful&&$.defaultCorpId?{defaultCorpId:$.defaultCorpId}:{},...$.testEnterprisesDir?{testEnterprisesDir:$.testEnterprisesDir}:{},lint:$.lint,configFile:Zz()}}async function x0($,Y,U,z,Q={}){y0(await O$($,Y,U,z),Q)}async function O$($,Y,U,z){let Q=Aq.find((K)=>K.name===$);if(!Q)throw Error(`Unknown Seal tool: ${$}`);let J=Object.fromEntries(Object.entries(z).filter(([,K])=>K!==void 0)),I=Q.handler;return I(Y,J,{corp:U})}var N4=m(()=>{P5();$P();Tq();l1()});import{existsSync as Uv0}from"node:fs";async function zv0($,Y){if(!Uv0($))throw Error(`File not found: ${$}`);let U=xz($);console.log(JSON.stringify(await kz(U.fileBuffer,U.fileName,Y),null,2))}async function gT($,Y,U,z,Q){if($==="ready"||$==="status"){let J=Y??h(Q.options.file)??h(Q.options.input),I=await OT(U,z,{filePath:J,webhook:h(Q.options.webhook)??h(Q.options.selector)});if(console.error(`[webhook-ready] 企业环境: ${I.corp.name} (${I.corp.id}) [${I.stateMode}]`),I.corp.tenant?.name)console.error(`[webhook-ready] 租户信息: ${I.corp.tenant.name} (${I.corp.tenant.id})`);console.error(`[webhook-ready] 凭证状态: ${I.authStatus==="ok"?"OK":`异常 (${I.authError})`}`),console.error(`[webhook-ready] Webhook 通道: ${I.activeWebhooks.length} 个可用`);for(let K of I.activeWebhooks){let G=K.isDefault?" [默认通道]":"";console.error(` - ${K.name} (${K.id}) mode=${K.mode}${G}`)}if(I.materialPack)console.error(`[webhook-ready] 材料包预检: ${I.materialPack.valid?`通过 (${I.materialPack.documentCount} 单)`:`失败 (${I.materialPack.errors?.join("; ")})`}`);if(I.ready)console.error(`\uD83D\uDFE2 ${I.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${I.nextAction}`);else console.error(`\uD83D\uDD34 准备阶段未通过: ${I.statusMessage}`),console.error(`\uD83D\uDC49 Next action: ${I.nextAction}`);console.log(JSON.stringify(I,null,2));return}if($==="replay"){let J=Y??h(Q.options.recordId)??h(Q.options["record-id"])??h(Q.options.id),I=h(Q.options.recordIds)??h(Q.options["record-ids"]),K=I?I.split(",").map((n)=>n.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((n)=>n.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&&!K&&!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 F=h(Q.options.sourceCorp)??h(Q.options["source-corp"])??h(Q.options.prodCorp)??h(Q.options["prod-corp"]),O=h(Q.options.targetCorp)??h(Q.options["target-corp"])??h(Q.options.testCorp)??h(Q.options["test-corp"]),w=H0(Q.options.force)===!0,{sourceCorp:N,targetCorp:M}=JP({sourceCorpId:F,targetCorpId:O,activeCorp:z,force:w},M1),D=N.id===z.id?U:await T1(N),P=M.id===z.id?U:await T1(M),T=h(Q.options.webhook)??h(Q.options.selector),B=h(Q.options.snSuffix)??h(Q.options["sn-suffix"]),j=h(Q.options.snPrefix)??h(Q.options["sn-prefix"]),C=h(Q.options.docIdSuffix)??h(Q.options["doc-id-suffix"]),b=h(Q.options.docIdPrefix)??h(Q.options["doc-id-prefix"]),k=H0(Q.options.dryRun)??H0(Q.options["dry-run"]),i=await UK({query:{recordId:J,recordIds:K,sn:G,sns:W,limit:X,status:Z,startDate:q,endDate:V},sourceClient:D,targetClient:P,sourceCorp:N,targetCorp:M,webhookSelector:T,snPrefix:j,snSuffix:B,docIdPrefix:b,docIdSuffix:C,dr Line truncated
or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]`);let J=M1(z),I=M1(Q);if(J.id===I.id)throw S4(`Cannot bind enterprise '${J.id}' to itself.`);if(J.prodCorpId&&J.prodCorpId!==I.id)throw S4(`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(I.testCorpId&&I.testCorpId!==J.id)throw S4(`Cannot bind '${I.id}' as a test enterprise because it already has a bound test enterprise '${I.testCorpId}'. Multi-tier chaining is not permitted.`);let K=H0(U.options.force)===!0;if(J.testCorpId&&J.testCorpId!==I.id||I.prodCorpId&&I.prodCorpId!==J.id){if(!K)throw w$(`Enterprise binding conflict: production enterprise '${J.id}' is bound to '${J.testCorpId??"none"}', and test enterprise '${I.id}' is bound to '${I.prodCorpId??"none"}'. Overwriting an existing binding requires --force and --confirm.`,`seal-use corps bind-test ${J.id} ${I.id} --confirm --force`)}if(!(H0(U.options.confirm)===!0||H0(U.options.yes)===!0)){let X=K?" --force":"";throw w$(`Refusing to bind test enterprise '${I.name}' (${I.id}) to production enterprise '${J.name}' (${J.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${I.id}' as a test environment.`,`seal-use corps bind-test ${J.id} ${I.id} --confirm${X}`)}if(J.testCorpId&&J.testCorpId!==I.id)try{j9(J.testCorpId,{prodCorpId:void 0})}catch{}if(I.prodCorpId&&I.prodCorpId!==J.id)try{j9(I.prodCorpId,{testCorpId:void 0})}catch{}let H=j9(J.id,{environment:"production",testCorpId:I.id}),W=j9(I.id,{environment:"test",prodCorpId:J.id});return y0({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 z=Y??h(U.options.corp),Q=M1(z);if(!Q.testCorpId&&!Q.prodCorpId)return y0({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,I=Q.testCorpId?Q.testCorpId:Q.id;if(!(H0(U.options.confirm)===!0||H0(U.options.yes)===!0))throw w$(`Refusing to unbind production enterprise '${J}' and test enterprise '${I}' without --confirm.`,`seal-use corps unbind-test ${Q.id} --confirm`);j9(J,{testCorpId:void 0});try{j9(I,{prodCorpId:void 0})}catch{}return y0({success:!0,unboundProduction:J,unboundTest:I}),!0}return!1}var Hv0=m(()=>{P5();N4();O8();q4();l1()});function yT($){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(Wv0))throw Error(`Invalid Seal delegate link: expected host ending in ${Wv0}, got ${U}`);let z=Y.pathname.replace(/\/+$/,"");if(z!==Xv0)throw Error(`Invalid Seal delegate link: expected path ${Xv0}, got ${z}`);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 Zv0($){let Y=typeof $==="string"?yT($):$;return(await A6(Y.sealUrl,void 0).post("api/v1/delegation/preview",{json:{token:Y.delegateToken}}).json()).data}async function qv0($){let Y=typeof $==="string"?yT($):$,U=Y.sealUrl,z=A6(U,void 0),Q=await z.post("api/v1/delegation/consume",{json:{token:Y.delegateToken}}),J=Q.headers.get("set-cookie")??"",I=typeof Q.headers.getSetCookie==="function"?Q.headers.getSetCookie():[J],K="";for(let O of I)if(O&&O.includes("session_token=")){K=(O.split(";")[0]??"").trim();break}let G;try{G=await z.get("api/auth/get-session",{headers:K?{cookie:K}:{}}).json()}catch{}let H=G?.session?.token;if(!H&&K){let O=K.match(/session_token=([^.;]+)/);if(O?.[1])H=decodeURIComponent(O[1])}if(!H)throw Error("Seal delegate exchange did not return a session token");let W=86400;if(G?.session?.expiresAt){let O=new Date(G.session.expiresAt).getTime();if(Number.isFinite(O)){let w=Math.floor((O-Date.now())/1000);if(w>0)W=w}}let Z=await A6(U,H).get("api/v1/auth/me").json(),q=Z.data&&typeof Z.data==="object"?Z.data:Z,V=q.user??G?.user??{},F=q.tenant??{};return{sealUrl:U,token:H,expiresIn:W,user:V,tenant:F}}function tl($){let Y=[],U=0,z="";try{let I=new URL($.trim()),K=I.hostname.toLowerCase(),G=I.pathname.replace(/\/+$/,"");if(K.endsWith(".ekuaibao.com")||K.endsWith(".hosecloud.com")||K==="ekuaibao.com"||K==="hosecloud.com")U+=40,z="host is Hose domain";if(G==="/web/thirdparty.html")U+=40,z+="; path is /web/thirdparty.html";if(I.searchParams.has("accessToken"))U+=10,z+="; has accessToken";if(I.searchParams.has("ekbCorpId"))U+=10,z+="; has ekbCorpId"}catch{U=0}if(U>0)Y.push({kind:"hose",score:U,reason:z});let Q=0,J="";try{let I=new URL($.trim()),K=I.hostname.toLowerCase(),G=I.pathname.replace(/\/+$/,"");if(K.endsWith(".sealai.cc"))Q+=40,J="host ends with .sealai.cc";if(G==="/delegate")Q+=40,J+="; path is /delegate";if( Line truncated
`);throw Error(`Missing required parameter: staffId. 当前企业共配置了 ${C.length} 位管理员账号(手机号已脱敏):
`+`${b}
${b}
`+`\uD83D\uDC49 请指定要作为审计身份绑定的管理员:
`+` • 按姓名选择:追加 --staffName <姓名>(支持关键字,如: --staffName 谢子豪)
`+` • 按手机选择:追加 --staffPhone <手机号>(支持手机后4位,如: --staffPhone 5678)
`+" • 或传 force:true / --force 自动使用默认首位管理员。")}else F=C.find((b)=>b.active)?.id??C[0]?.id}}if(!F)if(!W&&J)F=J;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");let w=p1($,"id")??Z,O=Y??q??Z,M=p1($,"sealUrl")??`https://${Z.toLowerCase()}.sealai.cc`,N={id:w,name:O,environment:"production",seal:{url:M,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",domain:X,appKey:U,appSecurity:z,corpId:Z,staffId:F},auth:{refreshTtl:300}};if(W){Kw(w);let T=await iK(N);if((!Y||Y===Z)&&T.tenantName&&T.tenantName!==Z)O=T.tenantName,N.name=T.tenantName}let D=tB();Wo(D,{recursive:!0,mode:448});let P=Zo(D,`${Eq(w)}.json`);if(Ho(P)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${P}。如需覆盖已有配置,请在命令行追加 --overwrite 或在 JSON 参数中添加 "overwrite": true。`);Xo(P,`${JSON.stringify(N,null,2)}
`,{mode:384}),x0({id:w,name:O,corpId:Z,domain:X,staffId:F,verified:W,path:P})}async function cg1($){let Y=l3($,"token"),U=(p1($,"sealUrl")??p1($,"url")??"").replace(/\/+$/,"");if(!U)throw Error("Missing required JSON field: sealUrl");let z=RT($,"expiresIn")??2592000,Q=$.force===!0||$.verify===!1?!1:!0,J=fh0($),I=Q?await og1(U,Y,A6(J)):void 0;bh0($,{token:Y,sealUrl:U,expiresIn:z,verify:Q,remote:I,custom:J})}async function pg1($){let Y=CT($,["accessToken","accesstoken"]),U=CT($,["corpId","ekbCorpId","corporationId"]),z=p1($,"baseUrl")??p1($,"domain"),Q=p1($,"staffId"),J=await qw({corpId:U,accessToken:Y,baseUrl:z}),I=await RH({corpId:U,accessToken:Y,baseUrl:z}),K=B6(I.sealUrl,I.token),G=await X8(K),H={user:G.user,tenant:G.tenant};if(_H(I.corpId,H.tenant),$.dryRun===!0){x0({dryRun:!0,kind:"hose-web-session",corpId:I.corpId,sealUrl:I.sealUrl,tenant:H.tenant,user:H.user,staffId:Q??J.staffId,expiresIn:I.expiresIn});return}ih0({id:I.corpId,corpId:I.corpId,name:p1($,"name")??J.corpName,provider:"hosecloud",domain:J.baseUrl,closeToken:Y,expiresIn:RT($,"expiresIn"),expiresAt:p1($,"expiresAt"),staffId:Q??J.staffId,sealUrl:I.sealUrl,remote:H,overwrite:$.overwrite===!0})}function fh0($){return{headers:qp.parse($.headers),cookies:Vp.parse($.cookies)}}async function dg1($,Y,U,z=!1){let J=rl($)[0];if(!J||J.score<50)throw Error(`Unrecognized assistance/delegate link. Expected either a Seal native delegate link (https://<tenant>.sealai.cc/delegate?token=...) or a Hose assistance link (https://<corp>.ekuaibao.com/web/thirdparty.html?accessToken=...&ekbCorpId=...). Top score: ${J?J.kind+"="+J.score:"none"}.`);if(J.kind==="seal-delegate"){if(z){let O=await Kv0($),M=gT($);x0({dryRun:!0,kind:"seal-delegate",sealUrl:M.sealUrl,tenant:{id:O.tenantId,name:O.tenantName},user:{id:O.userId,name:O.userName},delegationId:O.delegationId});return}console.error(`ℹ️ [Seal 委托链接] 识别为 Seal 原生委托链接 (${J.reason}),正在交换临时会话...`);let Z=await Gv0($),q={user:Z.user,tenant:Z.tenant},V=typeof Z.tenant.tenantSlug==="string"&&Z.tenant.tenantSlug||void 0,F=typeof Z.tenant.id==="string"&&Z.tenant.id||void 0,w=V??F??"seal-delegate";bh0({id:w,corpId:w,name:Y,provider:"seal",overwrite:U},{token:Z.token,sealUrl:Z.sealUrl,expiresIn:Z.expiresIn,verify:!0,remote:q});return}let I=Gw($),K=await qw(I),G=await RH(I),H=B6(G.sealUrl,G.token),W=await X8(H),X={user:W.user,tenant:W.tenant};if(_H(G.corpId,X.tenant),z){x0({dryRun:!0,kind:"hose",corpId:G.corpId,sealUrl:G.sealUrl,tenant:X.tenant,user:X.user,staffId:K.staffId});return}ih0({id:G.corpId,corpId:G.corpId,name:Y??K.corpName,provider:"hosecloud",domain:K.baseUrl,closeToken:I.accessToken,staffId:K.staffId,sealUrl:G.sealUrl,remote:X,overwrite:U})}function uh0($,Y,U,z){if($.length===0)throw Error(`[合思子域提权] 未能从协助链接中提取到合思企业 [${Y}] 的 OpenAPI 密钥凭据。
`+" • 或传 force:true / --force 自动使用默认首位管理员。")}else F=C.find((b)=>b.active)?.id??C[0]?.id}}if(!F)if(!W&&J)F=J;else throw Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");let O=d1($,"id")??Z,w=Y??q??Z,N=d1($,"sealUrl")??`https://${Z.toLowerCase()}.sealai.cc`,M={id:O,name:w,environment:"production",seal:{url:N,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",domain:X,appKey:U,appSecurity:z,corpId:Z,staffId:F},auth:{refreshTtl:300}};if(W){GO(O);let T=await uK(M);if((!Y||Y===Z)&&T.tenantName&&T.tenantName!==Z)w=T.tenantName,M.name=T.tenantName}let D=eA();$o(D,{recursive:!0,mode:448});let P=Uo(D,`${Eq(O)}.json`);if(el(P)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${P}。如需覆盖已有配置,请在命令行追加 --overwrite 或在 JSON 参数中添加 "overwrite": true。`);Yo(P,`${JSON.stringify(M,null,2)}
`,{mode:384}),y0({id:O,name:w,corpId:Z,domain:X,staffId:F,verified:W,path:P})}async function Pg1($){let Y=o3($,"token"),U=(d1($,"sealUrl")??d1($,"url")??"").replace(/\/+$/,"");if(!U)throw Error("Missing required JSON field: sealUrl");let z=_T($,"expiresIn")??2592000,Q=$.force===!0||$.verify===!1?!1:!0,J=Nv0($),I=Q?await Cg1(U,Y,B6(J)):void 0;Bv0($,{token:Y,sealUrl:U,expiresIn:z,verify:Q,remote:I,custom:J})}async function Tg1($){let Y=RT($,["accessToken","accesstoken"]),U=RT($,["corpId","ekbCorpId","corporationId"]),z=d1($,"baseUrl")??d1($,"domain"),Q=d1($,"staffId"),J=await VO({corpId:U,accessToken:Y,baseUrl:z}),I=await RH({corpId:U,accessToken:Y,baseUrl:z}),K=await X8(A6(I.sealUrl,I.token)),G={user:K.user,tenant:K.tenant};if(_H(I.corpId,G.tenant),$.dryRun===!0){y0({dryRun:!0,kind:"hose-web-session",corpId:I.corpId,sealUrl:I.sealUrl,tenant:G.tenant,user:G.user,staffId:Q??J.staffId,expiresIn:I.expiresIn});return}Av0({id:I.corpId,corpId:I.corpId,name:d1($,"name")??J.corpName,provider:"hosecloud",domain:J.baseUrl,closeToken:Y,expiresIn:_T($,"expiresIn"),expiresAt:d1($,"expiresAt"),staffId:Q??J.staffId,sealUrl:I.sealUrl,remote:G,overwrite:$.overwrite===!0})}function Nv0($){return{headers:Fd.parse($.headers),cookies:wd.parse($.cookies)}}async function jg1($,Y,U,z=!1){let Q=tl($)[0];if(!Q||Q.score<50)throw Error(`Unrecognized assistance/delegate link. Expected either a Seal native delegate link (https://<tenant>.sealai.cc/delegate?token=...) or a Hose assistance link (https://<corp>.ekuaibao.com/web/thirdparty.html?accessToken=...&ekbCorpId=...). Top score: ${Q?Q.kind+"="+Q.score:"none"}.`);if(Q.kind==="seal-delegate"){if(z){let F=await Zv0($),O=yT($);y0({dryRun:!0,kind:"seal-delegate",sealUrl:O.sealUrl,tenant:{id:F.tenantId,name:F.tenantName},user:{id:F.userId,name:F.userName},delegationId:F.delegationId});return}console.error(`ℹ️ [Seal 委托链接] 识别为 Seal 原生委托链接 (${Q.reason}),正在交换临时会话...`);let W=await qv0($),X={user:W.user,tenant:W.tenant},Z=typeof W.tenant.tenantSlug==="string"&&W.tenant.tenantSlug?W.tenant.tenantSlug:void 0,q=typeof W.tenant.id==="string"&&W.tenant.id?W.tenant.id:void 0,V=Z??q??"seal-delegate";Bv0({id:V,corpId:V,name:Y,provider:"seal",overwrite:U},{token:W.token,sealUrl:W.sealUrl,expiresIn:W.expiresIn,verify:!0,remote:X});return}let J=HO($),I=await VO(J),K=await RH(J),G=await X8(A6(K.sealUrl,K.token)),H={user:G.user,tenant:G.tenant};if(_H(K.corpId,H.tenant),z){y0({dryRun:!0,kind:"hose",corpId:K.corpId,sealUrl:K.sealUrl,tenant:H.tenant,user:H.user,staffId:I.staffId});return}Av0({id:K.corpId,corpId:K.corpId,name:Y??I.corpName,provider:"hosecloud",domain:I.baseUrl,closeToken:J.accessToken,staffId:I.staffId,sealUrl:K.sealUrl,remote:H,overwrite:U})}function Dv0($,Y,U,z){if($.length===0)throw Error(`[合思子域提权] 未能从协助链接中提取到合思企业 [${Y}] 的 OpenAPI 密钥凭据。
`+"\uD83D\uDCA1 说明:此能力专属于合思 (Hose) 子域,用于将临时会话提权为标准 OpenAPI 开发者接入。需要企业管理员已在合思开放平台创建应用并生成 appKey/appSecurity。");if(U.keyId||U.appKey){let Q=$.find((J)=>U.keyId&&J.id===U.keyId||U.appKey&&J.appKey===U.appKey);if(!Q){console.error(`
❌ 未找到指定的合思 OpenAPI 密钥 (${U.appKey??U.keyId})。`),console.error(`ℹ️ 该合思企业当前存在以下 ${$.length} 套候选密钥:`);for(let J of $){let I=J.active?"\uD83D\uDFE2 启用":"⚪ 停用";console.error(` • "${J.name||"未命名应用"}" (appKey: ${J.appKey}, keyId: ${J.id}, 状态: ${I})`)}throw new L4("指定的合思密钥不存在,请从上述候选列表中选择正确的 appKey 或 keyId。",2,`${z} --app-key ${$[0].appKey}`)}return Q}if($.length===1)return $[0];console.error(`
ℹ️ [合思子域提权] 合思企业 [${Y}] 存在多套 (${$.length} 套) OpenAPI 应用密钥凭据:`);for(let Q=0;Q<$.length;Q++){let J=$[Q],I=J.active?"\uD83D\uDFE2 启用":"⚪ 停用",K=J.name||"未命名应用";console.error(` [${Q+1}] "${K}" (appKey: ${J.appKey}, keyId: ${J.id}, 状态: ${I})`)}throw console.error(`
❌ 未找到指定的合思 OpenAPI 密钥 (${U.appKey??U.keyId})。`),console.error(`ℹ️ 该合思企业当前存在以下 ${$.length} 套候选密钥:`);for(let J of $)console.error(` • "${J.name||"未命名应用"}" (appKey: ${J.appKey}, keyId: ${J.id}, 状态: ${J.active?"\uD83D\uDFE2 启用":"⚪ 停用"})`);throw new X4("指定的合思密钥不存在,请从上述候选列表中选择正确的 appKey 或 keyId。",2,`${z} --app-key ${$[0].appKey}`)}return Q}if($.length===1)return $[0];console.error(`
ℹ️ [合思子域提权] 合思企业 [${Y}] 存在多套 (${$.length} 套) OpenAPI 应用密钥凭据:`);for(let Q=0;Q<$.length;Q++){let J=$[Q];console.error(` [${Q+1}] "${J.name||"未命名应用"}" (appKey: ${J.appKey}, keyId: ${J.id}, 状态: ${J.active?"\uD83D\uDFE2 启用":"⚪ 停用"})`)}throw console.error(`
\uD83D\uDC49 为确保权限提权绑定正确的业务应用,请显式指定要使用的密钥套件:`),console.error(` 在命令后追加 --app-key <key> 或 --key-id <id> 参数。
`),new L4(`合思企业 [${Y}] 存在多套 OpenAPI 密钥,必须指定 --app-key 或 --key-id 明确选择要绑定的密钥。`,2,`${z} --app-key ${$[0].appKey}`)}async function mg1($,Y,U,z=!1,Q=!1,J){console.error("ℹ️ [合思子域提权] 正在通过合思协助链接提取 OpenAPI 开发者密钥并提升企业权限等级...");let I=await tS($),K=uh0(I.keys,I.corpId,J??{},'seal-use corps add-link "<url>" --elevate-hose');if(console.error(Q?`ℹ️ [合思子域提权] 已选定合思 OpenAPI 凭据 (appKey: ${K.appKey}, 应用: "${K.name||"未命名应用"}"),正在生成预览...`:`ℹ️ [合思子域提权] 已选定合思 OpenAPI 凭据 (appKey: ${K.appKey}, 应用: "${K.name||"未命名应用"}"),正在初始化为长期合思标准配置...`),Q){x0({dryRun:!0,kind:"hose",provider:"hose",corpId:I.corpId,corpName:I.corpName,baseUrl:I.baseUrl,staffId:I.staffId,selectedKey:{id:K.id,name:K.name||"-",appKey:K.appKey,appSecurity:Zw(K.appSecurity),active:K.active}});return}await qo({domain:I.baseUrl,appKey:K.appKey,appSecurity:K.appSecurity,corpId:I.corpId,name:Y??I.corpName,staffId:I.staffId,overwrite:U,force:z})}async function pT($,Y){let U=await tS($),z=Y.reveal===!0;if(Y.save){let Q=uh0(U.keys,U.corpId,{appKey:Y.appKey,keyId:Y.keyId},'seal-use corps hose-extract-keys "<url>" --save');console.error(`ℹ️ [合思子域提权] 正在将选定的合思 OpenAPI 密钥 (appKey: ${Q.appKey}, 应用: "${Q.name||"未命名应用"}") 保存为标准合思企业配置...`),await qo({domain:U.baseUrl,appKey:Q.appKey,appSecurity:Q.appSecurity,corpId:U.corpId,name:Y.name??U.corpName,staffId:U.staffId,overwrite:Y.overwrite,force:Y.force});return}if(!z)console.error(`ℹ️ [合思子域提权] 成功提取合思 (Hose) OpenAPI 密钥。接入密码默认脱敏,附加 --reveal (或 -r) 可查看完整 appSecurity 明文;附加 --save 可将临时会话提权并持久化为标准合思企业。
`),new X4(`合思企业 [${Y}] 存在多套 OpenAPI 密钥,必须指定 --app-key 或 --key-id 明确选择要绑定的密钥。`,2,`${z} --app-key ${$[0].appKey}`)}async function Eg1($,Y,U,z=!1,Q=!1,J){console.error("ℹ️ [合思子域提权] 正在通过合思协助链接提取 OpenAPI 开发者密钥并提升企业权限等级...");let I=await Yg($),K=Dv0(I.keys,I.corpId,J??{},'seal-use corps add-link "<url>" --elevate-hose');if(console.error(Q?`ℹ️ [合思子域提权] 已选定合思 OpenAPI 凭据 (appKey: ${K.appKey}, 应用: "${K.name||"未命名应用"}"),正在生成预览...`:`ℹ️ [合思子域提权] 已选定合思 OpenAPI 凭据 (appKey: ${K.appKey}, 应用: "${K.name||"未命名应用"}"),正在初始化为长期合思标准配置...`),Q){y0({dryRun:!0,kind:"hose",provider:"hose",corpId:I.corpId,corpName:I.corpName,baseUrl:I.baseUrl,staffId:I.staffId,selectedKey:{id:K.id,name:K.name||"-",appKey:K.appKey,appSecurity:qO(K.appSecurity),active:K.active}});return}await zo({domain:I.baseUrl,appKey:K.appKey,appSecurity:K.appSecurity,corpId:I.corpId,name:Y??I.corpName,staffId:I.staffId,overwrite:U,force:z})}async function _q($,Y){let U=await Yg($),z=Y.reveal===!0;if(Y.save){let Q=Dv0(U.keys,U.corpId,{appKey:Y.appKey,keyId:Y.keyId},'seal-use corps hose-extract-keys "<url>" --save');console.error(`ℹ️ [合思子域提权] 正在将选定的合思 OpenAPI 密钥 (appKey: ${Q.appKey}, 应用: "${Q.name||"未命名应用"}") 保存为标准合思企业配置...`),await zo({domain:U.baseUrl,appKey:Q.appKey,appSecurity:Q.appSecurity,corpId:U.corpId,name:Y.name??U.corpName,staffId:U.staffId,overwrite:Y.overwrite,force:Y.force});return}if(!z)console.error(`ℹ️ [合思子域提权] 成功提取合思 (Hose) OpenAPI 密钥。接入密码默认脱敏,附加 --reveal (或 -r) 可查看完整 appSecurity 明文;附加 --save 可将临时会话提权并持久化为标准合思企业。
`);else console.error(`⚠️ [合思子域提权] 正在以明文展示合思 (Hose) appSecurity 接入密码,请妥善保管敏感凭据。
`);x0({provider:"hose",capability:"privilege-elevation",corpId:U.corpId,corpName:U.corpName??U.corpId,baseUrl:U.baseUrl,staffId:U.staffId,keyCount:U.keys.length,keys:U.keys.map((Q)=>({id:Q.id,name:Q.name||"-",appKey:Q.appKey,appSecurity:z?Q.appSecurity:Zw(Q.appSecurity),active:Q.active,createTime:Q.createTime,updateTime:Q.updateTime}))})}async function Vo($,Y){let U=j1($),z=Y.reveal===!0;if(U.source.type!=="hose")throw new L4(`【合思子域专享能力】当前企业「${U.name}」(id: ${U.id}) 为原生 Seal (${U.source.type}) 租户,非合思 (Hose/合思云/易快报) 渠道企业。
`);y0({provider:"hose",capability:"privilege-elevation",corpId:U.corpId,corpName:U.corpName??U.corpId,baseUrl:U.baseUrl,staffId:U.staffId,keyCount:U.keys.length,keys:U.keys.map((Q)=>({id:Q.id,name:Q.name||"-",appKey:Q.appKey,appSecurity:z?Q.appSecurity:qO(Q.appSecurity),active:Q.active,createTime:Q.createTime,updateTime:Q.updateTime}))})}async function uT($,Y){let U=M1($),z=Y.reveal===!0;if(U.source.type!=="hose")throw new X4(`【合思子域专享能力】当前企业「${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(!z)console.error(`\uD83D\uDCA1 [合思子域] 接入密码默认脱敏,附加 --reveal (或 -r) 可查看完整 appSecurity 明文。
`);else console.error(`⚠️ [合思子域] 正在以明文展示合思 appSecurity 接入密码,请妥善保管敏感凭据。
`);x0({provider:"hose",capability:"privilege-elevation",corpId:U.id,corpName:U.name,domain:U.source.domain,staffId:U.source.staffId,appKey:Q??"-",appSecurity:J?z?J:Zw(J):"-",active:!0})}function bh0($,Y){let{token:U,sealUrl:z,expiresIn:Q,verify:J,remote:I}=Y,K=Y.expiresAt??lg1(Date.now()+Q*1000),G=Y.custom??fh0($),H=I?.user,W=I?.tenant,X=p1($,"tenantSlug")??C5(W?.tenantSlug),Z=p1($,"tenantId")??C5(W?.id),q=p1($,"tenantName")??C5(W?.name),V=p1($,"id")??X??Z;if(!V)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let F=p1($,"staffId")??C5(H?.providerUserId)??C5(H?.id)??"seal",w=p1($,"provider")??C5(H?.provider)??C5(W?.providerConfig?.provider),O=p1($,"corpId")??X??Z??V,M={id:V,name:p1($,"name")??q??V,environment:"production",seal:{url:z,tenantSlug:X,headers:G.headers,cookies:G.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:U,sealUrl:z,expiresIn:Q,expiresAt:K,staffId:F,corpId:O,tenantId:Z,tenantSlug:X,tenantName:q,providerUserId:C5(H?.providerUserId),provider:w},auth:{refreshTtl:300}},N=tB();Wo(N,{recursive:!0,mode:448});let D=Zo(N,`${Eq(V)}.json`);if(Ho(D)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${D}. Pass "overwrite": true to replace it.`);Xo(D,`${JSON.stringify(M,null,2)}
`,{mode:384}),x0({id:V,name:M.name,tenantId:Z,tenantSlug:X,verified:J,path:D})}function ih0($){let Y=$.remote.tenant,U=C5(Y.tenantSlug)??$.corpId,z=C5(Y.id),Q=C5(Y.name),J={id:$.id,name:$.name??Q??$.id,environment:"production",seal:{url:$.sealUrl,tenantSlug:U,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",provider:$.provider,domain:$.domain,closeToken:$.closeToken,...$.expiresIn!==void 0?{expiresIn:$.expiresIn}:{},...$.expiresAt?{expiresAt:$.expiresAt}:{},staffId:$.staffId,corpId:$.corpId,sealUrl:$.sealUrl},auth:{refreshTtl:300}},I=tB();Wo(I,{recursive:!0,mode:448});let K=Zo(I,`${Eq($.id)}.json`);if(Ho(K)&&!$.overwrite)throw Error(`Enterprise config already exists: ${K}. Pass "overwrite": true to replace it.`);Xo(K,`${JSON.stringify(J,null,2)}
`,{mode:384}),x0({id:J.id,name:J.name,tenantId:z,tenantSlug:U,sourceType:"hose",credentialMode:"web-session",verified:!0,path:K})}function lg1($){return new Date($).toISOString().replace(/\.\d{3}Z$/,"Z")}async function og1($,Y,U={}){let z=B6($,Y,U),Q=await X8(z);return{user:Q.user??{},tenant:Q.tenant??{}}}function C5($){return typeof $==="string"&&$?$:void 0}var Lo=m(()=>{y7();Hv0();CH();i8();k3();Th0();eB();Fp();P6();P6();Go();Pp();bZ();cT();f4();F$();A4();G4()});var ph0={};B8(ph0,{handleAuthExtractKeysCommand:()=>wo,handleAuthCommand:()=>mT,formatBeijingIso:()=>Oo});async function wo($,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 z=X0(Y.options.reveal)===!0||X0(Y.options.r)===!0||X0(Y.options.plain)===!0,Q=X0(Y.options.save)===!0||X0(Y.options.add)===!0;await pT(U,{reveal:z,save:Q,name:h(Y.options.name),overwrite:X0(Y.options.overwrite)===!0,force:X0(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 mT($,Y,U){if($==="check"||$==="diagnose"||$==="status"||$==="test"||$==="doctor"){x0(await rg1(Y));return}if($==="seal-link"||$==="link"||$==="hose-link"&&Y?.source?.type==="seal"){let z=U.command[2]?.toLowerCase(),Q=h(U.options["from-link"])??(z==="from-link"?U.command[3]:void 0);if(Q){let X=h(U.options.note),Z=await RH(Q),q=B6(Z.sealUrl,Z.token),V=await X8(q);_H(Z.corpId,V.tenant);let F=await aQ(q,{note:X});x0({tenant:{id:V.tenant.id,name:V.tenant.name,tenantSlug:V.tenant.tenantSlug,corpId:Z.corpId},user:{id:V.user.id,name:V.user.name,providerUserId:V.user.providerUserId,isAdmin:V.user.isAdmin},delegation:F,expiresIn:Z.expiresIn});return}let J=await P1(Y);if(z==="list"){await k0("seal_delegation_list",J,Y,{},E0(U.options));return}if(z==="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 k0("seal_delegation_revoke",J,Y,{tokenId:X},E0(U.options));return}let I=h(U.options.note)??"CLI generated provisional access link",K=await O$("seal_delegation_create",J,Y,{note:I});if($==="hose-link")console.error(`\uD83D\uDC49 提示: 企业「${Y.name}」源类型为 Seal 原生测试环境,已自动为您生成委托免登直达链接。`);let G=K,H="staffName"in Y.source&&typeof Y.source.staffName==="string"?Y.source.staffName:void 0,W=Oo(Date.now()+86400000);x0({id:G.id,corpId:Y.source.corpId??Y.id,corpName:Y.name,staffId:Y.source.staffId,...H?{staffName:H}:{},link:G.link,expiresAt:W,token:G.token});return}if($==="hose-link"){let z=U.options.expire,Q=z!==void 0?s0(z):7200;if(Q===void 0||Q<=0)throw Error(`Invalid --expire: ${String(z)}. Must be a positive number of seconds (e.g. --expire 7200 or --expire 86400).`);let J=X0(U.options.force)===!0||X0(U.options.refresh)===!0||X0(U.options.f)===!0,I=await s00(Y,Q,{force:J}),K="staffName"in Y.source&&typeof Y.source.staffName==="string"?Y.source.staffName:void 0,G=Oo(Date.now()+Q*1000);x0({corpId:Y.source.corpId??Y.id,corpName:Y.name,staffId:Y.source.staffId,...K?{staffName:K}:{},link:I.url,expiresAt:G,token:I.token});return}if($==="keys"||$==="hose-keys"){let z=X0(U.options.reveal)===!0||X0(U.options.r)===!0||X0(U.options.plain)===!0;await Vo(Y.id,{reveal:z});return}throw Error(`Unknown auth command: ${$??""}. Run 'seal-use help' for available commands.`)}async function rg1($){if($.source.type!=="hose"){let F=await P1($),w=await X8(F);return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!0,stages:[{name:"seal.whoami",ok:!0,user:w.user,tenant:w.tenant}]}}Kw($.id);let Y=$.source,U=Y.appKey??Y.key,z=Y.appSecurity??Y.password,Q=($.seal.url??Y.sealUrl??`https://${Y.corpId.toLowerCase()}.sealai.cc`).replace(/\/+$/,""),J=Y.staffId.includes(":")?Y.staffId:`${Y.corpId}:${Y.staffId}`,I=[];if((!U||!z)&&!Y.closeToken)return{corp:{id:$.id,name:$.name,sourceType:$.source.type},ok:!1,stages:[{name:"hose.openapi",ok:!1,error:"Hose source requires appKey/key and appSecurity/password"}]};let K=U&&z?await dT("hose.openapi",async()=>{let F=await nh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1/auth/getAccessToken`,{appKey:U,appSecurity:z}),w=o3(F.value),O=n6(w.accessToken)??n6(F.accessToken)??n6(F.token);if(!O)throw Error("Hose login did not return an access token");return{token:O,public:{corporationId:n6(w.corporationId)??n6(o3(w.corporation).id),expireTime:gq(w.expireTime)}}}):void 0;if(K)I.push(K.public);let G=K?.private?.token,H=Y.closeToken?{public:{name:"hose.closeapi",ok:!0,corpId:Y.corpId,staffId:Y.staffId,configured:!0,expiresAt:Y.expiresAt},private:{token:Y.closeToken}}:G?await dT("hose.provisional",async()=>{let F=await nh0(`${Y.domain.replace(/\/+$/,"")}/api/openapi/v1.1/provisional/getProvisionalAuth?accessToken=${encodeURIComponent(G)}`,{uid:J,pageType:"home",expireDate:7200}),w=n6(o3(F.value).message);if(!w)throw Error("Hose CloseAPI d Line truncated
`);y0({provider:"hose",capability:"privilege-elevation",corpId:U.id,corpName:U.name,domain:U.source.domain,staffId:U.source.staffId,appKey:Q??"-",appSecurity:J?z?J:qO(J):"-",active:!0})}function Bv0($,Y){let{token:U,sealUrl:z,expiresIn:Q,verify:J,remote:I}=Y,K=Y.expiresAt??Ov0(Date.now()+Q*1000),G=Y.custom??Nv0($),H=I?.user,W=I?.tenant,X=d1($,"tenantSlug")??e$(W?.tenantSlug),Z=d1($,"tenantId")??e$(W?.id),q=d1($,"tenantName")??e$(W?.name),V=d1($,"id")??X??Z;if(!V)throw Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");let F=d1($,"staffId")??e$(H?.providerUserId)??e$(H?.id)??"seal",O=d1($,"provider")??e$(H?.provider)??e$(W?.providerConfig?.provider),w=d1($,"corpId")??X??Z??V,N={id:V,name:d1($,"name")??q??V,environment:"production",seal:{url:z,tenantSlug:X,headers:G.headers,cookies:G.cookies,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"seal",token:U,sealUrl:z,expiresIn:Q,expiresAt:K,staffId:F,corpId:w,tenantId:Z,tenantSlug:X,tenantName:q,providerUserId:e$(H?.providerUserId),provider:O},auth:{refreshTtl:300}},M=eA();$o(M,{recursive:!0,mode:448});let D=Uo(M,`${Eq(V)}.json`);if(el(D)&&$.overwrite!==!0)throw Error(`Enterprise config already exists: ${D}. Pass "overwrite": true to replace it.`);Yo(D,`${JSON.stringify(N,null,2)}
`,{mode:384}),y0({id:V,name:N.name,tenantId:Z,tenantSlug:X,verified:J,path:D})}function Av0($){let Y=$.remote.tenant,U=e$(Y.tenantSlug)??$.corpId,z=e$(Y.id),Q=e$(Y.name),J={id:$.id,name:$.name??Q??$.id,environment:"production",seal:{url:$.sealUrl,tenantSlug:U,endpoints:{approvalStylePreferences:"api/v1/agent/ai-approval/config"}},source:{type:"hose",provider:$.provider,domain:$.domain,closeToken:$.closeToken,...$.expiresIn!==void 0?{expiresIn:$.expiresIn}:{},...$.expiresAt?{expiresAt:$.expiresAt}:{},staffId:$.staffId,corpId:$.corpId,sealUrl:$.sealUrl},auth:{refreshTtl:300}},I=eA();$o(I,{recursive:!0,mode:448});let K=Uo(I,`${Eq($.id)}.json`);if(el(K)&&!$.overwrite)throw Error(`Enterprise config already exists: ${K}. Pass "overwrite": true to replace it.`);Yo(K,`${JSON.stringify(J,null,2)}
`,{mode:384}),y0({id:J.id,name:J.name,tenantId:z,tenantSlug:U,sourceType:"hose",credentialMode:"web-session",verified:!0,path:K})}async function Cg1($,Y,U={}){let z=await X8(A6($,Y,U));return{user:z.user??{},tenant:z.tenant??{}}}var Pv0=m(()=>{U3();Vv0();CH();R8();P5();Md();P6();kT();O8();N4();q4();l1();fT()});var jv0,Ev0,bT,Tv0,r4;var $5=m(()=>{jv0=/^[\uD800-\uDBFF]$/,Ev0=/^[\uDC00-\uDFFF]$/,bT=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;(function($){$[$.Unknown=0.0000000000001]="Unknown",$[$.Rule=0.000000000001]="Rule",$[$.DICT=0.00000002]="DICT",$[$.Surname=1]="Surname",$[$.Custom=1]="Custom"})(Tv0||(Tv0={}));r4={Normal:1,Surname:10,Custom:100}});function e2($){var Y;return $.length-(((Y=$.match(bT))===null||Y===void 0?void 0:Y.length)||0)}function M$($){if(bT.lastIndex=0,!bT.test($))return $.split("");let Y=[],U=0;while(U<$.length){let z=$[U];if(jv0.test(z)&&Ev0.test($[U+1]))Y.push($.substring(U,U+2)),U+=2;else Y.push(z),U+=1}return Y}class bK{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 y9=m(()=>{$5()});function Rg1(){let $={零一:"líng yī",〇一:"líng yī",十一:"shí yī",一十:"yī shí",第一:"dì yī",一十一:"yī shí yī"};for(let Y in Cv0)for(let U in Rv0){let z=`${Y}${U}`,Q=`${Cv0[Y]} ${Rv0[U]}`;$[z]=Q}return $}var vv0,hv0,Sv0,gv0,yv0,Cv0,Rv0,_v0,kv0,Qo,xv0,fv0;var Jo=m(()=>{$5();y9();vv0=["zh","ch","sh","z","c","s","b","p","m","f","d","t","n","l","g","k","h","j","q","x","r","y","w",""],hv0=["j","q","x"],Sv0=["uān","uán","uǎn","uàn","uan","uē","ué","uě","uè","ue","ūn","ún","ǔn","ùn","un","ū","ú","ǔ","ù","u"],gv0={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:"ü"},yv0=["ia","ian","iang","iao","ie","iu","iong","ua","uai","uan","uang","ue","ui","uo","üan","üe","van","ve"],Cv0={一:"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ī"},Rv0={重:"chóng",行:"háng",斗:"dǒu",更:"gēng"};_v0=Rg1(),kv0=Object.keys(_v0).map(($)=>({zh:$,pinyin:_v0[$],probability:0.000000000001,length:e2($),priority:r4.Normal,dict:Symbol("rule")})),Qo={不:{bú:[4]},一:{yí:[4],yì:[1,2,3]}},xv0={不:["的","而","之","后","也","还","地"],一:["的","而","之","后","也","还","是"]},fv0=Object.keys(Qo)});var uv0,R5;var iT=m(()=>{y9();uv0={"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 y0(w.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 z=Y??h(U.options.corp);if(!z)throw S4("Usage: seal-use corps get <corpId>");let Q=M1(z),J=Dd(Q.id),I=Fv0(Q);return y0({id:Q.id,name:Q.name,environment:Q.environment??"production",configFile:J,seal:{url:I,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:wv0(Q.source),relations:{testCorpId:Q.testCorpId,prodCorpId:Q.prodCorpId},auth:{refreshTtl:Q.auth.refreshTtl}}),!0}if($==="current"){let z=M1(h(U.options.corp));return y0({id:z.id,name:z.name,environment:z.environment??"production",sourceType:z.source.type,provider:z.source.provider??z.source.type,staffId:z.source.staffId,testCorpId:z.testCorpId,prodCorpId:z.prodCorpId}),!0}if($==="mark"||$==="mark-test"||$==="mark-prod"){let z=Y??h(U.options.corp);if(!z)throw S4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");let Q=M1(z),J=$==="mark-test"?"test":$==="mark-prod"?"production":h(U.options.env)??h(U.options.environment);if(J!=="production"&&J!=="test")throw S4("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");if(!(H0(U.options.confirm)===!0||H0(U.options.yes)===!0))throw w$(`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 K=j9(Q.id,{environment:J});return y0({id:K.id,name:K.name,environment:K.environment,testCorpId:K.testCorpId,prodCorpId:K.prodCorpId}),!0}if($==="rename"){let z=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(!z||!Q)throw Error("Usage: seal-use corps rename <corpId> --name <newName>");let J=M1(z),I=j9(J.id,{name:Q});return y0({success:!0,id:I.id,name:I.name,previousName:J.name}),!0}if($==="switch"){let z=Y;if(!z)throw Error("Usage: seal-use corps switch <corpId>");let Q=h4();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(z);return qz({...Q,stateful:!0,defaultCorpId:J.id}),y0({current:!0,id:J.id,name:J.name}),!0}return!1}var nh0=m(()=>{P5();bh0();$P();N4();O8();q4();l1();fT()});import{existsSync as tg1,mkdirSync as eg1,readFileSync as $y1,writeFileSync as ch0}from"node:fs";import{homedir as Yy1}from"node:os";import{join as lT}from"node:path";function dh0(){let $=process.env.SEAL_USE_MAPPINGS_DIR?.trim();if($)return $;return lT(Yy1(),".config","seal-use","mappings")}function ph0($){let Y=dh0();eg1(Y,{recursive:!0,mode:448});let U=lT(Y,`${$.target.id}-v${$.target.publishedVersionNumber}.json`),z=lT(Y,`${$.target.id}-latest.json`),Q=JSON.stringify($,null,2);return ch0(U,Q,{encoding:"utf-8",mode:384}),ch0(z,Q,{encoding:"utf-8",mode:384}),U}function mh0($,Y){let U=dh0(),z;if(!Y||Y==="latest")z=`${$}-latest.json`;else{let J=String(Y).replace(/^v/i,"");z=`${$}-v${J}.json`}let Q=lT(U,z);if(!tg1(Q))return null;try{let J=$y1(Q,"utf-8");return JSON.parse(J)}catch{return null}}function lh0($,Y){if(!Y)return $;let U=Y.trim().toLowerCase();return $.filter((z)=>{return String(z.sourceRuleCode).toLowerCase()===U||String(z.targetRuleCode).toLowerCase()===U||z.sourceRuleId.toLowerCase()===U||z.targetRuleId.toLowerCase()===U||`#${z.sourceRuleCode}`.toLowerCase()===U||`#${z.targetRuleCode}`.toLowerCase()===U})}function oh0($,Y,U){let z=0,Q=Y!==void 0?new RegExp(`\\[Prod v${Y}\\s*·\\s*#(\\d+)(?:[^\\]]*)\\]`):/\[Prod draft\s*·\s*#(\d+)(?:[^\]]*)\]/;for(let I of U){if(!I.versionName)continue;let K=I.versionName.match(Q);if(K&&K[1]){let G=parseInt(K[1],10);if(!isNaN(G)&&G>z)z=G}}if(z>0)return z+1;if(!U.some((I)=>I.versionName&&/\[Prod v\d+/.test(I.versionName))){let I=U.filter((K)=>K.versionName&&K.versionName.includes(`Sync from ${$}`)).length;if(I>0)return I+1}return 1}function rh0($,Y,U,z){let Q=Y!==void 0?`Prod v${Y}`:"Prod draft",J=z!==void 0?` -> Test v${z}`:"";return`Sync from ${$} [${Q} · #${U}${J}]`}var Fo=()=>{};import{randomBytes as Uy1}from"node:crypto";async function ah0($,Y,U){if($==="sync-test"){let z=Y??h(U.options.corp),Q=M1(z);if(!Q.testCorpId)throw S4(`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.`);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 I=await T1(Q),K=await T1(J),[G,H,W,X,Z,q,V,F]=await Promise.all([s1(I,Q.seal.endpoints.approvalStylePreferences),s1(K,J.seal.endpoints.approvalStylePreferences),X6(I),X6(K),d8(I),d8(K),sh0(I),sh0(K)]),O=(V.articles||[]).filter((G0)=>!G0.isDeleted),w=(F.articles||[]).filter((G0)=>!G0.isDeleted),N=new Map(w.map((G0)=>[G0.title.trim(),G0])),M=[],D=[],P=new Set(O.map((G0)=>G0.title.trim()));for(let G0 of O){let u0=G0.title.trim(),U1=N.get(u0);if(!U1){M.push(G0);continue}let a=U1.content!==G0.content,X0=(U1.purpose??"")!==(G0.purpose??""),F0=U1.enabled!==G0.enabled,b0=U1.contentType!==G0.contentType,i0=(U1.status??"")!==(G0.status??""),n0=JSON.stringify([...U1.scenarios??[]].sort())!==JSON.stringify([...G0.scenarios??[]].sort()),O1=JSON.stringify([...U1.tags??[]].sort())!==JSON.stringify([...G0.tags??[]].sort());if(a||X0||F0||b0||i0||n0||O1)D.push({testId:U1.id,prodDoc:G0,reasons:[...a?["content"]:[],...X0?["purpose"]:[],...F0?["enabled"]:[],...b0?["contentType"]:[],...i0?["status"]:[],...n0?["scenarios"]:[],...O1?["tags"]:[]]})}let T=w.filter((G0)=>!P.has(G0.title.trim())),j=[...Z].sort((G0,u0)=>u0.versionNumber-G0.versionNumber)[0],C=j?.versionNumber,k=([...q].sort((G0,u0)=>u0.versionNumber-G0.versionNumber)[0]?.versionNumber??0)+1,S=oh0(Q.name,C,q),n=h(U.options["version-name"])??h(U.options.versionName)??rh0(Q.name,C,S,k),z0={...H,tone:G.tone,language:G.language,detailLevel:G.detailLevel,outputFormat:G.outputFormat,examples:G.examples??[],prohibitedPhrases:G.prohibitedPhrases??[],customInstructions:G.customInstructions,decisionPreferences:G.decisionPreferences,thinkingDepthPreference:G.thinkingDepthPreference};if(H0(U.options["dry-run"])===!0||H0(U.options.dryRun)===!0)return y0({dryRun:!0,source:{id:Q.id,name:Q.name,environment:Q.environment,latestPublishedVersion:j?{versionNumber:j.versionNumber,versionName:j.versionName}:null,documentsCount:O.length},target:{id:J.id,name:J.name,environment:J.environment},versionMappingPlan:{sourceProdVersionNumber:C??null,sourceProdVersionName:j?.versionName??null,targetTestExpectedVersionNumber:k,targetTestPublishVersionName:n,iteration:S},preferencesDiff:{decisionPreferences:{before:H.decisionPreferences,after:G.decisionPreferences},thinkingDepthPreference:{before:H.thinkingDepthPreference,after:G.thinkingDepthPreference}},rulesPlan:{sourceDraftRuleCount:W.rules.length,targetExistingDraftRuleCount:X.rules.length,toDeleteCount:X.rules.length,toCreateCount:W.rules.length,rulesToSync:W.rules.map((G0,u0)=>({index:u0+1,sourceRuleId:G0.id,sourceRuleCode:G0.code??u0+1,expectedTargetCode:`rule-${u0+1}`,description:G0.description,scope:G0.scope,strictness:G0.strictness}))},documentsPlan:{sourceDocumentCount:O.length,targetExistingDocumentCount:w.length,toCreateCount:M.length,toCreate:M.map((G0)=>({title:G0.title,purpose:G0.purpose,contentType:G0.contentType,scenarios:G0.scenarios})),toUpdateCount:D.length,toUpdate:D.map((G0)=>({targetDocumentId:G0.testId,title:G0.prodDoc.title,reasons:G0.reasons})),toDeleteCount:T.length,toDelete:T.map((G0)=>({targetDocumentId:G0.id,title:G0.title}))},publishingPlan:{targetCorpId:J.id,publishVersionName:n,publishTarget:"test"},hosecloudSyncPlan:zy1(Q,G),productionGuarantees:{prodRulesStayDraft:!0,prodVersionPublished:!1}}),!0;if(!(H0(U.options.yes)===!0||H0(U.options.confirm)===!0))throw w$(`Refusing to overwrite test enterprise '${J.name}' (${J.id}) with preferences, ${W.rules.length} draft rules, and ${O.length} 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`);await a5(K,z0,J.seal.endpoints.approvalStylePreferences);let t=[];for(let G0 of T)await EO(K,G0.id),t.push({id:G0.id,title:G0.title});let e=[];for(let G0 of D)await jO(K,G0.testId,{title:G0.prodDoc.title,purpose:G0.prodDoc.purpose,content:G0.prodDoc.content,contentType:G0.prodDoc.contentType,status:G0.prodDoc.status,enabled:G0.prodDoc.enabled,scenarios:G0.prodDoc.scenarios&&G0.prodDoc.scenarios.length>0?G0.prodDoc.scenarios:["audit"],tags:G0.prodDoc.tags}),e.push({id:G0.testId,title:G0.prodDoc.title,reasons:G0.reasons});let g=[];for(let G0 of M){let u0=await TO(K,{title:G0.title,purpose:G0.purpose,content:G0.content,contentType:G0.contentType,status:G0.status,enabled:G0.enabled,scenarios:G0.scenarios&&G0.scenarios.length>0?G0.scenarios:["audit"],tags:G0.tags});g.push({id:u0.id,title:u0.title})}for(let G0 of X.rules)await tQ(K,G0.id);let d=[];for(let G0 of W.rules){let u0=await kH(K,{description:G0.description,scope:G0.scope,strictness:G0.strictness});d.push(u0)}let Y0=await PO(K);if(! Line truncated
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(!I&&!K)throw w$("Refusing to replay approval records without --confirm. Use --dry-run to preview the payload without sending it.",`seal-use corps replay-test ${z??"<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((S)=>S.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((S)=>S.trim()).filter(Boolean):void 0,F=s0(U.options.limit)??(!H&&!X&&!Z&&!V?1:void 0),O=h(U.options.status),w=h(U.options.startDate)??h(U.options["start-date"]),N=h(U.options.endDate)??h(U.options["end-date"]),M=await T1(Q),D=Q.id===G.id?M:await T1(G),P=h(U.options.webhook)??h(U.options.selector),T=h(U.options.snSuffix)??h(U.options["sn-suffix"]),B=h(U.options.snPrefix)??h(U.options["sn-prefix"]),j=h(U.options.docIdSuffix)??h(U.options["doc-id-suffix"]),C=h(U.options.docIdPrefix)??h(U.options["doc-id-prefix"]),b={recordId:H,recordIds:X,sn:Z,sns:V,limit:F,status:O,startDate:w,endDate:N};console.error(`[corps-replay-test] 正式企业「${Q.name}」(${Q.id}) -> 测试企业「${G.name}」(${G.id})`);let k=await UK({query:b,sourceClient:M,targetClient:D,sourceCorp:Q,targetCorp:G,webhookSelector:P,snPrefix:B,snSuffix:T,docIdPrefix:C,docIdSuffix:j,dryRun:I});if(I)return console.error(`[corps-replay-test] 预览模式:已成功从 ${Q.name} 提取单据并转换为 Webhook Payload(未实际推送)。`),console.log(JSON.stringify(k,null,2)),!0;if(k.success)if(k.totalCount===1&&k.replayedDocument)console.error(`\uD83D\uDFE2 成功重放单据「${k.replayedDocument.documentSN}」至 ${G.name} (${k.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDFE2 成功重放 ${k.successCount} 条单据(来自「${Q.name}」)至「${G.name}」(${k.targetWebhook?.name??"Webhook 通道"})`);else console.error(`\uD83D\uDD34 单据重放部分或全部失败(成功 ${k.successCount} 条,失败 ${k.failureCount} 条)至「${G.name}」`);if(console.error(`\uD83D\uDC49 Next action: seal-use approval-runs list --corp ${G.id} --limit ${k.totalCount}`),console.log(JSON.stringify(k,null,2)),!k.success)throw new X4(`Approval record replay failed: ${k.failureCount} record(s) failed.`,1);return!0}return!1}async function sh0($){let U=[],z=0;while(!0){let Q=await mY($,{offset:z,limit:100});if(U.push(...Q.articles),z+=Q.articles.length,Q.articles.length===0||Q.articles.length<100)break;if(Q.total!==void 0&&z>=Q.total)break}return{articles:U,total:U.length}}function wo($){return[...$].slice(0,6).join("")+"(Seal测)"}function zy1($,Y){if($.source.type!=="hose")return{sourceType:$.source.type,skipped:!0,reason:"prod source is not hose; no hosecloud credentials available"};let U=(Y.integrations??[]).filter((J)=>J.type==="hosecloud"),z=new Set,Q=U.filter((J)=>{let I=J.corporationId??$.id;if(z.has(I))return!1;return z.add(I),!0});return{sourceType:"hose",outboundName:wo($.name),targetMode:"assisted",integrationsCount:Q.length,integrations:Q.map((J)=>({corporationId:J.corporationId,apiOrigin:J.apiOrigin,customApiUrl:J.customApiUrl}))}}async function Qy1($,Y,U,z){if($.source.type!=="hose")return{skipped:!0,reason:"prod source is not hose; no hosecloud credentials available"};let Q=($.source.appKey??$.source.key)?.trim(),J=($.source.appSecurity??$.source.password)?.trim();if(!Q||!J)return{skipped:!0,reason:"prod hose source missing appKey/appSecurity (or key/password)"};let[I,K]=await Promise.all([s1(U,$.seal.endpoints.approvalStylePreferences),s1(z,Y.seal.endpoints.approvalStylePreferences)]),G=(I.integrations??[]).filter((w)=>w.type==="hosecloud");if(G.length===0)return{skipped:!0,reason:"prod Seal enterprise has no hosecloud integrations configured"};let H=new Set,W=[];for(let w of G){let N=w.corporationId??$.id;if(!H.has(N))H.add(N),W.push({...w,corporationId:N})}let X=K.integrations??[],Z=new Map(X.filter((w)=>w.type==="hosecloud").map((w)=>[w.corporationId,w])),q=wo($.name),V=[],F=W.map((w)=>{let N=Z.get(w.corporationId),M=N?.signKey??Uy1(6).toString("hex");return V.push({signKey:M,outboundName:q,corporationId:w.corporationId,action:N?"updated":"created"}),{type:"hosecloud",signKey:M,outboundName:q,mode:"assisted",apiKey:Q,apiSecret:J,apiOrigin:w.apiOrigin,...w.customApiUrl?{customApiUrl:w.customApiUrl}:{},corporationId:w.corporationId}}),O=X.filter((w)=>w.type!=="hosecloud");return await a5(z,{...K,integrations:[...O,...F]},Y.seal.endpoints.approvalStylePreferences),{skipped:!1,synced:V}}var th0=m(()=>{R8();P6();Fo();Ed();bZ();N4();O8( Line truncated
`+`支持的审批系统与发布目标:
`+` • hosecloud (合思费控): seal-use deploy hosecloud <requirements|list|get|status|configure|sync> --corp <corpId>
@@ -951,14 +951,14 @@ 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 I=$==="hosecloud",K=$==="hosecloud"?Y:$,G=$==="hosecloud"?U:Y;if(!I)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(K==="requirements"){await k0("seal_deploy_hosecloud_requirements",z,Q,{},E0(J.options));return}if(K==="list"){await k0("seal_deploy_hosecloud_list",z,Q,{},E0(J.options));return}if(K==="get"){let H=G??h(J.options.signKey)??h(J.options["sign-key"]);if(!H){let X=((await r1(z)).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 I=$==="hosecloud",K=$==="hosecloud"?Y:$,G=$==="hosecloud"?U:Y;if(!I)throw Error(`未知的发布目标系统: ${$}。当前支持: hosecloud (合思费控) 与 webhook (通用回调)。`);if(K==="requirements"){await x0("seal_deploy_hosecloud_requirements",z,Q,{},E0(J.options));return}if(K==="list"){await x0("seal_deploy_hosecloud_list",z,Q,{},E0(J.options));return}if(K==="get"){let H=G??h(J.options.signKey)??h(J.options["sign-key"]);if(!H){let X=((await s1(z)).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,F=Z.apiOrigin??"production";console.error(` • "${q}" (signKey: ${V}, 环境: ${F})`),console.error(` \uD83D\uDC49 查看命令: seal-use deploy hosecloud get ${V} --corp ${Q.id}
`)}throw new L4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey。",2,X.length===1?`seal-use deploy hosecloud get ${X[0].signKey} --corp ${Q.id}`:void 0)}await k0("seal_deploy_hosecloud_get",z,Q,{signKey:H},E0(J.options));return}if(K==="status"){await k0("seal_deploy_hosecloud_status",z,Q,{},E0(J.options));return}if(K==="configure"){let H=h(J.options.input),W=H?JSON.parse(eg1(H,"utf8")):D8(J.json);if(!W||Object.keys(W).length===0)throw Error("Usage: seal-use deploy hosecloud configure --json '{...}' or --input <file>");await k0("seal_deploy_hosecloud_configure",z,Q,{...W,dryRun:X0(J.options.dryRun)??X0(J.options["dry-run"])},E0(J.options));return}if(K==="sync"){let H=G??h(J.options.signKey)??h(J.options["sign-key"]),W=X0(J.options.auto)??X0(J.options.yes);if(!H){let Z=((await r1(z)).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 k0("seal_deploy_hosecloud_sync",z,Q,{signKey:V},E0(J.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${Q.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of Z){let F=V.outboundName??"SealAI 审批",w=V.signKey,O=V.apiOrigin??"production";console.error(` • "${F}" (signKey: ${w}, 环境: ${O})`),console.error(` \uD83D\uDC49 同步命令: seal-use deploy hosecloud sync ${w} --corp ${Q.id}
`)}throw new X4("缺少必需参数 <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",z,Q,{signKey:H},E0(J.options));return}if(K==="status"){await x0("seal_deploy_hosecloud_status",z,Q,{},E0(J.options));return}if(K==="configure"){let H=h(J.options.input),W=H?JSON.parse(Hy1(H,"utf8")):B8(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",z,Q,{...W,dryRun:H0(J.options.dryRun)??H0(J.options["dry-run"])},E0(J.options));return}if(K==="sync"){let H=G??h(J.options.signKey)??h(J.options["sign-key"]),W=H0(J.options.auto)??H0(J.options.yes);if(!H){let Z=((await s1(z)).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",z,Q,{signKey:V},E0(J.options));return}console.error(`Usage: seal-use deploy hosecloud sync <sign-key> [--corp ${Q.id}]
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let V of Z){let F=V.outboundName??"SealAI 审批",O=V.signKey,w=V.apiOrigin??"production";console.error(` • "${F}" (signKey: ${O}, 环境: ${w})`),console.error(` \uD83D\uDC49 同步命令: seal-use deploy hosecloud sync ${O} --corp ${Q.id}
`)}if(Z.length===1)console.error(`\uD83D\uDCA1 提示:若希望单配置自动同步,可附加 --auto 参数:seal-use deploy hosecloud sync --auto --corp ${Q.id}
`);throw new L4("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,Z.length===1?`seal-use deploy hosecloud sync ${Z[0].signKey} --corp ${Q.id}`:void 0)}await k0("seal_deploy_hosecloud_sync",z,Q,{signKey:H},E0(J.options));return}throw Error(`Unknown deploy hosecloud action: ${K??""}. Available: requirements, list, get, status, configure, sync.`)}var US0=m(()=>{f4();A4();G4();P6();F$()});var QS0=`---
`);throw new X4("缺少必需参数 <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",z,Q,{signKey:H},E0(J.options));return}throw Error(`Unknown deploy hosecloud action: ${K??""}. Available: requirements, list, get, status, configure, sync.`)}var VS0=m(()=>{N4();q4();l1();P6();O8()});var FS0=`---
name: seal-use
description: "v0.10.37: Use for Seal Use first-time enterprise onboarding, Hose/合思 or Seal-native authentication, assistance links and browser cURL intake, plus tenant approval operations, diagnosis, simulation, rules, users, configuration, and search."
metadata:
@@ -1123,11 +1123,11 @@ Hose 专属命令必须从命令名上显式可见:认证入口使用 \`auth h
- 返回授权、协助或委托链接时,必须同时提供代码块(便于复制)与可点击链接;
- 审批单链接默认提供只读 Deep Link(\`type: 'deep_link'\`);仅在用户明确需要免密时才使用 \`--sso\` 并声明四项安全告知。
- **高危写操作防线**:规则推送或发布(\`rules push --publish\`)、清空(\`rules clear\`)、测试同步(\`corps sync-test\`)与单据重放(\`corps replay-test\`)优先使用 \`--dry-run\` 预览;正式执行必须按命令要求显式带 \`--yes\` 或 \`--confirm\`。\`replay-test --force\` 仅放宽目标环境/绑定检查,不会跳过确认。
`;var zS0=()=>{};var IS0=`interface:
`;var LS0=()=>{};var OS0=`interface:
display_name: "Seal Use"
short_description: "Diagnose approval feedback and publish minimal rule fixes"
default_prompt: "Use $seal-use to resolve a customer feedback package to the correct tenant, diagnose the approval run, propose a minimal rule diff, and publish only after explicit confirmation."
`;var JS0=()=>{};var GS0=`# Approval Attachment Trace Investigation
`;var wS0=()=>{};var NS0=`# 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.
@@ -1348,7 +1348,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 KS0=()=>{};var WS0=`# Approval Bad Case Catalog
`;var MS0=()=>{};var BS0=`# 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.
@@ -1398,7 +1398,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 HS0=()=>{};var ZS0="# 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 DS0=()=>{};var PS0="# 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
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.
@@ -1666,7 +1666,7 @@ Do not automatically rerun or resubmit the customer's production document. Run a
- **系统调用凭证账号**:显式说明“周晚容(系统调用凭证账号,由智能助手代执行)”
- **全量规则总数**:核对总数是否变化
- **规则一致性校验**:确认目标规则文本与确认内容 100% 逐字吻合
`;var LS0=()=>{};var wS0=`# Enterprise Onboarding
`;var ES0=()=>{};var _S0=`# Enterprise Onboarding
> 💡 **新手接入指引分工**:
> - 若是引导无技术背景的用户找凭证材料、找按钮,**必须直接使用 \`references/first-time-user.md\` 并渲染其中的指引截图**;
@@ -1865,7 +1865,7 @@ seal-use auth check --corp <discovered-id> # Hose source
Report the human enterprise name, identity provider, credential method, and whether verification succeeded. Do not expose internal IDs unless they help with troubleshooting. Do not perform approval, rule, document, simulation, publishing, or other business mutations just because onboarding succeeded; continue only with the user's requested task and its normal confirmation rules.
If a temporary assistance-link or browser session expires, explain that it must be renewed or recaptured. Recommend standard Hose app credentials when the user needs durable unattended access.
`;var OS0=()=>{};var NS0=`# 第一次接入:看图找到材料
`;var RS0=()=>{};var hS0=`# 第一次接入:看图找到材料
> **【Agent 呈现铁律(Mandatory Image Rule)】**:
> 当向用户提供接入指引或引导用户获取材料时,**Agent 必须将本文档中对应的截图主动按顺序渲染到 Markdown 对话中**(使用图片语法 \`![说明](路径)\`),**绝不允许只讲纯文字步骤!** 真实业务用户必须对照图片界面才能准确找到按钮。
@@ -1952,7 +1952,7 @@ macOS 也可以使用 \`Option + Command + I\`;Windows 常见快捷键是 \`F1
## 安全提醒
协助平台、网页登录、SSO 和浏览器 cURL 都可能携带当前用户的访问权限。只把材料交给正在处理本机接入的可信助手,并在接入完成后关闭或刷新该网页会话。不要把原始 cURL、接入密码或完整截图发送到外部渠道。
`;var MS0=()=>{};var AS0=`# Hose Enterprise Auth
`;var vS0=()=>{};var gS0=`# Hose Enterprise Auth
Use this reference for Hose/合思 enterprise configuration and user-facing Hose authorization links.
@@ -2021,7 +2021,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 DS0=()=>{};var PS0=`# Seal AI 智能审核发布到合思费控 (HoseCloud Deployment)
`;var SS0=()=>{};var kS0=`# Seal AI 智能审核发布到合思费控 (HoseCloud Deployment)
Use this reference when configuring, deploying, or troubleshooting Seal AI smart approval integrations with Hose/合思费控 (界面路径:【智能审核】 $\\to$ 【发布】 $\\to$ 【合思费控】).
@@ -2119,7 +2119,7 @@ seal-use deploy hosecloud status --corp <corpId>
| \`signKey\` | string | 否 | 随机生成 | 集成配置卡片唯一标识,编辑时传入以更新对应配置 |
| \`apiOrigin\` | string | 否 | 自动探测 | \`production\` / \`custom\` |
| \`customApiUrl\` | string | 否 | - | 专属私有云 API 地址(当 \`apiOrigin=custom\` 时必填) |
`;var BS0=()=>{};var jS0=`# Hose Enterprise Initialization & Automated Discovery
`;var yS0=()=>{};var fS0=`# 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.
@@ -2225,7 +2225,7 @@ seal-use corps hose-staffs --json '{
}'
\`\`\`
* 直接使用指定 ID 完成接入并进行连通性验证。
`;var TS0=()=>{};var CS0=`# Rule Lightweight Queries
`;var xS0=()=>{};var bS0=`# 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.
@@ -2336,7 +2336,7 @@ Use current search only when the question is about current draft/current knowled
## Output Discipline
If a rule command would return many descriptions or more than about 20 rules, use \`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
`;var ES0=()=>{};var _S0="# 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 uS0=()=>{};var nS0="# 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
本文档面向 AI Agent 与运维人员,规范从**生产/测试环境搭配接入**、**配置与合思集成自动同步**、**测试环境单据模拟验证**,到**生产规则安全投产**的端到端标准工作流。
@@ -2551,10 +2551,10 @@ flowchart TD
seal-use tool seal_approval_rules_publish --corp <prodCorpId> --json '{"versionName":"审核规则 版本N"}'
\`\`\`
发布后核实版本状态,完成业务安全闭环。
`;var vS0=()=>{};var Ly1="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:z,configured:!0,configPath:U,targetDir:Y,action:"created"};let Q={};try{Q=JSON.parse(yS0(U,"utf8"))}catch{Q={entries:[]}}if(!Array.isArray(Q.entries))Q.entries=[];if(Q.entries.findIndex((K)=>K&&typeof K.path==="string"&&K.path===Y)!==-1)return{detected:z,configured:!0,configPath:U,targetDir:Y,action:"already_present"};let I=Q.entries.findIndex((K)=>K&&typeof K.path==="string"&&(K.path==="~/.agents/skills"||K.path==="~/.agents/skills/"));if(I!==-1)return Q.entries[I]={...Q.entries[I],path:Y},Do(U,JSON.stringify(Q,null,2)+`
`,"utf8"),{detected:z,configured:!0,configPath:U,targetDir:Y,action:"updated_tilde"};return Q.entries.unshift({path:Y}),Do(U,JSON.stringify(Q,null,2)+`
`,"utf8"),{detected:z,configured:!0,configPath:U,targetDir:Y,action:"prepended"}}function Po($){let Y=$?.targetSkillsDir??kS0(),U=$?.configFile??xS0(),z=fS0(),Q=!1;if(yq(U))try{let J=JSON.parse(yS0(U,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((I)=>I?.path===Y)}catch{}return{detected:z,configured:Q,configPath:U,targetDir:Y}}var To=()=>{};import{cpSync as By1,existsSync as nK,lstatSync as bS0,mkdirSync as Py1,realpathSync as $Y,rmSync as Ty1,symlinkSync as jy1,unlinkSync as uS0}from"node:fs";import{homedir as iS0}from"node:os";import{dirname as nS0,join as YY}from"node:path";function Ey1($,Y){let U=Y?.baseHomeDir??iS0(),z=YY(U,$.rootDirName),Q=Y?.sourceSkillDir??YY(U,".agents","skills","seal-use"),J=nS0(Q),I=YY(z,"skills"),K=YY(I,"seal-use");if(!nK(z))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(nK(I)&&nK(J))try{if($Y(I)===$Y(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}Py1(I,{recursive:!0});let G;try{G=bS0(K)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if($Y(K)===$Y(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:K}}catch{}try{uS0(K)}catch{}}else if(G.isDirectory())Ty1(K,{recursive:!0,force:!0}),H=!0;else uS0(K);let W=process.platform==="win32"?"junction":"dir";try{return jy1(Q,K,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:K}}catch{try{return By1(Q,K,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:K}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:K,error:X?.message||String(X)}}}}function Cy1($,Y){let U=Y?.baseHomeDir??iS0(),z=YY(U,$.rootDirName),Q=Y?.sourceSkillDir??YY(U,".agents","skills","seal-use"),J=nS0(Q),I=YY(z,"skills"),K=YY(I,"seal-use");if(!nK(z))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(nK(I)&&nK(J))try{if($Y(I)===$Y(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}let G;try{G=bS0(K)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if($Y(K)===$Y(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:K}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:K}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:K}}function jo($){return cS0.map((Y)=>Ey1(Y,$))}function Eo($){return cS0.map((Y)=>Cy1(Y,$))}var cS0;var Co=m(()=>{cS0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var Ro=m(()=>{To();Co();To();Co()});import{existsSync as Ry1,mkdirSync as _o,readFileSync as _y1,rmSync as vy1,writeFileSync as pS0}from"node:fs";import{homedir as mS0}from"node:os";import{dirname as dS0,join as xq}from"node:path";function vo(){return lS0["SKILL.md"]||""}function oS0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function rS0($=xq(bz(),"SKILL.md")){try{return oS0(_y1($,"utf8"))}catch{return}}function bz(){return xq(mS0(),".agents","skills","seal-use")}function Sy1(){return xq(mS0(),".agents","skills","seal-home")}function gy1(){let $=Sy1();if(Ry1($))try{return vy1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function sS0($=bz()){gy1(),_o($,{recursive:!0});let Y=[];for(let[U,z]of Object.entries(lS0)){let Q=xq($,U);_o(dS0(Q),{recursive:!0}),pS0(Q,z,"utf8"),Y.push(U)}for(let[U,z]of Object.entries(hy1)){let Q=xq($,U);_o(dS0(Q),{recursive:!0}),pS0(Q,z),Y.push(U)}return{targetDir:$,files:Y}}var lS0,hy1,cY4;var fq=m(()=>{No();No();Ro();lS0=SS0,hy1=Object.fromEntries(Object.entries(gS0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));cY4=oS0(vo())});function aS0(){return`# Seal Use 系统架构与运行规范白皮书
`;var cS0=()=>{};var Ty1="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:z,configured:!0,configPath:U,targetDir:Y,action:"created"};let Q={};try{Q=JSON.parse(lS0(U,"utf8"))}catch{Q={entries:[]}}if(!Array.isArray(Q.entries))Q.entries=[];if(Q.entries.findIndex((K)=>K&&typeof K.path==="string"&&K.path===Y)!==-1)return{detected:z,configured:!0,configPath:U,targetDir:Y,action:"already_present"};let I=Q.entries.findIndex((K)=>K&&typeof K.path==="string"&&(K.path==="~/.agents/skills"||K.path==="~/.agents/skills/"));if(I!==-1)return Q.entries[I]={...Q.entries[I],path:Y},Po(U,JSON.stringify(Q,null,2)+`
`,"utf8"),{detected:z,configured:!0,configPath:U,targetDir:Y,action:"updated_tilde"};return Q.entries.unshift({path:Y}),Po(U,JSON.stringify(Q,null,2)+`
`,"utf8"),{detected:z,configured:!0,configPath:U,targetDir:Y,action:"prepended"}}function Eo($){let Y=$?.targetSkillsDir??oS0(),U=$?.configFile??rS0(),z=sS0(),Q=!1;if(kq(U))try{let J=JSON.parse(lS0(U,"utf8"));if(Array.isArray(J?.entries))Q=J.entries.some((I)=>I?.path===Y)}catch{}return{detected:z,configured:Q,configPath:U,targetDir:Y}}var Co=()=>{};import{cpSync as Sy1,existsSync as nK,lstatSync as tS0,mkdirSync as gy1,realpathSync as $Y,rmSync as yy1,symlinkSync as ky1,unlinkSync as aS0}from"node:fs";import{homedir as eS0}from"node:os";import{dirname as $g0,join as YY}from"node:path";function xy1($,Y){let U=Y?.baseHomeDir??eS0(),z=YY(U,$.rootDirName),Q=Y?.sourceSkillDir??YY(U,".agents","skills","seal-use"),J=$g0(Q),I=YY(z,"skills"),K=YY(I,"seal-use");if(!nK(z))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"skipped_not_detected"};if(nK(I)&&nK(J))try{if($Y(I)===$Y(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}gy1(I,{recursive:!0});let G;try{G=tS0(K)}catch{G=void 0}let H=!1;if(G)if(G.isSymbolicLink()){try{if($Y(K)===$Y(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"already_linked",targetPath:K}}catch{}try{aS0(K)}catch{}}else if(G.isDirectory())yy1(K,{recursive:!0,force:!0}),H=!0;else aS0(K);let W=process.platform==="win32"?"junction":"dir";try{return ky1(Q,K,W),{id:$.id,name:$.name,detected:!0,configured:!0,mode:H?"replaced_real_dir":"linked",targetPath:K}}catch{try{return Sy1(Q,K,{recursive:!0}),{id:$.id,name:$.name,detected:!0,configured:!0,mode:"fallback_copied",targetPath:K}}catch(X){return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"error",targetPath:K,error:X?.message||String(X)}}}}function fy1($,Y){let U=Y?.baseHomeDir??eS0(),z=YY(U,$.rootDirName),Q=Y?.sourceSkillDir??YY(U,".agents","skills","seal-use"),J=$g0(Q),I=YY(z,"skills"),K=YY(I,"seal-use");if(!nK(z))return{id:$.id,name:$.name,detected:!1,configured:!1,mode:"not_detected"};if(nK(I)&&nK(J))try{if($Y(I)===$Y(J))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"parent_symlinked",targetPath:I}}catch{}let G;try{G=tS0(K)}catch{G=void 0}if(G){if(G.isSymbolicLink())try{if($Y(K)===$Y(Q))return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"single_symlinked",targetPath:K}}catch{}else if(G.isDirectory())return{id:$.id,name:$.name,detected:!0,configured:!0,mode:"real_directory",targetPath:K}}return{id:$.id,name:$.name,detected:!0,configured:!1,mode:"not_configured",targetPath:K}}function Ro($){return Yg0.map((Y)=>xy1(Y,$))}function _o($){return Yg0.map((Y)=>fy1(Y,$))}var Yg0;var vo=m(()=>{Yg0=[{id:"workbuddy",name:"WorkBuddy",rootDirName:".workbuddy"},{id:"claude",name:"Claude",rootDirName:".claude"},{id:"qoder",name:"Qoder",rootDirName:".qoder"}]});var ho=m(()=>{Co();vo();Co();vo()});import{existsSync as uy1,mkdirSync as So,readFileSync as by1,rmSync as iy1,writeFileSync as Ug0}from"node:fs";import{homedir as Qg0}from"node:os";import{dirname as zg0,join as fq}from"node:path";function go(){return Jg0["SKILL.md"]||""}function Ig0($){return $.match(/^\s*version:\s*(\S+)\s*$/m)?.[1]}function Kg0($=fq(bz(),"SKILL.md")){try{return Ig0(by1($,"utf8"))}catch{return}}function bz(){return fq(Qg0(),".agents","skills","seal-use")}function cy1(){return fq(Qg0(),".agents","skills","seal-home")}function dy1(){let $=cy1();if(uy1($))try{return iy1($,{recursive:!0,force:!0}),!0}catch{return!1}return!1}function Gg0($=bz()){dy1(),So($,{recursive:!0});let Y=[];for(let[U,z]of Object.entries(Jg0)){let Q=fq($,U);So(zg0(Q),{recursive:!0}),Ug0(Q,z,"utf8"),Y.push(U)}for(let[U,z]of Object.entries(ny1)){let Q=fq($,U);So(zg0(Q),{recursive:!0}),Ug0(Q,z),Y.push(U)}return{targetDir:$,files:Y}}var Jg0,ny1,CU4;var uq=m(()=>{Ao();Ao();ho();Jg0=pS0,ny1=Object.fromEntries(Object.entries(mS0).map(([$,Y])=>[$,Buffer.from(Y,"base64")]));CU4=Ig0(go())});function Hg0(){return`# Seal Use 系统架构与运行规范白皮书
> 本文档由 \`seal-use\` 单文件二进制程序内嵌提供,纯内存只读,未向用户电脑写入任何临时文件。
@@ -2577,14 +2577,14 @@ flowchart TD
| 目录名称 | 类别 | 规范路径 | 作用与生命周期 |
| :--- | :--- | :--- | :--- |
${ho.map(($)=>`| **${$.name}** | \`${$.category}\` | \`${$.standardPath}\` | ${$.purpose} (${$.retention}) |`).join(`
${yo.map(($)=>`| **${$.name}** | \`${$.category}\` | \`${$.standardPath}\` | ${$.purpose} (${$.retention}) |`).join(`
`)}
---
## 3. 安全与数据隐私保证
${So.map(($,Y)=>`### 3.${Y+1} ${$.topic}
${ko.map(($,Y)=>`### 3.${Y+1} ${$.topic}
- **安全承诺**:${$.guarantee}
- **实现约束**:${$.enforcement}
`).join(`
@@ -2594,7 +2594,7 @@ ${So.map(($,Y)=>`### 3.${Y+1} ${$.topic}
## 4. 业务域能力图谱
${go.map(($)=>`### \`seal-use ${$.domain}\`
${xo.map(($)=>`### \`seal-use ${$.domain}\`
* **能力定位**:${$.summary}
* **核心命令**:${$.primaryCommands.map((Y)=>`\`seal-use ${Y}\``).join("、")}
`).join(`
@@ -2607,14 +2607,14 @@ ${go.map(($)=>`### \`seal-use ${$.domain}\`
- **环境自检**:运行 \`seal-use doctor\`,一键检查当前运行时版本、本地目录健康度、企业资产接入数量以及守护服务状态。
- **查看企业配置源文件**:运行 \`seal-use corps get <corpId>\`,可直接查看指定企业的本地 JSON 存储绝对路径。
- **查阅完整操作手册**:运行 \`seal-use doctor guide\` 随时在离线状态下查看本文档。
`}var ho,So,go;var yo=m(()=>{ho=[{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"}],So=[{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 路径杜绝写文件与环境篡改。"}],go=[{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 Ug0=m(()=>{gp();$3();k3();fq();eB();yo()});var zg0={};B8(zg0,{formatTenantDoctorDashboard:()=>iy1,diagnoseTenantContract:()=>by1});async function by1($,Y){let U=[],z=Y.environment==="test"?"test":"production",Q=z==="test"?Y.prodCorpId:Y.testCorpId,J=z==="test"?"prodParent":"testTarget",I=Q?z==="test"?"已绑定生产母企业 (上游配置与样本源)":"已绑定测试靶场 (下游隔离演练环境)":void 0,K=null,G=null;try{let O=await X8($);if(K=O.user,G=O.tenant,Boolean(K?.isAdmin||K?.permissions?.includes("*")))U.push({id:"auth_identity",name:"身份与权限契约",status:"pass",summary:`已认证为管理员「${K.name??"未知"}」(${K.id??""}),具备完整操作权限`,details:{userId:K.id,userName:K.name,isAdmin:!0,permissionLevel:"超级管理员(具备完整操作权限)",tenantName:G?.name,tenantSlug:G?.tenantSlug,permissions:K.permissions}});else U.push({id:"auth_identity",name:"身份与权限契约",status:"warn",summary:`已认证为普通用户「${K.name??"未知"}」,非超级管理员,部分配置操作可能受限`,details:{userId:K.id,userName:K.name,isAdmin:!1,permissionLevel:"普通用户(部分管理配置受限)",tenantName:G?.name,permissions:K.permissions},recommendation:"建议使用具有管理权限的企业主账号执行规则修改与集成发布"})}catch(O){U.push({id:"auth_identity",name:"身份与权限契约",status:"fail",summary:`鉴权握手失败:${O instanceof Error?O.message:String(O)}`,details:{error:String(O)},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 O=await lY($),M=Array.isArray(O.features)?O.features:[],N=M.find((P)=>P?.code==="ai-approval");if(N){let P=typeof N.balance==="number"?N.balance:0,T=typeof N.deductionAmount==="number"&&N.deductionAmount>0?N.deductionAmount:120,A=Math.floor(P/T);if(H.balance=P,H.deductionAmount=T,H.estimatedRuns=A,P<=0)H.status="exhausted",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"fail",summary:"当前额度已耗尽 (余量 0 点),无法执行审批模拟或回归测试",details:{balance:P,deductionAmount:T,estimatedRuns:A},recommendation:`请前往后台充值补充额度 (可通过 seal-use auth link --corp ${Y.id} 免密直达)`});else if(A<10)H.status="low",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`额度偏低:剩余 ${P} 点 (单笔扣除 ${T} 点),仅可支持约 ${A} 笔审核`,details:{balance:P,deductionAmount:T,estimatedRuns:A},recommendation:`建议补充额度 (可通过 seal-use auth link --corp ${Y.id} 免密直达)`});else H.status="sufficient",U.push({id:"billing_quota",name:"AI 审批额度余量",status:"pass",summary:`额度充裕:剩余 ${P} 点,预估可支持 ${A} 笔审核单据`,details:{balance:P,deductionAmount:T,estimatedRuns:A}})}else U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:"未检索到「ai-approval」功能包额度明细,按默认通道运行",details:{features:M.map((P)=>P?.code)}});let D=M.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(O){U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`读取计费状态失败:${O instanceof Error?O.message:String(O)}`,details:{error:String(O)}})}let X={totalCount:0,activeCount:0,quotaUsed:W.used,quotaRemaining:W.remaining};try{let O=await X6($),M=Array.isArray(O.rules)?O.rules:[];if(X.totalCount=M.length,X.activeCount=M.filter((N)=>N.status==="ACTIVE").length,M.length===0)U.push({id:"rules_status",name:"审核规则状态",status:"warn",summary:"当前租户未配置任何审核规则 (规则数为 0)",details:{totalCount:0,activeCount:0},recommendation:z==="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(O){U.push({id:"rules_status",name:"审核规则状态",status:"fail",summary:`拉取规则列表失败:${O instanceof Error?O.message:String(O)}`,details:{error:String(O)}})}let Z={integrationCount:0,hasReplayChannel:!1,activeWebhookId:void 0};try{let O=await I$($);Z.integrationCount=O.length;let M=O.find((N)=>N.name.includes("回放")||N.name.toLowerCase().includes("replay"));if(Z.hasReplayChannel=Boolean(M),Z.activeWebhookId=M?.id??O[0]?.id,O.length===0)U.push({id:"webhook_integrations",name:"单据推送 Webhook 通道",status:"pass",summary:"未配置任何 Webhook 集成通道 (日常审批无影响;若需自动化系统推流或单据重放将 Line truncated
`)}var Qg0=m(()=>{P6()});async function Jg0($,Y,U){let z=($??Y??"").toLowerCase();if(z==="guide"||z==="doc"||z==="knowledge"||z==="book"){console.error(`\uD83D\uDCD6 [Seal Use Doctor] 正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(aS0());return}if(z==="paths"||z==="dirs"||z==="directories"){let I=ko();x0(I.directories);return}if(z==="auth"){let{selectCorp:I}=await Promise.resolve().then(() => (f4(),ll)),{stringOption:K}=await Promise.resolve().then(() => (A4(),pl)),{handleAuthCommand:G}=await Promise.resolve().then(() => (Mo(),ph0)),H=K(U.options.corp)??(Y&&Y!==z?Y:void 0)??(U.command[2]&&U.command[2]!==z?U.command[2]:void 0),W=I(H);await G("check",W,U);return}if(z==="tenant"||z==="corp"||z==="enterprise"){let{selectCorp:I}=await Promise.resolve().then(() => (f4(),ll)),{createSealClient:K}=await Promise.resolve().then(() => (i8(),U10)),{stringOption:G}=await Promise.resolve().then(() => (A4(),pl)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (Qg0(),zg0)),X=G(U.options.corp)??(Y&&Y!==z?Y:void 0)??(U.command[2]&&U.command[2]!==z?U.command[2]:void 0),Z=I(X),q=await K(Z),V=await H(q,Z);if(!(X0(U.options.quiet)||X0(U.options.silent)))console.error(W(V));x0(V);return}let Q=ko();if(!(X0(U.options.quiet)||X0(U.options.silent)))console.error(Yg0(Q));x0(Q)}var Ig0=m(()=>{Ug0();yo();A4();G4()});var Gg0;var Kg0=m(()=>{Gg0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.37",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 yo,ko,xo;var fo=m(()=>{yo=[{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"}],ko=[{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 路径杜绝写文件与环境篡改。"}],xo=[{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 Vg0=m(()=>{xd();z3();P5();uq();$P();fo()});var Lg0={};P8(Lg0,{formatTenantDoctorDashboard:()=>ay1,diagnoseTenantContract:()=>sy1});async function sy1($,Y){let U=[],z=Y.environment==="test"?"test":"production",Q=z==="test"?Y.prodCorpId:Y.testCorpId,J=z==="test"?"prodParent":"testTarget",I=Q?z==="test"?"已绑定生产母企业 (上游配置与样本源)":"已绑定测试靶场 (下游隔离演练环境)":void 0,K=null,G=null;try{let w=await X8($);if(K=w.user,G=w.tenant,Boolean(K?.isAdmin||K?.permissions?.includes("*")))U.push({id:"auth_identity",name:"身份与权限契约",status:"pass",summary:`已认证为管理员「${K.name??"未知"}」(${K.id??""}),具备完整操作权限`,details:{userId:K.id,userName:K.name,isAdmin:!0,permissionLevel:"超级管理员(具备完整操作权限)",tenantName:G?.name,tenantSlug:G?.tenantSlug,permissions:K.permissions}});else U.push({id:"auth_identity",name:"身份与权限契约",status:"warn",summary:`已认证为普通用户「${K.name??"未知"}」,非超级管理员,部分配置操作可能受限`,details:{userId:K.id,userName:K.name,isAdmin:!1,permissionLevel:"普通用户(部分管理配置受限)",tenantName:G?.name,permissions:K.permissions},recommendation:"建议使用具有管理权限的企业主账号执行规则修改与集成发布"})}catch(w){U.push({id:"auth_identity",name:"身份与权限契约",status:"fail",summary:`鉴权握手失败:${w instanceof Error?w.message:String(w)}`,details:{error:String(w)},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 w=await lY($),N=Array.isArray(w.features)?w.features:[],M=N.find((P)=>P?.code==="ai-approval");if(M){let P=typeof M.balance==="number"?M.balance:0,T=typeof M.deductionAmount==="number"&&M.deductionAmount>0?M.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(w){U.push({id:"billing_quota",name:"AI 审批额度余量",status:"warn",summary:`读取计费状态失败:${w instanceof Error?w.message:String(w)}`,details:{error:String(w)}})}let X={totalCount:0,activeCount:0,quotaUsed:W.used,quotaRemaining:W.remaining};try{let w=await X6($),N=Array.isArray(w.rules)?w.rules:[];if(X.totalCount=N.length,X.activeCount=N.filter((M)=>M.status==="ACTIVE").length,N.length===0)U.push({id:"rules_status",name:"审核规则状态",status:"warn",summary:"当前租户未配置任何审核规则 (规则数为 0)",details:{totalCount:0,activeCount:0},recommendation:z==="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(w){U.push({id:"rules_status",name:"审核规则状态",status:"fail",summary:`拉取规则列表失败:${w instanceof Error?w.message:String(w)}`,details:{error:String(w)}})}let Z={integrationCount:0,hasReplayChannel:!1,activeWebhookId:void 0};try{let w=await K$($);Z.integrationCount=w.length;let N=w.find((M)=>M.name.includes("回放")||M.name.toLowerCase().includes("replay"));if(Z.hasReplayChannel=Boolean(N),Z.activeWebhookId=N?.id??w[0]?.id,w.length===0)U.push({id:"webhook_integrations",name:"单据推送 Webhook 通道",status:"pass",summary:"未配置任何 Webhook 集成通道 (日常审批无影响;若需自动化系统推流或单据重放将 Line truncated
`)}var Fg0=m(()=>{P6()});async function wg0($,Y,U){let z=($??Y??"").toLowerCase();if(z==="guide"||z==="doc"||z==="knowledge"||z==="book"){console.error(`\uD83D\uDCD6 [Seal Use Doctor] 正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(Hg0());return}if(z==="paths"||z==="dirs"||z==="directories"){let I=uo();y0(I.directories);return}if(z==="auth"){let{selectCorp:I}=await Promise.resolve().then(() => (N4(),sl)),{stringOption:K}=await Promise.resolve().then(() => (q4(),ll)),{handleAuthCommand:G}=await Promise.resolve().then(() => (Bo(),US0)),H=K(U.options.corp)??(Y&&Y!==z?Y:void 0)??(U.command[2]&&U.command[2]!==z?U.command[2]:void 0),W=I(H);await G("check",W,U);return}if(z==="tenant"||z==="corp"||z==="enterprise"){let{selectCorp:I}=await Promise.resolve().then(() => (N4(),sl)),{createSealClient:K}=await Promise.resolve().then(() => (R8(),J10)),{stringOption:G}=await Promise.resolve().then(() => (q4(),ll)),{diagnoseTenantContract:H,formatTenantDoctorDashboard:W}=await Promise.resolve().then(() => (Fg0(),Lg0)),X=G(U.options.corp)??(Y&&Y!==z?Y:void 0)??(U.command[2]&&U.command[2]!==z?U.command[2]:void 0),Z=I(X),q=await K(Z),V=await H(q,Z);if(!(H0(U.options.quiet)||H0(U.options.silent)))console.error(W(V));y0(V);return}let Q=uo();if(!(H0(U.options.quiet)||H0(U.options.silent)))console.error(qg0(Q));y0(Q)}var Og0=m(()=>{Vg0();fo();q4();l1()});var Ng0;var Mg0=m(()=>{Ng0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.37",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
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" />
@@ -2638,23 +2638,23 @@ do not control.
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.101/dist/browser/standalone.js"
></script>
</body>
</html>`}var Xg0=m(()=>{$3()});import{URL as cy1}from"node:url";async function h6($,Y,U,z){let Q=$.handler;return Q(Y,U,{corp:z})}async function Zg0($,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",z=$.headers["x-forwarded-proto"]||"http",Q=new cy1($.url||"/",`${z}://${U}`),J=Q.pathname.replace(/\/+$/,"")||"/",I=($.method||"GET").toUpperCase();try{if(I==="GET"&&J==="/"){B4(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(I==="GET"&&J==="/docs"){dy1(Y,200,Wg0());return}if(I==="GET"&&J==="/openapi.json"){B4(Y,200,oT());return}if(I==="GET"&&J==="/health"){B4(Y,200,{status:"ok",version:Z1,name:"seal-use",timestamp:new Date().toISOString()});return}if(I==="POST"&&(J==="/shutdown"||J==="/api/shutdown")){B4(Y,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(I==="POST"&&J==="/api/cli"){let K=await sT($),G=(typeof K?.command==="string"?K.command:"").trim();if(!G){rT(Y,400,"Missing 'command' property in request body");return}let H=uq(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 bq(W),Z=void 0;try{if(X.stdout.trim().startsWith("{")||X.stdout.trim().startsWith("["))Z=JSON.parse(X.stdout)}catch{}B4(Y,X.isError?400:200,{success:!X.isError,stdout:X.stdout,stderr:X.stderr,exitCode:X.exitCode,data:Z});return}if(I==="POST"&&J.startsWith("/api/tool/")){let K=J.slice(10).trim(),G=w6(K);if(!G){rT(Y,404,`Tool not found: '${K}'`);return}let H=await sT($)||{},W=x8($,Q,H),X=j1(W),Z=await P1(X),q={...H};delete q.corp;let V=await h6(G,Z,q,X);B4(Y,200,V);return}if(J.startsWith("/v1/")){if(await py1($,Y,I,J,Q))return}rT(Y,404,`Cannot ${I} ${J}. Visit /docs for available endpoints.`)}catch(K){let G=K instanceof Error?K.message:String(K);rT(Y,500,G)}}async function py1($,Y,U,z,Q){let J=Object.fromEntries(Q.searchParams.entries());if(U==="GET"&&z==="/v1/corps"){let I=a8(),K=v4();return B4(Y,200,{count:I.length,mode:K.stateful?"stateful":"stateless",defaultCorpId:K.defaultCorpId,corps:I.map((G)=>({id:G.id,name:G.name,sourceType:G.source.type,sealUrl:G.seal?.url}))}),!0}if(U==="GET"&&z==="/v1/whoami"){let I=x8($,Q,J),K=j1(I),G=await P1(K),H=w6("seal_whoami"),W=await h6(H,G,{},K);return B4(Y,200,W),!0}if(U==="GET"&&z==="/v1/session"){let I=x8($,Q,J),K=j1(I),G=await P1(K),H=w6("seal_session_get"),W=await h6(H,G,{},K);return B4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/summary"){let I=x8($,Q,J),K=j1(I),G=await P1(K),H=w6("seal_approval_runs_summary"),W=await h6(H,G,J,K);return B4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/stats"){let I=x8($,Q,J),K=j1(I),G=await P1(K),H=w6("seal_approval_runs_stats"),W=await h6(H,G,J,K);return B4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/pick"){let I=x8($,Q,J),K=j1(I),G=await P1(K),H=w6("seal_approval_run_pick"),W=await h6(H,G,J,K);return B4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/url"){let I=x8($,Q,J),K=j1(I),G=await P1(K),H=w6("seal_approval_run_url_get"),W=await h6(H,G,J,K);return B4(Y,200,W),!0}if(z.startsWith("/v1/approval-runs/")){let I=z.slice(18).split("/"),K=I[0],G=I[1];if(K&&!["summary","pick","stats","url","bridge"].includes(K)){let H=x8($,Q,J),W=j1(H),X=await P1(W);if(!G){let Z=w6("seal_approval_run_get"),q=await h6(Z,X,{recordId:K,...J},W);return B4(Y,200,q),!0}if(G==="attachments"){let Z=w6("seal_approval_run_attachments_get"),q=await h6(Z,X,{recordId:K,...J},W);return B4(Y,200,q),!0}if(G==="cited-rules"){let Z=w6("seal_approval_run_cited_rules_get"),q=await h6(Z,X,{recordId:K,...J},W);return B4(Y,200,q),!0}if(G==="document-summary"){let Z=w6("seal_approval_run_document_summary_get"),q=await h6(Z,X,{recordId:K,...J},W);return B4(Y,200,q),!0}if(G==="result"){let Z=w6("seal_approval_run_result_get"),q=await h6(Z,X,{recordId:K,...J},W);return B4(Y,200,q),!0}}}if(U==="GET"&&z==="/v1/approval-runs"){let I=x8($,Q,J),K=j1(I),G=await P1(K),H=w6("seal_approval_runs_search"),W=await h6(H,G,{...J,limit:J.limit?Number(J.limit):void 0,offset:J.offset?Number(J.offset):void 0,includeBridge:J.includeBridge==="true"},K);return B4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval/rules"){let I=x8($,Q,J),K=j1(I),G=await P1(K),H=w6("seal_approval_rules_list"),W=await h6(H,G,J,K);return B4(Y,200,W),!0}if(U==="GET"&&z==="/v1/simulation/batches"){let I=x8($,Q,J),K=j1(I),G=await P1(K),H=w6("seal_simulation_batches_list"),W=await h6(H,G,J,K);return B4(Y,200,W),!0}if(U==="POST"&&z==="/v1/simulation/create-batchLine truncated
</html>`}var Ag0=m(()=>{z3()});import{URL as ey1}from"node:url";async function h6($,Y,U,z){let Q=$.handler;return Q(Y,U,{corp:z})}async function Pg0($,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",z=$.headers["x-forwarded-proto"]||"http",Q=new ey1($.url||"/",`${z}://${U}`),J=Q.pathname.replace(/\/+$/,"")||"/",I=($.method||"GET").toUpperCase();try{if(I==="GET"&&J==="/"){P4(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(I==="GET"&&J==="/docs"){Yk1(Y,200,Bg0());return}if(I==="GET"&&J==="/openapi.json"){P4(Y,200,aT());return}if(I==="GET"&&J==="/health"){P4(Y,200,{status:"ok",version:Z1,name:"seal-use",timestamp:new Date().toISOString()});return}if(I==="POST"&&(J==="/shutdown"||J==="/api/shutdown")){P4(Y,200,{success:!0,message:"Shutting down seal-use background daemon",pid:process.pid}),setTimeout(()=>{process.kill(process.pid,"SIGTERM")},50);return}if(I==="POST"&&J==="/api/cli"){let K=await eT($),G=(typeof K?.command==="string"?K.command:"").trim();if(!G){tT(Y,400,"Missing 'command' property in request body");return}let H=bq(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 iq(W),Z=void 0;try{if(X.stdout.trim().startsWith("{")||X.stdout.trim().startsWith("["))Z=JSON.parse(X.stdout)}catch{}P4(Y,X.isError?400:200,{success:!X.isError,stdout:X.stdout,stderr:X.stderr,exitCode:X.exitCode,data:Z});return}if(I==="POST"&&J.startsWith("/api/tool/")){let K=J.slice(10).trim(),G=O6(K);if(!G){tT(Y,404,`Tool not found: '${K}'`);return}let H=await eT($)||{},W=u8($,Q,H),X=M1(W),Z=await T1(X),q={...H};delete q.corp;let V=await h6(G,Z,q,X);P4(Y,200,V);return}if(J.startsWith("/v1/")){if(await $k1($,Y,I,J,Q))return}tT(Y,404,`Cannot ${I} ${J}. Visit /docs for available endpoints.`)}catch(K){let G=K instanceof Error?K.message:String(K);tT(Y,500,G)}}async function $k1($,Y,U,z,Q){let J=Object.fromEntries(Q.searchParams.entries());if(U==="GET"&&z==="/v1/corps"){let I=t8(),K=h4();return P4(Y,200,{count:I.length,mode:K.stateful?"stateful":"stateless",defaultCorpId:K.defaultCorpId,corps:I.map((G)=>({id:G.id,name:G.name,sourceType:G.source.type,sealUrl:G.seal?.url}))}),!0}if(U==="GET"&&z==="/v1/whoami"){let I=u8($,Q,J),K=M1(I),G=await T1(K),H=O6("seal_whoami"),W=await h6(H,G,{},K);return P4(Y,200,W),!0}if(U==="GET"&&z==="/v1/session"){let I=u8($,Q,J),K=M1(I),G=await T1(K),H=O6("seal_session_get"),W=await h6(H,G,{},K);return P4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/summary"){let I=u8($,Q,J),K=M1(I),G=await T1(K),H=O6("seal_approval_runs_summary"),W=await h6(H,G,J,K);return P4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/stats"){let I=u8($,Q,J),K=M1(I),G=await T1(K),H=O6("seal_approval_runs_stats"),W=await h6(H,G,J,K);return P4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/pick"){let I=u8($,Q,J),K=M1(I),G=await T1(K),H=O6("seal_approval_run_pick"),W=await h6(H,G,J,K);return P4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval-runs/url"){let I=u8($,Q,J),K=M1(I),G=await T1(K),H=O6("seal_approval_run_url_get"),W=await h6(H,G,J,K);return P4(Y,200,W),!0}if(z.startsWith("/v1/approval-runs/")){let I=z.slice(18).split("/"),K=I[0],G=I[1];if(K&&!["summary","pick","stats","url","bridge"].includes(K)){let H=u8($,Q,J),W=M1(H),X=await T1(W);if(!G){let Z=O6("seal_approval_run_get"),q=await h6(Z,X,{recordId:K,...J},W);return P4(Y,200,q),!0}if(G==="attachments"){let Z=O6("seal_approval_run_attachments_get"),q=await h6(Z,X,{recordId:K,...J},W);return P4(Y,200,q),!0}if(G==="cited-rules"){let Z=O6("seal_approval_run_cited_rules_get"),q=await h6(Z,X,{recordId:K,...J},W);return P4(Y,200,q),!0}if(G==="document-summary"){let Z=O6("seal_approval_run_document_summary_get"),q=await h6(Z,X,{recordId:K,...J},W);return P4(Y,200,q),!0}if(G==="result"){let Z=O6("seal_approval_run_result_get"),q=await h6(Z,X,{recordId:K,...J},W);return P4(Y,200,q),!0}}}if(U==="GET"&&z==="/v1/approval-runs"){let I=u8($,Q,J),K=M1(I),G=await T1(K),H=O6("seal_approval_runs_search"),W=await h6(H,G,{...J,limit:J.limit?Number(J.limit):void 0,offset:J.offset?Number(J.offset):void 0,includeBridge:J.includeBridge==="true"},K);return P4(Y,200,W),!0}if(U==="GET"&&z==="/v1/approval/rules"){let I=u8($,Q,J),K=M1(I),G=await T1(K),H=O6("seal_approval_rules_list"),W=await h6(H,G,J,K);return P4(Y,200,W),!0}if(U==="GET"&&z==="/v1/simulation/batches"){let I=u8($,Q,J),K=M1(I),G=await T1(K),H=O6("seal_simulation_batches_list"),W=await h6(H,G,J,K);return P4(Y,200,W),!0}if(U==="POST"&&z==="/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(z)})})}var aT=8787,tT="127.0.0.1";var uo=m(()=>{qg0();$3()});async function Vg0($){let Y=s0($.options.port)??s0($.options.p),U=h($.options.host)??h($.options.h),z=await eT({port:Y,host:U}),Q=()=>{z.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var Lg0=m(()=>{A4();uo()});async function Fg0($,Y,U,z){if($==="config"||$==="get"){await k0("seal_llm_config_get",Y,U,{},E0(z.options));return}if($==="providers"||$==="list"){await k0("seal_llm_providers_list",Y,U,{},E0(z.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}var Og0=m(()=>{f4();G4()});async function wg0($,Y){if($==="config"||$==="json"){bo();return}let{startServer:U}=await Dg0().then(() => Ng0);U()}function bo(){x0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var Mg0=m(()=>{G4()});function Ag0($){let Y=oT();x0(Y,{...E0($.options),allowFull:!0})}var Bg0=m(()=>{xo();G4()});async function Pg0($,Y,U,z){if($==="available"){await k0("seal_permissions_available_list",Y,U,{},E0(z.options));return}if($==="configs"||$==="list"){await k0("seal_permissions_configs_list",Y,U,{},E0(z.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}var Tg0=m(()=>{f4();G4()});import{readFileSync as jg0}from"node:fs";async function Eg0($,Y,U,z,Q,J,I){if(!$||$==="get"){await k0("seal_preference_get",Q,J,{},E0(I.options));return}if($==="decision"){if(Y==="update"||!Y){let K=h(I.options.input),G=K?JSON.parse(jg0(K,"utf8")):D8(I.json);if(!G||Object.keys(G).length===0)throw Error(`Usage: seal-use preference decision update --json '{"explicitApprove":"..."}'`);await k0("seal_preference_decision_update",Q,J,{...G,dryRun:X0(I.options.dryRun)??X0(I.options["dry-run"])},E0(I.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let K=h(I.options.default)??h(I.options.level)??z;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await k0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:K,dryRun:X0(I.options.dryRun)??X0(I.options["dry-run"])},E0(I.options));return}if(Y==="policies"){if(U==="list"||!U){await k0("seal_preference_thinking_depth_policies_list",Q,J,{},E0(I.options));return}if(U==="upsert"){let K=h(I.options.input),G=K?JSON.parse(jg0(K,"utf8")):D8(I.json);if(!G||!G.id||!G.name)throw Error(`Usage: seal-use preference thinking-depth policies upsert --json '{"id":"...","name":"...","level":"high"}'`);await k0("seal_preference_thinking_depth_policies_upsert",Q,J,{...G,dryRun:X0(I.options.dryRun)??X0(I.options["dry-run"])},E0(I.options));return}if(U==="remove"||U==="delete"){let K=z??h(I.options.id)??h(I.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await k0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:K,dryRun:X0(I.options.dryRun)??X0(I.options["dry-run"])},E0(I.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}var Cg0=m(()=>{f4();A4();G4()});async function Rg0($={}){let Y=a8(),U=v4(),z=c2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},g3());console.log(`[probe] corp=${z.id} source=${z.source.type}`);let Q=await iK(z);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await P1(z),I=await _w(J,{documentLimit:20,stylePreferencesEndpoint:z.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:I.rules.rules.length,hasPendingRuleDeletes:I.rules.hasPendingDeletes,documents:I.documents.articles.length,documentsTotal:I.documents.total,stylePreferences:I.stylePreferences.ok?"ok":`error: ${I.stylePreferences.error}`},null,2))}var _g0=m(()=>{k3();i8();cT();P6()});async function vg0($,Y,U){let z=Y??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await Rg0({corpId:z})}var hg0=m(()=>{_g0();A4()});async function io($,Y,U,z,Q){if($==="count"){await k0("seal_approval_rules_list",U,z,{countOnly:!0},E0(Q.options));return}if($==="list"){if(X0(Q.options.count)){await k0("seal_approval_rules_list",U,z,{countOnly:!0},E0(Q.options));return}let J=s0(Q.options.limit),I=s0(Q.options.offset);if(X0(Q.options.summary)){await k0("seal_approval_rules_list",U,z,{fields:s_0,limit:J,offset:I},E0(Q.options));return}let K=await O$("seal_approval_rules_list",U,z,{limit:J,offset:I}),G=E0(Q.options);a_0(K,G.allowFull===!0||Boolean(G.outputFile)),x0(K,G);return}if($==="clear"){let J=X0(Q.options.yes)===!0,I=X0(Q.options.dryRun)??X0(Q.options["dry-run"])??!J;if(!J&&!I)throw A5("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-use rules clear --corp ${z.id} --dry-run`);let K=await O$("seal_approval_rules_clear",U,z,{dryRun:I,recode:X0(Q.options.recode)});if(!J&&I& Line truncated
`).filter(Boolean),J=Q.slice(-Y);return{logFile:U,lines:J,totalLines:Q.length}}async function ay1($){let Y=zj($),U=po($),z=iq($);xg0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):aT),J=$.host??(process.env.HOST?process.env.HOST:tT);Yj(Y,`${process.pid}
`,{mode:384}),Yj(U,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),cK(z,`service starting on http://${J}:${Q} pid=${process.pid}`);let I=null;try{I=await eT({port:Q,host:J,silent:!0}),cK(z,`service listening pid=${process.pid}`)}catch(G){if(cK(z,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),Uj(Y)===process.pid)g9(Y,{force:!0}),g9(U,{force:!0});throw G}let K=()=>{if(I)I.close(),I=null;if(Uj(Y)===process.pid)g9(Y,{force:!0}),g9(U,{force:!0});cK(z,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,K(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function gg0($){xg0($.stateDir);let Y=iz($);if(Y.running)return Y;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},z=[...U.args??[],"service","run"];if($.port)z.push("--port",String($.port));if($.host)z.push("--host",String($.host));let Q=ly1(U.command,z,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=zj($);return Yj(J,`${Q.pid}
`,{mode:384}),cK(iq($),`started pid=${Q.pid}`),{started:!0,...iz($)}}function yg0($,Y={}){let U=zj($),z=po($),Q=Uj(U);if(!Q||!kg0(Q,$.appRoot))return g9(U,{force:!0}),g9(z,{force:!0}),Y.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(Q,"SIGTERM"),g9(U,{force:!0}),g9(z,{force:!0}),cK(iq($),`stop requested pid=${Q}`),Y.quiet?void 0:{stopped:!0,pid:Q}}function kg0($,Y){if(!ty1($))return!1;try{let U=oy1("ps",["-p",String($),"-o","command="],{encoding:"utf8"}),z=U.trim().split(/\s+/).filter(Boolean),Q=z.indexOf("service"),J=Q!==-1&&z[Q+1]==="run",I=U.includes(Y)||z.some((K)=>/(^|[\\/])(seal-use|seal-home)(\.exe)?$/.test(K));return J&&I}catch{return!1}}function ty1($){try{return process.kill($,0),!0}catch{return!1}}function zj($){return co($.stateDir,"service.pid")}function po($){return co($.stateDir,"service.json")}function iq($){return co($.stateDir,"service.log")}function Uj($){if(!$j($))return;let Y=Number(no($,"utf8").trim());return Number.isInteger(Y)&&Y>0?Y:void 0}function xg0($){ry1($,{recursive:!0,mode:448})}function cK($,Y){Yj($,`${new Date().toISOString()} ${Y}
`,{flag:"a",mode:384})}var mo=m(()=>{uo()});import{homedir as ey1}from"node:os";import{join as $k1}from"node:path";async function oo($,Y,U){let z=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,I=await r3($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:lo,version:Z1,launcher:Y.launcher,port:z,host:Q},{maxLines:J});if(I!==void 0)x0(I)}var lo;var ro=m(()=>{$3();mo();G4();A4();lo=$k1(ey1(),".config","seal-use")});import{existsSync as Yk1,readFileSync as fg0}from"node:fs";async function ug0($,Y,U,z,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 k0("seal_simulation_batch_records_get",U,z,{batchId:J,query:h(Q.options.query)},E0(Q.options));return}if($==="create"||$==="run"){let J=h(Q.options.mode)??h(Q.options.sourceSystem)??h(Q.options["source-system"])??"hosecloud",I=J==="material-pack"?"material_pack":J,K=h(Q.options.schemaConfig)??h(Q.options["schema-config"]),G=K?JSON.parse(fg0(K,"utf8")):void 0,H=h(Q.options.input),W=H?JSON.parse(fg0(H,"utf8")):D8(Q.json),X=h(Q.options.packageId)??h(Q.options["package-id"]),Z=i6(Q.options.packageIds)??i6(Q.options["package-ids"])??(X?[X]:void 0),q=i6(Q.options.flowIds)??i6(Q.options["flow-ids"])??i6(Q.options.documentSn)??i6(Q.options["document-sn"]),V=h(Q.options.signKey)??h(Q.options["sign-key"])??h(Q.options.integration),F=X0(Q.options.wait)===!0,w=X0(Q.options.noWait)??X0(Q.options["no-wait"])??(F?!1:!0),O=await O$("seal_simulation_batch_create",U,z,{mode:I,sourceSystem:I,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:X0(Q.options.skipInvoiceGeneration)??X0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:X0(Q.options.skipExpenseExtraction)??X0(Q.options["skip-expense-extraction"]),disableAttachmentCache:X0(Q.options.disableAttachmentCache)??X0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:h(Q.options.templateId)??h(Q.options["template-id"]),schemaConfig:G,requestIds:i6(Q.options.requestIds)??i6(Q.options["request-ids"]),workflowTypeId:h(Q.options.workflowTypeId)??h(Q.options["workflow-type-id"]),flowStatusList:i6(Q.options.flowStatusList)?.map(Number)??i6(Q.options["flow-status-list"])?.map(Number),businessCodes:i6(Q.options.businessCodes)??i6(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:i6(Q.options.status),limit:s0(Q.options.limit),noWait:w,rawParams:W});if(F&&O&&typeof O==="object"&&"batchId"in O&&typeof O.batchId==="string"){await k0("seal_simulation_batch_wait",U,z,{batchId:O.batchId,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},E0(Q.options));return}x0(O,E0(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 k0("seal_simulation_batch_wait",U,z,{batchId:J,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},E0(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 k0("seal_simulation_batch_status",U,z,{batchId:J},E0(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 k0("seal_simulation_batch_clean",U,z,{batchId:J},E0(Q.options));return}if($==="specifications"){let J=Y??h(Q.options.integration)??h(Q.options.signKey)??h(Q.options["sign-key"]);await k0("seal_simulation_specifications_list",U,z,{signKey:J},E0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await k0("seal_simulation_feishu_approval_definitions_list",U,z,{},E0(Q.options));return}if($==="list"){await k0("seal_simulation_batches_list",U,z,{limit:s0(Q.options.limit)},E0(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 k0("seal_simulation_batch_get",U,z,{batchId:J},E0(Q.options));return}if($==="templates"){await k0("seal_simulation_templates_get",U,z,{},E0(Q.options));return}if($==="integrations"){await k0("seal_simulation_integrations_get",U,z,{},E0(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(!Yk1(J))throw Error(`File not found: ${J}`);await k0("seal_simulation_material_package_upload",U,z,{filePath:J},E0(Q.o Line truncated
`);return}if($==="install"||$==="init"||$==="sync"){let z=X0(U.options.local)||X0(U.options.workspace),Q=h(U.options.dir)??h(U.options.target)??Y,J=Q?Q:z?Qj(process.cwd(),".agents","skills","seal-use"):bz(),I=sS0(J),K=!z&&!Q,G=K?Bo():void 0,H=K?jo():void 0;x0({installed:!0,targetDir:I.targetDir,fileCount:I.files.length,files:I.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let z=bz(),Q=Qj(process.cwd(),".agents","skills","seal-use"),J=Po(),I=Eo();x0({global:{dir:z,installed:ig0(Qj(z,"SKILL.md"))},local:{dir:Q,installed:ig0(Qj(Q,"SKILL.md"))},antigravity:J,hosts:I});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}var cg0=m(()=>{Ro();fq();A4();G4()});async function pg0($,Y){if($==="config"){x0(await iK(Y));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}var dg0=m(()=>{cT();G4()});function so($){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 mg0($){let{sourceCorp:Y,targetCorp:U,sourceClient:z,targetClient:Q,samples:J=10,dryRun:I=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw new L4(`重放目标企业「${U.name}」(${U.id}) 的环境为「${U.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${Y.id} <testCorpId>`);let X=await lY(Q),q=(Array.isArray(X.features)?X.features:[]).find((d)=>d?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,F=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,w=J*F;if(V<w)throw new L4(`测试企业「${U.name}」AI 审批额度不足:当前剩余 ${V} 点,本次回归抽样 ${J} 笔需要约 ${w} 点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${U.id}」充值 AI 审批额度,或降低抽样笔数 (--samples ${Math.max(1,Math.floor(V/F))})`);let O=await i4(z,{limit:J,status:"completed"}),M=Array.isArray(O.records)?O.records:[];if(M.length===0){let d=await i4(z,{limit:J});M=Array.isArray(d.records)?d.records:[]}if(M.length===0)throw new L4(`在母企业「${Y.name}」(${Y.id}) 中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(M=M.slice(0,J),I){let d=M.map((t)=>{let e=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,p=so(g),Y0=t?.result?.summary??t.aiSummary;return{sn:e,sourceRecordId:t.id,prodDecision:p,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:F,estimatedRequired:w},metrics:{sampleCount:d.length,successCount:d.length,failureCount:0,matchCount:d.length,flipCount:0,concordanceRate:1},flips:[],records:d}}let N=await Ep(Q,U,$.webhookSelector),D=[];for(let d of M){let t=Date.now(),e=d.sourceDocumentSN??d.id,g=so(d?.result?.decision??d.aiDecision??d?.decision),p=d?.result?.summary??d.aiSummary;try{let Y0=await W4(z,d.id),y=`${H}${e}`,r=Tp(Y0,{snPrefix:H,docIdPrefix:H});await jp(N.incomingDocumentWebhook.url,N.secret,r,W,A6(U.seal));let $0=null,N0=Date.now();while(Date.now()-N0<G){await new Promise((H0)=>setTimeout(H0,K));let s=await i4(Q,{sourceDocumentSN:y,limit:1});if(s.records&&s.records.length>0){let H0=s.records[0];if(H0.status==="completed"||H0.status==="failed"){$0=H0;break}}}if(!$0){D.push({sn:e,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:`测试租户单据审核超时 (${Math.round(G/1000)}s 未完成)`,durationMs:Date.now()-t});continue}let j0=so($0?.result?.decision??$0.aiDecision??$0?.decision??($0.status==="completed"?"APPROVE":"ERROR")),_0=$0?.result?.summary??$0.aiSummary,G0=g===j0,f0=G0?"MATCHED":"FLIPPED",e0={sn:e,sourceRecordId:d.id,prodDecision:g,prodSummary:p,testRecordId:$0.id,testDecision:j0,testSummary:_0,status:f0,durationMs:Date.now()-t};if(!G0)e0.diff={from:g,to:j0,reasonDiff:_0&&p&&_0!==p?`生产: ${p.slice(0,60)}... -> 测试: ${_0.slice(0,60)}...`:void 0};D.push(e0)}catch(Y0){D.push({sn:e,sourceRecordId:d.id,prodDecision:g,prodSummary:p,status:"FAILED",error:Y0 instanceof Error?Y0.message:String(Y0),durationMs:Date.now()-t})}}let P=D.filter((d)=>d.status==="MATCHED"||d.status==="FLIPPED"),T=D.filter((d)=>d.status==="MATCHED"),A=D.filter((d)=>d.status==="FLIPPED"),j=D.filter((d)=>d.status==="FAILED").length,C=T.length,b=A.length,k=C+b,S=k>0?C/k:0,i=b>0,n=i?"REGRESSIONS_DETECTED":"CLEAN",z0=!i&&j===0,x;try{let d=await lY(Q),e=(Array.isArray(d.features)?d.features:[]).find((g)=>g?.code==="ai-approval");if(typeof e?.balance==="number")x=e.balance}catch{}return{ok:!i&&j===0,verdict:n,safeToPublish:z0,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:F,estimatedRequired:w,balanceAfter:x},metrics:{sampleCount:D.length,successCount:P.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(S.toFixed(4))},flips:A,records:D}}function lg0($){let{sourceCorp:Y,targetCorp:U,verdict:z,safeToPublish:Q,metrics:J,quota:I,flips:K,records:G}=$,H=z==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":z==="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)}% | 消耗预估: ${I.estimatedRequired} 点 (余量: ${I.balanceBefore}${I.balanceAfter!==void 0?` -> ${I.balanceAfter}`:""})`," "+"─".repeat(65)];if(K.length>0){W.push(` ⚠️ 决策翻转清单 (${K.length} 笔单据在新规则下结果改变):`);for(let X of K)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(z==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% Line truncated
`)}var og0=m(()=>{F$();P6();bZ()});async function ao($,Y,U){let z=($??Y??"regression").toLowerCase();if(z==="regression"||z==="regress"||z==="matrix"){let Q=h(U.options.corp)??(Y&&Y!==z?Y:void 0),J=j1(Q),I=J,K=J;if(J.environment==="test"){K=J;let N=h(U.options["prod-corp"])??h(U.options.prod)??J.prodCorpId;if(!N)throw new L4(`测试企业「${J.name}」(${J.id}) 未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-use corps bind-test <prodCorpId> ${J.id}`);I=j1(N)}else{I=J;let N=h(U.options["test-corp"])??h(U.options.test)??J.testCorpId;if(!N)throw new L4(`生产企业「${J.name}」(${J.id}) 未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${J.id} <testCorpId>`);K=j1(N)}let G=await P1(I),H=await P1(K),W=s0(U.options.samples)??s0(U.options.limit)??s0(U.options.n)??10,X=X0(U.options["dry-run"]),Z=X0(U.options["fail-on-flips"]),q=s0(U.options["poll-interval"])??2000,V=s0(U.options.timeout)??45000,F=h(U.options["sn-prefix"])??"REG_",w=h(U.options.webhook)??h(U.options.selector),O=await mg0({sourceCorp:I,targetCorp:K,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z,webhookSelector:w});if(!(X0(U.options.quiet)||X0(U.options.silent)))console.error(lg0(O));if(x0(O),Z&&!O.ok)throw new L4(`回归测试发现 ${O.metrics.flipCount} 笔单据决策翻转,已按 --fail-on-flips 策略非零终止。`,1);return}throw new L4(`未知的 test 子命令: "${z}"。
可用子命令: seal-use test regression [--corp <id>] [--samples <N>] [--dry-run]`,2,"seal-use test regression --help")}var rg0=m(()=>{F$();f4();A4();G4();i8();og0()});async function sg0($,Y,U,z){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await k0($,Y,U,D8(z.json),E0(z.options))}var ag0=m(()=>{f4();A4();G4()});function tg0(){x0(Bq.map(($)=>({name:$.name,description:$.description})))}var eg0=m(()=>{Tq();G4()});function Jj($=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 $y0=m(()=>{fq()});import{existsSync as Uk1,mkdirSync as zk1,readFileSync as Qk1,renameSync as Jk1,writeFileSync as Ik1}from"node:fs";import{homedir as Kk1}from"node:os";import{dirname as Gk1,join as Hk1}from"node:path";import{spawn as Wk1}from"node:child_process";function Yy0($){return $.replace(/\.\d+Z$/,"Z")}function Uy0(){let $=process.env[Xk1]?.trim();if($)return $;return qk1}function zy0($=Uy0()){if(!Uk1($))return null;try{let Y=Qk1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&typeof U.latestVersion==="string"&&typeof U.checkedAt==="string")return{...U,checkedAt:Yy0(U.checkedAt)};return null}catch{return null}}function nq($,Y=Uy0()){try{let U=Gk1(Y);zk1(U,{recursive:!0,mode:448});let z={checkedAt:Yy0($.checkedAt??new Date().toISOString()),latestVersion:$.latestVersion,publishedAt:$.publishedAt,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;Ik1(Q,JSON.stringify(z,null,2),{mode:384}),Jk1(Q,Y)}catch{}}function Qy0($,Y=Zk1){if(!$||!$.checkedAt)return!0;let U=new Date($.checkedAt).getTime();if(Number.isNaN(U))return!0;return Date.now()-U>Y}function Jy0($){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 Wk1(Y,U,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var Xk1="SEAL_USE_UPDATE_CACHE_FILE",Zk1=86400000,qk1;var to=m(()=>{qk1=Hk1(Kk1(),".config","seal-use","update-cache.json")});import{chmodSync as Vk1,mkdirSync as Lk1,readdirSync as Fk1,realpathSync as Iy0,renameSync as eo,rmSync as Ok1,unlinkSync as Xy0,writeFileSync as Ky0}from"node:fs";import{basename as wk1,dirname as Mk1,isAbsolute as Nk1,join as Gj,relative as Dk1}from"node:path";import{spawn as Ak1,spawnSync as s3}from"node:child_process";async function qy0($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:lo,version:Z1,launcher:$.launcher},z=Y.repo||process.env[Bk1]?.trim()||process.env[Pk1]?.trim()||Zy0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=Oy0(D,Z1);if(P<0)if(!Yg&&Y.force);else{x0({updated:!1,currentVersion:Z1,targetVersion:D,mode:Jj()?"binary":"source",message:!Yg?`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){x0({updated:!1,currentVersion:Z1,targetVersion:D,mode:Jj()?"binary":"source",message:`seal-use is already at version v${Z1}. Use --force to reinstall.`});return}}if(Y.changelogOnly){let D=await Kj(z,Y.limit??10);x0({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:_5(P.version,Z1)}))});return}if(!Jj()){if(Y.checkOnly){let P=await Kj(z,30),T=P[0],A=T?.version??Z1,j=P.find((k)=>k.version===Z1),C=_5(A,Z1),b=P.filter((k)=>_5(k.version,Z1));if(T?.version)nq({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;x0({updated:!1,updateAvailable:C,currentVersion:Z1,currentVersionPublishedAt:j?.publishedAt,latestVersion:A,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.map((k)=>({version:k.version,tagName:k.tagName,publishedAt:k.publishedAt,author:k.author,releaseNotes:k.notes,releaseUrl:k.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"当前运行的是开发版。正式用户请安装正式版后使用 seal-use update。"});return}let D=iz(U).running;if(D)await r3("stop",U);try{Wy0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`⚠️ 开发版更新同步失败,继续刷新本地依赖: ${P instanceof Error?P.message:String(P)}`)}if(Wy0("bun",["install"],{cwd:$.appRoot}),D)await r3("start",U);x0({updated:!0,serviceRestarted:D,version:Z1,mode:"source"});return}if(Rk1())try{await _k1($,Y,U,z,J);return}catch(D){console.error(`⚠️ Homebrew 自动更新失败,回退至原生二进制更新: ${D instanceof Error?D.message:String(D)}`)}let I=jk1(),K=Ek1(),G=await Kj(z,30),H=J?G.find((D)=>D.version Line truncated
`)}catch{}}async function Sk1($,Y,U,z){let Q=$r(),J=[],I=U?U.startsWith("v")?U:`v${U}`:void 0,K=z||$.split("/").pop()||"";if(Q!=="github"){if(I&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${I}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${I}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(I&&K){let F=`https://github.com/${Zy0}/releases/download/${I}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${F}`,`https://gh.ddlc.top/${F}`);J.push(F)}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 F=0;F<G.length;F++){let w=G[F],O=new AbortController,M="",N=(A)=>{M=A;try{O.abort()}catch{}},D=setTimeout(()=>{N("Connection timed out (no response headers within 6s)")},W),P,T;try{Ij(`==> [${F+1}/${G.length}] Downloading via: ${w}`);let A=await fetch(w,{signal:O.signal});if(D)clearTimeout(D),D=void 0;if(!A.ok)throw Error(`HTTP ${A.status} ${A.statusText}`);P=setTimeout(()=>{N("Overall download time exceeded 3 minutes")},V);let j=Number(A.headers.get("content-length"))||0,C=A.body?.getReader();if(!C){let n=Buffer.from(await A.arrayBuffer());if(n.length<1000)throw Error(`Downloaded content is suspiciously small (${n.length} bytes)`);Ky0(Y,n),Ij(`✓ Download succeeded (${(n.length/1024/1024).toFixed(1)} MB)`);return}let b=[],k=0,S=0;T=setTimeout(()=>{if(k<Z){let n=(k/1024).toFixed(1);N(`Initial transfer too slow (${n} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let n=C.read(),z0,x=new Promise((g,p)=>{z0=setTimeout(()=>{p(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),d;try{d=await Promise.race([n,x])}finally{if(z0)clearTimeout(z0)}let{done:t,value:e}=d;if(t)break;if(e){if(b.push(e),k+=e.length,T&&k>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-S>200){S=g;let p=j?Math.round(k/j*100):0,Y0=(k/1048576).toFixed(1),y=j?(j/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${p}% (${Y0} / ${y} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let i=Buffer.concat(b);if(i.length<1000)throw Error(`Downloaded content is suspiciously small (${i.length} bytes)`);Ky0(Y,i),Ij(`✓ Download completed successfully (${(i.length/1024/1024).toFixed(1)} MB)`);return}catch(A){if(D)clearTimeout(D);if(T)clearTimeout(T);if(P)clearTimeout(P);let j=M||(A instanceof Error?A.message:String(A));H=Error(j),Ij(`
↳ 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 Ly0($){let Y;try{Y=Fk1($,{withFileTypes:!0})}catch{return[]}let U=[];for(let z of Y){let Q=Gj($,z.name);if(z.isDirectory())U.push(...Ly0(Q));else if(z.isFile())U.push(Q)}return U}function Fy0($,Y,U){let z=Y==="windows"?"seal-use.exe":"seal-use",Q=Ly0($);return Q.find((J)=>wk1(J)===z)??Q[0]??U}function gk1($,Y,U){let z=s3("tar",["-xzf",$,"-C",Y],{stdio:"pipe"});if(z.status!==0)throw Error(`Failed to extract tar archive: ${z.stderr.toString()}`);return Xy0($),Fy0(Y,U,$)}function yk1($,Y,U){let z=s3("unzip",["-q","-o",$,"-d",Y],{stdio:"pipe"});if(z.status!==0)throw Error(`Failed to extract zip archive: ${z.stderr.toString()}`);return Xy0($),Fy0(Y,U,$)}function Oy0($,Y){let U=$.replace(/^v/,"").split(".").map((Q)=>Number.parseInt(Q,10)||0),z=Y.replace(/^v/,"").split(".").map((Q)=>Number.parseInt(Q,10)||0);for(let Q=0;Q<Math.max(U.length,z.length);Q++){let J=U[Q]??0,I=z[Q]??0;if(J>I)return 1;if(J<I)return-1}return 0}function _5($,Y){return Oy0($,Y)>0}function Wy0($,Y,U={}){let z=s3($,Y,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(z.stdout)console.error(z.stdout.trimEnd());if(z.stderr)console.error(z.stderr.trimEnd());if(z.status!==0)throw Error(`${$} ${Y.join(" ")} failed with status ${z.status}`)}var Zy0="yunyingk/seal-use",cq="yunyingk/seal-home",Bk1="SEAL_USE_GITHUB_REPO",Pk1="SEAL_HOME_GITHUB_REPO";var wy0=m(()=>{$y0();fq();to();$3();mo();G4();ro()});async function My0($,Y,U,z,Q){if($==="create"){let J=h(Q.options.name)??Y,I=h(Q.options.phone);if(!J||!I)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let K=h(Q.options.dept)??h(Q.options.departmentId);await k0("seal_user_create",U,z,{name:J,phone:I,departmentIds:K?[K]:void 0},E0(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 k0("seal_user_reset_password",U,z,{userId:J},E0(Q.options));return}if($==="search"||$==="list"){let J=Y??h(Q.options.keyword)??h(Q.options.query)??"";await k0("seal_user_search",U,z,{keyword:J},E0(Q.options));return}if($==="get"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users get <userId>");await k0("seal_user_get",U,z,{userId:J},E0(Q.options));return}if($==="delete"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users delete <userId>");await k0("seal_user_delete",U,z,{userId:J},E0(Q.options));return}if($==="activate"){let J=Y??h(Q.options.userId);if(!J)throw Error("Usage: seal-use users activate <userId>");await k0("seal_user_activate",U,z,{userId:J},E0(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 I=h(Q.options.note);await k0("seal_user_delegation_create",U,z,{userIdOrPhone:J,note:I},E0(Q.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}var Ny0=m(()=>{f4();A4();G4()});import{dirname as Yr,join as kk1}from"node:path";import{fileURLToPath as xk1}from"node:url";function ik1($){if(!$.length)return!1;let Y=$[0]?.toLowerCase(),U=$[1]?.toLowerCase();if(Y&&bk1.has(Y))return!0;if((Y==="service"||Y==="daemon")&&U==="run")return!0;return!1}function bq($,Y={}){if(ik1($))return By0($,Y);let U=Ay0.then(()=>By0($,Y));return Ay0=U.then(()=>{return},()=>{return}),U}async function By0($,Y){let U=[],z=[],Q=console.log,J=console.error,I={appRoot:Y.appRoot??Dy0,entryFile:Y.entryFile??kk1(Y.appRoot??Dy0,"src","cli.ts"),launcher:Y.launcher};console.log=(...K)=>{U.push(ml(K))},console.error=(...K)=>{z.push(ml(K))};try{return await nk1($,I),{stdout:Cq(U),stderr:Cq(z),isError:!1,exitCode:0}}catch(K){let G=Rq(K instanceof Error?K.message:String(K)),H=uZ(K);if(z.push(G),H.nextAction&&!G.includes("Next action:"))z.push(`\uD83D\uDC49 Next action: ${H.nextAction}`);return{stdout:Cq(U),stderr:Cq(z),isError:!0,exitCode:H.exitCode}}finally{console.log=Q,console.error=J}}async function nk1($,Y){let U=jq($),[z,Q,J]=U.command,I=z?.toLowerCase(),K=I?fk1.has(I):!1,G=K?"update":I;if(G==="version"||G==="v"||Boolean(U.options.version)||Boolean(U.options.v)||Boolean(U.options.V)){let Z=zy0(),q=Z?.latestVersion?_5(Z.latestVersion,dY.version):!1,V={...dY,...Z?.latestVersion?{latestVersion:Z.latestVersion,updateAvailable:q,lastCheckedAt:Z.checkedAt}:{}};if(q&&Z?.latestVersion)console.error(`\uD83D\uDCA1 发现新版本可用: v${dY.version} -> v${Z.latestVersion}`),console.error(`\uD83D\uDC49 Next action: seal-use update
`);if(x0(V),Qy0(Z))Jy0(Y.launcher);return}let H=o_0(U);if(H.isHelp){t_0(H.target);return}if(!G||!uk1.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 $v0(Z,fK(U.options));return}if(G==="openapi"){Ag0(U);return}if(G==="mcp-config"){bo();return}if(G==="skill"){ng0(Q,J,U);return}if(G==="mcp"||G==="server"){await wg0(Q,U);return}if(G==="probe"){await vg0(Q,J,U);return}if(G==="doctor"){await Jg0(Q,J,U);return}if(G==="test"){await ao(Q,J,U);return}if(G==="config"){lh0(Q,J,U);return}if(G==="service"){await oo(Q,Y,U);return}if(G==="stop"){await oo("stop",Y,U);return}if(G==="http"||G==="serve"){await Vg0(U);return}if(K||G==="changelog"){if(K&&z!=="update")console.error(`⚠️ Notice: '${z}' 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"||X0(U.options.changelog)===!0,V=Z==="check"||X0(U.options.check)===!0||X0(U.options["check-only"])===!0,F=X0(U.options["bg-save"])===!0||X0(U.options["silent-save"])===!0,w=h(U.options.version)??h(U.options.tag)??(!q&&!V&&!F&&Q&&!Q.startsWith("-")?Q:void 0);await qy0(Y,{checkOnly:V||F,changelogOnly:q,limit:s0(U.options.limit),force:X0(U.options.force),targetVersion:w,repo:h(U.options.repo),bgSave:F});return}if(G==="tools"&&Q==="list"){tg0();return}if(G==="corps"||G==="corp"){if(Q==="regression"||Q==="test-regression"){await ao("regression",J,U);return}await yh0(Q,J,U);return}if(G==="rules"&&Q==="lint"&&(("file"in U.options)||("f"in U.options))){let Z;try{Z=j1(h(U.options.corp))}catch{Z={id:"local",name:"Local Workspace",source:{type:"native"}}}await io(Q,J,null,Z,U);return}if(G==="auth"&&(Q==="extract-keys"||Q==="extract-key"||Q==="extract-hose-keys"||Q==="hose-extract-keys")){await wo(J,U);return}if(G==="auth"&&(Q==="link"||Q==="seal-link")&&(("from-link"in U.options)||J==="from-link")){await mT(Q,null,U);return}let W=j1(h(U.options.corp));if(G==="source"){await pg0(Q,W);return}if(G==="auth"){await mT(Q,W,U);return}let X=await P1(W);if(G==="users"){await My0(Q,J,X,W,U);return}if(G==="contacts"){await rh0(Q,J,X,W,U);return}if(G==="data"){await ah0(Q,X,W,U);return}if(G==="llm"){await Fg0(Q,X,W,U);return}if(G==="permissions"){await Pg0(Q,X,W,U);return}if(G==="billing"){await dh0(Q,X,W,U);return}if(G==="webhook"||G==="webhooks"){await ST(Q,J,X,W,U);return}if(G==="context"){await eh0(X,W,U);return}if(G==="rules"){await io(Q,J,X,W,U);return}if(G==="approval-runs"){await Yv0(Q,J,X,W,U);return}if(G==="analytics"){await zv0(Q,J,X,W,U);return}if(G==="simulation"){await ug0(Q,J,X,W,U);return}if(G==="deploy"){await YS0(Q,J,U.command[3],X,W,U);return}if(G==="preference"||G==="preferences"){await Eg0(Q,J,U.command[3],U.command[4],X,W,U);return}if(G==="tool"){await sg0(Q,X,W,U);return}throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`)}var Dy0,fk1,uk1,bk1,Ay0;var fo=m(()=>{i8();$3();Uv0();Qv0();Mo();mh0();oh0();sh0();th0();$S0();Lo();US0();Ig0();Lg0();Og0();Mg0();Bg0();Tg0();Cg0();hg0();Sg0();ro();bg0();cg0();dg0();rg0();ag0();eg0();wy0();to();Ny0();ol();F$();f4();A4();dl();G4();Dy0=Yr(Yr(Yr(xk1(import.meta.url)))),fk1=new Set(["update","upgrade","up","self-update","selfupdate"]),uk1=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"]),bk1=new Set(["http","server","web","mcp"]);Ay0=Promise.resolve()});function mk1($){let{command:Y}=jq($),U=(Y[0]??"").toLowerCase();return{area:ck1[U]??U,actionTokens:Y.slice(1).map((z)=>z.toLowerCase())}}function Py0($){let Y,U;try{({area:Y,actionTokens:U}=mk1($))}catch{return!1}if(U.length===0&&dk1.has(Y))return!0;if(Y==="tool"){let Q=U[0];return Q!==void 0&&x_0(Q)}let z=pk1[Y];if(!z)return!1;return z.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((I,K)=>I===U[K])})}var ck1,pk1,dk1;var Ty0=m(()=>{Tq();A4();ck1={corp:"corps",webhooks:"webhook",preferences:"preference"},pk1={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
`);Q(z)})})}var $j=8787,Yj="127.0.0.1";var no=m(()=>{Tg0();z3()});async function jg0($){let Y=s0($.options.port)??s0($.options.p),U=h($.options.host)??h($.options.h),z=await Uj({port:Y,host:U}),Q=()=>{z.close(()=>{process.exit(0)})};process.on("SIGINT",Q),process.on("SIGTERM",Q),await new Promise(()=>{})}var Eg0=m(()=>{q4();no()});async function Cg0($,Y,U,z){if($==="config"||$==="get"){await x0("seal_llm_config_get",Y,U,{},E0(z.options));return}if($==="providers"||$==="list"){await x0("seal_llm_providers_list",Y,U,{},E0(z.options));return}throw Error(`Unknown llm command: ${$??""}. Run 'seal-use help' for available commands.`)}var Rg0=m(()=>{N4();l1()});async function _g0($,Y){if($==="config"||$==="json"){co();return}let{startServer:U}=await Sg0().then(() => hg0);U()}function co(){y0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}var vg0=m(()=>{l1()});function gg0($){let Y=aT();y0(Y,{...E0($.options),allowFull:!0})}var yg0=m(()=>{bo();l1()});async function kg0($,Y,U,z){if($==="available"){await x0("seal_permissions_available_list",Y,U,{},E0(z.options));return}if($==="configs"||$==="list"){await x0("seal_permissions_configs_list",Y,U,{},E0(z.options));return}throw Error(`Unknown permissions command: ${$??""}. Run 'seal-use help' for available commands.`)}var xg0=m(()=>{N4();l1()});import{readFileSync as fg0}from"node:fs";async function ug0($,Y,U,z,Q,J,I){if(!$||$==="get"){await x0("seal_preference_get",Q,J,{},E0(I.options));return}if($==="decision"){if(Y==="update"||!Y){let K=h(I.options.input),G=K?JSON.parse(fg0(K,"utf8")):B8(I.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:H0(I.options.dryRun)??H0(I.options["dry-run"])},E0(I.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(Y==="set"){let K=h(I.options.default)??h(I.options.level)??z;if(K!=="medium"&&K!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await x0("seal_preference_thinking_depth_set",Q,J,{defaultLevel:K,dryRun:H0(I.options.dryRun)??H0(I.options["dry-run"])},E0(I.options));return}if(Y==="policies"){if(U==="list"||!U){await x0("seal_preference_thinking_depth_policies_list",Q,J,{},E0(I.options));return}if(U==="upsert"){let K=h(I.options.input),G=K?JSON.parse(fg0(K,"utf8")):B8(I.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:H0(I.options.dryRun)??H0(I.options["dry-run"])},E0(I.options));return}if(U==="remove"||U==="delete"){let K=z??h(I.options.id)??h(I.options.policyId);if(!K)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await x0("seal_preference_thinking_depth_policies_remove",Q,J,{policyId:K,dryRun:H0(I.options.dryRun)??H0(I.options["dry-run"])},E0(I.options));return}}}throw Error(`Unknown preference action: ${$??""}. Available: get, decision update, thinking-depth set, thinking-depth policies list/upsert/remove.`)}var bg0=m(()=>{N4();q4();l1()});async function ig0($={}){let Y=t8(),U=h4(),z=c2(Y,{stateful:U.stateful,defaultCorpId:U.defaultCorpId,corpId:$.corpId},x3());console.log(`[probe] corp=${z.id} source=${z.source.type}`);let Q=await uK(z);console.log("[probe] seal enterprise"),console.log(JSON.stringify(Q,null,2));let J=await T1(z),I=await vO(J,{documentLimit:20,stylePreferencesEndpoint:z.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:I.rules.rules.length,hasPendingRuleDeletes:I.rules.hasPendingDeletes,documents:I.documents.articles.length,documentsTotal:I.documents.total,stylePreferences:I.stylePreferences.ok?"ok":`error: ${I.stylePreferences.error}`},null,2))}var ng0=m(()=>{P5();R8();kT();P6()});async function cg0($,Y,U){let z=Y??h(U.options.corp)??($&&$!=="--corp"?$:void 0);await ig0({corpId:z})}var dg0=m(()=>{ng0();q4()});async function po($,Y,U,z,Q){if($==="count"){await x0("seal_approval_rules_list",U,z,{countOnly:!0},E0(Q.options));return}if($==="list"){if(H0(Q.options.count)){await x0("seal_approval_rules_list",U,z,{countOnly:!0},E0(Q.options));return}let J=s0(Q.options.limit),I=s0(Q.options.offset);if(H0(Q.options.summary)){await x0("seal_approval_rules_list",U,z,{fields:e_0,limit:J,offset:I},E0(Q.options));return}let K=await O$("seal_approval_rules_list",U,z,{limit:J,offset:I}),G=E0(Q.options);$v0(K,G.allowFull===!0||Boolean(G.outputFile)),y0(K,G);return}if($==="clear"){let J=H0(Q.options.yes)===!0,I=H0(Q.options.dryRun)??H0(Q.options["dry-run"])??!J;if(!J&&!I)throw w$("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-use rules clear --corp ${z.id} --dry-run`);let K=await O$("seal_approval_rules_clear",U,z,{dryRun:I,recode:H0(Q.options.recode)});if(!J&&I& Line truncated
`).filter(Boolean),J=Q.slice(-Y);return{logFile:U,lines:J,totalLines:Q.length}}async function Kk1($){let Y=Ij($),U=oo($),z=nq($);rg0($.stateDir);let Q=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):$j),J=$.host??(process.env.HOST?process.env.HOST:Yj);Qj(Y,`${process.pid}
`,{mode:384}),Qj(U,JSON.stringify({pid:process.pid,port:Q,host:J,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),cK(z,`service starting on http://${J}:${Q} pid=${process.pid}`);let I=null;try{I=await Uj({port:Q,host:J,silent:!0}),cK(z,`service listening pid=${process.pid}`)}catch(G){if(cK(z,`service failed to bind port ${Q}: ${G instanceof Error?G.message:String(G)}`),Jj(Y)===process.pid)k9(Y,{force:!0}),k9(U,{force:!0});throw G}let K=()=>{if(I)I.close(),I=null;if(Jj(Y)===process.pid)k9(Y,{force:!0}),k9(U,{force:!0});cK(z,`stopped pid=${process.pid}`)};await new Promise((G)=>{let H=!1,W=()=>{if(H)return;H=!0,K(),process.off("SIGTERM",W),process.off("SIGINT",W),G()};process.once("SIGTERM",W),process.once("SIGINT",W)})}function mg0($){rg0($.stateDir);let Y=iz($);if(Y.running)return Y;let U=$.launcher??{command:process.execPath,args:[$.entryFile]},z=[...U.args??[],"service","run"];if($.port)z.push("--port",String($.port));if($.host)z.push("--host",String($.host));let Q=zk1(U.command,z,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});Q.unref();let J=Ij($);return Qj(J,`${Q.pid}
`,{mode:384}),cK(nq($),`started pid=${Q.pid}`),{started:!0,...iz($)}}function lg0($,Y={}){let U=Ij($),z=oo($),Q=Jj(U);if(!Q||!og0(Q,$.appRoot))return k9(U,{force:!0}),k9(z,{force:!0}),Y.quiet?void 0:{stopped:!1,reason:"not running"};return process.kill(Q,"SIGTERM"),k9(U,{force:!0}),k9(z,{force:!0}),cK(nq($),`stop requested pid=${Q}`),Y.quiet?void 0:{stopped:!0,pid:Q}}function og0($,Y){if(!Gk1($))return!1;try{let U=Qk1("ps",["-p",String($),"-o","command="],{encoding:"utf8"}),z=U.trim().split(/\s+/).filter(Boolean),Q=z.indexOf("service"),J=Q!==-1&&z[Q+1]==="run",I=U.includes(Y)||z.some((K)=>/(^|[\\/])(seal-use|seal-home)(\.exe)?$/.test(K));return J&&I}catch{return!1}}function Gk1($){try{return process.kill($,0),!0}catch{return!1}}function Ij($){return lo($.stateDir,"service.pid")}function oo($){return lo($.stateDir,"service.json")}function nq($){return lo($.stateDir,"service.log")}function Jj($){if(!zj($))return;let Y=Number(mo($,"utf8").trim());return Number.isInteger(Y)&&Y>0?Y:void 0}function rg0($){Jk1($,{recursive:!0,mode:448})}function cK($,Y){Qj($,`${new Date().toISOString()} ${Y}
`,{flag:"a",mode:384})}var ro=m(()=>{no()});import{homedir as Hk1}from"node:os";import{join as Wk1}from"node:path";async function ao($,Y,U){let z=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,I=await s3($,{appRoot:Y.appRoot,entryFile:Y.entryFile,stateDir:so,version:Z1,launcher:Y.launcher,port:z,host:Q},{maxLines:J});if(I!==void 0)y0(I)}var so;var to=m(()=>{z3();ro();l1();q4();so=Wk1(Hk1(),".config","seal-use")});import{existsSync as Xk1,readFileSync as sg0}from"node:fs";async function ag0($,Y,U,z,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,z,{batchId:J,query:h(Q.options.query)},E0(Q.options));return}if($==="create"||$==="run"){let J=h(Q.options.mode)??h(Q.options.sourceSystem)??h(Q.options["source-system"])??"hosecloud",I=J==="material-pack"?"material_pack":J,K=h(Q.options.schemaConfig)??h(Q.options["schema-config"]),G=K?JSON.parse(sg0(K,"utf8")):void 0,H=h(Q.options.input),W=H?JSON.parse(sg0(H,"utf8")):B8(Q.json),X=h(Q.options.packageId)??h(Q.options["package-id"]),Z=i6(Q.options.packageIds)??i6(Q.options["package-ids"])??(X?[X]:void 0),q=i6(Q.options.flowIds)??i6(Q.options["flow-ids"])??i6(Q.options.documentSn)??i6(Q.options["document-sn"]),V=h(Q.options.signKey)??h(Q.options["sign-key"])??h(Q.options.integration),F=H0(Q.options.wait)===!0,O=H0(Q.options.noWait)??H0(Q.options["no-wait"])??(F?!1:!0),w=await O$("seal_simulation_batch_create",U,z,{mode:I,sourceSystem:I,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:H0(Q.options.skipInvoiceGeneration)??H0(Q.options["skip-invoice-generation"]),skipExpenseExtraction:H0(Q.options.skipExpenseExtraction)??H0(Q.options["skip-expense-extraction"]),disableAttachmentCache:H0(Q.options.disableAttachmentCache)??H0(Q.options["disable-attachment-cache"]),signKey:V,packageIds:Z,packageId:X,templateId:h(Q.options.templateId)??h(Q.options["template-id"]),schemaConfig:G,requestIds:i6(Q.options.requestIds)??i6(Q.options["request-ids"]),workflowTypeId:h(Q.options.workflowTypeId)??h(Q.options["workflow-type-id"]),flowStatusList:i6(Q.options.flowStatusList)?.map(Number)??i6(Q.options["flow-status-list"])?.map(Number),businessCodes:i6(Q.options.businessCodes)??i6(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:i6(Q.options.status),limit:s0(Q.options.limit),noWait:O,rawParams:W});if(F&&w&&typeof w==="object"&&"batchId"in w&&typeof w.batchId==="string"){await x0("seal_simulation_batch_wait",U,z,{batchId:w.batchId,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},E0(Q.options));return}y0(w,E0(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,z,{batchId:J,timeout:h(Q.options.timeout),pollInterval:h(Q.options.pollInterval)??h(Q.options["poll-interval"])},E0(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,z,{batchId:J},E0(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,z,{batchId:J},E0(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,z,{signKey:J},E0(Q.options));return}if($==="approval-definitions"||$==="definitions"){await x0("seal_simulation_feishu_approval_definitions_list",U,z,{},E0(Q.options));return}if($==="list"){await x0("seal_simulation_batches_list",U,z,{limit:s0(Q.options.limit)},E0(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,z,{batchId:J},E0(Q.options));return}if($==="templates"){await x0("seal_simulation_templates_get",U,z,{},E0(Q.options));return}if($==="integrations"){await x0("seal_simulation_integrations_get",U,z,{},E0(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(!Xk1(J))throw Error(`File not found: ${J}`);await x0("seal_simulation_material_package_upload",U,z,{filePath:J},E0(Q.o Line truncated
`);return}if($==="install"||$==="init"||$==="sync"){let z=H0(U.options.local)||H0(U.options.workspace),Q=h(U.options.dir)??h(U.options.target)??Y,J=Q?Q:z?Kj(process.cwd(),".agents","skills","seal-use"):bz(),I=Gg0(J),K=!z&&!Q,G=K?jo():void 0,H=K?Ro():void 0;y0({installed:!0,targetDir:I.targetDir,fileCount:I.files.length,files:I.files,...G?{antigravity:G}:{},...H?{hosts:H}:{}});return}if($==="status"||$==="get"||!$){let z=bz(),Q=Kj(process.cwd(),".agents","skills","seal-use"),J=Eo(),I=_o();y0({global:{dir:z,installed:eg0(Kj(z,"SKILL.md"))},local:{dir:Q,installed:eg0(Kj(Q,"SKILL.md"))},antigravity:J,hosts:I});return}throw Error(`Unknown skill command: ${$}. Run 'seal-use help' for available commands.`)}var Yy0=m(()=>{ho();uq();q4();l1()});async function Uy0($,Y){if($==="config"){y0(await uK(Y));return}throw Error(`Unknown source command: ${$??""}. Run 'seal-use help' for available commands.`)}var zy0=m(()=>{kT();l1()});function eo($){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 Qy0($){let{sourceCorp:Y,targetCorp:U,sourceClient:z,targetClient:Q,samples:J=10,dryRun:I=!1,pollIntervalMs:K=2000,timeoutMs:G=45000,snPrefix:H="REG_",fetchFn:W=fetch}=$;if(U.environment!=="test")throw new X4(`重放目标企业「${U.name}」(${U.id}) 的环境为「${U.environment}」,非测试环境!
`+"硬性安全规定:自动化回归测试矩阵严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${Y.id} <testCorpId>`);let X=await lY(Q),q=(Array.isArray(X.features)?X.features:[]).find((p)=>p?.code==="ai-approval"),V=typeof q?.balance==="number"?q.balance:0,F=typeof q?.deductionAmount==="number"&&q.deductionAmount>0?q.deductionAmount:120,O=J*F;if(V<O)throw new X4(`测试企业「${U.name}」AI 审批额度不足:当前剩余 ${V} 点,本次回归抽样 ${J} 笔需要约 ${O} 点。
`+"为防止测试环境额度耗尽中断业务,已硬性拦截并拒绝发起测试单据注入。",2,`请为测试企业「${U.id}」充值 AI 审批额度,或降低抽样笔数 (--samples ${Math.max(1,Math.floor(V/F))})`);let w=await n4(z,{limit:J,status:"completed"}),N=Array.isArray(w.records)?w.records:[];if(N.length===0){let p=await n4(z,{limit:J});N=Array.isArray(p.records)?p.records:[]}if(N.length===0)throw new X4(`在母企业「${Y.name}」(${Y.id}) 中未检索到任何历史审批单据,无法抽取回归样本。`,2);if(N=N.slice(0,J),I){let p=N.map((t)=>{let e=t.sourceDocumentSN??t.id,g=t?.result?.decision??t.aiDecision??t?.decision,d=eo(g),Y0=t?.result?.summary??t.aiSummary;return{sn:e,sourceRecordId:t.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:F,estimatedRequired:O},metrics:{sampleCount:p.length,successCount:p.length,failureCount:0,matchCount:p.length,flipCount:0,concordanceRate:1},flips:[],records:p}}let M=await _d(Q,U,$.webhookSelector),D=[];for(let p of N){let t=Date.now(),e=p.sourceDocumentSN??p.id,g=eo(p?.result?.decision??p.aiDecision??p?.decision),d=p?.result?.summary??p.aiSummary;try{let Y0=await W4(z,p.id),y=`${H}${e}`,r=Cd(Y0,{snPrefix:H,docIdPrefix:H});await Rd(M.incomingDocumentWebhook.url,M.secret,r,W,B6(U.seal));let $0=null,N0=Date.now();while(Date.now()-N0<G){await new Promise((X0)=>setTimeout(X0,K));let a=await n4(Q,{sourceDocumentSN:y,limit:1});if(a.records&&a.records.length>0){let X0=a.records[0];if(X0.status==="completed"||X0.status==="failed"){$0=X0;break}}}if(!$0){D.push({sn:e,sourceRecordId:p.id,prodDecision:g,prodSummary:d,status:"FAILED",error:`测试租户单据审核超时 (${Math.round(G/1000)}s 未完成)`,durationMs:Date.now()-t});continue}let j0=eo($0?.result?.decision??$0.aiDecision??$0?.decision??($0.status==="completed"?"APPROVE":"ERROR")),_0=$0?.result?.summary??$0.aiSummary,G0=g===j0,u0=G0?"MATCHED":"FLIPPED",U1={sn:e,sourceRecordId:p.id,prodDecision:g,prodSummary:d,testRecordId:$0.id,testDecision:j0,testSummary:_0,status:u0,durationMs:Date.now()-t};if(!G0)U1.diff={from:g,to:j0,reasonDiff:_0&&d&&_0!==d?`生产: ${d.slice(0,60)}... -> 测试: ${_0.slice(0,60)}...`:void 0};D.push(U1)}catch(Y0){D.push({sn:e,sourceRecordId:p.id,prodDecision:g,prodSummary:d,status:"FAILED",error:Y0 instanceof Error?Y0.message:String(Y0),durationMs:Date.now()-t})}}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"),j=D.filter((p)=>p.status==="FAILED").length,C=T.length,b=B.length,k=C+b,S=k>0?C/k:0,i=b>0,n=i?"REGRESSIONS_DETECTED":"CLEAN",z0=!i&&j===0,x;try{let p=await lY(Q),e=(Array.isArray(p.features)?p.features:[]).find((g)=>g?.code==="ai-approval");if(typeof e?.balance==="number")x=e.balance}catch{}return{ok:!i&&j===0,verdict:n,safeToPublish:z0,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:F,estimatedRequired:O,balanceAfter:x},metrics:{sampleCount:D.length,successCount:P.length,failureCount:j,matchCount:C,flipCount:b,concordanceRate:Number(S.toFixed(4))},flips:B,records:D}}function Jy0($){let{sourceCorp:Y,targetCorp:U,verdict:z,safeToPublish:Q,metrics:J,quota:I,flips:K,records:G}=$,H=z==="CLEAN"?"\uD83D\uDFE2 决策完全一致 (CLEAN - 无回归)":z==="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)}% | 消耗预估: ${I.estimatedRequired} 点 (余量: ${I.balanceBefore}${I.balanceAfter!==void 0?` -> ${I.balanceAfter}`:""})`," "+"─".repeat(65)];if(K.length>0){W.push(` ⚠️ 决策翻转清单 (${K.length} 笔单据在新规则下结果改变):`);for(let X of K)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(z==="CLEAN")W.push(" ✓ 全部样本在新规则下的审核决策与生产历史 100% Line truncated
`)}var Iy0=m(()=>{O8();P6();bZ()});async function $r($,Y,U){let z=($??Y??"regression").toLowerCase();if(z==="regression"||z==="regress"||z==="matrix"){let Q=h(U.options.corp)??(Y&&Y!==z?Y:void 0),J=M1(Q),I=J,K=J;if(J.environment==="test"){K=J;let M=h(U.options["prod-corp"])??h(U.options.prod)??J.prodCorpId;if(!M)throw new X4(`测试企业「${J.name}」(${J.id}) 未绑定生产母企业,无法拉取历史样本。
`+"请建立绑定或通过 --prod-corp 参数指定生产企业来源。",2,`seal-use corps bind-test <prodCorpId> ${J.id}`);I=M1(M)}else{I=J;let M=h(U.options["test-corp"])??h(U.options.test)??J.testCorpId;if(!M)throw new X4(`生产企业「${J.name}」(${J.id}) 未绑定测试靶场企业。
`+"硬性规定:回归测试严禁在生产环境直接运行。必须绑定并指定测试环境(testCorp)。",2,`seal-use corps bind-test ${J.id} <testCorpId>`);K=M1(M)}let G=await T1(I),H=await T1(K),W=s0(U.options.samples)??s0(U.options.limit)??s0(U.options.n)??10,X=H0(U.options["dry-run"]),Z=H0(U.options["fail-on-flips"]),q=s0(U.options["poll-interval"])??2000,V=s0(U.options.timeout)??45000,F=h(U.options["sn-prefix"])??"REG_",O=h(U.options.webhook)??h(U.options.selector),w=await Qy0({sourceCorp:I,targetCorp:K,sourceClient:G,targetClient:H,samples:W,dryRun:X,pollIntervalMs:q,timeoutMs:V,snPrefix:F,failOnFlips:Z,webhookSelector:O});if(!(H0(U.options.quiet)||H0(U.options.silent)))console.error(Jy0(w));if(y0(w),Z&&!w.ok)throw new X4(`回归测试发现 ${w.metrics.flipCount} 笔单据决策翻转,已按 --fail-on-flips 策略非零终止。`,1);return}throw new X4(`未知的 test 子命令: "${z}"。
可用子命令: seal-use test regression [--corp <id>] [--samples <N>] [--dry-run]`,2,"seal-use test regression --help")}var Ky0=m(()=>{O8();N4();q4();l1();R8();Iy0()});async function Gy0($,Y,U,z){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await x0($,Y,U,B8(z.json),E0(z.options))}var Hy0=m(()=>{N4();q4();l1()});function Wy0(){y0(Aq.map(($)=>({name:$.name,description:$.description})))}var Xy0=m(()=>{Tq();l1()});function Gj($=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 Zy0=m(()=>{uq()});import{existsSync as Zk1,mkdirSync as qk1,readFileSync as Vk1,renameSync as Lk1,writeFileSync as Fk1}from"node:fs";import{homedir as wk1}from"node:os";import{dirname as Ok1,join as Mk1}from"node:path";import{spawn as Nk1}from"node:child_process";function qy0($){return $.replace(/\.\d+Z$/,"Z")}function Vy0(){let $=process.env[Dk1]?.trim();if($)return $;return Ak1}function Ly0($=Vy0()){if(!Zk1($))return null;try{let Y=Vk1($,"utf-8"),U=JSON.parse(Y);if(U&&typeof U==="object"&&typeof U.latestVersion==="string"&&typeof U.checkedAt==="string")return{...U,checkedAt:qy0(U.checkedAt)};return null}catch{return null}}function cq($,Y=Vy0()){try{let U=Ok1(Y);qk1(U,{recursive:!0,mode:448});let z={checkedAt:qy0($.checkedAt??new Date().toISOString()),latestVersion:$.latestVersion,publishedAt:$.publishedAt,releaseUrl:$.releaseUrl},Q=`${Y}.tmp.${Date.now()}.${Math.random().toString(36).slice(2,8)}`;Fk1(Q,JSON.stringify(z,null,2),{mode:384}),Lk1(Q,Y)}catch{}}function Fy0($,Y=Bk1){if(!$||!$.checkedAt)return!0;let U=new Date($.checkedAt).getTime();if(Number.isNaN(U))return!0;return Date.now()-U>Y}function wy0($){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 Nk1(Y,U,{detached:!0,stdio:"ignore",env:{...process.env,SEAL_DISABLE_BG_UPDATE:"1"}}).unref(),!0}catch{return!1}}var Dk1="SEAL_USE_UPDATE_CACHE_FILE",Bk1=86400000,Ak1;var Yr=m(()=>{Ak1=Mk1(wk1(),".config","seal-use","update-cache.json")});import{chmodSync as Pk1,mkdirSync as Tk1,readdirSync as jk1,realpathSync as Oy0,renameSync as Ur,rmSync as Ek1,unlinkSync as Ay0,writeFileSync as My0}from"node:fs";import{basename as Ck1,dirname as Rk1,isAbsolute as _k1,join as Xj,relative as vk1}from"node:path";import{spawn as hk1,spawnSync as a3}from"node:child_process";async function Ty0($,Y={}){let U={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:so,version:Z1,launcher:$.launcher},z=Y.repo||process.env[Sk1]?.trim()||process.env[gk1]?.trim()||Py0,Q=Y.targetVersion?.trim(),J=Q&&Q.toLowerCase()!=="latest"?Q:void 0;if(J){let D=J.replace(/^v/,""),P=Ry0(D,Z1);if(P<0)if(!Qg&&Y.force);else{y0({updated:!1,currentVersion:Z1,targetVersion:D,mode:Gj()?"binary":"source",message:!Qg?`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){y0({updated:!1,currentVersion:Z1,targetVersion:D,mode:Gj()?"binary":"source",message:`seal-use is already at version v${Z1}. Use --force to reinstall.`});return}}if(Y.changelogOnly){let D=await Wj(z,Y.limit??10);y0({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:v5(P.version,Z1)}))});return}if(!Gj()){if(Y.checkOnly){let P=await Wj(z,30),T=P[0],B=T?.version??Z1,j=P.find((k)=>k.version===Z1),C=v5(B,Z1),b=P.filter((k)=>v5(k.version,Z1));if(T?.version)cq({latestVersion:T.version,publishedAt:T.publishedAt,releaseUrl:T.htmlUrl});if(Y.bgSave)return;y0({updated:!1,updateAvailable:C,currentVersion:Z1,currentVersionPublishedAt:j?.publishedAt,latestVersion:B,latestVersionPublishedAt:T?.publishedAt,behindCount:b.length,pendingReleases:b.map((k)=>({version:k.version,tagName:k.tagName,publishedAt:k.publishedAt,author:k.author,releaseNotes:k.notes,releaseUrl:k.htmlUrl})),releaseNotes:T?.notes??"",releaseUrl:T?.htmlUrl??"",mode:"source",message:"当前运行的是开发版。正式用户请安装正式版后使用 seal-use update。"});return}let D=iz(U).running;if(D)await s3("stop",U);try{By0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(P){console.error(`⚠️ 开发版更新同步失败,继续刷新本地依赖: ${P instanceof Error?P.message:String(P)}`)}if(By0("bun",["install"],{cwd:$.appRoot}),D)await s3("start",U);y0({updated:!0,serviceRestarted:D,version:Z1,mode:"source"});return}if(uk1())try{await bk1($,Y,U,z,J);return}catch(D){console.error(`⚠️ Homebrew 自动更新失败,回退至原生二进制更新: ${D instanceof Error?D.message:String(D)}`)}let I=kk1(),K=xk1(),G=await Wj(z,30),H=J?G.find((D)=>D.version Line truncated
`)}catch{}}async function ck1($,Y,U,z){let Q=zr(),J=[],I=U?U.startsWith("v")?U:`v${U}`:void 0,K=z||$.split("/").pop()||"";if(Q!=="github"){if(I&&K)J.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${I}/${K}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${I}/${K}`);if($.startsWith("https://git.ying-qing.cn"))J.push($)}if(Q!=="gitea")if(I&&K){let F=`https://github.com/${Py0}/releases/download/${I}/${K}`;if(!process.env.CI)J.push(`https://ghfast.top/${F}`,`https://gh.ddlc.top/${F}`);J.push(F)}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 F=0;F<G.length;F++){let O=G[F],w=new AbortController,N="",M=(B)=>{N=B;try{w.abort()}catch{}},D=setTimeout(()=>{M("Connection timed out (no response headers within 6s)")},W),P,T;try{Hj(`==> [${F+1}/${G.length}] Downloading via: ${O}`);let B=await fetch(O,{signal:w.signal});if(D)clearTimeout(D),D=void 0;if(!B.ok)throw Error(`HTTP ${B.status} ${B.statusText}`);P=setTimeout(()=>{M("Overall download time exceeded 3 minutes")},V);let j=Number(B.headers.get("content-length"))||0,C=B.body?.getReader();if(!C){let n=Buffer.from(await B.arrayBuffer());if(n.length<1000)throw Error(`Downloaded content is suspiciously small (${n.length} bytes)`);My0(Y,n),Hj(`✓ Download succeeded (${(n.length/1024/1024).toFixed(1)} MB)`);return}let b=[],k=0,S=0;T=setTimeout(()=>{if(k<Z){let n=(k/1024).toFixed(1);M(`Initial transfer too slow (${n} KB < 300 KB in 6s), switching mirror...`)}},X);while(!0){let n=C.read(),z0,x=new Promise((g,d)=>{z0=setTimeout(()=>{d(Error("Data transfer stalled (no chunk received for 10s)"))},q)}),p;try{p=await Promise.race([n,x])}finally{if(z0)clearTimeout(z0)}let{done:t,value:e}=p;if(t)break;if(e){if(b.push(e),k+=e.length,T&&k>=Z)clearTimeout(T),T=void 0;let g=Date.now();if(g-S>200){S=g;let d=j?Math.round(k/j*100):0,Y0=(k/1048576).toFixed(1),y=j?(j/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${d}% (${Y0} / ${y} MB)...`)}catch{}}}}try{process.stderr.write(`
`)}catch{}let i=Buffer.concat(b);if(i.length<1000)throw Error(`Downloaded content is suspiciously small (${i.length} bytes)`);My0(Y,i),Hj(`✓ Download completed successfully (${(i.length/1024/1024).toFixed(1)} MB)`);return}catch(B){if(D)clearTimeout(D);if(T)clearTimeout(T);if(P)clearTimeout(P);let j=N||(B instanceof Error?B.message:String(B));H=Error(j),Hj(`
↳ 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 Ey0($){let Y;try{Y=jk1($,{withFileTypes:!0})}catch{return[]}let U=[];for(let z of Y){let Q=Xj($,z.name);if(z.isDirectory())U.push(...Ey0(Q));else if(z.isFile())U.push(Q)}return U}function Cy0($,Y,U){let z=Y==="windows"?"seal-use.exe":"seal-use",Q=Ey0($);return Q.find((J)=>Ck1(J)===z)??Q[0]??U}function dk1($,Y,U){let z=a3("tar",["-xzf",$,"-C",Y],{stdio:"pipe"});if(z.status!==0)throw Error(`Failed to extract tar archive: ${z.stderr.toString()}`);return Ay0($),Cy0(Y,U,$)}function pk1($,Y,U){let z=a3("unzip",["-q","-o",$,"-d",Y],{stdio:"pipe"});if(z.status!==0)throw Error(`Failed to extract zip archive: ${z.stderr.toString()}`);return Ay0($),Cy0(Y,U,$)}function Ry0($,Y){let U=$.replace(/^v/,"").split(".").map((Q)=>Number.parseInt(Q,10)||0),z=Y.replace(/^v/,"").split(".").map((Q)=>Number.parseInt(Q,10)||0);for(let Q=0;Q<Math.max(U.length,z.length);Q++){let J=U[Q]??0,I=z[Q]??0;if(J>I)return 1;if(J<I)return-1}return 0}function v5($,Y){return Ry0($,Y)>0}function By0($,Y,U={}){let z=a3($,Y,{cwd:U.cwd,encoding:"utf8",stdio:["ignore","pipe","pipe"]});if(z.stdout)console.error(z.stdout.trimEnd());if(z.stderr)console.error(z.stderr.trimEnd());if(z.status!==0)throw Error(`${$} ${Y.join(" ")} failed with status ${z.status}`)}var Py0="yunyingk/seal-use",dq="yunyingk/seal-home",Sk1="SEAL_USE_GITHUB_REPO",gk1="SEAL_HOME_GITHUB_REPO";var _y0=m(()=>{Zy0();uq();Yr();z3();ro();l1();to()});async function vy0($,Y,U,z,Q){if($==="create"){let J=h(Q.options.name)??Y,I=h(Q.options.phone);if(!J||!I)throw Error("Usage: seal-use users create --name <name> --phone <phone> [--dept <deptId>]");let K=h(Q.options.dept)??h(Q.options.departmentId);await x0("seal_user_create",U,z,{name:J,phone:I,departmentIds:K?[K]:void 0},E0(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,z,{userId:J},E0(Q.options));return}if($==="search"||$==="list"){let J=Y??h(Q.options.keyword)??h(Q.options.query)??"";await x0("seal_user_search",U,z,{keyword:J},E0(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,z,{userId:J},E0(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,z,{userId:J},E0(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,z,{userId:J},E0(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 I=h(Q.options.note);await x0("seal_user_delegation_create",U,z,{userIdOrPhone:J,note:I},E0(Q.options));return}throw Error(`Unknown users command: ${$??""}. Run 'seal-use help' for available commands.`)}var hy0=m(()=>{N4();q4();l1()});import{dirname as Qr,join as mk1}from"node:path";import{fileURLToPath as lk1}from"node:url";function ak1($){if(!$.length)return!1;let Y=$[0]?.toLowerCase(),U=$[1]?.toLowerCase();if(Y&&sk1.has(Y))return!0;if((Y==="service"||Y==="daemon")&&U==="run")return!0;return!1}function iq($,Y={}){if(ak1($))return yy0($,Y);let U=gy0.then(()=>yy0($,Y));return gy0=U.then(()=>{return},()=>{return}),U}async function yy0($,Y){let U=[],z=[],Q=console.log,J=console.error,I={appRoot:Y.appRoot??Sy0,entryFile:Y.entryFile??mk1(Y.appRoot??Sy0,"src","cli.ts"),launcher:Y.launcher};console.log=(...K)=>{U.push(rl(K))},console.error=(...K)=>{z.push(rl(K))};try{return await tk1($,I),{stdout:Cq(U),stderr:Cq(z),isError:!1,exitCode:0}}catch(K){let G=Rq(K instanceof Error?K.message:String(K)),H=uZ(K);if(z.push(G),H.nextAction&&!G.includes("Next action:"))z.push(`\uD83D\uDC49 Next action: ${H.nextAction}`);return{stdout:Cq(U),stderr:Cq(z),isError:!0,exitCode:H.exitCode}}finally{console.log=Q,console.error=J}}async function tk1($,Y){let U=jq($),[z,Q,J]=U.command,I=z?.toLowerCase(),K=I?ok1.has(I):!1,G=K?"update":I;if(G==="version"||G==="v"||Boolean(U.options.version)||Boolean(U.options.v)||Boolean(U.options.V)){let Z=Ly0(),q=Z?.latestVersion?v5(Z.latestVersion,pY.version):!1,V={...pY,...Z?.latestVersion?{latestVersion:Z.latestVersion,updateAvailable:q,lastCheckedAt:Z.checkedAt}:{}};if(q&&Z?.latestVersion)console.error(`\uD83D\uDCA1 发现新版本可用: v${pY.version} -> v${Z.latestVersion}`),console.error(`\uD83D\uDC49 Next action: seal-use update
`);if(y0(V),Fy0(Z))wy0(Y.launcher);return}let H=a_0(U);if(H.isHelp){Yv0(H.target);return}if(!G||!rk1.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 zv0(Z,fK(U.options));return}if(G==="openapi"){gg0(U);return}if(G==="mcp-config"){co();return}if(G==="skill"){$y0(Q,J,U);return}if(G==="mcp"||G==="server"){await _g0(Q,U);return}if(G==="probe"){await cg0(Q,J,U);return}if(G==="doctor"){await wg0(Q,J,U);return}if(G==="test"){await $r(Q,J,U);return}if(G==="config"){JS0(Q,J,U);return}if(G==="service"){await ao(Q,Y,U);return}if(G==="stop"){await ao("stop",Y,U);return}if(G==="http"||G==="serve"){await jg0(U);return}if(K||G==="changelog"){if(K&&z!=="update")console.error(`⚠️ Notice: '${z}' 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"||H0(U.options.changelog)===!0,V=Z==="check"||H0(U.options.check)===!0||H0(U.options["check-only"])===!0,F=H0(U.options["bg-save"])===!0||H0(U.options["silent-save"])===!0,O=h(U.options.version)??h(U.options.tag)??(!q&&!V&&!F&&Q&&!Q.startsWith("-")?Q:void 0);await Ty0(Y,{checkOnly:V||F,changelogOnly:q,limit:s0(U.options.limit),force:H0(U.options.force),targetVersion:O,repo:h(U.options.repo),bgSave:F});return}if(G==="tools"&&Q==="list"){Wy0();return}if(G==="corps"||G==="corp"){if(Q==="regression"||Q==="test-regression"){await $r("regression",J,U);return}await eh0(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 po(Q,J,null,Z,U);return}if(G==="auth"&&(Q==="extract-keys"||Q==="extract-key"||Q==="extract-hose-keys"||Q==="hose-extract-keys")){await Do(J,U);return}if(G==="auth"&&(Q==="link"||Q==="seal-link")&&(("from-link"in U.options)||J==="from-link")){await rT(Q,null,U);return}let W=M1(h(U.options.corp));if(G==="source"){await Uy0(Q,W);return}if(G==="auth"){await rT(Q,W,U);return}let X=await T1(W);if(G==="users"){await vy0(Q,J,X,W,U);return}if(G==="contacts"){await KS0(Q,J,X,W,U);return}if(G==="data"){await HS0(Q,X,W,U);return}if(G==="llm"){await Cg0(Q,X,W,U);return}if(G==="permissions"){await kg0(Q,X,W,U);return}if(G==="billing"){await zS0(Q,X,W,U);return}if(G==="webhook"||G==="webhooks"){await gT(Q,J,X,W,U);return}if(G==="context"){await XS0(X,W,U);return}if(G==="rules"){await po(Q,J,X,W,U);return}if(G==="approval-runs"){await Qv0(Q,J,X,W,U);return}if(G==="analytics"){await Iv0(Q,J,X,W,U);return}if(G==="simulation"){await ag0(Q,J,X,W,U);return}if(G==="deploy"){await qS0(Q,J,U.command[3],X,W,U);return}if(G==="preference"||G==="preferences"){await ug0(Q,J,U.command[3],U.command[4],X,W,U);return}if(G==="tool"){await Gy0(Q,X,W,U);return}throw Error(`Unknown command: ${U.command.join(" ")}. Run 'seal-use help' for available commands.`)}var Sy0,ok1,rk1,sk1,gy0;var io=m(()=>{R8();z3();Jv0();Kv0();Bo();QS0();IS0();GS0();WS0();ZS0();Oo();VS0();Og0();Eg0();Rg0();vg0();yg0();xg0();bg0();dg0();pg0();to();tg0();Yy0();zy0();Ky0();Hy0();Xy0();_y0();Yr();hy0();al();O8();N4();q4();ol();l1();Sy0=Qr(Qr(Qr(lk1(import.meta.url)))),ok1=new Set(["update","upgrade","up","self-update","selfupdate"]),rk1=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"]),sk1=new Set(["http","server","web","mcp"]);gy0=Promise.resolve()});function Ux1($){let{command:Y}=jq($),U=(Y[0]??"").toLowerCase();return{area:ek1[U]??U,actionTokens:Y.slice(1).map((z)=>z.toLowerCase())}}function ky0($){let Y,U;try{({area:Y,actionTokens:U}=Ux1($))}catch{return!1}if(U.length===0&&Yx1.has(Y))return!0;if(Y==="tool"){let Q=U[0];return Q!==void 0&&b_0(Q)}let z=$x1[Y];if(!z)return!1;return z.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((I,K)=>I===U[K])})}var ek1,$x1,Yx1;var xy0=m(()=>{Tq();q4();ek1={corp:"corps",webhooks:"webhook",preferences:"preference"},$x1={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
`)?"":`
`}`);process.exitCode=$.exitCode}var a3,Cy0,Wj="seal_cli",mq="seal_cli_write",Ry0="SEAL_USE_MCP_ENABLED",_y0="SEAL_HOME_MCP_ENABLED",rk1;var Dg0=m(async()=>{ee();U00();P$();fo();Ty0();F$();$3();a3=lk1(import.meta.url),Cy0=a3.includes("/dist/mcp/")||a3.includes("\\dist\\mcp\\")?pq(pq(pq(a3))):pq(pq(a3));rk1=Boolean(I0.main==I0.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&jy0(process.argv[1])===jy0(a3));if(rk1)if(process.argv[2]==="--seal-use-cli")await ok1();else try{Sy0()}catch($){console.error($),process.exitCode=1}});await Dg0();export{uq as tokenizeCommand,Sy0 as startServer,vy0 as resolveMcpEnabled,hy0 as createServer,Ry0 as SEAL_MCP_ENABLED_ENV,mq as SEAL_CLI_WRITE_TOOL_NAME,Wj as SEAL_CLI_TOOL_NAME,_y0 as LEGACY_SEAL_MCP_ENABLED_ENV};
`}`);process.exitCode=$.exitCode}var t3,by0,qj="seal_cli",lq="seal_cli_write",iy0="SEAL_USE_MCP_ENABLED",ny0="SEAL_HOME_MCP_ENABLED",Jx1;var Sg0=m(async()=>{U00();J00();T$();io();xy0();O8();z3();t3=zx1(import.meta.url),by0=t3.includes("/dist/mcp/")||t3.includes("\\dist\\mcp\\")?pq(pq(pq(t3))):pq(pq(t3));Jx1=Boolean(I0.main==I0.module||!import.meta.url.includes("$bunfs")&&process.argv[1]&&fy0(process.argv[1])===fy0(t3));if(Jx1)if(process.argv[2]==="--seal-use-cli")await Qx1();else try{py0()}catch($){console.error($),process.exitCode=1}});await Sg0();export{bq as tokenizeCommand,py0 as startServer,cy0 as resolveMcpEnabled,dy0 as createServer,iy0 as SEAL_MCP_ENABLED_ENV,lq as SEAL_CLI_WRITE_TOOL_NAME,qj as SEAL_CLI_TOOL_NAME,ny0 as LEGACY_SEAL_MCP_ENABLED_ENV};
+16 -2152
View File
File diff suppressed because it is too large. Load diff
+155
View File
@@ -0,0 +1,155 @@
import { updateCorpConfig } from "../../../core/config/loader.js";
import { selectCorp } from "../../helpers.js";
import { confirmationRequired, usageError } from "../../errors.js";
import { booleanOption, stringOption } from "../../parser.js";
import { printJson } from "../../printer.js";
import type { ParsedArgs } from "../../types.js";
export async function handleCorpBindings(
action: string | undefined,
maybeName: string | undefined,
args: ParsedArgs
): Promise<boolean> {
if (action === "bind-test") {
let prodId: string | undefined;
let testId: string | undefined;
if (maybeName && args.command[3]) {
prodId = maybeName;
testId = args.command[3];
} else if (maybeName) {
const corpOption = stringOption(args.options.corp);
const testCorpOption = stringOption(args.options["test-corp"]) ?? stringOption(args.options.testCorp);
if (corpOption) {
prodId = corpOption;
testId = maybeName;
} else if (testCorpOption) {
prodId = maybeName;
testId = testCorpOption;
}
}
if (!prodId || !testId) {
throw usageError(
"Usage: seal-use corps bind-test <prodCorpId> <testCorpId> [--confirm] [--force]\n" +
" or: seal-use corps bind-test <testCorpId> --corp <prodCorpId> [--confirm] [--force]"
);
}
const prodCorp = selectCorp(prodId);
const testCorp = selectCorp(testId);
if (prodCorp.id === testCorp.id) {
throw usageError(`Cannot bind enterprise '${prodCorp.id}' to itself.`);
}
if (prodCorp.prodCorpId && prodCorp.prodCorpId !== testCorp.id) {
throw usageError(
`Cannot use '${prodCorp.id}' as a production enterprise because it is already registered as a test enterprise for '${prodCorp.prodCorpId}'. Multi-tier chaining is not permitted.`
);
}
if (testCorp.testCorpId && testCorp.testCorpId !== prodCorp.id) {
throw usageError(
`Cannot bind '${testCorp.id}' as a test enterprise because it already has a bound test enterprise '${testCorp.testCorpId}'. Multi-tier chaining is not permitted.`
);
}
const force = booleanOption(args.options.force) === true;
if (
(prodCorp.testCorpId && prodCorp.testCorpId !== testCorp.id) ||
(testCorp.prodCorpId && testCorp.prodCorpId !== prodCorp.id)
) {
if (!force) {
throw confirmationRequired(
`Enterprise binding conflict: production enterprise '${prodCorp.id}' is bound to '${prodCorp.testCorpId ?? "none"}', and test enterprise '${testCorp.id}' is bound to '${testCorp.prodCorpId ?? "none"}'. Overwriting an existing binding requires --force and --confirm.`,
`seal-use corps bind-test ${prodCorp.id} ${testCorp.id} --confirm --force`
);
}
}
const confirmed = booleanOption(args.options.confirm) === true || booleanOption(args.options.yes) === true;
if (!confirmed) {
const forceFlag = force ? " --force" : "";
throw confirmationRequired(
`Refusing to bind test enterprise '${testCorp.name}' (${testCorp.id}) to production enterprise '${prodCorp.name}' (${prodCorp.id}) without --confirm. Enterprise binding establishes 1-to-1 sync pairing and marks '${testCorp.id}' as a test environment.`,
`seal-use corps bind-test ${prodCorp.id} ${testCorp.id} --confirm${forceFlag}`
);
}
if (prodCorp.testCorpId && prodCorp.testCorpId !== testCorp.id) {
try {
updateCorpConfig(prodCorp.testCorpId, { prodCorpId: undefined });
} catch {}
}
if (testCorp.prodCorpId && testCorp.prodCorpId !== prodCorp.id) {
try {
updateCorpConfig(testCorp.prodCorpId, { testCorpId: undefined });
} catch {}
}
const updatedProd = updateCorpConfig(prodCorp.id, {
environment: "production",
testCorpId: testCorp.id
});
const updatedTest = updateCorpConfig(testCorp.id, {
environment: "test",
prodCorpId: prodCorp.id
});
printJson({
success: true,
productionEnterprise: {
id: updatedProd.id,
name: updatedProd.name,
environment: updatedProd.environment,
testCorpId: updatedProd.testCorpId
},
testEnterprise: {
id: updatedTest.id,
name: updatedTest.name,
environment: updatedTest.environment,
prodCorpId: updatedTest.prodCorpId
}
});
return true;
}
if (action === "unbind-test") {
const targetId = maybeName ?? stringOption(args.options.corp);
const corp = selectCorp(targetId);
if (!corp.testCorpId && !corp.prodCorpId) {
printJson({
unbound: false,
message: `Enterprise '${corp.name}' (${corp.id}) does not have an active test enterprise binding.`
});
return true;
}
const prodId = corp.testCorpId ? corp.id : corp.prodCorpId!;
const testId = corp.testCorpId ? corp.testCorpId : corp.id;
const confirmed = booleanOption(args.options.confirm) === true || booleanOption(args.options.yes) === true;
if (!confirmed) {
throw confirmationRequired(
`Refusing to unbind production enterprise '${prodId}' and test enterprise '${testId}' without --confirm.`,
`seal-use corps unbind-test ${corp.id} --confirm`
);
}
updateCorpConfig(prodId, { testCorpId: undefined });
try {
updateCorpConfig(testId, { prodCorpId: undefined });
} catch {}
printJson({
success: true,
unboundProduction: prodId,
unboundTest: testId
});
return true;
}
return false;
}
+739
View File
@@ -0,0 +1,739 @@
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import {
assertHoseAssistTenantMatches,
exchangeHoseAssistLink,
fetchHoseOpenApiKeysFromLink,
fetchHoseRoleDefGroups,
fetchHoseRoleStaffs,
fetchHoseStaffDetails,
maskHoseSecurity,
parseHoseAssistLink,
probeHoseDomain,
resolveHoseAssistLinkDetails,
type HoseOpenApiKey
} from "../../../core/auth/hose.js";
import {
exchangeSealDelegateLink,
parseSealDelegateLink,
previewSealDelegateLink,
scoreAssistLink
} from "../../../core/auth/delegate.js";
import { clearCorpTokenCache } from "../../../core/auth/token-store.js";
import { createSealClientForUrl } from "../../../core/http/factory.js";
import { resolveSealCustomHeaders } from "../../../core/http/request-headers.js";
import { resolveWritableEnterprisesDir } from "../../../core/config/loader.js";
import {
SealCookieMapSchema,
SealHeaderMapSchema
} from "../../../core/config/types.js";
import type { CorpConfig } from "../../../core/config/types.js";
import { getMe } from "../../../domains/seal/api.js";
import { resolveLiveSealEnterpriseConfig } from "../../../domains/seal/source.js";
import { CliError } from "../../errors.js";
import { selectCorp } from "../../helpers.js";
import {
booleanOption,
jsonObject,
optionalNumber,
optionalString,
requiredString,
requiredStringAlias,
safeFileName,
stringOption
} from "../../parser.js";
import { printJson } from "../../printer.js";
import type { ParsedArgs } from "../../types.js";
import { formatUtcTimestampSeconds, maskCellphone, stringValue } from "./shared.js";
export async function handleCorpOnboarding(
action: string | undefined,
maybeName: string | undefined,
args: ParsedArgs
): Promise<boolean> {
if (action === "probe-hose") {
await probeHoseCorp(jsonObject(args.json));
return true;
}
if (action === "hose-staffs") {
await queryHoseStaffs(jsonObject(args.json));
return true;
}
if (action === "add-hose-persistent" || action === "add-hose") {
if (action === "add-hose") {
console.error("⚠️ Notice: 'add-hose' is a compatibility alias; use 'add-hose-persistent' for durable Hose credentials.");
}
const jsonPayload = jsonObject(args.json);
const merged = {
...jsonPayload,
...(args.options.staffName ? { staffName: stringOption(args.options.staffName) } : {}),
...(args.options["staff-name"] ? { staffName: stringOption(args.options["staff-name"]) } : {}),
...(args.options.staffPhone ? { staffPhone: stringOption(args.options.staffPhone) } : {}),
...(args.options["staff-phone"] ? { staffPhone: stringOption(args.options["staff-phone"]) } : {}),
...(args.options.name ? { name: stringOption(args.options.name) } : {}),
...(args.options.domain ? { domain: stringOption(args.options.domain) } : {}),
...(args.options.corpId ? { corpId: stringOption(args.options.corpId) } : {}),
...(args.options["corp-id"] ? { corpId: stringOption(args.options["corp-id"]) } : {}),
...(args.options.appKey ? { appKey: stringOption(args.options.appKey) } : {}),
...(args.options["app-key"] ? { appKey: stringOption(args.options["app-key"]) } : {}),
...(args.options.appSecurity ? { appSecurity: stringOption(args.options.appSecurity) } : {}),
...(args.options["app-security"] ? { appSecurity: stringOption(args.options["app-security"]) } : {}),
...(args.options.force !== undefined ? { force: booleanOption(args.options.force) } : {}),
...(args.options.overwrite !== undefined ? { overwrite: booleanOption(args.options.overwrite) } : {})
};
await addHoseCorp(merged);
return true;
}
if (action === "add-hose-web-session") {
const jsonPayload = jsonObject(args.json);
const merged = {
...jsonPayload,
...(args.options.name ? { name: stringOption(args.options.name) } : {}),
...(args.options.domain ? { baseUrl: stringOption(args.options.domain) } : {}),
...(args.options["base-url"] ? { baseUrl: stringOption(args.options["base-url"]) } : {}),
...(args.options.corpId ? { corpId: stringOption(args.options.corpId) } : {}),
...(args.options["corp-id"] ? { corpId: stringOption(args.options["corp-id"]) } : {}),
...(args.options.staffId ? { staffId: stringOption(args.options.staffId) } : {}),
...(args.options["staff-id"] ? { staffId: stringOption(args.options["staff-id"]) } : {}),
...(args.options.accessToken ? { accessToken: stringOption(args.options.accessToken) } : {}),
...(args.options["access-token"] ? { accessToken: stringOption(args.options["access-token"]) } : {}),
...(args.options.overwrite !== undefined ? { overwrite: booleanOption(args.options.overwrite) } : {}),
...(args.options["dry-run"] !== undefined ? { dryRun: booleanOption(args.options["dry-run"]) } : {})
};
await addHoseWebSessionCorp(merged);
return true;
}
if (action === "add-seal-bearer" || action === "add-seal") {
if (action === "add-seal") {
console.error("⚠️ Notice: 'add-seal' is a compatibility alias; use 'add-seal-bearer' for Seal Bearer credentials.");
}
const jsonPayload = jsonObject(args.json);
const merged = {
...jsonPayload,
...(args.options.name ? { name: stringOption(args.options.name) } : {}),
...(args.options.token ? { token: stringOption(args.options.token) } : {}),
...(args.options.sealUrl ? { sealUrl: stringOption(args.options.sealUrl) } : {}),
...(args.options.url ? { sealUrl: stringOption(args.options.url) } : {}),
...(args.options.force !== undefined ? { force: booleanOption(args.options.force) } : {}),
...(args.options.overwrite !== undefined ? { overwrite: booleanOption(args.options.overwrite) } : {})
};
await addSealCorp(merged);
return true;
}
if (action === "add-link") {
const link = maybeName ?? stringOption(args.options.link) ?? stringOption(args.options.url);
if (!link) {
throw new Error("Usage: seal-use corps add-link <url> [--name <customName>] [--elevate-hose] [--overwrite]");
}
const dryRun = booleanOption(args.options["dry-run"]) === true || booleanOption(args.options.dryRun) === true;
const legacyAsHose = booleanOption(args.options["as-hose"]) === true || booleanOption(args.options.hose) === true;
const elevateHose = booleanOption(args.options["elevate-hose"]) === true || legacyAsHose;
if (legacyAsHose && !booleanOption(args.options["elevate-hose"])) {
console.error("⚠️ Notice: '--as-hose' is deprecated; use '--elevate-hose' to request Hose credential elevation.");
}
if (elevateHose) {
const winner = scoreAssistLink(link)[0];
if (winner?.kind === "seal-delegate") {
throw new Error("Option --elevate-hose cannot be used with a Seal native delegate link. Seal delegate links directly authenticate to Seal.");
}
await addLinkAsHoseCorp(
link,
stringOption(args.options.name),
booleanOption(args.options.overwrite) === true,
booleanOption(args.options.force) === true,
dryRun,
{
appKey: stringOption(args.options["app-key"]) ?? stringOption(args.options.appKey),
keyId: stringOption(args.options["key-id"]) ?? stringOption(args.options.keyId)
}
);
return true;
}
await addLinkCorp(link, stringOption(args.options.name), booleanOption(args.options.overwrite) === true, dryRun);
return true;
}
if (action === "extract-keys" || action === "extract-key" || action === "extract-hose-keys" || action === "hose-extract-keys") {
const link = maybeName ?? stringOption(args.options.link) ?? stringOption(args.options.url);
if (!link) {
throw new Error("Usage: seal-use corps hose-extract-keys <url> [--reveal] [--save] [--app-key <key>] [--key-id <id>] [--name <customName>] [--overwrite]");
}
await extractKeysFromLinkAction(link, {
reveal: booleanOption(args.options.reveal) === true || booleanOption(args.options.r) === true || booleanOption(args.options.plain) === true,
save: booleanOption(args.options.save) === true || booleanOption(args.options.add) === true,
name: stringOption(args.options.name),
overwrite: booleanOption(args.options.overwrite) === true,
force: booleanOption(args.options.force) === true,
appKey: stringOption(args.options["app-key"]) ?? stringOption(args.options.appKey),
keyId: stringOption(args.options["key-id"]) ?? stringOption(args.options.keyId)
});
return true;
}
if (action === "keys" || action === "hose-keys") {
const target = maybeName ?? stringOption(args.options.link) ?? stringOption(args.options.url) ?? stringOption(args.options.corp);
const reveal = booleanOption(args.options.reveal) === true || booleanOption(args.options.r) === true || booleanOption(args.options.plain) === true;
if (target && (target.startsWith("http://") || target.startsWith("https://"))) {
await extractKeysFromLinkAction(target, {
reveal,
save: booleanOption(args.options.save) === true || booleanOption(args.options.add) === true,
name: stringOption(args.options.name),
overwrite: booleanOption(args.options.overwrite) === true,
force: booleanOption(args.options.force) === true,
appKey: stringOption(args.options["app-key"]) ?? stringOption(args.options.appKey),
keyId: stringOption(args.options["key-id"]) ?? stringOption(args.options.keyId)
});
return true;
}
await showCorpKeysAction(target, { reveal });
return true;
}
return false;
}
async function probeHoseCorp(input: Record<string, unknown>) {
const appKey = requiredString(input, "appKey");
const appSecurity = requiredString(input, "appSecurity");
const probe = await probeHoseDomain(appKey, appSecurity, optionalString(input, "domain"));
const roleGroups = await fetchHoseRoleDefGroups(probe.domain, probe.openapiToken).catch(() => []);
printJson({
domain: probe.domain,
corpId: probe.corpId,
name: probe.corpName ?? probe.corpId,
roleCount: roleGroups.reduce((acc, g) => acc + g.roleDefs.length, 0),
roleGroups: roleGroups.map((g) => ({
id: g.id,
name: g.name,
roleDefs: g.roleDefs.map((r) => ({ id: r.id, name: r.name, sourceType: r.sourceType }))
}))
});
}
async function queryHoseStaffs(input: Record<string, unknown>) {
const appKey = requiredString(input, "appKey");
const appSecurity = requiredString(input, "appSecurity");
const roleQuery = optionalString(input, "role") ?? optionalString(input, "roleDefId") ?? "admin";
const probe = await probeHoseDomain(appKey, appSecurity, optionalString(input, "domain"));
const roleGroups = await fetchHoseRoleDefGroups(probe.domain, probe.openapiToken);
let targetRoleDefId: string | undefined;
let targetRoleName: string | undefined;
// 1. Direct match by id
for (const group of roleGroups) {
for (const role of group.roleDefs) {
if (role.id === roleQuery || role.id === `${probe.corpId}:${roleQuery}`) {
targetRoleDefId = role.id;
targetRoleName = role.name;
break;
}
}
if (targetRoleDefId) break;
}
// 2. Admin match default
if (!targetRoleDefId && (roleQuery === "admin" || roleQuery === "主管理员")) {
for (const group of roleGroups) {
for (const role of group.roleDefs) {
if (role.id.endsWith(":admin") || role.name === "主管理员") {
targetRoleDefId = role.id;
targetRoleName = role.name;
break;
}
}
if (targetRoleDefId) break;
}
}
// 3. Match by role name substring
if (!targetRoleDefId) {
for (const group of roleGroups) {
for (const role of group.roleDefs) {
if (role.name.toLowerCase().includes(roleQuery.toLowerCase())) {
targetRoleDefId = role.id;
targetRoleName = role.name;
break;
}
}
if (targetRoleDefId) break;
}
}
if (!targetRoleDefId) {
throw new Error(`Role not found matching query: '${roleQuery}'. Run 'seal-use corps probe-hose' to view all available roles.`);
}
const roleStaffs = await fetchHoseRoleStaffs(probe.domain, probe.openapiToken, targetRoleDefId);
const staffDetails = await fetchHoseStaffDetails(probe.domain, probe.openapiToken, roleStaffs.staffs);
printJson({
domain: probe.domain,
corpId: probe.corpId,
corpName: probe.corpName ?? probe.corpId,
roleId: targetRoleDefId,
roleName: targetRoleName,
count: staffDetails.length,
staffs: staffDetails.map((staff) => ({
id: staff.id,
name: staff.name,
cellphone: maskCellphone(staff.cellphone),
active: staff.active,
authState: staff.authState,
userId: staff.userId,
email: staff.email
}))
});
}
async function addHoseCorp(input: Record<string, unknown>) {
const nameInput = optionalString(input, "name");
const appKey = requiredString(input, "appKey");
const appSecurity = requiredString(input, "appSecurity");
const explicitDomain = optionalString(input, "domain");
const explicitStaffId = optionalString(input, "staffId") ?? optionalString(input, "proxyStaffBizId");
const staffName = optionalString(input, "staffName");
const staffPhone = optionalString(input, "staffPhone");
const roleQuery = optionalString(input, "role") ?? "admin";
const force = input.force === true;
const verify = force || input.verify === false ? false : true;
let domain = explicitDomain;
let corpId = optionalString(input, "corpId") ?? optionalString(input, "corporationId");
let corpName = nameInput;
let openapiToken: string | undefined;
if (!domain || !corpId || !explicitStaffId) {
const probe = await probeHoseDomain(appKey, appSecurity, explicitDomain);
domain = probe.domain;
corpId = corpId ?? probe.corpId;
corpName = corpName ?? probe.corpName;
openapiToken = probe.openapiToken;
}
let finalStaffId = explicitStaffId;
if (!finalStaffId && openapiToken && domain) {
const roleGroups = await fetchHoseRoleDefGroups(domain, openapiToken).catch(() => []);
let targetRoleId: string | undefined;
for (const group of roleGroups) {
for (const role of group.roleDefs) {
if (role.id.endsWith(`:${roleQuery}`) || role.name === roleQuery || role.id === roleQuery) {
targetRoleId = role.id;
break;
}
}
if (targetRoleId) break;
}
if (!targetRoleId) {
targetRoleId = roleGroups.find((group) => group.roleDefs.some((role) => role.id.endsWith(":admin")))
?.roleDefs.find((role) => role.id.endsWith(":admin"))?.id;
}
if (targetRoleId) {
const roleStaffs = await fetchHoseRoleStaffs(domain, openapiToken, targetRoleId).catch(() => ({ staffs: [] }));
const staffDetails = await fetchHoseStaffDetails(domain, openapiToken, roleStaffs.staffs).catch(() => []);
if (staffName || staffPhone) {
const matches = staffDetails.filter((staff) => {
if (staffName && staff.name !== staffName && !staff.name.includes(staffName)) return false;
if (staffPhone && (!staff.cellphone || !staff.cellphone.includes(staffPhone))) return false;
return true;
});
if (matches.length === 1 && matches[0]) {
finalStaffId = matches[0].id;
} else if (matches.length > 1) {
throw new Error(`Multiple staff members matched '${staffName ?? staffPhone}': ${matches.map((m) => `${m.name}(${m.id})`).join(", ")}. Please specify exact staffId.`);
} else {
throw new Error(`No staff member found matching '${staffName ?? staffPhone}' under role ${targetRoleId}. Run 'seal-use corps hose-staffs' to view candidates.`);
}
} else if (!force) {
const candidateLines = staffDetails.map((staff, idx) => ` [${idx + 1}] ${staff.name} (${maskCellphone(staff.cellphone)})`).join("\n");
throw new Error(
`Missing required parameter: staffId. 当前企业共配置了 ${staffDetails.length} 位管理员账号(手机号已脱敏):\n\n${candidateLines}\n\n` +
`👉 请指定要作为审计身份绑定的管理员:\n` +
` • 按姓名选择:追加 --staffName <姓名>(支持关键字,如: --staffName 谢子豪)\n` +
` • 按手机选择:追加 --staffPhone <手机号>(支持手机后4位,如: --staffPhone 5678)\n` +
` • 或传 force:true / --force 自动使用默认首位管理员。`
);
} else {
finalStaffId = staffDetails.find((staff) => staff.active)?.id ?? staffDetails[0]?.id;
}
}
}
if (!finalStaffId) {
if (!verify && explicitStaffId) finalStaffId = explicitStaffId;
else throw new Error("Missing required parameter: staffId (or proxyStaffBizId). Run 'seal-use corps hose-staffs' to discover available administrators.");
}
const id = optionalString(input, "id") ?? corpId;
let name = nameInput ?? corpName ?? corpId;
const sealUrl = optionalString(input, "sealUrl") ?? `https://${corpId.toLowerCase()}.sealai.cc`;
const config: CorpConfig = {
id,
name,
environment: "production",
seal: {
url: sealUrl,
endpoints: { approvalStylePreferences: "api/v1/agent/ai-approval/config" }
},
source: {
type: "hose",
domain: domain!,
appKey,
appSecurity,
corpId: corpId!,
staffId: finalStaffId
},
auth: { refreshTtl: 300 }
};
if (verify) {
clearCorpTokenCache(id);
const live = await resolveLiveSealEnterpriseConfig(config);
if ((!nameInput || nameInput === corpId) && live.tenantName && live.tenantName !== corpId) {
name = live.tenantName;
config.name = live.tenantName;
}
}
const enterprisesDir = resolveWritableEnterprisesDir();
mkdirSync(enterprisesDir, { recursive: true, mode: 0o700 });
const file = join(enterprisesDir, `${safeFileName(id)}.json`);
if (existsSync(file) && input.overwrite !== true) {
throw new Error(`Enterprise config already exists: ${file}。如需覆盖已有配置,请在命令行追加 --overwrite 或在 JSON 参数中添加 "overwrite": true。`);
}
writeFileSync(file, `${JSON.stringify(config, null, 2)}\n`, { mode: 0o600 });
printJson({ id, name, corpId, domain, staffId: finalStaffId, verified: verify, path: file });
}
async function addSealCorp(input: Record<string, unknown>) {
const token = requiredString(input, "token");
const sealUrl = (optionalString(input, "sealUrl") ?? optionalString(input, "url") ?? "").replace(/\/+$/, "");
if (!sealUrl) throw new Error("Missing required JSON field: sealUrl");
const expiresIn = optionalNumber(input, "expiresIn") ?? 30 * 24 * 60 * 60;
const verify = input.force === true || input.verify === false ? false : true;
const custom = sealCustomHeadersFromInput(input);
const remote = verify ? await resolveSealWhoami(sealUrl, token, resolveSealCustomHeaders(custom)) : undefined;
writeSealCorpConfig(input, { token, sealUrl, expiresIn, verify, remote, custom });
}
async function addHoseWebSessionCorp(input: Record<string, unknown>) {
const accessToken = requiredStringAlias(input, ["accessToken", "accesstoken"]);
const corpId = requiredStringAlias(input, ["corpId", "ekbCorpId", "corporationId"]);
const baseUrl = optionalString(input, "baseUrl") ?? optionalString(input, "domain");
const suppliedStaffId = optionalString(input, "staffId");
const details = await resolveHoseAssistLinkDetails({ corpId, accessToken, baseUrl });
const session = await exchangeHoseAssistLink({ corpId, accessToken, baseUrl });
const me = await getMe(createSealClientForUrl(session.sealUrl, session.token));
const identity = { user: me.user as unknown as Record<string, unknown>, tenant: me.tenant as unknown as Record<string, unknown> };
assertHoseAssistTenantMatches(session.corpId, identity.tenant);
if (input.dryRun === true) {
printJson({
dryRun: true,
kind: "hose-web-session",
corpId: session.corpId,
sealUrl: session.sealUrl,
tenant: identity.tenant,
user: identity.user,
staffId: suppliedStaffId ?? details.staffId,
expiresIn: session.expiresIn
});
return;
}
writeHoseWebSessionConfig({
id: session.corpId,
corpId: session.corpId,
name: optionalString(input, "name") ?? details.corpName,
provider: "hosecloud",
domain: details.baseUrl,
closeToken: accessToken,
expiresIn: optionalNumber(input, "expiresIn"),
expiresAt: optionalString(input, "expiresAt"),
staffId: suppliedStaffId ?? details.staffId,
sealUrl: session.sealUrl,
remote: identity,
overwrite: input.overwrite === true
});
}
function sealCustomHeadersFromInput(input: Record<string, unknown>) {
// Validates extra headers/cookies up front so a malformed name fails here
// rather than on the next config load.
return {
headers: SealHeaderMapSchema.parse(input.headers),
cookies: SealCookieMapSchema.parse(input.cookies)
};
}
async function addLinkCorp(link: string, name: string | undefined, overwrite: boolean, dryRun = false) {
// Classify the incoming link by score. The highest-scoring scorer decides
// which exchange path to take. This lets one command consume both Seal
// native delegate links (*/delegate?token=...) and Hose assistance links
// (*/web/thirdparty.html) without the caller having to know which they got.
const winner = scoreAssistLink(link)[0];
if (!winner || winner.score < 50) {
throw new Error(
`Unrecognized assistance/delegate link. Expected either a Seal native delegate link ` +
`(https://<tenant>.sealai.cc/delegate?token=...) or a Hose assistance link ` +
`(https://<corp>.ekuaibao.com/web/thirdparty.html?accessToken=...&ekbCorpId=...). ` +
`Top score: ${winner ? winner.kind + "=" + winner.score : "none"}.`
);
}
if (winner.kind === "seal-delegate") {
if (dryRun) {
const preview = await previewSealDelegateLink(link);
const parsed = parseSealDelegateLink(link);
printJson({
dryRun: true,
kind: "seal-delegate",
sealUrl: parsed.sealUrl,
tenant: { id: preview.tenantId, name: preview.tenantName },
user: { id: preview.userId, name: preview.userName },
delegationId: preview.delegationId
});
return;
}
// Seal native delegate link: exchange directly against the Seal tenant.
console.error(`ℹ️ [Seal 委托链接] 识别为 Seal 原生委托链接 (${winner.reason}),正在交换临时会话...`);
const session = await exchangeSealDelegateLink(link);
const identity = { user: session.user, tenant: session.tenant };
const tenantSlug = typeof session.tenant.tenantSlug === "string" && session.tenant.tenantSlug ? session.tenant.tenantSlug : undefined;
const tenantId = typeof session.tenant.id === "string" && session.tenant.id ? session.tenant.id : undefined;
const corpId = tenantSlug ?? tenantId ?? "seal-delegate";
writeSealCorpConfig(
{ id: corpId, corpId, name, provider: "seal", overwrite },
{ token: session.token, sealUrl: session.sealUrl, expiresIn: session.expiresIn, verify: true, remote: identity }
);
return;
}
// Default: Hose assistance link. Keep the Hose web-session source and its
// CloseAPI token; the Seal bearer is only a runtime SSO session.
const hoseLink = parseHoseAssistLink(link);
const details = await resolveHoseAssistLinkDetails(hoseLink);
const session = await exchangeHoseAssistLink(hoseLink);
const me = await getMe(createSealClientForUrl(session.sealUrl, session.token));
const identity = { user: me.user as unknown as Record<string, unknown>, tenant: me.tenant as unknown as Record<string, unknown> };
assertHoseAssistTenantMatches(session.corpId, identity.tenant);
if (dryRun) {
printJson({ dryRun: true, kind: "hose", corpId: session.corpId, sealUrl: session.sealUrl, tenant: identity.tenant, user: identity.user, staffId: details.staffId });
return;
}
writeHoseWebSessionConfig({
id: session.corpId,
corpId: session.corpId,
name: name ?? details.corpName,
provider: "hosecloud",
domain: details.baseUrl,
closeToken: hoseLink.accessToken,
staffId: details.staffId,
sealUrl: session.sealUrl,
remote: identity,
overwrite
});
}
function selectHoseOpenApiKey(keys: HoseOpenApiKey[], corpId: string, selection: { appKey?: string; keyId?: string }, contextCmd: string): HoseOpenApiKey {
if (keys.length === 0) {
throw new Error(`[合思子域提权] 未能从协助链接中提取到合思企业 [${corpId}] 的 OpenAPI 密钥凭据。\n` +
`💡 说明:此能力专属于合思 (Hose) 子域,用于将临时会话提权为标准 OpenAPI 开发者接入。需要企业管理员已在合思开放平台创建应用并生成 appKey/appSecurity。`);
}
if (selection.keyId || selection.appKey) {
const matched = keys.find((key) => (selection.keyId && key.id === selection.keyId) || (selection.appKey && key.appKey === selection.appKey));
if (!matched) {
console.error(`\n❌ 未找到指定的合思 OpenAPI 密钥 (${selection.appKey ?? selection.keyId})。`);
console.error(`ℹ️ 该合思企业当前存在以下 ${keys.length} 套候选密钥:`);
for (const key of keys) console.error(` • "${key.name || "未命名应用"}" (appKey: ${key.appKey}, keyId: ${key.id}, 状态: ${key.active ? "🟢 启用" : "⚪ 停用"})`);
throw new CliError("指定的合思密钥不存在,请从上述候选列表中选择正确的 appKey 或 keyId。", 2, `${contextCmd} --app-key ${keys[0]!.appKey}`);
}
return matched;
}
if (keys.length === 1) return keys[0]!;
// Multiple keys exist and user did not specify which one
console.error(`\nℹ️ [合思子域提权] 合思企业 [${corpId}] 存在多套 (${keys.length} 套) OpenAPI 应用密钥凭据:`);
for (let i = 0; i < keys.length; i++) {
const key = keys[i]!;
console.error(` [${i + 1}] "${key.name || "未命名应用"}" (appKey: ${key.appKey}, keyId: ${key.id}, 状态: ${key.active ? "🟢 启用" : "⚪ 停用"})`);
}
console.error("\n👉 为确保权限提权绑定正确的业务应用,请显式指定要使用的密钥套件:");
console.error(" 在命令后追加 --app-key <key> 或 --key-id <id> 参数。\n");
throw new CliError(`合思企业 [${corpId}] 存在多套 OpenAPI 密钥,必须指定 --app-key 或 --key-id 明确选择要绑定的密钥。`, 2, `${contextCmd} --app-key ${keys[0]!.appKey}`);
}
async function addLinkAsHoseCorp(link: string, name: string | undefined, overwrite: boolean, force = false, dryRun = false, selection?: { appKey?: string; keyId?: string }) {
console.error("ℹ️ [合思子域提权] 正在通过合思协助链接提取 OpenAPI 开发者密钥并提升企业权限等级...");
const result = await fetchHoseOpenApiKeysFromLink(link);
const selectedKey = selectHoseOpenApiKey(result.keys, result.corpId, selection ?? {}, `seal-use corps add-link "<url>" --elevate-hose`);
console.error(dryRun
? `ℹ️ [合思子域提权] 已选定合思 OpenAPI 凭据 (appKey: ${selectedKey.appKey}, 应用: "${selectedKey.name || "未命名应用"}"),正在生成预览...`
: `ℹ️ [合思子域提权] 已选定合思 OpenAPI 凭据 (appKey: ${selectedKey.appKey}, 应用: "${selectedKey.name || "未命名应用"}"),正在初始化为长期合思标准配置...`);
if (dryRun) {
printJson({
dryRun: true,
kind: "hose",
provider: "hose",
corpId: result.corpId,
corpName: result.corpName,
baseUrl: result.baseUrl,
staffId: result.staffId,
selectedKey: {
id: selectedKey.id,
name: selectedKey.name || "-",
appKey: selectedKey.appKey,
appSecurity: maskHoseSecurity(selectedKey.appSecurity),
active: selectedKey.active
}
});
return;
}
await addHoseCorp({ domain: result.baseUrl, appKey: selectedKey.appKey, appSecurity: selectedKey.appSecurity, corpId: result.corpId, name: name ?? result.corpName, staffId: result.staffId, overwrite, force });
}
export async function extractKeysFromLinkAction(link: string, options: { reveal?: boolean; save?: boolean; name?: string; overwrite?: boolean; force?: boolean; appKey?: string; keyId?: string }) {
const result = await fetchHoseOpenApiKeysFromLink(link);
const reveal = options.reveal === true;
if (options.save) {
const selectedKey = selectHoseOpenApiKey(result.keys, result.corpId, { appKey: options.appKey, keyId: options.keyId }, `seal-use corps hose-extract-keys "<url>" --save`);
console.error(`ℹ️ [合思子域提权] 正在将选定的合思 OpenAPI 密钥 (appKey: ${selectedKey.appKey}, 应用: "${selectedKey.name || "未命名应用"}") 保存为标准合思企业配置...`);
await addHoseCorp({ domain: result.baseUrl, appKey: selectedKey.appKey, appSecurity: selectedKey.appSecurity, corpId: result.corpId, name: options.name ?? result.corpName, staffId: result.staffId, overwrite: options.overwrite, force: options.force });
return;
}
if (!reveal) console.error("ℹ️ [合思子域提权] 成功提取合思 (Hose) OpenAPI 密钥。接入密码默认脱敏,附加 --reveal (或 -r) 可查看完整 appSecurity 明文;附加 --save 可将临时会话提权并持久化为标准合思企业。\n");
else console.error("⚠️ [合思子域提权] 正在以明文展示合思 (Hose) appSecurity 接入密码,请妥善保管敏感凭据。\n");
printJson({
provider: "hose",
capability: "privilege-elevation",
corpId: result.corpId,
corpName: result.corpName ?? result.corpId,
baseUrl: result.baseUrl,
staffId: result.staffId,
keyCount: result.keys.length,
keys: result.keys.map((key) => ({
id: key.id,
name: key.name || "-",
appKey: key.appKey,
appSecurity: reveal ? key.appSecurity : maskHoseSecurity(key.appSecurity),
active: key.active,
createTime: key.createTime,
updateTime: key.updateTime
}))
});
}
export async function showCorpKeysAction(targetCorpId: string | undefined, options: { reveal?: boolean }) {
const corp = selectCorp(targetCorpId);
const reveal = options.reveal === true;
if (corp.source.type !== "hose") {
throw new CliError(`【合思子域专享能力】当前企业「${corp.name}」(id: ${corp.id}) 为原生 Seal (${corp.source.type}) 租户,非合思 (Hose/合思云/易快报) 渠道企业。\n` +
"OpenAPI 密钥查询与提权能力专属于合思生态租户(用于从合思协助链接或合思凭据中提取开发者密钥提升权限等级),非合思渠道企业不支持此能力。", 2);
}
const appKey = corp.source.appKey ?? corp.source.key;
const appSecurity = corp.source.appSecurity ?? corp.source.password;
if (!reveal) console.error("💡 [合思子域] 接入密码默认脱敏,附加 --reveal (或 -r) 可查看完整 appSecurity 明文。\n");
else console.error("⚠️ [合思子域] 正在以明文展示合思 appSecurity 接入密码,请妥善保管敏感凭据。\n");
printJson({
provider: "hose",
capability: "privilege-elevation",
corpId: corp.id,
corpName: corp.name,
domain: corp.source.domain,
staffId: corp.source.staffId,
appKey: appKey ?? "-",
appSecurity: appSecurity ? (reveal ? appSecurity : maskHoseSecurity(appSecurity)) : "-",
active: true
});
}
type RemoteSealIdentity = { user: Record<string, unknown>; tenant: Record<string, unknown> };
function writeSealCorpConfig(input: Record<string, unknown>, auth: { token: string; sealUrl: string; expiresIn: number; expiresAt?: string; verify: boolean; remote?: RemoteSealIdentity; custom?: { headers?: Record<string, string>; cookies?: Record<string, string> } }) {
const { token, sealUrl, expiresIn, verify, remote } = auth;
const expiresAt = auth.expiresAt ?? formatUtcTimestampSeconds(Date.now() + expiresIn * 1000);
const custom = auth.custom ?? sealCustomHeadersFromInput(input);
const remoteUser = remote?.user;
const remoteTenant = remote?.tenant;
const tenantSlug = optionalString(input, "tenantSlug") ?? stringValue(remoteTenant?.tenantSlug);
const tenantId = optionalString(input, "tenantId") ?? stringValue(remoteTenant?.id);
const tenantName = optionalString(input, "tenantName") ?? stringValue(remoteTenant?.name);
const id = optionalString(input, "id") ?? tenantSlug ?? tenantId;
if (!id) throw new Error("Missing required JSON field: id. Seal whoami did not return tenantSlug or tenantId.");
const staffId = optionalString(input, "staffId") ?? stringValue(remoteUser?.providerUserId) ?? stringValue(remoteUser?.id) ?? "seal";
const provider = optionalString(input, "provider") ?? stringValue(remoteUser?.provider) ?? stringValue((remoteTenant as any)?.providerConfig?.provider);
const corpId = optionalString(input, "corpId") ?? tenantSlug ?? tenantId ?? id;
const config: CorpConfig = {
id,
name: optionalString(input, "name") ?? tenantName ?? id,
environment: "production",
seal: {
url: sealUrl,
tenantSlug,
headers: custom.headers,
cookies: custom.cookies,
endpoints: { approvalStylePreferences: "api/v1/agent/ai-approval/config" }
},
source: {
type: "seal",
token,
sealUrl,
expiresIn,
expiresAt,
staffId,
corpId,
tenantId,
tenantSlug,
tenantName,
providerUserId: stringValue(remoteUser?.providerUserId),
provider
},
auth: { refreshTtl: 300 }
};
const enterprisesDir = resolveWritableEnterprisesDir();
mkdirSync(enterprisesDir, { recursive: true, mode: 0o700 });
const file = join(enterprisesDir, `${safeFileName(id)}.json`);
if (existsSync(file) && input.overwrite !== true) throw new Error(`Enterprise config already exists: ${file}. Pass "overwrite": true to replace it.`);
writeFileSync(file, `${JSON.stringify(config, null, 2)}\n`, { mode: 0o600 });
printJson({ id, name: config.name, tenantId, tenantSlug, verified: verify, path: file });
}
function writeHoseWebSessionConfig(input: { id: string; corpId: string; name?: string; provider: string; domain: string; closeToken: string; expiresIn?: number; expiresAt?: string; staffId: string; sealUrl: string; remote: RemoteSealIdentity; overwrite: boolean }) {
const remoteTenant = input.remote.tenant;
const tenantSlug = stringValue(remoteTenant.tenantSlug) ?? input.corpId;
const tenantId = stringValue(remoteTenant.id);
const tenantName = stringValue(remoteTenant.name);
const config: CorpConfig = {
id: input.id,
name: input.name ?? tenantName ?? input.id,
environment: "production",
seal: {
url: input.sealUrl,
tenantSlug,
endpoints: { approvalStylePreferences: "api/v1/agent/ai-approval/config" }
},
source: {
type: "hose",
provider: input.provider,
domain: input.domain,
closeToken: input.closeToken,
...(input.expiresIn !== undefined ? { expiresIn: input.expiresIn } : {}),
...(input.expiresAt ? { expiresAt: input.expiresAt } : {}),
staffId: input.staffId,
corpId: input.corpId,
sealUrl: input.sealUrl
},
auth: { refreshTtl: 300 }
};
const enterprisesDir = resolveWritableEnterprisesDir();
mkdirSync(enterprisesDir, { recursive: true, mode: 0o700 });
const file = join(enterprisesDir, `${safeFileName(input.id)}.json`);
if (existsSync(file) && !input.overwrite) throw new Error(`Enterprise config already exists: ${file}. Pass "overwrite": true to replace it.`);
writeFileSync(file, `${JSON.stringify(config, null, 2)}\n`, { mode: 0o600 });
printJson({ id: config.id, name: config.name, tenantId, tenantSlug, sourceType: "hose", credentialMode: "web-session", verified: true, path: file });
}
async function resolveSealWhoami(sealUrl: string, token: string, customHeaders: Record<string, string> = {}) {
const me = await getMe(createSealClientForUrl(sealUrl, token, customHeaders));
return { user: (me.user ?? {}) as Record<string, unknown>, tenant: (me.tenant ?? {}) as Record<string, unknown> };
}
+224
View File
@@ -0,0 +1,224 @@
import {
findCorpConfigFile,
loadCorpConfigs,
loadGlobalConfig,
saveGlobalConfig,
updateCorpConfig
} from "../../../core/config/loader.js";
import { filterCorpsFuzzy } from "../../../core/search/fuzzy.js";
import { sortCorpsByUsageAndRecency } from "../../../core/stats/usage-tracker.js";
import type { CorpEnvironment } from "../../../core/config/types.js";
import { selectCorp } from "../../helpers.js";
import { confirmationRequired, usageError } from "../../errors.js";
import { booleanOption, numberOption, optionalString, stringOption } from "../../parser.js";
import { printJson } from "../../printer.js";
import type { ParsedArgs } from "../../types.js";
import { formatSafeSourceDetail, resolveCorpSealUrl } from "./shared.js";
export async function handleCorpOverview(
action: string | undefined,
maybeName: string | undefined,
args: ParsedArgs
): Promise<boolean> {
if (!action || action === "list" || action === "search" || action === "find") {
const rawQuery = (
maybeName ?? stringOption(args.options.query) ?? stringOption(args.options.q)
)?.trim();
const isStrict = booleanOption(args.options.strict) === true;
const envFilter = (
stringOption(args.options.env) ?? stringOption(args.options.environment)
)?.trim().toLowerCase();
if ((action === "search" || action === "find") && !rawQuery && !envFilter) {
throw usageError("Usage: seal-use corps search <query> [--env <production|test>] [--strict]");
}
const corpId = stringOption(args.options.corp);
const allCorps = loadCorpConfigs();
const globalConfig = loadGlobalConfig();
const currentCorpId = corpId ?? (
globalConfig.stateful
? globalConfig.defaultCorpId ?? allCorps[0]?.id
: undefined
);
let filtered = allCorps;
if (envFilter) {
filtered = filtered.filter((item) => (item.environment ?? "production").toLowerCase() === envFilter);
}
if (rawQuery) {
filtered = filterCorpsFuzzy(filtered, rawQuery, { strict: isStrict });
}
if (allCorps.length === 0) {
console.error("提示:当前未检测到企业配置。你可以使用 seal-use corps add-hose-persistent、add-hose-web-session 或 add-seal-bearer 添加企业,或运行 seal-use help 查看说明。");
} else if (isStrict && filtered.length === 0 && (action === "search" || action === "find") && rawQuery) {
console.error(`提示:未在严格模式下匹配到企业 "${rawQuery}"。可以尝试省略 --strict 进行智能软搜索。`);
}
// Search results are already ranked by match confidence. Usage sorting is
// useful for an unfiltered list, but would otherwise discard relevance
// ordering for a query.
const sorted = rawQuery ? filtered : sortCorpsByUsageAndRecency(filtered, currentCorpId);
const isList = !action || action === "list";
const isAll = booleanOption(args.options.all) === true;
const limitOpt = numberOption(args.options.limit);
const defaultLimit = 10;
const effectiveLimit = limitOpt !== undefined
? Math.max(1, limitOpt)
: (isList && !isAll ? defaultLimit : undefined);
let displayList = sorted;
if (effectiveLimit !== undefined && sorted.length > effectiveLimit) {
displayList = sorted.slice(0, effectiveLimit);
if (isList && !isAll && limitOpt === undefined) {
console.error(
`ℹ️ 当前共有 ${sorted.length} 家企业,已按最近 7 天使用频次展示前 ${effectiveLimit} 家。\n` +
`👉 查看全部请添加: seal-use corps list --all\n` +
`👉 检索指定企业请使用: seal-use corps search <keyword>`
);
}
}
printJson(displayList.map((item) => ({
id: item.id,
name: item.name,
environment: item.environment ?? "production",
sourceType: item.source.type,
provider: (item.source as any).provider ?? item.source.type,
staffId: item.source.staffId,
testCorpId: item.testCorpId,
prodCorpId: item.prodCorpId,
current: item.id === currentCorpId
})));
return true;
}
if (action === "get" || action === "show") {
const targetCorpId = maybeName ?? stringOption(args.options.corp);
if (!targetCorpId) {
throw usageError("Usage: seal-use corps get <corpId>");
}
const corp = selectCorp(targetCorpId);
const configFile = findCorpConfigFile(corp.id);
const sealUrl = resolveCorpSealUrl(corp);
printJson({
id: corp.id,
name: corp.name,
environment: corp.environment ?? "production",
configFile,
seal: {
url: sealUrl,
tenantSlug: corp.seal.tenantSlug ?? (corp.source as any).tenantSlug,
customHeaderNames: corp.seal.headers ? Object.keys(corp.seal.headers) : [],
customCookieNames: corp.seal.cookies ? Object.keys(corp.seal.cookies) : [],
endpoints: corp.seal.endpoints
},
source: formatSafeSourceDetail(corp.source),
relations: {
testCorpId: corp.testCorpId,
prodCorpId: corp.prodCorpId
},
auth: {
refreshTtl: corp.auth.refreshTtl
}
});
return true;
}
if (action === "current") {
const corp = selectCorp(stringOption(args.options.corp));
printJson({
id: corp.id,
name: corp.name,
environment: corp.environment ?? "production",
sourceType: corp.source.type,
provider: (corp.source as any).provider ?? corp.source.type,
staffId: corp.source.staffId,
testCorpId: corp.testCorpId,
prodCorpId: corp.prodCorpId
});
return true;
}
if (action === "mark" || action === "mark-test" || action === "mark-prod") {
const corpId = maybeName ?? stringOption(args.options.corp);
if (!corpId) {
throw usageError("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");
}
const corp = selectCorp(corpId);
const targetEnv = (
action === "mark-test"
? "test"
: action === "mark-prod"
? "production"
: (stringOption(args.options.env) ?? stringOption(args.options.environment))
) as CorpEnvironment | undefined;
if (targetEnv !== "production" && targetEnv !== "test") {
throw usageError("Usage: seal-use corps mark <corpId> --env <production|test> [--confirm]");
}
const confirmed = booleanOption(args.options.confirm) === true || booleanOption(args.options.yes) === true;
if (!confirmed) {
throw confirmationRequired(
`Refusing to change environment tag of enterprise '${corp.name}' (${corp.id}) to '${targetEnv}' without --confirm. Marking alters synchronization safety guards.`,
`seal-use corps mark ${corp.id} --env ${targetEnv} --confirm`
);
}
const updated = updateCorpConfig(corp.id, { environment: targetEnv });
printJson({
id: updated.id,
name: updated.name,
environment: updated.environment,
testCorpId: updated.testCorpId,
prodCorpId: updated.prodCorpId
});
return true;
}
if (action === "rename") {
const targetCorpId = maybeName ?? stringOption(args.options.corp) ?? stringOption(args.options.id);
const newName = stringOption(args.options.name) ?? stringOption(args.options.to) ??
(args.command[3] && !args.command[3].startsWith("-") ? args.command[3] : undefined);
if (!targetCorpId || !newName) {
throw new Error("Usage: seal-use corps rename <corpId> --name <newName>");
}
const corp = selectCorp(targetCorpId);
const updated = updateCorpConfig(corp.id, { name: newName });
printJson({
success: true,
id: updated.id,
name: updated.name,
previousName: corp.name
});
return true;
}
if (action === "switch") {
const corpId = maybeName;
if (!corpId) throw new Error("Usage: seal-use corps switch <corpId>");
const globalConfig = loadGlobalConfig();
if (!globalConfig.stateful) {
throw new Error(
"Cannot switch the default enterprise while stateless mode is enabled. " +
"Use `seal-use config mode stateful` first."
);
}
const corp = selectCorp(corpId);
saveGlobalConfig({ ...globalConfig, stateful: true, defaultCorpId: corp.id });
printJson({
current: true,
id: corp.id,
name: corp.name
});
return true;
}
return false;
}
+82
View File
@@ -0,0 +1,82 @@
import { defaultSealUrl } from "../../../core/auth/hose.js";
import type { CorpConfig, SealSource } from "../../../core/config/types.js";
// ---------------------------------------------------------------------------
// Helpers & Sanitizers
// ---------------------------------------------------------------------------
export function maskSecret(value: string | undefined): string | undefined {
if (!value) return undefined;
if (value.length <= 8) return "****";
return `${value.slice(0, 4)}...${value.slice(-4)}`;
}
export function resolveCorpSealUrl(corp: CorpConfig): string | undefined {
if (corp.source.type === "hose") {
return defaultSealUrl(corp, corp.source);
}
return corp.seal.url ?? corp.source.sealUrl;
}
export function formatSafeSourceDetail(source: SealSource) {
if (source.type === "hose") {
const key = source.appKey ?? source.key;
return {
type: "hose",
provider: source.provider ?? "hosecloud",
domain: source.domain,
corpId: source.corpId,
staffId: source.staffId,
appKey: maskSecret(key),
hasAppSecurity: Boolean(source.appSecurity ?? source.password),
hasCloseToken: Boolean(source.closeToken),
closeTokenExpiresIn: source.closeToken ? source.expiresIn : undefined,
closeTokenExpiresAt: source.closeToken ? source.expiresAt : undefined,
credentialMode: source.closeToken ? "web-session" : "persistent",
sealUrl: source.sealUrl
};
}
if (source.type === "seal") {
return {
type: "seal",
provider: source.provider ?? "seal",
tenantId: source.tenantId,
tenantSlug: source.tenantSlug,
tenantName: source.tenantName,
providerUserId: source.providerUserId,
staffId: source.staffId,
corpId: source.corpId,
sealUrl: source.sealUrl,
hasToken: Boolean(source.token),
tokenMasked: maskSecret(source.token),
expiresIn: source.expiresIn,
expiresAt: source.expiresAt
};
}
throw new Error(`Unsupported enterprise source type: ${(source as { type: string }).type}`);
}
export function maskCellphone(phone: string | undefined | null): string {
if (!phone) return "未绑定手机";
const cleaned = phone.trim();
if (cleaned.length === 11) {
return `${cleaned.slice(0, 3)}****${cleaned.slice(7)}`;
}
if (cleaned.length >= 7) {
return `${cleaned.slice(0, 3)}****${cleaned.slice(-4)}`;
}
if (cleaned.length > 4) {
return `${cleaned.slice(0, 2)}****${cleaned.slice(-2)}`;
}
return cleaned;
}
export function formatUtcTimestampSeconds(timestampMs: number): string {
return new Date(timestampMs).toISOString().replace(/\.\d{3}Z$/, "Z");
}
export function stringValue(value: unknown): string | undefined {
return typeof value === "string" && value ? value : undefined;
}
+637
View File
@@ -0,0 +1,637 @@
import { randomBytes } from "node:crypto";
import type { KyInstance } from "ky";
import { createSealClient } from "../../../core/http/factory.js";
import type { CorpConfig } from "../../../core/config/types.js";
import * as api from "../../../domains/seal/api.js";
import {
computeNextSyncIteration,
formatSyncVersionName,
saveRuleMappingSnapshot
} from "../../../domains/seal/rule-mapping.js";
import { savePublishedRuleVersionSnapshot } from "../../../domains/seal/rule-version-snapshot.js";
import { executeApprovalRunsReplay, type ReplayRecordsQuery } from "../../../domains/seal/webhook-replay.js";
import { selectCorp } from "../../helpers.js";
import { CliError, confirmationRequired, usageError } from "../../errors.js";
import { booleanOption, numberOption, stringOption } from "../../parser.js";
import { printJson } from "../../printer.js";
import type { ParsedArgs } from "../../types.js";
export async function handleCorpSync(
action: string | undefined,
maybeName: string | undefined,
args: ParsedArgs
): Promise<boolean> {
if (action === "sync-test") {
const targetCorpId = maybeName ?? stringOption(args.options.corp);
const prodCorp = selectCorp(targetCorpId);
if (!prodCorp.testCorpId) {
throw usageError(
`Production enterprise '${prodCorp.name}' (${prodCorp.id}) has no bound test enterprise.\n` +
`Run 'seal-use corps bind-test ${prodCorp.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association.`
);
}
const testCorp = selectCorp(prodCorp.testCorpId);
if (testCorp.environment !== "test") {
throw new Error(
`Target enterprise '${testCorp.name}' (${testCorp.id}) is marked as '${testCorp.environment}', NOT 'test'. Aborting sync to protect non-test environments.`
);
}
const prodClient = await createSealClient(prodCorp);
const testClient = await createSealClient(testCorp);
const [
prodPref,
testPref,
prodRules,
testRules,
prodVersions,
testVersions,
prodDocsRes,
testDocsRes
] = await Promise.all([
api.getApprovalStylePreferences(prodClient, prodCorp.seal.endpoints.approvalStylePreferences),
api.getApprovalStylePreferences(testClient, testCorp.seal.endpoints.approvalStylePreferences),
api.listApprovalRules(prodClient),
api.listApprovalRules(testClient),
api.listApprovalRuleVersions(prodClient),
api.listApprovalRuleVersions(testClient),
listAllApprovalDocuments(prodClient),
listAllApprovalDocuments(testClient)
]);
const prodDocs = (prodDocsRes.articles || []).filter((d) => !d.isDeleted);
const testDocs = (testDocsRes.articles || []).filter((d) => !d.isDeleted);
const testDocsByTitle = new Map(testDocs.map((d) => [d.title.trim(), d]));
const docsToCreate = [];
const docsToUpdate = [];
const prodTitles = new Set(prodDocs.map((d) => d.title.trim()));
for (const prodDoc of prodDocs) {
const title = prodDoc.title.trim();
const existing = testDocsByTitle.get(title);
if (!existing) {
docsToCreate.push(prodDoc);
continue;
}
const contentChanged = existing.content !== prodDoc.content;
const purposeChanged = (existing.purpose ?? "") !== (prodDoc.purpose ?? "");
const enabledChanged = existing.enabled !== prodDoc.enabled;
const contentTypeChanged = existing.contentType !== prodDoc.contentType;
const statusChanged = (existing.status ?? "") !== (prodDoc.status ?? "");
const scenariosChanged = JSON.stringify([...(existing.scenarios ?? [])].sort()) !==
JSON.stringify([...(prodDoc.scenarios ?? [])].sort());
const tagsChanged = JSON.stringify([...(existing.tags ?? [])].sort()) !==
JSON.stringify([...(prodDoc.tags ?? [])].sort());
if (contentChanged || purposeChanged || enabledChanged || contentTypeChanged || statusChanged || scenariosChanged || tagsChanged) {
docsToUpdate.push({
testId: existing.id,
prodDoc,
reasons: [
...(contentChanged ? ["content"] : []),
...(purposeChanged ? ["purpose"] : []),
...(enabledChanged ? ["enabled"] : []),
...(contentTypeChanged ? ["contentType"] : []),
...(statusChanged ? ["status"] : []),
...(scenariosChanged ? ["scenarios"] : []),
...(tagsChanged ? ["tags"] : [])
]
});
}
}
const docsToDelete = testDocs.filter((td) => !prodTitles.has(td.title.trim()));
const sortedProdVersions = [...prodVersions].sort((a, b) => b.versionNumber - a.versionNumber);
const latestProd = sortedProdVersions[0];
const prodVersionNumber = latestProd?.versionNumber;
const sortedTestVersions = [...testVersions].sort((a, b) => b.versionNumber - a.versionNumber);
const targetTestExpectedVersionNumber = (sortedTestVersions[0]?.versionNumber ?? 0) + 1;
const nextIteration = computeNextSyncIteration(prodCorp.name, prodVersionNumber, testVersions);
const customVersionName = stringOption(args.options["version-name"]) ?? stringOption(args.options.versionName);
const versionName = customVersionName ?? formatSyncVersionName(
prodCorp.name,
prodVersionNumber,
nextIteration,
targetTestExpectedVersionNumber
);
const updatedTestPref = {
...testPref,
tone: prodPref.tone,
language: prodPref.language,
detailLevel: prodPref.detailLevel,
outputFormat: prodPref.outputFormat,
examples: prodPref.examples ?? [],
prohibitedPhrases: prodPref.prohibitedPhrases ?? [],
customInstructions: prodPref.customInstructions,
decisionPreferences: prodPref.decisionPreferences,
thinkingDepthPreference: prodPref.thinkingDepthPreference
};
const dryRun = booleanOption(args.options["dry-run"]) === true || booleanOption(args.options.dryRun) === true;
if (dryRun) {
printJson({
dryRun: true,
source: {
id: prodCorp.id,
name: prodCorp.name,
environment: prodCorp.environment,
latestPublishedVersion: latestProd ? {
versionNumber: latestProd.versionNumber,
versionName: latestProd.versionName
} : null,
documentsCount: prodDocs.length
},
target: {
id: testCorp.id,
name: testCorp.name,
environment: testCorp.environment
},
versionMappingPlan: {
sourceProdVersionNumber: prodVersionNumber ?? null,
sourceProdVersionName: latestProd?.versionName ?? null,
targetTestExpectedVersionNumber,
targetTestPublishVersionName: versionName,
iteration: nextIteration
},
preferencesDiff: {
decisionPreferences: {
before: testPref.decisionPreferences,
after: prodPref.decisionPreferences
},
thinkingDepthPreference: {
before: testPref.thinkingDepthPreference,
after: prodPref.thinkingDepthPreference
}
},
rulesPlan: {
sourceDraftRuleCount: prodRules.rules.length,
targetExistingDraftRuleCount: testRules.rules.length,
toDeleteCount: testRules.rules.length,
toCreateCount: prodRules.rules.length,
rulesToSync: prodRules.rules.map((r, idx) => ({
index: idx + 1,
sourceRuleId: r.id,
sourceRuleCode: r.code ?? idx + 1,
expectedTargetCode: `rule-${idx + 1}`,
description: r.description,
scope: r.scope,
strictness: r.strictness
}))
},
documentsPlan: {
sourceDocumentCount: prodDocs.length,
targetExistingDocumentCount: testDocs.length,
toCreateCount: docsToCreate.length,
toCreate: docsToCreate.map((d) => ({
title: d.title,
purpose: d.purpose,
contentType: d.contentType,
scenarios: d.scenarios
})),
toUpdateCount: docsToUpdate.length,
toUpdate: docsToUpdate.map((d) => ({
targetDocumentId: d.testId,
title: d.prodDoc.title,
reasons: d.reasons
})),
toDeleteCount: docsToDelete.length,
toDelete: docsToDelete.map((d) => ({
targetDocumentId: d.id,
title: d.title
}))
},
publishingPlan: {
targetCorpId: testCorp.id,
publishVersionName: versionName,
publishTarget: "test"
},
hosecloudSyncPlan: buildHosecloudSyncPlan(prodCorp, prodPref),
productionGuarantees: {
prodRulesStayDraft: true,
prodVersionPublished: false
}
});
return true;
}
const confirmed = booleanOption(args.options.yes) === true || booleanOption(args.options.confirm) === true;
if (!confirmed) {
throw confirmationRequired(
`Refusing to overwrite test enterprise '${testCorp.name}' (${testCorp.id}) with preferences, ${prodRules.rules.length} draft rules, and ${prodDocs.length} knowledge documents from production enterprise '${prodCorp.name}' (${prodCorp.id}) without --yes. This will replace test draft rules, synchronize knowledge documents, and publish a new version on the test enterprise.`,
`seal-use corps sync-test ${prodCorp.id} --yes`
);
}
// 1. Update style & decision preferences in test enterprise
await api.updateApprovalStylePreferences(testClient, updatedTestPref, testCorp.seal.endpoints.approvalStylePreferences);
// 2. Synchronize knowledge documents in test enterprise (full coverage, delete redundant test documents)
const deletedDocs: Array<{ id: string; title: string }> = [];
for (const doc of docsToDelete) {
await api.deleteApprovalDocument(testClient, doc.id);
deletedDocs.push({ id: doc.id, title: doc.title });
}
const updatedDocs: Array<{ id: string; title: string; reasons: string[] }> = [];
for (const item of docsToUpdate) {
await api.updateApprovalDocument(testClient, item.testId, {
title: item.prodDoc.title,
purpose: item.prodDoc.purpose,
content: item.prodDoc.content,
contentType: item.prodDoc.contentType,
status: item.prodDoc.status,
enabled: item.prodDoc.enabled,
scenarios: item.prodDoc.scenarios && item.prodDoc.scenarios.length > 0 ? item.prodDoc.scenarios : ["audit"],
tags: item.prodDoc.tags
});
updatedDocs.push({ id: item.testId, title: item.prodDoc.title, reasons: item.reasons });
}
const createdDocs: Array<{ id: string; title: string }> = [];
for (const doc of docsToCreate) {
const created = await api.createApprovalDocument(testClient, {
title: doc.title,
purpose: doc.purpose,
content: doc.content,
contentType: doc.contentType,
status: doc.status,
enabled: doc.enabled,
scenarios: doc.scenarios && doc.scenarios.length > 0 ? doc.scenarios : ["audit"],
tags: doc.tags
});
createdDocs.push({ id: created.id, title: created.title });
}
// 3. Clear old draft rules in test enterprise
for (const rule of testRules.rules) {
await api.deleteApprovalRule(testClient, rule.id);
}
// 4. Create new draft rules in test enterprise
const createdRules: any[] = [];
for (const rule of prodRules.rules) {
const created = await api.createApprovalRule(testClient, {
description: rule.description,
scope: rule.scope,
strictness: rule.strictness
});
createdRules.push(created);
}
// 5. Batch recode rules in test enterprise
const recodeResult = await api.recodeApprovalRules(testClient) as { ok: boolean; status: number };
if (!recodeResult.ok) {
throw new Error(`Failed to recode test approval rules: HTTP ${recodeResult.status}`);
}
// 6. Sync HoseCloud integrations before publishing the test version. This
// keeps a Hose configuration failure from leaving a newly published
// version behind, although the overall multi-request operation remains
// non-transactional.
const hosecloudSync = await syncHosecloudIntegrationsToTest(prodCorp, testCorp, prodClient, testClient);
// 7. Publish new version in test enterprise
const published = await api.publishApprovalRuleVersion(testClient, versionName);
try {
savePublishedRuleVersionSnapshot(testCorp.id, published.version, createdRules);
} catch {}
const publishedRules = published.version.rules ?? [];
const ruleMapping = prodRules.rules.map((prodRule, idx) => {
const testDraft = createdRules[idx];
const publishedRule = publishedRules[idx];
return {
index: idx + 1,
sourceRuleId: prodRule.id,
sourceRuleCode: prodRule.code ?? idx + 1,
targetRuleId: testDraft?.id ?? "",
targetRuleCode: publishedRule?.code ?? `rule-${idx + 1}`,
description: prodRule.description,
scope: prodRule.scope,
strictness: prodRule.strictness
};
});
const versionMapping = {
sourceProdVersionNumber: prodVersionNumber ?? null,
sourceProdVersionName: latestProd?.versionName ?? null,
targetTestVersionNumber: published.version.versionNumber,
targetTestVersionName: published.version.versionName ?? null
};
let mappingSavedTo: string | undefined;
try {
mappingSavedTo = saveRuleMappingSnapshot({
syncedAt: new Date().toISOString(),
source: {
id: prodCorp.id,
name: prodCorp.name,
latestPublishedVersionNumber: prodVersionNumber ?? null,
latestPublishedVersionName: latestProd?.versionName ?? null
},
target: {
id: testCorp.id,
name: testCorp.name,
publishedVersionNumber: published.version.versionNumber,
publishedVersionName: published.version.versionName,
rulesCount: published.rulesCount
},
versionMapping,
ruleMapping
});
} catch {}
printJson({
success: true,
syncedAt: new Date().toISOString(),
source: {
id: prodCorp.id,
name: prodCorp.name,
environment: prodCorp.environment,
latestPublishedVersion: latestProd ? {
versionNumber: latestProd.versionNumber,
versionName: latestProd.versionName
} : null,
draftRulesCount: prodRules.rules.length,
documentsCount: prodDocs.length
},
target: {
id: testCorp.id,
name: testCorp.name,
environment: testCorp.environment,
deletedDraftRulesCount: testRules.rules.length,
createdDraftRulesCount: createdRules.length,
publishedVersion: {
id: published.version.id,
versionNumber: published.version.versionNumber,
versionName: published.version.versionName,
rulesCount: published.rulesCount
}
},
documents: {
sourceCount: prodDocs.length,
targetExistingCount: testDocs.length,
createdCount: createdDocs.length,
created: createdDocs,
updatedCount: updatedDocs.length,
updated: updatedDocs,
deletedCount: deletedDocs.length,
deleted: deletedDocs
},
versionMapping,
ruleMapping,
...(mappingSavedTo ? { mappingSavedTo } : {}),
hosecloudSync,
productionGuarantees: {
prodRulesStayDraft: true,
prodVersionPublished: false
}
});
return true;
}
if (action === "replay-test") {
const targetCorpId = maybeName ?? stringOption(args.options.corp) ?? stringOption(args.options.prodCorp) ?? stringOption(args.options["prod-corp"]);
const prodCorp = selectCorp(targetCorpId);
const force = booleanOption(args.options.force) === true;
const dryRun = booleanOption(args.options.dryRun) ?? booleanOption(args.options["dry-run"]);
const confirmed = booleanOption(args.options.yes) === true || booleanOption(args.options.confirm) === true;
let testCorp: CorpConfig;
if (!prodCorp.testCorpId) {
if (!force) {
throw usageError(
`Production enterprise '${prodCorp.name}' (${prodCorp.id}) has no bound test enterprise.\n` +
`Run 'seal-use corps bind-test ${prodCorp.id} <testCorpId> --confirm' first to establish a verified 1-to-1 association,\n` +
`or add '--force' (or use 'seal-use webhook replay <recordId> --force') if you explicitly intend to replay directly within production.`
);
}
testCorp = prodCorp;
} else {
testCorp = selectCorp(prodCorp.testCorpId);
if (testCorp.environment !== "test" && !force) {
throw new Error(
`Target enterprise '${testCorp.name}' (${testCorp.id}) is marked as '${testCorp.environment}', NOT 'test'. Aborting replay to protect non-test environments (use --force to override).`
);
}
}
if (!dryRun && !confirmed) {
throw confirmationRequired(
"Refusing to replay approval records without --confirm. Use --dry-run to preview the payload without sending it.",
`seal-use corps replay-test ${targetCorpId ?? "<prodCorpId>"} --confirm`
);
}
const recordId = stringOption(args.options.recordId) ?? stringOption(args.options["record-id"]) ?? stringOption(args.options.id);
const recordIdsRaw = stringOption(args.options.recordIds) ?? stringOption(args.options["record-ids"]);
const recordIds = recordIdsRaw ? recordIdsRaw.split(",").map((s) => s.trim()).filter(Boolean) : undefined;
const sn = stringOption(args.options.sn) ?? stringOption(args.options.documentSn) ?? stringOption(args.options["document-sn"]);
const snsRaw = stringOption(args.options.sns) ?? stringOption(args.options["document-sns"]);
const sns = snsRaw ? snsRaw.split(",").map((s) => s.trim()).filter(Boolean) : undefined;
const limit = numberOption(args.options.limit) ?? (!recordId && !recordIds && !sn && !sns ? 1 : undefined);
const status = stringOption(args.options.status);
const startDate = stringOption(args.options.startDate) ?? stringOption(args.options["start-date"]);
const endDate = stringOption(args.options.endDate) ?? stringOption(args.options["end-date"]);
const prodClient = await createSealClient(prodCorp);
const testClient = prodCorp.id === testCorp.id ? prodClient : await createSealClient(testCorp);
const selector = stringOption(args.options.webhook) ?? stringOption(args.options.selector);
const snSuffix = stringOption(args.options.snSuffix) ?? stringOption(args.options["sn-suffix"]);
const snPrefix = stringOption(args.options.snPrefix) ?? stringOption(args.options["sn-prefix"]);
const docIdSuffix = stringOption(args.options.docIdSuffix) ?? stringOption(args.options["doc-id-suffix"]);
const docIdPrefix = stringOption(args.options.docIdPrefix) ?? stringOption(args.options["doc-id-prefix"]);
const query: ReplayRecordsQuery = { recordId, recordIds, sn, sns, limit, status, startDate, endDate };
console.error(`[corps-replay-test] 正式企业「${prodCorp.name}」(${prodCorp.id}) -> 测试企业「${testCorp.name}」(${testCorp.id})`);
const result = await executeApprovalRunsReplay({
query,
sourceClient: prodClient,
targetClient: testClient,
sourceCorp: prodCorp,
targetCorp: testCorp,
webhookSelector: selector,
snPrefix,
snSuffix,
docIdPrefix,
docIdSuffix,
dryRun
});
if (dryRun) {
console.error(`[corps-replay-test] 预览模式:已成功从 ${prodCorp.name} 提取单据并转换为 Webhook Payload(未实际推送)。`);
console.log(JSON.stringify(result, null, 2));
return true;
}
if (result.success) {
if (result.totalCount === 1 && result.replayedDocument) {
console.error(`🟢 成功重放单据「${result.replayedDocument.documentSN}」至 ${testCorp.name} (${result.targetWebhook?.name ?? "Webhook 通道"})`);
} else {
console.error(`🟢 成功重放 ${result.successCount} 条单据(来自「${prodCorp.name}」)至「${testCorp.name}」(${result.targetWebhook?.name ?? "Webhook 通道"})`);
}
} else {
console.error(`🔴 单据重放部分或全部失败(成功 ${result.successCount} 条,失败 ${result.failureCount} 条)至「${testCorp.name}」`);
}
console.error(`👉 Next action: seal-use approval-runs list --corp ${testCorp.id} --limit ${result.totalCount}`);
console.log(JSON.stringify(result, null, 2));
if (!result.success) {
throw new CliError(`Approval record replay failed: ${result.failureCount} record(s) failed.`, 1);
}
return true;
}
return false;
}
async function listAllApprovalDocuments(client: KyInstance) {
const pageSize = 100;
const documents: Awaited<ReturnType<typeof api.listApprovalDocuments>>["articles"] = [];
let offset = 0;
while (true) {
const page = await api.listApprovalDocuments(client, { offset, limit: pageSize });
documents.push(...page.articles);
offset += page.articles.length;
if (page.articles.length === 0 || page.articles.length < pageSize) break;
if (page.total !== undefined && offset >= page.total) break;
}
return { articles: documents, total: documents.length };
}
/**
* Build the outboundName for a test-env hosecloud integration.
* Format: {企业名前7字}(Seal测) — capped at 13 chars total.
*/
export function buildTestHosecloudOutboundName(corpName: string): string {
const suffix = "(Seal测)";
// "(Seal测)" is 7 chars; leave 6 chars for the corp name prefix.
const maxPrefix = 13 - suffix.length;
const prefix = [...corpName].slice(0, maxPrefix).join("");
return prefix + suffix;
}
/**
* Sync hosecloud integrations from the production Seal enterprise into the
* test Seal enterprise. Rules:
* - Only runs when prodCorp.source.type === "hose" (credentials available locally)
* - outboundName: buildTestHosecloudOutboundName(prodCorp.name)
* - mode: always "assisted"
* - apiKey/apiSecret: from prodCorp.source.appKey / appSecurity
* - apiOrigin/customApiUrl: copied verbatim from the production integration config
* - signKey: existing test integration keeps its key; new ones get a fresh random key
* - Does NOT call syncHosecloudOutbound (no sync to 合思)
*/
interface HosecloudSyncResult {
skipped: boolean;
reason?: string;
synced?: Array<{ signKey: string; outboundName: string; corporationId: string; action: "created" | "updated" }>;
}
function buildHosecloudSyncPlan(prodCorp: CorpConfig, prodPref: any) {
if (prodCorp.source.type !== "hose") {
return {
sourceType: prodCorp.source.type,
skipped: true,
reason: "prod source is not hose; no hosecloud credentials available"
};
}
const rawHose = (prodPref.integrations ?? []).filter((i: any) => i.type === "hosecloud");
const seen = new Set<string>();
const distinct = rawHose.filter((i: any) => {
const cid = i.corporationId ?? prodCorp.id;
if (seen.has(cid)) return false;
seen.add(cid);
return true;
});
return {
sourceType: "hose",
outboundName: buildTestHosecloudOutboundName(prodCorp.name),
targetMode: "assisted",
integrationsCount: distinct.length,
integrations: distinct.map((i: any) => ({
corporationId: i.corporationId,
apiOrigin: i.apiOrigin,
customApiUrl: i.customApiUrl
}))
};
}
async function syncHosecloudIntegrationsToTest(
prodCorp: CorpConfig,
testCorp: CorpConfig,
prodClient: KyInstance,
testClient: KyInstance
): Promise<HosecloudSyncResult> {
if (prodCorp.source.type !== "hose") {
return { skipped: true, reason: "prod source is not hose; no hosecloud credentials available" };
}
const appKey = (prodCorp.source.appKey ?? prodCorp.source.key)?.trim();
const appSecurity = (prodCorp.source.appSecurity ?? prodCorp.source.password)?.trim();
if (!appKey || !appSecurity) {
return { skipped: true, reason: "prod hose source missing appKey/appSecurity (or key/password)" };
}
const [prodPref, testPref] = await Promise.all([
api.getApprovalStylePreferences(prodClient, prodCorp.seal.endpoints.approvalStylePreferences),
api.getApprovalStylePreferences(testClient, testCorp.seal.endpoints.approvalStylePreferences)
]);
const prodIntegrations: any[] = (prodPref.integrations ?? []).filter((i: any) => i.type === "hosecloud");
if (prodIntegrations.length === 0) {
return { skipped: true, reason: "prod Seal enterprise has no hosecloud integrations configured" };
}
// Deduplicate prod integrations by corporationId:
// Production enterprises may have multiple integrations (e.g. "assisted" + "fully_automatic")
// with the same corporationId. For the test environment, exactly one assisted integration per
// corporationId is needed.
const seenCorpIds = new Set<string>();
const distinctProdIntegrations: any[] = [];
for (const item of prodIntegrations) {
const cid = item.corporationId ?? prodCorp.id;
if (!seenCorpIds.has(cid)) {
seenCorpIds.add(cid);
distinctProdIntegrations.push({ ...item, corporationId: cid });
}
}
const testIntegrations: any[] = testPref.integrations ?? [];
const testByCorpId = new Map<string, any>(
testIntegrations.filter((i: any) => i.type === "hosecloud").map((i: any) => [i.corporationId, i])
);
const outboundName = buildTestHosecloudOutboundName(prodCorp.name);
const synced: HosecloudSyncResult["synced"] = [];
const nextHosecloudIntegrations: any[] = distinctProdIntegrations.map((prodInt: any) => {
const existing = testByCorpId.get(prodInt.corporationId);
const signKey = existing?.signKey ?? randomBytes(6).toString("hex");
synced!.push({
signKey,
outboundName,
corporationId: prodInt.corporationId,
action: existing ? "updated" : "created"
});
return {
type: "hosecloud",
signKey,
outboundName,
mode: "assisted",
apiKey: appKey,
apiSecret: appSecurity,
apiOrigin: prodInt.apiOrigin,
...(prodInt.customApiUrl ? { customApiUrl: prodInt.customApiUrl } : {}),
corporationId: prodInt.corporationId
};
});
// Merge: keep non-hosecloud entries + newly built hosecloud entries
const otherIntegrations = testIntegrations.filter((i: any) => i.type !== "hosecloud");
await api.updateApprovalStylePreferences(
testClient,
{ ...testPref, integrations: [...otherIntegrations, ...nextHosecloudIntegrations] },
testCorp.seal.endpoints.approvalStylePreferences
);
return { skipped: false, synced };
}