@capgo/cli 7.94.1 → 7.94.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
3
  "type": "module",
4
- "version": "7.94.1",
4
+ "version": "7.94.2",
5
5
  "description": "A CLI to upload to capgo servers",
6
6
  "author": "Martin martin@capgo.app",
7
7
  "license": "Apache 2.0",
package/dist/src/sdk.js CHANGED
@@ -118,7 +118,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
118
118
  `)}),$.__defineSetter__("stack",function(F){return[F].concat($.stack).join(`
119
119
 
120
120
  `)}),$}});var lv=I((rr0,dv)=>{var O4=n("constants"),mO0=process.cwd,qY=null,cO0=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!qY)qY=mO0.call(process);return qY};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(KY=process.chdir,process.chdir=function(D){qY=null,KY.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,KY)}var KY;dv.exports=dO0;function dO0(D){if(O4.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))$(D);if(!D.lutimes)F(D);if(D.chown=Y(D.chown),D.fchown=Y(D.fchown),D.lchown=Y(D.lchown),D.chmod=X(D.chmod),D.fchmod=X(D.fchmod),D.lchmod=X(D.lchmod),D.chownSync=Q(D.chownSync),D.fchownSync=Q(D.fchownSync),D.lchownSync=Q(D.lchownSync),D.chmodSync=J(D.chmodSync),D.fchmodSync=J(D.fchmodSync),D.lchmodSync=J(D.lchmodSync),D.stat=Z(D.stat),D.fstat=Z(D.fstat),D.lstat=Z(D.lstat),D.statSync=U(D.statSync),D.fstatSync=U(D.fstatSync),D.lstatSync=U(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(O,B,q){if(q)process.nextTick(q)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(O,B,q,K){if(K)process.nextTick(K)},D.lchownSync=function(){};if(cO0==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(O){function B(q,K,H){var W=Date.now(),L=0;O(q,K,function M(A){if(A&&(A.code==="EACCES"||A.code==="EPERM"||A.code==="EBUSY")&&Date.now()-W<60000){if(setTimeout(function(){D.stat(K,function(z,N){if(z&&z.code==="ENOENT")O(q,K,M);else H(A)})},L),L<100)L+=10;return}if(H)H(A)})}if(Object.setPrototypeOf)Object.setPrototypeOf(B,O);return B}(D.rename);D.read=typeof D.read!=="function"?D.read:function(O){function B(q,K,H,W,L,M){var A;if(M&&typeof M==="function"){var z=0;A=function(N,V,E){if(N&&N.code==="EAGAIN"&&z<10)return z++,O.call(D,q,K,H,W,L,A);M.apply(this,arguments)}}return O.call(D,q,K,H,W,L,A)}if(Object.setPrototypeOf)Object.setPrototypeOf(B,O);return B}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(O){return function(B,q,K,H,W){var L=0;while(!0)try{return O.call(D,B,q,K,H,W)}catch(M){if(M.code==="EAGAIN"&&L<10){L++;continue}throw M}}}(D.readSync);function $(O){O.lchmod=function(B,q,K){O.open(B,O4.O_WRONLY|O4.O_SYMLINK,q,function(H,W){if(H){if(K)K(H);return}O.fchmod(W,q,function(L){O.close(W,function(M){if(K)K(L||M)})})})},O.lchmodSync=function(B,q){var K=O.openSync(B,O4.O_WRONLY|O4.O_SYMLINK,q),H=!0,W;try{W=O.fchmodSync(K,q),H=!1}finally{if(H)try{O.closeSync(K)}catch(L){}else O.closeSync(K)}return W}}function F(O){if(O4.hasOwnProperty("O_SYMLINK")&&O.futimes)O.lutimes=function(B,q,K,H){O.open(B,O4.O_SYMLINK,function(W,L){if(W){if(H)H(W);return}O.futimes(L,q,K,function(M){O.close(L,function(A){if(H)H(M||A)})})})},O.lutimesSync=function(B,q,K){var H=O.openSync(B,O4.O_SYMLINK),W,L=!0;try{W=O.futimesSync(H,q,K),L=!1}finally{if(L)try{O.closeSync(H)}catch(M){}else O.closeSync(H)}return W};else if(O.futimes)O.lutimes=function(B,q,K,H){if(H)process.nextTick(H)},O.lutimesSync=function(){}}function X(O){if(!O)return O;return function(B,q,K){return O.call(D,B,q,function(H){if(G(H))H=null;if(K)K.apply(this,arguments)})}}function J(O){if(!O)return O;return function(B,q){try{return O.call(D,B,q)}catch(K){if(!G(K))throw K}}}function Y(O){if(!O)return O;return function(B,q,K,H){return O.call(D,B,q,K,function(W){if(G(W))W=null;if(H)H.apply(this,arguments)})}}function Q(O){if(!O)return O;return function(B,q,K){try{return O.call(D,B,q,K)}catch(H){if(!G(H))throw H}}}function Z(O){if(!O)return O;return function(B,q,K){if(typeof q==="function")K=q,q=null;function H(W,L){if(L){if(L.uid<0)L.uid+=4294967296;if(L.gid<0)L.gid+=4294967296}if(K)K.apply(this,arguments)}return q?O.call(D,B,q,H):O.call(D,B,H)}}function U(O){if(!O)return O;return function(B,q){var K=q?O.call(D,B,q):O.call(D,B);if(K){if(K.uid<0)K.uid+=4294967296;if(K.gid<0)K.gid+=4294967296}return K}}function G(O){if(!O)return!0;if(O.code==="ENOSYS")return!0;var B=!process.getuid||process.getuid()!==0;if(B){if(O.code==="EINVAL"||O.code==="EPERM")return!0}return!1}}});var pv=I((tr0,iv)=>{var nv=n("stream").Stream;iv.exports=lO0;function lO0(D){return{ReadStream:$,WriteStream:F};function $(X,J){if(!(this instanceof $))return new $(X,J);nv.call(this);var Y=this;this.path=X,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,J=J||{};var Q=Object.keys(J);for(var Z=0,U=Q.length;Z<U;Z++){var G=Q[Z];this[G]=J[G]}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(){Y._read()});return}D.open(this.path,this.flags,this.mode,function(O,B){if(O){Y.emit("error",O),Y.readable=!1;return}Y.fd=B,Y.emit("open",B),Y._read()})}function F(X,J){if(!(this instanceof F))return new F(X,J);nv.call(this),this.path=X,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,J=J||{};var Y=Object.keys(J);for(var Q=0,Z=Y.length;Q<Z;Q++){var U=Y[Q];this[U]=J[U]}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=D.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush()}}});var tv=I((or0,rv)=>{rv.exports=iO0;var nO0=Object.getPrototypeOf||function(D){return D.__proto__};function iO0(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var $={__proto__:nO0(D)};else var $=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(F){Object.defineProperty($,F,Object.getOwnPropertyDescriptor(D,F))}),$}});var u1=I((ar0,yq)=>{var E1=n("fs"),pO0=lv(),rO0=pv(),tO0=tv(),HY=n("util"),$D,zY;if(typeof Symbol==="function"&&typeof Symbol.for==="function")$D=Symbol.for("graceful-fs.queue"),zY=Symbol.for("graceful-fs.previous");else $D="___graceful-fs.queue",zY="___graceful-fs.previous";function oO0(){}function av(D,$){Object.defineProperty(D,$D,{get:function(){return $}})}var P8=oO0;if(HY.debuglog)P8=HY.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))P8=function(){var D=HY.format.apply(HY,arguments);D="GFS4: "+D.split(/\n/).join(`
