import{createRequireasVF0}from"node:module";varUF0=Object.create;var{getPrototypeOf:YF0,defineProperty:AF,getOwnPropertyNames:JF0}=Object;varQF0=Object.prototype.hasOwnProperty;functionwF0($){returnthis[$]}varKF0,HF0,vI=($,I,z)=>{varq=$!=null&&typeof$==="object";if(q){varU=I?KF0??=newWeakMap:HF0??=newWeakMap,Y=U.get($);if(Y)returnY}z=$!=null?UF0(YF0($)):{};letJ=I||!$||!$.__esModule?AF(z,"default",{value:$,enumerable:!0}):z;for(letQofJF0($))if(!QF0.call(J,Q))AF(J,Q,{get:wF0.bind($,Q),enumerable:!0});if(q)U.set($,J);returnJ};varO=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);varGF0=($)=>$;functionWF0($,I){this[$]=GF0.bind(null,I)}varY5=($,I)=>{for(varzinI)AF($,z,{get:I[z],enumerable:!0,configurable:!0,set:WF0.bind(I,z)})};vart=VF0(import.meta.url);varaY=O((ln)=>{Object.defineProperty(ln,"__esModule",{value:!0});ln.regexpCode=ln.getEsmExportName=ln.getProperty=ln.safeStringify=ln.stringify=ln.strConcat=ln.addCodeArg=ln.str=ln._=ln.nil=ln._Code=ln.Name=ln.IDENTIFIER=ln._CodeOrName=void0;class$G{}ln._CodeOrName=$G;ln.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classWzextends$G{constructor($){super();if(!ln.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}ln.Name=Wz;classa$extends$G{constructor($){super();this._items=typeof$==="string"?[$]:$}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;let$=this._items[0];return$===""||$==='""'}getstr(){var$;return($=this._str)!==null&&$!==void0?$:this._str=this._items.reduce((I,z)=>`${I}${z}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((I,z)=>{if(zinstanceofWz)I[z.str]=(I[z.str]||0)+1;returnI},{})}}ln._Code=a$;ln.nil=newa$("");functiondn($,...I){letz=[$[0]],q=0;while(q<I.length)yT(z,I[q]),z.push($[++q]);returnnewa$(z)}ln._=dn;varST=newa$("+");functionmn($,...I){letz=[tY($[0])],q=0;while(q<I.length)z.push(ST),yT(z,I[q]),z.push(ST,tY($[++q]));returnSA0(z),newa$(z)}ln.str=mn;functionyT($,I){if(Iinstanceofa$)$.push(...I._items);elseif(IinstanceofWz)$.push(I);else$.push(xA0(I))}ln.addCodeArg=yT;functionSA0($){letI=1;while(I<$.length-1){if($[I]===ST){letz=yA0($[I-1],$[I+1]);if(z!==void0){$.splice(I-1,3,z);continue}$[I++]="+"}I++}}functionyA0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(IinstanceofWz||$[$.length-1]!=='"')return;if(typeofI!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return$.slice(0,-1)+I.slice(1);return}if(typeofI=="string"&&I[0]==='"'&&!($instanceofWz))return`"${$}${I.slice(1)}`;return}functionuA0($,I){returnI.emptyStr()?$:$.emptyStr()?I:mn`${$}${I}`}ln.strConcat=uA0;functionxA0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:tY(Array.isArray($)?$.join(","):$)}functionkA0($){returnnewa$(tY($))}ln.stringify=kA0;functiontY($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}ln.safeStringify=tY;functionfA0($){returntypeof$=="string"&&ln.IDENTIFIER.test($)?newa$(`.${$}`):dn`[${$}]`}ln.getProperty=fA0;functionnA0($){if(typeof$=="string"&&ln.IDENTIFIER.test($))returnnewa$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}ln.getEsmExportName=nA0;functionbA0($){returnnewa$($.toString())}ln.regexpCode=bA0});varfT=O((an)=>{Object.defineProperty(an,"__esModule",{value:!0});an.ValueScope=an.ValueScopeName=an.Scope=an.varKinds=an.UsedValueState=void0;vard6=aY();classrnextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varzG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(zG||(an.UsedValueState=zG={}));an.varKinds={const:newd6.Name("const"),let:newd6.Name("let"),var:newd6.Name("var")};classxT{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return$instanceofd6.Name?$:this.name($)}name($){returnnewd6.Name(this._newName($))}_newName($){letI=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){varI,z;if(((z=(I=this._parent)===null||I===void0?void0:I._prefixes)===null||z===void0?void0:z.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}an.Scope=xT;classkTextendsd6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:z}){this.value=$,this.scopePath=d6._`.${newd6.Name(I)}[${z}]`}}an.ValueScopeName=kT;var$P0=d6._`\n`;classtnextendsxT{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?$P0:d6.nil}}get(){returnthis._scope}name($){returnnewkT($,this._newName($))}value($,I){varz;if(I.ref===void0)throwError("CodeGen: ref must be passed in value");letq=this.toName($),{prefix:U}=q,Y=(z=I.key)!==null&&z!==void0?z:I.ref,J=this._values[U];if(J){letK=J.get(Y);if(Line truncated
import{createRequireasMF0}from"node:module";varWF0=Object.create;var{getPrototypeOf:VF0,defineProperty:PF,getOwnPropertyNames:ZF0}=Object;varXF0=Object.prototype.hasOwnProperty;functionLF0($){returnthis[$]}varDF0,FF0,vI=($,I,z)=>{varq=$!=null&&typeof$==="object";if(q){varU=I?DF0??=newWeakMap:FF0??=newWeakMap,Y=U.get($);if(Y)returnY}z=$!=null?WF0(VF0($)):{};letJ=I||!$||!$.__esModule?PF(z,"default",{value:$,enumerable:!0}):z;for(letQofZF0($))if(!XF0.call(J,Q))PF(J,Q,{get:LF0.bind($,Q),enumerable:!0});if(q)U.set($,J);returnJ};varO=($,I)=>()=>(I||$((I={exports:{}}).exports,I),I.exports);varOF0=($)=>$;functionNF0($,I){this[$]=OF0.bind(null,I)}varY5=($,I)=>{for(varzinI)PF($,z,{get:I[z],enumerable:!0,configurable:!0,set:NF0.bind(I,z)})};vart=MF0(import.meta.url);varaY=O((rn)=>{Object.defineProperty(rn,"__esModule",{value:!0});rn.regexpCode=rn.getEsmExportName=rn.getProperty=rn.safeStringify=rn.stringify=rn.strConcat=rn.addCodeArg=rn.str=rn._=rn.nil=rn._Code=rn.Name=rn.IDENTIFIER=rn._CodeOrName=void0;classIG{}rn._CodeOrName=IG;rn.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;classWzextendsIG{constructor($){super();if(!rn.IDENTIFIER.test($))throwError("CodeGen: name must be a valid identifier");this.str=$}toString(){returnthis.str}emptyStr(){return!1}getnames(){return{[this.str]:1}}}rn.Name=Wz;classa$extendsIG{constructor($){super();this._items=typeof$==="string"?[$]:$}toString(){returnthis.str}emptyStr(){if(this._items.length>1)return!1;let$=this._items[0];return$===""||$==='""'}getstr(){var$;return($=this._str)!==null&&$!==void0?$:this._str=this._items.reduce((I,z)=>`${I}${z}`,"")}getnames(){var$;return($=this._names)!==null&&$!==void0?$:this._names=this._items.reduce((I,z)=>{if(zinstanceofWz)I[z.str]=(I[z.str]||0)+1;returnI},{})}}rn._Code=a$;rn.nil=newa$("");functionln($,...I){letz=[$[0]],q=0;while(q<I.length)uT(z,I[q]),z.push($[++q]);returnnewa$(z)}rn._=ln;varyT=newa$("+");functionon($,...I){letz=[tY($[0])],q=0;while(q<I.length)z.push(yT),uT(z,I[q]),z.push(yT,tY($[++q]));returniA0(z),newa$(z)}rn.str=on;functionuT($,I){if(Iinstanceofa$)$.push(...I._items);elseif(IinstanceofWz)$.push(I);else$.push(dA0(I))}rn.addCodeArg=uT;functioniA0($){letI=1;while(I<$.length-1){if($[I]===yT){letz=pA0($[I-1],$[I+1]);if(z!==void0){$.splice(I-1,3,z);continue}$[I++]="+"}I++}}functionpA0($,I){if(I==='""')return$;if($==='""')returnI;if(typeof$=="string"){if(IinstanceofWz||$[$.length-1]!=='"')return;if(typeofI!="string")return`${$.slice(0,-1)}${I}"`;if(I[0]==='"')return$.slice(0,-1)+I.slice(1);return}if(typeofI=="string"&&I[0]==='"'&&!($instanceofWz))return`"${$}${I.slice(1)}`;return}functioncA0($,I){returnI.emptyStr()?$:$.emptyStr()?I:on`${$}${I}`}rn.strConcat=cA0;functiondA0($){returntypeof$=="number"||typeof$=="boolean"||$===null?$:tY(Array.isArray($)?$.join(","):$)}functionmA0($){returnnewa$(tY($))}rn.stringify=mA0;functiontY($){returnJSON.stringify($).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}rn.safeStringify=tY;functionlA0($){returntypeof$=="string"&&rn.IDENTIFIER.test($)?newa$(`.${$}`):ln`[${$}]`}rn.getProperty=lA0;functionoA0($){if(typeof$=="string"&&rn.IDENTIFIER.test($))returnnewa$(`${$}`);throwError(`CodeGen: invalid export name: ${$}, use explicit $id name mapping`)}rn.getEsmExportName=oA0;functionrA0($){returnnewa$($.toString())}rn.regexpCode=rA0});varnT=O((en)=>{Object.defineProperty(en,"__esModule",{value:!0});en.ValueScope=en.ValueScopeName=en.Scope=en.varKinds=en.UsedValueState=void0;vard6=aY();classanextendsError{constructor($){super(`CodeGen: "code" for ${$} not defined`);this.value=$.value}}varqG;(function($){$[$.Started=0]="Started",$[$.Completed=1]="Completed"})(qG||(en.UsedValueState=qG={}));en.varKinds={const:newd6.Name("const"),let:newd6.Name("let"),var:newd6.Name("var")};classkT{constructor({prefixes:$,parent:I}={}){this._names={},this._prefixes=$,this._parent=I}toName($){return$instanceofd6.Name?$:this.name($)}name($){returnnewd6.Name(this._newName($))}_newName($){letI=this._names[$]||this._nameGroup($);return`${$}${I.index++}`}_nameGroup($){varI,z;if(((z=(I=this._parent)===null||I===void0?void0:I._prefixes)===null||z===void0?void0:z.has($))||this._prefixes&&!this._prefixes.has($))throwError(`CodeGen: prefix "${$}" is not allowed in this scope`);returnthis._names[$]={prefix:$,index:0}}}en.Scope=kT;classfTextendsd6.Name{constructor($,I){super(I);this.prefix=$}setValue($,{property:I,itemIndex:z}){this.value=$,this.scopePath=d6._`.${newd6.Name(I)}[${z}]`}}en.ValueScopeName=fT;varwP0=d6._`\n`;classsnextendskT{constructor($){super($);this._values={},this._scope=$.scope,this.opts={...$,_n:$.lines?wP0:d6.nil}}get(){returnthis._scope}name($){returnnewfT($,this._newName($))}value($,I){varz;if(I.ref===void0)throwError("CodeGen: ref must be passed in value");letq=this.toName($),{prefix:U}=q,Y=(z=I.key)!==null&&z!==void0?z:I.ref,J=this._values[U];if(J){letK=J.get(Y);if(Line truncated
`)}openNode($,I){let z=this.tos,q=this._xml;if(z&&this.open)q.push(">");this._stack.push($),q.push("<"),q.push($),pv(q,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)P00(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");pv(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(A00.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,z){if(this.openNode($,I),z!==void 0)this.writeText(z);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("")}}cv.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};T00.exports=cv});var dv=O((zi0)=>{var E00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Ii0($){if(typeof $==="string")return $;if(E00)return E00.decode($);return $.toString()}zi0.bufferToString=Ii0});var R00=O((j00)=>{Object.defineProperty(j00,"__esModule",{value:!0});j00.CHAR=`
`)}openNode($,I){let z=this.tos,q=this._xml;if(z&&this.open)q.push(">");this._stack.push($),q.push("<"),q.push($),dv(q,I),this.leaf=!0,this.open=!0}addAttribute($,I){if(!this.open)throw Error("Cannot write attributes to node if it is not open");if(I!==void 0)_00(this._xml,$,I)}addAttributes($){if(!this.open)throw Error("Cannot write attributes to node if it is not open");dv(this._xml,$)}writeText($){let I=this._xml;if(this.open)I.push(">"),this.open=!1;this.leaf=!1,I.push(R00.xmlEncode($.toString()))}writeXml($){if(this.open)this._xml.push(">"),this.open=!1;this.leaf=!1,this._xml.push($)}closeNode(){let $=this._stack.pop(),I=this._xml;if(this.leaf)I.push("/>");else I.push("</"),I.push($),I.push(">");this.open=!1,this.leaf=!1}leafNode($,I,z){if(this.openNode($,I),z!==void 0)this.writeText(z);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("")}}mv.StdDocAttributes={version:"1.0",encoding:"UTF-8",standalone:"yes"};C00.exports=mv});var lv=O((Hi0)=>{var h00=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function Ki0($){if(typeof $==="string")return $;if(h00)return h00.decode($);return $.toString()}Hi0.bufferToString=Ki0});var k00=O((y00)=>{Object.defineProperty(y00,"__esModule",{value:!0});y00.CHAR=`
`,$=this.i;break;case Ap0:{let{entityReturnState:z}=this,q=this.entity+I.slice($,this.prevI);this.state=z;let U;if(q==="")this.fail("empty entity name."),U="&;";else U=this.parseEntity(q),this.entity="";if(z!==S6||this.textHandler!==void 0)this.text+=U;break $}case K4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(_Q($))this.state=Dp0,this.unget(),this.xmlDeclPossible=!1;else switch($){case fV:this.state=Np0,this.xmlDeclPossible=!1;break;case e00:this.state=Qp0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case U6:this.state=Wp0;break;default:this.fail("disallowed character in tag name"),this.state=S6,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=Ig,this.openWakaBang="";break;case"--":this.state=$g,this.openWakaBang="";break;case"DOCTYPE":if(this.state=av,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(kV))this.state=wp0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===kV)this.state=Kp0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=$g}sCommentEnded(){let $=this.getCodeNorm();if($!==u4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=$g;else this.state=S6}sCData(){if(this.captureToChar(Wq))this.state=Hp0}sCDataEnding(){let $=this.getCodeNorm();if($===Wq)this.state=Gp0;else this.text+=`]${String.fromCodePoint($)}`,this.state=Ig}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case u4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=S6;break}case Wq:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=Ig}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=m00;else if($===U6||a6($))this.fail("processing instruction without a target."),this.state=$===U6?xV:zg;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=m00}sPIRest(){let{chunk:$,i:I}=this;while(!0){let z=this.getCodeNorm();if(z===K4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(z)){this.piTarget+=$.slice(I,this.prevI);let q=z===U6;if(q||a6(z))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=q?O3:l00}else this.state=q?xV:zg;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(z);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===U6)this.state=xV;else if(!a6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(U6))this.state=xV}sPIEnding(){var $;let I=this.getCodeNorm();if(I===u4){let{piTarget:z}=this;if(z.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:z,body:this.text}),this.piTarget=this.text="",this.state=S6}else if(I===U6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=zg;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===U6){this.state=O3;return}if($!==K4)this.state=Vp0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(Ep0);if($===U6){this.state=O3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(a6($)||$===Gq))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(`expectedthename${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expectedoneof${this.xmlDeclExpects.join(", ")}`)}this.state=$===Gq?o00:Zp0}sXMLDeclEq(){let $=this.getCodeNorm();if($===U6){this.state=O3,this.fail("XML declaration is incomplete.");return}if(a6($))return;if($!==Gq)this.fail("value required.");this.state=o00}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===U6){this.state=O3,this.fail("XML declaration is incomplete.");return}if(a6($))return;if(!nV($))this.fail("value must be quoted."),this.q=s00;else this.q=$;this.state=Xp0}sXMLDeclValue(){let $=this.captureTo([this.q,U6]);if($===U6){this.state=O3,this.text="",this.fail("XML declaration is incomplete.");return}if($===K4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let z=I;if(this.xmlDecl.version=z,!/^1\.[0-9]+$/.test(z))this.fail("ver
Line truncated
`;$=this.i;break;case K4:if(z!==void 0)this.text+=I.slice($);break $;default:if(!a6(U))q=!0}}if(!q)return;if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0}pushAttribNS($,I){var z;let{prefix:q,local:U}=this.qname($),Y={name:$,prefix:q,local:U,value:I};if(this.attribList.push(Y),(z=this.attributeHandler)===null||z===void 0||z.call(this,Y),q==="xmlns"){let J=I.trim();if(this.currentXMLVersion==="1.0"&&J==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[U]=J,wg(this,U,J)}else if($==="xmlns"){let J=I.trim();this.topNS[""]=J,wg(this,"",J)}}pushAttribPlain($,I){var z;let q={name:$,value:I};this.attribList.push(q),(z=this.attributeHandler)===null||z===void 0||z.call(this,q)}end(){var $,I;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:z}=this;while(z.length>0){let U=z.pop();this.fail(`unclosedtag:${U.name}`)}if(this.state!==d00&&this.state!==S6)this.fail("unexpected end.");let{text:q}=this;if(q.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,q),this.text="";return this._closed=!0,(I=this.endHandler)===null||I===void 0||I.call(this),this._init(),this}resolve($){var I,z;let q=this.topNS[$];if(q!==void 0)return q;let{tags:U}=this;for(let Y=U.length-1;Y>=0;Y--)if(q=U[Y].ns[$],q!==void 0)return q;if(q=this.ns[$],q!==void 0)return q;return(z=(I=this.opt).resolvePrefix)===null||z===void 0?void 0:z.call(I,$)}qname($){let I=$.indexOf(":");if(I===-1)return{prefix:"",local:$};let z=$.slice(I+1),q=$.slice(0,I);if(q===""||z===""||z.includes(":"))this.fail(`malformedname:${$}.`);return{prefix:q,local:z}}processAttribsNS(){var $;let{attribList:I}=this,z=this.tag;{let{prefix:Y,local:J}=this.qname(z.name);z.prefix=Y,z.local=J;let Q=z.uri=($=this.resolve(Y))!==null&&$!==void 0?$:"";if(Y!==""){if(Y==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(Q==="")this.fail(`unboundnamespaceprefix:${JSON.stringify(Y)}.`),z.uri=Y}}if(I.length===0)return;let{attributes:q}=z,U=new Set;for(let Y of I){let{name:J,prefix:Q,local:w}=Y,K,H;if(Q==="")K=J==="xmlns"?Vq:"",H=J;else{if(K=this.resolve(Q),K===void 0)this.fail(`unboundnamespaceprefix:${JSON.stringify(Q)}.`),K=Q;H=`{${K}}${w}`}if(U.has(H))this.fail(`duplicateattribute:${H}.`);U.add(H),Y.uri=K,q[J]=Y}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,I=this.tag.attributes;for(let{name:z,value:q}of $){if(I[z]!==void 0)this.fail(`duplicateattribute:${z}.`);I[z]=q}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:I}=this,z=this.tag;z.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,z),I.push(z),this.state=S6,this.name=""}openSelfClosingTag(){var $,I,z;this.processAttribs();let{tags:q}=this,U=this.tag;if(U.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,U),(I=this.closeTagHandler)===null||I===void 0||I.call(this,U),(this.tag=(z=q[q.length-1])!==null&&z!==void 0?z:null)===null)this.closedRoot=!0;this.state=S6,this.name=""}closeTag(){let{tags:$,name:I}=this;if(this.state=S6,this.name="",I===""){this.fail("weird empty close tag."),this.text+="</>";return}let z=this.closeTagHandler,q=$.length;while(q-- >0){let U=this.tag=$.pop();if(this.topNS=U.ns,z===null||z===void 0||z(U),U.name===I)break;this.fail("unexpected close tag.")}if(q===0)this.closedRoot=!0;else if(q<0)this.fail(`unmatchedclosingtag:${I}.`),this.text+=`</${I}>`}parseEntity($){if($[0]!=="#"){let z=this.ENTITIES[$];if(z!==void 0)return z;return this.fail(this.isName($)?"undefined entity.":"disallowed character in entity name."),`&${$};`}let I=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))I=parseInt($.slice(2),16);elseif(/^#[0-9]+$/.test($))I=parseInt($.slice(1),10);if(!this.isChar(I))returnthis.fail("malformed character entity."),`&${$};`;returnString.fromCodePoint(I)}}H10.SaxesParser=K10});varSQ=O((vB1,W10)=>{var{SaxesParser:Cp0}=G10(),{PassThrough:hp0}=F6(),{bufferToString:Sp0}=dv();W10.exports=asyncfunction*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(newhp0);letI=newCp0,z;I.on("error",(U)=>{z=U});letq=[];I.on("opentag",(U)=>q.push({eventType:"opentag",value:U})),I.on("text",(U)=>q.push({eventType:"text",value:U})),I.on("closetag",(U)=>q.push({eventType:"closetag",value:U}));forawait(letUof$){if(I.write(Sp0(U)),z)throwz;yieldq,q=[]}}});varD0=O((gB1,V10)=>{varyp0=SQ(),up0=q6();classXq{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,I){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($instanceofXq)$.reset();elseif($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}asyncparse($){forawait(letIof$)for(let{eventType:z,value:q}ofI)if(z==="opentag")this.parseOpen(q);elseif(z==="text")this.parseText(q);elseif(z==="closetag"){if(!this.parseClose(q.name))returnthLine truncated
`,$=this.i;break;case Rp0:{let{entityReturnState:z}=this,q=this.entity+I.slice($,this.prevI);this.state=z;let U;if(q==="")this.fail("empty entity name."),U="&;";else U=this.parseEntity(q),this.entity="";if(z!==S6||this.textHandler!==void 0)this.text+=U;break $}case K4:this.entity+=I.slice($);break $;default:}}sOpenWaka(){let $=this.getCode();if(CQ($))this.state=Ep0,this.unget(),this.xmlDeclPossible=!1;else switch($){case nV:this.state=vp0,this.xmlDeclPossible=!1;break;case Q10:this.state=Xp0,this.openWakaBang="",this.xmlDeclPossible=!1;break;case U6:this.state=Np0;break;default:this.fail("disallowed character in tag name"),this.state=S6,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=qg,this.openWakaBang="";break;case"--":this.state=zg,this.openWakaBang="";break;case"DOCTYPE":if(this.state=ev,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(fV))this.state=Lp0}sCommentEnding(){var $;let I=this.getCodeNorm();if(I===fV)this.state=Dp0,($=this.commentHandler)===null||$===void 0||$.call(this,this.text),this.text="";else this.text+=`-${String.fromCodePoint(I)}`,this.state=zg}sCommentEnded(){let $=this.getCodeNorm();if($!==u4)this.fail("malformed comment."),this.text+=`--${String.fromCodePoint($)}`,this.state=zg;else this.state=S6}sCData(){if(this.captureToChar(Wq))this.state=Fp0}sCDataEnding(){let $=this.getCodeNorm();if($===Wq)this.state=Op0;else this.text+=`]${String.fromCodePoint($)}`,this.state=qg}sCDataEnding2(){var $;let I=this.getCodeNorm();switch(I){case u4:{($=this.cdataHandler)===null||$===void 0||$.call(this,this.text),this.text="",this.state=S6;break}case Wq:this.text+="]";break;default:this.text+=`]]${String.fromCodePoint(I)}`,this.state=qg}}sPIFirstChar(){let $=this.getCodeNorm();if(this.nameStartCheck($))this.piTarget+=String.fromCodePoint($),this.state=$10;else if($===U6||a6($))this.fail("processing instruction without a target."),this.state=$===U6?kV:Ug;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint($),this.state=$10}sPIRest(){let{chunk:$,i:I}=this;while(!0){let z=this.getCodeNorm();if(z===K4){this.piTarget+=$.slice(I);return}if(!this.nameCheck(z)){this.piTarget+=$.slice(I,this.prevI);let q=z===U6;if(q||a6(z))if(this.piTarget==="xml"){if(!this.xmlDeclPossible)this.fail("an XML declaration must be at the start of the document.");this.state=q?O3:I10}else this.state=q?kV:Ug;else this.fail("disallowed character in processing instruction name."),this.piTarget+=String.fromCodePoint(z);break}}}sPIBody(){if(this.text.length===0){let $=this.getCodeNorm();if($===U6)this.state=kV;else if(!a6($))this.text=String.fromCodePoint($)}else if(this.captureToChar(U6))this.state=kV}sPIEnding(){var $;let I=this.getCodeNorm();if(I===u4){let{piTarget:z}=this;if(z.toLowerCase()==="xml")this.fail("the XML declaration must appear at the start of the document.");($=this.piHandler)===null||$===void 0||$.call(this,{target:z,body:this.text}),this.piTarget=this.text="",this.state=S6}else if(I===U6)this.text+="?";else this.text+=`?${String.fromCodePoint(I)}`,this.state=Ug;this.xmlDeclPossible=!1}sXMLDeclNameStart(){let $=this.skipSpaces();if($===U6){this.state=O3;return}if($!==K4)this.state=Mp0,this.name=String.fromCodePoint($)}sXMLDeclName(){let $=this.captureTo(hp0);if($===U6){this.state=O3,this.name+=this.text,this.text="",this.fail("XML declaration is incomplete.");return}if(!(a6($)||$===Gq))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(`expectedthename${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expectedoneof${this.xmlDeclExpects.join(", ")}`)}this.state=$===Gq?z10:Ap0}sXMLDeclEq(){let $=this.getCodeNorm();if($===U6){this.state=O3,this.fail("XML declaration is incomplete.");return}if(a6($))return;if($!==Gq)this.fail("value required.");this.state=z10}sXMLDeclValueStart(){let $=this.getCodeNorm();if($===U6){this.state=O3,this.fail("XML declaration is incomplete.");return}if(a6($))return;if(!bV($))this.fail("value must be quoted."),this.q=J10;else this.q=$;this.state=Pp0}sXMLDeclValue(){let $=this.captureTo([this.q,U6]);if($===U6){this.state=O3,this.text="",this.fail("XML declaration is incomplete.");return}if($===K4)return;let I=this.text;switch(this.text="",this.name){case"version":{this.xmlDeclExpects=["encoding","standalone"];let z=I;if(this.xmlDecl.version=z,!/^1\.[0-9]+$/.test(z))this.fail("ver
Line truncated
`;$=this.i;break;case K4:if(z!==void 0)this.text+=I.slice($);break $;default:if(!a6(U))q=!0}}if(!q)return;if(!this.sawRoot&&!this.reportedTextBeforeRoot)this.fail("text data outside of root node."),this.reportedTextBeforeRoot=!0;if(this.closedRoot&&!this.reportedTextAfterRoot)this.fail("text data outside of root node."),this.reportedTextAfterRoot=!0}pushAttribNS($,I){var z;let{prefix:q,local:U}=this.qname($),Y={name:$,prefix:q,local:U,value:I};if(this.attribList.push(Y),(z=this.attributeHandler)===null||z===void 0||z.call(this,Y),q==="xmlns"){let J=I.trim();if(this.currentXMLVersion==="1.0"&&J==="")this.fail("invalid attempt to undefine prefix in XML 1.0");this.topNS[U]=J,Hg(this,U,J)}else if($==="xmlns"){let J=I.trim();this.topNS[""]=J,Hg(this,"",J)}}pushAttribPlain($,I){var z;let q={name:$,value:I};this.attribList.push(q),(z=this.attributeHandler)===null||z===void 0||z.call(this,q)}end(){var $,I;if(!this.sawRoot)this.fail("document must contain a root element.");let{tags:z}=this;while(z.length>0){let U=z.pop();this.fail(`unclosedtag:${U.name}`)}if(this.state!==e00&&this.state!==S6)this.fail("unexpected end.");let{text:q}=this;if(q.length!==0)($=this.textHandler)===null||$===void 0||$.call(this,q),this.text="";return this._closed=!0,(I=this.endHandler)===null||I===void 0||I.call(this),this._init(),this}resolve($){var I,z;let q=this.topNS[$];if(q!==void 0)return q;let{tags:U}=this;for(let Y=U.length-1;Y>=0;Y--)if(q=U[Y].ns[$],q!==void 0)return q;if(q=this.ns[$],q!==void 0)return q;return(z=(I=this.opt).resolvePrefix)===null||z===void 0?void 0:z.call(I,$)}qname($){let I=$.indexOf(":");if(I===-1)return{prefix:"",local:$};let z=$.slice(I+1),q=$.slice(0,I);if(q===""||z===""||z.includes(":"))this.fail(`malformedname:${$}.`);return{prefix:q,local:z}}processAttribsNS(){var $;let{attribList:I}=this,z=this.tag;{let{prefix:Y,local:J}=this.qname(z.name);z.prefix=Y,z.local=J;let Q=z.uri=($=this.resolve(Y))!==null&&$!==void 0?$:"";if(Y!==""){if(Y==="xmlns")this.fail('tags may not have "xmlns" as prefix.');if(Q==="")this.fail(`unboundnamespaceprefix:${JSON.stringify(Y)}.`),z.uri=Y}}if(I.length===0)return;let{attributes:q}=z,U=new Set;for(let Y of I){let{name:J,prefix:Q,local:w}=Y,K,H;if(Q==="")K=J==="xmlns"?Vq:"",H=J;else{if(K=this.resolve(Q),K===void 0)this.fail(`unboundnamespaceprefix:${JSON.stringify(Q)}.`),K=Q;H=`{${K}}${w}`}if(U.has(H))this.fail(`duplicateattribute:${H}.`);U.add(H),Y.uri=K,q[J]=Y}this.attribList=[]}processAttribsPlain(){let{attribList:$}=this,I=this.tag.attributes;for(let{name:z,value:q}of $){if(I[z]!==void 0)this.fail(`duplicateattribute:${z}.`);I[z]=q}this.attribList=[]}openTag(){var $;this.processAttribs();let{tags:I}=this,z=this.tag;z.isSelfClosing=!1,($=this.openTagHandler)===null||$===void 0||$.call(this,z),I.push(z),this.state=S6,this.name=""}openSelfClosingTag(){var $,I,z;this.processAttribs();let{tags:q}=this,U=this.tag;if(U.isSelfClosing=!0,($=this.openTagHandler)===null||$===void 0||$.call(this,U),(I=this.closeTagHandler)===null||I===void 0||I.call(this,U),(this.tag=(z=q[q.length-1])!==null&&z!==void 0?z:null)===null)this.closedRoot=!0;this.state=S6,this.name=""}closeTag(){let{tags:$,name:I}=this;if(this.state=S6,this.name="",I===""){this.fail("weird empty close tag."),this.text+="</>";return}let z=this.closeTagHandler,q=$.length;while(q-- >0){let U=this.tag=$.pop();if(this.topNS=U.ns,z===null||z===void 0||z(U),U.name===I)break;this.fail("unexpected close tag.")}if(q===0)this.closedRoot=!0;else if(q<0)this.fail(`unmatchedclosingtag:${I}.`),this.text+=`</${I}>`}parseEntity($){if($[0]!=="#"){let z=this.ENTITIES[$];if(z!==void 0)return z;return this.fail(this.isName($)?"undefined entity.":"disallowed character in entity name."),`&${$};`}let I=NaN;if($[1]==="x"&&/^#x[0-9a-f]+$/i.test($))I=parseInt($.slice(2),16);elseif(/^#[0-9]+$/.test($))I=parseInt($.slice(1),10);if(!this.isChar(I))returnthis.fail("malformed character entity."),`&${$};`;returnString.fromCodePoint(I)}}F10.SaxesParser=D10});varyQ=O((kB1,N10)=>{var{SaxesParser:np0}=O10(),{PassThrough:bp0}=F6(),{bufferToString:ip0}=lv();N10.exports=asyncfunction*($){if($.pipe&&!$[Symbol.asyncIterator])$=$.pipe(newbp0);letI=newnp0,z;I.on("error",(U)=>{z=U});letq=[];I.on("opentag",(U)=>q.push({eventType:"opentag",value:U})),I.on("text",(U)=>q.push({eventType:"text",value:U})),I.on("closetag",(U)=>q.push({eventType:"closetag",value:U}));forawait(letUof$){if(I.write(ip0(U)),z)throwz;yieldq,q=[]}}});varD0=O((fB1,M10)=>{varpp0=yQ(),cp0=q6();classXq{prepare(){}render(){}parseOpen($){}parseText($){}parseClose($){}reconcile($,I){}reset(){if(this.model=null,this.map)Object.values(this.map).forEach(($)=>{if($instanceofXq)$.reset();elseif($.xform)$.xform.reset()})}mergeModel($){this.model=Object.assign(this.model||{},$)}asyncparse($){forawait(letIof$)for(let{eventType:z,value:q}ofI)if(z==="opentag")this.parseOpen(q);elseif(z==="text")this.parseText(q);elseif(z==="closetag"){if(!this.parseClose(q.name))returnthLine truncated
See:https://github.com/isaacs/node-glob/issues/167`);return new x4($,I).found}function x4($,I){if(!$)throw Error("must provide pattern");if(typeof I==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
`)));return}}F=F._target();var T=F._bitField;if((T&50397184)===0)this._yieldedPromise=F,F._proxy(this,null);else if((T&33554432)!==0)$._async.invoke(this._promiseFulfilled,this,F._value());else if((T&16777216)!==0)$._async.invoke(this._promiseRejected,this,F._reason());else this._promiseCancelled()}},$.coroutine=function(X,L){if(typeof X!=="function")throw new Q(`generatorFunctionmustbeafunction
Seehttp://goo.gl/MqrFmX
`);var D=Object(L).yieldHandler,F=V,T=Error().stack;return function(){var P=X.apply(this,arguments),M=new F(void 0,void 0,D,T),B=M.promise();return M._generator=P,M._promiseFulfilled(void 0),B}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new Q("expecting a function but got "+w.classString(X));G.push(X)},$.spawn=function(X){if(Y.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunctionmustbeafunction
`);var D=Object(L).yieldHandler,F=V,T=Error().stack;return function(){var P=X.apply(this,arguments),M=new F(void 0,void 0,D,T),j=M.promise();return M._generator=P,M._promiseFulfilled(void 0),j}},$.coroutine.addYieldHandler=function(X){if(typeof X!=="function")throw new Q("expecting a function but got "+w.classString(X));G.push(X)},$.spawn=function(X){if(Y.deprecated("Promise.spawn()","Promise.coroutine()"),typeof X!=="function")return I(`generatorFunctionmustbeafunction
`)},I=function(){return new S.PromiseInspection(this._target())},z=function(v){return S.reject(new G(v))};function q(){}var U={},Y=d1(),J;if(Y.isNode)J=function(){var v=process.domain;if(v===void 0)v=null;return v};else J=function(){return null};Y.notEnumerableProp(S,"_getDomain",J);var Q=s3(),w=W20(),K=new w;Q.defineProperty(S,"_async",{value:K});var H=b5(),G=S.TypeError=H.TypeError;S.RangeError=H.RangeError;var W=S.CancellationError=H.CancellationError;S.TimeoutError=H.TimeoutError,S.OperationalError=H.OperationalError,S.RejectionError=H.OperationalError,S.AggregateError=H.AggregateError;var V=function(){},X={},L={},D=D20()(S,V),F=O20()(S,V,D,z,q),T=M20()(S),P=T.create,M=P20()(S,T),B=M.CapturedTrace,u=E20()(S,D),h=j20()(L),x=wS(),g=Y.errorObj,p=Y.tryCatch;function i(v,n){if(typeof n!=="function")throw new G("expecting a function but got "+Y.classString(n));if(v.constructor!==S)throw new G(`thepromiseconstructorcannotbeinvokeddirectly
`)},I=function(){return new S.PromiseInspection(this._target())},z=function(v){return S.reject(new G(v))};function q(){}var U={},Y=d1(),J;if(Y.isNode)J=function(){var v=process.domain;if(v===void 0)v=null;return v};else J=function(){return null};Y.notEnumerableProp(S,"_getDomain",J);var Q=s3(),w=N20(),K=new w;Q.defineProperty(S,"_async",{value:K});var H=b5(),G=S.TypeError=H.TypeError;S.RangeError=H.RangeError;var W=S.CancellationError=H.CancellationError;S.TimeoutError=H.TimeoutError,S.OperationalError=H.OperationalError,S.RejectionError=H.OperationalError,S.AggregateError=H.AggregateError;var V=function(){},X={},L={},D=E20()(S,V),F=j20()(S,V,D,z,q),T=g20()(S),P=T.create,M=_20()(S,T),j=M.CapturedTrace,u=h20()(S,D),h=y20()(L),x=HS(),g=Y.errorObj,p=Y.tryCatch;function i(v,n){if(typeof n!=="function")throw new G("expecting a function but got "+Y.classString(n));if(v.constructor!==S)throw new G(`thepromiseconstructorcannotbeinvokeddirectly
Seehttp://goo.gl/MqrFmX
`)}function S(v){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,v!==V)i(this,v),this._resolveFromExecutor(v);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(v){var n=arguments.length;if(n>1){var c=Array(n-1),r=0,U0;for(U0=0;U0<n-1;++U0){var G0=arguments[U0];if(Y.isObject(G0))c[r++]=G0;else return z("expecting an object but got A catch statement predicate "+Y.classString(G0))}return c.length=r,v=arguments[U0],this.then(void 0,h(c,v,this))}return this.then(void 0,v)},S.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},S.prototype.then=function(v,n){if(M.warnings()&&arguments.length>0&&typeof v!=="function"&&typeof n!=="function"){var c=".then() only accepts functions but was passed: "+Y.classString(v);if(arguments.length>1)c+=", "+Y.classString(n);this._warn(c)}return this._then(v,n,void 0,void 0,void 0)},S.prototype.done=function(v,n){var c=this._then(v,n,void 0,void 0,void 0);c._setIsFinal()},S.prototype.spread=function(v){if(typeof v!=="function")return z("expecting a function but got "+Y.classString(v));return this.all()._then(v,void 0,void 0,X,void 0)},S.prototype.toJSON=function(){var v={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())v.fulfillmentValue=this.value(),v.isFulfilled=!0;else if(this.isRejected())v.rejectionReason=this.reason(),v.isRejected=!0;return v},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},S.prototype.error=function(v){return this.caught(Y.originatesFromRejection,v)},S.getNewLibraryCopy=HS.exports,S.is=function(v){return v instanceof S},S.fromNode=S.fromCallback=function(v){var n=new S(V);n._captureStackTrace();var c=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=p(v)(x(n,c));if(r===g)n._rejectCallback(r.e,!0);if(!n._isFateSealed())n._setAsyncGuaranteed();return n},S.all=function(v){return new F(v).promise()},S.cast=function(v){var n=D(v);if(!(n instanceof S))n=new S(V),n._captureStackTrace(),n._setFulfilled(),n._rejectionHandler0=v;return n},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(v){var n=new S(V);return n._captureStackTrace(),n._rejectCallback(v,!0),n},S.setScheduler=function(v){if(typeof v!=="function")throw new G("expecting a function but got "+Y.classString(v));return K.setScheduler(v)},S.prototype._then=function(v,n,c,r,U0){var G0=U0!==void 0,A0=G0?U0:new S(V),g0=this._target(),Q1=g0._bitField;if(!G0){if(A0._propagateFrom(this,3),A0._captureStackTrace(),r===void 0&&(this._bitField&2097152)!==0)if((Q1&50397184)!==0)r=this._boundValue();else r=g0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,A0)}var f0=J();if((Q1&50397184)!==0){var z1,M0,Y0=g0._settlePromiseCtx;if((Q1&33554432)!==0)M0=g0._rejectionHandler0,z1=v;else if((Q1&16777216)!==0)M0=g0._fulfillmentHandler0,z1=n,g0._unsetRejectionIsUnhandled();else Y0=g0._settlePromiseLateCancellationObserver,M0=new W("late cancellation observer"),g0._attachExtraTrace(M0),z1=n;K.invoke(Y0,g0,{handler:f0===null?z1:typeof z1==="function"&&Y.domainBind(f0,z1),promise:A0,receiver:r,value:M0})}else g0._addCallbacks(v,n,A0,r,f0);return A0},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(v){this._bitField=this._bitField&-65536|v&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(K.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(v){var n=v===0?this._receiver0:this[v*4-4+3];if(n===U)return;else if(n===void 0&&this._isBound())return this._boundValue();return n},S.prototype._promiseAt=function(v){return this[v*4-4+2]},S.prototype._fulfillmentHandlerAt=function(v){return this[v*4-4+0]},S.prototype._rejectionHandlerAt=function(v){return this[v*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(v){var{_bit
Line truncated
`)}function S(v){if(this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,v!==V)i(this,v),this._resolveFromExecutor(v);this._promiseCreated(),this._fireEvent("promiseCreated",this)}S.prototype.toString=function(){return"[object Promise]"},S.prototype.caught=S.prototype.catch=function(v){var n=arguments.length;if(n>1){var c=Array(n-1),r=0,U0;for(U0=0;U0<n-1;++U0){var G0=arguments[U0];if(Y.isObject(G0))c[r++]=G0;else return z("expecting an object but got A catch statement predicate "+Y.classString(G0))}return c.length=r,v=arguments[U0],this.then(void 0,h(c,v,this))}return this.then(void 0,v)},S.prototype.reflect=function(){return this._then(I,I,void 0,this,void 0)},S.prototype.then=function(v,n){if(M.warnings()&&arguments.length>0&&typeof v!=="function"&&typeof n!=="function"){var c=".then() only accepts functions but was passed: "+Y.classString(v);if(arguments.length>1)c+=", "+Y.classString(n);this._warn(c)}return this._then(v,n,void 0,void 0,void 0)},S.prototype.done=function(v,n){var c=this._then(v,n,void 0,void 0,void 0);c._setIsFinal()},S.prototype.spread=function(v){if(typeof v!=="function")return z("expecting a function but got "+Y.classString(v));return this.all()._then(v,void 0,void 0,X,void 0)},S.prototype.toJSON=function(){var v={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};if(this.isFulfilled())v.fulfillmentValue=this.value(),v.isFulfilled=!0;else if(this.isRejected())v.rejectionReason=this.reason(),v.isRejected=!0;return v},S.prototype.all=function(){if(arguments.length>0)this._warn(".all() was passed arguments but it does not take any");return new F(this).promise()},S.prototype.error=function(v){return this.caught(Y.originatesFromRejection,v)},S.getNewLibraryCopy=WS.exports,S.is=function(v){return v instanceof S},S.fromNode=S.fromCallback=function(v){var n=new S(V);n._captureStackTrace();var c=arguments.length>1?!!Object(arguments[1]).multiArgs:!1,r=p(v)(x(n,c));if(r===g)n._rejectCallback(r.e,!0);if(!n._isFateSealed())n._setAsyncGuaranteed();return n},S.all=function(v){return new F(v).promise()},S.cast=function(v){var n=D(v);if(!(n instanceof S))n=new S(V),n._captureStackTrace(),n._setFulfilled(),n._rejectionHandler0=v;return n},S.resolve=S.fulfilled=S.cast,S.reject=S.rejected=function(v){var n=new S(V);return n._captureStackTrace(),n._rejectCallback(v,!0),n},S.setScheduler=function(v){if(typeof v!=="function")throw new G("expecting a function but got "+Y.classString(v));return K.setScheduler(v)},S.prototype._then=function(v,n,c,r,U0){var G0=U0!==void 0,A0=G0?U0:new S(V),g0=this._target(),Q1=g0._bitField;if(!G0){if(A0._propagateFrom(this,3),A0._captureStackTrace(),r===void 0&&(this._bitField&2097152)!==0)if((Q1&50397184)!==0)r=this._boundValue();else r=g0===this?void 0:this._boundTo;this._fireEvent("promiseChained",this,A0)}var f0=J();if((Q1&50397184)!==0){var z1,M0,Y0=g0._settlePromiseCtx;if((Q1&33554432)!==0)M0=g0._rejectionHandler0,z1=v;else if((Q1&16777216)!==0)M0=g0._fulfillmentHandler0,z1=n,g0._unsetRejectionIsUnhandled();else Y0=g0._settlePromiseLateCancellationObserver,M0=new W("late cancellation observer"),g0._attachExtraTrace(M0),z1=n;K.invoke(Y0,g0,{handler:f0===null?z1:typeof z1==="function"&&Y.domainBind(f0,z1),promise:A0,receiver:r,value:M0})}else g0._addCallbacks(v,n,A0,r,f0);return A0},S.prototype._length=function(){return this._bitField&65535},S.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0},S.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864},S.prototype._setLength=function(v){this._bitField=this._bitField&-65536|v&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(K.hasCustomScheduler())return;this._bitField=this._bitField|134217728},S.prototype._receiverAt=function(v){var n=v===0?this._receiver0:this[v*4-4+3];if(n===U)return;else if(n===void 0&&this._isBound())return this._boundValue();return n},S.prototype._promiseAt=function(v){return this[v*4-4+2]},S.prototype._fulfillmentHandlerAt=function(v){return this[v*4-4+0]},S.prototype._rejectionHandlerAt=function(v){return this[v*4-4+1]},S.prototype._boundValue=function(){},S.prototype._migrateCallback0=function(v){var{_bit
Line truncated
`).filter((Y)=>Y),q=Math.min(...z.map((Y)=>Y.length-Y.trimStart().length)),U=z.map((Y)=>Y.slice(q)).map((Y)=>" ".repeat(this.indent*2)+Y);for(let Y of U)this.content.push(Y)}compile(){let $=Function,I=this?.args,q=[...(this?.content??[""]).map((U)=>`${U}`)];return new $(...I,q.join(`
`))}}var RO={major:4,minor:4,patch:3};var p0=o("$ZodType",($,I)=>{var z;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=RO;let q=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))q.unshift($);for(let U of q)for(let Y of U._zod.onattach)Y($);if(q.length===0)(z=$._zod).deferred??(z.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let U=(J,Q,w)=>{let K=w9(J),H;for(let G of Q){if(G._zod.def.when){if(SF(J))continue;if(!G._zod.def.when(J))continue}else if(K)continue;let W=J.issues.length,V=G._zod.check(J);if(V instanceof Promise&&w?.async===!1)throw new O8;if(H||V instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await V,J.issues.length===W)return;if(!K)K=w9(J,W)});else{if(J.issues.length===W)continue;if(!K)K=w9(J,W)}}if(H)return H.then(()=>{return J});return J},Y=(J,Q,w)=>{if(w9(J))return J.aborted=!0,J;let K=U(Q,q,w);if(K instanceof Promise){if(w.async===!1)throw new O8;return K.then((H)=>$._zod.parse(H,w))}return $._zod.parse(K,w)};$._zod.run=(J,Q)=>{if(Q.skipChecks)return $._zod.parse(J,Q);if(Q.direction==="backward"){let K=$._zod.parse({value:J.value,issues:[]},{...Q,skipChecks:!0});if(K instanceof Promise)return K.then((H)=>{return Y(H,J,Q)});return Y(K,J,Q)}let w=$._zod.parse(J,Q);if(w instanceof Promise){if(Q.async===!1)throw new O8;return w.then((K)=>U(K,q,Q))}return U(w,q,Q)}}$1($,"~standard",()=>({validate:(U)=>{try{let Y=yI($,U);return Y.success?{value:Y.data}:{issues:Y.error?.issues}}catch(Y){return HY($,U).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),b7=o("$ZodString",($,I)=>{p0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??UO($._zod.bag),$._zod.parse=(z,q)=>{if(I.coerce)try{z.value=String(z.value)}catch(U){}if(typeof z.value==="string")return z;return z.issues.push({expected:"string",code:"invalid_type",input:z.value,inst:$}),z}}),x1=o("$ZodStringFormat",($,I)=>{xI.init($,I),b7.init($,I)}),CO=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=cF),x1.init($,I)}),hO=o("$ZodUUID",($,I)=>{if(I.version){let q={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(q===void 0)throw Error(`InvalidUUIDversion:"${I.version}"`);I.pattern??(I.pattern=n7(q))}else I.pattern??(I.pattern=n7());x1.init($,I)}),SO=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=dF),x1.init($,I)}),yO=o("$ZodURL",($,I)=>{x1.init($,I),$._zod.check=(z)=>{try{let q=z.value.trim();if(!I.normalize&&I.protocol?.source===eF.source){if(!/^https?:\/\//i.test(q)){z.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:z.value,inst:$,continue:!I.abort});return}}let U=new URL(q);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(U.hostname))z.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:z.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(U.protocol.endsWith(":")?U.protocol.slice(0,-1):U.protocol))z.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:z.value,inst:$,continue:!I.abort})}if(I.normalize)z.value=U.href;else z.value=q;return}catch(q){z.issues.push({code:"invalid_format",format:"url",input:z.value,inst:$,continue:!I.abort})}}}),uO=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=mF()),x1.init($,I)}),xO=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=iF),x1.init($,I)}),kO=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=xF),x1.init($,I)}),fO=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=kF),x1.init($,I)}),nO=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=fF),x1.init($,I)}),bO=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=nF),x1.init($,I)}),iO=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=bF),x1.init($,I)}),pO=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=qO(I)),x1.init($,I)}),cO=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=IO),x1.init($,I)}),dO=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=zO(I)),x1.init($,I)}),mO=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=pF),x1.init($,I)}),lO=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=lF),x1.init($,I),$._zod.bag.format="ipv4"}),oO=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=oF),x1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(z)=>{try{new URL(`http://[${z.value}]`)}catch{z.issues.push({code:"invalid_format",format:"ipv6",input:z.value,inst:$,continue:!I.abort})}}}),rO=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=rF(I.delimiter)),x1.init($,I),$._zod.bag.format="mac"}),tO=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=tF),x1.init($,I)}),aO=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=aF),x1.init($,I),$._zod.check=(z)=>{let q=z.value.split("/");try{if(q.length!==2)throw Error();let[U,Y]=q;if(!Y)throw Error();let J=Number(Y);if(`${J}`!==Y)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${U}]`)}catch{z.issues.push({code:"invalid_format",format:"cidrv6",input:z.value,inst:$,continue:!I.abort})}}});function sO($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`))}}var _O={major:4,minor:4,patch:3};var p0=o("$ZodType",($,I)=>{var z;$??($={}),$._zod.def=I,$._zod.bag=$._zod.bag||{},$._zod.version=_O;let q=[...$._zod.def.checks??[]];if($._zod.traits.has("$ZodCheck"))q.unshift($);for(let U of q)for(let Y of U._zod.onattach)Y($);if(q.length===0)(z=$._zod).deferred??(z.deferred=[]),$._zod.deferred?.push(()=>{$._zod.run=$._zod.parse});else{let U=(J,Q,w)=>{let K=w9(J),H;for(let G of Q){if(G._zod.def.when){if(yF(J))continue;if(!G._zod.def.when(J))continue}else if(K)continue;let W=J.issues.length,V=G._zod.check(J);if(V instanceof Promise&&w?.async===!1)throw new O8;if(H||V instanceof Promise)H=(H??Promise.resolve()).then(async()=>{if(await V,J.issues.length===W)return;if(!K)K=w9(J,W)});else{if(J.issues.length===W)continue;if(!K)K=w9(J,W)}}if(H)return H.then(()=>{return J});return J},Y=(J,Q,w)=>{if(w9(J))return J.aborted=!0,J;let K=U(Q,q,w);if(K instanceof Promise){if(w.async===!1)throw new O8;return K.then((H)=>$._zod.parse(H,w))}return $._zod.parse(K,w)};$._zod.run=(J,Q)=>{if(Q.skipChecks)return $._zod.parse(J,Q);if(Q.direction==="backward"){let K=$._zod.parse({value:J.value,issues:[]},{...Q,skipChecks:!0});if(K instanceof Promise)return K.then((H)=>{return Y(H,J,Q)});return Y(K,J,Q)}let w=$._zod.parse(J,Q);if(w instanceof Promise){if(Q.async===!1)throw new O8;return w.then((K)=>U(K,q,Q))}return U(w,q,Q)}}$1($,"~standard",()=>({validate:(U)=>{try{let Y=yI($,U);return Y.success?{value:Y.data}:{issues:Y.error?.issues}}catch(Y){return HY($,U).then((J)=>J.success?{value:J.data}:{issues:J.error?.issues})}},vendor:"zod",version:1}))}),b7=o("$ZodString",($,I)=>{p0.init($,I),$._zod.pattern=[...$?._zod.bag?.patterns??[]].pop()??YO($._zod.bag),$._zod.parse=(z,q)=>{if(I.coerce)try{z.value=String(z.value)}catch(U){}if(typeof z.value==="string")return z;return z.issues.push({expected:"string",code:"invalid_type",input:z.value,inst:$}),z}}),x1=o("$ZodStringFormat",($,I)=>{xI.init($,I),b7.init($,I)}),hO=o("$ZodGUID",($,I)=>{I.pattern??(I.pattern=dF),x1.init($,I)}),SO=o("$ZodUUID",($,I)=>{if(I.version){let q={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[I.version];if(q===void 0)throw Error(`InvalidUUIDversion:"${I.version}"`);I.pattern??(I.pattern=n7(q))}else I.pattern??(I.pattern=n7());x1.init($,I)}),yO=o("$ZodEmail",($,I)=>{I.pattern??(I.pattern=mF),x1.init($,I)}),uO=o("$ZodURL",($,I)=>{x1.init($,I),$._zod.check=(z)=>{try{let q=z.value.trim();if(!I.normalize&&I.protocol?.source===$O.source){if(!/^https?:\/\//i.test(q)){z.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:z.value,inst:$,continue:!I.abort});return}}let U=new URL(q);if(I.hostname){if(I.hostname.lastIndex=0,!I.hostname.test(U.hostname))z.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:I.hostname.source,input:z.value,inst:$,continue:!I.abort})}if(I.protocol){if(I.protocol.lastIndex=0,!I.protocol.test(U.protocol.endsWith(":")?U.protocol.slice(0,-1):U.protocol))z.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:I.protocol.source,input:z.value,inst:$,continue:!I.abort})}if(I.normalize)z.value=U.href;else z.value=q;return}catch(q){z.issues.push({code:"invalid_format",format:"url",input:z.value,inst:$,continue:!I.abort})}}}),xO=o("$ZodEmoji",($,I)=>{I.pattern??(I.pattern=lF()),x1.init($,I)}),kO=o("$ZodNanoID",($,I)=>{I.pattern??(I.pattern=pF),x1.init($,I)}),fO=o("$ZodCUID",($,I)=>{I.pattern??(I.pattern=kF),x1.init($,I)}),nO=o("$ZodCUID2",($,I)=>{I.pattern??(I.pattern=fF),x1.init($,I)}),bO=o("$ZodULID",($,I)=>{I.pattern??(I.pattern=nF),x1.init($,I)}),iO=o("$ZodXID",($,I)=>{I.pattern??(I.pattern=bF),x1.init($,I)}),pO=o("$ZodKSUID",($,I)=>{I.pattern??(I.pattern=iF),x1.init($,I)}),cO=o("$ZodISODateTime",($,I)=>{I.pattern??(I.pattern=UO(I)),x1.init($,I)}),dO=o("$ZodISODate",($,I)=>{I.pattern??(I.pattern=zO),x1.init($,I)}),mO=o("$ZodISOTime",($,I)=>{I.pattern??(I.pattern=qO(I)),x1.init($,I)}),lO=o("$ZodISODuration",($,I)=>{I.pattern??(I.pattern=cF),x1.init($,I)}),oO=o("$ZodIPv4",($,I)=>{I.pattern??(I.pattern=oF),x1.init($,I),$._zod.bag.format="ipv4"}),rO=o("$ZodIPv6",($,I)=>{I.pattern??(I.pattern=rF),x1.init($,I),$._zod.bag.format="ipv6",$._zod.check=(z)=>{try{new URL(`http://[${z.value}]`)}catch{z.issues.push({code:"invalid_format",format:"ipv6",input:z.value,inst:$,continue:!I.abort})}}}),tO=o("$ZodMAC",($,I)=>{I.pattern??(I.pattern=tF(I.delimiter)),x1.init($,I),$._zod.bag.format="mac"}),aO=o("$ZodCIDRv4",($,I)=>{I.pattern??(I.pattern=aF),x1.init($,I)}),sO=o("$ZodCIDRv6",($,I)=>{I.pattern??(I.pattern=sF),x1.init($,I),$._zod.check=(z)=>{let q=z.value.split("/");try{if(q.length!==2)throw Error();let[U,Y]=q;if(!Y)throw Error();let J=Number(Y);if(`${J}`!==Y)throw Error();if(J<0||J>128)throw Error();new URL(`http://[${U}]`)}catch{z.issues.push({code:"invalid_format",format:"cidrv6",input:z.value,inst:$,continue:!I.abort})}}});function eO($){if($==="")return!0;if(/\s/.test($))return!1;if($.length%4!==0)return!1;try{return atob($),!0}catch{return!1}}
Line truncated
`)}V.write("payload.value = newResult;"),V.write("return payload;");let T=V.compile();return(P,M)=>T(W,P,M)},Y,J=f7,Q=!x7.jitless,K=Q&&vF.value,H=I.catchall,G;$._zod.parse=(W,V)=>{G??(G=q.value);let X=W.value;if(!J(X))return W.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),W;if(Q&&K&&V?.async===!1&&V.jitless!==!0){if(!Y)Y=U(I.shape);if(W=Y(W,V),!H)return W;return If([],X,W,V,G,$)}return z(W,V)}});function fk($,I,z,q){for(let Y of $)if(Y.issues.length===0)return I.value=Y.value,I;let U=$.filter((Y)=>!w9(Y));if(U.length===1)return I.value=U[0].value,U[0];return I.issues.push({code:"invalid_union",input:I.value,inst:z,errors:$.map((Y)=>Y.issues.map((J)=>B6(J,q,D4())))}),I}var XY=o("$ZodUnion",($,I)=>{p0.init($,I),$1($._zod,"optin",()=>I.options.some((q)=>q._zod.optin==="optional")?"optional":void 0),$1($._zod,"optout",()=>I.options.some((q)=>q._zod.optout==="optional")?"optional":void 0),$1($._zod,"values",()=>{if(I.options.every((q)=>q._zod.values))return new Set(I.options.flatMap((q)=>Array.from(q._zod.values)));return}),$1($._zod,"pattern",()=>{if(I.options.every((q)=>q._zod.pattern)){let q=I.options.map((U)=>U._zod.pattern);return new RegExp(`^(${q.map((U)=>IY(U.source)).join("|")})$`)}return});let z=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(q,U)=>{if(z)return z(q,U);let Y=!1,J=[];for(let Q of I.options){let w=Q._zod.run({value:q.value,issues:[]},U);if(w instanceof Promise)J.push(w),Y=!0;else{if(w.issues.length===0)return w;J.push(w)}}if(!Y)return fk(J,q,$,U);return Promise.all(J).then((Q)=>{return fk(Q,q,$,U)})}});function nk($,I,z,q){let U=$.filter((Y)=>Y.issues.length===0);if(U.length===1)return I.value=U[0].value,I;if(U.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:z,errors:$.map((Y)=>Y.issues.map((J)=>B6(J,q,D4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:z,errors:[],inclusive:!1});return I}var LN=o("$ZodXor",($,I)=>{XY.init($,I),I.inclusive=!1;let z=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(q,U)=>{if(z)return z(q,U);let Y=!1,J=[];for(let Q of I.options){let w=Q._zod.run({value:q.value,issues:[]},U);if(w instanceof Promise)J.push(w),Y=!0;else J.push(w)}if(!Y)return nk(J,q,$,U);return Promise.all(J).then((Q)=>{return nk(Q,q,$,U)})}}),DN=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,XY.init($,I);let z=$._zod.parse;$1($._zod,"propValues",()=>{let U={};for(let Y of I.options){let J=Y._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(Y)}"`);for(let[Q,w]of Object.entries(J)){if(!U[Q])U[Q]=new Set;for(let K of w)U[Q].add(K)}}return U});let q=RI(()=>{let U=I.options,Y=new Map;for(let J of U){let Q=J._zod.propValues?.[I.discriminator];if(!Q||Q.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(J)}"`);for(let w of Q){if(Y.has(w))throw Error(`Duplicatediscriminatorvalue"${String(w)}"`);Y.set(w,J)}}return Y});$._zod.parse=(U,Y)=>{let J=U.value;if(!f7(J))return U.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),U;let Q=q.value.get(J?.[I.discriminator]);if(Q)return Q._zod.run(U,Y);if(I.unionFallback||Y.direction==="backward")return z(U,Y);return U.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(q.value.keys()),input:J,path:[I.discriminator],inst:$}),U}}),FN=o("$ZodIntersection",($,I)=>{p0.init($,I),$._zod.parse=(z,q)=>{let U=z.value,Y=I.left._zod.run({value:U,issues:[]},q),J=I.right._zod.run({value:U,issues:[]},q);if(Y instanceof Promise||J instanceof Promise)return Promise.all([Y,J]).then(([w,K])=>{return bk(z,w,K)});return bk(z,Y,J)}});function _O($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(Q9($)&&Q9(I)){let z=Object.keys(I),q=Object.keys($).filter((Y)=>z.indexOf(Y)!==-1),U={...$,...I};for(let Y of q){let J=_O($[Y],I[Y]);if(!J.valid)return{valid:!1,mergeErrorPath:[Y,...J.mergeErrorPath]};U[Y]=J.data}return{valid:!0,data:U}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let z=[];for(let q=0;q<$.length;q++){let U=$[q],Y=I[q],J=_O(U,Y);if(!J.valid)return{valid:!1,mergeErrorPath:[q,...J.mergeErrorPath]};z.push(J.data)}return{valid:!0,data:z}}return{valid:!1,mergeErrorPath:[]}}function bk($,I,z){let q=new Map,U;for(let Q of I.issues)if(Q.code==="unrecognized_keys"){U??(U=Q);for(let w of Q.keys){if(!q.has(w))q.set(w,{});q.get(w).l=!0}}else $.issues.push(Q);for(let Q of z.issues)if(Q.code==="unrecognized_keys")for(let w of Q.keys){if(!q.has(w))q.set(w,{});q.get(w).r=!0}else $.issues.push(Q);let Y=[...q].filter(([,Q])=>Q.l&&Q.r).map(([Q])=>Q);if(Y.length&&U)$.issues.push({...U,keys:Y});if(w9($))return $;let J=_O(I.value,z.value);if(!J.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}var RK=o("$ZodTuple",($,I)=>{p0.
Line truncated
`)}V.write("payload.value = newResult;"),V.write("return payload;");let T=V.compile();return(P,M)=>T(W,P,M)},Y,J=f7,Q=!x7.jitless,K=Q&&gF.value,H=I.catchall,G;$._zod.parse=(W,V)=>{G??(G=q.value);let X=W.value;if(!J(X))return W.issues.push({expected:"object",code:"invalid_type",input:X,inst:$}),W;if(Q&&K&&V?.async===!1&&V.jitless!==!0){if(!Y)Y=U(I.shape);if(W=Y(W,V),!H)return W;return qf([],X,W,V,G,$)}return z(W,V)}});function bk($,I,z,q){for(let Y of $)if(Y.issues.length===0)return I.value=Y.value,I;let U=$.filter((Y)=>!w9(Y));if(U.length===1)return I.value=U[0].value,U[0];return I.issues.push({code:"invalid_union",input:I.value,inst:z,errors:$.map((Y)=>Y.issues.map((J)=>B6(J,q,D4())))}),I}var XY=o("$ZodUnion",($,I)=>{p0.init($,I),$1($._zod,"optin",()=>I.options.some((q)=>q._zod.optin==="optional")?"optional":void 0),$1($._zod,"optout",()=>I.options.some((q)=>q._zod.optout==="optional")?"optional":void 0),$1($._zod,"values",()=>{if(I.options.every((q)=>q._zod.values))return new Set(I.options.flatMap((q)=>Array.from(q._zod.values)));return}),$1($._zod,"pattern",()=>{if(I.options.every((q)=>q._zod.pattern)){let q=I.options.map((U)=>U._zod.pattern);return new RegExp(`^(${q.map((U)=>IY(U.source)).join("|")})$`)}return});let z=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(q,U)=>{if(z)return z(q,U);let Y=!1,J=[];for(let Q of I.options){let w=Q._zod.run({value:q.value,issues:[]},U);if(w instanceof Promise)J.push(w),Y=!0;else{if(w.issues.length===0)return w;J.push(w)}}if(!Y)return bk(J,q,$,U);return Promise.all(J).then((Q)=>{return bk(Q,q,$,U)})}});function ik($,I,z,q){let U=$.filter((Y)=>Y.issues.length===0);if(U.length===1)return I.value=U[0].value,I;if(U.length===0)I.issues.push({code:"invalid_union",input:I.value,inst:z,errors:$.map((Y)=>Y.issues.map((J)=>B6(J,q,D4())))});else I.issues.push({code:"invalid_union",input:I.value,inst:z,errors:[],inclusive:!1});return I}var DN=o("$ZodXor",($,I)=>{XY.init($,I),I.inclusive=!1;let z=I.options.length===1?I.options[0]._zod.run:null;$._zod.parse=(q,U)=>{if(z)return z(q,U);let Y=!1,J=[];for(let Q of I.options){let w=Q._zod.run({value:q.value,issues:[]},U);if(w instanceof Promise)J.push(w),Y=!0;else J.push(w)}if(!Y)return ik(J,q,$,U);return Promise.all(J).then((Q)=>{return ik(Q,q,$,U)})}}),FN=o("$ZodDiscriminatedUnion",($,I)=>{I.inclusive=!1,XY.init($,I);let z=$._zod.parse;$1($._zod,"propValues",()=>{let U={};for(let Y of I.options){let J=Y._zod.propValues;if(!J||Object.keys(J).length===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(Y)}"`);for(let[Q,w]of Object.entries(J)){if(!U[Q])U[Q]=new Set;for(let K of w)U[Q].add(K)}}return U});let q=RI(()=>{let U=I.options,Y=new Map;for(let J of U){let Q=J._zod.propValues?.[I.discriminator];if(!Q||Q.size===0)throw Error(`Invaliddiscriminatedunionoptionatindex"${I.options.indexOf(J)}"`);for(let w of Q){if(Y.has(w))throw Error(`Duplicatediscriminatorvalue"${String(w)}"`);Y.set(w,J)}}return Y});$._zod.parse=(U,Y)=>{let J=U.value;if(!f7(J))return U.issues.push({code:"invalid_type",expected:"object",input:J,inst:$}),U;let Q=q.value.get(J?.[I.discriminator]);if(Q)return Q._zod.run(U,Y);if(I.unionFallback||Y.direction==="backward")return z(U,Y);return U.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:I.discriminator,options:Array.from(q.value.keys()),input:J,path:[I.discriminator],inst:$}),U}}),ON=o("$ZodIntersection",($,I)=>{p0.init($,I),$._zod.parse=(z,q)=>{let U=z.value,Y=I.left._zod.run({value:U,issues:[]},q),J=I.right._zod.run({value:U,issues:[]},q);if(Y instanceof Promise||J instanceof Promise)return Promise.all([Y,J]).then(([w,K])=>{return pk(z,w,K)});return pk(z,Y,J)}});function CO($,I){if($===I)return{valid:!0,data:$};if($ instanceof Date&&I instanceof Date&&+$===+I)return{valid:!0,data:$};if(Q9($)&&Q9(I)){let z=Object.keys(I),q=Object.keys($).filter((Y)=>z.indexOf(Y)!==-1),U={...$,...I};for(let Y of q){let J=CO($[Y],I[Y]);if(!J.valid)return{valid:!1,mergeErrorPath:[Y,...J.mergeErrorPath]};U[Y]=J.data}return{valid:!0,data:U}}if(Array.isArray($)&&Array.isArray(I)){if($.length!==I.length)return{valid:!1,mergeErrorPath:[]};let z=[];for(let q=0;q<$.length;q++){let U=$[q],Y=I[q],J=CO(U,Y);if(!J.valid)return{valid:!1,mergeErrorPath:[q,...J.mergeErrorPath]};z.push(J.data)}return{valid:!0,data:z}}return{valid:!1,mergeErrorPath:[]}}function pk($,I,z){let q=new Map,U;for(let Q of I.issues)if(Q.code==="unrecognized_keys"){U??(U=Q);for(let w of Q.keys){if(!q.has(w))q.set(w,{});q.get(w).l=!0}}else $.issues.push(Q);for(let Q of z.issues)if(Q.code==="unrecognized_keys")for(let w of Q.keys){if(!q.has(w))q.set(w,{});q.get(w).r=!0}else $.issues.push(Q);let Y=[...q].filter(([,Q])=>Q.l&&Q.r).map(([Q])=>Q);if(Y.length&&U)$.issues.push({...U,keys:Y});if(w9($))return $;let J=CO(I.value,z.value);if(!J.valid)throw Error(`Unmergableintersection.Errorpath:${JSON.stringify(J.mergeErrorPath)}`);return $.value=J.data,$}var _K=o("$ZodTuple",($,I)=>{p0.
Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letJof$.seen.entries()){letQ=J[1];if(I===J[0]){Y(J);continue}if($.external){letK=$.external.registry.get(J[0])?.id;if(I!==J[0]&&K){Y(J);continue}}if($.metadataRegistry.get(J[0])?.id){Y(J);continue}if(Q.cycle){Y(J);continue}if(Q.count>1){if($.reused==="ref"){Y(J);continue}}}}functionV9($,I){letz=$.seen.get(I);if(!z)throwError("Unprocessed schema. This is a bug in Zod.");letq=(Q)=>{letw=$.seen.get(Q);if(w.ref===null)return;letK=w.def??w.schema,H={...K},G=w.ref;if(w.ref=null,G){q(G);letV=$.seen.get(G),X=V.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))K.allOf=K.allOf??[],K.allOf.push(X);elseObject.assign(K,X);if(Object.assign(K,H),Q._zod.parent===G)for(letDinK){if(D==="$ref"||D==="allOf")continue;if(!(DinH))deleteK[D]}if(X.$ref&&V.def)for(letDinK){if(D==="$ref"||D==="allOf")continue;if(DinV.def&&JSON.stringify(K[D])===JSON.stringify(V.def[D]))deleteK[D]}}letW=Q._zod.parent;if(W&&W!==G){q(W);letV=$.seen.get(W);if(V?.schema.$ref){if(K.$ref=V.schema.$ref,V.def)for(letXinK){if(X==="$ref"||X==="allOf")continue;if(XinV.def&&JSON.stringify(K[X])===JSON.stringify(V.def[X]))deleteK[X]}}}$.override({zodSchema:Q,jsonSchema:K,path:w.path??[]})};for(letQof[...$.seen.entries()].reverse())q(Q[0]);letU={};if($.target==="draft-2020-12")U.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")U.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")U.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letQ=$.external.registry.get(I)?.id;if(!Q)throwError("Schema is missing an `id` property");U.$id=$.external.uri(Q)}Object.assign(U,z.def??z.schema);letY=$.metadataRegistry.get(I)?.id;if(Y!==void0&&U.id===Y)deleteU.id;letJ=$.external?.defs??{};for(letQof$.seen.entries()){letw=Q[1];if(w.def&&w.defId){if(w.def.id===w.defId)deletew.def.id;J[w.defId]=w.def}}if($.external);elseif(Object.keys(J).length>0)if($.target==="draft-2020-12")U.$defs=J;elseU.definitions=J;try{letQ=JSON.parse(JSON.stringify(U));returnObject.defineProperty(Q,"~standard",{value:{...I["~standard"],jsonSchema:{input:sI(I,"input",$.processors),output:sI(I,"output",$.processors)}},enumerable:!1,writable:!1}),Q}catch(Q){throwError("Error converting schema to JSON.")}}functionv6($,I){letz=I??{seen:newSet};if(z.seen.has($))return!1;z.seen.add($);letq=$._zod.def;if(q.type==="transform")return!0;if(q.type==="array")returnv6(q.element,z);if(q.type==="set")returnv6(q.valueType,z);if(q.type==="lazy")returnv6(q.getter(),z);if(q.type==="promise"||q.type==="optional"||q.type==="nonoptional"||q.type==="nullable"||q.type==="readonly"||q.type==="default"||q.type==="prefault")returnv6(q.innerType,z);if(q.type==="intersection")returnv6(q.left,z)||v6(q.right,z);if(q.type==="record"||q.type==="map")returnv6(q.keyType,z)||v6(q.valueType,z);if(q.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnv6(q.in,z)||v6(q.out,z)}if(q.type==="object"){for(letUinq.shape)if(v6(q.shape[U],z))return!0;return!1}if(q.type==="union"){for(letUofq.options)if(v6(U,z))return!0;return!1}if(q.type==="tuple"){for(letUofq.items)if(v6(U,z))return!0;if(q.rest&&v6(q.rest,z))return!0;return!1}return!1}varTA=($,I={})=>(z)=>{letq=G9({...z,processors:I});returnS1($,q),W9(q,$),V9(q,$)},sI=($,I,z={})=>(q)=>{let{libraryOptions:U,target:Y}=q??{},J=G9({...U??{},target:Y,io:I,processors:z});returnS1($,J),W9(J,$),V9(J,$)};varSN0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},EA=($,I,z,q)=>{letU=z;U.type="string";let{minimum:Y,maximum:J,format:Q,patterns:w,contentEncoding:K}=$._zod.bag;if(typeofY==="number")U.minLength=Y;if(typeofJ==="number")U.maxLength=J;if(Q){if(U.format=SN0[Q]??Q,U.format==="")deleteU.format;if(Q==="time")deleteU.format}if(K)U.contentEncoding=K;if(w&&w.size>0){letH=[...w];if(H.length===1)U.pattern=H[0].source;elseif(H.length>1)U.allOf=[...H.map((G)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:G.source}))]}},BA=($,I,z,q)=>{letU=z,{minimum:Y,maximum:J,format:Q,multipleOf:w,exclusiveMaximum:K,exclusiveMinimum:H}=$._zod.bag;if(typeofQ==="string"&&Q.includes("int"))U.type="integer";elseU.type="number";letG=typeofH==="number"&&H>=(Y??Number.NEGATIVE_INFINITY),W=typeofK==="number"&&K<=(J??Number.POSITIVE_INFINITY),V=I.target==="draft-04"||I.target==="openapi-3.0";if(G)if(V)U.minimum=H,U.exclusiveMinimum=!0;elseU.exclusiveMinimum=H;elseif(typeofY==="number")U.minimum=Y;if(W)if(V)U.maximum=K,U.exclusiveMaximum=!0;elseU.exclusiveMaximum=K;elseif(typeofJ==="number")U.maximum=J;if(typeofw==="number")U.multipleOf=w},jA=($,I,z,q)=>{z.type="boolean"},vA=($,I,z,q)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},gA=($,I,z,q)=>{if(I.unrepresentable==Line truncated
Setthe\`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(letJof$.seen.entries()){letQ=J[1];if(I===J[0]){Y(J);continue}if($.external){letK=$.external.registry.get(J[0])?.id;if(I!==J[0]&&K){Y(J);continue}}if($.metadataRegistry.get(J[0])?.id){Y(J);continue}if(Q.cycle){Y(J);continue}if(Q.count>1){if($.reused==="ref"){Y(J);continue}}}}functionV9($,I){letz=$.seen.get(I);if(!z)throwError("Unprocessed schema. This is a bug in Zod.");letq=(Q)=>{letw=$.seen.get(Q);if(w.ref===null)return;letK=w.def??w.schema,H={...K},G=w.ref;if(w.ref=null,G){q(G);letV=$.seen.get(G),X=V.schema;if(X.$ref&&($.target==="draft-07"||$.target==="draft-04"||$.target==="openapi-3.0"))K.allOf=K.allOf??[],K.allOf.push(X);elseObject.assign(K,X);if(Object.assign(K,H),Q._zod.parent===G)for(letDinK){if(D==="$ref"||D==="allOf")continue;if(!(DinH))deleteK[D]}if(X.$ref&&V.def)for(letDinK){if(D==="$ref"||D==="allOf")continue;if(DinV.def&&JSON.stringify(K[D])===JSON.stringify(V.def[D]))deleteK[D]}}letW=Q._zod.parent;if(W&&W!==G){q(W);letV=$.seen.get(W);if(V?.schema.$ref){if(K.$ref=V.schema.$ref,V.def)for(letXinK){if(X==="$ref"||X==="allOf")continue;if(XinV.def&&JSON.stringify(K[X])===JSON.stringify(V.def[X]))deleteK[X]}}}$.override({zodSchema:Q,jsonSchema:K,path:w.path??[]})};for(letQof[...$.seen.entries()].reverse())q(Q[0]);letU={};if($.target==="draft-2020-12")U.$schema="https://json-schema.org/draft/2020-12/schema";elseif($.target==="draft-07")U.$schema="http://json-schema.org/draft-07/schema#";elseif($.target==="draft-04")U.$schema="http://json-schema.org/draft-04/schema#";elseif($.target==="openapi-3.0");if($.external?.uri){letQ=$.external.registry.get(I)?.id;if(!Q)throwError("Schema is missing an `id` property");U.$id=$.external.uri(Q)}Object.assign(U,z.def??z.schema);letY=$.metadataRegistry.get(I)?.id;if(Y!==void0&&U.id===Y)deleteU.id;letJ=$.external?.defs??{};for(letQof$.seen.entries()){letw=Q[1];if(w.def&&w.defId){if(w.def.id===w.defId)deletew.def.id;J[w.defId]=w.def}}if($.external);elseif(Object.keys(J).length>0)if($.target==="draft-2020-12")U.$defs=J;elseU.definitions=J;try{letQ=JSON.parse(JSON.stringify(U));returnObject.defineProperty(Q,"~standard",{value:{...I["~standard"],jsonSchema:{input:sI(I,"input",$.processors),output:sI(I,"output",$.processors)}},enumerable:!1,writable:!1}),Q}catch(Q){throwError("Error converting schema to JSON.")}}functionv6($,I){letz=I??{seen:newSet};if(z.seen.has($))return!1;z.seen.add($);letq=$._zod.def;if(q.type==="transform")return!0;if(q.type==="array")returnv6(q.element,z);if(q.type==="set")returnv6(q.valueType,z);if(q.type==="lazy")returnv6(q.getter(),z);if(q.type==="promise"||q.type==="optional"||q.type==="nonoptional"||q.type==="nullable"||q.type==="readonly"||q.type==="default"||q.type==="prefault")returnv6(q.innerType,z);if(q.type==="intersection")returnv6(q.left,z)||v6(q.right,z);if(q.type==="record"||q.type==="map")returnv6(q.keyType,z)||v6(q.valueType,z);if(q.type==="pipe"){if($._zod.traits.has("$ZodCodec"))return!0;returnv6(q.in,z)||v6(q.out,z)}if(q.type==="object"){for(letUinq.shape)if(v6(q.shape[U],z))return!0;return!1}if(q.type==="union"){for(letUofq.options)if(v6(U,z))return!0;return!1}if(q.type==="tuple"){for(letUofq.items)if(v6(U,z))return!0;if(q.rest&&v6(q.rest,z))return!0;return!1}return!1}varEA=($,I={})=>(z)=>{letq=G9({...z,processors:I});returnS1($,q),W9(q,$),V9(q,$)},sI=($,I,z={})=>(q)=>{let{libraryOptions:U,target:Y}=q??{},J=G9({...U??{},target:Y,io:I,processors:z});returnS1($,J),W9(J,$),V9(J,$)};variN0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},BA=($,I,z,q)=>{letU=z;U.type="string";let{minimum:Y,maximum:J,format:Q,patterns:w,contentEncoding:K}=$._zod.bag;if(typeofY==="number")U.minLength=Y;if(typeofJ==="number")U.maxLength=J;if(Q){if(U.format=iN0[Q]??Q,U.format==="")deleteU.format;if(Q==="time")deleteU.format}if(K)U.contentEncoding=K;if(w&&w.size>0){letH=[...w];if(H.length===1)U.pattern=H[0].source;elseif(H.length>1)U.allOf=[...H.map((G)=>({...I.target==="draft-07"||I.target==="draft-04"||I.target==="openapi-3.0"?{type:"string"}:{},pattern:G.source}))]}},jA=($,I,z,q)=>{letU=z,{minimum:Y,maximum:J,format:Q,multipleOf:w,exclusiveMaximum:K,exclusiveMinimum:H}=$._zod.bag;if(typeofQ==="string"&&Q.includes("int"))U.type="integer";elseU.type="number";letG=typeofH==="number"&&H>=(Y??Number.NEGATIVE_INFINITY),W=typeofK==="number"&&K<=(J??Number.POSITIVE_INFINITY),V=I.target==="draft-04"||I.target==="openapi-3.0";if(G)if(V)U.minimum=H,U.exclusiveMinimum=!0;elseU.exclusiveMinimum=H;elseif(typeofY==="number")U.minimum=Y;if(W)if(V)U.maximum=K,U.exclusiveMaximum=!0;elseU.exclusiveMaximum=K;elseif(typeofJ==="number")U.maximum=J;if(typeofw==="number")U.multipleOf=w},vA=($,I,z,q)=>{z.type="boolean"},gA=($,I,z,q)=>{if(I.unrepresentable==="throw")throwError("BigInt cannot be represented in JSON Schema")},RA=($,I,z,q)=>{if(I.unrepresentable==Line truncated
`)}return{warnings:[],results:J}}function FI($){return{fileBuffer:DH1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as MH1}from"node:fs";async function fD($,I,z={}){let U=Y4().stateful?"stateful":"stateless",Y="ok",J,Q,w;try{let M=await V$($);w={id:M.user.id,name:M.user.name,isAdmin:M.user.isAdmin},Q={id:M.tenant.id,name:M.tenant.name,tenantSlug:M.tenant.tenantSlug,corporationName:M.tenant.hoseCorpConfig?.corporationName}}catch(M){Y="error",J=M instanceof Error?M.message:String(M)}let K=[];if(Y==="ok")try{K=await Y8($,I.seal.endpoints.approvalStylePreferences)}catch(M){Y="error",J=`读取Webhook配置失败:${MinstanceofError?M.message:String(M)}`}let H=K.length===1,G=K.map((M)=>({id:M.id,name:M.name,mode:M.mode,incomingDocumentWebhookUrl:M.incomingDocumentWebhook.url,outgoingResultWebhookUrl:M.outgoingResultWebhook,autoApprovalRate:M.autoApprovalRate,...H?{isDefault:!0}:{}})),W=H?{id:K[0].id,name:K[0].name,mode:K[0].mode}:null,V=z.webhook?v9(K,z.webhook):H?K[0]:void 0,X;if(z.filePath)if(!MH1(z.filePath))X={valid:!1,filePath:z.filePath,fileName:z.filePath.split(/[\\/]/).pop()??z.filePath,documentCount:0,errors:[`文件不存在:${z.filePath}`]};else try{let M=FI(z.filePath),B=await DI(M.fileBuffer,M.fileName,V?.materialPackFilePolicy);X={valid:!0,filePath:z.filePath,fileName:M.fileName,documentCount:B.documents.length,warnings:B.warnings}}catch(M){X={valid:!1,filePath:z.filePath,fileName:z.filePath.split(/[\\/]/).pop()??z.filePath,documentCount:0,errors:[M instanceof Error?M.message:String(M)]}}let L=X?X.valid:!0,D=Y==="ok"&&G.length>0&&L,F=U==="stateful"?"":`--corp${I.id}`,T="",P="";if(Y!=="ok")P=`凭证鉴权异常:${J}`,T=`seal-useauthdiagnose${F}`;else if(G.length===0)P="当前企业尚未配置任何 Webhook 集成通道",T=`seal-usewebhookadd--name"默认入站通道"--result-url"https://your-domain.com/callback"${F}`;else if(X&&!X.valid)P=`材料包预检失败:${X.errors?.join("; ")}`,T=`seal-usewebhookmaterial-packpreview${X.filePath}${F}`;else{P=H?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到${G.length}个Webhook通道,等待载入`;let M=X?.filePath??"<材料包.zip>",B=H?"":`--webhook${W?W.id:"<webhookIdOrName>"}`;T=`seal-usewebhookmaterial-packpush${M}${B}${F}`}return{ready:D,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:Q,user:w},stateMode:U,authStatus:Y,authError:J,activeWebhooks:G,defaultWebhook:W,materialPack:X,statusMessage:P,nextAction:T}}var vw=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:Z.object({}),handler:async($)=>V$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:Z.object({}),handler:async($)=>Ul($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:Z.object({}),handler:async($)=>Bl($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:Z.object({note:Z.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>hz($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:Z.object({tokenId:Z.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>jl($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:Z.object({name:Z.string().describe("用户姓名"),phone:Z.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:Z.array(Z.string()).optional().describe("权限列表,默认为 []"),departmentIds:Z.array(Z.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>vl($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>AB($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>UW($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:Z.object({keyword:Z.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>YW($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>fl($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>PB($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 S
Line truncated
`)}return{warnings:[],results:J}}function FI($){return{fileBuffer:EH1($),fileName:$.split(/[\\\/]/).pop()??"material-pack.zip"}}import{existsSync as gH1}from"node:fs";async function nD($,I,z={}){let U=Y4().stateful?"stateful":"stateless",Y="ok",J,Q,w;try{let M=await V$($);w={id:M.user.id,name:M.user.name,isAdmin:M.user.isAdmin},Q={id:M.tenant.id,name:M.tenant.name,tenantSlug:M.tenant.tenantSlug,corporationName:M.tenant.hoseCorpConfig?.corporationName}}catch(M){Y="error",J=M instanceof Error?M.message:String(M)}let K=[];if(Y==="ok")try{K=await Y8($,I.seal.endpoints.approvalStylePreferences)}catch(M){Y="error",J=`读取Webhook配置失败:${MinstanceofError?M.message:String(M)}`}let H=K.length===1,G=K.map((M)=>({id:M.id,name:M.name,mode:M.mode,incomingDocumentWebhookUrl:M.incomingDocumentWebhook.url,outgoingResultWebhookUrl:M.outgoingResultWebhook,autoApprovalRate:M.autoApprovalRate,...H?{isDefault:!0}:{}})),W=H?{id:K[0].id,name:K[0].name,mode:K[0].mode}:null,V=z.webhook?v9(K,z.webhook):H?K[0]:void 0,X;if(z.filePath)if(!gH1(z.filePath))X={valid:!1,filePath:z.filePath,fileName:z.filePath.split(/[\\/]/).pop()??z.filePath,documentCount:0,errors:[`文件不存在:${z.filePath}`]};else try{let M=FI(z.filePath),j=await DI(M.fileBuffer,M.fileName,V?.materialPackFilePolicy);X={valid:!0,filePath:z.filePath,fileName:M.fileName,documentCount:j.documents.length,warnings:j.warnings}}catch(M){X={valid:!1,filePath:z.filePath,fileName:z.filePath.split(/[\\/]/).pop()??z.filePath,documentCount:0,errors:[M instanceof Error?M.message:String(M)]}}let L=X?X.valid:!0,D=Y==="ok"&&G.length>0&&L,F=U==="stateful"?"":`--corp${I.id}`,T="",P="";if(Y!=="ok")P=`凭证鉴权异常:${J}`,T=`seal-useauthdiagnose${F}`;else if(G.length===0)P="当前企业尚未配置任何 Webhook 集成通道",T=`seal-usewebhookadd--name"默认入站通道"--result-url"https://your-domain.com/callback"${F}`;else if(X&&!X.valid)P=`材料包预检失败:${X.errors?.join("; ")}`,T=`seal-usewebhookmaterial-packpreview${X.filePath}${F}`;else{P=H?"所有通道正常,已自动锁定唯一 Webhook 通道,等待载入":`所有通道正常,检测到${G.length}个Webhook通道,等待载入`;let M=X?.filePath??"<材料包.zip>",j=H?"":`--webhook${W?W.id:"<webhookIdOrName>"}`;T=`seal-usewebhookmaterial-packpush${M}${j}${F}`}return{ready:D,corp:{id:I.id,name:I.name,sourceType:I.source.type,tenant:Q,user:w},stateMode:U,authStatus:Y,authError:J,activeWebhooks:G,defaultWebhook:W,materialPack:X,statusMessage:P,nextAction:T}}var gw=[{name:"seal_whoami",description:"查询当前 Seal 用户身份及租户信息",parameters:Z.object({}),handler:async($)=>V$($)},{name:"seal_session_get",description:"查询当前 Seal Bearer session、用户和过期时间",parameters:Z.object({}),handler:async($)=>Kl($)},{name:"seal_delegation_list",description:"查询当前 Seal 租户下的授权链接 (Delegation) 列表",parameters:Z.object({}),handler:async($)=>_l($)},{name:"seal_delegation_create",description:"创建新的 Seal 授权链接 (Delegation)",parameters:Z.object({note:Z.string().optional().describe("授权链接的备注或说明信息")}),handler:async($,I)=>hz($,I)},{name:"seal_delegation_revoke",description:"撤销/废除指定的 Seal 授权链接 (Delegation)",parameters:Z.object({tokenId:Z.string().describe("授权链接 ID (delegation record ID)")}),handler:async($,I)=>Cl($,I.tokenId)},{name:"seal_user_create",description:"创建本地 Seal 用户,生成并返回初始随机密码",parameters:Z.object({name:Z.string().describe("用户姓名"),phone:Z.string().describe("手机号码 (例如 13300001111 或 +8613300001111)"),permissions:Z.array(Z.string()).optional().describe("权限列表,默认为 []"),departmentIds:Z.array(Z.string()).optional().describe("关联部门 ID 数组")}),handler:async($,I)=>hl($,I)},{name:"seal_user_reset_password",description:"重置指定 Seal 用户的默认/随机密码,并返回生成的新密码",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>PB($,I.userId)},{name:"seal_user_get",description:"获取指定 Seal 用户的详细信息",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>YW($,I.userId)},{name:"seal_user_search",description:"按姓名、手机号或邮箱搜索 Seal 成员用户列表",parameters:Z.object({keyword:Z.string().optional().describe("搜索关键词(姓名、手机号、邮箱等),不传或传空字符串可列出租户成员")}),handler:async($,I)=>JW($,I.keyword??"")},{name:"seal_user_delete",description:"删除指定 Seal 本地用户",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>ll($,I.userId)},{name:"seal_user_activate",description:"启用/激活已离职的 Seal 用户账号",parameters:Z.object({userId:Z.string().describe("用户 ID (_id)")}),handler:async($,I)=>EB($,I.userId)},{name:"seal_user_delegation_create",description:"为指定 S
Line truncated
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:I.sso?H:K,sealResultUrl:K,ssoUrl:H,type:I.sso?"sso_link":"deep_link",expiresIn:I.sso?V:void 0,identity:G,warning:W,enterpriseAssistUrl:J,enterpriseUrl:J,hoseDomain:Y.type==="hose"?dH1(Y.domain):void 0,documentUrl:Q,recordId:U?.id,sourceDocumentSN:U?.sourceDocumentSN,sourceDocumentId:U?.sourceDocumentId,sourceSystem:U?.sourceSystem,missing:{enterpriseAssistUrl:J?void 0:"Current enterprise source is not Hose, so no Hose enterprise assist URL is configured.",documentUrl:q&&!Q?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:Z.object({query:Z.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:Z.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:Z.string().optional().describe("模拟批次 ID"),latest:Z.boolean().optional().describe("只返回最新一条匹配记录"),fields:Z.union([Z.string(),Z.array(Z.string())]).optional().describe("限制返回字段"),limit:Z.number().int().positive().max(100).optional(),maxScan:Z.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:Z.boolean().optional()}),handler:async($,I)=>{let z=I.sn??I.query;if(!z)throw Error("query or sn is required");let q=await mH1($,{query:z,sn:I.sn,batchId:I.batchId,latest:I.latest,limit:I.latest?1:I.limit??20,maxScan:I.maxScan??1000}),U=await Promise.all(q.records.map((Q)=>P4($,Q.id))),Y=ZZ0(I.fields),J=U.map((Q)=>iH1(Q,Y));return{query:z,sourceDocumentSN:I.sn,simulationBatchId:I.batchId,latest:I.latest??!1,total:q.total,scanned:q.scanned,matched:J.length,records:J,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-hometoolseal_approval_search--json'{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-hometoolseal_approval_context_get--json'{"ruleVersionNumber":14}'`},...I.includeBridge?{bridge:iD(U)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:Z.object({batchId:Z.string().describe("simulation batch ID"),query:Z.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,I)=>{let z=au(await OB($,I.batchId),I.query);return{batchId:I.batchId,count:z.length,records:z.map(OI),bridge:iD(z)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:Z.object({mode:Z.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:Z.array(Z.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:Z.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:Z.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:Z.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:Z.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:Z.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:Z.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:Z.array(Z.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:Z.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:Z.record(Z.string(),Z.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:Z.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:Z.record(Z.string(),Z.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,I)=>{let z=I.mode??"hosecloud",q=I.signKey;if(z==="hosecloud"&&!q){if(q=(await MB($)).find((Q)=>Q.signKey)?.signKey,!q)throw Error("未找到合思集成 signKey, 请通过 signKey
Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:nU({id:I?.id,sn:I?.sn??I?.sourceDocumentSN??$.sourceDocumentSN,title:I?.title??I?.name,template:dD(I,["template.name","templateName","form.name","formName","formTitle"]),amount:bD(z,["金额","报销金额","付款金额","合计","价税合计"])??dD(I,["amount","totalAmount","expenseAmount"]),expenseType:bD(z,["费用类型","费用类别","报销类型"]),costCompany:bD(z,["费用承担公司","承担公司","成本中心","费用归属"]),payee:bD(z,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:z.slice(0,30)}),invoices:kH1($),attachments:vU($,{summary:!0}).attachments,aiResult:lD($),manualResult:NI($)?.value,hints:nU({amountMentions:LZ0(q,["金额","合计","税率"],8),partyMentions:LZ0(q,["买方","卖方","甲方","乙方","收款"],8)})}}function SH1($){let I=[["result.citedRules",e5($,"result.citedRules")],["result.matchedRules",e5($,"result.matchedRules")],["result.ruleResults",e5($,"result.ruleResults")],["result.rules",e5($,"result.rules")],["pipelineData.citedRules",e5($,"pipelineData.citedRules")],["pipelineData.matchedRules",e5($,"pipelineData.matchedRules")]],z=[],q=new Set;for(let[U,Y]of I)(Array.isArray(Y)?Y:Y&&typeof Y==="object"?Object.values(Y):[]).forEach((Q,w)=>{let K=gw(Q);if(!K)return;let H=J4(K.runtimeRuleId)??J4(K.runtimeId)??J4(K.id)??J4(K.ruleId),G=J4(K.ruleCode)??J4(K.code)??(H?bH1(H):void 0),W=nU({runtimeRuleId:H,ruleCode:G,versionNumber:uH1(K.versionNumber)??$.ruleSetVersionNumber,scope:J4(K.scope),strictness:J4(K.strictness),appliedAnalysis:K.appliedAnalysis??K.analysis??K.reasoning,checkResult:K.checkResult??K.result??K.decision,findings:K.findings??K.riskPoints??K.evidence,sourcePath:`${U}.${w}`}),V=JSON.stringify(W);if(!q.has(V))q.add(V),z.push(W)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:z.length,rules:z}}function dD($,I){if(!$)return;for(let z of I){let q=e5($,z);if(q!==void 0)return q}return}function XZ0($,I){if(!$)return 0;for(let z of I){let q=e5($,z);if(Array.isArray(q))return q.length;if(q&&typeof q==="object")return Object.keys(q).length;if(typeof q==="number")return q}return 0}function e5($,I){return I.split(".").reduce((z,q)=>{if(z===void 0||z===null)return;if(Array.isArray(z)){let U=Number(q);return Number.isInteger(U)?z[U]:void 0}if(typeof z==="object")return z[q];return},$)}function yH1($,I,z){let q=I.split("."),U=$;for(let Y of q.slice(0,-1)){let J=U[Y];if(!J||typeof J!=="object"||Array.isArray(J))U[Y]={};U=U[Y]}U[q[q.length-1]??I]=z}function nU($){return Object.fromEntries(Object.entries($).filter(([,I])=>I!==void 0))}function gw($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function uH1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function xH1($){let I=[];return du($,"document",I),I}function du($,I,z){if(Array.isArray($)){$.forEach((J,Q)=>du(J,`${I}.${Q}`,z));return}let q=gw($);if(!q)return;let U=J4(q.label)??J4(q.name)??J4(q.title)??J4(q.fieldName),Y=q.value??q.displayValue??q.text??q.content;if(U&&Y!==void 0&&typeof Y!=="object")z.push(nU({path:I,label:U,value:Y,type:J4(q.type)??J4(q.fieldType)}));for(let[J,Q]of Object.entries(q)){if(J==="attachments")continue;du(Q,`${I}.${J}`,z)}}function bD($,I){return $.find((q)=>{let U=J4(q.label)??"";return I.some((Y)=>U.includes(Y))})?.value}function kH1($){let I=[];return mD($.result,"result",I),mD($.document,"document",I),I.slice(0,20)}function mD($,I,z){if(Array.isArray($)){$.forEach((U,Y)=>mD(U,`${I}.${Y}`,z));return}let q=gw($);if(!q)return;if(/invoice|发票/i.test(I))z.push(nU({path:I,fileName:J4(q.fileName)??J4(q.filename)??J4(q.name),buyer:q.buyer??q.buyerName??q.purchaserName,seller:q.seller??q.sellerName,amount:q.amount??q.totalAmount??q.total,taxRate:q.taxRate,category:q.category??q.type}));for(let[U,Y]of Object.entries(q))mD(Y,`${I}.${U}`,z)}function LZ0($,I,z){return $.split(/\r?\n/).filter((q)=>I.some((U)=>q.includes(U))).slice(0,z)}function iD($){return $.map((I)=>{let z=OI(I);return{recordId:z.id,tenantId:z.tenantId,agentId:z.agentId,sourceDocumentSN:z.sourceDocumentSN,sourceDocumentId:z.sourceDocumentId,simulationBatchId:z.simulationBatchId,langfuseTraceId:z.langfuseTraceId,langfuseSessionFallback:z.langfuseSessionFallback,ruleSetVersionNumber:z.ruleSetVersionNumber,ruleSetPublishedAt:z.ruleSetPublishedAt,ruleSetPublishedByName:z.ruleSetPublishedByName,resolution:z.langfuseTraceId?"trace":z.langfuseSessionFallback?"session-fallback":"unresolved"}})}function pu($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function fH1($,I){if(I.recordId&&!I.versionId&&!I.versionNumber&&!I.latest){let z=await P4($,I.recordId);if(!z.ruleSetVersionNumber)throw Er
Line truncated
`)}function $G1($){let I=[];if(I.push(`seal-use${$.area}-${$.title}`),$.description)I.push($.description);I.push(""),I.push("Usage:");for(let z of $.commands)for(let q of z.usage)I.push(`${q}`);if($.commands.some((z)=>z.name))I.push(""),I.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return I.join(`
`)}function kZ0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let I of fZ0)for(let z of I.commands)for(let q of z.usage)$.push(`${q}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`+"• 安全边界:该凭证绝不包含且无法访问合思 (Hose) 主系统;仅限内部排查,严禁在外部公开分享!")}return{url:I.sso?H:K,sealResultUrl:K,ssoUrl:H,type:I.sso?"sso_link":"deep_link",expiresIn:I.sso?V:void 0,identity:G,warning:W,enterpriseAssistUrl:J,enterpriseUrl:J,hoseDomain:Y.type==="hose"?eH1(Y.domain):void 0,documentUrl:Q,recordId:U?.id,sourceDocumentSN:U?.sourceDocumentSN,sourceDocumentId:U?.sourceDocumentId,sourceSystem:U?.sourceSystem,missing:{enterpriseAssistUrl:J?void 0:"Current enterprise source is not Hose, so no Hose enterprise assist URL is configured.",documentUrl:q&&!Q?"sourceExtendData.hosecloudViewUrl is absent from the approval run detail.":void 0}}}},{name:"seal_approval_run_pick",description:"按合思单号或关键字查询运行记录,返回候选记录及其当时使用的规则版本,便于再取详情或查版本规则",parameters:Z.object({query:Z.string().optional().describe("合思单号、源单据 ID、运行记录 ID 或 trace 关键字"),sn:Z.string().optional().describe("合思/易快报单号;优先作为精确 sourceDocumentSN 查询"),batchId:Z.string().optional().describe("模拟批次 ID"),latest:Z.boolean().optional().describe("只返回最新一条匹配记录"),fields:Z.union([Z.string(),Z.array(Z.string())]).optional().describe("限制返回字段"),limit:Z.number().int().positive().max(100).optional(),maxScan:Z.number().int().positive().max(5000).optional().describe("最多扫描多少条运行记录用于本地匹配,默认 1000"),includeBridge:Z.boolean().optional()}),handler:async($,I)=>{let z=I.sn??I.query;if(!z)throw Error("query or sn is required");let q=await $G1($,{query:z,sn:I.sn,batchId:I.batchId,latest:I.latest,limit:I.latest?1:I.limit??20,maxScan:I.maxScan??1000}),U=await Promise.all(q.records.map((Q)=>P4($,Q.id))),Y=AZ0(I.fields),J=U.map((Q)=>tH1(Q,Y));return{query:z,sourceDocumentSN:I.sn,simulationBatchId:I.batchId,latest:I.latest??!1,total:q.total,scanned:q.scanned,matched:J.length,records:J,next:{getSummary:"seal-home approval-runs get <recordId> --summary",getRuleVersion:"seal-home rules version <ruleSetVersionNumber>",searchRuleVersion:`seal-hometoolseal_approval_search--json'{"keywords":["关键词"],"areas":["rules"],"ruleVersionScope":"version","ruleVersionNumber":14}'`,getVersionContext:`seal-hometoolseal_approval_context_get--json'{"ruleVersionNumber":14}'`},...I.includeBridge?{bridge:pD(U)}:{}}}},{name:"seal_simulation_batch_records_get",description:"获取某一次 Seal 模拟批次的运行记录,并整理对应 Langfuse trace/session 桥接字段",parameters:Z.object({batchId:Z.string().describe("simulation batch ID"),query:Z.string().optional().describe("在 id、sourceDocumentSN、sourceDocumentId、documentId、Langfuse traceId 中做本地包含匹配")}),handler:async($,I)=>{let z=eu(await NB($,I.batchId),I.query);return{batchId:I.batchId,count:z.length,records:z.map(OI),bridge:pD(z)}}},{name:"seal_simulation_batch_create",description:"创建 Seal 模拟测试批次。支持合思指定单号(hosecloud)与材料包导入(material_pack)两种模式;其他取数模式通过 rawParams 预留透传。",parameters:Z.object({mode:Z.enum(["hosecloud","material_pack"]).default("hosecloud").describe("来源模式: hosecloud=合思指定单号; material_pack=材料包导入"),flowIds:Z.array(Z.string()).max(100).optional().describe("合思模式: 单据流水号列表"),rejectNodeName:Z.string().nullable().optional().describe("仅关注特定节点: 节点名称, 不设为 null 表示不限制"),thinkingDepthOverride:Z.enum(["default","medium","high"]).optional().describe("思考深度: default=按偏好设置, medium=标准, high=深度推理"),skipInvoiceGeneration:Z.boolean().optional().describe("跳过发票生成, 默认 true"),skipExpenseExtraction:Z.boolean().optional().describe("跳过费用提取, 默认 true"),disableAttachmentCache:Z.boolean().optional().describe("不使用附件缓存, 默认 false"),signKey:Z.string().optional().describe("合思集成标识; 缺省时自动取第一个合思集成"),packageIds:Z.array(Z.string()).optional().describe("材料包模式: 材料包 id 列表(来自 material-packages upload 响应)"),templateId:Z.string().optional().describe("材料包模板 id, 例如 conference_reimbursement_v1; 缺省取 schemaConfig.id"),schemaConfig:Z.record(Z.string(),Z.unknown()).optional().describe("材料包字段映射(确认参数), 建议使用 material-packages upload 返回的 schemaConfig"),noWait:Z.boolean().optional().describe("创建后立即返回异步票据,不等待批次完成"),rawParams:Z.record(Z.string(),Z.unknown()).optional().describe("预留: 其他取数模式(如时间范围 startTime/endTime)透传参数, 覆盖上述构建结果")}),handler:async($,I)=>{let z=I.mode??"hosecloud",q=I.signKey;if(z==="hosecloud"&&!q){if(q=(await AB($)).find((Q)=>Q.signKey)?.signKey,!q)throw Error("未找到合思集成 signKey, 请通过 signKey
Line truncated
`);return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,document:nU({id:I?.id,sn:I?.sn??I?.sourceDocumentSN??$.sourceDocumentSN,title:I?.title??I?.name,template:mD(I,["template.name","templateName","form.name","formName","formTitle"]),amount:iD(z,["金额","报销金额","付款金额","合计","价税合计"])??mD(I,["amount","totalAmount","expenseAmount"]),expenseType:iD(z,["费用类型","费用类别","报销类型"]),costCompany:iD(z,["费用承担公司","承担公司","成本中心","费用归属"]),payee:iD(z,["收款方","收款账户","收款信息","开户名","银行账号"]),keyFields:z.slice(0,30)}),invoices:mH1($),attachments:vU($,{summary:!0}).attachments,aiResult:oD($),manualResult:NI($)?.value,hints:nU({amountMentions:TZ0(q,["金额","合计","税率"],8),partyMentions:TZ0(q,["买方","卖方","甲方","乙方","收款"],8)})}}function iH1($){let I=[["result.citedRules",e5($,"result.citedRules")],["result.matchedRules",e5($,"result.matchedRules")],["result.ruleResults",e5($,"result.ruleResults")],["result.rules",e5($,"result.rules")],["pipelineData.citedRules",e5($,"pipelineData.citedRules")],["pipelineData.matchedRules",e5($,"pipelineData.matchedRules")]],z=[],q=new Set;for(let[U,Y]of I)(Array.isArray(Y)?Y:Y&&typeof Y==="object"?Object.values(Y):[]).forEach((Q,w)=>{let K=Rw(Q);if(!K)return;let H=J4(K.runtimeRuleId)??J4(K.runtimeId)??J4(K.id)??J4(K.ruleId),G=J4(K.ruleCode)??J4(K.code)??(H?rH1(H):void 0),W=nU({runtimeRuleId:H,ruleCode:G,versionNumber:cH1(K.versionNumber)??$.ruleSetVersionNumber,scope:J4(K.scope),strictness:J4(K.strictness),appliedAnalysis:K.appliedAnalysis??K.analysis??K.reasoning,checkResult:K.checkResult??K.result??K.decision,findings:K.findings??K.riskPoints??K.evidence,sourcePath:`${U}.${w}`}),V=JSON.stringify(W);if(!q.has(V))q.add(V),z.push(W)});return{recordId:$.id,sourceDocumentSN:$.sourceDocumentSN,sourceDocumentId:$.sourceDocumentId,ruleSetVersionNumber:$.ruleSetVersionNumber,count:z.length,rules:z}}function mD($,I){if(!$)return;for(let z of I){let q=e5($,z);if(q!==void 0)return q}return}function PZ0($,I){if(!$)return 0;for(let z of I){let q=e5($,z);if(Array.isArray(q))return q.length;if(q&&typeof q==="object")return Object.keys(q).length;if(typeof q==="number")return q}return 0}function e5($,I){return I.split(".").reduce((z,q)=>{if(z===void 0||z===null)return;if(Array.isArray(z)){let U=Number(q);return Number.isInteger(U)?z[U]:void 0}if(typeof z==="object")return z[q];return},$)}function pH1($,I,z){let q=I.split("."),U=$;for(let Y of q.slice(0,-1)){let J=U[Y];if(!J||typeof J!=="object"||Array.isArray(J))U[Y]={};U=U[Y]}U[q[q.length-1]??I]=z}function nU($){return Object.fromEntries(Object.entries($).filter(([,I])=>I!==void 0))}function Rw($){return $&&typeof $==="object"&&!Array.isArray($)?$:void 0}function cH1($){return typeof $==="number"&&Number.isFinite($)?$:void 0}function dH1($){let I=[];return lu($,"document",I),I}function lu($,I,z){if(Array.isArray($)){$.forEach((J,Q)=>lu(J,`${I}.${Q}`,z));return}let q=Rw($);if(!q)return;let U=J4(q.label)??J4(q.name)??J4(q.title)??J4(q.fieldName),Y=q.value??q.displayValue??q.text??q.content;if(U&&Y!==void 0&&typeof Y!=="object")z.push(nU({path:I,label:U,value:Y,type:J4(q.type)??J4(q.fieldType)}));for(let[J,Q]of Object.entries(q)){if(J==="attachments")continue;lu(Q,`${I}.${J}`,z)}}function iD($,I){return $.find((q)=>{let U=J4(q.label)??"";return I.some((Y)=>U.includes(Y))})?.value}function mH1($){let I=[];return lD($.result,"result",I),lD($.document,"document",I),I.slice(0,20)}function lD($,I,z){if(Array.isArray($)){$.forEach((U,Y)=>lD(U,`${I}.${Y}`,z));return}let q=Rw($);if(!q)return;if(/invoice|发票/i.test(I))z.push(nU({path:I,fileName:J4(q.fileName)??J4(q.filename)??J4(q.name),buyer:q.buyer??q.buyerName??q.purchaserName,seller:q.seller??q.sellerName,amount:q.amount??q.totalAmount??q.total,taxRate:q.taxRate,category:q.category??q.type}));for(let[U,Y]of Object.entries(q))lD(Y,`${I}.${U}`,z)}function TZ0($,I,z){return $.split(/\r?\n/).filter((q)=>I.some((U)=>q.includes(U))).slice(0,z)}function pD($){return $.map((I)=>{let z=OI(I);return{recordId:z.id,tenantId:z.tenantId,agentId:z.agentId,sourceDocumentSN:z.sourceDocumentSN,sourceDocumentId:z.sourceDocumentId,simulationBatchId:z.simulationBatchId,langfuseTraceId:z.langfuseTraceId,langfuseSessionFallback:z.langfuseSessionFallback,ruleSetVersionNumber:z.ruleSetVersionNumber,ruleSetPublishedAt:z.ruleSetPublishedAt,ruleSetPublishedByName:z.ruleSetPublishedByName,resolution:z.langfuseTraceId?"trace":z.langfuseSessionFallback?"session-fallback":"unresolved"}})}function du($){return{id:$.id,tenantId:$.tenantId,versionNumber:$.versionNumber,versionName:$.versionName,publishedBy:$.publishedBy,publishedByName:$.publishedByName,rulesCount:$.rules.length,publishedAt:$.publishedAt,createdAt:$.createdAt}}async function lH1($,I){if(I.recordId&&!I.versionId&&!I.versionNumber&&!I.latest){let z=await P4($,I.recordId);if(!z.ruleSetVersionNumber)throw Er
Line truncated
`)}function wG1($){let I=[];if(I.push(`seal-use${$.area}-${$.title}`),$.description)I.push($.description);I.push(""),I.push("Usage:");for(let z of $.commands)for(let q of z.usage)I.push(`${q}`);if($.commands.some((z)=>z.name))I.push(""),I.push(`Run'seal-use ${$.area} <command> --help'fordetailsonaspecificcommand.`);return I.join(`
`)}function mZ0(){let $=[];$.push("seal-use CLI"),$.push(""),$.push("Usage:"),$.push(" seal-use version");for(let I of lZ0)for(let z of I.commands)for(let q of z.usage)$.push(`${q}`);return $.push(""),$.push("Run 'seal-use <command> --help' for details on a specific command."),$.join(`
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let W of G){let V=W.outboundName??"SealAI 审批",X=W.signKey,L=W.apiOrigin??"production";console.error(`•"${V}"(signKey:${X},环境:${L})`),console.error(`\uD83D\uDC49查看命令:seal-usedeployhosecloudget${X}--corp${U.id}
`),console.error("ℹ️ 当前企业发现以下可用的合思配置卡片:");for(let X of W){let L=X.outboundName??"SealAI 审批",D=X.signKey,F=X.apiOrigin??"production";console.error(`•"${L}"(signKey:${D},环境:${F})`),console.error(`\uD83D\uDC49同步命令:seal-usedeployhosecloudsync${D}--corp${U.id}
`);throw new U$("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,W.length===1?`seal-usedeployhosecloudsync${W[0].signKey}--corp${U.id}`:void 0)}await O0("seal_deploy_hosecloud_sync",q,U,{signKey:K},W0(Y.options));return}throw Error(`Unknowndeployhosecloudaction:${Q??""}.Available:requirements,list,get,status,configure,sync.`)}import{accessSync as QW1,constants as wW1,existsSync as T$,readdirSync as KW1}from"node:fs";import{homedir as HW1}from"node:os";import{join as I9}from"node:path";import{existsSync as Vx,mkdirSync as SL0,rmSync as UW1,writeFileSync as YW1}from"node:fs";import{homedir as yL0}from"node:os";import{dirname as JW1,join as Zx}from"node:path";var PL0=`---
`);throw new U$("缺少必需参数 <sign-key>。请从上述候选列表中选择并指定 signKey 执行同步。",2,W.length===1?`seal-usedeployhosecloudsync${W[0].signKey}--corp${U.id}`:void 0)}await O0("seal_deploy_hosecloud_sync",q,U,{signKey:K},W0(Y.options));return}throw Error(`Unknowndeployhosecloudaction:${Q??""}.Available:requirements,list,get,status,configure,sync.`)}import{accessSync as XW1,constants as LW1,existsSync as T$,readdirSync as DW1}from"node:fs";import{homedir as FW1}from"node:os";import{join as I9}from"node:path";import{existsSync as Xx,mkdirSync as iL0,rmSync as WW1,writeFileSync as VW1}from"node:fs";import{homedir as pL0}from"node:os";import{dirname as ZW1,join as Lx}from"node:path";var _L0=`---
name:seal-use
description:"v0.10.18: 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."
-User-facing合思authorizationlink(合思/易快报授权):\`seal-use auth hose-link --corp <corpId> --expire 7200\`; read \`references/hose-enterprise-auth.md\`. Never use this route when the user says Seal 协助. Always provide BOTH a code block (\`\`\`\`text ... \`\`\`\`) AND a hyperlink.
Rule,document,stylepreference,andpublishactionsmutateSealconfiguration.Makethetargetenterpriseexplicit,showtheintendedpayload,andverifyafterthewrite.Neversendreal\`enterprises/*.json\` files, tokens, signed URLs, or full raw documents to GitHub, tickets, logs, or chat unless the user explicitly requests a safe export.
`;var TL0=`interface:
`;var CL0=`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."
@@ -656,7 +656,7 @@ Use current search only when the question is about current draft/current knowled
##OutputDiscipline
Ifarulecommandwouldreturnmanydescriptionsormorethanabout20rules,use\`rules count\`, \`rules list --summary\`, \`fields\`, \`snippetOnly\`, or \`--output-file\`. Use \`--full\` only for deliberate exports.
`;var jL0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use<command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise the user-level `~/.config/seal-use/enterprises`directoryisloaded.Aconfigured\n`testEnterprisesDir`isloadedfirstfortest-tenantworkflows.Thecurrentworkingdirectory's\n`./enterprises`directoryisnotloadedimplicitly.\n-Set`SEAL_USE_ENTERPRISES_DIR`touseoneexplicitdirectoryinstead.Legacy\n`~/.config/seal-home/enterprises`filesaremigratedtotheprimarydirectorywhenpossible.\n\nEnterpriseselectionisstatelessbydefault.Commandsthataccessanenterpriserequire\n`--corp<corpId>`unlessstatefulmodeisexplicitlyenabled:\n\n```bash\nseal-useconfigmodestateful--corp<corpId>\nseal-usecorpsswitch<corpId>\nseal-useconfigmodestateless\n```\n\nTheglobalmodeisstoredin`~/.config/seal-use/config.json`;set`SEAL_USE_CONFIG_FILE`to\noverridethatpath.Thelegacy`current-corp`fileisnotread.\n\n##Stream&ExitCodeContract\n\n-**`stdout`**:Pure,deterministicJSONformachine/Agentparsing.\n-**`stderr`**:Diagnostics,probinglogs,and**Next-StepCommandSuggestions**withthestableprefix`👉Nextaction:seal-use...`.\n-**`ExitCode`**:`0`onsuccess;`1`runtime/upstreamfailure,`2`usage/argumenterror,`10`explicitdestructive-operationconfirmationrequired,`11`missing/invalidauthentication,and`12`outputprotectionrequiringacompact/file/queryalternative.\n\n##Top-LevelCommands\n\n```bash\nseal-useversion\nseal-useconfigpaths\nseal-useconfigget\nseal-useconfigmode<stateful|stateless>[--corp<corpId>]\nseal-useconfigtest-dir[<path>|--clear]\nseal-useconfiglint<enable|disable|status>[--linter<name>][--min-score<score>]\nseal-userulescount[--corp<corpId>]\nseal-useruleslist[--summary][--count][--limit20][--offset0][--corp<corpId>]\nseal-userulesclear[--corp<corpId>][--dry-run|--yes]\nseal-userulesversions[--corp<corpId>]\nseal-userulesversion<versionId|versionNumber|latest>[--corp<corpId>]\nseal-userulesget--corp<corpId>--version<number|latest>--code'#0038'\nseal-userulesget--corp<corpId>--record-id<recordId>--runtime-idrule-205\nseal-userulessearch<keyword>[--version<versionId|versionNumber|latest>][--maxResults20][--corp<corpId>]\nseal-userulespull[--corp<corpId>][--version<id|num|latest>][--out<file>]\nseal-useruleslint[--file<path>][--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-userulespush[--file<path>][--corp<corpId>][--publish][--version-name<name>][--dry-run|--yes]\nseal-userulesmap[--corp<corpId>][--version<id|num|latest>][--code<code>]\nseal-useservice<start|stop|restart|status|logs>[--port8787][--host127.0.0.1][--lines50]\nseal-usehttp[--port8787][--host127.0.0.1]\nseal-useserve[--port8787]\nseal-useupdate[--check][--force][--version<v>]\nseal-useupdatecheck\nseal-useupdatechangelog[--limit<n>]\nseal-usechangelog[--limit<n>]\nseal-usemcp\nseal-usemcpconfig\nseal-usemcp-config\nseal-useskilldump\nseal-useskillinstall[--dir<path>|--local]\nseal-useskillstatus\nseal-useopenapi\nseal-usedoctor[--quiet]\nseal-usedoctorguide\nseal-usedoctorpaths\nseal-useprobe[<corpId>]\nseal-usetoolslist\nseal-usecorpslist[query][--env<production|test>][--strict][--corp<corpId>]\nseal-usecorpssearch<query>[--env<production|test>][--strict]\nseal-usecorpsget<corpId>\nseal-usecorpscurrent[--corp<corpId>]\nseal-usecorpsswitch<corpId>\nseal-usecorpsmark<corpId>--env<production|test>[--confirm]\nseal-usecorpsbind-test<prodCorpId><testCorpId>[--confirm][--force]\nseal-usecorpsunbind-test[<corpId>][--confirm]\nseal-usecorpssync-test[<prodCorpId>][--dry-run][--yes][--version-name<name>]\nseal-usecorpsreplay-test[<prodCorpId>][--record-id<id>][--sn<sn>][--limit<n>][--status<status>][--webhook<idOrName>][--sn-suffix<str>][--dry-run][--force]\nseal-usecorpsadd-hose--json'{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-usecorpsadd-seal--json'{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-usecorpsadd-link<https://.../web/thirdparty.html?...>[--name<customName>][--overwrite]\nseal-useauthdiagnose[--corp<corpId>]\nseal-useauthhose-link[--corp<corpId>][--expire7200]\nseal-usedelegationlist[--corp<corpId>]\nseal-usedelegationcreate[--note<note>][--from-link<url>][--corp<corpId>]\nseal-usedelegationrevoke<tokenId>[--corp<corpId>]\nseal-useuserscreate--name<name>--phone<phone>[--dept<deptId>][--corp<corpId>]\nseal-useuserssearch<keyword>Line truncated
`;var yL0="# Seal Use CLI Reference\n\nRun from any directory after installing the global CLI:\n\n```bash\nseal-use<command>\n```\n\nEnterprise config lookup:\n\n- If `SEAL_USE_ENTERPRISES_DIR` is set, only that directory is loaded.\n- Otherwise the user-level `~/.config/seal-use/enterprises`directoryisloaded.Aconfigured\n`testEnterprisesDir`isloadedfirstfortest-tenantworkflows.Thecurrentworkingdirectory's\n`./enterprises`directoryisnotloadedimplicitly.\n-Set`SEAL_USE_ENTERPRISES_DIR`touseoneexplicitdirectoryinstead.Legacy\n`~/.config/seal-home/enterprises`filesaremigratedtotheprimarydirectorywhenpossible.\n\nEnterpriseselectionisstatelessbydefault.Commandsthataccessanenterpriserequire\n`--corp<corpId>`unlessstatefulmodeisexplicitlyenabled:\n\n```bash\nseal-useconfigmodestateful--corp<corpId>\nseal-usecorpsswitch<corpId>\nseal-useconfigmodestateless\n```\n\nTheglobalmodeisstoredin`~/.config/seal-use/config.json`;set`SEAL_USE_CONFIG_FILE`to\noverridethatpath.Thelegacy`current-corp`fileisnotread.\n\n##Stream&ExitCodeContract\n\n-**`stdout`**:Pure,deterministicJSONformachine/Agentparsing.\n-**`stderr`**:Diagnostics,probinglogs,and**Next-StepCommandSuggestions**withthestableprefix`👉Nextaction:seal-use...`.\n-**`ExitCode`**:`0`onsuccess;`1`runtime/upstreamfailure,`2`usage/argumenterror,`10`explicitdestructive-operationconfirmationrequired,`11`missing/invalidauthentication,and`12`outputprotectionrequiringacompact/file/queryalternative.\n\n##Top-LevelCommands\n\n```bash\nseal-useversion\nseal-useconfigpaths\nseal-useconfigget\nseal-useconfigmode<stateful|stateless>[--corp<corpId>]\nseal-useconfigtest-dir[<path>|--clear]\nseal-useconfiglint<enable|disable|status>[--linter<name>][--min-score<score>]\nseal-userulescount[--corp<corpId>]\nseal-useruleslist[--summary][--count][--limit20][--offset0][--corp<corpId>]\nseal-userulesclear[--corp<corpId>][--dry-run|--yes]\nseal-userulesversions[--corp<corpId>]\nseal-userulesversion<versionId|versionNumber|latest>[--corp<corpId>]\nseal-userulesget--corp<corpId>--version<number|latest>--code'#0038'\nseal-userulesget--corp<corpId>--record-id<recordId>--runtime-idrule-205\nseal-userulessearch<keyword>[--version<versionId|versionNumber|latest>][--maxResults20][--corp<corpId>]\nseal-userulespull[--corp<corpId>][--version<id|num|latest>][--out<file>]\nseal-useruleslint[--file<path>][--corp<corpId>][--linter<name|path>][--version<num>][--code<code>][--min-score<score>][--summary]\nseal-userulespush[--file<path>][--corp<corpId>][--publish][--version-name<name>][--dry-run|--yes]\nseal-userulesmap[--corp<corpId>][--version<id|num|latest>][--code<code>]\nseal-useservice<start|stop|restart|status|logs>[--port8787][--host127.0.0.1][--lines50]\nseal-usehttp[--port8787][--host127.0.0.1]\nseal-useserve[--port8787]\nseal-useupdate[--check][--force][--version<v>]\nseal-useupdatecheck\nseal-useupdatechangelog[--limit<n>]\nseal-usechangelog[--limit<n>]\nseal-usemcp\nseal-usemcpconfig\nseal-usemcp-config\nseal-useskilldump\nseal-useskillinstall[--dir<path>|--local]\nseal-useskillstatus\nseal-useopenapi\nseal-usedoctor[--quiet]\nseal-usedoctorguide\nseal-usedoctorpaths\nseal-useprobe[<corpId>]\nseal-usetoolslist\nseal-usecorpslist[query][--env<production|test>][--strict][--corp<corpId>]\nseal-usecorpssearch<query>[--env<production|test>][--strict]\nseal-usecorpsget<corpId>\nseal-usecorpscurrent[--corp<corpId>]\nseal-usecorpsswitch<corpId>\nseal-usecorpsmark<corpId>--env<production|test>[--confirm]\nseal-usecorpsbind-test<prodCorpId><testCorpId>[--confirm][--force]\nseal-usecorpsunbind-test[<corpId>][--confirm]\nseal-usecorpssync-test[<prodCorpId>][--dry-run][--yes][--version-name<name>]\nseal-usecorpsreplay-test[<prodCorpId>][--record-id<id>][--sn<sn>][--limit<n>][--status<status>][--webhook<idOrName>][--sn-suffix<str>][--dry-run][--force]\nseal-usecorpsadd-hose--json'{\"name\":\"企业名称\",\"domain\":\"https://app.ekuaibao.com\",\"appKey\":\"...\",\"appSecurity\":\"...\",\"proxyStaffBizId\":\"corpId:staffId\"}'\nseal-usecorpsadd-seal--json'{\"sealUrl\":\"https://tenant.sealai.cc\",\"token\":\"seal-bearer-token\"}'\nseal-usecorpsadd-link<https://.../web/thirdparty.html?...>[--name<customName>][--overwrite]\nseal-useauthdiagnose[--corp<corpId>]\nseal-useauthhose-link[--corp<corpId>][--expire7200]\nseal-usedelegationlist[--corp<corpId>]\nseal-usedelegationcreate[--note<note>][--from-link<url>][--corp<corpId>]\nseal-usedelegationrevoke<tokenId>[--corp<corpId>]\nseal-useuserscreate--name<name>--phone<phone>[--dept<deptId>][--corp<corpId>]\nseal-useuserssearch<keyword>Line truncated
-\`seal-use auth diagnose\` proves this stage works but redacts the token, so it is not enough when the user needs the actual clickable Hose link.
-**FormattingRequirement**:WhenreturningaHoseauthorizationlinktotheuser,ALWAYSprovideBOTHacodeblock(\`\`\`\`text ... \`\`\`\`) for easy copying without accidental default browser redirection, AND a clickable hyperlink.
`)}async function pL0($,I,z){let q=($??I??"").toLowerCase();if(q==="guide"||q==="doc"||q==="knowledge"||q==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(nL0());return}if(q==="paths"||q==="dirs"||q==="directories"){let J=Mx();E0(J.directories);return}let U=Mx();if(!(L0(z.options.quiet)||L0(z.options.silent)))console.error(iL0(U));E0(U)}import{createServer as XW1}from"node:http";import{URL as WW1}from"node:url";var cL0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.18",description:`PlannedHTTPcontractfortheseal-usewrappedbackendAPI.
`)}async function aL0($,I,z){let q=($??I??"").toLowerCase();if(q==="guide"||q==="doc"||q==="knowledge"||q==="book"){console.error(`\uD83D\uDCD6[SealUseDoctor]正在读取内嵌系统规范白皮书(纯内存只读)...
`),console.log(oL0());return}if(q==="paths"||q==="dirs"||q==="directories"){let J=Px();E0(J.directories);return}let U=Px();if(!(L0(z.options.quiet)||L0(z.options.silent)))console.error(tL0(U));E0(U)}import{createServer as PW1}from"node:http";import{URL as NW1}from"node:url";var sL0={openapi:"3.1.0",info:{title:"seal-use Wrapped API",version:"0.10.18",description:`PlannedHTTPcontractfortheseal-usewrappedbackendAPI.
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"2
Line truncated
`},servers:[{url:"http://localhost:8787",description:"Reserved for a future local HTTP adapter; the current service uses MCP stdio."}],security:[{localSession:[]}],tags:[{name:"Corps",description:"Local enterprise configuration selection."},{name:"Source",description:"Source-derived Seal enterprise configuration."},{name:"Auth",description:"Wrapped authentication diagnostics and current identity."},{name:"Approval Runs",description:"Wrapped approval run history, summaries, document URLs, and trace bridge helpers."},{name:"Approval Knowledge",description:"Wrapped approval rules, documents, preferences, and search."},{name:"Simulation",description:"Wrapped simulation batch record access."}],paths:{"/v1/corps":{get:{tags:["Corps"],operationId:"listCorps",summary:"List configured enterprises",responses:{"200":{description:"Configured enterprises.",content:{"application/json":{schema:{type:"array",items:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}}},"/v1/corps/current":{get:{tags:["Corps"],operationId:"getCurrentCorp",summary:"Get current enterprise",description:"Returns the configured default enterprise in stateful mode. Stateless mode has no current enterprise and requires an explicit corpId for enterprise operations.",responses:{"200":{description:"Current enterprise.",content:{"application/json":{schema:{type:"object",required:["id","name","sourceType","current"],properties:{id:{type:"string"},name:{type:"string"},sourceType:{type:"string",enum:["hose","direct","seal"]},current:{type:"boolean"}}}}}}}}},"/v1/corps/current/switch":{post:{tags:["Corps"],operationId:"switchCurrentCorp",summary:"Switch current enterprise",requestBody:{required:!0,content:{"application/json":{schema:{type:"object",required:["corpId"],properties:{corpId:{type:"string"}}}}}},responses:{"200":{description:"Switched enterprise.",content:{"application/json":{schema:{type:"object",required:["current","id","name"],properties:{current:{type:"boolean"},id:{type:"string"},name:{type:"string"}}}}}},"404":{description:"Requested resource was not found.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/source/config":{get:{tags:["Source"],operationId:"getSourceConfig",summary:"Resolve source-derived Seal enterprise config",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Redacted Seal enterprise config.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,description:"Redacted Seal enterprise config resolved from the configured source."}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/auth/diagnose":{get:{tags:["Auth"],operationId:"diagnoseAuth",summary:"Diagnose wrapped source-to-Seal authentication",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Authentication stage diagnosis.",content:{"application/json":{schema:{type:"object",required:["stages"],properties:{stages:{type:"array",items:{$ref:"#/components/schemas/AuthStage"}}}}}}}}}},"/v1/whoami":{get:{tags:["Auth"],operationId:"whoami",summary:"Get current wrapped Seal identity",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"200":{description:"Current Seal user and tenant.",content:{"application/json":{schema:{type:"object",required:["user","tenant"],properties:{user:{$ref:"#/components/schemas/SealUser"},tenant:{$ref:"#/components/schemas/SealTenant"}}}}}},"401":{description:"Local service authentication failed or downstream Seal auth failed.",content:{"application/json":{schema:{type:"object",additionalProperties:!0,required:["error"],properties:{error:{type:"string"},message:{type:"string"},details:{}}}}}}}}},"/v1/session":{get:{tags:["Auth"],operationId:"getSession",summary:"Get current wrapped Seal session metadata",parameters:[{name:"corpId",in:"query",schema:{type:"string"},description:"Local enterprise config ID. Required when global selection mode is stateless; optional in stateful mode, where the configured default enterprise is used."}],responses:{"2
Line truncated
`);U(q)})})}async function lL0($){let I=k0($.options.port)??k0($.options.p),z=j($.options.host)??j($.options.h),q=await wF({port:I,host:z}),U=()=>{q.close(()=>{process.exit(0)})};process.on("SIGINT",U),process.on("SIGTERM",U),await new Promise(()=>{})}async function oL0($,I,z,q){if($==="config"||$==="get"){await O0("seal_llm_config_get",I,z,{},W0(q.options));return}if($==="providers"||$==="list"){await O0("seal_llm_providers_list",I,z,{},W0(q.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function rL0($,I){if($==="config"||$==="json"){Px();return}await Tx()}function Px(){E0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function tL0($){let I=qF();E0(I,{...W0($.options),allowFull:!0})}async function aL0($,I,z,q){if($==="available"){await O0("seal_permissions_available_list",I,z,{},W0(q.options));return}if($==="configs"||$==="list"){await O0("seal_permissions_configs_list",I,z,{},W0(q.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as sL0}from"node:fs";async function eL0($,I,z,q,U,Y,J){if(!$||$==="get"){await O0("seal_preference_get",U,Y,{},W0(J.options));return}if($==="decision"){if(I==="update"||!I){let Q=j(J.options.input),w=Q?JSON.parse(sL0(Q,"utf8")):J$(J.json);if(!w||Object.keys(w).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await O0("seal_preference_decision_update",U,Y,{...w,dryRun:L0(J.options.dryRun)??L0(J.options["dry-run"])},W0(J.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let Q=j(J.options.default)??j(J.options.level)??q;if(Q!=="medium"&&Q!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await O0("seal_preference_thinking_depth_set",U,Y,{defaultLevel:Q,dryRun:L0(J.options.dryRun)??L0(J.options["dry-run"])},W0(J.options));return}if(I==="policies"){if(z==="list"||!z){await O0("seal_preference_thinking_depth_policies_list",U,Y,{},W0(J.options));return}if(z==="upsert"){let Q=j(J.options.input),w=Q?JSON.parse(sL0(Q,"utf8")):J$(J.json);if(!w||!w.id||!w.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await O0("seal_preference_thinking_depth_policies_upsert",U,Y,{...w,dryRun:L0(J.options.dryRun)??L0(J.options["dry-run"])},W0(J.options));return}if(z==="remove"||z==="delete"){let Q=q??j(J.options.id)??j(J.options.policyId);if(!Q)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await O0("seal_preference_thinking_depth_policies_remove",U,Y,{policyId:Q,dryRun:L0(J.options.dryRun)??L0(J.options["dry-run"])},W0(J.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function $D0($={}){let I=q$(),z=Y4(),q=v7(I,{stateful:z.stateful,defaultCorpId:z.defaultCorpId,corpId:$.corpId},o5());console.log(`[probe]corp=${q.id}source=${q.source.type}`);let U=await pU(q);console.log("[probe] seal enterprise"),console.log(JSON.stringify(U,null,2));let Y=await G1(q),J=await ZW(Y,{documentLimit:20,stylePreferencesEndpoint:q.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:J.rules.rules.length,hasPendingRuleDeletes:J.rules.hasPendingDeletes,documents:J.documents.articles.length,documentsTotal:J.documents.total,stylePreferences:J.stylePreferences.ok?"ok":`error:${J.stylePreferences.error}`},null,2))}async function ID0($,I,z){let q=I??j(z.options.corp)??($&&$!=="--corp"?$:void 0);await $D0({corpId:q})}async function Ex($,I,z,q,U){if($==="count"){await O0("seal_approval_rules_list",z,q,{countOnly:!0},W0(U.options));return}if($==="list"){if(L0(U.options.count)){await O0("seal_approval_rules_list",z,q,{countOnly:!0},W0(U.options));return}let Y=k0(U.options.limit),J=k0(U.options.offset);if(L0(U.options.summary)){await O0("seal_approval_rules_list",z,q,{fields:iZ0,limit:Y,offset:J},W0(U.options));return}let Q=await AI("seal_approval_rules_list",z,q,{limit:Y,offset:J});pZ0(Q,L0(U.options.full)===!0),E0(Q);return}if($==="clear"){let Y=L0(U.options.yes)===!0,J=L0(U.options.dryRun)??L0(U.options["dry-run"])??!Y;if(!Y&&!J)throw $5("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${q.id}--dry-run`);let Q=await AI("seal_approval_rules_clear",z,q,{dryRun:J,recode:L0(U.options.recode)});if(!Y&&J&&Q&&typeof Q==="object"){E0({...Q,nextCommand:`seal-userulesclear--corp${q.id}--yes`},W0(U.options));return}E0(Q,W0(U.options));return}if($==="versions"){await O0("seal_approval_rule_versions_list",z,q,{},W0(U.options));return}if($==="version"){let Y=I??j(U.options.version);if(!Y)throw Error("Usage: seal-use rules version <versionId|versionNumber|l
Line truncated
`).filter(Boolean),Y=U.slice(-I);return{logFile:z,lines:Y,totalLines:U.length}}async function NW1($){let I=WF($),z=vx($),q=nw($);YD0($.stateDir);let U=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):JF),Y=$.host??(process.env.HOST?process.env.HOST:QF);HF(I,`${process.pid}
`,{mode:384}),HF(z,JSON.stringify({pid:process.pid,port:U,host:Y,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),cU(q,`servicestartingonhttp://${Y}:${U} pid=${process.pid}`);let J=null;try{J=await wF({port:U,host:Y,silent:!0}),cU(q,`service listening pid=${process.pid}`)}catch(w){if(cU(q,`service failed to bind port ${U}: ${w instanceof Error?w.message:String(w)}`),GF(I)===process.pid)U5(I,{force:!0}),U5(z,{force:!0});throw w}let Q=()=>{if(J)J.close(),J=null;if(GF(I)===process.pid)U5(I,{force:!0}),U5(z,{force:!0});cU(q,`stopped pid=${process.pid}`)};await new Promise((w)=>{let K=!1,H=()=>{if(K)return;K=!0,Q(),process.off("SIGTERM",H),process.off("SIGINT",H),w()};process.once("SIGTERM",H),process.once("SIGINT",H)})}function zD0($){YD0($.stateDir);let I=dU($);if(I.running)return I;let z=$.launcher??{command:process.execPath,args:[$.entryFile]},q=[...z.args??[],"service","run"];if($.port)q.push("--port",String($.port));if($.host)q.push("--host",String($.host));let U=LW1(z.command,q,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});U.unref();let Y=WF($);return HF(Y,`${U.pid}
`,{flag:"a",mode:384})}var gx=PW1(AW1(),".config","seal-use");async function Rx($,I,z){let q=z?k0(z.options.port)??k0(z.options.p):void 0,U=z?j(z.options.host)??j(z.options.h):void 0,Y=z?k0(z.options.lines)??k0(z.options.n):void 0,J=await TI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:gx,version:s0,launcher:I.launcher,port:q,host:U},{maxLines:Y});if(J!==void 0)E0(J)}import{existsSync as TW1,readFileSync as JD0}from"node:fs";async function QD0($,I,z,q,U){if($==="batch-records"||$==="records"){let Y=I??j(U.options.batchId)??j(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation batch-records <batchId>");await O0("seal_simulation_batch_records_get",z,q,{batchId:Y,query:j(U.options.query)},W0(U.options));return}if($==="create"||$==="run"){let Y=j(U.options.mode)??j(U.options.sourceSystem)??j(U.options["source-system"])??"hosecloud",J=Y==="material-pack"?"material_pack":Y,Q=j(U.options.schemaConfig)??j(U.options["schema-config"]),w=Q?JSON.parse(JD0(Q,"utf8")):void 0,K=j(U.options.input),H=K?JSON.parse(JD0(K,"utf8")):J$(U.json),G=j(U.options.packageId)??j(U.options["package-id"]),W=V6(U.options.packageIds)??V6(U.options["package-ids"])??(G?[G]:void 0),V=V6(U.options.flowIds)??V6(U.options["flow-ids"])??V6(U.options.documentSn)??V6(U.options["document-sn"]),X=j(U.options.signKey)??j(U.options["sign-key"])??j(U.options.integration),L=L0(U.options.noWait)??L0(U.options["no-wait"]);await O0("seal_simulation_batch_create",z,q,{mode:J,sourceSystem:J,flowIds:V,documentSn:V,rejectNodeName:j(U.options.rejectNode)??j(U.options["reject-node"])??null,thinkingDepthOverride:j(U.options.thinkingDepth)??j(U.options["thinking-depth"]),skipInvoiceGeneration:L0(U.options.skipInvoiceGeneration)??L0(U.options["skip-invoice-generation"]),skipExpenseExtraction:L0(U.options.skipExpenseExtraction)??L0(U.options["skip-expense-extraction"]),disableAttachmentCache:L0(U.options.disableAttachmentCache)??L0(U.options["disable-attachment-cache"]),signKey:X,packageIds:W,packageId:G,templateId:j(U.options.templateId)??j(U.options["template-id"]),schemaConfig:w,requestIds:V6(U.options.requestIds)??V6(U.options["request-ids"]),workflowTypeId:j(U.options.workflowTypeId)??j(U.options["workflow-type-id"]),flowStatusList:V6(U.options.flowStatusList)?.map(Number)??V6(U.options["flow-status-list"])?.map(Number),businessCodes:V6(U.options.businessCodes)??V6(U.options["business-codes"]),documentType:j(U.options.documentType)??j(U.options["document-type"]),startTime:k0(U.options.startTime)??k0(U.options["start-time"]),endTime:k0(U.options.endTime)??k0(U.options["end-time"]),status:V6(U.options.status),limit:k0(U.options.limit),noWait:L,rawParams:H},W0(U.options));return}if($==="wait"){let Y=I??j(U.options.batchId)??j(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await O0("seal_simulation_batch_wait",z,q,{batchId:Y,timeout:j(U.options.timeout),pollInterval:j(U.options.pollInterval)??j(U.options["poll-interval"])},W0(U.options));return}if($==="status"){let Y=I??j(U.options.batchId)??j(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation status <batchId>");await O0("seal_simulation_batch_status",z,q,{batchId:Y},W0(U.options));return}if($==="clean"||$==="delete"){let Y=I??j(U.options.batchId)??j(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation clean <batchId>");await O0("seal_simulation_batch_clean",z,q,{batchId:Y},W0(U.options));return}if($==="specifications"){let Y=I??j(U.options.integration)??j(U.options.signKey)??j(U.options["sign-key"]);await O0("seal_simulation_specifications_list",z,q,{signKey:Y},W0(U.options));return}if($==="approval-definitions"||$==="definitions"){await O0("seal_simulation_feishu_approval_definitions_list",z,q,{},W0(U.options));return}if($==="list"){await O0("seal_simulation_batches_list",z,q,{limit:k0(U.options.limit)},W0(U.options));return}if($==="get"){let Y=I??j(U.options.batchId)??j(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation get <batchId>");await O0("seal_simulation_batch_get",z,q,{batchId:Y},W0(U.options));return}if($==="templates"){await O0("seal_simulation_templates_get",z,q,{},W0(U.options));return}if($==="integrations"){await O0("seal_simulation_integrations_get",z,q,{},W0(U.options));return}if($==="package-upload"){let Y=I??j(U.options.file);if(!Y)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!TW1(Y))throw Error(`Filenotfound:${Y}`);await O0("seal_simulation_material_package_upload",z,q,{filePath:Y},W0(U.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as wD0}from"node:fs";import{join as VF}from"node:path";function KD0($,I,z){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${xL0()}
`);return}if($==="install"||$==="init"||$==="sync"){let q=L0(z.options.local)||L0(z.options.workspace),U=j(z.options.dir)??j(z.options.target)??I,Y=U?U:q?VF(process.cwd(),".agents","skills","seal-use"):PI(),J=Xx(Y);E0({installed:!0,targetDir:J.targetDir,fileCount:J.files.length,files:J.files});return}if($==="status"||$==="get"||!$){let q=PI(),U=VF(process.cwd(),".agents","skills","seal-use");E0({global:{dir:q,installed:wD0(VF(q,"SKILL.md"))},local:{dir:U,installed:wD0(VF(U,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function HD0($,I){if($==="config"){E0(await pU(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function GD0($,I,z,q){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await O0($,I,z,J$(q.json),W0(q.options))}function WD0(){E0(vw.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as EW1,mkdirSync as BW1,renameSync as _x,rmSync as jW1,unlinkSync as DD0,writeFileSync as VD0}from"node:fs";import{dirname as vW1,join as ZD0}from"node:path";import{spawnSync as EI}from"node:child_process";function ZF($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let z=$.toLowerCase().replace(/\\/g,"/");return!z.endsWith("/bun")&&!z.endsWith("/bun.exe")&&!z.endsWith("/node")&&!z.endsWith("/node.exe")}var FD0="yunyingk/seal-use",iw="yunyingk/seal-home";var gW1="SEAL_USE_GITHUB_REPO",RW1="SEAL_HOME_GITHUB_REPO";async function OD0($,I={}){let z={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:gx,version:s0,launcher:$.launcher},q=I.repo||process.env[gW1]?.trim()||process.env[RW1]?.trim()||FD0,U=I.targetVersion?.trim(),Y=U&&U.toLowerCase()!=="latest"?U:void 0;if(Y){let M=Y.replace(/^v/,""),B=ND0(M,s0);if(B<0)if(!JB&&I.force);else{E0({updated:!1,currentVersion:s0,targetVersion:M,mode:ZF()?"binary":"source",message:!JB?`Cannotdowngradeseal-usefromdevbuildv${s0}toreleasev${M}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${s0}toolderversionv${M}.Updatesmustbeforward-only.`});return}if(B===0&&!I.force){E0({updated:!1,currentVersion:s0,targetVersion:M,mode:ZF()?"binary":"source",message:`seal-useisalreadyatversionv${s0}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let M=await Cx(q,I.limit??10);E0({currentVersion:s0,totalQueried:M.length,releases:M.map((B)=>({version:B.version,tagName:B.tagName,publishedAt:B.publishedAt,author:B.author,releaseNotes:B.notes,releaseUrl:B.htmlUrl,isCurrent:B.version===s0,isNewer:bw(B.version,s0)}))});return}if(!ZF()){if(I.checkOnly){let B=await Cx(q,30),u=B[0],h=u?.version??s0,x=B.find((i)=>i.version===s0),g=bw(h,s0),p=B.filter((i)=>bw(i.version,s0));E0({updated:!1,updateAvailable:g,currentVersion:s0,currentVersionPublishedAt:x?.publishedAt,latestVersion:h,latestVersionPublishedAt:u?.publishedAt,behindCount:p.length,pendingReleases:p.map((i)=>({version:i.version,tagName:i.tagName,publishedAt:i.publishedAt,author:i.author,releaseNotes:i.notes,releaseUrl:i.htmlUrl})),releaseNotes:u?.notes??"",releaseUrl:u?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let M=dU(z).running;if(M)await TI("stop",z);try{LD0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(B){console.error(`gitpullskipped:${BinstanceofError?B.message:String(B)}`)}if(LD0("bun",["install"],{cwd:$.appRoot}),M)await TI("start",z);E0({updated:!0,serviceRestarted:M,version:s0,mode:"source"});return}let J=_W1(),Q=CW1(),w=await Cx(q,30),K=Y?w.find((M)=>M.version===Y||M.tagName===Y||M.tagName===`v${Y}`)??await XD0(q,Y):w[0]??await XD0(q);if(!K){E0({updated:!1,currentVersion:s0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${q}'`});return}let H=K.version,G=w.find((M)=>M.version===s0),W=bw(H,s0),V=W||Boolean(I.force),X=w.filter((M)=>bw(M.version,s0));if(I.checkOnly){E0({updated:!1,updateAvailable:W,currentVersion:s0,currentVersionPublishedAt:G?.publishedAt,latestVersion:H,latestVersionPublishedAt:K.publishedAt,behindCount:X.length,pendingReleases:X.map((M)=>({version:M.version,tagName:M.tagName,publishedAt:M.publishedAt,author:M.author,releaseNotes:M.notes,releaseUrl:M.htmlUrl})),releaseNotes:K.notes,releaseUrl:K.htmlUrl,mode:"binary"});return}if(!V){E0({updated:!1,currentVersion:s0,currentVersionPublishedAt:G?.publishedAt,latestVersion:H,latestVersionPublishedAt:K.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${s0})`});return}let L=hW1(K.assets,J,Q);if(!L)throw Error(`Nocompatiblebinaryfoundfor${J}-${Q}inreleasev${H}.Availableassets:${K.assets.map((M)=>M.name).join(", ")}`);let D=dU(z).running;if(D)await TI("stop",z);let F=process.execPath,T=vW1(F),P=ZD0(T,`.tmp-update-${Date.now()}`);BW1(P,{recursive:!0});try{let M=ZD0(P,L.name);await SW1(L.downloadUrl,M,K.tagName,L.name);let B=M;if(L.name.endsWith(".tar.gz")||L.name.endsWith(".tgz"))B=yW1
Line truncated
`)}catch{}}async function SW1($,I,z,q){let U=hx(),Y=[],J=z?z.startsWith("v")?z:`v${z}`:void 0,Q=q||$.split("/").pop()||"";if(U!=="github"){if(J&&Q)Y.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${J}/${Q}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${J}/${Q}`);if($.startsWith("https://git.ying-qing.cn"))Y.push($)}if(U!=="gitea")if(J&&Q){let L=`https://github.com/${FD0}/releases/download/${J}/${Q}`;if(!process.env.CI)Y.push(`https://ghfast.top/${L}`,`https://gh.ddlc.top/${L}`);Y.push(L)}else if($.includes("github.com")){if(!process.env.CI)Y.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Y.push($)}else Y.push($);let w=Array.from(new Set(Y)),K,H=6000,G=6000,W=307200,V=1e4,X=180000;for(let L=0;L<w.length;L++){let D=w[L],F=new AbortController,T="",P=(h)=>{T=h;try{F.abort()}catch{}},M=setTimeout(()=>{P("Connection timed out (no response headers within 6s)")},H),B,u;try{XF(`==> [${L+1}/${w.length}] Downloading via: ${D}`);let h=await fetch(D,{signal:F.signal});if(M)clearTimeout(M),M=void 0;if(!h.ok)throw Error(`HTTP ${h.status} ${h.statusText}`);B=setTimeout(()=>{P("Overall download time exceeded 3 minutes")},X);let x=Number(h.headers.get("content-length"))||0,g=h.body?.getReader();if(!g){let b=Buffer.from(await h.arrayBuffer());if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);VD0(I,b),XF(`✓ Download succeeded (${(b.length/1024/1024).toFixed(1)} MB)`);return}let p=[],i=0,S=0;u=setTimeout(()=>{if(i<W){let b=(i/1024).toFixed(1);P(`Initial transfer too slow (${b} KB < 300 KB in 6s), switching mirror...`)}},G);while(!0){let b=g.read(),z0,v=new Promise((U0,G0)=>{z0=setTimeout(()=>{G0(Error("Data transfer stalled (no chunk received for 10s)"))},V)}),n;try{n=await Promise.race([b,v])}finally{if(z0)clearTimeout(z0)}let{done:c,value:r}=n;if(c)break;if(r){if(p.push(r),i+=r.length,u&&i>=W)clearTimeout(u),u=void 0;let U0=Date.now();if(U0-S>200){S=U0;let G0=x?Math.round(i/x*100):0,A0=(i/1048576).toFixed(1),g0=x?(x/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${G0}% (${A0} / ${g0} MB)...`)}catch{}}}}try{process.stderr.write(`
`);U(q)})})}async function ID0($){let I=y0($.options.port)??y0($.options.p),z=B($.options.host)??B($.options.h),q=await KF({port:I,host:z}),U=()=>{q.close(()=>{process.exit(0)})};process.on("SIGINT",U),process.on("SIGTERM",U),await new Promise(()=>{})}async function zD0($,I,z,q){if($==="config"||$==="get"){await O0("seal_llm_config_get",I,z,{},W0(q.options));return}if($==="providers"||$==="list"){await O0("seal_llm_providers_list",I,z,{},W0(q.options));return}throw Error(`Unknownllmcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function qD0($,I){if($==="config"||$==="json"){Ex();return}await Bx()}function Ex(){E0({mcpServers:{"seal-use":{type:"stdio",command:"seal-use",args:["mcp"],env:{SEAL_USE_MCP_ENABLED:"true"}}}})}function UD0($){let I=UF();E0(I,{...W0($.options),allowFull:!0})}async function YD0($,I,z,q){if($==="available"){await O0("seal_permissions_available_list",I,z,{},W0(q.options));return}if($==="configs"||$==="list"){await O0("seal_permissions_configs_list",I,z,{},W0(q.options));return}throw Error(`Unknownpermissionscommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{readFileSync as JD0}from"node:fs";async function QD0($,I,z,q,U,Y,J){if(!$||$==="get"){await O0("seal_preference_get",U,Y,{},W0(J.options));return}if($==="decision"){if(I==="update"||!I){let Q=B(J.options.input),w=Q?JSON.parse(JD0(Q,"utf8")):J$(J.json);if(!w||Object.keys(w).length===0)throw Error(`Usage:seal-usepreferencedecisionupdate--json'{"explicitApprove":"..."}'`);await O0("seal_preference_decision_update",U,Y,{...w,dryRun:L0(J.options.dryRun)??L0(J.options["dry-run"])},W0(J.options));return}}if($==="thinking-depth"||$==="thinkingDepth"){if(I==="set"){let Q=B(J.options.default)??B(J.options.level)??q;if(Q!=="medium"&&Q!=="high")throw Error("Usage: seal-use preference thinking-depth set --default <medium|high>");await O0("seal_preference_thinking_depth_set",U,Y,{defaultLevel:Q,dryRun:L0(J.options.dryRun)??L0(J.options["dry-run"])},W0(J.options));return}if(I==="policies"){if(z==="list"||!z){await O0("seal_preference_thinking_depth_policies_list",U,Y,{},W0(J.options));return}if(z==="upsert"){let Q=B(J.options.input),w=Q?JSON.parse(JD0(Q,"utf8")):J$(J.json);if(!w||!w.id||!w.name)throw Error(`Usage:seal-usepreferencethinking-depthpoliciesupsert--json'{"id":"...","name":"...","level":"high"}'`);await O0("seal_preference_thinking_depth_policies_upsert",U,Y,{...w,dryRun:L0(J.options.dryRun)??L0(J.options["dry-run"])},W0(J.options));return}if(z==="remove"||z==="delete"){let Q=q??B(J.options.id)??B(J.options.policyId);if(!Q)throw Error("Usage: seal-use preference thinking-depth policies remove <policyId>");await O0("seal_preference_thinking_depth_policies_remove",U,Y,{policyId:Q,dryRun:L0(J.options.dryRun)??L0(J.options["dry-run"])},W0(J.options));return}}}throw Error(`Unknownpreferenceaction:${$??""}.Available:get,decisionupdate,thinking-depthset,thinking-depthpolicieslist/upsert/remove.`)}async function wD0($={}){let I=q$(),z=Y4(),q=v7(I,{stateful:z.stateful,defaultCorpId:z.defaultCorpId,corpId:$.corpId},o5());console.log(`[probe]corp=${q.id}source=${q.source.type}`);let U=await pU(q);console.log("[probe] seal enterprise"),console.log(JSON.stringify(U,null,2));let Y=await G1(q),J=await XW(Y,{documentLimit:20,stylePreferencesEndpoint:q.seal.endpoints.approvalStylePreferences});console.log("[probe] approval context summary"),console.log(JSON.stringify({rules:J.rules.rules.length,hasPendingRuleDeletes:J.rules.hasPendingDeletes,documents:J.documents.articles.length,documentsTotal:J.documents.total,stylePreferences:J.stylePreferences.ok?"ok":`error:${J.stylePreferences.error}`},null,2))}async function KD0($,I,z){let q=I??B(z.options.corp)??($&&$!=="--corp"?$:void 0);await wD0({corpId:q})}async function jx($,I,z,q,U){if($==="count"){await O0("seal_approval_rules_list",z,q,{countOnly:!0},W0(U.options));return}if($==="list"){if(L0(U.options.count)){await O0("seal_approval_rules_list",z,q,{countOnly:!0},W0(U.options));return}let Y=y0(U.options.limit),J=y0(U.options.offset);if(L0(U.options.summary)){await O0("seal_approval_rules_list",z,q,{fields:tZ0,limit:Y,offset:J},W0(U.options));return}let Q=await AI("seal_approval_rules_list",z,q,{limit:Y,offset:J});aZ0(Q,L0(U.options.full)===!0),E0(Q);return}if($==="clear"){let Y=L0(U.options.yes)===!0,J=L0(U.options.dryRun)??L0(U.options["dry-run"])??!Y;if(!Y&&!J)throw $5("Refusing to clear rules without --yes. Use --dry-run to preview.",`seal-userulesclear--corp${q.id}--dry-run`);let Q=await AI("seal_approval_rules_clear",z,q,{dryRun:J,recode:L0(U.options.recode)});if(!Y&&J&&Q&&typeof Q==="object"){E0({...Q,nextCommand:`seal-userulesclear--corp${q.id}--yes`},W0(U.options));return}E0(Q,W0(U.options));return}if($==="versions"){await O0("seal_approval_rule_versions_list",z,q,{},W0(U.options));return}if($==="version"){let Y=I??B(U.options.version);if(!Y)throw Error("Usage: seal-use rules version <versionId|versionNumber|l
Line truncated
`).filter(Boolean),Y=U.slice(-I);return{logFile:z,lines:Y,totalLines:U.length}}async function vW1($){let I=VF($),z=Rx($),q=bw($);VD0($.stateDir);let U=$.port??(process.env.PORT?Number.parseInt(process.env.PORT,10):QF),Y=$.host??(process.env.HOST?process.env.HOST:wF);GF(I,`${process.pid}
`,{mode:384}),GF(z,JSON.stringify({pid:process.pid,port:U,host:Y,version:$.version,startedAt:new Date().toISOString()},null,2),{mode:384}),cU(q,`servicestartingonhttp://${Y}:${U} pid=${process.pid}`);let J=null;try{J=await KF({port:U,host:Y,silent:!0}),cU(q,`service listening pid=${process.pid}`)}catch(w){if(cU(q,`service failed to bind port ${U}: ${w instanceof Error?w.message:String(w)}`),WF(I)===process.pid)U5(I,{force:!0}),U5(z,{force:!0});throw w}let Q=()=>{if(J)J.close(),J=null;if(WF(I)===process.pid)U5(I,{force:!0}),U5(z,{force:!0});cU(q,`stopped pid=${process.pid}`)};await new Promise((w)=>{let K=!1,H=()=>{if(K)return;K=!0,Q(),process.off("SIGTERM",H),process.off("SIGINT",H),w()};process.once("SIGTERM",H),process.once("SIGINT",H)})}function HD0($){VD0($.stateDir);let I=dU($);if(I.running)return I;let z=$.launcher??{command:process.execPath,args:[$.entryFile]},q=[...z.args??[],"service","run"];if($.port)q.push("--port",String($.port));if($.host)q.push("--host",String($.host));let U=TW1(z.command,q,{cwd:$.appRoot,detached:!0,stdio:["ignore","ignore","ignore"],env:process.env});U.unref();let Y=VF($);return GF(Y,`${U.pid}
`,{flag:"a",mode:384})}var _x=_W1(RW1(),".config","seal-use");async function Cx($,I,z){let q=z?y0(z.options.port)??y0(z.options.p):void 0,U=z?B(z.options.host)??B(z.options.h):void 0,Y=z?y0(z.options.lines)??y0(z.options.n):void 0,J=await TI($,{appRoot:I.appRoot,entryFile:I.entryFile,stateDir:_x,version:e0,launcher:I.launcher,port:q,host:U},{maxLines:Y});if(J!==void 0)E0(J)}import{existsSync as CW1,readFileSync as ZD0}from"node:fs";async function XD0($,I,z,q,U){if($==="batch-records"||$==="records"){let Y=I??B(U.options.batchId)??B(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation batch-records <batchId>");await O0("seal_simulation_batch_records_get",z,q,{batchId:Y,query:B(U.options.query)},W0(U.options));return}if($==="create"||$==="run"){let Y=B(U.options.mode)??B(U.options.sourceSystem)??B(U.options["source-system"])??"hosecloud",J=Y==="material-pack"?"material_pack":Y,Q=B(U.options.schemaConfig)??B(U.options["schema-config"]),w=Q?JSON.parse(ZD0(Q,"utf8")):void 0,K=B(U.options.input),H=K?JSON.parse(ZD0(K,"utf8")):J$(U.json),G=B(U.options.packageId)??B(U.options["package-id"]),W=V6(U.options.packageIds)??V6(U.options["package-ids"])??(G?[G]:void 0),V=V6(U.options.flowIds)??V6(U.options["flow-ids"])??V6(U.options.documentSn)??V6(U.options["document-sn"]),X=B(U.options.signKey)??B(U.options["sign-key"])??B(U.options.integration),L=L0(U.options.noWait)??L0(U.options["no-wait"]);await O0("seal_simulation_batch_create",z,q,{mode:J,sourceSystem:J,flowIds:V,documentSn:V,rejectNodeName:B(U.options.rejectNode)??B(U.options["reject-node"])??null,thinkingDepthOverride:B(U.options.thinkingDepth)??B(U.options["thinking-depth"]),skipInvoiceGeneration:L0(U.options.skipInvoiceGeneration)??L0(U.options["skip-invoice-generation"]),skipExpenseExtraction:L0(U.options.skipExpenseExtraction)??L0(U.options["skip-expense-extraction"]),disableAttachmentCache:L0(U.options.disableAttachmentCache)??L0(U.options["disable-attachment-cache"]),signKey:X,packageIds:W,packageId:G,templateId:B(U.options.templateId)??B(U.options["template-id"]),schemaConfig:w,requestIds:V6(U.options.requestIds)??V6(U.options["request-ids"]),workflowTypeId:B(U.options.workflowTypeId)??B(U.options["workflow-type-id"]),flowStatusList:V6(U.options.flowStatusList)?.map(Number)??V6(U.options["flow-status-list"])?.map(Number),businessCodes:V6(U.options.businessCodes)??V6(U.options["business-codes"]),documentType:B(U.options.documentType)??B(U.options["document-type"]),startTime:y0(U.options.startTime)??y0(U.options["start-time"]),endTime:y0(U.options.endTime)??y0(U.options["end-time"]),status:V6(U.options.status),limit:y0(U.options.limit),noWait:L,rawParams:H},W0(U.options));return}if($==="wait"){let Y=I??B(U.options.batchId)??B(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation wait <batchId> [--timeout 10m] [--poll-interval 2s]");await O0("seal_simulation_batch_wait",z,q,{batchId:Y,timeout:B(U.options.timeout),pollInterval:B(U.options.pollInterval)??B(U.options["poll-interval"])},W0(U.options));return}if($==="status"){let Y=I??B(U.options.batchId)??B(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation status <batchId>");await O0("seal_simulation_batch_status",z,q,{batchId:Y},W0(U.options));return}if($==="clean"||$==="delete"){let Y=I??B(U.options.batchId)??B(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation clean <batchId>");await O0("seal_simulation_batch_clean",z,q,{batchId:Y},W0(U.options));return}if($==="specifications"){let Y=I??B(U.options.integration)??B(U.options.signKey)??B(U.options["sign-key"]);await O0("seal_simulation_specifications_list",z,q,{signKey:Y},W0(U.options));return}if($==="approval-definitions"||$==="definitions"){await O0("seal_simulation_feishu_approval_definitions_list",z,q,{},W0(U.options));return}if($==="list"){await O0("seal_simulation_batches_list",z,q,{limit:y0(U.options.limit)},W0(U.options));return}if($==="get"){let Y=I??B(U.options.batchId)??B(U.options["batch-id"]);if(!Y)throw Error("Usage: seal-use simulation get <batchId>");await O0("seal_simulation_batch_get",z,q,{batchId:Y},W0(U.options));return}if($==="templates"){await O0("seal_simulation_templates_get",z,q,{},W0(U.options));return}if($==="integrations"){await O0("seal_simulation_integrations_get",z,q,{},W0(U.options));return}if($==="package-upload"){let Y=I??B(U.options.file);if(!Y)throw Error("Usage: seal-use simulation package-upload <材料包.zip>");if(!CW1(Y))throw Error(`Filenotfound:${Y}`);await O0("seal_simulation_material_package_upload",z,q,{filePath:Y},W0(U.options));return}throw Error(`Unknownsimulationcommand:${$??""}.Run'seal-use help'foravailablecommands.`)}import{existsSync as LD0}from"node:fs";import{join as ZF}from"node:path";function DD0($,I,z){if($==="dump"||$==="cat"||$==="show"){process.stdout.write(`${dL0()}
`);return}if($==="install"||$==="init"||$==="sync"){let q=L0(z.options.local)||L0(z.options.workspace),U=B(z.options.dir)??B(z.options.target)??I,Y=U?U:q?ZF(process.cwd(),".agents","skills","seal-use"):PI(),J=Dx(Y);E0({installed:!0,targetDir:J.targetDir,fileCount:J.files.length,files:J.files});return}if($==="status"||$==="get"||!$){let q=PI(),U=ZF(process.cwd(),".agents","skills","seal-use");E0({global:{dir:q,installed:LD0(ZF(q,"SKILL.md"))},local:{dir:U,installed:LD0(ZF(U,"SKILL.md"))}});return}throw Error(`Unknownskillcommand:${$}.Run'seal-use help'foravailablecommands.`)}async function FD0($,I){if($==="config"){E0(await pU(I));return}throw Error(`Unknownsourcecommand:${$??""}.Run'seal-use help'foravailablecommands.`)}async function OD0($,I,z,q){if(!$)throw Error("Usage: seal-use tool <toolName> [--json '{...}']");await O0($,I,z,J$(q.json),W0(q.options))}function ND0(){E0(gw.map(($)=>({name:$.name,description:$.description})))}import{chmodSync as hW1,mkdirSync as SW1,renameSync as hx,rmSync as yW1,unlinkSync as ED0,writeFileSync as MD0}from"node:fs";import{dirname as uW1,join as AD0}from"node:path";import{spawnSync as EI}from"node:child_process";function XF($=process.execPath,I=import.meta.url){if(I.includes("/$bunfs/")||I.includes("\\$bunfs\\"))return!0;let z=$.toLowerCase().replace(/\\/g,"/");return!z.endsWith("/bun")&&!z.endsWith("/bun.exe")&&!z.endsWith("/node")&&!z.endsWith("/node.exe")}var BD0="yunyingk/seal-use",pw="yunyingk/seal-home";var xW1="SEAL_USE_GITHUB_REPO",kW1="SEAL_HOME_GITHUB_REPO";async function jD0($,I={}){let z={appRoot:$.appRoot,entryFile:$.entryFile,stateDir:_x,version:e0,launcher:$.launcher},q=I.repo||process.env[xW1]?.trim()||process.env[kW1]?.trim()||BD0,U=I.targetVersion?.trim(),Y=U&&U.toLowerCase()!=="latest"?U:void 0;if(Y){let M=Y.replace(/^v/,""),j=vD0(M,e0);if(j<0)if(!QB&&I.force);else{E0({updated:!1,currentVersion:e0,targetVersion:M,mode:XF()?"binary":"source",message:!QB?`Cannotdowngradeseal-usefromdevbuildv${e0}toreleasev${M}.Use--forcetooverwrite.`:`Cannotdowngradeseal-usefromv${e0}toolderversionv${M}.Updatesmustbeforward-only.`});return}if(j===0&&!I.force){E0({updated:!1,currentVersion:e0,targetVersion:M,mode:XF()?"binary":"source",message:`seal-useisalreadyatversionv${e0}.Use--forcetoreinstall.`});return}}if(I.changelogOnly){let M=await Sx(q,I.limit??10);E0({currentVersion:e0,totalQueried:M.length,releases:M.map((j)=>({version:j.version,tagName:j.tagName,publishedAt:j.publishedAt,author:j.author,releaseNotes:j.notes,releaseUrl:j.htmlUrl,isCurrent:j.version===e0,isNewer:iw(j.version,e0)}))});return}if(!XF()){if(I.checkOnly){let j=await Sx(q,30),u=j[0],h=u?.version??e0,x=j.find((i)=>i.version===e0),g=iw(h,e0),p=j.filter((i)=>iw(i.version,e0));E0({updated:!1,updateAvailable:g,currentVersion:e0,currentVersionPublishedAt:x?.publishedAt,latestVersion:h,latestVersionPublishedAt:u?.publishedAt,behindCount:p.length,pendingReleases:p.map((i)=>({version:i.version,tagName:i.tagName,publishedAt:i.publishedAt,author:i.author,releaseNotes:i.notes,releaseUrl:i.htmlUrl})),releaseNotes:u?.notes??"",releaseUrl:u?.htmlUrl??"",mode:"source",message:"Running in source development mode. Run 'seal-use update' to git pull & bun install."});return}let M=dU(z).running;if(M)await TI("stop",z);try{TD0("git",["-C",$.appRoot,"pull","--ff-only"])}catch(j){console.error(`gitpullskipped:${jinstanceofError?j.message:String(j)}`)}if(TD0("bun",["install"],{cwd:$.appRoot}),M)await TI("start",z);E0({updated:!0,serviceRestarted:M,version:e0,mode:"source"});return}let J=fW1(),Q=nW1(),w=await Sx(q,30),K=Y?w.find((M)=>M.version===Y||M.tagName===Y||M.tagName===`v${Y}`)??await PD0(q,Y):w[0]??await PD0(q);if(!K){E0({updated:!1,currentVersion:e0,mode:"binary",message:`Failedtoqueryreleasesfromrepository'${q}'`});return}let H=K.version,G=w.find((M)=>M.version===e0),W=iw(H,e0),V=W||Boolean(I.force),X=w.filter((M)=>iw(M.version,e0));if(I.checkOnly){E0({updated:!1,updateAvailable:W,currentVersion:e0,currentVersionPublishedAt:G?.publishedAt,latestVersion:H,latestVersionPublishedAt:K.publishedAt,behindCount:X.length,pendingReleases:X.map((M)=>({version:M.version,tagName:M.tagName,publishedAt:M.publishedAt,author:M.author,releaseNotes:M.notes,releaseUrl:M.htmlUrl})),releaseNotes:K.notes,releaseUrl:K.htmlUrl,mode:"binary"});return}if(!V){E0({updated:!1,currentVersion:e0,currentVersionPublishedAt:G?.publishedAt,latestVersion:H,latestVersionPublishedAt:K.publishedAt,mode:"binary",message:`seal-useisalreadyuptodate(v${e0})`});return}let L=bW1(K.assets,J,Q);if(!L)throw Error(`Nocompatiblebinaryfoundfor${J}-${Q}inreleasev${H}.Availableassets:${K.assets.map((M)=>M.name).join(", ")}`);let D=dU(z).running;if(D)await TI("stop",z);let F=process.execPath,T=uW1(F),P=AD0(T,`.tmp-update-${Date.now()}`);SW1(P,{recursive:!0});try{let M=AD0(P,L.name);await iW1(L.downloadUrl,M,K.tagName,L.name);let j=M;if(L.name.endsWith(".tar.gz")||L.name.endsWith(".tgz"))j=pW1
Line truncated
`)}catch{}}async function iW1($,I,z,q){let U=yx(),Y=[],J=z?z.startsWith("v")?z:`v${z}`:void 0,Q=q||$.split("/").pop()||"";if(U!=="github"){if(J&&Q)Y.push(`https://git.ying-qing.cn/gitea/seal-use/releases/download/${J}/${Q}`,`https://git.ying-qing.cn/gitea/seal-home/releases/download/${J}/${Q}`);if($.startsWith("https://git.ying-qing.cn"))Y.push($)}if(U!=="gitea")if(J&&Q){let L=`https://github.com/${BD0}/releases/download/${J}/${Q}`;if(!process.env.CI)Y.push(`https://ghfast.top/${L}`,`https://gh.ddlc.top/${L}`);Y.push(L)}else if($.includes("github.com")){if(!process.env.CI)Y.push(`https://ghfast.top/${$}`,`https://gh.ddlc.top/${$}`);Y.push($)}else Y.push($);let w=Array.from(new Set(Y)),K,H=6000,G=6000,W=307200,V=1e4,X=180000;for(let L=0;L<w.length;L++){let D=w[L],F=new AbortController,T="",P=(h)=>{T=h;try{F.abort()}catch{}},M=setTimeout(()=>{P("Connection timed out (no response headers within 6s)")},H),j,u;try{LF(`==> [${L+1}/${w.length}] Downloading via: ${D}`);let h=await fetch(D,{signal:F.signal});if(M)clearTimeout(M),M=void 0;if(!h.ok)throw Error(`HTTP ${h.status} ${h.statusText}`);j=setTimeout(()=>{P("Overall download time exceeded 3 minutes")},X);let x=Number(h.headers.get("content-length"))||0,g=h.body?.getReader();if(!g){let b=Buffer.from(await h.arrayBuffer());if(b.length<1000)throw Error(`Downloaded content is suspiciously small (${b.length} bytes)`);MD0(I,b),LF(`✓ Download succeeded (${(b.length/1024/1024).toFixed(1)} MB)`);return}let p=[],i=0,S=0;u=setTimeout(()=>{if(i<W){let b=(i/1024).toFixed(1);P(`Initial transfer too slow (${b} KB < 300 KB in 6s), switching mirror...`)}},G);while(!0){let b=g.read(),z0,v=new Promise((U0,G0)=>{z0=setTimeout(()=>{G0(Error("Data transfer stalled (no chunk received for 10s)"))},V)}),n;try{n=await Promise.race([b,v])}finally{if(z0)clearTimeout(z0)}let{done:c,value:r}=n;if(c)break;if(r){if(p.push(r),i+=r.length,u&&i>=W)clearTimeout(u),u=void 0;let U0=Date.now();if(U0-S>200){S=U0;let G0=x?Math.round(i/x*100):0,A0=(i/1048576).toFixed(1),g0=x?(x/1048576).toFixed(1):"?";try{process.stderr.write(`\r ↳ Progress: ${G0}% (${A0} / ${g0} MB)...`)}catch{}}}}try{process.stderr.write(`
- User-facing 合思 authorization link (合思/易快报授权): `seal-use auth hose-link --corp <corpId> --expire 7200`; read `references/hose-enterprise-auth.md`. Never use this route when the user says Seal 协助. Always provide BOTH a code block (` ```text ... ``` `) AND a hyperlink.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.