@capgo/cli 7.42.0 → 7.42.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 +34 -34
- package/dist/package.json +1 -1
- package/dist/src/sdk.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -103,8 +103,8 @@ const config: CapacitorConfig = ${(0,e5.formatJSObject)(t)};
|
|
|
103
103
|
|
|
104
104
|
export default config;
|
|
105
105
|
`}});function y5(){try{return ig.default.statSync("/.dockerenv"),!0}catch{return!1}}function D5(){try{return ig.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function ag(){return og===void 0&&(og=y5()||D5()),og}var ig,og,Nx=Xe(()=>{ig=ue(require("node:fs"),1)});function Zi(){return sg===void 0&&(sg=b5()||ag()),sg}var Lx,sg,b5,ug=Xe(()=>{Lx=ue(require("node:fs"),1);Nx();b5=()=>{try{return Lx.default.statSync("/run/.containerenv"),!0}catch{return!1}}});var cg,Ux,Mx,jx,cn,lg=Xe(()=>{cg=ue(require("node:process"),1),Ux=ue(require("node:os"),1),Mx=ue(require("node:fs"),1);ug();jx=()=>{if(cg.default.platform!=="linux")return!1;if(Ux.default.release().toLowerCase().includes("microsoft"))return!Zi();try{return Mx.default.readFileSync("/proc/version","utf8").toLowerCase().includes("microsoft")?!Zi():!1}catch{return!1}},cn=cg.default.env.__IS_WSL_TEST__?jx:jx()});var fg,qx,Hx,Vx,w5,dg,Wt,pg=Xe(()=>{fg=ue(require("node:process"),1),qx=require("node:buffer"),Hx=require("node:util"),Vx=ue(require("node:child_process"),1),w5=(0,Hx.promisify)(Vx.default.execFile),dg=()=>`${fg.default.env.SYSTEMROOT||fg.default.env.windir||String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,Wt=async(t,e={})=>{let{powerShellPath:r,...n}=e,o=Wt.encodeCommand(t);return w5(r??dg(),[...Wt.argumentsPrefix,o],{encoding:"utf8",...n})};Wt.argumentsPrefix=["-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"];Wt.encodeCommand=t=>qx.Buffer.from(t,"utf16le").toString("base64");Wt.escapeArgument=t=>`'${String(t).replaceAll("'","''")}'`});var Kx,Gx,Fo,v5,C5,E5,$l,zx,Wx,Yx,Jx,Xx=Xe(()=>{Kx=require("node:util"),Gx=ue(require("node:child_process"),1),Fo=ue(require("node:fs/promises"),1);lg();pg();lg();v5=(0,Kx.promisify)(Gx.default.execFile),C5=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Fo.default.access(r,Fo.constants.F_OK),n=!0}catch{}if(!n)return t;let o=await Fo.default.readFile(r,{encoding:"utf8"}),i=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(o);return i?(e=i.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),E5=async()=>`${await C5()}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`,$l=cn?E5:dg,Wx=async()=>(zx??=(async()=>{try{let t=await $l();return await Fo.default.access(t,Fo.constants.X_OK),!0}catch{return!1}})(),zx),Yx=async()=>{let t=await $l(),e=String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`,{stdout:r}=await Wt(e,{powerShellPath:t});return r.trim()},Jx=async t=>{if(/^[a-z]+:\/\//i.test(t))return t;try{let{stdout:e}=await v5("wslpath",["-aw",t],{encoding:"utf8"});return e.trim()}catch{return t}}});function ko(t,e,r){let n=o=>Object.defineProperty(t,e,{value:o,enumerable:!0,writable:!0});return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get(){let o=r();return n(o),o},set(o){n(o)}}),t}var Zx=Xe(()=>{});async function hg(){if(eA.default.platform!=="darwin")throw new Error("macOS only");let{stdout:t}=await _5("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]),r=/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(t)?.groups.id??"com.apple.Safari";return r==="com.apple.safari"?"com.apple.Safari":r}var Qx,eA,tA,_5,rA=Xe(()=>{Qx=require("node:util"),eA=ue(require("node:process"),1),tA=require("node:child_process"),_5=(0,Qx.promisify)(tA.execFile)});async function iA(t,{humanReadableOutput:e=!0,signal:r}={}){if(nA.default.platform!=="darwin")throw new Error("macOS only");let n=e?[]:["-ss"],o={};r&&(o.signal=r);let{stdout:i}=await S5("osascript",["-e",t,n],o);return i.trim()}var nA,oA,mg,S5,aA=Xe(()=>{nA=ue(require("node:process"),1),oA=require("node:util"),mg=require("node:child_process"),S5=(0,oA.promisify)(mg.execFile)});async function gg(t){return iA(`tell application "Finder" to set app_path to application file id "${t}" as string
|
|
106
|
-
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var sA=Xe(()=>{aA()});async function Dg(t=x5){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 Il(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=lA[n];if(!o)throw new Il(`Unknown browser ID: ${n}`);return o}var uA,cA,x5,lA,yg,Il,bg=Xe(()=>{uA=require("node:util"),cA=require("node:child_process"),x5=(0,uA.promisify)(cA.execFile),lA={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},yg=new Map(Object.entries(lA)),Il=class extends Error{}});async function wg(){if(Tl.default.platform==="darwin"){let t=await hg();return{name:await gg(t),id:t}}if(Tl.default.platform==="linux"){let{stdout:t}=await A5("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:O5(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Tl.default.platform==="win32")return Dg();throw new Error("Only macOS, Linux, and Windows are supported")}var fA,Tl,dA,A5,O5,pA=Xe(()=>{fA=require("node:util"),Tl=ue(require("node:process"),1),dA=require("node:child_process");rA();sA();bg();bg();A5=(0,fA.promisify)(dA.execFile),O5=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Rl,F5,hA,mA=Xe(()=>{Rl=ue(require("node:process"),1),F5=!!(Rl.default.env.SSH_CONNECTION||Rl.default.env.SSH_CLIENT||Rl.default.env.SSH_TTY),hA=F5});var _g={};Yr(_g,{apps:()=>Po,default:()=>$5,openApp:()=>P5});function bA(t){if(typeof t=="string"||Array.isArray(t))return t;let{[yA]:e}=t;if(!e)throw new Error(`${yA} is not supported`);return e}function Fs({[Qi]:t},{wsl:e}={}){if(e&&cn)return bA(e);if(!t)throw new Error(`${Qi} is not supported`);return bA(t)}var Cg,Eg,vA,CA,Nl,wA,Bl,vg,gA,Qi,yA,DA,Os,k5,P5,Po,$5,Sg=Xe(()=>{Cg=ue(require("node:process"),1),Eg=ue(require("node:path"),1),vA=require("node:url"),CA=ue(require("node:child_process"),1),Nl=ue(require("node:fs/promises"),1);Xx();pg();Zx();pA();ug();mA();wA={},Bl=Symbol("fallbackAttempt"),vg=wA.url?Eg.default.dirname((0,vA.fileURLToPath)(wA.url)):"",gA=Eg.default.join(vg,"xdg-open"),{platform:Qi,arch:yA}=Cg.default,DA=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(o){r.push(o)}throw new AggregateError(r,"Failed to open in all supported apps")},Os=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[Bl]===!0;if(delete t[Bl],Array.isArray(t.app))return DA(t.app,c=>Os({...t,app:c,[Bl]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return DA(r,c=>Os({...t,app:{name:c,arguments:n},[Bl]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},d;if(cn){let p=await Yx();d=yg.get(p)??{}}else d=await wg();if(d.id in c){let p=c[d.id.toLowerCase()];if(r==="browserPrivate"){if(p==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(l[p])}return Os({...t,app:{name:Po[p],arguments:n}})}throw new Error(`${d.name} is not supported as a default browser`)}let o,i=[],a={},s=!1;if(cn&&!Zi()&&!hA&&!r&&(s=await Wx()),Qi==="darwin")o="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),r&&i.push("-a",r);else if(Qi==="win32"||s){o=await $l(),i.push(...Wt.argumentsPrefix),cn||(a.windowsVerbatimArguments=!0),cn&&t.target&&(t.target=await Jx(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(Wt.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(Wt.escapeArgument(t.target)),n.length>0&&(n=n.map(l=>Wt.escapeArgument(l)),c.push("-ArgumentList",n.join(","))),t.target=Wt.encodeCommand(c.join(" ")),t.wait||(a.stdio="ignore")}else{if(r)o=r;else{let c=!vg||vg==="/",l=!1;try{await Nl.default.access(gA,Nl.constants.X_OK),l=!0}catch{}o=Cg.default.versions.electron??(Qi==="android"||c||!l)?"xdg-open":gA}n.length>0&&i.push(...n),t.wait||(a.stdio="ignore",a.detached=!0)}Qi==="darwin"&&n.length>0&&i.push("--args",...n),t.target&&i.push(t.target);let u=CA.default.spawn(o,i,a);return t.wait?new Promise((c,l)=>{u.once("error",l),u.once("close",d=>{if(!t.allowNonzeroExitCode&&d!==0){l(new Error(`Exited with code ${d}`));return}c(u)})}):e?new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.once("close",d=>{if(u.off("error",l),d!==0){l(new Error(`Exited with code ${d}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.off("error",l),c(u)})}))},k5=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Os({...e,target:t})},P5=(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 Os({...e,app:{name:t,arguments:r}})};Po={browser:"browser",browserPrivate:"browserPrivate"};ko(Po,"chrome",()=>Fs({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{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"]}}));ko(Po,"brave",()=>Fs({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));ko(Po,"firefox",()=>Fs({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));ko(Po,"edge",()=>Fs({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));ko(Po,"safari",()=>Fs({darwin:"Safari"}));$5=k5});var ff=S(hr=>{"use strict";hr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;hr.find=(t,e)=>t.nodes.find(r=>r.type===e);hr.exceedsLimit=(t,e,r=1,n)=>n===!1||!hr.isInteger(t)||!hr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;hr.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};hr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;hr.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;hr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;hr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);hr.flatten=(...t)=>{let e=[],r=n=>{for(let o=0;o<n.length;o++){let i=n[o];if(Array.isArray(i)){r(i);continue}i!==void 0&&e.push(i)}return e};return r(t),e}});var df=S((JJ,ZO)=>{"use strict";var XO=ff();ZO.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&XO.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&XO.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)s+=r(u);return s};return r(t)}});var e1=S((XJ,QO)=>{"use strict";QO.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var c1=S((ZJ,u1)=>{"use strict";var t1=e1(),Mo=(t,e,r)=>{if(t1(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(t1(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let o=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),s=String(n.wrap),u=t+":"+e+"="+o+i+a+s;if(Mo.cache.hasOwnProperty(u))return Mo.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let b=t+"|"+e;return n.capture?`(${b})`:n.wrap===!1?b:`(?:${b})`}let d=s1(t)||s1(e),p={min:t,max:e,a:c,b:l},h=[],m=[];if(d&&(p.isPadded=d,p.maxLen=String(p.max).length),c<0){let b=l<0?Math.abs(l):1;m=r1(b,Math.abs(c),p,n),c=p.a=0}return l>=0&&(h=r1(c,l,p,n)),p.negatives=m,p.positives=h,p.result=SM(m,h,n),n.capture===!0?p.result=`(${p.result})`:n.wrap!==!1&&h.length+m.length>1&&(p.result=`(?:${p.result})`),Mo.cache[u]=p,p.result};function SM(t,e,r){let n=Jg(t,e,"-",!1,r)||[],o=Jg(e,t,"",!1,r)||[],i=Jg(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function xM(t,e){let r=1,n=1,o=o1(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=o1(t,r);for(o=i1(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=i1(e+1,n)-1;return i=[...i],i.sort(FM),i}function AM(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=OM(t,e),o=n.length,i="",a=0;for(let s=0;s<o;s++){let[u,c]=n[s];u===c?i+=u:u!=="0"||c!=="9"?i+=kM(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function r1(t,e,r,n){let o=xM(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],l=AM(String(a),String(c),n),d="";if(!r.isPadded&&s&&s.pattern===l.pattern){s.count.length>1&&s.count.pop(),s.count.push(l.count[0]),s.string=s.pattern+a1(s.count),a=c+1;continue}r.isPadded&&(d=PM(c,r,n)),l.string=d+l.pattern+a1(l.count),i.push(l),a=c+1,s=l}return i}function Jg(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!n1(e,"string",s)&&i.push(r+s),n&&n1(e,"string",s)&&i.push(r+s)}return i}function OM(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function FM(t,e){return t>e?1:e>t?-1:0}function n1(t,e,r){return t.some(n=>n[e]===r)}function o1(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function i1(t,e){return t-t%Math.pow(10,e)}function a1(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function kM(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function s1(t){return/^-?(0+)\d/.test(t)}function PM(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),o=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}Mo.cache={};Mo.clearCache=()=>Mo.cache={};u1.exports=Mo});var Qg=S((QJ,g1)=>{"use strict";var $M=require("util"),f1=c1(),l1=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),IM=t=>e=>t===!0?Number(e):String(e),Xg=t=>typeof t=="number"||typeof t=="string"&&t!=="",Hs=t=>Number.isInteger(+t),Zg=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},TM=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,RM=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},hf=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},BM=(t,e,r)=>{t.negatives.sort((s,u)=>s<u?-1:s>u?1:0),t.positives.sort((s,u)=>s<u?-1:s>u?1:0);let n=e.capture?"":"?:",o="",i="",a;return t.positives.length&&(o=t.positives.map(s=>hf(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>hf(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},d1=(t,e,r,n)=>{if(r)return f1(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},p1=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return f1(t,e,r)},h1=(...t)=>new RangeError("Invalid range arguments: "+$M.inspect(...t)),m1=(t,e,r)=>{if(r.strictRanges===!0)throw h1([t,e]);return[]},NM=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},LM=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw h1([t,e]);return[]}o===0&&(o=0),i===0&&(i=0);let a=o>i,s=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=Zg(s)||Zg(u)||Zg(c),d=l?Math.max(s.length,u.length,c.length):0,p=l===!1&&TM(t,e,n)===!1,h=n.transform||IM(p);if(n.toRegex&&r===1)return d1(hf(t,d),hf(e,d),!0,n);let m={negatives:[],positives:[]},b=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),y=[],C=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?b(o):y.push(RM(h(o,C),d,p)),o=a?o-r:o+r,C++;return n.toRegex===!0?r>1?BM(m,n,d):p1(y,null,{wrap:!1,...n}):y},jM=(t,e,r=1,n={})=>{if(!Hs(t)&&t.length>1||!Hs(e)&&e.length>1)return m1(t,e,n);let o=n.transform||(p=>String.fromCharCode(p)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),s=i>a,u=Math.min(i,a),c=Math.max(i,a);if(n.toRegex&&r===1)return d1(u,c,!1,n);let l=[],d=0;for(;s?i>=a:i<=a;)l.push(o(i,d)),i=s?i-r:i+r,d++;return n.toRegex===!0?p1(l,null,{wrap:!1,options:n}):l},pf=(t,e,r,n={})=>{if(e==null&&Xg(t))return[t];if(!Xg(t)||!Xg(e))return m1(t,e,n);if(typeof r=="function")return pf(t,e,1,{transform:r});if(l1(r))return pf(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Hs(r)?Hs(t)&&Hs(e)?LM(t,e,r,o):jM(t,e,Math.max(Math.abs(r),1),o):r!=null&&!l1(r)?NM(r,o):pf(t,e,1,r)};g1.exports=pf});var b1=S((eX,D1)=>{"use strict";var UM=Qg(),y1=ff(),MM=(t,e={})=>{let r=(n,o={})=>{let i=y1.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s=i===!0||a===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return s?u+n.value:"(";if(n.type==="close")return s?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":s?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=y1.reduce(n.nodes),d=UM(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return l.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};D1.exports=MM});var C1=S((tX,v1)=>{"use strict";var qM=Qg(),w1=df(),ha=ff(),qo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ha.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(qo(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?qo(o,i,r):o+i);return ha.flatten(n)},HM=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(o,i={})=>{o.queue=[];let a=i,s=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,s=a.queue;if(o.invalid||o.dollar){s.push(qo(s.pop(),w1(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(qo(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let d=ha.reduce(o.nodes);if(ha.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let p=qM(...d,e);p.length===0&&(p=w1(o,e)),s.push(qo(s.pop(),p)),o.nodes=[];return}let u=ha.encloseBrace(o),c=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let d=0;d<o.nodes.length;d++){let p=o.nodes[d];if(p.type==="comma"&&o.type==="brace"){d===1&&c.push(""),c.push("");continue}if(p.type==="close"){s.push(qo(s.pop(),c,u));continue}if(p.value&&p.type!=="open"){c.push(qo(c.pop(),p.value));continue}p.nodes&&n(p,o)}return c};return ha.flatten(n(t))};v1.exports=HM});var _1=S((rX,E1)=>{"use strict";E1.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
107
|
-
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var F1=S((nX,O1)=>{"use strict";var VM=df(),{MAX_LENGTH:S1,CHAR_BACKSLASH:ey,CHAR_BACKTICK:zM,CHAR_COMMA:KM,CHAR_DOT:GM,CHAR_LEFT_PARENTHESES:WM,CHAR_RIGHT_PARENTHESES:YM,CHAR_LEFT_CURLY_BRACE:JM,CHAR_RIGHT_CURLY_BRACE:XM,CHAR_LEFT_SQUARE_BRACKET:x1,CHAR_RIGHT_SQUARE_BRACKET:A1,CHAR_DOUBLE_QUOTE:ZM,CHAR_SINGLE_QUOTE:QM,CHAR_NO_BREAK_SPACE:e9,CHAR_ZERO_WIDTH_NOBREAK_SPACE:t9}=_1(),r9=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(S1,r.maxLength):S1;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let o={type:"root",input:t,nodes:[]},i=[o],a=o,s=o,u=0,c=t.length,l=0,d=0,p,h=()=>t[l++],m=b=>{if(b.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&b.type==="text"){s.value+=b.value;return}return a.nodes.push(b),b.parent=a,b.prev=s,s=b,b};for(m({type:"bos"});l<c;)if(a=i[i.length-1],p=h(),!(p===t9||p===e9)){if(p===ey){m({type:"text",value:(e.keepEscaping?p:"")+h()});continue}if(p===A1){m({type:"text",value:"\\"+p});continue}if(p===x1){u++;let b;for(;l<c&&(b=h());){if(p+=b,b===x1){u++;continue}if(b===ey){p+=h();continue}if(b===A1&&(u--,u===0))break}m({type:"text",value:p});continue}if(p===WM){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:p});continue}if(p===YM){if(a.type!=="paren"){m({type:"text",value:p});continue}a=i.pop(),m({type:"text",value:p}),a=i[i.length-1];continue}if(p===ZM||p===QM||p===zM){let b=p,y;for(e.keepQuotes!==!0&&(p="");l<c&&(y=h());){if(y===ey){p+=y+h();continue}if(y===b){e.keepQuotes===!0&&(p+=y);break}p+=y}m({type:"text",value:p});continue}if(p===JM){d++;let y={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};a=m(y),i.push(a),m({type:"open",value:p});continue}if(p===XM){if(a.type!=="brace"){m({type:"text",value:p});continue}let b="close";a=i.pop(),a.close=!0,m({type:b,value:p}),d--,a=i[i.length-1];continue}if(p===KM&&d>0){if(a.ranges>0){a.ranges=0;let b=a.nodes.shift();a.nodes=[b,{type:"text",value:VM(a)}]}m({type:"comma",value:p}),a.commas++;continue}if(p===GM&&d>0&&a.commas===0){let b=a.nodes;if(d===0||b.length===0){m({type:"text",value:p});continue}if(s.type==="dot"){if(a.range=[],s.value+=p,s.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,s.type="text";continue}a.ranges++,a.args=[];continue}if(s.type==="range"){b.pop();let y=b[b.length-1];y.value+=s.value+p,s=y,a.ranges--;continue}m({type:"dot",value:p});continue}m({type:"text",value:p})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(C=>{C.nodes||(C.type==="open"&&(C.isOpen=!0),C.type==="close"&&(C.isClose=!0),C.nodes||(C.type="text"),C.invalid=!0)});let b=i[i.length-1],y=b.nodes.indexOf(a);b.nodes.splice(y,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};O1.exports=r9});var $1=S((oX,P1)=>{"use strict";var k1=df(),n9=b1(),o9=C1(),i9=F1(),Zt=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=Zt.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(Zt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Zt.parse=(t,e={})=>i9(t,e);Zt.stringify=(t,e={})=>k1(typeof t=="string"?Zt.parse(t,e):t,e);Zt.compile=(t,e={})=>(typeof t=="string"&&(t=Zt.parse(t,e)),n9(t,e));Zt.expand=(t,e={})=>{typeof t=="string"&&(t=Zt.parse(t,e));let r=o9(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Zt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Zt.compile(t,e):Zt.expand(t,e);P1.exports=Zt});var Vs=S((iX,N1)=>{"use strict";var a9=require("path"),zr="\\\\/",I1=`[^${zr}]`,yn="\\.",s9="\\+",u9="\\?",mf="\\/",c9="(?=.)",T1="[^/]",ty=`(?:${mf}|$)`,R1=`(?:^|${mf})`,ry=`${yn}{1,2}${ty}`,l9=`(?!${yn})`,f9=`(?!${R1}${ry})`,d9=`(?!${yn}{0,1}${ty})`,p9=`(?!${ry})`,h9=`[^.${mf}]`,m9=`${T1}*?`,B1={DOT_LITERAL:yn,PLUS_LITERAL:s9,QMARK_LITERAL:u9,SLASH_LITERAL:mf,ONE_CHAR:c9,QMARK:T1,END_ANCHOR:ty,DOTS_SLASH:ry,NO_DOT:l9,NO_DOTS:f9,NO_DOT_SLASH:d9,NO_DOTS_SLASH:p9,QMARK_NO_DOT:h9,STAR:m9,START_ANCHOR:R1},g9={...B1,SLASH_LITERAL:`[${zr}]`,QMARK:I1,STAR:`${I1}*?`,DOTS_SLASH:`${yn}{1,2}(?:[${zr}]|$)`,NO_DOT:`(?!${yn})`,NO_DOTS:`(?!(?:^|[${zr}])${yn}{1,2}(?:[${zr}]|$))`,NO_DOT_SLASH:`(?!${yn}{0,1}(?:[${zr}]|$))`,NO_DOTS_SLASH:`(?!${yn}{1,2}(?:[${zr}]|$))`,QMARK_NO_DOT:`[^.${zr}]`,START_ANCHOR:`(?:^|[${zr}])`,END_ANCHOR:`(?:[${zr}]|$)`},y9={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};N1.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:y9,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:a9.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?g9:B1}}});var zs=S(Ht=>{"use strict";var D9=require("path"),b9=process.platform==="win32",{REGEX_BACKSLASH:w9,REGEX_REMOVE_BACKSLASH:v9,REGEX_SPECIAL_CHARS:C9,REGEX_SPECIAL_CHARS_GLOBAL:E9}=Vs();Ht.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ht.hasRegexChars=t=>C9.test(t);Ht.isRegexChar=t=>t.length===1&&Ht.hasRegexChars(t);Ht.escapeRegex=t=>t.replace(E9,"\\$1");Ht.toPosixSlashes=t=>t.replace(w9,"/");Ht.removeBackslashes=t=>t.replace(v9,e=>e==="\\"?"":e);Ht.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Ht.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:b9===!0||D9.sep==="\\";Ht.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Ht.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Ht.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Ht.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var z1=S((sX,V1)=>{"use strict";var L1=zs(),{CHAR_ASTERISK:ny,CHAR_AT:_9,CHAR_BACKWARD_SLASH:Ks,CHAR_COMMA:S9,CHAR_DOT:oy,CHAR_EXCLAMATION_MARK:iy,CHAR_FORWARD_SLASH:H1,CHAR_LEFT_CURLY_BRACE:ay,CHAR_LEFT_PARENTHESES:sy,CHAR_LEFT_SQUARE_BRACKET:x9,CHAR_PLUS:A9,CHAR_QUESTION_MARK:j1,CHAR_RIGHT_CURLY_BRACE:O9,CHAR_RIGHT_PARENTHESES:U1,CHAR_RIGHT_SQUARE_BRACKET:F9}=Vs(),M1=t=>t===H1||t===Ks,q1=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},k9=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,l=0,d=0,p=!1,h=!1,m=!1,b=!1,y=!1,C=!1,E=!1,g=!1,_=!1,x=!1,$=0,F,B,T={value:"",depth:0,isGlob:!1},L=()=>c>=n,A=()=>u.charCodeAt(c+1),j=()=>(F=B,u.charCodeAt(++c));for(;c<n;){B=j();let w;if(B===Ks){E=T.backslashes=!0,B=j(),B===ay&&(C=!0);continue}if(C===!0||B===ay){for($++;L()!==!0&&(B=j());){if(B===Ks){E=T.backslashes=!0,j();continue}if(B===ay){$++;continue}if(C!==!0&&B===oy&&(B=j())===oy){if(p=T.isBrace=!0,m=T.isGlob=!0,x=!0,o===!0)continue;break}if(C!==!0&&B===S9){if(p=T.isBrace=!0,m=T.isGlob=!0,x=!0,o===!0)continue;break}if(B===O9&&($--,$===0)){C=!1,p=T.isBrace=!0,x=!0;break}}if(o===!0)continue;break}if(B===H1){if(i.push(c),a.push(T),T={value:"",depth:0,isGlob:!1},x===!0)continue;if(F===oy&&c===l+1){l+=2;continue}d=c+1;continue}if(r.noext!==!0&&(B===A9||B===_9||B===ny||B===j1||B===iy)===!0&&A()===sy){if(m=T.isGlob=!0,b=T.isExtglob=!0,x=!0,B===iy&&c===l&&(_=!0),o===!0){for(;L()!==!0&&(B=j());){if(B===Ks){E=T.backslashes=!0,B=j();continue}if(B===U1){m=T.isGlob=!0,x=!0;break}}continue}break}if(B===ny){if(F===ny&&(y=T.isGlobstar=!0),m=T.isGlob=!0,x=!0,o===!0)continue;break}if(B===j1){if(m=T.isGlob=!0,x=!0,o===!0)continue;break}if(B===x9){for(;L()!==!0&&(w=j());){if(w===Ks){E=T.backslashes=!0,j();continue}if(w===F9){h=T.isBracket=!0,m=T.isGlob=!0,x=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===iy&&c===l){g=T.negated=!0,l++;continue}if(r.noparen!==!0&&B===sy){if(m=T.isGlob=!0,o===!0){for(;L()!==!0&&(B=j());){if(B===sy){E=T.backslashes=!0,B=j();continue}if(B===U1){x=!0;break}}continue}break}if(m===!0){if(x=!0,o===!0)continue;break}}r.noext===!0&&(b=!1,m=!1);let M=u,J="",k="";l>0&&(J=u.slice(0,l),u=u.slice(l),d-=l),M&&m===!0&&d>0?(M=u.slice(0,d),k=u.slice(d)):m===!0?(M="",k=u):M=u,M&&M!==""&&M!=="/"&&M!==u&&M1(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),r.unescape===!0&&(k&&(k=L1.removeBackslashes(k)),M&&E===!0&&(M=L1.removeBackslashes(M)));let D={prefix:J,input:t,start:l,base:M,glob:k,isBrace:p,isBracket:h,isGlob:m,isExtglob:b,isGlobstar:y,negated:g,negatedExtglob:_};if(r.tokens===!0&&(D.maxDepth=0,M1(B)||a.push(T),D.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let v=0;v<i.length;v++){let O=w?w+1:l,R=i[v],I=t.slice(O,R);r.tokens&&(v===0&&l!==0?(a[v].isPrefix=!0,a[v].value=J):a[v].value=I,q1(a[v]),D.maxDepth+=a[v].depth),(v!==0||I!=="")&&s.push(I),w=R}if(w&&w+1<t.length){let v=t.slice(w+1);s.push(v),r.tokens&&(a[a.length-1].value=v,q1(a[a.length-1]),D.maxDepth+=a[a.length-1].depth)}D.slashes=i,D.parts=s}return D};V1.exports=k9});var W1=S((uX,G1)=>{"use strict";var gf=Vs(),Qt=zs(),{MAX_LENGTH:yf,POSIX_REGEX_SOURCE:P9,REGEX_NON_SPECIAL_CHARS:$9,REGEX_SPECIAL_CHARS_BACKREF:I9,REPLACEMENTS:K1}=gf,T9=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(o=>Qt.escapeRegex(o)).join("..")}return r},ma=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,uy=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=K1[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(yf,r.maxLength):yf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},a=[i],s=r.capture?"":"?:",u=Qt.isWindows(e),c=gf.globChars(u),l=gf.extglobChars(c),{DOT_LITERAL:d,PLUS_LITERAL:p,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:b,NO_DOT:y,NO_DOT_SLASH:C,NO_DOTS_SLASH:E,QMARK:g,QMARK_NO_DOT:_,STAR:x,START_ANCHOR:$}=c,F=G=>`(${s}(?:(?!${$}${G.dot?b:d}).)*?)`,B=r.dot?"":y,T=r.dot?g:_,L=r.bash===!0?F(r):x;r.capture&&(L=`(${L})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let A={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};t=Qt.removePrefix(t,A),o=t.length;let j=[],M=[],J=[],k=i,D,w=()=>A.index===o-1,v=A.peek=(G=1)=>t[A.index+G],O=A.advance=()=>t[++A.index]||"",R=()=>t.slice(A.index+1),I=(G="",Se=0)=>{A.consumed+=G,A.index+=Se},q=G=>{A.output+=G.output!=null?G.output:G.value,I(G.value)},P=()=>{let G=1;for(;v()==="!"&&(v(2)!=="("||v(3)==="?");)O(),A.start++,G++;return G%2===0?!1:(A.negated=!0,A.start++,!0)},N=G=>{A[G]++,J.push(G)},z=G=>{A[G]--,J.pop()},H=G=>{if(k.type==="globstar"){let Se=A.braces>0&&(G.type==="comma"||G.type==="brace"),V=G.extglob===!0||j.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!Se&&!V&&(A.output=A.output.slice(0,-k.output.length),k.type="star",k.value="*",k.output=L,A.output+=k.output)}if(j.length&&G.type!=="paren"&&(j[j.length-1].inner+=G.value),(G.value||G.output)&&q(G),k&&k.type==="text"&&G.type==="text"){k.value+=G.value,k.output=(k.output||"")+G.value;return}G.prev=k,a.push(G),k=G},se=(G,Se)=>{let V={...l[Se],conditions:1,inner:""};V.prev=k,V.parens=A.parens,V.output=A.output;let ce=(r.capture?"(":"")+V.open;N("parens"),H({type:G,value:Se,output:A.output?"":m}),H({type:"paren",extglob:!0,value:O(),output:ce}),j.push(V)},zt=G=>{let Se=G.close+(r.capture?")":""),V;if(G.type==="negate"){let ce=L;if(G.inner&&G.inner.length>1&&G.inner.includes("/")&&(ce=F(r)),(ce!==L||w()||/^\)+$/.test(R()))&&(Se=G.close=`)$))${ce}`),G.inner.includes("*")&&(V=R())&&/^\.[^\\/.]+$/.test(V)){let qe=uy(V,{...e,fastpaths:!1}).output;Se=G.close=`)${qe})${ce})`}G.prev.type==="bos"&&(A.negatedExtglob=!0)}H({type:"paren",extglob:!0,value:D,output:Se}),z("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,Se=t.replace(I9,(V,ce,qe,Et,rt,Af)=>Et==="\\"?(G=!0,V):Et==="?"?ce?ce+Et+(rt?g.repeat(rt.length):""):Af===0?T+(rt?g.repeat(rt.length):""):g.repeat(qe.length):Et==="."?d.repeat(qe.length):Et==="*"?ce?ce+Et+(rt?L:""):L:ce?V:`\\${V}`);return G===!0&&(r.unescape===!0?Se=Se.replace(/\\/g,""):Se=Se.replace(/\\+/g,V=>V.length%2===0?"\\\\":V?"\\":"")),Se===t&&r.contains===!0?(A.output=t,A):(A.output=Qt.wrapOutput(Se,A,e),A)}for(;!w();){if(D=O(),D==="\0")continue;if(D==="\\"){let V=v();if(V==="/"&&r.bash!==!0||V==="."||V===";")continue;if(!V){D+="\\",H({type:"text",value:D});continue}let ce=/^\\+/.exec(R()),qe=0;if(ce&&ce[0].length>2&&(qe=ce[0].length,A.index+=qe,qe%2!==0&&(D+="\\")),r.unescape===!0?D=O():D+=O(),A.brackets===0){H({type:"text",value:D});continue}}if(A.brackets>0&&(D!=="]"||k.value==="["||k.value==="[^")){if(r.posix!==!1&&D===":"){let V=k.value.slice(1);if(V.includes("[")&&(k.posix=!0,V.includes(":"))){let ce=k.value.lastIndexOf("["),qe=k.value.slice(0,ce),Et=k.value.slice(ce+2),rt=P9[Et];if(rt){k.value=qe+rt,A.backtrack=!0,O(),!i.output&&a.indexOf(k)===1&&(i.output=m);continue}}}(D==="["&&v()!==":"||D==="-"&&v()==="]")&&(D=`\\${D}`),D==="]"&&(k.value==="["||k.value==="[^")&&(D=`\\${D}`),r.posix===!0&&D==="!"&&k.value==="["&&(D="^"),k.value+=D,q({value:D});continue}if(A.quotes===1&&D!=='"'){D=Qt.escapeRegex(D),k.value+=D,q({value:D});continue}if(D==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&H({type:"text",value:D});continue}if(D==="("){N("parens"),H({type:"paren",value:D});continue}if(D===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ma("opening","("));let V=j[j.length-1];if(V&&A.parens===V.parens+1){zt(j.pop());continue}H({type:"paren",value:D,output:A.parens?")":"\\)"}),z("parens");continue}if(D==="["){if(r.nobracket===!0||!R().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ma("closing","]"));D=`\\${D}`}else N("brackets");H({type:"bracket",value:D});continue}if(D==="]"){if(r.nobracket===!0||k&&k.type==="bracket"&&k.value.length===1){H({type:"text",value:D,output:`\\${D}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ma("opening","["));H({type:"text",value:D,output:`\\${D}`});continue}z("brackets");let V=k.value.slice(1);if(k.posix!==!0&&V[0]==="^"&&!V.includes("/")&&(D=`/${D}`),k.value+=D,q({value:D}),r.literalBrackets===!1||Qt.hasRegexChars(V))continue;let ce=Qt.escapeRegex(k.value);if(A.output=A.output.slice(0,-k.value.length),r.literalBrackets===!0){A.output+=ce,k.value=ce;continue}k.value=`(${s}${ce}|${k.value})`,A.output+=k.value;continue}if(D==="{"&&r.nobrace!==!0){N("braces");let V={type:"brace",value:D,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};M.push(V),H(V);continue}if(D==="}"){let V=M[M.length-1];if(r.nobrace===!0||!V){H({type:"text",value:D,output:D});continue}let ce=")";if(V.dots===!0){let qe=a.slice(),Et=[];for(let rt=qe.length-1;rt>=0&&(a.pop(),qe[rt].type!=="brace");rt--)qe[rt].type!=="dots"&&Et.unshift(qe[rt].value);ce=T9(Et,r),A.backtrack=!0}if(V.comma!==!0&&V.dots!==!0){let qe=A.output.slice(0,V.outputIndex),Et=A.tokens.slice(V.tokensIndex);V.value=V.output="\\{",D=ce="\\}",A.output=qe;for(let rt of Et)A.output+=rt.output||rt.value}H({type:"brace",value:D,output:ce}),z("braces"),M.pop();continue}if(D==="|"){j.length>0&&j[j.length-1].conditions++,H({type:"text",value:D});continue}if(D===","){let V=D,ce=M[M.length-1];ce&&J[J.length-1]==="braces"&&(ce.comma=!0,V="|"),H({type:"comma",value:D,output:V});continue}if(D==="/"){if(k.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),k=i;continue}H({type:"slash",value:D,output:h});continue}if(D==="."){if(A.braces>0&&k.type==="dot"){k.value==="."&&(k.output=d);let V=M[M.length-1];k.type="dots",k.output+=D,k.value+=D,V.dots=!0;continue}if(A.braces+A.parens===0&&k.type!=="bos"&&k.type!=="slash"){H({type:"text",value:D,output:d});continue}H({type:"dot",value:D,output:d});continue}if(D==="?"){if(!(k&&k.value==="(")&&r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("qmark",D);continue}if(k&&k.type==="paren"){let ce=v(),qe=D;if(ce==="<"&&!Qt.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(k.value==="("&&!/[!=<:]/.test(ce)||ce==="<"&&!/<([!=]|\w+>)/.test(R()))&&(qe=`\\${D}`),H({type:"text",value:D,output:qe});continue}if(r.dot!==!0&&(k.type==="slash"||k.type==="bos")){H({type:"qmark",value:D,output:_});continue}H({type:"qmark",value:D,output:g});continue}if(D==="!"){if(r.noextglob!==!0&&v()==="("&&(v(2)!=="?"||!/[!=<:]/.test(v(3)))){se("negate",D);continue}if(r.nonegate!==!0&&A.index===0){P();continue}}if(D==="+"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("plus",D);continue}if(k&&k.value==="("||r.regex===!1){H({type:"plus",value:D,output:p});continue}if(k&&(k.type==="bracket"||k.type==="paren"||k.type==="brace")||A.parens>0){H({type:"plus",value:D});continue}H({type:"plus",value:p});continue}if(D==="@"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){H({type:"at",extglob:!0,value:D,output:""});continue}H({type:"text",value:D});continue}if(D!=="*"){(D==="$"||D==="^")&&(D=`\\${D}`);let V=$9.exec(R());V&&(D+=V[0],A.index+=V[0].length),H({type:"text",value:D});continue}if(k&&(k.type==="globstar"||k.star===!0)){k.type="star",k.star=!0,k.value+=D,k.output=L,A.backtrack=!0,A.globstar=!0,I(D);continue}let G=R();if(r.noextglob!==!0&&/^\([^?]/.test(G)){se("star",D);continue}if(k.type==="star"){if(r.noglobstar===!0){I(D);continue}let V=k.prev,ce=V.prev,qe=V.type==="slash"||V.type==="bos",Et=ce&&(ce.type==="star"||ce.type==="globstar");if(r.bash===!0&&(!qe||G[0]&&G[0]!=="/")){H({type:"star",value:D,output:""});continue}let rt=A.braces>0&&(V.type==="comma"||V.type==="brace"),Af=j.length&&(V.type==="pipe"||V.type==="paren");if(!qe&&V.type!=="paren"&&!rt&&!Af){H({type:"star",value:D,output:""});continue}for(;G.slice(0,3)==="/**";){let Xs=t[A.index+4];if(Xs&&Xs!=="/")break;G=G.slice(3),I("/**",3)}if(V.type==="bos"&&w()){k.type="globstar",k.value+=D,k.output=F(r),A.output=k.output,A.globstar=!0,I(D);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&!Et&&w()){A.output=A.output.slice(0,-(V.output+k.output).length),V.output=`(?:${V.output}`,k.type="globstar",k.output=F(r)+(r.strictSlashes?")":"|$)"),k.value+=D,A.globstar=!0,A.output+=V.output+k.output,I(D);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&G[0]==="/"){let Xs=G[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(V.output+k.output).length),V.output=`(?:${V.output}`,k.type="globstar",k.output=`${F(r)}${h}|${h}${Xs})`,k.value+=D,A.output+=V.output+k.output,A.globstar=!0,I(D+O()),H({type:"slash",value:"/",output:""});continue}if(V.type==="bos"&&G[0]==="/"){k.type="globstar",k.value+=D,k.output=`(?:^|${h}|${F(r)}${h})`,A.output=k.output,A.globstar=!0,I(D+O()),H({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-k.output.length),k.type="globstar",k.output=F(r),k.value+=D,A.output+=k.output,A.globstar=!0,I(D);continue}let Se={type:"star",value:D,output:L};if(r.bash===!0){Se.output=".*?",(k.type==="bos"||k.type==="slash")&&(Se.output=B+Se.output),H(Se);continue}if(k&&(k.type==="bracket"||k.type==="paren")&&r.regex===!0){Se.output=D,H(Se);continue}(A.index===A.start||k.type==="slash"||k.type==="dot")&&(k.type==="dot"?(A.output+=C,k.output+=C):r.dot===!0?(A.output+=E,k.output+=E):(A.output+=B,k.output+=B),v()!=="*"&&(A.output+=m,k.output+=m)),H(Se)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ma("closing","]"));A.output=Qt.escapeLast(A.output,"["),z("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ma("closing",")"));A.output=Qt.escapeLast(A.output,"("),z("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ma("closing","}"));A.output=Qt.escapeLast(A.output,"{"),z("braces")}if(r.strictSlashes!==!0&&(k.type==="star"||k.type==="bracket")&&H({type:"maybe_slash",value:"",output:`${h}?`}),A.backtrack===!0){A.output="";for(let G of A.tokens)A.output+=G.output!=null?G.output:G.value,G.suffix&&(A.output+=G.suffix)}return A};uy.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(yf,r.maxLength):yf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=K1[t]||t;let i=Qt.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:d,NO_DOTS_SLASH:p,STAR:h,START_ANCHOR:m}=gf.globChars(i),b=r.dot?d:l,y=r.dot?p:l,C=r.capture?"":"?:",E={negated:!1,prefix:""},g=r.bash===!0?".*?":h;r.capture&&(g=`(${g})`);let _=B=>B.noglobstar===!0?g:`(${C}(?:(?!${m}${B.dot?c:a}).)*?)`,x=B=>{switch(B){case"*":return`${b}${u}${g}`;case".*":return`${a}${u}${g}`;case"*.*":return`${b}${g}${a}${u}${g}`;case"*/*":return`${b}${g}${s}${u}${y}${g}`;case"**":return b+_(r);case"**/*":return`(?:${b}${_(r)}${s})?${y}${u}${g}`;case"**/*.*":return`(?:${b}${_(r)}${s})?${y}${g}${a}${u}${g}`;case"**/.*":return`(?:${b}${_(r)}${s})?${a}${u}${g}`;default:{let T=/^(.*?)\.(\w+)$/.exec(B);if(!T)return;let L=x(T[1]);return L?L+a+T[2]:void 0}}},$=Qt.removePrefix(t,E),F=x($);return F&&r.strictSlashes!==!0&&(F+=`${s}?`),F};G1.exports=uy});var J1=S((cX,Y1)=>{"use strict";var R9=require("path"),B9=z1(),cy=W1(),ly=zs(),N9=Vs(),L9=t=>t&&typeof t=="object"&&!Array.isArray(t),et=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(p=>et(p,e,r));return p=>{for(let h of l){let m=h(p);if(m)return m}return!1}}let n=L9(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},i=ly.isWindows(e),a=n?et.compileRe(t,e):et.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=et(o.ignore,l,r)}let c=(l,d=!1)=>{let{isMatch:p,match:h,output:m}=et.test(l,a,e,{glob:t,posix:i}),b={glob:t,state:s,regex:a,posix:i,input:l,output:m,match:h,isMatch:p};return typeof o.onResult=="function"&&o.onResult(b),p===!1?(b.isMatch=!1,d?b:!1):u(l)?(typeof o.onIgnore=="function"&&o.onIgnore(b),b.isMatch=!1,d?b:!1):(typeof o.onMatch=="function"&&o.onMatch(b),d?b:!0)};return r&&(c.state=s),c};et.test=(t,e,r,{glob:n,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},a=i.format||(o?ly.toPosixSlashes:null),s=t===n,u=s&&a?a(t):t;return s===!1&&(u=a?a(t):t,s=u===n),(s===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?s=et.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};et.matchBase=(t,e,r,n=ly.isWindows(r))=>(e instanceof RegExp?e:et.makeRe(e,r)).test(R9.basename(t));et.isMatch=(t,e,r)=>et(e,r)(t);et.parse=(t,e)=>Array.isArray(t)?t.map(r=>et.parse(r,e)):cy(t,{...e,fastpaths:!1});et.scan=(t,e)=>B9(t,e);et.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",a=o.contains?"":"$",s=`${i}(?:${t.output})${a}`;t&&t.negated===!0&&(s=`^(?!${s}).*$`);let u=et.toRegex(s,e);return n===!0&&(u.state=t),u};et.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=cy.fastpaths(t,e)),o.output||(o=cy(t,e)),et.compileRe(o,e,r,n)};et.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};et.constants=N9;Y1.exports=et});var Z1=S((lX,X1)=>{"use strict";X1.exports=J1()});var oF=S((fX,nF)=>{"use strict";var eF=require("util"),tF=$1(),Kr=Z1(),fy=zs(),Q1=t=>t===""||t==="./",rF=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Le=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,o=new Set,i=new Set,a=0,s=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let d=Kr(String(e[l]),{...r,onResult:s},!0),p=d.state.negated||d.state.negatedExtglob;p&&a++;for(let h of t){let m=d(h,!0);(p?!m.isMatch:m.isMatch)&&(p?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};Le.match=Le;Le.matcher=(t,e)=>Kr(t,e);Le.isMatch=(t,e,r)=>Kr(e,r)(t);Le.any=Le.isMatch;Le.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,o=[],i=s=>{r.onResult&&r.onResult(s),o.push(s.output)},a=new Set(Le(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};Le.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${eF.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Le.contains(t,n,r));if(typeof e=="string"){if(Q1(t)||Q1(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Le.isMatch(t,e,{...r,contains:!0})};Le.matchKeys=(t,e,r)=>{if(!fy.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Le(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};Le.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Kr(String(o),r);if(n.some(a=>i(a)))return!0}return!1};Le.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Kr(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};Le.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${eF.inspect(t)}"`);return[].concat(e).every(n=>Kr(n,r)(t))};Le.capture=(t,e,r)=>{let n=fy.isWindows(r),i=Kr.makeRe(String(t),{...r,capture:!0}).exec(n?fy.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};Le.makeRe=(...t)=>Kr.makeRe(...t);Le.scan=(...t)=>Kr.scan(...t);Le.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of tF(String(n),e))r.push(Kr.parse(o,e));return r};Le.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!rF(t)?[t]:tF(t,e)};Le.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Le.braces(t,{...e,expand:!0})};Le.hasBraces=rF;nF.exports=Le});var qF=S((cZ,Dn)=>{var $e=require("fs"),Cf=require("os"),yt=require("path"),SF=require("crypto"),Wr={fs:$e.constants,os:Cf.constants},xF="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",kF=/XXXXXX/,f7=3,PF=(Wr.O_CREAT||Wr.fs.O_CREAT)|(Wr.O_EXCL||Wr.fs.O_EXCL)|(Wr.O_RDWR||Wr.fs.O_RDWR),d7=Cf.platform()==="win32",p7=Wr.EBADF||Wr.os.errno.EBADF,h7=Wr.ENOENT||Wr.os.errno.ENOENT,$F=448,IF=384,m7="exit",ya=[],TF=$e.rmdirSync.bind($e),RF=!1;function g7(t,e){return $e.rm(t,{recursive:!0},e)}function BF(t){return $e.rmSync(t,{recursive:!0})}function yy(t,e){let r=Da(t,e),n=r[0],o=r[1];x7(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=LF(a);$e.stat(c,function(l){if(!l)return s-- >0?u():o(new Error("Could not get a unique tmp filename, max tries reached "+c));o(null,c)})}catch(c){o(c)}})()})}function Dy(t){let e=Da(t),r=e[0],n=A7(r),o=n.tries;do{let i=LF(n);try{$e.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function y7(t,e){let r=Da(t,e),n=r[0],o=r[1];yy(n,function(a,s){if(a)return o(a);$e.open(s,PF,n.mode||IF,function(c,l){if(c)return o(c);if(n.discardDescriptor)return $e.close(l,function(p){return o(p,s,void 0,my(s,-1,n,!1))});{let d=n.discardDescriptor||n.detachDescriptor;o(null,s,l,my(s,d?-1:l,n,!1))}})})}function D7(t){let e=Da(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=Dy(r),i=$e.openSync(o,PF,r.mode||IF);return r.discardDescriptor&&($e.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:my(o,n?-1:i,r,!0)}}function b7(t,e){let r=Da(t,e),n=r[0],o=r[1];yy(n,function(a,s){if(a)return o(a);$e.mkdir(s,n.mode||$F,function(c){if(c)return o(c);o(null,s,NF(s,n,!1))})})}function w7(t){let e=Da(t),r=e[0],n=Dy(r);return $e.mkdirSync(n,r.mode||$F),{name:n,removeCallback:NF(n,r,!0)}}function v7(t,e){let r=function(n){if(n&&!gy(n))return e(n);e()};0<=t[0]?$e.close(t[0],function(){$e.unlink(t[1],r)}):$e.unlink(t[1],r)}function C7(t){let e=null;try{0<=t[0]&&$e.closeSync(t[0])}catch(r){if(!O7(r)&&!gy(r))throw r}finally{try{$e.unlinkSync(t[1])}catch(r){gy(r)||(e=r)}}if(e!==null)throw e}function my(t,e,r,n){let o=vf(C7,[e,t],n),i=vf(v7,[e,t],n,o);return r.keep||ya.unshift(o),n?o:i}function NF(t,e,r){let n=e.unsafeCleanup?g7:$e.rmdir.bind($e),o=e.unsafeCleanup?BF:TF,i=vf(o,t,r),a=vf(n,t,r,i);return e.keep||ya.unshift(i),r?i:a}function vf(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=ya.indexOf(s);return u>=0&&ya.splice(u,1),o=!0,r||t===TF||t===BF?t(e):t(e,a||function(){})}}}function E7(){if(RF)for(;ya.length;)try{ya[0]()}catch{}}function AF(t){let e=[],r=null;try{r=SF.randomBytes(t)}catch{r=SF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(xF[r[n]%xF.length]);return e.join("")}function er(t){return typeof t>"u"}function Da(t,e){if(typeof t=="function")return[{},t];if(er(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function _7(t,e,r){let n=yt.isAbsolute(t)?t:yt.join(e,t);$e.stat(n,function(o){o?$e.realpath(yt.dirname(n),function(i,a){if(i)return r(i);r(null,yt.join(a,yt.basename(n)))}):$e.realpath(n,r)})}function S7(t,e){let r=yt.isAbsolute(t)?t:yt.join(e,t);try{return $e.statSync(r),$e.realpathSync(r)}catch{let o=$e.realpathSync(yt.dirname(r));return yt.join(o,yt.basename(r))}}function LF(t){let e=t.tmpdir;if(!er(t.name))return yt.join(e,t.dir,t.name);if(!er(t.template))return yt.join(e,t.dir,t.template).replace(kF,AF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",AF(12),t.postfix?"-"+t.postfix:""].join("");return yt.join(e,t.dir,r)}function jF(t){if(!er(t.name)){let e=t.name;if(yt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=yt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!er(t.template)&&!t.template.match(kF))throw new Error(`Invalid template, found "${t.template}".`);if(!er(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=er(t.name)?t.tries||f7:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=er(t.prefix)?"":t.prefix,t.postfix=er(t.postfix)?"":t.postfix}function OF(t,e,r,n){if(er(e))return n(null);_7(e,r,function(o,i){if(o)return n(o);let a=yt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function FF(t,e,r){if(er(e))return;let n=S7(e,r),o=yt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function x7(t,e){k7(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{jF(t,n)}catch(o){return e(o)}OF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=er(i)?"":i,OF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function A7(t){let e=t.tmpdir=MF(t);jF(t,e);let r=FF("dir",t.dir,e);return t.dir=er(r)?"":r,t.template=FF("template",t.template,e),t}function O7(t){return UF(t,-p7,"EBADF")}function gy(t){return UF(t,-h7,"ENOENT")}function UF(t,e,r){return d7?t.code===r:t.code===r&&t.errno===e}function F7(){RF=!0}function k7(t,e){return $e.realpath(t&&t.tmpdir||Cf.tmpdir(),e)}function MF(t){return $e.realpathSync(t&&t.tmpdir||Cf.tmpdir())}process.addListener(m7,E7);Object.defineProperty(Dn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return MF()}});Dn.exports.dir=b7;Dn.exports.dirSync=w7;Dn.exports.file=y7;Dn.exports.fileSync=D7;Dn.exports.tmpName=yy;Dn.exports.tmpNameSync=Dy;Dn.exports.setGracefulCleanup=F7});var Sf=require("node:process");var qy=ue(My(),1),{program:ot,createCommand:lq,createArgument:fq,createOption:dq,CommanderError:pq,InvalidArgumentError:hq,InvalidOptionArgumentError:mq,Command:gq,Argument:yq,Option:Dq,Help:bq}=qy.default;var yr={name:"@capgo/cli",version:"7.42.0",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#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","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",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","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var ua=require("node:fs");var Dt=ue(Kf(),1),zo=require("node:process"),wn=ue(require("node:readline"),1),Xf=ue(require("node:readline"),1),Qy=require("node:stream"),eD=ue(Wf(),1);function x2({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 A2=x2();function tD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(A2,"")}function rD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nD={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var o=n.charCodeAt(0),i=n.length==2?n.charCodeAt(1):0,a=o;return 55296<=o&&o<=56319&&56320<=i&&i<=57343&&(o&=1023,i&=1023,a=o<<10|i,a+=65536),a==12288||65281<=a&&a<=65376||65504<=a&&a<=65510?"F":a==8361||65377<=a&&a<=65470||65474<=a&&a<=65479||65482<=a&&a<=65487||65490<=a&&a<=65495||65498<=a&&a<=65500||65512<=a&&a<=65518?"H":4352<=a&&a<=4447||4515<=a&&a<=4519||4602<=a&&a<=4607||9001<=a&&a<=9002||11904<=a&&a<=11929||11931<=a&&a<=12019||12032<=a&&a<=12245||12272<=a&&a<=12283||12289<=a&&a<=12350||12353<=a&&a<=12438||12441<=a&&a<=12543||12549<=a&&a<=12589||12593<=a&&a<=12686||12688<=a&&a<=12730||12736<=a&&a<=12771||12784<=a&&a<=12830||12832<=a&&a<=12871||12880<=a&&a<=13054||13056<=a&&a<=19903||19968<=a&&a<=42124||42128<=a&&a<=42182||43360<=a&&a<=43388||44032<=a&&a<=55203||55216<=a&&a<=55238||55243<=a&&a<=55291||63744<=a&&a<=64255||65040<=a&&a<=65049||65072<=a&&a<=65106||65108<=a&&a<=65126||65128<=a&&a<=65131||110592<=a&&a<=110593||127488<=a&&a<=127490||127504<=a&&a<=127546||127552<=a&&a<=127560||127568<=a&&a<=127569||131072<=a&&a<=194367||177984<=a&&a<=196605||196608<=a&&a<=262141?"W":32<=a&&a<=126||162<=a&&a<=163||165<=a&&a<=166||a==172||a==175||10214<=a&&a<=10221||10629<=a&&a<=10630?"Na":a==161||a==164||167<=a&&a<=168||a==170||173<=a&&a<=174||176<=a&&a<=180||182<=a&&a<=186||188<=a&&a<=191||a==198||a==208||215<=a&&a<=216||222<=a&&a<=225||a==230||232<=a&&a<=234||236<=a&&a<=237||a==240||242<=a&&a<=243||247<=a&&a<=250||a==252||a==254||a==257||a==273||a==275||a==283||294<=a&&a<=295||a==299||305<=a&&a<=307||a==312||319<=a&&a<=322||a==324||328<=a&&a<=331||a==333||338<=a&&a<=339||358<=a&&a<=359||a==363||a==462||a==464||a==466||a==468||a==470||a==472||a==474||a==476||a==593||a==609||a==708||a==711||713<=a&&a<=715||a==717||a==720||728<=a&&a<=731||a==733||a==735||768<=a&&a<=879||913<=a&&a<=929||931<=a&&a<=937||945<=a&&a<=961||963<=a&&a<=969||a==1025||1040<=a&&a<=1103||a==1105||a==8208||8211<=a&&a<=8214||8216<=a&&a<=8217||8220<=a&&a<=8221||8224<=a&&a<=8226||8228<=a&&a<=8231||a==8240||8242<=a&&a<=8243||a==8245||a==8251||a==8254||a==8308||a==8319||8321<=a&&a<=8324||a==8364||a==8451||a==8453||a==8457||a==8467||a==8470||8481<=a&&a<=8482||a==8486||a==8491||8531<=a&&a<=8532||8539<=a&&a<=8542||8544<=a&&a<=8555||8560<=a&&a<=8569||a==8585||8592<=a&&a<=8601||8632<=a&&a<=8633||a==8658||a==8660||a==8679||a==8704||8706<=a&&a<=8707||8711<=a&&a<=8712||a==8715||a==8719||a==8721||a==8725||a==8730||8733<=a&&a<=8736||a==8739||a==8741||8743<=a&&a<=8748||a==8750||8756<=a&&a<=8759||8764<=a&&a<=8765||a==8776||a==8780||a==8786||8800<=a&&a<=8801||8804<=a&&a<=8807||8810<=a&&a<=8811||8814<=a&&a<=8815||8834<=a&&a<=8835||8838<=a&&a<=8839||a==8853||a==8857||a==8869||a==8895||a==8978||9312<=a&&a<=9449||9451<=a&&a<=9547||9552<=a&&a<=9587||9600<=a&&a<=9615||9618<=a&&a<=9621||9632<=a&&a<=9633||9635<=a&&a<=9641||9650<=a&&a<=9651||9654<=a&&a<=9655||9660<=a&&a<=9661||9664<=a&&a<=9665||9670<=a&&a<=9672||a==9675||9678<=a&&a<=9681||9698<=a&&a<=9701||a==9711||9733<=a&&a<=9734||a==9737||9742<=a&&a<=9743||9748<=a&&a<=9749||a==9756||a==9758||a==9792||a==9794||9824<=a&&a<=9825||9827<=a&&a<=9829||9831<=a&&a<=9834||9836<=a&&a<=9837||a==9839||9886<=a&&a<=9887||9918<=a&&a<=9919||9924<=a&&a<=9933||9935<=a&&a<=9953||a==9955||9960<=a&&a<=9983||a==10045||a==10071||10102<=a&&a<=10111||11093<=a&&a<=11097||12872<=a&&a<=12879||57344<=a&&a<=63743||65024<=a&&a<=65039||a==65533||127232<=a&&a<=127242||127248<=a&&a<=127277||127280<=a&&a<=127337||127344<=a&&a<=127386||917760<=a&&a<=917999||983040<=a&&a<=1048573||1048576<=a&&a<=1114109?"A":"N"},e.characterLength=function(n){var o=this.eastAsianWidth(n);return o=="F"||o=="W"||o=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var o=r(n),i=0,a=0;a<o.length;a++)i=i+this.characterLength(o[a]);return i},e.slice=function(n,o,i){textLen=e.length(n),o=o||0,i=i||1,o<0&&(o=textLen+o),i<0&&(i=textLen+i);for(var a="",s=0,u=r(n),c=0;c<u.length;c++){var l=u[c],d=e.length(l);if(s>=o-(d==2?1:0))if(s+d<=i)a+=l;else break;s+=d}return a}})(nD);var O2=nD.exports,F2=rD(O2),k2=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},P2=rD(k2);function Ca(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=tD(t),t.length===0))return 0;t=t.replace(P2()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let o of t){let i=o.codePointAt(0);if(!(i<=31||i>=127&&i<=159||i>=768&&i<=879))switch(F2.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Yf=10,Ky=(t=0)=>e=>`\x1B[${e+t}m`,Gy=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Wy=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,je={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(je.modifier);var $2=Object.keys(je.color),I2=Object.keys(je.bgColor);[...$2,...I2];function T2(){let t=new Map;for(let[e,r]of Object.entries(je)){for(let[n,o]of Object.entries(r))je[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=je[n],t.set(o[0],o[1]);Object.defineProperty(je,e,{value:r,enumerable:!1})}return Object.defineProperty(je,"codes",{value:t,enumerable:!1}),je.color.close="\x1B[39m",je.bgColor.close="\x1B[49m",je.color.ansi=Ky(),je.color.ansi256=Gy(),je.color.ansi16m=Wy(),je.bgColor.ansi=Ky(Yf),je.bgColor.ansi256=Gy(Yf),je.bgColor.ansi16m=Wy(Yf),Object.defineProperties(je,{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(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:e=>je.rgbToAnsi256(...je.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,o;if(e>=232)r=((e-232)*10+8)/255,n=r,o=r;else{e-=16;let s=e%36;r=Math.floor(e/36)/5,n=Math.floor(s/6)/5,o=s%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let a=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>je.ansi256ToAnsi(je.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>je.ansi256ToAnsi(je.hexToAnsi256(e)),enumerable:!1}}),je}var R2=T2(),cu=new Set(["\x1B","\x9B"]),B2=39,Qf="\x07",oD="[",N2="]",iD="m",ed=`${N2}8;;`,Yy=t=>`${cu.values().next().value}${oD}${t}${iD}`,Jy=t=>`${cu.values().next().value}${ed}${t}${Qf}`,L2=t=>t.split(" ").map(e=>Ca(e)),Jf=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=Ca(tD(t[t.length-1]));for(let[s,u]of n.entries()){let c=Ca(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),cu.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(ed)),o){i?u===Qf&&(o=!1,i=!1):u===iD&&(o=!1);continue}a+=c,a===r&&s<n.length-1&&(t.push(""),a=0)}!a&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},j2=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Ca(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},U2=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=L2(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=Ca(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Jf(s,l,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){Jf(s,l,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){Jf(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(c=>j2(c)));let u=[...s.join(`
|
|
106
|
+
tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}var sA=Xe(()=>{aA()});async function Dg(t=x5){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 Il(`Cannot find Windows browser in stdout: ${JSON.stringify(e)}`);let{id:n}=r.groups,o=lA[n];if(!o)throw new Il(`Unknown browser ID: ${n}`);return o}var uA,cA,x5,lA,yg,Il,bg=Xe(()=>{uA=require("node:util"),cA=require("node:child_process"),x5=(0,uA.promisify)(cA.execFile),lA={MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},MSEdgeBHTML:{name:"Edge Beta",id:"com.microsoft.edge.beta"},MSEdgeDHTML:{name:"Edge Dev",id:"com.microsoft.edge.dev"},AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},ChromeBHTML:{name:"Chrome Beta",id:"com.google.chrome.beta"},ChromeDHTML:{name:"Chrome Dev",id:"com.google.chrome.dev"},ChromiumHTM:{name:"Chromium",id:"org.chromium.Chromium"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveDHTML:{name:"Brave Dev",id:"com.brave.Browser.dev"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},OperaStable:{name:"Opera",id:"com.operasoftware.Opera"},VivaldiHTM:{name:"Vivaldi",id:"com.vivaldi.Vivaldi"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"}},yg=new Map(Object.entries(lA)),Il=class extends Error{}});async function wg(){if(Tl.default.platform==="darwin"){let t=await hg();return{name:await gg(t),id:t}}if(Tl.default.platform==="linux"){let{stdout:t}=await A5("xdg-mime",["query","default","x-scheme-handler/http"]),e=t.trim();return{name:O5(e.replace(/.desktop$/,"").replace("-"," ")),id:e}}if(Tl.default.platform==="win32")return Dg();throw new Error("Only macOS, Linux, and Windows are supported")}var fA,Tl,dA,A5,O5,pA=Xe(()=>{fA=require("node:util"),Tl=ue(require("node:process"),1),dA=require("node:child_process");rA();sA();bg();bg();A5=(0,fA.promisify)(dA.execFile),O5=t=>t.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,e=>e.toUpperCase())});var Rl,F5,hA,mA=Xe(()=>{Rl=ue(require("node:process"),1),F5=!!(Rl.default.env.SSH_CONNECTION||Rl.default.env.SSH_CLIENT||Rl.default.env.SSH_TTY),hA=F5});var _g={};Yr(_g,{apps:()=>Po,default:()=>$5,openApp:()=>P5});function bA(t){if(typeof t=="string"||Array.isArray(t))return t;let{[yA]:e}=t;if(!e)throw new Error(`${yA} is not supported`);return e}function Fs({[Qi]:t},{wsl:e}={}){if(e&&cn)return bA(e);if(!t)throw new Error(`${Qi} is not supported`);return bA(t)}var Cg,Eg,vA,CA,Nl,wA,Bl,vg,gA,Qi,yA,DA,Os,k5,P5,Po,$5,Sg=Xe(()=>{Cg=ue(require("node:process"),1),Eg=ue(require("node:path"),1),vA=require("node:url"),CA=ue(require("node:child_process"),1),Nl=ue(require("node:fs/promises"),1);Xx();pg();Zx();pA();ug();mA();wA={},Bl=Symbol("fallbackAttempt"),vg=wA.url?Eg.default.dirname((0,vA.fileURLToPath)(wA.url)):"",gA=Eg.default.join(vg,"xdg-open"),{platform:Qi,arch:yA}=Cg.default,DA=async(t,e)=>{if(t.length===0)return;let r=[];for(let n of t)try{return await e(n)}catch(o){r.push(o)}throw new AggregateError(r,"Failed to open in all supported apps")},Os=async t=>{t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t};let e=t[Bl]===!0;if(delete t[Bl],Array.isArray(t.app))return DA(t.app,c=>Os({...t,app:c,[Bl]:!0}));let{name:r,arguments:n=[]}=t.app??{};if(n=[...n],Array.isArray(r))return DA(r,c=>Os({...t,app:{name:c,arguments:n},[Bl]:!0}));if(r==="browser"||r==="browserPrivate"){let c={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","com.brave.browser":"brave","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","com.microsoft.edgemac":"edge","microsoft-edge.desktop":"edge","com.apple.safari":"safari"},l={chrome:"--incognito",brave:"--incognito",firefox:"--private-window",edge:"--inPrivate"},d;if(cn){let p=await Yx();d=yg.get(p)??{}}else d=await wg();if(d.id in c){let p=c[d.id.toLowerCase()];if(r==="browserPrivate"){if(p==="safari")throw new Error("Safari doesn't support opening in private mode via command line");n.push(l[p])}return Os({...t,app:{name:Po[p],arguments:n}})}throw new Error(`${d.name} is not supported as a default browser`)}let o,i=[],a={},s=!1;if(cn&&!Zi()&&!hA&&!r&&(s=await Wx()),Qi==="darwin")o="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),r&&i.push("-a",r);else if(Qi==="win32"||s){o=await $l(),i.push(...Wt.argumentsPrefix),cn||(a.windowsVerbatimArguments=!0),cn&&t.target&&(t.target=await Jx(t.target));let c=["$ProgressPreference = 'SilentlyContinue';","Start"];t.wait&&c.push("-Wait"),r?(c.push(Wt.escapeArgument(r)),t.target&&n.push(t.target)):t.target&&c.push(Wt.escapeArgument(t.target)),n.length>0&&(n=n.map(l=>Wt.escapeArgument(l)),c.push("-ArgumentList",n.join(","))),t.target=Wt.encodeCommand(c.join(" ")),t.wait||(a.stdio="ignore")}else{if(r)o=r;else{let c=!vg||vg==="/",l=!1;try{await Nl.default.access(gA,Nl.constants.X_OK),l=!0}catch{}o=Cg.default.versions.electron??(Qi==="android"||c||!l)?"xdg-open":gA}n.length>0&&i.push(...n),t.wait||(a.stdio="ignore",a.detached=!0)}Qi==="darwin"&&n.length>0&&i.push("--args",...n),t.target&&i.push(t.target);let u=CA.default.spawn(o,i,a);return t.wait?new Promise((c,l)=>{u.once("error",l),u.once("close",d=>{if(!t.allowNonzeroExitCode&&d!==0){l(new Error(`Exited with code ${d}`));return}c(u)})}):e?new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.once("close",d=>{if(u.off("error",l),d!==0){l(new Error(`Exited with code ${d}`));return}u.unref(),c(u)})})}):(u.unref(),new Promise((c,l)=>{u.once("error",l),u.once("spawn",()=>{u.off("error",l),c(u)})}))},k5=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Os({...e,target:t})},P5=(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 Os({...e,app:{name:t,arguments:r}})};Po={browser:"browser",browserPrivate:"browserPrivate"};ko(Po,"chrome",()=>Fs({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium","chromium-browser"]},{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"]}}));ko(Po,"brave",()=>Fs({darwin:"brave browser",win32:"brave",linux:["brave-browser","brave"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe",x64:["/mnt/c/Program Files/BraveSoftware/Brave-Browser/Application/brave.exe","/mnt/c/Program Files (x86)/BraveSoftware/Brave-Browser/Application/brave.exe"]}}));ko(Po,"firefox",()=>Fs({darwin:"firefox",win32:String.raw`C:\Program Files\Mozilla Firefox\firefox.exe`,linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));ko(Po,"edge",()=>Fs({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));ko(Po,"safari",()=>Fs({darwin:"Safari"}));$5=k5});var ff=S(hr=>{"use strict";hr.isInteger=t=>typeof t=="number"?Number.isInteger(t):typeof t=="string"&&t.trim()!==""?Number.isInteger(Number(t)):!1;hr.find=(t,e)=>t.nodes.find(r=>r.type===e);hr.exceedsLimit=(t,e,r=1,n)=>n===!1||!hr.isInteger(t)||!hr.isInteger(e)?!1:(Number(e)-Number(t))/Number(r)>=n;hr.escapeNode=(t,e=0,r)=>{let n=t.nodes[e];n&&(r&&n.type===r||n.type==="open"||n.type==="close")&&n.escaped!==!0&&(n.value="\\"+n.value,n.escaped=!0)};hr.encloseBrace=t=>t.type!=="brace"?!1:t.commas>>0+t.ranges>>0===0?(t.invalid=!0,!0):!1;hr.isInvalidBrace=t=>t.type!=="brace"?!1:t.invalid===!0||t.dollar?!0:t.commas>>0+t.ranges>>0===0||t.open!==!0||t.close!==!0?(t.invalid=!0,!0):!1;hr.isOpenOrClose=t=>t.type==="open"||t.type==="close"?!0:t.open===!0||t.close===!0;hr.reduce=t=>t.reduce((e,r)=>(r.type==="text"&&e.push(r.value),r.type==="range"&&(r.type="text"),e),[]);hr.flatten=(...t)=>{let e=[],r=n=>{for(let o=0;o<n.length;o++){let i=n[o];if(Array.isArray(i)){r(i);continue}i!==void 0&&e.push(i)}return e};return r(t),e}});var df=S((JJ,Z1)=>{"use strict";var X1=ff();Z1.exports=(t,e={})=>{let r=(n,o={})=>{let i=e.escapeInvalid&&X1.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s="";if(n.value)return(i||a)&&X1.isOpenOrClose(n)?"\\"+n.value:n.value;if(n.value)return n.value;if(n.nodes)for(let u of n.nodes)s+=r(u);return s};return r(t)}});var eO=S((XJ,Q1)=>{"use strict";Q1.exports=function(t){return typeof t=="number"?t-t===0:typeof t=="string"&&t.trim()!==""?Number.isFinite?Number.isFinite(+t):isFinite(+t):!1}});var cO=S((ZJ,uO)=>{"use strict";var tO=eO(),Mo=(t,e,r)=>{if(tO(t)===!1)throw new TypeError("toRegexRange: expected the first argument to be a number");if(e===void 0||t===e)return String(t);if(tO(e)===!1)throw new TypeError("toRegexRange: expected the second argument to be a number.");let n={relaxZeros:!0,...r};typeof n.strictZeros=="boolean"&&(n.relaxZeros=n.strictZeros===!1);let o=String(n.relaxZeros),i=String(n.shorthand),a=String(n.capture),s=String(n.wrap),u=t+":"+e+"="+o+i+a+s;if(Mo.cache.hasOwnProperty(u))return Mo.cache[u].result;let c=Math.min(t,e),l=Math.max(t,e);if(Math.abs(c-l)===1){let b=t+"|"+e;return n.capture?`(${b})`:n.wrap===!1?b:`(?:${b})`}let d=sO(t)||sO(e),p={min:t,max:e,a:c,b:l},h=[],m=[];if(d&&(p.isPadded=d,p.maxLen=String(p.max).length),c<0){let b=l<0?Math.abs(l):1;m=rO(b,Math.abs(c),p,n),c=p.a=0}return l>=0&&(h=rO(c,l,p,n)),p.negatives=m,p.positives=h,p.result=SM(m,h,n),n.capture===!0?p.result=`(${p.result})`:n.wrap!==!1&&h.length+m.length>1&&(p.result=`(?:${p.result})`),Mo.cache[u]=p,p.result};function SM(t,e,r){let n=Jg(t,e,"-",!1,r)||[],o=Jg(e,t,"",!1,r)||[],i=Jg(t,e,"-?",!0,r)||[];return n.concat(i).concat(o).join("|")}function xM(t,e){let r=1,n=1,o=oO(t,r),i=new Set([e]);for(;t<=o&&o<=e;)i.add(o),r+=1,o=oO(t,r);for(o=iO(e+1,n)-1;t<o&&o<=e;)i.add(o),n+=1,o=iO(e+1,n)-1;return i=[...i],i.sort(FM),i}function AM(t,e,r){if(t===e)return{pattern:t,count:[],digits:0};let n=OM(t,e),o=n.length,i="",a=0;for(let s=0;s<o;s++){let[u,c]=n[s];u===c?i+=u:u!=="0"||c!=="9"?i+=kM(u,c,r):a++}return a&&(i+=r.shorthand===!0?"\\d":"[0-9]"),{pattern:i,count:[a],digits:o}}function rO(t,e,r,n){let o=xM(t,e),i=[],a=t,s;for(let u=0;u<o.length;u++){let c=o[u],l=AM(String(a),String(c),n),d="";if(!r.isPadded&&s&&s.pattern===l.pattern){s.count.length>1&&s.count.pop(),s.count.push(l.count[0]),s.string=s.pattern+aO(s.count),a=c+1;continue}r.isPadded&&(d=PM(c,r,n)),l.string=d+l.pattern+aO(l.count),i.push(l),a=c+1,s=l}return i}function Jg(t,e,r,n,o){let i=[];for(let a of t){let{string:s}=a;!n&&!nO(e,"string",s)&&i.push(r+s),n&&nO(e,"string",s)&&i.push(r+s)}return i}function OM(t,e){let r=[];for(let n=0;n<t.length;n++)r.push([t[n],e[n]]);return r}function FM(t,e){return t>e?1:e>t?-1:0}function nO(t,e,r){return t.some(n=>n[e]===r)}function oO(t,e){return Number(String(t).slice(0,-e)+"9".repeat(e))}function iO(t,e){return t-t%Math.pow(10,e)}function aO(t){let[e=0,r=""]=t;return r||e>1?`{${e+(r?","+r:"")}}`:""}function kM(t,e,r){return`[${t}${e-t===1?"":"-"}${e}]`}function sO(t){return/^-?(0+)\d/.test(t)}function PM(t,e,r){if(!e.isPadded)return t;let n=Math.abs(e.maxLen-String(t).length),o=r.relaxZeros!==!1;switch(n){case 0:return"";case 1:return o?"0?":"0";case 2:return o?"0{0,2}":"00";default:return o?`0{0,${n}}`:`0{${n}}`}}Mo.cache={};Mo.clearCache=()=>Mo.cache={};uO.exports=Mo});var Qg=S((QJ,gO)=>{"use strict";var $M=require("util"),fO=cO(),lO=t=>t!==null&&typeof t=="object"&&!Array.isArray(t),IM=t=>e=>t===!0?Number(e):String(e),Xg=t=>typeof t=="number"||typeof t=="string"&&t!=="",Hs=t=>Number.isInteger(+t),Zg=t=>{let e=`${t}`,r=-1;if(e[0]==="-"&&(e=e.slice(1)),e==="0")return!1;for(;e[++r]==="0";);return r>0},TM=(t,e,r)=>typeof t=="string"||typeof e=="string"?!0:r.stringify===!0,RM=(t,e,r)=>{if(e>0){let n=t[0]==="-"?"-":"";n&&(t=t.slice(1)),t=n+t.padStart(n?e-1:e,"0")}return r===!1?String(t):t},hf=(t,e)=>{let r=t[0]==="-"?"-":"";for(r&&(t=t.slice(1),e--);t.length<e;)t="0"+t;return r?"-"+t:t},BM=(t,e,r)=>{t.negatives.sort((s,u)=>s<u?-1:s>u?1:0),t.positives.sort((s,u)=>s<u?-1:s>u?1:0);let n=e.capture?"":"?:",o="",i="",a;return t.positives.length&&(o=t.positives.map(s=>hf(String(s),r)).join("|")),t.negatives.length&&(i=`-(${n}${t.negatives.map(s=>hf(String(s),r)).join("|")})`),o&&i?a=`${o}|${i}`:a=o||i,e.wrap?`(${n}${a})`:a},dO=(t,e,r,n)=>{if(r)return fO(t,e,{wrap:!1,...n});let o=String.fromCharCode(t);if(t===e)return o;let i=String.fromCharCode(e);return`[${o}-${i}]`},pO=(t,e,r)=>{if(Array.isArray(t)){let n=r.wrap===!0,o=r.capture?"":"?:";return n?`(${o}${t.join("|")})`:t.join("|")}return fO(t,e,r)},hO=(...t)=>new RangeError("Invalid range arguments: "+$M.inspect(...t)),mO=(t,e,r)=>{if(r.strictRanges===!0)throw hO([t,e]);return[]},NM=(t,e)=>{if(e.strictRanges===!0)throw new TypeError(`Expected step "${t}" to be a number`);return[]},LM=(t,e,r=1,n={})=>{let o=Number(t),i=Number(e);if(!Number.isInteger(o)||!Number.isInteger(i)){if(n.strictRanges===!0)throw hO([t,e]);return[]}o===0&&(o=0),i===0&&(i=0);let a=o>i,s=String(t),u=String(e),c=String(r);r=Math.max(Math.abs(r),1);let l=Zg(s)||Zg(u)||Zg(c),d=l?Math.max(s.length,u.length,c.length):0,p=l===!1&&TM(t,e,n)===!1,h=n.transform||IM(p);if(n.toRegex&&r===1)return dO(hf(t,d),hf(e,d),!0,n);let m={negatives:[],positives:[]},b=E=>m[E<0?"negatives":"positives"].push(Math.abs(E)),y=[],C=0;for(;a?o>=i:o<=i;)n.toRegex===!0&&r>1?b(o):y.push(RM(h(o,C),d,p)),o=a?o-r:o+r,C++;return n.toRegex===!0?r>1?BM(m,n,d):pO(y,null,{wrap:!1,...n}):y},jM=(t,e,r=1,n={})=>{if(!Hs(t)&&t.length>1||!Hs(e)&&e.length>1)return mO(t,e,n);let o=n.transform||(p=>String.fromCharCode(p)),i=`${t}`.charCodeAt(0),a=`${e}`.charCodeAt(0),s=i>a,u=Math.min(i,a),c=Math.max(i,a);if(n.toRegex&&r===1)return dO(u,c,!1,n);let l=[],d=0;for(;s?i>=a:i<=a;)l.push(o(i,d)),i=s?i-r:i+r,d++;return n.toRegex===!0?pO(l,null,{wrap:!1,options:n}):l},pf=(t,e,r,n={})=>{if(e==null&&Xg(t))return[t];if(!Xg(t)||!Xg(e))return mO(t,e,n);if(typeof r=="function")return pf(t,e,1,{transform:r});if(lO(r))return pf(t,e,0,r);let o={...n};return o.capture===!0&&(o.wrap=!0),r=r||o.step||1,Hs(r)?Hs(t)&&Hs(e)?LM(t,e,r,o):jM(t,e,Math.max(Math.abs(r),1),o):r!=null&&!lO(r)?NM(r,o):pf(t,e,1,r)};gO.exports=pf});var bO=S((eX,DO)=>{"use strict";var UM=Qg(),yO=ff(),MM=(t,e={})=>{let r=(n,o={})=>{let i=yO.isInvalidBrace(o),a=n.invalid===!0&&e.escapeInvalid===!0,s=i===!0||a===!0,u=e.escapeInvalid===!0?"\\":"",c="";if(n.isOpen===!0)return u+n.value;if(n.isClose===!0)return console.log("node.isClose",u,n.value),u+n.value;if(n.type==="open")return s?u+n.value:"(";if(n.type==="close")return s?u+n.value:")";if(n.type==="comma")return n.prev.type==="comma"?"":s?n.value:"|";if(n.value)return n.value;if(n.nodes&&n.ranges>0){let l=yO.reduce(n.nodes),d=UM(...l,{...e,wrap:!1,toRegex:!0,strictZeros:!0});if(d.length!==0)return l.length>1&&d.length>1?`(${d})`:d}if(n.nodes)for(let l of n.nodes)c+=r(l,n);return c};return r(t)};DO.exports=MM});var CO=S((tX,vO)=>{"use strict";var qM=Qg(),wO=df(),ha=ff(),qo=(t="",e="",r=!1)=>{let n=[];if(t=[].concat(t),e=[].concat(e),!e.length)return t;if(!t.length)return r?ha.flatten(e).map(o=>`{${o}}`):e;for(let o of t)if(Array.isArray(o))for(let i of o)n.push(qo(i,e,r));else for(let i of e)r===!0&&typeof i=="string"&&(i=`{${i}}`),n.push(Array.isArray(i)?qo(o,i,r):o+i);return ha.flatten(n)},HM=(t,e={})=>{let r=e.rangeLimit===void 0?1e3:e.rangeLimit,n=(o,i={})=>{o.queue=[];let a=i,s=i.queue;for(;a.type!=="brace"&&a.type!=="root"&&a.parent;)a=a.parent,s=a.queue;if(o.invalid||o.dollar){s.push(qo(s.pop(),wO(o,e)));return}if(o.type==="brace"&&o.invalid!==!0&&o.nodes.length===2){s.push(qo(s.pop(),["{}"]));return}if(o.nodes&&o.ranges>0){let d=ha.reduce(o.nodes);if(ha.exceedsLimit(...d,e.step,r))throw new RangeError("expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.");let p=qM(...d,e);p.length===0&&(p=wO(o,e)),s.push(qo(s.pop(),p)),o.nodes=[];return}let u=ha.encloseBrace(o),c=o.queue,l=o;for(;l.type!=="brace"&&l.type!=="root"&&l.parent;)l=l.parent,c=l.queue;for(let d=0;d<o.nodes.length;d++){let p=o.nodes[d];if(p.type==="comma"&&o.type==="brace"){d===1&&c.push(""),c.push("");continue}if(p.type==="close"){s.push(qo(s.pop(),c,u));continue}if(p.value&&p.type!=="open"){c.push(qo(c.pop(),p.value));continue}p.nodes&&n(p,o)}return c};return ha.flatten(n(t))};vO.exports=HM});var _O=S((rX,EO)=>{"use strict";EO.exports={MAX_LENGTH:1e4,CHAR_0:"0",CHAR_9:"9",CHAR_UPPERCASE_A:"A",CHAR_LOWERCASE_A:"a",CHAR_UPPERCASE_Z:"Z",CHAR_LOWERCASE_Z:"z",CHAR_LEFT_PARENTHESES:"(",CHAR_RIGHT_PARENTHESES:")",CHAR_ASTERISK:"*",CHAR_AMPERSAND:"&",CHAR_AT:"@",CHAR_BACKSLASH:"\\",CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:"\r",CHAR_CIRCUMFLEX_ACCENT:"^",CHAR_COLON:":",CHAR_COMMA:",",CHAR_DOLLAR:"$",CHAR_DOT:".",CHAR_DOUBLE_QUOTE:'"',CHAR_EQUAL:"=",CHAR_EXCLAMATION_MARK:"!",CHAR_FORM_FEED:"\f",CHAR_FORWARD_SLASH:"/",CHAR_HASH:"#",CHAR_HYPHEN_MINUS:"-",CHAR_LEFT_ANGLE_BRACKET:"<",CHAR_LEFT_CURLY_BRACE:"{",CHAR_LEFT_SQUARE_BRACKET:"[",CHAR_LINE_FEED:`
|
|
107
|
+
`,CHAR_NO_BREAK_SPACE:"\xA0",CHAR_PERCENT:"%",CHAR_PLUS:"+",CHAR_QUESTION_MARK:"?",CHAR_RIGHT_ANGLE_BRACKET:">",CHAR_RIGHT_CURLY_BRACE:"}",CHAR_RIGHT_SQUARE_BRACKET:"]",CHAR_SEMICOLON:";",CHAR_SINGLE_QUOTE:"'",CHAR_SPACE:" ",CHAR_TAB:" ",CHAR_UNDERSCORE:"_",CHAR_VERTICAL_LINE:"|",CHAR_ZERO_WIDTH_NOBREAK_SPACE:"\uFEFF"}});var FO=S((nX,OO)=>{"use strict";var VM=df(),{MAX_LENGTH:SO,CHAR_BACKSLASH:ey,CHAR_BACKTICK:zM,CHAR_COMMA:KM,CHAR_DOT:GM,CHAR_LEFT_PARENTHESES:WM,CHAR_RIGHT_PARENTHESES:YM,CHAR_LEFT_CURLY_BRACE:JM,CHAR_RIGHT_CURLY_BRACE:XM,CHAR_LEFT_SQUARE_BRACKET:xO,CHAR_RIGHT_SQUARE_BRACKET:AO,CHAR_DOUBLE_QUOTE:ZM,CHAR_SINGLE_QUOTE:QM,CHAR_NO_BREAK_SPACE:e9,CHAR_ZERO_WIDTH_NOBREAK_SPACE:t9}=_O(),r9=(t,e={})=>{if(typeof t!="string")throw new TypeError("Expected a string");let r=e||{},n=typeof r.maxLength=="number"?Math.min(SO,r.maxLength):SO;if(t.length>n)throw new SyntaxError(`Input length (${t.length}), exceeds max characters (${n})`);let o={type:"root",input:t,nodes:[]},i=[o],a=o,s=o,u=0,c=t.length,l=0,d=0,p,h=()=>t[l++],m=b=>{if(b.type==="text"&&s.type==="dot"&&(s.type="text"),s&&s.type==="text"&&b.type==="text"){s.value+=b.value;return}return a.nodes.push(b),b.parent=a,b.prev=s,s=b,b};for(m({type:"bos"});l<c;)if(a=i[i.length-1],p=h(),!(p===t9||p===e9)){if(p===ey){m({type:"text",value:(e.keepEscaping?p:"")+h()});continue}if(p===AO){m({type:"text",value:"\\"+p});continue}if(p===xO){u++;let b;for(;l<c&&(b=h());){if(p+=b,b===xO){u++;continue}if(b===ey){p+=h();continue}if(b===AO&&(u--,u===0))break}m({type:"text",value:p});continue}if(p===WM){a=m({type:"paren",nodes:[]}),i.push(a),m({type:"text",value:p});continue}if(p===YM){if(a.type!=="paren"){m({type:"text",value:p});continue}a=i.pop(),m({type:"text",value:p}),a=i[i.length-1];continue}if(p===ZM||p===QM||p===zM){let b=p,y;for(e.keepQuotes!==!0&&(p="");l<c&&(y=h());){if(y===ey){p+=y+h();continue}if(y===b){e.keepQuotes===!0&&(p+=y);break}p+=y}m({type:"text",value:p});continue}if(p===JM){d++;let y={type:"brace",open:!0,close:!1,dollar:s.value&&s.value.slice(-1)==="$"||a.dollar===!0,depth:d,commas:0,ranges:0,nodes:[]};a=m(y),i.push(a),m({type:"open",value:p});continue}if(p===XM){if(a.type!=="brace"){m({type:"text",value:p});continue}let b="close";a=i.pop(),a.close=!0,m({type:b,value:p}),d--,a=i[i.length-1];continue}if(p===KM&&d>0){if(a.ranges>0){a.ranges=0;let b=a.nodes.shift();a.nodes=[b,{type:"text",value:VM(a)}]}m({type:"comma",value:p}),a.commas++;continue}if(p===GM&&d>0&&a.commas===0){let b=a.nodes;if(d===0||b.length===0){m({type:"text",value:p});continue}if(s.type==="dot"){if(a.range=[],s.value+=p,s.type="range",a.nodes.length!==3&&a.nodes.length!==5){a.invalid=!0,a.ranges=0,s.type="text";continue}a.ranges++,a.args=[];continue}if(s.type==="range"){b.pop();let y=b[b.length-1];y.value+=s.value+p,s=y,a.ranges--;continue}m({type:"dot",value:p});continue}m({type:"text",value:p})}do if(a=i.pop(),a.type!=="root"){a.nodes.forEach(C=>{C.nodes||(C.type==="open"&&(C.isOpen=!0),C.type==="close"&&(C.isClose=!0),C.nodes||(C.type="text"),C.invalid=!0)});let b=i[i.length-1],y=b.nodes.indexOf(a);b.nodes.splice(y,1,...a.nodes)}while(i.length>0);return m({type:"eos"}),o};OO.exports=r9});var $O=S((oX,PO)=>{"use strict";var kO=df(),n9=bO(),o9=CO(),i9=FO(),Zt=(t,e={})=>{let r=[];if(Array.isArray(t))for(let n of t){let o=Zt.create(n,e);Array.isArray(o)?r.push(...o):r.push(o)}else r=[].concat(Zt.create(t,e));return e&&e.expand===!0&&e.nodupes===!0&&(r=[...new Set(r)]),r};Zt.parse=(t,e={})=>i9(t,e);Zt.stringify=(t,e={})=>kO(typeof t=="string"?Zt.parse(t,e):t,e);Zt.compile=(t,e={})=>(typeof t=="string"&&(t=Zt.parse(t,e)),n9(t,e));Zt.expand=(t,e={})=>{typeof t=="string"&&(t=Zt.parse(t,e));let r=o9(t,e);return e.noempty===!0&&(r=r.filter(Boolean)),e.nodupes===!0&&(r=[...new Set(r)]),r};Zt.create=(t,e={})=>t===""||t.length<3?[t]:e.expand!==!0?Zt.compile(t,e):Zt.expand(t,e);PO.exports=Zt});var Vs=S((iX,NO)=>{"use strict";var a9=require("path"),zr="\\\\/",IO=`[^${zr}]`,yn="\\.",s9="\\+",u9="\\?",mf="\\/",c9="(?=.)",TO="[^/]",ty=`(?:${mf}|$)`,RO=`(?:^|${mf})`,ry=`${yn}{1,2}${ty}`,l9=`(?!${yn})`,f9=`(?!${RO}${ry})`,d9=`(?!${yn}{0,1}${ty})`,p9=`(?!${ry})`,h9=`[^.${mf}]`,m9=`${TO}*?`,BO={DOT_LITERAL:yn,PLUS_LITERAL:s9,QMARK_LITERAL:u9,SLASH_LITERAL:mf,ONE_CHAR:c9,QMARK:TO,END_ANCHOR:ty,DOTS_SLASH:ry,NO_DOT:l9,NO_DOTS:f9,NO_DOT_SLASH:d9,NO_DOTS_SLASH:p9,QMARK_NO_DOT:h9,STAR:m9,START_ANCHOR:RO},g9={...BO,SLASH_LITERAL:`[${zr}]`,QMARK:IO,STAR:`${IO}*?`,DOTS_SLASH:`${yn}{1,2}(?:[${zr}]|$)`,NO_DOT:`(?!${yn})`,NO_DOTS:`(?!(?:^|[${zr}])${yn}{1,2}(?:[${zr}]|$))`,NO_DOT_SLASH:`(?!${yn}{0,1}(?:[${zr}]|$))`,NO_DOTS_SLASH:`(?!${yn}{1,2}(?:[${zr}]|$))`,QMARK_NO_DOT:`[^.${zr}]`,START_ANCHOR:`(?:^|[${zr}])`,END_ANCHOR:`(?:[${zr}]|$)`},y9={alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};NO.exports={MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:y9,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,SEP:a9.sep,extglobChars(t){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${t.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(t){return t===!0?g9:BO}}});var zs=S(Ht=>{"use strict";var D9=require("path"),b9=process.platform==="win32",{REGEX_BACKSLASH:w9,REGEX_REMOVE_BACKSLASH:v9,REGEX_SPECIAL_CHARS:C9,REGEX_SPECIAL_CHARS_GLOBAL:E9}=Vs();Ht.isObject=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);Ht.hasRegexChars=t=>C9.test(t);Ht.isRegexChar=t=>t.length===1&&Ht.hasRegexChars(t);Ht.escapeRegex=t=>t.replace(E9,"\\$1");Ht.toPosixSlashes=t=>t.replace(w9,"/");Ht.removeBackslashes=t=>t.replace(v9,e=>e==="\\"?"":e);Ht.supportsLookbehinds=()=>{let t=process.version.slice(1).split(".").map(Number);return t.length===3&&t[0]>=9||t[0]===8&&t[1]>=10};Ht.isWindows=t=>t&&typeof t.windows=="boolean"?t.windows:b9===!0||D9.sep==="\\";Ht.escapeLast=(t,e,r)=>{let n=t.lastIndexOf(e,r);return n===-1?t:t[n-1]==="\\"?Ht.escapeLast(t,e,n-1):`${t.slice(0,n)}\\${t.slice(n)}`};Ht.removePrefix=(t,e={})=>{let r=t;return r.startsWith("./")&&(r=r.slice(2),e.prefix="./"),r};Ht.wrapOutput=(t,e={},r={})=>{let n=r.contains?"":"^",o=r.contains?"":"$",i=`${n}(?:${t})${o}`;return e.negated===!0&&(i=`(?:^(?!${i}).*$)`),i}});var zO=S((sX,VO)=>{"use strict";var LO=zs(),{CHAR_ASTERISK:ny,CHAR_AT:_9,CHAR_BACKWARD_SLASH:Ks,CHAR_COMMA:S9,CHAR_DOT:oy,CHAR_EXCLAMATION_MARK:iy,CHAR_FORWARD_SLASH:HO,CHAR_LEFT_CURLY_BRACE:ay,CHAR_LEFT_PARENTHESES:sy,CHAR_LEFT_SQUARE_BRACKET:x9,CHAR_PLUS:A9,CHAR_QUESTION_MARK:jO,CHAR_RIGHT_CURLY_BRACE:O9,CHAR_RIGHT_PARENTHESES:UO,CHAR_RIGHT_SQUARE_BRACKET:F9}=Vs(),MO=t=>t===HO||t===Ks,qO=t=>{t.isPrefix!==!0&&(t.depth=t.isGlobstar?1/0:1)},k9=(t,e)=>{let r=e||{},n=t.length-1,o=r.parts===!0||r.scanToEnd===!0,i=[],a=[],s=[],u=t,c=-1,l=0,d=0,p=!1,h=!1,m=!1,b=!1,y=!1,C=!1,E=!1,g=!1,_=!1,x=!1,$=0,F,B,T={value:"",depth:0,isGlob:!1},L=()=>c>=n,A=()=>u.charCodeAt(c+1),j=()=>(F=B,u.charCodeAt(++c));for(;c<n;){B=j();let w;if(B===Ks){E=T.backslashes=!0,B=j(),B===ay&&(C=!0);continue}if(C===!0||B===ay){for($++;L()!==!0&&(B=j());){if(B===Ks){E=T.backslashes=!0,j();continue}if(B===ay){$++;continue}if(C!==!0&&B===oy&&(B=j())===oy){if(p=T.isBrace=!0,m=T.isGlob=!0,x=!0,o===!0)continue;break}if(C!==!0&&B===S9){if(p=T.isBrace=!0,m=T.isGlob=!0,x=!0,o===!0)continue;break}if(B===O9&&($--,$===0)){C=!1,p=T.isBrace=!0,x=!0;break}}if(o===!0)continue;break}if(B===HO){if(i.push(c),a.push(T),T={value:"",depth:0,isGlob:!1},x===!0)continue;if(F===oy&&c===l+1){l+=2;continue}d=c+1;continue}if(r.noext!==!0&&(B===A9||B===_9||B===ny||B===jO||B===iy)===!0&&A()===sy){if(m=T.isGlob=!0,b=T.isExtglob=!0,x=!0,B===iy&&c===l&&(_=!0),o===!0){for(;L()!==!0&&(B=j());){if(B===Ks){E=T.backslashes=!0,B=j();continue}if(B===UO){m=T.isGlob=!0,x=!0;break}}continue}break}if(B===ny){if(F===ny&&(y=T.isGlobstar=!0),m=T.isGlob=!0,x=!0,o===!0)continue;break}if(B===jO){if(m=T.isGlob=!0,x=!0,o===!0)continue;break}if(B===x9){for(;L()!==!0&&(w=j());){if(w===Ks){E=T.backslashes=!0,j();continue}if(w===F9){h=T.isBracket=!0,m=T.isGlob=!0,x=!0;break}}if(o===!0)continue;break}if(r.nonegate!==!0&&B===iy&&c===l){g=T.negated=!0,l++;continue}if(r.noparen!==!0&&B===sy){if(m=T.isGlob=!0,o===!0){for(;L()!==!0&&(B=j());){if(B===sy){E=T.backslashes=!0,B=j();continue}if(B===UO){x=!0;break}}continue}break}if(m===!0){if(x=!0,o===!0)continue;break}}r.noext===!0&&(b=!1,m=!1);let M=u,J="",k="";l>0&&(J=u.slice(0,l),u=u.slice(l),d-=l),M&&m===!0&&d>0?(M=u.slice(0,d),k=u.slice(d)):m===!0?(M="",k=u):M=u,M&&M!==""&&M!=="/"&&M!==u&&MO(M.charCodeAt(M.length-1))&&(M=M.slice(0,-1)),r.unescape===!0&&(k&&(k=LO.removeBackslashes(k)),M&&E===!0&&(M=LO.removeBackslashes(M)));let D={prefix:J,input:t,start:l,base:M,glob:k,isBrace:p,isBracket:h,isGlob:m,isExtglob:b,isGlobstar:y,negated:g,negatedExtglob:_};if(r.tokens===!0&&(D.maxDepth=0,MO(B)||a.push(T),D.tokens=a),r.parts===!0||r.tokens===!0){let w;for(let v=0;v<i.length;v++){let O=w?w+1:l,R=i[v],I=t.slice(O,R);r.tokens&&(v===0&&l!==0?(a[v].isPrefix=!0,a[v].value=J):a[v].value=I,qO(a[v]),D.maxDepth+=a[v].depth),(v!==0||I!=="")&&s.push(I),w=R}if(w&&w+1<t.length){let v=t.slice(w+1);s.push(v),r.tokens&&(a[a.length-1].value=v,qO(a[a.length-1]),D.maxDepth+=a[a.length-1].depth)}D.slashes=i,D.parts=s}return D};VO.exports=k9});var WO=S((uX,GO)=>{"use strict";var gf=Vs(),Qt=zs(),{MAX_LENGTH:yf,POSIX_REGEX_SOURCE:P9,REGEX_NON_SPECIAL_CHARS:$9,REGEX_SPECIAL_CHARS_BACKREF:I9,REPLACEMENTS:KO}=gf,T9=(t,e)=>{if(typeof e.expandRange=="function")return e.expandRange(...t,e);t.sort();let r=`[${t.join("-")}]`;try{new RegExp(r)}catch{return t.map(o=>Qt.escapeRegex(o)).join("..")}return r},ma=(t,e)=>`Missing ${t}: "${e}" - use "\\\\${e}" to match literal characters`,uy=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");t=KO[t]||t;let r={...e},n=typeof r.maxLength=="number"?Math.min(yf,r.maxLength):yf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);let i={type:"bos",value:"",output:r.prepend||""},a=[i],s=r.capture?"":"?:",u=Qt.isWindows(e),c=gf.globChars(u),l=gf.extglobChars(c),{DOT_LITERAL:d,PLUS_LITERAL:p,SLASH_LITERAL:h,ONE_CHAR:m,DOTS_SLASH:b,NO_DOT:y,NO_DOT_SLASH:C,NO_DOTS_SLASH:E,QMARK:g,QMARK_NO_DOT:_,STAR:x,START_ANCHOR:$}=c,F=G=>`(${s}(?:(?!${$}${G.dot?b:d}).)*?)`,B=r.dot?"":y,T=r.dot?g:_,L=r.bash===!0?F(r):x;r.capture&&(L=`(${L})`),typeof r.noext=="boolean"&&(r.noextglob=r.noext);let A={input:t,index:-1,start:0,dot:r.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:a};t=Qt.removePrefix(t,A),o=t.length;let j=[],M=[],J=[],k=i,D,w=()=>A.index===o-1,v=A.peek=(G=1)=>t[A.index+G],O=A.advance=()=>t[++A.index]||"",R=()=>t.slice(A.index+1),I=(G="",Se=0)=>{A.consumed+=G,A.index+=Se},q=G=>{A.output+=G.output!=null?G.output:G.value,I(G.value)},P=()=>{let G=1;for(;v()==="!"&&(v(2)!=="("||v(3)==="?");)O(),A.start++,G++;return G%2===0?!1:(A.negated=!0,A.start++,!0)},N=G=>{A[G]++,J.push(G)},z=G=>{A[G]--,J.pop()},H=G=>{if(k.type==="globstar"){let Se=A.braces>0&&(G.type==="comma"||G.type==="brace"),V=G.extglob===!0||j.length&&(G.type==="pipe"||G.type==="paren");G.type!=="slash"&&G.type!=="paren"&&!Se&&!V&&(A.output=A.output.slice(0,-k.output.length),k.type="star",k.value="*",k.output=L,A.output+=k.output)}if(j.length&&G.type!=="paren"&&(j[j.length-1].inner+=G.value),(G.value||G.output)&&q(G),k&&k.type==="text"&&G.type==="text"){k.value+=G.value,k.output=(k.output||"")+G.value;return}G.prev=k,a.push(G),k=G},se=(G,Se)=>{let V={...l[Se],conditions:1,inner:""};V.prev=k,V.parens=A.parens,V.output=A.output;let ce=(r.capture?"(":"")+V.open;N("parens"),H({type:G,value:Se,output:A.output?"":m}),H({type:"paren",extglob:!0,value:O(),output:ce}),j.push(V)},zt=G=>{let Se=G.close+(r.capture?")":""),V;if(G.type==="negate"){let ce=L;if(G.inner&&G.inner.length>1&&G.inner.includes("/")&&(ce=F(r)),(ce!==L||w()||/^\)+$/.test(R()))&&(Se=G.close=`)$))${ce}`),G.inner.includes("*")&&(V=R())&&/^\.[^\\/.]+$/.test(V)){let qe=uy(V,{...e,fastpaths:!1}).output;Se=G.close=`)${qe})${ce})`}G.prev.type==="bos"&&(A.negatedExtglob=!0)}H({type:"paren",extglob:!0,value:D,output:Se}),z("parens")};if(r.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(t)){let G=!1,Se=t.replace(I9,(V,ce,qe,Et,rt,Af)=>Et==="\\"?(G=!0,V):Et==="?"?ce?ce+Et+(rt?g.repeat(rt.length):""):Af===0?T+(rt?g.repeat(rt.length):""):g.repeat(qe.length):Et==="."?d.repeat(qe.length):Et==="*"?ce?ce+Et+(rt?L:""):L:ce?V:`\\${V}`);return G===!0&&(r.unescape===!0?Se=Se.replace(/\\/g,""):Se=Se.replace(/\\+/g,V=>V.length%2===0?"\\\\":V?"\\":"")),Se===t&&r.contains===!0?(A.output=t,A):(A.output=Qt.wrapOutput(Se,A,e),A)}for(;!w();){if(D=O(),D==="\0")continue;if(D==="\\"){let V=v();if(V==="/"&&r.bash!==!0||V==="."||V===";")continue;if(!V){D+="\\",H({type:"text",value:D});continue}let ce=/^\\+/.exec(R()),qe=0;if(ce&&ce[0].length>2&&(qe=ce[0].length,A.index+=qe,qe%2!==0&&(D+="\\")),r.unescape===!0?D=O():D+=O(),A.brackets===0){H({type:"text",value:D});continue}}if(A.brackets>0&&(D!=="]"||k.value==="["||k.value==="[^")){if(r.posix!==!1&&D===":"){let V=k.value.slice(1);if(V.includes("[")&&(k.posix=!0,V.includes(":"))){let ce=k.value.lastIndexOf("["),qe=k.value.slice(0,ce),Et=k.value.slice(ce+2),rt=P9[Et];if(rt){k.value=qe+rt,A.backtrack=!0,O(),!i.output&&a.indexOf(k)===1&&(i.output=m);continue}}}(D==="["&&v()!==":"||D==="-"&&v()==="]")&&(D=`\\${D}`),D==="]"&&(k.value==="["||k.value==="[^")&&(D=`\\${D}`),r.posix===!0&&D==="!"&&k.value==="["&&(D="^"),k.value+=D,q({value:D});continue}if(A.quotes===1&&D!=='"'){D=Qt.escapeRegex(D),k.value+=D,q({value:D});continue}if(D==='"'){A.quotes=A.quotes===1?0:1,r.keepQuotes===!0&&H({type:"text",value:D});continue}if(D==="("){N("parens"),H({type:"paren",value:D});continue}if(D===")"){if(A.parens===0&&r.strictBrackets===!0)throw new SyntaxError(ma("opening","("));let V=j[j.length-1];if(V&&A.parens===V.parens+1){zt(j.pop());continue}H({type:"paren",value:D,output:A.parens?")":"\\)"}),z("parens");continue}if(D==="["){if(r.nobracket===!0||!R().includes("]")){if(r.nobracket!==!0&&r.strictBrackets===!0)throw new SyntaxError(ma("closing","]"));D=`\\${D}`}else N("brackets");H({type:"bracket",value:D});continue}if(D==="]"){if(r.nobracket===!0||k&&k.type==="bracket"&&k.value.length===1){H({type:"text",value:D,output:`\\${D}`});continue}if(A.brackets===0){if(r.strictBrackets===!0)throw new SyntaxError(ma("opening","["));H({type:"text",value:D,output:`\\${D}`});continue}z("brackets");let V=k.value.slice(1);if(k.posix!==!0&&V[0]==="^"&&!V.includes("/")&&(D=`/${D}`),k.value+=D,q({value:D}),r.literalBrackets===!1||Qt.hasRegexChars(V))continue;let ce=Qt.escapeRegex(k.value);if(A.output=A.output.slice(0,-k.value.length),r.literalBrackets===!0){A.output+=ce,k.value=ce;continue}k.value=`(${s}${ce}|${k.value})`,A.output+=k.value;continue}if(D==="{"&&r.nobrace!==!0){N("braces");let V={type:"brace",value:D,output:"(",outputIndex:A.output.length,tokensIndex:A.tokens.length};M.push(V),H(V);continue}if(D==="}"){let V=M[M.length-1];if(r.nobrace===!0||!V){H({type:"text",value:D,output:D});continue}let ce=")";if(V.dots===!0){let qe=a.slice(),Et=[];for(let rt=qe.length-1;rt>=0&&(a.pop(),qe[rt].type!=="brace");rt--)qe[rt].type!=="dots"&&Et.unshift(qe[rt].value);ce=T9(Et,r),A.backtrack=!0}if(V.comma!==!0&&V.dots!==!0){let qe=A.output.slice(0,V.outputIndex),Et=A.tokens.slice(V.tokensIndex);V.value=V.output="\\{",D=ce="\\}",A.output=qe;for(let rt of Et)A.output+=rt.output||rt.value}H({type:"brace",value:D,output:ce}),z("braces"),M.pop();continue}if(D==="|"){j.length>0&&j[j.length-1].conditions++,H({type:"text",value:D});continue}if(D===","){let V=D,ce=M[M.length-1];ce&&J[J.length-1]==="braces"&&(ce.comma=!0,V="|"),H({type:"comma",value:D,output:V});continue}if(D==="/"){if(k.type==="dot"&&A.index===A.start+1){A.start=A.index+1,A.consumed="",A.output="",a.pop(),k=i;continue}H({type:"slash",value:D,output:h});continue}if(D==="."){if(A.braces>0&&k.type==="dot"){k.value==="."&&(k.output=d);let V=M[M.length-1];k.type="dots",k.output+=D,k.value+=D,V.dots=!0;continue}if(A.braces+A.parens===0&&k.type!=="bos"&&k.type!=="slash"){H({type:"text",value:D,output:d});continue}H({type:"dot",value:D,output:d});continue}if(D==="?"){if(!(k&&k.value==="(")&&r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("qmark",D);continue}if(k&&k.type==="paren"){let ce=v(),qe=D;if(ce==="<"&&!Qt.supportsLookbehinds())throw new Error("Node.js v10 or higher is required for regex lookbehinds");(k.value==="("&&!/[!=<:]/.test(ce)||ce==="<"&&!/<([!=]|\w+>)/.test(R()))&&(qe=`\\${D}`),H({type:"text",value:D,output:qe});continue}if(r.dot!==!0&&(k.type==="slash"||k.type==="bos")){H({type:"qmark",value:D,output:_});continue}H({type:"qmark",value:D,output:g});continue}if(D==="!"){if(r.noextglob!==!0&&v()==="("&&(v(2)!=="?"||!/[!=<:]/.test(v(3)))){se("negate",D);continue}if(r.nonegate!==!0&&A.index===0){P();continue}}if(D==="+"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){se("plus",D);continue}if(k&&k.value==="("||r.regex===!1){H({type:"plus",value:D,output:p});continue}if(k&&(k.type==="bracket"||k.type==="paren"||k.type==="brace")||A.parens>0){H({type:"plus",value:D});continue}H({type:"plus",value:p});continue}if(D==="@"){if(r.noextglob!==!0&&v()==="("&&v(2)!=="?"){H({type:"at",extglob:!0,value:D,output:""});continue}H({type:"text",value:D});continue}if(D!=="*"){(D==="$"||D==="^")&&(D=`\\${D}`);let V=$9.exec(R());V&&(D+=V[0],A.index+=V[0].length),H({type:"text",value:D});continue}if(k&&(k.type==="globstar"||k.star===!0)){k.type="star",k.star=!0,k.value+=D,k.output=L,A.backtrack=!0,A.globstar=!0,I(D);continue}let G=R();if(r.noextglob!==!0&&/^\([^?]/.test(G)){se("star",D);continue}if(k.type==="star"){if(r.noglobstar===!0){I(D);continue}let V=k.prev,ce=V.prev,qe=V.type==="slash"||V.type==="bos",Et=ce&&(ce.type==="star"||ce.type==="globstar");if(r.bash===!0&&(!qe||G[0]&&G[0]!=="/")){H({type:"star",value:D,output:""});continue}let rt=A.braces>0&&(V.type==="comma"||V.type==="brace"),Af=j.length&&(V.type==="pipe"||V.type==="paren");if(!qe&&V.type!=="paren"&&!rt&&!Af){H({type:"star",value:D,output:""});continue}for(;G.slice(0,3)==="/**";){let Xs=t[A.index+4];if(Xs&&Xs!=="/")break;G=G.slice(3),I("/**",3)}if(V.type==="bos"&&w()){k.type="globstar",k.value+=D,k.output=F(r),A.output=k.output,A.globstar=!0,I(D);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&!Et&&w()){A.output=A.output.slice(0,-(V.output+k.output).length),V.output=`(?:${V.output}`,k.type="globstar",k.output=F(r)+(r.strictSlashes?")":"|$)"),k.value+=D,A.globstar=!0,A.output+=V.output+k.output,I(D);continue}if(V.type==="slash"&&V.prev.type!=="bos"&&G[0]==="/"){let Xs=G[1]!==void 0?"|$":"";A.output=A.output.slice(0,-(V.output+k.output).length),V.output=`(?:${V.output}`,k.type="globstar",k.output=`${F(r)}${h}|${h}${Xs})`,k.value+=D,A.output+=V.output+k.output,A.globstar=!0,I(D+O()),H({type:"slash",value:"/",output:""});continue}if(V.type==="bos"&&G[0]==="/"){k.type="globstar",k.value+=D,k.output=`(?:^|${h}|${F(r)}${h})`,A.output=k.output,A.globstar=!0,I(D+O()),H({type:"slash",value:"/",output:""});continue}A.output=A.output.slice(0,-k.output.length),k.type="globstar",k.output=F(r),k.value+=D,A.output+=k.output,A.globstar=!0,I(D);continue}let Se={type:"star",value:D,output:L};if(r.bash===!0){Se.output=".*?",(k.type==="bos"||k.type==="slash")&&(Se.output=B+Se.output),H(Se);continue}if(k&&(k.type==="bracket"||k.type==="paren")&&r.regex===!0){Se.output=D,H(Se);continue}(A.index===A.start||k.type==="slash"||k.type==="dot")&&(k.type==="dot"?(A.output+=C,k.output+=C):r.dot===!0?(A.output+=E,k.output+=E):(A.output+=B,k.output+=B),v()!=="*"&&(A.output+=m,k.output+=m)),H(Se)}for(;A.brackets>0;){if(r.strictBrackets===!0)throw new SyntaxError(ma("closing","]"));A.output=Qt.escapeLast(A.output,"["),z("brackets")}for(;A.parens>0;){if(r.strictBrackets===!0)throw new SyntaxError(ma("closing",")"));A.output=Qt.escapeLast(A.output,"("),z("parens")}for(;A.braces>0;){if(r.strictBrackets===!0)throw new SyntaxError(ma("closing","}"));A.output=Qt.escapeLast(A.output,"{"),z("braces")}if(r.strictSlashes!==!0&&(k.type==="star"||k.type==="bracket")&&H({type:"maybe_slash",value:"",output:`${h}?`}),A.backtrack===!0){A.output="";for(let G of A.tokens)A.output+=G.output!=null?G.output:G.value,G.suffix&&(A.output+=G.suffix)}return A};uy.fastpaths=(t,e)=>{let r={...e},n=typeof r.maxLength=="number"?Math.min(yf,r.maxLength):yf,o=t.length;if(o>n)throw new SyntaxError(`Input length: ${o}, exceeds maximum allowed length: ${n}`);t=KO[t]||t;let i=Qt.isWindows(e),{DOT_LITERAL:a,SLASH_LITERAL:s,ONE_CHAR:u,DOTS_SLASH:c,NO_DOT:l,NO_DOTS:d,NO_DOTS_SLASH:p,STAR:h,START_ANCHOR:m}=gf.globChars(i),b=r.dot?d:l,y=r.dot?p:l,C=r.capture?"":"?:",E={negated:!1,prefix:""},g=r.bash===!0?".*?":h;r.capture&&(g=`(${g})`);let _=B=>B.noglobstar===!0?g:`(${C}(?:(?!${m}${B.dot?c:a}).)*?)`,x=B=>{switch(B){case"*":return`${b}${u}${g}`;case".*":return`${a}${u}${g}`;case"*.*":return`${b}${g}${a}${u}${g}`;case"*/*":return`${b}${g}${s}${u}${y}${g}`;case"**":return b+_(r);case"**/*":return`(?:${b}${_(r)}${s})?${y}${u}${g}`;case"**/*.*":return`(?:${b}${_(r)}${s})?${y}${g}${a}${u}${g}`;case"**/.*":return`(?:${b}${_(r)}${s})?${a}${u}${g}`;default:{let T=/^(.*?)\.(\w+)$/.exec(B);if(!T)return;let L=x(T[1]);return L?L+a+T[2]:void 0}}},$=Qt.removePrefix(t,E),F=x($);return F&&r.strictSlashes!==!0&&(F+=`${s}?`),F};GO.exports=uy});var JO=S((cX,YO)=>{"use strict";var R9=require("path"),B9=zO(),cy=WO(),ly=zs(),N9=Vs(),L9=t=>t&&typeof t=="object"&&!Array.isArray(t),et=(t,e,r=!1)=>{if(Array.isArray(t)){let l=t.map(p=>et(p,e,r));return p=>{for(let h of l){let m=h(p);if(m)return m}return!1}}let n=L9(t)&&t.tokens&&t.input;if(t===""||typeof t!="string"&&!n)throw new TypeError("Expected pattern to be a non-empty string");let o=e||{},i=ly.isWindows(e),a=n?et.compileRe(t,e):et.makeRe(t,e,!1,!0),s=a.state;delete a.state;let u=()=>!1;if(o.ignore){let l={...e,ignore:null,onMatch:null,onResult:null};u=et(o.ignore,l,r)}let c=(l,d=!1)=>{let{isMatch:p,match:h,output:m}=et.test(l,a,e,{glob:t,posix:i}),b={glob:t,state:s,regex:a,posix:i,input:l,output:m,match:h,isMatch:p};return typeof o.onResult=="function"&&o.onResult(b),p===!1?(b.isMatch=!1,d?b:!1):u(l)?(typeof o.onIgnore=="function"&&o.onIgnore(b),b.isMatch=!1,d?b:!1):(typeof o.onMatch=="function"&&o.onMatch(b),d?b:!0)};return r&&(c.state=s),c};et.test=(t,e,r,{glob:n,posix:o}={})=>{if(typeof t!="string")throw new TypeError("Expected input to be a string");if(t==="")return{isMatch:!1,output:""};let i=r||{},a=i.format||(o?ly.toPosixSlashes:null),s=t===n,u=s&&a?a(t):t;return s===!1&&(u=a?a(t):t,s=u===n),(s===!1||i.capture===!0)&&(i.matchBase===!0||i.basename===!0?s=et.matchBase(t,e,r,o):s=e.exec(u)),{isMatch:!!s,match:s,output:u}};et.matchBase=(t,e,r,n=ly.isWindows(r))=>(e instanceof RegExp?e:et.makeRe(e,r)).test(R9.basename(t));et.isMatch=(t,e,r)=>et(e,r)(t);et.parse=(t,e)=>Array.isArray(t)?t.map(r=>et.parse(r,e)):cy(t,{...e,fastpaths:!1});et.scan=(t,e)=>B9(t,e);et.compileRe=(t,e,r=!1,n=!1)=>{if(r===!0)return t.output;let o=e||{},i=o.contains?"":"^",a=o.contains?"":"$",s=`${i}(?:${t.output})${a}`;t&&t.negated===!0&&(s=`^(?!${s}).*$`);let u=et.toRegex(s,e);return n===!0&&(u.state=t),u};et.makeRe=(t,e={},r=!1,n=!1)=>{if(!t||typeof t!="string")throw new TypeError("Expected a non-empty string");let o={negated:!1,fastpaths:!0};return e.fastpaths!==!1&&(t[0]==="."||t[0]==="*")&&(o.output=cy.fastpaths(t,e)),o.output||(o=cy(t,e)),et.compileRe(o,e,r,n)};et.toRegex=(t,e)=>{try{let r=e||{};return new RegExp(t,r.flags||(r.nocase?"i":""))}catch(r){if(e&&e.debug===!0)throw r;return/$^/}};et.constants=N9;YO.exports=et});var ZO=S((lX,XO)=>{"use strict";XO.exports=JO()});var oF=S((fX,nF)=>{"use strict";var eF=require("util"),tF=$O(),Kr=ZO(),fy=zs(),QO=t=>t===""||t==="./",rF=t=>{let e=t.indexOf("{");return e>-1&&t.indexOf("}",e)>-1},Le=(t,e,r)=>{e=[].concat(e),t=[].concat(t);let n=new Set,o=new Set,i=new Set,a=0,s=l=>{i.add(l.output),r&&r.onResult&&r.onResult(l)};for(let l=0;l<e.length;l++){let d=Kr(String(e[l]),{...r,onResult:s},!0),p=d.state.negated||d.state.negatedExtglob;p&&a++;for(let h of t){let m=d(h,!0);(p?!m.isMatch:m.isMatch)&&(p?n.add(m.output):(n.delete(m.output),o.add(m.output)))}}let c=(a===e.length?[...i]:[...o]).filter(l=>!n.has(l));if(r&&c.length===0){if(r.failglob===!0)throw new Error(`No matches found for "${e.join(", ")}"`);if(r.nonull===!0||r.nullglob===!0)return r.unescape?e.map(l=>l.replace(/\\/g,"")):e}return c};Le.match=Le;Le.matcher=(t,e)=>Kr(t,e);Le.isMatch=(t,e,r)=>Kr(e,r)(t);Le.any=Le.isMatch;Le.not=(t,e,r={})=>{e=[].concat(e).map(String);let n=new Set,o=[],i=s=>{r.onResult&&r.onResult(s),o.push(s.output)},a=new Set(Le(t,e,{...r,onResult:i}));for(let s of o)a.has(s)||n.add(s);return[...n]};Le.contains=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${eF.inspect(t)}"`);if(Array.isArray(e))return e.some(n=>Le.contains(t,n,r));if(typeof e=="string"){if(QO(t)||QO(e))return!1;if(t.includes(e)||t.startsWith("./")&&t.slice(2).includes(e))return!0}return Le.isMatch(t,e,{...r,contains:!0})};Le.matchKeys=(t,e,r)=>{if(!fy.isObject(t))throw new TypeError("Expected the first argument to be an object");let n=Le(Object.keys(t),e,r),o={};for(let i of n)o[i]=t[i];return o};Le.some=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Kr(String(o),r);if(n.some(a=>i(a)))return!0}return!1};Le.every=(t,e,r)=>{let n=[].concat(t);for(let o of[].concat(e)){let i=Kr(String(o),r);if(!n.every(a=>i(a)))return!1}return!0};Le.all=(t,e,r)=>{if(typeof t!="string")throw new TypeError(`Expected a string: "${eF.inspect(t)}"`);return[].concat(e).every(n=>Kr(n,r)(t))};Le.capture=(t,e,r)=>{let n=fy.isWindows(r),i=Kr.makeRe(String(t),{...r,capture:!0}).exec(n?fy.toPosixSlashes(e):e);if(i)return i.slice(1).map(a=>a===void 0?"":a)};Le.makeRe=(...t)=>Kr.makeRe(...t);Le.scan=(...t)=>Kr.scan(...t);Le.parse=(t,e)=>{let r=[];for(let n of[].concat(t||[]))for(let o of tF(String(n),e))r.push(Kr.parse(o,e));return r};Le.braces=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return e&&e.nobrace===!0||!rF(t)?[t]:tF(t,e)};Le.braceExpand=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a string");return Le.braces(t,{...e,expand:!0})};Le.hasBraces=rF;nF.exports=Le});var qF=S((cZ,Dn)=>{var $e=require("fs"),Cf=require("os"),yt=require("path"),SF=require("crypto"),Wr={fs:$e.constants,os:Cf.constants},xF="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",kF=/XXXXXX/,f7=3,PF=(Wr.O_CREAT||Wr.fs.O_CREAT)|(Wr.O_EXCL||Wr.fs.O_EXCL)|(Wr.O_RDWR||Wr.fs.O_RDWR),d7=Cf.platform()==="win32",p7=Wr.EBADF||Wr.os.errno.EBADF,h7=Wr.ENOENT||Wr.os.errno.ENOENT,$F=448,IF=384,m7="exit",ya=[],TF=$e.rmdirSync.bind($e),RF=!1;function g7(t,e){return $e.rm(t,{recursive:!0},e)}function BF(t){return $e.rmSync(t,{recursive:!0})}function yy(t,e){let r=Da(t,e),n=r[0],o=r[1];x7(n,function(i,a){if(i)return o(i);let s=a.tries;(function u(){try{let c=LF(a);$e.stat(c,function(l){if(!l)return s-- >0?u():o(new Error("Could not get a unique tmp filename, max tries reached "+c));o(null,c)})}catch(c){o(c)}})()})}function Dy(t){let e=Da(t),r=e[0],n=A7(r),o=n.tries;do{let i=LF(n);try{$e.statSync(i)}catch{return i}}while(o-- >0);throw new Error("Could not get a unique tmp filename, max tries reached")}function y7(t,e){let r=Da(t,e),n=r[0],o=r[1];yy(n,function(a,s){if(a)return o(a);$e.open(s,PF,n.mode||IF,function(c,l){if(c)return o(c);if(n.discardDescriptor)return $e.close(l,function(p){return o(p,s,void 0,my(s,-1,n,!1))});{let d=n.discardDescriptor||n.detachDescriptor;o(null,s,l,my(s,d?-1:l,n,!1))}})})}function D7(t){let e=Da(t),r=e[0],n=r.discardDescriptor||r.detachDescriptor,o=Dy(r),i=$e.openSync(o,PF,r.mode||IF);return r.discardDescriptor&&($e.closeSync(i),i=void 0),{name:o,fd:i,removeCallback:my(o,n?-1:i,r,!0)}}function b7(t,e){let r=Da(t,e),n=r[0],o=r[1];yy(n,function(a,s){if(a)return o(a);$e.mkdir(s,n.mode||$F,function(c){if(c)return o(c);o(null,s,NF(s,n,!1))})})}function w7(t){let e=Da(t),r=e[0],n=Dy(r);return $e.mkdirSync(n,r.mode||$F),{name:n,removeCallback:NF(n,r,!0)}}function v7(t,e){let r=function(n){if(n&&!gy(n))return e(n);e()};0<=t[0]?$e.close(t[0],function(){$e.unlink(t[1],r)}):$e.unlink(t[1],r)}function C7(t){let e=null;try{0<=t[0]&&$e.closeSync(t[0])}catch(r){if(!O7(r)&&!gy(r))throw r}finally{try{$e.unlinkSync(t[1])}catch(r){gy(r)||(e=r)}}if(e!==null)throw e}function my(t,e,r,n){let o=vf(C7,[e,t],n),i=vf(v7,[e,t],n,o);return r.keep||ya.unshift(o),n?o:i}function NF(t,e,r){let n=e.unsafeCleanup?g7:$e.rmdir.bind($e),o=e.unsafeCleanup?BF:TF,i=vf(o,t,r),a=vf(n,t,r,i);return e.keep||ya.unshift(i),r?i:a}function vf(t,e,r,n){let o=!1;return function i(a){if(!o){let s=n||i,u=ya.indexOf(s);return u>=0&&ya.splice(u,1),o=!0,r||t===TF||t===BF?t(e):t(e,a||function(){})}}}function E7(){if(RF)for(;ya.length;)try{ya[0]()}catch{}}function AF(t){let e=[],r=null;try{r=SF.randomBytes(t)}catch{r=SF.pseudoRandomBytes(t)}for(let n=0;n<t;n++)e.push(xF[r[n]%xF.length]);return e.join("")}function er(t){return typeof t>"u"}function Da(t,e){if(typeof t=="function")return[{},t];if(er(t))return[{},e];let r={};for(let n of Object.getOwnPropertyNames(t))r[n]=t[n];return[r,e]}function _7(t,e,r){let n=yt.isAbsolute(t)?t:yt.join(e,t);$e.stat(n,function(o){o?$e.realpath(yt.dirname(n),function(i,a){if(i)return r(i);r(null,yt.join(a,yt.basename(n)))}):$e.realpath(n,r)})}function S7(t,e){let r=yt.isAbsolute(t)?t:yt.join(e,t);try{return $e.statSync(r),$e.realpathSync(r)}catch{let o=$e.realpathSync(yt.dirname(r));return yt.join(o,yt.basename(r))}}function LF(t){let e=t.tmpdir;if(!er(t.name))return yt.join(e,t.dir,t.name);if(!er(t.template))return yt.join(e,t.dir,t.template).replace(kF,AF(6));let r=[t.prefix?t.prefix:"tmp","-",process.pid,"-",AF(12),t.postfix?"-"+t.postfix:""].join("");return yt.join(e,t.dir,r)}function jF(t){if(!er(t.name)){let e=t.name;if(yt.isAbsolute(e))throw new Error(`name option must not contain an absolute path, found "${e}".`);let r=yt.basename(e);if(r===".."||r==="."||r!==e)throw new Error(`name option must not contain a path, found "${e}".`)}if(!er(t.template)&&!t.template.match(kF))throw new Error(`Invalid template, found "${t.template}".`);if(!er(t.tries)&&isNaN(t.tries)||t.tries<0)throw new Error(`Invalid tries, found "${t.tries}".`);t.tries=er(t.name)?t.tries||f7:1,t.keep=!!t.keep,t.detachDescriptor=!!t.detachDescriptor,t.discardDescriptor=!!t.discardDescriptor,t.unsafeCleanup=!!t.unsafeCleanup,t.prefix=er(t.prefix)?"":t.prefix,t.postfix=er(t.postfix)?"":t.postfix}function OF(t,e,r,n){if(er(e))return n(null);_7(e,r,function(o,i){if(o)return n(o);let a=yt.relative(r,i);if(!i.startsWith(r))return n(new Error(`${t} option must be relative to "${r}", found "${a}".`));n(null,a)})}function FF(t,e,r){if(er(e))return;let n=S7(e,r),o=yt.relative(r,n);if(!n.startsWith(r))throw new Error(`${t} option must be relative to "${r}", found "${o}".`);return o}function x7(t,e){k7(t,function(r,n){if(r)return e(r);t.tmpdir=n;try{jF(t,n)}catch(o){return e(o)}OF("dir",t.dir,n,function(o,i){if(o)return e(o);t.dir=er(i)?"":i,OF("template",t.template,n,function(a,s){if(a)return e(a);t.template=s,e(null,t)})})})}function A7(t){let e=t.tmpdir=MF(t);jF(t,e);let r=FF("dir",t.dir,e);return t.dir=er(r)?"":r,t.template=FF("template",t.template,e),t}function O7(t){return UF(t,-p7,"EBADF")}function gy(t){return UF(t,-h7,"ENOENT")}function UF(t,e,r){return d7?t.code===r:t.code===r&&t.errno===e}function F7(){RF=!0}function k7(t,e){return $e.realpath(t&&t.tmpdir||Cf.tmpdir(),e)}function MF(t){return $e.realpathSync(t&&t.tmpdir||Cf.tmpdir())}process.addListener(m7,E7);Object.defineProperty(Dn.exports,"tmpdir",{enumerable:!0,configurable:!1,get:function(){return MF()}});Dn.exports.dir=b7;Dn.exports.dirSync=w7;Dn.exports.file=y7;Dn.exports.fileSync=D7;Dn.exports.tmpName=yy;Dn.exports.tmpNameSync=Dy;Dn.exports.setGracefulCleanup=F7});var Sf=require("node:process");var qy=ue(My(),1),{program:ot,createCommand:lq,createArgument:fq,createOption:dq,CommanderError:pq,InvalidArgumentError:hq,InvalidOptionArgumentError:mq,Command:gq,Argument:yq,Option:Dq,Help:bq}=qy.default;var yr={name:"@capgo/cli",version:"7.42.1",description:"A CLI to upload to capgo servers",author:"Martin martin@capgo.app",license:"Apache 2.0",homepage:"https://github.com/Cap-go/CLI#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","sdk"],exports:{".":{import:"./dist/index.js",require:"./dist/index.js"},"./sdk":{types:"./dist/src/sdk.d.ts",import:"./dist/src/sdk.js",require:"./dist/src/sdk.js"}},main:"dist/index.js",types:"dist/src/index.d.ts",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","dev-build":"SUPA_DB=development ncc build",pack:"pkg",types:"npx --yes supabase gen types typescript --project-id=xvwzpoazmxkqosrdewyv > src/types/supabase.types.ts",typecheck:"tsc --noEmit",lint:'eslint "src/**/*.ts" --fix',"check-posix-paths":"node test/check-posix-paths.js","generate-docs":"node dist/index.js generate-docs README.md","test:bundle":"bun test/test-bundle.mjs","test:functional":"bun test/test-functional.mjs","test:semver":"bun test/test-semver-validation.mjs","test:version-edge-cases":"bun test/test-version-validation.mjs","test:regex":"bun test/test-regex-validation.mjs","test:upload":"bun test/test-upload-validation.mjs","test:credentials":"bun test/test-credentials.mjs","test:credentials-validation":"bun test/test-credentials-validation.mjs","test:version-detection":"node test/test-get-installed-version.mjs","test:version-detection:setup":"./test/fixtures/setup-test-projects.sh",test:"bun run test:bundle && bun run test:functional && bun run test:semver && bun run test:version-edge-cases && bun run test:regex && bun run test:upload && bun run test:credentials && bun run test:credentials-validation && bun run test:version-detection"},devDependencies:{"@antfu/eslint-config":"^6.1.0","@bradenmacdonald/s3-lite-client":"npm:@jsr/bradenmacdonald__s3-lite-client@0.9.4","@capacitor/cli":"^7.4.4","@capgo/find-package-manager":"^0.0.18","@clack/prompts":"^0.11.0","@sauber/table":"npm:@jsr/sauber__table","@std/semver":"npm:@jsr/std__semver@1.0.6","@supabase/supabase-js":"^2.79.0","@types/adm-zip":"^0.5.7","@types/node":"^24.9.1","@types/prettyjson":"^0.0.33","@types/tmp":"^0.2.6","@vercel/ncc":"^0.38.4","adm-zip":"^0.5.16","ci-info":"^4.3.1",commander:"^14.0.2",esbuild:"^0.27.0",eslint:"^9.38.0","git-format-staged":"3.1.1",husky:"^9.1.7","is-wsl":"^3.1.0",open:"^11.0.0",prettyjson:"^1.2.5",tmp:"^0.2.5","tus-js-client":"^4.3.1",typescript:"^5.9.3"}};var ua=require("node:fs");var Dt=ue(Kf(),1),zo=require("node:process"),wn=ue(require("node:readline"),1),Xf=ue(require("node:readline"),1),Qy=require("node:stream"),eD=ue(Wf(),1);function x2({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 A2=x2();function tD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(A2,"")}function rD(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var nD={exports:{}};(function(t){var e={};t.exports=e,e.eastAsianWidth=function(n){var o=n.charCodeAt(0),i=n.length==2?n.charCodeAt(1):0,a=o;return 55296<=o&&o<=56319&&56320<=i&&i<=57343&&(o&=1023,i&=1023,a=o<<10|i,a+=65536),a==12288||65281<=a&&a<=65376||65504<=a&&a<=65510?"F":a==8361||65377<=a&&a<=65470||65474<=a&&a<=65479||65482<=a&&a<=65487||65490<=a&&a<=65495||65498<=a&&a<=65500||65512<=a&&a<=65518?"H":4352<=a&&a<=4447||4515<=a&&a<=4519||4602<=a&&a<=4607||9001<=a&&a<=9002||11904<=a&&a<=11929||11931<=a&&a<=12019||12032<=a&&a<=12245||12272<=a&&a<=12283||12289<=a&&a<=12350||12353<=a&&a<=12438||12441<=a&&a<=12543||12549<=a&&a<=12589||12593<=a&&a<=12686||12688<=a&&a<=12730||12736<=a&&a<=12771||12784<=a&&a<=12830||12832<=a&&a<=12871||12880<=a&&a<=13054||13056<=a&&a<=19903||19968<=a&&a<=42124||42128<=a&&a<=42182||43360<=a&&a<=43388||44032<=a&&a<=55203||55216<=a&&a<=55238||55243<=a&&a<=55291||63744<=a&&a<=64255||65040<=a&&a<=65049||65072<=a&&a<=65106||65108<=a&&a<=65126||65128<=a&&a<=65131||110592<=a&&a<=110593||127488<=a&&a<=127490||127504<=a&&a<=127546||127552<=a&&a<=127560||127568<=a&&a<=127569||131072<=a&&a<=194367||177984<=a&&a<=196605||196608<=a&&a<=262141?"W":32<=a&&a<=126||162<=a&&a<=163||165<=a&&a<=166||a==172||a==175||10214<=a&&a<=10221||10629<=a&&a<=10630?"Na":a==161||a==164||167<=a&&a<=168||a==170||173<=a&&a<=174||176<=a&&a<=180||182<=a&&a<=186||188<=a&&a<=191||a==198||a==208||215<=a&&a<=216||222<=a&&a<=225||a==230||232<=a&&a<=234||236<=a&&a<=237||a==240||242<=a&&a<=243||247<=a&&a<=250||a==252||a==254||a==257||a==273||a==275||a==283||294<=a&&a<=295||a==299||305<=a&&a<=307||a==312||319<=a&&a<=322||a==324||328<=a&&a<=331||a==333||338<=a&&a<=339||358<=a&&a<=359||a==363||a==462||a==464||a==466||a==468||a==470||a==472||a==474||a==476||a==593||a==609||a==708||a==711||713<=a&&a<=715||a==717||a==720||728<=a&&a<=731||a==733||a==735||768<=a&&a<=879||913<=a&&a<=929||931<=a&&a<=937||945<=a&&a<=961||963<=a&&a<=969||a==1025||1040<=a&&a<=1103||a==1105||a==8208||8211<=a&&a<=8214||8216<=a&&a<=8217||8220<=a&&a<=8221||8224<=a&&a<=8226||8228<=a&&a<=8231||a==8240||8242<=a&&a<=8243||a==8245||a==8251||a==8254||a==8308||a==8319||8321<=a&&a<=8324||a==8364||a==8451||a==8453||a==8457||a==8467||a==8470||8481<=a&&a<=8482||a==8486||a==8491||8531<=a&&a<=8532||8539<=a&&a<=8542||8544<=a&&a<=8555||8560<=a&&a<=8569||a==8585||8592<=a&&a<=8601||8632<=a&&a<=8633||a==8658||a==8660||a==8679||a==8704||8706<=a&&a<=8707||8711<=a&&a<=8712||a==8715||a==8719||a==8721||a==8725||a==8730||8733<=a&&a<=8736||a==8739||a==8741||8743<=a&&a<=8748||a==8750||8756<=a&&a<=8759||8764<=a&&a<=8765||a==8776||a==8780||a==8786||8800<=a&&a<=8801||8804<=a&&a<=8807||8810<=a&&a<=8811||8814<=a&&a<=8815||8834<=a&&a<=8835||8838<=a&&a<=8839||a==8853||a==8857||a==8869||a==8895||a==8978||9312<=a&&a<=9449||9451<=a&&a<=9547||9552<=a&&a<=9587||9600<=a&&a<=9615||9618<=a&&a<=9621||9632<=a&&a<=9633||9635<=a&&a<=9641||9650<=a&&a<=9651||9654<=a&&a<=9655||9660<=a&&a<=9661||9664<=a&&a<=9665||9670<=a&&a<=9672||a==9675||9678<=a&&a<=9681||9698<=a&&a<=9701||a==9711||9733<=a&&a<=9734||a==9737||9742<=a&&a<=9743||9748<=a&&a<=9749||a==9756||a==9758||a==9792||a==9794||9824<=a&&a<=9825||9827<=a&&a<=9829||9831<=a&&a<=9834||9836<=a&&a<=9837||a==9839||9886<=a&&a<=9887||9918<=a&&a<=9919||9924<=a&&a<=9933||9935<=a&&a<=9953||a==9955||9960<=a&&a<=9983||a==10045||a==10071||10102<=a&&a<=10111||11093<=a&&a<=11097||12872<=a&&a<=12879||57344<=a&&a<=63743||65024<=a&&a<=65039||a==65533||127232<=a&&a<=127242||127248<=a&&a<=127277||127280<=a&&a<=127337||127344<=a&&a<=127386||917760<=a&&a<=917999||983040<=a&&a<=1048573||1048576<=a&&a<=1114109?"A":"N"},e.characterLength=function(n){var o=this.eastAsianWidth(n);return o=="F"||o=="W"||o=="A"?2:1};function r(n){return n.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}e.length=function(n){for(var o=r(n),i=0,a=0;a<o.length;a++)i=i+this.characterLength(o[a]);return i},e.slice=function(n,o,i){textLen=e.length(n),o=o||0,i=i||1,o<0&&(o=textLen+o),i<0&&(i=textLen+i);for(var a="",s=0,u=r(n),c=0;c<u.length;c++){var l=u[c],d=e.length(l);if(s>=o-(d==2?1:0))if(s+d<=i)a+=l;else break;s+=d}return a}})(nD);var O2=nD.exports,F2=rD(O2),k2=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},P2=rD(k2);function Ca(t,e={}){if(typeof t!="string"||t.length===0||(e={ambiguousIsNarrow:!0,...e},t=tD(t),t.length===0))return 0;t=t.replace(P2()," ");let r=e.ambiguousIsNarrow?1:2,n=0;for(let o of t){let i=o.codePointAt(0);if(!(i<=31||i>=127&&i<=159||i>=768&&i<=879))switch(F2.eastAsianWidth(o)){case"F":case"W":n+=2;break;case"A":n+=r;break;default:n+=1}}return n}var Yf=10,Ky=(t=0)=>e=>`\x1B[${e+t}m`,Gy=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,Wy=(t=0)=>(e,r,n)=>`\x1B[${38+t};2;${e};${r};${n}m`,je={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(je.modifier);var $2=Object.keys(je.color),I2=Object.keys(je.bgColor);[...$2,...I2];function T2(){let t=new Map;for(let[e,r]of Object.entries(je)){for(let[n,o]of Object.entries(r))je[n]={open:`\x1B[${o[0]}m`,close:`\x1B[${o[1]}m`},r[n]=je[n],t.set(o[0],o[1]);Object.defineProperty(je,e,{value:r,enumerable:!1})}return Object.defineProperty(je,"codes",{value:t,enumerable:!1}),je.color.close="\x1B[39m",je.bgColor.close="\x1B[49m",je.color.ansi=Ky(),je.color.ansi256=Gy(),je.color.ansi16m=Wy(),je.bgColor.ansi=Ky(Yf),je.bgColor.ansi256=Gy(Yf),je.bgColor.ansi16m=Wy(Yf),Object.defineProperties(je,{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(i=>i+i).join(""));let o=Number.parseInt(n,16);return[o>>16&255,o>>8&255,o&255]},enumerable:!1},hexToAnsi256:{value:e=>je.rgbToAnsi256(...je.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let r,n,o;if(e>=232)r=((e-232)*10+8)/255,n=r,o=r;else{e-=16;let s=e%36;r=Math.floor(e/36)/5,n=Math.floor(s/6)/5,o=s%6/5}let i=Math.max(r,n,o)*2;if(i===0)return 30;let a=30+(Math.round(o)<<2|Math.round(n)<<1|Math.round(r));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,r,n)=>je.ansi256ToAnsi(je.rgbToAnsi256(e,r,n)),enumerable:!1},hexToAnsi:{value:e=>je.ansi256ToAnsi(je.hexToAnsi256(e)),enumerable:!1}}),je}var R2=T2(),cu=new Set(["\x1B","\x9B"]),B2=39,Qf="\x07",oD="[",N2="]",iD="m",ed=`${N2}8;;`,Yy=t=>`${cu.values().next().value}${oD}${t}${iD}`,Jy=t=>`${cu.values().next().value}${ed}${t}${Qf}`,L2=t=>t.split(" ").map(e=>Ca(e)),Jf=(t,e,r)=>{let n=[...e],o=!1,i=!1,a=Ca(tD(t[t.length-1]));for(let[s,u]of n.entries()){let c=Ca(u);if(a+c<=r?t[t.length-1]+=u:(t.push(u),a=0),cu.has(u)&&(o=!0,i=n.slice(s+1).join("").startsWith(ed)),o){i?u===Qf&&(o=!1,i=!1):u===iD&&(o=!1);continue}a+=c,a===r&&s<n.length-1&&(t.push(""),a=0)}!a&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},j2=t=>{let e=t.split(" "),r=e.length;for(;r>0&&!(Ca(e[r-1])>0);)r--;return r===e.length?t:e.slice(0,r).join(" ")+e.slice(r).join("")},U2=(t,e,r={})=>{if(r.trim!==!1&&t.trim()==="")return"";let n="",o,i,a=L2(t),s=[""];for(let[c,l]of t.split(" ").entries()){r.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let d=Ca(s[s.length-1]);if(c!==0&&(d>=e&&(r.wordWrap===!1||r.trim===!1)&&(s.push(""),d=0),(d>0||r.trim===!1)&&(s[s.length-1]+=" ",d++)),r.hard&&a[c]>e){let p=e-d,h=1+Math.floor((a[c]-p-1)/e);Math.floor((a[c]-1)/e)<h&&s.push(""),Jf(s,l,e);continue}if(d+a[c]>e&&d>0&&a[c]>0){if(r.wordWrap===!1&&d<e){Jf(s,l,e);continue}s.push("")}if(d+a[c]>e&&r.wordWrap===!1){Jf(s,l,e);continue}s[s.length-1]+=l}r.trim!==!1&&(s=s.map(c=>j2(c)));let u=[...s.join(`
|
|
108
108
|
`)];for(let[c,l]of u.entries()){if(n+=l,cu.has(l)){let{groups:p}=new RegExp(`(?:\\${oD}(?<code>\\d+)m|\\${ed}(?<uri>.*)${Qf})`).exec(u.slice(c).join(""))||{groups:{}};if(p.code!==void 0){let h=Number.parseFloat(p.code);o=h===B2?void 0:h}else p.uri!==void 0&&(i=p.uri.length===0?void 0:p.uri)}let d=R2.codes.get(Number(o));u[c+1]===`
|
|
109
109
|
`?(i&&(n+=Jy("")),o&&d&&(n+=Yy(d))):l===`
|
|
110
110
|
`&&(o&&d&&(n+=Yy(o)),i&&(n+=Jy(i)))}return n};function Xy(t,e,r){return String(t).normalize().replace(/\r\n/g,`
|
|
@@ -168,26 +168,26 @@ Trial expires in ${s} days, upgrade here: ${i.hostWeb}/dashboard/settings/plans
|
|
|
168
168
|
)`).eq("name",r).eq("app_id",e).single();if(o)throw f.error(`Error fetching native packages: ${o.message}`),new Error(`Error fetching native packages: ${o.message}`);return H5(n.version.native_packages??[])}async function XA(t,e,r,n){let o=De();o.start(`Checking bundle checksum compatibility with channel ${r}`);let i=await q5(t,e,r);if(!i){o.stop(`No checksum found for channel ${r}, the bundle will be uploaded`);return}if(i&&i===n)throw f.error(`Cannot upload the same bundle content.
|
|
169
169
|
Current bundle checksum matches remote bundle for channel ${r}
|
|
170
170
|
Did you build your app before uploading?
|
|
171
|
-
PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");o.stop(`Checksum compatible with ${r} channel`)}function le(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function $o(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=Du(t.localVersion),r=Du(t.remoteVersion);return vD(e,r)}catch{return!1}}async function Kl(t,e,r,n,o){let i=await Tg(n,o),a=await JA(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let l=a.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...a].filter(([c])=>i.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function Rg(t,e,r,n){let o=await JA(t,e,r),i=n.map(s=>{let u=o.get(s.name);return u?{name:s.name,localVersion:s.version,remoteVersion:u.version}:{name:s.name,localVersion:s.version,remoteVersion:void 0}}),a=[...o].filter(([s])=>n.find(u=>u.name===s)===void 0).map(([s,u])=>({name:s,localVersion:void 0,remoteVersion:u.version}));return i.push(...a),{finalCompatibility:i,localDependencies:n}}async function Gl(t,e,r){let n=await ve({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(we(n))throw t&&e&&r&&await ur("onboarding-v2",e,r,"canceled","\u{1F937}"),f.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=tt(),i=De();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,FA.spawn)(o.runner,["cap","sync"],{stdio:"pipe"});u.on("close",c=>{c===0?a():s(new Error(`Command failed with exit code ${c}`))}),u.on("error",c=>{s(c)})}),i.stop("Capacitor sync completed \u2705")}catch(a){i.stop("Error"),f.error(`Failed to run Capacitor sync: ${a}`),f.warn(`Please run "${o.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let o=tt();f.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),f.info(`Remember to run "${o.runner} cap sync" before uploading encrypted bundles`)}}async function ZA(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Me(t,e,r,n,o=!1){let i=tt(),a=await BA(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||f.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${i.runner} @capgo/cli app add ${r}\` to create it`;throw o||f.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||f.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${vt[a.data]}, required for this action: ${vt[n]}.`;throw o||f.error(c),new Error(c)}return a.data}var pr="assets/icon.png";var V5=/^[a-z0-9]+(\.[\w-]+)+$/i;function z5(t,e,r){if(!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||f.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!V5.test(t))throw r||(f.error(`Invalid app ID format: "${t}"`),f.info("App ID must be in reverse domain notation (e.g., com.example.app)"),f.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),f.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function K5(t,e,r){if(await ZA(t,e))throw e==="io.ionic.starter"?(r||f.error(`This appId ${e} cannot be used it's reserved, please change it in your capacitor config.`),new Error("Reserved appId, please change it in capacitor config")):(r||f.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function Bg(t,e,r,n=!1){n||ee("Adding"),await ge(),e.apikey=e.apikey||ne();let o=await te(),i=le(t,o?.config);z5(i,e,n);let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ie(a,e.apikey,["write","all"]);await K5(a,i,n),r||(r=await aa(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||o.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||f.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),new Error("Missing app name or icon path");n||f.info(`Adding ${i} to Capgo`);let d=null,p=null;l&&(0,ua.existsSync)(l)?(d=(0,ua.readFileSync)(l),p=ia(l)||"image/png",n||f.warn(`Found app icon ${l}`)):(0,ua.existsSync)(pr)?(d=(0,ua.readFileSync)(pr),p=ia(pr)||"image/png",n||f.warn(`Found app icon ${pr}`)):n||f.warn(`Cannot find app icon in any of the following locations: ${l}, ${pr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(d&&p){let{error:y}=await a.storage.from(`images/org/${u}/${i}`).upload(h,d,{contentType:p});if(y)throw n||console.error(y),n||f.error(`Could not add app ${U(y)}`),new Error(`Could not add app ${U(y)}`);let{data:C}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(b)throw n||f.error(`Could not add app ${U(b)}`),new Error(`Could not add app ${U(b)}`);return n||(f.success(`App ${i} added to Capgo. You can upload a bundle now`),Z("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function QA(t,e){await Bg(t,e,void 0)}async function G5(t,e,r=!1,n=!1){r||ee("Deleting"),e.apikey=e.apikey||ne();let o=await te(),i=le(t,o?.config);if(!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ie(a,e.apikey,["write","all"]);await Me(a,e.apikey,i,5,r);let{data:u,error:c}=await a.from("apps").select("owner_org ( created_by, id )").eq("app_id",i).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{f.warn("Deleting the app is not recommended for users that are not the organization owner"),f.warn("You are invited as a super_admin but your are not the owner"),f.warn("It's strongly recommended that you do not continue!");let b=await br({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(we(b)||b==="no")throw f.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&f.warn(`Cannot get the app owner ${U(c)}`);let{error:d}=await a.storage.from("images").remove([`org/${l?.owner_org.id}/${i}/icon`]);d&&!r&&f.error("Could not delete app logo");let{error:p}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);p&&!r&&f.error("Could not delete app version");let{error:h}=await a.from("apps").delete().eq("app_id",i);if(h)throw r||f.error("Could not delete app"),new Error(`Could not delete app: ${U(h)}`);let m=await bt(a,i);return await de(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(f.success("App deleted in Capgo"),Z("Done \u2705")),!0}async function eO(t,e){return G5(t,e,!1,!1)}var Wl=require("node:os"),rO=require("node:process");async function tO(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>Qc(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function W5(){let t=await dr(),e={"@capgo/cli":yr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function Y5(t,e=!1){e||f.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=Fr("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=le("",r?.config),s=r?.config?.webDir||"";e||(f.info(` App Name: ${i}`),f.info(` App ID: ${a}`),f.info(` App Version: ${o}`),f.info(` Web Dir: ${s}`),f.info(` OS: ${(0,Wl.platform)()} ${(0,Wl.version)()}`),f.info(` Node: ${rO.version}`),f.info(" Installed Dependencies:"));let u=await W5();if(Object.keys(u).length===0)throw e||f.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))f.info(` ${l}: ${u[l]}`);let c={};if(e)c=await tO(u);else{let l=De();l.start("Running: Loading latest dependencies"),c=await tO(u),l.stop("Latest Dependencies:");for(let d of Object.keys(c))f.info(` ${d}: ${c[d]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||f.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),new Error("Some dependencies are not up to date");return e||f.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:i,appId:a,appVersion:o,webDir:s,installedDependencies:u,latestDependencies:c}}async function nO(t){return Y5(t)}function J5(t){let e=new at;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,sa(r.created_at)]);f.success("Apps"),f.success(e.toString())}async function X5(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||f.error("Apps not found"),new Error("Apps not found");return r??[]}async function Z5(t,e=!1){e||ee("List apps in Capgo"),await ge(),t.apikey=t.apikey||ne();let r=await re(t.apikey,t.supaHost,t.supaAnon);await ie(r,t.apikey,["write","all","read","upload"]),e||f.info("Getting active bundle in Capgo");let n=await X5(r,e);if(!n.length)throw e||f.error("No apps found"),new Error("No apps found");return e||(f.info(`Active app in Capgo: ${n.length}`),J5(n),Z("Done \u2705")),n}async function oO(t){return Z5(t,!1)}var iO=require("node:crypto"),ca=require("node:fs");async function Q5(t,e,r=!1){r||ee("Set app"),e.apikey=e.apikey||ne();let n=await te();if(t=le(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),a=(await aa(o,["admin","super_admin"])).gid,s=await ie(o,e.apikey,["write","all"]);await Me(o,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||f.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||f.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||f.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let d,p,h=`icon_${(0,iO.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,ca.existsSync)(c)?(d=(0,ca.readFileSync)(c),p=ia(c)||"image/png",r||f.warn(`Found app icon ${c}`)):(0,ca.existsSync)(pr)?(d=(0,ca.readFileSync)(pr),p=ia(pr)||"image/png",r||f.warn(`Found app icon ${pr}`)):r||f.warn(`Cannot find app icon in any of the following locations: ${c}, ${pr}`),d&&p){let{error:y}=await o.storage.from(`images/org/${a}/${t}`).upload(h,d,{contentType:p});if(y)throw r||f.error(`Could not set app ${U(y)}`),new Error(`Could not set app: ${U(y)}`);let{data:C}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await o.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",s);if(b)throw r||f.error(`Could not set app ${U(b)}`),new Error(`Could not set app: ${U(b)}`);return r||Z("Done \u2705"),!0}async function aO(t,e){return Q5(t,e)}async function eM(t,e,r=!1){if(r||ee("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||f.error("Bool and string CANNOT be set at the same time"),new Error("Bool and string cannot both be provided");if(!e.bool&&!e.string)throw r||f.error("You MUST provide either bool or string as the value"),new Error("Either bool or string value is required");if(e.bool&&e.bool!=="true"&&e.bool!=="false")throw r||f.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await te(),o=n.config,i=t.split(".");if(i.length===0)throw r||f.error("Invalid path"),new Error("Invalid config path");for(let s of i.slice(0,-1))Object.prototype.hasOwnProperty.call(o,s)||(o[s]={}),o=o[s];let a=e.bool?e.bool==="true":e.string;o[i.at(-1)]=a,await Xi(n,!0),r||f.success(`Set "${t}" to "${a}"`)}catch(n){throw r||f.error(`Cannot set config in capacitor settings ${U(n)}`),new Error(`Cannot set capacitor config: ${U(n)}`)}r||Z("Done \u2705")}async function sO(t,e){return eM(t,e)}var To=require("node:fs"),Ro=require("node:path"),Xt=ue(require("node:process"));var Io=require("node:fs/promises"),uO=require("node:os"),Ng=require("node:path"),Fe=require("node:process"),cO=(0,Ng.join)((0,uO.homedir)(),".capgo-credentials"),lO=(0,Ng.join)(cO,"credentials.json");async function la(t){return(await(0,Io.readFile)(t)).toString("base64")}async function Jl(){try{let t=await(0,Io.readFile)(lO,"utf-8");return JSON.parse(t)}catch{return{}}}async function Is(t){let e=await Jl();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}async function Yl(t){await(0,Io.mkdir)(cO,{recursive:!0}),await(0,Io.writeFile)(lO,JSON.stringify(t,null,2),"utf-8")}function tM(){let t={};return Fe.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=Fe.env.BUILD_CERTIFICATE_BASE64),Fe.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=Fe.env.BUILD_PROVISION_PROFILE_BASE64),Fe.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=Fe.env.BUILD_PROVISION_PROFILE_BASE64_PROD),Fe.env.P12_PASSWORD&&(t.P12_PASSWORD=Fe.env.P12_PASSWORD),Fe.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=Fe.env.APPLE_KEY_ID),Fe.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=Fe.env.APPLE_ISSUER_ID),Fe.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=Fe.env.APPLE_KEY_CONTENT),Fe.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=Fe.env.APPLE_PROFILE_NAME),Fe.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=Fe.env.APP_STORE_CONNECT_TEAM_ID),Fe.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=Fe.env.ANDROID_KEYSTORE_FILE),Fe.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=Fe.env.KEYSTORE_KEY_ALIAS),Fe.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=Fe.env.KEYSTORE_KEY_PASSWORD),Fe.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=Fe.env.KEYSTORE_STORE_PASSWORD),Fe.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=Fe.env.PLAY_CONFIG_JSON),t}async function fO(t,e,r){let n=await Is(t),o=tM(),i={...n?.[e]||{}};if(Object.assign(i,o),r&&Object.assign(i,r),e==="android"){let a=!!i.KEYSTORE_KEY_PASSWORD,s=!!i.KEYSTORE_STORE_PASSWORD;a&&!s?i.KEYSTORE_STORE_PASSWORD=i.KEYSTORE_KEY_PASSWORD:!a&&s&&(i.KEYSTORE_KEY_PASSWORD=i.KEYSTORE_STORE_PASSWORD)}return Object.keys(i).length>0?i:void 0}async function dO(t,e,r={}){let n={...r};return t==="ios"?(e.BUILD_CERTIFICATE_FILE&&(n.BUILD_CERTIFICATE_BASE64=await la(e.BUILD_CERTIFICATE_FILE)),e.BUILD_PROVISION_PROFILE_FILE&&(n.BUILD_PROVISION_PROFILE_BASE64=await la(e.BUILD_PROVISION_PROFILE_FILE)),e.BUILD_PROVISION_PROFILE_FILE_PROD&&(n.BUILD_PROVISION_PROFILE_BASE64_PROD=await la(e.BUILD_PROVISION_PROFILE_FILE_PROD)),e.APPLE_KEY_FILE&&(n.APPLE_KEY_CONTENT=await la(e.APPLE_KEY_FILE))):t==="android"&&(e.ANDROID_KEYSTORE_PATH&&(n.ANDROID_KEYSTORE_FILE=await la(e.ANDROID_KEYSTORE_PATH)),e.PLAY_CONFIG_JSON_PATH&&(n.PLAY_CONFIG_JSON=await la(e.PLAY_CONFIG_JSON_PATH))),n}async function pO(t,e,r){let n=await Jl(),o=n[t]||{};o[e]={...o[e],...r},n[t]=o,await Yl(n)}async function Xl(t,e){let r=await Jl();if(!t){await Yl({});return}if(!e){delete r[t],await Yl(r);return}let n=r[t]||{};delete n[e],Object.keys(n).length===0?delete r[t]:r[t]=n,await Yl(r)}async function hO(t,e){return(await Is(t))?.[e]||null}async function Lg(){let t=await Jl();return Object.keys(t)}async function mO(t){try{t.platform||(f.error("Platform is required. Use --platform ios or --platform android"),Xt.default.exit(1));let e=await te(),r=le(t.appId,e?.config);r||(f.error("\u274C App ID is required."),f.error(""),f.error("Either:"),f.error(" 1. Run this command from a Capacitor project directory, OR"),f.error(" 2. Provide --appId explicitly: --appId com.example.app"),f.error(""),Xt.default.exit(1));let n=t.platform;f.info(`
|
|
171
|
+
PS: You can ignore this check with "--ignore-checksum-check"`),new Error("Cannot upload the same bundle content");o.stop(`Checksum compatible with ${r} channel`)}function le(t,e){return t||e?.plugins?.CapacitorUpdater?.appId||e?.appId}function $o(t){if(!t.localVersion)return!0;if(!t.remoteVersion)return!1;try{let e=Du(t.localVersion),r=Du(t.remoteVersion);return vD(e,r)}catch{return!1}}async function Kl(t,e,r,n,o){let i=await Tg(n,o),a=await JA(t,e,r),s=i.filter(c=>!!c.native).map(c=>{let l=a.get(c.name);return l?{name:c.name,localVersion:c.version,remoteVersion:l.version}:{name:c.name,localVersion:c.version,remoteVersion:void 0}}),u=[...a].filter(([c])=>i.find(l=>l.name===c)===void 0).map(([c,l])=>({name:c,localVersion:void 0,remoteVersion:l.version}));return s.push(...u),{finalCompatibility:s,localDependencies:i}}async function Rg(t,e,r,n){let o=await JA(t,e,r),i=n.map(s=>{let u=o.get(s.name);return u?{name:s.name,localVersion:s.version,remoteVersion:u.version}:{name:s.name,localVersion:s.version,remoteVersion:void 0}}),a=[...o].filter(([s])=>n.find(u=>u.name===s)===void 0).map(([s,u])=>({name:s,localVersion:void 0,remoteVersion:u.version}));return i.push(...a),{finalCompatibility:i,localDependencies:n}}async function Gl(t,e,r){let n=await ve({message:"Would you like to sync your project with Capacitor now? This is recommended to ensure encrypted updates work properly."});if(we(n))throw t&&e&&r&&await ur("onboarding-v2",e,r,"canceled","\u{1F937}"),f.error("Canceled Capacitor sync"),new Error("Capacitor sync cancelled");if(n){let o=tt(),i=De();i.start("Running the command...");try{await new Promise((a,s)=>{let u=(0,FA.spawn)(o.runner,["cap","sync"],{stdio:"pipe"});u.on("close",c=>{c===0?a():s(new Error(`Command failed with exit code ${c}`))}),u.on("error",c=>{s(c)})}),i.stop("Capacitor sync completed \u2705")}catch(a){i.stop("Error"),f.error(`Failed to run Capacitor sync: ${a}`),f.warn(`Please run "${o.runner} cap sync" manually to ensure encrypted updates work properly`)}}else{let o=tt();f.warn("\u26A0\uFE0F Important: If you upload encrypted bundles without syncing, updates will fail!"),f.info(`Remember to run "${o.runner} cap sync" before uploading encrypted bundles`)}}async function ZA(t,e){let{data:r}=await t.rpc("exist_app_v2",{appid:e}).single();return!!r}async function Me(t,e,r,n,o=!1){let i=tt(),a=await BA(t,e,r);if(!a.okay)switch(a.error){case"INVALID_APIKEY":{let c="Invalid apikey, such apikey does not exists!";throw o||f.error(c),new Error(c)}case"NO_APP":{let c=`App ${r} does not exist, run first \`${i.runner} @capgo/cli app add ${r}\` to create it`;throw o||f.error(c),new Error(c)}case"NO_ORG":{let c="Could not find organization, please contact support to resolve this!";throw o||f.error(c),new Error(c)}}let s=a.data;if(n>s){let c=`Insuficcent permissions for app ${r}. Current permission: ${vt[a.data]}, required for this action: ${vt[n]}.`;throw o||f.error(c),new Error(c)}return a.data}var pr="assets/icon.png";var V5=/^[a-z0-9]+(\.[\w-]+)+$/i;function z5(t,e,r){if(!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(t.includes("--"))throw r||f.error('The app id includes illegal symbols. You cannot use "--" in the app id'),new Error("App id includes illegal symbols");if(!V5.test(t))throw r||(f.error(`Invalid app ID format: "${t}"`),f.info("App ID must be in reverse domain notation (e.g., com.example.app)"),f.info("Valid format: lowercase letters, numbers, dots, hyphens, and underscores"),f.info("Examples: com.mycompany.myapp, io.capgo.app, com.example.my-app")),new Error("Invalid app ID format")}async function K5(t,e,r){if(await ZA(t,e))throw e==="io.ionic.starter"?(r||f.error(`This appId ${e} cannot be used it's reserved, please change it in your capacitor config.`),new Error("Reserved appId, please change it in capacitor config")):(r||f.error(`App ${e} already exist`),new Error(`App ${e} already exists`))}async function Bg(t,e,r,n=!1){n||ee("Adding"),await ge(),e.apikey=e.apikey||ne();let o=await te(),i=le(t,o?.config);z5(i,e,n);let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ie(a,e.apikey,["write","all"]);await K5(a,i,n),r||(r=await aa(a,["admin","super_admin"]));let u=r.gid,{name:c,icon:l}=e;if(c=c||o.config?.appName||"Unknown",l=l||"resources/icon.png",!l||!c)throw n||f.error("Missing argument, you need to provide a appId and a name, or be in a capacitor project"),new Error("Missing app name or icon path");n||f.info(`Adding ${i} to Capgo`);let d=null,p=null;l&&(0,ua.existsSync)(l)?(d=(0,ua.readFileSync)(l),p=ia(l)||"image/png",n||f.warn(`Found app icon ${l}`)):(0,ua.existsSync)(pr)?(d=(0,ua.readFileSync)(pr),p=ia(pr)||"image/png",n||f.warn(`Found app icon ${pr}`)):n||f.warn(`Cannot find app icon in any of the following locations: ${l}, ${pr}`);let h="icon",m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(d&&p){let{error:y}=await a.storage.from(`images/org/${u}/${i}`).upload(h,d,{contentType:p});if(y)throw n||console.error(y),n||f.error(`Could not add app ${U(y)}`),new Error(`Could not add app ${U(y)}`);let{data:C}=await a.storage.from(`images/org/${u}/${i}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await a.from("apps").insert({icon_url:m,owner_org:u,user_id:s,name:c,app_id:i});if(b)throw n||f.error(`Could not add app ${U(b)}`),new Error(`Could not add app ${U(b)}`);return n||(f.success(`App ${i} added to Capgo. You can upload a bundle now`),Z("Done \u2705")),{appId:i,organizationUid:u,userId:s,name:c,signedURL:m}}async function QA(t,e){await Bg(t,e,void 0)}async function G5(t,e,r=!1,n=!1){r||ee("Deleting"),e.apikey=e.apikey||ne();let o=await te(),i=le(t,o?.config);if(!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await re(e.apikey,e.supaHost,e.supaAnon),s=await ie(a,e.apikey,["write","all"]);await Me(a,e.apikey,i,5,r);let{data:u,error:c}=await a.from("apps").select("owner_org ( created_by, id )").eq("app_id",i).single(),l=u;if(!n&&!c&&(l?.owner_org.created_by??"")!==s){if(r)throw new Error("Cannot delete app: you are not the organization owner");{f.warn("Deleting the app is not recommended for users that are not the organization owner"),f.warn("You are invited as a super_admin but your are not the owner"),f.warn("It's strongly recommended that you do not continue!");let b=await br({message:"Do you want to continue?",options:[{label:"Yes",value:"yes"},{label:"No",value:"no"}]});if(we(b)||b==="no")throw f.error("Canceled deleting the app, exiting"),new Error("App deletion cancelled")}}else c&&!r&&f.warn(`Cannot get the app owner ${U(c)}`);let{error:d}=await a.storage.from("images").remove([`org/${l?.owner_org.id}/${i}/icon`]);d&&!r&&f.error("Could not delete app logo");let{error:p}=await a.storage.from(`apps/${i}/${s}`).remove(["versions"]);p&&!r&&f.error("Could not delete app version");let{error:h}=await a.from("apps").delete().eq("app_id",i);if(h)throw r||f.error("Could not delete app"),new Error(`Could not delete app: ${U(h)}`);let m=await bt(a,i);return await de(e.apikey,{channel:"app",event:"App Deleted",icon:"\u{1F5D1}\uFE0F",user_id:m,tags:{"app-id":i},notify:!1}).catch(()=>{}),r||(f.success("App deleted in Capgo"),Z("Done \u2705")),!0}async function e1(t,e){return G5(t,e,!1,!1)}var Wl=require("node:os"),r1=require("node:process");async function t1(t){let e={},r=Object.keys(t);return(await Promise.all(r.map(o=>Qc(o)))).forEach((o,i)=>{o&&(e[r[i]]=o)}),e}async function W5(){let t=await dr(),e={"@capgo/cli":yr.version};for(let[r,n]of t)(r.startsWith("@capgo/")||r.startsWith("@capawesome/")||r.startsWith("capacitor"))&&(e[r]=n);return e}async function Y5(t,e=!1){e||f.warn(" \u{1F48A} Capgo Doctor \u{1F48A}");let r=await te(),n=Fr("",t.packageJson),o=r?.config?.plugins?.CapacitorUpdater?.version||n,i=r?.config?.appName||"",a=le("",r?.config),s=r?.config?.webDir||"";e||(f.info(` App Name: ${i}`),f.info(` App ID: ${a}`),f.info(` App Version: ${o}`),f.info(` Web Dir: ${s}`),f.info(` OS: ${(0,Wl.platform)()} ${(0,Wl.version)()}`),f.info(` Node: ${r1.version}`),f.info(" Installed Dependencies:"));let u=await W5();if(Object.keys(u).length===0)throw e||f.warning("\x1B[31m%s\x1B[0m \u{1F6A8} No dependencies found"),new Error("No dependencies found");if(!e)for(let l of Object.keys(u))f.info(` ${l}: ${u[l]}`);let c={};if(e)c=await t1(u);else{let l=De();l.start("Running: Loading latest dependencies"),c=await t1(u),l.stop("Latest Dependencies:");for(let d of Object.keys(c))f.info(` ${d}: ${c[d]}`)}if(JSON.stringify(u)!==JSON.stringify(c))throw e||f.warn("\x1B[31m\u{1F6A8} Some dependencies are not up to date\x1B[0m"),new Error("Some dependencies are not up to date");return e||f.success("\x1B[32m\u2705 All dependencies are up to date\x1B[0m"),{appName:i,appId:a,appVersion:o,webDir:s,installedDependencies:u,latestDependencies:c}}async function n1(t){return Y5(t)}function J5(t){let e=new at;e.headers=["Name","id","Created"],e.rows=[];for(let r of t.toReversed())e.rows.push([r.name??"",r.app_id,sa(r.created_at)]);f.success("Apps"),f.success(e.toString())}async function X5(t,e){let{data:r,error:n}=await t.from("apps").select().order("created_at",{ascending:!1});if(n)throw e||f.error("Apps not found"),new Error("Apps not found");return r??[]}async function Z5(t,e=!1){e||ee("List apps in Capgo"),await ge(),t.apikey=t.apikey||ne();let r=await re(t.apikey,t.supaHost,t.supaAnon);await ie(r,t.apikey,["write","all","read","upload"]),e||f.info("Getting active bundle in Capgo");let n=await X5(r,e);if(!n.length)throw e||f.error("No apps found"),new Error("No apps found");return e||(f.info(`Active app in Capgo: ${n.length}`),J5(n),Z("Done \u2705")),n}async function o1(t){return Z5(t,!1)}var i1=require("node:crypto"),ca=require("node:fs");async function Q5(t,e,r=!1){r||ee("Set app"),e.apikey=e.apikey||ne();let n=await te();if(t=le(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),a=(await aa(o,["admin","super_admin"])).gid,s=await ie(o,e.apikey,["write","all"]);await Me(o,e.apikey,t,4,r);let{name:u,icon:c,retention:l}=e;if(l&&Number.isNaN(Number(l)))throw r||f.error("retention value must be a number"),new Error("Retention value must be a number");if(l&&l<0)throw r||f.error("retention value cannot be less than 0"),new Error("Retention value cannot be less than 0");if(l&&l>=63113904)throw r||f.error("retention value cannot be greater than 63113904 seconds (2 years)"),new Error("Retention value cannot be greater than 63113904 seconds (2 years)");let d,p,h=`icon_${(0,i1.randomUUID)()}`,m="https://xvwzpoazmxkqosrdewyv.supabase.co/storage/v1/object/public/images/capgo.png";if(c&&(0,ca.existsSync)(c)?(d=(0,ca.readFileSync)(c),p=ia(c)||"image/png",r||f.warn(`Found app icon ${c}`)):(0,ca.existsSync)(pr)?(d=(0,ca.readFileSync)(pr),p=ia(pr)||"image/png",r||f.warn(`Found app icon ${pr}`)):r||f.warn(`Cannot find app icon in any of the following locations: ${c}, ${pr}`),d&&p){let{error:y}=await o.storage.from(`images/org/${a}/${t}`).upload(h,d,{contentType:p});if(y)throw r||f.error(`Could not set app ${U(y)}`),new Error(`Could not set app: ${U(y)}`);let{data:C}=await o.storage.from(`images/org/${a}/${t}`).getPublicUrl(h);m=C?.publicUrl||m}let{error:b}=await o.from("apps").update({icon_url:m,name:u,retention:l?l*24*60*60:void 0}).eq("app_id",t).eq("user_id",s);if(b)throw r||f.error(`Could not set app ${U(b)}`),new Error(`Could not set app: ${U(b)}`);return r||Z("Done \u2705"),!0}async function a1(t,e){return Q5(t,e)}async function eM(t,e,r=!1){if(r||ee("Set a specific setting in capacitor config"),e.bool&&e.string)throw r||f.error("Bool and string CANNOT be set at the same time"),new Error("Bool and string cannot both be provided");if(!e.bool&&!e.string)throw r||f.error("You MUST provide either bool or string as the value"),new Error("Either bool or string value is required");if(e.bool&&e.bool!=="true"&&e.bool!=="false")throw r||f.error("Invalid bool"),new Error("Invalid bool value; expected true or false");try{let n=await te(),o=n.config,i=t.split(".");if(i.length===0)throw r||f.error("Invalid path"),new Error("Invalid config path");for(let s of i.slice(0,-1))Object.prototype.hasOwnProperty.call(o,s)||(o[s]={}),o=o[s];let a=e.bool?e.bool==="true":e.string;o[i.at(-1)]=a,await Xi(n,!0),r||f.success(`Set "${t}" to "${a}"`)}catch(n){throw r||f.error(`Cannot set config in capacitor settings ${U(n)}`),new Error(`Cannot set capacitor config: ${U(n)}`)}r||Z("Done \u2705")}async function s1(t,e){return eM(t,e)}var To=require("node:fs"),Ro=require("node:path"),Xt=ue(require("node:process"));var Io=require("node:fs/promises"),u1=require("node:os"),Ng=require("node:path"),Fe=require("node:process"),c1=(0,Ng.join)((0,u1.homedir)(),".capgo-credentials"),l1=(0,Ng.join)(c1,"credentials.json");async function la(t){return(await(0,Io.readFile)(t)).toString("base64")}async function Jl(){try{let t=await(0,Io.readFile)(l1,"utf-8");return JSON.parse(t)}catch{return{}}}async function Is(t){let e=await Jl();if(!t){let r=Object.keys(e);return r.length===0?null:e[r[0]]||null}return e[t]||null}async function Yl(t){await(0,Io.mkdir)(c1,{recursive:!0}),await(0,Io.writeFile)(l1,JSON.stringify(t,null,2),"utf-8")}function tM(){let t={};return Fe.env.BUILD_CERTIFICATE_BASE64&&(t.BUILD_CERTIFICATE_BASE64=Fe.env.BUILD_CERTIFICATE_BASE64),Fe.env.BUILD_PROVISION_PROFILE_BASE64&&(t.BUILD_PROVISION_PROFILE_BASE64=Fe.env.BUILD_PROVISION_PROFILE_BASE64),Fe.env.BUILD_PROVISION_PROFILE_BASE64_PROD&&(t.BUILD_PROVISION_PROFILE_BASE64_PROD=Fe.env.BUILD_PROVISION_PROFILE_BASE64_PROD),Fe.env.P12_PASSWORD&&(t.P12_PASSWORD=Fe.env.P12_PASSWORD),Fe.env.APPLE_KEY_ID&&(t.APPLE_KEY_ID=Fe.env.APPLE_KEY_ID),Fe.env.APPLE_ISSUER_ID&&(t.APPLE_ISSUER_ID=Fe.env.APPLE_ISSUER_ID),Fe.env.APPLE_KEY_CONTENT&&(t.APPLE_KEY_CONTENT=Fe.env.APPLE_KEY_CONTENT),Fe.env.APPLE_PROFILE_NAME&&(t.APPLE_PROFILE_NAME=Fe.env.APPLE_PROFILE_NAME),Fe.env.APP_STORE_CONNECT_TEAM_ID&&(t.APP_STORE_CONNECT_TEAM_ID=Fe.env.APP_STORE_CONNECT_TEAM_ID),Fe.env.ANDROID_KEYSTORE_FILE&&(t.ANDROID_KEYSTORE_FILE=Fe.env.ANDROID_KEYSTORE_FILE),Fe.env.KEYSTORE_KEY_ALIAS&&(t.KEYSTORE_KEY_ALIAS=Fe.env.KEYSTORE_KEY_ALIAS),Fe.env.KEYSTORE_KEY_PASSWORD&&(t.KEYSTORE_KEY_PASSWORD=Fe.env.KEYSTORE_KEY_PASSWORD),Fe.env.KEYSTORE_STORE_PASSWORD&&(t.KEYSTORE_STORE_PASSWORD=Fe.env.KEYSTORE_STORE_PASSWORD),Fe.env.PLAY_CONFIG_JSON&&(t.PLAY_CONFIG_JSON=Fe.env.PLAY_CONFIG_JSON),t}async function f1(t,e,r){let n=await Is(t),o=tM(),i={...n?.[e]||{}};if(Object.assign(i,o),r&&Object.assign(i,r),e==="android"){let a=!!i.KEYSTORE_KEY_PASSWORD,s=!!i.KEYSTORE_STORE_PASSWORD;a&&!s?i.KEYSTORE_STORE_PASSWORD=i.KEYSTORE_KEY_PASSWORD:!a&&s&&(i.KEYSTORE_KEY_PASSWORD=i.KEYSTORE_STORE_PASSWORD)}return Object.keys(i).length>0?i:void 0}async function d1(t,e,r={}){let n={...r};return t==="ios"?(e.BUILD_CERTIFICATE_FILE&&(n.BUILD_CERTIFICATE_BASE64=await la(e.BUILD_CERTIFICATE_FILE)),e.BUILD_PROVISION_PROFILE_FILE&&(n.BUILD_PROVISION_PROFILE_BASE64=await la(e.BUILD_PROVISION_PROFILE_FILE)),e.BUILD_PROVISION_PROFILE_FILE_PROD&&(n.BUILD_PROVISION_PROFILE_BASE64_PROD=await la(e.BUILD_PROVISION_PROFILE_FILE_PROD)),e.APPLE_KEY_FILE&&(n.APPLE_KEY_CONTENT=await la(e.APPLE_KEY_FILE))):t==="android"&&(e.ANDROID_KEYSTORE_PATH&&(n.ANDROID_KEYSTORE_FILE=await la(e.ANDROID_KEYSTORE_PATH)),e.PLAY_CONFIG_JSON_PATH&&(n.PLAY_CONFIG_JSON=await la(e.PLAY_CONFIG_JSON_PATH))),n}async function p1(t,e,r){let n=await Jl(),o=n[t]||{};o[e]={...o[e],...r},n[t]=o,await Yl(n)}async function Xl(t,e){let r=await Jl();if(!t){await Yl({});return}if(!e){delete r[t],await Yl(r);return}let n=r[t]||{};delete n[e],Object.keys(n).length===0?delete r[t]:r[t]=n,await Yl(r)}async function h1(t,e){return(await Is(t))?.[e]||null}async function Lg(){let t=await Jl();return Object.keys(t)}async function m1(t){try{t.platform||(f.error("Platform is required. Use --platform ios or --platform android"),Xt.default.exit(1));let e=await te(),r=le(t.appId,e?.config);r||(f.error("\u274C App ID is required."),f.error(""),f.error("Either:"),f.error(" 1. Run this command from a Capacitor project directory, OR"),f.error(" 2. Provide --appId explicitly: --appId com.example.app"),f.error(""),Xt.default.exit(1));let n=t.platform;f.info(`
|
|
172
172
|
\u{1F512} SECURITY NOTICE:`),f.info(" - Credentials saved to ~/.capgo-credentials/credentials.json (local only)"),f.info(" - When building, credentials are sent to Capgo servers"),f.info(" - Credentials are NEVER stored on Capgo servers"),f.info(" - Auto-deleted after build (max 24 hours)"),f.info(` - Builds sent directly to app stores - Capgo keeps nothing
|
|
173
|
-
`);let o={},i={};if(n==="ios"){if(t.certificate){let u=(0,Ro.resolve)(t.certificate);(0,To.existsSync)(u)||(f.error(`Certificate file not found: ${u}`),Xt.default.exit(1)),i.BUILD_CERTIFICATE_FILE=u,f.info(`\u2713 Certificate file: ${u}`)}if(t.provisioningProfile){let u=(0,Ro.resolve)(t.provisioningProfile);(0,To.existsSync)(u)||(f.error(`Provisioning profile not found: ${u}`),Xt.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE=u,f.info(`\u2713 Provisioning profile: ${u}`)}if(t.provisioningProfileProd){let u=(0,Ro.resolve)(t.provisioningProfileProd);(0,To.existsSync)(u)||(f.error(`Production provisioning profile not found: ${u}`),Xt.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE_PROD=u,f.info(`\u2713 Production provisioning profile: ${u}`)}if(t.appleKey){let u=(0,Ro.resolve)(t.appleKey);(0,To.existsSync)(u)||(f.error(`Apple key file not found: ${u}`),Xt.default.exit(1)),i.APPLE_KEY_FILE=u,f.info(`\u2713 Apple key file: ${u}`)}t.p12Password?o.P12_PASSWORD=t.p12Password:i.BUILD_CERTIFICATE_FILE&&(f.warn("\u26A0\uFE0F No P12 password provided - assuming certificate has no password"),f.warn(' If your certificate requires a password, add --p12-password "your-password"')),t.appleKeyId&&(o.APPLE_KEY_ID=t.appleKeyId),t.appleIssuerId&&(o.APPLE_ISSUER_ID=t.appleIssuerId),t.appleProfileName&&(o.APPLE_PROFILE_NAME=t.appleProfileName),t.appleTeamId&&(o.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId)}else if(n==="android"){if(t.keystore){let l=(0,Ro.resolve)(t.keystore);(0,To.existsSync)(l)||(f.error(`Keystore file not found: ${l}`),Xt.default.exit(1)),i.ANDROID_KEYSTORE_PATH=l,f.info(`\u2713 Keystore file: ${l}`)}if(t.playConfig){let l=(0,Ro.resolve)(t.playConfig);(0,To.existsSync)(l)||(f.error(`Play config file not found: ${l}`),Xt.default.exit(1)),i.PLAY_CONFIG_JSON_PATH=l,f.info(`\u2713 Play Store config: ${l}`)}t.keystoreAlias&&(o.KEYSTORE_KEY_ALIAS=t.keystoreAlias);let u=!!t.keystoreKeyPassword,c=!!t.keystoreStorePassword;u&&!c?(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreKeyPassword):!u&&c?(o.KEYSTORE_KEY_PASSWORD=t.keystoreStorePassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword):u&&c&&(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword)}let a=await
|
|
173
|
+
`);let o={},i={};if(n==="ios"){if(t.certificate){let u=(0,Ro.resolve)(t.certificate);(0,To.existsSync)(u)||(f.error(`Certificate file not found: ${u}`),Xt.default.exit(1)),i.BUILD_CERTIFICATE_FILE=u,f.info(`\u2713 Certificate file: ${u}`)}if(t.provisioningProfile){let u=(0,Ro.resolve)(t.provisioningProfile);(0,To.existsSync)(u)||(f.error(`Provisioning profile not found: ${u}`),Xt.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE=u,f.info(`\u2713 Provisioning profile: ${u}`)}if(t.provisioningProfileProd){let u=(0,Ro.resolve)(t.provisioningProfileProd);(0,To.existsSync)(u)||(f.error(`Production provisioning profile not found: ${u}`),Xt.default.exit(1)),i.BUILD_PROVISION_PROFILE_FILE_PROD=u,f.info(`\u2713 Production provisioning profile: ${u}`)}if(t.appleKey){let u=(0,Ro.resolve)(t.appleKey);(0,To.existsSync)(u)||(f.error(`Apple key file not found: ${u}`),Xt.default.exit(1)),i.APPLE_KEY_FILE=u,f.info(`\u2713 Apple key file: ${u}`)}t.p12Password?o.P12_PASSWORD=t.p12Password:i.BUILD_CERTIFICATE_FILE&&(f.warn("\u26A0\uFE0F No P12 password provided - assuming certificate has no password"),f.warn(' If your certificate requires a password, add --p12-password "your-password"')),t.appleKeyId&&(o.APPLE_KEY_ID=t.appleKeyId),t.appleIssuerId&&(o.APPLE_ISSUER_ID=t.appleIssuerId),t.appleProfileName&&(o.APPLE_PROFILE_NAME=t.appleProfileName),t.appleTeamId&&(o.APP_STORE_CONNECT_TEAM_ID=t.appleTeamId)}else if(n==="android"){if(t.keystore){let l=(0,Ro.resolve)(t.keystore);(0,To.existsSync)(l)||(f.error(`Keystore file not found: ${l}`),Xt.default.exit(1)),i.ANDROID_KEYSTORE_PATH=l,f.info(`\u2713 Keystore file: ${l}`)}if(t.playConfig){let l=(0,Ro.resolve)(t.playConfig);(0,To.existsSync)(l)||(f.error(`Play config file not found: ${l}`),Xt.default.exit(1)),i.PLAY_CONFIG_JSON_PATH=l,f.info(`\u2713 Play Store config: ${l}`)}t.keystoreAlias&&(o.KEYSTORE_KEY_ALIAS=t.keystoreAlias);let u=!!t.keystoreKeyPassword,c=!!t.keystoreStorePassword;u&&!c?(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreKeyPassword):!u&&c?(o.KEYSTORE_KEY_PASSWORD=t.keystoreStorePassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword):u&&c&&(o.KEYSTORE_KEY_PASSWORD=t.keystoreKeyPassword,o.KEYSTORE_STORE_PASSWORD=t.keystoreStorePassword)}let a=await d1(n,i,o),s=[];if(n==="ios"?(a.BUILD_CERTIFICATE_BASE64||s.push("--certificate <path> (P12 certificate file)"),a.BUILD_PROVISION_PROFILE_BASE64||s.push("--provisioning-profile <path> (Provisioning profile file)"),a.APPLE_KEY_ID||s.push("--apple-key-id <id> (App Store Connect API Key ID)"),a.APPLE_ISSUER_ID||s.push("--apple-issuer-id <id> (App Store Connect Issuer ID)"),a.APPLE_KEY_CONTENT||s.push("--apple-key <path> (App Store Connect API Key file)"),a.APP_STORE_CONNECT_TEAM_ID||s.push("--apple-team-id <id> (App Store Connect Team ID)"),a.APPLE_PROFILE_NAME||s.push("--apple-profile-name <name> (Provisioning profile name)")):n==="android"&&(a.ANDROID_KEYSTORE_FILE||s.push("--keystore <path> (Keystore file)"),a.KEYSTORE_KEY_ALIAS||s.push("--keystore-alias <alias> (Keystore alias)"),!a.KEYSTORE_KEY_PASSWORD&&!a.KEYSTORE_STORE_PASSWORD&&s.push("--keystore-key-password <password> OR --keystore-store-password <password> (At least one password required, will be used for both)"),a.PLAY_CONFIG_JSON||s.push("--play-config <path> (Google Play service account JSON - required for uploading to Play Store)")),s.length>0){f.error(`\u274C Missing required credentials for ${n.toUpperCase()}:`),f.error("");for(let u of s)f.error(` \u2022 ${u}`);f.error(""),f.error("Example:"),n==="ios"?(f.error(" npx @capgo/cli build credentials save --platform ios \\"),f.error(" --certificate ./cert.p12 \\"),f.error(' --p12-password "your-password" \\ # Optional if cert has no password'),f.error(" --provisioning-profile ./profile.mobileprovision \\"),f.error(" --apple-key ./AuthKey_XXXXXXXXXX.p8 \\"),f.error(' --apple-key-id "XXXXXXXXXX" \\'),f.error(' --apple-issuer-id "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" \\'),f.error(' --apple-team-id "XXXXXXXXXX" \\'),f.error(' --apple-profile-name "match AppStore com.example.app"')):(f.error(" npx @capgo/cli build credentials save --platform android \\"),f.error(" --keystore ./release.keystore \\"),f.error(' --keystore-alias "my-key-alias" \\'),f.error(' --keystore-key-password "password" \\'),f.error(" --play-config ./play-store-service-account.json"),f.error(""),f.error(" Note: If both key and store passwords are the same, you only need to provide one."),f.error(" If they differ, provide both --keystore-key-password and --keystore-store-password."),f.error(" The --play-config is required for uploading to Google Play Store.")),f.error(""),Xt.default.exit(1)}await p1(r,n,a);try{let u=ne(!0);if(u){let c=await re(u),l=await bt(c,r);await de(u,{channel:"credentials",event:"Credentials saved",icon:"\u{1F510}",user_id:l,tags:{"app-id":r,platform:n},notify:!1}).catch()}}catch{}f.success(`
|
|
174
174
|
\u2705 ${n.toUpperCase()} credentials saved successfully for ${r}!`),f.info(" Location: ~/.capgo-credentials/credentials.json"),f.info(` Use: npx @capgo/cli build ${r} --platform ${n}
|
|
175
|
-
`)}catch(e){f.error(`Failed to save credentials: ${e instanceof Error?e.message:String(e)}`),Xt.default.exit(1)}}async function
|
|
175
|
+
`)}catch(e){f.error(`Failed to save credentials: ${e instanceof Error?e.message:String(e)}`),Xt.default.exit(1)}}async function g1(t){try{let e=await Lg();if(e.length===0){f.info("No saved credentials found."),f.info("Use: npx @capgo/cli build credentials save --platform <ios|android>");return}f.info(`
|
|
176
176
|
\u{1F4CB} Saved Build Credentials:
|
|
177
177
|
`);let r=await te(),n=t?.appId||le(void 0,r?.config),o=n?[n]:e;for(let i of o){let a=await Is(i);if(a){if(f.info(`
|
|
178
178
|
\u{1F539} App: ${i}`),a.ios){f.info(" iOS Credentials:");let s=a.ios;s.BUILD_CERTIFICATE_BASE64&&f.info(" \u2713 Certificate (base64)"),s.BUILD_PROVISION_PROFILE_BASE64&&f.info(" \u2713 Provisioning Profile (base64)"),s.BUILD_PROVISION_PROFILE_BASE64_PROD&&f.info(" \u2713 Production Provisioning Profile (base64)"),s.APPLE_KEY_CONTENT&&f.info(" \u2713 Apple Key Content (base64)"),s.P12_PASSWORD&&f.info(" \u2713 P12 Password: ********"),s.APPLE_KEY_ID&&f.info(` \u2713 Apple Key ID: ${s.APPLE_KEY_ID}`),s.APPLE_ISSUER_ID&&f.info(` \u2713 Apple Issuer ID: ${s.APPLE_ISSUER_ID}`),s.APP_STORE_CONNECT_TEAM_ID&&f.info(` \u2713 Team ID: ${s.APP_STORE_CONNECT_TEAM_ID}`)}if(a.android){f.info(" Android Credentials:");let s=a.android;s.ANDROID_KEYSTORE_FILE&&f.info(" \u2713 Keystore (base64)"),s.PLAY_CONFIG_JSON&&f.info(" \u2713 Play Store Config (base64)"),s.KEYSTORE_KEY_ALIAS&&f.info(` \u2713 Keystore Alias: ${s.KEYSTORE_KEY_ALIAS}`),s.KEYSTORE_KEY_PASSWORD&&f.info(" \u2713 Key Password: ********"),s.KEYSTORE_STORE_PASSWORD&&f.info(" \u2713 Store Password: ********")}}}f.info(`
|
|
179
179
|
Location: ~/.capgo-credentials/credentials.json`),f.info(`
|
|
180
180
|
\u{1F512} These credentials are stored locally on your machine only.`),f.info(" When building, they are sent to Capgo but NEVER stored there."),f.info(" They are auto-deleted after build completion (max 24 hours)."),f.info(` Builds sent directly to app stores - Capgo keeps nothing.
|
|
181
|
-
`)}catch(e){f.error(`Failed to list credentials: ${e instanceof Error?e.message:String(e)}`),Xt.default.exit(1)}}async function
|
|
182
|
-
`)}catch(e){f.error(`Failed to clear credentials: ${e instanceof Error?e.message:String(e)}`),Xt.default.exit(1)}}var fn=require("node:fs"),kr=require("node:fs/promises"),
|
|
183
|
-
`);for(let p of d)if(p.startsWith("data: ")){let h=p.slice(6);h.trim()&&f.error(h)}}}catch(i){o||f.warn(`Log streaming interrupted${i instanceof Error?`: ${i.message}`:""}`)}}async function nM(t,e,r,n,o,i){let s=0;for(;s<120;)try{let u=await fetch(`${t}/build/status?job_id=${encodeURIComponent(e)}&app_id=${encodeURIComponent(r)}&platform=${n}`,{headers:{authorization:o}});if(!u.ok){i||f.warn(`Status check failed: ${u.status}`),await new Promise(l=>setTimeout(l,5e3)),s++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(l=>setTimeout(l,5e3)),s++}catch(u){i||f.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),s++}return i||f.warn("Build status polling timed out"),"timeout"}async function oM(t,e){let r=new Set;if(e==="ios"){let n=(0,Pr.join)(t,"ios/App/Podfile");if((0,fn.existsSync)(n)){let i=(await(0,kr.readFile)(n,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let a of i){let s=a[1];r.add(`node_modules/${s}/Package.swift`),r.add(`node_modules/${s}/*.podspec`),r.add(`node_modules/${s}/ios/`)}}}else if(e==="android"){let n=(0,Pr.join)(t,"android/capacitor.settings.gradle");if((0,fn.existsSync)(n)){let i=(await(0,kr.readFile)(n,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let a of i){let u=a[1].replace(/\/android$/,"");r.add(`node_modules/${u}/android/`)}}}return r}function
|
|
181
|
+
`)}catch(e){f.error(`Failed to list credentials: ${e instanceof Error?e.message:String(e)}`),Xt.default.exit(1)}}async function y1(t){try{let e=await te(),r=t.appId||le(void 0,e?.config);if(r&&t.platform){if(!await h1(r,t.platform)){f.info(`No ${t.platform.toUpperCase()} credentials found for ${r}.`);return}await Xl(r,t.platform),f.success(`\u2705 ${t.platform.toUpperCase()} credentials cleared for ${r}!`)}else if(r){let n=await Is(r);if(!n||!n.ios&&!n.android){f.info(`No credentials found for ${r}.`);return}await Xl(r),f.success(`\u2705 All credentials cleared for ${r}!`)}else{if((await Lg()).length===0){f.info("No saved credentials found.");return}await Xl(),f.success("\u2705 All credentials cleared for all apps!")}f.info(` Location: ~/.capgo-credentials/credentials.json
|
|
182
|
+
`)}catch(e){f.error(`Failed to clear credentials: ${e instanceof Error?e.message:String(e)}`),Xt.default.exit(1)}}var fn=require("node:fs"),kr=require("node:fs/promises"),b1=require("node:os"),Pr=require("node:path"),jg=ue(require("node:process"));var w1=ue(Jp()),Zl=ue(Zc());async function rM(t,e,r,n,o){if(!o)try{let i=await fetch(`${t}/build/logs/${e}?app_id=${encodeURIComponent(r)}`,{headers:{authorization:n}});if(!i.ok){f.warn("Could not stream logs, continuing...");return}let a=i.body?.getReader();if(!a)return;let s=new TextDecoder;for(;;){let{done:u,value:c}=await a.read();if(u)break;let d=s.decode(c,{stream:!0}).split(`
|
|
183
|
+
`);for(let p of d)if(p.startsWith("data: ")){let h=p.slice(6);h.trim()&&f.error(h)}}}catch(i){o||f.warn(`Log streaming interrupted${i instanceof Error?`: ${i.message}`:""}`)}}async function nM(t,e,r,n,o,i){let s=0;for(;s<120;)try{let u=await fetch(`${t}/build/status?job_id=${encodeURIComponent(e)}&app_id=${encodeURIComponent(r)}&platform=${n}`,{headers:{authorization:o}});if(!u.ok){i||f.warn(`Status check failed: ${u.status}`),await new Promise(l=>setTimeout(l,5e3)),s++;continue}let c=await u.json();if(c.status==="succeeded"||c.status==="failed")return c.status;await new Promise(l=>setTimeout(l,5e3)),s++}catch(u){i||f.warn(`Status check error: ${u}`),await new Promise(c=>setTimeout(c,5e3)),s++}return i||f.warn("Build status polling timed out"),"timeout"}async function oM(t,e){let r=new Set;if(e==="ios"){let n=(0,Pr.join)(t,"ios/App/Podfile");if((0,fn.existsSync)(n)){let i=(await(0,kr.readFile)(n,"utf-8")).matchAll(/pod\s+['"][^'"]+['"],\s*:path\s*=>\s*['"]\.\.\/\.\.\/node_modules\/([^'"]+)['"]/g);for(let a of i){let s=a[1];r.add(`node_modules/${s}/Package.swift`),r.add(`node_modules/${s}/*.podspec`),r.add(`node_modules/${s}/ios/`)}}}else if(e==="android"){let n=(0,Pr.join)(t,"android/capacitor.settings.gradle");if((0,fn.existsSync)(n)){let i=(await(0,kr.readFile)(n,"utf-8")).matchAll(/new\s+File\s*\(\s*['"]\.\.\/node_modules\/([^'"]+)['"]\s*\)/g);for(let a of i){let u=a[1].replace(/\/android$/,"");r.add(`node_modules/${u}/android/`)}}}return r}function D1(t,e,r){let n=t.replace(/\\/g,"/");if(n.startsWith(`${e}/`)||n==="package.json"||n==="package-lock.json"||n.startsWith("capacitor.config.")||n.startsWith("resources/")||e==="ios"&&n.startsWith("node_modules/@capacitor/ios/")||e==="android"&&n.startsWith("node_modules/@capacitor/android/"))return!0;for(let o of r)if(n.startsWith(o))return!0;return!1}function Ts(t,e,r,n,o){let i=(0,fn.readdirSync)(e);for(let a of i){let s=(0,Pr.join)(e,a),u=r?`${r}/${a}`:a,c=(0,fn.statSync)(s);if(c.isDirectory()){if(a===".git"||a==="dist"||a==="build"||a===".angular"||a===".vite")continue;if(a===n){Ts(t,s,u,n,o);continue}if(a==="node_modules"){Ts(t,s,u,n,o);continue}if(a==="resources"){Ts(t,s,u,n,o);continue}let l=u.replace(/\\/g,"/");(D1(u,n,o)||Array.from(o).some(p=>p.startsWith(`${l}/`)))&&Ts(t,s,u,n,o)}else if(c.isFile()){if(a===".DS_Store"||a.endsWith(".log"))continue;D1(u,n,o)&&t.addLocalFile(s,r||void 0)}}}async function iM(t,e,r){let n=await oM(t,r),o=new w1.default;Ts(o,t,"",r,n),await(0,kr.writeFile)(e,o.toBuffer())}async function aM(t,e,r=!1){let n=Date.now();try{e.apikey=e.apikey||ne(r);let o=await te();if(t=t||o?.config.appId,!t)throw new Error("Missing argument, you need to provide a appId, or be in a capacitor project");if(!e.platform)throw new Error("Missing required argument: --platform <ios|android>");if(e.platform!=="ios"&&e.platform!=="android")throw new Error(`Invalid platform "${e.platform}". Must be "ios" or "android"`);let i=(0,Pr.resolve)(e.path||jg.default.cwd()),a=e.supaHost||"https://api.capgo.app",s=await re(e.apikey,e.supaHost,e.supaAnon);await ie(s,e.apikey,["write","all"]);let u=await bt(s,t);r||(f.info(`Requesting native build for ${t}`),f.info(`Platform: ${e.platform}`),f.info(`Project: ${i}`),f.info(`API host: ${a}`),f.info(`
|
|
184
184
|
\u{1F512} Security: Credentials are never stored on Capgo servers`),f.info(" They are used only during build and deleted after (max 24h)"),f.info(` Builds sent directly to app stores - Capgo keeps nothing
|
|
185
|
-
`));let c={};e.buildCertificateBase64&&(c.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(c.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(c.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(c.P12_PASSWORD=e.p12Password),e.appleKeyId&&(c.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(c.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(c.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(c.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(c.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(c.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(c.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let l=!!e.keystoreKeyPassword,d=!!e.keystoreStorePassword;l&&!d?(c.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!l&&d?(c.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):l&&d&&(c.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(c.PLAY_CONFIG_JSON=e.playConfigJson);let p=await
|
|
186
|
-
`)),await rM(a,y.job_id,t,e.apikey,r);let T=await nM(a,y.job_id,t,e.platform,e.apikey,r);r||(T==="succeeded"?f.success("Build completed successfully!"):T==="failed"?f.error("Build failed"):f.warn(`Build finished with status: ${T}`));let L=((Date.now()-n)/1e3).toFixed(2);return await de(e.apikey,{channel:"native-builder",event:T==="succeeded"?"Build succeeded":"Build failed",icon:T==="succeeded"?"\u2705":"\u274C",user_id:u,tags:{"app-id":t,platform:e.platform,status:T||"unknown",time:L},notify:!1}).catch(),{success:T==="succeeded",jobId:y.job_id,uploadUrl:y.upload_url,status:T||B.status||y.status}}finally{await(0,kr.rm)(C,{recursive:!0,force:!0})}}catch(o){let i=o instanceof Error?o.message:String(o);return r||f.error(i),{success:!1,error:i}}}async function
|
|
187
|
-
${U(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${U(i)}`)}function
|
|
185
|
+
`));let c={};e.buildCertificateBase64&&(c.BUILD_CERTIFICATE_BASE64=e.buildCertificateBase64),e.buildProvisionProfileBase64&&(c.BUILD_PROVISION_PROFILE_BASE64=e.buildProvisionProfileBase64),e.buildProvisionProfileBase64Prod&&(c.BUILD_PROVISION_PROFILE_BASE64_PROD=e.buildProvisionProfileBase64Prod),e.p12Password&&(c.P12_PASSWORD=e.p12Password),e.appleKeyId&&(c.APPLE_KEY_ID=e.appleKeyId),e.appleIssuerId&&(c.APPLE_ISSUER_ID=e.appleIssuerId),e.appleKeyContent&&(c.APPLE_KEY_CONTENT=e.appleKeyContent),e.appleProfileName&&(c.APPLE_PROFILE_NAME=e.appleProfileName),e.appStoreConnectTeamId&&(c.APP_STORE_CONNECT_TEAM_ID=e.appStoreConnectTeamId),e.androidKeystoreFile&&(c.ANDROID_KEYSTORE_FILE=e.androidKeystoreFile),e.keystoreKeyAlias&&(c.KEYSTORE_KEY_ALIAS=e.keystoreKeyAlias);let l=!!e.keystoreKeyPassword,d=!!e.keystoreStorePassword;l&&!d?(c.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreKeyPassword):!l&&d?(c.KEYSTORE_KEY_PASSWORD=e.keystoreStorePassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword):l&&d&&(c.KEYSTORE_KEY_PASSWORD=e.keystoreKeyPassword,c.KEYSTORE_STORE_PASSWORD=e.keystoreStorePassword),e.playConfigJson&&(c.PLAY_CONFIG_JSON=e.playConfigJson);let p=await f1(t,e.platform,Object.keys(c).length>0?c:void 0),h={app_id:t,platform:e.platform};if(!p)throw r||(f.error("\u274C No credentials found for this app and platform"),f.error(""),f.error("You must provide credentials via:"),f.error(" 1. CLI arguments (--apple-key-id, --p12-password, etc.)"),f.error(" 2. Environment variables (APPLE_KEY_ID, P12_PASSWORD, etc.)"),f.error(" 3. Saved credentials file:"),f.error(` npx @capgo/cli build credentials save --appId ${t} --platform ${e.platform}`),f.error(""),f.error("Documentation:"),f.error(" https://capgo.app/docs/cli/cloud-build/credentials/")),new Error("No credentials found. Please provide credentials before building.");let m=[];if(e.platform==="ios"?(p.BUILD_CERTIFICATE_BASE64||m.push("BUILD_CERTIFICATE_BASE64 (or --build-certificate-base64)"),!p.P12_PASSWORD&&!r&&(f.warn("\u26A0\uFE0F P12_PASSWORD not provided - assuming certificate has no password"),f.warn(" If your certificate requires a password, provide it with --p12-password")),p.BUILD_PROVISION_PROFILE_BASE64||m.push("BUILD_PROVISION_PROFILE_BASE64 (or --build-provision-profile-base64)"),p.APPLE_KEY_ID||m.push("APPLE_KEY_ID (or --apple-key-id)"),p.APPLE_ISSUER_ID||m.push("APPLE_ISSUER_ID (or --apple-issuer-id)"),p.APPLE_KEY_CONTENT||m.push("APPLE_KEY_CONTENT (or --apple-key-content)"),p.APP_STORE_CONNECT_TEAM_ID||m.push("APP_STORE_CONNECT_TEAM_ID (or --apple-team-id)")):e.platform==="android"&&(p.ANDROID_KEYSTORE_FILE||m.push("ANDROID_KEYSTORE_FILE (or --android-keystore-file)"),p.KEYSTORE_KEY_ALIAS||m.push("KEYSTORE_KEY_ALIAS (or --keystore-key-alias)"),!p.KEYSTORE_KEY_PASSWORD&&!p.KEYSTORE_STORE_PASSWORD&&m.push("KEYSTORE_KEY_PASSWORD or KEYSTORE_STORE_PASSWORD (at least one password required)"),!p.PLAY_CONFIG_JSON&&!r&&f.warn("\u26A0\uFE0F PLAY_CONFIG_JSON not provided - build will succeed but cannot auto-upload to Play Store")),m.length>0){if(!r){f.error(`\u274C Missing required credentials for ${e.platform}:`),f.error("");for(let g of m)f.error(` \u2022 ${g}`);f.error(""),f.error("Provide credentials via:"),f.error(' 1. CLI arguments: npx @capgo/cli build request --platform ios --apple-id "..." --p12-password "..."'),f.error(' 2. Environment variables: export APPLE_ID="..." P12_PASSWORD="..."'),f.error(" 3. Saved credentials: npx @capgo/cli build credentials save --platform ios ..."),f.error(""),f.error("Documentation:"),f.error(` https://capgo.app/docs/cli/cloud-build/${e.platform}/`)}throw new Error(`Missing required credentials for ${e.platform}: ${m.join(", ")}`)}h.credentials=p,r||f.info("\u2713 Using credentials (merged from CLI args, env vars, and saved file)"),r||f.info("Requesting build from Capgo...");let b=await fetch(`${a}/build/request`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify(h)});if(!b.ok){let g=await b.text();throw new Error(`Failed to request build: ${b.status} - ${g}`)}let y=await b.json();r||(f.success(`Build job created: ${y.job_id}`),f.info(`Status: ${y.status}`),f.info(`Upload URL: ${y.upload_url}`),f.info(`Upload expires: ${y.upload_expires_at}`)),await de(e.apikey,{channel:"native-builder",event:"Build requested",icon:"\u{1F3D7}\uFE0F",user_id:u,tags:{"app-id":t,platform:e.platform},notify:!1}).catch();let C=(0,Pr.join)((0,b1.tmpdir)(),`capgo-build-${Date.now()}`);await(0,kr.mkdir)(C,{recursive:!0});let E=(0,Pr.join)(C,`${(0,Pr.basename)(i)}.zip`);try{r||f.info(`Zipping ${e.platform} project from ${i}...`),await iM(i,E,e.platform);let _=((await(0,kr.stat)(E)).size/1024/1024).toFixed(2);r||f.success(`Created zip: ${E} (${_} MB)`),r||(f.info("Uploading to builder with TUS protocol..."),f.info(`Upload endpoint: ${y.upload_url}`),f.info(`File size: ${_} MB`),f.info(`Job ID: ${y.job_id}`));let x=(0,fn.readFileSync)(E),$=De();r||$.start("Uploading bundle"),await new Promise((A,j)=>{let M=new Zl.Upload(x,{endpoint:y.upload_url,chunkSize:5242880,metadata:{filename:(0,Pr.basename)(E),filetype:"application/zip"},headers:{authorization:e.apikey},onBeforeRequest(J){if(!r){f.info(`[TUS] ${J.getMethod()} ${J.getURL()}`);let k=J.getHeader("authorization");f.info(`[TUS] Authorization header present: ${!!k}`)}},onAfterResponse(J,k){if(!r){f.info(`[TUS] Response status: ${k.getStatus()}`);let D=k.getHeader("upload-offset"),w=k.getHeader("tus-resumable");f.info(`[TUS] Upload-Offset: ${D}, Tus-Resumable: ${w}`)}},onError(J){if(r||($.stop("Upload failed"),f.error(`[TUS] Upload error: ${J.message}`)),J instanceof Zl.DetailedError){let k=J.originalResponse?.getBody(),D=J.originalResponse?.getStatus(),w=J.originalRequest?.getURL();r||(f.error(`[TUS] Request URL: ${w}`),f.error(`[TUS] Response status: ${D}`),f.error(`[TUS] Response body: ${k}`));let v="Unknown error";try{let O=JSON.parse(k||'{"error": "unknown error"}');v=O.status||O.error||O.message||"unknown error"}catch{v=k||J.message}j(new Error(`TUS upload failed: ${v}`))}else j(new Error(`TUS upload failed: ${J.message||J.toString()}`))},onProgress(J,k){let D=(J/k*100).toFixed(2);r||$.message(`Uploading ${D}%`)},onSuccess(){r||($.stop("Upload complete!"),f.success("TUS upload completed successfully")),A()}});r||f.info("[TUS] Starting upload..."),M.start()}),r||f.info("Starting build job...");let F=await fetch(`${a}/build/start/${y.job_id}`,{method:"POST",headers:{"Content-Type":"application/json",authorization:e.apikey},body:JSON.stringify({app_id:t})});if(!F.ok){let A=await F.text();throw new Error(`Failed to start build: ${F.status} - ${A}`)}let B=await F.json();r||(f.success("Build started successfully!"),f.info(`Job ID: ${y.job_id}`),f.info(`Streaming build logs...
|
|
186
|
+
`)),await rM(a,y.job_id,t,e.apikey,r);let T=await nM(a,y.job_id,t,e.platform,e.apikey,r);r||(T==="succeeded"?f.success("Build completed successfully!"):T==="failed"?f.error("Build failed"):f.warn(`Build finished with status: ${T}`));let L=((Date.now()-n)/1e3).toFixed(2);return await de(e.apikey,{channel:"native-builder",event:T==="succeeded"?"Build succeeded":"Build failed",icon:T==="succeeded"?"\u2705":"\u274C",user_id:u,tags:{"app-id":t,platform:e.platform,status:T||"unknown",time:L},notify:!1}).catch(),{success:T==="succeeded",jobId:y.job_id,uploadUrl:y.upload_url,status:T||B.status||y.status}}finally{await(0,kr.rm)(C,{recursive:!0,force:!0})}}catch(o){let i=o instanceof Error?o.message:String(o);return r||f.error(i),{success:!1,error:i}}}async function v1(t,e){(await aM(t,e,!1)).success||jg.default.exit(1)}async function C1(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,{data:a,error:s}=await t.from("channels").select().eq("app_id",e).eq("version",r.id);if(s)throw o||f.error(`Cannot check Version ${e}@${r.name}: ${U(s)}`),new Error(`Cannot check version ${e}@${r.name}: ${U(s)}`);if(!a?.length)return;if(o)throw new Error(`Version ${e}@${r.name} is used in ${a.length} channel(s)`);ee(`\u274C Version ${e}@${r.name} is used in ${a.length} channel${a.length>1?"s":""}`);let u=i;if(i||(u=await ve({message:"unlink it?"})===!0),!u)throw f.error("Unlink it first"),new Error(`Version ${e}@${r.name} is still linked to channel(s)`);for(let c of a){let l=De();l.start(`Unlinking channel ${c.name}`);let d=await Ug(t,e,{silent:o});if(!d)throw l.stop(`Cannot find unknown version for ${e}`),new Error(`Cannot find unknown version for ${e}`);let{error:p}=await t.from("channels").update({version:d.id}).eq("id",c.id);if(p)throw l.stop(`Cannot update channel ${c.name} ${U(p)}`),new Error(`Cannot update channel ${c.name}: ${U(p)}`);l.stop(`\u2705 Channel ${c.name} unlinked`)}Z(`Version unlinked from ${a.length} channel${a.length>1?"s":""}`)}async function Ug(t,e,r={}){let{silent:n=!1}=r,o=[3e3,7e3],i;for(let a=0;a<=2;a++){let{data:s,error:u}=await t.from("app_versions").select("id").eq("app_id",e).eq("name","unknown").single();if(!u)return s;i=u,a<2&&await new Promise(c=>setTimeout(c,o[a]))}throw n||f.error(`Cannot call findUnknownVersion as it returned an error.
|
|
187
|
+
${U(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${U(i)}`)}function E1(t,e){return t.from("channels").insert(e).select().single()}function _1(t,e,r,n){return t.from("channels").delete().eq("name",e).eq("app_id",r).single()}function S1(t,e,r){return t.from("channels").select().eq("app_id",e).eq("name",r).single()}function x1(t,e,r){return t.from("channel_devices").delete().eq("app_id",e).eq("channel_id",r)}function A1(t,e,r){return t.from("channels").select(`
|
|
188
188
|
id,
|
|
189
189
|
version (id, name)
|
|
190
|
-
`).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function
|
|
190
|
+
`).eq("app_id",e).eq("name",r).single().throwOnError().then(({data:n})=>n?.version)}function O1(t,e=!1){if(e)return;let r=new at;r.theme=at.roundTheme,r.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"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,n.version?.name,n.public?"\u2705":"\u274C",n.ios?"\u2705":"\u274C",n.android?"\u2705":"\u274C",n.disable_auto_update,n.disable_auto_update_under_native?"\u274C":"\u2705",n.allow_device_self_set?"\u2705":"\u274C",n.allow_emulator?"\u2705":"\u274C",n.allow_dev?"\u2705":"\u274C"]);f.success("Channels"),f.success(r.toString())}async function F1(t,e,r=!1){let{data:n,error:o}=await t.from("channels").select(`
|
|
191
191
|
id,
|
|
192
192
|
name,
|
|
193
193
|
public,
|
|
@@ -202,16 +202,16 @@ ${U(i)}`),new Error(`Cannot retrieve unknown version for app ${e}: ${U(i)}`)}fun
|
|
|
202
202
|
created_by,
|
|
203
203
|
app_id,
|
|
204
204
|
version (id, name)
|
|
205
|
-
`).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||f.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${U(o)}`);return n}async function Mg(t,e,r,n={}){let{silent:o=!1}=n,{error:i}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(i){let a=`App version ${e}@${r} not found in database`;throw o||f.error(a),new Error(`${a}: ${U(i)}`)}}async function Ql(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await sM(t,e,r,{silent:o});await CO(t,e,a,{silent:o,autoUnlink:i}),await Mg(t,e,r,{silent:o})}function ef(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new at;r.theme=at.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,sa(n.created_at),n.keep??""]);f.success("Bundles"),f.success(r.toString())}async function tf(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(i){let a=`App ${e} not found in database`;throw n||f.error(a),new Error(`${a}: ${U(i)}`)}return o??[]}async function kO(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("channels").select("version").eq("app_id",e);if(i){let a=`App ${e} not found in database`;throw n||f.error(a),new Error(`${a}: ${U(i)}`)}return(o??[]).map(a=>a.version)}async function sM(t,e,r,n={}){let{silent:o=!1}=n,{data:i,error:a}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!i||a){let s=`App version ${e}@${r} doesn't exist`;throw o||f.error(s),new Error(`${s}${a?`: ${U(a)}`:""}`)}return i}async function uM(t,e,r,n){for await(let o of t)n||f.warn(`Removing ${o.name} created on ${sa(o.created_at)}`),await Ql(e,r,o.name)}function cM(t,e,r){let n=[];for(let o of t??[]){let i=xe(o.name);hd(i,e)&&Cr(i,r)&&n.push(o)}return n}async function lM(t,e,r=!1){r||ee("Cleanup versions in Capgo"),await ge(),e.apikey=e.apikey||ne();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=le(t,s?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await re(e.apikey,e.supaHost,e.supaAnon);await ie(u,e.apikey,["write","all"]),await Me(u,e.apikey,t,3,r),r||f.info("Querying all available versions in Capgo");let c=await tf(u,t),l=await kO(u,t);if(r||f.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||f.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let h=xe(n),m=Oa(h,"major");r||f.info(`Querying available versions in Capgo between ${vr(h)} and ${vr(m)}`),c=cM(c,h,m),r||f.info(`Active versions in Capgo between ${vr(h)} and ${vr(m)}: ${c?.length??0}`)}let d=[],p=0;for(let h of c){let m=l.find(b=>b===h.id);p<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",p+=1):(h.keep="\u274C",d.push(h))}if(!d.length)return r||f.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:p};if(r||ef(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await ve({message:"Do you want to continue removing the versions specified?"});if(we(h)||!h)throw f.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||f.success("You have confirmed removal, removing versions now"),await uM(d,u,t,r),r||Z("Done \u2705"),{removed:d.length,kept:p}}async function PO(t,e){return lM(t,e)}async function fM(t,e,r=!1){r||ee("Check compatibility");let n={...e,apikey:e.apikey||ne()},o=await te(),i=le(t,o?.config),a=n.channel;if(!a)throw r||f.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||f.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let s=await re(n.apikey,n.supaHost,n.supaAnon);await ie(s,n.apikey,["write","all","read","upload"]),await Me(s,n.apikey,i,1,r);let u=await Kl(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new at;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=at.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",d=n.text?"No":"\u274C";for(let p of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:b}=p,y=$o(p)?l:d;c.rows.push([h,m,b,y])}f.success("Compatibility"),f.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function $O(t,e){try{await fM(t,e,!1)}catch(r){throw f.error(`Error checking compatibility ${U(r)}`),r}}var hn=require("node:fs");var dn=require("node:buffer"),pt=require("node:crypto"),TO="aes-128-cbc",pn="base64",IO="hex",Rs=pt.constants.RSA_PKCS1_PADDING;function rf(t){let e=(0,pt.randomBytes)(16),r=(0,pt.randomBytes)(16),n=e.toString(pn),o=(0,pt.privateEncrypt)({key:t,padding:Rs},r).toString(pn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function fa(t,e,r){let[n]=r.split(":"),o=dn.Buffer.from(n,pn),i=(0,pt.createCipheriv)(TO,e,o);return i.setAutoPadding(!0),dn.Buffer.concat([i.update(t),i.final()])}function RO(t,e,r){let[n,o]=e.split(":"),i=(0,pt.publicDecrypt)({key:r,padding:Rs},dn.Buffer.from(o,pn)),a=dn.Buffer.from(n,pn),s=(0,pt.createDecipheriv)(TO,i,a);return s.setAutoPadding(!0),dn.Buffer.concat([s.update(t),s.final()])}function da(t,e){return(0,pt.privateEncrypt)({key:e,padding:Rs},dn.Buffer.from(t,pn)).toString(pn)}function nf(t,e){return(0,pt.privateEncrypt)({key:e,padding:Rs},dn.Buffer.from(t,IO)).toString(IO)}function BO(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,pt.generateKeyPairSync)("rsa",{modulusLength:e});return t==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:n.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:n.export({type:"pkcs1",format:"pem"}).toString("base64")}}function NO(t,e){return(0,pt.publicDecrypt)({key:e,padding:Rs},dn.Buffer.from(t,pn)).toString(pn)}function dM(t,e){let r=t.key||ln,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,hn.existsSync)(r)?n=(0,hn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function pM(t,e,r,n=!1){n||ee("Decrypt zip file");try{if(await ge(),!(0,hn.existsSync)(t)){let d=`Zip not found at the path ${t}`;throw n||f.error(d),new Error(d)}let o=await te();if(!r.key&&!(0,hn.existsSync)(ln)&&!o.config.plugins?.CapacitorUpdater?.publicKey){let d=`Public Key not found at the path ${ln} or in ${o.path}`;throw n||f.error(d),new Error(d)}let{publicKey:i,fallbackKeyPath:a}=dM(r,o);if(!i){let d=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||f.error(d),new Error(d)}let s=(0,hn.readFileSync)(t),u=RO(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,hn.writeFileSync)(c,u),n||f.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let d=await on(u,"sha256"),p=NO(r.checksum,r.keyData??i);if(l=d===p,!l){let h=`Checksum does not match ${d} !== ${p}`;throw n||f.error(h),new Error(h)}n||f.info("Checksum matches")}return n||Z("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(o){throw n||f.error(`Error decrypting zip file ${U(o)}`),o instanceof Error?o:new Error(String(o))}}async function LO(t,e,r){await pM(t,e,r,!1)}async function hM(t,e,r,n=!1){n||ee("Delete bundle"),r.apikey=r.apikey||ne();let o=await te();if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||f.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let i=await re(r.apikey,r.supaHost,r.supaAnon);return await ie(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,3,n),n||(f.info(`Deleting bundle ${e}@${t} from Capgo`),f.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Ql(i,e,t),n||(f.success(`Bundle ${e}@${t} deleted in Capgo`),Z("Done")),!0}async function jO(t,e,r){return hM(t,e,r)}var mn=require("node:fs");function Bs(t){console.error(U(t))}async function mM(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(ee("Encryption"),await ge());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&f.warning("There is still a privateKey in the config"),!(0,mn.existsSync)(t)){let C=`Zip not found at the path ${t}`;throw n||(o?Bs({error:"zip_not_found"}):f.error(`Error: ${C}`)),new Error(C)}if(!u)throw n||(o?Bs({error:"missing_public_key"}):f.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Jt,l=r.keyData||"";if(!(0,mn.existsSync)(c)&&!l)throw n||(o?Bs({error:"missing_key"}):(f.warning(`Cannot find a private key at ${c} or as a keyData option`),f.error("Error: Missing key"))),new Error("Missing private key");if((0,mn.existsSync)(c)&&(l=(0,mn.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?Bs({error:"invalid_private_key"}):f.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let d=(0,mn.readFileSync)(t),{sessionKey:p,ivSessionKey:h}=rf(l),m=fa(d,p,h),b=da(e,l),y=`${t}_encrypted.zip`;return(0,mn.writeFileSync)(y,m),n||(o?console.log(JSON.stringify({checksum:b,filename:y,ivSessionKey:h},null,2)):(f.success(`Encoded Checksum: ${b}`),f.success(`ivSessionKey: ${h}`),f.success(`Encrypted zip saved at ${y}`),Z("Done \u2705"))),{checksum:b,filename:y,ivSessionKey:h}}catch(a){throw n||(r.json?Bs(a):f.error(`Error encrypting zip file ${U(a)}`)),a instanceof Error?a:new Error(String(a))}}async function UO(t,e,r){await mM(t,e,r,!1)}async function MO(t,e,r=!1){r||ee("List bundles"),await ge(),e.apikey=e.apikey||ne();let n=await te();if(t=le(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon);await ie(o,e.apikey,["write","all","read","upload"]),await Me(o,e.apikey,t,1,r),r||f.info(`Querying available versions of: ${t} in Capgo`);let i=await tf(o,t);return r||(f.info(`Active versions in Capgo: ${i?.length??0}`),ef(i),Z("Done \u2705")),i}var pF=require("node:crypto"),Vo=require("node:fs"),bf=require("node:process");var of=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(o,i){let a=0;for(;a<o.length;){let s=e-n,u=Math.min(s,o.length-a);r.set(o.subarray(a,a+u),n),a+=u,n+=u,n===e&&(i.enqueue(r),r=new Uint8Array(e),n=0)}},flush(o){n>0&&o.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function Un(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let p={attributes:{}};for(;!(c()||l("?>"));){let h=i();if(!h)return p;p.attributes[h.name]=h.value}return u(/\?>\s*/),p}function n(){let d=u(/^<([\w-:.]+)\s*/);if(!d)return;let p={name:d[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=i();if(!m)return p;p.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return p;u(/\??>\s*/),p.content=o();let h;for(;h=n();)p.children.push(h);return u(/^<\/[\w-:.]+>\s*/),p}function o(){let d=u(/^([^<]*)/);return d?s(d[1]):""}function i(){let d=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(d)return{name:d[1],value:s(a(d[2]))}}function a(d){return d.replace(/^['"]|['"]$/g,"")}function s(d){return d.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function u(d){let p=t.match(d);if(p)return t=t.slice(p[0].length),p}function c(){return t.length===0}function l(d){return t.startsWith(d)}}var Hr=class extends Error{};var Ct=class extends Hr{},Ns=class extends Hr{},af=class extends Hr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Vr=class extends Hr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Mn=class extends Hr{constructor(){super("accessKey is required")}},pa=class extends Hr{constructor(){super("secretKey is required")}},Ls=class extends Hr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},gn=class extends Hr{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,o={}){super(n),this.statusCode=e,this.code=r,this.key=o.key,this.bucketName=o.bucketName,this.resource=o.resource,this.region=o.region}};async function qO(t){try{let r=Un(await t.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let n=r.children.find(c=>c.name==="Code")?.content??"UnknownErrorCode",o=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",i=r.children.find(c=>c.name==="Key")?.content,a=r.children.find(c=>c.name==="BucketName")?.content,s=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new gn(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new gn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function HO(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function VO(t){return typeof t!="string"||t.length<3||t.length>63||t.includes("..")||t.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!t.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function qn(t){return!(!gM(t)||t.length===0)}function gM(t){return!(typeof t!="string"||t.length>1024)}function js(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function Bo(t=""){let e={'"':"",""":"",""":"",""":"",""":""};return t.replace(/^("|"|")|("|"|")$/g,r=>e[r])}function Hg(t){return t.get("x-amz-version-id")??null}function No(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function Vg(t){return No(t).slice(0,8)}function zg(t,e){return`${Vg(e)}/${t}/s3/aws4_request`}async function sf(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),js(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var yM=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],uf=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],l,d=[];super({start(){},async write(p,h){let b=s++;try{if(b==1&&p.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(p.length)}),bucketName:r,objectName:n,payload:p});a={etag:Bo(E.headers.get("etag")??void 0),versionId:Hg(E.headers)};return}b===1&&(u=(await DM({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let y={"Content-Length":String(p.length)};for(let E of yM){let g=i[E];g&&(y[E]=g)}let C=e.makeRequest({method:"PUT",query:{partNumber:b.toString(),uploadId:u},headers:new Headers(y),bucketName:r,objectName:n,payload:p}).then(E=>{let g=E.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:b,etag:g}),E});d.push(C.catch(E=>{l||(l=E)}))}catch(y){throw y}},async close(){if(!a)if(u){if(await Promise.all(d),l)throw l;c.sort((p,h)=>p.part>h.part?1:-1),a=await bM({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(a===void 0)throw new Error("Result is not ready. await the stream first.");return a}}};async function DM(t){let e="POST",r=new Headers(t.metadata),i=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),a=Un(i).root;if(!a||a.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${i}`);let s=a.children.find(u=>u.name==="UploadId")?.content;if(!s)throw new Error(`Unable to get UploadId from response: ${i}`);return{uploadId:s}}async function bM({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
|
|
205
|
+
`).eq("app_id",e).order("created_at",{ascending:!1});if(o)throw r||f.error(`App ${e} not found in database`),new Error(`App ${e} not found in database: ${U(o)}`);return n}async function Mg(t,e,r,n={}){let{silent:o=!1}=n,{error:i}=await t.from("app_versions").update({deleted:!0}).eq("app_id",e).eq("deleted",!1).eq("name",r);if(i){let a=`App version ${e}@${r} not found in database`;throw o||f.error(a),new Error(`${a}: ${U(i)}`)}}async function Ql(t,e,r,n={}){let{silent:o=!1,autoUnlink:i=!1}=n,a=await sM(t,e,r,{silent:o});await C1(t,e,a,{silent:o,autoUnlink:i}),await Mg(t,e,r,{silent:o})}function ef(t,e=!1){if(e)return;if(!t.length)throw new Error("No bundle found");let r=new at;r.theme=at.roundTheme,r.headers=["Version","Created","Keep"],r.rows=[];for(let n of t.toReversed())r.rows.push([n.name,sa(n.created_at),n.keep??""]);f.success("Bundles"),f.success(r.toString())}async function tf(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("app_versions").select().eq("app_id",e).eq("deleted",!1).order("created_at",{ascending:!1});if(i){let a=`App ${e} not found in database`;throw n||f.error(a),new Error(`${a}: ${U(i)}`)}return o??[]}async function k1(t,e,r={}){let{silent:n=!1}=r,{data:o,error:i}=await t.from("channels").select("version").eq("app_id",e);if(i){let a=`App ${e} not found in database`;throw n||f.error(a),new Error(`${a}: ${U(i)}`)}return(o??[]).map(a=>a.version)}async function sM(t,e,r,n={}){let{silent:o=!1}=n,{data:i,error:a}=await t.from("app_versions").select().eq("app_id",e).eq("name",r).eq("deleted",!1).single();if(!i||a){let s=`App version ${e}@${r} doesn't exist`;throw o||f.error(s),new Error(`${s}${a?`: ${U(a)}`:""}`)}return i}async function uM(t,e,r,n){for await(let o of t)n||f.warn(`Removing ${o.name} created on ${sa(o.created_at)}`),await Ql(e,r,o.name)}function cM(t,e,r){let n=[];for(let o of t??[]){let i=xe(o.name);hd(i,e)&&Cr(i,r)&&n.push(o)}return n}async function lM(t,e,r=!1){r||ee("Cleanup versions in Capgo"),await ge(),e.apikey=e.apikey||ne();let{bundle:n,keep:o=4}=e,i=e.force||!1,a=e.ignoreChannel||!1,s=await te();if(t=le(t,s?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to delete your app"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let u=await re(e.apikey,e.supaHost,e.supaAnon);await ie(u,e.apikey,["write","all"]),await Me(u,e.apikey,t,3,r),r||f.info("Querying all available versions in Capgo");let c=await tf(u,t),l=await k1(u,t);if(r||f.info(`Total active versions in Capgo: ${c?.length??0}`),!c?.length)throw r||f.error("No versions found, aborting cleanup"),new Error("No versions found");if(n){let h=xe(n),m=Oa(h,"major");r||f.info(`Querying available versions in Capgo between ${vr(h)} and ${vr(m)}`),c=cM(c,h,m),r||f.info(`Active versions in Capgo between ${vr(h)} and ${vr(m)}: ${c?.length??0}`)}let d=[],p=0;for(let h of c){let m=l.find(b=>b===h.id);p<o||m&&!a?(h.keep=m?"\u2705 (Linked to channel)":"\u2705",p+=1):(h.keep="\u274C",d.push(h))}if(!d.length)return r||f.warn("Nothing to be removed, aborting removal..."),{removed:0,kept:p};if(r||ef(c),!i){if(r)throw new Error("Cleanup requires force=true in SDK mode to prevent accidental deletions");{let h=await ve({message:"Do you want to continue removing the versions specified?"});if(we(h)||!h)throw f.warn("Not confirmed, aborting removal..."),new Error("Cleanup cancelled by user")}}return r||f.success("You have confirmed removal, removing versions now"),await uM(d,u,t,r),r||Z("Done \u2705"),{removed:d.length,kept:p}}async function P1(t,e){return lM(t,e)}async function fM(t,e,r=!1){r||ee("Check compatibility");let n={...e,apikey:e.apikey||ne()},o=await te(),i=le(t,o?.config),a=n.channel;if(!a)throw r||f.error("Missing argument, you need to provide a channel"),new Error("Missing channel");if(!n.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!i)throw r||f.error("Missing argument, you need to provide an appId, or be in a capacitor project"),new Error("Missing appId");let s=await re(n.apikey,n.supaHost,n.supaAnon);await ie(s,n.apikey,["write","all","read","upload"]),await Me(s,n.apikey,i,1,r);let u=await Kl(s,i,a,n.packageJson,n.nodeModules);if(!r){let c=new at;c.headers=["Package","Local version","Remote version","Compatible"],c.theme=at.roundTheme,c.rows=[];let l=n.text?"Yes":"\u2705",d=n.text?"No":"\u274C";for(let p of u.finalCompatibility){let{name:h,localVersion:m,remoteVersion:b}=p,y=$o(p)?l:d;c.rows.push([h,m,b,y])}f.success("Compatibility"),f.success(c.toString())}return{finalCompatibility:u.finalCompatibility}}async function $1(t,e){try{await fM(t,e,!1)}catch(r){throw f.error(`Error checking compatibility ${U(r)}`),r}}var hn=require("node:fs");var dn=require("node:buffer"),pt=require("node:crypto"),T1="aes-128-cbc",pn="base64",I1="hex",Rs=pt.constants.RSA_PKCS1_PADDING;function rf(t){let e=(0,pt.randomBytes)(16),r=(0,pt.randomBytes)(16),n=e.toString(pn),o=(0,pt.privateEncrypt)({key:t,padding:Rs},r).toString(pn);return{sessionKey:r,ivSessionKey:`${n}:${o}`}}function fa(t,e,r){let[n]=r.split(":"),o=dn.Buffer.from(n,pn),i=(0,pt.createCipheriv)(T1,e,o);return i.setAutoPadding(!0),dn.Buffer.concat([i.update(t),i.final()])}function R1(t,e,r){let[n,o]=e.split(":"),i=(0,pt.publicDecrypt)({key:r,padding:Rs},dn.Buffer.from(o,pn)),a=dn.Buffer.from(n,pn),s=(0,pt.createDecipheriv)(T1,i,a);return s.setAutoPadding(!0),dn.Buffer.concat([s.update(t),s.final()])}function da(t,e){return(0,pt.privateEncrypt)({key:e,padding:Rs},dn.Buffer.from(t,pn)).toString(pn)}function nf(t,e){return(0,pt.privateEncrypt)({key:e,padding:Rs},dn.Buffer.from(t,I1)).toString(I1)}function B1(t="pem",e=2048){let{publicKey:r,privateKey:n}=(0,pt.generateKeyPairSync)("rsa",{modulusLength:e});return t==="pem"?{publicKey:r.export({type:"pkcs1",format:"pem"}),privateKey:n.export({type:"pkcs1",format:"pem"})}:{publicKey:r.export({type:"spki",format:"der"}).toString("base64"),privateKey:n.export({type:"pkcs1",format:"pem"}).toString("base64")}}function N1(t,e){return(0,pt.publicDecrypt)({key:e,padding:Rs},dn.Buffer.from(t,pn)).toString(pn)}function dM(t,e){let r=t.key||ln,n=e.config.plugins?.CapacitorUpdater?.publicKey;return(0,hn.existsSync)(r)?n=(0,hn.readFileSync)(r,"utf8"):!n&&t.keyData&&(n=t.keyData),{publicKey:n,fallbackKeyPath:r}}async function pM(t,e,r,n=!1){n||ee("Decrypt zip file");try{if(await ge(),!(0,hn.existsSync)(t)){let d=`Zip not found at the path ${t}`;throw n||f.error(d),new Error(d)}let o=await te();if(!r.key&&!(0,hn.existsSync)(ln)&&!o.config.plugins?.CapacitorUpdater?.publicKey){let d=`Public Key not found at the path ${ln} or in ${o.path}`;throw n||f.error(d),new Error(d)}let{publicKey:i,fallbackKeyPath:a}=dM(r,o);if(!i){let d=`Cannot find public key ${a} or as keyData option or in ${o.path}`;throw n||f.error(d),new Error(d)}let s=(0,hn.readFileSync)(t),u=R1(s,e,r.keyData??i),c=`${t}_decrypted.zip`;(0,hn.writeFileSync)(c,u),n||f.info(`Decrypted zip file at ${c}`);let l;if(r.checksum){let d=await on(u,"sha256"),p=N1(r.checksum,r.keyData??i);if(l=d===p,!l){let h=`Checksum does not match ${d} !== ${p}`;throw n||f.error(h),new Error(h)}n||f.info("Checksum matches")}return n||Z("\u2705 done"),{outputPath:c,checksumMatches:l}}catch(o){throw n||f.error(`Error decrypting zip file ${U(o)}`),o instanceof Error?o:new Error(String(o))}}async function L1(t,e,r){await pM(t,e,r,!1)}async function hM(t,e,r,n=!1){n||ee("Delete bundle"),r.apikey=r.apikey||ne();let o=await te();if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||f.error("Missing argument, you need to provide a bundleId, or be in a capacitor project"),new Error("Missing bundleId");let i=await re(r.apikey,r.supaHost,r.supaAnon);return await ie(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,3,n),n||(f.info(`Deleting bundle ${e}@${t} from Capgo`),f.info("Keep in mind that you will not be able to reuse this bundle version, it's gone forever")),await Ql(i,e,t),n||(f.success(`Bundle ${e}@${t} deleted in Capgo`),Z("Done")),!0}async function j1(t,e,r){return hM(t,e,r)}var mn=require("node:fs");function Bs(t){console.error(U(t))}async function mM(t,e,r,n=!1){let{json:o}=r,i=!o&&!n;i&&(ee("Encryption"),await ge());try{let a=await te(),s=!!a.config.plugins?.CapacitorUpdater?.privateKey,u=!!a.config.plugins?.CapacitorUpdater?.publicKey;if(s&&i&&f.warning("There is still a privateKey in the config"),!(0,mn.existsSync)(t)){let C=`Zip not found at the path ${t}`;throw n||(o?Bs({error:"zip_not_found"}):f.error(`Error: ${C}`)),new Error(C)}if(!u)throw n||(o?Bs({error:"missing_public_key"}):f.warning("Warning: Missing Public Key in config")),new Error("Missing public key in config");let c=r.key||Jt,l=r.keyData||"";if(!(0,mn.existsSync)(c)&&!l)throw n||(o?Bs({error:"missing_key"}):(f.warning(`Cannot find a private key at ${c} or as a keyData option`),f.error("Error: Missing key"))),new Error("Missing private key");if((0,mn.existsSync)(c)&&(l=(0,mn.readFileSync)(c,"utf8")),l&&!l.startsWith("-----BEGIN RSA PRIVATE KEY-----"))throw n||(o?Bs({error:"invalid_private_key"}):f.error("The private key provided is not a valid RSA Private key")),new Error("Invalid private key format");let d=(0,mn.readFileSync)(t),{sessionKey:p,ivSessionKey:h}=rf(l),m=fa(d,p,h),b=da(e,l),y=`${t}_encrypted.zip`;return(0,mn.writeFileSync)(y,m),n||(o?console.log(JSON.stringify({checksum:b,filename:y,ivSessionKey:h},null,2)):(f.success(`Encoded Checksum: ${b}`),f.success(`ivSessionKey: ${h}`),f.success(`Encrypted zip saved at ${y}`),Z("Done \u2705"))),{checksum:b,filename:y,ivSessionKey:h}}catch(a){throw n||(r.json?Bs(a):f.error(`Error encrypting zip file ${U(a)}`)),a instanceof Error?a:new Error(String(a))}}async function U1(t,e,r){await mM(t,e,r,!1)}async function M1(t,e,r=!1){r||ee("List bundles"),await ge(),e.apikey=e.apikey||ne();let n=await te();if(t=le(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appid, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon);await ie(o,e.apikey,["write","all","read","upload"]),await Me(o,e.apikey,t,1,r),r||f.info(`Querying available versions of: ${t} in Capgo`);let i=await tf(o,t);return r||(f.info(`Active versions in Capgo: ${i?.length??0}`),ef(i),Z("Done \u2705")),i}var pF=require("node:crypto"),Vo=require("node:fs"),bf=require("node:process");var of=class extends TransformStream{outChunkSize;constructor(e){let r=new Uint8Array(e),n=0;super({transform(o,i){let a=0;for(;a<o.length;){let s=e-n,u=Math.min(s,o.length-a);r.set(o.subarray(a,a+u),n),a+=u,n+=u,n===e&&(i.enqueue(r),r=new Uint8Array(e),n=0)}},flush(o){n>0&&o.enqueue(r.subarray(0,n))}}),this.outChunkSize=e}};function Un(t){return t=t.trim(),t=t.replace(/<!--[\s\S]*?-->/g,""),e();function e(){return{declaration:r(),root:n()}}function r(){if(!u(/^<\?xml\s*/))return;let p={attributes:{}};for(;!(c()||l("?>"));){let h=i();if(!h)return p;p.attributes[h.name]=h.value}return u(/\?>\s*/),p}function n(){let d=u(/^<([\w-:.]+)\s*/);if(!d)return;let p={name:d[1],attributes:{},children:[]};for(;!(c()||l(">")||l("?>")||l("/>"));){let m=i();if(!m)return p;p.attributes[m.name]=m.value}if(u(/^\s*\/>\s*/))return p;u(/\??>\s*/),p.content=o();let h;for(;h=n();)p.children.push(h);return u(/^<\/[\w-:.]+>\s*/),p}function o(){let d=u(/^([^<]*)/);return d?s(d[1]):""}function i(){let d=u(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(d)return{name:d[1],value:s(a(d[2]))}}function a(d){return d.replace(/^['"]|['"]$/g,"")}function s(d){return d.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}function u(d){let p=t.match(d);if(p)return t=t.slice(p[0].length),p}function c(){return t.length===0}function l(d){return t.startsWith(d)}}var Hr=class extends Error{};var Ct=class extends Hr{},Ns=class extends Hr{},af=class extends Hr{bucketName;constructor(e){super(`Invalid bucket name: ${e}`),this.bucketName=e}},Vr=class extends Hr{objectName;constructor(e){super(`Invalid object name: ${e}`),this.objectName=e}},Mn=class extends Hr{constructor(){super("accessKey is required")}},pa=class extends Hr{constructor(){super("secretKey is required")}},Ls=class extends Hr{constructor(){super("expirySeconds cannot be less than 1 second or more than 7 days")}},gn=class extends Hr{statusCode;code;key;bucketName;resource;region;constructor(e,r,n,o={}){super(n),this.statusCode=e,this.code=r,this.key=o.key,this.bucketName=o.bucketName,this.resource=o.resource,this.region=o.region}};async function q1(t){try{let r=Un(await t.text()).root;if(r?.name!=="Error")throw new Error("Invalid root, expected <Error>");let n=r.children.find(c=>c.name==="Code")?.content??"UnknownErrorCode",o=r.children.find(c=>c.name==="Message")?.content??"The error message could not be determined.",i=r.children.find(c=>c.name==="Key")?.content,a=r.children.find(c=>c.name==="BucketName")?.content,s=r.children.find(c=>c.name==="Resource")?.content,u=r.children.find(c=>c.name==="Region")?.content;return new gn(t.status,n,o,{key:i,bucketName:a,resource:s,region:u})}catch{return new gn(t.status,"UnrecognizedError",`Error: Unexpected response code ${t.status} ${t.statusText}. Unable to parse response as XML.`)}}function H1(t){return typeof t!="number"||isNaN(t)?!1:t>=1&&t<=65535}function V1(t){return typeof t!="string"||t.length<3||t.length>63||t.includes("..")||t.match(/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+/)?!1:!!t.match(/^[a-z0-9][a-z0-9.-]+[a-z0-9]$/)}function qn(t){return!(!gM(t)||t.length===0)}function gM(t){return!(typeof t!="string"||t.length>1024)}function js(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}function Bo(t=""){let e={'"':"",""":"",""":"",""":"",""":""};return t.replace(/^("|"|")|("|"|")$/g,r=>e[r])}function Hg(t){return t.get("x-amz-version-id")??null}function No(t){let e=t.toISOString();return e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19)+"Z"}function Vg(t){return No(t).slice(0,8)}function zg(t,e){return`${Vg(e)}/${t}/s3/aws4_request`}async function sf(t){return t instanceof Uint8Array||(t=new TextEncoder().encode(t)),js(new Uint8Array(await crypto.subtle.digest("SHA-256",t)))}var yM=["x-amz-server-side-encryption-customer-algorithm","x-amz-server-side-encryption-customer-key","x-amz-server-side-encryption-customer-key-MD5"],uf=class extends WritableStream{getResult;constructor({client:e,bucketName:r,objectName:n,partSize:o,metadata:i}){let a,s=1,u,c=[],l,d=[];super({start(){},async write(p,h){let b=s++;try{if(b==1&&p.length<o){let E=await e.makeRequest({method:"PUT",headers:new Headers({...i,"Content-Length":String(p.length)}),bucketName:r,objectName:n,payload:p});a={etag:Bo(E.headers.get("etag")??void 0),versionId:Hg(E.headers)};return}b===1&&(u=(await DM({client:e,bucketName:r,objectName:n,metadata:i})).uploadId);let y={"Content-Length":String(p.length)};for(let E of yM){let g=i[E];g&&(y[E]=g)}let C=e.makeRequest({method:"PUT",query:{partNumber:b.toString(),uploadId:u},headers:new Headers(y),bucketName:r,objectName:n,payload:p}).then(E=>{let g=E.headers.get("etag")??"";return g&&(g=g.replace(/^"/,"").replace(/"$/,"")),c.push({part:b,etag:g}),E});d.push(C.catch(E=>{l||(l=E)}))}catch(y){throw y}},async close(){if(!a)if(u){if(await Promise.all(d),l)throw l;c.sort((p,h)=>p.part>h.part?1:-1),a=await bM({client:e,bucketName:r,objectName:n,uploadId:u,etags:c})}else throw new Error("Stream was closed without uploading any data.")}}),this.getResult=()=>{if(a===void 0)throw new Error("Result is not ready. await the stream first.");return a}}};async function DM(t){let e="POST",r=new Headers(t.metadata),i=await(await t.client.makeRequest({method:e,bucketName:t.bucketName,objectName:t.objectName,query:"uploads",headers:r,returnBody:!0})).text(),a=Un(i).root;if(!a||a.name!=="InitiateMultipartUploadResult")throw new Error(`Unexpected response: ${i}`);let s=a.children.find(u=>u.name==="UploadId")?.content;if(!s)throw new Error(`Unable to get UploadId from response: ${i}`);return{uploadId:s}}async function bM({client:t,bucketName:e,objectName:r,uploadId:n,etags:o}){let i=`
|
|
206
206
|
<CompleteMultipartUpload xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
|
|
207
207
|
${o.map(d=>` <Part><PartNumber>${d.part}</PartNumber><ETag>${d.etag}</ETag></Part>`).join(`
|
|
208
208
|
`)}
|
|
209
209
|
</CompleteMultipartUpload>
|
|
210
|
-
`,a=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(i),returnBody:!0}),s=await a.text(),u=Un(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(d=>d.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let l=Hg(a.headers);return{etag:Bo(c),versionId:l}}var Us="AWS4-HMAC-SHA256";async function
|
|
210
|
+
`,a=await t.makeRequest({method:"POST",bucketName:e,objectName:r,query:`uploadId=${encodeURIComponent(n)}`,payload:new TextEncoder().encode(i),returnBody:!0}),s=await a.text(),u=Un(s).root;if(!u||u.name!=="CompleteMultipartUploadResult")throw new Error(`Unexpected response: ${s}`);let c=u.children.find(d=>d.name==="ETag")?.content;if(!c)throw new Error(`Unable to get ETag from response: ${s}`);let l=Hg(a.headers);return{etag:Bo(c),versionId:l}}var Us="AWS4-HMAC-SHA256";async function z1(t){if(!t.accessKey)throw new Mn;if(!t.secretKey)throw new pa;let e=t.headers.get("x-amz-content-sha256");if(e===null)throw new Error("Internal S3 client error - expected x-amz-content-sha256 header, but it's missing.");let r=G1(t.headers),n=W1(t.method,t.path,t.headers,r,e),o=await Y1(n,t.date,t.region),i=await Gg(t.date,t.region,t.secretKey),a=Wg(t.accessKey,t.region,t.date),s=js(await jo(i,o)).toLowerCase();return`${Us} Credential=${a}, SignedHeaders=${r.join(";").toLowerCase()}, Signature=${s}`}async function K1(t){if(!t.accessKey)throw new Mn;if(!t.secretKey)throw new pa;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Ls;if(!t.headers.has("Host"))throw new Error("Internal error: host header missing");let e=t.path.split("?")[0],r=t.path.split("?")[1],n=No(t.date),o=G1(t.headers),i=Wg(t.accessKey,t.region,t.date),a="UNSIGNED-PAYLOAD",s=new URLSearchParams(r);s.set("X-Amz-Algorithm",Us),s.set("X-Amz-Credential",i),s.set("X-Amz-Date",n),s.set("X-Amz-Expires",t.expirySeconds.toString()),s.set("X-Amz-SignedHeaders",o.join(";").toLowerCase()),t.sessionToken&&s.set("X-Amz-Security-Token",t.sessionToken);let u=s.toString().replace("+","%20"),c=e+"?"+u,l=e.split("/").map(y=>encodeURIComponent(y)).join("/"),d=W1(t.method,c,t.headers,o,a),p=await Y1(d,t.date,t.region),h=await Gg(t.date,t.region,t.secretKey),m=js(await jo(h,p)).toLowerCase();return`${t.protocol}//${t.headers.get("Host")}${l}?${u}&X-Amz-Signature=${m}`}function G1(t){let e=["authorization","content-length","content-type","user-agent"],r=[];for(let n of t.keys())e.includes(n.toLowerCase())||r.push(n);return r.sort(),r}var Lo={A:65,Z:90,a:97,z:122,0:48,9:57,"/":47},wM="-._~".split("").map(t=>t.charCodeAt(0));function Kg(t,e=!1){let r=new TextEncoder().encode(t),n="";for(let o of r)o>=Lo.A&&o<=Lo.Z||o>=Lo.a&&o<=Lo.z||o>=Lo[0]&&o<=Lo[9]||wM.includes(o)||o==Lo["/"]&&e?n+=String.fromCharCode(o):n+="%"+o.toString(16).padStart(2,"0").toUpperCase();return n}function W1(t,e,r,n,o){let i=n.reduce((u,c)=>{let l=`${r.get(c)}`.replace(/ +/g," ");return u.push(`${c.toLowerCase()}:${l}`),u},[]),a=e.split("?")[0],s=e.split("?")[1];return s?s=s.split("&").map(u=>{let[c,l]=u.split("=",2);return Kg(decodeURIComponent(c))+"="+Kg(decodeURIComponent(l||""))}).sort().join("&"):s="",[t.toUpperCase(),Kg(a,!0),s,i.join(`
|
|
211
211
|
`)+`
|
|
212
212
|
`,n.join(";").toLowerCase(),o].join(`
|
|
213
|
-
`)}async function
|
|
214
|
-
`)}async function Gg(t,e,r){let n=Vg(t),o=await jo("AWS4"+r,n),i=await jo(o,e),a=await jo(i,"s3");return await jo(a,"aws4_request")}function Wg(t,e,r){return`${t}/${zg(e,r)}`}async function jo(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"]),o=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(o)}async function JO(t){if(!t.accessKey)throw new Mn;if(!t.secretKey)throw new pa;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Ls;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=Wg(t.accessKey,t.region,t.date),n=No(t.date),o={"X-Amz-Algorithm":Us,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Us},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&i.push(...t.conditions);for(let[h,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(h)||i.push({[h]:m});let a={expiration:e.toISOString(),conditions:i},s=new TextEncoder().encode(JSON.stringify(a)),u=btoa(String.fromCharCode(...s));o.policy=u;let c=u,l=await Gg(t.date,t.region,t.secretKey),d=js(await jo(l,c)).toLowerCase();return o["X-Amz-Signature"]=d,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var vM=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","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"],CM=5*1024*1024,EM=5*1024*1024*1024,Yg=5*1024*1024*1024*1024,Ms=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:o,...i}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||o!==void 0)throw new Ct("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let s=new URL(e);e=s.hostname,r=s.protocol==="https:",n=s.port?parseInt(s.port,10):r?443:80,s.pathname&&s.pathname!=="/"&&(o=s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname)}catch{throw new Ns(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new Ns(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!HO(n))throw new Ct(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new Ct("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new Ct("If specifying temporary access key, session token must also be provided.");let a=r?443:80;if(this.port=n??a,this.host=e.toLowerCase()+(this.port!==a?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=i.accessKey,this.#e=i.secretKey??"",this.sessionToken=i.sessionToken,this.pathStyle=i.pathStyle??!0,this.pathPrefix=o??"",this.defaultBucket=i.bucket,this.region=i.region,this.pathPrefix){if(!this.pathStyle)throw new Ct("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Ct("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Ct("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!VO(r))throw new af(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,o=e.headers??new Headers;o.set("host",n);let i=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,a=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,s=i?`?${i}`:"",u=a+s,c=a.split("/").map(l=>encodeURIComponent(l)).join("/")+s;return{headers:o,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let o=new Date,{headers:i,host:a,path:s,encodedPath:u}=this.buildRequestOptions(n),c=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),i.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await sf(r??new Uint8Array);i.set("x-amz-date",No(o)),i.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await zO({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let d=`${this.protocol}//${a}${u}`,p=await fetch(d,{method:e,headers:i,body:r});if(p.status!==c)throw p.status>=400?await qO(p):p.status===301?new gn(p.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 gn(p.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${p.status} ${p.statusText}).`);return n.returnBody||await p.body?.getReader().read(),p}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!qn(e))throw new Vr(e);let o=r.versionId?{versionId:r.versionId}:{},i=new Headers;r.governanceBypass&&i.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:i,query:o,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof gn&&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,...o}){let i=this.getBucketName(o);if(!qn(e))throw new Vr(e);let a=new Headers(Object.entries(o.metadata??{})),s=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),a.set("Range",c),s=206}let u={...o.responseParams,...o.versionId?{versionId:o.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:i,objectName:e,headers:a,query:u,statusCode:s,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new Mn;if(!qn(r))throw new Vr(r);let{headers:o,path:i}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),a=n.requestDate??new Date,s=n.expirySeconds??1440*60*7;return KO({protocol:this.protocol,headers:o,method:e,path:i,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:a,expirySeconds:s})}presignedGetObject(e,r={}){let{versionId:n,responseParams:o,...i}=r,a={...o,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:a,...i})}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="",o=e.pageSize??1e3;if(o<1||o>1e3)throw new Ct("pageSize must be between 1 and 1,000.");let i=0;for(;;){let a=e.maxResults?Math.min(o,e.maxResults-i):o;if(a===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(a),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=Un(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(h=>h.name==="CommonPrefixes").flatMap(h=>h.children),d=[];for(let h of l)d.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))d.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:Bo(h.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(h.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(h.children.find(m=>m.name==="LastModified")?.content??"invalid")}),i++;d.sort((h,m)=>{let b=h.type==="Object"?h.key:h.prefix,y=m.type==="Object"?m.key:m.prefix;return b>y?1:b<y?-1:0});for(let h of d)yield h;if(c.children.find(h=>h.name==="IsTruncated")?.content==="true"){let h=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!h)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=h}else return}}async putObject(e,r,n){let o=this.getBucketName(n);if(!qn(e))throw new Vr(e);let i,a;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([l]):a=new ReadableStream({start(d){d.enqueue(l),d.close()}}),i=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(l){l.enqueue(r),l.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new Ct("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new Ct(`size was specified (${n.size}) but doesn't match auto-detected size (${i}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Ct(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<CM)throw new Ct("Part size should be greater than 5MB");if(s>EM)throw new Ct("Part size should be less than 6MB");let u=new of(s),c=new uf({client:this,bucketName:o,objectName:e,partSize:s,metadata:n?.metadata??{}});return await a.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=Yg),e>Yg)throw new TypeError(`size should not be more than ${Yg}`);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(!qn(e))throw new Vr(e);let o={};r?.versionId&&(o.versionId=r.versionId);let i=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:o,headers:new Headers(r?.headers)}),a={};for(let s of vM)i.headers.has(s)&&(a[s]=i.headers.get(s));return i.headers.forEach((s,u)=>{u.startsWith("x-amz-meta-")&&(a[u]=i.headers.get(u))}),{type:"Object",key:e,size:parseInt(i.headers.get("content-length")??"",10),metadata:a,lastModified:new Date(i.headers.get("Last-Modified")??"error: missing last modified"),versionId:i.headers.get("x-amz-version-id")||null,etag:Bo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!qn(r))throw new Vr(r);let a=`${i}/${e.sourceKey}`;e.sourceVersionId&&(a+=`?versionId=${e.sourceVersionId}`);let s=new Headers(n?.metadata);n?.metadata!==void 0&&s.set("x-amz-metadata-directive","REPLACE"),s.set("x-amz-copy-source",a);let u=await this.makeRequest({method:"PUT",bucketName:o,objectName:r,headers:s,returnBody:!0}),c=await u.text(),l=Un(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let d=l.children.find(h=>h.name==="ETag")?.content??"",p=l.children.find(h=>h.name==="LastModified")?.content;if(p===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:Bo(d),lastModified:new Date(p),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 gn&&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})}presignedPostObject(e,r={}){if(!qn(e))throw new Vr(e);let n=this.getBucketName(r);if(!n)throw new Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let o=r.requestDate||new Date,i=r.expirySeconds??3600;return JO({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:o,expirySeconds:i,conditions:r.conditions,fields:r.fields})}};var Uo=require("node:fs"),cf=require("node:path");function _M(t,e){return(0,Uo.readFileSync)(t,"utf8").includes(e)}function qs(t,e){let r=(0,Uo.readdirSync)(t);for(let n of r){let o=(0,cf.join)(t,n),i=(0,Uo.statSync)(o);if(i.isDirectory()){if(qs(o,e))return!0}else if(i.isFile()&&(0,cf.extname)(o)===".js"&&_M(o,e))return!0}return!1}function lf(t){return(0,Uo.readdirSync)(t).indexOf("index.html")>-1}var iF=require("node:crypto"),ga=require("node:fs"),aF=require("node:os"),Ho=require("node:path"),sF=require("node:process"),Df=require("node:stream/consumers"),uF=require("node:zlib");var cF=ue(oF()),lF=ue(Zc());async function j9(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var U9=8192;async function M9(t){let e=gt((0,sF.cwd)()),r=await qr("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?xe(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let o=!jn(n,void 0,void 0,$s);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function q9(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:cF.isMatch(t,r)}async function H9(t,e,r){let o=(0,ga.statSync)(t).size,i=await(0,Df.buffer)((0,ga.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(q9(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<U9)return{buffer:i,useBrotli:!1};try{let a=await(0,Df.buffer)((0,ga.createReadStream)(t).pipe((0,uF.createBrotliCompress)({})));return a.length>=o-10?{buffer:i,useBrotli:!1}:{buffer:a,useBrotli:!0}}catch(a){return f.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function fF(t,e,r,n,o,i,a=!1){let s=De();s.start(o!=="v2"?"Generating the update manifest":`Generating the update manifest with ${a?"V3":"V2"} encryption`);let u=await KA(t);if(o==="v2")for(let c of u)c.hash=a?nf(c.hash,i):da(c.hash,i);return s.stop("Manifest generated successfully"),await de(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function V9(t){return(0,aF.platform)()!=="win32"?t:Ho.win32.normalize(t).split(Ho.win32.sep).join(Ho.posix.sep)}function z9(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&f.warn(`File "${t}" contains spaces in its name.`),e}async function dF(t,e,r,n,o,i,a){let s=De();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await cr(),l=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:d,supportsBrotliV2:p}=await M9(a);if(p)a.disableBrotli?f.info("Brotli compression disabled by user request"):a.noBrotliPatterns&&f.info(`Files matching patterns (${a.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${d||"unknown"}). To use Delta updates, please upgrade to version ${VA} (v5), ${zA} (v6) or ${$s} (v7) or higher.`);let h=e.filter(C=>C.file.includes(" "));if(h.length>0)throw new Error(`Files with spaces in their names (${h.map(C=>C.file).join(", ")}). Please rename the files.`);let m=0,b=e.length,y=0;try{s.message(`Uploading ${b} files using TUS protocol`);let C=async $=>{let F=(0,Ho.join)(r,$.file),B=V9($.file),T,L=!1;if(a.disableBrotli)T=await(0,Df.buffer)((0,ga.createReadStream)(F)),L=!1;else{let D=await H9(F,B,a);T=D.buffer,L=D.useBrotli}let A=T;i&&(A=fa(T,i.sessionKey,i.ivSessionKey));let j=B;L&&(j=`${B}.br`,y++);let M=z9(j),J=(0,iF.createHash)("sha256").update($.hash).digest("hex"),k=`orgs/${o}/apps/${n}/delta/${J}_${M}`;return!i&&await j9(c,k)?(m++,Promise.resolve({file_name:M,s3_path:k,file_hash:$.hash})):new Promise((D,w)=>{s.message(`Prepare upload partial file: ${B}`),new lF.Upload(A,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:k},headers:{Authorization:t},onError:O=>{let R=O.toString(),I;try{let P=R.match(/response text: (\{.*?\})/);P&&P[1]&&(I=JSON.parse(P[1]).moreInfo?.requestId)}catch{}let q=I?` [requestId: ${I}]`:"";f.error(`Failed to upload ${B}: ${R}${q}`),w(O)},onProgress(){let O=(m/b*100).toFixed(2);s.message(`Uploading partial update: ${O}%`)},onSuccess(){m++,D({file_name:M,s3_path:k,file_hash:$.hash})}}).start()})},E=500,g=[];for(let $=0;$<e.length;$+=E){let F=e.slice($,$+E),B=Math.floor($/E)+1,T=Math.ceil(e.length/E);T>1&&s.message(`Processing batch ${B}/${T} (${F.length} files)`);let L=await Promise.all(F.map(A=>C(A)));g.push(...L)}let x=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${x} seconds)`),y>0&&f.info(`${y} of ${b} files were compressed with brotli and use .br extension`),await de(t,{channel:"app",event:`App Partial TUS done${y>0?" with .br extension":""}`,icon:"\u23EB",user_id:o,tags:{"app-id":n},notify:!1}),await de(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:x},notify:!1}),g}catch(C){let g=((performance.now()-u)/1e3).toFixed(2);if(s.stop(`Failed to upload Partial bundle (after ${g} seconds)`),l)throw f.error(`Error uploading partial update: ${C}`),f.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),C;return f.info(`Error uploading partial update: ${C}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function be(t){throw f.error(t),new Error(t)}async function K9(t,e){let r=Fr("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,pF.randomUUID)().split("-")[0]}`;return na.test(n)||be(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function G9(t){let e=t.apikey||ne();return e||be("Missing API key, you need to provide an API key to upload your bundle"),e}function W9(t,e,r){let n=le(t,r),o=e.path||r?.webDir;return n||be("Missing argument, you need to provide a appid or be in a capacitor project"),o||be("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Vo.existsSync)(o)||be(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function Y9(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(qs(e,"notifyAppReady")||be(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
|
|
213
|
+
`)}async function Y1(t,e,r){let n=await sf(t),o=zg(r,e);return[Us,No(e),o,n].join(`
|
|
214
|
+
`)}async function Gg(t,e,r){let n=Vg(t),o=await jo("AWS4"+r,n),i=await jo(o,e),a=await jo(i,"s3");return await jo(a,"aws4_request")}function Wg(t,e,r){return`${t}/${zg(e,r)}`}async function jo(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"]),o=await crypto.subtle.sign("HMAC",n,e instanceof Uint8Array?e:r.encode(e));return new Uint8Array(o)}async function J1(t){if(!t.accessKey)throw new Mn;if(!t.secretKey)throw new pa;if(t.expirySeconds<1||t.expirySeconds>604800)throw new Ls;let e=new Date(t.date);e.setSeconds(e.getSeconds()+t.expirySeconds);let r=Wg(t.accessKey,t.region,t.date),n=No(t.date),o={"X-Amz-Algorithm":Us,"X-Amz-Credential":r,"X-Amz-Date":n,key:t.objectKey,...t.fields},i=[{bucket:t.bucket},{key:t.objectKey},{"X-Amz-Algorithm":Us},{"X-Amz-Credential":r},{"X-Amz-Date":n}];t.conditions&&i.push(...t.conditions);for(let[h,m]of Object.entries(t.fields||{}))["key","X-Amz-Algorithm","X-Amz-Credential","X-Amz-Date"].includes(h)||i.push({[h]:m});let a={expiration:e.toISOString(),conditions:i},s=new TextEncoder().encode(JSON.stringify(a)),u=btoa(String.fromCharCode(...s));o.policy=u;let c=u,l=await Gg(t.date,t.region,t.secretKey),d=js(await jo(l,c)).toLowerCase();return o["X-Amz-Signature"]=d,{url:`${t.protocol}//${t.host}/${t.bucket}`,fields:o}}var vM=["Content-Type","Cache-Control","Content-Disposition","Content-Encoding","Content-Language","Expires","x-amz-checksum-sha256","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"],CM=5*1024*1024,EM=5*1024*1024*1024,Yg=5*1024*1024*1024*1024,Ms=class{host;port;protocol;accessKey;#e;sessionToken;defaultBucket;region;userAgent="s3-lite-client";pathStyle;pathPrefix;constructor({endPoint:e,useSSL:r,port:n,pathPrefix:o,...i}){if(/^https?:\/\//i.test(e)){if(r!==void 0||n!==void 0||o!==void 0)throw new Ct("useSSL/port/pathPrefix cannot be specified if endPoint is a URL.");try{let s=new URL(e);e=s.hostname,r=s.protocol==="https:",n=s.port?parseInt(s.port,10):r?443:80,s.pathname&&s.pathname!=="/"&&(o=s.pathname.endsWith("/")?s.pathname.slice(0,-1):s.pathname)}catch{throw new Ns(`Invalid endPoint URL: ${e}`)}}if(typeof e!="string"||e.length===0)throw new Ns(`Invalid endPoint: ${e}`);if(r===void 0&&(r=!0),n!==void 0&&!H1(n))throw new Ct(`Invalid port: ${n}`);if(i.accessKey&&!i.secretKey)throw new Ct("If specifying access key, secret key must also be provided.");if(i.accessKey&&i.accessKey.startsWith("ASIA")&&!i.sessionToken)throw new Ct("If specifying temporary access key, session token must also be provided.");let a=r?443:80;if(this.port=n??a,this.host=e.toLowerCase()+(this.port!==a?`:${this.port}`:""),this.protocol=r?"https:":"http:",this.accessKey=i.accessKey,this.#e=i.secretKey??"",this.sessionToken=i.sessionToken,this.pathStyle=i.pathStyle??!0,this.pathPrefix=o??"",this.defaultBucket=i.bucket,this.region=i.region,this.pathPrefix){if(!this.pathStyle)throw new Ct("pathPrefix is incompatible with pathStyle=false");if(!this.pathPrefix.startsWith("/"))throw new Ct("pathPrefix should start with /");if(this.pathPrefix.endsWith("/"))throw new Ct("pathPrefix should not end with /")}}getBucketName(e){let r=e?.bucketName??this.defaultBucket;if(r===void 0||!V1(r))throw new af(r??"");return r}buildRequestOptions(e){let r=this.getBucketName(e),n=this.pathStyle?this.host:`${r}.${this.host}`,o=e.headers??new Headers;o.set("host",n);let i=typeof e.query=="object"?new URLSearchParams(e.query).toString().replace("+","%20"):e.query,a=this.pathStyle?`${this.pathPrefix}/${r}/${e.objectName}`:`/${e.objectName}`,s=i?`?${i}`:"",u=a+s,c=a.split("/").map(l=>encodeURIComponent(l)).join("/")+s;return{headers:o,host:n,path:u,encodedPath:c}}async makeRequest({method:e,payload:r,...n}){let o=new Date,{headers:i,host:a,path:s,encodedPath:u}=this.buildRequestOptions(n),c=n.statusCode??200;if(e==="POST"||e==="PUT"||e==="DELETE")r===void 0?r=new Uint8Array:typeof r=="string"&&(r=new TextEncoder().encode(r)),i.set("Content-Length",String(r.length));else if(r)throw new Error(`Unexpected payload on ${e} request.`);let l=await sf(r??new Uint8Array);i.set("x-amz-date",No(o)),i.set("x-amz-content-sha256",l),this.accessKey&&(this.sessionToken&&i.set("x-amz-security-token",this.sessionToken),i.set("authorization",await z1({headers:i,method:e,path:s,accessKey:this.accessKey,secretKey:this.#e,region:this.region,date:o})));let d=`${this.protocol}//${a}${u}`,p=await fetch(d,{method:e,headers:i,body:r});if(p.status!==c)throw p.status>=400?await q1(p):p.status===301?new gn(p.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 gn(p.status,"UnexpectedStatusCode",`Unexpected response code from the server (expected ${c}, got ${p.status} ${p.statusText}).`);return n.returnBody||await p.body?.getReader().read(),p}async deleteObject(e,r={}){let n=this.getBucketName(r);if(!qn(e))throw new Vr(e);let o=r.versionId?{versionId:r.versionId}:{},i=new Headers;r.governanceBypass&&i.set("X-Amz-Bypass-Governance-Retention","true"),await this.makeRequest({method:"DELETE",bucketName:n,objectName:e,headers:i,query:o,statusCode:204})}async exists(e,r){try{return await this.statObject(e,r),!0}catch(n){if(n instanceof gn&&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,...o}){let i=this.getBucketName(o);if(!qn(e))throw new Vr(e);let a=new Headers(Object.entries(o.metadata??{})),s=200;if(r||n){let c="";r?c=`bytes=${+r}-`:(c="bytes=0-",r=0),n&&(c+=`${+n+r-1}`),a.set("Range",c),s=206}let u={...o.responseParams,...o.versionId?{versionId:o.versionId}:{}};return await this.makeRequest({method:"GET",bucketName:i,objectName:e,headers:a,query:u,statusCode:s,returnBody:!0})}getPresignedUrl(e,r,n={}){if(!this.accessKey)throw new Mn;if(!qn(r))throw new Vr(r);let{headers:o,path:i}=this.buildRequestOptions({objectName:r,bucketName:n.bucketName,query:n.parameters}),a=n.requestDate??new Date,s=n.expirySeconds??1440*60*7;return K1({protocol:this.protocol,headers:o,method:e,path:i,accessKey:this.accessKey,secretKey:this.#e,sessionToken:this.sessionToken,region:this.region,date:a,expirySeconds:s})}presignedGetObject(e,r={}){let{versionId:n,responseParams:o,...i}=r,a={...o,...n?{versionId:n}:{}};return this.getPresignedUrl("GET",e,{parameters:a,...i})}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="",o=e.pageSize??1e3;if(o<1||o>1e3)throw new Ct("pageSize must be between 1 and 1,000.");let i=0;for(;;){let a=e.maxResults?Math.min(o,e.maxResults-i):o;if(a===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(a),...n?{"continuation-token":n}:{}},returnBody:!0})).text(),c=Un(u).root;if(!c||c.name!=="ListBucketResult")throw new Error(`Unexpected response: ${u}`);let l=c.children.filter(h=>h.name==="CommonPrefixes").flatMap(h=>h.children),d=[];for(let h of l)d.push({type:"CommonPrefix",prefix:h.content??""}),i++;for(let h of c.children.filter(m=>m.name==="Contents"))d.push({type:"Object",key:h.children.find(m=>m.name==="Key")?.content??"",etag:Bo(h.children.find(m=>m.name==="ETag")?.content??""),size:parseInt(h.children.find(m=>m.name==="Size")?.content??"",10),lastModified:new Date(h.children.find(m=>m.name==="LastModified")?.content??"invalid")}),i++;d.sort((h,m)=>{let b=h.type==="Object"?h.key:h.prefix,y=m.type==="Object"?m.key:m.prefix;return b>y?1:b<y?-1:0});for(let h of d)yield h;if(c.children.find(h=>h.name==="IsTruncated")?.content==="true"){let h=c.children.find(m=>m.name==="NextContinuationToken")?.content;if(!h)throw new Error("Unexpectedly missing continuation token, but server said there are more results.");n=h}else return}}async putObject(e,r,n){let o=this.getBucketName(n);if(!qn(e))throw new Vr(e);let i,a;if(typeof r=="string"){let l=new TextEncoder().encode(r);typeof ReadableStream.from<"u"?a=ReadableStream.from([l]):a=new ReadableStream({start(d){d.enqueue(l),d.close()}}),i=l.length}else if(r instanceof Uint8Array)typeof ReadableStream.from<"u"?a=ReadableStream.from([r]):a=new ReadableStream({start(l){l.enqueue(r),l.close()}}),i=r.byteLength;else if(r instanceof ReadableStream)a=r;else throw new Ct("Invalid stream/data type provided.");if(n?.size!==void 0){if(i!==void 0&&n?.size!==i)throw new Ct(`size was specified (${n.size}) but doesn't match auto-detected size (${i}).`);if(typeof n.size!="number"||n.size<0||isNaN(n.size))throw new Ct(`invalid size specified: ${n.size}`);i=n.size}let s=n?.partSize??this.calculatePartSize(i);if(s<CM)throw new Ct("Part size should be greater than 5MB");if(s>EM)throw new Ct("Part size should be less than 6MB");let u=new of(s),c=new uf({client:this,bucketName:o,objectName:e,partSize:s,metadata:n?.metadata??{}});return await a.pipeThrough(u).pipeTo(c),c.getResult()}calculatePartSize(e){if(e===void 0&&(e=Yg),e>Yg)throw new TypeError(`size should not be more than ${Yg}`);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(!qn(e))throw new Vr(e);let o={};r?.versionId&&(o.versionId=r.versionId);let i=await this.makeRequest({method:"HEAD",bucketName:n,objectName:e,query:o,headers:new Headers(r?.headers)}),a={};for(let s of vM)i.headers.has(s)&&(a[s]=i.headers.get(s));return i.headers.forEach((s,u)=>{u.startsWith("x-amz-meta-")&&(a[u]=i.headers.get(u))}),{type:"Object",key:e,size:parseInt(i.headers.get("content-length")??"",10),metadata:a,lastModified:new Date(i.headers.get("Last-Modified")??"error: missing last modified"),versionId:i.headers.get("x-amz-version-id")||null,etag:Bo(i.headers.get("ETag")??"")}}async copyObject(e,r,n){let o=this.getBucketName(n),i=e.sourceBucketName??o;if(!qn(r))throw new Vr(r);let a=`${i}/${e.sourceKey}`;e.sourceVersionId&&(a+=`?versionId=${e.sourceVersionId}`);let s=new Headers(n?.metadata);n?.metadata!==void 0&&s.set("x-amz-metadata-directive","REPLACE"),s.set("x-amz-copy-source",a);let u=await this.makeRequest({method:"PUT",bucketName:o,objectName:r,headers:s,returnBody:!0}),c=await u.text(),l=Un(c).root;if(!l||l.name!=="CopyObjectResult")throw new Error(`Unexpected response: ${c}`);let d=l.children.find(h=>h.name==="ETag")?.content??"",p=l.children.find(h=>h.name==="LastModified")?.content;if(p===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:Bo(d),lastModified:new Date(p),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 gn&&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})}presignedPostObject(e,r={}){if(!qn(e))throw new Vr(e);let n=this.getBucketName(r);if(!n)throw new Error("Bucket name is required for presignedPost, but none was provided either to this method nor to the client constructor");let o=r.requestDate||new Date,i=r.expirySeconds??3600;return J1({protocol:this.protocol,host:this.host,bucket:n,objectKey:e,accessKey:this.accessKey||"",secretKey:this.#e||"",region:this.region,date:o,expirySeconds:i,conditions:r.conditions,fields:r.fields})}};var Uo=require("node:fs"),cf=require("node:path");function _M(t,e){return(0,Uo.readFileSync)(t,"utf8").includes(e)}function qs(t,e){let r=(0,Uo.readdirSync)(t);for(let n of r){let o=(0,cf.join)(t,n),i=(0,Uo.statSync)(o);if(i.isDirectory()){if(qs(o,e))return!0}else if(i.isFile()&&(0,cf.extname)(o)===".js"&&_M(o,e))return!0}return!1}function lf(t){return(0,Uo.readdirSync)(t).indexOf("index.html")>-1}var iF=require("node:crypto"),ga=require("node:fs"),aF=require("node:os"),Ho=require("node:path"),sF=require("node:process"),Df=require("node:stream/consumers"),uF=require("node:zlib");var cF=ue(oF()),lF=ue(Zc());async function j9(t,e){try{return(await fetch(`${t.hostFilesApi}/files/read/attachments/${encodeURIComponent(e)}`,{method:"HEAD"})).ok}catch{return!1}}var U9=8192;async function M9(t){let e=gt((0,sF.cwd)()),r=await qr("@capgo/capacitor-updater",e,t.packageJson),n;try{n=r?xe(r):void 0}catch{n=void 0}if(!r||!n)return{version:null,supportsBrotliV2:!1};let o=!jn(n,void 0,void 0,$s);return{version:`${n.major}.${n.minor}.${n.patch}`,supportsBrotliV2:o}}function q9(t,e){if(!e)return!1;let r=e.split(",").map(n=>n.trim()).filter(n=>!!n);return r.length===0?!1:cF.isMatch(t,r)}async function H9(t,e,r){let o=(0,ga.statSync)(t).size,i=await(0,Df.buffer)((0,ga.createReadStream)(t));if(o===0)return{buffer:i,useBrotli:!1};if(q9(e,r.noBrotliPatterns))return{buffer:i,useBrotli:!1};if(o<U9)return{buffer:i,useBrotli:!1};try{let a=await(0,Df.buffer)((0,ga.createReadStream)(t).pipe((0,uF.createBrotliCompress)({})));return a.length>=o-10?{buffer:i,useBrotli:!1}:{buffer:a,useBrotli:!0}}catch(a){return f.warn(`Brotli compression failed for ${t}: ${a}, using original file`),{buffer:i,useBrotli:!1}}}async function fF(t,e,r,n,o,i,a=!1){let s=De();s.start(o!=="v2"?"Generating the update manifest":`Generating the update manifest with ${a?"V3":"V2"} encryption`);let u=await KA(t);if(o==="v2")for(let c of u)c.hash=a?nf(c.hash,i):da(c.hash,i);return s.stop("Manifest generated successfully"),await de(e,{channel:"partial-update",event:"Generate manifest",icon:"\u{1F4C2}",user_id:r,tags:{"app-id":n},notify:!1}),u}function V9(t){return(0,aF.platform)()!=="win32"?t:Ho.win32.normalize(t).split(Ho.win32.sep).join(Ho.posix.sep)}function z9(t){let e=t.split("/").map(r=>encodeURIComponent(r)).join("/");return t.includes(" ")&&f.warn(`File "${t}" contains spaces in its name.`),e}async function dF(t,e,r,n,o,i,a){let s=De();s.start("Preparing partial update with TUS protocol");let u=performance.now(),c=await cr(),l=!!(a.partial||a.delta||a.partialOnly||a.deltaOnly),{version:d,supportsBrotliV2:p}=await M9(a);if(p)a.disableBrotli?f.info("Brotli compression disabled by user request"):a.noBrotliPatterns&&f.info(`Files matching patterns (${a.noBrotliPatterns}) will be excluded from brotli compression`);else throw new Error(`Your project is using an older version of @capgo/capacitor-updater (${d||"unknown"}). To use Delta updates, please upgrade to version ${VA} (v5), ${zA} (v6) or ${$s} (v7) or higher.`);let h=e.filter(C=>C.file.includes(" "));if(h.length>0)throw new Error(`Files with spaces in their names (${h.map(C=>C.file).join(", ")}). Please rename the files.`);let m=0,b=e.length,y=0;try{s.message(`Uploading ${b} files using TUS protocol`);let C=async $=>{let F=(0,Ho.join)(r,$.file),B=V9($.file),T,L=!1;if(a.disableBrotli)T=await(0,Df.buffer)((0,ga.createReadStream)(F)),L=!1;else{let D=await H9(F,B,a);T=D.buffer,L=D.useBrotli}let A=T;i&&(A=fa(T,i.sessionKey,i.ivSessionKey));let j=B;L&&(j=`${B}.br`,y++);let M=z9(j),J=(0,iF.createHash)("sha256").update($.hash).digest("hex"),k=`orgs/${o}/apps/${n}/delta/${J}_${M}`;return!i&&await j9(c,k)?(m++,Promise.resolve({file_name:M,s3_path:k,file_hash:$.hash})):new Promise((D,w)=>{s.message(`Prepare upload partial file: ${B}`),new lF.Upload(A,{endpoint:`${c.hostFilesApi}/files/upload/attachments/`,chunkSize:a.tusChunkSize,retryDelays:[0,1e3,3e3,5e3,1e4],removeFingerprintOnSuccess:!0,metadata:{filename:k},headers:{Authorization:t},onError:O=>{let R=O.toString(),I;try{let P=R.match(/response text: (\{.*?\})/);P&&P[1]&&(I=JSON.parse(P[1]).moreInfo?.requestId)}catch{}let q=I?` [requestId: ${I}]`:"";f.error(`Failed to upload ${B}: ${R}${q}`),w(O)},onProgress(){let O=(m/b*100).toFixed(2);s.message(`Uploading partial update: ${O}%`)},onSuccess(){m++,D({file_name:M,s3_path:k,file_hash:$.hash})}}).start()})},E=500,g=[];for(let $=0;$<e.length;$+=E){let F=e.slice($,$+E),B=Math.floor($/E)+1,T=Math.ceil(e.length/E);T>1&&s.message(`Processing batch ${B}/${T} (${F.length} files)`);let L=await Promise.all(F.map(A=>C(A)));g.push(...L)}let x=((performance.now()-u)/1e3).toFixed(2);return s.stop(`Partial update uploaded successfully \u{1F4AA} in (${x} seconds)`),y>0&&f.info(`${y} of ${b} files were compressed with brotli and use .br extension`),await de(t,{channel:"app",event:`App Partial TUS done${y>0?" with .br extension":""}`,icon:"\u23EB",user_id:o,tags:{"app-id":n},notify:!1}),await de(t,{channel:"performance",event:"Partial upload performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":n,time:x},notify:!1}),g}catch(C){let g=((performance.now()-u)/1e3).toFixed(2);if(s.stop(`Failed to upload Partial bundle (after ${g} seconds)`),l)throw f.error(`Error uploading partial update: ${C}`),f.error("Delta/partial upload was explicitly requested but failed. Upload aborted."),C;return f.info(`Error uploading partial update: ${C}, This is not a critical error, the bundle has been uploaded without the partial files`),null}}function be(t){throw f.error(t),new Error(t)}async function K9(t,e){let r=Fr("",e.packageJson),n=e.bundle||t?.plugins?.CapacitorUpdater?.version||r||`0.0.1-beta.${(0,pF.randomUUID)().split("-")[0]}`;return na.test(n)||be(`Your bundle name ${n}, is not valid it should follow semver convention : https://semver.org/`),n}function G9(t){let e=t.apikey||ne();return e||be("Missing API key, you need to provide an API key to upload your bundle"),e}function W9(t,e,r){let n=le(t,r),o=e.path||r?.webDir;return n||be("Missing argument, you need to provide a appid or be in a capacitor project"),o||be("Missing argument, you need to provide a path (--path), or be in a capacitor project"),(0,Vo.existsSync)(o)||be(`Path ${o} does not exist, build your app first, or provide a valid path`),{appid:n,path:o}}function Y9(t,e){let r=t.codeCheck;(typeof r>"u"||r)&&(qs(e,"notifyAppReady")||be(`notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready
|
|
215
215
|
If you are sure your app has this code, you can use the --no-code-check option`),lf(e)||be(`index.html is missing in the root folder of ${e}`))}async function J9(t,e,r,n,o,i){let a=r.ignoreMetadataCheck,s=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",o).single(),d=!!c&&c.disable_auto_update==="version_number",p,h;if(!l&&c&&c.version&&c.version.native_packages&&!a){let y=De();y.start(`Checking bundle compatibility with channel ${n}`);let{finalCompatibility:C,localDependencies:E}=await Kl(t,o,n,r.packageJson,r.nodeModules);if(h=C,p=E,h.find(g=>!$o(g)))y.stop(`Bundle NOT compatible with ${n} channel`),f.warn(`You can check compatibility with "${e.runner} @capgo/cli bundle compatibility"`),s&&(u=i,f.info(`Auto set min-update-version to ${u}`));else if(s)try{let{min_update_version:g}=c.version;(!g||!na.test(g))&&be("Invalid remote min update version, skipping auto setting compatibility"),u=g,y.stop(`Auto set min-update-version to ${u}`)}catch{be(`Cannot auto set compatibility, invalid data ${c}`)}else y.stop(`Bundle compatible with ${n} channel`)}else a||(f.warn(`Channel ${n} is new or it's your first upload with compatibility check, it will be ignored this time`),p=await Tg(r.packageJson,r.nodeModules),s&&(u=i,f.info(`Auto set min-update-version to ${u}`)));d&&!u&&!a&&be("You need to provide a min-update-version to upload a bundle to this channel"),u&&(na.test(u)||be(`Your minimal version update ${u}, is not valid it should follow semver convention : https://semver.org/`));let m=p?new Map(p.filter(y=>!!y.native&&y.native!==void 0).map(y=>[y.name,y])):new Map;return{nativePackages:m.size>0||!r.ignoreMetadataCheck?Array.from(m,([y,C])=>({name:y,version:C.version})):void 0,minUpdateVersion:u}}async function X9(t,e,r,n=!1){let{data:o,error:i}=await t.rpc("exist_app_versions",{appid:e,name_version:r}).single();if(o||i){if(n)return f.warn(`Version ${r} already exists - exiting gracefully due to --silent-fail option`),Z("Bundle version already exists - exiting gracefully \u{1F389}"),!0;be(`Version ${r} already exists ${U(i)}`)}return!1}async function Z9(t,e,r,n,o,i,a){let s,u,c="",l=null,d="none",p="",h=e.keyV2,m=e.key===!1,b=De();b.start(`Zipping bundle from ${t}`),l=await Vl(t),b.message("Calculating checksum");let y=gt((0,bf.cwd)()),C=await qr("@capgo/capacitor-updater",y,e.packageJson),E=!1,g;try{g=C?xe(C):void 0}catch{g=void 0}if(C?g?E=!jn(g,$s):(C==="link:@capgo/capacitor-updater"||C==="file:.."||C==="file:../")&&(f.warn("Using local @capgo/capacitor-updater. Assuming latest version for checksum calculation."),E=!0):be("Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager"),(h||e.keyDataV2||(0,Vo.existsSync)(Jt))&&!m||E?c=await on(l,"sha256"):c=await on(l,"crc32"),b.stop(`Checksum ${E?"SHA256":"CRC32"}: ${c}`),m)f.info("Encryption ignored");else if((h||(0,Vo.existsSync)(Jt)||e.keyDataV2)&&!e.oldEncryption){let $=typeof h=="string"?h:Jt,F=e.keyDataV2||"";!F&&!(0,Vo.existsSync)($)&&be(`Cannot find private key ${$}`),await de(r,{channel:"app",event:"App encryption v2",icon:"\u{1F511}",user_id:n,tags:{"app-id":o},notify:!1},e.verbose),F||(F=(0,Vo.readFileSync)($).toString());let B=g&&!jn(g,"5.30.0","6.30.0","7.30.0");f.info(`Encrypting your bundle with ${B?"V3":"V2"}`);let{sessionKey:T,ivSessionKey:L}=rf(F),A=fa(l,T,L);c=B?nf(c,F):da(c,F),s=L,u=T,d="v2",p=F,e.displayIvSession&&f.info(`Your Iv Session key is ${s},
|
|
216
216
|
keep it safe, you will need it to decrypt your bundle.
|
|
217
217
|
It will be also visible in your dashboard
|
|
@@ -222,8 +222,8 @@ The bundle size is ${_} Mb, this may take a while to download for users
|
|
|
222
222
|
Bundle uploaded \u{1F4AA} in 0 seconds`),a.verbose&&f.info("[Verbose] Dry upload mode - skipping actual upload");return}try{let h=await cr();if(a.verbose&&f.info("[Verbose] Local config retrieved for upload"),a.multipart!==void 0&&a.multipart||a.tus!==void 0&&a.tus){a.multipart?f.info("Uploading bundle with multipart is deprecated, we upload with TUS instead"):f.info("Uploading bundle with TUS protocol"),a.verbose&&(f.info("[Verbose] Starting TUS resumable upload..."),f.info(` - Host: ${h.hostWeb}`),f.info(` - Chunk size: ${Math.floor(s/1024/1024)} MB`)),await GA(t,i,o,r,n,u,h,s),l=!0,a.verbose&&f.info("[Verbose] TUS upload completed, updating database with R2 path...");let m=`orgs/${o}/apps/${r}/${n}.zip`,{error:b}=await e.from("app_versions").update({r2_path:m}).eq("name",n).eq("app_id",r);if(b)return f.error(`Cannot finish TUS upload ${U(b)}`),a.verbose&&f.info(`[Verbose] Database update failed: ${U(b)}`),Promise.reject(new Error("Cannot finish TUS upload"));a.verbose&&f.info(`[Verbose] Database updated with R2 path: ${m}`)}else{a.verbose&&f.info("[Verbose] Using standard upload (non-TUS), getting presigned URL...");let m=await qA(e,r,n);if(!m)return f.error("Cannot get upload url"),a.verbose&&f.info("[Verbose] Failed to retrieve presigned upload URL from database"),Promise.reject(new Error("Cannot get upload url"));a.verbose&&(f.info("[Verbose] Presigned URL obtained, uploading via HTTP PUT..."),f.info(` - Timeout: ${a.timeout||Og}ms`),f.info(" - Retry attempts: 5"),f.info(" - Content-Type: application/zip"));let b=new AbortController,y=setTimeout(()=>b.abort(),a.timeout||Og);try{let C=await fetch(m,{method:"PUT",body:i,headers:{"Content-Type":"application/zip"},signal:b.signal});if(!C.ok)throw new Error(`HTTP error! status: ${C.status}`)}finally{clearTimeout(y)}a.verbose&&f.info("[Verbose] HTTP PUT upload completed successfully")}}catch(h){let b=((performance.now()-c)/1e3).toFixed(2);if(u.stop(`Failed to upload bundle ( after ${b} seconds)`),a.verbose&&(f.info(`[Verbose] Upload failed after ${b} seconds`),f.info(`[Verbose] Error type: ${h instanceof Error?"Error":typeof h}`)),h instanceof Error&&h.message.includes("HTTP error"))try{let y=h.message.match(/status: (\d+)/),C=y?y[1]:"unknown";f.error(`Upload failed with status ${C}: ${h.message}`)}catch{f.error(`Upload failed: ${h.message}`)}else a.verbose&&f.info(`[Verbose] Non-HTTP error: ${U(h)}`),a.tus?f.error(`Cannot upload bundle please contact support if the issue persists ${U(h)}`):f.error(`Cannot upload bundle ( try again with --tus option) ${U(h)}`);throw a.verbose&&f.info("[Verbose] Cleaning up failed version from database..."),await WA(e,r,n),a.verbose&&f.info("[Verbose] Failed version cleaned up"),h instanceof Error?h:new Error(String(h))}let p=((performance.now()-c)/1e3).toFixed(2);u.stop(`Bundle uploaded \u{1F4AA} in (${p} seconds)`),a.verbose&&(f.info("[Verbose] Upload successful:"),f.info(` - Upload time: ${p} seconds`),f.info(` - Upload method: ${l?"TUS (resumable)":"Standard HTTP PUT"}`),f.info(` - Bundle size: ${Math.floor(i.byteLength/1024)} KB`),f.info("[Verbose] Sending performance event...")),await de(t,{channel:"performance",event:l?"TUS upload zip performance":"Upload zip performance",icon:"\u{1F684}",user_id:o,tags:{"app-id":r,time:p},notify:!1},a.verbose),a.verbose&&f.info("[Verbose] Performance event sent successfully")}async function e7(t,e,r){let{data:n,error:o}=await t.from("channels").select("version ( id, name, deleted )").eq("app_id",e).eq("name",r);if(o){f.error(`Cannot delete linked bundle on upload ${U(o)}`);return}if(n.length===0){f.warn("No linked bundle found in the channel you are trying to upload to");return}let i=n[0].version;if(i.deleted){f.warn("The linked bundle is already deleted");return}let{error:a}=await t.from("app_versions").update({deleted:!0}).eq("id",i.id);if(a){f.error(`Cannot delete linked bundle on upload ${U(a)}`);return}f.info("Linked bundle deleted")}async function t7(t,e,r,n,o,i,a,s,u,c){let{data:l}=await t.rpc("get_app_versions",{apikey:e,name_version:n,appid:s}).single();l||be("Cannot get version id, cannot set channel");let{data:d}=await t.rpc("is_allowed_capgkey",{apikey:e,keymode:["write","all"]}).single();if(d){let{error:p,data:h}=await zl(t,{name:o,app_id:s,created_by:i,version:l,owner_org:a,...c?{allow_device_self_set:!0}:{}});p&&be(`Cannot set channel, the upload key is not allowed to do that, use the "all" for this. ${U(p)}`);let m=`${u.hostWeb}/app/p/${s}/channel/${h.id}`;h?.public?f.info("Your update is now available in your public channel \u{1F389}"):h?.id&&f.info(`Link device to this bundle to try it: ${m}`),r&&f.info(`Bundle url: ${m}`)}else f.warn("The upload key is not allowed to set the version in the channel")}async function r7(t,e,r){let{error:n,data:o}=await e.from("apps").select("default_upload_channel").eq("app_id",t).single();return n?(f.warn("Cannot find default upload channel"),f.info(`You can set it here: ${r}/app/p/${t}/settings`),null):o.default_upload_channel}async function dy(t,e,r=!1){r||ee(`Uploading with CLI version ${yr.version}`);let n,o=tt();await ge();let{s3Region:i,s3Apikey:a,s3Apisecret:s,s3BucketName:u,s3Endpoint:c,s3Port:l,s3SSL:d}=e;e.verbose&&(f.info("[Verbose] Starting upload process with options:"),f.info(` - API key: ${e.apikey?"provided":"from saved key"}`),f.info(` - Path: ${e.path||"from capacitor config"}`),f.info(` - Channel: ${e.channel||"from default upload channel"}`),f.info(` - Bundle: ${e.bundle||"auto-detected"}`),f.info(` - External: ${e.external||"false"}`),f.info(` - Encryption: ${e.keyV2||e.keyDataV2?"v2":e.key===!1?"disabled":"auto"}`),f.info(` - Upload method: ${e.tus?"TUS":e.zip?"ZIP":"auto"}`),f.info(` - Delta updates: ${e.delta||e.partial?"enabled":"disabled"}`));let p=G9(e);e.verbose&&f.info("[Verbose] API key retrieved successfully");let h=await te();e.verbose&&f.info("[Verbose] Capacitor config loaded successfully");let m=await IA();e.verbose&&(f.info("[Verbose] Remote file config retrieved:"),f.info(` - Max upload length: ${Math.floor(m.maxUploadLength/1024/1024)} MB`),f.info(` - Alert upload size: ${Math.floor(m.alertUploadSize/1024/1024)} MB`),f.info(` - TUS upload: ${m.TUSUpload?"enabled":"disabled"}`),f.info(` - TUS upload forced: ${m.TUSUploadForced?"yes":"no"}`),f.info(` - Partial upload: ${m.partialUpload?"enabled":"disabled"}`),f.info(` - Max chunk size: ${Math.floor(m.maxChunkSize/1024/1024)} MB`));let{appid:b,path:y}=W9(t,e,h.config);e.verbose&&f.info(`[Verbose] App ID: ${b}, Build path: ${y}`);let C=await K9(h.config,e);e.verbose&&f.info(`[Verbose] Bundle version: ${C}`);let E=e.external?"external":"r2-direct",g="none";e.autoSetBundle&&(await Ps({version:C}),e.verbose&&f.info("[Verbose] Auto-set bundle version in capacitor.config.json")),Y9(e,y),e.verbose&&f.info("[Verbose] Code check passed (notifyAppReady found and index.html present)"),f.info(`Upload ${b}@${C} started from path "${y}" to Capgo cloud`);let _=await cr();e.verbose&&f.info(`[Verbose] Local config loaded: host=${_.hostWeb}`),e.supaHost&&e.supaAnon&&(f.info("Using custom supabase instance from provided options"),_.supaHost=e.supaHost,_.supaKey=e.supaAnon,e.verbose&&f.info(`[Verbose] Custom Supabase host: ${e.supaHost}`));let x=await re(p,e.supaHost,e.supaAnon);e.verbose&&f.info("[Verbose] Supabase client created successfully");let $=await ie(x,p,["write","all","upload"]);e.verbose&&f.info(`[Verbose] User verified successfully, user_id: ${$}`);let F=e.channel||await r7(b,x,_.hostWeb)||"dev";e.verbose&&f.info(`[Verbose] Target channel: ${F}`);let B=await bt(x,b);e.verbose&&f.info(`[Verbose] Organization ID: ${B}`),await NA(x,B,yr.version),e.verbose&&f.info("[Verbose] Remote CLI messages checked"),await jA(x,B,p,b,!0),e.verbose&&f.info("[Verbose] Plan validation passed"),e.verbose&&f.info("[Verbose] Trial check completed"),e.verbose&&f.info(`[Verbose] Checking compatibility with channel ${F}...`);let{nativePackages:T,minUpdateVersion:L}=await J9(x,o,e,F,b,C);e.verbose&&(f.info("[Verbose] Compatibility check completed:"),f.info(` - Native packages: ${T?T.length:0}`),f.info(` - Min update version: ${L||"none"}`)),e.verbose&&f.info(`[Verbose] Checking if version ${C} already exists...`);let A=await X9(x,b,C,e.versionExistsOk);if(e.verbose&&f.info(`[Verbose] Version exists check: ${A?"yes (skipping)":"no (continuing)"}`),A)return{success:!0,skipped:!0,reason:"VERSION_EXISTS",bundle:C,checksum:null,encryptionMethod:g,storageProvider:E};e.external&&!e.external.startsWith("https://")&&be(`External link should should start with "https://" current is "${e.external}"`),e.deleteLinkedBundleOnUpload&&(f.warn("Deleting linked bundle on upload is destructive, it will delete the currently linked bundle in the channel you are trying to upload to."),f.warn("Please make sure you want to do this, if you are not sure, please do not use this option."));let j={name:C,app_id:b,session_key:void 0,external_url:e.external,storage_provider:E,min_update_version:L,native_packages:T,owner_org:B,user_id:$,checksum:void 0,link:e.link||null,comment:e.comment||null},M=null,J="";if(e.external)e.verbose&&f.info(`[Verbose] Using external URL: ${e.external}`),await de(p,{channel:"app",event:"App external",icon:"\u{1F4E4}",user_id:B,tags:{"app-id":b},notify:!1},e.verbose),j.session_key=e.ivSessionKey,j.checksum=e.encryptedChecksum,e.verbose&&(f.info("[Verbose] External bundle configured:"),f.info(` - URL: ${e.external}`),f.info(` - IV Session Key: ${e.ivSessionKey?"provided":"none"}`),f.info(` - Encrypted Checksum: ${e.encryptedChecksum?"provided":"none"}`));else{e.verbose&&f.info(`[Verbose] Preparing bundle file from path: ${y}`);let{zipped:P,ivSessionKey:N,checksum:z,sessionKey:H,encryptionMethod:se,finalKeyData:zt}=await Z9(y,e,p,B,b,m.maxUploadLength,m.alertUploadSize);j.session_key=N,j.checksum=z,n=H,M=P,g=se,J=zt,e.verbose&&(f.info("[Verbose] Bundle prepared:"),f.info(` - Size: ${Math.floor((P?.byteLength??0)/1024)} KB`),f.info(` - Checksum: ${z}`),f.info(` - Encryption: ${se}`),f.info(` - IV Session Key: ${N?"present":"none"}`)),e.ignoreChecksumCheck||(e.verbose&&f.info("[Verbose] Checking for duplicate checksum..."),await XA(x,b,F,z),e.verbose&&f.info("[Verbose] Checksum is unique"))}e.zip?(e.tus=!1,e.verbose&&f.info("[Verbose] Upload method: ZIP (explicitly set via --zip)")):!m.TUSUpload||e.external?(e.tus=!1,e.verbose&&f.info("[Verbose] Upload method: Standard (TUS not available or external URL)")):(e.tus=e.tus||m.TUSUploadForced,e.verbose&&f.info(`[Verbose] Upload method: ${e.tus?"TUS (resumable)":"Standard"}`)),!m.partialUpload||e.external?(e.delta=!1,e.verbose&&e.external&&f.info("[Verbose] Delta updates disabled (not available with external URLs)")):(e.delta=e.delta||e.partial||e.deltaOnly||e.partialOnly||m.partialUploadForced,e.verbose&&f.info(`[Verbose] Delta updates: ${e.delta?"enabled":"disabled"}`)),e.encryptPartial&&g==="v1"&&be("You cannot encrypt the partial update if you are not using the v2 encryption method");let k="5.30.0",D="6.30.0",w="7.30.0",v=!1;if(e.delta&&g==="v2"&&!e.encryptPartial){let P=gt((0,bf.cwd)()),N=await qr("@capgo/capacitor-updater",P,e.packageJson),z;try{z=N?xe(N):void 0}catch{z=void 0}N&&z&&ED(z,xe("6.14.4"))&&(f.info(`Auto-enabling partial update encryption for updater version ${z} (> 6.14.4)`),e.verbose&&f.info("[Verbose] Partial encryption auto-enabled for updater >= 6.14.4"),e.encryptPartial=!0)}if(e.delta&&(e.encryptPartial||g==="v2")){let P=gt((0,bf.cwd)()),N=await qr("@capgo/capacitor-updater",P,e.packageJson),z;try{z=N?xe(N):void 0}catch{z=void 0}N&&z&&(v=!jn(z,k,D,w),e.verbose&&v&&f.info(`[Verbose] Using hex checksum format for updater version ${z}`))}e.verbose&&e.delta&&f.info("[Verbose] Preparing delta/partial update manifest...");let O=e.delta?await fF(y,p,B,b,e.encryptPartial?g:"none",J,v):[];e.verbose&&e.delta&&f.info(`[Verbose] Delta manifest prepared with ${O.length} files`),e.verbose&&f.info("[Verbose] Creating version record in database...");let{error:R}=await Ig(x,j);if(R&&be(`Cannot add bundle ${U(R)}`),e.verbose&&f.info("[Verbose] Version record created successfully"),e.tusChunkSize&&e.tusChunkSize>m.maxChunkSize?(f.error(`Chunk size ${e.tusChunkSize} is greater than the maximum chunk size ${m.maxChunkSize}, using the maximum chunk size`),e.tusChunkSize=m.maxChunkSize):e.tusChunkSize||(e.tusChunkSize=m.maxChunkSize),e.verbose&&f.info(`[Verbose] TUS chunk size: ${Math.floor(e.tusChunkSize/1024/1024)} MB`),M&&(u||c||i||a||s||l||d)){(!u||!c||!i||!a||!s||!l)&&be("Missing argument, for S3 upload you need to provide a bucket name, endpoint, region, port, API key, and API secret"),f.info("Uploading to S3"),e.verbose&&(f.info("[Verbose] S3 configuration:"),f.info(` - Endpoint: ${c}`),f.info(` - Region: ${i}`),f.info(` - Bucket: ${u}`),f.info(` - Port: ${l}`),f.info(` - SSL: ${d?"enabled":"disabled"}`));let P=d?`https://${c}`:`http://${c}`,N=new Ms({endPoint:c,region:i,port:l,pathStyle:!0,bucket:u,accessKey:a,secretKey:s}),z=`${b}-${C}`,H=encodeURIComponent(z);e.verbose&&f.info(`[Verbose] Uploading to S3 as: ${z}`),await N.putObject(z,Uint8Array.from(M)),j.external_url=`${P}/${H}`,j.storage_provider="external",e.verbose&&f.info(`[Verbose] S3 upload complete, external URL: ${j.external_url}`)}else if(M){!e.partialOnly&&!e.deltaOnly?(e.verbose&&f.info("[Verbose] Starting full bundle upload to Capgo Cloud..."),await Q9(p,x,b,C,B,M,e,e.tusChunkSize)):e.verbose&&f.info("[Verbose] Skipping full bundle upload (delta-only mode)");let P=null;try{e.dryUpload&&(e.delta=!1,e.verbose&&f.info("[Verbose] Dry upload mode: skipping delta upload"));let z=j.session_key&&e.encryptPartial&&n?{sessionKey:n,ivSessionKey:j.session_key}:void 0;e.verbose&&e.delta&&(f.info("[Verbose] Starting delta/partial file upload..."),f.info(` - Manifest entries: ${O.length}`),f.info(` - Encryption: ${z?"enabled":"disabled"}`)),P=e.delta?await dF(p,O,y,b,B,z,e):null,e.verbose&&P&&f.info(`[Verbose] Delta upload complete with ${P.length} files`)}catch(z){if(!!(e.partial||e.delta||e.partialOnly||e.deltaOnly))throw z;f.info(`Failed to upload partial files to capgo cloud. Error: ${U(z)}. This is not a critical error, the bundle has been uploaded without the partial files`),e.verbose&&f.info(`[Verbose] Delta upload error details: ${U(z)}`)}j.storage_provider="r2",j.manifest=P,e.verbose&&f.info("[Verbose] Updating version record with storage provider and manifest...");let{error:N}=await Ig(x,j);N&&be(`Cannot update bundle ${U(N)}`),e.verbose&&f.info("[Verbose] Version record updated successfully")}e.verbose&&f.info("[Verbose] Checking app permissions...");let I=await Me(x,p,b,2);e.verbose&&(f.info("[Verbose] Permissions:"),f.info(` - Upload: ${oa(I,2)?"yes":"no"}`),f.info(` - Write: ${oa(I,3)?"yes":"no"}`),f.info(` - Admin: ${oa(I,4)?"yes":"no"}`)),e.deleteLinkedBundleOnUpload&&oa(I,3)?(e.verbose&&f.info(`[Verbose] Deleting linked bundle in channel ${F}...`),await e7(x,b,F)):e.deleteLinkedBundleOnUpload&&f.warn("Cannot delete linked bundle on upload as a upload organization member"),oa(I,3)?(e.verbose&&f.info(`[Verbose] Setting bundle ${C} to channel ${F}...`),await t7(x,p,!!e.bundleUrl,C,F,$,B,b,_,e.selfAssign),e.verbose&&f.info("[Verbose] Channel updated successfully")):f.warn("Cannot set channel as a upload organization member"),e.verbose&&f.info("[Verbose] Sending upload event..."),await de(p,{channel:"app",event:"App Uploaded",icon:"\u23EB",user_id:B,tags:{"app-id":b},notify:!1},e.verbose);let q={success:!0,bundle:C,checksum:j.checksum??null,encryptionMethod:g,sessionKey:n?n.toString("base64"):void 0,ivSessionKey:typeof j.session_key=="string"?j.session_key:void 0,storageProvider:j.storage_provider};return e.verbose&&(f.info("[Verbose] Upload completed successfully:"),f.info(` - Bundle: ${q.bundle}`),f.info(` - Checksum: ${q.checksum}`),f.info(` - Encryption: ${q.encryptionMethod}`),f.info(` - Storage: ${q.storageProvider}`)),r&&!q.skipped&&Z("Time to share your update to the world \u{1F30D}"),q}function n7(t){t.ivSessionKey&&!t.external&&be("You need to provide an external url if you want to use the --iv-session-key option"),t.encryptedChecksum&&!t.external&&be("You need to provide an external url if you want to use the --encrypted-checksum option"),(t.partial||t.delta||t.partialOnly||t.deltaOnly)&&t.external&&be("You cannot use the --partial/--delta/--partial-only/--delta-only option with an external url"),t.tus&&t.external&&be("You cannot use the --tus option with an external url"),t.dryUpload&&t.external&&be("You cannot use the --dry-upload option with an external url"),t.multipart&&t.external&&be("You cannot use the --multipart option with an external url"),t.external&&(t.keyV2||t.keyDataV2)&&be("You cannot set a key if you are uploading to an external url"),t.keyV2&&t.keyDataV2&&be("You cannot set both key-v2 and key-data-v2"),t.external&&(t.s3Region||t.s3Apikey||t.s3Apisecret||t.s3Endpoint||t.s3BucketName||t.s3Port||t.s3SSL)&&be("You cannot set S3 options if you are uploading to an external url, it's automatically handled"),t.encryptedChecksum&&!t.external&&be("You cannot set the --encrypted-checksum option if you are not uploading to an external url"),t.minUpdateVersion&&t.autoMinUpdateVersion&&be("You cannot set both min-update-version and auto-min-update-version, use only one of them")}async function hF(t,e){try{n7(e),await dy(t,e)}catch(r){throw f.error(`uploadBundle failed: ${U(r)}`),r instanceof Error?r:new Error(String(r))}}var mF=require("node:crypto"),wf=require("node:fs"),gF=require("node:process");var o7=20;function i7(t){console.log(JSON.stringify(t,null,2))}function Gs(t){console.error(U(t))}async function a7(t,e,r=!1){let{json:n}=e,{bundle:o,path:i}=e,a=!n&&!r;try{a&&await ge();let s=await te(),u=le(t,s?.config),c=(0,mF.randomUUID)().split("-")[0],l=Fr("",e.packageJson);if(o=o||l||`0.0.1-beta.${c}`,a&&ee(`Zipping ${u}@${o}`),o&&!na.test(o)){let $=`Your bundle name ${o}, is not valid it should follow semver convention : https://semver.org/`;throw r||(n?Gs({error:"invalid_semver"}):f.error($)),new Error("Invalid bundle version format")}if(i=i||s?.config?.webDir,!u||!o||!i){let $="Missing argument, you need to provide a appId and a bundle and a path, or be in a capacitor project";throw r||(n?Gs({error:"missing_argument"}):f.error($)),new Error($)}if(a&&f.info(`Started from path "${i}"`),typeof e.codeCheck>"u"?!0:e.codeCheck){if(!qs(i,"notifyAppReady"))throw r||(n?Gs({error:"notifyAppReady_not_in_source_code"}):f.error("notifyAppReady() is missing in the build folder of your app. see: https://capgo.app/docs/plugin/api/#notifyappready")),new Error("notifyAppReady() is missing in build folder");if(!lf(i))throw r||(n?Gs({error:"index_html_not_found"}):f.error(`index.html is missing in the root folder of ${i}`)),new Error("index.html is missing in root folder")}let p=await Vl(i);a&&f.info(`Zipped ${p.byteLength} bytes`);let h=a?De():null;h&&h.start("Calculating checksum");let m=gt((0,gF.cwd)()),b=await qr("@capgo/capacitor-updater",m,e.packageJson);if(!b){let $="Cannot find @capgo/capacitor-updater in node_modules, please install it first with your package manager";throw r||f.warn($),new Error($)}let y=!1,C;try{C=b?xe(b):void 0}catch{C=void 0}C?y=!jn(C,void 0,void 0,"7.0.0"):b==="link:@capgo/capacitor-updater"&&(r||f.warn("Using local @capgo/capacitor-updater. Assuming v7"),y=!0);let E=await on(p,e.keyV2||(0,wf.existsSync)(Jt)||y?"sha256":"crc32");h&&h.stop(`Checksum ${y?"SHA256":"CRC32"}: ${E}`);let g=Math.floor(p.byteLength/1024/1024);g>o7&&a&&(f.warn(`WARNING !!
|
|
223
223
|
The bundle size is ${g} Mb, this may take a while to download for users
|
|
224
224
|
`),f.warn(`Learn how to optimize your assets https://capgo.app/blog/optimise-your-images-for-updates/
|
|
225
|
-
`));let _=a?De():null,x=e.name||`${u}_${o}.zip`;return _&&_.start(`Saving to ${x}`),(0,wf.writeFileSync)(x,p),_&&_.stop(`Saved to ${x}`),a&&Z("Done \u2705"),!r&&n&&i7({bundle:o,filename:x,checksum:E}),{bundle:o,filename:x,checksum:E}}catch(s){throw r||(n?Gs(s):f.error(U(s))),s instanceof Error?s:new Error(String(s))}}async function yF(t,e){await a7(t,e,!1)}async function py(t,e,r,n=!1){n||ee("Create channel"),r.apikey=r.apikey||ne();let o=await te().catch(()=>{});if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await re(r.apikey,r.supaHost,r.supaAnon);await ie(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,4,n),n||f.info(`Creating channel ${e}#${t} to Capgo`);let a=await Ug(i,e);if(!a)throw n||f.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let s=await bt(i,e),u=await ie(i,r.apikey,["write","all"]),c=await
|
|
226
|
-
${U(c.error)}`),new Error(`Cannot create channel: ${U(c.error)}`);return await de(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel created \u2705"),Z("Done \u2705")),c.data??!0}async function DF(t,e,r){await py(t,e,r,!1)}async function s7(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&ee("List current bundle"),r.apikey=r.apikey||ne(o);let i=await te();if(e=le(e,i?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await re(r.apikey,r.supaHost,r.supaAnon);if(await ie(a,r.apikey,["write","all","read"]),await Me(a,r.apikey,e,1,n),!t)throw n||f.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:s,error:u}=await a.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!s?.length)throw n||f.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} not found for app ${e}`);let{version:c}=s[0];if(!c)throw n||f.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} does not have a bundle linked`);return n||(o?f.info(c.name):f.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function bF(t,e,r){return s7(t,e,r)}async function u7(t,e,r,n=!1){n||ee("Delete channel"),r.apikey=r.apikey||ne();let o=await te();if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await re(r.apikey,r.supaHost,r.supaAnon),a=await ie(i,r.apikey,["all"]);if(await Me(i,r.apikey,e,4,n),r.deleteBundle&&!n&&f.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let p=await AO(i,e,t);p?.name&&!n&&f.info(`Deleting bundle ${p.name} from Capgo`),p?.name&&await Mg(i,e,p.name)}let{data:s,error:u}=await SO(i,e,t);if(u||!s){if(n||f.error(`Channel ${t} not found`),r.successIfNotFound)return n||f.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await xO(i,e,s.id);if(c)throw n||f.error(`Cannot delete channel devices: ${U(c)}`),new Error(`Cannot delete channel devices: ${U(c)}`);n||f.info(`Deleting channel ${e}#${t} from Capgo`);let l=await _O(i,t,e,a);if(l.error)throw n||f.error(`Cannot delete Channel \u{1F640} ${U(l.error)}`),new Error(`Cannot delete channel: ${U(l.error)}`);let d=await bt(i,e);return await de(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:d,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel deleted"),Z("Done \u2705")),!0}async function wF(t,e,r){return u7(t,e,r,!1)}async function c7(t,e,r=!1){r||ee("List channels"),e.apikey=e.apikey||ne();let n=await te();if(t=le(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),i=await ie(o,e.apikey,["write","all","read","upload"]);await Me(o,e.apikey,t,1,r),r||f.info("Querying available channels in Capgo");let a=await FO(o,t);return r||(f.info(`Active channels in Capgo: ${a?.length??0}`),OO(a)),await de(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||Z("Done \u2705"),a}async function vF(t,e){return c7(t,e,!1)}var CF=["major","minor","metadata","patch","none"];async function l7(t,e,r,n=!1){n||ee("Set channel"),r.apikey=r.apikey||ne();let o=await te();if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||f.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let i=await re(r.apikey,r.supaHost,r.supaAnon),a=await ie(i,r.apikey,["write","all"]);await Me(i,r.apikey,e,4,n);let s=await bt(i,e),{bundle:u,state:c,downgrade:l,latest:d,latestRemote:p,ios:h,android:m,selfAssign:b,disableAutoUpdate:y,dev:C,emulator:E}=r;if(d&&u)throw n||f.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(p&&u)throw n||f.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(p&&d)throw n||f.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&d==null&&p==null&&l==null&&h==null&&m==null&&b==null&&C==null&&E==null&&y==null)throw n||f.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await LA(i,s,r.apikey,e);let g={created_by:a,app_id:e,name:t,owner_org:s,version:void 0},{error:_}=await i.from("channels").select().eq("app_id",e).eq("name",t).single();if(_)throw n||f.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let x=d?o?.config?.plugins?.CapacitorUpdater?.version||Fr("",r.packageJson):u;if(x!=null){let{data:F,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("name",x).eq("user_id",a).eq("deleted",!1).single();if(B||!F)throw n||f.error(`Cannot find version ${x}`),new Error(`Cannot find version ${x}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:T,localDependencies:L}=await Rg(i,e,t,F.native_packages??[]),A=tt();if(L.length>0&&T.some(j=>!$o(j)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${A.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(L.length===0&&T.length>0?f.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):f.info(`Bundle is compatible with ${t} channel`))}n||f.info(`Set ${e} channel: ${t} to @${x}`),g.version=F.id}if(p){let{data:F,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("user_id",a).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(B||!F)throw n||f.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:T}=await Rg(i,e,t,F.native_packages??[]),L=tt();if(T.some(A=>!$o(A)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${L.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||f.info(`Set ${e} channel: ${t} to @${F.name}`),g.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||f.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||f.info(`Set ${e} channel: ${t} to ${c}`),g.public=c==="default"}if(l!=null&&(n||f.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),g.disable_auto_update_under_native=!l),h!=null&&(n||f.info(`Set ${e} channel: ${t} to ${h?"allow":"disallow"} ios update`),g.ios=!!h),m!=null&&(n||f.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),g.android=!!m),b!=null&&(n||f.info(`Set ${e} channel: ${t} to ${b?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!b),C!=null&&(n||f.info(`Set ${e} channel: ${t} to ${C?"allow":"disallow"} dev devices`),g.allow_dev=!!C),E!=null&&(n||f.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} emulator devices`),g.allow_emulator=!!E),y!=null){let F=y.toLowerCase();if(!CF.includes(F))throw n||f.error(`Channel strategy ${F} is not known. The possible values are: ${CF.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),g.disable_auto_update=F,n||f.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:$}=await zl(i,g);if($)throw n||f.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),new Error("Upload key is not allowed to set this channel");return await de(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||Z("Done \u2705"),!0}async function EF(t,e,r){return l7(t,e,r,!1)}var Gr=require("node:fs");function hy(t){let e="\u{1F539}";return t.includes("upload")?e="\u2B06\uFE0F":t.includes("delete")?e="\u{1F5D1}\uFE0F":t.includes("list")?e="\u{1F4CB}":t.includes("add")?e="\u2795":t.includes("set")?e="\u2699\uFE0F":t.includes("create")?e="\u{1F528}":t.includes("encrypt")?e="\u{1F512}":t.includes("decrypt")?e="\u{1F513}":t.includes("debug")?e="\u{1F41E}":t.includes("doctor")?e="\u{1F468}\u200D\u2695\uFE0F":t.includes("login")?e="\u{1F511}":t.includes("init")?e="\u{1F680}":t.includes("compatibility")?e="\u{1F9EA}":t.includes("cleanup")?e="\u{1F9F9}":t.includes("currentBundle")?e="\u{1F4E6}":t.includes("setting")?e="\u2699\uFE0F":t==="app"?e="\u{1F4F1}":t==="bundle"?e="\u{1F4E6}":t==="channel"?e="\u{1F4E2}":t==="key"?e="\u{1F510}":t==="account"&&(e="\u{1F464}"),e}function _F(t="./README.md",e){let r=ot.commands.map(o=>{let i=o,a=i._actionHandler!==null&&i._actionHandler!==void 0,u=o.commands&&o.commands.length>0&&!a;return{name:o.name(),alias:o.alias()||"",description:o.description(),options:o.options.map(c=>({flags:c.flags,description:c.description||""})),subcommands:o.commands?o.commands.map(c=>{let l=c,d=l._actionHandler!==null&&l._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(p=>({flags:p.flags,description:p.description||""})),subcommands:[],hasAction:d,isCommandGroup:!1}}):[],hasAction:a,isCommandGroup:u}}),n=(o,i=!1,a,s=!1)=>{let u=o.name,c=u.charAt(0).toUpperCase()+u.slice(1),l;i?l=a?`${a}-${u}`:u:l=s?"options":u;let d=i?"###":"##",p="",h=hy(u);s&&!i||(p+=`${d} <a id="${l}"></a> ${h} **${c}**
|
|
225
|
+
`));let _=a?De():null,x=e.name||`${u}_${o}.zip`;return _&&_.start(`Saving to ${x}`),(0,wf.writeFileSync)(x,p),_&&_.stop(`Saved to ${x}`),a&&Z("Done \u2705"),!r&&n&&i7({bundle:o,filename:x,checksum:E}),{bundle:o,filename:x,checksum:E}}catch(s){throw r||(n?Gs(s):f.error(U(s))),s instanceof Error?s:new Error(String(s))}}async function yF(t,e){await a7(t,e,!1)}async function py(t,e,r,n=!1){n||ee("Create channel"),r.apikey=r.apikey||ne();let o=await te().catch(()=>{});if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await re(r.apikey,r.supaHost,r.supaAnon);await ie(i,r.apikey,["write","all"]),await Me(i,r.apikey,e,4,n),n||f.info(`Creating channel ${e}#${t} to Capgo`);let a=await Ug(i,e);if(!a)throw n||f.error("Cannot find default version for channel creation, please contact Capgo support \u{1F928}"),new Error("Cannot find default version for channel creation");let s=await bt(i,e),u=await ie(i,r.apikey,["write","all"]),c=await E1(i,{name:t,app_id:e,version:a.id,created_by:u,owner_org:s,allow_device_self_set:r.selfAssign??!1,public:r.default??!1});if(c.error)throw n||f.error(`Cannot create Channel \u{1F640}
|
|
226
|
+
${U(c.error)}`),new Error(`Cannot create channel: ${U(c.error)}`);return await de(r.apikey,{channel:"channel",event:"Create channel",icon:"\u2705",user_id:s,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel created \u2705"),Z("Done \u2705")),c.data??!0}async function DF(t,e,r){await py(t,e,r,!1)}async function s7(t,e,r,n=!1){let{quiet:o}=r;!o&&!n&&ee("List current bundle"),r.apikey=r.apikey||ne(o);let i=await te();if(e=le(e,i?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let a=await re(r.apikey,r.supaHost,r.supaAnon);if(await ie(a,r.apikey,["write","all","read"]),await Me(a,r.apikey,e,1,n),!t)throw n||f.error("Please provide a channel to get the bundle from."),new Error("Channel name missing");let{data:s,error:u}=await a.from("channels").select("version ( name )").eq("name",t).eq("app_id",e).limit(1);if(u||!s?.length)throw n||f.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} not found for app ${e}`);let{version:c}=s[0];if(!c)throw n||f.error(`Error retrieving channel ${t} for app ${e}. Perhaps the channel does not exist?`),new Error(`Channel ${t} does not have a bundle linked`);return n||(o?f.info(c.name):f.info(`Current bundle for channel ${t} is ${c.name}`)),c.name}async function bF(t,e,r){return s7(t,e,r)}async function u7(t,e,r,n=!1){n||ee("Delete channel"),r.apikey=r.apikey||ne();let o=await te();if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let i=await re(r.apikey,r.supaHost,r.supaAnon),a=await ie(i,r.apikey,["all"]);if(await Me(i,r.apikey,e,4,n),r.deleteBundle&&!n&&f.info(`Deleting bundle ${e}#${t} from Capgo`),r.deleteBundle){let p=await A1(i,e,t);p?.name&&!n&&f.info(`Deleting bundle ${p.name} from Capgo`),p?.name&&await Mg(i,e,p.name)}let{data:s,error:u}=await S1(i,e,t);if(u||!s){if(n||f.error(`Channel ${t} not found`),r.successIfNotFound)return n||f.success(`Channel ${t} not found and successIfNotFound is true`),!0;throw new Error(`Channel ${t} not found`)}let{error:c}=await x1(i,e,s.id);if(c)throw n||f.error(`Cannot delete channel devices: ${U(c)}`),new Error(`Cannot delete channel devices: ${U(c)}`);n||f.info(`Deleting channel ${e}#${t} from Capgo`);let l=await _1(i,t,e,a);if(l.error)throw n||f.error(`Cannot delete Channel \u{1F640} ${U(l.error)}`),new Error(`Cannot delete channel: ${U(l.error)}`);let d=await bt(i,e);return await de(r.apikey,{channel:"channel",event:"Delete channel",icon:"\u2705",user_id:d,tags:{"app-id":e,channel:t},notify:!1}).catch(()=>{}),n||(f.success("Channel deleted"),Z("Done \u2705")),!0}async function wF(t,e,r){return u7(t,e,r,!1)}async function c7(t,e,r=!1){r||ee("List channels"),e.apikey=e.apikey||ne();let n=await te();if(t=le(t,n?.config),!e.apikey)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!t)throw r||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");let o=await re(e.apikey,e.supaHost,e.supaAnon),i=await ie(o,e.apikey,["write","all","read","upload"]);await Me(o,e.apikey,t,1,r),r||f.info("Querying available channels in Capgo");let a=await F1(o,t);return r||(f.info(`Active channels in Capgo: ${a?.length??0}`),O1(a)),await de(e.apikey,{channel:"channel",event:"List channel",icon:"\u2705",user_id:i,tags:{"app-id":t},notify:!1}).catch(()=>{}),r||Z("Done \u2705"),a}async function vF(t,e){return c7(t,e,!1)}var CF=["major","minor","metadata","patch","none"];async function l7(t,e,r,n=!1){n||ee("Set channel"),r.apikey=r.apikey||ne();let o=await te();if(e=le(e,o?.config),!r.apikey)throw n||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");if(!e)throw n||f.error("Missing argument, you need to provide a appId, or be in a capacitor project"),new Error("Missing appId");if(!t)throw n||f.error("Missing argument, you need to provide a channel"),new Error("Missing channel id");let i=await re(r.apikey,r.supaHost,r.supaAnon),a=await ie(i,r.apikey,["write","all"]);await Me(i,r.apikey,e,4,n);let s=await bt(i,e),{bundle:u,state:c,downgrade:l,latest:d,latestRemote:p,ios:h,android:m,selfAssign:b,disableAutoUpdate:y,dev:C,emulator:E}=r;if(d&&u)throw n||f.error("Cannot set latest and bundle at the same time"),new Error("Cannot set both latest and bundle simultaneously");if(p&&u)throw n||f.error("Cannot set latest remote and bundle at the same time"),new Error("Cannot set both latest remote and bundle simultaneously");if(p&&d)throw n||f.error("Cannot set latest remote and latest at the same time"),new Error("Cannot set both latest remote and latest simultaneously");if(u==null&&c==null&&d==null&&p==null&&l==null&&h==null&&m==null&&b==null&&C==null&&E==null&&y==null)throw n||f.error("Missing argument, you need to provide a option to set"),new Error("No channel option provided");await LA(i,s,r.apikey,e);let g={created_by:a,app_id:e,name:t,owner_org:s,version:void 0},{error:_}=await i.from("channels").select().eq("app_id",e).eq("name",t).single();if(_)throw n||f.error(`Cannot find channel ${t}`),new Error(`Cannot find channel ${t}`);let x=d?o?.config?.plugins?.CapacitorUpdater?.version||Fr("",r.packageJson):u;if(x!=null){let{data:F,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("name",x).eq("user_id",a).eq("deleted",!1).single();if(B||!F)throw n||f.error(`Cannot find version ${x}`),new Error(`Cannot find version ${x}`);if(!r.ignoreMetadataCheck){let{finalCompatibility:T,localDependencies:L}=await Rg(i,e,t,F.native_packages??[]),A=tt();if(L.length>0&&T.some(j=>!$o(j)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${A.runner} @capgo/cli bundle compatibility"`)),new Error(`Bundle is not compatible with ${t} channel`);n||(L.length===0&&T.length>0?f.info(`Ignoring check compatibility with ${t} channel because the bundle does not contain any native packages`):f.info(`Bundle is compatible with ${t} channel`))}n||f.info(`Set ${e} channel: ${t} to @${x}`),g.version=F.id}if(p){let{data:F,error:B}=await i.from("app_versions").select().eq("app_id",e).eq("user_id",a).eq("deleted",!1).order("created_at",{ascending:!1}).single();if(B||!F)throw n||f.error("Cannot find latest remote version"),new Error("Cannot find latest remote version");if(!r.ignoreMetadataCheck){let{finalCompatibility:T}=await Rg(i,e,t,F.native_packages??[]),L=tt();if(T.some(A=>!$o(A)))throw n||(f.warn(`Bundle NOT compatible with ${t} channel`),f.warn(`You can check compatibility with "${L.runner} @capgo/cli bundle compatibility"`)),new Error(`Latest remote bundle is not compatible with ${t} channel`)}n||f.info(`Set ${e} channel: ${t} to @${F.name}`),g.version=F.id}if(c!=null){if(c!=="normal"&&c!=="default")throw n||f.error(`State ${c} is not known. The possible values are: normal, default.`),new Error(`Unknown state ${c}. Expected normal or default`);n||f.info(`Set ${e} channel: ${t} to ${c}`),g.public=c==="default"}if(l!=null&&(n||f.info(`Set ${e} channel: ${t} to ${l?"allow":"disallow"} downgrade`),g.disable_auto_update_under_native=!l),h!=null&&(n||f.info(`Set ${e} channel: ${t} to ${h?"allow":"disallow"} ios update`),g.ios=!!h),m!=null&&(n||f.info(`Set ${e} channel: ${t} to ${m?"allow":"disallow"} android update`),g.android=!!m),b!=null&&(n||f.info(`Set ${e} channel: ${t} to ${b?"allow":"disallow"} self assign to this channel`),g.allow_device_self_set=!!b),C!=null&&(n||f.info(`Set ${e} channel: ${t} to ${C?"allow":"disallow"} dev devices`),g.allow_dev=!!C),E!=null&&(n||f.info(`Set ${e} channel: ${t} to ${E?"allow":"disallow"} emulator devices`),g.allow_emulator=!!E),y!=null){let F=y.toLowerCase();if(!CF.includes(F))throw n||f.error(`Channel strategy ${F} is not known. The possible values are: ${CF.join(", ")}.`),new Error(`Unknown channel strategy ${F}`);F==="metadata"&&(F="version_number"),g.disable_auto_update=F,n||f.info(`Set ${e} channel: ${t} to ${F} disable update strategy to this channel`)}let{error:$}=await zl(i,g);if($)throw n||f.error('Cannot set channel the upload key is not allowed to do that, use the "all" for this.'),new Error("Upload key is not allowed to set this channel");return await de(r.apikey,{channel:"channel",event:"Set channel",icon:"\u2705",user_id:s,tags:{"app-id":e},notify:!1}).catch(()=>{}),n||Z("Done \u2705"),!0}async function EF(t,e,r){return l7(t,e,r,!1)}var Gr=require("node:fs");function hy(t){let e="\u{1F539}";return t.includes("upload")?e="\u2B06\uFE0F":t.includes("delete")?e="\u{1F5D1}\uFE0F":t.includes("list")?e="\u{1F4CB}":t.includes("add")?e="\u2795":t.includes("set")?e="\u2699\uFE0F":t.includes("create")?e="\u{1F528}":t.includes("encrypt")?e="\u{1F512}":t.includes("decrypt")?e="\u{1F513}":t.includes("debug")?e="\u{1F41E}":t.includes("doctor")?e="\u{1F468}\u200D\u2695\uFE0F":t.includes("login")?e="\u{1F511}":t.includes("init")?e="\u{1F680}":t.includes("compatibility")?e="\u{1F9EA}":t.includes("cleanup")?e="\u{1F9F9}":t.includes("currentBundle")?e="\u{1F4E6}":t.includes("setting")?e="\u2699\uFE0F":t==="app"?e="\u{1F4F1}":t==="bundle"?e="\u{1F4E6}":t==="channel"?e="\u{1F4E2}":t==="key"?e="\u{1F510}":t==="account"&&(e="\u{1F464}"),e}function _F(t="./README.md",e){let r=ot.commands.map(o=>{let i=o,a=i._actionHandler!==null&&i._actionHandler!==void 0,u=o.commands&&o.commands.length>0&&!a;return{name:o.name(),alias:o.alias()||"",description:o.description(),options:o.options.map(c=>({flags:c.flags,description:c.description||""})),subcommands:o.commands?o.commands.map(c=>{let l=c,d=l._actionHandler!==null&&l._actionHandler!==void 0;return{name:c.name(),alias:c.alias()||"",description:c.description(),options:c.options.map(p=>({flags:p.flags,description:p.description||""})),subcommands:[],hasAction:d,isCommandGroup:!1}}):[],hasAction:a,isCommandGroup:u}}),n=(o,i=!1,a,s=!1)=>{let u=o.name,c=u.charAt(0).toUpperCase()+u.slice(1),l;i?l=a?`${a}-${u}`:u:l=s?"options":u;let d=i?"###":"##",p="",h=hy(u);s&&!i||(p+=`${d} <a id="${l}"></a> ${h} **${c}**
|
|
227
227
|
|
|
228
228
|
`),o.alias&&(p+=`**Alias:** \`${o.alias}\`
|
|
229
229
|
|
|
@@ -270,7 +270,7 @@ sidebar:
|
|
|
270
270
|
`);for(let d of l.subcommands)o+=n(d,!0,l.name)}o+=`
|
|
271
271
|
`}let i="<!-- AUTO-GENERATED-DOCS-START -->",a="<!-- AUTO-GENERATED-DOCS-END -->",s="";try{s=(0,Gr.readFileSync)(t,"utf8")}catch{s=""}let u=s.indexOf(i),c=s.indexOf(a,u);if(u!==-1&&c!==-1){let l=s.substring(0,u+i.length),d=s.substring(c),p=`${l}
|
|
272
272
|
${o}
|
|
273
|
-
${d}`;(0,Gr.writeFileSync)(t,p,"utf8"),f.success(`Documentation updated in ${t}`)}else(0,Gr.writeFileSync)(t,o,"utf8"),f.success(`Documentation written to ${t}`)}}var ba=require("node:child_process"),Ie=require("node:fs"),Hn=require("node:path"),_e=require("node:process");var _f=ue(qF());var Tt=require("node:fs");function HF(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function P7(t,e=!1){e||ee("Save keys \u{1F511}");let r=await te(),n=t.key||ln,o=t.keyData||"";if(!(0,Tt.existsSync)(n)&&!o)throw e||f.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,Tt.existsSync)(n)&&(o=(0,Tt.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||f.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=HF(r.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ve({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=o,await Xi(r)}return e||(f.success(`Public key saved into ${r.path} file in local directory`),f.success("Your app will decode the zip archive with this key")),!0}async function $7(t,e=!1){e||ee("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Xi(r),(0,Tt.existsSync)(ra))try{(0,Tt.unlinkSync)(ra),e||f.success(`Old private key file deleted: ${ra}`)}catch(o){e||f.error(`Failed to delete old private key file: ${ra} (${String(o)})`)}if((0,Tt.existsSync)(Ml))try{(0,Tt.unlinkSync)(Ml),e||f.success(`Old public key file deleted: ${Ml}`)}catch(o){e||f.error(`Failed to delete old public key file: ${ln} (${String(o)})`)}return e||(f.success(`Old private key deleted from ${r.path} file`),Z("Done \u2705")),!0}return e||f.info("No old private key found in config file"),!1}async function VF(t){await ge(),await P7(t,!1)}async function by(t,e=!1){e||ee("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=
|
|
273
|
+
${d}`;(0,Gr.writeFileSync)(t,p,"utf8"),f.success(`Documentation updated in ${t}`)}else(0,Gr.writeFileSync)(t,o,"utf8"),f.success(`Documentation written to ${t}`)}}var ba=require("node:child_process"),Ie=require("node:fs"),Hn=require("node:path"),_e=require("node:process");var _f=ue(qF());var Tt=require("node:fs");function HF(t){return t.plugins??={},t.plugins.extConfig??={},t.plugins.CapacitorUpdater??={},t.plugins.CapacitorUpdater}async function P7(t,e=!1){e||ee("Save keys \u{1F511}");let r=await te(),n=t.key||ln,o=t.keyData||"";if(!(0,Tt.existsSync)(n)&&!o)throw e||f.error(`Cannot find a public key at ${n} or as keyData option or in ${r.path}`),new Error("Missing public key");if((0,Tt.existsSync)(n)&&(o=(0,Tt.readFileSync)(n,"utf8")),!o.startsWith("-----BEGIN RSA PUBLIC KEY-----"))throw e||f.error("The public key provided is not a valid RSA Public key"),new Error("Invalid RSA public key");if(r?.config){let i=HF(r.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ve({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=o,await Xi(r)}return e||(f.success(`Public key saved into ${r.path} file in local directory`),f.success("Your app will decode the zip archive with this key")),!0}async function $7(t,e=!1){e||ee("Deleting old private key \u{1F5D1}\uFE0F");let r=await te(),n=r?.config?.plugins?.CapacitorUpdater;if(n?.privateKey){if(delete n.privateKey,await Xi(r),(0,Tt.existsSync)(ra))try{(0,Tt.unlinkSync)(ra),e||f.success(`Old private key file deleted: ${ra}`)}catch(o){e||f.error(`Failed to delete old private key file: ${ra} (${String(o)})`)}if((0,Tt.existsSync)(Ml))try{(0,Tt.unlinkSync)(Ml),e||f.success(`Old public key file deleted: ${Ml}`)}catch(o){e||f.error(`Failed to delete old public key file: ${ln} (${String(o)})`)}return e||(f.success(`Old private key deleted from ${r.path} file`),Z("Done \u2705")),!0}return e||f.info("No old private key found in config file"),!1}async function VF(t){await ge(),await P7(t,!1)}async function by(t,e=!1){e||ee("Create keys \u{1F511}");let{publicKey:r,privateKey:n}=B1();if((0,Tt.existsSync)(ln)&&!t.force)throw e||f.error("Public Key already exists, use --force to overwrite"),new Error("Public key already exists");if((0,Tt.writeFileSync)(ln,r),(0,Tt.existsSync)(Jt)&&!t.force)throw e||f.error("Private Key already exists, use --force to overwrite"),new Error("Private key already exists");(0,Tt.writeFileSync)(Jt,n);let o=await te();if(o){let i=HF(o.config);i.privateKey&&(delete i.privateKey,e||f.info("Old private key deleted from config file"),(e?t.setupChannel??!1:t.setupChannel??await ve({message:"Do you want to setup encryption with the new channel in order to support old apps and facilitate the migration?"}))&&(i.defaultChannel="encryption_v2")),i.publicKey=r,await Xi(o)}if(!e){f.success("Your RSA key has been generated"),f.success(`Private key saved in ${Jt}`),f.success("This key will be used to encrypt your bundle before sending it to Capgo"),f.success("Keep it safe"),f.success("Then make it unreadable by Capgo and unmodifiable by anyone"),f.success(`Public key saved in ${o.path}`),f.success("Your app will be the only one having it"),f.success("Only your users can decrypt your update"),f.success("Only you can send them an update");try{await Gl(),Z("Done \u2705")}catch(i){if(i instanceof Error&&i.message==="Capacitor sync cancelled")return!0;throw i}}return!0}async function zF(t){await ge(),await by(t,!1)}async function KF(t){await ge(),await $7(t,!1)}var bn=require("node:fs"),wy=require("node:os");function GF(){let t=(0,wy.homedir)();return(0,bn.existsSync)(`${t}/.capgo`)||(0,bn.existsSync)(".capgo")}async function vy(t,e,r=!1){if(r||ee("Login to Capgo"),!t)throw r||f.error("Missing API key, you need to provide an API key to upload your bundle"),new Error("Missing API key");await ge();let{local:n}=e;if(n){if(!(0,bn.existsSync)(".git"))throw r||f.error("To use local you should be in a git repository"),new Error("Not in a git repository");(0,bn.writeFileSync)(".capgo",`${t}
|
|
274
274
|
`),(0,bn.appendFileSync)(".gitignore",`.capgo
|
|
275
275
|
`)}else{let a=(0,wy.homedir)();(0,bn.writeFileSync)(`${a}/.capgo`,`${t}
|
|
276
276
|
`)}let o=await re(t,e.supaHost,e.supaAnon),i=await ie(o,t,["write","all","upload"]);await de(t,{channel:"user-login",event:"User CLI login",icon:"\u2705",user_id:i,notify:!1}).catch(),r||(f.success(`login saved into .capgo file in ${n?"local":"home"} directory`),Z("Done \u2705"))}async function WF(t,e){await vy(t,e,!1)}var YF="import { CapacitorUpdater } from '@capgo/capacitor-updater'",Ef="CapacitorUpdater.notifyAppReady()",I7=/import.*from.*/g,Ws="production",Cy={stdio:"pipe"},Ys,Vn;function JF(){Ys??=(0,Ie.readdirSync)(_f.default.tmpdir).map(t=>({name:t,full:`${_f.default.tmpdir}/${t}`})).find(t=>t.name.startsWith("capgocli"))?.full??_f.default.fileSync({prefix:"capgocli"}).name}function mr(t,e){try{JF(),(0,Ie.writeFileSync)(Ys,JSON.stringify(e?{step_done:t,pathToPackageJson:e}:{step_done:t,pathToPackageJson:Vn})),e&&(Vn=e)}catch(r){f.error(`Cannot mark step as done in the CLI, error:
|
|
@@ -316,7 +316,7 @@ Example: npx @capgo/cli@latest init YOUR_API_KEY com.example.app`).action(XF).op
|
|
|
316
316
|
|
|
317
317
|
This command helps diagnose issues with your setup.
|
|
318
318
|
|
|
319
|
-
Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",K.packageJson).action(async(...t)=>{let e=t.at(-1);await
|
|
319
|
+
Example: npx @capgo/cli@latest doctor`).option("--package-json <packageJson>",K.packageJson).action(async(...t)=>{let e=t.at(-1);await n1(e)});ot.command("login [apikey]").alias("l").description(`\u{1F511} Save your Capgo API key to your machine or local folder for easier access to Capgo Cloud services.
|
|
320
320
|
|
|
321
321
|
Use --apikey=******** in any command to override it.
|
|
322
322
|
|
|
@@ -329,23 +329,23 @@ Capgo never inspects external content. Add encryption for trustless security.
|
|
|
329
329
|
|
|
330
330
|
Example: npx @capgo/cli@latest bundle upload com.example.app --path ./dist --channel production`).action(hF).option("-a, --apikey <apikey>",K.apikey).option("-p, --path <path>","Path of the folder to upload, if not provided it will use the webDir set in capacitor.config").option("-c, --channel <channel>","Channel to link to").option("-e, --external <url>","Link to external URL instead 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>","API key for your S3 endpoint").option("--s3-apisecret <apisecret>","API secret for your S3 endpoint").option("--s3-endpoint <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-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 source 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("--link <link>","Link to external resource (e.g. GitHub release)").option("--comment <comment>","Comment about this version, could be a release note, a commit hash, a commit message, etc.").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","[DEPRECATED] Use --tus instead. Uses multipart protocol for S3 uploads").option("--zip","Upload the bundle using zip to Capgo cloud (legacy)").option("--tus","Upload the bundle using TUS to Capgo cloud").option("--tus-chunk-size <tusChunkSize>","Chunk size in bytes for TUS resumable uploads (default: auto)").option("--partial","[DEPRECATED] Use --delta instead. Upload incremental updates").option("--partial-only","[DEPRECATED] Use --delta-only instead. Upload only incremental updates, skip full bundle").option("--delta","Upload incremental/differential updates to reduce bandwidth").option("--delta-only","Upload only delta updates without full bundle (useful for large apps)").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 (Used by Capgo for internal testing)").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--encrypt-partial","Encrypt delta update files (auto-enabled for updater > 6.14.4)").option("--delete-linked-bundle-on-upload","Locates the currently linked bundle in the channel you are trying to upload to, and deletes it").option("--no-brotli-patterns <patterns>",'Files to exclude from Brotli compression (comma-separated globs, e.g., "*.jpg,*.png")').option("--disable-brotli","Completely disable brotli compression even if updater version supports it").option("--version-exists-ok","Exit successfully if bundle version already exists, useful for CI/CD workflows with monorepos").option("--self-assign","Allow devices to auto-join this channel (updates channel setting)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon).option("--verbose",K.verbose);zn.command("compatibility [appId]").description(`\u{1F9EA} Check compatibility of a bundle with a specific channel in Capgo Cloud to ensure updates are safe.
|
|
331
331
|
|
|
332
|
-
Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action($
|
|
332
|
+
Example: npx @capgo/cli@latest bundle compatibility com.example.app --channel production`).action($1).option("-a, --apikey <apikey>",K.apikey).option("-c, --channel <channel>","Channel to check the compatibility with").option("--text","Output text instead of emojis").option("--package-json <packageJson>",K.packageJson).option("--node-modules <nodeModules>",K.nodeModules).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);zn.command("delete [bundleId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a specific bundle from Capgo Cloud, optionally targeting a single version.
|
|
333
333
|
|
|
334
|
-
Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await
|
|
334
|
+
Example: npx @capgo/cli@latest bundle delete BUNDLE_ID com.example.app`).action(async(t,e,r)=>{await j1(t,e,r)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);zn.command("list [appId]").alias("l").description(`\u{1F4CB} List all bundles uploaded for an app in Capgo Cloud.
|
|
335
335
|
|
|
336
|
-
Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await
|
|
336
|
+
Example: npx @capgo/cli@latest bundle list com.example.app`).action(async(t,e)=>{await M1(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);zn.command("cleanup [appId]").alias("c").description(`\u{1F9F9} Delete old bundles in Capgo Cloud, keeping specified number of recent versions.
|
|
337
337
|
|
|
338
338
|
Bundles linked to channels are preserved unless --ignore-channel is used.
|
|
339
339
|
|
|
340
|
-
Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await
|
|
340
|
+
Example: npx @capgo/cli@latest bundle cleanup com.example.app --bundle=1.0 --keep=3`).action(async(t,e)=>{await P1(t,e)}).option("-b, --bundle <bundle>","Bundle version number of the app to delete").option("-a, --apikey <apikey>",K.apikey).option("-k, --keep <keep>","Number of versions to keep").option("-f, --force","Force removal").option("--ignore-channel","Delete bundles even if linked to channels (WARNING: deletes channels too)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);zn.command("encrypt [zipPath] [checksum]").description(`\u{1F512} Encrypt a zip bundle for secure external storage.
|
|
341
341
|
|
|
342
342
|
Returns ivSessionKey for upload/decryption. Get checksum using 'bundle zip --json'.
|
|
343
343
|
|
|
344
|
-
Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(
|
|
344
|
+
Example: npx @capgo/cli@latest bundle encrypt ./myapp.zip CHECKSUM`).action(U1).option("--key <key>","Custom path for private signing key").option("--key-data <keyData>","Private signing key").option("-j, --json","Output in JSON");zn.command("decrypt [zipPath] [checksum]").description(`\u{1F513} Decrypt an encrypted bundle (mainly for testing).
|
|
345
345
|
|
|
346
346
|
Prints base64 session key for verification.
|
|
347
347
|
|
|
348
|
-
Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(
|
|
348
|
+
Example: npx @capgo/cli@latest bundle decrypt ./myapp_encrypted.zip CHECKSUM`).action(L1).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");zn.command("zip [appId]").description(`\u{1F5DC}\uFE0F Create a zip file of your app bundle.
|
|
349
349
|
|
|
350
350
|
Returns checksum for use with encryption. Use --json for machine-readable output.
|
|
351
351
|
|
|
@@ -355,9 +355,9 @@ All options can be guessed from config if not provided.
|
|
|
355
355
|
|
|
356
356
|
Example: npx @capgo/cli@latest app add com.example.app --name "My App" --icon ./icon.png`).action(QA).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);wa.command("delete [appId]").description(`\u{1F5D1}\uFE0F Delete an app from Capgo Cloud, optionally specifying a version to delete only that bundle.
|
|
357
357
|
|
|
358
|
-
Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await
|
|
358
|
+
Example: npx @capgo/cli@latest app delete com.example.app`).action(async(t,e)=>{await e1(t,e)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);wa.command("list").alias("l").description(`\u{1F4CB} List all apps registered under your account in Capgo Cloud.
|
|
359
359
|
|
|
360
|
-
Example: npx @capgo/cli@latest app list`).action(async t=>{await
|
|
360
|
+
Example: npx @capgo/cli@latest app list`).action(async t=>{await o1(t)}).option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);wa.command("debug [appId]").action(rE).description(`\u{1F41E} Listen for live update events in Capgo Cloud to debug your app.
|
|
361
361
|
|
|
362
362
|
Optionally target a specific device for detailed diagnostics.
|
|
363
363
|
|
|
@@ -365,11 +365,11 @@ Example: npx @capgo/cli@latest app debug com.example.app --device DEVICE_ID`).op
|
|
|
365
365
|
|
|
366
366
|
Specify setting path (e.g., plugins.CapacitorUpdater.defaultChannel) with --string or --bool.
|
|
367
367
|
|
|
368
|
-
Example: npx @capgo/cli@latest app setting plugins.CapacitorUpdater.defaultChannel --string "Production"`).option("--bool <bool>","A value for the setting to modify as a boolean, ex: --bool true").option("--string <string>",'A value for the setting to modify as a string, ex: --string "Production"').action(
|
|
368
|
+
Example: npx @capgo/cli@latest app setting plugins.CapacitorUpdater.defaultChannel --string "Production"`).option("--bool <bool>","A value for the setting to modify as a boolean, ex: --bool true").option("--string <string>",'A value for the setting to modify as a string, ex: --string "Production"').action(s1);wa.command("set [appId]").alias("s").description(`\u2699\uFE0F Update settings for an existing app in Capgo Cloud, such as name, icon, or retention period for bundles.
|
|
369
369
|
|
|
370
370
|
Retention of 0 means infinite storage.
|
|
371
371
|
|
|
372
|
-
Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await
|
|
372
|
+
Example: npx @capgo/cli@latest app set com.example.app --name "Updated App" --retention 30`).action(async(t,e)=>{await a1(t,e)}).option("-n, --name <name>","App name for display in Capgo Cloud").option("-i, --icon <icon>","App icon path for display in Capgo Cloud").option("-a, --apikey <apikey>",K.apikey).option("-r, --retention <retention>","Days to keep old bundles (0 = infinite, default: 0)").option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Js=ot.command("channel").description("\u{1F4E2} Manage distribution channels for app updates in Capgo Cloud, controlling how updates are delivered to devices.");Js.command("add [channelId] [appId]").alias("a").description(`\u2795 Create a new channel for app distribution in Capgo Cloud to manage update delivery.
|
|
373
373
|
|
|
374
374
|
Example: npx @capgo/cli@latest channel add production com.example.app --default`).action(DF).option("-d, --default","Set the channel as default").option("--self-assign","Allow device to self-assign to this channel").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);Js.command("delete [channelId] [appId]").alias("d").description(`\u{1F5D1}\uFE0F Delete a channel from Capgo Cloud, optionally removing associated bundles to free up resources.
|
|
375
375
|
|
|
@@ -428,7 +428,7 @@ The build will be processed and sent directly to app stores.
|
|
|
428
428
|
\u{1F4CB} PREREQUISITE: Save credentials first with:
|
|
429
429
|
npx @capgo/cli build credentials save --appId <app-id> --platform <ios|android>
|
|
430
430
|
|
|
431
|
-
Example: npx @capgo/cli@latest build request com.example.app --platform ios --path .`).action(
|
|
431
|
+
Example: npx @capgo/cli@latest build request com.example.app --platform ios --path .`).action(v1).option("--path <path>","Path to the project directory to build (default: current directory)").option("--platform <platform>","Target platform: ios or android (required)").option("--build-mode <buildMode>","Build mode: debug or release (default: release)").option("--build-config <buildConfig>","Additional build configuration as JSON string").option("--build-certificate-base64 <cert>","iOS: Base64-encoded .p12 certificate").option("--build-provision-profile-base64 <profile>","iOS: Base64-encoded provisioning profile").option("--build-provision-profile-base64-prod <profile>","iOS: Base64-encoded production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-id <email>","iOS: Apple ID email").option("--apple-app-specific-password <password>","iOS: App-specific password").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-key-content <content>","iOS: Base64-encoded App Store Connect API key (.p8)").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--app-store-connect-team-id <id>","iOS: App Store Connect Team ID").option("--android-keystore-file <keystore>","Android: Base64-encoded keystore file").option("--keystore-key-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config-json <json>","Android: Base64-encoded Google Play service account JSON").option("-a, --apikey <apikey>",K.apikey).option("--supa-host <supaHost>",K.supaHost).option("--supa-anon <supaAnon>",K.supaAnon);var Oy=QF.command("credentials").description(`Manage build credentials stored locally on your machine.
|
|
432
432
|
|
|
433
433
|
\u{1F512} SECURITY:
|
|
434
434
|
- Credentials saved to ~/.capgo-credentials/credentials.json (local machine only)
|
|
@@ -465,13 +465,13 @@ Android Example:
|
|
|
465
465
|
--keystore-alias "my-key" \\
|
|
466
466
|
--keystore-key-password "key-pass" \\
|
|
467
467
|
--keystore-store-password "store-pass" \\
|
|
468
|
-
--play-config ./service-account.json`).action(
|
|
468
|
+
--play-config ./service-account.json`).action(m1).option("--appId <appId>","App ID (e.g., com.example.app) (required)").option("--platform <platform>","Platform: ios or android (required)").option("--certificate <path>","iOS: Path to .p12 certificate file").option("--provisioning-profile <path>","iOS: Path to provisioning profile (.mobileprovision)").option("--provisioning-profile-prod <path>","iOS: Path to production provisioning profile").option("--p12-password <password>","iOS: Certificate password (optional if cert has no password)").option("--apple-key <path>","iOS: Path to .p8 App Store Connect API key").option("--apple-key-id <id>","iOS: App Store Connect API Key ID").option("--apple-issuer-id <id>","iOS: App Store Connect Issuer ID").option("--apple-profile-name <name>","iOS: Provisioning profile name").option("--apple-team-id <id>","iOS: App Store Connect Team ID").option("--apple-id <email>","iOS: Apple ID email (optional)").option("--apple-app-password <password>","iOS: App-specific password (optional)").option("--keystore <path>","Android: Path to keystore file (.keystore or .jks)").option("--keystore-alias <alias>","Android: Keystore key alias").option("--keystore-key-password <password>","Android: Keystore key password").option("--keystore-store-password <password>","Android: Keystore store password").option("--play-config <path>","Android: Path to Play Store service account JSON");Oy.command("list").description(`List saved build credentials (passwords masked).
|
|
469
469
|
|
|
470
470
|
Shows what credentials are currently saved in ~/.capgo-credentials/credentials.json
|
|
471
471
|
|
|
472
472
|
Examples:
|
|
473
473
|
npx @capgo/cli build credentials list # List all apps
|
|
474
|
-
npx @capgo/cli build credentials list --appId com.example.app # List specific app`).action(
|
|
474
|
+
npx @capgo/cli build credentials list --appId com.example.app # List specific app`).action(g1).option("--appId <appId>","App ID to list (optional, lists all if omitted)");Oy.command("clear").description(`Clear saved build credentials.
|
|
475
475
|
|
|
476
476
|
Remove credentials from ~/.capgo-credentials/credentials.json
|
|
477
477
|
Use --appId and --platform to target specific credentials.
|
|
@@ -479,7 +479,7 @@ Use --appId and --platform to target specific credentials.
|
|
|
479
479
|
Examples:
|
|
480
480
|
npx @capgo/cli build credentials clear # Clear all apps
|
|
481
481
|
npx @capgo/cli build credentials clear --appId com.example.app # Clear specific app
|
|
482
|
-
npx @capgo/cli build credentials clear --appId com.example.app --platform ios # Clear iOS only`).action(
|
|
482
|
+
npx @capgo/cli build credentials clear --appId com.example.app --platform ios # Clear iOS only`).action(y1).option("--appId <appId>","App ID to clear (optional, clears all apps if omitted)").option("--platform <platform>","Platform to clear: ios or android (optional, clears all platforms if omitted)");ot.command("generate-docs [filePath]").description("Generate Markdown documentation for CLI commands - either for README or individual files").option("--folder <folderPath>","Generate individual markdown files for each command in the specified folder (instead of updating README)").action((t,e)=>{_F(t,e.folder)});ot.exitOverride();ot.configureOutput({writeErr:t=>{}});ot.parseAsync().catch(t=>{if(typeof t=="object"&&t!==null&&"code"in t){let e=t;(e.code==="commander.version"||e.code==="commander.helpDisplayed")&&(0,Sf.exit)(0),e.message&&console.error(e.message);let r=e.exitCode??1;(0,Sf.exit)(r)}console.error(`Error: ${U(t)}`),(0,Sf.exit)(1)});
|
|
483
483
|
/*! Bundled license information:
|
|
484
484
|
|
|
485
485
|
tus-js-client/lib.es5/upload.js:
|