@capgo/cli 8.3.0 → 8.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +608 -608
- package/dist/package.json +26 -2
- package/dist/src/build/mobileprovision-parser.d.ts +9 -0
- package/dist/src/build/onboarding/android/flow.d.ts +505 -0
- package/dist/src/build/onboarding/android/keystore.d.ts +18 -0
- package/dist/src/build/onboarding/android/oauth-google.d.ts +31 -0
- package/dist/src/build/onboarding/android/oauth-scopes.d.ts +4 -0
- package/dist/src/build/onboarding/android/types.d.ts +42 -1
- package/dist/src/build/onboarding/apple-api.d.ts +5 -1
- package/dist/src/build/onboarding/env-export.d.ts +12 -1
- package/dist/src/build/onboarding/flow/android-flow.d.ts +3 -0
- package/dist/src/build/onboarding/flow/contract.d.ts +24 -0
- package/dist/src/build/onboarding/flow/ios-flow.d.ts +3 -0
- package/dist/src/build/onboarding/ios/flow.d.ts +650 -0
- package/dist/src/build/onboarding/ios/progress.d.ts +2 -0
- package/dist/src/build/onboarding/mcp/app-id-validation.d.ts +8 -0
- package/dist/src/build/onboarding/mcp/contract.d.ts +51 -0
- package/dist/src/build/onboarding/mcp/engine.d.ts +131 -0
- package/dist/src/build/onboarding/mcp/explanations.d.ts +4 -0
- package/dist/src/build/onboarding/mcp/oauth-session.d.ts +29 -0
- package/dist/src/build/onboarding/mcp/onboarding-tools.d.ts +17 -0
- package/dist/src/build/onboarding/mcp/step-input.d.ts +45 -0
- package/dist/src/build/onboarding/mcp/terminal-launch.d.ts +22 -0
- package/dist/src/build/onboarding/tail/flow.d.ts +283 -0
- package/dist/src/build/onboarding/tail-types.d.ts +29 -0
- package/dist/src/build/onboarding/types.d.ts +82 -1
- package/dist/src/build/onboarding/ui/p8-error.d.ts +13 -0
- package/dist/src/build/output-record.d.ts +17 -0
- package/dist/src/schemas/onboarding.d.ts +41 -0
- package/dist/src/sdk.js +9 -9
- package/package.json +26 -2
package/dist/src/sdk.js
CHANGED
|
@@ -124,7 +124,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
124
124
|
`)}),$.__defineSetter__("stack",function(X){return[X].concat($.stack).join(`
|
|
125
125
|
|
|
126
126
|
`)}),$}});var sx=E((ke0,ax)=>{var j4=l("constants"),TK0=process.cwd,yF=null,CK0=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){if(!yF)yF=TK0.call(process);return yF};try{process.cwd()}catch(D){}if(typeof process.chdir==="function"){if(bF=process.chdir,process.chdir=function(D){yF=null,bF.call(process,D)},Object.setPrototypeOf)Object.setPrototypeOf(process.chdir,bF)}var bF;ax.exports=PK0;function PK0(D){if(j4.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./))$(D);if(!D.lutimes)X(D);if(D.chown=F(D.chown),D.fchown=F(D.fchown),D.lchown=F(D.lchown),D.chmod=J(D.chmod),D.fchmod=J(D.fchmod),D.lchmod=J(D.lchmod),D.chownSync=Q(D.chownSync),D.fchownSync=Q(D.fchownSync),D.lchownSync=Q(D.lchownSync),D.chmodSync=Y(D.chmodSync),D.fchmodSync=Y(D.fchmodSync),D.lchmodSync=Y(D.lchmodSync),D.stat=U(D.stat),D.fstat=U(D.fstat),D.lstat=U(D.lstat),D.statSync=Z(D.statSync),D.fstatSync=Z(D.fstatSync),D.lstatSync=Z(D.lstatSync),D.chmod&&!D.lchmod)D.lchmod=function(O,q,w){if(w)process.nextTick(w)},D.lchmodSync=function(){};if(D.chown&&!D.lchown)D.lchown=function(O,q,w,K){if(K)process.nextTick(K)},D.lchownSync=function(){};if(CK0==="win32")D.rename=typeof D.rename!=="function"?D.rename:function(O){function q(w,K,W){var H=Date.now(),B=0;O(w,K,function M(I){if(I&&(I.code==="EACCES"||I.code==="EPERM"||I.code==="EBUSY")&&Date.now()-H<60000){if(setTimeout(function(){D.stat(K,function(z,N){if(z&&z.code==="ENOENT")O(w,K,M);else W(I)})},B),B<100)B+=10;return}if(W)W(I)})}if(Object.setPrototypeOf)Object.setPrototypeOf(q,O);return q}(D.rename);D.read=typeof D.read!=="function"?D.read:function(O){function q(w,K,W,H,B,M){var I;if(M&&typeof M==="function"){var z=0;I=function(N,V,A){if(N&&N.code==="EAGAIN"&&z<10)return z++,O.call(D,w,K,W,H,B,I);M.apply(this,arguments)}}return O.call(D,w,K,W,H,B,I)}if(Object.setPrototypeOf)Object.setPrototypeOf(q,O);return q}(D.read),D.readSync=typeof D.readSync!=="function"?D.readSync:function(O){return function(q,w,K,W,H){var B=0;while(!0)try{return O.call(D,q,w,K,W,H)}catch(M){if(M.code==="EAGAIN"&&B<10){B++;continue}throw M}}}(D.readSync);function $(O){O.lchmod=function(q,w,K){O.open(q,j4.O_WRONLY|j4.O_SYMLINK,w,function(W,H){if(W){if(K)K(W);return}O.fchmod(H,w,function(B){O.close(H,function(M){if(K)K(B||M)})})})},O.lchmodSync=function(q,w){var K=O.openSync(q,j4.O_WRONLY|j4.O_SYMLINK,w),W=!0,H;try{H=O.fchmodSync(K,w),W=!1}finally{if(W)try{O.closeSync(K)}catch(B){}else O.closeSync(K)}return H}}function X(O){if(j4.hasOwnProperty("O_SYMLINK")&&O.futimes)O.lutimes=function(q,w,K,W){O.open(q,j4.O_SYMLINK,function(H,B){if(H){if(W)W(H);return}O.futimes(B,w,K,function(M){O.close(B,function(I){if(W)W(M||I)})})})},O.lutimesSync=function(q,w,K){var W=O.openSync(q,j4.O_SYMLINK),H,B=!0;try{H=O.futimesSync(W,w,K),B=!1}finally{if(B)try{O.closeSync(W)}catch(M){}else O.closeSync(W)}return H};else if(O.futimes)O.lutimes=function(q,w,K,W){if(W)process.nextTick(W)},O.lutimesSync=function(){}}function J(O){if(!O)return O;return function(q,w,K){return O.call(D,q,w,function(W){if(G(W))W=null;if(K)K.apply(this,arguments)})}}function Y(O){if(!O)return O;return function(q,w){try{return O.call(D,q,w)}catch(K){if(!G(K))throw K}}}function F(O){if(!O)return O;return function(q,w,K,W){return O.call(D,q,w,K,function(H){if(G(H))H=null;if(W)W.apply(this,arguments)})}}function Q(O){if(!O)return O;return function(q,w,K){try{return O.call(D,q,w,K)}catch(W){if(!G(W))throw W}}}function U(O){if(!O)return O;return function(q,w,K){if(typeof w==="function")K=w,w=null;function W(H,B){if(B){if(B.uid<0)B.uid+=4294967296;if(B.gid<0)B.gid+=4294967296}if(K)K.apply(this,arguments)}return w?O.call(D,q,w,W):O.call(D,q,W)}}function Z(O){if(!O)return O;return function(q,w){var K=w?O.call(D,q,w):O.call(D,q);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 q=!process.getuid||process.getuid()!==0;if(q){if(O.code==="EINVAL"||O.code==="EPERM")return!0}return!1}}});var $_=E((ye0,D_)=>{var ex=l("stream").Stream;D_.exports=SK0;function SK0(D){return{ReadStream:$,WriteStream:X};function $(J,Y){if(!(this instanceof $))return new $(J,Y);ex.call(this);var F=this;this.path=J,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=65536,Y=Y||{};var Q=Object.keys(Y);for(var U=0,Z=Q.length;U<Z;U++){var G=Q[U];this[G]=Y[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(){F._read()});return}D.open(this.path,this.flags,this.mode,function(O,q){if(O){F.emit("error",O),F.readable=!1;return}F.fd=q,F.emit("open",q),F._read()})}function X(J,Y){if(!(this instanceof X))return new X(J,Y);ex.call(this),this.path=J,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,Y=Y||{};var F=Object.keys(Y);for(var Q=0,U=F.length;Q<U;Q++){var Z=F[Q];this[Z]=Y[Z]}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 J_=E((be0,X_)=>{X_.exports=uK0;var vK0=Object.getPrototypeOf||function(D){return D.__proto__};function uK0(D){if(D===null||typeof D!=="object")return D;if(D instanceof Object)var $={__proto__:vK0(D)};else var $=Object.create(null);return Object.getOwnPropertyNames(D).forEach(function(X){Object.defineProperty($,X,Object.getOwnPropertyDescriptor(D,X))}),$}});var mD=E((ge0,VK)=>{var xD=l("fs"),xK0=sx(),_K0=$_(),fK0=J_(),gF=l("util"),Z1,mF;if(typeof Symbol==="function"&&typeof Symbol.for==="function")Z1=Symbol.for("graceful-fs.queue"),mF=Symbol.for("graceful-fs.previous");else Z1="___graceful-fs.queue",mF="___graceful-fs.previous";function kK0(){}function F_(D,$){Object.defineProperty(D,Z1,{get:function(){return $}})}var n8=kK0;if(gF.debuglog)n8=gF.debuglog("gfs4");else if(/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))n8=function(){var D=gF.format.apply(gF,arguments);D="GFS4: "+D.split(/\n/).join(`
|
|
127
|
-
GFS4: `),console.error(D)};if(!xD[Z1]){if(HK=global[Z1]||[],F_(xD,HK),xD.close=function(D){function $(X,J){return D.call(xD,X,function(Y){if(!Y)Y_();if(typeof J==="function")J.apply(this,arguments)})}return Object.defineProperty($,mF,{value:D}),$}(xD.close),xD.closeSync=function(D){function $(X){D.apply(xD,arguments),Y_()}return Object.defineProperty($,mF,{value:D}),$}(xD.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){n8(xD[Z1]),l("assert").equal(xD[Z1].length,0)})}var HK;if(!global[Z1])F_(global,xD[Z1]);VK.exports=zK(fK0(xD));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!xD.__patched)VK.exports=zK(xD),xD.__patched=!0;function zK(D){xK0(D),D.gracefulify=zK,D.createReadStream=V,D.createWriteStream=A;var $=D.readFile;D.readFile=X;function X(j,x,P){if(typeof x==="function")P=x,x=null;return m(j,x,P);function m(b,p,k,R){return $(b,p,function(S){if(S&&(S.code==="EMFILE"||S.code==="ENFILE"))x5([m,[b,p,k],S,R||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var J=D.writeFile;D.writeFile=Y;function Y(j,x,P,m){if(typeof P==="function")m=P,P=null;return b(j,x,P,m);function b(p,k,R,S,v){return J(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var F=D.appendFile;if(F)D.appendFile=Q;function Q(j,x,P,m){if(typeof P==="function")m=P,P=null;return b(j,x,P,m);function b(p,k,R,S,v){return F(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var U=D.copyFile;if(U)D.copyFile=Z;function Z(j,x,P,m){if(typeof P==="function")m=P,P=0;return b(j,x,P,m);function b(p,k,R,S,v){return U(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var G=D.readdir;D.readdir=q;var O=/^v[0-5]\./;function q(j,x,P){if(typeof x==="function")P=x,x=null;var m=O.test(process.version)?function(k,R,S,v){return G(k,b(k,R,S,v))}:function(k,R,S,v){return G(k,R,b(k,R,S,v))};return m(j,x,P);function b(p,k,R,S){return function(v,f){if(v&&(v.code==="EMFILE"||v.code==="ENFILE"))x5([m,[p,k,R],v,S||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof R==="function")R.call(this,v,f)}}}}if(process.version.substr(0,4)==="v0.8"){var w=_K0(D);M=w.ReadStream,z=w.WriteStream}var K=D.ReadStream;if(K)M.prototype=Object.create(K.prototype),M.prototype.open=I;var W=D.WriteStream;if(W)z.prototype=Object.create(W.prototype),z.prototype.open=N;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(j){M=j},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return z},set:function(j){z=j},enumerable:!0,configurable:!0});var H=M;Object.defineProperty(D,"FileReadStream",{get:function(){return H},set:function(j){H=j},enumerable:!0,configurable:!0});var B=z;Object.defineProperty(D,"FileWriteStream",{get:function(){return B},set:function(j){B=j},enumerable:!0,configurable:!0});function M(j,x){if(this instanceof M)return K.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function I(){var j=this;_(j.path,j.flags,j.mode,function(x,P){if(x){if(j.autoClose)j.destroy();j.emit("error",x)}else j.fd=P,j.emit("open",P),j.read()})}function z(j,x){if(this instanceof z)return W.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function N(){var j=this;_(j.path,j.flags,j.mode,function(x,P){if(x)j.destroy(),j.emit("error",x);else j.fd=P,j.emit("open",P)})}function V(j,x){return new D.ReadStream(j,x)}function A(j,x){return new D.WriteStream(j,x)}var u=D.open;D.open=_;function _(j,x,P,m){if(typeof P==="function")m=P,P=null;return b(j,x,P,m);function b(p,k,R,S,v){return u(p,k,R,function(f,h){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}return D}function x5(D){n8("ENQUEUE",D[0].name,D[1]),xD[Z1].push(D),NK()}var hF;function Y_(){var D=Date.now();for(var $=0;$<xD[Z1].length;++$)if(xD[Z1][$].length>2)xD[Z1][$][3]=D,xD[Z1][$][4]=D;NK()}function NK(){if(clearTimeout(hF),hF=void 0,xD[Z1].length===0)return;var D=xD[Z1].shift(),$=D[0],X=D[1],J=D[2],Y=D[3],F=D[4];if(Y===void 0)n8("RETRY",$.name,X),$.apply(null,X);else if(Date.now()-Y>=60000){n8("TIMEOUT",$.name,X);var Q=X.pop();if(typeof Q==="function")Q.call(null,J)}else{var U=Date.now()-F,Z=Math.max(F-Y,1),G=Math.min(Z*1.2,100);if(U>=G)n8("RETRY",$.name,X),$.apply(null,X.concat([Y]));else xD[Z1].push(D)}if(hF===void 0)hF=setTimeout(NK,0)}});var U_=E((he0,Q_)=>{function E$(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)}Q_.exports=E$;E$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};E$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};E$.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 X=this._timeouts.shift();if(X===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),X=this._timeouts.shift();else return!1;var J=this,Y=setTimeout(function(){if(J._attempts++,J._operationTimeoutCb){if(J._timeout=setTimeout(function(){J._operationTimeoutCb(J._attempts)},J._operationTimeout),J._options.unref)J._timeout.unref()}J._fn(J._attempts)},X);if(this._options.unref)Y.unref();return!0};E$.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var X=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){X._operationTimeoutCb()},X._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};E$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};E$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};E$.prototype.start=E$.prototype.try;E$.prototype.errors=function(){return this._errors};E$.prototype.attempts=function(){return this._attempts};E$.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,X=0;for(var J=0;J<this._errors.length;J++){var Y=this._errors[J],F=Y.message,Q=(D[F]||0)+1;if(D[F]=Q,Q>=X)$=Y,X=Q}return $}});var G_=E((bK0)=>{var yK0=U_();bK0.operation=function(D){var $=bK0.timeouts(D);return new yK0($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};bK0.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var X in D)$[X]=D[X];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var J=[];for(var Y=0;Y<$.retries;Y++)J.push(this.createTimeout(Y,$));if(D&&D.forever&&!J.length)J.push(this.createTimeout(Y,$));return J.sort(function(F,Q){return F-Q}),J};bK0.createTimeout=function(D,$){var X=$.randomize?Math.random()+1:1,J=Math.round(X*$.minTimeout*Math.pow($.factor,D));return J=Math.min(J,$.maxTimeout),J};bK0.wrap=function(D,$,X){if($ instanceof Array)X=$,$=null;if(!X){X=[];for(var J in D)if(typeof D[J]==="function")X.push(J)}for(var Y=0;Y<X.length;Y++){var F=X[Y],Q=D[F];D[F]=function(Z){var G=bK0.operation($),O=Array.prototype.slice.call(arguments,1),q=O.pop();O.push(function(w){if(G.retry(w))return;if(w)arguments[0]=G.mainError();q.apply(this,arguments)}),G.attempt(function(){Z.apply(D,O)})}.bind(D,Q),D[F].options=$}}});var O_=E((ce0,cF)=>{cF.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")cF.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")cF.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var lF=E((de0,f5)=>{var TD=global.process,l8=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(!l8(TD))f5.exports=function(){return function(){}};else{if(LK=l("assert"),i8=O_(),BK=/^win/i.test(TD.platform),_5=l("events"),typeof _5!=="function")_5=_5.EventEmitter;if(TD.__signal_exit_emitter__)sD=TD.__signal_exit_emitter__;else sD=TD.__signal_exit_emitter__=new _5,sD.count=0,sD.emitted={};if(!sD.infinite)sD.setMaxListeners(1/0),sD.infinite=!0;f5.exports=function(D,$){if(!l8(global.process))return function(){};if(LK.equal(typeof D,"function","a callback must be provided for exit handler"),p8===!1)dF();var X="exit";if($&&$.alwaysLast)X="afterexit";var J=function(){if(sD.removeListener(X,D),sD.listeners("exit").length===0&&sD.listeners("afterexit").length===0)v2()};return sD.on(X,D),J},v2=function(){if(!p8||!l8(global.process))return;p8=!1,i8.forEach(function($){try{TD.removeListener($,u2[$])}catch(X){}}),TD.emit=x2,TD.reallyExit=nF,sD.count-=1},f5.exports.unload=v2,E4=function($,X,J){if(sD.emitted[$])return;sD.emitted[$]=!0,sD.emit($,X,J)},u2={},i8.forEach(function(D){u2[D]=function(){if(!l8(global.process))return;var X=TD.listeners(D);if(X.length===sD.count){if(v2(),E4("exit",null,D),E4("afterexit",null,D),BK&&D==="SIGHUP")D="SIGINT";TD.kill(TD.pid,D)}}}),f5.exports.signals=function(){return i8},p8=!1,dF=function(){if(p8||!l8(global.process))return;p8=!0,sD.count+=1,i8=i8.filter(function($){try{return TD.on($,u2[$]),!0}catch(X){return!1}}),TD.emit=IK,TD.reallyExit=MK},f5.exports.load=dF,nF=TD.reallyExit,MK=function($){if(!l8(global.process))return;TD.exitCode=$||0,E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),nF.call(TD,TD.exitCode)},x2=TD.emit,IK=function($,X){if($==="exit"&&l8(global.process)){if(X!==void 0)TD.exitCode=X;var J=x2.apply(this,arguments);return E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),J}else return x2.apply(this,arguments)}}var LK,i8,BK,_5,sD,v2,E4,u2,p8,dF,nF,MK,x2,IK});var w_=E((nK0,jK)=>{var q_=Symbol();function cK0(D,$,X){let J=$[q_];if(J)return $.stat(D,(F,Q)=>{if(F)return X(F);X(null,Q.mtime,J)});let Y=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,Y,Y,(F)=>{if(F)return X(F);$.stat(D,(Q,U)=>{if(Q)return X(Q);let Z=U.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,q_,{value:Z}),X(null,U.mtime,Z)})})}function dK0(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}nK0.probe=cK0;nK0.getMtime=dK0});var N_=E((eK0,f2)=>{var pK0=l("path"),RK=mD(),rK0=G_(),tK0=lF(),K_=w_(),c6={};function _2(D,$){return $.lockfilePath||`${D}.lock`}function TK(D,$,X){if(!$.realpath)return X(null,pK0.resolve(D));$.fs.realpath(D,X)}function AK(D,$,X){let J=_2(D,$);$.fs.mkdir(J,(Y)=>{if(!Y)return K_.probe(J,$.fs,(F,Q,U)=>{if(F)return $.fs.rmdir(J,()=>{}),X(F);X(null,Q,U)});if(Y.code!=="EEXIST")return X(Y);if($.stale<=0)return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(J,(F,Q)=>{if(F){if(F.code==="ENOENT")return AK(D,{...$,stale:0},X);return X(F)}if(!W_(Q,$))return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));H_(D,$,(U)=>{if(U)return X(U);AK(D,{...$,stale:0},X)})})})}function W_(D,$){return D.mtime.getTime()<Date.now()-$.stale}function H_(D,$,X){$.fs.rmdir(_2(D,$),(J)=>{if(J&&J.code!=="ENOENT")return X(J);X()})}function iF(D,$){let X=c6[D];if(X.updateTimeout)return;if(X.updateDelay=X.updateDelay||$.update,X.updateTimeout=setTimeout(()=>{X.updateTimeout=null,$.fs.stat(X.lockfilePath,(J,Y)=>{let F=X.lastUpdate+$.stale<Date.now();if(J){if(J.code==="ENOENT"||F)return EK(D,X,Object.assign(J,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}if(X.mtime.getTime()!==Y.mtime.getTime())return EK(D,X,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let U=K_.getMtime(X.mtimePrecision);$.fs.utimes(X.lockfilePath,U,U,(Z)=>{let G=X.lastUpdate+$.stale<Date.now();if(X.released)return;if(Z){if(Z.code==="ENOENT"||G)return EK(D,X,Object.assign(Z,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}X.mtime=U,X.lastUpdate=Date.now(),X.updateDelay=null,iF(D,$)})})},X.updateDelay),X.updateTimeout.unref)X.updateTimeout.unref()}function EK(D,$,X){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(c6[D]===$)delete c6[D];$.options.onCompromised(X)}function oK0(D,$,X){$={stale:1e4,update:null,realpath:!0,retries:0,fs:RK,onCompromised:(J)=>{throw J},...$},$.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),TK(D,$,(J,Y)=>{if(J)return X(J);let F=rK0.operation($.retries);F.attempt(()=>{AK(Y,$,(Q,U,Z)=>{if(F.retry(Q))return;if(Q)return X(F.mainError());let G=c6[Y]={lockfilePath:_2(Y,$),mtime:U,mtimePrecision:Z,options:$,lastUpdate:Date.now()};iF(Y,$),X(null,(O)=>{if(G.released)return O&&O(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));z_(Y,{...$,realpath:!1},O)})})})})}function z_(D,$,X){$={fs:RK,realpath:!0,...$},TK(D,$,(J,Y)=>{if(J)return X(J);let F=c6[Y];if(!F)return X(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));F.updateTimeout&&clearTimeout(F.updateTimeout),F.released=!0,delete c6[Y],H_(Y,$,X)})}function aK0(D,$,X){$={stale:1e4,realpath:!0,fs:RK,...$},$.stale=Math.max($.stale||0,2000),TK(D,$,(J,Y)=>{if(J)return X(J);$.fs.stat(_2(Y,$),(F,Q)=>{if(F)return F.code==="ENOENT"?X(null,!1):X(F);return X(null,!W_(Q,$))})})}function sK0(){return c6}tK0(()=>{for(let D in c6){let $=c6[D].options;try{$.fs.rmdirSync(_2(D,$))}catch(X){}}});eK0.lock=oK0;eK0.unlock=z_;eK0.check=aK0;eK0.getLocks=sK0});var L_=E((ne0,V_)=>{var YW0=mD();function FW0(D){let $=["mkdir","realpath","stat","rmdir","utimes"],X={...D};return $.forEach((J)=>{X[J]=(...Y)=>{let F=Y.pop(),Q;try{Q=D[`${J}Sync`](...Y)}catch(U){return F(U)}F(null,Q)}}),X}function QW0(D){return(...$)=>new Promise((X,J)=>{$.push((Y,F)=>{if(Y)J(Y);else X(F)}),D(...$)})}function UW0(D){return(...$)=>{let X,J;if($.push((Y,F)=>{X=Y,J=F}),D(...$),X)throw X;return J}}function ZW0(D){if(D={...D},D.fs=FW0(D.fs||YW0),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}V_.exports={toPromise:QW0,toSync:UW0,toSyncOptions:ZW0}});var M_=E((le0,A4)=>{var k5=N_(),{toPromise:pF,toSync:rF,toSyncOptions:CK}=L_();async function B_(D,$){let X=await pF(k5.lock)(D,$);return pF(X)}function GW0(D,$){let X=rF(k5.lock)(D,CK($));return rF(X)}function OW0(D,$){return pF(k5.unlock)(D,$)}function qW0(D,$){return rF(k5.unlock)(D,CK($))}function wW0(D,$){return pF(k5.check)(D,$)}function KW0(D,$){return rF(k5.check)(D,CK($))}A4.exports=B_;A4.exports.lock=B_;A4.exports.unlock=OW0;A4.exports.lockSync=GW0;A4.exports.unlockSync=qW0;A4.exports.check=wW0;A4.exports.checkSync=KW0});var C_=E((R_)=>{Object.defineProperty(R_,"__esModule",{value:!0});R_.canStoreURLs=R_.FileUrlStorage=void 0;var I_=l("fs"),WW0=zW0(ox()),j_=HW0(M_());function A_(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,X=new WeakMap;return(A_=function(J){return J?X:$})(D)}function HW0(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var X=A_($);if(X&&X.has(D))return X.get(D);var J={__proto__:null},Y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in D)if(F!=="default"&&{}.hasOwnProperty.call(D,F)){var Q=Y?Object.getOwnPropertyDescriptor(D,F):null;Q&&(Q.get||Q.set)?Object.defineProperty(J,F,Q):J[F]=D[F]}return J.default=D,X&&X.set(D,J),J}function zW0(D){return D&&D.__esModule?D:{default:D}}function k2(D){return k2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},k2(D)}function NW0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function E_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,LW0(J.key),J)}}function VW0(D,$,X){if($)E_(D.prototype,$);if(X)E_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function LW0(D){var $=BW0(D,"string");return k2($)=="symbol"?$:$+""}function BW0(D,$){if(k2(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(k2(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var ie0=R_.canStoreURLs=!0,pe0=R_.FileUrlStorage=function(){function D($){NW0(this,D),this.path=$}return VW0(D,[{key:"findAllUploads",value:function(){var X=this;return new Promise(function(J,Y){X._getItems("tus::",function(F,Q){if(F)Y(F);else J(Q)})})}},{key:"findUploadsByFingerprint",value:function(X){var J=this;return new Promise(function(Y,F){J._getItems("tus::".concat(X),function(Q,U){if(Q)F(Q);else Y(U)})})}},{key:"removeUpload",value:function(X){var J=this;return new Promise(function(Y,F){J._removeItem(X,function(Q){if(Q)F(Q);else Y()})})}},{key:"addUpload",value:function(X,J){var Y=this,F=Math.round(Math.random()*1000000000000),Q="tus::".concat(X,"::").concat(F);return new Promise(function(U,Z){Y._setItem(Q,J,function(G){if(G)Z(G);else U(Q)})})}},{key:"_setItem",value:function(X,J,Y){var F=this;j_.lock(this.path,this._lockfileOptions()).then(function(Q){Y=F._releaseAndCb(Q,Y),F._getData(function(U,Z){if(U){Y(U);return}Z[X]=J,F._writeData(Z,function(G){return Y(G)})})}).catch(Y)}},{key:"_getItems",value:function(X,J){this._getData(function(Y,F){if(Y){J(Y);return}var Q=Object.keys(F).filter(function(U){return U.startsWith(X)}).map(function(U){var Z=F[U];return Z.urlStorageKey=U,Z});J(null,Q)})}},{key:"_removeItem",value:function(X,J){var Y=this;j_.lock(this.path,this._lockfileOptions()).then(function(F){J=Y._releaseAndCb(F,J),Y._getData(function(Q,U){if(Q){J(Q);return}delete U[X],Y._writeData(U,function(Z){return J(Z)})})}).catch(J)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(X,J){return function(Y){if(Y){X().then(function(){return J(Y)}).catch(function(F){return J((0,WW0.default)([Y,F]))});return}X().then(J).catch(J)}}},{key:"_writeData",value:function(X,J){var Y={encoding:"utf8",mode:432,flag:"w"};(0,I_.writeFile)(this.path,JSON.stringify(X),Y,function(F){return J(F)})}},{key:"_getData",value:function(X){(0,I_.readFile)(this.path,"utf8",function(J,Y){if(J){if(J.code==="ENOENT")X(null,{});else X(J);return}try{Y=!Y.trim().length?{}:JSON.parse(Y)}catch(F){X(F);return}X(null,Y)})}}])}()});var oF=E((R4)=>{Object.defineProperty(R4,"__esModule",{value:!0});Object.defineProperty(R4,"DefaultHttpStack",{enumerable:!0,get:function(){return u_.default}});Object.defineProperty(R4,"DetailedError",{enumerable:!0,get:function(){return IW0.default}});Object.defineProperty(R4,"FileUrlStorage",{enumerable:!0,get:function(){return x_.FileUrlStorage}});Object.defineProperty(R4,"StreamSource",{enumerable:!0,get:function(){return TW0.default}});R4.Upload=void 0;Object.defineProperty(R4,"canStoreURLs",{enumerable:!0,get:function(){return x_.canStoreURLs}});R4.defaultOptions=void 0;Object.defineProperty(R4,"enableDebugLog",{enumerable:!0,get:function(){return jW0.enableDebugLog}});R4.isSupported=void 0;var IW0=r8(Cw()),jW0=Pw(),EW0=r8(Mv()),PK=r8(Du()),AW0=r8(Bu()),RW0=r8(Au()),u_=r8(mu()),TW0=r8(hw()),x_=C_();function r8(D){return D&&D.__esModule?D:{default:D}}function b5(D){return b5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},b5(D)}function CW0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function P_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,f_(J.key),J)}}function PW0(D,$,X){if($)P_(D.prototype,$);if(X)P_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function SW0(D,$,X){return $=tF($),vW0(D,__()?Reflect.construct($,X||[],tF(D).constructor):$.apply(D,X))}function vW0(D,$){if($&&(b5($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return uW0(D)}function uW0(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function __(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(__=function(){return!!D})()}function tF(D){return tF=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},tF(D)}function xW0(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}),$)SK(D,$)}function SK(D,$){return SK=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(J,Y){return J.__proto__=Y,J},SK(D,$)}function S_(D,$){var X=Object.keys(D);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(D);$&&(J=J.filter(function(Y){return Object.getOwnPropertyDescriptor(D,Y).enumerable})),X.push.apply(X,J)}return X}function y5(D){for(var $=1;$<arguments.length;$++){var X=arguments[$]!=null?arguments[$]:{};$%2?S_(Object(X),!0).forEach(function(J){_W0(D,J,X[J])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(X)):S_(Object(X)).forEach(function(J){Object.defineProperty(D,J,Object.getOwnPropertyDescriptor(X,J))})}return D}function _W0(D,$,X){if($=f_($),$ in D)Object.defineProperty(D,$,{value:X,enumerable:!0,configurable:!0,writable:!0});else D[$]=X;return D}function f_(D){var $=fW0(D,"string");return b5($)=="symbol"?$:$+""}function fW0(D,$){if(b5(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(b5(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var v_=R4.defaultOptions=y5(y5({},PK.default.defaultOptions),{},{httpStack:new u_.default,fileReader:new AW0.default,urlStorage:new EW0.default,fingerprint:RW0.default}),te0=R4.Upload=function(D){function $(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return CW0(this,$),J=y5(y5({},v_),J),SW0(this,$,[X,J])}return xW0($,D),PW0($,null,[{key:"terminate",value:function(J){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Y=y5(y5({},v_),Y),PK.default.terminate(J,Y)}}])}(PK.default),oe0=R4.isSupported=!0});var B1;var T4=r(()=>{B1={name:"@capgo/cli",type:"module",version:"8.3.0",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:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","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:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.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:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs",test:"bun run build && bun run test:helper-dce && 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:fail-on-incompatible && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && 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 && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^7.0.4","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.6","string-width":"^8.2.1"},optionalDependencies:{"@capgo/cli-keychain-darwin-arm64":"^1.0.0","@capgo/cli-keychain-darwin-x64":"^1.0.0"},devDependencies:{"@antfu/eslint-config":"^9.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.3.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.4.0","@modelcontextprotocol/sdk":"^1.29.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.106.2","@tanstack/intent":"^0.0.41","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.9.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.15","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260526.1","@vercel/ncc":"^0.38.4","@xterm/headless":"^6.0.0","adm-zip":"^0.5.17","ci-info":"^4.4.0",commander:"^14.0.3",eslint:"^10.4.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.67.0",partysocket:"^1.1.19",prettyjson:"^1.2.5",tmp:"^0.2.6","tus-js-client":"^4.3.1",typescript:"^6.0.3",ws:"^8.21.0",zod:"^4.4.3"}}});async function aF(D){try{let X=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,J=await fetch(X,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!J.ok)return null;return(await J.json())["dist-tags"]?.latest||null}catch{return null}}async function yW0(){let D=await aF("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:B1.version,latestVersion:D,isOutdated:!!D&&D!==B1.version,majorVersion:$}}async function ND(){let{isOutdated:D,currentVersion:$,latestVersion:X,majorVersion:J}=await yW0();if(D)L.warning(`\uD83D\uDEA8 You are using @capgo/cli@${$} it's not the latest version.
|
|
127
|
+
GFS4: `),console.error(D)};if(!xD[Z1]){if(HK=global[Z1]||[],F_(xD,HK),xD.close=function(D){function $(X,J){return D.call(xD,X,function(Y){if(!Y)Y_();if(typeof J==="function")J.apply(this,arguments)})}return Object.defineProperty($,mF,{value:D}),$}(xD.close),xD.closeSync=function(D){function $(X){D.apply(xD,arguments),Y_()}return Object.defineProperty($,mF,{value:D}),$}(xD.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||""))process.on("exit",function(){n8(xD[Z1]),l("assert").equal(xD[Z1].length,0)})}var HK;if(!global[Z1])F_(global,xD[Z1]);VK.exports=zK(fK0(xD));if(process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!xD.__patched)VK.exports=zK(xD),xD.__patched=!0;function zK(D){xK0(D),D.gracefulify=zK,D.createReadStream=V,D.createWriteStream=A;var $=D.readFile;D.readFile=X;function X(j,x,P){if(typeof x==="function")P=x,x=null;return m(j,x,P);function m(b,p,k,R){return $(b,p,function(S){if(S&&(S.code==="EMFILE"||S.code==="ENFILE"))x5([m,[b,p,k],S,R||Date.now(),Date.now()]);else if(typeof k==="function")k.apply(this,arguments)})}}var J=D.writeFile;D.writeFile=Y;function Y(j,x,P,m){if(typeof P==="function")m=P,P=null;return b(j,x,P,m);function b(p,k,R,S,v){return J(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var F=D.appendFile;if(F)D.appendFile=Q;function Q(j,x,P,m){if(typeof P==="function")m=P,P=null;return b(j,x,P,m);function b(p,k,R,S,v){return F(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var U=D.copyFile;if(U)D.copyFile=Z;function Z(j,x,P,m){if(typeof P==="function")m=P,P=0;return b(j,x,P,m);function b(p,k,R,S,v){return U(p,k,R,function(f){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}var G=D.readdir;D.readdir=q;var O=/^v[0-5]\./;function q(j,x,P){if(typeof x==="function")P=x,x=null;var m=O.test(process.version)?function(k,R,S,v){return G(k,b(k,R,S,v))}:function(k,R,S,v){return G(k,R,b(k,R,S,v))};return m(j,x,P);function b(p,k,R,S){return function(v,f){if(v&&(v.code==="EMFILE"||v.code==="ENFILE"))x5([m,[p,k,R],v,S||Date.now(),Date.now()]);else{if(f&&f.sort)f.sort();if(typeof R==="function")R.call(this,v,f)}}}}if(process.version.substr(0,4)==="v0.8"){var w=_K0(D);M=w.ReadStream,z=w.WriteStream}var K=D.ReadStream;if(K)M.prototype=Object.create(K.prototype),M.prototype.open=I;var W=D.WriteStream;if(W)z.prototype=Object.create(W.prototype),z.prototype.open=N;Object.defineProperty(D,"ReadStream",{get:function(){return M},set:function(j){M=j},enumerable:!0,configurable:!0}),Object.defineProperty(D,"WriteStream",{get:function(){return z},set:function(j){z=j},enumerable:!0,configurable:!0});var H=M;Object.defineProperty(D,"FileReadStream",{get:function(){return H},set:function(j){H=j},enumerable:!0,configurable:!0});var B=z;Object.defineProperty(D,"FileWriteStream",{get:function(){return B},set:function(j){B=j},enumerable:!0,configurable:!0});function M(j,x){if(this instanceof M)return K.apply(this,arguments),this;else return M.apply(Object.create(M.prototype),arguments)}function I(){var j=this;_(j.path,j.flags,j.mode,function(x,P){if(x){if(j.autoClose)j.destroy();j.emit("error",x)}else j.fd=P,j.emit("open",P),j.read()})}function z(j,x){if(this instanceof z)return W.apply(this,arguments),this;else return z.apply(Object.create(z.prototype),arguments)}function N(){var j=this;_(j.path,j.flags,j.mode,function(x,P){if(x)j.destroy(),j.emit("error",x);else j.fd=P,j.emit("open",P)})}function V(j,x){return new D.ReadStream(j,x)}function A(j,x){return new D.WriteStream(j,x)}var u=D.open;D.open=_;function _(j,x,P,m){if(typeof P==="function")m=P,P=null;return b(j,x,P,m);function b(p,k,R,S,v){return u(p,k,R,function(f,h){if(f&&(f.code==="EMFILE"||f.code==="ENFILE"))x5([b,[p,k,R,S],f,v||Date.now(),Date.now()]);else if(typeof S==="function")S.apply(this,arguments)})}}return D}function x5(D){n8("ENQUEUE",D[0].name,D[1]),xD[Z1].push(D),NK()}var hF;function Y_(){var D=Date.now();for(var $=0;$<xD[Z1].length;++$)if(xD[Z1][$].length>2)xD[Z1][$][3]=D,xD[Z1][$][4]=D;NK()}function NK(){if(clearTimeout(hF),hF=void 0,xD[Z1].length===0)return;var D=xD[Z1].shift(),$=D[0],X=D[1],J=D[2],Y=D[3],F=D[4];if(Y===void 0)n8("RETRY",$.name,X),$.apply(null,X);else if(Date.now()-Y>=60000){n8("TIMEOUT",$.name,X);var Q=X.pop();if(typeof Q==="function")Q.call(null,J)}else{var U=Date.now()-F,Z=Math.max(F-Y,1),G=Math.min(Z*1.2,100);if(U>=G)n8("RETRY",$.name,X),$.apply(null,X.concat([Y]));else xD[Z1].push(D)}if(hF===void 0)hF=setTimeout(NK,0)}});var U_=E((he0,Q_)=>{function E$(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)}Q_.exports=E$;E$.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts};E$.prototype.stop=function(){if(this._timeout)clearTimeout(this._timeout);this._timeouts=[],this._cachedTimeouts=null};E$.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 X=this._timeouts.shift();if(X===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),X=this._timeouts.shift();else return!1;var J=this,Y=setTimeout(function(){if(J._attempts++,J._operationTimeoutCb){if(J._timeout=setTimeout(function(){J._operationTimeoutCb(J._attempts)},J._operationTimeout),J._options.unref)J._timeout.unref()}J._fn(J._attempts)},X);if(this._options.unref)Y.unref();return!0};E$.prototype.attempt=function(D,$){if(this._fn=D,$){if($.timeout)this._operationTimeout=$.timeout;if($.cb)this._operationTimeoutCb=$.cb}var X=this;if(this._operationTimeoutCb)this._timeout=setTimeout(function(){X._operationTimeoutCb()},X._operationTimeout);this._operationStart=new Date().getTime(),this._fn(this._attempts)};E$.prototype.try=function(D){console.log("Using RetryOperation.try() is deprecated"),this.attempt(D)};E$.prototype.start=function(D){console.log("Using RetryOperation.start() is deprecated"),this.attempt(D)};E$.prototype.start=E$.prototype.try;E$.prototype.errors=function(){return this._errors};E$.prototype.attempts=function(){return this._attempts};E$.prototype.mainError=function(){if(this._errors.length===0)return null;var D={},$=null,X=0;for(var J=0;J<this._errors.length;J++){var Y=this._errors[J],F=Y.message,Q=(D[F]||0)+1;if(D[F]=Q,Q>=X)$=Y,X=Q}return $}});var G_=E((bK0)=>{var yK0=U_();bK0.operation=function(D){var $=bK0.timeouts(D);return new yK0($,{forever:D&&D.forever,unref:D&&D.unref,maxRetryTime:D&&D.maxRetryTime})};bK0.timeouts=function(D){if(D instanceof Array)return[].concat(D);var $={retries:10,factor:2,minTimeout:1000,maxTimeout:1/0,randomize:!1};for(var X in D)$[X]=D[X];if($.minTimeout>$.maxTimeout)throw Error("minTimeout is greater than maxTimeout");var J=[];for(var Y=0;Y<$.retries;Y++)J.push(this.createTimeout(Y,$));if(D&&D.forever&&!J.length)J.push(this.createTimeout(Y,$));return J.sort(function(F,Q){return F-Q}),J};bK0.createTimeout=function(D,$){var X=$.randomize?Math.random()+1:1,J=Math.round(X*$.minTimeout*Math.pow($.factor,D));return J=Math.min(J,$.maxTimeout),J};bK0.wrap=function(D,$,X){if($ instanceof Array)X=$,$=null;if(!X){X=[];for(var J in D)if(typeof D[J]==="function")X.push(J)}for(var Y=0;Y<X.length;Y++){var F=X[Y],Q=D[F];D[F]=function(Z){var G=bK0.operation($),O=Array.prototype.slice.call(arguments,1),q=O.pop();O.push(function(w){if(G.retry(w))return;if(w)arguments[0]=G.mainError();q.apply(this,arguments)}),G.attempt(function(){Z.apply(D,O)})}.bind(D,Q),D[F].options=$}}});var O_=E((ce0,cF)=>{cF.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32")cF.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");if(process.platform==="linux")cF.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")});var lF=E((de0,f5)=>{var TD=global.process,l8=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(!l8(TD))f5.exports=function(){return function(){}};else{if(LK=l("assert"),i8=O_(),BK=/^win/i.test(TD.platform),_5=l("events"),typeof _5!=="function")_5=_5.EventEmitter;if(TD.__signal_exit_emitter__)sD=TD.__signal_exit_emitter__;else sD=TD.__signal_exit_emitter__=new _5,sD.count=0,sD.emitted={};if(!sD.infinite)sD.setMaxListeners(1/0),sD.infinite=!0;f5.exports=function(D,$){if(!l8(global.process))return function(){};if(LK.equal(typeof D,"function","a callback must be provided for exit handler"),p8===!1)dF();var X="exit";if($&&$.alwaysLast)X="afterexit";var J=function(){if(sD.removeListener(X,D),sD.listeners("exit").length===0&&sD.listeners("afterexit").length===0)v2()};return sD.on(X,D),J},v2=function(){if(!p8||!l8(global.process))return;p8=!1,i8.forEach(function($){try{TD.removeListener($,u2[$])}catch(X){}}),TD.emit=x2,TD.reallyExit=nF,sD.count-=1},f5.exports.unload=v2,E4=function($,X,J){if(sD.emitted[$])return;sD.emitted[$]=!0,sD.emit($,X,J)},u2={},i8.forEach(function(D){u2[D]=function(){if(!l8(global.process))return;var X=TD.listeners(D);if(X.length===sD.count){if(v2(),E4("exit",null,D),E4("afterexit",null,D),BK&&D==="SIGHUP")D="SIGINT";TD.kill(TD.pid,D)}}}),f5.exports.signals=function(){return i8},p8=!1,dF=function(){if(p8||!l8(global.process))return;p8=!0,sD.count+=1,i8=i8.filter(function($){try{return TD.on($,u2[$]),!0}catch(X){return!1}}),TD.emit=IK,TD.reallyExit=MK},f5.exports.load=dF,nF=TD.reallyExit,MK=function($){if(!l8(global.process))return;TD.exitCode=$||0,E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),nF.call(TD,TD.exitCode)},x2=TD.emit,IK=function($,X){if($==="exit"&&l8(global.process)){if(X!==void 0)TD.exitCode=X;var J=x2.apply(this,arguments);return E4("exit",TD.exitCode,null),E4("afterexit",TD.exitCode,null),J}else return x2.apply(this,arguments)}}var LK,i8,BK,_5,sD,v2,E4,u2,p8,dF,nF,MK,x2,IK});var w_=E((nK0,jK)=>{var q_=Symbol();function cK0(D,$,X){let J=$[q_];if(J)return $.stat(D,(F,Q)=>{if(F)return X(F);X(null,Q.mtime,J)});let Y=new Date(Math.ceil(Date.now()/1000)*1000+5);$.utimes(D,Y,Y,(F)=>{if(F)return X(F);$.stat(D,(Q,U)=>{if(Q)return X(Q);let Z=U.mtime.getTime()%1000===0?"s":"ms";Object.defineProperty($,q_,{value:Z}),X(null,U.mtime,Z)})})}function dK0(D){let $=Date.now();if(D==="s")$=Math.ceil($/1000)*1000;return new Date($)}nK0.probe=cK0;nK0.getMtime=dK0});var N_=E((eK0,f2)=>{var pK0=l("path"),RK=mD(),rK0=G_(),tK0=lF(),K_=w_(),c6={};function _2(D,$){return $.lockfilePath||`${D}.lock`}function TK(D,$,X){if(!$.realpath)return X(null,pK0.resolve(D));$.fs.realpath(D,X)}function AK(D,$,X){let J=_2(D,$);$.fs.mkdir(J,(Y)=>{if(!Y)return K_.probe(J,$.fs,(F,Q,U)=>{if(F)return $.fs.rmdir(J,()=>{}),X(F);X(null,Q,U)});if(Y.code!=="EEXIST")return X(Y);if($.stale<=0)return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));$.fs.stat(J,(F,Q)=>{if(F){if(F.code==="ENOENT")return AK(D,{...$,stale:0},X);return X(F)}if(!W_(Q,$))return X(Object.assign(Error("Lock file is already being held"),{code:"ELOCKED",file:D}));H_(D,$,(U)=>{if(U)return X(U);AK(D,{...$,stale:0},X)})})})}function W_(D,$){return D.mtime.getTime()<Date.now()-$.stale}function H_(D,$,X){$.fs.rmdir(_2(D,$),(J)=>{if(J&&J.code!=="ENOENT")return X(J);X()})}function iF(D,$){let X=c6[D];if(X.updateTimeout)return;if(X.updateDelay=X.updateDelay||$.update,X.updateTimeout=setTimeout(()=>{X.updateTimeout=null,$.fs.stat(X.lockfilePath,(J,Y)=>{let F=X.lastUpdate+$.stale<Date.now();if(J){if(J.code==="ENOENT"||F)return EK(D,X,Object.assign(J,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}if(X.mtime.getTime()!==Y.mtime.getTime())return EK(D,X,Object.assign(Error("Unable to update lock within the stale threshold"),{code:"ECOMPROMISED"}));let U=K_.getMtime(X.mtimePrecision);$.fs.utimes(X.lockfilePath,U,U,(Z)=>{let G=X.lastUpdate+$.stale<Date.now();if(X.released)return;if(Z){if(Z.code==="ENOENT"||G)return EK(D,X,Object.assign(Z,{code:"ECOMPROMISED"}));return X.updateDelay=1000,iF(D,$)}X.mtime=U,X.lastUpdate=Date.now(),X.updateDelay=null,iF(D,$)})})},X.updateDelay),X.updateTimeout.unref)X.updateTimeout.unref()}function EK(D,$,X){if($.released=!0,$.updateTimeout)clearTimeout($.updateTimeout);if(c6[D]===$)delete c6[D];$.options.onCompromised(X)}function oK0(D,$,X){$={stale:1e4,update:null,realpath:!0,retries:0,fs:RK,onCompromised:(J)=>{throw J},...$},$.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),TK(D,$,(J,Y)=>{if(J)return X(J);let F=rK0.operation($.retries);F.attempt(()=>{AK(Y,$,(Q,U,Z)=>{if(F.retry(Q))return;if(Q)return X(F.mainError());let G=c6[Y]={lockfilePath:_2(Y,$),mtime:U,mtimePrecision:Z,options:$,lastUpdate:Date.now()};iF(Y,$),X(null,(O)=>{if(G.released)return O&&O(Object.assign(Error("Lock is already released"),{code:"ERELEASED"}));z_(Y,{...$,realpath:!1},O)})})})})}function z_(D,$,X){$={fs:RK,realpath:!0,...$},TK(D,$,(J,Y)=>{if(J)return X(J);let F=c6[Y];if(!F)return X(Object.assign(Error("Lock is not acquired/owned by you"),{code:"ENOTACQUIRED"}));F.updateTimeout&&clearTimeout(F.updateTimeout),F.released=!0,delete c6[Y],H_(Y,$,X)})}function aK0(D,$,X){$={stale:1e4,realpath:!0,fs:RK,...$},$.stale=Math.max($.stale||0,2000),TK(D,$,(J,Y)=>{if(J)return X(J);$.fs.stat(_2(Y,$),(F,Q)=>{if(F)return F.code==="ENOENT"?X(null,!1):X(F);return X(null,!W_(Q,$))})})}function sK0(){return c6}tK0(()=>{for(let D in c6){let $=c6[D].options;try{$.fs.rmdirSync(_2(D,$))}catch(X){}}});eK0.lock=oK0;eK0.unlock=z_;eK0.check=aK0;eK0.getLocks=sK0});var L_=E((ne0,V_)=>{var YW0=mD();function FW0(D){let $=["mkdir","realpath","stat","rmdir","utimes"],X={...D};return $.forEach((J)=>{X[J]=(...Y)=>{let F=Y.pop(),Q;try{Q=D[`${J}Sync`](...Y)}catch(U){return F(U)}F(null,Q)}}),X}function QW0(D){return(...$)=>new Promise((X,J)=>{$.push((Y,F)=>{if(Y)J(Y);else X(F)}),D(...$)})}function UW0(D){return(...$)=>{let X,J;if($.push((Y,F)=>{X=Y,J=F}),D(...$),X)throw X;return J}}function ZW0(D){if(D={...D},D.fs=FW0(D.fs||YW0),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}V_.exports={toPromise:QW0,toSync:UW0,toSyncOptions:ZW0}});var M_=E((le0,A4)=>{var k5=N_(),{toPromise:pF,toSync:rF,toSyncOptions:CK}=L_();async function B_(D,$){let X=await pF(k5.lock)(D,$);return pF(X)}function GW0(D,$){let X=rF(k5.lock)(D,CK($));return rF(X)}function OW0(D,$){return pF(k5.unlock)(D,$)}function qW0(D,$){return rF(k5.unlock)(D,CK($))}function wW0(D,$){return pF(k5.check)(D,$)}function KW0(D,$){return rF(k5.check)(D,CK($))}A4.exports=B_;A4.exports.lock=B_;A4.exports.unlock=OW0;A4.exports.lockSync=GW0;A4.exports.unlockSync=qW0;A4.exports.check=wW0;A4.exports.checkSync=KW0});var C_=E((R_)=>{Object.defineProperty(R_,"__esModule",{value:!0});R_.canStoreURLs=R_.FileUrlStorage=void 0;var I_=l("fs"),WW0=zW0(ox()),j_=HW0(M_());function A_(D){if(typeof WeakMap!="function")return null;var $=new WeakMap,X=new WeakMap;return(A_=function(J){return J?X:$})(D)}function HW0(D,$){if(!$&&D&&D.__esModule)return D;if(D===null||typeof D!="object"&&typeof D!="function")return{default:D};var X=A_($);if(X&&X.has(D))return X.get(D);var J={__proto__:null},Y=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var F in D)if(F!=="default"&&{}.hasOwnProperty.call(D,F)){var Q=Y?Object.getOwnPropertyDescriptor(D,F):null;Q&&(Q.get||Q.set)?Object.defineProperty(J,F,Q):J[F]=D[F]}return J.default=D,X&&X.set(D,J),J}function zW0(D){return D&&D.__esModule?D:{default:D}}function k2(D){return k2=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},k2(D)}function NW0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function E_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,LW0(J.key),J)}}function VW0(D,$,X){if($)E_(D.prototype,$);if(X)E_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function LW0(D){var $=BW0(D,"string");return k2($)=="symbol"?$:$+""}function BW0(D,$){if(k2(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(k2(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var ie0=R_.canStoreURLs=!0,pe0=R_.FileUrlStorage=function(){function D($){NW0(this,D),this.path=$}return VW0(D,[{key:"findAllUploads",value:function(){var X=this;return new Promise(function(J,Y){X._getItems("tus::",function(F,Q){if(F)Y(F);else J(Q)})})}},{key:"findUploadsByFingerprint",value:function(X){var J=this;return new Promise(function(Y,F){J._getItems("tus::".concat(X),function(Q,U){if(Q)F(Q);else Y(U)})})}},{key:"removeUpload",value:function(X){var J=this;return new Promise(function(Y,F){J._removeItem(X,function(Q){if(Q)F(Q);else Y()})})}},{key:"addUpload",value:function(X,J){var Y=this,F=Math.round(Math.random()*1000000000000),Q="tus::".concat(X,"::").concat(F);return new Promise(function(U,Z){Y._setItem(Q,J,function(G){if(G)Z(G);else U(Q)})})}},{key:"_setItem",value:function(X,J,Y){var F=this;j_.lock(this.path,this._lockfileOptions()).then(function(Q){Y=F._releaseAndCb(Q,Y),F._getData(function(U,Z){if(U){Y(U);return}Z[X]=J,F._writeData(Z,function(G){return Y(G)})})}).catch(Y)}},{key:"_getItems",value:function(X,J){this._getData(function(Y,F){if(Y){J(Y);return}var Q=Object.keys(F).filter(function(U){return U.startsWith(X)}).map(function(U){var Z=F[U];return Z.urlStorageKey=U,Z});J(null,Q)})}},{key:"_removeItem",value:function(X,J){var Y=this;j_.lock(this.path,this._lockfileOptions()).then(function(F){J=Y._releaseAndCb(F,J),Y._getData(function(Q,U){if(Q){J(Q);return}delete U[X],Y._writeData(U,function(Z){return J(Z)})})}).catch(J)}},{key:"_lockfileOptions",value:function(){return{realpath:!1,retries:{retries:5,minTimeout:20}}}},{key:"_releaseAndCb",value:function(X,J){return function(Y){if(Y){X().then(function(){return J(Y)}).catch(function(F){return J((0,WW0.default)([Y,F]))});return}X().then(J).catch(J)}}},{key:"_writeData",value:function(X,J){var Y={encoding:"utf8",mode:432,flag:"w"};(0,I_.writeFile)(this.path,JSON.stringify(X),Y,function(F){return J(F)})}},{key:"_getData",value:function(X){(0,I_.readFile)(this.path,"utf8",function(J,Y){if(J){if(J.code==="ENOENT")X(null,{});else X(J);return}try{Y=!Y.trim().length?{}:JSON.parse(Y)}catch(F){X(F);return}X(null,Y)})}}])}()});var oF=E((R4)=>{Object.defineProperty(R4,"__esModule",{value:!0});Object.defineProperty(R4,"DefaultHttpStack",{enumerable:!0,get:function(){return u_.default}});Object.defineProperty(R4,"DetailedError",{enumerable:!0,get:function(){return IW0.default}});Object.defineProperty(R4,"FileUrlStorage",{enumerable:!0,get:function(){return x_.FileUrlStorage}});Object.defineProperty(R4,"StreamSource",{enumerable:!0,get:function(){return TW0.default}});R4.Upload=void 0;Object.defineProperty(R4,"canStoreURLs",{enumerable:!0,get:function(){return x_.canStoreURLs}});R4.defaultOptions=void 0;Object.defineProperty(R4,"enableDebugLog",{enumerable:!0,get:function(){return jW0.enableDebugLog}});R4.isSupported=void 0;var IW0=r8(Cw()),jW0=Pw(),EW0=r8(Mv()),PK=r8(Du()),AW0=r8(Bu()),RW0=r8(Au()),u_=r8(mu()),TW0=r8(hw()),x_=C_();function r8(D){return D&&D.__esModule?D:{default:D}}function b5(D){return b5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function($){return typeof $}:function($){return $&&typeof Symbol=="function"&&$.constructor===Symbol&&$!==Symbol.prototype?"symbol":typeof $},b5(D)}function CW0(D,$){if(!(D instanceof $))throw TypeError("Cannot call a class as a function")}function P_(D,$){for(var X=0;X<$.length;X++){var J=$[X];if(J.enumerable=J.enumerable||!1,J.configurable=!0,"value"in J)J.writable=!0;Object.defineProperty(D,f_(J.key),J)}}function PW0(D,$,X){if($)P_(D.prototype,$);if(X)P_(D,X);return Object.defineProperty(D,"prototype",{writable:!1}),D}function SW0(D,$,X){return $=tF($),vW0(D,__()?Reflect.construct($,X||[],tF(D).constructor):$.apply(D,X))}function vW0(D,$){if($&&(b5($)==="object"||typeof $==="function"))return $;else if($!==void 0)throw TypeError("Derived constructors may only return object or undefined");return uW0(D)}function uW0(D){if(D===void 0)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return D}function __(){try{var D=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch($){}return(__=function(){return!!D})()}function tF(D){return tF=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},tF(D)}function xW0(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}),$)SK(D,$)}function SK(D,$){return SK=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(J,Y){return J.__proto__=Y,J},SK(D,$)}function S_(D,$){var X=Object.keys(D);if(Object.getOwnPropertySymbols){var J=Object.getOwnPropertySymbols(D);$&&(J=J.filter(function(Y){return Object.getOwnPropertyDescriptor(D,Y).enumerable})),X.push.apply(X,J)}return X}function y5(D){for(var $=1;$<arguments.length;$++){var X=arguments[$]!=null?arguments[$]:{};$%2?S_(Object(X),!0).forEach(function(J){_W0(D,J,X[J])}):Object.getOwnPropertyDescriptors?Object.defineProperties(D,Object.getOwnPropertyDescriptors(X)):S_(Object(X)).forEach(function(J){Object.defineProperty(D,J,Object.getOwnPropertyDescriptor(X,J))})}return D}function _W0(D,$,X){if($=f_($),$ in D)Object.defineProperty(D,$,{value:X,enumerable:!0,configurable:!0,writable:!0});else D[$]=X;return D}function f_(D){var $=fW0(D,"string");return b5($)=="symbol"?$:$+""}function fW0(D,$){if(b5(D)!="object"||!D)return D;var X=D[Symbol.toPrimitive];if(X!==void 0){var J=X.call(D,$||"default");if(b5(J)!="object")return J;throw TypeError("@@toPrimitive must return a primitive value.")}return($==="string"?String:Number)(D)}var v_=R4.defaultOptions=y5(y5({},PK.default.defaultOptions),{},{httpStack:new u_.default,fileReader:new AW0.default,urlStorage:new EW0.default,fingerprint:RW0.default}),te0=R4.Upload=function(D){function $(){var X=arguments.length>0&&arguments[0]!==void 0?arguments[0]:null,J=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return CW0(this,$),J=y5(y5({},v_),J),SW0(this,$,[X,J])}return xW0($,D),PW0($,null,[{key:"terminate",value:function(J){var Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return Y=y5(y5({},v_),Y),PK.default.terminate(J,Y)}}])}(PK.default),oe0=R4.isSupported=!0});var B1;var T4=r(()=>{B1={name:"@capgo/cli",type:"module",version:"8.4.0",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:"tsgo --project tsconfig.tsgo.json --noEmit",lint:"bun run lint:ox","lint:ox":"oxlint --config ../.oxlintrc.json src","lint:fix":"oxlint --config ../.oxlintrc.json --fix src","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:fail-on-incompatible":"bun test/test-fail-on-incompatible.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:android-service-account-validation":"bun test/test-android-service-account-validation.mjs","test:build-zip-filter":"bun test/test-build-zip-filter.mjs","test:checksum":"bun test/test-checksum-algorithm.mjs","test:build-needed":"bun test/test-build-needed.mjs","test:ci-prompts":"bun test/test-ci-prompts.mjs","test:ci-secrets":"bun test/test-ci-secrets.mjs","test:android-onboarding-progress":"bun test/test-android-onboarding-progress.mjs","test:onboarding-telemetry":"bun test/test-onboarding-telemetry.mjs","test:v2-event-migration":"bun test/test-v2-event-migration.mjs","test:analytics":"bun test/test-analytics.mjs","test:analytics-error-category":"bun test/test-analytics-error-category.mjs","test:analytics-org-resolver":"bun test/test-analytics-org-resolver.mjs","test:supabase-perf":"bun test/test-supabase-perf.mjs","test:preview-qr":"bun test/test-preview-qr.mjs","test:mcp-analytics":"bun test/test-mcp-analytics.mjs","test:app-created-source":"bun test/test-app-created-source.mjs","test:doctor-analytics":"bun test/test-doctor-analytics.mjs","test:posthog-exception":"bun test/test-posthog-exception.mjs","test:onboarding-recovery":"bun test/test-onboarding-recovery.mjs","test:onboarding-progress":"bun test/test-onboarding-progress.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:macos-signing":"bun test/test-macos-signing.mjs","test:helper-dce":"bash scripts/check-helper-dce.sh","test:apple-api-import-helpers":"bun test/test-apple-api-import-helpers.mjs","test:bundle-id-detector":"bun test/test-bundle-id-detector.mjs","test:apple-api-app-list":"bun test/test-apple-api-app-list.mjs","test:apple-api-cert-create":"bun test/test-apple-api-cert-create.mjs","test:app-verification":"bun test/test-app-verification.mjs","test:pbxproj-parser":"bun test/test-pbxproj-parser.mjs","test:manifest-path-encoding":"bun test/test-manifest-path-encoding.mjs","test:self-update":"bun test/test-self-update.mjs","test:update-prompt":"bun test/test-update-prompt.mjs","test:android-tail-engine":"bun test/test-android-tail-engine.mjs","test:android-tail-render":"bun test/test-android-tail-render.mjs","test:android-tail-routing":"bun test/test-android-tail-routing.mjs","test:dev-gate-stripped":"bun test/test-dev-gate-stripped.mjs","test:frame-fit-ios-shared":"bun test/test-frame-fit-ios-shared.mjs","test:ios-confirm-app-id":"bun test/test-ios-confirm-app-id.mjs","test:ios-create-new":"bun test/test-ios-create-new.mjs","test:ios-e2e":"bun test/test-ios-e2e.mjs","test:ios-flow-contract":"bun test/test-ios-flow-contract.mjs","test:ios-import-discovery":"bun test/test-ios-import-discovery.mjs","test:ios-import-export":"bun test/test-ios-import-export.mjs","test:ios-import-pickers":"bun test/test-ios-import-pickers.mjs","test:ios-import-recovery":"bun test/test-ios-import-recovery.mjs","test:ios-recovery":"bun test/test-ios-recovery.mjs","test:ios-resume":"bun test/test-ios-resume.mjs","test:ios-tail-handoff":"bun test/test-ios-tail-handoff.mjs","test:ios-tui-render":"bun test/test-ios-tui-render.mjs","test:p8-error":"bun test/test-p8-error.mjs","test:ios-tui-routing":"bun test/test-ios-tui-routing.mjs","test:ios-updater-sync-validation":"bun test/test-ios-updater-sync-validation.mjs","test:ios-verify-app":"bun test/test-ios-verify-app.mjs","test:platform-flow-contract":"bun test/test-platform-flow-contract.mjs","test:tail-engine-shared":"bun test/test-tail-engine-shared.mjs",test:"bun run build && bun run test:helper-dce && 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:fail-on-incompatible && bun run test:credentials && bun run test:credentials-validation && bun run test:android-service-account-validation && bun run test:build-zip-filter && bun run test:checksum && bun run test:build-needed && bun run test:ci-prompts && bun run test:ci-secrets && bun run test:android-onboarding-progress && bun run test:onboarding-telemetry && bun run test:v2-event-migration && bun run test:analytics && bun run test:analytics-error-category && bun run test:analytics-org-resolver && bun run test:supabase-perf && bun run test:preview-qr && bun run test:mcp-analytics && bun run test:app-created-source && bun run test:doctor-analytics && bun run test:posthog-exception && bun run test:build-platform-selection && bun run test:onboarding-recovery && bun run test:onboarding-progress && 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 && bun run test:manifest-path-encoding && bun run test:macos-signing && bun run test:apple-api-import-helpers && bun run test:bundle-id-detector && bun run test:apple-api-app-list && bun run test:app-verification && bun run test:pbxproj-parser && bun run test:ai-log-capture && bun run test:ai-analyze-flow && bun run test:ai-sse-parser && bun run test:ai-render-markdown && bun run test:ai-stream-markdown && bun run test:ai-onboarding-mode && bun run test:ai-fit && bun run test:platform-layout && bun run test:frame-fit && bun run test:onboarding-min-size && bun run test:min-size-gate && bun run test:shell-size-gate && bun run test:build-log-sanitize && bun run test:build-output-viewport && bun run test:diff-viewer-viewport && bun run test:build-complete-exit && bun run test:ai-analyze-stream && bun run test:support-mailto && bun run test:support-redact && bun run test:support-internal-log && bun run test:support-help-menu && bun run test:support-contact && bun run test:support-bundle-files && bun run test:self-update && bun run test:update-prompt && bun run test:apple-api-cert-create && bun run test:android-tail-engine && bun run test:android-tail-render && bun run test:android-tail-routing && bun run test:dev-gate-stripped && bun run test:frame-fit-ios-shared && bun run test:ios-confirm-app-id && bun run test:ios-create-new && bun run test:ios-e2e && bun run test:ios-flow-contract && bun run test:ios-import-discovery && bun run test:ios-import-export && bun run test:ios-import-pickers && bun run test:ios-import-recovery && bun run test:ios-recovery && bun run test:ios-resume && bun run test:ios-tail-handoff && bun run test:ios-tui-render && bun run test:p8-error && bun run test:ios-tui-routing && bun run test:ios-updater-sync-validation && bun run test:ios-verify-app && bun run test:platform-flow-contract && bun run test:tail-engine-shared","test:build-platform-selection":"bun test/test-build-platform-selection.mjs","test:ai-log-capture":"bun test/test-ai-log-capture.mjs","test:ai-analyze-flow":"bun test/test-ai-analyze-flow.mjs","test:ai-analyze-stream":"bun test/test-ai-analyze-stream.mjs","test:ai-sse-parser":"bun test/test-ai-sse-parser.mjs","test:ai-render-markdown":"bun test/test-ai-render-markdown.mjs","test:ai-onboarding-mode":"bun test/test-ai-onboarding-mode.mjs","test:ai-fit":"bun test/test-ai-fit.mjs","test:platform-layout":"bun test/test-platform-layout.mjs","test:frame-fit":"bun test/run-frame-fit.mjs","test:onboarding-min-size":"bun test/test-onboarding-min-size.mjs","test:min-size-gate":"bun test/test-min-size-gate.mjs","test:shell-size-gate":"bun test/test-shell-size-gate.mjs","test:build-log-sanitize":"bun test/test-build-log-sanitize.mjs","test:build-output-viewport":"bun test/test-build-output-viewport.mjs","test:diff-viewer-viewport":"bun test/test-diff-viewer-viewport.mjs","test:build-complete-exit":"bun test/test-build-complete-exit.mjs","test:ai-stream-markdown":"bun test/test-ai-stream-markdown.mjs","test:support-mailto":"bun test/test-support-mailto.mjs","test:support-redact":"bun test/test-support-redact.mjs","test:support-internal-log":"bun test/test-support-internal-log.mjs","test:support-help-menu":"bun test/test-support-help-menu.mjs","test:support-contact":"bun test/test-support-contact.mjs","test:support-bundle-files":"bun test/test-support-bundle-files.mjs"},dependencies:{"@inkjs/ui":"^2.0.0",ink:"^7.0.4","ink-spinner":"^5.0.0",jsonwebtoken:"^9.0.3","node-forge":"^1.4.0",qrcode:"^1.5.4",react:"^19.2.6","string-width":"^8.2.1"},optionalDependencies:{"@capgo/cli-keychain-darwin-arm64":"^1.0.0","@capgo/cli-keychain-darwin-x64":"^1.0.0"},devDependencies:{"@antfu/eslint-config":"^9.0.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.6","@capacitor/cli":"^8.3.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^1.4.0","@modelcontextprotocol/sdk":"^1.29.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.8","@supabase/supabase-js":"^2.106.2","@tanstack/intent":"^0.0.41","@types/adm-zip":"^0.5.8","@types/jsonwebtoken":"^9.0.10","@types/node":"^25.9.1","@types/node-forge":"^1.3.14","@types/prettyjson":"^0.0.33","@types/qrcode":"^1.5.6","@types/react":"^19.2.15","@types/tmp":"^0.2.6","@types/ws":"^8.18.1","@typescript/native-preview":"7.0.0-dev.20260526.1","@vercel/ncc":"^0.38.4","@xterm/headless":"^6.0.0","adm-zip":"^0.5.17","ci-info":"^4.4.0",commander:"^14.0.3",eslint:"^10.4.0","git-format-staged":"4.0.1",husky:"^9.1.7","is-wsl":"^3.1.1",micromatch:"^4.0.8",open:"^11.0.0",oxlint:"^1.67.0",partysocket:"^1.1.19",prettyjson:"^1.2.5",tmp:"^0.2.6","tus-js-client":"^4.3.1",typescript:"^6.0.3",ws:"^8.21.0",zod:"^4.4.3"}}});async function aF(D){try{let X=`https://registry.npmjs.org/${encodeURIComponent(D.toLowerCase())}`,J=await fetch(X,{headers:{accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"}});if(!J.ok)return null;return(await J.json())["dist-tags"]?.latest||null}catch{return null}}async function yW0(){let D=await aF("@capgo/cli")??"",$=D?.split(".")[0]??"";return{currentVersion:B1.version,latestVersion:D,isOutdated:!!D&&D!==B1.version,majorVersion:$}}async function ND(){let{isOutdated:D,currentVersion:$,latestVersion:X,majorVersion:J}=await yW0();if(D)L.warning(`\uD83D\uDEA8 You are using @capgo/cli@${$} it's not the latest version.
|
|
128
128
|
Please use @capgo/cli@${X}" or @capgo/cli@${J} to keep up to date with the latest features and bug fixes.`)}var x1=r(()=>{g0();T4()});async function g_(D,$,X,J,Y,F="✅"){await I0(X,{channel:D,event:J,icon:F,org_id:$,tracking_version:2,...Y?{tags:{"app-id":Y}}:{},notify:!1})}var h_=r(()=>{g0();i9();x1();_0()});var c_=E((G0D,m_)=>{var g5=1000,h5=g5*60,m5=h5*60,t8=m5*24,bW0=t8*7,gW0=t8*365.25;m_.exports=function(D,$){$=$||{};var X=typeof D;if(X==="string"&&D.length>0)return hW0(D);else if(X==="number"&&isFinite(D))return $.long?cW0(D):mW0(D);throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(D))};function hW0(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 X=parseFloat($[1]),J=($[2]||"ms").toLowerCase();switch(J){case"years":case"year":case"yrs":case"yr":case"y":return X*gW0;case"weeks":case"week":case"w":return X*bW0;case"days":case"day":case"d":return X*t8;case"hours":case"hour":case"hrs":case"hr":case"h":return X*m5;case"minutes":case"minute":case"mins":case"min":case"m":return X*h5;case"seconds":case"second":case"secs":case"sec":case"s":return X*g5;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return X;default:return}}function mW0(D){var $=Math.abs(D);if($>=t8)return Math.round(D/t8)+"d";if($>=m5)return Math.round(D/m5)+"h";if($>=h5)return Math.round(D/h5)+"m";if($>=g5)return Math.round(D/g5)+"s";return D+"ms"}function cW0(D){var $=Math.abs(D);if($>=t8)return sF(D,$,t8,"day");if($>=m5)return sF(D,$,m5,"hour");if($>=h5)return sF(D,$,h5,"minute");if($>=g5)return sF(D,$,g5,"second");return D+" ms"}function sF(D,$,X,J){var Y=$>=X*1.5;return Math.round(D/X)+" "+J+(Y?"s":"")}});var vK=E((O0D,d_)=>{function dW0(D){X.debug=X,X.default=X,X.coerce=Z,X.disable=Q,X.enable=Y,X.enabled=U,X.humanize=c_(),X.destroy=G,Object.keys(D).forEach((O)=>{X[O]=D[O]}),X.names=[],X.skips=[],X.formatters={};function $(O){let q=0;for(let w=0;w<O.length;w++)q=(q<<5)-q+O.charCodeAt(w),q|=0;return X.colors[Math.abs(q)%X.colors.length]}X.selectColor=$;function X(O){let q,w=null,K,W;function H(...B){if(!H.enabled)return;let M=H,I=Number(new Date),z=I-(q||I);if(M.diff=z,M.prev=q,M.curr=I,q=I,B[0]=X.coerce(B[0]),typeof B[0]!=="string")B.unshift("%O");let N=0;B[0]=B[0].replace(/%([a-zA-Z%])/g,(A,u)=>{if(A==="%%")return"%";N++;let _=X.formatters[u];if(typeof _==="function"){let j=B[N];A=_.call(M,j),B.splice(N,1),N--}return A}),X.formatArgs.call(M,B),(M.log||X.log).apply(M,B)}if(H.namespace=O,H.useColors=X.useColors(),H.color=X.selectColor(O),H.extend=J,H.destroy=X.destroy,Object.defineProperty(H,"enabled",{enumerable:!0,configurable:!1,get:()=>{if(w!==null)return w;if(K!==X.namespaces)K=X.namespaces,W=X.enabled(O);return W},set:(B)=>{w=B}}),typeof X.init==="function")X.init(H);return H}function J(O,q){let w=X(this.namespace+(typeof q>"u"?":":q)+O);return w.log=this.log,w}function Y(O){X.save(O),X.namespaces=O,X.names=[],X.skips=[];let q=(typeof O==="string"?O:"").trim().replace(/\s+/g,",").split(",").filter(Boolean);for(let w of q)if(w[0]==="-")X.skips.push(w.slice(1));else X.names.push(w)}function F(O,q){let w=0,K=0,W=-1,H=0;while(w<O.length)if(K<q.length&&(q[K]===O[w]||q[K]==="*"))if(q[K]==="*")W=K,H=w,K++;else w++,K++;else if(W!==-1)K=W+1,H++,w=H;else return!1;while(K<q.length&&q[K]==="*")K++;return K===q.length}function Q(){let O=[...X.names,...X.skips.map((q)=>"-"+q)].join(",");return X.enable(""),O}function U(O){for(let q of X.skips)if(F(O,q))return!1;for(let q of X.names)if(F(O,q))return!0;return!1}function Z(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 X.enable(X.load()),X}d_.exports=dW0});var l_=E((n_,eF)=>{n_.formatArgs=lW0;n_.save=iW0;n_.load=pW0;n_.useColors=nW0;n_.storage=rW0();n_.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`.")}})();n_.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 nW0(){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 lW0(D){if(D[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+D[0]+(this.useColors?"%c ":" ")+"+"+eF.exports.humanize(this.diff),!this.useColors)return;let $="color: "+this.color;D.splice(1,0,$,"color: inherit");let X=0,J=0;D[0].replace(/%[a-zA-Z%]/g,(Y)=>{if(Y==="%%")return;if(X++,Y==="%c")J=X}),D.splice(J,0,$)}n_.log=console.debug||console.log||(()=>{});function iW0(D){try{if(D)n_.storage.setItem("debug",D);else n_.storage.removeItem("debug")}catch($){}}function pW0(){let D;try{D=n_.storage.getItem("debug")||n_.storage.getItem("DEBUG")}catch($){}if(!D&&typeof process<"u"&&"env"in process)D=process.env.DEBUG;return D}function rW0(){try{return localStorage}catch(D){}}eF.exports=vK()(n_);var{formatters:tW0}=eF.exports;tW0.j=function(D){try{return JSON.stringify(D)}catch($){return"[UnexpectedJSONParseError]: "+$.message}}});var p_=E((w0D,i_)=>{i_.exports=(D,$=process.argv)=>{let X=D.startsWith("-")?"":D.length===1?"-":"--",J=$.indexOf(X+D),Y=$.indexOf("--");return J!==-1&&(Y===-1||J<Y)}});var o_=E((K0D,t_)=>{var JH0=l("os"),r_=l("tty"),A$=p_(),{env:X1}=process,C4;if(A$("no-color")||A$("no-colors")||A$("color=false")||A$("color=never"))C4=0;else if(A$("color")||A$("colors")||A$("color=true")||A$("color=always"))C4=1;if("FORCE_COLOR"in X1)if(X1.FORCE_COLOR==="true")C4=1;else if(X1.FORCE_COLOR==="false")C4=0;else C4=X1.FORCE_COLOR.length===0?1:Math.min(parseInt(X1.FORCE_COLOR,10),3);function uK(D){if(D===0)return!1;return{level:D,hasBasic:!0,has256:D>=2,has16m:D>=3}}function xK(D,$){if(C4===0)return 0;if(A$("color=16m")||A$("color=full")||A$("color=truecolor"))return 3;if(A$("color=256"))return 2;if(D&&!$&&C4===void 0)return 0;let X=C4||0;if(X1.TERM==="dumb")return X;if(process.platform==="win32"){let J=JH0.release().split(".");if(Number(J[0])>=10&&Number(J[2])>=10586)return Number(J[2])>=14931?3:2;return 1}if("CI"in X1){if(["TRAVIS","CIRCLECI","APPVEYOR","GITLAB_CI","GITHUB_ACTIONS","BUILDKITE"].some((J)=>(J in X1))||X1.CI_NAME==="codeship")return 1;return X}if("TEAMCITY_VERSION"in X1)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(X1.TEAMCITY_VERSION)?1:0;if(X1.COLORTERM==="truecolor")return 3;if("TERM_PROGRAM"in X1){let J=parseInt((X1.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(X1.TERM_PROGRAM){case"iTerm.app":return J>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(X1.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(X1.TERM))return 1;if("COLORTERM"in X1)return 1;return X}function YH0(D){let $=xK(D,D&&D.isTTY);return uK($)}t_.exports={supportsColor:YH0,stdout:uK(xK(!0,r_.isatty(1))),stderr:uK(xK(!0,r_.isatty(2)))}});var Df=E((s_,$Q)=>{var FH0=l("tty"),DQ=l("util");s_.init=wH0;s_.log=GH0;s_.formatArgs=UH0;s_.save=OH0;s_.load=qH0;s_.useColors=QH0;s_.destroy=DQ.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");s_.colors=[6,2,3,4,5,1];try{let D=o_();if(D&&(D.stderr||D).level>=2)s_.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){}s_.inspectOpts=Object.keys(process.env).filter((D)=>{return/^debug_/i.test(D)}).reduce((D,$)=>{let X=$.substring(6).toLowerCase().replace(/_([a-z])/g,(Y,F)=>{return F.toUpperCase()}),J=process.env[$];if(/^(yes|on|true|enabled)$/i.test(J))J=!0;else if(/^(no|off|false|disabled)$/i.test(J))J=!1;else if(J==="null")J=null;else J=Number(J);return D[X]=J,D},{});function QH0(){return"colors"in s_.inspectOpts?Boolean(s_.inspectOpts.colors):FH0.isatty(process.stderr.fd)}function UH0(D){let{namespace:$,useColors:X}=this;if(X){let J=this.color,Y="\x1B[3"+(J<8?J:"8;5;"+J),F=` ${Y};1m${$} \x1B[0m`;D[0]=F+D[0].split(`
|
|
129
129
|
`).join(`
|
|
130
130
|
`+F),D.push(Y+"m+"+$Q.exports.humanize(this.diff)+"\x1B[0m")}else D[0]=ZH0()+$+" "+D[0]}function ZH0(){if(s_.inspectOpts.hideDate)return"";return new Date().toISOString()+" "}function GH0(...D){return process.stderr.write(DQ.formatWithOptions(s_.inspectOpts,...D)+`
|
|
@@ -435,23 +435,23 @@ Minimum version required to store current data is: `+F+`.
|
|
|
435
435
|
`}if(U+=Z+`
|
|
436
436
|
`,typeof X==="function")X(null,U);return U}});var S40=E((gc0)=>{var kc0="\x1B[47m\x1B[30m",yc0="\x1B[40m\x1B[37m",bc0=function(D,$,X){return{"00":"\x1B[0m "+D,"01":"\x1B[0m"+$+"▄"+D,"02":"\x1B[0m"+X+"▄"+D,10:"\x1B[0m"+$+"▀"+D,11:" ",12:"▄",20:"\x1B[0m"+X+"▀"+D,21:"▀",22:"█"}},C40=function(D,$,X,J){let Y=$+1;if(X>=Y||J>=Y||J<-1||X<-1)return"0";if(X>=$||J>=$||J<0||X<0)return"1";let F=J*$+X;return D[F]?"2":"1"},P40=function(D,$,X,J){return C40(D,$,X,J)+C40(D,$,X,J+1)};gc0.render=function(D,$,X){let J=D.modules.size,Y=D.modules.data,F=!!($&&$.inverse),Q=$&&$.inverse?yc0:kc0,G=bc0(Q,F?"\x1B[30m":"\x1B[37m",F?"\x1B[37m":"\x1B[30m"),O=`\x1B[0m
|
|
437
437
|
`+Q,q=Q;for(let w=-1;w<J+1;w+=2){for(let K=-1;K<J;K++)q+=G[P40(Y,J,K,w)];q+=G[P40(Y,J,J,w)]+O}if(q+="\x1B[0m",typeof X==="function")X(null,q);return q}});var v40=E((dc0)=>{var mc0=T40(),cc0=S40();dc0.render=function(D,$,X){if($&&$.small)return cc0.render(D,$,X);return mc0.render(D,$,X)}});var LE=E((pc0)=>{var lc0=tJ();function u40(D,$){let X=D.a/255,J=$+'="'+D.hex+'"';return X<1?J+" "+$+'-opacity="'+X.toFixed(2).slice(1)+'"':J}function VE(D,$,X){let J=D+$;if(typeof X<"u")J+=" "+X;return J}function ic0(D,$,X){let J="",Y=0,F=!1,Q=0;for(let U=0;U<D.length;U++){let Z=Math.floor(U%$),G=Math.floor(U/$);if(!Z&&!F)F=!0;if(D[U]){if(Q++,!(U>0&&Z>0&&D[U-1]))J+=F?VE("M",Z+X,0.5+G+X):VE("m",Y,0),Y=0,F=!1;if(!(Z+1<$&&D[U+1]))J+=VE("h",Q),Q=0}else Y++}return J}pc0.render=function($,X,J){let Y=lc0.getOptions(X),F=$.modules.size,Q=$.modules.data,U=F+Y.margin*2,Z=!Y.color.light.a?"":"<path "+u40(Y.color.light,"fill")+' d="M0 0h'+U+"v"+U+'H0z"/>',G="<path "+u40(Y.color.dark,"stroke")+' d="'+ic0(Q,F,Y.margin)+'"/>',O='viewBox="0 0 '+U+" "+U+'"',w='<svg xmlns="http://www.w3.org/2000/svg" '+(!Y.width?"":'width="'+Y.width+'" height="'+Y.width+'" ')+O+' shape-rendering="crispEdges">'+Z+G+`</svg>
|
|
438
|
-
`;if(typeof J==="function")J(null,w);return w}});var _40=E((oc0)=>{var tc0=LE();oc0.render=tc0.render;oc0.renderToFile=function($,X,J,Y){if(typeof Y>"u")Y=J,J=void 0;let F=l("fs"),U='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+oc0.render(X,J);F.writeFile($,U,Y)}});var k40=E((Dd0)=>{var BE=tJ();function sc0(D,$,X){if(D.clearRect(0,0,$.width,$.height),!$.style)$.style={};$.height=X,$.width=X,$.style.height=X+"px",$.style.width=X+"px"}function ec0(){try{return document.createElement("canvas")}catch(D){throw Error("You need to specify a canvas element")}}Dd0.render=function($,X,J){let Y=J,F=X;if(typeof Y>"u"&&(!X||!X.getContext))Y=X,X=void 0;if(!X)F=ec0();Y=BE.getOptions(Y);let Q=BE.getImageWidth($.modules.size,Y),U=F.getContext("2d"),Z=U.createImageData(Q,Q);return BE.qrToImageData(Z.data,$,Y),sc0(U,F,Q),U.putImageData(Z,0,0),F};Dd0.renderToDataURL=function($,X,J){let Y=J;if(typeof Y>"u"&&(!X||!X.getContext))Y=X,X=void 0;if(!Y)Y={};let F=Dd0.render($,X,Y),Q=Y.type||"image/png",U=Y.rendererOpts||{};return F.toDataURL(Q,U.quality)}});var b40=E((Yd0)=>{var Xd0=vj(),ME=$E(),y40=k40(),Jd0=LE();function IE(D,$,X,J,Y){let F=[].slice.call(arguments,1),Q=F.length,U=typeof F[Q-1]==="function";if(!U&&!Xd0())throw Error("Callback required as last argument");if(U){if(Q<2)throw Error("Too few arguments provided");if(Q===2)Y=X,X=$,$=J=void 0;else if(Q===3)if($.getContext&&typeof Y>"u")Y=J,J=void 0;else Y=J,J=X,X=$,$=void 0}else{if(Q<1)throw Error("Too few arguments provided");if(Q===1)X=$,$=J=void 0;else if(Q===2&&!$.getContext)J=X,X=$,$=void 0;return new Promise(function(Z,G){try{let O=ME.create(X,J);Z(D(O,$,J))}catch(O){G(O)}})}try{let Z=ME.create(X,J);Y(null,D(Z,$,J))}catch(Z){Y(Z)}}Yd0.create=ME.create;Yd0.toCanvas=IE.bind(null,y40.render);Yd0.toDataURL=IE.bind(null,y40.renderToDataURL);Yd0.toString=IE.bind(null,function(D,$,X){return Jd0.render(D,X)})});var TO=E((Kd0)=>{var g40=vj(),jE=$E(),Gd0=E40(),h40=R40(),Od0=v40(),m40=_40();function oJ(D,$,X){if(typeof D>"u")throw Error("String required as first argument");if(typeof X>"u")X=$,$={};if(typeof X!=="function")if(!g40())throw Error("Callback required as last argument");else $=X||{},X=null;return{opts:$,cb:X}}function qd0(D){return D.slice((D.lastIndexOf(".")-1>>>0)+2).toLowerCase()}function RO(D){switch(D){case"svg":return m40;case"txt":case"utf8":return h40;case"png":case"image/png":default:return Gd0}}function wd0(D){switch(D){case"svg":return m40;case"terminal":return Od0;case"utf8":default:return h40}}function aJ(D,$,X){if(!X.cb)return new Promise(function(J,Y){try{let F=jE.create($,X.opts);return D(F,X.opts,function(Q,U){return Q?Y(Q):J(U)})}catch(F){Y(F)}});try{let J=jE.create($,X.opts);return D(J,X.opts,X.cb)}catch(J){X.cb(J)}}Kd0.create=jE.create;Kd0.toCanvas=b40().toCanvas;Kd0.toString=function($,X,J){let Y=oJ($,X,J),F=Y.opts?Y.opts.type:void 0,Q=wd0(F);return aJ(Q.render,$,Y)};Kd0.toDataURL=function($,X,J){let Y=oJ($,X,J),F=RO(Y.opts.type);return aJ(F.renderToDataURL,$,Y)};Kd0.toBuffer=function($,X,J){let Y=oJ($,X,J),F=RO(Y.opts.type);return aJ(F.renderToBuffer,$,Y)};Kd0.toFile=function($,X,J,Y){if(typeof $!=="string"||!(typeof X==="string"||typeof X==="object"))throw Error("Invalid argument");if(arguments.length<3&&!g40())throw Error("Too few arguments provided");let F=oJ(X,J,Y),Q=F.opts.type||qd0($),Z=RO(Q).renderToFile.bind(null,$);return aJ(Z,X,F)};Kd0.toFileStream=function($,X,J){if(arguments.length<2)throw Error("Too few arguments provided");let Y=oJ(X,J,$.emit.bind($,"error")),Q=RO("png").renderToFileStream.bind(null,$);aJ(Q,X,Y)}});function Rd0(D){let $=`${D??""}`.trim();if(!$)return"";if($.includes("\\"))$=$.split("\\").join("/");while($.includes("//"))$=$.replace("//","/");while($.startsWith("./"))$=$.slice(2);while($.endsWith("/"))$=$.slice(0,-1);if($===".")return"";return $}function sJ(D,$){let X=D?.[$]?.path;if(typeof X==="string"&&X.trim()){let J=Rd0(X);if(J)return J}return $}var dO=E((Vl0)=>{Vl0.isInteger=(D)=>{if(typeof D==="number")return Number.isInteger(D);if(typeof D==="string"&&D.trim()!=="")return Number.isInteger(Number(D));return!1};Vl0.find=(D,$)=>D.nodes.find((X)=>X.type===$);Vl0.exceedsLimit=(D,$,X=1,J)=>{if(J===!1)return!1;if(!Vl0.isInteger(D)||!Vl0.isInteger($))return!1;return(Number($)-Number(D))/Number(X)>=J};Vl0.escapeNode=(D,$=0,X)=>{let J=D.nodes[$];if(!J)return;if(X&&J.type===X||J.type==="open"||J.type==="close"){if(J.escaped!==!0)J.value="\\"+J.value,J.escaped=!0}};Vl0.encloseBrace=(D)=>{if(D.type!=="brace")return!1;if(D.commas>>0+D.ranges>>0===0)return D.invalid=!0,!0;return!1};Vl0.isInvalidBrace=(D)=>{if(D.type!=="brace")return!1;if(D.invalid===!0||D.dollar)return!0;if(D.commas>>0+D.ranges>>0===0)return D.invalid=!0,!0;if(D.open!==!0||D.close!==!0)return D.invalid=!0,!0;return!1};Vl0.isOpenOrClose=(D)=>{if(D.type==="open"||D.type==="close")return!0;return D.open===!0||D.close===!0};Vl0.reduce=(D)=>D.reduce(($,X)=>{if(X.type==="text")$.push(X.value);if(X.type==="range")X.type="text";return $},[]);Vl0.flatten=(...D)=>{let $=[],X=(J)=>{for(let Y=0;Y<J.length;Y++){let F=J[Y];if(Array.isArray(F)){X(F);continue}if(F!==void 0)$.push(F)}return $};return X(D),$}});var nO=E((
|
|
438
|
+
`;if(typeof J==="function")J(null,w);return w}});var _40=E((oc0)=>{var tc0=LE();oc0.render=tc0.render;oc0.renderToFile=function($,X,J,Y){if(typeof Y>"u")Y=J,J=void 0;let F=l("fs"),U='<?xml version="1.0" encoding="utf-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">'+oc0.render(X,J);F.writeFile($,U,Y)}});var k40=E((Dd0)=>{var BE=tJ();function sc0(D,$,X){if(D.clearRect(0,0,$.width,$.height),!$.style)$.style={};$.height=X,$.width=X,$.style.height=X+"px",$.style.width=X+"px"}function ec0(){try{return document.createElement("canvas")}catch(D){throw Error("You need to specify a canvas element")}}Dd0.render=function($,X,J){let Y=J,F=X;if(typeof Y>"u"&&(!X||!X.getContext))Y=X,X=void 0;if(!X)F=ec0();Y=BE.getOptions(Y);let Q=BE.getImageWidth($.modules.size,Y),U=F.getContext("2d"),Z=U.createImageData(Q,Q);return BE.qrToImageData(Z.data,$,Y),sc0(U,F,Q),U.putImageData(Z,0,0),F};Dd0.renderToDataURL=function($,X,J){let Y=J;if(typeof Y>"u"&&(!X||!X.getContext))Y=X,X=void 0;if(!Y)Y={};let F=Dd0.render($,X,Y),Q=Y.type||"image/png",U=Y.rendererOpts||{};return F.toDataURL(Q,U.quality)}});var b40=E((Yd0)=>{var Xd0=vj(),ME=$E(),y40=k40(),Jd0=LE();function IE(D,$,X,J,Y){let F=[].slice.call(arguments,1),Q=F.length,U=typeof F[Q-1]==="function";if(!U&&!Xd0())throw Error("Callback required as last argument");if(U){if(Q<2)throw Error("Too few arguments provided");if(Q===2)Y=X,X=$,$=J=void 0;else if(Q===3)if($.getContext&&typeof Y>"u")Y=J,J=void 0;else Y=J,J=X,X=$,$=void 0}else{if(Q<1)throw Error("Too few arguments provided");if(Q===1)X=$,$=J=void 0;else if(Q===2&&!$.getContext)J=X,X=$,$=void 0;return new Promise(function(Z,G){try{let O=ME.create(X,J);Z(D(O,$,J))}catch(O){G(O)}})}try{let Z=ME.create(X,J);Y(null,D(Z,$,J))}catch(Z){Y(Z)}}Yd0.create=ME.create;Yd0.toCanvas=IE.bind(null,y40.render);Yd0.toDataURL=IE.bind(null,y40.renderToDataURL);Yd0.toString=IE.bind(null,function(D,$,X){return Jd0.render(D,X)})});var TO=E((Kd0)=>{var g40=vj(),jE=$E(),Gd0=E40(),h40=R40(),Od0=v40(),m40=_40();function oJ(D,$,X){if(typeof D>"u")throw Error("String required as first argument");if(typeof X>"u")X=$,$={};if(typeof X!=="function")if(!g40())throw Error("Callback required as last argument");else $=X||{},X=null;return{opts:$,cb:X}}function qd0(D){return D.slice((D.lastIndexOf(".")-1>>>0)+2).toLowerCase()}function RO(D){switch(D){case"svg":return m40;case"txt":case"utf8":return h40;case"png":case"image/png":default:return Gd0}}function wd0(D){switch(D){case"svg":return m40;case"terminal":return Od0;case"utf8":default:return h40}}function aJ(D,$,X){if(!X.cb)return new Promise(function(J,Y){try{let F=jE.create($,X.opts);return D(F,X.opts,function(Q,U){return Q?Y(Q):J(U)})}catch(F){Y(F)}});try{let J=jE.create($,X.opts);return D(J,X.opts,X.cb)}catch(J){X.cb(J)}}Kd0.create=jE.create;Kd0.toCanvas=b40().toCanvas;Kd0.toString=function($,X,J){let Y=oJ($,X,J),F=Y.opts?Y.opts.type:void 0,Q=wd0(F);return aJ(Q.render,$,Y)};Kd0.toDataURL=function($,X,J){let Y=oJ($,X,J),F=RO(Y.opts.type);return aJ(F.renderToDataURL,$,Y)};Kd0.toBuffer=function($,X,J){let Y=oJ($,X,J),F=RO(Y.opts.type);return aJ(F.renderToBuffer,$,Y)};Kd0.toFile=function($,X,J,Y){if(typeof $!=="string"||!(typeof X==="string"||typeof X==="object"))throw Error("Invalid argument");if(arguments.length<3&&!g40())throw Error("Too few arguments provided");let F=oJ(X,J,Y),Q=F.opts.type||qd0($),Z=RO(Q).renderToFile.bind(null,$);return aJ(Z,X,F)};Kd0.toFileStream=function($,X,J){if(arguments.length<2)throw Error("Too few arguments provided");let Y=oJ(X,J,$.emit.bind($,"error")),Q=RO("png").renderToFileStream.bind(null,$);aJ(Q,X,Y)}});function Rd0(D){let $=`${D??""}`.trim();if(!$)return"";if($.includes("\\"))$=$.split("\\").join("/");while($.includes("//"))$=$.replace("//","/");while($.startsWith("./"))$=$.slice(2);while($.endsWith("/"))$=$.slice(0,-1);if($===".")return"";return $}function sJ(D,$){let X=D?.[$]?.path;if(typeof X==="string"&&X.trim()){let J=Rd0(X);if(J)return J}return $}var dO=E((Vl0)=>{Vl0.isInteger=(D)=>{if(typeof D==="number")return Number.isInteger(D);if(typeof D==="string"&&D.trim()!=="")return Number.isInteger(Number(D));return!1};Vl0.find=(D,$)=>D.nodes.find((X)=>X.type===$);Vl0.exceedsLimit=(D,$,X=1,J)=>{if(J===!1)return!1;if(!Vl0.isInteger(D)||!Vl0.isInteger($))return!1;return(Number($)-Number(D))/Number(X)>=J};Vl0.escapeNode=(D,$=0,X)=>{let J=D.nodes[$];if(!J)return;if(X&&J.type===X||J.type==="open"||J.type==="close"){if(J.escaped!==!0)J.value="\\"+J.value,J.escaped=!0}};Vl0.encloseBrace=(D)=>{if(D.type!=="brace")return!1;if(D.commas>>0+D.ranges>>0===0)return D.invalid=!0,!0;return!1};Vl0.isInvalidBrace=(D)=>{if(D.type!=="brace")return!1;if(D.invalid===!0||D.dollar)return!0;if(D.commas>>0+D.ranges>>0===0)return D.invalid=!0,!0;if(D.open!==!0||D.close!==!0)return D.invalid=!0,!0;return!1};Vl0.isOpenOrClose=(D)=>{if(D.type==="open"||D.type==="close")return!0;return D.open===!0||D.close===!0};Vl0.reduce=(D)=>D.reduce(($,X)=>{if(X.type==="text")$.push(X.value);if(X.type==="range")X.type="text";return $},[]);Vl0.flatten=(...D)=>{let $=[],X=(J)=>{for(let Y=0;Y<J.length;Y++){let F=J[Y];if(Array.isArray(F)){X(F);continue}if(F!==void 0)$.push(F)}return $};return X(D),$}});var nO=E((jQD,s80)=>{var a80=dO();s80.exports=(D,$={})=>{let X=(J,Y={})=>{let F=$.escapeInvalid&&a80.isInvalidBrace(Y),Q=J.invalid===!0&&$.escapeInvalid===!0,U="";if(J.value){if((F||Q)&&a80.isOpenOrClose(J))return"\\"+J.value;return J.value}if(J.value)return J.value;if(J.nodes)for(let Z of J.nodes)U+=X(Z);return U};return X(D)}});var D90=E((EQD,e80)=>{/*!
|
|
439
439
|
* is-number <https://github.com/jonschlinkert/is-number>
|
|
440
440
|
*
|
|
441
441
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
442
442
|
* Released under the MIT License.
|
|
443
|
-
*/e80.exports=function(D){if(typeof D==="number")return D-D===0;if(typeof D==="string"&&D.trim()!=="")return Number.isFinite?Number.isFinite(+D):isFinite(+D);return!1}});var G90=E((
|
|
443
|
+
*/e80.exports=function(D){if(typeof D==="number")return D-D===0;if(typeof D==="string"&&D.trim()!=="")return Number.isFinite?Number.isFinite(+D):isFinite(+D);return!1}});var G90=E((AQD,Z90)=>{/*!
|
|
444
444
|
* to-regex-range <https://github.com/micromatch/to-regex-range>
|
|
445
445
|
*
|
|
446
446
|
* Copyright (c) 2015-present, Jon Schlinkert.
|
|
447
447
|
* Released under the MIT License.
|
|
448
|
-
*/var $90=D90(),c9=(D,$,X)=>{if($90(D)===!1)throw TypeError("toRegexRange: expected the first argument to be a number");if($===void 0||D===$)return String(D);if($90($)===!1)throw TypeError("toRegexRange: expected the second argument to be a number.");let J={relaxZeros:!0,...X};if(typeof J.strictZeros==="boolean")J.relaxZeros=J.strictZeros===!1;let Y=String(J.relaxZeros),F=String(J.shorthand),Q=String(J.capture),U=String(J.wrap),Z=D+":"+$+"="+Y+F+Q+U;if(c9.cache.hasOwnProperty(Z))return c9.cache[Z].result;let G=Math.min(D,$),O=Math.max(D,$);if(Math.abs(G-O)===1){let H=D+"|"+$;if(J.capture)return`(${H})`;if(J.wrap===!1)return H;return`(?:${H})`}let q=U90(D)||U90($),w={min:D,max:$,a:G,b:O},K=[],W=[];if(q)w.isPadded=q,w.maxLen=String(w.max).length;if(G<0){let H=O<0?Math.abs(O):1;W=X90(H,Math.abs(G),w,J),G=w.a=0}if(O>=0)K=X90(G,O,w,J);if(w.negatives=W,w.positives=K,w.result=Tl0(W,K,J),J.capture===!0)w.result=`(${w.result})`;else if(J.wrap!==!1&&K.length+W.length>1)w.result=`(?:${w.result})`;return c9.cache[Z]=w,w.result};function Tl0(D,$,X){let J=aE(D,$,"-",!1,X)||[],Y=aE($,D,"",!1,X)||[],F=aE(D,$,"-?",!0,X)||[];return J.concat(F).concat(Y).join("|")}function Cl0(D,$){let X=1,J=1,Y=Y90(D,X),F=new Set([$]);while(D<=Y&&Y<=$)F.add(Y),X+=1,Y=Y90(D,X);Y=F90($+1,J)-1;while(D<Y&&Y<=$)F.add(Y),J+=1,Y=F90($+1,J)-1;return F=[...F],F.sort(vl0),F}function Pl0(D,$,X){if(D===$)return{pattern:D,count:[],digits:0};let J=Sl0(D,$),Y=J.length,F="",Q=0;for(let U=0;U<Y;U++){let[Z,G]=J[U];if(Z===G)F+=Z;else if(Z!=="0"||G!=="9")F+=ul0(Z,G,X);else Q++}if(Q)F+=X.shorthand===!0?"\\d":"[0-9]";return{pattern:F,count:[Q],digits:Y}}function X90(D,$,X,J){let Y=Cl0(D,$),F=[],Q=D,U;for(let Z=0;Z<Y.length;Z++){let G=Y[Z],O=Pl0(String(Q),String(G),J),q="";if(!X.isPadded&&U&&U.pattern===O.pattern){if(U.count.length>1)U.count.pop();U.count.push(O.count[0]),U.string=U.pattern+Q90(U.count),Q=G+1;continue}if(X.isPadded)q=xl0(G,X,J);O.string=q+O.pattern+Q90(O.count),F.push(O),Q=G+1,U=O}return F}function aE(D,$,X,J,Y){let F=[];for(let Q of D){let{string:U}=Q;if(!J&&!J90($,"string",U))F.push(X+U);if(J&&J90($,"string",U))F.push(X+U)}return F}function Sl0(D,$){let X=[];for(let J=0;J<D.length;J++)X.push([D[J],$[J]]);return X}function vl0(D,$){return D>$?1:$>D?-1:0}function J90(D,$,X){return D.some((J)=>J[$]===X)}function Y90(D,$){return Number(String(D).slice(0,-$)+"9".repeat($))}function F90(D,$){return D-D%Math.pow(10,$)}function Q90(D){let[$=0,X=""]=D;if(X||$>1)return`{${$+(X?","+X:"")}}`;return""}function ul0(D,$,X){return`[${D}${$-D===1?"":"-"}${$}]`}function U90(D){return/^-?(0+)\d/.test(D)}function xl0(D,$,X){if(!$.isPadded)return D;let J=Math.abs($.maxLen-String(D).length),Y=X.relaxZeros!==!1;switch(J){case 0:return"";case 1:return Y?"0?":"0";case 2:return Y?"0{0,2}":"00";default:return Y?`0{0,${J}}`:`0{${J}}`}}c9.cache={};c9.clearCache=()=>c9.cache={};Z90.exports=c9});var DA=E((
|
|
448
|
+
*/var $90=D90(),c9=(D,$,X)=>{if($90(D)===!1)throw TypeError("toRegexRange: expected the first argument to be a number");if($===void 0||D===$)return String(D);if($90($)===!1)throw TypeError("toRegexRange: expected the second argument to be a number.");let J={relaxZeros:!0,...X};if(typeof J.strictZeros==="boolean")J.relaxZeros=J.strictZeros===!1;let Y=String(J.relaxZeros),F=String(J.shorthand),Q=String(J.capture),U=String(J.wrap),Z=D+":"+$+"="+Y+F+Q+U;if(c9.cache.hasOwnProperty(Z))return c9.cache[Z].result;let G=Math.min(D,$),O=Math.max(D,$);if(Math.abs(G-O)===1){let H=D+"|"+$;if(J.capture)return`(${H})`;if(J.wrap===!1)return H;return`(?:${H})`}let q=U90(D)||U90($),w={min:D,max:$,a:G,b:O},K=[],W=[];if(q)w.isPadded=q,w.maxLen=String(w.max).length;if(G<0){let H=O<0?Math.abs(O):1;W=X90(H,Math.abs(G),w,J),G=w.a=0}if(O>=0)K=X90(G,O,w,J);if(w.negatives=W,w.positives=K,w.result=Tl0(W,K,J),J.capture===!0)w.result=`(${w.result})`;else if(J.wrap!==!1&&K.length+W.length>1)w.result=`(?:${w.result})`;return c9.cache[Z]=w,w.result};function Tl0(D,$,X){let J=aE(D,$,"-",!1,X)||[],Y=aE($,D,"",!1,X)||[],F=aE(D,$,"-?",!0,X)||[];return J.concat(F).concat(Y).join("|")}function Cl0(D,$){let X=1,J=1,Y=Y90(D,X),F=new Set([$]);while(D<=Y&&Y<=$)F.add(Y),X+=1,Y=Y90(D,X);Y=F90($+1,J)-1;while(D<Y&&Y<=$)F.add(Y),J+=1,Y=F90($+1,J)-1;return F=[...F],F.sort(vl0),F}function Pl0(D,$,X){if(D===$)return{pattern:D,count:[],digits:0};let J=Sl0(D,$),Y=J.length,F="",Q=0;for(let U=0;U<Y;U++){let[Z,G]=J[U];if(Z===G)F+=Z;else if(Z!=="0"||G!=="9")F+=ul0(Z,G,X);else Q++}if(Q)F+=X.shorthand===!0?"\\d":"[0-9]";return{pattern:F,count:[Q],digits:Y}}function X90(D,$,X,J){let Y=Cl0(D,$),F=[],Q=D,U;for(let Z=0;Z<Y.length;Z++){let G=Y[Z],O=Pl0(String(Q),String(G),J),q="";if(!X.isPadded&&U&&U.pattern===O.pattern){if(U.count.length>1)U.count.pop();U.count.push(O.count[0]),U.string=U.pattern+Q90(U.count),Q=G+1;continue}if(X.isPadded)q=xl0(G,X,J);O.string=q+O.pattern+Q90(O.count),F.push(O),Q=G+1,U=O}return F}function aE(D,$,X,J,Y){let F=[];for(let Q of D){let{string:U}=Q;if(!J&&!J90($,"string",U))F.push(X+U);if(J&&J90($,"string",U))F.push(X+U)}return F}function Sl0(D,$){let X=[];for(let J=0;J<D.length;J++)X.push([D[J],$[J]]);return X}function vl0(D,$){return D>$?1:$>D?-1:0}function J90(D,$,X){return D.some((J)=>J[$]===X)}function Y90(D,$){return Number(String(D).slice(0,-$)+"9".repeat($))}function F90(D,$){return D-D%Math.pow(10,$)}function Q90(D){let[$=0,X=""]=D;if(X||$>1)return`{${$+(X?","+X:"")}}`;return""}function ul0(D,$,X){return`[${D}${$-D===1?"":"-"}${$}]`}function U90(D){return/^-?(0+)\d/.test(D)}function xl0(D,$,X){if(!$.isPadded)return D;let J=Math.abs($.maxLen-String(D).length),Y=X.relaxZeros!==!1;switch(J){case 0:return"";case 1:return Y?"0?":"0";case 2:return Y?"0{0,2}":"00";default:return Y?`0{0,${J}}`:`0{${J}}`}}c9.cache={};c9.clearCache=()=>c9.cache={};Z90.exports=c9});var DA=E((RQD,z90)=>{/*!
|
|
449
449
|
* fill-range <https://github.com/jonschlinkert/fill-range>
|
|
450
450
|
*
|
|
451
451
|
* Copyright (c) 2014-present, Jon Schlinkert.
|
|
452
452
|
* Licensed under the MIT License.
|
|
453
|
-
*/var _l0=l("util"),q90=G90(),O90=(D)=>D!==null&&typeof D==="object"&&!Array.isArray(D),fl0=(D)=>{return($)=>D===!0?Number($):String($)},sE=(D)=>{return typeof D==="number"||typeof D==="string"&&D!==""},QY=(D)=>Number.isInteger(+D),eE=(D)=>{let $=`${D}`,X=-1;if($[0]==="-")$=$.slice(1);if($==="0")return!1;while($[++X]==="0");return X>0},kl0=(D,$,X)=>{if(typeof D==="string"||typeof $==="string")return!0;return X.stringify===!0},yl0=(D,$,X)=>{if($>0){let J=D[0]==="-"?"-":"";if(J)D=D.slice(1);D=J+D.padStart(J?$-1:$,"0")}if(X===!1)return String(D);return D},iO=(D,$)=>{let X=D[0]==="-"?"-":"";if(X)D=D.slice(1),$--;while(D.length<$)D="0"+D;return X?"-"+D:D},bl0=(D,$,X)=>{D.negatives.sort((U,Z)=>U<Z?-1:U>Z?1:0),D.positives.sort((U,Z)=>U<Z?-1:U>Z?1:0);let J=$.capture?"":"?:",Y="",F="",Q;if(D.positives.length)Y=D.positives.map((U)=>iO(String(U),X)).join("|");if(D.negatives.length)F=`-(${J}${D.negatives.map((U)=>iO(String(U),X)).join("|")})`;if(Y&&F)Q=`${Y}|${F}`;else Q=Y||F;if($.wrap)return`(${J}${Q})`;return Q},w90=(D,$,X,J)=>{if(X)return q90(D,$,{wrap:!1,...J});let Y=String.fromCharCode(D);if(D===$)return Y;let F=String.fromCharCode($);return`[${Y}-${F}]`},K90=(D,$,X)=>{if(Array.isArray(D)){let J=X.wrap===!0,Y=X.capture?"":"?:";return J?`(${Y}${D.join("|")})`:D.join("|")}return q90(D,$,X)},W90=(...D)=>{return RangeError("Invalid range arguments: "+_l0.inspect(...D))},H90=(D,$,X)=>{if(X.strictRanges===!0)throw W90([D,$]);return[]},gl0=(D,$)=>{if($.strictRanges===!0)throw TypeError(`Expected step "${D}" to be a number`);return[]},hl0=(D,$,X=1,J={})=>{let Y=Number(D),F=Number($);if(!Number.isInteger(Y)||!Number.isInteger(F)){if(J.strictRanges===!0)throw W90([D,$]);return[]}if(Y===0)Y=0;if(F===0)F=0;let Q=Y>F,U=String(D),Z=String($),G=String(X);X=Math.max(Math.abs(X),1);let O=eE(U)||eE(Z)||eE(G),q=O?Math.max(U.length,Z.length,G.length):0,w=O===!1&&kl0(D,$,J)===!1,K=J.transform||fl0(w);if(J.toRegex&&X===1)return w90(iO(D,q),iO($,q),!0,J);let W={negatives:[],positives:[]},H=(I)=>W[I<0?"negatives":"positives"].push(Math.abs(I)),B=[],M=0;while(Q?Y>=F:Y<=F){if(J.toRegex===!0&&X>1)H(Y);else B.push(yl0(K(Y,M),q,w));Y=Q?Y-X:Y+X,M++}if(J.toRegex===!0)return X>1?bl0(W,J,q):K90(B,null,{wrap:!1,...J});return B},ml0=(D,$,X=1,J={})=>{if(!QY(D)&&D.length>1||!QY($)&&$.length>1)return H90(D,$,J);let Y=J.transform||((w)=>String.fromCharCode(w)),F=`${D}`.charCodeAt(0),Q=`${$}`.charCodeAt(0),U=F>Q,Z=Math.min(F,Q),G=Math.max(F,Q);if(J.toRegex&&X===1)return w90(Z,G,!1,J);let O=[],q=0;while(U?F>=Q:F<=Q)O.push(Y(F,q)),F=U?F-X:F+X,q++;if(J.toRegex===!0)return K90(O,null,{wrap:!1,options:J});return O},lO=(D,$,X,J={})=>{if($==null&&sE(D))return[D];if(!sE(D)||!sE($))return H90(D,$,J);if(typeof X==="function")return lO(D,$,1,{transform:X});if(O90(X))return lO(D,$,0,X);let Y={...J};if(Y.capture===!0)Y.wrap=!0;if(X=X||Y.step||1,!QY(X)){if(X!=null&&!O90(X))return gl0(X,Y);return lO(D,$,1,X)}if(QY(D)&&QY($))return hl0(D,$,X,Y);return ml0(D,$,Math.max(Math.abs(X),1),Y)};z90.exports=lO});var L90=E((
|
|
454
|
-
`,CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var P90=E((CQD,C90)=>{var il0=nO(),{MAX_LENGTH:A90,CHAR_BACKSLASH:$A,CHAR_BACKTICK:pl0,CHAR_COMMA:rl0,CHAR_DOT:tl0,CHAR_LEFT_PARENTHESES:ol0,CHAR_RIGHT_PARENTHESES:al0,CHAR_LEFT_CURLY_BRACE:sl0,CHAR_RIGHT_CURLY_BRACE:el0,CHAR_LEFT_SQUARE_BRACKET:R90,CHAR_RIGHT_SQUARE_BRACKET:T90,CHAR_DOUBLE_QUOTE:Di0,CHAR_SINGLE_QUOTE:$i0,CHAR_NO_BREAK_SPACE:Xi0,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Ji0}=E90(),Yi0=(D,$={})=>{if(typeof D!=="string")throw TypeError("Expected a string");let X=$||{},J=typeof X.maxLength==="number"?Math.min(A90,X.maxLength):A90;if(D.length>J)throw SyntaxError(`Input length (${D.length}), exceeds max characters (${J})`);let Y={type:"root",input:D,nodes:[]},F=[Y],Q=Y,U=Y,Z=0,G=D.length,O=0,q=0,w,K=()=>D[O++],W=(H)=>{if(H.type==="text"&&U.type==="dot")U.type="text";if(U&&U.type==="text"&&H.type==="text"){U.value+=H.value;return}return Q.nodes.push(H),H.parent=Q,H.prev=U,U=H,H};W({type:"bos"});while(O<G){if(Q=F[F.length-1],w=K(),w===Ji0||w===Xi0)continue;if(w===$A){W({type:"text",value:($.keepEscaping?w:"")+K()});continue}if(w===T90){W({type:"text",value:"\\"+w});continue}if(w===R90){Z++;let H;while(O<G&&(H=K())){if(w+=H,H===R90){Z++;continue}if(H===$A){w+=K();continue}if(H===T90){if(Z--,Z===0)break}}W({type:"text",value:w});continue}if(w===ol0){Q=W({type:"paren",nodes:[]}),F.push(Q),W({type:"text",value:w});continue}if(w===al0){if(Q.type!=="paren"){W({type:"text",value:w});continue}Q=F.pop(),W({type:"text",value:w}),Q=F[F.length-1];continue}if(w===Di0||w===$i0||w===pl0){let H=w,B;if($.keepQuotes!==!0)w="";while(O<G&&(B=K())){if(B===$A){w+=B+K();continue}if(B===H){if($.keepQuotes===!0)w+=B;break}w+=B}W({type:"text",value:w});continue}if(w===sl0){q++;let B={type:"brace",open:!0,close:!1,dollar:U.value&&U.value.slice(-1)==="$"||Q.dollar===!0,depth:q,commas:0,ranges:0,nodes:[]};Q=W(B),F.push(Q),W({type:"open",value:w});continue}if(w===el0){if(Q.type!=="brace"){W({type:"text",value:w});continue}let H="close";Q=F.pop(),Q.close=!0,W({type:H,value:w}),q--,Q=F[F.length-1];continue}if(w===rl0&&q>0){if(Q.ranges>0){Q.ranges=0;let H=Q.nodes.shift();Q.nodes=[H,{type:"text",value:il0(Q)}]}W({type:"comma",value:w}),Q.commas++;continue}if(w===tl0&&q>0&&Q.commas===0){let H=Q.nodes;if(q===0||H.length===0){W({type:"text",value:w});continue}if(U.type==="dot"){if(Q.range=[],U.value+=w,U.type="range",Q.nodes.length!==3&&Q.nodes.length!==5){Q.invalid=!0,Q.ranges=0,U.type="text";continue}Q.ranges++,Q.args=[];continue}if(U.type==="range"){H.pop();let B=H[H.length-1];B.value+=U.value+w,U=B,Q.ranges--;continue}W({type:"dot",value:w});continue}W({type:"text",value:w})}do if(Q=F.pop(),Q.type!=="root"){Q.nodes.forEach((M)=>{if(!M.nodes){if(M.type==="open")M.isOpen=!0;if(M.type==="close")M.isClose=!0;if(!M.nodes)M.type="text";M.invalid=!0}});let H=F[F.length-1],B=H.nodes.indexOf(Q);H.nodes.splice(B,1,...Q.nodes)}while(F.length>0);return W({type:"eos"}),Y};C90.exports=Yi0});var u90=E((PQD,v90)=>{var S90=nO(),Fi0=L90(),Qi0=I90(),Ui0=P90(),L$=(D,$={})=>{let X=[];if(Array.isArray(D))for(let J of D){let Y=L$.create(J,$);if(Array.isArray(Y))X.push(...Y);else X.push(Y)}else X=[].concat(L$.create(D,$));if($&&$.expand===!0&&$.nodupes===!0)X=[...new Set(X)];return X};L$.parse=(D,$={})=>Ui0(D,$);L$.stringify=(D,$={})=>{if(typeof D==="string")return S90(L$.parse(D,$),$);return S90(D,$)};L$.compile=(D,$={})=>{if(typeof D==="string")D=L$.parse(D,$);return Fi0(D,$)};L$.expand=(D,$={})=>{if(typeof D==="string")D=L$.parse(D,$);let X=Qi0(D,$);if($.noempty===!0)X=X.filter(Boolean);if($.nodupes===!0)X=[...new Set(X)];return X};L$.create=(D,$={})=>{if(D===""||D.length<3)return[D];return $.expand!==!0?L$.compile(D,$):L$.expand(D,$)};v90.exports=L$});var UY=E((SQD,_90)=>{var Zi0=l("path"),x90={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)"},Gi0={...x90,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)"},Oi0={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};_90.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:Oi0,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:Zi0.sep,extglobChars(D){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${D.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(D){return D===!0?Gi0:x90}}});var ZY=E((Ni0)=>{var qi0=l("path"),wi0=process.platform==="win32",{REGEX_BACKSLASH:Ki0,REGEX_REMOVE_BACKSLASH:Wi0,REGEX_SPECIAL_CHARS:Hi0,REGEX_SPECIAL_CHARS_GLOBAL:zi0}=UY();Ni0.isObject=(D)=>D!==null&&typeof D==="object"&&!Array.isArray(D);Ni0.hasRegexChars=(D)=>Hi0.test(D);Ni0.isRegexChar=(D)=>D.length===1&&Ni0.hasRegexChars(D);Ni0.escapeRegex=(D)=>D.replace(zi0,"\\$1");Ni0.toPosixSlashes=(D)=>D.replace(Ki0,"/");Ni0.removeBackslashes=(D)=>{return D.replace(Wi0,($)=>{return $==="\\"?"":$})};Ni0.supportsLookbehinds=()=>{let D=process.version.slice(1).split(".").map(Number);if(D.length===3&&D[0]>=9||D[0]===8&&D[1]>=10)return!0;return!1};Ni0.isWindows=(D)=>{if(D&&typeof D.windows==="boolean")return D.windows;return wi0===!0||qi0.sep==="\\"};Ni0.escapeLast=(D,$,X)=>{let J=D.lastIndexOf($,X);if(J===-1)return D;if(D[J-1]==="\\")return Ni0.escapeLast(D,$,J-1);return`${D.slice(0,J)}\\${D.slice(J)}`};Ni0.removePrefix=(D,$={})=>{let X=D;if(X.startsWith("./"))X=X.slice(2),$.prefix="./";return X};Ni0.wrapOutput=(D,$={},X={})=>{let J=X.contains?"":"^",Y=X.contains?"":"$",F=`${J}(?:${D})${Y}`;if($.negated===!0)F=`(?:^(?!${F}).*$)`;return F}});var n90=E((uQD,d90)=>{var y90=ZY(),{CHAR_ASTERISK:XA,CHAR_AT:Ti0,CHAR_BACKWARD_SLASH:GY,CHAR_COMMA:Ci0,CHAR_DOT:JA,CHAR_EXCLAMATION_MARK:YA,CHAR_FORWARD_SLASH:c90,CHAR_LEFT_CURLY_BRACE:FA,CHAR_LEFT_PARENTHESES:QA,CHAR_LEFT_SQUARE_BRACKET:Pi0,CHAR_PLUS:Si0,CHAR_QUESTION_MARK:b90,CHAR_RIGHT_CURLY_BRACE:vi0,CHAR_RIGHT_PARENTHESES:g90,CHAR_RIGHT_SQUARE_BRACKET:ui0}=UY(),h90=(D)=>{return D===c90||D===GY},m90=(D)=>{if(D.isPrefix!==!0)D.depth=D.isGlobstar?1/0:1},xi0=(D,$)=>{let X=$||{},J=D.length-1,Y=X.parts===!0||X.scanToEnd===!0,F=[],Q=[],U=[],Z=D,G=-1,O=0,q=0,w=!1,K=!1,W=!1,H=!1,B=!1,M=!1,I=!1,z=!1,N=!1,V=!1,A=0,u,_,j={value:"",depth:0,isGlob:!1},x=()=>G>=J,P=()=>Z.charCodeAt(G+1),m=()=>{return u=_,Z.charCodeAt(++G)};while(G<J){_=m();let S;if(_===GY){if(I=j.backslashes=!0,_=m(),_===FA)M=!0;continue}if(M===!0||_===FA){A++;while(x()!==!0&&(_=m())){if(_===GY){I=j.backslashes=!0,m();continue}if(_===FA){A++;continue}if(M!==!0&&_===JA&&(_=m())===JA){if(w=j.isBrace=!0,W=j.isGlob=!0,V=!0,Y===!0)continue;break}if(M!==!0&&_===Ci0){if(w=j.isBrace=!0,W=j.isGlob=!0,V=!0,Y===!0)continue;break}if(_===vi0){if(A--,A===0){M=!1,w=j.isBrace=!0,V=!0;break}}}if(Y===!0)continue;break}if(_===c90){if(F.push(G),Q.push(j),j={value:"",depth:0,isGlob:!1},V===!0)continue;if(u===JA&&G===O+1){O+=2;continue}q=G+1;continue}if(X.noext!==!0){if((_===Si0||_===Ti0||_===XA||_===b90||_===YA)===!0&&P()===QA){if(W=j.isGlob=!0,H=j.isExtglob=!0,V=!0,_===YA&&G===O)N=!0;if(Y===!0){while(x()!==!0&&(_=m())){if(_===GY){I=j.backslashes=!0,_=m();continue}if(_===g90){W=j.isGlob=!0,V=!0;break}}continue}break}}if(_===XA){if(u===XA)B=j.isGlobstar=!0;if(W=j.isGlob=!0,V=!0,Y===!0)continue;break}if(_===b90){if(W=j.isGlob=!0,V=!0,Y===!0)continue;break}if(_===Pi0){while(x()!==!0&&(S=m())){if(S===GY){I=j.backslashes=!0,m();continue}if(S===ui0){K=j.isBracket=!0,W=j.isGlob=!0,V=!0;break}}if(Y===!0)continue;break}if(X.nonegate!==!0&&_===YA&&G===O){z=j.negated=!0,O++;continue}if(X.noparen!==!0&&_===QA){if(W=j.isGlob=!0,Y===!0){while(x()!==!0&&(_=m())){if(_===QA){I=j.backslashes=!0,_=m();continue}if(_===g90){V=!0;break}}continue}break}if(W===!0){if(V=!0,Y===!0)continue;break}}if(X.noext===!0)H=!1,W=!1;let b=Z,p="",k="";if(O>0)p=Z.slice(0,O),Z=Z.slice(O),q-=O;if(b&&W===!0&&q>0)b=Z.slice(0,q),k=Z.slice(q);else if(W===!0)b="",k=Z;else b=Z;if(b&&b!==""&&b!=="/"&&b!==Z){if(h90(b.charCodeAt(b.length-1)))b=b.slice(0,-1)}if(X.unescape===!0){if(k)k=y90.removeBackslashes(k);if(b&&I===!0)b=y90.removeBackslashes(b)}let R={prefix:p,input:D,start:O,base:b,glob:k,isBrace:w,isBracket:K,isGlob:W,isExtglob:H,isGlobstar:B,negated:z,negatedExtglob:N};if(X.tokens===!0){if(R.maxDepth=0,!h90(_))Q.push(j);R.tokens=Q}if(X.parts===!0||X.tokens===!0){let S;for(let v=0;v<F.length;v++){let f=S?S+1:O,h=F[v],y=D.slice(f,h);if(X.tokens){if(v===0&&O!==0)Q[v].isPrefix=!0,Q[v].value=p;else Q[v].value=y;m90(Q[v]),R.maxDepth+=Q[v].depth}if(v!==0||y!=="")U.push(y);S=h}if(S&&S+1<D.length){let v=D.slice(S+1);if(U.push(v),X.tokens)Q[Q.length-1].value=v,m90(Q[Q.length-1]),R.maxDepth+=Q[Q.length-1].depth}R.slashes=F,R.parts=U}return R};d90.exports=xi0});var t90=E((xQD,r90)=>{var OY=UY(),T1=ZY(),{MAX_LENGTH:pO,POSIX_REGEX_SOURCE:_i0,REGEX_NON_SPECIAL_CHARS:fi0,REGEX_SPECIAL_CHARS_BACKREF:ki0,REPLACEMENTS:l90}=OY,yi0=(D,$)=>{if(typeof $.expandRange==="function")return $.expandRange(...D,$);D.sort();let X=`[${D.join("-")}]`;try{new RegExp(X)}catch(J){return D.map((Y)=>T1.escapeRegex(Y)).join("..")}return X},T3=(D,$)=>{return`Missing ${D}: "${$}" - use "\\\\${$}" to match literal characters`},i90=(D)=>{let $=[],X=0,J=0,Y=0,F="",Q=!1;for(let U of D){if(Q===!0){F+=U,Q=!1;continue}if(U==="\\"){F+=U,Q=!0;continue}if(U==='"'){Y=Y===1?0:1,F+=U;continue}if(Y===0){if(U==="[")X++;else if(U==="]"&&X>0)X--;else if(X===0){if(U==="(")J++;else if(U===")"&&J>0)J--;else if(U==="|"&&J===0){$.push(F),F="";continue}}}F+=U}return $.push(F),$},bi0=(D)=>{let $=!1;for(let X of D){if($===!0){$=!1;continue}if(X==="\\"){$=!0;continue}if(/[?*+@!()[\]{}]/.test(X))return!1}return!0},p90=(D)=>{let $=D.trim(),X=!0;while(X===!0)if(X=!1,/^@\([^\\()[\]{}|]+\)$/.test($))$=$.slice(2,-1),X=!0;if(!bi0($))return;return $.replace(/\\(.)/g,"$1")},gi0=(D)=>{let $=D.map(p90).filter(Boolean);for(let X=0;X<$.length;X++)for(let J=X+1;J<$.length;J++){let Y=$[X],F=$[J],Q=Y[0];if(!Q||Y!==Q.repeat(Y.length)||F!==Q.repeat(F.length))continue;if(Y===F||Y.startsWith(F)||F.startsWith(Y))return!0}return!1},UA=(D,$=!0)=>{if(D[0]!=="+"&&D[0]!=="*"||D[1]!=="(")return;let X=0,J=0,Y=0,F=!1;for(let Q=1;Q<D.length;Q++){let U=D[Q];if(F===!0){F=!1;continue}if(U==="\\"){F=!0;continue}if(U==='"'){Y=Y===1?0:1;continue}if(Y===1)continue;if(U==="["){X++;continue}if(U==="]"&&X>0){X--;continue}if(X>0)continue;if(U==="("){J++;continue}if(U===")"){if(J--,J===0){if($===!0&&Q!==D.length-1)return;return{type:D[0],body:D.slice(2,Q),end:Q}}}}},hi0=(D)=>{let $=0,X=[];while($<D.length){let Y=UA(D.slice($),!1);if(!Y||Y.type!=="*")return;let F=i90(Y.body).map((U)=>U.trim());if(F.length!==1)return;let Q=p90(F[0]);if(!Q||Q.length!==1)return;X.push(Q),$+=Y.end+1}if(X.length<1)return;return`${X.length===1?T1.escapeRegex(X[0]):`[${X.map((Y)=>T1.escapeRegex(Y)).join("")}]`}*`},mi0=(D)=>{let $=0,X=D.trim(),J=UA(X);while(J)$++,X=J.body.trim(),J=UA(X);return $},ci0=(D,$)=>{if($.maxExtglobRecursion===!1)return{risky:!1};let X=typeof $.maxExtglobRecursion==="number"?$.maxExtglobRecursion:OY.DEFAULT_MAX_EXTGLOB_RECURSION,J=i90(D).map((Y)=>Y.trim());if(J.length>1){if(J.some((Y)=>Y==="")||J.some((Y)=>/^[*?]+$/.test(Y))||gi0(J))return{risky:!0}}for(let Y of J){let F=hi0(Y);if(F)return{risky:!0,safeOutput:F};if(mi0(Y)>X)return{risky:!0}}return{risky:!1}},ZA=(D,$)=>{if(typeof D!=="string")throw TypeError("Expected a string");D=l90[D]||D;let X={...$},J=typeof X.maxLength==="number"?Math.min(pO,X.maxLength):pO,Y=D.length;if(Y>J)throw SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${J}`);let F={type:"bos",value:"",output:X.prepend||""},Q=[F],U=X.capture?"":"?:",Z=T1.isWindows($),G=OY.globChars(Z),O=OY.extglobChars(G),{DOT_LITERAL:q,PLUS_LITERAL:w,SLASH_LITERAL:K,ONE_CHAR:W,DOTS_SLASH:H,NO_DOT:B,NO_DOT_SLASH:M,NO_DOTS_SLASH:I,QMARK:z,QMARK_NO_DOT:N,STAR:V,START_ANCHOR:A}=G,u=(Q0)=>{return`(${U}(?:(?!${A}${Q0.dot?H:q}).)*?)`},_=X.dot?"":B,j=X.dot?z:N,x=X.bash===!0?u(X):V;if(X.capture)x=`(${x})`;if(typeof X.noext==="boolean")X.noextglob=X.noext;let P={input:D,index:-1,start:0,dot:X.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:Q};D=T1.removePrefix(D,P),Y=D.length;let m=[],b=[],p=[],k=F,R,S=()=>P.index===Y-1,v=P.peek=(Q0=1)=>D[P.index+Q0],f=P.advance=()=>D[++P.index]||"",h=()=>D.slice(P.index+1),y=(Q0="",T0=0)=>{P.consumed+=Q0,P.index+=T0},a=(Q0)=>{P.output+=Q0.output!=null?Q0.output:Q0.value,y(Q0.value)},c=()=>{let Q0=1;while(v()==="!"&&(v(2)!=="("||v(3)==="?"))f(),P.start++,Q0++;if(Q0%2===0)return!1;return P.negated=!0,P.start++,!0},t=(Q0)=>{P[Q0]++,p.push(Q0)},K0=(Q0)=>{P[Q0]--,p.pop()},F0=(Q0)=>{if(k.type==="globstar"){let T0=P.braces>0&&(Q0.type==="comma"||Q0.type==="brace"),C=Q0.extglob===!0||m.length&&(Q0.type==="pipe"||Q0.type==="paren");if(Q0.type!=="slash"&&Q0.type!=="paren"&&!T0&&!C)P.output=P.output.slice(0,-k.output.length),k.type="star",k.value="*",k.output=x,P.output+=k.output}if(m.length&&Q0.type!=="paren")m[m.length-1].inner+=Q0.value;if(Q0.value||Q0.output)a(Q0);if(k&&k.type==="text"&&Q0.type==="text"){k.value+=Q0.value,k.output=(k.output||"")+Q0.value;return}Q0.prev=k,Q.push(Q0),k=Q0},R0=(Q0,T0)=>{let C={...O[T0],conditions:1,inner:""};C.prev=k,C.parens=P.parens,C.output=P.output,C.startIndex=P.index,C.tokensIndex=Q.length;let T=(X.capture?"(":"")+C.open;t("parens"),F0({type:Q0,value:T0,output:P.output?"":W}),F0({type:"paren",extglob:!0,value:f(),output:T}),m.push(C)},h0=(Q0)=>{let T0=D.slice(Q0.startIndex,P.index+1),C=D.slice(Q0.startIndex+2,P.index),T=ci0(C,X);if((Q0.type==="plus"||Q0.type==="star")&&T.risky){let Z0=T.safeOutput?(Q0.output?"":W)+(X.capture?`(${T.safeOutput})`:T.safeOutput):void 0,v0=Q[Q0.tokensIndex];v0.type="text",v0.value=T0,v0.output=Z0||T1.escapeRegex(T0);for(let P0=Q0.tokensIndex+1;P0<Q.length;P0++)Q[P0].value="",Q[P0].output="",delete Q[P0].suffix;P.output=Q0.output+v0.output,P.backtrack=!0,F0({type:"paren",extglob:!0,value:R,output:""}),K0("parens");return}let n=Q0.close+(X.capture?")":""),g;if(Q0.type==="negate"){let Z0=x;if(Q0.inner&&Q0.inner.length>1&&Q0.inner.includes("/"))Z0=u(X);if(Z0!==x||S()||/^\)+$/.test(h()))n=Q0.close=`)$))${Z0}`;if(Q0.inner.includes("*")&&(g=h())&&/^\.[^\\/.]+$/.test(g)){let v0=ZA(g,{...$,fastpaths:!1}).output;n=Q0.close=`)${v0})${Z0})`}if(Q0.prev.type==="bos")P.negatedExtglob=!0}F0({type:"paren",extglob:!0,value:R,output:n}),K0("parens")};if(X.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(D)){let Q0=!1,T0=D.replace(ki0,(C,T,n,g,Z0,v0)=>{if(g==="\\")return Q0=!0,C;if(g==="?"){if(T)return T+g+(Z0?z.repeat(Z0.length):"");if(v0===0)return j+(Z0?z.repeat(Z0.length):"");return z.repeat(n.length)}if(g===".")return q.repeat(n.length);if(g==="*"){if(T)return T+g+(Z0?x:"");return x}return T?C:`\\${C}`});if(Q0===!0)if(X.unescape===!0)T0=T0.replace(/\\/g,"");else T0=T0.replace(/\\+/g,(C)=>{return C.length%2===0?"\\\\":C?"\\":""});if(T0===D&&X.contains===!0)return P.output=D,P;return P.output=T1.wrapOutput(T0,P,$),P}while(!S()){if(R=f(),R==="\x00")continue;if(R==="\\"){let C=v();if(C==="/"&&X.bash!==!0)continue;if(C==="."||C===";")continue;if(!C){R+="\\",F0({type:"text",value:R});continue}let T=/^\\+/.exec(h()),n=0;if(T&&T[0].length>2){if(n=T[0].length,P.index+=n,n%2!==0)R+="\\"}if(X.unescape===!0)R=f();else R+=f();if(P.brackets===0){F0({type:"text",value:R});continue}}if(P.brackets>0&&(R!=="]"||k.value==="["||k.value==="[^")){if(X.posix!==!1&&R===":"){let C=k.value.slice(1);if(C.includes("[")){if(k.posix=!0,C.includes(":")){let T=k.value.lastIndexOf("["),n=k.value.slice(0,T),g=k.value.slice(T+2),Z0=_i0[g];if(Z0){if(k.value=n+Z0,P.backtrack=!0,f(),!F.output&&Q.indexOf(k)===1)F.output=W;continue}}}}if(R==="["&&v()!==":"||R==="-"&&v()==="]")R=`\\${R}`;if(R==="]"&&(k.value==="["||k.value==="[^"))R=`\\${R}`;if(X.posix===!0&&R==="!"&&k.value==="[")R="^";k.value+=R,a({value:R});continue}if(P.quotes===1&&R!=='"'){R=T1.escapeRegex(R),k.value+=R,a({value:R});continue}if(R==='"'){if(P.quotes=P.quotes===1?0:1,X.keepQuotes===!0)F0({type:"text",value:R});continue}if(R==="("){t("parens"),F0({type:"paren",value:R});continue}if(R===")"){if(P.parens===0&&X.strictBrackets===!0)throw SyntaxError(T3("opening","("));let C=m[m.length-1];if(C&&P.parens===C.parens+1){h0(m.pop());continue}F0({type:"paren",value:R,output:P.parens?")":"\\)"}),K0("parens");continue}if(R==="["){if(X.nobracket===!0||!h().includes("]")){if(X.nobracket!==!0&&X.strictBrackets===!0)throw SyntaxError(T3("closing","]"));R=`\\${R}`}else t("brackets");F0({type:"bracket",value:R});continue}if(R==="]"){if(X.nobracket===!0||k&&k.type==="bracket"&&k.value.length===1){F0({type:"text",value:R,output:`\\${R}`});continue}if(P.brackets===0){if(X.strictBrackets===!0)throw SyntaxError(T3("opening","["));F0({type:"text",value:R,output:`\\${R}`});continue}K0("brackets");let C=k.value.slice(1);if(k.posix!==!0&&C[0]==="^"&&!C.includes("/"))R=`/${R}`;if(k.value+=R,a({value:R}),X.literalBrackets===!1||T1.hasRegexChars(C))continue;let T=T1.escapeRegex(k.value);if(P.output=P.output.slice(0,-k.value.length),X.literalBrackets===!0){P.output+=T,k.value=T;continue}k.value=`(${U}${T}|${k.value})`,P.output+=k.value;continue}if(R==="{"&&X.nobrace!==!0){t("braces");let C={type:"brace",value:R,output:"(",outputIndex:P.output.length,tokensIndex:P.tokens.length};b.push(C),F0(C);continue}if(R==="}"){let C=b[b.length-1];if(X.nobrace===!0||!C){F0({type:"text",value:R,output:R});continue}let T=")";if(C.dots===!0){let n=Q.slice(),g=[];for(let Z0=n.length-1;Z0>=0;Z0--){if(Q.pop(),n[Z0].type==="brace")break;if(n[Z0].type!=="dots")g.unshift(n[Z0].value)}T=yi0(g,X),P.backtrack=!0}if(C.comma!==!0&&C.dots!==!0){let n=P.output.slice(0,C.outputIndex),g=P.tokens.slice(C.tokensIndex);C.value=C.output="\\{",R=T="\\}",P.output=n;for(let Z0 of g)P.output+=Z0.output||Z0.value}F0({type:"brace",value:R,output:T}),K0("braces"),b.pop();continue}if(R==="|"){if(m.length>0)m[m.length-1].conditions++;F0({type:"text",value:R});continue}if(R===","){let C=R,T=b[b.length-1];if(T&&p[p.length-1]==="braces")T.comma=!0,C="|";F0({type:"comma",value:R,output:C});continue}if(R==="/"){if(k.type==="dot"&&P.index===P.start+1){P.start=P.index+1,P.consumed="",P.output="",Q.pop(),k=F;continue}F0({type:"slash",value:R,output:K});continue}if(R==="."){if(P.braces>0&&k.type==="dot"){if(k.value===".")k.output=q;let C=b[b.length-1];k.type="dots",k.output+=R,k.value+=R,C.dots=!0;continue}if(P.braces+P.parens===0&&k.type!=="bos"&&k.type!=="slash"){F0({type:"text",value:R,output:q});continue}F0({type:"dot",value:R,output:q});continue}if(R==="?"){if(!(k&&k.value==="(")&&X.noextglob!==!0&&v()==="("&&v(2)!=="?"){R0("qmark",R);continue}if(k&&k.type==="paren"){let T=v(),n=R;if(T==="<"&&!T1.supportsLookbehinds())throw Error("Node.js v10 or higher is required for regex lookbehinds");if(k.value==="("&&!/[!=<:]/.test(T)||T==="<"&&!/<([!=]|\w+>)/.test(h()))n=`\\${R}`;F0({type:"text",value:R,output:n});continue}if(X.dot!==!0&&(k.type==="slash"||k.type==="bos")){F0({type:"qmark",value:R,output:N});continue}F0({type:"qmark",value:R,output:z});continue}if(R==="!"){if(X.noextglob!==!0&&v()==="("){if(v(2)!=="?"||!/[!=<:]/.test(v(3))){R0("negate",R);continue}}if(X.nonegate!==!0&&P.index===0){c();continue}}if(R==="+"){if(X.noextglob!==!0&&v()==="("&&v(2)!=="?"){R0("plus",R);continue}if(k&&k.value==="("||X.regex===!1){F0({type:"plus",value:R,output:w});continue}if(k&&(k.type==="bracket"||k.type==="paren"||k.type==="brace")||P.parens>0){F0({type:"plus",value:R});continue}F0({type:"plus",value:w});continue}if(R==="@"){if(X.noextglob!==!0&&v()==="("&&v(2)!=="?"){F0({type:"at",extglob:!0,value:R,output:""});continue}F0({type:"text",value:R});continue}if(R!=="*"){if(R==="$"||R==="^")R=`\\${R}`;let C=fi0.exec(h());if(C)R+=C[0],P.index+=C[0].length;F0({type:"text",value:R});continue}if(k&&(k.type==="globstar"||k.star===!0)){k.type="star",k.star=!0,k.value+=R,k.output=x,P.backtrack=!0,P.globstar=!0,y(R);continue}let Q0=h();if(X.noextglob!==!0&&/^\([^?]/.test(Q0)){R0("star",R);continue}if(k.type==="star"){if(X.noglobstar===!0){y(R);continue}let C=k.prev,T=C.prev,n=C.type==="slash"||C.type==="bos",g=T&&(T.type==="star"||T.type==="globstar");if(X.bash===!0&&(!n||Q0[0]&&Q0[0]!=="/")){F0({type:"star",value:R,output:""});continue}let Z0=P.braces>0&&(C.type==="comma"||C.type==="brace"),v0=m.length&&(C.type==="pipe"||C.type==="paren");if(!n&&C.type!=="paren"&&!Z0&&!v0){F0({type:"star",value:R,output:""});continue}while(Q0.slice(0,3)==="/**"){let P0=D[P.index+4];if(P0&&P0!=="/")break;Q0=Q0.slice(3),y("/**",3)}if(C.type==="bos"&&S()){k.type="globstar",k.value+=R,k.output=u(X),P.output=k.output,P.globstar=!0,y(R);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&!g&&S()){P.output=P.output.slice(0,-(C.output+k.output).length),C.output=`(?:${C.output}`,k.type="globstar",k.output=u(X)+(X.strictSlashes?")":"|$)"),k.value+=R,P.globstar=!0,P.output+=C.output+k.output,y(R);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&Q0[0]==="/"){let P0=Q0[1]!==void 0?"|$":"";P.output=P.output.slice(0,-(C.output+k.output).length),C.output=`(?:${C.output}`,k.type="globstar",k.output=`${u(X)}${K}|${K}${P0})`,k.value+=R,P.output+=C.output+k.output,P.globstar=!0,y(R+f()),F0({type:"slash",value:"/",output:""});continue}if(C.type==="bos"&&Q0[0]==="/"){k.type="globstar",k.value+=R,k.output=`(?:^|${K}|${u(X)}${K})`,P.output=k.output,P.globstar=!0,y(R+f()),F0({type:"slash",value:"/",output:""});continue}P.output=P.output.slice(0,-k.output.length),k.type="globstar",k.output=u(X),k.value+=R,P.output+=k.output,P.globstar=!0,y(R);continue}let T0={type:"star",value:R,output:x};if(X.bash===!0){if(T0.output=".*?",k.type==="bos"||k.type==="slash")T0.output=_+T0.output;F0(T0);continue}if(k&&(k.type==="bracket"||k.type==="paren")&&X.regex===!0){T0.output=R,F0(T0);continue}if(P.index===P.start||k.type==="slash"||k.type==="dot"){if(k.type==="dot")P.output+=M,k.output+=M;else if(X.dot===!0)P.output+=I,k.output+=I;else P.output+=_,k.output+=_;if(v()!=="*")P.output+=W,k.output+=W}F0(T0)}while(P.brackets>0){if(X.strictBrackets===!0)throw SyntaxError(T3("closing","]"));P.output=T1.escapeLast(P.output,"["),K0("brackets")}while(P.parens>0){if(X.strictBrackets===!0)throw SyntaxError(T3("closing",")"));P.output=T1.escapeLast(P.output,"("),K0("parens")}while(P.braces>0){if(X.strictBrackets===!0)throw SyntaxError(T3("closing","}"));P.output=T1.escapeLast(P.output,"{"),K0("braces")}if(X.strictSlashes!==!0&&(k.type==="star"||k.type==="bracket"))F0({type:"maybe_slash",value:"",output:`${K}?`});if(P.backtrack===!0){P.output="";for(let Q0 of P.tokens)if(P.output+=Q0.output!=null?Q0.output:Q0.value,Q0.suffix)P.output+=Q0.suffix}return P};ZA.fastpaths=(D,$)=>{let X={...$},J=typeof X.maxLength==="number"?Math.min(pO,X.maxLength):pO,Y=D.length;if(Y>J)throw SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${J}`);D=l90[D]||D;let F=T1.isWindows($),{DOT_LITERAL:Q,SLASH_LITERAL:U,ONE_CHAR:Z,DOTS_SLASH:G,NO_DOT:O,NO_DOTS:q,NO_DOTS_SLASH:w,STAR:K,START_ANCHOR:W}=OY.globChars(F),H=X.dot?q:O,B=X.dot?w:O,M=X.capture?"":"?:",I={negated:!1,prefix:""},z=X.bash===!0?".*?":K;if(X.capture)z=`(${z})`;let N=(_)=>{if(_.noglobstar===!0)return z;return`(${M}(?:(?!${W}${_.dot?G:Q}).)*?)`},V=(_)=>{switch(_){case"*":return`${H}${Z}${z}`;case".*":return`${Q}${Z}${z}`;case"*.*":return`${H}${z}${Q}${Z}${z}`;case"*/*":return`${H}${z}${U}${Z}${B}${z}`;case"**":return H+N(X);case"**/*":return`(?:${H}${N(X)}${U})?${B}${Z}${z}`;case"**/*.*":return`(?:${H}${N(X)}${U})?${B}${z}${Q}${Z}${z}`;case"**/.*":return`(?:${H}${N(X)}${U})?${Q}${Z}${z}`;default:{let j=/^(.*?)\.(\w+)$/.exec(_);if(!j)return;let x=V(j[1]);if(!x)return;return x+Q+j[2]}}},A=T1.removePrefix(D,I),u=V(A);if(u&&X.strictSlashes!==!0)u+=`${U}?`;return u};r90.exports=ZA});var a90=E((_QD,o90)=>{var di0=l("path"),ni0=n90(),GA=t90(),OA=ZY(),li0=UY(),ii0=(D)=>D&&typeof D==="object"&&!Array.isArray(D),pD=(D,$,X=!1)=>{if(Array.isArray(D)){let O=D.map((w)=>pD(w,$,X));return(w)=>{for(let K of O){let W=K(w);if(W)return W}return!1}}let J=ii0(D)&&D.tokens&&D.input;if(D===""||typeof D!=="string"&&!J)throw TypeError("Expected pattern to be a non-empty string");let Y=$||{},F=OA.isWindows($),Q=J?pD.compileRe(D,$):pD.makeRe(D,$,!1,!0),U=Q.state;delete Q.state;let Z=()=>!1;if(Y.ignore){let O={...$,ignore:null,onMatch:null,onResult:null};Z=pD(Y.ignore,O,X)}let G=(O,q=!1)=>{let{isMatch:w,match:K,output:W}=pD.test(O,Q,$,{glob:D,posix:F}),H={glob:D,state:U,regex:Q,posix:F,input:O,output:W,match:K,isMatch:w};if(typeof Y.onResult==="function")Y.onResult(H);if(w===!1)return H.isMatch=!1,q?H:!1;if(Z(O)){if(typeof Y.onIgnore==="function")Y.onIgnore(H);return H.isMatch=!1,q?H:!1}if(typeof Y.onMatch==="function")Y.onMatch(H);return q?H:!0};if(X)G.state=U;return G};pD.test=(D,$,X,{glob:J,posix:Y}={})=>{if(typeof D!=="string")throw TypeError("Expected input to be a string");if(D==="")return{isMatch:!1,output:""};let F=X||{},Q=F.format||(Y?OA.toPosixSlashes:null),U=D===J,Z=U&&Q?Q(D):D;if(U===!1)Z=Q?Q(D):D,U=Z===J;if(U===!1||F.capture===!0)if(F.matchBase===!0||F.basename===!0)U=pD.matchBase(D,$,X,Y);else U=$.exec(Z);return{isMatch:Boolean(U),match:U,output:Z}};pD.matchBase=(D,$,X,J=OA.isWindows(X))=>{return($ instanceof RegExp?$:pD.makeRe($,X)).test(di0.basename(D))};pD.isMatch=(D,$,X)=>pD($,X)(D);pD.parse=(D,$)=>{if(Array.isArray(D))return D.map((X)=>pD.parse(X,$));return GA(D,{...$,fastpaths:!1})};pD.scan=(D,$)=>ni0(D,$);pD.compileRe=(D,$,X=!1,J=!1)=>{if(X===!0)return D.output;let Y=$||{},F=Y.contains?"":"^",Q=Y.contains?"":"$",U=`${F}(?:${D.output})${Q}`;if(D&&D.negated===!0)U=`^(?!${U}).*$`;let Z=pD.toRegex(U,$);if(J===!0)Z.state=D;return Z};pD.makeRe=(D,$={},X=!1,J=!1)=>{if(!D||typeof D!=="string")throw TypeError("Expected a non-empty string");let Y={negated:!1,fastpaths:!0};if($.fastpaths!==!1&&(D[0]==="."||D[0]==="*"))Y.output=GA.fastpaths(D,$);if(!Y.output)Y=GA(D,$);return pD.compileRe(Y,$,X,J)};pD.toRegex=(D,$)=>{try{let X=$||{};return new RegExp(D,X.flags||(X.nocase?"i":""))}catch(X){if($&&$.debug===!0)throw X;return/$^/}};pD.constants=li0;o90.exports=pD});var J50=E((fQD,X50)=>{var e90=l("util"),D50=u90(),v6=a90(),qA=ZY(),s90=(D)=>D===""||D==="./",$50=(D)=>{let $=D.indexOf("{");return $>-1&&D.indexOf("}",$)>-1},RD=(D,$,X)=>{$=[].concat($),D=[].concat(D);let J=new Set,Y=new Set,F=new Set,Q=0,U=(O)=>{if(F.add(O.output),X&&X.onResult)X.onResult(O)};for(let O=0;O<$.length;O++){let q=v6(String($[O]),{...X,onResult:U},!0),w=q.state.negated||q.state.negatedExtglob;if(w)Q++;for(let K of D){let W=q(K,!0);if(!(w?!W.isMatch:W.isMatch))continue;if(w)J.add(W.output);else J.delete(W.output),Y.add(W.output)}}let G=(Q===$.length?[...F]:[...Y]).filter((O)=>!J.has(O));if(X&&G.length===0){if(X.failglob===!0)throw Error(`No matches found for "${$.join(", ")}"`);if(X.nonull===!0||X.nullglob===!0)return X.unescape?$.map((O)=>O.replace(/\\/g,"")):$}return G};RD.match=RD;RD.matcher=(D,$)=>v6(D,$);RD.isMatch=(D,$,X)=>v6($,X)(D);RD.any=RD.isMatch;RD.not=(D,$,X={})=>{$=[].concat($).map(String);let J=new Set,Y=[],Q=new Set(RD(D,$,{...X,onResult:(U)=>{if(X.onResult)X.onResult(U);Y.push(U.output)}}));for(let U of Y)if(!Q.has(U))J.add(U);return[...J]};RD.contains=(D,$,X)=>{if(typeof D!=="string")throw TypeError(`Expected a string: "${e90.inspect(D)}"`);if(Array.isArray($))return $.some((J)=>RD.contains(D,J,X));if(typeof $==="string"){if(s90(D)||s90($))return!1;if(D.includes($)||D.startsWith("./")&&D.slice(2).includes($))return!0}return RD.isMatch(D,$,{...X,contains:!0})};RD.matchKeys=(D,$,X)=>{if(!qA.isObject(D))throw TypeError("Expected the first argument to be an object");let J=RD(Object.keys(D),$,X),Y={};for(let F of J)Y[F]=D[F];return Y};RD.some=(D,$,X)=>{let J=[].concat(D);for(let Y of[].concat($)){let F=v6(String(Y),X);if(J.some((Q)=>F(Q)))return!0}return!1};RD.every=(D,$,X)=>{let J=[].concat(D);for(let Y of[].concat($)){let F=v6(String(Y),X);if(!J.every((Q)=>F(Q)))return!1}return!0};RD.all=(D,$,X)=>{if(typeof D!=="string")throw TypeError(`Expected a string: "${e90.inspect(D)}"`);return[].concat($).every((J)=>v6(J,X)(D))};RD.capture=(D,$,X)=>{let J=qA.isWindows(X),F=v6.makeRe(String(D),{...X,capture:!0}).exec(J?qA.toPosixSlashes($):$);if(F)return F.slice(1).map((Q)=>Q===void 0?"":Q)};RD.makeRe=(...D)=>v6.makeRe(...D);RD.scan=(...D)=>v6.scan(...D);RD.parse=(D,$)=>{let X=[];for(let J of[].concat(D||[]))for(let Y of D50(String(J),$))X.push(v6.parse(Y,$));return X};RD.braces=(D,$)=>{if(typeof D!=="string")throw TypeError("Expected a string");if($&&$.nobrace===!0||!$50(D))return[D];return D50(D,$)};RD.braceExpand=(D,$)=>{if(typeof D!=="string")throw TypeError("Expected a string");return RD.braces(D,{...$,expand:!0})};RD.hasBraces=$50;X50.exports=RD});import{existsSync as lp0,readFileSync as ip0}from"node:fs";import{dirname as pp0,join as S3}from"node:path";import{cwd as oO}from"node:process";function VA(D){if(!lp0(D))return;return ip0(D,"utf-8")}function op0(D){let $=[S3(oO(),D,"app","build.gradle"),S3(oO(),D,"app","build.gradle.kts")];for(let X of $){let J=VA(X);if(!J)continue;let Y=J.match(/versionName\s*(?:=\s*)?["']([^"']+)["']/)?.[1],F=J.match(/versionCode\s*(?:=\s*)?(\d+)/)?.[1];if(Y)return{versionName:Y,versionCode:F,source:X}}return}function f50(D,$){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return D.match(new RegExp(`<key>${X}</key>\\s*<string>([^<]+)</string>`))?.[1]?.trim()}function tO(D,$){let J=D.match(new RegExp(`${$}\\s*=\\s*([^;]+);`))?.[1]?.trim();if(!J)return;return J.replace(/"/g,"").trim()}function ap0(D){let $=S3(oO(),D,"App"),X=S3($,"App","Info.plist"),J=S3($,"App.xcodeproj","project.pbxproj"),Y=VA(X),F=VA(J);if(!Y)return;let Q=f50(Y,"CFBundleShortVersionString"),U=f50(Y,"CFBundleVersion");if(Q==="$(MARKETING_VERSION)")Q=F?tO(F,"MARKETING_VERSION"):void 0;if(U==="$(CURRENT_PROJECT_VERSION)")U=F?tO(F,"CURRENT_PROJECT_VERSION"):void 0;if(!Q&&F)Q=tO(F,"MARKETING_VERSION");if(!U&&F)U=tO(F,"CURRENT_PROJECT_VERSION");if(!Q)return;return{versionName:Q,versionCode:U,source:X}}function sp0(D){let $=D?.plugins?.CapacitorUpdater?.version;if(typeof $==="string"&&$.trim().length>0)return $.trim();return}function ep0(D){let $=D?.plugins?.CapacitorUpdater?.defaultChannel;if(typeof $==="string"&&$.trim().length>0)return $.trim();return""}function Dr0(D){let $=D?.plugins?.CapacitorUpdater?.updateUrl;if(typeof $==="string"&&$.trim().length>0)return $.trim();return rp0}async function y50(D,$){let X=$?.plugins?.CapacitorUpdater?.appId,J=$?.appId,Y=X||J;if(!Y)return{ok:!1,error:"Could not resolve app ID from capacitor config. Ensure appId is set in capacitor.config.ts or CapacitorUpdater.appId is configured."};let F=X?"CapacitorUpdater.appId from capacitor config":"top-level appId from capacitor config",Q=sJ($,D),U=D==="android"?op0(Q):ap0(Q);if(!U)return{ok:!1,error:`Unable to resolve native ${D.toUpperCase()} version values from platform files in "${Q}".`};let Z=sp0($),G=Z||U.versionName,O=Z?"CapacitorUpdater.version from capacitor config":`native ${D.toUpperCase()} versionName`,q=S3(oO(),"package.json"),w=pp0(q),K=await U$("@capgo/capacitor-updater",w,q);if(!K)return{ok:!1,error:"Unable to resolve installed @capgo/capacitor-updater version from this project."};return{ok:!0,context:{endpoint:Dr0($),payload:{app_id:Y,device_id:tp0,version_name:"builtin",version_build:G,is_emulator:!1,is_prod:!1,platform:D,plugin_version:K,defaultChannel:ep0($)},nativeSource:U.source,versionBuildSource:O,appIdSource:F}}}function b50(D){let $={};if(D&&typeof D==="object"){for(let[X,J]of Object.entries(D))if(X!=="error"&&X!=="message")$[X]=J}return $}function $r0(D,$){let X=typeof D?.error==="string"?D.error:void 0,J=typeof D?.message==="string"?D.message:void 0,Y=typeof D?.version==="string"?D.version:void 0;if(X==="no_new_version_available"||Y&&Y===$)return{status:"retry",detail:J||"No new version available yet"};if(X)return{status:"failed",detail:`${X}: ${J??"Unknown backend message"}`,errorCode:X,backendMessage:J,extra:b50(D)};if(Y&&Y!==$)return{status:"available",detail:`Update ${Y} is available`,responseVersion:Y};return{status:"failed",detail:`Unexpected response format: ${JSON.stringify(D)}`}}async function g50(D,$){let X;try{X=await fetch(D,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($),signal:AbortSignal.timeout(k50)})}catch(F){if(F instanceof DOMException&&F.name==="TimeoutError")return{success:!1,reason:`Request timed out after ${k50/1000}s — the endpoint did not respond in time.`,backendRefusal:!1};return{success:!1,reason:`Network error: ${F instanceof Error?F.message:String(F)}`,backendRefusal:!1}}let J;try{J=await X.json()}catch{J={error:"invalid_json_response",message:"Non-JSON response from updates endpoint"}}if(!X.ok){let F=typeof J?.error==="string"?J.error:void 0,Q=typeof J?.message==="string"?J.message:void 0;return{success:!1,reason:`HTTP ${X.status}: ${JSON.stringify(J)}`,backendRefusal:!!F,errorCode:F,backendMessage:Q,extra:b50(J)}}let Y=$r0(J,$.version_name);if(Y.status==="available")return{success:!0,availableVersion:Y.responseVersion??""};if(Y.status==="retry")return{success:!1,reason:Y.detail,backendRefusal:!1};return{success:!1,reason:Y.detail,backendRefusal:!!Y.errorCode,errorCode:Y.errorCode,backendMessage:Y.backendMessage,extra:Y.extra}}function h50(D){if(!D.errorCode)return[];let $=[];if(D.errorCode==="disable_auto_update_to_major"){let J=typeof D.extra?.version==="string"?D.extra.version:"unknown",Y=typeof D.extra?.old==="string"?D.extra.old:"unknown";$.push(`Channel policy blocks major upgrades (target ${J}, device baseline ${Y}).`)}let X=Xr0[D.errorCode];if(X)$.push(X.cause),$.push(`Fix: ${X.fix}`),$.push(`Details: ${X.docsUrl||oD}`);else $.push(`Backend returned ${D.errorCode}.`),$.push("Check channel restrictions, app/plugin configuration, and device version values."),$.push(`Troubleshooting guide: ${oD}`);return $}var rp0="https://plugin.capgo.app/updates",tp0="00000000-0000-0000-0000-000000000000",oD="https://capgo.app/docs/plugins/updater/commonproblems/",k50=1e4,Xr0;var m50=r(()=>{_0();Xr0={disable_auto_update_to_major:{cause:"Channel blocks major upgrades and device baseline major does not match the target bundle major.",fix:"Set plugins.CapacitorUpdater.version so its MAJOR matches the bundle MAJOR (e.g. 1.0.0 for bundle 1.x.x), run npx cap sync, and reinstall the native build.",docsUrl:`${oD}#disable_auto_update_to_major`},disable_auto_update_to_minor:{cause:"Channel blocks minor upgrades and the target bundle minor is above the device baseline.",fix:"Upload a bundle within the allowed minor range, or change the channel disable_auto_update policy in the dashboard.",docsUrl:`${oD}#disable_auto_update_to_minor--disable_auto_update_to_patch`},disable_auto_update_to_patch:{cause:"Channel blocks patch upgrades and the target bundle patch is above the device baseline.",fix:"Upload a bundle within the allowed patch range, or change the channel disable_auto_update policy in the dashboard.",docsUrl:`${oD}#disable_auto_update_to_minor--disable_auto_update_to_patch`},disable_auto_update_to_metadata:{cause:"Channel uses metadata-based targeting (version_number) and the device baseline is below the required min_update_version.",fix:"Set plugins.CapacitorUpdater.version to match the installed native version, or adjust min_update_version on the channel.",docsUrl:`${oD}#disable_auto_update_to_metadata`},disable_auto_update_under_native:{cause:"Channel prevents downgrades below the native app version.",fix:"Upload a bundle with version >= native baseline, or disable the under-native downgrade protection on the channel.",docsUrl:`${oD}#disable_auto_update_under_native`},misconfigured_channel:{cause:"Channel has disable_auto_update=version_number but min_update_version is missing.",fix:"Set a valid min_update_version on the channel, or change disable_auto_update to a different mode."},cannot_update_via_private_channel:{cause:"The selected channel does not allow device self-assignment.",fix:"Use a channel with self-assignment enabled, or enable self-assignment / make the channel public.",docsUrl:`${oD}#cannot_update_via_private_channel`},semver_error:{cause:"version_build sent to the backend is not valid semver (expected x.y.z).",fix:"Set plugins.CapacitorUpdater.version to a valid semver like 1.2.3, run npx cap sync, and rebuild native.",docsUrl:`${oD}#unknown_version_build--semver_error`},unknown_version_build:{cause:"Backend received version_build=unknown (device baseline version is missing).",fix:"Set plugins.CapacitorUpdater.version in capacitor.config.*, run npx cap sync, and rebuild native.",docsUrl:`${oD}#unknown_version_build--semver_error`},unsupported_plugin_version:{cause:"Installed @capgo/capacitor-updater is too old for the current backend.",fix:"Run npm install @capgo/capacitor-updater@latest, then npx cap sync, and rebuild native.",docsUrl:`${oD}#unsupported_plugin_version`},key_id_mismatch:{cause:"Bundle encryption key and device key differ.",fix:"Ensure the same public key is used in app config and when encrypting bundles, then re-upload the bundle.",docsUrl:`${oD}#key_id_mismatch`},disabled_platform_ios:{cause:"Channel has iOS updates disabled.",fix:"Enable the iOS platform toggle on the target channel in the dashboard.",docsUrl:`${oD}#disabled_platform_ios--disabled_platform_android`},disabled_platform_android:{cause:"Channel has Android updates disabled.",fix:"Enable the Android platform toggle on the target channel in the dashboard.",docsUrl:`${oD}#disabled_platform_ios--disabled_platform_android`},disabled_platform_electron:{cause:"Channel has Electron updates disabled.",fix:"Enable the Electron platform toggle on the target channel in the dashboard."},disable_prod_build:{cause:"Channel blocks production builds (allow_prod is off).",fix:"Enable allow_prod on the channel, or test with a development build.",docsUrl:`${oD}#disable_prod_build--disable_dev_build--disable_device--disable_emulator`},disable_dev_build:{cause:"Channel blocks development builds (allow_dev is off).",fix:"Enable allow_dev on the channel, or test with a production build.",docsUrl:`${oD}#disable_prod_build--disable_dev_build--disable_device--disable_emulator`},disable_device:{cause:"Channel blocks physical devices (allow_device is off).",fix:"Enable allow_device on the channel, or test on an emulator.",docsUrl:`${oD}#disable_prod_build--disable_dev_build--disable_device--disable_emulator`},disable_emulator:{cause:"Channel blocks emulators (allow_emulator is off).",fix:"Enable allow_emulator on the channel, or test on a physical device.",docsUrl:`${oD}#disable_prod_build--disable_dev_build--disable_device--disable_emulator`},no_channel:{cause:"No channel was resolved for this device.",fix:"Set defaultChannel in capacitor.config.* plugins.CapacitorUpdater section, or create a default channel in the dashboard.",docsUrl:`${oD}#no_channel--null_channel_data`},null_channel_data:{cause:"Channel was resolved but contains no usable data.",fix:"Set defaultChannel in capacitor.config.* plugins.CapacitorUpdater section, or verify the channel has a bundle assigned.",docsUrl:`${oD}#no_channel--null_channel_data`},missing_info:{cause:"Request is missing required fields (app_id, device_id, version_build, or platform).",fix:"Check capacitor.config.* for a valid appId and verify the probe payload."},no_bundle:{cause:"Channel resolved a version but no downloadable bundle artifact exists.",fix:"Re-upload the bundle with npx @capgo/cli@latest bundle upload and verify channel assignment."},no_bundle_url:{cause:"Bundle was resolved but its download URL is missing.",fix:"Re-upload the bundle — the storage artifact may be corrupted or missing."},no_url_or_manifest:{cause:"Bundle was resolved but neither URL nor manifest is available.",fix:"Re-upload the bundle — the storage artifact may be corrupted or missing."},already_on_builtin:{cause:"Device is already running the builtin bundle.",fix:"Upload and assign a bundle to the channel for OTA updates to be delivered."},revert_to_builtin_plugin_version_too_old:{cause:"Plugin version is too old for safe builtin revert.",fix:"Run npm install @capgo/capacitor-updater@latest, then npx cap sync, and rebuild native."},on_premise_app:{cause:"App is either flagged as on-premise or does not exist in Capgo Cloud.",fix:"Check that the app_id is registered in Capgo (capgo app add). If it is an on-premise app, configure plugins.CapacitorUpdater.updateUrl to point to your on-prem update endpoint."},need_plan_upgrade:{cause:"Update checks are blocked by plan limits.",fix:"Upgrade your Capgo plan or contact your organization admin."},invalid_json_body:{cause:"Updates endpoint rejected the request body as invalid JSON.",fix:"This is likely a CLI bug — please report it at https://github.com/Cap-go/capgo/issues."},invalid_query_parameters:{cause:"Updates endpoint rejected the query parameters.",fix:"This is likely a CLI bug — please report it at https://github.com/Cap-go/capgo/issues."}}});var l50={};B$(l50,{probeInternal:()=>n50,probe:()=>Yr0});import{exit as Jr0,stdin as c50,stdout as d50}from"node:process";async function n50(D){let $;try{$=(await E0()).config}catch{return{success:!1,error:"Failed to load Capacitor config."}}let X;if(D.platform==="ios"||D.platform==="android")X=D.platform;else if(D.platform)return{success:!1,error:`Invalid platform "${D.platform}". Must be "ios" or "android".`};else{if(!(!!c50.isTTY&&!!d50.isTTY))return{success:!1,error:"Platform is required in non-interactive environments. Use --platform ios or --platform android."};let Z=await Q1({message:"Which platform do you want to probe?",options:[{value:"ios",label:"iOS"},{value:"android",label:"Android"}]});if(c0(Z))return{success:!1,error:"Probe cancelled."};X=Z}let J=await y50(X,$);if(!J.ok)return{success:!1,error:`Probe setup failed: ${J.error}`};let Y=J.context,F=await g50(Y.endpoint,Y.payload);l0({channel:"cli-usage",event:"Update Probed",icon:"\uD83D\uDD0E",tags:{update_available:F.success}});let Q={success:F.success,probeResult:F,endpoint:Y.endpoint,platform:X,versionBuild:Y.payload.version_build,versionBuildSource:Y.versionBuildSource,appId:Y.payload.app_id,appIdSource:Y.appIdSource,nativeSource:Y.nativeSource};if(!F.success)Q.hints=h50(F);return Q}async function Yr0(D){B0("Probe Capgo updates endpoint");let $=await n50(D);if($.error)L.error($.error),Jr0(1);L.info(`Endpoint: ${$.endpoint}`),L.info(`Platform: ${$.platform}, version_build: ${$.versionBuild}`),L.info(`version_build source: ${$.versionBuildSource}`),L.info(`app_id: ${$.appId} (${$.appIdSource})`),L.info(`Native values source: ${$.nativeSource}`);let X=$.probeResult;if(X.success)L.success(`Update available: ${X.availableVersion}`);else{if(L.warn(`Reason: ${X.reason}`),X.backendRefusal)L.warn("The backend actively refused the request (not a cache/propagation issue).");if(X.errorCode)L.warn(`Error code: ${X.errorCode}`);if(X.backendMessage)L.warn(`Backend message: ${X.backendMessage}`);if($.hints)for(let J of $.hints)L.warn(` ${J}`)}}var i50=r(()=>{g0();H1();m50();_0()});g0();i9();_0();g0();i9();_0();async function QD0(D,$,X,J={}){let{silent:Y=!1,autoUnlink:F=!1,channelName:Q,requireMatch:U=!1}=J,Z=D.from("channels").select().eq("app_id",$).eq("version",X.id);if(Q)Z=Z.eq("name",Q);let{data:G,error:O}=await Z;if(O){if(!Y)L.error(`Cannot check Version ${$}@${X.name}: ${o(O)}`);throw Error(`Cannot check version ${$}@${X.name}: ${o(O)}`)}if(!G?.length){if(Q&&U){let w=`Version ${$}@${X.name} is not linked to channel ${Q}`;if(!Y)L.error(w);throw Error(w)}return}if(Y&&!F)throw Error(`Version ${$}@${X.name} is used in ${G.length} channel(s)`);if(!Y)B0(`❌ Version ${$}@${X.name} is used in ${G.length} channel${G.length>1?"s":""}`);let q=F;if(!F)q=await kD({message:"unlink it?"})===!0;if(!q)throw L.error("Unlink it first"),Error(`Version ${$}@${X.name} is still linked to channel(s)`);for(let w of G){let K=Y?null:ID();K?.start(`Unlinking channel ${w.name}`);let{error:W}=await D.from("channels").update({version:null}).eq("id",w.id);if(W)throw K?.stop(`Cannot update channel ${w.name} ${o(W)}`),Error(`Cannot update channel ${w.name}: ${o(W)}`);K?.stop(`✅ Channel ${w.name} unlinked`)}if(!Y)M0(`Version unlinked from ${G.length} channel${G.length>1?"s":""}`)}function UD0(D,$){return D.from("channels").insert($).select().single()}function ZD0(D,$,X,J){return D.from("channels").delete().eq("name",$).eq("app_id",X).single()}function GD0(D,$,X){return D.from("channels").select().eq("app_id",$).eq("name",X).single()}function OD0(D,$,X){return D.from("channel_devices").delete().eq("app_id",$).eq("channel_id",X)}function qD0(D,$,X){return D.from("channels").select(`
|
|
453
|
+
*/var _l0=l("util"),q90=G90(),O90=(D)=>D!==null&&typeof D==="object"&&!Array.isArray(D),fl0=(D)=>{return($)=>D===!0?Number($):String($)},sE=(D)=>{return typeof D==="number"||typeof D==="string"&&D!==""},QY=(D)=>Number.isInteger(+D),eE=(D)=>{let $=`${D}`,X=-1;if($[0]==="-")$=$.slice(1);if($==="0")return!1;while($[++X]==="0");return X>0},kl0=(D,$,X)=>{if(typeof D==="string"||typeof $==="string")return!0;return X.stringify===!0},yl0=(D,$,X)=>{if($>0){let J=D[0]==="-"?"-":"";if(J)D=D.slice(1);D=J+D.padStart(J?$-1:$,"0")}if(X===!1)return String(D);return D},iO=(D,$)=>{let X=D[0]==="-"?"-":"";if(X)D=D.slice(1),$--;while(D.length<$)D="0"+D;return X?"-"+D:D},bl0=(D,$,X)=>{D.negatives.sort((U,Z)=>U<Z?-1:U>Z?1:0),D.positives.sort((U,Z)=>U<Z?-1:U>Z?1:0);let J=$.capture?"":"?:",Y="",F="",Q;if(D.positives.length)Y=D.positives.map((U)=>iO(String(U),X)).join("|");if(D.negatives.length)F=`-(${J}${D.negatives.map((U)=>iO(String(U),X)).join("|")})`;if(Y&&F)Q=`${Y}|${F}`;else Q=Y||F;if($.wrap)return`(${J}${Q})`;return Q},w90=(D,$,X,J)=>{if(X)return q90(D,$,{wrap:!1,...J});let Y=String.fromCharCode(D);if(D===$)return Y;let F=String.fromCharCode($);return`[${Y}-${F}]`},K90=(D,$,X)=>{if(Array.isArray(D)){let J=X.wrap===!0,Y=X.capture?"":"?:";return J?`(${Y}${D.join("|")})`:D.join("|")}return q90(D,$,X)},W90=(...D)=>{return RangeError("Invalid range arguments: "+_l0.inspect(...D))},H90=(D,$,X)=>{if(X.strictRanges===!0)throw W90([D,$]);return[]},gl0=(D,$)=>{if($.strictRanges===!0)throw TypeError(`Expected step "${D}" to be a number`);return[]},hl0=(D,$,X=1,J={})=>{let Y=Number(D),F=Number($);if(!Number.isInteger(Y)||!Number.isInteger(F)){if(J.strictRanges===!0)throw W90([D,$]);return[]}if(Y===0)Y=0;if(F===0)F=0;let Q=Y>F,U=String(D),Z=String($),G=String(X);X=Math.max(Math.abs(X),1);let O=eE(U)||eE(Z)||eE(G),q=O?Math.max(U.length,Z.length,G.length):0,w=O===!1&&kl0(D,$,J)===!1,K=J.transform||fl0(w);if(J.toRegex&&X===1)return w90(iO(D,q),iO($,q),!0,J);let W={negatives:[],positives:[]},H=(I)=>W[I<0?"negatives":"positives"].push(Math.abs(I)),B=[],M=0;while(Q?Y>=F:Y<=F){if(J.toRegex===!0&&X>1)H(Y);else B.push(yl0(K(Y,M),q,w));Y=Q?Y-X:Y+X,M++}if(J.toRegex===!0)return X>1?bl0(W,J,q):K90(B,null,{wrap:!1,...J});return B},ml0=(D,$,X=1,J={})=>{if(!QY(D)&&D.length>1||!QY($)&&$.length>1)return H90(D,$,J);let Y=J.transform||((w)=>String.fromCharCode(w)),F=`${D}`.charCodeAt(0),Q=`${$}`.charCodeAt(0),U=F>Q,Z=Math.min(F,Q),G=Math.max(F,Q);if(J.toRegex&&X===1)return w90(Z,G,!1,J);let O=[],q=0;while(U?F>=Q:F<=Q)O.push(Y(F,q)),F=U?F-X:F+X,q++;if(J.toRegex===!0)return K90(O,null,{wrap:!1,options:J});return O},lO=(D,$,X,J={})=>{if($==null&&sE(D))return[D];if(!sE(D)||!sE($))return H90(D,$,J);if(typeof X==="function")return lO(D,$,1,{transform:X});if(O90(X))return lO(D,$,0,X);let Y={...J};if(Y.capture===!0)Y.wrap=!0;if(X=X||Y.step||1,!QY(X)){if(X!=null&&!O90(X))return gl0(X,Y);return lO(D,$,1,X)}if(QY(D)&&QY($))return hl0(D,$,X,Y);return ml0(D,$,Math.max(Math.abs(X),1),Y)};z90.exports=lO});var L90=E((TQD,V90)=>{var cl0=DA(),N90=dO(),dl0=(D,$={})=>{let X=(J,Y={})=>{let F=N90.isInvalidBrace(Y),Q=J.invalid===!0&&$.escapeInvalid===!0,U=F===!0||Q===!0,Z=$.escapeInvalid===!0?"\\":"",G="";if(J.isOpen===!0)return Z+J.value;if(J.isClose===!0)return console.log("node.isClose",Z,J.value),Z+J.value;if(J.type==="open")return U?Z+J.value:"(";if(J.type==="close")return U?Z+J.value:")";if(J.type==="comma")return J.prev.type==="comma"?"":U?J.value:"|";if(J.value)return J.value;if(J.nodes&&J.ranges>0){let O=N90.reduce(J.nodes),q=cl0(...O,{...$,wrap:!1,toRegex:!0,strictZeros:!0});if(q.length!==0)return O.length>1&&q.length>1?`(${q})`:q}if(J.nodes)for(let O of J.nodes)G+=X(O,J);return G};return X(D)};V90.exports=dl0});var I90=E((CQD,M90)=>{var nl0=DA(),B90=nO(),R3=dO(),d9=(D="",$="",X=!1)=>{let J=[];if(D=[].concat(D),$=[].concat($),!$.length)return D;if(!D.length)return X?R3.flatten($).map((Y)=>`{${Y}}`):$;for(let Y of D)if(Array.isArray(Y))for(let F of Y)J.push(d9(F,$,X));else for(let F of $){if(X===!0&&typeof F==="string")F=`{${F}}`;J.push(Array.isArray(F)?d9(Y,F,X):Y+F)}return R3.flatten(J)},ll0=(D,$={})=>{let X=$.rangeLimit===void 0?1000:$.rangeLimit,J=(Y,F={})=>{Y.queue=[];let Q=F,U=F.queue;while(Q.type!=="brace"&&Q.type!=="root"&&Q.parent)Q=Q.parent,U=Q.queue;if(Y.invalid||Y.dollar){U.push(d9(U.pop(),B90(Y,$)));return}if(Y.type==="brace"&&Y.invalid!==!0&&Y.nodes.length===2){U.push(d9(U.pop(),["{}"]));return}if(Y.nodes&&Y.ranges>0){let q=R3.reduce(Y.nodes);if(R3.exceedsLimit(...q,$.step,X))throw RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let w=nl0(...q,$);if(w.length===0)w=B90(Y,$);U.push(d9(U.pop(),w)),Y.nodes=[];return}let Z=R3.encloseBrace(Y),G=Y.queue,O=Y;while(O.type!=="brace"&&O.type!=="root"&&O.parent)O=O.parent,G=O.queue;for(let q=0;q<Y.nodes.length;q++){let w=Y.nodes[q];if(w.type==="comma"&&Y.type==="brace"){if(q===1)G.push("");G.push("");continue}if(w.type==="close"){U.push(d9(U.pop(),G,Z));continue}if(w.value&&w.type!=="open"){G.push(d9(G.pop(),w.value));continue}if(w.nodes)J(w,Y)}return G};return R3.flatten(J(D))};M90.exports=ll0});var E90=E((PQD,j90)=>{j90.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
454
|
+
`,CHAR_NO_BREAK_SPACE:" ",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:"\t",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var P90=E((SQD,C90)=>{var il0=nO(),{MAX_LENGTH:A90,CHAR_BACKSLASH:$A,CHAR_BACKTICK:pl0,CHAR_COMMA:rl0,CHAR_DOT:tl0,CHAR_LEFT_PARENTHESES:ol0,CHAR_RIGHT_PARENTHESES:al0,CHAR_LEFT_CURLY_BRACE:sl0,CHAR_RIGHT_CURLY_BRACE:el0,CHAR_LEFT_SQUARE_BRACKET:R90,CHAR_RIGHT_SQUARE_BRACKET:T90,CHAR_DOUBLE_QUOTE:Di0,CHAR_SINGLE_QUOTE:$i0,CHAR_NO_BREAK_SPACE:Xi0,CHAR_ZERO_WIDTH_NOBREAK_SPACE:Ji0}=E90(),Yi0=(D,$={})=>{if(typeof D!=="string")throw TypeError("Expected a string");let X=$||{},J=typeof X.maxLength==="number"?Math.min(A90,X.maxLength):A90;if(D.length>J)throw SyntaxError(`Input length (${D.length}), exceeds max characters (${J})`);let Y={type:"root",input:D,nodes:[]},F=[Y],Q=Y,U=Y,Z=0,G=D.length,O=0,q=0,w,K=()=>D[O++],W=(H)=>{if(H.type==="text"&&U.type==="dot")U.type="text";if(U&&U.type==="text"&&H.type==="text"){U.value+=H.value;return}return Q.nodes.push(H),H.parent=Q,H.prev=U,U=H,H};W({type:"bos"});while(O<G){if(Q=F[F.length-1],w=K(),w===Ji0||w===Xi0)continue;if(w===$A){W({type:"text",value:($.keepEscaping?w:"")+K()});continue}if(w===T90){W({type:"text",value:"\\"+w});continue}if(w===R90){Z++;let H;while(O<G&&(H=K())){if(w+=H,H===R90){Z++;continue}if(H===$A){w+=K();continue}if(H===T90){if(Z--,Z===0)break}}W({type:"text",value:w});continue}if(w===ol0){Q=W({type:"paren",nodes:[]}),F.push(Q),W({type:"text",value:w});continue}if(w===al0){if(Q.type!=="paren"){W({type:"text",value:w});continue}Q=F.pop(),W({type:"text",value:w}),Q=F[F.length-1];continue}if(w===Di0||w===$i0||w===pl0){let H=w,B;if($.keepQuotes!==!0)w="";while(O<G&&(B=K())){if(B===$A){w+=B+K();continue}if(B===H){if($.keepQuotes===!0)w+=B;break}w+=B}W({type:"text",value:w});continue}if(w===sl0){q++;let B={type:"brace",open:!0,close:!1,dollar:U.value&&U.value.slice(-1)==="$"||Q.dollar===!0,depth:q,commas:0,ranges:0,nodes:[]};Q=W(B),F.push(Q),W({type:"open",value:w});continue}if(w===el0){if(Q.type!=="brace"){W({type:"text",value:w});continue}let H="close";Q=F.pop(),Q.close=!0,W({type:H,value:w}),q--,Q=F[F.length-1];continue}if(w===rl0&&q>0){if(Q.ranges>0){Q.ranges=0;let H=Q.nodes.shift();Q.nodes=[H,{type:"text",value:il0(Q)}]}W({type:"comma",value:w}),Q.commas++;continue}if(w===tl0&&q>0&&Q.commas===0){let H=Q.nodes;if(q===0||H.length===0){W({type:"text",value:w});continue}if(U.type==="dot"){if(Q.range=[],U.value+=w,U.type="range",Q.nodes.length!==3&&Q.nodes.length!==5){Q.invalid=!0,Q.ranges=0,U.type="text";continue}Q.ranges++,Q.args=[];continue}if(U.type==="range"){H.pop();let B=H[H.length-1];B.value+=U.value+w,U=B,Q.ranges--;continue}W({type:"dot",value:w});continue}W({type:"text",value:w})}do if(Q=F.pop(),Q.type!=="root"){Q.nodes.forEach((M)=>{if(!M.nodes){if(M.type==="open")M.isOpen=!0;if(M.type==="close")M.isClose=!0;if(!M.nodes)M.type="text";M.invalid=!0}});let H=F[F.length-1],B=H.nodes.indexOf(Q);H.nodes.splice(B,1,...Q.nodes)}while(F.length>0);return W({type:"eos"}),Y};C90.exports=Yi0});var u90=E((vQD,v90)=>{var S90=nO(),Fi0=L90(),Qi0=I90(),Ui0=P90(),L$=(D,$={})=>{let X=[];if(Array.isArray(D))for(let J of D){let Y=L$.create(J,$);if(Array.isArray(Y))X.push(...Y);else X.push(Y)}else X=[].concat(L$.create(D,$));if($&&$.expand===!0&&$.nodupes===!0)X=[...new Set(X)];return X};L$.parse=(D,$={})=>Ui0(D,$);L$.stringify=(D,$={})=>{if(typeof D==="string")return S90(L$.parse(D,$),$);return S90(D,$)};L$.compile=(D,$={})=>{if(typeof D==="string")D=L$.parse(D,$);return Fi0(D,$)};L$.expand=(D,$={})=>{if(typeof D==="string")D=L$.parse(D,$);let X=Qi0(D,$);if($.noempty===!0)X=X.filter(Boolean);if($.nodupes===!0)X=[...new Set(X)];return X};L$.create=(D,$={})=>{if(D===""||D.length<3)return[D];return $.expand!==!0?L$.compile(D,$):L$.expand(D,$)};v90.exports=L$});var UY=E((uQD,_90)=>{var Zi0=l("path"),x90={DOT_LITERAL:"\\.",PLUS_LITERAL:"\\+",QMARK_LITERAL:"\\?",SLASH_LITERAL:"\\/",ONE_CHAR:"(?=.)",QMARK:"[^/]",END_ANCHOR:"(?:\\/|$)",DOTS_SLASH:"\\.{1,2}(?:\\/|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|\\/)\\.{1,2}(?:\\/|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:\\/|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:\\/|$))",QMARK_NO_DOT:"[^.\\/]",STAR:"[^/]*?",START_ANCHOR:"(?:^|\\/)"},Gi0={...x90,SLASH_LITERAL:"[\\\\/]",QMARK:"[^\\\\/]",STAR:"[^\\\\/]*?",DOTS_SLASH:"\\.{1,2}(?:[\\\\/]|$)",NO_DOT:"(?!\\.)",NO_DOTS:"(?!(?:^|[\\\\/])\\.{1,2}(?:[\\\\/]|$))",NO_DOT_SLASH:"(?!\\.{0,1}(?:[\\\\/]|$))",NO_DOTS_SLASH:"(?!\\.{1,2}(?:[\\\\/]|$))",QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)"},Oi0={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};_90.exports={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:65536,POSIX_REGEX_SOURCE:Oi0,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:Zi0.sep,extglobChars(D){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${D.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(D){return D===!0?Gi0:x90}}});var ZY=E((Ni0)=>{var qi0=l("path"),wi0=process.platform==="win32",{REGEX_BACKSLASH:Ki0,REGEX_REMOVE_BACKSLASH:Wi0,REGEX_SPECIAL_CHARS:Hi0,REGEX_SPECIAL_CHARS_GLOBAL:zi0}=UY();Ni0.isObject=(D)=>D!==null&&typeof D==="object"&&!Array.isArray(D);Ni0.hasRegexChars=(D)=>Hi0.test(D);Ni0.isRegexChar=(D)=>D.length===1&&Ni0.hasRegexChars(D);Ni0.escapeRegex=(D)=>D.replace(zi0,"\\$1");Ni0.toPosixSlashes=(D)=>D.replace(Ki0,"/");Ni0.removeBackslashes=(D)=>{return D.replace(Wi0,($)=>{return $==="\\"?"":$})};Ni0.supportsLookbehinds=()=>{let D=process.version.slice(1).split(".").map(Number);if(D.length===3&&D[0]>=9||D[0]===8&&D[1]>=10)return!0;return!1};Ni0.isWindows=(D)=>{if(D&&typeof D.windows==="boolean")return D.windows;return wi0===!0||qi0.sep==="\\"};Ni0.escapeLast=(D,$,X)=>{let J=D.lastIndexOf($,X);if(J===-1)return D;if(D[J-1]==="\\")return Ni0.escapeLast(D,$,J-1);return`${D.slice(0,J)}\\${D.slice(J)}`};Ni0.removePrefix=(D,$={})=>{let X=D;if(X.startsWith("./"))X=X.slice(2),$.prefix="./";return X};Ni0.wrapOutput=(D,$={},X={})=>{let J=X.contains?"":"^",Y=X.contains?"":"$",F=`${J}(?:${D})${Y}`;if($.negated===!0)F=`(?:^(?!${F}).*$)`;return F}});var n90=E((_QD,d90)=>{var y90=ZY(),{CHAR_ASTERISK:XA,CHAR_AT:Ti0,CHAR_BACKWARD_SLASH:GY,CHAR_COMMA:Ci0,CHAR_DOT:JA,CHAR_EXCLAMATION_MARK:YA,CHAR_FORWARD_SLASH:c90,CHAR_LEFT_CURLY_BRACE:FA,CHAR_LEFT_PARENTHESES:QA,CHAR_LEFT_SQUARE_BRACKET:Pi0,CHAR_PLUS:Si0,CHAR_QUESTION_MARK:b90,CHAR_RIGHT_CURLY_BRACE:vi0,CHAR_RIGHT_PARENTHESES:g90,CHAR_RIGHT_SQUARE_BRACKET:ui0}=UY(),h90=(D)=>{return D===c90||D===GY},m90=(D)=>{if(D.isPrefix!==!0)D.depth=D.isGlobstar?1/0:1},xi0=(D,$)=>{let X=$||{},J=D.length-1,Y=X.parts===!0||X.scanToEnd===!0,F=[],Q=[],U=[],Z=D,G=-1,O=0,q=0,w=!1,K=!1,W=!1,H=!1,B=!1,M=!1,I=!1,z=!1,N=!1,V=!1,A=0,u,_,j={value:"",depth:0,isGlob:!1},x=()=>G>=J,P=()=>Z.charCodeAt(G+1),m=()=>{return u=_,Z.charCodeAt(++G)};while(G<J){_=m();let S;if(_===GY){if(I=j.backslashes=!0,_=m(),_===FA)M=!0;continue}if(M===!0||_===FA){A++;while(x()!==!0&&(_=m())){if(_===GY){I=j.backslashes=!0,m();continue}if(_===FA){A++;continue}if(M!==!0&&_===JA&&(_=m())===JA){if(w=j.isBrace=!0,W=j.isGlob=!0,V=!0,Y===!0)continue;break}if(M!==!0&&_===Ci0){if(w=j.isBrace=!0,W=j.isGlob=!0,V=!0,Y===!0)continue;break}if(_===vi0){if(A--,A===0){M=!1,w=j.isBrace=!0,V=!0;break}}}if(Y===!0)continue;break}if(_===c90){if(F.push(G),Q.push(j),j={value:"",depth:0,isGlob:!1},V===!0)continue;if(u===JA&&G===O+1){O+=2;continue}q=G+1;continue}if(X.noext!==!0){if((_===Si0||_===Ti0||_===XA||_===b90||_===YA)===!0&&P()===QA){if(W=j.isGlob=!0,H=j.isExtglob=!0,V=!0,_===YA&&G===O)N=!0;if(Y===!0){while(x()!==!0&&(_=m())){if(_===GY){I=j.backslashes=!0,_=m();continue}if(_===g90){W=j.isGlob=!0,V=!0;break}}continue}break}}if(_===XA){if(u===XA)B=j.isGlobstar=!0;if(W=j.isGlob=!0,V=!0,Y===!0)continue;break}if(_===b90){if(W=j.isGlob=!0,V=!0,Y===!0)continue;break}if(_===Pi0){while(x()!==!0&&(S=m())){if(S===GY){I=j.backslashes=!0,m();continue}if(S===ui0){K=j.isBracket=!0,W=j.isGlob=!0,V=!0;break}}if(Y===!0)continue;break}if(X.nonegate!==!0&&_===YA&&G===O){z=j.negated=!0,O++;continue}if(X.noparen!==!0&&_===QA){if(W=j.isGlob=!0,Y===!0){while(x()!==!0&&(_=m())){if(_===QA){I=j.backslashes=!0,_=m();continue}if(_===g90){V=!0;break}}continue}break}if(W===!0){if(V=!0,Y===!0)continue;break}}if(X.noext===!0)H=!1,W=!1;let b=Z,p="",k="";if(O>0)p=Z.slice(0,O),Z=Z.slice(O),q-=O;if(b&&W===!0&&q>0)b=Z.slice(0,q),k=Z.slice(q);else if(W===!0)b="",k=Z;else b=Z;if(b&&b!==""&&b!=="/"&&b!==Z){if(h90(b.charCodeAt(b.length-1)))b=b.slice(0,-1)}if(X.unescape===!0){if(k)k=y90.removeBackslashes(k);if(b&&I===!0)b=y90.removeBackslashes(b)}let R={prefix:p,input:D,start:O,base:b,glob:k,isBrace:w,isBracket:K,isGlob:W,isExtglob:H,isGlobstar:B,negated:z,negatedExtglob:N};if(X.tokens===!0){if(R.maxDepth=0,!h90(_))Q.push(j);R.tokens=Q}if(X.parts===!0||X.tokens===!0){let S;for(let v=0;v<F.length;v++){let f=S?S+1:O,h=F[v],y=D.slice(f,h);if(X.tokens){if(v===0&&O!==0)Q[v].isPrefix=!0,Q[v].value=p;else Q[v].value=y;m90(Q[v]),R.maxDepth+=Q[v].depth}if(v!==0||y!=="")U.push(y);S=h}if(S&&S+1<D.length){let v=D.slice(S+1);if(U.push(v),X.tokens)Q[Q.length-1].value=v,m90(Q[Q.length-1]),R.maxDepth+=Q[Q.length-1].depth}R.slashes=F,R.parts=U}return R};d90.exports=xi0});var t90=E((fQD,r90)=>{var OY=UY(),T1=ZY(),{MAX_LENGTH:pO,POSIX_REGEX_SOURCE:_i0,REGEX_NON_SPECIAL_CHARS:fi0,REGEX_SPECIAL_CHARS_BACKREF:ki0,REPLACEMENTS:l90}=OY,yi0=(D,$)=>{if(typeof $.expandRange==="function")return $.expandRange(...D,$);D.sort();let X=`[${D.join("-")}]`;try{new RegExp(X)}catch(J){return D.map((Y)=>T1.escapeRegex(Y)).join("..")}return X},T3=(D,$)=>{return`Missing ${D}: "${$}" - use "\\\\${$}" to match literal characters`},i90=(D)=>{let $=[],X=0,J=0,Y=0,F="",Q=!1;for(let U of D){if(Q===!0){F+=U,Q=!1;continue}if(U==="\\"){F+=U,Q=!0;continue}if(U==='"'){Y=Y===1?0:1,F+=U;continue}if(Y===0){if(U==="[")X++;else if(U==="]"&&X>0)X--;else if(X===0){if(U==="(")J++;else if(U===")"&&J>0)J--;else if(U==="|"&&J===0){$.push(F),F="";continue}}}F+=U}return $.push(F),$},bi0=(D)=>{let $=!1;for(let X of D){if($===!0){$=!1;continue}if(X==="\\"){$=!0;continue}if(/[?*+@!()[\]{}]/.test(X))return!1}return!0},p90=(D)=>{let $=D.trim(),X=!0;while(X===!0)if(X=!1,/^@\([^\\()[\]{}|]+\)$/.test($))$=$.slice(2,-1),X=!0;if(!bi0($))return;return $.replace(/\\(.)/g,"$1")},gi0=(D)=>{let $=D.map(p90).filter(Boolean);for(let X=0;X<$.length;X++)for(let J=X+1;J<$.length;J++){let Y=$[X],F=$[J],Q=Y[0];if(!Q||Y!==Q.repeat(Y.length)||F!==Q.repeat(F.length))continue;if(Y===F||Y.startsWith(F)||F.startsWith(Y))return!0}return!1},UA=(D,$=!0)=>{if(D[0]!=="+"&&D[0]!=="*"||D[1]!=="(")return;let X=0,J=0,Y=0,F=!1;for(let Q=1;Q<D.length;Q++){let U=D[Q];if(F===!0){F=!1;continue}if(U==="\\"){F=!0;continue}if(U==='"'){Y=Y===1?0:1;continue}if(Y===1)continue;if(U==="["){X++;continue}if(U==="]"&&X>0){X--;continue}if(X>0)continue;if(U==="("){J++;continue}if(U===")"){if(J--,J===0){if($===!0&&Q!==D.length-1)return;return{type:D[0],body:D.slice(2,Q),end:Q}}}}},hi0=(D)=>{let $=0,X=[];while($<D.length){let Y=UA(D.slice($),!1);if(!Y||Y.type!=="*")return;let F=i90(Y.body).map((U)=>U.trim());if(F.length!==1)return;let Q=p90(F[0]);if(!Q||Q.length!==1)return;X.push(Q),$+=Y.end+1}if(X.length<1)return;return`${X.length===1?T1.escapeRegex(X[0]):`[${X.map((Y)=>T1.escapeRegex(Y)).join("")}]`}*`},mi0=(D)=>{let $=0,X=D.trim(),J=UA(X);while(J)$++,X=J.body.trim(),J=UA(X);return $},ci0=(D,$)=>{if($.maxExtglobRecursion===!1)return{risky:!1};let X=typeof $.maxExtglobRecursion==="number"?$.maxExtglobRecursion:OY.DEFAULT_MAX_EXTGLOB_RECURSION,J=i90(D).map((Y)=>Y.trim());if(J.length>1){if(J.some((Y)=>Y==="")||J.some((Y)=>/^[*?]+$/.test(Y))||gi0(J))return{risky:!0}}for(let Y of J){let F=hi0(Y);if(F)return{risky:!0,safeOutput:F};if(mi0(Y)>X)return{risky:!0}}return{risky:!1}},ZA=(D,$)=>{if(typeof D!=="string")throw TypeError("Expected a string");D=l90[D]||D;let X={...$},J=typeof X.maxLength==="number"?Math.min(pO,X.maxLength):pO,Y=D.length;if(Y>J)throw SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${J}`);let F={type:"bos",value:"",output:X.prepend||""},Q=[F],U=X.capture?"":"?:",Z=T1.isWindows($),G=OY.globChars(Z),O=OY.extglobChars(G),{DOT_LITERAL:q,PLUS_LITERAL:w,SLASH_LITERAL:K,ONE_CHAR:W,DOTS_SLASH:H,NO_DOT:B,NO_DOT_SLASH:M,NO_DOTS_SLASH:I,QMARK:z,QMARK_NO_DOT:N,STAR:V,START_ANCHOR:A}=G,u=(Q0)=>{return`(${U}(?:(?!${A}${Q0.dot?H:q}).)*?)`},_=X.dot?"":B,j=X.dot?z:N,x=X.bash===!0?u(X):V;if(X.capture)x=`(${x})`;if(typeof X.noext==="boolean")X.noextglob=X.noext;let P={input:D,index:-1,start:0,dot:X.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:Q};D=T1.removePrefix(D,P),Y=D.length;let m=[],b=[],p=[],k=F,R,S=()=>P.index===Y-1,v=P.peek=(Q0=1)=>D[P.index+Q0],f=P.advance=()=>D[++P.index]||"",h=()=>D.slice(P.index+1),y=(Q0="",T0=0)=>{P.consumed+=Q0,P.index+=T0},a=(Q0)=>{P.output+=Q0.output!=null?Q0.output:Q0.value,y(Q0.value)},c=()=>{let Q0=1;while(v()==="!"&&(v(2)!=="("||v(3)==="?"))f(),P.start++,Q0++;if(Q0%2===0)return!1;return P.negated=!0,P.start++,!0},t=(Q0)=>{P[Q0]++,p.push(Q0)},K0=(Q0)=>{P[Q0]--,p.pop()},F0=(Q0)=>{if(k.type==="globstar"){let T0=P.braces>0&&(Q0.type==="comma"||Q0.type==="brace"),C=Q0.extglob===!0||m.length&&(Q0.type==="pipe"||Q0.type==="paren");if(Q0.type!=="slash"&&Q0.type!=="paren"&&!T0&&!C)P.output=P.output.slice(0,-k.output.length),k.type="star",k.value="*",k.output=x,P.output+=k.output}if(m.length&&Q0.type!=="paren")m[m.length-1].inner+=Q0.value;if(Q0.value||Q0.output)a(Q0);if(k&&k.type==="text"&&Q0.type==="text"){k.value+=Q0.value,k.output=(k.output||"")+Q0.value;return}Q0.prev=k,Q.push(Q0),k=Q0},R0=(Q0,T0)=>{let C={...O[T0],conditions:1,inner:""};C.prev=k,C.parens=P.parens,C.output=P.output,C.startIndex=P.index,C.tokensIndex=Q.length;let T=(X.capture?"(":"")+C.open;t("parens"),F0({type:Q0,value:T0,output:P.output?"":W}),F0({type:"paren",extglob:!0,value:f(),output:T}),m.push(C)},h0=(Q0)=>{let T0=D.slice(Q0.startIndex,P.index+1),C=D.slice(Q0.startIndex+2,P.index),T=ci0(C,X);if((Q0.type==="plus"||Q0.type==="star")&&T.risky){let Z0=T.safeOutput?(Q0.output?"":W)+(X.capture?`(${T.safeOutput})`:T.safeOutput):void 0,v0=Q[Q0.tokensIndex];v0.type="text",v0.value=T0,v0.output=Z0||T1.escapeRegex(T0);for(let P0=Q0.tokensIndex+1;P0<Q.length;P0++)Q[P0].value="",Q[P0].output="",delete Q[P0].suffix;P.output=Q0.output+v0.output,P.backtrack=!0,F0({type:"paren",extglob:!0,value:R,output:""}),K0("parens");return}let n=Q0.close+(X.capture?")":""),g;if(Q0.type==="negate"){let Z0=x;if(Q0.inner&&Q0.inner.length>1&&Q0.inner.includes("/"))Z0=u(X);if(Z0!==x||S()||/^\)+$/.test(h()))n=Q0.close=`)$))${Z0}`;if(Q0.inner.includes("*")&&(g=h())&&/^\.[^\\/.]+$/.test(g)){let v0=ZA(g,{...$,fastpaths:!1}).output;n=Q0.close=`)${v0})${Z0})`}if(Q0.prev.type==="bos")P.negatedExtglob=!0}F0({type:"paren",extglob:!0,value:R,output:n}),K0("parens")};if(X.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(D)){let Q0=!1,T0=D.replace(ki0,(C,T,n,g,Z0,v0)=>{if(g==="\\")return Q0=!0,C;if(g==="?"){if(T)return T+g+(Z0?z.repeat(Z0.length):"");if(v0===0)return j+(Z0?z.repeat(Z0.length):"");return z.repeat(n.length)}if(g===".")return q.repeat(n.length);if(g==="*"){if(T)return T+g+(Z0?x:"");return x}return T?C:`\\${C}`});if(Q0===!0)if(X.unescape===!0)T0=T0.replace(/\\/g,"");else T0=T0.replace(/\\+/g,(C)=>{return C.length%2===0?"\\\\":C?"\\":""});if(T0===D&&X.contains===!0)return P.output=D,P;return P.output=T1.wrapOutput(T0,P,$),P}while(!S()){if(R=f(),R==="\x00")continue;if(R==="\\"){let C=v();if(C==="/"&&X.bash!==!0)continue;if(C==="."||C===";")continue;if(!C){R+="\\",F0({type:"text",value:R});continue}let T=/^\\+/.exec(h()),n=0;if(T&&T[0].length>2){if(n=T[0].length,P.index+=n,n%2!==0)R+="\\"}if(X.unescape===!0)R=f();else R+=f();if(P.brackets===0){F0({type:"text",value:R});continue}}if(P.brackets>0&&(R!=="]"||k.value==="["||k.value==="[^")){if(X.posix!==!1&&R===":"){let C=k.value.slice(1);if(C.includes("[")){if(k.posix=!0,C.includes(":")){let T=k.value.lastIndexOf("["),n=k.value.slice(0,T),g=k.value.slice(T+2),Z0=_i0[g];if(Z0){if(k.value=n+Z0,P.backtrack=!0,f(),!F.output&&Q.indexOf(k)===1)F.output=W;continue}}}}if(R==="["&&v()!==":"||R==="-"&&v()==="]")R=`\\${R}`;if(R==="]"&&(k.value==="["||k.value==="[^"))R=`\\${R}`;if(X.posix===!0&&R==="!"&&k.value==="[")R="^";k.value+=R,a({value:R});continue}if(P.quotes===1&&R!=='"'){R=T1.escapeRegex(R),k.value+=R,a({value:R});continue}if(R==='"'){if(P.quotes=P.quotes===1?0:1,X.keepQuotes===!0)F0({type:"text",value:R});continue}if(R==="("){t("parens"),F0({type:"paren",value:R});continue}if(R===")"){if(P.parens===0&&X.strictBrackets===!0)throw SyntaxError(T3("opening","("));let C=m[m.length-1];if(C&&P.parens===C.parens+1){h0(m.pop());continue}F0({type:"paren",value:R,output:P.parens?")":"\\)"}),K0("parens");continue}if(R==="["){if(X.nobracket===!0||!h().includes("]")){if(X.nobracket!==!0&&X.strictBrackets===!0)throw SyntaxError(T3("closing","]"));R=`\\${R}`}else t("brackets");F0({type:"bracket",value:R});continue}if(R==="]"){if(X.nobracket===!0||k&&k.type==="bracket"&&k.value.length===1){F0({type:"text",value:R,output:`\\${R}`});continue}if(P.brackets===0){if(X.strictBrackets===!0)throw SyntaxError(T3("opening","["));F0({type:"text",value:R,output:`\\${R}`});continue}K0("brackets");let C=k.value.slice(1);if(k.posix!==!0&&C[0]==="^"&&!C.includes("/"))R=`/${R}`;if(k.value+=R,a({value:R}),X.literalBrackets===!1||T1.hasRegexChars(C))continue;let T=T1.escapeRegex(k.value);if(P.output=P.output.slice(0,-k.value.length),X.literalBrackets===!0){P.output+=T,k.value=T;continue}k.value=`(${U}${T}|${k.value})`,P.output+=k.value;continue}if(R==="{"&&X.nobrace!==!0){t("braces");let C={type:"brace",value:R,output:"(",outputIndex:P.output.length,tokensIndex:P.tokens.length};b.push(C),F0(C);continue}if(R==="}"){let C=b[b.length-1];if(X.nobrace===!0||!C){F0({type:"text",value:R,output:R});continue}let T=")";if(C.dots===!0){let n=Q.slice(),g=[];for(let Z0=n.length-1;Z0>=0;Z0--){if(Q.pop(),n[Z0].type==="brace")break;if(n[Z0].type!=="dots")g.unshift(n[Z0].value)}T=yi0(g,X),P.backtrack=!0}if(C.comma!==!0&&C.dots!==!0){let n=P.output.slice(0,C.outputIndex),g=P.tokens.slice(C.tokensIndex);C.value=C.output="\\{",R=T="\\}",P.output=n;for(let Z0 of g)P.output+=Z0.output||Z0.value}F0({type:"brace",value:R,output:T}),K0("braces"),b.pop();continue}if(R==="|"){if(m.length>0)m[m.length-1].conditions++;F0({type:"text",value:R});continue}if(R===","){let C=R,T=b[b.length-1];if(T&&p[p.length-1]==="braces")T.comma=!0,C="|";F0({type:"comma",value:R,output:C});continue}if(R==="/"){if(k.type==="dot"&&P.index===P.start+1){P.start=P.index+1,P.consumed="",P.output="",Q.pop(),k=F;continue}F0({type:"slash",value:R,output:K});continue}if(R==="."){if(P.braces>0&&k.type==="dot"){if(k.value===".")k.output=q;let C=b[b.length-1];k.type="dots",k.output+=R,k.value+=R,C.dots=!0;continue}if(P.braces+P.parens===0&&k.type!=="bos"&&k.type!=="slash"){F0({type:"text",value:R,output:q});continue}F0({type:"dot",value:R,output:q});continue}if(R==="?"){if(!(k&&k.value==="(")&&X.noextglob!==!0&&v()==="("&&v(2)!=="?"){R0("qmark",R);continue}if(k&&k.type==="paren"){let T=v(),n=R;if(T==="<"&&!T1.supportsLookbehinds())throw Error("Node.js v10 or higher is required for regex lookbehinds");if(k.value==="("&&!/[!=<:]/.test(T)||T==="<"&&!/<([!=]|\w+>)/.test(h()))n=`\\${R}`;F0({type:"text",value:R,output:n});continue}if(X.dot!==!0&&(k.type==="slash"||k.type==="bos")){F0({type:"qmark",value:R,output:N});continue}F0({type:"qmark",value:R,output:z});continue}if(R==="!"){if(X.noextglob!==!0&&v()==="("){if(v(2)!=="?"||!/[!=<:]/.test(v(3))){R0("negate",R);continue}}if(X.nonegate!==!0&&P.index===0){c();continue}}if(R==="+"){if(X.noextglob!==!0&&v()==="("&&v(2)!=="?"){R0("plus",R);continue}if(k&&k.value==="("||X.regex===!1){F0({type:"plus",value:R,output:w});continue}if(k&&(k.type==="bracket"||k.type==="paren"||k.type==="brace")||P.parens>0){F0({type:"plus",value:R});continue}F0({type:"plus",value:w});continue}if(R==="@"){if(X.noextglob!==!0&&v()==="("&&v(2)!=="?"){F0({type:"at",extglob:!0,value:R,output:""});continue}F0({type:"text",value:R});continue}if(R!=="*"){if(R==="$"||R==="^")R=`\\${R}`;let C=fi0.exec(h());if(C)R+=C[0],P.index+=C[0].length;F0({type:"text",value:R});continue}if(k&&(k.type==="globstar"||k.star===!0)){k.type="star",k.star=!0,k.value+=R,k.output=x,P.backtrack=!0,P.globstar=!0,y(R);continue}let Q0=h();if(X.noextglob!==!0&&/^\([^?]/.test(Q0)){R0("star",R);continue}if(k.type==="star"){if(X.noglobstar===!0){y(R);continue}let C=k.prev,T=C.prev,n=C.type==="slash"||C.type==="bos",g=T&&(T.type==="star"||T.type==="globstar");if(X.bash===!0&&(!n||Q0[0]&&Q0[0]!=="/")){F0({type:"star",value:R,output:""});continue}let Z0=P.braces>0&&(C.type==="comma"||C.type==="brace"),v0=m.length&&(C.type==="pipe"||C.type==="paren");if(!n&&C.type!=="paren"&&!Z0&&!v0){F0({type:"star",value:R,output:""});continue}while(Q0.slice(0,3)==="/**"){let P0=D[P.index+4];if(P0&&P0!=="/")break;Q0=Q0.slice(3),y("/**",3)}if(C.type==="bos"&&S()){k.type="globstar",k.value+=R,k.output=u(X),P.output=k.output,P.globstar=!0,y(R);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&!g&&S()){P.output=P.output.slice(0,-(C.output+k.output).length),C.output=`(?:${C.output}`,k.type="globstar",k.output=u(X)+(X.strictSlashes?")":"|$)"),k.value+=R,P.globstar=!0,P.output+=C.output+k.output,y(R);continue}if(C.type==="slash"&&C.prev.type!=="bos"&&Q0[0]==="/"){let P0=Q0[1]!==void 0?"|$":"";P.output=P.output.slice(0,-(C.output+k.output).length),C.output=`(?:${C.output}`,k.type="globstar",k.output=`${u(X)}${K}|${K}${P0})`,k.value+=R,P.output+=C.output+k.output,P.globstar=!0,y(R+f()),F0({type:"slash",value:"/",output:""});continue}if(C.type==="bos"&&Q0[0]==="/"){k.type="globstar",k.value+=R,k.output=`(?:^|${K}|${u(X)}${K})`,P.output=k.output,P.globstar=!0,y(R+f()),F0({type:"slash",value:"/",output:""});continue}P.output=P.output.slice(0,-k.output.length),k.type="globstar",k.output=u(X),k.value+=R,P.output+=k.output,P.globstar=!0,y(R);continue}let T0={type:"star",value:R,output:x};if(X.bash===!0){if(T0.output=".*?",k.type==="bos"||k.type==="slash")T0.output=_+T0.output;F0(T0);continue}if(k&&(k.type==="bracket"||k.type==="paren")&&X.regex===!0){T0.output=R,F0(T0);continue}if(P.index===P.start||k.type==="slash"||k.type==="dot"){if(k.type==="dot")P.output+=M,k.output+=M;else if(X.dot===!0)P.output+=I,k.output+=I;else P.output+=_,k.output+=_;if(v()!=="*")P.output+=W,k.output+=W}F0(T0)}while(P.brackets>0){if(X.strictBrackets===!0)throw SyntaxError(T3("closing","]"));P.output=T1.escapeLast(P.output,"["),K0("brackets")}while(P.parens>0){if(X.strictBrackets===!0)throw SyntaxError(T3("closing",")"));P.output=T1.escapeLast(P.output,"("),K0("parens")}while(P.braces>0){if(X.strictBrackets===!0)throw SyntaxError(T3("closing","}"));P.output=T1.escapeLast(P.output,"{"),K0("braces")}if(X.strictSlashes!==!0&&(k.type==="star"||k.type==="bracket"))F0({type:"maybe_slash",value:"",output:`${K}?`});if(P.backtrack===!0){P.output="";for(let Q0 of P.tokens)if(P.output+=Q0.output!=null?Q0.output:Q0.value,Q0.suffix)P.output+=Q0.suffix}return P};ZA.fastpaths=(D,$)=>{let X={...$},J=typeof X.maxLength==="number"?Math.min(pO,X.maxLength):pO,Y=D.length;if(Y>J)throw SyntaxError(`Input length: ${Y}, exceeds maximum allowed length: ${J}`);D=l90[D]||D;let F=T1.isWindows($),{DOT_LITERAL:Q,SLASH_LITERAL:U,ONE_CHAR:Z,DOTS_SLASH:G,NO_DOT:O,NO_DOTS:q,NO_DOTS_SLASH:w,STAR:K,START_ANCHOR:W}=OY.globChars(F),H=X.dot?q:O,B=X.dot?w:O,M=X.capture?"":"?:",I={negated:!1,prefix:""},z=X.bash===!0?".*?":K;if(X.capture)z=`(${z})`;let N=(_)=>{if(_.noglobstar===!0)return z;return`(${M}(?:(?!${W}${_.dot?G:Q}).)*?)`},V=(_)=>{switch(_){case"*":return`${H}${Z}${z}`;case".*":return`${Q}${Z}${z}`;case"*.*":return`${H}${z}${Q}${Z}${z}`;case"*/*":return`${H}${z}${U}${Z}${B}${z}`;case"**":return H+N(X);case"**/*":return`(?:${H}${N(X)}${U})?${B}${Z}${z}`;case"**/*.*":return`(?:${H}${N(X)}${U})?${B}${z}${Q}${Z}${z}`;case"**/.*":return`(?:${H}${N(X)}${U})?${Q}${Z}${z}`;default:{let j=/^(.*?)\.(\w+)$/.exec(_);if(!j)return;let x=V(j[1]);if(!x)return;return x+Q+j[2]}}},A=T1.removePrefix(D,I),u=V(A);if(u&&X.strictSlashes!==!0)u+=`${U}?`;return u};r90.exports=ZA});var a90=E((kQD,o90)=>{var di0=l("path"),ni0=n90(),GA=t90(),OA=ZY(),li0=UY(),ii0=(D)=>D&&typeof D==="object"&&!Array.isArray(D),pD=(D,$,X=!1)=>{if(Array.isArray(D)){let O=D.map((w)=>pD(w,$,X));return(w)=>{for(let K of O){let W=K(w);if(W)return W}return!1}}let J=ii0(D)&&D.tokens&&D.input;if(D===""||typeof D!=="string"&&!J)throw TypeError("Expected pattern to be a non-empty string");let Y=$||{},F=OA.isWindows($),Q=J?pD.compileRe(D,$):pD.makeRe(D,$,!1,!0),U=Q.state;delete Q.state;let Z=()=>!1;if(Y.ignore){let O={...$,ignore:null,onMatch:null,onResult:null};Z=pD(Y.ignore,O,X)}let G=(O,q=!1)=>{let{isMatch:w,match:K,output:W}=pD.test(O,Q,$,{glob:D,posix:F}),H={glob:D,state:U,regex:Q,posix:F,input:O,output:W,match:K,isMatch:w};if(typeof Y.onResult==="function")Y.onResult(H);if(w===!1)return H.isMatch=!1,q?H:!1;if(Z(O)){if(typeof Y.onIgnore==="function")Y.onIgnore(H);return H.isMatch=!1,q?H:!1}if(typeof Y.onMatch==="function")Y.onMatch(H);return q?H:!0};if(X)G.state=U;return G};pD.test=(D,$,X,{glob:J,posix:Y}={})=>{if(typeof D!=="string")throw TypeError("Expected input to be a string");if(D==="")return{isMatch:!1,output:""};let F=X||{},Q=F.format||(Y?OA.toPosixSlashes:null),U=D===J,Z=U&&Q?Q(D):D;if(U===!1)Z=Q?Q(D):D,U=Z===J;if(U===!1||F.capture===!0)if(F.matchBase===!0||F.basename===!0)U=pD.matchBase(D,$,X,Y);else U=$.exec(Z);return{isMatch:Boolean(U),match:U,output:Z}};pD.matchBase=(D,$,X,J=OA.isWindows(X))=>{return($ instanceof RegExp?$:pD.makeRe($,X)).test(di0.basename(D))};pD.isMatch=(D,$,X)=>pD($,X)(D);pD.parse=(D,$)=>{if(Array.isArray(D))return D.map((X)=>pD.parse(X,$));return GA(D,{...$,fastpaths:!1})};pD.scan=(D,$)=>ni0(D,$);pD.compileRe=(D,$,X=!1,J=!1)=>{if(X===!0)return D.output;let Y=$||{},F=Y.contains?"":"^",Q=Y.contains?"":"$",U=`${F}(?:${D.output})${Q}`;if(D&&D.negated===!0)U=`^(?!${U}).*$`;let Z=pD.toRegex(U,$);if(J===!0)Z.state=D;return Z};pD.makeRe=(D,$={},X=!1,J=!1)=>{if(!D||typeof D!=="string")throw TypeError("Expected a non-empty string");let Y={negated:!1,fastpaths:!0};if($.fastpaths!==!1&&(D[0]==="."||D[0]==="*"))Y.output=GA.fastpaths(D,$);if(!Y.output)Y=GA(D,$);return pD.compileRe(Y,$,X,J)};pD.toRegex=(D,$)=>{try{let X=$||{};return new RegExp(D,X.flags||(X.nocase?"i":""))}catch(X){if($&&$.debug===!0)throw X;return/$^/}};pD.constants=li0;o90.exports=pD});var J50=E((yQD,X50)=>{var e90=l("util"),D50=u90(),v6=a90(),qA=ZY(),s90=(D)=>D===""||D==="./",$50=(D)=>{let $=D.indexOf("{");return $>-1&&D.indexOf("}",$)>-1},RD=(D,$,X)=>{$=[].concat($),D=[].concat(D);let J=new Set,Y=new Set,F=new Set,Q=0,U=(O)=>{if(F.add(O.output),X&&X.onResult)X.onResult(O)};for(let O=0;O<$.length;O++){let q=v6(String($[O]),{...X,onResult:U},!0),w=q.state.negated||q.state.negatedExtglob;if(w)Q++;for(let K of D){let W=q(K,!0);if(!(w?!W.isMatch:W.isMatch))continue;if(w)J.add(W.output);else J.delete(W.output),Y.add(W.output)}}let G=(Q===$.length?[...F]:[...Y]).filter((O)=>!J.has(O));if(X&&G.length===0){if(X.failglob===!0)throw Error(`No matches found for "${$.join(", ")}"`);if(X.nonull===!0||X.nullglob===!0)return X.unescape?$.map((O)=>O.replace(/\\/g,"")):$}return G};RD.match=RD;RD.matcher=(D,$)=>v6(D,$);RD.isMatch=(D,$,X)=>v6($,X)(D);RD.any=RD.isMatch;RD.not=(D,$,X={})=>{$=[].concat($).map(String);let J=new Set,Y=[],Q=new Set(RD(D,$,{...X,onResult:(U)=>{if(X.onResult)X.onResult(U);Y.push(U.output)}}));for(let U of Y)if(!Q.has(U))J.add(U);return[...J]};RD.contains=(D,$,X)=>{if(typeof D!=="string")throw TypeError(`Expected a string: "${e90.inspect(D)}"`);if(Array.isArray($))return $.some((J)=>RD.contains(D,J,X));if(typeof $==="string"){if(s90(D)||s90($))return!1;if(D.includes($)||D.startsWith("./")&&D.slice(2).includes($))return!0}return RD.isMatch(D,$,{...X,contains:!0})};RD.matchKeys=(D,$,X)=>{if(!qA.isObject(D))throw TypeError("Expected the first argument to be an object");let J=RD(Object.keys(D),$,X),Y={};for(let F of J)Y[F]=D[F];return Y};RD.some=(D,$,X)=>{let J=[].concat(D);for(let Y of[].concat($)){let F=v6(String(Y),X);if(J.some((Q)=>F(Q)))return!0}return!1};RD.every=(D,$,X)=>{let J=[].concat(D);for(let Y of[].concat($)){let F=v6(String(Y),X);if(!J.every((Q)=>F(Q)))return!1}return!0};RD.all=(D,$,X)=>{if(typeof D!=="string")throw TypeError(`Expected a string: "${e90.inspect(D)}"`);return[].concat($).every((J)=>v6(J,X)(D))};RD.capture=(D,$,X)=>{let J=qA.isWindows(X),F=v6.makeRe(String(D),{...X,capture:!0}).exec(J?qA.toPosixSlashes($):$);if(F)return F.slice(1).map((Q)=>Q===void 0?"":Q)};RD.makeRe=(...D)=>v6.makeRe(...D);RD.scan=(...D)=>v6.scan(...D);RD.parse=(D,$)=>{let X=[];for(let J of[].concat(D||[]))for(let Y of D50(String(J),$))X.push(v6.parse(Y,$));return X};RD.braces=(D,$)=>{if(typeof D!=="string")throw TypeError("Expected a string");if($&&$.nobrace===!0||!$50(D))return[D];return D50(D,$)};RD.braceExpand=(D,$)=>{if(typeof D!=="string")throw TypeError("Expected a string");return RD.braces(D,{...$,expand:!0})};RD.hasBraces=$50;X50.exports=RD});import{existsSync as lp0,readFileSync as ip0}from"node:fs";import{dirname as pp0,join as S3}from"node:path";import{cwd as oO}from"node:process";function VA(D){if(!lp0(D))return;return ip0(D,"utf-8")}function op0(D){let $=[S3(oO(),D,"app","build.gradle"),S3(oO(),D,"app","build.gradle.kts")];for(let X of $){let J=VA(X);if(!J)continue;let Y=J.match(/versionName\s*(?:=\s*)?["']([^"']+)["']/)?.[1],F=J.match(/versionCode\s*(?:=\s*)?(\d+)/)?.[1];if(Y)return{versionName:Y,versionCode:F,source:X}}return}function f50(D,$){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return D.match(new RegExp(`<key>${X}</key>\\s*<string>([^<]+)</string>`))?.[1]?.trim()}function tO(D,$){let J=D.match(new RegExp(`${$}\\s*=\\s*([^;]+);`))?.[1]?.trim();if(!J)return;return J.replace(/"/g,"").trim()}function ap0(D){let $=S3(oO(),D,"App"),X=S3($,"App","Info.plist"),J=S3($,"App.xcodeproj","project.pbxproj"),Y=VA(X),F=VA(J);if(!Y)return;let Q=f50(Y,"CFBundleShortVersionString"),U=f50(Y,"CFBundleVersion");if(Q==="$(MARKETING_VERSION)")Q=F?tO(F,"MARKETING_VERSION"):void 0;if(U==="$(CURRENT_PROJECT_VERSION)")U=F?tO(F,"CURRENT_PROJECT_VERSION"):void 0;if(!Q&&F)Q=tO(F,"MARKETING_VERSION");if(!U&&F)U=tO(F,"CURRENT_PROJECT_VERSION");if(!Q)return;return{versionName:Q,versionCode:U,source:X}}function sp0(D){let $=D?.plugins?.CapacitorUpdater?.version;if(typeof $==="string"&&$.trim().length>0)return $.trim();return}function ep0(D){let $=D?.plugins?.CapacitorUpdater?.defaultChannel;if(typeof $==="string"&&$.trim().length>0)return $.trim();return""}function Dr0(D){let $=D?.plugins?.CapacitorUpdater?.updateUrl;if(typeof $==="string"&&$.trim().length>0)return $.trim();return rp0}async function y50(D,$){let X=$?.plugins?.CapacitorUpdater?.appId,J=$?.appId,Y=X||J;if(!Y)return{ok:!1,error:"Could not resolve app ID from capacitor config. Ensure appId is set in capacitor.config.ts or CapacitorUpdater.appId is configured."};let F=X?"CapacitorUpdater.appId from capacitor config":"top-level appId from capacitor config",Q=sJ($,D),U=D==="android"?op0(Q):ap0(Q);if(!U)return{ok:!1,error:`Unable to resolve native ${D.toUpperCase()} version values from platform files in "${Q}".`};let Z=sp0($),G=Z||U.versionName,O=Z?"CapacitorUpdater.version from capacitor config":`native ${D.toUpperCase()} versionName`,q=S3(oO(),"package.json"),w=pp0(q),K=await U$("@capgo/capacitor-updater",w,q);if(!K)return{ok:!1,error:"Unable to resolve installed @capgo/capacitor-updater version from this project."};return{ok:!0,context:{endpoint:Dr0($),payload:{app_id:Y,device_id:tp0,version_name:"builtin",version_build:G,is_emulator:!1,is_prod:!1,platform:D,plugin_version:K,defaultChannel:ep0($)},nativeSource:U.source,versionBuildSource:O,appIdSource:F}}}function b50(D){let $={};if(D&&typeof D==="object"){for(let[X,J]of Object.entries(D))if(X!=="error"&&X!=="message")$[X]=J}return $}function $r0(D,$){let X=typeof D?.error==="string"?D.error:void 0,J=typeof D?.message==="string"?D.message:void 0,Y=typeof D?.version==="string"?D.version:void 0;if(X==="no_new_version_available"||Y&&Y===$)return{status:"retry",detail:J||"No new version available yet"};if(X)return{status:"failed",detail:`${X}: ${J??"Unknown backend message"}`,errorCode:X,backendMessage:J,extra:b50(D)};if(Y&&Y!==$)return{status:"available",detail:`Update ${Y} is available`,responseVersion:Y};return{status:"failed",detail:`Unexpected response format: ${JSON.stringify(D)}`}}async function g50(D,$){let X;try{X=await fetch(D,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($),signal:AbortSignal.timeout(k50)})}catch(F){if(F instanceof DOMException&&F.name==="TimeoutError")return{success:!1,reason:`Request timed out after ${k50/1000}s — the endpoint did not respond in time.`,backendRefusal:!1};return{success:!1,reason:`Network error: ${F instanceof Error?F.message:String(F)}`,backendRefusal:!1}}let J;try{J=await X.json()}catch{J={error:"invalid_json_response",message:"Non-JSON response from updates endpoint"}}if(!X.ok){let F=typeof J?.error==="string"?J.error:void 0,Q=typeof J?.message==="string"?J.message:void 0;return{success:!1,reason:`HTTP ${X.status}: ${JSON.stringify(J)}`,backendRefusal:!!F,errorCode:F,backendMessage:Q,extra:b50(J)}}let Y=$r0(J,$.version_name);if(Y.status==="available")return{success:!0,availableVersion:Y.responseVersion??""};if(Y.status==="retry")return{success:!1,reason:Y.detail,backendRefusal:!1};return{success:!1,reason:Y.detail,backendRefusal:!!Y.errorCode,errorCode:Y.errorCode,backendMessage:Y.backendMessage,extra:Y.extra}}function h50(D){if(!D.errorCode)return[];let $=[];if(D.errorCode==="disable_auto_update_to_major"){let J=typeof D.extra?.version==="string"?D.extra.version:"unknown",Y=typeof D.extra?.old==="string"?D.extra.old:"unknown";$.push(`Channel policy blocks major upgrades (target ${J}, device baseline ${Y}).`)}let X=Xr0[D.errorCode];if(X)$.push(X.cause),$.push(`Fix: ${X.fix}`),$.push(`Details: ${X.docsUrl||oD}`);else $.push(`Backend returned ${D.errorCode}.`),$.push("Check channel restrictions, app/plugin configuration, and device version values."),$.push(`Troubleshooting guide: ${oD}`);return $}var rp0="https://plugin.capgo.app/updates",tp0="00000000-0000-0000-0000-000000000000",oD="https://capgo.app/docs/plugins/updater/commonproblems/",k50=1e4,Xr0;var m50=r(()=>{_0();Xr0={disable_auto_update_to_major:{cause:"Channel blocks major upgrades and device baseline major does not match the target bundle major.",fix:"Set plugins.CapacitorUpdater.version so its MAJOR matches the bundle MAJOR (e.g. 1.0.0 for bundle 1.x.x), run npx cap sync, and reinstall the native build.",docsUrl:`${oD}#disable_auto_update_to_major`},disable_auto_update_to_minor:{cause:"Channel blocks minor upgrades and the target bundle minor is above the device baseline.",fix:"Upload a bundle within the allowed minor range, or change the channel disable_auto_update policy in the dashboard.",docsUrl:`${oD}#disable_auto_update_to_minor--disable_auto_update_to_patch`},disable_auto_update_to_patch:{cause:"Channel blocks patch upgrades and the target bundle patch is above the device baseline.",fix:"Upload a bundle within the allowed patch range, or change the channel disable_auto_update policy in the dashboard.",docsUrl:`${oD}#disable_auto_update_to_minor--disable_auto_update_to_patch`},disable_auto_update_to_metadata:{cause:"Channel uses metadata-based targeting (version_number) and the device baseline is below the required min_update_version.",fix:"Set plugins.CapacitorUpdater.version to match the installed native version, or adjust min_update_version on the channel.",docsUrl:`${oD}#disable_auto_update_to_metadata`},disable_auto_update_under_native:{cause:"Channel prevents downgrades below the native app version.",fix:"Upload a bundle with version >= native baseline, or disable the under-native downgrade protection on the channel.",docsUrl:`${oD}#disable_auto_update_under_native`},misconfigured_channel:{cause:"Channel has disable_auto_update=version_number but min_update_version is missing.",fix:"Set a valid min_update_version on the channel, or change disable_auto_update to a different mode."},cannot_update_via_private_channel:{cause:"The selected channel does not allow device self-assignment.",fix:"Use a channel with self-assignment enabled, or enable self-assignment / make the channel public.",docsUrl:`${oD}#cannot_update_via_private_channel`},semver_error:{cause:"version_build sent to the backend is not valid semver (expected x.y.z).",fix:"Set plugins.CapacitorUpdater.version to a valid semver like 1.2.3, run npx cap sync, and rebuild native.",docsUrl:`${oD}#unknown_version_build--semver_error`},unknown_version_build:{cause:"Backend received version_build=unknown (device baseline version is missing).",fix:"Set plugins.CapacitorUpdater.version in capacitor.config.*, run npx cap sync, and rebuild native.",docsUrl:`${oD}#unknown_version_build--semver_error`},unsupported_plugin_version:{cause:"Installed @capgo/capacitor-updater is too old for the current backend.",fix:"Run npm install @capgo/capacitor-updater@latest, then npx cap sync, and rebuild native.",docsUrl:`${oD}#unsupported_plugin_version`},key_id_mismatch:{cause:"Bundle encryption key and device key differ.",fix:"Ensure the same public key is used in app config and when encrypting bundles, then re-upload the bundle.",docsUrl:`${oD}#key_id_mismatch`},disabled_platform_ios:{cause:"Channel has iOS updates disabled.",fix:"Enable the iOS platform toggle on the target channel in the dashboard.",docsUrl:`${oD}#disabled_platform_ios--disabled_platform_android`},disabled_platform_android:{cause:"Channel has Android updates disabled.",fix:"Enable the Android platform toggle on the target channel in the dashboard.",docsUrl:`${oD}#disabled_platform_ios--disabled_platform_android`},disabled_platform_electron:{cause:"Channel has Electron updates disabled.",fix:"Enable the Electron platform toggle on the target channel in the dashboard."},disable_prod_build:{cause:"Channel blocks production builds (allow_prod is off).",fix:"Enable allow_prod on the channel, or test with a development build.",docsUrl:`${oD}#disable_prod_build--disable_dev_build--disable_device--disable_emulator`},disable_dev_build:{cause:"Channel blocks development builds (allow_dev is off).",fix:"Enable allow_dev on the channel, or test with a production build.",docsUrl:`${oD}#disable_prod_build--disable_dev_build--disable_device--disable_emulator`},disable_device:{cause:"Channel blocks physical devices (allow_device is off).",fix:"Enable allow_device on the channel, or test on an emulator.",docsUrl:`${oD}#disable_prod_build--disable_dev_build--disable_device--disable_emulator`},disable_emulator:{cause:"Channel blocks emulators (allow_emulator is off).",fix:"Enable allow_emulator on the channel, or test on a physical device.",docsUrl:`${oD}#disable_prod_build--disable_dev_build--disable_device--disable_emulator`},no_channel:{cause:"No channel was resolved for this device.",fix:"Set defaultChannel in capacitor.config.* plugins.CapacitorUpdater section, or create a default channel in the dashboard.",docsUrl:`${oD}#no_channel--null_channel_data`},null_channel_data:{cause:"Channel was resolved but contains no usable data.",fix:"Set defaultChannel in capacitor.config.* plugins.CapacitorUpdater section, or verify the channel has a bundle assigned.",docsUrl:`${oD}#no_channel--null_channel_data`},missing_info:{cause:"Request is missing required fields (app_id, device_id, version_build, or platform).",fix:"Check capacitor.config.* for a valid appId and verify the probe payload."},no_bundle:{cause:"Channel resolved a version but no downloadable bundle artifact exists.",fix:"Re-upload the bundle with npx @capgo/cli@latest bundle upload and verify channel assignment."},no_bundle_url:{cause:"Bundle was resolved but its download URL is missing.",fix:"Re-upload the bundle — the storage artifact may be corrupted or missing."},no_url_or_manifest:{cause:"Bundle was resolved but neither URL nor manifest is available.",fix:"Re-upload the bundle — the storage artifact may be corrupted or missing."},already_on_builtin:{cause:"Device is already running the builtin bundle.",fix:"Upload and assign a bundle to the channel for OTA updates to be delivered."},revert_to_builtin_plugin_version_too_old:{cause:"Plugin version is too old for safe builtin revert.",fix:"Run npm install @capgo/capacitor-updater@latest, then npx cap sync, and rebuild native."},on_premise_app:{cause:"App is either flagged as on-premise or does not exist in Capgo Cloud.",fix:"Check that the app_id is registered in Capgo (capgo app add). If it is an on-premise app, configure plugins.CapacitorUpdater.updateUrl to point to your on-prem update endpoint."},need_plan_upgrade:{cause:"Update checks are blocked by plan limits.",fix:"Upgrade your Capgo plan or contact your organization admin."},invalid_json_body:{cause:"Updates endpoint rejected the request body as invalid JSON.",fix:"This is likely a CLI bug — please report it at https://github.com/Cap-go/capgo/issues."},invalid_query_parameters:{cause:"Updates endpoint rejected the query parameters.",fix:"This is likely a CLI bug — please report it at https://github.com/Cap-go/capgo/issues."}}});var l50={};B$(l50,{probeInternal:()=>n50,probe:()=>Yr0});import{exit as Jr0,stdin as c50,stdout as d50}from"node:process";async function n50(D){let $;try{$=(await E0()).config}catch{return{success:!1,error:"Failed to load Capacitor config."}}let X;if(D.platform==="ios"||D.platform==="android")X=D.platform;else if(D.platform)return{success:!1,error:`Invalid platform "${D.platform}". Must be "ios" or "android".`};else{if(!(!!c50.isTTY&&!!d50.isTTY))return{success:!1,error:"Platform is required in non-interactive environments. Use --platform ios or --platform android."};let Z=await Q1({message:"Which platform do you want to probe?",options:[{value:"ios",label:"iOS"},{value:"android",label:"Android"}]});if(c0(Z))return{success:!1,error:"Probe cancelled."};X=Z}let J=await y50(X,$);if(!J.ok)return{success:!1,error:`Probe setup failed: ${J.error}`};let Y=J.context,F=await g50(Y.endpoint,Y.payload);l0({channel:"cli-usage",event:"Update Probed",icon:"\uD83D\uDD0E",tags:{update_available:F.success}});let Q={success:F.success,probeResult:F,endpoint:Y.endpoint,platform:X,versionBuild:Y.payload.version_build,versionBuildSource:Y.versionBuildSource,appId:Y.payload.app_id,appIdSource:Y.appIdSource,nativeSource:Y.nativeSource};if(!F.success)Q.hints=h50(F);return Q}async function Yr0(D){B0("Probe Capgo updates endpoint");let $=await n50(D);if($.error)L.error($.error),Jr0(1);L.info(`Endpoint: ${$.endpoint}`),L.info(`Platform: ${$.platform}, version_build: ${$.versionBuild}`),L.info(`version_build source: ${$.versionBuildSource}`),L.info(`app_id: ${$.appId} (${$.appIdSource})`),L.info(`Native values source: ${$.nativeSource}`);let X=$.probeResult;if(X.success)L.success(`Update available: ${X.availableVersion}`);else{if(L.warn(`Reason: ${X.reason}`),X.backendRefusal)L.warn("The backend actively refused the request (not a cache/propagation issue).");if(X.errorCode)L.warn(`Error code: ${X.errorCode}`);if(X.backendMessage)L.warn(`Backend message: ${X.backendMessage}`);if($.hints)for(let J of $.hints)L.warn(` ${J}`)}}var i50=r(()=>{g0();H1();m50();_0()});g0();i9();_0();g0();i9();_0();async function QD0(D,$,X,J={}){let{silent:Y=!1,autoUnlink:F=!1,channelName:Q,requireMatch:U=!1}=J,Z=D.from("channels").select().eq("app_id",$).eq("version",X.id);if(Q)Z=Z.eq("name",Q);let{data:G,error:O}=await Z;if(O){if(!Y)L.error(`Cannot check Version ${$}@${X.name}: ${o(O)}`);throw Error(`Cannot check version ${$}@${X.name}: ${o(O)}`)}if(!G?.length){if(Q&&U){let w=`Version ${$}@${X.name} is not linked to channel ${Q}`;if(!Y)L.error(w);throw Error(w)}return}if(Y&&!F)throw Error(`Version ${$}@${X.name} is used in ${G.length} channel(s)`);if(!Y)B0(`❌ Version ${$}@${X.name} is used in ${G.length} channel${G.length>1?"s":""}`);let q=F;if(!F)q=await kD({message:"unlink it?"})===!0;if(!q)throw L.error("Unlink it first"),Error(`Version ${$}@${X.name} is still linked to channel(s)`);for(let w of G){let K=Y?null:ID();K?.start(`Unlinking channel ${w.name}`);let{error:W}=await D.from("channels").update({version:null}).eq("id",w.id);if(W)throw K?.stop(`Cannot update channel ${w.name} ${o(W)}`),Error(`Cannot update channel ${w.name}: ${o(W)}`);K?.stop(`✅ Channel ${w.name} unlinked`)}if(!Y)M0(`Version unlinked from ${G.length} channel${G.length>1?"s":""}`)}function UD0(D,$){return D.from("channels").insert($).select().single()}function ZD0(D,$,X,J){return D.from("channels").delete().eq("name",$).eq("app_id",X).single()}function GD0(D,$,X){return D.from("channels").select().eq("app_id",$).eq("name",X).single()}function OD0(D,$,X){return D.from("channel_devices").delete().eq("app_id",$).eq("channel_id",X)}function qD0(D,$,X){return D.from("channels").select(`
|
|
455
455
|
id,
|
|
456
456
|
version (id, name)
|
|
457
457
|
`).eq("app_id",$).eq("name",X).single().throwOnError().then(({data:J})=>J?.version)}function wD0(D,$=!1){if($)return;let X=new G$;X.theme=G$.roundTheme,X.headers=["Name","Version","Public","iOS","Android","Auto Update","Native Auto Update","Device Self Set","Emulator","Device","Dev","Prod"],X.rows=[];for(let J of D.toReversed())X.rows.push([J.name,J.version?.name,J.public?"✅":"❌",J.ios?"✅":"❌",J.android?"✅":"❌",J.disable_auto_update,J.disable_auto_update_under_native?"❌":"✅",J.allow_device_self_set?"✅":"❌",J.allow_emulator?"✅":"❌",J.allow_device?"✅":"❌",J.allow_dev?"✅":"❌",J.allow_prod?"✅":"❌"]);L.success("Channels"),L.success(X.toString())}async function KD0(D,$,X=!1){let{data:J,error:Y}=await D.from("channels").select(`
|
|
@@ -471,7 +471,7 @@ Minimum version required to store current data is: `+F+`.
|
|
|
471
471
|
created_by,
|
|
472
472
|
app_id,
|
|
473
473
|
version (id, name)
|
|
474
|
-
`).eq("app_id",$).order("created_at",{ascending:!1});if(Y){if(!X)L.error(`App ${$} not found in database`);throw Error(`App ${$} not found in database: ${o(Y)}`)}return J}async function oI(D,$,X,J={}){let{silent:Y=!1}=J,{error:F}=await D.from("app_versions").update({deleted:!0}).eq("app_id",$).eq("deleted",!1).eq("name",X);if(F){let Q=`App version ${$}@${X} not found in database`;if(!Y)L.error(Q);throw Error(`${Q}: ${o(F)}`)}}async function iG(D,$,X,J={}){let{silent:Y=!1,autoUnlink:F=!1}=J,Q=await Xk0(D,$,X,{silent:Y});await QD0(D,$,Q,{silent:Y,autoUnlink:F}),await oI(D,$,X,{silent:Y})}function WD0(D,$=!1){if($)return;if(!D.length)throw Error("No bundle found");let X=new G$;X.theme=G$.roundTheme,X.headers=["Version","Created","Keep"],X.rows=[];for(let J of D.toReversed())X.rows.push([J.name,e7(J.created_at),J.keep??""]);L.success("Bundles"),L.success(X.toString())}async function pG(D,$,X={}){let{silent:J=!1}=X,{data:Y,error:F}=await D.from("app_versions").select().eq("app_id",$).eq("deleted",!1).order("created_at",{ascending:!1});if(F){let Q=`App ${$} not found in database`;if(!J)L.error(Q);throw Error(`${Q}: ${o(F)}`)}return Y??[]}async function HD0(D,$,X={}){let{silent:J=!1}=X,{data:Y,error:F}=await D.from("channels").select("version").eq("app_id",$);if(F){let Q=`App ${$} not found in database`;if(!J)L.error(Q);throw Error(`${Q}: ${o(F)}`)}return(Y??[]).map((Q)=>Q.version)}async function Xk0(D,$,X,J={}){let{silent:Y=!1}=J,{data:F,error:Q}=await D.from("app_versions").select().eq("app_id",$).eq("name",X).eq("deleted",!1).single();if(!F||Q){let U=`App version ${$}@${X} doesn't exist`;if(!Y)L.error(U);throw Error(`${U}${Q?`: ${o(Q)}`:""}`)}return F}g0();H1();import{existsSync as PD0,readFileSync as SD0}from"node:fs";g0();_0();async function CD0(D,$){let{data:X}=await D.rpc("exist_app_v2",{appid:$}).single();return!!X}async function tD(D,$,X=!1){let{data:J,error:Y}=await D.rpc("reject_access_due_to_2fa_for_app",{app_id:$});if(Y){if(!X)L.error(`Cannot check 2FA compliance: ${Y.message}`);throw Error(`Cannot check 2FA compliance: ${Y.message}`)}if(J){if(X)throw Error("2FA required for this organization");pI()}}async function fD(D,$,X,J,Y=!1,F=!1){let Q=E9();if(!F)await tD(D,X,Y);let U=await d00(D,$,X);if(!U.okay)switch(U.error){case"INVALID_APIKEY":{if(!Y)L.error("Invalid apikey, such apikey does not exists!");throw Error("Invalid apikey, such apikey does not exists!")}case"NO_APP":{let O=`App ${X} does not exist, run first \`${Q.runner} @capgo/cli app add ${X}\` to create it`;if(!Y)L.error(O);throw Error(O)}case"NO_ORG":{if(!Y)L.error("Could not find organization, please contact support to resolve this!");throw Error("Could not find organization, please contact support to resolve this!")}}let Z=U.data;if(J>Z){let O=`Insuficcent permissions for app ${X}. Current permission: ${A1[U.data]}, required for this action: ${A1[J]}.`;if(!Y)L.error(O);throw Error(O)}return U.data}var x$="assets/icon.png",rG="public/capgo.png";function D3(D,$){return`org/${D}/${$}/icon`}x1();_0();var Nk0=/^[a-z0-9]+(\.[\w-]+)+$/i;function Vk0(D,$,X){if(!$.apikey){if(!X)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!D){if(!X)L.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(D.includes("--")){if(!X)L.error('The app id includes illegal symbols. You cannot use "--" in the app id');throw Error("App id includes illegal symbols")}if(!Nk0.test(D)){if(!X)L.error(`Invalid app ID format: "${D}"`),L.info("App ID must be in reverse domain notation (e.g., com.example.app)"),L.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),L.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app");throw Error("Invalid app ID format")}}async function Lk0(D,$,X){if(!await CD0(D,$))return;if($==="io.ionic.starter"){if(!X)L.error(`This appId ${$} cannot be used it's reserved, please change it in your capacitor config.`);throw Error("Reserved appId, please change it in capacitor config")}if(!X)L.error(`App ${$} already exist`);throw Error(`App ${$} already exists`)}function Bk0(D){if(D)return D;return TD0()==="mcp"?"mcp":"cli-direct"}async function vD0(D,$,X,J=!1,Y){if(!J)B0("Adding");if(!J)await ND();$.apikey=$.apikey||z0();let F=await E0(),Q=i0(D,F?.config);Vk0(Q,$,J);let U=await C0($.apikey,$.supaHost,$.supaAnon),Z=await $D(U,$.apikey);if(await Lk0(U,Q,J),!X)X=await e00(U,$.apikey,"org.create_app");let G=X.gid;await uJ(U,$.apikey,"org.create_app",{orgId:G},{message:`Insufficient permissions to create an app in organization ${G}`,silent:J});let{name:O,icon:q}=$;if(O=O||F.config?.appName||"Unknown",q=q||"resources/icon.png",!q||!O){if(!J)L.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project");throw Error("Missing app name or icon path")}if(!J)L.info(`Adding ${Q} to Capgo`);let w=null,K=null;if(PD0(q)){if(w=SD0(q),K=Y8(q)||"image/png",!J)L.warn(`Found app icon ${q}`)}else if(PD0(x$)){if(w=SD0(x$),K=Y8(x$)||"image/png",!J)L.warn(`Found app icon ${x$}`)}else if(!J)L.warn(`Cannot find app icon in any of the following locations: ${q}, ${x$}`);let W=D3(G,Q),H=rG;if(w&&K){let{error:M}=await U.storage.from("images").upload(W,w,{contentType:K,upsert:!0});if(M){if(!J)L.error(`Could not add app ${o(M)}`);throw Error(`Could not add app ${o(M)}`)}H=W}let{error:B}=await U.from("apps").insert({icon_url:H,owner_org:G,user_id:Z,name:O,app_id:Q});if(B){if(!J)L.error(`Could not add app ${o(B)}`);throw Error(`Could not add app ${o(B)}`)}if(await I0($.apikey,{channel:"app",event:"App Created",icon:"\uD83C\uDD95",org_id:G,tracking_version:2,tags:{"app-id":Q,source:Bk0(Y)},notify:!1,notifyConsole:!0}).catch(()=>{}),!J)L.success(`App ${Q} added to Capgo`),L.info("This app is accessible to all members of your organization based on their permissions"),L.info(`Next step: upload a bundle with "npx @capgo/cli bundle upload ${Q}"`),M0("Done ✅");return{appId:Q,organizationUid:G,userId:Z,name:O,iconUrl:H,signedURL:H}}g0();_0();async function uD0(D,$,X=!1,J=!1){if(!X)B0("Deleting");$.apikey=$.apikey||z0();let Y=await E0(),F=i0(D,Y?.config);if(!$.apikey){if(!X)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!F){if(!X)L.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let Q=await C0($.apikey,$.supaHost,$.supaAnon),U=await $D(Q,$.apikey);await fD(Q,$.apikey,F,5,X);let{data:Z,error:G}=await Q.from("apps").select("owner_org ( created_by, id )").eq("app_id",F).single(),O=Z;if(!J&&!G&&(O?.owner_org.created_by??"")!==U)if(!X){L.warn("Deleting the app is not recommended for users that are not the organization owner"),L.warn("You are invited as a super_admin but your are not the owner"),L.warn("It's strongly recommended that you do not continue!");let H=await Q1({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(c0(H)||H==="no")throw L.error("Canceled deleting the app, exiting"),Error("App deletion cancelled")}else throw Error("Cannot delete app: you are not the organization owner");else if(G&&!X)L.warn(`Cannot get the app owner ${o(G)}`);let{error:q}=O?.owner_org.id?await Q.storage.from("images").remove([D3(O.owner_org.id,F)]):{error:null};if(q&&!X)L.error("Could not delete app logo");let{error:w}=await Q.storage.from(`apps/${F}/${U}`).remove(["versions"]);if(w&&!X)L.error("Could not delete app version");let{error:K}=await Q.from("apps").delete().eq("app_id",F);if(K){if(!X)L.error("Could not delete app");throw Error(`Could not delete app: ${o(K)}`)}let W=await rD(Q,F);if(await I0($.apikey,{channel:"app",event:"App Deleted",icon:"\uD83D\uDDD1️",org_id:W,tracking_version:2,tags:{"app-id":F},notify:!1}).catch(()=>{}),!X)L.success("App deleted in Capgo"),M0("Done ✅");return!0}g0();T4();H1();_0();import{platform as Mk0,version as Ik0}from"node:os";import{version as jk0}from"node:process";async function xD0(D){let $={},X=Object.keys(D);return(await Promise.all(X.map((Y)=>aF(Y)))).forEach((Y,F)=>{if(Y)$[X[F]]=Y}),$}async function Ek0(){let D=await yG(),$={"@capgo/cli":B1.version};for(let[X,J]of D)if(X.startsWith("@capgo/")||X.startsWith("@capawesome/")||X.startsWith("capacitor"))$[X]=J;return $}function Ak0(D,$){let X=Object.keys(D),J=0;for(let Y of X){let F=D[Y],Q=$[Y];if(F&&Q&&F!==Q)J+=1}return{is_outdated:J>0,dependency_count:X.length,outdated_count:J}}async function _D0(D,$=!1){if(!$)L.warn(" \uD83D\uDC8A Capgo Doctor \uD83D\uDC8A");let X=await E0(),J=J8("",D.packageJson),Y=X?.config?.plugins?.CapacitorUpdater?.version||J,F=X?.config?.appName||"",Q=i0("",X?.config),U=X?.config?.webDir||"";if(!$)L.info(` App Name: ${F}`),L.info(` App ID: ${Q}`),L.info(` App Version: ${Y}`),L.info(` Web Dir: ${U}`),L.info(` OS: ${Mk0()} ${Ik0()}`),L.info(` Node: ${jk0}`),L.info(" Installed Dependencies:");let Z=await Ek0();if(Object.keys(Z).length===0){if(!$)L.warning("\x1B[31m%s\x1B[0m \uD83D\uDEA8 No dependencies found");throw Error("No dependencies found")}if(!$)for(let O of Object.keys(Z))L.info(` ${O}: ${Z[O]}`);let G={};if(!$){let O=ID();O.start("Running: Loading latest dependencies"),G=await xD0(Z),O.stop("Latest Dependencies:");for(let q of Object.keys(G))L.info(` ${q}: ${G[q]}`)}else G=await xD0(Z);if(l0({channel:"cli-usage",event:"Doctor Ran",icon:"\uD83D\uDC68⚕️",tags:Ak0(Z,G)}),JSON.stringify(Z)!==JSON.stringify(G)){if(!$)L.warn("\x1B[31m\uD83D\uDEA8 Some dependencies are not up to date\x1B[0m");throw Error("Some dependencies are not up to date")}if(!$)L.success("\x1B[32m✅ All dependencies are up to date\x1B[0m");return{appName:F,appId:Q,appVersion:Y,webDir:U,installedDependencies:Z,latestDependencies:G}}g0();i9();H1();x1();_0();function Rk0(D){let $=new G$;$.headers=["Name","id","Created"],$.rows=[];for(let X of D.toReversed())$.rows.push([X.name??"",X.app_id,e7(X.created_at)]);L.success("Apps"),L.success($.toString())}async function Tk0(D,$){let{data:X,error:J}=await IJ("apps.list",()=>D.from("apps").select().order("created_at",{ascending:!1}));if(J){if(!$)L.error("Apps not found");throw Error("Apps not found")}return X??[]}async function fD0(D,$=!1){if(!$)B0("List apps in Capgo");await ND(),D.apikey=D.apikey||z0();let X=await C0(D.apikey,D.supaHost,D.supaAnon);if(await $D(X,D.apikey),!$)L.info("Getting active bundle in Capgo");let J=await Tk0(X,$);if(l0({channel:"app",event:"Apps Listed",icon:"\uD83D\uDCCB",tags:{app_count:J.length}}),!J.length){if(!$)L.error("No apps found");throw Error("No apps found")}if(!$)L.info(`Active app in Capgo: ${J.length}`),Rk0(J),M0("Done ✅");return J}g0();import{existsSync as kD0,readFileSync as yD0}from"node:fs";_0();async function bD0(D,$,X=!1){if(!X)B0("Set app");$.apikey=$.apikey||z0();let J=await E0();if(D=i0(D,J?.config),!$.apikey){if(!X)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!D){if(!X)L.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let Y=await C0($.apikey,$.supaHost,$.supaAnon);await fD(Y,$.apikey,D,4,X);let F=await rD(Y,D),{name:Q,icon:U,retention:Z,exposeMetadata:G,preview:O}=$;if(Z&&Number.isNaN(Number(Z))){if(!X)L.error("retention value must be a number");throw Error("Retention value must be a number")}else if(Z&&Z<0){if(!X)L.error("retention value cannot be less than 0");throw Error("Retention value cannot be less than 0")}else if(Z&&Z>=63113904){if(!X)L.error("retention value cannot be greater than 63113904 seconds (2 years)");throw Error("Retention value cannot be greater than 63113904 seconds (2 years)")}let q,w,K=D3(F,D),W=rG;if(U&&kD0(U)){if(q=yD0(U),w=Y8(U)||"image/png",!X)L.warn(`Found app icon ${U}`)}else if(kD0(x$)){if(q=yD0(x$),w=Y8(x$)||"image/png",!X)L.warn(`Found app icon ${x$}`)}else if(!X)L.warn(`Cannot find app icon in any of the following locations: ${U}, ${x$}`);if(q&&w){let{error:B}=await Y.storage.from("images").upload(K,q,{contentType:w,upsert:!0});if(B){if(!X)L.error(`Could not set app ${o(B)}`);throw Error(`Could not set app: ${o(B)}`)}W=K}let{error:H}=await Y.from("apps").update({icon_url:W,name:Q,retention:!Z?void 0:Z*24*60*60,expose_metadata:G,allow_preview:O}).eq("app_id",D);if(H){if(!X)L.error(`Could not set app ${o(H)}`);throw Error(`Could not set app: ${o(H)}`)}if(await I0($.apikey,{channel:"app",event:"App Updated",icon:"\uD83D\uDCDD",org_id:F,tracking_version:2,tags:{"app-id":D},notify:!1,notifyConsole:!0}).catch(()=>{}),!X)M0("Done ✅");return!0}g0();cU();_0();async function gD0(D,$,X=!1){if(!X)B0("Set a specific setting in capacitor config");if($.bool&&$.string){if(!X)L.error("Bool and string CANNOT be set at the same time");throw Error("Bool and string cannot both be provided")}if(!$.bool&&!$.string){if(!X)L.error("You MUST provide either bool or string as the value");throw Error("Either bool or string value is required")}if($.bool&&$.bool!=="true"&&$.bool!=="false"){if(!X)L.error("Invalid bool");throw Error("Invalid bool value; expected true or false")}try{let J=await E0(),Y=J.config,F=D.split(".");if(F.length===0){if(!X)L.error("Invalid path");throw Error("Invalid config path")}for(let U of F.slice(0,-1)){if(!Object.hasOwn(Y,U))Y[U]={};Y=Y[U]}let Q=$.bool?$.bool==="true":$.string;if(Y[F.at(-1)]=Q,await K7(J,!0),!X)L.success(`Set "${D}" to "${Q}"`)}catch(J){if(!X)L.error(`Cannot set config in capacitor settings ${o(J)}`);throw Error(`Cannot set capacitor config: ${o(J)}`)}if(!X)M0("Done ✅")}g0();var o40=JD(Vw(),1);import{Buffer as l40}from"node:buffer";import{existsSync as S6,readdirSync as PE,readFileSync as RE,statSync as vd0}from"node:fs";import{mkdir as ud0,readFile as PO,rm as xd0,stat as _d0,writeFile as fd0}from"node:fs/promises";import{tmpdir as kd0}from"node:os";import{basename as i40,join as Z$,resolve as TE}from"node:path";import p1,{chdir as p40,cwd as CE,exit as EYD}from"node:process";if(!globalThis.EventTarget||!globalThis.Event)console.error(`
|
|
474
|
+
`).eq("app_id",$).order("created_at",{ascending:!1});if(Y){if(!X)L.error(`App ${$} not found in database`);throw Error(`App ${$} not found in database: ${o(Y)}`)}return J}async function oI(D,$,X,J={}){let{silent:Y=!1}=J,{error:F}=await D.from("app_versions").update({deleted:!0}).eq("app_id",$).eq("deleted",!1).eq("name",X);if(F){let Q=`App version ${$}@${X} not found in database`;if(!Y)L.error(Q);throw Error(`${Q}: ${o(F)}`)}}async function iG(D,$,X,J={}){let{silent:Y=!1,autoUnlink:F=!1}=J,Q=await Xk0(D,$,X,{silent:Y});await QD0(D,$,Q,{silent:Y,autoUnlink:F}),await oI(D,$,X,{silent:Y})}function WD0(D,$=!1){if($)return;if(!D.length)throw Error("No bundle found");let X=new G$;X.theme=G$.roundTheme,X.headers=["Version","Created","Keep"],X.rows=[];for(let J of D.toReversed())X.rows.push([J.name,e7(J.created_at),J.keep??""]);L.success("Bundles"),L.success(X.toString())}async function pG(D,$,X={}){let{silent:J=!1}=X,{data:Y,error:F}=await D.from("app_versions").select().eq("app_id",$).eq("deleted",!1).order("created_at",{ascending:!1});if(F){let Q=`App ${$} not found in database`;if(!J)L.error(Q);throw Error(`${Q}: ${o(F)}`)}return Y??[]}async function HD0(D,$,X={}){let{silent:J=!1}=X,{data:Y,error:F}=await D.from("channels").select("version").eq("app_id",$);if(F){let Q=`App ${$} not found in database`;if(!J)L.error(Q);throw Error(`${Q}: ${o(F)}`)}return(Y??[]).map((Q)=>Q.version)}async function Xk0(D,$,X,J={}){let{silent:Y=!1}=J,{data:F,error:Q}=await D.from("app_versions").select().eq("app_id",$).eq("name",X).eq("deleted",!1).single();if(!F||Q){let U=`App version ${$}@${X} doesn't exist`;if(!Y)L.error(U);throw Error(`${U}${Q?`: ${o(Q)}`:""}`)}return F}g0();H1();import{existsSync as PD0,readFileSync as SD0}from"node:fs";g0();_0();async function CD0(D,$){let{data:X}=await D.rpc("exist_app_v2",{appid:$}).single();return!!X}async function tD(D,$,X=!1){let{data:J,error:Y}=await D.rpc("reject_access_due_to_2fa_for_app",{app_id:$});if(Y){if(!X)L.error(`Cannot check 2FA compliance: ${Y.message}`);throw Error(`Cannot check 2FA compliance: ${Y.message}`)}if(J){if(X)throw Error("2FA required for this organization");pI()}}async function fD(D,$,X,J,Y=!1,F=!1){let Q=E9();if(!F)await tD(D,X,Y);let U=await d00(D,$,X);if(!U.okay)switch(U.error){case"INVALID_APIKEY":{if(!Y)L.error("Invalid apikey, such apikey does not exists!");throw Error("Invalid apikey, such apikey does not exists!")}case"NO_APP":{let O=`App ${X} does not exist, run first \`${Q.runner} @capgo/cli app add ${X}\` to create it`;if(!Y)L.error(O);throw Error(O)}case"NO_ORG":{if(!Y)L.error("Could not find organization, please contact support to resolve this!");throw Error("Could not find organization, please contact support to resolve this!")}}let Z=U.data;if(J>Z){let O=`Insuficcent permissions for app ${X}. Current permission: ${A1[U.data]}, required for this action: ${A1[J]}.`;if(!Y)L.error(O);throw Error(O)}return U.data}var x$="assets/icon.png",rG="public/capgo.png";function D3(D,$){return`org/${D}/${$}/icon`}x1();_0();var Nk0=/^[a-z0-9]+(\.[\w-]+)+$/i;function Vk0(D,$,X){if(!$.apikey){if(!X)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!D){if(!X)L.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}if(D.includes("--")){if(!X)L.error('The app id includes illegal symbols. You cannot use "--" in the app id');throw Error("App id includes illegal symbols")}if(!Nk0.test(D)){if(!X)L.error(`Invalid app ID format: "${D}"`),L.info("App ID must be in reverse domain notation (e.g., com.example.app)"),L.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),L.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app");throw Error("Invalid app ID format")}}async function Lk0(D,$,X){if(!await CD0(D,$))return;if($==="io.ionic.starter"){if(!X)L.error(`This appId ${$} cannot be used it's reserved, please change it in your capacitor config.`);throw Error("Reserved appId, please change it in capacitor config")}if(!X)L.error(`App ${$} already exist`);throw Error(`App ${$} already exists`)}function Bk0(D){if(D)return D;return TD0()==="mcp"?"mcp":"cli-direct"}async function vD0(D,$,X,J=!1,Y){if(!J)B0("Adding");if(!J)await ND();$.apikey=$.apikey||z0();let F=await E0(),Q=i0(D,F?.config);Vk0(Q,$,J);let U=await C0($.apikey,$.supaHost,$.supaAnon),Z=await $D(U,$.apikey);if(await Lk0(U,Q,J),!X)X=await e00(U,$.apikey,"org.create_app");let G=X.gid;await uJ(U,$.apikey,"org.create_app",{orgId:G},{message:`Insufficient permissions to create an app in organization ${G}`,silent:J});let{name:O,icon:q}=$;if(O=O||F.config?.appName||"Unknown",q=q||"resources/icon.png",!q||!O){if(!J)L.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project");throw Error("Missing app name or icon path")}if(!J)L.info(`Adding ${Q} to Capgo`);let w=null,K=null;if(PD0(q)){if(w=SD0(q),K=Y8(q)||"image/png",!J)L.warn(`Found app icon ${q}`)}else if(PD0(x$)){if(w=SD0(x$),K=Y8(x$)||"image/png",!J)L.warn(`Found app icon ${x$}`)}else if(!J)L.warn(`Cannot find app icon in any of the following locations: ${q}, ${x$}`);let W=D3(G,Q),H=rG;if(w&&K){let{error:M}=await U.storage.from("images").upload(W,w,{contentType:K,upsert:!0});if(M){if(!J)L.error(`Could not add app ${o(M)}`);throw Error(`Could not add app ${o(M)}`)}H=W}let{error:B}=await U.from("apps").insert({icon_url:H,owner_org:G,user_id:Z,name:O,app_id:Q});if(B){if(!J)L.error(`Could not add app ${o(B)}`);throw Error(`Could not add app ${o(B)}`)}if(await I0($.apikey,{channel:"app",event:"App Created",icon:"\uD83C\uDD95",org_id:G,tracking_version:2,tags:{"app-id":Q,source:Bk0(Y)},notify:!1,notifyConsole:!0}).catch(()=>{}),!J)L.success(`App ${Q} added to Capgo`),L.info("This app is accessible to all members of your organization based on their permissions"),L.info(`Next step: upload a bundle with "npx @capgo/cli bundle upload ${Q}"`),M0("Done ✅");return{appId:Q,organizationUid:G,userId:Z,name:O,iconUrl:H,signedURL:H}}g0();_0();async function uD0(D,$,X=!1,J=!1){if(!X)B0("Deleting");$.apikey=$.apikey||z0();let Y=await E0(),F=i0(D,Y?.config);if(!$.apikey){if(!X)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!F){if(!X)L.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let Q=await C0($.apikey,$.supaHost,$.supaAnon),U=await $D(Q,$.apikey);await fD(Q,$.apikey,F,5,X);let{data:Z,error:G}=await Q.from("apps").select("owner_org ( created_by, id )").eq("app_id",F).single(),O=Z;if(!J&&!G&&(O?.owner_org.created_by??"")!==U)if(!X){L.warn("Deleting the app is not recommended for users that are not the organization owner"),L.warn("You are invited as a super_admin but your are not the owner"),L.warn("It's strongly recommended that you do not continue!");let H=await Q1({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(c0(H)||H==="no")throw L.error("Canceled deleting the app, exiting"),Error("App deletion cancelled")}else throw Error("Cannot delete app: you are not the organization owner");else if(G&&!X)L.warn(`Cannot get the app owner ${o(G)}`);let{error:q}=O?.owner_org.id?await Q.storage.from("images").remove([D3(O.owner_org.id,F)]):{error:null};if(q&&!X)L.error("Could not delete app logo");let{error:w}=await Q.storage.from(`apps/${F}/${U}`).remove(["versions"]);if(w&&!X)L.error("Could not delete app version");let{error:K}=await Q.from("apps").delete().eq("app_id",F);if(K){if(!X)L.error("Could not delete app");throw Error(`Could not delete app: ${o(K)}`)}let W=await rD(Q,F);if(await I0($.apikey,{channel:"app",event:"App Deleted",icon:"\uD83D\uDDD1️",org_id:W,tracking_version:2,tags:{"app-id":F},notify:!1}).catch(()=>{}),!X)L.success("App deleted in Capgo"),M0("Done ✅");return!0}g0();T4();H1();_0();import{platform as Mk0,version as Ik0}from"node:os";import{version as jk0}from"node:process";async function xD0(D){let $={},X=Object.keys(D);return(await Promise.all(X.map((Y)=>aF(Y)))).forEach((Y,F)=>{if(Y)$[X[F]]=Y}),$}async function Ek0(){let D=await yG(),$={"@capgo/cli":B1.version};for(let[X,J]of D)if(X.startsWith("@capgo/")||X.startsWith("@capawesome/")||X.startsWith("capacitor"))$[X]=J;return $}function Ak0(D,$){let X=Object.keys(D),J=0;for(let Y of X){let F=D[Y],Q=$[Y];if(F&&Q&&F!==Q)J+=1}return{is_outdated:J>0,dependency_count:X.length,outdated_count:J}}async function _D0(D,$=!1){if(!$)L.warn(" \uD83D\uDC8A Capgo Doctor \uD83D\uDC8A");let X=await E0(),J=J8("",D.packageJson),Y=X?.config?.plugins?.CapacitorUpdater?.version||J,F=X?.config?.appName||"",Q=i0("",X?.config),U=X?.config?.webDir||"";if(!$)L.info(` App Name: ${F}`),L.info(` App ID: ${Q}`),L.info(` App Version: ${Y}`),L.info(` Web Dir: ${U}`),L.info(` OS: ${Mk0()} ${Ik0()}`),L.info(` Node: ${jk0}`),L.info(" Installed Dependencies:");let Z=await Ek0();if(Object.keys(Z).length===0){if(!$)L.warning("\x1B[31m%s\x1B[0m \uD83D\uDEA8 No dependencies found");throw Error("No dependencies found")}if(!$)for(let O of Object.keys(Z))L.info(` ${O}: ${Z[O]}`);let G={};if(!$){let O=ID();O.start("Running: Loading latest dependencies"),G=await xD0(Z),O.stop("Latest Dependencies:");for(let q of Object.keys(G))L.info(` ${q}: ${G[q]}`)}else G=await xD0(Z);if(l0({channel:"cli-usage",event:"Doctor Ran",icon:"\uD83D\uDC68⚕️",tags:Ak0(Z,G)}),JSON.stringify(Z)!==JSON.stringify(G)){if(!$)L.warn("\x1B[31m\uD83D\uDEA8 Some dependencies are not up to date\x1B[0m");throw Error("Some dependencies are not up to date")}if(!$)L.success("\x1B[32m✅ All dependencies are up to date\x1B[0m");return{appName:F,appId:Q,appVersion:Y,webDir:U,installedDependencies:Z,latestDependencies:G}}g0();i9();H1();x1();_0();function Rk0(D){let $=new G$;$.headers=["Name","id","Created"],$.rows=[];for(let X of D.toReversed())$.rows.push([X.name??"",X.app_id,e7(X.created_at)]);L.success("Apps"),L.success($.toString())}async function Tk0(D,$){let{data:X,error:J}=await IJ("apps.list",()=>D.from("apps").select().order("created_at",{ascending:!1}));if(J){if(!$)L.error("Apps not found");throw Error("Apps not found")}return X??[]}async function fD0(D,$=!1){if(!$)B0("List apps in Capgo");await ND(),D.apikey=D.apikey||z0();let X=await C0(D.apikey,D.supaHost,D.supaAnon);if(await $D(X,D.apikey),!$)L.info("Getting active bundle in Capgo");let J=await Tk0(X,$);if(l0({channel:"app",event:"Apps Listed",icon:"\uD83D\uDCCB",tags:{app_count:J.length}}),!J.length){if(!$)L.error("No apps found");throw Error("No apps found")}if(!$)L.info(`Active app in Capgo: ${J.length}`),Rk0(J),M0("Done ✅");return J}g0();import{existsSync as kD0,readFileSync as yD0}from"node:fs";_0();async function bD0(D,$,X=!1){if(!X)B0("Set app");$.apikey=$.apikey||z0();let J=await E0();if(D=i0(D,J?.config),!$.apikey){if(!X)L.error("Missing API key, you need to provide an API key to upload your bundle");throw Error("Missing API key")}if(!D){if(!X)L.error("Missing argument, you need to provide a appId, or be in a capacitor project");throw Error("Missing appId")}let Y=await C0($.apikey,$.supaHost,$.supaAnon);await fD(Y,$.apikey,D,4,X);let F=await rD(Y,D),{name:Q,icon:U,retention:Z,exposeMetadata:G,preview:O}=$;if(Z&&Number.isNaN(Number(Z))){if(!X)L.error("retention value must be a number");throw Error("Retention value must be a number")}else if(Z&&Z<0){if(!X)L.error("retention value cannot be less than 0");throw Error("Retention value cannot be less than 0")}else if(Z&&Z>=63113904){if(!X)L.error("retention value cannot be greater than 63113904 seconds (2 years)");throw Error("Retention value cannot be greater than 63113904 seconds (2 years)")}let q,w,K=D3(F,D),W=rG;if(U&&kD0(U)){if(q=yD0(U),w=Y8(U)||"image/png",!X)L.warn(`Found app icon ${U}`)}else if(kD0(x$)){if(q=yD0(x$),w=Y8(x$)||"image/png",!X)L.warn(`Found app icon ${x$}`)}else if(!X)L.warn(`Cannot find app icon in any of the following locations: ${U}, ${x$}`);if(q&&w){let{error:B}=await Y.storage.from("images").upload(K,q,{contentType:w,upsert:!0});if(B){if(!X)L.error(`Could not set app ${o(B)}`);throw Error(`Could not set app: ${o(B)}`)}W=K}let{error:H}=await Y.from("apps").update({icon_url:W,name:Q,retention:!Z?void 0:Z*24*60*60,expose_metadata:G,allow_preview:O}).eq("app_id",D);if(H){if(!X)L.error(`Could not set app ${o(H)}`);throw Error(`Could not set app: ${o(H)}`)}if(await I0($.apikey,{channel:"app",event:"App Updated",icon:"\uD83D\uDCDD",org_id:F,tracking_version:2,tags:{"app-id":D},notify:!1,notifyConsole:!0}).catch(()=>{}),!X)M0("Done ✅");return!0}g0();cU();_0();async function gD0(D,$,X=!1){if(!X)B0("Set a specific setting in capacitor config");if($.bool&&$.string){if(!X)L.error("Bool and string CANNOT be set at the same time");throw Error("Bool and string cannot both be provided")}if(!$.bool&&!$.string){if(!X)L.error("You MUST provide either bool or string as the value");throw Error("Either bool or string value is required")}if($.bool&&$.bool!=="true"&&$.bool!=="false"){if(!X)L.error("Invalid bool");throw Error("Invalid bool value; expected true or false")}try{let J=await E0(),Y=J.config,F=D.split(".");if(F.length===0){if(!X)L.error("Invalid path");throw Error("Invalid config path")}for(let U of F.slice(0,-1)){if(!Object.hasOwn(Y,U))Y[U]={};Y=Y[U]}let Q=$.bool?$.bool==="true":$.string;if(Y[F.at(-1)]=Q,await K7(J,!0),!X)L.success(`Set "${D}" to "${Q}"`)}catch(J){if(!X)L.error(`Cannot set config in capacitor settings ${o(J)}`);throw Error(`Cannot set capacitor config: ${o(J)}`)}if(!X)M0("Done ✅")}g0();var o40=JD(Vw(),1);import{Buffer as l40}from"node:buffer";import{existsSync as S6,readdirSync as PE,readFileSync as RE,statSync as vd0}from"node:fs";import{mkdir as ud0,readFile as PO,rm as xd0,stat as _d0,writeFile as fd0}from"node:fs/promises";import{tmpdir as kd0}from"node:os";import{basename as i40,join as Z$,resolve as TE}from"node:path";import p1,{chdir as p40,cwd as CE,exit as RYD}from"node:process";if(!globalThis.EventTarget||!globalThis.Event)console.error(`
|
|
475
475
|
PartySocket requires a global 'EventTarget' class to be available!
|
|
476
476
|
You can polyfill this global by adding this to your code before any partysocket imports:
|
|
477
477
|
|
|
@@ -560,7 +560,7 @@ ${J.url}`);return"opened"}let F=D.copyPath($.gzPath),Q=D.reveal?.($.gzPath)===!0
|
|
|
560
560
|
|
|
561
561
|
Please attach the logs file saved at:
|
|
562
562
|
${$.gzPath}${U}`,G=`${N$0(D.body,Z)}${Z}`,O=Mj({to:v9,subject:D.subject,body:G}),q=!0;try{await D.openUrl(O)}catch{q=!1}let w=F?" (copied to your clipboard)":"",K=Q?" A Finder window showing the file is open behind your mail app.":"";if(q)D.print(`Opened an email to ${v9}. Your logs are saved at ${$.gzPath}${w} — attach that file and send.${K} (A readable copy is also at ${$.logPath}.)`);else D.print(`Couldn't open your mail app automatically. Please email ${v9} and attach your logs saved at ${$.gzPath}${w}.${K} (A readable copy is also at ${$.logPath}.)`);return"opened"}import{appendFileSync as gb0,mkdirSync as hb0}from"node:fs";import{homedir as mb0}from"node:os";import{join as B$0}from"node:path";var O3=null;function cb0(){return new Date().toISOString().replace(/[:.]/g,"-")}function db0(D,$){return(D??$).replace(/[^\w.-]/g,"_").slice(0,60)||$}function M$0(D,$=B$0(mb0(),".capgo-credentials","support")){try{return hb0($,{recursive:!0}),O3=B$0($,`internal-${db0(D,"unknown-app")}-${cb0()}.log`),O3}catch{return O3=null,null}}function jj(){return O3}function q3(D){if(!O3)return;try{gb0(O3,`[${new Date().toISOString()}] ${OO(D)}
|
|
563
|
-
`,"utf8")}catch{}}import{readFileSync as nb0}from"node:fs";async function I$0(D){let $;try{$=nb0(D.gzPath).toString("base64")}catch{return null}let X=D.apiHost.replace(/\/+$/,"");try{let J=await fetch(`${X}/build/support_logs`,{method:"POST",headers:{capgkey:D.apikey,"content-type":"application/json"},body:JSON.stringify({appId:D.appId,jobId:D.jobId,gzB64:$}),signal:AbortSignal.timeout(15000)});if(J.status!==200)return null;let Y=await J.json();if(typeof Y.id!=="string"||typeof Y.url!=="string")return null;return{id:Y.id,url:Y.url}}catch{return null}}_0();import{Buffer as Dg0}from"node:buffer";import{homedir as $g0}from"node:os";import{join as Rj}from"node:path";import{cwd as Xg0,env as Jg0}from"node:process";import{randomBytes as lb0}from"node:crypto";import{appendFile as ib0,chmod as RXD,lstat as pb0,mkdir as TXD,readFile as rb0,rename as tb0,rm as ob0,writeFile as ab0}from"node:fs/promises";import{dirname as sb0,join as eb0}from"node:path";async function Ej(D){try{if((await pb0(D)).isSymbolicLink())throw Error(`Refusing to access symbolic link path: ${D}`)}catch($){if($.code!=="ENOENT")throw $}}async function j$0(D,$,X=384){await Ej(D),await ib0(D,$,{mode:X})}async function w3(D,$,X={}){let J=X.mode??384;await Ej(D);let Y=eb0(sb0(D),`.capgo-tmp-${lb0(8).toString("hex")}`);try{await ab0(Y,$,{encoding:X.encoding??"utf-8",mode:J}),await tb0(Y,D)}catch(F){throw await ob0(Y,{force:!0}),F}}async function KO(D){return await Ej(D),await rb0(D,"utf-8")}var Yg0=Rj($g0(),".capgo-credentials"),Fg0=Rj(Yg0,"credentials.json"),Qg0=".capgo-credentials.json",u9=3600,E$0=604800;function Ug0(D){return D?Rj(Xg0(),Qg0):Fg0}function WO(D){let X=D.trim().match(/^(\d+)\s*([smhd])?$/i);if(!X)throw Error("output-retention must be a number with optional unit: s, m, h, d (examples: 1h, 3600s, 2d)");let J=Number.parseInt(X[1],10),Y=(X[2]||"s").toLowerCase(),Q=J*(Y==="s"?1:Y==="m"?60:Y==="h"?3600:86400);if(Q<u9)throw Error(`output-retention must be at least ${u9} seconds (1h)`);if(Q>E$0)throw Error(`output-retention must be at most ${E$0} seconds (7d)`);return Q}function K3(D){if(D===void 0)return!0;if(typeof D==="boolean")return D;let $=D.trim().toLowerCase();if($==="true"||$==="1"||$==="yes")return!0;if($==="false"||$==="0"||$==="no")return!1;throw Error("output-upload must be true/false (examples: --output-upload, --output-upload false)")}function HO(D){if(typeof D==="string"&&D.trim()==="")throw Error("in-app-update-priority must be an integer between 0 and 5");let $=typeof D==="number"?D:Number(D);if(!Number.isInteger($)||$<0||$>5)throw Error("in-app-update-priority must be an integer between 0 and 5");return $}async function Aj(D){try{let $=Ug0(D),X=await KO($);return JSON.parse(X)}catch{return{}}}async function zO(D,$){if($!==void 0){let Y=await Aj($);if(!D){let F=Object.keys(Y);if(F.length===0)return null;return Y[F[0]]||null}return Y[D]||null}let X=await Aj(!0),J=await Aj(!1);if(!D){let Y=Object.keys(X);if(Y.length>0)return X[Y[0]]||null;let F=Object.keys(J);if(F.length===0)return null;return J[F[0]]||null}return X[D]||J[D]||null}function iD(D){return Jg0[D]}function Zg0(){let D={},$=iD("BUILD_CERTIFICATE_BASE64"),X=iD("P12_PASSWORD"),J=iD("APPLE_KEY_ID"),Y=iD("APPLE_ISSUER_ID"),F=iD("APPLE_KEY_CONTENT"),Q=iD("APP_STORE_CONNECT_TEAM_ID"),U=iD("CAPGO_IOS_SCHEME"),Z=iD("CAPGO_IOS_TARGET"),G=iD("CAPGO_IOS_PROVISIONING_MAP"),O=iD("CAPGO_IOS_PROVISIONING_MAP_BASE64"),q=G||(O?Dg0.from(O,"base64").toString("utf-8"):void 0),K=iD("CAPGO_ANDROID_FLAVOR")?.trim()||void 0,W=iD("ANDROID_KEYSTORE_FILE"),H=iD("KEYSTORE_KEY_ALIAS"),B=iD("KEYSTORE_KEY_PASSWORD"),M=iD("KEYSTORE_STORE_PASSWORD"),I=iD("PLAY_CONFIG_JSON"),z=iD("PLAY_STORE_IN_APP_UPDATE_PRIORITY"),N=iD("BUILD_OUTPUT_UPLOAD_ENABLED"),V=iD("BUILD_OUTPUT_RETENTION_SECONDS"),A=iD("SKIP_BUILD_NUMBER_BUMP"),u=iD("CAPGO_IOS_DISTRIBUTION");if($)D.BUILD_CERTIFICATE_BASE64=$;if(X)D.P12_PASSWORD=X;if(J)D.APPLE_KEY_ID=J;if(Y)D.APPLE_ISSUER_ID=Y;if(F)D.APPLE_KEY_CONTENT=F;if(Q)D.APP_STORE_CONNECT_TEAM_ID=Q;if(U)D.CAPGO_IOS_SCHEME=U;if(Z)D.CAPGO_IOS_TARGET=Z;if(u)D.CAPGO_IOS_DISTRIBUTION=u;if(q)D.CAPGO_IOS_PROVISIONING_MAP=q;let _=K?.trim();if(_)D.CAPGO_ANDROID_FLAVOR=_;if(W)D.ANDROID_KEYSTORE_FILE=W;if(H)D.KEYSTORE_KEY_ALIAS=H;if(B)D.KEYSTORE_KEY_PASSWORD=B;if(M)D.KEYSTORE_STORE_PASSWORD=M;if(I)D.PLAY_CONFIG_JSON=I;if(z)D.PLAY_STORE_IN_APP_UPDATE_PRIORITY=String(HO(z));if(N)D.BUILD_OUTPUT_UPLOAD_ENABLED=K3(N)?"true":"false";if(V)D.BUILD_OUTPUT_RETENTION_SECONDS=String(WO(V));if(A)D.SKIP_BUILD_NUMBER_BUMP=K3(A)?"true":"false";return D}async function A$0(D,$,X){let J=await zO(D),Y=Zg0(),F={...J?.[$]||{}};if(Object.assign(F,Y),X)Object.assign(F,X);if($==="android"){let Q=!!F.KEYSTORE_KEY_PASSWORD,U=!!F.KEYSTORE_STORE_PASSWORD;if(Q&&!U)F.KEYSTORE_STORE_PASSWORD=F.KEYSTORE_KEY_PASSWORD;else if(!Q&&U)F.KEYSTORE_KEY_PASSWORD=F.KEYSTORE_STORE_PASSWORD}return Object.keys(F).length>0?F:void 0}import{existsSync as v$0,readFileSync as zg0}from"node:fs";import{resolve as u$0}from"node:path";g0();H1();_0();import{readFileSync as Gg0}from"node:fs";function Pj(D){let $=Gg0(D);return Og0($,D)}function Og0(D,$){let Y=D.indexOf("<?xml"),F=Y!==-1?D.indexOf("</plist>",Y):-1;if(Y===-1||F===-1||F<=Y)throw Error(`No embedded plist found in mobileprovision file: ${$}`);let Q=D.slice(Y,F+8).toString("utf-8"),U=Tj(Q,"Name");if(!U)throw Error(`Mobileprovision file missing required 'Name' key: ${$}`);let Z=Tj(Q,"UUID")||"",G=qg0(Q,"Entitlements","application-identifier")||"",O=G.indexOf("."),q=O!==-1?G.slice(O+1):G;return{name:U,uuid:Z,applicationIdentifier:G,bundleId:q}}function Tj(D,$,X="string"){let J=Cj(X),Y=new RegExp(`<key>${Cj($)}</key>\\s*<${J}>([^<]*)</${J}>`),F=D.match(Y);return F?F[1]:null}function qg0(D,$,X){let J=new RegExp(`<key>${Cj($)}</key>\\s*<dict>([\\s\\S]*?)</dict>`),Y=D.match(J);if(!Y)return null;return Tj(Y[1],X)}function Cj(D){return D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}import{existsSync as Sj,readdirSync as R$0,readFileSync as wg0,writeFileSync as hXD}from"node:fs";import{join as NO}from"node:path";var Kg0=new Set(["com.apple.product-type.application","com.apple.product-type.app-extension","com.apple.product-type.app-extension.messages","com.apple.product-type.app-extension.messages-sticker-pack","com.apple.product-type.application.watchapp2","com.apple.product-type.watchkit2-extension","com.apple.product-type.extensionkit-extension","com.apple.product-type.application.on-demand-install-capable"]);function P$0(D){if(!D)return[];let $=/\w+\s*\/\*[^*]*\*\/\s*=\s*\{[^}]*isa\s*=\s*PBXNativeTarget;[^}]*\}/g,X=[];for(let J of D.matchAll($)){let Y=J[0],F=Y.match(/name\s*=\s*("[^"]*"|[^;\s]+)\s*;/),Q=Y.match(/productType\s*=\s*"([^"]+)"/),U=Y.match(/buildConfigurationList\s*=\s*(\w+)/);if(!F||!Q||!U)continue;let Z=F[1].replace(/^"|"$/g,""),G=Q[1],O=U[1];if(!Kg0.has(G))continue;let q=Wg0(D,O);X.push({name:Z,bundleId:q,productType:G})}return X}function Wg0(D,$){let X=new RegExp(`${C$0($)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*XCConfigurationList;[^}]*\\}`),J=D.match(X);if(!J)return"";let Y=J[0].match(/buildConfigurations\s*=\s*\(([^)]*)\)/);if(!Y)return"";let F=Array.from(Y[1].matchAll(/(\w+)/g),(U)=>U[1]);if(F.length===0)return"";let Q="";for(let U of F){let Z=new RegExp(`${C$0(U)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{(?:[^{}]*\\{[^}]*\\})*[^}]*\\}`),G=D.match(Z);if(!G)continue;let O=G[0],q=O.match(/PRODUCT_BUNDLE_IDENTIFIER\s*=\s*"?([^";\s]+)"?\s*;/);if(!q)continue;let w=O.match(/name\s*=\s*("[^"]*"|[^;\s]+)\s*;/);if((w?w[1].replace(/^"|"$/g,""):"")==="Release")return q[1];if(!Q)Q=q[1]}return Q}function Hg0(D){let $=NO(D,"ios"),X=T$0($);if(X)return X;return T$0(D)}function T$0(D){if(!Sj(D))return null;let $;try{$=R$0(D)}catch{return null}for(let X of $)if(X.endsWith(".xcodeproj")){let J=NO(D,X,"project.pbxproj");if(Sj(J))return J}for(let X of $){let J=NO(D,X),Y;try{Y=R$0(J)}catch{continue}for(let F of Y)if(F.endsWith(".xcodeproj")){let Q=NO(J,F,"project.pbxproj");if(Sj(Q))return Q}}return null}function S$0(D){let $=Hg0(D);if(!$)return null;try{return wg0($,"utf-8")}catch{return null}}function C$0(D){return D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x$0(D,$){let X={},J=[];if($){let Y=S$0($);if(Y)J=P$0(Y)}for(let Y of D){let F=Y.indexOf("="),Q,U;if(F!==-1){if(Q=Y.slice(0,F).trim(),U=Y.slice(F+1).trim(),!Q)throw Error(`Empty bundle ID in provisioning profile entry: "${Y}"`);if(!U)throw Error(`Empty profile path in provisioning profile entry: "${Y}"`)}else{if(U=Y.trim(),!U)throw Error("Empty provisioning profile entry");let w=u$0(U);if(!v$0(w))throw Error(`Provisioning profile not found: ${w}`);let K=Pj(w);if(J.find((H)=>H.bundleId===K.bundleId))Q=K.bundleId;else if(K.bundleId.endsWith(".*")){let H=J.find((B)=>B.productType==="com.apple.product-type.application");if(H)Q=H.bundleId;else Q=K.bundleId}else Q=K.bundleId}let Z=u$0(U);if(!v$0(Z))throw Error(`Provisioning profile not found: ${Z}`);if(X[Q])throw Error(`Duplicate provisioning profile for bundle ID "${Q}". Each bundle ID can only have one profile.`);let O=zg0(Z).toString("base64"),q=Pj(Z);X[Q]={profile:O,name:q.name}}return X}
|
|
563
|
+
`,"utf8")}catch{}}import{readFileSync as nb0}from"node:fs";async function I$0(D){let $;try{$=nb0(D.gzPath).toString("base64")}catch{return null}let X=D.apiHost.replace(/\/+$/,"");try{let J=await fetch(`${X}/build/support_logs`,{method:"POST",headers:{capgkey:D.apikey,"content-type":"application/json"},body:JSON.stringify({appId:D.appId,jobId:D.jobId,gzB64:$}),signal:AbortSignal.timeout(15000)});if(J.status!==200)return null;let Y=await J.json();if(typeof Y.id!=="string"||typeof Y.url!=="string")return null;return{id:Y.id,url:Y.url}}catch{return null}}_0();import{Buffer as Dg0}from"node:buffer";import{homedir as $g0}from"node:os";import{join as Rj}from"node:path";import{cwd as Xg0,env as Jg0}from"node:process";import{randomBytes as lb0}from"node:crypto";import{appendFile as ib0,chmod as RXD,lstat as pb0,mkdir as TXD,readFile as rb0,rename as tb0,rm as ob0,writeFile as ab0}from"node:fs/promises";import{dirname as sb0,join as eb0}from"node:path";async function Ej(D){try{if((await pb0(D)).isSymbolicLink())throw Error(`Refusing to access symbolic link path: ${D}`)}catch($){if($.code!=="ENOENT")throw $}}async function j$0(D,$,X=384){await Ej(D),await ib0(D,$,{mode:X})}async function w3(D,$,X={}){let J=X.mode??384;await Ej(D);let Y=eb0(sb0(D),`.capgo-tmp-${lb0(8).toString("hex")}`);try{await ab0(Y,$,{encoding:X.encoding??"utf-8",mode:J}),await tb0(Y,D)}catch(F){throw await ob0(Y,{force:!0}),F}}async function KO(D){return await Ej(D),await rb0(D,"utf-8")}var Yg0=Rj($g0(),".capgo-credentials"),Fg0=Rj(Yg0,"credentials.json"),Qg0=".capgo-credentials.json",u9=3600,E$0=604800;function Ug0(D){return D?Rj(Xg0(),Qg0):Fg0}function WO(D){let X=D.trim().match(/^(\d+)\s*([smhd])?$/i);if(!X)throw Error("output-retention must be a number with optional unit: s, m, h, d (examples: 1h, 3600s, 2d)");let J=Number.parseInt(X[1],10),Y=(X[2]||"s").toLowerCase(),Q=J*(Y==="s"?1:Y==="m"?60:Y==="h"?3600:86400);if(Q<u9)throw Error(`output-retention must be at least ${u9} seconds (1h)`);if(Q>E$0)throw Error(`output-retention must be at most ${E$0} seconds (7d)`);return Q}function K3(D){if(D===void 0)return!0;if(typeof D==="boolean")return D;let $=D.trim().toLowerCase();if($==="true"||$==="1"||$==="yes")return!0;if($==="false"||$==="0"||$==="no")return!1;throw Error("output-upload must be true/false (examples: --output-upload, --output-upload false)")}function HO(D){if(typeof D==="string"&&D.trim()==="")throw Error("in-app-update-priority must be an integer between 0 and 5");let $=typeof D==="number"?D:Number(D);if(!Number.isInteger($)||$<0||$>5)throw Error("in-app-update-priority must be an integer between 0 and 5");return $}async function Aj(D){try{let $=Ug0(D),X=await KO($);return JSON.parse(X)}catch{return{}}}async function zO(D,$){if($!==void 0){let Y=await Aj($);if(!D){let F=Object.keys(Y);if(F.length===0)return null;return Y[F[0]]||null}return Y[D]||null}let X=await Aj(!0),J=await Aj(!1);if(!D){let Y=Object.keys(X);if(Y.length>0)return X[Y[0]]||null;let F=Object.keys(J);if(F.length===0)return null;return J[F[0]]||null}return X[D]||J[D]||null}function iD(D){return Jg0[D]}function Zg0(){let D={},$=iD("BUILD_CERTIFICATE_BASE64"),X=iD("P12_PASSWORD"),J=iD("APPLE_KEY_ID"),Y=iD("APPLE_ISSUER_ID"),F=iD("APPLE_KEY_CONTENT"),Q=iD("APP_STORE_CONNECT_TEAM_ID"),U=iD("CAPGO_IOS_SCHEME"),Z=iD("CAPGO_IOS_TARGET"),G=iD("CAPGO_IOS_PROVISIONING_MAP"),O=iD("CAPGO_IOS_PROVISIONING_MAP_BASE64"),q=G||(O?Dg0.from(O,"base64").toString("utf-8"):void 0),K=iD("CAPGO_ANDROID_FLAVOR")?.trim()||void 0,W=iD("ANDROID_KEYSTORE_FILE"),H=iD("KEYSTORE_KEY_ALIAS"),B=iD("KEYSTORE_KEY_PASSWORD"),M=iD("KEYSTORE_STORE_PASSWORD"),I=iD("PLAY_CONFIG_JSON"),z=iD("PLAY_STORE_IN_APP_UPDATE_PRIORITY"),N=iD("BUILD_OUTPUT_UPLOAD_ENABLED"),V=iD("BUILD_OUTPUT_RETENTION_SECONDS"),A=iD("SKIP_BUILD_NUMBER_BUMP"),u=iD("CAPGO_IOS_DISTRIBUTION");if($)D.BUILD_CERTIFICATE_BASE64=$;if(X)D.P12_PASSWORD=X;if(J)D.APPLE_KEY_ID=J;if(Y)D.APPLE_ISSUER_ID=Y;if(F)D.APPLE_KEY_CONTENT=F;if(Q)D.APP_STORE_CONNECT_TEAM_ID=Q;if(U)D.CAPGO_IOS_SCHEME=U;if(Z)D.CAPGO_IOS_TARGET=Z;if(u)D.CAPGO_IOS_DISTRIBUTION=u;if(q)D.CAPGO_IOS_PROVISIONING_MAP=q;let _=K?.trim();if(_)D.CAPGO_ANDROID_FLAVOR=_;if(W)D.ANDROID_KEYSTORE_FILE=W;if(H)D.KEYSTORE_KEY_ALIAS=H;if(B)D.KEYSTORE_KEY_PASSWORD=B;if(M)D.KEYSTORE_STORE_PASSWORD=M;if(I)D.PLAY_CONFIG_JSON=I;if(z)D.PLAY_STORE_IN_APP_UPDATE_PRIORITY=String(HO(z));if(N)D.BUILD_OUTPUT_UPLOAD_ENABLED=K3(N)?"true":"false";if(V)D.BUILD_OUTPUT_RETENTION_SECONDS=String(WO(V));if(A)D.SKIP_BUILD_NUMBER_BUMP=K3(A)?"true":"false";return D}async function A$0(D,$,X){let J=await zO(D),Y=Zg0(),F={...J?.[$]||{}};if(Object.assign(F,Y),X)Object.assign(F,X);if($==="android"){let Q=!!F.KEYSTORE_KEY_PASSWORD,U=!!F.KEYSTORE_STORE_PASSWORD;if(Q&&!U)F.KEYSTORE_STORE_PASSWORD=F.KEYSTORE_KEY_PASSWORD;else if(!Q&&U)F.KEYSTORE_KEY_PASSWORD=F.KEYSTORE_STORE_PASSWORD}return Object.keys(F).length>0?F:void 0}import{existsSync as v$0,readFileSync as zg0}from"node:fs";import{resolve as u$0}from"node:path";g0();H1();_0();import{readFileSync as Gg0}from"node:fs";function Pj(D){let $=Gg0(D);return Og0($,D)}function Og0(D,$){let Y=D.indexOf("<?xml"),F=Y!==-1?D.indexOf("</plist>",Y):-1;if(Y===-1||F===-1||F<=Y)throw Error(`No embedded plist found in mobileprovision file: ${$}`);let Q=D.slice(Y,F+8).toString("utf-8"),U=Tj(Q,"Name");if(!U)throw Error(`Mobileprovision file missing required 'Name' key: ${$}`);let Z=Tj(Q,"UUID")||"",G=qg0(Q,"Entitlements","application-identifier")||"",O=G.indexOf("."),q=O!==-1?G.slice(O+1):G;return{name:U,uuid:Z,applicationIdentifier:G,bundleId:q}}function Tj(D,$,X="string"){let J=Cj(X),Y=new RegExp(`<key>${Cj($)}</key>\\s*<${J}>([^<]*)</${J}>`),F=D.match(Y);return F?F[1]:null}function qg0(D,$,X){let J=new RegExp(`<key>${Cj($)}</key>\\s*<dict>([\\s\\S]*?)</dict>`),Y=D.match(J);if(!Y)return null;return Tj(Y[1],X)}function Cj(D){return D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}import{existsSync as Sj,readdirSync as R$0,readFileSync as wg0,writeFileSync as hXD}from"node:fs";import{join as NO}from"node:path";var Kg0=new Set(["com.apple.product-type.application","com.apple.product-type.app-extension","com.apple.product-type.app-extension.messages","com.apple.product-type.app-extension.messages-sticker-pack","com.apple.product-type.application.watchapp2","com.apple.product-type.watchkit2-extension","com.apple.product-type.extensionkit-extension","com.apple.product-type.application.on-demand-install-capable"]);function P$0(D){if(!D)return[];let $=/\w+\s*\/\*[^*]*\*\/\s*=\s*\{[^}]*isa\s*=\s*PBXNativeTarget;[^}]*\}/g,X=[];for(let J of D.matchAll($)){let Y=J[0],F=Y.match(/name\s*=\s*("[^"]*"|[^;\s]+)\s*;/),Q=Y.match(/productType\s*=\s*"([^"]+)"/),U=Y.match(/buildConfigurationList\s*=\s*(\w+)/);if(!F||!Q||!U)continue;let Z=F[1].replace(/^"|"$/g,""),G=Q[1],O=U[1];if(!Kg0.has(G))continue;let q=Wg0(D,O);X.push({name:Z,bundleId:q,productType:G})}return X}function Wg0(D,$){let X=new RegExp(`${C$0($)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{[^}]*isa\\s*=\\s*XCConfigurationList;[^}]*\\}`),J=D.match(X);if(!J)return"";let Y=J[0].match(/buildConfigurations\s*=\s*\(([^)]*)\)/);if(!Y)return"";let F=Array.from(Y[1].matchAll(/(\w+)/g),(U)=>U[1]);if(F.length===0)return"";let Q="";for(let U of F){let Z=new RegExp(`${C$0(U)}\\s*\\/\\*[^*]*\\*\\/\\s*=\\s*\\{(?:[^{}]*\\{[^}]*\\})*[^}]*\\}`),G=D.match(Z);if(!G)continue;let O=G[0],q=O.match(/PRODUCT_BUNDLE_IDENTIFIER\s*=\s*"?([^";\s]+)"?\s*;/);if(!q)continue;let w=O.match(/name\s*=\s*("[^"]*"|[^;\s]+)\s*;/);if((w?w[1].replace(/^"|"$/g,""):"")==="Release")return q[1];if(!Q)Q=q[1]}return Q}function Hg0(D){let $=NO(D,"ios"),X=T$0($);if(X)return X;return T$0(D)}function T$0(D){if(!Sj(D))return null;let $;try{$=R$0(D)}catch{return null}for(let X of $)if(X.endsWith(".xcodeproj")){let J=NO(D,X,"project.pbxproj");if(Sj(J))return J}for(let X of $){let J=NO(D,X),Y;try{Y=R$0(J)}catch{continue}for(let F of Y)if(F.endsWith(".xcodeproj")){let Q=NO(J,F,"project.pbxproj");if(Sj(Q))return Q}}return null}function S$0(D){let $=Hg0(D);if(!$)return null;try{return wg0($,"utf-8")}catch{return null}}function C$0(D){return D.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x$0(D,$){let X={},J=[];if($){let Y=S$0($);if(Y)J=P$0(Y)}for(let Y of D){let F=Y.indexOf("="),Q,U;if(F!==-1){if(Q=Y.slice(0,F).trim(),U=Y.slice(F+1).trim(),!Q)throw Error(`Empty bundle ID in provisioning profile entry: "${Y}"`);if(!U)throw Error(`Empty profile path in provisioning profile entry: "${Y}"`)}else{if(U=Y.trim(),!U)throw Error("Empty provisioning profile entry");let w=u$0(U);if(!v$0(w))throw Error(`Provisioning profile not found: ${w}`);let K=Pj(w);if(J.find((H)=>H.bundleId===K.bundleId))Q=K.bundleId;else if(K.bundleId.endsWith(".*")){let H=J.find((B)=>B.productType==="com.apple.product-type.application");if(H)Q=H.bundleId;else Q=K.bundleId}else Q=K.bundleId}let Z=u$0(U);if(!v$0(Z))throw Error(`Provisioning profile not found: ${Z}`);if(X[Q])throw Error(`Duplicate provisioning profile for bundle ID "${Q}". Each bundle ID can only have one profile.`);let O=zg0(Z).toString("base64"),q=Pj(Z);X[Q]={profile:O,name:q.name}}return X}import{mkdir as Md0,readFile as qYD,writeFile as Id0}from"node:fs/promises";var EE=JD(TO(),1);import{dirname as jd0,join as KYD,resolve as Ed0}from"node:path";import{cwd as Ad0}from"node:process";async function d40(D,$,X){let J=Ed0(Ad0(),D),Y=`${J}.qr.png`;await Md0(jd0(J),{recursive:!0});let F=null,Q=null;if($.outputUrl){try{F=await EE.default.toString($.outputUrl,{type:"utf8",errorCorrectionLevel:"L"})}catch(Z){X?.(`Failed to render ASCII QR code: ${c40(Z)}`)}try{await EE.default.toFile(Y,$.outputUrl,{errorCorrectionLevel:"L",width:512}),Q=Y}catch(Z){X?.(`Failed to render PNG QR code at ${Y}: ${c40(Z)}`)}}let U={schemaVersion:1,jobId:$.jobId,appId:$.appId,platform:$.platform,buildMode:$.buildMode,status:$.status,outputUrl:$.outputUrl??null,qrCodeAscii:F,qrCodePngPath:Q,finishedAt:new Date().toISOString()};return await Id0(J,`${JSON.stringify(U,null,2)}
|
|
564
564
|
`,"utf-8"),U}function c40(D){if(D instanceof Error)return D.message;return String(D)}var n40=JD(TO(),1);async function AE(D,$,X,J){if(D==="qr_download_link"){let Y=$.url;if(typeof Y!=="string"){J("qr_download_link message missing url field");return}try{let F=await n40.default.toString(Y,{type:"utf8",errorCorrectionLevel:"L"});X("");for(let Q of F.split(`
|
|
565
565
|
`))X(Q);X(Y),X("")}catch{X(""),X(Y),X("")}return}J(`Unknown message type "${D}" — you may need to update the CLI`),X(JSON.stringify($,null,2))}_0();function Td0(D){if(!D||typeof D!=="object")return;let $=D.originalResponse?.getStatus?.();return typeof $==="number"?$:void 0}function Cd0(D){let $=Td0(D);if($===401||$===403)return"unauthorized";if($===413)return"payload_too_large";if($!==void 0&&$>=500&&$<600)return"storage_failure";if($===void 0||$===0)return"network_error";return"unknown"}var Pd0={started:"Builder Upload Started",succeeded:"Builder Upload Succeeded",failed:"Builder Upload Failed"},Sd0={started:"⬆️",succeeded:"\uD83D\uDCE6",failed:"\uD83D\uDEAB"};async function CO(D){let $={app_id:D.appId,platform:D.platform,build_mode:D.buildMode,job_id:D.jobId,upload_size_bytes:String(D.sizeBytes)};if(typeof D.durationSeconds==="number"&&Number.isFinite(D.durationSeconds))$.upload_duration_seconds=String(Math.round(D.durationSeconds));if(D.phase==="failed"&&D.error!==void 0)$.failure_category=Cd0(D.error);try{await I0(D.apikey,{event:Pd0[D.phase],channel:"build-lifecycle",icon:Sd0[D.phase],notify:!1,org_id:D.orgId,tracking_version:2,tags:$})}catch{}}async function yd0(){return Q1({message:"No platform selected. Which platform do you want to build?",options:[{value:"ios",label:"iOS"},{value:"android",label:"Android"}]})}async function bd0(D,{silent:$=!1,interactive:X=kG({silent:$}),promptPlatform:J=yd0}={}){if(D==="ios"||D==="android")return D;if(D)throw Error(`Invalid platform "${D}". Must be "ios" or "android"`);if(!X)throw Error("Missing required argument: --platform <ios|android>. In an interactive terminal, you can omit --platform and choose one when prompted.");let Y=await J();if(c0(Y))throw Error("Build request canceled.");if(Y!=="ios"&&Y!=="android")throw Error("Build request canceled.");return Y}function gd0(D){return{info:($)=>{if(!D)L.info($)},error:($)=>{if(!D)L.error($)},warn:($)=>{if(!D)L.warn($)},success:($)=>{if(!D)L.success($)},buildLog:($)=>{if(!D)console.log($)},uploadProgress:(()=>{let $=D?null:ID(),X=!1;return(J)=>{if(D||!$)return;if(!X)$.start("Uploading bundle"),X=!0;if(J>=100)$.stop("Upload complete!");else $.message(`Uploading ${J.toFixed(0)}%`)}})(),customMsg:async($,X)=>{if(!D)await AE($,X,(J)=>console.log(J),(J)=>L.warn(J))}}}var r40=Promise.resolve();async function hd0(D,$){let X=async()=>{let Y=CE();try{p40(D)}catch(F){throw Error(`Failed to change working directory to "${D}": ${F.message}`)}try{return await $()}finally{try{p40(Y)}catch(F){q3(`cwd restore failed (ignored): ${F instanceof Error?F.message:String(F)}`)}}},J=r40.then(X,X);return r40=J.then(()=>{return},()=>{return}),J}async function md0(D,$,X=3,J){let Y=[1000,3000,5000];for(let F=1;F<=X;F++)try{let Q=await fetch(D,$);if(Q.ok||Q.status>=400&&Q.status<500)return Q;let U=await Q.text().catch(()=>"unknown error");if(J?.warn(`Build request attempt ${F}/${X} failed: ${Q.status} - ${U}`),F<X){let Z=Y[F-1]||5000;J?.info(`Retrying in ${Z/1000}s...`),await new Promise((G)=>setTimeout(G,Z))}else throw Error(`Failed to request build after ${X} attempts: ${Q.status} - ${U}`)}catch(Q){let U=Q instanceof Error?Q.message:String(Q);if(U.startsWith("Failed to request build after"))throw Q;if(J?.warn(`Build request attempt ${F}/${X} failed: ${U}`),F<X){let Z=Y[F-1]||5000;J?.info(`Retrying in ${Z/1000}s...`),await new Promise((G)=>setTimeout(G,Z))}else throw Error(`Failed to request build after ${X} attempts: ${U}`)}throw Error("Unexpected error in fetchWithRetry")}var cd0=["succeeded","failed","expired","released","cancelled"],SO=new Set(cd0);function dd0(D){if(typeof D.data==="string")return D.data;if(D.data instanceof ArrayBuffer)return new TextDecoder().decode(D.data);if(ArrayBuffer.isView(D.data)){let $=D.data;return new TextDecoder().decode(new Uint8Array($.buffer,$.byteOffset,$.byteLength))}if(D.data&&typeof D.data.toString==="function")return D.data.toString();return""}function a40(D,$,X){if($)$.warn(D);else if(!X)L.warn(D)}async function nd0(D,$,X,J){try{if(X)await X.customMsg(D,$);else if(!J)await AE(D,$,(Y)=>console.log(Y),(Y)=>L.warn(Y))}catch(Y){a40(`Custom message handler encountered an error, continuing... ${String(Y)}`,X,J)}}async function ld0(D,$=!1,X,J,Y,F,Q,U){if(D&&!U)return null;let Z=null,G=!1,O=(w)=>{if(!w.trim())return;if(Z)return;if(!G)if(G=!0,U)U.buildLog("");else console.log("");if(U)U.buildLog(w);else console.log(w)},q=async()=>{if(!X||!J)return null;let w=X.replace(/\/+$/,""),K=`${w}/start`,H=`${w}/stream?token=${encodeURIComponent(J)}`.replace(/^https:/,"wss:").replace(/^http:/,"ws:");if(U)U.info("Connecting to log streaming...");else if(!D)console.log("Connecting to log streaming...");let B=await fetch(K,{method:"POST",headers:{"x-capgo-log-token":J}});if(!B.ok){let M=await B.text().catch(()=>"unknown error");if(U)U.warn(`Could not start log session (${B.status}): ${M}`);else if(!D)console.warn(`Could not start log session (${B.status}): ${M}`);return null}return await new Promise((M)=>{let I=!1,z=10,N=0,V=!1,A=new _J(H,void 0,{maxRetries:z,WebSocket:l10}),u=null,_=0,j=Date.now(),x=!1,P=2000,m=4,b=SO,p=null,k=null,R=(h)=>{if(I)return;if(I=!0,k)clearTimeout(k),k=null;if(u)clearInterval(u),u=null;if(F&&p)F.removeEventListener("abort",p),p=null;try{A.close()}catch(y){q3(`ws.close failed during cleanup (ignored): ${y instanceof Error?y.message:String(y)}`)}M(h)};k=setTimeout(()=>{if(!I){if(U)U.warn("Log streaming timed out after 3 hours");else if(!D)console.warn("Log streaming timed out after 3 hours");R(null)}},10800000);let S=()=>{if(u)return;u=setInterval(async()=>{try{if(A.readyState===_J.OPEN)A.send(JSON.stringify({type:"heartbeat",lastId:_}));let h=Date.now();if(Y&&!x&&h-j>=P*m){x=!0;try{let y=await Y();if(y&&b.has(y))Z=y,R(Z)}finally{x=!1}}}catch(h){if(U)U.warn(`Heartbeat encountered an error, continuing... ${String(h)}`);else if(!D)L.warn(`Heartbeat encountered an error, continuing... ${String(h)}`)}},P)},v=async(h)=>{if(h.type==="custom_msg"&&typeof h.kind==="string"&&h.data){j=Date.now(),await nd0(h.kind,h.data,U,D);return}if(h.type==="status"&&typeof h.status==="string"){let y=h.status.toLowerCase();if(j=Date.now(),b.has(y))Z=y;return}if(h.type==="log"&&typeof h.message==="string"){j=Date.now(),O(h.message);return}if(typeof h.message==="string")j=Date.now(),O(h.message)},f=(h)=>{if(A.readyState!==_J.OPEN)return;try{A.send(JSON.stringify({type:"confirmed_received",lastId:h}))}catch(y){a40(`Failed to send log confirmation, continuing... ${String(y)}`,U,D)}};if(S(),F){if(p=()=>{if(!I)R("cancelled")},F.aborted){R("cancelled");return}F.addEventListener("abort",p)}A.addEventListener("message",async(h)=>{let y=dd0(h),a=null;try{a=JSON.parse(y)}catch{a=null}if(a?.type==="heartbeat_response")return;if(a?.type==="batch_messages"&&Array.isArray(a.messages)){let c=_;for(let t of a.messages)if(await v(t),typeof t.id==="number")c=Math.max(c,t.id);if(c>_)_=c,f(c)}else{if(a)await v(a);else if(y)j=Date.now(),O(y);if(a&&typeof a.id==="number"&&a.id>_)_=a.id,f(a.id)}if(Z)R(Z)}),A.addEventListener("error",()=>{if(N+=1,U)U.warn(`Log stream encountered an error, retrying (${N}/${z})...`);else if(!D)console.warn(`Log stream encountered an error, retrying (${N}/${z})...`);if(!V&&N>=z){if(V=!0,U)U.warn("Log stream retry limit reached. Falling back to status checks.");else if(!D)L.warn("Log stream retry limit reached. Falling back to status checks.");if(Q)Q();R(null)}}),A.addEventListener("close",()=>{if(I)return;if(Z){R(Z);return}if(U)U.warn("Log stream closed, waiting for reconnect...");else if(!D)L.warn("Log stream closed, waiting for reconnect...")})})};try{let w=await q();if(w||Z)return w||Z}catch(w){if(U)U.warn(`Direct log streaming failed${w instanceof Error?`: ${w.message}`:""}`);else if(!D)L.warn(`Direct log streaming failed${w instanceof Error?`: ${w.message}`:""}`)}return Z}async function id0(D,$,X,J,Y,F,Q=!1,U,Z){let O=0;while(O<120){if(U?.aborted)return"cancelled";try{let q=await fetch(`${D}/build/status?job_id=${encodeURIComponent($)}&app_id=${encodeURIComponent(X)}&platform=${J}`,{headers:{authorization:Y},signal:U});if(!q.ok){Z?.warn(`Status check failed: ${q.status}`),await new Promise((W)=>setTimeout(W,5000)),O++;continue}let w=await q.json(),K=w.status?.toLowerCase?.()??"";if(Q)Z?.info(`Build status: ${K||w.status}`);if(SO.has(K))return K;await new Promise((W)=>setTimeout(W,5000)),O++}catch(q){if(U?.aborted)return"cancelled";Z?.warn(`Status check error: ${q}`),await new Promise((w)=>setTimeout(w,5000)),O++}}return Z?.warn("Build status polling timed out"),"timeout"}async function pd0(D,$,X){let J=new Set,Y=new Set,F=!1,Q=!1;if($==="ios"){let U=Z$(D,X,"App","CapApp-SPM","Package.swift");if(S6(U)){F=!0;let O=(await PO(U,"utf-8")).matchAll(/\.package\s*\([^)]*path:\s*["'](?:\.\.\/)*node_modules\/([^"']+)["']\s*\)/g);for(let q of O){let w=q[1],K=w.lastIndexOf("node_modules/");if(K!==-1)w=w.substring(K+13);J.add(w)}}let Z=Z$(D,X);if(S6(Z)){let G=[Z$(Z,"App","Podfile"),Z$(Z,"Podfile")];for(let q of PE(Z,{withFileTypes:!0}))if(q.isDirectory())G.push(Z$(Z,q.name,"Podfile"));let O=[...new Set(G)].filter((q)=>S6(q));if(O.length>0)Q=!0;for(let q of O){let K=(await PO(q,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"](?:\.\.\/)+node_modules\/([^'"]+)['"]/g);for(let W of K){let H=W[1],B=H.lastIndexOf("node_modules/");if(B!==-1)H=H.substring(B+13);J.add(H)}}}}else if($==="android"){let U=Z$(D,X,"capacitor.settings.gradle");if(S6(U)){let O=(await PO(U,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let q of O){let w=q[1],K=w.lastIndexOf("node_modules/");if(K!==-1)w=w.substring(K+13);let W=w.replace(/\/(android|capacitor)$/,"");J.add(W)}}let Z=Z$(D,X,"capacitor-cordova-android-plugins","build.gradle");if(S6(Z)){let O=(await PO(Z,"utf-8")).matchAll(/apply\s+from\s*:\s*["'](?:\.\.\/)+node_modules\/([^"']+)["']/g);for(let q of O){let w=q[1],K=w.lastIndexOf("node_modules/");if(K!==-1)w=w.substring(K+13);let W=w.split("/"),H=W[0].startsWith("@")&&W.length>=2?`${W[0]}/${W[1]}`:W[0];Y.add(H)}}}return{packages:J,cordovaPackages:Y,usesSPM:F,usesCocoaPods:Q}}function t40(D,$,X,J){let Y=D.replace(/\\/g,"/");if(Y.startsWith(`${J}/`))return!0;if(Y==="package.json"||Y==="package-lock.json"||Y.startsWith("capacitor.config."))return!0;if(Y.startsWith("resources/"))return!0;if($==="ios"&&Y.startsWith("node_modules/@capacitor/ios/"))return!0;if($==="android"&&Y.startsWith("node_modules/@capacitor/android/"))return!0;if($==="android")for(let F of X.cordovaPackages){let Q=`node_modules/${F}/`;if(Y===`node_modules/${F}/package.json`)return!0;if(Y.startsWith(Q)){let U=Y.slice(Q.length);if(U==="node_modules"||U.startsWith("node_modules/"))continue;return!0}}for(let F of X.packages){let Q=`node_modules/${F}/`;if(Y===`${Q}package.json`)return!0;if($==="android"){if(Y.startsWith(`${Q}android/`))return!0}else if($==="ios"){if(Y.startsWith(`${Q}ios/`))return!0;if(X.usesSPM){if(Y===`${Q}Package.swift`)return!0}if(X.usesCocoaPods||!X.usesSPM){if(Y.startsWith(Q)&&Y.endsWith(".podspec"))return!0}}}return!1}function eJ(D,$,X,J,Y,F){let Q=PE($);for(let U of Q){let Z=Z$($,U),G=X?`${X}/${U}`:U,O=vd0(Z);if(O.isDirectory()){if(U===".git"||U==="dist"||U==="build"||U===".angular"||U===".vite"||U===".gradle"||U===".idea"||U===".swiftpm")continue;if(U==="node_modules"){eJ(D,Z,G,J,Y,F);continue}if(U==="resources"){eJ(D,Z,G,J,Y,F);continue}let q=G.replace(/\\/g,"/"),w=[...Y.packages,...Y.cordovaPackages];if(t40(G,J,Y,F)||F===q||F.startsWith(`${q}/`)||w.some((W)=>{return`node_modules/${W}/`.startsWith(`${q}/`)||q.startsWith(`node_modules/${W}`)}))eJ(D,Z,G,J,Y,F)}else if(O.isFile()){if(U===".DS_Store"||U.endsWith(".log"))continue;if(t40(G,J,Y,F))rd0(D,Z,G)}}}function rd0(D,$,X){let J=X.replace(/\\/g,"/");if(D.getEntry(J))return;let Y=J.lastIndexOf("/"),F=Y===-1?void 0:J.slice(0,Y);D.addLocalFile($,F)}function td0(D){if(!D)return[];let $=D.split(",").map((X)=>X.trim()).filter(Boolean).map((X)=>TE(X));return[...new Set($)]}function od0(D,$){let X=new Set([...$.packages,...$.cordovaPackages]);return X.add(D==="ios"?"@capacitor/ios":"@capacitor/android"),X}function ad0(D,$){let X=Z$(D,...$.split("/"));if(S6(X))return X;let J=Z$(D,".pnpm");if(!S6(J))return;let Y=$.replace("/","+"),F=PE(J,{withFileTypes:!0}).filter((Q)=>Q.isDirectory()).map((Q)=>Q.name).filter((Q)=>Q.startsWith(`${Y}@`)).sort();if(F.length>1)throw Error(`Multiple pnpm store entries found for ${$} in ${J}; provide the app-specific node_modules path so the native build archive can use the exact resolved package.`);for(let Q of F){let U=Z$(J,Q,"node_modules",...$.split("/"));if(S6(U))return U}return}function sd0(D,$,X,J,Y){if($.length===0)return;let F=$.filter((Q)=>!S6(Q));if(F.length>0)throw Error(`Missing node_modules folder at ${F.join(", ")}`);for(let Q of $)for(let U of od0(X,J)){let Z=ad0(Q,U);if(!Z)continue;eJ(D,Z,`node_modules/${U}`,X,J,Y)}}async function ed0(D,$,X,J,Y={}){let F=sJ(J,X),Q=await pd0(D,X,F),U=new o40.default;eJ(U,D,"",X,Q,F),sd0(U,td0(Y.nodeModules),X,Q,F);let Z=/node_modules\/\.pnpm\/[^/\n\r]+(?:\/[^/\n\r]+)*\/node_modules\//g,G=/node_modules\/\.bun\/[^/\n\r]+(?:\/[^/\n\r]+)*\/node_modules\//g,O=new Set(["",".gradle",".swift",".json",".lock",".xml",".properties",".pbxproj",".xcconfig",".plist",".podspec",".rb",".yaml",".yml"]);for(let w of U.getEntries()){if(w.isDirectory)continue;let K=w.entryName.includes(".")?`.${w.entryName.split(".").pop()}`:"",W=w.entryName.split("/").pop()||"";if(!O.has(K)&&W!=="Podfile")continue;let H=w.getData().toString("utf-8"),B=H.replace(Z,"node_modules/").replace(G,"node_modules/");if(X==="ios"){let M="../".repeat(w.entryName.split("/").length-1);B=B.replace(/(?:\.\.\/){4,}(ios\/|node_modules\/)/g,(I,z)=>`${M}${z}`)}if(B!==H)U.updateFile(w.entryName,l40.from(B,"utf-8"))}let q=Z$(D,"capacitor.config.json");if(J&&!S6(q)){let w=`${JSON.stringify(J,null,2)}
|
|
566
566
|
`;U.addFile("capacitor.config.json",l40.from(w,"utf-8"))}await fd0($,U.toBuffer())}var Dn0=new Set(["CAPGO_IOS_SCHEME","CAPGO_IOS_TARGET","CAPGO_IOS_DISTRIBUTION","BUILD_OUTPUT_UPLOAD_ENABLED","BUILD_OUTPUT_RETENTION_SECONDS","SKIP_BUILD_NUMBER_BUMP","CAPGO_IOS_SOURCE_DIR","CAPGO_IOS_APP_DIR","CAPGO_IOS_PROJECT_DIR","IOS_PROJECT_DIR","CAPGO_ANDROID_SOURCE_DIR","CAPGO_ANDROID_APP_DIR","CAPGO_ANDROID_PROJECT_DIR","ANDROID_PROJECT_DIR","CAPGO_ANDROID_FLAVOR"]);function $n0(D,$,X,J){let Y={platform:$,buildMode:X,cliVersion:J,iosScheme:D.CAPGO_IOS_SCHEME,iosTarget:D.CAPGO_IOS_TARGET,iosDistribution:D.CAPGO_IOS_DISTRIBUTION,iosSourceDir:D.CAPGO_IOS_SOURCE_DIR,iosAppDir:D.CAPGO_IOS_APP_DIR,iosProjectDir:D.CAPGO_IOS_PROJECT_DIR,androidSourceDir:D.CAPGO_ANDROID_SOURCE_DIR,androidAppDir:D.CAPGO_ANDROID_APP_DIR,androidProjectDir:D.CAPGO_ANDROID_PROJECT_DIR,androidFlavor:D.CAPGO_ANDROID_FLAVOR,outputUploadEnabled:D.BUILD_OUTPUT_UPLOAD_ENABLED==="true",outputRetentionSeconds:D.BUILD_OUTPUT_RETENTION_SECONDS?Number.parseInt(D.BUILD_OUTPUT_RETENTION_SECONDS,10)||u9:u9,skipBuildNumberBump:D.SKIP_BUILD_NUMBER_BUMP==="true"},F={};for(let[Q,U]of Object.entries(D))if(!Dn0.has(Q)&&U!==void 0)F[Q]=U;return{buildOptions:Y,buildCredentials:F}}async function s40(D,$,X=!1,J){if(!jj())M$0(D);q3(`build request: started for ${D} (platform ${$.platform??"auto"})`);let Y=Date.now(),F=$.verbose??!1,Q=J||gd0(X),U=null,Z=$.outputRecord?{...Q,customMsg:async(G,O)=>{if(G==="qr_download_link"&&typeof O.url==="string")U=O.url;await Q.customMsg(G,O)}}:Q;try{$.apikey=$.apikey||z0(X);let G=TE($.path||CE()),O=await hd0(G,()=>E0());if(D=D||O?.config?.appId,!D)throw Error("Missing argument, you need to provide a appId, or be in a capacitor project");let q=await bd0($.platform,{silent:X}),w=$.supaHost||"https://api.capgo.app",K=await C0($.apikey,$.supaHost,$.supaAnon);await uJ(K,$.apikey,"app.build_native",{appId:D},{message:`Insufficient permissions to request a native build for app ${D}`,silent:X});let W=await rD(K,D);if(Z.info(`Requesting native build for ${D}`),Z.info(`Platform: ${q}`),Z.info(`Project: ${G}`),Z.info(`
|
|
@@ -640,4 +640,4 @@ ${$}
|
|
|
640
640
|
`,384);else{let F=dp0();await w3(`${F}/.capgo`,`${D}
|
|
641
641
|
`,{mode:384})}if(await I0(D,{channel:"user-login",event:"User CLI login",icon:"✅",tracking_version:2,notify:!1}).catch(),!X)L.success(`login saved into .capgo file in ${J?"local":"home"} directory`),M0("Done ✅")}g0();x1();_0();async function S50(D,$=!1){if(!$)B0("Adding organization");await ND();let X={...D,apikey:D.apikey||z0()};if(!X.apikey){if(!$)L.error("Missing API key, you need to provide an API key to add an organization");throw Error("Missing API key")}let J=await C0(X.apikey,X.supaHost,X.supaAnon),Y=await $D(J,X.apikey),{name:F,email:Q}=X;if(!$&&!F){let G=await H4({message:"Organization name:",placeholder:"My Organization"});if(c0(G))throw L.error("Canceled adding organization"),Error("Organization creation cancelled");F=G}if(!$&&!Q){let G=await H4({message:"Management email:",placeholder:"admin@example.com"});if(c0(G))throw L.error("Canceled adding organization"),Error("Organization creation cancelled");Q=G}if(!F||!Q){if(!$)L.error("Missing arguments, you need to provide an organization name and management email");throw Error("Missing organization name or management email")}if(!$)L.info(`Adding organization "${F}" to Capgo`);let{data:U,error:Z}=await J.from("orgs").insert({name:F,management_email:Q,created_by:Y}).select().single();if(Z){if(!$)L.error(`Could not add organization ${o(Z)}`);throw Error(`Could not add organization: ${o(Z)}`)}if(await I0(X.apikey,{channel:"organization",event:"Organization Created",icon:"\uD83C\uDFE2",org_id:U.id,tracking_version:2,tags:{"org-name":F},notify:!1}).catch(()=>{}),!$)L.success(`Organization "${F}" added to Capgo`),M0("Done ✅");return U}g0();x1();_0();async function v50(D,$,X=!1){if(!X)B0("Deleting organization");await ND();let J={...$,apikey:$.apikey||z0()};if(!J.apikey){if(!X)L.error("Missing API key, you need to provide an API key to delete an organization");throw Error("Missing API key")}if(!D){if(!X)L.error("Missing argument, you need to provide an organization ID");throw Error("Missing organization id")}let Y=await C0(J.apikey,J.supaHost,J.supaAnon);await nG(Y,J.apikey,"org.delete",D,`Insufficient permissions to delete organization ${D}`,X),await fG(Y,D,X);let{data:F,error:Q}=await Y.from("orgs").select("created_by, name").eq("id",D).single();if(Q||!F){if(!X)L.error(`Cannot get organization details ${o(Q)}`);throw Error(`Cannot get organization details: ${o(Q)}`)}if(!X&&!J.autoConfirm){let Z=await kD({message:`Are you sure you want to delete organization "${F.name}"? This action cannot be undone.`});if(c0(Z)||!Z)throw L.error("Canceled deleting the organization"),Error("Organization deletion cancelled")}if(!X)L.info(`Deleting organization "${F.name}"`);let{error:U}=await Y.from("orgs").delete().eq("id",D);if(U){if(!X)L.error(`Could not delete organization ${o(U)}`);throw Error(`Could not delete organization: ${o(U)}`)}if(await I0(J.apikey,{channel:"organization",event:"Organization Deleted",icon:"\uD83D\uDDD1️",org_id:D,tracking_version:2,tags:{"org-name":F.name},notify:!1}).catch(()=>{}),!X)L.success(`Organization "${F.name}" deleted from Capgo`),M0("Done ✅");return!0}g0();i9();H1();x1();_0();function np0(D,$){if($)return;if(!D.length){L.error("No organizations found");return}let X=new G$;X.headers=["Name","ID","Role","Apps","2FA Required","2FA Access"],X.rows=[];for(let Y of D.toReversed()){let F=Y.enforcing_2fa?"✓ Yes":"✗ No",Q=Y["2fa_has_access"]?"✓ Yes":"✗ No";X.rows.push([Y.name??"Unknown",Y.gid,Y.role,Y.app_count?.toString()||"0",F,Q])}L.success("Organizations"),L.success(X.toString());let J=D.filter((Y)=>Y.enforcing_2fa&&!Y["2fa_has_access"]);if(J.length>0){L.warn(`
|
|
642
642
|
⚠️ You don't have access to ${J.length} organization(s) due to 2FA enforcement:`);for(let Y of J)L.warn(` - ${Y.name} (${Y.gid})`);L.warn(`
|
|
643
|
-
To regain access, enable 2FA on your account at https://web.capgo.app/settings/account`)}}async function u50(D,$=!1){if(!$)B0("List organizations");await ND();let X={...D,apikey:D.apikey||z0()};if(!X.apikey){if(!$)L.error("Missing API key, you need to provide an API key to list organizations");throw Error("Missing API key")}let J=await C0(X.apikey,X.supaHost,X.supaAnon);if(await $D(J,X.apikey),!$)L.info("Getting organizations from Capgo");let{error:Y,data:F}=await J.rpc("get_orgs_v7");if(Y){if(!$)L.error(`Cannot get organizations ${o(Y)}`);throw Error(`Cannot get organizations: ${o(Y)}`)}let Q=F||[];if(l0({channel:"organization",event:"Orgs Listed",icon:"\uD83D\uDCCB",tags:{org_count:Q.length}}),!$)L.info(`Organizations found: ${Q.length}`),np0(Q,$),M0("Done ✅");return Q}g0();x1();_0();async function x50(D,$,X=!1){if(!X)B0("Updating organization");await ND();let J={...$,apikey:$.apikey||z0()};if(!J.apikey){if(!X)L.error("Missing API key, you need to provide an API key to update an organization");throw Error("Missing API key")}if(!D){if(!X)L.error("Missing argument, you need to provide an organization ID");throw Error("Missing organization id")}let Y=await C0(J.apikey,J.supaHost,J.supaAnon);await nG(Y,J.apikey,"org.update_settings",D,`Insufficient permissions to update organization ${D}`,X),await fG(Y,D,X);let{data:F,error:Q}=await Y.from("orgs").select("name, management_email, created_by, enforcing_2fa, password_policy_config, require_apikey_expiration, max_apikey_expiration_days, enforce_hashed_api_keys").eq("id",D).single();if(Q||!F){if(!X)L.error(`Cannot get organization details ${o(Q)}`);throw Error(`Cannot get organization details: ${o(Q)}`)}let{name:U,email:Z,enforce2fa:G}=J,{passwordPolicy:O,minLength:q,requireUppercase:w,requireNumber:K,requireSpecial:W}=J,{requireApikeyExpiration:H,maxApikeyExpirationDays:B,enforceHashedApiKeys:M}=J;if(G!==void 0){if(!X){if(G&&!F.enforcing_2fa){L.info("Checking organization members 2FA status...");let{data:A,error:u}=await Y.rpc("check_org_members_2fa_enabled",{org_id:D});if(u)throw L.error(`Cannot check members 2FA status: ${o(u)}`),Error("Cannot check members 2FA status");let{data:_,error:j}=await Y.rpc("has_2fa_enabled");if(j)throw L.error(`Cannot check your 2FA status: ${o(j)}`),Error("Cannot check your 2FA status");let{data:x,error:P}=await Y.rpc("get_identity_apikey_only",{keymode:["read","upload","write","all"]});if(P||!x)throw L.error(`Cannot get current user identity: ${P?o(P):"No user ID returned"}`),Error("Cannot get current user identity");let m=A?.filter((b)=>!b["2fa_enabled"]&&b.user_id!==x)||[];if(m.length>0||!_){if(L.warn("⚠️ Warning: Enabling 2FA enforcement will affect access"),L.message("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"),!_)L.warn("\uD83D\uDD10 YOU do not have 2FA enabled! By enabling 2FA enforcement, you will LOSE ACCESS to this organization until you enable 2FA on your account.");if(m.length>0){let{data:p,error:k}=await Y.rpc("get_org_members",{guild_id:D});if(k)throw L.error(`Cannot get organization members: ${o(k)}`),Error("Cannot get organization members");let R=new Map(p?.map((h)=>[h.uid,h])||[]),S=m.map((h)=>{return R.get(h.user_id)?.email||h.user_id}),v=m.length===1?"member does":"members do",f=m.length===1?"This member will":"These members will";L.warn(`${m.length} ${v} not have 2FA enabled: ${S.join(", ")}`),L.warn(`${f} lose access until they enable 2FA.`)}let b=await kD({message:"Are you sure you want to enable 2FA enforcement?"});if(c0(b)||!b)throw L.error("Canceled enabling 2FA enforcement"),Error("2FA enforcement cancelled")}L.info("Enabling 2FA enforcement for organization...")}else if(!G&&F.enforcing_2fa)L.info("Disabling 2FA enforcement for organization...")}let{error:N}=await Y.from("orgs").update({enforcing_2fa:G}).eq("id",D);if(N){if(!X)L.error(`Could not update 2FA enforcement: ${o(N)}`);throw Error(`Could not update 2FA enforcement: ${o(N)}`)}if(!X)if(G)L.success("✓ 2FA enforcement enabled for this organization");else L.success("✓ 2FA enforcement disabled for this organization");if(U===void 0&&Z===void 0&&!(O!==void 0||H!==void 0||B!==void 0||M!==void 0)){if(await I0(J.apikey,{channel:"organization",event:G?"Organization 2FA Enabled":"Organization 2FA Disabled",icon:"\uD83D\uDD10",org_id:D,tracking_version:2,tags:{"org-name":F.name,"enforce-2fa":G.toString()},notify:!1}).catch(()=>{}),!X)M0("Done ✅");return{orgId:D,name:F.name,email:F.management_email,enforce2fa:G}}}if(O!==void 0){if(!X)if(O){L.info("Configuring password policy for organization...");let{data:A,error:u}=await Y.rpc("check_org_members_password_policy",{org_id:D});if(u){if(!u.message?.includes("NO_RIGHTS"))L.warn(`Cannot check members password policy status: ${o(u)}`)}else if(A){let _=A.filter((j)=>!j.password_policy_compliant);if(_.length>0){L.warn(`⚠️ Warning: ${_.length} member(s) do not meet the password policy requirements`),L.warn("These members will need to update their passwords to regain access.");let j=await kD({message:"Are you sure you want to enable the password policy?"});if(c0(j)||!j)throw L.error("Canceled enabling password policy"),Error("Password policy configuration cancelled")}}}else L.info("Disabling password policy for organization...");let N={enabled:O,min_length:q??10,require_uppercase:w??!0,require_number:K??!0,require_special:W??!0},{error:V}=await Y.from("orgs").update({password_policy_config:N}).eq("id",D);if(V){if(!X)L.error(`Could not update password policy: ${o(V)}`);throw Error(`Could not update password policy: ${o(V)}`)}if(!X)if(O)L.success("✓ Password policy enabled for this organization"),L.info(` - Minimum length: ${N.min_length} characters`),L.info(` - Require uppercase: ${N.require_uppercase?"Yes":"No"}`),L.info(` - Require number: ${N.require_number?"Yes":"No"}`),L.info(` - Require special character: ${N.require_special?"Yes":"No"}`);else L.success("✓ Password policy disabled for this organization");if(U===void 0&&Z===void 0&&G===void 0&&H===void 0&&B===void 0&&M===void 0){if(await I0(J.apikey,{channel:"organization",event:O?"Password Policy Enabled":"Password Policy Disabled",icon:"\uD83D\uDD11",org_id:D,tracking_version:2,tags:{"org-name":F.name},notify:!1}).catch(()=>{}),!X)M0("Done ✅");return{orgId:D,name:F.name,email:F.management_email,passwordPolicy:O}}}if(H!==void 0||B!==void 0||M!==void 0){if(!X)L.info("Updating API key security settings...");if(B!==void 0&&B!==null){if(B<1||B>365){if(!X)L.error("Maximum API key expiration days must be between 1 and 365");throw Error("Maximum API key expiration days must be between 1 and 365")}}let N={};if(H!==void 0)N.require_apikey_expiration=H;if(B!==void 0)N.max_apikey_expiration_days=B;if(M!==void 0)N.enforce_hashed_api_keys=M;let{error:V}=await Y.from("orgs").update(N).eq("id",D);if(V){if(!X)L.error(`Could not update API key settings: ${o(V)}`);throw Error(`Could not update API key settings: ${o(V)}`)}if(!X){if(H!==void 0)L.success(`✓ API key expiration requirement: ${H?"Enabled":"Disabled"}`);if(B!==void 0)if(B===null)L.success("✓ Maximum API key expiration days: No limit");else L.success(`✓ Maximum API key expiration days: ${B}`);if(M!==void 0)L.success(`✓ Hashed API keys enforcement: ${M?"Enabled":"Disabled"}`)}if(U===void 0&&Z===void 0&&G===void 0&&O===void 0){if(await I0(J.apikey,{channel:"organization",event:"API Key Settings Updated",icon:"\uD83D\uDD10",org_id:D,tracking_version:2,tags:{"org-name":F.name},notify:!1}).catch(()=>{}),!X)M0("Done ✅");return{orgId:D,name:F.name,email:F.management_email}}}if(!X&&!U){let N=await H4({message:"New organization name:",placeholder:F.name||"My Organization"});if(c0(N))throw L.error("Canceled updating organization"),Error("Organization update cancelled");U=N}if(!X&&!Z){let N=await H4({message:"Management email:",placeholder:F.management_email||"admin@example.com"});if(c0(N))throw L.error("Canceled updating organization"),Error("Organization update cancelled");Z=N}if(!U||!Z){if(!X)L.error("Missing arguments, you need to provide an organization name and management email");throw Error("Missing organization name or management email")}if(!X)L.info(`Updating organization "${D}"`);let{error:z}=await Y.from("orgs").update({name:U,management_email:Z}).eq("id",D);if(z){if(!X)L.error(`Could not update organization ${o(z)}`);throw Error(`Could not update organization: ${o(z)}`)}if(await I0(J.apikey,{channel:"organization",event:"Organization Updated",icon:"✏️",org_id:D,tracking_version:2,tags:{"org-name":U},notify:!1}).catch(()=>{}),!X)L.success("Organization updated"),M0("Done ✅");return{orgId:D,name:U,email:Z,enforce2fa:G??F.enforcing_2fa}}g0();H1();_0();async function _50(D,$=!1){if(!$)B0("Getting user id");let X={...D,apikey:D.apikey||z0()};if(!X.apikey){if(!$)L.error("Missing API key, you need to provide an API key to fetch the user id");throw Error("Missing API key")}try{let J=await C0(X.apikey,X.supaHost,X.supaAnon),Y=await $D(J,X.apikey);if(l0({channel:"account",event:"Account Id Viewed",icon:"\uD83E\uDEAA",tags:{}}),!$)M0(`Done ✅: ${Y}`);return Y}catch(J){if(!$)L.error(`Error getting user id ${o(J)}`);throw J instanceof Error?J:Error(String(J))}}_0();AG();_0();AG();function p0(D){let $=D instanceof Error?D.message:String(D),X=l7(D);return{success:!1,error:$,isSecurityPolicyError:X.isSecurityPolicyError,securityPolicyMessage:X.isSecurityPolicyError?X.message:void 0}}class BD{apikey;supaHost;supaAnon;constructor(D){this.apikey=D?.apikey,this.supaHost=D?.supaHost,this.supaAnon=D?.supaAnon}async login(D){try{return await P50(D.apikey,{local:D.local??!1,supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon},!0),{success:!0}}catch($){return p0($)}}async doctor(D){try{return{success:!0,data:await _D0({packageJson:D?.packageJson},!0)}}catch($){return p0($)}}async addApp(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,name:D.name,icon:D.icon};return await vD0(D.appId,$,void 0,!0),{success:!0}}catch($){return p0($)}}async updateApp(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,name:D.name,icon:D.icon,retention:D.retention};return await bD0(D.appId,$,!0),{success:!0}}catch($){return p0($)}}async deleteApp(D,$=!1){try{let X={apikey:this.apikey||z0(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return await uD0(D,X,!1,$),{success:!0}}catch(X){return p0(X)}}async listApps(){try{let D={apikey:this.apikey||z0(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:(await fD0(D,!1)).map((J)=>({appId:J.app_id,name:J.name||"Unknown",iconUrl:J.icon_url||void 0,createdAt:new Date(J.created_at||"")}))}}catch(D){return p0(D)}}async getAccountId(D){try{let $={apikey:D?.apikey||this.apikey||z0(!0),supaHost:D?.supaHost||this.supaHost,supaAnon:D?.supaAnon||this.supaAnon};return{success:!0,data:await _50($,!0)}}catch($){return p0($)}}async starRepo(D){try{let{repository:$,alreadyStarred:X}=rE(D?.repository);return{success:!0,data:{repository:$,alreadyStarred:X}}}catch($){return p0($)}}async starAllRepositories(D){try{return{success:!0,data:await y80(D)}}catch($){return p0($)}}async checkBundleCompatibility(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),channel:D.channel,text:D.textOutput??!1,packageJson:D.packageJson,nodeModules:D.nodeModules,supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon};return{success:!0,data:(await X80(D.appId,$,!0)).finalCompatibility}}catch($){return p0($)}}async encryptBundle(D){try{return{success:!0,data:await H80(D.zipPath,D.checksum,{key:D.keyPath,keyData:D.keyData,json:D.json,packageJson:D.packageJson},!0)}}catch($){return p0($)}}async decryptBundle(D){try{return{success:!0,data:await w80(D.zipPath,D.ivSessionKey,{key:D.keyPath,keyData:D.keyData,checksum:D.checksum,packageJson:D.packageJson},!0)}}catch($){return p0($)}}async zipBundle(D){try{return{success:!0,data:await q50(D.appId,{apikey:this.apikey||z0(!0),path:D.path,bundle:D.bundle,name:D.name,codeCheck:D.codeCheck,json:D.json,keyV2:D.keyV2,packageJson:D.packageJson},!0)}}catch($){return p0($)}}async uploadBundle(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,path:D.path,bundle:D.bundle,channel:D.channel,external:D.external,key:D.encrypt!==!1,keyV2:D.encryptionKey,timeout:D.timeout,tus:D.useTus,comment:D.comment,minUpdateVersion:D.minUpdateVersion,autoMinUpdateVersion:D.autoMinUpdateVersion,selfAssign:D.selfAssign,packageJson:D.packageJsonPaths,ignoreMetadataCheck:D.ignoreCompatibilityCheck,codeCheck:!D.disableCodeCheck,zip:D.useZip},X=await NA(D.appId,$,!0);return{success:X.success,bundleId:X.bundle,checksum:X.checksum??null,encryptionMethod:X.encryptionMethod,sessionKey:X.sessionKey,ivSessionKey:X.ivSessionKey,storageProvider:X.storageProvider,skipped:X.skipped,reason:X.reason}}catch($){return p0($)}}async listBundles(D){try{let $=this.apikey||z0(!0),X=await C0($,this.supaHost,this.supaAnon);return{success:!0,data:(await pG(X,D)).map((F)=>({id:F.id.toString(),version:F.name,uploadedAt:new Date(F.created_at||""),size:0,encrypted:F.session_key!==null}))}}catch($){return p0($)}}async deleteBundle(D,$){try{let X={apikey:this.apikey||z0(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,bundle:$};return await K80($,D,X,!0),{success:!0}}catch(X){return p0(X)}}async cleanupBundles(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,bundle:D.bundle||"",version:"",keep:D.keep||4,force:D.force||!1,ignoreChannel:D.ignoreChannel||!1};return{success:!0,data:await e40(D.appId,$,!0)}}catch($){return p0($)}}async requestBuild(D){try{let $=D.credentials,X={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,path:D.path,nodeModules:D.nodeModules,platform:D.platform,userId:D.userId,buildCertificateBase64:$?.BUILD_CERTIFICATE_BASE64,p12Password:$?.P12_PASSWORD,appleKeyId:$?.APPLE_KEY_ID,appleIssuerId:$?.APPLE_ISSUER_ID,appleKeyContent:$?.APPLE_KEY_CONTENT,appStoreConnectTeamId:$?.APP_STORE_CONNECT_TEAM_ID,iosScheme:$?.CAPGO_IOS_SCHEME,iosTarget:$?.CAPGO_IOS_TARGET,iosDistribution:$?.CAPGO_IOS_DISTRIBUTION,iosProvisioningMap:$?.CAPGO_IOS_PROVISIONING_MAP,androidKeystoreFile:$?.ANDROID_KEYSTORE_FILE,keystoreKeyAlias:$?.KEYSTORE_KEY_ALIAS,keystoreKeyPassword:$?.KEYSTORE_KEY_PASSWORD,keystoreStorePassword:$?.KEYSTORE_STORE_PASSWORD,playConfigJson:$?.PLAY_CONFIG_JSON},J=await s40(D.appId,X,!0);if(J.success&&J.jobId)return{success:!0,data:{jobId:J.jobId,uploadUrl:J.uploadUrl||"",status:J.status||"unknown"}};return{success:!1,error:J.error||"Unknown error during build request"}}catch($){return p0($)}}async getCurrentBundle(D,$,X){try{let J={apikey:X?.apikey||this.apikey||z0(!0),quiet:!0,supaHost:X?.supaHost||this.supaHost,supaAnon:X?.supaAnon||this.supaAnon};return{success:!0,data:await K50($,D,J,!0)}}catch(J){return p0(J)}}async addChannel(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,default:D.default,selfAssign:D.selfAssign};return await w50(D.channelId,D.appId,$,!0),{success:!0}}catch($){return p0($)}}async updateChannel(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,bundle:D.bundle??void 0,state:D.state,downgrade:D.downgrade,ios:D.ios,android:D.android,selfAssign:D.selfAssign,disableAutoUpdate:D.disableAutoUpdate??void 0,dev:D.dev,emulator:D.emulator,device:D.device,prod:D.prod,latest:!1,latestRemote:!1,packageJson:void 0,ignoreMetadataCheck:!1};return await I50(D.channelId,D.appId,$,!0),{success:!0}}catch($){return p0($)}}async deleteChannel(D,$,X=!1){try{let J={apikey:this.apikey||z0(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,deleteBundle:X,successIfNotFound:!1};return await W50(D,$,J,!0),{success:!0}}catch(J){return p0(J)}}async listChannels(D){try{let $={apikey:this.apikey||z0(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:await H50(D,$,!0)}}catch($){return p0($)}}async generateEncryptionKeys(D){try{return await C50({force:D?.force,setupChannel:D?.setupChannel},!0),{success:!0}}catch($){return p0($)}}async saveEncryptionKey(D){try{return await R50({key:D?.keyPath,keyData:D?.keyData,setupChannel:D?.setupChannel},!0),{success:!0}}catch($){return p0($)}}async deleteLegacyEncryptionKey(D){try{return{success:!0,data:{deleted:await T50({force:D?.force,setupChannel:D?.setupChannel},!0)}}}catch($){return p0($)}}async listOrganizations(D){try{let $={apikey:D?.apikey||this.apikey||z0(!0),supaHost:D?.supaHost||this.supaHost,supaAnon:D?.supaAnon||this.supaAnon};return{success:!0,data:(await u50($,!0)).map((Y)=>({id:String(Y.id??Y.gid??""),name:Y.name??"Unknown",role:Y.role??void 0,appCount:typeof Y.app_count==="number"?Y.app_count:void 0,email:Y.management_email??void 0,createdAt:Y.created_at?new Date(Y.created_at):void 0}))}}catch($){return p0($)}}async addOrganization(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,name:D.name,email:D.email},X=await S50($,!0);return{success:!0,data:{id:String(X.id??X.gid??""),name:X.name??D.name,role:"owner",appCount:0,email:X.management_email??D.email,createdAt:X.created_at?new Date(X.created_at):void 0}}}catch($){return p0($)}}async updateOrganization(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,name:D.name,email:D.email},X=await x50(D.orgId,$,!0);return{success:!0,data:{id:X.orgId,name:X.name,email:X.email}}}catch($){return p0($)}}async deleteOrganization(D,$){try{let X={apikey:$?.apikey||this.apikey||z0(!0),supaHost:$?.supaHost||this.supaHost,supaAnon:$?.supaAnon||this.supaAnon,autoConfirm:$?.autoConfirm??!0};return{success:!0,data:{deleted:await v50(D,X,!0)}}}catch(X){return p0(X)}}async getStats(D){try{let $=D.apikey||this.apikey||z0(!0),X=await U6(),J={appId:D.appId,devicesId:D.deviceIds,search:D.search,order:D.order,rangeStart:D.after||D.rangeStart,rangeEnd:D.rangeEnd,limit:D.limit},Y=await fetch(`${X.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:$},body:JSON.stringify(J)});if(!Y.ok)throw Error(`HTTP error! status: ${Y.status}`);return{success:!0,data:(await Y.json()).map((U)=>({appId:U.app_id,deviceId:U.device_id,action:U.action,versionId:U.version_id,version:U.version,createdAt:U.created_at}))}}catch($){return p0($)}}async setAppSetting(D,$){try{return await gD0(D,{apikey:$.apikey||this.apikey||z0(!0),bool:$.bool,string:$.string},!0),{success:!0}}catch(X){return p0(X)}}async probe(D){try{let{probeInternal:$}=await Promise.resolve().then(() => (i50(),l50)),X=await $({platform:D.platform});if(X.error)return{success:!1,error:X.error};return{success:!0,data:X}}catch($){return p0($)}}}async function fGD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).uploadBundle(D)}async function kGD(D){return new BD({supaHost:D.supaHost,supaAnon:D.supaAnon}).login(D)}async function yGD(D){return new BD().doctor(D)}async function bGD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).checkBundleCompatibility(D)}async function gGD(D){return new BD().encryptBundle(D)}async function hGD(D){return new BD().decryptBundle(D)}async function mGD(D){return new BD().zipBundle(D)}async function cGD(D){return new BD().starRepo(D)}async function dGD(D){return new BD().starAllRepositories(D)}async function nGD(D){return new BD().generateEncryptionKeys(D)}async function lGD(D){return new BD().saveEncryptionKey(D)}async function iGD(D){return new BD().deleteLegacyEncryptionKey(D)}async function pGD(D,$,X){return new BD({apikey:X?.apikey,supaHost:X?.supaHost,supaAnon:X?.supaAnon}).getCurrentBundle(D,$,X)}async function rGD(D,$){return new BD({apikey:$.apikey}).setAppSetting(D,$)}async function tGD(D){return new BD({apikey:D?.apikey,supaHost:D?.supaHost,supaAnon:D?.supaAnon}).getAccountId(D)}async function oGD(D){return new BD({apikey:D?.apikey,supaHost:D?.supaHost,supaAnon:D?.supaAnon}).listOrganizations(D)}async function aGD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).addOrganization(D)}async function sGD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).updateOrganization(D)}async function eGD(D,$){return new BD({apikey:$?.apikey,supaHost:$?.supaHost,supaAnon:$?.supaAnon}).deleteOrganization(D,$)}async function DOD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).addApp(D)}async function $OD(D,$){return new BD($).listBundles(D)}async function XOD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).addChannel(D)}async function JOD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).requestBuild(D)}async function YOD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).getStats(D)}async function FOD(D){return new BD().probe(D)}async function QOD(){try{return await E0()}catch{return null}}export{mGD as zipBundle,fGD as uploadBundle,sGD as updateOrganization,rGD as updateAppSetting,cGD as starRepo,dGD as starAllRepositories,lGD as saveEncryptionKey,JOD as requestBuild,FOD as probeUpdates,l7 as parseSecurityPolicyError,kGD as login,oGD as listOrganizations,$OD as listBundles,ie as isSecurityPolicyError,YOD as getStats,n_0 as getSecurityPolicyMessage,pGD as getCurrentBundle,QOD as getCapacitorConfig,tGD as getAccountId,nGD as generateEncryptionKeys,jI as formatApiErrorForCli,gGD as encryptBundle,yGD as doctor,eGD as deleteOrganization,iGD as deleteLegacyEncryptionKey,hGD as decryptBundle,C0 as createSupabaseClient,bGD as checkBundleCompatibility,aGD as addOrganization,XOD as addChannel,DOD as addApp,EG as SECURITY_POLICY_MESSAGES,MJ as SECURITY_POLICY_ERRORS,BD as CapgoSDK};
|
|
643
|
+
To regain access, enable 2FA on your account at https://web.capgo.app/settings/account`)}}async function u50(D,$=!1){if(!$)B0("List organizations");await ND();let X={...D,apikey:D.apikey||z0()};if(!X.apikey){if(!$)L.error("Missing API key, you need to provide an API key to list organizations");throw Error("Missing API key")}let J=await C0(X.apikey,X.supaHost,X.supaAnon);if(await $D(J,X.apikey),!$)L.info("Getting organizations from Capgo");let{error:Y,data:F}=await J.rpc("get_orgs_v7");if(Y){if(!$)L.error(`Cannot get organizations ${o(Y)}`);throw Error(`Cannot get organizations: ${o(Y)}`)}let Q=F||[];if(l0({channel:"organization",event:"Orgs Listed",icon:"\uD83D\uDCCB",tags:{org_count:Q.length}}),!$)L.info(`Organizations found: ${Q.length}`),np0(Q,$),M0("Done ✅");return Q}g0();x1();_0();async function x50(D,$,X=!1){if(!X)B0("Updating organization");await ND();let J={...$,apikey:$.apikey||z0()};if(!J.apikey){if(!X)L.error("Missing API key, you need to provide an API key to update an organization");throw Error("Missing API key")}if(!D){if(!X)L.error("Missing argument, you need to provide an organization ID");throw Error("Missing organization id")}let Y=await C0(J.apikey,J.supaHost,J.supaAnon);await nG(Y,J.apikey,"org.update_settings",D,`Insufficient permissions to update organization ${D}`,X),await fG(Y,D,X);let{data:F,error:Q}=await Y.from("orgs").select("name, management_email, created_by, enforcing_2fa, password_policy_config, require_apikey_expiration, max_apikey_expiration_days, enforce_hashed_api_keys").eq("id",D).single();if(Q||!F){if(!X)L.error(`Cannot get organization details ${o(Q)}`);throw Error(`Cannot get organization details: ${o(Q)}`)}let{name:U,email:Z,enforce2fa:G}=J,{passwordPolicy:O,minLength:q,requireUppercase:w,requireNumber:K,requireSpecial:W}=J,{requireApikeyExpiration:H,maxApikeyExpirationDays:B,enforceHashedApiKeys:M}=J;if(G!==void 0){if(!X){if(G&&!F.enforcing_2fa){L.info("Checking organization members 2FA status...");let{data:A,error:u}=await Y.rpc("check_org_members_2fa_enabled",{org_id:D});if(u)throw L.error(`Cannot check members 2FA status: ${o(u)}`),Error("Cannot check members 2FA status");let{data:_,error:j}=await Y.rpc("has_2fa_enabled");if(j)throw L.error(`Cannot check your 2FA status: ${o(j)}`),Error("Cannot check your 2FA status");let{data:x,error:P}=await Y.rpc("get_identity_apikey_only",{keymode:["read","upload","write","all"]});if(P||!x)throw L.error(`Cannot get current user identity: ${P?o(P):"No user ID returned"}`),Error("Cannot get current user identity");let m=A?.filter((b)=>!b["2fa_enabled"]&&b.user_id!==x)||[];if(m.length>0||!_){if(L.warn("⚠️ Warning: Enabling 2FA enforcement will affect access"),L.message("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"),!_)L.warn("\uD83D\uDD10 YOU do not have 2FA enabled! By enabling 2FA enforcement, you will LOSE ACCESS to this organization until you enable 2FA on your account.");if(m.length>0){let{data:p,error:k}=await Y.rpc("get_org_members",{guild_id:D});if(k)throw L.error(`Cannot get organization members: ${o(k)}`),Error("Cannot get organization members");let R=new Map(p?.map((h)=>[h.uid,h])||[]),S=m.map((h)=>{return R.get(h.user_id)?.email||h.user_id}),v=m.length===1?"member does":"members do",f=m.length===1?"This member will":"These members will";L.warn(`${m.length} ${v} not have 2FA enabled: ${S.join(", ")}`),L.warn(`${f} lose access until they enable 2FA.`)}let b=await kD({message:"Are you sure you want to enable 2FA enforcement?"});if(c0(b)||!b)throw L.error("Canceled enabling 2FA enforcement"),Error("2FA enforcement cancelled")}L.info("Enabling 2FA enforcement for organization...")}else if(!G&&F.enforcing_2fa)L.info("Disabling 2FA enforcement for organization...")}let{error:N}=await Y.from("orgs").update({enforcing_2fa:G}).eq("id",D);if(N){if(!X)L.error(`Could not update 2FA enforcement: ${o(N)}`);throw Error(`Could not update 2FA enforcement: ${o(N)}`)}if(!X)if(G)L.success("✓ 2FA enforcement enabled for this organization");else L.success("✓ 2FA enforcement disabled for this organization");if(U===void 0&&Z===void 0&&!(O!==void 0||H!==void 0||B!==void 0||M!==void 0)){if(await I0(J.apikey,{channel:"organization",event:G?"Organization 2FA Enabled":"Organization 2FA Disabled",icon:"\uD83D\uDD10",org_id:D,tracking_version:2,tags:{"org-name":F.name,"enforce-2fa":G.toString()},notify:!1}).catch(()=>{}),!X)M0("Done ✅");return{orgId:D,name:F.name,email:F.management_email,enforce2fa:G}}}if(O!==void 0){if(!X)if(O){L.info("Configuring password policy for organization...");let{data:A,error:u}=await Y.rpc("check_org_members_password_policy",{org_id:D});if(u){if(!u.message?.includes("NO_RIGHTS"))L.warn(`Cannot check members password policy status: ${o(u)}`)}else if(A){let _=A.filter((j)=>!j.password_policy_compliant);if(_.length>0){L.warn(`⚠️ Warning: ${_.length} member(s) do not meet the password policy requirements`),L.warn("These members will need to update their passwords to regain access.");let j=await kD({message:"Are you sure you want to enable the password policy?"});if(c0(j)||!j)throw L.error("Canceled enabling password policy"),Error("Password policy configuration cancelled")}}}else L.info("Disabling password policy for organization...");let N={enabled:O,min_length:q??10,require_uppercase:w??!0,require_number:K??!0,require_special:W??!0},{error:V}=await Y.from("orgs").update({password_policy_config:N}).eq("id",D);if(V){if(!X)L.error(`Could not update password policy: ${o(V)}`);throw Error(`Could not update password policy: ${o(V)}`)}if(!X)if(O)L.success("✓ Password policy enabled for this organization"),L.info(` - Minimum length: ${N.min_length} characters`),L.info(` - Require uppercase: ${N.require_uppercase?"Yes":"No"}`),L.info(` - Require number: ${N.require_number?"Yes":"No"}`),L.info(` - Require special character: ${N.require_special?"Yes":"No"}`);else L.success("✓ Password policy disabled for this organization");if(U===void 0&&Z===void 0&&G===void 0&&H===void 0&&B===void 0&&M===void 0){if(await I0(J.apikey,{channel:"organization",event:O?"Password Policy Enabled":"Password Policy Disabled",icon:"\uD83D\uDD11",org_id:D,tracking_version:2,tags:{"org-name":F.name},notify:!1}).catch(()=>{}),!X)M0("Done ✅");return{orgId:D,name:F.name,email:F.management_email,passwordPolicy:O}}}if(H!==void 0||B!==void 0||M!==void 0){if(!X)L.info("Updating API key security settings...");if(B!==void 0&&B!==null){if(B<1||B>365){if(!X)L.error("Maximum API key expiration days must be between 1 and 365");throw Error("Maximum API key expiration days must be between 1 and 365")}}let N={};if(H!==void 0)N.require_apikey_expiration=H;if(B!==void 0)N.max_apikey_expiration_days=B;if(M!==void 0)N.enforce_hashed_api_keys=M;let{error:V}=await Y.from("orgs").update(N).eq("id",D);if(V){if(!X)L.error(`Could not update API key settings: ${o(V)}`);throw Error(`Could not update API key settings: ${o(V)}`)}if(!X){if(H!==void 0)L.success(`✓ API key expiration requirement: ${H?"Enabled":"Disabled"}`);if(B!==void 0)if(B===null)L.success("✓ Maximum API key expiration days: No limit");else L.success(`✓ Maximum API key expiration days: ${B}`);if(M!==void 0)L.success(`✓ Hashed API keys enforcement: ${M?"Enabled":"Disabled"}`)}if(U===void 0&&Z===void 0&&G===void 0&&O===void 0){if(await I0(J.apikey,{channel:"organization",event:"API Key Settings Updated",icon:"\uD83D\uDD10",org_id:D,tracking_version:2,tags:{"org-name":F.name},notify:!1}).catch(()=>{}),!X)M0("Done ✅");return{orgId:D,name:F.name,email:F.management_email}}}if(!X&&!U){let N=await H4({message:"New organization name:",placeholder:F.name||"My Organization"});if(c0(N))throw L.error("Canceled updating organization"),Error("Organization update cancelled");U=N}if(!X&&!Z){let N=await H4({message:"Management email:",placeholder:F.management_email||"admin@example.com"});if(c0(N))throw L.error("Canceled updating organization"),Error("Organization update cancelled");Z=N}if(!U||!Z){if(!X)L.error("Missing arguments, you need to provide an organization name and management email");throw Error("Missing organization name or management email")}if(!X)L.info(`Updating organization "${D}"`);let{error:z}=await Y.from("orgs").update({name:U,management_email:Z}).eq("id",D);if(z){if(!X)L.error(`Could not update organization ${o(z)}`);throw Error(`Could not update organization: ${o(z)}`)}if(await I0(J.apikey,{channel:"organization",event:"Organization Updated",icon:"✏️",org_id:D,tracking_version:2,tags:{"org-name":U},notify:!1}).catch(()=>{}),!X)L.success("Organization updated"),M0("Done ✅");return{orgId:D,name:U,email:Z,enforce2fa:G??F.enforcing_2fa}}g0();H1();_0();async function _50(D,$=!1){if(!$)B0("Getting user id");let X={...D,apikey:D.apikey||z0()};if(!X.apikey){if(!$)L.error("Missing API key, you need to provide an API key to fetch the user id");throw Error("Missing API key")}try{let J=await C0(X.apikey,X.supaHost,X.supaAnon),Y=await $D(J,X.apikey);if(l0({channel:"account",event:"Account Id Viewed",icon:"\uD83E\uDEAA",tags:{}}),!$)M0(`Done ✅: ${Y}`);return Y}catch(J){if(!$)L.error(`Error getting user id ${o(J)}`);throw J instanceof Error?J:Error(String(J))}}_0();AG();_0();AG();function p0(D){let $=D instanceof Error?D.message:String(D),X=l7(D);return{success:!1,error:$,isSecurityPolicyError:X.isSecurityPolicyError,securityPolicyMessage:X.isSecurityPolicyError?X.message:void 0}}class BD{apikey;supaHost;supaAnon;constructor(D){this.apikey=D?.apikey,this.supaHost=D?.supaHost,this.supaAnon=D?.supaAnon}async login(D){try{return await P50(D.apikey,{local:D.local??!1,supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon},!0),{success:!0}}catch($){return p0($)}}async doctor(D){try{return{success:!0,data:await _D0({packageJson:D?.packageJson},!0)}}catch($){return p0($)}}async addApp(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,name:D.name,icon:D.icon};return await vD0(D.appId,$,void 0,!0),{success:!0}}catch($){return p0($)}}async updateApp(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,name:D.name,icon:D.icon,retention:D.retention};return await bD0(D.appId,$,!0),{success:!0}}catch($){return p0($)}}async deleteApp(D,$=!1){try{let X={apikey:this.apikey||z0(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return await uD0(D,X,!1,$),{success:!0}}catch(X){return p0(X)}}async listApps(){try{let D={apikey:this.apikey||z0(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:(await fD0(D,!1)).map((J)=>({appId:J.app_id,name:J.name||"Unknown",iconUrl:J.icon_url||void 0,createdAt:new Date(J.created_at||"")}))}}catch(D){return p0(D)}}async getAccountId(D){try{let $={apikey:D?.apikey||this.apikey||z0(!0),supaHost:D?.supaHost||this.supaHost,supaAnon:D?.supaAnon||this.supaAnon};return{success:!0,data:await _50($,!0)}}catch($){return p0($)}}async starRepo(D){try{let{repository:$,alreadyStarred:X}=rE(D?.repository);return{success:!0,data:{repository:$,alreadyStarred:X}}}catch($){return p0($)}}async starAllRepositories(D){try{return{success:!0,data:await y80(D)}}catch($){return p0($)}}async checkBundleCompatibility(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),channel:D.channel,text:D.textOutput??!1,packageJson:D.packageJson,nodeModules:D.nodeModules,supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon};return{success:!0,data:(await X80(D.appId,$,!0)).finalCompatibility}}catch($){return p0($)}}async encryptBundle(D){try{return{success:!0,data:await H80(D.zipPath,D.checksum,{key:D.keyPath,keyData:D.keyData,json:D.json,packageJson:D.packageJson},!0)}}catch($){return p0($)}}async decryptBundle(D){try{return{success:!0,data:await w80(D.zipPath,D.ivSessionKey,{key:D.keyPath,keyData:D.keyData,checksum:D.checksum,packageJson:D.packageJson},!0)}}catch($){return p0($)}}async zipBundle(D){try{return{success:!0,data:await q50(D.appId,{apikey:this.apikey||z0(!0),path:D.path,bundle:D.bundle,name:D.name,codeCheck:D.codeCheck,json:D.json,keyV2:D.keyV2,packageJson:D.packageJson},!0)}}catch($){return p0($)}}async uploadBundle(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,path:D.path,bundle:D.bundle,channel:D.channel,external:D.external,key:D.encrypt!==!1,keyV2:D.encryptionKey,timeout:D.timeout,tus:D.useTus,comment:D.comment,minUpdateVersion:D.minUpdateVersion,autoMinUpdateVersion:D.autoMinUpdateVersion,selfAssign:D.selfAssign,packageJson:D.packageJsonPaths,ignoreMetadataCheck:D.ignoreCompatibilityCheck,codeCheck:!D.disableCodeCheck,zip:D.useZip},X=await NA(D.appId,$,!0);return{success:X.success,bundleId:X.bundle,checksum:X.checksum??null,encryptionMethod:X.encryptionMethod,sessionKey:X.sessionKey,ivSessionKey:X.ivSessionKey,storageProvider:X.storageProvider,skipped:X.skipped,reason:X.reason}}catch($){return p0($)}}async listBundles(D){try{let $=this.apikey||z0(!0),X=await C0($,this.supaHost,this.supaAnon);return{success:!0,data:(await pG(X,D)).map((F)=>({id:F.id.toString(),version:F.name,uploadedAt:new Date(F.created_at||""),size:0,encrypted:F.session_key!==null}))}}catch($){return p0($)}}async deleteBundle(D,$){try{let X={apikey:this.apikey||z0(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,bundle:$};return await K80($,D,X,!0),{success:!0}}catch(X){return p0(X)}}async cleanupBundles(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,bundle:D.bundle||"",version:"",keep:D.keep||4,force:D.force||!1,ignoreChannel:D.ignoreChannel||!1};return{success:!0,data:await e40(D.appId,$,!0)}}catch($){return p0($)}}async requestBuild(D){try{let $=D.credentials,X={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,path:D.path,nodeModules:D.nodeModules,platform:D.platform,userId:D.userId,buildCertificateBase64:$?.BUILD_CERTIFICATE_BASE64,p12Password:$?.P12_PASSWORD,appleKeyId:$?.APPLE_KEY_ID,appleIssuerId:$?.APPLE_ISSUER_ID,appleKeyContent:$?.APPLE_KEY_CONTENT,appStoreConnectTeamId:$?.APP_STORE_CONNECT_TEAM_ID,iosScheme:$?.CAPGO_IOS_SCHEME,iosTarget:$?.CAPGO_IOS_TARGET,iosDistribution:$?.CAPGO_IOS_DISTRIBUTION,iosProvisioningMap:$?.CAPGO_IOS_PROVISIONING_MAP,androidKeystoreFile:$?.ANDROID_KEYSTORE_FILE,keystoreKeyAlias:$?.KEYSTORE_KEY_ALIAS,keystoreKeyPassword:$?.KEYSTORE_KEY_PASSWORD,keystoreStorePassword:$?.KEYSTORE_STORE_PASSWORD,playConfigJson:$?.PLAY_CONFIG_JSON},J=await s40(D.appId,X,!0);if(J.success&&J.jobId)return{success:!0,data:{jobId:J.jobId,uploadUrl:J.uploadUrl||"",status:J.status||"unknown"}};return{success:!1,error:J.error||"Unknown error during build request"}}catch($){return p0($)}}async getCurrentBundle(D,$,X){try{let J={apikey:X?.apikey||this.apikey||z0(!0),quiet:!0,supaHost:X?.supaHost||this.supaHost,supaAnon:X?.supaAnon||this.supaAnon};return{success:!0,data:await K50($,D,J,!0)}}catch(J){return p0(J)}}async addChannel(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,default:D.default,selfAssign:D.selfAssign};return await w50(D.channelId,D.appId,$,!0),{success:!0}}catch($){return p0($)}}async updateChannel(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,bundle:D.bundle??void 0,state:D.state,downgrade:D.downgrade,ios:D.ios,android:D.android,selfAssign:D.selfAssign,disableAutoUpdate:D.disableAutoUpdate??void 0,dev:D.dev,emulator:D.emulator,device:D.device,prod:D.prod,latest:!1,latestRemote:!1,packageJson:void 0,ignoreMetadataCheck:!1};return await I50(D.channelId,D.appId,$,!0),{success:!0}}catch($){return p0($)}}async deleteChannel(D,$,X=!1){try{let J={apikey:this.apikey||z0(!0),supaHost:this.supaHost,supaAnon:this.supaAnon,deleteBundle:X,successIfNotFound:!1};return await W50(D,$,J,!0),{success:!0}}catch(J){return p0(J)}}async listChannels(D){try{let $={apikey:this.apikey||z0(!0),supaHost:this.supaHost,supaAnon:this.supaAnon};return{success:!0,data:await H50(D,$,!0)}}catch($){return p0($)}}async generateEncryptionKeys(D){try{return await C50({force:D?.force,setupChannel:D?.setupChannel},!0),{success:!0}}catch($){return p0($)}}async saveEncryptionKey(D){try{return await R50({key:D?.keyPath,keyData:D?.keyData,setupChannel:D?.setupChannel},!0),{success:!0}}catch($){return p0($)}}async deleteLegacyEncryptionKey(D){try{return{success:!0,data:{deleted:await T50({force:D?.force,setupChannel:D?.setupChannel},!0)}}}catch($){return p0($)}}async listOrganizations(D){try{let $={apikey:D?.apikey||this.apikey||z0(!0),supaHost:D?.supaHost||this.supaHost,supaAnon:D?.supaAnon||this.supaAnon};return{success:!0,data:(await u50($,!0)).map((Y)=>({id:String(Y.id??Y.gid??""),name:Y.name??"Unknown",role:Y.role??void 0,appCount:typeof Y.app_count==="number"?Y.app_count:void 0,email:Y.management_email??void 0,createdAt:Y.created_at?new Date(Y.created_at):void 0}))}}catch($){return p0($)}}async addOrganization(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,name:D.name,email:D.email},X=await S50($,!0);return{success:!0,data:{id:String(X.id??X.gid??""),name:X.name??D.name,role:"owner",appCount:0,email:X.management_email??D.email,createdAt:X.created_at?new Date(X.created_at):void 0}}}catch($){return p0($)}}async updateOrganization(D){try{let $={apikey:D.apikey||this.apikey||z0(!0),supaHost:D.supaHost||this.supaHost,supaAnon:D.supaAnon||this.supaAnon,name:D.name,email:D.email},X=await x50(D.orgId,$,!0);return{success:!0,data:{id:X.orgId,name:X.name,email:X.email}}}catch($){return p0($)}}async deleteOrganization(D,$){try{let X={apikey:$?.apikey||this.apikey||z0(!0),supaHost:$?.supaHost||this.supaHost,supaAnon:$?.supaAnon||this.supaAnon,autoConfirm:$?.autoConfirm??!0};return{success:!0,data:{deleted:await v50(D,X,!0)}}}catch(X){return p0(X)}}async getStats(D){try{let $=D.apikey||this.apikey||z0(!0),X=await U6(),J={appId:D.appId,devicesId:D.deviceIds,search:D.search,order:D.order,rangeStart:D.after||D.rangeStart,rangeEnd:D.rangeEnd,limit:D.limit},Y=await fetch(`${X.hostApi}/private/stats`,{method:"POST",headers:{"Content-Type":"application/json",capgkey:$},body:JSON.stringify(J)});if(!Y.ok)throw Error(`HTTP error! status: ${Y.status}`);return{success:!0,data:(await Y.json()).map((U)=>({appId:U.app_id,deviceId:U.device_id,action:U.action,versionId:U.version_id,version:U.version,createdAt:U.created_at}))}}catch($){return p0($)}}async setAppSetting(D,$){try{return await gD0(D,{apikey:$.apikey||this.apikey||z0(!0),bool:$.bool,string:$.string},!0),{success:!0}}catch(X){return p0(X)}}async probe(D){try{let{probeInternal:$}=await Promise.resolve().then(() => (i50(),l50)),X=await $({platform:D.platform});if(X.error)return{success:!1,error:X.error};return{success:!0,data:X}}catch($){return p0($)}}}async function yGD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).uploadBundle(D)}async function bGD(D){return new BD({supaHost:D.supaHost,supaAnon:D.supaAnon}).login(D)}async function gGD(D){return new BD().doctor(D)}async function hGD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).checkBundleCompatibility(D)}async function mGD(D){return new BD().encryptBundle(D)}async function cGD(D){return new BD().decryptBundle(D)}async function dGD(D){return new BD().zipBundle(D)}async function nGD(D){return new BD().starRepo(D)}async function lGD(D){return new BD().starAllRepositories(D)}async function iGD(D){return new BD().generateEncryptionKeys(D)}async function pGD(D){return new BD().saveEncryptionKey(D)}async function rGD(D){return new BD().deleteLegacyEncryptionKey(D)}async function tGD(D,$,X){return new BD({apikey:X?.apikey,supaHost:X?.supaHost,supaAnon:X?.supaAnon}).getCurrentBundle(D,$,X)}async function oGD(D,$){return new BD({apikey:$.apikey}).setAppSetting(D,$)}async function aGD(D){return new BD({apikey:D?.apikey,supaHost:D?.supaHost,supaAnon:D?.supaAnon}).getAccountId(D)}async function sGD(D){return new BD({apikey:D?.apikey,supaHost:D?.supaHost,supaAnon:D?.supaAnon}).listOrganizations(D)}async function eGD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).addOrganization(D)}async function DOD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).updateOrganization(D)}async function $OD(D,$){return new BD({apikey:$?.apikey,supaHost:$?.supaHost,supaAnon:$?.supaAnon}).deleteOrganization(D,$)}async function XOD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).addApp(D)}async function JOD(D,$){return new BD($).listBundles(D)}async function YOD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).addChannel(D)}async function FOD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).requestBuild(D)}async function QOD(D){return new BD({apikey:D.apikey,supaHost:D.supaHost,supaAnon:D.supaAnon}).getStats(D)}async function UOD(D){return new BD().probe(D)}async function ZOD(){try{return await E0()}catch{return null}}export{dGD as zipBundle,yGD as uploadBundle,DOD as updateOrganization,oGD as updateAppSetting,nGD as starRepo,lGD as starAllRepositories,pGD as saveEncryptionKey,FOD as requestBuild,UOD as probeUpdates,l7 as parseSecurityPolicyError,bGD as login,sGD as listOrganizations,JOD as listBundles,ie as isSecurityPolicyError,QOD as getStats,n_0 as getSecurityPolicyMessage,tGD as getCurrentBundle,ZOD as getCapacitorConfig,aGD as getAccountId,iGD as generateEncryptionKeys,jI as formatApiErrorForCli,mGD as encryptBundle,gGD as doctor,$OD as deleteOrganization,rGD as deleteLegacyEncryptionKey,cGD as decryptBundle,C0 as createSupabaseClient,hGD as checkBundleCompatibility,eGD as addOrganization,YOD as addChannel,XOD as addApp,EG as SECURITY_POLICY_MESSAGES,MJ as SECURITY_POLICY_ERRORS,BD as CapgoSDK};
|