zen-code 4.9.1 → 4.10.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/dist/app.js +175 -166
- package/dist/chunk-075hks9v.js +1 -0
- package/dist/chunk-0fj768k4.js +112 -0
- package/dist/chunk-19mf2aa7.js +1 -0
- package/dist/chunk-1mq2jmfy.js +2 -0
- package/dist/chunk-1v863afn.js +278 -0
- package/dist/chunk-1vn8d8b8.js +1 -0
- package/dist/{chunk-mmq834zt.js → chunk-1w19w1bm.js} +1 -1
- package/dist/chunk-3dnayvgx.js +224 -0
- package/dist/chunk-4hg13vwj.js +1 -0
- package/dist/chunk-4scrkcqv.js +1 -0
- package/dist/chunk-54cdhhqm.js +1 -0
- package/dist/chunk-5m4yb9av.js +91 -0
- package/dist/chunk-5yd4ntp6.js +8 -0
- package/dist/{chunk-b52b0t16.js → chunk-6scjjkn3.js} +1 -1
- package/dist/chunk-7jatn15w.js +2 -0
- package/dist/{chunk-4nsg4vcd.js → chunk-7w9y11hj.js} +1 -1
- package/dist/chunk-7yzv6385.js +1 -0
- package/dist/{chunk-g377vrpj.js → chunk-875hayaj.js} +3 -3
- package/dist/chunk-8bs8r50r.js +1 -0
- package/dist/chunk-8waww0j9.js +6 -0
- package/dist/chunk-8ysg0rga.js +1 -0
- package/dist/chunk-9czhw5k6.js +4 -0
- package/dist/chunk-9tgp14v7.js +16 -0
- package/dist/chunk-a239dn0b.js +1 -0
- package/dist/chunk-arv4h3h1.js +2 -0
- package/dist/chunk-b2551zfb.js +2 -0
- package/dist/chunk-b9emn03n.js +1 -0
- package/dist/chunk-bm7578sn.js +1 -0
- package/dist/{chunk-1y82m5kn.js → chunk-bytq4kd1.js} +3 -125
- package/dist/chunk-c2wfgbj6.js +1 -0
- package/dist/{chunk-gcm4jp0d.js → chunk-cef4vbtb.js} +1 -1
- package/dist/chunk-cnzhxgn5.js +4 -0
- package/dist/chunk-d2770b2z.js +1 -0
- package/dist/chunk-d72063sm.js +2 -0
- package/dist/{chunk-9k5d9vf1.js → chunk-d988tv30.js} +1 -1
- package/dist/{chunk-va71tsw3.js → chunk-dx9k6sdd.js} +3 -3
- package/dist/chunk-e6ggkg36.js +2 -0
- package/dist/chunk-fjqtrakn.js +1 -0
- package/dist/chunk-gbfpab0j.js +1 -0
- package/dist/chunk-gkvx829z.js +1 -0
- package/dist/{chunk-9dahn9h7.js → chunk-gwf8b14k.js} +1 -1
- package/dist/chunk-gz7fz9fg.js +1 -0
- package/dist/chunk-h0q3dvnv.js +5 -0
- package/dist/chunk-h0qb9jk1.js +1 -0
- package/dist/chunk-h9y136h8.js +1 -0
- package/dist/chunk-hrcxdj3c.js +54 -0
- package/dist/chunk-hz9yw7cs.js +166 -0
- package/dist/chunk-j4y5rjne.js +79 -0
- package/dist/chunk-k12y05c3.js +3 -0
- package/dist/chunk-k6fxqssr.js +18 -0
- package/dist/{chunk-rncpxz1b.js → chunk-kmxdq21k.js} +2 -2
- package/dist/chunk-mcb8rewr.js +213 -0
- package/dist/{chunk-wn43r152.js → chunk-mm9w91rj.js} +1 -1
- package/dist/chunk-mv0xzmq8.js +2 -0
- package/dist/chunk-n849zsd3.js +1 -0
- package/dist/chunk-nm253hhf.js +81 -0
- package/dist/chunk-prg6489q.js +1 -0
- package/dist/{chunk-cggjws6a.js → chunk-pxdgy0vr.js} +1 -1
- package/dist/chunk-qhzm2qw9.js +2 -0
- package/dist/{chunk-98f6hg43.js → chunk-qmxtys9q.js} +1 -1
- package/dist/chunk-r0cfe5c1.js +294 -0
- package/dist/chunk-rtjytfhh.js +1 -0
- package/dist/chunk-s7ttf0pm.js +2 -0
- package/dist/chunk-t01t72t2.js +140 -0
- package/dist/{chunk-ns6tjjkq.js → chunk-t0f66x64.js} +1 -1
- package/dist/chunk-tn356gwf.js +93 -0
- package/dist/chunk-vd8kwzra.js +41 -0
- package/dist/chunk-vhn13anh.js +233 -0
- package/dist/chunk-vnewbtjy.js +1 -0
- package/dist/chunk-wbm7rn9w.js +2 -0
- package/dist/chunk-wd3gkd45.js +3 -0
- package/dist/chunk-whdf0vbb.js +1 -0
- package/dist/{chunk-j7a40ww9.js → chunk-ws232ksq.js} +2 -2
- package/dist/{chunk-8g2zdcy0.js → chunk-yerf10k7.js} +1 -1
- package/dist/{chunk-heasksrr.js → chunk-yzv3n8mw.js} +2 -2
- package/dist/chunk-z3e4c424.js +2 -0
- package/dist/chunk-znw7fpep.js +6 -0
- package/dist/chunk-zq2g4rfd.js +1 -0
- package/dist/cli.js +1 -1
- package/dist/nonInteractive.js +314 -4
- package/dist/zen-keyboard.js +1 -1
- package/package.json +37 -37
- package/dist/chunk-02vv5584.js +0 -1
- package/dist/chunk-13nyfrmm.js +0 -310
- package/dist/chunk-1edvf7b5.js +0 -1
- package/dist/chunk-1rmnbdef.js +0 -1
- package/dist/chunk-1ttywx0y.js +0 -6
- package/dist/chunk-30sq2w0d.js +0 -8
- package/dist/chunk-32ase1cw.js +0 -2
- package/dist/chunk-3490ntd8.js +0 -1
- package/dist/chunk-3pcybja5.js +0 -7
- package/dist/chunk-5rr85f28.js +0 -1
- package/dist/chunk-5x8nxw0t.js +0 -137
- package/dist/chunk-6rfc36jg.js +0 -1
- package/dist/chunk-76h8pe7x.js +0 -2
- package/dist/chunk-7kdvr78m.js +0 -31
- package/dist/chunk-8z38ybz7.js +0 -1
- package/dist/chunk-b8dxq9rq.js +0 -1
- package/dist/chunk-cjqarwdn.js +0 -1
- package/dist/chunk-cs73xbzz.js +0 -1
- package/dist/chunk-cyexd09c.js +0 -2
- package/dist/chunk-ep2es95e.js +0 -81
- package/dist/chunk-f8ewggk1.js +0 -1
- package/dist/chunk-g7pm00z7.js +0 -253
- package/dist/chunk-hfve7nf5.js +0 -2
- package/dist/chunk-j9aysaeb.js +0 -1
- package/dist/chunk-jbf8ve63.js +0 -3
- package/dist/chunk-jfhc5c0d.js +0 -1
- package/dist/chunk-jxsfzfac.js +0 -2
- package/dist/chunk-kba8akjs.js +0 -2
- package/dist/chunk-m76ya904.js +0 -1
- package/dist/chunk-mjzeawnq.js +0 -6
- package/dist/chunk-nwy6n6b6.js +0 -274
- package/dist/chunk-qd305hg1.js +0 -1
- package/dist/chunk-qez6ejd4.js +0 -1
- package/dist/chunk-r2h3x9zv.js +0 -2
- package/dist/chunk-rz3b356n.js +0 -1
- package/dist/chunk-trjpzw1n.js +0 -91
- package/dist/chunk-xhnvpygg.js +0 -2
- package/dist/chunk-xkz5z0zn.js +0 -1
- package/dist/chunk-zwxjkwqd.js +0 -26
- package/dist/chunk-zz32kgt2.js +0 -1
package/dist/chunk-3pcybja5.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{ub as K0,vb as P,yb as R}from"./chunk-kba8akjs.js";var C=P((j4,h0)=>{var g0=["nodebuffer","arraybuffer","fragments"],w0=typeof Blob<"u";if(w0)g0.push("blob");h0.exports={BINARY_TYPES:g0,CLOSE_TIMEOUT:30000,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:w0,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var n=P((Y4,X0)=>{var{EMPTY_BUFFER:l5}=C(),F0=Buffer[Symbol.species];function p5(J,K){if(J.length===0)return l5;if(J.length===1)return J[0];let X=Buffer.allocUnsafe(K),Z=0;for(let $=0;$<J.length;$++){let Q=J[$];X.set(Q,Z),Z+=Q.length}if(Z<K)return new F0(X.buffer,X.byteOffset,Z);return X}function m0(J,K,X,Z,$){for(let Q=0;Q<$;Q++)X[Z+Q]=J[Q]^K[Q&3]}function f0(J,K){for(let X=0;X<J.length;X++)J[X]^=K[X&3]}function b5(J){if(J.length===J.buffer.byteLength)return J.buffer;return J.buffer.slice(J.byteOffset,J.byteOffset+J.length)}function D0(J){if(D0.readOnly=!0,Buffer.isBuffer(J))return J;let K;if(J instanceof ArrayBuffer)K=new F0(J);else if(ArrayBuffer.isView(J))K=new F0(J.buffer,J.byteOffset,J.byteLength);else K=Buffer.from(J),D0.readOnly=!1;return K}X0.exports={concat:p5,mask:m0,toArrayBuffer:b5,toBuffer:D0,unmask:f0};if(!process.env.WS_NO_BUFFER_UTIL)try{let J=(()=>{throw new Error("Cannot require module "+"bufferutil");})();X0.exports.mask=function(K,X,Z,$,Q){if(Q<48)m0(K,X,Z,$,Q);else J.mask(K,X,Z,$,Q)},X0.exports.unmask=function(K,X){if(K.length<32)f0(K,X);else J.unmask(K,X)}}catch(J){}});var b0=P((V4,p0)=>{var u0=Symbol("kDone"),O0=Symbol("kRun");class l0{constructor(J){this[u0]=()=>{this.pending--,this[O0]()},this.concurrency=J||1/0,this.jobs=[],this.pending=0}add(J){this.jobs.push(J),this[O0]()}[O0](){if(this.pending===this.concurrency)return;if(this.jobs.length){let J=this.jobs.shift();this.pending++,J(this[u0])}}}p0.exports=l0});var a=P((_4,n0)=>{var r=R("zlib"),k0=n(),k5=b0(),{kStatusCode:i0}=C(),i5=Buffer[Symbol.species],d5=Buffer.from([0,0,255,255]),$0=Symbol("permessage-deflate"),q=Symbol("total-length"),f=Symbol("callback"),L=Symbol("buffers"),u=Symbol("error"),Z0;class d0{constructor(J,K,X){if(this._maxPayload=X|0,this._options=J||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._isServer=!!K,this._deflate=null,this._inflate=null,this.params=null,!Z0){let Z=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Z0=new k5(Z)}}static get extensionName(){return"permessage-deflate"}offer(){let J={};if(this._options.serverNoContextTakeover)J.server_no_context_takeover=!0;if(this._options.clientNoContextTakeover)J.client_no_context_takeover=!0;if(this._options.serverMaxWindowBits)J.server_max_window_bits=this._options.serverMaxWindowBits;if(this._options.clientMaxWindowBits)J.client_max_window_bits=this._options.clientMaxWindowBits;else if(this._options.clientMaxWindowBits==null)J.client_max_window_bits=!0;return J}accept(J){return J=this.normalizeParams(J),this.params=this._isServer?this.acceptAsServer(J):this.acceptAsClient(J),this.params}cleanup(){if(this._inflate)this._inflate.close(),this._inflate=null;if(this._deflate){let J=this._deflate[f];if(this._deflate.close(),this._deflate=null,J)J(Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(J){let K=this._options,X=J.find((Z)=>{if(K.serverNoContextTakeover===!1&&Z.server_no_context_takeover||Z.server_max_window_bits&&(K.serverMaxWindowBits===!1||typeof K.serverMaxWindowBits==="number"&&K.serverMaxWindowBits>Z.server_max_window_bits)||typeof K.clientMaxWindowBits==="number"&&!Z.client_max_window_bits)return!1;return!0});if(!X)throw Error("None of the extension offers can be accepted");if(K.serverNoContextTakeover)X.server_no_context_takeover=!0;if(K.clientNoContextTakeover)X.client_no_context_takeover=!0;if(typeof K.serverMaxWindowBits==="number")X.server_max_window_bits=K.serverMaxWindowBits;if(typeof K.clientMaxWindowBits==="number")X.client_max_window_bits=K.clientMaxWindowBits;else if(X.client_max_window_bits===!0||K.clientMaxWindowBits===!1)delete X.client_max_window_bits;return X}acceptAsClient(J){let K=J[0];if(this._options.clientNoContextTakeover===!1&&K.client_no_context_takeover)throw Error('Unexpected parameter "client_no_context_takeover"');if(!K.client_max_window_bits){if(typeof this._options.clientMaxWindowBits==="number")K.client_max_window_bits=this._options.clientMaxWindowBits}else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==="number"&&K.client_max_window_bits>this._options.clientMaxWindowBits)throw Error('Unexpected or invalid parameter "client_max_window_bits"');return K}normalizeParams(J){return J.forEach((K)=>{Object.keys(K).forEach((X)=>{let Z=K[X];if(Z.length>1)throw Error(`Parameter "${X}" must have only a single value`);if(Z=Z[0],X==="client_max_window_bits"){if(Z!==!0){let $=+Z;if(!Number.isInteger($)||$<8||$>15)throw TypeError(`Invalid value for parameter "${X}": ${Z}`);Z=$}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${X}": ${Z}`)}else if(X==="server_max_window_bits"){let $=+Z;if(!Number.isInteger($)||$<8||$>15)throw TypeError(`Invalid value for parameter "${X}": ${Z}`);Z=$}else if(X==="client_no_context_takeover"||X==="server_no_context_takeover"){if(Z!==!0)throw TypeError(`Invalid value for parameter "${X}": ${Z}`)}else throw Error(`Unknown parameter "${X}"`);K[X]=Z})}),J}decompress(J,K,X){Z0.add((Z)=>{this._decompress(J,K,($,Q)=>{Z(),X($,Q)})})}compress(J,K,X){Z0.add((Z)=>{this._compress(J,K,($,Q)=>{Z(),X($,Q)})})}_decompress(J,K,X){let Z=this._isServer?"client":"server";if(!this._inflate){let $=`${Z}_max_window_bits`,Q=typeof this.params[$]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[$];this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:Q}),this._inflate[$0]=this,this._inflate[q]=0,this._inflate[L]=[],this._inflate.on("error",n5),this._inflate.on("data",c0)}if(this._inflate[f]=X,this._inflate.write(J),K)this._inflate.write(d5);this._inflate.flush(()=>{let $=this._inflate[u];if($){this._inflate.close(),this._inflate=null,X($);return}let Q=k0.concat(this._inflate[L],this._inflate[q]);if(this._inflate._readableState.endEmitted)this._inflate.close(),this._inflate=null;else if(this._inflate[q]=0,this._inflate[L]=[],K&&this.params[`${Z}_no_context_takeover`])this._inflate.reset();X(null,Q)})}_compress(J,K,X){let Z=this._isServer?"server":"client";if(!this._deflate){let $=`${Z}_max_window_bits`,Q=typeof this.params[$]!=="number"?r.Z_DEFAULT_WINDOWBITS:this.params[$];this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:Q}),this._deflate[q]=0,this._deflate[L]=[],this._deflate.on("data",c5)}this._deflate[f]=X,this._deflate.write(J),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let $=k0.concat(this._deflate[L],this._deflate[q]);if(K)$=new i5($.buffer,$.byteOffset,$.length-4);if(this._deflate[f]=null,this._deflate[q]=0,this._deflate[L]=[],K&&this.params[`${Z}_no_context_takeover`])this._deflate.reset();X(null,$)})}}n0.exports=d0;function c5(J){this[L].push(J),this[q]+=J.length}function c0(J){if(this[q]+=J.length,this[$0]._maxPayload<1||this[q]<=this[$0]._maxPayload){this[L].push(J);return}this[u]=RangeError("Max payload size exceeded"),this[u].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[u][i0]=1009,this.removeListener("data",c0),this.reset()}function n5(J){if(this[$0]._inflate=null,this[u]){this[f](this[u]);return}J[i0]=1007,this[f](J)}});var l=P((N4,Q0)=>{var{isUtf8:r0}=R("buffer"),{hasBlob:r5}=C(),a5=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function s5(J){return J>=1000&&J<=1014&&J!==1004&&J!==1005&&J!==1006||J>=3000&&J<=4999}function P0(J){let K=J.length,X=0;while(X<K)if((J[X]&128)===0)X++;else if((J[X]&224)===192){if(X+1===K||(J[X+1]&192)!==128||(J[X]&254)===192)return!1;X+=2}else if((J[X]&240)===224){if(X+2>=K||(J[X+1]&192)!==128||(J[X+2]&192)!==128||J[X]===224&&(J[X+1]&224)===128||J[X]===237&&(J[X+1]&224)===160)return!1;X+=3}else if((J[X]&248)===240){if(X+3>=K||(J[X+1]&192)!==128||(J[X+2]&192)!==128||(J[X+3]&192)!==128||J[X]===240&&(J[X+1]&240)===128||J[X]===244&&J[X+1]>143||J[X]>244)return!1;X+=4}else return!1;return!0}function o5(J){return r5&&typeof J==="object"&&typeof J.arrayBuffer==="function"&&typeof J.type==="string"&&typeof J.stream==="function"&&(J[Symbol.toStringTag]==="Blob"||J[Symbol.toStringTag]==="File")}Q0.exports={isBlob:o5,isValidStatusCode:s5,isValidUTF8:P0,tokenChars:a5};if(r0)Q0.exports.isValidUTF8=function(J){return J.length<24?P0(J):r0(J)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let J=(()=>{throw new Error("Cannot require module "+"utf-8-validate");})();Q0.exports.isValidUTF8=function(K){return K.length<32?P0(K):J(K)}}catch(J){}});var T0=P((H4,e0)=>{var{Writable:t5}=R("stream"),a0=a(),{BINARY_TYPES:e5,EMPTY_BUFFER:s0,kStatusCode:J1,kWebSocket:K1}=C(),{concat:M0,toArrayBuffer:X1,unmask:Z1}=n(),{isValidStatusCode:$1,isValidUTF8:o0}=l(),G0=Buffer[Symbol.species];class t0 extends t5{constructor(J={}){super();this._allowSynchronousEvents=J.allowSynchronousEvents!==void 0?J.allowSynchronousEvents:!0,this._binaryType=J.binaryType||e5[0],this._extensions=J.extensions||{},this._isServer=!!J.isServer,this._maxPayload=J.maxPayload|0,this._skipUTF8Validation=!!J.skipUTF8Validation,this[K1]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(J,K,X){if(this._opcode===8&&this._state==0)return X();this._bufferedBytes+=J.length,this._buffers.push(J),this.startLoop(X)}consume(J){if(this._bufferedBytes-=J,J===this._buffers[0].length)return this._buffers.shift();if(J<this._buffers[0].length){let X=this._buffers[0];return this._buffers[0]=new G0(X.buffer,X.byteOffset+J,X.length-J),new G0(X.buffer,X.byteOffset,J)}let K=Buffer.allocUnsafe(J);do{let X=this._buffers[0],Z=K.length-J;if(J>=X.length)K.set(this._buffers.shift(),Z);else K.set(new Uint8Array(X.buffer,X.byteOffset,J),Z),this._buffers[0]=new G0(X.buffer,X.byteOffset+J,X.length-J);J-=X.length}while(J>0);return K}startLoop(J){this._loop=!0;do switch(this._state){case 0:this.getInfo(J);break;case 1:this.getPayloadLength16(J);break;case 2:this.getPayloadLength64(J);break;case 3:this.getMask();break;case 4:this.getData(J);break;case 5:case 6:this._loop=!1;return}while(this._loop);if(!this._errored)J()}getInfo(J){if(this._bufferedBytes<2){this._loop=!1;return}let K=this.consume(2);if((K[0]&48)!==0){let Z=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");J(Z);return}let X=(K[0]&64)===64;if(X&&!this._extensions[a0.extensionName]){let Z=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");J(Z);return}if(this._fin=(K[0]&128)===128,this._opcode=K[0]&15,this._payloadLength=K[1]&127,this._opcode===0){if(X){let Z=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");J(Z);return}if(!this._fragmented){let Z=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");J(Z);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let Z=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");J(Z);return}this._compressed=X}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let Z=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");J(Z);return}if(X){let Z=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");J(Z);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let Z=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");J(Z);return}}else{let Z=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");J(Z);return}if(!this._fin&&!this._fragmented)this._fragmented=this._opcode;if(this._masked=(K[1]&128)===128,this._isServer){if(!this._masked){let Z=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");J(Z);return}}else if(this._masked){let Z=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");J(Z);return}if(this._payloadLength===126)this._state=1;else if(this._payloadLength===127)this._state=2;else this.haveLength(J)}getPayloadLength16(J){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(J)}getPayloadLength64(J){if(this._bufferedBytes<8){this._loop=!1;return}let K=this.consume(8),X=K.readUInt32BE(0);if(X>Math.pow(2,21)-1){let Z=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");J(Z);return}this._payloadLength=X*Math.pow(2,32)+K.readUInt32BE(4),this.haveLength(J)}haveLength(J){if(this._payloadLength&&this._opcode<8){if(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0){let K=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");J(K);return}}if(this._masked)this._state=3;else this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(J){let K=s0;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}if(K=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0)Z1(K,this._mask)}if(this._opcode>7){this.controlMessage(K,J);return}if(this._compressed){this._state=5,this.decompress(K,J);return}if(K.length)this._messageLength=this._totalPayloadLength,this._fragments.push(K);this.dataMessage(J)}decompress(J,K){this._extensions[a0.extensionName].decompress(J,this._fin,(Z,$)=>{if(Z)return K(Z);if($.length){if(this._messageLength+=$.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let Q=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");K(Q);return}this._fragments.push($)}if(this.dataMessage(K),this._state===0)this.startLoop(K)})}dataMessage(J){if(!this._fin){this._state=0;return}let K=this._messageLength,X=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let Z;if(this._binaryType==="nodebuffer")Z=M0(X,K);else if(this._binaryType==="arraybuffer")Z=X1(M0(X,K));else if(this._binaryType==="blob")Z=new Blob(X);else Z=X;if(this._allowSynchronousEvents)this.emit("message",Z,!0),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",Z,!0),this._state=0,this.startLoop(J)})}else{let Z=M0(X,K);if(!this._skipUTF8Validation&&!o0(Z)){let $=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");J($);return}if(this._state===5||this._allowSynchronousEvents)this.emit("message",Z,!1),this._state=0;else this._state=6,setImmediate(()=>{this.emit("message",Z,!1),this._state=0,this.startLoop(J)})}}controlMessage(J,K){if(this._opcode===8){if(J.length===0)this._loop=!1,this.emit("conclude",1005,s0),this.end();else{let X=J.readUInt16BE(0);if(!$1(X)){let $=this.createError(RangeError,`invalid status code ${X}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");K($);return}let Z=new G0(J.buffer,J.byteOffset+2,J.length-2);if(!this._skipUTF8Validation&&!o0(Z)){let $=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");K($);return}this._loop=!1,this.emit("conclude",X,Z),this.end()}this._state=0;return}if(this._allowSynchronousEvents)this.emit(this._opcode===9?"ping":"pong",J),this._state=0;else this._state=6,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",J),this._state=0,this.startLoop(K)})}createError(J,K,X,Z,$){this._loop=!1,this._errored=!0;let Q=new J(X?`Invalid WebSocket frame: ${K}`:K);return Error.captureStackTrace(Q,this.createError),Q.code=$,Q[J1]=Z,Q}}e0.exports=t0});var B0=P((A4,X5)=>{var{Duplex:R4}=R("stream"),{randomFillSync:Q1}=R("crypto"),J5=a(),{EMPTY_BUFFER:G1,kWebSocket:I1,NOOP:z1}=C(),{isBlob:p,isValidStatusCode:j1}=l(),{mask:K5,toBuffer:S}=n(),T=Symbol("kByteLength"),Y1=Buffer.alloc(4),v,b=8192,x=0,V1=1,_1=2;class W{constructor(J,K,X){if(this._extensions=K||{},X)this._generateMask=X,this._maskBuffer=Buffer.alloc(4);this._socket=J,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=x,this.onerror=z1,this[I1]=void 0}static frame(J,K){let X,Z=!1,$=2,Q=!1;if(K.mask){if(X=K.maskBuffer||Y1,K.generateMask)K.generateMask(X);else{if(b===8192){if(v===void 0)v=Buffer.alloc(8192);Q1(v,0,8192),b=0}X[0]=v[b++],X[1]=v[b++],X[2]=v[b++],X[3]=v[b++]}Q=(X[0]|X[1]|X[2]|X[3])===0,$=6}let G;if(typeof J==="string")if((!K.mask||Q)&&K[T]!==void 0)G=K[T];else J=Buffer.from(J),G=J.length;else G=J.length,Z=K.mask&&K.readOnly&&!Q;let z=G;if(G>=65536)$+=8,z=127;else if(G>125)$+=2,z=126;let I=Buffer.allocUnsafe(Z?G+$:$);if(I[0]=K.fin?K.opcode|128:K.opcode,K.rsv1)I[0]|=64;if(I[1]=z,z===126)I.writeUInt16BE(G,2);else if(z===127)I[2]=I[3]=0,I.writeUIntBE(G,4,6);if(!K.mask)return[I,J];if(I[1]|=128,I[$-4]=X[0],I[$-3]=X[1],I[$-2]=X[2],I[$-1]=X[3],Q)return[I,J];if(Z)return K5(J,X,I,$,G),[I];return K5(J,X,J,0,G),[I,J]}close(J,K,X,Z){let $;if(J===void 0)$=G1;else if(typeof J!=="number"||!j1(J))throw TypeError("First argument must be a valid error code number");else if(K===void 0||!K.length)$=Buffer.allocUnsafe(2),$.writeUInt16BE(J,0);else{let G=Buffer.byteLength(K);if(G>123)throw RangeError("The message must not be greater than 123 bytes");if($=Buffer.allocUnsafe(2+G),$.writeUInt16BE(J,0),typeof K==="string")$.write(K,2);else $.set(K,2)}let Q={[T]:$.length,fin:!0,generateMask:this._generateMask,mask:X,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};if(this._state!==x)this.enqueue([this.dispatch,$,!1,Q,Z]);else this.sendFrame(W.frame($,Q),Z)}ping(J,K,X){let Z,$;if(typeof J==="string")Z=Buffer.byteLength(J),$=!1;else if(p(J))Z=J.size,$=!1;else J=S(J),Z=J.length,$=S.readOnly;if(Z>125)throw RangeError("The data size must not be greater than 125 bytes");let Q={[T]:Z,fin:!0,generateMask:this._generateMask,mask:K,maskBuffer:this._maskBuffer,opcode:9,readOnly:$,rsv1:!1};if(p(J))if(this._state!==x)this.enqueue([this.getBlobData,J,!1,Q,X]);else this.getBlobData(J,!1,Q,X);else if(this._state!==x)this.enqueue([this.dispatch,J,!1,Q,X]);else this.sendFrame(W.frame(J,Q),X)}pong(J,K,X){let Z,$;if(typeof J==="string")Z=Buffer.byteLength(J),$=!1;else if(p(J))Z=J.size,$=!1;else J=S(J),Z=J.length,$=S.readOnly;if(Z>125)throw RangeError("The data size must not be greater than 125 bytes");let Q={[T]:Z,fin:!0,generateMask:this._generateMask,mask:K,maskBuffer:this._maskBuffer,opcode:10,readOnly:$,rsv1:!1};if(p(J))if(this._state!==x)this.enqueue([this.getBlobData,J,!1,Q,X]);else this.getBlobData(J,!1,Q,X);else if(this._state!==x)this.enqueue([this.dispatch,J,!1,Q,X]);else this.sendFrame(W.frame(J,Q),X)}send(J,K,X){let Z=this._extensions[J5.extensionName],$=K.binary?2:1,Q=K.compress,G,z;if(typeof J==="string")G=Buffer.byteLength(J),z=!1;else if(p(J))G=J.size,z=!1;else J=S(J),G=J.length,z=S.readOnly;if(this._firstFragment){if(this._firstFragment=!1,Q&&Z&&Z.params[Z._isServer?"server_no_context_takeover":"client_no_context_takeover"])Q=G>=Z._threshold;this._compress=Q}else Q=!1,$=0;if(K.fin)this._firstFragment=!0;let I={[T]:G,fin:K.fin,generateMask:this._generateMask,mask:K.mask,maskBuffer:this._maskBuffer,opcode:$,readOnly:z,rsv1:Q};if(p(J))if(this._state!==x)this.enqueue([this.getBlobData,J,this._compress,I,X]);else this.getBlobData(J,this._compress,I,X);else if(this._state!==x)this.enqueue([this.dispatch,J,this._compress,I,X]);else this.dispatch(J,this._compress,I,X)}getBlobData(J,K,X,Z){this._bufferedBytes+=X[T],this._state=_1,J.arrayBuffer().then(($)=>{if(this._socket.destroyed){let G=Error("The socket was closed while the blob was being read");process.nextTick(x0,this,G,Z);return}this._bufferedBytes-=X[T];let Q=S($);if(!K)this._state=x,this.sendFrame(W.frame(Q,X),Z),this.dequeue();else this.dispatch(Q,K,X,Z)}).catch(($)=>{process.nextTick(N1,this,$,Z)})}dispatch(J,K,X,Z){if(!K){this.sendFrame(W.frame(J,X),Z);return}let $=this._extensions[J5.extensionName];this._bufferedBytes+=X[T],this._state=V1,$.compress(J,X.fin,(Q,G)=>{if(this._socket.destroyed){let z=Error("The socket was closed while data was being compressed");x0(this,z,Z);return}this._bufferedBytes-=X[T],this._state=x,X.readOnly=!1,this.sendFrame(W.frame(G,X),Z),this.dequeue()})}dequeue(){while(this._state===x&&this._queue.length){let J=this._queue.shift();this._bufferedBytes-=J[3][T],Reflect.apply(J[0],this,J.slice(1))}}enqueue(J){this._bufferedBytes+=J[3][T],this._queue.push(J)}sendFrame(J,K){if(J.length===2)this._socket.cork(),this._socket.write(J[0]),this._socket.write(J[1],K),this._socket.uncork();else this._socket.write(J[0],K)}}X5.exports=W;function x0(J,K,X){if(typeof X==="function")X(K);for(let Z=0;Z<J._queue.length;Z++){let $=J._queue[Z],Q=$[$.length-1];if(typeof Q==="function")Q(K)}}function N1(J,K,X){x0(J,K,X),J.onerror(K)}});var V5=P((F4,Y5)=>{var{kForOnEventAttribute:s,kListener:C0}=C(),Z5=Symbol("kCode"),$5=Symbol("kData"),Q5=Symbol("kError"),G5=Symbol("kMessage"),I5=Symbol("kReason"),k=Symbol("kTarget"),z5=Symbol("kType"),j5=Symbol("kWasClean");class E{constructor(J){this[k]=null,this[z5]=J}get target(){return this[k]}get type(){return this[z5]}}Object.defineProperty(E.prototype,"target",{enumerable:!0});Object.defineProperty(E.prototype,"type",{enumerable:!0});class i extends E{constructor(J,K={}){super(J);this[Z5]=K.code===void 0?0:K.code,this[I5]=K.reason===void 0?"":K.reason,this[j5]=K.wasClean===void 0?!1:K.wasClean}get code(){return this[Z5]}get reason(){return this[I5]}get wasClean(){return this[j5]}}Object.defineProperty(i.prototype,"code",{enumerable:!0});Object.defineProperty(i.prototype,"reason",{enumerable:!0});Object.defineProperty(i.prototype,"wasClean",{enumerable:!0});class o extends E{constructor(J,K={}){super(J);this[Q5]=K.error===void 0?null:K.error,this[G5]=K.message===void 0?"":K.message}get error(){return this[Q5]}get message(){return this[G5]}}Object.defineProperty(o.prototype,"error",{enumerable:!0});Object.defineProperty(o.prototype,"message",{enumerable:!0});class z0 extends E{constructor(J,K={}){super(J);this[$5]=K.data===void 0?null:K.data}get data(){return this[$5]}}Object.defineProperty(z0.prototype,"data",{enumerable:!0});var H1={addEventListener(J,K,X={}){for(let $ of this.listeners(J))if(!X[s]&&$[C0]===K&&!$[s])return;let Z;if(J==="message")Z=function(Q,G){let z=new z0("message",{data:G?Q:Q.toString()});z[k]=this,I0(K,this,z)};else if(J==="close")Z=function(Q,G){let z=new i("close",{code:Q,reason:G.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});z[k]=this,I0(K,this,z)};else if(J==="error")Z=function(Q){let G=new o("error",{error:Q,message:Q.message});G[k]=this,I0(K,this,G)};else if(J==="open")Z=function(){let Q=new E("open");Q[k]=this,I0(K,this,Q)};else return;if(Z[s]=!!X[s],Z[C0]=K,X.once)this.once(J,Z);else this.on(J,Z)},removeEventListener(J,K){for(let X of this.listeners(J))if(X[C0]===K&&!X[s]){this.removeListener(J,X);break}}};Y5.exports={CloseEvent:i,ErrorEvent:o,Event:E,EventTarget:H1,MessageEvent:z0};function I0(J,K,X){if(typeof J==="object"&&J.handleEvent)J.handleEvent.call(J,X);else J.call(K,X)}});var q0=P((D4,_5)=>{var{tokenChars:t}=l();function B(J,K,X){if(J[K]===void 0)J[K]=[X];else J[K].push(X)}function R1(J){let K=Object.create(null),X=Object.create(null),Z=!1,$=!1,Q=!1,G,z,I=-1,V=-1,_=-1,Y=0;for(;Y<J.length;Y++)if(V=J.charCodeAt(Y),G===void 0)if(_===-1&&t[V]===1){if(I===-1)I=Y}else if(Y!==0&&(V===32||V===9)){if(_===-1&&I!==-1)_=Y}else if(V===59||V===44){if(I===-1)throw SyntaxError(`Unexpected character at index ${Y}`);if(_===-1)_=Y;let D=J.slice(I,_);if(V===44)B(K,D,X),X=Object.create(null);else G=D;I=_=-1}else throw SyntaxError(`Unexpected character at index ${Y}`);else if(z===void 0)if(_===-1&&t[V]===1){if(I===-1)I=Y}else if(V===32||V===9){if(_===-1&&I!==-1)_=Y}else if(V===59||V===44){if(I===-1)throw SyntaxError(`Unexpected character at index ${Y}`);if(_===-1)_=Y;if(B(X,J.slice(I,_),!0),V===44)B(K,G,X),X=Object.create(null),G=void 0;I=_=-1}else if(V===61&&I!==-1&&_===-1)z=J.slice(I,Y),I=_=-1;else throw SyntaxError(`Unexpected character at index ${Y}`);else if($){if(t[V]!==1)throw SyntaxError(`Unexpected character at index ${Y}`);if(I===-1)I=Y;else if(!Z)Z=!0;$=!1}else if(Q)if(t[V]===1){if(I===-1)I=Y}else if(V===34&&I!==-1)Q=!1,_=Y;else if(V===92)$=!0;else throw SyntaxError(`Unexpected character at index ${Y}`);else if(V===34&&J.charCodeAt(Y-1)===61)Q=!0;else if(_===-1&&t[V]===1){if(I===-1)I=Y}else if(I!==-1&&(V===32||V===9)){if(_===-1)_=Y}else if(V===59||V===44){if(I===-1)throw SyntaxError(`Unexpected character at index ${Y}`);if(_===-1)_=Y;let D=J.slice(I,_);if(Z)D=D.replace(/\\/g,""),Z=!1;if(B(X,z,D),V===44)B(K,G,X),X=Object.create(null),G=void 0;z=void 0,I=_=-1}else throw SyntaxError(`Unexpected character at index ${Y}`);if(I===-1||Q||V===32||V===9)throw SyntaxError("Unexpected end of input");if(_===-1)_=Y;let F=J.slice(I,_);if(G===void 0)B(K,F,X);else{if(z===void 0)B(X,F,!0);else if(Z)B(X,z,F.replace(/\\/g,""));else B(X,z,F);B(K,G,X)}return K}function A1(J){return Object.keys(J).map((K)=>{let X=J[K];if(!Array.isArray(X))X=[X];return X.map((Z)=>{return[K].concat(Object.keys(Z).map(($)=>{let Q=Z[$];if(!Array.isArray(Q))Q=[Q];return Q.map((G)=>G===!0?$:`${$}=${G}`).join("; ")})).join("; ")}).join(", ")}).join(", ")}_5.exports={format:A1,parse:R1}});var _0=P((M4,B5)=>{var F1=R("events"),D1=R("https"),O1=R("http"),R5=R("net"),P1=R("tls"),{randomBytes:M1,createHash:T1}=R("crypto"),{Duplex:O4,Readable:P4}=R("stream"),{URL:U0}=R("url"),y=a(),x1=T0(),B1=B0(),{isBlob:C1}=l(),{BINARY_TYPES:N5,CLOSE_TIMEOUT:q1,EMPTY_BUFFER:j0,GUID:U1,kForOnEventAttribute:L0,kListener:L1,kStatusCode:W1,kWebSocket:A,NOOP:A5}=C(),{EventTarget:{addEventListener:E1,removeEventListener:y1}}=V5(),{format:S1,parse:v1}=q0(),{toBuffer:g1}=n(),F5=Symbol("kAborted"),W0=[8,13],U=["CONNECTING","OPEN","CLOSING","CLOSED"],w1=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;class j extends F1{constructor(J,K,X){super();if(this._binaryType=N5[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=j0,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=j.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,J!==null){if(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,K===void 0)K=[];else if(!Array.isArray(K))if(typeof K==="object"&&K!==null)X=K,K=[];else K=[K];D5(this,J,K,X)}else this._autoPong=X.autoPong,this._closeTimeout=X.closeTimeout,this._isServer=!0}get binaryType(){return this._binaryType}set binaryType(J){if(!N5.includes(J))return;if(this._binaryType=J,this._receiver)this._receiver._binaryType=J}get bufferedAmount(){if(!this._socket)return this._bufferedAmount;return this._socket._writableState.length+this._sender._bufferedBytes}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(J,K,X){let Z=new x1({allowSynchronousEvents:X.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:X.maxPayload,skipUTF8Validation:X.skipUTF8Validation}),$=new B1(J,this._extensions,X.generateMask);if(this._receiver=Z,this._sender=$,this._socket=J,Z[A]=this,$[A]=this,J[A]=this,Z.on("conclude",f1),Z.on("drain",u1),Z.on("error",l1),Z.on("message",p1),Z.on("ping",b1),Z.on("pong",k1),$.onerror=i1,J.setTimeout)J.setTimeout(0);if(J.setNoDelay)J.setNoDelay();if(K.length>0)J.unshift(K);J.on("close",M5),J.on("data",V0),J.on("end",T5),J.on("error",x5),this._readyState=j.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=j.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}if(this._extensions[y.extensionName])this._extensions[y.extensionName].cleanup();this._receiver.removeAllListeners(),this._readyState=j.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(J,K){if(this.readyState===j.CLOSED)return;if(this.readyState===j.CONNECTING){M(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===j.CLOSING){if(this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted))this._socket.end();return}this._readyState=j.CLOSING,this._sender.close(J,K,!this._isServer,(X)=>{if(X)return;if(this._closeFrameSent=!0,this._closeFrameReceived||this._receiver._writableState.errorEmitted)this._socket.end()}),P5(this)}pause(){if(this.readyState===j.CONNECTING||this.readyState===j.CLOSED)return;this._paused=!0,this._socket.pause()}ping(J,K,X){if(this.readyState===j.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof J==="function")X=J,J=K=void 0;else if(typeof K==="function")X=K,K=void 0;if(typeof J==="number")J=J.toString();if(this.readyState!==j.OPEN){E0(this,J,X);return}if(K===void 0)K=!this._isServer;this._sender.ping(J||j0,K,X)}pong(J,K,X){if(this.readyState===j.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof J==="function")X=J,J=K=void 0;else if(typeof K==="function")X=K,K=void 0;if(typeof J==="number")J=J.toString();if(this.readyState!==j.OPEN){E0(this,J,X);return}if(K===void 0)K=!this._isServer;this._sender.pong(J||j0,K,X)}resume(){if(this.readyState===j.CONNECTING||this.readyState===j.CLOSED)return;if(this._paused=!1,!this._receiver._writableState.needDrain)this._socket.resume()}send(J,K,X){if(this.readyState===j.CONNECTING)throw Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof K==="function")X=K,K={};if(typeof J==="number")J=J.toString();if(this.readyState!==j.OPEN){E0(this,J,X);return}let Z={binary:typeof J!=="string",mask:!this._isServer,compress:!0,fin:!0,...K};if(!this._extensions[y.extensionName])Z.compress=!1;this._sender.send(J||j0,Z,X)}terminate(){if(this.readyState===j.CLOSED)return;if(this.readyState===j.CONNECTING){M(this,this._req,"WebSocket was closed before the connection was established");return}if(this._socket)this._readyState=j.CLOSING,this._socket.destroy()}}Object.defineProperty(j,"CONNECTING",{enumerable:!0,value:U.indexOf("CONNECTING")});Object.defineProperty(j.prototype,"CONNECTING",{enumerable:!0,value:U.indexOf("CONNECTING")});Object.defineProperty(j,"OPEN",{enumerable:!0,value:U.indexOf("OPEN")});Object.defineProperty(j.prototype,"OPEN",{enumerable:!0,value:U.indexOf("OPEN")});Object.defineProperty(j,"CLOSING",{enumerable:!0,value:U.indexOf("CLOSING")});Object.defineProperty(j.prototype,"CLOSING",{enumerable:!0,value:U.indexOf("CLOSING")});Object.defineProperty(j,"CLOSED",{enumerable:!0,value:U.indexOf("CLOSED")});Object.defineProperty(j.prototype,"CLOSED",{enumerable:!0,value:U.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach((J)=>{Object.defineProperty(j.prototype,J,{enumerable:!0})});["open","error","close","message"].forEach((J)=>{Object.defineProperty(j.prototype,`on${J}`,{enumerable:!0,get(){for(let K of this.listeners(J))if(K[L0])return K[L1];return null},set(K){for(let X of this.listeners(J))if(X[L0]){this.removeListener(J,X);break}if(typeof K!=="function")return;this.addEventListener(J,K,{[L0]:!0})}})});j.prototype.addEventListener=E1;j.prototype.removeEventListener=y1;B5.exports=j;function D5(J,K,X,Z){let $={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:q1,protocolVersion:W0[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...Z,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(J._autoPong=$.autoPong,J._closeTimeout=$.closeTimeout,!W0.includes($.protocolVersion))throw RangeError(`Unsupported protocol version: ${$.protocolVersion} (supported versions: ${W0.join(", ")})`);let Q;if(K instanceof U0)Q=K;else try{Q=new U0(K)}catch(N){throw SyntaxError(`Invalid URL: ${K}`)}if(Q.protocol==="http:")Q.protocol="ws:";else if(Q.protocol==="https:")Q.protocol="wss:";J._url=Q.href;let G=Q.protocol==="wss:",z=Q.protocol==="ws+unix:",I;if(Q.protocol!=="ws:"&&!G&&!z)I=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;else if(z&&!Q.pathname)I="The URL's pathname is empty";else if(Q.hash)I="The URL contains a fragment identifier";if(I){let N=SyntaxError(I);if(J._redirects===0)throw N;else{Y0(J,N);return}}let V=G?443:80,_=M1(16).toString("base64"),Y=G?D1.request:O1.request,F=new Set,D;if($.createConnection=$.createConnection||(G?m1:h1),$.defaultPort=$.defaultPort||V,$.port=Q.port||V,$.host=Q.hostname.startsWith("[")?Q.hostname.slice(1,-1):Q.hostname,$.headers={...$.headers,"Sec-WebSocket-Version":$.protocolVersion,"Sec-WebSocket-Key":_,Connection:"Upgrade",Upgrade:"websocket"},$.path=Q.pathname+Q.search,$.timeout=$.handshakeTimeout,$.perMessageDeflate)D=new y($.perMessageDeflate!==!0?$.perMessageDeflate:{},!1,$.maxPayload),$.headers["Sec-WebSocket-Extensions"]=S1({[y.extensionName]:D.offer()});if(X.length){for(let N of X){if(typeof N!=="string"||!w1.test(N)||F.has(N))throw SyntaxError("An invalid or duplicated subprotocol was specified");F.add(N)}$.headers["Sec-WebSocket-Protocol"]=X.join(",")}if($.origin)if($.protocolVersion<13)$.headers["Sec-WebSocket-Origin"]=$.origin;else $.headers.Origin=$.origin;if(Q.username||Q.password)$.auth=`${Q.username}:${Q.password}`;if(z){let N=$.path.split(":");$.socketPath=N[0],$.path=N[1]}let H;if($.followRedirects){if(J._redirects===0){J._originalIpc=z,J._originalSecure=G,J._originalHostOrSocketPath=z?$.socketPath:Q.host;let N=Z&&Z.headers;if(Z={...Z,headers:{}},N)for(let[O,h]of Object.entries(N))Z.headers[O.toLowerCase()]=h}else if(J.listenerCount("redirect")===0){let N=z?J._originalIpc?$.socketPath===J._originalHostOrSocketPath:!1:J._originalIpc?!1:Q.host===J._originalHostOrSocketPath;if(!N||J._originalSecure&&!G){if(delete $.headers.authorization,delete $.headers.cookie,!N)delete $.headers.host;$.auth=void 0}}if($.auth&&!Z.headers.authorization)Z.headers.authorization="Basic "+Buffer.from($.auth).toString("base64");if(H=J._req=Y($),J._redirects)J.emit("redirect",J.url,H)}else H=J._req=Y($);if($.timeout)H.on("timeout",()=>{M(J,H,"Opening handshake has timed out")});if(H.on("error",(N)=>{if(H===null||H[F5])return;H=J._req=null,Y0(J,N)}),H.on("response",(N)=>{let O=N.headers.location,h=N.statusCode;if(O&&$.followRedirects&&h>=300&&h<400){if(++J._redirects>$.maxRedirects){M(J,H,"Maximum redirects exceeded");return}H.abort();let d;try{d=new U0(O,K)}catch(y0){let m=SyntaxError(`Invalid URL: ${O}`);Y0(J,m);return}D5(J,d,X,Z)}else if(!J.emit("unexpected-response",H,N))M(J,H,`Unexpected server response: ${N.statusCode}`)}),H.on("upgrade",(N,O,h)=>{if(J.emit("upgrade",N),J.readyState!==j.CONNECTING)return;H=J._req=null;let d=N.headers.upgrade;if(d===void 0||d.toLowerCase()!=="websocket"){M(J,O,"Invalid Upgrade header");return}let y0=T1("sha1").update(_+U1).digest("base64");if(N.headers["sec-websocket-accept"]!==y0){M(J,O,"Invalid Sec-WebSocket-Accept header");return}let m=N.headers["sec-websocket-protocol"],c;if(m!==void 0){if(!F.size)c="Server sent a subprotocol but none was requested";else if(!F.has(m))c="Server sent an invalid subprotocol"}else if(F.size)c="Server sent no subprotocol";if(c){M(J,O,c);return}if(m)J._protocol=m;let S0=N.headers["sec-websocket-extensions"];if(S0!==void 0){if(!D){M(J,O,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let R0;try{R0=v1(S0)}catch(A0){M(J,O,"Invalid Sec-WebSocket-Extensions header");return}let v0=Object.keys(R0);if(v0.length!==1||v0[0]!==y.extensionName){M(J,O,"Server indicated an extension that was not requested");return}try{D.accept(R0[y.extensionName])}catch(A0){M(J,O,"Invalid Sec-WebSocket-Extensions header");return}J._extensions[y.extensionName]=D}J.setSocket(O,h,{allowSynchronousEvents:$.allowSynchronousEvents,generateMask:$.generateMask,maxPayload:$.maxPayload,skipUTF8Validation:$.skipUTF8Validation})}),$.finishRequest)$.finishRequest(H,J);else H.end()}function Y0(J,K){J._readyState=j.CLOSING,J._errorEmitted=!0,J.emit("error",K),J.emitClose()}function h1(J){return J.path=J.socketPath,R5.connect(J)}function m1(J){if(J.path=void 0,!J.servername&&J.servername!=="")J.servername=R5.isIP(J.host)?"":J.host;return P1.connect(J)}function M(J,K,X){J._readyState=j.CLOSING;let Z=Error(X);if(Error.captureStackTrace(Z,M),K.setHeader){if(K[F5]=!0,K.abort(),K.socket&&!K.socket.destroyed)K.socket.destroy();process.nextTick(Y0,J,Z)}else K.destroy(Z),K.once("error",J.emit.bind(J,"error")),K.once("close",J.emitClose.bind(J))}function E0(J,K,X){if(K){let Z=C1(K)?K.size:g1(K).length;if(J._socket)J._sender._bufferedBytes+=Z;else J._bufferedAmount+=Z}if(X){let Z=Error(`WebSocket is not open: readyState ${J.readyState} (${U[J.readyState]})`);process.nextTick(X,Z)}}function f1(J,K){let X=this[A];if(X._closeFrameReceived=!0,X._closeMessage=K,X._closeCode=J,X._socket[A]===void 0)return;if(X._socket.removeListener("data",V0),process.nextTick(O5,X._socket),J===1005)X.close();else X.close(J,K)}function u1(){let J=this[A];if(!J.isPaused)J._socket.resume()}function l1(J){let K=this[A];if(K._socket[A]!==void 0)K._socket.removeListener("data",V0),process.nextTick(O5,K._socket),K.close(J[W1]);if(!K._errorEmitted)K._errorEmitted=!0,K.emit("error",J)}function H5(){this[A].emitClose()}function p1(J,K){this[A].emit("message",J,K)}function b1(J){let K=this[A];if(K._autoPong)K.pong(J,!this._isServer,A5);K.emit("ping",J)}function k1(J){this[A].emit("pong",J)}function O5(J){J.resume()}function i1(J){let K=this[A];if(K.readyState===j.CLOSED)return;if(K.readyState===j.OPEN)K._readyState=j.CLOSING,P5(K);if(this._socket.end(),!K._errorEmitted)K._errorEmitted=!0,K.emit("error",J)}function P5(J){J._closeTimer=setTimeout(J._socket.destroy.bind(J._socket),J._closeTimeout)}function M5(){let J=this[A];if(this.removeListener("close",M5),this.removeListener("data",V0),this.removeListener("end",T5),J._readyState=j.CLOSING,!this._readableState.endEmitted&&!J._closeFrameReceived&&!J._receiver._writableState.errorEmitted&&this._readableState.length!==0){let K=this.read(this._readableState.length);J._receiver.write(K)}if(J._receiver.end(),this[A]=void 0,clearTimeout(J._closeTimer),J._receiver._writableState.finished||J._receiver._writableState.errorEmitted)J.emitClose();else J._receiver.on("error",H5),J._receiver.on("finish",H5)}function V0(J){if(!this[A]._receiver.write(J))this.pause()}function T5(){let J=this[A];J._readyState=j.CLOSING,J._receiver.end(),this.end()}function x5(){let J=this[A];if(this.removeListener("error",x5),this.on("error",A5),J)J._readyState=j.CLOSING,this.destroy()}});var L5=P((x4,U5)=>{var T4=_0(),{Duplex:d1}=R("stream");function C5(J){J.emit("close")}function c1(){if(!this.destroyed&&this._writableState.finished)this.destroy()}function q5(J){if(this.removeListener("error",q5),this.destroy(),this.listenerCount("error")===0)this.emit("error",J)}function n1(J,K){let X=!0,Z=new d1({...K,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return J.on("message",function(Q,G){let z=!G&&Z._readableState.objectMode?Q.toString():Q;if(!Z.push(z))J.pause()}),J.once("error",function(Q){if(Z.destroyed)return;X=!1,Z.destroy(Q)}),J.once("close",function(){if(Z.destroyed)return;Z.push(null)}),Z._destroy=function($,Q){if(J.readyState===J.CLOSED){Q($),process.nextTick(C5,Z);return}let G=!1;if(J.once("error",function(I){G=!0,Q(I)}),J.once("close",function(){if(!G)Q($);process.nextTick(C5,Z)}),X)J.terminate()},Z._final=function($){if(J.readyState===J.CONNECTING){J.once("open",function(){Z._final($)});return}if(J._socket===null)return;if(J._socket._writableState.finished){if($(),Z._readableState.endEmitted)Z.destroy()}else J._socket.once("finish",function(){$()}),J.close()},Z._read=function(){if(J.isPaused)J.resume()},Z._write=function($,Q,G){if(J.readyState===J.CONNECTING){J.once("open",function(){Z._write($,Q,G)});return}J.send($,G)},Z.on("end",c1),Z.on("error",q5),Z}U5.exports=n1});var E5=P((B4,W5)=>{var{tokenChars:r1}=l();function a1(J){let K=new Set,X=-1,Z=-1,$=0;for($;$<J.length;$++){let G=J.charCodeAt($);if(Z===-1&&r1[G]===1){if(X===-1)X=$}else if($!==0&&(G===32||G===9)){if(Z===-1&&X!==-1)Z=$}else if(G===44){if(X===-1)throw SyntaxError(`Unexpected character at index ${$}`);if(Z===-1)Z=$;let z=J.slice(X,Z);if(K.has(z))throw SyntaxError(`The "${z}" subprotocol is duplicated`);K.add(z),X=Z=-1}else throw SyntaxError(`Unexpected character at index ${$}`)}if(X===-1||Z!==-1)throw SyntaxError("Unexpected end of input");let Q=J.slice(X,$);if(K.has(Q))throw SyntaxError(`The "${Q}" subprotocol is duplicated`);return K.add(Q),K}W5.exports={parse:a1}});var w5=P((q4,g5)=>{var s1=R("events"),N0=R("http"),{Duplex:C4}=R("stream"),{createHash:o1}=R("crypto"),y5=q0(),g=a(),t1=E5(),e1=_0(),{CLOSE_TIMEOUT:J4,GUID:K4,kWebSocket:X4}=C(),Z4=/^[+/0-9A-Za-z]{22}==$/;class v5 extends s1{constructor(J,K){super();if(J={allowSynchronousEvents:!0,autoPong:!0,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:J4,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:e1,...J},J.port==null&&!J.server&&!J.noServer||J.port!=null&&(J.server||J.noServer)||J.server&&J.noServer)throw TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(J.port!=null)this._server=N0.createServer((X,Z)=>{let $=N0.STATUS_CODES[426];Z.writeHead(426,{"Content-Length":$.length,"Content-Type":"text/plain"}),Z.end($)}),this._server.listen(J.port,J.host,J.backlog,K);else if(J.server)this._server=J.server;if(this._server){let X=this.emit.bind(this,"connection");this._removeListeners=$4(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(Z,$,Q)=>{this.handleUpgrade(Z,$,Q,X)}})}if(J.perMessageDeflate===!0)J.perMessageDeflate={};if(J.clientTracking)this.clients=new Set,this._shouldEmitClose=!1;this.options=J,this._state=0}address(){if(this.options.noServer)throw Error('The server is operating in "noServer" mode');if(!this._server)return null;return this._server.address()}close(J){if(this._state===2){if(J)this.once("close",()=>{J(Error("The server is not running"))});process.nextTick(e,this);return}if(J)this.once("close",J);if(this._state===1)return;if(this._state=1,this.options.noServer||this.options.server){if(this._server)this._removeListeners(),this._removeListeners=this._server=null;if(this.clients)if(!this.clients.size)process.nextTick(e,this);else this._shouldEmitClose=!0;else process.nextTick(e,this)}else{let K=this._server;this._removeListeners(),this._removeListeners=this._server=null,K.close(()=>{e(this)})}}shouldHandle(J){if(this.options.path){let K=J.url.indexOf("?");if((K!==-1?J.url.slice(0,K):J.url)!==this.options.path)return!1}return!0}handleUpgrade(J,K,X,Z){K.on("error",S5);let $=J.headers["sec-websocket-key"],Q=J.headers.upgrade,G=+J.headers["sec-websocket-version"];if(J.method!=="GET"){w(this,J,K,405,"Invalid HTTP method");return}if(Q===void 0||Q.toLowerCase()!=="websocket"){w(this,J,K,400,"Invalid Upgrade header");return}if($===void 0||!Z4.test($)){w(this,J,K,400,"Missing or invalid Sec-WebSocket-Key header");return}if(G!==13&&G!==8){w(this,J,K,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(J)){J0(K,400);return}let z=J.headers["sec-websocket-protocol"],I=new Set;if(z!==void 0)try{I=t1.parse(z)}catch(Y){w(this,J,K,400,"Invalid Sec-WebSocket-Protocol header");return}let V=J.headers["sec-websocket-extensions"],_={};if(this.options.perMessageDeflate&&V!==void 0){let Y=new g(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let F=y5.parse(V);if(F[g.extensionName])Y.accept(F[g.extensionName]),_[g.extensionName]=Y}catch(F){w(this,J,K,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let Y={origin:J.headers[`${G===8?"sec-websocket-origin":"origin"}`],secure:!!(J.socket.authorized||J.socket.encrypted),req:J};if(this.options.verifyClient.length===2){this.options.verifyClient(Y,(F,D,H,N)=>{if(!F)return J0(K,D||401,H,N);this.completeUpgrade(_,$,I,J,K,X,Z)});return}if(!this.options.verifyClient(Y))return J0(K,401)}this.completeUpgrade(_,$,I,J,K,X,Z)}completeUpgrade(J,K,X,Z,$,Q,G){if(!$.readable||!$.writable)return $.destroy();if($[X4])throw Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>0)return J0($,503);let I=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${o1("sha1").update(K+K4).digest("base64")}`],V=new this.options.WebSocket(null,void 0,this.options);if(X.size){let _=this.options.handleProtocols?this.options.handleProtocols(X,Z):X.values().next().value;if(_)I.push(`Sec-WebSocket-Protocol: ${_}`),V._protocol=_}if(J[g.extensionName]){let _=J[g.extensionName].params,Y=y5.format({[g.extensionName]:[_]});I.push(`Sec-WebSocket-Extensions: ${Y}`),V._extensions=J}if(this.emit("headers",I,Z),$.write(I.concat(`\r
|
|
2
|
-
`).join(`\r
|
|
3
|
-
`)),$.removeListener("error",S5),V.setSocket($,Q,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients)this.clients.add(V),V.on("close",()=>{if(this.clients.delete(V),this._shouldEmitClose&&!this.clients.size)process.nextTick(e,this)});G(V,Z)}}g5.exports=v5;function $4(J,K){for(let X of Object.keys(K))J.on(X,K[X]);return function(){for(let Z of Object.keys(K))J.removeListener(Z,K[Z])}}function e(J){J._state=2,J.emit("close")}function S5(){this.destroy()}function J0(J,K,X,Z){X=X||N0.STATUS_CODES[K],Z={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(X),...Z},J.once("finish",J.destroy),J.end(`HTTP/1.1 ${K} ${N0.STATUS_CODES[K]}\r
|
|
4
|
-
`+Object.keys(Z).map(($)=>`${$}: ${Z[$]}`).join(`\r
|
|
5
|
-
`)+`\r
|
|
6
|
-
\r
|
|
7
|
-
`+X)}function w(J,K,X,Z,$,Q){if(J.listenerCount("wsClientError")){let G=Error($);Error.captureStackTrace(G,w),J.emit("wsClientError",G,X,K)}else J0(X,Z,$,Q)}});var Q4=K0(L5(),1),G4=K0(T0(),1),I4=K0(B0(),1),h5=K0(_0(),1),z4=K0(w5(),1);var m5=h5.default;var H0=global;H0.WebSocket||=m5;H0.window||=global;H0.self||=global;H0.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__=[{type:1,value:7,isEnabled:!0},{type:2,value:"InternalApp",isEnabled:!0,isValid:!0},{type:2,value:"InternalAppContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdoutContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStderrContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalStdinContext",isEnabled:!0,isValid:!0},{type:2,value:"InternalFocusContext",isEnabled:!0,isValid:!0}];import f5 from"react-devtools-core";f5.initialize();f5.connectToDevTools();
|
package/dist/chunk-5rr85f28.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ob as D}from"./chunk-cyexd09c.js";import{yb as $}from"./chunk-kba8akjs.js";class X{manager;routes=[];constructor(B){this.manager=B,this.registerRoutes()}registerRoutes(){this.addRoute("GET","/api/config",this.getConfig.bind(this)),this.addRoute("POST","/api/config",this.updateConfig.bind(this)),this.addRoute("GET","/api/skills",this.listSkills.bind(this)),this.addRoute("GET","/api/skill",this.getSkill.bind(this)),this.addRoute("PUT","/api/skill",this.saveSkill.bind(this)),this.addRoute("DELETE","/api/skill",this.deleteSkill.bind(this)),this.addRoute("POST","/api/skills/sync",this.syncSkills.bind(this)),this.addRoute("GET","/api/plugins",this.listPlugins.bind(this)),this.addRoute("GET","/api/plugin/config",this.getPluginConfig.bind(this)),this.addRoute("PUT","/api/plugin/config",this.updatePluginConfig.bind(this)),this.addRoute("POST","/api/plugin/install",this.installPlugin.bind(this)),this.addRoute("DELETE","/api/plugin",this.uninstallPlugin.bind(this)),this.addRoute("GET","/api/health",this.healthCheck.bind(this))}addRoute(B,G,Q){this.routes.push({method:B,pathname:G,handler:Q})}matchRoute(B,G){return B===G}async fetch(B){let G=new URL(B.url),Q=B.method,V=G.pathname;for(let W of this.routes){if(W.method!==Q)continue;if(!this.matchRoute(W.pathname,V))continue;try{return await W.handler(B)}catch(N){return this.errorResponse(N)}}return this.notFoundResponse()}jsonResponse(B,G=200){return new Response(JSON.stringify(B),{status:G,headers:{"Content-Type":"application/json"}})}errorResponse(B){console.error("Request error:",B);let G=B instanceof Error?B.message:"Internal server error";return this.jsonResponse({error:G},500)}notFoundResponse(){return this.jsonResponse({error:"Not found"},404)}async parseJson(B){let G=await B.text();if(!G)throw Error("Request body is empty");return JSON.parse(G)}getQueryParam(B,G){return new URL(B.url).searchParams.get(G)}requireQueryParam(B,G){let Q=this.getQueryParam(B,G);if(!Q)throw Error(`Missing required query parameter: ${G}`);return Q}async healthCheck(){return this.jsonResponse({status:"ok",timestamp:Date.now()})}async getConfig(){let B=await this.manager.getConfig();return this.jsonResponse(B)}async updateConfig(B){let G=await this.parseJson(B);return await this.manager.updateConfig(G),this.jsonResponse({success:!0})}async listSkills(){let B=await this.manager.listSkills();return this.jsonResponse(B)}async getSkill(B){let G=this.requireQueryParam(B,"name"),Q=await this.manager.getSkill(G);if(!Q)return this.jsonResponse({error:"Skill not found"},404);return this.jsonResponse(Q)}async saveSkill(B){let G=await this.parseJson(B);return await this.manager.saveSkill(G.name,G.content),this.jsonResponse({success:!0})}async deleteSkill(B){let G=await this.parseJson(B);return await this.manager.deleteSkill(G.name),this.jsonResponse({success:!0})}async syncSkills(){return await this.manager.syncSkillsFromRemote(),this.jsonResponse({success:!0})}async listPlugins(){let B=await this.manager.listPlugins();return this.jsonResponse(B)}async getPluginConfig(B){let G=this.requireQueryParam(B,"name"),Q=await this.manager.getPluginConfig(G);if(!Q)return this.jsonResponse({error:"Plugin config not found"},404);return this.jsonResponse(Q)}async updatePluginConfig(B){let G=await this.parseJson(B);return await this.manager.updatePluginConfig(G.name,G.config),this.jsonResponse({success:!0})}async installPlugin(B){let G=await this.parseJson(B);return await this.manager.installPlugin(G.name,G.source),this.jsonResponse({success:!0})}async uninstallPlugin(B){let G=await this.parseJson(B);return await this.manager.uninstallPlugin(G.name),this.jsonResponse({success:!0})}}async function x(){let{createFSManager:B}=await import("./chunk-qez6ejd4.js"),G=await B();return new X(G)}function F(B){return new X(B)}class Y{baseUrl;constructor(B="http://localhost:3000"){this.baseUrl=B}async request(B,G){let Q=`${this.baseUrl}${B}`,V=await fetch(Q,G);if(!V.ok){let W=await V.json().catch(()=>({error:"Unknown error"}));throw Error(W.error||`HTTP ${V.status}`)}return V.json()}async initialize(){}async getConfig(){return this.request("/api/config")}async updateConfig(B){await this.request("/api/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)})}}class Z{baseUrl;constructor(B="http://localhost:3000"){this.baseUrl=B}async request(B,G){let Q=`${this.baseUrl}${B}`,V=await fetch(Q,G);if(!V.ok){let W=await V.json().catch(()=>({error:"Unknown error"}));throw Error(W.error||`HTTP ${V.status}`)}return V.json()}async initialize(){}async listSkills(){return this.request("/api/skills")}async getSkill(B){let G=`/api/skill?name=${encodeURIComponent(B)}`;return this.request(G)}async saveSkill(B,G){await this.request("/api/skill",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B,content:G})})}async deleteSkill(B){await this.request("/api/skill",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B})})}async syncFromRemote(B){await this.request("/api/skills/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({remote:B})})}}class _{baseUrl;constructor(B="http://localhost:3000"){this.baseUrl=B}async request(B,G){let Q=`${this.baseUrl}${B}`,V=await fetch(Q,G);if(!V.ok){let W=await V.json().catch(()=>({error:"Unknown error"}));throw Error(W.error||`HTTP ${V.status}`)}return V.json()}async initialize(){}async listPlugins(){return this.request("/api/plugins")}async getPluginConfig(B){let G=`/api/plugin/config?name=${encodeURIComponent(B)}`;return this.request(G)}async updatePluginConfig(B,G){await this.request("/api/plugin/config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B,config:G})})}async installPlugin(B,G){await this.request("/api/plugin/install",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B,source:G})})}async uninstallPlugin(B){await this.request("/api/plugin",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B})})}}async function w(B="http://localhost:3000"){let G=new Y(B),Q=new Z(B),V=new _(B),W=new D(G,Q,V);return await W.initialize(),W}import{z as K}from"zod";var v=K.enum(["idea","bug_report","feature","refactor"]),C=K.enum(["low","medium","high","critical"]),U=K.enum(["pending","planned","archived"]),R=K.enum(["user_input","ai_suggestion","conversation_derived"]),P=K.object({id:K.string().uuid(),type:v,title:K.string().min(1).max(200),description:K.string(),priority:C.default("medium"),source:R,status:U.default("pending"),createdAt:K.string().datetime(),tags:K.array(K.string()).default([]),metadata:K.object({relatedFiles:K.array(K.string()).optional(),conversationContext:K.string().optional(),estimatedComplexity:K.enum(["simple","medium","complex"]).optional()}).optional()}),a=K.object({version:K.literal("1.0"),sparks:K.array(P),lastUpdated:K.string().datetime()}),O=K.enum(["pickup","running","complete","error","review","feedback"]),E=K.enum(["default","planner","reviewer","refactor","finder","debugger","architect"]),T=K.enum(["serial","parallel"]),H=K.lazy(()=>K.object({id:K.string(),title:K.string().min(1).max(200),description:K.string(),execution:T.optional(),children:K.array(K.lazy(()=>H)).optional(),agentType:E.optional(),threadId:K.string().optional(),estimatedTime:K.string().optional(),complexity:K.enum(["simple","medium","complex"]).optional(),dependencies:K.array(K.string()).optional(),acceptanceCriteria:K.array(K.string()).optional(),status:O.optional(),startedAt:K.string().datetime().optional(),completedAt:K.string().datetime().optional(),assignedTo:E.optional(),error:K.object({message:K.string(),stack:K.string().optional(),retryCount:K.number().optional()}).optional()})),j=K.object({taskId:K.string(),planId:K.string(),threadId:K.string(),agentType:E,status:O,startedAt:K.string().datetime(),completedAt:K.string().datetime().optional(),output:K.string().optional(),error:K.string().optional(),changedFiles:K.array(K.string()).optional()}),r=K.object({version:K.literal("1.0"),lastUpdated:K.string().datetime(),activePlanId:K.string().optional(),tasks:K.record(K.string(),H),history:K.array(j),config:K.object({maxConcurrentAgents:K.number().min(1).max(10).default(3),retryLimit:K.number().min(0).max(10).default(3),autoResume:K.boolean().default(!1)})});import{Low as b}from"lowdb";import{JSONFile as I}from"lowdb/node";import A from"path";class J{db;dbPath;constructor(B){this.dbPath=A.join(B,".claude","spark.json");let G=new I(this.dbPath);this.db=new b(G,this.getDefaultData())}getDefaultData(){return{version:"1.0",sparks:[],lastUpdated:new Date().toISOString()}}async initialize(){let B=await import("fs"),G=A.dirname(this.dbPath);if(!B.existsSync(G))B.mkdirSync(G,{recursive:!0});if(await this.db.read(),!this.db.data)this.db.data=this.getDefaultData(),await this.db.write()}generateId(){return crypto.randomUUID()}async addSpark(B){await this.db.read();let G={id:this.generateId(),type:B.type,title:B.title,description:B.description,priority:B.priority||"medium",source:"user_input",status:"pending",createdAt:new Date().toISOString(),tags:B.tags||[]};return this.db.data.sparks.push(G),this.db.data.lastUpdated=new Date().toISOString(),await this.db.write(),G}async getAllSparks(){return await this.db.read(),this.db.data.sparks}async getSparksByStatus(B){return await this.db.read(),this.db.data.sparks.filter((G)=>G.status===B)}async getSparksByType(B){return await this.db.read(),this.db.data.sparks.filter((G)=>G.type===B)}async updateSparkStatus(B,G){await this.db.read();let Q=this.db.data.sparks.find((V)=>V.id===B);if(!Q)return!1;return Q.status=G,this.db.data.lastUpdated=new Date().toISOString(),await this.db.write(),!0}async deleteSpark(B){await this.db.read();let G=this.db.data.sparks.findIndex((Q)=>Q.id===B);if(G===-1)return!1;return this.db.data.sparks.splice(G,1),this.db.data.lastUpdated=new Date().toISOString(),await this.db.write(),!0}getDbPath(){return this.dbPath}}import{Low as f}from"lowdb";import{JSONFile as q}from"lowdb/node";import M from"path";class L{db;dbPath;constructor(B){this.dbPath=M.join(B,".claude","task.json");let G=new q(this.dbPath);this.db=new f(G,this.getDefaultData())}getDefaultData(){return{version:"1.0",lastUpdated:new Date().toISOString(),tasks:{},history:[],config:{maxConcurrentAgents:3,retryLimit:3,autoResume:!1}}}async initialize(){let B=await import("fs"),G=M.dirname(this.dbPath);if(!B.existsSync(G))B.mkdirSync(G,{recursive:!0});if(await this.db.read(),!this.db.data)this.db.data=this.getDefaultData(),await this.db.write()}async getTask(B){return await this.db.read(),this.db.data.tasks[B]}async updateTask(B,G){await this.db.read();let Q=this.db.data.tasks[B];if(!Q)return!1;if(this.db.data.tasks[B]={...Q,...G},G.status){if(G.status==="running"&&!Q.startedAt)this.db.data.tasks[B].startedAt=new Date().toISOString();else if(["complete","error","review"].includes(G.status)&&!Q.completedAt)this.db.data.tasks[B].completedAt=new Date().toISOString()}return this.db.data.lastUpdated=new Date().toISOString(),await this.db.write(),!0}async addTasks(B){await this.db.read();for(let G of B)this.db.data.tasks[G.id]=G;this.db.data.lastUpdated=new Date().toISOString(),await this.db.write()}async getTasksByStatus(B){return await this.db.read(),Object.values(this.db.data.tasks).filter((G)=>G.status===B)}async getAllTasks(){return await this.db.read(),Object.values(this.db.data.tasks)}async addHistory(B){await this.db.read(),this.db.data.history.push(B),await this.db.write()}async getHistory(B){if(await this.db.read(),B)return this.db.data.history.filter((G)=>G.planId===B);return this.db.data.history}async setActivePlan(B){await this.db.read(),this.db.data.activePlanId=B,this.db.data.lastUpdated=new Date().toISOString(),await this.db.write()}async getActivePlan(){return await this.db.read(),this.db.data.activePlanId}async updateConfig(B){await this.db.read(),this.db.data.config={...this.db.data.config,...B},this.db.data.lastUpdated=new Date().toISOString(),await this.db.write()}async getConfig(){return await this.db.read(),this.db.data.config}async clearAllTasks(){await this.db.read(),this.db.data.tasks={},this.db.data.activePlanId=void 0,this.db.data.lastUpdated=new Date().toISOString(),await this.db.write()}async deleteTask(B){if(await this.db.read(),!this.db.data.tasks[B])return!1;return delete this.db.data.tasks[B],this.db.data.lastUpdated=new Date().toISOString(),await this.db.write(),!0}getDbPath(){return this.dbPath}}export{X as Ua,x as Va,F as Wa,Y as Xa,Z as Ya,_ as Za,w as _a,v as $a,C as ab,U as bb,R as cb,P as db,a as eb,O as fb,E as gb,T as hb,H as ib,j as jb,r as kb,J as lb,L as mb};
|
package/dist/chunk-5x8nxw0t.js
DELETED
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import{tool as x5}from"@langchain/core/tools";import{z as KQ}from"zod";import{promises as YQ}from"fs";import{resolve as O5,join as R5}from"path";var F5=KQ.object({operation:KQ.enum(["create","list","exists"]).describe("The folder operation to perform"),folder_path:KQ.string().describe("The path to the folder (absolute or relative to cwd)"),description:KQ.string().optional().describe("What you want to do"),recursive:KQ.boolean().default(!0).optional().describe("For create: create parent directories if they do not exist")}).strict(),L0=x5(async({operation:Q,folder_path:X,recursive:Z=!0},V)=>{if(!V.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");try{let $=O5(V.state.cwd,X);switch(Q){case"create":return await YQ.mkdir($,{recursive:Z}),`✓ Folder created successfully at: ${$}`;case"exists":try{await YQ.access($);let J=await YQ.stat($);return`✓ Folder exists at: ${$}
|
|
2
|
-
Type: ${J.isDirectory()?"Directory":"File"}`}catch{return`✗ Folder does not exist at: ${$}`}case"list":try{let J=await YQ.readdir($,{withFileTypes:!0});if(J.length===0)return`Folder is empty: ${$}`;let q=[];q.push(`\uD83D\uDCC1 ${$}
|
|
3
|
-
`);let K=[],Y=[];for(let H of J){let j=R5($,H.name);try{let W=await YQ.stat(j),z=W.size,G=W.mtime.toLocaleDateString(),U=`${H.isDirectory()?"\uD83D\uDCC1":"\uD83D\uDCC4"} ${H.name}${H.isDirectory()?"/":""} (${z} bytes, ${G})`;if(H.isDirectory())K.push(U);else Y.push(U)}catch(W){Y.push(`⚠️ ${H.name} (unreadable)`)}}if(K.length>0)q.push("Directories:"),K.forEach((H)=>q.push(` ${H}`)),q.push("");if(Y.length>0)q.push("Files:"),Y.forEach((H)=>q.push(` ${H}`));return q.push(`
|
|
4
|
-
Total: ${K.length} directories, ${Y.length} files`),q.join(`
|
|
5
|
-
`)}catch(J){if(J.code==="ENOENT")return`✗ Folder not found: ${$}`;if(J.code==="ENOTDIR")return`✗ Path exists but is not a folder: ${$}`;throw J}default:return`✗ Unknown operation: ${Q}`}}catch($){if($.code==="ENOENT")return`✗ Folder not found: ${X}`;if($.code==="EACCES")return`✗ Permission denied: ${X}`;return`✗ Error: ${$.message}`}},{name:"folder_operations",description:`Unified folder operations tool supporting create, list, and existence check. Relative paths are resolved based on the current working directory (cwd).
|
|
6
|
-
|
|
7
|
-
**Operations:**
|
|
8
|
-
- create: Create a folder (supports nested directory creation)
|
|
9
|
-
- list: List all files and subdirectories with metadata
|
|
10
|
-
- exists: Check if a folder exists
|
|
11
|
-
|
|
12
|
-
**Usage Examples:**
|
|
13
|
-
- Create nested folders: {operation: "create", folder_path: "/path/to/nested/folder"}
|
|
14
|
-
- Create with relative path: {operation: "create", folder_path: "data/output"}
|
|
15
|
-
- List contents: {operation: "list", folder_path: "/path/to/folder"}
|
|
16
|
-
- List with relative path: {operation: "list", folder_path: "src"}
|
|
17
|
-
- Check existence: {operation: "exists", folder_path: "path/to/folder"}
|
|
18
|
-
|
|
19
|
-
**Important:**
|
|
20
|
-
- All folder paths can be absolute or relative to cwd
|
|
21
|
-
- Create operation is recursive (creates parent directories if needed)
|
|
22
|
-
- List operation shows file sizes and modification dates
|
|
23
|
-
- Delete operations are not supported for safety reasons. Use terminal commands with user approval if needed.`,schema:F5});import{tool as B7}from"@langchain/core/tools";import{z as nQ}from"zod";var sQ=(Q,X,Z)=>{let V=Q instanceof RegExp?k0(Q,Z):Q,$=X instanceof RegExp?k0(X,Z):X,J=V!==null&&$!=null&&N5(V,$,Z);return J&&{start:J[0],end:J[1],pre:Z.slice(0,J[0]),body:Z.slice(J[0]+V.length,J[1]),post:Z.slice(J[1]+$.length)}},k0=(Q,X)=>{let Z=X.match(Q);return Z?Z[0]:null},N5=(Q,X,Z)=>{let V,$,J,q=void 0,K,Y=Z.indexOf(Q),H=Z.indexOf(X,Y+1),j=Y;if(Y>=0&&H>0){if(Q===X)return[Y,H];V=[],J=Z.length;while(j>=0&&!K){if(j===Y)V.push(j),Y=Z.indexOf(Q,j+1);else if(V.length===1){let W=V.pop();if(W!==void 0)K=[W,H]}else{if($=V.pop(),$!==void 0&&$<J)J=$,q=H;H=Z.indexOf(X,j+1)}j=Y<H&&Y>=0?Y:H}if(V.length&&q!==void 0)K=[J,q]}return K};var A0="\x00SLASH"+Math.random()+"\x00",v0="\x00OPEN"+Math.random()+"\x00",eQ="\x00CLOSE"+Math.random()+"\x00",w0="\x00COMMA"+Math.random()+"\x00",I0="\x00PERIOD"+Math.random()+"\x00",D5=new RegExp(A0,"g"),S5=new RegExp(v0,"g"),T5=new RegExp(eQ,"g"),P5=new RegExp(w0,"g"),b5=new RegExp(I0,"g"),u5=/\\\\/g,y5=/\\{/g,E5=/\\}/g,m5=/\\,/g,f5=/\\./g,g5=1e5;function rQ(Q){return!isNaN(Q)?parseInt(Q,10):Q.charCodeAt(0)}function h5(Q){return Q.replace(u5,A0).replace(y5,v0).replace(E5,eQ).replace(m5,w0).replace(f5,I0)}function d5(Q){return Q.replace(D5,"\\").replace(S5,"{").replace(T5,"}").replace(P5,",").replace(b5,".")}function x0(Q){if(!Q)return[""];let X=[],Z=sQ("{","}",Q);if(!Z)return Q.split(",");let{pre:V,body:$,post:J}=Z,q=V.split(",");q[q.length-1]+="{"+$+"}";let K=x0(J);if(J.length)q[q.length-1]+=K.shift(),q.push.apply(q,K);return X.push.apply(X,q),X}function O0(Q,X={}){if(!Q)return[];let{max:Z=g5}=X;if(Q.slice(0,2)==="{}")Q="\\{\\}"+Q.slice(2);return HQ(h5(Q),Z,!0).map(d5)}function c5(Q){return"{"+Q+"}"}function l5(Q){return/^-?0\d/.test(Q)}function o5(Q,X){return Q<=X}function n5(Q,X){return Q>=X}function HQ(Q,X,Z){let V=[],$=sQ("{","}",Q);if(!$)return[Q];let J=$.pre,q=$.post.length?HQ($.post,X,!1):[""];if(/\$$/.test($.pre))for(let K=0;K<q.length&&K<X;K++){let Y=J+"{"+$.body+"}"+q[K];V.push(Y)}else{let K=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test($.body),Y=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test($.body),H=K||Y,j=$.body.indexOf(",")>=0;if(!H&&!j){if($.post.match(/,(?!,).*\}/))return Q=$.pre+"{"+$.body+eQ+$.post,HQ(Q,X,!0);return[Q]}let W;if(H)W=$.body.split(/\.\./);else if(W=x0($.body),W.length===1&&W[0]!==void 0){if(W=HQ(W[0],X,!1).map(c5),W.length===1)return q.map((G)=>$.pre+W[0]+G)}let z;if(H&&W[0]!==void 0&&W[1]!==void 0){let G=rQ(W[0]),B=rQ(W[1]),U=Math.max(W[0].length,W[1].length),_=W.length===3&&W[2]!==void 0?Math.abs(rQ(W[2])):1,C=o5;if(B<G)_*=-1,C=n5;let k=W.some(l5);z=[];for(let A=G;C(A,B);A+=_){let L;if(Y){if(L=String.fromCharCode(A),L==="\\")L=""}else if(L=String(A),k){let n=U-L.length;if(n>0){let c=Array(n+1).join("0");if(A<0)L="-"+c+L.slice(1);else L=c+L}}z.push(L)}}else{z=[];for(let G=0;G<W.length;G++)z.push.apply(z,HQ(W[G],X,!1))}for(let G=0;G<z.length;G++)for(let B=0;B<q.length&&V.length<X;B++){let U=J+z[G]+q[B];if(!Z||H||U)V.push(U)}}return V}var WQ=(Q)=>{if(typeof Q!=="string")throw TypeError("invalid pattern");if(Q.length>65536)throw TypeError("pattern is too long")};var i5={"[:alnum:]":["\\p{L}\\p{Nl}\\p{Nd}",!0],"[:alpha:]":["\\p{L}\\p{Nl}",!0],"[:ascii:]":["\\x00-\\x7f",!1],"[:blank:]":["\\p{Zs}\\t",!0],"[:cntrl:]":["\\p{Cc}",!0],"[:digit:]":["\\p{Nd}",!0],"[:graph:]":["\\p{Z}\\p{C}",!0,!0],"[:lower:]":["\\p{Ll}",!0],"[:print:]":["\\p{C}",!0],"[:punct:]":["\\p{P}",!0],"[:space:]":["\\p{Z}\\t\\r\\n\\v\\f",!0],"[:upper:]":["\\p{Lu}",!0],"[:word:]":["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}",!0],"[:xdigit:]":["A-Fa-f0-9",!1]},jQ=(Q)=>Q.replace(/[[\]\\-]/g,"\\$&"),p5=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),R0=(Q)=>Q.join(""),F0=(Q,X)=>{let Z=X;if(Q.charAt(Z)!=="[")throw Error("not in a brace expression");let V=[],$=[],J=Z+1,q=!1,K=!1,Y=!1,H=!1,j=Z,W="";Q:while(J<Q.length){let U=Q.charAt(J);if((U==="!"||U==="^")&&J===Z+1){H=!0,J++;continue}if(U==="]"&&q&&!Y){j=J+1;break}if(q=!0,U==="\\"){if(!Y){Y=!0,J++;continue}}if(U==="["&&!Y){for(let[_,[C,M,k]]of Object.entries(i5))if(Q.startsWith(_,J)){if(W)return["$.",!1,Q.length-Z,!0];if(J+=_.length,k)$.push(C);else V.push(C);K=K||M;continue Q}}if(Y=!1,W){if(U>W)V.push(jQ(W)+"-"+jQ(U));else if(U===W)V.push(jQ(U));W="",J++;continue}if(Q.startsWith("-]",J+1)){V.push(jQ(U+"-")),J+=2;continue}if(Q.startsWith("-",J+1)){W=U,J+=2;continue}V.push(jQ(U)),J++}if(j<J)return["",!1,0,!1];if(!V.length&&!$.length)return["$.",!1,Q.length-Z,!0];if($.length===0&&V.length===1&&/^\\?.$/.test(V[0])&&!H){let U=V[0].length===2?V[0].slice(-1):V[0];return[p5(U),!1,j-Z,!1]}let z="["+(H?"^":"")+R0(V)+"]",G="["+(H?"":"^")+R0($)+"]";return[V.length&&$.length?"("+z+"|"+G+")":V.length?z:G,K,j-Z,!0]};var E=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!0}={})=>{if(Z)return X?Q.replace(/\[([^\/\\])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\])\]/g,"$1$2").replace(/\\([^\/])/g,"$1");return X?Q.replace(/\[([^\/\\{}])\]/g,"$1"):Q.replace(/((?!\\).|^)\[([^\/\\{}])\]/g,"$1$2").replace(/\\([^\/{}])/g,"$1")};var a5=new Set(["!","?","+","*","@"]),N0=(Q)=>a5.has(Q),s5="(?!(?:^|/)\\.\\.?(?:$|/))",RQ="(?!\\.)",r5=new Set(["[","."]),e5=new Set(["..","."]),t5=new Set("().*{}+?[]^$\\!"),Q6=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),tQ="[^/]",D0=tQ+"*?",S0=tQ+"+?";class O{type;#Q;#Z;#J=!1;#$=[];#q;#k;#M;#W=!1;#K;#z;#j=!1;constructor(Q,X,Z={}){if(this.type=Q,Q)this.#Z=!0;if(this.#q=X,this.#Q=this.#q?this.#q.#Q:this,this.#K=this.#Q===this?Z:this.#Q.#K,this.#M=this.#Q===this?[]:this.#Q.#M,Q==="!"&&!this.#Q.#W)this.#M.push(this);this.#k=this.#q?this.#q.#$.length:0}get hasMagic(){if(this.#Z!==void 0)return this.#Z;for(let Q of this.#$){if(typeof Q==="string")continue;if(Q.type||Q.hasMagic)return this.#Z=!0}return this.#Z}toString(){if(this.#z!==void 0)return this.#z;if(!this.type)return this.#z=this.#$.map((Q)=>String(Q)).join("");else return this.#z=this.type+"("+this.#$.map((Q)=>String(Q)).join("|")+")"}#Y(){if(this!==this.#Q)throw Error("should only call on root");if(this.#W)return this;this.toString(),this.#W=!0;let Q;while(Q=this.#M.pop()){if(Q.type!=="!")continue;let X=Q,Z=X.#q;while(Z){for(let V=X.#k+1;!Z.type&&V<Z.#$.length;V++)for(let $ of Q.#$){if(typeof $==="string")throw Error("string part in extglob AST??");$.copyIn(Z.#$[V])}X=Z,Z=X.#q}}return this}push(...Q){for(let X of Q){if(X==="")continue;if(typeof X!=="string"&&!(X instanceof O&&X.#q===this))throw Error("invalid part: "+X);this.#$.push(X)}}toJSON(){let Q=this.type===null?this.#$.slice().map((X)=>typeof X==="string"?X:X.toJSON()):[this.type,...this.#$.map((X)=>X.toJSON())];if(this.isStart()&&!this.type)Q.unshift([]);if(this.isEnd()&&(this===this.#Q||this.#Q.#W&&this.#q?.type==="!"))Q.push({});return Q}isStart(){if(this.#Q===this)return!0;if(!this.#q?.isStart())return!1;if(this.#k===0)return!0;let Q=this.#q;for(let X=0;X<this.#k;X++){let Z=Q.#$[X];if(!(Z instanceof O&&Z.type==="!"))return!1}return!0}isEnd(){if(this.#Q===this)return!0;if(this.#q?.type==="!")return!0;if(!this.#q?.isEnd())return!1;if(!this.type)return this.#q?.isEnd();let Q=this.#q?this.#q.#$.length:0;return this.#k===Q-1}copyIn(Q){if(typeof Q==="string")this.push(Q);else this.push(Q.clone(this))}clone(Q){let X=new O(this.type,Q);for(let Z of this.#$)X.copyIn(Z);return X}static#V(Q,X,Z,V){let $=!1,J=!1,q=-1,K=!1;if(X.type===null){let z=Z,G="";while(z<Q.length){let B=Q.charAt(z++);if($||B==="\\"){$=!$,G+=B;continue}if(J){if(z===q+1){if(B==="^"||B==="!")K=!0}else if(B==="]"&&!(z===q+2&&K))J=!1;G+=B;continue}else if(B==="["){J=!0,q=z,K=!1,G+=B;continue}if(!V.noext&&N0(B)&&Q.charAt(z)==="("){X.push(G),G="";let U=new O(B,X);z=O.#V(Q,U,z,V),X.push(U);continue}G+=B}return X.push(G),z}let Y=Z+1,H=new O(null,X),j=[],W="";while(Y<Q.length){let z=Q.charAt(Y++);if($||z==="\\"){$=!$,W+=z;continue}if(J){if(Y===q+1){if(z==="^"||z==="!")K=!0}else if(z==="]"&&!(Y===q+2&&K))J=!1;W+=z;continue}else if(z==="["){J=!0,q=Y,K=!1,W+=z;continue}if(N0(z)&&Q.charAt(Y)==="("){H.push(W),W="";let G=new O(z,H);H.push(G),Y=O.#V(Q,G,Y,V);continue}if(z==="|"){H.push(W),W="",j.push(H),H=new O(null,X);continue}if(z===")"){if(W===""&&X.#$.length===0)X.#j=!0;return H.push(W),W="",X.push(...j,H),Y}W+=z}return X.type=null,X.#Z=void 0,X.#$=[Q.substring(Z-1)],Y}static fromGlob(Q,X={}){let Z=new O(null,void 0,X);return O.#V(Q,Z,0,X),Z}toMMPattern(){if(this!==this.#Q)return this.#Q.toMMPattern();let Q=this.toString(),[X,Z,V,$]=this.toRegExpSource();if(!(V||this.#Z||this.#K.nocase&&!this.#K.nocaseMagicOnly&&Q.toUpperCase()!==Q.toLowerCase()))return Z;let q=(this.#K.nocase?"i":"")+($?"u":"");return Object.assign(new RegExp(`^${X}$`,q),{_src:X,_glob:Q})}get options(){return this.#K}toRegExpSource(Q){let X=Q??!!this.#K.dot;if(this.#Q===this)this.#Y();if(!this.type){let K=this.isStart()&&this.isEnd()&&!this.#$.some((z)=>typeof z!=="string"),Y=this.#$.map((z)=>{let[G,B,U,_]=typeof z==="string"?O.#A(z,this.#Z,K):z.toRegExpSource(Q);return this.#Z=this.#Z||U,this.#J=this.#J||_,G}).join(""),H="";if(this.isStart()){if(typeof this.#$[0]==="string"){if(!(this.#$.length===1&&e5.has(this.#$[0]))){let G=r5,B=X&&G.has(Y.charAt(0))||Y.startsWith("\\.")&&G.has(Y.charAt(2))||Y.startsWith("\\.\\.")&&G.has(Y.charAt(4)),U=!X&&!Q&&G.has(Y.charAt(0));H=B?s5:U?RQ:""}}}let j="";if(this.isEnd()&&this.#Q.#W&&this.#q?.type==="!")j="(?:$|\\/)";return[H+Y+j,E(Y),this.#Z=!!this.#Z,this.#J]}let Z=this.type==="*"||this.type==="+",V=this.type==="!"?"(?:(?!(?:":"(?:",$=this.#G(X);if(this.isStart()&&this.isEnd()&&!$&&this.type!=="!"){let K=this.toString();return this.#$=[K],this.type=null,this.#Z=void 0,[K,E(this.toString()),!1,!1]}let J=!Z||Q||X||!RQ?"":this.#G(!0);if(J===$)J="";if(J)$=`(?:${$})(?:${J})*?`;let q="";if(this.type==="!"&&this.#j)q=(this.isStart()&&!X?RQ:"")+S0;else{let K=this.type==="!"?"))"+(this.isStart()&&!X&&!Q?RQ:"")+D0+")":this.type==="@"?")":this.type==="?"?")?":this.type==="+"&&J?")":this.type==="*"&&J?")?":`)${this.type}`;q=V+$+K}return[q,E($),this.#Z=!!this.#Z,this.#J]}#G(Q){return this.#$.map((X)=>{if(typeof X==="string")throw Error("string type in extglob ast??");let[Z,V,$,J]=X.toRegExpSource(Q);return this.#J=this.#J||J,Z}).filter((X)=>!(this.isStart()&&this.isEnd())||!!X).join("|")}static#A(Q,X,Z=!1){let V=!1,$="",J=!1,q=!1;for(let K=0;K<Q.length;K++){let Y=Q.charAt(K);if(V){V=!1,$+=(t5.has(Y)?"\\":"")+Y;continue}if(Y==="*"){if(q)continue;q=!0,$+=Z&&/^[*]+$/.test(Q)?S0:D0,X=!0;continue}else q=!1;if(Y==="\\"){if(K===Q.length-1)$+="\\\\";else V=!0;continue}if(Y==="["){let[H,j,W,z]=F0(Q,K);if(W){$+=H,J=J||j,K+=W-1,X=X||z;continue}}if(Y==="?"){$+=tQ,X=!0;continue}$+=Q6(Y)}return[$,E(Q),!!X,J]}}var ZQ=(Q,{windowsPathsNoEscape:X=!1,magicalBraces:Z=!1}={})=>{if(Z)return X?Q.replace(/[?*()[\]{}]/g,"[$&]"):Q.replace(/[?*()[\]\\{}]/g,"\\$&");return X?Q.replace(/[?*()[\]]/g,"[$&]"):Q.replace(/[?*()[\]\\]/g,"\\$&")};var N=(Q,X,Z={})=>{if(WQ(X),!Z.nocomment&&X.charAt(0)==="#")return!1;return new b(X,Z).match(Q)},X6=/^\*+([^+@!?\*\[\(]*)$/,Z6=(Q)=>(X)=>!X.startsWith(".")&&X.endsWith(Q),V6=(Q)=>(X)=>X.endsWith(Q),$6=(Q)=>{return Q=Q.toLowerCase(),(X)=>!X.startsWith(".")&&X.toLowerCase().endsWith(Q)},J6=(Q)=>{return Q=Q.toLowerCase(),(X)=>X.toLowerCase().endsWith(Q)},q6=/^\*+\.\*+$/,K6=(Q)=>!Q.startsWith(".")&&Q.includes("."),Y6=(Q)=>Q!=="."&&Q!==".."&&Q.includes("."),H6=/^\.\*+$/,W6=(Q)=>Q!=="."&&Q!==".."&&Q.startsWith("."),j6=/^\*+$/,z6=(Q)=>Q.length!==0&&!Q.startsWith("."),G6=(Q)=>Q.length!==0&&Q!=="."&&Q!=="..",U6=/^\?+([^+@!?\*\[\(]*)?$/,B6=([Q,X=""])=>{let Z=b0([Q]);if(!X)return Z;return X=X.toLowerCase(),(V)=>Z(V)&&V.toLowerCase().endsWith(X)},C6=([Q,X=""])=>{let Z=u0([Q]);if(!X)return Z;return X=X.toLowerCase(),(V)=>Z(V)&&V.toLowerCase().endsWith(X)},M6=([Q,X=""])=>{let Z=u0([Q]);return!X?Z:(V)=>Z(V)&&V.endsWith(X)},_6=([Q,X=""])=>{let Z=b0([Q]);return!X?Z:(V)=>Z(V)&&V.endsWith(X)},b0=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&!Z.startsWith(".")},u0=([Q])=>{let X=Q.length;return(Z)=>Z.length===X&&Z!=="."&&Z!==".."},y0=typeof process==="object"&&process?typeof process.env==="object"&&process.env&&process.env.__MINIMATCH_TESTING_PLATFORM__||process.platform:"posix",T0={win32:{sep:"\\"},posix:{sep:"/"}},L6=y0==="win32"?T0.win32.sep:T0.posix.sep;N.sep=L6;var R=Symbol("globstar **");N.GLOBSTAR=R;var k6="[^/]",A6=k6+"*?",v6="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",w6="(?:(?!(?:\\/|^)\\.).)*?",I6=(Q,X={})=>(Z)=>N(Z,Q,X);N.filter=I6;var P=(Q,X={})=>Object.assign({},Q,X),x6=(Q)=>{if(!Q||typeof Q!=="object"||!Object.keys(Q).length)return N;let X=N;return Object.assign((V,$,J={})=>X(V,$,P(Q,J)),{Minimatch:class extends X.Minimatch{constructor($,J={}){super($,P(Q,J))}static defaults($){return X.defaults(P(Q,$)).Minimatch}},AST:class extends X.AST{constructor($,J,q={}){super($,J,P(Q,q))}static fromGlob($,J={}){return X.AST.fromGlob($,P(Q,J))}},unescape:(V,$={})=>X.unescape(V,P(Q,$)),escape:(V,$={})=>X.escape(V,P(Q,$)),filter:(V,$={})=>X.filter(V,P(Q,$)),defaults:(V)=>X.defaults(P(Q,V)),makeRe:(V,$={})=>X.makeRe(V,P(Q,$)),braceExpand:(V,$={})=>X.braceExpand(V,P(Q,$)),match:(V,$,J={})=>X.match(V,$,P(Q,J)),sep:X.sep,GLOBSTAR:R})};N.defaults=x6;var E0=(Q,X={})=>{if(WQ(Q),X.nobrace||!/\{(?:(?!\{).)*\}/.test(Q))return[Q];return O0(Q,{max:X.braceExpandMax})};N.braceExpand=E0;var O6=(Q,X={})=>new b(Q,X).makeRe();N.makeRe=O6;var R6=(Q,X,Z={})=>{let V=new b(X,Z);if(Q=Q.filter(($)=>V.match($)),V.options.nonull&&!Q.length)Q.push(X);return Q};N.match=R6;var P0=/[?*]|[+@!]\(.*?\)|\[|\]/,F6=(Q)=>Q.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");class b{options;set;pattern;windowsPathsNoEscape;nonegate;negate;comment;empty;preserveMultipleSlashes;partial;globSet;globParts;nocase;isWindows;platform;windowsNoMagicRoot;regexp;constructor(Q,X={}){WQ(Q),X=X||{},this.options=X,this.pattern=Q,this.platform=X.platform||y0,this.isWindows=this.platform==="win32";let Z="allowWindowsEscape";if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X[Z]===!1,this.windowsPathsNoEscape)this.pattern=this.pattern.replace(/\\/g,"/");this.preserveMultipleSlashes=!!X.preserveMultipleSlashes,this.regexp=null,this.negate=!1,this.nonegate=!!X.nonegate,this.comment=!1,this.empty=!1,this.partial=!!X.partial,this.nocase=!!this.options.nocase,this.windowsNoMagicRoot=X.windowsNoMagicRoot!==void 0?X.windowsNoMagicRoot:!!(this.isWindows&&this.nocase),this.globSet=[],this.globParts=[],this.set=[],this.make()}hasMagic(){if(this.options.magicalBraces&&this.set.length>1)return!0;for(let Q of this.set)for(let X of Q)if(typeof X!=="string")return!0;return!1}debug(...Q){}make(){let Q=this.pattern,X=this.options;if(!X.nocomment&&Q.charAt(0)==="#"){this.comment=!0;return}if(!Q){this.empty=!0;return}if(this.parseNegate(),this.globSet=[...new Set(this.braceExpand())],X.debug)this.debug=(...$)=>console.error(...$);this.debug(this.pattern,this.globSet);let Z=this.globSet.map(($)=>this.slashSplit($));this.globParts=this.preprocess(Z),this.debug(this.pattern,this.globParts);let V=this.globParts.map(($,J,q)=>{if(this.isWindows&&this.windowsNoMagicRoot){let K=$[0]===""&&$[1]===""&&($[2]==="?"||!P0.test($[2]))&&!P0.test($[3]),Y=/^[a-z]:/i.test($[0]);if(K)return[...$.slice(0,4),...$.slice(4).map((H)=>this.parse(H))];else if(Y)return[$[0],...$.slice(1).map((H)=>this.parse(H))]}return $.map((K)=>this.parse(K))});if(this.debug(this.pattern,V),this.set=V.filter(($)=>$.indexOf(!1)===-1),this.isWindows)for(let $=0;$<this.set.length;$++){let J=this.set[$];if(J[0]===""&&J[1]===""&&this.globParts[$][2]==="?"&&typeof J[3]==="string"&&/^[a-z]:$/i.test(J[3]))J[2]="?"}this.debug(this.pattern,this.set)}preprocess(Q){if(this.options.noglobstar){for(let Z=0;Z<Q.length;Z++)for(let V=0;V<Q[Z].length;V++)if(Q[Z][V]==="**")Q[Z][V]="*"}let{optimizationLevel:X=1}=this.options;if(X>=2)Q=this.firstPhasePreProcess(Q),Q=this.secondPhasePreProcess(Q);else if(X>=1)Q=this.levelOneOptimize(Q);else Q=this.adjascentGlobstarOptimize(Q);return Q}adjascentGlobstarOptimize(Q){return Q.map((X)=>{let Z=-1;while((Z=X.indexOf("**",Z+1))!==-1){let V=Z;while(X[V+1]==="**")V++;if(V!==Z)X.splice(Z,V-Z)}return X})}levelOneOptimize(Q){return Q.map((X)=>{return X=X.reduce((Z,V)=>{let $=Z[Z.length-1];if(V==="**"&&$==="**")return Z;if(V===".."){if($&&$!==".."&&$!=="."&&$!=="**")return Z.pop(),Z}return Z.push(V),Z},[]),X.length===0?[""]:X})}levelTwoFileOptimize(Q){if(!Array.isArray(Q))Q=this.slashSplit(Q);let X=!1;do{if(X=!1,!this.preserveMultipleSlashes){for(let V=1;V<Q.length-1;V++){let $=Q[V];if(V===1&&$===""&&Q[0]==="")continue;if($==="."||$==="")X=!0,Q.splice(V,1),V--}if(Q[0]==="."&&Q.length===2&&(Q[1]==="."||Q[1]===""))X=!0,Q.pop()}let Z=0;while((Z=Q.indexOf("..",Z+1))!==-1){let V=Q[Z-1];if(V&&V!=="."&&V!==".."&&V!=="**")X=!0,Q.splice(Z-1,2),Z-=2}}while(X);return Q.length===0?[""]:Q}firstPhasePreProcess(Q){let X=!1;do{X=!1;for(let Z of Q){let V=-1;while((V=Z.indexOf("**",V+1))!==-1){let J=V;while(Z[J+1]==="**")J++;if(J>V)Z.splice(V+1,J-V);let q=Z[V+1],K=Z[V+2],Y=Z[V+3];if(q!=="..")continue;if(!K||K==="."||K===".."||!Y||Y==="."||Y==="..")continue;X=!0,Z.splice(V,1);let H=Z.slice(0);H[V]="**",Q.push(H),V--}if(!this.preserveMultipleSlashes){for(let J=1;J<Z.length-1;J++){let q=Z[J];if(J===1&&q===""&&Z[0]==="")continue;if(q==="."||q==="")X=!0,Z.splice(J,1),J--}if(Z[0]==="."&&Z.length===2&&(Z[1]==="."||Z[1]===""))X=!0,Z.pop()}let $=0;while(($=Z.indexOf("..",$+1))!==-1){let J=Z[$-1];if(J&&J!=="."&&J!==".."&&J!=="**"){X=!0;let K=$===1&&Z[$+1]==="**"?["."]:[];if(Z.splice($-1,2,...K),Z.length===0)Z.push("");$-=2}}}}while(X);return Q}secondPhasePreProcess(Q){for(let X=0;X<Q.length-1;X++)for(let Z=X+1;Z<Q.length;Z++){let V=this.partsMatch(Q[X],Q[Z],!this.preserveMultipleSlashes);if(V){Q[X]=[],Q[Z]=V;break}}return Q.filter((X)=>X.length)}partsMatch(Q,X,Z=!1){let V=0,$=0,J=[],q="";while(V<Q.length&&$<X.length)if(Q[V]===X[$])J.push(q==="b"?X[$]:Q[V]),V++,$++;else if(Z&&Q[V]==="**"&&X[$]===Q[V+1])J.push(Q[V]),V++;else if(Z&&X[$]==="**"&&Q[V]===X[$+1])J.push(X[$]),$++;else if(Q[V]==="*"&&X[$]&&(this.options.dot||!X[$].startsWith("."))&&X[$]!=="**"){if(q==="b")return!1;q="a",J.push(Q[V]),V++,$++}else if(X[$]==="*"&&Q[V]&&(this.options.dot||!Q[V].startsWith("."))&&Q[V]!=="**"){if(q==="a")return!1;q="b",J.push(X[$]),V++,$++}else return!1;return Q.length===X.length&&J}parseNegate(){if(this.nonegate)return;let Q=this.pattern,X=!1,Z=0;for(let V=0;V<Q.length&&Q.charAt(V)==="!";V++)X=!X,Z++;if(Z)this.pattern=Q.slice(Z);this.negate=X}matchOne(Q,X,Z=!1){let V=this.options;if(this.isWindows){let B=typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0]),U=!B&&Q[0]===""&&Q[1]===""&&Q[2]==="?"&&/^[a-z]:$/i.test(Q[3]),_=typeof X[0]==="string"&&/^[a-z]:$/i.test(X[0]),C=!_&&X[0]===""&&X[1]===""&&X[2]==="?"&&typeof X[3]==="string"&&/^[a-z]:$/i.test(X[3]),M=U?3:B?0:void 0,k=C?3:_?0:void 0;if(typeof M==="number"&&typeof k==="number"){let[A,L]=[Q[M],X[k]];if(A.toLowerCase()===L.toLowerCase()){if(X[k]=A,k>M)X=X.slice(k);else if(M>k)Q=Q.slice(M)}}}let{optimizationLevel:$=1}=this.options;if($>=2)Q=this.levelTwoFileOptimize(Q);this.debug("matchOne",this,{file:Q,pattern:X}),this.debug("matchOne",Q.length,X.length);for(var J=0,q=0,K=Q.length,Y=X.length;J<K&&q<Y;J++,q++){this.debug("matchOne loop");var H=X[q],j=Q[J];if(this.debug(X,H,j),H===!1)return!1;if(H===R){this.debug("GLOBSTAR",[X,H,j]);var W=J,z=q+1;if(z===Y){this.debug("** at the end");for(;J<K;J++)if(Q[J]==="."||Q[J]===".."||!V.dot&&Q[J].charAt(0)===".")return!1;return!0}while(W<K){var G=Q[W];if(this.debug(`
|
|
24
|
-
globstar while`,Q,W,X,z,G),this.matchOne(Q.slice(W),X.slice(z),Z))return this.debug("globstar found match!",W,K,G),!0;else{if(G==="."||G===".."||!V.dot&&G.charAt(0)==="."){this.debug("dot detected!",Q,W,X,z);break}this.debug("globstar swallow a segment, and continue"),W++}}if(Z){if(this.debug(`
|
|
25
|
-
>>> no match, partial?`,Q,W,X,z),W===K)return!0}return!1}let B;if(typeof H==="string")B=j===H,this.debug("string match",H,j,B);else B=H.test(j),this.debug("pattern match",H,j,B);if(!B)return!1}if(J===K&&q===Y)return!0;else if(J===K)return Z;else if(q===Y)return J===K-1&&Q[J]==="";else throw Error("wtf?")}braceExpand(){return E0(this.pattern,this.options)}parse(Q){WQ(Q);let X=this.options;if(Q==="**")return R;if(Q==="")return"";let Z,V=null;if(Z=Q.match(j6))V=X.dot?G6:z6;else if(Z=Q.match(X6))V=(X.nocase?X.dot?J6:$6:X.dot?V6:Z6)(Z[1]);else if(Z=Q.match(U6))V=(X.nocase?X.dot?C6:B6:X.dot?M6:_6)(Z);else if(Z=Q.match(q6))V=X.dot?Y6:K6;else if(Z=Q.match(H6))V=W6;let $=O.fromGlob(Q,this.options).toMMPattern();if(V&&typeof $==="object")Reflect.defineProperty($,"test",{value:V});return $}makeRe(){if(this.regexp||this.regexp===!1)return this.regexp;let Q=this.set;if(!Q.length)return this.regexp=!1,this.regexp;let X=this.options,Z=X.noglobstar?A6:X.dot?v6:w6,V=new Set(X.nocase?["i"]:[]),$=Q.map((K)=>{let Y=K.map((j)=>{if(j instanceof RegExp)for(let W of j.flags.split(""))V.add(W);return typeof j==="string"?F6(j):j===R?R:j._src});Y.forEach((j,W)=>{let z=Y[W+1],G=Y[W-1];if(j!==R||G===R)return;if(G===void 0)if(z!==void 0&&z!==R)Y[W+1]="(?:\\/|"+Z+"\\/)?"+z;else Y[W]=Z;else if(z===void 0)Y[W-1]=G+"(?:\\/|\\/"+Z+")?";else if(z!==R)Y[W-1]=G+"(?:\\/|\\/"+Z+"\\/)"+z,Y[W+1]=R});let H=Y.filter((j)=>j!==R);if(this.partial&&H.length>=1){let j=[];for(let W=1;W<=H.length;W++)j.push(H.slice(0,W).join("/"));return"(?:"+j.join("|")+")"}return H.join("/")}).join("|"),[J,q]=Q.length>1?["(?:",")"]:["",""];if($="^"+J+$+q+"$",this.partial)$="^(?:\\/|"+J+$.slice(1,-1)+q+")$";if(this.negate)$="^(?!"+$+").+$";try{this.regexp=new RegExp($,[...V].join(""))}catch(K){this.regexp=!1}return this.regexp}slashSplit(Q){if(this.preserveMultipleSlashes)return Q.split("/");else if(this.isWindows&&/^\/\/[^\/]+/.test(Q))return["",...Q.split(/\/+/)];else return Q.split(/\/+/)}match(Q,X=this.partial){if(this.debug("match",Q,this.pattern),this.comment)return!1;if(this.empty)return Q==="";if(Q==="/"&&X)return!0;let Z=this.options;if(this.isWindows)Q=Q.split("\\").join("/");let V=this.slashSplit(Q);this.debug(this.pattern,"split",V);let $=this.set;this.debug(this.pattern,"set",$);let J=V[V.length-1];if(!J)for(let q=V.length-2;!J&&q>=0;q--)J=V[q];for(let q=0;q<$.length;q++){let K=$[q],Y=V;if(Z.matchBase&&K.length===1)Y=[J];if(this.matchOne(Y,K,X)){if(Z.flipNegate)return!0;return!this.negate}}if(Z.flipNegate)return!1;return this.negate}static defaults(Q){return N.defaults(Q).Minimatch}}N.AST=O;N.Minimatch=b;N.escape=ZQ;N.unescape=E;import{fileURLToPath as Y7}from"node:url";var N6=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,f0=new Set,Q0=typeof process=="object"&&process?process:{},g0=(Q,X,Z,V)=>{typeof Q0.emitWarning=="function"?Q0.emitWarning(Q,X,Z,V):console.error(`[${Z}] ${X}: ${Q}`)},NQ=globalThis.AbortController,m0=globalThis.AbortSignal;if(typeof NQ>"u"){m0=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(Z,V){this._onabort.push(V)}},NQ=class{constructor(){X()}signal=new m0;abort(Z){if(!this.signal.aborted){this.signal.reason=Z,this.signal.aborted=!0;for(let V of this.signal._onabort)V(Z);this.signal.onabort?.(Z)}}};let Q=Q0.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",X=()=>{Q&&(Q=!1,g0("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",X))}}var D6=(Q)=>!f0.has(Q),Y8=Symbol("type"),i=(Q)=>Q&&Q===Math.floor(Q)&&Q>0&&isFinite(Q),h0=(Q)=>i(Q)?Q<=Math.pow(2,8)?Uint8Array:Q<=Math.pow(2,16)?Uint16Array:Q<=Math.pow(2,32)?Uint32Array:Q<=Number.MAX_SAFE_INTEGER?FQ:null:null,FQ=class extends Array{constructor(Q){super(Q),this.fill(0)}},S6=class Q{heap;length;static#Q=!1;static create(X){let Z=h0(X);if(!Z)return[];Q.#Q=!0;let V=new Q(X,Z);return Q.#Q=!1,V}constructor(X,Z){if(!Q.#Q)throw TypeError("instantiate Stack using Stack.create(n)");this.heap=new Z(X),this.length=0}push(X){this.heap[this.length++]=X}pop(){return this.heap[--this.length]}},zQ=class Q{#Q;#Z;#J;#$;#q;#k;#M;#W;get perf(){return this.#W}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#K;#z;#j;#Y;#V;#G;#A;#L;#U;#F;#B;#I;#x;#C;#_;#v;#O;#X;#b;static unsafeExposeInternals(X){return{starts:X.#x,ttls:X.#C,autopurgeTimers:X.#_,sizes:X.#I,keyMap:X.#j,keyList:X.#Y,valList:X.#V,next:X.#G,prev:X.#A,get head(){return X.#L},get tail(){return X.#U},free:X.#F,isBackgroundFetch:(Z)=>X.#H(Z),backgroundFetch:(Z,V,$,J)=>X.#d(Z,V,$,J),moveToTail:(Z)=>X.#y(Z),indexes:(Z)=>X.#D(Z),rindexes:(Z)=>X.#S(Z),isStale:(Z)=>X.#w(Z)}}get max(){return this.#Q}get maxSize(){return this.#Z}get calculatedSize(){return this.#z}get size(){return this.#K}get fetchMethod(){return this.#k}get memoMethod(){return this.#M}get dispose(){return this.#J}get onInsert(){return this.#$}get disposeAfter(){return this.#q}constructor(X){let{max:Z=0,ttl:V,ttlResolution:$=1,ttlAutopurge:J,updateAgeOnGet:q,updateAgeOnHas:K,allowStale:Y,dispose:H,onInsert:j,disposeAfter:W,noDisposeOnSet:z,noUpdateTTL:G,maxSize:B=0,maxEntrySize:U=0,sizeCalculation:_,fetchMethod:C,memoMethod:M,noDeleteOnFetchRejection:k,noDeleteOnStaleGet:A,allowStaleOnFetchRejection:L,allowStaleOnFetchAbort:n,ignoreFetchAbort:c,perf:QQ}=X;if(QQ!==void 0&&typeof QQ?.now!="function")throw TypeError("perf option must have a now() method if specified");if(this.#W=QQ??N6,Z!==0&&!i(Z))throw TypeError("max option must be a nonnegative integer");let XQ=Z?h0(Z):Array;if(!XQ)throw Error("invalid max value: "+Z);if(this.#Q=Z,this.#Z=B,this.maxEntrySize=U||this.#Z,this.sizeCalculation=_,this.sizeCalculation){if(!this.#Z&&!this.maxEntrySize)throw TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw TypeError("sizeCalculation set to non-function")}if(M!==void 0&&typeof M!="function")throw TypeError("memoMethod must be a function if defined");if(this.#M=M,C!==void 0&&typeof C!="function")throw TypeError("fetchMethod must be a function if specified");if(this.#k=C,this.#O=!!C,this.#j=new Map,this.#Y=Array(Z).fill(void 0),this.#V=Array(Z).fill(void 0),this.#G=new XQ(Z),this.#A=new XQ(Z),this.#L=0,this.#U=0,this.#F=S6.create(Z),this.#K=0,this.#z=0,typeof H=="function"&&(this.#J=H),typeof j=="function"&&(this.#$=j),typeof W=="function"?(this.#q=W,this.#B=[]):(this.#q=void 0,this.#B=void 0),this.#v=!!this.#J,this.#b=!!this.#$,this.#X=!!this.#q,this.noDisposeOnSet=!!z,this.noUpdateTTL=!!G,this.noDeleteOnFetchRejection=!!k,this.allowStaleOnFetchRejection=!!L,this.allowStaleOnFetchAbort=!!n,this.ignoreFetchAbort=!!c,this.maxEntrySize!==0){if(this.#Z!==0&&!i(this.#Z))throw TypeError("maxSize must be a positive integer if specified");if(!i(this.maxEntrySize))throw TypeError("maxEntrySize must be a positive integer if specified");this.#l()}if(this.allowStale=!!Y,this.noDeleteOnStaleGet=!!A,this.updateAgeOnGet=!!q,this.updateAgeOnHas=!!K,this.ttlResolution=i($)||$===0?$:1,this.ttlAutopurge=!!J,this.ttl=V||0,this.ttl){if(!i(this.ttl))throw TypeError("ttl must be a positive integer if specified");this.#T()}if(this.#Q===0&&this.ttl===0&&this.#Z===0)throw TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#Q&&!this.#Z){let aQ="LRU_CACHE_UNBOUNDED";D6(aQ)&&(f0.add(aQ),g0("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",aQ,Q))}}getRemainingTTL(X){return this.#j.has(X)?1/0:0}#T(){let X=new FQ(this.#Q),Z=new FQ(this.#Q);this.#C=X,this.#x=Z;let V=this.ttlAutopurge?Array(this.#Q):void 0;this.#_=V,this.#m=(q,K,Y=this.#W.now())=>{if(Z[q]=K!==0?Y:0,X[q]=K,V?.[q]&&(clearTimeout(V[q]),V[q]=void 0),K!==0&&V){let H=setTimeout(()=>{this.#w(q)&&this.#N(this.#Y[q],"expire")},K+1);H.unref&&H.unref(),V[q]=H}},this.#R=(q)=>{Z[q]=X[q]!==0?this.#W.now():0},this.#P=(q,K)=>{if(X[K]){let Y=X[K],H=Z[K];if(!Y||!H)return;q.ttl=Y,q.start=H,q.now=$||J();let j=q.now-H;q.remainingTTL=Y-j}};let $=0,J=()=>{let q=this.#W.now();if(this.ttlResolution>0){$=q;let K=setTimeout(()=>$=0,this.ttlResolution);K.unref&&K.unref()}return q};this.getRemainingTTL=(q)=>{let K=this.#j.get(q);if(K===void 0)return 0;let Y=X[K],H=Z[K];if(!Y||!H)return 1/0;let j=($||J())-H;return Y-j},this.#w=(q)=>{let K=Z[q],Y=X[q];return!!Y&&!!K&&($||J())-K>Y}}#R=()=>{};#P=()=>{};#m=()=>{};#w=()=>!1;#l(){let X=new FQ(this.#Q);this.#z=0,this.#I=X,this.#E=(Z)=>{this.#z-=X[Z],X[Z]=0},this.#f=(Z,V,$,J)=>{if(this.#H(V))return 0;if(!i($))if(J){if(typeof J!="function")throw TypeError("sizeCalculation must be a function");if($=J(V,Z),!i($))throw TypeError("sizeCalculation return invalid (expect positive integer)")}else throw TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return $},this.#u=(Z,V,$)=>{if(X[Z]=V,this.#Z){let J=this.#Z-X[Z];for(;this.#z>J;)this.#h(!0)}this.#z+=X[Z],$&&($.entrySize=V,$.totalCalculatedSize=this.#z)}}#E=(X)=>{};#u=(X,Z,V)=>{};#f=(X,Z,V,$)=>{if(V||$)throw TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#D({allowStale:X=this.allowStale}={}){if(this.#K)for(let Z=this.#U;!(!this.#g(Z)||((X||!this.#w(Z))&&(yield Z),Z===this.#L));)Z=this.#A[Z]}*#S({allowStale:X=this.allowStale}={}){if(this.#K)for(let Z=this.#L;!(!this.#g(Z)||((X||!this.#w(Z))&&(yield Z),Z===this.#U));)Z=this.#G[Z]}#g(X){return X!==void 0&&this.#j.get(this.#Y[X])===X}*entries(){for(let X of this.#D())this.#V[X]!==void 0&&this.#Y[X]!==void 0&&!this.#H(this.#V[X])&&(yield[this.#Y[X],this.#V[X]])}*rentries(){for(let X of this.#S())this.#V[X]!==void 0&&this.#Y[X]!==void 0&&!this.#H(this.#V[X])&&(yield[this.#Y[X],this.#V[X]])}*keys(){for(let X of this.#D()){let Z=this.#Y[X];Z!==void 0&&!this.#H(this.#V[X])&&(yield Z)}}*rkeys(){for(let X of this.#S()){let Z=this.#Y[X];Z!==void 0&&!this.#H(this.#V[X])&&(yield Z)}}*values(){for(let X of this.#D())this.#V[X]!==void 0&&!this.#H(this.#V[X])&&(yield this.#V[X])}*rvalues(){for(let X of this.#S())this.#V[X]!==void 0&&!this.#H(this.#V[X])&&(yield this.#V[X])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(X,Z={}){for(let V of this.#D()){let $=this.#V[V],J=this.#H($)?$.__staleWhileFetching:$;if(J!==void 0&&X(J,this.#Y[V],this))return this.get(this.#Y[V],Z)}}forEach(X,Z=this){for(let V of this.#D()){let $=this.#V[V],J=this.#H($)?$.__staleWhileFetching:$;J!==void 0&&X.call(Z,J,this.#Y[V],this)}}rforEach(X,Z=this){for(let V of this.#S()){let $=this.#V[V],J=this.#H($)?$.__staleWhileFetching:$;J!==void 0&&X.call(Z,J,this.#Y[V],this)}}purgeStale(){let X=!1;for(let Z of this.#S({allowStale:!0}))this.#w(Z)&&(this.#N(this.#Y[Z],"expire"),X=!0);return X}info(X){let Z=this.#j.get(X);if(Z===void 0)return;let V=this.#V[Z],$=this.#H(V)?V.__staleWhileFetching:V;if($===void 0)return;let J={value:$};if(this.#C&&this.#x){let q=this.#C[Z],K=this.#x[Z];if(q&&K){let Y=q-(this.#W.now()-K);J.ttl=Y,J.start=Date.now()}}return this.#I&&(J.size=this.#I[Z]),J}dump(){let X=[];for(let Z of this.#D({allowStale:!0})){let V=this.#Y[Z],$=this.#V[Z],J=this.#H($)?$.__staleWhileFetching:$;if(J===void 0||V===void 0)continue;let q={value:J};if(this.#C&&this.#x){q.ttl=this.#C[Z];let K=this.#W.now()-this.#x[Z];q.start=Math.floor(Date.now()-K)}this.#I&&(q.size=this.#I[Z]),X.unshift([V,q])}return X}load(X){this.clear();for(let[Z,V]of X){if(V.start){let $=Date.now()-V.start;V.start=this.#W.now()-$}this.set(Z,V.value,V)}}set(X,Z,V={}){if(Z===void 0)return this.delete(X),this;let{ttl:$=this.ttl,start:J,noDisposeOnSet:q=this.noDisposeOnSet,sizeCalculation:K=this.sizeCalculation,status:Y}=V,{noUpdateTTL:H=this.noUpdateTTL}=V,j=this.#f(X,Z,V.size||0,K);if(this.maxEntrySize&&j>this.maxEntrySize)return Y&&(Y.set="miss",Y.maxEntrySizeExceeded=!0),this.#N(X,"set"),this;let W=this.#K===0?void 0:this.#j.get(X);if(W===void 0)W=this.#K===0?this.#U:this.#F.length!==0?this.#F.pop():this.#K===this.#Q?this.#h(!1):this.#K,this.#Y[W]=X,this.#V[W]=Z,this.#j.set(X,W),this.#G[this.#U]=W,this.#A[W]=this.#U,this.#U=W,this.#K++,this.#u(W,j,Y),Y&&(Y.set="add"),H=!1,this.#b&&this.#$?.(Z,X,"add");else{this.#y(W);let z=this.#V[W];if(Z!==z){if(this.#O&&this.#H(z)){z.__abortController.abort(Error("replaced"));let{__staleWhileFetching:G}=z;G!==void 0&&!q&&(this.#v&&this.#J?.(G,X,"set"),this.#X&&this.#B?.push([G,X,"set"]))}else q||(this.#v&&this.#J?.(z,X,"set"),this.#X&&this.#B?.push([z,X,"set"]));if(this.#E(W),this.#u(W,j,Y),this.#V[W]=Z,Y){Y.set="replace";let G=z&&this.#H(z)?z.__staleWhileFetching:z;G!==void 0&&(Y.oldValue=G)}}else Y&&(Y.set="update");this.#b&&this.onInsert?.(Z,X,Z===z?"update":"replace")}if($!==0&&!this.#C&&this.#T(),this.#C&&(H||this.#m(W,$,J),Y&&this.#P(Y,W)),!q&&this.#X&&this.#B){let z=this.#B,G;for(;G=z?.shift();)this.#q?.(...G)}return this}pop(){try{for(;this.#K;){let X=this.#V[this.#L];if(this.#h(!0),this.#H(X)){if(X.__staleWhileFetching)return X.__staleWhileFetching}else if(X!==void 0)return X}}finally{if(this.#X&&this.#B){let X=this.#B,Z;for(;Z=X?.shift();)this.#q?.(...Z)}}}#h(X){let Z=this.#L,V=this.#Y[Z],$=this.#V[Z];return this.#O&&this.#H($)?$.__abortController.abort(Error("evicted")):(this.#v||this.#X)&&(this.#v&&this.#J?.($,V,"evict"),this.#X&&this.#B?.push([$,V,"evict"])),this.#E(Z),this.#_?.[Z]&&(clearTimeout(this.#_[Z]),this.#_[Z]=void 0),X&&(this.#Y[Z]=void 0,this.#V[Z]=void 0,this.#F.push(Z)),this.#K===1?(this.#L=this.#U=0,this.#F.length=0):this.#L=this.#G[Z],this.#j.delete(V),this.#K--,Z}has(X,Z={}){let{updateAgeOnHas:V=this.updateAgeOnHas,status:$}=Z,J=this.#j.get(X);if(J!==void 0){let q=this.#V[J];if(this.#H(q)&&q.__staleWhileFetching===void 0)return!1;if(this.#w(J))$&&($.has="stale",this.#P($,J));else return V&&this.#R(J),$&&($.has="hit",this.#P($,J)),!0}else $&&($.has="miss");return!1}peek(X,Z={}){let{allowStale:V=this.allowStale}=Z,$=this.#j.get(X);if($===void 0||!V&&this.#w($))return;let J=this.#V[$];return this.#H(J)?J.__staleWhileFetching:J}#d(X,Z,V,$){let J=Z===void 0?void 0:this.#V[Z];if(this.#H(J))return J;let q=new NQ,{signal:K}=V;K?.addEventListener("abort",()=>q.abort(K.reason),{signal:q.signal});let Y={signal:q.signal,options:V,context:$},H=(U,_=!1)=>{let{aborted:C}=q.signal,M=V.ignoreFetchAbort&&U!==void 0,k=V.ignoreFetchAbort||!!(V.allowStaleOnFetchAbort&&U!==void 0);if(V.status&&(C&&!_?(V.status.fetchAborted=!0,V.status.fetchError=q.signal.reason,M&&(V.status.fetchAbortIgnored=!0)):V.status.fetchResolved=!0),C&&!M&&!_)return W(q.signal.reason,k);let A=G,L=this.#V[Z];return(L===G||M&&_&&L===void 0)&&(U===void 0?A.__staleWhileFetching!==void 0?this.#V[Z]=A.__staleWhileFetching:this.#N(X,"fetch"):(V.status&&(V.status.fetchUpdated=!0),this.set(X,U,Y.options))),U},j=(U)=>(V.status&&(V.status.fetchRejected=!0,V.status.fetchError=U),W(U,!1)),W=(U,_)=>{let{aborted:C}=q.signal,M=C&&V.allowStaleOnFetchAbort,k=M||V.allowStaleOnFetchRejection,A=k||V.noDeleteOnFetchRejection,L=G;if(this.#V[Z]===G&&(!A||!_&&L.__staleWhileFetching===void 0?this.#N(X,"fetch"):M||(this.#V[Z]=L.__staleWhileFetching)),k)return V.status&&L.__staleWhileFetching!==void 0&&(V.status.returnedStale=!0),L.__staleWhileFetching;if(L.__returned===L)throw U},z=(U,_)=>{let C=this.#k?.(X,J,Y);C&&C instanceof Promise&&C.then((M)=>U(M===void 0?void 0:M),_),q.signal.addEventListener("abort",()=>{(!V.ignoreFetchAbort||V.allowStaleOnFetchAbort)&&(U(void 0),V.allowStaleOnFetchAbort&&(U=(M)=>H(M,!0)))})};V.status&&(V.status.fetchDispatched=!0);let G=new Promise(z).then(H,j),B=Object.assign(G,{__abortController:q,__staleWhileFetching:J,__returned:void 0});return Z===void 0?(this.set(X,B,{...Y.options,status:void 0}),Z=this.#j.get(X)):this.#V[Z]=B,B}#H(X){if(!this.#O)return!1;let Z=X;return!!Z&&Z instanceof Promise&&Z.hasOwnProperty("__staleWhileFetching")&&Z.__abortController instanceof NQ}async fetch(X,Z={}){let{allowStale:V=this.allowStale,updateAgeOnGet:$=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,ttl:q=this.ttl,noDisposeOnSet:K=this.noDisposeOnSet,size:Y=0,sizeCalculation:H=this.sizeCalculation,noUpdateTTL:j=this.noUpdateTTL,noDeleteOnFetchRejection:W=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:z=this.allowStaleOnFetchRejection,ignoreFetchAbort:G=this.ignoreFetchAbort,allowStaleOnFetchAbort:B=this.allowStaleOnFetchAbort,context:U,forceRefresh:_=!1,status:C,signal:M}=Z;if(!this.#O)return C&&(C.fetch="get"),this.get(X,{allowStale:V,updateAgeOnGet:$,noDeleteOnStaleGet:J,status:C});let k={allowStale:V,updateAgeOnGet:$,noDeleteOnStaleGet:J,ttl:q,noDisposeOnSet:K,size:Y,sizeCalculation:H,noUpdateTTL:j,noDeleteOnFetchRejection:W,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:B,ignoreFetchAbort:G,status:C,signal:M},A=this.#j.get(X);if(A===void 0){C&&(C.fetch="miss");let L=this.#d(X,A,k,U);return L.__returned=L}else{let L=this.#V[A];if(this.#H(L)){let XQ=V&&L.__staleWhileFetching!==void 0;return C&&(C.fetch="inflight",XQ&&(C.returnedStale=!0)),XQ?L.__staleWhileFetching:L.__returned=L}let n=this.#w(A);if(!_&&!n)return C&&(C.fetch="hit"),this.#y(A),$&&this.#R(A),C&&this.#P(C,A),L;let c=this.#d(X,A,k,U),QQ=c.__staleWhileFetching!==void 0&&V;return C&&(C.fetch=n?"stale":"refresh",QQ&&n&&(C.returnedStale=!0)),QQ?c.__staleWhileFetching:c.__returned=c}}async forceFetch(X,Z={}){let V=await this.fetch(X,Z);if(V===void 0)throw Error("fetch() returned undefined");return V}memo(X,Z={}){let V=this.#M;if(!V)throw Error("no memoMethod provided to constructor");let{context:$,forceRefresh:J,...q}=Z,K=this.get(X,q);if(!J&&K!==void 0)return K;let Y=V(X,K,{options:q,context:$});return this.set(X,Y,q),Y}get(X,Z={}){let{allowStale:V=this.allowStale,updateAgeOnGet:$=this.updateAgeOnGet,noDeleteOnStaleGet:J=this.noDeleteOnStaleGet,status:q}=Z,K=this.#j.get(X);if(K!==void 0){let Y=this.#V[K],H=this.#H(Y);return q&&this.#P(q,K),this.#w(K)?(q&&(q.get="stale"),H?(q&&V&&Y.__staleWhileFetching!==void 0&&(q.returnedStale=!0),V?Y.__staleWhileFetching:void 0):(J||this.#N(X,"expire"),q&&V&&(q.returnedStale=!0),V?Y:void 0)):(q&&(q.get="hit"),H?Y.__staleWhileFetching:(this.#y(K),$&&this.#R(K),Y))}else q&&(q.get="miss")}#c(X,Z){this.#A[Z]=X,this.#G[X]=Z}#y(X){X!==this.#U&&(X===this.#L?this.#L=this.#G[X]:this.#c(this.#A[X],this.#G[X]),this.#c(this.#U,X),this.#U=X)}delete(X){return this.#N(X,"delete")}#N(X,Z){let V=!1;if(this.#K!==0){let $=this.#j.get(X);if($!==void 0)if(this.#_?.[$]&&(clearTimeout(this.#_?.[$]),this.#_[$]=void 0),V=!0,this.#K===1)this.#o(Z);else{this.#E($);let J=this.#V[$];if(this.#H(J)?J.__abortController.abort(Error("deleted")):(this.#v||this.#X)&&(this.#v&&this.#J?.(J,X,Z),this.#X&&this.#B?.push([J,X,Z])),this.#j.delete(X),this.#Y[$]=void 0,this.#V[$]=void 0,$===this.#U)this.#U=this.#A[$];else if($===this.#L)this.#L=this.#G[$];else{let q=this.#A[$];this.#G[q]=this.#G[$];let K=this.#G[$];this.#A[K]=this.#A[$]}this.#K--,this.#F.push($)}}if(this.#X&&this.#B?.length){let $=this.#B,J;for(;J=$?.shift();)this.#q?.(...J)}return V}clear(){return this.#o("delete")}#o(X){for(let Z of this.#S({allowStale:!0})){let V=this.#V[Z];if(this.#H(V))V.__abortController.abort(Error("deleted"));else{let $=this.#Y[Z];this.#v&&this.#J?.(V,$,X),this.#X&&this.#B?.push([V,$,X])}}if(this.#j.clear(),this.#V.fill(void 0),this.#Y.fill(void 0),this.#C&&this.#x){this.#C.fill(0),this.#x.fill(0);for(let Z of this.#_??[])Z!==void 0&&clearTimeout(Z);this.#_?.fill(void 0)}if(this.#I&&this.#I.fill(0),this.#L=0,this.#U=0,this.#F.length=0,this.#z=0,this.#K=0,this.#X&&this.#B){let Z=this.#B,V;for(;V=Z?.shift();)this.#q?.(...V)}}};import{posix as d6,win32 as W0}from"node:path";import{fileURLToPath as c6}from"node:url";import{lstatSync as l6,readdir as o6,readdirSync as n6,readlinkSync as i6,realpathSync as p6}from"fs";import*as a6 from"node:fs";import{lstat as r6,readdir as e6,readlink as t6,realpath as Q7}from"node:fs/promises";import{EventEmitter as q0}from"node:events";import n0 from"node:stream";import{StringDecoder as T6}from"node:string_decoder";var d0=typeof process==="object"&&process?process:{stdout:null,stderr:null},P6=(Q)=>!!Q&&typeof Q==="object"&&(Q instanceof r||Q instanceof n0||b6(Q)||u6(Q)),b6=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof q0&&typeof Q.pipe==="function"&&Q.pipe!==n0.Writable.prototype.pipe,u6=(Q)=>!!Q&&typeof Q==="object"&&Q instanceof q0&&typeof Q.write==="function"&&typeof Q.end==="function",l=Symbol("EOF"),o=Symbol("maybeEmitEnd"),p=Symbol("emittedEnd"),DQ=Symbol("emittingEnd"),GQ=Symbol("emittedError"),SQ=Symbol("closed"),c0=Symbol("read"),TQ=Symbol("flush"),l0=Symbol("flushChunk"),m=Symbol("encoding"),VQ=Symbol("decoder"),w=Symbol("flowing"),UQ=Symbol("paused"),$Q=Symbol("resume"),I=Symbol("buffer"),D=Symbol("pipes"),x=Symbol("bufferLength"),X0=Symbol("bufferPush"),PQ=Symbol("bufferShift"),F=Symbol("objectMode"),v=Symbol("destroyed"),Z0=Symbol("error"),V0=Symbol("emitData"),o0=Symbol("emitEnd"),$0=Symbol("emitEnd2"),g=Symbol("async"),J0=Symbol("abort"),bQ=Symbol("aborted"),BQ=Symbol("signal"),s=Symbol("dataListeners"),T=Symbol("discarded"),CQ=(Q)=>Promise.resolve().then(Q),y6=(Q)=>Q(),E6=(Q)=>Q==="end"||Q==="finish"||Q==="prefinish",m6=(Q)=>Q instanceof ArrayBuffer||!!Q&&typeof Q==="object"&&Q.constructor&&Q.constructor.name==="ArrayBuffer"&&Q.byteLength>=0,f6=(Q)=>!Buffer.isBuffer(Q)&&ArrayBuffer.isView(Q);class K0{src;dest;opts;ondrain;constructor(Q,X,Z){this.src=Q,this.dest=X,this.opts=Z,this.ondrain=()=>Q[$Q](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(Q){}end(){if(this.unpipe(),this.opts.end)this.dest.end()}}class i0 extends K0{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(Q,X,Z){super(Q,X,Z);this.proxyErrors=(V)=>this.dest.emit("error",V),Q.on("error",this.proxyErrors)}}var g6=(Q)=>!!Q.objectMode,h6=(Q)=>!Q.objectMode&&!!Q.encoding&&Q.encoding!=="buffer";class r extends q0{[w]=!1;[UQ]=!1;[D]=[];[I]=[];[F];[m];[g];[VQ];[l]=!1;[p]=!1;[DQ]=!1;[SQ]=!1;[GQ]=null;[x]=0;[v]=!1;[BQ];[bQ]=!1;[s]=0;[T]=!1;writable=!0;readable=!0;constructor(...Q){let X=Q[0]||{};super();if(X.objectMode&&typeof X.encoding==="string")throw TypeError("Encoding and objectMode may not be used together");if(g6(X))this[F]=!0,this[m]=null;else if(h6(X))this[m]=X.encoding,this[F]=!1;else this[F]=!1,this[m]=null;if(this[g]=!!X.async,this[VQ]=this[m]?new T6(this[m]):null,X&&X.debugExposeBuffer===!0)Object.defineProperty(this,"buffer",{get:()=>this[I]});if(X&&X.debugExposePipes===!0)Object.defineProperty(this,"pipes",{get:()=>this[D]});let{signal:Z}=X;if(Z)if(this[BQ]=Z,Z.aborted)this[J0]();else Z.addEventListener("abort",()=>this[J0]())}get bufferLength(){return this[x]}get encoding(){return this[m]}set encoding(Q){throw Error("Encoding must be set at instantiation time")}setEncoding(Q){throw Error("Encoding must be set at instantiation time")}get objectMode(){return this[F]}set objectMode(Q){throw Error("objectMode must be set at instantiation time")}get["async"](){return this[g]}set["async"](Q){this[g]=this[g]||!!Q}[J0](){this[bQ]=!0,this.emit("abort",this[BQ]?.reason),this.destroy(this[BQ]?.reason)}get aborted(){return this[bQ]}set aborted(Q){}write(Q,X,Z){if(this[bQ])return!1;if(this[l])throw Error("write after end");if(this[v])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof X==="function")Z=X,X="utf8";if(!X)X="utf8";let V=this[g]?CQ:y6;if(!this[F]&&!Buffer.isBuffer(Q)){if(f6(Q))Q=Buffer.from(Q.buffer,Q.byteOffset,Q.byteLength);else if(m6(Q))Q=Buffer.from(Q);else if(typeof Q!=="string")throw Error("Non-contiguous data written to non-objectMode stream")}if(this[F]){if(this[w]&&this[x]!==0)this[TQ](!0);if(this[w])this.emit("data",Q);else this[X0](Q);if(this[x]!==0)this.emit("readable");if(Z)V(Z);return this[w]}if(!Q.length){if(this[x]!==0)this.emit("readable");if(Z)V(Z);return this[w]}if(typeof Q==="string"&&!(X===this[m]&&!this[VQ]?.lastNeed))Q=Buffer.from(Q,X);if(Buffer.isBuffer(Q)&&this[m])Q=this[VQ].write(Q);if(this[w]&&this[x]!==0)this[TQ](!0);if(this[w])this.emit("data",Q);else this[X0](Q);if(this[x]!==0)this.emit("readable");if(Z)V(Z);return this[w]}read(Q){if(this[v])return null;if(this[T]=!1,this[x]===0||Q===0||Q&&Q>this[x])return this[o](),null;if(this[F])Q=null;if(this[I].length>1&&!this[F])this[I]=[this[m]?this[I].join(""):Buffer.concat(this[I],this[x])];let X=this[c0](Q||null,this[I][0]);return this[o](),X}[c0](Q,X){if(this[F])this[PQ]();else{let Z=X;if(Q===Z.length||Q===null)this[PQ]();else if(typeof Z==="string")this[I][0]=Z.slice(Q),X=Z.slice(0,Q),this[x]-=Q;else this[I][0]=Z.subarray(Q),X=Z.subarray(0,Q),this[x]-=Q}if(this.emit("data",X),!this[I].length&&!this[l])this.emit("drain");return X}end(Q,X,Z){if(typeof Q==="function")Z=Q,Q=void 0;if(typeof X==="function")Z=X,X="utf8";if(Q!==void 0)this.write(Q,X);if(Z)this.once("end",Z);if(this[l]=!0,this.writable=!1,this[w]||!this[UQ])this[o]();return this}[$Q](){if(this[v])return;if(!this[s]&&!this[D].length)this[T]=!0;if(this[UQ]=!1,this[w]=!0,this.emit("resume"),this[I].length)this[TQ]();else if(this[l])this[o]();else this.emit("drain")}resume(){return this[$Q]()}pause(){this[w]=!1,this[UQ]=!0,this[T]=!1}get destroyed(){return this[v]}get flowing(){return this[w]}get paused(){return this[UQ]}[X0](Q){if(this[F])this[x]+=1;else this[x]+=Q.length;this[I].push(Q)}[PQ](){if(this[F])this[x]-=1;else this[x]-=this[I][0].length;return this[I].shift()}[TQ](Q=!1){do;while(this[l0](this[PQ]())&&this[I].length);if(!Q&&!this[I].length&&!this[l])this.emit("drain")}[l0](Q){return this.emit("data",Q),this[w]}pipe(Q,X){if(this[v])return Q;this[T]=!1;let Z=this[p];if(X=X||{},Q===d0.stdout||Q===d0.stderr)X.end=!1;else X.end=X.end!==!1;if(X.proxyErrors=!!X.proxyErrors,Z){if(X.end)Q.end()}else if(this[D].push(!X.proxyErrors?new K0(this,Q,X):new i0(this,Q,X)),this[g])CQ(()=>this[$Q]());else this[$Q]();return Q}unpipe(Q){let X=this[D].find((Z)=>Z.dest===Q);if(X){if(this[D].length===1){if(this[w]&&this[s]===0)this[w]=!1;this[D]=[]}else this[D].splice(this[D].indexOf(X),1);X.unpipe()}}addListener(Q,X){return this.on(Q,X)}on(Q,X){let Z=super.on(Q,X);if(Q==="data"){if(this[T]=!1,this[s]++,!this[D].length&&!this[w])this[$Q]()}else if(Q==="readable"&&this[x]!==0)super.emit("readable");else if(E6(Q)&&this[p])super.emit(Q),this.removeAllListeners(Q);else if(Q==="error"&&this[GQ]){let V=X;if(this[g])CQ(()=>V.call(this,this[GQ]));else V.call(this,this[GQ])}return Z}removeListener(Q,X){return this.off(Q,X)}off(Q,X){let Z=super.off(Q,X);if(Q==="data"){if(this[s]=this.listeners("data").length,this[s]===0&&!this[T]&&!this[D].length)this[w]=!1}return Z}removeAllListeners(Q){let X=super.removeAllListeners(Q);if(Q==="data"||Q===void 0){if(this[s]=0,!this[T]&&!this[D].length)this[w]=!1}return X}get emittedEnd(){return this[p]}[o](){if(!this[DQ]&&!this[p]&&!this[v]&&this[I].length===0&&this[l]){if(this[DQ]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[SQ])this.emit("close");this[DQ]=!1}}emit(Q,...X){let Z=X[0];if(Q!=="error"&&Q!=="close"&&Q!==v&&this[v])return!1;else if(Q==="data")return!this[F]&&!Z?!1:this[g]?(CQ(()=>this[V0](Z)),!0):this[V0](Z);else if(Q==="end")return this[o0]();else if(Q==="close"){if(this[SQ]=!0,!this[p]&&!this[v])return!1;let $=super.emit("close");return this.removeAllListeners("close"),$}else if(Q==="error"){this[GQ]=Z,super.emit(Z0,Z);let $=!this[BQ]||this.listeners("error").length?super.emit("error",Z):!1;return this[o](),$}else if(Q==="resume"){let $=super.emit("resume");return this[o](),$}else if(Q==="finish"||Q==="prefinish"){let $=super.emit(Q);return this.removeAllListeners(Q),$}let V=super.emit(Q,...X);return this[o](),V}[V0](Q){for(let Z of this[D])if(Z.dest.write(Q)===!1)this.pause();let X=this[T]?!1:super.emit("data",Q);return this[o](),X}[o0](){if(this[p])return!1;return this[p]=!0,this.readable=!1,this[g]?(CQ(()=>this[$0]()),!0):this[$0]()}[$0](){if(this[VQ]){let X=this[VQ].end();if(X){for(let Z of this[D])Z.dest.write(X);if(!this[T])super.emit("data",X)}}for(let X of this[D])X.end();let Q=super.emit("end");return this.removeAllListeners("end"),Q}async collect(){let Q=Object.assign([],{dataLength:0});if(!this[F])Q.dataLength=0;let X=this.promise();return this.on("data",(Z)=>{if(Q.push(Z),!this[F])Q.dataLength+=Z.length}),await X,Q}async concat(){if(this[F])throw Error("cannot concat in objectMode");let Q=await this.collect();return this[m]?Q.join(""):Buffer.concat(Q,Q.dataLength)}async promise(){return new Promise((Q,X)=>{this.on(v,()=>X(Error("stream destroyed"))),this.on("error",(Z)=>X(Z)),this.on("end",()=>Q())})}[Symbol.asyncIterator](){this[T]=!1;let Q=!1,X=async()=>{return this.pause(),Q=!0,{value:void 0,done:!0}};return{next:()=>{if(Q)return X();let V=this.read();if(V!==null)return Promise.resolve({done:!1,value:V});if(this[l])return X();let $,J,q=(j)=>{this.off("data",K),this.off("end",Y),this.off(v,H),X(),J(j)},K=(j)=>{this.off("error",q),this.off("end",Y),this.off(v,H),this.pause(),$({value:j,done:!!this[l]})},Y=()=>{this.off("error",q),this.off("data",K),this.off(v,H),X(),$({done:!0,value:void 0})},H=()=>q(Error("stream destroyed"));return new Promise((j,W)=>{J=W,$=j,this.once(v,H),this.once("error",q),this.once("end",Y),this.once("data",K)})},throw:X,return:X,[Symbol.asyncIterator](){return this},[Symbol.asyncDispose]:async()=>{}}}[Symbol.iterator](){this[T]=!1;let Q=!1,X=()=>{return this.pause(),this.off(Z0,X),this.off(v,X),this.off("end",X),Q=!0,{done:!0,value:void 0}},Z=()=>{if(Q)return X();let V=this.read();return V===null?X():{done:!1,value:V}};return this.once("end",X),this.once(Z0,X),this.once(v,X),{next:Z,throw:X,return:X,[Symbol.iterator](){return this},[Symbol.dispose]:()=>{}}}destroy(Q){if(this[v]){if(Q)this.emit("error",Q);else this.emit(v);return this}this[v]=!0,this[T]=!0,this[I].length=0,this[x]=0;let X=this;if(typeof X.close==="function"&&!this[SQ])X.close();if(Q)this.emit("error",Q);else this.emit(v);return this}static get isStream(){return P6}}var s6=p6.native,_Q={lstatSync:l6,readdir:o6,readdirSync:n6,readlinkSync:i6,realpathSync:s6,promises:{lstat:r6,readdir:e6,readlink:t6,realpath:Q7}},e0=(Q)=>!Q||Q===_Q||Q===a6?_Q:{..._Q,...Q,promises:{..._Q.promises,...Q.promises||{}}},t0=/^\\\\\?\\([a-z]:)\\?$/i,X7=(Q)=>Q.replace(/\//g,"\\").replace(t0,"$1\\"),Z7=/[\\\/]/,y=0,Q5=1,X5=2,h=4,Z5=6,V5=8,e=10,$5=12,u=15,MQ=~u,Y0=16,p0=32,LQ=64,f=128,uQ=256,EQ=512,a0=LQ|f|EQ,V7=1023,H0=(Q)=>Q.isFile()?V5:Q.isDirectory()?h:Q.isSymbolicLink()?e:Q.isCharacterDevice()?X5:Q.isBlockDevice()?Z5:Q.isSocket()?$5:Q.isFIFO()?Q5:y,s0=new zQ({max:4096}),kQ=(Q)=>{let X=s0.get(Q);if(X)return X;let Z=Q.normalize("NFKD");return s0.set(Q,Z),Z},r0=new zQ({max:4096}),yQ=(Q)=>{let X=r0.get(Q);if(X)return X;let Z=kQ(Q.toLowerCase());return r0.set(Q,Z),Z};class j0 extends zQ{constructor(){super({max:256})}}class J5 extends zQ{constructor(Q=16384){super({maxSize:Q,sizeCalculation:(X)=>X.length+1})}}var q5=Symbol("PathScurry setAsCwd");class S{name;root;roots;parent;nocase;isCWD=!1;#Q;#Z;get dev(){return this.#Z}#J;get mode(){return this.#J}#$;get nlink(){return this.#$}#q;get uid(){return this.#q}#k;get gid(){return this.#k}#M;get rdev(){return this.#M}#W;get blksize(){return this.#W}#K;get ino(){return this.#K}#z;get size(){return this.#z}#j;get blocks(){return this.#j}#Y;get atimeMs(){return this.#Y}#V;get mtimeMs(){return this.#V}#G;get ctimeMs(){return this.#G}#A;get birthtimeMs(){return this.#A}#L;get atime(){return this.#L}#U;get mtime(){return this.#U}#F;get ctime(){return this.#F}#B;get birthtime(){return this.#B}#I;#x;#C;#_;#v;#O;#X;#b;#T;#R;get parentPath(){return(this.parent||this).fullpath()}get path(){return this.parentPath}constructor(Q,X=y,Z,V,$,J,q){if(this.name=Q,this.#I=$?yQ(Q):kQ(Q),this.#X=X&V7,this.nocase=$,this.roots=V,this.root=Z||this,this.#b=J,this.#C=q.fullpath,this.#v=q.relative,this.#O=q.relativePosix,this.parent=q.parent,this.parent)this.#Q=this.parent.#Q;else this.#Q=e0(q.fs)}depth(){if(this.#x!==void 0)return this.#x;if(!this.parent)return this.#x=0;return this.#x=this.parent.depth()+1}childrenCache(){return this.#b}resolve(Q){if(!Q)return this;let X=this.getRootString(Q),V=Q.substring(X.length).split(this.splitSep);return X?this.getRoot(X).#P(V):this.#P(V)}#P(Q){let X=this;for(let Z of Q)X=X.child(Z);return X}children(){let Q=this.#b.get(this);if(Q)return Q;let X=Object.assign([],{provisional:0});return this.#b.set(this,X),this.#X&=~Y0,X}child(Q,X){if(Q===""||Q===".")return this;if(Q==="..")return this.parent||this;let Z=this.children(),V=this.nocase?yQ(Q):kQ(Q);for(let K of Z)if(K.#I===V)return K;let $=this.parent?this.sep:"",J=this.#C?this.#C+$+Q:void 0,q=this.newChild(Q,y,{...X,parent:this,fullpath:J});if(!this.canReaddir())q.#X|=f;return Z.push(q),q}relative(){if(this.isCWD)return"";if(this.#v!==void 0)return this.#v;let Q=this.name,X=this.parent;if(!X)return this.#v=this.name;let Z=X.relative();return Z+(!Z||!X.parent?"":this.sep)+Q}relativePosix(){if(this.sep==="/")return this.relative();if(this.isCWD)return"";if(this.#O!==void 0)return this.#O;let Q=this.name,X=this.parent;if(!X)return this.#O=this.fullpathPosix();let Z=X.relativePosix();return Z+(!Z||!X.parent?"":"/")+Q}fullpath(){if(this.#C!==void 0)return this.#C;let Q=this.name,X=this.parent;if(!X)return this.#C=this.name;let V=X.fullpath()+(!X.parent?"":this.sep)+Q;return this.#C=V}fullpathPosix(){if(this.#_!==void 0)return this.#_;if(this.sep==="/")return this.#_=this.fullpath();if(!this.parent){let V=this.fullpath().replace(/\\/g,"/");if(/^[a-z]:\//i.test(V))return this.#_=`//?/${V}`;else return this.#_=V}let Q=this.parent,X=Q.fullpathPosix(),Z=X+(!X||!Q.parent?"":"/")+this.name;return this.#_=Z}isUnknown(){return(this.#X&u)===y}isType(Q){return this[`is${Q}`]()}getType(){return this.isUnknown()?"Unknown":this.isDirectory()?"Directory":this.isFile()?"File":this.isSymbolicLink()?"SymbolicLink":this.isFIFO()?"FIFO":this.isCharacterDevice()?"CharacterDevice":this.isBlockDevice()?"BlockDevice":this.isSocket()?"Socket":"Unknown"}isFile(){return(this.#X&u)===V5}isDirectory(){return(this.#X&u)===h}isCharacterDevice(){return(this.#X&u)===X5}isBlockDevice(){return(this.#X&u)===Z5}isFIFO(){return(this.#X&u)===Q5}isSocket(){return(this.#X&u)===$5}isSymbolicLink(){return(this.#X&e)===e}lstatCached(){return this.#X&p0?this:void 0}readlinkCached(){return this.#T}realpathCached(){return this.#R}readdirCached(){let Q=this.children();return Q.slice(0,Q.provisional)}canReadlink(){if(this.#T)return!0;if(!this.parent)return!1;let Q=this.#X&u;return!(Q!==y&&Q!==e||this.#X&uQ||this.#X&f)}calledReaddir(){return!!(this.#X&Y0)}isENOENT(){return!!(this.#X&f)}isNamed(Q){return!this.nocase?this.#I===kQ(Q):this.#I===yQ(Q)}async readlink(){let Q=this.#T;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=await this.#Q.promises.readlink(this.fullpath()),Z=(await this.parent.realpath())?.resolve(X);if(Z)return this.#T=Z}catch(X){this.#S(X.code);return}}readlinkSync(){let Q=this.#T;if(Q)return Q;if(!this.canReadlink())return;if(!this.parent)return;try{let X=this.#Q.readlinkSync(this.fullpath()),Z=this.parent.realpathSync()?.resolve(X);if(Z)return this.#T=Z}catch(X){this.#S(X.code);return}}#m(Q){this.#X|=Y0;for(let X=Q.provisional;X<Q.length;X++){let Z=Q[X];if(Z)Z.#w()}}#w(){if(this.#X&f)return;this.#X=(this.#X|f)&MQ,this.#l()}#l(){let Q=this.children();Q.provisional=0;for(let X of Q)X.#w()}#E(){this.#X|=EQ,this.#u()}#u(){if(this.#X&LQ)return;let Q=this.#X;if((Q&u)===h)Q&=MQ;this.#X=Q|LQ,this.#l()}#f(Q=""){if(Q==="ENOTDIR"||Q==="EPERM")this.#u();else if(Q==="ENOENT")this.#w();else this.children().provisional=0}#D(Q=""){if(Q==="ENOTDIR")this.parent.#u();else if(Q==="ENOENT")this.#w()}#S(Q=""){let X=this.#X;if(X|=uQ,Q==="ENOENT")X|=f;if(Q==="EINVAL"||Q==="UNKNOWN")X&=MQ;if(this.#X=X,Q==="ENOTDIR"&&this.parent)this.parent.#u()}#g(Q,X){return this.#d(Q,X)||this.#h(Q,X)}#h(Q,X){let Z=H0(Q),V=this.newChild(Q.name,Z,{parent:this}),$=V.#X&u;if($!==h&&$!==e&&$!==y)V.#X|=LQ;return X.unshift(V),X.provisional++,V}#d(Q,X){for(let Z=X.provisional;Z<X.length;Z++){let V=X[Z];if((this.nocase?yQ(Q.name):kQ(Q.name))!==V.#I)continue;return this.#H(Q,V,Z,X)}}#H(Q,X,Z,V){let $=X.name;if(X.#X=X.#X&MQ|H0(Q),$!==Q.name)X.name=Q.name;if(Z!==V.provisional){if(Z===V.length-1)V.pop();else V.splice(Z,1);V.unshift(X)}return V.provisional++,X}async lstat(){if((this.#X&f)===0)try{return this.#c(await this.#Q.promises.lstat(this.fullpath())),this}catch(Q){this.#D(Q.code)}}lstatSync(){if((this.#X&f)===0)try{return this.#c(this.#Q.lstatSync(this.fullpath())),this}catch(Q){this.#D(Q.code)}}#c(Q){let{atime:X,atimeMs:Z,birthtime:V,birthtimeMs:$,blksize:J,blocks:q,ctime:K,ctimeMs:Y,dev:H,gid:j,ino:W,mode:z,mtime:G,mtimeMs:B,nlink:U,rdev:_,size:C,uid:M}=Q;this.#L=X,this.#Y=Z,this.#B=V,this.#A=$,this.#W=J,this.#j=q,this.#F=K,this.#G=Y,this.#Z=H,this.#k=j,this.#K=W,this.#J=z,this.#U=G,this.#V=B,this.#$=U,this.#M=_,this.#z=C,this.#q=M;let k=H0(Q);if(this.#X=this.#X&MQ|k|p0,k!==y&&k!==h&&k!==e)this.#X|=LQ}#y=[];#N=!1;#o(Q){this.#N=!1;let X=this.#y.slice();this.#y.length=0,X.forEach((Z)=>Z(null,Q))}readdirCB(Q,X=!1){if(!this.canReaddir()){if(X)Q(null,[]);else queueMicrotask(()=>Q(null,[]));return}let Z=this.children();if(this.calledReaddir()){let $=Z.slice(0,Z.provisional);if(X)Q(null,$);else queueMicrotask(()=>Q(null,$));return}if(this.#y.push(Q),this.#N)return;this.#N=!0;let V=this.fullpath();this.#Q.readdir(V,{withFileTypes:!0},($,J)=>{if($)this.#f($.code),Z.provisional=0;else{for(let q of J)this.#g(q,Z);this.#m(Z)}this.#o(Z.slice(0,Z.provisional));return})}#n;async readdir(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();if(this.#n)await this.#n;else{let Z=()=>{};this.#n=new Promise((V)=>Z=V);try{for(let V of await this.#Q.promises.readdir(X,{withFileTypes:!0}))this.#g(V,Q);this.#m(Q)}catch(V){this.#f(V.code),Q.provisional=0}this.#n=void 0,Z()}return Q.slice(0,Q.provisional)}readdirSync(){if(!this.canReaddir())return[];let Q=this.children();if(this.calledReaddir())return Q.slice(0,Q.provisional);let X=this.fullpath();try{for(let Z of this.#Q.readdirSync(X,{withFileTypes:!0}))this.#g(Z,Q);this.#m(Q)}catch(Z){this.#f(Z.code),Q.provisional=0}return Q.slice(0,Q.provisional)}canReaddir(){if(this.#X&a0)return!1;let Q=u&this.#X;if(!(Q===y||Q===h||Q===e))return!1;return!0}shouldWalk(Q,X){return(this.#X&h)===h&&!(this.#X&a0)&&!Q.has(this)&&(!X||X(this))}async realpath(){if(this.#R)return this.#R;if((EQ|uQ|f)&this.#X)return;try{let Q=await this.#Q.promises.realpath(this.fullpath());return this.#R=this.resolve(Q)}catch(Q){this.#E()}}realpathSync(){if(this.#R)return this.#R;if((EQ|uQ|f)&this.#X)return;try{let Q=this.#Q.realpathSync(this.fullpath());return this.#R=this.resolve(Q)}catch(Q){this.#E()}}[q5](Q){if(Q===this)return;Q.isCWD=!1,this.isCWD=!0;let X=new Set([]),Z=[],V=this;while(V&&V.parent)X.add(V),V.#v=Z.join(this.sep),V.#O=Z.join("/"),V=V.parent,Z.push("..");V=Q;while(V&&V.parent&&!X.has(V))V.#v=void 0,V.#O=void 0,V=V.parent}}class mQ extends S{sep="\\";splitSep=Z7;constructor(Q,X=y,Z,V,$,J,q){super(Q,X,Z,V,$,J,q)}newChild(Q,X=y,Z={}){return new mQ(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}getRootString(Q){return W0.parse(Q).root}getRoot(Q){if(Q=X7(Q.toUpperCase()),Q===this.root.name)return this.root;for(let[X,Z]of Object.entries(this.roots))if(this.sameRoot(Q,X))return this.roots[Q]=Z;return this.roots[Q]=new AQ(Q,this).root}sameRoot(Q,X=this.root.name){return Q=Q.toUpperCase().replace(/\//g,"\\").replace(t0,"$1\\"),Q===X}}class fQ extends S{splitSep="/";sep="/";constructor(Q,X=y,Z,V,$,J,q){super(Q,X,Z,V,$,J,q)}getRootString(Q){return Q.startsWith("/")?"/":""}getRoot(Q){return this.root}newChild(Q,X=y,Z={}){return new fQ(Q,X,this.root,this.roots,this.nocase,this.childrenCache(),Z)}}class z0{root;rootPath;roots;cwd;#Q;#Z;#J;nocase;#$;constructor(Q=process.cwd(),X,Z,{nocase:V,childrenCacheSize:$=16384,fs:J=_Q}={}){if(this.#$=e0(J),Q instanceof URL||Q.startsWith("file://"))Q=c6(Q);let q=X.resolve(Q);this.roots=Object.create(null),this.rootPath=this.parseRootPath(q),this.#Q=new j0,this.#Z=new j0,this.#J=new J5($);let K=q.substring(this.rootPath.length).split(Z);if(K.length===1&&!K[0])K.pop();if(V===void 0)throw TypeError("must provide nocase setting to PathScurryBase ctor");this.nocase=V,this.root=this.newRoot(this.#$),this.roots[this.rootPath]=this.root;let Y=this.root,H=K.length-1,j=X.sep,W=this.rootPath,z=!1;for(let G of K){let B=H--;Y=Y.child(G,{relative:Array(B).fill("..").join(j),relativePosix:Array(B).fill("..").join("/"),fullpath:W+=(z?"":j)+G}),z=!0}this.cwd=Y}depth(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.depth()}childrenCache(){return this.#J}resolve(...Q){let X="";for(let $=Q.length-1;$>=0;$--){let J=Q[$];if(!J||J===".")continue;if(X=X?`${J}/${X}`:J,this.isAbsolute(J))break}let Z=this.#Q.get(X);if(Z!==void 0)return Z;let V=this.cwd.resolve(X).fullpath();return this.#Q.set(X,V),V}resolvePosix(...Q){let X="";for(let $=Q.length-1;$>=0;$--){let J=Q[$];if(!J||J===".")continue;if(X=X?`${J}/${X}`:J,this.isAbsolute(J))break}let Z=this.#Z.get(X);if(Z!==void 0)return Z;let V=this.cwd.resolve(X).fullpathPosix();return this.#Z.set(X,V),V}relative(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relative()}relativePosix(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.relativePosix()}basename(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.name}dirname(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return(Q.parent||Q).fullpath()}async readdir(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z}=X;if(!Q.canReaddir())return[];else{let V=await Q.readdir();return Z?V:V.map(($)=>$.name)}}readdirSync(Q=this.cwd,X={withFileTypes:!0}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0}=X;if(!Q.canReaddir())return[];else if(Z)return Q.readdirSync();else return Q.readdirSync().map((V)=>V.name)}async lstat(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstat()}lstatSync(Q=this.cwd){if(typeof Q==="string")Q=this.cwd.resolve(Q);return Q.lstatSync()}async readlink(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.readlink();return X?Z:Z?.fullpath()}readlinkSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q.withFileTypes,Q=this.cwd;let Z=Q.readlinkSync();return X?Z:Z?.fullpath()}async realpath(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q.withFileTypes,Q=this.cwd;let Z=await Q.realpath();return X?Z:Z?.fullpath()}realpathSync(Q=this.cwd,{withFileTypes:X}={withFileTypes:!1}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q.withFileTypes,Q=this.cwd;let Z=Q.realpathSync();return X?Z:Z?.fullpath()}async walk(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=[];if(!$||$(Q))q.push(Z?Q:Q.fullpath());let K=new Set,Y=(j,W)=>{K.add(j),j.readdirCB((z,G)=>{if(z)return W(z);let B=G.length;if(!B)return W();let U=()=>{if(--B===0)W()};for(let _ of G){if(!$||$(_))q.push(Z?_:_.fullpath());if(V&&_.isSymbolicLink())_.realpath().then((C)=>C?.isUnknown()?C.lstat():C).then((C)=>C?.shouldWalk(K,J)?Y(C,U):U());else if(_.shouldWalk(K,J))Y(_,U);else U()}},!0)},H=Q;return new Promise((j,W)=>{Y(H,(z)=>{if(z)return W(z);j(q)})})}walkSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=[];if(!$||$(Q))q.push(Z?Q:Q.fullpath());let K=new Set([Q]);for(let Y of K){let H=Y.readdirSync();for(let j of H){if(!$||$(j))q.push(Z?j:j.fullpath());let W=j;if(j.isSymbolicLink()){if(!(V&&(W=j.realpathSync())))continue;if(W.isUnknown())W.lstatSync()}if(W.shouldWalk(K,J))K.add(W)}}return q}[Symbol.asyncIterator](){return this.iterate()}iterate(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;return this.stream(Q,X)[Symbol.asyncIterator]()}[Symbol.iterator](){return this.iterateSync()}*iterateSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X;if(!$||$(Q))yield Z?Q:Q.fullpath();let q=new Set([Q]);for(let K of q){let Y=K.readdirSync();for(let H of Y){if(!$||$(H))yield Z?H:H.fullpath();let j=H;if(H.isSymbolicLink()){if(!(V&&(j=H.realpathSync())))continue;if(j.isUnknown())j.lstatSync()}if(j.shouldWalk(q,J))q.add(j)}}}stream(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=new r({objectMode:!0});if(!$||$(Q))q.write(Z?Q:Q.fullpath());let K=new Set,Y=[Q],H=0,j=()=>{let W=!1;while(!W){let z=Y.shift();if(!z){if(H===0)q.end();return}H++,K.add(z);let G=(U,_,C=!1)=>{if(U)return q.emit("error",U);if(V&&!C){let M=[];for(let k of _)if(k.isSymbolicLink())M.push(k.realpath().then((A)=>A?.isUnknown()?A.lstat():A));if(M.length){Promise.all(M).then(()=>G(null,_,!0));return}}for(let M of _)if(M&&(!$||$(M))){if(!q.write(Z?M:M.fullpath()))W=!0}H--;for(let M of _){let k=M.realpathCached()||M;if(k.shouldWalk(K,J))Y.push(k)}if(W&&!q.flowing)q.once("drain",j);else if(!B)j()},B=!0;z.readdirCB(G,!0),B=!1}};return j(),q}streamSync(Q=this.cwd,X={}){if(typeof Q==="string")Q=this.cwd.resolve(Q);else if(!(Q instanceof S))X=Q,Q=this.cwd;let{withFileTypes:Z=!0,follow:V=!1,filter:$,walkFilter:J}=X,q=new r({objectMode:!0}),K=new Set;if(!$||$(Q))q.write(Z?Q:Q.fullpath());let Y=[Q],H=0,j=()=>{let W=!1;while(!W){let z=Y.shift();if(!z){if(H===0)q.end();return}H++,K.add(z);let G=z.readdirSync();for(let B of G)if(!$||$(B)){if(!q.write(Z?B:B.fullpath()))W=!0}H--;for(let B of G){let U=B;if(B.isSymbolicLink()){if(!(V&&(U=B.realpathSync())))continue;if(U.isUnknown())U.lstatSync()}if(U.shouldWalk(K,J))Y.push(U)}}if(W&&!q.flowing)q.once("drain",j)};return j(),q}chdir(Q=this.cwd){let X=this.cwd;this.cwd=typeof Q==="string"?this.cwd.resolve(Q):Q,this.cwd[q5](X)}}class AQ extends z0{sep="\\";constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,W0,"\\",{...X,nocase:Z});this.nocase=Z;for(let V=this.cwd;V;V=V.parent)V.nocase=this.nocase}parseRootPath(Q){return W0.parse(Q).root.toUpperCase()}newRoot(Q){return new mQ(this.rootPath,h,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")||Q.startsWith("\\")||/^[a-z]:(\/|\\)/i.test(Q)}}class vQ extends z0{sep="/";constructor(Q=process.cwd(),X={}){let{nocase:Z=!1}=X;super(Q,d6,"/",{...X,nocase:Z});this.nocase=Z}parseRootPath(Q){return"/"}newRoot(Q){return new fQ(this.rootPath,h,void 0,this.roots,this.nocase,this.childrenCache(),{fs:Q})}isAbsolute(Q){return Q.startsWith("/")}}class gQ extends vQ{constructor(Q=process.cwd(),X={}){let{nocase:Z=!0}=X;super(Q,{...X,nocase:Z})}}var w8=process.platform==="win32"?mQ:fQ,K5=process.platform==="win32"?AQ:process.platform==="darwin"?gQ:vQ;var $7=(Q)=>Q.length>=1,J7=(Q)=>Q.length>=1;class JQ{#Q;#Z;#J;length;#$;#q;#k;#M;#W;#K;#z=!0;constructor(Q,X,Z,V){if(!$7(Q))throw TypeError("empty pattern list");if(!J7(X))throw TypeError("empty glob list");if(X.length!==Q.length)throw TypeError("mismatched pattern list and glob list lengths");if(this.length=Q.length,Z<0||Z>=this.length)throw TypeError("index out of range");if(this.#Q=Q,this.#Z=X,this.#J=Z,this.#$=V,this.#J===0){if(this.isUNC()){let[$,J,q,K,...Y]=this.#Q,[H,j,W,z,...G]=this.#Z;if(Y[0]==="")Y.shift(),G.shift();let B=[$,J,q,K,""].join("/"),U=[H,j,W,z,""].join("/");this.#Q=[B,...Y],this.#Z=[U,...G],this.length=this.#Q.length}else if(this.isDrive()||this.isAbsolute()){let[$,...J]=this.#Q,[q,...K]=this.#Z;if(J[0]==="")J.shift(),K.shift();let Y=$+"/",H=q+"/";this.#Q=[Y,...J],this.#Z=[H,...K],this.length=this.#Q.length}}}pattern(){return this.#Q[this.#J]}isString(){return typeof this.#Q[this.#J]==="string"}isGlobstar(){return this.#Q[this.#J]===R}isRegExp(){return this.#Q[this.#J]instanceof RegExp}globString(){return this.#k=this.#k||(this.#J===0?this.isAbsolute()?this.#Z[0]+this.#Z.slice(1).join("/"):this.#Z.join("/"):this.#Z.slice(this.#J).join("/"))}hasMore(){return this.length>this.#J+1}rest(){if(this.#q!==void 0)return this.#q;if(!this.hasMore())return this.#q=null;return this.#q=new JQ(this.#Q,this.#Z,this.#J+1,this.#$),this.#q.#K=this.#K,this.#q.#W=this.#W,this.#q.#M=this.#M,this.#q}isUNC(){let Q=this.#Q;return this.#W!==void 0?this.#W:this.#W=this.#$==="win32"&&this.#J===0&&Q[0]===""&&Q[1]===""&&typeof Q[2]==="string"&&!!Q[2]&&typeof Q[3]==="string"&&!!Q[3]}isDrive(){let Q=this.#Q;return this.#M!==void 0?this.#M:this.#M=this.#$==="win32"&&this.#J===0&&this.length>1&&typeof Q[0]==="string"&&/^[a-z]:$/i.test(Q[0])}isAbsolute(){let Q=this.#Q;return this.#K!==void 0?this.#K:this.#K=Q[0]===""&&Q.length>1||this.isDrive()||this.isUNC()}root(){let Q=this.#Q[0];return typeof Q==="string"&&this.isAbsolute()&&this.#J===0?Q:""}checkFollowGlobstar(){return!(this.#J===0||!this.isGlobstar()||!this.#z)}markFollowGlobstar(){if(this.#J===0||!this.isGlobstar()||!this.#z)return!1;return this.#z=!1,!0}}var q7=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class wQ{relative;relativeChildren;absolute;absoluteChildren;platform;mmopts;constructor(Q,{nobrace:X,nocase:Z,noext:V,noglobstar:$,platform:J=q7}){this.relative=[],this.absolute=[],this.relativeChildren=[],this.absoluteChildren=[],this.platform=J,this.mmopts={dot:!0,nobrace:X,nocase:Z,noext:V,noglobstar:$,optimizationLevel:2,platform:J,nocomment:!0,nonegate:!0};for(let q of Q)this.add(q)}add(Q){let X=new b(Q,this.mmopts);for(let Z=0;Z<X.set.length;Z++){let V=X.set[Z],$=X.globParts[Z];if(!V||!$)throw Error("invalid pattern object");while(V[0]==="."&&$[0]===".")V.shift(),$.shift();let J=new JQ(V,$,0,this.platform),q=new b(J.globString(),this.mmopts),K=$[$.length-1]==="**",Y=J.isAbsolute();if(Y)this.absolute.push(q);else this.relative.push(q);if(K)if(Y)this.absoluteChildren.push(q);else this.relativeChildren.push(q)}}ignored(Q){let X=Q.fullpath(),Z=`${X}/`,V=Q.relative()||".",$=`${V}/`;for(let J of this.relative)if(J.match(V)||J.match($))return!0;for(let J of this.absolute)if(J.match(X)||J.match(Z))return!0;return!1}childrenIgnored(Q){let X=Q.fullpath()+"/",Z=(Q.relative()||".")+"/";for(let V of this.relativeChildren)if(V.match(Z))return!0;for(let V of this.absoluteChildren)if(V.match(X))return!0;return!1}}class G0{store;constructor(Q=new Map){this.store=Q}copy(){return new G0(new Map(this.store))}hasWalked(Q,X){return this.store.get(Q.fullpath())?.has(X.globString())}storeWalked(Q,X){let Z=Q.fullpath(),V=this.store.get(Z);if(V)V.add(X.globString());else this.store.set(Z,new Set([X.globString()]))}}class Y5{store=new Map;add(Q,X,Z){let V=(X?2:0)|(Z?1:0),$=this.store.get(Q);this.store.set(Q,$===void 0?V:V&$)}entries(){return[...this.store.entries()].map(([Q,X])=>[Q,!!(X&2),!!(X&1)])}}class H5{store=new Map;add(Q,X){if(!Q.canReaddir())return;let Z=this.store.get(Q);if(Z){if(!Z.find((V)=>V.globString()===X.globString()))Z.push(X)}else this.store.set(Q,[X])}get(Q){let X=this.store.get(Q);if(!X)throw Error("attempting to walk unknown path");return X}entries(){return this.keys().map((Q)=>[Q,this.store.get(Q)])}keys(){return[...this.store.keys()].filter((Q)=>Q.canReaddir())}}class IQ{hasWalkedCache;matches=new Y5;subwalks=new H5;patterns;follow;dot;opts;constructor(Q,X){this.opts=Q,this.follow=!!Q.follow,this.dot=!!Q.dot,this.hasWalkedCache=X?X.copy():new G0}processPatterns(Q,X){this.patterns=X;let Z=X.map((V)=>[Q,V]);for(let[V,$]of Z){this.hasWalkedCache.storeWalked(V,$);let J=$.root(),q=$.isAbsolute()&&this.opts.absolute!==!1;if(J){V=V.resolve(J==="/"&&this.opts.root!==void 0?this.opts.root:J);let j=$.rest();if(!j){this.matches.add(V,!0,!1);continue}else $=j}if(V.isENOENT())continue;let K,Y,H=!1;while(typeof(K=$.pattern())==="string"&&(Y=$.rest()))V=V.resolve(K),$=Y,H=!0;if(K=$.pattern(),Y=$.rest(),H){if(this.hasWalkedCache.hasWalked(V,$))continue;this.hasWalkedCache.storeWalked(V,$)}if(typeof K==="string"){let j=K===".."||K===""||K===".";this.matches.add(V.resolve(K),q,j);continue}else if(K===R){if(!V.isSymbolicLink()||this.follow||$.checkFollowGlobstar())this.subwalks.add(V,$);let j=Y?.pattern(),W=Y?.rest();if(!Y||(j===""||j===".")&&!W)this.matches.add(V,q,j===""||j===".");else if(j===".."){let z=V.parent||V;if(!W)this.matches.add(z,q,!0);else if(!this.hasWalkedCache.hasWalked(z,W))this.subwalks.add(z,W)}}else if(K instanceof RegExp)this.subwalks.add(V,$)}return this}subwalkTargets(){return this.subwalks.keys()}child(){return new IQ(this.opts,this.hasWalkedCache)}filterEntries(Q,X){let Z=this.subwalks.get(Q),V=this.child();for(let $ of X)for(let J of Z){let q=J.isAbsolute(),K=J.pattern(),Y=J.rest();if(K===R)V.testGlobstar($,J,Y,q);else if(K instanceof RegExp)V.testRegExp($,K,Y,q);else V.testString($,K,Y,q)}return V}testGlobstar(Q,X,Z,V){if(this.dot||!Q.name.startsWith(".")){if(!X.hasMore())this.matches.add(Q,V,!1);if(Q.canReaddir()){if(this.follow||!Q.isSymbolicLink())this.subwalks.add(Q,X);else if(Q.isSymbolicLink()){if(Z&&X.checkFollowGlobstar())this.subwalks.add(Q,Z);else if(X.markFollowGlobstar())this.subwalks.add(Q,X)}}}if(Z){let $=Z.pattern();if(typeof $==="string"&&$!==".."&&$!==""&&$!==".")this.testString(Q,$,Z.rest(),V);else if($===".."){let J=Q.parent||Q;this.subwalks.add(J,Z)}else if($ instanceof RegExp)this.testRegExp(Q,$,Z.rest(),V)}}testRegExp(Q,X,Z,V){if(!X.test(Q.name))return;if(!Z)this.matches.add(Q,V,!1);else this.subwalks.add(Q,Z)}testString(Q,X,Z,V){if(!Q.isNamed(X))return;if(!Z)this.matches.add(Q,V,!1);else this.subwalks.add(Q,Z)}}var K7=(Q,X)=>typeof Q==="string"?new wQ([Q],X):Array.isArray(Q)?new wQ(Q,X):Q;class U0{path;patterns;opts;seen=new Set;paused=!1;aborted=!1;#Q=[];#Z;#J;signal;maxDepth;includeChildMatches;constructor(Q,X,Z){if(this.patterns=Q,this.path=X,this.opts=Z,this.#J=!Z.posix&&Z.platform==="win32"?"\\":"/",this.includeChildMatches=Z.includeChildMatches!==!1,Z.ignore||!this.includeChildMatches){if(this.#Z=K7(Z.ignore??[],Z),!this.includeChildMatches&&typeof this.#Z.add!=="function")throw Error("cannot ignore child matches, ignore lacks add() method.")}if(this.maxDepth=Z.maxDepth||1/0,Z.signal)this.signal=Z.signal,this.signal.addEventListener("abort",()=>{this.#Q.length=0})}#$(Q){return this.seen.has(Q)||!!this.#Z?.ignored?.(Q)}#q(Q){return!!this.#Z?.childrenIgnored?.(Q)}pause(){this.paused=!0}resume(){if(this.signal?.aborted)return;this.paused=!1;let Q=void 0;while(!this.paused&&(Q=this.#Q.shift()))Q()}onResume(Q){if(this.signal?.aborted)return;if(!this.paused)Q();else this.#Q.push(Q)}async matchCheck(Q,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||await Q.realpath(),!Z)return;Q=Z}let $=Q.isUnknown()||this.opts.stat?await Q.lstat():Q;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let J=await $.realpath();if(J&&(J.isUnknown()||this.opts.stat))await J.lstat()}return this.matchCheckTest($,X)}matchCheckTest(Q,X){return Q&&(this.maxDepth===1/0||Q.depth()<=this.maxDepth)&&(!X||Q.canReaddir())&&(!this.opts.nodir||!Q.isDirectory())&&(!this.opts.nodir||!this.opts.follow||!Q.isSymbolicLink()||!Q.realpathCached()?.isDirectory())&&!this.#$(Q)?Q:void 0}matchCheckSync(Q,X){if(X&&this.opts.nodir)return;let Z;if(this.opts.realpath){if(Z=Q.realpathCached()||Q.realpathSync(),!Z)return;Q=Z}let $=Q.isUnknown()||this.opts.stat?Q.lstatSync():Q;if(this.opts.follow&&this.opts.nodir&&$?.isSymbolicLink()){let J=$.realpathSync();if(J&&(J?.isUnknown()||this.opts.stat))J.lstatSync()}return this.matchCheckTest($,X)}matchFinish(Q,X){if(this.#$(Q))return;if(!this.includeChildMatches&&this.#Z?.add){let $=`${Q.relativePosix()}/**`;this.#Z.add($)}let Z=this.opts.absolute===void 0?X:this.opts.absolute;this.seen.add(Q);let V=this.opts.mark&&Q.isDirectory()?this.#J:"";if(this.opts.withFileTypes)this.matchEmit(Q);else if(Z){let $=this.opts.posix?Q.fullpathPosix():Q.fullpath();this.matchEmit($+V)}else{let $=this.opts.posix?Q.relativePosix():Q.relative(),J=this.opts.dotRelative&&!$.startsWith(".."+this.#J)?"."+this.#J:"";this.matchEmit(!$?"."+V:J+$+V)}}async match(Q,X,Z){let V=await this.matchCheck(Q,Z);if(V)this.matchFinish(V,X)}matchSync(Q,X,Z){let V=this.matchCheckSync(Q,Z);if(V)this.matchFinish(V,X)}walkCB(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2(Q,X,new IQ(this.opts),Z)}walkCB2(Q,X,Z,V){if(this.#q(Q))return V();if(this.signal?.aborted)V();if(this.paused){this.onResume(()=>this.walkCB2(Q,X,Z,V));return}Z.processPatterns(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,K,Y]of Z.matches.entries()){if(this.#$(q))continue;$++,this.match(q,K,Y).then(()=>J())}for(let q of Z.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;$++;let K=q.readdirCached();if(q.calledReaddir())this.walkCB3(q,K,Z,J);else q.readdirCB((Y,H)=>this.walkCB3(q,H,Z,J),!0)}J()}walkCB3(Q,X,Z,V){Z=Z.filterEntries(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,K,Y]of Z.matches.entries()){if(this.#$(q))continue;$++,this.match(q,K,Y).then(()=>J())}for(let[q,K]of Z.subwalks.entries())$++,this.walkCB2(q,K,Z.child(),J);J()}walkCBSync(Q,X,Z){if(this.signal?.aborted)Z();this.walkCB2Sync(Q,X,new IQ(this.opts),Z)}walkCB2Sync(Q,X,Z,V){if(this.#q(Q))return V();if(this.signal?.aborted)V();if(this.paused){this.onResume(()=>this.walkCB2Sync(Q,X,Z,V));return}Z.processPatterns(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,K,Y]of Z.matches.entries()){if(this.#$(q))continue;this.matchSync(q,K,Y)}for(let q of Z.subwalkTargets()){if(this.maxDepth!==1/0&&q.depth()>=this.maxDepth)continue;$++;let K=q.readdirSync();this.walkCB3Sync(q,K,Z,J)}J()}walkCB3Sync(Q,X,Z,V){Z=Z.filterEntries(Q,X);let $=1,J=()=>{if(--$===0)V()};for(let[q,K,Y]of Z.matches.entries()){if(this.#$(q))continue;this.matchSync(q,K,Y)}for(let[q,K]of Z.subwalks.entries())$++,this.walkCB2Sync(q,K,Z.child(),J);J()}}class hQ extends U0{matches=new Set;constructor(Q,X,Z){super(Q,X,Z)}matchEmit(Q){this.matches.add(Q)}async walk(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())await this.path.lstat();return await new Promise((Q,X)=>{this.walkCB(this.path,this.patterns,()=>{if(this.signal?.aborted)X(this.signal.reason);else Q(this.matches)})}),this.matches}walkSync(){if(this.signal?.aborted)throw this.signal.reason;if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>{if(this.signal?.aborted)throw this.signal.reason}),this.matches}}class dQ extends U0{results;constructor(Q,X,Z){super(Q,X,Z);this.results=new r({signal:this.signal,objectMode:!0}),this.results.on("drain",()=>this.resume()),this.results.on("resume",()=>this.resume())}matchEmit(Q){if(this.results.write(Q),!this.results.flowing)this.pause()}stream(){let Q=this.path;if(Q.isUnknown())Q.lstat().then(()=>{this.walkCB(Q,this.patterns,()=>this.results.end())});else this.walkCB(Q,this.patterns,()=>this.results.end());return this.results}streamSync(){if(this.path.isUnknown())this.path.lstatSync();return this.walkCBSync(this.path,this.patterns,()=>this.results.end()),this.results}}var H7=typeof process==="object"&&process&&typeof process.platform==="string"?process.platform:"linux";class d{absolute;cwd;root;dot;dotRelative;follow;ignore;magicalBraces;mark;matchBase;maxDepth;nobrace;nocase;nodir;noext;noglobstar;pattern;platform;realpath;scurry;stat;signal;windowsPathsNoEscape;withFileTypes;includeChildMatches;opts;patterns;constructor(Q,X){if(!X)throw TypeError("glob options required");if(this.withFileTypes=!!X.withFileTypes,this.signal=X.signal,this.follow=!!X.follow,this.dot=!!X.dot,this.dotRelative=!!X.dotRelative,this.nodir=!!X.nodir,this.mark=!!X.mark,!X.cwd)this.cwd="";else if(X.cwd instanceof URL||X.cwd.startsWith("file://"))X.cwd=Y7(X.cwd);if(this.cwd=X.cwd||"",this.root=X.root,this.magicalBraces=!!X.magicalBraces,this.nobrace=!!X.nobrace,this.noext=!!X.noext,this.realpath=!!X.realpath,this.absolute=X.absolute,this.includeChildMatches=X.includeChildMatches!==!1,this.noglobstar=!!X.noglobstar,this.matchBase=!!X.matchBase,this.maxDepth=typeof X.maxDepth==="number"?X.maxDepth:1/0,this.stat=!!X.stat,this.ignore=X.ignore,this.withFileTypes&&this.absolute!==void 0)throw Error("cannot set absolute and withFileTypes:true");if(typeof Q==="string")Q=[Q];if(this.windowsPathsNoEscape=!!X.windowsPathsNoEscape||X.allowWindowsEscape===!1,this.windowsPathsNoEscape)Q=Q.map((K)=>K.replace(/\\/g,"/"));if(this.matchBase){if(X.noglobstar)throw TypeError("base matching requires globstar");Q=Q.map((K)=>K.includes("/")?K:`./**/${K}`)}if(this.pattern=Q,this.platform=X.platform||H7,this.opts={...X,platform:this.platform},X.scurry){if(this.scurry=X.scurry,X.nocase!==void 0&&X.nocase!==X.scurry.nocase)throw Error("nocase option contradicts provided scurry option")}else{let K=X.platform==="win32"?AQ:X.platform==="darwin"?gQ:X.platform?vQ:K5;this.scurry=new K(this.cwd,{nocase:X.nocase,fs:X.fs})}this.nocase=this.scurry.nocase;let Z=this.platform==="darwin"||this.platform==="win32",V={...X,dot:this.dot,matchBase:this.matchBase,nobrace:this.nobrace,nocase:this.nocase,nocaseMagicOnly:Z,nocomment:!0,noext:this.noext,nonegate:!0,optimizationLevel:2,platform:this.platform,windowsPathsNoEscape:this.windowsPathsNoEscape,debug:!!this.opts.debug},$=this.pattern.map((K)=>new b(K,V)),[J,q]=$.reduce((K,Y)=>{return K[0].push(...Y.set),K[1].push(...Y.globParts),K},[[],[]]);this.patterns=J.map((K,Y)=>{let H=q[Y];if(!H)throw Error("invalid pattern object");return new JQ(K,H,0,this.platform)})}async walk(){return[...await new hQ(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walk()]}walkSync(){return[...new hQ(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).walkSync()]}stream(){return new dQ(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).stream()}streamSync(){return new dQ(this.patterns,this.scurry.cwd,{...this.opts,maxDepth:this.maxDepth!==1/0?this.maxDepth+this.scurry.cwd.depth():1/0,platform:this.platform,nocase:this.nocase,includeChildMatches:this.includeChildMatches}).streamSync()}iterateSync(){return this.streamSync()[Symbol.iterator]()}[Symbol.iterator](){return this.iterateSync()}iterate(){return this.stream()[Symbol.asyncIterator]()}[Symbol.asyncIterator](){return this.iterate()}}var B0=(Q,X={})=>{if(!Array.isArray(Q))Q=[Q];for(let Z of Q)if(new b(Z,X).hasMagic())return!0;return!1};function lQ(Q,X={}){return new d(Q,X).streamSync()}function j5(Q,X={}){return new d(Q,X).stream()}function z5(Q,X={}){return new d(Q,X).walkSync()}async function W5(Q,X={}){return new d(Q,X).walk()}function oQ(Q,X={}){return new d(Q,X).iterateSync()}function G5(Q,X={}){return new d(Q,X).iterate()}var W7=lQ,j7=Object.assign(j5,{sync:lQ}),z7=oQ,G7=Object.assign(G5,{sync:oQ}),U7=Object.assign(z5,{stream:lQ,iterate:oQ}),cQ=Object.assign(W5,{glob:W5,globSync:z5,sync:U7,globStream:j5,stream:j7,globStreamSync:lQ,streamSync:W7,globIterate:G5,iterate:G7,globIterateSync:oQ,iterateSync:z7,Glob:d,hasMagic:B0,escape:ZQ,unescape:E});cQ.glob=cQ;import{resolve as C7}from"path";var M7=nQ.object({description:nQ.string().optional().describe("what you want to do"),pattern:nQ.string().describe("The glob pattern to match files against"),path:nQ.string().optional().describe('The directory to search in. Can be absolute or relative to cwd. If not specified, the current working directory (cwd) will be used. IMPORTANT: Omit this field to use the default directory. DO NOT enter "undefined" or "null" - simply omit it for the default behavior. Must be a valid directory path if provided.')}),U5=B7(async({pattern:Q,path:X},Z)=>{if(!Z.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let V=X?C7(Z.state.cwd,X):Z.state.cwd,$=await cQ(Q,{ignore:["node_modules",".git","dist","build",".next",".turbo","coverage",".nyc_output","temp",".cache","vendor","venv","__pycache__","*.pyc","target","out",".output"],cwd:V,absolute:!0});if($.length===0)return"No files found.";return $.join(`
|
|
26
|
-
`)},{name:"glob_files",description:`- Fast file pattern matching tool that works with any codebase size
|
|
27
|
-
- Supports glob patterns like "**/*.js" or "src/**/*.ts"
|
|
28
|
-
- Returns matching file paths sorted by modification time
|
|
29
|
-
- Use this tool when you need to find files by name patterns
|
|
30
|
-
- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead
|
|
31
|
-
- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.`,schema:M7});import{tool as v7}from"@langchain/core/tools";import{z as xQ}from"zod";import{execa as J9}from"execa";import K9 from"extract-zip";import H9 from"fs-extra";import{dirname as _7,join as L7}from"node:path";import{fileURLToPath as k7}from"node:url";import{pathExists as G9}from"path-exists";import{temporaryFile as B9}from"tempy";import{xdgCache as M9}from"xdg-basedir";var A7=_7(k7(import.meta.url));var _9=process.env.RIPGREP_VERSION||"v15.0.0";var B5=L7(A7,`rg${process.platform==="win32"?".exe":""}`);import{execa as w7}from"execa";import{resolve as I7}from"path";var x7=async(Q,X,Z={})=>{let{timeout:V=15000,cwd:$}=Z;try{let J=await w7(Q,X,{cwd:$||process.cwd(),timeout:V,reject:!1,stripFinalNewline:!1,stdio:["pipe","pipe","pipe"],env:process.env});return{code:J.exitCode??0,stdout:J.stdout,stderr:J.stderr}}catch(J){if(J.timedOut)return{code:124,stdout:J.stdout||"",stderr:(J.stderr||"")+`
|
|
32
|
-
Process timed out`};return{code:J.exitCode||1,stdout:J.stdout||"",stderr:J.stderr||J.message||"Unknown error"}}},C5=v7(async({args:Q,head_limit:X},Z)=>{if(!Z.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");if(!Q||Q.length===0)return"Error: No arguments provided. Please provide ripgrep arguments.";if(!X&&!Q.includes("--max-count"))X=500;let V=Q[Q.length-1],$=[...Q];if(V&&!V.startsWith("-"))$[$.length-1]=I7(Z.state.cwd,V);let J=await x7(B5,$,{timeout:15000,cwd:Z.state.cwd});if(X&&J.stdout){let q=J.stdout.split(`
|
|
33
|
-
`);if(q.length>X)J.stdout=q.slice(0,X).join(`
|
|
34
|
-
`)}if(J.code!==0&&J.stderr){if(J.code===1&&J.stdout==="")return"No matches found.";if(J.code===124||J.stderr.includes("timeout")||J.stderr.includes("timed out"))return"Error: Search timed out after 15 seconds. Please use a more specific pattern or limit the search scope with type/glob/path parameters.";return`Error executing ripgrep: ${J.stderr}`}return J.stdout||"No matches found."},{name:"search_files_rg",description:`Ripgrep (rg) - A fast text search tool that recursively searches directories for regex patterns
|
|
35
|
-
|
|
36
|
-
⚠️ IMPORTANT USAGE GUIDELINES:
|
|
37
|
-
- This tool wraps the ripgrep (rg) command-line tool
|
|
38
|
-
- Use this ONLY for searching TEXT PATTERNS within file contents
|
|
39
|
-
- For reading entire files, use the Read tool instead
|
|
40
|
-
- For finding files by name patterns, use the Glob tool instead
|
|
41
|
-
|
|
42
|
-
\uD83D\uDD0D SEARCH PATH REQUIREMENT:
|
|
43
|
-
- MUST always specify a search path at the end of args array
|
|
44
|
-
- If no specific path needed, use "./" for current directory
|
|
45
|
-
- Never omit the path parameter - ripgrep requires it
|
|
46
|
-
- Relative paths are resolved relative to the current working directory (cwd)
|
|
47
|
-
|
|
48
|
-
Usage - Pass ripgrep (rg) arguments as an array:
|
|
49
|
-
The args array corresponds directly to 'rg [OPTIONS] PATTERN [PATH...]'
|
|
50
|
-
|
|
51
|
-
Examples:
|
|
52
|
-
- Search pattern in current directory: ["PATTERN", "./"]
|
|
53
|
-
- Search in specific path: ["PATTERN", "src/"]
|
|
54
|
-
- Search with file type filter: ["--type", "ts", "PATTERN", "./"]
|
|
55
|
-
- Case insensitive search: ["-i", "PATTERN", "./"]
|
|
56
|
-
- Show line numbers: ["-n", "PATTERN", "./"]
|
|
57
|
-
- Show context lines: ["-C", "3", "PATTERN", "./"]
|
|
58
|
-
- Only show file names: ["-l", "PATTERN", "./"]
|
|
59
|
-
- Count matches: ["-c", "PATTERN", "./"]
|
|
60
|
-
- Multiple options: ["-n", "-i", "--type", "js", "function", "src/"]
|
|
61
|
-
|
|
62
|
-
Common ripgrep (rg) options:
|
|
63
|
-
- -i, --ignore-case: Case insensitive search
|
|
64
|
-
- -n, --line-number: Show line numbers
|
|
65
|
-
- -A NUM: Show NUM lines after each match
|
|
66
|
-
- -B NUM: Show NUM lines before each match
|
|
67
|
-
- -C NUM: Show NUM lines around each match
|
|
68
|
-
- -l, --files-with-matches: Only show file paths that match
|
|
69
|
-
- -c, --count: Only show count of matches per file
|
|
70
|
-
- --type TYPE: Only search files of TYPE (js, ts, py, rust, etc.)
|
|
71
|
-
- --glob PATTERN: Include/exclude files matching PATTERN
|
|
72
|
-
- --max-count NUM: Stop after NUM matches per file
|
|
73
|
-
- --no-ignore: Don't respect .gitignore files
|
|
74
|
-
- --hidden: Search hidden files and directories
|
|
75
|
-
|
|
76
|
-
Performance:
|
|
77
|
-
- 15 second timeout per search
|
|
78
|
-
- Results limited to 500 lines by default (use head_limit parameter)
|
|
79
|
-
- Respects .gitignore by default (use --no-ignore to override)
|
|
80
|
-
`,schema:xQ.object({description:xQ.string().optional().describe("what you want to do"),args:xQ.array(xQ.string()).describe('Ripgrep (rg) command arguments as array. Format: [OPTIONS...] PATTERN [PATH...]. MUST include path at end! Examples: ["import", "./"] (search "import" in current dir), ["-n", "-i", "function", "./"] (search "function" with line numbers, case insensitive), ["--type", "ts", "export", "src/"] (search "export" in TypeScript files in src/).'),head_limit:xQ.number().optional().describe("Limit output to first N lines. If not specified and no --max-count in args, defaults to 500 lines for performance.")})});import{tool as O7}from"@langchain/core/tools";import{z as OQ}from"zod";import{promises as R7}from"fs";import{resolve as F7}from"path";var C0=2000,N7=OQ.object({description:OQ.string().optional().describe("what you want to do"),file_path:OQ.string().describe("The path to the file to read (absolute or relative to cwd)"),offset:OQ.number().default(0).optional().describe("The line number to start reading from. Only provide if the file is too large to read at once"),limit:OQ.number().default(C0).optional().describe("The number of lines to read. Only provide if the file is too large to read at once.")}),M5=O7(async({file_path:Q,offset:X,limit:Z},V)=>{try{if(!V.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let $=F7(V.state.cwd,Q),q=(await R7.readFile($,"utf-8")).split(`
|
|
81
|
-
`);if(X)q=q.slice(X-1);if(Z)q=q.slice(0,Z);return q.join(`
|
|
82
|
-
`)}catch($){if($.code==="ENOENT")return`Error: File not found at ${Q}`;throw $}},{name:"read_file",description:`Reads a file from the local filesystem. Relative paths are resolved based on the current working directory (cwd).
|
|
83
|
-
Assume this tool is able to read all files on the machine. If the User provides a path to a file assume that path is valid. It is okay to read a file that does not exist; an error will be returned.
|
|
84
|
-
|
|
85
|
-
Usage:
|
|
86
|
-
- The file_path parameter can be either an absolute path or a relative path
|
|
87
|
-
- Relative paths are resolved relative to the current working directory (cwd)
|
|
88
|
-
- By default, it reads up to ${C0} lines starting from the beginning of the file
|
|
89
|
-
- You can optionally specify a line offset and limit (especially handy for long files), but it's recommended to read the whole file by not providing these parameters
|
|
90
|
-
- Any lines longer than ${C0} characters will be truncated
|
|
91
|
-
- Results are returned using cat -n format, with line numbers starting at 1
|
|
92
|
-
- This tool allows You to read images (eg PNG, JPG, etc). When reading an image file the contents are presented visually as You is a multimodal LLM.
|
|
93
|
-
- This tool can read PDF files (.pdf). PDFs are processed page by page, extracting both text and visual content for analysis.
|
|
94
|
-
- This tool can read Jupyter notebooks (.ipynb files) and returns all cells with their outputs, combining code, text, and visualizations.
|
|
95
|
-
- You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful.
|
|
96
|
-
- You will regularly be asked to read screenshots. If the user provides a path to a screenshot ALWAYS use this tool to view the file at the path. This tool will work with all temporary file paths like /var/folders/123/abc/T/TemporaryItems/NSIRD_screencaptureui_ZfB1tD/Screenshot.png
|
|
97
|
-
- If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.`,schema:N7});import{tool as D7}from"@langchain/core/tools";import{z as iQ}from"zod";import{promises as S7}from"fs";import{resolve as T7}from"path";var _5=D7(async({file_path:Q,content:X},Z)=>{if(!Z.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");try{let V=T7(Z.state.cwd,Q);return await S7.writeFile(V,X,"utf-8"),`File ${V} has been written successfully.`}catch(V){return`Error writing file: ${V.message}`}},{name:"write_file",description:`Writes a file to the local filesystem. Relative paths are resolved based on the current working directory (cwd).
|
|
98
|
-
Usage:
|
|
99
|
-
- This tool will overwrite the existing file if there is one at the provided path.
|
|
100
|
-
- If this is an existing file, you MUST use the Read tool first to read the file's contents. This tool will fail if you did not read the file first.
|
|
101
|
-
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
102
|
-
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
|
|
103
|
-
- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`,schema:iQ.object({description:iQ.string().optional().describe("what you want to do"),file_path:iQ.string().describe("The path to the file to write (absolute or relative to cwd)"),content:iQ.string().describe("The content to write to the file")})});import{tool as P7}from"@langchain/core/tools";import{z as qQ}from"zod";import{promises as M0}from"fs";import{resolve as b7}from"path";var u7=qQ.object({description:qQ.string().optional().describe("what you want to do"),file_path:qQ.string().describe("The path to the file to modify (absolute or relative to cwd)"),old_string:qQ.string().describe("The text to replace"),new_string:qQ.string().describe("The text to replace it with (must be different from old_string)"),replace_all:qQ.boolean().optional().default(!1).describe("Replace all occurences of old_string (default false)")}),L5=P7(async({file_path:Q,old_string:X,new_string:Z,replace_all:V=!1},$)=>{try{if(!$.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");let J=b7($.state.cwd,Q),q=await M0.readFile(J,"utf-8");if(V){if(!q.includes(X))return`Error: old_string not found in ${J}`;let K=q.split(X).join(Z);return await M0.writeFile(J,K,"utf-8"),`File ${J} has been edited successfully. Replaced all occurrences of old_string.`}else{let K=q.split(X);if(K.length===1)return`Error: old_string not found in ${J}`;if(K.length>2)return`Error: old_string is not unique in ${J} (found ${K.length-1} occurrences). Please provide more context or set replace_all to true.`;let Y=q.replace(X,Z);return await M0.writeFile(J,Y,"utf-8"),`File ${J} has been edited successfully. Replaced single occurrence of old_string.`}}catch(J){if(J.code==="ENOENT")return`Error: File not found at ${Q}`;throw J}},{name:"edit_file",description:`Performs exact string replacements in files. Relative paths are resolved based on the current working directory (cwd).
|
|
104
|
-
|
|
105
|
-
Usage:
|
|
106
|
-
- You must use your \`Read\` tool at least once in the conversation before editing. This tool will error if you attempt an edit without reading the file.
|
|
107
|
-
- When editing text from Read tool output, ensure you preserve the exact indentation (tabs/spaces) as it appears AFTER the line number prefix. The line number prefix format is: spaces + line number + tab. Everything after that tab is the actual file content to match. Never include any part of the line number prefix in the old_string or new_string.
|
|
108
|
-
- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.
|
|
109
|
-
- Only use emojis if the user explicitly requests it. Avoid adding emojis to files unless asked.
|
|
110
|
-
- The edit will FAIL if \`old_string\` is not unique in the file. Either provide a larger string with more surrounding context to make it unique or use \`replace_all\` to change every instance of \`old_string\`.
|
|
111
|
-
- Use \`replace_all\` for replacing and renaming strings across the file. This parameter is useful if you want to rename a variable for instance.`,schema:u7});class k5{name="FilesystemMiddleware";contextSchema=void 0;stateSchema=void 0;tools=[M5,_5,L5,U5,C5,L0];async execute(){return this}}var t=new Map;import{tool as y7}from"@langchain/core/tools";import{z as a}from"zod";import{execa as A5}from"execa";var pQ=process.platform==="win32",v5=pQ?"cmd.exe":"/bin/bash",w5=pQ?["/d","/s","/c"]:["-c"],_0=y7(async({command:Q,timeout:X,run_in_background:Z,kill_process_id:V,get_output_id:$,filter:J},q)=>{if(V){let K=parseInt(V,10),Y=t.get(K);if(!Y)return`Error: No background process found with ID ${V}.`;return Y.process.kill(),t.delete(K),`Successfully killed process with ID ${V}.`}if($){let K=parseInt($,10),Y=t.get(K);if(!Y)return`Error: No background process found with ID ${$}.`;let H=Y.stdout.join(""),j=Y.stderr.join("");if(Y.stdout=[],Y.stderr=[],J){let z=new RegExp(J);H=H.split(`
|
|
112
|
-
`).filter((G)=>z.test(G)).join(`
|
|
113
|
-
`),j=j.split(`
|
|
114
|
-
`).filter((G)=>z.test(G)).join(`
|
|
115
|
-
`)}let W="";if(H)W+=`STDOUT:
|
|
116
|
-
${H}
|
|
117
|
-
`;if(j)W+=`STDERR:
|
|
118
|
-
${j}
|
|
119
|
-
`;return W||"No new output since last check."}if(!Q)return"Error: 'command' argument is required unless using 'kill_process_id' or 'get_output_id'.";if(!q.state.cwd)throw Error("Current working directory (cwd) is not set in the agent state.");if(Z)try{let K=A5(v5,[...w5,Q],{cwd:q.state.cwd,timeout:X??20000,reject:!1,windowsVerbatimArguments:pQ});if(!K.pid)return"Failed to start command in background.";let Y={process:K,stdout:[],stderr:[],command:Q,startTime:Date.now()};return t.set(K.pid,Y),K.stdout?.on("data",(H)=>{Y.stdout.push(H.toString())}),K.stderr?.on("data",(H)=>{Y.stderr.push(H.toString())}),K.on("close",()=>{}),`Command started in background with ID: ${K.pid}`}catch(K){return`Error starting background command: ${K}`}else try{let K=await A5(v5,[...w5,Q],{cwd:q.state.cwd,timeout:X??20000,reject:!1,windowsVerbatimArguments:pQ});if(K.exitCode!==0)return K.stderr;return K.stdout}catch(K){return`Error executing command: ${K}`}},{name:"terminal",description:`Executes commands in a persistent shell session (Bash on Linux/macOS, CMD on Windows). Commands are executed in the current working directory (cwd).
|
|
120
|
-
Features:
|
|
121
|
-
- Run commands (foreground or background)
|
|
122
|
-
- Retrieve background process output
|
|
123
|
-
- Kill background processes
|
|
124
|
-
- Cross-platform support (auto-detects OS)
|
|
125
|
-
|
|
126
|
-
Usage:
|
|
127
|
-
1. Run Command: Provide \`command\`. Optional: \`run_in_background\`, \`timeout\`.
|
|
128
|
-
2. Check Output: Provide \`get_output_id\`. Optional: \`filter\`.
|
|
129
|
-
3. Kill Process: Provide \`kill_process_id\`.
|
|
130
|
-
|
|
131
|
-
Notes:
|
|
132
|
-
- For file paths with spaces, ALWAYS use quotes: "path/to file"
|
|
133
|
-
- Commands are executed relative to the current working directory (cwd)
|
|
134
|
-
- Avoid interactive commands (like top, vim)
|
|
135
|
-
- Use '&&' or ';' to chain commands (PowerShell/CMD syntax varies, simple chaining often works)
|
|
136
|
-
- CAN'T BATCH CALL THIS TOOL!
|
|
137
|
-
`,schema:a.object({description:a.string().describe("what you want to do"),command:a.string().optional().describe("The command to execute (required for running commands)"),timeout:a.number().optional().describe("Timeout in ms (default: 20000)"),run_in_background:a.boolean().optional().describe("Run command in background"),kill_process_id:a.string().optional().describe("ID of process to kill"),get_output_id:a.string().optional().describe("ID of process to get output from"),filter:a.string().optional().describe("Regex to filter output (only for get_output_id)")})});class I5{name="TerminalMiddleware";contextSchema=void 0;stateSchema=void 0;tools=[_0];async execute(){return this}}export{L0 as Fa,U5 as Ga,M5 as Ha,L5 as Ia,k5 as Ja,t as Ka,I5 as La};
|
package/dist/chunk-6rfc36jg.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as t,e as r}from"./chunk-j7a40ww9.js";import{M as o}from"./chunk-rncpxz1b.js";import{N as T}from"./chunk-hfve7nf5.js";import"./chunk-va71tsw3.js";import{ea as v,fa as Z,ga as H,ja as p,oa as c,pa as E,ra as i,ta as s}from"./chunk-nwy6n6b6.js";import"./chunk-5rr85f28.js";import"./chunk-cggjws6a.js";import"./chunk-cyexd09c.js";import"./chunk-r2h3x9zv.js";import"./chunk-1ttywx0y.js";import{ub as I}from"./chunk-kba8akjs.js";var qq=I(v(),1);var _=I(v(),1);var $=I(E(),1),a={openai:"\uD83E\uDD16",anthropic:"\uD83E\uDDE0",gemini:"✨",default:"\uD83D\uDD2E"};var Gq=({onClose:L})=>{let{extraParams:B,config:U,updateConfig:K}=T(),[X,A]=_.useState(""),j=_.useRef([]),G=_.useMemo(()=>{if(!U?.providers||U.providers.length===0)return[];return U.providers.map((q)=>{let Y=q.type||"default";return{id:q.id,label:q.id,icon:a[Y]||a.default,config:q}})},[U?.providers]);_.useMemo(()=>{if(G.length>0&&!X){let q=G.find((Y)=>Y.id===B.provider_id);A(q?.id||G[0].id)}},[G,B.provider_id,X]);let h=G.find((q)=>q.id===X),{data:V,isLoading:w,error:b}=t({provider:h?.config||null,enabled:!!X}),l=_.useMemo(()=>{let q=(V||[]).map((Y)=>({id:Y.id,name:Y.name}));return j.current=q,q},[V]),P=_.useCallback(async()=>{return j.current},[]),R=_.useCallback((q,Y,C)=>{let y=q.id===B.provider_id+"-"+q.id;return $.jsxDEV(i,{isSelected:C,isCurrent:y,children:[$.jsxDEV(H,{bold:!0,children:[Y+1,". ",q.id]},void 0,!0,void 0,this),$.jsxDEV(H,{dimColor:!0,children:[" ",q.name!==q.id?`(${q.name})`:""]},void 0,!0,void 0,this)]},`model-${Y}-${q.id}`,!0,void 0,this)},[B.provider_id]),m=_.useCallback((q)=>{return q.id===B.provider_id+"-"+q.id},[B.provider_id]),k=_.useCallback(async(q)=>{let C=G.find((y)=>y.id===X)?.config.type||"openai";await K({provider_id:X,provider_type:C,model_id:q.id}),L()},[K,X,L,G]),g=_.useCallback(async(q)=>{if(G.length<=1)return;let Y=G.findIndex((u)=>u.id===X),C=q==="left"?(Y-1+G.length)%G.length:(Y+1)%G.length,y=G[C];A(y.id),await K({provider_id:y.id,provider_type:y.config.type})},[X,G,K]),f=_.useMemo(()=>{let q=h?.label||"加载中...";return{id:`model-${X}`,title:`模型选择 - ${q}`,icon:h?.icon||"\uD83D\uDD2E",dataSource:P,searchable:!0,searchFields:["id","name"],searchPlaceholder:"搜索模型...",itemHeight:1,visibleCount:10,renderItem:R,isSelected:m,onSelect:k,showCount:!0,keyMap:{leftArrow:(Y)=>{g("left")},rightArrow:(Y)=>{g("right")}}}},[X,h,P,R,m,k,g]);if(G.length===0)return $.jsxDEV(Z,{flexDirection:"column",paddingX:2,paddingY:1,children:[$.jsxDEV(H,{color:"yellow",children:"⚠️ 未配置任何 Provider"},void 0,!1,void 0,this),$.jsxDEV(H,{color:"gray",dimColor:!0,children:"请先配置 Provider 后再查看模型列表"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);let D=h?.config.apiKey;return $.jsxDEV(Z,{flexDirection:"column",children:[$.jsxDEV(Z,{gap:1,paddingX:1,paddingY:1,children:G.map((q,Y)=>$.jsxDEV(H,{bold:q.id===X,color:q.id===X?"cyan":"gray",children:[q.icon," ",q.label,q.id===X&&" [当前]",q.id===X&&!D&&" (未配置 API Key)"]},`provider-tab-${Y}-${q.id}`,!0,void 0,this))},void 0,!1,void 0,this),w?$.jsxDEV(Z,{paddingX:2,paddingY:1,children:$.jsxDEV(H,{color:"gray",children:"加载模型列表中..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):b?$.jsxDEV(Z,{paddingX:2,paddingY:1,children:$.jsxDEV(H,{color:"red",children:["加载失败: ",b.message]},void 0,!0,void 0,this)},void 0,!1,void 0,this):!D?$.jsxDEV(Z,{paddingX:2,paddingY:1,children:$.jsxDEV(H,{color:"yellow",children:"请先配置 API Key"},void 0,!1,void 0,this)},void 0,!1,void 0,this):$.jsxDEV(s,{config:f,onClose:L},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},d=Gq;var z=I(v(),1);var W=I(E(),1),Hq=({onClose:L})=>{let{config:B,updateConfig:U}=T(),[K,X]=z.useState("list"),[A,j]=z.useState(null),[G,h]=z.useState(0),[V,w]=z.useState(null),b=z.useCallback(()=>w(null),[]);o(b,V?3000:null);let l=z.useRef(K),P=z.useRef(G),R=z.useRef([]),m=z.useRef(!0);z.useEffect(()=>{l.current=K},[K]),z.useEffect(()=>{P.current=G},[G]);let k=B?.providers||[];z.useEffect(()=>{R.current=k},[k]);let g=z.useCallback(()=>{m.current=!0,j(null),X("form"),w(null)},[]),f=z.useCallback(()=>{let J=R.current,Q=P.current,N=J[Q];if(!N)return;m.current=!1,j(N),X("form"),w(null)},[]),D=z.useCallback(()=>{X("list"),j(null),w(null)},[]),q=z.useCallback(async(J)=>{let Q=R.current,N=m.current,O=N?[...Q,J]:Q.map((F)=>F.id===J.id?J:F);if(await U({providers:O}),w(N?`已添加 Provider: ${J.id}`:`已更新 Provider: ${J.id}`),N){let F=O.findIndex((S)=>S.id===J.id);h(F>=0?F:0)}X("list"),j(null),w(null)},[U]),Y=z.useCallback(async()=>{let J=R.current,Q=P.current,N=J[Q];if(!N)return;if(J.length<=1){w("无法删除最后一个 Provider");return}let O=J.filter((S)=>S.id!==N.id);await U({providers:O});let F=Math.min(Q,O.length-1);h(F>=0?F:0),w(`已删除 Provider: ${N.id}`)},[U]),C=z.useRef(g),y=z.useRef(f),u=z.useRef(Y),x=z.useRef(D),n=z.useRef(L);z.useEffect(()=>{C.current=g},[g]),z.useEffect(()=>{y.current=f},[f]),z.useEffect(()=>{u.current=Y},[Y]),z.useEffect(()=>{x.current=D},[D]),z.useEffect(()=>{n.current=L},[L]),c((J,Q)=>{let N=l.current,O=R.current,F=P.current;if(N==="form"){if(Q.escape)x.current();return}if(Q.upArrow)h((S)=>S>0?S-1:O.length-1);else if(Q.downArrow)h((S)=>S<O.length-1?S+1:0);else if(J==="n"||J==="N")C.current();else if((J==="e"||J==="E"||Q.return)&&O[F])y.current();else if((J==="d"||J==="D")&&O[F])u.current();else if(Q.escape)n.current()},{isActive:!0});let zq=z.useMemo(()=>{if(k.length===0)return W.jsxDEV(Z,{paddingX:2,paddingY:1,children:W.jsxDEV(H,{color:"yellow",children:"未配置任何 Provider"},void 0,!1,void 0,this)},void 0,!1,void 0,this);return W.jsxDEV(Z,{flexDirection:"column",paddingX:2,gap:1,children:[k.map((J,Q)=>{let N=!!J.apiKey,O=N?"green":"yellow";return W.jsxDEV(Z,{marginBottom:0,gap:1,children:[W.jsxDEV(H,{color:Q===G?"cyan":"gray",bold:Q===G,children:Q===G?">":" "},void 0,!1,void 0,this),W.jsxDEV(H,{bold:Q===G,color:Q===G?"cyan":void 0,children:J.id},void 0,!1,void 0,this),W.jsxDEV(p,{},void 0,!1,void 0,this),W.jsxDEV(H,{color:"gray",dimColor:Q!==G,children:[" ",J.type]},void 0,!0,void 0,this),W.jsxDEV(H,{color:O,dimColor:Q!==G,children:[" ","[",N?"已配置":"未配置","]"]},void 0,!0,void 0,this)]},`provider-${Q}-${J.id}`,!0,void 0,this)}),W.jsxDEV(Z,{marginTop:1,children:W.jsxDEV(H,{color:"gray",dimColor:!0,children:[W.jsxDEV(H,{color:"cyan",children:"↑↓"},void 0,!1,void 0,this)," 导航 ",W.jsxDEV(H,{color:"cyan",children:"n"},void 0,!1,void 0,this)," 新增 ",W.jsxDEV(H,{color:"cyan",children:"d"},void 0,!1,void 0,this)," ","删除 ",W.jsxDEV(H,{color:"cyan",children:"Esc"},void 0,!1,void 0,this)," 关闭"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},[k,G]);return W.jsxDEV(Z,{flexDirection:"column",children:[W.jsxDEV(Z,{paddingX:2,paddingY:1,children:W.jsxDEV(H,{bold:!0,color:"cyan",children:"Providers"},void 0,!1,void 0,this)},void 0,!1,void 0,this),K==="list"?zq:W.jsxDEV(r,{provider:A||void 0,onCancel:D,onSave:q},void 0,!1,void 0,this),V&&W.jsxDEV(Z,{paddingX:2,paddingY:0,children:W.jsxDEV(H,{color:"green",children:V},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},e=Hq;var M=I(E(),1),Jq=({onClose:L,initialTab:B="model"})=>{let[U,K]=qq.useState(B);return c((X,A)=>{if(A.leftArrow&&A.alt)K("model");else if(A.rightArrow&&A.alt)K("provider");else if(A.escape)L()},{isActive:!0}),M.jsxDEV(Z,{flexDirection:"column",width:"100%",borderStyle:"single",borderDimColor:!0,children:[M.jsxDEV(Z,{flexDirection:"column",paddingX:0,paddingY:0,children:[U==="model"&&M.jsxDEV(d,{onClose:L},void 0,!1,void 0,this),U==="provider"&&M.jsxDEV(e,{onClose:L},void 0,!1,void 0,this)]},void 0,!0,void 0,this),M.jsxDEV(Z,{flexDirection:"row",gap:2,paddingX:2,paddingY:1,borderTop:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:"single",borderColor:"gray",children:[M.jsxDEV(H,{bold:U==="model",color:U==="model"?"cyan":"gray",children:"\uD83E\uDD16 Model"},void 0,!1,void 0,this),M.jsxDEV(H,{bold:U==="provider",color:U==="provider"?"cyan":"gray",children:"\uD83D\uDD0C Provider"},void 0,!1,void 0,this),M.jsxDEV(p,{},void 0,!1,void 0,this),M.jsxDEV(H,{dimColor:!0,children:"Alt+ < >"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},Iq=Jq;export{Iq as default};
|
package/dist/chunk-76h8pe7x.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{Na as x,Qa as z}from"./chunk-zwxjkwqd.js";import{SubAgentsMiddleware as H,getAgentListFromPackage as J}from"@langgraph-js/standard-agent";import{SubAgentsMiddleware as U,getAgentListFromPackage as W}from"@langgraph-js/standard-agent";async function Q(q){let B=await J(q);return new H({agents:B,stateSchema:x,async createAgent(D,E,G){return await z(E.subagent_id,q,G,{},{parent_id:D})}})}
|
|
2
|
-
export{Q as xa,U as ya,W as za};
|