@gadgetinc/ggt 1.3.1 → 1.3.3

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.
Files changed (39) hide show
  1. package/dist/{add-CVO2CSA3.js → add-R6TZAGXK.js} +2 -2
  2. package/dist/{chunk-XB3JTJT6.js → chunk-AGPFNOXG.js} +2 -2
  3. package/dist/{chunk-MIN6ZMLJ.js → chunk-E3I3MPQD.js} +2 -2
  4. package/dist/{chunk-6BXHYE2C.js → chunk-IPKFNVOS.js} +3 -3
  5. package/dist/{chunk-6BXHYE2C.js.map → chunk-IPKFNVOS.js.map} +1 -1
  6. package/dist/{chunk-ACR6CVXY.js → chunk-NGYGSK7A.js} +2 -2
  7. package/dist/{chunk-YESACFSR.js → chunk-NO72UU5F.js} +2 -2
  8. package/dist/chunk-RIIVR43B.js +50 -0
  9. package/dist/{chunk-O2K4B6AL.js.map → chunk-RIIVR43B.js.map} +3 -3
  10. package/dist/{chunk-W5JAWOQQ.js → chunk-TMPKLC3N.js} +2 -2
  11. package/dist/{deploy-6JPQ4SNV.js → deploy-2SXBPB5C.js} +2 -2
  12. package/dist/{dev-ZPSCK7JQ.js → dev-I23ZQELT.js} +2 -2
  13. package/dist/{list-A7LFGUXG.js → list-ML7QUWEU.js} +2 -2
  14. package/dist/login-CEGC4DIJ.js +2 -0
  15. package/dist/main.js +1 -1
  16. package/dist/{open-MWPVVE7V.js → open-5DTFJE26.js} +2 -2
  17. package/dist/{pull-WEYQPN7H.js → pull-TC2GVZRD.js} +4 -4
  18. package/dist/{pull-WEYQPN7H.js.map → pull-TC2GVZRD.js.map} +2 -2
  19. package/dist/push-DUSAXZ3K.js +2 -0
  20. package/dist/{status-GI5XJQTQ.js → status-2CZXUGSZ.js} +2 -2
  21. package/dist/{whoami-PPXXBHUR.js → whoami-NI52A6U4.js} +2 -2
  22. package/package.json +9 -9
  23. package/dist/chunk-O2K4B6AL.js +0 -50
  24. package/dist/login-BP4XIHLA.js +0 -2
  25. package/dist/push-S4CWMHMS.js +0 -2
  26. /package/dist/{add-CVO2CSA3.js.map → add-R6TZAGXK.js.map} +0 -0
  27. /package/dist/{chunk-XB3JTJT6.js.map → chunk-AGPFNOXG.js.map} +0 -0
  28. /package/dist/{chunk-MIN6ZMLJ.js.map → chunk-E3I3MPQD.js.map} +0 -0
  29. /package/dist/{chunk-ACR6CVXY.js.map → chunk-NGYGSK7A.js.map} +0 -0
  30. /package/dist/{chunk-YESACFSR.js.map → chunk-NO72UU5F.js.map} +0 -0
  31. /package/dist/{chunk-W5JAWOQQ.js.map → chunk-TMPKLC3N.js.map} +0 -0
  32. /package/dist/{deploy-6JPQ4SNV.js.map → deploy-2SXBPB5C.js.map} +0 -0
  33. /package/dist/{dev-ZPSCK7JQ.js.map → dev-I23ZQELT.js.map} +0 -0
  34. /package/dist/{list-A7LFGUXG.js.map → list-ML7QUWEU.js.map} +0 -0
  35. /package/dist/{login-BP4XIHLA.js.map → login-CEGC4DIJ.js.map} +0 -0
  36. /package/dist/{open-MWPVVE7V.js.map → open-5DTFJE26.js.map} +0 -0
  37. /package/dist/{push-S4CWMHMS.js.map → push-DUSAXZ3K.js.map} +0 -0
  38. /package/dist/{status-GI5XJQTQ.js.map → status-2CZXUGSZ.js.map} +0 -0
  39. /package/dist/{whoami-PPXXBHUR.js.map → whoami-NI52A6U4.js.map} +0 -0
@@ -1,4 +1,4 @@
1
- import{f as U,g as L,h as S,i as O,j as R,o as P}from"./chunk-6BXHYE2C.js";import{g as F,l as j,m as M,n as N,o as k}from"./chunk-MIN6ZMLJ.js";import"./chunk-HCQR6OPH.js";import"./chunk-W5JAWOQQ.js";import{c as f}from"./chunk-YESACFSR.js";import"./chunk-FQ2LR3BI.js";import"./chunk-XB3JTJT6.js";import{a as T,f as v,g as E,j as y,n as $,p as u,x as C,y as B}from"./chunk-O2K4B6AL.js";import"./chunk-AGRDDZFS.js";import{$ as p,Z as r,b as m,m as b}from"./chunk-GIAIN3IJ.js";import"./chunk-B6XQEEUK.js";import{g as _}from"./chunk-SGMPMYEU.js";_();var h=class extends E{isBug=v.NO;constructor(t){let n="";if(b(t.cause)){let a=$(t.cause.map(e=>e.message));n=r` • ${a.map(e=>e.split(`
1
+ import{f as U,g as L,h as S,i as O,j as R,o as P}from"./chunk-IPKFNVOS.js";import{g as F,l as j,m as M,n as N,o as k}from"./chunk-E3I3MPQD.js";import"./chunk-HCQR6OPH.js";import"./chunk-TMPKLC3N.js";import{c as f}from"./chunk-NO72UU5F.js";import"./chunk-FQ2LR3BI.js";import"./chunk-AGPFNOXG.js";import{a as T,f as v,g as E,j as y,n as $,p as u,x as C,y as B}from"./chunk-RIIVR43B.js";import"./chunk-AGRDDZFS.js";import{$ as p,Z as r,b as m,m as b}from"./chunk-GIAIN3IJ.js";import"./chunk-B6XQEEUK.js";import{g as _}from"./chunk-SGMPMYEU.js";_();var h=class extends E{isBug=v.NO;constructor(t){let n="";if(b(t.cause)){let a=$(t.cause.map(e=>e.message));n=r` • ${a.map(e=>e.split(`
2
2
  `).join(`
3
3
  \u200E \u2022 `)).join(`
4
4
  `)}`}else n=r`${t.cause}`;super(n)}render(){return`${m.redBright(y.cross)} Failed to add:
@@ -75,4 +75,4 @@ import{f as U,g as L,h as S,i as O,j as R,o as P}from"./chunk-6BXHYE2C.js";impor
75
75
 
76
76
  {gray Usage}
77
77
  {cyanBright ggt add field ${e[0]}/<field_name>:<field_type>}`);try{let i=(await a.edit.mutate({mutation:O,variables:{path:e[0],fields:s.map(d=>({name:d.name,fieldType:d.fieldType}))}})).createModelFields;await n.writeToLocalFilesystem(o,{filesVersion:i.remoteFilesVersion,files:i.changed,delete:[]})}catch(i){throw i instanceof u?new h(i):i}p({ensureEmptyLineAbove:!0,content:`Field ${m.cyanBright(s[0]?.name)} added successfully.`})};export{h as AddClientError,ce as args,me as run,I as usage};
78
- //# sourceMappingURL=add-CVO2CSA3.js.map
78
+ //# sourceMappingURL=add-R6TZAGXK.js.map
@@ -1,4 +1,4 @@
1
- import{E as se,b as oe,r as ne,s as ie}from"./chunk-O2K4B6AL.js";import{e as G}from"./chunk-AGRDDZFS.js";import{$ as p,D,F as te,G as E,P as w,U as x,Z as T,_ as H,b as A,e as h}from"./chunk-GIAIN3IJ.js";import{d as Ae,g as s}from"./chunk-SGMPMYEU.js";s();s();import Ee from"node:net";import Te from"node:os";var I=class extends Error{constructor(r){super(`${r} is locked`)}},b={old:new Set,young:new Set},Le=1e3*15;var L,$e=()=>{let e=Te.networkInterfaces(),r=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(e))for(let o of t)r.add(o.address);return r},ae=e=>new Promise((r,t)=>{let o=Ee.createServer();o.unref(),o.on("error",t),o.listen(e,()=>{let{port:n}=o.address();o.close(()=>{r(n)})})}),ce=async(e,r)=>{if(e.host||e.port===0)return ae(e);for(let t of r)try{await ae({port:e.port,host:t})}catch(o){if(!["EADDRNOTAVAIL","EINVAL"].includes(o.code))throw o}return e.port},Be=function*(e){e&&(yield*e),yield 0};async function _(e){let r,t=new Set;if(e&&(e.port&&(r=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let n=e.exclude;if(typeof n[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let a of n){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}t=new Set(n)}L===void 0&&(L=setTimeout(()=>{L=void 0,b.old=b.young,b.young=new Set},Le),L.unref&&L.unref());let o=$e();for(let n of Be(r))try{if(t.has(n))continue;let a=await ce({...e,port:n},o);for(;b.old.has(a)||b.young.has(a);){if(n!==0)throw new I(n);a=await ce({...e,port:n},o)}return b.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof I))throw a}throw new Error("No available ports found")}import re from"node:assert";import Wr from"node:http";s();import R from"node:process";import{Buffer as Ke}from"node:buffer";import me from"node:path";import{fileURLToPath as Ye}from"node:url";import Xe from"node:child_process";import q,{constants as he}from"node:fs/promises";s();function g(e,r,t){let o=n=>Object.defineProperty(e,r,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let n=t();return o(n),n},set(n){o(n)}}),e}s();import{promisify as Ge}from"node:util";import Y from"node:process";import{execFile as _e}from"node:child_process";s();import{promisify as Ce}from"node:util";import We from"node:process";import{execFile as Ie}from"node:child_process";var Ne=Ce(Ie);async function j(){if(We.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await Ne("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari"}s();s();import Re from"node:process";import{promisify as ke}from"node:util";import{execFile as Fe,execFileSync as Yr}from"node:child_process";var Oe=ke(Fe);async function le(e,{humanReadableOutput:r=!0}={}){if(Re.platform!=="darwin")throw new Error("macOS only");let t=r?[]:["-ss"],{stdout:o}=await Oe("osascript",["-e",e,t]);return o.trim()}async function z(e){return le(`tell application "Finder" to set app_path to application file id "${e}" as string
1
+ import{E as se,b as oe,r as ne,s as ie}from"./chunk-RIIVR43B.js";import{e as G}from"./chunk-AGRDDZFS.js";import{$ as p,D,F as te,G as E,P as w,U as x,Z as T,_ as H,b as A,e as h}from"./chunk-GIAIN3IJ.js";import{d as Ae,g as s}from"./chunk-SGMPMYEU.js";s();s();import Ee from"node:net";import Te from"node:os";var I=class extends Error{constructor(r){super(`${r} is locked`)}},b={old:new Set,young:new Set},Le=1e3*15;var L,$e=()=>{let e=Te.networkInterfaces(),r=new Set([void 0,"0.0.0.0"]);for(let t of Object.values(e))for(let o of t)r.add(o.address);return r},ae=e=>new Promise((r,t)=>{let o=Ee.createServer();o.unref(),o.on("error",t),o.listen(e,()=>{let{port:n}=o.address();o.close(()=>{r(n)})})}),ce=async(e,r)=>{if(e.host||e.port===0)return ae(e);for(let t of r)try{await ae({port:e.port,host:t})}catch(o){if(!["EADDRNOTAVAIL","EINVAL"].includes(o.code))throw o}return e.port},Be=function*(e){e&&(yield*e),yield 0};async function _(e){let r,t=new Set;if(e&&(e.port&&(r=typeof e.port=="number"?[e.port]:e.port),e.exclude)){let n=e.exclude;if(typeof n[Symbol.iterator]!="function")throw new TypeError("The `exclude` option must be an iterable.");for(let a of n){if(typeof a!="number")throw new TypeError("Each item in the `exclude` option must be a number corresponding to the port you want excluded.");if(!Number.isSafeInteger(a))throw new TypeError(`Number ${a} in the exclude option is not a safe integer and can't be used`)}t=new Set(n)}L===void 0&&(L=setTimeout(()=>{L=void 0,b.old=b.young,b.young=new Set},Le),L.unref&&L.unref());let o=$e();for(let n of Be(r))try{if(t.has(n))continue;let a=await ce({...e,port:n},o);for(;b.old.has(a)||b.young.has(a);){if(n!==0)throw new I(n);a=await ce({...e,port:n},o)}return b.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof I))throw a}throw new Error("No available ports found")}import re from"node:assert";import Wr from"node:http";s();import R from"node:process";import{Buffer as Ke}from"node:buffer";import me from"node:path";import{fileURLToPath as Ye}from"node:url";import Xe from"node:child_process";import q,{constants as he}from"node:fs/promises";s();function g(e,r,t){let o=n=>Object.defineProperty(e,r,{value:n,enumerable:!0,writable:!0});return Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get(){let n=t();return o(n),n},set(n){o(n)}}),e}s();import{promisify as Ge}from"node:util";import Y from"node:process";import{execFile as _e}from"node:child_process";s();import{promisify as Ce}from"node:util";import We from"node:process";import{execFile as Ie}from"node:child_process";var Ne=Ce(Ie);async function j(){if(We.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await Ne("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari"}s();s();import Re from"node:process";import{promisify as ke}from"node:util";import{execFile as Fe,execFileSync as Yr}from"node:child_process";var Oe=ke(Fe);async function le(e,{humanReadableOutput:r=!0}={}){if(Re.platform!=="darwin")throw new Error("macOS only");let t=r?[]:["-ss"],{stdout:o}=await Oe("osascript",["-e",e,t]);return o.trim()}async function z(e){return le(`tell application "Finder" to set app_path to application file id "${e}" as string
2
2
  tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}s();import{promisify as Ue}from"node:util";import{execFile as Me}from"node:child_process";var De=Ue(Me),He={AppXq0fevzme2pys62n3e0fbqa7peapykr8v:{name:"Edge",id:"com.microsoft.edge.old"},MSEdgeDHTML:{name:"Edge",id:"com.microsoft.edge"},MSEdgeHTM:{name:"Edge",id:"com.microsoft.edge"},"IE.HTTP":{name:"Internet Explorer",id:"com.microsoft.ie"},FirefoxURL:{name:"Firefox",id:"org.mozilla.firefox"},ChromeHTML:{name:"Chrome",id:"com.google.chrome"},BraveHTML:{name:"Brave",id:"com.brave.Browser"},BraveBHTML:{name:"Brave Beta",id:"com.brave.Browser.beta"},BraveSSHTM:{name:"Brave Nightly",id:"com.brave.Browser.nightly"}},N=class extends Error{};async function K(e=De){let{stdout:r}=await e("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),t=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(r);if(!t)throw new N(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);let{id:o}=t.groups,n=He[o];if(!n)throw new N(`Unknown browser ID: ${o}`);return n}var je=Ge(_e),ze=e=>e.toLowerCase().replaceAll(/(?:^|\s|-)\S/g,r=>r.toUpperCase());async function X(){if(Y.platform==="darwin"){let e=await j();return{name:await z(e),id:e}}if(Y.platform==="linux"){let{stdout:e}=await je("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:ze(r.replace(/.desktop$/,"").replace("-"," ")),id:r}}if(Y.platform==="win32")return K();throw new Error("Only macOS, Linux, and Windows are supported")}var J=me.dirname(Ye(import.meta.url)),ue=me.join(J,"xdg-open"),{platform:y,arch:de}=R,qe=(()=>{let e="/mnt/",r;return async function(){if(r)return r;let t="/etc/wsl.conf",o=!1;try{await q.access(t,he.F_OK),o=!0}catch{}if(!o)return e;let n=await q.readFile(t,{encoding:"utf8"}),a=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(n);return a?(r=a.groups.mountPoint.trim(),r=r.endsWith("/")?r:`${r}/`,r):e}})(),pe=async(e,r)=>{let t;for(let o of e)try{return await r(o)}catch(n){t=n}throw t},k=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return pe(e.app,l=>k({...e,app:l}));let{name:r,arguments:t=[]}=e.app??{};if(t=[...t],Array.isArray(r))return pe(r,l=>k({...e,app:{name:l,arguments:t}}));if(r==="browser"||r==="browserPrivate"){let l={"com.google.chrome":"chrome","google-chrome.desktop":"chrome","org.mozilla.firefox":"firefox","firefox.desktop":"firefox","com.microsoft.msedge":"edge","com.microsoft.edge":"edge","microsoft-edge.desktop":"edge"},c={chrome:"--incognito",firefox:"--private-window",edge:"--inPrivate"},u=await X();if(u.id in l){let m=l[u.id];return r==="browserPrivate"&&t.push(c[m]),k({...e,app:{name:v[m],arguments:t}})}throw new Error(`${u.name} is not supported as a default browser`)}let o,n=[],a={};if(y==="darwin")o="open",e.wait&&n.push("--wait-apps"),e.background&&n.push("--background"),e.newInstance&&n.push("--new"),r&&n.push("-a",r);else if(y==="win32"||E&&!te()&&!r){let l=await qe();o=E?`${l}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${R.env.SYSTEMROOT||R.env.windir||"C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell`,n.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),E||(a.windowsVerbatimArguments=!0);let c=["Start"];e.wait&&c.push("-Wait"),r?(c.push(`"\`"${r}\`""`),e.target&&t.push(e.target)):e.target&&c.push(`"${e.target}"`),t.length>0&&(t=t.map(u=>`"\`"${u}\`""`),c.push("-ArgumentList",t.join(","))),e.target=Ke.from(c.join(" "),"utf16le").toString("base64")}else{if(r)o=r;else{let l=!J||J==="/",c=!1;try{await q.access(ue,he.X_OK),c=!0}catch{}o=R.versions.electron??(y==="android"||l||!c)?"xdg-open":ue}t.length>0&&n.push(...t),e.wait||(a.stdio="ignore",a.detached=!0)}y==="darwin"&&t.length>0&&n.push("--args",...t),e.target&&n.push(e.target);let d=Xe.spawn(o,n,a);return e.wait?new Promise((l,c)=>{d.once("error",c),d.once("close",u=>{if(!e.allowNonzeroExitCode&&u>0){c(new Error(`Exited with code ${u}`));return}l(d)})}):(d.unref(),d)},Je=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return k({...r,target:e})};function fe(e){if(typeof e=="string"||Array.isArray(e))return e;let{[de]:r}=e;if(!r)throw new Error(`${de} is not supported`);return r}function V({[y]:e},{wsl:r}){if(r&&E)return fe(r);if(!e)throw new Error(`${y} is not supported`);return fe(e)}var v={};g(v,"chrome",()=>V({darwin:"google chrome",win32:"chrome",linux:["google-chrome","google-chrome-stable","chromium"]},{wsl:{ia32:"/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",x64:["/mnt/c/Program Files/Google/Chrome/Application/chrome.exe","/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe"]}}));g(v,"firefox",()=>V({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));g(v,"edge",()=>V({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));g(v,"browser",()=>"browser");g(v,"browserPrivate",()=>"browserPrivate");var ge=Je;s();import Br from"node:assert";s();import W from"node:process";s();s();var O={};Ae(O,{beep:()=>Sr,clearScreen:()=>xr,clearTerminal:()=>br,cursorBackward:()=>or,cursorDown:()=>rr,cursorForward:()=>tr,cursorGetPosition:()=>sr,cursorHide:()=>lr,cursorLeft:()=>be,cursorMove:()=>er,cursorNextLine:()=>ar,cursorPrevLine:()=>cr,cursorRestorePosition:()=>ir,cursorSavePosition:()=>nr,cursorShow:()=>ur,cursorTo:()=>Ze,cursorUp:()=>xe,enterAlternativeScreen:()=>yr,eraseDown:()=>mr,eraseEndLine:()=>pr,eraseLine:()=>ye,eraseLines:()=>dr,eraseScreen:()=>Q,eraseStartLine:()=>fr,eraseUp:()=>hr,exitAlternativeScreen:()=>vr,iTerm:()=>Er,image:()=>Ar,link:()=>Pr,scrollDown:()=>wr,scrollUp:()=>gr});s();import Z from"node:process";s();var F=globalThis.window?.document!==void 0,Pt=globalThis.process?.versions?.node!==void 0,At=globalThis.process?.versions?.bun!==void 0,Et=globalThis.Deno?.version?.deno!==void 0,Tt=globalThis.process?.versions?.electron!==void 0,Lt=globalThis.navigator?.userAgent?.includes("jsdom")===!0,$t=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Bt=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,Ct=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,Wt=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,$=globalThis.navigator?.userAgentData?.platform,It=$==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",Nt=$==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",Rt=$==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",kt=$==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),Ft=$==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var i="\x1B[",C="\x1B]",S="\x07",B=";",we=!F&&Z.env.TERM_PROGRAM==="Apple_Terminal",Ve=!F&&Z.platform==="win32",Qe=F?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:Z.cwd,Ze=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof r!="number"?i+(e+1)+"G":i+(r+1)+B+(e+1)+"H"},er=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let t="";return e<0?t+=i+-e+"D":e>0&&(t+=i+e+"C"),r<0?t+=i+-r+"A":r>0&&(t+=i+r+"B"),t},xe=(e=1)=>i+e+"A",rr=(e=1)=>i+e+"B",tr=(e=1)=>i+e+"C",or=(e=1)=>i+e+"D",be=i+"G",nr=we?"\x1B7":i+"s",ir=we?"\x1B8":i+"u",sr=i+"6n",ar=i+"E",cr=i+"F",lr=i+"?25l",ur=i+"?25h",dr=e=>{let r="";for(let t=0;t<e;t++)r+=ye+(t<e-1?xe():"");return e&&(r+=be),r},pr=i+"K",fr=i+"1K",ye=i+"2K",mr=i+"J",hr=i+"1J",Q=i+"2J",gr=i+"S",wr=i+"T",xr="\x1Bc",br=Ve?`${Q}${i}0f`:`${Q}${i}3J${i}H`,yr=i+"?1049h",vr=i+"?1049l",Sr=S,Pr=(e,r)=>[C,"8",B,B,r,S,e,C,"8",B,B,S].join(""),Ar=(e,r={})=>{let t=`${C}1337;File=inline=1`;return r.width&&(t+=`;width=${r.width}`),r.height&&(t+=`;height=${r.height}`),r.preserveAspectRatio===!1&&(t+=";preserveAspectRatio=0"),t+":"+Buffer.from(e).toString("base64")+S},Er={setCwd:(e=Qe())=>`${C}50;CurrentDir=${e}${S}`,annotation(e,r={}){let t=`${C}1337;`,o=r.x!==void 0,n=r.y!==void 0;if((o||n)&&!(o&&n&&r.length!==void 0))throw new Error("`x`, `y` and `length` must be defined when `x` or `y` is defined");return e=e.replaceAll("|",""),t+=r.isHidden?"AddHiddenAnnotation=":"AddAnnotation=",r.length>0?t+=(o?[e,r.length,r.x,r.y]:[r.length,e]).join("|"):t+=e,t+S}};import Tr from"node:assert";import Lr from"node:events";import f from"node:process";import ve from"node:readline";var U=class e extends Lr{static active=!1;value=void 0;firstRender=!0;done=!1;closed=!1;aborted=!1;exited=!1;close;constructor(){super(),Tr(!e.active,"only one prompt can be active at a time"),e.active=!0;let r=ve.createInterface({input:f.stdin,escapeCodeTimeout:50});ve.emitKeypressEvents(f.stdin,r),f.stdin.isTTY&&f.stdin.setRawMode(!0);let t=["SelectPrompt"].includes(this.constructor.name),o=(n,a)=>{let d=$r(a,t);d===!1?this._(n,a):d&&typeof this[d]=="function"?this[d](a):this.bell()};this.close=()=>{f.stdin.removeListener("keypress",o),f.stdin.isTTY&&f.stdin.setRawMode(!1),r.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0,e.active=!1},f.stdin.on("keypress",o)}_(r,t){}onRender(){}fire(){this.emit("state",{value:this.value,aborted:this.aborted,exited:this.exited})}bell(){x.writeStdout(O.beep)}render(){this.onRender(),this.firstRender&&(this.firstRender=!1)}},$r=(e,r)=>{if(!(e.meta&&e.name!=="escape")){if(e.ctrl)switch(e.name){case"a":return"first";case"c":case"d":return"abort";case"e":return"last";case"g":return"reset"}if(r){if(e.name==="j")return"down";if(e.name==="k")return"up"}switch(e.name){case"return":case"enter":return"submit";case"backspace":return"delete";case"delete":return"deleteForward";case"abort":return"abort";case"escape":return"exit";case"tab":return"next";case"pagedown":return"nextPage";case"pageup":return"prevPage";case"home":return"home";case"end":return"end";case"up":return"up";case"down":return"down";case"right":return"right";case"left":return"left";default:return!1}}},Vt=(e,r,t)=>{t=t||r;let o=Math.min(r-t,e-Math.floor(t/2));o<0&&(o=0);let n=Math.min(o+t,r);return{startIndex:o,endIndex:n}};var Se=e=>{let r;if(typeof e=="string"?r={content:e}:r=e,r=D(r,{ensureEmptyLineAbove:!0,ensureNewLine:!0,exitWhenNo:!0}),!x.isInteractive){let t=r.whenNotInteractive??(()=>{p(r),p({ensureEmptyLineAbove:!0,content:"Aborting because ggt is not running in an interactive terminal."}),W.exit(1)});return Promise.resolve(t())}return new Promise(t=>{let o=new ee(r);o.on("submit",t),o.on("exit",()=>W.exit(0)),o.on("abort",()=>W.exit(1))})},ee=class extends U{value=void 0;defaultValue=!1;options;constructor(r){super(),this.options=D(r,{exitWhenNo:!0,ensureEmptyLineAbove:!0}),this.render()}reset(){this.value=this.defaultValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=!1,this.done=this.aborted=!0,this.fire(),this.render(!1),this.close(),this.options.exitWhenNo&&W.exit(0)}submit(){this.value=this.value??!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.close(),this.options.exitWhenNo&&!this.value&&W.exit(0)}_(r,t){if(r.toLowerCase()==="y"){this.value=!0,this.submit();return}if(r.toLowerCase()==="n"){this.value=!1,this.submit();return}this.bell()}render(r=this.value){if(super.render(),this.done){x.persistPrompt(H({...this.options,content:`${this.options.content} ${r?A.bold.greenBright("Yes."):A.bold.redBright("No.")}`}));return}x.updatePrompt(H({...this.options,content:`${this.options.content} ${this.defaultValue?A.blueBright("[Y/n] "):A.blueBright("[y/N] ")}`}))}};var Cr=h.object({id:h.union([h.string(),h.number()]).transform(Number),name:h.string().nullish(),email:h.string()}),M=async e=>{let r=ne(e);if(r)try{let t=await se({context:{ctx:e},url:`https://${w.domains.services}/auth/api/current-user`,headers:r,responseType:"json",resolveBodyOnly:!0}),o=Cr.parse(t);return e.log.info("loaded user",{user:{id:o.id}},{user:o}),oe(o),o}catch(t){ie(e,t);return}},bo=async(e,r)=>{let t=await M(e);return t||(e.log.info("prompting user to log in"),p({ensureEmptyLineAbove:!0,content:`You must be logged in to use "ggt ${r}".`}),await Se({ensureEmptyLineAbove:!0,content:"Would you like to log in?"}),await Pe(e,{_:[]}),t=await M(e),Br(t,"missing user after successful login"),t)};var Wo=()=>T`
3
3
  Log in to your account.
4
4
 
@@ -15,4 +15,4 @@ tell application "System Events" to get value of property list item "CFBundleNam
15
15
 
16
16
  Once logged in, return to this terminal.
17
17
  `})}await o}finally{r?.close()}},Pe=Ir;export{U as a,Vt as b,Se as c,ge as d,Wo as e,Ir as f,Pe as g,M as h,bo as i};
18
- //# sourceMappingURL=chunk-XB3JTJT6.js.map
18
+ //# sourceMappingURL=chunk-AGPFNOXG.js.map
@@ -1,4 +1,4 @@
1
- import{c as V}from"./chunk-YESACFSR.js";import{a as lr}from"./chunk-FQ2LR3BI.js";import{a as yr,b as vr,i as br}from"./chunk-XB3JTJT6.js";import{a as st,c as pr,f as pt,g as mt,j as Pt,l as Wi,m as mr,o as ee,p as Q,t as hr,u as dr,v as re,w as gr,z as ft}from"./chunk-O2K4B6AL.js";import{a as fr}from"./chunk-AGRDDZFS.js";import{$ as z,D as ct,K as lt,P as te,R as ur,U as Et,X as cr,Z as T,_ as R,b as G,e as B,g as tr,h as er,l as rr,m as nr,t as sr,u as ir,v as or,y as ar,z as Qi}from"./chunk-GIAIN3IJ.js";import{a as Vi,c as Zt,e as nt,g as C}from"./chunk-SGMPMYEU.js";var xr=Zt(D=>{"use strict";C();var Ki=D&&D.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(D,"__esModule",{value:!0});var Xi=Vi("fs"),Zi=Ki(lr()),it=Zi.default("@kwsites/file-exists");function to(t,e,r){it("checking %s",t);try{let n=Xi.statSync(t);return n.isFile()&&e?(it("[OK] path represents a file"),!0):n.isDirectory()&&r?(it("[OK] path represents a directory"),!0):(it("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return it("[FAIL] path is not accessible: %o",n),!1;throw it("[FATAL] %o",n),n}}function eo(t,e=D.READABLE){return to(t,(e&D.FILE)>0,(e&D.FOLDER)>0)}D.exists=eo;D.FILE=1;D.FOLDER=2;D.READABLE=D.FILE+D.FOLDER});var Er=Zt(Rt=>{"use strict";C();function ro(t){for(var e in t)Rt.hasOwnProperty(e)||(Rt[e]=t[e])}Object.defineProperty(Rt,"__esModule",{value:!0});ro(xr())});var ue=Zt(Z=>{"use strict";C();Object.defineProperty(Z,"__esModule",{value:!0});Z.createDeferred=Z.deferred=void 0;function ae(){let t,e,r="pending";return{promise:new Promise((s,i)=>{t=s,e=i}),done(s){r==="pending"&&(r="resolved",t(s))},fail(s){r==="pending"&&(r="rejected",e(s))},get fulfilled(){return r!=="pending"},get status(){return r}}}Z.deferred=ae;Z.createDeferred=ae;Z.default=ae});C();var _r=nt(Wi(),1);var Ec=Object.freeze({Fatal:"Fatal",Error:"Error",Warning:"Warning",Info:"Info"}),ne=({problems:t,showFileTypes:e,...r})=>{let n="";for(let[s,i]of Object.entries(t)){n+=R(""),n+=R`• {cyan ${s}} {redBright ${(0,_r.default)("problem",i.length,!0)}}`;for(let o of i){let[a,...c]=o.message.split(`
1
+ import{c as V}from"./chunk-NO72UU5F.js";import{a as lr}from"./chunk-FQ2LR3BI.js";import{a as yr,b as vr,i as br}from"./chunk-AGPFNOXG.js";import{a as st,c as pr,f as pt,g as mt,j as Pt,l as Wi,m as mr,o as ee,p as Q,t as hr,u as dr,v as re,w as gr,z as ft}from"./chunk-RIIVR43B.js";import{a as fr}from"./chunk-AGRDDZFS.js";import{$ as z,D as ct,K as lt,P as te,R as ur,U as Et,X as cr,Z as T,_ as R,b as G,e as B,g as tr,h as er,l as rr,m as nr,t as sr,u as ir,v as or,y as ar,z as Qi}from"./chunk-GIAIN3IJ.js";import{a as Vi,c as Zt,e as nt,g as C}from"./chunk-SGMPMYEU.js";var xr=Zt(D=>{"use strict";C();var Ki=D&&D.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(D,"__esModule",{value:!0});var Xi=Vi("fs"),Zi=Ki(lr()),it=Zi.default("@kwsites/file-exists");function to(t,e,r){it("checking %s",t);try{let n=Xi.statSync(t);return n.isFile()&&e?(it("[OK] path represents a file"),!0):n.isDirectory()&&r?(it("[OK] path represents a directory"),!0):(it("[FAIL] path represents something other than a file or directory"),!1)}catch(n){if(n.code==="ENOENT")return it("[FAIL] path is not accessible: %o",n),!1;throw it("[FATAL] %o",n),n}}function eo(t,e=D.READABLE){return to(t,(e&D.FILE)>0,(e&D.FOLDER)>0)}D.exists=eo;D.FILE=1;D.FOLDER=2;D.READABLE=D.FILE+D.FOLDER});var Er=Zt(Rt=>{"use strict";C();function ro(t){for(var e in t)Rt.hasOwnProperty(e)||(Rt[e]=t[e])}Object.defineProperty(Rt,"__esModule",{value:!0});ro(xr())});var ue=Zt(Z=>{"use strict";C();Object.defineProperty(Z,"__esModule",{value:!0});Z.createDeferred=Z.deferred=void 0;function ae(){let t,e,r="pending";return{promise:new Promise((s,i)=>{t=s,e=i}),done(s){r==="pending"&&(r="resolved",t(s))},fail(s){r==="pending"&&(r="rejected",e(s))},get fulfilled(){return r!=="pending"},get status(){return r}}}Z.deferred=ae;Z.createDeferred=ae;Z.default=ae});C();var _r=nt(Wi(),1);var Ec=Object.freeze({Fatal:"Fatal",Error:"Error",Warning:"Warning",Info:"Info"}),ne=({problems:t,showFileTypes:e,...r})=>{let n="";for(let[s,i]of Object.entries(t)){n+=R(""),n+=R`• {cyan ${s}} {redBright ${(0,_r.default)("problem",i.length,!0)}}`;for(let o of i){let[a,...c]=o.message.split(`
2
2
  `);n+=T` {red ✖} `,(e??o.type==="SourceFile")&&(n+=T`${Hi(s)} `),n+=T(a);for(let p of c)n+=R(""),n+=T` ${p}`;for(let p of o.labels)n+=T` {dim ${p}}`;n+=R("")}}return R({...r,content:n})},Pc=t=>{z(ne(t))},Hi=t=>{switch(!0){case sr(t):return G.yellowBright("JavaScript");case ir(t):return G.blue("TypeScript");case or(t):return G.magenta("Gelly");default:return G.gray("File")}},Cc=t=>{let e={};for(let r of t){let n=r.node?.apiIdentifier??r.node?.name??"Other";e[n]??=[],e[n].push({type:r.node?.type??"Unknown",severity:r.severity,message:r.message,labels:mr(r.nodeLabels?.map(s=>s?.identifier)??[])})}return e},Rc=t=>{let e={};for(let r of t)e[r.path]??=[],e[r.path].push({type:r.type,severity:r.level,message:r.message,labels:[]});return e};C();var kr=class extends mt{isBug=pt.NO;constructor(){super("Yarn not found")}render(){return T`
3
3
  Yarn must be installed to sync your application. You can install it by running:
4
4
 
@@ -114,4 +114,4 @@ import{c as V}from"./chunk-YESACFSR.js";import{a as lr}from"./chunk-FQ2LR3BI.js"
114
114
  • ${a.join(`
115
115
  \u2022 `)}
116
116
  `)},gc=async(t,{directory:e})=>{try{return await ai(e.path).revparse(["--abbrev-ref","HEAD"])}catch(r){t.log.warn("failed to read git branch",{error:r});return}},yc=B.object({application:B.string(),environment:B.string(),environments:B.record(B.object({filesVersion:B.string()}))}),vc=B.object({app:B.string(),filesVersion:B.string(),mtime:B.number()}),bc=B.union([yc,vc]),_c=bc.transform(t=>"environment"in t?t:{application:t.app,environment:"development",environments:{development:{filesVersion:t.filesVersion}}});export{Ec as a,ne as b,Pc as c,Cc as d,Rc as e,kr as f,Ct as g,wr as h,Tr as i,Yi as j,Fc as k,oe as l,yp as m,pi as n,vp as o};
117
- //# sourceMappingURL=chunk-MIN6ZMLJ.js.map
117
+ //# sourceMappingURL=chunk-E3I3MPQD.js.map
@@ -1,4 +1,4 @@
1
- import{b as gt,e as ft,h as ht,j as xe,k as te,l as It}from"./chunk-MIN6ZMLJ.js";import{a as St,b as mt}from"./chunk-HCQR6OPH.js";import{b as $}from"./chunk-W5JAWOQQ.js";import{c as dt}from"./chunk-YESACFSR.js";import{c as Me}from"./chunk-XB3JTJT6.js";import{B as Mt,i as Ee,j as w,k as _r,l as yt,q as bt}from"./chunk-O2K4B6AL.js";import{b as Et,c as xt}from"./chunk-AGRDDZFS.js";import{$ as R,E as ut,H as pt,I as N,L as be,M as Z,P as ee,S as ct,Z as m,_ as k,b,d as rt,g as at,n as ot,p as he,q as st,r as it,s as lt,z as Ar}from"./chunk-GIAIN3IJ.js";import{a as Ir}from"./chunk-B6XQEEUK.js";import{a as v,c as x,e as F,g as u}from"./chunk-SGMPMYEU.js";var Dt=x((hs,Vt)=>{u();Vt.exports=Gt;Gt.sync=Pr;var kt=v("fs");function wr(e,t){var n=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var r=0;r<n.length;r++){var a=n[r].toLowerCase();if(a&&e.substr(-a.length).toLowerCase()===a)return!0}return!1}function Lt(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:wr(t,n)}function Gt(e,t,n){kt.stat(e,function(r,a){n(r,r?!1:Lt(a,e,t))})}function Pr(e,t){return Lt(kt.statSync(e),e,t)}});var jt=x((Es,Qt)=>{u();Qt.exports=Ut;Ut.sync=Or;var Ht=v("fs");function Ut(e,t,n){Ht.stat(e,function(r,a){n(r,r?!1:$t(a,t))})}function Or(e,t){return $t(Ht.statSync(e),t)}function $t(e,t){return e.isFile()&&Br(e,t)}function Br(e,t){var n=e.mode,r=e.uid,a=e.gid,o=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),i=parseInt("100",8),l=parseInt("010",8),p=parseInt("001",8),c=i|l,d=n&p||n&l&&a===s||n&i&&r===o||n&c&&o===0;return d}});var Wt=x((Is,Jt)=>{u();var Ms=v("fs"),ae;process.platform==="win32"||global.TESTING_WINDOWS?ae=Dt():ae=jt();Jt.exports=_e;_e.sync=Nr;function _e(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,a){_e(e,t||{},function(o,s){o?a(o):r(s)})})}ae(e,t||{},function(r,a){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,a=!1),n(r,a)})}function Nr(e,t){try{return ae.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}});var en=x((_s,Zt)=>{u();var V=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",qt=v("path"),kr=V?";":":",Yt=Wt(),zt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Kt=(e,t)=>{let n=t.colon||kr,r=e.match(/\//)||V&&e.match(/\\/)?[""]:[...V?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],a=V?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=V?a.split(n):[""];return V&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:r,pathExt:o,pathExtExe:a}},Xt=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:a,pathExtExe:o}=Kt(e,t),s=[],i=p=>new Promise((c,d)=>{if(p===r.length)return t.all&&s.length?c(s):d(zt(e));let y=r[p],S=/^".*"$/.test(y)?y.slice(1,-1):y,f=qt.join(S,e),h=!S&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;c(l(h,p,0))}),l=(p,c,d)=>new Promise((y,S)=>{if(d===a.length)return y(i(c+1));let f=a[d];Yt(p+f,{pathExt:o},(h,g)=>{if(!h&&g)if(t.all)s.push(p+f);else return y(p+f);return y(l(p,c,d+1))})});return n?i(0).then(p=>n(null,p),n):i(0)},Lr=(e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:a}=Kt(e,t),o=[];for(let s=0;s<n.length;s++){let i=n[s],l=/^".*"$/.test(i)?i.slice(1,-1):i,p=qt.join(l,e),c=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;for(let d=0;d<r.length;d++){let y=c+r[d];try{if(Yt.sync(y,{pathExt:a}))if(t.all)o.push(y);else return y}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw zt(e)};Zt.exports=Xt;Xt.sync=Lr});var nn=x((Ts,Ce)=>{"use strict";u();var tn=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};Ce.exports=tn;Ce.exports.default=tn});var sn=x((Fs,on)=>{"use strict";u();var rn=v("path"),Gr=en(),Vr=nn();function an(e,t){let n=e.options.env||process.env,r=process.cwd(),a=e.options.cwd!=null,o=a&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=Gr.sync(e.command,{path:n[Vr({env:n})],pathExt:t?rn.delimiter:void 0})}catch{}finally{o&&process.chdir(r)}return s&&(s=rn.resolve(a?e.options.cwd:"",s)),s}function Dr(e){return an(e)||an(e,!0)}on.exports=Dr});var ln=x((ws,ve)=>{"use strict";u();var Te=/([()\][%!^"`<>&|;, *?])/g;function Hr(e){return e=e.replace(Te,"^$1"),e}function Ur(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Te,"^$1"),t&&(e=e.replace(Te,"^$1")),e}ve.exports.command=Hr;ve.exports.argument=Ur});var pn=x((Os,un)=>{"use strict";u();un.exports=/^#!(.*)/});var dn=x((Ns,cn)=>{"use strict";u();var $r=pn();cn.exports=(e="")=>{let t=e.match($r);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,"").split(" "),a=n.split("/").pop();return a==="env"?r:r?`${a} ${r}`:a}});var Sn=x((Ls,yn)=>{"use strict";u();var Fe=v("fs"),Qr=dn();function jr(e){let n=Buffer.alloc(150),r;try{r=Fe.openSync(e,"r"),Fe.readSync(r,n,0,150,0),Fe.closeSync(r)}catch{}return Qr(n.toString())}yn.exports=jr});var hn=x((Vs,fn)=>{"use strict";u();var Jr=v("path"),mn=sn(),gn=ln(),Wr=Sn(),qr=process.platform==="win32",Yr=/\.(?:com|exe)$/i,zr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Kr(e){e.file=mn(e);let t=e.file&&Wr(e.file);return t?(e.args.unshift(e.file),e.command=t,mn(e)):e.file}function Xr(e){if(!qr)return e;let t=Kr(e),n=!Yr.test(t);if(e.options.forceShell||n){let r=zr.test(t);e.command=Jr.normalize(e.command),e.command=gn.command(e.command),e.args=e.args.map(o=>gn.argument(o,r));let a=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${a}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Zr(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:Xr(r)}fn.exports=Zr});var xn=x((Hs,En)=>{"use strict";u();var Re=process.platform==="win32";function we(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function ea(e,t){if(!Re)return;let n=e.emit;e.emit=function(r,a){if(r==="exit"){let o=bn(a,t,"spawn");if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function bn(e,t){return Re&&e===1&&!t.file?we(t.original,"spawn"):null}function ta(e,t){return Re&&e===1&&!t.file?we(t.original,"spawnSync"):null}En.exports={hookChildProcess:ea,verifyENOENT:bn,verifyENOENTSync:ta,notFoundError:we}});var An=x(($s,D)=>{"use strict";u();var Mn=v("child_process"),Pe=hn(),Oe=xn();function In(e,t,n){let r=Pe(e,t,n),a=Mn.spawn(r.command,r.args,r.options);return Oe.hookChildProcess(a,r),a}function na(e,t,n){let r=Pe(e,t,n),a=Mn.spawnSync(r.command,r.args,r.options);return a.error=a.error||Oe.verifyENOENTSync(a.status,r),a}D.exports=In;D.exports.spawn=In;D.exports.sync=na;D.exports._parse=Pe;D.exports._enoent=Oe});var Kn=x((pl,zn)=>{"use strict";u();var{PassThrough:Xa}=v("stream");zn.exports=function(){var e=[],t=new Xa({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on("unpipe",a),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",a.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function r(){return e.length==0}function a(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}}});var mr=x((zl,Sr)=>{u();function I(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Sr.exports=I;I.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};I.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};I.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0};I.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};I.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};I.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};I.prototype.start=I.prototype.try;I.prototype.errors=function(){return this._errors};I.prototype.attempts=function(){return this._attempts};I.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var a=this._errors[r],o=a.message,s=(e[o]||0)+1;e[o]=s,s>=n&&(t=a,n=s)}return t}});var gr=x(B=>{u();var Io=mr();B.operation=function(e){var t=B.timeouts(e);return new Io(t,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};B.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],a=0;a<t.retries;a++)r.push(this.createTimeout(a,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(a,t)),r.sort(function(o,s){return o-s}),r};B.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout),r};B.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var r in e)typeof e[r]=="function"&&n.push(r)}for(var a=0;a<n.length;a++){var o=n[a],s=e[o];e[o]=function(l){var p=B.operation(t),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(y){p.retry(y)||(y&&(arguments[0]=p.mainError()),d.apply(this,arguments))}),p.attempt(function(){l.apply(e,c)})}.bind(e,s),e[o].options=t}}});var hr=x((eu,fr)=>{u();fr.exports=gr()});u();var Q=F(yt(),1);var ne=class extends Map{created=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="create").map(([t])=>t));updated=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="update").map(([t])=>t));deleted=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="delete").map(([t])=>t))},Cr=b.greenBright("+"),Tr=b.blueBright("\xB1"),vr=b.redBright("-"),At=b.yellowBright("\u2192"),j=(e,{changes:t,tense:n,limit:r=1/0,...a})=>{ee.logLevel<=Z.TRACE&&(r=1/0);let o=Array.from(t.entries()).filter(([y])=>!y.startsWith(".gadget/"));if(o.length===0)return"";let s=b.yellowBright(n==="past"?"renamed":"rename"),i=b.greenBright(n==="past"?"created":"create"),l=b.blueBright(n==="past"?"updated":"update"),p=b.redBright(n==="past"?"deleted":"delete"),c=o.sort((y,S)=>y[0].localeCompare(S[0])).slice(0,r).map(([y,S])=>{switch(!0){case(S.type==="create"&&at(S.oldPath)):return[At,b.yellowBright(S.oldPath),s,At,b.yellowBright(y)];case S.type==="create":return[Cr,b.greenBright(y),i];case S.type==="update":return[Tr,b.blueBright(y),l];case S.type==="delete":return[vr,b.redBright(y),p];default:return ot(S)}});o.length>r&&c.push([b.gray(w.ellipsis),m`{gray ${o.length-r} more}`,""]);let d;if(o.length>=5){let y=[],S=o.filter(([,g])=>g.type==="create").length;if(S>0){let g=n==="past"?`${S} created`:(0,Q.default)("create",S,!0);y.push(m`{greenBright ${g}}`)}let f=o.filter(([,g])=>g.type==="update").length;if(f>0){let g=n==="past"?`${f} updated`:(0,Q.default)("update",f,!0);y.push(m`{blueBright ${g}}`)}let h=o.filter(([,g])=>g.type==="delete").length;if(h>0){let g=n==="past"?`${h} deleted`:(0,Q.default)("delete",h,!0);y.push(m`{redBright ${g}}`)}d=k`
1
+ import{b as gt,e as ft,h as ht,j as xe,k as te,l as It}from"./chunk-E3I3MPQD.js";import{a as St,b as mt}from"./chunk-HCQR6OPH.js";import{b as $}from"./chunk-TMPKLC3N.js";import{c as dt}from"./chunk-NO72UU5F.js";import{c as Me}from"./chunk-AGPFNOXG.js";import{B as Mt,i as Ee,j as w,k as _r,l as yt,q as bt}from"./chunk-RIIVR43B.js";import{b as Et,c as xt}from"./chunk-AGRDDZFS.js";import{$ as R,E as ut,H as pt,I as N,L as be,M as Z,P as ee,S as ct,Z as m,_ as k,b,d as rt,g as at,n as ot,p as he,q as st,r as it,s as lt,z as Ar}from"./chunk-GIAIN3IJ.js";import{a as Ir}from"./chunk-B6XQEEUK.js";import{a as v,c as x,e as F,g as u}from"./chunk-SGMPMYEU.js";var Dt=x((hs,Vt)=>{u();Vt.exports=Gt;Gt.sync=Pr;var kt=v("fs");function wr(e,t){var n=t.pathExt!==void 0?t.pathExt:process.env.PATHEXT;if(!n||(n=n.split(";"),n.indexOf("")!==-1))return!0;for(var r=0;r<n.length;r++){var a=n[r].toLowerCase();if(a&&e.substr(-a.length).toLowerCase()===a)return!0}return!1}function Lt(e,t,n){return!e.isSymbolicLink()&&!e.isFile()?!1:wr(t,n)}function Gt(e,t,n){kt.stat(e,function(r,a){n(r,r?!1:Lt(a,e,t))})}function Pr(e,t){return Lt(kt.statSync(e),e,t)}});var jt=x((Es,Qt)=>{u();Qt.exports=Ut;Ut.sync=Or;var Ht=v("fs");function Ut(e,t,n){Ht.stat(e,function(r,a){n(r,r?!1:$t(a,t))})}function Or(e,t){return $t(Ht.statSync(e),t)}function $t(e,t){return e.isFile()&&Br(e,t)}function Br(e,t){var n=e.mode,r=e.uid,a=e.gid,o=t.uid!==void 0?t.uid:process.getuid&&process.getuid(),s=t.gid!==void 0?t.gid:process.getgid&&process.getgid(),i=parseInt("100",8),l=parseInt("010",8),p=parseInt("001",8),c=i|l,d=n&p||n&l&&a===s||n&i&&r===o||n&c&&o===0;return d}});var Wt=x((Is,Jt)=>{u();var Ms=v("fs"),ae;process.platform==="win32"||global.TESTING_WINDOWS?ae=Dt():ae=jt();Jt.exports=_e;_e.sync=Nr;function _e(e,t,n){if(typeof t=="function"&&(n=t,t={}),!n){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,a){_e(e,t||{},function(o,s){o?a(o):r(s)})})}ae(e,t||{},function(r,a){r&&(r.code==="EACCES"||t&&t.ignoreErrors)&&(r=null,a=!1),n(r,a)})}function Nr(e,t){try{return ae.sync(e,t||{})}catch(n){if(t&&t.ignoreErrors||n.code==="EACCES")return!1;throw n}}});var en=x((_s,Zt)=>{u();var V=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",qt=v("path"),kr=V?";":":",Yt=Wt(),zt=e=>Object.assign(new Error(`not found: ${e}`),{code:"ENOENT"}),Kt=(e,t)=>{let n=t.colon||kr,r=e.match(/\//)||V&&e.match(/\\/)?[""]:[...V?[process.cwd()]:[],...(t.path||process.env.PATH||"").split(n)],a=V?t.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",o=V?a.split(n):[""];return V&&e.indexOf(".")!==-1&&o[0]!==""&&o.unshift(""),{pathEnv:r,pathExt:o,pathExtExe:a}},Xt=(e,t,n)=>{typeof t=="function"&&(n=t,t={}),t||(t={});let{pathEnv:r,pathExt:a,pathExtExe:o}=Kt(e,t),s=[],i=p=>new Promise((c,d)=>{if(p===r.length)return t.all&&s.length?c(s):d(zt(e));let y=r[p],S=/^".*"$/.test(y)?y.slice(1,-1):y,f=qt.join(S,e),h=!S&&/^\.[\\\/]/.test(e)?e.slice(0,2)+f:f;c(l(h,p,0))}),l=(p,c,d)=>new Promise((y,S)=>{if(d===a.length)return y(i(c+1));let f=a[d];Yt(p+f,{pathExt:o},(h,g)=>{if(!h&&g)if(t.all)s.push(p+f);else return y(p+f);return y(l(p,c,d+1))})});return n?i(0).then(p=>n(null,p),n):i(0)},Lr=(e,t)=>{t=t||{};let{pathEnv:n,pathExt:r,pathExtExe:a}=Kt(e,t),o=[];for(let s=0;s<n.length;s++){let i=n[s],l=/^".*"$/.test(i)?i.slice(1,-1):i,p=qt.join(l,e),c=!l&&/^\.[\\\/]/.test(e)?e.slice(0,2)+p:p;for(let d=0;d<r.length;d++){let y=c+r[d];try{if(Yt.sync(y,{pathExt:a}))if(t.all)o.push(y);else return y}catch{}}}if(t.all&&o.length)return o;if(t.nothrow)return null;throw zt(e)};Zt.exports=Xt;Xt.sync=Lr});var nn=x((Ts,Ce)=>{"use strict";u();var tn=(e={})=>{let t=e.env||process.env;return(e.platform||process.platform)!=="win32"?"PATH":Object.keys(t).reverse().find(r=>r.toUpperCase()==="PATH")||"Path"};Ce.exports=tn;Ce.exports.default=tn});var sn=x((Fs,on)=>{"use strict";u();var rn=v("path"),Gr=en(),Vr=nn();function an(e,t){let n=e.options.env||process.env,r=process.cwd(),a=e.options.cwd!=null,o=a&&process.chdir!==void 0&&!process.chdir.disabled;if(o)try{process.chdir(e.options.cwd)}catch{}let s;try{s=Gr.sync(e.command,{path:n[Vr({env:n})],pathExt:t?rn.delimiter:void 0})}catch{}finally{o&&process.chdir(r)}return s&&(s=rn.resolve(a?e.options.cwd:"",s)),s}function Dr(e){return an(e)||an(e,!0)}on.exports=Dr});var ln=x((ws,ve)=>{"use strict";u();var Te=/([()\][%!^"`<>&|;, *?])/g;function Hr(e){return e=e.replace(Te,"^$1"),e}function Ur(e,t){return e=`${e}`,e=e.replace(/(\\*)"/g,'$1$1\\"'),e=e.replace(/(\\*)$/,"$1$1"),e=`"${e}"`,e=e.replace(Te,"^$1"),t&&(e=e.replace(Te,"^$1")),e}ve.exports.command=Hr;ve.exports.argument=Ur});var pn=x((Os,un)=>{"use strict";u();un.exports=/^#!(.*)/});var dn=x((Ns,cn)=>{"use strict";u();var $r=pn();cn.exports=(e="")=>{let t=e.match($r);if(!t)return null;let[n,r]=t[0].replace(/#! ?/,"").split(" "),a=n.split("/").pop();return a==="env"?r:r?`${a} ${r}`:a}});var Sn=x((Ls,yn)=>{"use strict";u();var Fe=v("fs"),Qr=dn();function jr(e){let n=Buffer.alloc(150),r;try{r=Fe.openSync(e,"r"),Fe.readSync(r,n,0,150,0),Fe.closeSync(r)}catch{}return Qr(n.toString())}yn.exports=jr});var hn=x((Vs,fn)=>{"use strict";u();var Jr=v("path"),mn=sn(),gn=ln(),Wr=Sn(),qr=process.platform==="win32",Yr=/\.(?:com|exe)$/i,zr=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function Kr(e){e.file=mn(e);let t=e.file&&Wr(e.file);return t?(e.args.unshift(e.file),e.command=t,mn(e)):e.file}function Xr(e){if(!qr)return e;let t=Kr(e),n=!Yr.test(t);if(e.options.forceShell||n){let r=zr.test(t);e.command=Jr.normalize(e.command),e.command=gn.command(e.command),e.args=e.args.map(o=>gn.argument(o,r));let a=[e.command].concat(e.args).join(" ");e.args=["/d","/s","/c",`"${a}"`],e.command=process.env.comspec||"cmd.exe",e.options.windowsVerbatimArguments=!0}return e}function Zr(e,t,n){t&&!Array.isArray(t)&&(n=t,t=null),t=t?t.slice(0):[],n=Object.assign({},n);let r={command:e,args:t,options:n,file:void 0,original:{command:e,args:t}};return n.shell?r:Xr(r)}fn.exports=Zr});var xn=x((Hs,En)=>{"use strict";u();var Re=process.platform==="win32";function we(e,t){return Object.assign(new Error(`${t} ${e.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${t} ${e.command}`,path:e.command,spawnargs:e.args})}function ea(e,t){if(!Re)return;let n=e.emit;e.emit=function(r,a){if(r==="exit"){let o=bn(a,t,"spawn");if(o)return n.call(e,"error",o)}return n.apply(e,arguments)}}function bn(e,t){return Re&&e===1&&!t.file?we(t.original,"spawn"):null}function ta(e,t){return Re&&e===1&&!t.file?we(t.original,"spawnSync"):null}En.exports={hookChildProcess:ea,verifyENOENT:bn,verifyENOENTSync:ta,notFoundError:we}});var An=x(($s,D)=>{"use strict";u();var Mn=v("child_process"),Pe=hn(),Oe=xn();function In(e,t,n){let r=Pe(e,t,n),a=Mn.spawn(r.command,r.args,r.options);return Oe.hookChildProcess(a,r),a}function na(e,t,n){let r=Pe(e,t,n),a=Mn.spawnSync(r.command,r.args,r.options);return a.error=a.error||Oe.verifyENOENTSync(a.status,r),a}D.exports=In;D.exports.spawn=In;D.exports.sync=na;D.exports._parse=Pe;D.exports._enoent=Oe});var Kn=x((pl,zn)=>{"use strict";u();var{PassThrough:Xa}=v("stream");zn.exports=function(){var e=[],t=new Xa({objectMode:!0});return t.setMaxListeners(0),t.add=n,t.isEmpty=r,t.on("unpipe",a),Array.prototype.slice.call(arguments).forEach(n),t;function n(o){return Array.isArray(o)?(o.forEach(n),this):(e.push(o),o.once("end",a.bind(null,o)),o.once("error",t.emit.bind(t,"error")),o.pipe(t,{end:!1}),this)}function r(){return e.length==0}function a(o){e=e.filter(function(s){return s!==o}),!e.length&&t.readable&&t.end()}}});var mr=x((zl,Sr)=>{u();function I(e,t){typeof t=="boolean"&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}Sr.exports=I;I.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};I.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};I.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.push(e),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),n=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n),this._options.unref&&this._timer.unref(),!0};I.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};I.prototype.try=function(e){console.log("Using RetryOperation.try() is deprecated"),this.attempt(e)};I.prototype.start=function(e){console.log("Using RetryOperation.start() is deprecated"),this.attempt(e)};I.prototype.start=I.prototype.try;I.prototype.errors=function(){return this._errors};I.prototype.attempts=function(){return this._attempts};I.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var a=this._errors[r],o=a.message,s=(e[o]||0)+1;e[o]=s,s>=n&&(t=a,n=s)}return t}});var gr=x(B=>{u();var Io=mr();B.operation=function(e){var t=B.timeouts(e);return new Io(t,{forever:e&&(e.forever||e.retries===1/0),unref:e&&e.unref,maxRetryTime:e&&e.maxRetryTime})};B.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],a=0;a<t.retries;a++)r.push(this.createTimeout(a,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(a,t)),r.sort(function(o,s){return o-s}),r};B.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*Math.max(t.minTimeout,1)*Math.pow(t.factor,e));return r=Math.min(r,t.maxTimeout),r};B.wrap=function(e,t,n){if(t instanceof Array&&(n=t,t=null),!n){n=[];for(var r in e)typeof e[r]=="function"&&n.push(r)}for(var a=0;a<n.length;a++){var o=n[a],s=e[o];e[o]=function(l){var p=B.operation(t),c=Array.prototype.slice.call(arguments,1),d=c.pop();c.push(function(y){p.retry(y)||(y&&(arguments[0]=p.mainError()),d.apply(this,arguments))}),p.attempt(function(){l.apply(e,c)})}.bind(e,s),e[o].options=t}}});var hr=x((eu,fr)=>{u();fr.exports=gr()});u();var Q=F(yt(),1);var ne=class extends Map{created=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="create").map(([t])=>t));updated=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="update").map(([t])=>t));deleted=N(()=>Array.from(this.entries()).filter(([,t])=>t.type==="delete").map(([t])=>t))},Cr=b.greenBright("+"),Tr=b.blueBright("\xB1"),vr=b.redBright("-"),At=b.yellowBright("\u2192"),j=(e,{changes:t,tense:n,limit:r=1/0,...a})=>{ee.logLevel<=Z.TRACE&&(r=1/0);let o=Array.from(t.entries()).filter(([y])=>!y.startsWith(".gadget/"));if(o.length===0)return"";let s=b.yellowBright(n==="past"?"renamed":"rename"),i=b.greenBright(n==="past"?"created":"create"),l=b.blueBright(n==="past"?"updated":"update"),p=b.redBright(n==="past"?"deleted":"delete"),c=o.sort((y,S)=>y[0].localeCompare(S[0])).slice(0,r).map(([y,S])=>{switch(!0){case(S.type==="create"&&at(S.oldPath)):return[At,b.yellowBright(S.oldPath),s,At,b.yellowBright(y)];case S.type==="create":return[Cr,b.greenBright(y),i];case S.type==="update":return[Tr,b.blueBright(y),l];case S.type==="delete":return[vr,b.redBright(y),p];default:return ot(S)}});o.length>r&&c.push([b.gray(w.ellipsis),m`{gray ${o.length-r} more}`,""]);let d;if(o.length>=5){let y=[],S=o.filter(([,g])=>g.type==="create").length;if(S>0){let g=n==="past"?`${S} created`:(0,Q.default)("create",S,!0);y.push(m`{greenBright ${g}}`)}let f=o.filter(([,g])=>g.type==="update").length;if(f>0){let g=n==="past"?`${f} updated`:(0,Q.default)("update",f,!0);y.push(m`{blueBright ${g}}`)}let h=o.filter(([,g])=>g.type==="delete").length;if(h>0){let g=n==="past"?`${h} deleted`:(0,Q.default)("delete",h,!0);y.push(m`{redBright ${g}}`)}d=k`
2
2
  ${(0,Q.default)("change",o.length,!0)} in total. ${y.join(", ")}.
3
3
  `}return St({rows:c,footer:d,ensureEmptyLineAbove:!0,ensureEmptyLineAboveBody:!1,ensureEmptyLineAboveFooter:!0,indent:0,...a})},re=(e,t)=>{let n=j(e,t);n&&R(n)};u();var _t=m(`
4
4
  subscription EnvironmentLogs($query: String!, $start: DateTime, $limit: Int) {
@@ -170,7 +170,7 @@ ${r.message}`:g,_=[E,t,e].filter(Boolean).join(`
170
170
  Your environment's files have changed since we last checked.
171
171
 
172
172
  Please re-run "ggt ${n}" to see the changes and try again.
173
- `)}}async pull(t,{hashes:n,force:r,printEnvironmentChangesOptions:a}={}){let{localChanges:o,environmentChangesToPull:s,environmentFilesVersion:i}=n??await this.hashes(t);H(s.size>0,"cannot push if there are no changes"),o.size>0&&!r&&await Me(m`
173
+ `)}}async pull(t,{hashes:n,force:r,printEnvironmentChangesOptions:a}={}){let{localChanges:o,environmentChangesToPull:s,environmentFilesVersion:i}=n??await this.hashes(t);H(s.size>0,"cannot pull if there are no changes"),o.size>0&&!r&&await Me(m`
174
174
  Are you sure you want to {underline discard} your local changes?
175
175
  `),await this._getChangesFromEnvironment(t,{changes:s,filesVersion:i,printEnvironmentChangesOptions:a})}async writeToLocalFilesystem(t,n){let r=BigInt(n.filesVersion);H(r>=this.syncJson.filesVersion,"filesVersion must be greater than or equal to current filesVersion"),t.log.debug("writing to local filesystem",{filesVersion:r,files:n.files.map(s=>s.path),delete:n.delete});let a=new ne,o=new Set;await K(n.delete,async s=>{let i=fe.dirname(s);for(;i!==".";)o.add(this.syncJson.directory.normalize(i,!0)),i=fe.dirname(i);let l=this.syncJson.directory.absolute(s),p=this.syncJson.directory.absolute(".gadget/backup",this.syncJson.directory.relative(s));await tt(async()=>{try{await A.default.remove(p),await A.default.move(l,p),a.set(s,{type:"delete"})}catch(c){if(he(c))return;if(it(c)||lt(c)){let d=fe.dirname(p);for(;d!==this.syncJson.directory.absolute(".gadget/backup");)(await A.default.stat(d)).isDirectory()||(t.log.debug("removing file in the way of backup path",{currentPath:l,backupPath:p,file:d}),await A.default.remove(d)),d=fe.dirname(d)}throw c}},{retries:ee.windows?4:2,minTimeout:(0,Mr.default)("100ms"),onFailedAttempt:c=>{t.log.warn("failed to move file to backup",{error:c,currentPath:l,backupPath:p})}})});for(let s of Array.from(o.values()).sort().reverse())if(!n.files.some(i=>i.path===s))try{await A.default.rmdir(this.syncJson.directory.absolute(s)),a.set(s,{type:"delete"})}catch(i){if(he(i)||st(i))continue;throw i}if(await K(n.files,async s=>{let i=this.syncJson.directory.absolute(s.path);await A.default.pathExists(i)?s.path.endsWith("/")||a.set(s.path,{type:"update"}):a.set(s.path,{type:"create"}),s.path.endsWith("/")?await A.default.ensureDir(i):await A.default.outputFile(i,Buffer.from(s.content,s.encoding)),Et&&await A.default.chmod(i,s.mode&511),i===this.syncJson.directory.absolute(".ignore")&&await this.syncJson.directory.loadIgnoreFile()}),await this.syncJson.save(String(r)),n.spinner?.clear(),re(t,{changes:a,tense:"past",title:m`{greenBright ${w.arrowDown}} Pulled ${(0,U.default)("file",a.size)}. ${P()}`,...n.printEnvironmentChangesOptions}),a.has("yarn.lock")){let s=$({ensureEmptyLineAbove:!0,content:'Running "yarn install --check-files"'});try{await Xe("yarn",["install","--check-files"],{cwd:this.syncJson.directory.path}),s.succeed(`Ran "yarn install --check-files" ${P()}`)}catch(i){s.fail(),t.log.error("yarn install failed",{error:i});let l=ut(i).message;l&&R({ensureEmptyLineAbove:!0,indent:2,content:l})}}return a}async _merge(t,{hashes:{localChanges:n,environmentChanges:r,environmentFilesVersion:a},prefer:o,printLocalChangesOptions:s,printEnvironmentChangesOptions:i}){let l=Bt({localChanges:n,environmentChanges:r});if(l.size>0)switch(t.log.debug("conflicts detected",{conflicts:l}),o||(Nt({conflicts:l}),o=await It({choices:Object.values(O),content:b.bold("How should we resolve these conflicts?")})),o){case O.CANCEL:{To.exit(0);break}case O.LOCAL:{r=Ae({conflicts:l,changes:r});break}case O.ENVIRONMENT:{n=Ae({conflicts:l,changes:n});break}}r.size>0&&await this._getChangesFromEnvironment(t,{changes:r,filesVersion:a,printEnvironmentChangesOptions:i}),n.size>0&&await this._sendChangesToEnvironment(t,{changes:n,expectedFilesVersion:a,printLocalChangesOptions:s})}async _getChangesFromEnvironment(t,{filesVersion:n,changes:r,printEnvironmentChangesOptions:a}){t.log.debug("getting changes from gadget",{filesVersion:n,changes:r});let o=r.created(),s=r.updated(),i=$({ensureEmptyLineAbove:!0,content:j(t,{changes:r,tense:"present",title:m`Pulling ${(0,U.default)("file",r.size)}.`,...a})});try{let l=[];if(o.length>0||s.length>0){let{fileSyncFiles:p}=await this.syncJson.edit.query({query:vt,variables:{paths:[...o,...s],filesVersion:String(n),encoding:"base64"}});l=p.files}await this.writeToLocalFilesystem(t,{filesVersion:n,files:l,delete:r.deleted(),spinner:i,printEnvironmentChangesOptions:a})}catch(l){throw i.fail(),l}}async _sendChangesToEnvironment(t,{changes:n,expectedFilesVersion:r=this.syncJson.filesVersion,printLocalChangesOptions:a}){t.log.debug("sending changes to gadget",{expectedFilesVersion:r,changes:n});let o=[],s=[];if(await K(n,async([p,c])=>{if(c.type==="delete"){s.push({path:p});return}let d=this.syncJson.directory.absolute(p),y;try{y=await A.default.stat(d)}catch(h){xt(h),t.log.debug("skipping change because file doesn't exist",{path:p});return}let S="";y.isFile()&&(S=await A.default.readFile(d,"base64"));let f;c.type==="create"&&c.oldPath&&(f=c.oldPath),o.push({content:S,oldPath:f,path:p,mode:y.mode,encoding:"base64"})}),o.length===0&&s.length===0){t.log.debug("skipping send because there are no changes");return}if(o.map(p=>p.content.length).reduce((p,c)=>p+c,0)>vo)throw new Ee(m`
176
176
  {underline Your file changes are too large to push.}
@@ -184,4 +184,4 @@ ${r.message}`:g,_=[E,t,e].filter(Boolean).join(`
184
184
 
185
185
  {red Your app will not be operational until all fatal errors are fixed.}
186
186
  `})}catch(p){throw xe(p)?l.clear():l.fail(),p}}};export{ne as a,Tr as b,vr as c,en as d,Uo as e,$o as f,Qo as g,jo as h,Jo as i,P as j,Bt as k,Nt as l,Ss as m,ms as n,xr as o};
187
- //# sourceMappingURL=chunk-6BXHYE2C.js.map
187
+ //# sourceMappingURL=chunk-IPKFNVOS.js.map