gdx 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -20
- package/dist/index.js +536 -388
- package/package.json +9 -8
package/dist/index.js
CHANGED
|
@@ -1,93 +1,87 @@
|
|
|
1
|
-
import{createRequire as tK}from"node:module";var iK=Object.create;var{getPrototypeOf:nK,defineProperty:eZ,getOwnPropertyNames:aK}=Object;var oK=Object.prototype.hasOwnProperty;var Y7=(Y,Z,Q)=>{Q=Y!=null?iK(nK(Y)):{};let X=Z||!Y||!Y.__esModule?eZ(Q,"default",{value:Y,enumerable:!0}):Q;for(let J of aK(Y))if(!oK.call(X,J))eZ(X,J,{get:()=>Y[J],enumerable:!0});return X};var N0=(Y,Z)=>()=>(Z||Y((Z={exports:{}}).exports,Z),Z.exports);var sK=(Y,Z)=>{for(var Q in Z)eZ(Y,Q,{get:Z[Q],enumerable:!0,configurable:!0,set:(X)=>Z[Q]=()=>X})};var i5=(Y,Z)=>()=>(Y&&(Z=Y(Y=0)),Z);var b0=tK(import.meta.url);var O3=N0((mL,N3)=>{N3.exports=w3;w3.sync=rH;var T3=b0("fs");function tH(Y,Z){var Q=Z.pathExt!==void 0?Z.pathExt:process.env.PATHEXT;if(!Q)return!0;if(Q=Q.split(";"),Q.indexOf("")!==-1)return!0;for(var X=0;X<Q.length;X++){var J=Q[X].toLowerCase();if(J&&Y.substr(-J.length).toLowerCase()===J)return!0}return!1}function _3(Y,Z,Q){if(!Y.isSymbolicLink()&&!Y.isFile())return!1;return tH(Z,Q)}function w3(Y,Z,Q){T3.stat(Y,function(X,J){Q(X,X?!1:_3(J,Y,Z))})}function rH(Y,Z){return _3(T3.statSync(Y),Y,Z)}});var A3=N0((uL,k3)=>{k3.exports=E3;E3.sync=eH;var P3=b0("fs");function E3(Y,Z,Q){P3.stat(Y,function(X,J){Q(X,X?!1:C3(J,Z))})}function eH(Y,Z){return C3(P3.statSync(Y),Z)}function C3(Y,Z){return Y.isFile()&&Yz(Y,Z)}function Yz(Y,Z){var{mode:Q,uid:X,gid:J}=Y,$=Z.uid!==void 0?Z.uid:process.getuid&&process.getuid(),G=Z.gid!==void 0?Z.gid:process.getgid&&process.getgid(),K=parseInt("100",8),H=parseInt("010",8),W=parseInt("001",8),z=K|H,q=Q&W||Q&H&&J===G||Q&K&&X===$||Q&z&&$===0;return q}});var j3=N0((pL,I3)=>{var dL=b0("fs"),Z4;if(process.platform==="win32"||global.TESTING_WINDOWS)Z4=O3();else Z4=A3();I3.exports=U7;U7.sync=Zz;function U7(Y,Z,Q){if(typeof Z==="function")Q=Z,Z={};if(!Q){if(typeof Promise!=="function")throw TypeError("callback not provided");return new Promise(function(X,J){U7(Y,Z||{},function($,G){if($)J($);else X(G)})})}Z4(Y,Z||{},function(X,J){if(X){if(X.code==="EACCES"||Z&&Z.ignoreErrors)X=null,J=!1}Q(X,J)})}function Zz(Y,Z){try{return Z4.sync(Y,Z||{})}catch(Q){if(Z&&Z.ignoreErrors||Q.code==="EACCES")return!1;else throw Q}}});var b3=N0((cL,h3)=>{var _6=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",x3=b0("path"),Qz=_6?";":":",S3=j3(),y3=(Y)=>Object.assign(Error(`not found: ${Y}`),{code:"ENOENT"}),v3=(Y,Z)=>{let Q=Z.colon||Qz,X=Y.match(/\//)||_6&&Y.match(/\\/)?[""]:[..._6?[process.cwd()]:[],...(Z.path||process.env.PATH||"").split(Q)],J=_6?Z.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",$=_6?J.split(Q):[""];if(_6){if(Y.indexOf(".")!==-1&&$[0]!=="")$.unshift("")}return{pathEnv:X,pathExt:$,pathExtExe:J}},f3=(Y,Z,Q)=>{if(typeof Z==="function")Q=Z,Z={};if(!Z)Z={};let{pathEnv:X,pathExt:J,pathExtExe:$}=v3(Y,Z),G=[],K=(W)=>new Promise((z,q)=>{if(W===X.length)return Z.all&&G.length?z(G):q(y3(Y));let V=X[W],R=/^".*"$/.test(V)?V.slice(1,-1):V,B=x3.join(R,Y),M=!R&&/^\.[\\\/]/.test(Y)?Y.slice(0,2)+B:B;z(H(M,W,0))}),H=(W,z,q)=>new Promise((V,R)=>{if(q===J.length)return V(K(z+1));let B=J[q];S3(W+B,{pathExt:$},(M,T)=>{if(!M&&T)if(Z.all)G.push(W+B);else return V(W+B);return V(H(W,z,q+1))})});return Q?K(0).then((W)=>Q(null,W),Q):K(0)},Xz=(Y,Z)=>{Z=Z||{};let{pathEnv:Q,pathExt:X,pathExtExe:J}=v3(Y,Z),$=[];for(let G=0;G<Q.length;G++){let K=Q[G],H=/^".*"$/.test(K)?K.slice(1,-1):K,W=x3.join(H,Y),z=!H&&/^\.[\\\/]/.test(Y)?Y.slice(0,2)+W:W;for(let q=0;q<X.length;q++){let V=z+X[q];try{if(S3.sync(V,{pathExt:J}))if(Z.all)$.push(V);else return V}catch(R){}}}if(Z.all&&$.length)return $;if(Z.nothrow)return null;throw y3(Y)};h3.exports=f3;f3.sync=Xz});var m3=N0((lL,q7)=>{var g3=(Y={})=>{let Z=Y.env||process.env;if((Y.platform||process.platform)!=="win32")return"PATH";return Object.keys(Z).reverse().find((X)=>X.toUpperCase()==="PATH")||"Path"};q7.exports=g3;q7.exports.default=g3});var c3=N0((iL,p3)=>{var u3=b0("path"),Jz=b3(),$z=m3();function d3(Y,Z){let Q=Y.options.env||process.env,X=process.cwd(),J=Y.options.cwd!=null,$=J&&process.chdir!==void 0&&!process.chdir.disabled;if($)try{process.chdir(Y.options.cwd)}catch(K){}let G;try{G=Jz.sync(Y.command,{path:Q[$z({env:Q})],pathExt:Z?u3.delimiter:void 0})}catch(K){}finally{if($)process.chdir(X)}if(G)G=u3.resolve(J?Y.options.cwd:"",G);return G}function Gz(Y){return d3(Y)||d3(Y,!0)}p3.exports=Gz});var l3=N0((zz,B7)=>{var V7=/([()\][%!^"`<>&|;, *?])/g;function Kz(Y){return Y=Y.replace(V7,"^$1"),Y}function Hz(Y,Z){if(Y=`${Y}`,Y=Y.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),Y=Y.replace(/(?=(\\+?)?)\1$/,"$1$1"),Y=`"${Y}"`,Y=Y.replace(V7,"^$1"),Z)Y=Y.replace(V7,"^$1");return Y}zz.command=Kz;zz.argument=Hz});var n3=N0((nL,i3)=>{i3.exports=/^#!(.*)/});var o3=N0((aL,a3)=>{var qz=n3();a3.exports=(Y="")=>{let Z=Y.match(qz);if(!Z)return null;let[Q,X]=Z[0].replace(/#! ?/,"").split(" "),J=Q.split("/").pop();if(J==="env")return X;return X?`${J} ${X}`:J}});var t3=N0((oL,s3)=>{var F7=b0("fs"),Vz=o3();function Bz(Y){let Q=Buffer.alloc(150),X;try{X=F7.openSync(Y,"r"),F7.readSync(X,Q,0,150,0),F7.closeSync(X)}catch(J){}return Vz(Q.toString())}s3.exports=Bz});var ZQ=N0((sL,YQ)=>{var Fz=b0("path"),r3=c3(),e3=l3(),Rz=t3(),Mz=process.platform==="win32",Dz=/\.(?:com|exe)$/i,Lz=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Tz(Y){Y.file=r3(Y);let Z=Y.file&&Rz(Y.file);if(Z)return Y.args.unshift(Y.file),Y.command=Z,r3(Y);return Y.file}function _z(Y){if(!Mz)return Y;let Z=Tz(Y),Q=!Dz.test(Z);if(Y.options.forceShell||Q){let X=Lz.test(Z);Y.command=Fz.normalize(Y.command),Y.command=e3.command(Y.command),Y.args=Y.args.map(($)=>e3.argument($,X));let J=[Y.command].concat(Y.args).join(" ");Y.args=["/d","/s","/c",`"${J}"`],Y.command=process.env.comspec||"cmd.exe",Y.options.windowsVerbatimArguments=!0}return Y}function wz(Y,Z,Q){if(Z&&!Array.isArray(Z))Q=Z,Z=null;Z=Z?Z.slice(0):[],Q=Object.assign({},Q);let X={command:Y,args:Z,options:Q,file:void 0,original:{command:Y,args:Z}};return Q.shell?X:_z(X)}YQ.exports=wz});var JQ=N0((tL,XQ)=>{var R7=process.platform==="win32";function M7(Y,Z){return Object.assign(Error(`${Z} ${Y.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${Z} ${Y.command}`,path:Y.command,spawnargs:Y.args})}function Nz(Y,Z){if(!R7)return;let Q=Y.emit;Y.emit=function(X,J){if(X==="exit"){let $=QQ(J,Z);if($)return Q.call(Y,"error",$)}return Q.apply(Y,arguments)}}function QQ(Y,Z){if(R7&&Y===1&&!Z.file)return M7(Z.original,"spawn");return null}function Oz(Y,Z){if(R7&&Y===1&&!Z.file)return M7(Z.original,"spawnSync");return null}XQ.exports={hookChildProcess:Nz,verifyENOENT:QQ,verifyENOENTSync:Oz,notFoundError:M7}});var KQ=N0((rL,w6)=>{var $Q=b0("child_process"),D7=ZQ(),L7=JQ();function GQ(Y,Z,Q){let X=D7(Y,Z,Q),J=$Q.spawn(X.command,X.args,X.options);return L7.hookChildProcess(J,X),J}function Pz(Y,Z,Q){let X=D7(Y,Z,Q),J=$Q.spawnSync(X.command,X.args,X.options);return J.error=J.error||L7.verifyENOENTSync(J.status,X),J}w6.exports=GQ;w6.exports.spawn=GQ;w6.exports.sync=Pz;w6.exports._parse=D7;w6.exports._enoent=L7});import{createRequire as EF}from"module";class Z${value;start;end;constructor(Y,Z,Q){this.value=Y,this.start=Z,this.end=Q}}class I2{TF;IDF;TF_IDF;constructor(Y){this.TF=Y}}class Q${x;y;z;r;t;get unit(){return this.#Z}get dimension(){return this.#Q}#Z;#Q=0;constructor(Y,Z,Q=null){if(this.x=Y,this.y=Z,this.z=Q,Q)this.#Q=3;else if(Z)this.#Q=2;else if(Y)this.#Q=1}toPolarCoords(Y="r"){this.#Z=Y;let{r:Z,t:Q}=F.MathKit.toPolarCoords(this.x,this.y,Y);return this.r=Z,this.t=Q,this}toCartesianCoords(){if(!this.#Z&&this.x)return this;let{x:Y,y:Z}=F.MathKit.toCartesianCoords(this.r,this.t,this.#Z);return this.x=Y,this.y=Z,this}setUnit(Y){if(!Y||Y!="d"&&Y!="r")throw Error("unit must be 'r' or 'd', given: "+Y);if(this.#Z==Y)return;if(Y=="r")this.#Z=Y,this.t=F.MathKit.radians(this.t);else this.#Z=Y,this.t=F.MathKit.degrees(this.t)}}class X${constructor(Y,Z,Q,X,J,$,G){this.x=Y,this.y=Z,this.f=Q,this.ymid=X,this.iterations=J,this.events=G,this.msg=$}_at(Y,Z){function Q(R){return R*R}let X,J,$,G,K,H,W,z,q,V;return X=this.x[Z],J=this.x[Z+1],G=this.y[Z],K=this.y[Z+1],W=J-X,$=X+0.5*W,H=this.ymid[Z],z=this.f[Z]-G*(1/(X-$)+2/(X-J)),q=this.f[Z+1]-K*(1/(J-$)+2/(J-X)),V=[Q(Y-J)*(Y-$)/Q(X-J)/(X-$),Q(Y-X)*Q(Y-J)/Q(X-$)/Q(J-$),Q(Y-X)*(Y-$)/Q(J-X)/(J-$),(Y-X)*Q(Y-J)*(Y-$)/Q(X-J)/(X-$),(Y-J)*Q(Y-X)*(Y-$)/Q(X-J)/(J-$)],G*V[0]+H*V[1]+K*V[2]+z*V[3]+q*V[4]}at(Y){let Z,Q,X;if(typeof Y!=="number"){let $=Y.length,G=Array($);for(Z=$-1;Z!==-1;--Z)G[Z]=this.at(Y[Z]);return G}let J=this.x;Z=0,Q=J.length-1;while(Q-Z>1)if(X=Math.floor(0.5*(Z+Q)),J[X]<=Y)Z=X;else Q=X;return this._at(Y,Z)}}class JY{value;index;type;constructor(Y,Z,Q=-1){this.value=Y,this.type=Z,this.index=Q}valueOf(){return this.value}toString(){return this.value.toString()}}class y6{type;UPID=null;callback;constructor(Y,Z,Q=null){if(Q)this.type=1,this.UPID=Q;else this.type=Y;this.callback=Z}}function AF(Y){return Y==null||typeof Y=="number"||typeof Y=="string"||typeof Y=="boolean"||Y instanceof ArrayBuffer||Y instanceof MessagePort||Y instanceof ReadableStream||Y instanceof WritableStream||Y instanceof TransformStream}var CF,S6,kF,XY,A2="[#*0-9]\\uFE0F?\\u20E3|©\\uFE0F?|[®\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9\\u21AA]\\uFE0F?|[\\u231A\\u231B]|[\\u2328\\u23CF]\\uFE0F?|[\\u23E9-\\u23EC]|[\\u23ED-\\u23EF]\\uFE0F?|\\u23F0|[\\u23F1\\u23F2]\\uFE0F?|\\u23F3|[\\u23F8-\\u23FA\\u24C2\\u25AA\\u25AB\\u25B6\\u25C0\\u25FB\\u25FC]\\uFE0F?|[\\u25FD\\u25FE]|[\\u2600-\\u2604\\u260E\\u2611]\\uFE0F?|[\\u2614\\u2615]|\\u2618\\uFE0F?|\\u261D(?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?|[\\u2620\\u2622\\u2623\\u2626\\u262A\\u262E\\u262F\\u2638-\\u263A\\u2640\\u2642]\\uFE0F?|[\\u2648-\\u2653]|[\\u265F\\u2660\\u2663\\u2665\\u2666\\u2668\\u267B\\u267E]\\uFE0F?|\\u267F|\\u2692\\uFE0F?|\\u2693|[\\u2694-\\u2697\\u2699\\u269B\\u269C\\u26A0]\\uFE0F?|\\u26A1|\\u26A7\\uFE0F?|[\\u26AA\\u26AB]|[\\u26B0\\u26B1]\\uFE0F?|[\\u26BD\\u26BE\\u26C4\\u26C5]|\\u26C8\\uFE0F?|\\u26CE|[\\u26CF\\u26D1\\u26D3]\\uFE0F?|\\u26D4|\\u26E9\\uFE0F?|\\u26EA|[\\u26F0\\u26F1]\\uFE0F?|[\\u26F2\\u26F3]|\\u26F4\\uFE0F?|\\u26F5|[\\u26F7\\u26F8]\\uFE0F?|\\u26F9(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\uFE0F(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\u26FA\\u26FD]|\\u2702\\uFE0F?|\\u2705|[\\u2708\\u2709]\\uFE0F?|[\\u270A\\u270B](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\u270C\\u270D](?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?|\\u270F\\uFE0F?|[\\u2712\\u2714\\u2716\\u271D\\u2721]\\uFE0F?|\\u2728|[\\u2733\\u2734\\u2744\\u2747]\\uFE0F?|[\\u274C\\u274E\\u2753-\\u2755\\u2757]|\\u2763\\uFE0F?|\\u2764(?:\\u200D(?:\\uD83D\\uDD25|\\uD83E\\uDE79)|\\uFE0F(?:\\u200D(?:\\uD83D\\uDD25|\\uD83E\\uDE79))?)?|[\\u2795-\\u2797]|\\u27A1\\uFE0F?|[\\u27B0\\u27BF]|[\\u2934\\u2935\\u2B05-\\u2B07]\\uFE0F?|[\\u2B1B\\u2B1C\\u2B50\\u2B55]|[\\u3030\\u303D\\u3297\\u3299]\\uFE0F?|\\uD83C(?:[\\uDC04\\uDCCF]|[\\uDD70\\uDD71\\uDD7E\\uDD7F]\\uFE0F?|[\\uDD8E\\uDD91-\\uDD9A]|\\uDDE6\\uD83C[\\uDDE8-\\uDDEC\\uDDEE\\uDDF1\\uDDF2\\uDDF4\\uDDF6-\\uDDFA\\uDDFC\\uDDFD\\uDDFF]|\\uDDE7\\uD83C[\\uDDE6\\uDDE7\\uDDE9-\\uDDEF\\uDDF1-\\uDDF4\\uDDF6-\\uDDF9\\uDDFB\\uDDFC\\uDDFE\\uDDFF]|\\uDDE8\\uD83C[\\uDDE6\\uDDE8\\uDDE9\\uDDEB-\\uDDEE\\uDDF0-\\uDDF5\\uDDF7\\uDDFA-\\uDDFF]|\\uDDE9\\uD83C[\\uDDEA\\uDDEC\\uDDEF\\uDDF0\\uDDF2\\uDDF4\\uDDFF]|\\uDDEA\\uD83C[\\uDDE6\\uDDE8\\uDDEA\\uDDEC\\uDDED\\uDDF7-\\uDDFA]|\\uDDEB\\uD83C[\\uDDEE-\\uDDF0\\uDDF2\\uDDF4\\uDDF7]|\\uDDEC\\uD83C[\\uDDE6\\uDDE7\\uDDE9-\\uDDEE\\uDDF1-\\uDDF3\\uDDF5-\\uDDFA\\uDDFC\\uDDFE]|\\uDDED\\uD83C[\\uDDF0\\uDDF2\\uDDF3\\uDDF7\\uDDF9\\uDDFA]|\\uDDEE\\uD83C[\\uDDE8-\\uDDEA\\uDDF1-\\uDDF4\\uDDF6-\\uDDF9]|\\uDDEF\\uD83C[\\uDDEA\\uDDF2\\uDDF4\\uDDF5]|\\uDDF0\\uD83C[\\uDDEA\\uDDEC-\\uDDEE\\uDDF2\\uDDF3\\uDDF5\\uDDF7\\uDDFC\\uDDFE\\uDDFF]|\\uDDF1\\uD83C[\\uDDE6-\\uDDE8\\uDDEE\\uDDF0\\uDDF7-\\uDDFB\\uDDFE]|\\uDDF2\\uD83C[\\uDDE6\\uDDE8-\\uDDED\\uDDF0-\\uDDFF]|\\uDDF3\\uD83C[\\uDDE6\\uDDE8\\uDDEA-\\uDDEC\\uDDEE\\uDDF1\\uDDF4\\uDDF5\\uDDF7\\uDDFA\\uDDFF]|\\uDDF4\\uD83C\\uDDF2|\\uDDF5\\uD83C[\\uDDE6\\uDDEA-\\uDDED\\uDDF0-\\uDDF3\\uDDF7-\\uDDF9\\uDDFC\\uDDFE]|\\uDDF6\\uD83C\\uDDE6|\\uDDF7\\uD83C[\\uDDEA\\uDDF4\\uDDF8\\uDDFA\\uDDFC]|\\uDDF8\\uD83C[\\uDDE6-\\uDDEA\\uDDEC-\\uDDF4\\uDDF7-\\uDDF9\\uDDFB\\uDDFD-\\uDDFF]|\\uDDF9\\uD83C[\\uDDE6\\uDDE8\\uDDE9\\uDDEB-\\uDDED\\uDDEF-\\uDDF4\\uDDF7\\uDDF9\\uDDFB\\uDDFC\\uDDFF]|\\uDDFA\\uD83C[\\uDDE6\\uDDEC\\uDDF2\\uDDF3\\uDDF8\\uDDFE\\uDDFF]|\\uDDFB\\uD83C[\\uDDE6\\uDDE8\\uDDEA\\uDDEC\\uDDEE\\uDDF3\\uDDFA]|\\uDDFC\\uD83C[\\uDDEB\\uDDF8]|\\uDDFD\\uD83C\\uDDF0|\\uDDFE\\uD83C[\\uDDEA\\uDDF9]|\\uDDFF\\uD83C[\\uDDE6\\uDDF2\\uDDFC]|\\uDE01|\\uDE02\\uFE0F?|[\\uDE1A\\uDE2F\\uDE32-\\uDE36]|\\uDE37\\uFE0F?|[\\uDE38-\\uDE3A\\uDE50\\uDE51\\uDF00-\\uDF20]|[\\uDF21\\uDF24-\\uDF2C]\\uFE0F?|[\\uDF2D-\\uDF35]|\\uDF36\\uFE0F?|[\\uDF37-\\uDF7C]|\\uDF7D\\uFE0F?|[\\uDF7E-\\uDF84]|\\uDF85(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDF86-\\uDF93]|[\\uDF96\\uDF97\\uDF99-\\uDF9B\\uDF9E\\uDF9F]\\uFE0F?|[\\uDFA0-\\uDFC1]|\\uDFC2(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDFC3\\uDFC4](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDFC5\\uDFC6]|\\uDFC7(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDFC8\\uDFC9]|\\uDFCA(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDFCB\\uDFCC](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\uFE0F(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDFCD\\uDFCE]\\uFE0F?|[\\uDFCF-\\uDFD3]|[\\uDFD4-\\uDFDF]\\uFE0F?|[\\uDFE0-\\uDFF0]|\\uDFF3(?:\\u200D(?:\\u26A7\\uFE0F?|\\uD83C\\uDF08)|\\uFE0F(?:\\u200D(?:\\u26A7\\uFE0F?|\\uD83C\\uDF08))?)?|\\uDFF4(?:\\u200D\\u2620\\uFE0F?|\\uDB40\\uDC67\\uDB40\\uDC62\\uDB40(?:\\uDC65\\uDB40\\uDC6E\\uDB40\\uDC67|\\uDC73\\uDB40\\uDC63\\uDB40\\uDC74|\\uDC77\\uDB40\\uDC6C\\uDB40\\uDC73)\\uDB40\\uDC7F)?|[\\uDFF5\\uDFF7]\\uFE0F?|[\\uDFF8-\\uDFFF])|\\uD83D(?:[\\uDC00-\\uDC07]|\\uDC08(?:\\u200D\\u2B1B)?|[\\uDC09-\\uDC14]|\\uDC15(?:\\u200D\\uD83E\\uDDBA)?|[\\uDC16-\\uDC3A]|\\uDC3B(?:\\u200D\\u2744\\uFE0F?)?|[\\uDC3C-\\uDC3E]|\\uDC3F\\uFE0F?|\\uDC40|\\uDC41(?:\\u200D\\uD83D\\uDDE8\\uFE0F?|\\uFE0F(?:\\u200D\\uD83D\\uDDE8\\uFE0F?)?)?|[\\uDC42\\uDC43](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC44\\uDC45]|[\\uDC46-\\uDC50](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC51-\\uDC65]|[\\uDC66\\uDC67](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC68(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?|[\\uDC68\\uDC69]\\u200D\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?)|[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92])|\\uD83E[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFC-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFD-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFD\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFE]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?))?|\\uDC69(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?[\\uDC68\\uDC69]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?|\\uDC69\\u200D\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?)|[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92])|\\uD83E[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFC-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB\\uDFFD-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFD\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFE]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?))?|\\uDC6A|[\\uDC6B-\\uDC6D](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC6E(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDC6F(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|[\\uDC70\\uDC71](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDC72(?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC73(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDC74-\\uDC76](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC77(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDC78(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC79-\\uDC7B]|\\uDC7C(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC7D-\\uDC80]|[\\uDC81\\uDC82](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDC83(?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC84|\\uDC85(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC86\\uDC87](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDC88-\\uDC8E]|\\uDC8F(?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC90|\\uDC91(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC92-\\uDCA9]|\\uDCAA(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDCAB-\\uDCFC]|\\uDCFD\\uFE0F?|[\\uDCFF-\\uDD3D]|[\\uDD49\\uDD4A]\\uFE0F?|[\\uDD4B-\\uDD4E\\uDD50-\\uDD67]|[\\uDD6F\\uDD70\\uDD73]\\uFE0F?|\\uDD74(?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?|\\uDD75(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\uFE0F(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDD76-\\uDD79]\\uFE0F?|\\uDD7A(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD87\\uDD8A-\\uDD8D]\\uFE0F?|\\uDD90(?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?|[\\uDD95\\uDD96](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDDA4|[\\uDDA5\\uDDA8\\uDDB1\\uDDB2\\uDDBC\\uDDC2-\\uDDC4\\uDDD1-\\uDDD3\\uDDDC-\\uDDDE\\uDDE1\\uDDE3\\uDDE8\\uDDEF\\uDDF3\\uDDFA]\\uFE0F?|[\\uDDFB-\\uDE2D]|\\uDE2E(?:\\u200D\\uD83D\\uDCA8)?|[\\uDE2F-\\uDE34]|\\uDE35(?:\\u200D\\uD83D\\uDCAB)?|\\uDE36(?:\\u200D\\uD83C\\uDF2B\\uFE0F?)?|[\\uDE37-\\uDE44]|[\\uDE45-\\uDE47](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDE48-\\uDE4A]|\\uDE4B(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDE4C(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDE4D\\uDE4E](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDE4F(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDE80-\\uDEA2]|\\uDEA3(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDEA4-\\uDEB3]|[\\uDEB4-\\uDEB6](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDEB7-\\uDEBF]|\\uDEC0(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDEC1-\\uDEC5]|\\uDECB\\uFE0F?|\\uDECC(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDECD-\\uDECF]\\uFE0F?|[\\uDED0-\\uDED2\\uDED5-\\uDED7]|[\\uDEE0-\\uDEE5\\uDEE9]\\uFE0F?|[\\uDEEB\\uDEEC]|[\\uDEF0\\uDEF3]\\uFE0F?|[\\uDEF4-\\uDEFC\\uDFE0-\\uDFEB])|\\uD83E(?:\\uDD0C(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD0D\\uDD0E]|\\uDD0F(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD10-\\uDD17]|[\\uDD18-\\uDD1C](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDD1D|[\\uDD1E\\uDD1F](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD20-\\uDD25]|\\uDD26(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDD27-\\uDD2F]|[\\uDD30-\\uDD34](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDD35(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDD36(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD37-\\uDD39](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDD3A|\\uDD3C(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|[\\uDD3D\\uDD3E](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDD3F-\\uDD45\\uDD47-\\uDD76]|\\uDD77(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD78\\uDD7A-\\uDDB4]|[\\uDDB5\\uDDB6](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDDB7|[\\uDDB8\\uDDB9](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDDBA|\\uDDBB(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDDBC-\\uDDCB]|[\\uDDCD-\\uDDCF](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDDD0|\\uDDD1(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD]))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFC-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB\\uDFFD-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFD\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFE]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?))?|[\\uDDD2\\uDDD3](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDDD4(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDDD5(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDDD6-\\uDDDD](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDDDE\\uDDDF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|[\\uDDE0-\\uDDFF\\uDE70-\\uDE74\\uDE78-\\uDE7A\\uDE80-\\uDE86\\uDE90-\\uDEA8\\uDEB0-\\uDEB6\\uDEC0-\\uDEC2\\uDED0-\\uDED6])",F,KA,J$,HA,zA,WA,$$,UA,qA,I1,VA,BA,FA,RA,MA,DA,LA,TA,_A,wA,NA,OA,X0,PA,EA,CA,kA,AA,IA,jA,xA,SA,yA,v6,vA,fA,hA,bA,gA,mA,uA,dA,pA,cA,G$,lA,iA,nA,aA,oA,K$,M0,H$,U,sA,tA,rA,eA,YI,z$,ZI,QI,XI,JI,$I,GI,KI,HI,zI,WI,UI,qI,VI,BI,FI,RI,f6,MI,W$,DI,LI,TI,_I,a,wI,NI,OI,PI,EI,$Y,CI,kI,s;var Y0=i5(()=>{CF=EF(import.meta.url),S6=typeof window>"u"||typeof process<"u",kF={dgram:null,worker_threads:null,os:null,fs:null,mathjs:null},XY={consoleTimeInstances:null};F={_modules:kF,arrFindLast(Y,Z){for(let Q=Y.length-1;Q>=0;Q--)if(Z(Y[Q],Q,Y))return Y[Q];return},arrToString(Y,Z={}){let{maxDepth:Q=4,indent:X=3,maxRow:J=10,maxCol:$=20,color:G=!1,defColor:K=void 0,noHeader:H=!1}=Z;if(Q<1)Q=1;let W={color:G,defColor:K},z=F.getDimensions(Y,"max"),q=z.length*0.4,V=typeof X=="number"?" ".repeat(X):X,R=null;if(G)R={magenta:F.ncc(11550650),gray:F.ncc(4802889),_default:F.ncc(K)};if(!H&&(!(Y instanceof Array)||z.length>2||Math.max(...z)>5))return T(Y)+B(Y,0);else return B(Y,0);function B(D,_,w=0){let N="";if(_>Q-1)if(G)return R.gray+`... [${M(D)||"Array"}]`+R._default;else return`... [${M(D)||"Array"}]`;if(!F.isArrayLike(D))return N+F.yuString(D,W);let j;if(_>q)j=F.getDimensions(D,"max");else j=z.slice(_);let x=z[_+1]!=null&&(j[2]!=null||j[1]>2)&&_<Q-1,f=w?V.repeat(w):"",m=f+V,b=x?`[
|
|
2
|
-
`+
|
|
3
|
-
`+
|
|
4
|
-
`+
|
|
5
|
-
`+
|
|
6
|
-
`);else Z=
|
|
7
|
-
`),Z=
|
|
8
|
-
`),
|
|
9
|
-
expected length: ${
|
|
10
|
-
actual length: ${
|
|
11
|
-
Name: `,
|
|
12
|
-
Code: `,
|
|
13
|
-
Stack: `,X)$+=F.ncc(5592405)+Z.stack+F.ncc(J);else $+=Z.stack;return $}},escapeRegExp(Y){return Y.replace(/[[\]{}.*$^|\-?+,:\\]/g,"\\$&")},ex_length(Y,Z=0){if(typeof Y!=="string")throw TypeError("argument must be a string");if(Z<0)return Y.length;Y=F.cleanString(Y);let Q=Y.length;if(Z<1)return Q;let X=Y;for(let K of F.CONSTS.UNICODES_RANGE_TABLE){if(!K.type.endsWith("full"))continue;X=X.replace(K.regex,"")}let J=Q+(Q-X.length);if(Z<2)return J;let $=Y.match(F.REGEXP.EmojiEach)??[],G=$.reduce((K,H)=>K+H.length,0);return $.length*2+(J-G)},fileNameCleaner(Y,Z="_"){if(!Y||typeof Y!="string")throw Error("the given `rawName` isn't a string");return Y.trim().replace(/[|/*\\<>"?:]/g,Z)},fixFilePath(Y,Z="_"){if(!Y||!Y?.length)throw"path is either falsy or empty!";return Y.replace(/[:?"<>|*]/g,Z)},fixYTurl(Y){if(Y=Y||void 0,!Y)throw"url can't be falsy!!";if(Y.includes("youtu.be"))Y=Y.replace("https://youtu.be/","https://www.youtube.com/watch?v=");if(Y.includes("&list="))Y=Y.split("&list=")[0];if(Y.includes("?si="))Y=Y.split("?si=")[0];if(Y.includes("https")==!1)Y="https://www."+Y;return Y},fileTypeOf(Y){let Z=Y.slice(Y.lastIndexOf(".")+1).toLowerCase(),Q=Z=="jpg"||Z=="png"||Z=="svg"||Z=="jfif"||Z=="pbm"||Z=="pgm"||Z=="jpeg",X=Z=="txt"||Z=="bat"||Z=="text"||Z=="md"||Z=="json"||Z=="step"||Z=="js"||Z=="cs"||Z=="cpp"||Z=="gitignore"||Z=="java"||Z=="py"||Z=="config"||Z=="cfg"||Z=="ts"||Z=="env",J=Z=="exe"||Z=="vpk"||Z=="qc"||Z=="smd"||Z=="vmt"||Z=="vtf"||Z=="zip"||Z=="7z"||Z=="bin"||Z=="ipynb"||Z=="pyc"||Z=="jar",$=Z=="aiff"||Z=="aif"||Z=="aifc"||Z=="flac"||Z=="mp3"||Z=="mp4"||Z=="mp4a"||Z=="m4a"||Z=="mkv"||Z=="mov"||Z=="wav"||Z=="gif"||Z=="webm";if(Q)return"image";else if(X)return"text";else if(J)return"binary";else if($)return"media";return null},getMatchAllIndexes(Y){if(!Y)return[];let Z=[];for(let Q of Y)Z.push(Q.index);return Z},getMatchAllResults(Y){if(!Y)return[];let Z=[];for(let Q of Y)Z.push(new Z$(Q[0],Q.index,Q.index+Q[0].length));return Z},getRandomInt(Y,Z){return Math.round(Math.random()*(Z-Y)+Y)},getProcessTime(){let Y=process.hrtime();return Y[0]*1000+Y[1]/1e6},hyperLink(Y,Z){if(Z=encodeURI(Z),!F.CheckCache.supportsHyperlink)return Z;return`\x1B]8;;${Z}\x07${Y}\x1B]8;;\x07`},IDGenerator(Y=null,Z="CCNNNN"){let Q=!1,X=Z.length,J=new F.SafeTrue;while(J.True){let $=Array(X);for(let G=0;G<X;G++)switch(Z[G]){case"C":{let K=F.getRandomInt(65,116);if(K>90)K+=6;$[G]=String.fromCharCode(K);continue}case"N":$[G]=F.getRandomInt(0,9).toString();continue;case"B":{let K=F.getRandomInt(48,109);if(K>57&&K<84)K+=7;else if(K>83)K+=13;$[G]=String.fromCharCode(K);continue}default:$[G]=Z[G];break}if(Y){if(Y instanceof Set)Q=Y.has($);else Q=Y.includes($);if(!Q)return $.join("")}else return $.join("")}return null},includesWord(Y,Z,Q=!1){if(!Q)Z=Z.toLowerCase(),Y=Y.toLowerCase();Z=Z.padStart(Z.length+1," ").padEnd(Z.length+2," ");let X=Z.search(Y);if(X!==-1){let J=Z.substring(X-1),$=Z.substring(X+Y.length);if(J.search(F.REGEXP.Seperators)==0&&$.search(F.REGEXP.Seperators)==0)return!0}return!1},IPC:class Y{static Listener=y6;#Z;#Q=new Map;#Y;#X=!1;#J=new Set;peersAddress="localhost";peersPort;listenPort;get protocol(){return this.#Y}constructor(Z="udp4",Q={}){if(!S6)throw Error("IPC is only available on JSRuntime, due to the use of Node modules");let{peersPort:X=null,peersAddress:J=null,listenPort:$=null}=typeof Q=="number"?{listenPort:Q}:Q;if(Z!="nodeworker"&&Z!="udp4"&&Z!="udp6")throw Error(`protocol must be 'nodeworker', 'udp4' or 'udp6' instead given '${Z}'`);if(this.#Y=Z,!F._modules.dgram&&Z!="nodeworker")throw Error(`module 'dgram' not loaded use 'Tools._modules.dgram = require("dgram")' to load it`);if(Z=="nodeworker"){if(!F._modules.worker_threads)throw Error(`module 'worker_threads' not loaded use 'Tools._modules.worker_threads = require("worker_threads")' to load it`);if(!$){if(F._modules.worker_threads.isMainThread)throw Error("when using `nodeworker` protocol, `port` must be provided if on the main thread");this.#Z=F._modules.worker_threads.parentPort,this.#$();return}if(!($ instanceof F._modules.worker_threads.Worker)&&$!==F._modules.worker_threads.parentPort&&$!=null)throw Error(`port must be a type of 'Worker' or a 'parentPort' instead given '${typeof $}'`);this.#Z=$,this.#$();return}if(!X)throw Error("peersPort must be provided for `udp4` or `udp6` protocol");this.listenPort=$,this.peersAddress=J,this.peersPort=X,this.#Z=F._modules.dgram.createSocket(Z),this.#$()}async#$(){if(this.#Z.on("message",this.#G),this.protocol=="nodeworker")return;if(!this.listenPort)return;try{this.#Z.bind(this.listenPort),this.#X=!0}catch(Z){switch(Z.code){case"ERR_SOCKET_BAD_PORT":throw new F.Err(`Tools.IPC: port ${this.listenPort} is not valid`,"IPC_ERR_SOCKET_BAD_PORT",Z.code,Z.stack);case"EADDRINUSE":throw new F.Err(`Tools.IPC: port ${this.listenPort} is already in use`,"IPC_EADDRINUSE",Z.code,Z.stack);default:throw F.Err.from(Z,"IPC_BIND_ERROR").message=`Tools.IPC: failed to bind port ${this.listenPort} `+Z.message}}}bind(Z,Q){if(this.protocol=="nodeworker")return;if(this.peersAddress=Z,this.listenPort=Q,!this.#X)this.#$();return this}close(){if(this.protocol=="nodeworker")return;this.#Z.close()}async advSend(Z,Q){return new Promise((X,J)=>{if(!Z)throw Error("channel must be provided");if(typeof Z!="string")throw Error(`channel must be a type of 'string' instead given '${typeof Z}'`);let{contents:$,UPID:G}=Q;if(!($ instanceof Array))$=[$];let K;try{K=this.protocol=="nodeworker"?{channel:Z,UPID:G,contents:$.map((H)=>{if(AF(H))return H;return"@JSON:"+JSON.stringify(H,F.JSONReplacer)})}:Buffer.from(JSON.stringify({channel:Z,UPID:G,contents:$},F.JSONReplacer))}catch(H){J(F.Err.from(H,"IPC_SERIALIZE_ERROR").message="Tools.IPC: failed to serialize payload,"+H.message);return}if(this.protocol=="nodeworker"){this.#Z.postMessage(K),X();return}this.#Z.send(K,this.peersPort,this.peersAddress,(H)=>{if(H)J(H);X()})})}async send(Z,...Q){return this.advSend(Z,{contents:Q})}on(Z,Q){let X=this.#Q.get(Z);if(!X){this.#Q.set(Z,[new y6(0,Q)]);return}return X.push(new y6(0,Q)),this}once(Z,Q,X=null){let J=this.#Q.get(Z);if(!J){this.#Q.set(Z,[new y6(1,Q,X)]);return}return J.push(new y6(1,Q,X)),this}remove(Z){if(typeof Z=="string")return this.#Q.delete(Z),!0;if(typeof Z!="function")throw Error(`listener must be a type of 'string' or 'function' instead given '${typeof Z}'`);for(let[Q,X]of this.#Q){let J=X.find((G)=>G.callback==Z);if(!J)continue;if(!X.filter((G)=>G.callback!=Z))return this.#Q.delete(Q),!0;return this.#Q.set(Q,X.filter((G)=>G.callback!=J)),!0}return!1}async ask(Z,Q,...X){return new Promise((J,$)=>{let G;if(Q)G=setTimeout(()=>{$(new F.Err(`Tools.IPC: ask timeout on channel: ${Z}`,"IPCAskTimeout"))},Q);let K=this.#K();this.once(Z,(H)=>{if(Q)clearTimeout(G);J(H)},K),this.advSend(Z,{contents:X,UPID:K})})}onAsk(Z,Q){let X=this,J=async function(...$){X.#J.add(this.UPID);let G=await Q(...$);X.advSend(Z,{contents:[G],UPID:this.UPID}),X.#J.delete(this.UPID)};return this.on(Z,J),this}#G=(Z)=>{let Q;try{Q=this.protocol=="nodeworker"?{channel:Z.channel,UPID:Z.UPID,contents:Z.contents.map((J)=>{if(typeof J=="string"&&J.startsWith("@JSON:"))return JSON.parse(J.slice(6),F.JSONReviver);return J})}:JSON.parse(Z.toString(),F.JSONReviver)}catch(J){throw F.Err.from(J,"IPC_DESERIALIZE_ERROR").message="Tools.IPC: failed to deserialize payload,"+J.message}let X=this.#Q.get(Q.channel);if(!X)return;for(let J of X){if(J.UPID){if(J.UPID!=Q.UPID)continue;this.#J.delete(J.UPID)}if(J.callback.call(Q,...Q.contents),J.type==1||J.UPID)this.remove(J.callback)}};#K(){let Z=F.IDGenerator(this.#J,"BBBBBBBB");return this.#J.add(Z),Z}},isArrayLike(Y){let Z=Y?.length;return Array.isArray(Y)||!!Y&&Z!=null&&typeof Y==="object"&&typeof Z==="number"&&(Z===0||Z>0&&(Z-1 in Y))},isArrowFunction(Y){if(typeof Y!=="function")return!1;if(Object.hasOwnProperty.call(Y,"prototype"))return!1;try{return Y.arguments,!1}catch{}return Y.toString().slice(0,20).includes("=>")},isAsyncFunction(Y){if(typeof Y!=="function")return!1;if(Y.constructor?.name==="AsyncFunction")return!0;return(Y instanceof F.CONSTS.AsyncFunction&&F.CONSTS.AsyncFunction!==Function&&F.CONSTS.AsyncFunction!==F.CONSTS.GeneratorFunction)===!0},isClass:(Y)=>{if(typeof Y!=="function")return!1;return Y.toString().startsWith("class")},isNumber:(Y)=>{return/^[0-9]+$|^[0-9]+\\.[0-9]+$/.test(Y)},isEmptyArray:(Y)=>F.isArrayLike(Y)&&!Y.length,isEmptyObject:(Y)=>!F.isArrayLike(Y)&&Y instanceof Object&&!F.propertiesCount(Y),isError(Y){return F.Err.isError(Y)},isValidFilePath(Y){if(!Y||!Y?.length)return!1;if(/[:?"<>|*]/g.test(Y))return!1;return!0},JSONReplacer(Y,Z){if(Z instanceof Map)return{"@dataType":"Map","@value":Array.from(Z.entries())};if(Z instanceof Set)return{"@dataType":"Set","@value":Array.from(Z.values())};switch(typeof Z){case"function":return{"@dataType":"function","@value":Z.toString().replace(/\n* {2,}|\n/g,"")};case"bigint":return{"@dataType":"BigInt","@value":Z.toString()};case"object":for(let Q in Z)if(Z[Q]instanceof Date)Z[Q]={"@dataType":"Date","@value":Z[Q].valueOf()};return Z}return Z},JSONReviver(Y,Z){if(!Z||!Z["@dataType"])return Z;switch(Z["@dataType"]){case"function":return Function("return "+Z["@value"])();case"BigInt":return BigInt(Z["@value"]);case"Map":return new Map(Z["@value"]);case"Set":return new Set(Z["@value"]);case"Date":return new Date(Z["@value"])}return Z},jsTime:{howLong(Y,Z=new Date){let Q=Z.getTime()-Y.getTime();return F.jsTime.getTimeFromMS(Q).modern()},getTimeFromMS(Y){let Z=0,Q=0,X=0,J=0,$=0,G=0,K=Y>262800200;while(Y>=1000)Y-=1000,G++;while(G>=60)G-=60,$++;while($>=60)$-=60,J++;if(K){while(J>=24)J-=24,X++;while(X>=30.4167)X-=30.4167,Q++;X=Math.round(X);while(Q>=12)Q-=12,Z++}if(K)return{year:Z,month:Q,days:X,hr:J,min:$,sec:G,ms:Y,toString(){return`${Z}:${Q}:${X}|${J}:${$}:${G}.${Y.toString().padStart(3,"0")}`},modern(){if(Z+Q+X+G+$+J==0)return`${Y}ms`;else if(Z+Q+X+$+J==0)return`${G}.${Y}s`;else if(Z+Q+X+J==0)return`${$}min ${G}s`;else if(Z+Q+X==0)return`${J}hr ${$}min`;else if(Z+Q==0)return`${X}days ${J}hr`;else if(Z==0)return`${Q}months ${X}days`;else return`${Z}year ${Q}months`}};return{year:Z,month:Q,days:X,hr:J,min:$,sec:G,ms:Y,toString(){return`${J}:${$}:${G}.${Y.toString().padStart(3,"0")}`},modern(){if(G+$+J==0)return`${Y}ms`;else if($+J==0)return`${G}.${Y}s`;else if(J==0)return`${$}min ${G}s`;else return`${J}hr ${$}min`}}}},lazySplit:function*(Y,Z){if(Z===""){for(let J of Y)yield J;return}let Q=0,X;while((X=Y.indexOf(Z,Q))!==-1)yield Y.substring(Q,X),Q=X+Z.length;yield Q?Y.substring(Q):Y},remap(Y,Z){if(Y instanceof Map){let X=new Map;for(let[J,$]of Y){let G=Z(J,$,X);if(G===void 0)continue;if(G===null)X.set(J,$);if(G.key===void 0)X.set(J,G);if(X.set(G.key,G.value),G.key!==J&&X.has(J))X.delete(J)}return X}let Q={};for(let X in Y){let J=Z(X,Y[X],Q);if(J===void 0)continue;if(J===null){Q[X]=Y[X];continue}if(J.key===void 0){Q[X]=J;continue}if(Q[J.key]=J.value,J.key!==X&&Q[X]!==void 0)delete Q[X]}return Q},MathKit:{clamp(Y,Z,Q){return Math.min(Math.max(Y,Z),Q)},degrees(Y){return Y*180/Math.PI},distanceFrom(Y,Z){let Q=Z.x-Y.x,X=Z.y-Y.y,J=Z.z-Y.z;return Math.sqrt(Q**2+(isNaN(X)?0:X**2)+(isNaN(J)?0:J**2))},dopri(Y,Z,Q,X,J=0.000001,$=1000,G){let K=[Y],H=[Q],W=[X(Y,Q)],z,q,V,R,B,M,T=[],D=0.2,_=[0.075,0.225],w=[0.9777777777777777,-3.7333333333333334,3.5555555555555554],N=[2.9525986892242035,-11.595793324188385,9.822892851699436,-0.2908093278463649],j=[2.8462752525252526,-10.757575757575758,8.906422717743473,0.2784090909090909,-0.2735313036020583],x=[0.09114583333333333,0,0.44923629829290207,0.6510416666666666,-0.322376179245283,0.13095238095238096],f=[0.10013431883002395,0,0.3918321794184259,-0.02982460176594817,0.05893268337240795,-0.04497888809104361,0.023904308236133973],m=[0.2,0.3,0.8,0.8888888888888888,1,1],b=[-0.0012326388888888888,0,0.0042527702905061394,-0.03697916666666667,0.05086379716981132,-0.0419047619047619,0.025],v=0,d,o,y=(Z-Y)/10,B0=0,w0,M6,q0,_0,xY,F0=new X$(K,H,W,T,-1,"");if(typeof G==="function")q0=G(Y,Q);while(Y<Z&&B0<$){if(++B0,Y+y>Z)y=Z-Y;if(z=X(Y+m[0]*y,Q+D*y*W[v]),q=X(Y+m[1]*y,Q+_[0]*y*W[v]+_[1]*y*z),V=X(Y+m[2]*y,Q+w[0]*y*W[v]+w[1]*y*z+w[2]*y*q),R=X(Y+m[3]*y,Q+N[0]*y*W[v]+N[1]*y*z+N[2]*y*q+N[3]*y*V),B=X(Y+m[4]*y,Q+j[0]*y*W[v]+j[1]*y*z+j[2]*y*q+j[3]*y*V+j[4]*y*R),w0=Q+W[v]*y*x[0]+q*y*x[2]+V*y*x[3]+R*y*x[4]+B*y*x[5],M=X(Y+y,w0),d=W[v]*y*b[0]+q*y*b[2]+V*y*b[3]+R*y*b[4]+B*y*b[5]+M*y*b[6],M6=Math.abs(d),M6>J){if(y=0.2*y*Math.pow(J/M6,0.25),Y+y===Y){F0.msg="Step size became too small";break}continue}if(T[v]=Q+W[v]*y*f[0]+q*y*f[2]+V*y*f[3]+R*y*f[4]+B*y*f[5]+M*y*f[6],++v,K[v]=Y+y,H[v]=w0,W[v]=M,typeof G==="function"){let SY,yY=Y,S0=Y+0.5*y,r;if(_0=G(S0,T[v-1]),xY=q0<0&&0<_0,xY){let R0,u8,d8=0,vY=1,fY=1;while(!0){if(typeof q0==="number")r=(fY*_0*yY-vY*q0*S0)/(fY*_0-vY*q0);else{r=S0;for(o=q0.length-1;o!==-1;--o)if(q0[o]<0&&_0[o]>0)r=Math.min(r,(fY*_0[o]*yY-vY*q0[o]*S0)/(fY*_0[o]-vY*q0[o]))}if(r<=yY||r>=S0)break;if(SY=F0._at(r,v-1),u8=G(r,SY),R0=q0<0&&0<u8,R0){if(S0=r,_0=u8,xY=R0,fY=1,d8===-1)vY*=0.5;else vY=1;d8=-1}else{if(yY=r,q0=u8,vY=1,d8===1)fY*=0.5;else fY=1;d8=1}}return w0=F0._at(0.5*(Y+r),v-1),F0.f[v]=X(r,SY),F0.x[v]=r,F0.y[v]=SY,F0.ymid[v-1]=w0,F0.events=xY,F0.iterations=B0,F0}yY=S0,S0=Y+y,q0=_0,_0=G(S0,w0),xY=q0<0&&0<_0}Y+=y,Q=w0,q0=_0,y=Math.min(0.8*y*Math.pow(J/M6,0.25),4*y)}return F0.iterations=B0,F0},integral(Y,Z,Q){if(Q>Z)throw Error("lower bound must be less than upper bound");if(Q==Z)return 0;if(!F._modules.mathjs)throw Error(`module 'mathjs' not loaded use 'Tools._modules.mathjs = require("mathjs")' to load it`);let X;if(typeof Y=="string")X=F._modules.mathjs.compile(Y);else X=Y;if(typeof Q=="string")Q=F._modules.mathjs.evaluate(Q);if(typeof Z=="string")Z=F._modules.mathjs.evaluate(Z);let J=($)=>X.evaluate({x:$});return F.MathKit.dopri(Q,Z,0,J).at(Z)},lerp(Y,Z,Q){return Y+(Z-Y)*Q},Lsh_us(Y,Z){return Y*2**Z},not_us16(Y){return Y^65535},not_us32(Y){return Y^4294967295},not_us8(Y){return Y^255},map(Y,Z,Q,X,J){return Y=F.MathKit.clamp(Y,Z,Q),(Y-Z)/(Q-Z)*(J-X)+X},Point:Q$,radians(Y){return Y*Math.PI/180},Rsh_us(Y,Z){return Math.floor(Y/2**Z)},sum:(...Y)=>{return Y.flat(5).reduce((Z,Q)=>Z+Q,0)},toPolarCoords(Y,Z,Q="r"){if(!Q||Q!="d"&&Q!="r")throw Error("unit must be 'r' or 'd', given: "+Q);let X=Math.atan(Z/Y);if(Z<0&&Y<0)X+=360;else if(Y<0)X+=180;return{r:Math.sqrt(Y**2+Z**2),t:Q=="d"?X:F.MathKit.radians(X)}},toCartesianCoords(Y,Z,Q=null,X="r"){if(!X||X!="d"&&X!="r")throw Error("unit must be 'r' or 'd', given: "+X);if(Q!==null&&typeof Q!="number")throw Error("polar must be a number");if(X=="d"){if(Z=F.MathKit.radians(Z),Q!==null)Q=F.MathKit.radians(Q)}if(Q===null)return{x:Y*Math.cos(Z),y:Y*Math.sin(Z)};else return{x:Y*Math.sin(Q)*Math.cos(Z),y:Y*Math.sin(Q)*Math.sin(Z),z:Y*Math.cos(Q)}}},maxFraction(Y,Z,Q=!1){let X=Y.toString();if(!X.includes("."))return X;let J=10**Z;return Y=(Q?Math.floor(Y*J):Math.round(Y*J))/J,Y.toString()},ncc(Y=null,Z=null,Q=null){if(F.CheckCache.supportsColor===0)return"";if(Y==null)return"\x1B[0m";if(typeof Y=="number"){let J=F.Convert.decimalColorToRGB(Y);switch(Q?1:F.CheckCache.supportsColor){default:return"";case 1:Y=(Z=="bg"?"bg":"")+F.Convert.basicColorFromRgb(J);case 2:{let G=F.Convert._8bitColorFromRgb(J);return`\x1B[${Z=="bg"?"4":"3"}8;5;${G}m`}case 3:return`\x1B[${Z=="bg"?"4":"3"}8;2;${J.r};${J.g};${J.b}m`}}return Y=Y.toLowerCase(),{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",blink:"\x1B[5m",invert:"\x1B[7m",hidden:"\x1B[8m",normal:"\x1B[22m",bgblack:"\x1B[40m",bgred:"\x1B[41m",bggreen:"\x1B[42m",bgyellow:"\x1B[43m",bgblue:"\x1B[44m",bgmagenta:"\x1B[45m",bgcyan:"\x1B[46m",bgwhite:"\x1B[47m"}[Y]||"\x1B[37m"},nearestNumber(Y,Z){let Q=1/0,X=null;for(let J=0,$=Y[J];J<Y.length;){let G=Math.abs(Z-$);if(!G)return J;if(G<Q)Q=G,X=J;$=Y[++J]}return X},objectMap(Y,Z){return F.remap(Y,Z)},objValueAt(Y,Z){return Y[Object.keys(Y).at(Z)]},objToString(Y,Z={}){let{maxDepth:Q=4,indent:X=3,maxKeys:J=20,color:$=!1,defColor:G=void 0,noHeader:K=!1}=Z;if(Q<1)Q=1;let H={color:$,defColor:G},W=typeof X=="number"?" ".repeat(X):X,z=null;if($)z={cyan:F.ncc(4764610),magenta:F.ncc(11550650),gray:F.ncc(4802889),yellow:F.ncc(12754962),_default:F.ncc(G)};if(Y==null||typeof Y!=="object")return F.yuString(Y,H);if(F.isArrayLike(Y))return F.arrToString(Y,{color:$,defColor:G,maxDepth:Q,indent:X});if(Y instanceof Map||Y instanceof Set||Y instanceof Promise||Y instanceof Date||Y instanceof RegExp)return F.yuString(Y,H);if(F.isError(Y))return F.Err.toString(Y,{color:$,defColor:G});let q=Y.constructor?.name||"Object",V=q!=="Object",B=Object.keys(Y).length,M="";if(!K&&(V||B>5))if($)M=z.magenta+`${q}(${B}) `+z._default;else M=`${q}(${B}) `;return M+T(Y,0);function T(D,_,w=0){if(_>Q-1)if($)return z.gray+"... {Object}"+z._default;else return"... {Object}";if(D==null)return F.yuString(D,H);if(typeof D!=="object"||D instanceof Date||D instanceof RegExp)return F.yuString(D,H);if(F.isArrayLike(D))return F.arrToString(D,{color:$,defColor:G,maxDepth:Q-_,indent:X,noHeader:!0});if(D instanceof Map||D instanceof Set)return F.yuString(D,H);let N=Object.keys(D),j=N.length;if(j===0)return"{}";let x=j>3||_>0,f=w?W.repeat(w):"",m=f+W,b=x?`{
|
|
14
|
-
`+
|
|
15
|
-
`+
|
|
16
|
-
`+
|
|
17
|
-
`+
|
|
18
|
-
`+
|
|
19
|
-
`),["","\r"]),G={},
|
|
1
|
+
import{createRequire as TB}from"node:module";var RB=Object.create;var{getPrototypeOf:MB,defineProperty:o2,getOwnPropertyNames:DB}=Object;var LB=Object.prototype.hasOwnProperty;var s2=(Y,Z,Q)=>{Q=Y!=null?RB(MB(Y)):{};let J=Z||!Y||!Y.__esModule?o2(Q,"default",{value:Y,enumerable:!0}):Q;for(let X of DB(Y))if(!LB.call(J,X))o2(J,X,{get:()=>Y[X],enumerable:!0});return J};var h0=(Y,Z)=>()=>(Z||Y((Z={exports:{}}).exports,Z),Z.exports);var r2=(Y,Z)=>{for(var Q in Z)o2(Y,Q,{get:Z[Q],enumerable:!0,configurable:!0,set:(J)=>Z[Q]=()=>J})};var F=(Y,Z)=>()=>(Y&&(Z=Y(Y=0)),Z);var HY=TB(import.meta.url);import{createRequire as _B}from"module";class YX{value;start;end;constructor(Y,Z,Q){this.value=Y,this.start=Z,this.end=Q}}class e2{TF;IDF;TF_IDF;constructor(Y){this.TF=Y}}class ZX{x;y;z;r;t;get unit(){return this.#Z}get dimension(){return this.#Q}#Z;#Q=0;constructor(Y,Z,Q=null){if(this.x=Y,this.y=Z,this.z=Q,Q)this.#Q=3;else if(Z)this.#Q=2;else if(Y)this.#Q=1}toPolarCoords(Y="r"){this.#Z=Y;let{r:Z,t:Q}=R.MathKit.toPolarCoords(this.x,this.y,Y);return this.r=Z,this.t=Q,this}toCartesianCoords(){if(!this.#Z&&this.x)return this;let{x:Y,y:Z}=R.MathKit.toCartesianCoords(this.r,this.t,this.#Z);return this.x=Y,this.y=Z,this}setUnit(Y){if(!Y||Y!="d"&&Y!="r")throw Error("unit must be 'r' or 'd', given: "+Y);if(this.#Z==Y)return;if(Y=="r")this.#Z=Y,this.t=R.MathKit.radians(this.t);else this.#Z=Y,this.t=R.MathKit.degrees(this.t)}}class QX{constructor(Y,Z,Q,J,X,z,G){this.x=Y,this.y=Z,this.f=Q,this.ymid=J,this.iterations=X,this.events=G,this.msg=z}_at(Y,Z){function Q(M){return M*M}let J,X,z,G,H,W,K,$,V,q;return J=this.x[Z],X=this.x[Z+1],G=this.y[Z],H=this.y[Z+1],K=X-J,z=J+0.5*K,W=this.ymid[Z],$=this.f[Z]-G*(1/(J-z)+2/(J-X)),V=this.f[Z+1]-H*(1/(X-z)+2/(X-J)),q=[Q(Y-X)*(Y-z)/Q(J-X)/(J-z),Q(Y-J)*Q(Y-X)/Q(J-z)/Q(X-z),Q(Y-J)*(Y-z)/Q(X-J)/(X-z),(Y-J)*Q(Y-X)*(Y-z)/Q(J-X)/(J-z),(Y-X)*Q(Y-J)*(Y-z)/Q(J-X)/(X-z)],G*q[0]+W*q[1]+H*q[2]+$*q[3]+V*q[4]}at(Y){let Z,Q,J;if(typeof Y!=="number"){let z=Y.length,G=Array(z);for(Z=z-1;Z!==-1;--Z)G[Z]=this.at(Y[Z]);return G}let X=this.x;Z=0,Q=X.length-1;while(Q-Z>1)if(J=Math.floor(0.5*(Z+Q)),X[J]<=Y)Z=J;else Q=J;return this._at(Y,Z)}}class CY{value;index;type;constructor(Y,Z,Q=-1){this.value=Y,this.type=Z,this.index=Q}valueOf(){return this.value}toString(){return this.value.toString()}}class D8{type;UPID=null;callback;constructor(Y,Z,Q=null){if(Q)this.type=1,this.UPID=Q;else this.type=Y;this.callback=Z}}function OB(Y){return Y==null||typeof Y=="number"||typeof Y=="string"||typeof Y=="boolean"||Y instanceof ArrayBuffer||Y instanceof MessagePort||Y instanceof ReadableStream||Y instanceof WritableStream||Y instanceof TransformStream}var NB,M8,wB,EY,t2="[#*0-9]\\uFE0F?\\u20E3|©\\uFE0F?|[®\\u203C\\u2049\\u2122\\u2139\\u2194-\\u2199\\u21A9\\u21AA]\\uFE0F?|[\\u231A\\u231B]|[\\u2328\\u23CF]\\uFE0F?|[\\u23E9-\\u23EC]|[\\u23ED-\\u23EF]\\uFE0F?|\\u23F0|[\\u23F1\\u23F2]\\uFE0F?|\\u23F3|[\\u23F8-\\u23FA\\u24C2\\u25AA\\u25AB\\u25B6\\u25C0\\u25FB\\u25FC]\\uFE0F?|[\\u25FD\\u25FE]|[\\u2600-\\u2604\\u260E\\u2611]\\uFE0F?|[\\u2614\\u2615]|\\u2618\\uFE0F?|\\u261D(?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?|[\\u2620\\u2622\\u2623\\u2626\\u262A\\u262E\\u262F\\u2638-\\u263A\\u2640\\u2642]\\uFE0F?|[\\u2648-\\u2653]|[\\u265F\\u2660\\u2663\\u2665\\u2666\\u2668\\u267B\\u267E]\\uFE0F?|\\u267F|\\u2692\\uFE0F?|\\u2693|[\\u2694-\\u2697\\u2699\\u269B\\u269C\\u26A0]\\uFE0F?|\\u26A1|\\u26A7\\uFE0F?|[\\u26AA\\u26AB]|[\\u26B0\\u26B1]\\uFE0F?|[\\u26BD\\u26BE\\u26C4\\u26C5]|\\u26C8\\uFE0F?|\\u26CE|[\\u26CF\\u26D1\\u26D3]\\uFE0F?|\\u26D4|\\u26E9\\uFE0F?|\\u26EA|[\\u26F0\\u26F1]\\uFE0F?|[\\u26F2\\u26F3]|\\u26F4\\uFE0F?|\\u26F5|[\\u26F7\\u26F8]\\uFE0F?|\\u26F9(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\uFE0F(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\u26FA\\u26FD]|\\u2702\\uFE0F?|\\u2705|[\\u2708\\u2709]\\uFE0F?|[\\u270A\\u270B](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\u270C\\u270D](?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?|\\u270F\\uFE0F?|[\\u2712\\u2714\\u2716\\u271D\\u2721]\\uFE0F?|\\u2728|[\\u2733\\u2734\\u2744\\u2747]\\uFE0F?|[\\u274C\\u274E\\u2753-\\u2755\\u2757]|\\u2763\\uFE0F?|\\u2764(?:\\u200D(?:\\uD83D\\uDD25|\\uD83E\\uDE79)|\\uFE0F(?:\\u200D(?:\\uD83D\\uDD25|\\uD83E\\uDE79))?)?|[\\u2795-\\u2797]|\\u27A1\\uFE0F?|[\\u27B0\\u27BF]|[\\u2934\\u2935\\u2B05-\\u2B07]\\uFE0F?|[\\u2B1B\\u2B1C\\u2B50\\u2B55]|[\\u3030\\u303D\\u3297\\u3299]\\uFE0F?|\\uD83C(?:[\\uDC04\\uDCCF]|[\\uDD70\\uDD71\\uDD7E\\uDD7F]\\uFE0F?|[\\uDD8E\\uDD91-\\uDD9A]|\\uDDE6\\uD83C[\\uDDE8-\\uDDEC\\uDDEE\\uDDF1\\uDDF2\\uDDF4\\uDDF6-\\uDDFA\\uDDFC\\uDDFD\\uDDFF]|\\uDDE7\\uD83C[\\uDDE6\\uDDE7\\uDDE9-\\uDDEF\\uDDF1-\\uDDF4\\uDDF6-\\uDDF9\\uDDFB\\uDDFC\\uDDFE\\uDDFF]|\\uDDE8\\uD83C[\\uDDE6\\uDDE8\\uDDE9\\uDDEB-\\uDDEE\\uDDF0-\\uDDF5\\uDDF7\\uDDFA-\\uDDFF]|\\uDDE9\\uD83C[\\uDDEA\\uDDEC\\uDDEF\\uDDF0\\uDDF2\\uDDF4\\uDDFF]|\\uDDEA\\uD83C[\\uDDE6\\uDDE8\\uDDEA\\uDDEC\\uDDED\\uDDF7-\\uDDFA]|\\uDDEB\\uD83C[\\uDDEE-\\uDDF0\\uDDF2\\uDDF4\\uDDF7]|\\uDDEC\\uD83C[\\uDDE6\\uDDE7\\uDDE9-\\uDDEE\\uDDF1-\\uDDF3\\uDDF5-\\uDDFA\\uDDFC\\uDDFE]|\\uDDED\\uD83C[\\uDDF0\\uDDF2\\uDDF3\\uDDF7\\uDDF9\\uDDFA]|\\uDDEE\\uD83C[\\uDDE8-\\uDDEA\\uDDF1-\\uDDF4\\uDDF6-\\uDDF9]|\\uDDEF\\uD83C[\\uDDEA\\uDDF2\\uDDF4\\uDDF5]|\\uDDF0\\uD83C[\\uDDEA\\uDDEC-\\uDDEE\\uDDF2\\uDDF3\\uDDF5\\uDDF7\\uDDFC\\uDDFE\\uDDFF]|\\uDDF1\\uD83C[\\uDDE6-\\uDDE8\\uDDEE\\uDDF0\\uDDF7-\\uDDFB\\uDDFE]|\\uDDF2\\uD83C[\\uDDE6\\uDDE8-\\uDDED\\uDDF0-\\uDDFF]|\\uDDF3\\uD83C[\\uDDE6\\uDDE8\\uDDEA-\\uDDEC\\uDDEE\\uDDF1\\uDDF4\\uDDF5\\uDDF7\\uDDFA\\uDDFF]|\\uDDF4\\uD83C\\uDDF2|\\uDDF5\\uD83C[\\uDDE6\\uDDEA-\\uDDED\\uDDF0-\\uDDF3\\uDDF7-\\uDDF9\\uDDFC\\uDDFE]|\\uDDF6\\uD83C\\uDDE6|\\uDDF7\\uD83C[\\uDDEA\\uDDF4\\uDDF8\\uDDFA\\uDDFC]|\\uDDF8\\uD83C[\\uDDE6-\\uDDEA\\uDDEC-\\uDDF4\\uDDF7-\\uDDF9\\uDDFB\\uDDFD-\\uDDFF]|\\uDDF9\\uD83C[\\uDDE6\\uDDE8\\uDDE9\\uDDEB-\\uDDED\\uDDEF-\\uDDF4\\uDDF7\\uDDF9\\uDDFB\\uDDFC\\uDDFF]|\\uDDFA\\uD83C[\\uDDE6\\uDDEC\\uDDF2\\uDDF3\\uDDF8\\uDDFE\\uDDFF]|\\uDDFB\\uD83C[\\uDDE6\\uDDE8\\uDDEA\\uDDEC\\uDDEE\\uDDF3\\uDDFA]|\\uDDFC\\uD83C[\\uDDEB\\uDDF8]|\\uDDFD\\uD83C\\uDDF0|\\uDDFE\\uD83C[\\uDDEA\\uDDF9]|\\uDDFF\\uD83C[\\uDDE6\\uDDF2\\uDDFC]|\\uDE01|\\uDE02\\uFE0F?|[\\uDE1A\\uDE2F\\uDE32-\\uDE36]|\\uDE37\\uFE0F?|[\\uDE38-\\uDE3A\\uDE50\\uDE51\\uDF00-\\uDF20]|[\\uDF21\\uDF24-\\uDF2C]\\uFE0F?|[\\uDF2D-\\uDF35]|\\uDF36\\uFE0F?|[\\uDF37-\\uDF7C]|\\uDF7D\\uFE0F?|[\\uDF7E-\\uDF84]|\\uDF85(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDF86-\\uDF93]|[\\uDF96\\uDF97\\uDF99-\\uDF9B\\uDF9E\\uDF9F]\\uFE0F?|[\\uDFA0-\\uDFC1]|\\uDFC2(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDFC3\\uDFC4](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDFC5\\uDFC6]|\\uDFC7(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDFC8\\uDFC9]|\\uDFCA(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDFCB\\uDFCC](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\uFE0F(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDFCD\\uDFCE]\\uFE0F?|[\\uDFCF-\\uDFD3]|[\\uDFD4-\\uDFDF]\\uFE0F?|[\\uDFE0-\\uDFF0]|\\uDFF3(?:\\u200D(?:\\u26A7\\uFE0F?|\\uD83C\\uDF08)|\\uFE0F(?:\\u200D(?:\\u26A7\\uFE0F?|\\uD83C\\uDF08))?)?|\\uDFF4(?:\\u200D\\u2620\\uFE0F?|\\uDB40\\uDC67\\uDB40\\uDC62\\uDB40(?:\\uDC65\\uDB40\\uDC6E\\uDB40\\uDC67|\\uDC73\\uDB40\\uDC63\\uDB40\\uDC74|\\uDC77\\uDB40\\uDC6C\\uDB40\\uDC73)\\uDB40\\uDC7F)?|[\\uDFF5\\uDFF7]\\uFE0F?|[\\uDFF8-\\uDFFF])|\\uD83D(?:[\\uDC00-\\uDC07]|\\uDC08(?:\\u200D\\u2B1B)?|[\\uDC09-\\uDC14]|\\uDC15(?:\\u200D\\uD83E\\uDDBA)?|[\\uDC16-\\uDC3A]|\\uDC3B(?:\\u200D\\u2744\\uFE0F?)?|[\\uDC3C-\\uDC3E]|\\uDC3F\\uFE0F?|\\uDC40|\\uDC41(?:\\u200D\\uD83D\\uDDE8\\uFE0F?|\\uFE0F(?:\\u200D\\uD83D\\uDDE8\\uFE0F?)?)?|[\\uDC42\\uDC43](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC44\\uDC45]|[\\uDC46-\\uDC50](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC51-\\uDC65]|[\\uDC66\\uDC67](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC68(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?|[\\uDC68\\uDC69]\\u200D\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?)|[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92])|\\uD83E[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFC-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFD-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFD\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?\\uDC68\\uD83C[\\uDFFB-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D\\uDC68\\uD83C[\\uDFFB-\\uDFFE]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?))?|\\uDC69(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:\\uDC8B\\u200D\\uD83D)?[\\uDC68\\uDC69]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?|\\uDC69\\u200D\\uD83D(?:\\uDC66(?:\\u200D\\uD83D\\uDC66)?|\\uDC67(?:\\u200D\\uD83D[\\uDC66\\uDC67])?)|[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92])|\\uD83E[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFC-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB\\uDFFD-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFD\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D\\uD83D(?:[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF]|\\uDC8B\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFF])|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83D[\\uDC68\\uDC69]\\uD83C[\\uDFFB-\\uDFFE]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?))?|\\uDC6A|[\\uDC6B-\\uDC6D](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC6E(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDC6F(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|[\\uDC70\\uDC71](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDC72(?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC73(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDC74-\\uDC76](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC77(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDC78(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC79-\\uDC7B]|\\uDC7C(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC7D-\\uDC80]|[\\uDC81\\uDC82](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDC83(?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC84|\\uDC85(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC86\\uDC87](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDC88-\\uDC8E]|\\uDC8F(?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDC90|\\uDC91(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDC92-\\uDCA9]|\\uDCAA(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDCAB-\\uDCFC]|\\uDCFD\\uFE0F?|[\\uDCFF-\\uDD3D]|[\\uDD49\\uDD4A]\\uFE0F?|[\\uDD4B-\\uDD4E\\uDD50-\\uDD67]|[\\uDD6F\\uDD70\\uDD73]\\uFE0F?|\\uDD74(?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?|\\uDD75(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|\\uFE0F(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDD76-\\uDD79]\\uFE0F?|\\uDD7A(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD87\\uDD8A-\\uDD8D]\\uFE0F?|\\uDD90(?:\\uD83C[\\uDFFB-\\uDFFF]|\\uFE0F)?|[\\uDD95\\uDD96](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDDA4|[\\uDDA5\\uDDA8\\uDDB1\\uDDB2\\uDDBC\\uDDC2-\\uDDC4\\uDDD1-\\uDDD3\\uDDDC-\\uDDDE\\uDDE1\\uDDE3\\uDDE8\\uDDEF\\uDDF3\\uDDFA]\\uFE0F?|[\\uDDFB-\\uDE2D]|\\uDE2E(?:\\u200D\\uD83D\\uDCA8)?|[\\uDE2F-\\uDE34]|\\uDE35(?:\\u200D\\uD83D\\uDCAB)?|\\uDE36(?:\\u200D\\uD83C\\uDF2B\\uFE0F?)?|[\\uDE37-\\uDE44]|[\\uDE45-\\uDE47](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDE48-\\uDE4A]|\\uDE4B(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDE4C(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDE4D\\uDE4E](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDE4F(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDE80-\\uDEA2]|\\uDEA3(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDEA4-\\uDEB3]|[\\uDEB4-\\uDEB6](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDEB7-\\uDEBF]|\\uDEC0(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDEC1-\\uDEC5]|\\uDECB\\uFE0F?|\\uDECC(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDECD-\\uDECF]\\uFE0F?|[\\uDED0-\\uDED2\\uDED5-\\uDED7]|[\\uDEE0-\\uDEE5\\uDEE9]\\uFE0F?|[\\uDEEB\\uDEEC]|[\\uDEF0\\uDEF3]\\uFE0F?|[\\uDEF4-\\uDEFC\\uDFE0-\\uDFEB])|\\uD83E(?:\\uDD0C(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD0D\\uDD0E]|\\uDD0F(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD10-\\uDD17]|[\\uDD18-\\uDD1C](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDD1D|[\\uDD1E\\uDD1F](?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD20-\\uDD25]|\\uDD26(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDD27-\\uDD2F]|[\\uDD30-\\uDD34](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDD35(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDD36(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD37-\\uDD39](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDD3A|\\uDD3C(?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|[\\uDD3D\\uDD3E](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDD3F-\\uDD45\\uDD47-\\uDD76]|\\uDD77(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDD78\\uDD7A-\\uDDB4]|[\\uDDB5\\uDDB6](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDDB7|[\\uDDB8\\uDDB9](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDDBA|\\uDDBB(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDDBC-\\uDDCB]|[\\uDDCD-\\uDDCF](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDDD0|\\uDDD1(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD]))|\\uD83C(?:\\uDFFB(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFC-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFC(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB\\uDFFD-\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFD(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB\\uDFFC\\uDFFE\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFE(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFD\\uDFFF]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?|\\uDFFF(?:\\u200D(?:[\\u2695\\u2696\\u2708]\\uFE0F?|\\u2764\\uFE0F?\\u200D(?:\\uD83D\\uDC8B\\u200D)?\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFE]|\\uD83C[\\uDF3E\\uDF73\\uDF7C\\uDF84\\uDF93\\uDFA4\\uDFA8\\uDFEB\\uDFED]|\\uD83D[\\uDCBB\\uDCBC\\uDD27\\uDD2C\\uDE80\\uDE92]|\\uD83E(?:\\uDD1D\\u200D\\uD83E\\uDDD1\\uD83C[\\uDFFB-\\uDFFF]|[\\uDDAF-\\uDDB3\\uDDBC\\uDDBD])))?))?|[\\uDDD2\\uDDD3](?:\\uD83C[\\uDFFB-\\uDFFF])?|\\uDDD4(?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|\\uDDD5(?:\\uD83C[\\uDFFB-\\uDFFF])?|[\\uDDD6-\\uDDDD](?:\\u200D[\\u2640\\u2642]\\uFE0F?|\\uD83C[\\uDFFB-\\uDFFF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?)?|[\\uDDDE\\uDDDF](?:\\u200D[\\u2640\\u2642]\\uFE0F?)?|[\\uDDE0-\\uDDFF\\uDE70-\\uDE74\\uDE78-\\uDE7A\\uDE80-\\uDE86\\uDE90-\\uDEA8\\uDEB0-\\uDEB6\\uDEC0-\\uDEC2\\uDED0-\\uDED6])",R,TI,JX,_I,NI,wI,XX,OI,II,V1,EI,CI,zX,jI,kI,AI,PI,xI,SI,vI,yI,fI,s,bI,hI,gI,mI,uI,dI,pI,cI,lI,iI,C6,nI,aI,oI,sI,rI,tI,eI,YE,ZE,QE,GX,JE,XE,zE,HX,GE,WX,k0,KX,U,HE,WE,KE,$E,UE,$X,VE,qE,BE,FE,RE,ME,DE,LE,TE,_E,NE,wE,OE,IE,EE,CE,L8,jE,j6,q1,kE,AE,PE,n,xE,SE,vE,yE,fE,jY,bE,hE,p;var Q0=F(()=>{NB=_B(import.meta.url),M8=typeof window>"u"||typeof process<"u",wB={dgram:null,worker_threads:null,os:null,fs:null,mathjs:null},EY={consoleTimeInstances:null};R={_modules:wB,arrFindLast(Y,Z){for(let Q=Y.length-1;Q>=0;Q--)if(Z(Y[Q],Q,Y))return Y[Q];return},arrToString(Y,Z={}){let{maxDepth:Q=4,indent:J=3,maxRow:X=10,maxCol:z=20,color:G=!1,defColor:H=void 0,noHeader:W=!1}=Z;if(Q<1)Q=1;let K={color:G,defColor:H},$=R.getDimensions(Y,"max"),V=$.length*0.4,q=typeof J=="number"?" ".repeat(J):J,M=null;if(G)M={magenta:R.ncc(11550650),gray:R.ncc(4802889),_default:R.ncc(H)};if(!W&&(!(Y instanceof Array)||$.length>2||Math.max(...$)>5))return T(Y)+B(Y,0);else return B(Y,0);function B(_,w,I=0){let E="";if(w>Q-1)if(G)return M.gray+`... [${D(_)||"Array"}]`+M._default;else return`... [${D(_)||"Array"}]`;if(!R.isArrayLike(_))return E+R.yuString(_,K);let v;if(w>V)v=R.getDimensions(_,"max");else v=$.slice(w);let S=$[w+1]!=null&&(v[2]!=null||v[1]>2)&&w<Q-1,g=I?q.repeat(I):"",d=g+q,m=S?`[
|
|
2
|
+
`+d:"[",b=S?`
|
|
3
|
+
`+g+"]":"]",i=_.length;E+=m;for(let Y0=0;Y0<i;Y0++){if(R.isArrayLike(_[Y0]))E+=D(_[Y0])+B(_[Y0],w+1,S?I+1:I);else E+=R.yuString(_[Y0],K);if(S){if(Y0>=X-2){if(E+=`,
|
|
4
|
+
`+d,G)E+=M.gray+"... ("+(i-X+1)+" more)"+M._default;else E+="... ("+(i-X+1)+" more)";break}}else if(Y0>=z-2){if(G)E+=", "+M.gray+"... ("+(i-z+1)+" more)"+M._default;else E+=", ... ("+(i-z+1)+" more)";break}if(Y0!=i-1)E+=S?`,
|
|
5
|
+
`+d:", "}return E+=b,E}function D(_){if(_ instanceof Array)return"";if(G)return M.magenta+`${_.constructor.name}: `+M._default;else return`${_.constructor.name}: `}function T(_){if(!R.isArrayLike(_))return"";if(G)return M.magenta+`${_.constructor.name}(${$}): `+M._default;else return`${_.constructor.name}(${$}): `}},argvHasFlag(Y,Z=process?.argv){if(!Z||typeof Y!="string")return!1;let Q=Y.startsWith("-")?"":Y.length===1?"-":"--",J=Z.indexOf(Q+Y),X=Z.indexOf("--");return J!==-1&&(X===-1||J<X)},async asyncSleep(Y){return new Promise((Q)=>{if(!Y||Y<4||typeof Y!="number")Q();setTimeout(Q,Y)})},beautifyJson(Y){Y=Y.replace(/\s/,"");let Z=Y+"",Q=R.getMatchAllIndexes(Y.matchAll(/[{[]/g)).sort((G,H)=>G-H),J=R.getMatchAllIndexes(Y.matchAll(/[}\]]/g)).sort((G,H)=>G-H);for(let G=0,H=0,W=0;W<Y.length;){let K=Q[z(Q,W)],$=J[z(J,W)];if(K=K==null?1/0:K,K<$)G++,W=K+1;else G--,W=$+1;let V=Q[z(Q,W)],q=J[z(J,W)],M=V<q?V:q,B="".padEnd(G,"\t");if(X(Z[W+H-1]))Z=R.strSplice(Z,W+H,0,`
|
|
6
|
+
`);else Z=R.strSplice(Z,W+H-1,0,`
|
|
7
|
+
`),Z=R.strSplice(Z,W+H,0,B),H+=B.length;H++;let D=Y.substring(W,M),T=R.getMatchAllIndexes(D.matchAll(/"/g)).filter((w)=>w!=0?D[w-1]!="\\":!0);if(T.length%2!=0)throw Error('cannot match Double-Quote correctly from string: "'+D+'"');let _=R.getMatchAllIndexes(D.matchAll(/[,]/g)).filter((w)=>{for(let I=0;I<T.length;I+=2)if(w>T[I]&&w<T[I+1])return!1;return!0});for(let w=0;w<_.length+1;w++){let I=w==0?W+H:_[w-1]+H+W+1;if(X(Z[I-1])==null)Z=R.strSplice(Z,I,0,B),H+=B.length;if(!Z[_[w]+H+W])break;Z=R.strSplice(Z,_[w]+1+H+W,0,`
|
|
8
|
+
`),H++}}return Z;function X(G){let H=new RegExp(/[{[]/),W=new RegExp(/[}\]]/);if(H.test(G))return 1;if(W.test(G))return 0;return null}function z(G,H){let W=1/0,K;for(let $=0,V=G[$];$<G.length;V=G[++$]){let q=V-H;if(!q)return $;if(q<0)continue;if(q<W)W=q,K=$}return K}},beforeExit(Y,Z=!1){if(Z)process.stdin.resume();let Q=!1,J=!1;["exit","SIGINT","SIGUSR1","SIGUSR2","uncaughtException","SIGTERM"].forEach((X)=>{process.on(X,(...z)=>{if(["SIGINT","SIGUSR1","SIGUSR2"].includes(X))if(Q)console.log("Forcefully Exiting..."),process.exit(1);else Q=!0;if(J)return;else J=!0;let G=Y(X,...z);if(G instanceof Promise){G.then(()=>{if(X!=="exit"&&Z)process.exit(0)}).catch((H)=>{if(console.error("Error in beforeExit callback:",H),X!=="exit"&&Z)process.exit(1)});return}if(X!=="exit"&&Z)process.exit(0)})})},changeDateTimezone(Y,Z){let Q=new Date(`${Y.toLocaleString("en-US",{timeZone:Z})}`),J=Y.getTime()-Q.getTime();return new Date(Y.getTime()-J)},charTypeAt(Y,Z){let Q=R.CONSTS.UNICODES_RANGE_TABLE;if(Y<0)Y=Z.length+Y;let J=Z.charCodeAt(Y);if(isNaN(J))return null;for(let X=Q.length>>1,z=0;X>=0&&X<Q.length;z++){if(z>(Q.length>>1)+1)break;if(R.isArrayLike(Q[X].to)){for(let G=0;G<Q[X].to.length;G++)if(J>=Q[X].from[G]&&J<=Q[X].to[G])return Q[X].type;if(J>Q[X].from[0])X++;else X--}else{if(J>=Q[X].from&&J<=Q[X].to)return Q[X].type;if(J>Q[X].from)X++;else X--}}return null},CheckCache:class Y{static#Z=null;static#Q=null;static#Y=null;static get supportsColor(){if(this.#Z==null)this.#Z=R.supportsColor();return this.#Z??0}static get supportsHyperlink(){if(this.#Q==null)this.#Q=R.supportsHyperlink();return this.#Q}static set supportsColor(Z){this.#Z=Z}static set supportsHyperlink(Z){this.#Q=Z}static get forceColor(){if(!M8)this.#Y=!1;if(this.#Y===void 0){let Z=process.env;if(R.argvHasFlag("no-color")||R.argvHasFlag("no-colors")||R.argvHasFlag("color=false"))this.#Y=!1;else if(R.argvHasFlag("color")||R.argvHasFlag("colors")||R.argvHasFlag("color=true")||R.argvHasFlag("color=always"))this.#Y=!0;if("FORCE_COLOR"in Z)this.#Y=Z.FORCE_COLOR.length===0||parseInt(Z.FORCE_COLOR,10)!==0}return this.#Y}static set forceColor(Z){this.#Y=Z}},cleanArr(Y,Z=null){if(Z&&Z instanceof Array)return Y.filter((Q)=>{return!Z.includes(Q)});if(Z!==null)return Y.filter((Q)=>{return Q!==Z});return Y.filter((Q)=>Q!==""&&Q!=="\r"&&!R.isEmptyArray(Q)&&!R.isEmptyObject(Q))},cleanComments(Y){return Y.replace(R.REGEXP.JSComments,(Z,Q)=>Q?"":Z)},cleanString(Y){return Y.normalize().replace(R.REGEXP.ANSICode,"")},CONSTS:Object.freeze({UNICODES_RANGE_TABLE:[Object.freeze({type:"generic.en.upper",regex:/[\x41-\x5a]/g,from:65,to:90}),Object.freeze({type:"generic.en.lower",regex:/[\x61-\x7a]/g,from:97,to:122}),Object.freeze({type:"generic.jp.full",regex:/[\u2E80-\u2FD5\u3400-\u4DB5\u4E00-\u9FCB\uF900-\uFA6A\u3000-\u303f\u3041-\u3096\u30a0-\u30ff]/g,from:new Int16Array([11904,13312,19968,63744,12288,12353,12448]),to:new Int16Array([12245,19893,40907,64106,12351,12438,12543])}),Object.freeze({type:"generic.cn.full",regex:/[\u4e00-\u9fff]/g,from:19968,to:40959}),Object.freeze({type:"generic.jp.half",regex:/[\uff5f-\uff9f]/g,from:65375,to:65439})],AsyncFunction:(async()=>{}).constructor,GeneratorFunction:function*(){}.constructor}),Convert:{decimalColorToRGB(Y){return{r:Y>>16&255,g:Y>>8&255,b:Y&255}},basicColorFromRgb(Y){let Z=Y.r>127,Q=Y.g>127,J=Y.b>127;switch(Z+Q+J){case 3:return"white";case 0:return"black";case 2:if(!Z)return"cyan";else if(!Q)return"magenta";else if(!J)return"yellow";case 1:if(Z)return"red";else if(Q)return"green";else if(J)return"blue"}},_8bitColorFromRgb(Y){let{r:Z,g:Q,b:J}=Y;if(Z===Q&&Q===J){if(Z<8)return 16;if(Z>248)return 231;return Math.round((Z-8)/247*24)+232}let X=Math.round(Z/255*5),z=Math.round(Q/255*5),G=Math.round(J/255*5);return 16+36*X+6*z+G}},ConsoleTime:class Y{static lookbackLimit=100;static elipsedStart(Z){if(EY.consoleTimeInstances==null){EY.consoleTimeInstances=new Map([[Z,[R.getProcessTime()]]]);return}if(!EY.consoleTimeInstances.has(Z)){EY.consoleTimeInstances.set(Z,[R.getProcessTime()]);return}let Q=EY.consoleTimeInstances.get(Z);if(Q.unshift(R.getProcessTime()),this.lookbackLimit>0&&Q.length>=this.lookbackLimit)Q.pop()}static elipsedEnd(Z){if(!EY.consoleTimeInstances.has(Z))return;let Q=EY.consoleTimeInstances.get(Z),J=Q[0];Q[0]=R.getProcessTime()-J}static condense(Z){let Q=EY.consoleTimeInstances.get(Z);if(!Q)return null;let J=0;for(let X of Q)J+=X;return J/=Q.length,EY.consoleTimeInstances.delete(Z),{print(){console.log(Z+": "+R.toShortNum(J)+"s")},valueOf:()=>J,toString:()=>Z+": "+R.toShortNum(J)+"s",value:J}}},compareDate(Y,Z,Q,J="day"){if(!Y||!Q)return!1;let X=W(Y),z=W(Q),G=X.next(),H=z.next();do if(G.value!==H.value)switch(Z){case">":return G.value>H.value;case"<":return G.value<H.value;case">=":return G.value>=H.value;case"<=":return G.value<=H.value;default:return!1}while(!(G=X.next()).done&&!(H=z.next()).done);return Z[1]==="=";function*W(K){if(yield K.getFullYear(),J==="year")return;if(yield K.getMonth(),J==="month")return;yield K.getDate()}},DataScienceKit:{frequencyOf(Y){if(!Y||typeof Y!="string"&&!R.isArrayLike(Y))return new Map;let Z=[...new Set(Y)],Q=new Map(Z.map((J)=>[J,0]));for(let J of Y)Z.forEach((X)=>{if(X==J)Q.set(X,Q.get(X)+1)});return Q},LCS_of(Y,Z,Q=(J,X)=>J===X){if(!(Y?.length&&Z?.length))return[];let J=[],X=Z.length,z=Y.length;while(J.length<z)J.push(Array(X));for(let K=0;K<J.length;K++)for(let $=0;$<J[K].length;$++){if(Q(Y[K],Z[$])){let M=W(K-1,$-1);J[K][$]=[M+1,3];continue}let V=W(K,$-1),q=W(K-1,$);if(V>q)J[K][$]=[V,2];else J[K][$]=[q,1]}let G=[];return H(z-1,X-1),G;function H(K,$){if(K<0||$<0)return;switch(J[K][$][1]){case 1:H(K-1,$);break;case 2:H(K,$-1);break;case 3:G.unshift(Y[K]),H(K-1,$-1);break}}function W(K,$){if(K<0||$<0)return 0;else return J[K][$][0]}},LCSLength_of(Y,Z,Q=(J,X)=>J===X){if(!(Y?.length&&Z?.length))return 0;let J=[],X=Z.length,z=Y.length;while(J.length<z)J.push(Array(X));for(let H=0;H<J.length;H++)for(let W=0;W<J[H].length;W++){if(Q(Y[H],Z[W])){let V=G(H-1,W-1);J[H][W]=[V+1,3];continue}let K=G(H,W-1),$=G(H-1,W);if(K>$)J[H][W]=[K,2];else J[H][W]=[$,1]}return J[z-1][X-1][0];function G(H,W){if(H<0||W<0)return 0;else return J[H][W][0]}},TFIDF_of(Y){let Z=Y.length,Q=Array(Z),J=new Map;for(let z=0;z<Z;z++){let G=Y[z].length,H=R.DataScienceKit.frequencyOf(Y[z]);Q[z]=new Map;for(let W=0;W<G;W++){if(!Q[z].has(Y[z][W]))Q[z].set(Y[z][W],new e2(H.get(Y[z][W])/G));if(!J.has(Y[z][W]))J.set(Y[z][W],0)}}let X=[...J.keys()];for(let z=0;z<X.length;z++)for(let G of Y)if(G.includes(X[z]))J.set(X[z],J.get(X[z])+1);for(let[z,G]of J)J.set(z,Math.log10(Z/G));for(let z of Q)for(let[G,H]of z)H.IDF=J.get(G),H.TF_IDF=H.IDF*H.TF;return Q},TFIDF_extends(Y,Z){let Q=Y.concat(Array(Z.length)),J=new Map,X=Q.length;for(let G=0;G<X;G++){let H,W,K=!1,$=G-Y.length;if(!Q[G])K=!0,H=Z[$].length,W=R.DataScienceKit.frequencyOf(Z[$]),Q[G]=new Map;else H=Q[G].size;for(let V=0;V<H;V++){if(K&&!Q[G].has(Z[$][V])){if(Q[G].set(Z[$][V],new e2(W.get(Z[$][V])/H)),!J.has(Z[$][V]))J.set(Z[$][V],0);continue}let q=[...Q[G].keys()][V];if(!J.has(q))J.set(q,0)}}let z=[...J.keys()];for(let G=0;G<z.length;G++)for(let H of Q)if(H.has(z[G]))J.set(z[G],J.get(z[G])+1);for(let[G,H]of J)J.set(G,Math.log10(X/H));for(let G of Q)for(let[H,W]of G)W.IDF=J.get(H),W.TF_IDF=W.IDF*W.TF;return Q},wagnerFischer_of(Y,Z,Q=(J,X)=>J===X){let J=[],X,z;for(X=0;X<=Y.length;X++)J[X]=[X];for(z=0;z<=Z.length;z++)J[0][z]=z;for(X=1;X<=Y.length;X++)for(z=1;z<=Z.length;z++){if(Q(Y[X-1],Z[z-1])){J[X][z]=J[X-1][z-1];continue}J[X][z]=Math.min(J[X-1][z-1]+1,Math.min(J[X][z-1]+1,J[X-1][z]+1))}return{distance:J[Y.length][Z.length],getOperations(){let G=J.length-1,H=J[0].length-1,W=[],K=new R.SafeTrue;while((G>0||H>0)&&K.True)switch($(G,H,J)){case 2:W.push({type:"delete",index:G-1,value:Y[G-1]}),G--;break;case 0:W.push({type:"insert",index:G,value:Z[H-1]}),H--;break;case 1:if(J[G][H]!==J[G-1][H-1])W.push({type:"replace",index:G-1,value:Z[H-1]});G--,H--;break}return W;function $(V,q,M){let B=[M[V][q-1],M[V-1][q-1],M[V-1][q]];if(q<=0)return 2;if(V<=0)return 0;if(B[0]==B[1])if(B[2]==B[1])return 1;else return 0;let D=B[0],T=0;for(let _=1;_<B.length;_++)if(B[_]<D)D=B[_],T=_;return T}}}}},deferredFunc(Y,Z=200,Q=!1){let J=null;return function(...X){let z=!1;if(Q&&!J)Y(...X),z=!0;clearTimeout(J),J=setTimeout(()=>{if(J=null,!z)Y(...X)},Z)}},digitAt(Y,Z){try{return parseInt((Z+"").at(Y))}catch{return 0}},digitAtRange(Y,Z,Q){if(!Q)return;Y=Y<0?void 0:Y??void 0,Z=Z<0?void 0:Z??void 0;let J=(Q+"").slice(Y,Z);return parseInt(J.length?J:"0")},getDimensions(Y,Z="max"){let Q=[],J=Z==="min"?Math.min:Math.max,X=Z==="min"?1/0:0,z=X,G=[],H=0;if(!R.isArrayLike(Y))return Q;if(Q.push(Y.length),Z==="symmetric")W(Y,0);else K(Y,0,!0);return Q;function W($,V){if(!R.isArrayLike($?.[Q[V]-1]))return;Q.push($[Q[V]-1].length),W($[Q[V]-1],V+1)}function K($,V,q=!1,M=[]){for(let B=0;B<Q[V];B++){if(!R.isArrayLike($[B]))continue;if($[B].length!=z){if(Z==="fixed"&&z!==X)throw Error(`Array length mismatched at depth ${V+1} position (${[...M,B].join(",")}):
|
|
9
|
+
expected length: ${z}
|
|
10
|
+
actual length: ${$[B].length}`);z=J(z,$[B].length)}G.push([$[B],V+1,!1,[...M,B]])}if(q&&z!==X){Q.push(z),z=X;let B=[...G];G=[];for(let D=0;D<B.length;D++){if(D==B.length-1)B[D][2]=!0;if(++H>5000){queueMicrotask(()=>{H=0,K(...B[D])});continue}K(...B[D])}}}},Err:class Y extends Error{constructor(Z,Q=null,J=null,X=null){if(R.isError(Z)){if(!Q)Q=Z.name;if(!J)J=Z.code;if(!X)X=Z.stack;Z=Z.message}super(Z);if(Q)this.name=Q;if(J)this.code=J;if(X)this.stack=X}toString(Z={}){if(!this||!R.isError(this))return"[Error unknown]";return R.Err.toString(this,Z)}static from(Z,Q=null,J=null,X=null){return new R.Err(Z,Q,J,X)}static isError(Z){if(Z instanceof Error)return!0;if(Object.prototype.isPrototypeOf.call(Error.prototype,Z))return!0;return typeof Z?.message=="string"&&typeof Z?.stack=="string"}static toString(Z,Q={}){let{color:J=!1,defColor:X=void 0}=Q,z=(J?R.ncc("Red")+"ERROR"+R.ncc(X):"ERROR")+" Message: ";if(J)z+=R.ncc("Red")+(Z?.message??"[unknown]")+R.ncc(X);else z+=Z?.message??"[unknown]";if(Z?.name)if(z+=`
|
|
11
|
+
Name: `,J)z+=R.ncc("Red")+Z.name+R.ncc(X);else z+=Z.name;if(Z?.code)if(z+=`
|
|
12
|
+
Code: `,J)z+=R.ncc("Yellow")+Z.code+R.ncc(X);else z+=Z.code;if(Z?.stack)if(z+=`
|
|
13
|
+
Stack: `,J)z+=R.ncc(5592405)+Z.stack+R.ncc(X);else z+=Z.stack;return z}},escapeRegExp(Y){return Y.replace(/[[\]{}.*$^|\-?+,:\\]/g,"\\$&")},ex_length(Y,Z=0){if(typeof Y!=="string")throw TypeError("argument must be a string");if(Z<0)return Y.length;Y=R.cleanString(Y);let Q=Y.length;if(Z<1)return Q;let J=Y;for(let H of R.CONSTS.UNICODES_RANGE_TABLE){if(!H.type.endsWith("full"))continue;J=J.replace(H.regex,"")}let X=Q+(Q-J.length);if(Z<2)return X;let z=Y.match(R.REGEXP.EmojiEach)??[],G=z.reduce((H,W)=>H+W.length,0);return z.length*2+(X-G)},fileNameCleaner(Y,Z="_"){if(!Y||typeof Y!="string")throw Error("the given `rawName` isn't a string");return Y.trim().replace(/[|/*\\<>"?:]/g,Z)},fixFilePath(Y,Z="_"){if(!Y||!Y?.length)throw"path is either falsy or empty!";return Y.replace(/[:?"<>|*]/g,Z)},fixYTurl(Y){if(Y=Y||void 0,!Y)throw"url can't be falsy!!";if(Y.includes("youtu.be"))Y=Y.replace("https://youtu.be/","https://www.youtube.com/watch?v=");if(Y.includes("&list="))Y=Y.split("&list=")[0];if(Y.includes("?si="))Y=Y.split("?si=")[0];if(Y.includes("https")==!1)Y="https://www."+Y;return Y},fileTypeOf(Y){let Z=Y.slice(Y.lastIndexOf(".")+1).toLowerCase(),Q=Z=="jpg"||Z=="png"||Z=="svg"||Z=="jfif"||Z=="pbm"||Z=="pgm"||Z=="jpeg",J=Z=="txt"||Z=="bat"||Z=="text"||Z=="md"||Z=="json"||Z=="step"||Z=="js"||Z=="cs"||Z=="cpp"||Z=="gitignore"||Z=="java"||Z=="py"||Z=="config"||Z=="cfg"||Z=="ts"||Z=="env",X=Z=="exe"||Z=="vpk"||Z=="qc"||Z=="smd"||Z=="vmt"||Z=="vtf"||Z=="zip"||Z=="7z"||Z=="bin"||Z=="ipynb"||Z=="pyc"||Z=="jar",z=Z=="aiff"||Z=="aif"||Z=="aifc"||Z=="flac"||Z=="mp3"||Z=="mp4"||Z=="mp4a"||Z=="m4a"||Z=="mkv"||Z=="mov"||Z=="wav"||Z=="gif"||Z=="webm";if(Q)return"image";else if(J)return"text";else if(X)return"binary";else if(z)return"media";return null},getMatchAllIndexes(Y){if(!Y)return[];let Z=[];for(let Q of Y)Z.push(Q.index);return Z},getMatchAllResults(Y){if(!Y)return[];let Z=[];for(let Q of Y)Z.push(new YX(Q[0],Q.index,Q.index+Q[0].length));return Z},getRandomInt(Y,Z){return Math.round(Math.random()*(Z-Y)+Y)},getProcessTime(){let Y=process.hrtime();return Y[0]*1000+Y[1]/1e6},hyperLink(Y,Z){if(Z=encodeURI(Z.replace(/\\/g,"/")),!R.CheckCache.supportsHyperlink)return Z;return`\x1B]8;;${Z}\x07${Y}\x1B]8;;\x07`},IDGenerator(Y=null,Z="CCNNNN"){let Q=!1,J=Z.length,X=new R.SafeTrue;while(X.True){let z=Array(J);for(let G=0;G<J;G++)switch(Z[G]){case"C":{let H=R.getRandomInt(65,116);if(H>90)H+=6;z[G]=String.fromCharCode(H);continue}case"N":z[G]=R.getRandomInt(0,9).toString();continue;case"B":{let H=R.getRandomInt(48,109);if(H>57&&H<84)H+=7;else if(H>83)H+=13;z[G]=String.fromCharCode(H);continue}default:z[G]=Z[G];break}if(Y){if(Y instanceof Set)Q=Y.has(z);else Q=Y.includes(z);if(!Q)return z.join("")}else return z.join("")}return null},includesWord(Y,Z,Q=!1){if(!Q)Z=Z.toLowerCase(),Y=Y.toLowerCase();Z=Z.padStart(Z.length+1," ").padEnd(Z.length+2," ");let J=Z.search(Y);if(J!==-1){let X=Z.substring(J-1),z=Z.substring(J+Y.length);if(X.search(R.REGEXP.Seperators)==0&&z.search(R.REGEXP.Seperators)==0)return!0}return!1},IPC:class Y{static Listener=D8;#Z;#Q=new Map;#Y;#J=!1;#X=new Set;peersAddress="localhost";peersPort;listenPort;get protocol(){return this.#Y}constructor(Z="udp4",Q={}){if(!M8)throw Error("IPC is only available on JSRuntime, due to the use of Node modules");let{peersPort:J=null,peersAddress:X=null,listenPort:z=null}=typeof Q=="number"?{listenPort:Q}:Q;if(Z!="nodeworker"&&Z!="udp4"&&Z!="udp6")throw Error(`protocol must be 'nodeworker', 'udp4' or 'udp6' instead given '${Z}'`);if(this.#Y=Z,!R._modules.dgram&&Z!="nodeworker")throw Error(`module 'dgram' not loaded use 'Tools._modules.dgram = require("dgram")' to load it`);if(Z=="nodeworker"){if(!R._modules.worker_threads)throw Error(`module 'worker_threads' not loaded use 'Tools._modules.worker_threads = require("worker_threads")' to load it`);if(!z){if(R._modules.worker_threads.isMainThread)throw Error("when using `nodeworker` protocol, `port` must be provided if on the main thread");this.#Z=R._modules.worker_threads.parentPort,this.#z();return}if(!(z instanceof R._modules.worker_threads.Worker)&&z!==R._modules.worker_threads.parentPort&&z!=null)throw Error(`port must be a type of 'Worker' or a 'parentPort' instead given '${typeof z}'`);this.#Z=z,this.#z();return}if(!J)throw Error("peersPort must be provided for `udp4` or `udp6` protocol");this.listenPort=z,this.peersAddress=X,this.peersPort=J,this.#Z=R._modules.dgram.createSocket(Z),this.#z()}async#z(){if(this.#Z.on("message",this.#G),this.protocol=="nodeworker")return;if(!this.listenPort)return;try{this.#Z.bind(this.listenPort),this.#J=!0}catch(Z){switch(Z.code){case"ERR_SOCKET_BAD_PORT":throw new R.Err(`Tools.IPC: port ${this.listenPort} is not valid`,"IPC_ERR_SOCKET_BAD_PORT",Z.code,Z.stack);case"EADDRINUSE":throw new R.Err(`Tools.IPC: port ${this.listenPort} is already in use`,"IPC_EADDRINUSE",Z.code,Z.stack);default:throw R.Err.from(Z,"IPC_BIND_ERROR").message=`Tools.IPC: failed to bind port ${this.listenPort} `+Z.message}}}bind(Z,Q){if(this.protocol=="nodeworker")return;if(this.peersAddress=Z,this.listenPort=Q,!this.#J)this.#z();return this}close(){if(this.protocol=="nodeworker")return;this.#Z.close()}async advSend(Z,Q){return new Promise((J,X)=>{if(!Z)throw Error("channel must be provided");if(typeof Z!="string")throw Error(`channel must be a type of 'string' instead given '${typeof Z}'`);let{contents:z,UPID:G}=Q;if(!(z instanceof Array))z=[z];let H;try{H=this.protocol=="nodeworker"?{channel:Z,UPID:G,contents:z.map((W)=>{if(OB(W))return W;return"@JSON:"+JSON.stringify(W,R.JSONReplacer)})}:Buffer.from(JSON.stringify({channel:Z,UPID:G,contents:z},R.JSONReplacer))}catch(W){X(R.Err.from(W,"IPC_SERIALIZE_ERROR").message="Tools.IPC: failed to serialize payload,"+W.message);return}if(this.protocol=="nodeworker"){this.#Z.postMessage(H),J();return}this.#Z.send(H,this.peersPort,this.peersAddress,(W)=>{if(W)X(W);J()})})}async send(Z,...Q){return this.advSend(Z,{contents:Q})}on(Z,Q){let J=this.#Q.get(Z);if(!J){this.#Q.set(Z,[new D8(0,Q)]);return}return J.push(new D8(0,Q)),this}once(Z,Q,J=null){let X=this.#Q.get(Z);if(!X){this.#Q.set(Z,[new D8(1,Q,J)]);return}return X.push(new D8(1,Q,J)),this}remove(Z){if(typeof Z=="string")return this.#Q.delete(Z),!0;if(typeof Z!="function")throw Error(`listener must be a type of 'string' or 'function' instead given '${typeof Z}'`);for(let[Q,J]of this.#Q){let X=J.find((G)=>G.callback==Z);if(!X)continue;if(!J.filter((G)=>G.callback!=Z))return this.#Q.delete(Q),!0;return this.#Q.set(Q,J.filter((G)=>G.callback!=X)),!0}return!1}async ask(Z,Q,...J){return new Promise((X,z)=>{let G;if(Q)G=setTimeout(()=>{z(new R.Err(`Tools.IPC: ask timeout on channel: ${Z}`,"IPCAskTimeout"))},Q);let H=this.#H();this.once(Z,(W)=>{if(Q)clearTimeout(G);X(W)},H),this.advSend(Z,{contents:J,UPID:H})})}onAsk(Z,Q){let J=this,X=async function(...z){J.#X.add(this.UPID);let G=await Q(...z);J.advSend(Z,{contents:[G],UPID:this.UPID}),J.#X.delete(this.UPID)};return this.on(Z,X),this}#G=(Z)=>{let Q;try{Q=this.protocol=="nodeworker"?{channel:Z.channel,UPID:Z.UPID,contents:Z.contents.map((X)=>{if(typeof X=="string"&&X.startsWith("@JSON:"))return JSON.parse(X.slice(6),R.JSONReviver);return X})}:JSON.parse(Z.toString(),R.JSONReviver)}catch(X){throw R.Err.from(X,"IPC_DESERIALIZE_ERROR").message="Tools.IPC: failed to deserialize payload,"+X.message}let J=this.#Q.get(Q.channel);if(!J)return;for(let X of J){if(X.UPID){if(X.UPID!=Q.UPID)continue;this.#X.delete(X.UPID)}if(X.callback.call(Q,...Q.contents),X.type==1||X.UPID)this.remove(X.callback)}};#H(){let Z=R.IDGenerator(this.#X,"BBBBBBBB");return this.#X.add(Z),Z}},isArrayLike(Y){let Z=Y?.length;return Array.isArray(Y)||!!Y&&Z!=null&&typeof Y==="object"&&typeof Z==="number"&&(Z===0||Z>0&&(Z-1 in Y))},isArrowFunction(Y){if(typeof Y!=="function")return!1;if(Object.hasOwnProperty.call(Y,"prototype"))return!1;try{return Y.arguments,!1}catch{}return Y.toString().slice(0,20).includes("=>")},isAsyncFunction(Y){if(typeof Y!=="function")return!1;if(Y.constructor?.name==="AsyncFunction")return!0;return(Y instanceof R.CONSTS.AsyncFunction&&R.CONSTS.AsyncFunction!==Function&&R.CONSTS.AsyncFunction!==R.CONSTS.GeneratorFunction)===!0},isClass:(Y)=>{if(typeof Y!=="function")return!1;return Y.toString().startsWith("class")},isNumber:(Y)=>{return/^[0-9]+$|^[0-9]+\\.[0-9]+$/.test(Y)},isEmptyArray:(Y)=>R.isArrayLike(Y)&&!Y.length,isEmptyObject:(Y)=>!R.isArrayLike(Y)&&Y instanceof Object&&!R.propertiesCount(Y),isError(Y){return R.Err.isError(Y)},isValidFilePath(Y){if(!Y||!Y?.length)return!1;if(/[:?"<>|*]/g.test(Y))return!1;return!0},JSONReplacer(Y,Z){if(Z instanceof Map)return{"@dataType":"Map","@value":Array.from(Z.entries())};if(Z instanceof Set)return{"@dataType":"Set","@value":Array.from(Z.values())};switch(typeof Z){case"function":return{"@dataType":"function","@value":Z.toString().replace(/\n* {2,}|\n/g,"")};case"bigint":return{"@dataType":"BigInt","@value":Z.toString()};case"object":for(let Q in Z)if(Z[Q]instanceof Date)Z[Q]={"@dataType":"Date","@value":Z[Q].valueOf()};return Z}return Z},JSONReviver(Y,Z){if(!Z||!Z["@dataType"])return Z;switch(Z["@dataType"]){case"function":return Function("return "+Z["@value"])();case"BigInt":return BigInt(Z["@value"]);case"Map":return new Map(Z["@value"]);case"Set":return new Set(Z["@value"]);case"Date":return new Date(Z["@value"])}return Z},jsTime:{howLong(Y,Z=new Date){let Q=Z.getTime()-Y.getTime();return R.jsTime.getTimeFromMS(Q).modern()},getTimeFromMS(Y){let Z=0,Q=0,J=0,X=0,z=0,G=0,H=Y>262800200;while(Y>=1000)Y-=1000,G++;while(G>=60)G-=60,z++;while(z>=60)z-=60,X++;if(H){while(X>=24)X-=24,J++;while(J>=30.4167)J-=30.4167,Q++;J=Math.round(J);while(Q>=12)Q-=12,Z++}if(H)return{year:Z,month:Q,days:J,hr:X,min:z,sec:G,ms:Y,toString(){return`${Z}:${Q}:${J}|${X}:${z}:${G}.${Y.toString().padStart(3,"0")}`},modern(){if(Z+Q+J+G+z+X==0)return`${Y}ms`;else if(Z+Q+J+z+X==0)return`${G}.${Y}s`;else if(Z+Q+J+X==0)return`${z}min ${G}s`;else if(Z+Q+J==0)return`${X}hr ${z}min`;else if(Z+Q==0)return`${J}days ${X}hr`;else if(Z==0)return`${Q}months ${J}days`;else return`${Z}year ${Q}months`}};return{year:Z,month:Q,days:J,hr:X,min:z,sec:G,ms:Y,toString(){return`${X}:${z}:${G}.${Y.toString().padStart(3,"0")}`},modern(){if(G+z+X==0)return`${Y}ms`;else if(z+X==0)return`${G}.${Y}s`;else if(X==0)return`${z}min ${G}s`;else return`${X}hr ${z}min`}}}},lazySplit:function*(Y,Z){if(Z===""){for(let X of Y)yield X;return}let Q=0,J;while((J=Y.indexOf(Z,Q))!==-1)yield Y.substring(Q,J),Q=J+Z.length;yield Q?Y.substring(Q):Y},remap(Y,Z){if(Y instanceof Map){let J=new Map;for(let[X,z]of Y){let G=Z(X,z,J);if(G===void 0)continue;if(G===null)J.set(X,z);if(G.key===void 0)J.set(X,G);if(J.set(G.key,G.value),G.key!==X&&J.has(X))J.delete(X)}return J}let Q={};for(let J in Y){let X=Z(J,Y[J],Q);if(X===void 0)continue;if(X===null){Q[J]=Y[J];continue}if(X.key===void 0){Q[J]=X;continue}if(Q[X.key]=X.value,X.key!==J&&Q[J]!==void 0)delete Q[J]}return Q},MathKit:{clamp(Y,Z,Q){return Math.min(Math.max(Y,Z),Q)},degrees(Y){return Y*180/Math.PI},distanceFrom(Y,Z){let Q=Z.x-Y.x,J=Z.y-Y.y,X=Z.z-Y.z;return Math.sqrt(Q**2+(isNaN(J)?0:J**2)+(isNaN(X)?0:X**2))},dopri(Y,Z,Q,J,X=0.000001,z=1000,G){let H=[Y],W=[Q],K=[J(Y,Q)],$,V,q,M,B,D,T=[],_=0.2,w=[0.075,0.225],I=[0.9777777777777777,-3.7333333333333334,3.5555555555555554],E=[2.9525986892242035,-11.595793324188385,9.822892851699436,-0.2908093278463649],v=[2.8462752525252526,-10.757575757575758,8.906422717743473,0.2784090909090909,-0.2735313036020583],S=[0.09114583333333333,0,0.44923629829290207,0.6510416666666666,-0.322376179245283,0.13095238095238096],g=[0.10013431883002395,0,0.3918321794184259,-0.02982460176594817,0.05893268337240795,-0.04497888809104361,0.023904308236133973],d=[0.2,0.3,0.8,0.8888888888888888,1,1],m=[-0.0012326388888888888,0,0.0042527702905061394,-0.03697916666666667,0.05086379716981132,-0.0419047619047619,0.025],b=0,i,Y0,f=(Z-Y)/10,j0=0,b0,F8,E0,f0,IY,x0=new QX(H,W,K,T,-1,"");if(typeof G==="function")E0=G(Y,Q);while(Y<Z&&j0<z){if(++j0,Y+f>Z)f=Z-Y;if($=J(Y+d[0]*f,Q+_*f*K[b]),V=J(Y+d[1]*f,Q+w[0]*f*K[b]+w[1]*f*$),q=J(Y+d[2]*f,Q+I[0]*f*K[b]+I[1]*f*$+I[2]*f*V),M=J(Y+d[3]*f,Q+E[0]*f*K[b]+E[1]*f*$+E[2]*f*V+E[3]*f*q),B=J(Y+d[4]*f,Q+v[0]*f*K[b]+v[1]*f*$+v[2]*f*V+v[3]*f*q+v[4]*f*M),b0=Q+K[b]*f*S[0]+V*f*S[2]+q*f*S[3]+M*f*S[4]+B*f*S[5],D=J(Y+f,b0),i=K[b]*f*m[0]+V*f*m[2]+q*f*m[3]+M*f*m[4]+B*f*m[5]+D*f*m[6],F8=Math.abs(i),F8>X){if(f=0.2*f*Math.pow(X/F8,0.25),Y+f===Y){x0.msg="Step size became too small";break}continue}if(T[b]=Q+K[b]*f*g[0]+V*f*g[2]+q*f*g[3]+M*f*g[4]+B*f*g[5]+D*f*g[6],++b,H[b]=Y+f,W[b]=b0,K[b]=D,typeof G==="function"){let R8,O6=Y,w0=Y+0.5*f,H0;if(f0=G(w0,T[b-1]),IY=E0<0&&0<f0,IY){let a2,e4,YZ=0,I6=1,E6=1;while(!0){if(typeof E0==="number")H0=(E6*f0*O6-I6*E0*w0)/(E6*f0-I6*E0);else{H0=w0;for(Y0=E0.length-1;Y0!==-1;--Y0)if(E0[Y0]<0&&f0[Y0]>0)H0=Math.min(H0,(E6*f0[Y0]*O6-I6*E0[Y0]*w0)/(E6*f0[Y0]-I6*E0[Y0]))}if(H0<=O6||H0>=w0)break;if(R8=x0._at(H0,b-1),e4=G(H0,R8),a2=E0<0&&0<e4,a2){if(w0=H0,f0=e4,IY=a2,E6=1,YZ===-1)I6*=0.5;else I6=1;YZ=-1}else{if(O6=H0,E0=e4,I6=1,YZ===1)E6*=0.5;else E6=1;YZ=1}}return b0=x0._at(0.5*(Y+H0),b-1),x0.f[b]=J(H0,R8),x0.x[b]=H0,x0.y[b]=R8,x0.ymid[b-1]=b0,x0.events=IY,x0.iterations=j0,x0}O6=w0,w0=Y+f,E0=f0,f0=G(w0,b0),IY=E0<0&&0<f0}Y+=f,Q=b0,E0=f0,f=Math.min(0.8*f*Math.pow(X/F8,0.25),4*f)}return x0.iterations=j0,x0},integral(Y,Z,Q){if(Q>Z)throw Error("lower bound must be less than upper bound");if(Q==Z)return 0;if(!R._modules.mathjs)throw Error(`module 'mathjs' not loaded use 'Tools._modules.mathjs = require("mathjs")' to load it`);let J;if(typeof Y=="string")J=R._modules.mathjs.compile(Y);else J=Y;if(typeof Q=="string")Q=R._modules.mathjs.evaluate(Q);if(typeof Z=="string")Z=R._modules.mathjs.evaluate(Z);let X=(z)=>J.evaluate({x:z});return R.MathKit.dopri(Q,Z,0,X).at(Z)},lerp(Y,Z,Q){return Y+(Z-Y)*Q},Lsh_us(Y,Z){return Y*2**Z},not_us16(Y){return Y^65535},not_us32(Y){return Y^4294967295},not_us8(Y){return Y^255},map(Y,Z,Q,J,X){return Y=R.MathKit.clamp(Y,Z,Q),(Y-Z)/(Q-Z)*(X-J)+J},Point:ZX,radians(Y){return Y*Math.PI/180},Rsh_us(Y,Z){return Math.floor(Y/2**Z)},sum:(...Y)=>{return Y.flat(5).reduce((Z,Q)=>Z+Q,0)},toPolarCoords(Y,Z,Q="r"){if(!Q||Q!="d"&&Q!="r")throw Error("unit must be 'r' or 'd', given: "+Q);let J=Math.atan(Z/Y);if(Z<0&&Y<0)J+=360;else if(Y<0)J+=180;return{r:Math.sqrt(Y**2+Z**2),t:Q=="d"?J:R.MathKit.radians(J)}},toCartesianCoords(Y,Z,Q=null,J="r"){if(!J||J!="d"&&J!="r")throw Error("unit must be 'r' or 'd', given: "+J);if(Q!==null&&typeof Q!="number")throw Error("polar must be a number");if(J=="d"){if(Z=R.MathKit.radians(Z),Q!==null)Q=R.MathKit.radians(Q)}if(Q===null)return{x:Y*Math.cos(Z),y:Y*Math.sin(Z)};else return{x:Y*Math.sin(Q)*Math.cos(Z),y:Y*Math.sin(Q)*Math.sin(Z),z:Y*Math.cos(Q)}}},maxFraction(Y,Z,Q=!1){let J=Y.toString();if(!J.includes("."))return J;let X=10**Z;return Y=(Q?Math.floor(Y*X):Math.round(Y*X))/X,Y.toString()},ncc(Y=null,Z=null,Q=null){if(R.CheckCache.supportsColor===0)return"";if(Y==null)return"\x1B[0m";if(typeof Y=="number"){let X=R.Convert.decimalColorToRGB(Y);switch(Q?1:R.CheckCache.supportsColor){default:return"";case 1:Y=(Z=="bg"?"bg":"")+R.Convert.basicColorFromRgb(X);case 2:{let G=R.Convert._8bitColorFromRgb(X);return`\x1B[${Z=="bg"?"4":"3"}8;5;${G}m`}case 3:return`\x1B[${Z=="bg"?"4":"3"}8;2;${X.r};${X.g};${X.b}m`}}return Y=Y.toLowerCase(),{black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",italic:"\x1B[3m",underline:"\x1B[4m",blink:"\x1B[5m",invert:"\x1B[7m",hidden:"\x1B[8m",normal:"\x1B[22m",bgblack:"\x1B[40m",bgred:"\x1B[41m",bggreen:"\x1B[42m",bgyellow:"\x1B[43m",bgblue:"\x1B[44m",bgmagenta:"\x1B[45m",bgcyan:"\x1B[46m",bgwhite:"\x1B[47m"}[Y]||"\x1B[37m"},nearestNumber(Y,Z){let Q=1/0,J=null;for(let X=0,z=Y[X];X<Y.length;){let G=Math.abs(Z-z);if(!G)return X;if(G<Q)Q=G,J=X;z=Y[++X]}return J},objectMap(Y,Z){return R.remap(Y,Z)},objValueAt(Y,Z){return Y[Object.keys(Y).at(Z)]},objToString(Y,Z={}){let{maxDepth:Q=4,indent:J=3,maxKeys:X=20,color:z=!1,defColor:G=void 0,noHeader:H=!1}=Z;if(Q<1)Q=1;let W={color:z,defColor:G},K=typeof J=="number"?" ".repeat(J):J,$=null;if(z)$={cyan:R.ncc(4764610),magenta:R.ncc(11550650),gray:R.ncc(4802889),yellow:R.ncc(12754962),_default:R.ncc(G)};if(Y==null||typeof Y!=="object")return R.yuString(Y,W);if(R.isArrayLike(Y))return R.arrToString(Y,{color:z,defColor:G,maxDepth:Q,indent:J});if(Y instanceof Map||Y instanceof Set||Y instanceof Promise||Y instanceof Date||Y instanceof RegExp)return R.yuString(Y,W);if(R.isError(Y))return R.Err.toString(Y,{color:z,defColor:G});let V=Y.constructor?.name||"Object",q=V!=="Object",B=Object.keys(Y).length,D="";if(!H&&(q||B>5))if(z)D=$.magenta+`${V}(${B}) `+$._default;else D=`${V}(${B}) `;return D+T(Y,0);function T(_,w,I=0){if(w>Q-1)if(z)return $.gray+"... {Object}"+$._default;else return"... {Object}";if(_==null)return R.yuString(_,W);if(typeof _!=="object"||_ instanceof Date||_ instanceof RegExp)return R.yuString(_,W);if(R.isArrayLike(_))return R.arrToString(_,{color:z,defColor:G,maxDepth:Q-w,indent:J,noHeader:!0});if(_ instanceof Map||_ instanceof Set)return R.yuString(_,W);let E=Object.keys(_),v=E.length;if(v===0)return"{}";let S=v>3||w>0,g=I?K.repeat(I):"",d=g+K,m=S?`{
|
|
14
|
+
`+d:"{ ",b=Math.min(E.length,X-1);for(let i=0;i<b;i++){let Y0=E[i],f=_[Y0];if(z)m+=$.cyan+Y0+$._default+": ";else m+=Y0+": ";if(f&&typeof f==="object"&&!R.isArrayLike(f)&&!(f instanceof Date)&&!(f instanceof RegExp)&&!(f instanceof Map)&&!(f instanceof Set)&&!(f instanceof Promise)){let j0=f.constructor?.name||"Object";if(j0!=="Object"&&z)m+=$.magenta+j0+" "+$._default;else if(j0!=="Object")m+=j0+" ";m+=T(f,w+1,S?I+1:I)}else m+=R.yuString(f,W);if(i<b-1)m+=S?`,
|
|
15
|
+
`+d:", "}if(E.length>X-1){let i=E.length-b;if(z)m+=S?`,
|
|
16
|
+
`+d:", ",m+=$.gray+`... (${i} more)`+$._default;else m+=S?`,
|
|
17
|
+
`+d:", ",m+=`... (${i} more)`}return m+=S?`
|
|
18
|
+
`+g+"}":" }",m}},propertiesCount(Y){return Object.keys(Y).length},padEnd(Y,Z,Q=" ",J=0){let X=R.ex_length(Y,J);if(X>=Z)return Y;return Y+Q.repeat(Z-X)},padStart(Y,Z,Q=" ",J=0){let X=R.ex_length(Y,J);if(X>=Z)return Y;return Q.repeat(Z-X)+Y},parseArgs(Y,Z,Q=!1){let J={_unmatched:[]},X=new Set;for(let G in Z)if(Z[G]?.required)X.add(G);for(let G=0;G<Y.length;G++){let H=!1;for(let W in Z){if(!Z[W]?.pattern)throw Error("invalid template: Object structure missmatched. every entries requires `pattern` property");if(!z(Y[G],Z[W].pattern))continue;if(X.delete(W),Z[W]?.isFlag||Z[W]?.type=="flag"){H=!0,J[W]=new CY(!0,"flag",G);continue}let K=!1;if(G+1<Y.length){for(let $ in Z)if(z(Y[G+1],Z[$].pattern))K=!0}if(G+1>=Y.length||K)throw Error(`argument '${Y[G]}' requires a Value`);switch(Z[W]?.type){case"int":if(isNaN((J[W]=new CY(parseInt(Y[++G]),Z[W]?.type,G)).value))throw Error(`argument '${Y[G-1]}' requires a Value of type '${Z[W]?.type}'`);break;case"float":if(isNaN((J[W]=new CY(parseFloat(Y[++G]),Z[W]?.type,G)).value))throw Error(`argument '${Y[G-1]}' requires a Value of type '${Z[W]?.type}'`);break;case"choice":if(!Z[W]?.choices?.length)throw Error("invalid template: Object structure missmatched. entry of type 'choice' requires `choices` property");if(!z(Y[++G],Z[W].choices)&&Z[W]?.default==null)throw Error(`invalid value for '${Y[G-1]}' argument, requires any of these Choices: ${Z[W].choices}`);J[W]=new CY(Y[G],Z[W]?.type,G);break;case"string":case void 0:J[W]=new CY(Y[++G],Z[W]?.type,G);break;default:throw Error(`invalid template: entry of type '${Z[W]?.type}' is not supported`)}H=!0}if(!H)J._unmatched.push(new CY(Y[G],void 0,G))}if(X.size>0)throw Error(`argument(s) '${[...X]}' is required.`);for(let G in Z){if(Z[G]?.isFlag||Z[G]?.type=="flag"){if(!J[G])J[G]=new CY(!1,"flag");continue}if(!J[G])J[G]=new CY(Z[G]?.default?Z[G]?.default:null,Z[G]?.type)}return J;function z(G,H){for(let W of H){if(!Q){if(G.toLowerCase()==W.toLowerCase())return!0;continue}if(G==W)return!0}return!1}},parseBool(Y,Z=!1){if(typeof Y=="boolean")return Y;Y=Y.toLowerCase();let Q=Y=="true"?!0:!1;if(!Z)return Q;if(!(Y=="true"||Y=="false"))return null;return Q},parseConfig(Y,Z=null,Q={}){let{ignoreGroups:J=!1,multiValues:X=!1}=Q,z=R.cleanArr(Y.trim().split(`
|
|
19
|
+
`),["","\r"]),G={},H=null,W="",K,$=0,V=!1;for(let M=0;M<z.length;M++){let B=z[M].trim();if(/^[#;]/.test(B))continue;if(B.startsWith("[")){if(J)continue;{let E=!1;for(let v=1;v<B.length;v++)if(B[v]=="]"&&B[v-1]!="\\"){if(H=B.slice(1,v),!G[H])G[H]={};E=!0;break}if(!E)throw Error(`Tools.parseConfig(): invalid syntax, missing ']' at the end of the group. at \`${B}\``);else continue}}if(V){if(W+=z[M],!q(M,z))continue;if(V=!1,H)G[H][K]=JSON.parse(W,Z);else G[K]=JSON.parse(W,Z);continue}let D=R.cleanArr(B.split("="));if(D.length>2)throw Error(`Tools.parseConfig(): invalid syntax, '=' cannot occur more than one time. at \`${B}\``);else if(D.length==1&&!V)if(B.includes("="))throw Error(`Tools.parseConfig(): invalid syntax, expected expresion after '='. at \`${B}\``);else throw Error(`Tools.parseConfig(): expected expresion. at \`${B}\``);else if(!D.length)throw Error(`Tools.parseConfig(): unknown operator. \`${B}\``);D=[D[0].trim(),D[1].trim()];let T=R.getMatchAllIndexes(D[1].matchAll(/["']/g)).filter((E,v,S)=>{if(D[1][E-1]=="\\"){D[1]=D[1].slice(0,E-1)+D[1].slice(E);for(let g=v+1;g<S.length;g++)S[g]--;return!1}return!0}),_=D[1].search("#"),w=T[0],I=!1;if(w!=null&&(_==-1||w<_)){let E=T[1]==null?-1:T[1],v=D[1].slice(E+2).trim();if(v&&!/^[#;]/.test(v))throw Error(`Tools.parseConfig(): invalid syntax, unexpected charactor(s).
|
|
20
20
|
at \`${B}\`
|
|
21
|
-
`+"".padStart(
|
|
21
|
+
`+"".padStart(E+10+D[0].length," ")+"^");if(E==-1)throw Error(`Tools.parseConfig(): invalid syntax, missing closing quote.
|
|
22
22
|
at \`${B}\`
|
|
23
|
-
`+" ".padStart(
|
|
24
|
-
`),this.reset()}reset(){this.progress=0,this.#Z=0,this.spd=0,this.lastCheck=Date.now(),this.#Q=!0}setPrintTemplate(Z){Z=Z.replace(/%total%/g,"${this.total}"),Z=Z.replace(/%spd%/g,"${this.spd.toFixed(1)}"),Z=Z.replace(/%prog%/g,"${this.progress}"),this.#Y=Function("this.stdout.write(`"+Z+"`);").bind(this)}},proximate(Y,Z,Q){if(Y<Z+Q&&Y>Z-Q)return Z;else return Y},randomPick(Y){if(Y.length<=1)return Y[0];return Y[Math.floor(Math.random()*Y.length)]},redexOf(Y,Z,Q=0){let
|
|
25
|
-
`;else if(typeof
|
|
23
|
+
`+" ".padStart(w+7+D[0].length," ")+"^");I=!0,D[1]=D[1].slice(w+1,E)}else if(_!=-1){if(D[1]=D[1].slice(0,D[1].indexOf("#")).trim(),!D[1])throw Error(`Tools.parseConfig(): invalid syntax, expected expresion after '='. at \`${B}\``)}if(/^[0-9]/.test(D[0]))throw Error(`Tools.parseConfig(): Key cannot starts with Numbers. at \`${B}\``);{let E=D[0].replace(/[a-z$_0-9.]/ig,"");if(E.length!==0)throw Error(`Tools.parseConfig(): these character(s) "${E}" can not be Parse. at \`${B}\``)}if(/^[[{]/.test(D[1])){if($=0,[K,W]=D,q(1,D)){if(H)G[H][K]=JSON.parse(W,Z);else G[K]=JSON.parse(W,Z);continue}V=!0;continue}{let E=H?G[H]:G;if(X&&Object.hasOwnProperty.call(E,D[0])){if(E[D[0]].$multiValues===void 0)E[D[0]]=[E[D[0]]],E[D[0]].$multiValues=!0;E[D[0]].push(I?D[1]:R.parseValue(D[1]))}else E[D[0]]=I?D[1]:R.parseValue(D[1])}}return G;function q(M,B){if($+=[...B[M].matchAll(R.REGEXP.OpenSCBrackets)].filter((D)=>D[1]).length,$-=[...B[M].matchAll(R.REGEXP.CloseSCBrackets)].filter((D)=>D[1]).length,$<=0)return!0;return!1}},parseValue(Y){if(typeof Y!="string")return Y;switch(Y.toLowerCase()){case"true":return!0;case"false":return!1;case"null":return null;case"":case"undefined":return;default:if(!isNaN(Y))return Number(Y);return Y}},pass(Y,Z=null){if(Z)Z(Y);else console?.log(Y);return Y},Progress:class Y{stdout=process.stdout;progress=0;spd=0;lastCheck=null;printInterval;updateInterval;total;#Z=0;#Q=!0;#Y;constructor(Z,Q=null,J=500,X=100){if(!Z)throw Error("printTemplate is required");this.total=Q,this.printInterval=J,this.updateInterval=X,this.setPrintTemplate(Z),this.lastCheck=Date.now()}update(Z=1){if(!this.#Y)return;this.#Z+=Z,this.progress+=Z;let Q=Date.now()-this.lastCheck;if(Q>this.updateInterval&&this.#Z>4)this.spd=this.#Z*this.updateInterval/Q,this.#Z=0,this.lastCheck=Date.now();if(this.lastPrint+this.printInterval>Date.now())return;if(this.lastPrint=Date.now(),!this.#Q)this.stdout.clearLine(),this.stdout.cursorTo(0);else this.#Q=!1;if(!this.total){this.#Y();return}this.#Y()}done(){if(this.progress!=this.total){if(!this.#Q)this.stdout.clearLine(),this.stdout.cursorTo(0);this.progress=this.total,this.#Y()}this.stdout.write(`
|
|
24
|
+
`),this.reset()}reset(){this.progress=0,this.#Z=0,this.spd=0,this.lastCheck=Date.now(),this.#Q=!0}setPrintTemplate(Z){Z=Z.replace(/%total%/g,"${this.total}"),Z=Z.replace(/%spd%/g,"${this.spd.toFixed(1)}"),Z=Z.replace(/%prog%/g,"${this.progress}"),this.#Y=Function("this.stdout.write(`"+Z+"`);").bind(this)}},proximate(Y,Z,Q){if(Y<Z+Q&&Y>Z-Q)return Z;else return Y},randomPick(Y){if(Y.length<=1)return Y[0];return Y[Math.floor(Math.random()*Y.length)]},redexOf(Y,Z,Q=0){let J=typeof this!=="string";if(!Y&&J)return-1;if(!J)Y=this;if(!Y.length)return-1;if(!(Z instanceof RegExp))if(Q>=0)return Y.indexOf(Z,Q);else return Y.lastIndexOf(Z,Y.length+Q);let X,z;if(Q>=0){X=-1;do{z=Y.substring(++X);let G=z.search(Z);if(G==-1)return-1;X=G+X}while(X<Q)}else{X=-1;do{z=Y.substring(++X);let G=z.search(Z);if(G==-1)return X-1;X=G+X}while(X<Y.length+Q)}return X},REGEXP:Object.freeze({Seperators:/[-\s_・⧸/\\;:()[\]、,.'""!^**=+「【】」()]/g,SoftWrapSeperators:/(?<!\x1b\[\d{1,3}(?:;\d{1,3})*|\x1b\]8;;[^\x07]+|\x1b|\x07)[\s,.\]})]/g,HardWrapSeperators:/(?<!\x1b\[\d{1,3}(?:;\d{1,3})*|[\x1b\x07]\]8;*[^\x07]*|\x1b|\x07)[-\s_・⧸/\\;:()\[\]、,.'""!^**=+「【】」()]/g,ValidEmail:/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,ANSICode:/\x1b\[\d{1,3}(?:;\d{1,3})*m|\x1b\]8;;|(?<=[^\x07]+)\x07[^\x07]+\]8;;\x07/g,EmojiDetection:new RegExp(t2),EmojiEach:new RegExp(t2,"g"),EmojiEachGroup:new RegExp("(?:"+t2+")+","g"),IniGroups:/^[\t ]*\[(.+)\][\t ]*$/gm,JSComments:/\\"|"(?:\\"|[^"])*"|(\/\/.*|\/\*[\s\S]*?\*\/)/g,OpenSCBrackets:/\\"|"(?:\\"|[^"])*"|([[{])/g,CloseSCBrackets:/\\"|"(?:\\"|[^"])*"|([\]}])/g}),resolveNodeEnv(Y,Z=/%(\w+)%/g){return Y.replace(Z,(Q,J)=>{let X=J;if(process.env[X]==null)return Q;return process.env[X]})},SafeTrue:class Y{#Z=0;limit=0;noWarning=!1;constructor(Z=10000000000,Q=!1){this.limit=Z,this.noWarning=Q}get True(){if(this.#Z++>=this.limit){if(!this.noWarning)process?.emitWarning("SafeTrue limit reached");return!1}return!0}},search(Y,Z,Q={}){let J=R.REGEXP.Seperators,X=Q.maxResult,z=Q.TF_IDFMaps instanceof Array?[...Q.TF_IDFMaps]:Q.TF_IDFMaps;if(!X)if(typeof Q=="number")X=Q;else X=1/0;if(Z=Z.trim().toLowerCase(),Z=="")return null;let G=[...Y];if(G.forEach((K,$,V)=>V[$]=K.trim().toLowerCase()),z==="builtin")z=R.DataScienceKit.TFIDF_of(G.concat(Z).map((K)=>R.cleanArr(K.split(J))));class H{constructor(K,$,V=-1,q=null){this.score=$,this.string=K,this.matchIndex=V,this.scores=q}}let W=[];for(let K=0;K<G.length;K++){let $=G[K].replace(J,"");if(G[K]==Z||$==Z)W.unshift(new H(Y[K],Z.length<<2,K));let V,q,M,B;V=q=M=B=0;for(let T of R.cleanArr(Z.split(J))){let _=0;if(R.includesWord(T,G[K],!1))if(z&&z[K]?.has(T))_=T.length*z[K].get(T).TF_IDF*2.9,V+=_;else _=T.length,q+=_;else if(G[K].includes(T))_=T.length*0.3,M+=_;let w=R.DataScienceKit.LCSLength_of(T,G[K])*0.4;B+=w}let D=V+q+M+B;W.push(new H(null,D,K,{tfidf_s:V,word_s:q,includes_s:M,lcs_s:B,TF_IDFMap:z?.[K]}))}W.sort((K,$)=>$.score-K.score);for(let K=0;K<X;K++){if(!W[K])break;if(W[K].string!=null)continue;W[K].string=Y[W[K].matchIndex]}return W.slice(0,X)},sleep(Y){if(!Y||Y<0)return;let Z=Date.now();while(Date.now()-Z<Y);},SpawnMirror:class Y{static STDIO_MIRROR=["inherit","pipe","pipe"];static createMirror(Z){Z?.stdout?.pipe(process.stdout),Z?.stderr?.pipe(process.stderr)}},strClamp(Y,Z,Q="mid",J=0){let X=R.ex_length(Y,J);if(X<=Z)return Y.padEnd(Z," ");let z=X-(X-Z)-3;switch(Q){default:if(M8)process?.emitWarning(`'${Q}' is not a valid location type.`);else throw Error(`'${Q}' is not a valid location type.`);case"mid":{let G=z>>1;return R.strSlice(Y,0,G,J)+"..."+R.strSlice(Y,X-G,void 0,J)}case"end":return R.strSlice(Y,0,z,J)+"...";case"start":return"..."+R.strSlice(Y,z,void 0,J)}},stringifyConfig(Y,Z={}){let{ignoreList:Q=[],minify:J=!1,replacer:X,mode:z="merge",useIniGroup:G=!1,alwaysWrapStrInQuotes:H=!1,oldConfigStr:W=""}=Z,K=new R.SafeTrue(1e5),$=z=="merge"?W:"";for(let B in Y){if(Q.includes(B))continue;if(!G){V(B,Y);continue}if(B===""||typeof Y[B]!=="object"){V(B,Y,"");continue}for(let D in Y[B]){if(Q.includes(D))continue;V(D,Y[B],B)}}return $;function V(B,D,T,_=!1){let w="";if(D[B]!=null&&typeof D[B]==="object")if(D[B].$multiValues){for(let i of D[B])V(B,{[B]:i},T,!0);return}else w=`${JSON.stringify(D[B],X,J?null:3)}
|
|
25
|
+
`;else if(typeof D[B]=="string")if(H||/\s|[{[}\]]/.test(D[B]))w=`"${D[B]}"`;else w=`${D[B]}`;else w=`${D[B]}`;let I=_?-1:R.redexOf($,new RegExp(`^[ \\t]*\\b${B}\\s*=`,"m")),E;if(T==="")E=-3;else E=G?$.indexOf(`[${T}]`):null;let v=E===-1;if(v)E=$.length+2,$+=`
|
|
26
26
|
|
|
27
27
|
[${T}]
|
|
28
|
-
`;if(
|
|
29
|
-
`:`${B} = ${
|
|
30
|
-
`;if(G)if(
|
|
31
|
-
`;else{let
|
|
32
|
-
$`,"m"),
|
|
33
|
-
`?
|
|
34
|
-
`,
|
|
35
|
-
Reason: loop limit reached`);return T+1}function
|
|
36
|
-
`)){let
|
|
37
|
-
`),
|
|
38
|
-
|
|
39
|
-
`,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
`
|
|
46
|
-
`}),Q
|
|
47
|
-
`,Q}var SK=null;var vK=i5(()=>{Y0()});function e(Y){if(typeof Y!=="object"||Y===null)return!1;let Z=Object.getPrototypeOf(Y);return(Z===null||Z===Object.prototype||Object.getPrototypeOf(Z)===null)&&!(Symbol.toStringTag in Y)&&!(Symbol.iterator in Y)}import{fileURLToPath as rK}from"node:url";var D6=(Y,Z)=>{let Q=Q7(eK(Y));if(typeof Q!=="string")throw TypeError(`${Z} must be a string or a file URL: ${Q}.`);return Q},eK=(Y)=>Z7(Y)?Y.toString():Y,Z7=(Y)=>typeof Y!=="string"&&Y&&Object.getPrototypeOf(Y)===String.prototype,Q7=(Y)=>Y instanceof URL?rK(Y):Y;var p8=(Y,Z=[],Q={})=>{let X=D6(Y,"First argument"),[J,$]=e(Z)?[[],Z]:[Z,Q];if(!Array.isArray(J))throw TypeError(`Second argument must be either an array of arguments or an options object: ${J}`);if(J.some((H)=>typeof H==="object"&&H!==null))throw TypeError(`Second argument must be an array of strings: ${J}`);let G=J.map(String),K=G.find((H)=>H.includes("\x00"));if(K!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${K}`);if(!e($))throw TypeError(`Last argument must be an options object: ${$}`);return[X,G,$]};import{ChildProcess as GH}from"node:child_process";import{StringDecoder as YH}from"node:string_decoder";var{toString:n5}=Object.prototype,a5=(Y)=>n5.call(Y)==="[object ArrayBuffer]",G0=(Y)=>n5.call(Y)==="[object Uint8Array]",r0=(Y)=>new Uint8Array(Y.buffer,Y.byteOffset,Y.byteLength),ZH=new TextEncoder,o5=(Y)=>ZH.encode(Y),QH=new TextDecoder,c8=(Y)=>QH.decode(Y),s5=(Y,Z)=>{return XH(Y,Z).join("")},XH=(Y,Z)=>{if(Z==="utf8"&&Y.every(($)=>typeof $==="string"))return Y;let Q=new YH(Z),X=Y.map(($)=>typeof $==="string"?o5($):$).map(($)=>Q.write($)),J=Q.end();return J===""?X:[...X,J]},F1=(Y)=>{if(Y.length===1&&G0(Y[0]))return Y[0];return X7(JH(Y))},JH=(Y)=>Y.map((Z)=>typeof Z==="string"?o5(Z):Z),X7=(Y)=>{let Z=new Uint8Array($H(Y)),Q=0;for(let X of Y)Z.set(X,Q),Q+=X.length;return Z},$H=(Y)=>{let Z=0;for(let Q of Y)Z+=Q.length;return Z};var Y3=(Y)=>Array.isArray(Y)&&Array.isArray(Y.raw),Z3=(Y,Z)=>{let Q=[];for(let[$,G]of Y.entries())Q=KH({templates:Y,expressions:Z,tokens:Q,index:$,template:G});if(Q.length===0)throw TypeError("Template script must not be empty");let[X,...J]=Q;return[X,J,{}]},KH=({templates:Y,expressions:Z,tokens:Q,index:X,template:J})=>{if(J===void 0)throw TypeError(`Invalid backslash sequence: ${Y.raw[X]}`);let{nextTokens:$,leadingWhitespaces:G,trailingWhitespaces:K}=HH(J,Y.raw[X]),H=r5(Q,$,G);if(X===Z.length)return H;let W=Z[X],z=Array.isArray(W)?W.map((q)=>e5(q)):[e5(W)];return r5(H,z,K)},HH=(Y,Z)=>{if(Z.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let Q=[],X=0,J=t5.has(Z[0]);for(let G=0,K=0;G<Y.length;G+=1,K+=1){let H=Z[K];if(t5.has(H)){if(X!==G)Q.push(Y.slice(X,G));X=G+1}else if(H==="\\"){let W=Z[K+1];if(W===`
|
|
48
|
-
`)G-=1,K+=1;else if(W==="u"&&Z[K+2]==="{")K=Z.indexOf("}",K+3);else K+=zH[W]??1}}let $=X===Y.length;if(!$)Q.push(Y.slice(X));return{nextTokens:Q,leadingWhitespaces:J,trailingWhitespaces:$}},t5=new Set([" ","\t","\r",`
|
|
49
|
-
`]),zH={x:3,u:5},r5=(Y,Z,Q)=>Q||Y.length===0||Z.length===0?[...Y,...Z]:[...Y.slice(0,-1),`${Y.at(-1)}${Z[0]}`,...Z.slice(1)],e5=(Y)=>{let Z=typeof Y;if(Z==="string")return Y;if(Z==="number")return String(Y);if(e(Y)&&(("stdout"in Y)||("isMaxBuffer"in Y)))return WH(Y);if(Y instanceof GH||Object.prototype.toString.call(Y)==="[object Promise]")throw TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}.");throw TypeError(`Unexpected "${Z}" in template expression`)},WH=({stdout:Y})=>{if(typeof Y==="string")return Y;if(G0(Y))return c8(Y);if(Y===void 0)throw TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`);throw TypeError(`Unexpected "${typeof Y}" stdout in template expression`)};import{spawnSync as MV}from"node:child_process";import{debuglog as UH}from"node:util";import J7 from"node:process";var y0=(Y)=>l8.includes(Y),l8=[J7.stdin,J7.stdout,J7.stderr],j0=["stdin","stdout","stderr"],i8=(Y)=>j0[Y]??`stdio[${Y}]`;var X3=(Y)=>{let Z={...Y};for(let Q of K7)Z[Q]=$7(Y,Q);return Z},$7=(Y,Z)=>{let Q=Array.from({length:qH(Y)+1}),X=VH(Y[Z],Q,Z);return DH(X,Z)},qH=({stdio:Y})=>Array.isArray(Y)?Math.max(Y.length,j0.length):j0.length,VH=(Y,Z,Q)=>e(Y)?BH(Y,Z,Q):Z.fill(Y),BH=(Y,Z,Q)=>{for(let X of Object.keys(Y).sort(FH))for(let J of RH(X,Q,Z))Z[J]=Y[X];return Z},FH=(Y,Z)=>Q3(Y)<Q3(Z)?1:-1,Q3=(Y)=>{if(Y==="stdout"||Y==="stderr")return 0;return Y==="all"?2:1},RH=(Y,Z,Q)=>{if(Y==="ipc")return[Q.length-1];let X=G7(Y);if(X===void 0||X===0)throw TypeError(`"${Z}.${Y}" is invalid.
|
|
50
|
-
It must be "${Z}.stdout", "${Z}.stderr", "${Z}.all", "${Z}.ipc", or "${Z}.fd3", "${Z}.fd4" (and so on).`);if(X>=Q.length)throw TypeError(`"${Z}.${Y}" is invalid: that file descriptor does not exist.
|
|
51
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);return X==="all"?[1,2]:[X]},G7=(Y)=>{if(Y==="all")return Y;if(j0.includes(Y))return j0.indexOf(Y);let Z=MH.exec(Y);if(Z!==null)return Number(Z[1])},MH=/^fd(\d+)$/,DH=(Y,Z)=>Y.map((Q)=>Q===void 0?TH[Z]:Q),LH=UH("execa").enabled?"full":"none",TH={lines:!1,buffer:!0,maxBuffer:1e8,verbose:LH,stripFinalNewline:!0},K7=["lines","buffer","maxBuffer","verbose","stripFinalNewline"],e0=(Y,Z)=>Z==="ipc"?Y.at(-1):Y[Z];var L6=({verbose:Y},Z)=>H7(Y,Z)!=="none",T6=({verbose:Y},Z)=>!["none","short"].includes(H7(Y,Z)),J3=({verbose:Y},Z)=>{let Q=H7(Y,Z);return n8(Q)?Q:void 0},H7=(Y,Z)=>Z===void 0?_H(Y):e0(Y,Z),_H=(Y)=>Y.find((Z)=>n8(Z))??a8.findLast((Z)=>Y.includes(Z)),n8=(Y)=>typeof Y==="function",a8=["none","short","full"];import{inspect as pH}from"node:util";import{platform as wH}from"node:process";import{stripVTControlCharacters as NH}from"node:util";var $3=(Y,Z)=>{let Q=[Y,...Z],X=Q.join(" "),J=Q.map(($)=>AH(G3($))).join(" ");return{command:X,escapedCommand:J}},R1=(Y)=>NH(Y).split(`
|
|
52
|
-
`).map((Z)=>G3(Z)).join(`
|
|
53
|
-
`),G3=(Y)=>Y.replaceAll(EH,(Z)=>OH(Z)),OH=(Y)=>{let Z=CH[Y];if(Z!==void 0)return Z;let Q=Y.codePointAt(0),X=Q.toString(16);return Q<=kH?`\\u${X.padStart(4,"0")}`:`\\U${X}`},PH=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},EH=PH(),CH={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},kH=65535,AH=(Y)=>{if(IH.test(Y))return Y;return wH==="win32"?`"${Y.replaceAll('"','""')}"`:`'${Y.replaceAll("'","'\\''")}'`},IH=/^[\w./-]+$/;import K3 from"node:process";function z7(){let{env:Y}=K3,{TERM:Z,TERM_PROGRAM:Q}=Y;if(K3.platform!=="win32")return Z!=="linux";return Boolean(Y.WT_SESSION)||Boolean(Y.TERMINUS_SUBLIME)||Y.ConEmuTask==="{cmd::Cmder}"||Q==="Terminus-Sublime"||Q==="vscode"||Z==="xterm-256color"||Z==="alacritty"||Z==="rxvt-unicode"||Z==="rxvt-unicode-256color"||Y.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var H3={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"½",oneThird:"⅓",oneQuarter:"¼",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"¾",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},z3={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},jH={tick:"√",info:"i",warning:"‼",cross:"×",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},xH={...H3,...z3},SH={...H3,...jH},yH=z7(),vH=yH?xH:SH,o8=vH,ID=Object.entries(z3);import fH from"node:tty";var hH=fH?.WriteStream?.prototype?.hasColors?.()??!1,i=(Y,Z)=>{if(!hH)return(J)=>J;let Q=`\x1B[${Y}m`,X=`\x1B[${Z}m`;return(J)=>{let $=J+"",G=$.indexOf(X);if(G===-1)return Q+$+X;let K=Q,H=0,z=(Z===22?X:"")+Q;while(G!==-1)K+=$.slice(H,G)+z,H=G+X.length,G=$.indexOf(X,H);return K+=$.slice(H)+X,K}},SD=i(0,0),W3=i(1,22),yD=i(2,22),vD=i(3,23),fD=i(4,24),hD=i(53,55),bD=i(7,27),gD=i(8,28),mD=i(9,29),uD=i(30,39),dD=i(31,39),pD=i(32,39),cD=i(33,39),lD=i(34,39),iD=i(35,39),nD=i(36,39),aD=i(37,39),s8=i(90,39),oD=i(40,49),sD=i(41,49),tD=i(42,49),rD=i(43,49),eD=i(44,49),YL=i(45,49),ZL=i(46,49),QL=i(47,49),XL=i(100,49),U3=i(91,39),JL=i(92,39),q3=i(93,39),$L=i(94,39),GL=i(95,39),KL=i(96,39),HL=i(97,39),zL=i(101,49),WL=i(102,49),UL=i(103,49),qL=i(104,49),VL=i(105,49),BL=i(106,49),FL=i(107,49);var F3=({type:Y,message:Z,timestamp:Q,piped:X,commandId:J,result:{failed:$=!1}={},options:{reject:G=!0}})=>{let K=bH(Q),H=gH[Y]({failed:$,reject:G,piped:X}),W=mH[Y]({reject:G});return`${s8(`[${K}]`)} ${s8(`[${J}]`)} ${W(H)} ${W(Z)}`},bH=(Y)=>`${t8(Y.getHours(),2)}:${t8(Y.getMinutes(),2)}:${t8(Y.getSeconds(),2)}.${t8(Y.getMilliseconds(),3)}`,t8=(Y,Z)=>String(Y).padStart(Z,"0"),V3=({failed:Y,reject:Z})=>{if(!Y)return o8.tick;return Z?o8.cross:o8.warning},gH={command:({piped:Y})=>Y?"|":"$",output:()=>" ",ipc:()=>"*",error:V3,duration:V3},B3=(Y)=>Y,mH={command:()=>W3,output:()=>B3,ipc:()=>B3,error:({reject:Y})=>Y?U3:q3,duration:()=>s8};var R3=(Y,Z,Q)=>{let X=J3(Z,Q);return Y.map(({verboseLine:J,verboseObject:$})=>uH(J,$,X)).filter((J)=>J!==void 0).map((J)=>dH(J)).join("")},uH=(Y,Z,Q)=>{if(Q===void 0)return Y;let X=Q(Y,Z);if(typeof X==="string")return X},dH=(Y)=>Y.endsWith(`
|
|
28
|
+
`;if(I==-1){let i=J?`${B}=${w}
|
|
29
|
+
`:`${B} = ${w}
|
|
30
|
+
`;if(G)if(v)$+=i+`
|
|
31
|
+
`;else{let Y0=R.redexOf($,new RegExp(`^\\s*
|
|
32
|
+
$`,"m"),E);$=R.strSplice($,Y0,0,i)}else $+=i;return}let S=null,g=null;if(G)S=R.redexOf($.slice(0,I),R.REGEXP.IniGroups,-1),g=S==E?T:$.slice(S+1,$.slice(S,I).indexOf("]")+S);let d=$.indexOf("=",I)+1,m=R.getMatchAllIndexes($.slice(d).matchAll(/(?<!\\)[#\n;]/g))?.[0]??-1;if(m==-1)m=$.length;else m+=d;let b=$[m]===`
|
|
33
|
+
`?m:$.indexOf(`
|
|
34
|
+
`,m+1);if(M(d,m))m=q(d);if(g&&g!==T){let i=$.slice(I,b+1),Y0=b-I,f=d-I,j0=m-I;if($=R.strSplice($,I,Y0+1,""),E>I)E-=Y0;else E++;I=E+T.length+2,d=I+f,m=I+j0,$=R.strSplice($,I,0,i)}$=R.strSplice($,d,m-d,(J?"":" ")+w);{let i=0;while($[d+(i-2)]==" ")i--;if(J&&i<0)$=R.strSplice($,d+i-1,-i,"");else if(!J&&i!==-1)$=R.strSplice($,d+i-1,-i," ")}}function q(B){let D=0,T=B,_=!1;do{if(T++,_){if($[T]=='"'&&$[T-1]!="\\")_=!1;continue}if($[T]=='"'){_=!0;continue}if($[T]=="{"||$[T]=="[")D++;if($[T]=="}"||$[T]=="]")D--}while(D&&K.True);if(K.True==!1)throw Error(`failed to write config
|
|
35
|
+
Reason: loop limit reached`);return T+1}function M(B,D){return/^[\t ]*[[{]/.test($.slice(B,D))}},strJustify(Y,Z,Q={}){let{filler:J=" ",align:X="center",overflow:z="hidden",collapseLocation:G="end",redundancyLv:H=0}=Q,W=Y instanceof Array,K=W?Y.join(""):Y,$=R.ex_length(K,H);if($>Z){if(z=="collapse")return R.strLimit(K,Z,G);if(z=="hidden")return K.slice(0,Z);return K}switch(X){case"spacebetween":if(W){let V=J.repeat((Z-$)/(Y.length-1));return Y.reduce((q,M,B)=>{if(B==0)return q;return q+V+M},Y[0])}default:case"center":return R.strSurround(K,J,Z);case"right":return R.padStart(K,Z,J);case"left":return R.padEnd(K,Z,J)}},strLimit(Y,Z,Q="mid",J=0){let X=R.ex_length(Y,J);if(X<=Z)return Y;let z=X-(X-Z)-3;switch(Q){default:if(M8)process?.emitWarning(`'${Q}' is not a valid location type.`);else throw Error(`'${Q}' is not a valid location type.`);case"mid":{let G=z>>1;return R.strSlice(Y,0,G)+"..."+R.strSlice(Y,X-G+1)}case"end":return R.strSlice(Y,0,z)+"...";case"start":return"..."+R.strSlice(Y,X-z)}},strSlice(Y,Z,Q,J=0){let X=[...Y.matchAll(R.REGEXP.ANSICode)].map((H)=>{return{start:H.index,end:H.index+H[0].length,length:H[0].length}});if(!Q)Q=R.ex_length(Y,J);let z=0,G=0;for(let H=0;H<X.length;H++){if(X[H].start-z<Z)z+=X[H].length;if(X[H].start-G<=Q)G+=X[H].length;if(X[H].start-G>Q)break}return Y.slice(Z+z,Q+G)},strSplice(Y,Z,Q,J=null){if(Q<0)Q=0;if(Z<Y.length*-1)Z=0;if(J)return Y.slice(0,Z)+J+(Z<0&&Q+Z>=0?"":Y.slice(Z+Q));else return Y.slice(0,Z)+(Z<0&&Q+Z>=0?"":Y.slice(Z+Q))},strSurround(Y,Z,Q,J=0){let X=R.ex_length(Y,J),z=Math.ceil(Q/2-X/2);return R.padEnd(" ",z,Z,J)+R.padEnd(Y,Q/2+X/2,Z,J)},strWrap(Y,Z,Q={}){if(!Y)return"";let{indent:J="",firstIndent:X="",mode:z="softboundary",redundancyLv:G=0}=Q,H="",W=R.REGEXP.SoftWrapSeperators,K=R.REGEXP.HardWrapSeperators,$=Z*0.67;if(typeof X=="number")X="".padEnd(X," ");if(typeof J=="number")J="".padEnd(J," ");let V=0,q=Y.split(`
|
|
36
|
+
`);for(let B=0;B<q.length;B++){let D=R.getMatchAllIndexes(q[B].matchAll(W));while(R.ex_length(q[B],G)>Z){let T=D.map((w)=>w-V).filter((w)=>w>=$),_=T[0]??-1;if(J!=null)if(X!=null)H+=X,X=null;else H+=J;if(z=="softboundary")if(_==-1){let w=R.getMatchAllIndexes(q[B].matchAll(K)).filter((I)=>I>=$);_=M(w,0)??Z}else _=M(T,0);else _=_>Z||_==-1?Z:_;_++,H+=q[B].substring(0,_).concat(`
|
|
37
|
+
`),q[B]=q[B].substring(_).trimStart(),V+=_}if(J!=null)if(X!=null)H+=X,X=null;else H+=J;H+=q[B].concat(B<q.length-1?`
|
|
38
|
+
`:"")}return H;function M(B,D){if(!B[D+1])return B[D];if(B[D+1]-B[D]>1)return B[D];return M(B,D+1)}},supportsColor(Y=process?.stdout){if(!M8)return 3;if(R.CheckCache.forceColor===!1)return 0;if(R.argvHasFlag("color=16m")||R.argvHasFlag("color=full")||R.argvHasFlag("color=truecolor"))return 3;if(R.argvHasFlag("color=256"))return 2;if(Y&&!Y.isTTY&&R.CheckCache.forceColor!==!0)return 0;let Z=R.CheckCache.forceColor?1:0;if(process.platform==="win32"){if(!R._modules.os)R._modules.os=NB("os");let J=R._modules.os.release().split(".");if(Number(process.versions.node.split(".")[0])>=8&&Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}let{env:Q}=process;if("CI"in Q){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI"].some((J)=>(J in Q))||Q.CI_NAME==="codeship")return 1;return Z}if("TEAMCITY_VERSION"in Q)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Q.TEAMCITY_VERSION)?1:0;if(Q.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in Q){let J=parseInt((Q.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Q.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(Q.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Q.TERM))return 1;if("COLORTERM"in Q)return 1;if(Q.TERM==="dumb")return Z;return Z},supportsHyperlink(Y=process?.stdout,Z=!1){if(!M8)return!0;if(Z)console.log("Terminal Support Hyperlink Test: (result of last check is the test result)");if(Z)console.log(`1. has process.env: ${!!process.env}`);let{env:Q}=process;if(!Q)return!1;if(Z)console.log(`2. force hyperlink: ${!!Q.FORCE_HYPERLINK&&!(Q.FORCE_HYPERLINK.length>0&&parseInt(Q.FORCE_HYPERLINK,10)===0)}`);if("FORCE_HYPERLINK"in Q)return!(Q.FORCE_HYPERLINK.length>0&&parseInt(Q.FORCE_HYPERLINK,10)===0);if(Z)console.log(`3. hyperlink disable: ${R.argvHasFlag("no-hyperlink")||R.argvHasFlag("no-hyperlinks")||R.argvHasFlag("hyperlink=false")||R.argvHasFlag("hyperlink=never")}`);if(R.argvHasFlag("no-hyperlink")||R.argvHasFlag("no-hyperlinks")||R.argvHasFlag("hyperlink=false")||R.argvHasFlag("hyperlink=never"))return!1;if(Z)console.log(`4. has hyperlink enable: ${R.argvHasFlag("hyperlink=true")||R.argvHasFlag("hyperlink=always")}`);if(R.argvHasFlag("hyperlink=true")||R.argvHasFlag("hyperlink=always"))return!0;if(Z)console.log(`5. ran on Netlify: ${"NETLIFY"in Q}`);if("NETLIFY"in Q)return!0;if(Z)console.log(`6. supports color: ${R.CheckCache.supportsColor>0}`);if(R.CheckCache.supportsColor>0)return!0;if(Z)console.log(`7. in TTY stream: ${!(Y&&!Y.isTTY)}`);if(Y&&!Y.isTTY)return!1;if(Z)console.log(`8. platform is win32: ${process.platform==="win32"}`);if(process.platform==="win32")return!1;if(Z)console.log(`9. is CI: ${"CI"in Q}`);if("CI"in Q)return!1;if(Z)console.log(`10. no TEAMCITY_VERSION: ${!("TEAMCITY_VERSION"in Q)}`);if("TEAMCITY_VERSION"in Q)return!1;if(Z)console.log("11. valid TERM_PROGRAM: (multiple check)");if("TERM_PROGRAM"in Q){let X=J(Q.TERM_PROGRAM_VERSION);switch(Q.TERM_PROGRAM){case"iTerm.app":if(X.major===3)return X.minor>=1;return X.major>3;case"WezTerm":return X.major>=20200620;case"vscode":return X.major>1||X.major===1&&X.minor>=72}}if(Z)console.log("11. valid VTE_VERSION: (multiple check)");if("VTE_VERSION"in Q){if(Q.VTE_VERSION==="0.50.0")return!1;let X=J(Q.VTE_VERSION);return X.major>0||X.minor>=50}if(Z)console.log("12. Final: failed");return!1;function J(X){if(/^\d{3,4}$/.test(X)){let G=/(\d{1,2})(\d{2})/.exec(X);return{major:0,minor:parseInt(G[1],10),patch:parseInt(G[2],10)}}let z=(X||"").split(".").map((G)=>parseInt(G,10));return{major:z[0],minor:z[1],patch:z[2]}}},surroundedBy(Y,Z,Q){if(Z<0)return!1;let J=-1/0,X=1/0,z=Y=="{"||Y=="["||Y=="("||Y=="<";for(let H=Z;H>0;H-=2){let W=Q.lastIndexOf(Y,H);if(W==-1)break;else J=W;if(Q[J-1]=="\\")J=-1/0}for(let H=0;H<Q.length;H+=2){let W=Q.indexOf(z?G(Y):Y,H);if(W==-1)break;else X=W;if(Q[X-1]=="\\")X=1/0}if(J==-1/0||X==1/0)return!1;return J<Z&&X>Z;function G(H){return String.fromCharCode(H.charCodeAt(0)+(H[0]=="("?1:2))}},Timer:class Y{time;resolution;isRunning=!1;maxTime;#Z;#Q;#Y=0;#J;#X;constructor(Z,Q="ms"){switch(this.maxTime=this.time=Z,this.resolution=Q,Q){case"ms":this.#Z=1;break;case"s":this.#Z=1000;break;case"m":this.#Z=60000;break}}start(){if(this.isRunning||this.time<=0)return;return this.isRunning=!0,this.#Y=Date.now(),this.#Q=setInterval(this.#z,this.#Z==1?4:this.#Z/100),this}stop(){if(!this.isRunning)return;return clearInterval(this.#Q),this.isRunning=!1,this.reset()}pause(){if(!this.isRunning)return;clearInterval(this.#Q),this.isRunning=!1;return}reset(){return this.time=this.maxTime,this}async wait(){if(!this.isRunning)return;return new Promise((Z)=>{this.#X=()=>{this.#X=null,Z()}})}onceEnd(Z){return this.#J=Z,this}#z=()=>{let Z=Date.now(),Q=(Z-this.#Y)/this.#Z;if(this.time-=Q,this.#Y=Z,this.time>0)return;if(this.stop(),this.time=0,this.#J)this.#J(),this.#J=null;if(this.#X)this.#X()}},toPlace(Y){switch(Y){case 1:return"1st";case 2:return"2nd";case 3:return"3rd";default:return Y+"th"}},toShortNum(Y,Z=2,Q=1000,J=!1,X=-Number.MAX_SAFE_INTEGER,z=Number.MAX_SAFE_INTEGER){if(Y===0)return"0";let G=Math.abs(Y),H=Math.sign(Y),W=G>0&&G<1,K=R.MathKit.clamp(Math.floor(Math.log(G)/Math.log(Q)),X,z);Y=Y/Math.pow(Q,K)*H;let $=R.maxFraction(Y,Z,J),q={"4":"T","2":"M","3":"G","1":"k","0":"","-1":"m","-2":"μ","-3":"n","-4":"p"}[K]??`e${W?"":"+"}${K*3}`;return $+q},Tracer:class Y{liveLog=!0;log="";startTime;enableLogging=!1;recursive=!1;constructor(){this.startTime=new Date}createTracker=function(Z,Q,J){let X=(z,G)=>{let H=z.length;if(H<=G)return z;let K=H-(H-G)-3>>1;return z.slice(0,K)+"..."+z.slice(H-K+1)};return function(){if(!J.enableLogging)return Z.apply(this,arguments);let z=Z.apply(this,arguments)??"void",G="["+R.jsTime.howLong(J.startTime)+"] "+Q+"(";for(let H=0;H<arguments.length;H++){if(H>0)G+=", ";let W=R.yuString(arguments[H]);G+=W.trim().length?X(W,70):`"${W}"`}if(z==="void")G+=")";else G+="): "+X(R.yuString(z),70);if(J.log+=G+`
|
|
39
|
+
`,J.liveLog)console.log(G);return z==="void"?void 0:z}};attachTracer(Z,Q=""){if(Q.length>100)return this;if(typeof Z!=="object")return this;for(let J of Object.getOwnPropertyNames(Z)){let X=Z[J];if(Object.prototype.toString.call(X)==="[object Function]"){if(!R.isClass(X))Z[J]=this.createTracker(X,Q+J,this);if(this.recursive&&R.propertiesCount(X)>0)for(let z of Object.getOwnPropertyNames(X)){let G=X[z];return this.attachTracer(G,Q+J+".")}}}return this}},writeConfig(Y,Z,Q={}){if(!R._modules.fs)throw Error('fs module is required for Tools.writeConfig()\nimport them with `Tools._modules.fs = require("fs")`');let{ignoreList:J=[],minify:X=!1,replacer:z,mode:G="merge",useIniGroup:H=!1,alwaysWrapStrInQuotes:W=!1}=Q,K="";if(R._modules.fs.existsSync(Z)&&G=="merge")K=R._modules.fs.readFileSync(Z,{encoding:"utf-8"});K=R.stringifyConfig(Y,{ignoreList:J,minify:X,replacer:z,mode:G,useIniGroup:H,alwaysWrapStrInQuotes:W,oldConfigStr:K}),R._modules.fs.writeFileSync(Z,K,{encoding:"utf-8"})},yuString(Y,Z={}){let{color:Q=!1,defColor:J=void 0}=Z;switch(typeof Y){case"string":if(Q)return R.ncc(8373322)+`"${Y}"`+R.ncc(J);return`"${Y}"`;case"bigint":case"number":if(Q)return R.ncc(11609489)+Y+R.ncc(J);case"boolean":case"undefined":if(Q)return R.ncc(15756194)+Y+R.ncc(J);return Y+"";case"function":if(Q)return(R.isAsyncFunction(Y)?R.ncc(4802889)+"async ":"")+(R.isArrowFunction(Y)?R.ncc(13401911)+(Y.name||R.ncc(4802889)+"[anonymous]"+R.ncc(13401911))+" () => {...}":R.ncc(13401911)+(Y.name||R.ncc(4802889)+"[anonymous]"+R.ncc(13401911))+"()")+R.ncc(J);return(R.isAsyncFunction(Y)?"async ":"")+(R.isArrowFunction(Y)?(Y.name||"[anonymous]")+" () => {...}":(Y.name||"[anonymous]")+"()");case"symbol":if(Q)return R.ncc(13401911)+Y.toString()+R.ncc(J);return Y.toString()}if(Y==null){if(Q)return R.ncc(13136006)+Y+R.ncc(J);return Y+""}if(Y instanceof Date){if(Q)return R.ncc(11550650)+"Date"+R.ncc(J)+" "+Y.toISOString();return"Date "+Y.toISOString()}if(Y instanceof RegExp){if(Q)return R.ncc("Yellow")+Y.toString()+R.ncc(J);return Y.toString()}if(Y instanceof Promise)return R.ncc(11550650)+"Promise"+R.ncc(J)+" {...(pending)}";if(Y instanceof Map){let X=[...Y.entries()];return(Q?R.ncc(11550650)+`Map(${Y.size}) {`+R.ncc(J):`Map(${Y.size}) {`)+R.arrToString(X,{color:Q,defColor:J,noHeader:!0})+"}"}if(Y instanceof Set){let X=[...Y.values()];return(Q?R.ncc(11550650)+`Set(${Y.size}) {`+R.ncc(J):`Set(${Y.size}) {`)+R.arrToString(X,{color:Q,defColor:J,noHeader:!0})+"}"}if(R.isError(Y))return R.Err.toString(Y,{color:Q,defColor:J});try{if(typeof Y==="object"){if(R.isArrayLike(Y))return R.arrToString(Y,{color:Q,defColor:J});return R.objToString(Y,{color:Q,defColor:J})}}catch{}return"[unknown]"}};if(typeof window<"u")window._tools=R;({arrFindLast:TI,arrToString:JX,argvHasFlag:_I,asyncSleep:NI,beautifyJson:wI,beforeExit:XX,changeDateTimezone:OI,charTypeAt:II,CheckCache:V1,cleanArr:EI,cleanComments:CI,cleanString:zX,CONSTS:jI,Convert:kI,ConsoleTime:AI,compareDate:PI,DataScienceKit:xI,deferredFunc:SI,digitAt:vI,digitAtRange:yI,getDimensions:fI,Err:s,escapeRegExp:bI,ex_length:hI,fileNameCleaner:gI,fixFilePath:mI,fixYTurl:uI,fileTypeOf:dI,getMatchAllIndexes:pI,getMatchAllResults:cI,getRandomInt:lI,getProcessTime:iI,hyperLink:C6,IDGenerator:nI,includesWord:aI,IPC:oI,isArrayLike:sI,isArrowFunction:rI,isAsyncFunction:tI,isClass:eI,isNumber:YE,isEmptyArray:ZE,isEmptyObject:QE,isError:GX,isValidFilePath:JE,JSONReplacer:XE,JSONReviver:zE,jsTime:HX,lazySplit:GE,remap:WX,MathKit:k0,maxFraction:KX,ncc:U,nearestNumber:HE,objectMap:WE,objValueAt:KE,objToString:$E,propertiesCount:UE,padEnd:$X,padStart:VE,parseArgs:qE,parseBool:BE,parseConfig:FE,parseValue:RE,pass:ME,Progress:DE,proximate:LE,randomPick:TE,redexOf:_E,REGEXP:NE,resolveNodeEnv:wE,SafeTrue:OE,search:IE,sleep:EE,SpawnMirror:CE,strClamp:L8,stringifyConfig:jE,strJustify:j6,strLimit:q1,strSlice:kE,strSplice:AE,strSurround:PE,strWrap:n,supportsColor:xE,supportsHyperlink:SE,surroundedBy:vE,Timer:yE,toPlace:fE,toShortNum:jY,Tracer:bE,writeConfig:hE,yuString:p}=R)});var Y5;var UX=F(()=>{Y5={name:"gdx",version:"0.3.0",description:"Git, but with better DX. The raw power of Git, aligned with human workflows.",homepage:"https://github.com/Type-Delta/gdx#readme",bugs:{url:"https://github.com/Type-Delta/gdx/issues"},repository:{type:"git",url:"git+https://github.com/Type-Delta/gdx.git"},keywords:["git","dx","cli-wrapper"],license:"MIT",author:"Type-Delta",type:"module",main:"dist/index.js",bin:{gdx:"scripts/launcher.cjs"},files:["dist/","scripts/postinstall.cjs","scripts/launcher.cjs","README.md","LICENSE"],scripts:{"prepare-dev":"bun i && bun run transpile-esm",start:"bun run src/index.ts","start:profile":"bun --cpu-prof src/index.ts","start:node":"tsx src/index.ts","transpile-esm":"bunx tsc -p lib/tsconfig.json && bun run scripts/transform-tools.mjs",check:"bun run ts-check && bun run lint && bun run build",lint:"bun run ts-check && eslint src --ext .ts -c eslint.config.ts --fix",build:"bun run transpile-esm && bun build ./src/index.ts --outfile=./bin/gdx --compile --bytecode --production --keep-names","ts-check":"bunx tsc --noEmit","package:node":"bun run transpile-esm && bun build ./src/index.ts --outdir=./dist --target=node --external=keytar --external=cspell-lib --format=esm --production --keep-names",prepack:"bun run package:node",postinstall:"node scripts/postinstall.cjs",prettier:'prettier --write "src/**/*.ts" "test/**/*.ts" "./*.md"',"dummy-editor":"bun ./scripts/dummyEditor.mjs"},devDependencies:{"@babel/cli":"^7.28.0","@babel/core":"^7.28.0","@babel/preset-env":"^7.27.2","@babel/preset-typescript":"^7.27.1","@eslint/js":"^9.22.0","@types/chai":"^5.2.3","@typescript-eslint/eslint-plugin":"^8.13.0","@typescript-eslint/parser":"^8.13.0","bun-types":"latest",chai:"^6.2.1",dedent:"^1.7.0",eslint:"^9.22.0",execa:"^9.6.1",jiti:"^2.6.1",openai:"^6.14.0",prettier:"^3.6.2","smol-toml":"^1.5.2",tsx:"^4.21.0",typescript:"^5.8.3","typescript-eslint":"^8.50.0"},dependencies:{"cspell-lib":"9.4.0",keytar:"^7.9.0"}}});import{existsSync as t,readFileSync as aY,writeFileSync as oY,mkdirSync as WY,mkdtempSync as dE,rmSync as Z5,accessSync as VX,readdirSync as sY,appendFileSync as qX,unlinkSync as Q5,constants as J5}from"fs";import{access as BX,rm as FX,rmdir as cE,mkdir as lE,readdir as iE,readlink as nE,stat as ZZ,link as aE,unlink as RX,writeFile as rY,appendFile as oE,readFile as KY}from"fs/promises";var g0=()=>{};import{constants as EB}from"fs";function O(Y,Z=`
|
|
40
|
+
`){if(MX){MX(Y+Z);return}process.stdout.write(Y+Z)}async function X5(Y){try{if(!(await ZZ(Y)).isFile())return!1;return await BX(Y,EB.X_OK),!0}catch{return!1}}function z5(Y,Z,Q=!1){if(Y==="")return{match:null,candidates:Z,isExact:!1};let J=[];for(let X of Z){if(X===Y)return{match:X,candidates:null,isExact:!0};if(X.startsWith(Y))J.push(X)}if(Q&&J.length>1)J=[J[0]];return{match:J.length===1?J[0]:null,candidates:J,isExact:J.includes(Y)}}function QZ(Y){return Y.map((Z)=>{if(/[\s"`$\\]/.test(Z))return`"${Z.replace(/(["\\$`])/g,"\\$1")}"`;return Z})}function G5(Y){if(!Y)return"";return Y.replace(/[/\\]/g,"_").replace(/[<>:"|?*\x00-\x1f]/g,"_")}function DX(Y){return["1","true","yes","on"].includes(Y.toLowerCase())}function LX(Y,Z){let Q=Y.split(".").map(Number),J=Z.split(".").map(Number),X=Math.max(Q.length,J.length);for(let z=0;z<X;z++){let G=Q[z]||0,H=J[z]||0;if(G>H)return 1;if(G<H)return-1}return 0}var MX=null,B1=()=>{};var R0=F(()=>{g0()});import H5 from"os";import k6 from"path";var TX,k,kY,QC,_X=".gdxrc.toml",NX,F1,W5,A6=150,P6,YY,wX,K5,JZ="gdx-cli",tY,CB="cache.json",jB="macro.json",XZ,j,OX,x6,IX,zZ=86400000,o0,S6,GZ=360,EX=7,CX="https://openrouter.ai/api/v1",jX=512000;var J0=F(()=>{UX();R0();TX=k6.basename(process.argv[0]||"gdx",k6.extname(process.argv[0]||"")),k=TX.startsWith("bun")?"gdx":TX,kY=process.env.GDX_TEMP_DIR||H5.tmpdir(),QC=process.env.GDX_CURRENT_DIR||process.cwd(),NX=k6.join(H5.homedir(),".gdx"),F1=k6.join(NX,_X),W5=k6.join(H5.homedir(),_X),P6=process.env.GDX_RESULT,YY=Y5.version||"unknown",wX=Y5.homepage||"",K5=process.env.GDX_WRITE_LOGS!=null?DX(process.env.GDX_WRITE_LOGS):!0,tY=["llm.apiKey"],XZ=["add","branch","checkout","clone","commit","diff","log","pull","push","rebase","reset","revert","merge","init","stash","status","switch"],j={OceanDeepBlue:[46,149,153],OceanGreen:[57,211,83],ForestGreen:[34,139,34],SunsetOrange:[255,99,71],MidnightBlack:[10,16,36],Zinc700:[63,63,70],Zinc400:[161,161,170],Zinc100:[244,244,245],Fuchsia400:[232,121,249],Teal300:[94,234,212]},OX=["⠋","⠙","⠹","⠸","⠼","⠴","⠦","⠧","⠇","⠏"],x6={AVG_CHARS_PER_LINE:40,AVG_LINES_PER_FUNCTION:45,AVG_LINES_PER_FILE:500},IX=[/api[\w_-]?key[\w_-]?\s*=\s*['"].+['"]/i,/access[\w_-]?token[\w_-]?\s*=\s*['"].+['"]/i,/private[\w_-]?key[\w_-]?\s*=\s*['"].+['"]/i,/sk-ant-[\d\w]{32,}/,/sk-[\d\w]{32,}/,/sk-or-[\d\w]{32,}/,/-----\s*BEGIN PRIVATE KEY\s*-----/i],o0=k6.join(kY,"gdx",CB),S6=k6.join(NX,jB)});function h(Y,Z,Q,J=0,X=1){if(J<0)J=0;else if(X>1)X=1;if(!(J<X)||V1.supportsColor<3)return Y;let z=Y.length,G=Math.floor(z*J),H=Math.floor(z*X),W=H-G,K=(Q[0]-Z[0])/W,$=(Q[1]-Z[1])/W,V=(Q[2]-Z[2])/W,q="";for(let M=0;M<z;M++)if(M<G)q+=`\x1B[38;2;${Z[0]};${Z[1]};${Z[2]}m${Y[M]}`;else if(M>=G&&M<=H){let B=M-G,D=Math.round(k0.clamp(Z[0]+K*B,0,255)),T=Math.round(k0.clamp(Z[1]+$*B,0,255)),_=Math.round(k0.clamp(Z[2]+V*B,0,255));q+=`\x1B[38;2;${D};${T};${_}m${Y[M]}`}else q+=`\x1B[38;2;${Q[0]};${Q[1]};${Q[2]}m${Y[M]}`;return q+="\x1B[0m",q}function kX(Y,Z,Q){let J=k0.clamp(Math.round(Y[0]+(Z[0]-Y[0])*Q),0,255),X=k0.clamp(Math.round(Y[1]+(Z[1]-Y[1])*Q),0,255),z=k0.clamp(Math.round(Y[2]+(Z[2]-Y[2])*Q),0,255);return[J,X,z]}function AX(Y,Z,Q,J=0.5,X=0.3){if(J<0)J=0;else if(J>1)J=1;if(X<=0||V1.supportsColor<3)return Y;let z=Y.length,G=J*z,H=X*z,W="";for(let K=0;K<z;K++){let V=Math.abs(K-G)/H;V=k0.clamp(V,0,1);let q=Math.round(k0.clamp(Z[0]+(Q[0]-Z[0])*V,0,255)),M=Math.round(k0.clamp(Z[1]+(Q[1]-Z[1])*V,0,255)),B=Math.round(k0.clamp(Z[2]+(Q[2]-Z[2])*V,0,255));W+=`\x1B[38;2;${q};${M};${B}m${Y[K]}`}return W+="\x1B[0m",W}function M1(Y){let Z=k0.clamp(Math.round(Y[0]),0,255),Q=k0.clamp(Math.round(Y[1]),0,255),J=k0.clamp(Math.round(Y[2]),0,255);return(Z<<16)+(Q<<8)+J}function R1(Y,Z,Q,J,X){let H=0,W=1,K=Y;for(let $=0;$<10;$++){let q=kB(K,Z,J)-Y;if(Math.abs(q)<0.000001)break;if(q>0)W=K;else H=K;K=(H+W)/2}return AB(K,Q,X)}function kB(Y,Z,Q){let J=1-Y;return 3*J*J*Y*Z+3*J*Y*Y*Q+Y*Y*Y}function AB(Y,Z,Q){let J=1-Y;return 3*J*J*Y*Z+3*J*Y*Y*Q+Y*Y*Y}var PX;var S0=F(()=>{Q0();PX={linear:(Y)=>Y,easeIn:(Y)=>R1(Y,0.42,0,1,1),easeOut:(Y)=>R1(Y,0,0,0.58,1),easeInOut:(Y)=>R1(Y,0.42,0,0.58,1),smooth:(Y)=>R1(Y,0.25,0.1,0.25,1),bounce:(Y)=>R1(Y,0.68,-0.55,0.265,1.55)}});var c;var O0=F(()=>{c={exitCodeOverride:-1,finalStringOutput:"",logLevel:"warn",terminalWidth:process.stdout.columns||100}});function B0(Y){if(typeof Y!=="object"||Y===null)return!1;let Z=Object.getPrototypeOf(Y);return(Z===null||Z===Object.prototype||Object.getPrototypeOf(Z)===null)&&!(Symbol.toStringTag in Y)&&!(Symbol.iterator in Y)}import{fileURLToPath as PB}from"node:url";var T8=(Y,Z)=>{let Q=U5(xB(Y));if(typeof Q!=="string")throw TypeError(`${Z} must be a string or a file URL: ${Q}.`);return Q},xB=(Y)=>$5(Y)?Y.toString():Y,$5=(Y)=>typeof Y!=="string"&&Y&&Object.getPrototypeOf(Y)===String.prototype,U5=(Y)=>Y instanceof URL?PB(Y):Y;var _8=()=>{};var HZ=(Y,Z=[],Q={})=>{let J=T8(Y,"First argument"),[X,z]=B0(Z)?[[],Z]:[Z,Q];if(!Array.isArray(X))throw TypeError(`Second argument must be either an array of arguments or an options object: ${X}`);if(X.some((W)=>typeof W==="object"&&W!==null))throw TypeError(`Second argument must be an array of strings: ${X}`);let G=X.map(String),H=G.find((W)=>W.includes("\x00"));if(H!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${H}`);if(!B0(z))throw TypeError(`Last argument must be an options object: ${z}`);return[J,G,z]};var V5=F(()=>{_8()});import{StringDecoder as SB}from"node:string_decoder";var xX,SX=(Y)=>xX.call(Y)==="[object ArrayBuffer]",L0=(Y)=>xX.call(Y)==="[object Uint8Array]",AY=(Y)=>new Uint8Array(Y.buffer,Y.byteOffset,Y.byteLength),vB,vX=(Y)=>vB.encode(Y),yB,WZ=(Y)=>yB.decode(Y),yX=(Y,Z)=>{return fB(Y,Z).join("")},fB=(Y,Z)=>{if(Z==="utf8"&&Y.every((z)=>typeof z==="string"))return Y;let Q=new SB(Z),J=Y.map((z)=>typeof z==="string"?vX(z):z).map((z)=>Q.write(z)),X=Q.end();return X===""?J:[...J,X]},D1=(Y)=>{if(Y.length===1&&L0(Y[0]))return Y[0];return q5(bB(Y))},bB=(Y)=>Y.map((Z)=>typeof Z==="string"?vX(Z):Z),q5=(Y)=>{let Z=new Uint8Array(hB(Y)),Q=0;for(let J of Y)Z.set(J,Q),Q+=J.length;return Z},hB=(Y)=>{let Z=0;for(let Q of Y)Z+=Q.length;return Z};var m0=F(()=>{({toString:xX}=Object.prototype),vB=new TextEncoder,yB=new TextDecoder});import{ChildProcess as gB}from"node:child_process";var gX=(Y)=>Array.isArray(Y)&&Array.isArray(Y.raw),mX=(Y,Z)=>{let Q=[];for(let[z,G]of Y.entries())Q=mB({templates:Y,expressions:Z,tokens:Q,index:z,template:G});if(Q.length===0)throw TypeError("Template script must not be empty");let[J,...X]=Q;return[J,X,{}]},mB=({templates:Y,expressions:Z,tokens:Q,index:J,template:X})=>{if(X===void 0)throw TypeError(`Invalid backslash sequence: ${Y.raw[J]}`);let{nextTokens:z,leadingWhitespaces:G,trailingWhitespaces:H}=uB(X,Y.raw[J]),W=bX(Q,z,G);if(J===Z.length)return W;let K=Z[J],$=Array.isArray(K)?K.map((V)=>hX(V)):[hX(K)];return bX(W,$,H)},uB=(Y,Z)=>{if(Z.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let Q=[],J=0,X=fX.has(Z[0]);for(let G=0,H=0;G<Y.length;G+=1,H+=1){let W=Z[H];if(fX.has(W)){if(J!==G)Q.push(Y.slice(J,G));J=G+1}else if(W==="\\"){let K=Z[H+1];if(K===`
|
|
41
|
+
`)G-=1,H+=1;else if(K==="u"&&Z[H+2]==="{")H=Z.indexOf("}",H+3);else H+=dB[K]??1}}let z=J===Y.length;if(!z)Q.push(Y.slice(J));return{nextTokens:Q,leadingWhitespaces:X,trailingWhitespaces:z}},fX,dB,bX=(Y,Z,Q)=>Q||Y.length===0||Z.length===0?[...Y,...Z]:[...Y.slice(0,-1),`${Y.at(-1)}${Z[0]}`,...Z.slice(1)],hX=(Y)=>{let Z=typeof Y;if(Z==="string")return Y;if(Z==="number")return String(Y);if(B0(Y)&&(("stdout"in Y)||("isMaxBuffer"in Y)))return pB(Y);if(Y instanceof gB||Object.prototype.toString.call(Y)==="[object Promise]")throw TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}.");throw TypeError(`Unexpected "${Z}" in template expression`)},pB=({stdout:Y})=>{if(typeof Y==="string")return Y;if(L0(Y))return WZ(Y);if(Y===void 0)throw TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`);throw TypeError(`Unexpected "${typeof Y}" stdout in template expression`)};var uX=F(()=>{m0();fX=new Set([" ","\t","\r",`
|
|
42
|
+
`]),dB={x:3,u:5}});import B5 from"node:process";var ZY=(Y)=>KZ.includes(Y),KZ,s0,$Z=(Y)=>s0[Y]??`stdio[${Y}]`;var PY=F(()=>{KZ=[B5.stdin,B5.stdout,B5.stderr],s0=["stdin","stdout","stderr"]});import{debuglog as cB}from"node:util";var pX=(Y)=>{let Z={...Y};for(let Q of M5)Z[Q]=F5(Y,Q);return Z},F5=(Y,Z)=>{let Q=Array.from({length:lB(Y)+1}),J=iB(Y[Z],Q,Z);return rB(J,Z)},lB=({stdio:Y})=>Array.isArray(Y)?Math.max(Y.length,s0.length):s0.length,iB=(Y,Z,Q)=>B0(Y)?nB(Y,Z,Q):Z.fill(Y),nB=(Y,Z,Q)=>{for(let J of Object.keys(Y).sort(aB))for(let X of oB(J,Q,Z))Z[X]=Y[J];return Z},aB=(Y,Z)=>dX(Y)<dX(Z)?1:-1,dX=(Y)=>{if(Y==="stdout"||Y==="stderr")return 0;return Y==="all"?2:1},oB=(Y,Z,Q)=>{if(Y==="ipc")return[Q.length-1];let J=R5(Y);if(J===void 0||J===0)throw TypeError(`"${Z}.${Y}" is invalid.
|
|
43
|
+
It must be "${Z}.stdout", "${Z}.stderr", "${Z}.all", "${Z}.ipc", or "${Z}.fd3", "${Z}.fd4" (and so on).`);if(J>=Q.length)throw TypeError(`"${Z}.${Y}" is invalid: that file descriptor does not exist.
|
|
44
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);return J==="all"?[1,2]:[J]},R5=(Y)=>{if(Y==="all")return Y;if(s0.includes(Y))return s0.indexOf(Y);let Z=sB.exec(Y);if(Z!==null)return Number(Z[1])},sB,rB=(Y,Z)=>Y.map((Q)=>Q===void 0?eB[Z]:Q),tB,eB,M5,xY=(Y,Z)=>Z==="ipc"?Y.at(-1):Y[Z];var SY=F(()=>{PY();sB=/^fd(\d+)$/,tB=cB("execa").enabled?"full":"none",eB={lines:!1,buffer:!0,maxBuffer:1e8,verbose:tB,stripFinalNewline:!0},M5=["lines","buffer","maxBuffer","verbose","stripFinalNewline"]});var N8=({verbose:Y},Z)=>D5(Y,Z)!=="none",w8=({verbose:Y},Z)=>!["none","short"].includes(D5(Y,Z)),cX=({verbose:Y},Z)=>{let Q=D5(Y,Z);return UZ(Q)?Q:void 0},D5=(Y,Z)=>Z===void 0?YF(Y):xY(Y,Z),YF=(Y)=>Y.find((Z)=>UZ(Z))??VZ.findLast((Z)=>Y.includes(Z)),UZ=(Y)=>typeof Y==="function",VZ;var eY=F(()=>{SY();VZ=["none","short","full"]});import{platform as ZF}from"node:process";import{stripVTControlCharacters as QF}from"node:util";var lX=(Y,Z)=>{let Q=[Y,...Z],J=Q.join(" "),X=Q.map((z)=>WF(iX(z))).join(" ");return{command:J,escapedCommand:X}},L1=(Y)=>QF(Y).split(`
|
|
45
|
+
`).map((Z)=>iX(Z)).join(`
|
|
46
|
+
`),iX=(Y)=>Y.replaceAll(zF,(Z)=>JF(Z)),JF=(Y)=>{let Z=GF[Y];if(Z!==void 0)return Z;let Q=Y.codePointAt(0),J=Q.toString(16);return Q<=HF?`\\u${J.padStart(4,"0")}`:`\\U${J}`},XF=()=>{try{return new RegExp("\\p{Separator}|\\p{Other}","gu")}catch{return/[\s\u0000-\u001F\u007F-\u009F\u00AD]/g}},zF,GF,HF=65535,WF=(Y)=>{if(KF.test(Y))return Y;return ZF==="win32"?`"${Y.replaceAll('"','""')}"`:`'${Y.replaceAll("'","'\\''")}'`},KF;var qZ=F(()=>{zF=XF(),GF={" ":" ","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"},KF=/^[\w./-]+$/});import nX from"node:process";function L5(){let{env:Y}=nX,{TERM:Z,TERM_PROGRAM:Q}=Y;if(nX.platform!=="win32")return Z!=="linux";return Boolean(Y.WT_SESSION)||Boolean(Y.TERMINUS_SUBLIME)||Y.ConEmuTask==="{cmd::Cmder}"||Q==="Terminus-Sublime"||Q==="vscode"||Z==="xterm-256color"||Z==="alacritty"||Z==="rxvt-unicode"||Z==="rxvt-unicode-256color"||Y.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var aX=()=>{};var oX,sX,$F,UF,VF,qF,BF,BZ,SC;var rX=F(()=>{aX();oX={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"█",squareDarkShade:"▓",squareMediumShade:"▒",squareLightShade:"░",squareTop:"▀",squareBottom:"▄",squareLeft:"▌",squareRight:"▐",squareCenter:"■",bullet:"●",dot:"․",ellipsis:"…",pointerSmall:"›",triangleUp:"▲",triangleUpSmall:"▴",triangleDown:"▼",triangleDownSmall:"▾",triangleLeftSmall:"◂",triangleRightSmall:"▸",home:"⌂",heart:"♥",musicNote:"♪",musicNoteBeamed:"♫",arrowUp:"↑",arrowDown:"↓",arrowLeft:"←",arrowRight:"→",arrowLeftRight:"↔",arrowUpDown:"↕",almostEqual:"≈",notEqual:"≠",lessOrEqual:"≤",greaterOrEqual:"≥",identical:"≡",infinity:"∞",subscriptZero:"₀",subscriptOne:"₁",subscriptTwo:"₂",subscriptThree:"₃",subscriptFour:"₄",subscriptFive:"₅",subscriptSix:"₆",subscriptSeven:"₇",subscriptEight:"₈",subscriptNine:"₉",oneHalf:"½",oneThird:"⅓",oneQuarter:"¼",oneFifth:"⅕",oneSixth:"⅙",oneEighth:"⅛",twoThirds:"⅔",twoFifths:"⅖",threeQuarters:"¾",threeFifths:"⅗",threeEighths:"⅜",fourFifths:"⅘",fiveSixths:"⅚",fiveEighths:"⅝",sevenEighths:"⅞",line:"─",lineBold:"━",lineDouble:"═",lineDashed0:"┄",lineDashed1:"┅",lineDashed2:"┈",lineDashed3:"┉",lineDashed4:"╌",lineDashed5:"╍",lineDashed6:"╴",lineDashed7:"╶",lineDashed8:"╸",lineDashed9:"╺",lineDashed10:"╼",lineDashed11:"╾",lineDashed12:"−",lineDashed13:"–",lineDashed14:"‐",lineDashed15:"⁃",lineVertical:"│",lineVerticalBold:"┃",lineVerticalDouble:"║",lineVerticalDashed0:"┆",lineVerticalDashed1:"┇",lineVerticalDashed2:"┊",lineVerticalDashed3:"┋",lineVerticalDashed4:"╎",lineVerticalDashed5:"╏",lineVerticalDashed6:"╵",lineVerticalDashed7:"╷",lineVerticalDashed8:"╹",lineVerticalDashed9:"╻",lineVerticalDashed10:"╽",lineVerticalDashed11:"╿",lineDownLeft:"┐",lineDownLeftArc:"╮",lineDownBoldLeftBold:"┓",lineDownBoldLeft:"┒",lineDownLeftBold:"┑",lineDownDoubleLeftDouble:"╗",lineDownDoubleLeft:"╖",lineDownLeftDouble:"╕",lineDownRight:"┌",lineDownRightArc:"╭",lineDownBoldRightBold:"┏",lineDownBoldRight:"┎",lineDownRightBold:"┍",lineDownDoubleRightDouble:"╔",lineDownDoubleRight:"╓",lineDownRightDouble:"╒",lineUpLeft:"┘",lineUpLeftArc:"╯",lineUpBoldLeftBold:"┛",lineUpBoldLeft:"┚",lineUpLeftBold:"┙",lineUpDoubleLeftDouble:"╝",lineUpDoubleLeft:"╜",lineUpLeftDouble:"╛",lineUpRight:"└",lineUpRightArc:"╰",lineUpBoldRightBold:"┗",lineUpBoldRight:"┖",lineUpRightBold:"┕",lineUpDoubleRightDouble:"╚",lineUpDoubleRight:"╙",lineUpRightDouble:"╘",lineUpDownLeft:"┤",lineUpBoldDownBoldLeftBold:"┫",lineUpBoldDownBoldLeft:"┨",lineUpDownLeftBold:"┥",lineUpBoldDownLeftBold:"┩",lineUpDownBoldLeftBold:"┪",lineUpDownBoldLeft:"┧",lineUpBoldDownLeft:"┦",lineUpDoubleDownDoubleLeftDouble:"╣",lineUpDoubleDownDoubleLeft:"╢",lineUpDownLeftDouble:"╡",lineUpDownRight:"├",lineUpBoldDownBoldRightBold:"┣",lineUpBoldDownBoldRight:"┠",lineUpDownRightBold:"┝",lineUpBoldDownRightBold:"┡",lineUpDownBoldRightBold:"┢",lineUpDownBoldRight:"┟",lineUpBoldDownRight:"┞",lineUpDoubleDownDoubleRightDouble:"╠",lineUpDoubleDownDoubleRight:"╟",lineUpDownRightDouble:"╞",lineDownLeftRight:"┬",lineDownBoldLeftBoldRightBold:"┳",lineDownLeftBoldRightBold:"┯",lineDownBoldLeftRight:"┰",lineDownBoldLeftBoldRight:"┱",lineDownBoldLeftRightBold:"┲",lineDownLeftRightBold:"┮",lineDownLeftBoldRight:"┭",lineDownDoubleLeftDoubleRightDouble:"╦",lineDownDoubleLeftRight:"╥",lineDownLeftDoubleRightDouble:"╤",lineUpLeftRight:"┴",lineUpBoldLeftBoldRightBold:"┻",lineUpLeftBoldRightBold:"┷",lineUpBoldLeftRight:"┸",lineUpBoldLeftBoldRight:"┹",lineUpBoldLeftRightBold:"┺",lineUpLeftRightBold:"┶",lineUpLeftBoldRight:"┵",lineUpDoubleLeftDoubleRightDouble:"╩",lineUpDoubleLeftRight:"╨",lineUpLeftDoubleRightDouble:"╧",lineUpDownLeftRight:"┼",lineUpBoldDownBoldLeftBoldRightBold:"╋",lineUpDownBoldLeftBoldRightBold:"╈",lineUpBoldDownLeftBoldRightBold:"╇",lineUpBoldDownBoldLeftRightBold:"╊",lineUpBoldDownBoldLeftBoldRight:"╉",lineUpBoldDownLeftRight:"╀",lineUpDownBoldLeftRight:"╁",lineUpDownLeftBoldRight:"┽",lineUpDownLeftRightBold:"┾",lineUpBoldDownBoldLeftRight:"╂",lineUpDownLeftBoldRightBold:"┿",lineUpBoldDownLeftBoldRight:"╃",lineUpBoldDownLeftRightBold:"╄",lineUpDownBoldLeftBoldRight:"╅",lineUpDownBoldLeftRightBold:"╆",lineUpDoubleDownDoubleLeftDoubleRightDouble:"╬",lineUpDoubleDownDoubleLeftRight:"╫",lineUpDownLeftDoubleRightDouble:"╪",lineCross:"╳",lineBackslash:"╲",lineSlash:"╱"},sX={tick:"✔",info:"ℹ",warning:"⚠",cross:"✘",squareSmall:"◻",squareSmallFilled:"◼",circle:"◯",circleFilled:"◉",circleDotted:"◌",circleDouble:"◎",circleCircle:"ⓞ",circleCross:"ⓧ",circlePipe:"Ⓘ",radioOn:"◉",radioOff:"◯",checkboxOn:"☒",checkboxOff:"☐",checkboxCircleOn:"ⓧ",checkboxCircleOff:"Ⓘ",pointer:"❯",triangleUpOutline:"△",triangleLeft:"◀",triangleRight:"▶",lozenge:"◆",lozengeOutline:"◇",hamburger:"☰",smiley:"㋡",mustache:"෴",star:"★",play:"▶",nodejs:"⬢",oneSeventh:"⅐",oneNinth:"⅑",oneTenth:"⅒"},$F={tick:"√",info:"i",warning:"‼",cross:"×",squareSmall:"□",squareSmallFilled:"■",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(○)",circleCross:"(×)",circlePipe:"(│)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[×]",checkboxOff:"[ ]",checkboxCircleOn:"(×)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"∆",triangleLeft:"◄",triangleRight:"►",lozenge:"♦",lozengeOutline:"◊",hamburger:"≡",smiley:"☺",mustache:"┌─┐",star:"✶",play:"►",nodejs:"♦",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},UF={...oX,...sX},VF={...oX,...$F},qF=L5(),BF=qF?UF:VF,BZ=BF,SC=Object.entries(sX)});import FF from"node:tty";var RF,r=(Y,Z)=>{if(!RF)return(X)=>X;let Q=`\x1B[${Y}m`,J=`\x1B[${Z}m`;return(X)=>{let z=X+"",G=z.indexOf(J);if(G===-1)return Q+z+J;let H=Q,W=0,$=(Z===22?J:"")+Q;while(G!==-1)H+=z.slice(W,G)+$,W=G+J.length,G=z.indexOf(J,W);return H+=z.slice(W)+J,H}},fC,tX,bC,hC,gC,mC,uC,dC,pC,cC,lC,iC,nC,aC,oC,sC,rC,FZ,tC,eC,Yj,Zj,Qj,Jj,Xj,zj,Gj,eX,Hj,Yz,Wj,Kj,$j,Uj,Vj,qj,Bj,Fj,Rj,Mj,Dj;var T5=F(()=>{RF=FF?.WriteStream?.prototype?.hasColors?.()??!1,fC=r(0,0),tX=r(1,22),bC=r(2,22),hC=r(3,23),gC=r(4,24),mC=r(53,55),uC=r(7,27),dC=r(8,28),pC=r(9,29),cC=r(30,39),lC=r(31,39),iC=r(32,39),nC=r(33,39),aC=r(34,39),oC=r(35,39),sC=r(36,39),rC=r(37,39),FZ=r(90,39),tC=r(40,49),eC=r(41,49),Yj=r(42,49),Zj=r(43,49),Qj=r(44,49),Jj=r(45,49),Xj=r(46,49),zj=r(47,49),Gj=r(100,49),eX=r(91,39),Hj=r(92,39),Yz=r(93,39),Wj=r(94,39),Kj=r(95,39),$j=r(96,39),Uj=r(97,39),Vj=r(101,49),qj=r(102,49),Bj=r(103,49),Fj=r(104,49),Rj=r(105,49),Mj=r(106,49),Dj=r(107,49)});var Zz=F(()=>{T5();T5()});var Xz=({type:Y,message:Z,timestamp:Q,piped:J,commandId:X,result:{failed:z=!1}={},options:{reject:G=!0}})=>{let H=DF(Q),W=LF[Y]({failed:z,reject:G,piped:J}),K=TF[Y]({reject:G});return`${FZ(`[${H}]`)} ${FZ(`[${X}]`)} ${K(W)} ${K(Z)}`},DF=(Y)=>`${RZ(Y.getHours(),2)}:${RZ(Y.getMinutes(),2)}:${RZ(Y.getSeconds(),2)}.${RZ(Y.getMilliseconds(),3)}`,RZ=(Y,Z)=>String(Y).padStart(Z,"0"),Qz=({failed:Y,reject:Z})=>{if(!Y)return BZ.tick;return Z?BZ.cross:BZ.warning},LF,Jz=(Y)=>Y,TF;var zz=F(()=>{rX();Zz();LF={command:({piped:Y})=>Y?"|":"$",output:()=>" ",ipc:()=>"*",error:Qz,duration:Qz},TF={command:()=>tX,output:()=>Jz,ipc:()=>Jz,error:({reject:Y})=>Y?eX:Yz,duration:()=>FZ}});var Gz=(Y,Z,Q)=>{let J=cX(Z,Q);return Y.map(({verboseLine:X,verboseObject:z})=>_F(X,z,J)).filter((X)=>X!==void 0).map((X)=>NF(X)).join("")},_F=(Y,Z,Q)=>{if(Q===void 0)return Y;let J=Q(Y,Z);if(typeof J==="string")return J},NF=(Y)=>Y.endsWith(`
|
|
54
47
|
`)?Y:`${Y}
|
|
55
|
-
`;var
|
|
56
|
-
`).map((Q)=>iH({...Z,message:Q})),iH=(Y)=>{return{verboseLine:F3(Y),verboseObject:Y}},r8=(Y)=>{let Z=typeof Y==="string"?Y:pH(Y);return R1(Z).replaceAll("\t"," ".repeat(nH))},nH=2;var M3=(Y,Z)=>{if(!L6(Z))return;g0({type:"command",verboseMessage:Y,verboseInfo:Z})};var D3=(Y,Z,Q)=>{sH(Y);let X=aH(Y);return{verbose:Y,escapedCommand:Z,commandId:X,rawOptions:Q}},aH=(Y)=>L6({verbose:Y})?oH++:void 0,oH=0n,sH=(Y)=>{for(let Z of Y){if(Z===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(Z===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!a8.includes(Z)&&!n8(Z)){let Q=a8.map((X)=>`'${X}'`).join(", ");throw TypeError(`The "verbose" option must not be ${Z}. Allowed values are: ${Q} or a function.`)}}};import{hrtime as L3}from"node:process";var e8=()=>L3.bigint(),W7=(Y)=>Number(L3.bigint()-Y)/1e6;var Y4=(Y,Z,Q)=>{let X=e8(),{command:J,escapedCommand:$}=$3(Y,Z),G=$7(Q,"verbose"),K=D3(G,$,{...Q});return M3($,K),{command:J,escapedCommand:$,startTime:X,verboseInfo:K}};var MX=Y7(KQ(),1);import fW from"node:path";import RX from"node:process";import J4 from"node:process";import hY from"node:path";function Q4(Y={}){let{env:Z=process.env,platform:Q=process.platform}=Y;if(Q!=="win32")return"PATH";return Object.keys(Z).reverse().find((X)=>X.toUpperCase()==="PATH")||"Path"}import{promisify as Ez}from"node:util";import{execFile as Cz,execFileSync as QT}from"node:child_process";import HQ from"node:path";import{fileURLToPath as kz}from"node:url";var $T=Ez(Cz);function X4(Y){return Y instanceof URL?kz(Y):Y}function zQ(Y){return{*[Symbol.iterator](){let Z=HQ.resolve(X4(Y)),Q;while(Q!==Z)yield Z,Q=Z,Z=HQ.resolve(Z,"..")}}}var Az=({cwd:Y=J4.cwd(),path:Z=J4.env[Q4()],preferLocal:Q=!0,execPath:X=J4.execPath,addExecPath:J=!0}={})=>{let $=hY.resolve(X4(Y)),G=[],K=Z.split(hY.delimiter);if(Q)Iz(G,K,$);if(J)jz(G,K,X,$);return Z===""||Z===hY.delimiter?`${G.join(hY.delimiter)}${Z}`:[...G,Z].join(hY.delimiter)},Iz=(Y,Z,Q)=>{for(let X of zQ(Q)){let J=hY.join(X,"node_modules/.bin");if(!Z.includes(J))Y.push(J)}},jz=(Y,Z,Q,X)=>{let J=hY.resolve(X,X4(Q),"..");if(!Z.includes(J))Y.push(J)},WQ=({env:Y=J4.env,...Z}={})=>{Y={...Y};let Q=Q4({env:Y});return Z.path=Y[Q],Y[Q]=Az(Z),Y};import{setTimeout as iz}from"node:timers/promises";var UQ=(Y,Z,Q)=>{let X=Q?M1:bY,J=Y instanceof m0?{}:{cause:Y};return new X(Z,J)};class m0 extends Error{}var qQ=(Y,Z)=>{Object.defineProperty(Y.prototype,"name",{value:Z,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(Y.prototype,BQ,{value:!0,writable:!1,enumerable:!1,configurable:!1})},VQ=(Y)=>$4(Y)&&(BQ in Y),BQ=Symbol("isExecaError"),$4=(Y)=>Object.prototype.toString.call(Y)==="[object Error]";class bY extends Error{}qQ(bY,bY.name);class M1 extends Error{}qQ(M1,M1.name);import{constants as D1}from"node:os";import{constants as vz}from"node:os";var FQ=()=>{let Y=T7-RQ+1;return Array.from({length:Y},xz)},xz=(Y,Z)=>({name:`SIGRT${Z+1}`,number:RQ+Z,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),RQ=34,T7=64;import{constants as Sz}from"node:os";var MQ=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var _7=()=>{let Y=FQ();return[...MQ,...Y].map(yz)},yz=({name:Y,number:Z,description:Q,action:X,forced:J=!1,standard:$})=>{let{signals:{[Y]:G}}=Sz,K=G!==void 0;return{name:Y,number:K?G:Z,description:Q,supported:K,action:X,forced:J,standard:$}};var fz=()=>{let Y=_7();return Object.fromEntries(Y.map(hz))},hz=({name:Y,number:Z,description:Q,supported:X,action:J,forced:$,standard:G})=>[Y,{name:Y,number:Z,description:Q,supported:X,action:J,forced:$,standard:G}],DQ=fz(),bz=()=>{let Y=_7(),Z=T7+1,Q=Array.from({length:Z},(X,J)=>gz(J,Y));return Object.assign({},...Q)},gz=(Y,Z)=>{let Q=mz(Y,Z);if(Q===void 0)return{};let{name:X,description:J,supported:$,action:G,forced:K,standard:H}=Q;return{[Y]:{name:X,number:Y,description:J,supported:$,action:G,forced:K,standard:H}}},mz=(Y,Z)=>{let Q=Z.find(({name:X})=>vz.signals[X]===Y);if(Q!==void 0)return Q;return Z.find((X)=>X.number===Y)},NT=bz();var TQ=(Y)=>{if(Y===0)throw TypeError("Invalid option `killSignal`: 0 cannot be used.");return wQ(Y,"option `killSignal`")},_Q=(Y)=>Y===0?Y:wQ(Y,"`subprocess.kill()`'s argument"),wQ=(Y,Z)=>{if(Number.isInteger(Y))return uz(Y,Z);if(typeof Y==="string")return pz(Y,Z);throw TypeError(`Invalid ${Z} ${String(Y)}: it must be a string or an integer.
|
|
57
|
-
${
|
|
58
|
-
${
|
|
59
|
-
${
|
|
60
|
-
Available signal numbers: ${
|
|
48
|
+
`;var Hz=F(()=>{eY()});import{inspect as wF}from"node:util";var $Y=({type:Y,verboseMessage:Z,fdNumber:Q,verboseInfo:J,result:X})=>{let z=OF({type:Y,result:X,verboseInfo:J}),G=IF(Z,z),H=Gz(G,J,Q);if(H!=="")console.warn(H.slice(0,-1))},OF=({type:Y,result:Z,verboseInfo:{escapedCommand:Q,commandId:J,rawOptions:{piped:X=!1,...z}}})=>({type:Y,escapedCommand:Q,commandId:`${J}`,timestamp:new Date,piped:X,result:Z,options:z}),IF=(Y,Z)=>Y.split(`
|
|
49
|
+
`).map((Q)=>EF({...Z,message:Q})),EF=(Y)=>{return{verboseLine:Xz(Y),verboseObject:Y}},MZ=(Y)=>{let Z=typeof Y==="string"?Y:wF(Y);return L1(Z).replaceAll("\t"," ".repeat(CF))},CF=2;var O8=F(()=>{qZ();zz();Hz()});var Wz=(Y,Z)=>{if(!N8(Z))return;$Y({type:"command",verboseMessage:Y,verboseInfo:Z})};var Kz=F(()=>{eY();O8()});var $z=(Y,Z,Q)=>{AF(Y);let J=jF(Y);return{verbose:Y,escapedCommand:Z,commandId:J,rawOptions:Q}},jF=(Y)=>N8({verbose:Y})?kF++:void 0,kF=0n,AF=(Y)=>{for(let Z of Y){if(Z===!1)throw TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);if(Z===!0)throw TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);if(!VZ.includes(Z)&&!UZ(Z)){let Q=VZ.map((J)=>`'${J}'`).join(", ");throw TypeError(`The "verbose" option must not be ${Z}. Allowed values are: ${Q} or a function.`)}}};var Uz=F(()=>{eY()});import{hrtime as Vz}from"node:process";var DZ=()=>Vz.bigint(),_5=(Y)=>Number(Vz.bigint()-Y)/1e6;var LZ=()=>{};var TZ=(Y,Z,Q)=>{let J=DZ(),{command:X,escapedCommand:z}=lX(Y,Z),G=F5(Q,"verbose"),H=$z(G,z,{...Q});return Wz(z,H),{command:X,escapedCommand:z,startTime:J,verboseInfo:H}};var N5=F(()=>{Kz();Uz();LZ();qZ();SY()});var Mz=h0((cj,Rz)=>{Rz.exports=Fz;Fz.sync=xF;var qz=HY("fs");function PF(Y,Z){var Q=Z.pathExt!==void 0?Z.pathExt:process.env.PATHEXT;if(!Q)return!0;if(Q=Q.split(";"),Q.indexOf("")!==-1)return!0;for(var J=0;J<Q.length;J++){var X=Q[J].toLowerCase();if(X&&Y.substr(-X.length).toLowerCase()===X)return!0}return!1}function Bz(Y,Z,Q){if(!Y.isSymbolicLink()&&!Y.isFile())return!1;return PF(Z,Q)}function Fz(Y,Z,Q){qz.stat(Y,function(J,X){Q(J,J?!1:Bz(X,Y,Z))})}function xF(Y,Z){return Bz(qz.statSync(Y),Y,Z)}});var Nz=h0((lj,_z)=>{_z.exports=Lz;Lz.sync=SF;var Dz=HY("fs");function Lz(Y,Z,Q){Dz.stat(Y,function(J,X){Q(J,J?!1:Tz(X,Z))})}function SF(Y,Z){return Tz(Dz.statSync(Y),Z)}function Tz(Y,Z){return Y.isFile()&&vF(Y,Z)}function vF(Y,Z){var{mode:Q,uid:J,gid:X}=Y,z=Z.uid!==void 0?Z.uid:process.getuid&&process.getuid(),G=Z.gid!==void 0?Z.gid:process.getgid&&process.getgid(),H=parseInt("100",8),W=parseInt("010",8),K=parseInt("001",8),$=H|W,V=Q&K||Q&W&&X===G||Q&H&&J===z||Q&$&&z===0;return V}});var Oz=h0((nj,wz)=>{var ij=HY("fs"),_Z;if(process.platform==="win32"||global.TESTING_WINDOWS)_Z=Mz();else _Z=Nz();wz.exports=w5;w5.sync=yF;function w5(Y,Z,Q){if(typeof Z==="function")Q=Z,Z={};if(!Q){if(typeof Promise!=="function")throw TypeError("callback not provided");return new Promise(function(J,X){w5(Y,Z||{},function(z,G){if(z)X(z);else J(G)})})}_Z(Y,Z||{},function(J,X){if(J){if(J.code==="EACCES"||Z&&Z.ignoreErrors)J=null,X=!1}Q(J,X)})}function yF(Y,Z){try{return _Z.sync(Y,Z||{})}catch(Q){if(Z&&Z.ignoreErrors||Q.code==="EACCES")return!1;else throw Q}}});var Pz=h0((aj,Az)=>{var I8=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",Iz=HY("path"),fF=I8?";":":",Ez=Oz(),Cz=(Y)=>Object.assign(Error(`not found: ${Y}`),{code:"ENOENT"}),jz=(Y,Z)=>{let Q=Z.colon||fF,J=Y.match(/\//)||I8&&Y.match(/\\/)?[""]:[...I8?[process.cwd()]:[],...(Z.path||process.env.PATH||"").split(Q)],X=I8?Z.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",z=I8?X.split(Q):[""];if(I8){if(Y.indexOf(".")!==-1&&z[0]!=="")z.unshift("")}return{pathEnv:J,pathExt:z,pathExtExe:X}},kz=(Y,Z,Q)=>{if(typeof Z==="function")Q=Z,Z={};if(!Z)Z={};let{pathEnv:J,pathExt:X,pathExtExe:z}=jz(Y,Z),G=[],H=(K)=>new Promise(($,V)=>{if(K===J.length)return Z.all&&G.length?$(G):V(Cz(Y));let q=J[K],M=/^".*"$/.test(q)?q.slice(1,-1):q,B=Iz.join(M,Y),D=!M&&/^\.[\\\/]/.test(Y)?Y.slice(0,2)+B:B;$(W(D,K,0))}),W=(K,$,V)=>new Promise((q,M)=>{if(V===X.length)return q(H($+1));let B=X[V];Ez(K+B,{pathExt:z},(D,T)=>{if(!D&&T)if(Z.all)G.push(K+B);else return q(K+B);return q(W(K,$,V+1))})});return Q?H(0).then((K)=>Q(null,K),Q):H(0)},bF=(Y,Z)=>{Z=Z||{};let{pathEnv:Q,pathExt:J,pathExtExe:X}=jz(Y,Z),z=[];for(let G=0;G<Q.length;G++){let H=Q[G],W=/^".*"$/.test(H)?H.slice(1,-1):H,K=Iz.join(W,Y),$=!W&&/^\.[\\\/]/.test(Y)?Y.slice(0,2)+K:K;for(let V=0;V<J.length;V++){let q=$+J[V];try{if(Ez.sync(q,{pathExt:X}))if(Z.all)z.push(q);else return q}catch(M){}}}if(Z.all&&z.length)return z;if(Z.nothrow)return null;throw Cz(Y)};Az.exports=kz;kz.sync=bF});var Sz=h0((oj,O5)=>{var xz=(Y={})=>{let Z=Y.env||process.env;if((Y.platform||process.platform)!=="win32")return"PATH";return Object.keys(Z).reverse().find((J)=>J.toUpperCase()==="PATH")||"Path"};O5.exports=xz;O5.exports.default=xz});var bz=h0((sj,fz)=>{var vz=HY("path"),hF=Pz(),gF=Sz();function yz(Y,Z){let Q=Y.options.env||process.env,J=process.cwd(),X=Y.options.cwd!=null,z=X&&process.chdir!==void 0&&!process.chdir.disabled;if(z)try{process.chdir(Y.options.cwd)}catch(H){}let G;try{G=hF.sync(Y.command,{path:Q[gF({env:Q})],pathExt:Z?vz.delimiter:void 0})}catch(H){}finally{if(z)process.chdir(J)}if(G)G=vz.resolve(X?Y.options.cwd:"",G);return G}function mF(Y){return yz(Y)||yz(Y,!0)}fz.exports=mF});var hz=h0((pF,E5)=>{var I5=/([()\][%!^"`<>&|;, *?])/g;function uF(Y){return Y=Y.replace(I5,"^$1"),Y}function dF(Y,Z){if(Y=`${Y}`,Y=Y.replace(/(?=(\\+?)?)\1"/g,"$1$1\\\""),Y=Y.replace(/(?=(\\+?)?)\1$/,"$1$1"),Y=`"${Y}"`,Y=Y.replace(I5,"^$1"),Z)Y=Y.replace(I5,"^$1");return Y}pF.command=uF;pF.argument=dF});var mz=h0((rj,gz)=>{gz.exports=/^#!(.*)/});var dz=h0((tj,uz)=>{var iF=mz();uz.exports=(Y="")=>{let Z=Y.match(iF);if(!Z)return null;let[Q,J]=Z[0].replace(/#! ?/,"").split(" "),X=Q.split("/").pop();if(X==="env")return J;return J?`${X} ${J}`:X}});var cz=h0((ej,pz)=>{var C5=HY("fs"),nF=dz();function aF(Y){let Q=Buffer.alloc(150),J;try{J=C5.openSync(Y,"r"),C5.readSync(J,Q,0,150,0),C5.closeSync(J)}catch(X){}return nF(Q.toString())}pz.exports=aF});var az=h0((Yk,nz)=>{var oF=HY("path"),lz=bz(),iz=hz(),sF=cz(),rF=process.platform==="win32",tF=/\.(?:com|exe)$/i,eF=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function YR(Y){Y.file=lz(Y);let Z=Y.file&&sF(Y.file);if(Z)return Y.args.unshift(Y.file),Y.command=Z,lz(Y);return Y.file}function ZR(Y){if(!rF)return Y;let Z=YR(Y),Q=!tF.test(Z);if(Y.options.forceShell||Q){let J=eF.test(Z);Y.command=oF.normalize(Y.command),Y.command=iz.command(Y.command),Y.args=Y.args.map((z)=>iz.argument(z,J));let X=[Y.command].concat(Y.args).join(" ");Y.args=["/d","/s","/c",`"${X}"`],Y.command=process.env.comspec||"cmd.exe",Y.options.windowsVerbatimArguments=!0}return Y}function QR(Y,Z,Q){if(Z&&!Array.isArray(Z))Q=Z,Z=null;Z=Z?Z.slice(0):[],Q=Object.assign({},Q);let J={command:Y,args:Z,options:Q,file:void 0,original:{command:Y,args:Z}};return Q.shell?J:ZR(J)}nz.exports=QR});var rz=h0((Zk,sz)=>{var j5=process.platform==="win32";function k5(Y,Z){return Object.assign(Error(`${Z} ${Y.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${Z} ${Y.command}`,path:Y.command,spawnargs:Y.args})}function JR(Y,Z){if(!j5)return;let Q=Y.emit;Y.emit=function(J,X){if(J==="exit"){let z=oz(X,Z);if(z)return Q.call(Y,"error",z)}return Q.apply(Y,arguments)}}function oz(Y,Z){if(j5&&Y===1&&!Z.file)return k5(Z.original,"spawn");return null}function XR(Y,Z){if(j5&&Y===1&&!Z.file)return k5(Z.original,"spawnSync");return null}sz.exports={hookChildProcess:JR,verifyENOENT:oz,verifyENOENTSync:XR,notFoundError:k5}});var YG=h0((Qk,E8)=>{var tz=HY("child_process"),A5=az(),P5=rz();function ez(Y,Z,Q){let J=A5(Y,Z,Q),X=tz.spawn(J.command,J.args,J.options);return P5.hookChildProcess(X,J),X}function zR(Y,Z,Q){let J=A5(Y,Z,Q),X=tz.spawnSync(J.command,J.args,J.options);return X.error=X.error||P5.verifyENOENTSync(X.status,J),X}E8.exports=ez;E8.exports.spawn=ez;E8.exports.sync=zR;E8.exports._parse=A5;E8.exports._enoent=P5});function NZ(Y={}){let{env:Z=process.env,platform:Q=process.platform}=Y;if(Q!=="win32")return"PATH";return Object.keys(Z).reverse().find((J)=>J.toUpperCase()==="PATH")||"Path"}import{promisify as GR}from"node:util";import{execFile as HR,execFileSync as Gk}from"node:child_process";import ZG from"node:path";import{fileURLToPath as WR}from"node:url";function wZ(Y){return Y instanceof URL?WR(Y):Y}function QG(Y){return{*[Symbol.iterator](){let Z=ZG.resolve(wZ(Y)),Q;while(Q!==Z)yield Z,Q=Z,Z=ZG.resolve(Z,"..")}}}var Kk;var JG=F(()=>{Kk=GR(HR)});import OZ from"node:process";import v6 from"node:path";var KR=({cwd:Y=OZ.cwd(),path:Z=OZ.env[NZ()],preferLocal:Q=!0,execPath:J=OZ.execPath,addExecPath:X=!0}={})=>{let z=v6.resolve(wZ(Y)),G=[],H=Z.split(v6.delimiter);if(Q)$R(G,H,z);if(X)UR(G,H,J,z);return Z===""||Z===v6.delimiter?`${G.join(v6.delimiter)}${Z}`:[...G,Z].join(v6.delimiter)},$R=(Y,Z,Q)=>{for(let J of QG(Q)){let X=v6.join(J,"node_modules/.bin");if(!Z.includes(X))Y.push(X)}},UR=(Y,Z,Q,J)=>{let X=v6.resolve(J,wZ(Q),"..");if(!Z.includes(X))Y.push(X)},XG=({env:Y=OZ.env,...Z}={})=>{Y={...Y};let Q=NZ({env:Y});return Z.path=Y[Q],Y[Q]=KR(Z),Y};var zG=F(()=>{JG()});var GG=(Y,Z,Q)=>{let J=Q?T1:UY,X=Y instanceof VY?{}:{cause:Y};return new J(Z,X)},VY,HG=(Y,Z)=>{Object.defineProperty(Y.prototype,"name",{value:Z,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(Y.prototype,KG,{value:!0,writable:!1,enumerable:!1,configurable:!1})},WG=(Y)=>IZ(Y)&&(KG in Y),KG,IZ=(Y)=>Object.prototype.toString.call(Y)==="[object Error]",UY,T1;var Y6=F(()=>{VY=class VY extends Error{};KG=Symbol("isExecaError");UY=class UY extends Error{};HG(UY,UY.name);T1=class T1 extends Error{};HG(T1,T1.name)});var $G=()=>{let Y=x5-UG+1;return Array.from({length:Y},VR)},VR=(Y,Z)=>({name:`SIGRT${Z+1}`,number:UG+Z,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),UG=34,x5=64;var VG;var qG=F(()=>{VG=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}]});import{constants as qR}from"node:os";var S5=()=>{let Y=$G();return[...VG,...Y].map(BR)},BR=({name:Y,number:Z,description:Q,action:J,forced:X=!1,standard:z})=>{let{signals:{[Y]:G}}=qR,H=G!==void 0;return{name:Y,number:H?G:Z,description:Q,supported:H,action:J,forced:X,standard:z}};var BG=F(()=>{qG()});import{constants as FR}from"node:os";var RR=()=>{let Y=S5();return Object.fromEntries(Y.map(MR))},MR=({name:Y,number:Z,description:Q,supported:J,action:X,forced:z,standard:G})=>[Y,{name:Y,number:Z,description:Q,supported:J,action:X,forced:z,standard:G}],FG,DR=()=>{let Y=S5(),Z=x5+1,Q=Array.from({length:Z},(J,X)=>LR(X,Y));return Object.assign({},...Q)},LR=(Y,Z)=>{let Q=TR(Y,Z);if(Q===void 0)return{};let{name:J,description:X,supported:z,action:G,forced:H,standard:W}=Q;return{[Y]:{name:J,number:Y,description:X,supported:z,action:G,forced:H,standard:W}}},TR=(Y,Z)=>{let Q=Z.find(({name:J})=>FR.signals[J]===Y);if(Q!==void 0)return Q;return Z.find((J)=>J.number===Y)},Ck;var RG=F(()=>{BG();FG=RR(),Ck=DR()});import{constants as _1}from"node:os";var DG=(Y)=>{if(Y===0)throw TypeError("Invalid option `killSignal`: 0 cannot be used.");return TG(Y,"option `killSignal`")},LG=(Y)=>Y===0?Y:TG(Y,"`subprocess.kill()`'s argument"),TG=(Y,Z)=>{if(Number.isInteger(Y))return _R(Y,Z);if(typeof Y==="string")return wR(Y,Z);throw TypeError(`Invalid ${Z} ${String(Y)}: it must be a string or an integer.
|
|
50
|
+
${v5()}`)},_R=(Y,Z)=>{if(MG.has(Y))return MG.get(Y);throw TypeError(`Invalid ${Z} ${Y}: this signal integer does not exist.
|
|
51
|
+
${v5()}`)},NR=()=>new Map(Object.entries(_1.signals).reverse().map(([Y,Z])=>[Z,Y])),MG,wR=(Y,Z)=>{if(Y in _1.signals)return Y;if(Y.toUpperCase()in _1.signals)throw TypeError(`Invalid ${Z} '${Y}': please rename it to '${Y.toUpperCase()}'.`);throw TypeError(`Invalid ${Z} '${Y}': this signal name does not exist.
|
|
52
|
+
${v5()}`)},v5=()=>`Available signal names: ${OR()}.
|
|
53
|
+
Available signal numbers: ${IR()}.`,OR=()=>Object.keys(_1.signals).sort().map((Y)=>`'${Y}'`).join(", "),IR=()=>[...new Set(Object.values(_1.signals).sort((Y,Z)=>Y-Z))].join(", "),EZ=(Y)=>FG[Y].description;var N1=F(()=>{RG();MG=NR()});import{setTimeout as ER}from"node:timers/promises";var _G=(Y)=>{if(Y===!1)return Y;if(Y===!0)return CR;if(!Number.isFinite(Y)||Y<0)throw TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${Y}\` (${typeof Y})`);return Y},CR=5000,NG=({kill:Y,options:{forceKillAfterDelay:Z,killSignal:Q},onInternalError:J,context:X,controller:z},G,H)=>{let{signal:W,error:K}=jR(G,H,Q);kR(K,J);let $=Y(W);return AR({kill:Y,signal:W,forceKillAfterDelay:Z,killSignal:Q,killResult:$,context:X,controller:z}),$},jR=(Y,Z,Q)=>{let[J=Q,X]=IZ(Y)?[void 0,Y]:[Y,Z];if(typeof J!=="string"&&!Number.isInteger(J))throw TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(J)}`);if(X!==void 0&&!IZ(X))throw TypeError(`The second argument is optional. If specified, it must be an error instance: ${X}`);return{signal:LG(J),error:X}},kR=(Y,Z)=>{if(Y!==void 0)Z.reject(Y)},AR=async({kill:Y,signal:Z,forceKillAfterDelay:Q,killSignal:J,killResult:X,context:z,controller:G})=>{if(Z===J&&X)y5({kill:Y,forceKillAfterDelay:Q,context:z,controllerSignal:G.signal})},y5=async({kill:Y,forceKillAfterDelay:Z,context:Q,controllerSignal:J})=>{if(Z===!1)return;try{if(await ER(Z,void 0,{signal:J}),Y("SIGKILL"))Q.isForcefullyTerminated??=!0}catch{}};var CZ=F(()=>{Y6();N1()});import{once as PR}from"node:events";var jZ=async(Y,Z)=>{if(!Y.aborted)await PR(Y,"abort",{signal:Z})};var f5=()=>{};var wG=({cancelSignal:Y})=>{if(Y!==void 0&&Object.prototype.toString.call(Y)!=="[object AbortSignal]")throw Error(`The \`cancelSignal\` option must be an AbortSignal: ${String(Y)}`)},OG=({subprocess:Y,cancelSignal:Z,gracefulCancel:Q,context:J,controller:X})=>Z===void 0||Q?[]:[xR(Y,Z,J,X)],xR=async(Y,Z,Q,{signal:J})=>{throw await jZ(Z,J),Q.terminationReason??="cancel",Y.kill(),Z.reason};var b5=F(()=>{f5()});var C8=({methodName:Y,isSubprocess:Z,ipc:Q,isConnected:J})=>{SR(Y,Z,Q),h5(Y,Z,J)},SR=(Y,Z,Q)=>{if(!Q)throw Error(`${QY(Y,Z)} can only be used if the \`ipc\` option is \`true\`.`)},h5=(Y,Z,Q)=>{if(!Q)throw Error(`${QY(Y,Z)} cannot be used: the ${Z6(Z)} has already exited or disconnected.`)},IG=(Y)=>{throw Error(`${QY("getOneMessage",Y)} could not complete: the ${Z6(Y)} exited or disconnected.`)},EG=(Y)=>{throw Error(`${QY("sendMessage",Y)} failed: the ${Z6(Y)} is sending a message too, instead of listening to incoming messages.
|
|
61
54
|
This can be fixed by both sending a message and listening to incoming messages at the same time:
|
|
62
55
|
|
|
63
56
|
const [receivedMessage] = await Promise.all([
|
|
64
|
-
${
|
|
65
|
-
${
|
|
66
|
-
]);`)},
|
|
67
|
-
It must be ${
|
|
68
|
-
It is optional and defaults to "${
|
|
69
|
-
Please set the "stdio" option to ensure that file descriptor exists.`);if(
|
|
70
|
-
Please set this option with "pipe" instead.`},
|
|
71
|
-
Please rename it to ${
|
|
72
|
-
Please rename it to one of: ${Q}.`)},
|
|
73
|
-
${Y.message}`,Y}},
|
|
74
|
-
${
|
|
57
|
+
${QY("getOneMessage",Y)},
|
|
58
|
+
${QY("sendMessage",Y,"message, {strict: true}")},
|
|
59
|
+
]);`)},kZ=(Y,Z)=>Error(`${QY("sendMessage",Z)} failed when sending an acknowledgment response to the ${Z6(Z)}.`,{cause:Y}),CG=(Y)=>{throw Error(`${QY("sendMessage",Y)} failed: the ${Z6(Y)} is not listening to incoming messages.`)},jG=(Y)=>{throw Error(`${QY("sendMessage",Y)} failed: the ${Z6(Y)} exited without listening to incoming messages.`)},kG=()=>Error(`\`cancelSignal\` aborted: the ${Z6(!0)} disconnected.`),AG=()=>{throw Error("`getCancelSignal()` cannot be used without setting the `cancelSignal` subprocess option.")},PG=({error:Y,methodName:Z,isSubprocess:Q})=>{if(Y.code==="EPIPE")throw Error(`${QY(Z,Q)} cannot be used: the ${Z6(Q)} is disconnecting.`,{cause:Y})},xG=({error:Y,methodName:Z,isSubprocess:Q,message:J})=>{if(vR(Y))throw Error(`${QY(Z,Q)}'s argument type is invalid: the message cannot be serialized: ${String(J)}.`,{cause:Y})},vR=({code:Y,message:Z})=>yR.has(Y)||fR.some((Q)=>Z.includes(Q)),yR,fR,QY=(Y,Z,Q="")=>Y==="cancelSignal"?"`cancelSignal`'s `controller.abort()`":`${bR(Z)}${Y}(${Q})`,bR=(Y)=>Y?"":"subprocess.",Z6=(Y)=>Y?"parent process":"subprocess",j8=(Y)=>{if(Y.connected)Y.disconnect()};var k8=F(()=>{yR=new Set(["ERR_MISSING_ARGS","ERR_INVALID_ARG_TYPE"]),fR=["could not be cloned","circular structure","call stack size exceeded"]});var qY=()=>{let Y={},Z=new Promise((Q,J)=>{Object.assign(Y,{resolve:Q,reject:J})});return Object.assign(Z,Y)};var PZ=(Y,Z="stdin")=>{let{options:J,fileDescriptors:X}=BY.get(Y),z=SG(X,Z,!0),G=Y.stdio[z];if(G===null)throw TypeError(vG(z,Z,J,!0));return G},A8=(Y,Z="stdout")=>{let{options:J,fileDescriptors:X}=BY.get(Y),z=SG(X,Z,!1),G=z==="all"?Y.all:Y.stdio[z];if(G===null||G===void 0)throw TypeError(vG(z,Z,J,!1));return G},BY,SG=(Y,Z,Q)=>{let J=hR(Z,Q);return gR(J,Z,Q,Y),J},hR=(Y,Z)=>{let Q=R5(Y);if(Q!==void 0)return Q;let{validOptions:J,defaultValue:X}=Z?{validOptions:'"stdin"',defaultValue:"stdin"}:{validOptions:'"stdout", "stderr", "all"',defaultValue:"stdout"};throw TypeError(`"${w1(Z)}" must not be "${Y}".
|
|
60
|
+
It must be ${J} or "fd3", "fd4" (and so on).
|
|
61
|
+
It is optional and defaults to "${X}".`)},gR=(Y,Z,Q,J)=>{let X=J[yG(Y)];if(X===void 0)throw TypeError(`"${w1(Q)}" must not be ${Z}. That file descriptor does not exist.
|
|
62
|
+
Please set the "stdio" option to ensure that file descriptor exists.`);if(X.direction==="input"&&!Q)throw TypeError(`"${w1(Q)}" must not be ${Z}. It must be a readable stream, not writable.`);if(X.direction!=="input"&&Q)throw TypeError(`"${w1(Q)}" must not be ${Z}. It must be a writable stream, not readable.`)},vG=(Y,Z,Q,J)=>{if(Y==="all"&&!Q.all)return`The "all" option must be true to use "from: 'all'".`;let{optionName:X,optionValue:z}=mR(Y,Q);return`The "${X}: ${AZ(z)}" option is incompatible with using "${w1(J)}: ${AZ(Z)}".
|
|
63
|
+
Please set this option with "pipe" instead.`},mR=(Y,{stdin:Z,stdout:Q,stderr:J,stdio:X})=>{let z=yG(Y);if(z===0&&Z!==void 0)return{optionName:"stdin",optionValue:Z};if(z===1&&Q!==void 0)return{optionName:"stdout",optionValue:Q};if(z===2&&J!==void 0)return{optionName:"stderr",optionValue:J};return{optionName:`stdio[${z}]`,optionValue:X[z]}},yG=(Y)=>Y==="all"?1:Y,w1=(Y)=>Y?"to":"from",AZ=(Y)=>{if(typeof Y==="string")return`'${Y}'`;return typeof Y==="number"?`${Y}`:"Stream"};var Q6=F(()=>{SY();BY=new WeakMap});import{addAbortListener as uR}from"node:events";var y6=(Y,Z,Q)=>{let J=Y.getMaxListeners();if(J===0||J===Number.POSITIVE_INFINITY)return;Y.setMaxListeners(J+Z),uR(Q,()=>{Y.setMaxListeners(Y.getMaxListeners()-Z)})};var xZ=()=>{};var SZ=(Y,Z)=>{if(Z)g5(Y)},g5=(Y)=>{Y.refCounted()},vZ=(Y,Z)=>{if(Z)m5(Y)},m5=(Y)=>{Y.unrefCounted()},fG=(Y,Z)=>{if(Z)m5(Y),m5(Y)},bG=(Y,Z)=>{if(Z)g5(Y),g5(Y)};import{once as dR}from"node:events";import{scheduler as pR}from"node:timers/promises";var hG=async({anyProcess:Y,channel:Z,isSubprocess:Q,ipcEmitter:J},X)=>{if(dG(X)||cG(X))return;if(!yZ.has(Y))yZ.set(Y,[]);let z=yZ.get(Y);if(z.push(X),z.length>1)return;while(z.length>0){await pG(Y,J,X),await pR.yield();let G=await uG({wrappedMessage:z[0],anyProcess:Y,channel:Z,isSubprocess:Q,ipcEmitter:J});z.shift(),J.emit("message",G),J.emit("message:done")}},gG=async({anyProcess:Y,channel:Z,isSubprocess:Q,ipcEmitter:J,boundOnMessage:X})=>{u5();let z=yZ.get(Y);while(z?.length>0)await dR(J,"message:done");Y.removeListener("message",X),bG(Z,Q),J.connected=!1,J.emit("disconnect")},yZ;var mG=F(()=>{bZ();fZ();hZ();yZ=new WeakMap});import{EventEmitter as cR}from"node:events";var J6=(Y,Z,Q)=>{if(gZ.has(Y))return gZ.get(Y);let J=new cR;return J.connected=!0,gZ.set(Y,J),lR({ipcEmitter:J,anyProcess:Y,channel:Z,isSubprocess:Q}),J},gZ,lR=({ipcEmitter:Y,anyProcess:Z,channel:Q,isSubprocess:J})=>{let X=hG.bind(void 0,{anyProcess:Z,channel:Q,isSubprocess:J,ipcEmitter:Y});Z.on("message",X),Z.once("disconnect",gG.bind(void 0,{anyProcess:Z,channel:Q,isSubprocess:J,ipcEmitter:Y,boundOnMessage:X})),fG(Q,J)},mZ=(Y)=>{let Z=gZ.get(Y);return Z===void 0?Y.channel!==null:Z.connected};var O1=F(()=>{mG();gZ=new WeakMap});import{once as iR}from"node:events";var lG=({anyProcess:Y,channel:Z,isSubprocess:Q,message:J,strict:X})=>{if(!X)return J;let z=J6(Y,Z,Q),G=pZ(Y,z);return{id:nR++,type:dZ,message:J,hasListeners:G}},nR=0n,iG=(Y,Z)=>{if(Z?.type!==dZ||Z.hasListeners)return;for(let{id:Q}of Y)if(Q!==void 0)uZ[Q].resolve({isDeadlock:!0,hasListeners:!1})},uG=async({wrappedMessage:Y,anyProcess:Z,channel:Q,isSubprocess:J,ipcEmitter:X})=>{if(Y?.type!==dZ||!Z.connected)return Y;let{id:z,message:G}=Y,H={id:z,type:aG,message:pZ(Z,X)};try{await cZ({anyProcess:Z,channel:Q,isSubprocess:J,ipc:!0},H)}catch(W){X.emit("strict:error",W)}return G},dG=(Y)=>{if(Y?.type!==aG)return!1;let{id:Z,message:Q}=Y;return uZ[Z]?.resolve({isDeadlock:!1,hasListeners:Q}),!0},nG=async(Y,Z,Q)=>{if(Y?.type!==dZ)return;let J=qY();uZ[Y.id]=J;let X=new AbortController;try{let{isDeadlock:z,hasListeners:G}=await Promise.race([J,aR(Z,Q,X)]);if(z)EG(Q);if(!G)CG(Q)}finally{X.abort(),delete uZ[Y.id]}},uZ,aR=async(Y,Z,{signal:Q})=>{y6(Y,1,Q),await iR(Y,"disconnect",{signal:Q}),jG(Z)},dZ="execa:ipc:request",aG="execa:ipc:response";var fZ=F(()=>{xZ();lZ();k8();O1();bZ();uZ={}});var oG=(Y,Z,Q)=>{if(!I1.has(Y))I1.set(Y,new Set);let J=I1.get(Y),X=qY(),z=Q?Z.id:void 0,G={onMessageSent:X,id:z};return J.add(G),{outgoingMessages:J,outgoingMessage:G}},sG=({outgoingMessages:Y,outgoingMessage:Z})=>{Y.delete(Z),Z.onMessageSent.resolve()},pG=async(Y,Z,Q)=>{while(!pZ(Y,Z)&&I1.get(Y)?.size>0){let J=[...I1.get(Y)];iG(J,Q),await Promise.all(J.map(({onMessageSent:X})=>X))}},I1,pZ=(Y,Z)=>Z.listenerCount("message")>oR(Y),oR=(Y)=>BY.has(Y)&&!xY(BY.get(Y).options.buffer,"ipc")?1:0;var bZ=F(()=>{SY();Q6();fZ();I1=new WeakMap});import{promisify as sR}from"node:util";var cZ=({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:J},X,{strict:z=!1}={})=>{return C8({methodName:"sendMessage",isSubprocess:Q,ipc:J,isConnected:Y.connected}),rR({anyProcess:Y,channel:Z,methodName:"sendMessage",isSubprocess:Q,message:X,strict:z})},rR=async({anyProcess:Y,channel:Z,methodName:Q,isSubprocess:J,message:X,strict:z})=>{let G=lG({anyProcess:Y,channel:Z,isSubprocess:J,message:X,strict:z}),H=oG(Y,G,z);try{await p5({anyProcess:Y,methodName:Q,isSubprocess:J,wrappedMessage:G,message:X})}catch(W){throw j8(Y),W}finally{sG(H)}},p5=async({anyProcess:Y,methodName:Z,isSubprocess:Q,wrappedMessage:J,message:X})=>{let z=tR(Y);try{await Promise.all([nG(J,Y,Q),z(J)])}catch(G){throw PG({error:G,methodName:Z,isSubprocess:Q}),xG({error:G,methodName:Z,isSubprocess:Q,message:X}),G}},tR=(Y)=>{if(d5.has(Y))return d5.get(Y);let Z=sR(Y.send.bind(Y));return d5.set(Y,Z),Z},d5;var lZ=F(()=>{k8();bZ();fZ();d5=new WeakMap});import{scheduler as eR}from"node:timers/promises";var tG=(Y,Z)=>{return h5("cancelSignal",!1,Y.connected),p5({anyProcess:Y,methodName:"cancelSignal",isSubprocess:!1,wrappedMessage:{type:YH,message:Z},message:Z})},eG=async({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:J})=>{return await YM({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:J}),c5.signal},YM=async({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:J})=>{if(rG)return;if(rG=!0,!J){AG();return}if(Z===null){u5();return}J6(Y,Z,Q),await eR.yield()},rG=!1,cG=(Y)=>{if(Y?.type!==YH)return!1;return c5.abort(Y.message),!0},YH="execa:ipc:cancel",u5=()=>{c5.abort(kG())},c5;var hZ=F(()=>{lZ();O1();k8();c5=new AbortController});var ZH=({gracefulCancel:Y,cancelSignal:Z,ipc:Q,serialization:J})=>{if(!Y)return;if(Z===void 0)throw Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");if(!Q)throw Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");if(J==="json")throw Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.")},QH=({subprocess:Y,cancelSignal:Z,gracefulCancel:Q,forceKillAfterDelay:J,context:X,controller:z})=>Q?[ZM({subprocess:Y,cancelSignal:Z,forceKillAfterDelay:J,context:X,controller:z})]:[],ZM=async({subprocess:Y,cancelSignal:Z,forceKillAfterDelay:Q,context:J,controller:{signal:X}})=>{await jZ(Z,X);let z=QM(Z);throw await tG(Y,z),y5({kill:Y.kill,forceKillAfterDelay:Q,context:J,controllerSignal:X}),J.terminationReason??="gracefulCancel",Z.reason},QM=({reason:Y})=>{if(!(Y instanceof DOMException))return Y;let Z=Error(Y.message);return Object.defineProperty(Z,"stack",{value:Y.stack,enumerable:!1,configurable:!0,writable:!0}),Z};var l5=F(()=>{f5();hZ();CZ()});import{setTimeout as JM}from"node:timers/promises";var JH=({timeout:Y})=>{if(Y!==void 0&&(!Number.isFinite(Y)||Y<0))throw TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${Y}\` (${typeof Y})`)},XH=(Y,Z,Q,J)=>Z===0||Z===void 0?[]:[XM(Y,Z,Q,J)],XM=async(Y,Z,Q,{signal:J})=>{throw await JM(Z,void 0,{signal:J}),Q.terminationReason??="timeout",Y.kill(),new VY};var i5=F(()=>{Y6()});import{execPath as zM,execArgv as GM}from"node:process";import zH from"node:path";var GH=({options:Y})=>{if(Y.node===!1)throw TypeError('The "node" option cannot be false with `execaNode()`.');return{options:{...Y,node:!0}}},HH=(Y,Z,{node:Q=!1,nodePath:J=zM,nodeOptions:X=GM.filter((W)=>!W.startsWith("--inspect")),cwd:z,execPath:G,...H})=>{if(G!==void 0)throw TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');let W=T8(J,'The "nodePath" option'),K=zH.resolve(z,W),$={...H,nodePath:K,node:Q,cwd:z};if(!Q)return[Y,Z,$];if(zH.basename(Y,".exe")==="node")throw TypeError('When the "node" option is true, the first argument does not need to be "node".');return[K,[...X,Y,...Z],{ipc:!0,...$,shell:!1}]};var n5=F(()=>{_8()});import{serialize as HM}from"node:v8";var WH=({ipcInput:Y,ipc:Z,serialization:Q})=>{if(Y===void 0)return;if(!Z)throw Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");$M[Q](Y)},WM=(Y)=>{try{HM(Y)}catch(Z){throw Error("The `ipcInput` option is not serializable with a structured clone.",{cause:Z})}},KM=(Y)=>{try{JSON.stringify(Y)}catch(Z){throw Error("The `ipcInput` option is not serializable with JSON.",{cause:Z})}},$M,KH=async(Y,Z)=>{if(Z===void 0)return;await Y.sendMessage(Z)};var a5=F(()=>{$M={advanced:WM,json:KM}});var UH=({encoding:Y})=>{if(o5.has(Y))return;let Z=VM(Y);if(Z!==void 0)throw TypeError(`Invalid option \`encoding: ${iZ(Y)}\`.
|
|
64
|
+
Please rename it to ${iZ(Z)}.`);let Q=[...o5].map((J)=>iZ(J)).join(", ");throw TypeError(`Invalid option \`encoding: ${iZ(Y)}\`.
|
|
65
|
+
Please rename it to one of: ${Q}.`)},UM,u0,o5,VM=(Y)=>{if(Y===null)return"buffer";if(typeof Y!=="string")return;let Z=Y.toLowerCase();if(Z in $H)return $H[Z];if(o5.has(Z))return Z},$H,iZ=(Y)=>typeof Y==="string"?`"${Y}"`:String(Y);var f6=F(()=>{UM=new Set(["utf8","utf16le"]),u0=new Set(["buffer","hex","base64","base64url","latin1","ascii"]),o5=new Set([...UM,...u0]),$H={"utf-8":"utf8","utf-16le":"utf16le","ucs-2":"utf16le",ucs2:"utf16le",binary:"latin1"}});import{statSync as qM}from"node:fs";import BM from"node:path";import FM from"node:process";var VH=(Y=qH())=>{let Z=T8(Y,'The "cwd" option');return BM.resolve(Z)},qH=()=>{try{return FM.cwd()}catch(Y){throw Y.message=`The current directory does not exist.
|
|
66
|
+
${Y.message}`,Y}},BH=(Y,Z)=>{if(Z===qH())return Y;let Q;try{Q=qM(Z)}catch(J){return`The "cwd" option is invalid: ${Z}.
|
|
67
|
+
${J.message}
|
|
75
68
|
${Y}`}if(!Q.isDirectory())return`The "cwd" option is not a directory: ${Z}.
|
|
76
|
-
${Y}`;return Y};var
|
|
77
|
-
`,
|
|
78
|
-
${
|
|
79
|
-
`)].map((
|
|
80
|
-
|
|
81
|
-
`);return{originalMessage:
|
|
82
|
-
`):hX(Y),hX=(Y)=>{if(typeof Y==="string")return Y;if(G0(Y))return c8(Y);return""};var j4=({command:Y,escapedCommand:Z,stdio:Q,all:X,ipcOutput:J,options:{cwd:$},startTime:G})=>gX({command:Y,escapedCommand:Z,cwd:$,durationMs:W7(G),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:Q[1],stderr:Q[2],all:X,stdio:Q,ipcOutput:J,pipedFrom:[]}),k6=({error:Y,command:Z,escapedCommand:Q,fileDescriptors:X,options:J,startTime:$,isSync:G})=>N1({error:Y,command:Z,escapedCommand:Q,startTime:$,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:X.length}),ipcOutput:[],options:J,isSync:G}),N1=({error:Y,command:Z,escapedCommand:Q,startTime:X,timedOut:J,isCanceled:$,isGracefullyCanceled:G,isMaxBuffer:K,isForcefullyTerminated:H,exitCode:W,signal:z,stdio:q,all:V,ipcOutput:R,options:{timeoutDuration:B,timeout:M=B,forceKillAfterDelay:T,killSignal:D,cwd:_,maxBuffer:w},isSync:N})=>{let{exitCode:j,signal:x,signalDescription:f}=PU(W,z),{originalMessage:m,shortMessage:b,message:v}=bX({stdio:q,all:V,ipcOutput:R,originalError:Y,signal:x,signalDescription:f,exitCode:j,escapedCommand:Q,timedOut:J,isCanceled:$,isGracefullyCanceled:G,isMaxBuffer:K,isForcefullyTerminated:H,forceKillAfterDelay:T,killSignal:D,maxBuffer:w,timeout:M,cwd:_}),d=UQ(Y,v,N);return Object.assign(d,OU({error:d,command:Z,escapedCommand:Q,startTime:X,timedOut:J,isCanceled:$,isGracefullyCanceled:G,isMaxBuffer:K,isForcefullyTerminated:H,exitCode:j,signal:x,signalDescription:f,stdio:q,all:V,ipcOutput:R,cwd:_,originalMessage:m,shortMessage:b})),d},OU=({error:Y,command:Z,escapedCommand:Q,startTime:X,timedOut:J,isCanceled:$,isGracefullyCanceled:G,isMaxBuffer:K,isForcefullyTerminated:H,exitCode:W,signal:z,signalDescription:q,stdio:V,all:R,ipcOutput:B,cwd:M,originalMessage:T,shortMessage:D})=>gX({shortMessage:D,originalMessage:T,command:Z,escapedCommand:Q,cwd:M,durationMs:W7(X),failed:!0,timedOut:J,isCanceled:$,isGracefullyCanceled:G,isTerminated:z!==void 0,isMaxBuffer:K,isForcefullyTerminated:H,exitCode:W,signal:z,signalDescription:q,code:Y.cause?.code,stdout:V[1],stderr:V[2],all:R,stdio:V,ipcOutput:B,pipedFrom:[]}),gX=(Y)=>Object.fromEntries(Object.entries(Y).filter(([,Z])=>Z!==void 0)),PU=(Y,Z)=>{let Q=Y===null?void 0:Y,X=Z===null?void 0:Z,J=X===void 0?void 0:G4(Z);return{exitCode:Q,signal:X,signalDescription:J}};var mX=(Y)=>Number.isFinite(Y)?Y:0;function EU(Y){return{days:Math.trunc(Y/86400000),hours:Math.trunc(Y/3600000%24),minutes:Math.trunc(Y/60000%60),seconds:Math.trunc(Y/1000%60),milliseconds:Math.trunc(Y%1000),microseconds:Math.trunc(mX(Y*1000)%1000),nanoseconds:Math.trunc(mX(Y*1e6)%1000)}}function CU(Y){return{days:Y/86400000n,hours:Y/3600000n%24n,minutes:Y/60000n%60n,seconds:Y/1000n%60n,milliseconds:Y%1000n,microseconds:0n,nanoseconds:0n}}function f7(Y){switch(typeof Y){case"number":{if(Number.isFinite(Y))return EU(Y);break}case"bigint":return CU(Y)}throw TypeError("Expected a finite number or bigint")}var kU=(Y)=>Y===0||Y===0n,AU=(Y,Z)=>Z===1||Z===1n?Y:`${Y}s`,IU=0.0000001,jU=24n*60n*60n*1000n;function h7(Y,Z){let Q=typeof Y==="bigint";if(!Q&&!Number.isFinite(Y))throw TypeError("Expected a finite number or bigint");Z={...Z};let X=Y<0?"-":"";if(Y=Y<0?-Y:Y,Z.colonNotation)Z.compact=!1,Z.formatSubMilliseconds=!1,Z.separateMilliseconds=!1,Z.verbose=!1;if(Z.compact)Z.unitCount=1,Z.secondsDecimalDigits=0,Z.millisecondsDecimalDigits=0;let J=[],$=(z,q)=>{let V=Math.floor(z*10**q+IU);return(Math.round(V)/10**q).toFixed(q)},G=(z,q,V,R)=>{if((J.length===0||!Z.colonNotation)&&kU(z)&&!(Z.colonNotation&&V==="m"))return;if(R??=String(z),Z.colonNotation){let B=R.includes(".")?R.split(".")[0].length:R.length,M=J.length>0?2:1;R="0".repeat(Math.max(0,M-B))+R}else R+=Z.verbose?" "+AU(q,z):V;J.push(R)},K=f7(Y),H=BigInt(K.days);if(Z.hideYearAndDays)G(BigInt(H)*24n+BigInt(K.hours),"hour","h");else{if(Z.hideYear)G(H,"day","d");else G(H/365n,"year","y"),G(H%365n,"day","d");G(Number(K.hours),"hour","h")}if(G(Number(K.minutes),"minute","m"),!Z.hideSeconds)if(Z.separateMilliseconds||Z.formatSubMilliseconds||!Z.colonNotation&&Y<1000&&!Z.subSecondsAsDecimals){let z=Number(K.seconds),q=Number(K.milliseconds),V=Number(K.microseconds),R=Number(K.nanoseconds);if(G(z,"second","s"),Z.formatSubMilliseconds)G(q,"millisecond","ms"),G(V,"microsecond","µs"),G(R,"nanosecond","ns");else{let B=q+V/1000+R/1e6,M=typeof Z.millisecondsDecimalDigits==="number"?Z.millisecondsDecimalDigits:0,T=B>=1?Math.round(B):Math.ceil(B),D=M?B.toFixed(M):T;G(Number.parseFloat(D),"millisecond","ms",D)}}else{let z=(Q?Number(Y%jU):Y)/1000%60,q=typeof Z.secondsDecimalDigits==="number"?Z.secondsDecimalDigits:1,V=$(z,q),R=Z.keepDecimalsOnWholeSeconds?V:V.replace(/\.0+$/,"");G(Number.parseFloat(R),"second","s",R)}if(J.length===0)return X+"0"+(Z.verbose?" milliseconds":"ms");let W=Z.colonNotation?":":" ";if(typeof Z.unitCount==="number")J=J.slice(0,Math.max(Z.unitCount,1));return X+J.join(W)}var uX=(Y,Z)=>{if(Y.failed)g0({type:"error",verboseMessage:Y.shortMessage,verboseInfo:Z,result:Y})};var dX=(Y,Z)=>{if(!L6(Z))return;uX(Y,Z),xU(Y,Z)},xU=(Y,Z)=>{let Q=`(done in ${h7(Y.durationMs)})`;g0({type:"duration",verboseMessage:Q,verboseInfo:Z,result:Y})};var A6=(Y,Z,{reject:Q})=>{if(dX(Y,Z),Y.failed&&Q)throw Y;return Y};import{readFileSync as FJ}from"node:fs";var lX=(Y,Z)=>{if(uY(Y))return"asyncGenerator";if(aX(Y))return"generator";if(x4(Y))return"fileUrl";if(hU(Y))return"filePath";if(mU(Y))return"webStream";if(f0(Y,{checkOpen:!1}))return"native";if(G0(Y))return"uint8Array";if(uU(Y))return"asyncIterable";if(dU(Y))return"iterable";if(m7(Y))return iX({transform:Y},Z);if(fU(Y))return SU(Y,Z);return"native"},SU=(Y,Z)=>{if(S7(Y.transform,{checkOpen:!1}))return yU(Y,Z);if(m7(Y.transform))return iX(Y,Z);return vU(Y,Z)},yU=(Y,Z)=>{return nX(Y,Z,"Duplex stream"),"duplex"},iX=(Y,Z)=>{return nX(Y,Z,"web TransformStream"),"webTransform"},nX=({final:Y,binary:Z,objectMode:Q},X,J)=>{pX(Y,`${X}.final`,J),pX(Z,`${X}.binary`,J),b7(Q,`${X}.objectMode`)},pX=(Y,Z,Q)=>{if(Y!==void 0)throw TypeError(`The \`${Z}\` option can only be defined when using a generator, not a ${Q}.`)},vU=({transform:Y,final:Z,binary:Q,objectMode:X},J)=>{if(Y!==void 0&&!cX(Y))throw TypeError(`The \`${J}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(S7(Z,{checkOpen:!1}))throw TypeError(`The \`${J}.final\` option must not be a Duplex stream.`);if(m7(Z))throw TypeError(`The \`${J}.final\` option must not be a web TransformStream.`);if(Z!==void 0&&!cX(Z))throw TypeError(`The \`${J}.final\` option must be a generator.`);return b7(Q,`${J}.binary`),b7(X,`${J}.objectMode`),uY(Y)||uY(Z)?"asyncGenerator":"generator"},b7=(Y,Z)=>{if(Y!==void 0&&typeof Y!=="boolean")throw TypeError(`The \`${Z}\` option must use a boolean.`)},cX=(Y)=>uY(Y)||aX(Y),uY=(Y)=>Object.prototype.toString.call(Y)==="[object AsyncGeneratorFunction]",aX=(Y)=>Object.prototype.toString.call(Y)==="[object GeneratorFunction]",fU=(Y)=>e(Y)&&(Y.transform!==void 0||Y.final!==void 0),x4=(Y)=>Object.prototype.toString.call(Y)==="[object URL]",oX=(Y)=>x4(Y)&&Y.protocol!=="file:",hU=(Y)=>e(Y)&&Object.keys(Y).length>0&&Object.keys(Y).every((Z)=>bU.has(Z))&&g7(Y.file),bU=new Set(["file","append"]),g7=(Y)=>typeof Y==="string",sX=(Y,Z)=>Y==="native"&&typeof Z==="string"&&!gU.has(Z),gU=new Set(["ipc","ignore","inherit","overlapped","pipe"]),tX=(Y)=>Object.prototype.toString.call(Y)==="[object ReadableStream]",S4=(Y)=>Object.prototype.toString.call(Y)==="[object WritableStream]",mU=(Y)=>tX(Y)||S4(Y),m7=(Y)=>tX(Y?.readable)&&S4(Y?.writable),uU=(Y)=>rX(Y)&&typeof Y[Symbol.asyncIterator]==="function",dU=(Y)=>rX(Y)&&typeof Y[Symbol.iterator]==="function",rX=(Y)=>typeof Y==="object"&&Y!==null,x0=new Set(["generator","asyncGenerator","duplex","webTransform"]),y4=new Set(["fileUrl","filePath","fileNumber"]),u7=new Set(["fileUrl","filePath"]),eX=new Set([...u7,"webStream","nodeStream"]),YJ=new Set(["webTransform","duplex"]),FY={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"};var d7=(Y,Z,Q,X)=>X==="output"?pU(Y,Z,Q):cU(Y,Z,Q),pU=(Y,Z,Q)=>{let X=Z!==0&&Q[Z-1].value.readableObjectMode;return{writableObjectMode:X,readableObjectMode:Y??X}},cU=(Y,Z,Q)=>{let X=Z===0?Y===!0:Q[Z-1].value.readableObjectMode,J=Z!==Q.length-1&&(Y??X);return{writableObjectMode:X,readableObjectMode:J}},ZJ=(Y,Z)=>{let Q=Y.findLast(({type:X})=>x0.has(X));if(Q===void 0)return!1;return Z==="input"?Q.value.writableObjectMode:Q.value.readableObjectMode};var QJ=(Y,Z,Q,X)=>[...Y.filter(({type:J})=>!x0.has(J)),...lU(Y,Z,Q,X)],lU=(Y,Z,Q,{encoding:X})=>{let J=Y.filter(({type:G})=>x0.has(G)),$=Array.from({length:J.length});for(let[G,K]of Object.entries(J))$[G]=iU({stdioItem:K,index:Number(G),newTransforms:$,optionName:Z,direction:Q,encoding:X});return sU($,Q)},iU=({stdioItem:Y,stdioItem:{type:Z},index:Q,newTransforms:X,optionName:J,direction:$,encoding:G})=>{if(Z==="duplex")return nU({stdioItem:Y,optionName:J});if(Z==="webTransform")return aU({stdioItem:Y,index:Q,newTransforms:X,direction:$});return oU({stdioItem:Y,index:Q,newTransforms:X,direction:$,encoding:G})},nU=({stdioItem:Y,stdioItem:{value:{transform:Z,transform:{writableObjectMode:Q,readableObjectMode:X},objectMode:J=X}},optionName:$})=>{if(J&&!X)throw TypeError(`The \`${$}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!J&&X)throw TypeError(`The \`${$}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...Y,value:{transform:Z,writableObjectMode:Q,readableObjectMode:X}}},aU=({stdioItem:Y,stdioItem:{value:Z},index:Q,newTransforms:X,direction:J})=>{let{transform:$,objectMode:G}=e(Z)?Z:{transform:Z},{writableObjectMode:K,readableObjectMode:H}=d7(G,Q,X,J);return{...Y,value:{transform:$,writableObjectMode:K,readableObjectMode:H}}},oU=({stdioItem:Y,stdioItem:{value:Z},index:Q,newTransforms:X,direction:J,encoding:$})=>{let{transform:G,final:K,binary:H=!1,preserveNewlines:W=!1,objectMode:z}=e(Z)?Z:{transform:Z},q=H||O0.has($),{writableObjectMode:V,readableObjectMode:R}=d7(z,Q,X,J);return{...Y,value:{transform:G,final:K,binary:q,preserveNewlines:W,writableObjectMode:V,readableObjectMode:R}}},sU=(Y,Z)=>Z==="input"?Y.reverse():Y;import p7 from"node:process";var XJ=(Y,Z,Q)=>{let X=Y.map((J)=>tU(J,Z));if(X.includes("input")&&X.includes("output"))throw TypeError(`The \`${Q}\` option must not be an array of both readable and writable values.`);return X.find(Boolean)??Yq},tU=({type:Y,value:Z},Q)=>rU[Q]??JJ[Y](Z),rU=["input","output","output"],I6=()=>{return},c7=()=>"input",JJ={generator:I6,asyncGenerator:I6,fileUrl:I6,filePath:I6,iterable:c7,asyncIterable:c7,uint8Array:c7,webStream:(Y)=>S4(Y)?"output":"input",nodeStream(Y){if(!mY(Y,{checkOpen:!1}))return"output";return x7(Y,{checkOpen:!1})?void 0:"input"},webTransform:I6,duplex:I6,native(Y){let Z=eU(Y);if(Z!==void 0)return Z;if(f0(Y,{checkOpen:!1}))return JJ.nodeStream(Y)}},eU=(Y)=>{if([0,p7.stdin].includes(Y))return"input";if([1,2,p7.stdout,p7.stderr].includes(Y))return"output"},Yq="output";var $J=(Y,Z)=>Z&&!Y.includes("ipc")?[...Y,"ipc"]:Y;var GJ=({stdio:Y,ipc:Z,buffer:Q,...X},J,$)=>{let G=Zq(Y,X).map((K,H)=>KJ(K,H));return $?Xq(G,Q,J):$J(G,Z)},Zq=(Y,Z)=>{if(Y===void 0)return j0.map((X)=>Z[X]);if(Qq(Z))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${j0.map((X)=>`\`${X}\``).join(", ")}`);if(typeof Y==="string")return[Y,Y,Y];if(!Array.isArray(Y))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof Y}\``);let Q=Math.max(Y.length,j0.length);return Array.from({length:Q},(X,J)=>Y[J])},Qq=(Y)=>j0.some((Z)=>Y[Z]!==void 0),KJ=(Y,Z)=>{if(Array.isArray(Y))return Y.map((Q)=>KJ(Q,Z));if(Y===null||Y===void 0)return Z>=j0.length?"ignore":"pipe";return Y},Xq=(Y,Z,Q)=>Y.map((X,J)=>!Z[J]&&J!==0&&!T6(Q,J)&&Jq(X)?"ignore":X),Jq=(Y)=>Y==="pipe"||Array.isArray(Y)&&Y.every((Z)=>Z==="pipe");import{readFileSync as $q}from"node:fs";import Gq from"node:tty";var zJ=({stdioItem:Y,stdioItem:{type:Z},isStdioArray:Q,fdNumber:X,direction:J,isSync:$})=>{if(!Q||Z!=="native")return Y;return $?Kq({stdioItem:Y,fdNumber:X,direction:J}):Wq({stdioItem:Y,fdNumber:X})},Kq=({stdioItem:Y,stdioItem:{value:Z,optionName:Q},fdNumber:X,direction:J})=>{let $=Hq({value:Z,optionName:Q,fdNumber:X,direction:J});if($!==void 0)return $;if(f0(Z,{checkOpen:!1}))throw TypeError(`The \`${Q}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return Y},Hq=({value:Y,optionName:Z,fdNumber:Q,direction:X})=>{let J=zq(Y,Q);if(J===void 0)return;if(X==="output")return{type:"fileNumber",value:J,optionName:Z};if(Gq.isatty(J))throw TypeError(`The \`${Z}: ${z4(Y)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:r0($q(J)),optionName:Z}},zq=(Y,Z)=>{if(Y==="inherit")return Z;if(typeof Y==="number")return Y;let Q=l8.indexOf(Y);if(Q!==-1)return Q},Wq=({stdioItem:Y,stdioItem:{value:Z,optionName:Q},fdNumber:X})=>{if(Z==="inherit")return{type:"nodeStream",value:HJ(X,Z,Q),optionName:Q};if(typeof Z==="number")return{type:"nodeStream",value:HJ(Z,Z,Q),optionName:Q};if(f0(Z,{checkOpen:!1}))return{type:"nodeStream",value:Z,optionName:Q};return Y},HJ=(Y,Z,Q)=>{let X=l8[Y];if(X===void 0)throw TypeError(`The \`${Q}: ${Z}\` option is invalid: no such standard stream.`);return X};var WJ=({input:Y,inputFile:Z},Q)=>Q===0?[...Uq(Y),...Vq(Z)]:[],Uq=(Y)=>Y===void 0?[]:[{type:qq(Y),value:Y,optionName:"input"}],qq=(Y)=>{if(mY(Y,{checkOpen:!1}))return"nodeStream";if(typeof Y==="string")return"string";if(G0(Y))return"uint8Array";throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},Vq=(Y)=>Y===void 0?[]:[{...Bq(Y),optionName:"inputFile"}],Bq=(Y)=>{if(x4(Y))return{type:"fileUrl",value:Y};if(g7(Y))return{type:"filePath",value:{file:Y}};throw Error("The `inputFile` option must be a file path string or a file URL.")};var UJ=(Y)=>Y.filter((Z,Q)=>Y.every((X,J)=>Z.value!==X.value||Q>=J||Z.type==="generator"||Z.type==="asyncGenerator")),qJ=({stdioItem:{type:Y,value:Z,optionName:Q},direction:X,fileDescriptors:J,isSync:$})=>{let G=Fq(J,Y);if(G.length===0)return;if($){Rq({otherStdioItems:G,type:Y,value:Z,optionName:Q,direction:X});return}if(eX.has(Y))return VJ({otherStdioItems:G,type:Y,value:Z,optionName:Q,direction:X});if(YJ.has(Y))Dq({otherStdioItems:G,type:Y,value:Z,optionName:Q})},Fq=(Y,Z)=>Y.flatMap(({direction:Q,stdioItems:X})=>X.filter((J)=>J.type===Z).map((J)=>({...J,direction:Q}))),Rq=({otherStdioItems:Y,type:Z,value:Q,optionName:X,direction:J})=>{if(u7.has(Z))VJ({otherStdioItems:Y,type:Z,value:Q,optionName:X,direction:J})},VJ=({otherStdioItems:Y,type:Z,value:Q,optionName:X,direction:J})=>{let $=Y.filter((K)=>Mq(K,Q));if($.length===0)return;let G=$.find((K)=>K.direction!==J);return BJ(G,X,Z),J==="output"?$[0].stream:void 0},Mq=({type:Y,value:Z},Q)=>{if(Y==="filePath")return Z.file===Q.file;if(Y==="fileUrl")return Z.href===Q.href;return Z===Q},Dq=({otherStdioItems:Y,type:Z,value:Q,optionName:X})=>{let J=Y.find(({value:{transform:$}})=>$===Q.transform);BJ(J,X,Z)},BJ=(Y,Z,Q)=>{if(Y!==void 0)throw TypeError(`The \`${Y.optionName}\` and \`${Z}\` options must not target ${FY[Q]} that is the same.`)};var v4=(Y,Z,Q,X)=>{let $=GJ(Z,Q,X).map((K,H)=>Lq({stdioOption:K,fdNumber:H,options:Z,isSync:X})),G=Cq({initialFileDescriptors:$,addProperties:Y,options:Z,isSync:X});return Z.stdio=G.map(({stdioItems:K})=>Iq(K)),G},Lq=({stdioOption:Y,fdNumber:Z,options:Q,isSync:X})=>{let J=i8(Z),{stdioItems:$,isStdioArray:G}=Tq({stdioOption:Y,fdNumber:Z,options:Q,optionName:J}),K=XJ($,Z,J),H=$.map((q)=>zJ({stdioItem:q,isStdioArray:G,fdNumber:Z,direction:K,isSync:X})),W=QJ(H,J,K,Q),z=ZJ(W,K);return Eq(W,z),{direction:K,objectMode:z,stdioItems:W}},Tq=({stdioOption:Y,fdNumber:Z,options:Q,optionName:X})=>{let $=[...(Array.isArray(Y)?Y:[Y]).map((H)=>_q(H,X)),...WJ(Q,Z)],G=UJ($),K=G.length>1;return wq(G,K,X),Oq(G),{stdioItems:G,isStdioArray:K}},_q=(Y,Z)=>({type:lX(Y,Z),value:Y,optionName:Z}),wq=(Y,Z,Q)=>{if(Y.length===0)throw TypeError(`The \`${Q}\` option must not be an empty array.`);if(!Z)return;for(let{value:X,optionName:J}of Y)if(Nq.has(X))throw Error(`The \`${J}\` option must not include \`${X}\`.`)},Nq=new Set(["ignore","ipc"]),Oq=(Y)=>{for(let Z of Y)Pq(Z)},Pq=({type:Y,value:Z,optionName:Q})=>{if(oX(Z))throw TypeError(`The \`${Q}: URL\` option must use the \`file:\` scheme.
|
|
83
|
-
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(
|
|
84
|
-
`){let G=
|
|
69
|
+
${Y}`;return Y};var s5=F(()=>{_8()});import RM from"node:path";import FH from"node:process";var RH,nZ=(Y,Z,Q)=>{Q.cwd=VH(Q.cwd);let[J,X,z]=HH(Y,Z,Q),{command:G,args:H,options:W}=RH.default._parse(J,X,z),K=pX(W),$=MM(K);if(JH($),UH($),WH($),wG($),ZH($),$.shell=U5($.shell),$.env=DM($),$.killSignal=DG($.killSignal),$.forceKillAfterDelay=_G($.forceKillAfterDelay),$.lines=$.lines.map((V,q)=>V&&!u0.has($.encoding)&&$.buffer[q]),FH.platform==="win32"&&RM.basename(G,".exe")==="cmd")H.unshift("/q");return{file:G,commandArguments:H,options:$}},MM=({extendEnv:Y=!0,preferLocal:Z=!1,cwd:Q,localDir:J=Q,encoding:X="utf8",reject:z=!0,cleanup:G=!0,all:H=!1,windowsHide:W=!0,killSignal:K="SIGTERM",forceKillAfterDelay:$=!0,gracefulCancel:V=!1,ipcInput:q,ipc:M=q!==void 0||V,serialization:B="advanced",...D})=>({...D,extendEnv:Y,preferLocal:Z,cwd:Q,localDirectory:J,encoding:X,reject:z,cleanup:G,all:H,windowsHide:W,killSignal:K,forceKillAfterDelay:$,gracefulCancel:V,ipcInput:q,ipc:M,serialization:B}),DM=({env:Y,extendEnv:Z,preferLocal:Q,node:J,localDirectory:X,nodePath:z})=>{let G=Z?{...FH.env,...Y}:Y;if(Q||J)return XG({env:G,cwd:X,execPath:z,preferLocal:Q,addExecPath:J});return G};var r5=F(()=>{zG();CZ();N1();b5();l5();i5();n5();a5();f6();s5();_8();SY();RH=s2(YG(),1)});var aZ=(Y,Z,Q)=>Q.shell&&Z.length>0?[[Y,...Z].join(" "),[],Q]:[Y,Z,Q];function P8(Y){if(typeof Y==="string")return LM(Y);if(!(ArrayBuffer.isView(Y)&&Y.BYTES_PER_ELEMENT===1))throw Error("Input must be a string or a Uint8Array");return TM(Y)}var LM=(Y)=>Y.at(-1)===MH?Y.slice(0,Y.at(-2)===DH?-2:-1):Y,TM=(Y)=>Y.at(-1)===_M?Y.subarray(0,Y.at(-2)===NM?-2:-1):Y,MH=`
|
|
70
|
+
`,_M,DH="\r",NM;var t5=F(()=>{_M=MH.codePointAt(0),NM=DH.codePointAt(0)});function JY(Y,{checkOpen:Z=!0}={}){return Y!==null&&typeof Y==="object"&&(Y.writable||Y.readable||!Z||Y.writable===void 0&&Y.readable===void 0)&&typeof Y.pipe==="function"}function e5(Y,{checkOpen:Z=!0}={}){return JY(Y,{checkOpen:Z})&&(Y.writable||!Z)&&typeof Y.write==="function"&&typeof Y.end==="function"&&typeof Y.writable==="boolean"&&typeof Y.writableObjectMode==="boolean"&&typeof Y.destroy==="function"&&typeof Y.destroyed==="boolean"}function b6(Y,{checkOpen:Z=!0}={}){return JY(Y,{checkOpen:Z})&&(Y.readable||!Z)&&typeof Y.read==="function"&&typeof Y.readable==="boolean"&&typeof Y.readableObjectMode==="boolean"&&typeof Y.destroy==="function"&&typeof Y.destroyed==="boolean"}function Y3(Y,Z){return e5(Y,Z)&&b6(Y,Z)}class LH{#Z;#Q;#Y=!1;#J=void 0;constructor(Y,Z){this.#Z=Y,this.#Q=Z}next(){let Y=()=>this.#X();return this.#J=this.#J?this.#J.then(Y,Y):Y(),this.#J}return(Y){let Z=()=>this.#z(Y);return this.#J?this.#J.then(Z,Z):Z()}async#X(){if(this.#Y)return{done:!0,value:void 0};let Y;try{Y=await this.#Z.read()}catch(Z){throw this.#J=void 0,this.#Y=!0,this.#Z.releaseLock(),Z}return Y.done&&(this.#J=void 0,this.#Y=!0,this.#Z.releaseLock()),Y}async#z(Y){if(this.#Y)return{done:!0,value:Y};if(this.#Y=!0,!this.#Q){let Z=this.#Z.cancel(Y);return this.#Z.releaseLock(),await Z,{done:!0,value:Y}}return this.#Z.releaseLock(),{done:!0,value:Y}}}function TH(){return this[Z3].next()}function _H(Y){return this[Z3].return(Y)}function Q3({preventCancel:Y=!1}={}){let Z=this.getReader(),Q=new LH(Z,Y),J=Object.create(OM);return J[Z3]=Q,J}var wM,Z3,OM;var NH=F(()=>{wM=Object.getPrototypeOf(Object.getPrototypeOf(async function*(){}).prototype);Z3=Symbol();Object.defineProperty(TH,"name",{value:"next"});Object.defineProperty(_H,"name",{value:"return"});OM=Object.create(wM,{next:{enumerable:!0,configurable:!0,writable:!0,value:TH},return:{enumerable:!0,configurable:!0,writable:!0,value:_H}})});var wH=()=>{};var OH=F(()=>{NH();wH()});var IH=(Y)=>{if(b6(Y,{checkOpen:!1})&&E1.on!==void 0)return EM(Y);if(typeof Y?.[Symbol.asyncIterator]==="function")return Y;if(IM.call(Y)==="[object ReadableStream]")return Q3.call(Y);throw TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.")},IM,EM=async function*(Y){let Z=new AbortController,Q={};CM(Y,Z,Q);try{for await(let[J]of E1.on(Y,"data",{signal:Z.signal}))yield J}catch(J){if(Q.error!==void 0)throw Q.error;else if(!Z.signal.aborted)throw J}finally{Y.destroy()}},CM=async(Y,Z,Q)=>{try{await E1.finished(Y,{cleanup:!0,readable:!0,writable:!1,error:!1})}catch(J){Q.error=J}finally{Z.abort()}},E1;var J3=F(()=>{OH();({toString:IM}=Object.prototype),E1={}});var x8=async(Y,{init:Z,convertChunk:Q,getSize:J,truncateChunk:X,addChunk:z,getFinalChunk:G,finalize:H},{maxBuffer:W=Number.POSITIVE_INFINITY}={})=>{let K=IH(Y),$=Z();$.length=0;try{for await(let V of K){let q=kM(V),M=Q[q](V,$);jH({convertedChunk:M,state:$,getSize:J,truncateChunk:X,addChunk:z,maxBuffer:W})}return jM({state:$,convertChunk:Q,getSize:J,truncateChunk:X,addChunk:z,getFinalChunk:G,maxBuffer:W}),H($)}catch(V){let q=typeof V==="object"&&V!==null?V:Error(V);throw q.bufferedData=H($),q}},jM=({state:Y,getSize:Z,truncateChunk:Q,addChunk:J,getFinalChunk:X,maxBuffer:z})=>{let G=X(Y);if(G!==void 0)jH({convertedChunk:G,state:Y,getSize:Z,truncateChunk:Q,addChunk:J,maxBuffer:z})},jH=({convertedChunk:Y,state:Z,getSize:Q,truncateChunk:J,addChunk:X,maxBuffer:z})=>{let G=Q(Y),H=Z.length+G;if(H<=z){EH(Y,Z,X,H);return}let W=J(Y,z-Z.length);if(W!==void 0)EH(W,Z,X,z);throw new vY},EH=(Y,Z,Q,J)=>{Z.contents=Q(Y,Z,J),Z.length=J},kM=(Y)=>{let Z=typeof Y;if(Z==="string")return"string";if(Z!=="object"||Y===null)return"others";if(globalThis.Buffer?.isBuffer(Y))return"buffer";let Q=CH.call(Y);if(Q==="[object ArrayBuffer]")return"arrayBuffer";if(Q==="[object DataView]")return"dataView";if(Number.isInteger(Y.byteLength)&&Number.isInteger(Y.byteOffset)&&CH.call(Y.buffer)==="[object ArrayBuffer]")return"typedArray";return"others"},CH,vY;var C1=F(()=>{J3();({toString:CH}=Object.prototype);vY=class vY extends Error{name="MaxBufferError";constructor(){super("maxBuffer exceeded")}}});var yY=(Y)=>Y,j1=()=>{return},oZ=({contents:Y})=>Y,sZ=(Y)=>{throw Error(`Streams in object mode are not supported: ${String(Y)}`)},rZ=(Y)=>Y.length;async function tZ(Y,Z){return x8(Y,SM,Z)}var AM=()=>({contents:[]}),PM=()=>1,xM=(Y,{contents:Z})=>{return Z.push(Y),Z},SM;var kH=F(()=>{C1();SM={init:AM,convertChunk:{string:yY,buffer:yY,arrayBuffer:yY,dataView:yY,typedArray:yY,others:yY},getSize:PM,truncateChunk:j1,addChunk:xM,getFinalChunk:j1,finalize:oZ}});async function eZ(Y,Z){return x8(Y,dM,Z)}var vM=()=>({contents:new ArrayBuffer(0)}),yM=(Y)=>fM.encode(Y),fM,AH=(Y)=>new Uint8Array(Y),PH=(Y)=>new Uint8Array(Y.buffer,Y.byteOffset,Y.byteLength),bM=(Y,Z)=>Y.slice(0,Z),hM=(Y,{contents:Z,length:Q},J)=>{let X=vH()?mM(Z,J):gM(Z,J);return new Uint8Array(X).set(Y,Q),X},gM=(Y,Z)=>{if(Z<=Y.byteLength)return Y;let Q=new ArrayBuffer(SH(Z));return new Uint8Array(Q).set(new Uint8Array(Y),0),Q},mM=(Y,Z)=>{if(Z<=Y.maxByteLength)return Y.resize(Z),Y;let Q=new ArrayBuffer(Z,{maxByteLength:SH(Z)});return new Uint8Array(Q).set(new Uint8Array(Y),0),Q},SH=(Y)=>xH**Math.ceil(Math.log(Y)/Math.log(xH)),xH=2,uM=({contents:Y,length:Z})=>vH()?Y:Y.slice(0,Z),vH=()=>("resize"in ArrayBuffer.prototype),dM;var yH=F(()=>{C1();fM=new TextEncoder,dM={init:vM,convertChunk:{string:yM,buffer:AH,arrayBuffer:AH,dataView:PH,typedArray:PH,others:sZ},getSize:rZ,truncateChunk:bM,addChunk:hM,getFinalChunk:j1,finalize:uM}});async function Z7(Y,Z){return x8(Y,nM,Z)}var pM=()=>({contents:"",textDecoder:new TextDecoder}),Y7=(Y,{textDecoder:Z})=>Z.decode(Y,{stream:!0}),cM=(Y,{contents:Z})=>Z+Y,lM=(Y,Z)=>Y.slice(0,Z),iM=({textDecoder:Y})=>{let Z=Y.decode();return Z===""?void 0:Z},nM;var fH=F(()=>{C1();nM={init:pM,convertChunk:{string:yY,buffer:Y7,arrayBuffer:Y7,dataView:Y7,typedArray:Y7,others:sZ},getSize:rZ,truncateChunk:lM,addChunk:cM,getFinalChunk:iM,finalize:oZ}});var bH=F(()=>{kH();yH();fH();C1()});import{on as aM}from"node:events";import{finished as oM}from"node:stream/promises";var Q7=F(()=>{J3();bH();Object.assign(E1,{on:aM,finished:oM})});var hH=({error:Y,stream:Z,readableObjectMode:Q,lines:J,encoding:X,fdNumber:z})=>{if(!(Y instanceof vY))throw Y;if(z==="all")return Y;let G=sM(Q,J,X);throw Y.maxBufferInfo={fdNumber:z,unit:G},Z.destroy(),Y},sM=(Y,Z,Q)=>{if(Y)return"objects";if(Z)return"lines";if(Q==="buffer")return"bytes";return"characters"},gH=(Y,Z,Q)=>{if(Z.length!==Q)return;let J=new vY;throw J.maxBufferInfo={fdNumber:"ipc"},J},mH=(Y,Z)=>{let{streamName:Q,threshold:J,unit:X}=rM(Y,Z);return`Command's ${Q} was larger than ${J} ${X}`},rM=(Y,Z)=>{if(Y?.maxBufferInfo===void 0)return{streamName:"output",threshold:Z[1],unit:"bytes"};let{maxBufferInfo:{fdNumber:Q,unit:J}}=Y;delete Y.maxBufferInfo;let X=xY(Z,Q);if(Q==="ipc")return{streamName:"IPC output",threshold:X,unit:"messages"};return{streamName:$Z(Q),threshold:X,unit:J}},uH=(Y,Z,Q)=>Y?.code==="ENOBUFS"&&Z!==null&&Z.some((J)=>J!==null&&J.length>J7(Q)),dH=(Y,Z,Q)=>{if(!Z)return Y;let J=J7(Q);return Y.length>J?Y.slice(0,J):Y},J7=([,Y])=>Y;var h6=F(()=>{Q7();PY();SY()});import{inspect as tM}from"node:util";var cH=({stdio:Y,all:Z,ipcOutput:Q,originalError:J,signal:X,signalDescription:z,exitCode:G,escapedCommand:H,timedOut:W,isCanceled:K,isGracefullyCanceled:$,isMaxBuffer:V,isForcefullyTerminated:q,forceKillAfterDelay:M,killSignal:B,maxBuffer:D,timeout:T,cwd:_})=>{let w=J?.code,I=eM({originalError:J,timedOut:W,timeout:T,isMaxBuffer:V,maxBuffer:D,errorCode:w,signal:X,signalDescription:z,exitCode:G,isCanceled:K,isGracefullyCanceled:$,isForcefullyTerminated:q,forceKillAfterDelay:M,killSignal:B}),E=ZD(J,_),v=E===void 0?"":`
|
|
71
|
+
${E}`,S=`${I}: ${H}${v}`,g=Z===void 0?[Y[2],Y[1]]:[Z],d=[S,...g,...Y.slice(3),Q.map((m)=>QD(m)).join(`
|
|
72
|
+
`)].map((m)=>L1(P8(JD(m)))).filter(Boolean).join(`
|
|
73
|
+
|
|
74
|
+
`);return{originalMessage:E,shortMessage:S,message:d}},eM=({originalError:Y,timedOut:Z,timeout:Q,isMaxBuffer:J,maxBuffer:X,errorCode:z,signal:G,signalDescription:H,exitCode:W,isCanceled:K,isGracefullyCanceled:$,isForcefullyTerminated:V,forceKillAfterDelay:q,killSignal:M})=>{let B=YD(V,q);if(Z)return`Command timed out after ${Q} milliseconds${B}`;if($){if(G===void 0)return`Command was gracefully canceled with exit code ${W}`;return V?`Command was gracefully canceled${B}`:`Command was gracefully canceled with ${G} (${H})`}if(K)return`Command was canceled${B}`;if(J)return`${mH(Y,X)}${B}`;if(z!==void 0)return`Command failed with ${z}${B}`;if(V)return`Command was killed with ${M} (${EZ(M)})${B}`;if(G!==void 0)return`Command was killed with ${G} (${H})`;if(W!==void 0)return`Command failed with exit code ${W}`;return"Command failed"},YD=(Y,Z)=>Y?` and was forcefully terminated after ${Z} milliseconds`:"",ZD=(Y,Z)=>{if(Y instanceof VY)return;let Q=WG(Y)?Y.originalMessage:String(Y?.message??Y),J=L1(BH(Q,Z));return J===""?void 0:J},QD=(Y)=>typeof Y==="string"?Y:tM(Y),JD=(Y)=>Array.isArray(Y)?Y.map((Z)=>P8(pH(Z))).filter(Boolean).join(`
|
|
75
|
+
`):pH(Y),pH=(Y)=>{if(typeof Y==="string")return Y;if(L0(Y))return WZ(Y);return""};var lH=F(()=>{t5();m0();s5();qZ();h6();N1();Y6()});var X7=({command:Y,escapedCommand:Z,stdio:Q,all:J,ipcOutput:X,options:{cwd:z},startTime:G})=>iH({command:Y,escapedCommand:Z,cwd:z,durationMs:_5(G),failed:!1,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isTerminated:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,exitCode:0,stdout:Q[1],stderr:Q[2],all:J,stdio:Q,ipcOutput:X,pipedFrom:[]}),S8=({error:Y,command:Z,escapedCommand:Q,fileDescriptors:J,options:X,startTime:z,isSync:G})=>k1({error:Y,command:Z,escapedCommand:Q,startTime:z,timedOut:!1,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:!1,isForcefullyTerminated:!1,stdio:Array.from({length:J.length}),ipcOutput:[],options:X,isSync:G}),k1=({error:Y,command:Z,escapedCommand:Q,startTime:J,timedOut:X,isCanceled:z,isGracefullyCanceled:G,isMaxBuffer:H,isForcefullyTerminated:W,exitCode:K,signal:$,stdio:V,all:q,ipcOutput:M,options:{timeoutDuration:B,timeout:D=B,forceKillAfterDelay:T,killSignal:_,cwd:w,maxBuffer:I},isSync:E})=>{let{exitCode:v,signal:S,signalDescription:g}=zD(K,$),{originalMessage:d,shortMessage:m,message:b}=cH({stdio:V,all:q,ipcOutput:M,originalError:Y,signal:S,signalDescription:g,exitCode:v,escapedCommand:Q,timedOut:X,isCanceled:z,isGracefullyCanceled:G,isMaxBuffer:H,isForcefullyTerminated:W,forceKillAfterDelay:T,killSignal:_,maxBuffer:I,timeout:D,cwd:w}),i=GG(Y,b,E);return Object.assign(i,XD({error:i,command:Z,escapedCommand:Q,startTime:J,timedOut:X,isCanceled:z,isGracefullyCanceled:G,isMaxBuffer:H,isForcefullyTerminated:W,exitCode:v,signal:S,signalDescription:g,stdio:V,all:q,ipcOutput:M,cwd:w,originalMessage:d,shortMessage:m})),i},XD=({error:Y,command:Z,escapedCommand:Q,startTime:J,timedOut:X,isCanceled:z,isGracefullyCanceled:G,isMaxBuffer:H,isForcefullyTerminated:W,exitCode:K,signal:$,signalDescription:V,stdio:q,all:M,ipcOutput:B,cwd:D,originalMessage:T,shortMessage:_})=>iH({shortMessage:_,originalMessage:T,command:Z,escapedCommand:Q,cwd:D,durationMs:_5(J),failed:!0,timedOut:X,isCanceled:z,isGracefullyCanceled:G,isTerminated:$!==void 0,isMaxBuffer:H,isForcefullyTerminated:W,exitCode:K,signal:$,signalDescription:V,code:Y.cause?.code,stdout:q[1],stderr:q[2],all:M,stdio:q,ipcOutput:B,pipedFrom:[]}),iH=(Y)=>Object.fromEntries(Object.entries(Y).filter(([,Z])=>Z!==void 0)),zD=(Y,Z)=>{let Q=Y===null?void 0:Y,J=Z===null?void 0:Z,X=J===void 0?void 0:EZ(Z);return{exitCode:Q,signal:J,signalDescription:X}};var A1=F(()=>{N1();LZ();Y6();lH()});function GD(Y){return{days:Math.trunc(Y/86400000),hours:Math.trunc(Y/3600000%24),minutes:Math.trunc(Y/60000%60),seconds:Math.trunc(Y/1000%60),milliseconds:Math.trunc(Y%1000),microseconds:Math.trunc(nH(Y*1000)%1000),nanoseconds:Math.trunc(nH(Y*1e6)%1000)}}function HD(Y){return{days:Y/86400000n,hours:Y/3600000n%24n,minutes:Y/60000n%60n,seconds:Y/1000n%60n,milliseconds:Y%1000n,microseconds:0n,nanoseconds:0n}}function X3(Y){switch(typeof Y){case"number":{if(Number.isFinite(Y))return GD(Y);break}case"bigint":return HD(Y)}throw TypeError("Expected a finite number or bigint")}var nH=(Y)=>Number.isFinite(Y)?Y:0;function z3(Y,Z){let Q=typeof Y==="bigint";if(!Q&&!Number.isFinite(Y))throw TypeError("Expected a finite number or bigint");Z={...Z};let J=Y<0?"-":"";if(Y=Y<0?-Y:Y,Z.colonNotation)Z.compact=!1,Z.formatSubMilliseconds=!1,Z.separateMilliseconds=!1,Z.verbose=!1;if(Z.compact)Z.unitCount=1,Z.secondsDecimalDigits=0,Z.millisecondsDecimalDigits=0;let X=[],z=($,V)=>{let q=Math.floor($*10**V+$D);return(Math.round(q)/10**V).toFixed(V)},G=($,V,q,M)=>{if((X.length===0||!Z.colonNotation)&&WD($)&&!(Z.colonNotation&&q==="m"))return;if(M??=String($),Z.colonNotation){let B=M.includes(".")?M.split(".")[0].length:M.length,D=X.length>0?2:1;M="0".repeat(Math.max(0,D-B))+M}else M+=Z.verbose?" "+KD(V,$):q;X.push(M)},H=X3(Y),W=BigInt(H.days);if(Z.hideYearAndDays)G(BigInt(W)*24n+BigInt(H.hours),"hour","h");else{if(Z.hideYear)G(W,"day","d");else G(W/365n,"year","y"),G(W%365n,"day","d");G(Number(H.hours),"hour","h")}if(G(Number(H.minutes),"minute","m"),!Z.hideSeconds)if(Z.separateMilliseconds||Z.formatSubMilliseconds||!Z.colonNotation&&Y<1000&&!Z.subSecondsAsDecimals){let $=Number(H.seconds),V=Number(H.milliseconds),q=Number(H.microseconds),M=Number(H.nanoseconds);if(G($,"second","s"),Z.formatSubMilliseconds)G(V,"millisecond","ms"),G(q,"microsecond","µs"),G(M,"nanosecond","ns");else{let B=V+q/1000+M/1e6,D=typeof Z.millisecondsDecimalDigits==="number"?Z.millisecondsDecimalDigits:0,T=B>=1?Math.round(B):Math.ceil(B),_=D?B.toFixed(D):T;G(Number.parseFloat(_),"millisecond","ms",_)}}else{let $=(Q?Number(Y%UD):Y)/1000%60,V=typeof Z.secondsDecimalDigits==="number"?Z.secondsDecimalDigits:1,q=z($,V),M=Z.keepDecimalsOnWholeSeconds?q:q.replace(/\.0+$/,"");G(Number.parseFloat(M),"second","s",M)}if(X.length===0)return J+"0"+(Z.verbose?" milliseconds":"ms");let K=Z.colonNotation?":":" ";if(typeof Z.unitCount==="number")X=X.slice(0,Math.max(Z.unitCount,1));return J+X.join(K)}var WD=(Y)=>Y===0||Y===0n,KD=(Y,Z)=>Z===1||Z===1n?Y:`${Y}s`,$D=0.0000001,UD;var aH=F(()=>{UD=24n*60n*60n*1000n});var oH=(Y,Z)=>{if(Y.failed)$Y({type:"error",verboseMessage:Y.shortMessage,verboseInfo:Z,result:Y})};var sH=F(()=>{O8()});var rH=(Y,Z)=>{if(!N8(Z))return;oH(Y,Z),VD(Y,Z)},VD=(Y,Z)=>{let Q=`(done in ${z3(Y.durationMs)})`;$Y({type:"duration",verboseMessage:Q,verboseInfo:Z,result:Y})};var tH=F(()=>{aH();eY();O8();sH()});var v8=(Y,Z,{reject:Q})=>{if(rH(Y,Z),Y.failed&&Q)throw Y;return Y};var z7=F(()=>{tH()});var ZW=(Y,Z)=>{if(g6(Y))return"asyncGenerator";if(XW(Y))return"generator";if(G7(Y))return"fileUrl";if(MD(Y))return"filePath";if(TD(Y))return"webStream";if(JY(Y,{checkOpen:!1}))return"native";if(L0(Y))return"uint8Array";if(_D(Y))return"asyncIterable";if(ND(Y))return"iterable";if(W3(Y))return QW({transform:Y},Z);if(RD(Y))return qD(Y,Z);return"native"},qD=(Y,Z)=>{if(Y3(Y.transform,{checkOpen:!1}))return BD(Y,Z);if(W3(Y.transform))return QW(Y,Z);return FD(Y,Z)},BD=(Y,Z)=>{return JW(Y,Z,"Duplex stream"),"duplex"},QW=(Y,Z)=>{return JW(Y,Z,"web TransformStream"),"webTransform"},JW=({final:Y,binary:Z,objectMode:Q},J,X)=>{eH(Y,`${J}.final`,X),eH(Z,`${J}.binary`,X),G3(Q,`${J}.objectMode`)},eH=(Y,Z,Q)=>{if(Y!==void 0)throw TypeError(`The \`${Z}\` option can only be defined when using a generator, not a ${Q}.`)},FD=({transform:Y,final:Z,binary:Q,objectMode:J},X)=>{if(Y!==void 0&&!YW(Y))throw TypeError(`The \`${X}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);if(Y3(Z,{checkOpen:!1}))throw TypeError(`The \`${X}.final\` option must not be a Duplex stream.`);if(W3(Z))throw TypeError(`The \`${X}.final\` option must not be a web TransformStream.`);if(Z!==void 0&&!YW(Z))throw TypeError(`The \`${X}.final\` option must be a generator.`);return G3(Q,`${X}.binary`),G3(J,`${X}.objectMode`),g6(Y)||g6(Z)?"asyncGenerator":"generator"},G3=(Y,Z)=>{if(Y!==void 0&&typeof Y!=="boolean")throw TypeError(`The \`${Z}\` option must use a boolean.`)},YW=(Y)=>g6(Y)||XW(Y),g6=(Y)=>Object.prototype.toString.call(Y)==="[object AsyncGeneratorFunction]",XW=(Y)=>Object.prototype.toString.call(Y)==="[object GeneratorFunction]",RD=(Y)=>B0(Y)&&(Y.transform!==void 0||Y.final!==void 0),G7=(Y)=>Object.prototype.toString.call(Y)==="[object URL]",zW=(Y)=>G7(Y)&&Y.protocol!=="file:",MD=(Y)=>B0(Y)&&Object.keys(Y).length>0&&Object.keys(Y).every((Z)=>DD.has(Z))&&H3(Y.file),DD,H3=(Y)=>typeof Y==="string",GW=(Y,Z)=>Y==="native"&&typeof Z==="string"&&!LD.has(Z),LD,HW=(Y)=>Object.prototype.toString.call(Y)==="[object ReadableStream]",H7=(Y)=>Object.prototype.toString.call(Y)==="[object WritableStream]",TD=(Y)=>HW(Y)||H7(Y),W3=(Y)=>HW(Y?.readable)&&H7(Y?.writable),_D=(Y)=>WW(Y)&&typeof Y[Symbol.asyncIterator]==="function",ND=(Y)=>WW(Y)&&typeof Y[Symbol.iterator]==="function",WW=(Y)=>typeof Y==="object"&&Y!==null,r0,W7,K3,KW,$W,X6;var v0=F(()=>{m0();DD=new Set(["file","append"]),LD=new Set(["ipc","ignore","inherit","overlapped","pipe"]),r0=new Set(["generator","asyncGenerator","duplex","webTransform"]),W7=new Set(["fileUrl","filePath","fileNumber"]),K3=new Set(["fileUrl","filePath"]),KW=new Set([...K3,"webStream","nodeStream"]),$W=new Set(["webTransform","duplex"]),X6={generator:"a generator",asyncGenerator:"an async generator",fileUrl:"a file URL",filePath:"a file path string",fileNumber:"a file descriptor number",webStream:"a web stream",nodeStream:"a Node.js stream",webTransform:"a web TransformStream",duplex:"a Duplex stream",native:"any value",iterable:"an iterable",asyncIterable:"an async iterable",string:"a string",uint8Array:"a Uint8Array"}});var $3=(Y,Z,Q,J)=>J==="output"?wD(Y,Z,Q):OD(Y,Z,Q),wD=(Y,Z,Q)=>{let J=Z!==0&&Q[Z-1].value.readableObjectMode;return{writableObjectMode:J,readableObjectMode:Y??J}},OD=(Y,Z,Q)=>{let J=Z===0?Y===!0:Q[Z-1].value.readableObjectMode,X=Z!==Q.length-1&&(Y??J);return{writableObjectMode:J,readableObjectMode:X}},UW=(Y,Z)=>{let Q=Y.findLast(({type:J})=>r0.has(J));if(Q===void 0)return!1;return Z==="input"?Q.value.writableObjectMode:Q.value.readableObjectMode};var U3=F(()=>{v0()});var VW=(Y,Z,Q,J)=>[...Y.filter(({type:X})=>!r0.has(X)),...ID(Y,Z,Q,J)],ID=(Y,Z,Q,{encoding:J})=>{let X=Y.filter(({type:G})=>r0.has(G)),z=Array.from({length:X.length});for(let[G,H]of Object.entries(X))z[G]=ED({stdioItem:H,index:Number(G),newTransforms:z,optionName:Z,direction:Q,encoding:J});return AD(z,Q)},ED=({stdioItem:Y,stdioItem:{type:Z},index:Q,newTransforms:J,optionName:X,direction:z,encoding:G})=>{if(Z==="duplex")return CD({stdioItem:Y,optionName:X});if(Z==="webTransform")return jD({stdioItem:Y,index:Q,newTransforms:J,direction:z});return kD({stdioItem:Y,index:Q,newTransforms:J,direction:z,encoding:G})},CD=({stdioItem:Y,stdioItem:{value:{transform:Z,transform:{writableObjectMode:Q,readableObjectMode:J},objectMode:X=J}},optionName:z})=>{if(X&&!J)throw TypeError(`The \`${z}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);if(!X&&J)throw TypeError(`The \`${z}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);return{...Y,value:{transform:Z,writableObjectMode:Q,readableObjectMode:J}}},jD=({stdioItem:Y,stdioItem:{value:Z},index:Q,newTransforms:J,direction:X})=>{let{transform:z,objectMode:G}=B0(Z)?Z:{transform:Z},{writableObjectMode:H,readableObjectMode:W}=$3(G,Q,J,X);return{...Y,value:{transform:z,writableObjectMode:H,readableObjectMode:W}}},kD=({stdioItem:Y,stdioItem:{value:Z},index:Q,newTransforms:J,direction:X,encoding:z})=>{let{transform:G,final:H,binary:W=!1,preserveNewlines:K=!1,objectMode:$}=B0(Z)?Z:{transform:Z},V=W||u0.has(z),{writableObjectMode:q,readableObjectMode:M}=$3($,Q,J,X);return{...Y,value:{transform:G,final:H,binary:V,preserveNewlines:K,writableObjectMode:q,readableObjectMode:M}}},AD=(Y,Z)=>Z==="input"?Y.reverse():Y;var qW=F(()=>{f6();v0();U3()});import V3 from"node:process";var BW=(Y,Z,Q)=>{let J=Y.map((X)=>PD(X,Z));if(J.includes("input")&&J.includes("output"))throw TypeError(`The \`${Q}\` option must not be an array of both readable and writable values.`);return J.find(Boolean)??vD},PD=({type:Y,value:Z},Q)=>xD[Q]??FW[Y](Z),xD,y8=()=>{return},q3=()=>"input",FW,SD=(Y)=>{if([0,V3.stdin].includes(Y))return"input";if([1,2,V3.stdout,V3.stderr].includes(Y))return"output"},vD="output";var RW=F(()=>{v0();xD=["input","output","output"],FW={generator:y8,asyncGenerator:y8,fileUrl:y8,filePath:y8,iterable:q3,asyncIterable:q3,uint8Array:q3,webStream:(Y)=>H7(Y)?"output":"input",nodeStream(Y){if(!b6(Y,{checkOpen:!1}))return"output";return e5(Y,{checkOpen:!1})?void 0:"input"},webTransform:y8,duplex:y8,native(Y){let Z=SD(Y);if(Z!==void 0)return Z;if(JY(Y,{checkOpen:!1}))return FW.nodeStream(Y)}}});var MW=(Y,Z)=>Z&&!Y.includes("ipc")?[...Y,"ipc"]:Y;var DW=({stdio:Y,ipc:Z,buffer:Q,...J},X,z)=>{let G=yD(Y,J).map((H,W)=>LW(H,W));return z?bD(G,Q,X):MW(G,Z)},yD=(Y,Z)=>{if(Y===void 0)return s0.map((J)=>Z[J]);if(fD(Z))throw Error(`It's not possible to provide \`stdio\` in combination with one of ${s0.map((J)=>`\`${J}\``).join(", ")}`);if(typeof Y==="string")return[Y,Y,Y];if(!Array.isArray(Y))throw TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof Y}\``);let Q=Math.max(Y.length,s0.length);return Array.from({length:Q},(J,X)=>Y[X])},fD=(Y)=>s0.some((Z)=>Y[Z]!==void 0),LW=(Y,Z)=>{if(Array.isArray(Y))return Y.map((Q)=>LW(Q,Z));if(Y===null||Y===void 0)return Z>=s0.length?"ignore":"pipe";return Y},bD=(Y,Z,Q)=>Y.map((J,X)=>!Z[X]&&X!==0&&!w8(Q,X)&&hD(J)?"ignore":J),hD=(Y)=>Y==="pipe"||Array.isArray(Y)&&Y.every((Z)=>Z==="pipe");var TW=F(()=>{PY();eY()});import{readFileSync as gD}from"node:fs";import mD from"node:tty";var NW=({stdioItem:Y,stdioItem:{type:Z},isStdioArray:Q,fdNumber:J,direction:X,isSync:z})=>{if(!Q||Z!=="native")return Y;return z?uD({stdioItem:Y,fdNumber:J,direction:X}):cD({stdioItem:Y,fdNumber:J})},uD=({stdioItem:Y,stdioItem:{value:Z,optionName:Q},fdNumber:J,direction:X})=>{let z=dD({value:Z,optionName:Q,fdNumber:J,direction:X});if(z!==void 0)return z;if(JY(Z,{checkOpen:!1}))throw TypeError(`The \`${Q}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);return Y},dD=({value:Y,optionName:Z,fdNumber:Q,direction:J})=>{let X=pD(Y,Q);if(X===void 0)return;if(J==="output")return{type:"fileNumber",value:X,optionName:Z};if(mD.isatty(X))throw TypeError(`The \`${Z}: ${AZ(Y)}\` option is invalid: it cannot be a TTY with synchronous methods.`);return{type:"uint8Array",value:AY(gD(X)),optionName:Z}},pD=(Y,Z)=>{if(Y==="inherit")return Z;if(typeof Y==="number")return Y;let Q=KZ.indexOf(Y);if(Q!==-1)return Q},cD=({stdioItem:Y,stdioItem:{value:Z,optionName:Q},fdNumber:J})=>{if(Z==="inherit")return{type:"nodeStream",value:_W(J,Z,Q),optionName:Q};if(typeof Z==="number")return{type:"nodeStream",value:_W(Z,Z,Q),optionName:Q};if(JY(Z,{checkOpen:!1}))return{type:"nodeStream",value:Z,optionName:Q};return Y},_W=(Y,Z,Q)=>{let J=KZ[Y];if(J===void 0)throw TypeError(`The \`${Q}: ${Z}\` option is invalid: no such standard stream.`);return J};var wW=F(()=>{PY();m0();Q6()});var OW=({input:Y,inputFile:Z},Q)=>Q===0?[...lD(Y),...nD(Z)]:[],lD=(Y)=>Y===void 0?[]:[{type:iD(Y),value:Y,optionName:"input"}],iD=(Y)=>{if(b6(Y,{checkOpen:!1}))return"nodeStream";if(typeof Y==="string")return"string";if(L0(Y))return"uint8Array";throw Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.")},nD=(Y)=>Y===void 0?[]:[{...aD(Y),optionName:"inputFile"}],aD=(Y)=>{if(G7(Y))return{type:"fileUrl",value:Y};if(H3(Y))return{type:"filePath",value:{file:Y}};throw Error("The `inputFile` option must be a file path string or a file URL.")};var IW=F(()=>{m0();v0()});var EW=(Y)=>Y.filter((Z,Q)=>Y.every((J,X)=>Z.value!==J.value||Q>=X||Z.type==="generator"||Z.type==="asyncGenerator")),CW=({stdioItem:{type:Y,value:Z,optionName:Q},direction:J,fileDescriptors:X,isSync:z})=>{let G=oD(X,Y);if(G.length===0)return;if(z){sD({otherStdioItems:G,type:Y,value:Z,optionName:Q,direction:J});return}if(KW.has(Y))return jW({otherStdioItems:G,type:Y,value:Z,optionName:Q,direction:J});if($W.has(Y))tD({otherStdioItems:G,type:Y,value:Z,optionName:Q})},oD=(Y,Z)=>Y.flatMap(({direction:Q,stdioItems:J})=>J.filter((X)=>X.type===Z).map((X)=>({...X,direction:Q}))),sD=({otherStdioItems:Y,type:Z,value:Q,optionName:J,direction:X})=>{if(K3.has(Z))jW({otherStdioItems:Y,type:Z,value:Q,optionName:J,direction:X})},jW=({otherStdioItems:Y,type:Z,value:Q,optionName:J,direction:X})=>{let z=Y.filter((H)=>rD(H,Q));if(z.length===0)return;let G=z.find((H)=>H.direction!==X);return kW(G,J,Z),X==="output"?z[0].stream:void 0},rD=({type:Y,value:Z},Q)=>{if(Y==="filePath")return Z.file===Q.file;if(Y==="fileUrl")return Z.href===Q.href;return Z===Q},tD=({otherStdioItems:Y,type:Z,value:Q,optionName:J})=>{let X=Y.find(({value:{transform:z}})=>z===Q.transform);kW(X,J,Z)},kW=(Y,Z,Q)=>{if(Y!==void 0)throw TypeError(`The \`${Y.optionName}\` and \`${Z}\` options must not target ${X6[Q]} that is the same.`)};var AW=F(()=>{v0()});var K7=(Y,Z,Q,J)=>{let z=DW(Z,Q,J).map((H,W)=>eD({stdioOption:H,fdNumber:W,options:Z,isSync:J})),G=HL({initialFileDescriptors:z,addProperties:Y,options:Z,isSync:J});return Z.stdio=G.map(({stdioItems:H})=>$L(H)),G},eD=({stdioOption:Y,fdNumber:Z,options:Q,isSync:J})=>{let X=$Z(Z),{stdioItems:z,isStdioArray:G}=YL({stdioOption:Y,fdNumber:Z,options:Q,optionName:X}),H=BW(z,Z,X),W=z.map((V)=>NW({stdioItem:V,isStdioArray:G,fdNumber:Z,direction:H,isSync:J})),K=VW(W,X,H,Q),$=UW(K,H);return GL(K,$),{direction:H,objectMode:$,stdioItems:K}},YL=({stdioOption:Y,fdNumber:Z,options:Q,optionName:J})=>{let z=[...(Array.isArray(Y)?Y:[Y]).map((W)=>ZL(W,J)),...OW(Q,Z)],G=EW(z),H=G.length>1;return QL(G,H,J),XL(G),{stdioItems:G,isStdioArray:H}},ZL=(Y,Z)=>({type:ZW(Y,Z),value:Y,optionName:Z}),QL=(Y,Z,Q)=>{if(Y.length===0)throw TypeError(`The \`${Q}\` option must not be an empty array.`);if(!Z)return;for(let{value:J,optionName:X}of Y)if(JL.has(J))throw Error(`The \`${X}\` option must not include \`${J}\`.`)},JL,XL=(Y)=>{for(let Z of Y)zL(Z)},zL=({type:Y,value:Z,optionName:Q})=>{if(zW(Z))throw TypeError(`The \`${Q}: URL\` option must use the \`file:\` scheme.
|
|
76
|
+
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);if(GW(Y,Z))throw TypeError(`The \`${Q}: { file: '...' }\` option must be used instead of \`${Q}: '...'\`.`)},GL=(Y,Z)=>{if(!Z)return;let Q=Y.find(({type:J})=>W7.has(J));if(Q!==void 0)throw TypeError(`The \`${Q.optionName}\` option cannot use both files and transforms in objectMode.`)},HL=({initialFileDescriptors:Y,addProperties:Z,options:Q,isSync:J})=>{let X=[];try{for(let z of Y)X.push(WL({fileDescriptor:z,fileDescriptors:X,addProperties:Z,options:Q,isSync:J}));return X}catch(z){throw B3(X),z}},WL=({fileDescriptor:{direction:Y,objectMode:Z,stdioItems:Q},fileDescriptors:J,addProperties:X,options:z,isSync:G})=>{let H=Q.map((W)=>KL({stdioItem:W,addProperties:X,direction:Y,options:z,fileDescriptors:J,isSync:G}));return{direction:Y,objectMode:Z,stdioItems:H}},KL=({stdioItem:Y,addProperties:Z,direction:Q,options:J,fileDescriptors:X,isSync:z})=>{let G=CW({stdioItem:Y,direction:Q,fileDescriptors:X,isSync:z});if(G!==void 0)return{...Y,stream:G};return{...Y,...Z[Q][Y.type](Y,J)}},B3=(Y)=>{for(let{stdioItems:Z}of Y)for(let{stream:Q}of Z)if(Q!==void 0&&!ZY(Q))Q.destroy()},$L=(Y)=>{if(Y.length>1)return Y.some(({value:J})=>J==="overlapped")?"overlapped":"pipe";let[{type:Z,value:Q}]=Y;return Z==="native"?Q:"pipe"};var $7=F(()=>{PY();qW();U3();v0();RW();TW();wW();IW();AW();JL=new Set(["ignore","ipc"])});import{readFileSync as PW}from"node:fs";var SW=(Y,Z)=>K7(VL,Y,Z,!0),FY=({type:Y,optionName:Z})=>{vW(Z,X6[Y])},UL=({optionName:Y,value:Z})=>{if(Z==="ipc"||Z==="overlapped")vW(Y,`"${Z}"`);return{}},vW=(Y,Z)=>{throw TypeError(`The \`${Y}\` option cannot be ${Z} with synchronous methods.`)},xW,VL;var yW=F(()=>{m0();$7();v0();xW={generator(){},asyncGenerator:FY,webStream:FY,nodeStream:FY,webTransform:FY,duplex:FY,asyncIterable:FY,native:UL},VL={input:{...xW,fileUrl:({value:Y})=>({contents:[AY(PW(Y))]}),filePath:({value:{file:Y}})=>({contents:[AY(PW(Y))]}),fileNumber:FY,iterable:({value:Y})=>({contents:[...Y]}),string:({value:Y})=>({contents:[Y]}),uint8Array:({value:Y})=>({contents:[Y]})},output:{...xW,fileUrl:({value:Y})=>({path:Y}),filePath:({value:{file:Y,append:Z}})=>({path:Y,append:Z}),fileNumber:({value:Y})=>({path:Y}),iterable:FY,string:FY,uint8Array:FY}}});var fY=(Y,{stripFinalNewline:Z},Q)=>F3(Z,Q)&&Y!==void 0&&!Array.isArray(Y)?P8(Y):Y,F3=(Y,Z)=>Z==="all"?Y[1]||Y[2]:Y[Z];var P1=F(()=>{t5()});var U7=(Y,Z,Q,J)=>Y||Q?void 0:bW(Z,J),M3=(Y,Z,Q)=>Q?Y.flatMap((J)=>fW(J,Z)):fW(Y,Z),fW=(Y,Z)=>{let{transform:Q,final:J}=bW(Z,{});return[...Q(Y),...J()]},bW=(Y,Z)=>{return Z.previousChunks="",{transform:qL.bind(void 0,Z,Y),final:FL.bind(void 0,Z)}},qL=function*(Y,Z,Q){if(typeof Q!=="string"){yield Q;return}let{previousChunks:J}=Y,X=-1;for(let z=0;z<Q.length;z+=1)if(Q[z]===`
|
|
77
|
+
`){let G=BL(Q,z,Z,Y),H=Q.slice(X+1,z+1-G);if(J.length>0)H=R3(J,H),J="";yield H,X=z}if(X!==Q.length-1)J=R3(J,Q.slice(X+1));Y.previousChunks=J},BL=(Y,Z,Q,J)=>{if(Q)return 0;return J.isWindowsNewline=Z!==0&&Y[Z-1]==="\r",J.isWindowsNewline?2:1},FL=function*({previousChunks:Y}){if(Y.length>0)yield Y},hW=({binary:Y,preserveNewlines:Z,readableObjectMode:Q,state:J})=>Y||Z||Q?void 0:{transform:RL.bind(void 0,J)},RL=function*({isWindowsNewline:Y=!1},Z){let{unixNewline:Q,windowsNewline:J,LF:X,concatBytes:z}=typeof Z==="string"?ML:LL;if(Z.at(-1)===X){yield Z;return}yield z(Z,Y?J:Q)},R3=(Y,Z)=>`${Y}${Z}`,ML,DL=(Y,Z)=>{let Q=new Uint8Array(Y.length+Z.length);return Q.set(Y,0),Q.set(Z,Y.length),Q},LL;var V7=F(()=>{ML={windowsNewline:`\r
|
|
85
78
|
`,unixNewline:`
|
|
86
79
|
`,LF:`
|
|
87
|
-
`,concatBytes:
|
|
80
|
+
`,concatBytes:R3},LL={windowsNewline:new Uint8Array([13,10]),unixNewline:new Uint8Array([10]),LF:10,concatBytes:DL}});import{Buffer as TL}from"node:buffer";var gW=(Y,Z)=>Y?void 0:_L.bind(void 0,Z),_L=function*(Y,Z){if(typeof Z!=="string"&&!L0(Z)&&!TL.isBuffer(Z))throw TypeError(`The \`${Y}\` option's transform must use "objectMode: true" to receive as input: ${typeof Z}.`);yield Z},mW=(Y,Z)=>Y?NL.bind(void 0,Z):wL.bind(void 0,Z),NL=function*(Y,Z){uW(Y,Z),yield Z},wL=function*(Y,Z){if(uW(Y,Z),typeof Z!=="string"&&!L0(Z))throw TypeError(`The \`${Y}\` option's function must yield a string or an Uint8Array, not ${typeof Z}.`);yield Z},uW=(Y,Z)=>{if(Z===null||Z===void 0)throw TypeError(`The \`${Y}\` option's function must not call \`yield ${Z}\`.
|
|
88
81
|
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
|
|
89
|
-
if (condition) { yield value; }`)};import{Buffer as cq}from"node:buffer";import{StringDecoder as lq}from"node:string_decoder";var h4=(Y,Z,Q)=>{if(Q)return;if(Y)return{transform:iq.bind(void 0,new TextEncoder)};let X=new lq(Z);return{transform:nq.bind(void 0,X),final:aq.bind(void 0,X)}},iq=function*(Y,Z){if(cq.isBuffer(Z))yield r0(Z);else if(typeof Z==="string")yield Y.encode(Z);else yield Z},nq=function*(Y,Z){yield G0(Z)?Y.write(Z):Z},aq=function*(Y){let Z=Y.end();if(Z!=="")yield Z};import{callbackify as PJ}from"node:util";var o7=PJ(async(Y,Z,Q,X)=>{Z.currentIterable=Y(...Q);try{for await(let J of Z.currentIterable)X.push(J)}finally{delete Z.currentIterable}}),b4=async function*(Y,Z,Q){if(Q===Z.length){yield Y;return}let{transform:X=sq}=Z[Q];for await(let J of X(Y))yield*b4(J,Z,Q+1)},EJ=async function*(Y){for(let[Z,{final:Q}]of Object.entries(Y))yield*oq(Q,Number(Z),Y)},oq=async function*(Y,Z,Q){if(Y===void 0)return;for await(let X of Y())yield*b4(X,Q,Z+1)},CJ=PJ(async({currentIterable:Y},Z)=>{if(Y!==void 0){await(Z?Y.throw(Z):Y.return());return}if(Z)throw Z}),sq=function*(Y){yield Y};var s7=(Y,Z,Q,X)=>{try{for(let J of Y(...Z))Q.push(J);X()}catch(J){X(J)}},kJ=(Y,Z)=>[...Z.flatMap((Q)=>[...dY(Q,Y,0)]),...O1(Y)],dY=function*(Y,Z,Q){if(Q===Z.length){yield Y;return}let{transform:X=rq}=Z[Q];for(let J of X(Y))yield*dY(J,Z,Q+1)},O1=function*(Y){for(let[Z,{final:Q}]of Object.entries(Y))yield*tq(Q,Number(Z),Y)},tq=function*(Y,Z,Q){if(Y===void 0)return;for(let X of Y())yield*dY(X,Q,Z+1)},rq=function*(Y){yield Y};var t7=({value:Y,value:{transform:Z,final:Q,writableObjectMode:X,readableObjectMode:J},optionName:$},{encoding:G})=>{let K={},H=IJ(Y,G,$),W=uY(Z),z=uY(Q),q=W?o7.bind(void 0,b4,K):s7.bind(void 0,dY),V=W||z?o7.bind(void 0,EJ,K):s7.bind(void 0,O1),R=W||z?CJ.bind(void 0,K):void 0;return{stream:new eq({writableObjectMode:X,writableHighWaterMark:AJ(X),readableObjectMode:J,readableHighWaterMark:AJ(J),transform(M,T,D){q([M,H,0],this,D)},flush(M){V([H],this,M)},destroy:R})}},g4=(Y,Z,Q,X)=>{let J=Z.filter(({type:G})=>G==="generator"),$=X?J.reverse():J;for(let{value:G,optionName:K}of $){let H=IJ(G,Q,K);Y=kJ(H,Y)}return Y},IJ=({transform:Y,final:Z,binary:Q,writableObjectMode:X,readableObjectMode:J,preserveNewlines:$},G,K)=>{let H={};return[{transform:wJ(X,K)},h4(Q,G,X),f4(Q,$,X,H),{transform:Y,final:Z},{transform:NJ(J,K)},_J({binary:Q,preserveNewlines:$,readableObjectMode:J,state:H})].filter(Boolean)};var jJ=(Y,Z)=>{for(let Q of YV(Y))ZV(Y,Q,Z)},YV=(Y)=>new Set(Object.entries(Y).filter(([,{direction:Z}])=>Z==="input").map(([Z])=>Number(Z))),ZV=(Y,Z,Q)=>{let{stdioItems:X}=Y[Z],J=X.filter(({contents:K})=>K!==void 0);if(J.length===0)return;if(Z!==0){let[{type:K,optionName:H}]=J;throw TypeError(`Only the \`stdin\` option, not \`${H}\`, can be ${FY[K]} with synchronous methods.`)}let G=J.map(({contents:K})=>K).map((K)=>QV(K,X));Q.input=F1(G)},QV=(Y,Z)=>{let Q=g4(Y,Z,"utf8",!0);return XV(Q),F1(Q)},XV=(Y)=>{let Z=Y.find((Q)=>typeof Q!=="string"&&!G0(Q));if(Z!==void 0)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${Z}.`)};import{writeFileSync as KV,appendFileSync as HV}from"node:fs";var m4=({stdioItems:Y,encoding:Z,verboseInfo:Q,fdNumber:X})=>X!=="all"&&T6(Q,X)&&!O0.has(Z)&&JV(X)&&(Y.some(({type:J,value:$})=>J==="native"&&$V.has($))||Y.every(({type:J})=>x0.has(J))),JV=(Y)=>Y===1||Y===2,$V=new Set(["pipe","overlapped"]),xJ=async(Y,Z,Q,X)=>{for await(let J of Y)if(!GV(Z))yJ(J,Q,X)},SJ=(Y,Z,Q)=>{for(let X of Y)yJ(X,Z,Q)},GV=(Y)=>Y._readableState.pipes.length>0,yJ=(Y,Z,Q)=>{let X=r8(Y);g0({type:"output",verboseMessage:X,fdNumber:Z,verboseInfo:Q})};var vJ=({fileDescriptors:Y,syncResult:{output:Z},options:Q,isMaxBuffer:X,verboseInfo:J})=>{if(Z===null)return{output:Array.from({length:3})};let $={},G=new Set([]);return{output:Z.map((H,W)=>zV({result:H,fileDescriptors:Y,fdNumber:W,state:$,outputFiles:G,isMaxBuffer:X,verboseInfo:J},Q)),...$}},zV=({result:Y,fileDescriptors:Z,fdNumber:Q,state:X,outputFiles:J,isMaxBuffer:$,verboseInfo:G},{buffer:K,encoding:H,lines:W,stripFinalNewline:z,maxBuffer:q})=>{if(Y===null)return;let V=fX(Y,$,q),R=r0(V),{stdioItems:B,objectMode:M}=Z[Q],T=WV([R],B,H,X),{serializedResult:D,finalResult:_=D}=UV({chunks:T,objectMode:M,encoding:H,lines:W,stripFinalNewline:z,fdNumber:Q});qV({serializedResult:D,fdNumber:Q,state:X,verboseInfo:G,encoding:H,stdioItems:B,objectMode:M});let w=K[Q]?_:void 0;try{if(X.error===void 0)VV(D,B,J);return w}catch(N){return X.error=N,w}},WV=(Y,Z,Q,X)=>{try{return g4(Y,Z,Q,!1)}catch(J){return X.error=J,Y}},UV=({chunks:Y,objectMode:Z,encoding:Q,lines:X,stripFinalNewline:J,fdNumber:$})=>{if(Z)return{serializedResult:Y};if(Q==="buffer")return{serializedResult:F1(Y)};let G=s5(Y,Q);if(X[$])return{serializedResult:G,finalResult:a7(G,!J[$],Z)};return{serializedResult:G}},qV=({serializedResult:Y,fdNumber:Z,state:Q,verboseInfo:X,encoding:J,stdioItems:$,objectMode:G})=>{if(!m4({stdioItems:$,encoding:J,verboseInfo:X,fdNumber:Z}))return;let K=a7(Y,!1,G);try{SJ(K,Z,X)}catch(H){Q.error??=H}},VV=(Y,Z,Q)=>{for(let{path:X,append:J}of Z.filter(({type:$})=>y4.has($))){let $=typeof X==="string"?X:X.toString();if(J||Q.has($))HV(X,Y);else Q.add($),KV(X,Y)}};var fJ=([,Y,Z],Q)=>{if(!Q.all)return;if(Y===void 0)return Z;if(Z===void 0)return Y;if(Array.isArray(Y))return Array.isArray(Z)?[...Y,...Z]:[...Y,QY(Z,Q,"all")];if(Array.isArray(Z))return[QY(Y,Q,"all"),...Z];if(G0(Y)&&G0(Z))return X7([Y,Z]);return`${Y}${Z}`};import{once as r7}from"node:events";var hJ=async(Y,Z)=>{let[Q,X]=await BV(Y);return Z.isForcefullyTerminated??=!1,[Q,X]},BV=async(Y)=>{let[Z,Q]=await Promise.allSettled([r7(Y,"spawn"),r7(Y,"exit")]);if(Z.status==="rejected")return[];return Q.status==="rejected"?bJ(Y):Q.value},bJ=async(Y)=>{try{return await r7(Y,"exit")}catch{return bJ(Y)}},gJ=async(Y)=>{let[Z,Q]=await Y;if(!FV(Z,Q)&&e7(Z,Q))throw new m0;return[Z,Q]},FV=(Y,Z)=>Y===void 0&&Z===void 0,e7=(Y,Z)=>Y!==0||Z!==null;var mJ=({error:Y,status:Z,signal:Q,output:X},{maxBuffer:J})=>{let $=RV(Y,Z,Q),G=$?.code==="ETIMEDOUT",K=vX($,X,J);return{resultError:$,exitCode:Z,signal:Q,timedOut:G,isMaxBuffer:K}},RV=(Y,Z,Q)=>{if(Y!==void 0)return Y;return e7(Z,Q)?new m0:void 0};var uJ=(Y,Z,Q)=>{let{file:X,commandArguments:J,command:$,escapedCommand:G,startTime:K,verboseInfo:H,options:W,fileDescriptors:z}=DV(Y,Z,Q),q=_V({file:X,commandArguments:J,options:W,command:$,escapedCommand:G,verboseInfo:H,fileDescriptors:z,startTime:K});return A6(q,H,W)},DV=(Y,Z,Q)=>{let{command:X,escapedCommand:J,startTime:$,verboseInfo:G}=Y4(Y,Z,Q),K=LV(Q),{file:H,commandArguments:W,options:z}=_4(Y,Z,K);TV(z);let q=MJ(z,G);return{file:H,commandArguments:W,command:X,escapedCommand:J,startTime:$,verboseInfo:G,options:z,fileDescriptors:q}},LV=(Y)=>Y.node&&!Y.ipc?{...Y,ipc:!1}:Y,TV=({ipc:Y,ipcInput:Z,detached:Q,cancelSignal:X})=>{if(Z)u4("ipcInput");if(Y)u4("ipc: true");if(Q)u4("detached: true");if(X)u4("cancelSignal")},u4=(Y)=>{throw TypeError(`The "${Y}" option cannot be used with synchronous methods.`)},_V=({file:Y,commandArguments:Z,options:Q,command:X,escapedCommand:J,verboseInfo:$,fileDescriptors:G,startTime:K})=>{let H=wV({file:Y,commandArguments:Z,options:Q,command:X,escapedCommand:J,fileDescriptors:G,startTime:K});if(H.failed)return H;let{resultError:W,exitCode:z,signal:q,timedOut:V,isMaxBuffer:R}=mJ(H,Q),{output:B,error:M=W}=vJ({fileDescriptors:G,syncResult:H,options:Q,isMaxBuffer:R,verboseInfo:$}),T=B.map((_,w)=>QY(_,Q,w)),D=QY(fJ(B,Q),Q,"all");return OV({error:M,exitCode:z,signal:q,timedOut:V,isMaxBuffer:R,stdio:T,all:D,options:Q,command:X,escapedCommand:J,startTime:K})},wV=({file:Y,commandArguments:Z,options:Q,command:X,escapedCommand:J,fileDescriptors:$,startTime:G})=>{try{jJ($,Q);let K=NV(Q);return MV(...w4(Y,Z,K))}catch(K){return k6({error:K,command:X,escapedCommand:J,fileDescriptors:$,options:Q,startTime:G,isSync:!0})}},NV=({encoding:Y,maxBuffer:Z,...Q})=>({...Q,encoding:"buffer",maxBuffer:I4(Z)}),OV=({error:Y,exitCode:Z,signal:Q,timedOut:X,isMaxBuffer:J,stdio:$,all:G,options:K,command:H,escapedCommand:W,startTime:z})=>Y===void 0?j4({command:H,escapedCommand:W,stdio:$,all:G,ipcOutput:[],options:K,startTime:z}):N1({error:Y,command:H,escapedCommand:W,timedOut:X,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:J,isForcefullyTerminated:!1,exitCode:Z,signal:Q,stdio:$,all:G,ipcOutput:[],options:K,startTime:z,isSync:!0});import{setMaxListeners as UF}from"node:events";import{spawn as qF}from"node:child_process";import iJ from"node:process";import{once as Y2,on as PV}from"node:events";var dJ=({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:X},{reference:J=!0,filter:$}={})=>{return N6({methodName:"getOneMessage",isSubprocess:Q,ipc:X,isConnected:F4(Y)}),EV({anyProcess:Y,channel:Z,isSubprocess:Q,filter:$,reference:J})},EV=async({anyProcess:Y,channel:Z,isSubprocess:Q,filter:X,reference:J})=>{U4(Z,J);let $=BY(Y,Z,Q),G=new AbortController;try{return await Promise.race([CV($,X,G),kV($,Q,G),AV($,Q,G)])}catch(K){throw O6(Y),K}finally{G.abort(),q4(Z,J)}},CV=async(Y,Z,{signal:Q})=>{if(Z===void 0){let[X]=await Y2(Y,"message",{signal:Q});return X}for await(let[X]of PV(Y,"message",{signal:Q}))if(Z(X))return X},kV=async(Y,Z,{signal:Q})=>{await Y2(Y,"disconnect",{signal:Q}),CQ(Z)},AV=async(Y,Z,{signal:Q})=>{let[X]=await Y2(Y,"strict:error",{signal:Q});throw H4(X,Z)};import{once as cJ,on as IV}from"node:events";var lJ=({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:X},{reference:J=!0}={})=>Z2({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:X,shouldAwait:!Q,reference:J}),Z2=({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:X,shouldAwait:J,reference:$})=>{N6({methodName:"getEachMessage",isSubprocess:Q,ipc:X,isConnected:F4(Y)}),U4(Z,$);let G=BY(Y,Z,Q),K=new AbortController,H={};return jV(Y,G,K),xV({ipcEmitter:G,isSubprocess:Q,controller:K,state:H}),SV({anyProcess:Y,channel:Z,ipcEmitter:G,isSubprocess:Q,shouldAwait:J,controller:K,state:H,reference:$})},jV=async(Y,Z,Q)=>{try{await cJ(Z,"disconnect",{signal:Q.signal}),Q.abort()}catch{}},xV=async({ipcEmitter:Y,isSubprocess:Z,controller:Q,state:X})=>{try{let[J]=await cJ(Y,"strict:error",{signal:Q.signal});X.error=H4(J,Z),Q.abort()}catch{}},SV=async function*({anyProcess:Y,channel:Z,ipcEmitter:Q,isSubprocess:X,shouldAwait:J,controller:$,state:G,reference:K}){try{for await(let[H]of IV(Q,"message",{signal:$.signal}))pJ(G),yield H}catch{pJ(G)}finally{if($.abort(),q4(Z,K),!X)O6(Y);if(J)await Y}},pJ=({error:Y})=>{if(Y)throw Y};var nJ=(Y,{ipc:Z})=>{Object.assign(Y,oJ(Y,!1,Z))},aJ=()=>{let Y=iJ,Z=!0,Q=iJ.channel!==void 0;return{...oJ(Y,!0,Q),getCancelSignal:YX.bind(void 0,{anyProcess:Y,channel:Y.channel,isSubprocess:!0,ipc:Q})}},oJ=(Y,Z,Q)=>({sendMessage:L4.bind(void 0,{anyProcess:Y,channel:Y.channel,isSubprocess:Z,ipc:Q}),getOneMessage:dJ.bind(void 0,{anyProcess:Y,channel:Y.channel,isSubprocess:Z,ipc:Q}),getEachMessage:lJ.bind(void 0,{anyProcess:Y,channel:Y.channel,isSubprocess:Z,ipc:Q})});import{ChildProcess as yV}from"node:child_process";import{PassThrough as vV,Readable as fV,Writable as hV,Duplex as bV}from"node:stream";var sJ=({error:Y,command:Z,escapedCommand:Q,fileDescriptors:X,options:J,startTime:$,verboseInfo:G})=>{l7(X);let K=new yV;gV(K,X),Object.assign(K,{readable:mV,writable:uV,duplex:dV});let H=k6({error:Y,command:Z,escapedCommand:Q,fileDescriptors:X,options:J,startTime:$,isSync:!1}),W=pV(H,G,J);return{subprocess:K,promise:W}},gV=(Y,Z)=>{let Q=P1(),X=P1(),J=P1(),$=Array.from({length:Z.length-3},P1),G=P1(),K=[Q,X,J,...$];Object.assign(Y,{stdin:Q,stdout:X,stderr:J,all:G,stdio:K})},P1=()=>{let Y=new vV;return Y.end(),Y},mV=()=>new fV({read(){}}),uV=()=>new hV({write(){}}),dV=()=>new bV({read(){},write(){}}),pV=async(Y,Z,Q)=>A6(Y,Z,Q);import{createReadStream as tJ,createWriteStream as rJ}from"node:fs";import{Buffer as cV}from"node:buffer";import{Readable as E1,Writable as lV,Duplex as iV}from"node:stream";var Y9=(Y,Z)=>v4(nV,Y,Z,!1),C1=({type:Y,optionName:Z})=>{throw TypeError(`The \`${Z}\` option cannot be ${FY[Y]}.`)},eJ={fileNumber:C1,generator:t7,asyncGenerator:t7,nodeStream:({value:Y})=>({stream:Y}),webTransform({value:{transform:Y,writableObjectMode:Z,readableObjectMode:Q}}){let X=Z||Q;return{stream:iV.fromWeb(Y,{objectMode:X})}},duplex:({value:{transform:Y}})=>({stream:Y}),native(){}},nV={input:{...eJ,fileUrl:({value:Y})=>({stream:tJ(Y)}),filePath:({value:{file:Y}})=>({stream:tJ(Y)}),webStream:({value:Y})=>({stream:E1.fromWeb(Y)}),iterable:({value:Y})=>({stream:E1.from(Y)}),asyncIterable:({value:Y})=>({stream:E1.from(Y)}),string:({value:Y})=>({stream:E1.from(Y)}),uint8Array:({value:Y})=>({stream:E1.from(cV.from(Y))})},output:{...eJ,fileUrl:({value:Y})=>({stream:rJ(Y)}),filePath:({value:{file:Y,append:Z}})=>({stream:rJ(Y,Z?{flags:"a"}:{})}),webStream:({value:Y})=>({stream:lV.fromWeb(Y)}),iterable:C1,asyncIterable:C1,string:C1,uint8Array:C1}};import{on as aV,once as Z9}from"node:events";import{PassThrough as oV,getDefaultHighWaterMark as sV}from"node:stream";import{finished as J9}from"node:stream/promises";function pY(Y){if(!Array.isArray(Y))throw TypeError(`Expected an array, got \`${typeof Y}\`.`);for(let J of Y)Q2(J);let Z=Y.some(({readableObjectMode:J})=>J),Q=tV(Y,Z),X=new $9({objectMode:Z,writableHighWaterMark:Q,readableHighWaterMark:Q});for(let J of Y)X.add(J);return X}var tV=(Y,Z)=>{if(Y.length===0)return sV(Z);let Q=Y.filter(({readableObjectMode:X})=>X===Z).map(({readableHighWaterMark:X})=>X);return Math.max(...Q)};class $9 extends oV{#Z=new Set([]);#Q=new Set([]);#Y=new Set([]);#X;#J=Symbol("unpipe");#$=new WeakMap;add(Y){if(Q2(Y),this.#Z.has(Y))return;this.#Z.add(Y),this.#X??=rV(this,this.#Z,this.#J);let Z=ZB({passThroughStream:this,stream:Y,streams:this.#Z,ended:this.#Q,aborted:this.#Y,onFinished:this.#X,unpipeEvent:this.#J});this.#$.set(Y,Z),Y.pipe(this,{end:!1})}async remove(Y){if(Q2(Y),!this.#Z.has(Y))return!1;let Z=this.#$.get(Y);if(Z===void 0)return!1;return this.#$.delete(Y),Y.unpipe(this),await Z,!0}}var rV=async(Y,Z,Q)=>{d4(Y,Q9);let X=new AbortController;try{await Promise.race([eV(Y,X),YB(Y,Z,Q,X)])}finally{X.abort(),d4(Y,-Q9)}},eV=async(Y,{signal:Z})=>{try{await J9(Y,{signal:Z,cleanup:!0})}catch(Q){throw G9(Y,Q),Q}},YB=async(Y,Z,Q,{signal:X})=>{for await(let[J]of aV(Y,"unpipe",{signal:X}))if(Z.has(J))J.emit(Q)},Q2=(Y)=>{if(typeof Y?.pipe!=="function")throw TypeError(`Expected a readable stream, got: \`${typeof Y}\`.`)},ZB=async({passThroughStream:Y,stream:Z,streams:Q,ended:X,aborted:J,onFinished:$,unpipeEvent:G})=>{d4(Y,X9);let K=new AbortController;try{await Promise.race([QB($,Z,K),XB({passThroughStream:Y,stream:Z,streams:Q,ended:X,aborted:J,controller:K}),JB({stream:Z,streams:Q,ended:X,aborted:J,unpipeEvent:G,controller:K})])}finally{K.abort(),d4(Y,-X9)}if(Q.size>0&&Q.size===X.size+J.size)if(X.size===0&&J.size>0)X2(Y);else $B(Y)},QB=async(Y,Z,{signal:Q})=>{try{if(await Y,!Q.aborted)X2(Z)}catch(X){if(!Q.aborted)G9(Z,X)}},XB=async({passThroughStream:Y,stream:Z,streams:Q,ended:X,aborted:J,controller:{signal:$}})=>{try{if(await J9(Z,{signal:$,cleanup:!0,readable:!0,writable:!1}),Q.has(Z))X.add(Z)}catch(G){if($.aborted||!Q.has(Z))return;if(K9(G))J.add(Z);else H9(Y,G)}},JB=async({stream:Y,streams:Z,ended:Q,aborted:X,unpipeEvent:J,controller:{signal:$}})=>{if(await Z9(Y,J,{signal:$}),!Y.readable)return Z9($,"abort",{signal:$});Z.delete(Y),Q.delete(Y),X.delete(Y)},$B=(Y)=>{if(Y.writable)Y.end()},G9=(Y,Z)=>{if(K9(Z))X2(Y);else H9(Y,Z)},K9=(Y)=>Y?.code==="ERR_STREAM_PREMATURE_CLOSE",X2=(Y)=>{if(Y.readable||Y.writable)Y.destroy()},H9=(Y,Z)=>{if(!Y.destroyed)Y.once("error",GB),Y.destroy(Z)},GB=()=>{},d4=(Y,Z)=>{let Q=Y.getMaxListeners();if(Q!==0&&Q!==Number.POSITIVE_INFINITY)Y.setMaxListeners(Q+Z)},Q9=2,X9=1;import{finished as z9}from"node:stream/promises";var j6=(Y,Z)=>{Y.pipe(Z),KB(Y,Z),HB(Y,Z)},KB=async(Y,Z)=>{if(y0(Y)||y0(Z))return;try{await z9(Y,{cleanup:!0,readable:!0,writable:!1})}catch{}J2(Z)},J2=(Y)=>{if(Y.writable)Y.end()},HB=async(Y,Z)=>{if(y0(Y)||y0(Z))return;try{await z9(Z,{cleanup:!0,readable:!1,writable:!0})}catch{}$2(Y)},$2=(Y)=>{if(Y.readable)Y.destroy()};var W9=(Y,Z,Q)=>{let X=new Map;for(let[J,{stdioItems:$,direction:G}]of Object.entries(Z)){for(let{stream:K}of $.filter(({type:H})=>x0.has(H)))zB(Y,K,G,J);for(let{stream:K}of $.filter(({type:H})=>!x0.has(H)))UB({subprocess:Y,stream:K,direction:G,fdNumber:J,pipeGroups:X,controller:Q})}for(let[J,$]of X.entries()){let G=$.length===1?$[0]:pY($);j6(G,J)}},zB=(Y,Z,Q,X)=>{if(Q==="output")j6(Y.stdio[X],Z);else j6(Z,Y.stdio[X]);let J=WB[X];if(J!==void 0)Y[J]=Z;Y.stdio[X]=Z},WB=["stdin","stdout","stderr"],UB=({subprocess:Y,stream:Z,direction:Q,fdNumber:X,pipeGroups:J,controller:$})=>{if(Z===void 0)return;qB(Z,$);let[G,K]=Q==="output"?[Z,Y.stdio[X]]:[Y.stdio[X],Z],H=J.get(G)??[];J.set(G,[...H,K])},qB=(Y,{signal:Z})=>{if(y0(Y))gY(Y,VB,Z)},VB=2;import{addAbortListener as RB}from"node:events";var cY=[];cY.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")cY.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")cY.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var p4=(Y)=>!!Y&&typeof Y==="object"&&typeof Y.removeListener==="function"&&typeof Y.emit==="function"&&typeof Y.reallyExit==="function"&&typeof Y.listeners==="function"&&typeof Y.kill==="function"&&typeof Y.pid==="number"&&typeof Y.on==="function",G2=Symbol.for("signal-exit emitter"),K2=globalThis,BB=Object.defineProperty.bind(Object);class U9{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(K2[G2])return K2[G2];BB(K2,G2,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(Y,Z){this.listeners[Y].push(Z)}removeListener(Y,Z){let Q=this.listeners[Y],X=Q.indexOf(Z);if(X===-1)return;if(X===0&&Q.length===1)Q.length=0;else Q.splice(X,1)}emit(Y,Z,Q){if(this.emitted[Y])return!1;this.emitted[Y]=!0;let X=!1;for(let J of this.listeners[Y])X=J(Z,Q)===!0||X;if(Y==="exit")X=this.emit("afterExit",Z,Q)||X;return X}}class z2{}var FB=(Y)=>{return{onExit(Z,Q){return Y.onExit(Z,Q)},load(){return Y.load()},unload(){return Y.unload()}}};class q9 extends z2{onExit(){return()=>{}}load(){}unload(){}}class V9 extends z2{#Z=H2.platform==="win32"?"SIGINT":"SIGHUP";#Q=new U9;#Y;#X;#J;#$={};#G=!1;constructor(Y){super();this.#Y=Y,this.#$={};for(let Z of cY)this.#$[Z]=()=>{let Q=this.#Y.listeners(Z),{count:X}=this.#Q,J=Y;if(typeof J.__signal_exit_emitter__==="object"&&typeof J.__signal_exit_emitter__.count==="number")X+=J.__signal_exit_emitter__.count;if(Q.length===X){this.unload();let $=this.#Q.emit("exit",null,Z),G=Z==="SIGHUP"?this.#Z:Z;if(!$)Y.kill(Y.pid,G)}};this.#J=Y.reallyExit,this.#X=Y.emit}onExit(Y,Z){if(!p4(this.#Y))return()=>{};if(this.#G===!1)this.load();let Q=Z?.alwaysLast?"afterExit":"exit";return this.#Q.on(Q,Y),()=>{if(this.#Q.removeListener(Q,Y),this.#Q.listeners.exit.length===0&&this.#Q.listeners.afterExit.length===0)this.unload()}}load(){if(this.#G)return;this.#G=!0,this.#Q.count+=1;for(let Y of cY)try{let Z=this.#$[Y];if(Z)this.#Y.on(Y,Z)}catch(Z){}this.#Y.emit=(Y,...Z)=>{return this.#H(Y,...Z)},this.#Y.reallyExit=(Y)=>{return this.#K(Y)}}unload(){if(!this.#G)return;this.#G=!1,cY.forEach((Y)=>{let Z=this.#$[Y];if(!Z)throw Error("Listener not defined for signal: "+Y);try{this.#Y.removeListener(Y,Z)}catch(Q){}}),this.#Y.emit=this.#X,this.#Y.reallyExit=this.#J,this.#Q.count-=1}#K(Y){if(!p4(this.#Y))return 0;return this.#Y.exitCode=Y||0,this.#Q.emit("exit",this.#Y.exitCode,null),this.#J.call(this.#Y,this.#Y.exitCode)}#H(Y,...Z){let Q=this.#X;if(Y==="exit"&&p4(this.#Y)){if(typeof Z[0]==="number")this.#Y.exitCode=Z[0];let X=Q.call(this.#Y,Y,...Z);return this.#Q.emit("exit",this.#Y.exitCode,null),X}else return Q.call(this.#Y,Y,...Z)}}var H2=globalThis.process,{onExit:B9,load:GE,unload:KE}=FB(p4(H2)?new V9(H2):new q9);var F9=(Y,{cleanup:Z,detached:Q},{signal:X})=>{if(!Z||Q)return;let J=B9(()=>{Y.kill()});RB(X,()=>{J()})};var M9=({source:Y,sourcePromise:Z,boundOptions:Q,createNested:X},...J)=>{let $=e8(),{destination:G,destinationStream:K,destinationError:H,from:W,unpipeSignal:z}=MB(Q,X,J),{sourceStream:q,sourceError:V}=LB(Y,W),{options:R,fileDescriptors:B}=d0.get(Y);return{sourcePromise:Z,sourceStream:q,sourceOptions:R,sourceError:V,destination:G,destinationStream:K,destinationError:H,unpipeSignal:z,fileDescriptors:B,startTime:$}},MB=(Y,Z,Q)=>{try{let{destination:X,pipeOptions:{from:J,to:$,unpipeSignal:G}={}}=DB(Y,Z,...Q),K=W4(X,$);return{destination:X,destinationStream:K,from:J,unpipeSignal:G}}catch(X){return{destinationError:X}}},DB=(Y,Z,Q,...X)=>{if(Array.isArray(Q))return{destination:Z(R9,Y)(Q,...X),pipeOptions:Y};if(typeof Q==="string"||Q instanceof URL||Z7(Q)){if(Object.keys(Y).length>0)throw TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[J,$,G]=p8(Q,...X);return{destination:Z(R9)(J,$,G),pipeOptions:G}}if(d0.has(Q)){if(Object.keys(Y).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:Q,pipeOptions:X[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${Q}`)},R9=({options:Y})=>({options:{...Y,stdin:"pipe",piped:!0}}),LB=(Y,Z)=>{try{return{sourceStream:P6(Y,Z)}}catch(Q){return{sourceError:Q}}};var L9=({sourceStream:Y,sourceError:Z,destinationStream:Q,destinationError:X,fileDescriptors:J,sourceOptions:$,startTime:G})=>{let K=TB({sourceStream:Y,sourceError:Z,destinationStream:Q,destinationError:X});if(K!==void 0)throw W2({error:K,fileDescriptors:J,sourceOptions:$,startTime:G})},TB=({sourceStream:Y,sourceError:Z,destinationStream:Q,destinationError:X})=>{if(Z!==void 0&&X!==void 0)return X;if(X!==void 0)return $2(Y),X;if(Z!==void 0)return J2(Q),Z},W2=({error:Y,fileDescriptors:Z,sourceOptions:Q,startTime:X})=>k6({error:Y,command:D9,escapedCommand:D9,fileDescriptors:Z,options:Q,startTime:X,isSync:!1}),D9="source.pipe(destination)";var T9=async(Y)=>{let[{status:Z,reason:Q,value:X=Q},{status:J,reason:$,value:G=$}]=await Y;if(!G.pipedFrom.includes(X))G.pipedFrom.push(X);if(J==="rejected")throw G;if(Z==="rejected")throw X;return G};import{finished as _B}from"node:stream/promises";var _9=(Y,Z,Q)=>{let X=c4.has(Z)?NB(Y,Z):wB(Y,Z);return gY(Y,PB,Q.signal),gY(Z,EB,Q.signal),OB(Z),X},wB=(Y,Z)=>{let Q=pY([Y]);return j6(Q,Z),c4.set(Z,Q),Q},NB=(Y,Z)=>{let Q=c4.get(Z);return Q.add(Y),Q},OB=async(Y)=>{try{await _B(Y,{cleanup:!0,readable:!1,writable:!0})}catch{}c4.delete(Y)},c4=new WeakMap,PB=2,EB=1;import{aborted as CB}from"node:util";var w9=(Y,Z)=>Y===void 0?[]:[kB(Y,Z)],kB=async(Y,{sourceStream:Z,mergedStream:Q,fileDescriptors:X,sourceOptions:J,startTime:$})=>{await CB(Y,Z),await Q.remove(Z);let G=Error("Pipe canceled by `unpipeSignal` option.");throw W2({error:G,fileDescriptors:X,sourceOptions:J,startTime:$})};var l4=(Y,...Z)=>{if(e(Z[0]))return l4.bind(void 0,{...Y,boundOptions:{...Y.boundOptions,...Z[0]}});let{destination:Q,...X}=M9(Y,...Z),J=AB({...X,destination:Q});return J.pipe=l4.bind(void 0,{...Y,source:Q,sourcePromise:J,boundOptions:{}}),J},AB=async({sourcePromise:Y,sourceStream:Z,sourceOptions:Q,sourceError:X,destination:J,destinationStream:$,destinationError:G,unpipeSignal:K,fileDescriptors:H,startTime:W})=>{let z=IB(Y,J);L9({sourceStream:Z,sourceError:X,destinationStream:$,destinationError:G,fileDescriptors:H,sourceOptions:Q,startTime:W});let q=new AbortController;try{let V=_9(Z,$,q);return await Promise.race([T9(z),...w9(K,{sourceStream:Z,mergedStream:V,sourceOptions:Q,fileDescriptors:H,startTime:W})])}finally{q.abort()}},IB=(Y,Z)=>Promise.allSettled([Y,Z]);import{setImmediate as hB}from"node:timers/promises";import{on as jB}from"node:events";import{getDefaultHighWaterMark as xB}from"node:stream";var i4=({subprocessStdout:Y,subprocess:Z,binary:Q,shouldEncode:X,encoding:J,preserveNewlines:$})=>{let G=new AbortController;return SB(Z,G),O9({stream:Y,controller:G,binary:Q,shouldEncode:!Y.readableObjectMode&&X,encoding:J,shouldSplit:!Y.readableObjectMode,preserveNewlines:$})},SB=async(Y,Z)=>{try{await Y}catch{}finally{Z.abort()}},U2=({stream:Y,onStreamEnd:Z,lines:Q,encoding:X,stripFinalNewline:J,allMixed:$})=>{let G=new AbortController;yB(Z,G,Y);let K=Y.readableObjectMode&&!$;return O9({stream:Y,controller:G,binary:X==="buffer",shouldEncode:!K,encoding:X,shouldSplit:!K&&Q,preserveNewlines:!J})},yB=async(Y,Z,Q)=>{try{await Y}catch{Q.destroy()}finally{Z.abort()}},O9=({stream:Y,controller:Z,binary:Q,shouldEncode:X,encoding:J,shouldSplit:$,preserveNewlines:G})=>{let K=jB(Y,"data",{signal:Z.signal,highWaterMark:N9,highWatermark:N9});return vB({onStdoutChunk:K,controller:Z,binary:Q,shouldEncode:X,encoding:J,shouldSplit:$,preserveNewlines:G})},q2=xB(!0),N9=q2,vB=async function*({onStdoutChunk:Y,controller:Z,binary:Q,shouldEncode:X,encoding:J,shouldSplit:$,preserveNewlines:G}){let K=fB({binary:Q,shouldEncode:X,encoding:J,shouldSplit:$,preserveNewlines:G});try{for await(let[H]of Y)yield*dY(H,K,0)}catch(H){if(!Z.signal.aborted)throw H}finally{yield*O1(K)}},fB=({binary:Y,shouldEncode:Z,encoding:Q,shouldSplit:X,preserveNewlines:J})=>[h4(Y,Q,!Z),f4(Y,J,!X,{})].filter(Boolean);var P9=async({stream:Y,onStreamEnd:Z,fdNumber:Q,encoding:X,buffer:J,maxBuffer:$,lines:G,allMixed:K,stripFinalNewline:H,verboseInfo:W,streamInfo:z})=>{let q=bB({stream:Y,onStreamEnd:Z,fdNumber:Q,encoding:X,allMixed:K,verboseInfo:W,streamInfo:z});if(!J){await Promise.all([gB(Y),q]);return}let V=i7(H,Q),R=U2({stream:Y,onStreamEnd:Z,lines:G,encoding:X,stripFinalNewline:V,allMixed:K}),[B]=await Promise.all([mB({stream:Y,iterable:R,fdNumber:Q,encoding:X,maxBuffer:$,lines:G}),q]);return B},bB=async({stream:Y,onStreamEnd:Z,fdNumber:Q,encoding:X,allMixed:J,verboseInfo:$,streamInfo:{fileDescriptors:G}})=>{if(!m4({stdioItems:G[Q]?.stdioItems,encoding:X,verboseInfo:$,fdNumber:Q}))return;let K=U2({stream:Y,onStreamEnd:Z,lines:!0,encoding:X,stripFinalNewline:!0,allMixed:J});await xJ(K,Y,Q,$)},gB=async(Y)=>{if(await hB(),Y.readableFlowing===null)Y.resume()},mB=async({stream:Y,stream:{readableObjectMode:Z},iterable:Q,fdNumber:X,encoding:J,maxBuffer:$,lines:G})=>{try{if(Z||G)return await E4(Q,{maxBuffer:$});if(J==="buffer")return new Uint8Array(await C4(Q,{maxBuffer:$}));return await A4(Q,{maxBuffer:$})}catch(K){return E9(xX({error:K,stream:Y,readableObjectMode:Z,lines:G,encoding:J,fdNumber:X}))}},V2=async(Y)=>{try{return await Y}catch(Z){return E9(Z)}},E9=({bufferedData:Y})=>a5(Y)?new Uint8Array(Y):Y;import{finished as uB}from"node:stream/promises";var k1=async(Y,Z,Q,{isSameDirection:X,stopOnExit:J=!1}={})=>{let $=dB(Y,Q),G=new AbortController;try{await Promise.race([...J?[Q.exitPromise]:[],uB(Y,{cleanup:!0,signal:G.signal})])}catch(K){if(!$.stdinCleanedUp)lB(K,Z,Q,X)}finally{G.abort()}},dB=(Y,{originalStreams:[Z],subprocess:Q})=>{let X={stdinCleanedUp:!1};if(Y===Z)pB(Y,Q,X);return X},pB=(Y,Z,Q)=>{let{_destroy:X}=Y;Y._destroy=(...J)=>{cB(Z,Q),X.call(Y,...J)}},cB=({exitCode:Y,signalCode:Z},Q)=>{if(Y!==null||Z!==null)Q.stdinCleanedUp=!0},lB=(Y,Z,Q,X)=>{if(!iB(Y,Z,Q,X))throw Y},iB=(Y,Z,Q,X=!0)=>{if(Q.propagating)return C9(Y)||n4(Y);return Q.propagating=!0,B2(Q,Z)===X?C9(Y):n4(Y)},B2=({fileDescriptors:Y},Z)=>Z!=="all"&&Y[Z].direction==="input",n4=(Y)=>Y?.code==="ERR_STREAM_PREMATURE_CLOSE",C9=(Y)=>Y?.code==="EPIPE";var k9=({subprocess:Y,encoding:Z,buffer:Q,maxBuffer:X,lines:J,stripFinalNewline:$,verboseInfo:G,streamInfo:K})=>Y.stdio.map((H,W)=>F2({stream:H,fdNumber:W,encoding:Z,buffer:Q[W],maxBuffer:X[W],lines:J[W],allMixed:!1,stripFinalNewline:$,verboseInfo:G,streamInfo:K})),F2=async({stream:Y,fdNumber:Z,encoding:Q,buffer:X,maxBuffer:J,lines:$,allMixed:G,stripFinalNewline:K,verboseInfo:H,streamInfo:W})=>{if(!Y)return;let z=k1(Y,Z,W);if(B2(W,Z)){await z;return}let[q]=await Promise.all([P9({stream:Y,onStreamEnd:z,fdNumber:Z,encoding:Q,buffer:X,maxBuffer:J,lines:$,allMixed:G,stripFinalNewline:K,verboseInfo:H,streamInfo:W}),z]);return q};var A9=({stdout:Y,stderr:Z},{all:Q})=>Q&&(Y||Z)?pY([Y,Z].filter(Boolean)):void 0,I9=({subprocess:Y,encoding:Z,buffer:Q,maxBuffer:X,lines:J,stripFinalNewline:$,verboseInfo:G,streamInfo:K})=>F2({...nB(Y,Q),fdNumber:"all",encoding:Z,maxBuffer:X[1]+X[2],lines:J[1]||J[2],allMixed:aB(Y),stripFinalNewline:$,verboseInfo:G,streamInfo:K}),nB=({stdout:Y,stderr:Z,all:Q},[,X,J])=>{let $=X||J;if(!$)return{stream:Q,buffer:$};if(!X)return{stream:Z,buffer:$};if(!J)return{stream:Y,buffer:$};return{stream:Q,buffer:$}},aB=({all:Y,stdout:Z,stderr:Q})=>Y&&Z&&Q&&Z.readableObjectMode!==Q.readableObjectMode;import{once as oB}from"node:events";var j9=(Y)=>T6(Y,"ipc"),x9=(Y,Z)=>{let Q=r8(Y);g0({type:"ipc",verboseMessage:Q,fdNumber:"ipc",verboseInfo:Z})};var S9=async({subprocess:Y,buffer:Z,maxBuffer:Q,ipc:X,ipcOutput:J,verboseInfo:$})=>{if(!X)return J;let G=j9($),K=e0(Z,"ipc"),H=e0(Q,"ipc");for await(let W of Z2({anyProcess:Y,channel:Y.channel,isSubprocess:!1,ipc:X,shouldAwait:!1,reference:!0})){if(K)SX(Y,J,H),J.push(W);if(G)x9(W,$)}return J},y9=async(Y,Z)=>{return await Promise.allSettled([Y]),Z};var v9=async({subprocess:Y,options:{encoding:Z,buffer:Q,maxBuffer:X,lines:J,timeoutDuration:$,cancelSignal:G,gracefulCancel:K,forceKillAfterDelay:H,stripFinalNewline:W,ipc:z,ipcInput:q},context:V,verboseInfo:R,fileDescriptors:B,originalStreams:M,onInternalError:T,controller:D})=>{let _=hJ(Y,V),w={originalStreams:M,fileDescriptors:B,subprocess:Y,exitPromise:_,propagating:!1},N=k9({subprocess:Y,encoding:Z,buffer:Q,maxBuffer:X,lines:J,stripFinalNewline:W,verboseInfo:R,streamInfo:w}),j=I9({subprocess:Y,encoding:Z,buffer:Q,maxBuffer:X,lines:J,stripFinalNewline:W,verboseInfo:R,streamInfo:w}),x=[],f=S9({subprocess:Y,buffer:Q,maxBuffer:X,ipc:z,ipcOutput:x,verboseInfo:R}),m=sB(M,Y,w),b=tB(B,w);try{return await Promise.race([Promise.all([{},gJ(_),Promise.all(N),j,f,WX(Y,q),...m,...b]),T,rB(Y,D),...$X(Y,$,V,D),...EQ({subprocess:Y,cancelSignal:G,gracefulCancel:K,context:V,controller:D}),...XX({subprocess:Y,cancelSignal:G,gracefulCancel:K,forceKillAfterDelay:H,context:V,controller:D})])}catch(v){return V.terminationReason??="other",Promise.all([{error:v},_,Promise.all(N.map((d)=>V2(d))),V2(j),y9(f,x),Promise.allSettled(m),Promise.allSettled(b)])}},sB=(Y,Z,Q)=>Y.map((X,J)=>X===Z.stdio[J]?void 0:k1(X,J,Q)),tB=(Y,Z)=>Y.flatMap(({stdioItems:Q},X)=>Q.filter(({value:J,stream:$=J})=>f0($,{checkOpen:!1})&&!y0($)).map(({type:J,value:$,stream:G=$})=>k1(G,X,Z,{isSameDirection:x0.has(J),stopOnExit:J==="native"}))),rB=async(Y,{signal:Z})=>{let[Q]=await oB(Y,"error",{signal:Z});throw Q};var f9=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),A1=(Y,Z,Q)=>{let X=Y[Q];if(!X.has(Z))X.set(Z,[]);let J=X.get(Z),$=u0();return J.push($),{resolve:$.resolve.bind($),promises:J}},x6=async({resolve:Y,promises:Z},Q)=>{Y();let[X]=await Promise.race([Promise.allSettled([!0,Q]),Promise.all([!1,...Z])]);return!X};import{Readable as eB}from"node:stream";import{callbackify as YF}from"node:util";import{finished as h9}from"node:stream/promises";var R2=async(Y)=>{if(Y===void 0)return;try{await M2(Y)}catch{}},b9=async(Y)=>{if(Y===void 0)return;try{await D2(Y)}catch{}},M2=async(Y)=>{await h9(Y,{cleanup:!0,readable:!1,writable:!0})},D2=async(Y)=>{await h9(Y,{cleanup:!0,readable:!0,writable:!1})},a4=async(Y,Z)=>{if(await Y,Z)throw Z},o4=(Y,Z,Q)=>{if(Q&&!n4(Q))Y.destroy(Q);else if(Z)Y.destroy()};var g9=({subprocess:Y,concurrentStreams:Z,encoding:Q},{from:X,binary:J=!0,preserveNewlines:$=!0}={})=>{let G=J||O0.has(Q),{subprocessStdout:K,waitReadableDestroy:H}=L2(Y,X,Z),{readableEncoding:W,readableObjectMode:z,readableHighWaterMark:q}=T2(K,G),{read:V,onStdoutDataDone:R}=_2({subprocessStdout:K,subprocess:Y,binary:G,encoding:Q,preserveNewlines:$}),B=new eB({read:V,destroy:YF(N2.bind(void 0,{subprocessStdout:K,subprocess:Y,waitReadableDestroy:H})),highWaterMark:q,objectMode:z,encoding:W});return w2({subprocessStdout:K,onStdoutDataDone:R,readable:B,subprocess:Y}),B},L2=(Y,Z,Q)=>{let X=P6(Y,Z),J=A1(Q,X,"readableDestroy");return{subprocessStdout:X,waitReadableDestroy:J}},T2=({readableEncoding:Y,readableObjectMode:Z,readableHighWaterMark:Q},X)=>X?{readableEncoding:Y,readableObjectMode:Z,readableHighWaterMark:Q}:{readableEncoding:Y,readableObjectMode:!0,readableHighWaterMark:q2},_2=({subprocessStdout:Y,subprocess:Z,binary:Q,encoding:X,preserveNewlines:J})=>{let $=u0(),G=i4({subprocessStdout:Y,subprocess:Z,binary:Q,shouldEncode:!Q,encoding:X,preserveNewlines:J});return{read(){ZF(this,G,$)},onStdoutDataDone:$}},ZF=async(Y,Z,Q)=>{try{let{value:X,done:J}=await Z.next();if(J)Q.resolve();else Y.push(X)}catch{}},w2=async({subprocessStdout:Y,onStdoutDataDone:Z,readable:Q,subprocess:X,subprocessStdin:J})=>{try{if(await D2(Y),await X,await R2(J),await Z,Q.readable)Q.push(null)}catch($){await R2(J),m9(Q,$)}},N2=async({subprocessStdout:Y,subprocess:Z,waitReadableDestroy:Q},X)=>{if(await x6(Q,Z))m9(Y,X),await a4(Z,X)},m9=(Y,Z)=>{o4(Y,Y.readable,Z)};import{Writable as QF}from"node:stream";import{callbackify as u9}from"node:util";var d9=({subprocess:Y,concurrentStreams:Z},{to:Q}={})=>{let{subprocessStdin:X,waitWritableFinal:J,waitWritableDestroy:$}=O2(Y,Q,Z),G=new QF({...P2(X,Y,J),destroy:u9(C2.bind(void 0,{subprocessStdin:X,subprocess:Y,waitWritableFinal:J,waitWritableDestroy:$})),highWaterMark:X.writableHighWaterMark,objectMode:X.writableObjectMode});return E2(X,G),G},O2=(Y,Z,Q)=>{let X=W4(Y,Z),J=A1(Q,X,"writableFinal"),$=A1(Q,X,"writableDestroy");return{subprocessStdin:X,waitWritableFinal:J,waitWritableDestroy:$}},P2=(Y,Z,Q)=>({write:XF.bind(void 0,Y),final:u9(JF.bind(void 0,Y,Z,Q))}),XF=(Y,Z,Q,X)=>{if(Y.write(Z,Q))X();else Y.once("drain",X)},JF=async(Y,Z,Q)=>{if(await x6(Q,Z)){if(Y.writable)Y.end();await Z}},E2=async(Y,Z,Q)=>{try{if(await M2(Y),Z.writable)Z.end()}catch(X){await b9(Q),p9(Z,X)}},C2=async({subprocessStdin:Y,subprocess:Z,waitWritableFinal:Q,waitWritableDestroy:X},J)=>{if(await x6(Q,Z),await x6(X,Z))p9(Y,J),await a4(Z,J)},p9=(Y,Z)=>{o4(Y,Y.writable,Z)};import{Duplex as $F}from"node:stream";import{callbackify as GF}from"node:util";var c9=({subprocess:Y,concurrentStreams:Z,encoding:Q},{from:X,to:J,binary:$=!0,preserveNewlines:G=!0}={})=>{let K=$||O0.has(Q),{subprocessStdout:H,waitReadableDestroy:W}=L2(Y,X,Z),{subprocessStdin:z,waitWritableFinal:q,waitWritableDestroy:V}=O2(Y,J,Z),{readableEncoding:R,readableObjectMode:B,readableHighWaterMark:M}=T2(H,K),{read:T,onStdoutDataDone:D}=_2({subprocessStdout:H,subprocess:Y,binary:K,encoding:Q,preserveNewlines:G}),_=new $F({read:T,...P2(z,Y,q),destroy:GF(KF.bind(void 0,{subprocessStdout:H,subprocessStdin:z,subprocess:Y,waitReadableDestroy:W,waitWritableFinal:q,waitWritableDestroy:V})),readableHighWaterMark:M,writableHighWaterMark:z.writableHighWaterMark,readableObjectMode:B,writableObjectMode:z.writableObjectMode,encoding:R});return w2({subprocessStdout:H,onStdoutDataDone:D,readable:_,subprocess:Y,subprocessStdin:z}),E2(z,_,H),_},KF=async({subprocessStdout:Y,subprocessStdin:Z,subprocess:Q,waitReadableDestroy:X,waitWritableFinal:J,waitWritableDestroy:$},G)=>{await Promise.all([N2({subprocessStdout:Y,subprocess:Q,waitReadableDestroy:X},G),C2({subprocessStdin:Z,subprocess:Q,waitWritableFinal:J,waitWritableDestroy:$},G)])};var k2=(Y,Z,{from:Q,binary:X=!1,preserveNewlines:J=!1}={})=>{let $=X||O0.has(Z),G=P6(Y,Q),K=i4({subprocessStdout:G,subprocess:Y,binary:$,shouldEncode:!0,encoding:Z,preserveNewlines:J});return HF(K,G,Y)},HF=async function*(Y,Z,Q){try{yield*Y}finally{if(Z.readable)Z.destroy();await Q}};var l9=(Y,{encoding:Z})=>{let Q=f9();Y.readable=g9.bind(void 0,{subprocess:Y,concurrentStreams:Q,encoding:Z}),Y.writable=d9.bind(void 0,{subprocess:Y,concurrentStreams:Q}),Y.duplex=c9.bind(void 0,{subprocess:Y,concurrentStreams:Q,encoding:Z}),Y.iterable=k2.bind(void 0,Y,Z),Y[Symbol.asyncIterator]=k2.bind(void 0,Y,Z,{})};var i9=(Y,Z)=>{for(let[Q,X]of WF){let J=X.value.bind(Z);Reflect.defineProperty(Y,Q,{...X,value:J})}},zF=(async()=>{})().constructor.prototype,WF=["then","catch","finally"].map((Y)=>[Y,Reflect.getOwnPropertyDescriptor(zF,Y)]);var n9=(Y,Z,Q,X)=>{let{file:J,commandArguments:$,command:G,escapedCommand:K,startTime:H,verboseInfo:W,options:z,fileDescriptors:q}=VF(Y,Z,Q),{subprocess:V,promise:R}=FF({file:J,commandArguments:$,options:z,startTime:H,verboseInfo:W,command:G,escapedCommand:K,fileDescriptors:q});return V.pipe=l4.bind(void 0,{source:V,sourcePromise:R,boundOptions:{},createNested:X}),i9(V,R),d0.set(V,{options:z,fileDescriptors:q}),V},VF=(Y,Z,Q)=>{let{command:X,escapedCommand:J,startTime:$,verboseInfo:G}=Y4(Y,Z,Q),{file:K,commandArguments:H,options:W}=_4(Y,Z,Q),z=BF(W),q=Y9(z,G);return{file:K,commandArguments:H,command:X,escapedCommand:J,startTime:$,verboseInfo:G,options:z,fileDescriptors:q}},BF=({timeout:Y,signal:Z,...Q})=>{if(Z!==void 0)throw TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...Q,timeoutDuration:Y}},FF=({file:Y,commandArguments:Z,options:Q,startTime:X,verboseInfo:J,command:$,escapedCommand:G,fileDescriptors:K})=>{let H;try{H=qF(...w4(Y,Z,Q))}catch(B){return sJ({error:B,command:$,escapedCommand:G,fileDescriptors:K,options:Q,startTime:X,verboseInfo:J})}let W=new AbortController;UF(Number.POSITIVE_INFINITY,W.signal);let z=[...H.stdio];W9(H,K,W),F9(H,Q,W);let q={},V=u0();H.kill=OQ.bind(void 0,{kill:H.kill.bind(H),options:Q,onInternalError:V,context:q,controller:W}),H.all=A9(H,Q),l9(H,Q),nJ(H,Q);let R=RF({subprocess:H,options:Q,startTime:X,verboseInfo:J,fileDescriptors:K,originalStreams:z,command:$,escapedCommand:G,context:q,onInternalError:V,controller:W});return{subprocess:H,promise:R}},RF=async({subprocess:Y,options:Z,startTime:Q,verboseInfo:X,fileDescriptors:J,originalStreams:$,command:G,escapedCommand:K,context:H,onInternalError:W,controller:z})=>{let[q,[V,R],B,M,T]=await v9({subprocess:Y,options:Z,context:H,verboseInfo:X,fileDescriptors:J,originalStreams:$,onInternalError:W,controller:z});z.abort(),W.resolve();let D=B.map((N,j)=>QY(N,Z,j)),_=QY(M,Z,"all"),w=MF({errorInfo:q,exitCode:V,signal:R,stdio:D,all:_,ipcOutput:T,context:H,options:Z,command:G,escapedCommand:K,startTime:Q});return A6(w,X,Z)},MF=({errorInfo:Y,exitCode:Z,signal:Q,stdio:X,all:J,ipcOutput:$,context:G,options:K,command:H,escapedCommand:W,startTime:z})=>("error"in Y)?N1({error:Y.error,command:H,escapedCommand:W,timedOut:G.terminationReason==="timeout",isCanceled:G.terminationReason==="cancel"||G.terminationReason==="gracefulCancel",isGracefullyCanceled:G.terminationReason==="gracefulCancel",isMaxBuffer:Y.error instanceof YY,isForcefullyTerminated:G.isForcefullyTerminated,exitCode:Z,signal:Q,stdio:X,all:J,ipcOutput:$,options:K,startTime:z,isSync:!1}):j4({command:H,escapedCommand:W,stdio:X,all:J,ipcOutput:$,options:K,startTime:z});var s4=(Y,Z)=>{let Q=Object.fromEntries(Object.entries(Z).map(([X,J])=>[X,DF(X,Y[X],J)]));return{...Y,...Q}},DF=(Y,Z,Q)=>{if(LF.has(Y)&&e(Z)&&e(Q))return{...Z,...Q};return Q},LF=new Set(["env",...K7]);var RY=(Y,Z,Q,X)=>{let J=(G,K,H)=>RY(G,K,Q,H),$=(...G)=>TF({mapArguments:Y,deepOptions:Q,boundOptions:Z,setBoundExeca:X,createNested:J},...G);if(X!==void 0)X($,J,Z);return $},TF=({mapArguments:Y,deepOptions:Z={},boundOptions:Q={},setBoundExeca:X,createNested:J},$,...G)=>{if(e($))return J(Y,s4(Q,$),X);let{file:K,commandArguments:H,options:W,isSync:z}=_F({mapArguments:Y,firstArgument:$,nextArguments:G,deepOptions:Z,boundOptions:Q});return z?uJ(K,H,W):n9(K,H,W,J)},_F=({mapArguments:Y,firstArgument:Z,nextArguments:Q,deepOptions:X,boundOptions:J})=>{let $=Y3(Z)?Z3(Z,Q):[Z,...Q],[G,K,H]=p8(...$),W=s4(s4(X,J),H),{file:z=G,commandArguments:q=K,options:V=W,isSync:R=!1}=Y({file:G,commandArguments:K,options:W});return{file:z,commandArguments:q,options:V,isSync:R}};var a9=({file:Y,commandArguments:Z})=>s9(Y,Z),o9=({file:Y,commandArguments:Z})=>({...s9(Y,Z),isSync:!0}),s9=(Y,Z)=>{if(Z.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${Y} ${Z}.`);let[Q,...X]=wF(Y);return{file:Q,commandArguments:X}},wF=(Y)=>{if(typeof Y!=="string")throw TypeError(`The command must be a string: ${String(Y)}.`);let Z=Y.trim();if(Z==="")return[];let Q=[];for(let X of Z.split(NF)){let J=Q.at(-1);if(J&&J.endsWith("\\"))Q[Q.length-1]=`${J.slice(0,-1)} ${X}`;else Q.push(X)}return Q},NF=/ +/g;var t9=(Y,Z,Q)=>{Y.sync=Z(OF,Q),Y.s=Y.sync},r9=({options:Y})=>e9(Y),OF=({options:Y})=>({...e9(Y),isSync:!0}),e9=(Y)=>({options:{...PF(Y),...Y}}),PF=({input:Y,inputFile:Z,stdio:Q})=>Y===void 0&&Z===void 0&&Q===void 0?{stdin:"inherit"}:{},Y$={preferLocal:!0};var c0=RY(()=>({})),sk=RY(()=>({isSync:!0})),tk=RY(a9),rk=RY(o9),ek=RY(KX),h=RY(r9,{},Y$,t9),{sendMessage:YA,getOneMessage:ZA,getEachMessage:QA,getCancelSignal:XA}=aJ();Y0();Y0();import QZ from"path";import L$ from"os";var j2={name:"gdx",version:"0.2.0",description:"Git, but with better DX. The raw power of Git, aligned with human workflows.",homepage:"https://github.com/Type-Delta/gdx#readme",bugs:{url:"https://github.com/Type-Delta/gdx/issues"},repository:{type:"git",url:"git+https://github.com/Type-Delta/gdx.git"},keywords:["git","dx","cli-wrapper"],license:"MIT",author:"Type-Delta",type:"module",main:"dist/index.js",bin:{gdx:"scripts/launcher.cjs"},files:["dist/","scripts/postinstall.cjs","scripts/launcher.cjs","README.md","LICENSE"],scripts:{"prepare-dev":"bun i && bun run transpile-esm",start:"bun run src/index.ts","start:profile":"bun --cpu-prof src/index.ts","start:node":"tsx src/index.ts","transpile-esm":"bunx tsc -p lib/tsconfig.json && bun run scripts/transform-tools.mjs",lint:"bun run ts-check && eslint src --ext .ts -c eslint.config.ts --fix",build:"bun run transpile-esm && bun build ./src/index.ts --outfile=./bin/gdx --compile --bytecode --production --keep-names","ts-check":"bunx tsc --noEmit","package:node":"bun run transpile-esm && bun build ./src/index.ts --outdir=./dist --target=node --external=keytar --external=cspell-lib --format=esm --production --keep-names",prepack:"bun run package:node",postinstall:"node scripts/postinstall.cjs",prettier:'prettier --write "src/**/*.ts" "test/**/*.ts" "./*.md"',"dummy-editor":"bun ./scripts/dummyEditor.mjs"},devDependencies:{"@babel/cli":"^7.28.0","@babel/core":"^7.28.0","@babel/preset-env":"^7.27.2","@babel/preset-typescript":"^7.27.1","@eslint/js":"^9.22.0","@types/chai":"^5.2.3","@typescript-eslint/eslint-plugin":"^8.13.0","@typescript-eslint/parser":"^8.13.0","bun-types":"latest",chai:"^6.2.1",eslint:"^9.22.0",jiti:"^2.6.1",tsx:"^4.21.0",prettier:"^3.6.2",typescript:"^5.8.3","typescript-eslint":"^8.50.0",dedent:"^1.7.0",execa:"^9.6.1",openai:"^6.14.0","smol-toml":"^1.5.2"},dependencies:{"cspell-lib":"^9.4.0",keytar:"^7.9.0"}};import{existsSync as l0,readFileSync as x2,writeFileSync as MY,mkdirSync as t4,mkdtempSync as xI,rmSync as S2,accessSync as U$,readdirSync as r4,appendFileSync as q$,unlinkSync as y2,constants as v2}from"fs";import{access as V$,rm as yI,rmdir as vI,mkdir as fI,readdir as hI,readlink as bI,stat as e4,link as gI,unlink as B$,writeFile as YZ,appendFile as mI,readFile as ZZ}from"fs/promises";import{constants as jF}from"fs";function k(Y,Z=`
|
|
90
|
-
|
|
82
|
+
if (condition) { yield value; }`)};var dW=F(()=>{m0()});import{Buffer as OL}from"node:buffer";import{StringDecoder as IL}from"node:string_decoder";var q7=(Y,Z,Q)=>{if(Q)return;if(Y)return{transform:EL.bind(void 0,new TextEncoder)};let J=new IL(Z);return{transform:CL.bind(void 0,J),final:jL.bind(void 0,J)}},EL=function*(Y,Z){if(OL.isBuffer(Z))yield AY(Z);else if(typeof Z==="string")yield Y.encode(Z);else yield Z},CL=function*(Y,Z){yield L0(Z)?Y.write(Z):Z},jL=function*(Y){let Z=Y.end();if(Z!=="")yield Z};var D3=F(()=>{m0()});import{callbackify as pW}from"node:util";var L3,B7=async function*(Y,Z,Q){if(Q===Z.length){yield Y;return}let{transform:J=AL}=Z[Q];for await(let X of J(Y))yield*B7(X,Z,Q+1)},cW=async function*(Y){for(let[Z,{final:Q}]of Object.entries(Y))yield*kL(Q,Number(Z),Y)},kL=async function*(Y,Z,Q){if(Y===void 0)return;for await(let J of Y())yield*B7(J,Q,Z+1)},lW,AL=function*(Y){yield Y};var iW=F(()=>{L3=pW(async(Y,Z,Q,J)=>{Z.currentIterable=Y(...Q);try{for await(let X of Z.currentIterable)J.push(X)}finally{delete Z.currentIterable}}),lW=pW(async({currentIterable:Y},Z)=>{if(Y!==void 0){await(Z?Y.throw(Z):Y.return());return}if(Z)throw Z})});var T3=(Y,Z,Q,J)=>{try{for(let X of Y(...Z))Q.push(X);J()}catch(X){J(X)}},nW=(Y,Z)=>[...Z.flatMap((Q)=>[...m6(Q,Y,0)]),...x1(Y)],m6=function*(Y,Z,Q){if(Q===Z.length){yield Y;return}let{transform:J=xL}=Z[Q];for(let X of J(Y))yield*m6(X,Z,Q+1)},x1=function*(Y){for(let[Z,{final:Q}]of Object.entries(Y))yield*PL(Q,Number(Z),Y)},PL=function*(Y,Z,Q){if(Y===void 0)return;for(let J of Y())yield*m6(J,Q,Z+1)},xL=function*(Y){yield Y};import{Transform as SL,getDefaultHighWaterMark as aW}from"node:stream";var _3=({value:Y,value:{transform:Z,final:Q,writableObjectMode:J,readableObjectMode:X},optionName:z},{encoding:G})=>{let H={},W=oW(Y,G,z),K=g6(Z),$=g6(Q),V=K?L3.bind(void 0,B7,H):T3.bind(void 0,m6),q=K||$?L3.bind(void 0,cW,H):T3.bind(void 0,x1),M=K||$?lW.bind(void 0,H):void 0;return{stream:new SL({writableObjectMode:J,writableHighWaterMark:aW(J),readableObjectMode:X,readableHighWaterMark:aW(X),transform(D,T,_){V([D,W,0],this,_)},flush(D){q([W],this,D)},destroy:M})}},F7=(Y,Z,Q,J)=>{let X=Z.filter(({type:G})=>G==="generator"),z=J?X.reverse():X;for(let{value:G,optionName:H}of z){let W=oW(G,Q,H);Y=nW(W,Y)}return Y},oW=({transform:Y,final:Z,binary:Q,writableObjectMode:J,readableObjectMode:X,preserveNewlines:z},G,H)=>{let W={};return[{transform:gW(J,H)},q7(Q,G,J),U7(Q,z,J,W),{transform:Y,final:Z},{transform:mW(X,H)},hW({binary:Q,preserveNewlines:z,readableObjectMode:X,state:W})].filter(Boolean)};var R7=F(()=>{v0();V7();dW();D3();iW()});var sW=(Y,Z)=>{for(let Q of vL(Y))yL(Y,Q,Z)},vL=(Y)=>new Set(Object.entries(Y).filter(([,{direction:Z}])=>Z==="input").map(([Z])=>Number(Z))),yL=(Y,Z,Q)=>{let{stdioItems:J}=Y[Z],X=J.filter(({contents:H})=>H!==void 0);if(X.length===0)return;if(Z!==0){let[{type:H,optionName:W}]=X;throw TypeError(`Only the \`stdin\` option, not \`${W}\`, can be ${X6[H]} with synchronous methods.`)}let G=X.map(({contents:H})=>H).map((H)=>fL(H,J));Q.input=D1(G)},fL=(Y,Z)=>{let Q=F7(Y,Z,"utf8",!0);return bL(Q),D1(Q)},bL=(Y)=>{let Z=Y.find((Q)=>typeof Q!=="string"&&!L0(Q));if(Z!==void 0)throw TypeError(`The \`stdin\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${Z}.`)};var rW=F(()=>{R7();m0();v0()});var M7=({stdioItems:Y,encoding:Z,verboseInfo:Q,fdNumber:J})=>J!=="all"&&w8(Q,J)&&!u0.has(Z)&&hL(J)&&(Y.some(({type:X,value:z})=>X==="native"&&gL.has(z))||Y.every(({type:X})=>r0.has(X))),hL=(Y)=>Y===1||Y===2,gL,tW=async(Y,Z,Q,J)=>{for await(let X of Y)if(!mL(Z))YK(X,Q,J)},eW=(Y,Z,Q)=>{for(let J of Y)YK(J,Z,Q)},mL=(Y)=>Y._readableState.pipes.length>0,YK=(Y,Z,Q)=>{let J=MZ(Y);$Y({type:"output",verboseMessage:J,fdNumber:Z,verboseInfo:Q})};var N3=F(()=>{f6();v0();O8();eY();gL=new Set(["pipe","overlapped"])});import{writeFileSync as uL,appendFileSync as dL}from"node:fs";var ZK=({fileDescriptors:Y,syncResult:{output:Z},options:Q,isMaxBuffer:J,verboseInfo:X})=>{if(Z===null)return{output:Array.from({length:3})};let z={},G=new Set([]);return{output:Z.map((W,K)=>pL({result:W,fileDescriptors:Y,fdNumber:K,state:z,outputFiles:G,isMaxBuffer:J,verboseInfo:X},Q)),...z}},pL=({result:Y,fileDescriptors:Z,fdNumber:Q,state:J,outputFiles:X,isMaxBuffer:z,verboseInfo:G},{buffer:H,encoding:W,lines:K,stripFinalNewline:$,maxBuffer:V})=>{if(Y===null)return;let q=dH(Y,z,V),M=AY(q),{stdioItems:B,objectMode:D}=Z[Q],T=cL([M],B,W,J),{serializedResult:_,finalResult:w=_}=lL({chunks:T,objectMode:D,encoding:W,lines:K,stripFinalNewline:$,fdNumber:Q});iL({serializedResult:_,fdNumber:Q,state:J,verboseInfo:G,encoding:W,stdioItems:B,objectMode:D});let I=H[Q]?w:void 0;try{if(J.error===void 0)nL(_,B,X);return I}catch(E){return J.error=E,I}},cL=(Y,Z,Q,J)=>{try{return F7(Y,Z,Q,!1)}catch(X){return J.error=X,Y}},lL=({chunks:Y,objectMode:Z,encoding:Q,lines:J,stripFinalNewline:X,fdNumber:z})=>{if(Z)return{serializedResult:Y};if(Q==="buffer")return{serializedResult:D1(Y)};let G=yX(Y,Q);if(J[z])return{serializedResult:G,finalResult:M3(G,!X[z],Z)};return{serializedResult:G}},iL=({serializedResult:Y,fdNumber:Z,state:Q,verboseInfo:J,encoding:X,stdioItems:z,objectMode:G})=>{if(!M7({stdioItems:z,encoding:X,verboseInfo:J,fdNumber:Z}))return;let H=M3(Y,!1,G);try{eW(H,Z,J)}catch(W){Q.error??=W}},nL=(Y,Z,Q)=>{for(let{path:J,append:X}of Z.filter(({type:z})=>W7.has(z))){let z=typeof J==="string"?J:J.toString();if(X||Q.has(z))dL(J,Y);else Q.add(z),uL(J,Y)}};var QK=F(()=>{N3();R7();V7();m0();v0();h6()});var JK=([,Y,Z],Q)=>{if(!Q.all)return;if(Y===void 0)return Z;if(Z===void 0)return Y;if(Array.isArray(Y))return Array.isArray(Z)?[...Y,...Z]:[...Y,fY(Z,Q,"all")];if(Array.isArray(Z))return[fY(Y,Q,"all"),...Z];if(L0(Y)&&L0(Z))return q5([Y,Z]);return`${Y}${Z}`};var XK=F(()=>{m0();P1()});import{once as w3}from"node:events";var zK=async(Y,Z)=>{let[Q,J]=await aL(Y);return Z.isForcefullyTerminated??=!1,[Q,J]},aL=async(Y)=>{let[Z,Q]=await Promise.allSettled([w3(Y,"spawn"),w3(Y,"exit")]);if(Z.status==="rejected")return[];return Q.status==="rejected"?GK(Y):Q.value},GK=async(Y)=>{try{return await w3(Y,"exit")}catch{return GK(Y)}},HK=async(Y)=>{let[Z,Q]=await Y;if(!oL(Z,Q)&&O3(Z,Q))throw new VY;return[Z,Q]},oL=(Y,Z)=>Y===void 0&&Z===void 0,O3=(Y,Z)=>Y!==0||Z!==null;var I3=F(()=>{Y6()});var WK=({error:Y,status:Z,signal:Q,output:J},{maxBuffer:X})=>{let z=sL(Y,Z,Q),G=z?.code==="ETIMEDOUT",H=uH(z,J,X);return{resultError:z,exitCode:Z,signal:Q,timedOut:G,isMaxBuffer:H}},sL=(Y,Z,Q)=>{if(Y!==void 0)return Y;return O3(Z,Q)?new VY:void 0};var KK=F(()=>{Y6();h6();I3()});import{spawnSync as rL}from"node:child_process";var $K=(Y,Z,Q)=>{let{file:J,commandArguments:X,command:z,escapedCommand:G,startTime:H,verboseInfo:W,options:K,fileDescriptors:$}=tL(Y,Z,Q),V=ZT({file:J,commandArguments:X,options:K,command:z,escapedCommand:G,verboseInfo:W,fileDescriptors:$,startTime:H});return v8(V,W,K)},tL=(Y,Z,Q)=>{let{command:J,escapedCommand:X,startTime:z,verboseInfo:G}=TZ(Y,Z,Q),H=eL(Q),{file:W,commandArguments:K,options:$}=nZ(Y,Z,H);YT($);let V=SW($,G);return{file:W,commandArguments:K,command:J,escapedCommand:X,startTime:z,verboseInfo:G,options:$,fileDescriptors:V}},eL=(Y)=>Y.node&&!Y.ipc?{...Y,ipc:!1}:Y,YT=({ipc:Y,ipcInput:Z,detached:Q,cancelSignal:J})=>{if(Z)D7("ipcInput");if(Y)D7("ipc: true");if(Q)D7("detached: true");if(J)D7("cancelSignal")},D7=(Y)=>{throw TypeError(`The "${Y}" option cannot be used with synchronous methods.`)},ZT=({file:Y,commandArguments:Z,options:Q,command:J,escapedCommand:X,verboseInfo:z,fileDescriptors:G,startTime:H})=>{let W=QT({file:Y,commandArguments:Z,options:Q,command:J,escapedCommand:X,fileDescriptors:G,startTime:H});if(W.failed)return W;let{resultError:K,exitCode:$,signal:V,timedOut:q,isMaxBuffer:M}=WK(W,Q),{output:B,error:D=K}=ZK({fileDescriptors:G,syncResult:W,options:Q,isMaxBuffer:M,verboseInfo:z}),T=B.map((w,I)=>fY(w,Q,I)),_=fY(JK(B,Q),Q,"all");return XT({error:D,exitCode:$,signal:V,timedOut:q,isMaxBuffer:M,stdio:T,all:_,options:Q,command:J,escapedCommand:X,startTime:H})},QT=({file:Y,commandArguments:Z,options:Q,command:J,escapedCommand:X,fileDescriptors:z,startTime:G})=>{try{sW(z,Q);let H=JT(Q);return rL(...aZ(Y,Z,H))}catch(H){return S8({error:H,command:J,escapedCommand:X,fileDescriptors:z,options:Q,startTime:G,isSync:!0})}},JT=({encoding:Y,maxBuffer:Z,...Q})=>({...Q,encoding:"buffer",maxBuffer:J7(Z)}),XT=({error:Y,exitCode:Z,signal:Q,timedOut:J,isMaxBuffer:X,stdio:z,all:G,options:H,command:W,escapedCommand:K,startTime:$})=>Y===void 0?X7({command:W,escapedCommand:K,stdio:z,all:G,ipcOutput:[],options:H,startTime:$}):k1({error:Y,command:W,escapedCommand:K,timedOut:J,isCanceled:!1,isGracefullyCanceled:!1,isMaxBuffer:X,isForcefullyTerminated:!1,exitCode:Z,signal:Q,stdio:z,all:G,ipcOutput:[],options:H,startTime:$,isSync:!0});var UK=F(()=>{N5();r5();A1();z7();yW();P1();rW();QK();h6();XK();KK()});import{once as E3,on as zT}from"node:events";var VK=({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:J},{reference:X=!0,filter:z}={})=>{return C8({methodName:"getOneMessage",isSubprocess:Q,ipc:J,isConnected:mZ(Y)}),GT({anyProcess:Y,channel:Z,isSubprocess:Q,filter:z,reference:X})},GT=async({anyProcess:Y,channel:Z,isSubprocess:Q,filter:J,reference:X})=>{SZ(Z,X);let z=J6(Y,Z,Q),G=new AbortController;try{return await Promise.race([HT(z,J,G),WT(z,Q,G),KT(z,Q,G)])}catch(H){throw j8(Y),H}finally{G.abort(),vZ(Z,X)}},HT=async(Y,Z,{signal:Q})=>{if(Z===void 0){let[J]=await E3(Y,"message",{signal:Q});return J}for await(let[J]of zT(Y,"message",{signal:Q}))if(Z(J))return J},WT=async(Y,Z,{signal:Q})=>{await E3(Y,"disconnect",{signal:Q}),IG(Z)},KT=async(Y,Z,{signal:Q})=>{let[J]=await E3(Y,"strict:error",{signal:Q});throw kZ(J,Z)};var qK=F(()=>{k8();O1()});import{once as FK,on as $T}from"node:events";var RK=({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:J},{reference:X=!0}={})=>C3({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:J,shouldAwait:!Q,reference:X}),C3=({anyProcess:Y,channel:Z,isSubprocess:Q,ipc:J,shouldAwait:X,reference:z})=>{C8({methodName:"getEachMessage",isSubprocess:Q,ipc:J,isConnected:mZ(Y)}),SZ(Z,z);let G=J6(Y,Z,Q),H=new AbortController,W={};return UT(Y,G,H),VT({ipcEmitter:G,isSubprocess:Q,controller:H,state:W}),qT({anyProcess:Y,channel:Z,ipcEmitter:G,isSubprocess:Q,shouldAwait:X,controller:H,state:W,reference:z})},UT=async(Y,Z,Q)=>{try{await FK(Z,"disconnect",{signal:Q.signal}),Q.abort()}catch{}},VT=async({ipcEmitter:Y,isSubprocess:Z,controller:Q,state:J})=>{try{let[X]=await FK(Y,"strict:error",{signal:Q.signal});J.error=kZ(X,Z),Q.abort()}catch{}},qT=async function*({anyProcess:Y,channel:Z,ipcEmitter:Q,isSubprocess:J,shouldAwait:X,controller:z,state:G,reference:H}){try{for await(let[W]of $T(Q,"message",{signal:z.signal}))BK(G),yield W}catch{BK(G)}finally{if(z.abort(),vZ(Z,H),!J)j8(Y);if(X)await Y}},BK=({error:Y})=>{if(Y)throw Y};var j3=F(()=>{k8();O1()});import MK from"node:process";var DK=(Y,{ipc:Z})=>{Object.assign(Y,TK(Y,!1,Z))},LK=()=>{let Y=MK,Z=!0,Q=MK.channel!==void 0;return{...TK(Y,!0,Q),getCancelSignal:eG.bind(void 0,{anyProcess:Y,channel:Y.channel,isSubprocess:!0,ipc:Q})}},TK=(Y,Z,Q)=>({sendMessage:cZ.bind(void 0,{anyProcess:Y,channel:Y.channel,isSubprocess:Z,ipc:Q}),getOneMessage:VK.bind(void 0,{anyProcess:Y,channel:Y.channel,isSubprocess:Z,ipc:Q}),getEachMessage:RK.bind(void 0,{anyProcess:Y,channel:Y.channel,isSubprocess:Z,ipc:Q})});var k3=F(()=>{lZ();qK();j3();hZ()});import{ChildProcess as BT}from"node:child_process";import{PassThrough as FT,Readable as RT,Writable as MT,Duplex as DT}from"node:stream";var _K=({error:Y,command:Z,escapedCommand:Q,fileDescriptors:J,options:X,startTime:z,verboseInfo:G})=>{B3(J);let H=new BT;LT(H,J),Object.assign(H,{readable:TT,writable:_T,duplex:NT});let W=S8({error:Y,command:Z,escapedCommand:Q,fileDescriptors:J,options:X,startTime:z,isSync:!1}),K=wT(W,G,X);return{subprocess:H,promise:K}},LT=(Y,Z)=>{let Q=S1(),J=S1(),X=S1(),z=Array.from({length:Z.length-3},S1),G=S1(),H=[Q,J,X,...z];Object.assign(Y,{stdin:Q,stdout:J,stderr:X,all:G,stdio:H})},S1=()=>{let Y=new FT;return Y.end(),Y},TT=()=>new RT({read(){}}),_T=()=>new MT({write(){}}),NT=()=>new DT({read(){},write(){}}),wT=async(Y,Z,Q)=>v8(Y,Z,Q);var NK=F(()=>{$7();A1();z7()});import{createReadStream as wK,createWriteStream as OK}from"node:fs";import{Buffer as OT}from"node:buffer";import{Readable as v1,Writable as IT,Duplex as ET}from"node:stream";var EK=(Y,Z)=>K7(CT,Y,Z,!1),y1=({type:Y,optionName:Z})=>{throw TypeError(`The \`${Z}\` option cannot be ${X6[Y]}.`)},IK,CT;var CK=F(()=>{R7();$7();v0();IK={fileNumber:y1,generator:_3,asyncGenerator:_3,nodeStream:({value:Y})=>({stream:Y}),webTransform({value:{transform:Y,writableObjectMode:Z,readableObjectMode:Q}}){let J=Z||Q;return{stream:ET.fromWeb(Y,{objectMode:J})}},duplex:({value:{transform:Y}})=>({stream:Y}),native(){}},CT={input:{...IK,fileUrl:({value:Y})=>({stream:wK(Y)}),filePath:({value:{file:Y}})=>({stream:wK(Y)}),webStream:({value:Y})=>({stream:v1.fromWeb(Y)}),iterable:({value:Y})=>({stream:v1.from(Y)}),asyncIterable:({value:Y})=>({stream:v1.from(Y)}),string:({value:Y})=>({stream:v1.from(Y)}),uint8Array:({value:Y})=>({stream:v1.from(OT.from(Y))})},output:{...IK,fileUrl:({value:Y})=>({stream:OK(Y)}),filePath:({value:{file:Y,append:Z}})=>({stream:OK(Y,Z?{flags:"a"}:{})}),webStream:({value:Y})=>({stream:IT.fromWeb(Y)}),iterable:y1,asyncIterable:y1,string:y1,uint8Array:y1}}});import{on as jT,once as jK}from"node:events";import{PassThrough as kT,getDefaultHighWaterMark as AT}from"node:stream";import{finished as PK}from"node:stream/promises";function u6(Y){if(!Array.isArray(Y))throw TypeError(`Expected an array, got \`${typeof Y}\`.`);for(let X of Y)A3(X);let Z=Y.some(({readableObjectMode:X})=>X),Q=PT(Y,Z),J=new xK({objectMode:Z,writableHighWaterMark:Q,readableHighWaterMark:Q});for(let X of Y)J.add(X);return J}var PT=(Y,Z)=>{if(Y.length===0)return AT(Z);let Q=Y.filter(({readableObjectMode:J})=>J===Z).map(({readableHighWaterMark:J})=>J);return Math.max(...Q)},xK,xT=async(Y,Z,Q)=>{L7(Y,kK);let J=new AbortController;try{await Promise.race([ST(Y,J),vT(Y,Z,Q,J)])}finally{J.abort(),L7(Y,-kK)}},ST=async(Y,{signal:Z})=>{try{await PK(Y,{signal:Z,cleanup:!0})}catch(Q){throw SK(Y,Q),Q}},vT=async(Y,Z,Q,{signal:J})=>{for await(let[X]of jT(Y,"unpipe",{signal:J}))if(Z.has(X))X.emit(Q)},A3=(Y)=>{if(typeof Y?.pipe!=="function")throw TypeError(`Expected a readable stream, got: \`${typeof Y}\`.`)},yT=async({passThroughStream:Y,stream:Z,streams:Q,ended:J,aborted:X,onFinished:z,unpipeEvent:G})=>{L7(Y,AK);let H=new AbortController;try{await Promise.race([fT(z,Z,H),bT({passThroughStream:Y,stream:Z,streams:Q,ended:J,aborted:X,controller:H}),hT({stream:Z,streams:Q,ended:J,aborted:X,unpipeEvent:G,controller:H})])}finally{H.abort(),L7(Y,-AK)}if(Q.size>0&&Q.size===J.size+X.size)if(J.size===0&&X.size>0)P3(Y);else gT(Y)},fT=async(Y,Z,{signal:Q})=>{try{if(await Y,!Q.aborted)P3(Z)}catch(J){if(!Q.aborted)SK(Z,J)}},bT=async({passThroughStream:Y,stream:Z,streams:Q,ended:J,aborted:X,controller:{signal:z}})=>{try{if(await PK(Z,{signal:z,cleanup:!0,readable:!0,writable:!1}),Q.has(Z))J.add(Z)}catch(G){if(z.aborted||!Q.has(Z))return;if(vK(G))X.add(Z);else yK(Y,G)}},hT=async({stream:Y,streams:Z,ended:Q,aborted:J,unpipeEvent:X,controller:{signal:z}})=>{if(await jK(Y,X,{signal:z}),!Y.readable)return jK(z,"abort",{signal:z});Z.delete(Y),Q.delete(Y),J.delete(Y)},gT=(Y)=>{if(Y.writable)Y.end()},SK=(Y,Z)=>{if(vK(Z))P3(Y);else yK(Y,Z)},vK=(Y)=>Y?.code==="ERR_STREAM_PREMATURE_CLOSE",P3=(Y)=>{if(Y.readable||Y.writable)Y.destroy()},yK=(Y,Z)=>{if(!Y.destroyed)Y.once("error",mT),Y.destroy(Z)},mT=()=>{},L7=(Y,Z)=>{let Q=Y.getMaxListeners();if(Q!==0&&Q!==Number.POSITIVE_INFINITY)Y.setMaxListeners(Q+Z)},kK=2,AK=1;var T7=F(()=>{xK=class xK extends kT{#Z=new Set([]);#Q=new Set([]);#Y=new Set([]);#J;#X=Symbol("unpipe");#z=new WeakMap;add(Y){if(A3(Y),this.#Z.has(Y))return;this.#Z.add(Y),this.#J??=xT(this,this.#Z,this.#X);let Z=yT({passThroughStream:this,stream:Y,streams:this.#Z,ended:this.#Q,aborted:this.#Y,onFinished:this.#J,unpipeEvent:this.#X});this.#z.set(Y,Z),Y.pipe(this,{end:!1})}async remove(Y){if(A3(Y),!this.#Z.has(Y))return!1;let Z=this.#z.get(Y);if(Z===void 0)return!1;return this.#z.delete(Y),Y.unpipe(this),await Z,!0}}});import{finished as fK}from"node:stream/promises";var f8=(Y,Z)=>{Y.pipe(Z),uT(Y,Z),dT(Y,Z)},uT=async(Y,Z)=>{if(ZY(Y)||ZY(Z))return;try{await fK(Y,{cleanup:!0,readable:!0,writable:!1})}catch{}x3(Z)},x3=(Y)=>{if(Y.writable)Y.end()},dT=async(Y,Z)=>{if(ZY(Y)||ZY(Z))return;try{await fK(Z,{cleanup:!0,readable:!1,writable:!0})}catch{}S3(Y)},S3=(Y)=>{if(Y.readable)Y.destroy()};var _7=F(()=>{PY()});var bK=(Y,Z,Q)=>{let J=new Map;for(let[X,{stdioItems:z,direction:G}]of Object.entries(Z)){for(let{stream:H}of z.filter(({type:W})=>r0.has(W)))pT(Y,H,G,X);for(let{stream:H}of z.filter(({type:W})=>!r0.has(W)))lT({subprocess:Y,stream:H,direction:G,fdNumber:X,pipeGroups:J,controller:Q})}for(let[X,z]of J.entries()){let G=z.length===1?z[0]:u6(z);f8(G,X)}},pT=(Y,Z,Q,J)=>{if(Q==="output")f8(Y.stdio[J],Z);else f8(Z,Y.stdio[J]);let X=cT[J];if(X!==void 0)Y[X]=Z;Y.stdio[J]=Z},cT,lT=({subprocess:Y,stream:Z,direction:Q,fdNumber:J,pipeGroups:X,controller:z})=>{if(Z===void 0)return;iT(Z,z);let[G,H]=Q==="output"?[Z,Y.stdio[J]]:[Y.stdio[J],Z],W=X.get(G)??[];X.set(G,[...W,H])},iT=(Y,{signal:Z})=>{if(ZY(Y))y6(Y,nT,Z)},nT=2;var hK=F(()=>{T7();PY();xZ();v0();_7();cT=["stdin","stdout","stderr"]});var d6;var gK=F(()=>{d6=[];d6.push("SIGHUP","SIGINT","SIGTERM");if(process.platform!=="win32")d6.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")d6.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT")});class mK{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(y3[v3])return y3[v3];aT(y3,v3,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(Y,Z){this.listeners[Y].push(Z)}removeListener(Y,Z){let Q=this.listeners[Y],J=Q.indexOf(Z);if(J===-1)return;if(J===0&&Q.length===1)Q.length=0;else Q.splice(J,1)}emit(Y,Z,Q){if(this.emitted[Y])return!1;this.emitted[Y]=!0;let J=!1;for(let X of this.listeners[Y])J=X(Z,Q)===!0||J;if(Y==="exit")J=this.emit("afterExit",Z,Q)||J;return J}}class b3{}var N7=(Y)=>!!Y&&typeof Y==="object"&&typeof Y.removeListener==="function"&&typeof Y.emit==="function"&&typeof Y.reallyExit==="function"&&typeof Y.listeners==="function"&&typeof Y.kill==="function"&&typeof Y.pid==="number"&&typeof Y.on==="function",v3,y3,aT,oT=(Y)=>{return{onExit(Z,Q){return Y.onExit(Z,Q)},load(){return Y.load()},unload(){return Y.unload()}}},uK,dK,f3,pK,$y,Uy;var cK=F(()=>{gK();v3=Symbol.for("signal-exit emitter"),y3=globalThis,aT=Object.defineProperty.bind(Object);uK=class uK extends b3{onExit(){return()=>{}}load(){}unload(){}};dK=class dK extends b3{#Z=f3.platform==="win32"?"SIGINT":"SIGHUP";#Q=new mK;#Y;#J;#X;#z={};#G=!1;constructor(Y){super();this.#Y=Y,this.#z={};for(let Z of d6)this.#z[Z]=()=>{let Q=this.#Y.listeners(Z),{count:J}=this.#Q,X=Y;if(typeof X.__signal_exit_emitter__==="object"&&typeof X.__signal_exit_emitter__.count==="number")J+=X.__signal_exit_emitter__.count;if(Q.length===J){this.unload();let z=this.#Q.emit("exit",null,Z),G=Z==="SIGHUP"?this.#Z:Z;if(!z)Y.kill(Y.pid,G)}};this.#X=Y.reallyExit,this.#J=Y.emit}onExit(Y,Z){if(!N7(this.#Y))return()=>{};if(this.#G===!1)this.load();let Q=Z?.alwaysLast?"afterExit":"exit";return this.#Q.on(Q,Y),()=>{if(this.#Q.removeListener(Q,Y),this.#Q.listeners.exit.length===0&&this.#Q.listeners.afterExit.length===0)this.unload()}}load(){if(this.#G)return;this.#G=!0,this.#Q.count+=1;for(let Y of d6)try{let Z=this.#z[Y];if(Z)this.#Y.on(Y,Z)}catch(Z){}this.#Y.emit=(Y,...Z)=>{return this.#W(Y,...Z)},this.#Y.reallyExit=(Y)=>{return this.#H(Y)}}unload(){if(!this.#G)return;this.#G=!1,d6.forEach((Y)=>{let Z=this.#z[Y];if(!Z)throw Error("Listener not defined for signal: "+Y);try{this.#Y.removeListener(Y,Z)}catch(Q){}}),this.#Y.emit=this.#J,this.#Y.reallyExit=this.#X,this.#Q.count-=1}#H(Y){if(!N7(this.#Y))return 0;return this.#Y.exitCode=Y||0,this.#Q.emit("exit",this.#Y.exitCode,null),this.#X.call(this.#Y,this.#Y.exitCode)}#W(Y,...Z){let Q=this.#J;if(Y==="exit"&&N7(this.#Y)){if(typeof Z[0]==="number")this.#Y.exitCode=Z[0];let J=Q.call(this.#Y,Y,...Z);return this.#Q.emit("exit",this.#Y.exitCode,null),J}else return Q.call(this.#Y,Y,...Z)}};f3=globalThis.process,{onExit:pK,load:$y,unload:Uy}=oT(N7(f3)?new dK(f3):new uK)});import{addAbortListener as sT}from"node:events";var lK=(Y,{cleanup:Z,detached:Q},{signal:J})=>{if(!Z||Q)return;let X=pK(()=>{Y.kill()});sT(J,()=>{X()})};var iK=F(()=>{cK()});var aK=({source:Y,sourcePromise:Z,boundOptions:Q,createNested:J},...X)=>{let z=DZ(),{destination:G,destinationStream:H,destinationError:W,from:K,unpipeSignal:$}=rT(Q,J,X),{sourceStream:V,sourceError:q}=eT(Y,K),{options:M,fileDescriptors:B}=BY.get(Y);return{sourcePromise:Z,sourceStream:V,sourceOptions:M,sourceError:q,destination:G,destinationStream:H,destinationError:W,unpipeSignal:$,fileDescriptors:B,startTime:z}},rT=(Y,Z,Q)=>{try{let{destination:J,pipeOptions:{from:X,to:z,unpipeSignal:G}={}}=tT(Y,Z,...Q),H=PZ(J,z);return{destination:J,destinationStream:H,from:X,unpipeSignal:G}}catch(J){return{destinationError:J}}},tT=(Y,Z,Q,...J)=>{if(Array.isArray(Q))return{destination:Z(nK,Y)(Q,...J),pipeOptions:Y};if(typeof Q==="string"||Q instanceof URL||$5(Q)){if(Object.keys(Y).length>0)throw TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');let[X,z,G]=HZ(Q,...J);return{destination:Z(nK)(X,z,G),pipeOptions:G}}if(BY.has(Q)){if(Object.keys(Y).length>0)throw TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");return{destination:Q,pipeOptions:J[0]}}throw TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${Q}`)},nK=({options:Y})=>({options:{...Y,stdin:"pipe",piped:!0}}),eT=(Y,Z)=>{try{return{sourceStream:A8(Y,Z)}}catch(Q){return{sourceError:Q}}};var oK=F(()=>{V5();LZ();Q6();_8()});var rK=({sourceStream:Y,sourceError:Z,destinationStream:Q,destinationError:J,fileDescriptors:X,sourceOptions:z,startTime:G})=>{let H=Y_({sourceStream:Y,sourceError:Z,destinationStream:Q,destinationError:J});if(H!==void 0)throw h3({error:H,fileDescriptors:X,sourceOptions:z,startTime:G})},Y_=({sourceStream:Y,sourceError:Z,destinationStream:Q,destinationError:J})=>{if(Z!==void 0&&J!==void 0)return J;if(J!==void 0)return S3(Y),J;if(Z!==void 0)return x3(Q),Z},h3=({error:Y,fileDescriptors:Z,sourceOptions:Q,startTime:J})=>S8({error:Y,command:sK,escapedCommand:sK,fileDescriptors:Z,options:Q,startTime:J,isSync:!1}),sK="source.pipe(destination)";var g3=F(()=>{A1();_7()});var tK=async(Y)=>{let[{status:Z,reason:Q,value:J=Q},{status:X,reason:z,value:G=z}]=await Y;if(!G.pipedFrom.includes(J))G.pipedFrom.push(J);if(X==="rejected")throw G;if(Z==="rejected")throw J;return G};import{finished as Z_}from"node:stream/promises";var eK=(Y,Z,Q)=>{let J=w7.has(Z)?J_(Y,Z):Q_(Y,Z);return y6(Y,z_,Q.signal),y6(Z,G_,Q.signal),X_(Z),J},Q_=(Y,Z)=>{let Q=u6([Y]);return f8(Q,Z),w7.set(Z,Q),Q},J_=(Y,Z)=>{let Q=w7.get(Z);return Q.add(Y),Q},X_=async(Y)=>{try{await Z_(Y,{cleanup:!0,readable:!1,writable:!0})}catch{}w7.delete(Y)},w7,z_=2,G_=1;var Y$=F(()=>{T7();xZ();_7();w7=new WeakMap});import{aborted as H_}from"node:util";var Z$=(Y,Z)=>Y===void 0?[]:[W_(Y,Z)],W_=async(Y,{sourceStream:Z,mergedStream:Q,fileDescriptors:J,sourceOptions:X,startTime:z})=>{await H_(Y,Z),await Q.remove(Z);let G=Error("Pipe canceled by `unpipeSignal` option.");throw h3({error:G,fileDescriptors:J,sourceOptions:X,startTime:z})};var Q$=F(()=>{g3()});var O7=(Y,...Z)=>{if(B0(Z[0]))return O7.bind(void 0,{...Y,boundOptions:{...Y.boundOptions,...Z[0]}});let{destination:Q,...J}=aK(Y,...Z),X=K_({...J,destination:Q});return X.pipe=O7.bind(void 0,{...Y,source:Q,sourcePromise:X,boundOptions:{}}),X},K_=async({sourcePromise:Y,sourceStream:Z,sourceOptions:Q,sourceError:J,destination:X,destinationStream:z,destinationError:G,unpipeSignal:H,fileDescriptors:W,startTime:K})=>{let $=$_(Y,X);rK({sourceStream:Z,sourceError:J,destinationStream:z,destinationError:G,fileDescriptors:W,sourceOptions:Q,startTime:K});let V=new AbortController;try{let q=eK(Z,z,V);return await Promise.race([tK($),...Z$(H,{sourceStream:Z,mergedStream:q,sourceOptions:Q,fileDescriptors:W,startTime:K})])}finally{V.abort()}},$_=(Y,Z)=>Promise.allSettled([Y,Z]);var J$=F(()=>{oK();g3();Y$();Q$()});import{on as U_}from"node:events";import{getDefaultHighWaterMark as V_}from"node:stream";var I7=({subprocessStdout:Y,subprocess:Z,binary:Q,shouldEncode:J,encoding:X,preserveNewlines:z})=>{let G=new AbortController;return q_(Z,G),z$({stream:Y,controller:G,binary:Q,shouldEncode:!Y.readableObjectMode&&J,encoding:X,shouldSplit:!Y.readableObjectMode,preserveNewlines:z})},q_=async(Y,Z)=>{try{await Y}catch{}finally{Z.abort()}},m3=({stream:Y,onStreamEnd:Z,lines:Q,encoding:J,stripFinalNewline:X,allMixed:z})=>{let G=new AbortController;B_(Z,G,Y);let H=Y.readableObjectMode&&!z;return z$({stream:Y,controller:G,binary:J==="buffer",shouldEncode:!H,encoding:J,shouldSplit:!H&&Q,preserveNewlines:!X})},B_=async(Y,Z,Q)=>{try{await Y}catch{Q.destroy()}finally{Z.abort()}},z$=({stream:Y,controller:Z,binary:Q,shouldEncode:J,encoding:X,shouldSplit:z,preserveNewlines:G})=>{let H=U_(Y,"data",{signal:Z.signal,highWaterMark:X$,highWatermark:X$});return F_({onStdoutChunk:H,controller:Z,binary:Q,shouldEncode:J,encoding:X,shouldSplit:z,preserveNewlines:G})},u3,X$,F_=async function*({onStdoutChunk:Y,controller:Z,binary:Q,shouldEncode:J,encoding:X,shouldSplit:z,preserveNewlines:G}){let H=R_({binary:Q,shouldEncode:J,encoding:X,shouldSplit:z,preserveNewlines:G});try{for await(let[W]of Y)yield*m6(W,H,0)}catch(W){if(!Z.signal.aborted)throw W}finally{yield*x1(H)}},R_=({binary:Y,shouldEncode:Z,encoding:Q,shouldSplit:J,preserveNewlines:X})=>[q7(Y,Q,!Z),U7(Y,X,!J,{})].filter(Boolean);var E7=F(()=>{D3();V7();u3=V_(!0),X$=u3});import{setImmediate as M_}from"node:timers/promises";var G$=async({stream:Y,onStreamEnd:Z,fdNumber:Q,encoding:J,buffer:X,maxBuffer:z,lines:G,allMixed:H,stripFinalNewline:W,verboseInfo:K,streamInfo:$})=>{let V=D_({stream:Y,onStreamEnd:Z,fdNumber:Q,encoding:J,allMixed:H,verboseInfo:K,streamInfo:$});if(!X){await Promise.all([L_(Y),V]);return}let q=F3(W,Q),M=m3({stream:Y,onStreamEnd:Z,lines:G,encoding:J,stripFinalNewline:q,allMixed:H}),[B]=await Promise.all([T_({stream:Y,iterable:M,fdNumber:Q,encoding:J,maxBuffer:z,lines:G}),V]);return B},D_=async({stream:Y,onStreamEnd:Z,fdNumber:Q,encoding:J,allMixed:X,verboseInfo:z,streamInfo:{fileDescriptors:G}})=>{if(!M7({stdioItems:G[Q]?.stdioItems,encoding:J,verboseInfo:z,fdNumber:Q}))return;let H=m3({stream:Y,onStreamEnd:Z,lines:!0,encoding:J,stripFinalNewline:!0,allMixed:X});await tW(H,Y,Q,z)},L_=async(Y)=>{if(await M_(),Y.readableFlowing===null)Y.resume()},T_=async({stream:Y,stream:{readableObjectMode:Z},iterable:Q,fdNumber:J,encoding:X,maxBuffer:z,lines:G})=>{try{if(Z||G)return await tZ(Q,{maxBuffer:z});if(X==="buffer")return new Uint8Array(await eZ(Q,{maxBuffer:z}));return await Z7(Q,{maxBuffer:z})}catch(H){return H$(hH({error:H,stream:Y,readableObjectMode:Z,lines:G,encoding:X,fdNumber:J}))}},d3=async(Y)=>{try{return await Y}catch(Z){return H$(Z)}},H$=({bufferedData:Y})=>SX(Y)?new Uint8Array(Y):Y;var p3=F(()=>{Q7();m0();N3();E7();h6();P1()});import{finished as __}from"node:stream/promises";var f1=async(Y,Z,Q,{isSameDirection:J,stopOnExit:X=!1}={})=>{let z=N_(Y,Q),G=new AbortController;try{await Promise.race([...X?[Q.exitPromise]:[],__(Y,{cleanup:!0,signal:G.signal})])}catch(H){if(!z.stdinCleanedUp)I_(H,Z,Q,J)}finally{G.abort()}},N_=(Y,{originalStreams:[Z],subprocess:Q})=>{let J={stdinCleanedUp:!1};if(Y===Z)w_(Y,Q,J);return J},w_=(Y,Z,Q)=>{let{_destroy:J}=Y;Y._destroy=(...X)=>{O_(Z,Q),J.call(Y,...X)}},O_=({exitCode:Y,signalCode:Z},Q)=>{if(Y!==null||Z!==null)Q.stdinCleanedUp=!0},I_=(Y,Z,Q,J)=>{if(!E_(Y,Z,Q,J))throw Y},E_=(Y,Z,Q,J=!0)=>{if(Q.propagating)return W$(Y)||C7(Y);return Q.propagating=!0,c3(Q,Z)===J?W$(Y):C7(Y)},c3=({fileDescriptors:Y},Z)=>Z!=="all"&&Y[Z].direction==="input",C7=(Y)=>Y?.code==="ERR_STREAM_PREMATURE_CLOSE",W$=(Y)=>Y?.code==="EPIPE";var j7=()=>{};var K$=({subprocess:Y,encoding:Z,buffer:Q,maxBuffer:J,lines:X,stripFinalNewline:z,verboseInfo:G,streamInfo:H})=>Y.stdio.map((W,K)=>l3({stream:W,fdNumber:K,encoding:Z,buffer:Q[K],maxBuffer:J[K],lines:X[K],allMixed:!1,stripFinalNewline:z,verboseInfo:G,streamInfo:H})),l3=async({stream:Y,fdNumber:Z,encoding:Q,buffer:J,maxBuffer:X,lines:z,allMixed:G,stripFinalNewline:H,verboseInfo:W,streamInfo:K})=>{if(!Y)return;let $=f1(Y,Z,K);if(c3(K,Z)){await $;return}let[V]=await Promise.all([G$({stream:Y,onStreamEnd:$,fdNumber:Z,encoding:Q,buffer:J,maxBuffer:X,lines:z,allMixed:G,stripFinalNewline:H,verboseInfo:W,streamInfo:K}),$]);return V};var i3=F(()=>{p3();j7()});var $$=({stdout:Y,stderr:Z},{all:Q})=>Q&&(Y||Z)?u6([Y,Z].filter(Boolean)):void 0,U$=({subprocess:Y,encoding:Z,buffer:Q,maxBuffer:J,lines:X,stripFinalNewline:z,verboseInfo:G,streamInfo:H})=>l3({...C_(Y,Q),fdNumber:"all",encoding:Z,maxBuffer:J[1]+J[2],lines:X[1]||X[2],allMixed:j_(Y),stripFinalNewline:z,verboseInfo:G,streamInfo:H}),C_=({stdout:Y,stderr:Z,all:Q},[,J,X])=>{let z=J||X;if(!z)return{stream:Q,buffer:z};if(!J)return{stream:Z,buffer:z};if(!X)return{stream:Y,buffer:z};return{stream:Q,buffer:z}},j_=({all:Y,stdout:Z,stderr:Q})=>Y&&Z&&Q&&Z.readableObjectMode!==Q.readableObjectMode;var n3=F(()=>{T7();i3()});var V$=(Y)=>w8(Y,"ipc"),q$=(Y,Z)=>{let Q=MZ(Y);$Y({type:"ipc",verboseMessage:Q,fdNumber:"ipc",verboseInfo:Z})};var B$=F(()=>{O8();eY()});var F$=async({subprocess:Y,buffer:Z,maxBuffer:Q,ipc:J,ipcOutput:X,verboseInfo:z})=>{if(!J)return X;let G=V$(z),H=xY(Z,"ipc"),W=xY(Q,"ipc");for await(let K of C3({anyProcess:Y,channel:Y.channel,isSubprocess:!1,ipc:J,shouldAwait:!1,reference:!0})){if(H)gH(Y,X,W),X.push(K);if(G)q$(K,z)}return X},R$=async(Y,Z)=>{return await Promise.allSettled([Y]),Z};var M$=F(()=>{h6();B$();SY();j3()});import{once as k_}from"node:events";var D$=async({subprocess:Y,options:{encoding:Z,buffer:Q,maxBuffer:J,lines:X,timeoutDuration:z,cancelSignal:G,gracefulCancel:H,forceKillAfterDelay:W,stripFinalNewline:K,ipc:$,ipcInput:V},context:q,verboseInfo:M,fileDescriptors:B,originalStreams:D,onInternalError:T,controller:_})=>{let w=zK(Y,q),I={originalStreams:D,fileDescriptors:B,subprocess:Y,exitPromise:w,propagating:!1},E=K$({subprocess:Y,encoding:Z,buffer:Q,maxBuffer:J,lines:X,stripFinalNewline:K,verboseInfo:M,streamInfo:I}),v=U$({subprocess:Y,encoding:Z,buffer:Q,maxBuffer:J,lines:X,stripFinalNewline:K,verboseInfo:M,streamInfo:I}),S=[],g=F$({subprocess:Y,buffer:Q,maxBuffer:J,ipc:$,ipcOutput:S,verboseInfo:M}),d=A_(D,Y,I),m=P_(B,I);try{return await Promise.race([Promise.all([{},HK(w),Promise.all(E),v,g,KH(Y,V),...d,...m]),T,x_(Y,_),...XH(Y,z,q,_),...OG({subprocess:Y,cancelSignal:G,gracefulCancel:H,context:q,controller:_}),...QH({subprocess:Y,cancelSignal:G,gracefulCancel:H,forceKillAfterDelay:W,context:q,controller:_})])}catch(b){return q.terminationReason??="other",Promise.all([{error:b},w,Promise.all(E.map((i)=>d3(i))),d3(v),R$(g,S),Promise.allSettled(d),Promise.allSettled(m)])}},A_=(Y,Z,Q)=>Y.map((J,X)=>J===Z.stdio[X]?void 0:f1(J,X,Q)),P_=(Y,Z)=>Y.flatMap(({stdioItems:Q},J)=>Q.filter(({value:X,stream:z=X})=>JY(z,{checkOpen:!1})&&!ZY(z)).map(({type:X,value:z,stream:G=z})=>f1(G,J,Z,{isSameDirection:r0.has(X),stopOnExit:X==="native"}))),x_=async(Y,{signal:Z})=>{let[Q]=await k_(Y,"error",{signal:Z});throw Q};var L$=F(()=>{i5();b5();l5();PY();v0();p3();M$();a5();n3();i3();I3();j7()});var T$=()=>({readableDestroy:new WeakMap,writableFinal:new WeakMap,writableDestroy:new WeakMap}),b1=(Y,Z,Q)=>{let J=Y[Q];if(!J.has(Z))J.set(Z,[]);let X=J.get(Z),z=qY();return X.push(z),{resolve:z.resolve.bind(z),promises:X}},b8=async({resolve:Y,promises:Z},Q)=>{Y();let[J]=await Promise.race([Promise.allSettled([!0,Q]),Promise.all([!1,...Z])]);return!J};var k7=()=>{};import{finished as _$}from"node:stream/promises";var a3=async(Y)=>{if(Y===void 0)return;try{await o3(Y)}catch{}},N$=async(Y)=>{if(Y===void 0)return;try{await s3(Y)}catch{}},o3=async(Y)=>{await _$(Y,{cleanup:!0,readable:!1,writable:!0})},s3=async(Y)=>{await _$(Y,{cleanup:!0,readable:!0,writable:!1})},A7=async(Y,Z)=>{if(await Y,Z)throw Z},P7=(Y,Z,Q)=>{if(Q&&!C7(Q))Y.destroy(Q);else if(Z)Y.destroy()};var r3=F(()=>{j7()});import{Readable as S_}from"node:stream";import{callbackify as v_}from"node:util";var w$=({subprocess:Y,concurrentStreams:Z,encoding:Q},{from:J,binary:X=!0,preserveNewlines:z=!0}={})=>{let G=X||u0.has(Q),{subprocessStdout:H,waitReadableDestroy:W}=t3(Y,J,Z),{readableEncoding:K,readableObjectMode:$,readableHighWaterMark:V}=e3(H,G),{read:q,onStdoutDataDone:M}=YQ({subprocessStdout:H,subprocess:Y,binary:G,encoding:Q,preserveNewlines:z}),B=new S_({read:q,destroy:v_(QQ.bind(void 0,{subprocessStdout:H,subprocess:Y,waitReadableDestroy:W})),highWaterMark:V,objectMode:$,encoding:K});return ZQ({subprocessStdout:H,onStdoutDataDone:M,readable:B,subprocess:Y}),B},t3=(Y,Z,Q)=>{let J=A8(Y,Z),X=b1(Q,J,"readableDestroy");return{subprocessStdout:J,waitReadableDestroy:X}},e3=({readableEncoding:Y,readableObjectMode:Z,readableHighWaterMark:Q},J)=>J?{readableEncoding:Y,readableObjectMode:Z,readableHighWaterMark:Q}:{readableEncoding:Y,readableObjectMode:!0,readableHighWaterMark:u3},YQ=({subprocessStdout:Y,subprocess:Z,binary:Q,encoding:J,preserveNewlines:X})=>{let z=qY(),G=I7({subprocessStdout:Y,subprocess:Z,binary:Q,shouldEncode:!Q,encoding:J,preserveNewlines:X});return{read(){y_(this,G,z)},onStdoutDataDone:z}},y_=async(Y,Z,Q)=>{try{let{value:J,done:X}=await Z.next();if(X)Q.resolve();else Y.push(J)}catch{}},ZQ=async({subprocessStdout:Y,onStdoutDataDone:Z,readable:Q,subprocess:J,subprocessStdin:X})=>{try{if(await s3(Y),await J,await a3(X),await Z,Q.readable)Q.push(null)}catch(z){await a3(X),O$(Q,z)}},QQ=async({subprocessStdout:Y,subprocess:Z,waitReadableDestroy:Q},J)=>{if(await b8(Q,Z))O$(Y,J),await A7(Z,J)},O$=(Y,Z)=>{P7(Y,Y.readable,Z)};var JQ=F(()=>{f6();Q6();E7();k7();r3()});import{Writable as f_}from"node:stream";import{callbackify as I$}from"node:util";var E$=({subprocess:Y,concurrentStreams:Z},{to:Q}={})=>{let{subprocessStdin:J,waitWritableFinal:X,waitWritableDestroy:z}=XQ(Y,Q,Z),G=new f_({...zQ(J,Y,X),destroy:I$(HQ.bind(void 0,{subprocessStdin:J,subprocess:Y,waitWritableFinal:X,waitWritableDestroy:z})),highWaterMark:J.writableHighWaterMark,objectMode:J.writableObjectMode});return GQ(J,G),G},XQ=(Y,Z,Q)=>{let J=PZ(Y,Z),X=b1(Q,J,"writableFinal"),z=b1(Q,J,"writableDestroy");return{subprocessStdin:J,waitWritableFinal:X,waitWritableDestroy:z}},zQ=(Y,Z,Q)=>({write:b_.bind(void 0,Y),final:I$(h_.bind(void 0,Y,Z,Q))}),b_=(Y,Z,Q,J)=>{if(Y.write(Z,Q))J();else Y.once("drain",J)},h_=async(Y,Z,Q)=>{if(await b8(Q,Z)){if(Y.writable)Y.end();await Z}},GQ=async(Y,Z,Q)=>{try{if(await o3(Y),Z.writable)Z.end()}catch(J){await N$(Q),C$(Z,J)}},HQ=async({subprocessStdin:Y,subprocess:Z,waitWritableFinal:Q,waitWritableDestroy:J},X)=>{if(await b8(Q,Z),await b8(J,Z))C$(Y,X),await A7(Z,X)},C$=(Y,Z)=>{P7(Y,Y.writable,Z)};var WQ=F(()=>{Q6();k7();r3()});import{Duplex as g_}from"node:stream";import{callbackify as m_}from"node:util";var j$=({subprocess:Y,concurrentStreams:Z,encoding:Q},{from:J,to:X,binary:z=!0,preserveNewlines:G=!0}={})=>{let H=z||u0.has(Q),{subprocessStdout:W,waitReadableDestroy:K}=t3(Y,J,Z),{subprocessStdin:$,waitWritableFinal:V,waitWritableDestroy:q}=XQ(Y,X,Z),{readableEncoding:M,readableObjectMode:B,readableHighWaterMark:D}=e3(W,H),{read:T,onStdoutDataDone:_}=YQ({subprocessStdout:W,subprocess:Y,binary:H,encoding:Q,preserveNewlines:G}),w=new g_({read:T,...zQ($,Y,V),destroy:m_(u_.bind(void 0,{subprocessStdout:W,subprocessStdin:$,subprocess:Y,waitReadableDestroy:K,waitWritableFinal:V,waitWritableDestroy:q})),readableHighWaterMark:D,writableHighWaterMark:$.writableHighWaterMark,readableObjectMode:B,writableObjectMode:$.writableObjectMode,encoding:M});return ZQ({subprocessStdout:W,onStdoutDataDone:_,readable:w,subprocess:Y,subprocessStdin:$}),GQ($,w,W),w},u_=async({subprocessStdout:Y,subprocessStdin:Z,subprocess:Q,waitReadableDestroy:J,waitWritableFinal:X,waitWritableDestroy:z},G)=>{await Promise.all([QQ({subprocessStdout:Y,subprocess:Q,waitReadableDestroy:J},G),HQ({subprocessStdin:Z,subprocess:Q,waitWritableFinal:X,waitWritableDestroy:z},G)])};var k$=F(()=>{f6();JQ();WQ()});var KQ=(Y,Z,{from:Q,binary:J=!1,preserveNewlines:X=!1}={})=>{let z=J||u0.has(Z),G=A8(Y,Q),H=I7({subprocessStdout:G,subprocess:Y,binary:z,shouldEncode:!0,encoding:Z,preserveNewlines:X});return d_(H,G,Y)},d_=async function*(Y,Z,Q){try{yield*Y}finally{if(Z.readable)Z.destroy();await Q}};var A$=F(()=>{f6();Q6();E7()});var P$=(Y,{encoding:Z})=>{let Q=T$();Y.readable=w$.bind(void 0,{subprocess:Y,concurrentStreams:Q,encoding:Z}),Y.writable=E$.bind(void 0,{subprocess:Y,concurrentStreams:Q}),Y.duplex=j$.bind(void 0,{subprocess:Y,concurrentStreams:Q,encoding:Z}),Y.iterable=KQ.bind(void 0,Y,Z),Y[Symbol.asyncIterator]=KQ.bind(void 0,Y,Z,{})};var x$=F(()=>{k7();JQ();WQ();k$();A$()});var S$=(Y,Z)=>{for(let[Q,J]of c_){let X=J.value.bind(Z);Reflect.defineProperty(Y,Q,{...J,value:X})}},p_,c_;var v$=F(()=>{p_=(async()=>{})().constructor.prototype,c_=["then","catch","finally"].map((Y)=>[Y,Reflect.getOwnPropertyDescriptor(p_,Y)])});import{setMaxListeners as l_}from"node:events";import{spawn as i_}from"node:child_process";var y$=(Y,Z,Q,J)=>{let{file:X,commandArguments:z,command:G,escapedCommand:H,startTime:W,verboseInfo:K,options:$,fileDescriptors:V}=n_(Y,Z,Q),{subprocess:q,promise:M}=o_({file:X,commandArguments:z,options:$,startTime:W,verboseInfo:K,command:G,escapedCommand:H,fileDescriptors:V});return q.pipe=O7.bind(void 0,{source:q,sourcePromise:M,boundOptions:{},createNested:J}),S$(q,M),BY.set(q,{options:$,fileDescriptors:V}),q},n_=(Y,Z,Q)=>{let{command:J,escapedCommand:X,startTime:z,verboseInfo:G}=TZ(Y,Z,Q),{file:H,commandArguments:W,options:K}=nZ(Y,Z,Q),$=a_(K),V=EK($,G);return{file:H,commandArguments:W,command:J,escapedCommand:X,startTime:z,verboseInfo:G,options:$,fileDescriptors:V}},a_=({timeout:Y,signal:Z,...Q})=>{if(Z!==void 0)throw TypeError('The "signal" option has been renamed to "cancelSignal" instead.');return{...Q,timeoutDuration:Y}},o_=({file:Y,commandArguments:Z,options:Q,startTime:J,verboseInfo:X,command:z,escapedCommand:G,fileDescriptors:H})=>{let W;try{W=i_(...aZ(Y,Z,Q))}catch(B){return _K({error:B,command:z,escapedCommand:G,fileDescriptors:H,options:Q,startTime:J,verboseInfo:X})}let K=new AbortController;l_(Number.POSITIVE_INFINITY,K.signal);let $=[...W.stdio];bK(W,H,K),lK(W,Q,K);let V={},q=qY();W.kill=NG.bind(void 0,{kill:W.kill.bind(W),options:Q,onInternalError:q,context:V,controller:K}),W.all=$$(W,Q),P$(W,Q),DK(W,Q);let M=s_({subprocess:W,options:Q,startTime:J,verboseInfo:X,fileDescriptors:H,originalStreams:$,command:z,escapedCommand:G,context:V,onInternalError:q,controller:K});return{subprocess:W,promise:M}},s_=async({subprocess:Y,options:Z,startTime:Q,verboseInfo:J,fileDescriptors:X,originalStreams:z,command:G,escapedCommand:H,context:W,onInternalError:K,controller:$})=>{let[V,[q,M],B,D,T]=await D$({subprocess:Y,options:Z,context:W,verboseInfo:J,fileDescriptors:X,originalStreams:z,onInternalError:K,controller:$});$.abort(),K.resolve();let _=B.map((E,v)=>fY(E,Z,v)),w=fY(D,Z,"all"),I=r_({errorInfo:V,exitCode:q,signal:M,stdio:_,all:w,ipcOutput:T,context:W,options:Z,command:G,escapedCommand:H,startTime:Q});return v8(I,J,Z)},r_=({errorInfo:Y,exitCode:Z,signal:Q,stdio:J,all:X,ipcOutput:z,context:G,options:H,command:W,escapedCommand:K,startTime:$})=>("error"in Y)?k1({error:Y.error,command:W,escapedCommand:K,timedOut:G.terminationReason==="timeout",isCanceled:G.terminationReason==="cancel"||G.terminationReason==="gracefulCancel",isGracefullyCanceled:G.terminationReason==="gracefulCancel",isMaxBuffer:Y.error instanceof vY,isForcefullyTerminated:G.isForcefullyTerminated,exitCode:Z,signal:Q,stdio:J,all:X,ipcOutput:z,options:H,startTime:$,isSync:!1}):X7({command:W,escapedCommand:K,stdio:J,all:X,ipcOutput:z,options:H,startTime:$});var f$=F(()=>{Q7();N5();r5();Q6();k3();A1();z7();NK();CK();P1();hK();CZ();iK();J$();n3();L$();x$();v$()});var x7=(Y,Z)=>{let Q=Object.fromEntries(Object.entries(Z).map(([J,X])=>[J,t_(J,Y[J],X)]));return{...Y,...Q}},t_=(Y,Z,Q)=>{if(e_.has(Y)&&B0(Z)&&B0(Q))return{...Z,...Q};return Q},e_;var b$=F(()=>{SY();e_=new Set(["env",...M5])});var z6=(Y,Z,Q,J)=>{let X=(G,H,W)=>z6(G,H,Q,W),z=(...G)=>YN({mapArguments:Y,deepOptions:Q,boundOptions:Z,setBoundExeca:J,createNested:X},...G);if(J!==void 0)J(z,X,Z);return z},YN=({mapArguments:Y,deepOptions:Z={},boundOptions:Q={},setBoundExeca:J,createNested:X},z,...G)=>{if(B0(z))return X(Y,x7(Q,z),J);let{file:H,commandArguments:W,options:K,isSync:$}=ZN({mapArguments:Y,firstArgument:z,nextArguments:G,deepOptions:Z,boundOptions:Q});return $?$K(H,W,K):y$(H,W,K,X)},ZN=({mapArguments:Y,firstArgument:Z,nextArguments:Q,deepOptions:J,boundOptions:X})=>{let z=gX(Z)?mX(Z,Q):[Z,...Q],[G,H,W]=HZ(...z),K=x7(x7(J,X),W),{file:$=G,commandArguments:V=H,options:q=K,isSync:M=!1}=Y({file:G,commandArguments:H,options:K});return{file:$,commandArguments:V,options:q,isSync:M}};var h$=F(()=>{V5();uX();UK();f$();b$()});var g$=({file:Y,commandArguments:Z})=>u$(Y,Z),m$=({file:Y,commandArguments:Z})=>({...u$(Y,Z),isSync:!0}),u$=(Y,Z)=>{if(Z.length>0)throw TypeError(`The command and its arguments must be passed as a single string: ${Y} ${Z}.`);let[Q,...J]=QN(Y);return{file:Q,commandArguments:J}},QN=(Y)=>{if(typeof Y!=="string")throw TypeError(`The command must be a string: ${String(Y)}.`);let Z=Y.trim();if(Z==="")return[];let Q=[];for(let J of Z.split(JN)){let X=Q.at(-1);if(X&&X.endsWith("\\"))Q[Q.length-1]=`${X.slice(0,-1)} ${J}`;else Q.push(J)}return Q},JN;var d$=F(()=>{JN=/ +/g});var p$=(Y,Z,Q)=>{Y.sync=Z(XN,Q),Y.s=Y.sync},c$=({options:Y})=>l$(Y),XN=({options:Y})=>({...l$(Y),isSync:!0}),l$=(Y)=>({options:{...zN(Y),...Y}}),zN=({input:Y,inputFile:Z,stdio:Q})=>Y===void 0&&Z===void 0&&Q===void 0?{stdin:"inherit"}:{},i$;var n$=F(()=>{i$={preferLocal:!0}});var bY,Zh,Qh,Jh,Xh,x,zh,Gh,Hh,Wh;var h1=F(()=>{h$();d$();n5();n$();k3();Y6();bY=z6(()=>({})),Zh=z6(()=>({isSync:!0})),Qh=z6(g$),Jh=z6(m$),Xh=z6(GH),x=z6(c$,{},i$,p$),{sendMessage:zh,getOneMessage:Gh,getEachMessage:Hh,getCancelSignal:Wh}=LK()});function GN(Y,Z){let Q=Y.slice(0,Z).split(/\r\n|\n|\r/g);return[Q.length,Q.pop().length+1]}function HN(Y,Z,Q){let J=Y.split(/\r\n|\n|\r/g),X="",z=(Math.log10(Z+1)|0)+1;for(let G=Z-1;G<=Z+1;G++){let H=J[G-1];if(!H)continue;if(X+=G.toString().padEnd(z," "),X+=": ",X+=H,X+=`
|
|
83
|
+
`,G===Z)X+=" ".repeat(z+Q+2),X+=`^
|
|
84
|
+
`}return X}var o;var p6=F(()=>{/*!
|
|
91
85
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
92
86
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
93
87
|
*
|
|
@@ -113,11 +107,16 @@ Instead, \`yield\` should either be called with a value, or not be called at all
|
|
|
113
107
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
114
108
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
115
109
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
116
|
-
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
*/o=class o extends Error{line;column;codeblock;constructor(Y,Z){let[Q,J]=GN(Z.toml,Z.ptr),X=HN(Z.toml,Q,J);super(`Invalid TOML document: ${Y}
|
|
111
|
+
|
|
112
|
+
${X}`,Z);this.line=Q,this.column=J,this.codeblock=X}}});function WN(Y,Z){let Q=0;while(Y[Z-++Q]==="\\");return--Q&&Q%2}function h8(Y,Z=0,Q=Y.length){let J=Y.indexOf(`
|
|
113
|
+
`,Z);if(Y[J-1]==="\r")J--;return J<=Q?J:-1}function g1(Y,Z){for(let Q=Z;Q<Y.length;Q++){let J=Y[Q];if(J===`
|
|
114
|
+
`)return Q;if(J==="\r"&&Y[Q+1]===`
|
|
115
|
+
`)return Q+1;if(J<" "&&J!=="\t"||J==="")throw new o("control characters are not allowed in comments",{toml:Y,ptr:Z})}return Y.length}function d0(Y,Z,Q,J){let X;while((X=Y[Z])===" "||X==="\t"||!Q&&(X===`
|
|
116
|
+
`||X==="\r"&&Y[Z+1]===`
|
|
117
|
+
`))Z++;return J||X!=="#"?Z:d0(Y,g1(Y,Z),Q)}function $Q(Y,Z,Q,J,X=!1){if(!J)return Z=h8(Y,Z),Z<0?Y.length:Z;for(let z=Z;z<Y.length;z++){let G=Y[z];if(G==="#")z=h8(Y,z);else if(G===Q)return z+1;else if(G===J||X&&(G===`
|
|
118
|
+
`||G==="\r"&&Y[z+1]===`
|
|
119
|
+
`))return z}throw new o("cannot find end of structure",{toml:Y,ptr:Z})}function S7(Y,Z){let Q=Y[Z],J=Q===Y[Z+1]&&Y[Z+1]===Y[Z+2]?Y.slice(Z,Z+3):Q;Z+=J.length-1;do Z=Y.indexOf(J,++Z);while(Z>-1&&Q!=="'"&&WN(Y,Z));if(Z>-1){if(Z+=J.length,J.length>1){if(Y[Z]===Q)Z++;if(Y[Z]===Q)Z++}}return Z}var m1=F(()=>{p6();/*!
|
|
121
120
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
122
121
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
123
122
|
*
|
|
@@ -143,14 +142,7 @@ ${J}`,Z);this.line=Q,this.column=X,this.codeblock=J}}/*!
|
|
|
143
142
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
144
143
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
145
144
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
146
|
-
*/
|
|
147
|
-
`,Z);if(Y[X-1]==="\r")X--;return X<=Q?X:-1}function v1(Y,Z){for(let Q=Z;Q<Y.length;Q++){let X=Y[Q];if(X===`
|
|
148
|
-
`)return Q;if(X==="\r"&&Y[Q+1]===`
|
|
149
|
-
`)return Q+1;if(X<" "&&X!=="\t"||X==="")throw new l("control characters are not allowed in comments",{toml:Y,ptr:Z})}return Y.length}function P0(Y,Z,Q,X){let J;while((J=Y[Z])===" "||J==="\t"||!Q&&(J===`
|
|
150
|
-
`||J==="\r"&&Y[Z+1]===`
|
|
151
|
-
`))Z++;return X||J!=="#"?Z:P0(Y,v1(Y,Z),Q)}function m2(Y,Z,Q,X,J=!1){if(!X)return Z=h6(Y,Z),Z<0?Y.length:Z;for(let $=Z;$<Y.length;$++){let G=Y[$];if(G==="#")$=h6(Y,$);else if(G===Q)return $+1;else if(G===X||J&&(G===`
|
|
152
|
-
`||G==="\r"&&Y[$+1]===`
|
|
153
|
-
`))return $}throw new l("cannot find end of structure",{toml:Y,ptr:Z})}function $Z(Y,Z){let Q=Y[Z],X=Q===Y[Z+1]&&Y[Z+1]===Y[Z+2]?Y.slice(Z,Z+3):Q;Z+=X.length-1;do Z=Y.indexOf(X,++Z);while(Z>-1&&Q!=="'"&&bF(Y,Z));if(Z>-1){if(Z+=X.length,X.length>1){if(Y[Z]===Q)Z++;if(Y[Z]===Q)Z++}}return Z}/*!
|
|
145
|
+
*/});var KN,G6;var UQ=F(()=>{/*!
|
|
154
146
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
155
147
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
156
148
|
*
|
|
@@ -176,7 +168,12 @@ ${J}`,Z);this.line=Q,this.column=X,this.codeblock=J}}/*!
|
|
|
176
168
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
177
169
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
178
170
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
179
|
-
*/
|
|
171
|
+
*/KN=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}:\d{2}(?:\.\d+)?)?(Z|[-+]\d{2}:\d{2})?$/i;G6=class G6 extends Date{#Z=!1;#Q=!1;#Y=null;constructor(Y){let Z=!0,Q=!0,J="Z";if(typeof Y==="string"){let X=Y.match(KN);if(X){if(!X[1])Z=!1,Y=`0000-01-01T${Y}`;if(Q=!!X[2],Q&&Y[10]===" "&&(Y=Y.replace(" ","T")),X[2]&&+X[2]>23)Y="";else if(J=X[3]||null,Y=Y.toUpperCase(),!J&&Q)Y+="Z"}else Y=""}super(Y);if(!isNaN(this.getTime()))this.#Z=Z,this.#Q=Q,this.#Y=J}isDateTime(){return this.#Z&&this.#Q}isLocal(){return!this.#Z||!this.#Q||!this.#Y}isDate(){return this.#Z&&!this.#Q}isTime(){return this.#Q&&!this.#Z}isValid(){return this.#Z||this.#Q}toISOString(){let Y=super.toISOString();if(this.isDate())return Y.slice(0,10);if(this.isTime())return Y.slice(11,23);if(this.#Y===null)return Y.slice(0,-1);if(this.#Y==="Z")return Y;let Z=+this.#Y.slice(1,3)*60+ +this.#Y.slice(4,6);return Z=this.#Y[0]==="-"?Z:-Z,new Date(this.getTime()-Z*60000).toISOString().slice(0,-1)+this.#Y}static wrapAsOffsetDateTime(Y,Z="Z"){let Q=new G6(Y);return Q.#Y=Z,Q}static wrapAsLocalDateTime(Y){let Z=new G6(Y);return Z.#Y=null,Z}static wrapAsLocalDate(Y){let Z=new G6(Y);return Z.#Q=!1,Z.#Y=null,Z}static wrapAsLocalTime(Y){let Z=new G6(Y);return Z.#Z=!1,Z.#Y=null,Z}}});function v7(Y,Z=0,Q=Y.length){let J=Y[Z]==="'",X=Y[Z++]===Y[Z]&&Y[Z]===Y[Z+1];if(X){if(Q-=2,Y[Z+=2]==="\r")Z++;if(Y[Z]===`
|
|
172
|
+
`)Z++}let z=0,G,H="",W=Z;while(Z<Q-1){let K=Y[Z++];if(K===`
|
|
173
|
+
`||K==="\r"&&Y[Z]===`
|
|
174
|
+
`){if(!X)throw new o("newlines are not allowed in strings",{toml:Y,ptr:Z-1})}else if(K<" "&&K!=="\t"||K==="")throw new o("control characters are not allowed in strings",{toml:Y,ptr:Z-1});if(G){if(G=!1,K==="u"||K==="U"){let $=Y.slice(Z,Z+=K==="u"?4:8);if(!qN.test($))throw new o("invalid unicode escape",{toml:Y,ptr:z});try{H+=String.fromCodePoint(parseInt($,16))}catch{throw new o("invalid unicode escape",{toml:Y,ptr:z})}}else if(X&&(K===`
|
|
175
|
+
`||K===" "||K==="\t"||K==="\r")){if(Z=d0(Y,Z-1,!0),Y[Z]!==`
|
|
176
|
+
`&&Y[Z]!=="\r")throw new o("invalid escape: only line-ending whitespace may be escaped",{toml:Y,ptr:z});Z=d0(Y,Z)}else if(K in a$)H+=a$[K];else throw new o("unrecognized escape sequence",{toml:Y,ptr:z});W=Z}else if(!J&&K==="\\")z=Z-1,G=!0,H+=Y.slice(W,z)}return H+Y.slice(W,Q-1)}function o$(Y,Z,Q,J){if(Y==="true")return!0;if(Y==="false")return!1;if(Y==="-inf")return-1/0;if(Y==="inf"||Y==="+inf")return 1/0;if(Y==="nan"||Y==="+nan"||Y==="-nan")return NaN;if(Y==="-0")return J?0n:0;let X=$N.test(Y);if(X||UN.test(Y)){if(VN.test(Y))throw new o("leading zeroes are not allowed",{toml:Z,ptr:Q});Y=Y.replace(/_/g,"");let G=+Y;if(isNaN(G))throw new o("invalid number",{toml:Z,ptr:Q});if(X){if((X=!Number.isSafeInteger(G))&&!J)throw new o("integer value cannot be represented losslessly",{toml:Z,ptr:Q});if(X||J===!0)G=BigInt(Y)}return G}let z=new G6(Y);if(!z.isValid())throw new o("invalid value",{toml:Z,ptr:Q});return z}var $N,UN,VN,qN,a$;var VQ=F(()=>{m1();UQ();p6();/*!
|
|
180
177
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
181
178
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
182
179
|
*
|
|
@@ -202,13 +199,10 @@ ${J}`,Z);this.line=Q,this.column=X,this.codeblock=J}}/*!
|
|
|
202
199
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
203
200
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
204
201
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
205
|
-
|
|
206
|
-
`,f:"\f",r:"\r",'"':'"',"\\":"\\"};function
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
`){if(!J)throw new l("newlines are not allowed in strings",{toml:Y,ptr:Z-1})}else if(W<" "&&W!=="\t"||W==="")throw new l("control characters are not allowed in strings",{toml:Y,ptr:Z-1});if(G){if(G=!1,W==="u"||W==="U"){let z=Y.slice(Z,Z+=W==="u"?4:8);if(!pF.test(z))throw new l("invalid unicode escape",{toml:Y,ptr:$});try{K+=String.fromCodePoint(parseInt(z,16))}catch{throw new l("invalid unicode escape",{toml:Y,ptr:$})}}else if(J&&(W===`
|
|
210
|
-
`||W===" "||W==="\t"||W==="\r")){if(Z=P0(Y,Z-1,!0),Y[Z]!==`
|
|
211
|
-
`&&Y[Z]!=="\r")throw new l("invalid escape: only line-ending whitespace may be escaped",{toml:Y,ptr:$});Z=P0(Y,Z)}else if(W in j$)K+=j$[W];else throw new l("unrecognized escape sequence",{toml:Y,ptr:$});H=Z}else if(!X&&W==="\\")$=Z-1,G=!0,K+=Y.slice(H,$)}return K+Y.slice(H,Q-1)}function x$(Y,Z,Q,X){if(Y==="true")return!0;if(Y==="false")return!1;if(Y==="-inf")return-1/0;if(Y==="inf"||Y==="+inf")return 1/0;if(Y==="nan"||Y==="+nan"||Y==="-nan")return NaN;if(Y==="-0")return X?0n:0;let J=mF.test(Y);if(J||uF.test(Y)){if(dF.test(Y))throw new l("leading zeroes are not allowed",{toml:Z,ptr:Q});Y=Y.replace(/_/g,"");let G=+Y;if(isNaN(G))throw new l("invalid number",{toml:Z,ptr:Q});if(J){if((J=!Number.isSafeInteger(G))&&!X)throw new l("integer value cannot be represented losslessly",{toml:Z,ptr:Q});if(J||X===!0)G=BigInt(Y)}return G}let $=new TY(Y);if(!$.isValid())throw new l("invalid value",{toml:Z,ptr:Q});return $}/*!
|
|
202
|
+
*/$N=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,UN=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,VN=/^[+-]?0[0-9_]/,qN=/^[0-9a-f]{4,8}$/i,a$={b:"\b",t:"\t",n:`
|
|
203
|
+
`,f:"\f",r:"\r",'"':'"',"\\":"\\"}});function BN(Y,Z,Q,J){let X=Y.slice(Z,Q),z=X.indexOf("#");if(z>-1)g1(Y,z),X=X.slice(0,z);let G=X.trimEnd();if(!J){let H=X.indexOf(`
|
|
204
|
+
`,G.length);if(H>-1)throw new o("newlines are not allowed in inline tables",{toml:Y,ptr:Z+H})}return[G,z]}function u1(Y,Z,Q,J,X){if(J===0)throw new o("document contains excessively nested structures. aborting.",{toml:Y,ptr:Z});let z=Y[Z];if(z==="["||z==="{"){let[W,K]=z==="["?r$(Y,Z,J,X):s$(Y,Z,J,X),$=Q?$Q(Y,K,",",Q):K;if(K-$&&Q==="}"){let V=h8(Y,K,$);if(V>-1)throw new o("newlines are not allowed in inline tables",{toml:Y,ptr:V})}return[W,$]}let G;if(z==='"'||z==="'"){G=S7(Y,Z);let W=v7(Y,Z,G);if(Q){if(G=d0(Y,G,Q!=="]"),Y[G]&&Y[G]!==","&&Y[G]!==Q&&Y[G]!==`
|
|
205
|
+
`&&Y[G]!=="\r")throw new o("unexpected character encountered",{toml:Y,ptr:G});G+=+(Y[G]===",")}return[W,G]}G=$Q(Y,Z,",",Q);let H=BN(Y,Z,G-+(Y[G-1]===","),Q==="]");if(!H[0])throw new o("incomplete key-value declaration: no value specified",{toml:Y,ptr:Z});if(Q&&H[1]>-1)G=d0(Y,Z+H[1]),G+=+(Y[G]===",");return[o$(H[0],Y,Z,X),G]}var qQ=F(()=>{VQ();BQ();m1();p6();/*!
|
|
212
206
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
213
207
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
214
208
|
*
|
|
@@ -234,9 +228,9 @@ ${J}`,Z);this.line=Q,this.column=X,this.codeblock=J}}/*!
|
|
|
234
228
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
235
229
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
236
230
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
237
|
-
*/function
|
|
238
|
-
|
|
239
|
-
`&&
|
|
231
|
+
*/});function y7(Y,Z,Q="="){let J=Z-1,X=[],z=Y.indexOf(Q,Z);if(z<0)throw new o("incomplete key-value: cannot find end of key",{toml:Y,ptr:Z});do{let G=Y[Z=++J];if(G!==" "&&G!=="\t")if(G==='"'||G==="'"){if(G===Y[Z+1]&&G===Y[Z+2])throw new o("multiline strings are not allowed in keys",{toml:Y,ptr:Z});let H=S7(Y,Z);if(H<0)throw new o("unfinished string encountered",{toml:Y,ptr:Z});J=Y.indexOf(".",H);let W=Y.slice(H,J<0||J>z?z:J),K=h8(W);if(K>-1)throw new o("newlines are not allowed in keys",{toml:Y,ptr:Z+J+K});if(W.trimStart())throw new o("found extra tokens after the string part",{toml:Y,ptr:H});if(z<H){if(z=Y.indexOf(Q,H),z<0)throw new o("incomplete key-value: cannot find end of key",{toml:Y,ptr:Z})}X.push(v7(Y,Z,H))}else{J=Y.indexOf(".",Z);let H=Y.slice(Z,J<0||J>z?z:J);if(!FN.test(H))throw new o("only letter, numbers, dashes and underscores are allowed in keys",{toml:Y,ptr:Z});X.push(H.trimEnd())}}while(J+1&&J<z);return[X,d0(Y,z+1,!0,!0)]}function s$(Y,Z,Q,J){let X={},z=new Set,G,H=0;Z++;while((G=Y[Z++])!=="}"&&G){let W={toml:Y,ptr:Z-1};if(G===`
|
|
232
|
+
`)throw new o("newlines are not allowed in inline tables",W);else if(G==="#")throw new o("inline tables cannot contain comments",W);else if(G===",")throw new o("expected key-value, found comma",W);else if(G!==" "&&G!=="\t"){let K,$=X,V=!1,[q,M]=y7(Y,Z-1);for(let T=0;T<q.length;T++){if(T)$=V?$[K]:$[K]={};if(K=q[T],(V=Object.hasOwn($,K))&&(typeof $[K]!=="object"||z.has($[K])))throw new o("trying to redefine an already defined value",{toml:Y,ptr:Z});if(!V&&K==="__proto__")Object.defineProperty($,K,{enumerable:!0,configurable:!0,writable:!0})}if(V)throw new o("trying to redefine an already defined value",{toml:Y,ptr:Z});let[B,D]=u1(Y,M,"}",Q-1,J);z.add(B),$[K]=B,Z=D,H=Y[Z-1]===","?Z-1:0}}if(H)throw new o("trailing commas are not allowed in inline tables",{toml:Y,ptr:H});if(!G)throw new o("unfinished table encountered",{toml:Y,ptr:Z});return[X,Z]}function r$(Y,Z,Q,J){let X=[],z;Z++;while((z=Y[Z++])!=="]"&&z)if(z===",")throw new o("expected value, found comma",{toml:Y,ptr:Z-1});else if(z==="#")Z=g1(Y,Z);else if(z!==" "&&z!=="\t"&&z!==`
|
|
233
|
+
`&&z!=="\r"){let G=u1(Y,Z-1,"]",Q-1,J);X.push(G[0]),Z=G[1]}if(!z)throw new o("unfinished array encountered",{toml:Y,ptr:Z});return[X,Z]}var FN;var BQ=F(()=>{VQ();qQ();m1();p6();/*!
|
|
240
234
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
241
235
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
242
236
|
*
|
|
@@ -262,9 +256,8 @@ ${J}`,Z);this.line=Q,this.column=X,this.codeblock=J}}/*!
|
|
|
262
256
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
263
257
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
264
258
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
265
|
-
*/
|
|
266
|
-
|
|
267
|
-
`&&$!=="\r"){let G=f1(Y,Z-1,"]",Q-1,X);J.push(G[0]),Z=G[1]}if(!$)throw new l("unfinished array encountered",{toml:Y,ptr:Z});return[J,Z]}/*!
|
|
259
|
+
*/FN=/^[a-zA-Z0-9-_]+[ \t]*$/});function t$(Y,Z,Q,J){let X=Z,z=Q,G,H=!1,W;for(let K=0;K<Y.length;K++){if(K){if(X=H?X[G]:X[G]={},z=(W=z[G]).c,J===0&&(W.t===1||W.t===2))return null;if(W.t===2){let $=X.length-1;X=X[$],z=z[$].c}}if(G=Y[K],(H=Object.hasOwn(X,G))&&z[G]?.t===0&&z[G]?.d)return null;if(!H){if(G==="__proto__")Object.defineProperty(X,G,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(z,G,{enumerable:!0,configurable:!0,writable:!0});z[G]={t:K<Y.length-1&&J===2?3:J,d:!1,i:0,c:{}}}}if(W=z[G],W.t!==J&&!(J===1&&W.t===3))return null;if(J===2){if(!W.d)W.d=!0,X[G]=[];X[G].push(X={}),W.c[W.i++]=W={t:1,d:!1,i:0,c:{}}}if(W.d)return null;if(W.d=!0,J===1)X=H?X[G]:X[G]={};else if(J===0&&H)return null;return[G,X,W.c]}function FQ(Y,{maxDepth:Z=1000,integersAsBigInt:Q}={}){let J={},X={},z=J,G=X;for(let H=d0(Y,0);H<Y.length;){if(Y[H]==="["){let W=Y[++H]==="[",K=y7(Y,H+=+W,"]");if(W){if(Y[K[1]-1]!=="]")throw new o("expected end of table declaration",{toml:Y,ptr:K[1]-1});K[1]++}let $=t$(K[0],J,X,W?2:1);if(!$)throw new o("trying to redefine an already defined table or value",{toml:Y,ptr:H});G=$[2],z=$[1],H=K[1]}else{let W=y7(Y,H),K=t$(W[0],z,G,0);if(!K)throw new o("trying to redefine an already defined table or value",{toml:Y,ptr:H});let $=u1(Y,W[1],void 0,Z,Q);K[1][K[0]]=$[0],H=$[1]}if(H=d0(Y,H,!0),Y[H]&&Y[H]!==`
|
|
260
|
+
`&&Y[H]!=="\r")throw new o("each key-value declaration must be followed by an end-of-line",{toml:Y,ptr:H});H=d0(Y,H)}return J}var e$=F(()=>{BQ();qQ();m1();p6();/*!
|
|
268
261
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
269
262
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
270
263
|
*
|
|
@@ -290,8 +283,16 @@ ${J}`,Z);this.line=Q,this.column=X,this.codeblock=J}}/*!
|
|
|
290
283
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
291
284
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
292
285
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
293
|
-
*/function
|
|
294
|
-
|
|
286
|
+
*/});function d1(Y){let Z=typeof Y;if(Z==="object"){if(Array.isArray(Y))return"array";if(Y instanceof Date)return"date"}return Z}function RN(Y){for(let Z=0;Z<Y.length;Z++)if(d1(Y[Z])!=="object")return!1;return Y.length!=0}function RQ(Y){return JSON.stringify(Y).replace(/\x7f/g,"\\u007f")}function MQ(Y,Z,Q,J){if(Q===0)throw Error("Could not stringify the object: maximum object depth exceeded");if(Z==="number"){if(isNaN(Y))return"nan";if(Y===1/0)return"inf";if(Y===-1/0)return"-inf";if(J&&Number.isInteger(Y))return Y.toFixed(1);return Y.toString()}if(Z==="bigint"||Z==="boolean")return Y.toString();if(Z==="string")return RQ(Y);if(Z==="date"){if(isNaN(Y.getTime()))throw TypeError("cannot serialize invalid date");return Y.toISOString()}if(Z==="object")return MN(Y,Q,J);if(Z==="array")return DN(Y,Q,J)}function MN(Y,Z,Q){let J=Object.keys(Y);if(J.length===0)return"{}";let X="{ ";for(let z=0;z<J.length;z++){let G=J[z];if(z)X+=", ";X+=YU.test(G)?G:RQ(G),X+=" = ",X+=MQ(Y[G],d1(Y[G]),Z-1,Q)}return X+" }"}function DN(Y,Z,Q){if(Y.length===0)return"[]";let J="[ ";for(let X=0;X<Y.length;X++){if(X)J+=", ";if(Y[X]===null||Y[X]===void 0)throw TypeError("arrays cannot contain null or undefined values");J+=MQ(Y[X],d1(Y[X]),Z-1,Q)}return J+" ]"}function LN(Y,Z,Q,J){if(Q===0)throw Error("Could not stringify the object: maximum object depth exceeded");let X="";for(let z=0;z<Y.length;z++)X+=`${X&&`
|
|
287
|
+
`}[[${Z}]]
|
|
288
|
+
`,X+=DQ(0,Y[z],Z,Q,J);return X}function DQ(Y,Z,Q,J,X){if(J===0)throw Error("Could not stringify the object: maximum object depth exceeded");let z="",G="",H=Object.keys(Z);for(let W=0;W<H.length;W++){let K=H[W];if(Z[K]!==null&&Z[K]!==void 0){let $=d1(Z[K]);if($==="symbol"||$==="function")throw TypeError(`cannot serialize values of type '${$}'`);let V=YU.test(K)?K:RQ(K);if($==="array"&&RN(Z[K]))G+=(G&&`
|
|
289
|
+
`)+LN(Z[K],Q?`${Q}.${V}`:V,J-1,X);else if($==="object"){let q=Q?`${Q}.${V}`:V;G+=(G&&`
|
|
290
|
+
`)+DQ(q,Z[K],q,J-1,X)}else z+=V,z+=" = ",z+=MQ(Z[K],$,J,X),z+=`
|
|
291
|
+
`}}if(Y&&(z||!G))z=z?`[${Y}]
|
|
292
|
+
${z}`:`[${Y}]`;return z&&G?`${z}
|
|
293
|
+
${G}`:z||G}function LQ(Y,{maxDepth:Z=1000,numbersAsFloat:Q=!1}={}){if(d1(Y)!=="object")throw TypeError("stringify can only be called with an object");let J=DQ(0,Y,"",Z,Q);if(J[J.length-1]!==`
|
|
294
|
+
`)return J+`
|
|
295
|
+
`;return J}var YU;var ZU=F(()=>{/*!
|
|
295
296
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
296
297
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
297
298
|
*
|
|
@@ -317,16 +318,7 @@ ${J}`,Z);this.line=Q,this.column=X,this.codeblock=J}}/*!
|
|
|
317
318
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
318
319
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
319
320
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
320
|
-
*/
|
|
321
|
-
`}[[${Z}]]
|
|
322
|
-
`,J+=c2(0,Y[$],Z,Q,X);return J}function c2(Y,Z,Q,X,J){if(X===0)throw Error("Could not stringify the object: maximum object depth exceeded");let $="",G="",K=Object.keys(Z);for(let H=0;H<K.length;H++){let W=K[H];if(Z[W]!==null&&Z[W]!==void 0){let z=h1(Z[W]);if(z==="symbol"||z==="function")throw TypeError(`cannot serialize values of type '${z}'`);let q=f$.test(W)?W:d2(W);if(z==="array"&&iF(Z[W]))G+=(G&&`
|
|
323
|
-
`)+oF(Z[W],Q?`${Q}.${q}`:q,X-1,J);else if(z==="object"){let V=Q?`${Q}.${q}`:q;G+=(G&&`
|
|
324
|
-
`)+c2(V,Z[W],V,X-1,J)}else $+=q,$+=" = ",$+=p2(Z[W],z,X,J),$+=`
|
|
325
|
-
`}}if(Y&&($||!G))$=$?`[${Y}]
|
|
326
|
-
${$}`:`[${Y}]`;return $&&G?`${$}
|
|
327
|
-
${G}`:$||G}function l2(Y,{maxDepth:Z=1000,numbersAsFloat:Q=!1}={}){if(h1(Y)!=="object")throw TypeError("stringify can only be called with an object");let X=c2(0,Y,"",Z,Q);if(X[X.length-1]!==`
|
|
328
|
-
`)return X+`
|
|
329
|
-
`;return X}/*!
|
|
321
|
+
*/YU=/^[a-z0-9-_]+$/i});var QU=F(()=>{e$();ZU();UQ();p6();/*!
|
|
330
322
|
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
331
323
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
332
324
|
*
|
|
@@ -352,106 +344,121 @@ ${G}`:$||G}function l2(Y,{maxDepth:Z=1000,numbersAsFloat:Q=!1}={}){if(h1(Y)!=="o
|
|
|
352
344
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
353
345
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
354
346
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
355
|
-
*/var
|
|
356
|
-
Values that are expensive to get are cached for faster subsequent access.`,"cache.enabled":"Whether caching is enabled","cache.maxAgeMinutes":"Maximum age of cache entries in minutes",
|
|
357
|
-
`);else process.stdout.write(
|
|
358
|
-
`)}fatal(Y){
|
|
359
|
-
`),
|
|
360
|
-
`+Q:Q;if(Buffer.byteLength(
|
|
361
|
-
`),G=Math.floor(
|
|
362
|
-
`)}
|
|
363
|
-
|
|
347
|
+
*/});var c6,JU,TQ;var _Q=F(()=>{J0();c6={llm:{provider:"openai",model:"gpt-5-nano",temperature:0.14,maxTokens:void 0,apiKey:void 0,baseUrl:void 0,showThinking:!0},lint:{onPushBehavior:"off",maxFileSizeKb:1024},stash:{undoLimit:10},commit:{commitPattern:"inherit",guidelineCacheDays:30},cache:{enabled:!0,maxAgeMinutes:GZ},parallel:{init:"submodule"},defaultEditor:"code"},JU={"llm.provider":"GDX_LLM_PROVIDER","llm.apiKey":"GDX_LLM_API_KEY","llm.baseUrl":"GDX_LLM_BASE_URL","llm.model":"GDX_LLM_MODEL","llm.temperature":"GDX_LLM_TEMPERATURE","llm.maxTokens":"GDX_LLM_MAX_TOKENS","llm.showThinking":"GDX_LLM_SHOW_THINKING","lint.onPushBehavior":"GDX_LINT_ON_PUSH_BEHAVIOR","lint.maxFileSizeKb":"GDX_LINT_MAX_FILE_SIZE_KB","stash.undoLimit":"GDX_STASH_UNDO_LIMIT","commit.commitPattern":"GDX_COMMIT_PATTERN","commit.guidelineCacheDays":"GDX_COMMIT_GUIDELINE_CACHE_DAYS","cache.enabled":"GDX_CACHE_ENABLED","cache.maxAgeMinutes":"GDX_CACHE_MAX_AGE_MINUTES","parallel.init":"GDX_PARALLEL_INIT",defaultEditor:"GDX_DEFAULT_EDITOR"},TQ={llm:"Configuration for the Language Model (LLM) integration","llm.provider":"LLM provider to use (e.g., openai)","llm.apiKey":"API key for the LLM provider","llm.baseUrl":"Base URL for the LLM API (optional)","llm.model":"Model to use for LLM requests","llm.temperature":"Temperature for LLM generation (0-2)","llm.maxTokens":"Maximum tokens for LLM responses","llm.showThinking":"Whether to show part of LLM reasoning messages",lint:"Configuration for post-commit linting","lint.onPushBehavior":"Lint behavior before push (off, error, warning)","lint.maxFileSizeKb":"Maximum allowed file size in KB","stash.undoLimit":"Max number of stash drops to keep in history",commit:"Configuration for commit message generation","commit.commitPattern":"Commit message pattern (inherit: learn from repo, comprehensive: fixed format)","commit.guidelineCacheDays":"Days to cache learned commit guidelines per repository",cache:`Configuration for caching mechanism.
|
|
348
|
+
Values that are expensive to get are cached for faster subsequent access.`,"cache.enabled":"Whether caching is enabled","cache.maxAgeMinutes":"Maximum age of cache entries in minutes",parallel:"Configuration for parallel worktree automation","parallel.init":"Comma-separated init behaviors for new forks (submodule, pkg)",defaultEditor:"Default code editor to open files with"}});import l6 from"fs";import NQ from"path";import TN from"os";var XU=null,zU,_N,NN,wN,X0,L;var K0=F(()=>{Q0();J0();O0();zU={off:-1,fatal:0,error:1,warn:2,info:3,debug:4},_N={off:"BgBlue",fatal:"BgRed",error:"BgRed",warn:"BgYellow",info:"BgBlue",debug:"BgCyan"},NN={off:"",fatal:"FATAL",error:"ERROR",warn:"WARN",info:"INFO",debug:"DEBUG"},wN={off:"Cyan",fatal:"Red",error:"Red",warn:"Yellow",info:"Cyan",debug:"Magenta"};X0=class X0{static logFile=NQ.join(TN.tmpdir(),"gdx","gdx.log");moduleName;static initialized=!1;static allLogs=[];constructor(Y){this.moduleName=Y,X0.ensureInitialized()}static ensureInitialized(){if(!X0.initialized){if(X0.initialized=!0,!K5)return;X0.initializeLogDirectory(),process.on("exit",()=>X0.flushLogs())}}static initializeLogDirectory(){let Y=NQ.dirname(X0.logFile);try{if(!l6.existsSync(Y))l6.mkdirSync(Y,{recursive:!0})}catch{}}static logInternal(Y,Z,Q){let X={timestamp:new Date().toISOString(),level:Y,message:Z,module:Q};if(XU)XU(X);if(zU[Y]<=zU[c.logLevel])X0.printMessage(Y,Z,Q);if(!K5)return;X0.ensureInitialized(),X0.allLogs.push(X)}static printMessage(Y,Z,Q){let J=_N[Y],X=NN[Y],z=wN[Y],G=n(Z,100,{indent:" "}),H=U(J)+U("Bright")+U("White")+` ${X} `+U()+U("Invert")+` ${Q} ${U()+U(z)} ${G}`+U();if(Y==="fatal"||Y==="error")process.stderr.write(H+`
|
|
349
|
+
`);else process.stdout.write(H+`
|
|
350
|
+
`)}fatal(Y){X0.logInternal("fatal",Y,this.moduleName)}error(Y){X0.logInternal("error",Y,this.moduleName)}warn(Y){X0.logInternal("warn",Y,this.moduleName)}info(Y){X0.logInternal("info",Y,this.moduleName)}debug(Y){X0.logInternal("debug",Y,this.moduleName)}static fatal(Y,Z="gdx"){X0.logInternal("fatal",Y,Z)}static error(Y,Z="gdx"){X0.logInternal("error",Y,Z)}static warn(Y,Z="gdx"){X0.logInternal("warn",Y,Z)}static info(Y,Z="gdx"){X0.logInternal("info",Y,Z)}static debug(Y,Z="gdx"){X0.logInternal("debug",Y,Z)}static flushLogs(){if(X0.allLogs.length===0)return;try{let Y=NQ.dirname(X0.logFile);if(!l6.existsSync(Y))l6.mkdirSync(Y,{recursive:!0});let Z="";if(l6.existsSync(X0.logFile))Z=l6.readFileSync(X0.logFile,"utf-8");let Q=X0.allLogs.map(({timestamp:z,level:G,message:H,module:W})=>{let K=G.toUpperCase().padEnd(5);return H=n(zX(H),120,{indent:33,redundancyLv:-1,mode:"strict"}),`${z} [${K}] ${W}: ${H}`}).join(`
|
|
351
|
+
`),J=Z?Z+`
|
|
352
|
+
`+Q:Q;if(Buffer.byteLength(J,"utf-8")>jX){let z=J.split(`
|
|
353
|
+
`),G=Math.floor(z.length/2);J=z.slice(G).join(`
|
|
354
|
+
`)}l6.writeFileSync(X0.logFile,J,"utf-8")}catch{}}};L=X0});import ON from"path";async function wQ(){return GU??=import("keytar"),await GU}class HU{configPath;config=structuredClone(c6);loaded=!1;logger=new L("ConfigService");constructor(Y){this.configPath=Y||F1}async load(){if(this.loaded)return;try{let Y=await KY(this.configPath,"utf-8"),Z=FQ(Y);this.config=this.mergeConfig(c6,Z)}catch(Y){let Z=new s(Y);if(Z.code!=="ENOENT")this.logger.warn(`Failed to parse config file at ${this.configPath}: ${Z.message}`);this.config=structuredClone(c6)}this.applyEnvOverrides(),this.loaded=!0}async save(){let Y=this.removeSecureKeys(this.config),Z=LQ(Y),Q=ON.dirname(this.configPath);if(!t(Q))WY(Q,{recursive:!0});await rY(this.configPath,Z,"utf-8")}get(Y,Z){let Q=Y.split("."),J=this.config;for(let X of Q)if(J&&typeof J==="object"&&X in J)J=J[X];else return Z;return J}async getSecure(Y,Z){let Q=this.get(Y);if(Q!==void 0)return Q;if(tY.includes(Y))try{let X=await(await wQ()).getPassword(JZ,Y);if(X){let z=Y.split("."),G=this.config;for(let H=0;H<z.length-1;H++){let W=z[H];if(!(W in G)||typeof G[W]!=="object")G[W]={};G=G[W]}return G[z[z.length-1]]=X,X}}catch(J){this.logger.warn(`Failed to load secure key '${Y}' from keychain:
|
|
355
|
+
`+s.from(J).toString({color:!0}))}return Z}async set(Y,Z){let Q=Y.split("."),J=this.config;for(let G=0;G<Q.length-1;G++){let H=Q[G];if(!(H in J)||typeof J[H]!=="object")J[H]={};J=J[H]}let X=Q[Q.length-1],z=this.get(Y);if(z!==void 0&&typeof Z!==typeof z){this.logger.warn(`Type mismatch for '${Y}'. Expected ${typeof z}, got ${typeof Z}. Ignoring value.`);return}if(tY.includes(Y))try{await(await wQ()).setPassword(JZ,Y,String(Z))}catch(G){this.logger.warn(`Failed to save secure key '${Y}' to keychain:
|
|
356
|
+
`+s.from(G).toString({color:!0}))}J[X]=Z}getAll(){return this.config}getConfigPath(){return this.configPath}isDefault(Y){let Z=Y.split("."),Q=this.config,J=c6;for(let X of Z){if(Q&&typeof Q==="object"&&X in Q)Q=Q[X];else Q=void 0;if(J&&typeof J==="object"&&X in J)J=J[X];else J=void 0}return Q===J}mergeConfig(Y,Z){let Q=structuredClone(Y),J=(X,z,G="")=>{for(let H in z){let W=G?`${G}.${H}`:H,K=z[H],$=X[H];if($===void 0)continue;if(typeof K==="object"&&K!==null&&!Array.isArray(K))if(typeof $==="object"&&$!==null)J(X[H],K,W);else this.logger.warn(`Type mismatch for '${W}'. Expected ${typeof $}, got object. Ignoring value.`);else if(typeof K!==typeof $)this.logger.warn(`Type mismatch for '${W}'. Expected ${typeof $}, got ${typeof K}. Ignoring value.`);else X[H]=K}};return J(Q,Z),Q}removeSecureKeys(Y){let Z=structuredClone(Y);for(let Q of tY){let J=Q.split("."),X=Z;for(let z=0;z<J.length-1;z++){if(!X[J[z]])return Z;X=X[J[z]]}delete X[J[J.length-1]]}return Z}async deleteSecureKey(Y){if(!tY.includes(Y))return!1;try{return await(await wQ()).deletePassword(JZ,Y)}catch{return!1}}applyEnvOverrides(){for(let[Y,Z]of Object.entries(JU)){let Q=process.env[Z];if(Q!==void 0){let J=this.get(Y),X=Q;if(typeof J==="number"){let z=Number(Q);if(!isNaN(z))X=z;else{this.logger.warn(`Environment variable ${Z} has invalid number value '${Q}'. Ignoring.`);continue}}else if(typeof J==="boolean")X=Q.toLowerCase()==="true";this.set(Y,X)}}}}function IN(){let Y=process.env.GDX_CONFIG_PATH;if(Y)return Y;if(t(F1))return F1;if(t(W5))return W5;return F1}async function $0(){if(!f7)f7=new HU(IN()),await f7.load();return f7}var GU=null,f7=null;var XY=F(()=>{QU();g0();_Q();J0();Q0();K0()});import EN from"path";class KU{cachePath;isDisabled=!1;cache={...WU};memoryData={};memoryEntryMeta={};loaded=!1;dirty=!1;loadingPromise=null;constructor(Y){this.cachePath=Y||o0}async ensureLoaded(){if(this.loaded)return;if(this.loadingPromise){await this.loadingPromise;return}this.loadingPromise=this.load();try{await this.loadingPromise}finally{this.loadingPromise=null}}pruneExpiredKeys(){let Y=Date.now(),Z=0,Q=[];for(let[J,X]of Object.entries(this.cache.entryMeta))if(Y>X.expiresAt)Q.push(J);for(let J of Q){delete this.cache.entryMeta[J];let X=J.split("."),z=[],G=this.cache.data;for(let H of X)if(G&&typeof G==="object"&&H in G)z.push({obj:G,key:H}),G=G[H];else break;if(z.length>0){let H=z[z.length-1];delete H.obj[H.key],Z++}for(let H=z.length-2;H>=0;H--){let{obj:W,key:K}=z[H],$=W[K];if($&&typeof $==="object"&&Object.keys($).length===0)delete W[K];else break}}if(this.cache.meta.lastPruneAt=Y,Z>0)this.cache.meta.updatedAt=Y,this.dirty=!0;return Z}async load(){if(this.loaded)return;if(!(await $0()).get("cache.enabled")){this.resetCache(!1),this.loaded=!0,this.isDisabled=!0,L.debug("Cache is disabled via configuration","cache");return}try{let Z=await KY(this.cachePath,"utf-8"),Q=JSON.parse(Z);if(!Q.meta||!Q.data){this.resetCache(!1),this.loaded=!0;return}if(Q.meta.version!==YY){L.debug(`Cache version mismatch: stored=${Q.meta.version}, current=${YY}. Resetting cache.`,"cache"),this.resetCache(!1),this.loaded=!0;return}if(!Q.entryMeta||!Q.meta.lastPruneAt){L.debug("Existing cache file' schema mismatch; resetting cache to newer version","cache"),this.resetCache(!1),this.loaded=!0;return}this.cache=Q;let X=(Date.now()-this.cache.meta.lastPruneAt)/zZ;if(X>=EX){L.debug(`Last prune was ${X.toFixed(1)} days ago. Running cache pruning...`,"cache");let z=this.pruneExpiredKeys();if(z>0)L.debug(`Pruned ${z} expired cache entries`,"cache");else L.debug("No expired entries found during pruning","cache")}}catch(Z){let Q=new s(Z);if(Q.code!=="ENOENT")L.debug(`Failed to parse cache file at ${this.cachePath}: ${Q.message}`,"cache");this.resetCache(!1)}this.loaded=!0}resetCache(Y=!0){if(this.cache=structuredClone(WU),Y)this.dirty=!0}resetMemoryCache(){this.memoryData={},this.memoryEntryMeta={}}async get(Y,Z){if(this.isDisabled)return Z;await this.ensureLoaded();let Q=this.cache.entryMeta[Y];if(!Q)return Z;if(Date.now()>Q.expiresAt)return L.debug(`Cache entry expired: ${Y}. expiresAt=${new Date(Q.expiresAt).toISOString()}, now=${new Date().toISOString()}`,"cache"),await this.delete(Y),Z;let J=Y.split("."),X=this.cache.data;for(let z of J)if(X&&typeof X==="object"&&z in X)X=X[z];else return Z;return X}async getOneOff(Y,Z){if(await this.ensureLoaded(),this.isDisabled)return Z;if(!this.memoryEntryMeta[Y])return Z;let J=Y.split("."),X=this.memoryData;for(let z of J)if(X&&typeof X==="object"&&z in X)X=X[z];else return Z;return X}async set(Y,Z,Q){if(this.isDisabled)return;let J=await $0();await this.ensureLoaded();let X=Y.split("."),z=this.cache.data,G=Q?.maxAgeMinutes??J.get("cache.maxAgeMinutes")??GZ;for(let K=0;K<X.length-1;K++){let $=X[K];if(!($ in z)||typeof z[$]!=="object")z[$]={};z=z[$]}let H=X[X.length-1];z[H]=Z;let W=Date.now();this.cache.entryMeta[Y]={createdAt:this.cache.entryMeta[Y]?.createdAt??W,updatedAt:W,expiresAt:W+G*60*1000},this.cache.meta.updatedAt=W,this.dirty=!0}async setOneOff(Y,Z){if(await this.ensureLoaded(),this.isDisabled)return;let Q=Y.split("."),J=this.memoryData;for(let G=0;G<Q.length-1;G++){let H=Q[G];if(!(H in J)||typeof J[H]!=="object")J[H]={};J=J[H]}let X=Q[Q.length-1];J[X]=Z;let z=Date.now();this.memoryEntryMeta[Y]={createdAt:this.memoryEntryMeta[Y]?.createdAt??z,updatedAt:z}}async delete(Y){if(this.isDisabled)return!1;if(await this.ensureLoaded(),!this.cache.entryMeta[Y])return!1;delete this.cache.entryMeta[Y];let Z=Y.split("."),Q=[],J=this.cache.data;for(let X of Z)if(J&&typeof J==="object"&&X in J)Q.push({obj:J,key:X}),J=J[X];else return!1;if(Q.length>0){let X=Q[Q.length-1];delete X.obj[X.key]}for(let X=Q.length-2;X>=0;X--){let{obj:z,key:G}=Q[X],H=z[G];if(H&&typeof H==="object"&&Object.keys(H).length===0)delete z[G];else break}return this.cache.meta.updatedAt=Date.now(),this.dirty=!0,L.debug(`Cache entry deleted: ${Y}`,"cache"),!0}async deleteOneOff(Y){if(await this.ensureLoaded(),this.isDisabled)return!1;if(!this.memoryEntryMeta[Y])return!1;delete this.memoryEntryMeta[Y];let Z=Y.split("."),Q=[],J=this.memoryData;for(let X of Z)if(J&&typeof J==="object"&&X in J)Q.push({obj:J,key:X}),J=J[X];else return!1;if(Q.length>0){let X=Q[Q.length-1];delete X.obj[X.key]}for(let X=Q.length-2;X>=0;X--){let{obj:z,key:G}=Q[X],H=z[G];if(H&&typeof H==="object"&&Object.keys(H).length===0)delete z[G];else break}return!0}async getAll(){return await this.ensureLoaded(),this.cache}getCachePath(){return this.cachePath}flush(){if(!this.dirty)return;try{let Y=EN.dirname(this.cachePath);WY(Y,{recursive:!0});let Z=JSON.stringify(this.cache);oY(this.cachePath,Z,"utf-8"),this.dirty=!1,L.debug(`Cache flushed to ${this.cachePath}`,"cache")}catch(Y){let Z=new s(Y);L.warn(`Failed to flush cache: ${Z.message}`,"cache")}}async clear(){await this.ensureLoaded(),this.resetCache(),this.resetMemoryCache()}}async function z0(){if(!H6){if(H6=new KU,await H6.ensureLoaded(),!H6.isDisabled)CN()}return H6}function b7(){H6=null}function CN(){L.debug("Registering cache flush hook on exit","cache"),XX(()=>{if(H6)H6.flush()})}var WU,H6=null;var W6=F(()=>{g0();J0();Q0();K0();XY();WU={meta:{version:YY,createdAt:Date.now(),updatedAt:Date.now(),lastPruneAt:Date.now()},data:{},entryMeta:{}}});import $U from"crypto";async function UU(Y){let Z=await z0(),Q="git.version",J=await Z.get("git.version");if(J)return L.debug("Cache hit for git.version","cache-ctrl"),J;try{let{stdout:X}=await x`${Y} --version`,z=X.trim().match(/(\d{1,2}\.\d{1,3}\.\d{1,3})/i)?.[1]||"unknown";return await Z.set("git.version",z),L.debug(`Cache store for git.version: ${z}`,"cache-ctrl"),z}catch(X){throw L.warn(`Failed to get git version: ${X}`,"cache-ctrl"),X}}async function t0(Y){let Z=await z0(),Q=process.cwd(),X="git.repoRoot."+$U.createHash("sha1").update(Q).digest("hex"),z=await Z.get(X);if(z&&t(z))return L.debug(`Cache hit for ${X}`,"cache-ctrl"),z;try{let{stdout:G}=await x`${Y} rev-parse --show-toplevel`,H=G.trim();return await Z.set(X,H),L.debug(`Cache store for ${X}: ${H}`,"cache-ctrl"),H}catch(G){throw L.warn(`Failed to get repo root: ${G}`,"cache-ctrl"),G}}async function VU(Y,Z){let Q=await z0(),J=`which.${Y}`,X=await Q.get(J);if(X!=null&&t(X))return L.debug(`Cache hit for ${J}`,"cache-ctrl"),X;try{let z=Z?await Z():await $6(Y);if(!z)return null;return await Q.set(J,z),L.debug(`Cache store for ${J}: ${z}`,"cache-ctrl"),z}catch(z){throw L.warn(`Failed to get which exec for ${Y}: ${z}`,"cache-ctrl"),z}}async function K6(Y,Z){let Q=await z0(),J=`git.config.${Z}`,X=await Q.get(J);if(X!==void 0)return L.debug(`Cache hit for ${J}`,"cache-ctrl"),X;try{let{stdout:z}=await x`${Y} config ${Z}`,G=z.trim();if(G)await Q.set(J,G),L.debug(`Cache store for ${J}: ${G}`,"cache-ctrl");return G}catch(z){return L.warn(`Git config ${Z} not found or failed`,"cache-ctrl"),L.debug(`Error details: ${s.from(z)}`,"cache-ctrl"),""}}async function qU(Y,Z=!1){let Q=await z0(),J=`git.branches${Z?".remote":""}`,X=await Q.get(J);if(X)return L.debug(`Cache hit for ${J}`,"cache-ctrl"),X;try{let z=Z?["for-each-ref","--format=%(refname:short)","refs/remotes/"]:["for-each-ref","--format=%(refname:short)","refs/heads/"],{stdout:G}=await x`${Y} ${z}`,H=G.trim().split(`
|
|
357
|
+
`).filter((W)=>W.length>0);return await Q.set(J,H),L.debug(`Cache store for ${J}: ${H.length} branches`,"cache-ctrl"),H}catch(z){return L.warn(`Failed to get git branches: ${s.from(z)}`,"cache-ctrl"),[]}}var RY=F(()=>{A0();W6();K0();g0();Q0()});import g8 from"path";import{createInterface as jN}from"readline";import{writeFile as kN}from"fs/promises";import{unlink as AN}from"fs/promises";function h7(Y={}){let Z=new AbortController;return{$:bY({cancelSignal:Z.signal,...Y}),abort:()=>Z.abort(),signal:Z.signal}}async function p1(Y){let Z=jN({input:process.stdin,output:process.stdout});return new Promise((Q)=>{Z.question(Y,(J)=>{Z.close(),Q(J.trim())})})}async function $6(Y){return await VU(Y,async()=>{if(Y.includes(g8.sep)){let z=g8.resolve(Y);return await X5(z)?z:null}let Z=process.platform==="win32",Q=[""];if(Z)Q=["",...(process.env.PATHEXT||".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH").split(";").filter(Boolean)];let J=[];if(J.push(process.cwd()),process.argv[1])J.push(g8.dirname(process.argv[1]));if(J.push(g8.dirname(process.execPath)),process.env.PATH)J.push(...process.env.PATH.split(g8.delimiter));let X=[...new Set(J)];for(let z of X){if(!z)continue;for(let G of Q){let H=g8.join(z,Y+G);if(await X5(H))return H}}return null})}async function g7(Y){try{switch(process.platform){case"win32":return await x({input:Y})`clip`,!0;case"darwin":return await x({input:Y})`pbcopy`,!0;case"linux":try{return await x({input:Y})`xclip -selection clipboard`,!0}catch{return await x({input:Y})`xsel --clipboard --input`,!0}default:return!1}}catch{return!1}}function i6(Y={}){if(Y={message:"",interval:80,frames:OX,animateGradient:!1,gradientColor:j.Zinc100,gradientColorBg:j.Zinc700,gradientSpeed:0.11,...Y},!process.stdout.isTTY)return{stop:()=>{},options:Y};let Z=0,Q=0,J=!0,X=null,z=U();process.stdout.write("\x1B[?25l");let G=()=>{if(!J)return;let H=Y.frames[Z%Y.frames.length];if(Y.message)if(Y.animateGradient&&V1.supportsColor>=3){let W=Q%2;if(W<=1){let K=PX.easeInOut(W),$=AX(Y.message,Y.gradientColor,Y.gradientColorBg,K,0.3);H+=" "+$}else H+=" "+U(M1(Y.gradientColorBg))+Y.message+z;Q+=Y.gradientSpeed??0.1}else H+=" "+Y.message;process.stdout.write("\r\x1B[K"+H),Z++};return X=setInterval(G,Y.interval),G(),{stop:()=>{if(J=!1,X)clearInterval(X),X=null;process.stdout.write("\r\x1B[K\x1B[?25h")},options:Y}}async function OQ(Y){let Q=(await $0()).getAll().defaultEditor,J=await $6(Q);if(!J)throw new s(`Default editor "${Q}" not found in PATH. Set a valid editor in the configuration.`,"EDITOR_NOT_FOUND");await W0`${J} ${Y}`}async function FU(Y){if(!Y){if(P6)await AN(P6).catch(()=>{});c.exitCodeOverride=-1;return}if(P6)await kN(P6,Y,"utf-8");c.exitCodeOverride=A6}function RU(Y){let Z=[],Q="",J=!1,X=!1;for(let z=0;z<Y.length;z++){let G=Y[z];if(G==="'"&&!X)J=!J;else if(G==='"'&&!J)X=!X;else if(G===" "&&!J&&!X){if(Q)Z.push(Q),Q=""}else Q+=G}if(Q)Z.push(Q);return Z}async function m7(Y,Z,Q=null,J=">"){let X=0;try{if(Q){let{exitCode:z}=await bY({stdout:{file:Q,append:J===">>"},stderr:"inherit"})`${Y} ${Z}`;X=z}else{let{exitCode:z}=await W0`${Y} ${Z}`;X=z}}catch(z){let G=s.from(z);if(G.name===UY.name&&G.message.startsWith("Command failed"))return X||1;return L.error(`Command failed.
|
|
358
|
+
`+p(G,{color:!0})),1}return X??0}var BU=()=>process.stdout.isTTY&&process.stdin.isTTY,W0;var A0=F(()=>{h1();Q0();R0();S0();J0();XY();O0();RY();K0();h1();W0=bY({stdout:"inherit",stderr:"inherit"})});import PN from"crypto";import q0 from"path";function hY(Y,Z){let Q=PN.createHash("sha1").update(Z).digest("hex");return`${Y}.${Q}`}function gY(Y,Z){let Q=Array.isArray(Y)?Y.join(" "):Y,J=Z?q0.resolve(Z):process.cwd();return`${Q}|${J}`}async function u7(Y){try{await x`${Y} rev-parse --is-inside-work-tree`}catch{return L.error("This command must be run inside a git repository.","git"),!1}return!0}async function EQ(Y,Z){let Q=await z0(),J=hY("git.stashEntry",`${gY(Y)}|${Z}`),X=await Q.getOneOff(J);if(X!==void 0)return X;try{let z=`stash@{${Z}}`,{stdout:G}=await x`${Y} rev-parse ${z}`,{stdout:H}=await x`${Y} log -1 --format=%s ${z}`,W={sha:G.trim(),message:H.trim()};return await Q.setOneOff(J,W),W}catch{return await Q.setOneOff(J,null),null}}async function DU(Y,Z,Q){await x`${Y} stash store -m ${Q} ${Z}`}function xN(Y){let Z=Y.trim();if(!Z)return"";Z=Z.replace(/\\+/g,"/");let Q=Z.match(/^(?:[^@]+@)?([^:/]+):(.+)$/);if(Q&&!Z.includes("://")){let J=Q[1].toLowerCase(),X=Q[2];return IQ(J,X)}try{let J=new URL(Z),X=J.hostname.toLowerCase(),z=J.pathname;return IQ(X,z)}catch{return IQ("",Z)}}async function SN(Y){let Z=await z0(),Q=hY("git.defaultRemoteName",gY(Y)),J=await Z.getOneOff(Q);if(J!==void 0)return J;let X=null;try{let{stdout:z}=await x`${Y} remote`,G=z.trim().split(`
|
|
359
|
+
`).map((H)=>H.trim()).filter(Boolean);if(G.length===0)X=null;else{let H="";try{let{stdout:W}=await x`${Y} rev-parse --abbrev-ref HEAD`,K=W.trim();if(K&&K!=="HEAD"){let{stdout:$}=await x`${Y} config branch.${K}.remote`;H=$.trim()}}catch{H=""}if(H&&G.includes(H))X=H;else if(G.includes("origin"))X="origin";else X=G[0]}}catch{X=null}return await Z.setOneOff(Q,X),X}async function LU(Y){let Z=await z0(),Q=hY("git.normalizedRemoteUrl",gY(Y)),J=await Z.getOneOff(Q);if(J!==void 0)return J;let X=await SN(Y);if(!X)return await Z.setOneOff(Q,null),null;try{let{stdout:z}=await x`${Y} remote get-url ${X}`,G=z.trim();if(!G)return await Z.setOneOff(Q,null),null;let W=xN(G)||null;return await Z.setOneOff(Q,W),W}catch{return await Z.setOneOff(Q,null),null}}async function TU(Y){let Z=await z0(),Q=hY("git.mainWorktreeRoot",gY(Y)),J=await Z.getOneOff(Q);if(J!==void 0)return J;let X="";try{let{stdout:z}=await x`${Y} rev-parse --show-toplevel`;X=z.trim()}catch{X=process.cwd()}try{let{stdout:z}=await x`${Y} rev-parse --git-common-dir`,G=z.trim();if(!G)return await Z.setOneOff(Q,X),X;let H=q0.isAbsolute(G)?G:q0.resolve(X,G);if(H.replace(/\\/g,"/").includes("/.git/worktrees/")){let V=q0.dirname(q0.dirname(H)),M=q0.dirname(V)||X;return await Z.setOneOff(Q,M),M}try{let q=aY(H,"utf-8").split(`
|
|
360
|
+
`).map((M)=>M.trim()).find((M)=>M.toLowerCase().startsWith("gitdir:"));if(q){let M=q.split(":").slice(1).join(":").trim(),B=q0.isAbsolute(M)?M:q0.resolve(X,M);if(B.replace(/\\/g,"/").includes("/.git/worktrees/")){let T=q0.dirname(q0.dirname(B)),w=q0.dirname(T)||X;return await Z.setOneOff(Q,w),w}}}catch{}let $=q0.dirname(H)||X;return await Z.setOneOff(Q,$),$}catch{return await Z.setOneOff(Q,X),X}}async function CQ(Y,Z){let Q=await z0(),J=hY("git.cherryPickInProgress",`${gY(Y,Z)}|${q0.resolve(Z)}`),X=await Q.getOneOff(J);if(X!==void 0)return X;try{return await x`${Y} -C ${Z} rev-parse -q --verify CHERRY_PICK_HEAD`,await Q.setOneOff(J,!0),!0}catch{return await Q.setOneOff(J,!1),!1}}function MU(Y){let Z=q0.resolve(Y).replace(/\\/g,"/");return process.platform==="win32"?Z.toLowerCase():Z}function jQ(Y){return Y.trim().replace(/^"|"$/g,"").replace(/\\/g,"/")}async function vN(Y){let Z=await z0(),Q=hY("git.worktreeList",gY(Y)),J=await Z.getOneOff(Q);if(J!==void 0)return J;try{let X=(await x`${Y} worktree list --porcelain`).stdout.trim();if(!X)return await Z.setOneOff(Q,[]),[];let z=[],G=null;for(let H of X.split(`
|
|
361
|
+
`)){if(!H.trim())continue;if(H.startsWith("worktree ")){if(G)z.push(G);G={path:H.slice(9).trim(),locked:!1,lockReason:null,prunable:!1};continue}if(!G)continue;if(H.startsWith("locked")){G.locked=!0;let W=H.slice(6).trim();G.lockReason=W.length>0?W:null}else if(H.startsWith("prunable"))G.prunable=!0}if(G)z.push(G);return await Z.setOneOff(Q,z),z}catch(X){return L.debug(p(X,{color:!0}),"git"),await Z.setOneOff(Q,[]),[]}}async function kQ(Y){let Z=await z0(),Q=hY("git.worktreeList",gY(Y));await Z.deleteOneOff(Q)}async function AQ(Y,Z){let Q=await vN(Y),J=MU(Z);return Q.find((X)=>MU(X.path)===J)??null}async function d7(Y){try{await x`${Y} worktree prune --expire now`}catch(Z){L.debug(p(Z,{color:!0}),"git")}finally{await kQ(Y)}}async function yN(Y,Z,Q){let J=await z0(),X=`${gY(Y,Z)}|${Q}`,z=hY("git.path",X),G=await J.getOneOff(z);if(G!==void 0)return G;try{let H=(await x`${Y} -C ${Z} rev-parse --git-path ${Q}`).stdout.trim();if(!H)return await J.setOneOff(z,null),null;let W=q0.isAbsolute(H)?H:q0.resolve(Z,H);return await J.setOneOff(z,W),W}catch{return await J.setOneOff(z,null),null}}async function _U(Y,Z){let Q=[{label:"merge",path:"MERGE_HEAD"},{label:"cherry-pick",path:"CHERRY_PICK_HEAD"},{label:"revert",path:"REVERT_HEAD"},{label:"rebase",path:"rebase-apply"},{label:"rebase",path:"rebase-merge"},{label:"bisect",path:"BISECT_LOG"},{label:"sequencer",path:"sequencer"}],J=new Set;for(let X of Q){let z=await yN(Y,Z,X.path);if(!z)continue;if(t(z))J.add(X.label)}return Array.from(J)}async function PQ(Y,Z){let Q=await z0(),J=hY("git.submodules",gY(Y,Z)),X=await Q.getOneOff(J);if(X!==void 0)return X;try{let z="";try{z=(await x`${Y} -C ${Z} config --file .gitmodules --get-regexp path`).stdout.trim()}catch{z=""}let G=z.split(`
|
|
362
|
+
`).map((B)=>B.trim()).filter((B)=>B.length>0).map((B)=>{return B.match(/^submodule\.(.+?)\.path\s+(.+)$/)?.[2]?.trim()??""}).filter((B)=>B.length>0),H=q0.join(Z,".gitmodules"),W=[];if(t(H))try{W=aY(H,"utf-8").split(`
|
|
363
|
+
`).map((D)=>D.trim()).map((D)=>D.match(/^path\s*=\s*(.+)$/)?.[1]?.trim()??"").filter((D)=>D.length>0)}catch{W=[]}let K=[];try{K=(await x`${Y} -C ${Z} ls-files --stage`).stdout.split(`
|
|
364
|
+
`).map((D)=>D.trim()).filter((D)=>D.startsWith("160000 ")).map((D)=>D.match(/^160000 [0-9a-f]{40} \d\t(.+)$/)?.[1]?.trim()??"").filter((D)=>D.length>0)}catch{K=[]}let $=new Set([...G,...W,...K]);if($.size===0)return await Q.setOneOff(J,[]),[];let V=Array.from($),q=new Map;try{let D=(await x`${Y} -C ${Z} submodule status --recursive`).stdout.split(`
|
|
365
|
+
`).map((T)=>T.trim()).filter((T)=>T.length>0&&!T.startsWith("Entering "));for(let T of D){let _=T[0],I=T.match(/^[ +-U]([0-9a-f]{7,40})\s+(.+?)(?:\s+\(|$)/)?.[2]?.trim();if(I)q.set(I,_)}}catch{q=new Map}let M=V.map((B)=>{let D=q.get(B)??"-";return{path:B,status:D,initialized:D!=="-"}});return await Q.setOneOff(J,M),M}catch(z){return L.debug(p(z,{color:!0}),"git"),await Q.setOneOff(J,[]),[]}}async function NU(Y,Z,Q){let J=[];for(let X of Q){if(X.status!==" "&&X.status!=="-"){J.push(X.path);continue}let z=q0.resolve(Z,X.path);if(!t(z))continue;let G=q0.join(z,".git");if(!t(G)){if(X.status!=="-")try{if(sY(z).length>0)J.push(X.path)}catch{J.push(X.path)}continue}try{if((await x`${Y} -C ${z} status --porcelain=v1 --untracked-files=normal`).stdout.trim().length>0)J.push(X.path)}catch{J.push(X.path)}}return J}async function wU(Y,Z){await x`${Y} -C ${Z} submodule deinit -f --all`}async function OU(Y,Z){if((await PQ(Y,Z)).length===0)return;await x`${Y} -c protocol.file.allow=always -C ${Z} submodule update --init --recursive`}function IQ(Y,Z){let Q=Z.replace(/^[/:]+/,"");if(Q=Q.replace(/\.git$/i,""),Q=Q.replace(/\/+$/,""),Y)return`${Y}/${Q}`;return Q}var n6=F(()=>{Q0();W6();g0();K0();A0()});import IU from"path";import c1 from"fs";import fN from"crypto";async function bN(Y){try{let Z=await t0(Y),Q=gN(Z);if(!Q)return L.error("No stash drop to pardon.","stash"),1;O(U("Cyan")+`Restoring ${Q.entries.length} dropped stash(es)...`+U());for(let J of Q.entries)await DU(Y,J.sha,J.message),O(U("Green")+` + Restored: ${J.message}`+U());return 0}catch(Z){return L.error("Error pardoning stash: "+Z,"stash"),1}}async function EU(Y,Z,Q){let[J,X]=Z[2].split("..").map((G)=>parseInt(G,10));if(isNaN(J)||isNaN(X)||J>X)return L.error(`Invalid stash range: ${Z[2]}`,"stash"),1;let z=[];try{let G=await t0(Y);for(let H=X;H>=J;H--){let W=await EQ(Y,H);if(W)z.push(W)}if(z.length>0)AU(G,{timestamp:Date.now(),entries:z,type:"range"},Q)}catch(G){let H=s.from(G);L.warn(`Could not capture stash entry for undo. (${H.name})`,"stash"),L.debug(H.toString(),"stash")}O(U("Cyan")+`Dropping stashes from ${U("Bright")+J+U()+U("Cyan")} to ${U("Bright")+X+U()+U("Cyan")} (inclusive)`+U());for(let G=X;G>=J;G--)await W0`${Y} stash drop stash@{${G}}`;return 0}async function hN(Y,Z){if(Z[2]==="pardon")return await bN(Y);let J=(await $0()).get("stash.undoLimit")??10;if(Z[2]&&/\d+\.\.\d+$/.test(Z[2]))return await EU(Y,Z,J);let X=0,z=Z.slice(2).filter((G)=>!G.startsWith("-"));if(z.length>0)if(z[0].includes(".."));else{let G=z[0].match(/stash@\{(\d+)\}/)||z[0].match(/^(\d+)$/);if(G)X=parseInt(G[1],10)}try{let G=await EQ(Y,X);if(G){let H=await t0(Y);AU(H,{timestamp:Date.now(),entries:[G],type:"single"},J)}}catch(G){L.warn(`Could not capture stash entry for undo. (${s.from(G).name})`,"stash")}try{return await W0`${Y} ${Z}`,0}catch{return 1}}function CU(Y){let Z=fN.createHash("sha256").update(Y).digest("hex"),Q=IU.join(kY,"gdx","stash-undo");if(!c1.existsSync(Q))c1.mkdirSync(Q,{recursive:!0});return IU.join(Q,`${Z}.json`)}function jU(Y){let Z=CU(Y);if(!c1.existsSync(Z))return[];try{let Q=c1.readFileSync(Z,"utf-8");return JSON.parse(Q)}catch{return[]}}function kU(Y,Z){let Q=CU(Y);c1.writeFileSync(Q,JSON.stringify(Z,null,2))}function AU(Y,Z,Q=10){let J=jU(Y);if(J.push(Z),J.length>Q)J.splice(0,J.length-Q);kU(Y,J)}function gN(Y){let Z=jU(Y);if(Z.length===0)return null;let Q=Z.pop()||null;return kU(Y,Z),Q}var PU,xU,SU;var p7=F(()=>{Q0();A0();R0();J0();J0();S0();n6();XY();K0();O0();RY();PU={dropRange:EU,drop:hN},xU={long:()=>{let Y=U("Bright"),Z=U("Cyan"),Q=U();return n(`
|
|
366
|
+
${Y+h("STASH DROP",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
364
367
|
Remove a stash entry or a range of stash entries.
|
|
365
368
|
|
|
366
|
-
${
|
|
369
|
+
${Y+h("DESCRIPTION",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
367
370
|
Accepts a single stash index, a range like <start>..<end>, or defaults to the latest stash.
|
|
368
371
|
Includes safety features:
|
|
369
|
-
- **Undoable**: You can restore the last dropped stash(es) with
|
|
372
|
+
- **Undoable**: You can restore the last dropped stash(es) with \`${Z}${k} stash drop pardon${Q}\`.
|
|
370
373
|
|
|
371
|
-
${
|
|
372
|
-
-
|
|
373
|
-
-
|
|
374
|
-
-
|
|
374
|
+
${Y+h("COMMANDS",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
375
|
+
- \`${Z}drop <index>${Q}\`: Drop specific stash.
|
|
376
|
+
- \`${Z}drop <start>..<end>${Q}\`: Drop range of stashes.
|
|
377
|
+
- \`${Z}drop pardon${Q}\`: Undo the last drop operation.
|
|
375
378
|
|
|
376
|
-
${
|
|
377
|
-
Dropped stashes are backed up temporarily. Use
|
|
378
|
-
`,Math.min(100,
|
|
379
|
-
${
|
|
379
|
+
${Y+h("SAFETY",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
380
|
+
Dropped stashes are backed up temporarily. Use \`${Z}pardon${Q}\` to bring them back.
|
|
381
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Drop stash entries with undo support (e.g. 0..3, pardon).",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
382
|
+
${Y}${k} stash drop ${Z}[<stash> | <range> | pardon]${Q}
|
|
380
383
|
|
|
381
384
|
Examples:
|
|
382
|
-
${
|
|
383
|
-
${
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
`))
|
|
393
|
-
|
|
394
|
-
`)
|
|
395
|
-
${
|
|
385
|
+
${Y}${k} stash drop 0..0 ${Q+Z}# Drop the most recent stash${Q}
|
|
386
|
+
${Y}${k} stash drop pardon ${Q+Z}# Restore last dropped stash${Q}
|
|
387
|
+
${Y}${k} stash l ${Q+Z}# Show stash list (alias for ${k} stash list).${Q}
|
|
388
|
+
${Y}${k} stash d 3 ${Q+Z}# Drop stash@{3}.${Q}
|
|
389
|
+
${Y}${k} stash d 2..5 ${Q+Z}# Drop stash@{5}, stash@{4}, stash@{3}, stash@{2} (safe ordering).${Q}
|
|
390
|
+
${Y}${k} stash p 1 ${Q+Z}# Pop stash@{1}.${Q}
|
|
391
|
+
${Y}${k} stash c ${Q+Z}# Clear all stashes (maps to ${k} stash clear — destructive).${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},SU={$root:["pardon"]}});function vU(Y,Z){var Q=Object.keys(Y);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(Y);Z&&(J=J.filter(function(X){return Object.getOwnPropertyDescriptor(Y,X).enumerable})),Q.push.apply(Q,J)}return Q}function yU(Y){for(var Z=1;Z<arguments.length;Z++){var Q=arguments[Z]!=null?arguments[Z]:{};Z%2?vU(Object(Q),!0).forEach(function(J){mN(Y,J,Q[J])}):Object.getOwnPropertyDescriptors?Object.defineProperties(Y,Object.getOwnPropertyDescriptors(Q)):vU(Object(Q)).forEach(function(J){Object.defineProperty(Y,J,Object.getOwnPropertyDescriptor(Q,J))})}return Y}function mN(Y,Z,Q){if(Z=uN(Z),Z in Y)Object.defineProperty(Y,Z,{value:Q,enumerable:!0,configurable:!0,writable:!0});else Y[Z]=Q;return Y}function uN(Y){var Z=dN(Y,"string");return typeof Z==="symbol"?Z:String(Z)}function dN(Y,Z){if(typeof Y!=="object"||Y===null)return Y;var Q=Y[Symbol.toPrimitive];if(Q!==void 0){var J=Q.call(Y,Z||"default");if(typeof J!=="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return(Z==="string"?String:Number)(Y)}function fU(Y){return Z.withOptions=(Q)=>fU(yU(yU({},Y),Q)),Z;function Z(Q,...J){let X=typeof Q==="string"?[Q]:Q.raw,{alignValues:z=!1,escapeSpecialCharacters:G=Array.isArray(Q),trimWhitespace:H=!0}=Y,W="";for(let V=0;V<X.length;V++){let q=X[V];if(G)q=q.replace(/\\\n[ \t]*/g,"").replace(/\\`/g,"`").replace(/\\\$/g,"$").replace(/\\\{/g,"{");if(W+=q,V<J.length){let M=z?cN(J[V],W):J[V];W+=M}}let K=W.split(`
|
|
392
|
+
`),$=null;for(let V of K){let q=V.match(/^(\s+)\S+/);if(q){let M=q[1].length;if(!$)$=M;else $=Math.min($,M)}}if($!==null){let V=$;W=K.map((q)=>q[0]===" "||q[0]==="\t"?q.slice(V):q).join(`
|
|
393
|
+
`)}if(H)W=W.trim();if(G)W=W.replace(/\\n/g,`
|
|
394
|
+
`);return W}}function cN(Y,Z){if(typeof Y!=="string"||!Y.includes(`
|
|
395
|
+
`))return Y;let J=Z.slice(Z.lastIndexOf(`
|
|
396
|
+
`)+1).match(/^(\s+)/);if(J){let X=J[1];return Y.replace(/\n/g,`
|
|
397
|
+
${X}`)}return Y}var pN,mY;var c7=F(()=>{pN=fU({}),mY=pN});async function l1(Y){let{git$:Z,args:Q}=Y,J=Q.popValue("--email")||await K6(Z,"user.email");if(J=J?J.trim().replace(/^["']|["']$/g,""):J,!J)return L.error('User email not configured. Please set it using "git config user.email <email>" or provide it with --email option.',"graph"),1;if(!Q.includes("--quiet"))O(U("Cyan")+"Generating commit graph for user: "+U("Yellow")+J+U());let z=c.terminalWidth-bU-hU,G=Math.min(Math.floor(z/l7),52);if(z<gU)return L.error(`Terminal width too small for graph display. Minimum required width is ${gU+bU+hU} columns.`,"graph"),1;let H=new Date,W=new Date(H),K=W.getDay();W.setDate(W.getDate()-K),W.setDate(W.getDate()-G*7);let $=(await x`
|
|
398
|
+
${Z} --no-pager log --all --author=${J} --since=${W.toISOString()} --date=short --format=%ad
|
|
399
|
+
`).stdout.trim(),V={};for(let _ of $.split(`
|
|
400
|
+
`)){let w=_.trim();if(w)V[w]=(V[w]||0)+1}let q=1;for(let _ of Object.values(V))if(_>q)q=_;O(`
|
|
401
|
+
`+U("Bright")+h("Contribution Graph",j.OceanDeepBlue,j.OceanGreen,0.12,0.83)+` (Max: ${q} commits/day)
|
|
402
|
+
`);let M=" ",B=0,D=-1;for(let _=0;_<=G;_++){let w=new Date(W);w.setDate(w.getDate()+_*7);let I=_*l7;if(w.getMonth()!==D&&I>=B){M+=" ".repeat(I-B);let E=w.toLocaleString("default",{month:"short"});M+=E.padEnd(l7*3," "),B=I+l7*3,D=w.getMonth()}}O(U("Bright")+M+U());let T=[" ","Mon"," ","Wed"," ","Fri"," "];for(let _=0;_<7;_++){let w=U("Bright")+T[_]+U()+" ";for(let I=0;I<=G;I++){let E=new Date(W);if(E.setDate(E.getDate()+I*7+_),E>H){w+=" ";continue}let v=E.toISOString().slice(0,10),S=V[v]||0,g,d="■";if(S===0)g=U("Dim")+U(M1(j.MidnightBlack)),d="▨";else{let m=k0.clamp(S/q,0.15,1),b=kX(j.MidnightBlack,j.OceanGreen,m);g=U(M1(b))}w+=g+d+U()+" "}O(" "+w)}return O(""),0}var bU=6,l7=2,hU=4,gU=12,mU,uU;var i1=F(()=>{A0();R0();Q0();S0();J0();K0();O0();RY();mU={long:()=>{let Y=U("Bright"),Z=U("Cyan"),Q=U();return n(`
|
|
403
|
+
${Y+h("GRAPH",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
396
404
|
Render a calendar-style contribution graph for a repository author.
|
|
397
405
|
|
|
398
|
-
${
|
|
406
|
+
${Y+h("DESCRIPTION",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
399
407
|
Visualize commit activity as a calendar-like heatmap showing commit density by day for the last N weeks (limited by terminal width). Each cell is colored to indicate relative commit frequency and can be clamped to a maximum of 52 weeks.
|
|
400
408
|
|
|
401
|
-
${
|
|
402
|
-
Supply ${
|
|
409
|
+
${Y+h("OPTIONS",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
410
|
+
Supply ${Z}--email <email>${Q} to override the configured git user email. Use ${Z}--quiet${Q} to suppress informational headers when embedding the graph in other scripts.
|
|
403
411
|
|
|
404
|
-
${
|
|
405
|
-
The graph respects
|
|
406
|
-
`,Math.min(100,
|
|
407
|
-
${
|
|
412
|
+
${Y+h("TERMINAL NOTES",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
413
|
+
The graph respects \`${Z}global.terminalWidth${Q}\`. If the terminal is too narrow the command will bail with an error message.
|
|
414
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Render a calendar-style contribution graph for an author.",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
415
|
+
${Y}${k} graph ${Z}[--email <email>] [--quiet]${Q}
|
|
408
416
|
|
|
409
417
|
Examples:
|
|
410
|
-
${
|
|
411
|
-
${
|
|
412
|
-
`).length:0,
|
|
413
|
-
`)){let
|
|
414
|
-
`)){let
|
|
415
|
-
`).filter((r)=>r.trim()),F0=0,SY="N/A",yY=await Promise.all(xY.map(async(r)=>{let{stdout:R0}=await Q`${J} rev-list --count --author=${$} ${r}`;return{branch:r,count:parseInt(R0.trim(),10)}}));for(let{branch:r,count:R0}of yY)if(R0>F0)F0=R0,SY=r;let S0=M.stdout.trim()||"Never";return k(tY`
|
|
418
|
+
${Y}${k} graph ${Q+Z}# Graph for configured git user${Q}
|
|
419
|
+
${Y}${k} graph --email bob@example.com ${Q+Z}# Graph for specified author${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},uU={$root:["--email","--quiet"]}});function lN(Y){let Z=Y.indexOf("=");if(Z!==-1)return Y.substring(Z+1);return null}function dU(Y){return new a6(Y)}var a6;var i7=F(()=>{a6=class a6 extends Array{constructor(Y){if(Array.isArray(Y))super(...Y);else super(Y)}optionIndexOf(Y,Z=0){for(let Q=Z;Q<this.length;Q++)if(this[Q]===Y||this[Q].startsWith(Y+"="))return Q;return-1}delete(Y){let Z=this.optionIndexOf(Y);if(Z!==-1)return this.splice(Z,1),!0;return!1}popValue(Y,Z=0,Q=!1){let J=this.optionIndexOf(Y,Z);if(J!==-1){let X=null;if(Y.includes("="))X=lN(this[J]),this.splice(J,1);else if(!Q&&J+1<this.length&&!this[J+1].startsWith("-"))X=this[J+1],this.splice(J,2);else this.splice(J,1);return X}return null}popOption(Y,Z=0){let Q=this.optionIndexOf(Y,Z);if(Q!==-1)return this.splice(Q,1),Y;return null}spliceOption(Y,Z,Q=0){let J=this.optionIndexOf(Y,Q);if(J!==-1)return this.splice(J,1,...Z),!0;return!1}hasOption(Y,Z=0){for(let Q=Z;Q<this.length;Q++)if(this[Q]===Y||this[Q].startsWith(Y+"="))return!0;return!1}slice(Y,Z){return new a6(super.slice(Y,Z))}}});async function xQ(Y){let Z=h7(),Q=Z.$,{args:J,git$:X}=Y;if(!await u7(X))return 1;let z="",G="Your",H=J.indexOf("--author");try{if(H!==-1&&H+1<J.length)z=J[H+1].trim(),G=z.split("@")[0]+"'s";else z=await K6(X,"user.email")}catch(W){return Z.abort(),L.error("Failed to read git config user.email.","stats"),L.error(p(W,{color:!0}),"stats"),1}if(!z)return L.error("No user.email configured in git.","stats"),1;O(U("Cyan")+"Gathering stats for user: "+U("Yellow")+z+U("Cyan")+" this may take a while..."+U());try{let[W,K,$,V,q,M,B,D]=await Promise.all([t0(X),Q`${X} rev-list --all --count --author=${z}`,Q`${X} rev-list --all --count`,Q`${X} log --all --author=${z} --since=midnight --pretty=tformat:%h`,Q`${X} log --all --author=${z} --pretty=tformat: --numstat`,Q`${X} log --all --pretty=tformat: --numstat`,qU(X),Q`${X} log --all --author=${z} -1 --format=${`%ar ${U()+U("Dim")}[at %h] (on %ad)`+U()}`]),T=W.split(/[\\/]/).pop(),_=K.stdout.trim(),w=$.stdout.trim(),I=V.stdout.trim()?V.stdout.trim().split(`
|
|
420
|
+
`).length:0,E=q.stdout,v=0,S=0;for(let w0 of E.split(`
|
|
421
|
+
`)){let H0=w0.match(/^(\d+)\s+(\d+)/);if(H0)v+=parseInt(H0[1],10),S+=parseInt(H0[2],10)}let g=jY(v*x6.AVG_CHARS_PER_LINE,2,1024)+"B",d=jY(S*x6.AVG_CHARS_PER_LINE,2,1024)+"B",m=jY(v/x6.AVG_LINES_PER_FUNCTION,1,1000,!1,0),b=jY(S/x6.AVG_LINES_PER_FUNCTION,1,1000,!1,0),i=jY(v/x6.AVG_LINES_PER_FILE,1,1000,!1,0),Y0=jY(S/x6.AVG_LINES_PER_FILE,1,1000,!1,0),f=M.stdout,j0=0,b0=0;for(let w0 of f.split(`
|
|
422
|
+
`)){let H0=w0.match(/^(\d+)\s+(\d+)/);if(H0)j0+=parseInt(H0[1],10),b0+=parseInt(H0[2],10)}let F8=v+S,E0=j0+b0,f0=E0>0?KX(F8/E0*100,2,!0):"0.00",IY=0,x0="N/A",R8=await Promise.all(B.map(async(w0)=>{let{stdout:H0}=await Q`${X} rev-list --count --author=${z} ${w0}`;return{branch:w0,count:parseInt(H0.trim(),10)}}));for(let{branch:w0,count:H0}of R8)if(H0>IY)IY=H0,x0=w0;let O6=D.stdout.trim()||"Never";return O(mY`
|
|
416
423
|
\n=== ${G} Git Stats ===
|
|
417
424
|
Project: ${U("Cyan")}${T}${U()}
|
|
418
|
-
Total Commits: ${U("Green")}${
|
|
419
|
-
Total Lines Added: ${U("Green")}+ ${
|
|
420
|
-
Total Lines Removed: ${U("Red")}- ${
|
|
421
|
-
Contributions: ${U("Magenta")}${
|
|
422
|
-
Most Active Branch: ${U("Cyan")}${
|
|
423
|
-
Last Commit: ${U("Yellow")}${
|
|
424
|
-
`),await
|
|
425
|
-
${
|
|
425
|
+
Total Commits: ${U("Green")}${_}${U()} (today: ${I}) / ${U("Yellow")}${w}${U()} (all)
|
|
426
|
+
Total Lines Added: ${U("Green")}+ ${v} lines ${U()}${U("Dim")}(roughly ${g}, ${m} functions or ${i} source files)${U()}
|
|
427
|
+
Total Lines Removed: ${U("Red")}- ${S} lines ${U()}${U("Dim")}(roughly ${d}, ${b} functions or ${Y0} source files)${U()}
|
|
428
|
+
Contributions: ${U("Magenta")}${f0}%${U()} of all lines changed in the project
|
|
429
|
+
Most Active Branch: ${U("Cyan")}${x0}${U()} (${IY} commits)
|
|
430
|
+
Last Commit: ${U("Yellow")}${O6}${U()}
|
|
431
|
+
`),await l1({...Y,args:dU(["--quiet","--author",z])}),0}catch(W){return Z.abort(),L.error(p(W,{color:!0})),1}}var pU,cU;var n7=F(()=>{c7();Q0();A0();R0();i1();i7();J0();O0();S0();n6();K0();RY();pU={long:()=>{let Y=U("Bright"),Z=U("Cyan"),Q=U();return n(`
|
|
432
|
+
${Y+h("STATS",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
426
433
|
Gather detailed contribution statistics for a git author in this repository.
|
|
427
434
|
|
|
428
|
-
${
|
|
435
|
+
${Y+h("WHAT IT COMPUTES",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
429
436
|
Total commits by the author, today's commits, lines added/removed, rough size estimates (bytes), estimated functions/files added or removed, contribution percentage of the project, most active branch, and time of the last commit.
|
|
430
437
|
|
|
431
|
-
${
|
|
438
|
+
${Y+h("HOW IT WORKS",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
432
439
|
The command runs multiple git queries in parallel to collect commit lists, per-commit numstat, branch lists and last-commit metadata. For large repos this may take some time; progress messages are shown while queries run.
|
|
433
440
|
|
|
434
|
-
${
|
|
435
|
-
Use ${
|
|
436
|
-
`,Math.min(100,
|
|
437
|
-
${
|
|
441
|
+
${Y+h("OPTIONS",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
442
|
+
Use ${Z}--author <email>${Q} to target a different author than the configured git user.email. Output includes a small visual graph invocation via the \`${Z}graph${Q}\` command by default.
|
|
443
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Show (local) contribution statistics for a repository author.",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
444
|
+
${Y}${k} stats ${Z}[--author <email>]${Q}
|
|
438
445
|
|
|
439
446
|
Examples:
|
|
440
|
-
${
|
|
441
|
-
${U("Cyan")}${I} stats --author alice@example.com ${U()+U("Dim")}# Stats for specified author${U()}`,Math.min(100,p.terminalWidth-4),{firstIndent:" ",mode:"softboundery",indent:" "})},UG={$root:["--author"]};Y0();Y0();function g(Y,Z,Q,X,J){if(X==="m")throw TypeError("Private method is not writable");if(X==="a"&&!J)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?Y!==Z||!J:!Z.has(Y))throw TypeError("Cannot write private member to an object whose class did not declare it");return X==="a"?J.call(Y,Q):J?J.value=Q:Z.set(Y,Q),Q}function L(Y,Z,Q,X){if(Q==="a"&&!X)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?Y!==Z||!X:!Z.has(Y))throw TypeError("Cannot read private member from an object whose class did not declare it");return Q==="m"?X:Q==="a"?X.call(Y):X?X.value:Z.get(Y)}var r2=function(){let{crypto:Y}=globalThis;if(Y?.randomUUID)return r2=Y.randomUUID.bind(Y),Y.randomUUID();let Z=new Uint8Array(1),Q=Y?()=>Y.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(X)=>(+X^Q()&15>>+X/4).toString(16))};function u1(Y){return typeof Y==="object"&&Y!==null&&(("name"in Y)&&Y.name==="AbortError"||("message"in Y)&&String(Y.message).includes("FetchRequestCanceledException"))}var d1=(Y)=>{if(Y instanceof Error)return Y;if(typeof Y==="object"&&Y!==null){try{if(Object.prototype.toString.call(Y)==="[object Error]"){let Z=Error(Y.message,Y.cause?{cause:Y.cause}:{});if(Y.stack)Z.stack=Y.stack;if(Y.cause&&!Z.cause)Z.cause=Y.cause;if(Y.name)Z.name=Y.name;return Z}}catch{}try{return Error(JSON.stringify(Y))}catch{}}return Error(Y)};class S extends Error{}class $0 extends S{constructor(Y,Z,Q,X){super(`${$0.makeMessage(Y,Z,Q)}`);this.status=Y,this.headers=X,this.requestID=X?.get("x-request-id"),this.error=Z;let J=Z;this.code=J?.code,this.param=J?.param,this.type=J?.type}static makeMessage(Y,Z,Q){let X=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):Q;if(Y&&X)return`${Y} ${X}`;if(Y)return`${Y} status code (no body)`;if(X)return X;return"(no status code or body)"}static generate(Y,Z,Q,X){if(!Y||!X)return new rY({message:Q,cause:d1(Z)});let J=Z?.error;if(Y===400)return new p1(Y,J,Q,X);if(Y===401)return new c1(Y,J,Q,X);if(Y===403)return new l1(Y,J,Q,X);if(Y===404)return new i1(Y,J,Q,X);if(Y===409)return new n1(Y,J,Q,X);if(Y===422)return new a1(Y,J,Q,X);if(Y===429)return new o1(Y,J,Q,X);if(Y>=500)return new s1(Y,J,Q,X);return new $0(Y,J,Q,X)}}class K0 extends $0{constructor({message:Y}={}){super(void 0,void 0,Y||"Request was aborted.",void 0)}}class rY extends $0{constructor({message:Y,cause:Z}){super(void 0,void 0,Y||"Connection error.",void 0);if(Z)this.cause=Z}}class eY extends rY{constructor({message:Y}={}){super({message:Y??"Request timed out."})}}class p1 extends $0{}class c1 extends $0{}class l1 extends $0{}class i1 extends $0{}class n1 extends $0{}class a1 extends $0{}class o1 extends $0{}class s1 extends $0{}class t1 extends S{constructor(){super("Could not parse response content as the length limit was reached")}}class r1 extends S{constructor(){super("Could not parse response content as the request was rejected by the content filter")}}class KY extends Error{constructor(Y){super(Y)}}var RR=/^[a-z][a-z0-9+.-]*:/i,qG=(Y)=>{return RR.test(Y)},D0=(Y)=>(D0=Array.isArray,D0(Y)),e2=D0;function Y5(Y){if(typeof Y!=="object")return{};return Y??{}}function VG(Y){if(!Y)return!0;for(let Z in Y)return!1;return!0}function BG(Y,Z){return Object.prototype.hasOwnProperty.call(Y,Z)}function e1(Y){return Y!=null&&typeof Y==="object"&&!Array.isArray(Y)}var FG=(Y,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new S(`${Y} must be an integer`);if(Z<0)throw new S(`${Y} must be a positive integer`);return Z};var RG=(Y)=>{try{return JSON.parse(Y)}catch(Z){return}};var n0=(Y)=>new Promise((Z)=>setTimeout(Z,Y));var _Y="6.14.0";var TG=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"};function MR(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}var DR=()=>{let Y=MR();if(Y==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_Y,"X-Stainless-OS":DG(Deno.build.os),"X-Stainless-Arch":MG(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_Y,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(Y==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_Y,"X-Stainless-OS":DG(globalThis.process.platform??"unknown"),"X-Stainless-Arch":MG(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=LR();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_Y,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":_Y,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}};function LR(){if(typeof navigator>"u"||!navigator)return null;let Y=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:Q}of Y){let X=Q.exec(navigator.userAgent);if(X){let J=X[1]||0,$=X[2]||0,G=X[3]||0;return{browser:Z,version:`${J}.${$}.${G}`}}}return null}var MG=(Y)=>{if(Y==="x32")return"x32";if(Y==="x86_64"||Y==="x64")return"x64";if(Y==="arm")return"arm";if(Y==="aarch64"||Y==="arm64")return"arm64";if(Y)return`other:${Y}`;return"unknown"},DG=(Y)=>{if(Y=Y.toLowerCase(),Y.includes("ios"))return"iOS";if(Y==="android")return"Android";if(Y==="darwin")return"MacOS";if(Y==="win32")return"Windows";if(Y==="freebsd")return"FreeBSD";if(Y==="openbsd")return"OpenBSD";if(Y==="linux")return"Linux";if(Y)return`Other:${Y}`;return"Unknown"},LG,_G=()=>{return LG??(LG=DR())};function wG(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function Z5(...Y){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...Y)}function MZ(Y){let Z=Symbol.asyncIterator in Y?Y[Symbol.asyncIterator]():Y[Symbol.iterator]();return Z5({start(){},async pull(Q){let{done:X,value:J}=await Z.next();if(X)Q.close();else Q.enqueue(J)},async cancel(){await Z.return?.()}})}function Q5(Y){if(Y[Symbol.asyncIterator])return Y;let Z=Y.getReader();return{async next(){try{let Q=await Z.read();if(Q?.done)Z.releaseLock();return Q}catch(Q){throw Z.releaseLock(),Q}},async return(){let Q=Z.cancel();return Z.releaseLock(),await Q,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function NG(Y){if(Y===null||typeof Y!=="object")return;if(Y[Symbol.asyncIterator]){await Y[Symbol.asyncIterator]().return?.();return}let Z=Y.getReader(),Q=Z.cancel();Z.releaseLock(),await Q}var OG=({headers:Y,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};var DZ="RFC3986",X5=(Y)=>String(Y),LZ={RFC1738:(Y)=>String(Y).replace(/%20/g,"+"),RFC3986:X5},J5="RFC1738";var TZ=(Y,Z)=>(TZ=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),TZ(Y,Z)),a0=(()=>{let Y=[];for(let Z=0;Z<256;++Z)Y.push("%"+((Z<16?"0":"")+Z.toString(16)).toUpperCase());return Y})();var $5=1024,PG=(Y,Z,Q,X,J)=>{if(Y.length===0)return Y;let $=Y;if(typeof Y==="symbol")$=Symbol.prototype.toString.call(Y);else if(typeof Y!=="string")$=String(Y);if(Q==="iso-8859-1")return escape($).replace(/%u[0-9a-f]{4}/gi,function(K){return"%26%23"+parseInt(K.slice(2),16)+"%3B"});let G="";for(let K=0;K<$.length;K+=$5){let H=$.length>=$5?$.slice(K,K+$5):$,W=[];for(let z=0;z<H.length;++z){let q=H.charCodeAt(z);if(q===45||q===46||q===95||q===126||q>=48&&q<=57||q>=65&&q<=90||q>=97&&q<=122||J===J5&&(q===40||q===41)){W[W.length]=H.charAt(z);continue}if(q<128){W[W.length]=a0[q];continue}if(q<2048){W[W.length]=a0[192|q>>6]+a0[128|q&63];continue}if(q<55296||q>=57344){W[W.length]=a0[224|q>>12]+a0[128|q>>6&63]+a0[128|q&63];continue}z+=1,q=65536+((q&1023)<<10|H.charCodeAt(z)&1023),W[W.length]=a0[240|q>>18]+a0[128|q>>12&63]+a0[128|q>>6&63]+a0[128|q&63]}G+=W.join("")}return G};function EG(Y){if(!Y||typeof Y!=="object")return!1;return!!(Y.constructor&&Y.constructor.isBuffer&&Y.constructor.isBuffer(Y))}function G5(Y,Z){if(D0(Y)){let Q=[];for(let X=0;X<Y.length;X+=1)Q.push(Z(Y[X]));return Q}return Z(Y)}var kG={brackets(Y){return String(Y)+"[]"},comma:"comma",indices(Y,Z){return String(Y)+"["+Z+"]"},repeat(Y){return String(Y)}},AG=function(Y,Z){Array.prototype.push.apply(Y,D0(Z)?Z:[Z])},CG,H0={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:PG,encodeValuesOnly:!1,format:DZ,formatter:X5,indices:!1,serializeDate(Y){return(CG??(CG=Function.prototype.call.bind(Date.prototype.toISOString)))(Y)},skipNulls:!1,strictNullHandling:!1};function wR(Y){return typeof Y==="string"||typeof Y==="number"||typeof Y==="boolean"||typeof Y==="symbol"||typeof Y==="bigint"}var K5={};function IG(Y,Z,Q,X,J,$,G,K,H,W,z,q,V,R,B,M,T,D){let _=Y,w=D,N=0,j=!1;while((w=w.get(K5))!==void 0&&!j){let v=w.get(Y);if(N+=1,typeof v<"u")if(v===N)throw RangeError("Cyclic object value");else j=!0;if(typeof w.get(K5)>"u")N=0}if(typeof W==="function")_=W(Z,_);else if(_ instanceof Date)_=V?.(_);else if(Q==="comma"&&D0(_))_=G5(_,function(v){if(v instanceof Date)return V?.(v);return v});if(_===null){if($)return H&&!M?H(Z,H0.encoder,T,"key",R):Z;_=""}if(wR(_)||EG(_)){if(H){let v=M?Z:H(Z,H0.encoder,T,"key",R);return[B?.(v)+"="+B?.(H(_,H0.encoder,T,"value",R))]}return[B?.(Z)+"="+B?.(String(_))]}let x=[];if(typeof _>"u")return x;let f;if(Q==="comma"&&D0(_)){if(M&&H)_=G5(_,H);f=[{value:_.length>0?_.join(",")||null:void 0}]}else if(D0(W))f=W;else{let v=Object.keys(_);f=z?v.sort(z):v}let m=K?String(Z).replace(/\./g,"%2E"):String(Z),b=X&&D0(_)&&_.length===1?m+"[]":m;if(J&&D0(_)&&_.length===0)return b+"[]";for(let v=0;v<f.length;++v){let d=f[v],o=typeof d==="object"&&typeof d.value<"u"?d.value:_[d];if(G&&o===null)continue;let y=q&&K?d.replace(/\./g,"%2E"):d,B0=D0(_)?typeof Q==="function"?Q(b,y):b:b+(q?"."+y:"["+y+"]");D.set(Y,N);let w0=new WeakMap;w0.set(K5,D),AG(x,IG(o,B0,Q,X,J,$,G,K,Q==="comma"&&M&&D0(_)?null:H,W,z,q,V,R,B,M,T,w0))}return x}function NR(Y=H0){if(typeof Y.allowEmptyArrays<"u"&&typeof Y.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof Y.encodeDotInKeys<"u"&&typeof Y.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(Y.encoder!==null&&typeof Y.encoder<"u"&&typeof Y.encoder!=="function")throw TypeError("Encoder has to be a function.");let Z=Y.charset||H0.charset;if(typeof Y.charset<"u"&&Y.charset!=="utf-8"&&Y.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let Q=DZ;if(typeof Y.format<"u"){if(!TZ(LZ,Y.format))throw TypeError("Unknown format option provided.");Q=Y.format}let X=LZ[Q],J=H0.filter;if(typeof Y.filter==="function"||D0(Y.filter))J=Y.filter;let $;if(Y.arrayFormat&&Y.arrayFormat in kG)$=Y.arrayFormat;else if("indices"in Y)$=Y.indices?"indices":"repeat";else $=H0.arrayFormat;if("commaRoundTrip"in Y&&typeof Y.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let G=typeof Y.allowDots>"u"?!!Y.encodeDotInKeys===!0?!0:H0.allowDots:!!Y.allowDots;return{addQueryPrefix:typeof Y.addQueryPrefix==="boolean"?Y.addQueryPrefix:H0.addQueryPrefix,allowDots:G,allowEmptyArrays:typeof Y.allowEmptyArrays==="boolean"?!!Y.allowEmptyArrays:H0.allowEmptyArrays,arrayFormat:$,charset:Z,charsetSentinel:typeof Y.charsetSentinel==="boolean"?Y.charsetSentinel:H0.charsetSentinel,commaRoundTrip:!!Y.commaRoundTrip,delimiter:typeof Y.delimiter>"u"?H0.delimiter:Y.delimiter,encode:typeof Y.encode==="boolean"?Y.encode:H0.encode,encodeDotInKeys:typeof Y.encodeDotInKeys==="boolean"?Y.encodeDotInKeys:H0.encodeDotInKeys,encoder:typeof Y.encoder==="function"?Y.encoder:H0.encoder,encodeValuesOnly:typeof Y.encodeValuesOnly==="boolean"?Y.encodeValuesOnly:H0.encodeValuesOnly,filter:J,format:Q,formatter:X,serializeDate:typeof Y.serializeDate==="function"?Y.serializeDate:H0.serializeDate,skipNulls:typeof Y.skipNulls==="boolean"?Y.skipNulls:H0.skipNulls,sort:typeof Y.sort==="function"?Y.sort:null,strictNullHandling:typeof Y.strictNullHandling==="boolean"?Y.strictNullHandling:H0.strictNullHandling}}function H5(Y,Z={}){let Q=Y,X=NR(Z),J,$;if(typeof X.filter==="function")$=X.filter,Q=$("",Q);else if(D0(X.filter))$=X.filter,J=$;let G=[];if(typeof Q!=="object"||Q===null)return"";let K=kG[X.arrayFormat],H=K==="comma"&&X.commaRoundTrip;if(!J)J=Object.keys(Q);if(X.sort)J.sort(X.sort);let W=new WeakMap;for(let V=0;V<J.length;++V){let R=J[V];if(X.skipNulls&&Q[R]===null)continue;AG(G,IG(Q[R],R,K,H,X.allowEmptyArrays,X.strictNullHandling,X.skipNulls,X.encodeDotInKeys,X.encode?X.encoder:null,X.filter,X.sort,X.allowDots,X.serializeDate,X.format,X.formatter,X.encodeValuesOnly,X.charset,W))}let z=G.join(X.delimiter),q=X.addQueryPrefix===!0?"?":"";if(X.charsetSentinel)if(X.charset==="iso-8859-1")q+="utf8=%26%2310003%3B&";else q+="utf8=%E2%9C%93&";return z.length>0?q+z:""}function SG(Y){let Z=0;for(let J of Y)Z+=J.length;let Q=new Uint8Array(Z),X=0;for(let J of Y)Q.set(J,X),X+=J.length;return Q}var jG;function d6(Y){let Z;return(jG??(Z=new globalThis.TextEncoder,jG=Z.encode.bind(Z)))(Y)}var xG;function z5(Y){let Z;return(xG??(Z=new globalThis.TextDecoder,xG=Z.decode.bind(Z)))(Y)}var E0,C0;class p6{constructor(){E0.set(this,void 0),C0.set(this,void 0),g(this,E0,new Uint8Array,"f"),g(this,C0,null,"f")}decode(Y){if(Y==null)return[];let Z=Y instanceof ArrayBuffer?new Uint8Array(Y):typeof Y==="string"?d6(Y):Y;g(this,E0,SG([L(this,E0,"f"),Z]),"f");let Q=[],X;while((X=PR(L(this,E0,"f"),L(this,C0,"f")))!=null){if(X.carriage&&L(this,C0,"f")==null){g(this,C0,X.index,"f");continue}if(L(this,C0,"f")!=null&&(X.index!==L(this,C0,"f")+1||X.carriage)){Q.push(z5(L(this,E0,"f").subarray(0,L(this,C0,"f")-1))),g(this,E0,L(this,E0,"f").subarray(L(this,C0,"f")),"f"),g(this,C0,null,"f");continue}let J=L(this,C0,"f")!==null?X.preceding-1:X.preceding,$=z5(L(this,E0,"f").subarray(0,J));Q.push($),g(this,E0,L(this,E0,"f").subarray(X.index),"f"),g(this,C0,null,"f")}return Q}flush(){if(!L(this,E0,"f").length)return[];return this.decode(`
|
|
442
|
-
`)}}
|
|
443
|
-
`,"\r"]);
|
|
444
|
-
`);Q.
|
|
445
|
-
`)
|
|
446
|
-
${
|
|
447
|
+
${Y}${k} stats ${Q+Z}# Stats for configured git user${Q}
|
|
448
|
+
${Y}${k} stats --author alice@example.com ${Q+Z}# Stats for specified author${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},cU={$root:["--author"]}});function u(Y,Z,Q,J,X){if(J==="m")throw TypeError("Private method is not writable");if(J==="a"&&!X)throw TypeError("Private accessor was defined without a setter");if(typeof Z==="function"?Y!==Z||!X:!Z.has(Y))throw TypeError("Cannot write private member to an object whose class did not declare it");return J==="a"?X.call(Y,Q):X?X.value=Q:Z.set(Y,Q),Q}function N(Y,Z,Q,J){if(Q==="a"&&!J)throw TypeError("Private accessor was defined without a getter");if(typeof Z==="function"?Y!==Z||!J:!Z.has(Y))throw TypeError("Cannot read private member from an object whose class did not declare it");return Q==="m"?J:Q==="a"?J.call(Y):J?J.value:Z.get(Y)}var e0=()=>{};var SQ=function(){let{crypto:Y}=globalThis;if(Y?.randomUUID)return SQ=Y.randomUUID.bind(Y),Y.randomUUID();let Z=new Uint8Array(1),Q=Y?()=>Y.getRandomValues(Z)[0]:()=>Math.random()*255&255;return"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(J)=>(+J^Q()&15>>+J/4).toString(16))};function n1(Y){return typeof Y==="object"&&Y!==null&&(("name"in Y)&&Y.name==="AbortError"||("message"in Y)&&String(Y.message).includes("FetchRequestCanceledException"))}var a1=(Y)=>{if(Y instanceof Error)return Y;if(typeof Y==="object"&&Y!==null){try{if(Object.prototype.toString.call(Y)==="[object Error]"){let Z=Error(Y.message,Y.cause?{cause:Y.cause}:{});if(Y.stack)Z.stack=Y.stack;if(Y.cause&&!Z.cause)Z.cause=Y.cause;if(Y.name)Z.name=Y.name;return Z}}catch{}try{return Error(JSON.stringify(Y))}catch{}}return Error(Y)};var y,M0,T0,o6,s6,o1,s1,r1,t1,e1,Y4,Z4,Q4,J4,X4,uY;var MY=F(()=>{y=class y extends Error{};M0=class M0 extends y{constructor(Y,Z,Q,J){super(`${M0.makeMessage(Y,Z,Q)}`);this.status=Y,this.headers=J,this.requestID=J?.get("x-request-id"),this.error=Z;let X=Z;this.code=X?.code,this.param=X?.param,this.type=X?.type}static makeMessage(Y,Z,Q){let J=Z?.message?typeof Z.message==="string"?Z.message:JSON.stringify(Z.message):Z?JSON.stringify(Z):Q;if(Y&&J)return`${Y} ${J}`;if(Y)return`${Y} status code (no body)`;if(J)return J;return"(no status code or body)"}static generate(Y,Z,Q,J){if(!Y||!J)return new o6({message:Q,cause:a1(Z)});let X=Z?.error;if(Y===400)return new o1(Y,X,Q,J);if(Y===401)return new s1(Y,X,Q,J);if(Y===403)return new r1(Y,X,Q,J);if(Y===404)return new t1(Y,X,Q,J);if(Y===409)return new e1(Y,X,Q,J);if(Y===422)return new Y4(Y,X,Q,J);if(Y===429)return new Z4(Y,X,Q,J);if(Y>=500)return new Q4(Y,X,Q,J);return new M0(Y,X,Q,J)}};T0=class T0 extends M0{constructor({message:Y}={}){super(void 0,void 0,Y||"Request was aborted.",void 0)}};o6=class o6 extends M0{constructor({message:Y,cause:Z}){super(void 0,void 0,Y||"Connection error.",void 0);if(Z)this.cause=Z}};s6=class s6 extends o6{constructor({message:Y}={}){super({message:Y??"Request timed out."})}};o1=class o1 extends M0{};s1=class s1 extends M0{};r1=class r1 extends M0{};t1=class t1 extends M0{};e1=class e1 extends M0{};Y4=class Y4 extends M0{};Z4=class Z4 extends M0{};Q4=class Q4 extends M0{};J4=class J4 extends y{constructor(){super("Could not parse response content as the length limit was reached")}};X4=class X4 extends y{constructor(){super("Could not parse response content as the request was rejected by the content filter")}};uY=class uY extends Error{constructor(Y){super(Y)}}});function yQ(Y){if(typeof Y!=="object")return{};return Y??{}}function iU(Y){if(!Y)return!0;for(let Z in Y)return!1;return!0}function nU(Y,Z){return Object.prototype.hasOwnProperty.call(Y,Z)}function z4(Y){return Y!=null&&typeof Y==="object"&&!Array.isArray(Y)}var nN,lU=(Y)=>{return nN.test(Y)},P0=(Y)=>(P0=Array.isArray,P0(Y)),vQ,aU=(Y,Z)=>{if(typeof Z!=="number"||!Number.isInteger(Z))throw new y(`${Y} must be an integer`);if(Z<0)throw new y(`${Y} must be a positive integer`);return Z},oU=(Y)=>{try{return JSON.parse(Y)}catch(Z){return}};var dY=F(()=>{MY();nN=/^[a-z][a-z0-9+.-]*:/i,vQ=P0});var DY=(Y)=>new Promise((Z)=>setTimeout(Z,Y));var U6="6.14.0";function aN(){if(typeof Deno<"u"&&Deno.build!=null)return"deno";if(typeof EdgeRuntime<"u")return"edge";if(Object.prototype.toString.call(typeof globalThis.process<"u"?globalThis.process:0)==="[object process]")return"node";return"unknown"}function sN(){if(typeof navigator>"u"||!navigator)return null;let Y=[{key:"edge",pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"ie",pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"chrome",pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"firefox",pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:"safari",pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}];for(let{key:Z,pattern:Q}of Y){let J=Q.exec(navigator.userAgent);if(J){let X=J[1]||0,z=J[2]||0,G=J[3]||0;return{browser:Z,version:`${X}.${z}.${G}`}}}return null}var eU=()=>{return typeof window<"u"&&typeof window.document<"u"&&typeof navigator<"u"},oN=()=>{let Y=aN();if(Y==="deno")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":U6,"X-Stainless-OS":rU(Deno.build.os),"X-Stainless-Arch":sU(Deno.build.arch),"X-Stainless-Runtime":"deno","X-Stainless-Runtime-Version":typeof Deno.version==="string"?Deno.version:Deno.version?.deno??"unknown"};if(typeof EdgeRuntime<"u")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":U6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":"edge","X-Stainless-Runtime-Version":globalThis.process.version};if(Y==="node")return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":U6,"X-Stainless-OS":rU(globalThis.process.platform??"unknown"),"X-Stainless-Arch":sU(globalThis.process.arch??"unknown"),"X-Stainless-Runtime":"node","X-Stainless-Runtime-Version":globalThis.process.version??"unknown"};let Z=sN();if(Z)return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":U6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":`browser:${Z.browser}`,"X-Stainless-Runtime-Version":Z.version};return{"X-Stainless-Lang":"js","X-Stainless-Package-Version":U6,"X-Stainless-OS":"Unknown","X-Stainless-Arch":"unknown","X-Stainless-Runtime":"unknown","X-Stainless-Runtime-Version":"unknown"}},sU=(Y)=>{if(Y==="x32")return"x32";if(Y==="x86_64"||Y==="x64")return"x64";if(Y==="arm")return"arm";if(Y==="aarch64"||Y==="arm64")return"arm64";if(Y)return`other:${Y}`;return"unknown"},rU=(Y)=>{if(Y=Y.toLowerCase(),Y.includes("ios"))return"iOS";if(Y==="android")return"Android";if(Y==="darwin")return"MacOS";if(Y==="win32")return"Windows";if(Y==="freebsd")return"FreeBSD";if(Y==="openbsd")return"OpenBSD";if(Y==="linux")return"Linux";if(Y)return`Other:${Y}`;return"Unknown"},tU,YV=()=>{return tU??(tU=oN())};var fQ=()=>{};function ZV(){if(typeof fetch<"u")return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new OpenAI({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function bQ(...Y){let Z=globalThis.ReadableStream;if(typeof Z>"u")throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new Z(...Y)}function a7(Y){let Z=Symbol.asyncIterator in Y?Y[Symbol.asyncIterator]():Y[Symbol.iterator]();return bQ({start(){},async pull(Q){let{done:J,value:X}=await Z.next();if(J)Q.close();else Q.enqueue(X)},async cancel(){await Z.return?.()}})}function hQ(Y){if(Y[Symbol.asyncIterator])return Y;let Z=Y.getReader();return{async next(){try{let Q=await Z.read();if(Q?.done)Z.releaseLock();return Q}catch(Q){throw Z.releaseLock(),Q}},async return(){let Q=Z.cancel();return Z.releaseLock(),await Q,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function QV(Y){if(Y===null||typeof Y!=="object")return;if(Y[Symbol.asyncIterator]){await Y[Symbol.asyncIterator]().return?.();return}let Z=Y.getReader(),Q=Z.cancel();Z.releaseLock(),await Q}var JV=({headers:Y,body:Z})=>{return{bodyHeaders:{"content-type":"application/json"},body:JSON.stringify(Z)}};var o7="RFC3986",gQ=(Y)=>String(Y),s7,mQ="RFC1738";var r7=F(()=>{s7={RFC1738:(Y)=>String(Y).replace(/%20/g,"+"),RFC3986:gQ}});function zV(Y){if(!Y||typeof Y!=="object")return!1;return!!(Y.constructor&&Y.constructor.isBuffer&&Y.constructor.isBuffer(Y))}function dQ(Y,Z){if(P0(Y)){let Q=[];for(let J=0;J<Y.length;J+=1)Q.push(Z(Y[J]));return Q}return Z(Y)}var t7=(Y,Z)=>(t7=Object.hasOwn??Function.prototype.call.bind(Object.prototype.hasOwnProperty),t7(Y,Z)),LY,uQ=1024,XV=(Y,Z,Q,J,X)=>{if(Y.length===0)return Y;let z=Y;if(typeof Y==="symbol")z=Symbol.prototype.toString.call(Y);else if(typeof Y!=="string")z=String(Y);if(Q==="iso-8859-1")return escape(z).replace(/%u[0-9a-f]{4}/gi,function(H){return"%26%23"+parseInt(H.slice(2),16)+"%3B"});let G="";for(let H=0;H<z.length;H+=uQ){let W=z.length>=uQ?z.slice(H,H+uQ):z,K=[];for(let $=0;$<W.length;++$){let V=W.charCodeAt($);if(V===45||V===46||V===95||V===126||V>=48&&V<=57||V>=65&&V<=90||V>=97&&V<=122||X===mQ&&(V===40||V===41)){K[K.length]=W.charAt($);continue}if(V<128){K[K.length]=LY[V];continue}if(V<2048){K[K.length]=LY[192|V>>6]+LY[128|V&63];continue}if(V<55296||V>=57344){K[K.length]=LY[224|V>>12]+LY[128|V>>6&63]+LY[128|V&63];continue}$+=1,V=65536+((V&1023)<<10|W.charCodeAt($)&1023),K[K.length]=LY[240|V>>18]+LY[128|V>>12&63]+LY[128|V>>6&63]+LY[128|V&63]}G+=K.join("")}return G};var GV=F(()=>{r7();dY();LY=(()=>{let Y=[];for(let Z=0;Z<256;++Z)Y.push("%"+((Z<16?"0":"")+Z.toString(16)).toUpperCase());return Y})()});function eN(Y){return typeof Y==="string"||typeof Y==="number"||typeof Y==="boolean"||typeof Y==="symbol"||typeof Y==="bigint"}function $V(Y,Z,Q,J,X,z,G,H,W,K,$,V,q,M,B,D,T,_){let w=Y,I=_,E=0,v=!1;while((I=I.get(pQ))!==void 0&&!v){let b=I.get(Y);if(E+=1,typeof b<"u")if(b===E)throw RangeError("Cyclic object value");else v=!0;if(typeof I.get(pQ)>"u")E=0}if(typeof K==="function")w=K(Z,w);else if(w instanceof Date)w=q?.(w);else if(Q==="comma"&&P0(w))w=dQ(w,function(b){if(b instanceof Date)return q?.(b);return b});if(w===null){if(z)return W&&!D?W(Z,_0.encoder,T,"key",M):Z;w=""}if(eN(w)||zV(w)){if(W){let b=D?Z:W(Z,_0.encoder,T,"key",M);return[B?.(b)+"="+B?.(W(w,_0.encoder,T,"value",M))]}return[B?.(Z)+"="+B?.(String(w))]}let S=[];if(typeof w>"u")return S;let g;if(Q==="comma"&&P0(w)){if(D&&W)w=dQ(w,W);g=[{value:w.length>0?w.join(",")||null:void 0}]}else if(P0(K))g=K;else{let b=Object.keys(w);g=$?b.sort($):b}let d=H?String(Z).replace(/\./g,"%2E"):String(Z),m=J&&P0(w)&&w.length===1?d+"[]":d;if(X&&P0(w)&&w.length===0)return m+"[]";for(let b=0;b<g.length;++b){let i=g[b],Y0=typeof i==="object"&&typeof i.value<"u"?i.value:w[i];if(G&&Y0===null)continue;let f=V&&H?i.replace(/\./g,"%2E"):i,j0=P0(w)?typeof Q==="function"?Q(m,f):m:m+(V?"."+f:"["+f+"]");_.set(Y,E);let b0=new WeakMap;b0.set(pQ,_),KV(S,$V(Y0,j0,Q,J,X,z,G,H,Q==="comma"&&D&&P0(w)?null:W,K,$,V,q,M,B,D,T,b0))}return S}function Yw(Y=_0){if(typeof Y.allowEmptyArrays<"u"&&typeof Y.allowEmptyArrays!=="boolean")throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof Y.encodeDotInKeys<"u"&&typeof Y.encodeDotInKeys!=="boolean")throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(Y.encoder!==null&&typeof Y.encoder<"u"&&typeof Y.encoder!=="function")throw TypeError("Encoder has to be a function.");let Z=Y.charset||_0.charset;if(typeof Y.charset<"u"&&Y.charset!=="utf-8"&&Y.charset!=="iso-8859-1")throw TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");let Q=o7;if(typeof Y.format<"u"){if(!t7(s7,Y.format))throw TypeError("Unknown format option provided.");Q=Y.format}let J=s7[Q],X=_0.filter;if(typeof Y.filter==="function"||P0(Y.filter))X=Y.filter;let z;if(Y.arrayFormat&&Y.arrayFormat in WV)z=Y.arrayFormat;else if("indices"in Y)z=Y.indices?"indices":"repeat";else z=_0.arrayFormat;if("commaRoundTrip"in Y&&typeof Y.commaRoundTrip!=="boolean")throw TypeError("`commaRoundTrip` must be a boolean, or absent");let G=typeof Y.allowDots>"u"?!!Y.encodeDotInKeys===!0?!0:_0.allowDots:!!Y.allowDots;return{addQueryPrefix:typeof Y.addQueryPrefix==="boolean"?Y.addQueryPrefix:_0.addQueryPrefix,allowDots:G,allowEmptyArrays:typeof Y.allowEmptyArrays==="boolean"?!!Y.allowEmptyArrays:_0.allowEmptyArrays,arrayFormat:z,charset:Z,charsetSentinel:typeof Y.charsetSentinel==="boolean"?Y.charsetSentinel:_0.charsetSentinel,commaRoundTrip:!!Y.commaRoundTrip,delimiter:typeof Y.delimiter>"u"?_0.delimiter:Y.delimiter,encode:typeof Y.encode==="boolean"?Y.encode:_0.encode,encodeDotInKeys:typeof Y.encodeDotInKeys==="boolean"?Y.encodeDotInKeys:_0.encodeDotInKeys,encoder:typeof Y.encoder==="function"?Y.encoder:_0.encoder,encodeValuesOnly:typeof Y.encodeValuesOnly==="boolean"?Y.encodeValuesOnly:_0.encodeValuesOnly,filter:X,format:Q,formatter:J,serializeDate:typeof Y.serializeDate==="function"?Y.serializeDate:_0.serializeDate,skipNulls:typeof Y.skipNulls==="boolean"?Y.skipNulls:_0.skipNulls,sort:typeof Y.sort==="function"?Y.sort:null,strictNullHandling:typeof Y.strictNullHandling==="boolean"?Y.strictNullHandling:_0.strictNullHandling}}function cQ(Y,Z={}){let Q=Y,J=Yw(Z),X,z;if(typeof J.filter==="function")z=J.filter,Q=z("",Q);else if(P0(J.filter))z=J.filter,X=z;let G=[];if(typeof Q!=="object"||Q===null)return"";let H=WV[J.arrayFormat],W=H==="comma"&&J.commaRoundTrip;if(!X)X=Object.keys(Q);if(J.sort)X.sort(J.sort);let K=new WeakMap;for(let q=0;q<X.length;++q){let M=X[q];if(J.skipNulls&&Q[M]===null)continue;KV(G,$V(Q[M],M,H,W,J.allowEmptyArrays,J.strictNullHandling,J.skipNulls,J.encodeDotInKeys,J.encode?J.encoder:null,J.filter,J.sort,J.allowDots,J.serializeDate,J.format,J.formatter,J.encodeValuesOnly,J.charset,K))}let $=G.join(J.delimiter),V=J.addQueryPrefix===!0?"?":"";if(J.charsetSentinel)if(J.charset==="iso-8859-1")V+="utf8=%26%2310003%3B&";else V+="utf8=%E2%9C%93&";return $.length>0?V+$:""}var WV,KV=function(Y,Z){Array.prototype.push.apply(Y,P0(Z)?Z:[Z])},HV,_0,pQ;var UV=F(()=>{GV();r7();dY();WV={brackets(Y){return String(Y)+"[]"},comma:"comma",indices(Y,Z){return String(Y)+"["+Z+"]"},repeat(Y){return String(Y)}},_0={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:XV,encodeValuesOnly:!1,format:o7,formatter:gQ,indices:!1,serializeDate(Y){return(HV??(HV=Function.prototype.call.bind(Date.prototype.toISOString)))(Y)},skipNulls:!1,strictNullHandling:!1};pQ={}});var VV=F(()=>{r7();UV()});function FV(Y){let Z=0;for(let X of Y)Z+=X.length;let Q=new Uint8Array(Z),J=0;for(let X of Y)Q.set(X,J),J+=X.length;return Q}function m8(Y){let Z;return(qV??(Z=new globalThis.TextEncoder,qV=Z.encode.bind(Z)))(Y)}function lQ(Y){let Z;return(BV??(Z=new globalThis.TextDecoder,BV=Z.decode.bind(Z)))(Y)}var qV,BV;class u8{constructor(){p0.set(this,void 0),c0.set(this,void 0),u(this,p0,new Uint8Array,"f"),u(this,c0,null,"f")}decode(Y){if(Y==null)return[];let Z=Y instanceof ArrayBuffer?new Uint8Array(Y):typeof Y==="string"?m8(Y):Y;u(this,p0,FV([N(this,p0,"f"),Z]),"f");let Q=[],J;while((J=Qw(N(this,p0,"f"),N(this,c0,"f")))!=null){if(J.carriage&&N(this,c0,"f")==null){u(this,c0,J.index,"f");continue}if(N(this,c0,"f")!=null&&(J.index!==N(this,c0,"f")+1||J.carriage)){Q.push(lQ(N(this,p0,"f").subarray(0,N(this,c0,"f")-1))),u(this,p0,N(this,p0,"f").subarray(N(this,c0,"f")),"f"),u(this,c0,null,"f");continue}let X=N(this,c0,"f")!==null?J.preceding-1:J.preceding,z=lQ(N(this,p0,"f").subarray(0,X));Q.push(z),u(this,p0,N(this,p0,"f").subarray(J.index),"f"),u(this,c0,null,"f")}return Q}flush(){if(!N(this,p0,"f").length)return[];return this.decode(`
|
|
449
|
+
`)}}function Qw(Y,Z){for(let X=Z??0;X<Y.length;X++){if(Y[X]===10)return{preceding:X,index:X+1,carriage:!1};if(Y[X]===13)return{preceding:X,index:X+1,carriage:!0}}return null}function RV(Y){for(let J=0;J<Y.length-1;J++){if(Y[J]===10&&Y[J+1]===10)return J+2;if(Y[J]===13&&Y[J+1]===13)return J+2;if(Y[J]===13&&Y[J+1]===10&&J+3<Y.length&&Y[J+2]===13&&Y[J+3]===10)return J+4}return-1}var p0,c0;var MV=F(()=>{e0();p0=new WeakMap,c0=new WeakMap;u8.NEWLINE_CHARS=new Set([`
|
|
450
|
+
`,"\r"]);u8.NEWLINE_REGEXP=/\r\n|[\n\r]/g});function G4(){}function e7(Y,Z,Q){if(!Z||Y2[Y]>Y2[Q])return G4;else return Z[Y].bind(Z)}function F0(Y){let Z=Y.logger,Q=Y.logLevel??"off";if(!Z)return Jw;let J=DV.get(Z);if(J&&J[0]===Q)return J[1];let X={error:e7("error",Z,Q),warn:e7("warn",Z,Q),info:e7("info",Z,Q),debug:e7("debug",Z,Q)};return DV.set(Z,[Q,X]),X}var Y2,iQ=(Y,Z,Q)=>{if(!Y)return;if(nU(Y2,Y))return Y;F0(Q).warn(`${Z} was set to ${JSON.stringify(Y)}, expected one of ${JSON.stringify(Object.keys(Y2))}`);return},Jw,DV,pY=(Y)=>{if(Y.options)Y.options={...Y.options},delete Y.options.headers;if(Y.headers)Y.headers=Object.fromEntries((Y.headers instanceof Headers?[...Y.headers]:Object.entries(Y.headers)).map(([Z,Q])=>[Z,Z.toLowerCase()==="authorization"||Z.toLowerCase()==="cookie"||Z.toLowerCase()==="set-cookie"?"***":Q]));if("retryOfRequestLogID"in Y){if(Y.retryOfRequestLogID)Y.retryOf=Y.retryOfRequestLogID;delete Y.retryOfRequestLogID}return Y};var H4=F(()=>{dY();Y2={off:0,error:200,warn:300,info:400,debug:500};Jw={error:G4,warn:G4,info:G4,debug:G4},DV=new WeakMap});async function*Xw(Y,Z){if(!Y.body){if(Z.abort(),typeof globalThis.navigator<"u"&&globalThis.navigator.product==="ReactNative")throw new y("The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api");throw new y("Attempted to iterate over a response with no body")}let Q=new LV,J=new u8,X=hQ(Y.body);for await(let z of zw(X))for(let G of J.decode(z)){let H=Q.decode(G);if(H)yield H}for(let z of J.flush()){let G=Q.decode(z);if(G)yield G}}async function*zw(Y){let Z=new Uint8Array;for await(let Q of Y){if(Q==null)continue;let J=Q instanceof ArrayBuffer?new Uint8Array(Q):typeof Q==="string"?m8(Q):Q,X=new Uint8Array(Z.length+J.length);X.set(Z),X.set(J,Z.length),Z=X;let z;while((z=RV(Z))!==-1)yield Z.slice(0,z),Z=Z.slice(z)}if(Z.length>0)yield Z}class LV{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(Y){if(Y.endsWith("\r"))Y=Y.substring(0,Y.length-1);if(!Y){if(!this.event&&!this.data.length)return null;let X={event:this.event,data:this.data.join(`
|
|
451
|
+
`),raw:this.chunks};return this.event=null,this.data=[],this.chunks=[],X}if(this.chunks.push(Y),Y.startsWith(":"))return null;let[Z,Q,J]=Gw(Y,":");if(J.startsWith(" "))J=J.substring(1);if(Z==="event")this.event=J;else if(Z==="data")this.data.push(J);return null}}function Gw(Y,Z){let Q=Y.indexOf(Z);if(Q!==-1)return[Y.substring(0,Q),Z,Y.substring(Q+Z.length)];return[Y,"",""]}var W4,l0;var nQ=F(()=>{e0();MY();MV();H4();MY();l0=class l0{constructor(Y,Z,Q){this.iterator=Y,W4.set(this,void 0),this.controller=Z,u(this,W4,Q,"f")}static fromSSEResponse(Y,Z,Q){let J=!1,X=Q?F0(Q):console;async function*z(){if(J)throw new y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");J=!0;let G=!1;try{for await(let H of Xw(Y,Z)){if(G)continue;if(H.data.startsWith("[DONE]")){G=!0;continue}if(H.event===null||!H.event.startsWith("thread.")){let W;try{W=JSON.parse(H.data)}catch(K){throw X.error("Could not parse message into JSON:",H.data),X.error("From chunk:",H.raw),K}if(W&&W.error)throw new M0(void 0,W.error,void 0,Y.headers);yield W}else{let W;try{W=JSON.parse(H.data)}catch(K){throw console.error("Could not parse message into JSON:",H.data),console.error("From chunk:",H.raw),K}if(H.event=="error")throw new M0(void 0,W.error,W.message,void 0);yield{event:H.event,data:W}}}G=!0}catch(H){if(n1(H))return;throw H}finally{if(!G)Z.abort()}}return new l0(z,Z,Q)}static fromReadableStream(Y,Z,Q){let J=!1;async function*X(){let G=new u8,H=hQ(Y);for await(let W of H)for(let K of G.decode(W))yield K;for(let W of G.flush())yield W}async function*z(){if(J)throw new y("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");J=!0;let G=!1;try{for await(let H of X()){if(G)continue;if(H)yield JSON.parse(H)}G=!0}catch(H){if(n1(H))return;throw H}finally{if(!G)Z.abort()}}return new l0(z,Z,Q)}[(W4=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let Y=[],Z=[],Q=this.iterator(),J=(X)=>{return{next:()=>{if(X.length===0){let z=Q.next();Y.push(z),Z.push(z)}return X.shift()}}};return[new l0(()=>J(Y),this.controller,N(this,W4,"f")),new l0(()=>J(Z),this.controller,N(this,W4,"f"))]}toReadableStream(){let Y=this,Z;return bQ({async start(){Z=Y[Symbol.asyncIterator]()},async pull(Q){try{let{value:J,done:X}=await Z.next();if(X)return Q.close();let z=m8(JSON.stringify(J)+`
|
|
452
|
+
`);Q.enqueue(z)}catch(J){Q.error(J)}},async cancel(){await Z.return?.()}})}}});async function Z2(Y,Z){let{response:Q,requestLogID:J,retryOfRequestLogID:X,startTime:z}=Z,G=await(async()=>{if(Z.options.stream){if(F0(Y).debug("response",Q.status,Q.url,Q.headers,Q.body),Z.options.__streamClass)return Z.options.__streamClass.fromSSEResponse(Q,Z.controller,Y);return l0.fromSSEResponse(Q,Z.controller,Y)}if(Q.status===204)return null;if(Z.options.__binaryResponse)return Q;let W=Q.headers.get("content-type")?.split(";")[0]?.trim();if(W?.includes("application/json")||W?.endsWith("+json")){let V=await Q.json();return aQ(V,Q)}return await Q.text()})();return F0(Y).debug(`[${J}] response parsed`,pY({retryOfRequestLogID:X,url:Q.url,status:Q.status,body:G,durationMs:Date.now()-z})),G}function aQ(Y,Z){if(!Y||typeof Y!=="object"||Array.isArray(Y))return Y;return Object.defineProperty(Y,"_request_id",{value:Z.headers.get("x-request-id"),enumerable:!1})}var oQ=F(()=>{nQ();H4()});var K4,r6;var Q2=F(()=>{e0();oQ();r6=class r6 extends Promise{constructor(Y,Z,Q=Z2){super((J)=>{J(null)});this.responsePromise=Z,this.parseResponse=Q,K4.set(this,void 0),u(this,K4,Y,"f")}_thenUnwrap(Y){return new r6(N(this,K4,"f"),this.responsePromise,async(Z,Q)=>aQ(Y(await this.parseResponse(Z,Q),Q),Q.response))}asResponse(){return this.responsePromise.then((Y)=>Y.response)}async withResponse(){let[Y,Z]=await Promise.all([this.parse(),this.asResponse()]);return{data:Y,response:Z,request_id:Z.headers.get("x-request-id")}}parse(){if(!this.parsedPromise)this.parsedPromise=this.responsePromise.then((Y)=>this.parseResponse(N(this,K4,"f"),Y));return this.parsedPromise}then(Y,Z){return this.parse().then(Y,Z)}catch(Y){return this.parse().catch(Y)}finally(Y){return this.parse().finally(Y)}};K4=new WeakMap});var J2,X2,z2,cY,e,V6;var G0=F(()=>{e0();MY();oQ();Q2();dY();X2=class X2{constructor(Y,Z,Q,J){J2.set(this,void 0),u(this,J2,Y,"f"),this.options=J,this.response=Z,this.body=Q}hasNextPage(){if(!this.getPaginatedItems().length)return!1;return this.nextPageRequestOptions()!=null}async getNextPage(){let Y=this.nextPageRequestOptions();if(!Y)throw new y("No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.");return await N(this,J2,"f").requestAPIList(this.constructor,Y)}async*iterPages(){let Y=this;yield Y;while(Y.hasNextPage())Y=await Y.getNextPage(),yield Y}async*[(J2=new WeakMap,Symbol.asyncIterator)](){for await(let Y of this.iterPages())for(let Z of Y.getPaginatedItems())yield Z}};z2=class z2 extends r6{constructor(Y,Z,Q){super(Y,Z,async(J,X)=>new Q(J,X.response,await Z2(J,X),X.options))}async*[Symbol.asyncIterator](){let Y=await this;for await(let Z of Y)yield Z}};cY=class cY extends X2{constructor(Y,Z,Q,J){super(Y,Z,Q,J);this.data=Q.data||[],this.object=Q.object}getPaginatedItems(){return this.data??[]}nextPageRequestOptions(){return null}};e=class e extends X2{constructor(Y,Z,Q,J){super(Y,Z,Q,J);this.data=Q.data||[],this.has_more=Q.has_more||!1}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let Y=this.getPaginatedItems(),Z=Y[Y.length-1]?.id;if(!Z)return null;return{...this.options,query:{...yQ(this.options.query),after:Z}}}};V6=class V6 extends X2{constructor(Y,Z,Q,J){super(Y,Z,Q,J);this.data=Q.data||[],this.has_more=Q.has_more||!1,this.last_id=Q.last_id||""}getPaginatedItems(){return this.data??[]}hasNextPage(){if(this.has_more===!1)return!1;return super.hasNextPage()}nextPageRequestOptions(){let Y=this.last_id;if(!Y)return null;return{...this.options,query:{...yQ(this.options.query),after:Y}}}}});function d8(Y,Z,Q){return tQ(),new File(Y,Z??"unknown_file",Q)}function $4(Y){return(typeof Y==="object"&&Y!==null&&(("name"in Y)&&Y.name&&String(Y.name)||("url"in Y)&&Y.url&&String(Y.url)||("filename"in Y)&&Y.filename&&String(Y.filename)||("path"in Y)&&Y.path&&String(Y.path))||"").split(/[\\/]/).pop()||void 0}function Ww(Y){let Z=typeof Y==="function"?Y:Y.fetch,Q=TV.get(Z);if(Q)return Q;let J=(async()=>{try{let X="Response"in Z?Z.Response:(await Z("data:,")).constructor,z=new FormData;if(z.toString()===await new X(z).text())return!1;return!0}catch{return!0}})();return TV.set(Z,J),J}var tQ=()=>{if(typeof File>"u"){let{process:Y}=globalThis,Z=typeof Y?.versions?.node==="string"&&parseInt(Y.versions.node.split("."))<20;throw Error("`File` is not defined as a global, which is required for file uploads."+(Z?" Update to Node 20 LTS or newer, or set `globalThis.File` to `import('node:buffer').File`.":""))}},G2=(Y)=>Y!=null&&typeof Y==="object"&&typeof Y[Symbol.asyncIterator]==="function",eQ=async(Y,Z)=>{if(!sQ(Y.body))return Y;return{...Y,body:await _V(Y.body,Z)}},i0=async(Y,Z)=>{return{...Y,body:await _V(Y.body,Z)}},TV,_V=async(Y,Z)=>{if(!await Ww(Z))throw TypeError("The provided fetch function does not support file uploads with the current global FormData class.");let Q=new FormData;return await Promise.all(Object.entries(Y||{}).map(([J,X])=>rQ(Q,J,X))),Q},NV=(Y)=>Y instanceof Blob&&("name"in Y),Kw=(Y)=>typeof Y==="object"&&Y!==null&&(Y instanceof Response||G2(Y)||NV(Y)),sQ=(Y)=>{if(Kw(Y))return!0;if(Array.isArray(Y))return Y.some(sQ);if(Y&&typeof Y==="object"){for(let Z in Y)if(sQ(Y[Z]))return!0}return!1},rQ=async(Y,Z,Q)=>{if(Q===void 0)return;if(Q==null)throw TypeError(`Received null for "${Z}"; to pass null in FormData, you must use the string 'null'`);if(typeof Q==="string"||typeof Q==="number"||typeof Q==="boolean")Y.append(Z,String(Q));else if(Q instanceof Response)Y.append(Z,d8([await Q.blob()],$4(Q)));else if(G2(Q))Y.append(Z,d8([await new Response(a7(Q)).blob()],$4(Q)));else if(NV(Q))Y.append(Z,Q,$4(Q));else if(Array.isArray(Q))await Promise.all(Q.map((J)=>rQ(Y,Z+"[]",J)));else if(typeof Q==="object")await Promise.all(Object.entries(Q).map(([J,X])=>rQ(Y,`${Z}[${J}]`,X)));else throw TypeError(`Invalid value given to form, expected a string, number, boolean, object, Array, File or Blob but got ${Q} instead`)};var TY=F(()=>{TV=new WeakMap});async function H2(Y,Z,Q){if(tQ(),Y=await Y,$w(Y)){if(Y instanceof File)return Y;return d8([await Y.arrayBuffer()],Y.name)}if(Uw(Y)){let X=await Y.blob();return Z||(Z=new URL(Y.url).pathname.split(/[\\/]/).pop()),d8(await YJ(X),Z,Q)}let J=await YJ(Y);if(Z||(Z=$4(Y)),!Q?.type){let X=J.find((z)=>typeof z==="object"&&("type"in z)&&z.type);if(typeof X==="string")Q={...Q,type:X}}return d8(J,Z,Q)}async function YJ(Y){let Z=[];if(typeof Y==="string"||ArrayBuffer.isView(Y)||Y instanceof ArrayBuffer)Z.push(Y);else if(wV(Y))Z.push(Y instanceof Blob?Y:await Y.arrayBuffer());else if(G2(Y))for await(let Q of Y)Z.push(...await YJ(Q));else{let Q=Y?.constructor?.name;throw Error(`Unexpected data type: ${typeof Y}${Q?`; constructor: ${Q}`:""}${Vw(Y)}`)}return Z}function Vw(Y){if(typeof Y!=="object"||Y===null)return"";return`; props: [${Object.getOwnPropertyNames(Y).map((Q)=>`"${Q}"`).join(", ")}]`}var wV=(Y)=>Y!=null&&typeof Y==="object"&&typeof Y.size==="number"&&typeof Y.type==="string"&&typeof Y.text==="function"&&typeof Y.slice==="function"&&typeof Y.arrayBuffer==="function",$w=(Y)=>Y!=null&&typeof Y==="object"&&typeof Y.name==="string"&&typeof Y.lastModified==="number"&&wV(Y),Uw=(Y)=>Y!=null&&typeof Y==="object"&&typeof Y.url==="string"&&typeof Y.blob==="function";var OV=F(()=>{TY();TY()});var ZJ=F(()=>{OV()});class A{constructor(Y){this._client=Y}}function EV(Y){return Y.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var IV,Bw=(Y=EV)=>function Z(Q,...J){if(Q.length===1)return Q[0];let X=!1,z=[],G=Q.reduce(($,V,q)=>{if(/[?#]/.test(V))X=!0;let M=J[q],B=(X?encodeURIComponent:Y)(""+M);if(q!==J.length&&(M==null||typeof M==="object"&&M.toString===Object.getPrototypeOf(Object.getPrototypeOf(M.hasOwnProperty??IV)??IV)?.toString))B=M+"",z.push({start:$.length+V.length,length:B.length,error:`Value of type ${Object.prototype.toString.call(M).slice(8,-1)} is not a valid path parameter`});return $+V+(q===J.length?"":B)},""),H=G.split(/[?#]/,1)[0],W=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,K;while((K=W.exec(H))!==null)z.push({start:K.index,length:K[0].length,error:`Value "${K[0]}" can't be safely passed as a path parameter`});if(z.sort(($,V)=>$.start-V.start),z.length>0){let $=0,V=z.reduce((q,M)=>{let B=" ".repeat(M.start-$),D="^".repeat(M.length);return $=M.start+M.length,q+B+D},"");throw new y(`Path parameters result in path with invalid segments:
|
|
453
|
+
${z.map((q)=>q.error).join(`
|
|
447
454
|
`)}
|
|
448
455
|
${G}
|
|
449
|
-
${q}`)}return G},O=hR(dG);class l6 extends E{list(Y,Z={},Q){return this._client.getAPIList(O`/chat/completions/${Y}/messages`,n,{query:Z,...Q})}}function J8(Y){return Y!==void 0&&"function"in Y&&Y.function!==void 0}function $8(Y){return Y?.$brand==="auto-parseable-response-format"}function Z6(Y){return Y?.$brand==="auto-parseable-tool"}function pG(Y,Z){if(!Z||!M5(Z))return{...Y,choices:Y.choices.map((Q)=>{return lG(Q.message.tool_calls),{...Q,message:{...Q.message,parsed:null,...Q.message.tool_calls?{tool_calls:Q.message.tool_calls}:void 0}}})};return G8(Y,Z)}function G8(Y,Z){let Q=Y.choices.map((X)=>{if(X.finish_reason==="length")throw new t1;if(X.finish_reason==="content_filter")throw new r1;return lG(X.message.tool_calls),{...X,message:{...X.message,...X.message.tool_calls?{tool_calls:X.message.tool_calls?.map((J)=>uR(Z,J))??void 0}:void 0,parsed:X.message.content&&!X.message.refusal?mR(Z,X.message.content):null}}});return{...Y,choices:Q}}function mR(Y,Z){if(Y.response_format?.type!=="json_schema")return null;if(Y.response_format?.type==="json_schema"){if("$parseRaw"in Y.response_format)return Y.response_format.$parseRaw(Z);return JSON.parse(Z)}return null}function uR(Y,Z){let Q=Y.tools?.find((X)=>J8(X)&&X.function?.name===Z.function.name);return{...Z,function:{...Z.function,parsed_arguments:Z6(Q)?Q.$parseRaw(Z.function.arguments):Q?.function.strict?JSON.parse(Z.function.arguments):null}}}function cG(Y,Z){if(!Y||!("tools"in Y)||!Y.tools)return!1;let Q=Y.tools?.find((X)=>J8(X)&&X.function?.name===Z.function.name);return J8(Q)&&(Z6(Q)||Q?.function.strict||!1)}function M5(Y){if($8(Y.response_format))return!0;return Y.tools?.some((Z)=>Z6(Z)||Z.type==="function"&&Z.function.strict===!0)??!1}function lG(Y){for(let Z of Y||[])if(Z.type!=="function")throw new S(`Currently only \`function\` tool calls are supported; Received \`${Z.type}\``)}function iG(Y){for(let Z of Y??[]){if(Z.type!=="function")throw new S(`Currently only \`function\` tool types support auto-parsing; Received \`${Z.type}\``);if(Z.function.strict!==!0)throw new S(`The \`${Z.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var i6=(Y)=>{return Y?.role==="assistant"},D5=(Y)=>{return Y?.role==="tool"};var L5,AZ,IZ,K8,H8,jZ,z8,WY,W8,xZ,SZ,n6,nG;class Q6{constructor(){L5.add(this),this.controller=new AbortController,AZ.set(this,void 0),IZ.set(this,()=>{}),K8.set(this,()=>{}),H8.set(this,void 0),jZ.set(this,()=>{}),z8.set(this,()=>{}),WY.set(this,{}),W8.set(this,!1),xZ.set(this,!1),SZ.set(this,!1),n6.set(this,!1),g(this,AZ,new Promise((Y,Z)=>{g(this,IZ,Y,"f"),g(this,K8,Z,"f")}),"f"),g(this,H8,new Promise((Y,Z)=>{g(this,jZ,Y,"f"),g(this,z8,Z,"f")}),"f"),L(this,AZ,"f").catch(()=>{}),L(this,H8,"f").catch(()=>{})}_run(Y){setTimeout(()=>{Y().then(()=>{this._emitFinal(),this._emit("end")},L(this,L5,"m",nG).bind(this))},0)}_connected(){if(this.ended)return;L(this,IZ,"f").call(this),this._emit("connect")}get ended(){return L(this,W8,"f")}get errored(){return L(this,xZ,"f")}get aborted(){return L(this,SZ,"f")}abort(){this.controller.abort()}on(Y,Z){return(L(this,WY,"f")[Y]||(L(this,WY,"f")[Y]=[])).push({listener:Z}),this}off(Y,Z){let Q=L(this,WY,"f")[Y];if(!Q)return this;let X=Q.findIndex((J)=>J.listener===Z);if(X>=0)Q.splice(X,1);return this}once(Y,Z){return(L(this,WY,"f")[Y]||(L(this,WY,"f")[Y]=[])).push({listener:Z,once:!0}),this}emitted(Y){return new Promise((Z,Q)=>{if(g(this,n6,!0,"f"),Y!=="error")this.once("error",Q);this.once(Y,Z)})}async done(){g(this,n6,!0,"f"),await L(this,H8,"f")}_emit(Y,...Z){if(L(this,W8,"f"))return;if(Y==="end")g(this,W8,!0,"f"),L(this,jZ,"f").call(this);let Q=L(this,WY,"f")[Y];if(Q)L(this,WY,"f")[Y]=Q.filter((X)=>!X.once),Q.forEach(({listener:X})=>X(...Z));if(Y==="abort"){let X=Z[0];if(!L(this,n6,"f")&&!Q?.length)Promise.reject(X);L(this,K8,"f").call(this,X),L(this,z8,"f").call(this,X),this._emit("end");return}if(Y==="error"){let X=Z[0];if(!L(this,n6,"f")&&!Q?.length)Promise.reject(X);L(this,K8,"f").call(this,X),L(this,z8,"f").call(this,X),this._emit("end")}}_emitFinal(){}}AZ=new WeakMap,IZ=new WeakMap,K8=new WeakMap,H8=new WeakMap,jZ=new WeakMap,z8=new WeakMap,WY=new WeakMap,W8=new WeakMap,xZ=new WeakMap,SZ=new WeakMap,n6=new WeakMap,L5=new WeakSet,nG=function Y(Z){if(g(this,xZ,!0,"f"),Z instanceof Error&&Z.name==="AbortError")Z=new K0;if(Z instanceof K0)return g(this,SZ,!0,"f"),this._emit("abort",Z);if(Z instanceof S)return this._emit("error",Z);if(Z instanceof Error){let Q=new S(Z.message);return Q.cause=Z,this._emit("error",Q)}return this._emit("error",new S(String(Z)))};function aG(Y){return typeof Y.parse==="function"}var T0,T5,yZ,_5,w5,N5,oG,sG,dR=10;class U8 extends Q6{constructor(){super(...arguments);T0.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(Y){this._chatCompletions.push(Y),this._emit("chatCompletion",Y);let Z=Y.choices[0]?.message;if(Z)this._addMessage(Z);return Y}_addMessage(Y,Z=!0){if(!("content"in Y))Y.content=null;if(this.messages.push(Y),Z){if(this._emit("message",Y),D5(Y)&&Y.content)this._emit("functionToolCallResult",Y.content);else if(i6(Y)&&Y.tool_calls){for(let Q of Y.tool_calls)if(Q.type==="function")this._emit("functionToolCall",Q.function)}}}async finalChatCompletion(){await this.done();let Y=this._chatCompletions[this._chatCompletions.length-1];if(!Y)throw new S("stream ended without producing a ChatCompletion");return Y}async finalContent(){return await this.done(),L(this,T0,"m",T5).call(this)}async finalMessage(){return await this.done(),L(this,T0,"m",yZ).call(this)}async finalFunctionToolCall(){return await this.done(),L(this,T0,"m",_5).call(this)}async finalFunctionToolCallResult(){return await this.done(),L(this,T0,"m",w5).call(this)}async totalUsage(){return await this.done(),L(this,T0,"m",N5).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let Y=this._chatCompletions[this._chatCompletions.length-1];if(Y)this._emit("finalChatCompletion",Y);let Z=L(this,T0,"m",yZ).call(this);if(Z)this._emit("finalMessage",Z);let Q=L(this,T0,"m",T5).call(this);if(Q)this._emit("finalContent",Q);let X=L(this,T0,"m",_5).call(this);if(X)this._emit("finalFunctionToolCall",X);let J=L(this,T0,"m",w5).call(this);if(J!=null)this._emit("finalFunctionToolCallResult",J);if(this._chatCompletions.some(($)=>$.usage))this._emit("totalUsage",L(this,T0,"m",N5).call(this))}async _createChatCompletion(Y,Z,Q){let X=Q?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}L(this,T0,"m",oG).call(this,Z);let J=await Y.chat.completions.create({...Z,stream:!1},{...Q,signal:this.controller.signal});return this._connected(),this._addChatCompletion(G8(J,Z))}async _runChatCompletion(Y,Z,Q){for(let X of Z.messages)this._addMessage(X,!1);return await this._createChatCompletion(Y,Z,Q)}async _runTools(Y,Z,Q){let{tool_choice:J="auto",stream:$,...G}=Z,K=typeof J!=="string"&&J.type==="function"&&J?.function?.name,{maxChatCompletions:H=dR}=Q||{},W=Z.tools.map((V)=>{if(Z6(V)){if(!V.$callback)throw new S("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:V.$callback,name:V.function.name,description:V.function.description||"",parameters:V.function.parameters,parse:V.$parseRaw,strict:!0}}}return V}),z={};for(let V of W)if(V.type==="function")z[V.function.name||V.function.function.name]=V.function;let q="tools"in Z?W.map((V)=>V.type==="function"?{type:"function",function:{name:V.function.name||V.function.function.name,parameters:V.function.parameters,description:V.function.description,strict:V.function.strict}}:V):void 0;for(let V of Z.messages)this._addMessage(V,!1);for(let V=0;V<H;++V){let B=(await this._createChatCompletion(Y,{...G,tool_choice:J,tools:q,messages:[...this.messages]},Q)).choices[0]?.message;if(!B)throw new S("missing message in ChatCompletion response");if(!B.tool_calls?.length)return;for(let M of B.tool_calls){if(M.type!=="function")continue;let T=M.id,{name:D,arguments:_}=M.function,w=z[D];if(!w){let f=`Invalid tool_call: ${JSON.stringify(D)}. Available options are: ${Object.keys(z).map((m)=>JSON.stringify(m)).join(", ")}. Please try again`;this._addMessage({role:"tool",tool_call_id:T,content:f});continue}else if(K&&K!==D){let f=`Invalid tool_call: ${JSON.stringify(D)}. ${JSON.stringify(K)} requested. Please try again`;this._addMessage({role:"tool",tool_call_id:T,content:f});continue}let N;try{N=aG(w)?await w.parse(_):_}catch(f){let m=f instanceof Error?f.message:String(f);this._addMessage({role:"tool",tool_call_id:T,content:m});continue}let j=await w.function(N,this),x=L(this,T0,"m",sG).call(this,j);if(this._addMessage({role:"tool",tool_call_id:T,content:x}),K)return}}return}}T0=new WeakSet,T5=function Y(){return L(this,T0,"m",yZ).call(this).content??null},yZ=function Y(){let Z=this.messages.length;while(Z-- >0){let Q=this.messages[Z];if(i6(Q))return{...Q,content:Q.content??null,refusal:Q.refusal??null}}throw new S("stream ended without producing a ChatCompletionMessage with role=assistant")},_5=function Y(){for(let Z=this.messages.length-1;Z>=0;Z--){let Q=this.messages[Z];if(i6(Q)&&Q?.tool_calls?.length)return Q.tool_calls.filter((X)=>X.type==="function").at(-1)?.function}return},w5=function Y(){for(let Z=this.messages.length-1;Z>=0;Z--){let Q=this.messages[Z];if(D5(Q)&&Q.content!=null&&typeof Q.content==="string"&&this.messages.some((X)=>X.role==="assistant"&&X.tool_calls?.some((J)=>J.type==="function"&&J.id===Q.tool_call_id)))return Q.content}return},N5=function Y(){let Z={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:Q}of this._chatCompletions)if(Q)Z.completion_tokens+=Q.completion_tokens,Z.prompt_tokens+=Q.prompt_tokens,Z.total_tokens+=Q.total_tokens;return Z},oG=function Y(Z){if(Z.n!=null&&Z.n>1)throw new S("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},sG=function Y(Z){return typeof Z==="string"?Z:Z===void 0?"undefined":JSON.stringify(Z)};class q8 extends U8{static runTools(Y,Z,Q){let X=new q8,J={...Q,headers:{...Q?.headers,"X-Stainless-Helper-Method":"runTools"}};return X._run(()=>X._runTools(Y,Z,J)),X}_addMessage(Y,Z=!0){if(super._addMessage(Y,Z),i6(Y)&&Y.content)this._emit("content",Y.content)}}var W0={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511};class tG extends Error{}class rG extends Error{}function pR(Y,Z=W0.ALL){if(typeof Y!=="string")throw TypeError(`expecting str, got ${typeof Y}`);if(!Y.trim())throw Error(`${Y} is empty`);return cR(Y.trim(),Z)}var cR=(Y,Z)=>{let Q=Y.length,X=0,J=(V)=>{throw new tG(`${V} at position ${X}`)},$=(V)=>{throw new rG(`${V} at position ${X}`)},G=()=>{if(q(),X>=Q)J("Unexpected end of input");if(Y[X]==='"')return K();if(Y[X]==="{")return H();if(Y[X]==="[")return W();if(Y.substring(X,X+4)==="null"||W0.NULL&Z&&Q-X<4&&"null".startsWith(Y.substring(X)))return X+=4,null;if(Y.substring(X,X+4)==="true"||W0.BOOL&Z&&Q-X<4&&"true".startsWith(Y.substring(X)))return X+=4,!0;if(Y.substring(X,X+5)==="false"||W0.BOOL&Z&&Q-X<5&&"false".startsWith(Y.substring(X)))return X+=5,!1;if(Y.substring(X,X+8)==="Infinity"||W0.INFINITY&Z&&Q-X<8&&"Infinity".startsWith(Y.substring(X)))return X+=8,1/0;if(Y.substring(X,X+9)==="-Infinity"||W0.MINUS_INFINITY&Z&&1<Q-X&&Q-X<9&&"-Infinity".startsWith(Y.substring(X)))return X+=9,-1/0;if(Y.substring(X,X+3)==="NaN"||W0.NAN&Z&&Q-X<3&&"NaN".startsWith(Y.substring(X)))return X+=3,NaN;return z()},K=()=>{let V=X,R=!1;X++;while(X<Q&&(Y[X]!=='"'||R&&Y[X-1]==="\\"))R=Y[X]==="\\"?!R:!1,X++;if(Y.charAt(X)=='"')try{return JSON.parse(Y.substring(V,++X-Number(R)))}catch(B){$(String(B))}else if(W0.STR&Z)try{return JSON.parse(Y.substring(V,X-Number(R))+'"')}catch(B){return JSON.parse(Y.substring(V,Y.lastIndexOf("\\"))+'"')}J("Unterminated string literal")},H=()=>{X++,q();let V={};try{while(Y[X]!=="}"){if(q(),X>=Q&&W0.OBJ&Z)return V;let R=K();q(),X++;try{let B=G();Object.defineProperty(V,R,{value:B,writable:!0,enumerable:!0,configurable:!0})}catch(B){if(W0.OBJ&Z)return V;else throw B}if(q(),Y[X]===",")X++}}catch(R){if(W0.OBJ&Z)return V;else J("Expected '}' at end of object")}return X++,V},W=()=>{X++;let V=[];try{while(Y[X]!=="]")if(V.push(G()),q(),Y[X]===",")X++}catch(R){if(W0.ARR&Z)return V;J("Expected ']' at end of array")}return X++,V},z=()=>{if(X===0){if(Y==="-"&&W0.NUM&Z)J("Not sure what '-' is");try{return JSON.parse(Y)}catch(R){if(W0.NUM&Z)try{if(Y[Y.length-1]===".")return JSON.parse(Y.substring(0,Y.lastIndexOf(".")));return JSON.parse(Y.substring(0,Y.lastIndexOf("e")))}catch(B){}$(String(R))}}let V=X;if(Y[X]==="-")X++;while(Y[X]&&!",]}".includes(Y[X]))X++;if(X==Q&&!(W0.NUM&Z))J("Unterminated number literal");try{return JSON.parse(Y.substring(V,X))}catch(R){if(Y.substring(V,X)==="-"&&W0.NUM&Z)J("Not sure what '-' is");try{return JSON.parse(Y.substring(V,Y.lastIndexOf("e")))}catch(B){$(String(B))}}},q=()=>{while(X<Q&&`
|
|
450
|
-
\r `.includes(Y[
|
|
451
|
-
${
|
|
452
|
-
${
|
|
453
|
-
${
|
|
454
|
-
${hZ(Y)}`);return{...m,id:f,type:x,function:{...d,name:v,arguments:b}}})}};return{...R,message:{...D,content:B,role:_,refusal:W.refusal??null},finish_reason:z,index:q,logprobs:V}}),created:J,model:$,object:"chat.completion",...G?{system_fingerprint:G}:{}};return pG(H,Z)}function hZ(Y){return JSON.stringify(Y)}function YK(Y){return}function ZK(Y){}class o6 extends OY{static fromReadableStream(Y){let Z=new o6(null);return Z._run(()=>Z._fromReadableStream(Y)),Z}static runTools(Y,Z,Q){let X=new o6(Z),J={...Q,headers:{...Q?.headers,"X-Stainless-Helper-Method":"runTools"}};return X._run(()=>X._runTools(Y,Z,J)),X}}class PY extends E{constructor(){super(...arguments);this.messages=new l6(this._client)}create(Y,Z){return this._client.post("/chat/completions",{body:Y,...Z,stream:Y.stream??!1})}retrieve(Y,Z){return this._client.get(O`/chat/completions/${Y}`,Z)}update(Y,Z,Q){return this._client.post(O`/chat/completions/${Y}`,{body:Z,...Q})}list(Y={},Z){return this._client.getAPIList("/chat/completions",n,{query:Y,...Z})}delete(Y,Z){return this._client.delete(O`/chat/completions/${Y}`,Z)}parse(Y,Z){return iG(Y.tools),this._client.chat.completions.create(Y,{...Z,headers:{...Z?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap((Q)=>G8(Q,Y))}runTools(Y,Z){if(Y.stream)return o6.runTools(this._client,Y,Z);return q8.runTools(this._client,Y,Z)}stream(Y,Z){return OY.createChatCompletion(this._client,Y,Z)}}PY.Messages=l6;class X6 extends E{constructor(){super(...arguments);this.completions=new PY(this._client)}}X6.Completions=PY;var QK=Symbol("brand.privateNullableHeaders");function*nR(Y){if(!Y)return;if(QK in Y){let{values:X,nulls:J}=Y;yield*X.entries();for(let $ of J)yield[$,null];return}let Z=!1,Q;if(Y instanceof Headers)Q=Y.entries();else if(e2(Y))Q=Y;else Z=!0,Q=Object.entries(Y??{});for(let X of Q){let J=X[0];if(typeof J!=="string")throw TypeError("expected header name to be a string");let $=e2(X[1])?X[1]:[X[1]],G=!1;for(let K of $){if(K===void 0)continue;if(Z&&!G)G=!0,yield[J,null];yield[J,K]}}}var A=(Y)=>{let Z=new Headers,Q=new Set;for(let X of Y){let J=new Set;for(let[$,G]of nR(X)){let K=$.toLowerCase();if(!J.has(K))Z.delete($),J.add(K);if(G===null)Z.delete($),Q.add(K);else Z.append($,G),Q.delete(K)}}return{[QK]:!0,values:Z,nulls:Q}};class V8 extends E{create(Y,Z){return this._client.post("/audio/speech",{body:Y,...Z,headers:A([{Accept:"application/octet-stream"},Z?.headers]),__binaryResponse:!0})}}class B8 extends E{create(Y,Z){return this._client.post("/audio/transcriptions",A0({body:Y,...Z,stream:Y.stream??!1,__metadata:{model:Y.model}},this._client))}}class F8 extends E{create(Y,Z){return this._client.post("/audio/translations",A0({body:Y,...Z,__metadata:{model:Y.model}},this._client))}}class qY extends E{constructor(){super(...arguments);this.transcriptions=new B8(this._client),this.translations=new F8(this._client),this.speech=new V8(this._client)}}qY.Transcriptions=B8;qY.Translations=F8;qY.Speech=V8;class s6 extends E{create(Y,Z){return this._client.post("/batches",{body:Y,...Z})}retrieve(Y,Z){return this._client.get(O`/batches/${Y}`,Z)}list(Y={},Z){return this._client.getAPIList("/batches",n,{query:Y,...Z})}cancel(Y,Z){return this._client.post(O`/batches/${Y}/cancel`,Z)}}class R8 extends E{create(Y,Z){return this._client.post("/assistants",{body:Y,...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}retrieve(Y,Z){return this._client.get(O`/assistants/${Y}`,{...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}update(Y,Z,Q){return this._client.post(O`/assistants/${Y}`,{body:Z,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y={},Z){return this._client.getAPIList("/assistants",n,{query:Y,...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}delete(Y,Z){return this._client.delete(O`/assistants/${Y}`,{...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}}class M8 extends E{create(Y,Z){return this._client.post("/realtime/sessions",{body:Y,...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}}class D8 extends E{create(Y,Z){return this._client.post("/realtime/transcription_sessions",{body:Y,...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}}class J6 extends E{constructor(){super(...arguments);this.sessions=new M8(this._client),this.transcriptionSessions=new D8(this._client)}}J6.Sessions=M8;J6.TranscriptionSessions=D8;class L8 extends E{create(Y,Z){return this._client.post("/chatkit/sessions",{body:Y,...Z,headers:A([{"OpenAI-Beta":"chatkit_beta=v1"},Z?.headers])})}cancel(Y,Z){return this._client.post(O`/chatkit/sessions/${Y}/cancel`,{...Z,headers:A([{"OpenAI-Beta":"chatkit_beta=v1"},Z?.headers])})}}class T8 extends E{retrieve(Y,Z){return this._client.get(O`/chatkit/threads/${Y}`,{...Z,headers:A([{"OpenAI-Beta":"chatkit_beta=v1"},Z?.headers])})}list(Y={},Z){return this._client.getAPIList("/chatkit/threads",wY,{query:Y,...Z,headers:A([{"OpenAI-Beta":"chatkit_beta=v1"},Z?.headers])})}delete(Y,Z){return this._client.delete(O`/chatkit/threads/${Y}`,{...Z,headers:A([{"OpenAI-Beta":"chatkit_beta=v1"},Z?.headers])})}listItems(Y,Z={},Q){return this._client.getAPIList(O`/chatkit/threads/${Y}/items`,wY,{query:Z,...Q,headers:A([{"OpenAI-Beta":"chatkit_beta=v1"},Q?.headers])})}}class $6 extends E{constructor(){super(...arguments);this.sessions=new L8(this._client),this.threads=new T8(this._client)}}$6.Sessions=L8;$6.Threads=T8;class _8 extends E{create(Y,Z,Q){return this._client.post(O`/threads/${Y}/messages`,{body:Z,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}retrieve(Y,Z,Q){let{thread_id:X}=Z;return this._client.get(O`/threads/${X}/messages/${Y}`,{...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}update(Y,Z,Q){let{thread_id:X,...J}=Z;return this._client.post(O`/threads/${X}/messages/${Y}`,{body:J,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y,Z={},Q){return this._client.getAPIList(O`/threads/${Y}/messages`,n,{query:Z,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}delete(Y,Z,Q){let{thread_id:X}=Z;return this._client.delete(O`/threads/${X}/messages/${Y}`,{...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}}class w8 extends E{retrieve(Y,Z,Q){let{thread_id:X,run_id:J,...$}=Z;return this._client.get(O`/threads/${X}/runs/${J}/steps/${Y}`,{query:$,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y,Z,Q){let{thread_id:X,...J}=Z;return this._client.getAPIList(O`/threads/${X}/runs/${Y}/steps`,n,{query:J,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}}var XK=(Y)=>{if(typeof Buffer<"u"){let Z=Buffer.from(Y,"base64");return Array.from(new Float32Array(Z.buffer,Z.byteOffset,Z.length/Float32Array.BYTES_PER_ELEMENT))}else{let Z=atob(Y),Q=Z.length,X=new Uint8Array(Q);for(let J=0;J<Q;J++)X[J]=Z.charCodeAt(J);return Array.from(new Float32Array(X.buffer))}};var EY=(Y)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[Y]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(Y)?.trim();return};var V0,K6,I5,o0,bZ,h0,H6,t6,G6,uZ,I0,gZ,mZ,P8,N8,O8,JK,$K,GK,KK,HK,zK,WK;class CY extends Q6{constructor(){super(...arguments);V0.add(this),I5.set(this,[]),o0.set(this,{}),bZ.set(this,{}),h0.set(this,void 0),H6.set(this,void 0),t6.set(this,void 0),G6.set(this,void 0),uZ.set(this,void 0),I0.set(this,void 0),gZ.set(this,void 0),mZ.set(this,void 0),P8.set(this,void 0)}[(I5=new WeakMap,o0=new WeakMap,bZ=new WeakMap,h0=new WeakMap,H6=new WeakMap,t6=new WeakMap,G6=new WeakMap,uZ=new WeakMap,I0=new WeakMap,gZ=new WeakMap,mZ=new WeakMap,P8=new WeakMap,V0=new WeakSet,Symbol.asyncIterator)](){let Y=[],Z=[],Q=!1;return this.on("event",(X)=>{let J=Z.shift();if(J)J.resolve(X);else Y.push(X)}),this.on("end",()=>{Q=!0;for(let X of Z)X.resolve(void 0);Z.length=0}),this.on("abort",(X)=>{Q=!0;for(let J of Z)J.reject(X);Z.length=0}),this.on("error",(X)=>{Q=!0;for(let J of Z)J.reject(X);Z.length=0}),{next:async()=>{if(!Y.length){if(Q)return{value:void 0,done:!0};return new Promise((J,$)=>Z.push({resolve:J,reject:$})).then((J)=>J?{value:J,done:!1}:{value:void 0,done:!0})}return{value:Y.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}static fromReadableStream(Y){let Z=new K6;return Z._run(()=>Z._fromReadableStream(Y)),Z}async _fromReadableStream(Y,Z){let Q=Z?.signal;if(Q){if(Q.aborted)this.controller.abort();Q.addEventListener("abort",()=>this.controller.abort())}this._connected();let X=k0.fromReadableStream(Y,this.controller);for await(let J of X)L(this,V0,"m",N8).call(this,J);if(X.controller.signal?.aborted)throw new K0;return this._addRun(L(this,V0,"m",O8).call(this))}toReadableStream(){return new k0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(Y,Z,Q,X){let J=new K6;return J._run(()=>J._runToolAssistantStream(Y,Z,Q,{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}async _createToolAssistantStream(Y,Z,Q,X){let J=X?.signal;if(J){if(J.aborted)this.controller.abort();J.addEventListener("abort",()=>this.controller.abort())}let $={...Q,stream:!0},G=await Y.submitToolOutputs(Z,$,{...X,signal:this.controller.signal});this._connected();for await(let K of G)L(this,V0,"m",N8).call(this,K);if(G.controller.signal?.aborted)throw new K0;return this._addRun(L(this,V0,"m",O8).call(this))}static createThreadAssistantStream(Y,Z,Q){let X=new K6;return X._run(()=>X._threadAssistantStream(Y,Z,{...Q,headers:{...Q?.headers,"X-Stainless-Helper-Method":"stream"}})),X}static createAssistantStream(Y,Z,Q,X){let J=new K6;return J._run(()=>J._runAssistantStream(Y,Z,Q,{...X,headers:{...X?.headers,"X-Stainless-Helper-Method":"stream"}})),J}currentEvent(){return L(this,gZ,"f")}currentRun(){return L(this,mZ,"f")}currentMessageSnapshot(){return L(this,h0,"f")}currentRunStepSnapshot(){return L(this,P8,"f")}async finalRunSteps(){return await this.done(),Object.values(L(this,o0,"f"))}async finalMessages(){return await this.done(),Object.values(L(this,bZ,"f"))}async finalRun(){if(await this.done(),!L(this,H6,"f"))throw Error("Final run was not received.");return L(this,H6,"f")}async _createThreadAssistantStream(Y,Z,Q){let X=Q?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}let J={...Z,stream:!0},$=await Y.createAndRun(J,{...Q,signal:this.controller.signal});this._connected();for await(let G of $)L(this,V0,"m",N8).call(this,G);if($.controller.signal?.aborted)throw new K0;return this._addRun(L(this,V0,"m",O8).call(this))}async _createAssistantStream(Y,Z,Q,X){let J=X?.signal;if(J){if(J.aborted)this.controller.abort();J.addEventListener("abort",()=>this.controller.abort())}let $={...Q,stream:!0},G=await Y.create(Z,$,{...X,signal:this.controller.signal});this._connected();for await(let K of G)L(this,V0,"m",N8).call(this,K);if(G.controller.signal?.aborted)throw new K0;return this._addRun(L(this,V0,"m",O8).call(this))}static accumulateDelta(Y,Z){for(let[Q,X]of Object.entries(Z)){if(!Y.hasOwnProperty(Q)){Y[Q]=X;continue}let J=Y[Q];if(J===null||J===void 0){Y[Q]=X;continue}if(Q==="index"||Q==="type"){Y[Q]=X;continue}if(typeof J==="string"&&typeof X==="string")J+=X;else if(typeof J==="number"&&typeof X==="number")J+=X;else if(e1(J)&&e1(X))J=this.accumulateDelta(J,X);else if(Array.isArray(J)&&Array.isArray(X)){if(J.every(($)=>typeof $==="string"||typeof $==="number")){J.push(...X);continue}for(let $ of X){if(!e1($))throw Error(`Expected array delta entry to be an object but got: ${$}`);let G=$.index;if(G==null)throw console.error($),Error("Expected array delta entry to have an `index` property");if(typeof G!=="number")throw Error(`Expected array delta entry \`index\` property to be a number but got ${G}`);let K=J[G];if(K==null)J.push($);else J[G]=this.accumulateDelta(K,$)}continue}else throw Error(`Unhandled record type: ${Q}, deltaValue: ${X}, accValue: ${J}`);Y[Q]=J}return Y}_addRun(Y){return Y}async _threadAssistantStream(Y,Z,Q){return await this._createThreadAssistantStream(Z,Y,Q)}async _runAssistantStream(Y,Z,Q,X){return await this._createAssistantStream(Z,Y,Q,X)}async _runToolAssistantStream(Y,Z,Q,X){return await this._createToolAssistantStream(Z,Y,Q,X)}}K6=CY,N8=function Y(Z){if(this.ended)return;switch(g(this,gZ,Z,"f"),L(this,V0,"m",GK).call(this,Z),Z.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":L(this,V0,"m",WK).call(this,Z);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":L(this,V0,"m",$K).call(this,Z);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":L(this,V0,"m",JK).call(this,Z);break;case"error":throw Error("Encountered an error event in event processing - errors should be processed earlier");default:GM(Z)}},O8=function Y(){if(this.ended)throw new S("stream has ended, this shouldn't happen");if(!L(this,H6,"f"))throw Error("Final run has not been received");return L(this,H6,"f")},JK=function Y(Z){let[Q,X]=L(this,V0,"m",HK).call(this,Z,L(this,h0,"f"));g(this,h0,Q,"f"),L(this,bZ,"f")[Q.id]=Q;for(let J of X){let $=Q.content[J.index];if($?.type=="text")this._emit("textCreated",$.text)}switch(Z.event){case"thread.message.created":this._emit("messageCreated",Z.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",Z.data.delta,Q),Z.data.delta.content)for(let J of Z.data.delta.content){if(J.type=="text"&&J.text){let $=J.text,G=Q.content[J.index];if(G&&G.type=="text")this._emit("textDelta",$,G.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(J.index!=L(this,t6,"f")){if(L(this,G6,"f"))switch(L(this,G6,"f").type){case"text":this._emit("textDone",L(this,G6,"f").text,L(this,h0,"f"));break;case"image_file":this._emit("imageFileDone",L(this,G6,"f").image_file,L(this,h0,"f"));break}g(this,t6,J.index,"f")}g(this,G6,Q.content[J.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(L(this,t6,"f")!==void 0){let J=Z.data.content[L(this,t6,"f")];if(J)switch(J.type){case"image_file":this._emit("imageFileDone",J.image_file,L(this,h0,"f"));break;case"text":this._emit("textDone",J.text,L(this,h0,"f"));break}}if(L(this,h0,"f"))this._emit("messageDone",Z.data);g(this,h0,void 0,"f")}},$K=function Y(Z){let Q=L(this,V0,"m",KK).call(this,Z);switch(g(this,P8,Q,"f"),Z.event){case"thread.run.step.created":this._emit("runStepCreated",Z.data);break;case"thread.run.step.delta":let X=Z.data.delta;if(X.step_details&&X.step_details.type=="tool_calls"&&X.step_details.tool_calls&&Q.step_details.type=="tool_calls")for(let $ of X.step_details.tool_calls)if($.index==L(this,uZ,"f"))this._emit("toolCallDelta",$,Q.step_details.tool_calls[$.index]);else{if(L(this,I0,"f"))this._emit("toolCallDone",L(this,I0,"f"));if(g(this,uZ,$.index,"f"),g(this,I0,Q.step_details.tool_calls[$.index],"f"),L(this,I0,"f"))this._emit("toolCallCreated",L(this,I0,"f"))}this._emit("runStepDelta",Z.data.delta,Q);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":if(g(this,P8,void 0,"f"),Z.data.step_details.type=="tool_calls"){if(L(this,I0,"f"))this._emit("toolCallDone",L(this,I0,"f")),g(this,I0,void 0,"f")}this._emit("runStepDone",Z.data,Q);break;case"thread.run.step.in_progress":break}},GK=function Y(Z){L(this,I5,"f").push(Z),this._emit("event",Z)},KK=function Y(Z){switch(Z.event){case"thread.run.step.created":return L(this,o0,"f")[Z.data.id]=Z.data,Z.data;case"thread.run.step.delta":let Q=L(this,o0,"f")[Z.data.id];if(!Q)throw Error("Received a RunStepDelta before creation of a snapshot");let X=Z.data;if(X.delta){let J=K6.accumulateDelta(Q,X.delta);L(this,o0,"f")[Z.data.id]=J}return L(this,o0,"f")[Z.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":L(this,o0,"f")[Z.data.id]=Z.data;break}if(L(this,o0,"f")[Z.data.id])return L(this,o0,"f")[Z.data.id];throw Error("No snapshot available")},HK=function Y(Z,Q){let X=[];switch(Z.event){case"thread.message.created":return[Z.data,X];case"thread.message.delta":if(!Q)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let J=Z.data;if(J.delta.content)for(let $ of J.delta.content)if($.index in Q.content){let G=Q.content[$.index];Q.content[$.index]=L(this,V0,"m",zK).call(this,$,G)}else Q.content[$.index]=$,X.push($);return[Q,X];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(Q)return[Q,X];else throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},zK=function Y(Z,Q){return K6.accumulateDelta(Q,Z)},WK=function Y(Z){switch(g(this,mZ,Z.data,"f"),Z.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":if(g(this,H6,Z.data,"f"),L(this,I0,"f"))this._emit("toolCallDone",L(this,I0,"f")),g(this,I0,void 0,"f");break;case"thread.run.cancelling":break}};function GM(Y){}class r6 extends E{constructor(){super(...arguments);this.steps=new w8(this._client)}create(Y,Z,Q){let{include:X,...J}=Z;return this._client.post(O`/threads/${Y}/runs`,{query:{include:X},body:J,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers]),stream:Z.stream??!1})}retrieve(Y,Z,Q){let{thread_id:X}=Z;return this._client.get(O`/threads/${X}/runs/${Y}`,{...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}update(Y,Z,Q){let{thread_id:X,...J}=Z;return this._client.post(O`/threads/${X}/runs/${Y}`,{body:J,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y,Z={},Q){return this._client.getAPIList(O`/threads/${Y}/runs`,n,{query:Z,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}cancel(Y,Z,Q){let{thread_id:X}=Z;return this._client.post(O`/threads/${X}/runs/${Y}/cancel`,{...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}async createAndPoll(Y,Z,Q){let X=await this.create(Y,Z,Q);return await this.poll(X.id,{thread_id:Y},Q)}createAndStream(Y,Z,Q){return CY.createAssistantStream(Y,this._client.beta.threads.runs,Z,Q)}async poll(Y,Z,Q){let X=A([Q?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Q?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:J,response:$}=await this.retrieve(Y,Z,{...Q,headers:{...Q?.headers,...X}}).withResponse();switch(J.status){case"queued":case"in_progress":case"cancelling":let G=5000;if(Q?.pollIntervalMs)G=Q.pollIntervalMs;else{let K=$.headers.get("openai-poll-after-ms");if(K){let H=parseInt(K);if(!isNaN(H))G=H}}await n0(G);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return J}}}stream(Y,Z,Q){return CY.createAssistantStream(Y,this._client.beta.threads.runs,Z,Q)}submitToolOutputs(Y,Z,Q){let{thread_id:X,...J}=Z;return this._client.post(O`/threads/${X}/runs/${Y}/submit_tool_outputs`,{body:J,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers]),stream:Z.stream??!1})}async submitToolOutputsAndPoll(Y,Z,Q){let X=await this.submitToolOutputs(Y,Z,Q);return await this.poll(X.id,Z,Q)}submitToolOutputsStream(Y,Z,Q){return CY.createToolAssistantStream(Y,this._client.beta.threads.runs,Z,Q)}}r6.Steps=w8;class z6 extends E{constructor(){super(...arguments);this.runs=new r6(this._client),this.messages=new _8(this._client)}create(Y={},Z){return this._client.post("/threads",{body:Y,...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}retrieve(Y,Z){return this._client.get(O`/threads/${Y}`,{...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}update(Y,Z,Q){return this._client.post(O`/threads/${Y}`,{body:Z,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}delete(Y,Z){return this._client.delete(O`/threads/${Y}`,{...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}createAndRun(Y,Z){return this._client.post("/threads/runs",{body:Y,...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers]),stream:Y.stream??!1})}async createAndRunPoll(Y,Z){let Q=await this.createAndRun(Y,Z);return await this.runs.poll(Q.id,{thread_id:Q.thread_id},Z)}createAndRunStream(Y,Z){return CY.createThreadAssistantStream(Y,this._client.beta.threads,Z)}}z6.Runs=r6;z6.Messages=_8;class s0 extends E{constructor(){super(...arguments);this.realtime=new J6(this._client),this.chatkit=new $6(this._client),this.assistants=new R8(this._client),this.threads=new z6(this._client)}}s0.Realtime=J6;s0.ChatKit=$6;s0.Assistants=R8;s0.Threads=z6;class e6 extends E{create(Y,Z){return this._client.post("/completions",{body:Y,...Z,stream:Y.stream??!1})}}class E8 extends E{retrieve(Y,Z,Q){let{container_id:X}=Z;return this._client.get(O`/containers/${X}/files/${Y}/content`,{...Q,headers:A([{Accept:"application/binary"},Q?.headers]),__binaryResponse:!0})}}class Y1 extends E{constructor(){super(...arguments);this.content=new E8(this._client)}create(Y,Z,Q){return this._client.post(O`/containers/${Y}/files`,A0({body:Z,...Q},this._client))}retrieve(Y,Z,Q){let{container_id:X}=Z;return this._client.get(O`/containers/${X}/files/${Y}`,Q)}list(Y,Z={},Q){return this._client.getAPIList(O`/containers/${Y}/files`,n,{query:Z,...Q})}delete(Y,Z,Q){let{container_id:X}=Z;return this._client.delete(O`/containers/${X}/files/${Y}`,{...Q,headers:A([{Accept:"*/*"},Q?.headers])})}}Y1.Content=E8;class W6 extends E{constructor(){super(...arguments);this.files=new Y1(this._client)}create(Y,Z){return this._client.post("/containers",{body:Y,...Z})}retrieve(Y,Z){return this._client.get(O`/containers/${Y}`,Z)}list(Y={},Z){return this._client.getAPIList("/containers",n,{query:Y,...Z})}delete(Y,Z){return this._client.delete(O`/containers/${Y}`,{...Z,headers:A([{Accept:"*/*"},Z?.headers])})}}W6.Files=Y1;class C8 extends E{create(Y,Z,Q){let{include:X,...J}=Z;return this._client.post(O`/conversations/${Y}/items`,{query:{include:X},body:J,...Q})}retrieve(Y,Z,Q){let{conversation_id:X,...J}=Z;return this._client.get(O`/conversations/${X}/items/${Y}`,{query:J,...Q})}list(Y,Z={},Q){return this._client.getAPIList(O`/conversations/${Y}/items`,wY,{query:Z,...Q})}delete(Y,Z,Q){let{conversation_id:X}=Z;return this._client.delete(O`/conversations/${X}/items/${Y}`,Q)}}class U6 extends E{constructor(){super(...arguments);this.items=new C8(this._client)}create(Y={},Z){return this._client.post("/conversations",{body:Y,...Z})}retrieve(Y,Z){return this._client.get(O`/conversations/${Y}`,Z)}update(Y,Z,Q){return this._client.post(O`/conversations/${Y}`,{body:Z,...Q})}delete(Y,Z){return this._client.delete(O`/conversations/${Y}`,Z)}}U6.Items=C8;class Z1 extends E{create(Y,Z){let Q=!!Y.encoding_format,X=Q?Y.encoding_format:"base64";if(Q)Q0(this._client).debug("embeddings/user defined encoding_format:",Y.encoding_format);let J=this._client.post("/embeddings",{body:{...Y,encoding_format:X},...Z});if(Q)return J;return Q0(this._client).debug("embeddings/decoding base64 embeddings from base64"),J._thenUnwrap(($)=>{if($&&$.data)$.data.forEach((G)=>{let K=G.embedding;G.embedding=XK(K)});return $})}}class k8 extends E{retrieve(Y,Z,Q){let{eval_id:X,run_id:J}=Z;return this._client.get(O`/evals/${X}/runs/${J}/output_items/${Y}`,Q)}list(Y,Z,Q){let{eval_id:X,...J}=Z;return this._client.getAPIList(O`/evals/${X}/runs/${Y}/output_items`,n,{query:J,...Q})}}class Q1 extends E{constructor(){super(...arguments);this.outputItems=new k8(this._client)}create(Y,Z,Q){return this._client.post(O`/evals/${Y}/runs`,{body:Z,...Q})}retrieve(Y,Z,Q){let{eval_id:X}=Z;return this._client.get(O`/evals/${X}/runs/${Y}`,Q)}list(Y,Z={},Q){return this._client.getAPIList(O`/evals/${Y}/runs`,n,{query:Z,...Q})}delete(Y,Z,Q){let{eval_id:X}=Z;return this._client.delete(O`/evals/${X}/runs/${Y}`,Q)}cancel(Y,Z,Q){let{eval_id:X}=Z;return this._client.post(O`/evals/${X}/runs/${Y}`,Q)}}Q1.OutputItems=k8;class q6 extends E{constructor(){super(...arguments);this.runs=new Q1(this._client)}create(Y,Z){return this._client.post("/evals",{body:Y,...Z})}retrieve(Y,Z){return this._client.get(O`/evals/${Y}`,Z)}update(Y,Z,Q){return this._client.post(O`/evals/${Y}`,{body:Z,...Q})}list(Y={},Z){return this._client.getAPIList("/evals",n,{query:Y,...Z})}delete(Y,Z){return this._client.delete(O`/evals/${Y}`,Z)}}q6.Runs=Q1;class X1 extends E{create(Y,Z){return this._client.post("/files",A0({body:Y,...Z},this._client))}retrieve(Y,Z){return this._client.get(O`/files/${Y}`,Z)}list(Y={},Z){return this._client.getAPIList("/files",n,{query:Y,...Z})}delete(Y,Z){return this._client.delete(O`/files/${Y}`,Z)}content(Y,Z){return this._client.get(O`/files/${Y}/content`,{...Z,headers:A([{Accept:"application/binary"},Z?.headers]),__binaryResponse:!0})}async waitForProcessing(Y,{pollInterval:Z=5000,maxWait:Q=1800000}={}){let X=new Set(["processed","error","deleted"]),J=Date.now(),$=await this.retrieve(Y);while(!$.status||!X.has($.status))if(await n0(Z),$=await this.retrieve(Y),Date.now()-J>Q)throw new eY({message:`Giving up on waiting for file ${Y} to finish processing after ${Q} milliseconds.`});return $}}class A8 extends E{}class I8 extends E{run(Y,Z){return this._client.post("/fine_tuning/alpha/graders/run",{body:Y,...Z})}validate(Y,Z){return this._client.post("/fine_tuning/alpha/graders/validate",{body:Y,...Z})}}class J1 extends E{constructor(){super(...arguments);this.graders=new I8(this._client)}}J1.Graders=I8;class j8 extends E{create(Y,Z,Q){return this._client.getAPIList(O`/fine_tuning/checkpoints/${Y}/permissions`,zY,{body:Z,method:"post",...Q})}retrieve(Y,Z={},Q){return this._client.get(O`/fine_tuning/checkpoints/${Y}/permissions`,{query:Z,...Q})}delete(Y,Z,Q){let{fine_tuned_model_checkpoint:X}=Z;return this._client.delete(O`/fine_tuning/checkpoints/${X}/permissions/${Y}`,Q)}}class $1 extends E{constructor(){super(...arguments);this.permissions=new j8(this._client)}}$1.Permissions=j8;class x8 extends E{list(Y,Z={},Q){return this._client.getAPIList(O`/fine_tuning/jobs/${Y}/checkpoints`,n,{query:Z,...Q})}}class G1 extends E{constructor(){super(...arguments);this.checkpoints=new x8(this._client)}create(Y,Z){return this._client.post("/fine_tuning/jobs",{body:Y,...Z})}retrieve(Y,Z){return this._client.get(O`/fine_tuning/jobs/${Y}`,Z)}list(Y={},Z){return this._client.getAPIList("/fine_tuning/jobs",n,{query:Y,...Z})}cancel(Y,Z){return this._client.post(O`/fine_tuning/jobs/${Y}/cancel`,Z)}listEvents(Y,Z={},Q){return this._client.getAPIList(O`/fine_tuning/jobs/${Y}/events`,n,{query:Z,...Q})}pause(Y,Z){return this._client.post(O`/fine_tuning/jobs/${Y}/pause`,Z)}resume(Y,Z){return this._client.post(O`/fine_tuning/jobs/${Y}/resume`,Z)}}G1.Checkpoints=x8;class t0 extends E{constructor(){super(...arguments);this.methods=new A8(this._client),this.jobs=new G1(this._client),this.checkpoints=new $1(this._client),this.alpha=new J1(this._client)}}t0.Methods=A8;t0.Jobs=G1;t0.Checkpoints=$1;t0.Alpha=J1;class S8 extends E{}class V6 extends E{constructor(){super(...arguments);this.graderModels=new S8(this._client)}}V6.GraderModels=S8;class K1 extends E{createVariation(Y,Z){return this._client.post("/images/variations",A0({body:Y,...Z},this._client))}edit(Y,Z){return this._client.post("/images/edits",A0({body:Y,...Z,stream:Y.stream??!1},this._client))}generate(Y,Z){return this._client.post("/images/generations",{body:Y,...Z,stream:Y.stream??!1})}}class H1 extends E{retrieve(Y,Z){return this._client.get(O`/models/${Y}`,Z)}list(Y){return this._client.getAPIList("/models",zY,Y)}delete(Y,Z){return this._client.delete(O`/models/${Y}`,Z)}}class z1 extends E{create(Y,Z){return this._client.post("/moderations",{body:Y,...Z})}}class y8 extends E{accept(Y,Z,Q){return this._client.post(O`/realtime/calls/${Y}/accept`,{body:Z,...Q,headers:A([{Accept:"*/*"},Q?.headers])})}hangup(Y,Z){return this._client.post(O`/realtime/calls/${Y}/hangup`,{...Z,headers:A([{Accept:"*/*"},Z?.headers])})}refer(Y,Z,Q){return this._client.post(O`/realtime/calls/${Y}/refer`,{body:Z,...Q,headers:A([{Accept:"*/*"},Q?.headers])})}reject(Y,Z={},Q){return this._client.post(O`/realtime/calls/${Y}/reject`,{body:Z,...Q,headers:A([{Accept:"*/*"},Q?.headers])})}}class v8 extends E{create(Y,Z){return this._client.post("/realtime/client_secrets",{body:Y,...Z})}}class kY extends E{constructor(){super(...arguments);this.clientSecrets=new v8(this._client),this.calls=new y8(this._client)}}kY.ClientSecrets=v8;kY.Calls=y8;function UK(Y,Z){if(!Z||!PM(Z))return{...Y,output_parsed:null,output:Y.output.map((Q)=>{if(Q.type==="function_call")return{...Q,parsed_arguments:null};if(Q.type==="message")return{...Q,content:Q.content.map((X)=>({...X,parsed:null}))};else return Q})};return j5(Y,Z)}function j5(Y,Z){let Q=Y.output.map((J)=>{if(J.type==="function_call")return{...J,parsed_arguments:kM(Z,J)};if(J.type==="message"){let $=J.content.map((G)=>{if(G.type==="output_text")return{...G,parsed:OM(Z,G.text)};return G});return{...J,content:$}}return J}),X=Object.assign({},Y,{output:Q});if(!Object.getOwnPropertyDescriptor(Y,"output_text"))dZ(X);return Object.defineProperty(X,"output_parsed",{enumerable:!0,get(){for(let J of X.output){if(J.type!=="message")continue;for(let $ of J.content)if($.type==="output_text"&&$.parsed!==null)return $.parsed}return null}}),X}function OM(Y,Z){if(Y.text?.format?.type!=="json_schema")return null;if("$parseRaw"in Y.text?.format)return(Y.text?.format).$parseRaw(Z);return JSON.parse(Z)}function PM(Y){if($8(Y.text?.format))return!0;return!1}function EM(Y){return Y?.$brand==="auto-parseable-tool"}function CM(Y,Z){return Y.find((Q)=>Q.type==="function"&&Q.name===Z)}function kM(Y,Z){let Q=CM(Y.tools??[],Z.name);return{...Z,...Z,parsed_arguments:EM(Q)?Q.$parseRaw(Z.arguments):Q?.strict?JSON.parse(Z.arguments):null}}function dZ(Y){let Z=[];for(let Q of Y.output){if(Q.type!=="message")continue;for(let X of Q.content)if(X.type==="output_text")Z.push(X.text)}Y.output_text=Z.join("")}var W1,pZ,AY,cZ,qK,VK,BK,FK;class lZ extends Q6{constructor(Y){super();W1.add(this),pZ.set(this,void 0),AY.set(this,void 0),cZ.set(this,void 0),g(this,pZ,Y,"f")}static createResponse(Y,Z,Q){let X=new lZ(Z);return X._run(()=>X._createOrRetrieveResponse(Y,Z,{...Q,headers:{...Q?.headers,"X-Stainless-Helper-Method":"stream"}})),X}async _createOrRetrieveResponse(Y,Z,Q){let X=Q?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}L(this,W1,"m",qK).call(this);let J,$=null;if("response_id"in Z)J=await Y.responses.retrieve(Z.response_id,{stream:!0},{...Q,signal:this.controller.signal,stream:!0}),$=Z.starting_after??null;else J=await Y.responses.create({...Z,stream:!0},{...Q,signal:this.controller.signal});this._connected();for await(let G of J)L(this,W1,"m",VK).call(this,G,$);if(J.controller.signal?.aborted)throw new K0;return L(this,W1,"m",BK).call(this)}[(pZ=new WeakMap,AY=new WeakMap,cZ=new WeakMap,W1=new WeakSet,qK=function Y(){if(this.ended)return;g(this,AY,void 0,"f")},VK=function Y(Z,Q){if(this.ended)return;let X=($,G)=>{if(Q==null||G.sequence_number>Q)this._emit($,G)},J=L(this,W1,"m",FK).call(this,Z);switch(X("event",Z),Z.type){case"response.output_text.delta":{let $=J.output[Z.output_index];if(!$)throw new S(`missing output at index ${Z.output_index}`);if($.type==="message"){let G=$.content[Z.content_index];if(!G)throw new S(`missing content at index ${Z.content_index}`);if(G.type!=="output_text")throw new S(`expected content to be 'output_text', got ${G.type}`);X("response.output_text.delta",{...Z,snapshot:G.text})}break}case"response.function_call_arguments.delta":{let $=J.output[Z.output_index];if(!$)throw new S(`missing output at index ${Z.output_index}`);if($.type==="function_call")X("response.function_call_arguments.delta",{...Z,snapshot:$.arguments});break}default:X(Z.type,Z);break}},BK=function Y(){if(this.ended)throw new S("stream has ended, this shouldn't happen");let Z=L(this,AY,"f");if(!Z)throw new S("request ended without sending any events");g(this,AY,void 0,"f");let Q=AM(Z,L(this,pZ,"f"));return g(this,cZ,Q,"f"),Q},FK=function Y(Z){let Q=L(this,AY,"f");if(!Q){if(Z.type!=="response.created")throw new S(`When snapshot hasn't been set yet, expected 'response.created' event, got ${Z.type}`);return Q=g(this,AY,Z.response,"f"),Q}switch(Z.type){case"response.output_item.added":{Q.output.push(Z.item);break}case"response.content_part.added":{let X=Q.output[Z.output_index];if(!X)throw new S(`missing output at index ${Z.output_index}`);let J=X.type,$=Z.part;if(J==="message"&&$.type!=="reasoning_text")X.content.push($);else if(J==="reasoning"&&$.type==="reasoning_text"){if(!X.content)X.content=[];X.content.push($)}break}case"response.output_text.delta":{let X=Q.output[Z.output_index];if(!X)throw new S(`missing output at index ${Z.output_index}`);if(X.type==="message"){let J=X.content[Z.content_index];if(!J)throw new S(`missing content at index ${Z.content_index}`);if(J.type!=="output_text")throw new S(`expected content to be 'output_text', got ${J.type}`);J.text+=Z.delta}break}case"response.function_call_arguments.delta":{let X=Q.output[Z.output_index];if(!X)throw new S(`missing output at index ${Z.output_index}`);if(X.type==="function_call")X.arguments+=Z.delta;break}case"response.reasoning_text.delta":{let X=Q.output[Z.output_index];if(!X)throw new S(`missing output at index ${Z.output_index}`);if(X.type==="reasoning"){let J=X.content?.[Z.content_index];if(!J)throw new S(`missing content at index ${Z.content_index}`);if(J.type!=="reasoning_text")throw new S(`expected content to be 'reasoning_text', got ${J.type}`);J.text+=Z.delta}break}case"response.completed":{g(this,AY,Z.response,"f");break}}return Q},Symbol.asyncIterator)](){let Y=[],Z=[],Q=!1;return this.on("event",(X)=>{let J=Z.shift();if(J)J.resolve(X);else Y.push(X)}),this.on("end",()=>{Q=!0;for(let X of Z)X.resolve(void 0);Z.length=0}),this.on("abort",(X)=>{Q=!0;for(let J of Z)J.reject(X);Z.length=0}),this.on("error",(X)=>{Q=!0;for(let J of Z)J.reject(X);Z.length=0}),{next:async()=>{if(!Y.length){if(Q)return{value:void 0,done:!0};return new Promise((J,$)=>Z.push({resolve:J,reject:$})).then((J)=>J?{value:J,done:!1}:{value:void 0,done:!0})}return{value:Y.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}async finalResponse(){await this.done();let Y=L(this,cZ,"f");if(!Y)throw new S("stream ended without producing a ChatCompletion");return Y}}function AM(Y,Z){return UK(Y,Z)}class f8 extends E{list(Y,Z={},Q){return this._client.getAPIList(O`/responses/${Y}/input_items`,n,{query:Z,...Q})}}class h8 extends E{count(Y={},Z){return this._client.post("/responses/input_tokens",{body:Y,...Z})}}class IY extends E{constructor(){super(...arguments);this.inputItems=new f8(this._client),this.inputTokens=new h8(this._client)}create(Y,Z){return this._client.post("/responses",{body:Y,...Z,stream:Y.stream??!1})._thenUnwrap((Q)=>{if("object"in Q&&Q.object==="response")dZ(Q);return Q})}retrieve(Y,Z={},Q){return this._client.get(O`/responses/${Y}`,{query:Z,...Q,stream:Z?.stream??!1})._thenUnwrap((X)=>{if("object"in X&&X.object==="response")dZ(X);return X})}delete(Y,Z){return this._client.delete(O`/responses/${Y}`,{...Z,headers:A([{Accept:"*/*"},Z?.headers])})}parse(Y,Z){return this._client.responses.create(Y,Z)._thenUnwrap((Q)=>j5(Q,Y))}stream(Y,Z){return lZ.createResponse(this._client,Y,Z)}cancel(Y,Z){return this._client.post(O`/responses/${Y}/cancel`,Z)}compact(Y,Z){return this._client.post("/responses/compact",{body:Y,...Z})}}IY.InputItems=f8;IY.InputTokens=h8;class b8 extends E{create(Y,Z,Q){return this._client.post(O`/uploads/${Y}/parts`,A0({body:Z,...Q},this._client))}}class B6 extends E{constructor(){super(...arguments);this.parts=new b8(this._client)}create(Y,Z){return this._client.post("/uploads",{body:Y,...Z})}cancel(Y,Z){return this._client.post(O`/uploads/${Y}/cancel`,Z)}complete(Y,Z,Q){return this._client.post(O`/uploads/${Y}/complete`,{body:Z,...Q})}}B6.Parts=b8;var RK=async(Y)=>{let Z=await Promise.allSettled(Y),Q=Z.filter((J)=>J.status==="rejected");if(Q.length){for(let J of Q)console.error(J.reason);throw Error(`${Q.length} promise(s) failed - see the above errors`)}let X=[];for(let J of Z)if(J.status==="fulfilled")X.push(J.value);return X};class g8 extends E{create(Y,Z,Q){return this._client.post(O`/vector_stores/${Y}/file_batches`,{body:Z,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}retrieve(Y,Z,Q){let{vector_store_id:X}=Z;return this._client.get(O`/vector_stores/${X}/file_batches/${Y}`,{...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}cancel(Y,Z,Q){let{vector_store_id:X}=Z;return this._client.post(O`/vector_stores/${X}/file_batches/${Y}/cancel`,{...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}async createAndPoll(Y,Z,Q){let X=await this.create(Y,Z);return await this.poll(Y,X.id,Q)}listFiles(Y,Z,Q){let{vector_store_id:X,...J}=Z;return this._client.getAPIList(O`/vector_stores/${X}/file_batches/${Y}/files`,n,{query:J,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}async poll(Y,Z,Q){let X=A([Q?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Q?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:J,response:$}=await this.retrieve(Z,{vector_store_id:Y},{...Q,headers:X}).withResponse();switch(J.status){case"in_progress":let G=5000;if(Q?.pollIntervalMs)G=Q.pollIntervalMs;else{let K=$.headers.get("openai-poll-after-ms");if(K){let H=parseInt(K);if(!isNaN(H))G=H}}await n0(G);break;case"failed":case"cancelled":case"completed":return J}}}async uploadAndPoll(Y,{files:Z,fileIds:Q=[]},X){if(Z==null||Z.length==0)throw Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let J=X?.maxConcurrency??5,$=Math.min(J,Z.length),G=this._client,K=Z.values(),H=[...Q];async function W(q){for(let V of q){let R=await G.files.create({file:V,purpose:"assistants"},X);H.push(R.id)}}let z=Array($).fill(K).map(W);return await RK(z),await this.createAndPoll(Y,{file_ids:H})}}class m8 extends E{create(Y,Z,Q){return this._client.post(O`/vector_stores/${Y}/files`,{body:Z,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}retrieve(Y,Z,Q){let{vector_store_id:X}=Z;return this._client.get(O`/vector_stores/${X}/files/${Y}`,{...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}update(Y,Z,Q){let{vector_store_id:X,...J}=Z;return this._client.post(O`/vector_stores/${X}/files/${Y}`,{body:J,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y,Z={},Q){return this._client.getAPIList(O`/vector_stores/${Y}/files`,n,{query:Z,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}delete(Y,Z,Q){let{vector_store_id:X}=Z;return this._client.delete(O`/vector_stores/${X}/files/${Y}`,{...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}async createAndPoll(Y,Z,Q){let X=await this.create(Y,Z,Q);return await this.poll(Y,X.id,Q)}async poll(Y,Z,Q){let X=A([Q?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Q?.pollIntervalMs?.toString()??void 0}]);while(!0){let J=await this.retrieve(Z,{vector_store_id:Y},{...Q,headers:X}).withResponse(),$=J.data;switch($.status){case"in_progress":let G=5000;if(Q?.pollIntervalMs)G=Q.pollIntervalMs;else{let K=J.response.headers.get("openai-poll-after-ms");if(K){let H=parseInt(K);if(!isNaN(H))G=H}}await n0(G);break;case"failed":case"completed":return $}}}async upload(Y,Z,Q){let X=await this._client.files.create({file:Z,purpose:"assistants"},Q);return this.create(Y,{file_id:X.id},Q)}async uploadAndPoll(Y,Z,Q){let X=await this.upload(Y,Z,Q);return await this.poll(Y,X.id,Q)}content(Y,Z,Q){let{vector_store_id:X}=Z;return this._client.getAPIList(O`/vector_stores/${X}/files/${Y}/content`,zY,{...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}}class jY extends E{constructor(){super(...arguments);this.files=new m8(this._client),this.fileBatches=new g8(this._client)}create(Y,Z){return this._client.post("/vector_stores",{body:Y,...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}retrieve(Y,Z){return this._client.get(O`/vector_stores/${Y}`,{...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}update(Y,Z,Q){return this._client.post(O`/vector_stores/${Y}`,{body:Z,...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y={},Z){return this._client.getAPIList("/vector_stores",n,{query:Y,...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}delete(Y,Z){return this._client.delete(O`/vector_stores/${Y}`,{...Z,headers:A([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}search(Y,Z,Q){return this._client.getAPIList(O`/vector_stores/${Y}/search`,zY,{body:Z,method:"post",...Q,headers:A([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}}jY.Files=m8;jY.FileBatches=g8;class U1 extends E{create(Y,Z){return this._client.post("/videos",F5({body:Y,...Z},this._client))}retrieve(Y,Z){return this._client.get(O`/videos/${Y}`,Z)}list(Y={},Z){return this._client.getAPIList("/videos",wY,{query:Y,...Z})}delete(Y,Z){return this._client.delete(O`/videos/${Y}`,Z)}downloadContent(Y,Z={},Q){return this._client.get(O`/videos/${Y}/content`,{query:Z,...Q,headers:A([{Accept:"application/binary"},Q?.headers]),__binaryResponse:!0})}remix(Y,Z,Q){return this._client.post(O`/videos/${Y}/remix`,F5({body:Z,...Q},this._client))}}var q1,MK,iZ;class V1 extends E{constructor(){super(...arguments);q1.add(this)}async unwrap(Y,Z,Q=this._client.webhookSecret,X=300){return await this.verifySignature(Y,Z,Q,X),JSON.parse(Y)}async verifySignature(Y,Z,Q=this._client.webhookSecret,X=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!=="function"||typeof crypto.subtle.verify!=="function")throw Error("Webhook signature verification is only supported when the `crypto` global is defined");L(this,q1,"m",MK).call(this,Q);let J=A([Z]).values,$=L(this,q1,"m",iZ).call(this,J,"webhook-signature"),G=L(this,q1,"m",iZ).call(this,J,"webhook-timestamp"),K=L(this,q1,"m",iZ).call(this,J,"webhook-id"),H=parseInt(G,10);if(isNaN(H))throw new KY("Invalid webhook timestamp format");let W=Math.floor(Date.now()/1000);if(W-H>X)throw new KY("Webhook timestamp is too old");if(H>W+X)throw new KY("Webhook timestamp is too new");let z=$.split(" ").map((B)=>B.startsWith("v1,")?B.substring(3):B),q=Q.startsWith("whsec_")?Buffer.from(Q.replace("whsec_",""),"base64"):Buffer.from(Q,"utf-8"),V=K?`${K}.${G}.${Y}`:`${G}.${Y}`,R=await crypto.subtle.importKey("raw",q,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let B of z)try{let M=Buffer.from(B,"base64");if(await crypto.subtle.verify("HMAC",R,M,new TextEncoder().encode(V)))return}catch{continue}throw new KY("The given webhook signature does not match the expected signature")}}q1=new WeakSet,MK=function Y(Z){if(typeof Z!=="string"||Z.length===0)throw Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},iZ=function Y(Z,Q){if(!Z)throw Error("Headers are required");let X=Z.get(Q);if(X===null||X===void 0)throw Error(`Missing required header: ${Q}`);return X};var x5,S5,nZ,DK;class c{constructor({baseURL:Y=EY("OPENAI_BASE_URL"),apiKey:Z=EY("OPENAI_API_KEY"),organization:Q=EY("OPENAI_ORG_ID")??null,project:X=EY("OPENAI_PROJECT_ID")??null,webhookSecret:J=EY("OPENAI_WEBHOOK_SECRET")??null,...$}={}){if(x5.add(this),nZ.set(this,void 0),this.completions=new e6(this),this.chat=new X6(this),this.embeddings=new Z1(this),this.files=new X1(this),this.images=new K1(this),this.audio=new qY(this),this.moderations=new z1(this),this.models=new H1(this),this.fineTuning=new t0(this),this.graders=new V6(this),this.vectorStores=new jY(this),this.webhooks=new V1(this),this.beta=new s0(this),this.batches=new s6(this),this.uploads=new B6(this),this.responses=new IY(this),this.realtime=new kY(this),this.conversations=new U6(this),this.evals=new q6(this),this.containers=new W6(this),this.videos=new U1(this),Z===void 0)throw new S("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let G={apiKey:Z,organization:Q,project:X,webhookSecret:J,...$,baseURL:Y||"https://api.openai.com/v1"};if(!G.dangerouslyAllowBrowser&&TG())throw new S(`It looks like you're running in a browser-like environment.
|
|
456
|
+
${V}`)}return G},C;var Z0=F(()=>{MY();IV=Object.freeze(Object.create(null)),C=Bw(EV)});var p8;var W2=F(()=>{G0();Z0();p8=class p8 extends A{list(Y,Z={},Q){return this._client.getAPIList(C`/chat/completions/${Y}/messages`,e,{query:Z,...Q})}}});var zY=F(()=>{MY()});function U4(Y){return Y!==void 0&&"function"in Y&&Y.function!==void 0}function V4(Y){return Y?.$brand==="auto-parseable-response-format"}function t6(Y){return Y?.$brand==="auto-parseable-tool"}function CV(Y,Z){if(!Z||!QJ(Z))return{...Y,choices:Y.choices.map((Q)=>{return kV(Q.message.tool_calls),{...Q,message:{...Q.message,parsed:null,...Q.message.tool_calls?{tool_calls:Q.message.tool_calls}:void 0}}})};return q4(Y,Z)}function q4(Y,Z){let Q=Y.choices.map((J)=>{if(J.finish_reason==="length")throw new J4;if(J.finish_reason==="content_filter")throw new X4;return kV(J.message.tool_calls),{...J,message:{...J.message,...J.message.tool_calls?{tool_calls:J.message.tool_calls?.map((X)=>Dw(Z,X))??void 0}:void 0,parsed:J.message.content&&!J.message.refusal?Mw(Z,J.message.content):null}}});return{...Y,choices:Q}}function Mw(Y,Z){if(Y.response_format?.type!=="json_schema")return null;if(Y.response_format?.type==="json_schema"){if("$parseRaw"in Y.response_format)return Y.response_format.$parseRaw(Z);return JSON.parse(Z)}return null}function Dw(Y,Z){let Q=Y.tools?.find((J)=>U4(J)&&J.function?.name===Z.function.name);return{...Z,function:{...Z.function,parsed_arguments:t6(Q)?Q.$parseRaw(Z.function.arguments):Q?.function.strict?JSON.parse(Z.function.arguments):null}}}function jV(Y,Z){if(!Y||!("tools"in Y)||!Y.tools)return!1;let Q=Y.tools?.find((J)=>U4(J)&&J.function?.name===Z.function.name);return U4(Q)&&(t6(Q)||Q?.function.strict||!1)}function QJ(Y){if(V4(Y.response_format))return!0;return Y.tools?.some((Z)=>t6(Z)||Z.type==="function"&&Z.function.strict===!0)??!1}function kV(Y){for(let Z of Y||[])if(Z.type!=="function")throw new y(`Currently only \`function\` tool calls are supported; Received \`${Z.type}\``)}function AV(Y){for(let Z of Y??[]){if(Z.type!=="function")throw new y(`Currently only \`function\` tool types support auto-parsing; Received \`${Z.type}\``);if(Z.function.strict!==!0)throw new y(`The \`${Z.function.name}\` tool is not marked with \`strict: true\`. Only strict function tools can be auto-parsed`)}}var B4=F(()=>{zY()});var c8=(Y)=>{return Y?.role==="assistant"},JJ=(Y)=>{return Y?.role==="tool"};class e6{constructor(){XJ.add(this),this.controller=new AbortController,K2.set(this,void 0),$2.set(this,()=>{}),F4.set(this,()=>{}),R4.set(this,void 0),U2.set(this,()=>{}),M4.set(this,()=>{}),lY.set(this,{}),D4.set(this,!1),V2.set(this,!1),q2.set(this,!1),l8.set(this,!1),u(this,K2,new Promise((Y,Z)=>{u(this,$2,Y,"f"),u(this,F4,Z,"f")}),"f"),u(this,R4,new Promise((Y,Z)=>{u(this,U2,Y,"f"),u(this,M4,Z,"f")}),"f"),N(this,K2,"f").catch(()=>{}),N(this,R4,"f").catch(()=>{})}_run(Y){setTimeout(()=>{Y().then(()=>{this._emitFinal(),this._emit("end")},N(this,XJ,"m",PV).bind(this))},0)}_connected(){if(this.ended)return;N(this,$2,"f").call(this),this._emit("connect")}get ended(){return N(this,D4,"f")}get errored(){return N(this,V2,"f")}get aborted(){return N(this,q2,"f")}abort(){this.controller.abort()}on(Y,Z){return(N(this,lY,"f")[Y]||(N(this,lY,"f")[Y]=[])).push({listener:Z}),this}off(Y,Z){let Q=N(this,lY,"f")[Y];if(!Q)return this;let J=Q.findIndex((X)=>X.listener===Z);if(J>=0)Q.splice(J,1);return this}once(Y,Z){return(N(this,lY,"f")[Y]||(N(this,lY,"f")[Y]=[])).push({listener:Z,once:!0}),this}emitted(Y){return new Promise((Z,Q)=>{if(u(this,l8,!0,"f"),Y!=="error")this.once("error",Q);this.once(Y,Z)})}async done(){u(this,l8,!0,"f"),await N(this,R4,"f")}_emit(Y,...Z){if(N(this,D4,"f"))return;if(Y==="end")u(this,D4,!0,"f"),N(this,U2,"f").call(this);let Q=N(this,lY,"f")[Y];if(Q)N(this,lY,"f")[Y]=Q.filter((J)=>!J.once),Q.forEach(({listener:J})=>J(...Z));if(Y==="abort"){let J=Z[0];if(!N(this,l8,"f")&&!Q?.length)Promise.reject(J);N(this,F4,"f").call(this,J),N(this,M4,"f").call(this,J),this._emit("end");return}if(Y==="error"){let J=Z[0];if(!N(this,l8,"f")&&!Q?.length)Promise.reject(J);N(this,F4,"f").call(this,J),N(this,M4,"f").call(this,J),this._emit("end")}}_emitFinal(){}}var XJ,K2,$2,F4,R4,U2,M4,lY,D4,V2,q2,l8,PV;var B2=F(()=>{e0();zY();K2=new WeakMap,$2=new WeakMap,F4=new WeakMap,R4=new WeakMap,U2=new WeakMap,M4=new WeakMap,lY=new WeakMap,D4=new WeakMap,V2=new WeakMap,q2=new WeakMap,l8=new WeakMap,XJ=new WeakSet,PV=function Y(Z){if(u(this,V2,!0,"f"),Z instanceof Error&&Z.name==="AbortError")Z=new T0;if(Z instanceof T0)return u(this,q2,!0,"f"),this._emit("abort",Z);if(Z instanceof y)return this._emit("error",Z);if(Z instanceof Error){let Q=new y(Z.message);return Q.cause=Z,this._emit("error",Q)}return this._emit("error",new y(String(Z)))}});function xV(Y){return typeof Y.parse==="function"}var y0,zJ,F2,GJ,HJ,WJ,SV,vV,Lw=10,L4;var KJ=F(()=>{e0();zY();B4();B2();L4=class L4 extends e6{constructor(){super(...arguments);y0.add(this),this._chatCompletions=[],this.messages=[]}_addChatCompletion(Y){this._chatCompletions.push(Y),this._emit("chatCompletion",Y);let Z=Y.choices[0]?.message;if(Z)this._addMessage(Z);return Y}_addMessage(Y,Z=!0){if(!("content"in Y))Y.content=null;if(this.messages.push(Y),Z){if(this._emit("message",Y),JJ(Y)&&Y.content)this._emit("functionToolCallResult",Y.content);else if(c8(Y)&&Y.tool_calls){for(let Q of Y.tool_calls)if(Q.type==="function")this._emit("functionToolCall",Q.function)}}}async finalChatCompletion(){await this.done();let Y=this._chatCompletions[this._chatCompletions.length-1];if(!Y)throw new y("stream ended without producing a ChatCompletion");return Y}async finalContent(){return await this.done(),N(this,y0,"m",zJ).call(this)}async finalMessage(){return await this.done(),N(this,y0,"m",F2).call(this)}async finalFunctionToolCall(){return await this.done(),N(this,y0,"m",GJ).call(this)}async finalFunctionToolCallResult(){return await this.done(),N(this,y0,"m",HJ).call(this)}async totalUsage(){return await this.done(),N(this,y0,"m",WJ).call(this)}allChatCompletions(){return[...this._chatCompletions]}_emitFinal(){let Y=this._chatCompletions[this._chatCompletions.length-1];if(Y)this._emit("finalChatCompletion",Y);let Z=N(this,y0,"m",F2).call(this);if(Z)this._emit("finalMessage",Z);let Q=N(this,y0,"m",zJ).call(this);if(Q)this._emit("finalContent",Q);let J=N(this,y0,"m",GJ).call(this);if(J)this._emit("finalFunctionToolCall",J);let X=N(this,y0,"m",HJ).call(this);if(X!=null)this._emit("finalFunctionToolCallResult",X);if(this._chatCompletions.some((z)=>z.usage))this._emit("totalUsage",N(this,y0,"m",WJ).call(this))}async _createChatCompletion(Y,Z,Q){let J=Q?.signal;if(J){if(J.aborted)this.controller.abort();J.addEventListener("abort",()=>this.controller.abort())}N(this,y0,"m",SV).call(this,Z);let X=await Y.chat.completions.create({...Z,stream:!1},{...Q,signal:this.controller.signal});return this._connected(),this._addChatCompletion(q4(X,Z))}async _runChatCompletion(Y,Z,Q){for(let J of Z.messages)this._addMessage(J,!1);return await this._createChatCompletion(Y,Z,Q)}async _runTools(Y,Z,Q){let{tool_choice:X="auto",stream:z,...G}=Z,H=typeof X!=="string"&&X.type==="function"&&X?.function?.name,{maxChatCompletions:W=Lw}=Q||{},K=Z.tools.map((q)=>{if(t6(q)){if(!q.$callback)throw new y("Tool given to `.runTools()` that does not have an associated function");return{type:"function",function:{function:q.$callback,name:q.function.name,description:q.function.description||"",parameters:q.function.parameters,parse:q.$parseRaw,strict:!0}}}return q}),$={};for(let q of K)if(q.type==="function")$[q.function.name||q.function.function.name]=q.function;let V="tools"in Z?K.map((q)=>q.type==="function"?{type:"function",function:{name:q.function.name||q.function.function.name,parameters:q.function.parameters,description:q.function.description,strict:q.function.strict}}:q):void 0;for(let q of Z.messages)this._addMessage(q,!1);for(let q=0;q<W;++q){let B=(await this._createChatCompletion(Y,{...G,tool_choice:X,tools:V,messages:[...this.messages]},Q)).choices[0]?.message;if(!B)throw new y("missing message in ChatCompletion response");if(!B.tool_calls?.length)return;for(let D of B.tool_calls){if(D.type!=="function")continue;let T=D.id,{name:_,arguments:w}=D.function,I=$[_];if(!I){let g=`Invalid tool_call: ${JSON.stringify(_)}. Available options are: ${Object.keys($).map((d)=>JSON.stringify(d)).join(", ")}. Please try again`;this._addMessage({role:"tool",tool_call_id:T,content:g});continue}else if(H&&H!==_){let g=`Invalid tool_call: ${JSON.stringify(_)}. ${JSON.stringify(H)} requested. Please try again`;this._addMessage({role:"tool",tool_call_id:T,content:g});continue}let E;try{E=xV(I)?await I.parse(w):w}catch(g){let d=g instanceof Error?g.message:String(g);this._addMessage({role:"tool",tool_call_id:T,content:d});continue}let v=await I.function(E,this),S=N(this,y0,"m",vV).call(this,v);if(this._addMessage({role:"tool",tool_call_id:T,content:S}),H)return}}return}};y0=new WeakSet,zJ=function Y(){return N(this,y0,"m",F2).call(this).content??null},F2=function Y(){let Z=this.messages.length;while(Z-- >0){let Q=this.messages[Z];if(c8(Q))return{...Q,content:Q.content??null,refusal:Q.refusal??null}}throw new y("stream ended without producing a ChatCompletionMessage with role=assistant")},GJ=function Y(){for(let Z=this.messages.length-1;Z>=0;Z--){let Q=this.messages[Z];if(c8(Q)&&Q?.tool_calls?.length)return Q.tool_calls.filter((J)=>J.type==="function").at(-1)?.function}return},HJ=function Y(){for(let Z=this.messages.length-1;Z>=0;Z--){let Q=this.messages[Z];if(JJ(Q)&&Q.content!=null&&typeof Q.content==="string"&&this.messages.some((J)=>J.role==="assistant"&&J.tool_calls?.some((X)=>X.type==="function"&&X.id===Q.tool_call_id)))return Q.content}return},WJ=function Y(){let Z={completion_tokens:0,prompt_tokens:0,total_tokens:0};for(let{usage:Q}of this._chatCompletions)if(Q)Z.completion_tokens+=Q.completion_tokens,Z.prompt_tokens+=Q.prompt_tokens,Z.total_tokens+=Q.total_tokens;return Z},SV=function Y(Z){if(Z.n!=null&&Z.n>1)throw new y("ChatCompletion convenience helpers only support n=1 at this time. To use n>1, please use chat.completions.create() directly.")},vV=function Y(Z){return typeof Z==="string"?Z:Z===void 0?"undefined":JSON.stringify(Z)}});var T4;var $J=F(()=>{KJ();T4=class T4 extends L4{static runTools(Y,Z,Q){let J=new T4,X={...Q,headers:{...Q?.headers,"X-Stainless-Helper-Method":"runTools"}};return J._run(()=>J._runTools(Y,Z,X)),J}_addMessage(Y,Z=!0){if(super._addMessage(Y,Z),c8(Y)&&Y.content)this._emit("content",Y.content)}}});function Tw(Y,Z=I0.ALL){if(typeof Y!=="string")throw TypeError(`expecting str, got ${typeof Y}`);if(!Y.trim())throw Error(`${Y} is empty`);return _w(Y.trim(),Z)}var I0,yV,fV,_w=(Y,Z)=>{let Q=Y.length,J=0,X=(q)=>{throw new yV(`${q} at position ${J}`)},z=(q)=>{throw new fV(`${q} at position ${J}`)},G=()=>{if(V(),J>=Q)X("Unexpected end of input");if(Y[J]==='"')return H();if(Y[J]==="{")return W();if(Y[J]==="[")return K();if(Y.substring(J,J+4)==="null"||I0.NULL&Z&&Q-J<4&&"null".startsWith(Y.substring(J)))return J+=4,null;if(Y.substring(J,J+4)==="true"||I0.BOOL&Z&&Q-J<4&&"true".startsWith(Y.substring(J)))return J+=4,!0;if(Y.substring(J,J+5)==="false"||I0.BOOL&Z&&Q-J<5&&"false".startsWith(Y.substring(J)))return J+=5,!1;if(Y.substring(J,J+8)==="Infinity"||I0.INFINITY&Z&&Q-J<8&&"Infinity".startsWith(Y.substring(J)))return J+=8,1/0;if(Y.substring(J,J+9)==="-Infinity"||I0.MINUS_INFINITY&Z&&1<Q-J&&Q-J<9&&"-Infinity".startsWith(Y.substring(J)))return J+=9,-1/0;if(Y.substring(J,J+3)==="NaN"||I0.NAN&Z&&Q-J<3&&"NaN".startsWith(Y.substring(J)))return J+=3,NaN;return $()},H=()=>{let q=J,M=!1;J++;while(J<Q&&(Y[J]!=='"'||M&&Y[J-1]==="\\"))M=Y[J]==="\\"?!M:!1,J++;if(Y.charAt(J)=='"')try{return JSON.parse(Y.substring(q,++J-Number(M)))}catch(B){z(String(B))}else if(I0.STR&Z)try{return JSON.parse(Y.substring(q,J-Number(M))+'"')}catch(B){return JSON.parse(Y.substring(q,Y.lastIndexOf("\\"))+'"')}X("Unterminated string literal")},W=()=>{J++,V();let q={};try{while(Y[J]!=="}"){if(V(),J>=Q&&I0.OBJ&Z)return q;let M=H();V(),J++;try{let B=G();Object.defineProperty(q,M,{value:B,writable:!0,enumerable:!0,configurable:!0})}catch(B){if(I0.OBJ&Z)return q;else throw B}if(V(),Y[J]===",")J++}}catch(M){if(I0.OBJ&Z)return q;else X("Expected '}' at end of object")}return J++,q},K=()=>{J++;let q=[];try{while(Y[J]!=="]")if(q.push(G()),V(),Y[J]===",")J++}catch(M){if(I0.ARR&Z)return q;X("Expected ']' at end of array")}return J++,q},$=()=>{if(J===0){if(Y==="-"&&I0.NUM&Z)X("Not sure what '-' is");try{return JSON.parse(Y)}catch(M){if(I0.NUM&Z)try{if(Y[Y.length-1]===".")return JSON.parse(Y.substring(0,Y.lastIndexOf(".")));return JSON.parse(Y.substring(0,Y.lastIndexOf("e")))}catch(B){}z(String(M))}}let q=J;if(Y[J]==="-")J++;while(Y[J]&&!",]}".includes(Y[J]))J++;if(J==Q&&!(I0.NUM&Z))X("Unterminated number literal");try{return JSON.parse(Y.substring(q,J))}catch(M){if(Y.substring(q,J)==="-"&&I0.NUM&Z)X("Not sure what '-' is");try{return JSON.parse(Y.substring(q,Y.lastIndexOf("e")))}catch(B){z(String(B))}}},V=()=>{while(J<Q&&`
|
|
457
|
+
\r `.includes(Y[J]))J++};return G()},UJ=(Y)=>Tw(Y,I0.ALL^I0.NUM);var bV=F(()=>{I0={STR:1,NUM:2,ARR:4,OBJ:8,NULL:16,BOOL:32,NAN:64,INFINITY:128,MINUS_INFINITY:256,INF:384,SPECIAL:496,ATOM:499,COLLECTION:12,ALL:511};yV=class yV extends Error{};fV=class fV extends Error{}});var VJ=F(()=>{nQ()});function Nw(Y,Z){let{id:Q,choices:J,created:X,model:z,system_fingerprint:G,...H}=Y,W={...H,id:Q,choices:J.map(({message:K,finish_reason:$,index:V,logprobs:q,...M})=>{if(!$)throw new y(`missing finish_reason for choice ${V}`);let{content:B=null,function_call:D,tool_calls:T,..._}=K,w=K.role;if(!w)throw new y(`missing role for choice ${V}`);if(D){let{arguments:I,name:E}=D;if(I==null)throw new y(`missing function_call.arguments for choice ${V}`);if(!E)throw new y(`missing function_call.name for choice ${V}`);return{...M,message:{content:B,function_call:{arguments:I,name:E},role:w,refusal:K.refusal??null},finish_reason:$,index:V,logprobs:q}}if(T)return{...M,index:V,finish_reason:$,logprobs:q,message:{..._,role:w,content:B,refusal:K.refusal??null,tool_calls:T.map((I,E)=>{let{function:v,type:S,id:g,...d}=I,{arguments:m,name:b,...i}=v||{};if(g==null)throw new y(`missing choices[${V}].tool_calls[${E}].id
|
|
458
|
+
${D2(Y)}`);if(S==null)throw new y(`missing choices[${V}].tool_calls[${E}].type
|
|
459
|
+
${D2(Y)}`);if(b==null)throw new y(`missing choices[${V}].tool_calls[${E}].function.name
|
|
460
|
+
${D2(Y)}`);if(m==null)throw new y(`missing choices[${V}].tool_calls[${E}].function.arguments
|
|
461
|
+
${D2(Y)}`);return{...d,id:g,type:S,function:{...i,name:b,arguments:m}}})}};return{...M,message:{..._,content:B,role:w,refusal:K.refusal??null},finish_reason:$,index:V,logprobs:q}}),created:X,model:z,object:"chat.completion",...G?{system_fingerprint:G}:{}};return CV(W,Z)}function D2(Y){return JSON.stringify(Y)}function gV(Y){return}function mV(Y){}var N0,iY,i8,q6,qJ,R2,BJ,FJ,RJ,M2,MJ,hV,B6;var L2=F(()=>{e0();bV();zY();B4();VJ();KJ();B6=class B6 extends L4{constructor(Y){super();N0.add(this),iY.set(this,void 0),i8.set(this,void 0),q6.set(this,void 0),u(this,iY,Y,"f"),u(this,i8,[],"f")}get currentChatCompletionSnapshot(){return N(this,q6,"f")}static fromReadableStream(Y){let Z=new B6(null);return Z._run(()=>Z._fromReadableStream(Y)),Z}static createChatCompletion(Y,Z,Q){let J=new B6(Z);return J._run(()=>J._runChatCompletion(Y,{...Z,stream:!0},{...Q,headers:{...Q?.headers,"X-Stainless-Helper-Method":"stream"}})),J}async _createChatCompletion(Y,Z,Q){super._createChatCompletion;let J=Q?.signal;if(J){if(J.aborted)this.controller.abort();J.addEventListener("abort",()=>this.controller.abort())}N(this,N0,"m",qJ).call(this);let X=await Y.chat.completions.create({...Z,stream:!0},{...Q,signal:this.controller.signal});this._connected();for await(let z of X)N(this,N0,"m",BJ).call(this,z);if(X.controller.signal?.aborted)throw new T0;return this._addChatCompletion(N(this,N0,"m",M2).call(this))}async _fromReadableStream(Y,Z){let Q=Z?.signal;if(Q){if(Q.aborted)this.controller.abort();Q.addEventListener("abort",()=>this.controller.abort())}N(this,N0,"m",qJ).call(this),this._connected();let J=l0.fromReadableStream(Y,this.controller),X;for await(let z of J){if(X&&X!==z.id)this._addChatCompletion(N(this,N0,"m",M2).call(this));N(this,N0,"m",BJ).call(this,z),X=z.id}if(J.controller.signal?.aborted)throw new T0;return this._addChatCompletion(N(this,N0,"m",M2).call(this))}[(iY=new WeakMap,i8=new WeakMap,q6=new WeakMap,N0=new WeakSet,qJ=function Y(){if(this.ended)return;u(this,q6,void 0,"f")},R2=function Y(Z){let Q=N(this,i8,"f")[Z.index];if(Q)return Q;return Q={content_done:!1,refusal_done:!1,logprobs_content_done:!1,logprobs_refusal_done:!1,done_tool_calls:new Set,current_tool_call_index:null},N(this,i8,"f")[Z.index]=Q,Q},BJ=function Y(Z){if(this.ended)return;let Q=N(this,N0,"m",hV).call(this,Z);this._emit("chunk",Z,Q);for(let J of Z.choices){let X=Q.choices[J.index];if(J.delta.content!=null&&X.message?.role==="assistant"&&X.message?.content)this._emit("content",J.delta.content,X.message.content),this._emit("content.delta",{delta:J.delta.content,snapshot:X.message.content,parsed:X.message.parsed});if(J.delta.refusal!=null&&X.message?.role==="assistant"&&X.message?.refusal)this._emit("refusal.delta",{delta:J.delta.refusal,snapshot:X.message.refusal});if(J.logprobs?.content!=null&&X.message?.role==="assistant")this._emit("logprobs.content.delta",{content:J.logprobs?.content,snapshot:X.logprobs?.content??[]});if(J.logprobs?.refusal!=null&&X.message?.role==="assistant")this._emit("logprobs.refusal.delta",{refusal:J.logprobs?.refusal,snapshot:X.logprobs?.refusal??[]});let z=N(this,N0,"m",R2).call(this,X);if(X.finish_reason){if(N(this,N0,"m",RJ).call(this,X),z.current_tool_call_index!=null)N(this,N0,"m",FJ).call(this,X,z.current_tool_call_index)}for(let G of J.delta.tool_calls??[]){if(z.current_tool_call_index!==G.index){if(N(this,N0,"m",RJ).call(this,X),z.current_tool_call_index!=null)N(this,N0,"m",FJ).call(this,X,z.current_tool_call_index)}z.current_tool_call_index=G.index}for(let G of J.delta.tool_calls??[]){let H=X.message.tool_calls?.[G.index];if(!H?.type)continue;if(H?.type==="function")this._emit("tool_calls.function.arguments.delta",{name:H.function?.name,index:G.index,arguments:H.function.arguments,parsed_arguments:H.function.parsed_arguments,arguments_delta:G.function?.arguments??""});else mV(H?.type)}}},FJ=function Y(Z,Q){if(N(this,N0,"m",R2).call(this,Z).done_tool_calls.has(Q))return;let X=Z.message.tool_calls?.[Q];if(!X)throw Error("no tool call snapshot");if(!X.type)throw Error("tool call snapshot missing `type`");if(X.type==="function"){let z=N(this,iY,"f")?.tools?.find((G)=>U4(G)&&G.function.name===X.function.name);this._emit("tool_calls.function.arguments.done",{name:X.function.name,index:Q,arguments:X.function.arguments,parsed_arguments:t6(z)?z.$parseRaw(X.function.arguments):z?.function.strict?JSON.parse(X.function.arguments):null})}else mV(X.type)},RJ=function Y(Z){let Q=N(this,N0,"m",R2).call(this,Z);if(Z.message.content&&!Q.content_done){Q.content_done=!0;let J=N(this,N0,"m",MJ).call(this);this._emit("content.done",{content:Z.message.content,parsed:J?J.$parseRaw(Z.message.content):null})}if(Z.message.refusal&&!Q.refusal_done)Q.refusal_done=!0,this._emit("refusal.done",{refusal:Z.message.refusal});if(Z.logprobs?.content&&!Q.logprobs_content_done)Q.logprobs_content_done=!0,this._emit("logprobs.content.done",{content:Z.logprobs.content});if(Z.logprobs?.refusal&&!Q.logprobs_refusal_done)Q.logprobs_refusal_done=!0,this._emit("logprobs.refusal.done",{refusal:Z.logprobs.refusal})},M2=function Y(){if(this.ended)throw new y("stream has ended, this shouldn't happen");let Z=N(this,q6,"f");if(!Z)throw new y("request ended without sending any chunks");return u(this,q6,void 0,"f"),u(this,i8,[],"f"),Nw(Z,N(this,iY,"f"))},MJ=function Y(){let Z=N(this,iY,"f")?.response_format;if(V4(Z))return Z;return null},hV=function Y(Z){var Q,J,X,z;let G=N(this,q6,"f"),{choices:H,...W}=Z;if(!G)G=u(this,q6,{...W,choices:[]},"f");else Object.assign(G,W);for(let{delta:K,finish_reason:$,index:V,logprobs:q=null,...M}of Z.choices){let B=G.choices[V];if(!B)B=G.choices[V]={finish_reason:$,index:V,message:{},logprobs:q,...M};if(q)if(!B.logprobs)B.logprobs=Object.assign({},q);else{let{content:v,refusal:S,...g}=q;if(gV(g),Object.assign(B.logprobs,g),v)(Q=B.logprobs).content??(Q.content=[]),B.logprobs.content.push(...v);if(S)(J=B.logprobs).refusal??(J.refusal=[]),B.logprobs.refusal.push(...S)}if($){if(B.finish_reason=$,N(this,iY,"f")&&QJ(N(this,iY,"f"))){if($==="length")throw new J4;if($==="content_filter")throw new X4}}if(Object.assign(B,M),!K)continue;let{content:D,refusal:T,function_call:_,role:w,tool_calls:I,...E}=K;if(gV(E),Object.assign(B.message,E),T)B.message.refusal=(B.message.refusal||"")+T;if(w)B.message.role=w;if(_)if(!B.message.function_call)B.message.function_call=_;else{if(_.name)B.message.function_call.name=_.name;if(_.arguments)(X=B.message.function_call).arguments??(X.arguments=""),B.message.function_call.arguments+=_.arguments}if(D){if(B.message.content=(B.message.content||"")+D,!B.message.refusal&&N(this,N0,"m",MJ).call(this))B.message.parsed=UJ(B.message.content)}if(I){if(!B.message.tool_calls)B.message.tool_calls=[];for(let{index:v,id:S,type:g,function:d,...m}of I){let b=(z=B.message.tool_calls)[v]??(z[v]={});if(Object.assign(b,m),S)b.id=S;if(g)b.type=g;if(d)b.function??(b.function={name:d.name??"",arguments:""});if(d?.name)b.function.name=d.name;if(d?.arguments){if(b.function.arguments+=d.arguments,jV(N(this,iY,"f"),b))b.function.parsed_arguments=UJ(b.function.arguments)}}}}return G},Symbol.asyncIterator)](){let Y=[],Z=[],Q=!1;return this.on("chunk",(J)=>{let X=Z.shift();if(X)X.resolve(J);else Y.push(J)}),this.on("end",()=>{Q=!0;for(let J of Z)J.resolve(void 0);Z.length=0}),this.on("abort",(J)=>{Q=!0;for(let X of Z)X.reject(J);Z.length=0}),this.on("error",(J)=>{Q=!0;for(let X of Z)X.reject(J);Z.length=0}),{next:async()=>{if(!Y.length){if(Q)return{value:void 0,done:!0};return new Promise((X,z)=>Z.push({resolve:X,reject:z})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:Y.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}toReadableStream(){return new l0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}}});var n8;var DJ=F(()=>{L2();n8=class n8 extends B6{static fromReadableStream(Y){let Z=new n8(null);return Z._run(()=>Z._fromReadableStream(Y)),Z}static runTools(Y,Z,Q){let J=new n8(Z),X={...Q,headers:{...Q?.headers,"X-Stainless-Helper-Method":"runTools"}};return J._run(()=>J._runTools(Y,Z,X)),J}}});var F6;var _4=F(()=>{W2();W2();G0();Z0();$J();DJ();L2();B4();DJ();L2();$J();F6=class F6 extends A{constructor(){super(...arguments);this.messages=new p8(this._client)}create(Y,Z){return this._client.post("/chat/completions",{body:Y,...Z,stream:Y.stream??!1})}retrieve(Y,Z){return this._client.get(C`/chat/completions/${Y}`,Z)}update(Y,Z,Q){return this._client.post(C`/chat/completions/${Y}`,{body:Z,...Q})}list(Y={},Z){return this._client.getAPIList("/chat/completions",e,{query:Y,...Z})}delete(Y,Z){return this._client.delete(C`/chat/completions/${Y}`,Z)}parse(Y,Z){return AV(Y.tools),this._client.chat.completions.create(Y,{...Z,headers:{...Z?.headers,"X-Stainless-Helper-Method":"chat.completions.parse"}})._thenUnwrap((Q)=>q4(Q,Y))}runTools(Y,Z){if(Y.stream)return n8.runTools(this._client,Y,Z);return T4.runTools(this._client,Y,Z)}stream(Y,Z){return B6.createChatCompletion(this._client,Y,Z)}};F6.Messages=p8});var Y8;var LJ=F(()=>{_4();_4();Y8=class Y8 extends A{constructor(){super(...arguments);this.completions=new F6(this._client)}};Y8.Completions=F6});var uV=F(()=>{_4();W2();_4()});var dV=F(()=>{LJ();uV()});var pV=()=>{};function*Ow(Y){if(!Y)return;if(cV in Y){let{values:J,nulls:X}=Y;yield*J.entries();for(let z of X)yield[z,null];return}let Z=!1,Q;if(Y instanceof Headers)Q=Y.entries();else if(vQ(Y))Q=Y;else Z=!0,Q=Object.entries(Y??{});for(let J of Q){let X=J[0];if(typeof X!=="string")throw TypeError("expected header name to be a string");let z=vQ(J[1])?J[1]:[J[1]],G=!1;for(let H of z){if(H===void 0)continue;if(Z&&!G)G=!0,yield[X,null];yield[X,H]}}}var cV,P=(Y)=>{let Z=new Headers,Q=new Set;for(let J of Y){let X=new Set;for(let[z,G]of Ow(J)){let H=z.toLowerCase();if(!X.has(H))Z.delete(z),X.add(H);if(G===null)Z.delete(z),Q.add(H);else Z.append(z,G),Q.delete(H)}}return{[cV]:!0,values:Z,nulls:Q}};var U0=F(()=>{dY();cV=Symbol("brand.privateNullableHeaders")});var N4;var TJ=F(()=>{U0();N4=class N4 extends A{create(Y,Z){return this._client.post("/audio/speech",{body:Y,...Z,headers:P([{Accept:"application/octet-stream"},Z?.headers]),__binaryResponse:!0})}}});var w4;var _J=F(()=>{TY();w4=class w4 extends A{create(Y,Z){return this._client.post("/audio/transcriptions",i0({body:Y,...Z,stream:Y.stream??!1,__metadata:{model:Y.model}},this._client))}}});var O4;var NJ=F(()=>{TY();O4=class O4 extends A{create(Y,Z){return this._client.post("/audio/translations",i0({body:Y,...Z,__metadata:{model:Y.model}},this._client))}}});var nY;var wJ=F(()=>{TJ();TJ();_J();_J();NJ();NJ();nY=class nY extends A{constructor(){super(...arguments);this.transcriptions=new w4(this._client),this.translations=new O4(this._client),this.speech=new N4(this._client)}};nY.Transcriptions=w4;nY.Translations=O4;nY.Speech=N4});var a8;var OJ=F(()=>{G0();Z0();a8=class a8 extends A{create(Y,Z){return this._client.post("/batches",{body:Y,...Z})}retrieve(Y,Z){return this._client.get(C`/batches/${Y}`,Z)}list(Y={},Z){return this._client.getAPIList("/batches",e,{query:Y,...Z})}cancel(Y,Z){return this._client.post(C`/batches/${Y}/cancel`,Z)}}});var I4;var IJ=F(()=>{G0();U0();Z0();I4=class I4 extends A{create(Y,Z){return this._client.post("/assistants",{body:Y,...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}retrieve(Y,Z){return this._client.get(C`/assistants/${Y}`,{...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}update(Y,Z,Q){return this._client.post(C`/assistants/${Y}`,{body:Z,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y={},Z){return this._client.getAPIList("/assistants",e,{query:Y,...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}delete(Y,Z){return this._client.delete(C`/assistants/${Y}`,{...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}}});var E4;var EJ=F(()=>{U0();E4=class E4 extends A{create(Y,Z){return this._client.post("/realtime/sessions",{body:Y,...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}}});var C4;var CJ=F(()=>{U0();C4=class C4 extends A{create(Y,Z){return this._client.post("/realtime/transcription_sessions",{body:Y,...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}}});var Z8;var jJ=F(()=>{EJ();EJ();CJ();CJ();Z8=class Z8 extends A{constructor(){super(...arguments);this.sessions=new E4(this._client),this.transcriptionSessions=new C4(this._client)}};Z8.Sessions=E4;Z8.TranscriptionSessions=C4});var j4;var kJ=F(()=>{U0();Z0();j4=class j4 extends A{create(Y,Z){return this._client.post("/chatkit/sessions",{body:Y,...Z,headers:P([{"OpenAI-Beta":"chatkit_beta=v1"},Z?.headers])})}cancel(Y,Z){return this._client.post(C`/chatkit/sessions/${Y}/cancel`,{...Z,headers:P([{"OpenAI-Beta":"chatkit_beta=v1"},Z?.headers])})}}});var k4;var AJ=F(()=>{G0();U0();Z0();k4=class k4 extends A{retrieve(Y,Z){return this._client.get(C`/chatkit/threads/${Y}`,{...Z,headers:P([{"OpenAI-Beta":"chatkit_beta=v1"},Z?.headers])})}list(Y={},Z){return this._client.getAPIList("/chatkit/threads",V6,{query:Y,...Z,headers:P([{"OpenAI-Beta":"chatkit_beta=v1"},Z?.headers])})}delete(Y,Z){return this._client.delete(C`/chatkit/threads/${Y}`,{...Z,headers:P([{"OpenAI-Beta":"chatkit_beta=v1"},Z?.headers])})}listItems(Y,Z={},Q){return this._client.getAPIList(C`/chatkit/threads/${Y}/items`,V6,{query:Z,...Q,headers:P([{"OpenAI-Beta":"chatkit_beta=v1"},Q?.headers])})}}});var Q8;var PJ=F(()=>{kJ();kJ();AJ();AJ();Q8=class Q8 extends A{constructor(){super(...arguments);this.sessions=new j4(this._client),this.threads=new k4(this._client)}};Q8.Sessions=j4;Q8.Threads=k4});var A4;var xJ=F(()=>{G0();U0();Z0();A4=class A4 extends A{create(Y,Z,Q){return this._client.post(C`/threads/${Y}/messages`,{body:Z,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}retrieve(Y,Z,Q){let{thread_id:J}=Z;return this._client.get(C`/threads/${J}/messages/${Y}`,{...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}update(Y,Z,Q){let{thread_id:J,...X}=Z;return this._client.post(C`/threads/${J}/messages/${Y}`,{body:X,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y,Z={},Q){return this._client.getAPIList(C`/threads/${Y}/messages`,e,{query:Z,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}delete(Y,Z,Q){let{thread_id:J}=Z;return this._client.delete(C`/threads/${J}/messages/${Y}`,{...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}}});var P4;var SJ=F(()=>{G0();U0();Z0();P4=class P4 extends A{retrieve(Y,Z,Q){let{thread_id:J,run_id:X,...z}=Z;return this._client.get(C`/threads/${J}/runs/${X}/steps/${Y}`,{query:z,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y,Z,Q){let{thread_id:J,...X}=Z;return this._client.getAPIList(C`/threads/${J}/runs/${Y}/steps`,e,{query:X,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}}});var lV=(Y)=>{if(typeof Buffer<"u"){let Z=Buffer.from(Y,"base64");return Array.from(new Float32Array(Z.buffer,Z.byteOffset,Z.length/Float32Array.BYTES_PER_ELEMENT))}else{let Z=atob(Y),Q=Z.length,J=new Uint8Array(Q);for(let X=0;X<Q;X++)J[X]=Z.charCodeAt(X);return Array.from(new Float32Array(J.buffer))}};var iV=F(()=>{MY()});var R6=(Y)=>{if(typeof globalThis.process<"u")return globalThis.process.env?.[Y]?.trim()??void 0;if(typeof globalThis.Deno<"u")return globalThis.Deno.env?.get?.(Y)?.trim();return};var x4=F(()=>{dY();iV();H4()});function bw(Y){}var C0,X8,vJ,_Y,T2,GY,z8,o8,J8,w2,n0,_2,N2,y4,S4,v4,nV,aV,oV,sV,rV,tV,eV,M6;var yJ=F(()=>{e0();VJ();zY();B2();x4();M6=class M6 extends e6{constructor(){super(...arguments);C0.add(this),vJ.set(this,[]),_Y.set(this,{}),T2.set(this,{}),GY.set(this,void 0),z8.set(this,void 0),o8.set(this,void 0),J8.set(this,void 0),w2.set(this,void 0),n0.set(this,void 0),_2.set(this,void 0),N2.set(this,void 0),y4.set(this,void 0)}[(vJ=new WeakMap,_Y=new WeakMap,T2=new WeakMap,GY=new WeakMap,z8=new WeakMap,o8=new WeakMap,J8=new WeakMap,w2=new WeakMap,n0=new WeakMap,_2=new WeakMap,N2=new WeakMap,y4=new WeakMap,C0=new WeakSet,Symbol.asyncIterator)](){let Y=[],Z=[],Q=!1;return this.on("event",(J)=>{let X=Z.shift();if(X)X.resolve(J);else Y.push(J)}),this.on("end",()=>{Q=!0;for(let J of Z)J.resolve(void 0);Z.length=0}),this.on("abort",(J)=>{Q=!0;for(let X of Z)X.reject(J);Z.length=0}),this.on("error",(J)=>{Q=!0;for(let X of Z)X.reject(J);Z.length=0}),{next:async()=>{if(!Y.length){if(Q)return{value:void 0,done:!0};return new Promise((X,z)=>Z.push({resolve:X,reject:z})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:Y.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}static fromReadableStream(Y){let Z=new X8;return Z._run(()=>Z._fromReadableStream(Y)),Z}async _fromReadableStream(Y,Z){let Q=Z?.signal;if(Q){if(Q.aborted)this.controller.abort();Q.addEventListener("abort",()=>this.controller.abort())}this._connected();let J=l0.fromReadableStream(Y,this.controller);for await(let X of J)N(this,C0,"m",S4).call(this,X);if(J.controller.signal?.aborted)throw new T0;return this._addRun(N(this,C0,"m",v4).call(this))}toReadableStream(){return new l0(this[Symbol.asyncIterator].bind(this),this.controller).toReadableStream()}static createToolAssistantStream(Y,Z,Q,J){let X=new X8;return X._run(()=>X._runToolAssistantStream(Y,Z,Q,{...J,headers:{...J?.headers,"X-Stainless-Helper-Method":"stream"}})),X}async _createToolAssistantStream(Y,Z,Q,J){let X=J?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}let z={...Q,stream:!0},G=await Y.submitToolOutputs(Z,z,{...J,signal:this.controller.signal});this._connected();for await(let H of G)N(this,C0,"m",S4).call(this,H);if(G.controller.signal?.aborted)throw new T0;return this._addRun(N(this,C0,"m",v4).call(this))}static createThreadAssistantStream(Y,Z,Q){let J=new X8;return J._run(()=>J._threadAssistantStream(Y,Z,{...Q,headers:{...Q?.headers,"X-Stainless-Helper-Method":"stream"}})),J}static createAssistantStream(Y,Z,Q,J){let X=new X8;return X._run(()=>X._runAssistantStream(Y,Z,Q,{...J,headers:{...J?.headers,"X-Stainless-Helper-Method":"stream"}})),X}currentEvent(){return N(this,_2,"f")}currentRun(){return N(this,N2,"f")}currentMessageSnapshot(){return N(this,GY,"f")}currentRunStepSnapshot(){return N(this,y4,"f")}async finalRunSteps(){return await this.done(),Object.values(N(this,_Y,"f"))}async finalMessages(){return await this.done(),Object.values(N(this,T2,"f"))}async finalRun(){if(await this.done(),!N(this,z8,"f"))throw Error("Final run was not received.");return N(this,z8,"f")}async _createThreadAssistantStream(Y,Z,Q){let J=Q?.signal;if(J){if(J.aborted)this.controller.abort();J.addEventListener("abort",()=>this.controller.abort())}let X={...Z,stream:!0},z=await Y.createAndRun(X,{...Q,signal:this.controller.signal});this._connected();for await(let G of z)N(this,C0,"m",S4).call(this,G);if(z.controller.signal?.aborted)throw new T0;return this._addRun(N(this,C0,"m",v4).call(this))}async _createAssistantStream(Y,Z,Q,J){let X=J?.signal;if(X){if(X.aborted)this.controller.abort();X.addEventListener("abort",()=>this.controller.abort())}let z={...Q,stream:!0},G=await Y.create(Z,z,{...J,signal:this.controller.signal});this._connected();for await(let H of G)N(this,C0,"m",S4).call(this,H);if(G.controller.signal?.aborted)throw new T0;return this._addRun(N(this,C0,"m",v4).call(this))}static accumulateDelta(Y,Z){for(let[Q,J]of Object.entries(Z)){if(!Y.hasOwnProperty(Q)){Y[Q]=J;continue}let X=Y[Q];if(X===null||X===void 0){Y[Q]=J;continue}if(Q==="index"||Q==="type"){Y[Q]=J;continue}if(typeof X==="string"&&typeof J==="string")X+=J;else if(typeof X==="number"&&typeof J==="number")X+=J;else if(z4(X)&&z4(J))X=this.accumulateDelta(X,J);else if(Array.isArray(X)&&Array.isArray(J)){if(X.every((z)=>typeof z==="string"||typeof z==="number")){X.push(...J);continue}for(let z of J){if(!z4(z))throw Error(`Expected array delta entry to be an object but got: ${z}`);let G=z.index;if(G==null)throw console.error(z),Error("Expected array delta entry to have an `index` property");if(typeof G!=="number")throw Error(`Expected array delta entry \`index\` property to be a number but got ${G}`);let H=X[G];if(H==null)X.push(z);else X[G]=this.accumulateDelta(H,z)}continue}else throw Error(`Unhandled record type: ${Q}, deltaValue: ${J}, accValue: ${X}`);Y[Q]=X}return Y}_addRun(Y){return Y}async _threadAssistantStream(Y,Z,Q){return await this._createThreadAssistantStream(Z,Y,Q)}async _runAssistantStream(Y,Z,Q,J){return await this._createAssistantStream(Z,Y,Q,J)}async _runToolAssistantStream(Y,Z,Q,J){return await this._createToolAssistantStream(Z,Y,Q,J)}};X8=M6,S4=function Y(Z){if(this.ended)return;switch(u(this,_2,Z,"f"),N(this,C0,"m",oV).call(this,Z),Z.event){case"thread.created":break;case"thread.run.created":case"thread.run.queued":case"thread.run.in_progress":case"thread.run.requires_action":case"thread.run.completed":case"thread.run.incomplete":case"thread.run.failed":case"thread.run.cancelling":case"thread.run.cancelled":case"thread.run.expired":N(this,C0,"m",eV).call(this,Z);break;case"thread.run.step.created":case"thread.run.step.in_progress":case"thread.run.step.delta":case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":N(this,C0,"m",aV).call(this,Z);break;case"thread.message.created":case"thread.message.in_progress":case"thread.message.delta":case"thread.message.completed":case"thread.message.incomplete":N(this,C0,"m",nV).call(this,Z);break;case"error":throw Error("Encountered an error event in event processing - errors should be processed earlier");default:bw(Z)}},v4=function Y(){if(this.ended)throw new y("stream has ended, this shouldn't happen");if(!N(this,z8,"f"))throw Error("Final run has not been received");return N(this,z8,"f")},nV=function Y(Z){let[Q,J]=N(this,C0,"m",rV).call(this,Z,N(this,GY,"f"));u(this,GY,Q,"f"),N(this,T2,"f")[Q.id]=Q;for(let X of J){let z=Q.content[X.index];if(z?.type=="text")this._emit("textCreated",z.text)}switch(Z.event){case"thread.message.created":this._emit("messageCreated",Z.data);break;case"thread.message.in_progress":break;case"thread.message.delta":if(this._emit("messageDelta",Z.data.delta,Q),Z.data.delta.content)for(let X of Z.data.delta.content){if(X.type=="text"&&X.text){let z=X.text,G=Q.content[X.index];if(G&&G.type=="text")this._emit("textDelta",z,G.text);else throw Error("The snapshot associated with this text delta is not text or missing")}if(X.index!=N(this,o8,"f")){if(N(this,J8,"f"))switch(N(this,J8,"f").type){case"text":this._emit("textDone",N(this,J8,"f").text,N(this,GY,"f"));break;case"image_file":this._emit("imageFileDone",N(this,J8,"f").image_file,N(this,GY,"f"));break}u(this,o8,X.index,"f")}u(this,J8,Q.content[X.index],"f")}break;case"thread.message.completed":case"thread.message.incomplete":if(N(this,o8,"f")!==void 0){let X=Z.data.content[N(this,o8,"f")];if(X)switch(X.type){case"image_file":this._emit("imageFileDone",X.image_file,N(this,GY,"f"));break;case"text":this._emit("textDone",X.text,N(this,GY,"f"));break}}if(N(this,GY,"f"))this._emit("messageDone",Z.data);u(this,GY,void 0,"f")}},aV=function Y(Z){let Q=N(this,C0,"m",sV).call(this,Z);switch(u(this,y4,Q,"f"),Z.event){case"thread.run.step.created":this._emit("runStepCreated",Z.data);break;case"thread.run.step.delta":let J=Z.data.delta;if(J.step_details&&J.step_details.type=="tool_calls"&&J.step_details.tool_calls&&Q.step_details.type=="tool_calls")for(let z of J.step_details.tool_calls)if(z.index==N(this,w2,"f"))this._emit("toolCallDelta",z,Q.step_details.tool_calls[z.index]);else{if(N(this,n0,"f"))this._emit("toolCallDone",N(this,n0,"f"));if(u(this,w2,z.index,"f"),u(this,n0,Q.step_details.tool_calls[z.index],"f"),N(this,n0,"f"))this._emit("toolCallCreated",N(this,n0,"f"))}this._emit("runStepDelta",Z.data.delta,Q);break;case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":if(u(this,y4,void 0,"f"),Z.data.step_details.type=="tool_calls"){if(N(this,n0,"f"))this._emit("toolCallDone",N(this,n0,"f")),u(this,n0,void 0,"f")}this._emit("runStepDone",Z.data,Q);break;case"thread.run.step.in_progress":break}},oV=function Y(Z){N(this,vJ,"f").push(Z),this._emit("event",Z)},sV=function Y(Z){switch(Z.event){case"thread.run.step.created":return N(this,_Y,"f")[Z.data.id]=Z.data,Z.data;case"thread.run.step.delta":let Q=N(this,_Y,"f")[Z.data.id];if(!Q)throw Error("Received a RunStepDelta before creation of a snapshot");let J=Z.data;if(J.delta){let X=X8.accumulateDelta(Q,J.delta);N(this,_Y,"f")[Z.data.id]=X}return N(this,_Y,"f")[Z.data.id];case"thread.run.step.completed":case"thread.run.step.failed":case"thread.run.step.cancelled":case"thread.run.step.expired":case"thread.run.step.in_progress":N(this,_Y,"f")[Z.data.id]=Z.data;break}if(N(this,_Y,"f")[Z.data.id])return N(this,_Y,"f")[Z.data.id];throw Error("No snapshot available")},rV=function Y(Z,Q){let J=[];switch(Z.event){case"thread.message.created":return[Z.data,J];case"thread.message.delta":if(!Q)throw Error("Received a delta with no existing snapshot (there should be one from message creation)");let X=Z.data;if(X.delta.content)for(let z of X.delta.content)if(z.index in Q.content){let G=Q.content[z.index];Q.content[z.index]=N(this,C0,"m",tV).call(this,z,G)}else Q.content[z.index]=z,J.push(z);return[Q,J];case"thread.message.in_progress":case"thread.message.completed":case"thread.message.incomplete":if(Q)return[Q,J];else throw Error("Received thread message event with no existing snapshot")}throw Error("Tried to accumulate a non-message event")},tV=function Y(Z,Q){return X8.accumulateDelta(Q,Z)},eV=function Y(Z){switch(u(this,N2,Z.data,"f"),Z.event){case"thread.run.created":break;case"thread.run.queued":break;case"thread.run.in_progress":break;case"thread.run.requires_action":case"thread.run.cancelled":case"thread.run.failed":case"thread.run.completed":case"thread.run.expired":case"thread.run.incomplete":if(u(this,z8,Z.data,"f"),N(this,n0,"f"))this._emit("toolCallDone",N(this,n0,"f")),u(this,n0,void 0,"f");break;case"thread.run.cancelling":break}}});var s8;var fJ=F(()=>{SJ();SJ();G0();U0();yJ();Z0();s8=class s8 extends A{constructor(){super(...arguments);this.steps=new P4(this._client)}create(Y,Z,Q){let{include:J,...X}=Z;return this._client.post(C`/threads/${Y}/runs`,{query:{include:J},body:X,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers]),stream:Z.stream??!1})}retrieve(Y,Z,Q){let{thread_id:J}=Z;return this._client.get(C`/threads/${J}/runs/${Y}`,{...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}update(Y,Z,Q){let{thread_id:J,...X}=Z;return this._client.post(C`/threads/${J}/runs/${Y}`,{body:X,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y,Z={},Q){return this._client.getAPIList(C`/threads/${Y}/runs`,e,{query:Z,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}cancel(Y,Z,Q){let{thread_id:J}=Z;return this._client.post(C`/threads/${J}/runs/${Y}/cancel`,{...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}async createAndPoll(Y,Z,Q){let J=await this.create(Y,Z,Q);return await this.poll(J.id,{thread_id:Y},Q)}createAndStream(Y,Z,Q){return M6.createAssistantStream(Y,this._client.beta.threads.runs,Z,Q)}async poll(Y,Z,Q){let J=P([Q?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Q?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:X,response:z}=await this.retrieve(Y,Z,{...Q,headers:{...Q?.headers,...J}}).withResponse();switch(X.status){case"queued":case"in_progress":case"cancelling":let G=5000;if(Q?.pollIntervalMs)G=Q.pollIntervalMs;else{let H=z.headers.get("openai-poll-after-ms");if(H){let W=parseInt(H);if(!isNaN(W))G=W}}await DY(G);break;case"requires_action":case"incomplete":case"cancelled":case"completed":case"failed":case"expired":return X}}}stream(Y,Z,Q){return M6.createAssistantStream(Y,this._client.beta.threads.runs,Z,Q)}submitToolOutputs(Y,Z,Q){let{thread_id:J,...X}=Z;return this._client.post(C`/threads/${J}/runs/${Y}/submit_tool_outputs`,{body:X,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers]),stream:Z.stream??!1})}async submitToolOutputsAndPoll(Y,Z,Q){let J=await this.submitToolOutputs(Y,Z,Q);return await this.poll(J.id,Z,Q)}submitToolOutputsStream(Y,Z,Q){return M6.createToolAssistantStream(Y,this._client.beta.threads.runs,Z,Q)}};s8.Steps=P4});var G8;var bJ=F(()=>{xJ();xJ();fJ();fJ();U0();yJ();Z0();G8=class G8 extends A{constructor(){super(...arguments);this.runs=new s8(this._client),this.messages=new A4(this._client)}create(Y={},Z){return this._client.post("/threads",{body:Y,...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}retrieve(Y,Z){return this._client.get(C`/threads/${Y}`,{...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}update(Y,Z,Q){return this._client.post(C`/threads/${Y}`,{body:Z,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}delete(Y,Z){return this._client.delete(C`/threads/${Y}`,{...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}createAndRun(Y,Z){return this._client.post("/threads/runs",{body:Y,...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers]),stream:Y.stream??!1})}async createAndRunPoll(Y,Z){let Q=await this.createAndRun(Y,Z);return await this.runs.poll(Q.id,{thread_id:Q.thread_id},Z)}createAndRunStream(Y,Z){return M6.createThreadAssistantStream(Y,this._client.beta.threads,Z)}};G8.Runs=s8;G8.Messages=A4});var NY;var hJ=F(()=>{IJ();IJ();jJ();jJ();PJ();PJ();bJ();bJ();NY=class NY extends A{constructor(){super(...arguments);this.realtime=new Z8(this._client),this.chatkit=new Q8(this._client),this.assistants=new I4(this._client),this.threads=new G8(this._client)}};NY.Realtime=Z8;NY.ChatKit=Q8;NY.Assistants=I4;NY.Threads=G8});var r8;var gJ=F(()=>{r8=class r8 extends A{create(Y,Z){return this._client.post("/completions",{body:Y,...Z,stream:Y.stream??!1})}}});var f4;var mJ=F(()=>{U0();Z0();f4=class f4 extends A{retrieve(Y,Z,Q){let{container_id:J}=Z;return this._client.get(C`/containers/${J}/files/${Y}/content`,{...Q,headers:P([{Accept:"application/binary"},Q?.headers]),__binaryResponse:!0})}}});var t8;var uJ=F(()=>{mJ();mJ();G0();U0();TY();Z0();t8=class t8 extends A{constructor(){super(...arguments);this.content=new f4(this._client)}create(Y,Z,Q){return this._client.post(C`/containers/${Y}/files`,i0({body:Z,...Q},this._client))}retrieve(Y,Z,Q){let{container_id:J}=Z;return this._client.get(C`/containers/${J}/files/${Y}`,Q)}list(Y,Z={},Q){return this._client.getAPIList(C`/containers/${Y}/files`,e,{query:Z,...Q})}delete(Y,Z,Q){let{container_id:J}=Z;return this._client.delete(C`/containers/${J}/files/${Y}`,{...Q,headers:P([{Accept:"*/*"},Q?.headers])})}};t8.Content=f4});var H8;var dJ=F(()=>{uJ();uJ();G0();U0();Z0();H8=class H8 extends A{constructor(){super(...arguments);this.files=new t8(this._client)}create(Y,Z){return this._client.post("/containers",{body:Y,...Z})}retrieve(Y,Z){return this._client.get(C`/containers/${Y}`,Z)}list(Y={},Z){return this._client.getAPIList("/containers",e,{query:Y,...Z})}delete(Y,Z){return this._client.delete(C`/containers/${Y}`,{...Z,headers:P([{Accept:"*/*"},Z?.headers])})}};H8.Files=t8});var b4;var pJ=F(()=>{G0();Z0();b4=class b4 extends A{create(Y,Z,Q){let{include:J,...X}=Z;return this._client.post(C`/conversations/${Y}/items`,{query:{include:J},body:X,...Q})}retrieve(Y,Z,Q){let{conversation_id:J,...X}=Z;return this._client.get(C`/conversations/${J}/items/${Y}`,{query:X,...Q})}list(Y,Z={},Q){return this._client.getAPIList(C`/conversations/${Y}/items`,V6,{query:Z,...Q})}delete(Y,Z,Q){let{conversation_id:J}=Z;return this._client.delete(C`/conversations/${J}/items/${Y}`,Q)}}});var W8;var cJ=F(()=>{pJ();pJ();Z0();W8=class W8 extends A{constructor(){super(...arguments);this.items=new b4(this._client)}create(Y={},Z){return this._client.post("/conversations",{body:Y,...Z})}retrieve(Y,Z){return this._client.get(C`/conversations/${Y}`,Z)}update(Y,Z,Q){return this._client.post(C`/conversations/${Y}`,{body:Z,...Q})}delete(Y,Z){return this._client.delete(C`/conversations/${Y}`,Z)}};W8.Items=b4});var e8;var lJ=F(()=>{x4();e8=class e8 extends A{create(Y,Z){let Q=!!Y.encoding_format,J=Q?Y.encoding_format:"base64";if(Q)F0(this._client).debug("embeddings/user defined encoding_format:",Y.encoding_format);let X=this._client.post("/embeddings",{body:{...Y,encoding_format:J},...Z});if(Q)return X;return F0(this._client).debug("embeddings/decoding base64 embeddings from base64"),X._thenUnwrap((z)=>{if(z&&z.data)z.data.forEach((G)=>{let H=G.embedding;G.embedding=lV(H)});return z})}}});var h4;var iJ=F(()=>{G0();Z0();h4=class h4 extends A{retrieve(Y,Z,Q){let{eval_id:J,run_id:X}=Z;return this._client.get(C`/evals/${J}/runs/${X}/output_items/${Y}`,Q)}list(Y,Z,Q){let{eval_id:J,...X}=Z;return this._client.getAPIList(C`/evals/${J}/runs/${Y}/output_items`,e,{query:X,...Q})}}});var Y1;var nJ=F(()=>{iJ();iJ();G0();Z0();Y1=class Y1 extends A{constructor(){super(...arguments);this.outputItems=new h4(this._client)}create(Y,Z,Q){return this._client.post(C`/evals/${Y}/runs`,{body:Z,...Q})}retrieve(Y,Z,Q){let{eval_id:J}=Z;return this._client.get(C`/evals/${J}/runs/${Y}`,Q)}list(Y,Z={},Q){return this._client.getAPIList(C`/evals/${Y}/runs`,e,{query:Z,...Q})}delete(Y,Z,Q){let{eval_id:J}=Z;return this._client.delete(C`/evals/${J}/runs/${Y}`,Q)}cancel(Y,Z,Q){let{eval_id:J}=Z;return this._client.post(C`/evals/${J}/runs/${Y}`,Q)}};Y1.OutputItems=h4});var K8;var aJ=F(()=>{nJ();nJ();G0();Z0();K8=class K8 extends A{constructor(){super(...arguments);this.runs=new Y1(this._client)}create(Y,Z){return this._client.post("/evals",{body:Y,...Z})}retrieve(Y,Z){return this._client.get(C`/evals/${Y}`,Z)}update(Y,Z,Q){return this._client.post(C`/evals/${Y}`,{body:Z,...Q})}list(Y={},Z){return this._client.getAPIList("/evals",e,{query:Y,...Z})}delete(Y,Z){return this._client.delete(C`/evals/${Y}`,Z)}};K8.Runs=Y1});var Z1;var oJ=F(()=>{G0();U0();zY();TY();Z0();Z1=class Z1 extends A{create(Y,Z){return this._client.post("/files",i0({body:Y,...Z},this._client))}retrieve(Y,Z){return this._client.get(C`/files/${Y}`,Z)}list(Y={},Z){return this._client.getAPIList("/files",e,{query:Y,...Z})}delete(Y,Z){return this._client.delete(C`/files/${Y}`,Z)}content(Y,Z){return this._client.get(C`/files/${Y}/content`,{...Z,headers:P([{Accept:"application/binary"},Z?.headers]),__binaryResponse:!0})}async waitForProcessing(Y,{pollInterval:Z=5000,maxWait:Q=1800000}={}){let J=new Set(["processed","error","deleted"]),X=Date.now(),z=await this.retrieve(Y);while(!z.status||!J.has(z.status))if(await DY(Z),z=await this.retrieve(Y),Date.now()-X>Q)throw new s6({message:`Giving up on waiting for file ${Y} to finish processing after ${Q} milliseconds.`});return z}}});var g4;var sJ=F(()=>{g4=class g4 extends A{}});var m4;var rJ=F(()=>{m4=class m4 extends A{run(Y,Z){return this._client.post("/fine_tuning/alpha/graders/run",{body:Y,...Z})}validate(Y,Z){return this._client.post("/fine_tuning/alpha/graders/validate",{body:Y,...Z})}}});var Q1;var tJ=F(()=>{rJ();rJ();Q1=class Q1 extends A{constructor(){super(...arguments);this.graders=new m4(this._client)}};Q1.Graders=m4});var u4;var eJ=F(()=>{G0();Z0();u4=class u4 extends A{create(Y,Z,Q){return this._client.getAPIList(C`/fine_tuning/checkpoints/${Y}/permissions`,cY,{body:Z,method:"post",...Q})}retrieve(Y,Z={},Q){return this._client.get(C`/fine_tuning/checkpoints/${Y}/permissions`,{query:Z,...Q})}delete(Y,Z,Q){let{fine_tuned_model_checkpoint:J}=Z;return this._client.delete(C`/fine_tuning/checkpoints/${J}/permissions/${Y}`,Q)}}});var J1;var Y9=F(()=>{eJ();eJ();J1=class J1 extends A{constructor(){super(...arguments);this.permissions=new u4(this._client)}};J1.Permissions=u4});var d4;var Z9=F(()=>{G0();Z0();d4=class d4 extends A{list(Y,Z={},Q){return this._client.getAPIList(C`/fine_tuning/jobs/${Y}/checkpoints`,e,{query:Z,...Q})}}});var X1;var Q9=F(()=>{Z9();Z9();G0();Z0();X1=class X1 extends A{constructor(){super(...arguments);this.checkpoints=new d4(this._client)}create(Y,Z){return this._client.post("/fine_tuning/jobs",{body:Y,...Z})}retrieve(Y,Z){return this._client.get(C`/fine_tuning/jobs/${Y}`,Z)}list(Y={},Z){return this._client.getAPIList("/fine_tuning/jobs",e,{query:Y,...Z})}cancel(Y,Z){return this._client.post(C`/fine_tuning/jobs/${Y}/cancel`,Z)}listEvents(Y,Z={},Q){return this._client.getAPIList(C`/fine_tuning/jobs/${Y}/events`,e,{query:Z,...Q})}pause(Y,Z){return this._client.post(C`/fine_tuning/jobs/${Y}/pause`,Z)}resume(Y,Z){return this._client.post(C`/fine_tuning/jobs/${Y}/resume`,Z)}};X1.Checkpoints=d4});var wY;var J9=F(()=>{sJ();sJ();tJ();tJ();Y9();Y9();Q9();Q9();wY=class wY extends A{constructor(){super(...arguments);this.methods=new g4(this._client),this.jobs=new X1(this._client),this.checkpoints=new J1(this._client),this.alpha=new Q1(this._client)}};wY.Methods=g4;wY.Jobs=X1;wY.Checkpoints=J1;wY.Alpha=Q1});var p4;var X9=F(()=>{p4=class p4 extends A{}});var $8;var z9=F(()=>{X9();X9();$8=class $8 extends A{constructor(){super(...arguments);this.graderModels=new p4(this._client)}};$8.GraderModels=p4});var z1;var G9=F(()=>{TY();z1=class z1 extends A{createVariation(Y,Z){return this._client.post("/images/variations",i0({body:Y,...Z},this._client))}edit(Y,Z){return this._client.post("/images/edits",i0({body:Y,...Z,stream:Y.stream??!1},this._client))}generate(Y,Z){return this._client.post("/images/generations",{body:Y,...Z,stream:Y.stream??!1})}}});var G1;var H9=F(()=>{G0();Z0();G1=class G1 extends A{retrieve(Y,Z){return this._client.get(C`/models/${Y}`,Z)}list(Y){return this._client.getAPIList("/models",cY,Y)}delete(Y,Z){return this._client.delete(C`/models/${Y}`,Z)}}});var H1;var W9=F(()=>{H1=class H1 extends A{create(Y,Z){return this._client.post("/moderations",{body:Y,...Z})}}});var c4;var K9=F(()=>{U0();Z0();c4=class c4 extends A{accept(Y,Z,Q){return this._client.post(C`/realtime/calls/${Y}/accept`,{body:Z,...Q,headers:P([{Accept:"*/*"},Q?.headers])})}hangup(Y,Z){return this._client.post(C`/realtime/calls/${Y}/hangup`,{...Z,headers:P([{Accept:"*/*"},Z?.headers])})}refer(Y,Z,Q){return this._client.post(C`/realtime/calls/${Y}/refer`,{body:Z,...Q,headers:P([{Accept:"*/*"},Q?.headers])})}reject(Y,Z={},Q){return this._client.post(C`/realtime/calls/${Y}/reject`,{body:Z,...Q,headers:P([{Accept:"*/*"},Q?.headers])})}}});var l4;var $9=F(()=>{l4=class l4 extends A{create(Y,Z){return this._client.post("/realtime/client_secrets",{body:Y,...Z})}}});var D6;var U9=F(()=>{K9();K9();$9();$9();D6=class D6 extends A{constructor(){super(...arguments);this.clientSecrets=new l4(this._client),this.calls=new c4(this._client)}};D6.ClientSecrets=l4;D6.Calls=c4});function Yq(Y,Z){if(!Z||!QO(Z))return{...Y,output_parsed:null,output:Y.output.map((Q)=>{if(Q.type==="function_call")return{...Q,parsed_arguments:null};if(Q.type==="message")return{...Q,content:Q.content.map((J)=>({...J,parsed:null}))};else return Q})};return V9(Y,Z)}function V9(Y,Z){let Q=Y.output.map((X)=>{if(X.type==="function_call")return{...X,parsed_arguments:zO(Z,X)};if(X.type==="message"){let z=X.content.map((G)=>{if(G.type==="output_text")return{...G,parsed:ZO(Z,G.text)};return G});return{...X,content:z}}return X}),J=Object.assign({},Y,{output:Q});if(!Object.getOwnPropertyDescriptor(Y,"output_text"))O2(J);return Object.defineProperty(J,"output_parsed",{enumerable:!0,get(){for(let X of J.output){if(X.type!=="message")continue;for(let z of X.content)if(z.type==="output_text"&&z.parsed!==null)return z.parsed}return null}}),J}function ZO(Y,Z){if(Y.text?.format?.type!=="json_schema")return null;if("$parseRaw"in Y.text?.format)return(Y.text?.format).$parseRaw(Z);return JSON.parse(Z)}function QO(Y){if(V4(Y.text?.format))return!0;return!1}function JO(Y){return Y?.$brand==="auto-parseable-tool"}function XO(Y,Z){return Y.find((Q)=>Q.type==="function"&&Q.name===Z)}function zO(Y,Z){let Q=XO(Y.tools??[],Z.name);return{...Z,...Z,parsed_arguments:JO(Q)?Q.$parseRaw(Z.arguments):Q?.strict?JSON.parse(Z.arguments):null}}function O2(Y){let Z=[];for(let Q of Y.output){if(Q.type!=="message")continue;for(let J of Q.content)if(J.type==="output_text")Z.push(J.text)}Y.output_text=Z.join("")}var q9=F(()=>{zY();B4()});function GO(Y,Z){return Yq(Y,Z)}var W1,I2,L6,E2,Zq,Qq,Jq,Xq,C2;var zq=F(()=>{e0();zY();B2();q9();C2=class C2 extends e6{constructor(Y){super();W1.add(this),I2.set(this,void 0),L6.set(this,void 0),E2.set(this,void 0),u(this,I2,Y,"f")}static createResponse(Y,Z,Q){let J=new C2(Z);return J._run(()=>J._createOrRetrieveResponse(Y,Z,{...Q,headers:{...Q?.headers,"X-Stainless-Helper-Method":"stream"}})),J}async _createOrRetrieveResponse(Y,Z,Q){let J=Q?.signal;if(J){if(J.aborted)this.controller.abort();J.addEventListener("abort",()=>this.controller.abort())}N(this,W1,"m",Zq).call(this);let X,z=null;if("response_id"in Z)X=await Y.responses.retrieve(Z.response_id,{stream:!0},{...Q,signal:this.controller.signal,stream:!0}),z=Z.starting_after??null;else X=await Y.responses.create({...Z,stream:!0},{...Q,signal:this.controller.signal});this._connected();for await(let G of X)N(this,W1,"m",Qq).call(this,G,z);if(X.controller.signal?.aborted)throw new T0;return N(this,W1,"m",Jq).call(this)}[(I2=new WeakMap,L6=new WeakMap,E2=new WeakMap,W1=new WeakSet,Zq=function Y(){if(this.ended)return;u(this,L6,void 0,"f")},Qq=function Y(Z,Q){if(this.ended)return;let J=(z,G)=>{if(Q==null||G.sequence_number>Q)this._emit(z,G)},X=N(this,W1,"m",Xq).call(this,Z);switch(J("event",Z),Z.type){case"response.output_text.delta":{let z=X.output[Z.output_index];if(!z)throw new y(`missing output at index ${Z.output_index}`);if(z.type==="message"){let G=z.content[Z.content_index];if(!G)throw new y(`missing content at index ${Z.content_index}`);if(G.type!=="output_text")throw new y(`expected content to be 'output_text', got ${G.type}`);J("response.output_text.delta",{...Z,snapshot:G.text})}break}case"response.function_call_arguments.delta":{let z=X.output[Z.output_index];if(!z)throw new y(`missing output at index ${Z.output_index}`);if(z.type==="function_call")J("response.function_call_arguments.delta",{...Z,snapshot:z.arguments});break}default:J(Z.type,Z);break}},Jq=function Y(){if(this.ended)throw new y("stream has ended, this shouldn't happen");let Z=N(this,L6,"f");if(!Z)throw new y("request ended without sending any events");u(this,L6,void 0,"f");let Q=GO(Z,N(this,I2,"f"));return u(this,E2,Q,"f"),Q},Xq=function Y(Z){let Q=N(this,L6,"f");if(!Q){if(Z.type!=="response.created")throw new y(`When snapshot hasn't been set yet, expected 'response.created' event, got ${Z.type}`);return Q=u(this,L6,Z.response,"f"),Q}switch(Z.type){case"response.output_item.added":{Q.output.push(Z.item);break}case"response.content_part.added":{let J=Q.output[Z.output_index];if(!J)throw new y(`missing output at index ${Z.output_index}`);let X=J.type,z=Z.part;if(X==="message"&&z.type!=="reasoning_text")J.content.push(z);else if(X==="reasoning"&&z.type==="reasoning_text"){if(!J.content)J.content=[];J.content.push(z)}break}case"response.output_text.delta":{let J=Q.output[Z.output_index];if(!J)throw new y(`missing output at index ${Z.output_index}`);if(J.type==="message"){let X=J.content[Z.content_index];if(!X)throw new y(`missing content at index ${Z.content_index}`);if(X.type!=="output_text")throw new y(`expected content to be 'output_text', got ${X.type}`);X.text+=Z.delta}break}case"response.function_call_arguments.delta":{let J=Q.output[Z.output_index];if(!J)throw new y(`missing output at index ${Z.output_index}`);if(J.type==="function_call")J.arguments+=Z.delta;break}case"response.reasoning_text.delta":{let J=Q.output[Z.output_index];if(!J)throw new y(`missing output at index ${Z.output_index}`);if(J.type==="reasoning"){let X=J.content?.[Z.content_index];if(!X)throw new y(`missing content at index ${Z.content_index}`);if(X.type!=="reasoning_text")throw new y(`expected content to be 'reasoning_text', got ${X.type}`);X.text+=Z.delta}break}case"response.completed":{u(this,L6,Z.response,"f");break}}return Q},Symbol.asyncIterator)](){let Y=[],Z=[],Q=!1;return this.on("event",(J)=>{let X=Z.shift();if(X)X.resolve(J);else Y.push(J)}),this.on("end",()=>{Q=!0;for(let J of Z)J.resolve(void 0);Z.length=0}),this.on("abort",(J)=>{Q=!0;for(let X of Z)X.reject(J);Z.length=0}),this.on("error",(J)=>{Q=!0;for(let X of Z)X.reject(J);Z.length=0}),{next:async()=>{if(!Y.length){if(Q)return{value:void 0,done:!0};return new Promise((X,z)=>Z.push({resolve:X,reject:z})).then((X)=>X?{value:X,done:!1}:{value:void 0,done:!0})}return{value:Y.shift(),done:!1}},return:async()=>{return this.abort(),{value:void 0,done:!0}}}}async finalResponse(){await this.done();let Y=N(this,E2,"f");if(!Y)throw new y("stream ended without producing a ChatCompletion");return Y}}});var i4;var B9=F(()=>{G0();Z0();i4=class i4 extends A{list(Y,Z={},Q){return this._client.getAPIList(C`/responses/${Y}/input_items`,e,{query:Z,...Q})}}});var n4;var F9=F(()=>{n4=class n4 extends A{count(Y={},Z){return this._client.post("/responses/input_tokens",{body:Y,...Z})}}});var T6;var R9=F(()=>{q9();zq();B9();B9();F9();F9();U0();Z0();T6=class T6 extends A{constructor(){super(...arguments);this.inputItems=new i4(this._client),this.inputTokens=new n4(this._client)}create(Y,Z){return this._client.post("/responses",{body:Y,...Z,stream:Y.stream??!1})._thenUnwrap((Q)=>{if("object"in Q&&Q.object==="response")O2(Q);return Q})}retrieve(Y,Z={},Q){return this._client.get(C`/responses/${Y}`,{query:Z,...Q,stream:Z?.stream??!1})._thenUnwrap((J)=>{if("object"in J&&J.object==="response")O2(J);return J})}delete(Y,Z){return this._client.delete(C`/responses/${Y}`,{...Z,headers:P([{Accept:"*/*"},Z?.headers])})}parse(Y,Z){return this._client.responses.create(Y,Z)._thenUnwrap((Q)=>V9(Q,Y))}stream(Y,Z){return C2.createResponse(this._client,Y,Z)}cancel(Y,Z){return this._client.post(C`/responses/${Y}/cancel`,Z)}compact(Y,Z){return this._client.post("/responses/compact",{body:Y,...Z})}};T6.InputItems=i4;T6.InputTokens=n4});var a4;var M9=F(()=>{TY();Z0();a4=class a4 extends A{create(Y,Z,Q){return this._client.post(C`/uploads/${Y}/parts`,i0({body:Z,...Q},this._client))}}});var U8;var D9=F(()=>{M9();M9();Z0();U8=class U8 extends A{constructor(){super(...arguments);this.parts=new a4(this._client)}create(Y,Z){return this._client.post("/uploads",{body:Y,...Z})}cancel(Y,Z){return this._client.post(C`/uploads/${Y}/cancel`,Z)}complete(Y,Z,Q){return this._client.post(C`/uploads/${Y}/complete`,{body:Z,...Q})}};U8.Parts=a4});var Gq=async(Y)=>{let Z=await Promise.allSettled(Y),Q=Z.filter((X)=>X.status==="rejected");if(Q.length){for(let X of Q)console.error(X.reason);throw Error(`${Q.length} promise(s) failed - see the above errors`)}let J=[];for(let X of Z)if(X.status==="fulfilled")J.push(X.value);return J};var o4;var L9=F(()=>{G0();U0();Z0();o4=class o4 extends A{create(Y,Z,Q){return this._client.post(C`/vector_stores/${Y}/file_batches`,{body:Z,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}retrieve(Y,Z,Q){let{vector_store_id:J}=Z;return this._client.get(C`/vector_stores/${J}/file_batches/${Y}`,{...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}cancel(Y,Z,Q){let{vector_store_id:J}=Z;return this._client.post(C`/vector_stores/${J}/file_batches/${Y}/cancel`,{...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}async createAndPoll(Y,Z,Q){let J=await this.create(Y,Z);return await this.poll(Y,J.id,Q)}listFiles(Y,Z,Q){let{vector_store_id:J,...X}=Z;return this._client.getAPIList(C`/vector_stores/${J}/file_batches/${Y}/files`,e,{query:X,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}async poll(Y,Z,Q){let J=P([Q?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Q?.pollIntervalMs?.toString()??void 0}]);while(!0){let{data:X,response:z}=await this.retrieve(Z,{vector_store_id:Y},{...Q,headers:J}).withResponse();switch(X.status){case"in_progress":let G=5000;if(Q?.pollIntervalMs)G=Q.pollIntervalMs;else{let H=z.headers.get("openai-poll-after-ms");if(H){let W=parseInt(H);if(!isNaN(W))G=W}}await DY(G);break;case"failed":case"cancelled":case"completed":return X}}}async uploadAndPoll(Y,{files:Z,fileIds:Q=[]},J){if(Z==null||Z.length==0)throw Error("No `files` provided to process. If you've already uploaded files you should use `.createAndPoll()` instead");let X=J?.maxConcurrency??5,z=Math.min(X,Z.length),G=this._client,H=Z.values(),W=[...Q];async function K(V){for(let q of V){let M=await G.files.create({file:q,purpose:"assistants"},J);W.push(M.id)}}let $=Array(z).fill(H).map(K);return await Gq($),await this.createAndPoll(Y,{file_ids:W})}}});var s4;var T9=F(()=>{G0();U0();x4();Z0();s4=class s4 extends A{create(Y,Z,Q){return this._client.post(C`/vector_stores/${Y}/files`,{body:Z,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}retrieve(Y,Z,Q){let{vector_store_id:J}=Z;return this._client.get(C`/vector_stores/${J}/files/${Y}`,{...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}update(Y,Z,Q){let{vector_store_id:J,...X}=Z;return this._client.post(C`/vector_stores/${J}/files/${Y}`,{body:X,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y,Z={},Q){return this._client.getAPIList(C`/vector_stores/${Y}/files`,e,{query:Z,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}delete(Y,Z,Q){let{vector_store_id:J}=Z;return this._client.delete(C`/vector_stores/${J}/files/${Y}`,{...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}async createAndPoll(Y,Z,Q){let J=await this.create(Y,Z,Q);return await this.poll(Y,J.id,Q)}async poll(Y,Z,Q){let J=P([Q?.headers,{"X-Stainless-Poll-Helper":"true","X-Stainless-Custom-Poll-Interval":Q?.pollIntervalMs?.toString()??void 0}]);while(!0){let X=await this.retrieve(Z,{vector_store_id:Y},{...Q,headers:J}).withResponse(),z=X.data;switch(z.status){case"in_progress":let G=5000;if(Q?.pollIntervalMs)G=Q.pollIntervalMs;else{let H=X.response.headers.get("openai-poll-after-ms");if(H){let W=parseInt(H);if(!isNaN(W))G=W}}await DY(G);break;case"failed":case"completed":return z}}}async upload(Y,Z,Q){let J=await this._client.files.create({file:Z,purpose:"assistants"},Q);return this.create(Y,{file_id:J.id},Q)}async uploadAndPoll(Y,Z,Q){let J=await this.upload(Y,Z,Q);return await this.poll(Y,J.id,Q)}content(Y,Z,Q){let{vector_store_id:J}=Z;return this._client.getAPIList(C`/vector_stores/${J}/files/${Y}/content`,cY,{...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}}});var _6;var _9=F(()=>{L9();L9();T9();T9();G0();U0();Z0();_6=class _6 extends A{constructor(){super(...arguments);this.files=new s4(this._client),this.fileBatches=new o4(this._client)}create(Y,Z){return this._client.post("/vector_stores",{body:Y,...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}retrieve(Y,Z){return this._client.get(C`/vector_stores/${Y}`,{...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}update(Y,Z,Q){return this._client.post(C`/vector_stores/${Y}`,{body:Z,...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}list(Y={},Z){return this._client.getAPIList("/vector_stores",e,{query:Y,...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}delete(Y,Z){return this._client.delete(C`/vector_stores/${Y}`,{...Z,headers:P([{"OpenAI-Beta":"assistants=v2"},Z?.headers])})}search(Y,Z,Q){return this._client.getAPIList(C`/vector_stores/${Y}/search`,cY,{body:Z,method:"post",...Q,headers:P([{"OpenAI-Beta":"assistants=v2"},Q?.headers])})}};_6.Files=s4;_6.FileBatches=o4});var K1;var N9=F(()=>{G0();U0();TY();Z0();K1=class K1 extends A{create(Y,Z){return this._client.post("/videos",eQ({body:Y,...Z},this._client))}retrieve(Y,Z){return this._client.get(C`/videos/${Y}`,Z)}list(Y={},Z){return this._client.getAPIList("/videos",V6,{query:Y,...Z})}delete(Y,Z){return this._client.delete(C`/videos/${Y}`,Z)}downloadContent(Y,Z={},Q){return this._client.get(C`/videos/${Y}/content`,{query:Z,...Q,headers:P([{Accept:"application/binary"},Q?.headers]),__binaryResponse:!0})}remix(Y,Z,Q){return this._client.post(C`/videos/${Y}/remix`,eQ({body:Z,...Q},this._client))}}});var $1,Hq,j2,U1;var w9=F(()=>{e0();zY();U0();U1=class U1 extends A{constructor(){super(...arguments);$1.add(this)}async unwrap(Y,Z,Q=this._client.webhookSecret,J=300){return await this.verifySignature(Y,Z,Q,J),JSON.parse(Y)}async verifySignature(Y,Z,Q=this._client.webhookSecret,J=300){if(typeof crypto>"u"||typeof crypto.subtle.importKey!=="function"||typeof crypto.subtle.verify!=="function")throw Error("Webhook signature verification is only supported when the `crypto` global is defined");N(this,$1,"m",Hq).call(this,Q);let X=P([Z]).values,z=N(this,$1,"m",j2).call(this,X,"webhook-signature"),G=N(this,$1,"m",j2).call(this,X,"webhook-timestamp"),H=N(this,$1,"m",j2).call(this,X,"webhook-id"),W=parseInt(G,10);if(isNaN(W))throw new uY("Invalid webhook timestamp format");let K=Math.floor(Date.now()/1000);if(K-W>J)throw new uY("Webhook timestamp is too old");if(W>K+J)throw new uY("Webhook timestamp is too new");let $=z.split(" ").map((B)=>B.startsWith("v1,")?B.substring(3):B),V=Q.startsWith("whsec_")?Buffer.from(Q.replace("whsec_",""),"base64"):Buffer.from(Q,"utf-8"),q=H?`${H}.${G}.${Y}`:`${G}.${Y}`,M=await crypto.subtle.importKey("raw",V,{name:"HMAC",hash:"SHA-256"},!1,["verify"]);for(let B of $)try{let D=Buffer.from(B,"base64");if(await crypto.subtle.verify("HMAC",M,D,new TextEncoder().encode(q)))return}catch{continue}throw new uY("The given webhook signature does not match the expected signature")}};$1=new WeakSet,Hq=function Y(Z){if(typeof Z!=="string"||Z.length===0)throw Error("The webhook secret must either be set using the env var, OPENAI_WEBHOOK_SECRET, on the client class, OpenAI({ webhookSecret: '123' }), or passed to this function")},j2=function Y(Z,Q){if(!Z)throw Error("Headers are required");let J=Z.get(Q);if(J===null||J===void 0)throw Error(`Missing required header: ${Q}`);return J}});var Wq=F(()=>{wJ();OJ();hJ();gJ();dJ();cJ();lJ();aJ();oJ();J9();z9();G9();H9();W9();U9();R9();D9();_9();N9();w9();dV();pV()});class a{constructor({baseURL:Y=R6("OPENAI_BASE_URL"),apiKey:Z=R6("OPENAI_API_KEY"),organization:Q=R6("OPENAI_ORG_ID")??null,project:J=R6("OPENAI_PROJECT_ID")??null,webhookSecret:X=R6("OPENAI_WEBHOOK_SECRET")??null,...z}={}){if(O9.add(this),k2.set(this,void 0),this.completions=new r8(this),this.chat=new Y8(this),this.embeddings=new e8(this),this.files=new Z1(this),this.images=new z1(this),this.audio=new nY(this),this.moderations=new H1(this),this.models=new G1(this),this.fineTuning=new wY(this),this.graders=new $8(this),this.vectorStores=new _6(this),this.webhooks=new U1(this),this.beta=new NY(this),this.batches=new a8(this),this.uploads=new U8(this),this.responses=new T6(this),this.realtime=new D6(this),this.conversations=new W8(this),this.evals=new K8(this),this.containers=new H8(this),this.videos=new K1(this),Z===void 0)throw new y("Missing credentials. Please pass an `apiKey`, or set the `OPENAI_API_KEY` environment variable.");let G={apiKey:Z,organization:Q,project:J,webhookSecret:X,...z,baseURL:Y||"https://api.openai.com/v1"};if(!G.dangerouslyAllowBrowser&&eU())throw new y(`It looks like you're running in a browser-like environment.
|
|
455
462
|
|
|
456
463
|
This is disabled by default, as it risks exposing your secret API credentials to attackers.
|
|
457
464
|
If you understand the risks and have appropriate mitigations in place,
|
|
@@ -460,7 +467,7 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
|
|
|
460
467
|
new OpenAI({ apiKey, dangerouslyAllowBrowser: true });
|
|
461
468
|
|
|
462
469
|
https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
463
|
-
`);this.baseURL=G.baseURL,this.timeout=G.timeout??S5.DEFAULT_TIMEOUT,this.logger=G.logger??console;let K="warn";this.logLevel=K,this.logLevel=W5(G.logLevel,"ClientOptions.logLevel",this)??W5(EY("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??K,this.fetchOptions=G.fetchOptions,this.maxRetries=G.maxRetries??2,this.fetch=G.fetch??wG(),g(this,nZ,OG,"f"),this._options=G,this.apiKey=typeof Z==="string"?Z:"Missing Key",this.organization=Q,this.project=X,this.webhookSecret=J}withOptions(Y){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...Y})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:Y,nulls:Z}){return}async authHeaders(Y){return A([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(Y){return H5(Y,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${_Y}`}defaultIdempotencyKey(){return`stainless-node-retry-${r2()}`}makeStatusError(Y,Z,Q,X){return $0.generate(Y,Z,Q,X)}async _callApiKey(){let Y=this._options.apiKey;if(typeof Y!=="function")return!1;let Z;try{Z=await Y()}catch(Q){if(Q instanceof S)throw Q;throw new S(`Failed to get token from 'apiKey' function: ${Q.message}`,{cause:Q})}if(typeof Z!=="string"||!Z)throw new S(`Expected 'apiKey' function argument to return a string but it returned ${Z}`);return this.apiKey=Z,!0}buildURL(Y,Z,Q){let X=!L(this,x5,"m",DK).call(this)&&Q||this.baseURL,J=qG(Y)?new URL(Y):new URL(X+(X.endsWith("/")&&Y.startsWith("/")?Y.slice(1):Y)),$=this.defaultQuery();if(!VG($))Z={...$,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))J.search=this.stringifyQuery(Z);return J.toString()}async prepareOptions(Y){await this._callApiKey()}async prepareRequest(Y,{url:Z,options:Q}){}get(Y,Z){return this.methodRequest("get",Y,Z)}post(Y,Z){return this.methodRequest("post",Y,Z)}patch(Y,Z){return this.methodRequest("patch",Y,Z)}put(Y,Z){return this.methodRequest("put",Y,Z)}delete(Y,Z){return this.methodRequest("delete",Y,Z)}methodRequest(Y,Z,Q){return this.request(Promise.resolve(Q).then((X)=>{return{method:Y,path:Z,...X}}))}request(Y,Z=null){return new Y6(this,this.makeRequest(Y,Z,void 0))}async makeRequest(Y,Z,Q){let X=await Y,J=X.maxRetries??this.maxRetries;if(Z==null)Z=J;await this.prepareOptions(X);let{req:$,url:G,timeout:K}=await this.buildRequest(X,{retryCount:J-Z});await this.prepareRequest($,{url:G,options:X});let H="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),W=Q===void 0?"":`, retryOf: ${Q}`,z=Date.now();if(Q0(this).debug(`[${H}] sending request`,HY({retryOfRequestLogID:Q,method:X.method,url:G,options:X,headers:$.headers})),X.signal?.aborted)throw new K0;let q=new AbortController,V=await this.fetchWithTimeout(G,$,K,q).catch(d1),R=Date.now();if(V instanceof globalThis.Error){let T=`retrying, ${Z} attempts remaining`;if(X.signal?.aborted)throw new K0;let D=u1(V)||/timed? ?out/i.test(String(V)+("cause"in V?String(V.cause):""));if(Z)return Q0(this).info(`[${H}] connection ${D?"timed out":"failed"} - ${T}`),Q0(this).debug(`[${H}] connection ${D?"timed out":"failed"} (${T})`,HY({retryOfRequestLogID:Q,url:G,durationMs:R-z,message:V.message})),this.retryRequest(X,Z,Q??H);if(Q0(this).info(`[${H}] connection ${D?"timed out":"failed"} - error; no more retries left`),Q0(this).debug(`[${H}] connection ${D?"timed out":"failed"} (error; no more retries left)`,HY({retryOfRequestLogID:Q,url:G,durationMs:R-z,message:V.message})),D)throw new eY;throw new rY({cause:V})}let B=[...V.headers.entries()].filter(([T])=>T==="x-request-id").map(([T,D])=>", "+T+": "+JSON.stringify(D)).join(""),M=`[${H}${W}${B}] ${$.method} ${G} ${V.ok?"succeeded":"failed"} with status ${V.status} in ${R-z}ms`;if(!V.ok){let T=await this.shouldRetry(V);if(Z&&T){let x=`retrying, ${Z} attempts remaining`;return await NG(V.body),Q0(this).info(`${M} - ${x}`),Q0(this).debug(`[${H}] response error (${x})`,HY({retryOfRequestLogID:Q,url:V.url,status:V.status,headers:V.headers,durationMs:R-z})),this.retryRequest(X,Z,Q??H,V.headers)}let D=T?"error; no more retries left":"error; not retryable";Q0(this).info(`${M} - ${D}`);let _=await V.text().catch((x)=>d1(x).message),w=RG(_),N=w?void 0:_;throw Q0(this).debug(`[${H}] response error (${D})`,HY({retryOfRequestLogID:Q,url:V.url,status:V.status,headers:V.headers,message:N,durationMs:Date.now()-z})),this.makeStatusError(V.status,w,N,V.headers)}return Q0(this).info(M),Q0(this).debug(`[${H}] response start`,HY({retryOfRequestLogID:Q,url:V.url,status:V.status,headers:V.headers,durationMs:R-z})),{response:V,options:X,controller:q,requestLogID:H,retryOfRequestLogID:Q,startTime:z}}getAPIList(Y,Z,Q){return this.requestAPIList(Z,{method:"get",path:Y,...Q})}requestAPIList(Y,Z){let Q=this.makeRequest(Z,null,void 0);return new EZ(this,Q,Y)}async fetchWithTimeout(Y,Z,Q,X){let{signal:J,method:$,...G}=Z||{};if(J)J.addEventListener("abort",()=>X.abort());let K=setTimeout(()=>X.abort(),Q),H=globalThis.ReadableStream&&G.body instanceof globalThis.ReadableStream||typeof G.body==="object"&&G.body!==null&&Symbol.asyncIterator in G.body,W={signal:X.signal,...H?{duplex:"half"}:{},method:"GET",...G};if($)W.method=$.toUpperCase();try{return await this.fetch.call(void 0,Y,W)}finally{clearTimeout(K)}}async shouldRetry(Y){let Z=Y.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(Y.status===408)return!0;if(Y.status===409)return!0;if(Y.status===429)return!0;if(Y.status>=500)return!0;return!1}async retryRequest(Y,Z,Q,X){let J,$=X?.get("retry-after-ms");if($){let K=parseFloat($);if(!Number.isNaN(K))J=K}let G=X?.get("retry-after");if(G&&!J){let K=parseFloat(G);if(!Number.isNaN(K))J=K*1000;else J=Date.parse(G)-Date.now()}if(!(J&&0<=J&&J<60000)){let K=Y.maxRetries??this.maxRetries;J=this.calculateDefaultRetryTimeoutMillis(Z,K)}return await n0(J),this.makeRequest(Y,Z-1,Q)}calculateDefaultRetryTimeoutMillis(Y,Z){let J=Z-Y,$=Math.min(0.5*Math.pow(2,J),8),G=1-Math.random()*0.25;return $*G*1000}async buildRequest(Y,{retryCount:Z=0}={}){let Q={...Y},{method:X,path:J,query:$,defaultBaseURL:G}=Q,K=this.buildURL(J,$,G);if("timeout"in Q)FG("timeout",Q.timeout);Q.timeout=Q.timeout??this.timeout;let{bodyHeaders:H,body:W}=this.buildBody({options:Q}),z=await this.buildHeaders({options:Y,method:X,bodyHeaders:H,retryCount:Z});return{req:{method:X,headers:z,...Q.signal&&{signal:Q.signal},...globalThis.ReadableStream&&W instanceof globalThis.ReadableStream&&{duplex:"half"},...W&&{body:W},...this.fetchOptions??{},...Q.fetchOptions??{}},url:K,timeout:Q.timeout}}async buildHeaders({options:Y,method:Z,bodyHeaders:Q,retryCount:X}){let J={};if(this.idempotencyHeader&&Z!=="get"){if(!Y.idempotencyKey)Y.idempotencyKey=this.defaultIdempotencyKey();J[this.idempotencyHeader]=Y.idempotencyKey}let $=A([J,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(X),...Y.timeout?{"X-Stainless-Timeout":String(Math.trunc(Y.timeout/1000))}:{},..._G(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(Y),this._options.defaultHeaders,Q,Y.headers]);return this.validateHeaders($),$.values}buildBody({options:{body:Y,headers:Z}}){if(!Y)return{bodyHeaders:void 0,body:void 0};let Q=A([Z]);if(ArrayBuffer.isView(Y)||Y instanceof ArrayBuffer||Y instanceof DataView||typeof Y==="string"&&Q.values.has("content-type")||globalThis.Blob&&Y instanceof globalThis.Blob||Y instanceof FormData||Y instanceof URLSearchParams||globalThis.ReadableStream&&Y instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:Y};else if(typeof Y==="object"&&((Symbol.asyncIterator in Y)||(Symbol.iterator in Y)&&("next"in Y)&&typeof Y.next==="function"))return{bodyHeaders:void 0,body:MZ(Y)};else return L(this,nZ,"f").call(this,{body:Y,headers:Q})}}S5=c,nZ=new WeakMap,x5=new WeakSet,DK=function Y(){return this.baseURL!=="https://api.openai.com/v1"};c.OpenAI=S5;c.DEFAULT_TIMEOUT=600000;c.OpenAIError=S;c.APIError=$0;c.APIConnectionError=rY;c.APIConnectionTimeoutError=eY;c.APIUserAbortError=K0;c.NotFoundError=i1;c.ConflictError=n1;c.RateLimitError=o1;c.BadRequestError=p1;c.AuthenticationError=c1;c.InternalServerError=s1;c.PermissionDeniedError=l1;c.UnprocessableEntityError=a1;c.InvalidWebhookSignatureError=KY;c.toFile=kZ;c.Completions=e6;c.Chat=X6;c.Embeddings=Z1;c.Files=X1;c.Images=K1;c.Audio=qY;c.Moderations=z1;c.Models=H1;c.FineTuning=t0;c.Graders=V6;c.VectorStores=jY;c.Webhooks=V1;c.Beta=s0;c.Batches=s6;c.Uploads=B6;c.Responses=IY;c.Realtime=kY;c.Conversations=U6;c.Evals=q6;c.Containers=W6;c.Videos=U1;Y0();class aZ{client;defaultModel;constructor(Y,Z,Q="gpt-5-nano",X){this.client=new c({apiKey:Y,baseURL:Z,defaultHeaders:X}),this.defaultModel=Q}async generate(Y){return(await this.client.chat.completions.create({messages:[{role:"user",content:Y.prompt}],model:Y.model||this.defaultModel,temperature:Y.temperature,max_tokens:Y.maxTokens,reasoning_effort:Y.reasoning})).choices[0].message.content||""}async*streamGenerate(Y){try{let Z=await this.client.chat.completions.create({messages:[{role:"user",content:Y.prompt}],model:Y.model||this.defaultModel,temperature:Y.temperature,max_tokens:Y.maxTokens,stream:!0,reasoning_effort:Y.reasoning});for await(let Q of Z){let X=Q.choices[0]?.delta,J=X?.content,$=X?.reasoning_content||X?.reasoning||X?.reasoning_details?.[0]?.summary;if(J||$)yield{chunk:J??void 0,thinkingChunk:$??void 0,metadata:{model:Q.model,finishReason:Q.choices[0]?.finish_reason??void 0}}}}catch(Z){yield{error:G$(Z)?Z:new X0(String(Z),"OPENAI_STREAM_ERROR")}}}}async function oZ(){let Y=await J0(),Z=Y.get("llm.provider")||"openai",Q=await Y.getSecure("llm.apiKey"),X=Y.get("llm.model");if(!Q)throw new X0("No API key found. Please set llm.apiKey in ~/.gdxrc.toml or GDX_LLM_API_KEY env var.","NO_API_KEY");if(Q.startsWith("sk-or-"))Z="openrouter";switch(Z.toLowerCase()){case"openrouter":return new aZ(Q,E$,X,{"HTTP-Referer":"https://github.com/Type-Delta/gdx/tree/main","X-Title":"GDX"});case"openai":return new aZ(Q,void 0,X);default:throw new X0(`Unsupported LLM provider: ${Z}`,"UNSUPPORTED_LLM_PROVIDER")}}function LK(Y){return tY`<instructions>You are an expert Git commit message generator. Analyze the provided git diff in the following messages and generate a concise and informative commit message following the specified format and rules. Focus on clarity and relevance to help maintain a well-documented project history. Output ONLY the commit message.</instructions>
|
|
470
|
+
`);this.baseURL=G.baseURL,this.timeout=G.timeout??I9.DEFAULT_TIMEOUT,this.logger=G.logger??console;let H="warn";this.logLevel=H,this.logLevel=iQ(G.logLevel,"ClientOptions.logLevel",this)??iQ(R6("OPENAI_LOG"),"process.env['OPENAI_LOG']",this)??H,this.fetchOptions=G.fetchOptions,this.maxRetries=G.maxRetries??2,this.fetch=G.fetch??ZV(),u(this,k2,JV,"f"),this._options=G,this.apiKey=typeof Z==="string"?Z:"Missing Key",this.organization=Q,this.project=J,this.webhookSecret=X}withOptions(Y){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,organization:this.organization,project:this.project,webhookSecret:this.webhookSecret,...Y})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:Y,nulls:Z}){return}async authHeaders(Y){return P([{Authorization:`Bearer ${this.apiKey}`}])}stringifyQuery(Y){return cQ(Y,{arrayFormat:"brackets"})}getUserAgent(){return`${this.constructor.name}/JS ${U6}`}defaultIdempotencyKey(){return`stainless-node-retry-${SQ()}`}makeStatusError(Y,Z,Q,J){return M0.generate(Y,Z,Q,J)}async _callApiKey(){let Y=this._options.apiKey;if(typeof Y!=="function")return!1;let Z;try{Z=await Y()}catch(Q){if(Q instanceof y)throw Q;throw new y(`Failed to get token from 'apiKey' function: ${Q.message}`,{cause:Q})}if(typeof Z!=="string"||!Z)throw new y(`Expected 'apiKey' function argument to return a string but it returned ${Z}`);return this.apiKey=Z,!0}buildURL(Y,Z,Q){let J=!N(this,O9,"m",Kq).call(this)&&Q||this.baseURL,X=lU(Y)?new URL(Y):new URL(J+(J.endsWith("/")&&Y.startsWith("/")?Y.slice(1):Y)),z=this.defaultQuery();if(!iU(z))Z={...z,...Z};if(typeof Z==="object"&&Z&&!Array.isArray(Z))X.search=this.stringifyQuery(Z);return X.toString()}async prepareOptions(Y){await this._callApiKey()}async prepareRequest(Y,{url:Z,options:Q}){}get(Y,Z){return this.methodRequest("get",Y,Z)}post(Y,Z){return this.methodRequest("post",Y,Z)}patch(Y,Z){return this.methodRequest("patch",Y,Z)}put(Y,Z){return this.methodRequest("put",Y,Z)}delete(Y,Z){return this.methodRequest("delete",Y,Z)}methodRequest(Y,Z,Q){return this.request(Promise.resolve(Q).then((J)=>{return{method:Y,path:Z,...J}}))}request(Y,Z=null){return new r6(this,this.makeRequest(Y,Z,void 0))}async makeRequest(Y,Z,Q){let J=await Y,X=J.maxRetries??this.maxRetries;if(Z==null)Z=X;await this.prepareOptions(J);let{req:z,url:G,timeout:H}=await this.buildRequest(J,{retryCount:X-Z});await this.prepareRequest(z,{url:G,options:J});let W="log_"+(Math.random()*16777216|0).toString(16).padStart(6,"0"),K=Q===void 0?"":`, retryOf: ${Q}`,$=Date.now();if(F0(this).debug(`[${W}] sending request`,pY({retryOfRequestLogID:Q,method:J.method,url:G,options:J,headers:z.headers})),J.signal?.aborted)throw new T0;let V=new AbortController,q=await this.fetchWithTimeout(G,z,H,V).catch(a1),M=Date.now();if(q instanceof globalThis.Error){let T=`retrying, ${Z} attempts remaining`;if(J.signal?.aborted)throw new T0;let _=n1(q)||/timed? ?out/i.test(String(q)+("cause"in q?String(q.cause):""));if(Z)return F0(this).info(`[${W}] connection ${_?"timed out":"failed"} - ${T}`),F0(this).debug(`[${W}] connection ${_?"timed out":"failed"} (${T})`,pY({retryOfRequestLogID:Q,url:G,durationMs:M-$,message:q.message})),this.retryRequest(J,Z,Q??W);if(F0(this).info(`[${W}] connection ${_?"timed out":"failed"} - error; no more retries left`),F0(this).debug(`[${W}] connection ${_?"timed out":"failed"} (error; no more retries left)`,pY({retryOfRequestLogID:Q,url:G,durationMs:M-$,message:q.message})),_)throw new s6;throw new o6({cause:q})}let B=[...q.headers.entries()].filter(([T])=>T==="x-request-id").map(([T,_])=>", "+T+": "+JSON.stringify(_)).join(""),D=`[${W}${K}${B}] ${z.method} ${G} ${q.ok?"succeeded":"failed"} with status ${q.status} in ${M-$}ms`;if(!q.ok){let T=await this.shouldRetry(q);if(Z&&T){let S=`retrying, ${Z} attempts remaining`;return await QV(q.body),F0(this).info(`${D} - ${S}`),F0(this).debug(`[${W}] response error (${S})`,pY({retryOfRequestLogID:Q,url:q.url,status:q.status,headers:q.headers,durationMs:M-$})),this.retryRequest(J,Z,Q??W,q.headers)}let _=T?"error; no more retries left":"error; not retryable";F0(this).info(`${D} - ${_}`);let w=await q.text().catch((S)=>a1(S).message),I=oU(w),E=I?void 0:w;throw F0(this).debug(`[${W}] response error (${_})`,pY({retryOfRequestLogID:Q,url:q.url,status:q.status,headers:q.headers,message:E,durationMs:Date.now()-$})),this.makeStatusError(q.status,I,E,q.headers)}return F0(this).info(D),F0(this).debug(`[${W}] response start`,pY({retryOfRequestLogID:Q,url:q.url,status:q.status,headers:q.headers,durationMs:M-$})),{response:q,options:J,controller:V,requestLogID:W,retryOfRequestLogID:Q,startTime:$}}getAPIList(Y,Z,Q){return this.requestAPIList(Z,{method:"get",path:Y,...Q})}requestAPIList(Y,Z){let Q=this.makeRequest(Z,null,void 0);return new z2(this,Q,Y)}async fetchWithTimeout(Y,Z,Q,J){let{signal:X,method:z,...G}=Z||{};if(X)X.addEventListener("abort",()=>J.abort());let H=setTimeout(()=>J.abort(),Q),W=globalThis.ReadableStream&&G.body instanceof globalThis.ReadableStream||typeof G.body==="object"&&G.body!==null&&Symbol.asyncIterator in G.body,K={signal:J.signal,...W?{duplex:"half"}:{},method:"GET",...G};if(z)K.method=z.toUpperCase();try{return await this.fetch.call(void 0,Y,K)}finally{clearTimeout(H)}}async shouldRetry(Y){let Z=Y.headers.get("x-should-retry");if(Z==="true")return!0;if(Z==="false")return!1;if(Y.status===408)return!0;if(Y.status===409)return!0;if(Y.status===429)return!0;if(Y.status>=500)return!0;return!1}async retryRequest(Y,Z,Q,J){let X,z=J?.get("retry-after-ms");if(z){let H=parseFloat(z);if(!Number.isNaN(H))X=H}let G=J?.get("retry-after");if(G&&!X){let H=parseFloat(G);if(!Number.isNaN(H))X=H*1000;else X=Date.parse(G)-Date.now()}if(!(X&&0<=X&&X<60000)){let H=Y.maxRetries??this.maxRetries;X=this.calculateDefaultRetryTimeoutMillis(Z,H)}return await DY(X),this.makeRequest(Y,Z-1,Q)}calculateDefaultRetryTimeoutMillis(Y,Z){let X=Z-Y,z=Math.min(0.5*Math.pow(2,X),8),G=1-Math.random()*0.25;return z*G*1000}async buildRequest(Y,{retryCount:Z=0}={}){let Q={...Y},{method:J,path:X,query:z,defaultBaseURL:G}=Q,H=this.buildURL(X,z,G);if("timeout"in Q)aU("timeout",Q.timeout);Q.timeout=Q.timeout??this.timeout;let{bodyHeaders:W,body:K}=this.buildBody({options:Q}),$=await this.buildHeaders({options:Y,method:J,bodyHeaders:W,retryCount:Z});return{req:{method:J,headers:$,...Q.signal&&{signal:Q.signal},...globalThis.ReadableStream&&K instanceof globalThis.ReadableStream&&{duplex:"half"},...K&&{body:K},...this.fetchOptions??{},...Q.fetchOptions??{}},url:H,timeout:Q.timeout}}async buildHeaders({options:Y,method:Z,bodyHeaders:Q,retryCount:J}){let X={};if(this.idempotencyHeader&&Z!=="get"){if(!Y.idempotencyKey)Y.idempotencyKey=this.defaultIdempotencyKey();X[this.idempotencyHeader]=Y.idempotencyKey}let z=P([X,{Accept:"application/json","User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(J),...Y.timeout?{"X-Stainless-Timeout":String(Math.trunc(Y.timeout/1000))}:{},...YV(),"OpenAI-Organization":this.organization,"OpenAI-Project":this.project},await this.authHeaders(Y),this._options.defaultHeaders,Q,Y.headers]);return this.validateHeaders(z),z.values}buildBody({options:{body:Y,headers:Z}}){if(!Y)return{bodyHeaders:void 0,body:void 0};let Q=P([Z]);if(ArrayBuffer.isView(Y)||Y instanceof ArrayBuffer||Y instanceof DataView||typeof Y==="string"&&Q.values.has("content-type")||globalThis.Blob&&Y instanceof globalThis.Blob||Y instanceof FormData||Y instanceof URLSearchParams||globalThis.ReadableStream&&Y instanceof globalThis.ReadableStream)return{bodyHeaders:void 0,body:Y};else if(typeof Y==="object"&&((Symbol.asyncIterator in Y)||(Symbol.iterator in Y)&&("next"in Y)&&typeof Y.next==="function"))return{bodyHeaders:void 0,body:a7(Y)};else return N(this,k2,"f").call(this,{body:Y,headers:Q})}}var O9,I9,k2,Kq;var A2=F(()=>{e0();dY();fQ();VV();MY();G0();ZJ();Wq();Q2();OJ();gJ();lJ();oJ();G9();H9();W9();N9();w9();wJ();hJ();LJ();dJ();cJ();aJ();J9();z9();U9();R9();D9();_9();fQ();U0();H4();dY();I9=a,k2=new WeakMap,O9=new WeakSet,Kq=function Y(){return this.baseURL!=="https://api.openai.com/v1"};a.OpenAI=I9;a.DEFAULT_TIMEOUT=600000;a.OpenAIError=y;a.APIError=M0;a.APIConnectionError=o6;a.APIConnectionTimeoutError=s6;a.APIUserAbortError=T0;a.NotFoundError=t1;a.ConflictError=e1;a.RateLimitError=Z4;a.BadRequestError=o1;a.AuthenticationError=s1;a.InternalServerError=Q4;a.PermissionDeniedError=r1;a.UnprocessableEntityError=Y4;a.InvalidWebhookSignatureError=uY;a.toFile=H2;a.Completions=r8;a.Chat=Y8;a.Embeddings=e8;a.Files=Z1;a.Images=z1;a.Audio=nY;a.Moderations=H1;a.Models=G1;a.FineTuning=wY;a.Graders=$8;a.VectorStores=_6;a.Webhooks=U1;a.Beta=NY;a.Batches=a8;a.Uploads=U8;a.Responses=T6;a.Realtime=D6;a.Conversations=W8;a.Evals=K8;a.Containers=H8;a.Videos=K1});var $q=F(()=>{U0();zY();x4();A2()});var Uq=F(()=>{A2();ZJ();Q2();A2();G0();MY();$q()});class P2{client;defaultModel;constructor(Y,Z,Q="gpt-5-nano",J){this.client=new a({apiKey:Y,baseURL:Z,defaultHeaders:J}),this.defaultModel=Q}async generate(Y){return(await this.client.chat.completions.create({messages:[{role:"user",content:Y.prompt}],model:Y.model||this.defaultModel,temperature:Y.temperature,max_tokens:Y.maxTokens,reasoning_effort:Y.reasoning})).choices[0].message.content||""}async*streamGenerate(Y){try{let Z=await this.client.chat.completions.create({messages:[{role:"user",content:Y.prompt}],model:Y.model||this.defaultModel,temperature:Y.temperature,max_tokens:Y.maxTokens,stream:!0,reasoning_effort:Y.reasoning});for await(let Q of Z){let J=Q.choices[0]?.delta,X=J?.content,z=J?.reasoning_content||J?.reasoning||J?.reasoning_details?.[0]?.summary;if(X||z)yield{chunk:X??void 0,thinkingChunk:z??void 0,metadata:{model:Q.model,finishReason:Q.choices[0]?.finish_reason??void 0}}}}catch(Z){yield{error:GX(Z)?Z:new s(String(Z),"OPENAI_STREAM_ERROR")}}}}var Vq=F(()=>{Uq();Q0()});var qq=()=>{};async function r4(){let Y=await $0(),Z=Y.get("llm.provider")||"openai",Q=await Y.getSecure("llm.apiKey"),J=Y.get("llm.model");if(!Q)throw new s("No API key found. Please set llm.apiKey in ~/.gdx/.gdxrc.toml or GDX_LLM_API_KEY env var.","NO_API_KEY");if(Q.startsWith("sk-or-"))Z="openrouter";switch(Z.toLowerCase()){case"openrouter":return new P2(Q,CX,J,{"HTTP-Referer":"https://github.com/Type-Delta/gdx/tree/main","X-Title":"GDX"});case"openai":return new P2(Q,void 0,J);default:throw new s(`Unsupported LLM provider: ${Z}`,"UNSUPPORTED_LLM_PROVIDER")}}var E9=F(()=>{Q0();J0();XY();Vq();qq()});function C9(Y){return mY`<instructions>You are an expert Git commit message generator. Analyze the provided git diff in the following messages and generate a concise and informative commit message following the specified format and rules. Focus on clarity and relevance to help maintain a well-documented project history. Output ONLY the commit message.</instructions>
|
|
464
471
|
|
|
465
472
|
<rules>
|
|
466
473
|
Commit message must be in the following format:
|
|
@@ -481,7 +488,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
481
488
|
|
|
482
489
|
Additional rules:
|
|
483
490
|
- Use the imperative mood in the title (e.g., "Fix bug" not "Fixed bug" or "Fixes bug")
|
|
484
|
-
- Total commit message length
|
|
491
|
+
- IMPORTANT! Total commit message length MUST NOT EXCEED 170 WORDS, keep it concise
|
|
485
492
|
- Do not use Markdown or any other formatting in the output
|
|
486
493
|
- Do not use bullet points outside of the recap section
|
|
487
494
|
- DO NOT PREFIX SECTIONS with labels like "Description:" or "Recap:"
|
|
@@ -491,7 +498,51 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
491
498
|
${Y}
|
|
492
499
|
</git-diff>
|
|
493
500
|
|
|
494
|
-
Your commit message:`}function
|
|
501
|
+
Your commit message:`}function Bq(Y,Z){return mY`<instructions>You are an expert Git commit message generator. Analyze the provided git diff and generate a commit message that follows the project-specific conventions documented below. Focus on clarity and consistency with the existing commit history. Output ONLY the commit message.</instructions>
|
|
502
|
+
|
|
503
|
+
<project-commit-guidelines>
|
|
504
|
+
${Z}
|
|
505
|
+
</project-commit-guidelines>
|
|
506
|
+
|
|
507
|
+
<rules>
|
|
508
|
+
- Follow the project-specific conventions above strictly
|
|
509
|
+
- Use the imperative mood in commit titles
|
|
510
|
+
- IMPORTANT! Total commit message length MUST NOT EXCEED 170 WORDS, keep it concise
|
|
511
|
+
- Do not use Markdown or any other formatting in the output
|
|
512
|
+
- Output ONLY the commit message without any labels or prefixes
|
|
513
|
+
</rules>
|
|
514
|
+
|
|
515
|
+
<git-diff>
|
|
516
|
+
${Y}
|
|
517
|
+
</git-diff>
|
|
518
|
+
|
|
519
|
+
Your commit message:`}function Fq(Y){let Z=Y.map((Q,J)=>`Example ${J+1}:
|
|
520
|
+
${Q}`).join(`
|
|
521
|
+
|
|
522
|
+
---
|
|
523
|
+
|
|
524
|
+
`);return mY`<instructions>You are analyzing a Git repository's commit message history to identify and document the commit message conventions used by this project. Study the provided examples and extract the underlying patterns, structure, and style rules.</instructions>
|
|
525
|
+
|
|
526
|
+
<commit-message-examples>
|
|
527
|
+
${Z}
|
|
528
|
+
</commit-message-examples>
|
|
529
|
+
|
|
530
|
+
<task>
|
|
531
|
+
Analyze the commit messages above and produce a concise "Commit Message Guideline" document (max 500 words) that captures:
|
|
532
|
+
1. Overall structure (header/body/footer format, line length limits)
|
|
533
|
+
2. Header conventions (prefixes, types, scopes, title style)
|
|
534
|
+
3. Body conventions (description style, wrapping, bullets if used)
|
|
535
|
+
4. Any recurring patterns or special formatting
|
|
536
|
+
|
|
537
|
+
CRITICAL RULES:
|
|
538
|
+
- Only document patterns that are CLEARLY EVIDENT in the examples
|
|
539
|
+
- Do NOT invent rules that aren't demonstrated in the actual commits
|
|
540
|
+
- If examples are inconsistent, note the variations
|
|
541
|
+
- Be specific and actionable
|
|
542
|
+
- Output ONLY the guideline document, no preamble
|
|
543
|
+
</task>
|
|
544
|
+
|
|
545
|
+
Commit Message Guideline:`}function Rq(Y){return mY`<instruction>
|
|
495
546
|
You are an unfiltered Gen-Z dev who speaks like a terminal meme lord.
|
|
496
547
|
You talk in chaotic, funny, exaggerated internet slang. You sprinkle emojis,
|
|
497
548
|
caps, sarcasm, and over-the-top reactions. Never boring.
|
|
@@ -509,281 +560,384 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
|
|
|
509
560
|
${Y}
|
|
510
561
|
</commit>
|
|
511
562
|
|
|
512
|
-
Your unhinged reaction:`}async function
|
|
513
|
-
`);for(let
|
|
563
|
+
Your unhinged reaction:`}var j9=F(()=>{c7()});async function k9(Y){let{git$:Z}=Y;try{let Q=await K6(Z,"user.email"),J=(await x`${Z} log -1 --pretty=format:%s\n\n%b --author=${Q} --no-merges`.catch(B1))?.stdout.trim();if(!J||J.length===0)return L.error("Bro, you haven't committed anything yet. \uD83E\uDD23","nocap"),1;let X=J.split(`
|
|
564
|
+
`);for(let $ of X)O(`${U("Dim")}> ${U()}${$}`);O(`
|
|
514
565
|
${U("Cyan")}${U("Dim")}Reviewing your commit message...${U()}
|
|
515
|
-
`);let
|
|
566
|
+
`);let z=await r4(),G=i6({message:"cooking up a roast...",animateGradient:!0,gradientColor:j.Teal300,gradientColorBg:j.Fuchsia400}),H=z.streamGenerate({prompt:Rq(J),temperature:0.8,maxTokens:269,reasoning:"low"}),W="",K=!1;for await(let $ of H){if($.error)return G.stop(),L.error(`\uD83D\uDE2D ill bro, the server rejected u
|
|
516
567
|
|
|
517
|
-
${
|
|
518
|
-
`),!
|
|
519
|
-
${
|
|
568
|
+
${p($.error,{color:!0})}`,"nocap"),1;if($.chunk){if(!K)K=!0,G.stop();O($.chunk,""),W+=$.chunk}}if(O(`
|
|
569
|
+
`),!W)return L.error("Unable to generate response (empty response).","nocap"),1;return 0}catch(Q){return L.error(p(Q,{color:!0}),"nocap"),1}}var Mq,Dq;var x2=F(()=>{Q0();A0();R0();E9();K0();j9();J0();O0();S0();RY();Mq={long:()=>{let Y=U("Bright"),Z=U();return n(`
|
|
570
|
+
${Y+h("NOCAP",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
520
571
|
Generate a playful roast for your latest commit message.
|
|
521
572
|
|
|
522
|
-
${
|
|
573
|
+
${Y+h("DESCRIPTION",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
523
574
|
Reads the latest commit message authored by the configured git user and asks the configured LLM provider to produce a humorous "roast" or light-hearted commentary. Output is streamed to the terminal with progress spinners and incremental printing as the LLM responds.
|
|
524
575
|
|
|
525
|
-
${
|
|
576
|
+
${Y+h("WHEN TO USE",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
526
577
|
Use when you want a quick, entertaining summary/critique of your most recent commit message before pushing, or as a lighthearted CI/gaming aid.
|
|
527
578
|
|
|
528
|
-
${
|
|
579
|
+
${Y+h("NOTES",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
529
580
|
The command requires a valid git user.email in repo config and a configured LLM adapter. Network or LLM errors will print a colored error and return a non-zero exit code.
|
|
530
|
-
`,Math.min(100,
|
|
531
|
-
${
|
|
581
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Create a humorous critique of your latest commit message.",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
582
|
+
${Y}${k} nocap${Q}
|
|
532
583
|
|
|
533
584
|
Examples:
|
|
534
|
-
${
|
|
535
|
-
${
|
|
585
|
+
${Y}${k} nocap ${Q+Z}# Roast the latest commit by the configured git user${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},Dq={$root:[]}});function Lq(Y){let Z={},Q=Array.from(new Set(Y));for(let J of Q){if(!J)continue;Z[J]={}}return Z}function S2(Y,Z,Q="$allOf"){let J={},X=Array.from(new Set(Y));for(let z of X){if(!z)continue;J[z]={[Q]:Z}}return J}import N6 from"path";async function _q(Y){let Z=[],Q=!1;try{let X=(await $0()).get("parallel.init","submodule"),z=Tq(X);if(z.invalid.length>0)Z.push(`Unknown parallel.init values: ${z.invalid.join(", ")}. Valid values: submodule, pkg.`);let G=Tq(Y.noInitList);if(G.invalid.length>0)Z.push(`Unknown --no-init values: ${G.invalid.join(", ")}. Valid values: submodule, pkg.`);if(Y.noInitAll||Y.noInitList==="")Q=!0;let H=new Set(G.values),W=z.values.filter((K)=>!H.has(K));if(W.length===0)Q=!0;if(!Q&&W.includes("submodule"))try{await OU(Y.git$,Y.worktreePath)}catch(K){Z.push(`Submodule init failed. ${p(K,{color:!0})}`)}if(!Q&&W.includes("pkg")){let K=await FO(Y.worktreePath);Z.push(...K.warnings)}}catch(J){Z.push(`Init failed. ${p(J,{color:!0})}`)}BO(Z)}function BO(Y){for(let Z of Y)L.warn(Z,"worktree-init")}function Tq(Y){let Z=[],Q=[],J=new Set,X=[];if(Array.isArray(Y))X=Y.map((z)=>String(z));else if(typeof Y==="string")X=Y.split(",");else if(Y!=null)X=[String(Y)];for(let z of X){let G=z.trim().toLowerCase();if(!G)continue;if(qO.has(G)){let H=G;if(!J.has(H))Z.push(H),J.add(H)}else Q.push(G)}return{values:Z,invalid:Q}}async function FO(Y){let Z=[],Q=!1,J=RO(Y,Z);if(J){let X=await LO(J,Y,Z);Q||=X}if(DO(Y)){let X=await TO(Y,Z);Q||=X}return{ran:Q,warnings:Z}}function RO(Y,Z){let Q=N6.join(Y,"package.json"),J=t(Q),X=N6.join(Y,"bun.lockb"),z=N6.join(Y,"bun.lock"),G=N6.join(Y,"pnpm-lock.yaml"),H=N6.join(Y,"package-lock.json"),W=N6.join(Y,"npm-shrinkwrap.json"),K=null;if(J){let $=MO(Q,Z);if($)K=$}if(!K){if(t(X)||t(z))K="bun";else if(t(G))K="pnpm";else if(J&&(t(H)||t(W)))K="npm";else if(J)K="npm"}return K}function MO(Y,Z){try{let Q=aY(Y,"utf-8"),X=JSON.parse(Q).packageManager?.split("@")[0]?.trim().toLowerCase();if(X==="npm"||X==="pnpm"||X==="bun")return X;if(X)Z.push(`Unsupported packageManager '${X}' in package.json. Supported: npm, pnpm, bun.`)}catch(Q){Z.push(`Failed to parse package.json: ${p(Q,{color:!0})}`)}return null}function DO(Y){let Z=N6.join(Y,"uv.lock"),Q=N6.join(Y,"pyproject.toml");return t(Z)||t(Q)}async function LO(Y,Z,Q){if(!await $6(Y))return Q.push(`Package manager '${Y}' not found in PATH. Skipping install.`),!1;let X=x({cwd:Z,stdout:"inherit",stderr:"inherit"});try{if(Y==="npm")await X`npm install`;else if(Y==="pnpm")await X`pnpm install`;else await X`bun install`;return!0}catch(z){return Q.push(`Package install failed for '${Y}'. ${p(z,{color:!0})}`),!1}}async function TO(Y,Z){if(!await $6("uv"))return Z.push("Package manager 'uv' not found in PATH. Skipping install."),!1;let J=x({cwd:Y,stdout:"inherit",stderr:"inherit"});try{return await J`uv sync`,!0}catch(X){return Z.push(`Package install failed for 'uv'. ${p(X,{color:!0})}`),!1}}var qO;var Nq=F(()=>{Q0();g0();A0();K0();XY();n6();qO=new Set(["submodule","pkg"])});import V0 from"path";async function y2(Y){let Z=await q8(Y);if(!Z)return[];if(!t(Z.parallelRoot))return[];let Q=sY(Z.parallelRoot,{withFileTypes:!0}),J=[];for(let X of Q){if(!X.isDirectory())continue;let z=V0.join(Z.parallelRoot,X.name),G=t4(z);if(!G)continue;let H=G.alias||X.name;J.push(H)}return J.sort((X,z)=>X.localeCompare(z))}function f2(Y){if(!Y||Y.trim()==="")return!1;if(/[/\\ ]/.test(Y))return!1;if(/[<>:"|?*\x00-\x1f]/.test(Y))return!1;return!0}function t4(Y){let Z=V0.join(Y,".git-parallel.json");try{let Q=aY(Z,"utf-8");return JSON.parse(Q)}catch{return null}}async function q8(Y){let Q=`${Array.isArray(Y)?Y.join(" "):Y}|${V0.resolve(process.cwd())}`;if(V8&&V8.cacheKey===Q){if(Date.now()<=V8.expiresAt)return V8.context;V8=null}try{let J=await t0(Y),X=V0.basename(J),z;try{z=(await x`${Y} rev-parse --abbrev-ref HEAD`).stdout.trim()}catch{z="HEAD"}let G=V0.join(kY,"worktrees"),H=J.startsWith(G.replace(/\\/g,"/")),W=X,K=z,$=null,V=J;if(H){let B=t4(J);if(B){if(B.branch)z=B.branch;if(B.originPath)V=V0.resolve(B.originPath);if(B.alias)$=B.alias}else $=V0.basename(J);W=B?.safeProject||W,K=B?.safeBranch||K}W=G5(W),K=G5(K);let q=V0.join(G,W,K),M={repoRoot:J,projectName:X,branchName:z,safeProjectName:W,safeBranchName:K,parallelRoot:q,originPath:V,alias:$,isParallelWorktree:H};return V8={cacheKey:Q,context:M,expiresAt:Date.now()+wq},M}catch(J){return L.error(p(J,{color:!0}),"parallel"),V8={cacheKey:Q,context:null,expiresAt:Date.now()+wq},null}}async function Eq(Y,Z){let Q=await q8(Y);if(!Q)return 1;let J=V0.join(Q.parallelRoot,Z);await kQ(Y);let X=await AQ(Y,J);if(!X&&!t(J))return L.error(`Worktree '${Z}' not found for branch '${Q.branchName}'.`,"parallel"),1;if(X?.locked){let K=X.lockReason?` (${X.lockReason})`:"";return L.error(`Worktree '${Z}' is locked${K}. Unlock it before removing.`,"parallel"),1}if(!t(J)){if(await d7(Y),!await AQ(Y,J))return O(`${U("Cyan")}Removed worktree metadata:${U()} ${Z}`),0;return L.error(`Worktree '${Z}' is missing on disk and could not be pruned.`,"parallel"),1}try{VX(J,J5.F_OK|J5.W_OK)}catch{return L.error(`Worktree '${Z}' is not accessible or writable. Cannot remove.`,"parallel"),1}let z=await _U(Y,J);if(z.length>0)return L.error(`Worktree '${Z}' has in-progress operations (${z.join(", ")}). Complete or abort them before removing.`,"parallel"),1;let G=await PQ(Y,J);if(G.length>0){let K=await NU(Y,J,G);if(K.length>0){let $=K.join(", ");return L.error(`Worktree '${Z}' has dirty submodules (${$}). Commit, stash, or clean them before removing.`,"parallel"),1}try{await wU(Y,J)}catch($){if((await x`${Y} -C ${J} status --porcelain=v1 --untracked-files=normal`).stdout.trim().length===0)await d7(Y);return L.error(`Failed to deinit submodules for '${Z}'.
|
|
586
|
+
${p($,{color:!0})}`,"parallel"),1}}let H=(await x`${Y} -C ${J} status --porcelain=v1 --untracked-files=normal`).stdout.trim();if(H.length>0){if(G.length>0){let K=new Set(G.map((q)=>jQ(q.path))),V=H.split(`
|
|
587
|
+
`).map((q)=>q.trim()).filter((q)=>q.length>0).map((q)=>q.slice(3)).map((q)=>q.split(" -> ").pop()??q).map((q)=>jQ(q)).filter((q)=>K.has(q));if(V.length>0)return L.error(`Worktree '${Z}' has dirty submodules (${V.join(", ")}). Commit, stash, or clean them before removing.`,"parallel"),1}return L.error(`Worktree '${Z}' has uncommitted changes. Join or clean it before removing.`,"parallel"),1}O("");let W=i6({frames:["███","██▇","██▆","▇▅▆","▆▅▆","▃▅▅","▄▅▄","▃▃▁","▂▂▂","▁ ▁"," ","░ ","▓░ ","█▓░","██▓"],interval:120,message:`Removing worktree '${Z}'...`});try{await W0`${Y} worktree remove ${J}`;try{Z5(J,{recursive:!0,force:!0})}catch{}return O(`${U("Cyan")}Removed worktree:${U()} ${Z}`),0}catch(K){if(W.stop(),(K instanceof UY?`${K.stderr||""} ${K.message||""}`:"").toLowerCase().includes("working trees containing submodules cannot be moved or removed"))return L.error(`Worktree '${Z}' contains submodules that must be deinitialized before removal.`,"parallel"),1;if(K instanceof UY&&K.exitCode===255)L.error(`Folder '${J}' is currently in use or GDX does not have permission to remove it. Please close any applications using it and force remove. (git already removed the connection to the origin worktree, retry may not work)`,"parallel");else L.error(`Failed to remove worktree '${Z}'.
|
|
588
|
+
${p(K,{color:!0})}`,"parallel");let V=await p1("Do you want to force remove the worktree directory? (y/n): ");if(V.toLowerCase()==="y"||V.toLowerCase()==="yes")try{return Z5(J,{recursive:!0,force:!0}),await d7(Y),O(`${U("Cyan")}Force removed worktree directory:${U()} ${Z}`),0}catch{return L.error(`Failed to force remove worktree directory '${Z}'.`,"parallel"),1}else return L.warn(`Aborted removing worktree '${Z}'.`,"parallel"),1}finally{W.stop()}}async function IO(Y,Z){let Q=await q8(Y);if(!Q)return 1;if(Q.isParallelWorktree)return L.error("Run `git parallel fork` from the original worktree, not from a fork.","parallel"),1;if(Q.branchName==="HEAD")return L.error("Detached HEAD detected. Switch to a branch before forking.","parallel"),1;if(Z.length<1)return L.error("Missing worktree alias.","parallel"),OY(),1;let J=Z[0];if(!f2(J))return L.error(`Alias '${J}' contains invalid characters or spaces.`,"parallel"),1;let X=Z.slice(1),z=!1,G=null;if(X.hasOption("--no-init")){if(G=X.popValue("--no-init",0,!0),G===null)z=!0}let H=V0.join(Q.parallelRoot,J),W=X.includes("--move")||X.includes("-mv"),K=X.includes("--mirror")||X.includes("-mr"),$=X.filter((I)=>!["--move","--mirror","-mv","-mr"].includes(I));if($.length>0)return L.error(`Unknown option '${$[0]}'.`,"parallel"),OY(),1;if(t(H))return L.error(`Worktree alias '${J}' already exists for this branch.`,"parallel"),1;let V=V0.join(Q.repoRoot,".git","info","exclude");try{if(!aY(V,"utf-8").includes(".git-parallel.json"))qX(V,`
|
|
536
589
|
.git-parallel.json
|
|
537
|
-
`)}catch{
|
|
538
|
-
`)}
|
|
539
|
-
`),!
|
|
540
|
-
`).map((
|
|
541
|
-
`)
|
|
542
|
-
${U("
|
|
590
|
+
`)}catch{oY(V,`.git-parallel.json
|
|
591
|
+
`)}WY(Q.parallelRoot,{recursive:!0});let q=(await x`${Y} rev-parse HEAD`).stdout.trim(),B=(await x`${Y} status --porcelain=v1 --untracked-files=normal`).stdout.trim().length>0,D=null,T=null;if(B&&(W||K)){let I=`git-parallel:${J}`;try{if(K){let E=await x`${Y} stash create --include-untracked`;await x`${Y} stash store -m ${I} ${E}`,T="mirrored"}else if(W)await x`${Y} stash push --include-untracked -m ${I}`,T="moved";D="stash@{0}"}catch{return L.error("Failed to stash changes before forking.","parallel"),1}}try{await W0`${Y} worktree add --detach ${H} HEAD`}catch{if(L.error("Failed to create the parallel worktree.","parallel"),D)await x`${Y} stash pop ${D}`,O(`${U("Yellow")}Stashed changes restored to the origin worktree.${U()}`);return 1}if(D)try{await x`${Y} -C ${H} stash apply --index ${D}`,await x`${Y} stash drop ${D}`}catch{return L.error("Failed to move local changes into the new worktree.","parallel"),L.warn(`Your changes remain stashed as '${D}'. Apply them manually when ready.`,"parallel"),L.info(`Worktree path: ${H}`,"parallel"),1}let _={alias:J,branch:Q.branchName,safeBranch:Q.safeBranchName,project:Q.projectName,safeProject:Q.safeProjectName,originPath:Q.repoRoot,baseCommit:q,createdAt:new Date().toISOString()},w=V0.join(H,".git-parallel.json");if(oY(w,JSON.stringify(_,null,2),"utf-8"),O(`${U("Cyan")}Parallel worktree created:${U()} ${H}`),T)O(`${U("Cyan")}Pending changes ${T} to fork '${J}'.${U()}`);return await _q({git$:Y,worktreePath:H,noInitAll:z,noInitList:G}),0}async function EO(Y,Z){if(Z.length<1)return L.error("Missing worktree alias to remove.","parallel"),OY(),1;let Q=Z[0];if(!f2(Q))return L.error(`Alias '${Q}' contains invalid characters or spaces.`,"parallel"),1;let J=await q8(Y);if(!J)return 1;let X=V0.join(J.parallelRoot,Q);if(V0.resolve(J.repoRoot)===V0.resolve(X))return L.error("Cannot remove the worktree you are currently in. Switch to origin first.","parallel"),1;return await Eq(Y,Q)}async function Oq(Y,Z,Q=!1){let J=await q8(Y);if(!J)return 1;if(Z.length<1)return L.error("Missing target worktree alias or 'origin'.","parallel"),OY(),1;let X=Z[0];if(X.toLowerCase()==="origin"){if(!t(J.originPath))return L.error(`Origin worktree path not found at '${J.originPath}'.`,"parallel"),1;return await OQ(J.originPath),0}if(!f2(X))return L.error(`Alias '${X}' contains invalid characters or spaces.`,"parallel"),1;let z=V0.join(J.parallelRoot,X);if(!t(z))return L.error(`Worktree '${X}' not found for branch '${J.branchName}'.`,"parallel"),1;if(Z.includes("-c")||Z.includes("--copy"))return await g7(z),O(`${U("Cyan")}Worktree path copied to clipboard!${U()}`),0;if(Q)await FU(z);else await OQ(z);return 0}async function CO(Y,Z,Q){try{let J=(await x`${Y} -C ${Z} rev-parse HEAD`).stdout.trim(),X=(await x`${Y} -C ${Q} rev-parse HEAD`).stdout.trim();if(J===X)return{ahead:0,behind:0};let z=0;try{let H=(await x`${Y} -C ${Z} rev-list --count ${X}..${J}`).stdout.trim();z=parseInt(H,10)||0}catch{z=0}let G=0;try{let H=(await x`${Y} -C ${Z} rev-list --count ${J}..${X}`).stdout.trim();G=parseInt(H,10)||0}catch{G=0}return{ahead:z,behind:G}}catch{return{ahead:0,behind:0}}}async function jO(Y,Z){let Q=await q8(Y);if(!Q)return 1;let J=new Map,X=new Map;O(`${U("Cyan")}Project:${U()} ${Q.projectName}`),O(`${U("Cyan")}Branch:${U()} ${Q.branchName}`),O(`${U("Cyan")}Origin:${U()} ${Q.originPath}`);let z=Q.isParallelWorktree?Q.alias:"origin";if(O(`${U("Cyan")}Current:${U()} ${z}
|
|
592
|
+
`),!t(Q.parallelRoot))return O(`${U("Yellow")}No forked worktrees found for this branch.${U()}`),0;let H=sY(Q.parallelRoot,{withFileTypes:!0}).filter((K)=>K.isDirectory()).sort((K,$)=>K.name.localeCompare($.name));if(H.length===0)return O(`${U("Yellow")}No forked worktrees found for this branch.${U()}`),0;let W=!1;for(let K of H){let $=V0.join(Q.parallelRoot,K.name),V=t4($);if(!V)continue;let q=V?.alias||K.name;W=!0;let M=V0.resolve($),B=J.get(M);if(!B){let v=(await x`${Y} -C ${$} status --porcelain=v1 --untracked-files=normal`).stdout.trim().length>0,S="unknown";try{S=(await x`${Y} -C ${$} rev-parse --short HEAD`).stdout.trim()}catch{}B={isDirty:v,shortHead:S},J.set(M,B)}let D=`${M}::${V0.resolve(Q.originPath)}`,T=X.get(D);if(!T)T=await CO(Y,$,Q.originPath),X.set(D,T);let _="";if(T.ahead>0&&T.behind>0)_=`${U("Yellow")}↑${T.ahead} ↓${T.behind}${U()}`;else if(T.ahead>0)_=`${U("Green")}↑${T.ahead}${U()}`;else if(T.behind>0)_=`${U("Red")}↓${T.behind}${U()}`;else _=`${U("Dim")}up-to-date${U()}`;let w=Q.isParallelWorktree&&q===Q.alias?"●":"○",I=B.isDirty?`${U("Red")}dirty${U()}`:`${U("Green")}clean${U()}`;if(Z.includes("--short")||Z.includes("-s")){let E=L8($,50,"mid",-1);$=C6(E,`file://${$.replace(/\\/g,"/")}`)}O(`${U("Dim")}${w}${U()} ${L8(q,18,"end")} ${j6(I,7,{align:"center"})} ${U("Dim")}${B.shortHead}${U()} ${$X(_,11)} ${$}`)}if(!W)O(`${U("Yellow")}No forked worktrees found for this branch.${U()}`);return O(""),0}async function Iq(Y,Z,Q,J){try{await x`${Y} -C ${Z} stash pop ${J}`,O(`${U("Yellow")}Stashed changes restored to fork '${Q}' due to cherry-pick failure.${U()}`)}catch(X){O(`${U("Yellow")}Please restore stash '${J}' manually from fork '${Q}'. Automatic pop failed.${U()}`),L.debug(p(X,{color:!0}),"parallel")}}async function Cq(Y,Z){try{return(await x`${Y} -C ${Z} diff --name-only --diff-filter=U`).stdout.split(`
|
|
593
|
+
`).map((J)=>J.trim()).filter((J)=>J.length>0)}catch{return[]}}async function kO(Y,Z){let Q=await Cq(Y,Z);if(Q.length===0)return;let J=["-C",Z,"add","-A","--",...Q];await W0`${Y} ${J}`}function AO(Y,Z,Q,J,X){if(O(`${U("Yellow")}Cherry-pick stopped at commit ${Q}. To resolve conflicts run:${U()}`),O(`${U("Cyan")}${` git -C "${Y}" cherry-pick ${Q}`}${U()}`),X.length>0){let G=X.map((H)=>H.includes(" ")?`"${H}"`:H).join(" ");O(`${U("Cyan")}${` git -C "${Y}" add -- ${G}`}${U()}`)}else O(`${U("Cyan")}${` git -C "${Y}" add -A`}${U()}`);if(O(`${U("Cyan")}${` git -C "${Y}" cherry-pick --continue`}${U()}`),O(`${U("Cyan")}${` ${k} parallel join ${Z}`}${U()}`),J)O(`${U("Dim")}Stashed changes from fork '${Z}' can be applied after join.${U()}`)}async function jq(Y,Z,Q,J){let{keep:X,bringAll:z}=J,G=t4(Z);if(!G)return L.error(`Missing metadata for worktree '${Q}'. Unable to join automatically.`,"parallel"),1;let H=V0.resolve(G.originPath);if(!t(H))return L.error(`Original worktree path not found. Expected at '${G.originPath}'.`,"parallel"),1;let K=(await x`${Y} -C ${Z} status --porcelain=v1 --untracked-files=normal`).stdout.trim().length>0;if(K&&!z)return L.error(`Fork '${Q}' has uncommitted changes. Re-run with --all to include them or clean the worktree first.`,"parallel"),1;if((await x`${Y} -C ${H} status --porcelain=v1 --untracked-files=normal`).stdout.trim().length>0)return L.error("Origin worktree has pending changes. Commit or stash them before joining.","parallel"),1;let V=G.baseCommit?.trim();if(!V)return L.error("Fork metadata is missing base commit information. Unable to perform an automatic join.","parallel"),1;let q=null;if(K&&z){let D=`git-parallel-join:${Q}`;try{await x`${Y} -C ${Z} stash push --include-untracked -m ${D}`,q="stash@{0}"}catch{return L.error("Failed to stash uncommitted changes before joining.","parallel"),1}}let M;try{let D=(await x`${Y} -C ${Z} rev-parse HEAD`).stdout.trim(),T=(await x`${Y} -C ${Z} rev-list --reverse ${V}..${D}`).stdout.trim();M=T?T.split(`
|
|
594
|
+
`).map((_)=>_.trim()).filter((_)=>_):[]}catch(D){if(q)await x`${Y} -C ${Z} stash pop ${q}`;return L.error("Unable to enumerate commits to join.","parallel"),L.debug(p(D,{color:!0}),"parallel"),1}let B=[];for(let D of M){if(!D)continue;try{await W0`${Y} -C ${H} cherry-pick ${D}`,B.push(D)}catch(T){if(!await CQ(Y,H)){if(q)await Iq(Y,Z,Q,q);return L.error(`Cherry-pick failed while applying commit ${D}.`,"parallel"),L.debug(p(T,{color:!0}),"parallel"),1}if(!BU()){let w=await Cq(Y,H);return AO(H,Q,D,q,w),L.debug(p(T,{color:!0}),"parallel"),1}O(`${U("Yellow")}Cherry-pick paused due to conflicts while applying commit ${D}.${U()}`),O(`${U("Dim")}Resolve conflicts in the origin worktree, then choose to continue or abort.${U()}`);while(!0){let w=(await p1("Type c to continue, a to abort (c|a): ")).toLowerCase();if(w==="c"||w==="continue"||w==="y"||w==="yes")try{await kO(Y,H),await W0`${Y} -C ${H} cherry-pick --continue`,B.push(D);break}catch(I){if(await CQ(Y,H)){O(`${U("Yellow")}Cherry-pick still has conflicts. Resolve them and try again.${U()}`),L.debug(p(I,{color:!0}),"parallel");continue}return L.error("Cherry-pick no longer in progress. You may need to resolve the state manually before retrying.","parallel"),L.debug(p(I,{color:!0}),"parallel"),1}if(w==="a"||w==="abort"||w==="n"||w==="no"){try{await W0`${Y} -C ${H} cherry-pick --abort`}catch(I){return L.error("Failed to abort cherry-pick.","parallel"),L.debug(p(I,{color:!0}),"parallel"),1}if(q)await Iq(Y,Z,Q,q);return L.error(`Cherry-pick aborted while applying commit ${D}.`,"parallel"),1}}}}if(q)try{let _=(await x`${Y} -C ${Z} stash list`).stdout.trim().split(`
|
|
595
|
+
`)[0]?.split(":")[0]||q;await x`${Y} -C ${H} stash apply --index ${_}`,await x`${Y} -C ${Z} stash drop ${_}`}catch(D){L.error("Failed to apply uncommitted changes to the origin worktree.","parallel"),L.debug(p(D,{color:!0}),"parallel");try{await x`${Y} -C ${Z} stash pop ${q}`,O(`${U("Yellow")}Stashed changes restored to fork '${Q}' for safety.${U()}`)}catch(T){O(`${U("Yellow")}Please restore stash '${q}' manually from fork '${Q}'. Automatic pop failed.${U()}`),L.debug(p(T,{color:!0}),"parallel")}return 1}if(B.length>0)O(`${U("Cyan")}Cherry-picked ${B.length} commit(s) into origin.${U()}`);else O(`${U("Cyan")}No new commits to cherry-pick. Origin was already up to date.${U()}`);if(!X){if(await Eq(Y,Q)!==0)return L.warn(`Failed to remove fork '${Q}' after joining. Please remove it manually later.`),1;O(`${U("Cyan")}Fork '${Q}' merged and removed successfully.${U()}`)}else{try{let D=(await x`${Y} -C ${H} rev-parse HEAD`).stdout.trim();if(D){G.baseCommit=D,G.updatedAt=new Date().toISOString();let T=V0.join(Z,".git-parallel.json");oY(T,JSON.stringify(G,null,2),"utf-8")}}catch{}O(`${U("Cyan")}Fork '${Q}' merged into origin. Worktree kept at:${U()} ${Z}`)}return 0}async function PO(Y,Z,Q){if(!t(Z.parallelRoot))return O(`${U("Yellow")}No forked worktrees found for this branch.${U()}`),0;let X=sY(Z.parallelRoot,{withFileTypes:!0}).filter((G)=>G.isDirectory()).sort((G,H)=>G.name.localeCompare(H.name));if(X.length===0)return O(`${U("Yellow")}No forked worktrees found for this branch.${U()}`),0;let z=!1;for(let G of X){let H=V0.join(Z.parallelRoot,G.name),W=t4(H);if(!W)continue;let K=W.alias||G.name;z=!0;let $=await jq(Y,H,K,{keep:Q,bringAll:!1});if($!==0)return $}if(!z)O(`${U("Yellow")}No forked worktrees found for this branch.${U()}`);return 0}async function xO(Y,Z){let Q=await q8(Y);if(!Q)return 1;let J=["--keep","--all","-r","--recursive"],X=new Set,z=null;for(let V of Z){let q=V.toLowerCase();if(J.includes(q))X.add(q);else if(!z&&!V.startsWith("-"))z=V;else return L.error(`Unknown option '${V}'.`,"parallel"),OY(),1}let G=X.has("--keep"),H=X.has("--all"),W=X.has("-r")||X.has("--recursive");if(W&&H)return L.error("Recursive join does not support --all. Join forks individually.","parallel"),OY(),1;if(W&&z)return L.error("Recursive join does not accept an alias. Omit <alias> with -r.","parallel"),OY(),1;if(W&&Q.isParallelWorktree)return L.error("Run recursive join from the origin worktree, not from a fork.","parallel"),1;if(W)return await PO(Y,Q,G);let K,$;if(z){if(Q.isParallelWorktree&&Q.alias===z)return L.error("Cannot join the fork you are currently in. Switch to origin or another fork first.","parallel"),1;if(!f2(z))return L.error(`Alias '${z}' contains invalid characters or spaces.`,"parallel"),1;if(K=V0.join(Q.parallelRoot,z),$=z,!t(K))return L.error(`Worktree '${z}' not found for branch '${Q.branchName}'.`,"parallel"),1}else{if(!Q.isParallelWorktree)return L.error("Either run join from inside a forked worktree, or specify which fork to join.","parallel"),L.info("Usage: git parallel join [<alias>] [--keep|--all] | git parallel join -r [--keep]","parallel"),1;K=Q.repoRoot,$=Q.alias}return await jq(Y,K,$,{keep:G,bringAll:H})}async function A9(Y){let{git$:Z,args:Q}=Y;if(Q.length<2)return OY(),1;let J=Q[1].toLowerCase(),X=Q.slice(2);switch(J){case"fork":return await IO(Z,X);case"remove":return await EO(Z,X);case"switch":if(!P6)return L.error("'git parallel switch' requires the shell integration. See readme for details."),1;return await Oq(Z,X,!0);case"open":return await Oq(Z,X);case"list":return await jO(Z,X);case"join":return await xO(Z,X);case"help":return OY(),0;default:return OY(),1}}function OY(){O(v2.short+`
|
|
596
|
+
`+v2.usage())}var wq=1000,V8=null,_O=async({git$:Y})=>{let Z=await y2(Y);return S2(["origin",...Z],["-c","--copy"])},NO=async({git$:Y})=>{let Z=await y2(Y);return S2(["origin",...Z],["-c","--copy"])},wO=async({git$:Y})=>{let Z=await y2(Y);return{$allOf:["--keep","--all"],"-r":{$allOf:["--keep"]},"--recursive":{$allOf:["--keep"]},...S2(Z,["--keep","--all"])}},OO=async({git$:Y})=>{let Z=await y2(Y);return Lq(Z)},v2,kq;var b2=F(()=>{g0();h1();Q0();A0();R0();K0();J0();S0();O0();RY();n6();Nq();v2={long:()=>{let Y=U("Bright"),Z=U("Cyan"),Q=U();return n(`
|
|
597
|
+
${Y+h("PARALLEL",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
543
598
|
Manage parallel (forked) worktrees for iterative development.
|
|
544
599
|
|
|
545
|
-
${
|
|
546
|
-
\`${
|
|
547
|
-
|
|
548
|
-
${
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
${
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
${
|
|
558
|
-
${
|
|
559
|
-
|
|
560
|
-
${
|
|
561
|
-
|
|
562
|
-
|
|
600
|
+
${Y+h("OVERVIEW",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
601
|
+
\`${Z}${k} parallel${Q}\` helps you create and manage temporary forked worktrees for the current branch. Forked worktrees live under a temp worktree root and contain a small metadata file (.git-parallel.json) so the tool can later join, list or remove them cleanly.
|
|
602
|
+
|
|
603
|
+
Additionally, \`${Z}${k} parallel fork${Q}\` can auto-initialize submodules and
|
|
604
|
+
install dependencies using detected package managers (currently supports npm, pnpm, bun, and uv)
|
|
605
|
+
if configured (see \`${Z}parallel.init${Q}\` config for options),
|
|
606
|
+
getting the fork ready for work in no time.
|
|
607
|
+
|
|
608
|
+
${Y+h("SUBCOMMANDS AND BEHAVIOR",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
609
|
+
- ${Z}fork <alias>${Q}: Creates a detached worktree in a safe temporary namespace. If pending changes exist and you run with \`${Z}--move${Q}\` or \`${Z}--mirror${Q}\`, changes will be moved/applied to the fork. Init behaviors are controlled by config and \`${Z}--no-init${Q}\`.
|
|
610
|
+
- ${Z}join [<alias>] [--keep|--all]${Q}: Cherry-picks commits from the fork back into the origin worktree. \`${Z}--keep${Q}\` retains the fork and updates its base; \`${Z}--all${Q}\` also includes uncommitted changes.
|
|
611
|
+
- ${Z}join -r|--recursive [--keep]${Q}: Joins every fork for the current branch back into origin. Recursive join does not allow \`${Z}--all${Q}\`.
|
|
612
|
+
- ${Z}list${Q}: Lists forks for the current branch with status (clean/dirty), commit divergence and optional path hyperlinks.
|
|
613
|
+
- ${Z}remove <alias>${Q}: Removes the forked worktree and cleans up the directory.
|
|
614
|
+
|
|
615
|
+
${Y+h("SAFETY AND NOTES",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
616
|
+
Joining cherry-picks commits into origin; conflicts will prompt for resolve/continue in a TTY or print manual steps in non-interactive shells. Removing a fork will also delete the worktree directory when forced.
|
|
617
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Manage temporary forked worktrees: create, list, join, open and remove.",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
618
|
+
${Y}${k} parallel fork ${Z}<alias> [--move|--mirror] [--no-init[=submodule,pkg]]${Q}
|
|
619
|
+
${Y}${k} parallel list${Q}
|
|
620
|
+
${Y}${k} parallel open ${Z}<alias|origin> [-c|--copy]${Q}
|
|
621
|
+
${Y}${k} parallel switch ${Z}<alias|origin> [-c|--copy]${Q}
|
|
622
|
+
${Y}${k} parallel join ${Z}<alias> [--keep|--all]${Q}
|
|
623
|
+
${Y}${k} parallel join ${Z}-r|--recursive [--keep]${Q}
|
|
624
|
+
${Y}${k} parallel remove ${Z}<alias>${Q}
|
|
563
625
|
|
|
564
626
|
Examples:
|
|
565
|
-
${
|
|
566
|
-
${
|
|
567
|
-
${
|
|
568
|
-
|
|
627
|
+
${Y}${k} parallel fork feature-x --move ${Q+Z}# Create fork and optionally move changes${Q}
|
|
628
|
+
${Y}${k} parallel fork feature-x --no-init ${Q+Z}# Skip all init behaviors${Q}
|
|
629
|
+
${Y}${k} parallel fork feature-x --no-init=pkg ${Q+Z}# Skip package installs only${Q}
|
|
630
|
+
${Y}${k} parallel list --short ${Q+Z}# Show forks for current branch${Q}
|
|
631
|
+
${Y}${k} parallel join feature-x --all ${Q+Z}# Merge fork back into origin${Q}
|
|
632
|
+
${Y}${k} parallel join -r ${Q+Z}# Merge all forks back into origin${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},kq={$root:{fork:["--move","--mirror","--no-init"],list:{},open:_O,switch:NO,join:wO,remove:OO,help:{}}}});async function SO(){let Y=await $0(),Z=xq(c6),Q=[],J="";O(U("Dim")+`# GDX Configuration
|
|
569
633
|
# read from ${Y.getConfigPath()}
|
|
570
634
|
# (api keys stored separately)
|
|
571
|
-
`+U());for(let{key:
|
|
572
|
-
`;if(G){let T=
|
|
573
|
-
`,T)
|
|
635
|
+
`+U());for(let{key:X}of Z){let z=X.split("."),G=z.slice(0,-1).join("."),H=z[z.length-1];if(!Q.includes(G)){if(Q.length>0)J+=`
|
|
636
|
+
`;if(G){let T=TQ[G];if(J+=`${U("Magenta")+U("Bright")}[${G}]${U()}
|
|
637
|
+
`,T)J+=`${U("Dim")}# ${T.split(`
|
|
574
638
|
`).join(`
|
|
575
639
|
# `)}${U()}
|
|
576
|
-
`}Q.push(G)}let
|
|
577
|
-
`:`${U("Cyan")+
|
|
578
|
-
`;if(Q[Q.length-1]==="")
|
|
579
|
-
`+
|
|
640
|
+
`}Q.push(G)}let W=Y.get(X);if(W===void 0&&tY.includes(X))W=await Y.getSecure(X);let K=Y.isDefault(X),$=TQ[X]||"",V="",q=!1;switch(typeof W){case"boolean":V=p(W,{color:!0});break;case"number":V=p(W,{color:!0});break;case"string":if(H.toLowerCase().includes("key"))V=p(L8(W,20,"mid",-1),{color:!0});else V=p(W,{color:!0});break;case"undefined":case"object":if(W==null)q=!0,V=p(null,{color:!0});break;default:V=String(W)}let M=K?"":` ${U()+U("Yellow")+U("Italic")}[Modified]${U()+U("Dim")}`,B=$?` ${U("Dim")}#${M} ${$}${U()}`:"",D=q?`${U("Dim")}# ${U("Cyan")+H+U("White")} = ${V}${B}${U()}
|
|
641
|
+
`:`${U("Cyan")+H+U()} = ${V}${B}
|
|
642
|
+
`;if(Q[Q.length-1]==="")J=D+`
|
|
643
|
+
`+J;else J+=D}return O(J,""),0}async function vO(Y){let Z=await $0(),Q=Y.args[1];if(!Q)return L.error("Missing configuration key","gdx-config"),1;let J=Z.get(Q);if(J===void 0&&tY.includes(Q))J=await Z.getSecure(Q);if(J===void 0)return L.warn(`Key '${Q}' is not set`,"gdx-config"),1;return O(String(J)),0}async function yO(Y){let Z=await $0(),Q=Y.args[1],J=Y.args[2];if(!Q||J===void 0)return L.error("Usage: gdx gdx-config <key> <value>","gdx-config"),1;let X=Z.get(Q),z=J;if(typeof X==="number"){let H=Number(J);if(isNaN(H))return L.error(`Expected a number for '${Q}', got '${J}'`,"gdx-config"),1;z=H}else if(typeof X==="boolean")z=J.toLowerCase()==="true";await Z.set(Q,z),await Z.save();let G=Q.toLowerCase().includes("key")?L8(String(z),20,"mid",-1):z;return O(`${U("Green")}Configuration updated: ${Q} = ${G}${U()}`),0}async function P9(Y){let Z=Y.args[1];if(Z==="list")return await SO();else if(Z==="path"){let Q=await $0();return O(Q.getConfigPath()),0}else if(Y.args.length===2)return await vO(Y);else if(Y.args.length===3)return await yO(Y);else return O(mY(`${U("Cyan")}Usage:${U()}
|
|
580
644
|
gdx gdx-config list - List all configuration
|
|
581
645
|
gdx gdx-config path - Show config file path
|
|
582
646
|
gdx gdx-config <key> - Get configuration value
|
|
583
|
-
gdx gdx-config <key> <value> - Set configuration value`)),0}var
|
|
584
|
-
${
|
|
647
|
+
gdx gdx-config <key> <value> - Set configuration value`)),0}function xq(Y,Z=""){let Q=[];for(let J in Y){let X=Z?`${Z}.${J}`:J,z=Y[J];if(z!==null&&typeof z==="object"&&!Array.isArray(z))Q.push(...xq(z,X));else Q.push({key:X,value:z})}return Q}var Aq,Pq;var h2=F(()=>{c7();Q0();XY();_Q();R0();K0();J0();O0();S0();Aq={long:()=>{let Y=U("Bright"),Z=U();return n(`
|
|
648
|
+
${Y+h("GDX-CONFIG",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
585
649
|
View and modify gdx configuration.
|
|
586
650
|
|
|
587
|
-
${
|
|
651
|
+
${Y+h("OVERVIEW",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
588
652
|
Manage gdx settings stored in the configuration file. The command supports listing all config values, getting the path to the currently loaded config file, and getting/setting individual keys. API keys and sensitive values are masked when displayed.
|
|
589
653
|
|
|
590
|
-
${
|
|
654
|
+
${Y+h("COMMANDS",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
591
655
|
- list: Prints flattened configuration with defaults and modified markers.
|
|
592
656
|
- path: Prints the path to the active config file used by gdx.
|
|
593
657
|
- <key> [value]: Get or set a config key. When setting, types are coerced based on the existing default value where possible.
|
|
594
|
-
`,Math.min(100,
|
|
595
|
-
${
|
|
596
|
-
${
|
|
597
|
-
${
|
|
658
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"View or modify gdx configuration settings.",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
659
|
+
${Y}${k} gdx-config list${Q}
|
|
660
|
+
${Y}${k} gdx-config path${Q}
|
|
661
|
+
${Y}${k} gdx-config ${Z}<key> [value]${Q}
|
|
598
662
|
|
|
599
663
|
Examples:
|
|
600
|
-
${
|
|
601
|
-
${
|
|
602
|
-
`);try{let
|
|
603
|
-
`),!
|
|
604
|
-
`);if(
|
|
605
|
-
|
|
606
|
-
`+
|
|
607
|
-
${
|
|
664
|
+
${Y}${k} gdx-config list ${Q+Z}# List all config keys and values${Q}
|
|
665
|
+
${Y}${k} gdx-config editor.code true ${Q+Z}# Set value for a key${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},Pq={$root:["list","path"]}});import fO from"path";import bO from"crypto";function Sq(Y){return bO.createHash("sha256").update(Y).digest("hex").slice(0,16)}async function hO(Y){O("");let Z=i6({message:"learning this repo's commit style...",animateGradient:!0});try{let J=(await x`${Y} log --no-merges -n 10 --format=%B%x00`).stdout.split("\x00").map((H)=>H.trim()).filter((H)=>H.length>0);if(J.length===0)return Z.stop(),{guideline:null,historyCount:0};let X=J.slice(0,Math.min(10,J.length)),G=await(await r4()).generate({prompt:Fq(X),temperature:0.2,reasoning:"medium"});return Z.stop(),{guideline:G.trim(),historyCount:X.length}}catch(Q){return Z.stop(),L.warn(`Failed to learn commit guidelines: ${p(Q)}`,"commit"),{guideline:null,historyCount:0}}}async function gO(Y,Z){let Q=await z0(),J=await TU(Y),X=await LU(Y),z=J.replace(/\\/g,"/"),G=Z.get("commit.guidelineCacheDays",30),H=G*24*60,W=X?Sq(`remote:${X}`):"",K=Sq(`path:${z}`),$=W?`commit.repoGuidelines.${W}`:"",V=`commit.repoGuidelines.${K}`;if($){let _=await Q.get($);if(_)return L.debug(`Using cached commit guidelines for remote ${X}`,"commit"),_}let q=await Q.get(V);if(q){if($)await Q.set($,q,{maxAgeMinutes:H}),L.debug(`Promoted commit guidelines cache to remote ${X}`,"commit");else L.debug(`Using cached commit guidelines for ${z}`,"commit");return q}let{guideline:M,historyCount:B}=await hO(Y);if(!M||B===0)return L.warn("No commit history found in this repository. Falling back to comprehensive format.","commit"),null;if(B<5)L.warn(`Only ${B} commit(s) found in history. The learned guidelines may be less accurate.`,"commit");let D=$||V;await Q.set(D,M,{maxAgeMinutes:H});let T=$?`remote ${X}`:z;return L.debug(`Cached commit guidelines for ${T} (${G} days)`,"commit"),M}async function mO(Y){let{git$:Z,args:Q}=Y,J=["auto","--no-commit","-nc","--copy","-cp"],X=Q.slice(1).filter(($)=>!J.includes($)),z=await $0(),G=z.get("llm.showThinking",!0),H=z.get("commit.commitPattern","inherit"),W=(await x`${Z} diff --cached HEAD`).stdout;if(!W||W.trim().length===0)return O(`${U("Red")}No staged changes found. Please stage your changes before generating a commit message.${U()}`),1;let K;if(H==="inherit"){let $=await gO(Z,z);if($)K=Bq(W,$);else K=C9(W)}else K=C9(W);O(`${U("Cyan")}Generating commit message based on staged changes...${U()}
|
|
666
|
+
`);try{let $=await r4(),V=i6({message:"connecting...",animateGradient:!1}),q=$.streamGenerate({prompt:K,temperature:0.14,reasoning:"low"}),M="",B=!1,D=!1,T="";for await(let I of q){if(I.error)return V.stop(),L.error(I.error.message,"commit"),1;if(I.thinkingChunk){if(!D){if(D=!0,V.options.animateGradient=!0,!G)V.options.message="reasoning..."}if(G)T=(T+I.thinkingChunk.replace(/[\n\r]/g,"")).slice(-32),V.options.message=`reasoning... ${T.trim()}`;continue}if(I.chunk){if(!B)B=!0,V.stop(),O(`${U("Cyan")}Generated Commit Message:${U()}`);O(I.chunk,""),M+=I.chunk}}if(O(`
|
|
667
|
+
`),!M)return L.error("Unable to generate commit message (empty response).","commit"),1;M=M.replace(/(^\s*["'`]*|["'`]*\s*$)/g,"");let _=M.indexOf(`
|
|
668
|
+
`);if(_!==-1){let I=M.slice(0,_),E=M.slice(_+1).trim();M=I+`
|
|
669
|
+
|
|
670
|
+
`+n(E,72,{mode:"softboundary",redundancyLv:-1})}if(Q.includes("--no-commit")||Q.includes("-nc")){if(Q.includes("--copy")||Q.includes("-cp"))if(await g7(M))O(`${U("Cyan")}(message has been copied to clipboard)${U()}`);else L.warn("(failed to copy to clipboard)","commit");return 0}let w=fO.join(kY,`gdx_commit_msg_${Date.now()}.txt`);return await rY(w,M,"utf8"),await W0`${Z} commit -F ${w} --edit ${X}`.catch(B1),await RX(w).catch(B1),0}catch($){return L.error(p($,{color:!0}),"commit"),1}}var vq,yq;var x9=F(()=>{g0();Q0();A0();R0();E9();K0();j9();J0();S0();O0();XY();W6();n6();vq={auto:mO},yq={long:()=>{let Y=U("Bright"),Z=U("Cyan"),Q=U();return n(`
|
|
671
|
+
${Y+h("COMMIT AUTO",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
608
672
|
Generate a commit message from staged changes using an LLM.
|
|
609
673
|
|
|
610
|
-
${
|
|
674
|
+
${Y+h("DESCRIPTION",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
611
675
|
Analyze the staged diff and ask the configured LLM provider to produce a well-formed commit message (title and body). The generated text is streamed for interactive feedback; you may choose to commit it automatically or inspect/copy it first.
|
|
612
676
|
|
|
613
|
-
${
|
|
614
|
-
Use ${
|
|
677
|
+
${Y+h("FLAGS AND BEHAVIOR",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
678
|
+
Use ${Z}--no-commit (-nc)${Q} to prevent creating the commit (message will be printed). Use ${Z}--copy (-cp)${Q} in combination with --no-commit to copy the message to the clipboard. The tool writes a temporary message file when performing an actual commit.
|
|
615
679
|
|
|
616
|
-
${
|
|
680
|
+
${Y+h("REQUIREMENTS",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
617
681
|
A non-empty staged diff is required; the command will error if there are no staged changes.
|
|
618
|
-
`,Math.min(100,
|
|
619
|
-
${
|
|
682
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Auto-generate a commit message from staged changes using an LLM.",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
683
|
+
${Y}${k} commit auto ${Z}[--no-commit] [--copy]${Q}
|
|
620
684
|
|
|
621
685
|
Examples:
|
|
622
|
-
${
|
|
623
|
-
${
|
|
624
|
-
${
|
|
625
|
-
`),
|
|
626
|
-
`);let
|
|
627
|
-
${
|
|
628
|
-
${
|
|
629
|
-
${U("Cyan")}(\`git clear pardon\` to undo)${U()}`),await
|
|
630
|
-
${
|
|
686
|
+
${Y}${k} commit auto ${Q+Z}# Generate and commit using LLM-generated message${Q}
|
|
687
|
+
${Y}${k} commit auto --no-commit ${Q+Z}# Print generated message without committing${Q}
|
|
688
|
+
${Y}${k} commit auto --no-commit --copy ${Q+Z}# Copy generated message to clipboard${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}}});import S9 from"path";async function v9(Y){let{git$:Z,args:Q}=Y,[J,X]=await Promise.all([x`${Z} rev-parse --abbrev-ref HEAD`.then((I)=>I.stdout.trim().replace(/\//g,"-")),t0(Z)]),z=S9.basename(X),G=kY,H=`${z}_${J}_backup_*.patch`,W=`${z}_${J}_backup_`,K=".patch";if(Q.includes("list")){O(`${U("Cyan")}Project:${U()} ${z}`),O(`${U("Cyan")}Branch:${U()} ${J}`),O(`${U("Cyan")}Backup location:${U()} ${G}`),O(`${U("Cyan")}Use \`git clear pardon\` to restore the latest backup.${U()}
|
|
689
|
+
`),O(`${U("Cyan")}Looking for backup patch files matching:${U()} ${H}
|
|
690
|
+
`);let I=await fq(G,W,".patch");if(I.length===0)return O(`${U("Yellow")}No backup patch files found for project '${z}' on branch '${J}'.${U()}`),0;let E=new Date;for(let v=0;v<I.length;v++){let S=I[v],g=(E.getTime()-S.stats.mtime.getTime())/zZ,d=S.stats.mtime.toISOString().replace("T"," ").split(".")[0],m=U("Dim");if(S.stats.mtime.toDateString()===E.toDateString())m=U("White");else if(g>=6)m=U("Red");O(`${m}backup@${v}: ${d} - ${S.name}${U()}`)}return 0}let $=await fq(G,W,".patch"),V=new Date;V.setDate(V.getDate()-7);for(let I of $)if(I.stats.mtime<V)try{Q5(I.path),$.splice($.indexOf(I),1)}catch(E){L.error(`Failed to delete old backup file: ${I.path}
|
|
691
|
+
${p(E,{color:!0})}`,"clear")}if(Q.includes("pardon")){if((await x`${Z} diff --cached --name-only`).stdout.length>0||(await x`${Z} diff --name-only`).stdout.length>0)return L.error("Working Directory is dirty, aborting pardon to prevent unintended data loss. Please clear your workspace first.","clear"),await W0`${Z} status`,1;if($.length===0)return L.error(`No backup patch file found for branch '${J}'. Pardon failed.`,"clear"),1;let v=$[0],S=new Date;if(S.setDate(S.getDate()-1),v.stats.mtime<S){if(L.warn("Latest backup patch file is older than 1 day. Do you want to proceed with the pardon? (y/n)","clear"),(await p1("Type 'y' to confirm: ")).toLowerCase()!=="y")return L.error("Pardon aborted.","clear"),1}try{await W0`${Z} apply ${v.path}`,Q5(v.path),O(`${U("Cyan")}Pardon applied successfully from backup: ${U("Bright")}${v.path}${U()}`),await W0`${Z} status`}catch(g){return L.error(`Failed to apply patch. Pardon aborted.
|
|
692
|
+
${p(g,{color:!0})}`,"clear"),1}return 0}let[q,M,B]=await Promise.all([x`${Z} diff --cached --name-only`.then((I)=>I.stdout.length>0),x`${Z} diff --name-only`.then((I)=>I.stdout.length>0),x`${Z} ls-files --others --exclude-standard`.then((I)=>I.stdout.length>0)]);if(!q&&!M&&!B)return O(`${U("Cyan")}No changes to clear. Working directory is clean.${U()}`),await W0`${Z} status`,0;let D=new Date().toISOString().replace(/[-:T.]/g,"").slice(0,14),T=`${z}_${J}_backup_${D}.patch`,_=S9.join(G,T);await W0`${Z} add -A`;let w=await x`${Z} diff --cached --binary`;return oY(_,w.stdout),O(`${U("Cyan")}Backup of all changes saved to: ${U("Bright")}${_}${U()}
|
|
693
|
+
${U("Cyan")}(\`git clear pardon\` to undo)${U()}`),await W0`${Z} reset --hard HEAD`,await W0`${Z} clean -fd`,await W0`${Z} status`,0}async function fq(Y,Z,Q){let X=sY(Y).filter((G)=>G.startsWith(Z)&&G.endsWith(Q));return(await Promise.all(X.map(async(G)=>{let H=S9.join(Y,G),W=await ZZ(H);return{name:G,path:H,stats:W}}))).sort((G,H)=>H.stats.mtime.getTime()-G.stats.mtime.getTime())}var bq,hq;var g2=F(()=>{g0();Q0();A0();R0();J0();K0();J0();S0();O0();RY();bq={long:()=>{let Y=U("Bright"),Z=U("Cyan"),Q=U();return n(`
|
|
694
|
+
${Y+h("CLEAR",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
631
695
|
Safely backup and clear local working changes.
|
|
632
696
|
|
|
633
|
-
${
|
|
634
|
-
Creates a patch file containing the current unstaged, staged, and untracked changes, stores it in the OS temporary directory and then resets the working tree to a clean HEAD via
|
|
697
|
+
${Y+h("DESCRIPTION",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
698
|
+
Creates a patch file containing the current unstaged, staged, and untracked changes, stores it in the OS temporary directory and then resets the working tree to a clean HEAD via \`${Z}git reset --hard${Q}\` and \`${Z}git clean -fd${Q}\`. The latest patch is kept so you can restore it with \`${Z}${k} clear pardon${Q}\`.
|
|
635
699
|
|
|
636
|
-
${
|
|
700
|
+
${Y+h("SUBCOMMANDS",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
637
701
|
- list: Show available backup patch files for this project/branch.
|
|
638
702
|
- pardon: Restore the most recent backup patch.
|
|
639
703
|
|
|
640
|
-
${
|
|
704
|
+
${Y+h("SAFETY",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
641
705
|
All files (tracked and untracked) are backed up before clearing. Pardon requires a clean working directory.
|
|
642
|
-
`,Math.min(100,
|
|
643
|
-
${
|
|
706
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Backup and clear local changes, with a restore (pardon) option.",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
707
|
+
${Y}${k} clear ${Z}[list|pardon]${Q}
|
|
708
|
+
|
|
709
|
+
Examples:
|
|
710
|
+
${Y}${k} clear ${Q+Z}# Create backup patch and clear working tree${Q}
|
|
711
|
+
${Y}${k} clear list ${Q+Z}# Show recent backup patches${Q}
|
|
712
|
+
${Y}${k} clear pardon ${Q+Z}# Restore the latest backup patch${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},hq={$root:["list","pardon"]}});import uO from"path";async function y9(Y){switch(Y.args[1]){case"list":return await pO();case"prune":return await dO();case"reset":return await cO();case"delete":return await lO(Y.args.slice(2));case"disable":return await gq(!1);case"enable":return await gq(!0);default:return O(b9.usage()),0}}async function dO(){let Y=null;try{Y=await f9()}catch(X){return L.error(p(X,{color:!0}),"cache"),1}if(!Y)return O(`${U("Yellow")}No cache file found. Nothing to prune.${U()}`),0;let Z=Date.now(),Q=Object.entries(Y.entryMeta).filter(([,X])=>Z>X.expiresAt).map(([X])=>X),J=0;for(let X of Q)if(iO(Y,X))J++;if(Y.meta.lastPruneAt=Z,J>0)Y.meta.updatedAt=Z;if(await mq(Y),b7(),J>0)O(`${U("Green")}Pruned ${J} expired cache entries.${U()}`);else O(`${U("Cyan")}No expired cache entries found.${U()}`);return 0}async function pO(){let Y=null;try{Y=await f9()}catch(Q){return L.error(p(Q,{color:!0}),"cache"),1}if(!Y)return O(`${U("Yellow")}No cache file found. Nothing to list.${U()}`),0;let Z=Object.keys(Y.entryMeta).sort((Q,J)=>{let X=Y.entryMeta[Q],z=Y.entryMeta[J];return(X?.expiresAt??0)-(z?.expiresAt??0)||Q.localeCompare(J)});if(Z.length===0)return O(`${U("Yellow")}No cache keys found.${U()}`),0;O(`${U("Cyan")}Cache:${U()} ${o0} ${U("Dim")}(${Z.length} keys)${U()}
|
|
713
|
+
`);for(let Q of Z){let J=Y.entryMeta[Q];if(!J)continue;let X=J.expiresAt-Date.now(),z=X<=0?"expired":HX.getTimeFromMS(X).modern(),G=U("Green");if(X<43200000)G=U("Yellow");if(X<3600000)G=U("Red");let H=nO(Y.data,Q),W=aO(H);O(`${U("Cyan")}${j6(Q,24,{align:"left",redundancyLv:-1,overflow:"collapse"})}${U()} ttl=${G}${j6(z,12,{align:"left",redundancyLv:-1,overflow:"visible"})}${U()} ${U("Dim")}preview=${W}${U()}`)}return 0}async function cO(){try{let Y=t(o0);if(await FX(o0,{force:!0,recursive:!0}),b7(),!Y)return O(`${U("Yellow")}No cache file found. Nothing to delete.${U()}`),0;let Z=t(o0)?`${U("Yellow")}Cache file not removed: ${o0}${U()}`:`${U("Green")}Cache file deleted: ${o0}${U()}`;return O(Z),0}catch(Y){return L.error(p(Y,{color:!0}),"cache"),1}}async function lO(Y){if(Y.length===0)return L.error("Usage: gdx cache delete <key|prefix> [more...]","cache"),1;let Z=null;try{Z=await f9()}catch(G){return L.error(p(G,{color:!0}),"cache"),1}if(!Z)return O(`${U("Yellow")}No cache file found. Nothing to delete.${U()}`),0;let Q=Object.keys(Z.entryMeta),J=new Set;for(let G of Y){let H=G.trim();if(!H)continue;let W=H.endsWith(".")?H.slice(0,-1):H,K=W.length>0?`${W}.`:"";for(let $ of Q)if($===W||K&&$.startsWith(K))J.add($)}if(J.size===0)return O(`${U("Yellow")}No matching cache keys found.${U()}`),0;let X=Date.now(),z=0;for(let G of J){let H=Z.entryMeta[G];if(!H)continue;H.expiresAt=X-1,H.updatedAt=X,z++}if(z>0)return Z.meta.updatedAt=X,await mq(Z),b7(),O(`${U("Green")}Marked ${z} cache entries as expired.${U()}`),0;return O(`${U("Yellow")}No matching cache keys found.${U()}`),0}async function gq(Y){let Z=await $0();await Z.set("cache.enabled",Y),await Z.save();let Q=Y?"enabled":"disabled";return O(`${U("Green")}Cache ${Q}.${U()}`),0}async function f9(){try{let Y=await KY(o0,"utf-8"),Z=JSON.parse(Y);if(!Z||!Z.meta||!Z.data||!Z.entryMeta)throw new s("Cache file is invalid or corrupted. Run `gdx cache reset`.","CACHE_INVALID");if(Z.meta.version!==YY)throw new s(`Cache version mismatch (found ${Z.meta.version}, expected ${YY}). Run gdx cache reset.`,"CACHE_VERSION_MISMATCH");if(!Z.meta.lastPruneAt)Z.meta.lastPruneAt=Z.meta.updatedAt||Date.now();return Z}catch(Y){if(s.from(Y).code==="ENOENT")return null;throw Y}}async function mq(Y){let Z=uO.dirname(o0);WY(Z,{recursive:!0}),await rY(o0,JSON.stringify(Y),"utf-8")}function iO(Y,Z){if(!Y.entryMeta[Z])return!1;delete Y.entryMeta[Z];let Q=Z.split("."),J=[],X=Y.data;for(let z of Q)if(X&&typeof X==="object"&&z in X)J.push({obj:X,key:z}),X=X[z];else return!1;if(J.length>0){let z=J[J.length-1];delete z.obj[z.key]}for(let z=J.length-2;z>=0;z--){let{obj:G,key:H}=J[z],W=G[H];if(W&&typeof W==="object"&&Object.keys(W).length===0)delete G[H];else break}return!0}function nO(Y,Z){let Q=Z.split("."),J=Y;for(let X of Q)if(J&&typeof J==="object"&&X in J)J=J[X];else return;return J}function aO(Y){if(typeof Y==="string")return`'${q1(Y.replace(/\s+/g," "),60,"mid",-1)}'`;if(typeof Y==="number"||typeof Y==="boolean"||Y==null)return String(Y);if(Array.isArray(Y)){let Z=q1(p(Y,{color:!1}),60,"mid",-1);return`[${Y.length}] ${Z}`}if(typeof Y==="object")return`{...} ${q1(p(Y,{color:!1}),60,"mid",-1)}`;return q1(String(Y),60,"mid",-1)}var b9,uq;var m2=F(()=>{Q0();W6();XY();J0();O0();S0();g0();K0();R0();b9={long:()=>{let Y=U("Bright"),Z=U();return n(`
|
|
714
|
+
${Y+h("CACHE",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
715
|
+
Manually manage gdx cache entries and settings.
|
|
716
|
+
|
|
717
|
+
${Y+h("COMMANDS",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
718
|
+
- list: Show cache keys, TTL, and a short value preview.
|
|
719
|
+
- prune: Remove expired entries from the cache file.
|
|
720
|
+
- reset: Delete the entire cache file.
|
|
721
|
+
- delete: Mark cache entries as expired by key or prefix.
|
|
722
|
+
- enable/disable: Toggle cache.enabled in gdx config.
|
|
723
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Manually manage gdx cache entries and settings.",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
724
|
+
${Y}${k} cache prune${Q}
|
|
725
|
+
${Y}${k} cache reset${Q}
|
|
726
|
+
${Y}${k} cache list${Q}
|
|
727
|
+
${Y}${k} cache delete ${Z}<key|prefix> [more...]${Q}
|
|
728
|
+
${Y}${k} cache enable${Q}
|
|
729
|
+
${Y}${k} cache disable${Q}
|
|
644
730
|
|
|
645
731
|
Examples:
|
|
646
|
-
${
|
|
647
|
-
${
|
|
648
|
-
${
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
732
|
+
${Y}${k} cache list ${Q+Z}# List cached keys with TTL${Q}
|
|
733
|
+
${Y}${k} cache prune ${Q+Z}# Remove expired cache entries${Q}
|
|
734
|
+
${Y}${k} cache reset ${Q+Z}# Delete cache file entirely${Q}
|
|
735
|
+
${Y}${k} cache delete git git.config ${Q+Z}# Expire by key/prefix${Q}
|
|
736
|
+
${Y}${k} cache disable ${Q+Z}# Turn caching off${Q}
|
|
737
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},uq={$root:["list","prune","reset","delete","enable","disable"]}});var lq={};r2(lq,{spellCheckDocument:()=>oO,prettyFormatIssues:()=>rO,getBundledDictionaryNames:()=>sO});async function cq(){return dq??=import("cspell-lib"),await dq}async function oO(...Y){return await(await cq()).spellCheckDocument(...Y)}async function sO(){return pq??=(async()=>{let Z=await(await cq()).getDefaultBundledSettingsAsync(),Q=new Set,J=[],X=(z)=>{if(!z||Q.has(z))return;Q.add(z),J.push(z)};return Z.dictionaryDefinitions?.forEach((z)=>X(z.name)),Z.dictionaries?.forEach((z)=>X(z)),J})(),pq}function rO(Y,Z){if(Y.issues.length===0)return U("Green")+"✓ No spelling issues found!"+U();let Q=U("Yellow")+`✗ Found ${Y.issues.length} spelling issue${Y.issues.length===1?"":"s"}:
|
|
738
|
+
`+U();Q+=U("Dim")+"─".repeat(60)+`
|
|
739
|
+
|
|
740
|
+
`+U();let J=U("Cyan"),X=U("Magenta"),z=U("Red")+U("Bright"),G=U("Dim"),H=U("Underline");return Y.issues.forEach((W,K)=>{let $=Z.substring(0,W.line.offset),V=$.length-$.replace(/\n/g,"").length,q=W.offset-W.line.offset;Q+=`${G}${K+1}.${U()} ${J}Line ${V+1}${U()}, ${X}Col ${q+1}${U()}: ${z}"${W.text}"${U()}
|
|
741
|
+
`;let M=W.line.text;if(M){let B=W.offset-W.line.offset,D=M.substring(0,B),T=M.substring(B+W.text.length);Q+=` ${D}${z+H}${W.text}${U()}${T}
|
|
742
|
+
`}if(W.suggestions?.length){let B=W.suggestions.slice(0,5).join(", ");Q+=` ${J}Suggestions:${U()} ${B}
|
|
743
|
+
`}if(K<Y.issues.length-1)Q+=`
|
|
744
|
+
`}),Q+=G+"─".repeat(60)+U()+`
|
|
745
|
+
`,Q}var dq=null,pq=null;var iq=F(()=>{Q0()});async function h9(Y){let Q=h7().$,{git$:J}=Y;if(!await u7(J))return 1;let{spellCheckDocument:X,prettyFormatIssues:z,getBundledDictionaryNames:G}=await Promise.resolve().then(() => (iq(),lq)),W=(await $0()).get("lint.maxFileSizeKb")||1024,K="";try{let{stdout:T}=await Q`${J} rev-parse --abbrev-ref --symbolic-full-name @{u}`;K=T.trim()}catch{}let $="";if(K)$=`${K}..HEAD`;else L.warn("No upstream configured. Checking last commit only.","lint"),$="HEAD^..HEAD";let V=0,q=0,[M,B,D]=await Promise.all([Q`${J} log --pretty=format:"%s\n%b$$\$___SEP___\$$$" ${$}`.then((T)=>T.stdout).catch(()=>""),Q`${J} diff ${$}`.then((T)=>T.stdout).catch(()=>""),Q`${J} diff --name-only ${$}`.then((T)=>T.stdout).catch(()=>"")]);if(M){let T=await G(),_=M.split("$$$___SEP___$$$").filter((w)=>w.trim());for(let[w,I]of _.entries()){let E=await X({uri:"commit-message",text:I,languageId:"plaintext",locale:"en"},{generateSuggestions:!0,noConfigSearch:!0,unknownWords:"report-common-typos"},{dictionaries:T});if(E.issues.length===0)continue;q+=E.issues.length,nq("Spelling",`At HEAD~${w} found ${E.issues.length} potential spelling issue(s) in commit messages.
|
|
746
|
+
|
|
747
|
+
`+z(E,I))}}if(B){let T="",_=B.split(/^diff --git a\/.+$/m);for(let w of _){let I=w.split(`
|
|
748
|
+
`).filter((E)=>E.trim());if(T=I.slice(2,4).find((E)=>E.startsWith("+++ b/"))?.split(" b/")[1]||"unknown",/\n?\+?<{7}(?:[^\n]*\n)*\+?={7}(?:[^\n]*\n)*\+?>{7}/.test(B))aq("Conflict Markers",`File: ${T}
|
|
749
|
+
Please resolve merge conflict markers.`),V++;for(let E=3;E<I.length;E++){let v=I[E];if(v.startsWith("+")){let S=v.substring(1);for(let g of IX)if(g.test(S))aq("Sensitive Content",`File: ${T}
|
|
750
|
+
Matched Pattern: ${g}
|
|
751
|
+
Content: ${S}`),V++}}}}if(D){let _=D.split(`
|
|
752
|
+
`).filter((I)=>I.trim()).map(async(I)=>{try{let{stdout:E}=await Q`${J} cat-file -s HEAD:${I}`,v=parseInt(E.trim(),10);return{file:I,sizeBytes:v}}catch{return null}}),w=await Promise.all(_);for(let I of w){if(!I)continue;let{file:E,sizeBytes:v}=I;if(v/1024>W)nq("Size",`File: ${E}
|
|
753
|
+
File size ${jY(v)}B exceeds limit of ${W}KB`),q++}}if(V>0)return L.error(`Lint failed with ${V} errors and ${q} warnings.`,"lint"),1;else if(q>0)return O(U("Yellow")+`
|
|
754
|
+
Lint passed with ${q} warnings.`+U()),0;else return O(U("Green")+`
|
|
755
|
+
No problems found.`+U()),0}function nq(Y,Z){Z=n(Z,100,{indent:" "}),O(U("BgYellow")+U("Bright")+U("White")+" LWARN "+U()+U("Invert")+` ${Y} ${U()+U("Yellow")} ${Z}`+U())}function aq(Y,Z){Z=n(Z,100,{indent:" "}),O(U("BgRed")+U("Bright")+U("White")+" LERROR "+U()+U("Invert")+` ${Y} ${U()+U("Red")} ${Z}`+U())}var oq,sq;var u2=F(()=>{Q0();A0();R0();XY();n6();J0();K0();O0();S0();oq={long:()=>{let Y=U("Bright"),Z=U("Cyan"),Q=U();return n(`
|
|
756
|
+
${Y+h("LINT",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
660
757
|
Runs a set of linting checks on your outgoing commits (or the last commit if no upstream is configured).
|
|
661
758
|
|
|
662
|
-
${
|
|
759
|
+
${Y+h("CHECKS PERFORMED",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
663
760
|
- Spelling: Checks for typos in commit messages using cspell.
|
|
664
761
|
- Sensitive Content: Scans for API keys, tokens, and private keys.
|
|
665
762
|
- Conflict Markers: Checks for leftover merge conflict markers.
|
|
666
763
|
- File Size: Warns if files exceed the configured size limit (default 1MB).
|
|
667
764
|
|
|
668
|
-
${
|
|
669
|
-
You can configure the behavior in your
|
|
765
|
+
${Y+h("CONFIGURATION",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
766
|
+
You can configure the behavior in your ~/.gdx/.gdxrc.toml file or \`${Z}${k} gdx-config${Q}\`:
|
|
670
767
|
[lint]
|
|
671
768
|
onPushBehavior = "off" | "error" | "warning" # Default: "off"
|
|
672
769
|
maxFileSizeKb = 1024 # Default: 1024 KB
|
|
673
|
-
`,Math.min(100,
|
|
674
|
-
${
|
|
770
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Lint outgoing commits for format, spelling, sensitive data, and more.",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
771
|
+
${Y}${k} lint${Q}
|
|
772
|
+
|
|
773
|
+
Examples:
|
|
774
|
+
${Y}${k} lint ${Q+Z}# Run lint checks on outgoing commits${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},sq={$root:[]}});import g9 from"path";async function tO(Y){try{let Q=(await x`${Y} config --file .gitmodules --get-regexp path`).stdout.trim();if(!Q)return[];let J=Q.split(`
|
|
775
|
+
`),X=[];for(let z of J){if(!z.trim())continue;let G=z.match(/^submodule\.(.+?)\.path\s+(.+)$/);if(G){let H=G[2];X.push({path:H,status:" "})}}return X}catch{return[]}}async function eO(Y,Z,Q){try{return(await x`${Y} -C ${Z} status ${Q}`).stdout}catch(J){let X=s.from(J);return L.warn(`Failed to get status for submodule ${Z}.
|
|
776
|
+
Error: ${X.message}`,"status"),L.debug(`Failed to get status for submodule ${Z}.
|
|
777
|
+
${X.toString({color:!0})}`,"status"),""}}async function m9(Y){let{git$:Z,args:Q}=Y;if(!(Q.includes("-r")||Q.includes("--recursive")))return await W0`${Z} status ${Q.slice(1)}`.then((z)=>z.exitCode??0);let X=Q.slice(1).filter((z)=>z!=="-r"&&z!=="--recursive");try{let z=await t0(Z),G=process.cwd();O(`${U("Cyan")}${U("Bright")}━━━ Repository Root${U()}${U("Dim")} (${g9.relative(G,z)||"."})${U()}
|
|
778
|
+
`),await W0`${Z} status ${X}`;let H=await tO(Z);if(H.length===0)return O(`
|
|
779
|
+
${U("Dim")}No submodules found.${U()}`),0;for(let W of H){let K=g9.resolve(z,W.path),$=g9.relative(G,K);O(`
|
|
780
|
+
${U("Cyan")}${U("Bright")}━━━ Submodule: ${W.path}${U()}${U("Dim")} (${$})${U()}
|
|
781
|
+
`);let V=await eO(Z,K,X);if(V)O(V);else O(`${U("Dim")}Unable to get status for this submodule.${U()}
|
|
782
|
+
`)}return 0}catch(z){return L.error(`Failed to get recursive status.
|
|
783
|
+
${z}`,"status"),1}}var rq,tq;var d2=F(()=>{Q0();A0();R0();J0();S0();K0();O0();RY();rq={long:()=>{let Y=U("Bright"),Z=U("Cyan"),Q=U();return n(`
|
|
784
|
+
${Y+h("STATUS",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
785
|
+
Show the working tree status for the repository and optionally all submodules.
|
|
786
|
+
|
|
787
|
+
${Y+h("OVERVIEW",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
788
|
+
\`${Z}${k} status${Q}\` is a wrapper around \`${Z}git status${Q}\` with added support for recursive submodule status checking. When the \`${Z}--recursive${Q}\` or \`${Z}-r${Q}\` flag is used, it will show the status of the main repository followed by the status of each submodule.
|
|
789
|
+
|
|
790
|
+
${Y+h("RECURSIVE MODE",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
791
|
+
When \`${Z}--recursive${Q}\` or \`${Z}-r${Q}\` is specified:
|
|
792
|
+
- Shows status of the main repository first
|
|
793
|
+
- Then shows status for each submodule with clear headers
|
|
794
|
+
- Displays both absolute submodule paths and paths relative to your current directory
|
|
795
|
+
- All other \`${Z}git status${Q}\` flags are passed through to each status check
|
|
796
|
+
|
|
797
|
+
${Y+h("EXAMPLES",j.Zinc400,j.Zinc100,0.2)+Q}
|
|
798
|
+
${Z}${k} status --recursive${Q}
|
|
799
|
+
Show status for repository and all submodules
|
|
800
|
+
|
|
801
|
+
${Z}${k} s -r${Q}
|
|
802
|
+
Same as above using shorthand
|
|
803
|
+
|
|
804
|
+
${Z}${k} status -r --short${Q}
|
|
805
|
+
Show short format status recursively
|
|
806
|
+
|
|
807
|
+
${Z}${k} status --recursive --porcelain${Q}
|
|
808
|
+
Show porcelain format status recursively
|
|
809
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Show working tree status with optional recursive submodule support",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
810
|
+
${Y}${k} status ${Z}[--recursive|-r] [<git-status-options>]${Q}
|
|
811
|
+
${Y}${k} s ${Z}[--recursive|-r] [<git-status-options>]${Q}
|
|
675
812
|
|
|
676
813
|
Examples:
|
|
677
|
-
${
|
|
814
|
+
${Y}${k} status --recursive ${Q+Z}# Show status for repo and all submodules${Q}
|
|
815
|
+
${Y}${k} s -r --short ${Q+Z}# Short format with submodules${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},tq={$root:{$allOf:["-r","--recursive","--short","--porcelain","--branch","--long"]}}});import u9 from"fs";import B8 from"path";async function d9(){let Y,Z=!1,Q=process.argv[0].endsWith("node")||process.argv[0].endsWith("node.exe"),J=process.argv[0].endsWith("bun")||process.argv[0].endsWith("bun.exe"),X=process.execPath.toLowerCase()!==process.argv[0].toLowerCase();if(!X){let W=process.argv[1],K=B8.dirname(W),$=[B8.join(K,"native/install.json"),B8.join(K,"../dist/native/install.json"),B8.join(K,"../native/install.json")];for(let V of $)if(u9.existsSync(V)){Y=V;break}if(!Y)Y=B8.join(K,"native/install.json")}else Y=B8.join(B8.dirname(process.execPath),"install.json");let z=null;if(u9.existsSync(Y))try{let W=JSON.parse(u9.readFileSync(Y,"utf8"));z=p(W,{color:!0})}catch(W){let K=s.from(W);L.error(`Error reading install.json: ${K.message}`,"doctor"),L.debug(K.toString(),"doctor"),Z=!0}else if(X)L.warn(`No native install info found at ${Y}`,"doctor"),Z=!0;O(`Version: ${U("Cyan")+YY+U()}`),O(`Platform: ${U("Magenta")+process.platform+U()}`),O(`Arch: ${U("Magenta")+process.arch+U()}`),O(`Runtime: ${U("Magenta")+(J?"Bun":Q?"Node":"Unknown")+(X?" (Native)":"")+U()}`);try{let W=await bY("bun",["--version"]);O(`Bun: ${U("Cyan")+W.stdout.trim()+U()}`)}catch{O("Bun: Not found")}try{let W=await bY("node",["--version"]);O(`Node: ${U("Cyan")+W.stdout.trim()+U()}`)}catch{O("Node: Not found")}O(`Installation mode: ${X?U("Green")+"Native"+U():U("Yellow")+"Interpreted"+U()}`),O(`Executable path: ${U("Cyan")+process.execPath+U()}`),O(`Log file path: ${U("Cyan")+C6(L.logFile,L.logFile)+U()}`);let G=await z0();O(`Cache file path: ${U("Cyan")+C6(G.cachePath,G.cachePath)+U()}`);try{let W=await bY("git",["--version"]);O(`Git: ${U("Cyan")+W.stdout.trim()+U()}`);let K=process.platform==="win32"?"where":"which",V=(await bY(K,["git"])).stdout.trim().replaceAll(`
|
|
816
|
+
`,`
|
|
817
|
+
- `);O(`Git path: ${V?U("Green")+`
|
|
818
|
+
- `+V+U():"Not found in PATH"}`)}catch{O(U("Red")+"Git: Not found or error checking"+U()),Z=!0}let H=WX(process.env,(W)=>W.startsWith("GDX_")?null:void 0);if(O("Process argv: "+JX(process.argv,{color:!0,indent:2,maxCol:80})),O("GDX Environment Variables: "+p(H,{color:!0})),z)O(`
|
|
819
|
+
Native Install Info: ${U("Green")+z+U()}`);else{if(O(U("Bright")+`
|
|
820
|
+
Actionable next steps:`+U()),process.platform==="win32"&&process.arch==="x64")O("To use prebuilt binary:"),O(" GDX_USE_PREBUILT=1 npm i -g gdx");else O(`Prebuilt binary not supported for ${process.platform}/${process.arch}.`);O("To build locally (requires Bun):"),O(" GDX_BUILD_NATIVE=1 npm i -g gdx")}return Z?1:0}var eq,YB;var p2=F(()=>{h1();Q0();R0();K0();J0();O0();J0();S0();W6();eq={long:()=>{let Y=U("Bright"),Z=U();return n(`
|
|
821
|
+
${Y+h("DOCTOR",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
822
|
+
Diagnose installation and environment.
|
|
823
|
+
|
|
824
|
+
${Y+h("DESCRIPTION",j.Zinc400,j.Zinc100,0.2)+Z}
|
|
825
|
+
Checks for native binary, runtimes, and provides installation guidance.
|
|
826
|
+
`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})},short:"Run a diagnostic check on gdx installation and environment.",usage:()=>{let Y=U("Cyan"),Z=U("Dim"),Q=U();return n(`
|
|
827
|
+
${Y}${k} doctor${Q}
|
|
828
|
+
|
|
829
|
+
Examples:
|
|
830
|
+
${Y}${k} doctor ${Q+Z}# Diagnose installation and environment${Q}`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})}},YB={$root:[]}});function c2(Y){let Z=U("Cyan"),Q=U("Yellow"),J=U("Bright"),X=U("Dim"),z=U("Reset"),G={cache:b9,stash:xU,stats:pU,graph:mU,nocap:Mq,parallel:v2,"gdx-config":Aq,commit:yq,clear:bq,lint:oq,status:rq,doctor:eq};if(!Y)return O(n(`
|
|
678
831
|
──────────────────────────────
|
|
679
|
-
${
|
|
680
|
-
Version: ${Z+
|
|
832
|
+
${J+h("GDX (Git Developer eXperience)",j.OceanDeepBlue,j.OceanGreen,0.32,1)+z}
|
|
833
|
+
Version: ${Z+YY+z}
|
|
681
834
|
──────────────────────────────
|
|
682
835
|
|
|
683
836
|
Git, but with better DX. The raw power of Git,
|
|
684
837
|
aligned with human workflows.
|
|
685
838
|
|
|
686
|
-
${
|
|
687
|
-
${
|
|
839
|
+
${J+h("DESCRIPTION",j.Zinc400,j.Zinc100,0.2)+z}
|
|
840
|
+
${k} (wrapper) — shorthand-friendly wrapper for git (executable) with common shortcuts,
|
|
688
841
|
stash-range support, and convenience expansions.
|
|
689
842
|
It forwards unrecognized commands/args to git (executable) unchanged.
|
|
690
843
|
|
|
691
|
-
${
|
|
692
|
-
${
|
|
844
|
+
${J+h("SYNOPSIS",j.Zinc400,j.Zinc100,0.2)+z}
|
|
845
|
+
${k} <command> [<args>]
|
|
693
846
|
Examples:
|
|
694
|
-
${Z}${
|
|
695
|
-
${Z}${
|
|
696
|
-
${Z}${
|
|
697
|
-
${Z}${
|
|
698
|
-
${Z}${
|
|
847
|
+
${Z}${k} st ${z+X}# shorthand for ${k} stash${z}
|
|
848
|
+
${Z}${k} lg ${z+X}# shorthand for ${k} log --oneline --graph --all --decorate${z}
|
|
849
|
+
${Z}${k} stash d 2..6 ${z+X}# drop stashes 2 through 6 (safe: drops high->low)${z}
|
|
850
|
+
${Z}${k} clear ${z+X}# backup changes to a temp patch file and reset working directory (use \`${Z}${k} clear pardon${z}\` to restore)${z}
|
|
851
|
+
${Z}${k} cmi auto ${z+X}# generate commit message based on staged changes using LLM${z}
|
|
699
852
|
|
|
700
|
-
${
|
|
853
|
+
${J+h("KEY FEATURES",j.Zinc400,j.Zinc100,0.2)+z}
|
|
701
854
|
- Many short aliases for common commands (commit, branch, checkout, etc.).
|
|
702
855
|
- Smart expansions:
|
|
703
|
-
- log: ${Z}${
|
|
704
|
-
- log export: ${Z}${
|
|
705
|
-
export (adds --author if missing).${
|
|
706
|
-
- pull: ${Z}${
|
|
707
|
-
- push: ${Z}${
|
|
708
|
-
- reset: ${Z}${
|
|
856
|
+
- log: ${Z}${k} lg ${z+X}-> ${z+Z}${k} log --oneline --graph --all --decorate${z}
|
|
857
|
+
- log export: ${Z}${k} lg export [extra args] ${z+X}creates a nicely formatted
|
|
858
|
+
export (adds --author if missing).${z}
|
|
859
|
+
- pull: ${Z}${k} pl -au ${z+X}-> expands -au to --allow-unrelated-histories.${z}
|
|
860
|
+
- push: ${Z}${k} ps -fl ${z+X}-> expands -fl to --force-with-lease.${z}
|
|
861
|
+
- reset: ${Z}${k} res -h ${z+X}-> ${z+Z}${k} reset --hard${z+X}; ${z+Z}${k} res ~3 ${z+X}-> ${z+Z}${k} reset HEAD~3${z}
|
|
709
862
|
- Clear convenience:
|
|
710
|
-
- ${Z}${
|
|
863
|
+
- ${Z}${k} clear ${z+X}->${z} creates a timestamped patch backup
|
|
711
864
|
in the system temp folder, then resets the working directory
|
|
712
|
-
(${Z}${
|
|
713
|
-
- Use \`${
|
|
714
|
-
and restore changes. Add
|
|
865
|
+
(${Z}${k} reset --hard ${z+X}+ ${z+Z}${k} clean -fd${z}).
|
|
866
|
+
- Use \`${Z}${k} clear pardon${z}\` to apply the latest backup patch
|
|
867
|
+
and restore changes. Add \`${Z}-f${z}\`/\`${Z}--force${z}\` to bypass dirty-working-directory prompts.
|
|
715
868
|
- Stash convenience:
|
|
716
|
-
- Short forms: ${Z}${
|
|
717
|
-
- ${Z}${
|
|
869
|
+
- Short forms: ${Z}${k} sta / ${k} st${z} for stash; ${Z}${k} sta l${z} -> stash list.
|
|
870
|
+
- ${Z}${k} stash d 2..6${z} — drops stash@{6}..stash@{2} (drops high→low to
|
|
718
871
|
avoid index shift).
|
|
719
872
|
- Supports apply, pop, drop, list, show, clear via short forms.
|
|
720
873
|
- Quick worktrees:
|
|
721
|
-
- ${Z}${
|
|
722
|
-
|
|
723
|
-
${
|
|
724
|
-
${Z}ad ${
|
|
725
|
-
${Z}bra, br ${
|
|
726
|
-
${Z}clear ${
|
|
727
|
-
${Z}cl, clo ${
|
|
728
|
-
${Z}com, comm, cmi ${
|
|
729
|
-
${Z}che, checko, co ${
|
|
730
|
-
${Z}dif ${
|
|
731
|
-
${Z}lg, lo ${
|
|
732
|
-
${Z}pl, pul ${
|
|
733
|
-
${Z}ps, pus ${
|
|
734
|
-
${Z}rb, rebas ${
|
|
735
|
-
${Z}res, rese ${
|
|
736
|
-
${Z}rv, rever ${
|
|
737
|
-
${Z}mg, merg ${
|
|
738
|
-
${Z}in, ini ${
|
|
739
|
-
${Z}sta, st ${
|
|
740
|
-
${Z}s, stat ${
|
|
741
|
-
${Z}swit, sw ${
|
|
742
|
-
|
|
743
|
-
${
|
|
744
|
-
${Z}
|
|
745
|
-
|
|
746
|
-
${
|
|
747
|
-
${Z}
|
|
748
|
-
${Z}
|
|
749
|
-
${Z}
|
|
750
|
-
${Z}
|
|
751
|
-
${Z}
|
|
752
|
-
|
|
753
|
-
${Q
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
${
|
|
761
|
-
${Z}${I} lg export --author="me@example.com"${J}
|
|
874
|
+
- ${Z}${k} parallel fork/remove/join/switch/open/list${z} for temp-backed worktree workflows.
|
|
875
|
+
|
|
876
|
+
${J+h("SHORTHAND LIST (common)",j.Zinc400,j.Zinc100,0.2)+z}
|
|
877
|
+
${Z}ad ${z+X}-> ${z}add
|
|
878
|
+
${Z}bra, br ${z+X}-> ${z}branch
|
|
879
|
+
${Z}clear ${z+X}-> ${z}clear (backup changes and reset working directory; use \`${Z}pardon${z}\` to restore)
|
|
880
|
+
${Z}cl, clo ${z+X}-> ${z}clone
|
|
881
|
+
${Z}com, comm, cmi ${z+X}-> ${z}commit
|
|
882
|
+
${Z}che, checko, co ${z+X}-> ${z}checkout
|
|
883
|
+
${Z}dif ${z+X}-> ${z}diff
|
|
884
|
+
${Z}lg, lo ${z+X}-> ${z}log (auto-expanded)
|
|
885
|
+
${Z}pl, pul ${z+X}-> ${z}pull
|
|
886
|
+
${Z}ps, pus ${z+X}-> ${z}push
|
|
887
|
+
${Z}rb, rebas ${z+X}-> ${z}rebase
|
|
888
|
+
${Z}res, rese ${z+X}-> ${z}reset
|
|
889
|
+
${Z}rv, rever ${z+X}-> ${z}revert
|
|
890
|
+
${Z}mg, merg ${z+X}-> ${z}merge
|
|
891
|
+
${Z}in, ini ${z+X}-> ${z}init
|
|
892
|
+
${Z}sta, st ${z+X}-> ${z}stash
|
|
893
|
+
${Z}s, stat ${z+X}-> ${z}status
|
|
894
|
+
${Z}swit, sw ${z+X}-> ${z}switch
|
|
895
|
+
|
|
896
|
+
${J+h("CUSTOM COMMAND LIST",j.Zinc400,j.Zinc100,0.2)+z}
|
|
897
|
+
${YI(G,{cyan:Z,reset:z})}
|
|
898
|
+
|
|
899
|
+
${J+h("OPTIONS",j.Zinc400,j.Zinc100,0.2)+z}
|
|
900
|
+
${Z}--init <shell> ${z}Output shell initialization script for given shell.
|
|
901
|
+
${Z}--bypass ${z}Bypass gdx and execute git directly with the provided arguments.
|
|
902
|
+
${Z}--loglevel <level> ${z}Set log level (error, warning, info, debug).
|
|
903
|
+
${Z}--ghelp, ${z}Show GDX help message. ${X}(use \`${Z}ghelp <command>${z}\`
|
|
904
|
+
${Z} --gdx-help, -gh ${z+X}for command-specific help)${z}
|
|
905
|
+
${Z}-r, --recursive ${Q}[For '${k} status']${z} Recursively show git status of submodules.
|
|
906
|
+
${Z}-au ${Q}[For '${k} pull']${z} Shorthand for ${Z}--allow-unrelated-histories${z}.
|
|
907
|
+
${Z}--on-lint ${Q}[For '${k} push']${z} Skip linting for this push${z}.
|
|
908
|
+
${Z}-fl ${Q}[For '${k} push']${z} Shorthand for ${Z}--force-with-lease${z}.
|
|
909
|
+
${Z}-h ${Q}[For '${k} reset']${z} Shorthand for ${Z}--hard${z}.
|
|
910
|
+
${Z}-s ${Q}[For '${k} reset']${z} Shorthand for ${Z}--soft${z}.
|
|
911
|
+
|
|
912
|
+
${J+h("LOG EXPORT EXAMPLE",j.Zinc400,j.Zinc100,0.2)+z}
|
|
913
|
+
${Z}${k} lg export --author="me@example.com"${z}
|
|
762
914
|
Generate a formatted log export file (wrapper will add default
|
|
763
915
|
--author if missing and format the output for export).
|
|
764
916
|
|
|
765
|
-
${
|
|
917
|
+
${J+h("NOTES & SAFETY",j.Zinc400,j.Zinc100,0.2)+z}
|
|
766
918
|
- Help message for individual custom commands is available via
|
|
767
|
-
${Z}${
|
|
919
|
+
${Z}${k} ghelp <command>${z} (e.g. ${Z}${k} ghelp stash${z}).
|
|
768
920
|
- Range notation must be numeric and in the form start..end (e.g. 2..6).
|
|
769
921
|
- The wrapper prints an auto-expansion message when it expands a shorthand.
|
|
770
|
-
- If you rely on advanced argument parsing or unusual ${
|
|
922
|
+
- If you rely on advanced argument parsing or unusual ${k} flags, you can
|
|
771
923
|
bypass expansions by using the full command name
|
|
772
924
|
so they are not recognized as shorthand triggers.
|
|
773
|
-
- For more infomation, see ${
|
|
774
|
-
|
|
775
|
-
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
925
|
+
- For more infomation, see ${C6("README.md",wX)}.`,Math.min(100,c.terminalWidth-4),{firstIndent:" ",mode:"softboundary",indent:" "})),0;let H=Y.replace(/^\/+/,"");if(H==="help")return c2();let W=G[H],K="";if(W&&W.long)K=W.long();if(K&&W.usage)K+=`
|
|
926
|
+
`+J+h("USAGE",j.Zinc400,j.Zinc100,0.2)+z+W.usage();if(K)return O(K),0;return O(`No help found for '${H}'.`),1}function YI(Y,Z){let Q=[];for(let[J,X]of Object.entries(Y))Q.push(`${Z.cyan}${j6(J,19,{overflow:"visible",align:"left",redundancyLv:0})}${Z.reset}${n(X.short,60,{indent:19,firstIndent:0,redundancyLv:0,mode:"strict"})}`);return Q.join(`
|
|
927
|
+
`)}var ZB;var p9=F(()=>{Q0();J0();R0();S0();O0();p7();n7();i1();x2();b2();h2();x9();g2();m2();u2();d2();p2();ZB={$root:["cache","clear","commit","doctor","graph","gdx-config","lint","nocap","parallel","stash","stats","status"]}});var QB={};r2(QB,{dispatch:()=>c9});async function c9(Y,Z={inMacro:!1}){let Q=Y.args,J=Q[0];if(!Z.inMacro){let G=await l2();if(Q[0]&&Q[0]in G){let H=Q[0],W=G[H],K=Q.slice(1),$=[],V=[];for(let M of K)if(M.startsWith("-"))V.push(M);else $.push(M);O(U("Magenta")+`Executing macro '${H}'...`+U());let{executeMacro:q}=await Promise.resolve().then(() => (i2(),JB));return await q(Y.git$,W,$,V)}}else{let G=await l2();if(Q[0]&&Q[0]in G)return L.error(`Macro '${Q[0]}' cannot be invoked from inside a macro. Macro composition is not allowed.`,"macro"),1}let X=null,z=">";Y:if(Q[0]){let{match:G,candidates:H}=z5(Q[0],XZ);if(G)Q[0]=G;switch(Q[0]){case"s":Q[0]="status";case"status":if(Q.includes("-r")||Q.includes("--recursive"))return await D0.status(Y);break;case"co":Q[0]="checkout";break;case"br":Q[0]="branch";break;case"cmi":Q[0]="commit";case"commit":if(Q[1]==="auto")return await D0.commit.auto(Y);break;case"mg":Q[0]="merge";break;case"pl":case"pu":Q[0]="pull";case"pull":for(let W=1;W<Q.length;W++)if(Q[W]==="-au"){Q[W]="--allow-unrelated-histories";break}break;case"lint":return await D0.lint(Y);case"ps":Q[0]="push";case"push":{if(!Q.popOption("--no-lint")){let K=(await $0()).get("lint.onPushBehavior")||"off";if(K==="error"||K==="warning"){if(await D0.lint(Y)!==0)if(K==="error")return L.error("Lint failed. Push aborted.","lint"),1;else O(U("Yellow")+"Lint failed, but proceeding with push (warning mode)."+U())}}Q.spliceOption("-fl",["--force-with-lease"],1);break}case"ad":Q[0]="add";break;case"rv":Q[0]="revert";break;case"rb":Q[0]="rebase";break;case"reset":Q[0]="reset";for(let W=1;W<Q.length;W++){if(Q[W]==="-h"){Q[W]="--hard";break}if(Q[W]==="-s"){Q[W]="--soft";break}if(Q[W]==="~"){Q[W]="HEAD";break}if(/^~\d+$/.test(Q[W])){let K=Q[W].substring(1);Q[W]=`HEAD~${K}`;break}}break;case"log":case"lg":if(Q[0]==="lg"&&Q.length===1)Q.push("--oneline","--graph","--decorate","--all");else if(Q.popOption("export")){let W='--date=format:"%Y-%m-%d %H:%M"';if(!Q.hasOption("--author",1)){let q=Array.isArray(Y.git$)?Y.git$[0]:Y.git$;Q.push("--author="+await K6(q,"user.email"))}let $=Q.indexOf("--relative");if($>=0)Q.splice($,1),W='--date=format:"%Y-%m-%d %H:%M" (%ar)';let V=["--all",`--pretty=format:## Commit %h on [%p] - %ad%d
|
|
928
|
+
%s
|
|
929
|
+
|
|
930
|
+
%b
|
|
931
|
+
---
|
|
932
|
+
`,W].filter((q)=>!Q.hasOption(q,1));Q.push(...V),X="gitlog_export.md",z=">"}Q[0]="log";break;case"sta":Q[0]="stash";case"stash":{let W=["apply","pop","list","drop","clear","show","push","save","create","store"],K=z5(Q[1]||"",W,!0);if(K.match)Q[1]=K.match;else{let $=Q.indexOf("--");$=$>=0?$:Q.length;let V=!1;for(let q=1;q<$;q++)if(W.includes(Q[q])){V=!0;break}if(!V){let q=Array.isArray(Y.git$)?Y.git$[0]:Y.git$,B=LX(await UU(q),"2.15.0")>=0?"push":"save";Q.splice(1,0,B)}}if(Q[1]==="drop"){let $=Array.isArray(Y.git$)?Y.git$[0]:Y.git$;return await D0.stash.drop($,Q)}break}case"graph":return D0.graph(Y);case"stats":return D0.stats(Y);case"clear":return D0.clear(Y);case"cache":return D0.cache(Y);case"gdx-config":return D0.gdxConfig(Y);case"gdx-help":case"ghelp":return D0.help(Q[1]);case"nocap":return D0.nocap(Y);case"parallel":return D0.parallel(Y);case"doctor":return D0.doctor();case"macro":return D0.macro(Y);default:if(H&&H.length>1){L.warn(`Ambiguous command '${J}'. Did you mean: ${H.join(", ")}?`);break Y}}}if(Q[0]!==J)O(U("Cyan")+`Command auto expanded to: git ${QZ(Q).join(" ")}`+U());return m7(Y.git$,Q,X,z)}var l9=F(()=>{Q0();i9();J0();A0();R0();XY();K0();RY();i2()});var JB={};r2(JB,{writeMacrosToFile:()=>n2,syncMacrosToCache:()=>a9,substitutePlaceholders:()=>zB,readMacrosFromFile:()=>w6,isFilePath:()=>o9,getMacrosCachedOrLoad:()=>l2,executeMacro:()=>QI});import ZI from"path";async function w6(){try{if(!t(S6))return{};let Y=await KY(S6,"utf-8"),Z=JSON.parse(Y);if(typeof Z!=="object"||Z===null||Array.isArray(Z))return L.warn(`Invalid macro.json format at ${S6}`,"macro"),{};return Z}catch(Y){return L.warn(`Failed to read macro.json: ${s.from(Y).message}`,"macro"),{}}}async function n2(Y){try{let Z=ZI.dirname(S6);if(!t(Z))WY(Z,{recursive:!0});let Q=JSON.stringify(Y,null,2);await rY(S6,Q,"utf-8"),L.debug(`Macros written to ${S6}`,"macro")}catch(Z){throw new s(`Failed to write macro.json: ${s.from(Z).message}`,"MACRO_WRITE_FAILED")}}async function a9(){let Y=await w6(),Z=await z0();if(Z.isDisabled)throw new s("Cache is disabled. Cannot sync macros to cache.","CACHE_DISABLED");await Z.set(n9,Y,{maxAgeMinutes:XB}),L.debug(`Synced ${Object.keys(Y).length} macros to cache`,"macro")}async function l2(){let Y=await z0();if(Y.isDisabled)return await w6();let Z=await Y.get(n9);if(Z)return L.debug("Using cached macros","macro"),Z;let Q=await w6();return await Y.set(n9,Q,{maxAgeMinutes:XB}),L.debug("Loaded macros from file and cached","macro"),Q}async function QI(Y,Z,Q,J){let X=Z.split(";").map((G)=>G.trim()).filter((G)=>G.length>0);if(X.length===0)return L.error("Macro script is empty.","macro"),1;let{dispatch:z}=await Promise.resolve().then(() => (l9(),QB));for(let G=0;G<X.length;G++){let H=G===X.length-1,W=RU(X[G]);if(W=zB(W,Q),H&&J.length>0)W.push(...J);if(W.length===0)continue;O(U("Cyan")+`Executing: gdx ${QZ(W).join(" ")}`+U());let K={git$:Y,args:new a6(W)},$=await z(K,{inMacro:!0});if($!==0)return L.error(`Macro command failed with exit code ${$}`,"macro"),$}return 0}function o9(Y){if(Y.startsWith("./")||Y.startsWith("/"))return!0;if(Y.startsWith(".\\"))return!0;if(/^[a-zA-Z]:[/\\]/.test(Y))return!0;return!1}function zB(Y,Z){return Y.map((Q)=>{return Q.replace(/\$(\d+)/g,(J,X)=>{let z=parseInt(X,10)-1;return z>=0&&z<Z.length?Z[z]:J})})}var n9="macro.all",XB=1440;var i2=F(()=>{g0();J0();W6();Q0();K0();A0();R0();i7()});async function JI(Y){let{args:Z}=Y,Q=Z[1];switch(Q){case"set":return await zI(Y);case"list":return await GI();case"drop":return await HI(Y);case"sync":return await WI();default:return L.error(`Unknown macro subcommand: '${Q}'. Available: set, list, drop, sync`,"macro"),1}}async function XI(){return new Promise((Y,Z)=>{let Q="";if(process.stdin.setEncoding("utf-8"),process.stdin.on("data",(J)=>{Q+=J}),process.stdin.on("end",()=>{Y(Q.trim())}),process.stdin.on("error",(J)=>{Z(J)}),process.stdin.isTTY)Y("")})}async function zI(Y){let{args:Z}=Y,Q=Z[2],J=Z.slice(3);if(!Q)return L.error("Macro name is required. Usage: gdx macro set <name> <script>","macro"),1;let X;if(J.length===0)try{if(X=await XI(),!X)return L.error("Macro script or file path is required. Use: gdx macro set <name> <script> or gdx macro set <name> < file.txt","macro"),1;L.debug("Loaded macro script from stdin","macro")}catch(z){return L.error(`Failed to read from stdin: ${s.from(z).message}`,"macro"),1}else if(J.length===1&&o9(J[0])){let z=J[0];try{if(!t(z))return L.error(`File not found: ${z}`,"macro"),1;X=(await KY(z,"utf-8")).trim(),L.debug(`Loaded macro script from file: ${z}`,"macro")}catch(G){return L.error(`Failed to read file: ${s.from(G).message}`,"macro"),1}}else X=J.join(" ");if(!X)return L.error("Macro script cannot be empty.","macro"),1;try{let z=await w6(),G=Q in z;if(z[Q]=X,await n2(z),await(await z0()).set("macro.all",z,{maxAgeMinutes:1440}),G)O(U("Yellow")+`Macro '${Q}' updated.`+U());else O(U("Green")+`Macro '${Q}' created.`+U());return 0}catch(z){return L.error(`Failed to set macro: ${s.from(z).message}`,"macro"),1}}async function GI(){try{let Y=await w6();await(await z0()).set("macro.all",Y,{maxAgeMinutes:1440});let Q=Object.keys(Y);if(Q.length===0)return O(U("Dim")+"No macros defined."+U()),0;O(U("Cyan")+U("Bright")+"Macros:"+U());for(let J of Q.sort()){let X=Y[J],G=(X.length>80?X.substring(0,77)+"...":X).replace(/\s+/g," ");O(` ${U("Green")}${J}${U()}: ${U("Dim")}${G}${U()}`)}return 0}catch(Y){return L.error(`Failed to list macros: ${s.from(Y).message}`,"macro"),1}}async function HI(Y){let{args:Z}=Y,Q=Z[2];if(!Q)return L.error("Macro name is required. Usage: gdx macro drop <name>","macro"),1;try{let J=await w6();if(!(Q in J))return L.error(`Macro '${Q}' not found.`,"macro"),1;return delete J[Q],await n2(J),await(await z0()).set("macro.all",J,{maxAgeMinutes:1440}),O(U("Yellow")+`Macro '${Q}' deleted.`+U()),0}catch(J){return L.error(`Failed to drop macro: ${s.from(J).message}`,"macro"),1}}async function WI(){try{return await a9(),O(U("Green")+"Macros synced to cache."+U()),0}catch(Y){let Z=s.from(Y);if(Z.code==="CACHE_DISABLED")L.error("Cache is disabled. Cannot sync macros.","macro");else L.error(`Failed to sync macros: ${Z.message}`,"macro");return 1}}var HB,GB;var s9=F(()=>{i2();Q0();K0();R0();W6();g0();HB=JI,GB={$root:{set:{},list:{},drop:{},sync:{}}}});function KI(Y){if(!Y||typeof Y!=="object"||Array.isArray(Y))return!1;return!0}async function r9(Y,Z){let Q=Y,J=0;while(typeof Q==="function"&&J<3){try{Q=await Q(Z)}catch{return{}}J+=1}if(Array.isArray(Q)||KI(Q))return Q;return{}}async function WB(Y,Z){if(!Y)return[];let Q=Y,J=0;while(typeof Q==="function"&&J<3){try{Q=await Q(Z)}catch{return[]}J+=1}return Array.isArray(Q)?Q:[]}async function KB(Y,Z){if(Array.isArray(Y))return{children:{},anyOf:new Set(Y),allOf:new Set};let Q={},J=new Set(await WB(Y.$anyOf,Z)),X=new Set(await WB(Y.$allOf,Z));for(let[z,G]of Object.entries(Y)){if(z==="$allOf"||z==="$anyOf"||!G)continue;Q[z]=G}return{children:Q,anyOf:J,allOf:X}}async function $B(Y,Z,Q,J){let X=Q.$root,z=new Set,G=new Set,H=!1,W=Z,K=(D,T)=>({git$:J.git$,args:Y,index:D,cursorIndex:W,mode:T});for(let D=0;D<Z;D++){let T=Y[D];if(!T)continue;X=await r9(X,K(D,"history"));let _=await KB(X,K(D,"history"));if(T in _.children){for(let I of _.allOf)z.add(I);X=await r9(_.children[T],K(D,"history")),H=!1;continue}if(_.anyOf.has(T)){if(H)return{completions:[]};H=!0;continue}if(_.allOf.has(T)){if(G.has(T))return{completions:[]};G.add(T);continue}if(z.has(T)){if(G.has(T))return{completions:[]};G.add(T);continue}if(T.startsWith("-"))return{completions:[]}}X=await r9(X,K(Z,"suggest"));let $=await KB(X,K(Z,"suggest")),V=new Set;for(let D of Object.keys($.children))V.add(D);if(!H)for(let D of $.anyOf)V.add(D);let q=new Set([...$.allOf,...z]);for(let D of q)if(!G.has(D))V.add(D);let M=Y[Z]||"";return{completions:Array.from(V).filter((D)=>D.startsWith(M)).sort((D,T)=>D.length-T.length||D.localeCompare(T))}}var t9,UB,VB;var qB=F(()=>{m2();g2();p2();h2();i1();p9();u2();x2();b2();p7();n7();d2();s9();t9={cache:uq,clear:hq,doctor:YB,"gdx-config":Pq,graph:uU,help:ZB,lint:sq,nocap:Dq,parallel:kq,stash:SU,stats:cU,status:tq,macro:GB},UB=["s","st","co","br","cmi","mg","pl","pu","ps","ad","rv","rb","lg","sta"],VB=["--loglevel","--ghelp","--bypass"]});function $I(Y){let Z=process.env.GDX_CMP_IDX,Q=Number.parseInt(Z||"",10);if(!Number.isInteger(Q)||Q<0)Q=Math.max(0,Y-1);if(Y>0&&Q>=Y)Q=Y-1;return Q}async function e9(Y){let Z=c.logLevel;c.logLevel="off";try{let Q=[...Y.args];if(Q[0]==="__completion")Q.shift();let J=$I(Q.length);if(L.debug(`Completion invoked with args: ${Q.join(" ")} (idx=${J})`,"completion"),Q.length===0||J===0){let H=Q[0]||"",W=new Set;for(let $ of Object.keys(t9))W.add($);for(let $ of UB)W.add($);for(let $ of VB)W.add($);for(let $ of XZ)W.add($);let K=Array.from(W).filter(($)=>$.startsWith(H)).sort(($,V)=>$.length-V.length||$.localeCompare(V));L.debug(`Completion root-level matches: ${K.join(", ")}`,"completion");for(let $ of K)process.stdout.write(`${$}
|
|
933
|
+
`);return 0}let X=Q[0],z=Q.slice(1),G=t9[X];if(G){let H=J-1;if(H>=0&&H<z.length){let{completions:W}=await $B(z,H,G,{git$:Y.git$});L.debug(`Completion matches for command '${X}': ${W.join(", ")}`,"completion");for(let K of W)process.stdout.write(`${K}
|
|
934
|
+
`);return 0}}return L.debug(`No completion structure for command '${X}', or index out of range`,"completion"),0}finally{c.logLevel=Z}}var BB=F(()=>{O0();J0();K0();qB()});var D0;var i9=F(()=>{p9();p7();i1();n7();g2();m2();x9();h2();x2();b2();u2();p2();d2();s9();BB();D0={__completion:e9,help:c2,stash:PU,graph:l1,stats:xQ,clear:v9,cache:y9,commit:vq,gdxConfig:P9,nocap:k9,parallel:A9,lint:h9,doctor:d9,status:m9,macro:HB}});Q0();i9();A0();R0();i7();J0();var UI=(Y="gdx")=>{return`# gdx shell integration
|
|
781
935
|
${Y}() {
|
|
782
936
|
local tmp
|
|
783
937
|
tmp="$(mktemp)"
|
|
784
938
|
GDX_RESULT="$tmp" command gdx "$@"
|
|
785
939
|
local ret=$?
|
|
786
|
-
if [ $ret -eq ${
|
|
940
|
+
if [ $ret -eq ${A6} ]; then
|
|
787
941
|
if [ -f "$tmp" ]; then
|
|
788
942
|
cd "$(cat "$tmp")"
|
|
789
943
|
fi
|
|
@@ -832,13 +986,13 @@ __gdx_complete_bash() {
|
|
|
832
986
|
}
|
|
833
987
|
|
|
834
988
|
complete -o bashdefault -o default -F __gdx_complete_bash ${Y}
|
|
835
|
-
`},
|
|
989
|
+
`},VI=(Y="gdx")=>{return`# gdx shell integration
|
|
836
990
|
${Y}() {
|
|
837
991
|
local tmp
|
|
838
992
|
tmp="$(mktemp)"
|
|
839
993
|
GDX_RESULT="$tmp" command gdx "$@"
|
|
840
994
|
local ret=$?
|
|
841
|
-
if [ $ret -eq ${
|
|
995
|
+
if [ $ret -eq ${A6} ]; then
|
|
842
996
|
if [ -f "$tmp" ]; then
|
|
843
997
|
cd "$(cat "$tmp")"
|
|
844
998
|
fi
|
|
@@ -887,13 +1041,13 @@ if ! (( $+functions[compdef] )); then
|
|
|
887
1041
|
fi
|
|
888
1042
|
|
|
889
1043
|
compdef __gdx_complete_zsh ${Y}
|
|
890
|
-
`},
|
|
1044
|
+
`},qI=(Y="gdx")=>{return`# gdx shell integration
|
|
891
1045
|
function ${Y}
|
|
892
1046
|
set -l tmp (mktemp)
|
|
893
1047
|
set -x GDX_RESULT "$tmp"
|
|
894
1048
|
command gdx $argv
|
|
895
1049
|
set -l ret $status
|
|
896
|
-
if test $ret -eq ${
|
|
1050
|
+
if test $ret -eq ${A6}
|
|
897
1051
|
if test -f "$tmp"
|
|
898
1052
|
cd (cat "$tmp")
|
|
899
1053
|
end
|
|
@@ -934,7 +1088,7 @@ complete -c ${Y} -w git
|
|
|
934
1088
|
|
|
935
1089
|
# Then add gdx-specific completions (they take precedence)
|
|
936
1090
|
complete -c ${Y} -f -a "(__gdx_complete_fish)"
|
|
937
|
-
`},
|
|
1091
|
+
`},BI=(Y="gdx")=>{return`# gdx shell integration
|
|
938
1092
|
function ${Y} {
|
|
939
1093
|
$tmp = [System.IO.Path]::GetTempFileName()
|
|
940
1094
|
$env:GDX_RESULT = $tmp
|
|
@@ -945,7 +1099,7 @@ function ${Y} {
|
|
|
945
1099
|
}
|
|
946
1100
|
if ($command) {
|
|
947
1101
|
& $command @args
|
|
948
|
-
if ($LASTEXITCODE -eq ${
|
|
1102
|
+
if ($LASTEXITCODE -eq ${A6}) {
|
|
949
1103
|
if (Test-Path $tmp) {
|
|
950
1104
|
$target = Get-Content $tmp -Raw
|
|
951
1105
|
if ($target) {
|
|
@@ -1015,10 +1169,4 @@ $__gdxCompleter = {
|
|
|
1015
1169
|
}
|
|
1016
1170
|
|
|
1017
1171
|
Register-ArgumentCompleter -Native -CommandName ${Y} -ScriptBlock $__gdxCompleter
|
|
1018
|
-
`},
|
|
1019
|
-
%s
|
|
1020
|
-
|
|
1021
|
-
%b
|
|
1022
|
-
---
|
|
1023
|
-
`,z].filter((R)=>!Z.hasOption(R,1));Z.push(...V),$="gitlog_export.md",G=">"}Z[0]="log";break;case"sta":Z[0]="stash";case"stash":{let z=["apply","pop","list","drop","clear","show","push","save"],q=h2(Z[1]||"",z,!0);if(q.match)Z[1]=q.match;else{let V=Z.indexOf("--");V=V>=0?V:Z.length;let R=!1;for(let B=1;B<V;B++)if(z.includes(Z[B])){R=!0;break}if(!R){let M=M$(await d$(Q),"2.15.0")>=0?"push":"save";Z.splice(1,0,M)}}if(Z[1]==="drop")return await L0.stash.drop(Q,Z);break}case"graph":return L0.graph(Y);case"stats":return L0.stats(Y);case"clear":return L0.clear(Y);case"gdx-config":return L0.gdxConfig(Y);case"gdx-help":case"ghelp":return L0.help(Z[1]);case"nocap":return L0.nocap(Y);case"parallel":return L0.parallel(Y);case"doctor":return L0.doctor();default:if(W&&W.length>1){P.warn(`Ambiguous command '${J}'. Did you mean: ${W.join(", ")}?`);break Y}}}if(Z[0]!==J)k(U("Cyan")+`Command auto expanded to: git ${F$(Z).join(" ")}`+U());let K=0;try{if($){let{exitCode:H}=await c0({stdout:{file:$,append:G===">>"},stderr:"inherit"})`${Q} ${Z}`;K=H}else{let{exitCode:H}=await Z0`${Q} ${Z}`;K=H}}catch(H){let W=X0.from(H);if(W.name===bY.name&&W.message.startsWith("Command failed"))return K||1;return P.error(`Command failed.
|
|
1024
|
-
`+s(W,{color:!0})),1}return K??0}(async()=>{try{let Y=await ZD();if(p.finalStringOutput)k(p.finalStringOutput);process.exit(p.exitCodeOverride>=0?p.exitCodeOverride:Y)}catch(Y){P.error(s(Y,{color:!0})),process.exit(1)}})();
|
|
1172
|
+
`},FB=(Y,Z)=>{switch(Y.toLowerCase()){case"bash":return UI(Z);case"zsh":return VI(Z);case"fish":return qI(Z);case"powershell":case"pwsh":return BI(Z);default:throw Error("Unsupported shell: ${shell}`")}};O0();K0();l9();var FI=process.argv.slice(2);async function RI(){let Y={args:new a6(FI),git$:""},Z=Y.args;if(Z[0]==="--init"){let X=Z.popValue("--shell")||Z.popValue("--init"),z=Z.popValue("--cmd");if(X)try{let G=FB(X,z||void 0);return O(G),0}catch(G){return L.error(p(G,{color:!0})),1}else return L.error("<shell-name> is not specified. --init <shell-name> is required for initialization."),1}if(Z[0]==="__completion")return await D0.__completion({...Y,git$:"git"});let Q=await $6("git");if(!Q)throw new s("Git is not installed or not found in PATH.","GIT_NOT_FOUND");if(Y.git$=Q,Z[0]==="--bypass")return m7(Q,Z.slice(1));let J=Z.popValue("--loglevel");if(J){let X=["fatal","error","warn","info","debug"];if(X.includes(J))c.logLevel=J;else return L.error(`Invalid log level '${J}'. Expected: ${X.join(", ")}`),1}if(Z.includes("--ghelp")||Z.includes("-gh")||Z.includes("--gdx-help")||Z.length===0)return D0.help(),0;return c9(Y)}(async()=>{try{let Y=await RI();if(c.finalStringOutput)O(c.finalStringOutput);process.exit(c.exitCodeOverride>=0?c.exitCodeOverride:Y)}catch(Y){L.error(p(Y,{color:!0})),process.exit(1)}})();
|