g4lstudio 0.0.0-stage → 1.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -2
- package/cli.js +192 -0
- package/package.json +22 -4
package/README.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# g4lstudio
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
CLI do [g4lstudio.ai](https://g4lstudio.ai). Roda com [Bun](https://bun.com).
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bunx g4lstudio auth login --target https://<seu-studio>
|
|
7
|
+
bunx g4lstudio orgs
|
|
8
|
+
bunx g4lstudio tools list --org <slug>
|
|
9
|
+
```
|
package/cli.js
ADDED
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
// @bun
|
|
3
|
+
var sm=Object.create;var{getPrototypeOf:am,defineProperty:Pa,getOwnPropertyNames:cm}=Object;var Ca=Object.prototype.hasOwnProperty;function um(e){return this[e]}var lm,fm,hm=(e,t,r)=>{var n=e!=null&&typeof e==="object";if(n){var o=t?lm??=new WeakMap:fm??=new WeakMap,i=o.get(e);if(i)return i}r=e!=null?sm(am(e)):{};let s=t||!e||!e.__esModule||!Ca.call(e,"default")?Pa(r,"default",{value:e,enumerable:!0}):r;if(e&&typeof e==="object"||typeof e==="function"){for(let a of cm(e))if(!Ca.call(s,a))Pa(s,a,{get:um.bind(e,a),enumerable:!0})}if(n)o.set(e,s);return s};var Ra=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var A=(e,t,r)=>()=>{if(e)try{t=e(e=0)}catch(n){r=[n]}if(r)throw r[0];return t};var P=import.meta.require;var nl=Ra(function(bv){var dm=P("fs"),pm=P("path"),mm=P("events"),gm=P("stream"),ym=P("string_decoder"),_m=P("assert"),wm=P("buffer"),vm=P("zlib"),bm=P("util"),$m=P("crypto"),Sm=P("os"),km=P("tty"),Em=P("constants"),xm=P("https"),Om=P("child_process"),Im=P("url"),zm=P("net"),Am=P("tls");function re(e){return e&&typeof e==="object"&&"default"in e?e:{default:e}}var m=re(dm),v=re(pm),ar=re(mm),bi=re(gm),Pm=re(ym),O=re(_m),Cm=re(wm),$i=re(vm),Fe=re(bm),Oc=re($m),Si=re(Sm),ki=re(km),ct=re(Em),Rm=re(xm),Tm=re(Om),Ic=re(Im),Nm=re(zm),Dm=re(Am),ze=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Ce(e){var t={exports:{}};return e(t,t.exports),t.exports}var Ta=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"]]),Gr=(e)=>e?Object.keys(e).map((t)=>[Ta.has(t)?Ta.get(t):t,e[t]]).reduce((t,r)=>(t[r[0]]=r[1],t),Object.create(null)):{},Lm=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}},Ot=D;D.Node=zt;D.create=D;function D(e){var t=this;if(!(t instanceof D))t=new D;if(t.tail=null,t.head=null,t.length=0,e&&typeof e.forEach==="function")e.forEach(function(o){t.push(o)});else if(arguments.length>0)for(var r=0,n=arguments.length;r<n;r++)t.push(arguments[r]);return t}D.prototype.removeNode=function(e){if(e.list!==this)throw Error("removing node which does not belong to this list");var{next:t,prev:r}=e;if(t)t.prev=r;if(r)r.next=t;if(e===this.head)this.head=t;if(e===this.tail)this.tail=r;return e.list.length--,e.next=null,e.prev=null,e.list=null,t};D.prototype.unshiftNode=function(e){if(e===this.head)return;if(e.list)e.list.removeNode(e);var t=this.head;if(e.list=this,e.next=t,t)t.prev=e;if(this.head=e,!this.tail)this.tail=e;this.length++};D.prototype.pushNode=function(e){if(e===this.tail)return;if(e.list)e.list.removeNode(e);var t=this.tail;if(e.list=this,e.prev=t,t)t.next=e;if(this.tail=e,!this.head)this.head=e;this.length++};D.prototype.push=function(){for(var e=0,t=arguments.length;e<t;e++)Fm(this,arguments[e]);return this.length};D.prototype.unshift=function(){for(var e=0,t=arguments.length;e<t;e++)Mm(this,arguments[e]);return this.length};D.prototype.pop=function(){if(!this.tail)return;var e=this.tail.value;if(this.tail=this.tail.prev,this.tail)this.tail.next=null;else this.head=null;return this.length--,e};D.prototype.shift=function(){if(!this.head)return;var e=this.head.value;if(this.head=this.head.next,this.head)this.head.prev=null;else this.tail=null;return this.length--,e};D.prototype.forEach=function(e,t){t=t||this;for(var r=this.head,n=0;r!==null;n++)e.call(t,r.value,n,this),r=r.next};D.prototype.forEachReverse=function(e,t){t=t||this;for(var r=this.tail,n=this.length-1;r!==null;n--)e.call(t,r.value,n,this),r=r.prev};D.prototype.get=function(e){for(var t=0,r=this.head;r!==null&&t<e;t++)r=r.next;if(t===e&&r!==null)return r.value};D.prototype.getReverse=function(e){for(var t=0,r=this.tail;r!==null&&t<e;t++)r=r.prev;if(t===e&&r!==null)return r.value};D.prototype.map=function(e,t){t=t||this;var r=new D;for(var n=this.head;n!==null;)r.push(e.call(t,n.value,this)),n=n.next;return r};D.prototype.mapReverse=function(e,t){t=t||this;var r=new D;for(var n=this.tail;n!==null;)r.push(e.call(t,n.value,this)),n=n.prev;return r};D.prototype.reduce=function(e,t){var r,n=this.head;if(arguments.length>1)r=t;else if(this.head)n=this.head.next,r=this.head.value;else throw TypeError("Reduce of empty list with no initial value");for(var o=0;n!==null;o++)r=e(r,n.value,o),n=n.next;return r};D.prototype.reduceReverse=function(e,t){var r,n=this.tail;if(arguments.length>1)r=t;else if(this.tail)n=this.tail.prev,r=this.tail.value;else throw TypeError("Reduce of empty list with no initial value");for(var o=this.length-1;n!==null;o--)r=e(r,n.value,o),n=n.prev;return r};D.prototype.toArray=function(){var e=Array(this.length);for(var t=0,r=this.head;r!==null;t++)e[t]=r.value,r=r.next;return e};D.prototype.toArrayReverse=function(){var e=Array(this.length);for(var t=0,r=this.tail;r!==null;t++)e[t]=r.value,r=r.prev;return e};D.prototype.slice=function(e,t){if(t=t||this.length,t<0)t+=this.length;if(e=e||0,e<0)e+=this.length;var r=new D;if(t<e||t<0)return r;if(e<0)e=0;if(t>this.length)t=this.length;for(var n=0,o=this.head;o!==null&&n<e;n++)o=o.next;for(;o!==null&&n<t;n++,o=o.next)r.push(o.value);return r};D.prototype.sliceReverse=function(e,t){if(t=t||this.length,t<0)t+=this.length;if(e=e||0,e<0)e+=this.length;var r=new D;if(t<e||t<0)return r;if(e<0)e=0;if(t>this.length)t=this.length;for(var n=this.length,o=this.tail;o!==null&&n>t;n--)o=o.prev;for(;o!==null&&n>e;n--,o=o.prev)r.push(o.value);return r};D.prototype.splice=function(e,t,...r){if(e>this.length)e=this.length-1;if(e<0)e=this.length+e;for(var n=0,o=this.head;o!==null&&n<e;n++)o=o.next;var i=[];for(var n=0;o&&n<t;n++)i.push(o.value),o=this.removeNode(o);if(o===null)o=this.tail;if(o!==this.head&&o!==this.tail)o=o.prev;for(var n=0;n<r.length;n++)o=Zm(this,o,r[n]);return i};D.prototype.reverse=function(){var e=this.head,t=this.tail;for(var r=e;r!==null;r=r.prev){var n=r.prev;r.prev=r.next,r.next=n}return this.head=t,this.tail=e,this};function Zm(e,t,r){var n=t===e.head?new zt(r,null,t,e):new zt(r,t,t.next,e);if(n.next===null)e.tail=n;if(n.prev===null)e.head=n;return e.length++,n}function Fm(e,t){if(e.tail=new zt(t,e.tail,null,e),!e.head)e.head=e.tail;e.length++}function Mm(e,t){if(e.head=new zt(t,null,e.head,e),!e.tail)e.tail=e.head;e.length++}function zt(e,t,r,n){if(!(this instanceof zt))return new zt(e,t,r,n);if(this.list=n,this.value=e,t)t.next=this,this.prev=t;else this.prev=null;if(r)r.prev=this,this.next=r;else this.next=null}try{Lm(D)}catch(e){}var Na=Pm.default.StringDecoder,We=Symbol("EOF"),Sr=Symbol("maybeEmitEnd"),rt=Symbol("emittedEnd"),ln=Symbol("emittingEnd"),fn=Symbol("closed"),Da=Symbol("read"),Go=Symbol("flush"),La=Symbol("flushChunk"),de=Symbol("encoding"),He=Symbol("decoder"),hn=Symbol("flowing"),kr=Symbol("paused"),Er=Symbol("resume"),ue=Symbol("bufferLength"),Za=Symbol("bufferPush"),Wo=Symbol("bufferShift"),ae=Symbol("objectMode"),ce=Symbol("destroyed"),zc=ze._MP_NO_ITERATOR_SYMBOLS_!=="1",jm=zc&&Symbol.asyncIterator||Symbol("asyncIterator not implemented"),Bm=zc&&Symbol.iterator||Symbol("iterator not implemented"),Fa=(e)=>e==="end"||e==="finish"||e==="prefinish",Um=(e)=>e instanceof ArrayBuffer||typeof e==="object"&&e.constructor&&e.constructor.name==="ArrayBuffer"&&e.byteLength>=0,Vm=(e)=>!Buffer.isBuffer(e)&&ArrayBuffer.isView(e),cr=class e extends bi.default{constructor(t){super();if(this[hn]=!1,this[kr]=!1,this.pipes=new Ot,this.buffer=new Ot,this[ae]=t&&t.objectMode||!1,this[ae])this[de]=null;else this[de]=t&&t.encoding||null;if(this[de]==="buffer")this[de]=null;this[He]=this[de]?new Na(this[de]):null,this[We]=!1,this[rt]=!1,this[ln]=!1,this[fn]=!1,this.writable=!0,this.readable=!0,this[ue]=0,this[ce]=!1}get bufferLength(){return this[ue]}get encoding(){return this[de]}set encoding(t){if(this[ae])throw Error("cannot set encoding in objectMode");if(this[de]&&t!==this[de]&&(this[He]&&this[He].lastNeed||this[ue]))throw Error("cannot change encoding");if(this[de]!==t){if(this[He]=t?new Na(t):null,this.buffer.length)this.buffer=this.buffer.map((r)=>this[He].write(r))}this[de]=t}setEncoding(t){this.encoding=t}get objectMode(){return this[ae]}set objectMode(t){this[ae]=this[ae]||!!t}write(t,r,n){if(this[We])throw Error("write after end");if(this[ce])return this.emit("error",Object.assign(Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;if(typeof r==="function")n=r,r="utf8";if(!r)r="utf8";if(!this[ae]&&!Buffer.isBuffer(t)){if(Vm(t))t=Buffer.from(t.buffer,t.byteOffset,t.byteLength);else if(Um(t))t=Buffer.from(t);else if(typeof t!=="string")this.objectMode=!0}if(!this.objectMode&&!t.length){if(this[ue]!==0)this.emit("readable");if(n)n();return this.flowing}if(typeof t==="string"&&!this[ae]&&!(r===this[de]&&!this[He].lastNeed))t=Buffer.from(t,r);if(Buffer.isBuffer(t)&&this[de])t=this[He].write(t);if(this.flowing){if(this[ue]!==0)this[Go](!0);this.emit("data",t)}else this[Za](t);if(this[ue]!==0)this.emit("readable");if(n)n();return this.flowing}read(t){if(this[ce])return null;try{if(this[ue]===0||t===0||t>this[ue])return null;if(this[ae])t=null;if(this.buffer.length>1&&!this[ae])if(this.encoding)this.buffer=new Ot([Array.from(this.buffer).join("")]);else this.buffer=new Ot([Buffer.concat(Array.from(this.buffer),this[ue])]);return this[Da](t||null,this.buffer.head.value)}finally{this[Sr]()}}[Da](t,r){if(t===r.length||t===null)this[Wo]();else this.buffer.head.value=r.slice(t),r=r.slice(0,t),this[ue]-=t;if(this.emit("data",r),!this.buffer.length&&!this[We])this.emit("drain");return r}end(t,r,n){if(typeof t==="function")n=t,t=null;if(typeof r==="function")n=r,r="utf8";if(t)this.write(t,r);if(n)this.once("end",n);if(this[We]=!0,this.writable=!1,this.flowing||!this[kr])this[Sr]();return this}[Er](){if(this[ce])return;if(this[kr]=!1,this[hn]=!0,this.emit("resume"),this.buffer.length)this[Go]();else if(this[We])this[Sr]();else this.emit("drain")}resume(){return this[Er]()}pause(){this[hn]=!1,this[kr]=!0}get destroyed(){return this[ce]}get flowing(){return this[hn]}get paused(){return this[kr]}[Za](t){if(this[ae])this[ue]+=1;else this[ue]+=t.length;return this.buffer.push(t)}[Wo](){if(this.buffer.length)if(this[ae])this[ue]-=1;else this[ue]-=this.buffer.head.value.length;return this.buffer.shift()}[Go](t){do;while(this[La](this[Wo]()));if(!t&&!this.buffer.length&&!this[We])this.emit("drain")}[La](t){return t?(this.emit("data",t),this.flowing):!1}pipe(t,r){if(this[ce])return;let n=this[rt];if(r=r||{},t===process.stdout||t===process.stderr)r.end=!1;else r.end=r.end!==!1;let o={dest:t,opts:r,ondrain:(i)=>this[Er]()};if(this.pipes.push(o),t.on("drain",o.ondrain),this[Er](),n&&o.opts.end)o.dest.end();return t}addListener(t,r){return this.on(t,r)}on(t,r){try{return super.on(t,r)}finally{if(t==="data"&&!this.pipes.length&&!this.flowing)this[Er]();else if(Fa(t)&&this[rt])super.emit(t),this.removeAllListeners(t)}}get emittedEnd(){return this[rt]}[Sr](){if(!this[ln]&&!this[rt]&&!this[ce]&&this.buffer.length===0&&this[We]){if(this[ln]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[fn])this.emit("close");this[ln]=!1}}emit(t,r){if(t!=="error"&&t!=="close"&&t!==ce&&this[ce])return;else if(t==="data"){if(!r)return;if(this.pipes.length)this.pipes.forEach((o)=>o.dest.write(r)===!1&&this.pause())}else if(t==="end"){if(this[rt]===!0)return;if(this[rt]=!0,this.readable=!1,this[He]){if(r=this[He].end(),r)this.pipes.forEach((o)=>o.dest.write(r)),super.emit("data",r)}this.pipes.forEach((o)=>{if(o.dest.removeListener("drain",o.ondrain),o.opts.end)o.dest.end()})}else if(t==="close"){if(this[fn]=!0,!this[rt]&&!this[ce])return}let n=Array(arguments.length);if(n[0]=t,n[1]=r,arguments.length>2)for(let o=2;o<arguments.length;o++)n[o]=arguments[o];try{return super.emit.apply(this,n)}finally{if(!Fa(t))this[Sr]();else this.removeAllListeners(t)}}collect(){let t=[];if(!this[ae])t.dataLength=0;let r=this.promise();return this.on("data",(n)=>{if(t.push(n),!this[ae])t.dataLength+=n.length}),r.then(()=>t)}concat(){return this[ae]?Promise.reject(Error("cannot concat in objectMode")):this.collect().then((t)=>this[ae]?Promise.reject(Error("cannot concat in objectMode")):this[de]?t.join(""):Buffer.concat(t,t.dataLength))}promise(){return new Promise((t,r)=>{this.on(ce,()=>r(Error("stream destroyed"))),this.on("end",()=>t()),this.on("error",(n)=>r(n))})}[jm](){return{next:()=>{let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[We])return Promise.resolve({done:!0});let n=null,o=null,i=(l)=>{this.removeListener("data",s),this.removeListener("end",a),o(l)},s=(l)=>{this.removeListener("error",i),this.removeListener("end",a),this.pause(),n({value:l,done:!!this[We]})},a=()=>{this.removeListener("error",i),this.removeListener("data",s),n({done:!0})},c=()=>i(Error("stream destroyed"));return new Promise((l,u)=>{o=u,n=l,this.once(ce,c),this.once("error",i),this.once("end",a),this.once("data",s)})}}}[Bm](){return{next:()=>{let r=this.read();return{value:r,done:r===null}}}}destroy(t){if(this[ce]){if(t)this.emit("error",t);else this.emit(ce);return this}if(this[ce]=!0,this.buffer=new Ot,this[ue]=0,typeof this.close==="function"&&!this[fn])this.close();if(t)this.emit("error",t);else this.emit(ce);return this}static isStream(t){return!!t&&(t instanceof e||t instanceof bi.default||t instanceof ar.default&&(typeof t.pipe==="function"||typeof t.write==="function"&&typeof t.end==="function"))}},Gm=$i.default.constants||{ZLIB_VERNUM:4736},Wm=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},Gm)),Ac=Ce(function(e,t){let r=Cm.default.Buffer,n=t.constants=Wm,o=r.concat,i=Symbol("_superWrite");class s extends Error{constructor(w){super("zlib: "+w.message);if(this.code=w.code,this.errno=w.errno,!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+w.message,Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}let a=Symbol("opts"),c=Symbol("flushFlag"),l=Symbol("finishFlushFlag"),u=Symbol("fullFlushFlag"),f=Symbol("handle"),h=Symbol("onError"),d=Symbol("sawError"),p=Symbol("level"),g=Symbol("strategy"),y=Symbol("ended");class b extends cr{constructor(w,T){if(!w||typeof w!=="object")throw TypeError("invalid options for ZlibBase constructor");super(w);this[d]=!1,this[y]=!1,this[a]=w,this[c]=w.flush,this[l]=w.finishFlush;try{this[f]=new $i.default[T](w)}catch(L){throw new s(L)}this[h]=(L)=>{if(this[d])return;this[d]=!0,this.close(),this.emit("error",L)},this[f].on("error",(L)=>this[h](new s(L))),this.once("end",()=>this.close)}close(){if(this[f])this[f].close(),this[f]=null,this.emit("close")}reset(){if(!this[d])return O.default(this[f],"zlib binding closed"),this[f].reset()}flush(w){if(this.ended)return;if(typeof w!=="number")w=this[u];this.write(Object.assign(r.alloc(0),{[c]:w}))}end(w,T,L){if(w)this.write(w,T);return this.flush(this[l]),this[y]=!0,super.end(null,null,L)}get ended(){return this[y]}write(w,T,L){if(typeof T==="function")L=T,T="utf8";if(typeof w==="string")w=r.from(w,T);if(this[d])return;O.default(this[f],"zlib binding closed");let V=this[f]._handle,q=V.close;V.close=()=>{};let Q=this[f].close;this[f].close=()=>{},r.concat=(se)=>se;let G;try{let se=typeof w[c]==="number"?w[c]:this[c];G=this[f]._processChunk(w,se),r.concat=o}catch(se){r.concat=o,this[h](new s(se))}finally{if(this[f])this[f]._handle=V,V.close=q,this[f].close=Q,this[f].removeAllListeners("error")}if(this[f])this[f].on("error",(se)=>this[h](new s(se)));let J;if(G)if(Array.isArray(G)&&G.length>0){J=this[i](r.from(G[0]));for(let se=1;se<G.length;se++)J=this[i](G[se])}else J=this[i](r.from(G));if(L)L();return J}[i](w){return super.write(w)}}class S extends b{constructor(w,T){w=w||{},w.flush=w.flush||n.Z_NO_FLUSH,w.finishFlush=w.finishFlush||n.Z_FINISH;super(w,T);this[u]=n.Z_FULL_FLUSH,this[p]=w.level,this[g]=w.strategy}params(w,T){if(this[d])return;if(!this[f])throw Error("cannot switch params when binding is closed");if(!this[f].params)throw Error("not supported in this implementation");if(this[p]!==w||this[g]!==T){this.flush(n.Z_SYNC_FLUSH),O.default(this[f],"zlib binding closed");let L=this[f].flush;this[f].flush=(V,q)=>{this.flush(V),q()};try{this[f].params(w,T)}finally{this[f].flush=L}if(this[f])this[p]=w,this[g]=T}}}class N extends S{constructor(w){super(w,"Deflate")}}class z extends S{constructor(w){super(w,"Inflate")}}let C=Symbol("_portable");class x extends S{constructor(w){super(w,"Gzip");this[C]=w&&!!w.portable}[i](w){if(!this[C])return super[i](w);return this[C]=!1,w[9]=255,super[i](w)}}class U extends S{constructor(w){super(w,"Gunzip")}}class ie extends S{constructor(w){super(w,"DeflateRaw")}}class oe extends S{constructor(w){super(w,"InflateRaw")}}class ye extends S{constructor(w){super(w,"Unzip")}}class he extends b{constructor(w,T){w=w||{},w.flush=w.flush||n.BROTLI_OPERATION_PROCESS,w.finishFlush=w.finishFlush||n.BROTLI_OPERATION_FINISH;super(w,T);this[u]=n.BROTLI_OPERATION_FLUSH}}class I extends he{constructor(w){super(w,"BrotliCompress")}}class R extends he{constructor(w){super(w,"BrotliDecompress")}}if(t.Deflate=N,t.Inflate=z,t.Gzip=x,t.Gunzip=U,t.DeflateRaw=ie,t.InflateRaw=oe,t.Unzip=ye,typeof $i.default.BrotliCompress==="function")t.BrotliCompress=I,t.BrotliDecompress=R;else t.BrotliCompress=t.BrotliDecompress=class{constructor(){throw Error("Brotli is not supported in this version of Node.js")}}}),Ho=Symbol("slurp"),as=class extends cr{constructor(t,r,n){super();switch(this.pause(),this.extended=r,this.globalExtended=n,this.header=t,this.startBlockSize=512*Math.ceil(t.size/512),this.blockRemain=this.startBlockSize,this.remain=t.size,this.type=t.type,this.meta=!1,this.ignore=!1,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(this.path=t.path,this.mode=t.mode,this.mode)this.mode=this.mode&4095;if(this.uid=t.uid,this.gid=t.gid,this.uname=t.uname,this.gname=t.gname,this.size=t.size,this.mtime=t.mtime,this.atime=t.atime,this.ctime=t.ctime,this.linkpath=t.linkpath,this.uname=t.uname,this.gname=t.gname,r)this[Ho](r);if(n)this[Ho](n,!0)}write(t){let r=t.length;if(r>this.blockRemain)throw Error("writing more to entry than is appropriate");let n=this.remain,o=this.blockRemain;if(this.remain=Math.max(0,n-r),this.blockRemain=Math.max(0,o-r),this.ignore)return!0;if(n>=r)return super.write(t);return super.write(t.slice(0,n))}[Ho](t,r){for(let n in t)if(t[n]!==null&&t[n]!==void 0&&!(r&&n==="path"))this[n]=t[n]}},On=Ce(function(e,t){t.name=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),t.code=new Map(Array.from(t.name).map((r)=>[r[1],r[0]]))}),Hm=(e,t)=>{if(!Number.isSafeInteger(e))throw Error("cannot encode number outside of javascript safe integer range");else if(e<0)Km(e,t);else qm(e,t);return t},qm=(e,t)=>{t[0]=128;for(var r=t.length;r>1;r--)t[r-1]=e&255,e=Math.floor(e/256)},Km=(e,t)=>{t[0]=255;var r=!1;e=e*-1;for(var n=t.length;n>1;n--){var o=e&255;if(e=Math.floor(e/256),r)t[n-1]=Pc(o);else if(o===0)t[n-1]=0;else r=!0,t[n-1]=Cc(o)}},Jm=(e)=>{let t=e[0],r=t===128?Xm(e.slice(1,e.length)):t===255?Ym(e):null;if(r===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(r))throw Error("parsed number outside of javascript safe integer range");return r},Ym=(e)=>{var t=e.length,r=0,n=!1;for(var o=t-1;o>-1;o--){var i=e[o],s;if(n)s=Pc(i);else if(i===0)s=i;else n=!0,s=Cc(i);if(s!==0)r-=s*Math.pow(256,t-o-1)}return r},Xm=(e)=>{var t=e.length,r=0;for(var n=t-1;n>-1;n--){var o=e[n];if(o!==0)r+=o*Math.pow(256,t-n-1)}return r},Pc=(e)=>(255^e)&255,Cc=(e)=>(255^e)+1&255,Rc={encode:Hm,parse:Jm},Ut=v.default.posix,qo=Symbol("slurp"),_e=Symbol("type");class Tc{constructor(e,t,r,n){if(this.cksumValid=!1,this.needPax=!1,this.nullBlock=!1,this.block=null,this.path=null,this.mode=null,this.uid=null,this.gid=null,this.size=null,this.mtime=null,this.cksum=null,this[_e]="0",this.linkpath=null,this.uname=null,this.gname=null,this.devmaj=0,this.devmin=0,this.atime=null,this.ctime=null,Buffer.isBuffer(e))this.decode(e,t||0,r,n);else if(e)this.set(e)}decode(e,t,r,n){if(!t)t=0;if(!e||!(e.length>=t+512))throw Error("need 512 bytes for header");if(this.path=wt(e,t,100),this.mode=it(e,t+100,8),this.uid=it(e,t+108,8),this.gid=it(e,t+116,8),this.size=it(e,t+124,12),this.mtime=Ko(e,t+136,12),this.cksum=it(e,t+148,12),this[qo](r),this[qo](n,!0),this[_e]=wt(e,t+156,1),this[_e]==="")this[_e]="0";if(this[_e]==="0"&&this.path.substr(-1)==="/")this[_e]="5";if(this[_e]==="5")this.size=0;if(this.linkpath=wt(e,t+157,100),e.slice(t+257,t+265).toString()==="ustar\x0000")if(this.uname=wt(e,t+265,32),this.gname=wt(e,t+297,32),this.devmaj=it(e,t+329,8),this.devmin=it(e,t+337,8),e[t+475]!==0){let i=wt(e,t+345,155);this.path=i+"/"+this.path}else{let i=wt(e,t+345,130);if(i)this.path=i+"/"+this.path;this.atime=Ko(e,t+476,12),this.ctime=Ko(e,t+488,12)}let o=256;for(let i=t;i<t+148;i++)o+=e[i];for(let i=t+156;i<t+512;i++)o+=e[i];if(this.cksumValid=o===this.cksum,this.cksum===null&&o===256)this.nullBlock=!0}[qo](e,t){for(let r in e)if(e[r]!==null&&e[r]!==void 0&&!(t&&r==="path"))this[r]=e[r]}encode(e,t){if(!e)e=this.block=Buffer.alloc(512),t=0;if(!t)t=0;if(!(e.length>=t+512))throw Error("need 512 bytes for header");let r=this.ctime||this.atime?130:155,n=Qm(this.path||"",r),o=n[0],i=n[1];if(this.needPax=n[2],this.needPax=vt(e,t,100,o)||this.needPax,this.needPax=st(e,t+100,8,this.mode)||this.needPax,this.needPax=st(e,t+108,8,this.uid)||this.needPax,this.needPax=st(e,t+116,8,this.gid)||this.needPax,this.needPax=st(e,t+124,12,this.size)||this.needPax,this.needPax=Jo(e,t+136,12,this.mtime)||this.needPax,e[t+156]=this[_e].charCodeAt(0),this.needPax=vt(e,t+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",t+257,8),this.needPax=vt(e,t+265,32,this.uname)||this.needPax,this.needPax=vt(e,t+297,32,this.gname)||this.needPax,this.needPax=st(e,t+329,8,this.devmaj)||this.needPax,this.needPax=st(e,t+337,8,this.devmin)||this.needPax,this.needPax=vt(e,t+345,r,i)||this.needPax,e[t+475]!==0)this.needPax=vt(e,t+345,155,i)||this.needPax;else this.needPax=vt(e,t+345,130,i)||this.needPax,this.needPax=Jo(e,t+476,12,this.atime)||this.needPax,this.needPax=Jo(e,t+488,12,this.ctime)||this.needPax;let s=256;for(let a=t;a<t+148;a++)s+=e[a];for(let a=t+156;a<t+512;a++)s+=e[a];return this.cksum=s,st(e,t+148,8,this.cksum),this.cksumValid=!0,this.needPax}set(e){for(let t in e)if(e[t]!==null&&e[t]!==void 0)this[t]=e[t]}get type(){return On.name.get(this[_e])||this[_e]}get typeKey(){return this[_e]}set type(e){if(On.code.has(e))this[_e]=On.code.get(e);else this[_e]=e}}var Qm=(e,t)=>{let n=e,o="",i,s=Ut.parse(e).root||".";if(Buffer.byteLength(n)<100)i=[n,o,!1];else{o=Ut.dirname(n),n=Ut.basename(n);do if(Buffer.byteLength(n)<=100&&Buffer.byteLength(o)<=t)i=[n,o,!1];else if(Buffer.byteLength(n)>100&&Buffer.byteLength(o)<=t)i=[n.substr(0,99),o,!0];else n=Ut.join(Ut.basename(o),n),o=Ut.dirname(o);while(o!==s&&!i);if(!i)i=[e.substr(0,99),"",!0]}return i},wt=(e,t,r)=>e.slice(t,t+r).toString("utf8").replace(/\0.*/,""),Ko=(e,t,r)=>eg(it(e,t,r)),eg=(e)=>e===null?null:new Date(e*1000),it=(e,t,r)=>e[t]&128?Rc.parse(e.slice(t,t+r)):rg(e,t,r),tg=(e)=>isNaN(e)?null:e,rg=(e,t,r)=>tg(parseInt(e.slice(t,t+r).toString("utf8").replace(/\0.*$/,"").trim(),8)),ng={12:8589934591,8:2097151},st=(e,t,r,n)=>n===null?!1:n>ng[r]||n<0?(Rc.encode(n,e.slice(t,t+r)),!0):(og(e,t,r,n),!1),og=(e,t,r,n)=>e.write(ig(n,r),t,r,"ascii"),ig=(e,t)=>sg(Math.floor(e).toString(8),t),sg=(e,t)=>(e.length===t-1?e:Array(t-e.length-1).join("0")+e+" ")+"\x00",Jo=(e,t,r,n)=>n===null?!1:st(e,t,r,n.getTime()/1000),ag=Array(156).join("\x00"),vt=(e,t,r,n)=>n===null?!1:(e.write(n+ag,t,r,"utf8"),n.length!==Buffer.byteLength(n)||n.length>r),Rt=Tc;class jn{constructor(e,t){this.atime=e.atime||null,this.charset=e.charset||null,this.comment=e.comment||null,this.ctime=e.ctime||null,this.gid=e.gid||null,this.gname=e.gname||null,this.linkpath=e.linkpath||null,this.mtime=e.mtime||null,this.path=e.path||null,this.size=e.size||null,this.uid=e.uid||null,this.uname=e.uname||null,this.dev=e.dev||null,this.ino=e.ino||null,this.nlink=e.nlink||null,this.global=t||!1}encode(){let e=this.encodeBody();if(e==="")return null;let t=Buffer.byteLength(e),r=512*Math.ceil(1+t/512),n=Buffer.allocUnsafe(r);for(let o=0;o<512;o++)n[o]=0;new Rt({path:("PaxHeader/"+v.default.basename(this.path)).slice(0,99),mode:this.mode||420,uid:this.uid||null,gid:this.gid||null,size:t,mtime:this.mtime||null,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime||null,ctime:this.ctime||null}).encode(n),n.write(e,512,t,"utf8");for(let o=t+512;o<n.length;o++)n[o]=0;return n}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===null||this[e]===void 0)return"";let t=this[e]instanceof Date?this[e].getTime()/1000:this[e],r=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+t+`
|
|
4
|
+
`,n=Buffer.byteLength(r),o=Math.floor(Math.log(n)/Math.log(10))+1;if(n+o>=Math.pow(10,o))o+=1;return o+n+r}}jn.parse=(e,t,r)=>new jn(cg(ug(e),t),r);var cg=(e,t)=>t?Object.keys(e).reduce((r,n)=>(r[n]=e[n],r),t):e,ug=(e)=>e.replace(/\n$/,"").split(`
|
|
5
|
+
`).reduce(lg,Object.create(null)),lg=(e,t)=>{let r=parseInt(t,10);if(r!==Buffer.byteLength(t)+1)return e;t=t.substr((r+" ").length);let n=t.split("="),o=n.shift().replace(/^SCHILY\.(dev|ino|nlink)/,"$1");if(!o)return e;let i=n.join("=");return e[o]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(o)?new Date(i*1000):/^[0-9]+$/.test(i)?+i:i,e},Lr=jn,Jn=(e)=>class extends e{warn(t,r,n={}){if(this.file)n.file=this.file;if(this.cwd)n.cwd=this.cwd;if(n.code=r instanceof Error&&r.code||t,n.tarCode=t,!this.strict&&n.recoverable!==!1){if(r instanceof Error)n=Object.assign(r,n),r=r.message;this.emit("warn",n.tarCode,r,n)}else if(r instanceof Error)this.emit("error",Object.assign(r,n));else this.emit("error",Object.assign(Error(`${t}: ${r}`),n))}},Yn=["|","<",">","?",":"],cs=Yn.map((e)=>String.fromCharCode(61440+e.charCodeAt(0))),fg=new Map(Yn.map((e,t)=>[e,cs[t]])),hg=new Map(cs.map((e,t)=>[e,Yn[t]])),Ei={encode:(e)=>Yn.reduce((t,r)=>t.split(r).join(fg.get(r)),e),decode:(e)=>cs.reduce((t,r)=>t.split(r).join(hg.get(r)),e)},Nc=(e,t,r)=>{if(e&=4095,r)e=(e|384)&-19;if(t){if(e&256)e|=64;if(e&32)e|=8;if(e&4)e|=1}return e},dg=16777216,Ma=Symbol("process"),ja=Symbol("file"),Ba=Symbol("directory"),xi=Symbol("symlink"),Ua=Symbol("hardlink"),xr=Symbol("header"),In=Symbol("read"),Oi=Symbol("lstat"),zn=Symbol("onlstat"),Ii=Symbol("onread"),zi=Symbol("onreadlink"),Ai=Symbol("openfile"),Pi=Symbol("onopenfile"),It=Symbol("close"),Bn=Symbol("mode"),Xn=Jn(class extends cr{constructor(t,r){r=r||{};super(r);if(typeof t!=="string")throw TypeError("path is required");if(this.path=t,this.portable=!!r.portable,this.myuid=process.getuid&&process.getuid(),this.myuser=process.env.USER||"",this.maxReadSize=r.maxReadSize||dg,this.linkCache=r.linkCache||new Map,this.statCache=r.statCache||new Map,this.preservePaths=!!r.preservePaths,this.cwd=r.cwd||process.cwd(),this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.mtime=r.mtime||null,typeof r.onwarn==="function")this.on("warn",r.onwarn);let n=!1;if(!this.preservePaths&&v.default.win32.isAbsolute(t)){let o=v.default.win32.parse(t);this.path=t.substr(o.root.length),n=o.root}if(this.win32=!!r.win32||process.platform==="win32",this.win32)this.path=Ei.decode(this.path.replace(/\\/g,"/")),t=t.replace(/\\/g,"/");if(this.absolute=r.absolute||v.default.resolve(this.cwd,t),this.path==="")this.path="./";if(n)this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path});if(this.statCache.has(this.absolute))this[zn](this.statCache.get(this.absolute));else this[Oi]()}[Oi](){m.default.lstat(this.absolute,(t,r)=>{if(t)return this.emit("error",t);this[zn](r)})}[zn](t){if(this.statCache.set(this.absolute,t),this.stat=t,!t.isFile())t.size=0;this.type=mg(t),this.emit("stat",t),this[Ma]()}[Ma](){switch(this.type){case"File":return this[ja]();case"Directory":return this[Ba]();case"SymbolicLink":return this[xi]();default:return this.end()}}[Bn](t){return Nc(t,this.type==="Directory",this.portable)}[xr](){if(this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.header=new Rt({path:this.path,linkpath:this.linkpath,mode:this[Bn](this.stat.mode),uid:this.portable?null:this.stat.uid,gid:this.portable?null:this.stat.gid,size:this.stat.size,mtime:this.noMtime?null:this.mtime||this.stat.mtime,type:this.type,uname:this.portable?null:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?null:this.stat.atime,ctime:this.portable?null:this.stat.ctime}),this.header.encode()&&!this.noPax)this.write(new Lr({atime:this.portable?null:this.header.atime,ctime:this.portable?null:this.header.ctime,gid:this.portable?null:this.header.gid,mtime:this.noMtime?null:this.mtime||this.header.mtime,path:this.path,linkpath:this.linkpath,size:this.header.size,uid:this.portable?null:this.header.uid,uname:this.portable?null:this.header.uname,dev:this.portable?null:this.stat.dev,ino:this.portable?null:this.stat.ino,nlink:this.portable?null:this.stat.nlink}).encode());this.write(this.header.block)}[Ba](){if(this.path.substr(-1)!=="/")this.path+="/";this.stat.size=0,this[xr](),this.end()}[xi](){m.default.readlink(this.absolute,(t,r)=>{if(t)return this.emit("error",t);this[zi](r)})}[zi](t){this.linkpath=t.replace(/\\/g,"/"),this[xr](),this.end()}[Ua](t){this.type="Link",this.linkpath=v.default.relative(this.cwd,t).replace(/\\/g,"/"),this.stat.size=0,this[xr](),this.end()}[ja](){if(this.stat.nlink>1){let t=this.stat.dev+":"+this.stat.ino;if(this.linkCache.has(t)){let r=this.linkCache.get(t);if(r.indexOf(this.cwd)===0)return this[Ua](r)}this.linkCache.set(t,this.absolute)}if(this[xr](),this.stat.size===0)return this.end();this[Ai]()}[Ai](){m.default.open(this.absolute,"r",(t,r)=>{if(t)return this.emit("error",t);this[Pi](r)})}[Pi](t){let r=512*Math.ceil(this.stat.size/512),n=Math.min(r,this.maxReadSize),o=Buffer.allocUnsafe(n);this[In](t,o,0,o.length,0,this.stat.size,r)}[In](t,r,n,o,i,s,a){m.default.read(t,r,n,o,i,(c,l)=>{if(c)return this[It](t,()=>this.emit("error",c));this[Ii](t,r,n,o,i,s,a,l)})}[It](t,r){m.default.close(t,r)}[Ii](t,r,n,o,i,s,a,c){if(c<=0&&s>0){let u=Error("encountered unexpected EOF");return u.path=this.absolute,u.syscall="read",u.code="EOF",this[It](t,()=>this.emit("error",u))}if(c>s){let u=Error("did not encounter expected EOF");return u.path=this.absolute,u.syscall="read",u.code="EOF",this[It](t,()=>this.emit("error",u))}if(c===s)for(let u=c;u<o&&c<a;u++)r[u+n]=0,c++,s++;let l=n===0&&c===r.length?r:r.slice(n,n+c);if(s-=c,a-=c,i+=c,n+=c,this.write(l),!s){if(a)this.write(Buffer.alloc(a));return this[It](t,(u)=>u?this.emit("error",u):this.end())}if(n>=o)r=Buffer.allocUnsafe(o),n=0;o=r.length-n,this[In](t,r,n,o,i,s,a)}});class Dc extends Xn{[Oi](){this[zn](m.default.lstatSync(this.absolute))}[xi](){this[zi](m.default.readlinkSync(this.absolute))}[Ai](){this[Pi](m.default.openSync(this.absolute,"r"))}[In](e,t,r,n,o,i,s){let a=!0;try{let c=m.default.readSync(e,t,r,n,o);this[Ii](e,t,r,n,o,i,s,c),a=!1}finally{if(a)try{this[It](e,()=>{})}catch(c){}}}[It](e,t){m.default.closeSync(e),t()}}var pg=Jn(class extends cr{constructor(t,r){r=r||{};super(r);if(this.preservePaths=!!r.preservePaths,this.portable=!!r.portable,this.strict=!!r.strict,this.noPax=!!r.noPax,this.noMtime=!!r.noMtime,this.readEntry=t,this.type=t.type,this.type==="Directory"&&this.portable)this.noMtime=!0;if(this.path=t.path,this.mode=this[Bn](t.mode),this.uid=this.portable?null:t.uid,this.gid=this.portable?null:t.gid,this.uname=this.portable?null:t.uname,this.gname=this.portable?null:t.gname,this.size=t.size,this.mtime=this.noMtime?null:r.mtime||t.mtime,this.atime=this.portable?null:t.atime,this.ctime=this.portable?null:t.ctime,this.linkpath=t.linkpath,typeof r.onwarn==="function")this.on("warn",r.onwarn);let n=!1;if(v.default.isAbsolute(this.path)&&!this.preservePaths){let o=v.default.parse(this.path);n=o.root,this.path=this.path.substr(o.root.length)}if(this.remain=t.size,this.blockRemain=t.startBlockSize,this.header=new Rt({path:this.path,linkpath:this.linkpath,mode:this.mode,uid:this.portable?null:this.uid,gid:this.portable?null:this.gid,size:this.size,mtime:this.noMtime?null:this.mtime,type:this.type,uname:this.portable?null:this.uname,atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime}),n)this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:this,path:n+this.path});if(this.header.encode()&&!this.noPax)super.write(new Lr({atime:this.portable?null:this.atime,ctime:this.portable?null:this.ctime,gid:this.portable?null:this.gid,mtime:this.noMtime?null:this.mtime,path:this.path,linkpath:this.linkpath,size:this.size,uid:this.portable?null:this.uid,uname:this.portable?null:this.uname,dev:this.portable?null:this.readEntry.dev,ino:this.portable?null:this.readEntry.ino,nlink:this.portable?null:this.readEntry.nlink}).encode());super.write(this.header.block),t.pipe(this)}[Bn](t){return Nc(t,this.type==="Directory",this.portable)}write(t){let r=t.length;if(r>this.blockRemain)throw Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(t)}end(){if(this.blockRemain)this.write(Buffer.alloc(this.blockRemain));return super.end()}});Xn.Sync=Dc;Xn.Tar=pg;var mg=(e)=>e.isFile()?"File":e.isDirectory()?"Directory":e.isSymbolicLink()?"SymbolicLink":"Unsupported",Qn=Xn;class Ci{constructor(e,t){this.path=e||"./",this.absolute=t,this.entry=null,this.stat=null,this.readdir=null,this.pending=!1,this.ignore=!1,this.piped=!1}}var{Sync:gg,Tar:yg}=Qn,Va=Buffer.alloc(1024),An=Symbol("onStat"),dn=Symbol("ended"),De=Symbol("queue"),Vt=Symbol("current"),bt=Symbol("process"),pn=Symbol("processing"),Ga=Symbol("processJob"),Le=Symbol("jobs"),Yo=Symbol("jobDone"),Pn=Symbol("addFSEntry"),Wa=Symbol("addTarEntry"),Ri=Symbol("stat"),Ti=Symbol("readdir"),Cn=Symbol("onreaddir"),Rn=Symbol("pipe"),Ha=Symbol("entry"),Xo=Symbol("entryOpt"),Ni=Symbol("writeEntryClass"),Lc=Symbol("write"),Qo=Symbol("ondrain"),us=Jn(class extends cr{constructor(t){super(t);if(t=t||Object.create(null),this.opt=t,this.file=t.file||"",this.cwd=t.cwd||process.cwd(),this.maxReadSize=t.maxReadSize,this.preservePaths=!!t.preservePaths,this.strict=!!t.strict,this.noPax=!!t.noPax,this.prefix=(t.prefix||"").replace(/(\\|\/)+$/,""),this.linkCache=t.linkCache||new Map,this.statCache=t.statCache||new Map,this.readdirCache=t.readdirCache||new Map,this[Ni]=Qn,typeof t.onwarn==="function")this.on("warn",t.onwarn);if(this.portable=!!t.portable,this.zip=null,t.gzip){if(typeof t.gzip!=="object")t.gzip={};if(this.portable)t.gzip.portable=!0;this.zip=new Ac.Gzip(t.gzip),this.zip.on("data",(r)=>super.write(r)),this.zip.on("end",(r)=>super.end()),this.zip.on("drain",(r)=>this[Qo]()),this.on("resume",(r)=>this.zip.resume())}else this.on("drain",this[Qo]);this.noDirRecurse=!!t.noDirRecurse,this.follow=!!t.follow,this.noMtime=!!t.noMtime,this.mtime=t.mtime||null,this.filter=typeof t.filter==="function"?t.filter:(r)=>!0,this[De]=new Ot,this[Le]=0,this.jobs=+t.jobs||4,this[pn]=!1,this[dn]=!1}[Lc](t){return super.write(t)}add(t){return this.write(t),this}end(t){if(t)this.write(t);return this[dn]=!0,this[bt](),this}write(t){if(this[dn])throw Error("write after end");if(t instanceof as)this[Wa](t);else this[Pn](t);return this.flowing}[Wa](t){let r=v.default.resolve(this.cwd,t.path);if(this.prefix)t.path=this.prefix+"/"+t.path.replace(/^\.(\/+|$)/,"");if(!this.filter(t.path,t))t.resume();else{let n=new Ci(t.path,r,!1);n.entry=new yg(t,this[Xo](n)),n.entry.on("end",(o)=>this[Yo](n)),this[Le]+=1,this[De].push(n)}this[bt]()}[Pn](t){let r=v.default.resolve(this.cwd,t);if(this.prefix)t=this.prefix+"/"+t.replace(/^\.(\/+|$)/,"");this[De].push(new Ci(t,r)),this[bt]()}[Ri](t){t.pending=!0,this[Le]+=1;let r=this.follow?"stat":"lstat";m.default[r](t.absolute,(n,o)=>{if(t.pending=!1,this[Le]-=1,n)this.emit("error",n);else this[An](t,o)})}[An](t,r){if(this.statCache.set(t.absolute,r),t.stat=r,!this.filter(t.path,r))t.ignore=!0;this[bt]()}[Ti](t){t.pending=!0,this[Le]+=1,m.default.readdir(t.absolute,(r,n)=>{if(t.pending=!1,this[Le]-=1,r)return this.emit("error",r);this[Cn](t,n)})}[Cn](t,r){this.readdirCache.set(t.absolute,r),t.readdir=r,this[bt]()}[bt](){if(this[pn])return;this[pn]=!0;for(let t=this[De].head;t!==null&&this[Le]<this.jobs;t=t.next)if(this[Ga](t.value),t.value.ignore){let r=t.next;this[De].removeNode(t),t.next=r}if(this[pn]=!1,this[dn]&&!this[De].length&&this[Le]===0)if(this.zip)this.zip.end(Va);else super.write(Va),super.end()}get[Vt](){return this[De]&&this[De].head&&this[De].head.value}[Yo](t){this[De].shift(),this[Le]-=1,this[bt]()}[Ga](t){if(t.pending)return;if(t.entry){if(t===this[Vt]&&!t.piped)this[Rn](t);return}if(!t.stat)if(this.statCache.has(t.absolute))this[An](t,this.statCache.get(t.absolute));else this[Ri](t);if(!t.stat)return;if(t.ignore)return;if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){if(this.readdirCache.has(t.absolute))this[Cn](t,this.readdirCache.get(t.absolute));else this[Ti](t);if(!t.readdir)return}if(t.entry=this[Ha](t),!t.entry){t.ignore=!0;return}if(t===this[Vt]&&!t.piped)this[Rn](t)}[Xo](t){return{onwarn:(r,n,o)=>this.warn(r,n,o),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime}}[Ha](t){this[Le]+=1;try{return new this[Ni](t.path,this[Xo](t)).on("end",()=>this[Yo](t)).on("error",(r)=>this.emit("error",r))}catch(r){this.emit("error",r)}}[Qo](){if(this[Vt]&&this[Vt].entry)this[Vt].entry.resume()}[Rn](t){if(t.piped=!0,t.readdir)t.readdir.forEach((o)=>{let i=this.prefix?t.path.slice(this.prefix.length+1)||"./":t.path,s=i==="./"?"":i.replace(/\/*$/,"/");this[Pn](s+o)});let r=t.entry,n=this.zip;if(n)r.on("data",(o)=>{if(!n.write(o))r.pause()});else r.on("data",(o)=>{if(!super.write(o))r.pause()})}pause(){if(this.zip)this.zip.pause();return super.pause()}});class Zc extends us{constructor(e){super(e);this[Ni]=gg}pause(){}resume(){}[Ri](e){let t=this.follow?"statSync":"lstatSync";this[An](e,m.default[t](e.absolute))}[Ti](e,t){this[Cn](e,m.default.readdirSync(e.absolute))}[Rn](e){let t=e.entry,r=this.zip;if(e.readdir)e.readdir.forEach((n)=>{let o=this.prefix?e.path.slice(this.prefix.length+1)||"./":e.path,i=o==="./"?"":o.replace(/\/*$/,"/");this[Pn](i+n)});if(r)t.on("data",(n)=>{r.write(n)});else t.on("data",(n)=>{super[Lc](n)})}}us.Sync=Zc;var Tt=us,_g=ar.default.EventEmitter,Di=m.default.writev;if(!Di){let e=process.binding("fs"),t=e.FSReqWrap||e.FSReqCallback;Di=(r,n,o,i)=>{let s=(c,l)=>i(c,l,n),a=new t;a.oncomplete=s,e.writeBuffers(r,n,o,a)}}var tr=Symbol("_autoClose"),Pe=Symbol("_close"),Or=Symbol("_ended"),M=Symbol("_fd"),qa=Symbol("_finished"),ut=Symbol("_flags"),ei=Symbol("_flush"),Li=Symbol("_handleChunk"),Zi=Symbol("_makeBuf"),Un=Symbol("_mode"),mn=Symbol("_needDrain"),Yt=Symbol("_onerror"),rr=Symbol("_onopen"),ti=Symbol("_onread"),Ht=Symbol("_onwrite"),lt=Symbol("_open"),Xe=Symbol("_path"),xt=Symbol("_pos"),Ze=Symbol("_queue"),qt=Symbol("_read"),Ka=Symbol("_readSize"),at=Symbol("_reading"),gn=Symbol("_remain"),Ja=Symbol("_size"),Tn=Symbol("_write"),Gt=Symbol("_writing"),Nn=Symbol("_defaultFlag"),Xt=Symbol("_errored");class ls extends cr{constructor(e,t){t=t||{};super(t);if(this.readable=!0,this.writable=!1,typeof e!=="string")throw TypeError("path must be a string");if(this[Xt]=!1,this[M]=typeof t.fd==="number"?t.fd:null,this[Xe]=e,this[Ka]=t.readSize||16777216,this[at]=!1,this[Ja]=typeof t.size==="number"?t.size:1/0,this[gn]=this[Ja],this[tr]=typeof t.autoClose==="boolean"?t.autoClose:!0,typeof this[M]==="number")this[qt]();else this[lt]()}get fd(){return this[M]}get path(){return this[Xe]}write(){throw TypeError("this is a readable stream")}end(){throw TypeError("this is a readable stream")}[lt](){m.default.open(this[Xe],"r",(e,t)=>this[rr](e,t))}[rr](e,t){if(e)this[Yt](e);else this[M]=t,this.emit("open",t),this[qt]()}[Zi](){return Buffer.allocUnsafe(Math.min(this[Ka],this[gn]))}[qt](){if(!this[at]){this[at]=!0;let e=this[Zi]();if(e.length===0)return process.nextTick(()=>this[ti](null,0,e));m.default.read(this[M],e,0,e.length,null,(t,r,n)=>this[ti](t,r,n))}}[ti](e,t,r){if(this[at]=!1,e)this[Yt](e);else if(this[Li](t,r))this[qt]()}[Pe](){if(this[tr]&&typeof this[M]==="number"){let e=this[M];this[M]=null,m.default.close(e,(t)=>t?this.emit("error",t):this.emit("close"))}}[Yt](e){this[at]=!0,this[Pe](),this.emit("error",e)}[Li](e,t){let r=!1;if(this[gn]-=e,e>0)r=super.write(e<t.length?t.slice(0,e):t);if(e===0||this[gn]<=0)r=!1,this[Pe](),super.end();return r}emit(e,t){switch(e){case"prefinish":case"finish":break;case"drain":if(typeof this[M]==="number")this[qt]();break;case"error":if(this[Xt])return;return this[Xt]=!0,super.emit(e,t);default:return super.emit(e,t)}}}class Fc extends ls{[lt](){let e=!0;try{this[rr](null,m.default.openSync(this[Xe],"r")),e=!1}finally{if(e)this[Pe]()}}[qt](){let e=!0;try{if(!this[at]){this[at]=!0;do{let t=this[Zi](),r=t.length===0?0:m.default.readSync(this[M],t,0,t.length,null);if(!this[Li](r,t))break}while(!0);this[at]=!1}e=!1}finally{if(e)this[Pe]()}}[Pe](){if(this[tr]&&typeof this[M]==="number"){let e=this[M];this[M]=null,m.default.closeSync(e),this.emit("close")}}}class fs extends _g{constructor(e,t){t=t||{};super(t);this.readable=!1,this.writable=!0,this[Xt]=!1,this[Gt]=!1,this[Or]=!1,this[mn]=!1,this[Ze]=[],this[Xe]=e,this[M]=typeof t.fd==="number"?t.fd:null,this[Un]=t.mode===void 0?438:t.mode,this[xt]=typeof t.start==="number"?t.start:null,this[tr]=typeof t.autoClose==="boolean"?t.autoClose:!0;let r=this[xt]!==null?"r+":"w";if(this[Nn]=t.flags===void 0,this[ut]=this[Nn]?r:t.flags,this[M]===null)this[lt]()}emit(e,t){if(e==="error"){if(this[Xt])return;this[Xt]=!0}return super.emit(e,t)}get fd(){return this[M]}get path(){return this[Xe]}[Yt](e){this[Pe](),this[Gt]=!0,this.emit("error",e)}[lt](){m.default.open(this[Xe],this[ut],this[Un],(e,t)=>this[rr](e,t))}[rr](e,t){if(this[Nn]&&this[ut]==="r+"&&e&&e.code==="ENOENT")this[ut]="w",this[lt]();else if(e)this[Yt](e);else this[M]=t,this.emit("open",t),this[ei]()}end(e,t){if(e)this.write(e,t);if(this[Or]=!0,!this[Gt]&&!this[Ze].length&&typeof this[M]==="number")this[Ht](null,0);return this}write(e,t){if(typeof e==="string")e=Buffer.from(e,t);if(this[Or])return this.emit("error",Error("write() after end()")),!1;if(this[M]===null||this[Gt]||this[Ze].length)return this[Ze].push(e),this[mn]=!0,!1;return this[Gt]=!0,this[Tn](e),!0}[Tn](e){m.default.write(this[M],e,0,e.length,this[xt],(t,r)=>this[Ht](t,r))}[Ht](e,t){if(e)this[Yt](e);else{if(this[xt]!==null)this[xt]+=t;if(this[Ze].length)this[ei]();else if(this[Gt]=!1,this[Or]&&!this[qa])this[qa]=!0,this[Pe](),this.emit("finish");else if(this[mn])this[mn]=!1,this.emit("drain")}}[ei](){if(this[Ze].length===0){if(this[Or])this[Ht](null,0)}else if(this[Ze].length===1)this[Tn](this[Ze].pop());else{let e=this[Ze];this[Ze]=[],Di(this[M],e,this[xt],(t,r)=>this[Ht](t,r))}}[Pe](){if(this[tr]&&typeof this[M]==="number"){let e=this[M];this[M]=null,m.default.close(e,(t)=>t?this.emit("error",t):this.emit("close"))}}}class Mc extends fs{[lt](){let e;if(this[Nn]&&this[ut]==="r+")try{e=m.default.openSync(this[Xe],this[ut],this[Un])}catch(t){if(t.code==="ENOENT")return this[ut]="w",this[lt]();else throw t}else e=m.default.openSync(this[Xe],this[ut],this[Un]);this[rr](null,e)}[Pe](){if(this[tr]&&typeof this[M]==="number"){let e=this[M];this[M]=null,m.default.closeSync(e),this.emit("close")}}[Tn](e){let t=!0;try{this[Ht](null,m.default.writeSync(this[M],e,0,e.length,this[xt])),t=!1}finally{if(t)try{this[Pe]()}catch(r){}}}}var wg=ls,vg=Fc,bg=fs,$g=Mc,mt={ReadStream:wg,ReadStreamSync:vg,WriteStream:bg,WriteStreamSync:$g},Sg=1048576,ri=Buffer.from([31,139]),ke=Symbol("state"),$t=Symbol("writeEntry"),qe=Symbol("readEntry"),ni=Symbol("nextEntry"),Ya=Symbol("processEntry"),Ee=Symbol("extendedHeader"),Ir=Symbol("globalExtendedHeader"),nt=Symbol("meta"),Xa=Symbol("emitMeta"),j=Symbol("buffer"),Ke=Symbol("queue"),St=Symbol("ended"),Qa=Symbol("emittedEnd"),kt=Symbol("emit"),pe=Symbol("unzip"),yn=Symbol("consumeChunk"),_n=Symbol("consumeChunkSub"),oi=Symbol("consumeBody"),ec=Symbol("consumeMeta"),tc=Symbol("consumeHeader"),wn=Symbol("consuming"),ii=Symbol("bufferConcat"),si=Symbol("maybeEnd"),zr=Symbol("writing"),ot=Symbol("aborted"),vn=Symbol("onDone"),Et=Symbol("sawValidEntry"),bn=Symbol("sawNullBlock"),$n=Symbol("sawEOF"),kg=(e)=>!0,eo=Jn(class extends ar.default{constructor(t){t=t||{};super(t);if(this.file=t.file||"",this[Et]=null,this.on(vn,(r)=>{if(this[ke]==="begin"||this[Et]===!1)this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),t.ondone)this.on(vn,t.ondone);else this.on(vn,(r)=>{this.emit("prefinish"),this.emit("finish"),this.emit("end"),this.emit("close")});if(this.strict=!!t.strict,this.maxMetaEntrySize=t.maxMetaEntrySize||Sg,this.filter=typeof t.filter==="function"?t.filter:kg,this.writable=!0,this.readable=!1,this[Ke]=new Ot,this[j]=null,this[qe]=null,this[$t]=null,this[ke]="begin",this[nt]="",this[Ee]=null,this[Ir]=null,this[St]=!1,this[pe]=null,this[ot]=!1,this[bn]=!1,this[$n]=!1,typeof t.onwarn==="function")this.on("warn",t.onwarn);if(typeof t.onentry==="function")this.on("entry",t.onentry)}[tc](t,r){if(this[Et]===null)this[Et]=!1;let n;try{n=new Rt(t,r,this[Ee],this[Ir])}catch(o){return this.warn("TAR_ENTRY_INVALID",o)}if(n.nullBlock)if(this[bn]){if(this[$n]=!0,this[ke]==="begin")this[ke]="header";this[kt]("eof")}else this[bn]=!0,this[kt]("nullBlock");else if(this[bn]=!1,!n.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:n});else if(!n.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:n});else{let o=n.type;if(/^(Symbolic)?Link$/.test(o)&&!n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:n});else if(!/^(Symbolic)?Link$/.test(o)&&n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:n});else{let i=this[$t]=new as(n,this[Ee],this[Ir]);if(!this[Et])if(i.remain){let s=()=>{if(!i.invalid)this[Et]=!0};i.on("end",s)}else this[Et]=!0;if(i.meta){if(i.size>this.maxMetaEntrySize)i.ignore=!0,this[kt]("ignoredEntry",i),this[ke]="ignore",i.resume();else if(i.size>0)this[nt]="",i.on("data",(s)=>this[nt]+=s),this[ke]="meta"}else if(this[Ee]=null,i.ignore=i.ignore||!this.filter(i.path,i),i.ignore)this[kt]("ignoredEntry",i),this[ke]=i.remain?"ignore":"header",i.resume();else{if(i.remain)this[ke]="body";else this[ke]="header",i.end();if(!this[qe])this[Ke].push(i),this[ni]();else this[Ke].push(i)}}}}[Ya](t){let r=!0;if(!t)this[qe]=null,r=!1;else if(Array.isArray(t))this.emit.apply(this,t);else if(this[qe]=t,this.emit("entry",t),!t.emittedEnd)t.on("end",(n)=>this[ni]()),r=!1;return r}[ni](){do;while(this[Ya](this[Ke].shift()));if(!this[Ke].length){let t=this[qe];if(!t||t.flowing||t.size===t.remain){if(!this[zr])this.emit("drain")}else t.once("drain",(n)=>this.emit("drain"))}}[oi](t,r){let n=this[$t],o=n.blockRemain,i=o>=t.length&&r===0?t:t.slice(r,r+o);if(n.write(i),!n.blockRemain)this[ke]="header",this[$t]=null,n.end();return i.length}[ec](t,r){let n=this[$t],o=this[oi](t,r);if(!this[$t])this[Xa](n);return o}[kt](t,r,n){if(!this[Ke].length&&!this[qe])this.emit(t,r,n);else this[Ke].push([t,r,n])}[Xa](t){switch(this[kt]("meta",this[nt]),t.type){case"ExtendedHeader":case"OldExtendedHeader":this[Ee]=Lr.parse(this[nt],this[Ee],!1);break;case"GlobalExtendedHeader":this[Ir]=Lr.parse(this[nt],this[Ir],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":this[Ee]=this[Ee]||Object.create(null),this[Ee].path=this[nt].replace(/\0.*/,"");break;case"NextFileHasLongLinkpath":this[Ee]=this[Ee]||Object.create(null),this[Ee].linkpath=this[nt].replace(/\0.*/,"");break;default:throw Error("unknown meta: "+t.type)}}abort(t){this[ot]=!0,this.emit("abort",t),this.warn("TAR_ABORT",t,{recoverable:!1})}write(t){if(this[ot])return;if(this[pe]===null&&t){if(this[j])t=Buffer.concat([this[j],t]),this[j]=null;if(t.length<ri.length)return this[j]=t,!0;for(let n=0;this[pe]===null&&n<ri.length;n++)if(t[n]!==ri[n])this[pe]=!1;if(this[pe]===null){let n=this[St];this[St]=!1,this[pe]=new Ac.Unzip,this[pe].on("data",(i)=>this[yn](i)),this[pe].on("error",(i)=>this.abort(i)),this[pe].on("end",(i)=>{this[St]=!0,this[yn]()}),this[zr]=!0;let o=this[pe][n?"end":"write"](t);return this[zr]=!1,o}}if(this[zr]=!0,this[pe])this[pe].write(t);else this[yn](t);this[zr]=!1;let r=this[Ke].length?!1:this[qe]?this[qe].flowing:!0;if(!r&&!this[Ke].length)this[qe].once("drain",(n)=>this.emit("drain"));return r}[ii](t){if(t&&!this[ot])this[j]=this[j]?Buffer.concat([this[j],t]):t}[si](){if(this[St]&&!this[Qa]&&!this[ot]&&!this[wn]){this[Qa]=!0;let t=this[$t];if(t&&t.blockRemain){let r=this[j]?this[j].length:0;if(this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${r} available)`,{entry:t}),this[j])t.write(this[j]);t.end()}this[kt](vn)}}[yn](t){if(this[wn])this[ii](t);else if(!t&&!this[j])this[si]();else{if(this[wn]=!0,this[j]){this[ii](t);let r=this[j];this[j]=null,this[_n](r)}else this[_n](t);while(this[j]&&this[j].length>=512&&!this[ot]&&!this[$n]){let r=this[j];this[j]=null,this[_n](r)}this[wn]=!1}if(!this[j]||this[St])this[si]()}[_n](t){let r=0,n=t.length;while(r+512<=n&&!this[ot]&&!this[$n])switch(this[ke]){case"begin":case"header":this[tc](t,r),r+=512;break;case"ignore":case"body":r+=this[oi](t,r);break;case"meta":r+=this[ec](t,r);break;default:throw Error("invalid state: "+this[ke])}if(r<n)if(this[j])this[j]=Buffer.concat([t.slice(r),this[j]]);else this[j]=t.slice(r)}end(t){if(!this[ot])if(this[pe])this[pe].end(t);else this[St]=!0,this.write(t)}}),Wr=(e,t,r)=>{if(typeof e==="function")r=e,t=null,e={};else if(Array.isArray(e))t=e,e={};if(typeof t==="function")r=t,t=null;if(!t)t=[];else t=Array.from(t);let n=Gr(e);if(n.sync&&typeof r==="function")throw TypeError("callback not supported for sync tar functions");if(!n.file&&typeof r==="function")throw TypeError("callback only supported with file option");if(t.length)xg(n,t);if(!n.noResume)Eg(n);return n.file&&n.sync?Og(n):n.file?Ig(n,r):jc(n)},Eg=(e)=>{let t=e.onentry;e.onentry=t?(r)=>{t(r),r.resume()}:(r)=>r.resume()},xg=(e,t)=>{let r=new Map(t.map((i)=>[i.replace(/\/+$/,""),!0])),n=e.filter,o=(i,s)=>{let a=s||v.default.parse(i).root||".",c=i===a?!1:r.has(i)?r.get(i):o(v.default.dirname(i),a);return r.set(i,c),c};e.filter=n?(i,s)=>n(i,s)&&o(i.replace(/\/+$/,"")):(i)=>o(i.replace(/\/+$/,""))},Og=(e)=>{let t=jc(e),r=e.file,n=!0,o;try{let i=m.default.statSync(r),s=e.maxReadSize||16777216;if(i.size<s)t.end(m.default.readFileSync(r));else{let a=0,c=Buffer.allocUnsafe(s);o=m.default.openSync(r,"r");while(a<i.size){let l=m.default.readSync(o,c,0,s,a);a+=l,t.write(c.slice(0,l))}t.end()}n=!1}finally{if(n&&o)try{m.default.closeSync(o)}catch(i){}}},Ig=(e,t)=>{let r=new eo(e),n=e.maxReadSize||16777216,o=e.file,i=new Promise((s,a)=>{r.on("error",a),r.on("end",s),m.default.stat(o,(c,l)=>{if(c)a(c);else{let u=new mt.ReadStream(o,{readSize:n,size:l.size});u.on("error",a),u.pipe(r)}})});return t?i.then(t,t):i},jc=(e)=>new eo(e),zg=(e,t,r)=>{if(typeof t==="function")r=t;if(Array.isArray(e))t=e,e={};if(!t||!Array.isArray(t)||!t.length)throw TypeError("no files or directories specified");t=Array.from(t);let n=Gr(e);if(n.sync&&typeof r==="function")throw TypeError("callback not supported for sync tar functions");if(!n.file&&typeof r==="function")throw TypeError("callback only supported with file option");return n.file&&n.sync?Ag(n,t):n.file?Pg(n,t,r):n.sync?Cg(n,t):Rg(n,t)},Ag=(e,t)=>{let r=new Tt.Sync(e),n=new mt.WriteStreamSync(e.file,{mode:e.mode||438});r.pipe(n),Bc(r,t)},Pg=(e,t,r)=>{let n=new Tt(e),o=new mt.WriteStream(e.file,{mode:e.mode||438});n.pipe(o);let i=new Promise((s,a)=>{o.on("error",a),o.on("close",s),n.on("error",a)});return hs(n,t),r?i.then(r,r):i},Bc=(e,t)=>{t.forEach((r)=>{if(r.charAt(0)==="@")Wr({file:v.default.resolve(e.cwd,r.substr(1)),sync:!0,noResume:!0,onentry:(n)=>e.add(n)});else e.add(r)}),e.end()},hs=(e,t)=>{while(t.length){let r=t.shift();if(r.charAt(0)==="@")return Wr({file:v.default.resolve(e.cwd,r.substr(1)),noResume:!0,onentry:(n)=>e.add(n)}).then((n)=>hs(e,t));else e.add(r)}e.end()},Cg=(e,t)=>{let r=new Tt.Sync(e);return Bc(r,t),r},Rg=(e,t)=>{let r=new Tt(e);return hs(r,t),r},Uc=(e,t,r)=>{let n=Gr(e);if(!n.file)throw TypeError("file is required");if(n.gzip)throw TypeError("cannot append to compressed archives");if(!t||!Array.isArray(t)||!t.length)throw TypeError("no files or directories specified");return t=Array.from(t),n.sync?Tg(n,t):Dg(n,t,r)},Tg=(e,t)=>{let r=new Tt.Sync(e),n=!0,o,i;try{try{o=m.default.openSync(e.file,"r+")}catch(c){if(c.code==="ENOENT")o=m.default.openSync(e.file,"w+");else throw c}let s=m.default.fstatSync(o),a=Buffer.alloc(512);e:for(i=0;i<s.size;i+=512){for(let u=0,f=0;u<512;u+=f){if(f=m.default.readSync(o,a,u,a.length-u,i+u),i===0&&a[0]===31&&a[1]===139)throw Error("cannot append to compressed archives");if(!f)break e}let c=new Rt(a);if(!c.cksumValid)break;let l=512*Math.ceil(c.size/512);if(i+l+512>s.size)break;if(i+=l,e.mtimeCache)e.mtimeCache.set(c.path,c.mtime)}n=!1,Ng(e,r,i,o,t)}finally{if(n)try{m.default.closeSync(o)}catch(s){}}},Ng=(e,t,r,n,o)=>{let i=new mt.WriteStreamSync(e.file,{fd:n,start:r});t.pipe(i),Lg(t,o)},Dg=(e,t,r)=>{t=Array.from(t);let n=new Tt(e),o=(s,a,c)=>{let l=(p,g)=>{if(p)m.default.close(s,(y)=>c(p));else c(null,g)},u=0;if(a===0)return l(null,0);let f=0,h=Buffer.alloc(512),d=(p,g)=>{if(p)return l(p);if(f+=g,f<512&&g)return m.default.read(s,h,f,h.length-f,u+f,d);if(u===0&&h[0]===31&&h[1]===139)return l(Error("cannot append to compressed archives"));if(f<512)return l(null,u);let y=new Rt(h);if(!y.cksumValid)return l(null,u);let b=512*Math.ceil(y.size/512);if(u+b+512>a)return l(null,u);if(u+=b+512,u>=a)return l(null,u);if(e.mtimeCache)e.mtimeCache.set(y.path,y.mtime);f=0,m.default.read(s,h,0,512,u,d)};m.default.read(s,h,0,512,u,d)},i=new Promise((s,a)=>{n.on("error",a);let c="r+",l=(u,f)=>{if(u&&u.code==="ENOENT"&&c==="r+")return c="w+",m.default.open(e.file,c,l);if(u)return a(u);m.default.fstat(f,(h,d)=>{if(h)return a(h);o(f,d.size,(p,g)=>{if(p)return a(p);let y=new mt.WriteStream(e.file,{fd:f,start:g});n.pipe(y),y.on("error",a),y.on("close",s),Vc(n,t)})})};m.default.open(e.file,c,l)});return r?i.then(r,r):i},Lg=(e,t)=>{t.forEach((r)=>{if(r.charAt(0)==="@")Wr({file:v.default.resolve(e.cwd,r.substr(1)),sync:!0,noResume:!0,onentry:(n)=>e.add(n)});else e.add(r)}),e.end()},Vc=(e,t)=>{while(t.length){let r=t.shift();if(r.charAt(0)==="@")return Wr({file:v.default.resolve(e.cwd,r.substr(1)),noResume:!0,onentry:(n)=>e.add(n)}).then((n)=>Vc(e,t));else e.add(r)}e.end()},Zg=(e,t,r)=>{let n=Gr(e);if(!n.file)throw TypeError("file is required");if(n.gzip)throw TypeError("cannot append to compressed archives");if(!t||!Array.isArray(t)||!t.length)throw TypeError("no files or directories specified");return t=Array.from(t),Fg(n),Uc(n,t,r)},Fg=(e)=>{let t=e.filter;if(!e.mtimeCache)e.mtimeCache=new Map;e.filter=t?(r,n)=>t(r,n)&&!(e.mtimeCache.get(r)>n.mtime):(r,n)=>!(e.mtimeCache.get(r)>n.mtime)},{promisify:rc}=Fe.default,Mg=(e)=>{if(!e)e={mode:511,fs:m.default};else if(typeof e==="object")e={mode:511,fs:m.default,...e};else if(typeof e==="number")e={mode:e,fs:m.default};else if(typeof e==="string")e={mode:parseInt(e,8),fs:m.default};else throw TypeError("invalid options argument");return e.mkdir=e.mkdir||e.fs.mkdir||m.default.mkdir,e.mkdirAsync=rc(e.mkdir),e.stat=e.stat||e.fs.stat||m.default.stat,e.statAsync=rc(e.stat),e.statSync=e.statSync||e.fs.statSync||m.default.statSync,e.mkdirSync=e.mkdirSync||e.fs.mkdirSync||m.default.mkdirSync,e},ur=Mg,jg=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform,{resolve:Bg,parse:Ug}=v.default,Vg=(e)=>{if(/\0/.test(e))throw Object.assign(TypeError("path must be a string without null bytes"),{path:e,code:"ERR_INVALID_ARG_VALUE"});if(e=Bg(e),jg==="win32"){let t=/[*|"<>?:]/,{root:r}=Ug(e);if(t.test(e.substr(r.length)))throw Object.assign(Error("Illegal characters in path."),{path:e,code:"EINVAL"})}return e},lr=Vg,{dirname:Gc}=v.default,Wc=(e,t,r=void 0)=>{if(r===t)return Promise.resolve();return e.statAsync(t).then((n)=>n.isDirectory()?r:void 0,(n)=>n.code==="ENOENT"?Wc(e,Gc(t),t):void 0)},Hc=(e,t,r=void 0)=>{if(r===t)return;try{return e.statSync(t).isDirectory()?r:void 0}catch(n){return n.code==="ENOENT"?Hc(e,Gc(t),t):void 0}},Gg={findMade:Wc,findMadeSync:Hc},{dirname:qc}=v.default,Fi=(e,t,r)=>{t.recursive=!1;let n=qc(e);if(n===e)return t.mkdirAsync(e,t).catch((o)=>{if(o.code!=="EISDIR")throw o});return t.mkdirAsync(e,t).then(()=>r||e,(o)=>{if(o.code==="ENOENT")return Fi(n,t).then((i)=>Fi(e,t,i));if(o.code!=="EEXIST"&&o.code!=="EROFS")throw o;return t.statAsync(e).then((i)=>{if(i.isDirectory())return r;else throw o},()=>{throw o})})},Mi=(e,t,r)=>{let n=qc(e);if(t.recursive=!1,n===e)try{return t.mkdirSync(e,t)}catch(o){if(o.code!=="EISDIR")throw o;else return}try{return t.mkdirSync(e,t),r||e}catch(o){if(o.code==="ENOENT")return Mi(e,t,Mi(n,t,r));if(o.code!=="EEXIST"&&o.code!=="EROFS")throw o;try{if(!t.statSync(e).isDirectory())throw o}catch(i){throw o}}},Kc={mkdirpManual:Fi,mkdirpManualSync:Mi},{dirname:Jc}=v.default,{findMade:Wg,findMadeSync:Hg}=Gg,{mkdirpManual:qg,mkdirpManualSync:Kg}=Kc,Jg=(e,t)=>{if(t.recursive=!0,Jc(e)===e)return t.mkdirAsync(e,t);return Wg(t,e).then((n)=>t.mkdirAsync(e,t).then(()=>n).catch((o)=>{if(o.code==="ENOENT")return qg(e,t);else throw o}))},Yg=(e,t)=>{if(t.recursive=!0,Jc(e)===e)return t.mkdirSync(e,t);let n=Hg(t,e);try{return t.mkdirSync(e,t),n}catch(o){if(o.code==="ENOENT")return Kg(e,t);else throw o}},Xg={mkdirpNative:Jg,mkdirpNativeSync:Yg},Qg=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version,ai=Qg.replace(/^v/,"").split("."),Yc=+ai[0]>10||+ai[0]===10&&+ai[1]>=12,ey=!Yc?()=>!1:(e)=>e.mkdir===m.default.mkdir,ty=!Yc?()=>!1:(e)=>e.mkdirSync===m.default.mkdirSync,ry={useNative:ey,useNativeSync:ty},{mkdirpNative:Xc,mkdirpNativeSync:Qc}=Xg,{mkdirpManual:eu,mkdirpManualSync:tu}=Kc,{useNative:ny,useNativeSync:oy}=ry,fr=(e,t)=>(e=lr(e),t=ur(t),ny(t)?Xc(e,t):eu(e,t)),iy=(e,t)=>(e=lr(e),t=ur(t),oy(t)?Qc(e,t):tu(e,t));fr.sync=iy;fr.native=(e,t)=>Xc(lr(e),ur(t));fr.manual=(e,t)=>eu(lr(e),ur(t));fr.nativeSync=(e,t)=>Qc(lr(e),ur(t));fr.manualSync=(e,t)=>tu(lr(e),ur(t));var ru=fr,sy=m.default.lchown?"lchown":"chown",ay=m.default.lchownSync?"lchownSync":"chownSync",nu=m.default.lchown&&!process.version.match(/v1[1-9]+\./)&&!process.version.match(/v10\.[6-9]/),nc=(e,t,r)=>{try{return m.default[ay](e,t,r)}catch(n){if(n.code!=="ENOENT")throw n}},cy=(e,t,r)=>{try{return m.default.chownSync(e,t,r)}catch(n){if(n.code!=="ENOENT")throw n}},uy=nu?(e,t,r,n)=>(o)=>{if(!o||o.code!=="EISDIR")n(o);else m.default.chown(e,t,r,n)}:(e,t,r,n)=>n,ji=nu?(e,t,r)=>{try{return nc(e,t,r)}catch(n){if(n.code!=="EISDIR")throw n;cy(e,t,r)}}:(e,t,r)=>nc(e,t,r),ly=process.version,ou=(e,t,r)=>m.default.readdir(e,t,r),fy=(e,t)=>m.default.readdirSync(e,t);if(/^v4\./.test(ly))ou=(e,t,r)=>m.default.readdir(e,r);var Vn=(e,t,r,n)=>{m.default[sy](e,t,r,uy(e,t,r,(o)=>{n(o&&o.code!=="ENOENT"?o:null)}))},iu=(e,t,r,n,o)=>{if(typeof t==="string")return m.default.lstat(v.default.resolve(e,t),(i,s)=>{if(i)return o(i.code!=="ENOENT"?i:null);s.name=t,iu(e,s,r,n,o)});if(t.isDirectory())ds(v.default.resolve(e,t.name),r,n,(i)=>{if(i)return o(i);let s=v.default.resolve(e,t.name);Vn(s,r,n,o)});else{let i=v.default.resolve(e,t.name);Vn(i,r,n,o)}},ds=(e,t,r,n)=>{ou(e,{withFileTypes:!0},(o,i)=>{if(o){if(o.code==="ENOENT")return n();else if(o.code!=="ENOTDIR"&&o.code!=="ENOTSUP")return n(o)}if(o||!i.length)return Vn(e,t,r,n);let s=i.length,a=null,c=(l)=>{if(a)return;if(l)return n(a=l);if(--s===0)return Vn(e,t,r,n)};i.forEach((l)=>iu(e,l,t,r,c))})},hy=(e,t,r,n)=>{if(typeof t==="string")try{let o=m.default.lstatSync(v.default.resolve(e,t));o.name=t,t=o}catch(o){if(o.code==="ENOENT")return;else throw o}if(t.isDirectory())su(v.default.resolve(e,t.name),r,n);ji(v.default.resolve(e,t.name),r,n)},su=(e,t,r)=>{let n;try{n=fy(e,{withFileTypes:!0})}catch(o){if(o.code==="ENOENT")return;else if(o.code==="ENOTDIR"||o.code==="ENOTSUP")return ji(e,t,r);else throw o}if(n&&n.length)n.forEach((o)=>hy(e,o,t,r));return ji(e,t,r)},au=ds;ds.sync=su;class ps extends Error{constructor(e,t){super("Cannot extract through symbolic link");this.path=t,this.symlink=e}get name(){return"SylinkError"}}class Zr extends Error{constructor(e,t){super(t+": Cannot cd into '"+e+"'");this.path=e,this.code=t}get name(){return"CwdError"}}var ms=(e,t,r)=>{let n=t.umask,o=t.mode|448,i=(o&n)!==0,{uid:s,gid:a}=t,c=typeof s==="number"&&typeof a==="number"&&(s!==t.processUid||a!==t.processGid),{preserve:l,unlink:u,cache:f,cwd:h}=t,d=(y,b)=>{if(y)r(y);else if(f.set(e,!0),b&&c)au(b,s,a,(S)=>d(S));else if(i)m.default.chmod(e,o,r);else r()};if(f&&f.get(e)===!0)return d();if(e===h)return m.default.stat(e,(y,b)=>{if(y||!b.isDirectory())y=new Zr(e,y&&y.code||"ENOTDIR");d(y)});if(l)return ru(e,{mode:o}).then((y)=>d(null,y),d);let g=v.default.relative(h,e).split(/\/|\\/);Gn(h,g,o,f,u,h,null,d)},Gn=(e,t,r,n,o,i,s,a)=>{if(!t.length)return a(null,s);let c=t.shift(),l=e+"/"+c;if(n.get(l))return Gn(l,t,r,n,o,i,s,a);m.default.mkdir(l,r,cu(l,t,r,n,o,i,s,a))},cu=(e,t,r,n,o,i,s,a)=>(c)=>{if(c){if(c.path&&v.default.dirname(c.path)===i&&(c.code==="ENOTDIR"||c.code==="ENOENT"))return a(new Zr(i,c.code));m.default.lstat(e,(l,u)=>{if(l)a(l);else if(u.isDirectory())Gn(e,t,r,n,o,i,s,a);else if(o)m.default.unlink(e,(f)=>{if(f)return a(f);m.default.mkdir(e,r,cu(e,t,r,n,o,i,s,a))});else if(u.isSymbolicLink())return a(new ps(e,e+"/"+t.join("/")));else a(c)})}else s=s||e,Gn(e,t,r,n,o,i,s,a)},dy=(e,t)=>{let r=t.umask,n=t.mode|448,o=(n&r)!==0,{uid:i,gid:s}=t,a=typeof i==="number"&&typeof s==="number"&&(i!==t.processUid||s!==t.processGid),{preserve:c,unlink:l,cache:u,cwd:f}=t,h=(y)=>{if(u.set(e,!0),y&&a)au.sync(y,i,s);if(o)m.default.chmodSync(e,n)};if(u&&u.get(e)===!0)return h();if(e===f){let y=!1,b="ENOTDIR";try{y=m.default.statSync(e).isDirectory()}catch(S){b=S.code}finally{if(!y)throw new Zr(e,b)}h();return}if(c)return h(ru.sync(e,n));let p=v.default.relative(f,e).split(/\/|\\/),g=null;for(let y=p.shift(),b=f;y&&(b+="/"+y);y=p.shift()){if(u.get(b))continue;try{m.default.mkdirSync(b,n),g=g||b,u.set(b,!0)}catch(S){if(S.path&&v.default.dirname(S.path)===f&&(S.code==="ENOTDIR"||S.code==="ENOENT"))return new Zr(f,S.code);let N=m.default.lstatSync(b);if(N.isDirectory()){u.set(b,!0);continue}else if(l){m.default.unlinkSync(b),m.default.mkdirSync(b,n),g=g||b,u.set(b,!0);continue}else if(N.isSymbolicLink())return new ps(b,b+"/"+p.join("/"))}}return h(g)};ms.sync=dy;var py=()=>{let e=new Map,t=new Map,{join:r}=v.default,n=(u)=>r(u).split(/[\\/]/).slice(0,-1).reduce((f,h)=>f.length?f.concat(r(f[f.length-1],h)):[h],[]),o=new Set,i=(u)=>{let f=t.get(u);if(!f)throw Error("function does not have any path reservations");return{paths:f.paths.map((h)=>e.get(h)),dirs:[...f.dirs].map((h)=>e.get(h))}},s=(u)=>{let{paths:f,dirs:h}=i(u);return f.every((d)=>d[0]===u)&&h.every((d)=>d[0]instanceof Set&&d[0].has(u))},a=(u)=>{if(o.has(u)||!s(u))return!1;return o.add(u),u(()=>c(u)),!0},c=(u)=>{if(!o.has(u))return!1;let{paths:f,dirs:h}=t.get(u),d=new Set;return f.forEach((p)=>{let g=e.get(p);if(O.default.equal(g[0],u),g.length===1)e.delete(p);else if(g.shift(),typeof g[0]==="function")d.add(g[0]);else g[0].forEach((y)=>d.add(y))}),h.forEach((p)=>{let g=e.get(p);if(O.default(g[0]instanceof Set),g[0].size===1&&g.length===1)e.delete(p);else if(g[0].size===1)g.shift(),d.add(g[0]);else g[0].delete(u)}),o.delete(u),d.forEach((p)=>a(p)),!0};return{check:s,reserve:(u,f)=>{let h=new Set(u.map((d)=>n(d)).reduce((d,p)=>d.concat(p)));return t.set(f,{dirs:h,paths:u}),u.forEach((d)=>{let p=e.get(d);if(!p)e.set(d,[f]);else p.push(f)}),h.forEach((d)=>{let p=e.get(d);if(!p)e.set(d,[new Set([f])]);else if(p[p.length-1]instanceof Set)p[p.length-1].add(f);else p.push(new Set([f]))}),a(f)}}},my=process.env.__FAKE_PLATFORM__||process.platform,gy=my==="win32",yy=ze.__FAKE_TESTING_FS__||m.default,{O_CREAT:_y,O_TRUNC:wy,O_WRONLY:vy,UV_FS_O_FILEMAP:uu=0}=yy.constants,by=gy&&!!uu,$y=524288,Sy=uu|wy|_y|vy,lu=!by?()=>"w":(e)=>e<$y?Sy:"w",oc=Symbol("onEntry"),Bi=Symbol("checkFs"),ic=Symbol("checkFs2"),Ui=Symbol("isReusable"),Ye=Symbol("makeFs"),Vi=Symbol("file"),Gi=Symbol("directory"),Dn=Symbol("link"),sc=Symbol("symlink"),ac=Symbol("hardlink"),cc=Symbol("unsupported"),uc=Symbol("checkPath"),Qt=Symbol("mkdir"),le=Symbol("onError"),Sn=Symbol("pending"),lc=Symbol("pend"),Wt=Symbol("unpend"),ci=Symbol("ended"),ui=Symbol("maybeClose"),Wi=Symbol("skip"),Rr=Symbol("doChown"),Tr=Symbol("uid"),Nr=Symbol("gid"),kn=()=>{throw Error("sync function called cb somehow?!?")},ky=(e,t)=>{if(process.platform!=="win32")return m.default.unlink(e,t);let r=e+".DELETE."+Oc.default.randomBytes(16).toString("hex");m.default.rename(e,r,(n)=>{if(n)return t(n);m.default.unlink(r,t)})},Ey=(e)=>{if(process.platform!=="win32")return m.default.unlinkSync(e);let t=e+".DELETE."+Oc.default.randomBytes(16).toString("hex");m.default.renameSync(e,t),m.default.unlinkSync(t)},fc=(e,t,r)=>e===e>>>0?e:t===t>>>0?t:r;class to extends eo{constructor(e){if(!e)e={};e.ondone=(t)=>{this[ci]=!0,this[ui]()};super(e);if(this.reservations=py(),this.transform=typeof e.transform==="function"?e.transform:null,this.writable=!0,this.readable=!1,this[Sn]=0,this[ci]=!1,this.dirCache=e.dirCache||new Map,typeof e.uid==="number"||typeof e.gid==="number"){if(typeof e.uid!=="number"||typeof e.gid!=="number")throw TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=null,this.gid=null,this.setOwner=!1;if(e.preserveOwner===void 0&&typeof e.uid!=="number")this.preserveOwner=process.getuid&&process.getuid()===0;else this.preserveOwner=!!e.preserveOwner;this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():null,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():null,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||process.platform==="win32",this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=v.default.resolve(e.cwd||process.cwd()),this.strip=+e.strip||0,this.processUmask=e.noChmod?0:process.umask(),this.umask=typeof e.umask==="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",(t)=>this[oc](t))}warn(e,t,r={}){if(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")r.recoverable=!1;return super.warn(e,t,r)}[ui](){if(this[ci]&&this[Sn]===0)this.emit("prefinish"),this.emit("finish"),this.emit("end"),this.emit("close")}[uc](e){if(this.strip){let t=e.path.split(/\/|\\/);if(t.length<this.strip)return!1;if(e.path=t.slice(this.strip).join("/"),e.type==="Link"){let r=e.linkpath.split(/\/|\\/);if(r.length>=this.strip)e.linkpath=r.slice(this.strip).join("/")}}if(!this.preservePaths){let t=e.path;if(t.match(/(^|\/|\\)\.\.(\\|\/|$)/))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:t}),!1;if(v.default.win32.isAbsolute(t)){let r=v.default.win32.parse(t);e.path=t.substr(r.root.length);let n=r.root;this.warn("TAR_ENTRY_INFO",`stripping ${n} from absolute path`,{entry:e,path:t})}}if(this.win32){let t=v.default.win32.parse(e.path);e.path=t.root===""?Ei.encode(e.path):t.root+Ei.encode(e.path.substr(t.root.length))}if(v.default.isAbsolute(e.path))e.absolute=e.path;else e.absolute=v.default.resolve(this.cwd,e.path);return!0}[oc](e){if(!this[uc](e))return e.resume();switch(O.default.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":if(e.mode)e.mode=e.mode|448;case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[Bi](e);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[cc](e)}}[le](e,t){if(e.name==="CwdError")this.emit("error",e);else this.warn("TAR_ENTRY_ERROR",e,{entry:t}),this[Wt](),t.resume()}[Qt](e,t,r){ms(e,{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:t,noChmod:this.noChmod},r)}[Rr](e){return this.forceChown||this.preserveOwner&&(typeof e.uid==="number"&&e.uid!==this.processUid||typeof e.gid==="number"&&e.gid!==this.processGid)||(typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid)}[Tr](e){return fc(this.uid,e.uid,this.processUid)}[Nr](e){return fc(this.gid,e.gid,this.processGid)}[Vi](e,t){let r=e.mode&4095||this.fmode,n=new mt.WriteStream(e.absolute,{flags:lu(e.size),mode:r,autoClose:!1});n.on("error",(a)=>this[le](a,e));let o=1,i=(a)=>{if(a)return this[le](a,e);if(--o===0)m.default.close(n.fd,(c)=>{t(),c?this[le](c,e):this[Wt]()})};n.on("finish",(a)=>{let c=e.absolute,l=n.fd;if(e.mtime&&!this.noMtime){o++;let u=e.atime||new Date,f=e.mtime;m.default.futimes(l,u,f,(h)=>h?m.default.utimes(c,u,f,(d)=>i(d&&h)):i())}if(this[Rr](e)){o++;let u=this[Tr](e),f=this[Nr](e);m.default.fchown(l,u,f,(h)=>h?m.default.chown(c,u,f,(d)=>i(d&&h)):i())}i()});let s=this.transform?this.transform(e)||e:e;if(s!==e)s.on("error",(a)=>this[le](a,e)),e.pipe(s);s.pipe(n)}[Gi](e,t){let r=e.mode&4095||this.dmode;this[Qt](e.absolute,r,(n)=>{if(n)return t(),this[le](n,e);let o=1,i=(s)=>{if(--o===0)t(),this[Wt](),e.resume()};if(e.mtime&&!this.noMtime)o++,m.default.utimes(e.absolute,e.atime||new Date,e.mtime,i);if(this[Rr](e))o++,m.default.chown(e.absolute,this[Tr](e),this[Nr](e),i);i()})}[cc](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[sc](e,t){this[Dn](e,e.linkpath,"symlink",t)}[ac](e,t){this[Dn](e,v.default.resolve(this.cwd,e.linkpath),"link",t)}[lc](){this[Sn]++}[Wt](){this[Sn]--,this[ui]()}[Wi](e){this[Wt](),e.resume()}[Ui](e,t){return e.type==="File"&&!this.unlink&&t.isFile()&&t.nlink<=1&&process.platform!=="win32"}[Bi](e){this[lc]();let t=[e.path];if(e.linkpath)t.push(e.linkpath);this.reservations.reserve(t,(r)=>this[ic](e,r))}[ic](e,t){this[Qt](v.default.dirname(e.absolute),this.dmode,(r)=>{if(r)return t(),this[le](r,e);m.default.lstat(e.absolute,(n,o)=>{if(o&&(this.keep||this.newer&&o.mtime>e.mtime))this[Wi](e),t();else if(n||this[Ui](e,o))this[Ye](null,e,t);else if(o.isDirectory())if(e.type==="Directory")if(!this.noChmod&&(!e.mode||(o.mode&4095)===e.mode))this[Ye](null,e,t);else m.default.chmod(e.absolute,e.mode,(i)=>this[Ye](i,e,t));else m.default.rmdir(e.absolute,(i)=>this[Ye](i,e,t));else ky(e.absolute,(i)=>this[Ye](i,e,t))})})}[Ye](e,t,r){if(e)return this[le](e,t);switch(t.type){case"File":case"OldFile":case"ContiguousFile":return this[Vi](t,r);case"Link":return this[ac](t,r);case"SymbolicLink":return this[sc](t,r);case"Directory":case"GNUDumpDir":return this[Gi](t,r)}}[Dn](e,t,r,n){m.default[r](t,e.absolute,(o)=>{if(o)return this[le](o,e);n(),this[Wt](),e.resume()})}}class fu extends to{[Bi](e){let t=this[Qt](v.default.dirname(e.absolute),this.dmode,kn);if(t)return this[le](t,e);try{let r=m.default.lstatSync(e.absolute);if(this.keep||this.newer&&r.mtime>e.mtime)return this[Wi](e);else if(this[Ui](e,r))return this[Ye](null,e,kn);else try{if(r.isDirectory())if(e.type==="Directory"){if(!this.noChmod&&e.mode&&(r.mode&4095)!==e.mode)m.default.chmodSync(e.absolute,e.mode)}else m.default.rmdirSync(e.absolute);else Ey(e.absolute);return this[Ye](null,e,kn)}catch(n){return this[le](n,e)}}catch(r){return this[Ye](null,e,kn)}}[Vi](e,t){let r=e.mode&4095||this.fmode,n=(s)=>{let a;try{m.default.closeSync(o)}catch(c){a=c}if(s||a)this[le](s||a,e)},o;try{o=m.default.openSync(e.absolute,lu(e.size),r)}catch(s){return n(s)}let i=this.transform?this.transform(e)||e:e;if(i!==e)i.on("error",(s)=>this[le](s,e)),e.pipe(i);i.on("data",(s)=>{try{m.default.writeSync(o,s,0,s.length)}catch(a){n(a)}}),i.on("end",(s)=>{let a=null;if(e.mtime&&!this.noMtime){let c=e.atime||new Date,l=e.mtime;try{m.default.futimesSync(o,c,l)}catch(u){try{m.default.utimesSync(e.absolute,c,l)}catch(f){a=u}}}if(this[Rr](e)){let c=this[Tr](e),l=this[Nr](e);try{m.default.fchownSync(o,c,l)}catch(u){try{m.default.chownSync(e.absolute,c,l)}catch(f){a=a||u}}}n(a)})}[Gi](e,t){let r=e.mode&4095||this.dmode,n=this[Qt](e.absolute,r);if(n)return this[le](n,e);if(e.mtime&&!this.noMtime)try{m.default.utimesSync(e.absolute,e.atime||new Date,e.mtime)}catch(o){}if(this[Rr](e))try{m.default.chownSync(e.absolute,this[Tr](e),this[Nr](e))}catch(o){}e.resume()}[Qt](e,t){try{return ms.sync(e,{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:t})}catch(r){return r}}[Dn](e,t,r,n){try{m.default[r+"Sync"](t,e.absolute),e.resume()}catch(o){return this[le](o,e)}}}to.Sync=fu;var Hr=to,xy=(e,t,r)=>{if(typeof e==="function")r=e,t=null,e={};else if(Array.isArray(e))t=e,e={};if(typeof t==="function")r=t,t=null;if(!t)t=[];else t=Array.from(t);let n=Gr(e);if(n.sync&&typeof r==="function")throw TypeError("callback not supported for sync tar functions");if(!n.file&&typeof r==="function")throw TypeError("callback only supported with file option");if(t.length)Oy(n,t);return n.file&&n.sync?Iy(n):n.file?zy(n,r):n.sync?Ay(n):Py(n)},Oy=(e,t)=>{let r=new Map(t.map((i)=>[i.replace(/\/+$/,""),!0])),n=e.filter,o=(i,s)=>{let a=s||v.default.parse(i).root||".",c=i===a?!1:r.has(i)?r.get(i):o(v.default.dirname(i),a);return r.set(i,c),c};e.filter=n?(i,s)=>n(i,s)&&o(i.replace(/\/+$/,"")):(i)=>o(i.replace(/\/+$/,""))},Iy=(e)=>{let t=new Hr.Sync(e),r=e.file,n=m.default.statSync(r),o=e.maxReadSize||16777216;new mt.ReadStreamSync(r,{readSize:o,size:n.size}).pipe(t)},zy=(e,t)=>{let r=new Hr(e),n=e.maxReadSize||16777216,o=e.file,i=new Promise((s,a)=>{r.on("error",a),r.on("close",s),m.default.stat(o,(c,l)=>{if(c)a(c);else{let u=new mt.ReadStream(o,{readSize:n,size:l.size});u.on("error",a),u.pipe(r)}})});return t?i.then(t,t):i},Ay=(e)=>new Hr.Sync(e),Py=(e)=>new Hr(e),Cy=Ce(function(e,t){t.c=t.create=zg,t.r=t.replace=Uc,t.t=t.list=Wr,t.u=t.update=Zg,t.x=t.extract=xy,t.Pack=Tt,t.Unpack=Hr,t.Parse=eo,t.ReadEntry=as,t.WriteEntry=Qn,t.Header=Rt,t.Pax=Lr,t.types=On}),Fr={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},hu={};for(let e of Object.keys(Fr))hu[Fr[e]]=e;var k={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}},At=k;for(let e of Object.keys(k)){if(!("channels"in k[e]))throw Error("missing channels property: "+e);if(!("labels"in k[e]))throw Error("missing channel labels property: "+e);if(k[e].labels.length!==k[e].channels)throw Error("channel and label counts mismatch: "+e);let{channels:t,labels:r}=k[e];delete k[e].channels,delete k[e].labels,Object.defineProperty(k[e],"channels",{value:t}),Object.defineProperty(k[e],"labels",{value:r})}k.rgb.hsl=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.min(t,r,n),i=Math.max(t,r,n),s=i-o,a,c;if(i===o)a=0;else if(t===i)a=(r-n)/s;else if(r===i)a=2+(n-t)/s;else if(n===i)a=4+(t-r)/s;if(a=Math.min(a*60,360),a<0)a+=360;let l=(o+i)/2;if(i===o)c=0;else if(l<=0.5)c=s/(i+o);else c=s/(2-i-o);return[a,c*100,l*100]};k.rgb.hsv=function(e){let t,r,n,o,i,s=e[0]/255,a=e[1]/255,c=e[2]/255,l=Math.max(s,a,c),u=l-Math.min(s,a,c),f=function(h){return(l-h)/6/u+0.5};if(u===0)o=0,i=0;else{if(i=u/l,t=f(s),r=f(a),n=f(c),s===l)o=n-r;else if(a===l)o=0.3333333333333333+t-n;else if(c===l)o=0.6666666666666666+r-t;if(o<0)o+=1;else if(o>1)o-=1}return[o*360,i*100,l*100]};k.rgb.hwb=function(e){let t=e[0],r=e[1],n=e[2],o=k.rgb.hsl(e)[0],i=0.00392156862745098*Math.min(t,Math.min(r,n));return n=1-0.00392156862745098*Math.max(t,Math.max(r,n)),[o,i*100,n*100]};k.rgb.cmyk=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.min(1-t,1-r,1-n),i=(1-t-o)/(1-o)||0,s=(1-r-o)/(1-o)||0,a=(1-n-o)/(1-o)||0;return[i*100,s*100,a*100,o*100]};function Ry(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}k.rgb.keyword=function(e){let t=hu[e];if(t)return t;let r=1/0,n;for(let o of Object.keys(Fr)){let i=Fr[o],s=Ry(e,i);if(s<r)r=s,n=o}return n};k.keyword.rgb=function(e){return Fr[e]};k.rgb.xyz=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255;t=t>0.04045?((t+0.055)/1.055)**2.4:t/12.92,r=r>0.04045?((r+0.055)/1.055)**2.4:r/12.92,n=n>0.04045?((n+0.055)/1.055)**2.4:n/12.92;let o=t*0.4124+r*0.3576+n*0.1805,i=t*0.2126+r*0.7152+n*0.0722,s=t*0.0193+r*0.1192+n*0.9505;return[o*100,i*100,s*100]};k.rgb.lab=function(e){let t=k.rgb.xyz(e),r=t[0],n=t[1],o=t[2];r/=95.047,n/=100,o/=108.883,r=r>0.008856?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>0.008856?n**0.3333333333333333:7.787*n+0.13793103448275862,o=o>0.008856?o**0.3333333333333333:7.787*o+0.13793103448275862;let i=116*n-16,s=500*(r-n),a=200*(n-o);return[i,s,a]};k.hsl.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,o,i,s;if(r===0)return s=n*255,[s,s,s];if(n<0.5)o=n*(1+r);else o=n+r-n*r;let a=2*n-o,c=[0,0,0];for(let l=0;l<3;l++){if(i=t+0.3333333333333333*-(l-1),i<0)i++;if(i>1)i--;if(6*i<1)s=a+(o-a)*6*i;else if(2*i<1)s=o;else if(3*i<2)s=a+(o-a)*(0.6666666666666666-i)*6;else s=a;c[l]=s*255}return c};k.hsl.hsv=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,o=r,i=Math.max(n,0.01);n*=2,r*=n<=1?n:2-n,o*=i<=1?i:2-i;let s=(n+r)/2,a=n===0?2*o/(i+o):2*r/(n+r);return[t,a*100,s*100]};k.hsv.rgb=function(e){let t=e[0]/60,r=e[1]/100,n=e[2]/100,o=Math.floor(t)%6,i=t-Math.floor(t),s=255*n*(1-r),a=255*n*(1-r*i),c=255*n*(1-r*(1-i));switch(n*=255,o){case 0:return[n,c,s];case 1:return[a,n,s];case 2:return[s,n,c];case 3:return[s,a,n];case 4:return[c,s,n];case 5:return[n,s,a]}};k.hsv.hsl=function(e){let t=e[0],r=e[1]/100,n=e[2]/100,o=Math.max(n,0.01),i,s;s=(2-r)*n;let a=(2-r)*o;return i=r*o,i/=a<=1?a:2-a,i=i||0,s/=2,[t,i*100,s*100]};k.hwb.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100,o=r+n,i;if(o>1)r/=o,n/=o;let s=Math.floor(6*t),a=1-n;if(i=6*t-s,(s&1)!==0)i=1-i;let c=r+i*(a-r),l,u,f;switch(s){default:case 6:case 0:l=a,u=c,f=r;break;case 1:l=c,u=a,f=r;break;case 2:l=r,u=a,f=c;break;case 3:l=r,u=c,f=a;break;case 4:l=c,u=r,f=a;break;case 5:l=a,u=r,f=c;break}return[l*255,u*255,f*255]};k.cmyk.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,o=e[3]/100,i=1-Math.min(1,t*(1-o)+o),s=1-Math.min(1,r*(1-o)+o),a=1-Math.min(1,n*(1-o)+o);return[i*255,s*255,a*255]};k.xyz.rgb=function(e){let t=e[0]/100,r=e[1]/100,n=e[2]/100,o,i,s;return o=t*3.2406+r*-1.5372+n*-0.4986,i=t*-0.9689+r*1.8758+n*0.0415,s=t*0.0557+r*-0.204+n*1.057,o=o>0.0031308?1.055*o**0.4166666666666667-0.055:o*12.92,i=i>0.0031308?1.055*i**0.4166666666666667-0.055:i*12.92,s=s>0.0031308?1.055*s**0.4166666666666667-0.055:s*12.92,o=Math.min(Math.max(0,o),1),i=Math.min(Math.max(0,i),1),s=Math.min(Math.max(0,s),1),[o*255,i*255,s*255]};k.xyz.lab=function(e){let t=e[0],r=e[1],n=e[2];t/=95.047,r/=100,n/=108.883,t=t>0.008856?t**0.3333333333333333:7.787*t+0.13793103448275862,r=r>0.008856?r**0.3333333333333333:7.787*r+0.13793103448275862,n=n>0.008856?n**0.3333333333333333:7.787*n+0.13793103448275862;let o=116*r-16,i=500*(t-r),s=200*(r-n);return[o,i,s]};k.lab.xyz=function(e){let t=e[0],r=e[1],n=e[2],o,i,s;i=(t+16)/116,o=r/500+i,s=i-n/200;let a=i**3,c=o**3,l=s**3;return i=a>0.008856?a:(i-0.13793103448275862)/7.787,o=c>0.008856?c:(o-0.13793103448275862)/7.787,s=l>0.008856?l:(s-0.13793103448275862)/7.787,o*=95.047,i*=100,s*=108.883,[o,i,s]};k.lab.lch=function(e){let t=e[0],r=e[1],n=e[2],o;if(o=Math.atan2(n,r)*360/2/Math.PI,o<0)o+=360;let s=Math.sqrt(r*r+n*n);return[t,s,o]};k.lch.lab=function(e){let t=e[0],r=e[1],o=e[2]/360*2*Math.PI,i=r*Math.cos(o),s=r*Math.sin(o);return[t,i,s]};k.rgb.ansi16=function(e,t=null){let[r,n,o]=e,i=t===null?k.rgb.hsv(e)[2]:t;if(i=Math.round(i/50),i===0)return 30;let s=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(r/255));if(i===2)s+=60;return s};k.hsv.ansi16=function(e){return k.rgb.ansi16(k.hsv.rgb(e),e[2])};k.rgb.ansi256=function(e){let t=e[0],r=e[1],n=e[2];if(t===r&&r===n){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)};k.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7){if(e>50)t+=3.5;return t=t/10.5*255,[t,t,t]}let r=(~~(e>50)+1)*0.5,n=(t&1)*r*255,o=(t>>1&1)*r*255,i=(t>>2&1)*r*255;return[n,o,i]};k.ansi256.rgb=function(e){if(e>=232){let i=(e-232)*10+8;return[i,i,i]}e-=16;let t,r=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,o=t%6/5*255;return[r,n,o]};k.rgb.hex=function(e){let r=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(r.length)+r};k.hex.rgb=function(e){let t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let r=t[0];if(t[0].length===3)r=r.split("").map((a)=>a+a).join("");let n=parseInt(r,16),o=n>>16&255,i=n>>8&255,s=n&255;return[o,i,s]};k.rgb.hcg=function(e){let t=e[0]/255,r=e[1]/255,n=e[2]/255,o=Math.max(Math.max(t,r),n),i=Math.min(Math.min(t,r),n),s=o-i,a,c;if(s<1)a=i/(1-s);else a=0;if(s<=0)c=0;else if(o===t)c=(r-n)/s%6;else if(o===r)c=2+(n-t)/s;else c=4+(t-r)/s;return c/=6,c%=1,[c*360,s*100,a*100]};k.hsl.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=r<0.5?2*t*r:2*t*(1-r),o=0;if(n<1)o=(r-0.5*n)/(1-n);return[e[0],n*100,o*100]};k.hsv.hcg=function(e){let t=e[1]/100,r=e[2]/100,n=t*r,o=0;if(n<1)o=(r-n)/(1-n);return[e[0],n*100,o*100]};k.hcg.rgb=function(e){let t=e[0]/360,r=e[1]/100,n=e[2]/100;if(r===0)return[n*255,n*255,n*255];let o=[0,0,0],i=t%1*6,s=i%1,a=1-s,c=0;switch(Math.floor(i)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=a,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=a,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=a}return c=(1-r)*n,[(r*o[0]+c)*255,(r*o[1]+c)*255,(r*o[2]+c)*255]};k.hcg.hsv=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t),o=0;if(n>0)o=t/n;return[e[0],o*100,n*100]};k.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+0.5*t,o=0;if(n>0&&n<0.5)o=t/(2*n);else if(n>=0.5&&n<1)o=t/(2*(1-n));return[e[0],o*100,n*100]};k.hcg.hwb=function(e){let t=e[1]/100,r=e[2]/100,n=t+r*(1-t);return[e[0],(n-t)*100,(1-n)*100]};k.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,o=n-t,i=0;if(o<1)i=(n-o)/(1-o);return[e[0],o*100,i*100]};k.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};k.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};k.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};k.gray.hsl=function(e){return[0,0,e[0]]};k.gray.hsv=k.gray.hsl;k.gray.hwb=function(e){return[0,100,e[0]]};k.gray.cmyk=function(e){return[0,0,0,e[0]]};k.gray.lab=function(e){return[e[0],0,0]};k.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n};k.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]};function Ty(){let e={},t=Object.keys(At);for(let r=t.length,n=0;n<r;n++)e[t[n]]={distance:-1,parent:null};return e}function Ny(e){let t=Ty(),r=[e];t[e].distance=0;while(r.length){let n=r.pop(),o=Object.keys(At[n]);for(let i=o.length,s=0;s<i;s++){let a=o[s],c=t[a];if(c.distance===-1)c.distance=t[n].distance+1,c.parent=n,r.unshift(a)}}return t}function Dy(e,t){return function(r){return t(e(r))}}function Ly(e,t){let r=[t[e].parent,e],n=At[t[e].parent][e],o=t[e].parent;while(t[o].parent)r.unshift(t[o].parent),n=Dy(At[t[o].parent][o],n),o=t[o].parent;return n.conversion=r,n}var Zy=function(e){let t=Ny(e),r={},n=Object.keys(t);for(let o=n.length,i=0;i<o;i++){let s=n[i];if(t[s].parent===null)continue;r[s]=Ly(s,t)}return r},Kt={},Fy=Object.keys(At);function My(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;return e(r)};if("conversion"in e)t.conversion=e.conversion;return t}function jy(e){let t=function(...r){let n=r[0];if(n===void 0||n===null)return n;if(n.length>1)r=n;let o=e(r);if(typeof o==="object")for(let i=o.length,s=0;s<i;s++)o[s]=Math.round(o[s]);return o};if("conversion"in e)t.conversion=e.conversion;return t}Fy.forEach((e)=>{Kt[e]={},Object.defineProperty(Kt[e],"channels",{value:At[e].channels}),Object.defineProperty(Kt[e],"labels",{value:At[e].labels});let t=Zy(e);Object.keys(t).forEach((n)=>{let o=t[n];Kt[e][n]=jy(o),Kt[e][n].raw=My(o)})});var By=Kt,Mr=Ce(function(e){let t=(u,f)=>(...h)=>`\x1B[${u(...h)+f}m`,r=(u,f)=>(...h)=>{let d=u(...h);return`\x1B[${38+f};5;${d}m`},n=(u,f)=>(...h)=>{let d=u(...h);return`\x1B[${38+f};2;${d[0]};${d[1]};${d[2]}m`},o=(u)=>u,i=(u,f,h)=>[u,f,h],s=(u,f,h)=>{Object.defineProperty(u,f,{get:()=>{let d=h();return Object.defineProperty(u,f,{value:d,enumerable:!0,configurable:!0}),d},enumerable:!0,configurable:!0})},a,c=(u,f,h,d)=>{if(a===void 0)a=By;let p=d?10:0,g={};for(let[y,b]of Object.entries(a)){let S=y==="ansi16"?"ansi":y;if(y===f)g[S]=u(h,p);else if(typeof b==="object")g[S]=u(b[f],p)}return g};function l(){let u=new Map,f={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};f.color.gray=f.color.blackBright,f.bgColor.bgGray=f.bgColor.bgBlackBright,f.color.grey=f.color.blackBright,f.bgColor.bgGrey=f.bgColor.bgBlackBright;for(let[h,d]of Object.entries(f)){for(let[p,g]of Object.entries(d))f[p]={open:`\x1B[${g[0]}m`,close:`\x1B[${g[1]}m`},d[p]=f[p],u.set(g[0],g[1]);Object.defineProperty(f,h,{value:d,enumerable:!1})}return Object.defineProperty(f,"codes",{value:u,enumerable:!1}),f.color.close="\x1B[39m",f.bgColor.close="\x1B[49m",s(f.color,"ansi",()=>c(t,"ansi16",o,!1)),s(f.color,"ansi256",()=>c(r,"ansi256",o,!1)),s(f.color,"ansi16m",()=>c(n,"rgb",i,!1)),s(f.bgColor,"ansi",()=>c(t,"ansi16",o,!0)),s(f.bgColor,"ansi256",()=>c(r,"ansi256",o,!0)),s(f.bgColor,"ansi16m",()=>c(n,"rgb",i,!0)),f}Object.defineProperty(e,"exports",{enumerable:!0,get:l})}),xe=(e,t=process.argv)=>{let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),o=t.indexOf("--");return n!==-1&&(o===-1||n<o)},{env:ee}=process,ft;if(xe("no-color")||xe("no-colors")||xe("color=false")||xe("color=never"))ft=0;else if(xe("color")||xe("colors")||xe("color=true")||xe("color=always"))ft=1;if("FORCE_COLOR"in ee)if(ee.FORCE_COLOR==="true")ft=1;else if(ee.FORCE_COLOR==="false")ft=0;else ft=ee.FORCE_COLOR.length===0?1:Math.min(parseInt(ee.FORCE_COLOR,10),3);function Hi(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function qi(e,t){if(ft===0)return 0;if(xe("color=16m")||xe("color=full")||xe("color=truecolor"))return 3;if(xe("color=256"))return 2;if(e&&!t&&ft===void 0)return 0;let r=ft||0;if(ee.TERM==="dumb")return r;if(process.platform==="win32"){let n=Si.default.release().split(".");if(Number(n[0])>=10&&Number(n[2])>=10586)return Number(n[2])>=14931?3:2;return 1}if("CI"in ee){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((n)=>(n in ee))||ee.CI_NAME==="codeship")return 1;return r}if("TEAMCITY_VERSION"in ee)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(ee.TEAMCITY_VERSION)?1:0;if(ee.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in ee){let n=parseInt((ee.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(ee.TERM_PROGRAM){case"iTerm.app":return n>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(ee.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(ee.TERM))return 1;if("COLORTERM"in ee)return 1;return r}function Uy(e){let t=qi(e,e&&e.isTTY);return Hi(t)}var du={supportsColor:Uy,stdout:Hi(qi(!0,ki.default.isatty(1))),stderr:Hi(qi(!0,ki.default.isatty(2)))},Vy=(e,t,r)=>{let n=e.indexOf(t);if(n===-1)return e;let o=t.length,i=0,s="";do s+=e.substr(i,n-i)+t+r,i=n+o,n=e.indexOf(t,i);while(n!==-1);return s+=e.substr(i),s},Gy=(e,t,r,n)=>{let o=0,i="";do{let s=e[n-1]==="\r";i+=e.substr(o,(s?n-1:n)-o)+t+(s?`\r
|
|
6
|
+
`:`
|
|
7
|
+
`)+r,o=n+1,n=e.indexOf(`
|
|
8
|
+
`,o)}while(n!==-1);return i+=e.substr(o),i},Wy={stringReplaceAll:Vy,stringEncaseCRLFWithFirstIndex:Gy},Hy=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,hc=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,qy=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,Ky=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,Jy=new Map([["n",`
|
|
9
|
+
`],["r","\r"],["t","\t"],["b","\b"],["f","\f"],["v","\v"],["0","\x00"],["\\","\\"],["e","\x1B"],["a","\x07"]]);function pu(e){let t=e[0]==="u",r=e[1]==="{";if(t&&!r&&e.length===5||e[0]==="x"&&e.length===3)return String.fromCharCode(parseInt(e.slice(1),16));if(t&&r)return String.fromCodePoint(parseInt(e.slice(2,-1),16));return Jy.get(e)||e}function Yy(e,t){let r=[],n=t.trim().split(/\s*,\s*/g),o;for(let i of n){let s=Number(i);if(!Number.isNaN(s))r.push(s);else if(o=i.match(qy))r.push(o[2].replace(Ky,(a,c,l)=>c?pu(c):l));else throw Error(`Invalid Chalk template style argument: ${i} (in style '${e}')`)}return r}function Xy(e){hc.lastIndex=0;let t=[],r;while((r=hc.exec(e))!==null){let n=r[1];if(r[2]){let o=Yy(n,r[2]);t.push([n].concat(o))}else t.push([n])}return t}function dc(e,t){let r={};for(let o of t)for(let i of o.styles)r[i[0]]=o.inverse?null:i.slice(1);let n=e;for(let[o,i]of Object.entries(r)){if(!Array.isArray(i))continue;if(!(o in n))throw Error(`Unknown Chalk style: ${o}`);n=i.length>0?n[o](...i):n[o]}return n}var Qy=(e,t)=>{let r=[],n=[],o=[];if(t.replace(Hy,(i,s,a,c,l,u)=>{if(s)o.push(pu(s));else if(c){let f=o.join("");o=[],n.push(r.length===0?f:dc(e,r)(f)),r.push({inverse:a,styles:Xy(c)})}else if(l){if(r.length===0)throw Error("Found extraneous } in Chalk template literal");n.push(dc(e,r)(o.join(""))),o=[],r.pop()}else o.push(u)}),n.push(o.join("")),r.length>0){let i=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?"":"s"} (\`}\`)`;throw Error(i)}return n.join("")},{stdout:Ki,stderr:Ji}=du,{stringReplaceAll:e_,stringEncaseCRLFWithFirstIndex:t_}=Wy,{isArray:Wn}=Array,mu=["ansi","ansi","ansi256","ansi16m"],hr=Object.create(null),r_=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let r=Ki?Ki.level:0;e.level=t.level===void 0?r:t.level};class gu{constructor(e){return yu(e)}}var yu=(e)=>{let t={};return r_(t,e),t.template=(...r)=>wu(t.template,...r),Object.setPrototypeOf(t,ro.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=()=>{throw Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},t.template.Instance=gu,t.template};function ro(e){return yu(e)}for(let[e,t]of Object.entries(Mr))hr[e]={get(){let r=no(this,gs(t.open,t.close,this._styler),this._isEmpty);return Object.defineProperty(this,e,{value:r}),r}};hr.visible={get(){let e=no(this,this._styler,!0);return Object.defineProperty(this,"visible",{value:e}),e}};var _u=["rgb","hex","keyword","hsl","hsv","hwb","ansi","ansi256"];for(let e of _u)hr[e]={get(){let{level:t}=this;return function(...r){let n=gs(Mr.color[mu[t]][e](...r),Mr.color.close,this._styler);return no(this,n,this._isEmpty)}}};for(let e of _u){let t="bg"+e[0].toUpperCase()+e.slice(1);hr[t]={get(){let{level:r}=this;return function(...n){let o=gs(Mr.bgColor[mu[r]][e](...n),Mr.bgColor.close,this._styler);return no(this,o,this._isEmpty)}}}}var n_=Object.defineProperties(()=>{},{...hr,level:{enumerable:!0,get(){return this._generator.level},set(e){this._generator.level=e}}}),gs=(e,t,r)=>{let n,o;if(r===void 0)n=e,o=t;else n=r.openAll+e,o=t+r.closeAll;return{open:e,close:t,openAll:n,closeAll:o,parent:r}},no=(e,t,r)=>{let n=(...o)=>{if(Wn(o[0])&&Wn(o[0].raw))return pc(n,wu(n,...o));return pc(n,o.length===1?""+o[0]:o.join(" "))};return Object.setPrototypeOf(n,n_),n._generator=e,n._styler=t,n._isEmpty=r,n},pc=(e,t)=>{if(e.level<=0||!t)return e._isEmpty?"":t;let r=e._styler;if(r===void 0)return t;let{openAll:n,closeAll:o}=r;if(t.indexOf("\x1B")!==-1)while(r!==void 0)t=e_(t,r.close,r.open),r=r.parent;let i=t.indexOf(`
|
|
10
|
+
`);if(i!==-1)t=t_(t,o,n,i);return n+t+o},li,wu=(e,...t)=>{let[r]=t;if(!Wn(r)||!Wn(r.raw))return t.join(" ");let n=t.slice(1),o=[r.raw[0]];for(let i=1;i<r.length;i++)o.push(String(n[i-1]).replace(/[{}\\]/g,"\\$&"),String(r.raw[i]));if(li===void 0)li=Qy;return li(e,o.join(""))};Object.defineProperties(ro.prototype,hr);var oo=ro();oo.supportsColor=Ki;oo.stderr=ro({level:Ji?Ji.level:0});oo.stderr.supportsColor=Ji;var Je=oo,Nt=o_(m.default);function o_(e){if(e===null||typeof e!=="object")return e;if(e instanceof Object)var t={__proto__:e.__proto__};else var t=Object.create(null);return Object.getOwnPropertyNames(e).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r))}),t}var i_=process.cwd,Ln=null,s_=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!Ln)Ln=i_.call(process);return Ln};try{process.cwd()}catch(e){}var a_=process.chdir;process.chdir=function(e){Ln=null,a_.call(process,e)};var c_=u_;function u_(e){if(ct.default.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))l_(e);if(!e.lutimes)f_(e);if(e.chown=di(e.chown),e.fchown=di(e.fchown),e.lchown=di(e.lchown),e.chmod=fi(e.chmod),e.fchmod=fi(e.fchmod),e.lchmod=fi(e.lchmod),e.chownSync=pi(e.chownSync),e.fchownSync=pi(e.fchownSync),e.lchownSync=pi(e.lchownSync),e.chmodSync=hi(e.chmodSync),e.fchmodSync=hi(e.fchmodSync),e.lchmodSync=hi(e.lchmodSync),e.stat=mi(e.stat),e.fstat=mi(e.fstat),e.lstat=mi(e.lstat),e.statSync=gi(e.statSync),e.fstatSync=gi(e.fstatSync),e.lstatSync=gi(e.lstatSync),!e.lchmod)e.lchmod=function(t,r,n){if(n)process.nextTick(n)},e.lchmodSync=function(){};if(!e.lchown)e.lchown=function(t,r,n,o){if(o)process.nextTick(o)},e.lchownSync=function(){};if(s_==="win32")e.rename=function(t){return function(r,n,o){var i=Date.now(),s=0;t(r,n,function a(c){if(c&&(c.code==="EACCES"||c.code==="EPERM")&&Date.now()-i<60000){if(setTimeout(function(){e.stat(n,function(l,u){if(l&&l.code==="ENOENT")t(r,n,a);else o(c)})},s),s<100)s+=10;return}if(o)o(c)})}}(e.rename);e.read=function(t){return function(r,n,o,i,s,a){var c;if(a&&typeof a==="function"){var l=0;c=function(u,f,h){if(u&&u.code==="EAGAIN"&&l<10)return l++,t.call(e,r,n,o,i,s,c);a.apply(this,arguments)}}return t.call(e,r,n,o,i,s,c)}}(e.read),e.readSync=function(t){return function(r,n,o,i,s){var a=0;while(!0)try{return t.call(e,r,n,o,i,s)}catch(c){if(c.code==="EAGAIN"&&a<10){a++;continue}throw c}}}(e.readSync)}function l_(e){e.lchmod=function(t,r,n){e.open(t,ct.default.O_WRONLY|ct.default.O_SYMLINK,r,function(o,i){if(o){if(n)n(o);return}e.fchmod(i,r,function(s){e.close(i,function(a){if(n)n(s||a)})})})},e.lchmodSync=function(t,r){var n=e.openSync(t,ct.default.O_WRONLY|ct.default.O_SYMLINK,r),o=!0,i;try{i=e.fchmodSync(n,r),o=!1}finally{if(o)try{e.closeSync(n)}catch(s){}else e.closeSync(n)}return i}}function f_(e){if(ct.default.hasOwnProperty("O_SYMLINK"))e.lutimes=function(t,r,n,o){e.open(t,ct.default.O_SYMLINK,function(i,s){if(i){if(o)o(i);return}e.futimes(s,r,n,function(a){e.close(s,function(c){if(o)o(a||c)})})})},e.lutimesSync=function(t,r,n){var o=e.openSync(t,ct.default.O_SYMLINK),i,s=!0;try{i=e.futimesSync(o,r,n),s=!1}finally{if(s)try{e.closeSync(o)}catch(a){}else e.closeSync(o)}return i};else e.lutimes=function(t,r,n,o){if(o)process.nextTick(o)},e.lutimesSync=function(){}}function fi(e){if(!e)return e;return function(t,r,n){return e.call(Nt,t,r,function(o){if(io(o))o=null;if(n)n.apply(this,arguments)})}}function hi(e){if(!e)return e;return function(t,r){try{return e.call(Nt,t,r)}catch(n){if(!io(n))throw n}}}function di(e){if(!e)return e;return function(t,r,n,o){return e.call(Nt,t,r,n,function(i){if(io(i))i=null;if(o)o.apply(this,arguments)})}}function pi(e){if(!e)return e;return function(t,r,n){try{return e.call(Nt,t,r,n)}catch(o){if(!io(o))throw o}}}function mi(e){if(!e)return e;return function(t,r){return e.call(Nt,t,function(n,o){if(!o)return r.apply(this,arguments);if(o.uid<0)o.uid+=4294967296;if(o.gid<0)o.gid+=4294967296;if(r)r.apply(this,arguments)})}}function gi(e){if(!e)return e;return function(t){var r=e.call(Nt,t);if(r.uid<0)r.uid+=4294967296;if(r.gid<0)r.gid+=4294967296;return r}}function io(e){if(!e)return!0;if(e.code==="ENOSYS")return!0;var t=!process.getuid||process.getuid()!==0;if(t){if(e.code==="EINVAL"||e.code==="EPERM")return!0}return!1}var mc=bi.default.Stream,h_=d_;function d_(e){return{ReadStream:t,WriteStream:r};function t(n,o){if(!(this instanceof t))return new t(n,o);mc.call(this);var i=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,o=o||{};var s=Object.keys(o);for(var a=0,c=s.length;a<c;a++){var l=s[a];this[l]=o[l]}if(this.encoding)this.setEncoding(this.encoding);if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!=="number")throw TypeError("end must be a Number");if(this.start>this.end)throw Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){i._read()});return}e.open(this.path,this.flags,this.mode,function(u,f){if(u){i.emit("error",u),i.readable=!1;return}i.fd=f,i.emit("open",f),i._read()})}function r(n,o){if(!(this instanceof r))return new r(n,o);mc.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,o=o||{};var i=Object.keys(o);for(var s=0,a=i.length;s<a;s++){var c=i[s];this[c]=o[c]}if(this.start!==void 0){if(typeof this.start!=="number")throw TypeError("start must be a Number");if(this.start<0)throw Error("start must be >= zero");this.pos=this.start}if(this.busy=!1,this._queue=[],this.fd===null)this._open=e.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}var Oe=Ce(function(e){var t=[];function r(){}var n=r;if(Fe.default.debuglog)n=Fe.default.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))n=function(){var a=Fe.default.format.apply(Fe.default,arguments);a="GFS4: "+a.split(/\n/).join(`
|
|
11
|
+
GFS4: `),console.error(a)};if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){n(t),O.default.equal(t.length,0)});if(e.exports=o(Nt),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH)e.exports=o(m.default);e.exports.close=m.default.close=function(a){return function(c,l){return a.call(m.default,c,function(u){if(!u)s();if(typeof l==="function")l.apply(this,arguments)})}}(m.default.close),e.exports.closeSync=m.default.closeSync=function(a){return function(c){var l=a.apply(m.default,arguments);return s(),l}}(m.default.closeSync);function o(a){c_(a),a.gracefulify=o,a.FileReadStream=z,a.FileWriteStream=x,a.createReadStream=ie,a.createWriteStream=oe;var c=a.readFile;a.readFile=l;function l(I,R,w){if(typeof R==="function")w=R,R=null;return T(I,R,w);function T(L,V,q){return c(L,V,function(Q){if(Q&&(Q.code==="EMFILE"||Q.code==="ENFILE"))i([T,[L,V,q]]);else{if(typeof q==="function")q.apply(this,arguments);s()}})}}var u=a.writeFile;a.writeFile=f;function f(I,R,w,T){if(typeof w==="function")T=w,w=null;return L(I,R,w,T);function L(V,q,Q,G){return u(V,q,Q,function(J){if(J&&(J.code==="EMFILE"||J.code==="ENFILE"))i([L,[V,q,Q,G]]);else{if(typeof G==="function")G.apply(this,arguments);s()}})}}var h=a.appendFile;if(h)a.appendFile=d;function d(I,R,w,T){if(typeof w==="function")T=w,w=null;return L(I,R,w,T);function L(V,q,Q,G){return h(V,q,Q,function(J){if(J&&(J.code==="EMFILE"||J.code==="ENFILE"))i([L,[V,q,Q,G]]);else{if(typeof G==="function")G.apply(this,arguments);s()}})}}var p=a.readdir;a.readdir=g;function g(I,R,w){var T=[I];if(typeof R!=="function")T.push(R);else w=R;return T.push(L),y(T);function L(V,q){if(q&&q.sort)q.sort();if(V&&(V.code==="EMFILE"||V.code==="ENFILE"))i([y,[T]]);else{if(typeof w==="function")w.apply(this,arguments);s()}}}function y(I){return p.apply(a,I)}if(process.version.substr(0,4)==="v0.8"){var b=h_(a);z=b.ReadStream,x=b.WriteStream}var S=a.ReadStream;z.prototype=Object.create(S.prototype),z.prototype.open=C;var N=a.WriteStream;x.prototype=Object.create(N.prototype),x.prototype.open=U,a.ReadStream=z,a.WriteStream=x;function z(I,R){if(this instanceof z)return S.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function C(){var I=this;he(I.path,I.flags,I.mode,function(R,w){if(R){if(I.autoClose)I.destroy();I.emit("error",R)}else I.fd=w,I.emit("open",w),I.read()})}function x(I,R){if(this instanceof x)return N.apply(this,arguments),this;else return x.apply(Object.create(x.prototype),arguments)}function U(){var I=this;he(I.path,I.flags,I.mode,function(R,w){if(R)I.destroy(),I.emit("error",R);else I.fd=w,I.emit("open",w)})}function ie(I,R){return new z(I,R)}function oe(I,R){return new x(I,R)}var ye=a.open;a.open=he;function he(I,R,w,T){if(typeof w==="function")T=w,w=null;return L(I,R,w,T);function L(V,q,Q,G){return ye(V,q,Q,function(J,se){if(J&&(J.code==="EMFILE"||J.code==="ENFILE"))i([L,[V,q,Q,G]]);else{if(typeof G==="function")G.apply(this,arguments);s()}})}}return a}function i(a){n("ENQUEUE",a[0].name,a[1]),t.push(a)}function s(){var a=t.shift();if(a)n("RETRY",a[0].name,a[1]),a[0].apply(null,a[1])}}),vu=parseInt("0777",8),p_=er.mkdirp=er.mkdirP=er;function er(e,t,r,n){if(typeof t==="function")r=t,t={};else if(!t||typeof t!=="object")t={mode:t};var o=t.mode,i=t.fs||m.default;if(o===void 0)o=vu&~process.umask();if(!n)n=null;var s=r||function(){};e=v.default.resolve(e),i.mkdir(e,o,function(a){if(!a)return n=n||e,s(null,n);switch(a.code){case"ENOENT":er(v.default.dirname(e),t,function(c,l){if(c)s(c,l);else er(e,t,s,l)});break;default:i.stat(e,function(c,l){if(c||!l.isDirectory())s(a,n);else s(null,n)});break}})}er.sync=function e(t,r,n){if(!r||typeof r!=="object")r={mode:r};var o=r.mode,i=r.fs||m.default;if(o===void 0)o=vu&~process.umask();if(!n)n=null;t=v.default.resolve(t);try{i.mkdirSync(t,o),n=n||t}catch(a){switch(a.code){case"ENOENT":n=e(v.default.dirname(t),r,n),e(t,r,n);break;default:var s;try{s=i.statSync(t)}catch(c){throw a}if(!s.isDirectory())throw a;break}}return n};var ht=process.platform==="win32",m_=process.env.NODE_DEBUG&&/fs/.test(process.env.NODE_DEBUG);function g_(){var e;if(m_){var t=Error();e=r}else e=n;return e;function r(o){if(o)t.message=o.message,o=t,n(o)}function n(o){if(o){if(process.throwDeprecation)throw o;else if(!process.noDeprecation){var i="fs: missing callback "+(o.stack||o.message);if(process.traceDeprecation)console.trace(i);else console.error(i)}}}}function y_(e){return typeof e==="function"?e:g_()}v.default.normalize;if(ht)Me=/(.*?)(?:[\/\\]+|$)/g;else Me=/(.*?)(?:[\/]+|$)/g;var Me;if(ht)dr=/^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;else dr=/^[\/]*/;var dr,__=function(t,r){if(t=v.default.resolve(t),r&&Object.prototype.hasOwnProperty.call(r,t))return r[t];var n=t,o={},i={},s,a,c,l;u();function u(){var y=dr.exec(t);if(s=y[0].length,a=y[0],c=y[0],l="",ht&&!i[c])m.default.lstatSync(c),i[c]=!0}while(s<t.length){Me.lastIndex=s;var f=Me.exec(t);if(l=a,a+=f[0],c=l+f[1],s=Me.lastIndex,i[c]||r&&r[c]===c)continue;var h;if(r&&Object.prototype.hasOwnProperty.call(r,c))h=r[c];else{var d=m.default.lstatSync(c);if(!d.isSymbolicLink()){if(i[c]=!0,r)r[c]=c;continue}var p=null;if(!ht){var g=d.dev.toString(32)+":"+d.ino.toString(32);if(o.hasOwnProperty(g))p=o[g]}if(p===null)m.default.statSync(c),p=m.default.readlinkSync(c);if(h=v.default.resolve(l,p),r)r[c]=h;if(!ht)o[g]=p}t=v.default.resolve(h,t.slice(s)),u()}if(r)r[n]=t;return t},w_=function(t,r,n){if(typeof n!=="function")n=y_(r),r=null;if(t=v.default.resolve(t),r&&Object.prototype.hasOwnProperty.call(r,t))return process.nextTick(n.bind(null,null,r[t]));var o=t,i={},s={},a,c,l,u;f();function f(){var y=dr.exec(t);if(a=y[0].length,c=y[0],l=y[0],u="",ht&&!s[l])m.default.lstat(l,function(b){if(b)return n(b);s[l]=!0,h()});else process.nextTick(h)}function h(){if(a>=t.length){if(r)r[o]=t;return n(null,t)}Me.lastIndex=a;var y=Me.exec(t);if(u=c,c+=y[0],l=u+y[1],a=Me.lastIndex,s[l]||r&&r[l]===l)return process.nextTick(h);if(r&&Object.prototype.hasOwnProperty.call(r,l))return g(r[l]);return m.default.lstat(l,d)}function d(y,b){if(y)return n(y);if(!b.isSymbolicLink()){if(s[l]=!0,r)r[l]=l;return process.nextTick(h)}if(!ht){var S=b.dev.toString(32)+":"+b.ino.toString(32);if(i.hasOwnProperty(S))return p(null,i[S],l)}m.default.stat(l,function(N){if(N)return n(N);m.default.readlink(l,function(z,C){if(!ht)i[S]=C;p(z,C)})})}function p(y,b,S){if(y)return n(y);var N=v.default.resolve(u,b);if(r)r[S]=N;g(N)}function g(y){t=v.default.resolve(y,t.slice(a)),f()}},bu={realpathSync:__,realpath:w_},$u=pt;pt.realpath=pt;pt.sync=ys;pt.realpathSync=ys;pt.monkeypatch=b_;pt.unmonkeypatch=$_;var Yi=m.default.realpath,Xi=m.default.realpathSync,v_=process.version,Su=/^v[0-5]\./.test(v_);function ku(e){return e&&e.syscall==="realpath"&&(e.code==="ELOOP"||e.code==="ENOMEM"||e.code==="ENAMETOOLONG")}function pt(e,t,r){if(Su)return Yi(e,t,r);if(typeof t==="function")r=t,t=null;Yi(e,t,function(n,o){if(ku(n))bu.realpath(e,t,r);else r(n,o)})}function ys(e,t){if(Su)return Xi(e,t);try{return Xi(e,t)}catch(r){if(ku(r))return bu.realpathSync(e,t);else throw r}}function b_(){m.default.realpath=pt,m.default.realpathSync=ys}function $_(){m.default.realpath=Yi,m.default.realpathSync=Xi}var S_=function(e,t){var r=[];for(var n=0;n<e.length;n++){var o=t(e[n],n);if(k_(o))r.push.apply(r,o);else r.push(o)}return r},k_=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"},Eu=xu;function xu(e,t,r){if(e instanceof RegExp)e=gc(e,r);if(t instanceof RegExp)t=gc(t,r);var n=Ou(e,t,r);return n&&{start:n[0],end:n[1],pre:r.slice(0,n[0]),body:r.slice(n[0]+e.length,n[1]),post:r.slice(n[1]+t.length)}}function gc(e,t){var r=t.match(e);return r?r[0]:null}xu.range=Ou;function Ou(e,t,r){var n,o,i,s,a,c=r.indexOf(e),l=r.indexOf(t,c+1),u=c;if(c>=0&&l>0){n=[],i=r.length;while(u>=0&&!a){if(u==c)n.push(u),c=r.indexOf(e,u+1);else if(n.length==1)a=[n.pop(),l];else{if(o=n.pop(),o<i)i=o,s=l;l=r.indexOf(t,u+1)}u=c<l&&c>=0?c:l}if(n.length)a=[i,s]}return a}var E_=I_,Iu="\x00SLASH"+Math.random()+"\x00",zu="\x00OPEN"+Math.random()+"\x00",_s="\x00CLOSE"+Math.random()+"\x00",Au="\x00COMMA"+Math.random()+"\x00",Pu="\x00PERIOD"+Math.random()+"\x00";function yi(e){return parseInt(e,10)==e?parseInt(e,10):e.charCodeAt(0)}function x_(e){return e.split("\\\\").join(Iu).split("\\{").join(zu).split("\\}").join(_s).split("\\,").join(Au).split("\\.").join(Pu)}function O_(e){return e.split(Iu).join("\\").split(zu).join("{").split(_s).join("}").split(Au).join(",").split(Pu).join(".")}function Cu(e){if(!e)return[""];var t=[],r=Eu("{","}",e);if(!r)return e.split(",");var{pre:n,body:o,post:i}=r,s=n.split(",");s[s.length-1]+="{"+o+"}";var a=Cu(i);if(i.length)s[s.length-1]+=a.shift(),s.push.apply(s,a);return t.push.apply(t,s),t}function I_(e){if(!e)return[];if(e.substr(0,2)==="{}")e="\\{\\}"+e.substr(2);return Jt(x_(e),!0).map(O_)}function z_(e){return"{"+e+"}"}function A_(e){return/^-?0\d/.test(e)}function P_(e,t){return e<=t}function C_(e,t){return e>=t}function Jt(e,t){var r=[],n=Eu("{","}",e);if(!n||/\$$/.test(n.pre))return[e];var o=/^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(n.body),i=/^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(n.body),s=o||i,a=n.body.indexOf(",")>=0;if(!s&&!a){if(n.post.match(/,.*\}/))return e=n.pre+"{"+n.body+_s+n.post,Jt(e);return[e]}var c;if(s)c=n.body.split(/\.\./);else if(c=Cu(n.body),c.length===1){if(c=Jt(c[0],!1).map(z_),c.length===1){var u=n.post.length?Jt(n.post,!1):[""];return u.map(function(he){return n.pre+c[0]+he})}}var l=n.pre,u=n.post.length?Jt(n.post,!1):[""],f;if(s){var h=yi(c[0]),d=yi(c[1]),p=Math.max(c[0].length,c[1].length),g=c.length==3?Math.abs(yi(c[2])):1,y=P_,b=d<h;if(b)g*=-1,y=C_;var S=c.some(A_);f=[];for(var N=h;y(N,d);N+=g){var z;if(i){if(z=String.fromCharCode(N),z==="\\")z=""}else if(z=String(N),S){var C=p-z.length;if(C>0){var x=Array(C+1).join("0");if(N<0)z="-"+x+z.slice(1);else z=x+z}}f.push(z)}}else f=S_(c,function(ye){return Jt(ye,!1)});for(var U=0;U<f.length;U++)for(var ie=0;ie<u.length;ie++){var oe=l+f[U]+u[ie];if(!t||s||oe)r.push(oe)}return r}var ws=Ie;Ie.Minimatch=te;var jr={sep:"/"};try{jr=v.default}catch(e){}var vs=Ie.GLOBSTAR=te.GLOBSTAR={},yc={"!":{open:"(?:(?!(?:",close:"))[^/]*?)"},"?":{open:"(?:",close:")?"},"+":{open:"(?:",close:")+"},"*":{open:"(?:",close:")*"},"@":{open:"(?:",close:")"}},Qi="[^/]",es=Qi+"*?",R_="(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?",T_="(?:(?!(?:\\/|^)\\.).)*?",_c=N_("().*{}+?[]^$\\!");function N_(e){return e.split("").reduce(function(t,r){return t[r]=!0,t},{})}var Ru=/\/+/;Ie.filter=D_;function D_(e,t){return t=t||{},function(r,n,o){return Ie(r,e,t)}}function wc(e,t){e=e||{},t=t||{};var r={};return Object.keys(t).forEach(function(n){r[n]=t[n]}),Object.keys(e).forEach(function(n){r[n]=e[n]}),r}Ie.defaults=function(e){if(!e||!Object.keys(e).length)return Ie;var t=Ie,r=function(o,i,s){return t.minimatch(o,i,wc(e,s))};return r.Minimatch=function(o,i){return new t.Minimatch(o,wc(e,i))},r};te.defaults=function(e){if(!e||!Object.keys(e).length)return te;return Ie.defaults(e).Minimatch};function Ie(e,t,r){if(typeof t!=="string")throw TypeError("glob pattern string required");if(!r)r={};if(!r.nocomment&&t.charAt(0)==="#")return!1;if(t.trim()==="")return e==="";return new te(t,r).match(e)}function te(e,t){if(!(this instanceof te))return new te(e,t);if(typeof e!=="string")throw TypeError("glob pattern string required");if(!t)t={};if(e=e.trim(),jr.sep!=="/")e=e.split(jr.sep).join("/");this.options=t,this.set=[],this.pattern=e,this.regexp=null,this.negate=!1,this.comment=!1,this.empty=!1,this.make()}te.prototype.debug=function(){};te.prototype.make=L_;function L_(){if(this._made)return;var e=this.pattern,t=this.options;if(!t.nocomment&&e.charAt(0)==="#"){this.comment=!0;return}if(!e){this.empty=!0;return}this.parseNegate();var r=this.globSet=this.braceExpand();if(t.debug)this.debug=console.error;this.debug(this.pattern,r),r=this.globParts=r.map(function(n){return n.split(Ru)}),this.debug(this.pattern,r),r=r.map(function(n,o,i){return n.map(this.parse,this)},this),this.debug(this.pattern,r),r=r.filter(function(n){return n.indexOf(!1)===-1}),this.debug(this.pattern,r),this.set=r}te.prototype.parseNegate=Z_;function Z_(){var e=this.pattern,t=!1,r=this.options,n=0;if(r.nonegate)return;for(var o=0,i=e.length;o<i&&e.charAt(o)==="!";o++)t=!t,n++;if(n)this.pattern=e.substr(n);this.negate=t}Ie.braceExpand=function(e,t){return Tu(e,t)};te.prototype.braceExpand=Tu;function Tu(e,t){if(!t)if(this instanceof te)t=this.options;else t={};if(e=typeof e>"u"?this.pattern:e,typeof e>"u")throw TypeError("undefined pattern");if(t.nobrace||!e.match(/\{.*\}/))return[e];return E_(e)}te.prototype.parse=F_;var En={};function F_(e,t){if(e.length>65536)throw TypeError("pattern is too long");var r=this.options;if(!r.noglobstar&&e==="**")return vs;if(e==="")return"";var n="",o=!!r.nocase,i=!1,s=[],a=[],c,l=!1,u=-1,f=-1,h=e.charAt(0)==="."?"":r.dot?"(?!(?:^|\\/)\\.{1,2}(?:$|\\/))":"(?!\\.)",d=this;function p(){if(c){switch(c){case"*":n+=es,o=!0;break;case"?":n+=Qi,o=!0;break;default:n+="\\"+c;break}d.debug("clearStateChar %j %j",c,n),c=!1}}for(var g=0,y=e.length,b;g<y&&(b=e.charAt(g));g++){if(this.debug("%s\t%s %s %j",e,g,n,b),i&&_c[b]){n+="\\"+b,i=!1;continue}switch(b){case"/":return!1;case"\\":p(),i=!0;continue;case"?":case"*":case"+":case"@":case"!":if(this.debug("%s\t%s %s %j <-- stateChar",e,g,n,b),l){if(this.debug(" in class"),b==="!"&&g===f+1)b="^";n+=b;continue}if(d.debug("call clearStateChar %j",c),p(),c=b,r.noext)p();continue;case"(":if(l){n+="(";continue}if(!c){n+="\\(";continue}s.push({type:c,start:g-1,reStart:n.length,open:yc[c].open,close:yc[c].close}),n+=c==="!"?"(?:(?!(?:":"(?:",this.debug("plType %j %j",c,n),c=!1;continue;case")":if(l||!s.length){n+="\\)";continue}p(),o=!0;var S=s.pop();if(n+=S.close,S.type==="!")a.push(S);S.reEnd=n.length;continue;case"|":if(l||!s.length||i){n+="\\|",i=!1;continue}p(),n+="|";continue;case"[":if(p(),l){n+="\\"+b;continue}l=!0,f=g,u=n.length,n+=b;continue;case"]":if(g===f+1||!l){n+="\\"+b,i=!1;continue}if(l){var N=e.substring(f+1,g);try{RegExp("["+N+"]")}catch(G){var z=this.parse(N,En);n=n.substr(0,u)+"\\["+z[0]+"\\]",o=o||z[1],l=!1;continue}}o=!0,l=!1,n+=b;continue;default:if(p(),i)i=!1;else if(_c[b]&&!(b==="^"&&l))n+="\\";n+=b}}if(l)N=e.substr(f+1),z=this.parse(N,En),n=n.substr(0,u)+"\\["+z[0],o=o||z[1];for(S=s.pop();S;S=s.pop()){var C=n.slice(S.reStart+S.open.length);this.debug("setting tail",n,S),C=C.replace(/((?:\\{2}){0,64})(\\?)\|/g,function(G,J,se){if(!se)se="\\";return J+J+se+"|"}),this.debug(`tail=%j
|
|
12
|
+
%s`,C,C,S,n);var x=S.type==="*"?es:S.type==="?"?Qi:"\\"+S.type;o=!0,n=n.slice(0,S.reStart)+x+"\\("+C}if(p(),i)n+="\\\\";var U=!1;switch(n.charAt(0)){case".":case"[":case"(":U=!0}for(var ie=a.length-1;ie>-1;ie--){var oe=a[ie],ye=n.slice(0,oe.reStart),he=n.slice(oe.reStart,oe.reEnd-8),I=n.slice(oe.reEnd-8,oe.reEnd),R=n.slice(oe.reEnd);I+=R;var w=ye.split("(").length-1,T=R;for(g=0;g<w;g++)T=T.replace(/\)[+*?]?/,"");R=T;var L="";if(R===""&&t!==En)L="$";var V=ye+he+R+L+I;n=V}if(n!==""&&o)n="(?=.)"+n;if(U)n=h+n;if(t===En)return[n,o];if(!o)return B_(e);var q=r.nocase?"i":"";try{var Q=new RegExp("^"+n+"$",q)}catch(G){return new RegExp("$.")}return Q._glob=e,Q._src=n,Q}Ie.makeRe=function(e,t){return new te(e,t||{}).makeRe()};te.prototype.makeRe=M_;function M_(){if(this.regexp||this.regexp===!1)return this.regexp;var e=this.set;if(!e.length)return this.regexp=!1,this.regexp;var t=this.options,r=t.noglobstar?es:t.dot?R_:T_,n=t.nocase?"i":"",o=e.map(function(i){return i.map(function(s){return s===vs?r:typeof s==="string"?U_(s):s._src}).join("\\/")}).join("|");if(o="^(?:"+o+")$",this.negate)o="^(?!"+o+").*$";try{this.regexp=new RegExp(o,n)}catch(i){this.regexp=!1}return this.regexp}Ie.match=function(e,t,r){r=r||{};var n=new te(t,r);if(e=e.filter(function(o){return n.match(o)}),n.options.nonull&&!e.length)e.push(t);return e};te.prototype.match=j_;function j_(e,t){if(this.debug("match",e,this.pattern),this.comment)return!1;if(this.empty)return e==="";if(e==="/"&&t)return!0;var r=this.options;if(jr.sep!=="/")e=e.split(jr.sep).join("/");e=e.split(Ru),this.debug(this.pattern,"split",e);var n=this.set;this.debug(this.pattern,"set",n);var o,i;for(i=e.length-1;i>=0;i--)if(o=e[i],o)break;for(i=0;i<n.length;i++){var s=n[i],a=e;if(r.matchBase&&s.length===1)a=[o];var c=this.matchOne(a,s,t);if(c){if(r.flipNegate)return!0;return!this.negate}}if(r.flipNegate)return!1;return this.negate}te.prototype.matchOne=function(e,t,r){var n=this.options;this.debug("matchOne",{this:this,file:e,pattern:t}),this.debug("matchOne",e.length,t.length);for(var o=0,i=0,s=e.length,a=t.length;o<s&&i<a;o++,i++){this.debug("matchOne loop");var c=t[i],l=e[o];if(this.debug(t,c,l),c===!1)return!1;if(c===vs){this.debug("GLOBSTAR",[t,c,l]);var u=o,f=i+1;if(f===a){this.debug("** at the end");for(;o<s;o++)if(e[o]==="."||e[o]===".."||!n.dot&&e[o].charAt(0)===".")return!1;return!0}while(u<s){var h=e[u];if(this.debug(`
|
|
13
|
+
globstar while`,e,u,t,f,h),this.matchOne(e.slice(u),t.slice(f),r))return this.debug("globstar found match!",u,s,h),!0;else{if(h==="."||h===".."||!n.dot&&h.charAt(0)==="."){this.debug("dot detected!",e,u,t,f);break}this.debug("globstar swallow a segment, and continue"),u++}}if(r){if(this.debug(`
|
|
14
|
+
>>> no match, partial?`,e,u,t,f),u===s)return!0}return!1}var d;if(typeof c==="string"){if(n.nocase)d=l.toLowerCase()===c.toLowerCase();else d=l===c;this.debug("string match",c,l,d)}else d=l.match(c),this.debug("pattern match",c,l,d);if(!d)return!1}if(o===s&&i===a)return!0;else if(o===s)return r;else if(i===a){var p=o===s-1&&e[o]==="";return p}throw Error("wtf?")};function B_(e){return e.replace(/\\(.)/g,"$1")}function U_(e){return e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}var V_=Ce(function(e){if(typeof Object.create==="function")e.exports=function(r,n){r.super_=n,r.prototype=Object.create(n.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}})};else e.exports=function(r,n){r.super_=n;var o=function(){};o.prototype=n.prototype,r.prototype=new o,r.prototype.constructor=r}}),G_=Ce(function(e){try{var t=Fe.default;if(typeof t.inherits!=="function")throw"";e.exports=t.inherits}catch(r){e.exports=V_}});function Nu(e){return e.charAt(0)==="/"}function Du(e){var t=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/,r=t.exec(e),n=r[1]||"",o=Boolean(n&&n.charAt(1)!==":");return Boolean(r[2]||o)}var we=process.platform==="win32"?Du:Nu,W_=Nu,H_=Du;we.posix=W_;we.win32=H_;var q_=Fu,K_=Zu,J_=iw,Y_=Lu,X_=Br,Q_=sw,ew=aw,tw=Mu,rw=cw;function Lu(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var ts=ws.Minimatch;function Zu(e,t){return e.toLowerCase().localeCompare(t.toLowerCase())}function Fu(e,t){return e.localeCompare(t)}function nw(e,t){if(e.ignore=t.ignore||[],!Array.isArray(e.ignore))e.ignore=[e.ignore];if(e.ignore.length)e.ignore=e.ignore.map(ow)}function ow(e){var t=null;if(e.slice(-3)==="/**"){var r=e.replace(/(\/\*\*)+$/,"");t=new ts(r,{dot:!0})}return{matcher:new ts(e,{dot:!0}),gmatcher:t}}function iw(e,t,r){if(!r)r={};if(r.matchBase&&t.indexOf("/")===-1){if(r.noglobstar)throw Error("base matching requires globstar");t="**/"+t}if(e.silent=!!r.silent,e.pattern=t,e.strict=r.strict!==!1,e.realpath=!!r.realpath,e.realpathCache=r.realpathCache||Object.create(null),e.follow=!!r.follow,e.dot=!!r.dot,e.mark=!!r.mark,e.nodir=!!r.nodir,e.nodir)e.mark=!0;e.sync=!!r.sync,e.nounique=!!r.nounique,e.nonull=!!r.nonull,e.nosort=!!r.nosort,e.nocase=!!r.nocase,e.stat=!!r.stat,e.noprocess=!!r.noprocess,e.absolute=!!r.absolute,e.maxLength=r.maxLength||1/0,e.cache=r.cache||Object.create(null),e.statCache=r.statCache||Object.create(null),e.symlinks=r.symlinks||Object.create(null),nw(e,r),e.changedCwd=!1;var n=process.cwd();if(!Lu(r,"cwd"))e.cwd=n;else e.cwd=v.default.resolve(r.cwd),e.changedCwd=e.cwd!==n;if(e.root=r.root||v.default.resolve(e.cwd,"/"),e.root=v.default.resolve(e.root),process.platform==="win32")e.root=e.root.replace(/\\/g,"/");if(e.cwdAbs=we(e.cwd)?e.cwd:Br(e,e.cwd),process.platform==="win32")e.cwdAbs=e.cwdAbs.replace(/\\/g,"/");e.nomount=!!r.nomount,r.nonegate=!0,r.nocomment=!0,e.minimatch=new ts(t,r),e.options=e.minimatch.options}function sw(e){var t=e.nounique,r=t?[]:Object.create(null);for(var n=0,o=e.matches.length;n<o;n++){var i=e.matches[n];if(!i||Object.keys(i).length===0){if(e.nonull){var s=e.minimatch.globSet[n];if(t)r.push(s);else r[s]=!0}}else{var a=Object.keys(i);if(t)r.push.apply(r,a);else a.forEach(function(c){r[c]=!0})}}if(!t)r=Object.keys(r);if(!e.nosort)r=r.sort(e.nocase?Zu:Fu);if(e.mark){for(var n=0;n<r.length;n++)r[n]=e._mark(r[n]);if(e.nodir)r=r.filter(function(c){var l=!/\/$/.test(c),u=e.cache[c]||e.cache[Br(e,c)];if(l&&u)l=u!=="DIR"&&!Array.isArray(u);return l})}if(e.ignore.length)r=r.filter(function(c){return!Mu(e,c)});e.found=r}function aw(e,t){var r=Br(e,t),n=e.cache[r],o=t;if(n){var i=n==="DIR"||Array.isArray(n),s=t.slice(-1)==="/";if(i&&!s)o+="/";else if(!i&&s)o=o.slice(0,-1);if(o!==t){var a=Br(e,o);e.statCache[a]=e.statCache[r],e.cache[a]=e.cache[r]}}return o}function Br(e,t){var r=t;if(t.charAt(0)==="/")r=v.default.join(e.root,t);else if(we(t)||t==="")r=t;else if(e.changedCwd)r=v.default.resolve(e.cwd,t);else r=v.default.resolve(t);if(process.platform==="win32")r=r.replace(/\\/g,"/");return r}function Mu(e,t){if(!e.ignore.length)return!1;return e.ignore.some(function(r){return r.matcher.match(t)||!!(r.gmatcher&&r.gmatcher.match(t))})}function cw(e,t){if(!e.ignore.length)return!1;return e.ignore.some(function(r){return!!(r.gmatcher&&r.gmatcher.match(t))})}var me={alphasort:q_,alphasorti:K_,setopts:J_,ownProp:Y_,makeAbs:X_,finish:Q_,mark:ew,isIgnored:tw,childrenIgnored:rw},bs=ju;ju.GlobSync=Y;var{setopts:uw,ownProp:rs,childrenIgnored:lw,isIgnored:fw}=me;function ju(e,t){if(typeof t==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
|
|
15
|
+
See: https://github.com/isaacs/node-glob/issues/167`);return new Y(e,t).found}function Y(e,t){if(!e)throw Error("must provide pattern");if(typeof t==="function"||arguments.length===3)throw TypeError(`callback provided to sync glob
|
|
16
|
+
See: https://github.com/isaacs/node-glob/issues/167`);if(!(this instanceof Y))return new Y(e,t);if(uw(this,e,t),this.noprocess)return this;var r=this.minimatch.set.length;this.matches=Array(r);for(var n=0;n<r;n++)this._process(this.minimatch.set[n],n,!1);this._finish()}Y.prototype._finish=function(){if(O.default(this instanceof Y),this.realpath){var e=this;this.matches.forEach(function(t,r){var n=e.matches[r]=Object.create(null);for(var o in t)try{o=e._makeAbs(o);var i=$u.realpathSync(o,e.realpathCache);n[i]=!0}catch(s){if(s.syscall==="stat")n[e._makeAbs(o)]=!0;else throw s}})}me.finish(this)};Y.prototype._process=function(e,t,r){O.default(this instanceof Y);var n=0;while(typeof e[n]==="string")n++;var o;switch(n){case e.length:this._processSimple(e.join("/"),t);return;case 0:o=null;break;default:o=e.slice(0,n).join("/");break}var i=e.slice(n),s;if(o===null)s=".";else if(we(o)||we(e.join("/"))){if(!o||!we(o))o="/"+o;s=o}else s=o;var a=this._makeAbs(s);if(lw(this,s))return;var c=i[0]===ws.GLOBSTAR;if(c)this._processGlobStar(o,s,a,i,t,r);else this._processReaddir(o,s,a,i,t,r)};Y.prototype._processReaddir=function(e,t,r,n,o,i){var s=this._readdir(r,i);if(!s)return;var a=n[0],c=!!this.minimatch.negate,l=a._glob,u=this.dot||l.charAt(0)===".",f=[];for(var h=0;h<s.length;h++){var d=s[h];if(d.charAt(0)!=="."||u){var p;if(c&&!e)p=!d.match(a);else p=d.match(a);if(p)f.push(d)}}var g=f.length;if(g===0)return;if(n.length===1&&!this.mark&&!this.stat){if(!this.matches[o])this.matches[o]=Object.create(null);for(var h=0;h<g;h++){var d=f[h];if(e)if(e.slice(-1)!=="/")d=e+"/"+d;else d=e+d;if(d.charAt(0)==="/"&&!this.nomount)d=v.default.join(this.root,d);this._emitMatch(o,d)}return}n.shift();for(var h=0;h<g;h++){var d=f[h],y;if(e)y=[e,d];else y=[d];this._process(y.concat(n),o,i)}};Y.prototype._emitMatch=function(e,t){if(fw(this,t))return;var r=this._makeAbs(t);if(this.mark)t=this._mark(t);if(this.absolute)t=r;if(this.matches[e][t])return;if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}if(this.matches[e][t]=!0,this.stat)this._stat(t)};Y.prototype._readdirInGlobStar=function(e){if(this.follow)return this._readdir(e,!1);var t,r;try{r=m.default.lstatSync(e)}catch(o){if(o.code==="ENOENT")return null}var n=r&&r.isSymbolicLink();if(this.symlinks[e]=n,!n&&r&&!r.isDirectory())this.cache[e]="FILE";else t=this._readdir(e,!1);return t};Y.prototype._readdir=function(e,t){if(t&&!rs(this.symlinks,e))return this._readdirInGlobStar(e);if(rs(this.cache,e)){var r=this.cache[e];if(!r||r==="FILE")return null;if(Array.isArray(r))return r}try{return this._readdirEntries(e,m.default.readdirSync(e))}catch(n){return this._readdirError(e,n),null}};Y.prototype._readdirEntries=function(e,t){if(!this.mark&&!this.stat)for(var r=0;r<t.length;r++){var n=t[r];if(e==="/")n=e+n;else n=e+"/"+n;this.cache[n]=!0}return this.cache[e]=t,t};Y.prototype._readdirError=function(e,t){switch(t.code){case"ENOTSUP":case"ENOTDIR":var r=this._makeAbs(e);if(this.cache[r]="FILE",r===this.cwdAbs){var n=Error(t.code+" invalid cwd "+this.cwd);throw n.path=this.cwd,n.code=t.code,n}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)throw t;if(!this.silent)console.error("glob error",t);break}};Y.prototype._processGlobStar=function(e,t,r,n,o,i){var s=this._readdir(r,i);if(!s)return;var a=n.slice(1),c=e?[e]:[],l=c.concat(a);this._process(l,o,!1);var u=s.length,f=this.symlinks[r];if(f&&i)return;for(var h=0;h<u;h++){var d=s[h];if(d.charAt(0)==="."&&!this.dot)continue;var p=c.concat(s[h],a);this._process(p,o,!0);var g=c.concat(s[h],n);this._process(g,o,!0)}};Y.prototype._processSimple=function(e,t){var r=this._stat(e);if(!this.matches[t])this.matches[t]=Object.create(null);if(!r)return;if(e&&we(e)&&!this.nomount){var n=/[\/\\]$/.test(e);if(e.charAt(0)==="/")e=v.default.join(this.root,e);else if(e=v.default.resolve(this.root,e),n)e+="/"}if(process.platform==="win32")e=e.replace(/\\/g,"/");this._emitMatch(t,e)};Y.prototype._stat=function(e){var t=this._makeAbs(e),r=e.slice(-1)==="/";if(e.length>this.maxLength)return!1;if(!this.stat&&rs(this.cache,t)){var i=this.cache[t];if(Array.isArray(i))i="DIR";if(!r||i==="DIR")return i;if(r&&i==="FILE")return!1}var n=this.statCache[t];if(!n){var o;try{o=m.default.lstatSync(t)}catch(s){if(s&&(s.code==="ENOENT"||s.code==="ENOTDIR"))return this.statCache[t]=!1,!1}if(o&&o.isSymbolicLink())try{n=m.default.statSync(t)}catch(s){n=o}else n=o}this.statCache[t]=n;var i=!0;if(n)i=n.isDirectory()?"DIR":"FILE";if(this.cache[t]=this.cache[t]||i,r&&i==="FILE")return!1;return i};Y.prototype._mark=function(e){return me.mark(this,e)};Y.prototype._makeAbs=function(e){return me.makeAbs(this,e)};var $s=Bu;function Bu(e,t){if(e&&t)return Bu(e)(t);if(typeof e!=="function")throw TypeError("need wrapper function");return Object.keys(e).forEach(function(n){r[n]=e[n]}),r;function r(){var n=Array(arguments.length);for(var o=0;o<n.length;o++)n[o]=arguments[o];var i=e.apply(this,n),s=n[n.length-1];if(typeof i==="function"&&i!==s)Object.keys(s).forEach(function(a){i[a]=s[a]});return i}}var Ss=$s(Zn),hw=$s(Uu);Zn.proto=Zn(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return Zn(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return Uu(this)},configurable:!0})});function Zn(e){var t=function(){if(t.called)return t.value;return t.called=!0,t.value=e.apply(this,arguments)};return t.called=!1,t}function Uu(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},r=e.name||"Function wrapped with `once`";return t.onceError=r+" shouldn't be called more than once",t.called=!1,t}Ss.strict=hw;var Dr=Object.create(null),ks=$s(dw);function dw(e,t){if(Dr[e])return Dr[e].push(t),null;else return Dr[e]=[t],pw(e)}function pw(e){return Ss(function t(){var r=Dr[e],n=r.length,o=mw(arguments);try{for(var i=0;i<n;i++)r[i].apply(null,o)}finally{if(r.length>n)r.splice(0,n),process.nextTick(function(){t.apply(null,o)});else delete Dr[e]}})}function mw(e){var t=e.length,r=[];for(var n=0;n<t;n++)r[n]=e[n];return r}var gw=Pt,yw=ar.default.EventEmitter,{setopts:_w,ownProp:ns,childrenIgnored:ww,isIgnored:vw}=me;function Pt(e,t,r){if(typeof t==="function")r=t,t={};if(!t)t={};if(t.sync){if(r)throw TypeError("callback provided to sync glob");return bs(e,t)}return new Z(e,t,r)}Pt.sync=bs;var bw=Pt.GlobSync=bs.GlobSync;Pt.glob=Pt;function $w(e,t){if(t===null||typeof t!=="object")return e;var r=Object.keys(t),n=r.length;while(n--)e[r[n]]=t[r[n]];return e}Pt.hasMagic=function(e,t){var r=$w({},t);r.noprocess=!0;var n=new Z(e,r),o=n.minimatch.set;if(!e)return!1;if(o.length>1)return!0;for(var i=0;i<o[0].length;i++)if(typeof o[0][i]!=="string")return!0;return!1};Pt.Glob=Z;G_(Z,yw);function Z(e,t,r){if(typeof t==="function")r=t,t=null;if(t&&t.sync){if(r)throw TypeError("callback provided to sync glob");return new bw(e,t)}if(!(this instanceof Z))return new Z(e,t,r);_w(this,e,t),this._didRealPath=!1;var n=this.minimatch.set.length;if(this.matches=Array(n),typeof r==="function")r=Ss(r),this.on("error",r),this.on("end",function(c){r(null,c)});var o=this;if(this._processing=0,this._emitQueue=[],this._processQueue=[],this.paused=!1,this.noprocess)return this;if(n===0)return a();var i=!0;for(var s=0;s<n;s++)this._process(this.minimatch.set[s],s,!1,a);i=!1;function a(){if(--o._processing,o._processing<=0)if(i)process.nextTick(function(){o._finish()});else o._finish()}}Z.prototype._finish=function(){if(O.default(this instanceof Z),this.aborted)return;if(this.realpath&&!this._didRealpath)return this._realpath();me.finish(this),this.emit("end",this.found)};Z.prototype._realpath=function(){if(this._didRealpath)return;this._didRealpath=!0;var e=this.matches.length;if(e===0)return this._finish();var t=this;for(var r=0;r<this.matches.length;r++)this._realpathSet(r,n);function n(){if(--e===0)t._finish()}};Z.prototype._realpathSet=function(e,t){var r=this.matches[e];if(!r)return t();var n=Object.keys(r),o=this,i=n.length;if(i===0)return t();var s=this.matches[e]=Object.create(null);n.forEach(function(a,c){a=o._makeAbs(a),$u.realpath(a,o.realpathCache,function(l,u){if(!l)s[u]=!0;else if(l.syscall==="stat")s[a]=!0;else o.emit("error",l);if(--i===0)o.matches[e]=s,t()})})};Z.prototype._mark=function(e){return me.mark(this,e)};Z.prototype._makeAbs=function(e){return me.makeAbs(this,e)};Z.prototype.abort=function(){this.aborted=!0,this.emit("abort")};Z.prototype.pause=function(){if(!this.paused)this.paused=!0,this.emit("pause")};Z.prototype.resume=function(){if(this.paused){if(this.emit("resume"),this.paused=!1,this._emitQueue.length){var e=this._emitQueue.slice(0);this._emitQueue.length=0;for(var t=0;t<e.length;t++){var r=e[t];this._emitMatch(r[0],r[1])}}if(this._processQueue.length){var n=this._processQueue.slice(0);this._processQueue.length=0;for(var t=0;t<n.length;t++){var o=n[t];this._processing--,this._process(o[0],o[1],o[2],o[3])}}}};Z.prototype._process=function(e,t,r,n){if(O.default(this instanceof Z),O.default(typeof n==="function"),this.aborted)return;if(this._processing++,this.paused){this._processQueue.push([e,t,r,n]);return}var o=0;while(typeof e[o]==="string")o++;var i;switch(o){case e.length:this._processSimple(e.join("/"),t,n);return;case 0:i=null;break;default:i=e.slice(0,o).join("/");break}var s=e.slice(o),a;if(i===null)a=".";else if(we(i)||we(e.join("/"))){if(!i||!we(i))i="/"+i;a=i}else a=i;var c=this._makeAbs(a);if(ww(this,a))return n();var l=s[0]===ws.GLOBSTAR;if(l)this._processGlobStar(i,a,c,s,t,r,n);else this._processReaddir(i,a,c,s,t,r,n)};Z.prototype._processReaddir=function(e,t,r,n,o,i,s){var a=this;this._readdir(r,i,function(c,l){return a._processReaddir2(e,t,r,n,o,i,l,s)})};Z.prototype._processReaddir2=function(e,t,r,n,o,i,s,a){if(!s)return a();var c=n[0],l=!!this.minimatch.negate,u=c._glob,f=this.dot||u.charAt(0)===".",h=[];for(var d=0;d<s.length;d++){var p=s[d];if(p.charAt(0)!=="."||f){var g;if(l&&!e)g=!p.match(c);else g=p.match(c);if(g)h.push(p)}}var y=h.length;if(y===0)return a();if(n.length===1&&!this.mark&&!this.stat){if(!this.matches[o])this.matches[o]=Object.create(null);for(var d=0;d<y;d++){var p=h[d];if(e)if(e!=="/")p=e+"/"+p;else p=e+p;if(p.charAt(0)==="/"&&!this.nomount)p=v.default.join(this.root,p);this._emitMatch(o,p)}return a()}n.shift();for(var d=0;d<y;d++){var p=h[d];if(e)if(e!=="/")p=e+"/"+p;else p=e+p;this._process([p].concat(n),o,i,a)}a()};Z.prototype._emitMatch=function(e,t){if(this.aborted)return;if(vw(this,t))return;if(this.paused){this._emitQueue.push([e,t]);return}var r=we(t)?t:this._makeAbs(t);if(this.mark)t=this._mark(t);if(this.absolute)t=r;if(this.matches[e][t])return;if(this.nodir){var n=this.cache[r];if(n==="DIR"||Array.isArray(n))return}this.matches[e][t]=!0;var o=this.statCache[r];if(o)this.emit("stat",t,o);this.emit("match",t)};Z.prototype._readdirInGlobStar=function(e,t){if(this.aborted)return;if(this.follow)return this._readdir(e,!1,t);var r="lstat\x00"+e,n=this,o=ks(r,i);if(o)m.default.lstat(e,o);function i(s,a){if(s&&s.code==="ENOENT")return t();var c=a&&a.isSymbolicLink();if(n.symlinks[e]=c,!c&&a&&!a.isDirectory())n.cache[e]="FILE",t();else n._readdir(e,!1,t)}};Z.prototype._readdir=function(e,t,r){if(this.aborted)return;if(r=ks("readdir\x00"+e+"\x00"+t,r),!r)return;if(t&&!ns(this.symlinks,e))return this._readdirInGlobStar(e,r);if(ns(this.cache,e)){var n=this.cache[e];if(!n||n==="FILE")return r();if(Array.isArray(n))return r(null,n)}m.default.readdir(e,Sw(this,e,r))};function Sw(e,t,r){return function(n,o){if(n)e._readdirError(t,n,r);else e._readdirEntries(t,o,r)}}Z.prototype._readdirEntries=function(e,t,r){if(this.aborted)return;if(!this.mark&&!this.stat)for(var n=0;n<t.length;n++){var o=t[n];if(e==="/")o=e+o;else o=e+"/"+o;this.cache[o]=!0}return this.cache[e]=t,r(null,t)};Z.prototype._readdirError=function(e,t,r){if(this.aborted)return;switch(t.code){case"ENOTSUP":case"ENOTDIR":var n=this._makeAbs(e);if(this.cache[n]="FILE",n===this.cwdAbs){var o=Error(t.code+" invalid cwd "+this.cwd);o.path=this.cwd,o.code=t.code,this.emit("error",o),this.abort()}break;case"ENOENT":case"ELOOP":case"ENAMETOOLONG":case"UNKNOWN":this.cache[this._makeAbs(e)]=!1;break;default:if(this.cache[this._makeAbs(e)]=!1,this.strict)this.emit("error",t),this.abort();if(!this.silent)console.error("glob error",t);break}return r()};Z.prototype._processGlobStar=function(e,t,r,n,o,i,s){var a=this;this._readdir(r,i,function(c,l){a._processGlobStar2(e,t,r,n,o,i,l,s)})};Z.prototype._processGlobStar2=function(e,t,r,n,o,i,s,a){if(!s)return a();var c=n.slice(1),l=e?[e]:[],u=l.concat(c);this._process(u,o,!1,a);var f=this.symlinks[r],h=s.length;if(f&&i)return a();for(var d=0;d<h;d++){var p=s[d];if(p.charAt(0)==="."&&!this.dot)continue;var g=l.concat(s[d],c);this._process(g,o,!0,a);var y=l.concat(s[d],n);this._process(y,o,!0,a)}a()};Z.prototype._processSimple=function(e,t,r){var n=this;this._stat(e,function(o,i){n._processSimple2(e,t,o,i,r)})};Z.prototype._processSimple2=function(e,t,r,n,o){if(!this.matches[t])this.matches[t]=Object.create(null);if(!n)return o();if(e&&we(e)&&!this.nomount){var i=/[\/\\]$/.test(e);if(e.charAt(0)==="/")e=v.default.join(this.root,e);else if(e=v.default.resolve(this.root,e),i)e+="/"}if(process.platform==="win32")e=e.replace(/\\/g,"/");this._emitMatch(t,e),o()};Z.prototype._stat=function(e,t){var r=this._makeAbs(e),n=e.slice(-1)==="/";if(e.length>this.maxLength)return t();if(!this.stat&&ns(this.cache,r)){var o=this.cache[r];if(Array.isArray(o))o="DIR";if(!n||o==="DIR")return t(null,o);if(n&&o==="FILE")return t()}var i=this.statCache[r];if(i!==void 0)if(i===!1)return t(null,i);else{var s=i.isDirectory()?"DIR":"FILE";if(n&&s==="FILE")return t();else return t(null,s,i)}var a=this,c=ks("stat\x00"+r,l);if(c)m.default.lstat(r,c);function l(u,f){if(f&&f.isSymbolicLink())return m.default.stat(r,function(h,d){if(h)a._stat2(e,r,null,f,t);else a._stat2(e,r,h,d,t)});else a._stat2(e,r,u,f,t)}};Z.prototype._stat2=function(e,t,r,n,o){if(r&&(r.code==="ENOENT"||r.code==="ENOTDIR"))return this.statCache[t]=!1,o();var i=e.slice(-1)==="/";if(this.statCache[t]=n,t.slice(-1)==="/"&&n&&!n.isDirectory())return o(null,!1,n);var s=!0;if(n)s=n.isDirectory()?"DIR":"FILE";if(this.cache[t]=this.cache[t]||s,i&&s==="FILE")return o();return o(null,s,n)};var kw=Es;Es.sync=Wu;var nr=void 0;try{nr=gw}catch(e){}var Vu=parseInt("666",8),Ew={nosort:!0,silent:!0},_i=0,Ur=process.platform==="win32";function Gu(e){var t=["unlink","chmod","stat","lstat","rmdir","readdir"];if(t.forEach(function(r){e[r]=e[r]||m.default[r],r=r+"Sync",e[r]=e[r]||m.default[r]}),e.maxBusyTries=e.maxBusyTries||3,e.emfileWait=e.emfileWait||1000,e.glob===!1)e.disableGlob=!0;if(e.disableGlob!==!0&&nr===void 0)throw Error("glob dependency not found, set `options.disableGlob = true` if intentional");e.disableGlob=e.disableGlob||!1,e.glob=e.glob||Ew}function Es(e,t,r){if(typeof t==="function")r=t,t={};O.default(e,"rimraf: missing path"),O.default.equal(typeof e,"string","rimraf: path should be a string"),O.default.equal(typeof r,"function","rimraf: callback function required"),O.default(t,"rimraf: invalid options argument provided"),O.default.equal(typeof t,"object","rimraf: options should be object"),Gu(t);var n=0,o=null,i=0;if(t.disableGlob||!nr.hasMagic(e))return a(null,[e]);t.lstat(e,function(c,l){if(!c)return a(null,[e]);nr(e,t.glob,a)});function s(c){if(o=o||c,--i===0)r(o)}function a(c,l){if(c)return r(c);if(i=l.length,i===0)return r();l.forEach(function(u){wi(u,t,function f(h){if(h){if((h.code==="EBUSY"||h.code==="ENOTEMPTY"||h.code==="EPERM")&&n<t.maxBusyTries){n++;var d=n*100;return setTimeout(function(){wi(u,t,f)},d)}if(h.code==="EMFILE"&&_i<t.emfileWait)return setTimeout(function(){wi(u,t,f)},_i++);if(h.code==="ENOENT")h=null}_i=0,s(h)})})}}function wi(e,t,r){O.default(e),O.default(t),O.default(typeof r==="function"),t.lstat(e,function(n,o){if(n&&n.code==="ENOENT")return r(null);if(n&&n.code==="EPERM"&&Ur)vc(e,t,n,r);if(o&&o.isDirectory())return Fn(e,t,n,r);t.unlink(e,function(i){if(i){if(i.code==="ENOENT")return r(null);if(i.code==="EPERM")return Ur?vc(e,t,i,r):Fn(e,t,i,r);if(i.code==="EISDIR")return Fn(e,t,i,r)}return r(i)})})}function vc(e,t,r,n){if(O.default(e),O.default(t),O.default(typeof n==="function"),r)O.default(r instanceof Error);t.chmod(e,Vu,function(o){if(o)n(o.code==="ENOENT"?null:r);else t.stat(e,function(i,s){if(i)n(i.code==="ENOENT"?null:r);else if(s.isDirectory())Fn(e,t,r,n);else t.unlink(e,n)})})}function bc(e,t,r){if(O.default(e),O.default(t),r)O.default(r instanceof Error);try{t.chmodSync(e,Vu)}catch(o){if(o.code==="ENOENT")return;else throw r}try{var n=t.statSync(e)}catch(o){if(o.code==="ENOENT")return;else throw r}if(n.isDirectory())Mn(e,t,r);else t.unlinkSync(e)}function Fn(e,t,r,n){if(O.default(e),O.default(t),r)O.default(r instanceof Error);O.default(typeof n==="function"),t.rmdir(e,function(o){if(o&&(o.code==="ENOTEMPTY"||o.code==="EEXIST"||o.code==="EPERM"))xw(e,t,n);else if(o&&o.code==="ENOTDIR")n(r);else n(o)})}function xw(e,t,r){O.default(e),O.default(t),O.default(typeof r==="function"),t.readdir(e,function(n,o){if(n)return r(n);var i=o.length;if(i===0)return t.rmdir(e,r);var s;o.forEach(function(a){Es(v.default.join(e,a),t,function(c){if(s)return;if(c)return r(s=c);if(--i===0)t.rmdir(e,r)})})})}function Wu(e,t){t=t||{},Gu(t),O.default(e,"rimraf: missing path"),O.default.equal(typeof e,"string","rimraf: path should be a string"),O.default(t,"rimraf: missing options"),O.default.equal(typeof t,"object","rimraf: options should be object");var r;if(t.disableGlob||!nr.hasMagic(e))r=[e];else try{t.lstatSync(e),r=[e]}catch(i){r=nr.sync(e,t.glob)}if(!r.length)return;for(var n=0;n<r.length;n++){var e=r[n];try{var o=t.lstatSync(e)}catch(s){if(s.code==="ENOENT")return;if(s.code==="EPERM"&&Ur)bc(e,t,s)}try{if(o&&o.isDirectory())Mn(e,t,null);else t.unlinkSync(e)}catch(s){if(s.code==="ENOENT")return;if(s.code==="EPERM")return Ur?bc(e,t,s):Mn(e,t,s);if(s.code!=="EISDIR")throw s;Mn(e,t,s)}}}function Mn(e,t,r){if(O.default(e),O.default(t),r)O.default(r instanceof Error);try{t.rmdirSync(e)}catch(n){if(n.code==="ENOENT")return;if(n.code==="ENOTDIR")throw r;if(n.code==="ENOTEMPTY"||n.code==="EEXIST"||n.code==="EPERM")Ow(e,t)}}function Ow(e,t){O.default(e),O.default(t),t.readdirSync(e).forEach(function(s){Wu(v.default.join(e,s),t)});var r=Ur?100:1,n=0;do{var o=!0;try{var i=t.rmdirSync(e,t);return o=!1,i}finally{if(++n<r&&o)continue}}while(!0)}function Hu(e){return e&&typeof e==="object"&&"default"in e?e.default:e}var Iw=Hu(p_),zw=Hu(kw);function Aw(e){return v.default.resolve.apply(null,e)}function $c(e){var t,r;if(typeof e[e.length-1]==="object"){t=e[e.length-1];var n=e.length-1;r=Array(n);while(n--)r[n]=e[n]}else t={},r=e;var o=v.default.resolve.apply(null,r);return{options:t,resolvedPath:o}}function Pw(){var e=$c(arguments),{resolvedPath:t,options:r}=e;return{to:function(){var o=$c(arguments),{resolvedPath:i,options:s}=o;function a(c,l){Iw.sync(l),Oe.readdirSync(c).forEach(function(u){var f=c+v.default.sep+u,h=l+v.default.sep+u;if(Oe.statSync(f).isDirectory())return a(f,h);var d=Oe.readFileSync(f,r);Oe.writeFileSync(h,d,s)})}a(t,i)}}}function Cw(){zw.sync(Aw(arguments))}process.platform;Oe.closeSync;Oe.fchmodSync;Oe.fchownSync;Oe.fstatSync;Oe.fsyncSync;Oe.ftruncateSync;Oe.futimesSync;Oe.readSync;var qu=Pw,Vr=Cw,Rw=Si.default.homedir()||Si.default.tmpdir(),or=1000,ir=or*60,sr=ir*60,Ct=sr*24,Tw=Ct*7,Nw=Ct*365.25,Dw=function(e,t){t=t||{};var r=typeof e;if(r==="string"&&e.length>0)return Lw(e);else if(r==="number"&&isFinite(e))return t.long?Fw(e):Zw(e);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(e))};function Lw(e){if(e=String(e),e.length>100)return;var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(!t)return;var r=parseFloat(t[1]),n=(t[2]||"ms").toLowerCase();switch(n){case"years":case"year":case"yrs":case"yr":case"y":return r*Nw;case"weeks":case"week":case"w":return r*Tw;case"days":case"day":case"d":return r*Ct;case"hours":case"hour":case"hrs":case"hr":case"h":return r*sr;case"minutes":case"minute":case"mins":case"min":case"m":return r*ir;case"seconds":case"second":case"secs":case"sec":case"s":return r*or;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return r;default:return}}function Zw(e){var t=Math.abs(e);if(t>=Ct)return Math.round(e/Ct)+"d";if(t>=sr)return Math.round(e/sr)+"h";if(t>=ir)return Math.round(e/ir)+"m";if(t>=or)return Math.round(e/or)+"s";return e+"ms"}function Fw(e){var t=Math.abs(e);if(t>=Ct)return xn(e,t,Ct,"day");if(t>=sr)return xn(e,t,sr,"hour");if(t>=ir)return xn(e,t,ir,"minute");if(t>=or)return xn(e,t,or,"second");return e+" ms"}function xn(e,t,r,n){var o=t>=r*1.5;return Math.round(e/r)+" "+n+(o?"s":"")}function Mw(e){r.debug=r,r.default=r,r.coerce=c,r.disable=i,r.enable=o,r.enabled=s,r.humanize=Dw,r.destroy=l,Object.keys(e).forEach((u)=>{r[u]=e[u]}),r.names=[],r.skips=[],r.formatters={};function t(u){let f=0;for(let h=0;h<u.length;h++)f=(f<<5)-f+u.charCodeAt(h),f|=0;return r.colors[Math.abs(f)%r.colors.length]}r.selectColor=t;function r(u){let f,h=null;function d(...p){if(!d.enabled)return;let g=d,y=Number(new Date),b=y-(f||y);if(g.diff=b,g.prev=f,g.curr=y,f=y,p[0]=r.coerce(p[0]),typeof p[0]!=="string")p.unshift("%O");let S=0;p[0]=p[0].replace(/%([a-zA-Z%])/g,(z,C)=>{if(z==="%%")return"%";S++;let x=r.formatters[C];if(typeof x==="function"){let U=p[S];z=x.call(g,U),p.splice(S,1),S--}return z}),r.formatArgs.call(g,p),(g.log||r.log).apply(g,p)}if(d.namespace=u,d.useColors=r.useColors(),d.color=r.selectColor(u),d.extend=n,d.destroy=r.destroy,Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,get:()=>h===null?r.enabled(u):h,set:(p)=>{h=p}}),typeof r.init==="function")r.init(d);return d}function n(u,f){let h=r(this.namespace+(typeof f>"u"?":":f)+u);return h.log=this.log,h}function o(u){r.save(u),r.names=[],r.skips=[];let f,h=(typeof u==="string"?u:"").split(/[\s,]+/),d=h.length;for(f=0;f<d;f++){if(!h[f])continue;if(u=h[f].replace(/\*/g,".*?"),u[0]==="-")r.skips.push(new RegExp("^"+u.substr(1)+"$"));else r.names.push(new RegExp("^"+u+"$"))}}function i(){let u=[...r.names.map(a),...r.skips.map(a).map((f)=>"-"+f)].join(",");return r.enable(""),u}function s(u){if(u[u.length-1]==="*")return!0;let f,h;for(f=0,h=r.skips.length;f<h;f++)if(r.skips[f].test(u))return!1;for(f=0,h=r.names.length;f<h;f++)if(r.names[f].test(u))return!0;return!1}function a(u){return u.toString().substring(2,u.toString().length-2).replace(/\.\*\?$/,"*")}function c(u){if(u instanceof Error)return u.stack||u.message;return u}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return r.enable(r.load()),r}var Ku=Mw,jw=Ce(function(e,t){t.formatArgs=n,t.save=o,t.load=i,t.useColors=r,t.storage=s(),t.destroy=(()=>{let c=!1;return()=>{if(!c)c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;let l="color: "+this.color;c.splice(1,0,l,"color: inherit");let u=0,f=0;c[0].replace(/%[a-zA-Z%]/g,(h)=>{if(h==="%%")return;if(u++,h==="%c")f=u}),c.splice(f,0,l)}t.log=console.debug||console.log||(()=>{});function o(c){try{if(c)t.storage.setItem("debug",c);else t.storage.removeItem("debug")}catch(l){}}function i(){let c;try{c=t.storage.getItem("debug")}catch(l){}if(!c&&typeof process<"u"&&"env"in process)c=process.env.DEBUG;return c}function s(){try{return localStorage}catch(c){}}e.exports=Ku(t);let{formatters:a}=e.exports;a.j=function(c){try{return JSON.stringify(c)}catch(l){return"[UnexpectedJSONParseError]: "+l.message}}}),Bw=Ce(function(e,t){t.init=c,t.log=i,t.formatArgs=n,t.save=s,t.load=a,t.useColors=r,t.destroy=Fe.default.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),t.colors=[6,2,3,4,5,1];try{let u=du;if(u&&(u.stderr||u).level>=2)t.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221]}catch(u){}t.inspectOpts=Object.keys(process.env).filter((u)=>/^debug_/i.test(u)).reduce((u,f)=>{let h=f.substring(6).toLowerCase().replace(/_([a-z])/g,(p,g)=>g.toUpperCase()),d=process.env[f];if(/^(yes|on|true|enabled)$/i.test(d))d=!0;else if(/^(no|off|false|disabled)$/i.test(d))d=!1;else if(d==="null")d=null;else d=Number(d);return u[h]=d,u},{});function r(){return"colors"in t.inspectOpts?Boolean(t.inspectOpts.colors):ki.default.isatty(process.stderr.fd)}function n(u){let{namespace:f,useColors:h}=this;if(h){let d=this.color,p="\x1B[3"+(d<8?d:"8;5;"+d),g=` ${p};1m${f} \x1B[0m`;u[0]=g+u[0].split(`
|
|
17
|
+
`).join(`
|
|
18
|
+
`+g),u.push(p+"m+"+e.exports.humanize(this.diff)+"\x1B[0m")}else u[0]=o()+f+" "+u[0]}function o(){if(t.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function i(...u){return process.stderr.write(Fe.default.format(...u)+`
|
|
19
|
+
`)}function s(u){if(u)process.env.DEBUG=u;else delete process.env.DEBUG}function a(){return process.env.DEBUG}function c(u){u.inspectOpts={};let f=Object.keys(t.inspectOpts);for(let h=0;h<f.length;h++)u.inspectOpts[f[h]]=t.inspectOpts[f[h]]}e.exports=Ku(t);let{formatters:l}=e.exports;l.o=function(u){return this.inspectOpts.colors=this.useColors,Fe.default.inspect(u,this.inspectOpts).split(`
|
|
20
|
+
`).map((f)=>f.trim()).join(" ")},l.O=function(u){return this.inspectOpts.colors=this.useColors,Fe.default.inspect(u,this.inspectOpts)}}),xs=Ce(function(e){if(typeof process>"u"||process.type==="renderer"||!1||process.__nwjs)e.exports=jw;else e.exports=Bw});function Uw(e){return function(t,r){return new Promise((n,o)=>{e.call(this,t,r,(i,s)=>{if(i)o(i);else n(s)})})}}var Vw=Uw,Gw=Object.defineProperty({default:Vw},"__esModule",{value:!0}),Ju=ze&&ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Ww=Ju(xs),Hw=Ju(Gw),Ar=Ww.default("agent-base");function qw(e){return Boolean(e)&&typeof e.addRequest==="function"}function vi(){let{stack:e}=Error();if(typeof e!=="string")return!1;return e.split(`
|
|
21
|
+
`).some((t)=>t.indexOf("(https.js:")!==-1||t.indexOf("node:https:")!==-1)}function Hn(e,t){return new Hn.Agent(e,t)}(function(e){class t extends ar.default.EventEmitter{constructor(r,n){super();let o=n;if(typeof r==="function")this.callback=r;else if(r)o=r;if(this.timeout=null,o&&typeof o.timeout==="number")this.timeout=o.timeout;this.maxFreeSockets=1,this.maxSockets=1,this.maxTotalSockets=1/0,this.sockets={},this.freeSockets={},this.requests={},this.options={}}get defaultPort(){if(typeof this.explicitDefaultPort==="number")return this.explicitDefaultPort;return vi()?443:80}set defaultPort(r){this.explicitDefaultPort=r}get protocol(){if(typeof this.explicitProtocol==="string")return this.explicitProtocol;return vi()?"https:":"http:"}set protocol(r){this.explicitProtocol=r}callback(r,n,o){throw Error('"agent-base" has no default implementation, you must subclass and override `callback()`')}addRequest(r,n){let o=Object.assign({},n);if(typeof o.secureEndpoint!=="boolean")o.secureEndpoint=vi();if(o.host==null)o.host="localhost";if(o.port==null)o.port=o.secureEndpoint?443:80;if(o.protocol==null)o.protocol=o.secureEndpoint?"https:":"http:";if(o.host&&o.path)delete o.path;delete o.agent,delete o.hostname,delete o._defaultAgent,delete o.defaultPort,delete o.createConnection,r._last=!0,r.shouldKeepAlive=!1;let i=!1,s=null,a=o.timeout||this.timeout,c=(h)=>{if(r._hadError)return;r.emit("error",h),r._hadError=!0},l=()=>{s=null,i=!0;let h=Error(`A "socket" was not created for HTTP request before ${a}ms`);h.code="ETIMEOUT",c(h)},u=(h)=>{if(i)return;if(s!==null)clearTimeout(s),s=null;c(h)},f=(h)=>{if(i)return;if(s!=null)clearTimeout(s),s=null;if(qw(h)){Ar("Callback returned another Agent instance %o",h.constructor.name),h.addRequest(r,o);return}if(h){h.once("free",()=>{this.freeSocket(h,o)}),r.onSocket(h);return}let d=Error(`no Duplex stream was returned to agent-base for \`${r.method} ${r.path}\``);c(d)};if(typeof this.callback!=="function"){c(Error("`callback` is not defined"));return}if(!this.promisifiedCallback)if(this.callback.length>=3)Ar("Converting legacy callback function to promise"),this.promisifiedCallback=Hw.default(this.callback);else this.promisifiedCallback=this.callback;if(typeof a==="number"&&a>0)s=setTimeout(l,a);if("port"in o&&typeof o.port!=="number")o.port=Number(o.port);try{Ar("Resolving socket for %o request: %o",o.protocol,`${r.method} ${r.path}`),Promise.resolve(this.promisifiedCallback(r,o)).then(f,u)}catch(h){Promise.reject(h).catch(u)}}freeSocket(r,n){Ar("Freeing socket %o %o",r.constructor.name,n),r.destroy()}destroy(){Ar("Destroying agent %o",this.constructor.name)}}e.Agent=t,e.prototype=e.Agent.prototype})(Hn||(Hn={}));var Kw=Hn,Jw=ze&&ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Yw=Jw(xs),Pr=Yw.default("https-proxy-agent:parse-proxy-response");function Xw(e){return new Promise((t,r)=>{let n=0,o=[];function i(){let f=e.read();if(f)u(f);else e.once("readable",i)}function s(){e.removeListener("end",c),e.removeListener("error",l),e.removeListener("close",a),e.removeListener("readable",i)}function a(f){Pr("onclose had error %o",f)}function c(){Pr("onend")}function l(f){s(),Pr("onerror %o",f),r(f)}function u(f){o.push(f),n+=f.length;let h=Buffer.concat(o,n);if(h.indexOf(`\r
|
|
22
|
+
\r
|
|
23
|
+
`)===-1){Pr("have not received end of HTTP headers yet..."),i();return}let p=h.toString("ascii",0,h.indexOf(`\r
|
|
24
|
+
`)),g=+p.split(" ")[1];Pr("got proxy server response: %o",p),t({statusCode:g,buffered:h})}e.on("error",l),e.on("close",a),e.on("end",c),i()})}var Qw=Xw,ev=Object.defineProperty({default:Qw},"__esModule",{value:!0}),tv=ze&&ze.__awaiter||function(e,t,r,n){function o(i){return i instanceof r?i:new r(function(s){s(i)})}return new(r||(r=Promise))(function(i,s){function a(u){try{l(n.next(u))}catch(f){s(f)}}function c(u){try{l(n.throw(u))}catch(f){s(f)}}function l(u){u.done?i(u.value):o(u.value).then(a,c)}l((n=n.apply(e,t||[])).next())})},pr=ze&&ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},Sc=pr(Nm.default),kc=pr(Dm.default),rv=pr(Ic.default),nv=pr(O.default),ov=pr(xs),iv=pr(ev),Cr=ov.default("https-proxy-agent:agent");class Yu extends Kw.Agent{constructor(e){let t;if(typeof e==="string")t=rv.default.parse(e);else t=e;if(!t)throw Error("an HTTP(S) proxy server `host` and `port` must be specified!");Cr("creating new HttpsProxyAgent instance: %o",t);super(t);let r=Object.assign({},t);if(this.secureProxy=t.secureProxy||uv(r.protocol),r.host=r.hostname||r.host,typeof r.port==="string")r.port=parseInt(r.port,10);if(!r.port&&r.host)r.port=this.secureProxy?443:80;if(this.secureProxy&&!("ALPNProtocols"in r))r.ALPNProtocols=["http 1.1"];if(r.host&&r.path)delete r.path,delete r.pathname;this.proxy=r}callback(e,t){return tv(this,void 0,void 0,function*(){let{proxy:r,secureProxy:n}=this,o;if(n)Cr("Creating `tls.Socket`: %o",r),o=kc.default.connect(r);else Cr("Creating `net.Socket`: %o",r),o=Sc.default.connect(r);let i=Object.assign({},r.headers),a=`CONNECT ${`${t.host}:${t.port}`} HTTP/1.1\r
|
|
25
|
+
`;if(r.auth)i["Proxy-Authorization"]=`Basic ${Buffer.from(r.auth).toString("base64")}`;let{host:c,port:l,secureEndpoint:u}=t;if(!cv(l,u))c+=`:${l}`;i.Host=c,i.Connection="close";for(let g of Object.keys(i))a+=`${g}: ${i[g]}\r
|
|
26
|
+
`;let f=iv.default(o);o.write(`${a}\r
|
|
27
|
+
`);let{statusCode:h,buffered:d}=yield f;if(h===200){if(e.once("socket",av),t.secureEndpoint){let g=t.servername||t.host;if(!g)throw Error('Could not determine "servername"');return Cr("Upgrading socket connection to TLS"),kc.default.connect(Object.assign(Object.assign({},lv(t,"host","hostname","path","port")),{socket:o,servername:g}))}return o}o.destroy();let p=new Sc.default.Socket;return p.readable=!0,e.once("socket",(g)=>{Cr("replaying proxy buffer for failed request"),nv.default(g.listenerCount("data")>0),g.push(d),g.push(null)}),p})}}var sv=Yu;function av(e){e.resume()}function cv(e,t){return Boolean(!t&&e===80||t&&e===443)}function uv(e){return typeof e==="string"?/^https:?$/i.test(e):!1}function lv(e,...t){let r={},n;for(n in e)if(!t.includes(n))r[n]=e[n];return r}var fv=Object.defineProperty({default:sv},"__esModule",{value:!0}),hv=ze&&ze.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},os=hv(fv);function is(e){return new os.default(e)}(function(e){e.HttpsProxyAgent=os.default,e.prototype=os.default.prototype})(is||(is={}));var dv=is,Xu="tmp",pv="degit.json";class dt extends Error{constructor(e,t){super(e);Object.assign(this,t)}}function qn(e,t){try{if(t&&t.clearCache===!0)delete P.cache[P.resolve(e)];return P(e)}catch(r){return null}}function ss(e){return new Promise((t,r)=>{Tm.default.exec(e,(n,o,i)=>{if(n){r(n);return}t({stdout:o,stderr:i})})})}function Kn(e){let t=v.default.dirname(e);if(t===e)return;Kn(t);try{m.default.mkdirSync(e)}catch(r){if(r.code!=="EEXIST")throw r}}function Qu(e,t,r){return new Promise((n,o)=>{let i=e;if(r){let s=Ic.default.parse(e);i={hostname:s.host,path:s.path,agent:new dv(r)}}Rm.default.get(i,(s)=>{let a=s.statusCode;if(a>=400)o({code:a,message:s.statusMessage});else if(a>=300)Qu(s.headers.location,t,r).then(n,o);else s.pipe(m.default.createWriteStream(t)).on("finish",()=>n()).on("error",o)}).on("error",o)})}function mv(e,t){let r=v.default.join(e,Xu);Vr(r),Kn(r),m.default.readdirSync(t).forEach((n)=>{let o=v.default.join(t,n),i=v.default.join(r,n);if(m.default.lstatSync(o).isDirectory())qu(o).to(i),Vr(o);else m.default.copyFileSync(o,i),m.default.unlinkSync(o)})}function gv(e,t){let r=v.default.join(e,Xu);m.default.readdirSync(r).forEach((n)=>{let o=v.default.join(r,n),i=v.default.join(t,n);if(m.default.lstatSync(o).isDirectory())qu(o).to(i),Vr(o);else{if(n!=="degit.json")m.default.copyFileSync(o,i);m.default.unlinkSync(o)}}),Vr(r)}var el=v.default.join(Rw,".degit"),Ec=new Set(["tar","git"]);function tl(e,t){return new rl(e,t)}class rl extends ar.default{constructor(e,t={}){super();if(this.src=e,this.cache=t.cache,this.force=t.force,this.verbose=t.verbose,this.proxy=process.env.https_proxy,this.repo=yv(e),this.mode=t.mode||this.repo.mode,!Ec.has(this.mode))throw Error(`Valid modes are ${Array.from(Ec).join(", ")}`);this._hasStashed=!1,this.directiveActions={clone:async(r,n,o)=>{if(this._hasStashed===!1)mv(r,n),this._hasStashed=!0;let i=Object.assign({force:!0},{cache:o.cache,verbose:o.verbose}),s=tl(o.src,i);s.on("info",(a)=>{console.error(Je.cyan(`> ${a.message.replace("options.","--")}`))}),s.on("warn",(a)=>{console.error(Je.magenta(`! ${a.message.replace("options.","--")}`))}),await s.clone(n).catch((a)=>{console.error(Je.red(`! ${a.message}`)),process.exit(1)})},remove:this.remove.bind(this)}}_getDirectives(e){let t=v.default.resolve(e,pv),r=qn(t,{clearCache:!0})||!1;if(r)m.default.unlinkSync(t);return r}async clone(e){this._checkDirIsEmpty(e);let{repo:t}=this,r=v.default.join(el,t.site,t.user,t.name);if(this.mode==="tar")await this._cloneWithTar(r,e);else await this._cloneWithGit(r,e);this._info({code:"SUCCESS",message:`cloned ${Je.bold(t.user+"/"+t.name)}#${Je.bold(t.ref)}${e!=="."?` to ${e}`:""}`,repo:t,dest:e});let n=this._getDirectives(e);if(n){for(let o of n)await this.directiveActions[o.action](r,e,o);if(this._hasStashed===!0)gv(r,e)}}remove(e,t,r){let n=r.files;if(!Array.isArray(n))n=[n];let o=n.map((i)=>{let s=v.default.resolve(t,i);if(m.default.existsSync(s))if(m.default.lstatSync(s).isDirectory())return Vr(s),i+"/";else return m.default.unlinkSync(s),i;else return this._warn({code:"FILE_DOES_NOT_EXIST",message:`action wants to remove ${Je.bold(i)} but it does not exist`}),null}).filter((i)=>i);if(o.length>0)this._info({code:"REMOVED",message:`removed: ${Je.bold(o.map((i)=>Je.bold(i)).join(", "))}`})}_checkDirIsEmpty(e){try{if(m.default.readdirSync(e).length>0)if(this.force)this._info({code:"DEST_NOT_EMPTY",message:"destination directory is not empty. Using options.force, continuing"});else throw new dt("destination directory is not empty, aborting. Use options.force to override",{code:"DEST_NOT_EMPTY"});else this._verbose({code:"DEST_IS_EMPTY",message:"destination directory is empty"})}catch(t){if(t.code!=="ENOENT")throw t}}_info(e){this.emit("info",e)}_warn(e){this.emit("warn",e)}_verbose(e){if(this.verbose)this._info(e)}async _getHash(e,t){try{let r=await wv(e);if(e.ref==="HEAD")return r.find((n)=>n.type==="HEAD").hash;return this._selectRef(r,e.ref)}catch(r){return this._warn(r),this._verbose(r.original),this._getHashFromCache(e,t)}}_getHashFromCache(e,t){if(e.ref in t){let r=t[e.ref];return this._info({code:"USING_CACHE",message:`using cached commit hash ${r}`}),r}}_selectRef(e,t){for(let r of e)if(r.name===t)return this._verbose({code:"FOUND_MATCH",message:`found matching commit hash: ${r.hash}`}),r.hash;if(t.length<8)return null;for(let r of e)if(r.hash.startsWith(t))return r.hash}async _cloneWithTar(e,t){let{repo:r}=this,n=qn(v.default.join(e,"map.json"))||{},o=this.cache?this._getHashFromCache(r,n):await this._getHash(r,n),i=r.subdir?`${r.name}-${o}${r.subdir}`:null;if(!o)throw new dt(`could not find commit hash for ${r.ref}`,{code:"MISSING_REF",ref:r.ref});let s=`${e}/${o}.tar.gz`,a=r.site==="gitlab"?`${r.url}/repository/archive.tar.gz?ref=${o}`:r.site==="bitbucket"?`${r.url}/get/${o}.tar.gz`:`${r.url}/archive/${o}.tar.gz`;try{if(!this.cache)try{m.default.statSync(s),this._verbose({code:"FILE_EXISTS",message:`${s} already exists locally`})}catch(c){if(Kn(v.default.dirname(s)),this.proxy)this._verbose({code:"PROXY",message:`using proxy ${this.proxy}`});this._verbose({code:"DOWNLOADING",message:`downloading ${a} to ${s}`}),await Qu(a,s,this.proxy)}}catch(c){throw new dt(`could not download ${a}`,{code:"COULD_NOT_DOWNLOAD",url:a,original:c})}vv(e,r,o,n),this._verbose({code:"EXTRACTING",message:`extracting ${i?r.subdir+" from ":""}${s} to ${t}`}),Kn(t),await _v(s,t,i)}async _cloneWithGit(e,t){await ss(`git clone ${this.repo.ssh} ${t}`),await ss(`rm -rf ${v.default.resolve(t,".git")}`)}}var xc=new Set(["github","gitlab","bitbucket","git.sr.ht"]);function yv(e){let t=/^(?:(?:https:\/\/)?([^:/]+\.[^:/]+)\/|git@([^:/]+)[:/]|([^/]+):)?([^/\s]+)\/([^/\s#]+)(?:((?:\/[^/\s#]+)+))?(?:\/)?(?:#(.+))?/.exec(e);if(!t)throw new dt(`could not parse ${e}`,{code:"BAD_SRC"});let r=(t[1]||t[2]||t[3]||"github").replace(/\.(com|org)$/,"");if(!xc.has(r))throw new dt("degit supports GitHub, GitLab, Sourcehut and BitBucket",{code:"UNSUPPORTED_HOST"});let n=t[4],o=t[5].replace(/\.git$/,""),i=t[6],s=t[7]||"HEAD",a=`${r}.${r==="bitbucket"?"org":r==="git.sr.ht"?"":"com"}`,c=`https://${a}/${n}/${o}`,l=`git@${a}:${n}/${o}`,u=xc.has(r)?"tar":"git";return{site:r,user:n,name:o,ref:s,url:c,ssh:l,subdir:i,mode:u}}async function _v(e,t,r=null){return Cy.extract({file:e,strip:r?r.split("/").length:1,C:t},r?[r]:[])}async function wv(e){try{let{stdout:t}=await ss(`git ls-remote ${e.url}`);return t.split(`
|
|
28
|
+
`).filter(Boolean).map((r)=>{let[n,o]=r.split("\t");if(o==="HEAD")return{type:"HEAD",hash:n};let i=/refs\/(\w+)\/(.+)/.exec(o);if(!i)throw new dt(`could not parse ${o}`,{code:"BAD_REF"});return{type:i[1]==="heads"?"branch":i[1]==="refs"?"ref":i[1],name:i[2],hash:n}})}catch(t){throw new dt(`could not fetch remote ${e.url}`,{code:"COULD_NOT_FETCH",url:e.url,original:t})}}function vv(e,t,r,n){let o=qn(v.default.join(e,"access.json"))||{};if(o[t.ref]=new Date().toISOString(),m.default.writeFileSync(v.default.join(e,"access.json"),JSON.stringify(o,null," ")),n[t.ref]===r)return;let i=n[t.ref];if(i){let s=!1;for(let a in n)if(n[a]===r){s=!0;break}if(!s)try{m.default.unlinkSync(v.default.join(e,`${i}.tar.gz`))}catch(a){}}n[t.ref]=r,m.default.writeFileSync(v.default.join(e,"map.json"),JSON.stringify(n,null," "))}bv.base=el;bv.createCommonjsModule=Ce;bv.degit=tl;bv.source=Je;bv.tryRequire=qn});var il=Ra(function(A$,ol){P("fs");P("path");var Ov=nl();P("events");P("stream");P("string_decoder");P("assert");P("buffer");P("zlib");P("util");P("crypto");P("os");P("tty");P("constants");P("https");P("child_process");P("url");P("net");P("tls");ol.exports=Ov.degit});import{existsSync as Iv,readdirSync as zv}from"fs";async function sl(e){let t=e||".";if(Iv(t)){if(zv(t).length>0)console.log(`Directory "${t}" is not empty.`),console.log("Use an empty directory or a new directory name to proceed."),process.exit(1)}console.log(`Scaffolding new MCP app into ${t}...`);try{let o=(await Promise.resolve().then(() => hm(il(),1))).default;await o("Garage4Labs/mcp-app",{cache:!1,force:!0}).clone(t)}catch{if(console.log("degit not available, falling back to git clone..."),await Bun.spawn(["git","clone","--depth=1","https://github.com/Garage4Labs/mcp-app.git",t],{stdout:"inherit",stderr:"inherit"}).exited!==0)console.error("Failed to clone template repository."),process.exit(1);let{rm:s}=await import("fs/promises"),{join:a}=await import("path");await s(a(t,".git"),{recursive:!0,force:!0})}if(console.log(`
|
|
29
|
+
Installing dependencies...`),await Bun.spawn(["bun","install"],{cwd:t,stdout:"inherit",stderr:"inherit"}).exited!==0)console.error("Failed to install dependencies."),process.exit(1);if(console.log(`
|
|
30
|
+
Done! Next steps:`),console.log(""),t!==".")console.log(` cd ${t}`);console.log(" bunx g4lstudio"),console.log("")}var al=()=>{};import{writeFile as Av}from"fs/promises";import{mkdirSync as Pv}from"fs";import{dirname as cl,join as ul}from"path";import{homedir as ll}from"os";function Cv(){return`#!/bin/bash
|
|
31
|
+
|
|
32
|
+
# g4lstudio.ai completion script for bash
|
|
33
|
+
_g4lstudio_completion() {
|
|
34
|
+
local cur prev words cword
|
|
35
|
+
_init_completion || return
|
|
36
|
+
|
|
37
|
+
case $prev in
|
|
38
|
+
--home)
|
|
39
|
+
_filedir -d
|
|
40
|
+
return 0
|
|
41
|
+
;;
|
|
42
|
+
*)
|
|
43
|
+
COMPREPLY=($(compgen -W "init auth api tools orgs backfill-assets completion --help --version --home --target --org --json" -- "$cur"))
|
|
44
|
+
;;
|
|
45
|
+
esac
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
complete -F _g4lstudio_completion g4lstudio
|
|
49
|
+
`}function Rv(){return`#compdef g4lstudio
|
|
50
|
+
|
|
51
|
+
_g4lstudio() {
|
|
52
|
+
local context state state_descr line
|
|
53
|
+
typeset -A opt_args
|
|
54
|
+
|
|
55
|
+
_arguments -C \\
|
|
56
|
+
'1: :_g4lstudio_commands' \\
|
|
57
|
+
'--home[Data directory]:directory:_directories' \\
|
|
58
|
+
'-h[Show help]' \\
|
|
59
|
+
'--help[Show help]' \\
|
|
60
|
+
'-v[Show version]' \\
|
|
61
|
+
'--version[Show version]' \\
|
|
62
|
+
'*:: :->args'
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
_g4lstudio_commands() {
|
|
66
|
+
local commands
|
|
67
|
+
commands=(
|
|
68
|
+
'init:Scaffold a new MCP app'
|
|
69
|
+
'auth:Manage CLI authentication'
|
|
70
|
+
'api:Make an authenticated API request'
|
|
71
|
+
'tools:List, inspect, and call tools'
|
|
72
|
+
'orgs:List organizations'
|
|
73
|
+
'backfill-assets:Hoist legacy inline media'
|
|
74
|
+
'completion:Install shell completion'
|
|
75
|
+
)
|
|
76
|
+
_describe 'commands' commands
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
_g4lstudio "$@"
|
|
80
|
+
`}async function fl(e){let t=e||process.env.SHELL?.split("/").pop()||"bash",r,n;switch(t){case"bash":{r=Cv(),n=ul(ll(),".local/share/bash-completion/completions/g4lstudio");break}case"zsh":{r=Rv(),n=ul(ll(),".zsh/completions/_g4lstudio");break}default:console.error(`Unsupported shell: ${t}`),console.log("Supported shells: bash, zsh"),process.exit(1)}if(Pv(cl(n),{recursive:!0}),await Av(n,r,"utf8"),console.log(`Completion script installed to: ${n}`),console.log(""),t==="bash")console.log("To enable completions, add to your ~/.bashrc:"),console.log(` source "${n}"`);else console.log("To enable completions, add to your ~/.zshrc:"),console.log(` fpath=("${cl(n)}" $fpath)`),console.log(" autoload -U compinit && compinit");console.log(""),console.log("Then restart your shell.")}var hl=()=>{};async function dl(){console.error("backfill-assets roda dentro do cont\xEAiner do Studio, n\xE3o na CLI do npm."),process.exit(1)}async function pl(e){let t,r,n=new Promise((s,a)=>{t=s,r=a});n.catch(()=>{});let o=!1,i=Bun.serve({port:e.port??0,hostname:"127.0.0.1",fetch(s){if(o)return new Response("",{status:204});let a=new URL(s.url),c=a.searchParams.get("code");if(a.searchParams.get("state")!==e.expectedState)return o=!0,r(Error("OAuth state mismatch")),new Response("State mismatch \u2014 close this tab.",{status:400});if(!c)return o=!0,r(Error("OAuth callback missing code")),new Response("Missing code \u2014 close this tab.",{status:400});return o=!0,t({code:c}),new Response(null,{status:302,headers:{location:e.successRedirectUrl}})}});return{url:`http://127.0.0.1:${i.port}`,waitForCallback:()=>n,close:()=>i.stop(!0)}}import{createHash as Tv,randomBytes as Nv}from"crypto";function gl(){let e=ml(Nv(32)),t=ml(Tv("sha256").update(e).digest());return{verifier:e,challenge:t}}function ml(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}var yl=()=>{};async function _l(e,t=fetch,r=Date.now){if(!e.refreshToken)throw new Ae("invalid_grant","Session has no refresh token");let n=new URLSearchParams({grant_type:"refresh_token",refresh_token:e.refreshToken,client_id:e.clientId}),o;try{o=await t(`${e.target}/api/auth/mcp/token`,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:n.toString(),signal:AbortSignal.timeout(Dv)})}catch(l){throw new Ae("transient",l instanceof Error?l.message:String(l))}if(!o.ok){let l=await o.text().catch(()=>"");if(o.status>=400&&o.status<500&&o.status!==429)throw new Ae("invalid_grant",`HTTP ${o.status} ${l}`);throw new Ae("transient",`HTTP ${o.status} ${l}`)}let i;try{i=await o.json()}catch(l){throw new Ae("transient",`Token endpoint returned a non-JSON body: ${l instanceof Error?l.message:String(l)}`)}if(typeof i!=="object"||i===null)throw new Ae("transient","Token endpoint returned a non-object JSON body");if(typeof i.access_token!=="string"||!i.access_token)throw new Ae("transient","Token endpoint returned no access_token");let s=Number(i.expires_in),a=Number.isFinite(s)&&s>0&&s<=Os?Math.floor(r()/1000)+s:e.expiresAt,c=typeof i.refresh_token==="string"&&i.refresh_token?i.refresh_token:e.refreshToken;return{...e,accessToken:i.access_token,refreshToken:c,expiresAt:a}}var Ae,Dv=1e4,Os=3153600000;var so=A(()=>{Ae=class Ae extends Error{kind;constructor(e,t){super(t);this.name="RefreshFailedError",this.kind=e}}});import{chmod as Lv,mkdir as Zv,readdir as Fv,readFile as Mv,rename as jv,rm as wl,writeFile as Bv}from"fs/promises";import{dirname as Uv,join as bl}from"path";function Is(e,t){return bl(e,`session.${Vv(t)}.json`)}function Vv(e){let t=e;try{t=new URL(e).host}catch{}return t.replace(/[^a-zA-Z0-9.-]/g,"_")||"default"}async function vl(e){try{let t=await Mv(e,"utf8"),r=JSON.parse(t);if(!Gv(r))return null;return r}catch{return null}}async function $l(e){try{return(await Fv(e)).filter((r)=>/^session\..+\.json$/.test(r)).map((r)=>bl(e,r))}catch{return[]}}async function ao(e,t){if(t)return vl(Is(e,t));for(let r of await $l(e)){let n=await vl(r);if(n)return n}return null}async function co(e,t){let r=Is(e,t.target);await Zv(Uv(r),{recursive:!0});let n=`${r}.tmp`;await Bv(n,JSON.stringify(t,null,2),{mode:384}),await Lv(n,384),await jv(n,r)}async function uo(e,t){if(t){await wl(Is(e,t),{force:!0});return}for(let r of await $l(e))await wl(r,{force:!0})}function Gv(e){if(!e||typeof e!=="object")return!1;let t=e;if(typeof t.target!=="string"||typeof t.clientId!=="string"||typeof t.accessToken!=="string"||typeof t.createdAt!=="string")return!1;if(!t.user||typeof t.user!=="object")return!1;if(typeof t.user.sub!=="string")return!1;if(t.refreshToken!==void 0&&typeof t.refreshToken!=="string")return!1;if(t.expiresAt!==void 0&&typeof t.expiresAt!=="number")return!1;return!0}var lo=()=>{};import{spawn as Wv}from"child_process";import{randomUUID as Hv}from"crypto";async function Jv(e={}){let t=(e.target??qv).replace(/\/$/,""),r=e.fetch??fetch,n=e.openBrowser??eb,o=Hv(),i=gl(),s=await pl({expectedState:o,successRedirectUrl:`${t}/cli/auth-success`});try{let a=`${s.url}/`,c=await Yv(r,t,a),l=new URLSearchParams({client_id:c,redirect_uri:a,response_type:"code",state:o,scope:Kv,code_challenge:i.challenge,code_challenge_method:"S256"}),u=`${t}/login?${l.toString()}`;console.log(`Opening ${u} in your browser...`),await n(u);let{code:f}=await s.waitForCallback(),h=await Xv(r,t,c,f,a,i.verifier);if(!h.id_token)throw Error("Token endpoint returned no id_token");let d=Qv(h.id_token);return{target:t,clientId:c,user:{sub:d.sub,email:d.email,name:d.name},accessToken:h.access_token,refreshToken:h.refresh_token,expiresAt:Number.isFinite(h.expires_in)&&h.expires_in>0&&h.expires_in<=Os?Math.floor(Date.now()/1000)+h.expires_in:void 0,createdAt:new Date().toISOString()}}finally{s.close()}}async function Sl(e){try{let t=await Jv({target:e.target,openBrowser:e.openBrowser,fetch:e.fetch});return await co(e.dataDir,t),console.log(`Logged in as ${t.user.email??t.user.sub}.`),0}catch(t){return console.error(`Login failed: ${t instanceof Error?t.message:String(t)}`),1}}async function Yv(e,t,r){let n=await e(`${t}/api/auth/mcp/register`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({client_name:"g4lstudio-cli",redirect_uris:[r],grant_types:["authorization_code","refresh_token"],response_types:["code"],token_endpoint_auth_method:"none",application_type:"native"})});if(!n.ok)throw Error(`Client registration failed: HTTP ${n.status} ${await n.text().catch(()=>"")}`);let o=await n.json();if(typeof o?.client_id!=="string")throw Error("Client registration returned no client_id");return o.client_id}async function Xv(e,t,r,n,o,i){let s=new URLSearchParams({grant_type:"authorization_code",code:n,redirect_uri:o,client_id:r,code_verifier:i}),a=await e(`${t}/api/auth/mcp/token`,{method:"POST",headers:{"content-type":"application/x-www-form-urlencoded"},body:s.toString()});if(!a.ok)throw Error(`Token exchange failed: HTTP ${a.status} ${await a.text().catch(()=>"")}`);let c=await a.json();if(typeof c?.access_token!=="string")throw Error("Token endpoint returned no access_token");return c}function Qv(e){let t=e.split(".");if(t.length!==3||!t[1])throw Error("id_token is not a valid JWT");let r=JSON.parse(Buffer.from(t[1],"base64url").toString("utf8"));if(typeof r.sub!=="string")throw Error("id_token has no sub claim");return{sub:r.sub,email:typeof r.email==="string"?r.email:void 0,name:typeof r.name==="string"?r.name:void 0}}async function eb(e){let t,r;switch(process.platform){case"darwin":t="open",r=[e];break;case"win32":t="cmd",r=["/c","start","",e];break;default:t="xdg-open",r=[e];break}await new Promise((n)=>{let o=Wv(t,r,{stdio:"ignore",detached:!0});o.on("error",()=>{console.log(`Could not open browser automatically. Please open this URL manually:
|
|
81
|
+
${e}`),n()}),o.on("spawn",()=>{o.unref(),n()})})}var qv="https://app.g4lstudio.ai",Kv="openid profile email offline_access";var kl=A(()=>{yl();so();lo()});async function El(e){let t=await ao(e.dataDir,e.target);if(!t)return null;let r=e.now??Date.now;if(!rb(t,r()))return t;try{let n=await _l(t,e.fetch,r);return await co(e.dataDir,n),n}catch(n){if(n instanceof Ae&&n.kind==="invalid_grant")return await uo(e.dataDir,t.target),null;throw n}}function rb(e,t){if(e.expiresAt===void 0)return!1;let r=Math.floor(t/1000);return e.expiresAt-tb<r}var tb=60;var xl=A(()=>{so();lo()});function Il(e){return e?`g4lstudio auth login --target ${e}`:"g4lstudio auth login"}async function je(e){let t=Il(e.target),r;try{r=await El(e)}catch(n){if(n instanceof Ae&&n.kind==="transient")return console.error(`Could not refresh session: ${n.message}. Run \`${t}\` to authenticate.`),null;throw n}if(!r)console.error(`Not logged in. Run \`${t}\` to authenticate.`);return r}async function fo(e,t=nb){if(e===void 0)return;if(e==="@-")return{bytes:await t(),contentType:Ol};if(e.startsWith("@")){let r=Bun.file(e.slice(1));return{bytes:new Uint8Array(await r.arrayBuffer()),contentType:r.type}}return{bytes:e,contentType:Ol}}async function Dt(e,t,r){let n=new URL(e.target).origin,o=new URL(t,e.target);if(!t.startsWith("/")||o.origin!==n)throw Error(`Path must start with "/" and stay on ${n}; got "${t}".`);let i=new Headers(r.headers);if(r.body&&!i.has("content-type"))i.set("content-type",r.body.contentType);return i.set("authorization",`Bearer ${e.accessToken}`),(r.fetch??fetch)(o,{method:r.method,headers:i,body:r.body?.bytes})}async function Lt(e,t,r=ob){if(!e.ok){if(console.error(`HTTP ${e.status} ${e.statusText}`.trim()),e.status===401)console.error(`Run \`${Il(t.target)}\` to authenticate again.`)}if(e.body)for await(let n of e.body)await r(n);return e.ok?0:1}function Kr(e){return e instanceof Error?e.message:String(e)}async function nb(){return new Uint8Array(await Bun.stdin.arrayBuffer())}function ob(e){return new Promise((t,r)=>{process.stdout.write(e,(n)=>n?r(n):t())})}var Ol="application/json";var mr=A(()=>{xl();so()});async function zl(e){let t=await je(e);if(!t)return 1;return console.log(`Target: ${t.target}`),console.log(`User: ${t.user.email??t.user.sub}`),0}var Al=A(()=>{mr()});async function Pl(e){let t=await je(e);if(!t)return 1;return console.log(t.accessToken),0}var Cl=A(()=>{mr()});async function Rl(e){if(!await ao(e.dataDir,e.target))return console.log("Already logged out."),0;return await uo(e.dataDir,e.target),console.log("Logged out."),0}var Tl=A(()=>{lo()});async function Nl(e){if(!e.path)return console.error(ib),1;let t=new Headers;for(let o of e.headers??[]){let i=o.indexOf(":");if(i<=0)return console.error(`Invalid header "${o}". Use "Name: value".`),1;try{t.append(o.slice(0,i).trim(),o.slice(i+1).trim())}catch(s){return console.error(`Invalid header "${o}": ${Kr(s)}`),1}}let r=await je(e);if(!r)return 1;let n;try{let o=await fo(e.data,e.readStdin),i=(e.method??(o===void 0?"GET":"POST")).trim().toUpperCase();n=await Dt(r,e.path,{method:i,headers:t,body:o,fetch:e.fetch})}catch(o){return console.error(Kr(o)),1}return Lt(n,r,e.output)}var ib="Usage: g4lstudio api <path> [-X <method>] [-d <data|@file|@->] [-H 'Name: value']";var Dl=A(()=>{mr()});function Xr(e){let t=Object.values(e).filter((n)=>typeof n==="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function As(e,t="|"){return e.map((r)=>Rs(r)).join(t)}function Qr(e,t){if(typeof t==="bigint")return t.toString();return t}class Ll{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;if(e!==void 0)this._value=e(),this._getter=void 0;return this._value}}function ho(e){return new Ll(e)}function Zl(e){return e===null||e===void 0}function po(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function Be(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function mo(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function Qe(e){return mo(e._zod.def)??e._zod.def.shape}function Fl(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return Be(this,t,n),n},enumerable:!0,configurable:!0})}function Ml(e,t,r){if(t in e)Be(e,t,r);else e[t]=r}function Zt(e,t,r,n){let o=Qe(t);for(let i of r){let s=Object.getOwnPropertyDescriptor(o,i);if(!s.enumerable)continue;if(s.get)Fl(e,i,()=>{let a=t._zod.def.shape[i];return n?n(a,i):a});else Ml(e,i,n?n(s.value,i):s.value)}}function sb(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);if(!n.enumerable)continue;if(n.get)Fl(e,r,()=>t[r]);else Ml(e,r,n.value)}}function ve(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function jl(e){return JSON.stringify(e)}function Bl(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}function Yr(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function gr(e){if(Yr(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;if(typeof t!=="function")return!0;let r=t.prototype;if(Yr(r)===!1)return!1;if(Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)return!1;return!0}function Cs(e){if(gr(e))return{...e};if(Array.isArray(e))return[...e];if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);return e}function yr(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ue(e,t,r){let n=new e._zod.constr(t??e._zod.def);if(!t||r?.parent)n._zod.parent=e;return n}function E(e){let t=e;if(!t)return{};if(typeof t==="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}if(delete t.message,typeof t.error==="string")return{...t,error:()=>t.error};return t}function Rs(e){if(typeof e==="bigint")return e.toString()+"n";if(typeof e==="string")return`"${e}"`;return`${e}`}function Gl(e){return Object.keys(e).filter((t)=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}function ab(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".pick() cannot be used on object schemas containing refinements");let i={};return Zt(i,e,go(e,t)),Ue(e,ve(r,{shape:i,checks:[]}))}function go(e,t){let r=Qe(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw Error(`Unrecognized key: "${String(o)}"`);if(t[o])n.push(o)}return n}function cb(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(go(e,t)),s={};return Zt(s,e,Reflect.ownKeys(Qe(e)).filter((a)=>!i.has(a))),Ue(e,ve(r,{shape:s,checks:[]}))}function ub(e,t){if(!gr(t))throw Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=Qe(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return Ue(e,ve(e._zod.def,{shape:Wl(e,t)}))}function Wl(e,t){let r={};return Zt(r,e,Reflect.ownKeys(Qe(e))),sb(r,t),r}function lb(e,t){if(!gr(t))throw Error("Invalid input to safeExtend: expected a plain object");return Ue(e,ve(e._zod.def,{shape:Wl(e,t)}))}function fb(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};Zt(r,e,Reflect.ownKeys(Qe(e))),Zt(r,t,Reflect.ownKeys(Qe(t)));let n=ve(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ue(e,n)}function Hl(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${n}() cannot be used on object schemas containing refinements`);let a=r?new Set(go(t,r)):void 0,c={};return Zt(c,t,Reflect.ownKeys(Qe(t)),e&&((l,u)=>a&&!a.has(u)?l:new e({type:"optional",innerType:l}))),Ue(t,ve(t._zod.def,{shape:c,checks:[]}))}function hb(e,t,r){let n=r?new Set(go(t,r)):void 0,o={};return Zt(o,t,Reflect.ownKeys(Qe(t)),(i,s)=>n&&!n.has(s)?i:new e({type:"nonoptional",innerType:i})),Ue(t,ve(t._zod.def,{shape:o}))}function Ve(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function ql(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function yo(e,t){return t.map((r)=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function Jr(e){return typeof e==="string"?e:e?.message}function Ds(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;if(o>=0)t.push([o,r])}return t}function _o(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function yt(e,t,r){var n;let o=e.inst?._zod?.traits;if(o?.has("$ZodType"))if(o.has("$ZodCheck"))(n=e).schema??(n.schema=e.inst);else e.schema=e.inst;let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,s=e.message?e.message:Jr(e.inst?._zod.def?.error?.(e))??Jr(i?.(e))??Jr(t?.error?.(e))??Jr(r.customError?.(e))??Jr(r.localeError?.(e))??"Invalid input",a={};for(let c of Object.keys(e)){if(c==="inst"||c==="schema"||c==="continue"||c==="input"||c==="__proto__")continue;a[c]=e[c]}if(a.path??(a.path=[]),a.message=s,t?.reportInput)a.input=e.input;return a}function wo(e){let t=e.length;if(!db.test(e))return t;let r=t;for(let n=0;n<t-1;n++)if((e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320)r--,n++;return r}function vo(e){if(Array.isArray(e))return"array";if(typeof e==="string")return"string";return"unknown"}function Kl(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function Ft(...e){let[t,r,n]=e;if(typeof t==="string")return{message:t,code:"custom",input:r,inst:n};return{...t}}function Jl(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);if(n.get)Object.defineProperty(e,r,{...n,enumerable:!1});else mb(e,r,n.value)}}function et(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function bo(e,t,r){return et(e,t,r,!1)}function pb(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return et(this,r,n(this))},set(o){et(this,r,o)}})}return t}function mb(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:et(this,t,r.bind(this))},set(n){et(this,t,n)}})}function gb(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}function F(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&zs!==e._zod){zs=void 0;return}zs=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,yb);let o=gt;gt=!1;try{let i=r(this);if(gt)delete this[t];else Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i});return gt=gt||o,i}catch(i){throw delete this[t],gt=gt||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function _b(e,t,r,n){let o=gb(e,t);if(!o)return;Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}function Yl(e){let t=()=>e;return t[wb]=!0,t}var Ps,Ul,Vl,Ts,Ns,db,zs,gt=!1,yb,wb="~constantCatch";var ge=A(()=>{Mt();Ps="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};Ul=ho(()=>{if(be.jitless)return!1;if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});Vl=new Set(["string","number","symbol"]);Ts=(()=>({safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-340282346638528860000000000000000000000,340282346638528860000000000000000000000],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]}))(),Ns={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};db=/[\uD800-\uDBFF]/;yb={configurable:!0,get(){gt=!0;return}}});function vb(e){let t=Ql;if(t){let r=t.stackTraceLimit;if(typeof r==="number"){try{t.stackTraceLimit=0}catch{return Ql=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function _(e,t,r,n){let o={};function i(h){this.def=h,this.constr=f,this.traits=new Set}i.prototype=o;let s=r,a=s&&new WeakSet;function c(h,d){if(!h._zod){Ls.value=new i(d);try{Object.defineProperty(h,"_zod",Ls)}finally{Ls.value=void 0}}else if(h._zod.traits.has(e))return;if(h._zod.traits.add(e),t(h,d),a){let g=Object.getPrototypeOf(h),y=h._zod.constr.prototype,b=g;while(b&&b!==y)b=Object.getPrototypeOf(b);let S=b??g;if(!a.has(S))a.add(S),Jl(S,s)}let p=f.prototype;for(let g in p){if(!Object.prototype.hasOwnProperty.call(p,g))continue;if(!(g in h))h[g]=p[g].bind(h)}}let l=n?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function f(h){let d=n?.Parent?vb(u):this;c(d,h);let p=d._zod.deferred;if(p){for(let y of p)y();d._zod.deferred=void 0}let g=globalThis.__zod_globalConfig?.postProcessor;if(g)g(d);return d}return Object.defineProperty(f,"init",{value:c}),Object.defineProperty(f,Symbol.hasInstance,{value:(h)=>{if(n?.Parent&&h instanceof n.Parent)return!0;return h?._zod?.traits?.has(e)}}),Object.defineProperty(f,"name",{value:e}),f}function Te(e){if(e)Object.assign(be,e);return be}var Xl,Ls,Ql,Ge,en,be;var Mt=A(()=>{ge();Ls={value:void 0,enumerable:!1},Ql="captureStackTrace"in Error?Error:null;Ge=class Ge extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};en=class en extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`);this.name="ZodEncodeError"}};(Xl=globalThis).__zod_globalConfig??(Xl.__zod_globalConfig={});be=globalThis.__zod_globalConfig});function bb(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,Qr,2)),e.message}function $b(e){this._zod.message=e}function kb(e,t,r){if(!Object.prototype.hasOwnProperty.call(e,t))if(t==="__proto__")Object.defineProperty(e,t,{value:r(),writable:!0,enumerable:!0,configurable:!0});else e[t]=r();return e[t]}function nf(e,t=(r)=>r.message){let r={},n=[];for(let o of e.issues)if(o.path.length>0)kb(r,o.path[0],()=>[]).push(t(o));else n.push(t(o));return{formErrors:n,fieldErrors:r}}function of(e,t=(r)=>r.message){let r={_errors:[]},n=(o,i=[])=>{for(let s of o.issues)if(s.code==="invalid_union"&&s.errors.length)s.errors.map((a)=>n({issues:a},[...i,...s.path]));else if(s.code==="invalid_key")n({issues:s.issues},[...i,...s.path]);else if(s.code==="invalid_element")n({issues:s.issues},[...i,...s.path]);else{let a=[...i,...s.path];if(a.length===0)r._errors.push(t(s));else{let c=r,l=0;while(l<a.length){let u=a[l],f=l===a.length-1;if(u==="_errors"){if(f)c._errors.push(t(s));l++;continue}if(!Object.prototype.hasOwnProperty.call(c,u))Object.defineProperty(c,u,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let h=c[u];if(f)h._errors.push(t(s));c=h,l++}}}};return n(e),r}var Sb,Fs,ef,tf=(e,t)=>{e.name="$ZodError",Fs.value=t,Object.defineProperty(e,"issues",Fs),Fs.value=void 0,Object.defineProperty(e,"message",Sb);let r=Object.getPrototypeOf(e);if(!ef.has(r))ef.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}})},rf,gS;var sf=A(()=>{Mt();ge();Sb={get:bb,set:$b,enumerable:!0,configurable:!0},Fs={value:void 0,enumerable:!1},ef=new WeakSet([Object.prototype,Error.prototype]),rf=_("$ZodError",tf),gS=_("$ZodError",tf,void 0,{Parent:Error})});function $o(e,t){return{callee:t?.callee??e,Err:t?.Err}}function af(e,t,r){let n;return{success:!1,get error(){if(!n)n=new e(t.map((o)=>yt(o,r,Te()))),t=void 0,r=void 0;return n},set error(o){n=o,t=void 0,r=void 0}}}function Ob(e,t,r){let n=r?{...r,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},o=e._zod.bag.fallbackRun,i;if(o)n[xb]=!0,i=o({value:t,issues:[]},n);else i=e._zod.run({value:t,issues:[]},n);if(i instanceof Promise)throw new Ge;return i.issues.length===0}var So=(e)=>{let t=(r,n,o,i)=>{let s=o?{...o,async:!1}:{async:!1},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise)throw new Ge;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>yt(l,s,Te())));throw Ps(c,i?.callee??t),c}return a.value};return t},ko=(e)=>{let t=async(r,n,o,i)=>{let s=o?{...o,async:!0}:{async:!0},a=r._zod.run({value:n,issues:[]},s);if(a instanceof Promise)a=await a;if(a.issues.length){let c=new(i?.Err??e)(a.issues.map((l)=>yt(l,s,Te())));throw Ps(c,i?.callee??t),c}return a.value};return t},Eo=(e)=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new Ge;return i.issues.length?af(e,i.issues,o):{success:!0,data:i.value}},xo=(e)=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)i=await i;return i.issues.length?af(e,i.issues,o):{success:!0,data:i.value}},Eb,xb,Ms=(e,t,r)=>{let n=e._zod.bag.validator;if(n!==void 0){if(n(t)!==Eb)return!0;if(n.definite===!0&&r===void 0)return!1}return Ob(e,t,r)},js=async(e,t,r)=>{let n=r?{...r,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},o=e._zod.run({value:t,issues:[]},n);if(o instanceof Promise)o=await o;return o.issues.length===0},cf=(e)=>{let t=So(e),r=(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return t(n,o,a,$o(r,s))};return r},uf=(e)=>{let t=So(e),r=(n,o,i,s)=>t(n,o,i,$o(r,s));return r},lf=(e)=>{let t=ko(e),r=async(n,o,i,s)=>{let a=i?{...i,direction:"backward"}:{direction:"backward"};return await t(n,o,a,$o(r,s))};return r},ff=(e)=>{let t=ko(e),r=async(n,o,i,s)=>await t(n,o,i,$o(r,s));return r},hf=(e)=>(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return Eo(e)(t,r,o)},df=(e)=>(t,r,n)=>Eo(e)(t,r,n),pf=(e)=>async(t,r,n)=>{let o=n?{...n,direction:"backward"}:{direction:"backward"};return xo(e)(t,r,o)},mf=(e)=>async(t,r,n)=>xo(e)(t,r,n);var gf=A(()=>{Mt();ge();Eb=Symbol.for("zod.compile.invalid"),xb=Symbol.for("zod.compile.fallback")});function Sf(e){return new RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}function Of(){return new RegExp(Ib,"u")}function zb(e){return new RegExp(`^${e}$`)}function Bs(e){return typeof e.precision==="number"?e.precision===-1?"(?:[01]\\d|2[0-3]):[0-5]\\d":e.precision===0?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d":`(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?"(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?":"(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?"}function Zf(e){return new RegExp(`^${Bs(e)}$`)}function Ff(e){let t=["Z"];if(e.offset)t.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${Bs({precision:e.precision,seconds:!0})}(?:${t.join("|")})`,n=e.local?`${r}|${Bs({precision:e.precision})}`:r;return new RegExp(`^${Df}T(?:${n})$`)}var yf,_f,wf,vf,bf,$f,kf,Ef,Us=(e)=>{if(!e)return/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`)},xf,Ib="^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$",If,zf,Af,Pf,Cf,Rf,Tf,Nf,Df="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Lf,Mf,jf,Bf;var rn=A(()=>{yf=/^[cC][0-9a-z]{6,}$/,_f=/^[0-9a-z]+$/,wf=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,vf=/^[0-9a-vA-V]{20}$/,bf=/^[A-Za-z0-9]{27}$/,$f=/^[a-zA-Z0-9_-]{21}$/;kf=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Ef=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,xf=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;If=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,zf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Af=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Pf=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Cf=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rf=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,Tf=/^https?$/,Nf=/^\+[1-9]\d{6,14}$/;Lf=zb(Df);Mf=/^[\s\S]{0,}$/,jf=/^[^A-Z]*$/,Bf=/^[^a-z]*$/});var $e,Vs=(e)=>{let t=e.value;return!Zl(t)&&t.length!==void 0},Uf,Vf,Gf,nn,Wf,Hf,qf,Kf,Jf,Yf,Xf;var Oo=A(()=>{Mt();rn();ge();$e=_("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])}),Uf=_("$ZodCheckMaxLength",(e,t)=>{var r;$e.init(e,t),(r=e._zod.def).when??(r.when=Vs),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>t.maximum?wo(o):i)<=t.maximum)return;let a=vo(o);n.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Vf=_("$ZodCheckMinLength",(e,t)=>{var r;$e.init(e,t),(r=e._zod.def).when??(r.when=Vs),e._zod.check=(n)=>{let o=n.value,i=o.length;if((typeof o==="string"&&i>=t.minimum&&i<t.minimum*2?wo(o):i)>=t.minimum)return;let a=vo(o);n.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Gf=_("$ZodCheckLengthEquals",(e,t)=>{var r;$e.init(e,t),(r=e._zod.def).when??(r.when=Vs),e._zod.check=(n)=>{let o=n.value,i=o.length,s=typeof o==="string"&&i>=t.length&&i<=t.length*2?wo(o):i;if(s===t.length)return;let a=vo(o),c=s>t.length;n.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),nn=_("$ZodCheckStringFormat",(e,t)=>{var r,n;if($e.init(e,t),t.pattern)(r=e._zod).check??(r.check=(o)=>{if(t.pattern.lastIndex=0,t.pattern.test(o.value))return;o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})});else(n=e._zod).check??(n.check=()=>{})}),Wf=_("$ZodCheckRegex",(e,t)=>{nn.init(e,t),e._zod.check=(r)=>{if(t.pattern.lastIndex=0,t.pattern.test(r.value))return;r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Hf=_("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=jf),nn.init(e,t)}),qf=_("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Bf),nn.init(e,t)}),Kf=_("$ZodCheckIncludes",(e,t)=>{$e.init(e,t);let r=yr(t.includes),n=new RegExp(typeof t.position==="number"?`^.{${t.position},}${r}`:r);t.pattern=n,e._zod.check=(o)=>{if(o.value.includes(t.includes,t.position))return;o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),Jf=_("$ZodCheckStartsWith",(e,t)=>{$e.init(e,t);let r=new RegExp(`^${yr(t.prefix)}.*`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.startsWith(t.prefix))return;n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Yf=_("$ZodCheckEndsWith",(e,t)=>{$e.init(e,t);let r=new RegExp(`.*${yr(t.suffix)}$`);t.pattern??(t.pattern=r),e._zod.check=(n)=>{if(n.value.endsWith(t.suffix))return;n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Xf=_("$ZodCheckOverwrite",(e,t)=>{$e.init(e,t),e._zod.check=(r)=>{r.value=t.tx(r.value)}})});class Gs{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{this.indent-=1}}write(e){if(typeof e==="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
|
|
82
|
+
`).filter((i)=>i),n=Math.min(...r.map((i)=>i.length-i.trimStart().length)),o=r.map((i)=>i.slice(n)).map((i)=>" ".repeat(this.indent*2)+i);for(let i of o)this.content.push(i)}compile(){let e=Function,t=this?.content??[""];return new e(...Object.keys(this.closed),`return function (${this.args.join(", ")}) {
|
|
83
|
+
${t.join(`
|
|
84
|
+
`)}
|
|
85
|
+
};`)(...Object.values(this.closed))}}var eh;var Ws=A(()=>{eh={major:4,minor:6,patch:7}});async function Cb(e,t){let r={async:!0};return fh(await e._zod.run({value:t,issues:[]},r),r)}function qs(e){return{validate:(t)=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return fh(n,r)}catch(n){}return Cb(e,t)},vendor:"zod",version:1}}function gh(e){try{if(typeof URL<"u"&&typeof URL.canParse==="function")return URL.canParse(e);return new URL(e),!0}catch{return!1}}function Rb(e,t){if(!("normalize"in t)&&!("hostname"in t)&&!("protocol"in t))return gh(e)||zo;return Tb(e,t)}function Tb(e,t){if(!t.normalize&&t.protocol?.source===Tf.source&&!/^https?:\/\//i.test(e))return mh;try{if(typeof URL<"u"){let r=URL;if(typeof r.parse==="function")return r.parse(e)??zo}return new URL(e)}catch{return zo}}function th(e){return e.replace(Nb,"")}function Db(e,t){return t.lastIndex=0,t.test(e.hostname)}function Lb(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(":")?e.protocol.slice(0,-1):e.protocol)}function Ah(e){if(!Zb.test(e))return!1;return gh(`http://[${e}]`)}function Fb(e){let t=e.split("/");if(t.length!==2)return!1;let[r,n]=t;if(!n)return!1;let o=Number(n);if(`${o}`!==n)return!1;if(o<0||o>128)return!1;return Ah(r)}function Th(e){if(e==="")return!0;if(/\s/.test(e))return!1;if(e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}function Mb(e){if(!Co.test(e))return!1;let t=e.replace(/[-_]/g,(n)=>n==="-"?"+":"/"),r=t.padEnd(Math.ceil(t.length/4)*4,"=");return Th(r)}function jb(e,t=null){try{let r=e.split(".");if(r.length!==3)return!1;let[n]=r;if(!n)return!1;let o=JSON.parse(atob(n));if("typ"in o&&o?.typ!=="JWT")return!1;if(!o.alg)return!1;if(t&&(!("alg"in o)||o.alg!==t))return!1;return!0}catch{return!1}}function Bb(e,t){let r=Ds(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map((i)=>i[0])),o=e._zod.parse;e._zod.parse=(i,s)=>{let a=t(i.value);if(a>n&&!s?.skipChecks&&s?.direction!=="backward"){for(let[c,l]of Ds(e._zod.def.checks))if(a>c&&l._zod.def.when(i)){let u=i.issues.length;return l._zod.check(i),i.issues[u].continue=!1,_o(i.issues,u,e),i}}return o(i,s)}}function rh(e,t,r){if(e.issues.length)t.issues.push(...yo(r,e.issues));t.value[r]=e.value}function Ao(e,t,r,n,o,i){let s=r in n,a=i==="optional";if(!s&&a&&o==="optional")return;if(e.issues.length){if(o!==void 0&&a&&!s)return;t.issues.push(...yo(r,e.issues))}if(!s&&o===void 0){if(!e.issues.length)t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}if(e.value===void 0){if(s||o==="defaulted"&&!a)t.value[r]=void 0}else t.value[r]=e.value}function Bh(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Vb,o=n.length?[...t,...n]:t;for(let s of o)if(!e.shape?.[s]?._zod?.traits?.has("$ZodType"))throw Error(`Invalid element at key "${String(s)}": expected a Zod schema`);let i=Gl(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Uh(e,t,r,n,o,i,s){let a=[],c=o.keySet,l=o.catchall._zod,u=l.def.type,{optin:f,optout:h}=l,d=0;for(let p in t){if(s&&r.issues.length!==d){if(Ve(r,d))break;d=r.issues.length}if(c.has(p))continue;if(p==="__proto__"){if(u==="never")a.push(p);continue}if(u==="never"){a.push(p);continue}let g=l.run({value:t[p],issues:[]},n);if(g instanceof Promise)e.push(g.then((y)=>Ao(y,r,p,t,f,h)));else Ao(g,r,p,t,f,h)}if(a.length)r.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i,continue:!0});if(!e.length)return r;return Promise.all(e).then(()=>r)}function nh(e,t,r,n){for(let i of e)if(i.issues.length===0)return t.value=i.value,t;let o=e.filter((i)=>!Ve(i));if(o.length===1)return t.value=o[0].value,o[0];return t.issues.push({code:"invalid_union",input:t.value,inst:r,errors:e.map((i)=>i.issues.map((s)=>yt(s,n,Te())))}),t}function Hs(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(gr(e)&&gr(t)){let r=Object.keys(t),n=Object.keys(e).filter((i)=>r.indexOf(i)!==-1),o={...e,...t};if(Object.prototype.hasOwnProperty.call(o,"__proto__"))delete o.__proto__;for(let i of n){if(i==="__proto__")continue;let s=Hs(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};o[i]=s.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],s=Hs(o,i);if(!s.valid)return{valid:!1,mergeErrorPath:[n,...s.mergeErrorPath]};r.push(s.data)}return{valid:!0,data:r}}return{valid:!1,mergeErrorPath:[]}}function oh(e,t,r){let n=new Map,o,i=new Map,s=(l,u)=>{let f;if(l.code==="unrecognized_keys"&&!l.path?.length)o??(o=l),f=l.keys;else if(l.code==="invalid_key"&&l.origin==="record"&&l.path?.length===1){let h=String(l.path[0]);if(!i.has(h))i.set(h,l);f=[h]}else return!1;for(let h of f){if(!n.has(h))n.set(h,{});n.get(h)[u]=!0}return!0};for(let l of t.issues)if(!s(l,"l"))e.issues.push(l);for(let l of r.issues)if(!s(l,"r"))e.issues.push(l);let a=[...n].filter(([,l])=>l.l&&l.r).map(([l])=>l);if(a.length){let l=o?a.filter((u)=>o.keys.includes(u)):[];if(l.length)e.issues.push({...o,keys:l});for(let u of a)if(!l.includes(u)&&i.has(u))e.issues.push(i.get(u))}let c=Hs(t.value,r.value);if(!c.valid){if(Ve(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}function ih(e,t){return e.value=t.issues.length?void 0:t.value,e}function sh(e,t){if(e.value===void 0)e.value=t.defaultValue;return e}function ah(e,t){if(!e.issues.length&&e.value===void 0)e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t});return e}function ch(e,t,r,n){if(!t.issues.length){if(e.value=t.value,t.memo)e.memo=!0;return e}return e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map((o)=>yt(o,n,Te()))},input:e.value}),e}function Io(e,t,r){if(e.issues.some((n)=>n.code!=="unrecognized_keys"))return e.aborted=!0,e;return t._zod.run({value:e.value,issues:e.issues},r)}function uh(e){if(!e.memo)e.value=Object.freeze(e.value);return e}function lh(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};if(n._zod.def.params)o.params=n._zod.def.params;t.issues.push(Ft(o))}}var K,fh=(e,t)=>e.issues.length?{issues:e.issues.map((r)=>yt(r,t,Te()))}:{value:e.value},Po,B,hh,dh,ph,mh=1,zo=2,Nb,yh,_h,wh,vh,bh,$h,Sh,kh,Eh,xh,Oh,Ih,zh,Zb,Ph,Ch,Rh,Ks,Nh,Co,Dh,Lh,Zh,Fh,Mh,Ub=(e)=>Array.isArray(e)?e.length:-1,jh,Vb,Gb,Vh,Gh,Wh,Hh,qh,Js,Kh,Jh,Yh,Xh,Qh,ed,td,rd,nd;var Ys=A(()=>{Oo();Mt();rn();ge();Ws();ge();K=_("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=eh;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let s of i._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(a,c,l)=>{if(a.memo)return a;let u=Ve(a),f;for(let h of c){if(h._zod.def.when){if(ql(a))continue;if(!h._zod.def.when(a))continue}else if(u)continue;let d=a.issues.length,p=h._zod.check(a);if(p instanceof Promise&&l?.async===!1)throw new Ge;if(f||p instanceof Promise)f=(f??Promise.resolve()).then(async()=>{if(await p,a.issues.length===d)return;if(_o(a.issues,d,e),!u)u=Ve(a,d)});else{if(a.issues.length===d)continue;if(_o(a.issues,d,e),!u)u=Ve(a,d)}}if(f)return f.then(()=>a);return a},s=(a,c,l)=>{if(Ve(a))return a.aborted=!0,a;let u=i(c,o,l);if(u instanceof Promise){if(l.async===!1)throw new Ge;return u.then((f)=>e._zod.parse(f,l))}return e._zod.parse(u,l)};e._zod.run=(a,c)=>{if(c.skipChecks)return e._zod.parse(a,c);if(c.direction==="backward"){let u=e._zod.parse({value:a.value,issues:[]},{...c,skipChecks:!0});if(u instanceof Promise)return u.then((f)=>s(f,a,c));return s(u,a,c)}let l=e._zod.parse(a,c);if(l instanceof Promise){if(c.async===!1)throw new Ge;return l.then((u)=>i(u,o,c))}return i(l,o,c)}}},{get "~standard"(){return bo(this,"~standard",qs(this))},set "~standard"(e){et(this,"~standard",e)}});Po=_("$ZodString",(e,t)=>{K.init(e,t),e._zod.pattern=t.pattern??Mf,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch(o){}if(typeof r.value==="string")return r;return r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),B=_("$ZodStringFormat",(e,t)=>{nn.init(e,t),Po.init(e,t)}),hh=_("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Ef),B.init(e,t)}),dh=_("$ZodUUID",(e,t)=>{if(t.version){let n={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(n===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Us(n))}else t.pattern??(t.pattern=Us());B.init(e,t)}),ph=_("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=xf),B.init(e,t)});Nb=/[\t\n\r]/g;yh=_("$ZodURL",(e,t)=>{B.init(e,t),e._zod.check=(r)=>{try{let n=r.value.trim(),o=Rb(n,t);if(o===mh){r.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:r.value,inst:e,continue:!t.abort});return}if(o===zo){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort});return}if(o===!0){r.value=th(n);return}if(t.hostname&&!Db(o,t.hostname))r.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:r.value,inst:e,continue:!t.abort});if(t.protocol&&!Lb(o,t.protocol))r.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:r.value,inst:e,continue:!t.abort});r.value=t.normalize?o.href:th(n);return}catch(n){r.issues.push({code:"invalid_format",format:"url",input:r.value,inst:e,continue:!t.abort})}}}),_h=_("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Of()),B.init(e,t)}),wh=_("$ZodNanoID",(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??(t.pattern=t.length===void 0?$f:Sf(t.length)),B.init(e,t)}),vh=_("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=yf),B.init(e,t)}),bh=_("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=_f),B.init(e,t)}),$h=_("$ZodULID",(e,t)=>{t.pattern??(t.pattern=wf),B.init(e,t)}),Sh=_("$ZodXID",(e,t)=>{t.pattern??(t.pattern=vf),B.init(e,t)}),kh=_("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=bf),B.init(e,t)}),Eh=_("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=Ff(t)),B.init(e,t)}),xh=_("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Lf),B.init(e,t)}),Oh=_("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Zf(t)),B.init(e,t)}),Ih=_("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=kf),B.init(e,t)}),zh=_("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=If),B.init(e,t)}),Zb=/^[0-9a-fA-F:.]+$/;Ph=_("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=zf),B.init(e,t),e._zod.check=(r)=>{if(!Ah(r.value))r.issues.push({code:"invalid_format",format:"ipv6",input:r.value,inst:e,continue:!t.abort})}}),Ch=_("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Af),B.init(e,t)});Rh=_("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Pf),B.init(e,t),e._zod.check=(r)=>{if(!Fb(r.value))r.issues.push({code:"invalid_format",format:"cidrv6",input:r.value,inst:e,continue:!t.abort})}});Ks=/^[0-9a-zA-Z+/]*={0,2}$/,Nh=_("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Ks),B.init(e,t),e._zod.check=(r)=>{if(Th(r.value))return;r.issues.push({code:"invalid_format",format:"base64",input:r.value,inst:e,continue:!t.abort})}}),Co=/^[A-Za-z0-9_-]*$/;Dh=_("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Co),B.init(e,t),e._zod.check=(r)=>{if(Mb(r.value))return;r.issues.push({code:"invalid_format",format:"base64url",input:r.value,inst:e,continue:!t.abort})}}),Lh=_("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Nf),B.init(e,t)});Zh=_("$ZodJWT",(e,t)=>{B.init(e,t),e._zod.check=(r)=>{if(jb(r.value,t.alg))return;r.issues.push({code:"invalid_format",format:"jwt",input:r.value,inst:e,continue:!t.abort})}}),Fh=_("$ZodUnknown",(e,t)=>{K.init(e,t),e._zod.parse=(r)=>r}),Mh=_("$ZodNever",(e,t)=>{K.init(e,t),e._zod.parse=(r,n)=>(r.issues.push({expected:"never",code:"invalid_type",input:r.value,inst:e}),r)});jh=_("$ZodArray",(e,t)=>{K.init(e,t);let r=be.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let s=[],a=o?.abortEarly;for(let c=0;c<i.length;c++){let l=i[c],u=t.element._zod.run({value:l,issues:[]},o);if(u instanceof Promise)s.push(u.then((f)=>rh(f,n,c)));else if(rh(u,n,c),a&&u.issues.length!==0&&Ve(u))break}if(s.length)return Promise.all(s).then(()=>n);return n},Bb(e,Ub)});Vb=[];Gb=_("$ZodObject",(e,t)=>{K.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let l=()=>{let u={...n};return Object.defineProperty(t,"shape",{value:u}),l.raw=u,u};l.raw=n,Object.defineProperty(t,"shape",{get:l})}let o=ho(()=>Bh(t));F(e,"propValues",(l)=>{let u=l.def.shape,f={};for(let h in u){let d=u[h]._zod;if(d.values){if(!Object.prototype.hasOwnProperty.call(f,h))Be(f,h,new Set);for(let p of d.values)f[h].add(p);if(d.optin!==void 0)f[h].add(void 0)}}return f});let i=Yr,s=t.catchall,a,c=be.memoizer;c?.attach(e),e._zod.parse=(l,u)=>{a??(a=o.value);let f=l.value;if(!i(f))return l.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),l;l.value=c?c.alloc(e,l,{},u):{};let h=[],d=a.shape,p=u?.abortEarly,g=l.issues.length;for(let y of a.allKeys){if(p&&l.issues.length!==g){if(Ve(l,g))break;g=l.issues.length}if(y==="__proto__")continue;let b=d[y],S=b._zod.optin,N=b._zod.optout,z=b._zod.run({value:f[y],issues:[]},u);if(z instanceof Promise)h.push(z.then((C)=>Ao(C,l,y,f,S,N)));else Ao(z,l,y,f,S,N)}if(!s)return h.length?Promise.all(h).then(()=>l):l;return Uh(h,f,l,u,o.value,e,p===!0)}}),Vh=_("$ZodObjectJIT",(e,t)=>{Gb.init(e,t);let r=e._zod.parse,n=ho(()=>Bh(t)),o=be.memoizer,i=(d)=>{let p=n.value,g=p.symbolKeys,y=new Gs(["payload","ctx"],{shape:d,inst:e,memo:o,syms:g}),b=(C)=>`shape[${C}]._zod.run({ value: input[${C}], issues: [] }, ctx)`,S=(C,x)=>`
|
|
86
|
+
let ${C}_ab = false;
|
|
87
|
+
for (let i = 0; i < ${C}.issues.length; i++) {
|
|
88
|
+
const iss = ${C}.issues[i];
|
|
89
|
+
iss.path = iss.path ? [${x}, ...iss.path] : [${x}];
|
|
90
|
+
payload.issues.push(iss);
|
|
91
|
+
if (iss.continue !== true) ${C}_ab = true;
|
|
92
|
+
}
|
|
93
|
+
if (${C}_ab && ctx && ctx.abortEarly) {
|
|
94
|
+
payload.value = newResult;
|
|
95
|
+
return payload;
|
|
96
|
+
}`;y.write("const input = payload.value;");let N=Object.create(null),z=0;for(let C of p.allKeys)N[C]=`key_${z++}`;y.write(o?"const newResult = memo.alloc(inst, payload, {}, ctx);":"const newResult = {};");for(let C of p.allKeys){if(C==="__proto__")continue;let x=N[C],U=typeof C==="symbol"?`syms[${g.indexOf(C)}]`:jl(C),ie=`${U} in input`,oe=d[C],ye=oe?._zod?.optin,he=ye!==void 0,I=oe?._zod?.optout==="optional";if(y.write(`const ${x} = ${b(U)};`),he&&I){let R=ye==="optional"?`${x}_present`:`${x}.value !== undefined || ${x}_present`;y.write(`
|
|
97
|
+
const ${x}_present = ${ie};
|
|
98
|
+
if (!${x}.issues.length || ${x}_present) {
|
|
99
|
+
if (${x}.issues.length) {${S(x,U)}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (${R}) {
|
|
103
|
+
newResult[${U}] = ${x}.value;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
`)}else if(!he)y.write(`
|
|
108
|
+
const ${x}_present = ${ie};
|
|
109
|
+
if (${x}.issues.length) {${S(x,U)}
|
|
110
|
+
}
|
|
111
|
+
if (!${x}_present && !${x}.issues.length) {
|
|
112
|
+
payload.issues.push({
|
|
113
|
+
code: "invalid_type",
|
|
114
|
+
expected: "nonoptional",
|
|
115
|
+
input: undefined,
|
|
116
|
+
path: [${U}]
|
|
117
|
+
});
|
|
118
|
+
if (ctx && ctx.abortEarly) {
|
|
119
|
+
payload.value = newResult;
|
|
120
|
+
return payload;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (${x}_present) {
|
|
125
|
+
newResult[${U}] = ${x}.value;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
`);else if(y.write(`
|
|
129
|
+
if (${x}.issues.length) {${S(x,U)}
|
|
130
|
+
}
|
|
131
|
+
`),ye==="defaulted")y.write(`newResult[${U}] = ${x}.value;`);else y.write(`
|
|
132
|
+
if (${x}.value !== undefined || ${ie}) {
|
|
133
|
+
newResult[${U}] = ${x}.value;
|
|
134
|
+
}
|
|
135
|
+
`)}return y.write("payload.value = newResult;"),y.write("return payload;"),y.compile()},s,a=Yr,c=!be.jitless,u=c&&Ul.value,f=t.catchall,h;e._zod.parse=(d,p)=>{h??(h=n.value);let g=d.value;if(!a(g))return d.issues.push({expected:"object",code:"invalid_type",input:g,inst:e}),d;if(c&&u&&p?.async===!1&&p.jitless!==!0){if(!s)s=i(t.shape);if(d=s(d,p),!f)return d;return Uh([],g,d,p,h,e,p?.abortEarly===!0)}return r(d,p)}});Gh=_("$ZodUnion",(e,t)=>{K.init(e,t),F(e,"optin",(n)=>n.def.options.some((o)=>o._zod.optin==="defaulted")?"defaulted":n.def.options.some((o)=>o._zod.optin!==void 0)?"optional":void 0),F(e,"optout",(n)=>n.def.options.some((o)=>o._zod.optout==="optional")?"optional":void 0),F(e,"values",(n)=>{if(n.def.options.every((o)=>o._zod.values))return new Set(n.def.options.flatMap((o)=>Array.from(o._zod.values)));return}),F(e,"pattern",(n)=>{if(n.def.options.every((o)=>o._zod.pattern)){let o=n.def.options.map((i)=>i._zod.pattern);return new RegExp(`^(${o.map((i)=>po(i.source)).join("|")})$`)}return});let r=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(n,o)=>{if(r)return r(n,o);let i=!1,s=[];for(let a of t.options){let c=a._zod.run({value:n.value,issues:[]},o);if(c instanceof Promise)s.push(c),i=!0;else{if(c.issues.length===0)return c;s.push(c)}}if(!i)return nh(s,n,e,o);return Promise.all(s).then((a)=>nh(a,n,e,o))}}),Wh=_("$ZodIntersection",(e,t)=>{K.init(e,t),e._zod.parse=(r,n)=>{let o=r.value,i=t.left._zod.run({value:o,issues:[]},n),s=t.right._zod.run({value:o,issues:[]},n);if(i instanceof Promise||s instanceof Promise)return Promise.all([i,s]).then(([c,l])=>oh(r,c,l));return oh(r,i,s)}});Hh=_("$ZodEnum",(e,t)=>{K.init(e,t);let r=Xr(t.entries),n=new Set(r);e._zod.values=n,F(e,"pattern",(o)=>{let i=Xr(o.def.entries).filter((s)=>Vl.has(typeof s));return new RegExp(i.length?`^(${i.map((s)=>yr(s.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let s=o.value;if(n.has(s))return o;return o.issues.push({code:"invalid_value",values:r,input:s,inst:e}),o}}),qh=_("$ZodTransform",(e,t)=>{K.init(e,t),e._zod.optin="optional",be.memoizer?.guard(e),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new en(e.constructor.name);let o=t.transform(r.value,r);if(n.async)return(o instanceof Promise?o:Promise.resolve(o)).then((s)=>(r.value=s,r));if(o instanceof Promise)throw new Ge;return r.value=o,r}});Js=_("$ZodOptional",(e,t)=>{K.init(e,t),F(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",F(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),F(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${po(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>ih(r,i));return ih(r,o)}return t.innerType._zod.run(r,n)}}),Kh=_("$ZodExactOptional",(e,t)=>{Js.init(e,t),F(e,"values",(r)=>r.def.innerType._zod.values),F(e,"pattern",(r)=>r.def.innerType._zod.pattern),e._zod.parse=(r,n)=>t.innerType._zod.run(r,n)}),Jh=_("$ZodNullable",(e,t)=>{K.init(e,t),F(e,"optin",(r)=>r.def.innerType._zod.optin),F(e,"optout",(r)=>r.def.innerType._zod.optout),F(e,"pattern",(r)=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${po(n.source)}|null)$`):void 0}),F(e,"values",(r)=>r.def.innerType._zod.values?new Set([...r.def.innerType._zod.values,null]):void 0),e._zod.parse=(r,n)=>{if(r.value===null)return r;return t.innerType._zod.run(r,n)}}),Yh=_("$ZodDefault",(e,t)=>{K.init(e,t),e._zod.optin="defaulted",F(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>sh(i,t));return sh(o,t)}});Xh=_("$ZodPrefault",(e,t)=>{K.init(e,t),e._zod.optin="defaulted",F(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)r.value=t.defaultValue;return t.innerType._zod.run(r,n)}}),Qh=_("$ZodNonOptional",(e,t)=>{K.init(e,t),F(e,"values",(r)=>{let n=r.def.innerType._zod.values;return n?new Set([...n].filter((o)=>o!==void 0)):void 0}),e._zod.parse=(r,n)=>{let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>ah(i,e));return ah(o,e)}});ed=_("$ZodCatch",(e,t)=>{K.init(e,t),F(e,"optin",(r)=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),F(e,"optout",(r)=>r.def.innerType._zod.optout),F(e,"values",(r)=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);if(o instanceof Promise)return o.then((i)=>ch(r,i,t,n));return ch(r,o,t,n)}}),td=_("$ZodPipe",(e,t)=>{K.init(e,t),F(e,"values",(r)=>r.def.in._zod.values),F(e,"optin",(r)=>r.def.in._zod.optin),F(e,"optout",(r)=>r.def.out._zod.optout),F(e,"propValues",(r)=>r.def.in._zod.propValues),e._zod.parse=(r,n)=>{if(n.direction==="backward"){let i=t.out._zod.run(r,n);if(i instanceof Promise)return i.then((s)=>Io(s,t.in,n));return Io(i,t.in,n)}let o=t.in._zod.run(r,n);if(o instanceof Promise)return o.then((i)=>Io(i,t.out,n));return Io(o,t.out,n)}});rd=_("$ZodReadonly",(e,t)=>{K.init(e,t),F(e,"propValues",(r)=>r.def.innerType._zod.propValues),F(e,"values",(r)=>r.def.innerType._zod.values),F(e,"optin",(r)=>r.def.innerType?._zod?.optin),F(e,"optout",(r)=>r.def.innerType?._zod?.optout),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run(r,n);if(o instanceof Promise)return o.then(uh);return uh(o)}});nd=_("$ZodCustom",(e,t)=>{$e.init(e,t),K.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=(r)=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then((i)=>lh(i,r,n,e));lh(o,r,n,e);return}})});function sd(e){return e!==null&&typeof e==="object"}function Xs(e){return e.map((t)=>t.path?{...t,path:t.path.slice()}:{...t})}function Do(e,t,r){let n=ad.get(e);if(n!==void 0)return n?sn:on;if(t.has(e))return sn;t.add(e);let o=on,i=(u)=>{if(o!==sn&&u?._zod){let f=Do(u,t,r);if(f>o)o=f}},s=(u,f)=>{let h=on;for(let d of Reflect.ownKeys(u)){let p=Object.getOwnPropertyDescriptor(u,d);if(f&&!p.enumerable)continue;let g=p.get?No:p.value?._zod?Do(p.value,t,r):on;if(g>h)h=g}return h},a=(u)=>{if(u>o)o=u},c=e._zod.def,l=c.type;switch(l){case"object":{let u=mo(c);a(u?s(u,!0):No),i(c.catchall);break}case"array":i(c.element);break;case"tuple":for(let u of c.items)i(u);i(c.rest);break;case"record":case"map":i(c.keyType),i(c.valueType);break;case"set":i(c.valueType);break;case"union":for(let u of c.options)i(u);break;case"intersection":i(c.left),i(c.right);break;case"optional":case"nullable":case"default":case"prefault":case"catch":case"readonly":case"nonoptional":case"promise":case"success":i(c.innerType);break;case"pipe":i(c.in),i(c.out);break;case"function":i(c.input),i(c.output);break;case"lazy":{let u=c._cachedInner??(r?e._zod.innerType:void 0);a(u?Do(u,t,!1):No);break}case"template_literal":case"string":case"number":case"int":case"boolean":case"bigint":case"symbol":case"undefined":case"null":case"void":case"never":case"any":case"unknown":case"date":case"nan":case"enum":case"literal":case"file":case"transform":case"custom":break;default:for(let u in c){let f=Object.getOwnPropertyDescriptor(c,u);if(!f||f.get)continue;let h=f.value;if(!h||typeof h!=="object")continue;if(h._zod)i(h);else if(Array.isArray(h))for(let d of h)i(d)}}return t.delete(e),Wb(e,o)}function Wb(e,t){if(t!==No)ad.set(e,t===sn);return t}function Hb(e,t){let r=e.buckets.get(t);if(!r)r=new WeakMap,e.buckets.set(t,r);return r}function cd(){return qb}function Kb(e,t){let r=e[Qs]?.backEdges;return r!==void 0&&sd(t)&&r.has(t)}var id,Qs="~memo",od,ad,on=0,No=1,sn=2,Ro,To,qb;var ud=A(()=>{ge();id=class id extends Error{constructor(){super("Cannot parse a reference cycle that closes through a transform");this.name="ZodCyclicError"}};od=[];ad=new WeakMap;To=[],qb={alloc(e,t,r){let n=Ro;if(!n)return r;Ro=void 0;let o={value:r,issues:null};return n.set(t.value,o),To.push(o),r},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let r=e._zod.parse,n=(o,i)=>{if(i.direction!=="backward"&&Kb(i,o.value))throw new id;return r(o,i)};if(e._zod.parse=n,e._zod.run===r)e._zod.run=n})},attach(e){var t;let r,n=!1,o,i;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let s=e._zod.parse,a=(c,l)=>{if(r===void 0){let b=Do(e,new Set,!1);if(b===on){if(e._zod.parse=s,e._zod.run===a)e._zod.run=s;return s(c,l)}if(b===sn||n)r=!0;else n=!0}let u=c.value;if(!sd(u))return s(c,l);let f=l[Qs];if(!f)f={buckets:new WeakMap,backEdges:void 0},l[Qs]=f;let h;if(o===l)h=i;else h=Hb(f,e),o=l,i=h;let d=h.get(u);if(d){if(c.value=d.value,d.issues){if(d.issues.length)c.issues.push(...Xs(d.issues))}else c.memo=!0,f.backEdges??(f.backEdges=new WeakSet),f.backEdges.add(d.value);return c}Ro=h;let p=To.length,g=s(c,l);Ro=void 0;let y=To.length>p?To.pop():void 0;if(g instanceof Promise)return g.then((b)=>{if(y)y.issues=b.issues.length?Xs(b.issues):od;return b});if(y)y.issues=g.issues.length?Xs(g.issues):od;return g};if(e._zod.parse=a,e._zod.run===s)e._zod.run=a})}}});function ea(){return{localeError:Jb()}}var Jb=()=>{let e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(i){return e[i]??null}let r={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",currency_code:"currency code",credit_card:"credit card number",iban:"IBAN",jwt:"JWT",template_literal:"input"},n={nan:"NaN"};function o(i,s){if(i==="number"&&typeof s==="number"&&!Number.isFinite(s))return String(s);return n[i]??i}return(i)=>{switch(i.code){case"invalid_type":{let s=o(i.expected),a=Kl(i.input),c=o(a,i.input);return`Invalid input: expected ${s}, received ${c}`}case"invalid_value":if(i.values.length===1)return`Invalid input: expected ${Rs(i.values[0])}`;return`Invalid option: expected one of ${As(i.values,"|")}`;case"too_big":{let s=i.exact?"exactly ":i.inclusive?"<=":"<",a=t(i.origin);if(a)return`Too big: expected ${i.origin??"value"} to have ${s}${i.maximum.toString()} ${a.unit??"elements"}`;return`Too big: expected ${i.origin??"value"} to be ${s}${i.maximum.toString()}`}case"too_small":{let s=i.exact?"exactly ":i.inclusive?">=":">",a=t(i.origin);if(a)return`Too small: expected ${i.origin} to have ${s}${i.minimum.toString()} ${a.unit}`;return`Too small: expected ${i.origin} to be ${s}${i.minimum.toString()}`}case"invalid_format":{let s=i;if(s.format==="starts_with")return`Invalid string: must start with "${s.prefix}"`;if(s.format==="ends_with")return`Invalid string: must end with "${s.suffix}"`;if(s.format==="includes")return`Invalid string: must include "${s.includes}"`;if(s.format==="regex")return`Invalid string: must match pattern ${s.pattern}`;return`Invalid ${r[s.format]??i.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${i.divisor}`;case"unrecognized_keys":return`Unrecognized key${i.keys.length>1?"s":""}: ${As(i.keys,", ")}`;case"invalid_key":return`Invalid key in ${i.origin}`;case"invalid_union":if(i.options&&Array.isArray(i.options)&&i.options.length>0)return`Invalid discriminator value. Expected ${i.options.map((a)=>`'${a}'`).join(" | ")}`;if(i.inclusive===!1)return"Invalid input: more than one option matched";return"Invalid input";case"invalid_element":return`Invalid value in ${i.origin}`;default:return"Invalid input"}}};var ld=A(()=>{ge()});var ta=()=>{};class dd{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let r=t[0];if(this._map.set(e,r),r&&typeof r==="object"&&"id"in r)this._idmap.set(r.id,e);return this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);if(t&&typeof t==="object"&&"id"in t)this._idmap.delete(t.id);return this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let r={...this.get(t)??{}};delete r.id;let n={...r,...this._map.get(e)};return Object.keys(n).length?n:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}function Yb(){return new dd}var hd,jt;var ra=A(()=>{(hd=globalThis).__zod_globalRegistry??(hd.__zod_globalRegistry=Yb());jt=globalThis.__zod_globalRegistry});var pd=()=>{};function Xb(e){if(e.checks)e.checks=[...e.checks];return e}function md(e,t){return new e(Xb({type:"string",...E(t)}))}function gd(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...E(t)})}function yd(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...E(t)})}function _d(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...E(t)})}function wd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...E(t)})}function vd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...E(t)})}function bd(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...E(t)})}function $d(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...E(t)})}function Sd(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...E(t)})}function kd(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...E(t)})}function Ed(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...E(t)})}function xd(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...E(t)})}function Od(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...E(t)})}function Id(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...E(t)})}function zd(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...E(t)})}function Ad(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...E(t)})}function Pd(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...E(t)})}function Cd(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...E(t)})}function Rd(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...E(t)})}function Td(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...E(t)})}function Nd(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...E(t)})}function Dd(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...E(t)})}function Ld(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...E(t)})}function Zd(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...E(t)})}function Fd(e,t){return new e({type:"string",format:"date",check:"string_format",...E(t)})}function Md(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...E(t)})}function jd(e,t){return new e({type:"string",format:"duration",check:"string_format",...E(t)})}function Bd(e){return new e({type:"unknown"})}function Ud(e,t){return new e({type:"never",...E(t)})}function Lo(e,t){return new Uf({check:"max_length",...E(t),maximum:e})}function _r(e,t){return new Vf({check:"min_length",...E(t),minimum:e})}function Zo(e,t){return new Gf({check:"length_equals",...E(t),length:e})}function na(e,t){return new Wf({check:"string_format",format:"regex",...E(t),pattern:e})}function oa(e){return new Hf({check:"string_format",format:"lowercase",...E(e)})}function ia(e){return new qf({check:"string_format",format:"uppercase",...E(e)})}function sa(e,t){return new Kf({check:"string_format",format:"includes",...E(t),includes:e})}function aa(e,t){return new Jf({check:"string_format",format:"starts_with",...E(t),prefix:e})}function ca(e,t){return new Yf({check:"string_format",format:"ends_with",...E(t),suffix:e})}function _t(e){return new Xf({check:"overwrite",tx:e})}function ua(e){return _t((t)=>t.normalize(e))}function la(){return _t((e)=>e.trim())}function fa(){return _t((e)=>e.toLowerCase())}function ha(){return _t((e)=>e.toUpperCase())}function da(){return _t((e)=>Bl(e))}function Vd(e,t,r){return new e({type:"array",element:t,...E(r)})}function Gd(e,t,r){return new e({type:"custom",check:"custom",fn:t,...E(r)})}function Wd(e,t){let r=Qb((n)=>(n.addIssue=(o)=>{if(typeof o==="string")n.issues.push(Ft(o,n.value,r._zod.def));else{let i=o;if(i.fatal)i.continue=!1;if(i.code??(i.code="custom"),!("input"in i))i.input=n.value;i.inst??(i.inst=r),i.continue??(i.continue=!r._zod.def.abort),n.issues.push(Ft(i))}},e(n.value,n)),t);return r}function Qb(e,t){let r=new $e({check:"custom",...E(t)});return r._zod.check=e,r}var Hd=A(()=>{Oo();ge()});function an(e,...t){for(let r of t)for(let n of Reflect.ownKeys(r))if(Object.prototype.propertyIsEnumerable.call(r,n))Be(e,n,r[n]);return e}function ma(e){let t=e?.target??"draft-2020-12";if(t==="draft-4")t="draft-04";if(t==="draft-7")t="draft-07";return{processors:e.processors??{},metadataRegistry:e?.metadata??jt,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??"ref",reused:e?.reused??"inline",intersections:[],deferred:[],external:e?.external??void 0}}function wr(e,t,r,n,o){let i=typeof t.unrepresentable==="function"?t.unrepresentable({zodSchema:e,path:n.path,message:o}):t.unrepresentable;if(i==="any")return!1;if(i===void 0||i==="throw")throw Error(o);return Object.assign(r,i),!0}function ne(e,t,r={path:[],schemaPath:[]}){var n;let o=e._zod.def,i=t.seen.get(e);if(i){if(i.count++,r.schemaPath.includes(e))i.cycle=r.path;return i.schema}let s={schema:{},count:1,cycle:void 0,path:r.path};t.seen.set(e,s),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let a=e._zod.toJSONSchema?.();if(a)s.schema=a;else{let u={...r,schemaPath:[...r.schemaPath,e],path:r.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,s.schema,u);else{let h=s.schema,d=t.processors[o.type];if(!d)throw Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,h,u)}let f=e._zod.parent;if(f){if(!s.ref)s.ref=f;ne(f,t,u),t.seen.get(f).isParent=!0}}let c=t.metadataRegistry.get(e);if(c)an(s.schema,c);if(t.io==="input"&&fe(e))delete s.schema.examples,delete s.schema.default;if(t.io==="input"&&"_prefault"in s.schema)(n=s.schema).default??(n.default=s.schema._prefault);return delete s.schema._prefault,t.seen.get(e).schema}function qd(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}function ga(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");if(e.external&&e.sharedDefsExtractedFor===e.external)return;let n=new Map;for(let s of e.seen.entries()){let a=e.metadataRegistry.get(s[0])?.id;if(a){let c=n.get(a);if(c&&c!==s[0])throw Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);n.set(a,s[0])}}let o=(s)=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let f=e.external.registry.get(s[0])?.id,h=e.external.uri??((p)=>p);if(f)return{ref:h(f)};let d=s[1].defId??s[1].schema.id??`schema${e.counter++}`;return s[1].defId=d,{defId:d,ref:`${h("__shared")}#/${a}/${qd(d)}`}}let c="#",l=`${c}/${a}/`;if(s[1]===r&&!s[1].schema.id)return{ref:c};let u=s[1].schema.id??`__schema${e.counter++}`;return{defId:u,ref:l+qd(u)}},i=(s)=>{if(s[1].schema.$ref)return;let a=s[1],{ref:c,defId:l}=o(s);if(a.def={...a.schema},l)a.defId=l;let u=a.schema;for(let f in u)delete u[f];u.$ref=c};if(e.cycles==="throw")for(let s of e.seen.entries()){let a=s[1];if(a.cycle)throw Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
|
|
136
|
+
|
|
137
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let s of e.seen.entries()){let a=s[1];if(t===s[0]){i(s);continue}if(e.external){let l=e.external.registry.get(s[0])?.id;if(t!==s[0]&&l){i(s);continue}}if(e.metadataRegistry.get(s[0])?.id){i(s);continue}if(a.cycle){i(s);continue}if(a.count>1){if(e.reused==="ref")i(s)}}if(e.external)e.sharedDefsExtractedFor=e.external}function Yd(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let r=[];for(let n of t){if(!n||typeof n!=="object")return;Yd(n);let o=Object.keys(n);if(o.length!==1||o[0]!=="type")return;let i=n.type;for(let s of Array.isArray(i)?i:[i]){if(typeof s!=="string")return;if(!r.includes(s))r.push(s)}}delete e.anyOf,e.type=r.length===1?r[0]:r}function Jd(e){let t=e.additionalProperties;if(t===void 0||t===!1||typeof t!=="object"||t===null)return null;return Object.keys(t).length?t:null}function pa(e){let t=[];for(let i of e){if(typeof i!=="object"||i.type!=="object")return null;for(let s in i)if(!Xd.has(s))return null;t.push(i)}let r={},n=new Set;for(let i of t){for(let s in i.properties){if(Object.prototype.hasOwnProperty.call(r,s))continue;let a=[];for(let l of t){let u=l.properties?.[s]??Jd(l);if(u===null||u===void 0)continue;if(!a.some((f)=>JSON.stringify(f)===JSON.stringify(u)))a.push(u)}let c=a.length===1?a[0]:pa(a)??{allOf:a};Be(r,s,c)}for(let s of i.required??[])n.add(s)}let o={type:"object",properties:r};if(n.size)o.required=[...n];if(t.every((i)=>i.additionalProperties===!1))o.additionalProperties=!1;else{let i=[];for(let s of t){let a=Jd(s);if(a&&!i.some((c)=>JSON.stringify(c)===JSON.stringify(a)))i.push(a)}if(i.length===1)o.additionalProperties=i[0];else if(i.length>1)o.additionalProperties={allOf:i}}return o}function e0(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let o of Xd)if(o in e)return;let r=t.filter((o)=>Kd.some((i)=>Array.isArray(o[i]))),n=null;if(!r.length)n=pa(t);else{let o=r[0],i=Kd.find((c)=>Array.isArray(o[c]));if(Object.keys(o).length!==1)return;let s=t.filter((c)=>c!==o),a=o[i].map((c)=>pa([...s,c]));if(a.some((c)=>!c))return;n={[i]:a}}if(!n)return;delete e.allOf,an(e,n)}function ya(e,t){let r=e.seen.get(t);if(!r)throw Error("Unprocessed schema. This is a bug in Zod.");let n=(a)=>{let c=e.seen.get(a);if(c.ref===null)return;let l=c.def??c.schema,u={...l},f=c.ref;if(c.ref=null,f){n(f);let d=e.seen.get(f),p=d.schema;if(p.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"))l.allOf=l.allOf??[],l.allOf.push(p);else an(l,p);if(an(l,u),a._zod.parent===f)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(!(y in u))delete l[y]}if(p.$ref&&d.def)for(let y in l){if(y==="$ref"||y==="allOf")continue;if(y in d.def&&JSON.stringify(l[y])===JSON.stringify(d.def[y]))delete l[y]}}let h=a._zod.parent;if(h&&h!==f){n(h);let d=e.seen.get(h);if(d?.schema.$ref){if(l.$ref=d.schema.$ref,d.def)for(let p in l){if(p==="$ref"||p==="allOf")continue;if(p in d.def&&JSON.stringify(l[p])===JSON.stringify(d.def[p]))delete l[p]}}}e.override({zodSchema:a,jsonSchema:l,path:c.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let a of[...e.seen.entries()].reverse())n(a[0]);if(e.target!=="openapi-3.0")for(let a of e.seen.entries())Yd(a[1].def??a[1].schema);for(let a of e.deferred)a();if(e.intersections.length){let a=new Map;for(let c of e.seen.values())for(let l of[c.schema,c.def]){let u=l?.allOf;if(!Array.isArray(u))continue;let f=a.get(u);if(f)f.push(l);else a.set(u,[l])}for(let c of e.intersections)for(let l of a.get(c)??[])e0(l)}}let o={};if(e.target==="draft-2020-12")o.$schema="https://json-schema.org/draft/2020-12/schema";else if(e.target==="draft-07")o.$schema="http://json-schema.org/draft-07/schema#";else if(e.target==="draft-04")o.$schema="http://json-schema.org/draft-04/schema#";else if(e.target==="openapi-3.0");if(e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}an(o,r.defId?r.schema:r.def??r.schema);let i=e.metadataRegistry.get(t)?.id;if(i!==void 0&&o.id===i)delete o.id;let s=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let a of e.seen.entries()){let c=a[1];if(c.def&&c.defId){if(c.def.id===c.defId)delete c.def.id;Be(s,c.defId,c.def)}}if(e.external)e.sharedEmitDoneFor=e.external;if(e.external);else if(Object.keys(s).length>0)if(e.target==="draft-2020-12")o.$defs=s;else o.definitions=s;try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:cn(t,"input",e.processors),output:cn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch(a){throw Error("Error converting schema to JSON.")}}function fe(e,t){let r=t??{seen:new Set};if(r.seen.has(e))return!1;r.seen.add(e);let n=e._zod.def;if(n.type==="transform")return!0;if(n.type==="array")return fe(n.element,r);if(n.type==="set")return fe(n.valueType,r);if(n.type==="lazy")return fe(n.getter(),r);if(n.type==="promise"||n.type==="optional"||n.type==="nonoptional"||n.type==="nullable"||n.type==="readonly"||n.type==="default"||n.type==="prefault"||n.type==="catch")return fe(n.innerType,r);if(n.type==="intersection")return fe(n.left,r)||fe(n.right,r);if(n.type==="record"||n.type==="map")return fe(n.keyType,r)||fe(n.valueType,r);if(n.type==="pipe"){if(e._zod.traits.has("$ZodCodec"))return!0;return fe(n.in,r)||fe(n.out,r)}if(n.type==="object"){for(let o in n.shape)if(fe(n.shape[o],r))return!0;return!1}if(n.type==="union"){for(let o of n.options)if(fe(o,r))return!0;return!1}if(n.type==="tuple"){for(let o of n.items)if(fe(o,r))return!0;if(n.rest&&fe(n.rest,r))return!0;return!1}return!1}var Xd,Kd,Qd=(e,t={})=>(r)=>{let n=ma({...r,processors:t});return ne(e,n),ga(n,e),ya(n,e)},cn=(e,t,r={})=>(n)=>{let{libraryOptions:o,target:i}=n??{},s=ma({...o??{},target:i,io:t,processors:r});return ne(e,s),ga(s,e),ya(s,e)};var Fo=A(()=>{ra();ge();Xd=new Set(["type","properties","required","additionalProperties"]),Kd=["oneOf","anyOf"]});function $r(e){let t={},r=e._zod.def,n=e._zod.traits.has("$ZodCheck")?[e,...r.checks??[]]:r.checks??[];for(let i of n)t0[i._zod.def.check]?.(t,i._zod.def);let o=e._zod.bag;if(o.minimum!==void 0)vr(t,"minimum",o.minimum);if(o.exclusiveMinimum!==void 0)vr(t,"exclusiveMinimum",o.exclusiveMinimum);if(o.maximum!==void 0)br(t,"maximum",o.maximum);if(o.exclusiveMaximum!==void 0)br(t,"exclusiveMaximum",o.exclusiveMaximum);if(o.multipleOf!==void 0)op(t,o.multipleOf);if(o.format!==void 0){if(t.format??(t.format=o.format),o.format.includes("int"))t.isInt=!0}if(o.mime)sp(t,o.mime);for(let i of o.patterns??[])ip(t,i);return t}function _a(e){let t=e._zod.def;if(t.type==="pipe"&&t.in._zod.traits.has("$ZodTransform"))return _a(t.out);if(t.type==="catch")return _a(t.innerType);return e._zod.optin}function vp(e,t,r,n,o){let i=!1,s=JSON.stringify(e,(a,c)=>{if(typeof c!=="bigint")return c;return i=!0,null});if(!i)return JSON.parse(s);return wr(t,r,n,o,"BigInt defaults cannot be represented in JSON Schema"),wa}var vr=(e,t,r)=>{if(e[t]===void 0||r>e[t])e[t]=r},br=(e,t,r)=>{if(e[t]===void 0||r<e[t])e[t]=r},ep=(e,t)=>{vr(e,"minimum",t),br(e,"maximum",t)},op=(e,t)=>{if(e.multipleOf??(e.multipleOf=[]),!e.multipleOf.includes(t))e.multipleOf.push(t)},ip=(e,t)=>{e.patterns??(e.patterns=new Set),e.patterns.add(t)},sp=(e,t)=>{e.mime=e.mime?e.mime.filter((r)=>t.includes(r)):[...t]},ap=(e,t)=>{if(e.format=t,t.includes("int"))e.isInt=!0},tp=(e,t)=>vr(e,"minimum",t.minimum),rp=(e,t)=>br(e,"maximum",t.maximum),np=(e)=>(t,r)=>{ap(t,r.format);let[n,o]=e[r.format];vr(t,"minimum",n),br(t,"maximum",o)},t0,r0,n0,o0=(e)=>n0.get(e)??e,cp=(e,t,r,n)=>{let o=r;o.type="string";let{minimum:i,maximum:s,format:a,patterns:c,contentEncoding:l,laxFormat:u}=$r(e);if(typeof i==="number")o.minLength=i;if(typeof s==="number")o.maxLength=s;if(a){if(o.format=r0[a]??a,o.format==="")delete o.format;if(a==="time"||u)delete o.format}if(l)o.contentEncoding=l;if(c&&c.size>0){let f=[...c].map(o0);if(f.length===1)o.pattern=f[0].source;else if(f.length>1)o.allOf=[...f.map((h)=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))]}},up=(e,t,r,n)=>{r.not={}},lp=(e,t,r,n)=>{},fp=(e,t,r,n)=>{let o=e._zod.def,i=Xr(o.entries);if(i.length===0){r.not={};return}if(i.every((s)=>typeof s==="number"))r.type="number";if(i.every((s)=>typeof s==="string"))r.type="string";r.enum=i},hp=(e,t,r,n)=>{wr(e,t,r,n,"Custom types cannot be represented in JSON Schema")},dp=(e,t,r,n)=>{wr(e,t,r,n,"Transforms cannot be represented in JSON Schema")},pp=(e,t,r,n)=>{let o=r,i=e._zod.def,{minimum:s,maximum:a}=$r(e);if(typeof s==="number")o.minItems=s;if(typeof a==="number")o.maxItems=a;o.type="array",o.items=ne(i.element,t,{...n,path:[...n.path,"items"]})},mp=(e,t,r,n)=>{let o=r,i=e._zod.def,s=i.shape;if(Object.getOwnPropertySymbols(s).length&&wr(e,t,o,n,"Symbol keys cannot be represented in JSON Schema"))return;o.type="object",o.properties={};for(let l in s)Be(o.properties,l,ne(s[l],t,{...n,path:[...n.path,"properties",l]}));let c=[];for(let l of Object.keys(s)){let u=i.shape[l];if(t.io==="input"?_a(u)===void 0:u._zod.optout===void 0)c.push(l)}if(c.length>0)o.required=c;if(i.catchall?._zod.def.type==="never")o.additionalProperties=!1;else if(!i.catchall){if(t.io==="output")o.additionalProperties=!1}else if(i.catchall)o.additionalProperties=ne(i.catchall,t,{...n,path:[...n.path,"additionalProperties"]})},gp=(e,t,r,n)=>{let o=e._zod.def,i=o.inclusive===!1,s=o.options.map((a,c)=>ne(a,t,{...n,path:[...n.path,i?"oneOf":"anyOf",c]}));if(i)r.oneOf=s;else r.anyOf=s},yp=(e,t,r,n)=>{let o=e._zod.def,i=ne(o.left,t,{...n,path:[...n.path,"allOf",0]}),s=ne(o.right,t,{...n,path:[...n.path,"allOf",1]}),a=(l)=>("allOf"in l)&&Object.keys(l).length===1,c=[...a(i)?i.allOf:[i],...a(s)?s.allOf:[s]];r.allOf=c,t.intersections.push(c)},_p=(e,t,r,n)=>{let o=e._zod.def,i=ne(o.innerType,t,n),s=t.seen.get(e);if(t.target==="openapi-3.0")s.ref=o.innerType,r.nullable=!0;else r.anyOf=[i,{type:"null"}]},wp=(e,t,r,n)=>{let o=e._zod.def;ne(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType},wa,bp=(e,t,r,n)=>{let o=e._zod.def;ne(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s=vp(o.defaultValue,e,t,r,n);if(s!==wa)r.default=s},$p=(e,t,r,n)=>{let o=e._zod.def;ne(o.innerType,t,n);let i=t.seen.get(e);if(i.ref=o.innerType,t.io!=="input")return;let s=vp(o.defaultValue,e,t,r,n);if(s!==wa)r._prefault=s},Sp=(e,t,r,n)=>{let o=e._zod.def;ne(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType;let s;try{s=o.catchValue(void 0)}catch{wr(e,t,r,n,"Dynamic catch values are not supported in JSON Schema");return}r.default=s},kp=(e,t,r,n)=>{let o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),s=t.io==="input"?i?o.out:o.in:o.out;ne(s,t,n);let a=t.seen.get(e);a.ref=s},Ep=(e,t,r,n)=>{let o=e._zod.def;ne(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType,r.readOnly=!0},va=(e,t,r,n)=>{let o=e._zod.def;ne(o.innerType,t,n);let i=t.seen.get(e);i.ref=o.innerType};var xp=A(()=>{rn();Ys();Fo();ge();t0={greater_than:(e,t)=>vr(e,t.inclusive?"minimum":"exclusiveMinimum",t.value),less_than:(e,t)=>br(e,t.inclusive?"maximum":"exclusiveMaximum",t.value),multiple_of:(e,t)=>op(e,t.value),number_format:np(Ts),bigint_format:np(Ns),min_length:tp,max_length:rp,length_equals:(e,t)=>ep(e,t.length),min_size:tp,max_size:rp,size_equals:(e,t)=>ep(e,t.size),string_format:(e,t)=>{if(ap(e,t.format),t.pattern)ip(e,t.pattern);if(t.format==="base64"||t.format==="base64url")e.contentEncoding=t.format;if(t.local||t.precision===-1)e.laxFormat=!0},mime_type:(e,t)=>sp(e,t.mime)};r0={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},n0=new Map([[Ks,Cf],[Co,Rf]]);wa=Symbol()});var Op=()=>{};var tt=A(()=>{ge();rn();ta();Op();Mt();gf();sf();Ys();ud();Oo();Ws();ra();pd();Hd();Fo()});var ba=A(()=>{tt()});function jo(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let n=r(this);return Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,t,{value:n,configurable:!0,writable:!0})}})}var Ip,y0=(e,t)=>{rf.init(e,t),e.name="ZodError";let r=Object.getPrototypeOf(e);if(Ip.has(r))return;Ip.add(r),jo(r,"format",(n)=>(o)=>of(n,o)),jo(r,"flatten",(n)=>(o)=>nf(n,o)),jo(r,"addIssue",(n)=>(o)=>{n.issues.push(o),n.message=JSON.stringify(n.issues,Qr,2)}),jo(r,"addIssues",(n)=>(o)=>{n.issues.push(...o),n.message=JSON.stringify(n.issues,Qr,2)}),Object.defineProperty(r,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}})},Se;var $a=A(()=>{tt();tt();ge();Ip=new WeakSet([Object.prototype,Error.prototype]);Se=_("ZodError",y0,void 0,{Parent:Error})});var zp,Ap,Pp,Cp,Rp,Tp,Np,Dp,Lp,Zp,Fp,Mp;var Sa=A(()=>{tt();$a();tt();zp=So(Se),Ap=ko(Se),Pp=Eo(Se),Cp=xo(Se),Rp=cf(Se),Tp=uf(Se),Np=lf(Se),Dp=ff(Se),Lp=hf(Se),Zp=df(Se),Fp=pf(Se),Mp=mf(Se)});function w0(){if(!be.localeError)Te(ea())}function xa(){if(!be.memoizer)Te({memoizer:cd()})}function un(e){return md(v0,e)}function ka(){return Bd(U0)}function G0(e){return Ud(V0,e)}function Oa(e,t){return Vd(W0,e,t)}function Wp(e,t){let r={type:"object",shape:e??{},...E(t)};return new Gp(r)}function Hp(e,t){return new Gp({type:"object",shape:e,catchall:ka(),...E(t)})}function q0(e,t){return new H0({type:"union",options:e,...E(t)})}function J0(e,t){return new K0({type:"intersection",left:e,right:t})}function Y0(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map((n)=>[n,n])):e;return new Ea({type:"enum",entries:r,...E(t)})}function Q0(e){return new X0({type:"transform",transform:e})}function jp(e){return new qp({type:"optional",innerType:e})}function e$(e){return new Kp({type:"optional",innerType:e})}function Bp(e){return new t$({type:"nullable",innerType:e})}function n$(e,t){return new r$({type:"default",innerType:e,get defaultValue(){return typeof t==="function"?t():Cs(t)}})}function i$(e,t){return new o$({type:"prefault",innerType:e,get defaultValue(){return typeof t==="function"?t():Cs(t)}})}function s$(e,t){return new Jp({type:"nonoptional",innerType:e,...E(t)})}function c$(e,t){return new a$({type:"catch",innerType:e,catchValue:typeof t==="function"?t:Yl(t)})}function Up(e,t){return new u$({type:"pipe",in:e,out:t})}function f$(e){return new l$({type:"readonly",innerType:e})}function d$(e,t={}){return Gd(h$,e,t)}function p$(e,t){return Wd(e,t)}var X,Vp,v0,W,b0,$0,S0,k0,E0,x0,Bo,O0,I0,z0,A0,P0,C0,R0,T0,N0,D0,L0,Z0,F0,M0,j0,B0,U0,V0,W0,Gp,H0,K0,Ea,X0,qp,Kp,t$,r$,o$,Jp,a$,u$,l$,h$;var Yp=A(()=>{tt();tt();xp();Fo();ld();ba();Sa();X=_("ZodType",(e,t)=>(w0(),K.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(ve(t,{checks:[...t.checks??[],...e.map((r)=>typeof r==="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Ue(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(d$(e,t))},superRefine(e,t){return this.check(p$(e,t))},overwrite(e){return this.check(_t(e))},optional(){return jp(this)},exactOptional(){return e$(this)},nullable(){return Bp(this)},nullish(){return jp(Bp(this))},nonoptional(e){return s$(this,e)},array(){return Oa(this)},or(e){return q0([this,e])},and(e){return J0(this,e)},transform(e){return Up(this,Q0(e))},default(e){return n$(this,e)},prefault(e){return i$(this,e)},catch(e){return c$(this,e)},pipe(e){return Up(this,e)},readonly(){return f$(this)},describe(e){let t=this.clone();return jt.add(t,{description:e}),t},meta(...e){if(e.length===0)return jt.get(this);let t=this.clone();return jt.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get "~standard"(){return bo(this,"~standard",{...qs(this),jsonSchema:{input:cn(this,"input"),output:cn(this,"output")}})},set "~standard"(e){et(this,"~standard",e)},parse:function e(t,r){return zp(this,t,r,{callee:e})},parseAsync:async function e(t,r){return await Ap(this,t,r,{callee:e})},safeParse(e,t){return Pp(this,e,t)},async safeParseAsync(e,t){return Cp(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){et(this,"spa",e)},validate(e,t){return Ms(this,e,t)},validateAsync(e,t){return js(this,e,t)},encode:function e(t,r){return Rp(this,t,r,{callee:e})},decode:function e(t,r){return Tp(this,t,r,{callee:e})},encodeAsync:async function e(t,r){return await Np(this,t,r,{callee:e})},decodeAsync:async function e(t,r){return await Dp(this,t,r,{callee:e})},safeEncode(e,t){return Lp(this,e,t)},safeDecode(e,t){return Zp(this,e,t)},async safeEncodeAsync(e,t){return Fp(this,e,t)},async safeDecodeAsync(e,t){return Mp(this,e,t)},toJSONSchema(e){return Qd(this,{})(e)},get description(){return jt.get(this)?.description},get _def(){return this._zod.def}}),Vp=_("_ZodString",(e,t)=>{Po.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>cp(e,r,n,o)},pb({format:(e)=>$r(e).format??null,minLength:(e)=>$r(e).minimum??null,maxLength:(e)=>$r(e).maximum??null},{regex(...e){return this.check(na(...e))},includes(...e){return this.check(sa(...e))},startsWith(...e){return this.check(aa(...e))},endsWith(...e){return this.check(ca(...e))},min(...e){return this.check(_r(...e))},max(...e){return this.check(Lo(...e))},length(...e){return this.check(Zo(...e))},nonempty(...e){return this.check(_r(1,...e))},lowercase(e){return this.check(oa(e))},uppercase(e){return this.check(ia(e))},trim(){return this.check(la())},normalize(...e){return this.check(ua(...e))},toLowerCase(){return this.check(fa())},toUpperCase(){return this.check(ha())},slugify(){return this.check(da())}})),v0=_("ZodString",(e,t)=>{Po.init(e,t),Vp.init(e,t)},{email(e){return this.check(gd(E0,e))},url(e){return this.check($d(O0,e))},jwt(e){return this.check(Ld(B0,e))},emoji(e){return this.check(Sd(I0,e))},guid(e){return this.check(yd(x0,e))},uuid(e){return this.check(_d(Bo,e))},uuidv4(e){return this.check(wd(Bo,e))},uuidv6(e){return this.check(vd(Bo,e))},uuidv7(e){return this.check(bd(Bo,e))},nanoid(e){return this.check(kd(z0,e))},cuid(e){return this.check(Ed(A0,e))},cuid2(e){return this.check(xd(P0,e))},ulid(e){return this.check(Od(C0,e))},base64(e){return this.check(Td(F0,e))},base64url(e){return this.check(Nd(M0,e))},xid(e){return this.check(Id(R0,e))},ksuid(e){return this.check(zd(T0,e))},ipv4(e){return this.check(Ad(N0,e))},ipv6(e){return this.check(Pd(D0,e))},cidrv4(e){return this.check(Cd(L0,e))},cidrv6(e){return this.check(Rd(Z0,e))},e164(e){return this.check(Dd(j0,e))},datetime(e){return this.check(Zd(b0,e))},date(e){return this.check(Fd($0,e))},time(e){return this.check(Md(S0,e))},duration(e){return this.check(jd(k0,e))}});W=_("ZodStringFormat",(e,t)=>{B.init(e,t),Vp.init(e,t)}),b0=_("ZodISODateTime",(e,t)=>{Eh.init(e,t),W.init(e,t)}),$0=_("ZodISODate",(e,t)=>{xh.init(e,t),W.init(e,t)}),S0=_("ZodISOTime",(e,t)=>{Oh.init(e,t),W.init(e,t)}),k0=_("ZodISODuration",(e,t)=>{Ih.init(e,t),W.init(e,t)}),E0=_("ZodEmail",(e,t)=>{ph.init(e,t),W.init(e,t)}),x0=_("ZodGUID",(e,t)=>{hh.init(e,t),W.init(e,t)}),Bo=_("ZodUUID",(e,t)=>{dh.init(e,t),W.init(e,t)}),O0=_("ZodURL",(e,t)=>{yh.init(e,t),W.init(e,t)}),I0=_("ZodEmoji",(e,t)=>{_h.init(e,t),W.init(e,t)}),z0=_("ZodNanoID",(e,t)=>{wh.init(e,t),W.init(e,t)}),A0=_("ZodCUID",(e,t)=>{vh.init(e,t),W.init(e,t)}),P0=_("ZodCUID2",(e,t)=>{bh.init(e,t),W.init(e,t)}),C0=_("ZodULID",(e,t)=>{$h.init(e,t),W.init(e,t)}),R0=_("ZodXID",(e,t)=>{Sh.init(e,t),W.init(e,t)}),T0=_("ZodKSUID",(e,t)=>{kh.init(e,t),W.init(e,t)}),N0=_("ZodIPv4",(e,t)=>{zh.init(e,t),W.init(e,t)}),D0=_("ZodIPv6",(e,t)=>{Ph.init(e,t),W.init(e,t)}),L0=_("ZodCIDRv4",(e,t)=>{Ch.init(e,t),W.init(e,t)}),Z0=_("ZodCIDRv6",(e,t)=>{Rh.init(e,t),W.init(e,t)}),F0=_("ZodBase64",(e,t)=>{Nh.init(e,t),W.init(e,t)}),M0=_("ZodBase64URL",(e,t)=>{Dh.init(e,t),W.init(e,t)}),j0=_("ZodE164",(e,t)=>{Lh.init(e,t),W.init(e,t)}),B0=_("ZodJWT",(e,t)=>{Zh.init(e,t),W.init(e,t)}),U0=_("ZodUnknown",(e,t)=>{Fh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>lp(e,r,n,o)});V0=_("ZodNever",(e,t)=>{Mh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>up(e,r,n,o)});W0=_("ZodArray",(e,t)=>{xa(),jh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>pp(e,r,n,o),e.element=t.element},{min(e,t){return this.check(_r(e,t))},nonempty(e){return this.check(_r(1,e))},max(e,t){return this.check(Lo(e,t))},length(e,t){return this.check(Zo(e,t))},unwrap(){return this.element}});Gp=_("ZodObject",(e,t)=>{xa(),Vh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>mp(e,r,n,o),_b(e,"shape",(r)=>r._zod.def.shape,!1)},{keyof(){return Y0(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(ve(this._zod.def,{catchall:e}))},passthrough(){return this.clone(ve(this._zod.def,{catchall:ka()}))},loose(){return this.clone(ve(this._zod.def,{catchall:ka()}))},strict(){return this.clone(ve(this._zod.def,{catchall:G0()}))},strip(){return this.clone(ve(this._zod.def,{catchall:void 0}))},extend(e){return ub(this,e)},safeExtend(e){return lb(this,e)},merge(e){return fb(this,e)},pick(e){return ab(this,e)},omit(e){return cb(this,e)},partial(...e){return Hl(qp,this,e[0])},exactPartial(...e){return Hl(Kp,this,e[0],"exactPartial")},required(...e){return hb(Jp,this,e[0])}});H0=_("ZodUnion",(e,t)=>{Gh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>gp(e,r,n,o),e.options=t.options});K0=_("ZodIntersection",(e,t)=>{Wh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>yp(e,r,n,o)});Ea=_("ZodEnum",(e,t)=>{Hh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(n,o,i)=>fp(e,n,o,i),e.enum=t.entries,e.options=[...e._zod.values];let r=new Set(Object.keys(t.entries));e.extract=(n,o)=>{let i={};for(let s of n)if(r.has(s))i[s]=t.entries[s];else throw Error(`Key ${s} not found in enum`);return new Ea({...t,checks:[],...E(o),entries:i})},e.exclude=(n,o)=>{let i={...t.entries};for(let s of n)if(r.has(s))delete i[s];else throw Error(`Key ${s} not found in enum`);return new Ea({...t,checks:[],...E(o),entries:i})}});X0=_("ZodTransform",(e,t)=>{xa(),qh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>dp(e,r,n,o),e._zod.parse=(r,n)=>{if(n.direction==="backward")throw new en(e.constructor.name);r.addIssue=(i)=>{if(typeof i==="string")r.issues.push(Ft(i,r.value,t));else{let s=i;if(s.fatal)s.continue=!1;if(s.code??(s.code="custom"),!("input"in s))s.input=r.value;s.inst??(s.inst=e),r.issues.push(Ft(s))}};let o=t.transform(r.value,r);if(o instanceof Promise)return o.then((i)=>(r.value=i,r));return r.value=o,r}});qp=_("ZodOptional",(e,t)=>{Js.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>va(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Kp=_("ZodExactOptional",(e,t)=>{Kh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>va(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});t$=_("ZodNullable",(e,t)=>{Jh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>_p(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});r$=_("ZodDefault",(e,t)=>{Yh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>bp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});o$=_("ZodPrefault",(e,t)=>{Xh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>$p(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});Jp=_("ZodNonOptional",(e,t)=>{Qh.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>wp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});a$=_("ZodCatch",(e,t)=>{ed.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Sp(e,r,n,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});u$=_("ZodPipe",(e,t)=>{td.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>kp(e,r,n,o),e.in=t.in,e.out=t.out});l$=_("ZodReadonly",(e,t)=>{rd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>Ep(e,r,n,o),e.unwrap=()=>e._zod.def.innerType});h$=_("ZodCustom",(e,t)=>{nd.init(e,t),X.init(e,t),e._zod.processJSONSchema=(r,n,o)=>hp(e,r,n,o)})});var Xp;var Qp=A(()=>{(function(e){})(Xp||(Xp={}))});var em=()=>{};var tm=()=>{};var za=A(()=>{tt();ta();em();tm();Yp();ba();$a();Sa();Qp()});var Aa=A(()=>{za();za()});async function rm(e){let t=await je(e);if(!t)return 1;let r=await Dt(t,"/api/_me/organizations",{method:"GET",fetch:e.fetch});if(!r.ok)return Lt(r,t,e.output);let n=y$.safeParse(await r.json());if(!n.success)return console.error("Unexpected response from the organizations endpoint."),1;let{organizations:o}=n.data;if(e.json)return console.log(JSON.stringify(o)),0;for(let i of o)console.log(`${i.slug} ${i.name}`);return 0}var y$;var nm=A(()=>{Aa();mr();y$=Wp({organizations:Oa(Hp({id:un(),slug:un(),name:un()}))})});async function om(e){let{subcommand:t,arg:r,org:n}=e;if(!t||!["list","describe","call"].includes(t)||t!=="list"&&!r)return console.error(_$),1;if(!n)return console.error("Missing --org <slug>. The slug is the first path segment of the studio URL."),1;let o=await je(e);if(!o)return 1;let i=`/api/${encodeURIComponent(n)}/tools`;if(t==="call"&&r){let f;try{let h=await fo(e.data,e.readStdin)??{bytes:"{}",contentType:"application/json"};f=await Dt(o,`${i}/${encodeURIComponent(r)}`,{method:"POST",body:h,fetch:e.fetch})}catch(h){return console.error(Kr(h)),1}return Lt(f,o,e.output)}let s=await Dt(o,i,{method:"GET",fetch:e.fetch});if(!s.ok)return Lt(s,o,e.output);let a=w$.safeParse(await s.json());if(!a.success)return console.error("Unexpected response from the tools endpoint."),1;let{tools:c}=a.data;if(t==="describe"){let f=c.find((h)=>h.name===r);if(!f)return console.error(`Unknown tool: ${r}. Run \`g4lstudio tools list --org ${n} <search>\`.`),1;return console.log(JSON.stringify(f,null,2)),0}let l=r?.toLowerCase(),u=l?c.filter((f)=>f.name.toLowerCase().includes(l)||f.description?.toLowerCase().includes(l)):c;if(e.json)return console.log(JSON.stringify(u)),0;for(let f of u){let h=f.description?.trim().split(`
|
|
138
|
+
`)[0]??"";console.log(h?`${f.name} ${h}`:f.name)}return 0}var _$=`Usage:
|
|
139
|
+
g4lstudio tools list --org <slug> [search] [--json]
|
|
140
|
+
g4lstudio tools describe <name> --org <slug>
|
|
141
|
+
g4lstudio tools call <name> --org <slug> [-d <json|@file|@->]`,w$;var im=A(()=>{Aa();mr();w$=Wp({tools:Oa(Hp({name:un(),description:un().optional()}))})});import{parseArgs as v$}from"util";import{homedir as b$}from"os";import{join as $$}from"path";function Vo(e,t,r){if(t===void 0)return;let n=Number(t);if(!Number.isSafeInteger(n)||n<=0||r!==void 0&&n>r)throw Error(`Invalid --${e} "${t}" \u2014 must be a positive integer${r!==void 0?` up to ${r}`:""}.`);return n}var{values:H,positionals:Bt}=v$({args:process.argv.slice(2),options:{home:{type:"string"},"base-url":{type:"string"},help:{type:"boolean",short:"h",default:!1},version:{type:"boolean",short:"v",default:!1},target:{type:"string"},"dry-run":{type:"boolean",default:!1},batch:{type:"string"},limit:{type:"string"},org:{type:"string"},method:{type:"string",short:"X"},data:{type:"string",short:"d"},header:{type:"string",short:"H",multiple:!0},json:{type:"boolean",default:!1}},allowPositionals:!0});if(H.help||process.argv.length===2)console.log(`
|
|
142
|
+
g4lstudio.ai \u2014 Open-source control plane for your AI agents
|
|
143
|
+
|
|
144
|
+
Usage:
|
|
145
|
+
g4lstudio init <directory> Scaffold a new MCP app
|
|
146
|
+
g4lstudio auth <login|whoami|token|logout> Manage CLI authentication
|
|
147
|
+
g4lstudio api <path> Authenticated request to the studio
|
|
148
|
+
g4lstudio tools <list|describe|call> List, inspect, and call builtin tools
|
|
149
|
+
g4lstudio orgs List the organizations you belong to
|
|
150
|
+
g4lstudio backfill-assets Hoist legacy inline media out of threads + connections + org logos
|
|
151
|
+
g4lstudio completion [shell] Install shell completions
|
|
152
|
+
|
|
153
|
+
Options:
|
|
154
|
+
--home <path> CLI session directory (default: ~/g4lstudio/)
|
|
155
|
+
-h, --help Show this help message
|
|
156
|
+
-v, --version Show version
|
|
157
|
+
|
|
158
|
+
Run Studio with Docker Compose or Kubernetes. See the repository setup guide.
|
|
159
|
+
|
|
160
|
+
Auth Options (auth, api, tools, orgs):
|
|
161
|
+
--target <url> G4lstudio target (default: https://app.g4lstudio.ai)
|
|
162
|
+
|
|
163
|
+
API Options:
|
|
164
|
+
-X, --method <m> HTTP method (default: POST with --data, else GET)
|
|
165
|
+
-d, --data <body> Request body: literal, @<file>, or @- for stdin
|
|
166
|
+
-H, --header <h> Extra header "Name: value" (repeatable)
|
|
167
|
+
|
|
168
|
+
Tools Options:
|
|
169
|
+
--org <slug> Organization slug (first path segment of the studio URL)
|
|
170
|
+
-d, --data <json> Tool arguments: literal JSON, @<file>, or @- for stdin
|
|
171
|
+
--json Print full objects from tools list and orgs
|
|
172
|
+
|
|
173
|
+
Backfill Options (backfill-assets):
|
|
174
|
+
--target <t> all | threads | connections | organizations (default: all)
|
|
175
|
+
--org <slug|id> Restrict to a single organization
|
|
176
|
+
--dry-run Report what would change without uploading or writing
|
|
177
|
+
--batch <n> Rows scanned per page (default: 500)
|
|
178
|
+
--limit <n> Cap total rows scanned per target (default: all)
|
|
179
|
+
--base-url <url> Public origin for stored URLs (default: BASE_URL env)
|
|
180
|
+
|
|
181
|
+
Examples:
|
|
182
|
+
g4lstudio init my-app Scaffold a new MCP app
|
|
183
|
+
g4lstudio auth login Log in to app.g4lstudio.ai
|
|
184
|
+
g4lstudio auth whoami Show current session
|
|
185
|
+
g4lstudio orgs
|
|
186
|
+
g4lstudio tools list --org my-org thread
|
|
187
|
+
g4lstudio tools call ORGANIZATION_LIST --org my-org
|
|
188
|
+
g4lstudio api "/api/my-org/fs/<volume>/list?path=/"
|
|
189
|
+
|
|
190
|
+
Documentation:
|
|
191
|
+
https://g4lstudio.ai
|
|
192
|
+
`),process.exit(0);async function S$(){let e=[new URL("./package.json",import.meta.url),new URL("../package.json",import.meta.url),new URL("../../package.json",import.meta.url)];for(let t of e)try{let r=Bun.file(t);if(await r.exists())return(await r.json()).version}catch{}return"unknown"}if(H.version)console.log(`g4lstudio.ai v${await S$()}`),process.exit(0);var Ne=Bt[0];if(Ne==="init"){await Promise.resolve().then(() => al());await sl(Bt[1]),process.exit(0)}if(Ne==="completion"){await Promise.resolve().then(() => hl());await fl(Bt[1]),process.exit(0)}if(Ne==="backfill-assets"){await Promise.resolve();let t=H.target??"all";if(!["all","threads","connections","organizations"].includes(t))console.error(`Invalid --target "${t}". Use: all | threads | connections | organizations`),process.exit(1);let r=500,n;try{r=Vo("batch",H.batch)??500,n=Vo("limit",H.limit)}catch(i){console.error(i.message),process.exit(1)}let o=await dl({dryRun:H["dry-run"]===!0,batch:r,limit:n,baseUrl:H["base-url"],org:H.org,target:t});process.exit(o)}function Uo(){return H.home||process.env.DATA_DIR||process.env.G4LSTUDIO_HOME||$$(b$(),"g4lstudio")}if(Ne==="auth"){let e=Bt[1],t=Uo();if(e==="login"){await Promise.resolve().then(() => kl());let n=await Sl({dataDir:t,target:H.target});process.exit(n)}if(e==="whoami"){await Promise.resolve().then(() => Al());let n=await zl({dataDir:t,target:H.target});process.exit(n)}if(e==="token"){await Promise.resolve().then(() => Cl());let n=await Pl({dataDir:t,target:H.target});process.exit(n)}if(e==="logout"){await Promise.resolve().then(() => Tl());let n=await Rl({dataDir:t,target:H.target});process.exit(n)}console.error("Usage: g4lstudio auth <login|whoami|token|logout>"),process.exit(1)}if(Ne==="api"){await Promise.resolve().then(() => Dl());let t=await Nl({dataDir:Uo(),target:H.target,path:Bt[1],method:H.method,data:H.data,headers:H.header});process.exit(t)}if(Ne==="orgs"){await Promise.resolve().then(() => nm());let t=await rm({dataDir:Uo(),target:H.target,json:H.json===!0});process.exit(t)}if(Ne==="tools"){await Promise.resolve().then(() => im());let t=await om({dataDir:Uo(),target:H.target,subcommand:Bt[1],arg:Bt[2],org:H.org,data:H.data,json:H.json===!0});process.exit(t)}console.error(Ne==="dev"||Ne==="services"||Ne==="serve"?"Run Studio with Docker Compose or Kubernetes. Use --help for client commands.":`Unknown command: ${Ne}. Use --help for available commands.`);process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "g4lstudio",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.56.0",
|
|
4
|
+
"description": "CLI do g4lstudio.ai: login, organizações, ferramentas e API do Studio pelo terminal.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://g4lstudio.ai",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Garage4Labs/g4lstudio.ai.git"
|
|
10
|
+
},
|
|
11
|
+
"type": "module",
|
|
12
|
+
"bin": {
|
|
13
|
+
"g4lstudio": "./cli.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"cli.js"
|
|
17
|
+
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"bun": ">=1.2"
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
}
|
|
24
|
+
}
|