121
- GFS4: `),console.error(D)};if(!E1[$D]){if(_q=global[$D]||[],av(E1,_q),E1.close=function(D){function $(F,X){return D.call(E1,F,function(J){if(!J)ov();if(typeof X==="function")X.apply(this,arguments)})}return Object.defineProperty($,zY,{value:D}),$}(E1.close),E1.closeSync=function(D){function $(F){D.apply(E1,arguments),ov()}return Object.defineProperty($,zY,{value:D}),$}(E1.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){P8(E1[$D]),n("assert").equal(E1[$D].length,0)})}var _q;if(!global[$D])av(global,E1[$D]);yq.exports=kq(tO0(E1));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!E1.__patched)yq.exports=kq(E1),E1.__patched=!0;function kq(D){pO0(D),D.gracefulify=kq,D.createReadStream=V,D.createWriteStream=E;var $=D.readFile;D.readFile=F;function F(R,v,P){if(typeof v==="function")P=v,v=null;return g(R,v,P);function g(m,p,k,j){return $(m,p,function(S){if(S&&(S.code==="EMFILE"||S.code==="ENFILE"))K9([g,[m,p,k],S,j||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var X=D.writeFile;D.writeFile=J;function J(R,v,P,g){if(typeof P==="function")g=P,P=null;return m(R,v,P,g);function m(p,k,j,S,u){return X(p,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))K9([m,[p,k,j,S],f,u||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var Y=D.appendFile;if(Y)D.appendFile=Q;function Q(R,v,P,g){if(typeof P==="function")g=P,P=null;return m(R,v,P,g);function m(p,k,j,S,u){return Y(p,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))K9([m,[p,k,j,S],f,u||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var Z=D.copyFile;if(Z)D.copyFile=U;function U(R,v,P,g){if(typeof P==="function")g=P,P=0;return m(R,v,P,g);function m(p,k,j,S,u){return Z(p,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))K9([m,[p,k,j,S],f,u||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var G=D.readdir;D.readdir=B;var O=/^v[0-5]\./;function B(R,v,P){if(typeof v==="function")P=v,v=null;var g=O.test(process.version)?function(k,j,S,u){return G(k,m(k,j,S,u))}:function(k,j,S,u){return G(k,j,m(k,j,S,u))};return g(R,v,P);function m(p,k,j,S){return function(u,f){if(u&&(u.code==="EMFILE"||u.code==="ENFILE"))K9([g,[p,k,j],u,S||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof j==="function")j.call(this,u,f)}}}}if(process.version.substr(0,4)==="v0.8"){var q=rO0(D);M=q.ReadStream,z=q.WriteStream}var K=D.ReadStream;if(K)M.prototype=Object.create(K.prototype),M.prototype.open=A;var H=D.WriteStream;if(H)z.prototype=Object.create(H.prototype),z.prototype.open=N;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(R){M=R},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return z},set:function(R){z=R},enumerable:!0,configurable:!0});var W=M;Object.defineProperty(D,"FileReadStream",{get:function(){return W},set:function(R){W=R},enumerable:!0,configurable:!0});var L=z;Object.defineProperty(D,"FileWriteStream",{get:function(){return L},set:function(R){L=R},enumerable:!0,configurable:!0});function M(R,v){if(this instanceof M)return K.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function A(){var R=this;_(R.path,R.flags,R.mode,function(v,P){if(v){if(R.autoClose)R.destroy();R.emit("error",v)}else R.fd=P,R.emit("open",P),R.read()})}function z(R,v){if(this instanceof z)return H.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function N(){var R=this;_(R.path,R.flags,R.mode,function(v,P){if(v)R.destroy(),R.emit("error",v);else R.fd=P,R.emit("open",P)})}function V(R,v){return new D.ReadStream(R,v)}function E(R,v){return new D.WriteStream(R,v)}var x=D.open;D.open=_;function _(R,v,P,g){if(typeof P==="function")g=P,P=null;return m(R,v,P,g);function m(p,k,j,S,u){return x(p,k,j,function(f,h){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))K9([m,[p,k,j,S],f,u||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}return D}function K9(D){P8("ENQUEUE",D[0].name,D[1]),E1[$D].push(D),fq()}var WY;function ov(){var D=Date.now();for(var $=0;$<E1[$D].length;++$)if(E1[$D][$].length>2)E1[$D][$][3]=D,E1[$D][$][4]=D;fq()}function fq(){if(clearTimeout(WY),WY=void 0,E1[$D].length===0)return;var D=E1[$D].shift(),$=D[0],F=D[1],X=D[2],J=D[3],Y=D[4];if(J===void 0)P8("RETRY",$.name,F),$.apply(null,F);else if(Date.now()-J>=60000){P8("TIMEOUT",$.name,F);var Q=F.pop();if(typeof Q==="function")Q.call(null,X)}else{var Z=Date.now()-Y,U=Math.max(Y-J,1),G=Math.min(U*1.2,100);if(Z>=G)P8("RETRY",$.name,F),$.apply(null,F.concat([J]));else E1[$D].push(D)}if(WY===void 0)WY=setTimeout(fq,0)}});var ev=I((sr0,sv)=>{function G$(D,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}sv.exports=G$;G$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};G$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};G$.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var $=new Date().getTime();if(D&&$-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var F=this._timeouts.shift();if(F===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),F=this._timeouts.shift();else return!1;var X=this,J=setTimeout(function(){if(X._attempts++,X._operationTimeoutCb){if(X._timeout=setTimeout(function(){X._operationTimeoutCb(X._attempts)},X._operationTimeout),X._options.unref)X._timeout.unref()}X._fn(X._attempts)},F);if(this._options.unref)J.unref();return!0};G$.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var F=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){F._operationTimeoutCb()},F._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};G$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};G$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};G$.prototype.start=G$.prototype.try;G$.prototype.errors=function(){return this._errors};G$.prototype.attempts=function(){return this._attempts};G$.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,F=0;for(var X=0;X<this._errors.length;X++){var J=this._errors[X],Y=J.message,Q=(D[Y]||0)+1;if(D[Y]=Q,Q>=F)$=J,F=Q}return $}});var $u=I((sO0)=>{var aO0=ev();sO0.operation=function(D){var $=sO0.timeouts(D);return new aO0($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};sO0.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var F in D)$[F]=D[F];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var X=[];for(var J=0;J<$.retries;J++)X.push(this.createTimeout(J,$));if(D&&D.forever&&!X.length)X.push(this.createTimeout(J,$));return X.sort(function(Y,Q){return Y-Q}),X};sO0.createTimeout=function(D,$){var F=$.randomize?Math.random()+1:1,X=Math.round(F*$.minTimeout*Math.pow($.factor,D));return X=Math.min(X,$.maxTimeout),X};sO0.wrap=function(D,$,F){if($ instanceof Array)F=$,$=null;if(!F){F=[];for(var X in D)if(typeof D[X]==="function")F.push(X)}for(var J=0;J<F.length;J++){var Y=F[J],Q=D[Y];D[Y]=function(U){var G=sO0.operation($),O=Array.prototype.slice.call(arguments,1),B=O.pop();O.push(function(q){if(G.retry(q))return;if(q)arguments[0]=G.mainError();B.apply(this,arguments)}),G.attempt(function(){U.apply(D,O)})}.bind(D,Q),D[Y].options=$}}});var Fu=I((Dt0,VY)=>{VY.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")VY.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")VY.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var LY=I(($t0,W9)=>{var L1=global.process,S8=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!S8(L1))W9.exports=function(){return function(){}};else{if(bq=n("assert"),x8=Fu(),hq=/^win/i.test(L1.platform),H9=n("events"),typeof H9!=="function")H9=H9.EventEmitter;if(L1.__signal_exit_emitter__)l1=L1.__signal_exit_emitter__;else l1=L1.__signal_exit_emitter__=new H9,l1.count=0,l1.emitted={};if(!l1.infinite)l1.setMaxListeners(1/0),l1.infinite=!0;W9.exports=function(D,$){if(!S8(global.process))return function(){};if(bq.equal(typeof D,"function","a callback must be provided for exit handler"),v8===!1)NY();var F="exit";if($&&$.alwaysLast)F="afterexit";var X=function(){if(l1.removeListener(F,D),l1.listeners("exit").length===0&&l1.listeners("afterexit").length===0)Q3()};return l1.on(F,D),X},Q3=function(){if(!v8||!S8(global.process))return;v8=!1,x8.forEach(function($){try{L1.removeListener($,Z3[$])}catch(F){}}),L1.emit=U3,L1.reallyExit=wY,l1.count-=1},W9.exports.unload=Q3,B4=function($,F,X){if(l1.emitted[$])return;l1.emitted[$]=!0,l1.emit($,F,X)},Z3={},x8.forEach(function(D){Z3[D]=function(){if(!S8(global.process))return;var F=L1.listeners(D);if(F.length===l1.count){if(Q3(),B4("exit",null,D),B4("afterexit",null,D),hq&&D==="SIGHUP")D="SIGINT";L1.kill(L1.pid,D)}}}),W9.exports.signals=function(){return x8},v8=!1,NY=function(){if(v8||!S8(global.process))return;v8=!0,l1.count+=1,x8=x8.filter(function($){try{return L1.on($,Z3[$]),!0}catch(F){return!1}}),L1.emit=mq,L1.reallyExit=gq},W9.exports.load=NY,wY=L1.reallyExit,gq=function($){if(!S8(global.process))return;L1.exitCode=$||0,B4("exit",L1.exitCode,null),B4("afterexit",L1.exitCode,null),wY.call(L1,L1.exitCode)},U3=L1.emit,mq=function($,F){if($==="exit"&&S8(global.process)){if(F!==void 0)L1.exitCode=F;var X=U3.apply(this,arguments);return B4("exit",L1.exitCode,null),B4("afterexit",L1.exitCode,null),X}else return U3.apply(this,arguments)}}var bq,x8,hq,H9,l1,Q3,B4,Z3,v8,NY,wY,gq,U3,mq});var Ju=I((JB0,cq)=>{var Xu=Symbol();function FB0(D,$,F){let X=$[Xu];if(X)return $.stat(D,(Y,Q)=>{if(Y)return F(Y);F(null,Q.mtime,X)});let J=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,J,J,(Y)=>{if(Y)return F(Y);$.stat(D,(Q,Z)=>{if(Q)return F(Q);let U=Z.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,Xu,{value:U}),F(null,Z.mtime,U)})})}function XB0(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}JB0.probe=FB0;JB0.getMtime=XB0});var Gu=I((KB0,O3)=>{var ZB0=n("path"),nq=u1(),UB0=$u(),GB0=LY(),Yu=Ju(),C6={};function G3(D,$){return $.lockfilePath||`${D}.lock`}function iq(D,$,F){if(!$.realpath)return F(null,ZB0.resolve(D));$.fs.realpath(D,F)}function lq(D,$,F){let X=G3(D,$);$.fs.mkdir(X,(J)=>{if(!J)return Yu.probe(X,$.fs,(Y,Q,Z)=>{if(Y)return $.fs.rmdir(X,()=>{}),F(Y);F(null,Q,Z)});if(J.code!=="EEXIST")return F(J);if($.stale<=0)return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(X,(Y,Q)=>{if(Y){if(Y.code==="ENOENT")return lq(D,{...$,stale:0},F);return F(Y)}if(!Qu(Q,$))return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));Zu(D,$,(Z)=>{if(Z)return F(Z);lq(D,{...$,stale:0},F)})})})}function Qu(D,$){return D.mtime.getTime()<Date.now()-$.stale}function Zu(D,$,F){$.fs.rmdir(G3(D,$),(X)=>{if(X&&X.code!=="ENOENT")return F(X);F()})}function MY(D,$){let F=C6[D];if(F.updateTimeout)return;if(F.updateDelay=F.updateDelay||$.update,F.updateTimeout=setTimeout(()=>{F.updateTimeout=null,$.fs.stat(F.lockfilePath,(X,J)=>{let Y=F.lastUpdate+$.stale<Date.now();if(X){if(X.code==="ENOENT"||Y)return dq(D,F,Object.assign(X,{code:"ECOMPROMISED"}));return F.updateDelay=1000,MY(D,$)}if(F.mtime.getTime()!==J.mtime.getTime())return dq(D,F,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let Z=Yu.getMtime(F.mtimePrecision);$.fs.utimes(F.lockfilePath,Z,Z,(U)=>{let G=F.lastUpdate+$.stale<Date.now();if(F.released)return;if(U){if(U.code==="ENOENT"||G)return dq(D,F,Object.assign(U,{code:"ECOMPROMISED"}));return F.updateDelay=1000,MY(D,$)}F.mtime=Z,F.lastUpdate=Date.now(),F.updateDelay=null,MY(D,$)})})},F.updateDelay),F.updateTimeout.unref)F.updateTimeout.unref()}function dq(D,$,F){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(C6[D]===$)delete C6[D];$.options.onCompromised(F)}function OB0(D,$,F){$={stale:1e4,update:null,realpath:!0,retries:0,fs:nq,onCompromised:(X)=>{throw X},...$},$.retries=$.retries||0,$.retries=typeof $.retries==="number"?{retries:$.retries}:$.retries,$.stale=Math.max($.stale||0,2000),$.update=$.update==null?$.stale/2:$.update||0,$.update=Math.max(Math.min($.update,$.stale/2),1000),iq(D,$,(X,J)=>{if(X)return F(X);let Y=UB0.operation($.retries);Y.attempt(()=>{lq(J,$,(Q,Z,U)=>{if(Y.retry(Q))return;if(Q)return F(Y.mainError());let G=C6[J]={lockfilePath:G3(J,$),mtime:Z,mtimePrecision:U,options:$,lastUpdate:Date.now()};MY(J,$),F(null,(O)=>{if(G.released)return O&&O(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));Uu(J,{...$,realpath:!1},O)})})})})}function Uu(D,$,F){$={fs:nq,realpath:!0,...$},iq(D,$,(X,J)=>{if(X)return F(X);let Y=C6[J];if(!Y)return F(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));Y.updateTimeout&&clearTimeout(Y.updateTimeout),Y.released=!0,delete C6[J],Zu(J,$,F)})}function BB0(D,$,F){$={stale:1e4,realpath:!0,fs:nq,...$},$.stale=Math.max($.stale||0,2000),iq(D,$,(X,J)=>{if(X)return F(X);$.fs.stat(G3(J,$),(Y,Q)=>{if(Y)return Y.code==="ENOENT"?F(null,!1):F(Y);return F(null,!Qu(Q,$))})})}function qB0(){return C6}GB0(()=>{for(let D in C6){let $=C6[D].options;try{$.fs.rmdirSync(G3(D,$))}catch(F){}}});KB0.lock=OB0;KB0.unlock=Uu;KB0.check=BB0;KB0.getLocks=qB0});var Bu=I((Ft0,Ou)=>{var NB0=u1();function wB0(D){let $=["mkdir","realpath","stat","rmdir","utimes"],F={...D};return $.forEach((X)=>{F[X]=(...J)=>{let Y=J.pop(),Q;try{Q=D[`${X}Sync`](...J)}catch(Z){return Y(Z)}Y(null,Q)}}),F}function LB0(D){return(...$)=>new Promise((F,X)=>{$.push((J,Y)=>{if(J)X(J);else F(Y)}),D(...$)})}function MB0(D){return(...$)=>{let F,X;if($.push((J,Y)=>{F=J,X=Y}),D(...$),F)throw F;return X}}function AB0(D){if(D={...D},D.fs=wB0(D.fs||NB0),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}Ou.exports={toPromise:LB0,toSync:MB0,toSyncOptions:AB0}});var Ku=I((Xt0,q4)=>{var z9=Gu(),{toPromise:AY,toSync:IY,toSyncOptions:pq}=Bu();async function qu(D,$){let F=await AY(z9.lock)(D,$);return AY(F)}function IB0(D,$){let F=IY(z9.lock)(D,pq($));return IY(F)}function RB0(D,$){return AY(z9.unlock)(D,$)}function EB0(D,$){return IY(z9.unlock)(D,pq($))}function jB0(D,$){return AY(z9.check)(D,$)}function TB0(D,$){return IY(z9.check)(D,pq($))}q4.exports=qu;q4.exports.lock=qu;q4.exports.unlock=RB0;q4.exports.lockSync=IB0;q4.exports.unlockSync=EB0;q4.exports.check=jB0;q4.exports.checkSync=TB0});var Lu=I((Nu)=>{Object.defineProperty(Nu,"__esModule",{value:!0});Nu.canStoreURLs=Nu.FileUrlStorage=void 0;var Hu=n("fs"),CB0=SB0(cv()),Wu=PB0(Ku());function Vu(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,F=new WeakMap;return(Vu=function(X){return X?F:$})(D)}function PB0(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var F=Vu($);if(F&&F.has(D))return F.get(D);var X={__proto__:null},J=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Y in D)if(Y!=="default"&&{}.hasOwnProperty.call(D,Y)){var Q=J?Object.getOwnPropertyDescriptor(D,Y):null;Q&&(Q.get||Q.set)?Object.defineProperty(X,Y,Q):X[Y]=D[Y]}return X.default=D,F&&F.set(D,X),X}function SB0(D){return D&&D.__esModule?D:{default:D}}function B3(D){return B3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},B3(D)}function xB0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function zu(D,$){for(var F=0;F<$.length;F++){var X=$[F];if(X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X)X.writable=!0;Object.defineProperty(D,uB0(X.key),X)}}function vB0(D,$,F){if($)zu(D.prototype,$);if(F)zu(D,F);return Object.defineProperty(D,"prototype",{writable:!1}),D}function uB0(D){var $=_B0(D,"string");return B3($)=="symbol"?$:$+""}function _B0(D,$){if(B3(D)!="object"||!D)return D;var F=D[Symbol.toPrimitive];if(F!==void 0){var X=F.call(D,$||"default");if(B3(X)!="object")return X;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var Jt0=Nu.canStoreURLs=!0,Yt0=Nu.FileUrlStorage=function(){function D($){xB0(this,D),this.path=$}return vB0(D,[{key:"findAllUploads",value:function(){var F=this;return new Promise(function(X,J){F._getItems("tus::",function(Y,Q){if(Y)J(Y);else X(Q)})})}},{key:"findUploadsByFingerprint",value:function(F){var X=this;return new Promise(function(J,Y){X._getItems("tus::".concat(F),function(Q,Z){if(Q)Y(Q);else J(Z)})})}},{key:"removeUpload",value:function(F){var X=this;return new Promise(function(J,Y){X._removeItem(F,function(Q){if(Q)Y(Q);else J()})})}},{key:"addUpload",value:function(F,X){var J=this,Y=Math.round(Math.random()*1000000000000),Q="tus::".concat(F,"::").concat(Y);return new Promise(function(Z,U){J._setItem(Q,X,function(G){if(G)U(G);else Z(Q)})})}},{key:"_setItem",value:function(F,X,J){var Y=this;Wu.lock(this.path,this._lockfileOptions()).then(function(Q){J=Y._releaseAndCb(Q,J),Y._getData(function(Z,U){if(Z){J(Z);return}U[F]=X,Y._writeData(U,function(G){return J(G)})})}).catch(J)}},{key:"_getItems",value:function(F,X){this._getData(function(J,Y){if(J){X(J);return}var Q=Object.keys(Y).filter(function(Z){return Z.startsWith(F)}).map(function(Z){var U=Y[Z];return U.urlStorageKey=Z,U});X(null,Q)})}},{key:"_removeItem",value:function(F,X){var J=this;Wu.lock(this.path,this._lockfileOptions()).then(function(Y){X=J._releaseAndCb(Y,X),J._getData(function(Q,Z){if(Q){X(Q);return}delete Z[F],J._writeData(Z,function(U){return X(U)})})}).catch(X)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(F,X){return function(J){if(J){F().then(function(){return X(J)}).catch(function(Y){return X((0,CB0.default)([J,Y]))});return}F().then(X).catch(X)}}},{key:"_writeData",value:function(F,X){var J={encoding:"utf8",mode:432,flag:"w"};(0,Hu.writeFile)(this.path,JSON.stringify(F),J,function(Y){return X(Y)})}},{key:"_getData",value:function(F){(0,Hu.readFile)(this.path,"utf8",function(X,J){if(X){if(X.code==="ENOENT")F(null,{});else F(X);return}try{J=!J.trim().length?{}:JSON.parse(J)}catch(Y){F(Y);return}F(null,J)})}}])}()});var EY=I((K4)=>{Object.defineProperty(K4,"__esModule",{value:!0});Object.defineProperty(K4,"DefaultHttpStack",{enumerable:!0,get:function(){return Ru.default}});Object.defineProperty(K4,"DetailedError",{enumerable:!0,get:function(){return fB0.default}});Object.defineProperty(K4,"FileUrlStorage",{enumerable:!0,get:function(){return Eu.FileUrlStorage}});Object.defineProperty(K4,"StreamSource",{enumerable:!0,get:function(){return mB0.default}});K4.Upload=void 0;Object.defineProperty(K4,"canStoreURLs",{enumerable:!0,get:function(){return Eu.canStoreURLs}});K4.defaultOptions=void 0;Object.defineProperty(K4,"enableDebugLog",{enumerable:!0,get:function(){return yB0.enableDebugLog}});K4.isSupported=void 0;var fB0=u8(pB()),yB0=rB(),bB0=u8(KS()),rq=u8(iS()),hB0=u8(qx()),gB0=u8(Vx()),Ru=u8(ux()),mB0=u8(Yq()),Eu=Lu();function u8(D){return D&&D.__esModule?D:{default:D}}function N9(D){return N9=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},N9(D)}function cB0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function Mu(D,$){for(var F=0;F<$.length;F++){var X=$[F];if(X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X)X.writable=!0;Object.defineProperty(D,Tu(X.key),X)}}function dB0(D,$,F){if($)Mu(D.prototype,$);if(F)Mu(D,F);return Object.defineProperty(D,"prototype",{writable:!1}),D}function lB0(D,$,F){return $=RY($),nB0(D,ju()?Reflect.construct($,F||[],RY(D).constructor):$.apply(D,F))}function nB0(D,$){if($&&(N9($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return iB0(D)}function iB0(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function ju(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(ju=function(){return!!D})()}function RY(D){return RY=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(F){return F.__proto__||Object.getPrototypeOf(F)},RY(D)}function pB0(D,$){if(typeof $!=="function"&&$!==null)throw TypeError("Super expression must either be null or a function");if(D.prototype=Object.create($&&$.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),Object.defineProperty(D,"prototype",{writable:!1}),$)tq(D,$)}function tq(D,$){return tq=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,J){return X.__proto__=J,X},tq(D,$)}function Au(D,$){var F=Object.keys(D);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(D);$&&(X=X.filter(function(J){return Object.getOwnPropertyDescriptor(D,J).enumerable})),F.push.apply(F,X)}return F}function V9(D){for(var $=1;$<arguments.length;$++){var F=arguments[$]!=null?arguments[$]:{};$%2?Au(Object(F),!0).forEach(function(X){rB0(D,X,F[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(F)):Au(Object(F)).forEach(function(X){Object.defineProperty(D,X,Object.getOwnPropertyDescriptor(F,X))})}return D}function rB0(D,$,F){if($=Tu($),$ in D)Object.defineProperty(D,$,{value:F,enumerable:!0,configurable:!0,writable:!0});else D[$]=F;return D}function Tu(D){var $=tB0(D,"string");return N9($)=="symbol"?$:$+""}function tB0(D,$){if(N9(D)!="object"||!D)return D;var F=D[Symbol.toPrimitive];if(F!==void 0){var X=F.call(D,$||"default");if(N9(X)!="object")return X;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var Iu=K4.defaultOptions=V9(V9({},rq.default.defaultOptions),{},{httpStack:new Ru.default,fileReader:new hB0.default,urlStorage:new bB0.default,fingerprint:gB0.default}),Zt0=K4.Upload=function(D){function $(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return cB0(this,$),X=V9(V9({},Iu),X),lB0(this,$,[F,X])}return pB0($,D),dB0($,null,[{key:"terminate",value:function(X){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return J=V9(V9({},Iu),J),rq.default.terminate(X,J)}}])}(rq.default),Ut0=K4.isSupported=!0});var P$;var q3=r(()=>{P$={name:"@capgo/cli",type:"module",version:"7.94.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts"',"lint:fix":'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs",test:"bun run build && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:ci-prompts && bun run test:onboarding-recovery && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split"},devDependencies:{"@antfu/eslint-config":"^7.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.5","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.0.0","@modelcontextprotocol/sdk":"^1.25.3","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.79.0","@tanstack/intent":"^0.0.23","@types/adm-zip":"^0.5.7","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.0.0","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^18.3.28","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",eslint:"^9.38.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.0",micromatch:"^4.0.8",open:"^11.0.0",partysocket:"^1.1.11",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",ws:"^8.18.3",zod:"^4.3.6"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^5.2.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.3.3",qrcode:"^1.5.4",react:"^18.3.1"}}});async function jY(D){try{let F=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,X=await fetch(F,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!X.ok)return null;return(await X.json())["dist-tags"]?.latest||null}catch{return null}}async function aB0(){let D=await jY("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:P$.version,latestVersion:D,isOutdated:!!D&&D!==P$.version,majorVersion:$}}async function O1(){let{isOutdated:D,currentVersion:$,latestVersion:F,majorVersion:X}=await aB0();if(D)w.warning(`\uD83D\uDEA8 You are using @capgo/cli@${$} it's not the latest version.
121
+ GFS4: `),console.error(D)};if(!E1[$D]){if(_q=global[$D]||[],av(E1,_q),E1.close=function(D){function $(F,X){return D.call(E1,F,function(J){if(!J)ov();if(typeof X==="function")X.apply(this,arguments)})}return Object.defineProperty($,zY,{value:D}),$}(E1.close),E1.closeSync=function(D){function $(F){D.apply(E1,arguments),ov()}return Object.defineProperty($,zY,{value:D}),$}(E1.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){P8(E1[$D]),n("assert").equal(E1[$D].length,0)})}var _q;if(!global[$D])av(global,E1[$D]);yq.exports=kq(tO0(E1));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!E1.__patched)yq.exports=kq(E1),E1.__patched=!0;function kq(D){pO0(D),D.gracefulify=kq,D.createReadStream=V,D.createWriteStream=E;var $=D.readFile;D.readFile=F;function F(R,v,P){if(typeof v==="function")P=v,v=null;return g(R,v,P);function g(m,p,k,j){return $(m,p,function(S){if(S&&(S.code==="EMFILE"||S.code==="ENFILE"))K9([g,[m,p,k],S,j||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var X=D.writeFile;D.writeFile=J;function J(R,v,P,g){if(typeof P==="function")g=P,P=null;return m(R,v,P,g);function m(p,k,j,S,u){return X(p,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))K9([m,[p,k,j,S],f,u||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var Y=D.appendFile;if(Y)D.appendFile=Q;function Q(R,v,P,g){if(typeof P==="function")g=P,P=null;return m(R,v,P,g);function m(p,k,j,S,u){return Y(p,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))K9([m,[p,k,j,S],f,u||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var Z=D.copyFile;if(Z)D.copyFile=U;function U(R,v,P,g){if(typeof P==="function")g=P,P=0;return m(R,v,P,g);function m(p,k,j,S,u){return Z(p,k,j,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))K9([m,[p,k,j,S],f,u||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var G=D.readdir;D.readdir=B;var O=/^v[0-5]\./;function B(R,v,P){if(typeof v==="function")P=v,v=null;var g=O.test(process.version)?function(k,j,S,u){return G(k,m(k,j,S,u))}:function(k,j,S,u){return G(k,j,m(k,j,S,u))};return g(R,v,P);function m(p,k,j,S){return function(u,f){if(u&&(u.code==="EMFILE"||u.code==="ENFILE"))K9([g,[p,k,j],u,S||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof j==="function")j.call(this,u,f)}}}}if(process.version.substr(0,4)==="v0.8"){var q=rO0(D);M=q.ReadStream,z=q.WriteStream}var K=D.ReadStream;if(K)M.prototype=Object.create(K.prototype),M.prototype.open=A;var H=D.WriteStream;if(H)z.prototype=Object.create(H.prototype),z.prototype.open=N;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(R){M=R},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return z},set:function(R){z=R},enumerable:!0,configurable:!0});var W=M;Object.defineProperty(D,"FileReadStream",{get:function(){return W},set:function(R){W=R},enumerable:!0,configurable:!0});var L=z;Object.defineProperty(D,"FileWriteStream",{get:function(){return L},set:function(R){L=R},enumerable:!0,configurable:!0});function M(R,v){if(this instanceof M)return K.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function A(){var R=this;_(R.path,R.flags,R.mode,function(v,P){if(v){if(R.autoClose)R.destroy();R.emit("error",v)}else R.fd=P,R.emit("open",P),R.read()})}function z(R,v){if(this instanceof z)return H.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function N(){var R=this;_(R.path,R.flags,R.mode,function(v,P){if(v)R.destroy(),R.emit("error",v);else R.fd=P,R.emit("open",P)})}function V(R,v){return new D.ReadStream(R,v)}function E(R,v){return new D.WriteStream(R,v)}var x=D.open;D.open=_;function _(R,v,P,g){if(typeof P==="function")g=P,P=null;return m(R,v,P,g);function m(p,k,j,S,u){return x(p,k,j,function(f,h){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))K9([m,[p,k,j,S],f,u||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}return D}function K9(D){P8("ENQUEUE",D[0].name,D[1]),E1[$D].push(D),fq()}var WY;function ov(){var D=Date.now();for(var $=0;$<E1[$D].length;++$)if(E1[$D][$].length>2)E1[$D][$][3]=D,E1[$D][$][4]=D;fq()}function fq(){if(clearTimeout(WY),WY=void 0,E1[$D].length===0)return;var D=E1[$D].shift(),$=D[0],F=D[1],X=D[2],J=D[3],Y=D[4];if(J===void 0)P8("RETRY",$.name,F),$.apply(null,F);else if(Date.now()-J>=60000){P8("TIMEOUT",$.name,F);var Q=F.pop();if(typeof Q==="function")Q.call(null,X)}else{var Z=Date.now()-Y,U=Math.max(Y-J,1),G=Math.min(U*1.2,100);if(Z>=G)P8("RETRY",$.name,F),$.apply(null,F.concat([J]));else E1[$D].push(D)}if(WY===void 0)WY=setTimeout(fq,0)}});var ev=I((sr0,sv)=>{function G$(D,$){if(typeof $==="boolean")$={forever:$};if(this._originalTimeouts=JSON.parse(JSON.stringify(D)),this._timeouts=D,this._options=$||{},this._maxRetryTime=$&&$.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever)this._cachedTimeouts=this._timeouts.slice(0)}sv.exports=G$;G$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};G$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};G$.prototype.retry=function(D){if(this._timeout)clearTimeout(this._timeout);if(!D)return!1;var $=new Date().getTime();if(D&&$-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error("RetryOperation timeout occurred")),!1;this._errors.push(D);var F=this._timeouts.shift();if(F===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),F=this._timeouts.shift();else return!1;var X=this,J=setTimeout(function(){if(X._attempts++,X._operationTimeoutCb){if(X._timeout=setTimeout(function(){X._operationTimeoutCb(X._attempts)},X._operationTimeout),X._options.unref)X._timeout.unref()}X._fn(X._attempts)},F);if(this._options.unref)J.unref();return!0};G$.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var F=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){F._operationTimeoutCb()},F._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};G$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};G$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};G$.prototype.start=G$.prototype.try;G$.prototype.errors=function(){return this._errors};G$.prototype.attempts=function(){return this._attempts};G$.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,F=0;for(var X=0;X<this._errors.length;X++){var J=this._errors[X],Y=J.message,Q=(D[Y]||0)+1;if(D[Y]=Q,Q>=F)$=J,F=Q}return $}});var $u=I((sO0)=>{var aO0=ev();sO0.operation=function(D){var $=sO0.timeouts(D);return new aO0($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};sO0.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var F in D)$[F]=D[F];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var X=[];for(var J=0;J<$.retries;J++)X.push(this.createTimeout(J,$));if(D&&D.forever&&!X.length)X.push(this.createTimeout(J,$));return X.sort(function(Y,Q){return Y-Q}),X};sO0.createTimeout=function(D,$){var F=$.randomize?Math.random()+1:1,X=Math.round(F*$.minTimeout*Math.pow($.factor,D));return X=Math.min(X,$.maxTimeout),X};sO0.wrap=function(D,$,F){if($ instanceof Array)F=$,$=null;if(!F){F=[];for(var X in D)if(typeof D[X]==="function")F.push(X)}for(var J=0;J<F.length;J++){var Y=F[J],Q=D[Y];D[Y]=function(U){var G=sO0.operation($),O=Array.prototype.slice.call(arguments,1),B=O.pop();O.push(function(q){if(G.retry(q))return;if(q)arguments[0]=G.mainError();B.apply(this,arguments)}),G.attempt(function(){U.apply(D,O)})}.bind(D,Q),D[Y].options=$}}});var Fu=I((Dt0,VY)=>{VY.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")VY.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")VY.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var LY=I(($t0,W9)=>{var L1=global.process,S8=function(D){return D&&typeof D==="object"&&typeof D.removeListener==="function"&&typeof D.emit==="function"&&typeof D.reallyExit==="function"&&typeof D.listeners==="function"&&typeof D.kill==="function"&&typeof D.pid==="number"&&typeof D.on==="function"};if(!S8(L1))W9.exports=function(){return function(){}};else{if(bq=n("assert"),x8=Fu(),hq=/^win/i.test(L1.platform),H9=n("events"),typeof H9!=="function")H9=H9.EventEmitter;if(L1.__signal_exit_emitter__)l1=L1.__signal_exit_emitter__;else l1=L1.__signal_exit_emitter__=new H9,l1.count=0,l1.emitted={};if(!l1.infinite)l1.setMaxListeners(1/0),l1.infinite=!0;W9.exports=function(D,$){if(!S8(global.process))return function(){};if(bq.equal(typeof D,"function","a callback must be provided for exit handler"),v8===!1)NY();var F="exit";if($&&$.alwaysLast)F="afterexit";var X=function(){if(l1.removeListener(F,D),l1.listeners("exit").length===0&&l1.listeners("afterexit").length===0)Q3()};return l1.on(F,D),X},Q3=function(){if(!v8||!S8(global.process))return;v8=!1,x8.forEach(function($){try{L1.removeListener($,Z3[$])}catch(F){}}),L1.emit=U3,L1.reallyExit=wY,l1.count-=1},W9.exports.unload=Q3,B4=function($,F,X){if(l1.emitted[$])return;l1.emitted[$]=!0,l1.emit($,F,X)},Z3={},x8.forEach(function(D){Z3[D]=function(){if(!S8(global.process))return;var F=L1.listeners(D);if(F.length===l1.count){if(Q3(),B4("exit",null,D),B4("afterexit",null,D),hq&&D==="SIGHUP")D="SIGINT";L1.kill(L1.pid,D)}}}),W9.exports.signals=function(){return x8},v8=!1,NY=function(){if(v8||!S8(global.process))return;v8=!0,l1.count+=1,x8=x8.filter(function($){try{return L1.on($,Z3[$]),!0}catch(F){return!1}}),L1.emit=mq,L1.reallyExit=gq},W9.exports.load=NY,wY=L1.reallyExit,gq=function($){if(!S8(global.process))return;L1.exitCode=$||0,B4("exit",L1.exitCode,null),B4("afterexit",L1.exitCode,null),wY.call(L1,L1.exitCode)},U3=L1.emit,mq=function($,F){if($==="exit"&&S8(global.process)){if(F!==void 0)L1.exitCode=F;var X=U3.apply(this,arguments);return B4("exit",L1.exitCode,null),B4("afterexit",L1.exitCode,null),X}else return U3.apply(this,arguments)}}var bq,x8,hq,H9,l1,Q3,B4,Z3,v8,NY,wY,gq,U3,mq});var Ju=I((JB0,cq)=>{var Xu=Symbol();function FB0(D,$,F){let X=$[Xu];if(X)return $.stat(D,(Y,Q)=>{if(Y)return F(Y);F(null,Q.mtime,X)});let J=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,J,J,(Y)=>{if(Y)return F(Y);$.stat(D,(Q,Z)=>{if(Q)return F(Q);let U=Z.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,Xu,{value:U}),F(null,Z.mtime,U)})})}function XB0(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}JB0.probe=FB0;JB0.getMtime=XB0});var Gu=I((KB0,O3)=>{var ZB0=n("path"),nq=u1(),UB0=$u(),GB0=LY(),Yu=Ju(),C6={};function G3(D,$){return $.lockfilePath||`${D}.lock`}function iq(D,$,F){if(!$.realpath)return F(null,ZB0.resolve(D));$.fs.realpath(D,F)}function lq(D,$,F){let X=G3(D,$);$.fs.mkdir(X,(J)=>{if(!J)return Yu.probe(X,$.fs,(Y,Q,Z)=>{if(Y)return $.fs.rmdir(X,()=>{}),F(Y);F(null,Q,Z)});if(J.code!=="EEXIST")return F(J);if($.stale<=0)return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(X,(Y,Q)=>{if(Y){if(Y.code==="ENOENT")return lq(D,{...$,stale:0},F);return F(Y)}if(!Qu(Q,$))return F(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));Zu(D,$,(Z)=>{if(Z)return F(Z);lq(D,{...$,stale:0},F)})})})}function Qu(D,$){return D.mtime.getTime()<Date.now()-$.stale}function Zu(D,$,F){$.fs.rmdir(G3(D,$),(X)=>{if(X&&X.code!=="ENOENT")return F(X);F()})}function MY(D,$){let F=C6[D];if(F.updateTimeout)return;if(F.updateDelay=F.updateDelay||$.update,F.updateTimeout=setTimeout(()=>{F.updateTimeout=null,$.fs.stat(F.lockfilePath,(X,J)=>{let Y=F.lastUpdate+$.stale<Date.now();if(X){if(X.code==="ENOENT"||Y)return dq(D,F,Object.assign(X,{code:"ECOMPROMISED"}));return F.updateDelay=1000,MY(D,$)}if(F.mtime.getTime()!==J.mtime.getTime())return dq(D,F,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let Z=Yu.getMtime(F.mtimePrecision);$.fs.utimes(F.lockfilePath,Z,Z,(U)=>{let G=F.lastUpdate+$.stale<Date.now();if(F.released)return;if(U){if(U.code==="ENOENT"||G)return dq(D,F,Object.assign(U,{code:"ECOMPROMISED"}));return F.updateDelay=1000,MY(D,$)}F.mtime=Z,F.lastUpdate=Date.now(),F.updateDelay=null,MY(D,$)})})},F.updateDelay),F.updateTimeout.unref)F.updateTimeout.unref()}function dq(D,$,F){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(C6[D]===$)delete C6[D];$.options.onCompromised(F)}function OB0(D,$,F){$={stale:1e4,update:null,realpath:!0,retries:0,fs:nq,onCompromised:(X)=>{throw X},...$},$.retries=$.retries||0,$.retries=typeof $.retries==="number"?{retries:$.retries}:$.retries,$.stale=Math.max($.stale||0,2000),$.update=$.update==null?$.stale/2:$.update||0,$.update=Math.max(Math.min($.update,$.stale/2),1000),iq(D,$,(X,J)=>{if(X)return F(X);let Y=UB0.operation($.retries);Y.attempt(()=>{lq(J,$,(Q,Z,U)=>{if(Y.retry(Q))return;if(Q)return F(Y.mainError());let G=C6[J]={lockfilePath:G3(J,$),mtime:Z,mtimePrecision:U,options:$,lastUpdate:Date.now()};MY(J,$),F(null,(O)=>{if(G.released)return O&&O(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));Uu(J,{...$,realpath:!1},O)})})})})}function Uu(D,$,F){$={fs:nq,realpath:!0,...$},iq(D,$,(X,J)=>{if(X)return F(X);let Y=C6[J];if(!Y)return F(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));Y.updateTimeout&&clearTimeout(Y.updateTimeout),Y.released=!0,delete C6[J],Zu(J,$,F)})}function BB0(D,$,F){$={stale:1e4,realpath:!0,fs:nq,...$},$.stale=Math.max($.stale||0,2000),iq(D,$,(X,J)=>{if(X)return F(X);$.fs.stat(G3(J,$),(Y,Q)=>{if(Y)return Y.code==="ENOENT"?F(null,!1):F(Y);return F(null,!Qu(Q,$))})})}function qB0(){return C6}GB0(()=>{for(let D in C6){let $=C6[D].options;try{$.fs.rmdirSync(G3(D,$))}catch(F){}}});KB0.lock=OB0;KB0.unlock=Uu;KB0.check=BB0;KB0.getLocks=qB0});var Bu=I((Ft0,Ou)=>{var NB0=u1();function wB0(D){let $=["mkdir","realpath","stat","rmdir","utimes"],F={...D};return $.forEach((X)=>{F[X]=(...J)=>{let Y=J.pop(),Q;try{Q=D[`${X}Sync`](...J)}catch(Z){return Y(Z)}Y(null,Q)}}),F}function LB0(D){return(...$)=>new Promise((F,X)=>{$.push((J,Y)=>{if(J)X(J);else F(Y)}),D(...$)})}function MB0(D){return(...$)=>{let F,X;if($.push((J,Y)=>{F=J,X=Y}),D(...$),F)throw F;return X}}function AB0(D){if(D={...D},D.fs=wB0(D.fs||NB0),typeof D.retries==="number"&&D.retries>0||D.retries&&typeof D.retries.retries==="number"&&D.retries.retries>0)throw Object.assign(Error("Cannot use retries with the sync api"),{code:"ESYNC"});return D}Ou.exports={toPromise:LB0,toSync:MB0,toSyncOptions:AB0}});var Ku=I((Xt0,q4)=>{var z9=Gu(),{toPromise:AY,toSync:IY,toSyncOptions:pq}=Bu();async function qu(D,$){let F=await AY(z9.lock)(D,$);return AY(F)}function IB0(D,$){let F=IY(z9.lock)(D,pq($));return IY(F)}function RB0(D,$){return AY(z9.unlock)(D,$)}function EB0(D,$){return IY(z9.unlock)(D,pq($))}function jB0(D,$){return AY(z9.check)(D,$)}function TB0(D,$){return IY(z9.check)(D,pq($))}q4.exports=qu;q4.exports.lock=qu;q4.exports.unlock=RB0;q4.exports.lockSync=IB0;q4.exports.unlockSync=EB0;q4.exports.check=jB0;q4.exports.checkSync=TB0});var Lu=I((Nu)=>{Object.defineProperty(Nu,"__esModule",{value:!0});Nu.canStoreURLs=Nu.FileUrlStorage=void 0;var Hu=n("fs"),CB0=SB0(cv()),Wu=PB0(Ku());function Vu(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,F=new WeakMap;return(Vu=function(X){return X?F:$})(D)}function PB0(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var F=Vu($);if(F&&F.has(D))return F.get(D);var X={__proto__:null},J=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var Y in D)if(Y!=="default"&&{}.hasOwnProperty.call(D,Y)){var Q=J?Object.getOwnPropertyDescriptor(D,Y):null;Q&&(Q.get||Q.set)?Object.defineProperty(X,Y,Q):X[Y]=D[Y]}return X.default=D,F&&F.set(D,X),X}function SB0(D){return D&&D.__esModule?D:{default:D}}function B3(D){return B3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},B3(D)}function xB0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function zu(D,$){for(var F=0;F<$.length;F++){var X=$[F];if(X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X)X.writable=!0;Object.defineProperty(D,uB0(X.key),X)}}function vB0(D,$,F){if($)zu(D.prototype,$);if(F)zu(D,F);return Object.defineProperty(D,"prototype",{writable:!1}),D}function uB0(D){var $=_B0(D,"string");return B3($)=="symbol"?$:$+""}function _B0(D,$){if(B3(D)!="object"||!D)return D;var F=D[Symbol.toPrimitive];if(F!==void 0){var X=F.call(D,$||"default");if(B3(X)!="object")return X;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var Jt0=Nu.canStoreURLs=!0,Yt0=Nu.FileUrlStorage=function(){function D($){xB0(this,D),this.path=$}return vB0(D,[{key:"findAllUploads",value:function(){var F=this;return new Promise(function(X,J){F._getItems("tus::",function(Y,Q){if(Y)J(Y);else X(Q)})})}},{key:"findUploadsByFingerprint",value:function(F){var X=this;return new Promise(function(J,Y){X._getItems("tus::".concat(F),function(Q,Z){if(Q)Y(Q);else J(Z)})})}},{key:"removeUpload",value:function(F){var X=this;return new Promise(function(J,Y){X._removeItem(F,function(Q){if(Q)Y(Q);else J()})})}},{key:"addUpload",value:function(F,X){var J=this,Y=Math.round(Math.random()*1000000000000),Q="tus::".concat(F,"::").concat(Y);return new Promise(function(Z,U){J._setItem(Q,X,function(G){if(G)U(G);else Z(Q)})})}},{key:"_setItem",value:function(F,X,J){var Y=this;Wu.lock(this.path,this._lockfileOptions()).then(function(Q){J=Y._releaseAndCb(Q,J),Y._getData(function(Z,U){if(Z){J(Z);return}U[F]=X,Y._writeData(U,function(G){return J(G)})})}).catch(J)}},{key:"_getItems",value:function(F,X){this._getData(function(J,Y){if(J){X(J);return}var Q=Object.keys(Y).filter(function(Z){return Z.startsWith(F)}).map(function(Z){var U=Y[Z];return U.urlStorageKey=Z,U});X(null,Q)})}},{key:"_removeItem",value:function(F,X){var J=this;Wu.lock(this.path,this._lockfileOptions()).then(function(Y){X=J._releaseAndCb(Y,X),J._getData(function(Q,Z){if(Q){X(Q);return}delete Z[F],J._writeData(Z,function(U){return X(U)})})}).catch(X)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(F,X){return function(J){if(J){F().then(function(){return X(J)}).catch(function(Y){return X((0,CB0.default)([J,Y]))});return}F().then(X).catch(X)}}},{key:"_writeData",value:function(F,X){var J={encoding:"utf8",mode:432,flag:"w"};(0,Hu.writeFile)(this.path,JSON.stringify(F),J,function(Y){return X(Y)})}},{key:"_getData",value:function(F){(0,Hu.readFile)(this.path,"utf8",function(X,J){if(X){if(X.code==="ENOENT")F(null,{});else F(X);return}try{J=!J.trim().length?{}:JSON.parse(J)}catch(Y){F(Y);return}F(null,J)})}}])}()});var EY=I((K4)=>{Object.defineProperty(K4,"__esModule",{value:!0});Object.defineProperty(K4,"DefaultHttpStack",{enumerable:!0,get:function(){return Ru.default}});Object.defineProperty(K4,"DetailedError",{enumerable:!0,get:function(){return fB0.default}});Object.defineProperty(K4,"FileUrlStorage",{enumerable:!0,get:function(){return Eu.FileUrlStorage}});Object.defineProperty(K4,"StreamSource",{enumerable:!0,get:function(){return mB0.default}});K4.Upload=void 0;Object.defineProperty(K4,"canStoreURLs",{enumerable:!0,get:function(){return Eu.canStoreURLs}});K4.defaultOptions=void 0;Object.defineProperty(K4,"enableDebugLog",{enumerable:!0,get:function(){return yB0.enableDebugLog}});K4.isSupported=void 0;var fB0=u8(pB()),yB0=rB(),bB0=u8(KS()),rq=u8(iS()),hB0=u8(qx()),gB0=u8(Vx()),Ru=u8(ux()),mB0=u8(Yq()),Eu=Lu();function u8(D){return D&&D.__esModule?D:{default:D}}function N9(D){return N9=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},N9(D)}function cB0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function Mu(D,$){for(var F=0;F<$.length;F++){var X=$[F];if(X.enumerable=X.enumerable||!1,X.configurable=!0,"value"in X)X.writable=!0;Object.defineProperty(D,Tu(X.key),X)}}function dB0(D,$,F){if($)Mu(D.prototype,$);if(F)Mu(D,F);return Object.defineProperty(D,"prototype",{writable:!1}),D}function lB0(D,$,F){return $=RY($),nB0(D,ju()?Reflect.construct($,F||[],RY(D).constructor):$.apply(D,F))}function nB0(D,$){if($&&(N9($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return iB0(D)}function iB0(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function ju(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(ju=function(){return!!D})()}function RY(D){return RY=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(F){return F.__proto__||Object.getPrototypeOf(F)},RY(D)}function pB0(D,$){if(typeof $!=="function"&&$!==null)throw TypeError("Super expression must either be null or a function");if(D.prototype=Object.create($&&$.prototype,{constructor:{value:D,writable:!0,configurable:!0}}),Object.defineProperty(D,"prototype",{writable:!1}),$)tq(D,$)}function tq(D,$){return tq=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,J){return X.__proto__=J,X},tq(D,$)}function Au(D,$){var F=Object.keys(D);if(Object.getOwnPropertySymbols){var X=Object.getOwnPropertySymbols(D);$&&(X=X.filter(function(J){return Object.getOwnPropertyDescriptor(D,J).enumerable})),F.push.apply(F,X)}return F}function V9(D){for(var $=1;$<arguments.length;$++){var F=arguments[$]!=null?arguments[$]:{};$%2?Au(Object(F),!0).forEach(function(X){rB0(D,X,F[X])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(F)):Au(Object(F)).forEach(function(X){Object.defineProperty(D,X,Object.getOwnPropertyDescriptor(F,X))})}return D}function rB0(D,$,F){if($=Tu($),$ in D)Object.defineProperty(D,$,{value:F,enumerable:!0,configurable:!0,writable:!0});else D[$]=F;return D}function Tu(D){var $=tB0(D,"string");return N9($)=="symbol"?$:$+""}function tB0(D,$){if(N9(D)!="object"||!D)return D;var F=D[Symbol.toPrimitive];if(F!==void 0){var X=F.call(D,$||"default");if(N9(X)!="object")return X;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var Iu=K4.defaultOptions=V9(V9({},rq.default.defaultOptions),{},{httpStack:new Ru.default,fileReader:new hB0.default,urlStorage:new bB0.default,fingerprint:gB0.default}),Zt0=K4.Upload=function(D){function $(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,X=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return cB0(this,$),X=V9(V9({},Iu),X),lB0(this,$,[F,X])}return pB0($,D),dB0($,null,[{key:"terminate",value:function(X){var J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return J=V9(V9({},Iu),J),rq.default.terminate(X,J)}}])}(rq.default),Ut0=K4.isSupported=!0});var P$;var q3=r(()=>{P$={name:"@capgo/cli",type:"module",version:"7.94.2",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/capgo/tree/main/cli#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/capgo.git",directory:"cli"},bugs:{url:"https://github.com/Cap-go/capgo/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli","sdk","tanstack-intent"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",bin:{capgo:"dist/index.js"},files:["!skills/_artifacts","dist","skills"],engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && bun build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"bunx --bun supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts"',"lint:fix":'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-run-targets":"bun test/test-onboarding-run-targets.mjs","test:run-device-command":"bun test/test-run-device-command.mjs","test:init-app-conflict":"bun test/test-init-app-conflict.mjs","test:init-guardrails":"bun test/test-init-guardrails.mjs","test:prompt-preferences":"bun test/test-prompt-preferences.mjs","test:esm-sdk":"node test/test-sdk-esm.mjs","test:mcp":"node test/test-mcp.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh","test:platform-paths":"bun test/test-platform-paths.mjs","test:payload-split":"bun test/test-payload-split.mjs",test:"bun run build && bun run test:version-detection:setup && bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:ci-prompts && bun run test:onboarding-recovery && bun run test:onboarding-run-targets && bun run test:run-device-command && bun run test:init-app-conflict && bun run test:init-guardrails && bun run test:prompt-preferences && bun run test:esm-sdk && bun run test:mcp && bun run test:version-detection && bun run test:platform-paths && bun run test:payload-split"},devDependencies:{"@antfu/eslint-config":"^7.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.5","@capacitor/cli":"^8.0.0","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.0.0","@modelcontextprotocol/sdk":"^1.25.3","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.79.0","@tanstack/intent":"^0.0.23","@types/adm-zip":"^0.5.7","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.0.0","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^18.3.28","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",eslint:"^9.38.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.0",micromatch:"^4.0.8",open:"^11.0.0",partysocket:"^1.1.11",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3",ws:"^8.18.3",zod:"^4.3.6"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^5.2.1","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.3.3",qrcode:"^1.5.4",react:"^18.3.1"}}});async function jY(D){try{let F=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,X=await fetch(F,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!X.ok)return null;return(await X.json())["dist-tags"]?.latest||null}catch{return null}}async function aB0(){let D=await jY("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:P$.version,latestVersion:D,isOutdated:!!D&&D!==P$.version,majorVersion:$}}async function O1(){let{isOutdated:D,currentVersion:$,latestVersion:F,majorVersion:X}=await aB0();if(D)w.warning(`\uD83D\uDEA8 You are using @capgo/cli@${$} it's not the latest version.
122
122
  Please use @capgo/cli@${F}" or @capgo/cli@${X} to keep up to date with the latest features and bug fixes.`)}var wD=r(()=>{_0();q3()});async function xu(D,$,F,X,J,Y="✅"){await E0(F,{channel:D,event:X,icon:Y,user_id:$,...J?{tags:{"app-id":J}}:{},notify:!1})}var vu=r(()=>{_0();L6();wD();k0()});import{Buffer as uu}from"node:buffer";import{createHash as sB0}from"node:crypto";function Dq0(D){let $=4294967295;for(let F=0;F<D.length;F++){let X=D[F];$=eB0[($^X)&255]^$>>>8}return $=$^4294967295,($>>>0).toString(16).padStart(8,"0")}async function H4(D,$="sha256"){let F=uu.isBuffer(D)?D:uu.from(D);if($==="crc32")return Dq0(F);let X=sB0($);return X.update(F),X.digest("hex")}var eB0;var K3=r(()=>{eB0=(()=>{let D=[];for(let $=0;$<256;$++){let F=$;for(let X=0;X<8;X++)F=F&1?3988292384^F>>>1:F>>>1;D[$]=F}return D})()});var ku=I((Rt0,_u)=>{var w9=1000,L9=w9*60,M9=L9*60,_8=M9*24,$q0=_8*7,Fq0=_8*365.25;_u.exports=function(D,$){$=$||{};var F=typeof D;if(F==="string"&&D.length>0)return Xq0(D);else if(F==="number"&&isFinite(D))return $.long?Yq0(D):Jq0(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function Xq0(D){if(D=String(D),D.length>100)return;var $=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(D);if(!$)return;var F=parseFloat($[1]),X=($[2]||"ms").toLowerCase();switch(X){case"years":case"year":case"yrs":case"yr":case"y":return F*Fq0;case"weeks":case"week":case"w":return F*$q0;case"days":case"day":case"d":return F*_8;case"hours":case"hour":case"hrs":case"hr":case"h":return F*M9;case"minutes":case"minute":case"mins":case"min":case"m":return F*L9;case"seconds":case"second":case"secs":case"sec":case"s":return F*w9;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return F;default:return}}function Jq0(D){var $=Math.abs(D);if($>=_8)return Math.round(D/_8)+"d";if($>=M9)return Math.round(D/M9)+"h";if($>=L9)return Math.round(D/L9)+"m";if($>=w9)return Math.round(D/w9)+"s";return D+"ms"}function Yq0(D){var $=Math.abs(D);if($>=_8)return TY(D,$,_8,"day");if($>=M9)return TY(D,$,M9,"hour");if($>=L9)return TY(D,$,L9,"minute");if($>=w9)return TY(D,$,w9,"second");return D+" ms"}function TY(D,$,F,X){var J=$>=F*1.5;return Math.round(D/F)+" "+X+(J?"s":"")}});var oq=I((Et0,fu)=>{function Qq0(D){F.debug=F,F.default=F,F.coerce=U,F.disable=Q,F.enable=J,F.enabled=Z,F.humanize=ku(),F.destroy=G,Object.keys(D).forEach((O)=>{F[O]=D[O]}),F.names=[],F.skips=[],F.formatters={};function $(O){let B=0;for(let q=0;q<O.length;q++)B=(B<<5)-B+O.charCodeAt(q),B|=0;return F.colors[Math.abs(B)%F.colors.length]}F.selectColor=$;function F(O){let B,q=null,K,H;function W(...L){if(!W.enabled)return;let M=W,A=Number(new Date),z=A-(B||A);if(M.diff=z,M.prev=B,M.curr=A,B=A,L[0]=F.coerce(L[0]),typeof L[0]!=="string")L.unshift("%O");let N=0;L[0]=L[0].replace(/%([a-zA-Z%])/g,(E,x)=>{if(E==="%%")return"%";N++;let _=F.formatters[x];if(typeof _==="function"){let R=L[N];E=_.call(M,R),L.splice(N,1),N--}return E}),F.formatArgs.call(M,L),(M.log||F.log).apply(M,L)}if(W.namespace=O,W.useColors=F.useColors(),W.color=F.selectColor(O),W.extend=X,W.destroy=F.destroy,Object.defineProperty(W,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(q!==null)return q;if(K!==F.namespaces)K=F.namespaces,H=F.enabled(O);return H},set:(L)=>{q=L}}),typeof F.init==="function")F.init(W);return W}function X(O,B){let q=F(this.namespace+(typeof B>"u"?":":B)+O);return q.log=this.log,q}function J(O){F.save(O),F.namespaces=O,F.names=[],F.skips=[];let B=(typeof O==="string"?O:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let q of B)if(q[0]==="-")F.skips.push(q.slice(1));else F.names.push(q)}function Y(O,B){let q=0,K=0,H=-1,W=0;while(q<O.length)if(K<B.length&&(B[K]===O[q]||B[K]==="*"))if(B[K]==="*")H=K,W=q,K++;else q++,K++;else if(H!==-1)K=H+1,W++,q=W;else return!1;while(K<B.length&&B[K]==="*")K++;return K===B.length}function Q(){let O=[...F.names,...F.skips.map((B)=>"-"+B)].join(",");return F.enable(""),O}function Z(O){for(let B of F.skips)if(Y(O,B))return!1;for(let B of F.names)if(Y(O,B))return!0;return!1}function U(O){if(O instanceof Error)return O.stack||O.message;return O}function G(){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 F.enable(F.load()),F}fu.exports=Qq0});var bu=I((yu,CY)=>{yu.formatArgs=Uq0;yu.save=Gq0;yu.load=Oq0;yu.useColors=Zq0;yu.storage=Bq0();yu.destroy=(()=>{let D=!1;return()=>{if(!D)D=!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`.")}})();yu.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 Zq0(){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;let D;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&&(D=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(D[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function Uq0(D){if(D[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+D[0]+(this.useColors?"%c ":" ")+"+"+CY.exports.humanize(this.diff),!this.useColors)return;let $="color: "+this.color;D.splice(1,0,$,"color: inherit");let F=0,X=0;D[0].replace(/%[a-zA-Z%]/g,(J)=>{if(J==="%%")return;if(F++,J==="%c")X=F}),D.splice(X,0,$)}yu.log=console.debug||console.log||(()=>{});function Gq0(D){try{if(D)yu.storage.setItem("debug",D);else yu.storage.removeItem("debug")}catch($){}}function Oq0(){let D;try{D=yu.storage.getItem("debug")||yu.storage.getItem("DEBUG")}catch($){}if(!D&&typeof process<"u"&&"env"in process)D=process.env.DEBUG;return D}function Bq0(){try{return localStorage}catch(D){}}CY.exports=oq()(yu);var{formatters:qq0}=CY.exports;qq0.j=function(D){try{return JSON.stringify(D)}catch($){return"[UnexpectedJSONParseError]: "+$.message}}});var gu=I((Tt0,hu)=>{hu.exports=(D,$=process.argv)=>{let F=D.startsWith("-")?"":D.length===1?"-":"--",X=$.indexOf(F+D),J=$.indexOf("--");return X!==-1&&(J===-1||X<J)}});var du=I((Ct0,cu)=>{var Lq0=n("os"),mu=n("tty"),O$=gu(),{env:t1}=process,W4;if(O$("no-color")||O$("no-colors")||O$("color=false")||O$("color=never"))W4=0;else if(O$("color")||O$("colors")||O$("color=true")||O$("color=always"))W4=1;if("FORCE_COLOR"in t1)if(t1.FORCE_COLOR==="true")W4=1;else if(t1.FORCE_COLOR==="false")W4=0;else W4=t1.FORCE_COLOR.length===0?1:Math.min(parseInt(t1.FORCE_COLOR,10),3);function aq(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function sq(D,$){if(W4===0)return 0;if(O$("color=16m")||O$("color=full")||O$("color=truecolor"))return 3;if(O$("color=256"))return 2;if(D&&!$&&W4===void 0)return 0;let F=W4||0;if(t1.TERM==="dumb")return F;if(process.platform==="win32"){let X=Lq0.release().split(".");if(Number(X[0])>=10&&Number(X[2])>=10586)return Number(X[2])>=14931?3:2;return 1}if("CI"in t1){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((X)=>(X in t1))||t1.CI_NAME==="codeship")return 1;return F}if("TEAMCITY_VERSION"in t1)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(t1.TEAMCITY_VERSION)?1:0;if(t1.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in t1){let X=parseInt((t1.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(t1.TERM_PROGRAM){case"iTerm.app":return X>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(t1.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(t1.TERM))return 1;if("COLORTERM"in t1)return 1;return F}function Mq0(D){let $=sq(D,D&&D.isTTY);return aq($)}cu.exports={supportsColor:Mq0,stdout:aq(sq(!0,mu.isatty(1))),stderr:aq(sq(!0,mu.isatty(2)))}});var pu=I((nu,SY)=>{var Aq0=n("tty"),PY=n("util");nu.init=Pq0;nu.log=jq0;nu.formatArgs=Rq0;nu.save=Tq0;nu.load=Cq0;nu.useColors=Iq0;nu.destroy=PY.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");nu.colors=[6,2,3,4,5,1];try{let D=du();if(D&&(D.stderr||D).level>=2)nu.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(D){}nu.inspectOpts=Object.keys(process.env).filter((D)=>{return/^debug_/i.test(D)}).reduce((D,$)=>{let F=$.substring(6).toLowerCase().replace(/_([a-z])/g,(J,Y)=>{return Y.toUpperCase()}),X=process.env[$];if(/^(yes|on|true|enabled)$/i.test(X))X=!0;else if(/^(no|off|false|disabled)$/i.test(X))X=!1;else if(X==="null")X=null;else X=Number(X);return D[F]=X,D},{});function Iq0(){return"colors"in nu.inspectOpts?Boolean(nu.inspectOpts.colors):Aq0.isatty(process.stderr.fd)}function Rq0(D){let{namespace:$,useColors:F}=this;if(F){let X=this.color,J="\x1B[3"+(X<8?X:"8;5;"+X),Y=` ${J};1m${$} \x1B[0m`;D[0]=Y+D[0].split(`
123
123
  `).join(`
124
124
  `+Y),D.push(J+"m+"+SY.exports.humanize(this.diff)+"\x1B[0m")}else D[0]=Eq0()+$+" "+D[0]}function Eq0(){if(nu.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function jq0(...D){return process.stderr.write(PY.formatWithOptions(nu.inspectOpts,...D)+`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capgo/cli",
3
3
  "type": "module",
4
- "version": "7.94.1",
4
+ "version": "7.94.2",
5
5
  "description": "A CLI to upload to capgo servers",
6
6
  "author": "Martin martin@capgo.app",
7
7
  "license": "Apache 2.0",