@capgo/cli 4.29.0 → 4.29.1

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 CHANGED
@@ -162,7 +162,7 @@ Are you sure ${ia.default.strong(e)} is installed?`);let n=(0,mv.dirname)(r),i=a
162
162
  `;break;case"incompatible":n=`Found ${t.length} incompatible Cordova plugin${i} for ${ia.default.strong(e)}, skipped install:
163
163
  `;break;case"capacitor":n=`Found ${t.length} Capacitor plugin${i} for ${ia.default.strong(e)}:
164
164
  `;break}n+=t.map(o=>`${o.id}${ia.default.weak(`@${o.version}`)}`).join(`
165
- `),cre.logger.info(n)}Ce.printPlugins=dre;function yv(t,e){return t.xml.platform?t.xml.platform.filter(function(i){return i.$.name===e})[0]:[]}Ce.getPluginPlatform=yv;function hre(t,e,r){let n=yv(t,e);if(n){let i=n[r];if(i)return i}return[]}Ce.getPlatformElement=hre;function pre(t,e){var r,n,i,o;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(o=(i=t.android)===null||i===void 0?void 0:i.type)!==null&&o!==void 0?o:0}return 0}Ce.getPluginType=pre;function mre(t,e){return Dv(t,e,"js-module")}Ce.getJSModules=mre;function gre(t,e){return Dv(t,e,"asset")}Ce.getAssets=gre;function yre(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let i=(0,XR.resolveNode)(t.app.rootDir,...n);if(!i)throw new Error(`Can't resolve module ${n[0]}`);return i}return(0,mv.join)(e.rootPath,r)}Ce.getFilePath=yre;function Dv(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let i=yv(t,e);return i?.[r]&&(n=n.concat(i[r])),n}Ce.getAllElements=Dv});var r$={};mn(r$,{default:()=>Dre});var Dre,n$=ut(()=>{Dre={}});var hh=D(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.isInstalled=mi.getCommandOutput=mi.runCommand=void 0;var vv=(n$(),ke(r$));async function i$(t,e,r={}){let n=new vv.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof vv.SubprocessError?i.output?i.output:i.code?i.code:i.error?i.error.message:"Unknown error":i}}mi.runCommand=i$;async function vre(t,e,r={}){try{return(await i$(t,e,r)).trim()}catch{return null}}mi.getCommandOutput=vre;async function bre(t){try{await(0,vv.which)(t)}catch{return!1}return!0}mi.isInstalled=bre});var _c=D(($me,o$)=>{var wre="2.0.0",_re=Number.MAX_SAFE_INTEGER||9007199254740991,Ere=16,Cre=250,Sre=["major","premajor","minor","preminor","patch","prepatch","prerelease"];o$.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Ere,MAX_SAFE_BUILD_LENGTH:Cre,MAX_SAFE_INTEGER:_re,RELEASE_TYPES:Sre,SEMVER_SPEC_VERSION:wre,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Ec=D((Ime,s$)=>{var xre=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};s$.exports=xre});var oa=D((In,a$)=>{var{MAX_SAFE_COMPONENT_LENGTH:bv,MAX_SAFE_BUILD_LENGTH:Fre,MAX_LENGTH:Ore}=_c(),Are=Ec();In=a$.exports={};var kre=In.re=[],Tre=In.safeRe=[],z=In.src=[],G=In.t={},Pre=0,wv="[a-zA-Z0-9-]",Rre=[["\\s",1],["\\d",Ore],[wv,Fre]],$re=t=>{for(let[e,r]of Rre)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ne=(t,e,r)=>{let n=$re(e),i=Pre++;Are(t,i,e),G[t]=i,z[i]=e,kre[i]=new RegExp(e,r?"g":void 0),Tre[i]=new RegExp(n,r?"g":void 0)};ne("NUMERICIDENTIFIER","0|[1-9]\\d*");ne("NUMERICIDENTIFIERLOOSE","\\d+");ne("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${wv}*`);ne("MAINVERSION",`(${z[G.NUMERICIDENTIFIER]})\\.(${z[G.NUMERICIDENTIFIER]})\\.(${z[G.NUMERICIDENTIFIER]})`);ne("MAINVERSIONLOOSE",`(${z[G.NUMERICIDENTIFIERLOOSE]})\\.(${z[G.NUMERICIDENTIFIERLOOSE]})\\.(${z[G.NUMERICIDENTIFIERLOOSE]})`);ne("PRERELEASEIDENTIFIER",`(?:${z[G.NUMERICIDENTIFIER]}|${z[G.NONNUMERICIDENTIFIER]})`);ne("PRERELEASEIDENTIFIERLOOSE",`(?:${z[G.NUMERICIDENTIFIERLOOSE]}|${z[G.NONNUMERICIDENTIFIER]})`);ne("PRERELEASE",`(?:-(${z[G.PRERELEASEIDENTIFIER]}(?:\\.${z[G.PRERELEASEIDENTIFIER]})*))`);ne("PRERELEASELOOSE",`(?:-?(${z[G.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${z[G.PRERELEASEIDENTIFIERLOOSE]})*))`);ne("BUILDIDENTIFIER",`${wv}+`);ne("BUILD",`(?:\\+(${z[G.BUILDIDENTIFIER]}(?:\\.${z[G.BUILDIDENTIFIER]})*))`);ne("FULLPLAIN",`v?${z[G.MAINVERSION]}${z[G.PRERELEASE]}?${z[G.BUILD]}?`);ne("FULL",`^${z[G.FULLPLAIN]}$`);ne("LOOSEPLAIN",`[v=\\s]*${z[G.MAINVERSIONLOOSE]}${z[G.PRERELEASELOOSE]}?${z[G.BUILD]}?`);ne("LOOSE",`^${z[G.LOOSEPLAIN]}$`);ne("GTLT","((?:<|>)?=?)");ne("XRANGEIDENTIFIERLOOSE",`${z[G.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ne("XRANGEIDENTIFIER",`${z[G.NUMERICIDENTIFIER]}|x|X|\\*`);ne("XRANGEPLAIN",`[v=\\s]*(${z[G.XRANGEIDENTIFIER]})(?:\\.(${z[G.XRANGEIDENTIFIER]})(?:\\.(${z[G.XRANGEIDENTIFIER]})(?:${z[G.PRERELEASE]})?${z[G.BUILD]}?)?)?`);ne("XRANGEPLAINLOOSE",`[v=\\s]*(${z[G.XRANGEIDENTIFIERLOOSE]})(?:\\.(${z[G.XRANGEIDENTIFIERLOOSE]})(?:\\.(${z[G.XRANGEIDENTIFIERLOOSE]})(?:${z[G.PRERELEASELOOSE]})?${z[G.BUILD]}?)?)?`);ne("XRANGE",`^${z[G.GTLT]}\\s*${z[G.XRANGEPLAIN]}$`);ne("XRANGELOOSE",`^${z[G.GTLT]}\\s*${z[G.XRANGEPLAINLOOSE]}$`);ne("COERCEPLAIN",`(^|[^\\d])(\\d{1,${bv}})(?:\\.(\\d{1,${bv}}))?(?:\\.(\\d{1,${bv}}))?`);ne("COERCE",`${z[G.COERCEPLAIN]}(?:$|[^\\d])`);ne("COERCEFULL",z[G.COERCEPLAIN]+`(?:${z[G.PRERELEASE]})?(?:${z[G.BUILD]})?(?:$|[^\\d])`);ne("COERCERTL",z[G.COERCE],!0);ne("COERCERTLFULL",z[G.COERCEFULL],!0);ne("LONETILDE","(?:~>?)");ne("TILDETRIM",`(\\s*)${z[G.LONETILDE]}\\s+`,!0);In.tildeTrimReplace="$1~";ne("TILDE",`^${z[G.LONETILDE]}${z[G.XRANGEPLAIN]}$`);ne("TILDELOOSE",`^${z[G.LONETILDE]}${z[G.XRANGEPLAINLOOSE]}$`);ne("LONECARET","(?:\\^)");ne("CARETTRIM",`(\\s*)${z[G.LONECARET]}\\s+`,!0);In.caretTrimReplace="$1^";ne("CARET",`^${z[G.LONECARET]}${z[G.XRANGEPLAIN]}$`);ne("CARETLOOSE",`^${z[G.LONECARET]}${z[G.XRANGEPLAINLOOSE]}$`);ne("COMPARATORLOOSE",`^${z[G.GTLT]}\\s*(${z[G.LOOSEPLAIN]})$|^$`);ne("COMPARATOR",`^${z[G.GTLT]}\\s*(${z[G.FULLPLAIN]})$|^$`);ne("COMPARATORTRIM",`(\\s*)${z[G.GTLT]}\\s*(${z[G.LOOSEPLAIN]}|${z[G.XRANGEPLAIN]})`,!0);In.comparatorTrimReplace="$1$2$3";ne("HYPHENRANGE",`^\\s*(${z[G.XRANGEPLAIN]})\\s+-\\s+(${z[G.XRANGEPLAIN]})\\s*$`);ne("HYPHENRANGELOOSE",`^\\s*(${z[G.XRANGEPLAINLOOSE]})\\s+-\\s+(${z[G.XRANGEPLAINLOOSE]})\\s*$`);ne("STAR","(<|>)?=?\\s*\\*");ne("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ne("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ph=D((jme,u$)=>{var Ire=Object.freeze({loose:!0}),jre=Object.freeze({}),Nre=t=>t?typeof t!="object"?Ire:t:jre;u$.exports=Nre});var _v=D((Nme,f$)=>{var c$=/^[0-9]+$/,l$=(t,e)=>{let r=c$.test(t),n=c$.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Lre=(t,e)=>l$(e,t);f$.exports={compareIdentifiers:l$,rcompareIdentifiers:Lre}});var xt=D((Lme,m$)=>{var mh=Ec(),{MAX_LENGTH:d$,MAX_SAFE_INTEGER:gh}=_c(),{safeRe:h$,t:p$}=oa(),Bre=ph(),{compareIdentifiers:sa}=_v(),Ev=class t{constructor(e,r){if(r=Bre(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>d$)throw new TypeError(`version is longer than ${d$} characters`);mh("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?h$[p$.LOOSE]:h$[p$.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>gh||this.major<0)throw new TypeError("Invalid major version");if(this.minor>gh||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>gh||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let o=+i;if(o>=0&&o<gh)return o}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(mh("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),sa(this.major,e.major)||sa(this.minor,e.minor)||sa(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(mh("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return sa(n,i)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(mh("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return sa(n,i)}while(++r)}inc(e,r,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[i];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let o=[r,i];n===!1&&(o=[r]),sa(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};m$.exports=Ev});var mo=D((Bme,y$)=>{var g$=xt(),qre=(t,e,r=!1)=>{if(t instanceof g$)return t;try{return new g$(t,e)}catch(n){if(!r)return null;throw n}};y$.exports=qre});var v$=D((qme,D$)=>{var Mre=mo(),Ure=(t,e)=>{let r=Mre(t,e);return r?r.version:null};D$.exports=Ure});var w$=D((Mme,b$)=>{var Hre=mo(),Vre=(t,e)=>{let r=Hre(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};b$.exports=Vre});var C$=D((Ume,E$)=>{var _$=xt(),zre=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new _$(t instanceof _$?t.version:t,r).inc(e,n,i).version}catch{return null}};E$.exports=zre});var F$=D((Hme,x$)=>{var S$=mo(),Gre=(t,e)=>{let r=S$(t,null,!0),n=S$(e,null,!0),i=r.compare(n);if(i===0)return null;let o=i>0,s=o?r:n,a=o?n:r,u=!!s.prerelease.length;if(!!a.prerelease.length&&!u)return!a.patch&&!a.minor?"major":s.patch?"patch":s.minor?"minor":"major";let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};x$.exports=Gre});var A$=D((Vme,O$)=>{var Wre=xt(),Kre=(t,e)=>new Wre(t,e).major;O$.exports=Kre});var T$=D((zme,k$)=>{var Yre=xt(),Jre=(t,e)=>new Yre(t,e).minor;k$.exports=Jre});var R$=D((Gme,P$)=>{var Xre=xt(),Zre=(t,e)=>new Xre(t,e).patch;P$.exports=Zre});var I$=D((Wme,$$)=>{var Qre=mo(),ene=(t,e)=>{let r=Qre(t,e);return r&&r.prerelease.length?r.prerelease:null};$$.exports=ene});var wr=D((Kme,N$)=>{var j$=xt(),tne=(t,e,r)=>new j$(t,r).compare(new j$(e,r));N$.exports=tne});var B$=D((Yme,L$)=>{var rne=wr(),nne=(t,e,r)=>rne(e,t,r);L$.exports=nne});var M$=D((Jme,q$)=>{var ine=wr(),one=(t,e)=>ine(t,e,!0);q$.exports=one});var yh=D((Xme,H$)=>{var U$=xt(),sne=(t,e,r)=>{let n=new U$(t,r),i=new U$(e,r);return n.compare(i)||n.compareBuild(i)};H$.exports=sne});var z$=D((Zme,V$)=>{var ane=yh(),une=(t,e)=>t.sort((r,n)=>ane(r,n,e));V$.exports=une});var W$=D((Qme,G$)=>{var cne=yh(),lne=(t,e)=>t.sort((r,n)=>cne(n,r,e));G$.exports=lne});var Cc=D((ege,K$)=>{var fne=wr(),dne=(t,e,r)=>fne(t,e,r)>0;K$.exports=dne});var Dh=D((tge,Y$)=>{var hne=wr(),pne=(t,e,r)=>hne(t,e,r)<0;Y$.exports=pne});var Cv=D((rge,J$)=>{var mne=wr(),gne=(t,e,r)=>mne(t,e,r)===0;J$.exports=gne});var Sv=D((nge,X$)=>{var yne=wr(),Dne=(t,e,r)=>yne(t,e,r)!==0;X$.exports=Dne});var vh=D((ige,Z$)=>{var vne=wr(),bne=(t,e,r)=>vne(t,e,r)>=0;Z$.exports=bne});var bh=D((oge,Q$)=>{var wne=wr(),_ne=(t,e,r)=>wne(t,e,r)<=0;Q$.exports=_ne});var xv=D((sge,eI)=>{var Ene=Cv(),Cne=Sv(),Sne=Cc(),xne=vh(),Fne=Dh(),One=bh(),Ane=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return Ene(t,r,n);case"!=":return Cne(t,r,n);case">":return Sne(t,r,n);case">=":return xne(t,r,n);case"<":return Fne(t,r,n);case"<=":return One(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};eI.exports=Ane});var rI=D((age,tI)=>{var kne=xt(),Tne=mo(),{safeRe:wh,t:_h}=oa(),Pne=(t,e)=>{if(t instanceof kne)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?wh[_h.COERCEFULL]:wh[_h.COERCE]);else{let u=e.includePrerelease?wh[_h.COERCERTLFULL]:wh[_h.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",o=r[4]||"0",s=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Tne(`${n}.${i}.${o}${s}${a}`,e)};tI.exports=Pne});var iI=D((uge,nI)=>{var Fv=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}};nI.exports=Fv});var _r=D((cge,uI)=>{var Rne=/\s+/g,Ov=class t{constructor(e,r){if(r=Ine(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Av)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Rne," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!sI(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&Une(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&qne)|(this.options.loose&&Mne))+":"+e,i=oI.get(n);if(i)return i;let o=this.options.loose,s=o?Xt[$t.HYPHENRANGELOOSE]:Xt[$t.HYPHENRANGE];e=e.replace(s,Zne(this.options.includePrerelease)),Re("hyphen replace",e),e=e.replace(Xt[$t.COMPARATORTRIM],Nne),Re("comparator trim",e),e=e.replace(Xt[$t.TILDETRIM],Lne),Re("tilde trim",e),e=e.replace(Xt[$t.CARETTRIM],Bne),Re("caret trim",e);let a=e.split(" ").map(f=>Hne(f,this.options)).join(" ").split(/\s+/).map(f=>Xne(f,this.options));o&&(a=a.filter(f=>(Re("loose invalid filter",f,this.options),!!f.match(Xt[$t.COMPARATORLOOSE])))),Re("range list",a);let u=new Map,c=a.map(f=>new Av(f,this.options));for(let f of c){if(sI(f))return[f];u.set(f.value,f)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return oI.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>aI(n,r)&&e.set.some(i=>aI(i,r)&&n.every(o=>i.every(s=>o.intersects(s,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new jne(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Qne(this.set[r],e,this.options))return!0;return!1}};uI.exports=Ov;var $ne=iI(),oI=new $ne,Ine=ph(),Av=Sc(),Re=Ec(),jne=xt(),{safeRe:Xt,t:$t,comparatorTrimReplace:Nne,tildeTrimReplace:Lne,caretTrimReplace:Bne}=oa(),{FLAG_INCLUDE_PRERELEASE:qne,FLAG_LOOSE:Mne}=_c(),sI=t=>t.value==="<0.0.0-0",Une=t=>t.value==="",aI=(t,e)=>{let r=!0,n=t.slice(),i=n.pop();for(;r&&n.length;)r=n.every(o=>i.intersects(o,e)),i=n.pop();return r},Hne=(t,e)=>(Re("comp",t,e),t=Gne(t,e),Re("caret",t),t=Vne(t,e),Re("tildes",t),t=Kne(t,e),Re("xrange",t),t=Jne(t,e),Re("stars",t),t),It=t=>!t||t.toLowerCase()==="x"||t==="*",Vne=(t,e)=>t.trim().split(/\s+/).map(r=>zne(r,e)).join(" "),zne=(t,e)=>{let r=e.loose?Xt[$t.TILDELOOSE]:Xt[$t.TILDE];return t.replace(r,(n,i,o,s,a)=>{Re("tilde",t,n,i,o,s,a);let u;return It(i)?u="":It(o)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:It(s)?u=`>=${i}.${o}.0 <${i}.${+o+1}.0-0`:a?(Re("replaceTilde pr",a),u=`>=${i}.${o}.${s}-${a} <${i}.${+o+1}.0-0`):u=`>=${i}.${o}.${s} <${i}.${+o+1}.0-0`,Re("tilde return",u),u})},Gne=(t,e)=>t.trim().split(/\s+/).map(r=>Wne(r,e)).join(" "),Wne=(t,e)=>{Re("caret",t,e);let r=e.loose?Xt[$t.CARETLOOSE]:Xt[$t.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(i,o,s,a,u)=>{Re("caret",t,i,o,s,a,u);let c;return It(o)?c="":It(s)?c=`>=${o}.0.0${n} <${+o+1}.0.0-0`:It(a)?o==="0"?c=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`:c=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`:u?(Re("replaceCaret pr",u),o==="0"?s==="0"?c=`>=${o}.${s}.${a}-${u} <${o}.${s}.${+a+1}-0`:c=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`:c=`>=${o}.${s}.${a}-${u} <${+o+1}.0.0-0`):(Re("no pr"),o==="0"?s==="0"?c=`>=${o}.${s}.${a}${n} <${o}.${s}.${+a+1}-0`:c=`>=${o}.${s}.${a}${n} <${o}.${+s+1}.0-0`:c=`>=${o}.${s}.${a} <${+o+1}.0.0-0`),Re("caret return",c),c})},Kne=(t,e)=>(Re("replaceXRanges",t,e),t.split(/\s+/).map(r=>Yne(r,e)).join(" ")),Yne=(t,e)=>{t=t.trim();let r=e.loose?Xt[$t.XRANGELOOSE]:Xt[$t.XRANGE];return t.replace(r,(n,i,o,s,a,u)=>{Re("xRange",t,n,i,o,s,a,u);let c=It(o),l=c||It(s),f=l||It(a),h=f;return i==="="&&h&&(i=""),u=e.includePrerelease?"-0":"",c?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&h?(l&&(s=0),a=0,i===">"?(i=">=",l?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):i==="<="&&(i="<",l?o=+o+1:s=+s+1),i==="<"&&(u="-0"),n=`${i+o}.${s}.${a}${u}`):l?n=`>=${o}.0.0${u} <${+o+1}.0.0-0`:f&&(n=`>=${o}.${s}.0${u} <${o}.${+s+1}.0-0`),Re("xRange return",n),n})},Jne=(t,e)=>(Re("replaceStars",t,e),t.trim().replace(Xt[$t.STAR],"")),Xne=(t,e)=>(Re("replaceGTE0",t,e),t.trim().replace(Xt[e.includePrerelease?$t.GTE0PRE:$t.GTE0],"")),Zne=t=>(e,r,n,i,o,s,a,u,c,l,f,h)=>(It(n)?r="":It(i)?r=`>=${n}.0.0${t?"-0":""}`:It(o)?r=`>=${n}.${i}.0${t?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,It(c)?u="":It(l)?u=`<${+c+1}.0.0-0`:It(f)?u=`<${c}.${+l+1}.0-0`:h?u=`<=${c}.${l}.${f}-${h}`:t?u=`<${c}.${l}.${+f+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Qne=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(Re(t[n].semver),t[n].semver!==Av.ANY&&t[n].semver.prerelease.length>0){let i=t[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var Sc=D((lge,pI)=>{var xc=Symbol("SemVer ANY"),Pv=class t{static get ANY(){return xc}constructor(e,r){if(r=cI(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Tv("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===xc?this.value="":this.value=this.operator+this.semver.version,Tv("comp",this)}parse(e){let r=this.options.loose?lI[fI.COMPARATORLOOSE]:lI[fI.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new dI(n[2],this.options.loose):this.semver=xc}toString(){return this.value}test(e){if(Tv("Comparator.test",e,this.options.loose),this.semver===xc||e===xc)return!0;if(typeof e=="string")try{e=new dI(e,this.options)}catch{return!1}return kv(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new hI(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new hI(this.value,r).test(e.semver):(r=cI(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||kv(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||kv(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};pI.exports=Pv;var cI=ph(),{safeRe:lI,t:fI}=oa(),kv=xv(),Tv=Ec(),dI=xt(),hI=_r()});var Fc=D((fge,mI)=>{var eie=_r(),tie=(t,e,r)=>{try{e=new eie(e,r)}catch{return!1}return e.test(t)};mI.exports=tie});var yI=D((dge,gI)=>{var rie=_r(),nie=(t,e)=>new rie(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));gI.exports=nie});var vI=D((hge,DI)=>{var iie=xt(),oie=_r(),sie=(t,e,r)=>{let n=null,i=null,o=null;try{o=new oie(e,r)}catch{return null}return t.forEach(s=>{o.test(s)&&(!n||i.compare(s)===-1)&&(n=s,i=new iie(n,r))}),n};DI.exports=sie});var wI=D((pge,bI)=>{var aie=xt(),uie=_r(),cie=(t,e,r)=>{let n=null,i=null,o=null;try{o=new uie(e,r)}catch{return null}return t.forEach(s=>{o.test(s)&&(!n||i.compare(s)===1)&&(n=s,i=new aie(n,r))}),n};bI.exports=cie});var CI=D((mge,EI)=>{var Rv=xt(),lie=_r(),_I=Cc(),fie=(t,e)=>{t=new lie(t,e);let r=new Rv("0.0.0");if(t.test(r)||(r=new Rv("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let i=t.set[n],o=null;i.forEach(s=>{let a=new Rv(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||_I(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),o&&(!r||_I(r,o))&&(r=o)}return r&&t.test(r)?r:null};EI.exports=fie});var xI=D((gge,SI)=>{var die=_r(),hie=(t,e)=>{try{return new die(t,e).range||"*"}catch{return null}};SI.exports=hie});var Eh=D((yge,kI)=>{var pie=xt(),AI=Sc(),{ANY:mie}=AI,gie=_r(),yie=Fc(),FI=Cc(),OI=Dh(),Die=bh(),vie=vh(),bie=(t,e,r,n)=>{t=new pie(t,n),e=new gie(e,n);let i,o,s,a,u;switch(r){case">":i=FI,o=Die,s=OI,a=">",u=">=";break;case"<":i=OI,o=vie,s=FI,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(yie(t,e,n))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],f=null,h=null;if(l.forEach(d=>{d.semver===mie&&(d=new AI(">=0.0.0")),f=f||d,h=h||d,i(d.semver,f.semver,n)?f=d:s(d.semver,h.semver,n)&&(h=d)}),f.operator===a||f.operator===u||(!h.operator||h.operator===a)&&o(t,h.semver))return!1;if(h.operator===u&&s(t,h.semver))return!1}return!0};kI.exports=bie});var PI=D((Dge,TI)=>{var wie=Eh(),_ie=(t,e,r)=>wie(t,e,">",r);TI.exports=_ie});var $I=D((vge,RI)=>{var Eie=Eh(),Cie=(t,e,r)=>Eie(t,e,"<",r);RI.exports=Cie});var NI=D((bge,jI)=>{var II=_r(),Sie=(t,e,r)=>(t=new II(t,r),e=new II(e,r),t.intersects(e,r));jI.exports=Sie});var BI=D((wge,LI)=>{var xie=Fc(),Fie=wr();LI.exports=(t,e,r)=>{let n=[],i=null,o=null,s=t.sort((l,f)=>Fie(l,f,r));for(let l of s)xie(l,e,r)?(o=l,i||(i=l)):(o&&n.push([i,o]),o=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,f]of n)l===f?a.push(l):!f&&l===s[0]?a.push("*"):f?l===s[0]?a.push(`<=${f}`):a.push(`${l} - ${f}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var Nv=D((_ge,VI)=>{var qI=_r(),Iv=Sc(),{ANY:$v}=Iv,Oc=Fc(),jv=wr(),Oie=(t,e,r={})=>{if(t===e)return!0;t=new qI(t,r),e=new qI(e,r);let n=!1;e:for(let i of t.set){for(let o of e.set){let s=kie(i,o,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},Aie=[new Iv(">=0.0.0-0")],MI=[new Iv(">=0.0.0")],kie=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===$v){if(e.length===1&&e[0].semver===$v)return!0;r.includePrerelease?t=Aie:t=MI}if(e.length===1&&e[0].semver===$v){if(r.includePrerelease)return!0;e=MI}let n=new Set,i,o;for(let d of t)d.operator===">"||d.operator===">="?i=UI(i,d,r):d.operator==="<"||d.operator==="<="?o=HI(o,d,r):n.add(d.semver);if(n.size>1)return null;let s;if(i&&o){if(s=jv(i.semver,o.semver,r),s>0)return null;if(s===0&&(i.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(i&&!Oc(d,String(i),r)||o&&!Oc(d,String(o),r))return null;for(let p of e)if(!Oc(d,String(p),r))return!1;return!0}let a,u,c,l,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,h=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;f&&f.prerelease.length===1&&o.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(let d of e){if(l=l||d.operator===">"||d.operator===">=",c=c||d.operator==="<"||d.operator==="<=",i){if(h&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===h.major&&d.semver.minor===h.minor&&d.semver.patch===h.patch&&(h=!1),d.operator===">"||d.operator===">="){if(a=UI(i,d,r),a===d&&a!==i)return!1}else if(i.operator===">="&&!Oc(i.semver,String(d),r))return!1}if(o){if(f&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===f.major&&d.semver.minor===f.minor&&d.semver.patch===f.patch&&(f=!1),d.operator==="<"||d.operator==="<="){if(u=HI(o,d,r),u===d&&u!==o)return!1}else if(o.operator==="<="&&!Oc(o.semver,String(d),r))return!1}if(!d.operator&&(o||i)&&s!==0)return!1}return!(i&&c&&!o&&s!==0||o&&l&&!i&&s!==0||h||f)},UI=(t,e,r)=>{if(!t)return e;let n=jv(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},HI=(t,e,r)=>{if(!t)return e;let n=jv(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};VI.exports=Oie});var Bv=D((Ege,WI)=>{var Lv=oa(),zI=_c(),Tie=xt(),GI=_v(),Pie=mo(),Rie=v$(),$ie=w$(),Iie=C$(),jie=F$(),Nie=A$(),Lie=T$(),Bie=R$(),qie=I$(),Mie=wr(),Uie=B$(),Hie=M$(),Vie=yh(),zie=z$(),Gie=W$(),Wie=Cc(),Kie=Dh(),Yie=Cv(),Jie=Sv(),Xie=vh(),Zie=bh(),Qie=xv(),eoe=rI(),toe=Sc(),roe=_r(),noe=Fc(),ioe=yI(),ooe=vI(),soe=wI(),aoe=CI(),uoe=xI(),coe=Eh(),loe=PI(),foe=$I(),doe=NI(),hoe=BI(),poe=Nv();WI.exports={parse:Pie,valid:Rie,clean:$ie,inc:Iie,diff:jie,major:Nie,minor:Lie,patch:Bie,prerelease:qie,compare:Mie,rcompare:Uie,compareLoose:Hie,compareBuild:Vie,sort:zie,rsort:Gie,gt:Wie,lt:Kie,eq:Yie,neq:Jie,gte:Xie,lte:Zie,cmp:Qie,coerce:eoe,Comparator:toe,Range:roe,satisfies:noe,toComparators:ioe,maxSatisfying:ooe,minSatisfying:soe,minVersion:aoe,validRange:uoe,outside:coe,gtr:loe,ltr:foe,intersects:doe,simplifyRange:hoe,subset:poe,SemVer:Tie,re:Lv.re,src:Lv.src,tokens:Lv.t,SEMVER_SPEC_VERSION:zI.SEMVER_SPEC_VERSION,RELEASE_TYPES:zI.RELEASE_TYPES,compareIdentifiers:GI.compareIdentifiers,rcompareIdentifiers:GI.rcompareIdentifiers}});var oj=D(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.parseApkNameFromFlavor=W.checkJDKMajorVersion=W.resolvePlatform=W.checkPlatformVersions=W.getAddedPlatforms=W.getPlatformTargetName=W.promptForPlatformTarget=W.promptForPlatform=W.isValidEnterprisePlatform=W.getKnownEnterprisePlatforms=W.isValidCommunityPlatform=W.getKnownCommunityPlatforms=W.isValidPlatform=W.getKnownPlatforms=W.selectPlatforms=W.getProjectPlatformDirectory=W.getCLIVersion=W.getCoreVersion=W.getCapacitorPackageVersion=W.requireCapacitorPackage=W.getCapacitorPackage=W.runTask=W.runPlatformHook=W.runHooks=W.wait=W.checkAppName=W.checkAppId=W.checkAppDir=W.checkAppConfig=W.checkCapacitorPlatform=W.checkPackage=W.checkWebDir=W.check=void 0;var kc=(Cn(),ke(En)),gi=Us(),KI=e0(),go=require("path"),Se=kc.__importDefault(Gs()),aa=Wd(),JI=cc(),moe=t$(),YI=ml(),Ac=dh(),goe=hh();async function yoe(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
165
+ `),cre.logger.info(n)}Ce.printPlugins=dre;function yv(t,e){return t.xml.platform?t.xml.platform.filter(function(i){return i.$.name===e})[0]:[]}Ce.getPluginPlatform=yv;function hre(t,e,r){let n=yv(t,e);if(n){let i=n[r];if(i)return i}return[]}Ce.getPlatformElement=hre;function pre(t,e){var r,n,i,o;switch(e){case"ios":return(n=(r=t.ios)===null||r===void 0?void 0:r.type)!==null&&n!==void 0?n:0;case"android":return(o=(i=t.android)===null||i===void 0?void 0:i.type)!==null&&o!==void 0?o:0}return 0}Ce.getPluginType=pre;function mre(t,e){return Dv(t,e,"js-module")}Ce.getJSModules=mre;function gre(t,e){return Dv(t,e,"asset")}Ce.getAssets=gre;function yre(t,e,r){if(r.startsWith("node_modules")){let n=r.split("/").slice(1);n[0].startsWith("@")&&(n=[n[0]+"/"+n[1],...n.slice(2)]);let i=(0,XR.resolveNode)(t.app.rootDir,...n);if(!i)throw new Error(`Can't resolve module ${n[0]}`);return i}return(0,mv.join)(e.rootPath,r)}Ce.getFilePath=yre;function Dv(t,e,r){let n=[];t.xml[r]&&(n=n.concat(t.xml[r]));let i=yv(t,e);return i?.[r]&&(n=n.concat(i[r])),n}Ce.getAllElements=Dv});var r$={};mn(r$,{default:()=>Dre});var Dre,n$=ut(()=>{Dre={}});var hh=D(mi=>{"use strict";Object.defineProperty(mi,"__esModule",{value:!0});mi.isInstalled=mi.getCommandOutput=mi.runCommand=void 0;var vv=(n$(),ke(r$));async function i$(t,e,r={}){let n=new vv.Subprocess(t,e,r);try{return await n.output()}catch(i){throw i instanceof vv.SubprocessError?i.output?i.output:i.code?i.code:i.error?i.error.message:"Unknown error":i}}mi.runCommand=i$;async function vre(t,e,r={}){try{return(await i$(t,e,r)).trim()}catch{return null}}mi.getCommandOutput=vre;async function bre(t){try{await(0,vv.which)(t)}catch{return!1}return!0}mi.isInstalled=bre});var _c=D(($me,o$)=>{var wre="2.0.0",_re=Number.MAX_SAFE_INTEGER||9007199254740991,Ere=16,Cre=250,Sre=["major","premajor","minor","preminor","patch","prepatch","prerelease"];o$.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:Ere,MAX_SAFE_BUILD_LENGTH:Cre,MAX_SAFE_INTEGER:_re,RELEASE_TYPES:Sre,SEMVER_SPEC_VERSION:wre,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var Ec=D((Ime,s$)=>{var xre=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};s$.exports=xre});var oa=D((In,a$)=>{var{MAX_SAFE_COMPONENT_LENGTH:bv,MAX_SAFE_BUILD_LENGTH:Fre,MAX_LENGTH:Ore}=_c(),Are=Ec();In=a$.exports={};var kre=In.re=[],Tre=In.safeRe=[],z=In.src=[],G=In.t={},Pre=0,wv="[a-zA-Z0-9-]",Rre=[["\\s",1],["\\d",Ore],[wv,Fre]],$re=t=>{for(let[e,r]of Rre)t=t.split(`${e}*`).join(`${e}{0,${r}}`).split(`${e}+`).join(`${e}{1,${r}}`);return t},ne=(t,e,r)=>{let n=$re(e),i=Pre++;Are(t,i,e),G[t]=i,z[i]=e,kre[i]=new RegExp(e,r?"g":void 0),Tre[i]=new RegExp(n,r?"g":void 0)};ne("NUMERICIDENTIFIER","0|[1-9]\\d*");ne("NUMERICIDENTIFIERLOOSE","\\d+");ne("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${wv}*`);ne("MAINVERSION",`(${z[G.NUMERICIDENTIFIER]})\\.(${z[G.NUMERICIDENTIFIER]})\\.(${z[G.NUMERICIDENTIFIER]})`);ne("MAINVERSIONLOOSE",`(${z[G.NUMERICIDENTIFIERLOOSE]})\\.(${z[G.NUMERICIDENTIFIERLOOSE]})\\.(${z[G.NUMERICIDENTIFIERLOOSE]})`);ne("PRERELEASEIDENTIFIER",`(?:${z[G.NUMERICIDENTIFIER]}|${z[G.NONNUMERICIDENTIFIER]})`);ne("PRERELEASEIDENTIFIERLOOSE",`(?:${z[G.NUMERICIDENTIFIERLOOSE]}|${z[G.NONNUMERICIDENTIFIER]})`);ne("PRERELEASE",`(?:-(${z[G.PRERELEASEIDENTIFIER]}(?:\\.${z[G.PRERELEASEIDENTIFIER]})*))`);ne("PRERELEASELOOSE",`(?:-?(${z[G.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${z[G.PRERELEASEIDENTIFIERLOOSE]})*))`);ne("BUILDIDENTIFIER",`${wv}+`);ne("BUILD",`(?:\\+(${z[G.BUILDIDENTIFIER]}(?:\\.${z[G.BUILDIDENTIFIER]})*))`);ne("FULLPLAIN",`v?${z[G.MAINVERSION]}${z[G.PRERELEASE]}?${z[G.BUILD]}?`);ne("FULL",`^${z[G.FULLPLAIN]}$`);ne("LOOSEPLAIN",`[v=\\s]*${z[G.MAINVERSIONLOOSE]}${z[G.PRERELEASELOOSE]}?${z[G.BUILD]}?`);ne("LOOSE",`^${z[G.LOOSEPLAIN]}$`);ne("GTLT","((?:<|>)?=?)");ne("XRANGEIDENTIFIERLOOSE",`${z[G.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);ne("XRANGEIDENTIFIER",`${z[G.NUMERICIDENTIFIER]}|x|X|\\*`);ne("XRANGEPLAIN",`[v=\\s]*(${z[G.XRANGEIDENTIFIER]})(?:\\.(${z[G.XRANGEIDENTIFIER]})(?:\\.(${z[G.XRANGEIDENTIFIER]})(?:${z[G.PRERELEASE]})?${z[G.BUILD]}?)?)?`);ne("XRANGEPLAINLOOSE",`[v=\\s]*(${z[G.XRANGEIDENTIFIERLOOSE]})(?:\\.(${z[G.XRANGEIDENTIFIERLOOSE]})(?:\\.(${z[G.XRANGEIDENTIFIERLOOSE]})(?:${z[G.PRERELEASELOOSE]})?${z[G.BUILD]}?)?)?`);ne("XRANGE",`^${z[G.GTLT]}\\s*${z[G.XRANGEPLAIN]}$`);ne("XRANGELOOSE",`^${z[G.GTLT]}\\s*${z[G.XRANGEPLAINLOOSE]}$`);ne("COERCEPLAIN",`(^|[^\\d])(\\d{1,${bv}})(?:\\.(\\d{1,${bv}}))?(?:\\.(\\d{1,${bv}}))?`);ne("COERCE",`${z[G.COERCEPLAIN]}(?:$|[^\\d])`);ne("COERCEFULL",z[G.COERCEPLAIN]+`(?:${z[G.PRERELEASE]})?(?:${z[G.BUILD]})?(?:$|[^\\d])`);ne("COERCERTL",z[G.COERCE],!0);ne("COERCERTLFULL",z[G.COERCEFULL],!0);ne("LONETILDE","(?:~>?)");ne("TILDETRIM",`(\\s*)${z[G.LONETILDE]}\\s+`,!0);In.tildeTrimReplace="$1~";ne("TILDE",`^${z[G.LONETILDE]}${z[G.XRANGEPLAIN]}$`);ne("TILDELOOSE",`^${z[G.LONETILDE]}${z[G.XRANGEPLAINLOOSE]}$`);ne("LONECARET","(?:\\^)");ne("CARETTRIM",`(\\s*)${z[G.LONECARET]}\\s+`,!0);In.caretTrimReplace="$1^";ne("CARET",`^${z[G.LONECARET]}${z[G.XRANGEPLAIN]}$`);ne("CARETLOOSE",`^${z[G.LONECARET]}${z[G.XRANGEPLAINLOOSE]}$`);ne("COMPARATORLOOSE",`^${z[G.GTLT]}\\s*(${z[G.LOOSEPLAIN]})$|^$`);ne("COMPARATOR",`^${z[G.GTLT]}\\s*(${z[G.FULLPLAIN]})$|^$`);ne("COMPARATORTRIM",`(\\s*)${z[G.GTLT]}\\s*(${z[G.LOOSEPLAIN]}|${z[G.XRANGEPLAIN]})`,!0);In.comparatorTrimReplace="$1$2$3";ne("HYPHENRANGE",`^\\s*(${z[G.XRANGEPLAIN]})\\s+-\\s+(${z[G.XRANGEPLAIN]})\\s*$`);ne("HYPHENRANGELOOSE",`^\\s*(${z[G.XRANGEPLAINLOOSE]})\\s+-\\s+(${z[G.XRANGEPLAINLOOSE]})\\s*$`);ne("STAR","(<|>)?=?\\s*\\*");ne("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");ne("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var ph=D((jme,u$)=>{var Ire=Object.freeze({loose:!0}),jre=Object.freeze({}),Nre=t=>t?typeof t!="object"?Ire:t:jre;u$.exports=Nre});var _v=D((Nme,f$)=>{var c$=/^[0-9]+$/,l$=(t,e)=>{let r=c$.test(t),n=c$.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:t<e?-1:1},Lre=(t,e)=>l$(e,t);f$.exports={compareIdentifiers:l$,rcompareIdentifiers:Lre}});var xt=D((Lme,m$)=>{var mh=Ec(),{MAX_LENGTH:d$,MAX_SAFE_INTEGER:gh}=_c(),{safeRe:h$,t:p$}=oa(),Bre=ph(),{compareIdentifiers:sa}=_v(),Ev=class t{constructor(e,r){if(r=Bre(r),e instanceof t){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>d$)throw new TypeError(`version is longer than ${d$} characters`);mh("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;let n=e.trim().match(r.loose?h$[p$.LOOSE]:h$[p$.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>gh||this.major<0)throw new TypeError("Invalid major version");if(this.minor>gh||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>gh||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){let o=+i;if(o>=0&&o<gh)return o}return i}):this.prerelease=[],this.build=n[5]?n[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(e){if(mh("SemVer.compare",this.version,this.options,e),!(e instanceof t)){if(typeof e=="string"&&e===this.version)return 0;e=new t(e,this.options)}return e.version===this.version?0:this.compareMain(e)||this.comparePre(e)}compareMain(e){return e instanceof t||(e=new t(e,this.options)),sa(this.major,e.major)||sa(this.minor,e.minor)||sa(this.patch,e.patch)}comparePre(e){if(e instanceof t||(e=new t(e,this.options)),this.prerelease.length&&!e.prerelease.length)return-1;if(!this.prerelease.length&&e.prerelease.length)return 1;if(!this.prerelease.length&&!e.prerelease.length)return 0;let r=0;do{let n=this.prerelease[r],i=e.prerelease[r];if(mh("prerelease compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return sa(n,i)}while(++r)}compareBuild(e){e instanceof t||(e=new t(e,this.options));let r=0;do{let n=this.build[r],i=e.build[r];if(mh("build compare",r,n,i),n===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(n===void 0)return-1;if(n===i)continue;return sa(n,i)}while(++r)}inc(e,r,n){switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);break;case"major":(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case"patch":this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case"pre":{let i=Number(n)?1:0;if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(this.prerelease.length===0)this.prerelease=[i];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let o=[r,i];n===!1&&(o=[r]),sa(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};m$.exports=Ev});var mo=D((Bme,y$)=>{var g$=xt(),qre=(t,e,r=!1)=>{if(t instanceof g$)return t;try{return new g$(t,e)}catch(n){if(!r)return null;throw n}};y$.exports=qre});var v$=D((qme,D$)=>{var Mre=mo(),Ure=(t,e)=>{let r=Mre(t,e);return r?r.version:null};D$.exports=Ure});var w$=D((Mme,b$)=>{var Hre=mo(),Vre=(t,e)=>{let r=Hre(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};b$.exports=Vre});var C$=D((Ume,E$)=>{var _$=xt(),zre=(t,e,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new _$(t instanceof _$?t.version:t,r).inc(e,n,i).version}catch{return null}};E$.exports=zre});var F$=D((Hme,x$)=>{var S$=mo(),Gre=(t,e)=>{let r=S$(t,null,!0),n=S$(e,null,!0),i=r.compare(n);if(i===0)return null;let o=i>0,s=o?r:n,a=o?n:r,u=!!s.prerelease.length;if(!!a.prerelease.length&&!u)return!a.patch&&!a.minor?"major":s.patch?"patch":s.minor?"minor":"major";let l=u?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};x$.exports=Gre});var A$=D((Vme,O$)=>{var Wre=xt(),Kre=(t,e)=>new Wre(t,e).major;O$.exports=Kre});var T$=D((zme,k$)=>{var Yre=xt(),Jre=(t,e)=>new Yre(t,e).minor;k$.exports=Jre});var R$=D((Gme,P$)=>{var Xre=xt(),Zre=(t,e)=>new Xre(t,e).patch;P$.exports=Zre});var I$=D((Wme,$$)=>{var Qre=mo(),ene=(t,e)=>{let r=Qre(t,e);return r&&r.prerelease.length?r.prerelease:null};$$.exports=ene});var wr=D((Kme,N$)=>{var j$=xt(),tne=(t,e,r)=>new j$(t,r).compare(new j$(e,r));N$.exports=tne});var B$=D((Yme,L$)=>{var rne=wr(),nne=(t,e,r)=>rne(e,t,r);L$.exports=nne});var M$=D((Jme,q$)=>{var ine=wr(),one=(t,e)=>ine(t,e,!0);q$.exports=one});var yh=D((Xme,H$)=>{var U$=xt(),sne=(t,e,r)=>{let n=new U$(t,r),i=new U$(e,r);return n.compare(i)||n.compareBuild(i)};H$.exports=sne});var z$=D((Zme,V$)=>{var ane=yh(),une=(t,e)=>t.sort((r,n)=>ane(r,n,e));V$.exports=une});var W$=D((Qme,G$)=>{var cne=yh(),lne=(t,e)=>t.sort((r,n)=>cne(n,r,e));G$.exports=lne});var Cc=D((ege,K$)=>{var fne=wr(),dne=(t,e,r)=>fne(t,e,r)>0;K$.exports=dne});var Dh=D((tge,Y$)=>{var hne=wr(),pne=(t,e,r)=>hne(t,e,r)<0;Y$.exports=pne});var Cv=D((rge,J$)=>{var mne=wr(),gne=(t,e,r)=>mne(t,e,r)===0;J$.exports=gne});var Sv=D((nge,X$)=>{var yne=wr(),Dne=(t,e,r)=>yne(t,e,r)!==0;X$.exports=Dne});var vh=D((ige,Z$)=>{var vne=wr(),bne=(t,e,r)=>vne(t,e,r)>=0;Z$.exports=bne});var bh=D((oge,Q$)=>{var wne=wr(),_ne=(t,e,r)=>wne(t,e,r)<=0;Q$.exports=_ne});var xv=D((sge,eI)=>{var Ene=Cv(),Cne=Sv(),Sne=Cc(),xne=vh(),Fne=Dh(),One=bh(),Ane=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return Ene(t,r,n);case"!=":return Cne(t,r,n);case">":return Sne(t,r,n);case">=":return xne(t,r,n);case"<":return Fne(t,r,n);case"<=":return One(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};eI.exports=Ane});var rI=D((age,tI)=>{var kne=xt(),Tne=mo(),{safeRe:wh,t:_h}=oa(),Pne=(t,e)=>{if(t instanceof kne)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(e.includePrerelease?wh[_h.COERCEFULL]:wh[_h.COERCE]);else{let u=e.includePrerelease?wh[_h.COERCERTLFULL]:wh[_h.COERCERTL],c;for(;(c=u.exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||c.index+c[0].length!==r.index+r[0].length)&&(r=c),u.lastIndex=c.index+c[1].length+c[2].length;u.lastIndex=-1}if(r===null)return null;let n=r[2],i=r[3]||"0",o=r[4]||"0",s=e.includePrerelease&&r[5]?`-${r[5]}`:"",a=e.includePrerelease&&r[6]?`+${r[6]}`:"";return Tne(`${n}.${i}.${o}${s}${a}`,e)};tI.exports=Pne});var iI=D((uge,nI)=>{var Fv=class{constructor(){this.max=1e3,this.map=new Map}get(e){let r=this.map.get(e);if(r!==void 0)return this.map.delete(e),this.map.set(e,r),r}delete(e){return this.map.delete(e)}set(e,r){if(!this.delete(e)&&r!==void 0){if(this.map.size>=this.max){let i=this.map.keys().next().value;this.delete(i)}this.map.set(e,r)}return this}};nI.exports=Fv});var _r=D((cge,uI)=>{var Rne=/\s+/g,Ov=class t{constructor(e,r){if(r=Ine(r),e instanceof t)return e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease?e:new t(e.raw,r);if(e instanceof Av)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=e.trim().replace(Rne," "),this.set=this.raw.split("||").map(n=>this.parseRange(n.trim())).filter(n=>n.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let n=this.set[0];if(this.set=this.set.filter(i=>!sI(i[0])),this.set.length===0)this.set=[n];else if(this.set.length>1){for(let i of this.set)if(i.length===1&&Une(i[0])){this.set=[i];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+="||");let r=this.set[e];for(let n=0;n<r.length;n++)n>0&&(this.formatted+=" "),this.formatted+=r[n].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let n=((this.options.includePrerelease&&qne)|(this.options.loose&&Mne))+":"+e,i=oI.get(n);if(i)return i;let o=this.options.loose,s=o?Xt[$t.HYPHENRANGELOOSE]:Xt[$t.HYPHENRANGE];e=e.replace(s,Zne(this.options.includePrerelease)),Re("hyphen replace",e),e=e.replace(Xt[$t.COMPARATORTRIM],Nne),Re("comparator trim",e),e=e.replace(Xt[$t.TILDETRIM],Lne),Re("tilde trim",e),e=e.replace(Xt[$t.CARETTRIM],Bne),Re("caret trim",e);let a=e.split(" ").map(f=>Hne(f,this.options)).join(" ").split(/\s+/).map(f=>Xne(f,this.options));o&&(a=a.filter(f=>(Re("loose invalid filter",f,this.options),!!f.match(Xt[$t.COMPARATORLOOSE])))),Re("range list",a);let u=new Map,c=a.map(f=>new Av(f,this.options));for(let f of c){if(sI(f))return[f];u.set(f.value,f)}u.size>1&&u.has("")&&u.delete("");let l=[...u.values()];return oI.set(n,l),l}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some(n=>aI(n,r)&&e.set.some(i=>aI(i,r)&&n.every(o=>i.every(s=>o.intersects(s,r)))))}test(e){if(!e)return!1;if(typeof e=="string")try{e=new jne(e,this.options)}catch{return!1}for(let r=0;r<this.set.length;r++)if(Qne(this.set[r],e,this.options))return!0;return!1}};uI.exports=Ov;var $ne=iI(),oI=new $ne,Ine=ph(),Av=Sc(),Re=Ec(),jne=xt(),{safeRe:Xt,t:$t,comparatorTrimReplace:Nne,tildeTrimReplace:Lne,caretTrimReplace:Bne}=oa(),{FLAG_INCLUDE_PRERELEASE:qne,FLAG_LOOSE:Mne}=_c(),sI=t=>t.value==="<0.0.0-0",Une=t=>t.value==="",aI=(t,e)=>{let r=!0,n=t.slice(),i=n.pop();for(;r&&n.length;)r=n.every(o=>i.intersects(o,e)),i=n.pop();return r},Hne=(t,e)=>(Re("comp",t,e),t=Gne(t,e),Re("caret",t),t=Vne(t,e),Re("tildes",t),t=Kne(t,e),Re("xrange",t),t=Jne(t,e),Re("stars",t),t),It=t=>!t||t.toLowerCase()==="x"||t==="*",Vne=(t,e)=>t.trim().split(/\s+/).map(r=>zne(r,e)).join(" "),zne=(t,e)=>{let r=e.loose?Xt[$t.TILDELOOSE]:Xt[$t.TILDE];return t.replace(r,(n,i,o,s,a)=>{Re("tilde",t,n,i,o,s,a);let u;return It(i)?u="":It(o)?u=`>=${i}.0.0 <${+i+1}.0.0-0`:It(s)?u=`>=${i}.${o}.0 <${i}.${+o+1}.0-0`:a?(Re("replaceTilde pr",a),u=`>=${i}.${o}.${s}-${a} <${i}.${+o+1}.0-0`):u=`>=${i}.${o}.${s} <${i}.${+o+1}.0-0`,Re("tilde return",u),u})},Gne=(t,e)=>t.trim().split(/\s+/).map(r=>Wne(r,e)).join(" "),Wne=(t,e)=>{Re("caret",t,e);let r=e.loose?Xt[$t.CARETLOOSE]:Xt[$t.CARET],n=e.includePrerelease?"-0":"";return t.replace(r,(i,o,s,a,u)=>{Re("caret",t,i,o,s,a,u);let c;return It(o)?c="":It(s)?c=`>=${o}.0.0${n} <${+o+1}.0.0-0`:It(a)?o==="0"?c=`>=${o}.${s}.0${n} <${o}.${+s+1}.0-0`:c=`>=${o}.${s}.0${n} <${+o+1}.0.0-0`:u?(Re("replaceCaret pr",u),o==="0"?s==="0"?c=`>=${o}.${s}.${a}-${u} <${o}.${s}.${+a+1}-0`:c=`>=${o}.${s}.${a}-${u} <${o}.${+s+1}.0-0`:c=`>=${o}.${s}.${a}-${u} <${+o+1}.0.0-0`):(Re("no pr"),o==="0"?s==="0"?c=`>=${o}.${s}.${a}${n} <${o}.${s}.${+a+1}-0`:c=`>=${o}.${s}.${a}${n} <${o}.${+s+1}.0-0`:c=`>=${o}.${s}.${a} <${+o+1}.0.0-0`),Re("caret return",c),c})},Kne=(t,e)=>(Re("replaceXRanges",t,e),t.split(/\s+/).map(r=>Yne(r,e)).join(" ")),Yne=(t,e)=>{t=t.trim();let r=e.loose?Xt[$t.XRANGELOOSE]:Xt[$t.XRANGE];return t.replace(r,(n,i,o,s,a,u)=>{Re("xRange",t,n,i,o,s,a,u);let c=It(o),l=c||It(s),f=l||It(a),h=f;return i==="="&&h&&(i=""),u=e.includePrerelease?"-0":"",c?i===">"||i==="<"?n="<0.0.0-0":n="*":i&&h?(l&&(s=0),a=0,i===">"?(i=">=",l?(o=+o+1,s=0,a=0):(s=+s+1,a=0)):i==="<="&&(i="<",l?o=+o+1:s=+s+1),i==="<"&&(u="-0"),n=`${i+o}.${s}.${a}${u}`):l?n=`>=${o}.0.0${u} <${+o+1}.0.0-0`:f&&(n=`>=${o}.${s}.0${u} <${o}.${+s+1}.0-0`),Re("xRange return",n),n})},Jne=(t,e)=>(Re("replaceStars",t,e),t.trim().replace(Xt[$t.STAR],"")),Xne=(t,e)=>(Re("replaceGTE0",t,e),t.trim().replace(Xt[e.includePrerelease?$t.GTE0PRE:$t.GTE0],"")),Zne=t=>(e,r,n,i,o,s,a,u,c,l,f,h)=>(It(n)?r="":It(i)?r=`>=${n}.0.0${t?"-0":""}`:It(o)?r=`>=${n}.${i}.0${t?"-0":""}`:s?r=`>=${r}`:r=`>=${r}${t?"-0":""}`,It(c)?u="":It(l)?u=`<${+c+1}.0.0-0`:It(f)?u=`<${c}.${+l+1}.0-0`:h?u=`<=${c}.${l}.${f}-${h}`:t?u=`<${c}.${l}.${+f+1}-0`:u=`<=${u}`,`${r} ${u}`.trim()),Qne=(t,e,r)=>{for(let n=0;n<t.length;n++)if(!t[n].test(e))return!1;if(e.prerelease.length&&!r.includePrerelease){for(let n=0;n<t.length;n++)if(Re(t[n].semver),t[n].semver!==Av.ANY&&t[n].semver.prerelease.length>0){let i=t[n].semver;if(i.major===e.major&&i.minor===e.minor&&i.patch===e.patch)return!0}return!1}return!0}});var Sc=D((lge,pI)=>{var xc=Symbol("SemVer ANY"),Pv=class t{static get ANY(){return xc}constructor(e,r){if(r=cI(r),e instanceof t){if(e.loose===!!r.loose)return e;e=e.value}e=e.trim().split(/\s+/).join(" "),Tv("comparator",e,r),this.options=r,this.loose=!!r.loose,this.parse(e),this.semver===xc?this.value="":this.value=this.operator+this.semver.version,Tv("comp",this)}parse(e){let r=this.options.loose?lI[fI.COMPARATORLOOSE]:lI[fI.COMPARATOR],n=e.match(r);if(!n)throw new TypeError(`Invalid comparator: ${e}`);this.operator=n[1]!==void 0?n[1]:"",this.operator==="="&&(this.operator=""),n[2]?this.semver=new dI(n[2],this.options.loose):this.semver=xc}toString(){return this.value}test(e){if(Tv("Comparator.test",e,this.options.loose),this.semver===xc||e===xc)return!0;if(typeof e=="string")try{e=new dI(e,this.options)}catch{return!1}return kv(e,this.operator,this.semver,this.options)}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new hI(e.value,r).test(this.value):e.operator===""?e.value===""?!0:new hI(this.value,r).test(e.semver):(r=cI(r),r.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0")||!r.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&e.operator.startsWith(">")||this.operator.startsWith("<")&&e.operator.startsWith("<")||this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("=")||kv(this.semver,"<",e.semver,r)&&this.operator.startsWith(">")&&e.operator.startsWith("<")||kv(this.semver,">",e.semver,r)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))}};pI.exports=Pv;var cI=ph(),{safeRe:lI,t:fI}=oa(),kv=xv(),Tv=Ec(),dI=xt(),hI=_r()});var Fc=D((fge,mI)=>{var eie=_r(),tie=(t,e,r)=>{try{e=new eie(e,r)}catch{return!1}return e.test(t)};mI.exports=tie});var yI=D((dge,gI)=>{var rie=_r(),nie=(t,e)=>new rie(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));gI.exports=nie});var vI=D((hge,DI)=>{var iie=xt(),oie=_r(),sie=(t,e,r)=>{let n=null,i=null,o=null;try{o=new oie(e,r)}catch{return null}return t.forEach(s=>{o.test(s)&&(!n||i.compare(s)===-1)&&(n=s,i=new iie(n,r))}),n};DI.exports=sie});var wI=D((pge,bI)=>{var aie=xt(),uie=_r(),cie=(t,e,r)=>{let n=null,i=null,o=null;try{o=new uie(e,r)}catch{return null}return t.forEach(s=>{o.test(s)&&(!n||i.compare(s)===1)&&(n=s,i=new aie(n,r))}),n};bI.exports=cie});var CI=D((mge,EI)=>{var Rv=xt(),lie=_r(),_I=Cc(),fie=(t,e)=>{t=new lie(t,e);let r=new Rv("0.0.0");if(t.test(r)||(r=new Rv("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n<t.set.length;++n){let i=t.set[n],o=null;i.forEach(s=>{let a=new Rv(s.semver.version);switch(s.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!o||_I(a,o))&&(o=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),o&&(!r||_I(r,o))&&(r=o)}return r&&t.test(r)?r:null};EI.exports=fie});var xI=D((gge,SI)=>{var die=_r(),hie=(t,e)=>{try{return new die(t,e).range||"*"}catch{return null}};SI.exports=hie});var Eh=D((yge,kI)=>{var pie=xt(),AI=Sc(),{ANY:mie}=AI,gie=_r(),yie=Fc(),FI=Cc(),OI=Dh(),Die=bh(),vie=vh(),bie=(t,e,r,n)=>{t=new pie(t,n),e=new gie(e,n);let i,o,s,a,u;switch(r){case">":i=FI,o=Die,s=OI,a=">",u=">=";break;case"<":i=OI,o=vie,s=FI,a="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(yie(t,e,n))return!1;for(let c=0;c<e.set.length;++c){let l=e.set[c],f=null,h=null;if(l.forEach(d=>{d.semver===mie&&(d=new AI(">=0.0.0")),f=f||d,h=h||d,i(d.semver,f.semver,n)?f=d:s(d.semver,h.semver,n)&&(h=d)}),f.operator===a||f.operator===u||(!h.operator||h.operator===a)&&o(t,h.semver))return!1;if(h.operator===u&&s(t,h.semver))return!1}return!0};kI.exports=bie});var PI=D((Dge,TI)=>{var wie=Eh(),_ie=(t,e,r)=>wie(t,e,">",r);TI.exports=_ie});var $I=D((vge,RI)=>{var Eie=Eh(),Cie=(t,e,r)=>Eie(t,e,"<",r);RI.exports=Cie});var NI=D((bge,jI)=>{var II=_r(),Sie=(t,e,r)=>(t=new II(t,r),e=new II(e,r),t.intersects(e,r));jI.exports=Sie});var BI=D((wge,LI)=>{var xie=Fc(),Fie=wr();LI.exports=(t,e,r)=>{let n=[],i=null,o=null,s=t.sort((l,f)=>Fie(l,f,r));for(let l of s)xie(l,e,r)?(o=l,i||(i=l)):(o&&n.push([i,o]),o=null,i=null);i&&n.push([i,null]);let a=[];for(let[l,f]of n)l===f?a.push(l):!f&&l===s[0]?a.push("*"):f?l===s[0]?a.push(`<=${f}`):a.push(`${l} - ${f}`):a.push(`>=${l}`);let u=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return u.length<c.length?u:e}});var Nv=D((_ge,VI)=>{var qI=_r(),Iv=Sc(),{ANY:$v}=Iv,Oc=Fc(),jv=wr(),Oie=(t,e,r={})=>{if(t===e)return!0;t=new qI(t,r),e=new qI(e,r);let n=!1;e:for(let i of t.set){for(let o of e.set){let s=kie(i,o,r);if(n=n||s!==null,s)continue e}if(n)return!1}return!0},Aie=[new Iv(">=0.0.0-0")],MI=[new Iv(">=0.0.0")],kie=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===$v){if(e.length===1&&e[0].semver===$v)return!0;r.includePrerelease?t=Aie:t=MI}if(e.length===1&&e[0].semver===$v){if(r.includePrerelease)return!0;e=MI}let n=new Set,i,o;for(let d of t)d.operator===">"||d.operator===">="?i=UI(i,d,r):d.operator==="<"||d.operator==="<="?o=HI(o,d,r):n.add(d.semver);if(n.size>1)return null;let s;if(i&&o){if(s=jv(i.semver,o.semver,r),s>0)return null;if(s===0&&(i.operator!==">="||o.operator!=="<="))return null}for(let d of n){if(i&&!Oc(d,String(i),r)||o&&!Oc(d,String(o),r))return null;for(let p of e)if(!Oc(d,String(p),r))return!1;return!0}let a,u,c,l,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,h=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;f&&f.prerelease.length===1&&o.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(let d of e){if(l=l||d.operator===">"||d.operator===">=",c=c||d.operator==="<"||d.operator==="<=",i){if(h&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===h.major&&d.semver.minor===h.minor&&d.semver.patch===h.patch&&(h=!1),d.operator===">"||d.operator===">="){if(a=UI(i,d,r),a===d&&a!==i)return!1}else if(i.operator===">="&&!Oc(i.semver,String(d),r))return!1}if(o){if(f&&d.semver.prerelease&&d.semver.prerelease.length&&d.semver.major===f.major&&d.semver.minor===f.minor&&d.semver.patch===f.patch&&(f=!1),d.operator==="<"||d.operator==="<="){if(u=HI(o,d,r),u===d&&u!==o)return!1}else if(o.operator==="<="&&!Oc(o.semver,String(d),r))return!1}if(!d.operator&&(o||i)&&s!==0)return!1}return!(i&&c&&!o&&s!==0||o&&l&&!i&&s!==0||h||f)},UI=(t,e,r)=>{if(!t)return e;let n=jv(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},HI=(t,e,r)=>{if(!t)return e;let n=jv(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};VI.exports=Oie});var Bv=D((Ege,WI)=>{var Lv=oa(),zI=_c(),Tie=xt(),GI=_v(),Pie=mo(),Rie=v$(),$ie=w$(),Iie=C$(),jie=F$(),Nie=A$(),Lie=T$(),Bie=R$(),qie=I$(),Mie=wr(),Uie=B$(),Hie=M$(),Vie=yh(),zie=z$(),Gie=W$(),Wie=Cc(),Kie=Dh(),Yie=Cv(),Jie=Sv(),Xie=vh(),Zie=bh(),Qie=xv(),eoe=rI(),toe=Sc(),roe=_r(),noe=Fc(),ioe=yI(),ooe=vI(),soe=wI(),aoe=CI(),uoe=xI(),coe=Eh(),loe=PI(),foe=$I(),doe=NI(),hoe=BI(),poe=Nv();WI.exports={parse:Pie,valid:Rie,clean:$ie,inc:Iie,diff:jie,major:Nie,minor:Lie,patch:Bie,prerelease:qie,compare:Mie,rcompare:Uie,compareLoose:Hie,compareBuild:Vie,sort:zie,rsort:Gie,gt:Wie,lt:Kie,eq:Yie,neq:Jie,gte:Xie,lte:Zie,cmp:Qie,coerce:eoe,Comparator:toe,Range:roe,satisfies:noe,toComparators:ioe,maxSatisfying:ooe,minSatisfying:soe,minVersion:aoe,validRange:uoe,outside:coe,gtr:loe,ltr:foe,intersects:doe,simplifyRange:hoe,subset:poe,SemVer:Tie,re:Lv.re,src:Lv.src,tokens:Lv.t,SEMVER_SPEC_VERSION:zI.SEMVER_SPEC_VERSION,RELEASE_TYPES:zI.RELEASE_TYPES,compareIdentifiers:GI.compareIdentifiers,rcompareIdentifiers:GI.rcompareIdentifiers}});var o6=D(W=>{"use strict";Object.defineProperty(W,"__esModule",{value:!0});W.parseApkNameFromFlavor=W.checkJDKMajorVersion=W.resolvePlatform=W.checkPlatformVersions=W.getAddedPlatforms=W.getPlatformTargetName=W.promptForPlatformTarget=W.promptForPlatform=W.isValidEnterprisePlatform=W.getKnownEnterprisePlatforms=W.isValidCommunityPlatform=W.getKnownCommunityPlatforms=W.isValidPlatform=W.getKnownPlatforms=W.selectPlatforms=W.getProjectPlatformDirectory=W.getCLIVersion=W.getCoreVersion=W.getCapacitorPackageVersion=W.requireCapacitorPackage=W.getCapacitorPackage=W.runTask=W.runPlatformHook=W.runHooks=W.wait=W.checkAppName=W.checkAppId=W.checkAppDir=W.checkAppConfig=W.checkCapacitorPlatform=W.checkPackage=W.checkWebDir=W.check=void 0;var kc=(Cn(),ke(En)),gi=Us(),KI=e0(),go=require("path"),Se=kc.__importDefault(Gs()),aa=Wd(),JI=cc(),moe=t$(),YI=ml(),Ac=dh(),goe=hh();async function yoe(t){let r=(await Promise.all(t.map(n=>n()))).filter(n=>n!=null);if(r.length>0)throw r.join(`
166
166
  `)}W.check=yoe;async function Doe(t){var e;return!((e=t.app.extConfig.server)===null||e===void 0)&&e.url?null:["",".","..","../","./"].includes(t.app.webDir)?`"${t.app.webDir}" is not a valid value for webDir`:await(0,gi.pathExists)(t.app.webDirAbs)?await(0,gi.pathExists)((0,go.join)(t.app.webDirAbs,"index.html"))?null:`The web assets directory (${Se.default.strong((0,KI.prettyPath)(t.app.webDirAbs))}) must contain an ${Se.default.strong("index.html")} file.
167
167
  It will be the entry point for the web portion of the Capacitor app.`:`Could not find the web assets directory: ${Se.default.strong((0,KI.prettyPath)(t.app.webDirAbs))}.
168
168
  Please create it and make sure it has an ${Se.default.strong("index.html")} file. You can change the path of this directory in ${Se.default.strong(t.app.extConfigName)} (${Se.default.input("webDir")} option). You may need to compile the web assets for your app (typically ${Se.default.input("npm run build")}). More info: ${Se.default.strong("https://capacitorjs.com/docs/basics/workflow#sync-your-project")}`}W.checkWebDir=Doe;async function voe(){return await(0,gi.pathExists)("package.json")||await(0,gi.pathExists)("project.json")?null:`The Capacitor CLI needs to run at the root of an npm package or in a valid NX monorepo.
@@ -171,33 +171,33 @@ More info: ${Se.default.strong("https://docs.npmjs.com/cli/init")}`}W.checkPacka
171
171
  You must install it in your project first, e.g. w/ ${Se.default.input(`npm install @capacitor/${e}`)}`}W.checkCapacitorPlatform=boe;async function woe(t){if(!t.app.appId)return`Missing ${Se.default.input("appId")} for new platform.
172
172
  Please add it in ${t.app.extConfigName} or run ${Se.default.input("npx cap init")}.`;if(!t.app.appName)return`Missing ${Se.default.input("appName")} for new platform.
173
173
  Please add it in ${t.app.extConfigName} or run ${Se.default.input("npx cap init")}.`;let e=await XI(t,t.app.appId);if(e)return e;let r=await ZI(t,t.app.appName);return r||null}W.checkAppConfig=woe;async function _oe(t,e){return/^\S*$/.test(e)?null:"Your app directory should not contain spaces"}W.checkAppDir=_oe;async function XI(t,e){return e?/^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$/.test(e.toLowerCase())?null:`Invalid App ID "${e}". Must be in Java package form with no dashes (ex: com.example.app)`:"Invalid App ID. Must be in Java package form with no dashes (ex: com.example.app)"}W.checkAppId=XI;async function ZI(t,e){return e?.length?null:"Must provide an app name. For example: 'Spacebook'"}W.checkAppName=ZI;async function Eoe(t){return new Promise(e=>setTimeout(e,t))}W.wait=Eoe;async function Coe(t,e,r,n){await qv(t,e,r,n),(await(0,moe.getPlugins)(t,e)).forEach(async o=>{await qv(t,e,o.rootPath,n)})}W.runHooks=Coe;async function qv(t,e,r,n){var i;let{spawn:o}=await Promise.resolve().then(()=>kc.__importStar(require("child_process"))),s;(0,YI.isNXMonorepo)(r)?s=await(0,gi.readJSON)((0,go.join)((0,YI.findNXMonorepoRoot)(r),"package.json")):s=await(0,gi.readJSON)((0,go.join)(r,"package.json"));let a=(i=s.scripts)===null||i===void 0?void 0:i[n];if(a)return new Promise((u,c)=>{let l=o(a,{stdio:"inherit",shell:!0,cwd:r,env:{INIT_CWD:r,CAPACITOR_ROOT_DIR:t.app.rootDir,CAPACITOR_WEB_DIR:t.app.webDirAbs,CAPACITOR_CONFIG:JSON.stringify(t.app.extConfig),CAPACITOR_PLATFORM_NAME:e,...process.env}});l.on("close",()=>{u()}),l.on("error",f=>{c(f)})})}W.runPlatformHook=qv;async function Soe(t,e){let r=JI.output.createTaskChain();r.next(t);try{let n=await e();return r.end(),n}catch(n){throw r.fail(),n}}W.runTask=Soe;async function Mv(t,e){let r=(0,Ac.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");return r?(0,gi.readJSON)(r):null}W.getCapacitorPackage=Mv;async function QI(t,e){let r=await Mv(t,e);return r||(0,aa.fatal)(`Unable to find node_modules/@capacitor/${e}.
174
- Are you sure ${Se.default.strong(`@capacitor/${e}`)} is installed?`),r}W.requireCapacitorPackage=QI;async function Sh(t,e){return(await QI(t,e)).version}W.getCapacitorPackageVersion=Sh;async function ej(t){return Sh(t,"core")}W.getCoreVersion=ej;async function xoe(t){return Sh(t,"cli")}W.getCLIVersion=xoe;function Foe(t,e){switch(e){case"android":return t.android.platformDirAbs;case"ios":return t.ios.platformDirAbs;case"web":return t.web.platformDirAbs}return null}async function Ch(t,e){let r=Foe(t,e);return r&&await(0,gi.pathExists)(r)?r:null}W.getProjectPlatformDirectory=Ch;async function Ooe(t,e){if(e){let r=e.toLowerCase().trim();return await Hv(r)?await Ch(t,r)||(r==="web"&&(0,aa.fatal)(`Could not find the web platform directory.
174
+ Are you sure ${Se.default.strong(`@capacitor/${e}`)} is installed?`),r}W.requireCapacitorPackage=QI;async function Sh(t,e){return(await QI(t,e)).version}W.getCapacitorPackageVersion=Sh;async function e6(t){return Sh(t,"core")}W.getCoreVersion=e6;async function xoe(t){return Sh(t,"cli")}W.getCLIVersion=xoe;function Foe(t,e){switch(e){case"android":return t.android.platformDirAbs;case"ios":return t.ios.platformDirAbs;case"web":return t.web.platformDirAbs}return null}async function Ch(t,e){let r=Foe(t,e);return r&&await(0,gi.pathExists)(r)?r:null}W.getProjectPlatformDirectory=Ch;async function Ooe(t,e){if(e){let r=e.toLowerCase().trim();return await Hv(r)?await Ch(t,r)||(r==="web"&&(0,aa.fatal)(`Could not find the web platform directory.
175
175
  Make sure ${Se.default.strong(t.app.webDir)} exists.`),(0,aa.fatal)(`${Se.default.strong(r)} platform has not been added yet.
176
- See the docs for adding the ${Se.default.strong(r)} platform: ${Se.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,aa.fatal)(`Invalid platform: ${Se.default.input(r)}`),[r]}return ij(t)}W.selectPlatforms=Ooe;async function Uv(){return["web","android","ios"]}W.getKnownPlatforms=Uv;async function Hv(t){return(await Uv()).includes(t)}W.isValidPlatform=Hv;async function tj(){return["electron"]}W.getKnownCommunityPlatforms=tj;async function Aoe(t){return(await tj()).includes(t)}W.isValidCommunityPlatform=Aoe;async function rj(){return["windows"]}W.getKnownEnterprisePlatforms=rj;async function koe(t){return(await rj()).includes(t)}W.isValidEnterprisePlatform=koe;async function Toe(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>kc.__importStar(fh()));if(!r)return(await n([{type:"select",name:"mode",message:e,choices:t.map(s=>({title:s,value:s}))}],{onCancel:()=>process.exit(1)})).mode.toLowerCase().trim();let i=r.toLowerCase().trim();if(!await Hv(i)){let o=await Uv();(0,aa.fatal)(`Invalid platform: ${Se.default.input(i)}.
177
- Valid platforms include: ${o.join(", ")}`)}return i}W.promptForPlatform=Toe;async function Poe(t,e){let{prompt:r}=await Promise.resolve().then(()=>kc.__importStar(fh())),n=t.filter(s=>s.id!==void 0);if(!e)return n.length===1?n[0]:(await r([{type:"select",name:"target",message:"Please choose a target device:",choices:n.map(a=>({title:`${nj(a)} (${a.id})`,value:a}))}],{onCancel:()=>process.exit(1)})).target;let i=e.trim(),o=t.find(s=>s.id===i);return o||(0,aa.fatal)(`Invalid target ID: ${Se.default.input(i)}.
178
- Valid targets are: ${t.map(s=>s.id).join(", ")}`),o}W.promptForPlatformTarget=Poe;function nj(t){var e,r,n;return`${(n=(r=(e=t.name)!==null&&e!==void 0?e:t.model)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"?"}${t.virtual?` (${t.platform==="ios"?"simulator":"emulator"})`:""}`}W.getPlatformTargetName=nj;async function ij(t){let e=[];return await Ch(t,t.android.name)&&e.push(t.android.name),await Ch(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}W.getAddedPlatforms=ij;async function Roe(t,e){let r=await Promise.resolve().then(()=>kc.__importStar(Bv())),n=await ej(t),i=await Sh(t,e);(r.diff(n,i)==="minor"||r.diff(n,i)==="major")&&JI.logger.warn(`${Se.default.strong("@capacitor/core")}${Se.default.weak(`@${n}`)} version doesn't match ${Se.default.strong(`@capacitor/${e}`)}${Se.default.weak(`@${i}`)} version.
179
- Consider updating to a matching version, e.g. w/ ${Se.default.input(`npm install @capacitor/core@${i}`)}`)}W.checkPlatformVersions=Roe;function $oe(t,e){if(e[0]!=="@"){let n=(0,Ac.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,go.dirname)(n);let i=(0,Ac.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(i)return(0,go.dirname)(i);let o=(0,Ac.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(o)return(0,go.dirname)(o)}let r=(0,Ac.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,go.dirname)(r):null}W.resolvePlatform=$oe;async function Ioe(){try{let t=await(0,goe.runCommand)("java",["--version"]),r=RegExp(/([0-9]+)\.?([0-9]*)\.?([0-9]*)/).exec(t);if(r===null)return-1;let n=parseInt(r[1]),i=parseInt(r[2]);return typeof n=="number"&&n!=1?n:typeof i=="number"&&n==1&&i<9?i:-1}catch{return-1}}W.checkJDKMajorVersion=Ioe;function joe(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}W.parseApkNameFromFlavor=joe});var sj=D(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.tryFn=void 0;var Noe=async(t,...e)=>{try{return await t(...e)}catch{}return null};xh.tryFn=Noe});var aj=D(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0});Fh.formatJSObject=void 0;var Loe=(Cn(),ke(En)),Boe=Loe.__importDefault(require("util"));function qoe(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return Boe.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Fh.formatJSObject=qoe});var uj=D(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.lazy=yi.LazyPromise=yi.allSerial=void 0;function Moe(t){return t.reduce((e,r)=>e.then(n=>r().then(i=>n.concat(i))),Promise.resolve([]))}yi.allSerial=Moe;var Oh=class extends Promise{constructor(e){super(()=>{}),this._executor=e}then(e,r){return this._promise=this._promise||new Promise(this._executor),this._promise.then(e,r)}catch(e){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(e)}};yi.LazyPromise=Oh;function Uoe(t){return new Oh(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}yi.lazy=Uoe});var hj=D(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.checkExternalConfig=it.writeConfig=it.loadConfig=it.CONFIG_FILE_NAME_JSON=it.CONFIG_FILE_NAME_JS=it.CONFIG_FILE_NAME_TS=void 0;var zv=(Cn(),ke(En)),Zt=Us(),Hoe=zv.__importDefault(HA()),ie=require("path"),Di=zv.__importDefault(Gs()),Voe=oj(),Ah=Wd(),fj=cc(),Vv=sj(),zoe=aj(),cj=ml(),lj=dh(),ua=uj(),Goe=hh(),dj=(0,Hoe.default)("capacitor:config");it.CONFIG_FILE_NAME_TS="capacitor.config.ts";it.CONFIG_FILE_NAME_JS="capacitor.config.js";it.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function Woe(){var t,e,r,n;let i=process.cwd(),o=(0,ie.dirname)(__dirname),s=await Xoe(i),a=await(async()=>{var d,p;if((0,cj.isNXMonorepo)(i)){let v=(0,cj.findNXMonorepoRoot)(i),g=await(0,Vv.tryFn)(Zt.readJSON,(0,ie.resolve)(v,"package.json")),w=(d=g?.devDependencies)!==null&&d!==void 0?d:{},S=(p=g?.dependencies)!==null&&p!==void 0?p:{};return{devDependencies:w,dependencies:S}}return{}})(),u=(t=s.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=s.extConfig.appName)!==null&&e!==void 0?e:"",l=(r=s.extConfig.webDir)!==null&&r!==void 0?r:"www",f=await Zoe(o),h={android:await Qoe(i,s.extConfig,f),ios:await ese(i,s.extConfig),web:await tse(i,l),cli:f,app:{rootDir:i,appId:u,appName:c,webDir:l,webDirAbs:(0,ie.resolve)(i,l),package:(n=await(0,Vv.tryFn)(Zt.readJSON,(0,ie.resolve)(i,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...a},...s}};return dj("config: %O",h),h}it.loadConfig=Woe;async function Koe(t,e){switch((0,ie.extname)(e)){case".json":{await(0,Zt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,Zt.writeFile)(e,ase(t));break}}}it.writeConfig=Koe;async function Yoe(t,e,r){var n;try{let i=(0,lj.resolveNode)(t,"typescript");i||(0,Ah.fatal)(`Could not find installation of TypeScript.
180
- To use ${Di.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${Di.default.input("npm install -D typescript")}`);let o=require(i),s=(0,lj.requireTS)(o,r),a=s.default?await s.default:s;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:a}}catch(i){throw(0,Ah.isFatal)(i)||(0,Ah.fatal)(`Parsing ${Di.default.strong(e)} failed.
176
+ See the docs for adding the ${Se.default.strong(r)} platform: ${Se.default.strong(`https://capacitorjs.com/docs/${r}#adding-the-${r}-platform`)}`)):(0,aa.fatal)(`Invalid platform: ${Se.default.input(r)}`),[r]}return i6(t)}W.selectPlatforms=Ooe;async function Uv(){return["web","android","ios"]}W.getKnownPlatforms=Uv;async function Hv(t){return(await Uv()).includes(t)}W.isValidPlatform=Hv;async function t6(){return["electron"]}W.getKnownCommunityPlatforms=t6;async function Aoe(t){return(await t6()).includes(t)}W.isValidCommunityPlatform=Aoe;async function r6(){return["windows"]}W.getKnownEnterprisePlatforms=r6;async function koe(t){return(await r6()).includes(t)}W.isValidEnterprisePlatform=koe;async function Toe(t,e,r){let{prompt:n}=await Promise.resolve().then(()=>kc.__importStar(fh()));if(!r)return(await n([{type:"select",name:"mode",message:e,choices:t.map(s=>({title:s,value:s}))}],{onCancel:()=>process.exit(1)})).mode.toLowerCase().trim();let i=r.toLowerCase().trim();if(!await Hv(i)){let o=await Uv();(0,aa.fatal)(`Invalid platform: ${Se.default.input(i)}.
177
+ Valid platforms include: ${o.join(", ")}`)}return i}W.promptForPlatform=Toe;async function Poe(t,e){let{prompt:r}=await Promise.resolve().then(()=>kc.__importStar(fh())),n=t.filter(s=>s.id!==void 0);if(!e)return n.length===1?n[0]:(await r([{type:"select",name:"target",message:"Please choose a target device:",choices:n.map(a=>({title:`${n6(a)} (${a.id})`,value:a}))}],{onCancel:()=>process.exit(1)})).target;let i=e.trim(),o=t.find(s=>s.id===i);return o||(0,aa.fatal)(`Invalid target ID: ${Se.default.input(i)}.
178
+ Valid targets are: ${t.map(s=>s.id).join(", ")}`),o}W.promptForPlatformTarget=Poe;function n6(t){var e,r,n;return`${(n=(r=(e=t.name)!==null&&e!==void 0?e:t.model)!==null&&r!==void 0?r:t.id)!==null&&n!==void 0?n:"?"}${t.virtual?` (${t.platform==="ios"?"simulator":"emulator"})`:""}`}W.getPlatformTargetName=n6;async function i6(t){let e=[];return await Ch(t,t.android.name)&&e.push(t.android.name),await Ch(t,t.ios.name)&&e.push(t.ios.name),e.push(t.web.name),e}W.getAddedPlatforms=i6;async function Roe(t,e){let r=await Promise.resolve().then(()=>kc.__importStar(Bv())),n=await e6(t),i=await Sh(t,e);(r.diff(n,i)==="minor"||r.diff(n,i)==="major")&&JI.logger.warn(`${Se.default.strong("@capacitor/core")}${Se.default.weak(`@${n}`)} version doesn't match ${Se.default.strong(`@capacitor/${e}`)}${Se.default.weak(`@${i}`)} version.
179
+ Consider updating to a matching version, e.g. w/ ${Se.default.input(`npm install @capacitor/core@${i}`)}`)}W.checkPlatformVersions=Roe;function $oe(t,e){if(e[0]!=="@"){let n=(0,Ac.resolveNode)(t.app.rootDir,`@capacitor/${e}`,"package.json");if(n)return(0,go.dirname)(n);let i=(0,Ac.resolveNode)(t.app.rootDir,`@capacitor-community/${e}`,"package.json");if(i)return(0,go.dirname)(i);let o=(0,Ac.resolveNode)(t.app.rootDir,`@ionic-enterprise/capacitor-${e}`,"package.json");if(o)return(0,go.dirname)(o)}let r=(0,Ac.resolveNode)(t.app.rootDir,e,"package.json");return r?(0,go.dirname)(r):null}W.resolvePlatform=$oe;async function Ioe(){try{let t=await(0,goe.runCommand)("java",["--version"]),r=RegExp(/([0-9]+)\.?([0-9]*)\.?([0-9]*)/).exec(t);if(r===null)return-1;let n=parseInt(r[1]),i=parseInt(r[2]);return typeof n=="number"&&n!=1?n:typeof i=="number"&&n==1&&i<9?i:-1}catch{return-1}}W.checkJDKMajorVersion=Ioe;function joe(t){let e=t.replace(/([A-Z])/g,"$1").toLowerCase();return`app-${e?`${e}-`:""}debug.apk`}W.parseApkNameFromFlavor=joe});var s6=D(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.tryFn=void 0;var Noe=async(t,...e)=>{try{return await t(...e)}catch{}return null};xh.tryFn=Noe});var a6=D(Fh=>{"use strict";Object.defineProperty(Fh,"__esModule",{value:!0});Fh.formatJSObject=void 0;var Loe=(Cn(),ke(En)),Boe=Loe.__importDefault(require("util"));function qoe(t){try{t=JSON.parse(JSON.stringify(t))}catch(e){throw new Error(`Cannot parse object as JSON: ${e.stack?e.stack:e}`)}return Boe.default.inspect(t,{compact:!1,breakLength:1/0,depth:1/0,maxArrayLength:1/0,maxStringLength:1/0})}Fh.formatJSObject=qoe});var u6=D(yi=>{"use strict";Object.defineProperty(yi,"__esModule",{value:!0});yi.lazy=yi.LazyPromise=yi.allSerial=void 0;function Moe(t){return t.reduce((e,r)=>e.then(n=>r().then(i=>n.concat(i))),Promise.resolve([]))}yi.allSerial=Moe;var Oh=class extends Promise{constructor(e){super(()=>{}),this._executor=e}then(e,r){return this._promise=this._promise||new Promise(this._executor),this._promise.then(e,r)}catch(e){return this._promise=this._promise||new Promise(this._executor),this._promise.catch(e)}};yi.LazyPromise=Oh;function Uoe(t){return new Oh(async(e,r)=>{try{e(await t())}catch(n){r(n)}})}yi.lazy=Uoe});var h6=D(it=>{"use strict";Object.defineProperty(it,"__esModule",{value:!0});it.checkExternalConfig=it.writeConfig=it.loadConfig=it.CONFIG_FILE_NAME_JSON=it.CONFIG_FILE_NAME_JS=it.CONFIG_FILE_NAME_TS=void 0;var zv=(Cn(),ke(En)),Zt=Us(),Hoe=zv.__importDefault(HA()),ie=require("path"),Di=zv.__importDefault(Gs()),Voe=o6(),Ah=Wd(),f6=cc(),Vv=s6(),zoe=a6(),c6=ml(),l6=dh(),ua=u6(),Goe=hh(),d6=(0,Hoe.default)("capacitor:config");it.CONFIG_FILE_NAME_TS="capacitor.config.ts";it.CONFIG_FILE_NAME_JS="capacitor.config.js";it.CONFIG_FILE_NAME_JSON="capacitor.config.json";async function Woe(){var t,e,r,n;let i=process.cwd(),o=(0,ie.dirname)(__dirname),s=await Xoe(i),a=await(async()=>{var d,p;if((0,c6.isNXMonorepo)(i)){let v=(0,c6.findNXMonorepoRoot)(i),g=await(0,Vv.tryFn)(Zt.readJSON,(0,ie.resolve)(v,"package.json")),w=(d=g?.devDependencies)!==null&&d!==void 0?d:{},S=(p=g?.dependencies)!==null&&p!==void 0?p:{};return{devDependencies:w,dependencies:S}}return{}})(),u=(t=s.extConfig.appId)!==null&&t!==void 0?t:"",c=(e=s.extConfig.appName)!==null&&e!==void 0?e:"",l=(r=s.extConfig.webDir)!==null&&r!==void 0?r:"www",f=await Zoe(o),h={android:await Qoe(i,s.extConfig,f),ios:await ese(i,s.extConfig),web:await tse(i,l),cli:f,app:{rootDir:i,appId:u,appName:c,webDir:l,webDirAbs:(0,ie.resolve)(i,l),package:(n=await(0,Vv.tryFn)(Zt.readJSON,(0,ie.resolve)(i,"package.json")))!==null&&n!==void 0?n:{name:c,version:"1.0.0",...a},...s}};return d6("config: %O",h),h}it.loadConfig=Woe;async function Koe(t,e){switch((0,ie.extname)(e)){case".json":{await(0,Zt.writeJSON)(e,t,{spaces:2});break}case".ts":{await(0,Zt.writeFile)(e,ase(t));break}}}it.writeConfig=Koe;async function Yoe(t,e,r){var n;try{let i=(0,l6.resolveNode)(t,"typescript");i||(0,Ah.fatal)(`Could not find installation of TypeScript.
180
+ To use ${Di.default.strong(e)} files, you must install TypeScript in your project, e.g. w/ ${Di.default.input("npm install -D typescript")}`);let o=require(i),s=(0,l6.requireTS)(o,r),a=s.default?await s.default:s;return{extConfigType:"ts",extConfigName:e,extConfigFilePath:r,extConfig:a}}catch(i){throw(0,Ah.isFatal)(i)||(0,Ah.fatal)(`Parsing ${Di.default.strong(e)} failed.
181
181
 
182
182
  ${(n=i.stack)!==null&&n!==void 0?n:i}`),i}}async function Joe(t,e,r){var n;try{return{extConfigType:"js",extConfigName:e,extConfigFilePath:r,extConfig:await require(r)}}catch(i){(0,Ah.fatal)(`Parsing ${Di.default.strong(e)} failed.
183
183
 
184
- ${(n=i.stack)!==null&&n!==void 0?n:i}`)}}async function Xoe(t){var e;let r=(0,ie.resolve)(t,it.CONFIG_FILE_NAME_TS);if(await(0,Zt.pathExists)(r))return Yoe(t,it.CONFIG_FILE_NAME_TS,r);let n=(0,ie.resolve)(t,it.CONFIG_FILE_NAME_JS);if(await(0,Zt.pathExists)(n))return Joe(t,it.CONFIG_FILE_NAME_JS,n);let i=(0,ie.resolve)(t,it.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:it.CONFIG_FILE_NAME_JSON,extConfigFilePath:i,extConfig:(e=await(0,Vv.tryFn)(Zt.readJSON,i))!==null&&e!==void 0?e:{}}}async function Zoe(t){let e="assets",r=(0,ie.join)(t,e),n="ios-pods-template.tar.gz",i="capacitor-cordova-ios-plugins.tar.gz",o="android-template.tar.gz",s="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ie.resolve)(r,n),cordovaPluginsTemplateArchive:i,cordovaPluginsTemplateArchiveAbs:(0,ie.resolve)(r,i)},android:{platformTemplateArchive:o,platformTemplateArchiveAbs:(0,ie.resolve)(r,o),cordovaPluginsTemplateArchive:s,cordovaPluginsTemplateArchiveAbs:(0,ie.resolve)(r,s)}},package:await(0,Zt.readJSON)((0,ie.resolve)(t,"package.json")),os:rse(process.platform)}}async function Qoe(t,e,r){var n,i,o,s,a,u,c,l,f,h,d,p,v,g,w,S,y;let C="android",A=(i=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&i!==void 0?i:"android",$=(0,ie.resolve)(t,A),F="app",L=`${F}/src`,x=`${L}/main`,I=`${x}/assets`,R=`${I}/public`,B=`${x}/res`,q=`${F}/build/outputs/apk/`,K=((o=e.android)===null||o===void 0?void 0:o.flavor)||"";!((s=e.android)===null||s===void 0)&&s.flavor&&(q=`${q}/${(a=e.android)===null||a===void 0?void 0:a.flavor}`);let M=(0,Voe.parseApkNameFromFlavor)(K),E=`${q}/debug`,b="capacitor-cordova-android-plugins",_=(0,ua.lazy)(()=>ose(r.os)),O={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(f=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||f===void 0?void 0:f.keystorePassword,keystoreAlias:(d=(h=e.android)===null||h===void 0?void 0:h.buildOptions)===null||d===void 0?void 0:d.keystoreAlias,keystoreAliasPassword:(v=(p=e.android)===null||p===void 0?void 0:p.buildOptions)===null||v===void 0?void 0:v.keystoreAliasPassword,signingType:(w=(g=e.android)===null||g===void 0?void 0:g.buildOptions)===null||w===void 0?void 0:w.signingType,releaseType:(y=(S=e.android)===null||S===void 0?void 0:S.buildOptions)===null||y===void 0?void 0:y.releaseType};return{name:C,minVersion:"22",studioPath:_,platformDir:A,platformDirAbs:$,cordovaPluginsDir:b,cordovaPluginsDirAbs:(0,ie.resolve)($,b),appDir:F,appDirAbs:(0,ie.resolve)($,F),srcDir:L,srcDirAbs:(0,ie.resolve)($,L),srcMainDir:x,srcMainDirAbs:(0,ie.resolve)($,x),assetsDir:I,assetsDirAbs:(0,ie.resolve)($,I),webDir:R,webDirAbs:(0,ie.resolve)($,R),resDir:B,resDirAbs:(0,ie.resolve)($,B),apkName:M,buildOutputDir:E,buildOutputDirAbs:(0,ie.resolve)($,E),flavor:K,buildOptions:O}}async function ese(t,e){var r,n,i,o;let s="ios",a=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",u=(0,ie.resolve)(t,a),c=(o=(i=e.ios)===null||i===void 0?void 0:i.scheme)!==null&&o!==void 0?o:"App",l="App",f=(0,ie.resolve)(u,l),h=`${l}/App`,d=(0,ie.resolve)(u,h),p=`${l}/App.xcodeproj`,v=(0,ie.resolve)(u,p),g=(0,ua.lazy)(()=>nse(f)),w=(0,ua.lazy)(()=>sse(t,u,f)),S=(0,ua.lazy)(()=>ise(f,d,v)),y="capacitor-cordova-ios-plugins";return{name:s,minVersion:"13.0",platformDir:a,platformDirAbs:u,scheme:c,cordovaPluginsDir:y,cordovaPluginsDirAbs:(0,ie.resolve)(u,y),nativeProjectDir:l,nativeProjectDirAbs:f,nativeTargetDir:h,nativeTargetDirAbs:d,nativeXcodeProjDir:p,nativeXcodeProjDirAbs:v,nativeXcodeWorkspaceDir:(0,ua.lazy)(async()=>(0,ie.relative)(u,await g)),nativeXcodeWorkspaceDirAbs:g,webDir:(0,ua.lazy)(async()=>(0,ie.relative)(u,await S)),webDirAbs:S,podPath:w}}async function tse(t,e){let r=e,n=(0,ie.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function rse(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function nse(t){return(0,ie.resolve)(t,"App.xcworkspace")}async function ise(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,i=(0,ie.resolve)(r,"project.pbxproj");try{let s=(await(0,Zt.readFile)(i,{encoding:"utf8"})).match(n);if(s&&s[1]==="SOURCE_ROOT")return fj.logger.warn(`Using the iOS project root for the ${Di.default.strong("public")} directory is deprecated.
185
- Please follow the Upgrade Guide to move ${Di.default.strong("public")} inside the iOS target directory: ${Di.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ie.resolve)(t,"public")}catch{}return(0,ie.resolve)(e,"public")}async function ose(t){if(process.env.CAPACITOR_ANDROID_STUDIO_PATH)return process.env.CAPACITOR_ANDROID_STUDIO_PATH;switch(t){case"mac":return"/Applications/Android Studio.app";case"windows":{let{runCommand:e}=await Promise.resolve().then(()=>zv.__importStar(hh())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,Zt.pathExists)(r)){let n=await e("REG",["QUERY","HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio","/v","Path"]);n=n.replace(/(\r\n|\n|\r)/gm,"");let i=n.indexOf("REG_SZ");i>0&&(r=n.substring(i+6).trim()+"\\bin\\studio64.exe")}}catch(n){dj("Error checking registry for Android Studio path: %O",n);break}return r}case"linux":return"/usr/local/android-studio/bin/studio.sh"}return""}async function sse(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,Zt.pathExists)((0,ie.resolve)(t,"Gemfile"))?n=(0,ie.resolve)(t,"Gemfile"):await(0,Zt.pathExists)((0,ie.resolve)(e,"Gemfile"))?n=(0,ie.resolve)(e,"Gemfile"):await(0,Zt.pathExists)((0,ie.resolve)(r,"Gemfile"))&&(n=(0,ie.resolve)(r,"Gemfile")),!(n!=""))try{let o=await(0,Goe.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});o!=null&&(n=(0,ie.resolve)(o,"Gemfile"))}catch{}try{let o=(await(0,Zt.readFile)(n)).toString();return o&&new RegExp(/gem\s+['"]cocoapods/).test(o)?"bundle exec pod":"pod"}catch{return"pod"}}function ase(t){return`import type { CapacitorConfig } from '@capacitor/cli';
184
+ ${(n=i.stack)!==null&&n!==void 0?n:i}`)}}async function Xoe(t){var e;let r=(0,ie.resolve)(t,it.CONFIG_FILE_NAME_TS);if(await(0,Zt.pathExists)(r))return Yoe(t,it.CONFIG_FILE_NAME_TS,r);let n=(0,ie.resolve)(t,it.CONFIG_FILE_NAME_JS);if(await(0,Zt.pathExists)(n))return Joe(t,it.CONFIG_FILE_NAME_JS,n);let i=(0,ie.resolve)(t,it.CONFIG_FILE_NAME_JSON);return{extConfigType:"json",extConfigName:it.CONFIG_FILE_NAME_JSON,extConfigFilePath:i,extConfig:(e=await(0,Vv.tryFn)(Zt.readJSON,i))!==null&&e!==void 0?e:{}}}async function Zoe(t){let e="assets",r=(0,ie.join)(t,e),n="ios-pods-template.tar.gz",i="capacitor-cordova-ios-plugins.tar.gz",o="android-template.tar.gz",s="capacitor-cordova-android-plugins.tar.gz";return{rootDir:t,assetsDir:e,assetsDirAbs:r,assets:{ios:{platformTemplateArchive:n,platformTemplateArchiveAbs:(0,ie.resolve)(r,n),cordovaPluginsTemplateArchive:i,cordovaPluginsTemplateArchiveAbs:(0,ie.resolve)(r,i)},android:{platformTemplateArchive:o,platformTemplateArchiveAbs:(0,ie.resolve)(r,o),cordovaPluginsTemplateArchive:s,cordovaPluginsTemplateArchiveAbs:(0,ie.resolve)(r,s)}},package:await(0,Zt.readJSON)((0,ie.resolve)(t,"package.json")),os:rse(process.platform)}}async function Qoe(t,e,r){var n,i,o,s,a,u,c,l,f,h,d,p,v,g,w,S,y;let C="android",A=(i=(n=e.android)===null||n===void 0?void 0:n.path)!==null&&i!==void 0?i:"android",$=(0,ie.resolve)(t,A),F="app",L=`${F}/src`,x=`${L}/main`,I=`${x}/assets`,R=`${I}/public`,B=`${x}/res`,q=`${F}/build/outputs/apk/`,K=((o=e.android)===null||o===void 0?void 0:o.flavor)||"";!((s=e.android)===null||s===void 0)&&s.flavor&&(q=`${q}/${(a=e.android)===null||a===void 0?void 0:a.flavor}`);let M=(0,Voe.parseApkNameFromFlavor)(K),E=`${q}/debug`,b="capacitor-cordova-android-plugins",_=(0,ua.lazy)(()=>ose(r.os)),O={keystorePath:(c=(u=e.android)===null||u===void 0?void 0:u.buildOptions)===null||c===void 0?void 0:c.keystorePath,keystorePassword:(f=(l=e.android)===null||l===void 0?void 0:l.buildOptions)===null||f===void 0?void 0:f.keystorePassword,keystoreAlias:(d=(h=e.android)===null||h===void 0?void 0:h.buildOptions)===null||d===void 0?void 0:d.keystoreAlias,keystoreAliasPassword:(v=(p=e.android)===null||p===void 0?void 0:p.buildOptions)===null||v===void 0?void 0:v.keystoreAliasPassword,signingType:(w=(g=e.android)===null||g===void 0?void 0:g.buildOptions)===null||w===void 0?void 0:w.signingType,releaseType:(y=(S=e.android)===null||S===void 0?void 0:S.buildOptions)===null||y===void 0?void 0:y.releaseType};return{name:C,minVersion:"22",studioPath:_,platformDir:A,platformDirAbs:$,cordovaPluginsDir:b,cordovaPluginsDirAbs:(0,ie.resolve)($,b),appDir:F,appDirAbs:(0,ie.resolve)($,F),srcDir:L,srcDirAbs:(0,ie.resolve)($,L),srcMainDir:x,srcMainDirAbs:(0,ie.resolve)($,x),assetsDir:I,assetsDirAbs:(0,ie.resolve)($,I),webDir:R,webDirAbs:(0,ie.resolve)($,R),resDir:B,resDirAbs:(0,ie.resolve)($,B),apkName:M,buildOutputDir:E,buildOutputDirAbs:(0,ie.resolve)($,E),flavor:K,buildOptions:O}}async function ese(t,e){var r,n,i,o;let s="ios",a=(n=(r=e.ios)===null||r===void 0?void 0:r.path)!==null&&n!==void 0?n:"ios",u=(0,ie.resolve)(t,a),c=(o=(i=e.ios)===null||i===void 0?void 0:i.scheme)!==null&&o!==void 0?o:"App",l="App",f=(0,ie.resolve)(u,l),h=`${l}/App`,d=(0,ie.resolve)(u,h),p=`${l}/App.xcodeproj`,v=(0,ie.resolve)(u,p),g=(0,ua.lazy)(()=>nse(f)),w=(0,ua.lazy)(()=>sse(t,u,f)),S=(0,ua.lazy)(()=>ise(f,d,v)),y="capacitor-cordova-ios-plugins";return{name:s,minVersion:"13.0",platformDir:a,platformDirAbs:u,scheme:c,cordovaPluginsDir:y,cordovaPluginsDirAbs:(0,ie.resolve)(u,y),nativeProjectDir:l,nativeProjectDirAbs:f,nativeTargetDir:h,nativeTargetDirAbs:d,nativeXcodeProjDir:p,nativeXcodeProjDirAbs:v,nativeXcodeWorkspaceDir:(0,ua.lazy)(async()=>(0,ie.relative)(u,await g)),nativeXcodeWorkspaceDirAbs:g,webDir:(0,ua.lazy)(async()=>(0,ie.relative)(u,await S)),webDirAbs:S,podPath:w}}async function tse(t,e){let r=e,n=(0,ie.resolve)(t,r);return{name:"web",platformDir:r,platformDirAbs:n}}function rse(t){switch(t){case"darwin":return"mac";case"win32":return"windows";case"linux":return"linux"}return"unknown"}async function nse(t){return(0,ie.resolve)(t,"App.xcworkspace")}async function ise(t,e,r){let n=/path\s=\spublic[\s\S]+?sourceTree\s=\s([^;]+)/,i=(0,ie.resolve)(r,"project.pbxproj");try{let s=(await(0,Zt.readFile)(i,{encoding:"utf8"})).match(n);if(s&&s[1]==="SOURCE_ROOT")return f6.logger.warn(`Using the iOS project root for the ${Di.default.strong("public")} directory is deprecated.
185
+ Please follow the Upgrade Guide to move ${Di.default.strong("public")} inside the iOS target directory: ${Di.default.strong("https://capacitorjs.com/docs/updating/3-0#move-public-into-the-ios-target-directory")}`),(0,ie.resolve)(t,"public")}catch{}return(0,ie.resolve)(e,"public")}async function ose(t){if(process.env.CAPACITOR_ANDROID_STUDIO_PATH)return process.env.CAPACITOR_ANDROID_STUDIO_PATH;switch(t){case"mac":return"/Applications/Android Studio.app";case"windows":{let{runCommand:e}=await Promise.resolve().then(()=>zv.__importStar(hh())),r="C:\\Program Files\\Android\\Android Studio\\bin\\studio64.exe";try{if(!await(0,Zt.pathExists)(r)){let n=await e("REG",["QUERY","HKEY_LOCAL_MACHINE\\SOFTWARE\\Android Studio","/v","Path"]);n=n.replace(/(\r\n|\n|\r)/gm,"");let i=n.indexOf("REG_SZ");i>0&&(r=n.substring(i+6).trim()+"\\bin\\studio64.exe")}}catch(n){d6("Error checking registry for Android Studio path: %O",n);break}return r}case"linux":return"/usr/local/android-studio/bin/studio.sh"}return""}async function sse(t,e,r){if(process.env.CAPACITOR_COCOAPODS_PATH)return process.env.CAPACITOR_COCOAPODS_PATH;let n="";if(await(0,Zt.pathExists)((0,ie.resolve)(t,"Gemfile"))?n=(0,ie.resolve)(t,"Gemfile"):await(0,Zt.pathExists)((0,ie.resolve)(e,"Gemfile"))?n=(0,ie.resolve)(e,"Gemfile"):await(0,Zt.pathExists)((0,ie.resolve)(r,"Gemfile"))&&(n=(0,ie.resolve)(r,"Gemfile")),!(n!=""))try{let o=await(0,Goe.getCommandOutput)("git",["rev-parse","--show-toplevel"],{cwd:t});o!=null&&(n=(0,ie.resolve)(o,"Gemfile"))}catch{}try{let o=(await(0,Zt.readFile)(n)).toString();return o&&new RegExp(/gem\s+['"]cocoapods/).test(o)?"bundle exec pod":"pod"}catch{return"pod"}}function ase(t){return`import type { CapacitorConfig } from '@capacitor/cli';
186
186
 
187
187
  const config: CapacitorConfig = ${(0,zoe.formatJSObject)(t)};
188
188
 
189
189
  export default config;
190
- `}function use(t){if(typeof t.extConfig.bundledWebRuntime<"u"){let e="Can be safely deleted.";t.extConfig.bundledWebRuntime===!0&&(e="Please, use a bundler to bundle Capacitor and its plugins."),fj.logger.warn(`The ${Di.default.strong("bundledWebRuntime")} configuration option has been deprecated. ${e}`)}}it.checkExternalConfig=use});function cse(){try{return Wv.default.statSync("/.dockerenv"),!0}catch{return!1}}function lse(){try{return Wv.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Kv(){return Gv===void 0&&(Gv=cse()||lse()),Gv}var Wv,Gv,mj=ut(()=>{Wv=ce(require("node:fs"),1)});function ca(){return Yv===void 0&&(Yv=fse()||Kv()),Yv}var gj,Yv,fse,Jv=ut(()=>{gj=ce(require("node:fs"),1);mj();fse=()=>{try{return gj.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var Xv,Dj,vj,yj,Pc,bj=ut(()=>{Xv=ce(require("node:process"),1),Dj=ce(require("node:os"),1),vj=ce(require("node:fs"),1);Jv();yj=()=>{if(Xv.default.platform!=="linux")return!1;if(Dj.default.release().toLowerCase().includes("microsoft"))return!ca();try{return vj.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!ca():!1}catch{return!1}},Pc=Xv.default.env.__IS_WSL_TEST__?yj:yj()});function yo(t,e,r){let n=i=>Object.defineProperty(t,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let i=r();return n(i),i},set(i){n(i)}}),t}var wj=ut(()=>{});async function Zv(){if(Ej.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await dse("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var _j,Ej,Cj,dse,Sj=ut(()=>{_j=require("node:util"),Ej=ce(require("node:process"),1),Cj=require("node:child_process"),dse=(0,_j.promisify)(Cj.execFile)});async function Oj(t,{humanReadableOutput:e=!0}={}){if(xj.default.platform!=="darwin")throw new Error("macOS only");let r=e?[]:["-ss"],{stdout:n}=await hse("osascript",["-e",t,r]);return n.trim()}var xj,Fj,Qv,hse,Aj=ut(()=>{xj=ce(require("node:process"),1),Fj=require("node:util"),Qv=require("node:child_process"),hse=(0,Fj.promisify)(Qv.execFile)});async function eb(t){return Oj(`tell application "Finder" to set app_path to application file id "${t}" as string
191
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var kj=ut(()=>{Aj()});async function tb(t=pse){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new kh(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=mse[n];if(!i)throw new kh(`Unknown browser ID: ${n}`);return i}var Tj,Pj,pse,mse,kh,Rj=ut(()=>{Tj=require("node:util"),Pj=require("node:child_process"),pse=(0,Tj.promisify)(Pj.execFile),mse={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},kh=class extends Error{}});async function rb(){if(Th.default.platform==="darwin"){let t=await Zv();return{name:await eb(t),id:t}}if(Th.default.platform==="linux"){let{stdout:t}=await gse("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:yse(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Th.default.platform==="win32")return tb();throw new Error("Only macOS, Linux, and Windows are supported")}var $j,Th,Ij,gse,yse,jj=ut(()=>{$j=require("node:util"),Th=ce(require("node:process"),1),Ij=require("node:child_process");Sj();kj();Rj();gse=(0,$j.promisify)(Ij.execFile),yse=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Vj={};mn(Vj,{apps:()=>vo,default:()=>wse,openApp:()=>bse});function qj(t){if(typeof t=="string"||Array.isArray(t))return t;let{[Lj]:e}=t;if(!e)throw new Error(`${Lj} is not supported`);return e}function ob({[la]:t},{wsl:e}){if(e&&Pc)return qj(e);if(!t)throw new Error(`${la} is not supported`);return qj(t)}var Rc,Mj,ib,Uj,Hj,Do,_se,nb,Nj,la,Lj,Dse,Bj,$c,vse,bse,vo,wse,zj=ut(()=>{Rc=ce(require("node:process"),1),Mj=require("node:buffer"),ib=ce(require("node:path"),1),Uj=require("node:url"),Hj=ce(require("node:child_process"),1),Do=ce(require("node:fs/promises"),1);bj();wj();jj();Jv();_se={},nb=ib.default.dirname((0,Uj.fileURLToPath)(_se.url)),Nj=ib.default.join(nb,"xdg-open"),{platform:la,arch:Lj}=Rc.default,Dse=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Do.default.access(r,Do.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await Do.default.readFile(r,{encoding:"utf8"}),o=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return o?(e=o.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),Bj=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},$c=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return Bj(t.app,a=>$c({...t,app:a}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return Bj(e,a=>$c({...t,app:{name:a,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=await rb();if(c.id in a){let l=a[c.id];return e==="browserPrivate"&&r.push(u[l]),$c({...t,app:{name:vo[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,i=[],o={};if(la==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(la==="win32"||Pc&&!ca()&&!e){let a=await Dse();n=Pc?`${a}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${Rc.default.env.SYSTEMROOT||Rc.default.env.windir||"C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Pc||(o.windowsVerbatimArguments=!0);let u=["Start"];t.wait&&u.push("-Wait"),e?(u.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&u.push(`"${t.target}"`),r.length>0&&(r=r.map(c=>`"\`"${c}\`""`),u.push("-ArgumentList",r.join(","))),t.target=Mj.Buffer.from(u.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let a=!nb||nb==="/",u=!1;try{await Do.default.access(Nj,Do.constants.X_OK),u=!0}catch{}n=Rc.default.versions.electron??(la==="android"||a||!u)?"xdg-open":Nj}r.length>0&&i.push(...r),t.wait||(o.stdio="ignore",o.detached=!0)}la==="darwin"&&r.length>0&&i.push("--args",...r),t.target&&i.push(t.target);let s=Hj.default.spawn(n,i,o);return t.wait?new Promise((a,u)=>{s.once("error",u),s.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}a(s)})}):(s.unref(),s)},vse=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return $c({...e,target:t})},bse=(t,e)=>{if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("Expected a valid `name`");let{arguments:r=[]}=e??{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return $c({...e,app:{name:t,arguments:r}})};vo={};yo(vo,"chrome",()=>ob({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));yo(vo,"firefox",()=>ob({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));yo(vo,"edge",()=>ob({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));yo(vo,"browser",()=>"browser");yo(vo,"browserPrivate",()=>"browserPrivate");wse=vse});var b6=D(Eo=>{Eo.parse=Eo.decode=Rse;Eo.stringify=Eo.encode=y6;Eo.safe=Da;Eo.unsafe=Bh;var hb=typeof process<"u"&&process.platform==="win32"?`\r
190
+ `}function use(t){if(typeof t.extConfig.bundledWebRuntime<"u"){let e="Can be safely deleted.";t.extConfig.bundledWebRuntime===!0&&(e="Please, use a bundler to bundle Capacitor and its plugins."),f6.logger.warn(`The ${Di.default.strong("bundledWebRuntime")} configuration option has been deprecated. ${e}`)}}it.checkExternalConfig=use});function cse(){try{return Wv.default.statSync("/.dockerenv"),!0}catch{return!1}}function lse(){try{return Wv.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Kv(){return Gv===void 0&&(Gv=cse()||lse()),Gv}var Wv,Gv,m6=ut(()=>{Wv=ce(require("node:fs"),1)});function ca(){return Yv===void 0&&(Yv=fse()||Kv()),Yv}var g6,Yv,fse,Jv=ut(()=>{g6=ce(require("node:fs"),1);m6();fse=()=>{try{return g6.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var Xv,D6,v6,y6,Pc,b6=ut(()=>{Xv=ce(require("node:process"),1),D6=ce(require("node:os"),1),v6=ce(require("node:fs"),1);Jv();y6=()=>{if(Xv.default.platform!=="linux")return!1;if(D6.default.release().toLowerCase().includes("microsoft"))return!ca();try{return v6.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!ca():!1}catch{return!1}},Pc=Xv.default.env.__IS_WSL_TEST__?y6:y6()});function yo(t,e,r){let n=i=>Object.defineProperty(t,e,{value:i,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let i=r();return n(i),i},set(i){n(i)}}),t}var w6=ut(()=>{});async function Zv(){if(E6.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await dse("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari"}var _6,E6,C6,dse,S6=ut(()=>{_6=require("node:util"),E6=ce(require("node:process"),1),C6=require("node:child_process"),dse=(0,_6.promisify)(C6.execFile)});async function O6(t,{humanReadableOutput:e=!0}={}){if(x6.default.platform!=="darwin")throw new Error("macOS only");let r=e?[]:["-ss"],{stdout:n}=await hse("osascript",["-e",t,r]);return n.trim()}var x6,F6,Qv,hse,A6=ut(()=>{x6=ce(require("node:process"),1),F6=require("node:util"),Qv=require("node:child_process"),hse=(0,F6.promisify)(Qv.execFile)});async function eb(t){return O6(`tell application "Finder" to set app_path to application file id "${t}" as string
191
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var k6=ut(()=>{A6()});async function tb(t=pse){let{stdout:e}=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e);if(!r)throw new kh(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,i=mse[n];if(!i)throw new kh(`Unknown browser ID: ${n}`);return i}var T6,P6,pse,mse,kh,R6=ut(()=>{T6=require("node:util"),P6=require("node:child_process"),pse=(0,T6.promisify)(P6.execFile),mse={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},kh=class extends Error{}});async function rb(){if(Th.default.platform==="darwin"){let t=await Zv();return{name:await eb(t),id:t}}if(Th.default.platform==="linux"){let{stdout:t}=await gse("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:yse(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Th.default.platform==="win32")return tb();throw new Error("Only macOS, Linux, and Windows are supported")}var $6,Th,I6,gse,yse,j6=ut(()=>{$6=require("node:util"),Th=ce(require("node:process"),1),I6=require("node:child_process");S6();k6();R6();gse=(0,$6.promisify)(I6.execFile),yse=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var V6={};mn(V6,{apps:()=>vo,default:()=>wse,openApp:()=>bse});function q6(t){if(typeof t=="string"||Array.isArray(t))return t;let{[L6]:e}=t;if(!e)throw new Error(`${L6} is not supported`);return e}function ob({[la]:t},{wsl:e}){if(e&&Pc)return q6(e);if(!t)throw new Error(`${la} is not supported`);return q6(t)}var Rc,M6,ib,U6,H6,Do,_se,nb,N6,la,L6,Dse,B6,$c,vse,bse,vo,wse,z6=ut(()=>{Rc=ce(require("node:process"),1),M6=require("node:buffer"),ib=ce(require("node:path"),1),U6=require("node:url"),H6=ce(require("node:child_process"),1),Do=ce(require("node:fs/promises"),1);b6();w6();j6();Jv();_se={},nb=ib.default.dirname((0,U6.fileURLToPath)(_se.url)),N6=ib.default.join(nb,"xdg-open"),{platform:la,arch:L6}=Rc.default,Dse=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Do.default.access(r,Do.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await Do.default.readFile(r,{encoding:"utf8"}),o=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return o?(e=o.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),B6=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},$c=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return B6(t.app,a=>$c({...t,app:a}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return B6(e,a=>$c({...t,app:{name:a,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let a={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","microsoft-edge.desktop":"edge"},u={chrome:"--incognito",firefox:"--private-window",edge:"--inPrivate"},c=await rb();if(c.id in a){let l=a[c.id];return e==="browserPrivate"&&r.push(u[l]),$c({...t,app:{name:vo[l],arguments:r}})}throw new Error(`${c.name} is not supported as a default browser`)}let n,i=[],o={};if(la==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(la==="win32"||Pc&&!ca()&&!e){let a=await Dse();n=Pc?`${a}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${Rc.default.env.SYSTEMROOT||Rc.default.env.windir||"C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),Pc||(o.windowsVerbatimArguments=!0);let u=["Start"];t.wait&&u.push("-Wait"),e?(u.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&u.push(`"${t.target}"`),r.length>0&&(r=r.map(c=>`"\`"${c}\`""`),u.push("-ArgumentList",r.join(","))),t.target=M6.Buffer.from(u.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let a=!nb||nb==="/",u=!1;try{await Do.default.access(N6,Do.constants.X_OK),u=!0}catch{}n=Rc.default.versions.electron??(la==="android"||a||!u)?"xdg-open":N6}r.length>0&&i.push(...r),t.wait||(o.stdio="ignore",o.detached=!0)}la==="darwin"&&r.length>0&&i.push("--args",...r),t.target&&i.push(t.target);let s=H6.default.spawn(n,i,o);return t.wait?new Promise((a,u)=>{s.once("error",u),s.once("close",c=>{if(!t.allowNonzeroExitCode&&c>0){u(new Error(`Exited with code ${c}`));return}a(s)})}):(s.unref(),s)},vse=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return $c({...e,target:t})},bse=(t,e)=>{if(typeof t!="string"&&!Array.isArray(t))throw new TypeError("Expected a valid `name`");let{arguments:r=[]}=e??{};if(r!=null&&!Array.isArray(r))throw new TypeError("Expected `appArguments` as Array type");return $c({...e,app:{name:t,arguments:r}})};vo={};yo(vo,"chrome",()=>ob({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));yo(vo,"firefox",()=>ob({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));yo(vo,"edge",()=>ob({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));yo(vo,"browser",()=>"browser");yo(vo,"browserPrivate",()=>"browserPrivate");wse=vse});var bj=D(Eo=>{Eo.parse=Eo.decode=Rse;Eo.stringify=Eo.encode=yj;Eo.safe=Da;Eo.unsafe=Bh;var hb=typeof process<"u"&&process.platform==="win32"?`\r
192
192
  `:`
193
- `;function y6(t,e){var r=[],n="";typeof e=="string"?e={section:e,whitespace:!1}:(e=e||{},e.whitespace=e.whitespace===!0);var i=e.whitespace?" = ":"=";return Object.keys(t).forEach(function(o,s,a){var u=t[o];u&&Array.isArray(u)?u.forEach(function(c){n+=Da(o+"[]")+i+Da(c)+`
194
- `}):u&&typeof u=="object"?r.push(o):n+=Da(o)+i+Da(u)+hb}),e.section&&n.length&&(n="["+Da(e.section)+"]"+hb+n),r.forEach(function(o,s,a){var u=D6(o).join("\\."),c=(e.section?e.section+".":"")+u,l=y6(t[o],{section:c,whitespace:e.whitespace});n.length&&l.length&&(n+=hb),n+=l}),n}function D6(t){return t.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(function(e){return e.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")})}function Rse(t){var e={},r=e,n=null,i=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=t.split(/[\r\n]+/g);return o.forEach(function(s,a,u){if(!(!s||s.match(/^\s*[;#]/))){var c=s.match(i);if(c){if(c[1]!==void 0){if(n=Bh(c[1]),n==="__proto__"){r={};return}r=e[n]=e[n]||{};return}var l=Bh(c[2]);if(l!=="__proto__"){var f=c[3]?Bh(c[4]):!0;switch(f){case"true":case"false":case"null":f=JSON.parse(f)}if(l.length>2&&l.slice(-2)==="[]"){if(l=l.substring(0,l.length-2),l==="__proto__")return;r[l]?Array.isArray(r[l])||(r[l]=[r[l]]):r[l]=[]}Array.isArray(r[l])?r[l].push(f):r[l]=f}}}}),Object.keys(e).filter(function(s,a,u){if(!e[s]||typeof e[s]!="object"||Array.isArray(e[s]))return!1;var c=D6(s),l=e,f=c.pop(),h=f.replace(/\\\./g,".");return c.forEach(function(d,p,v){d!=="__proto__"&&((!l[d]||typeof l[d]!="object")&&(l[d]={}),l=l[d])}),l===e&&h===f?!1:(l[h]=e[s],!0)}).forEach(function(s,a,u){delete e[s]}),e}function v6(t){return t.charAt(0)==='"'&&t.slice(-1)==='"'||t.charAt(0)==="'"&&t.slice(-1)==="'"}function Da(t){return typeof t!="string"||t.match(/[=\r\n]/)||t.match(/^\[/)||t.length>1&&v6(t)||t!==t.trim()?JSON.stringify(t):t.replace(/;/g,"\\;").replace(/#/g,"\\#")}function Bh(t,e){if(t=(t||"").trim(),v6(t)){t.charAt(0)==="'"&&(t=t.substr(1,t.length-2));try{t=JSON.parse(t)}catch{}}else{for(var r=!1,n="",i=0,o=t.length;i<o;i++){var s=t.charAt(i);if(r)"\\;#".indexOf(s)!==-1?n+=s:n+="\\"+s,r=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?r=!0:n+=s}}return r&&(n+="\\"),n.trim()}return t}});var E6=D((sye,_6)=>{"use strict";var pb=1,w6=2;function $se(){return""}function Ise(t,e,r){return t.slice(e,r).replace(/\S/g," ")}_6.exports=function(t,e){e=e||{};for(var r,n,i=!1,o=!1,s=0,a="",u=e.whitespace===!1?$se:Ise,c=0;c<t.length;c++){if(r=t[c],n=t[c+1],!o&&r==='"'){var l=t[c-1]==="\\"&&t[c-2]!=="\\";l||(i=!i)}if(!i){if(!o&&r+n==="//")a+=t.slice(s,c),s=c,o=pb,c++;else if(o===pb&&r+n===`\r
193
+ `;function yj(t,e){var r=[],n="";typeof e=="string"?e={section:e,whitespace:!1}:(e=e||{},e.whitespace=e.whitespace===!0);var i=e.whitespace?" = ":"=";return Object.keys(t).forEach(function(o,s,a){var u=t[o];u&&Array.isArray(u)?u.forEach(function(c){n+=Da(o+"[]")+i+Da(c)+`
194
+ `}):u&&typeof u=="object"?r.push(o):n+=Da(o)+i+Da(u)+hb}),e.section&&n.length&&(n="["+Da(e.section)+"]"+hb+n),r.forEach(function(o,s,a){var u=Dj(o).join("\\."),c=(e.section?e.section+".":"")+u,l=yj(t[o],{section:c,whitespace:e.whitespace});n.length&&l.length&&(n+=hb),n+=l}),n}function Dj(t){return t.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(function(e){return e.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")})}function Rse(t){var e={},r=e,n=null,i=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=t.split(/[\r\n]+/g);return o.forEach(function(s,a,u){if(!(!s||s.match(/^\s*[;#]/))){var c=s.match(i);if(c){if(c[1]!==void 0){if(n=Bh(c[1]),n==="__proto__"){r={};return}r=e[n]=e[n]||{};return}var l=Bh(c[2]);if(l!=="__proto__"){var f=c[3]?Bh(c[4]):!0;switch(f){case"true":case"false":case"null":f=JSON.parse(f)}if(l.length>2&&l.slice(-2)==="[]"){if(l=l.substring(0,l.length-2),l==="__proto__")return;r[l]?Array.isArray(r[l])||(r[l]=[r[l]]):r[l]=[]}Array.isArray(r[l])?r[l].push(f):r[l]=f}}}}),Object.keys(e).filter(function(s,a,u){if(!e[s]||typeof e[s]!="object"||Array.isArray(e[s]))return!1;var c=Dj(s),l=e,f=c.pop(),h=f.replace(/\\\./g,".");return c.forEach(function(d,p,v){d!=="__proto__"&&((!l[d]||typeof l[d]!="object")&&(l[d]={}),l=l[d])}),l===e&&h===f?!1:(l[h]=e[s],!0)}).forEach(function(s,a,u){delete e[s]}),e}function vj(t){return t.charAt(0)==='"'&&t.slice(-1)==='"'||t.charAt(0)==="'"&&t.slice(-1)==="'"}function Da(t){return typeof t!="string"||t.match(/[=\r\n]/)||t.match(/^\[/)||t.length>1&&vj(t)||t!==t.trim()?JSON.stringify(t):t.replace(/;/g,"\\;").replace(/#/g,"\\#")}function Bh(t,e){if(t=(t||"").trim(),vj(t)){t.charAt(0)==="'"&&(t=t.substr(1,t.length-2));try{t=JSON.parse(t)}catch{}}else{for(var r=!1,n="",i=0,o=t.length;i<o;i++){var s=t.charAt(i);if(r)"\\;#".indexOf(s)!==-1?n+=s:n+="\\"+s,r=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?r=!0:n+=s}}return r&&(n+="\\"),n.trim()}return t}});var Ej=D((sye,_j)=>{"use strict";var pb=1,wj=2;function $se(){return""}function Ise(t,e,r){return t.slice(e,r).replace(/\S/g," ")}_j.exports=function(t,e){e=e||{};for(var r,n,i=!1,o=!1,s=0,a="",u=e.whitespace===!1?$se:Ise,c=0;c<t.length;c++){if(r=t[c],n=t[c+1],!o&&r==='"'){var l=t[c-1]==="\\"&&t[c-2]!=="\\";l||(i=!i)}if(!i){if(!o&&r+n==="//")a+=t.slice(s,c),s=c,o=pb,c++;else if(o===pb&&r+n===`\r
195
195
  `){c++,o=!1,a+=u(t,s,c),s=c;continue}else if(o===pb&&r===`
196
- `)o=!1,a+=u(t,s,c),s=c;else if(!o&&r+n==="/*"){a+=t.slice(s,c),s=c,o=w6,c++;continue}else if(o===w6&&r+n==="*/"){c++,o=!1,a+=u(t,s,c+1),s=c+1;continue}}}return a+(o?u(t.substr(s)):t.substr(s))}});var S6=D(va=>{"use strict";var C6=require("fs"),jse=b6(),jc=require("path"),Nse=E6(),Lse=va.parse=function(t){return/^\s*{/.test(t)?JSON.parse(Nse(t)):jse.parse(t)},Bse=va.file=function(){var t=[].slice.call(arguments).filter(function(i){return i!=null});for(var e in t)if(typeof t[e]!="string")return;var r=jc.join.apply(null,t),n;try{return C6.readFileSync(r,"utf-8")}catch{return}},aye=va.json=function(){var t=Bse.apply(null,arguments);return t?Lse(t):null},uye=va.env=function(t,e){e=e||process.env;var r={},n=t.length;for(var i in e)if(i.toLowerCase().indexOf(t.toLowerCase())===0){for(var o=i.substring(n).split("__"),s;(s=o.indexOf(""))>-1;)o.splice(s,1);var a=r;o.forEach(function(c,l){!c||typeof a!="object"||(l===o.length-1&&(a[c]=e[i]),a[c]===void 0&&(a[c]={}),a=a[c])})}return r},cye=va.find=function(){var t=jc.join.apply(null,[].slice.call(arguments));function e(r,n){var i=jc.join(r,n);try{return C6.statSync(i),i}catch{if(jc.dirname(r)!==r)return e(jc.dirname(r),n)}}return e(process.cwd(),t)}});var T6=D((fye,k6)=>{"use strict";function F6(t){return t instanceof Buffer||t instanceof Date||t instanceof RegExp}function O6(t){if(t instanceof Buffer){var e=Buffer.alloc?Buffer.alloc(t.length):new Buffer(t.length);return t.copy(e),e}else{if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);throw new Error("Unexpected situation")}}function A6(t){var e=[];return t.forEach(function(r,n){typeof r=="object"&&r!==null?Array.isArray(r)?e[n]=A6(r):F6(r)?e[n]=O6(r):e[n]=mb({},r):e[n]=r}),e}function x6(t,e){return e==="__proto__"?void 0:t[e]}var mb=k6.exports=function(){if(arguments.length<1||typeof arguments[0]!="object")return!1;if(arguments.length<2)return arguments[0];var t=arguments[0],e=Array.prototype.slice.call(arguments,1),r,n,i;return e.forEach(function(o){typeof o!="object"||o===null||Array.isArray(o)||Object.keys(o).forEach(function(s){if(n=x6(t,s),r=x6(o,s),r!==t)if(typeof r!="object"||r===null){t[s]=r;return}else if(Array.isArray(r)){t[s]=A6(r);return}else if(F6(r)){t[s]=O6(r);return}else if(typeof n!="object"||n===null||Array.isArray(n)){t[s]=mb({},r);return}else{t[s]=mb(n,r);return}})}),t}});var I6=D((dye,$6)=>{"use strict";function qse(t,e){var r=t;e.slice(0,-1).forEach(function(i){r=r[i]||{}});var n=e[e.length-1];return n in r}function P6(t){return typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function R6(t,e){return e==="constructor"&&typeof t[e]=="function"||e==="__proto__"}$6.exports=function(t,e){e||(e={});var r={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(r.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?r.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(C){r.bools[C]=!0});var n={};function i(C){return n[C].some(function(A){return r.bools[A]})}Object.keys(e.alias||{}).forEach(function(C){n[C]=[].concat(e.alias[C]),n[C].forEach(function(A){n[A]=[C].concat(n[C].filter(function($){return A!==$}))})}),[].concat(e.string).filter(Boolean).forEach(function(C){r.strings[C]=!0,n[C]&&[].concat(n[C]).forEach(function(A){r.strings[A]=!0})});var o=e.default||{},s={_:[]};function a(C,A){return r.allBools&&/^--[^=]+$/.test(A)||r.strings[C]||r.bools[C]||n[C]}function u(C,A,$){for(var F=C,L=0;L<A.length-1;L++){var x=A[L];if(R6(F,x))return;F[x]===void 0&&(F[x]={}),(F[x]===Object.prototype||F[x]===Number.prototype||F[x]===String.prototype)&&(F[x]={}),F[x]===Array.prototype&&(F[x]=[]),F=F[x]}var I=A[A.length-1];R6(F,I)||((F===Object.prototype||F===Number.prototype||F===String.prototype)&&(F={}),F===Array.prototype&&(F=[]),F[I]===void 0||r.bools[I]||typeof F[I]=="boolean"?F[I]=$:Array.isArray(F[I])?F[I].push($):F[I]=[F[I],$])}function c(C,A,$){if(!($&&r.unknownFn&&!a(C,$)&&r.unknownFn($)===!1)){var F=!r.strings[C]&&P6(A)?Number(A):A;u(s,C.split("."),F),(n[C]||[]).forEach(function(L){u(s,L.split("."),F)})}}Object.keys(r.bools).forEach(function(C){c(C,o[C]===void 0?!1:o[C])});var l=[];t.indexOf("--")!==-1&&(l=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var f=0;f<t.length;f++){var h=t[f],d,p;if(/^--.+=/.test(h)){var v=h.match(/^--([^=]+)=([\s\S]*)$/);d=v[1];var g=v[2];r.bools[d]&&(g=g!=="false"),c(d,g,h)}else if(/^--no-.+/.test(h))d=h.match(/^--no-(.+)/)[1],c(d,!1,h);else if(/^--.+/.test(h))d=h.match(/^--(.+)/)[1],p=t[f+1],p!==void 0&&!/^(-|--)[^-]/.test(p)&&!r.bools[d]&&!r.allBools&&(!n[d]||!i(d))?(c(d,p,h),f+=1):/^(true|false)$/.test(p)?(c(d,p==="true",h),f+=1):c(d,r.strings[d]?"":!0,h);else if(/^-[^-]+/.test(h)){for(var w=h.slice(1,-1).split(""),S=!1,y=0;y<w.length;y++){if(p=h.slice(y+2),p==="-"){c(w[y],p,h);continue}if(/[A-Za-z]/.test(w[y])&&p[0]==="="){c(w[y],p.slice(1),h),S=!0;break}if(/[A-Za-z]/.test(w[y])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(p)){c(w[y],p,h),S=!0;break}if(w[y+1]&&w[y+1].match(/\W/)){c(w[y],h.slice(y+2),h),S=!0;break}else c(w[y],r.strings[w[y]]?"":!0,h)}d=h.slice(-1)[0],!S&&d!=="-"&&(t[f+1]&&!/^(-|--)[^-]/.test(t[f+1])&&!r.bools[d]&&(!n[d]||!i(d))?(c(d,t[f+1],h),f+=1):t[f+1]&&/^(true|false)$/.test(t[f+1])?(c(d,t[f+1]==="true",h),f+=1):c(d,r.strings[d]?"":!0,h))}else if((!r.unknownFn||r.unknownFn(h)!==!1)&&s._.push(r.strings._||!P6(h)?h:Number(h)),e.stopEarly){s._.push.apply(s._,t.slice(f+1));break}}return Object.keys(o).forEach(function(C){qse(s,C.split("."))||(u(s,C.split("."),o[C]),(n[C]||[]).forEach(function(A){u(s,A.split("."),o[C])}))}),e["--"]?s["--"]=l.slice():l.forEach(function(C){s._.push(C)}),s}});var B6=D((hye,L6)=>{var Nc=S6(),ba=require("path").join,Mse=T6(),j6="/etc",N6=process.platform==="win32",Lc=N6?process.env.USERPROFILE:process.env.HOME;L6.exports=function(t,e,r,n){if(typeof t!="string")throw new Error("rc(name): name *must* be string");r||(r=I6()(process.argv.slice(2))),e=(typeof e=="string"?Nc.json(e):e)||{},n=n||Nc.parse;var i=Nc.env(t+"_"),o=[e],s=[];function a(u){if(!(s.indexOf(u)>=0)){var c=Nc.file(u);c&&(o.push(n(c)),s.push(u))}}return N6||[ba(j6,t,"config"),ba(j6,t+"rc")].forEach(a),Lc&&[ba(Lc,".config",t,"config"),ba(Lc,".config",t),ba(Lc,"."+t,"config"),ba(Lc,"."+t+"rc")].forEach(a),a(Nc.find("."+t+"rc")),i.config&&a(i.config),r.config&&a(r.config),Mse.apply(null,o.concat([i,r,s.length?{configs:s,config:s[s.length-1]}:void 0]))}});var U6=D((mye,M6)=>{var bi=require("constants"),Use=process.cwd,qh=null,Hse=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return qh||(qh=Use.call(process)),qh};try{process.cwd()}catch{}typeof process.chdir=="function"&&(yb=process.chdir,process.chdir=function(t){qh=null,yb.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,yb));var yb;M6.exports=Vse;function Vse(t){bi.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,f,h){h&&process.nextTick(h)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,f,h,d){d&&process.nextTick(d)},t.lchownSync=function(){}),Hse==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(l){function f(h,d,p){var v=Date.now(),g=0;l(h,d,function w(S){if(S&&(S.code==="EACCES"||S.code==="EPERM")&&Date.now()-v<6e4){setTimeout(function(){t.stat(d,function(y,C){y&&y.code==="ENOENT"?l(h,d,w):p(S)})},g),g<100&&(g+=10);return}p&&p(S)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f}(t.rename)),t.read=typeof t.read!="function"?t.read:function(l){function f(h,d,p,v,g,w){var S;if(w&&typeof w=="function"){var y=0;S=function(C,A,$){if(C&&C.code==="EAGAIN"&&y<10)return y++,l.call(t,h,d,p,v,g,S);w.apply(this,arguments)}}return l.call(t,h,d,p,v,g,S)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(l){return function(f,h,d,p,v){for(var g=0;;)try{return l.call(t,f,h,d,p,v)}catch(w){if(w.code==="EAGAIN"&&g<10){g++;continue}throw w}}}(t.readSync);function e(l){l.lchmod=function(f,h,d){l.open(f,bi.O_WRONLY|bi.O_SYMLINK,h,function(p,v){if(p){d&&d(p);return}l.fchmod(v,h,function(g){l.close(v,function(w){d&&d(g||w)})})})},l.lchmodSync=function(f,h){var d=l.openSync(f,bi.O_WRONLY|bi.O_SYMLINK,h),p=!0,v;try{v=l.fchmodSync(d,h),p=!1}finally{if(p)try{l.closeSync(d)}catch{}else l.closeSync(d)}return v}}function r(l){bi.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(f,h,d,p){l.open(f,bi.O_SYMLINK,function(v,g){if(v){p&&p(v);return}l.futimes(g,h,d,function(w){l.close(g,function(S){p&&p(w||S)})})})},l.lutimesSync=function(f,h,d){var p=l.openSync(f,bi.O_SYMLINK),v,g=!0;try{v=l.futimesSync(p,h,d),g=!1}finally{if(g)try{l.closeSync(p)}catch{}else l.closeSync(p)}return v}):l.futimes&&(l.lutimes=function(f,h,d,p){p&&process.nextTick(p)},l.lutimesSync=function(){})}function n(l){return l&&function(f,h,d){return l.call(t,f,h,function(p){c(p)&&(p=null),d&&d.apply(this,arguments)})}}function i(l){return l&&function(f,h){try{return l.call(t,f,h)}catch(d){if(!c(d))throw d}}}function o(l){return l&&function(f,h,d,p){return l.call(t,f,h,d,function(v){c(v)&&(v=null),p&&p.apply(this,arguments)})}}function s(l){return l&&function(f,h,d){try{return l.call(t,f,h,d)}catch(p){if(!c(p))throw p}}}function a(l){return l&&function(f,h,d){typeof h=="function"&&(d=h,h=null);function p(v,g){g&&(g.uid<0&&(g.uid+=4294967296),g.gid<0&&(g.gid+=4294967296)),d&&d.apply(this,arguments)}return h?l.call(t,f,h,p):l.call(t,f,p)}}function u(l){return l&&function(f,h){var d=h?l.call(t,f,h):l.call(t,f);return d&&(d.uid<0&&(d.uid+=4294967296),d.gid<0&&(d.gid+=4294967296)),d}}function c(l){if(!l||l.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var z6=D((gye,V6)=>{var H6=require("stream").Stream;V6.exports=zse;function zse(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);H6.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var s=Object.keys(i),a=0,u=s.length;a<u;a++){var c=s[a];this[c]=i[c]}if(this.encoding&&this.setEncoding(this.encoding),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 new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}t.open(this.path,this.flags,this.mode,function(l,f){if(l){o.emit("error",l),o.readable=!1;return}o.fd=f,o.emit("open",f),o._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);H6.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var u=o[s];this[u]=i[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var W6=D((yye,G6)=>{"use strict";G6.exports=Wse;var Gse=Object.getPrototypeOf||function(t){return t.__proto__};function Wse(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:Gse(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var X6=D((Dye,bb)=>{var Ge=require("fs"),Kse=U6(),Yse=z6(),Jse=W6(),Mh=require("util"),_t,Hh;typeof Symbol=="function"&&typeof Symbol.for=="function"?(_t=Symbol.for("graceful-fs.queue"),Hh=Symbol.for("graceful-fs.previous")):(_t="___graceful-fs.queue",Hh="___graceful-fs.previous");function Xse(){}function J6(t,e){Object.defineProperty(t,_t,{get:function(){return e}})}var Co=Xse;Mh.debuglog?Co=Mh.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Co=function(){var t=Mh.format.apply(Mh,arguments);t="GFS4: "+t.split(/\n/).join(`
197
- GFS4: `),console.error(t)});Ge[_t]||(K6=global[_t]||[],J6(Ge,K6),Ge.close=function(t){function e(r,n){return t.call(Ge,r,function(i){i||Y6(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Hh,{value:t}),e}(Ge.close),Ge.closeSync=function(t){function e(r){t.apply(Ge,arguments),Y6()}return Object.defineProperty(e,Hh,{value:t}),e}(Ge.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Co(Ge[_t]),require("assert").equal(Ge[_t].length,0)}));var K6;global[_t]||J6(global,Ge[_t]);bb.exports=Db(Jse(Ge));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ge.__patched&&(bb.exports=Db(Ge),Ge.__patched=!0);function Db(t){Kse(t),t.gracefulify=Db,t.createReadStream=A,t.createWriteStream=$;var e=t.readFile;t.readFile=r;function r(x,I,R){return typeof I=="function"&&(R=I,I=null),B(x,I,R);function B(q,K,M,E){return e(q,K,function(b){b&&(b.code==="EMFILE"||b.code==="ENFILE")?wa([B,[q,K,M],b,E||Date.now(),Date.now()]):typeof M=="function"&&M.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(x,I,R,B){return typeof R=="function"&&(B=R,R=null),q(x,I,R,B);function q(K,M,E,b,_){return n(K,M,E,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?wa([q,[K,M,E,b],O,_||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}var o=t.appendFile;o&&(t.appendFile=s);function s(x,I,R,B){return typeof R=="function"&&(B=R,R=null),q(x,I,R,B);function q(K,M,E,b,_){return o(K,M,E,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?wa([q,[K,M,E,b],O,_||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(x,I,R,B){return typeof R=="function"&&(B=R,R=0),q(x,I,R,B);function q(K,M,E,b,_){return a(K,M,E,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?wa([q,[K,M,E,b],O,_||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}var c=t.readdir;t.readdir=f;var l=/^v[0-5]\./;function f(x,I,R){typeof I=="function"&&(R=I,I=null);var B=l.test(process.version)?function(M,E,b,_){return c(M,q(M,E,b,_))}:function(M,E,b,_){return c(M,E,q(M,E,b,_))};return B(x,I,R);function q(K,M,E,b){return function(_,O){_&&(_.code==="EMFILE"||_.code==="ENFILE")?wa([B,[K,M,E],_,b||Date.now(),Date.now()]):(O&&O.sort&&O.sort(),typeof E=="function"&&E.call(this,_,O))}}}if(process.version.substr(0,4)==="v0.8"){var h=Yse(t);w=h.ReadStream,y=h.WriteStream}var d=t.ReadStream;d&&(w.prototype=Object.create(d.prototype),w.prototype.open=S);var p=t.WriteStream;p&&(y.prototype=Object.create(p.prototype),y.prototype.open=C),Object.defineProperty(t,"ReadStream",{get:function(){return w},set:function(x){w=x},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return y},set:function(x){y=x},enumerable:!0,configurable:!0});var v=w;Object.defineProperty(t,"FileReadStream",{get:function(){return v},set:function(x){v=x},enumerable:!0,configurable:!0});var g=y;Object.defineProperty(t,"FileWriteStream",{get:function(){return g},set:function(x){g=x},enumerable:!0,configurable:!0});function w(x,I){return this instanceof w?(d.apply(this,arguments),this):w.apply(Object.create(w.prototype),arguments)}function S(){var x=this;L(x.path,x.flags,x.mode,function(I,R){I?(x.autoClose&&x.destroy(),x.emit("error",I)):(x.fd=R,x.emit("open",R),x.read())})}function y(x,I){return this instanceof y?(p.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function C(){var x=this;L(x.path,x.flags,x.mode,function(I,R){I?(x.destroy(),x.emit("error",I)):(x.fd=R,x.emit("open",R))})}function A(x,I){return new t.ReadStream(x,I)}function $(x,I){return new t.WriteStream(x,I)}var F=t.open;t.open=L;function L(x,I,R,B){return typeof R=="function"&&(B=R,R=null),q(x,I,R,B);function q(K,M,E,b,_){return F(K,M,E,function(O,j){O&&(O.code==="EMFILE"||O.code==="ENFILE")?wa([q,[K,M,E,b],O,_||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}return t}function wa(t){Co("ENQUEUE",t[0].name,t[1]),Ge[_t].push(t),vb()}var Uh;function Y6(){for(var t=Date.now(),e=0;e<Ge[_t].length;++e)Ge[_t][e].length>2&&(Ge[_t][e][3]=t,Ge[_t][e][4]=t);vb()}function vb(){if(clearTimeout(Uh),Uh=void 0,Ge[_t].length!==0){var t=Ge[_t].shift(),e=t[0],r=t[1],n=t[2],i=t[3],o=t[4];if(i===void 0)Co("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Co("TIMEOUT",e.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-o,u=Math.max(o-i,1),c=Math.min(u*1.2,100);a>=c?(Co("RETRY",e.name,r),e.apply(null,r.concat([i]))):Ge[_t].push(t)}Uh===void 0&&(Uh=setTimeout(vb,0))}}});var Z6=D(_a=>{"use strict";var Zse=_a&&_a.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_a,"__esModule",{value:!0});_a.readCAFileSync=void 0;var Qse=Zse(X6());function eae(t){try{let e=Qse.default.readFileSync(t,"utf8"),r="-----END CERTIFICATE-----";return e.split(r).filter(i=>!!i.trim()).map(i=>`${i.trimLeft()}${r}`)}catch(e){if(e.code==="ENOENT")return;throw e}}_a.readCAFileSync=eae});var Q6=D(So=>{"use strict";var tae=So&&So.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rae=So&&So.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tae(e,t,r)};Object.defineProperty(So,"__esModule",{value:!0});rae(Z6(),So)});var r8=D((wye,t8)=>{t8.exports=e8;function xo(t,e){if(typeof Object.setPrototypeOf=="function")return Object.setPrototypeOf(t,e);t.__proto__=e}function e8(){this.list=[];var t=null;Object.defineProperty(this,"root",{get:function(){return t},set:function(e){t=e,this.list.length&&xo(this.list[this.list.length-1],e)},enumerable:!0,configurable:!0})}e8.prototype={get length(){return this.list.length},get keys(){var t=[];for(var e in this.list[0])t.push(e);return t},get snapshot(){var t={};return this.keys.forEach(function(e){t[e]=this.get(e)},this),t},get store(){return this.list[0]},push:function(t){return typeof t!="object"&&(t={valueOf:t}),this.list.length>=1&&xo(this.list[this.list.length-1],t),xo(t,this.root),this.list.push(t)},pop:function(){return this.list.length>=2&&xo(this.list[this.list.length-2],this.root),this.list.pop()},unshift:function(t){return xo(t,this.list[0]||this.root),this.list.unshift(t)},shift:function(){return this.list.length===1&&xo(this.list[0],this.root),this.list.shift()},get:function(t){return this.list[0][t]},set:function(t,e,r){return this.length||this.push({}),r&&this.list[0].hasOwnProperty(t)&&this.push({}),this.list[0][t]=e},forEach:function(t,e){for(var r in this.list[0])t.call(e,r,this.list[0][r])},slice:function(){return this.list.slice.apply(this.list,arguments)},splice:function(){for(var t=this.list.splice.apply(this.list,arguments),e=0,r=this.list.length;e<r;e++)xo(this.list[e],this.list[e+1]||this.root);return t}}});var s8=D(Fo=>{Fo.parse=Fo.decode=nae;Fo.stringify=Fo.encode=n8;Fo.safe=Ea;Fo.unsafe=Vh;var wb=typeof process<"u"&&process.platform==="win32"?`\r
196
+ `)o=!1,a+=u(t,s,c),s=c;else if(!o&&r+n==="/*"){a+=t.slice(s,c),s=c,o=wj,c++;continue}else if(o===wj&&r+n==="*/"){c++,o=!1,a+=u(t,s,c+1),s=c+1;continue}}}return a+(o?u(t.substr(s)):t.substr(s))}});var Sj=D(va=>{"use strict";var Cj=require("fs"),jse=bj(),jc=require("path"),Nse=Ej(),Lse=va.parse=function(t){return/^\s*{/.test(t)?JSON.parse(Nse(t)):jse.parse(t)},Bse=va.file=function(){var t=[].slice.call(arguments).filter(function(i){return i!=null});for(var e in t)if(typeof t[e]!="string")return;var r=jc.join.apply(null,t),n;try{return Cj.readFileSync(r,"utf-8")}catch{return}},aye=va.json=function(){var t=Bse.apply(null,arguments);return t?Lse(t):null},uye=va.env=function(t,e){e=e||process.env;var r={},n=t.length;for(var i in e)if(i.toLowerCase().indexOf(t.toLowerCase())===0){for(var o=i.substring(n).split("__"),s;(s=o.indexOf(""))>-1;)o.splice(s,1);var a=r;o.forEach(function(c,l){!c||typeof a!="object"||(l===o.length-1&&(a[c]=e[i]),a[c]===void 0&&(a[c]={}),a=a[c])})}return r},cye=va.find=function(){var t=jc.join.apply(null,[].slice.call(arguments));function e(r,n){var i=jc.join(r,n);try{return Cj.statSync(i),i}catch{if(jc.dirname(r)!==r)return e(jc.dirname(r),n)}}return e(process.cwd(),t)}});var Tj=D((fye,kj)=>{"use strict";function Fj(t){return t instanceof Buffer||t instanceof Date||t instanceof RegExp}function Oj(t){if(t instanceof Buffer){var e=Buffer.alloc?Buffer.alloc(t.length):new Buffer(t.length);return t.copy(e),e}else{if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);throw new Error("Unexpected situation")}}function Aj(t){var e=[];return t.forEach(function(r,n){typeof r=="object"&&r!==null?Array.isArray(r)?e[n]=Aj(r):Fj(r)?e[n]=Oj(r):e[n]=mb({},r):e[n]=r}),e}function xj(t,e){return e==="__proto__"?void 0:t[e]}var mb=kj.exports=function(){if(arguments.length<1||typeof arguments[0]!="object")return!1;if(arguments.length<2)return arguments[0];var t=arguments[0],e=Array.prototype.slice.call(arguments,1),r,n,i;return e.forEach(function(o){typeof o!="object"||o===null||Array.isArray(o)||Object.keys(o).forEach(function(s){if(n=xj(t,s),r=xj(o,s),r!==t)if(typeof r!="object"||r===null){t[s]=r;return}else if(Array.isArray(r)){t[s]=Aj(r);return}else if(Fj(r)){t[s]=Oj(r);return}else if(typeof n!="object"||n===null||Array.isArray(n)){t[s]=mb({},r);return}else{t[s]=mb(n,r);return}})}),t}});var Ij=D((dye,$j)=>{"use strict";function qse(t,e){var r=t;e.slice(0,-1).forEach(function(i){r=r[i]||{}});var n=e[e.length-1];return n in r}function Pj(t){return typeof t=="number"||/^0x[0-9a-f]+$/i.test(t)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function Rj(t,e){return e==="constructor"&&typeof t[e]=="function"||e==="__proto__"}$j.exports=function(t,e){e||(e={});var r={bools:{},strings:{},unknownFn:null};typeof e.unknown=="function"&&(r.unknownFn=e.unknown),typeof e.boolean=="boolean"&&e.boolean?r.allBools=!0:[].concat(e.boolean).filter(Boolean).forEach(function(C){r.bools[C]=!0});var n={};function i(C){return n[C].some(function(A){return r.bools[A]})}Object.keys(e.alias||{}).forEach(function(C){n[C]=[].concat(e.alias[C]),n[C].forEach(function(A){n[A]=[C].concat(n[C].filter(function($){return A!==$}))})}),[].concat(e.string).filter(Boolean).forEach(function(C){r.strings[C]=!0,n[C]&&[].concat(n[C]).forEach(function(A){r.strings[A]=!0})});var o=e.default||{},s={_:[]};function a(C,A){return r.allBools&&/^--[^=]+$/.test(A)||r.strings[C]||r.bools[C]||n[C]}function u(C,A,$){for(var F=C,L=0;L<A.length-1;L++){var x=A[L];if(Rj(F,x))return;F[x]===void 0&&(F[x]={}),(F[x]===Object.prototype||F[x]===Number.prototype||F[x]===String.prototype)&&(F[x]={}),F[x]===Array.prototype&&(F[x]=[]),F=F[x]}var I=A[A.length-1];Rj(F,I)||((F===Object.prototype||F===Number.prototype||F===String.prototype)&&(F={}),F===Array.prototype&&(F=[]),F[I]===void 0||r.bools[I]||typeof F[I]=="boolean"?F[I]=$:Array.isArray(F[I])?F[I].push($):F[I]=[F[I],$])}function c(C,A,$){if(!($&&r.unknownFn&&!a(C,$)&&r.unknownFn($)===!1)){var F=!r.strings[C]&&Pj(A)?Number(A):A;u(s,C.split("."),F),(n[C]||[]).forEach(function(L){u(s,L.split("."),F)})}}Object.keys(r.bools).forEach(function(C){c(C,o[C]===void 0?!1:o[C])});var l=[];t.indexOf("--")!==-1&&(l=t.slice(t.indexOf("--")+1),t=t.slice(0,t.indexOf("--")));for(var f=0;f<t.length;f++){var h=t[f],d,p;if(/^--.+=/.test(h)){var v=h.match(/^--([^=]+)=([\s\S]*)$/);d=v[1];var g=v[2];r.bools[d]&&(g=g!=="false"),c(d,g,h)}else if(/^--no-.+/.test(h))d=h.match(/^--no-(.+)/)[1],c(d,!1,h);else if(/^--.+/.test(h))d=h.match(/^--(.+)/)[1],p=t[f+1],p!==void 0&&!/^(-|--)[^-]/.test(p)&&!r.bools[d]&&!r.allBools&&(!n[d]||!i(d))?(c(d,p,h),f+=1):/^(true|false)$/.test(p)?(c(d,p==="true",h),f+=1):c(d,r.strings[d]?"":!0,h);else if(/^-[^-]+/.test(h)){for(var w=h.slice(1,-1).split(""),S=!1,y=0;y<w.length;y++){if(p=h.slice(y+2),p==="-"){c(w[y],p,h);continue}if(/[A-Za-z]/.test(w[y])&&p[0]==="="){c(w[y],p.slice(1),h),S=!0;break}if(/[A-Za-z]/.test(w[y])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(p)){c(w[y],p,h),S=!0;break}if(w[y+1]&&w[y+1].match(/\W/)){c(w[y],h.slice(y+2),h),S=!0;break}else c(w[y],r.strings[w[y]]?"":!0,h)}d=h.slice(-1)[0],!S&&d!=="-"&&(t[f+1]&&!/^(-|--)[^-]/.test(t[f+1])&&!r.bools[d]&&(!n[d]||!i(d))?(c(d,t[f+1],h),f+=1):t[f+1]&&/^(true|false)$/.test(t[f+1])?(c(d,t[f+1]==="true",h),f+=1):c(d,r.strings[d]?"":!0,h))}else if((!r.unknownFn||r.unknownFn(h)!==!1)&&s._.push(r.strings._||!Pj(h)?h:Number(h)),e.stopEarly){s._.push.apply(s._,t.slice(f+1));break}}return Object.keys(o).forEach(function(C){qse(s,C.split("."))||(u(s,C.split("."),o[C]),(n[C]||[]).forEach(function(A){u(s,A.split("."),o[C])}))}),e["--"]?s["--"]=l.slice():l.forEach(function(C){s._.push(C)}),s}});var Bj=D((hye,Lj)=>{var Nc=Sj(),ba=require("path").join,Mse=Tj(),jj="/etc",Nj=process.platform==="win32",Lc=Nj?process.env.USERPROFILE:process.env.HOME;Lj.exports=function(t,e,r,n){if(typeof t!="string")throw new Error("rc(name): name *must* be string");r||(r=Ij()(process.argv.slice(2))),e=(typeof e=="string"?Nc.json(e):e)||{},n=n||Nc.parse;var i=Nc.env(t+"_"),o=[e],s=[];function a(u){if(!(s.indexOf(u)>=0)){var c=Nc.file(u);c&&(o.push(n(c)),s.push(u))}}return Nj||[ba(jj,t,"config"),ba(jj,t+"rc")].forEach(a),Lc&&[ba(Lc,".config",t,"config"),ba(Lc,".config",t),ba(Lc,"."+t,"config"),ba(Lc,"."+t+"rc")].forEach(a),a(Nc.find("."+t+"rc")),i.config&&a(i.config),r.config&&a(r.config),Mse.apply(null,o.concat([i,r,s.length?{configs:s,config:s[s.length-1]}:void 0]))}});var Uj=D((mye,Mj)=>{var bi=require("constants"),Use=process.cwd,qh=null,Hse=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return qh||(qh=Use.call(process)),qh};try{process.cwd()}catch{}typeof process.chdir=="function"&&(yb=process.chdir,process.chdir=function(t){qh=null,yb.call(process,t)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,yb));var yb;Mj.exports=Vse;function Vse(t){bi.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&e(t),t.lutimes||r(t),t.chown=o(t.chown),t.fchown=o(t.fchown),t.lchown=o(t.lchown),t.chmod=n(t.chmod),t.fchmod=n(t.fchmod),t.lchmod=n(t.lchmod),t.chownSync=s(t.chownSync),t.fchownSync=s(t.fchownSync),t.lchownSync=s(t.lchownSync),t.chmodSync=i(t.chmodSync),t.fchmodSync=i(t.fchmodSync),t.lchmodSync=i(t.lchmodSync),t.stat=a(t.stat),t.fstat=a(t.fstat),t.lstat=a(t.lstat),t.statSync=u(t.statSync),t.fstatSync=u(t.fstatSync),t.lstatSync=u(t.lstatSync),t.chmod&&!t.lchmod&&(t.lchmod=function(l,f,h){h&&process.nextTick(h)},t.lchmodSync=function(){}),t.chown&&!t.lchown&&(t.lchown=function(l,f,h,d){d&&process.nextTick(d)},t.lchownSync=function(){}),Hse==="win32"&&(t.rename=typeof t.rename!="function"?t.rename:function(l){function f(h,d,p){var v=Date.now(),g=0;l(h,d,function w(S){if(S&&(S.code==="EACCES"||S.code==="EPERM")&&Date.now()-v<6e4){setTimeout(function(){t.stat(d,function(y,C){y&&y.code==="ENOENT"?l(h,d,w):p(S)})},g),g<100&&(g+=10);return}p&&p(S)})}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f}(t.rename)),t.read=typeof t.read!="function"?t.read:function(l){function f(h,d,p,v,g,w){var S;if(w&&typeof w=="function"){var y=0;S=function(C,A,$){if(C&&C.code==="EAGAIN"&&y<10)return y++,l.call(t,h,d,p,v,g,S);w.apply(this,arguments)}}return l.call(t,h,d,p,v,g,S)}return Object.setPrototypeOf&&Object.setPrototypeOf(f,l),f}(t.read),t.readSync=typeof t.readSync!="function"?t.readSync:function(l){return function(f,h,d,p,v){for(var g=0;;)try{return l.call(t,f,h,d,p,v)}catch(w){if(w.code==="EAGAIN"&&g<10){g++;continue}throw w}}}(t.readSync);function e(l){l.lchmod=function(f,h,d){l.open(f,bi.O_WRONLY|bi.O_SYMLINK,h,function(p,v){if(p){d&&d(p);return}l.fchmod(v,h,function(g){l.close(v,function(w){d&&d(g||w)})})})},l.lchmodSync=function(f,h){var d=l.openSync(f,bi.O_WRONLY|bi.O_SYMLINK,h),p=!0,v;try{v=l.fchmodSync(d,h),p=!1}finally{if(p)try{l.closeSync(d)}catch{}else l.closeSync(d)}return v}}function r(l){bi.hasOwnProperty("O_SYMLINK")&&l.futimes?(l.lutimes=function(f,h,d,p){l.open(f,bi.O_SYMLINK,function(v,g){if(v){p&&p(v);return}l.futimes(g,h,d,function(w){l.close(g,function(S){p&&p(w||S)})})})},l.lutimesSync=function(f,h,d){var p=l.openSync(f,bi.O_SYMLINK),v,g=!0;try{v=l.futimesSync(p,h,d),g=!1}finally{if(g)try{l.closeSync(p)}catch{}else l.closeSync(p)}return v}):l.futimes&&(l.lutimes=function(f,h,d,p){p&&process.nextTick(p)},l.lutimesSync=function(){})}function n(l){return l&&function(f,h,d){return l.call(t,f,h,function(p){c(p)&&(p=null),d&&d.apply(this,arguments)})}}function i(l){return l&&function(f,h){try{return l.call(t,f,h)}catch(d){if(!c(d))throw d}}}function o(l){return l&&function(f,h,d,p){return l.call(t,f,h,d,function(v){c(v)&&(v=null),p&&p.apply(this,arguments)})}}function s(l){return l&&function(f,h,d){try{return l.call(t,f,h,d)}catch(p){if(!c(p))throw p}}}function a(l){return l&&function(f,h,d){typeof h=="function"&&(d=h,h=null);function p(v,g){g&&(g.uid<0&&(g.uid+=4294967296),g.gid<0&&(g.gid+=4294967296)),d&&d.apply(this,arguments)}return h?l.call(t,f,h,p):l.call(t,f,p)}}function u(l){return l&&function(f,h){var d=h?l.call(t,f,h):l.call(t,f);return d&&(d.uid<0&&(d.uid+=4294967296),d.gid<0&&(d.gid+=4294967296)),d}}function c(l){if(!l||l.code==="ENOSYS")return!0;var f=!process.getuid||process.getuid()!==0;return!!(f&&(l.code==="EINVAL"||l.code==="EPERM"))}}});var zj=D((gye,Vj)=>{var Hj=require("stream").Stream;Vj.exports=zse;function zse(t){return{ReadStream:e,WriteStream:r};function e(n,i){if(!(this instanceof e))return new e(n,i);Hj.call(this);var o=this;this.path=n,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,i=i||{};for(var s=Object.keys(i),a=0,u=s.length;a<u;a++){var c=s[a];this[c]=i[c]}if(this.encoding&&this.setEncoding(this.encoding),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 new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){o._read()});return}t.open(this.path,this.flags,this.mode,function(l,f){if(l){o.emit("error",l),o.readable=!1;return}o.fd=f,o.emit("open",f),o._read()})}function r(n,i){if(!(this instanceof r))return new r(n,i);Hj.call(this),this.path=n,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,i=i||{};for(var o=Object.keys(i),s=0,a=o.length;s<a;s++){var u=o[s];this[u]=i[u]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=t.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}});var Wj=D((yye,Gj)=>{"use strict";Gj.exports=Wse;var Gse=Object.getPrototypeOf||function(t){return t.__proto__};function Wse(t){if(t===null||typeof t!="object")return t;if(t instanceof Object)var e={__proto__:Gse(t)};else var e=Object.create(null);return Object.getOwnPropertyNames(t).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}),e}});var Xj=D((Dye,bb)=>{var Ge=require("fs"),Kse=Uj(),Yse=zj(),Jse=Wj(),Mh=require("util"),_t,Hh;typeof Symbol=="function"&&typeof Symbol.for=="function"?(_t=Symbol.for("graceful-fs.queue"),Hh=Symbol.for("graceful-fs.previous")):(_t="___graceful-fs.queue",Hh="___graceful-fs.previous");function Xse(){}function Jj(t,e){Object.defineProperty(t,_t,{get:function(){return e}})}var Co=Xse;Mh.debuglog?Co=Mh.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(Co=function(){var t=Mh.format.apply(Mh,arguments);t="GFS4: "+t.split(/\n/).join(`
197
+ GFS4: `),console.error(t)});Ge[_t]||(Kj=global[_t]||[],Jj(Ge,Kj),Ge.close=function(t){function e(r,n){return t.call(Ge,r,function(i){i||Yj(),typeof n=="function"&&n.apply(this,arguments)})}return Object.defineProperty(e,Hh,{value:t}),e}(Ge.close),Ge.closeSync=function(t){function e(r){t.apply(Ge,arguments),Yj()}return Object.defineProperty(e,Hh,{value:t}),e}(Ge.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){Co(Ge[_t]),require("assert").equal(Ge[_t].length,0)}));var Kj;global[_t]||Jj(global,Ge[_t]);bb.exports=Db(Jse(Ge));process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!Ge.__patched&&(bb.exports=Db(Ge),Ge.__patched=!0);function Db(t){Kse(t),t.gracefulify=Db,t.createReadStream=A,t.createWriteStream=$;var e=t.readFile;t.readFile=r;function r(x,I,R){return typeof I=="function"&&(R=I,I=null),B(x,I,R);function B(q,K,M,E){return e(q,K,function(b){b&&(b.code==="EMFILE"||b.code==="ENFILE")?wa([B,[q,K,M],b,E||Date.now(),Date.now()]):typeof M=="function"&&M.apply(this,arguments)})}}var n=t.writeFile;t.writeFile=i;function i(x,I,R,B){return typeof R=="function"&&(B=R,R=null),q(x,I,R,B);function q(K,M,E,b,_){return n(K,M,E,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?wa([q,[K,M,E,b],O,_||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}var o=t.appendFile;o&&(t.appendFile=s);function s(x,I,R,B){return typeof R=="function"&&(B=R,R=null),q(x,I,R,B);function q(K,M,E,b,_){return o(K,M,E,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?wa([q,[K,M,E,b],O,_||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}var a=t.copyFile;a&&(t.copyFile=u);function u(x,I,R,B){return typeof R=="function"&&(B=R,R=0),q(x,I,R,B);function q(K,M,E,b,_){return a(K,M,E,function(O){O&&(O.code==="EMFILE"||O.code==="ENFILE")?wa([q,[K,M,E,b],O,_||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}var c=t.readdir;t.readdir=f;var l=/^v[0-5]\./;function f(x,I,R){typeof I=="function"&&(R=I,I=null);var B=l.test(process.version)?function(M,E,b,_){return c(M,q(M,E,b,_))}:function(M,E,b,_){return c(M,E,q(M,E,b,_))};return B(x,I,R);function q(K,M,E,b){return function(_,O){_&&(_.code==="EMFILE"||_.code==="ENFILE")?wa([B,[K,M,E],_,b||Date.now(),Date.now()]):(O&&O.sort&&O.sort(),typeof E=="function"&&E.call(this,_,O))}}}if(process.version.substr(0,4)==="v0.8"){var h=Yse(t);w=h.ReadStream,y=h.WriteStream}var d=t.ReadStream;d&&(w.prototype=Object.create(d.prototype),w.prototype.open=S);var p=t.WriteStream;p&&(y.prototype=Object.create(p.prototype),y.prototype.open=C),Object.defineProperty(t,"ReadStream",{get:function(){return w},set:function(x){w=x},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return y},set:function(x){y=x},enumerable:!0,configurable:!0});var v=w;Object.defineProperty(t,"FileReadStream",{get:function(){return v},set:function(x){v=x},enumerable:!0,configurable:!0});var g=y;Object.defineProperty(t,"FileWriteStream",{get:function(){return g},set:function(x){g=x},enumerable:!0,configurable:!0});function w(x,I){return this instanceof w?(d.apply(this,arguments),this):w.apply(Object.create(w.prototype),arguments)}function S(){var x=this;L(x.path,x.flags,x.mode,function(I,R){I?(x.autoClose&&x.destroy(),x.emit("error",I)):(x.fd=R,x.emit("open",R),x.read())})}function y(x,I){return this instanceof y?(p.apply(this,arguments),this):y.apply(Object.create(y.prototype),arguments)}function C(){var x=this;L(x.path,x.flags,x.mode,function(I,R){I?(x.destroy(),x.emit("error",I)):(x.fd=R,x.emit("open",R))})}function A(x,I){return new t.ReadStream(x,I)}function $(x,I){return new t.WriteStream(x,I)}var F=t.open;t.open=L;function L(x,I,R,B){return typeof R=="function"&&(B=R,R=null),q(x,I,R,B);function q(K,M,E,b,_){return F(K,M,E,function(O,j){O&&(O.code==="EMFILE"||O.code==="ENFILE")?wa([q,[K,M,E,b],O,_||Date.now(),Date.now()]):typeof b=="function"&&b.apply(this,arguments)})}}return t}function wa(t){Co("ENQUEUE",t[0].name,t[1]),Ge[_t].push(t),vb()}var Uh;function Yj(){for(var t=Date.now(),e=0;e<Ge[_t].length;++e)Ge[_t][e].length>2&&(Ge[_t][e][3]=t,Ge[_t][e][4]=t);vb()}function vb(){if(clearTimeout(Uh),Uh=void 0,Ge[_t].length!==0){var t=Ge[_t].shift(),e=t[0],r=t[1],n=t[2],i=t[3],o=t[4];if(i===void 0)Co("RETRY",e.name,r),e.apply(null,r);else if(Date.now()-i>=6e4){Co("TIMEOUT",e.name,r);var s=r.pop();typeof s=="function"&&s.call(null,n)}else{var a=Date.now()-o,u=Math.max(o-i,1),c=Math.min(u*1.2,100);a>=c?(Co("RETRY",e.name,r),e.apply(null,r.concat([i]))):Ge[_t].push(t)}Uh===void 0&&(Uh=setTimeout(vb,0))}}});var Zj=D(_a=>{"use strict";var Zse=_a&&_a.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(_a,"__esModule",{value:!0});_a.readCAFileSync=void 0;var Qse=Zse(Xj());function eae(t){try{let e=Qse.default.readFileSync(t,"utf8"),r="-----END CERTIFICATE-----";return e.split(r).filter(i=>!!i.trim()).map(i=>`${i.trimLeft()}${r}`)}catch(e){if(e.code==="ENOENT")return;throw e}}_a.readCAFileSync=eae});var Qj=D(So=>{"use strict";var tae=So&&So.__createBinding||(Object.create?function(t,e,r,n){n===void 0&&(n=r);var i=Object.getOwnPropertyDescriptor(e,r);(!i||("get"in i?!e.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,n,i)}:function(t,e,r,n){n===void 0&&(n=r),t[n]=e[r]}),rae=So&&So.__exportStar||function(t,e){for(var r in t)r!=="default"&&!Object.prototype.hasOwnProperty.call(e,r)&&tae(e,t,r)};Object.defineProperty(So,"__esModule",{value:!0});rae(Zj(),So)});var r8=D((wye,t8)=>{t8.exports=e8;function xo(t,e){if(typeof Object.setPrototypeOf=="function")return Object.setPrototypeOf(t,e);t.__proto__=e}function e8(){this.list=[];var t=null;Object.defineProperty(this,"root",{get:function(){return t},set:function(e){t=e,this.list.length&&xo(this.list[this.list.length-1],e)},enumerable:!0,configurable:!0})}e8.prototype={get length(){return this.list.length},get keys(){var t=[];for(var e in this.list[0])t.push(e);return t},get snapshot(){var t={};return this.keys.forEach(function(e){t[e]=this.get(e)},this),t},get store(){return this.list[0]},push:function(t){return typeof t!="object"&&(t={valueOf:t}),this.list.length>=1&&xo(this.list[this.list.length-1],t),xo(t,this.root),this.list.push(t)},pop:function(){return this.list.length>=2&&xo(this.list[this.list.length-2],this.root),this.list.pop()},unshift:function(t){return xo(t,this.list[0]||this.root),this.list.unshift(t)},shift:function(){return this.list.length===1&&xo(this.list[0],this.root),this.list.shift()},get:function(t){return this.list[0][t]},set:function(t,e,r){return this.length||this.push({}),r&&this.list[0].hasOwnProperty(t)&&this.push({}),this.list[0][t]=e},forEach:function(t,e){for(var r in this.list[0])t.call(e,r,this.list[0][r])},slice:function(){return this.list.slice.apply(this.list,arguments)},splice:function(){for(var t=this.list.splice.apply(this.list,arguments),e=0,r=this.list.length;e<r;e++)xo(this.list[e],this.list[e+1]||this.root);return t}}});var s8=D(Fo=>{Fo.parse=Fo.decode=nae;Fo.stringify=Fo.encode=n8;Fo.safe=Ea;Fo.unsafe=Vh;var wb=typeof process<"u"&&process.platform==="win32"?`\r
198
198
  `:`
199
199
  `;function n8(t,e){var r=[],n="";typeof e=="string"?e={section:e,whitespace:!1}:(e=e||{},e.whitespace=e.whitespace===!0);var i=e.whitespace?" = ":"=";return Object.keys(t).forEach(function(o,s,a){var u=t[o];u&&Array.isArray(u)?u.forEach(function(c){n+=Ea(o+"[]")+i+Ea(c)+`
200
- `}):u&&typeof u=="object"?r.push(o):n+=Ea(o)+i+Ea(u)+wb}),e.section&&n.length&&(n="["+Ea(e.section)+"]"+wb+n),r.forEach(function(o,s,a){var u=i8(o).join("\\."),c=(e.section?e.section+".":"")+u,l=n8(t[o],{section:c,whitespace:e.whitespace});n.length&&l.length&&(n+=wb),n+=l}),n}function i8(t){return t.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(function(e){return e.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")})}function nae(t){var e={},r=e,n=null,i=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=t.split(/[\r\n]+/g);return o.forEach(function(s,a,u){if(!(!s||s.match(/^\s*[;#]/))){var c=s.match(i);if(c){if(c[1]!==void 0){if(n=Vh(c[1]),n==="__proto__"){r={};return}r=e[n]=e[n]||{};return}var l=Vh(c[2]);if(l!=="__proto__"){var f=c[3]?Vh(c[4]):!0;switch(f){case"true":case"false":case"null":f=JSON.parse(f)}if(l.length>2&&l.slice(-2)==="[]"){if(l=l.substring(0,l.length-2),l==="__proto__")return;r[l]?Array.isArray(r[l])||(r[l]=[r[l]]):r[l]=[]}Array.isArray(r[l])?r[l].push(f):r[l]=f}}}}),Object.keys(e).filter(function(s,a,u){if(!e[s]||typeof e[s]!="object"||Array.isArray(e[s]))return!1;var c=i8(s),l=e,f=c.pop(),h=f.replace(/\\\./g,".");return c.forEach(function(d,p,v){d!=="__proto__"&&((!l[d]||typeof l[d]!="object")&&(l[d]={}),l=l[d])}),l===e&&h===f?!1:(l[h]=e[s],!0)}).forEach(function(s,a,u){delete e[s]}),e}function o8(t){return t.charAt(0)==='"'&&t.slice(-1)==='"'||t.charAt(0)==="'"&&t.slice(-1)==="'"}function Ea(t){return typeof t!="string"||t.match(/[=\r\n]/)||t.match(/^\[/)||t.length>1&&o8(t)||t!==t.trim()?JSON.stringify(t):t.replace(/;/g,"\\;").replace(/#/g,"\\#")}function Vh(t,e){if(t=(t||"").trim(),o8(t)){t.charAt(0)==="'"&&(t=t.substr(1,t.length-2));try{t=JSON.parse(t)}catch{}}else{for(var r=!1,n="",i=0,o=t.length;i<o;i++){var s=t.charAt(i);if(r)"\\;#".indexOf(s)!==-1?n+=s:n+="\\"+s,r=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?r=!0:n+=s}}return r&&(n+="\\"),n.trim()}return t}});var l8=D((Nn,c8)=>{var a8=r8(),Bc=require("path"),zh=require("fs"),_b=s8(),Eb=require("events").EventEmitter,iae=require("url"),oae=require("http"),Nn=c8.exports=function(){for(var t=[].slice.call(arguments),e=new Ot;t.length;){var r=t.shift();r&&e.push(typeof r=="string"?aae(r):r)}return e},Eye=Nn.find=function(){var t=Bc.join.apply(null,[].slice.call(arguments));function e(r,n){var i=Bc.join(r,n);try{return zh.statSync(i),i}catch{if(Bc.dirname(r)!==r)return e(Bc.dirname(r),n)}}return e(__dirname,t)},sae=Nn.parse=function(t,e,r){if(t=""+t,r)if(r==="json")if(this.emit)try{return JSON.parse(t)}catch(n){this.emit("error",n)}else return JSON.parse(t);else return _b.parse(t);else try{return JSON.parse(t)}catch{return _b.parse(t)}},aae=Nn.json=function(){var t=[].slice.call(arguments).filter(function(n){return n!=null}),e=Bc.join.apply(null,t),r;try{r=zh.readFileSync(e,"utf-8")}catch{return}return sae(r,e,"json")},Cye=Nn.env=function(t,e){e=e||process.env;var r={},n=t.length;for(var i in e)i.indexOf(t)===0&&(r[i.substring(n)]=e[i]);return r};Nn.ConfigChain=Ot;function Ot(){Eb.apply(this),a8.apply(this,arguments),this._awaiting=0,this._saving=0,this.sources={}}var u8={constructor:{value:Ot}};Object.keys(Eb.prototype).forEach(function(t){u8[t]=Object.getOwnPropertyDescriptor(Eb.prototype,t)});Ot.prototype=Object.create(a8.prototype,u8);Ot.prototype.del=function(t,e){if(e){var r=this.sources[e];if(r=r&&r.data,!r)return this.emit("error",new Error("not found "+e));delete r[t]}else for(var n=0,i=this.list.length;n<i;n++)delete this.list[n][t];return this};Ot.prototype.set=function(t,e,r){var n;if(r){if(n=this.sources[r],n=n&&n.data,!n)return this.emit("error",new Error("not found "+r))}else if(n=this.list[0],!n)return this.emit("error",new Error("cannot set, no confs!"));return n[t]=e,this};Ot.prototype.get=function(t,e){return e?(e=this.sources[e],e&&(e=e.data),e&&Object.hasOwnProperty.call(e,t)?e[t]:void 0):this.list[0][t]};Ot.prototype.save=function(t,o,r){typeof o=="function"&&(r=o,o=null);var n=this.sources[t];if(!n||!(n.path||n.source)||!n.data)return this.emit("error",new Error("bad save target: "+t));if(n.source){var i=n.prefix||"";return Object.keys(n.data).forEach(function(a){n.source[i+a]=n.data[a]}),this}var o=o||n.type,s=n.data;return n.type==="json"?s=JSON.stringify(s):s=_b.stringify(s),this._saving++,zh.writeFile(n.path,s,"utf8",function(a){if(this._saving--,a)return r?r(a):this.emit("error",a);this._saving===0&&(r&&r(),this.emit("save"))}.bind(this)),this};Ot.prototype.addFile=function(t,e,r){r=r||t;var n={__source__:r};return this.sources[r]={path:t,type:e},this.push(n),this._await(),zh.readFile(t,"utf8",function(i,o){i&&this.emit("error",i),this.addString(o,t,e,n)}.bind(this)),this};Ot.prototype.addEnv=function(t,e,r){r=r||"env";var n=Nn.env(t,e);return this.sources[r]={data:n,source:e,prefix:t},this.add(n,r)};Ot.prototype.addUrl=function(t,e,r){this._await();var n=iae.format(t);r=r||n;var i={__source__:r};return this.sources[r]={href:n,type:e},this.push(i),oae.request(t,function(o){var s=[],a=o.headers["content-type"];e||(e=a.indexOf("json")!==-1?"json":a.indexOf("ini")!==-1?"ini":n.match(/\.json$/)?"json":n.match(/\.ini$/)?"ini":null,i.type=e),o.on("data",s.push.bind(s)).on("end",function(){this.addString(Buffer.concat(s),n,e,i)}.bind(this)).on("error",this.emit.bind(this,"error"))}.bind(this)).on("error",this.emit.bind(this,"error")).end(),this};Ot.prototype.addString=function(t,e,r,n){return t=this.parse(t,e,r),this.add(t,n),this};Ot.prototype.add=function(t,e){if(e&&typeof e=="object"){var r=this.list.indexOf(e);if(r===-1)return this.emit("error",new Error("bad marker"));this.splice(r,1,t),e=e.__source__,this.sources[e]=this.sources[e]||{},this.sources[e].data=t,this._resolve()}else typeof e=="string"&&(this.sources[e]=this.sources[e]||{},this.sources[e].data=t),this._await(),this.push(t),process.nextTick(this._resolve.bind(this));return this};Ot.prototype.parse=Nn.parse;Ot.prototype._await=function(){this._awaiting++};Ot.prototype._resolve=function(){this._awaiting--,this._awaiting===0&&this.emit("load",this)}});var d8=D((Sye,f8)=>{f8.exports=function(t){let e=t.indexOf(":");if(e===-1)return Cb(t);let r=t.substr(0,e),n=t.substr(e+1);return`${Cb(r)}:${Cb(n)}`};function Cb(t){if(t=t.toLowerCase(),t==="_authtoken")return"_authToken";let e=t[0];for(let r=1;r<t.length;r++)e+=t[r]==="_"?"-":t[r];return e}});var h8=D(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.envReplace=void 0;var uae=/(?<!\\)(\\*)\$\{([^${}]+)\}/g;function cae(t,e){return t.replace(uae,lae.bind(null,e))}Gh.envReplace=cae;function lae(t,e,r,n){if(r.length%2)return e.slice((r.length+1)/2);let i=dae(t,n);if(i===void 0)throw new Error(`Failed to replace env in config: ${e}`);return`${r.slice(r.length/2)}${i}`}var fae=/([^:-]+)(:?)-(.+)/;function dae(t,e){let r=e.match(fae);if(!r)return t[e];let[,n,i,o]=r;return Object.prototype.hasOwnProperty.call(t,n)?!t[n]&&i?o:t[n]:o}});var p8=D(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.envReplace=void 0;var hae=h8();Object.defineProperty(Wh,"envReplace",{enumerable:!0,get:function(){return hae.envReplace}})});var g8=D(Kh=>{"use strict";var pae=require("fs"),Oo=require("path"),{envReplace:m8}=p8(),mae=(t,e,r)=>{if(typeof e!="string")return e;let n=[].concat(t[r]),i=n.indexOf(Oo)!==-1,o=n.indexOf(Boolean)!==-1,s=n.indexOf(String)!==-1,a=n.indexOf(Number)!==-1;if(e=`${e}`.trim(),/^".*"$/.test(e))try{e=JSON.parse(e)}catch{throw new Error(`Failed parsing JSON config key ${r}: ${e}`)}if(o&&!s&&e==="")return!0;switch(e){case"true":return!0;case"false":return!1;case"null":return null;case"undefined":return}return e=m8(e,process.env),i&&((process.platform==="win32"?/^~(\/|\\)/:/^~\//).test(e)&&process.env.HOME&&(e=Oo.resolve(process.env.HOME,e.substr(2))),e=Oo.resolve(e)),a&&!isNaN(e)&&(e=Number(e)),e},gae=t=>{t=Oo.resolve(t);let e=!1;for(;Oo.basename(t)==="node_modules";)t=Oo.dirname(t),e=!0;if(e)return t;let r=(n,i)=>{let o=/^[a-zA-Z]:(\\|\/)?$/;if(n==="/"||process.platform==="win32"&&o.test(n))return i;try{let s=pae.readdirSync(n);if(s.includes("node_modules")||s.includes("package.json")||s.includes("package.json5")||s.includes("package.yaml")||s.includes("pnpm-workspace.yaml"))return n;let a=Oo.dirname(n);return a===n?i:r(a,i)}catch(s){if(n===i){if(s.code==="ENOENT")return i;throw s}return i}};return r(t,t)};Kh.envReplace=m8;Kh.findPrefix=gae;Kh.parseField=mae});var v8=D(D8=>{"use strict";var Ao=require("path"),yae=require("stream").Stream,Yh=require("url"),Dae=()=>{},vae=()=>[],y8=()=>{};D8.types={access:[null,"restricted","public"],"allow-same-version":Boolean,"always-auth":Boolean,also:[null,"dev","development"],audit:Boolean,"auth-type":["legacy","sso","saml","oauth"],"bin-links":Boolean,browser:[null,String],ca:[null,String,Array],cafile:Ao,cache:Ao,"cache-lock-stale":Number,"cache-lock-retries":Number,"cache-lock-wait":Number,"cache-max":Number,"cache-min":Number,cert:[null,String],cidr:[null,String,Array],color:["always",Boolean],depth:Number,description:Boolean,dev:Boolean,"dry-run":Boolean,editor:String,"engine-strict":Boolean,force:Boolean,"fetch-retries":Number,"fetch-retry-factor":Number,"fetch-retry-mintimeout":Number,"fetch-retry-maxtimeout":Number,git:String,"git-tag-version":Boolean,"commit-hooks":Boolean,global:Boolean,globalconfig:Ao,"global-style":Boolean,group:[Number,String],"https-proxy":[null,Yh],"user-agent":String,"ham-it-up":Boolean,heading:String,"if-present":Boolean,"ignore-prepublish":Boolean,"ignore-scripts":Boolean,"init-module":Ao,"init-author-name":String,"init-author-email":String,"init-author-url":["",Yh],"init-license":String,"init-version":y8,json:Boolean,key:[null,String],"legacy-bundling":Boolean,link:Boolean,"local-address":vae(),loglevel:["silent","error","warn","notice","http","timing","info","verbose","silly"],logstream:yae,"logs-max":Number,long:Boolean,maxsockets:Number,message:String,"metrics-registry":[null,String],"node-options":[null,String],"node-version":[null,y8],"no-proxy":[null,String,Array],offline:Boolean,"onload-script":[null,String],only:[null,"dev","development","prod","production"],optional:Boolean,"package-lock":Boolean,otp:[null,String],"package-lock-only":Boolean,parseable:Boolean,"prefer-offline":Boolean,"prefer-online":Boolean,prefix:Ao,production:Boolean,progress:Boolean,proxy:[null,!1,Yh],provenance:Boolean,"read-only":Boolean,"rebuild-bundle":Boolean,registry:[null,Yh],rollback:Boolean,save:Boolean,"save-bundle":Boolean,"save-dev":Boolean,"save-exact":Boolean,"save-optional":Boolean,"save-prefix":String,"save-prod":Boolean,scope:String,"script-shell":[null,String],"scripts-prepend-node-path":[!1,!0,"auto","warn-only"],searchopts:String,searchexclude:[null,String],searchlimit:Number,searchstaleness:Number,"send-metrics":Boolean,shell:String,shrinkwrap:Boolean,"sign-git-tag":Boolean,"sso-poll-frequency":Number,"sso-type":[null,"oauth","saml"],"strict-ssl":Boolean,tag:String,timing:Boolean,tmp:Ao,unicode:Boolean,"unsafe-perm":Boolean,usage:Boolean,user:[Number,String],userconfig:Ao,umask:Dae,version:Boolean,"tag-version-prefix":String,versions:Boolean,viewer:String,_exit:Boolean}});var E8=D((kye,_8)=>{"use strict";var{readCAFileSync:bae}=Q6(),b8=require("fs"),Sb=require("path"),{ConfigChain:wae}=l8(),_ae=d8(),w8=g8(),xb=class extends wae{constructor(e,r){super(e),this.root=e,this._parseField=w8.parseField.bind(null,r||v8())}add(e,r){try{for(let n of Object.keys(e))e[n]=this._parseField(e[n],n)}catch(n){throw n}return super.add(e,r)}addFile(e,r){r=r||e;let n={__source__:r};this.sources[r]={path:e,type:"ini"},this.push(n),this._await();try{let i=b8.readFileSync(e,"utf8");this.addString(i,e,"ini",n)}catch(i){if(i.code==="ENOENT")this.add({},n);else return`Issue while reading "${e}". ${i.message}`}}addEnv(e){e=e||process.env;let r={};return Object.keys(e).filter(n=>/^npm_config_/i.test(n)).forEach(n=>{e[n]&&(r[_ae(n.substr(11))]=e[n])}),super.addEnv("",r,"env")}loadPrefix(){let e=this.list[0];Object.defineProperty(this,"prefix",{enumerable:!0,set:n=>{let i=this.get("global");this[i?"globalPrefix":"localPrefix"]=n},get:()=>this.get("global")?this.globalPrefix:this.localPrefix}),Object.defineProperty(this,"globalPrefix",{enumerable:!0,set:n=>{this.set("prefix",n)},get:()=>Sb.resolve(this.get("prefix"))});let r;if(Object.defineProperty(this,"localPrefix",{enumerable:!0,set:n=>{r=n},get:()=>r}),Object.prototype.hasOwnProperty.call(e,"prefix"))r=Sb.resolve(e.prefix);else try{r=w8.findPrefix(process.cwd())}catch(n){throw n}return r}loadCAFile(e){if(!e)return;let r=bae(e);r&&this.set("ca",r)}loadUser(){let e=this.root;if(this.get("global"))return;if(process.env.SUDO_UID){e.user=Number(process.env.SUDO_UID);return}let r=Sb.resolve(this.get("prefix"));try{let n=b8.statSync(r);e.user=n.uid}catch(n){if(n.code==="ENOENT")return;throw n}}};_8.exports=xb});var A8=D(O8=>{"use strict";var x8=require("os"),Ln=require("path"),F8=x8.tmpdir(),Eae=process.getuid?process.getuid():process.pid,Cae=()=>!0,C8=process.platform==="win32",S8={editor:()=>process.env.EDITOR||process.env.VISUAL||(C8?"notepad.exe":"vi"),shell:()=>C8?process.env.COMSPEC||"cmd.exe":process.env.SHELL||"/bin/bash"},Sae={fromString:()=>process.umask()},Ca=x8.homedir();Ca?process.env.HOME=Ca:Ca=Ln.resolve(F8,"npm-"+Eae);var xae=process.platform==="win32"?"npm-cache":".npm",Fae=process.platform==="win32"&&process.env.APPDATA||Ca,Oae=Ln.resolve(Fae,xae),Jh,ko;Object.defineProperty(O8,"defaults",{get:function(){return Jh||(process.env.PREFIX?ko=process.env.PREFIX:process.platform==="win32"?ko=Ln.dirname(process.execPath):(ko=Ln.dirname(Ln.dirname(process.execPath)),process.env.DESTDIR&&(ko=Ln.join(process.env.DESTDIR,ko))),Jh={access:null,"allow-same-version":!1,"always-auth":!1,also:null,audit:!0,"auth-type":"legacy","bin-links":!0,browser:null,ca:null,cafile:null,cache:Oae,"cache-lock-stale":6e4,"cache-lock-retries":10,"cache-lock-wait":1e4,"cache-max":1/0,"cache-min":10,cert:null,cidr:null,color:process.env.NO_COLOR==null,depth:1/0,description:!0,dev:!1,"dry-run":!1,editor:S8.editor(),"engine-strict":!1,force:!1,"fetch-retries":2,"fetch-retry-factor":10,"fetch-retry-mintimeout":1e4,"fetch-retry-maxtimeout":6e4,git:"git","git-tag-version":!0,"commit-hooks":!0,global:!1,globalconfig:Ln.resolve(ko,"etc","npmrc"),"global-style":!1,group:process.platform==="win32"?0:process.env.SUDO_GID||process.getgid&&process.getgid(),"ham-it-up":!1,heading:"npm","if-present":!1,"ignore-prepublish":!1,"ignore-scripts":!1,"init-module":Ln.resolve(Ca,".npm-init.js"),"init-author-name":"","init-author-email":"","init-author-url":"","init-version":"1.0.0","init-license":"ISC",json:!1,key:null,"legacy-bundling":!1,link:!1,"local-address":void 0,loglevel:"notice",logstream:process.stderr,"logs-max":10,long:!1,maxsockets:50,message:"%s","metrics-registry":null,"node-options":null,offline:!1,"onload-script":!1,only:null,optional:!0,otp:null,"package-lock":!0,"package-lock-only":!1,parseable:!1,"prefer-offline":!1,"prefer-online":!1,prefix:ko,production:process.env.NODE_ENV==="production",progress:!process.env.TRAVIS&&!process.env.CI,provenance:!1,proxy:null,"https-proxy":null,"no-proxy":null,"user-agent":"npm/{npm-version} node/{node-version} {platform} {arch}","read-only":!1,"rebuild-bundle":!0,registry:"https://registry.npmjs.org/",rollback:!0,save:!0,"save-bundle":!1,"save-dev":!1,"save-exact":!1,"save-optional":!1,"save-prefix":"^","save-prod":!1,scope:"","script-shell":null,"scripts-prepend-node-path":"warn-only",searchopts:"",searchexclude:null,searchlimit:20,searchstaleness:15*60,"send-metrics":!1,shell:S8.shell(),shrinkwrap:!0,"sign-git-tag":!1,"sso-poll-frequency":500,"sso-type":"oauth","strict-ssl":!0,tag:"latest","tag-version-prefix":"v",timing:!1,tmp:F8,unicode:Cae(),"unsafe-perm":process.platform==="win32"||process.platform==="cygwin"||!(process.getuid&&process.setuid&&process.getgid&&process.setgid)||process.getuid()!==0,usage:!1,user:process.platform==="win32"?0:"nobody",userconfig:Ln.resolve(Ca,".npmrc"),umask:process.umask?process.umask():Sae.fromString("022"),version:!1,versions:!1,viewer:process.platform==="win32"?"browser":"man",_exit:!0},Jh)}})});var T8=D((Pye,Fb)=>{"use strict";var To=require("path"),Aae=E8(),k8=A8();Fb.exports=(t,e,r)=>{let n=new Aae(Object.assign({},k8.defaults,r),e);n.add(Object.assign({},t),"cli");let i=[],o=!1;if(require.resolve.paths){let c=require.resolve.paths("npm"),l;try{l=require.resolve("npm",{paths:c.slice(-1)})}catch{o=!0}l&&i.push(n.addFile(To.resolve(To.dirname(l),"..","npmrc"),"builtin"))}n.addEnv(),n.loadPrefix();let s=To.resolve(n.localPrefix,".npmrc"),a=n.get("userconfig");if(!n.get("global")&&s!==a?i.push(n.addFile(s,"project")):n.add({},"project"),n.get("workspace-prefix")&&n.get("workspace-prefix")!==s){let c=To.resolve(n.get("workspace-prefix"),".npmrc");i.push(n.addFile(c,"workspace"))}if(i.push(n.addFile(n.get("userconfig"),"user")),n.get("prefix")){let c=To.resolve(n.get("prefix"),"etc");n.root.globalconfig=To.resolve(c,"npmrc"),n.root.globalignorefile=To.resolve(c,"npmignore")}i.push(n.addFile(n.get("globalconfig"),"global")),n.loadUser();let u=n.get("cafile");return u&&n.loadCAFile(u),{config:n,warnings:i.filter(Boolean),failedToLoadBuiltInConfig:o}};Object.defineProperty(Fb.exports,"defaults",{get(){return k8.defaults},enumerable:!0})});var B8=D((Rye,L8)=>{var Ob=require("url"),P8=T8(),R8=":_authToken",$8=":_auth",I8=":username",j8=":_password";L8.exports=function(){let e,r;arguments.length>=2?(e=arguments[0],r=Object.assign({},arguments[1])):typeof arguments[0]=="string"?e=arguments[0]:r=Object.assign({},arguments[0]),r=r||{};let n=r.npmrc;return r.npmrc=(r.npmrc?{config:{get:i=>n[i]}}:P8()).config,e=e||r.npmrc.get("registry")||P8.defaults.registry,N8(e,r)||kae(r.npmrc)};function N8(t,e){let r=Ob.parse(t,!1,!0),n;for(;n!=="/"&&r.pathname!==n;){n=r.pathname||"/";let i="//"+r.host+n.replace(/\/$/,""),o=Pae(i,e.npmrc);if(o)return o;if(!e.recursive)return/\/$/.test(t)?void 0:N8(Ob.resolve(t,"."),e);r.pathname=Ob.resolve(Tae(n),"..")||"/"}}function kae(t){return t.get("_auth")?{token:Xh(t.get("_auth")),type:"Basic"}:void 0}function Tae(t){return t[t.length-1]==="/"?t:t+"/"}function Pae(t,e){let r=Rae(e.get(t+R8)||e.get(t+"/"+R8));if(r)return r;let n=e.get(t+I8)||e.get(t+"/"+I8),i=e.get(t+j8)||e.get(t+"/"+j8),o=$ae(n,i);if(o)return o;let s=Iae(e.get(t+$8)||e.get(t+"/"+$8));if(s)return s}function Xh(t){return t.replace(/^\$\{?([^}]*)\}?$/,function(e,r){return process.env[r]})}function Rae(t){return t?{token:Xh(t),type:"Bearer"}:void 0}function $ae(t,e){if(!t||!e)return;let r=Buffer.from(Xh(e),"base64").toString("utf8");return{token:Buffer.from(t+":"+r,"utf8").toString("base64"),type:"Basic",password:r,username:t}}function Iae(t){return t?{token:Xh(t),type:"Basic"}:void 0}});var jL=D((Rwe,Hn)=>{var ot=require("fs"),ow=require("os"),fr=require("path"),wL=require("crypto"),ln={fs:ot.constants,os:ow.constants},_L="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",CL=/XXXXXX/,_ue=3,SL=(ln.O_CREAT||ln.fs.O_CREAT)|(ln.O_EXCL||ln.fs.O_EXCL)|(ln.O_RDWR||ln.fs.O_RDWR),Eue=ow.platform()==="win32",Cue=ln.EBADF||ln.os.errno.EBADF,Sue=ln.ENOENT||ln.os.errno.ENOENT,xL=448,FL=384,xue="exit",Ra=[],OL=ot.rmdirSync.bind(ot),AL=!1;function Fue(t,e){return ot.rm(t,{recursive:!0},e)}function kL(t){return ot.rmSync(t,{recursive:!0})}function sw(t,e){let r=$a(t,e),n=r[0],i=r[1];try{RL(n)}catch(s){return i(s)}let o=n.tries;(function s(){try{let a=PL(n);ot.stat(a,function(u){if(!u)return o-- >0?s():i(new Error("Could not get a unique tmp filename, max tries reached "+a));i(null,a)})}catch(a){i(a)}})()}function aw(t){let e=$a(t),r=e[0];RL(r);let n=r.tries;do{let i=PL(r);try{ot.statSync(i)}catch{return i}}while(n-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function Oue(t,e){let r=$a(t,e),n=r[0],i=r[1];sw(n,function(s,a){if(s)return i(s);ot.open(a,SL,n.mode||FL,function(c,l){if(c)return i(c);if(n.discardDescriptor)return ot.close(l,function(h){return i(h,a,void 0,rw(a,-1,n,!1))});{let f=n.discardDescriptor||n.detachDescriptor;i(null,a,l,rw(a,f?-1:l,n,!1))}})})}function Aue(t){let e=$a(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,i=aw(r);var o=ot.openSync(i,SL,r.mode||FL);return r.discardDescriptor&&(ot.closeSync(o),o=void 0),{name:i,fd:o,removeCallback:rw(i,n?-1:o,r,!0)}}function kue(t,e){let r=$a(t,e),n=r[0],i=r[1];sw(n,function(s,a){if(s)return i(s);ot.mkdir(a,n.mode||xL,function(c){if(c)return i(c);i(null,a,TL(a,n,!1))})})}function Tue(t){let e=$a(t),r=e[0],n=aw(r);return ot.mkdirSync(n,r.mode||xL),{name:n,removeCallback:TL(n,r,!0)}}function Pue(t,e){let r=function(n){if(n&&!iw(n))return e(n);e()};0<=t[0]?ot.close(t[0],function(){ot.unlink(t[1],r)}):ot.unlink(t[1],r)}function Rue(t){let e=null;try{0<=t[0]&&ot.closeSync(t[0])}catch(r){if(!jue(r)&&!iw(r))throw r}finally{try{ot.unlinkSync(t[1])}catch(r){iw(r)||(e=r)}}if(e!==null)throw e}function rw(t,e,r,n){let i=wp(Rue,[e,t],n),o=wp(Pue,[e,t],n,i);return r.keep||Ra.unshift(i),n?i:o}function TL(t,e,r){let n=e.unsafeCleanup?Fue:ot.rmdir.bind(ot),i=e.unsafeCleanup?kL:OL,o=wp(i,t,r),s=wp(n,t,r,o);return e.keep||Ra.unshift(o),r?o:s}function wp(t,e,r,n){let i=!1;return function o(s){if(!i){let a=n||o,u=Ra.indexOf(a);return u>=0&&Ra.splice(u,1),i=!0,r||t===OL||t===kL?t(e):t(e,s||function(){})}}}function $ue(){if(AL)for(;Ra.length;)try{Ra[0]()}catch{}}function EL(t){let e=[],r=null;try{r=wL.randomBytes(t)}catch{r=wL.pseudoRandomBytes(t)}for(var n=0;n<t;n++)e.push(_L[r[n]%_L.length]);return e.join("")}function Iue(t){return t===null||tr(t)||!t.trim()}function tr(t){return typeof t>"u"}function $a(t,e){if(typeof t=="function")return[{},t];if(tr(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function PL(t){let e=t.tmpdir;if(!tr(t.name))return fr.join(e,t.dir,t.name);if(!tr(t.template))return fr.join(e,t.dir,t.template).replace(CL,EL(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",EL(12),t.postfix?"-"+t.postfix:""].join("");return fr.join(e,t.dir,r)}function RL(t){t.tmpdir=IL(t);let e=t.tmpdir;if(tr(t.name)||tw(t.name,"name",e),tr(t.dir)||tw(t.dir,"dir",e),!tr(t.template)&&(tw(t.template,"template",e),!t.template.match(CL)))throw new Error(`Invalid template, found "${t.template}".`);if(!tr(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=tr(t.name)?t.tries||_ue:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.dir=tr(t.dir)?"":fr.relative(e,nw(t.dir,e)),t.template=tr(t.template)?void 0:fr.relative(e,nw(t.template,e)),t.template=Iue(t.template)?void 0:fr.relative(t.dir,t.template),t.name=tr(t.name)?void 0:t.name,t.prefix=tr(t.prefix)?"":t.prefix,t.postfix=tr(t.postfix)?"":t.postfix}function nw(t,e){return t.startsWith(e)?fr.resolve(t):fr.resolve(fr.join(e,t))}function tw(t,e,r){if(e==="name"){if(fr.isAbsolute(t))throw new Error(`${e} option must not contain an absolute path, found "${t}".`);let n=fr.basename(t);if(n===".."||n==="."||n!==t)throw new Error(`${e} option must not contain a path, found "${t}".`)}else{if(fr.isAbsolute(t)&&!t.startsWith(r))throw new Error(`${e} option must be relative to "${r}", found "${t}".`);let n=nw(t,r);if(!n.startsWith(r))throw new Error(`${e} option must be relative to "${r}", found "${n}".`)}}function jue(t){return $L(t,-Cue,"EBADF")}function iw(t){return $L(t,-Sue,"ENOENT")}function $L(t,e,r){return Eue?t.code===r:t.code===r&&t.errno===e}function Nue(){AL=!0}function IL(t){return fr.resolve(t&&t.tmpdir||ow.tmpdir())}process.addListener(xue,$ue);Object.defineProperty(Hn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return IL()}});Hn.exports.dir=kue;Hn.exports.dirSync=Tue;Hn.exports.file=Oue;Hn.exports.fileSync=Aue;Hn.exports.tmpName=sw;Hn.exports.tmpNameSync=aw;Hn.exports.setGracefulCleanup=Nue});var Ow=ce(Fw(),1),{program:k,createCommand:mce,createArgument:gce,createOption:yce,CommanderError:Dce,InvalidArgumentError:vce,InvalidOptionArgumentError:bce,Command:wce,Argument:_ce,Option:Ece,Help:Cce}=Ow.default;var Ir={name:"@capgo/cli",version:"4.29.0",description:"A CLI to upload to capgo servers",author:"github.com/riderx",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLIl#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli"],main:"dist/index.js",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js",test:"npx --yes ts-node -T src/index.ts","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",test_rls:"ts-node ./test/test_headers_rls.ts",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js"},devDependencies:{"@antfu/eslint-config":"^3.9.2","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client","@capacitor/cli":"^6.2.0","@capgo/find-package-manager":"^0.0.17","@clack/prompts":"^0.9.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver","@supabase/supabase-js":"^2.46.0","@tomasklaen/checksum":"^1.1.0","@types/adm-zip":"^0.5.6","@types/node":"^22.8.4","@types/prettyjson":"^0.0.33","@types/semver":"7.5.8","@types/tmp":"^0.2.6","@typescript-eslint/eslint-plugin":"^8.15.0","@typescript-eslint/parser":"^8.15.0","@vercel/ncc":"^0.38.3","adm-zip":"^0.5.16","ci-info":"^4.1.0",commander:"12.1.0",esbuild:"^0.24.0",eslint:"9.17.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",ky:"^1.7.2","latest-version":"^9.0.0",open:"^10.1.0",pkg:"5.8.1",prettyjson:"^1.2.5",semver:"^7.6.3",tmp:"^0.2.3","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"4.2.0","tus-js-client":"^4.2.3",typescript:"5.7.2"}};var Sa=require("node:fs"),U8=require("node:process");var Et=ce(Te(),1),Bo=require("node:process"),Gn=ce(require("node:readline"),1),Wp=ce(require("node:readline"),1),Bw=require("node:tty"),al=ce(Vp(),1);function xB({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var FB=xB();function qw(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(FB,"")}function Mw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Uw={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var i=n.charCodeAt(0),o=n.length==2?n.charCodeAt(1):0,s=i;return 55296<=i&&i<=56319&&56320<=o&&o<=57343&&(i&=1023,o&=1023,s=i<<10|o,s+=65536),s==12288||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":s==8361||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||s==172||s==175||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":s==161||s==164||167<=s&&s<=168||s==170||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||s==198||s==208||215<=s&&s<=216||222<=s&&s<=225||s==230||232<=s&&s<=234||236<=s&&s<=237||s==240||242<=s&&s<=243||247<=s&&s<=250||s==252||s==254||s==257||s==273||s==275||s==283||294<=s&&s<=295||s==299||305<=s&&s<=307||s==312||319<=s&&s<=322||s==324||328<=s&&s<=331||s==333||338<=s&&s<=339||358<=s&&s<=359||s==363||s==462||s==464||s==466||s==468||s==470||s==472||s==474||s==476||s==593||s==609||s==708||s==711||713<=s&&s<=715||s==717||s==720||728<=s&&s<=731||s==733||s==735||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||s==1025||1040<=s&&s<=1103||s==1105||s==8208||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||s==8240||8242<=s&&s<=8243||s==8245||s==8251||s==8254||s==8308||s==8319||8321<=s&&s<=8324||s==8364||s==8451||s==8453||s==8457||s==8467||s==8470||8481<=s&&s<=8482||s==8486||s==8491||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||s==8585||8592<=s&&s<=8601||8632<=s&&s<=8633||s==8658||s==8660||s==8679||s==8704||8706<=s&&s<=8707||8711<=s&&s<=8712||s==8715||s==8719||s==8721||s==8725||s==8730||8733<=s&&s<=8736||s==8739||s==8741||8743<=s&&s<=8748||s==8750||8756<=s&&s<=8759||8764<=s&&s<=8765||s==8776||s==8780||s==8786||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||s==8853||s==8857||s==8869||s==8895||s==8978||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||s==9675||9678<=s&&s<=9681||9698<=s&&s<=9701||s==9711||9733<=s&&s<=9734||s==9737||9742<=s&&s<=9743||9748<=s&&s<=9749||s==9756||s==9758||s==9792||s==9794||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||s==9839||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||s==9955||9960<=s&&s<=9983||s==10045||s==10071||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||s==65533||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"},e.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var i=r(n),o=0,s=0;s<i.length;s++)o=o+this.characterLength(i[s]);return o},e.slice=function(n,i,o){textLen=e.length(n),i=i||0,o=o||1,i<0&&(i=textLen+i),o<0&&(o=textLen+o);for(var s="",a=0,u=r(n),c=0;c<u.length;c++){var l=u[c],f=e.length(l);if(a>=i-(f==2?1:0))if(a+f<=o)s+=l;else break;a+=f}return s}})(Uw);var OB=Uw.exports,AB=Mw(OB),kB=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},TB=Mw(kB);function La(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=qw(t),t.length===0))return 0;t=t.replace(TB()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let o=i.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(AB.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var zp=10,Pw=(t=0)=>e=>`\x1B[${e+t}m`,Rw=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,$w=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,$e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys($e.modifier);var PB=Object.keys($e.color),RB=Object.keys($e.bgColor);[...PB,...RB];function $B(){let t=new Map;for(let[e,r]of Object.entries($e)){for(let[n,i]of Object.entries(r))$e[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=$e[n],t.set(i[0],i[1]);Object.defineProperty($e,e,{value:r,enumerable:!1})}return Object.defineProperty($e,"codes",{value:t,enumerable:!1}),$e.color.close="\x1B[39m",$e.bgColor.close="\x1B[49m",$e.color.ansi=Pw(),$e.color.ansi256=Rw(),$e.color.ansi16m=$w(),$e.bgColor.ansi=Pw(zp),$e.bgColor.ansi256=Rw(zp),$e.bgColor.ansi16m=$w(zp),Object.defineProperties($e,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>$e.rgbToAnsi256(...$e.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,i;if(e>=232)r=((e-232)*10+8)/255,n=r,i=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>$e.ansi256ToAnsi($e.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>$e.ansi256ToAnsi($e.hexToAnsi256(e)),enumerable:!1}}),$e}var IB=$B(),dl=new Set(["\x1B","\x9B"]),jB=39,Yp="\x07",Hw="[",NB="]",Vw="m",Jp=`${NB}8;;`,Iw=t=>`${dl.values().next().value}${Hw}${t}${Vw}`,jw=t=>`${dl.values().next().value}${Jp}${t}${Yp}`,LB=t=>t.split(" ").map(e=>La(e)),Gp=(t,e,r)=>{let n=[...e],i=!1,o=!1,s=La(qw(t[t.length-1]));for(let[a,u]of n.entries()){let c=La(u);if(s+c<=r?t[t.length-1]+=u:(t.push(u),s=0),dl.has(u)&&(i=!0,o=n.slice(a+1).join("").startsWith(Jp)),i){o?u===Yp&&(i=!1,o=!1):u===Vw&&(i=!1);continue}s+=c,s===r&&a<n.length-1&&(t.push(""),s=0)}!s&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},BB=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(La(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},qB=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,o,s=LB(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let f=La(a[a.length-1]);if(c!==0&&(f>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),f=0),(f>0||r.trim===!1)&&(a[a.length-1]+=" ",f++)),r.hard&&s[c]>e){let h=e-f,d=1+Math.floor((s[c]-h-1)/e);Math.floor((s[c]-1)/e)<d&&a.push(""),Gp(a,l,e);continue}if(f+s[c]>e&&f>0&&s[c]>0){if(r.wordWrap===!1&&f<e){Gp(a,l,e);continue}a.push("")}if(f+s[c]>e&&r.wordWrap===!1){Gp(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>BB(c)));let u=[...a.join(`
200
+ `}):u&&typeof u=="object"?r.push(o):n+=Ea(o)+i+Ea(u)+wb}),e.section&&n.length&&(n="["+Ea(e.section)+"]"+wb+n),r.forEach(function(o,s,a){var u=i8(o).join("\\."),c=(e.section?e.section+".":"")+u,l=n8(t[o],{section:c,whitespace:e.whitespace});n.length&&l.length&&(n+=wb),n+=l}),n}function i8(t){return t.replace(/\1/g,"LITERAL\\1LITERAL").replace(/\\\./g,"").split(/\./).map(function(e){return e.replace(/\1/g,"\\.").replace(/\2LITERAL\\1LITERAL\2/g,"")})}function nae(t){var e={},r=e,n=null,i=/^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i,o=t.split(/[\r\n]+/g);return o.forEach(function(s,a,u){if(!(!s||s.match(/^\s*[;#]/))){var c=s.match(i);if(c){if(c[1]!==void 0){if(n=Vh(c[1]),n==="__proto__"){r={};return}r=e[n]=e[n]||{};return}var l=Vh(c[2]);if(l!=="__proto__"){var f=c[3]?Vh(c[4]):!0;switch(f){case"true":case"false":case"null":f=JSON.parse(f)}if(l.length>2&&l.slice(-2)==="[]"){if(l=l.substring(0,l.length-2),l==="__proto__")return;r[l]?Array.isArray(r[l])||(r[l]=[r[l]]):r[l]=[]}Array.isArray(r[l])?r[l].push(f):r[l]=f}}}}),Object.keys(e).filter(function(s,a,u){if(!e[s]||typeof e[s]!="object"||Array.isArray(e[s]))return!1;var c=i8(s),l=e,f=c.pop(),h=f.replace(/\\\./g,".");return c.forEach(function(d,p,v){d!=="__proto__"&&((!l[d]||typeof l[d]!="object")&&(l[d]={}),l=l[d])}),l===e&&h===f?!1:(l[h]=e[s],!0)}).forEach(function(s,a,u){delete e[s]}),e}function o8(t){return t.charAt(0)==='"'&&t.slice(-1)==='"'||t.charAt(0)==="'"&&t.slice(-1)==="'"}function Ea(t){return typeof t!="string"||t.match(/[=\r\n]/)||t.match(/^\[/)||t.length>1&&o8(t)||t!==t.trim()?JSON.stringify(t):t.replace(/;/g,"\\;").replace(/#/g,"\\#")}function Vh(t,e){if(t=(t||"").trim(),o8(t)){t.charAt(0)==="'"&&(t=t.substr(1,t.length-2));try{t=JSON.parse(t)}catch{}}else{for(var r=!1,n="",i=0,o=t.length;i<o;i++){var s=t.charAt(i);if(r)"\\;#".indexOf(s)!==-1?n+=s:n+="\\"+s,r=!1;else{if(";#".indexOf(s)!==-1)break;s==="\\"?r=!0:n+=s}}return r&&(n+="\\"),n.trim()}return t}});var l8=D((Nn,c8)=>{var a8=r8(),Bc=require("path"),zh=require("fs"),_b=s8(),Eb=require("events").EventEmitter,iae=require("url"),oae=require("http"),Nn=c8.exports=function(){for(var t=[].slice.call(arguments),e=new Ot;t.length;){var r=t.shift();r&&e.push(typeof r=="string"?aae(r):r)}return e},Eye=Nn.find=function(){var t=Bc.join.apply(null,[].slice.call(arguments));function e(r,n){var i=Bc.join(r,n);try{return zh.statSync(i),i}catch{if(Bc.dirname(r)!==r)return e(Bc.dirname(r),n)}}return e(__dirname,t)},sae=Nn.parse=function(t,e,r){if(t=""+t,r)if(r==="json")if(this.emit)try{return JSON.parse(t)}catch(n){this.emit("error",n)}else return JSON.parse(t);else return _b.parse(t);else try{return JSON.parse(t)}catch{return _b.parse(t)}},aae=Nn.json=function(){var t=[].slice.call(arguments).filter(function(n){return n!=null}),e=Bc.join.apply(null,t),r;try{r=zh.readFileSync(e,"utf-8")}catch{return}return sae(r,e,"json")},Cye=Nn.env=function(t,e){e=e||process.env;var r={},n=t.length;for(var i in e)i.indexOf(t)===0&&(r[i.substring(n)]=e[i]);return r};Nn.ConfigChain=Ot;function Ot(){Eb.apply(this),a8.apply(this,arguments),this._awaiting=0,this._saving=0,this.sources={}}var u8={constructor:{value:Ot}};Object.keys(Eb.prototype).forEach(function(t){u8[t]=Object.getOwnPropertyDescriptor(Eb.prototype,t)});Ot.prototype=Object.create(a8.prototype,u8);Ot.prototype.del=function(t,e){if(e){var r=this.sources[e];if(r=r&&r.data,!r)return this.emit("error",new Error("not found "+e));delete r[t]}else for(var n=0,i=this.list.length;n<i;n++)delete this.list[n][t];return this};Ot.prototype.set=function(t,e,r){var n;if(r){if(n=this.sources[r],n=n&&n.data,!n)return this.emit("error",new Error("not found "+r))}else if(n=this.list[0],!n)return this.emit("error",new Error("cannot set, no confs!"));return n[t]=e,this};Ot.prototype.get=function(t,e){return e?(e=this.sources[e],e&&(e=e.data),e&&Object.hasOwnProperty.call(e,t)?e[t]:void 0):this.list[0][t]};Ot.prototype.save=function(t,o,r){typeof o=="function"&&(r=o,o=null);var n=this.sources[t];if(!n||!(n.path||n.source)||!n.data)return this.emit("error",new Error("bad save target: "+t));if(n.source){var i=n.prefix||"";return Object.keys(n.data).forEach(function(a){n.source[i+a]=n.data[a]}),this}var o=o||n.type,s=n.data;return n.type==="json"?s=JSON.stringify(s):s=_b.stringify(s),this._saving++,zh.writeFile(n.path,s,"utf8",function(a){if(this._saving--,a)return r?r(a):this.emit("error",a);this._saving===0&&(r&&r(),this.emit("save"))}.bind(this)),this};Ot.prototype.addFile=function(t,e,r){r=r||t;var n={__source__:r};return this.sources[r]={path:t,type:e},this.push(n),this._await(),zh.readFile(t,"utf8",function(i,o){i&&this.emit("error",i),this.addString(o,t,e,n)}.bind(this)),this};Ot.prototype.addEnv=function(t,e,r){r=r||"env";var n=Nn.env(t,e);return this.sources[r]={data:n,source:e,prefix:t},this.add(n,r)};Ot.prototype.addUrl=function(t,e,r){this._await();var n=iae.format(t);r=r||n;var i={__source__:r};return this.sources[r]={href:n,type:e},this.push(i),oae.request(t,function(o){var s=[],a=o.headers["content-type"];e||(e=a.indexOf("json")!==-1?"json":a.indexOf("ini")!==-1?"ini":n.match(/\.json$/)?"json":n.match(/\.ini$/)?"ini":null,i.type=e),o.on("data",s.push.bind(s)).on("end",function(){this.addString(Buffer.concat(s),n,e,i)}.bind(this)).on("error",this.emit.bind(this,"error"))}.bind(this)).on("error",this.emit.bind(this,"error")).end(),this};Ot.prototype.addString=function(t,e,r,n){return t=this.parse(t,e,r),this.add(t,n),this};Ot.prototype.add=function(t,e){if(e&&typeof e=="object"){var r=this.list.indexOf(e);if(r===-1)return this.emit("error",new Error("bad marker"));this.splice(r,1,t),e=e.__source__,this.sources[e]=this.sources[e]||{},this.sources[e].data=t,this._resolve()}else typeof e=="string"&&(this.sources[e]=this.sources[e]||{},this.sources[e].data=t),this._await(),this.push(t),process.nextTick(this._resolve.bind(this));return this};Ot.prototype.parse=Nn.parse;Ot.prototype._await=function(){this._awaiting++};Ot.prototype._resolve=function(){this._awaiting--,this._awaiting===0&&this.emit("load",this)}});var d8=D((Sye,f8)=>{f8.exports=function(t){let e=t.indexOf(":");if(e===-1)return Cb(t);let r=t.substr(0,e),n=t.substr(e+1);return`${Cb(r)}:${Cb(n)}`};function Cb(t){if(t=t.toLowerCase(),t==="_authtoken")return"_authToken";let e=t[0];for(let r=1;r<t.length;r++)e+=t[r]==="_"?"-":t[r];return e}});var h8=D(Gh=>{"use strict";Object.defineProperty(Gh,"__esModule",{value:!0});Gh.envReplace=void 0;var uae=/(?<!\\)(\\*)\$\{([^${}]+)\}/g;function cae(t,e){return t.replace(uae,lae.bind(null,e))}Gh.envReplace=cae;function lae(t,e,r,n){if(r.length%2)return e.slice((r.length+1)/2);let i=dae(t,n);if(i===void 0)throw new Error(`Failed to replace env in config: ${e}`);return`${r.slice(r.length/2)}${i}`}var fae=/([^:-]+)(:?)-(.+)/;function dae(t,e){let r=e.match(fae);if(!r)return t[e];let[,n,i,o]=r;return Object.prototype.hasOwnProperty.call(t,n)?!t[n]&&i?o:t[n]:o}});var p8=D(Wh=>{"use strict";Object.defineProperty(Wh,"__esModule",{value:!0});Wh.envReplace=void 0;var hae=h8();Object.defineProperty(Wh,"envReplace",{enumerable:!0,get:function(){return hae.envReplace}})});var g8=D(Kh=>{"use strict";var pae=require("fs"),Oo=require("path"),{envReplace:m8}=p8(),mae=(t,e,r)=>{if(typeof e!="string")return e;let n=[].concat(t[r]),i=n.indexOf(Oo)!==-1,o=n.indexOf(Boolean)!==-1,s=n.indexOf(String)!==-1,a=n.indexOf(Number)!==-1;if(e=`${e}`.trim(),/^".*"$/.test(e))try{e=JSON.parse(e)}catch{throw new Error(`Failed parsing JSON config key ${r}: ${e}`)}if(o&&!s&&e==="")return!0;switch(e){case"true":return!0;case"false":return!1;case"null":return null;case"undefined":return}return e=m8(e,process.env),i&&((process.platform==="win32"?/^~(\/|\\)/:/^~\//).test(e)&&process.env.HOME&&(e=Oo.resolve(process.env.HOME,e.substr(2))),e=Oo.resolve(e)),a&&!isNaN(e)&&(e=Number(e)),e},gae=t=>{t=Oo.resolve(t);let e=!1;for(;Oo.basename(t)==="node_modules";)t=Oo.dirname(t),e=!0;if(e)return t;let r=(n,i)=>{let o=/^[a-zA-Z]:(\\|\/)?$/;if(n==="/"||process.platform==="win32"&&o.test(n))return i;try{let s=pae.readdirSync(n);if(s.includes("node_modules")||s.includes("package.json")||s.includes("package.json5")||s.includes("package.yaml")||s.includes("pnpm-workspace.yaml"))return n;let a=Oo.dirname(n);return a===n?i:r(a,i)}catch(s){if(n===i){if(s.code==="ENOENT")return i;throw s}return i}};return r(t,t)};Kh.envReplace=m8;Kh.findPrefix=gae;Kh.parseField=mae});var v8=D(D8=>{"use strict";var Ao=require("path"),yae=require("stream").Stream,Yh=require("url"),Dae=()=>{},vae=()=>[],y8=()=>{};D8.types={access:[null,"restricted","public"],"allow-same-version":Boolean,"always-auth":Boolean,also:[null,"dev","development"],audit:Boolean,"auth-type":["legacy","sso","saml","oauth"],"bin-links":Boolean,browser:[null,String],ca:[null,String,Array],cafile:Ao,cache:Ao,"cache-lock-stale":Number,"cache-lock-retries":Number,"cache-lock-wait":Number,"cache-max":Number,"cache-min":Number,cert:[null,String],cidr:[null,String,Array],color:["always",Boolean],depth:Number,description:Boolean,dev:Boolean,"dry-run":Boolean,editor:String,"engine-strict":Boolean,force:Boolean,"fetch-retries":Number,"fetch-retry-factor":Number,"fetch-retry-mintimeout":Number,"fetch-retry-maxtimeout":Number,git:String,"git-tag-version":Boolean,"commit-hooks":Boolean,global:Boolean,globalconfig:Ao,"global-style":Boolean,group:[Number,String],"https-proxy":[null,Yh],"user-agent":String,"ham-it-up":Boolean,heading:String,"if-present":Boolean,"ignore-prepublish":Boolean,"ignore-scripts":Boolean,"init-module":Ao,"init-author-name":String,"init-author-email":String,"init-author-url":["",Yh],"init-license":String,"init-version":y8,json:Boolean,key:[null,String],"legacy-bundling":Boolean,link:Boolean,"local-address":vae(),loglevel:["silent","error","warn","notice","http","timing","info","verbose","silly"],logstream:yae,"logs-max":Number,long:Boolean,maxsockets:Number,message:String,"metrics-registry":[null,String],"node-options":[null,String],"node-version":[null,y8],"no-proxy":[null,String,Array],offline:Boolean,"onload-script":[null,String],only:[null,"dev","development","prod","production"],optional:Boolean,"package-lock":Boolean,otp:[null,String],"package-lock-only":Boolean,parseable:Boolean,"prefer-offline":Boolean,"prefer-online":Boolean,prefix:Ao,production:Boolean,progress:Boolean,proxy:[null,!1,Yh],provenance:Boolean,"read-only":Boolean,"rebuild-bundle":Boolean,registry:[null,Yh],rollback:Boolean,save:Boolean,"save-bundle":Boolean,"save-dev":Boolean,"save-exact":Boolean,"save-optional":Boolean,"save-prefix":String,"save-prod":Boolean,scope:String,"script-shell":[null,String],"scripts-prepend-node-path":[!1,!0,"auto","warn-only"],searchopts:String,searchexclude:[null,String],searchlimit:Number,searchstaleness:Number,"send-metrics":Boolean,shell:String,shrinkwrap:Boolean,"sign-git-tag":Boolean,"sso-poll-frequency":Number,"sso-type":[null,"oauth","saml"],"strict-ssl":Boolean,tag:String,timing:Boolean,tmp:Ao,unicode:Boolean,"unsafe-perm":Boolean,usage:Boolean,user:[Number,String],userconfig:Ao,umask:Dae,version:Boolean,"tag-version-prefix":String,versions:Boolean,viewer:String,_exit:Boolean}});var E8=D((kye,_8)=>{"use strict";var{readCAFileSync:bae}=Qj(),b8=require("fs"),Sb=require("path"),{ConfigChain:wae}=l8(),_ae=d8(),w8=g8(),xb=class extends wae{constructor(e,r){super(e),this.root=e,this._parseField=w8.parseField.bind(null,r||v8())}add(e,r){try{for(let n of Object.keys(e))e[n]=this._parseField(e[n],n)}catch(n){throw n}return super.add(e,r)}addFile(e,r){r=r||e;let n={__source__:r};this.sources[r]={path:e,type:"ini"},this.push(n),this._await();try{let i=b8.readFileSync(e,"utf8");this.addString(i,e,"ini",n)}catch(i){if(i.code==="ENOENT")this.add({},n);else return`Issue while reading "${e}". ${i.message}`}}addEnv(e){e=e||process.env;let r={};return Object.keys(e).filter(n=>/^npm_config_/i.test(n)).forEach(n=>{e[n]&&(r[_ae(n.substr(11))]=e[n])}),super.addEnv("",r,"env")}loadPrefix(){let e=this.list[0];Object.defineProperty(this,"prefix",{enumerable:!0,set:n=>{let i=this.get("global");this[i?"globalPrefix":"localPrefix"]=n},get:()=>this.get("global")?this.globalPrefix:this.localPrefix}),Object.defineProperty(this,"globalPrefix",{enumerable:!0,set:n=>{this.set("prefix",n)},get:()=>Sb.resolve(this.get("prefix"))});let r;if(Object.defineProperty(this,"localPrefix",{enumerable:!0,set:n=>{r=n},get:()=>r}),Object.prototype.hasOwnProperty.call(e,"prefix"))r=Sb.resolve(e.prefix);else try{r=w8.findPrefix(process.cwd())}catch(n){throw n}return r}loadCAFile(e){if(!e)return;let r=bae(e);r&&this.set("ca",r)}loadUser(){let e=this.root;if(this.get("global"))return;if(process.env.SUDO_UID){e.user=Number(process.env.SUDO_UID);return}let r=Sb.resolve(this.get("prefix"));try{let n=b8.statSync(r);e.user=n.uid}catch(n){if(n.code==="ENOENT")return;throw n}}};_8.exports=xb});var A8=D(O8=>{"use strict";var x8=require("os"),Ln=require("path"),F8=x8.tmpdir(),Eae=process.getuid?process.getuid():process.pid,Cae=()=>!0,C8=process.platform==="win32",S8={editor:()=>process.env.EDITOR||process.env.VISUAL||(C8?"notepad.exe":"vi"),shell:()=>C8?process.env.COMSPEC||"cmd.exe":process.env.SHELL||"/bin/bash"},Sae={fromString:()=>process.umask()},Ca=x8.homedir();Ca?process.env.HOME=Ca:Ca=Ln.resolve(F8,"npm-"+Eae);var xae=process.platform==="win32"?"npm-cache":".npm",Fae=process.platform==="win32"&&process.env.APPDATA||Ca,Oae=Ln.resolve(Fae,xae),Jh,ko;Object.defineProperty(O8,"defaults",{get:function(){return Jh||(process.env.PREFIX?ko=process.env.PREFIX:process.platform==="win32"?ko=Ln.dirname(process.execPath):(ko=Ln.dirname(Ln.dirname(process.execPath)),process.env.DESTDIR&&(ko=Ln.join(process.env.DESTDIR,ko))),Jh={access:null,"allow-same-version":!1,"always-auth":!1,also:null,audit:!0,"auth-type":"legacy","bin-links":!0,browser:null,ca:null,cafile:null,cache:Oae,"cache-lock-stale":6e4,"cache-lock-retries":10,"cache-lock-wait":1e4,"cache-max":1/0,"cache-min":10,cert:null,cidr:null,color:process.env.NO_COLOR==null,depth:1/0,description:!0,dev:!1,"dry-run":!1,editor:S8.editor(),"engine-strict":!1,force:!1,"fetch-retries":2,"fetch-retry-factor":10,"fetch-retry-mintimeout":1e4,"fetch-retry-maxtimeout":6e4,git:"git","git-tag-version":!0,"commit-hooks":!0,global:!1,globalconfig:Ln.resolve(ko,"etc","npmrc"),"global-style":!1,group:process.platform==="win32"?0:process.env.SUDO_GID||process.getgid&&process.getgid(),"ham-it-up":!1,heading:"npm","if-present":!1,"ignore-prepublish":!1,"ignore-scripts":!1,"init-module":Ln.resolve(Ca,".npm-init.js"),"init-author-name":"","init-author-email":"","init-author-url":"","init-version":"1.0.0","init-license":"ISC",json:!1,key:null,"legacy-bundling":!1,link:!1,"local-address":void 0,loglevel:"notice",logstream:process.stderr,"logs-max":10,long:!1,maxsockets:50,message:"%s","metrics-registry":null,"node-options":null,offline:!1,"onload-script":!1,only:null,optional:!0,otp:null,"package-lock":!0,"package-lock-only":!1,parseable:!1,"prefer-offline":!1,"prefer-online":!1,prefix:ko,production:process.env.NODE_ENV==="production",progress:!process.env.TRAVIS&&!process.env.CI,provenance:!1,proxy:null,"https-proxy":null,"no-proxy":null,"user-agent":"npm/{npm-version} node/{node-version} {platform} {arch}","read-only":!1,"rebuild-bundle":!0,registry:"https://registry.npmjs.org/",rollback:!0,save:!0,"save-bundle":!1,"save-dev":!1,"save-exact":!1,"save-optional":!1,"save-prefix":"^","save-prod":!1,scope:"","script-shell":null,"scripts-prepend-node-path":"warn-only",searchopts:"",searchexclude:null,searchlimit:20,searchstaleness:15*60,"send-metrics":!1,shell:S8.shell(),shrinkwrap:!0,"sign-git-tag":!1,"sso-poll-frequency":500,"sso-type":"oauth","strict-ssl":!0,tag:"latest","tag-version-prefix":"v",timing:!1,tmp:F8,unicode:Cae(),"unsafe-perm":process.platform==="win32"||process.platform==="cygwin"||!(process.getuid&&process.setuid&&process.getgid&&process.setgid)||process.getuid()!==0,usage:!1,user:process.platform==="win32"?0:"nobody",userconfig:Ln.resolve(Ca,".npmrc"),umask:process.umask?process.umask():Sae.fromString("022"),version:!1,versions:!1,viewer:process.platform==="win32"?"browser":"man",_exit:!0},Jh)}})});var T8=D((Pye,Fb)=>{"use strict";var To=require("path"),Aae=E8(),k8=A8();Fb.exports=(t,e,r)=>{let n=new Aae(Object.assign({},k8.defaults,r),e);n.add(Object.assign({},t),"cli");let i=[],o=!1;if(require.resolve.paths){let c=require.resolve.paths("npm"),l;try{l=require.resolve("npm",{paths:c.slice(-1)})}catch{o=!0}l&&i.push(n.addFile(To.resolve(To.dirname(l),"..","npmrc"),"builtin"))}n.addEnv(),n.loadPrefix();let s=To.resolve(n.localPrefix,".npmrc"),a=n.get("userconfig");if(!n.get("global")&&s!==a?i.push(n.addFile(s,"project")):n.add({},"project"),n.get("workspace-prefix")&&n.get("workspace-prefix")!==s){let c=To.resolve(n.get("workspace-prefix"),".npmrc");i.push(n.addFile(c,"workspace"))}if(i.push(n.addFile(n.get("userconfig"),"user")),n.get("prefix")){let c=To.resolve(n.get("prefix"),"etc");n.root.globalconfig=To.resolve(c,"npmrc"),n.root.globalignorefile=To.resolve(c,"npmignore")}i.push(n.addFile(n.get("globalconfig"),"global")),n.loadUser();let u=n.get("cafile");return u&&n.loadCAFile(u),{config:n,warnings:i.filter(Boolean),failedToLoadBuiltInConfig:o}};Object.defineProperty(Fb.exports,"defaults",{get(){return k8.defaults},enumerable:!0})});var B8=D((Rye,L8)=>{var Ob=require("url"),P8=T8(),R8=":_authToken",$8=":_auth",I8=":username",j8=":_password";L8.exports=function(){let e,r;arguments.length>=2?(e=arguments[0],r=Object.assign({},arguments[1])):typeof arguments[0]=="string"?e=arguments[0]:r=Object.assign({},arguments[0]),r=r||{};let n=r.npmrc;return r.npmrc=(r.npmrc?{config:{get:i=>n[i]}}:P8()).config,e=e||r.npmrc.get("registry")||P8.defaults.registry,N8(e,r)||kae(r.npmrc)};function N8(t,e){let r=Ob.parse(t,!1,!0),n;for(;n!=="/"&&r.pathname!==n;){n=r.pathname||"/";let i="//"+r.host+n.replace(/\/$/,""),o=Pae(i,e.npmrc);if(o)return o;if(!e.recursive)return/\/$/.test(t)?void 0:N8(Ob.resolve(t,"."),e);r.pathname=Ob.resolve(Tae(n),"..")||"/"}}function kae(t){return t.get("_auth")?{token:Xh(t.get("_auth")),type:"Basic"}:void 0}function Tae(t){return t[t.length-1]==="/"?t:t+"/"}function Pae(t,e){let r=Rae(e.get(t+R8)||e.get(t+"/"+R8));if(r)return r;let n=e.get(t+I8)||e.get(t+"/"+I8),i=e.get(t+j8)||e.get(t+"/"+j8),o=$ae(n,i);if(o)return o;let s=Iae(e.get(t+$8)||e.get(t+"/"+$8));if(s)return s}function Xh(t){return t.replace(/^\$\{?([^}]*)\}?$/,function(e,r){return process.env[r]})}function Rae(t){return t?{token:Xh(t),type:"Bearer"}:void 0}function $ae(t,e){if(!t||!e)return;let r=Buffer.from(Xh(e),"base64").toString("utf8");return{token:Buffer.from(t+":"+r,"utf8").toString("base64"),type:"Basic",password:r,username:t}}function Iae(t){return t?{token:Xh(t),type:"Basic"}:void 0}});var jL=D((Rwe,Hn)=>{var ot=require("fs"),ow=require("os"),fr=require("path"),wL=require("crypto"),ln={fs:ot.constants,os:ow.constants},_L="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",CL=/XXXXXX/,_ue=3,SL=(ln.O_CREAT||ln.fs.O_CREAT)|(ln.O_EXCL||ln.fs.O_EXCL)|(ln.O_RDWR||ln.fs.O_RDWR),Eue=ow.platform()==="win32",Cue=ln.EBADF||ln.os.errno.EBADF,Sue=ln.ENOENT||ln.os.errno.ENOENT,xL=448,FL=384,xue="exit",Ra=[],OL=ot.rmdirSync.bind(ot),AL=!1;function Fue(t,e){return ot.rm(t,{recursive:!0},e)}function kL(t){return ot.rmSync(t,{recursive:!0})}function sw(t,e){let r=$a(t,e),n=r[0],i=r[1];try{RL(n)}catch(s){return i(s)}let o=n.tries;(function s(){try{let a=PL(n);ot.stat(a,function(u){if(!u)return o-- >0?s():i(new Error("Could not get a unique tmp filename, max tries reached "+a));i(null,a)})}catch(a){i(a)}})()}function aw(t){let e=$a(t),r=e[0];RL(r);let n=r.tries;do{let i=PL(r);try{ot.statSync(i)}catch{return i}}while(n-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function Oue(t,e){let r=$a(t,e),n=r[0],i=r[1];sw(n,function(s,a){if(s)return i(s);ot.open(a,SL,n.mode||FL,function(c,l){if(c)return i(c);if(n.discardDescriptor)return ot.close(l,function(h){return i(h,a,void 0,rw(a,-1,n,!1))});{let f=n.discardDescriptor||n.detachDescriptor;i(null,a,l,rw(a,f?-1:l,n,!1))}})})}function Aue(t){let e=$a(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,i=aw(r);var o=ot.openSync(i,SL,r.mode||FL);return r.discardDescriptor&&(ot.closeSync(o),o=void 0),{name:i,fd:o,removeCallback:rw(i,n?-1:o,r,!0)}}function kue(t,e){let r=$a(t,e),n=r[0],i=r[1];sw(n,function(s,a){if(s)return i(s);ot.mkdir(a,n.mode||xL,function(c){if(c)return i(c);i(null,a,TL(a,n,!1))})})}function Tue(t){let e=$a(t),r=e[0],n=aw(r);return ot.mkdirSync(n,r.mode||xL),{name:n,removeCallback:TL(n,r,!0)}}function Pue(t,e){let r=function(n){if(n&&!iw(n))return e(n);e()};0<=t[0]?ot.close(t[0],function(){ot.unlink(t[1],r)}):ot.unlink(t[1],r)}function Rue(t){let e=null;try{0<=t[0]&&ot.closeSync(t[0])}catch(r){if(!jue(r)&&!iw(r))throw r}finally{try{ot.unlinkSync(t[1])}catch(r){iw(r)||(e=r)}}if(e!==null)throw e}function rw(t,e,r,n){let i=wp(Rue,[e,t],n),o=wp(Pue,[e,t],n,i);return r.keep||Ra.unshift(i),n?i:o}function TL(t,e,r){let n=e.unsafeCleanup?Fue:ot.rmdir.bind(ot),i=e.unsafeCleanup?kL:OL,o=wp(i,t,r),s=wp(n,t,r,o);return e.keep||Ra.unshift(o),r?o:s}function wp(t,e,r,n){let i=!1;return function o(s){if(!i){let a=n||o,u=Ra.indexOf(a);return u>=0&&Ra.splice(u,1),i=!0,r||t===OL||t===kL?t(e):t(e,s||function(){})}}}function $ue(){if(AL)for(;Ra.length;)try{Ra[0]()}catch{}}function EL(t){let e=[],r=null;try{r=wL.randomBytes(t)}catch{r=wL.pseudoRandomBytes(t)}for(var n=0;n<t;n++)e.push(_L[r[n]%_L.length]);return e.join("")}function Iue(t){return t===null||tr(t)||!t.trim()}function tr(t){return typeof t>"u"}function $a(t,e){if(typeof t=="function")return[{},t];if(tr(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function PL(t){let e=t.tmpdir;if(!tr(t.name))return fr.join(e,t.dir,t.name);if(!tr(t.template))return fr.join(e,t.dir,t.template).replace(CL,EL(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",EL(12),t.postfix?"-"+t.postfix:""].join("");return fr.join(e,t.dir,r)}function RL(t){t.tmpdir=IL(t);let e=t.tmpdir;if(tr(t.name)||tw(t.name,"name",e),tr(t.dir)||tw(t.dir,"dir",e),!tr(t.template)&&(tw(t.template,"template",e),!t.template.match(CL)))throw new Error(`Invalid template, found "${t.template}".`);if(!tr(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=tr(t.name)?t.tries||_ue:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.dir=tr(t.dir)?"":fr.relative(e,nw(t.dir,e)),t.template=tr(t.template)?void 0:fr.relative(e,nw(t.template,e)),t.template=Iue(t.template)?void 0:fr.relative(t.dir,t.template),t.name=tr(t.name)?void 0:t.name,t.prefix=tr(t.prefix)?"":t.prefix,t.postfix=tr(t.postfix)?"":t.postfix}function nw(t,e){return t.startsWith(e)?fr.resolve(t):fr.resolve(fr.join(e,t))}function tw(t,e,r){if(e==="name"){if(fr.isAbsolute(t))throw new Error(`${e} option must not contain an absolute path, found "${t}".`);let n=fr.basename(t);if(n===".."||n==="."||n!==t)throw new Error(`${e} option must not contain a path, found "${t}".`)}else{if(fr.isAbsolute(t)&&!t.startsWith(r))throw new Error(`${e} option must be relative to "${r}", found "${t}".`);let n=nw(t,r);if(!n.startsWith(r))throw new Error(`${e} option must be relative to "${r}", found "${n}".`)}}function jue(t){return $L(t,-Cue,"EBADF")}function iw(t){return $L(t,-Sue,"ENOENT")}function $L(t,e,r){return Eue?t.code===r:t.code===r&&t.errno===e}function Nue(){AL=!0}function IL(t){return fr.resolve(t&&t.tmpdir||ow.tmpdir())}process.addListener(xue,$ue);Object.defineProperty(Hn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return IL()}});Hn.exports.dir=kue;Hn.exports.dirSync=Tue;Hn.exports.file=Oue;Hn.exports.fileSync=Aue;Hn.exports.tmpName=sw;Hn.exports.tmpNameSync=aw;Hn.exports.setGracefulCleanup=Nue});var Ow=ce(Fw(),1),{program:k,createCommand:mce,createArgument:gce,createOption:yce,CommanderError:Dce,InvalidArgumentError:vce,InvalidOptionArgumentError:bce,Command:wce,Argument:_ce,Option:Ece,Help:Cce}=Ow.default;var Ir={name:"@capgo/cli",version:"4.29.1",description:"A CLI to upload to capgo servers",author:"github.com/riderx",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLIl#readme",repository:{type:"git",url:"git+https://github.com/Cap-go/CLI.git"},bugs:{url:"https://github.com/Cap-go/CLI/issues"},keywords:["appflow alternative","ionic","capacitor","auto update","live update","capgo","cli","upload","capgo-cli"],main:"dist/index.js",bin:{capgo:"dist/index.js"},engines:{npm:">=8.0.0",node:">=20.0.0"},scripts:{build:"tsc && node build.mjs",dev:"NODE_ENV=development ncc build","no-debug":"node dist/index.js",test:"npx --yes ts-node -T src/index.ts","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",test_rls:"ts-node ./test/test_headers_rls.ts",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js"},devDependencies:{"@antfu/eslint-config":"^3.9.2","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client","@capacitor/cli":"^6.2.0","@capgo/find-package-manager":"^0.0.17","@clack/prompts":"^0.9.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver","@supabase/supabase-js":"^2.46.0","@tomasklaen/checksum":"^1.1.0","@types/adm-zip":"^0.5.6","@types/node":"^22.8.4","@types/prettyjson":"^0.0.33","@types/semver":"7.5.8","@types/tmp":"^0.2.6","@typescript-eslint/eslint-plugin":"^8.15.0","@typescript-eslint/parser":"^8.15.0","@vercel/ncc":"^0.38.3","adm-zip":"^0.5.16","ci-info":"^4.1.0",commander:"12.1.0",esbuild:"^0.24.0",eslint:"9.17.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",ky:"^1.7.2","latest-version":"^9.0.0",open:"^10.1.0",pkg:"5.8.1",prettyjson:"^1.2.5",semver:"^7.6.3",tmp:"^0.2.3","ts-loader":"^9.5.1","ts-node":"^10.9.2","tsconfig-paths":"4.2.0","tus-js-client":"^4.2.3",typescript:"5.7.2"}};var Sa=require("node:fs"),U8=require("node:process");var Et=ce(Te(),1),Bo=require("node:process"),Gn=ce(require("node:readline"),1),Wp=ce(require("node:readline"),1),Bw=require("node:tty"),al=ce(Vp(),1);function xB({onlyFirst:t=!1}={}){let e=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(e,t?void 0:"g")}var FB=xB();function qw(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(FB,"")}function Mw(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Uw={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var i=n.charCodeAt(0),o=n.length==2?n.charCodeAt(1):0,s=i;return 55296<=i&&i<=56319&&56320<=o&&o<=57343&&(i&=1023,o&=1023,s=i<<10|o,s+=65536),s==12288||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":s==8361||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||s==172||s==175||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":s==161||s==164||167<=s&&s<=168||s==170||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||s==198||s==208||215<=s&&s<=216||222<=s&&s<=225||s==230||232<=s&&s<=234||236<=s&&s<=237||s==240||242<=s&&s<=243||247<=s&&s<=250||s==252||s==254||s==257||s==273||s==275||s==283||294<=s&&s<=295||s==299||305<=s&&s<=307||s==312||319<=s&&s<=322||s==324||328<=s&&s<=331||s==333||338<=s&&s<=339||358<=s&&s<=359||s==363||s==462||s==464||s==466||s==468||s==470||s==472||s==474||s==476||s==593||s==609||s==708||s==711||713<=s&&s<=715||s==717||s==720||728<=s&&s<=731||s==733||s==735||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||s==1025||1040<=s&&s<=1103||s==1105||s==8208||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||s==8240||8242<=s&&s<=8243||s==8245||s==8251||s==8254||s==8308||s==8319||8321<=s&&s<=8324||s==8364||s==8451||s==8453||s==8457||s==8467||s==8470||8481<=s&&s<=8482||s==8486||s==8491||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||s==8585||8592<=s&&s<=8601||8632<=s&&s<=8633||s==8658||s==8660||s==8679||s==8704||8706<=s&&s<=8707||8711<=s&&s<=8712||s==8715||s==8719||s==8721||s==8725||s==8730||8733<=s&&s<=8736||s==8739||s==8741||8743<=s&&s<=8748||s==8750||8756<=s&&s<=8759||8764<=s&&s<=8765||s==8776||s==8780||s==8786||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||s==8853||s==8857||s==8869||s==8895||s==8978||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||s==9675||9678<=s&&s<=9681||9698<=s&&s<=9701||s==9711||9733<=s&&s<=9734||s==9737||9742<=s&&s<=9743||9748<=s&&s<=9749||s==9756||s==9758||s==9792||s==9794||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||s==9839||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||s==9955||9960<=s&&s<=9983||s==10045||s==10071||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||s==65533||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"},e.characterLength=function(n){var i=this.eastAsianWidth(n);return i=="F"||i=="W"||i=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var i=r(n),o=0,s=0;s<i.length;s++)o=o+this.characterLength(i[s]);return o},e.slice=function(n,i,o){textLen=e.length(n),i=i||0,o=o||1,i<0&&(i=textLen+i),o<0&&(o=textLen+o);for(var s="",a=0,u=r(n),c=0;c<u.length;c++){var l=u[c],f=e.length(l);if(a>=i-(f==2?1:0))if(a+f<=o)s+=l;else break;a+=f}return s}})(Uw);var OB=Uw.exports,AB=Mw(OB),kB=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},TB=Mw(kB);function La(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=qw(t),t.length===0))return 0;t=t.replace(TB()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let i of t){let o=i.codePointAt(0);if(!(o<=31||o>=127&&o<=159||o>=768&&o<=879))switch(AB.eastAsianWidth(i)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var zp=10,Pw=(t=0)=>e=>`\x1B[${e+t}m`,Rw=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,$w=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,$e={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys($e.modifier);var PB=Object.keys($e.color),RB=Object.keys($e.bgColor);[...PB,...RB];function $B(){let t=new Map;for(let[e,r]of Object.entries($e)){for(let[n,i]of Object.entries(r))$e[n]={open:`\x1B[${i[0]}m`,close:`\x1B[${i[1]}m`},r[n]=$e[n],t.set(i[0],i[1]);Object.defineProperty($e,e,{value:r,enumerable:!1})}return Object.defineProperty($e,"codes",{value:t,enumerable:!1}),$e.color.close="\x1B[39m",$e.bgColor.close="\x1B[49m",$e.color.ansi=Pw(),$e.color.ansi256=Rw(),$e.color.ansi16m=$w(),$e.bgColor.ansi=Pw(zp),$e.bgColor.ansi256=Rw(zp),$e.bgColor.ansi16m=$w(zp),Object.defineProperties($e,{rgbToAnsi256:{value:(e,r,n)=>e===r&&r===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!r)return[0,0,0];let[n]=r;n.length===3&&(n=[...n].map(o=>o+o).join(""));let i=Number.parseInt(n,16);return[i>>16&255,i>>8&255,i&255]},enumerable:!1},hexToAnsi256:{value:e=>$e.rgbToAnsi256(...$e.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,i;if(e>=232)r=((e-232)*10+8)/255,n=r,i=r;else{e-=16;let a=e%36;r=Math.floor(e/36)/5,n=Math.floor(a/6)/5,i=a%6/5}let o=Math.max(r,n,i)*2;if(o===0)return 30;let s=30+(Math.round(i)<<2|Math.round(n)<<1|Math.round(r));return o===2&&(s+=60),s},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>$e.ansi256ToAnsi($e.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>$e.ansi256ToAnsi($e.hexToAnsi256(e)),enumerable:!1}}),$e}var IB=$B(),dl=new Set(["\x1B","\x9B"]),jB=39,Yp="\x07",Hw="[",NB="]",Vw="m",Jp=`${NB}8;;`,Iw=t=>`${dl.values().next().value}${Hw}${t}${Vw}`,jw=t=>`${dl.values().next().value}${Jp}${t}${Yp}`,LB=t=>t.split(" ").map(e=>La(e)),Gp=(t,e,r)=>{let n=[...e],i=!1,o=!1,s=La(qw(t[t.length-1]));for(let[a,u]of n.entries()){let c=La(u);if(s+c<=r?t[t.length-1]+=u:(t.push(u),s=0),dl.has(u)&&(i=!0,o=n.slice(a+1).join("").startsWith(Jp)),i){o?u===Yp&&(i=!1,o=!1):u===Vw&&(i=!1);continue}s+=c,s===r&&a<n.length-1&&(t.push(""),s=0)}!s&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},BB=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(La(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},qB=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",i,o,s=LB(t),a=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(a[a.length-1]=a[a.length-1].trimStart());let f=La(a[a.length-1]);if(c!==0&&(f>=e&&(r.wordWrap===!1||r.trim===!1)&&(a.push(""),f=0),(f>0||r.trim===!1)&&(a[a.length-1]+=" ",f++)),r.hard&&s[c]>e){let h=e-f,d=1+Math.floor((s[c]-h-1)/e);Math.floor((s[c]-1)/e)<d&&a.push(""),Gp(a,l,e);continue}if(f+s[c]>e&&f>0&&s[c]>0){if(r.wordWrap===!1&&f<e){Gp(a,l,e);continue}a.push("")}if(f+s[c]>e&&r.wordWrap===!1){Gp(a,l,e);continue}a[a.length-1]+=l}r.trim!==!1&&(a=a.map(c=>BB(c)));let u=[...a.join(`
201
201
  `)];for(let[c,l]of u.entries()){if(n+=l,dl.has(l)){let{groups:h}=new RegExp(`(?:\\${Hw}(?<code>\\d+)m|\\${Jp}(?<uri>.*)${Yp})`).exec(u.slice(c).join(""))||{groups:{}};if(h.code!==void 0){let d=Number.parseFloat(h.code);i=d===jB?void 0:d}else h.uri!==void 0&&(o=h.uri.length===0?void 0:h.uri)}let f=IB.codes.get(Number(i));u[c+1]===`
202
202
  `?(o&&(n+=jw("")),i&&f&&(n+=Iw(f))):l===`
203
203
  `&&(i&&f&&(n+=Iw(i)),o&&(n+=jw(o)))}return n};function Nw(t,e,r){return String(t).normalize().replace(/\r\n/g,`
@@ -242,18 +242,18 @@ ${V.default.gray(qo)} ${t}
242
242
  `);let w=a.split(`
243
243
  `);process.stdout.write(hl.cursor.move(-999,w.length-1)),process.stdout.write(hl.erase.down(w.length))},p=w=>w.replace(/\.+$/,""),v=(w="")=>{o=!0,n=zw(),s=p(w),process.stdout.write(`${V.default.gray(Ke)}
244
244
  `);let S=0,y=0;f(),i=setInterval(()=>{if(r&&s===a)return;d(),a=s;let C=V.default.magenta(t[S]),A=r?"...":".".repeat(Math.floor(y)).slice(0,3);process.stdout.write(`${C} ${s}${A}`),S=S+1<t.length?S+1:0,y=y<t.length?y+.125:0},e)},g=(w="",S=0)=>{o=!1,clearInterval(i),d();let y=S===0?V.default.green(tm):S===1?V.default.red(Gw):V.default.red(Ww);s=p(w??s),process.stdout.write(`${y} ${s}
245
- `),h(),n()};return{start:v,stop:g,message:(w="")=>{s=p(w??s)}}};var et=require("node:fs"),Ph=require("node:os"),Qe=ce(require("node:path")),jt=require("node:process"),vi=ce(ml());var yn=require("fs"),Ma=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/pnpm-lock.yaml`,i=`${t}/yarn.lock`,o=`${t}/package-lock.json`;return(0,yn.existsSync)(r)?"bun":(0,yn.existsSync)(n)?"pnpm":(0,yn.existsSync)(i)?"yarn":(0,yn.existsSync)(o)?"npm":e},gl=(t=Ma(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},Kw=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/pnpm-lock.yaml`,i=`${t}/yarn.lock`,o=`${t}/package-lock.json`;return(0,yn.existsSync)(r)?"bunx":(0,yn.existsSync)(n)?"pnpm exec":(0,yn.existsSync)(i)?"yarn dlx":(0,yn.existsSync)(o)?"npx":e};var da=ce(z_()),Zj=ce(bu()),ab=ce(BC());var ti=class extends Error{response;request;options;constructor(e,r,n){let i=e.status||e.status===0?e.status:"",o=e.statusText||"",s=`${i} ${o}`.trim(),a=s?`status code ${s}`:"an unknown error";super(`Request failed with ${a}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=e,this.request=r,this.options=n}};var as=class extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}};var us=t=>t!==null&&typeof t=="object";var _u=(...t)=>{for(let e of t)if((!us(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return zg({},...t)},Hg=(t={},e={})=>{let r=new globalThis.Headers(t),n=e instanceof globalThis.Headers,i=new globalThis.Headers(e);for(let[o,s]of i.entries())n&&s==="undefined"||s===void 0?r.delete(o):r.set(o,s);return r};function rf(t,e,r){return Object.hasOwn(e,r)&&e[r]===void 0?[]:zg(t[r]??[],e[r]??[])}var Vg=(t={},e={})=>({beforeRequest:rf(t,e,"beforeRequest"),beforeRetry:rf(t,e,"beforeRetry"),afterResponse:rf(t,e,"afterResponse"),beforeError:rf(t,e,"beforeError")}),zg=(...t)=>{let e={},r={},n={};for(let i of t)if(Array.isArray(i))Array.isArray(e)||(e=[]),e=[...e,...i];else if(us(i)){for(let[o,s]of Object.entries(i))us(s)&&o in e&&(s=zg(e[o],s)),e={...e,[o]:s};us(i.hooks)&&(n=Vg(n,i.hooks),e.hooks=n),us(i.headers)&&(r=Hg(r,i.headers),e.headers=r)}return e};var qC=(()=>{let t=!1,e=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return t&&!e})(),MC=typeof globalThis.AbortController=="function",UC=typeof globalThis.ReadableStream=="function",HC=typeof globalThis.FormData=="function",nf=["get","post","put","patch","head","delete"],l9=()=>{};l9();var VC={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},of=2147483647,sf=Symbol("stop"),zC={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},GC={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var KC=t=>nf.includes(t)?t.toUpperCase():t,f9=["get","put","head","delete","options","trace"],d9=[408,413,429,500,502,503,504],h9=[413,429,503],WC={limit:2,methods:f9,statusCodes:d9,afterStatusCodes:h9,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3},YC=(t={})=>{if(typeof t=="number")return{...WC,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");return{...WC,...t}};async function Gg(t,e,r,n){return new Promise((i,o)=>{let s=setTimeout(()=>{r&&r.abort(),o(new as(t))},n.timeout);n.fetch(t,e).then(i).catch(o).then(()=>{clearTimeout(s)})})}async function Wg(t,{signal:e}){return new Promise((r,n)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(o),n(e.reason)}let o=setTimeout(()=>{e?.removeEventListener("abort",i),r()},t)})}var JC=(t,e)=>{let r={};for(let n in e)!(n in GC)&&!(n in zC)&&!(n in t)&&(r[n]=e[n]);return r};var Eu=class t{static create(e,r){let n=new t(e,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>of)throw new RangeError(`The \`timeout\` option cannot be greater than ${of}`);await Promise.resolve();let a=await n._fetch();for(let u of n._options.hooks.afterResponse){let c=await u(n.request,n._options,n._decorateResponse(a.clone()));c instanceof globalThis.Response&&(a=c)}if(n._decorateResponse(a),!a.ok&&n._options.throwHttpErrors){let u=new ti(a,n.request,n._options);for(let c of n._options.hooks.beforeError)u=await c(u);throw u}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!UC)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(a.clone(),n._options.onDownloadProgress)}return a},s=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i();for(let[a,u]of Object.entries(VC))s[a]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||u);let l=(await s).clone();if(a==="json"){if(l.status===204||(await l.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await l.text())}return l[a]()};return s}request;abortController;_retryCount=0;_input;_options;constructor(e,r={}){if(this._input=e,this._options={...r,headers:Hg(this._input.headers,r.headers),hooks:Vg({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:KC(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:YC(r.retry),throwHttpErrors:r.throwHttpErrors!==!1,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(MC){this.abortController=new globalThis.AbortController;let n=this._options.signal??this._input.signal;n?.addEventListener("abort",()=>{this.abortController.abort(n.reason)}),this._options.signal=this.abortController.signal}if(qC&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),o=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(HC&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(o,{...this.request}),this._options)}}_calculateRetryDelay(e){if(this._retryCount++,this._retryCount>this._options.retry.limit||e instanceof as)throw e;if(e instanceof ti){if(!this._options.retry.statusCodes.includes(e.response.status))throw e;let n=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(n&&this._options.retry.afterStatusCodes.includes(e.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let o=this._options.retry.maxRetryAfter??i;return i<o?i:o}if(e.response.status===413)throw e}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(e){return this._options.parseJson&&(e.json=async()=>this._options.parseJson(await e.text())),e}async _retry(e){try{return await e()}catch(r){let n=Math.min(this._calculateRetryDelay(r),of);if(this._retryCount<1)throw r;await Wg(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===sf)return;return this._retry(e)}}async _fetch(){for(let n of this._options.hooks.beforeRequest){let i=await n(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let e=JC(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,e):Gg(r,e,this.abortController,this._options)}_stream(e,r){let n=Number(e.headers.get("content-length"))||0,i=0;return e.status===204?(r&&r({percent:1,totalBytes:n,transferredBytes:i},new Uint8Array),new globalThis.Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(o){let s=e.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array);async function a(){let{done:u,value:c}=await s.read();if(u){o.close();return}if(r){i+=c.byteLength;let l=n===0?0:i/n;r({percent:l,transferredBytes:i,totalBytes:n},c)}o.enqueue(c),await a()}await a()}}),{status:e.status,statusText:e.statusText,headers:e.headers})}};var Kg=t=>{let e=(r,n)=>Eu.create(r,_u(t,n));for(let r of nf)e[r]=(n,i)=>Eu.create(n,_u(t,i,{method:r}));return e.create=r=>Kg(_u(r)),e.extend=r=>(typeof r=="function"&&(r=r(t??{})),Kg(_u(t,r))),e.stop=sf,e},p9=Kg(),Vr=p9;var Qj=ce(FS()),Rh=ce(cD());var Tc=ce(hj());async function pj(){let t=await(0,Tc.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function on(t,e=!1){let r=await(0,Tc.loadConfig)(),{extConfig:n}=r.app;n&&(n.plugins||(n.plugins={extConfig:{},CapacitorUpdater:{}}),n.plugins.CapacitorUpdater||(n.plugins.CapacitorUpdater={}),e?n=t.config:n.plugins.CapacitorUpdater=t.config.plugins?.CapacitorUpdater,(0,Tc.writeConfig)(n,r.app.extConfigFilePath))}var Qt=".capgo_key",ur=".capgo_key_v2",cr=`${Qt}.pub`,jn=`${ur}.pub`,Gj="https://capgo.app",Wj="https://files.capgo.app",Kj="https://api.capgo.app",Yj="https://web.capgo.app",e6=20,t6=12e4,bo=1024*1024*99,r6="package.json",ha=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i,te=t=>t?`
246
- ${Qj.default.render(t)}`:"";function Jj(t){return new Promise(e=>{setTimeout(e,t)})}function $h(t){return(0,vi.isMonorepo)(t)?(0,vi.findMonorepoRoot)(t):(0,vi.isNXMonorepo)(t)?(0,vi.findNXMonorepoRoot)(t):t}async function Er(t=$h((0,jt.cwd)()),e=void 0){e&&((0,et.existsSync)(e)||(m.error(`Package.json at ${e} does not exist`),(0,jt.exit)(1)));let r=(0,et.readFileSync)(e||(0,Qe.join)(t,r6));return JSON.parse(r)}async function Ih(t=$h((0,jt.cwd)()),e=void 0){let r=e?.split(",");if(r||(r=[(0,Qe.join)(t,r6)]),r)for(let i of r)(0,et.existsSync)(i)||(m.error(`Package.json at ${i} does not exist`),(0,jt.exit)(1));let n=new Map;for(let i of r){let o=(0,et.readFileSync)(i),s=JSON.parse(o);for(let a in s.dependencies)n.set(a,s.dependencies[a]);for(let a in s.devDependencies)n.set(a,s.devDependencies[a])}return n}async function Q(){try{let t=await pj();return t||(m.error("No capacitor config file found, run `cap init` first"),k.error("")),t}catch(t){m.error(`No capacitor config file found, run \`cap init\` first ${te(t)}`),k.error("")}}async function wo(t){let e=await Q();return e?.config&&(e.config.plugins||(e.config.plugins={extConfig:{},CapacitorUpdater:{}}),e.config.plugins.CapacitorUpdater||(e.config.plugins.CapacitorUpdater={}),e.config.plugins.CapacitorUpdater={...e.config.plugins.CapacitorUpdater,...t},on(e)),e}async function Cr(){try{let t=await Q(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||Gj,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||Yj,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||Wj,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||Kj};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(m.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:Gj,hostWeb:Yj,hostFilesApi:Wj,hostApi:Kj}}}var Ese=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function ub(){let t=await Cr();return Vr.get(`${t.hostApi}/private/config`).then(e=>e.json()).then(e=>({...e,...t})).catch(()=>(m.info(`Local config ${te(t)}`),t))}async function n6(){let t=await Cr();return Vr.get(`${t.hostFilesApi}/files/config`).then(e=>e.json()).catch(()=>({partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1}))}async function de(t){let e=await ub();return(!e.supaHost||!e.supaKey)&&(m.error("Cannot connect to server please try again later"),k.error("")),(0,da.createClient)(e.supaHost,e.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function Cse(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){m.error("Invalid API key or insufficient permissions.");let i=r.map((o,s)=>r.length===1?`"${o}"`:s===r.length-1?`or "${o}"`:`"${o}", `).join("");m.error(`Your key should be: ${i} mode.`),k.error("")}}async function Sse(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function xse(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function Fse(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function Ose(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var Ft=(s=>(s[s.none=0]="none",s[s.read=1]="read",s[s.upload=2]="upload",s[s.write=3]="write",s[s.admin=4]="admin",s[s.super_admin=5]="super_admin",s))(Ft||{}),i6=(t,e)=>t>=e;async function o6(t,e,r){let{data:n,error:i}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(i&&(m.error("Cannot get permissions for organization!"),console.error(i),(0,jt.exit)(1)),n.includes("perm")){let a=null;switch(n){case"perm_none":{a=0;break}case"perm_read":{a=1;break}case"perm_upload":{a=2;break}case"perm_write":{a=3;break}case"perm_admin":{a=4;break}case"perm_owner":{a=5;break}default:n.includes("invite")&&(m.info("Please accept/deny the organization invitation before trying to access the app"),(0,jt.exit)(1)),m.error(`Invalid output when fetching organization permission. Response: ${n}`),(0,jt.exit)(1)}return{okay:!0,data:a}}let s=null;switch(n){case"INVALID_APIKEY":{s="INVALID_APIKEY";break}case"NO_APP":{s="NO_APP";break}case"NO_ORG":{s="NO_ORG";break}default:m.error(`Invalid error when fetching organization permission. Response: ${n}`),(0,jt.exit)(1)}return{okay:!1,error:s}}async function pa(t,e,r,n,i=!0){let o=await ub();await(n?Ose(t,n,r):Fse(t,e))||(m.error(`You need to upgrade your plan to continue to use capgo.
245
+ `),h(),n()};return{start:v,stop:g,message:(w="")=>{s=p(w??s)}}};var et=require("node:fs"),Ph=require("node:os"),Qe=ce(require("node:path")),jt=require("node:process"),vi=ce(ml());var yn=require("fs"),Ma=(t=".",e="unknown")=>{let r=`${t}/bun.lockb`,n=`${t}/pnpm-lock.yaml`,i=`${t}/yarn.lock`,o=`${t}/package-lock.json`;return(0,yn.existsSync)(r)?"bun":(0,yn.existsSync)(n)?"pnpm":(0,yn.existsSync)(i)?"yarn":(0,yn.existsSync)(o)?"npm":e},gl=(t=Ma(),e=!1)=>{switch(t){case"bun":return e?"bun install":"install";case"pnpm":return e?"pnpm install":"install";case"yarn":return e?"yarn install":"install";case"npm":return e?"npm install":"install";case"unknown":return e?"unknown unknown":"unknown";default:return e?"npm install":"install"}},Kw=(t=".",e="npx")=>{let r=`${t}/bun.lockb`,n=`${t}/pnpm-lock.yaml`,i=`${t}/yarn.lock`,o=`${t}/package-lock.json`;return(0,yn.existsSync)(r)?"bunx":(0,yn.existsSync)(n)?"pnpm exec":(0,yn.existsSync)(i)?"yarn dlx":(0,yn.existsSync)(o)?"npx":e};var da=ce(z_()),Z6=ce(bu()),ab=ce(BC());var ti=class extends Error{response;request;options;constructor(e,r,n){let i=e.status||e.status===0?e.status:"",o=e.statusText||"",s=`${i} ${o}`.trim(),a=s?`status code ${s}`:"an unknown error";super(`Request failed with ${a}: ${r.method} ${r.url}`),this.name="HTTPError",this.response=e,this.request=r,this.options=n}};var as=class extends Error{request;constructor(e){super(`Request timed out: ${e.method} ${e.url}`),this.name="TimeoutError",this.request=e}};var us=t=>t!==null&&typeof t=="object";var _u=(...t)=>{for(let e of t)if((!us(e)||Array.isArray(e))&&e!==void 0)throw new TypeError("The `options` argument must be an object");return zg({},...t)},Hg=(t={},e={})=>{let r=new globalThis.Headers(t),n=e instanceof globalThis.Headers,i=new globalThis.Headers(e);for(let[o,s]of i.entries())n&&s==="undefined"||s===void 0?r.delete(o):r.set(o,s);return r};function rf(t,e,r){return Object.hasOwn(e,r)&&e[r]===void 0?[]:zg(t[r]??[],e[r]??[])}var Vg=(t={},e={})=>({beforeRequest:rf(t,e,"beforeRequest"),beforeRetry:rf(t,e,"beforeRetry"),afterResponse:rf(t,e,"afterResponse"),beforeError:rf(t,e,"beforeError")}),zg=(...t)=>{let e={},r={},n={};for(let i of t)if(Array.isArray(i))Array.isArray(e)||(e=[]),e=[...e,...i];else if(us(i)){for(let[o,s]of Object.entries(i))us(s)&&o in e&&(s=zg(e[o],s)),e={...e,[o]:s};us(i.hooks)&&(n=Vg(n,i.hooks),e.hooks=n),us(i.headers)&&(r=Hg(r,i.headers),e.headers=r)}return e};var qC=(()=>{let t=!1,e=!1,r=typeof globalThis.ReadableStream=="function",n=typeof globalThis.Request=="function";if(r&&n)try{e=new globalThis.Request("https://empty.invalid",{body:new globalThis.ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type")}catch(i){if(i instanceof Error&&i.message==="unsupported BodyInit type")return!1;throw i}return t&&!e})(),MC=typeof globalThis.AbortController=="function",UC=typeof globalThis.ReadableStream=="function",HC=typeof globalThis.FormData=="function",nf=["get","post","put","patch","head","delete"],l9=()=>{};l9();var VC={json:"application/json",text:"text/*",formData:"multipart/form-data",arrayBuffer:"*/*",blob:"*/*"},of=2147483647,sf=Symbol("stop"),zC={json:!0,parseJson:!0,stringifyJson:!0,searchParams:!0,prefixUrl:!0,retry:!0,timeout:!0,hooks:!0,throwHttpErrors:!0,onDownloadProgress:!0,fetch:!0},GC={method:!0,headers:!0,body:!0,mode:!0,credentials:!0,cache:!0,redirect:!0,referrer:!0,referrerPolicy:!0,integrity:!0,keepalive:!0,signal:!0,window:!0,dispatcher:!0,duplex:!0,priority:!0};var KC=t=>nf.includes(t)?t.toUpperCase():t,f9=["get","put","head","delete","options","trace"],d9=[408,413,429,500,502,503,504],h9=[413,429,503],WC={limit:2,methods:f9,statusCodes:d9,afterStatusCodes:h9,maxRetryAfter:Number.POSITIVE_INFINITY,backoffLimit:Number.POSITIVE_INFINITY,delay:t=>.3*2**(t-1)*1e3},YC=(t={})=>{if(typeof t=="number")return{...WC,limit:t};if(t.methods&&!Array.isArray(t.methods))throw new Error("retry.methods must be an array");if(t.statusCodes&&!Array.isArray(t.statusCodes))throw new Error("retry.statusCodes must be an array");return{...WC,...t}};async function Gg(t,e,r,n){return new Promise((i,o)=>{let s=setTimeout(()=>{r&&r.abort(),o(new as(t))},n.timeout);n.fetch(t,e).then(i).catch(o).then(()=>{clearTimeout(s)})})}async function Wg(t,{signal:e}){return new Promise((r,n)=>{e&&(e.throwIfAborted(),e.addEventListener("abort",i,{once:!0}));function i(){clearTimeout(o),n(e.reason)}let o=setTimeout(()=>{e?.removeEventListener("abort",i),r()},t)})}var JC=(t,e)=>{let r={};for(let n in e)!(n in GC)&&!(n in zC)&&!(n in t)&&(r[n]=e[n]);return r};var Eu=class t{static create(e,r){let n=new t(e,r),i=async()=>{if(typeof n._options.timeout=="number"&&n._options.timeout>of)throw new RangeError(`The \`timeout\` option cannot be greater than ${of}`);await Promise.resolve();let a=await n._fetch();for(let u of n._options.hooks.afterResponse){let c=await u(n.request,n._options,n._decorateResponse(a.clone()));c instanceof globalThis.Response&&(a=c)}if(n._decorateResponse(a),!a.ok&&n._options.throwHttpErrors){let u=new ti(a,n.request,n._options);for(let c of n._options.hooks.beforeError)u=await c(u);throw u}if(n._options.onDownloadProgress){if(typeof n._options.onDownloadProgress!="function")throw new TypeError("The `onDownloadProgress` option must be a function");if(!UC)throw new Error("Streams are not supported in your environment. `ReadableStream` is missing.");return n._stream(a.clone(),n._options.onDownloadProgress)}return a},s=n._options.retry.methods.includes(n.request.method.toLowerCase())?n._retry(i):i();for(let[a,u]of Object.entries(VC))s[a]=async()=>{n.request.headers.set("accept",n.request.headers.get("accept")||u);let l=(await s).clone();if(a==="json"){if(l.status===204||(await l.clone().arrayBuffer()).byteLength===0)return"";if(r.parseJson)return r.parseJson(await l.text())}return l[a]()};return s}request;abortController;_retryCount=0;_input;_options;constructor(e,r={}){if(this._input=e,this._options={...r,headers:Hg(this._input.headers,r.headers),hooks:Vg({beforeRequest:[],beforeRetry:[],beforeError:[],afterResponse:[]},r.hooks),method:KC(r.method??this._input.method),prefixUrl:String(r.prefixUrl||""),retry:YC(r.retry),throwHttpErrors:r.throwHttpErrors!==!1,timeout:r.timeout??1e4,fetch:r.fetch??globalThis.fetch.bind(globalThis)},typeof this._input!="string"&&!(this._input instanceof URL||this._input instanceof globalThis.Request))throw new TypeError("`input` must be a string, URL, or Request");if(this._options.prefixUrl&&typeof this._input=="string"){if(this._input.startsWith("/"))throw new Error("`input` must not begin with a slash when using `prefixUrl`");this._options.prefixUrl.endsWith("/")||(this._options.prefixUrl+="/"),this._input=this._options.prefixUrl+this._input}if(MC){this.abortController=new globalThis.AbortController;let n=this._options.signal??this._input.signal;n?.addEventListener("abort",()=>{this.abortController.abort(n.reason)}),this._options.signal=this.abortController.signal}if(qC&&(this._options.duplex="half"),this._options.json!==void 0&&(this._options.body=this._options.stringifyJson?.(this._options.json)??JSON.stringify(this._options.json),this._options.headers.set("content-type",this._options.headers.get("content-type")??"application/json")),this.request=new globalThis.Request(this._input,this._options),this._options.searchParams){let i="?"+(typeof this._options.searchParams=="string"?this._options.searchParams.replace(/^\?/,""):new URLSearchParams(this._options.searchParams).toString()),o=this.request.url.replace(/(?:\?.*?)?(?=#|$)/,i);(HC&&this._options.body instanceof globalThis.FormData||this._options.body instanceof URLSearchParams)&&!(this._options.headers&&this._options.headers["content-type"])&&this.request.headers.delete("content-type"),this.request=new globalThis.Request(new globalThis.Request(o,{...this.request}),this._options)}}_calculateRetryDelay(e){if(this._retryCount++,this._retryCount>this._options.retry.limit||e instanceof as)throw e;if(e instanceof ti){if(!this._options.retry.statusCodes.includes(e.response.status))throw e;let n=e.response.headers.get("Retry-After")??e.response.headers.get("RateLimit-Reset")??e.response.headers.get("X-RateLimit-Reset")??e.response.headers.get("X-Rate-Limit-Reset");if(n&&this._options.retry.afterStatusCodes.includes(e.response.status)){let i=Number(n)*1e3;Number.isNaN(i)?i=Date.parse(n)-Date.now():i>=Date.parse("2024-01-01")&&(i-=Date.now());let o=this._options.retry.maxRetryAfter??i;return i<o?i:o}if(e.response.status===413)throw e}let r=this._options.retry.delay(this._retryCount);return Math.min(this._options.retry.backoffLimit,r)}_decorateResponse(e){return this._options.parseJson&&(e.json=async()=>this._options.parseJson(await e.text())),e}async _retry(e){try{return await e()}catch(r){let n=Math.min(this._calculateRetryDelay(r),of);if(this._retryCount<1)throw r;await Wg(n,{signal:this._options.signal});for(let i of this._options.hooks.beforeRetry)if(await i({request:this.request,options:this._options,error:r,retryCount:this._retryCount})===sf)return;return this._retry(e)}}async _fetch(){for(let n of this._options.hooks.beforeRequest){let i=await n(this.request,this._options);if(i instanceof Request){this.request=i;break}if(i instanceof Response)return i}let e=JC(this.request,this._options),r=this.request;return this.request=r.clone(),this._options.timeout===!1?this._options.fetch(r,e):Gg(r,e,this.abortController,this._options)}_stream(e,r){let n=Number(e.headers.get("content-length"))||0,i=0;return e.status===204?(r&&r({percent:1,totalBytes:n,transferredBytes:i},new Uint8Array),new globalThis.Response(null,{status:e.status,statusText:e.statusText,headers:e.headers})):new globalThis.Response(new globalThis.ReadableStream({async start(o){let s=e.body.getReader();r&&r({percent:0,transferredBytes:0,totalBytes:n},new Uint8Array);async function a(){let{done:u,value:c}=await s.read();if(u){o.close();return}if(r){i+=c.byteLength;let l=n===0?0:i/n;r({percent:l,transferredBytes:i,totalBytes:n},c)}o.enqueue(c),await a()}await a()}}),{status:e.status,statusText:e.statusText,headers:e.headers})}};var Kg=t=>{let e=(r,n)=>Eu.create(r,_u(t,n));for(let r of nf)e[r]=(n,i)=>Eu.create(n,_u(t,i,{method:r}));return e.create=r=>Kg(_u(r)),e.extend=r=>(typeof r=="function"&&(r=r(t??{})),Kg(_u(t,r))),e.stop=sf,e},p9=Kg(),Vr=p9;var Q6=ce(FS()),Rh=ce(cD());var Tc=ce(h6());async function p6(){let t=await(0,Tc.loadConfig)();return{config:t.app.extConfig,path:t.app.extConfigFilePath}}async function on(t,e=!1){let r=await(0,Tc.loadConfig)(),{extConfig:n}=r.app;n&&(n.plugins||(n.plugins={extConfig:{},CapacitorUpdater:{}}),n.plugins.CapacitorUpdater||(n.plugins.CapacitorUpdater={}),e?n=t.config:n.plugins.CapacitorUpdater=t.config.plugins?.CapacitorUpdater,(0,Tc.writeConfig)(n,r.app.extConfigFilePath))}var Qt=".capgo_key",ur=".capgo_key_v2",cr=`${Qt}.pub`,jn=`${ur}.pub`,G6="https://capgo.app",W6="https://files.capgo.app",K6="https://api.capgo.app",Y6="https://web.capgo.app",ej=20,tj=12e4,bo=1024*1024*99,rj="package.json",ha=/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-z-][0-9a-z-]*))*))?(?:\+([0-9a-z-]+(?:\.[0-9a-z-]+)*))?$/i,te=t=>t?`
246
+ ${Q6.default.render(t)}`:"";function J6(t){return new Promise(e=>{setTimeout(e,t)})}function $h(t){return(0,vi.isMonorepo)(t)?(0,vi.findMonorepoRoot)(t):(0,vi.isNXMonorepo)(t)?(0,vi.findNXMonorepoRoot)(t):t}async function Er(t=$h((0,jt.cwd)()),e=void 0){e&&((0,et.existsSync)(e)||(m.error(`Package.json at ${e} does not exist`),(0,jt.exit)(1)));let r=(0,et.readFileSync)(e||(0,Qe.join)(t,rj));return JSON.parse(r)}async function Ih(t=$h((0,jt.cwd)()),e=void 0){let r=e?.split(",");if(r||(r=[(0,Qe.join)(t,rj)]),r)for(let i of r)(0,et.existsSync)(i)||(m.error(`Package.json at ${i} does not exist`),(0,jt.exit)(1));let n=new Map;for(let i of r){let o=(0,et.readFileSync)(i),s=JSON.parse(o);for(let a in s.dependencies)n.set(a,s.dependencies[a]);for(let a in s.devDependencies)n.set(a,s.devDependencies[a])}return n}async function Q(){try{let t=await p6();return t||(m.error("No capacitor config file found, run `cap init` first"),k.error("")),t}catch(t){m.error(`No capacitor config file found, run \`cap init\` first ${te(t)}`),k.error("")}}async function wo(t){let e=await Q();return e?.config&&(e.config.plugins||(e.config.plugins={extConfig:{},CapacitorUpdater:{}}),e.config.plugins.CapacitorUpdater||(e.config.plugins.CapacitorUpdater={}),e.config.plugins.CapacitorUpdater={...e.config.plugins.CapacitorUpdater,...t},on(e)),e}async function Cr(){try{let t=await Q(),e={host:t?.config?.plugins?.CapacitorUpdater?.localHost||G6,hostWeb:t?.config?.plugins?.CapacitorUpdater?.localWebHost||Y6,hostFilesApi:t?.config?.plugins?.CapacitorUpdater?.localApiFiles||W6,hostApi:t?.config?.plugins?.CapacitorUpdater?.localApi||K6};return t?.config?.plugins?.CapacitorUpdater?.localSupa&&t?.config?.plugins?.CapacitorUpdater?.localSupaAnon&&(m.info("Using custom supabase instance from capacitor.config.json"),e.supaKey=t?.config?.plugins?.CapacitorUpdater?.localSupaAnon,e.supaHost=t?.config?.plugins?.CapacitorUpdater?.localSupa),e}catch{return{host:G6,hostWeb:Y6,hostFilesApi:W6,hostApi:K6}}}var Ese=/([A-Za-z0-9]+)\.(java|swift|kt|scala)$/;async function ub(){let t=await Cr();return Vr.get(`${t.hostApi}/private/config`).then(e=>e.json()).then(e=>({...e,...t})).catch(()=>(m.info(`Local config ${te(t)}`),t))}async function nj(){let t=await Cr();return Vr.get(`${t.hostFilesApi}/files/config`).then(e=>e.json()).catch(()=>({partialUpload:!1,TUSUpload:!1,partialUploadForced:!1,TUSUploadForced:!1}))}async function de(t){let e=await ub();return(!e.supaHost||!e.supaKey)&&(m.error("Cannot connect to server please try again later"),k.error("")),(0,da.createClient)(e.supaHost,e.supaKey,{auth:{persistSession:!1},global:{headers:{capgkey:t}}})}async function Cse(t,e,r){let{data:n}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:r}).single();if(!n){m.error("Invalid API key or insufficient permissions.");let i=r.map((o,s)=>r.length===1?`"${o}"`:s===r.length-1?`or "${o}"`:`"${o}", `).join("");m.error(`Your key should be: ${i} mode.`),k.error("")}}async function Sse(t,e){let{data:r}=await t.rpc("is_paying_org",{orgid:e}).single();return r||!1}async function xse(t,e){let{data:r}=await t.rpc("is_trial_org",{orgid:e}).single();return r||0}async function Fse(t,e){let{data:r}=await t.rpc("is_allowed_action_org",{orgid:e}).single();return!!r}async function Ose(t,e,r){let{data:n}=await t.rpc("is_allowed_action",{apikey:r,appid:e}).single();return!!n}var Ft=(s=>(s[s.none=0]="none",s[s.read=1]="read",s[s.upload=2]="upload",s[s.write=3]="write",s[s.admin=4]="admin",s[s.super_admin=5]="super_admin",s))(Ft||{}),ij=(t,e)=>t>=e;async function oj(t,e,r){let{data:n,error:i}=await t.rpc("get_org_perm_for_apikey",{apikey:e,app_id:r}).single();if(i&&(m.error("Cannot get permissions for organization!"),console.error(i),(0,jt.exit)(1)),n.includes("perm")){let a=null;switch(n){case"perm_none":{a=0;break}case"perm_read":{a=1;break}case"perm_upload":{a=2;break}case"perm_write":{a=3;break}case"perm_admin":{a=4;break}case"perm_owner":{a=5;break}default:n.includes("invite")&&(m.info("Please accept/deny the organization invitation before trying to access the app"),(0,jt.exit)(1)),m.error(`Invalid output when fetching organization permission. Response: ${n}`),(0,jt.exit)(1)}return{okay:!0,data:a}}let s=null;switch(n){case"INVALID_APIKEY":{s="INVALID_APIKEY";break}case"NO_APP":{s="NO_APP";break}case"NO_ORG":{s="NO_ORG";break}default:m.error(`Invalid error when fetching organization permission. Response: ${n}`),(0,jt.exit)(1)}return{okay:!1,error:s}}async function pa(t,e,r,n,i=!0){let o=await ub();await(n?Ose(t,n,r):Fse(t,e))||(m.error(`You need to upgrade your plan to continue to use capgo.
247
247
  Upgrade here: ${o.hostWeb}/dashboard/settings/plans
248
- `),Jj(100),Promise.resolve().then(()=>(zj(),Vj)).then(c=>{c.default(`${o.hostWeb}/dashboard/settings/plans`)}),Jj(500),k.error(""));let[a,u]=await Promise.all([xse(t,e),Sse(t,e)]);a>0&&i&&!u&&m.warn(`WARNING !!
248
+ `),J6(100),Promise.resolve().then(()=>(z6(),V6)).then(c=>{c.default(`${o.hostWeb}/dashboard/settings/plans`)}),J6(500),k.error(""));let[a,u]=await Promise.all([xse(t,e),Sse(t,e)]);a>0&&i&&!u&&m.warn(`WARNING !!
249
249
  Trial expires in ${a} days, upgrade here: ${o.hostWeb}/dashboard/settings/plans
250
- `)}function pe(t=!1){let e=(0,Ph.homedir)(),r,n=`${e}/.capgo`;return(0,et.existsSync)(n)&&(t||m.info(`Use global API key ${n}`),r=(0,et.readFileSync)(n,"utf8").trim()),n=".capgo",!r&&(0,et.existsSync)(n)&&(t||m.info(`Use local API key ${n}`),r=(0,et.readFileSync)(n,"utf8").trim()),r||(m.error(`Cannot find API key in local folder or global, please login first with ${er().runner} @capacitor/cli login`),k.error("")),r}async function*cb(t){let e=await(0,et.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Qe.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*cb(n):yield n}}function ma(t){let e=/\.(jpg|jpeg|png|gif|bmp|webp)$/i,r=t.match(e);if(r)switch(r[1].toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp"}return null}async function lb(){let t=(0,jt.cwd)(),e=!1,r=(0,Qe.resolve)(t,"tsconfig.json");(0,et.existsSync)(r)&&(e=!0);for await(let n of cb(t)){if(n.includes("angular.json"))return m.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return m.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return m.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return m.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return m.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return m.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes("package.json")){let i=(0,Qe.dirname)(n),o=await Ih(i);if(o){if(o.get("react"))return m.info("Found react project test"),e?"react-ts":"react-js";if(o.get("vue"))return m.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function s6(t,e){return t==="angular-js"||t==="angular-ts"?e?"src/main.ts":"src/main.js":t==="nextjs-js"||t==="nextjs-ts"?e?"src/app/layout.tsx":"src/app/layout.js":t==="svelte-js"||t==="svelte-ts"||t==="vue-js"||t==="vue-ts"?e?"src/main.ts":"src/main.js":t==="react-js"||t==="react-ts"?e?"src/index.tsx":"src/index.js":null}async function a6(t){return t==="angular"?(m.info("Angular project detected"),"build"):t==="nuxtjs"?(m.info("Nuxtjs project detected"),"generate"):t==="nextjs"?(m.info("Nextjs project detected"),m.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),m.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),await qe({message:"Do you want to continue?"})||(m.error("Aborted"),k.error("")),"build"):(t==="sveltekit"&&(m.info("Sveltekit project detected"),m.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),m.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adaptater"),await qe({message:"Do you want to continue?"})||(m.error("Aborted"),k.error(""))),"build")}async function u6(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,jt.cwd)(),n=r.split("/").length;for await(let i of cb(r))if(i.split("/").length-n<=2&&t.test(i)){e=i,m.info(`Found main file here ${i}`);break}return e}async function fb(t,e){return t.from("app_versions").upsert(e,{onConflict:"name,app_id"}).eq("app_id",e.app_id).eq("name",e.name)}async function c6(t,e,r){let n={app_id:e,name:r,version:0};try{let o=await t.functions.invoke("private/upload_link",{body:JSON.stringify(n)});if(o.error){if(o.error instanceof da.FunctionsHttpError){let s=await o.error.context.json();m.error(`Upload URL error: ${s.status||JSON.stringify(s)}`)}else m.error(`Cannot get upload url: ${o.error.message}`);return""}return o.data.url}catch(i){m.error(`Cannot get upload url ${te(i)}`)}return""}async function*l6(t){let e=(0,et.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Qe.join)(t,r.name);r.isDirectory()?yield*l6(n):yield n}}async function f6(t){let e=[];for await(let r of l6(t)){let n=(0,et.readFileSync)(r),i=await(0,Zj.checksum)(n,"sha256"),o=(0,Qe.relative)(t,r);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:i})}return e}async function jh(t){return(0,Ph.platform)()==="win32"?kse(t):Ase(t)}function Ase(t){let e=new ab.default;return e.addLocalFolder(t),e.toBuffer()}async function kse(t){m.info("Zipping file windows mode");let e=new ab.default,r=(n,i)=>{let o=(0,et.readdirSync)(n);for(let s of o){let a=(0,Qe.join)(n,s),u=(0,et.statSync)(a);if(u.isFile()){let c=(0,et.readFileSync)(a);e.addFile((0,Qe.join)(i,s).split(Qe.sep).join("/"),c)}else u.isDirectory()&&r(a,(0,Qe.join)(i,s))}};return r(t,""),e.toBuffer()}async function d6(t,e,r,n,i,o,s,a){return new Promise((u,c)=>{Fe(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Rh.Upload(e,{endpoint:`${s.hostFilesApi}/files/upload/attachments/`,chunkSize:a||bo,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(f){if(m.error(`Error uploading bundle: ${f.message}`),f instanceof Rh.DetailedError){let h=f.originalResponse?.getBody(),d=JSON.parse(h||'{"error": "unknown error"}');c(d.status||d.error||d.message||"unknown error")}else c(f.message||f.toString()||"unknown error")},onProgress(f,h){let d=(f/h*100).toFixed(2);o.message(`Uploaded ${d}%`)},async onSuccess(){await Fe(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function h6(t,e,r){let n={app_id:e,name:r};try{let o=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(o.error){if(o.error instanceof da.FunctionsHttpError){let s=await o.error.context.json();m.error(`Cannot delete failed version: ${s.status||JSON.stringify(s)}`)}else m.error(`Cannot delete failed version: ${o.error.message}`);return}return o.data?.status}catch(i){if(i instanceof da.FunctionsHttpError){let o=await i.context.json();m.error(`Cannot delete failed version: ${o.message||JSON.stringify(o)}`)}else m.error(`Cannot delete failed version: ${te(i)}`)}}async function Nh(t,e){if(!e.app_id||!e.name||!e.created_by)return m.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:n}=await t.from("channels").select().eq("app_id",e.app_id).eq("name",e.name).single();return r&&!n?t.from("channels").update(e).eq("app_id",e.app_id).eq("name",e.name).select().single():t.from("channels").insert(e).select().single()}async function Fe(t,e){try{let r=await ub(),n=await Vr.post(`${r.host}/private/events`,{json:e,headers:{capgkey:t},timeout:1e4,retry:3}).json();n.error&&m.error(`Failed to send LogSnag event: ${n.error}`)}catch{}}async function ga(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v5");r&&(m.error("Cannot get the list of organizations - exiting"),m.error(`Error ${JSON.stringify(r)}`),k.error(""));let i=n.filter(u=>!!e.find(c=>c===u.role));i.length===0&&(m.error(`Could not get organization with roles: ${e.join(" or ")} because the user does not have any org`),k.error(""));let o=i.length>1?await Mo({message:"Please pick the organization that you want to insert to",options:i.map(u=>({value:u.gid,label:u.name}))}):i[0].gid;kt(o)&&(m.error("Canceled organization selection, exiting"),k.error(""));let s=o,a=n.find(u=>u.gid===s);return m.info(`Using the organization "${a.name}" as the app owner`),a}var _o=t=>t.replace(/\./g,"--");async function me(t,e,r=["all"]){await Cse(t,e,r);let{data:n,error:i}=await t.rpc("get_user_id",{apikey:e}).single(),o=(n||"").toString();return(!o||i)&&(m.error("Cannot auth user with apikey"),k.error("")),o}async function Sr(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();return(!r||n)&&(m.error(`Cannot get organization id for app id ${e}`),te(n),k.error("")),r.owner_org}function ya(t){return new Date(t||"").toLocaleString()}var Xj=!1,fa="npm",Ic="install",sb="npx";function er(){if(Xj)return{pm:fa,command:Ic,installCommand:`${fa} ${Ic}`,runner:sb};let t=$h((0,jt.cwd)());return fa=Ma(t,"npm"),Ic=gl(fa),Xj=!0,sb=Kw(t),{pm:fa,command:Ic,installCommand:`${fa} ${Ic}`,runner:sb}}function p6(t){return(0,et.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,Qe.join)(t,n.name);return n.isDirectory()?p6(i):i.split(`node_modules${Qe.sep}`)[1]||i})}async function db(t,e){let r=e?e.split(","):[],n;try{n=await Ih("",t)}catch(l){m.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),k.error("")}let i=t?.split(",")[0],o=i?Qe.default.resolve(i).replace("package.json",""):$h((0,jt.cwd)());n||(m.error("Missing dependencies section in package.json"),k.error(""));for(let[l,f]of Object.entries(n))typeof f!="string"&&(m.error(`Invalid dependency ${l}: ${f}, expected string, got ${typeof f}`),k.error(""));let s=r.length===0?[(0,Qe.join)((0,jt.cwd)(),"node_modules")]:r;if(!s.some(l=>(0,et.existsSync)(l))){let l=Ma(o,"npm"),f=gl(l);m.error(`Missing node_modules folder at ${s.join(", ")}, please run ${l} ${f}`),k.error("")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,f])=>{let h=!1,d=!1;for(let p of s){let v=(0,Qe.join)(p,l);if((0,et.existsSync)(v)){h=!0;try{if(p6(v).some(w=>Ese.test(w))){d=!0;break}}catch(g){m.error(`Error reading node_modules files for ${l} package in ${p}`),console.error(g),k.error("")}}}if(!h){u=!0;let p=Ma(o,"npm"),v=gl(p);return m.error(`Missing dependency ${l}, please run ${p} ${v}`),{name:l,version:f}}return{name:l,version:f,native:d}})).catch(()=>[]);return(u||c.find(l=>l.native===void 0))&&k.error(""),c}async function Tse(t,e,r){let{data:n,error:i}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),o=n;return i||o===null||!o.version||!o.version.checksum?null:o.version.checksum}async function Pse(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
250
+ `)}function pe(t=!1){let e=(0,Ph.homedir)(),r,n=`${e}/.capgo`;return(0,et.existsSync)(n)&&(t||m.info(`Use global API key ${n}`),r=(0,et.readFileSync)(n,"utf8").trim()),n=".capgo",!r&&(0,et.existsSync)(n)&&(t||m.info(`Use local API key ${n}`),r=(0,et.readFileSync)(n,"utf8").trim()),r||(m.error(`Cannot find API key in local folder or global, please login first with ${er().runner} @capacitor/cli login`),k.error("")),r}async function*cb(t){let e=await(0,et.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Qe.resolve)(t,r.name);r.isDirectory()&&!r.name.startsWith(".")&&!r.name.startsWith("node_modules")&&!r.name.startsWith("dist")?yield*cb(n):yield n}}function ma(t){let e=/\.(jpg|jpeg|png|gif|bmp|webp)$/i,r=t.match(e);if(r)switch(r[1].toLowerCase()){case"jpg":case"jpeg":return"image/jpeg";case"png":return"image/png";case"webp":return"image/webp"}return null}async function lb(){let t=(0,jt.cwd)(),e=!1,r=(0,Qe.resolve)(t,"tsconfig.json");(0,et.existsSync)(r)&&(e=!0);for await(let n of cb(t)){if(n.includes("angular.json"))return m.info("Found angular project"),e?"angular-ts":"angular-js";if(n.includes("nuxt.config.js")||n.includes("nuxt.config.ts"))return m.info("Found nuxtjs project"),e?"nuxtjs-ts":"nuxtjs-js";if(n.includes("next.config.js")||n.includes("next.config.mjs"))return m.info("Found nextjs project"),e?"nextjs-ts":"nextjs-js";if(n.includes("svelte.config.js"))return m.info("Found sveltekit project"),e?"sveltekit-ts":"sveltekit-js";if(n.includes("rolluconfig.js"))return m.info("Found svelte project"),e?"svelte-ts":"svelte-js";if(n.includes("vue.config.js"))return m.info("Found vue project"),e?"vue-ts":"vue-js";if(n.includes("package.json")){let i=(0,Qe.dirname)(n),o=await Ih(i);if(o){if(o.get("react"))return m.info("Found react project test"),e?"react-ts":"react-js";if(o.get("vue"))return m.info("Found vue project"),e?"vue-ts":"vue-js"}}}return"unknown"}function sj(t,e){return t==="angular-js"||t==="angular-ts"?e?"src/main.ts":"src/main.js":t==="nextjs-js"||t==="nextjs-ts"?e?"src/app/layout.tsx":"src/app/layout.js":t==="svelte-js"||t==="svelte-ts"||t==="vue-js"||t==="vue-ts"?e?"src/main.ts":"src/main.js":t==="react-js"||t==="react-ts"?e?"src/index.tsx":"src/index.js":null}async function aj(t){return t==="angular"?(m.info("Angular project detected"),"build"):t==="nuxtjs"?(m.info("Nuxtjs project detected"),"generate"):t==="nextjs"?(m.info("Nextjs project detected"),m.warn("Please make sure you have configured static export in your next.config.js: https://nextjs.org/docs/pages/building-your-application/deploying/static-exports"),m.warn("Please make sure you have the output: 'export' and distDir: 'dist' in your next.config.js"),await qe({message:"Do you want to continue?"})||(m.error("Aborted"),k.error("")),"build"):(t==="sveltekit"&&(m.info("Sveltekit project detected"),m.warn("Please make sure you have the adapter-static installed: https://kit.svelte.dev/docs/adapter-static"),m.warn("Please make sure you have the pages: 'dist' and assets: 'dest', in your svelte.config.js adaptater"),await qe({message:"Do you want to continue?"})||(m.error("Aborted"),k.error(""))),"build")}async function uj(){let t=/(main|index)\.(ts|tsx|js|jsx)$/,e="",r=(0,jt.cwd)(),n=r.split("/").length;for await(let i of cb(r))if(i.split("/").length-n<=2&&t.test(i)){e=i,m.info(`Found main file here ${i}`);break}return e}async function fb(t,e){return t.from("app_versions").upsert(e,{onConflict:"name,app_id"}).eq("app_id",e.app_id).eq("name",e.name)}async function cj(t,e,r){let n={app_id:e,name:r,version:0};try{let o=await t.functions.invoke("private/upload_link",{body:JSON.stringify(n)});if(o.error){if(o.error instanceof da.FunctionsHttpError){let s=await o.error.context.json();m.error(`Upload URL error: ${s.status||JSON.stringify(s)}`)}else m.error(`Cannot get upload url: ${o.error.message}`);return""}return o.data.url}catch(i){m.error(`Cannot get upload url ${te(i)}`)}return""}async function*lj(t){let e=(0,et.readdirSync)(t,{withFileTypes:!0});for(let r of e){let n=(0,Qe.join)(t,r.name);r.isDirectory()?yield*lj(n):yield n}}async function fj(t){let e=[];for await(let r of lj(t)){let n=(0,et.readFileSync)(r),i=await(0,Z6.checksum)(n,"sha256"),o=(0,Qe.relative)(t,r);o.startsWith("/")&&(o=o.substring(1)),e.push({file:o,hash:i})}return e}async function jh(t){return(0,Ph.platform)()==="win32"?kse(t):Ase(t)}function Ase(t){let e=new ab.default;return e.addLocalFolder(t),e.toBuffer()}async function kse(t){m.info("Zipping file windows mode");let e=new ab.default,r=(n,i)=>{let o=(0,et.readdirSync)(n);for(let s of o){let a=(0,Qe.join)(n,s),u=(0,et.statSync)(a);if(u.isFile()){let c=(0,et.readFileSync)(a);e.addFile((0,Qe.join)(i,s).split(Qe.sep).join("/"),c)}else u.isDirectory()&&r(a,(0,Qe.join)(i,s))}};return r(t,""),e.toBuffer()}async function dj(t,e,r,n,i,o,s,a){return new Promise((u,c)=>{Fe(t,{channel:"app",event:"App TUS upload",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}),new Rh.Upload(e,{endpoint:`${s.hostFilesApi}/files/upload/attachments/`,chunkSize:a||bo,metadataForPartialUploads:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/gzip"},metadata:{filename:`orgs/${r}/apps/${n}/${i}.zip`,filetype:"application/zip"},headers:{Authorization:t},onError(f){if(m.error(`Error uploading bundle: ${f.message}`),f instanceof Rh.DetailedError){let h=f.originalResponse?.getBody(),d=JSON.parse(h||'{"error": "unknown error"}');c(d.status||d.error||d.message||"unknown error")}else c(f.message||f.toString()||"unknown error")},onProgress(f,h){let d=(f/h*100).toFixed(2);o.message(`Uploaded ${d}%`)},async onSuccess(){await Fe(t,{channel:"app",event:"App TUS done",icon:"\u23EB",user_id:r,tags:{"app-id":n},notify:!1}).catch(),u(!0)}}).start()})}async function hj(t,e,r){let n={app_id:e,name:r};try{let o=await t.functions.invoke("private/delete_failed_version",{body:JSON.stringify(n),method:"DELETE"});if(o.error){if(o.error instanceof da.FunctionsHttpError){let s=await o.error.context.json();m.error(`Cannot delete failed version: ${s.status||JSON.stringify(s)}`)}else m.error(`Cannot delete failed version: ${o.error.message}`);return}return o.data?.status}catch(i){if(i instanceof da.FunctionsHttpError){let o=await i.context.json();m.error(`Cannot delete failed version: ${o.message||JSON.stringify(o)}`)}else m.error(`Cannot delete failed version: ${te(i)}`)}}async function Nh(t,e){if(!e.app_id||!e.name||!e.created_by)return m.error("missing app_id, name, or created_by"),Promise.reject(new Error("missing app_id, name, or created_by"));let{data:r,error:n}=await t.from("channels").select().eq("app_id",e.app_id).eq("name",e.name).single();return r&&!n?t.from("channels").update(e).eq("app_id",e.app_id).eq("name",e.name).select().single():t.from("channels").insert(e).select().single()}async function Fe(t,e){try{let r=await ub(),n=await Vr.post(`${r.host}/private/events`,{json:e,headers:{capgkey:t},timeout:1e4,retry:3}).json();n.error&&m.error(`Failed to send LogSnag event: ${n.error}`)}catch{}}async function ga(t,e){let{error:r,data:n}=await t.rpc("get_orgs_v6");r&&(m.error("Cannot get the list of organizations - exiting"),m.error(`Error ${JSON.stringify(r)}`),k.error(""));let i=n.filter(u=>!!e.find(c=>c===u.role));i.length===0&&(m.error(`Could not get organization with roles: ${e.join(" or ")} because the user does not have any org`),k.error(""));let o=i.length>1?await Mo({message:"Please pick the organization that you want to insert to",options:i.map(u=>({value:u.gid,label:u.name}))}):i[0].gid;kt(o)&&(m.error("Canceled organization selection, exiting"),k.error(""));let s=o,a=n.find(u=>u.gid===s);return m.info(`Using the organization "${a.name}" as the app owner`),a}var _o=t=>t.replace(/\./g,"--");async function me(t,e,r=["all"]){await Cse(t,e,r);let{data:n,error:i}=await t.rpc("get_user_id",{apikey:e}).single(),o=(n||"").toString();return(!o||i)&&(m.error("Cannot auth user with apikey"),k.error("")),o}async function Sr(t,e){let{data:r,error:n}=await t.from("apps").select("owner_org").eq("app_id",e).single();return(!r||n)&&(m.error(`Cannot get organization id for app id ${e}`),te(n),k.error("")),r.owner_org}function ya(t){return new Date(t||"").toLocaleString()}var X6=!1,fa="npm",Ic="install",sb="npx";function er(){if(X6)return{pm:fa,command:Ic,installCommand:`${fa} ${Ic}`,runner:sb};let t=$h((0,jt.cwd)());return fa=Ma(t,"npm"),Ic=gl(fa),X6=!0,sb=Kw(t),{pm:fa,command:Ic,installCommand:`${fa} ${Ic}`,runner:sb}}function pj(t){return(0,et.readdirSync)(t,{withFileTypes:!0}).flatMap(n=>{let i=(0,Qe.join)(t,n.name);return n.isDirectory()?pj(i):i.split(`node_modules${Qe.sep}`)[1]||i})}async function db(t,e){let r=e?e.split(","):[],n;try{n=await Ih("",t)}catch(l){m.error("Invalid package.json, JSON parsing failed"),console.error("json parse error: ",l),k.error("")}let i=t?.split(",")[0],o=i?Qe.default.resolve(i).replace("package.json",""):$h((0,jt.cwd)());n||(m.error("Missing dependencies section in package.json"),k.error(""));for(let[l,f]of Object.entries(n))typeof f!="string"&&(m.error(`Invalid dependency ${l}: ${f}, expected string, got ${typeof f}`),k.error(""));let s=r.length===0?[(0,Qe.join)((0,jt.cwd)(),"node_modules")]:r;if(!s.some(l=>(0,et.existsSync)(l))){let l=Ma(o,"npm"),f=gl(l);m.error(`Missing node_modules folder at ${s.join(", ")}, please run ${l} ${f}`),k.error("")}let u=!1,c=await Promise.all(Array.from(n.entries()).map(async([l,f])=>{let h=!1,d=!1;for(let p of s){let v=(0,Qe.join)(p,l);if((0,et.existsSync)(v)){h=!0;try{if(pj(v).some(w=>Ese.test(w))){d=!0;break}}catch(g){m.error(`Error reading node_modules files for ${l} package in ${p}`),console.error(g),k.error("")}}}if(!h){u=!0;let p=Ma(o,"npm"),v=gl(p);return m.error(`Missing dependency ${l}, please run ${p} ${v}`),{name:l,version:f}}return{name:l,version:f,native:d}})).catch(()=>[]);return(u||c.find(l=>l.native===void 0))&&k.error(""),c}async function Tse(t,e,r){let{data:n,error:i}=await t.from("channels").select("version(checksum)").eq("name",r).eq("app_id",e).single(),o=n;return i||o===null||!o.version||!o.version.checksum?null:o.version.checksum}async function Pse(t,e,r){let{data:n,error:i}=await t.from("channels").select(`version (
251
251
  native_packages
252
- )`).eq("name",r).eq("app_id",e).single();i&&(m.error(`Error fetching native packages: ${i.message}`),k.error(""));let o;try{o=n.version.native_packages}catch{m.error("Error parsing native packages"),k.error("")}return o||(m.error("Error parsing native packages, perhaps the metadata does not exist?"),k.error("")),o.forEach(a=>{typeof a!="object"&&(m.error(`Invalid remote native package data: ${a}, expected object, got ${typeof a}`),k.error(""));let{name:u,version:c}=a;(!u||typeof u!="string")&&(m.error(`Invalid remote native package name: ${u}, expected string, got ${typeof u}`),k.error("")),(!c||typeof c!="string")&&(m.error(`Invalid remote native package version: ${c}, expected string, got ${typeof c}`),k.error(""))}),new Map(o.map(a=>[a.name,a]))}async function m6(t,e,r,n){let i=Ee();i.start(`Checking bundle checksum compatibility with channel ${r}`);let o=await Tse(t,e,r);if(!o){i.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}o&&o===n&&(m.error(`Cannot upload the same bundle content.
252
+ )`).eq("name",r).eq("app_id",e).single();i&&(m.error(`Error fetching native packages: ${i.message}`),k.error(""));let o;try{o=n.version.native_packages}catch{m.error("Error parsing native packages"),k.error("")}return o||(m.error("Error parsing native packages, perhaps the metadata does not exist?"),k.error("")),o.forEach(a=>{typeof a!="object"&&(m.error(`Invalid remote native package data: ${a}, expected object, got ${typeof a}`),k.error(""));let{name:u,version:c}=a;(!u||typeof u!="string")&&(m.error(`Invalid remote native package name: ${u}, expected string, got ${typeof u}`),k.error("")),(!c||typeof c!="string")&&(m.error(`Invalid remote native package version: ${c}, expected string, got ${typeof c}`),k.error(""))}),new Map(o.map(a=>[a.name,a]))}async function mj(t,e,r,n){let i=Ee();i.start(`Checking bundle checksum compatibility with channel ${r}`);let o=await Tse(t,e,r);if(!o){i.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}o&&o===n&&(m.error(`Cannot upload the same bundle content.
253
253
  Current bundle checksum matches remote bundle for channel ${r}
254
254
  Did you builded your app before uploading?
255
- PS: You can ignore this check with "--ignore-checksum-check"`),k.error("")),i.stop(`Checksum compatible with ${r} channel`)}function ge(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}async function Lh(t,e,r,n,i){let o=await db(n,i),s=await Pse(t,e,r),a=o.filter(c=>!!c.native).map(c=>{let l=s.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...s].filter(([c])=>o.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return a.push(...u),{finalCompatibility:a,localDependencies:o}}async function g6(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Le(t,e,r,n){let i=er(),o=await o6(t,e,r);if(!o.okay)switch(o.error){case"INVALID_APIKEY":{m.error("Invalid apikey, such apikey does not exists!"),k.error("");break}case"NO_APP":{m.error(`App ${r} does not exist, run first \`${i.runner} @capgo/cli app add ${r}\` to create it`),k.error("");break}case"NO_ORG":{m.error("Could not find organization, please contact support to resolve this!"),k.error("");break}}let s=o.data;return n>s&&(m.error(`Insuficcent permissions for app ${r}. Current permission: ${Ft[o.data]}, required for this action: ${Ft[n]}.`),k.error("")),o.data}var xr="assets/icon.png";var q6=ce(B6(),1);function gb(t){let e=(0,q6.default)("npm",{registry:"https://registry.npmjs.org/"}),r=e[`${t}:registry`]||e.config_registry||e.registry;return r.slice(-1)==="/"?r:`${r}/`}var q8=ce(B8(),1),M8=ce(Bv(),1),Ab=class extends Error{constructor(e){super(`Package \`${e}\` could not be found`),this.name="PackageNotFoundError"}},kb=class extends Error{constructor(e,r){super(`Version \`${r}\` for package \`${e}\` could not be found`),this.name="VersionNotFoundError"}};async function Tb(t,e={}){let{version:r="latest"}=e,{omitDeprecated:n=!0}=e,i=t.split("/")[0],o=e.registryUrl??gb(i),s=new URL(encodeURIComponent(t).replace(/^%40/,"@"),o),a=(0,q8.default)(o.toString(),{recursive:!0}),u={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};e.fullMetadata&&delete u.accept,a&&(u.authorization=`${a.type} ${a.token}`);let c;try{c=await Vr(s,{headers:u,keepalive:!0}).json()}catch(f){throw f?.response?.status===404?new Ab(t):f}if(e.allVersions)return c;let l=new kb(t,r);if(c["dist-tags"][r]){let{time:f}=c;c=c.versions[c["dist-tags"][r]],c.time=f}else if(r){let f=!!c.versions[r];if(n&&!f)for(let[d,p]of Object.entries(c.versions))p.deprecated&&delete c.versions[d];if(!f){let d=Object.keys(c.versions);if(r=M8.default.maxSatisfying(d,r),!r)throw l}let{time:h}=c;if(c=c.versions[r],c.time=h,!c)throw l}return c}async function qc(t,e){let{version:r}=await Tb(t.toLowerCase(),e);return r}async function De(){let t=await qc("@capgo/cli").catch(()=>""),e=t?.split(".")[0];t!==Ir.version&&m.warning(`\u{1F6A8} You are using @capgo/cli@${Ir.version} it's not the latest version.
256
- Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function jae(t,e,r=!0){await Pb(t,e,void 0,r)}async function Pb(t,e,r,n=!0){n&&X("Adding"),await De(),e.apikey=e.apikey||pe();let i=await Q();t=ge(t,i?.config),e.apikey||(m.error("Missing API key, you need to provide a API key to upload your bundle"),k.error("")),t||(m.error("Missing argument, you need to provide a appId, or be in a capacitor project"),k.error("")),t.includes("--")&&(m.error('The app id includes illegal symbols. You cannot use "--" in the app id'),k.error(""));let o=await de(e.apikey);await me(o,e.apikey,["write","all"]),await g6(o,t)&&(t==="io.ionic.starter"?m.error(`This appId ${t} cannot be used it's reserved, please change it in your capacitor config.`):m.error(`App ${t} already exist`),k.error("")),r||(r=await ga(o,["admin","super_admin"]));let a=r.gid;await pa(o,a,e.apikey,void 0,!1);let{name:u,icon:c}=e;u=u||i.config?.appName||"Unknown",c=c||"resources/icon.png",(!c||!u)&&(m.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),k.error("")),n&&m.info(`Adding ${t} to Capgo`);let l=null,f=null;c&&(0,Sa.existsSync)(c)?(l=(0,Sa.readFileSync)(c),f=ma(c)||"image/png",m.warn(`Found app icon ${c}`)):(0,Sa.existsSync)(xr)?(l=(0,Sa.readFileSync)(xr),f=ma(xr)||"image/png",m.warn(`Found app icon ${xr}`)):m.warn(`Cannot find app icon in any of the following locations: ${c}, ${xr}`);let h="icon",d="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(l&&f){let{error:g}=await o.storage.from(`images/org/${a}/${t}`).upload(h,l,{contentType:f});g&&(console.error(g),m.error(`Could not add app ${te(g)}`),k.error(""));let{data:w}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(h);d=w?.publicUrl||d}let{error:p}=await o.from("apps").insert({icon_url:d,owner_org:a,name:u,app_id:t});p&&(m.error(`Could not add app ${te(p)}`),k.error(""));let{error:v}=await o.from("app_versions").insert([{owner_org:a,deleted:!0,name:"unknown",app_id:t},{owner_org:a,deleted:!0,name:"builtin",app_id:t}]);return v&&(m.error(`Could not add app ${te(v)}`),k.error("")),m.success(`App ${t} added to Capgo. ${n?"You can upload a bundle now":""}`),n&&(J("Done \u2705"),(0,U8.exit)()),!0}async function H8(t,e){jae(t,e,!0)}var V8=require("node:process");async function z8(t,e){X("Deleting"),e.apikey=e.apikey||pe();let r=await Q();t=ge(t,r?.config),e.apikey||(m.error("Missing API key, you need to provide a API key to upload your bundle"),k.error("")),t||(m.error("Missing argument, you need to provide a appId, or be in a capacitor project"),k.error(""));let n=await de(e.apikey),i=await me(n,e.apikey,["write","all"]);await Le(n,e.apikey,t,5);let{data:o,error:s}=await n.from("apps").select("owner_org ( created_by, id )").eq("app_id",t).single(),a=o;if(!s&&(a?.owner_org.created_by??"")!==i){m.warn("Deleting the app is not recomended for users that are not the organization owner"),m.warn("You are invited as a super_admin but your are not the owner"),m.warn("It's strongly recomended that you do not continue!");let h=await Mo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});(kt(h)||h==="no")&&(m.error("Canceled deleting the app, exiting"),k.error(""))}else s&&m.warn(`Cannot get the app owner ${te(s)}`);let{error:u}=await n.storage.from("images").remove([`org/${a?.owner_org.id}/${t}/icon`]);u&&(console.error(u,`images/org/${a?.owner_org.id}/${t}`),m.error("Could not delete app logo"));let{error:c}=await n.storage.from(`apps/${t}/${i}`).remove(["versions"]);c&&m.error("Could not delete app version");let{error:l}=await n.from("apps").delete().eq("app_id",t);l&&(m.error("Could not delete app"),k.error(""));let f=await Sr(n,t);await Fe(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:f,tags:{"app-id":t},notify:!1}).catch(),m.success("App deleted in Capgo"),J("Done \u2705"),(0,V8.exit)()}var Zh=require("node:os"),xa=require("node:process");async function Nae(t){let e={},r=[];for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.push(qc(n));return await Promise.all(r).then(n=>{let i=Object.keys(t);for(let o=0;o<n.length;o+=1){let s=n[o];s&&(e[i[o]]=s)}}),e}async function Lae(){let{dependencies:t}=await Er(),e={"@capgo/cli":Ir.version};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&r.startsWith("@capgo/")&&r.startsWith("@capawesome/")&&r.startsWith("capacitor")){let n=t[r].replace("^","").replace("~","");e[r]=n}return e}async function G8(t){m.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let e=await Q(),r=await Er("",t.packageJson),n=e?.config?.plugins?.CapacitorUpdater?.version||r?.version,i=e?.config?.appName||"";m.info(` App Name: ${i}`);let o=ge("",e?.config);m.info(` App ID: ${o}`),m.info(` App Version: ${n}`);let s=e?.config?.webDir||"";m.info(` Web Dir: ${s}`),m.info(` OS: ${(0,Zh.platform)()} ${(0,Zh.version)()}`),m.info(` Node: ${xa.version}`),m.info(" Installed Dependencies:");let a=await Lae();Object.keys(a).length===0&&(m.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),(0,xa.exit)(1));for(let l in a)if(Object.prototype.hasOwnProperty.call(a,l)){let f=a[l];m.info(` ${l}: ${f}`)}let u=Ee();u.start("Running: Loading latest dependencies");let c=await Nae(a);u.stop("Latest Dependencies:");for(let l in c)if(Object.prototype.hasOwnProperty.call(c,l)){let f=c[l];m.info(` ${l}: ${f}`)}JSON.stringify(a)!==JSON.stringify(c)&&(m.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),(0,xa.exit)(1)),m.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),(0,xa.exit)()}var Rb=require("node:process");function W8(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),i="\x1B[";return i+n+"m"+e+i+"0m"}var lr=class t{title=null;headers=[];rows=[];static narrowTheme={top:["\u2554","\u2550","\u2564","\u2557"],row:["\u2551"," ","\u2502","\u2551"],div:["\u255F","\u2500","\u253C","\u2562"],bot:["\u255A","\u2550","\u2567","\u255D"]};static wideTheme={top:["\u2554\u2550","\u2550","\u2550\u2564\u2550","\u2550\u2557"],row:["\u2551 "," "," \u2502 "," \u2551"],div:["\u255F\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2562"],bot:["\u255A\u2550","\u2550","\u2550\u2567\u2550","\u2550\u255D"]};static roundTheme={top:["\u256D\u2500","\u2500","\u2500\u252C\u2500","\u2500\u256E"],row:["\u2502 "," "," \u2502 "," \u2502"],div:["\u251C\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2524"],bot:["\u2570\u2500","\u2500","\u2500\u2534\u2500","\u2500\u256F"]};theme=t.wideTheme;columnWidth(){let e=[this.headers,...this.rows].filter(n=>n.length>0),r=e[0].map(n=>this.cast(n).length);for(let n of e.slice(1))for(let i=0;i<r.length;i++){let o=this.cast(n[i]).length;o>r[i]&&(r[i]=o)}return r}cast(e){return typeof e=="object"?"obj":e!==void 0&&typeof e.toString=="function"?e.toString():""}renderTitle(){return"[ "+this.title+" ]"}renderLine(e){let r=this.columnWidth();return e[0]+r.map(n=>e[1].repeat(n)).join(e[2])+e[3]}renderCell(e,r,n=!1){let i=this.cast(e),o=n?W8("bold",i):i,s=r-i.length,a=this.theme.row[1];switch(typeof e){case"number":return a.repeat(s)+o;case"string":return o+a.repeat(s);case"boolean":case"object":return a.repeat(Math.ceil(s/2))+W8("italic",i)+a.repeat(Math.floor(s/2));default:return a.repeat(s)}}renderRow(e,r=!1){let n=this.theme.row,i=this.columnWidth();return n[0]+e.map((o,s)=>this.renderCell(o,i[s],r)).join(n[2])+n[3]}toString(){let e=this.theme,r=this.headers.length>0,n=this.rows.length>0;return[this.title?this.renderTitle():"",r||n?this.renderLine(e.top):"",r?this.renderRow(this.headers,!0):"",r&&n?this.renderLine(e.div):"",...this.rows.map(i=>this.renderRow(i)),r||n?this.renderLine(e.bot):""].filter(i=>i.length>0).join(`
255
+ PS: You can ignore this check with "--ignore-checksum-check"`),k.error("")),i.stop(`Checksum compatible with ${r} channel`)}function ge(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}async function Lh(t,e,r,n,i){let o=await db(n,i),s=await Pse(t,e,r),a=o.filter(c=>!!c.native).map(c=>{let l=s.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...s].filter(([c])=>o.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return a.push(...u),{finalCompatibility:a,localDependencies:o}}async function gj(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Le(t,e,r,n){let i=er(),o=await oj(t,e,r);if(!o.okay)switch(o.error){case"INVALID_APIKEY":{m.error("Invalid apikey, such apikey does not exists!"),k.error("");break}case"NO_APP":{m.error(`App ${r} does not exist, run first \`${i.runner} @capgo/cli app add ${r}\` to create it`),k.error("");break}case"NO_ORG":{m.error("Could not find organization, please contact support to resolve this!"),k.error("");break}}let s=o.data;return n>s&&(m.error(`Insuficcent permissions for app ${r}. Current permission: ${Ft[o.data]}, required for this action: ${Ft[n]}.`),k.error("")),o.data}var xr="assets/icon.png";var qj=ce(Bj(),1);function gb(t){let e=(0,qj.default)("npm",{registry:"https://registry.npmjs.org/"}),r=e[`${t}:registry`]||e.config_registry||e.registry;return r.slice(-1)==="/"?r:`${r}/`}var q8=ce(B8(),1),M8=ce(Bv(),1),Ab=class extends Error{constructor(e){super(`Package \`${e}\` could not be found`),this.name="PackageNotFoundError"}},kb=class extends Error{constructor(e,r){super(`Version \`${r}\` for package \`${e}\` could not be found`),this.name="VersionNotFoundError"}};async function Tb(t,e={}){let{version:r="latest"}=e,{omitDeprecated:n=!0}=e,i=t.split("/")[0],o=e.registryUrl??gb(i),s=new URL(encodeURIComponent(t).replace(/^%40/,"@"),o),a=(0,q8.default)(o.toString(),{recursive:!0}),u={accept:"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"};e.fullMetadata&&delete u.accept,a&&(u.authorization=`${a.type} ${a.token}`);let c;try{c=await Vr(s,{headers:u,keepalive:!0}).json()}catch(f){throw f?.response?.status===404?new Ab(t):f}if(e.allVersions)return c;let l=new kb(t,r);if(c["dist-tags"][r]){let{time:f}=c;c=c.versions[c["dist-tags"][r]],c.time=f}else if(r){let f=!!c.versions[r];if(n&&!f)for(let[d,p]of Object.entries(c.versions))p.deprecated&&delete c.versions[d];if(!f){let d=Object.keys(c.versions);if(r=M8.default.maxSatisfying(d,r),!r)throw l}let{time:h}=c;if(c=c.versions[r],c.time=h,!c)throw l}return c}async function qc(t,e){let{version:r}=await Tb(t.toLowerCase(),e);return r}async function De(){let t=await qc("@capgo/cli").catch(()=>""),e=t?.split(".")[0];t!==Ir.version&&m.warning(`\u{1F6A8} You are using @capgo/cli@${Ir.version} it's not the latest version.
256
+ Please use @capgo/cli@${t}" or @capgo/cli@${e} to keep up to date with the latest features and bug fixes.`)}async function jae(t,e,r=!0){await Pb(t,e,void 0,r)}async function Pb(t,e,r,n=!0){n&&X("Adding"),await De(),e.apikey=e.apikey||pe();let i=await Q();t=ge(t,i?.config),e.apikey||(m.error("Missing API key, you need to provide a API key to upload your bundle"),k.error("")),t||(m.error("Missing argument, you need to provide a appId, or be in a capacitor project"),k.error("")),t.includes("--")&&(m.error('The app id includes illegal symbols. You cannot use "--" in the app id'),k.error(""));let o=await de(e.apikey);await me(o,e.apikey,["write","all"]),await gj(o,t)&&(t==="io.ionic.starter"?m.error(`This appId ${t} cannot be used it's reserved, please change it in your capacitor config.`):m.error(`App ${t} already exist`),k.error("")),r||(r=await ga(o,["admin","super_admin"]));let a=r.gid;await pa(o,a,e.apikey,void 0,!1);let{name:u,icon:c}=e;u=u||i.config?.appName||"Unknown",c=c||"resources/icon.png",(!c||!u)&&(m.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),k.error("")),n&&m.info(`Adding ${t} to Capgo`);let l=null,f=null;c&&(0,Sa.existsSync)(c)?(l=(0,Sa.readFileSync)(c),f=ma(c)||"image/png",m.warn(`Found app icon ${c}`)):(0,Sa.existsSync)(xr)?(l=(0,Sa.readFileSync)(xr),f=ma(xr)||"image/png",m.warn(`Found app icon ${xr}`)):m.warn(`Cannot find app icon in any of the following locations: ${c}, ${xr}`);let h="icon",d="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(l&&f){let{error:g}=await o.storage.from(`images/org/${a}/${t}`).upload(h,l,{contentType:f});g&&(console.error(g),m.error(`Could not add app ${te(g)}`),k.error(""));let{data:w}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(h);d=w?.publicUrl||d}let{error:p}=await o.from("apps").insert({icon_url:d,owner_org:a,name:u,app_id:t});p&&(m.error(`Could not add app ${te(p)}`),k.error(""));let{error:v}=await o.from("app_versions").insert([{owner_org:a,deleted:!0,name:"unknown",app_id:t},{owner_org:a,deleted:!0,name:"builtin",app_id:t}]);return v&&(m.error(`Could not add app ${te(v)}`),k.error("")),m.success(`App ${t} added to Capgo. ${n?"You can upload a bundle now":""}`),n&&(J("Done \u2705"),(0,U8.exit)()),!0}async function H8(t,e){jae(t,e,!0)}var V8=require("node:process");async function z8(t,e){X("Deleting"),e.apikey=e.apikey||pe();let r=await Q();t=ge(t,r?.config),e.apikey||(m.error("Missing API key, you need to provide a API key to upload your bundle"),k.error("")),t||(m.error("Missing argument, you need to provide a appId, or be in a capacitor project"),k.error(""));let n=await de(e.apikey),i=await me(n,e.apikey,["write","all"]);await Le(n,e.apikey,t,5);let{data:o,error:s}=await n.from("apps").select("owner_org ( created_by, id )").eq("app_id",t).single(),a=o;if(!s&&(a?.owner_org.created_by??"")!==i){m.warn("Deleting the app is not recomended for users that are not the organization owner"),m.warn("You are invited as a super_admin but your are not the owner"),m.warn("It's strongly recomended that you do not continue!");let h=await Mo({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});(kt(h)||h==="no")&&(m.error("Canceled deleting the app, exiting"),k.error(""))}else s&&m.warn(`Cannot get the app owner ${te(s)}`);let{error:u}=await n.storage.from("images").remove([`org/${a?.owner_org.id}/${t}/icon`]);u&&(console.error(u,`images/org/${a?.owner_org.id}/${t}`),m.error("Could not delete app logo"));let{error:c}=await n.storage.from(`apps/${t}/${i}`).remove(["versions"]);c&&m.error("Could not delete app version");let{error:l}=await n.from("apps").delete().eq("app_id",t);l&&(m.error("Could not delete app"),k.error(""));let f=await Sr(n,t);await Fe(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:f,tags:{"app-id":t},notify:!1}).catch(),m.success("App deleted in Capgo"),J("Done \u2705"),(0,V8.exit)()}var Zh=require("node:os"),xa=require("node:process");async function Nae(t){let e={},r=[];for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.push(qc(n));return await Promise.all(r).then(n=>{let i=Object.keys(t);for(let o=0;o<n.length;o+=1){let s=n[o];s&&(e[i[o]]=s)}}),e}async function Lae(){let{dependencies:t}=await Er(),e={"@capgo/cli":Ir.version};for(let r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&r.startsWith("@capgo/")&&r.startsWith("@capawesome/")&&r.startsWith("capacitor")){let n=t[r].replace("^","").replace("~","");e[r]=n}return e}async function G8(t){m.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let e=await Q(),r=await Er("",t.packageJson),n=e?.config?.plugins?.CapacitorUpdater?.version||r?.version,i=e?.config?.appName||"";m.info(` App Name: ${i}`);let o=ge("",e?.config);m.info(` App ID: ${o}`),m.info(` App Version: ${n}`);let s=e?.config?.webDir||"";m.info(` Web Dir: ${s}`),m.info(` OS: ${(0,Zh.platform)()} ${(0,Zh.version)()}`),m.info(` Node: ${xa.version}`),m.info(" Installed Dependencies:");let a=await Lae();Object.keys(a).length===0&&(m.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),(0,xa.exit)(1));for(let l in a)if(Object.prototype.hasOwnProperty.call(a,l)){let f=a[l];m.info(` ${l}: ${f}`)}let u=Ee();u.start("Running: Loading latest dependencies");let c=await Nae(a);u.stop("Latest Dependencies:");for(let l in c)if(Object.prototype.hasOwnProperty.call(c,l)){let f=c[l];m.info(` ${l}: ${f}`)}JSON.stringify(a)!==JSON.stringify(c)&&(m.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),(0,xa.exit)(1)),m.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),(0,xa.exit)()}var Rb=require("node:process");function W8(t,e){let n=["normal","bold","dim","italic","underline","strikethrough"].indexOf(t),i="\x1B[";return i+n+"m"+e+i+"0m"}var lr=class t{title=null;headers=[];rows=[];static narrowTheme={top:["\u2554","\u2550","\u2564","\u2557"],row:["\u2551"," ","\u2502","\u2551"],div:["\u255F","\u2500","\u253C","\u2562"],bot:["\u255A","\u2550","\u2567","\u255D"]};static wideTheme={top:["\u2554\u2550","\u2550","\u2550\u2564\u2550","\u2550\u2557"],row:["\u2551 "," "," \u2502 "," \u2551"],div:["\u255F\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2562"],bot:["\u255A\u2550","\u2550","\u2550\u2567\u2550","\u2550\u255D"]};static roundTheme={top:["\u256D\u2500","\u2500","\u2500\u252C\u2500","\u2500\u256E"],row:["\u2502 "," "," \u2502 "," \u2502"],div:["\u251C\u2500","\u2500","\u2500\u253C\u2500","\u2500\u2524"],bot:["\u2570\u2500","\u2500","\u2500\u2534\u2500","\u2500\u256F"]};theme=t.wideTheme;columnWidth(){let e=[this.headers,...this.rows].filter(n=>n.length>0),r=e[0].map(n=>this.cast(n).length);for(let n of e.slice(1))for(let i=0;i<r.length;i++){let o=this.cast(n[i]).length;o>r[i]&&(r[i]=o)}return r}cast(e){return typeof e=="object"?"obj":e!==void 0&&typeof e.toString=="function"?e.toString():""}renderTitle(){return"[ "+this.title+" ]"}renderLine(e){let r=this.columnWidth();return e[0]+r.map(n=>e[1].repeat(n)).join(e[2])+e[3]}renderCell(e,r,n=!1){let i=this.cast(e),o=n?W8("bold",i):i,s=r-i.length,a=this.theme.row[1];switch(typeof e){case"number":return a.repeat(s)+o;case"string":return o+a.repeat(s);case"boolean":case"object":return a.repeat(Math.ceil(s/2))+W8("italic",i)+a.repeat(Math.floor(s/2));default:return a.repeat(s)}}renderRow(e,r=!1){let n=this.theme.row,i=this.columnWidth();return n[0]+e.map((o,s)=>this.renderCell(o,i[s],r)).join(n[2])+n[3]}toString(){let e=this.theme,r=this.headers.length>0,n=this.rows.length>0;return[this.title?this.renderTitle():"",r||n?this.renderLine(e.top):"",r?this.renderRow(this.headers,!0):"",r&&n?this.renderLine(e.div):"",...this.rows.map(i=>this.renderRow(i)),r||n?this.renderLine(e.bot):""].filter(i=>i.length>0).join(`
257
257
  `)}};function Bae(t){t.length||(m.error("No apps found"),(0,Rb.exit)(1));let e=new lr;e.headers=["Name","id","Created"],e.rows=[],t.reverse().forEach(r=>{e.rows.push([r.name??"",r.app_id,ya(r.created_at)])}),m.success("Apps"),m.success(e.toString())}async function qae(t){let{data:e,error:r}=await t.from("apps").select().order("created_at",{ascending:!1});return r&&(m.error("Apps not found"),k.error("")),e}async function K8(t){X("List apps in Capgo"),await De(),t.apikey=t.apikey||pe();let e=await de(t.apikey);await me(e,t.apikey,["write","all","read","upload"]),m.info("Getting active bundle in Capgo");let r=await qae(e);m.info(`Active app in Capgo: ${r?.length}`),Bae(r),J("Done \u2705"),(0,Rb.exit)()}var Y8=require("node:crypto"),Fa=require("node:fs"),J8=require("node:process");async function X8(t,e){X("Set app"),e.apikey=e.apikey||pe();let r=await Q();t=ge(t,r?.config),e.apikey||(m.error("Missing API key, you need to provide a API key to upload your bundle"),k.error("")),t||(m.error("Missing argument, you need to provide a appId, or be in a capacitor project"),k.error(""));let n=await de(e.apikey),o=(await ga(n,["admin","super_admin"])).gid,s=await me(n,e.apikey,["write","all"]);await Le(n,e.apikey,t,4);let{name:a,icon:u,retention:c}=e;c&&Number.isNaN(Number(c))?(m.error("retention value must be a number"),k.error("")):c&&c<0&&(m.error("retention value cannot be less than 0"),k.error(""));let l,f,h=`icon_${(0,Y8.randomUUID)()}`,d="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(u&&(0,Fa.existsSync)(u)?(l=(0,Fa.readFileSync)(u),f=ma(u)||"image/png",m.warn(`Found app icon ${u}`)):(0,Fa.existsSync)(xr)?(l=(0,Fa.readFileSync)(xr),f=ma(xr)||"image/png",m.warn(`Found app icon ${xr}`)):m.warn(`Cannot find app icon in any of the following locations: ${u}, ${xr}`),l&&f){let{error:v}=await n.storage.from(`images/org/${o}/${t}`).upload(h,l,{contentType:f});v&&(m.error(`Could not set app ${te(v)}`),k.error(""));let{data:g}=await n.storage.from(`images/org/${o}/${t}`).getPublicUrl(h);d=g?.publicUrl||d}let{error:p}=await n.from("apps").update({icon_url:d,name:a,retention:c?c*24*60*60:void 0}).eq("app_id",t).eq("user_id",s);p&&(m.error(`Could not set app ${te(p)}`),k.error("")),J("Done \u2705"),(0,J8.exit)()}var Oa=require("node:process");async function Z8(t,e){X("Set a specific setting in capacitor config"),e.bool&&e.string&&(m.error("Bool and string CANNOT be set at the same time"),(0,Oa.exit)(1)),!e.bool&&!e.string&&(m.error("You MUST provide either bool or string as the value"),(0,Oa.exit)(1)),e.bool&&e.bool!=="true"&&e.bool!=="false"&&(m.error("Invalid bool"),(0,Oa.exit)(1));try{let r=await Q(),n=r.config,i=t.split(".");i.length===0&&(m.error("Invalid path"),(0,Oa.exit)(1));for(let s of i.slice(0,-1))Object.prototype.hasOwnProperty.call(n,s)||(n[s]={}),n=n[s];let o=e.bool?e.bool==="true":e.string;n[i.at(-1)]=o,await on(r,!0),m.success(`Set "${t}" to "${o}"`)}catch(r){m.error(`Cannot set config in capacitor settings ${te(r)}`),(0,Oa.exit)(1)}J("Done \u2705")}var Hb=require("node:process");function Qh(t,e){if(isNaN(t)||isNaN(e))throw new Error("Cannot compare against non-numbers");return t===e?0:t<e?-1:1}function tN(t=[],e=[]){return t.length&&!e.length?-1:!t.length&&e.length?1:0}function Ib(t=[],e=[]){let r=Math.max(t.length,e.length);for(let n=0;n<r;n++){let i=t[n],o=e[n];if(i===void 0&&o===void 0)return 0;if(o===void 0)return 1;if(i===void 0)return-1;if(typeof i=="string"&&typeof o=="number")return 1;if(typeof i=="number"&&typeof o=="string"||i<o)return-1;if(i>o)return 1}return 0}var Aa="0|[1-9]\\d*",Mae="\\d*[a-zA-Z-][a-zA-Z0-9-]*",Uae=`(?<major>${Aa})\\.(?<minor>${Aa})\\.(?<patch>${Aa})`,Q8=`(?:${Aa}|${Mae})`,rN=`(?:-(?<prerelease>${Q8}(?:\\.${Q8})*))`,eN="[0-9A-Za-z-]+",nN=`(?:\\+(?<buildmetadata>${eN}(?:\\.${eN})*))`,iN=`v?${Uae}${rN}?${nN}?`,oN=new RegExp(`^${iN}$`),sN="(?:<|>)?=?",Hae="x|X|\\*",$b=`${Aa}|${Hae}`,aN=`[v=\\s]*(?<major>${$b})(?:\\.(?<minor>${$b})(?:\\.(?<patch>${$b})${rN}?${nN}?)?)?`,Vae=new RegExp(`^(?<operator>~>?|\\^|${sN})\\s*${aN}$`),zae=new RegExp(`^(?<operator>${sN})\\s*(${iN})$|^$`);function jb(t){return typeof t=="number"&&!Number.isNaN(t)&&(!Number.isFinite(t)||0<=t&&t<=Number.MAX_SAFE_INTEGER)}var Nb=256;var Gae=new RegExp(`^${Aa}$`);function Lb(t){return t.split(".").filter(Boolean).map(e=>{if(Gae.test(e)){let r=Number(e);if(jb(r))return r}return e})}function Mc(t){return t.split(".").filter(Boolean)}function Uc(t,e){let r=Number(t);if(!jb(r))throw new TypeError(e);return r}function Fr(t,e){return t===e?0:Qh(t.major,e.major)||Qh(t.minor,e.minor)||Qh(t.patch,e.patch)||tN(t.prerelease,e.prerelease)||Ib(t.prerelease,e.prerelease)}function Bb(t){return t.toFixed(0)}function ka(t){let e=Bb(t.major),r=Bb(t.minor),n=Bb(t.patch),i=t.prerelease?.join(".")??"",o=t.build?.join(".")??"";return[[`${e}.${r}.${n}`,i].filter(u=>u).join("-"),o].filter(u=>u).join("+")}function Wae(t=[]){let e=[...t],r=e.length;for(;r>=0;){let n=e[r];if(typeof n=="number"){e[r]=n+1;break}r-=1}return r===-1&&e.push(0),e}function Hc(t=[],e){let r=Wae(t);return e&&(r[0]!==e||isNaN(r[1]))&&(r=[e,0]),r}function cN(t,e,r={}){let n=r.build!==void 0?Mc(r.build):t.build??[];switch(e){case"premajor":return{major:t.major+1,minor:0,patch:0,prerelease:Hc(t.prerelease,r.prerelease),build:n};case"preminor":return{major:t.major,minor:t.minor+1,patch:0,prerelease:Hc(t.prerelease,r.prerelease),build:n};case"prepatch":return{major:t.major,minor:t.minor,patch:t.patch+1,prerelease:Hc(t.prerelease,r.prerelease),build:n};case"prerelease":{let o=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:o,prerelease:Hc(t.prerelease,r.prerelease),build:n}}case"major":return{major:(t.prerelease??[]).length===0||t.minor!==0||t.patch!==0?t.major+1:t.major,minor:0,patch:0,prerelease:[],build:n};case"minor":{let o=(t.prerelease??[]).length===0||t.patch!==0?t.minor+1:t.minor;return{major:t.major,minor:o,patch:0,prerelease:[],build:n}}case"patch":{let o=(t.prerelease??[]).length===0?t.patch+1:t.patch;return{major:t.major,minor:t.minor,patch:o,prerelease:[],build:n}}case"pre":return{major:t.major,minor:t.minor,patch:t.patch,prerelease:Hc(t.prerelease,r.prerelease),build:n};default:throw new TypeError(`Cannot increment version: invalid argument ${e}`)}}var qb={major:Number.NaN,minor:Number.NaN,patch:Number.NaN,prerelease:[],build:[]},lN={operator:void 0,...qb};function Mb(t,e){return Fr(t,e)>0}function Ta(t,e){return Fr(t,e)<0}function Bn(t){if(typeof t!="string")throw new TypeError(`Cannot parse version as version must be a string: received ${typeof t}`);if(t.length>Nb)throw new TypeError(`Cannot parse version as version length is too long: length is ${t.length}, max length is ${Nb}`);t=t.trim();let e=t.match(oN)?.groups;if(!e)throw new TypeError(`Cannot parse version: ${t}`);let r=Uc(e.major,`Cannot parse version ${t}: invalid major version`),n=Uc(e.minor,`Cannot parse version ${t}: invalid minor version`),i=Uc(e.patch,`Cannot parse version ${t}: invalid patch version`),o=e.prerelease?Lb(e.prerelease):[],s=e.buildmetadata?Mc(e.buildmetadata):[];return{major:r,minor:n,patch:i,prerelease:o,build:s}}var DN=require("node:process");var dN=require("node:process");async function hN(t,e,r){let{data:n,error:i}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(i&&(m.error(`Cannot check Version ${e}@${r.name}`),k.error("")),n&&n.length>0){if(X(`\u274C Version ${e}@${r.name} is used in ${n.length} channel`),await qe({message:"unlink it?"}))for(let o of n){let s=Ee();s.start(`Unlinking channel ${o.name}`);let{error:a}=await t.from("channels").update({version:(await Ub(t,e))?.id}).eq("id",o.id);a&&(s.stop(`Cannot update channel ${o.name} ${te(a)}`),(0,dN.exit)(1)),s.stop(`\u2705 Channel ${o.name} unlinked`)}else m.error("Unlink it first"),k.error("");J(`Version unlinked from ${n.length} channel`)}}function Ub(t,e){return t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").throwOnError().single().then(({data:r,error:n})=>(n&&(m.error(`Cannot call findUnknownVersion as it returned an error.
258
258
  ${te(n)}`),k.error("")),r))}function pN(t,e){return t.from("channels").insert(e).select().single()}function mN(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function gN(t){let e=new lr;e.theme=lr.roundTheme,e.headers=["Name","Version","Public","iOS","Android","Auto Update","Native Auto Update","Device Self Set","Progressive Deploy","Secondary Version","Secondary Version Percentage","AB Testing","AB Testing Version","AB Testing Percentage","Emulator","Dev"],e.rows=[["a",0,!0],["bb",10,!1]],t.reverse().forEach(r=>{e.rows.push([r.name,r.version?.name,r.public?"\u2705":"\u274C",r.ios?"\u2705":"\u274C",r.android?"\u2705":"\u274C",r.disable_auto_update,r.disable_auto_update_under_native?"\u274C":"\u2705",r.allow_device_self_set?"\u2705":"\u274C",r.allow_emulator?"\u2705":"\u274C",r.allow_dev?"\u2705":"\u274C"])}),m.success("Channels"),m.success(e.toString())}async function yN(t,e){let{data:r,error:n}=await t.from("channels").select(`
259
259
  id,
@@ -279,7 +279,7 @@ ${te(n)}`),k.error("")),r))}function pN(t,e){return t.from("channels").insert(e)
279
279
  `)+`
280
280
  `),u.push(n.join(";").toLowerCase()),u.push(i),u.join(`
281
281
  `)}async function KN(t,e,r){let n=await gp(t),i=Kb(r,e),o=[];return o.push(Yb),o.push(Kc(e)),o.push(i),o.push(n),o.join(`
282
- `)}async function YN(t,e,r){let n=Wb(t),i=await Pa("AWS4"+r,n),o=await Pa(i,e),s=await Pa(o,"s3");return await Pa(s,"aws4_request")}function JN(t,e,r){return`${t}/${Kb(e,r)}`}async function Pa(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),i=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(i)}var iue=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],oue=5*1024*1024,sue=5*1024*1024*1024,Jb=5*1024*1024*1024*1024,Yc=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;constructor(e){if(e.useSSL===void 0&&(e.useSSL=!0),typeof e.endPoint!="string"||e.endPoint.length===0||e.endPoint.indexOf("/")!==-1)throw new hp(`Invalid endPoint : ${e.endPoint}`);if(e.port!==void 0&&!UN(e.port))throw new Or(`Invalid port : ${e.port}`);if(e.accessKey&&!e.secretKey)throw new Or("If specifying access key, secret key must also be provided.");if(e.accessKey&&e.accessKey.startsWith("ASIA")&&!e.sessionToken)throw new Or("If specifying temporary access key, session token must also be provided.");let r=e.useSSL?443:80;this.port=e.port??r,this.host=e.endPoint.toLowerCase()+(this.port!==r?`:${e.port}`:""),this.protocol=e.useSSL?"https:":"http:",this.accessKey=e.accessKey,this.#e=e.secretKey??"",this.sessionToken=e.sessionToken,this.pathStyle=e.pathStyle??!0,this.defaultBucket=e.bucket,this.region=e.region}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!HN(r))throw new pp(`Invalid bucket name: ${r}`);return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,i=e.headers??new Headers;i.set("host",n);let o=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,s=(this.pathStyle?`/${r}/${e.objectName}`:`/${e.objectName}`)+(o?`?${o}`:"");return{headers:i,host:n,path:s}}async makeRequest({method:e,payload:r,...n}){let i=new Date,{headers:o,host:s,path:a}=this.buildRequestOptions(n),u=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),o.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let c=await gp(r??new Uint8Array);o.set("x-amz-date",Kc(i)),o.set("x-amz-content-sha256",c),this.accessKey&&(this.sessionToken&&o.set("x-amz-security-token",this.sessionToken),o.set("authorization",await VN({headers:o,method:e,path:a,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:i})));let l=`${this.protocol}//${s}${a}`,f=await fetch(l,{method:e,headers:o,body:r});if(f.status!==u)throw f.status>=400?await MN(f):f.status===301?new Un(f.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new Un(f.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${u}, got ${f.status} ${f.statusText}).`);return n.returnBody||await f.body?.getReader().read(),f}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!$o(e))throw new Mn(`Invalid object name: ${e}`);let i=r.versionId?{versionId:r.versionId}:{},o=new Headers;r.governanceBypass&&o.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:o,query:i,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof Un&&n.statusCode===404)return!1;throw n}}getObject(e,r){return this.getPartialObject(e,{...r,offset:0,length:0})}async getPartialObject(e,{offset:r,length:n,...i}){let o=this.getBucketName(i);if(!$o(e))throw new Mn(`Invalid object name: ${e}`);let s=new Headers(Object.entries(i.metadata??{})),a=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),s.set("Range",c),a=206}let u={...i.responseParams,...i.versionId?{versionId:i.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:o,objectName:e,headers:s,query:u,statusCode:a,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new Ro(`Presigned ${e} URLs cannot be generated for anonymous requests. Specify an accessKey and secretKey.`);if(!$o(r))throw new Mn(`Invalid object name: ${r}`);let{headers:i,path:o}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),s=n.requestDate??new Date,a=n.expirySeconds??24*60*60*7;return zN({protocol:this.protocol,headers:i,method:e,path:o,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:s,expirySeconds:a})}presignedGetObject(e,r={}){let{versionId:n,responseParams:i,...o}=r,s={...i,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:s,...o})}async*listObjects(e={}){for await(let r of this.listObjectsGrouped({...e,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(e){let r=this.getBucketName(e),n="",i=e.pageSize??1e3;if(i<1||i>1e3)throw new Or("pageSize must be between 1 and 1,000.");let o=0;for(;;){let s=e.maxResults?Math.min(i,e.maxResults-o):i;if(s===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:e.prefix??"",delimiter:e.delimiter,"max-keys":String(s),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=Ei(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(d=>d.name==="CommonPrefixes").flatMap(d=>d.children),f=[];for(let d of l)f.push({type:"CommonPrefix",prefix:d.content??""}),o++;for(let d of c.children.filter(p=>p.name==="Contents"))f.push({type:"Object",key:d.children.find(p=>p.name==="Key")?.content??"",etag:Io(d.children.find(p=>p.name==="ETag")?.content??""),size:parseInt(d.children.find(p=>p.name==="Size")?.content??"",10),lastModified:new Date(d.children.find(p=>p.name==="LastModified")?.content??"invalid")}),o++;f.sort((d,p)=>{let v=d.type==="Object"?d.key:d.prefix,g=p.type==="Object"?p.key:p.prefix;return v>g?1:v<g?-1:0});for(let d of f)yield d;if(c.children.find(d=>d.name==="IsTruncated")?.content==="true"){let d=c.children.find(p=>p.name==="NextContinuationToken")?.content;if(!d)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=d}else return}}async putObject(e,r,n){let i=this.getBucketName(n);if(!$o(e))throw new Mn(`Invalid object name: ${e}`);let o,s;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?s=ReadableStream.from([l]):s=new ReadableStream({start(f){f.enqueue(l),f.close()}}),o=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?s=ReadableStream.from([r]):s=new ReadableStream({start(l){l.enqueue(r),l.close()}}),o=r.byteLength;else if(r instanceof ReadableStream)s=r;else throw new Or("Invalid stream/data type provided.");if(n?.size!==void 0){if(o!==void 0&&n?.size!==o)throw new Or(`size was specified (${n.size}) but doesn't match auto-detected size (${o}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Or(`invalid size specified: ${n.size}`);o=n.size}let a=n?.partSize??this.calculatePartSize(o);if(a<oue)throw new Or("Part size should be greater than 5MB");if(a>sue)throw new Or("Part size should be less than 6MB");let u=new dp(a),c=new yp({client:this,bucketName:i,objectName:e,partSize:a,metadata:n?.metadata??{}});return await s.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=Jb),e>Jb)throw new TypeError(`size should not be more than ${Jb}`);let r=64*1024*1024;for(;;){if(r*1e4>e)return r;r+=16*1024*1024}}async statObject(e,r){let n=this.getBucketName(r);if(!$o(e))throw new Mn(`Invalid object name: ${e}`);let i={};r?.versionId&&(i.versionId=r.versionId);let o=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:i}),s={};for(let a of iue)o.headers.has(a)&&(s[a]=o.headers.get(a));return o.headers.forEach((a,u)=>{u.startsWith("x-amz-meta-")&&(s[u]=o.headers.get(u))}),{type:"Object",key:e,size:parseInt(o.headers.get("content-length")??"",10),metadata:s,lastModified:new Date(o.headers.get("Last-Modified")??"error: missing last modified"),versionId:o.headers.get("x-amz-version-id")||null,etag:Io(o.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),o=e.sourceBucketName??i;if(!$o(r))throw new Mn(`Invalid object name: ${r}`);let s=`${o}/${e.sourceKey}`;e.sourceVersionId&&(s+=`?versionId=${e.sourceVersionId}`);let a=new Headers(n?.metadata);n?.metadata!==void 0&&a.set("x-amz-metadata-directive","REPLACE"),a.set("x-amz-copy-source",s);let u=await this.makeRequest({method:"PUT",bucketName:i,objectName:r,headers:a,returnBody:!0}),c=await u.text(),l=Ei(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let f=l.children.find(d=>d.name==="ETag")?.content??"",h=l.children.find(d=>d.name==="LastModified")?.content;if(h===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:Io(f),lastModified:new Date(h),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof Un&&r.statusCode===404)return!1;throw r}}async makeBucket(e){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:200})}async removeBucket(e){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:204})}};var Xb=ce(bu());var No=require("node:fs"),Dp=require("node:path");function aue(t,e){return(0,No.readFileSync)(t,"utf8").includes(e)}function Jc(t,e){let r=(0,No.readdirSync)(t);for(let n of r){let i=(0,Dp.join)(t,n),o=(0,No.statSync)(i);if(o.isDirectory()){if(Jc(i,e))return!0}else if(o.isFile()&&(0,Dp.extname)(i)===".js"&&aue(i,e))return!0}return!1}function vp(t){return(0,No.readdirSync)(t).indexOf("index.html")>-1}var XN=require("node:fs"),ZN=require("node:os"),Lo=require("node:path"),QN=require("node:stream/consumers"),eL=require("node:zlib");var tL=ce(cD());async function rL(t,e,r,n){let i=Ee();i.start("Generating the update manifest");let o=await f6(t);return i.stop("Manifest generated successfully"),await Fe(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),o}function uue(t){return(0,ZN.platform)()!=="win32"?t:Lo.win32.normalize(t).split(Lo.win32.sep).join(Lo.posix.sep)}async function nL(t,e,r,n,i,o,s){let a=Ee();a.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await Cr(),l=0,f=e.length,h=e.map(async d=>{let p=(0,Lo.join)(r,d.file),v=uue(d.file),g=(0,XN.createReadStream)(p).pipe((0,eL.createBrotliCompress)()),w=await(0,QN.buffer)(g);return new Promise((S,y)=>{new tL.Upload(w,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:s||bo,metadata:{filename:`orgs/${o}/apps/${n}/${i}/${v}`},headers:{Authorization:t},onError(A){m.info(`Failed to upload ${v}: ${A}`),y(A)},onProgress(){let A=(l/f*100).toFixed(2);a.message(`Uploading partial update: ${A}%`)},onSuccess(){l++,S({file_name:v,s3_path:`orgs/${o}/apps/${n}/${i}/${v}`,file_hash:d.hash})}}).start()})});try{let d=await Promise.all(h),v=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${v} seconds)`),await Fe(t,{channel:"app",event:"App Partial TUS done",icon:"\u23EB",user_id:o,tags:{"app-id":n},notify:!1}),await Fe(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:v},notify:!1}),d}catch(d){let v=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Failed to upload Partial bundle ( after ${v} seconds)`),m.info(`Error uploading partial update: ${d}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}async function cue(t,e){let r=await Er("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r?.version||`0.0.1-beta.${(0,iL.randomUUID)().split("-")[0]}`;return ha.test(n)||(m.error(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),k.error("")),n}function lue(t){let e=t.apikey||pe();return e||(m.error("Missing API key, you need to provide a API key to upload your bundle"),k.error("")),e}function fue(t,e,r){let n=ge(t,r),i=e.path||r?.webDir;return n||(m.error("Missing argument, you need to provide a appid or be in a capacitor project"),k.error("")),i||(m.error("Missing argument, you need to provide a path (--path), or be in a capacitor project"),k.error("")),(0,cn.existsSync)(i)||(m.error(`Path ${i} does not exist, build your app first, or provide a valid path`),k.error("")),{appid:n,path:i}}function due(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Jc(e,"notifyAppReady")||(m.error("notifyAppReady() is missing in the source code. see: https://capgo.app/docs/plugin/api/#notifyappready"),k.error("")),vp(e)||(m.error(`index.html is missing in the root folder of ${e}`),k.error("")))}async function hue(t,e,r,n,i,o){let s=r.ignoreMetadataCheck,a=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",i).single(),f=!!c&&c.disable_auto_update==="version_number",h,d;if(!l&&c&&c.version&&c.version.native_packages&&!s){let g=Ee();g.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:w,localDependencies:S}=await Lh(t,i,n,r.packageJson,r.nodeModules);if(d=w,h=S,d.find(y=>y.localVersion!==y.remoteVersion))g.stop(`Bundle NOT compatible with ${n} channel`),m.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=o,m.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:y}=c.version;(!y||!ha.test(y))&&(m.error("Invalid remote min update version, skipping auto setting compatibility"),k.error("")),u=y,g.stop(`Auto set min-update-version to ${u}`)}catch{m.error(`Cannot auto set compatibility, invalid data ${c}`),k.error("")}else g.stop(`Bundle compatible with ${n} channel`)}else s||(m.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),h=await db(r.packageJson,r.nodeModules),a&&(u=o,m.info(`Auto set min-update-version to ${u}`)));f&&!u&&!s&&(m.error("You need to provide a min-update-version to upload a bundle to this channel"),k.error("")),u&&(ha.test(u)||(m.error(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`),k.error("")));let p=h?new Map(h.filter(g=>!!g.native&&g.native!==void 0).map(g=>[g.name,g])):new Map;return{nativePackages:p.size>0||!r.ignoreMetadataCheck?Array.from(p,([g,w])=>({name:g,version:w.version})):void 0,minUpdateVersion:u}}async function pue(t,e,r){let{data:n,error:i}=await t.rpc("is_trial_org",{orgid:e}).single();(n&&n>0||i)&&(m.warn(`WARNING !!
282
+ `)}async function YN(t,e,r){let n=Wb(t),i=await Pa("AWS4"+r,n),o=await Pa(i,e),s=await Pa(o,"s3");return await Pa(s,"aws4_request")}function JN(t,e,r){return`${t}/${Kb(e,r)}`}async function Pa(t,e){let r=new TextEncoder,n=await crypto.subtle.importKey("raw",t instanceof Uint8Array?t:r.encode(t),{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign","verify"]),i=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(i)}var iue=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-grant-full-control","x-amz-grant-read","x-amz-grant-read-acp","x-amz-grant-write-acp","x-amz-server-side-encryption","x-amz-storage-class","x-amz-website-redirect-location","x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5","x-amz-server-side-encryption-aws-kms-key-id","x-amz-server-side-encryption-context","x-amz-server-side-encryption-bucket-key-enabled","x-amz-request-payer","x-amz-tagging","x-amz-object-lock-mode","x-amz-object-lock-retain-until-date","x-amz-object-lock-legal-hold","x-amz-expected-bucket-owner"],oue=5*1024*1024,sue=5*1024*1024*1024,Jb=5*1024*1024*1024*1024,Yc=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;constructor(e){if(e.useSSL===void 0&&(e.useSSL=!0),typeof e.endPoint!="string"||e.endPoint.length===0||e.endPoint.indexOf("/")!==-1)throw new hp(`Invalid endPoint : ${e.endPoint}`);if(e.port!==void 0&&!UN(e.port))throw new Or(`Invalid port : ${e.port}`);if(e.accessKey&&!e.secretKey)throw new Or("If specifying access key, secret key must also be provided.");if(e.accessKey&&e.accessKey.startsWith("ASIA")&&!e.sessionToken)throw new Or("If specifying temporary access key, session token must also be provided.");let r=e.useSSL?443:80;this.port=e.port??r,this.host=e.endPoint.toLowerCase()+(this.port!==r?`:${e.port}`:""),this.protocol=e.useSSL?"https:":"http:",this.accessKey=e.accessKey,this.#e=e.secretKey??"",this.sessionToken=e.sessionToken,this.pathStyle=e.pathStyle??!0,this.defaultBucket=e.bucket,this.region=e.region}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!HN(r))throw new pp(`Invalid bucket name: ${r}`);return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,i=e.headers??new Headers;i.set("host",n);let o=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,s=(this.pathStyle?`/${r}/${e.objectName}`:`/${e.objectName}`)+(o?`?${o}`:"");return{headers:i,host:n,path:s}}async makeRequest({method:e,payload:r,...n}){let i=new Date,{headers:o,host:s,path:a}=this.buildRequestOptions(n),u=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),o.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let c=await gp(r??new Uint8Array);o.set("x-amz-date",Kc(i)),o.set("x-amz-content-sha256",c),this.accessKey&&(this.sessionToken&&o.set("x-amz-security-token",this.sessionToken),o.set("authorization",await VN({headers:o,method:e,path:a,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:i})));let l=`${this.protocol}//${s}${a}`,f=await fetch(l,{method:e,headers:o,body:r});if(f.status!==u)throw f.status>=400?await MN(f):f.status===301?new Un(f.status,"UnexpectedRedirect",'The server unexpectedly returned a redirect response. With AWS S3, this usually means you need to use a region-specific endpoint like "s3.us-west-2.amazonaws.com" instead of "s3.amazonaws.com"'):new Un(f.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${u}, got ${f.status} ${f.statusText}).`);return n.returnBody||await f.body?.getReader().read(),f}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!$o(e))throw new Mn(`Invalid object name: ${e}`);let i=r.versionId?{versionId:r.versionId}:{},o=new Headers;r.governanceBypass&&o.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:o,query:i,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof Un&&n.statusCode===404)return!1;throw n}}getObject(e,r){return this.getPartialObject(e,{...r,offset:0,length:0})}async getPartialObject(e,{offset:r,length:n,...i}){let o=this.getBucketName(i);if(!$o(e))throw new Mn(`Invalid object name: ${e}`);let s=new Headers(Object.entries(i.metadata??{})),a=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),s.set("Range",c),a=206}let u={...i.responseParams,...i.versionId?{versionId:i.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:o,objectName:e,headers:s,query:u,statusCode:a,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new Ro(`Presigned ${e} URLs cannot be generated for anonymous requests. Specify an accessKey and secretKey.`);if(!$o(r))throw new Mn(`Invalid object name: ${r}`);let{headers:i,path:o}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),s=n.requestDate??new Date,a=n.expirySeconds??24*60*60*7;return zN({protocol:this.protocol,headers:i,method:e,path:o,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:s,expirySeconds:a})}presignedGetObject(e,r={}){let{versionId:n,responseParams:i,...o}=r,s={...i,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:s,...o})}async*listObjects(e={}){for await(let r of this.listObjectsGrouped({...e,delimiter:""}))if(r.type==="Object")yield r;else throw new Error(`Unexpected result from listObjectsGrouped(): ${r}`)}async*listObjectsGrouped(e){let r=this.getBucketName(e),n="",i=e.pageSize??1e3;if(i<1||i>1e3)throw new Or("pageSize must be between 1 and 1,000.");let o=0;for(;;){let s=e.maxResults?Math.min(i,e.maxResults-o):i;if(s===0)return;let u=await(await this.makeRequest({method:"GET",bucketName:r,objectName:"",query:{"list-type":"2",prefix:e.prefix??"",delimiter:e.delimiter,"max-keys":String(s),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=Ei(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(d=>d.name==="CommonPrefixes").flatMap(d=>d.children),f=[];for(let d of l)f.push({type:"CommonPrefix",prefix:d.content??""}),o++;for(let d of c.children.filter(p=>p.name==="Contents"))f.push({type:"Object",key:d.children.find(p=>p.name==="Key")?.content??"",etag:Io(d.children.find(p=>p.name==="ETag")?.content??""),size:parseInt(d.children.find(p=>p.name==="Size")?.content??"",10),lastModified:new Date(d.children.find(p=>p.name==="LastModified")?.content??"invalid")}),o++;f.sort((d,p)=>{let v=d.type==="Object"?d.key:d.prefix,g=p.type==="Object"?p.key:p.prefix;return v>g?1:v<g?-1:0});for(let d of f)yield d;if(c.children.find(d=>d.name==="IsTruncated")?.content==="true"){let d=c.children.find(p=>p.name==="NextContinuationToken")?.content;if(!d)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=d}else return}}async putObject(e,r,n){let i=this.getBucketName(n);if(!$o(e))throw new Mn(`Invalid object name: ${e}`);let o,s;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?s=ReadableStream.from([l]):s=new ReadableStream({start(f){f.enqueue(l),f.close()}}),o=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?s=ReadableStream.from([r]):s=new ReadableStream({start(l){l.enqueue(r),l.close()}}),o=r.byteLength;else if(r instanceof ReadableStream)s=r;else throw new Or("Invalid stream/data type provided.");if(n?.size!==void 0){if(o!==void 0&&n?.size!==o)throw new Or(`size was specified (${n.size}) but doesn't match auto-detected size (${o}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Or(`invalid size specified: ${n.size}`);o=n.size}let a=n?.partSize??this.calculatePartSize(o);if(a<oue)throw new Or("Part size should be greater than 5MB");if(a>sue)throw new Or("Part size should be less than 6MB");let u=new dp(a),c=new yp({client:this,bucketName:i,objectName:e,partSize:a,metadata:n?.metadata??{}});return await s.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=Jb),e>Jb)throw new TypeError(`size should not be more than ${Jb}`);let r=64*1024*1024;for(;;){if(r*1e4>e)return r;r+=16*1024*1024}}async statObject(e,r){let n=this.getBucketName(r);if(!$o(e))throw new Mn(`Invalid object name: ${e}`);let i={};r?.versionId&&(i.versionId=r.versionId);let o=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:i}),s={};for(let a of iue)o.headers.has(a)&&(s[a]=o.headers.get(a));return o.headers.forEach((a,u)=>{u.startsWith("x-amz-meta-")&&(s[u]=o.headers.get(u))}),{type:"Object",key:e,size:parseInt(o.headers.get("content-length")??"",10),metadata:s,lastModified:new Date(o.headers.get("Last-Modified")??"error: missing last modified"),versionId:o.headers.get("x-amz-version-id")||null,etag:Io(o.headers.get("ETag")??"")}}async copyObject(e,r,n){let i=this.getBucketName(n),o=e.sourceBucketName??i;if(!$o(r))throw new Mn(`Invalid object name: ${r}`);let s=`${o}/${e.sourceKey}`;e.sourceVersionId&&(s+=`?versionId=${e.sourceVersionId}`);let a=new Headers(n?.metadata);n?.metadata!==void 0&&a.set("x-amz-metadata-directive","REPLACE"),a.set("x-amz-copy-source",s);let u=await this.makeRequest({method:"PUT",bucketName:i,objectName:r,headers:a,returnBody:!0}),c=await u.text(),l=Ei(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let f=l.children.find(d=>d.name==="ETag")?.content??"",h=l.children.find(d=>d.name==="LastModified")?.content;if(h===void 0)throw new Error("Unable to find <LastModified>...</LastModified> from the server.");return{copySourceVersionId:u.headers.get("x-amz-copy-source-version-id")||null,etag:Io(f),lastModified:new Date(h),versionId:u.headers.get("x-amz-version-id")||null}}async bucketExists(e){try{return await this.listObjects({bucketName:e}).next(),!0}catch(r){if(r instanceof Un&&r.statusCode===404)return!1;throw r}}async makeBucket(e){await this.makeRequest({method:"PUT",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:200})}async removeBucket(e){await this.makeRequest({method:"DELETE",bucketName:this.getBucketName({bucketName:e}),objectName:"",statusCode:204})}};var Xb=ce(bu());var No=require("node:fs"),Dp=require("node:path");function aue(t,e){return(0,No.readFileSync)(t,"utf8").includes(e)}function Jc(t,e){let r=(0,No.readdirSync)(t);for(let n of r){let i=(0,Dp.join)(t,n),o=(0,No.statSync)(i);if(o.isDirectory()){if(Jc(i,e))return!0}else if(o.isFile()&&(0,Dp.extname)(i)===".js"&&aue(i,e))return!0}return!1}function vp(t){return(0,No.readdirSync)(t).indexOf("index.html")>-1}var XN=require("node:fs"),ZN=require("node:os"),Lo=require("node:path"),QN=require("node:stream/consumers"),eL=require("node:zlib");var tL=ce(cD());async function rL(t,e,r,n){let i=Ee();i.start("Generating the update manifest");let o=await fj(t);return i.stop("Manifest generated successfully"),await Fe(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),o}function uue(t){return(0,ZN.platform)()!=="win32"?t:Lo.win32.normalize(t).split(Lo.win32.sep).join(Lo.posix.sep)}async function nL(t,e,r,n,i,o,s){let a=Ee();a.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await Cr(),l=0,f=e.length,h=e.map(async d=>{let p=(0,Lo.join)(r,d.file),v=uue(d.file),g=(0,XN.createReadStream)(p).pipe((0,eL.createBrotliCompress)()),w=await(0,QN.buffer)(g);return new Promise((S,y)=>{new tL.Upload(w,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:s||bo,metadata:{filename:`orgs/${o}/apps/${n}/${i}/${v}`},headers:{Authorization:t},onError(A){m.info(`Failed to upload ${v}: ${A}`),y(A)},onProgress(){let A=(l/f*100).toFixed(2);a.message(`Uploading partial update: ${A}%`)},onSuccess(){l++,S({file_name:v,s3_path:`orgs/${o}/apps/${n}/${i}/${v}`,file_hash:d.hash})}}).start()})});try{let d=await Promise.all(h),v=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Partial update uploaded successfully \u{1F4AA} in (${v} seconds)`),await Fe(t,{channel:"app",event:"App Partial TUS done",icon:"\u23EB",user_id:o,tags:{"app-id":n},notify:!1}),await Fe(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:v},notify:!1}),d}catch(d){let v=((performance.now()-u)/1e3).toFixed(2);return a.stop(`Failed to upload Partial bundle ( after ${v} seconds)`),m.info(`Error uploading partial update: ${d}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}async function cue(t,e){let r=await Er("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r?.version||`0.0.1-beta.${(0,iL.randomUUID)().split("-")[0]}`;return ha.test(n)||(m.error(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),k.error("")),n}function lue(t){let e=t.apikey||pe();return e||(m.error("Missing API key, you need to provide a API key to upload your bundle"),k.error("")),e}function fue(t,e,r){let n=ge(t,r),i=e.path||r?.webDir;return n||(m.error("Missing argument, you need to provide a appid or be in a capacitor project"),k.error("")),i||(m.error("Missing argument, you need to provide a path (--path), or be in a capacitor project"),k.error("")),(0,cn.existsSync)(i)||(m.error(`Path ${i} does not exist, build your app first, or provide a valid path`),k.error("")),{appid:n,path:i}}function due(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(Jc(e,"notifyAppReady")||(m.error("notifyAppReady() is missing in the source code. see: https://capgo.app/docs/plugin/api/#notifyappready"),k.error("")),vp(e)||(m.error(`index.html is missing in the root folder of ${e}`),k.error("")))}async function hue(t,e,r,n,i,o){let s=r.ignoreMetadataCheck,a=r.autoMinUpdateVersion,u=r.minUpdateVersion,{data:c,error:l}=await t.from("channels").select("disable_auto_update, version ( min_update_version, native_packages )").eq("name",n).eq("app_id",i).single(),f=!!c&&c.disable_auto_update==="version_number",h,d;if(!l&&c&&c.version&&c.version.native_packages&&!s){let g=Ee();g.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:w,localDependencies:S}=await Lh(t,i,n,r.packageJson,r.nodeModules);if(d=w,h=S,d.find(y=>y.localVersion!==y.remoteVersion))g.stop(`Bundle NOT compatible with ${n} channel`),m.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),a&&(u=o,m.info(`Auto set min-update-version to ${u}`));else if(a)try{let{min_update_version:y}=c.version;(!y||!ha.test(y))&&(m.error("Invalid remote min update version, skipping auto setting compatibility"),k.error("")),u=y,g.stop(`Auto set min-update-version to ${u}`)}catch{m.error(`Cannot auto set compatibility, invalid data ${c}`),k.error("")}else g.stop(`Bundle compatible with ${n} channel`)}else s||(m.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),h=await db(r.packageJson,r.nodeModules),a&&(u=o,m.info(`Auto set min-update-version to ${u}`)));f&&!u&&!s&&(m.error("You need to provide a min-update-version to upload a bundle to this channel"),k.error("")),u&&(ha.test(u)||(m.error(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`),k.error("")));let p=h?new Map(h.filter(g=>!!g.native&&g.native!==void 0).map(g=>[g.name,g])):new Map;return{nativePackages:p.size>0||!r.ignoreMetadataCheck?Array.from(p,([g,w])=>({name:g,version:w.version})):void 0,minUpdateVersion:u}}async function pue(t,e,r){let{data:n,error:i}=await t.rpc("is_trial_org",{orgid:e}).single();(n&&n>0||i)&&(m.warn(`WARNING !!
283
283
  Trial expires in ${n} days`),m.warn(`Upgrade here: ${r.hostWeb}/dashboard/settings/plans?oid=${e}`))}async function mue(t,e,r){let{data:n,error:i}=await t.rpc("exist_app_versions",{appid:e,apikey:"",name_version:r}).single();(n||i)&&(m.error(`Version ${r} already exists ${te(i)}`),k.error(""))}async function gue(t,e,r,n,i,o){let s,a="",u=null,c=e.key,l=e.keyV2;u=await jh(t);let f=Ee();if(f.start("Calculating checksum"),(l||e.keyDataV2||(0,cn.existsSync)(ur))&&c!==!1?a=await(0,Xb.checksum)(u,"sha256"):a=await(0,Xb.checksum)(u,"crc32"),f.stop(`Checksum: ${a}`),c===!1)m.info("Encryption ignored");else if((l||(0,cn.existsSync)(ur)||e.keyDataV2)&&!e.oldEncryption){let d=typeof l=="string"?l:ur,p=e.keyDataV2||"";!p&&!(0,cn.existsSync)(d)&&(m.error(`Cannot find private key ${d}`),k.error("")),await Fe(n,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:i,tags:{"app-id":o},notify:!1}),p||(p=(0,cn.readFileSync)(d).toString()),m.info("Encrypting your bundle with V2");let v=cp(u,p);a=up(a,p),s=v.ivSessionKey,e.displayIvSession&&m.info(`Your Iv Session key is ${s},
284
284
  keep it safe, you will need it to decrypt your bundle.
285
285
  It will be also visible in your dashboard
@@ -287,11 +287,11 @@ Trial expires in ${n} days`),m.warn(`Upgrade here: ${r.hostWeb}/dashboard/settin
287
287
  You are using old encryption key, it's not secure enouth and it should be migrate on v2, here is the migration guide: https://capgo.app/docs/cli/migrations/encryption/`);let d=typeof c=="string"?c:cr,p=e.keyData||"";!p&&!(0,cn.existsSync)(d)&&(m.error(`Cannot find public key ${d}`),k.error("")),await Fe(n,{channel:"app",event:"App encryption",icon:"\u{1F511}",user_id:i,tags:{"app-id":o},notify:!1}),p||(p=(0,cn.readFileSync)(d).toString()),m.info("Encrypting your bundle");let v=op(u,p);s=v.ivSessionKey,e.displayIvSession&&m.info(`Your Iv Session key is ${s},
288
288
  keep it safe, you will need it to decrypt your bundle.
289
289
  It will be also visible in your dashboard
290
- `),u=v.encryptedData}let h=Math.floor((u?.byteLength??0)/1024/1024);return h>e6&&(m.warn(`WARNING !!
290
+ `),u=v.encryptedData}let h=Math.floor((u?.byteLength??0)/1024/1024);return h>ej&&(m.warn(`WARNING !!
291
291
  The app size is ${h} Mb, this may take a while to download for users
292
292
  `),m.info(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
293
293
  `),await Fe(n,{channel:"app-error",event:"App Too Large",icon:"\u{1F69B}",user_id:i,tags:{"app-id":o},notify:!1})),{zipped:u,sessionKey:s,checksum:a}}async function yue(t,e,r,n,i,o,s){let a=Ee();a.start("Uploading Bundle");let u=performance.now(),c=!1;if(s.dryUpload){a.stop(`Dry run, bundle not uploaded
294
- Bundle uploaded \u{1F4AA} in 0 seconds`);return}try{let h=await Cr();if(s.multipart!==void 0&&s.multipart||s.tus!==void 0&&s.tus){s.multipart?m.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):m.info("Uploading bundle with TUS protocol"),await d6(t,o,i,r,n,a,h,s.tusChunkSize),c=!0;let d=`orgs/${i}/apps/${r}/${n}.zip`,{error:p}=await e.from("app_versions").update({r2_path:d}).eq("name",n).eq("app_id",r);p&&(m.error(`Cannot finish TUS upload ${te(p)}`),Promise.reject(new Error("Cannot finish TUS upload")))}else{let d=await c6(e,r,n);d||(m.error("Cannot get upload url"),Promise.reject(new Error("Cannot get upload url"))),await Vr.put(d,{timeout:s.timeout||t6,retry:5,body:o})}}catch(h){let p=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload bundle ( after ${p} seconds)`),h instanceof ti){let v=await h.response.json();m.error(`Response Error: ${v.error||v.status||v.message}`)}else s.tus?m.error(`Cannot upload bundle please contact support if the issue persists ${te(h)}`):m.error(`Cannot upload bundle ( try again with --tus option) ${te(h)}`);await h6(e,r,n),k.error("")}let f=((performance.now()-u)/1e3).toFixed(2);a.stop(`Bundle uploaded \u{1F4AA} in (${f} seconds)`),await Fe(t,{channel:"performance",event:c?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":r,time:f},notify:!1})}async function Due(t,e,r,n,i,o,s,a,u){let{data:c}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:a}).single();c||(m.warn("Cannot get version id, cannot set channel"),k.error(""));let{error:l,data:f}=await Nh(t,{name:i,app_id:a,created_by:o,version:c,owner_org:s});l&&(m.error(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${te(l)}`),k.error(""));let h=_o(a),d=`${u.hostWeb}/app/p/${h}/channel/${f.id}`;f?.public?m.info("Your update is now available in your public channel \u{1F389}"):f?.id&&m.info(`Link device to this bundle to try it: ${d}`),r?m.info(`Bundle url: ${d}`):c||(m.warn("Cannot set bundle with upload key, use key with more rights for that"),k.error(""))}async function vue(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").single();if(n){m.warn("Cannot find default upload channel");let o=_o(t);return m.info(`You can set it here: ${r}/app/p/${o}/settings`),null}return i.default_upload_channel}async function Zb(t,e,r=!0){X(`Uploading with CLI version ${Ir.version}`);let n=er();await De();let{s3Region:i,s3Apikey:o,s3Apisecret:s,s3BucketName:a,s3Endpoint:u,s3Port:c,s3SSL:l}=e,f=lue(e),h=await Q(),d=await n6(),{appid:p,path:v}=fue(t,e,h.config),g=await cue(h.config,e);e.autoSetBundle&&await wo({version:g}),due(e,v),m.info(`Upload ${p}@${g} started from path "${v}" to Capgo cloud`);let w=await Cr(),S=await de(f),y=await me(S,f,["write","all","upload"]),C=e.channel||await vue(p,S,w.hostWeb)||"dev",A=await Sr(S,p);await pa(S,A,f,p,!0),await pue(S,A,w);let{nativePackages:$,minUpdateVersion:F}=await hue(S,n,e,C,p,g);await mue(S,p,g),e.external&&!e.external.startsWith("https://")&&(m.error(`External link should should start with "https://" current is "${e.external}"`),k.error(""));let L={name:g,app_id:p,session_key:void 0,external_url:e.external,storage_provider:e.external?"external":"r2-direct",min_update_version:F,native_packages:$,owner_org:A,user_id:y,checksum:void 0},x=null;if(e.external)await Fe(f,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:A,tags:{"app-id":p},notify:!1}),L.session_key=e.ivSessionKey,L.checksum=e.encryptedChecksum;else{let{zipped:q,sessionKey:K,checksum:M}=await gue(v,e,w,f,A,p);L.session_key=K,L.checksum=M,x=q,e.ignoreChecksumCheck||await m6(S,p,C,M)}!d.TUSUpload||e.external?e.tus=!1:e.tus=e.tus||d.TUSUploadForced,!d.partialUpload||e.external?e.partial=!1:e.partial=e.partial||e.partialOnly||d.partialUploadForced;let I=e.partial?await rL(v,f,A,p):[],{error:R}=await fb(S,L);if(R&&(m.error(`Cannot add bundle ${te(R)}`),k.error("")),e.tusChunkSize&&e.tusChunkSize>bo&&(m.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${bo}, using the maximum chunk size`),e.tusChunkSize=bo),x&&(a||u||i||o||s||c||l)){(!a||!u||!i||!o||!s||!c)&&(m.error("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),k.error("")),m.info("Uploading to S3");let q=new Yc({endPoint:u,region:i,port:c,useSSL:l,bucket:a,accessKey:o,secretKey:s}),K=`${p}-${g}`,M=encodeURIComponent(K);await q.putObject(K,Uint8Array.from(x)),L.external_url=`https://${u}/${M}`,L.storage_provider="external"}else if(x){e.partialOnly||await yue(f,S,p,g,A,x,e);let q=null;try{e.dryUpload&&(e.partial=!1),q=e.partial?await nL(f,I,v,p,g,A,e.tusChunkSize):null}catch(M){m.info(`Failed to upload partial files to capgo cloud. Error: ${te(M)}. This is not a critical error, the bundle has been uploaded without the partial files`)}L.storage_provider="r2",L.manifest=q;let{error:K}=await fb(S,L);K&&(m.error(`Cannot update bundle ${te(K)}`),k.error(""))}let B=await Le(S,f,p,2);return i6(B,3)?await Due(S,f,!!e.bundleUrl,g,C,y,A,p,w):m.warn("Cannot set channel as a upload organization member"),await Fe(f,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:A,tags:{"app-id":p},notify:!1}),r&&(J("Time to share your update to the world \u{1F30D}"),(0,oL.exit)()),!0}function bue(t){t.ivSessionKey&&!t.external&&(m.error("You need to provide an external url if you want to use the --iv-session-key option"),k.error("")),t.encryptedChecksum&&!t.external&&(m.error("You need to provide an external url if you want to use the --encrypted-checksum option"),k.error("")),t.partial&&t.external&&(m.error("You cannot use the --partial option with an external url"),k.error("")),t.tus&&t.external&&(m.error("You cannot use the --tus option with an external url"),k.error("")),t.dryUpload&&t.external&&(m.error("You cannot use the --dry-upload option with an external url"),k.error("")),t.multipart&&t.external&&(m.error("You cannot use the --multipart option with an external url"),k.error("")),t.external&&(t.key||t.keyData||t.keyV2||t.keyDataV2)&&(m.error("You cannot set a key if you are uploading to an external url"),k.error("")),(t.key||t.keyData)&&(t.keyV2||t.keyDataV2)&&(m.error("You cannot set both key and key-v2"),k.error("")),t.key&&t.keyData&&(m.error("You cannot set both key and key-data"),k.error("")),t.keyV2&&t.keyDataV2&&(m.error("You cannot set both key-v2 and key-data-v2"),k.error("")),t.external&&(t.s3Region||t.s3Apikey||t.s3Apisecret||t.s3Endpoint||t.s3BucketName||t.s3Port||t.s3SSL)&&(m.error("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),k.error("")),t.encryptedChecksum&&!t.external&&(m.error("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),k.error("")),t.minUpdateVersion&&t.autoMinUpdateVersion&&(m.error("You cannot set both min-update-version and auto-min-update-version, use only one of them"),k.error(""))}async function sL(t,e){try{bue(e),await Zb(t,e,!0)}catch(r){m.error(te(r)),k.error("")}}var aL=require("node:crypto"),bp=require("node:fs"),uL=require("node:process");var Qb=ce(bu());var wue=20;async function cL(t,e){try{let{bundle:r,path:n}=e,{json:i}=e;i||await De();let o=await Q();t=ge(t,o?.config);let s=(0,aL.randomUUID)().split("-")[0],a=await Er("",e.packageJson);r=r||a?.version||`0.0.1-beta.${s}`,i||X(`Zipping ${t}@${r}`),r&&!ha.test(r)&&(i?console.error(te({error:"invalid_semver"})):m.error(`Your bundle name ${r}, is not valid it should follow semver convention : https://semver.org/`),k.error("")),n=n||o?.config?.webDir,(!t||!r||!n)&&(i?console.error(te({error:"missing_argument"})):m.error("Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project"),k.error("")),i||m.info(`Started from path "${n}"`);let u=e.codeCheck;(typeof u>"u"||u)&&(Jc(n,"notifyAppReady")||(i?console.error(te({error:"notifyAppReady_not_in_source_code"})):m.error("notifyAppReady() is missing in the source code. see: https://capgo.app/docs/plugin/api/#notifyappready"),k.error("")),vp(n)||(i?console.error(te({error:"index_html_not_found"})):m.error(`index.html is missing in the root folder of ${n}`),k.error("")));let c=await jh(n);i||m.info(`Zipped ${c.byteLength} bytes`);let l=Ee();i||l.start("Calculating checksum");let f="";e.keyV2||(0,bp.existsSync)(ur)?f=await(0,Qb.checksum)(c,"sha256"):f=await(0,Qb.checksum)(c,"crc32"),i||l.stop(`Checksum: ${f}`);let h=Math.floor(c.byteLength/1024/1024);h>wue&&!i&&(m.warn(`WARNING !!
294
+ Bundle uploaded \u{1F4AA} in 0 seconds`);return}try{let h=await Cr();if(s.multipart!==void 0&&s.multipart||s.tus!==void 0&&s.tus){s.multipart?m.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):m.info("Uploading bundle with TUS protocol"),await dj(t,o,i,r,n,a,h,s.tusChunkSize),c=!0;let d=`orgs/${i}/apps/${r}/${n}.zip`,{error:p}=await e.from("app_versions").update({r2_path:d}).eq("name",n).eq("app_id",r);p&&(m.error(`Cannot finish TUS upload ${te(p)}`),Promise.reject(new Error("Cannot finish TUS upload")))}else{let d=await cj(e,r,n);d||(m.error("Cannot get upload url"),Promise.reject(new Error("Cannot get upload url"))),await Vr.put(d,{timeout:s.timeout||tj,retry:5,body:o})}}catch(h){let p=((performance.now()-u)/1e3).toFixed(2);if(a.stop(`Failed to upload bundle ( after ${p} seconds)`),h instanceof ti){let v=await h.response.json();m.error(`Response Error: ${v.error||v.status||v.message}`)}else s.tus?m.error(`Cannot upload bundle please contact support if the issue persists ${te(h)}`):m.error(`Cannot upload bundle ( try again with --tus option) ${te(h)}`);await hj(e,r,n),k.error("")}let f=((performance.now()-u)/1e3).toFixed(2);a.stop(`Bundle uploaded \u{1F4AA} in (${f} seconds)`),await Fe(t,{channel:"performance",event:c?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:i,tags:{"app-id":r,time:f},notify:!1})}async function Due(t,e,r,n,i,o,s,a,u){let{data:c}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:a}).single();c||(m.warn("Cannot get version id, cannot set channel"),k.error(""));let{error:l,data:f}=await Nh(t,{name:i,app_id:a,created_by:o,version:c,owner_org:s});l&&(m.error(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${te(l)}`),k.error(""));let h=_o(a),d=`${u.hostWeb}/app/p/${h}/channel/${f.id}`;f?.public?m.info("Your update is now available in your public channel \u{1F389}"):f?.id&&m.info(`Link device to this bundle to try it: ${d}`),r?m.info(`Bundle url: ${d}`):c||(m.warn("Cannot set bundle with upload key, use key with more rights for that"),k.error(""))}async function vue(t,e,r){let{error:n,data:i}=await e.from("apps").select("default_upload_channel").single();if(n){m.warn("Cannot find default upload channel");let o=_o(t);return m.info(`You can set it here: ${r}/app/p/${o}/settings`),null}return i.default_upload_channel}async function Zb(t,e,r=!0){X(`Uploading with CLI version ${Ir.version}`);let n=er();await De();let{s3Region:i,s3Apikey:o,s3Apisecret:s,s3BucketName:a,s3Endpoint:u,s3Port:c,s3SSL:l}=e,f=lue(e),h=await Q(),d=await nj(),{appid:p,path:v}=fue(t,e,h.config),g=await cue(h.config,e);e.autoSetBundle&&await wo({version:g}),due(e,v),m.info(`Upload ${p}@${g} started from path "${v}" to Capgo cloud`);let w=await Cr(),S=await de(f),y=await me(S,f,["write","all","upload"]),C=e.channel||await vue(p,S,w.hostWeb)||"dev",A=await Sr(S,p);await pa(S,A,f,p,!0),await pue(S,A,w);let{nativePackages:$,minUpdateVersion:F}=await hue(S,n,e,C,p,g);await mue(S,p,g),e.external&&!e.external.startsWith("https://")&&(m.error(`External link should should start with "https://" current is "${e.external}"`),k.error(""));let L={name:g,app_id:p,session_key:void 0,external_url:e.external,storage_provider:e.external?"external":"r2-direct",min_update_version:F,native_packages:$,owner_org:A,user_id:y,checksum:void 0},x=null;if(e.external)await Fe(f,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:A,tags:{"app-id":p},notify:!1}),L.session_key=e.ivSessionKey,L.checksum=e.encryptedChecksum;else{let{zipped:q,sessionKey:K,checksum:M}=await gue(v,e,w,f,A,p);L.session_key=K,L.checksum=M,x=q,e.ignoreChecksumCheck||await mj(S,p,C,M)}!d.TUSUpload||e.external?e.tus=!1:e.tus=e.tus||d.TUSUploadForced,!d.partialUpload||e.external?e.partial=!1:e.partial=e.partial||e.partialOnly||d.partialUploadForced;let I=e.partial?await rL(v,f,A,p):[],{error:R}=await fb(S,L);if(R&&(m.error(`Cannot add bundle ${te(R)}`),k.error("")),e.tusChunkSize&&e.tusChunkSize>bo&&(m.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${bo}, using the maximum chunk size`),e.tusChunkSize=bo),x&&(a||u||i||o||s||c||l)){(!a||!u||!i||!o||!s||!c)&&(m.error("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),k.error("")),m.info("Uploading to S3");let q=new Yc({endPoint:u,region:i,port:c,useSSL:l,bucket:a,accessKey:o,secretKey:s}),K=`${p}-${g}`,M=encodeURIComponent(K);await q.putObject(K,Uint8Array.from(x)),L.external_url=`https://${u}/${M}`,L.storage_provider="external"}else if(x){e.partialOnly||await yue(f,S,p,g,A,x,e);let q=null;try{e.dryUpload&&(e.partial=!1),q=e.partial?await nL(f,I,v,p,g,A,e.tusChunkSize):null}catch(M){m.info(`Failed to upload partial files to capgo cloud. Error: ${te(M)}. This is not a critical error, the bundle has been uploaded without the partial files`)}L.storage_provider="r2",L.manifest=q;let{error:K}=await fb(S,L);K&&(m.error(`Cannot update bundle ${te(K)}`),k.error(""))}let B=await Le(S,f,p,2);return ij(B,3)?await Due(S,f,!!e.bundleUrl,g,C,y,A,p,w):m.warn("Cannot set channel as a upload organization member"),await Fe(f,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:A,tags:{"app-id":p},notify:!1}),r&&(J("Time to share your update to the world \u{1F30D}"),(0,oL.exit)()),!0}function bue(t){t.ivSessionKey&&!t.external&&(m.error("You need to provide an external url if you want to use the --iv-session-key option"),k.error("")),t.encryptedChecksum&&!t.external&&(m.error("You need to provide an external url if you want to use the --encrypted-checksum option"),k.error("")),t.partial&&t.external&&(m.error("You cannot use the --partial option with an external url"),k.error("")),t.tus&&t.external&&(m.error("You cannot use the --tus option with an external url"),k.error("")),t.dryUpload&&t.external&&(m.error("You cannot use the --dry-upload option with an external url"),k.error("")),t.multipart&&t.external&&(m.error("You cannot use the --multipart option with an external url"),k.error("")),t.external&&(t.key||t.keyData||t.keyV2||t.keyDataV2)&&(m.error("You cannot set a key if you are uploading to an external url"),k.error("")),(t.key||t.keyData)&&(t.keyV2||t.keyDataV2)&&(m.error("You cannot set both key and key-v2"),k.error("")),t.key&&t.keyData&&(m.error("You cannot set both key and key-data"),k.error("")),t.keyV2&&t.keyDataV2&&(m.error("You cannot set both key-v2 and key-data-v2"),k.error("")),t.external&&(t.s3Region||t.s3Apikey||t.s3Apisecret||t.s3Endpoint||t.s3BucketName||t.s3Port||t.s3SSL)&&(m.error("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),k.error("")),t.encryptedChecksum&&!t.external&&(m.error("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),k.error("")),t.minUpdateVersion&&t.autoMinUpdateVersion&&(m.error("You cannot set both min-update-version and auto-min-update-version, use only one of them"),k.error(""))}async function sL(t,e){try{bue(e),await Zb(t,e,!0)}catch(r){m.error(te(r)),k.error("")}}var aL=require("node:crypto"),bp=require("node:fs"),uL=require("node:process");var Qb=ce(bu());var wue=20;async function cL(t,e){try{let{bundle:r,path:n}=e,{json:i}=e;i||await De();let o=await Q();t=ge(t,o?.config);let s=(0,aL.randomUUID)().split("-")[0],a=await Er("",e.packageJson);r=r||a?.version||`0.0.1-beta.${s}`,i||X(`Zipping ${t}@${r}`),r&&!ha.test(r)&&(i?console.error(te({error:"invalid_semver"})):m.error(`Your bundle name ${r}, is not valid it should follow semver convention : https://semver.org/`),k.error("")),n=n||o?.config?.webDir,(!t||!r||!n)&&(i?console.error(te({error:"missing_argument"})):m.error("Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project"),k.error("")),i||m.info(`Started from path "${n}"`);let u=e.codeCheck;(typeof u>"u"||u)&&(Jc(n,"notifyAppReady")||(i?console.error(te({error:"notifyAppReady_not_in_source_code"})):m.error("notifyAppReady() is missing in the source code. see: https://capgo.app/docs/plugin/api/#notifyappready"),k.error("")),vp(n)||(i?console.error(te({error:"index_html_not_found"})):m.error(`index.html is missing in the root folder of ${n}`),k.error("")));let c=await jh(n);i||m.info(`Zipped ${c.byteLength} bytes`);let l=Ee();i||l.start("Calculating checksum");let f="";e.keyV2||(0,bp.existsSync)(ur)?f=await(0,Qb.checksum)(c,"sha256"):f=await(0,Qb.checksum)(c,"crc32"),i||l.stop(`Checksum: ${f}`);let h=Math.floor(c.byteLength/1024/1024);h>wue&&!i&&(m.warn(`WARNING !!
295
295
  The app size is ${h} Mb, this may take a while to download for users
296
296
  `),m.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
297
297
  `));let d=Ee(),p=e.name||`${t}_${r}.zip`;i||d.start(`Saving to ${p}`),(0,bp.writeFileSync)(p,c),i||d.stop(`Saved to ${p}`),i||J("Done \u2705"),i&&console.log(JSON.stringify({bundle:r,filename:p,checksum:f},null,2)),(0,uL.exit)()}catch(r){m.error(te(r)),k.error("")}}var lL=require("node:process");async function ew(t,e,r,n=!0){X("Create channel"),r.apikey=r.apikey||pe();let i=await Q();e=ge(e,i?.config),r.apikey||(m.error("Missing API key, you need to provide a API key to upload your bundle"),k.error("")),e||(m.error("Missing argument, you need to provide a appId, or be in a capacitor project"),k.error(""));let o=await de(r.apikey);await me(o,r.apikey,["write","all"]),await Le(o,r.apikey,e,4),m.info(`Creating channel ${e}#${t} to Capgo`);try{let s=await Ub(o,e),a=await Sr(o,e);s||(m.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),k.error(""));let u=await pN(o,{name:t,app_id:e,version:s.id,owner_org:a});u.error&&(m.error(`Cannot create Channel \u{1F640}
@@ -316,7 +316,7 @@ Error: ${t}`)}}async function fn(t,e,r){kt(t)&&(await Vn("onboarding-v2",e,r,"ca
316
316
  export default defineNuxtPlugin(() => {
317
317
  CapacitorUpdater.notifyAppReady()
318
318
  })
319
- `;(0,st.existsSync)(a)?(0,st.readFileSync)(a,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(i.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),m.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,st.writeFileSync)(a,u,"utf8"),i.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),m.info("Updated capacitorUpdater.client.ts file with required code")):((0,st.writeFileSync)(a,u,"utf8"),i.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),m.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let s;if(o==="unknown")s=await u6();else{let f=o.endsWith("-ts");s=await s6(o,f)}if(!s||!(0,st.existsSync)(s)){i.stop("Cannot find main file to install Updater plugin");let f=await nm({message:"Provide the correct relative path to your main file (JS or TS):",validate:h=>{if(!(0,st.existsSync)(h))return"File does not exist. Please provide a valid path."}});kt(f)&&(im("Operation cancelled."),(0,rr.exit)(1)),s=f}let u=(0,st.readFileSync)(s,"utf8").toString(),l=u.match(Vue)?.pop();if(l||(i.stop("Error"),m.warn("Cannot find import line in main file, use manual installation: https://capgo.app/docs/plugin/cloud-mode/auto-update/"),J("Bye \u{1F44B}"),(0,rr.exit)()),u.includes(_p))i.stop(`Code already added to ${s} \u2705`);else{let f=u.replace(l,`${l}
319
+ `;(0,st.existsSync)(a)?(0,st.readFileSync)(a,"utf8").includes("CapacitorUpdater.notifyAppReady()")?(i.stop("Code already added to capacitorUpdater.client.ts file inside plugins directory \u2705"),m.info("Plugins directory and capacitorUpdater.client.ts file already exist with required code")):((0,st.writeFileSync)(a,u,"utf8"),i.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),m.info("Updated capacitorUpdater.client.ts file with required code")):((0,st.writeFileSync)(a,u,"utf8"),i.stop("Code added to capacitorUpdater.client.ts file inside plugins directory \u2705"),m.info("Created plugins directory and capacitorUpdater.client.ts file"))}else{let s;if(o==="unknown")s=await uj();else{let f=o.endsWith("-ts");s=await sj(o,f)}if(!s||!(0,st.existsSync)(s)){i.stop("Cannot find main file to install Updater plugin");let f=await nm({message:"Provide the correct relative path to your main file (JS or TS):",validate:h=>{if(!(0,st.existsSync)(h))return"File does not exist. Please provide a valid path."}});kt(f)&&(im("Operation cancelled."),(0,rr.exit)(1)),s=f}let u=(0,st.readFileSync)(s,"utf8").toString(),l=u.match(Vue)?.pop();if(l||(i.stop("Error"),m.warn("Cannot find import line in main file, use manual installation: https://capgo.app/docs/plugin/cloud-mode/auto-update/"),J("Bye \u{1F44B}"),(0,rr.exit)()),u.includes(_p))i.stop(`Code already added to ${s} \u2705`);else{let f=u.replace(l,`${l}
320
320
  ${HL};
321
321
 
322
322
  ${_p};
@@ -325,7 +325,7 @@ ${_p};
325
325
  ${HL};
326
326
 
327
327
  ${_p};
328
- `)}async function Que(t,e,r){let n=er(),i=await qe({message:`Automatic configure end-to-end encryption in ${r} updates?`});if(await fn(i,t,e),i){let o=Ee();o.start(`Running: ${n.runner} @capgo/cli@latest key create`),await lw({force:!0},!1)?o.stop("key created \u{1F511}"):(o.stop("Error"),m.warn("Cannot create key \u274C"),J("Bye \u{1F44B}"),(0,rr.exit)(1)),Vn("onboarding-v2",t,e,"Use encryption v2")}await $r(t,e,6)}async function ece(t,e,r){let n=er(),i=await qe({message:`Automatic build ${r} with "${n.pm} run build" ?`});if(await fn(i,t,e),i){let o=Ee(),s=await lb(),a=await a6(s);o.start(`Running: ${n.pm} run ${a} && ${n.runner} cap sync`),(await Er()).scripts[a]||(o.stop("Error"),m.warn(`Cannot find ${a} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,rr.exit)()),(0,Zc.execSync)(`${n.pm} run ${a} && ${n.runner} cap sync`,VL),o.stop("Build & Sync Done \u2705")}else m.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await $r(t,e,7)}async function tce(t,e,r){let n=er(),i=await qe({message:`Automatic upload ${r} bundle to Capgo?`});if(await fn(i,t,e),i){let o=Ee();o.start(`Running: ${n.runner} @capgo/cli@latest bundle upload`),await Zb(r,{channel:Xc,apikey:e},!1)?o.stop("Upload Done \u2705"):(o.stop("Error"),m.warn("Upload failed \u274C"),J("Bye \u{1F44B}"),(0,rr.exit)())}else m.info(`Upload yourself with command: ${n.runner} @capgo/cli@latest bundle upload`);await $r(t,e,8)}async function rce(t,e){let r=er(),n=await qe({message:"Run in device now ?"});if(await fn(n,t,e),n){let i=await Mo({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});kt(i)&&(J("Bye \u{1F44B}"),(0,rr.exit)());let o=i,s=Ee();s.start(`Running: ${r.runner} cap run ${o}`),await(0,Zc.spawnSync)(r.runner,["cap","run",o],{stdio:"inherit"}),s.stop("Started Done \u2705")}else m.info(`If you change your mind, run it for yourself with: ${r.runner} cap run <ios|android>`);await $r(t,e,9)}async function nce(t,e,r,n){let i=await qe({message:"Automatic check if update working in device ?"});if(await fn(i,t,e),i)m.info(`Wait logs sent to Capgo from ${r} device, Please open your app \u{1F4AA}`),await cw("onboarding-v2",e,r,e,t);else{let o=_o(r);m.info(`Check logs in ${n}/app/p/${o}/logs to see if update works.`)}await $r(t,e,10)}async function GL(t,e,r){let n=er();X("Capgo onboarding \u{1F6EB}"),await De();let i=!r.supaAnon||!r.supaHost?await Q():await wo({statsUrl:`${r.supaHost}/functions/v1/stats`,channelUrl:`${r.supaHost}/functions/v1/channel_self`,updateUrl:`${r.supaHost}/functions/v1/updates`,localApiFiles:`${r.supaHost}/functions/v1`,localS3:!0,localSupa:r.supaHost,localSupaAnon:r.supaAnon}),o=await Cr();e=ge(e,i?.config),r.apikey=t||pe(),e===void 0&&(e=await nm({message:"Enter your appId:"}),kt(e)&&(im("Operation cancelled."),(0,rr.exit)(1)));let s=Ee();(!ML()||t)&&(s.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await hw(r.apikey,r,!1),s.stop("Login Done \u2705"));let a=await de(r.apikey);await me(a,r.apikey,["upload","all","read","write"]);let u=await ga(a,["admin","super_admin"]),c=u.gid,l=await zue(c,r.apikey)??0;try{l<1&&await $r(c,r.apikey,1),l<2&&(await Wue(u,r.apikey,e,r),Ci(2)),l<3&&(await Kue(c,r.apikey,e),Ci(3)),l<4&&(await Xue(c,r.apikey,e),Ci(4)),l<5&&(await Zue(c,r.apikey,e),Ci(5)),l<6&&(await Que(c,r.apikey,e),Ci(6)),l<7&&(await ece(c,r.apikey,e),Ci(7)),l<8&&(await tce(c,r.apikey,e),Ci(8)),l<9&&(await rce(c,r.apikey),Ci(9)),await nce(c,r.apikey,e,o.hostWeb),await $r(c,r.apikey,0),Gue()}catch(f){console.error(f),m.error("Error during onboarding, please try again later"),(0,rr.exit)(1)}m.info("Welcome onboard \u2708\uFE0F!"),m.info("Your Capgo update system is setup"),m.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),m.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),J("Bye \u{1F44B}"),(0,rr.exit)()}var dn=require("node:fs");async function ice(t,e=!0){e&&X("Save keys \u{1F511}");let r=await Q(),n=t.key||Qt,i=t.keyData||"";if(!(0,dn.existsSync)(n)&&!i)if(e)m.error(`Cannot find public key ${n} or as keyData option or in ${r.path}`),k.error("");else return!1;else(0,dn.existsSync)(n)&&(i=(0,dn.readFileSync)(n).toString());return r?.config&&(r.config.plugins||(r.config.plugins={extConfig:{},CapacitorUpdater:{}}),r.config.plugins.CapacitorUpdater||(r.config.plugins.CapacitorUpdater={}),r.config.plugins.CapacitorUpdater.privateKey=i,await on(r)),m&&(m.success(`private key saved into ${r.path} file in local directory`),m.success("your app will decode the zip archive with this key")),!0}async function WL(t){X("Save keys \u{1F511}"),await De(),await ice(t)}async function oce(t,e=!0){e&&X("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=sp();if((0,dn.existsSync)(cr)&&!t.force)if(m.error("Public Key already exists, use --force to overwrite"),e)k.error("");else return!1;if((0,dn.writeFileSync)(cr,r),(0,dn.existsSync)(Qt)&&!t.force)if(m.error("Private Key already exists, use --force to overwrite"),e)k.error("");else return!1;(0,dn.writeFileSync)(Qt,n);let i=n.replace(/\\n/g,"\\n"),o=await wo({privateKey:i});return e&&(m.success("Your RSA key has been generated"),m.success(`Public key saved in ${cr}`),m.success("This key will be use to encrypt your bundle before sending it to Capgo"),m.success("Keep it safe"),m.success("Than make it unreadable by Capgo and unmodifiable by anyone"),m.success(`Private key saved in ${o.path}`),m.success("Your app will be the only one having it"),m.success("Only your users can decrypt your update"),m.success("Only you can send them an update"),J("Done \u2705")),!0}async function KL(t){await De(),await oce(t)}async function YL(t){X("Getting user id"),t.apikey=t.apikey||pe();let e=await de(t.apikey),r=await me(e,t.apikey,["read","all","write"]);J(`Done \u2705: ${r}`)}var JL=ce(Nv());async function XL(t,e){X("Check compatibility"),e.apikey=e.apikey||pe();let r=await Q();t=ge(t,r?.config);let{channel:n}=e;n||(m.error("Missing argument, you need to provide a channel"),k.error("")),e.apikey||(m.error("Missing API key, you need to provide a API key to upload your bundle"),k.error("")),t||(m.error("Missing argument, you need to provide a appId, or be in a capacitor project"),k.error(""));let i=await de(e.apikey);await me(i,e.apikey,["write","all","read","upload"]),await Le(i,e.apikey,t,1);let{finalCompatibility:o}=await Lh(i,t,n,e.packageJson,e.nodeModules),s=new lr;s.headers=["Package","Local version","Remote version","Compatible"],s.theme=lr.roundTheme,s.rows=[];let a=e.text?"Yes":"\u2705",u=e.text?"No":"\u274C";o.forEach(c=>{let{name:l,localVersion:f,remoteVersion:h}=c,d=u;try{d=(0,JL.default)(f??"",h??"")?a:u}catch(p){m.error(`Fail when compare. Error: ${p}`)}s.rows.push([l,f,h,d])}),m.success("Compatibility"),m.success(s.toString())}k.name(Ir.name).description("Manage packages and bundle versions in Capgo Cloud").version(Ir.version,"-v, --version","output the current version");k.command("login [apikey]").alias("l").description("Save apikey to your machine or folder").action(UL).option("--local","Only save in local folder");k.command("doctor").description("Get info about your Capgo app install").option("--package-json <packageJson>","A list of path to package.json. Usefull for monorepos (comma separated ex: ../../package.json,./package.json)").action(G8);k.command("init [apikey] [appId]").alias("i").description("Init a new app").action(GL).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("--supa-host <supaHost>","Supabase host URL").option("--supa-anon <supaAnon>","Supabase anon token");var ja=k.command("app").description("Manage app");ja.command("add [appId]").alias("a").description("Add a new app in Capgo Cloud").action(H8).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account");ja.command("delete [appId]").description("Delete an app in Capgo Cloud").action(z8).option("-a, --apikey <apikey>","apikey to link to your account");ja.command("list").alias("l").description("list apps in Capgo Cloud").action(K8).option("-a, --apikey <apikey>","apikey to link to your account");ja.command("debug [appId]").description("Listen for live updates event in Capgo Cloud to debug your app").option("-a, --apikey <apikey>","apikey to link to your account").option("-d, --device <device>","the specific device to debug").action(NL);ja.command("setting [path]").description("Modifies capacitor config programmatically").option("--bool <bool>","A value for the setting to modify as a boolean").option("--string <string>","A value for the setting to modify as a string").action(Z8);ja.command("set [appId]").alias("s").description("Set an app in Capgo Cloud").action(X8).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account").option("-r, --retention <retention>","retention period of app bundle in days");var hn=k.command("bundle").description("Manage bundle");hn.command("upload [appId]").alias("u").description("Upload a new bundle in Capgo Cloud").action(sL).option("-a, --apikey <apikey>","apikey to link to your account").option("-p, --path <path>","path of the folder to upload").option("-c, --channel <channel>","channel to link to").option("-e, --external <url>","link to external url intead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the iv and session key for bundle url external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","Apikey for your S3 endpoint").option("--s3-apisecret <apisecret>","Api secret for your S3 endpoint").option("--s3-endoint <s3Endpoint>","Url of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key <key>","custom path for public signing key (v1 system)").option("--key-data <keyData>","public signing key (v1 system)").option("--key-v2 <key>","custom path for private signing key (v2 system)").option("--key-data-v2 <keyDataV2>","private signing key (v2 system)").option("--bundle-url","prints bundle url into stdout").option("--no-key","ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder").option("--display-iv-session","Show in the console the iv and session key used to encrypt the update").option("-b, --bundle <bundle>","bundle version number of the bundle to upload").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","Uses multipart protocol to upload data to S3, Deprecated, use tus instead").option("--tus","Upload the bundle using TUS to Capgo cloud").option("--tus-chunk-size <tusChunkSize>","Chunk size for the TUS upload").option("--partial","Upload partial files to Capgo cloud").option("--partial-only","Upload only partial files to Capgo cloud, skip the zipped file, useful for big bundle").option("--encrypted-checksum <encryptedChecksum>","An encrypted checksum (signature). Used only when uploading an external bundle.").option("--auto-set-bundle","Set the bundle in capacitor.config.json").option("--dry-upload","Dry upload the bundle process, mean it will not upload the files but add the row in database (useful for testing)").option("--package-json <packageJson>","A list of path to package.json. Usefull for monorepos (comma separated ex: ../../package.json,./package.json)").option("--node-modules <nodeModules>","A list of path to node_modules. Usefull for monorepos (comma separated ex: ../../node_modules,./node_modules)");hn.command("compatibility [appId]").action(XL).option("-a, --apikey <apikey>","apikey to link to your account").option("-c, --channel <channel>","channel to check the compatibility with").option("--text","output text instead of emojis").option("--package-json <packageJson>","A list of path to package.json. Usefull for monorepos (comma separated ex: ../../package.json,./package.json)").option("--node-modules <nodeModules>","A list of path to node_modules. Usefull for monorepos (comma separated ex: ../../node_modules,./node_modules)");hn.command("delete [bundleId] [appId]").alias("d").description("Delete a bundle in Capgo Cloud").action($N).option("-a, --apikey <apikey>","apikey to link to your account");hn.command("list [appId]").alias("l").description("List bundle in Capgo Cloud").action(qN).option("-a, --apikey <apikey>","apikey to link to your account");hn.command("cleanup [appId]").alias("c").action(bN).description("Cleanup bundle in Capgo Cloud").option("-b, --bundle <bundle>","bundle version number of the app to delete").option("-a, --apikey <apikey>","apikey to link to your account").option("-k, --keep <keep>","number of version to keep").option("-f, --force","force removal");hn.command("decrypt [zipPath] [sessionKey]").description("Decrypt a signed zip bundle").action(xN).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key");hn.command("encrypt [zipPath]").description("Encrypt a zip bundle").action(jN).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key");hn.command("encryptV2 [zipPath] [checksum]").description("Encrypt a zip bundle using the new encryption method").action(LN).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key").option("-j, --json","output in JSON");hn.command("decryptV2 [zipPath] [checksum]").description("Decrypt a zip bundle using the new encryption method").action(PN).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key").option("--checksum <checksum>","checksum of the bundle, to verify the integrity of the bundle");hn.command("zip [appId]").description("Zip a bundle").action(cL).option("-p, --path <path>","path of the folder to upload").option("-b, --bundle <bundle>","bundle version number to name the zip file").option("-n, --name <name>","name of the zip file").option("-j, --json","output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder").option("--key-v2","use encryption v2").option("--package-json <packageJson>","A list of path to package.json. Usefull for monorepos (comma separated ex: ../../package.json,./package.json)");var Qc=k.command("channel").description("Manage channel");Qc.command("add [channelId] [appId]").alias("a").description("Create channel").action(fL).option("-d, --default","set the channel as default").option("-a, --apikey <apikey>","apikey to link to your account");Qc.command("delete [channelId] [appId]").alias("d").description("Delete channel").action(mL).option("-a, --apikey <apikey>","apikey to link to your account");Qc.command("list [appId]").alias("l").description("List channel").action(yL).option("-a, --apikey <apikey>","apikey to link to your account");Qc.command("currentBundle [channel] [appId]").description("Get current bundle for specific channel in Capgo Cloud").action(hL).option("-c, --channel <channel>","channel to get the current bundle from").option("-a, --apikey <apikey>","apikey to link to your account").option("--quiet","only print the bundle version");Qc.command("set [channelId] [appId]").alias("s").description("Set channel").action(bL).option("-a, --apikey <apikey>","apikey to link to your account").option("-b, --bundle <bundle>","bundle version number of the file to set").option("-s, --state <state>","set the state of the channel, default or normal").option("--latest","get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--upgrade","Allow to upgrade to version above native one").option("--no-upgrade","Disable upgrade to version above native one").option("--ios","Allow sending update to ios devices").option("--no-ios","Disable sending update to ios devices").option("--android","Allow sending update to android devices").option("--no-android","Disable sending update to android devices").option("--self-assign","Allow to device to self assign to this channel").option("--no-self-assign","Disable devices to self assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Disable auto update strategy for this channel.The possible options are: major, minor, metadata, patch, none").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices").option("--package-json <packageJson>","A list of path to package.json. Usefull for monorepos (comma separated ex: ../../package.json,./package.json)");var ZL=k.command("key_old").description("Manage old encryption key");ZL.command("save").description("Save base64 encryption key in capacitor config, usefull for CI").action(WL).option("-f, --force","force generate a new one").option("--key","key path to save in capacitor config").option("--key-data","key data to save in capacitor config");ZL.command("create").description("Create a new encryption key").action(KL).option("-f, --force","force generate a new one");var pw=k.command("key").description("Manage encryption key");pw.command("save").description("Save base64 encryption key in capacitor config, usefull for CI").action(LL).option("-f, --force","force generate a new one").option("--key","key path to save in capacitor config").option("--key-data","key data to save in capacitor config");pw.command("create").description("Create a new encryption key").action(BL).option("-f, --force","force generate a new one");pw.command("delete_old").description("Delete the old encryption key").action(qL);var sce=k.command("account").description("Manage account");sce.command("id").description("Get your account ID").action(YL).option("-a, --apikey <apikey>","apikey to link to your account");k.parseAsync();
328
+ `)}async function Que(t,e,r){let n=er(),i=await qe({message:`Automatic configure end-to-end encryption in ${r} updates?`});if(await fn(i,t,e),i){let o=Ee();o.start(`Running: ${n.runner} @capgo/cli@latest key create`),await lw({force:!0},!1)?o.stop("key created \u{1F511}"):(o.stop("Error"),m.warn("Cannot create key \u274C"),J("Bye \u{1F44B}"),(0,rr.exit)(1)),Vn("onboarding-v2",t,e,"Use encryption v2")}await $r(t,e,6)}async function ece(t,e,r){let n=er(),i=await qe({message:`Automatic build ${r} with "${n.pm} run build" ?`});if(await fn(i,t,e),i){let o=Ee(),s=await lb(),a=await aj(s);o.start(`Running: ${n.pm} run ${a} && ${n.runner} cap sync`),(await Er()).scripts[a]||(o.stop("Error"),m.warn(`Cannot find ${a} script in package.json, please add it and run \`capgo init\` again`),J("Bye \u{1F44B}"),(0,rr.exit)()),(0,Zc.execSync)(`${n.pm} run ${a} && ${n.runner} cap sync`,VL),o.stop("Build & Sync Done \u2705")}else m.info(`Build yourself with command: ${n.pm} run build && ${n.runner} cap sync`);await $r(t,e,7)}async function tce(t,e,r){let n=er(),i=await qe({message:`Automatic upload ${r} bundle to Capgo?`});if(await fn(i,t,e),i){let o=Ee();o.start(`Running: ${n.runner} @capgo/cli@latest bundle upload`),await Zb(r,{channel:Xc,apikey:e},!1)?o.stop("Upload Done \u2705"):(o.stop("Error"),m.warn("Upload failed \u274C"),J("Bye \u{1F44B}"),(0,rr.exit)())}else m.info(`Upload yourself with command: ${n.runner} @capgo/cli@latest bundle upload`);await $r(t,e,8)}async function rce(t,e){let r=er(),n=await qe({message:"Run in device now ?"});if(await fn(n,t,e),n){let i=await Mo({message:"Pick a platform to run your app",options:[{value:"ios",label:"IOS"},{value:"android",label:"Android"}]});kt(i)&&(J("Bye \u{1F44B}"),(0,rr.exit)());let o=i,s=Ee();s.start(`Running: ${r.runner} cap run ${o}`),await(0,Zc.spawnSync)(r.runner,["cap","run",o],{stdio:"inherit"}),s.stop("Started Done \u2705")}else m.info(`If you change your mind, run it for yourself with: ${r.runner} cap run <ios|android>`);await $r(t,e,9)}async function nce(t,e,r,n){let i=await qe({message:"Automatic check if update working in device ?"});if(await fn(i,t,e),i)m.info(`Wait logs sent to Capgo from ${r} device, Please open your app \u{1F4AA}`),await cw("onboarding-v2",e,r,e,t);else{let o=_o(r);m.info(`Check logs in ${n}/app/p/${o}/logs to see if update works.`)}await $r(t,e,10)}async function GL(t,e,r){let n=er();X("Capgo onboarding \u{1F6EB}"),await De();let i=!r.supaAnon||!r.supaHost?await Q():await wo({statsUrl:`${r.supaHost}/functions/v1/stats`,channelUrl:`${r.supaHost}/functions/v1/channel_self`,updateUrl:`${r.supaHost}/functions/v1/updates`,localApiFiles:`${r.supaHost}/functions/v1`,localS3:!0,localSupa:r.supaHost,localSupaAnon:r.supaAnon}),o=await Cr();e=ge(e,i?.config),r.apikey=t||pe(),e===void 0&&(e=await nm({message:"Enter your appId:"}),kt(e)&&(im("Operation cancelled."),(0,rr.exit)(1)));let s=Ee();(!ML()||t)&&(s.start(`Running: ${n.runner} @capgo/cli@latest login ***`),await hw(r.apikey,r,!1),s.stop("Login Done \u2705"));let a=await de(r.apikey);await me(a,r.apikey,["upload","all","read","write"]);let u=await ga(a,["admin","super_admin"]),c=u.gid,l=await zue(c,r.apikey)??0;try{l<1&&await $r(c,r.apikey,1),l<2&&(await Wue(u,r.apikey,e,r),Ci(2)),l<3&&(await Kue(c,r.apikey,e),Ci(3)),l<4&&(await Xue(c,r.apikey,e),Ci(4)),l<5&&(await Zue(c,r.apikey,e),Ci(5)),l<6&&(await Que(c,r.apikey,e),Ci(6)),l<7&&(await ece(c,r.apikey,e),Ci(7)),l<8&&(await tce(c,r.apikey,e),Ci(8)),l<9&&(await rce(c,r.apikey),Ci(9)),await nce(c,r.apikey,e,o.hostWeb),await $r(c,r.apikey,0),Gue()}catch(f){console.error(f),m.error("Error during onboarding, please try again later"),(0,rr.exit)(1)}m.info("Welcome onboard \u2708\uFE0F!"),m.info("Your Capgo update system is setup"),m.info(`Next time use \`${n.runner} @capgo/cli@latest bundle upload\` to only upload your bundle`),m.info(`If you have any issue try to use the debug command \`${n.runner} @capgo/cli@latest app debug\``),J("Bye \u{1F44B}"),(0,rr.exit)()}var dn=require("node:fs");async function ice(t,e=!0){e&&X("Save keys \u{1F511}");let r=await Q(),n=t.key||Qt,i=t.keyData||"";if(!(0,dn.existsSync)(n)&&!i)if(e)m.error(`Cannot find public key ${n} or as keyData option or in ${r.path}`),k.error("");else return!1;else(0,dn.existsSync)(n)&&(i=(0,dn.readFileSync)(n).toString());return r?.config&&(r.config.plugins||(r.config.plugins={extConfig:{},CapacitorUpdater:{}}),r.config.plugins.CapacitorUpdater||(r.config.plugins.CapacitorUpdater={}),r.config.plugins.CapacitorUpdater.privateKey=i,await on(r)),m&&(m.success(`private key saved into ${r.path} file in local directory`),m.success("your app will decode the zip archive with this key")),!0}async function WL(t){X("Save keys \u{1F511}"),await De(),await ice(t)}async function oce(t,e=!0){e&&X("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=sp();if((0,dn.existsSync)(cr)&&!t.force)if(m.error("Public Key already exists, use --force to overwrite"),e)k.error("");else return!1;if((0,dn.writeFileSync)(cr,r),(0,dn.existsSync)(Qt)&&!t.force)if(m.error("Private Key already exists, use --force to overwrite"),e)k.error("");else return!1;(0,dn.writeFileSync)(Qt,n);let i=n.replace(/\\n/g,"\\n"),o=await wo({privateKey:i});return e&&(m.success("Your RSA key has been generated"),m.success(`Public key saved in ${cr}`),m.success("This key will be use to encrypt your bundle before sending it to Capgo"),m.success("Keep it safe"),m.success("Than make it unreadable by Capgo and unmodifiable by anyone"),m.success(`Private key saved in ${o.path}`),m.success("Your app will be the only one having it"),m.success("Only your users can decrypt your update"),m.success("Only you can send them an update"),J("Done \u2705")),!0}async function KL(t){await De(),await oce(t)}async function YL(t){X("Getting user id"),t.apikey=t.apikey||pe();let e=await de(t.apikey),r=await me(e,t.apikey,["read","all","write"]);J(`Done \u2705: ${r}`)}var JL=ce(Nv());async function XL(t,e){X("Check compatibility"),e.apikey=e.apikey||pe();let r=await Q();t=ge(t,r?.config);let{channel:n}=e;n||(m.error("Missing argument, you need to provide a channel"),k.error("")),e.apikey||(m.error("Missing API key, you need to provide a API key to upload your bundle"),k.error("")),t||(m.error("Missing argument, you need to provide a appId, or be in a capacitor project"),k.error(""));let i=await de(e.apikey);await me(i,e.apikey,["write","all","read","upload"]),await Le(i,e.apikey,t,1);let{finalCompatibility:o}=await Lh(i,t,n,e.packageJson,e.nodeModules),s=new lr;s.headers=["Package","Local version","Remote version","Compatible"],s.theme=lr.roundTheme,s.rows=[];let a=e.text?"Yes":"\u2705",u=e.text?"No":"\u274C";o.forEach(c=>{let{name:l,localVersion:f,remoteVersion:h}=c,d=u;try{d=(0,JL.default)(f??"",h??"")?a:u}catch(p){m.error(`Fail when compare. Error: ${p}`)}s.rows.push([l,f,h,d])}),m.success("Compatibility"),m.success(s.toString())}k.name(Ir.name).description("Manage packages and bundle versions in Capgo Cloud").version(Ir.version,"-v, --version","output the current version");k.command("login [apikey]").alias("l").description("Save apikey to your machine or folder").action(UL).option("--local","Only save in local folder");k.command("doctor").description("Get info about your Capgo app install").option("--package-json <packageJson>","A list of path to package.json. Usefull for monorepos (comma separated ex: ../../package.json,./package.json)").action(G8);k.command("init [apikey] [appId]").alias("i").description("Init a new app").action(GL).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("--supa-host <supaHost>","Supabase host URL").option("--supa-anon <supaAnon>","Supabase anon token");var ja=k.command("app").description("Manage app");ja.command("add [appId]").alias("a").description("Add a new app in Capgo Cloud").action(H8).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account");ja.command("delete [appId]").description("Delete an app in Capgo Cloud").action(z8).option("-a, --apikey <apikey>","apikey to link to your account");ja.command("list").alias("l").description("list apps in Capgo Cloud").action(K8).option("-a, --apikey <apikey>","apikey to link to your account");ja.command("debug [appId]").description("Listen for live updates event in Capgo Cloud to debug your app").option("-a, --apikey <apikey>","apikey to link to your account").option("-d, --device <device>","the specific device to debug").action(NL);ja.command("setting [path]").description("Modifies capacitor config programmatically").option("--bool <bool>","A value for the setting to modify as a boolean").option("--string <string>","A value for the setting to modify as a string").action(Z8);ja.command("set [appId]").alias("s").description("Set an app in Capgo Cloud").action(X8).option("-n, --name <name>","app name").option("-i, --icon <icon>","app icon path").option("-a, --apikey <apikey>","apikey to link to your account").option("-r, --retention <retention>","retention period of app bundle in days");var hn=k.command("bundle").description("Manage bundle");hn.command("upload [appId]").alias("u").description("Upload a new bundle in Capgo Cloud").action(sL).option("-a, --apikey <apikey>","apikey to link to your account").option("-p, --path <path>","path of the folder to upload").option("-c, --channel <channel>","channel to link to").option("-e, --external <url>","link to external url intead of upload to Capgo Cloud").option("--iv-session-key <key>","Set the iv and session key for bundle url external").option("--s3-region <region>","Region for your S3 bucket").option("--s3-apikey <apikey>","Apikey for your S3 endpoint").option("--s3-apisecret <apisecret>","Api secret for your S3 endpoint").option("--s3-endoint <s3Endpoint>","Url of S3 endpoint").option("--s3-bucket-name <bucketName>","Name for your AWS S3 bucket").option("--s3-port <port>","Port for your S3 endpoint").option("--no-s3-ssl","Disable SSL for S3 upload").option("--key <key>","custom path for public signing key (v1 system)").option("--key-data <keyData>","public signing key (v1 system)").option("--key-v2 <key>","custom path for private signing key (v2 system)").option("--key-data-v2 <keyDataV2>","private signing key (v2 system)").option("--bundle-url","prints bundle url into stdout").option("--no-key","ignore signing key and send clear update").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder").option("--display-iv-session","Show in the console the iv and session key used to encrypt the update").option("-b, --bundle <bundle>","bundle version number of the bundle to upload").option("--min-update-version <minUpdateVersion>","Minimal version required to update to this version. Used only if the disable auto update is set to metadata in channel").option("--auto-min-update-version","Set the min update version based on native packages").option("--ignore-metadata-check","Ignores the metadata (node_modules) check when uploading").option("--ignore-checksum-check","Ignores the checksum check when uploading").option("--timeout <timeout>","Timeout for the upload process in seconds").option("--multipart","Uses multipart protocol to upload data to S3, Deprecated, use tus instead").option("--tus","Upload the bundle using TUS to Capgo cloud").option("--tus-chunk-size <tusChunkSize>","Chunk size for the TUS upload").option("--partial","Upload partial files to Capgo cloud").option("--partial-only","Upload only partial files to Capgo cloud, skip the zipped file, useful for big bundle").option("--encrypted-checksum <encryptedChecksum>","An encrypted checksum (signature). Used only when uploading an external bundle.").option("--auto-set-bundle","Set the bundle in capacitor.config.json").option("--dry-upload","Dry upload the bundle process, mean it will not upload the files but add the row in database (useful for testing)").option("--package-json <packageJson>","A list of path to package.json. Usefull for monorepos (comma separated ex: ../../package.json,./package.json)").option("--node-modules <nodeModules>","A list of path to node_modules. Usefull for monorepos (comma separated ex: ../../node_modules,./node_modules)");hn.command("compatibility [appId]").action(XL).option("-a, --apikey <apikey>","apikey to link to your account").option("-c, --channel <channel>","channel to check the compatibility with").option("--text","output text instead of emojis").option("--package-json <packageJson>","A list of path to package.json. Usefull for monorepos (comma separated ex: ../../package.json,./package.json)").option("--node-modules <nodeModules>","A list of path to node_modules. Usefull for monorepos (comma separated ex: ../../node_modules,./node_modules)");hn.command("delete [bundleId] [appId]").alias("d").description("Delete a bundle in Capgo Cloud").action($N).option("-a, --apikey <apikey>","apikey to link to your account");hn.command("list [appId]").alias("l").description("List bundle in Capgo Cloud").action(qN).option("-a, --apikey <apikey>","apikey to link to your account");hn.command("cleanup [appId]").alias("c").action(bN).description("Cleanup bundle in Capgo Cloud").option("-b, --bundle <bundle>","bundle version number of the app to delete").option("-a, --apikey <apikey>","apikey to link to your account").option("-k, --keep <keep>","number of version to keep").option("-f, --force","force removal");hn.command("decrypt [zipPath] [sessionKey]").description("Decrypt a signed zip bundle").action(xN).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key");hn.command("encrypt [zipPath]").description("Encrypt a zip bundle").action(jN).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key");hn.command("encryptV2 [zipPath] [checksum]").description("Encrypt a zip bundle using the new encryption method").action(LN).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key").option("-j, --json","output in JSON");hn.command("decryptV2 [zipPath] [checksum]").description("Decrypt a zip bundle using the new encryption method").action(PN).option("--key <key>","custom path for private signing key").option("--key-data <keyData>","private signing key").option("--checksum <checksum>","checksum of the bundle, to verify the integrity of the bundle");hn.command("zip [appId]").description("Zip a bundle").action(cL).option("-p, --path <path>","path of the folder to upload").option("-b, --bundle <bundle>","bundle version number to name the zip file").option("-n, --name <name>","name of the zip file").option("-j, --json","output in JSON").option("--no-code-check","Ignore checking if notifyAppReady() is called in soure code and index present in root folder").option("--key-v2","use encryption v2").option("--package-json <packageJson>","A list of path to package.json. Usefull for monorepos (comma separated ex: ../../package.json,./package.json)");var Qc=k.command("channel").description("Manage channel");Qc.command("add [channelId] [appId]").alias("a").description("Create channel").action(fL).option("-d, --default","set the channel as default").option("-a, --apikey <apikey>","apikey to link to your account");Qc.command("delete [channelId] [appId]").alias("d").description("Delete channel").action(mL).option("-a, --apikey <apikey>","apikey to link to your account");Qc.command("list [appId]").alias("l").description("List channel").action(yL).option("-a, --apikey <apikey>","apikey to link to your account");Qc.command("currentBundle [channel] [appId]").description("Get current bundle for specific channel in Capgo Cloud").action(hL).option("-c, --channel <channel>","channel to get the current bundle from").option("-a, --apikey <apikey>","apikey to link to your account").option("--quiet","only print the bundle version");Qc.command("set [channelId] [appId]").alias("s").description("Set channel").action(bL).option("-a, --apikey <apikey>","apikey to link to your account").option("-b, --bundle <bundle>","bundle version number of the file to set").option("-s, --state <state>","set the state of the channel, default or normal").option("--latest","get the latest version key in the package.json to set it to the channel").option("--downgrade","Allow to downgrade to version under native one").option("--no-downgrade","Disable downgrade to version under native one").option("--upgrade","Allow to upgrade to version above native one").option("--no-upgrade","Disable upgrade to version above native one").option("--ios","Allow sending update to ios devices").option("--no-ios","Disable sending update to ios devices").option("--android","Allow sending update to android devices").option("--no-android","Disable sending update to android devices").option("--self-assign","Allow to device to self assign to this channel").option("--no-self-assign","Disable devices to self assign to this channel").option("--disable-auto-update <disableAutoUpdate>","Disable auto update strategy for this channel.The possible options are: major, minor, metadata, patch, none").option("--dev","Allow sending update to development devices").option("--no-dev","Disable sending update to development devices").option("--emulator","Allow sending update to emulator devices").option("--no-emulator","Disable sending update to emulator devices").option("--package-json <packageJson>","A list of path to package.json. Usefull for monorepos (comma separated ex: ../../package.json,./package.json)");var ZL=k.command("key_old").description("Manage old encryption key");ZL.command("save").description("Save base64 encryption key in capacitor config, usefull for CI").action(WL).option("-f, --force","force generate a new one").option("--key","key path to save in capacitor config").option("--key-data","key data to save in capacitor config");ZL.command("create").description("Create a new encryption key").action(KL).option("-f, --force","force generate a new one");var pw=k.command("key").description("Manage encryption key");pw.command("save").description("Save base64 encryption key in capacitor config, usefull for CI").action(LL).option("-f, --force","force generate a new one").option("--key","key path to save in capacitor config").option("--key-data","key data to save in capacitor config");pw.command("create").description("Create a new encryption key").action(BL).option("-f, --force","force generate a new one");pw.command("delete_old").description("Delete the old encryption key").action(qL);var sce=k.command("account").description("Manage account");sce.command("id").description("Get your account ID").action(YL).option("-a, --apikey <apikey>","apikey to link to your account");k.parseAsync();
329
329
  /*! Bundled license information:
330
330
 
331
331
  safe-buffer/index.js: