@gadgetinc/ggt 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/README.md +1 -0
  2. package/dist/{add-RDTHYTCK.js → add-DCE6CV2D.js} +2 -2
  3. package/dist/{chunk-M2OJZLL7.js → chunk-6FBP46EB.js} +6 -6
  4. package/dist/{chunk-M2OJZLL7.js.map → chunk-6FBP46EB.js.map} +2 -2
  5. package/dist/{chunk-NGTOMLDS.js → chunk-AB4I3BMD.js} +2 -2
  6. package/dist/{chunk-TRHAPK2F.js → chunk-BYMG3KOL.js} +2 -2
  7. package/dist/{chunk-JKDJXJKF.js → chunk-BZSAGSV3.js} +2 -2
  8. package/dist/{chunk-RYQWS5BH.js → chunk-CXYA3RFX.js} +2 -2
  9. package/dist/{chunk-LWW4E6P5.js → chunk-DVKNBG4P.js} +35 -28
  10. package/dist/chunk-DVKNBG4P.js.map +7 -0
  11. package/dist/{chunk-457GEPUN.js → chunk-EFU2JNKY.js} +3 -3
  12. package/dist/{chunk-CQLM5U6T.js → chunk-KGOVR5SK.js} +12 -12
  13. package/dist/{chunk-CQLM5U6T.js.map → chunk-KGOVR5SK.js.map} +4 -4
  14. package/dist/{chunk-FLXIAZND.js → chunk-KMCOZJPU.js} +2 -2
  15. package/dist/{chunk-VICN6LTV.js → chunk-OLKWG2EP.js} +3 -3
  16. package/dist/{chunk-5ONACLO6.js → chunk-THZRTDWW.js} +2 -2
  17. package/dist/{context-GN36UFJL.js → context-L5YSPF3X.js} +2 -2
  18. package/dist/deploy-PBJEUYGH.js +25 -0
  19. package/dist/deploy-PBJEUYGH.js.map +7 -0
  20. package/dist/{dev-5UFCKF4X.js → dev-OT7PEKUN.js} +2 -2
  21. package/dist/{list-WGRXHV2B.js → list-CC5PICEF.js} +2 -2
  22. package/dist/login-SE7XIHRW.js +2 -0
  23. package/dist/{logout-YXDH5ZZI.js → logout-B3YAZN6R.js} +2 -2
  24. package/dist/main.js +1 -1
  25. package/dist/{open-EOH3Q5KP.js → open-OVK3YL4O.js} +2 -2
  26. package/dist/{pull-UAKKKJJP.js → pull-SLPBOP6Z.js} +2 -2
  27. package/dist/push-3HGVWCKW.js +2 -0
  28. package/dist/{status-UJUGP24U.js → status-7GLNL7D5.js} +2 -2
  29. package/dist/user-C34J52UL.js +2 -0
  30. package/dist/{version-VE55GG37.js → version-AUI4NRDS.js} +2 -2
  31. package/dist/{whoami-OAH55L4M.js → whoami-TXO7VJXC.js} +2 -2
  32. package/package.json +1 -1
  33. package/dist/chunk-LWW4E6P5.js.map +0 -7
  34. package/dist/deploy-BAMMI3ZA.js +0 -24
  35. package/dist/deploy-BAMMI3ZA.js.map +0 -7
  36. package/dist/login-5YZOB4XB.js +0 -2
  37. package/dist/push-7X4P2364.js +0 -2
  38. package/dist/user-B2RIDVTH.js +0 -2
  39. /package/dist/{add-RDTHYTCK.js.map → add-DCE6CV2D.js.map} +0 -0
  40. /package/dist/{chunk-NGTOMLDS.js.map → chunk-AB4I3BMD.js.map} +0 -0
  41. /package/dist/{chunk-TRHAPK2F.js.map → chunk-BYMG3KOL.js.map} +0 -0
  42. /package/dist/{chunk-JKDJXJKF.js.map → chunk-BZSAGSV3.js.map} +0 -0
  43. /package/dist/{chunk-RYQWS5BH.js.map → chunk-CXYA3RFX.js.map} +0 -0
  44. /package/dist/{chunk-457GEPUN.js.map → chunk-EFU2JNKY.js.map} +0 -0
  45. /package/dist/{chunk-FLXIAZND.js.map → chunk-KMCOZJPU.js.map} +0 -0
  46. /package/dist/{chunk-VICN6LTV.js.map → chunk-OLKWG2EP.js.map} +0 -0
  47. /package/dist/{chunk-5ONACLO6.js.map → chunk-THZRTDWW.js.map} +0 -0
  48. /package/dist/{context-GN36UFJL.js.map → context-L5YSPF3X.js.map} +0 -0
  49. /package/dist/{dev-5UFCKF4X.js.map → dev-OT7PEKUN.js.map} +0 -0
  50. /package/dist/{list-WGRXHV2B.js.map → list-CC5PICEF.js.map} +0 -0
  51. /package/dist/{login-5YZOB4XB.js.map → login-SE7XIHRW.js.map} +0 -0
  52. /package/dist/{logout-YXDH5ZZI.js.map → logout-B3YAZN6R.js.map} +0 -0
  53. /package/dist/{open-EOH3Q5KP.js.map → open-OVK3YL4O.js.map} +0 -0
  54. /package/dist/{pull-UAKKKJJP.js.map → pull-SLPBOP6Z.js.map} +0 -0
  55. /package/dist/{push-7X4P2364.js.map → push-3HGVWCKW.js.map} +0 -0
  56. /package/dist/{status-UJUGP24U.js.map → status-7GLNL7D5.js.map} +0 -0
  57. /package/dist/{user-B2RIDVTH.js.map → user-C34J52UL.js.map} +0 -0
  58. /package/dist/{version-VE55GG37.js.map → version-AUI4NRDS.js.map} +0 -0
  59. /package/dist/{whoami-OAH55L4M.js.map → whoami-TXO7VJXC.js.map} +0 -0
package/README.md CHANGED
@@ -155,6 +155,7 @@ Options
155
155
  --allow-different-directory Deploys from any local directory with existing files, even if the ".gadget/sync.json" file is missing
156
156
  --allow-different-app Deploys a different app using the --app command, instead of the one specified in the “.gadget/sync.json” file
157
157
  --allow-problems Deploys despite any existing issues found in the app (gelly errors, typescript errors etc.)
158
+ --allow-data-delete Deploys even if it results in the deletion of data in production
158
159
  --allow-charges Deploys even if it results in additional charges to your plan
159
160
 
160
161
  Examples
@@ -1,4 +1,4 @@
1
- import{d as F,e as C,f as B,g as U,h as S,m as P}from"./chunk-LWW4E6P5.js";import{g as $,l as L,m as M,n as k,o as N}from"./chunk-RYQWS5BH.js";import"./chunk-5ONACLO6.js";import{b as y,h as O,i as j}from"./chunk-NGTOMLDS.js";import"./chunk-JKDJXJKF.js";import{b as E}from"./chunk-D2K5XPNJ.js";import"./chunk-M4PNFOA5.js";import"./chunk-3Q3GPB6Z.js";import"./chunk-M2OJZLL7.js";import"./chunk-457GEPUN.js";import"./chunk-FLXIAZND.js";import{d as f,e as A,g as p,k as b,l as v}from"./chunk-VICN6LTV.js";import{$ as g,Z as s,b as c,m as _}from"./chunk-CQLM5U6T.js";import"./chunk-F3EZ4KS3.js";import"./chunk-GOBNB5VT.js";import{g as T}from"./chunk-5WC5D4WL.js";T();var h=class extends v{isBug=b.NO;constructor(n){let a="";if(_(n.cause)){let e=E(n.cause.map(o=>o.message));a=s` • ${e.map(o=>o.split(`
1
+ import{f as F,g as C,h as B,i as U,j as S,o as P}from"./chunk-DVKNBG4P.js";import{g as $,l as L,m as M,n as k,o as N}from"./chunk-CXYA3RFX.js";import"./chunk-THZRTDWW.js";import{b as y,h as O,i as j}from"./chunk-AB4I3BMD.js";import"./chunk-BZSAGSV3.js";import{b as E}from"./chunk-D2K5XPNJ.js";import"./chunk-M4PNFOA5.js";import"./chunk-3Q3GPB6Z.js";import"./chunk-6FBP46EB.js";import"./chunk-EFU2JNKY.js";import"./chunk-KMCOZJPU.js";import{d as f,e as A,g as p,k as b,l as v}from"./chunk-OLKWG2EP.js";import{$ as g,Z as s,b as c,m as _}from"./chunk-KGOVR5SK.js";import"./chunk-F3EZ4KS3.js";import"./chunk-GOBNB5VT.js";import{g as T}from"./chunk-5WC5D4WL.js";T();var h=class extends v{isBug=b.NO;constructor(n){let a="";if(_(n.cause)){let e=E(n.cause.map(o=>o.message));a=s` • ${e.map(o=>o.split(`
2
2
  `).join(`
3
3
  \u200E \u2022 `)).join(`
4
4
  `)}`}else a=s`${n.cause}`;super(a)}render(){return`${c.redBright(f.cross)} Failed to add:
@@ -75,4 +75,4 @@ import{d as F,e as C,f as B,g as U,h as S,m as P}from"./chunk-LWW4E6P5.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:U,variables:{path:e[0],fields:o.map(r=>({name:r.name,fieldType:r.fieldType}))}})).createModelFields;await n.writeToLocalFilesystem(t,{filesVersion:i.remoteFilesVersion,files:i.changed,delete:[]})}catch(i){throw i instanceof y?new h(i):i}g({ensureEmptyLineAbove:!0,content:`Field ${c.cyanBright(o[0]?.name)} added successfully.`})};export{h as AddClientError,le as args,ce as run,R as usage};
78
- //# sourceMappingURL=add-RDTHYTCK.js.map
78
+ //# sourceMappingURL=add-DCE6CV2D.js.map
@@ -1,18 +1,18 @@
1
- import{b as ne,c as se,d as ie,h as ae}from"./chunk-457GEPUN.js";import{e as G}from"./chunk-FLXIAZND.js";import{$ as d,H as w,M as x,W as D,Z as E,_ as H,b as M,c as oe,d as A,e as h}from"./chunk-CQLM5U6T.js";import{d as Le,g as i}from"./chunk-5WC5D4WL.js";i();i();import $e from"node:net";import Ce from"node:os";var U=class extends Error{constructor(r){super(`${r} is locked`)}},b={old:new Set,young:new Set},Be=1e3*15;var T,Ue=()=>{let e=Ce.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},ce=e=>new Promise((r,t)=>{let o=$e.createServer();o.unref(),o.on("error",t),o.listen(e,()=>{let{port:n}=o.address();o.close(()=>{r(n)})})}),le=async(e,r)=>{if(e.host||e.port===0)return ce(e);for(let t of r)try{await ce({port:e.port,host:t})}catch(o){if(!["EADDRNOTAVAIL","EINVAL"].includes(o.code))throw o}return e.port},We=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)}T===void 0&&(T=setTimeout(()=>{T=void 0,b.old=b.young,b.young=new Set},Be),T.unref&&T.unref());let o=Ue();for(let n of We(r))try{if(t.has(n))continue;let a=await le({...e,port:n},o);for(;b.old.has(a)||b.young.has(a);){if(n!==0)throw new U(n);a=await le({...e,port:n},o)}return b.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof U))throw a}throw new Error("No available ports found")}import te from"node:assert";import Ir from"node:http";i();import I from"node:process";import{Buffer as qe}from"node:buffer";import he from"node:path";import{fileURLToPath as Je}from"node:url";import Ve from"node:child_process";import q,{constants as ge}from"node:fs/promises";i();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}i();import{promisify as ze}from"node:util";import Y from"node:process";import{execFile as Ke}from"node:child_process";i();import{promisify as Ie}from"node:util";import Ne from"node:process";import{execFile as Re}from"node:child_process";var ke=Ie(Re);async function j(){if(Ne.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await ke("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari"}i();i();import Fe from"node:process";import{promisify as Oe}from"node:util";import{execFile as Me,execFileSync as qr}from"node:child_process";var De=Oe(Me);async function ue(e,{humanReadableOutput:r=!0}={}){if(Fe.platform!=="darwin")throw new Error("macOS only");let t=r?[]:["-ss"],{stdout:o}=await De("osascript",["-e",e,t]);return o.trim()}async function z(e){return ue(`tell application "Finder" to set app_path to application file id "${e}" as string
2
- tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}i();import{promisify as He}from"node:util";import{execFile as Ge}from"node:child_process";var _e=He(Ge),je={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"}},W=class extends Error{};async function K(e=_e){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 W(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);let{id:o}=t.groups,n=je[o];if(!n)throw new W(`Unknown browser ID: ${o}`);return n}var Ye=ze(Ke),Xe=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 Ye("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:Xe(r.replace(/.desktop$/,"").replace("-"," ")),id:r}}if(Y.platform==="win32")return K();throw new Error("Only macOS, Linux, and Windows are supported")}var J=he.dirname(Je(import.meta.url)),pe=he.join(J,"xdg-open"),{platform:y,arch:de}=I,Qe=(()=>{let e="/mnt/",r;return async function(){if(r)return r;let t="/etc/wsl.conf",o=!1;try{await q.access(t,ge.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}})(),fe=async(e,r)=>{let t;for(let o of e)try{return await r(o)}catch(n){t=n}throw t},N=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return fe(e.app,l=>N({...e,app:l}));let{name:r,arguments:t=[]}=e.app??{};if(t=[...t],Array.isArray(r))return fe(r,l=>N({...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]),N({...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"||A&&!oe()&&!r){let l=await Qe();o=A?`${l}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${I.env.SYSTEMROOT||I.env.windir||"C:\\Windows"}\\System32\\WindowsPowerShell\\v1.0\\powershell`,n.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),A||(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=qe.from(c.join(" "),"utf16le").toString("base64")}else{if(r)o=r;else{let l=!J||J==="/",c=!1;try{await q.access(pe,ge.X_OK),c=!0}catch{}o=I.versions.electron??(y==="android"||l||!c)?"xdg-open":pe}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 p=Ve.spawn(o,n,a);return e.wait?new Promise((l,c)=>{p.once("error",c),p.once("close",u=>{if(!e.allowNonzeroExitCode&&u>0){c(new Error(`Exited with code ${u}`));return}l(p)})}):(p.unref(),p)},Ze=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return N({...r,target:e})};function me(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&&A)return me(r);if(!e)throw new Error(`${y} is not supported`);return me(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 we=Ze;i();import Ee from"node:assert";i();import B from"node:process";i();i();var k={};Le(k,{beep:()=>Er,clearScreen:()=>vr,clearTerminal:()=>Sr,cursorBackward:()=>ir,cursorDown:()=>nr,cursorForward:()=>sr,cursorGetPosition:()=>lr,cursorHide:()=>dr,cursorLeft:()=>ye,cursorMove:()=>or,cursorNextLine:()=>ur,cursorPrevLine:()=>pr,cursorRestorePosition:()=>cr,cursorSavePosition:()=>ar,cursorShow:()=>fr,cursorTo:()=>tr,cursorUp:()=>be,enterAlternativeScreen:()=>Pr,eraseDown:()=>wr,eraseEndLine:()=>hr,eraseLine:()=>ve,eraseLines:()=>mr,eraseScreen:()=>Q,eraseStartLine:()=>gr,eraseUp:()=>xr,exitAlternativeScreen:()=>Ar,iTerm:()=>$r,image:()=>Lr,link:()=>Tr,scrollDown:()=>yr,scrollUp:()=>br});i();import Z from"node:process";i();var R=globalThis.window?.document!==void 0,Et=globalThis.process?.versions?.node!==void 0,Tt=globalThis.process?.versions?.bun!==void 0,Lt=globalThis.Deno?.version?.deno!==void 0,$t=globalThis.process?.versions?.electron!==void 0,Ct=globalThis.navigator?.userAgent?.includes("jsdom")===!0,Bt=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Ut=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,Wt=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,It=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,L=globalThis.navigator?.userAgentData?.platform,Nt=L==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",Rt=L==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",kt=L==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",Ft=L==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),Ot=L==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var s="\x1B[",C="\x1B]",S="\x07",$=";",xe=!R&&Z.env.TERM_PROGRAM==="Apple_Terminal",er=!R&&Z.platform==="win32",rr=R?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:Z.cwd,tr=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof r!="number"?s+(e+1)+"G":s+(r+1)+$+(e+1)+"H"},or=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let t="";return e<0?t+=s+-e+"D":e>0&&(t+=s+e+"C"),r<0?t+=s+-r+"A":r>0&&(t+=s+r+"B"),t},be=(e=1)=>s+e+"A",nr=(e=1)=>s+e+"B",sr=(e=1)=>s+e+"C",ir=(e=1)=>s+e+"D",ye=s+"G",ar=xe?"\x1B7":s+"s",cr=xe?"\x1B8":s+"u",lr=s+"6n",ur=s+"E",pr=s+"F",dr=s+"?25l",fr=s+"?25h",mr=e=>{let r="";for(let t=0;t<e;t++)r+=ve+(t<e-1?be():"");return e&&(r+=ye),r},hr=s+"K",gr=s+"1K",ve=s+"2K",wr=s+"J",xr=s+"1J",Q=s+"2J",br=s+"S",yr=s+"T",vr="\x1Bc",Sr=er?`${Q}${s}0f`:`${Q}${s}3J${s}H`,Pr=s+"?1049h",Ar=s+"?1049l",Er=S,Tr=(e,r)=>[C,"8",$,$,r,S,e,C,"8",$,$,S].join(""),Lr=(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},$r={setCwd:(e=rr())=>`${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 Cr from"node:assert";import Br from"node:events";import f from"node:process";import Se from"node:readline";var F=class e extends Br{static active=!1;value=void 0;firstRender=!0;done=!1;closed=!1;aborted=!1;exited=!1;close;constructor(){super(),Cr(!e.active,"only one prompt can be active at a time"),e.active=!0;let r=Se.createInterface({input:f.stdin,escapeCodeTimeout:50});Se.emitKeypressEvents(f.stdin,r),f.stdin.isTTY&&f.stdin.setRawMode(!0);let t=["SelectPrompt"].includes(this.constructor.name),o=(n,a)=>{let p=Ur(a,t);p===!1?this._(n,a):p&&typeof this[p]=="function"?this[p](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(k.beep)}render(){this.onRender(),this.firstRender&&(this.firstRender=!1)}},Ur=(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}}},Zt=(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 Pe=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??(()=>{d(r),d({ensureEmptyLineAbove:!0,content:"Aborting because ggt is not running in an interactive terminal."}),B.exit(1)});return Promise.resolve(t())}return new Promise(t=>{let o=new ee(r);o.on("submit",t),o.on("exit",()=>B.exit(0)),o.on("abort",()=>B.exit(1))})},ee=class extends F{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&&B.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&&B.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?M.bold.greenBright("Yes."):M.bold.redBright("No.")}`}));return}x.updatePrompt(H({...this.options,content:`${this.options.content} ${this.defaultValue?"[Y/n] ":"[y/N] "}`}))}};var Wr=h.object({id:h.union([h.string(),h.number()]).transform(Number),name:h.string().nullish(),email:h.string()}),re=Symbol.for("user"),Te=e=>e.get(re),vo=e=>{let r=Te(e);return Ee(r,"missing user"),r},So=(e,r)=>{e.set(re,r)},O=async e=>{let r=Te(e);if(r)return r;let t=ne(e);if(t)try{let o=await ie({context:{ctx:e},url:`https://${w.domains.services}/auth/api/current-user`,headers:t,responseType:"json",resolveBodyOnly:!0});return r=Wr.parse(o),e.set(re,r),e.log.info("loaded user"),r}catch(o){se(e,o);return}},Po=async e=>{let r=await O(e);return r||(e.log.info("prompting user to log in"),d({ensureEmptyLineAbove:!0,content:`You must be logged in to use "ggt ${ae(e)}".`}),await Pe({ensureEmptyLineAbove:!0,content:"Would you like to log in?"}),await Ae(e),r=await O(e),Ee(r,"missing user after successful login"),r)};var Ro=()=>E`
1
+ import{b as ne,c as se,d as ie,h as ae}from"./chunk-EFU2JNKY.js";import{e as G}from"./chunk-KMCOZJPU.js";import{$ as d,H as w,M as x,W as D,Z as T,_ as H,b as A,c as oe,d as E,e as h}from"./chunk-KGOVR5SK.js";import{d as Le,g as i}from"./chunk-5WC5D4WL.js";i();i();import $e from"node:net";import Ce from"node:os";var W=class extends Error{constructor(r){super(`${r} is locked`)}},b={old:new Set,young:new Set},Be=1e3*15;var L,Ue=()=>{let e=Ce.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},ce=e=>new Promise((r,t)=>{let o=$e.createServer();o.unref(),o.on("error",t),o.listen(e,()=>{let{port:n}=o.address();o.close(()=>{r(n)})})}),le=async(e,r)=>{if(e.host||e.port===0)return ce(e);for(let t of r)try{await ce({port:e.port,host:t})}catch(o){if(!["EADDRNOTAVAIL","EINVAL"].includes(o.code))throw o}return e.port},We=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},Be),L.unref&&L.unref());let o=Ue();for(let n of We(r))try{if(t.has(n))continue;let a=await le({...e,port:n},o);for(;b.old.has(a)||b.young.has(a);){if(n!==0)throw new W(n);a=await le({...e,port:n},o)}return b.young.add(a),a}catch(a){if(!["EADDRINUSE","EACCES"].includes(a.code)&&!(a instanceof W))throw a}throw new Error("No available ports found")}import te from"node:assert";import Ir from"node:http";i();import N from"node:process";import{Buffer as qe}from"node:buffer";import he from"node:path";import{fileURLToPath as Je}from"node:url";import Ve from"node:child_process";import q,{constants as ge}from"node:fs/promises";i();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}i();import{promisify as ze}from"node:util";import Y from"node:process";import{execFile as Ke}from"node:child_process";i();import{promisify as Ie}from"node:util";import Ne from"node:process";import{execFile as Re}from"node:child_process";var ke=Ie(Re);async function j(){if(Ne.platform!=="darwin")throw new Error("macOS only");let{stdout:e}=await ke("defaults",["read","com.apple.LaunchServices/com.apple.launchservices.secure","LSHandlers"]);return/LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(e)?.groups.id??"com.apple.Safari"}i();i();import Fe from"node:process";import{promisify as Oe}from"node:util";import{execFile as Me,execFileSync as qr}from"node:child_process";var De=Oe(Me);async function ue(e,{humanReadableOutput:r=!0}={}){if(Fe.platform!=="darwin")throw new Error("macOS only");let t=r?[]:["-ss"],{stdout:o}=await De("osascript",["-e",e,t]);return o.trim()}async function z(e){return ue(`tell application "Finder" to set app_path to application file id "${e}" as string
2
+ tell application "System Events" to get value of property list item "CFBundleName" of property list file (app_path & ":Contents:Info.plist")`)}i();import{promisify as He}from"node:util";import{execFile as Ge}from"node:child_process";var _e=He(Ge),je={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"}},I=class extends Error{};async function K(e=_e){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 I(`Cannot find Windows browser in stdout: ${JSON.stringify(r)}`);let{id:o}=t.groups,n=je[o];if(!n)throw new I(`Unknown browser ID: ${o}`);return n}var Ye=ze(Ke),Xe=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 Ye("xdg-mime",["query","default","x-scheme-handler/http"]),r=e.trim();return{name:Xe(r.replace(/.desktop$/,"").replace("-"," ")),id:r}}if(Y.platform==="win32")return K();throw new Error("Only macOS, Linux, and Windows are supported")}var J=he.dirname(Je(import.meta.url)),pe=he.join(J,"xdg-open"),{platform:y,arch:de}=N,Qe=(()=>{let e="/mnt/",r;return async function(){if(r)return r;let t="/etc/wsl.conf",o=!1;try{await q.access(t,ge.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}})(),fe=async(e,r)=>{let t;for(let o of e)try{return await r(o)}catch(n){t=n}throw t},R=async e=>{if(e={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...e},Array.isArray(e.app))return fe(e.app,l=>R({...e,app:l}));let{name:r,arguments:t=[]}=e.app??{};if(t=[...t],Array.isArray(r))return fe(r,l=>R({...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]),R({...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&&!oe()&&!r){let l=await Qe();o=E?`${l}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${N.env.SYSTEMROOT||N.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=qe.from(c.join(" "),"utf16le").toString("base64")}else{if(r)o=r;else{let l=!J||J==="/",c=!1;try{await q.access(pe,ge.X_OK),c=!0}catch{}o=N.versions.electron??(y==="android"||l||!c)?"xdg-open":pe}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 p=Ve.spawn(o,n,a);return e.wait?new Promise((l,c)=>{p.once("error",c),p.once("close",u=>{if(!e.allowNonzeroExitCode&&u>0){c(new Error(`Exited with code ${u}`));return}l(p)})}):(p.unref(),p)},Ze=(e,r)=>{if(typeof e!="string")throw new TypeError("Expected a `target`");return R({...r,target:e})};function me(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 me(r);if(!e)throw new Error(`${y} is not supported`);return me(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 we=Ze;i();import Ee from"node:assert";i();import U from"node:process";i();i();var F={};Le(F,{beep:()=>Er,clearScreen:()=>vr,clearTerminal:()=>Sr,cursorBackward:()=>ir,cursorDown:()=>nr,cursorForward:()=>sr,cursorGetPosition:()=>lr,cursorHide:()=>dr,cursorLeft:()=>ye,cursorMove:()=>or,cursorNextLine:()=>ur,cursorPrevLine:()=>pr,cursorRestorePosition:()=>cr,cursorSavePosition:()=>ar,cursorShow:()=>fr,cursorTo:()=>tr,cursorUp:()=>be,enterAlternativeScreen:()=>Pr,eraseDown:()=>wr,eraseEndLine:()=>hr,eraseLine:()=>ve,eraseLines:()=>mr,eraseScreen:()=>Q,eraseStartLine:()=>gr,eraseUp:()=>xr,exitAlternativeScreen:()=>Ar,iTerm:()=>$r,image:()=>Lr,link:()=>Tr,scrollDown:()=>yr,scrollUp:()=>br});i();import Z from"node:process";i();var k=globalThis.window?.document!==void 0,Et=globalThis.process?.versions?.node!==void 0,Tt=globalThis.process?.versions?.bun!==void 0,Lt=globalThis.Deno?.version?.deno!==void 0,$t=globalThis.process?.versions?.electron!==void 0,Ct=globalThis.navigator?.userAgent?.includes("jsdom")===!0,Bt=typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope,Ut=typeof DedicatedWorkerGlobalScope<"u"&&globalThis instanceof DedicatedWorkerGlobalScope,Wt=typeof SharedWorkerGlobalScope<"u"&&globalThis instanceof SharedWorkerGlobalScope,It=typeof ServiceWorkerGlobalScope<"u"&&globalThis instanceof ServiceWorkerGlobalScope,$=globalThis.navigator?.userAgentData?.platform,Nt=$==="macOS"||globalThis.navigator?.platform==="MacIntel"||globalThis.navigator?.userAgent?.includes(" Mac ")===!0||globalThis.process?.platform==="darwin",Rt=$==="Windows"||globalThis.navigator?.platform==="Win32"||globalThis.process?.platform==="win32",kt=$==="Linux"||globalThis.navigator?.platform?.startsWith("Linux")===!0||globalThis.navigator?.userAgent?.includes(" Linux ")===!0||globalThis.process?.platform==="linux",Ft=$==="iOS"||globalThis.navigator?.platform==="MacIntel"&&globalThis.navigator?.maxTouchPoints>1||/iPad|iPhone|iPod/.test(globalThis.navigator?.platform),Ot=$==="Android"||globalThis.navigator?.platform==="Android"||globalThis.navigator?.userAgent?.includes(" Android ")===!0||globalThis.process?.platform==="android";var s="\x1B[",B="\x1B]",S="\x07",C=";",xe=!k&&Z.env.TERM_PROGRAM==="Apple_Terminal",er=!k&&Z.platform==="win32",rr=k?()=>{throw new Error("`process.cwd()` only works in Node.js, not the browser.")}:Z.cwd,tr=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");return typeof r!="number"?s+(e+1)+"G":s+(r+1)+C+(e+1)+"H"},or=(e,r)=>{if(typeof e!="number")throw new TypeError("The `x` argument is required");let t="";return e<0?t+=s+-e+"D":e>0&&(t+=s+e+"C"),r<0?t+=s+-r+"A":r>0&&(t+=s+r+"B"),t},be=(e=1)=>s+e+"A",nr=(e=1)=>s+e+"B",sr=(e=1)=>s+e+"C",ir=(e=1)=>s+e+"D",ye=s+"G",ar=xe?"\x1B7":s+"s",cr=xe?"\x1B8":s+"u",lr=s+"6n",ur=s+"E",pr=s+"F",dr=s+"?25l",fr=s+"?25h",mr=e=>{let r="";for(let t=0;t<e;t++)r+=ve+(t<e-1?be():"");return e&&(r+=ye),r},hr=s+"K",gr=s+"1K",ve=s+"2K",wr=s+"J",xr=s+"1J",Q=s+"2J",br=s+"S",yr=s+"T",vr="\x1Bc",Sr=er?`${Q}${s}0f`:`${Q}${s}3J${s}H`,Pr=s+"?1049h",Ar=s+"?1049l",Er=S,Tr=(e,r)=>[B,"8",C,C,r,S,e,B,"8",C,C,S].join(""),Lr=(e,r={})=>{let t=`${B}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},$r={setCwd:(e=rr())=>`${B}50;CurrentDir=${e}${S}`,annotation(e,r={}){let t=`${B}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 Cr from"node:assert";import Br from"node:events";import f from"node:process";import Se from"node:readline";var O=class e extends Br{static active=!1;value=void 0;firstRender=!0;done=!1;closed=!1;aborted=!1;exited=!1;close;constructor(){super(),Cr(!e.active,"only one prompt can be active at a time"),e.active=!0;let r=Se.createInterface({input:f.stdin,escapeCodeTimeout:50});Se.emitKeypressEvents(f.stdin,r),f.stdin.isTTY&&f.stdin.setRawMode(!0);let t=["SelectPrompt"].includes(this.constructor.name),o=(n,a)=>{let p=Ur(a,t);p===!1?this._(n,a):p&&typeof this[p]=="function"?this[p](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(F.beep)}render(){this.onRender(),this.firstRender&&(this.firstRender=!1)}},Ur=(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}}},Zt=(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 Pe=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??(()=>{d(r),d({ensureEmptyLineAbove:!0,content:"Aborting because ggt is not running in an interactive terminal."}),U.exit(1)});return Promise.resolve(t())}return new Promise(t=>{let o=new ee(r);o.on("submit",t),o.on("exit",()=>U.exit(0)),o.on("abort",()=>U.exit(1))})},ee=class extends O{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&&U.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&&U.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 Wr=h.object({id:h.union([h.string(),h.number()]).transform(Number),name:h.string().nullish(),email:h.string()}),re=Symbol.for("user"),Te=e=>e.get(re),vo=e=>{let r=Te(e);return Ee(r,"missing user"),r},So=(e,r)=>{e.set(re,r)},M=async e=>{let r=Te(e);if(r)return r;let t=ne(e);if(t)try{let o=await ie({context:{ctx:e},url:`https://${w.domains.services}/auth/api/current-user`,headers:t,responseType:"json",resolveBodyOnly:!0});return r=Wr.parse(o),e.set(re,r),e.log.info("loaded user"),r}catch(o){se(e,o);return}},Po=async e=>{let r=await M(e);return r||(e.log.info("prompting user to log in"),d({ensureEmptyLineAbove:!0,content:`You must be logged in to use "ggt ${ae(e)}".`}),await Pe({ensureEmptyLineAbove:!0,content:"Would you like to log in?"}),await Ae(e),r=await M(e),Ee(r,"missing user after successful login"),r)};var Ro=()=>T`
3
3
  Log in to your account.
4
4
 
5
5
  {bold Usage}
6
6
  ggt login
7
- `,Nr=async e=>{let r;try{let t=await _(),o=new Promise((a,p)=>{r=Ir.createServer(async(l,c)=>{let u=new URL(`https://${w.domains.services}/auth/cli`);try{te(l.url,"missing url");let m=new URL(l.url,`http://localhost:${t}`).searchParams.get("session");te(m,"missing session"),G(e,m);let P=await O(e);te(P,"missing user after successful login"),P.name?d({ensureEmptyLineAbove:!0,content:E`Hello, ${P.name} {gray (${P.email})}`}):d({ensureEmptyLineAbove:!0,content:`Hello, ${P.email}`}),u.searchParams.set("success","true"),a()}catch(m){G(e,void 0),u.searchParams.set("success","false"),p(m)}finally{c.writeHead(303,{Location:u.toString()}),c.end()}}),e.log.info("starting login server",{port:t}),r.listen(t)}),n=new URL(`https://${w.domains.services}/auth/login`);n.searchParams.set("returnTo",`https://${w.domains.services}/auth/cli/callback?port=${t}`);try{e.log.info("opening browser",{url:n.toString()}),await we(n.toString()),d({ensureEmptyLineAbove:!0,content:E`
7
+ `,Nr=async e=>{let r;try{let t=await _(),o=new Promise((a,p)=>{r=Ir.createServer(async(l,c)=>{let u=new URL(`https://${w.domains.services}/auth/cli`);try{te(l.url,"missing url");let m=new URL(l.url,`http://localhost:${t}`).searchParams.get("session");te(m,"missing session"),G(e,m);let P=await M(e);te(P,"missing user after successful login"),P.name?d({ensureEmptyLineAbove:!0,content:T`Hello, ${P.name} {gray (${P.email})}`}):d({ensureEmptyLineAbove:!0,content:`Hello, ${P.email}`}),u.searchParams.set("success","true"),a()}catch(m){G(e,void 0),u.searchParams.set("success","false"),p(m)}finally{c.writeHead(303,{Location:u.toString()}),c.end()}}),e.log.info("starting login server",{port:t}),r.listen(t)}),n=new URL(`https://${w.domains.services}/auth/login`);n.searchParams.set("returnTo",`https://${w.domains.services}/auth/cli/callback?port=${t}`);try{e.log.info("opening browser",{url:n.toString()}),await we(n.toString()),d({ensureEmptyLineAbove:!0,content:T`
8
8
  We've opened Gadget's login page using your default browser.
9
9
 
10
10
  Please log in and then return to this terminal.
11
- `})}catch(a){e.log.error("failed to open browser",{error:a}),d({ensureEmptyLineAbove:!0,content:E`
11
+ `})}catch(a){e.log.error("failed to open browser",{error:a}),d({ensureEmptyLineAbove:!0,content:T`
12
12
  Please open the following URL in your browser and log in:
13
13
 
14
14
  {gray ${n.toString()}}
15
15
 
16
16
  Once logged in, return to this terminal.
17
- `})}await o}finally{r?.close()}},Ae=Nr;export{we as a,Ro as b,Nr as c,Ae as d,F as e,Zt as f,Pe as g,Te as h,vo as i,So as j,O as k,Po as l};
18
- //# sourceMappingURL=chunk-M2OJZLL7.js.map
17
+ `})}await o}finally{r?.close()}},Ae=Nr;export{we as a,Ro as b,Nr as c,Ae as d,O as e,Zt as f,Pe as g,Te as h,vo as i,So as j,M as k,Po as l};
18
+ //# sourceMappingURL=chunk-6FBP46EB.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/commands/login.ts", "../node_modules/.pnpm/get-port@7.1.0/node_modules/get-port/index.js", "../node_modules/.pnpm/open@10.1.0/node_modules/open/index.js", "../node_modules/.pnpm/define-lazy-prop@3.0.0/node_modules/define-lazy-prop/index.js", "../node_modules/.pnpm/default-browser@5.2.1/node_modules/default-browser/index.js", "../node_modules/.pnpm/default-browser-id@5.0.0/node_modules/default-browser-id/index.js", "../node_modules/.pnpm/bundle-name@4.1.0/node_modules/bundle-name/index.js", "../node_modules/.pnpm/run-applescript@7.0.0/node_modules/run-applescript/index.js", "../node_modules/.pnpm/default-browser@5.2.1/node_modules/default-browser/windows.js", "../src/services/user/user.ts", "../src/services/output/confirm.ts", "../src/services/output/prompt.ts", "../node_modules/.pnpm/ansi-escapes@7.0.0/node_modules/ansi-escapes/index.js", "../node_modules/.pnpm/ansi-escapes@7.0.0/node_modules/ansi-escapes/base.js", "../node_modules/.pnpm/environment@1.1.0/node_modules/environment/index.js"],
4
- "sourcesContent": ["import getPort from \"get-port\";\nimport assert from \"node:assert\";\nimport http, { type Server } from \"node:http\";\nimport open from \"open\";\nimport type { Run, Usage } from \"../services/command/command.js\";\nimport { config } from \"../services/config/config.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { writeSession } from \"../services/user/session.js\";\nimport { getUser } from \"../services/user/user.js\";\n\nexport const usage: Usage = () => sprint`\n Log in to your account.\n\n {bold Usage}\n ggt login\n`;\n\nexport const run: Run = async (ctx): Promise<void> => {\n let server: Server | undefined;\n\n try {\n const port = await getPort();\n const receiveSession = new Promise<void>((resolve, reject) => {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n server = http.createServer(async (req, res) => {\n const landingPage = new URL(`https://${config.domains.services}/auth/cli`);\n\n try {\n assert(req.url, \"missing url\");\n const session = new URL(req.url, `http://localhost:${port}`).searchParams.get(\"session\");\n assert(session, \"missing session\");\n\n writeSession(ctx, session);\n\n const user = await getUser(ctx);\n assert(user, \"missing user after successful login\");\n\n if (user.name) {\n println({ ensureEmptyLineAbove: true, content: sprint`Hello, ${user.name} {gray (${user.email})}` });\n } else {\n println({ ensureEmptyLineAbove: true, content: `Hello, ${user.email}` });\n }\n\n landingPage.searchParams.set(\"success\", \"true\");\n resolve();\n } catch (error) {\n writeSession(ctx, undefined);\n landingPage.searchParams.set(\"success\", \"false\");\n reject(error as Error);\n } finally {\n res.writeHead(303, { Location: landingPage.toString() });\n res.end();\n }\n });\n\n ctx.log.info(\"starting login server\", { port });\n server.listen(port);\n });\n\n // open the login page in the user's default browser have it\n // redirect to the cli callback route. The cli callback route will\n // send the session to the server we just started.\n const url = new URL(`https://${config.domains.services}/auth/login`);\n url.searchParams.set(\"returnTo\", `https://${config.domains.services}/auth/cli/callback?port=${port}`);\n\n try {\n ctx.log.info(\"opening browser\", { url: url.toString() });\n await open(url.toString());\n println({\n ensureEmptyLineAbove: true,\n content: sprint`\n We've opened Gadget's login page using your default browser.\n\n Please log in and then return to this terminal.\n `,\n });\n } catch (error) {\n ctx.log.error(\"failed to open browser\", { error });\n println({\n ensureEmptyLineAbove: true,\n content: sprint`\n Please open the following URL in your browser and log in:\n\n {gray ${url.toString()}}\n\n Once logged in, return to this terminal.\n `,\n });\n }\n\n await receiveSession;\n } finally {\n server?.close();\n }\n};\n\n// alias\nexport const login = run;\n", "import net from 'node:net';\nimport os from 'node:os';\n\nclass Locked extends Error {\n\tconstructor(port) {\n\t\tsuper(`${port} is locked`);\n\t}\n}\n\nconst lockedPorts = {\n\told: new Set(),\n\tyoung: new Set(),\n};\n\n// On this interval, the old locked ports are discarded,\n// the young locked ports are moved to old locked ports,\n// and a new young set for locked ports are created.\nconst releaseOldLockedPortsIntervalMs = 1000 * 15;\n\nconst minPort = 1024;\nconst maxPort = 65_535;\n\n// Lazily create timeout on first use\nlet timeout;\n\nconst getLocalHosts = () => {\n\tconst interfaces = os.networkInterfaces();\n\n\t// Add undefined value for createServer function to use default host,\n\t// and default IPv4 host in case createServer defaults to IPv6.\n\tconst results = new Set([undefined, '0.0.0.0']);\n\n\tfor (const _interface of Object.values(interfaces)) {\n\t\tfor (const config of _interface) {\n\t\t\tresults.add(config.address);\n\t\t}\n\t}\n\n\treturn results;\n};\n\nconst checkAvailablePort = options =>\n\tnew Promise((resolve, reject) => {\n\t\tconst server = net.createServer();\n\t\tserver.unref();\n\t\tserver.on('error', reject);\n\n\t\tserver.listen(options, () => {\n\t\t\tconst {port} = server.address();\n\t\t\tserver.close(() => {\n\t\t\t\tresolve(port);\n\t\t\t});\n\t\t});\n\t});\n\nconst getAvailablePort = async (options, hosts) => {\n\tif (options.host || options.port === 0) {\n\t\treturn checkAvailablePort(options);\n\t}\n\n\tfor (const host of hosts) {\n\t\ttry {\n\t\t\tawait checkAvailablePort({port: options.port, host}); // eslint-disable-line no-await-in-loop\n\t\t} catch (error) {\n\t\t\tif (!['EADDRNOTAVAIL', 'EINVAL'].includes(error.code)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn options.port;\n};\n\nconst portCheckSequence = function * (ports) {\n\tif (ports) {\n\t\tyield * ports;\n\t}\n\n\tyield 0; // Fall back to 0 if anything else failed\n};\n\nexport default async function getPorts(options) {\n\tlet ports;\n\tlet exclude = new Set();\n\n\tif (options) {\n\t\tif (options.port) {\n\t\t\tports = typeof options.port === 'number' ? [options.port] : options.port;\n\t\t}\n\n\t\tif (options.exclude) {\n\t\t\tconst excludeIterable = options.exclude;\n\n\t\t\tif (typeof excludeIterable[Symbol.iterator] !== 'function') {\n\t\t\t\tthrow new TypeError('The `exclude` option must be an iterable.');\n\t\t\t}\n\n\t\t\tfor (const element of excludeIterable) {\n\t\t\t\tif (typeof element !== 'number') {\n\t\t\t\t\tthrow new TypeError('Each item in the `exclude` option must be a number corresponding to the port you want excluded.');\n\t\t\t\t}\n\n\t\t\t\tif (!Number.isSafeInteger(element)) {\n\t\t\t\t\tthrow new TypeError(`Number ${element} in the exclude option is not a safe integer and can't be used`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\texclude = new Set(excludeIterable);\n\t\t}\n\t}\n\n\tif (timeout === undefined) {\n\t\ttimeout = setTimeout(() => {\n\t\t\ttimeout = undefined;\n\n\t\t\tlockedPorts.old = lockedPorts.young;\n\t\t\tlockedPorts.young = new Set();\n\t\t}, releaseOldLockedPortsIntervalMs);\n\n\t\t// Does not exist in some environments (Electron, Jest jsdom env, browser, etc).\n\t\tif (timeout.unref) {\n\t\t\ttimeout.unref();\n\t\t}\n\t}\n\n\tconst hosts = getLocalHosts();\n\n\tfor (const port of portCheckSequence(ports)) {\n\t\ttry {\n\t\t\tif (exclude.has(port)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet availablePort = await getAvailablePort({...options, port}, hosts); // eslint-disable-line no-await-in-loop\n\t\t\twhile (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {\n\t\t\t\tif (port !== 0) {\n\t\t\t\t\tthrow new Locked(port);\n\t\t\t\t}\n\n\t\t\t\tavailablePort = await getAvailablePort({...options, port}, hosts); // eslint-disable-line no-await-in-loop\n\t\t\t}\n\n\t\t\tlockedPorts.young.add(availablePort);\n\n\t\t\treturn availablePort;\n\t\t} catch (error) {\n\t\t\tif (!['EADDRINUSE', 'EACCES'].includes(error.code) && !(error instanceof Locked)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new Error('No available ports found');\n}\n\nexport function portNumbers(from, to) {\n\tif (!Number.isInteger(from) || !Number.isInteger(to)) {\n\t\tthrow new TypeError('`from` and `to` must be integer numbers');\n\t}\n\n\tif (from < minPort || from > maxPort) {\n\t\tthrow new RangeError(`'from' must be between ${minPort} and ${maxPort}`);\n\t}\n\n\tif (to < minPort || to > maxPort) {\n\t\tthrow new RangeError(`'to' must be between ${minPort} and ${maxPort}`);\n\t}\n\n\tif (from > to) {\n\t\tthrow new RangeError('`to` must be greater than or equal to `from`');\n\t}\n\n\tconst generator = function * (from, to) {\n\t\tfor (let port = from; port <= to; port++) {\n\t\t\tyield port;\n\t\t}\n\t};\n\n\treturn generator(from, to);\n}\n\nexport function clearLockedPorts() {\n\tlockedPorts.old.clear();\n\tlockedPorts.young.clear();\n}\n", "import process from 'node:process';\nimport {Buffer} from 'node:buffer';\nimport path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport childProcess from 'node:child_process';\nimport fs, {constants as fsConstants} from 'node:fs/promises';\nimport isWsl from 'is-wsl';\nimport defineLazyProperty from 'define-lazy-prop';\nimport defaultBrowser from 'default-browser';\nimport isInsideContainer from 'is-inside-container';\n\n// Path to included `xdg-open`.\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst localXdgOpenPath = path.join(__dirname, 'xdg-open');\n\nconst {platform, arch} = process;\n\n/**\nGet the mount point for fixed drives in WSL.\n\n@inner\n@returns {string} The mount point.\n*/\nconst getWslDrivesMountPoint = (() => {\n\t// Default value for \"root\" param\n\t// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config\n\tconst defaultMountPoint = '/mnt/';\n\n\tlet mountPoint;\n\n\treturn async function () {\n\t\tif (mountPoint) {\n\t\t\t// Return memoized mount point value\n\t\t\treturn mountPoint;\n\t\t}\n\n\t\tconst configFilePath = '/etc/wsl.conf';\n\n\t\tlet isConfigFileExists = false;\n\t\ttry {\n\t\t\tawait fs.access(configFilePath, fsConstants.F_OK);\n\t\t\tisConfigFileExists = true;\n\t\t} catch {}\n\n\t\tif (!isConfigFileExists) {\n\t\t\treturn defaultMountPoint;\n\t\t}\n\n\t\tconst configContent = await fs.readFile(configFilePath, {encoding: 'utf8'});\n\t\tconst configMountPoint = /(?<!#.*)root\\s*=\\s*(?<mountPoint>.*)/g.exec(configContent);\n\n\t\tif (!configMountPoint) {\n\t\t\treturn defaultMountPoint;\n\t\t}\n\n\t\tmountPoint = configMountPoint.groups.mountPoint.trim();\n\t\tmountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;\n\n\t\treturn mountPoint;\n\t};\n})();\n\nconst pTryEach = async (array, mapper) => {\n\tlet latestError;\n\n\tfor (const item of array) {\n\t\ttry {\n\t\t\treturn await mapper(item); // eslint-disable-line no-await-in-loop\n\t\t} catch (error) {\n\t\t\tlatestError = error;\n\t\t}\n\t}\n\n\tthrow latestError;\n};\n\nconst baseOpen = async options => {\n\toptions = {\n\t\twait: false,\n\t\tbackground: false,\n\t\tnewInstance: false,\n\t\tallowNonzeroExitCode: false,\n\t\t...options,\n\t};\n\n\tif (Array.isArray(options.app)) {\n\t\treturn pTryEach(options.app, singleApp => baseOpen({\n\t\t\t...options,\n\t\t\tapp: singleApp,\n\t\t}));\n\t}\n\n\tlet {name: app, arguments: appArguments = []} = options.app ?? {};\n\tappArguments = [...appArguments];\n\n\tif (Array.isArray(app)) {\n\t\treturn pTryEach(app, appName => baseOpen({\n\t\t\t...options,\n\t\t\tapp: {\n\t\t\t\tname: appName,\n\t\t\t\targuments: appArguments,\n\t\t\t},\n\t\t}));\n\t}\n\n\tif (app === 'browser' || app === 'browserPrivate') {\n\t\t// IDs from default-browser for macOS and windows are the same\n\t\tconst ids = {\n\t\t\t'com.google.chrome': 'chrome',\n\t\t\t'google-chrome.desktop': 'chrome',\n\t\t\t'org.mozilla.firefox': 'firefox',\n\t\t\t'firefox.desktop': 'firefox',\n\t\t\t'com.microsoft.msedge': 'edge',\n\t\t\t'com.microsoft.edge': 'edge',\n\t\t\t'microsoft-edge.desktop': 'edge',\n\t\t};\n\n\t\t// Incognito flags for each browser in `apps`.\n\t\tconst flags = {\n\t\t\tchrome: '--incognito',\n\t\t\tfirefox: '--private-window',\n\t\t\tedge: '--inPrivate',\n\t\t};\n\n\t\tconst browser = await defaultBrowser();\n\t\tif (browser.id in ids) {\n\t\t\tconst browserName = ids[browser.id];\n\n\t\t\tif (app === 'browserPrivate') {\n\t\t\t\tappArguments.push(flags[browserName]);\n\t\t\t}\n\n\t\t\treturn baseOpen({\n\t\t\t\t...options,\n\t\t\t\tapp: {\n\t\t\t\t\tname: apps[browserName],\n\t\t\t\t\targuments: appArguments,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\tthrow new Error(`${browser.name} is not supported as a default browser`);\n\t}\n\n\tlet command;\n\tconst cliArguments = [];\n\tconst childProcessOptions = {};\n\n\tif (platform === 'darwin') {\n\t\tcommand = 'open';\n\n\t\tif (options.wait) {\n\t\t\tcliArguments.push('--wait-apps');\n\t\t}\n\n\t\tif (options.background) {\n\t\t\tcliArguments.push('--background');\n\t\t}\n\n\t\tif (options.newInstance) {\n\t\t\tcliArguments.push('--new');\n\t\t}\n\n\t\tif (app) {\n\t\t\tcliArguments.push('-a', app);\n\t\t}\n\t} else if (platform === 'win32' || (isWsl && !isInsideContainer() && !app)) {\n\t\tconst mountPoint = await getWslDrivesMountPoint();\n\n\t\tcommand = isWsl\n\t\t\t? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`\n\t\t\t: `${process.env.SYSTEMROOT || process.env.windir || 'C:\\\\Windows'}\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell`;\n\n\t\tcliArguments.push(\n\t\t\t'-NoProfile',\n\t\t\t'-NonInteractive',\n\t\t\t'-ExecutionPolicy',\n\t\t\t'Bypass',\n\t\t\t'-EncodedCommand',\n\t\t);\n\n\t\tif (!isWsl) {\n\t\t\tchildProcessOptions.windowsVerbatimArguments = true;\n\t\t}\n\n\t\tconst encodedArguments = ['Start'];\n\n\t\tif (options.wait) {\n\t\t\tencodedArguments.push('-Wait');\n\t\t}\n\n\t\tif (app) {\n\t\t\t// Double quote with double quotes to ensure the inner quotes are passed through.\n\t\t\t// Inner quotes are delimited for PowerShell interpretation with backticks.\n\t\t\tencodedArguments.push(`\"\\`\"${app}\\`\"\"`);\n\t\t\tif (options.target) {\n\t\t\t\tappArguments.push(options.target);\n\t\t\t}\n\t\t} else if (options.target) {\n\t\t\tencodedArguments.push(`\"${options.target}\"`);\n\t\t}\n\n\t\tif (appArguments.length > 0) {\n\t\t\tappArguments = appArguments.map(argument => `\"\\`\"${argument}\\`\"\"`);\n\t\t\tencodedArguments.push('-ArgumentList', appArguments.join(','));\n\t\t}\n\n\t\t// Using Base64-encoded command, accepted by PowerShell, to allow special characters.\n\t\toptions.target = Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');\n\t} else {\n\t\tif (app) {\n\t\t\tcommand = app;\n\t\t} else {\n\t\t\t// When bundled by Webpack, there's no actual package file path and no local `xdg-open`.\n\t\t\tconst isBundled = !__dirname || __dirname === '/';\n\n\t\t\t// Check if local `xdg-open` exists and is executable.\n\t\t\tlet exeLocalXdgOpen = false;\n\t\t\ttry {\n\t\t\t\tawait fs.access(localXdgOpenPath, fsConstants.X_OK);\n\t\t\t\texeLocalXdgOpen = true;\n\t\t\t} catch {}\n\n\t\t\tconst useSystemXdgOpen = process.versions.electron\n\t\t\t\t?? (platform === 'android' || isBundled || !exeLocalXdgOpen);\n\t\t\tcommand = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;\n\t\t}\n\n\t\tif (appArguments.length > 0) {\n\t\t\tcliArguments.push(...appArguments);\n\t\t}\n\n\t\tif (!options.wait) {\n\t\t\t// `xdg-open` will block the process unless stdio is ignored\n\t\t\t// and it's detached from the parent even if it's unref'd.\n\t\t\tchildProcessOptions.stdio = 'ignore';\n\t\t\tchildProcessOptions.detached = true;\n\t\t}\n\t}\n\n\tif (platform === 'darwin' && appArguments.length > 0) {\n\t\tcliArguments.push('--args', ...appArguments);\n\t}\n\n\t// This has to come after `--args`.\n\tif (options.target) {\n\t\tcliArguments.push(options.target);\n\t}\n\n\tconst subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);\n\n\tif (options.wait) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsubprocess.once('error', reject);\n\n\t\t\tsubprocess.once('close', exitCode => {\n\t\t\t\tif (!options.allowNonzeroExitCode && exitCode > 0) {\n\t\t\t\t\treject(new Error(`Exited with code ${exitCode}`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresolve(subprocess);\n\t\t\t});\n\t\t});\n\t}\n\n\tsubprocess.unref();\n\n\treturn subprocess;\n};\n\nconst open = (target, options) => {\n\tif (typeof target !== 'string') {\n\t\tthrow new TypeError('Expected a `target`');\n\t}\n\n\treturn baseOpen({\n\t\t...options,\n\t\ttarget,\n\t});\n};\n\nexport const openApp = (name, options) => {\n\tif (typeof name !== 'string' && !Array.isArray(name)) {\n\t\tthrow new TypeError('Expected a valid `name`');\n\t}\n\n\tconst {arguments: appArguments = []} = options ?? {};\n\tif (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {\n\t\tthrow new TypeError('Expected `appArguments` as Array type');\n\t}\n\n\treturn baseOpen({\n\t\t...options,\n\t\tapp: {\n\t\t\tname,\n\t\t\targuments: appArguments,\n\t\t},\n\t});\n};\n\nfunction detectArchBinary(binary) {\n\tif (typeof binary === 'string' || Array.isArray(binary)) {\n\t\treturn binary;\n\t}\n\n\tconst {[arch]: archBinary} = binary;\n\n\tif (!archBinary) {\n\t\tthrow new Error(`${arch} is not supported`);\n\t}\n\n\treturn archBinary;\n}\n\nfunction detectPlatformBinary({[platform]: platformBinary}, {wsl}) {\n\tif (wsl && isWsl) {\n\t\treturn detectArchBinary(wsl);\n\t}\n\n\tif (!platformBinary) {\n\t\tthrow new Error(`${platform} is not supported`);\n\t}\n\n\treturn detectArchBinary(platformBinary);\n}\n\nexport const apps = {};\n\ndefineLazyProperty(apps, 'chrome', () => detectPlatformBinary({\n\tdarwin: 'google chrome',\n\twin32: 'chrome',\n\tlinux: ['google-chrome', 'google-chrome-stable', 'chromium'],\n}, {\n\twsl: {\n\t\tia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',\n\t\tx64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'],\n\t},\n}));\n\ndefineLazyProperty(apps, 'firefox', () => detectPlatformBinary({\n\tdarwin: 'firefox',\n\twin32: 'C:\\\\Program Files\\\\Mozilla Firefox\\\\firefox.exe',\n\tlinux: 'firefox',\n}, {\n\twsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe',\n}));\n\ndefineLazyProperty(apps, 'edge', () => detectPlatformBinary({\n\tdarwin: 'microsoft edge',\n\twin32: 'msedge',\n\tlinux: ['microsoft-edge', 'microsoft-edge-dev'],\n}, {\n\twsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',\n}));\n\ndefineLazyProperty(apps, 'browser', () => 'browser');\n\ndefineLazyProperty(apps, 'browserPrivate', () => 'browserPrivate');\n\nexport default open;\n", "export default function defineLazyProperty(object, propertyName, valueGetter) {\n\tconst define = value => Object.defineProperty(object, propertyName, {value, enumerable: true, writable: true});\n\n\tObject.defineProperty(object, propertyName, {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\tconst result = valueGetter();\n\t\t\tdefine(result);\n\t\t\treturn result;\n\t\t},\n\t\tset(value) {\n\t\t\tdefine(value);\n\t\t}\n\t});\n\n\treturn object;\n}\n", "import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\nimport defaultBrowserId from 'default-browser-id';\nimport bundleName from 'bundle-name';\nimport windows from './windows.js';\n\nconst execFileAsync = promisify(execFile);\n\n// Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js\nconst titleize = string => string.toLowerCase().replaceAll(/(?:^|\\s|-)\\S/g, x => x.toUpperCase());\n\nexport default async function defaultBrowser() {\n\tif (process.platform === 'darwin') {\n\t\tconst id = await defaultBrowserId();\n\t\tconst name = await bundleName(id);\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'linux') {\n\t\tconst {stdout} = await execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);\n\t\tconst id = stdout.trim();\n\t\tconst name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'win32') {\n\t\treturn windows();\n\t}\n\n\tthrow new Error('Only macOS, Linux, and Windows are supported');\n}\n", "import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport default async function defaultBrowserId() {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst {stdout} = await execFileAsync('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);\n\n\t// `(?!-)` is to prevent matching `LSHandlerRoleAll = \"-\";`.\n\tconst match = /LSHandlerRoleAll = \"(?!-)(?<id>[^\"]+?)\";\\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);\n\n\treturn match?.groups.id ?? 'com.apple.Safari';\n}\n", "import {runAppleScript} from 'run-applescript';\n\nexport default async function bundleName(bundleId) {\n\treturn runAppleScript(`tell application \"Finder\" to set app_path to application file id \"${bundleId}\" as string\\ntell application \"System Events\" to get value of property list item \"CFBundleName\" of property list file (app_path & \":Contents:Info.plist\")`);\n}\n", "import process from 'node:process';\nimport {promisify} from 'node:util';\nimport {execFile, execFileSync} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport async function runAppleScript(script, {humanReadableOutput = true} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst {stdout} = await execFileAsync('osascript', ['-e', script, outputArguments]);\n\treturn stdout.trim();\n}\n\nexport function runAppleScriptSync(script, {humanReadableOutput = true} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst stdout = execFileSync('osascript', ['-e', script, ...outputArguments], {\n\t\tencoding: 'utf8',\n\t\tstdio: ['ignore', 'pipe', 'ignore'],\n\t\ttimeout: 500,\n\t});\n\n\treturn stdout.trim();\n}\n", "import {promisify} from 'node:util';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\n// Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake\n// ones that look real and match the macOS/Linux versions for cross-platform apps.\nconst windowsBrowserProgIds = {\n\tAppXq0fevzme2pys62n3e0fbqa7peapykr8v: {name: 'Edge', id: 'com.microsoft.edge.old'},\n\tMSEdgeDHTML: {name: 'Edge', id: 'com.microsoft.edge'}, // On macOS, it's \"com.microsoft.edgemac\"\n\tMSEdgeHTM: {name: 'Edge', id: 'com.microsoft.edge'}, // Newer Edge/Win10 releases\n\t'IE.HTTP': {name: 'Internet Explorer', id: 'com.microsoft.ie'},\n\tFirefoxURL: {name: 'Firefox', id: 'org.mozilla.firefox'},\n\tChromeHTML: {name: 'Chrome', id: 'com.google.chrome'},\n\tBraveHTML: {name: 'Brave', id: 'com.brave.Browser'},\n\tBraveBHTML: {name: 'Brave Beta', id: 'com.brave.Browser.beta'},\n\tBraveSSHTM: {name: 'Brave Nightly', id: 'com.brave.Browser.nightly'},\n};\n\nexport class UnknownBrowserError extends Error {}\n\nexport default async function defaultBrowser(_execFileAsync = execFileAsync) {\n\tconst {stdout} = await _execFileAsync('reg', [\n\t\t'QUERY',\n\t\t' HKEY_CURRENT_USER\\\\Software\\\\Microsoft\\\\Windows\\\\Shell\\\\Associations\\\\UrlAssociations\\\\http\\\\UserChoice',\n\t\t'/v',\n\t\t'ProgId',\n\t]);\n\n\tconst match = /ProgId\\s*REG_SZ\\s*(?<id>\\S+)/.exec(stdout);\n\tif (!match) {\n\t\tthrow new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);\n\t}\n\n\tconst {id} = match.groups;\n\n\tconst browser = windowsBrowserProgIds[id];\n\tif (!browser) {\n\t\tthrow new UnknownBrowserError(`Unknown browser ID: ${id}`);\n\t}\n\n\treturn browser;\n}\n", "import assert from \"node:assert\";\nimport { z } from \"zod\";\nimport { login } from \"../../commands/login.js\";\nimport { maybeGetCurrentCommand } from \"../command/command.js\";\nimport type { Context } from \"../command/context.js\";\nimport { config } from \"../config/config.js\";\nimport { maybeLoadAuthHeaders, swallowUnauthorized } from \"../http/auth.js\";\nimport { http } from \"../http/http.js\";\nimport { confirm } from \"../output/confirm.js\";\nimport { println } from \"../output/print.js\";\n\nconst User = z.object({\n id: z.union([z.string(), z.number()]).transform(Number),\n name: z.string().nullish(),\n email: z.string(),\n});\n\nexport type User = z.infer<typeof User>;\n\nconst kUser = Symbol.for(\"user\");\n\nexport const maybeGetCurrentUser = (ctx: Context): User | undefined => {\n return ctx.get(kUser) as User | undefined;\n};\n\nexport const getCurrentUser = (ctx: Context): User => {\n const user = maybeGetCurrentUser(ctx);\n assert(user, \"missing user\");\n return user;\n};\n\nexport const setCurrentUser = (ctx: Context, user: User): void => {\n ctx.set(kUser, user);\n};\n\n/**\n * Retrieves the currently logged in user from Gadgets API.\n *\n * @returns A Promise that resolves to a User object representing the\n * current user, or undefined if the user is not authenticated.\n */\nexport const getUser = async (ctx: Context): Promise<User | undefined> => {\n let user = maybeGetCurrentUser(ctx);\n if (user) {\n return user;\n }\n\n const headers = maybeLoadAuthHeaders(ctx);\n if (!headers) {\n return undefined;\n }\n\n try {\n const json = await http({\n context: { ctx },\n url: `https://${config.domains.services}/auth/api/current-user`,\n headers,\n responseType: \"json\",\n resolveBodyOnly: true,\n });\n\n user = User.parse(json);\n ctx.set(kUser, user);\n ctx.log.info(\"loaded user\");\n\n return user;\n } catch (error) {\n swallowUnauthorized(ctx, error);\n return undefined;\n }\n};\n\n/**\n * Retrieves the current user or prompts the user to log in if not\n * already logged in.\n *\n * @param ctx - The current context.\n * @returns A Promise that resolves to the current user.\n */\nexport const getUserOrLogin = async (ctx: Context): Promise<User> => {\n let user = await getUser(ctx);\n if (user) {\n return user;\n }\n\n ctx.log.info(\"prompting user to log in\");\n println({\n ensureEmptyLineAbove: true,\n content: `You must be logged in to use \"ggt ${maybeGetCurrentCommand(ctx)}\".`,\n });\n\n await confirm({ ensureEmptyLineAbove: true, content: \"Would you like to log in?\" });\n await login(ctx);\n\n user = await getUser(ctx);\n assert(user, \"missing user after successful login\");\n\n return user;\n};\n", "import chalk from \"chalk\";\nimport process from \"node:process\";\nimport type { Promisable } from \"type-fest\";\nimport { defaults } from \"../util/object.js\";\nimport type { PartialExcept } from \"../util/types.js\";\nimport { output } from \"./output.js\";\nimport { println, type PrintOptions } from \"./print.js\";\nimport { Prompt, type StdinKey } from \"./prompt.js\";\nimport { sprintln } from \"./sprint.js\";\n\nexport type ConfirmOptions = PrintOptions & {\n /**\n * If `true`, ggt will exit if the user selects \"No\".\n *\n * @default true\n */\n exitWhenNo?: boolean;\n\n /**\n * What to do if ggt is not running in an interactive terminal.\n *\n * @default ```\n * println(options)(text);\n * println({ ensureEmptyLineAbove: true })`\n * Aborting because ggt is not running in an interactive terminal.\n * `;\n * process.exit(1);\n * ```\n */\n whenNotInteractive?: () => Promisable<void>;\n};\n\nexport type confirm = typeof confirm;\n\nexport const confirm = (contentOrOptions: string | ConfirmOptions): Promise<void> => {\n let options: ConfirmOptions;\n if (typeof contentOrOptions === \"string\") {\n options = { content: contentOrOptions };\n } else {\n options = contentOrOptions;\n }\n\n options = defaults(options, {\n ensureEmptyLineAbove: true,\n ensureNewLine: true,\n exitWhenNo: true,\n });\n\n if (!output.isInteractive) {\n const whenNotInteractive =\n options.whenNotInteractive ??\n (() => {\n println(options);\n println({ ensureEmptyLineAbove: true, content: \"Aborting because ggt is not running in an interactive terminal.\" });\n process.exit(1);\n });\n\n return Promise.resolve(whenNotInteractive());\n }\n\n return new Promise((resolve) => {\n const conf = new Confirm(options);\n conf.on(\"submit\", resolve);\n conf.on(\"exit\", () => process.exit(0));\n conf.on(\"abort\", () => process.exit(1));\n });\n};\n\n/**\n * Inspired by `prompts`:\n * https://github.com/terkelg/prompts/blob/e0519913ec4fcc6746bb3d97d8cd0960c3f3ffde/lib/elements/confirm.js\n *\n * MIT License\n *\n * Copyright (c) 2018 Terkel Gjervig Nielsen\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nexport class Confirm extends Prompt {\n override value: boolean | undefined = undefined;\n defaultValue = false;\n options;\n\n constructor(options: PartialExcept<ConfirmOptions, \"content\">) {\n super();\n\n this.options = defaults(options, {\n exitWhenNo: true,\n ensureEmptyLineAbove: true,\n });\n\n this.render();\n }\n\n reset(): void {\n this.value = this.defaultValue;\n this.fire();\n this.render();\n }\n\n exit(): void {\n this.abort();\n }\n\n abort(): void {\n this.value = false;\n this.done = this.aborted = true;\n this.fire();\n this.render(false);\n this.close();\n\n if (this.options.exitWhenNo) {\n process.exit(0);\n }\n }\n\n submit(): void {\n this.value = this.value ?? false;\n this.done = true;\n this.aborted = false;\n this.fire();\n this.render();\n this.close();\n\n if (this.options.exitWhenNo && !this.value) {\n process.exit(0);\n }\n }\n\n override _(char: string, _key: StdinKey): void {\n if (char.toLowerCase() === \"y\") {\n this.value = true;\n this.submit();\n return;\n }\n\n if (char.toLowerCase() === \"n\") {\n this.value = false;\n this.submit();\n return;\n }\n\n this.bell();\n }\n\n override render(value = this.value): void {\n super.render();\n\n if (this.done) {\n output.persistPrompt(\n sprintln({\n ...this.options,\n content: `${this.options.content} ${value ? chalk.bold.greenBright(\"Yes.\") : chalk.bold.redBright(\"No.\")}`,\n }),\n );\n return;\n }\n\n output.updatePrompt(\n sprintln({\n ...this.options,\n content: `${this.options.content} ${this.defaultValue ? \"[Y/n] \" : \"[y/N] \"}`,\n }),\n );\n }\n}\n", "import ansiEscapes from \"ansi-escapes\";\nimport assert from \"node:assert\";\nimport EventEmitter from \"node:events\";\nimport process from \"node:process\";\nimport readline from \"node:readline\";\nimport { output } from \"./output.js\";\n\n/**\n * Inspired by `prompts`:\n * https://github.com/terkelg/prompts/blob/e0519913ec4fcc6746bb3d97d8cd0960c3f3ffde/lib/elements/prompt.js\n *\n * MIT License\n *\n * Copyright (c) 2018 Terkel Gjervig Nielsen\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nexport class Prompt extends EventEmitter {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [action: string]: any; // (key: StdinKey) => void;\n\n static active = false;\n\n // state\n value: unknown = undefined;\n firstRender = true;\n done = false;\n closed = false;\n aborted = false;\n exited = false;\n\n // methods that rely on constructor closure\n close: () => void;\n\n constructor() {\n super();\n assert(!Prompt.active, \"only one prompt can be active at a time\");\n Prompt.active = true;\n\n const rl = readline.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });\n readline.emitKeypressEvents(process.stdin, rl);\n\n if (process.stdin.isTTY) {\n process.stdin.setRawMode(true);\n }\n\n const isSelect = [\"SelectPrompt\"].includes(this.constructor.name);\n const keypress = (str: string, key: StdinKey): void => {\n const action = getPromptAction(key, isSelect);\n if (action === false) {\n this._(str, key);\n } else if (action && typeof this[action] === \"function\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n this[action](key);\n } else {\n this.bell();\n }\n };\n\n this.close = () => {\n process.stdin.removeListener(\"keypress\", keypress);\n if (process.stdin.isTTY) {\n process.stdin.setRawMode(false);\n }\n\n rl.close();\n this.emit(this.aborted ? \"abort\" : this.exited ? \"exit\" : \"submit\", this.value);\n this.closed = true;\n Prompt.active = false;\n };\n\n process.stdin.on(\"keypress\", keypress);\n }\n\n _(_str: string, _key: StdinKey): void {\n // noop\n }\n\n onRender(): void {\n // noop\n }\n\n fire(): void {\n this.emit(\"state\", {\n value: this.value,\n aborted: this.aborted,\n exited: this.exited,\n });\n }\n\n bell(): void {\n output.writeStdout(ansiEscapes.beep);\n }\n\n render(): void {\n this.onRender();\n if (this.firstRender) {\n this.firstRender = false;\n }\n }\n}\n\nexport type PromptAction =\n | \"abort\"\n | \"exit\"\n | \"submit\"\n | \"next\"\n | \"nextPage\"\n | \"prevPage\"\n | \"home\"\n | \"end\"\n | \"up\"\n | \"down\"\n | \"right\"\n | \"left\"\n | \"reset\"\n | \"delete\"\n | \"deleteForward\"\n | \"first\"\n | \"last\";\n\nexport type StdinKey = {\n name: string;\n ctrl: boolean;\n meta: boolean;\n};\n\nconst getPromptAction = (key: StdinKey, isSelect: boolean): PromptAction | false | undefined => {\n if (key.meta && key.name !== \"escape\") {\n return;\n }\n\n if (key.ctrl) {\n switch (key.name) {\n case \"a\":\n return \"first\";\n case \"c\":\n case \"d\":\n return \"abort\";\n case \"e\":\n return \"last\";\n case \"g\":\n return \"reset\";\n }\n }\n\n if (isSelect) {\n if (key.name === \"j\") {\n return \"down\";\n }\n if (key.name === \"k\") {\n return \"up\";\n }\n }\n\n switch (key.name) {\n case \"return\":\n case \"enter\":\n return \"submit\";\n case \"backspace\":\n return \"delete\";\n case \"delete\":\n return \"deleteForward\";\n case \"abort\":\n return \"abort\";\n case \"escape\":\n return \"exit\";\n case \"tab\":\n return \"next\";\n case \"pagedown\":\n return \"nextPage\";\n case \"pageup\":\n return \"prevPage\";\n case \"home\":\n return \"home\";\n case \"end\":\n return \"end\";\n case \"up\":\n return \"up\";\n case \"down\":\n return \"down\";\n case \"right\":\n return \"right\";\n case \"left\":\n return \"left\";\n default:\n return false;\n }\n};\n\n/**\n * Determine what entries should be displayed on the screen, based on the\n * currently selected index and the maximum visible. Used in list-based\n * prompts like `select` and `multiselect`.\n *\n * @param cursor - the currently selected entry\n * @param total - the total entries available to display\n * @param [maxVisible] - the number of entries that can be displayed\n */\nexport const entriesToDisplay = (cursor: number, total: number, maxVisible: number): { startIndex: number; endIndex: number } => {\n maxVisible = maxVisible || total;\n\n let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));\n if (startIndex < 0) {\n startIndex = 0;\n }\n\n const endIndex = Math.min(startIndex + maxVisible, total);\n\n return { startIndex, endIndex };\n};\n", "export * from './base.js';\nexport * as default from './base.js';\n", "import process from 'node:process';\nimport {isBrowser} from 'environment';\n\nconst ESC = '\\u001B[';\nconst OSC = '\\u001B]';\nconst BEL = '\\u0007';\nconst SEP = ';';\n\nconst isTerminalApp = !isBrowser && process.env.TERM_PROGRAM === 'Apple_Terminal';\nconst isWindows = !isBrowser && process.platform === 'win32';\n\nconst cwdFunction = isBrowser ? () => {\n\tthrow new Error('`process.cwd()` only works in Node.js, not the browser.');\n} : process.cwd;\n\nexport const cursorTo = (x, y) => {\n\tif (typeof x !== 'number') {\n\t\tthrow new TypeError('The `x` argument is required');\n\t}\n\n\tif (typeof y !== 'number') {\n\t\treturn ESC + (x + 1) + 'G';\n\t}\n\n\treturn ESC + (y + 1) + SEP + (x + 1) + 'H';\n};\n\nexport const cursorMove = (x, y) => {\n\tif (typeof x !== 'number') {\n\t\tthrow new TypeError('The `x` argument is required');\n\t}\n\n\tlet returnValue = '';\n\n\tif (x < 0) {\n\t\treturnValue += ESC + (-x) + 'D';\n\t} else if (x > 0) {\n\t\treturnValue += ESC + x + 'C';\n\t}\n\n\tif (y < 0) {\n\t\treturnValue += ESC + (-y) + 'A';\n\t} else if (y > 0) {\n\t\treturnValue += ESC + y + 'B';\n\t}\n\n\treturn returnValue;\n};\n\nexport const cursorUp = (count = 1) => ESC + count + 'A';\nexport const cursorDown = (count = 1) => ESC + count + 'B';\nexport const cursorForward = (count = 1) => ESC + count + 'C';\nexport const cursorBackward = (count = 1) => ESC + count + 'D';\n\nexport const cursorLeft = ESC + 'G';\nexport const cursorSavePosition = isTerminalApp ? '\\u001B7' : ESC + 's';\nexport const cursorRestorePosition = isTerminalApp ? '\\u001B8' : ESC + 'u';\nexport const cursorGetPosition = ESC + '6n';\nexport const cursorNextLine = ESC + 'E';\nexport const cursorPrevLine = ESC + 'F';\nexport const cursorHide = ESC + '?25l';\nexport const cursorShow = ESC + '?25h';\n\nexport const eraseLines = count => {\n\tlet clear = '';\n\n\tfor (let i = 0; i < count; i++) {\n\t\tclear += eraseLine + (i < count - 1 ? cursorUp() : '');\n\t}\n\n\tif (count) {\n\t\tclear += cursorLeft;\n\t}\n\n\treturn clear;\n};\n\nexport const eraseEndLine = ESC + 'K';\nexport const eraseStartLine = ESC + '1K';\nexport const eraseLine = ESC + '2K';\nexport const eraseDown = ESC + 'J';\nexport const eraseUp = ESC + '1J';\nexport const eraseScreen = ESC + '2J';\nexport const scrollUp = ESC + 'S';\nexport const scrollDown = ESC + 'T';\n\nexport const clearScreen = '\\u001Bc';\n\nexport const clearTerminal = isWindows\n\t? `${eraseScreen}${ESC}0f`\n\t// 1. Erases the screen (Only done in case `2` is not supported)\n\t// 2. Erases the whole screen including scrollback buffer\n\t// 3. Moves cursor to the top-left position\n\t// More info: https://www.real-world-systems.com/docs/ANSIcode.html\n\t:\t`${eraseScreen}${ESC}3J${ESC}H`;\n\nexport const enterAlternativeScreen = ESC + '?1049h';\nexport const exitAlternativeScreen = ESC + '?1049l';\n\nexport const beep = BEL;\n\nexport const link = (text, url) => [\n\tOSC,\n\t'8',\n\tSEP,\n\tSEP,\n\turl,\n\tBEL,\n\ttext,\n\tOSC,\n\t'8',\n\tSEP,\n\tSEP,\n\tBEL,\n].join('');\n\nexport const image = (data, options = {}) => {\n\tlet returnValue = `${OSC}1337;File=inline=1`;\n\n\tif (options.width) {\n\t\treturnValue += `;width=${options.width}`;\n\t}\n\n\tif (options.height) {\n\t\treturnValue += `;height=${options.height}`;\n\t}\n\n\tif (options.preserveAspectRatio === false) {\n\t\treturnValue += ';preserveAspectRatio=0';\n\t}\n\n\treturn returnValue + ':' + Buffer.from(data).toString('base64') + BEL;\n};\n\nexport const iTerm = {\n\tsetCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,\n\n\tannotation(message, options = {}) {\n\t\tlet returnValue = `${OSC}1337;`;\n\n\t\tconst hasX = options.x !== undefined;\n\t\tconst hasY = options.y !== undefined;\n\t\tif ((hasX || hasY) && !(hasX && hasY && options.length !== undefined)) {\n\t\t\tthrow new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');\n\t\t}\n\n\t\tmessage = message.replaceAll('|', '');\n\n\t\treturnValue += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';\n\n\t\tif (options.length > 0) {\n\t\t\treturnValue += (\n\t\t\t\thasX\n\t\t\t\t\t? [message, options.length, options.x, options.y]\n\t\t\t\t\t: [options.length, message]\n\t\t\t).join('|');\n\t\t} else {\n\t\t\treturnValue += message;\n\t\t}\n\n\t\treturn returnValue + BEL;\n\t},\n};\n", "/* globals WorkerGlobalScope, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope */\n\nexport const isBrowser = globalThis.window?.document !== undefined;\n\nexport const isNode = globalThis.process?.versions?.node !== undefined;\n\nexport const isBun = globalThis.process?.versions?.bun !== undefined;\n\nexport const isDeno = globalThis.Deno?.version?.deno !== undefined;\n\nexport const isElectron = globalThis.process?.versions?.electron !== undefined;\n\nexport const isJsDom = globalThis.navigator?.userAgent?.includes('jsdom') === true;\n\nexport const isWebWorker = typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGlobalScope;\n\nexport const isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== 'undefined' && globalThis instanceof DedicatedWorkerGlobalScope;\n\nexport const isSharedWorker = typeof SharedWorkerGlobalScope !== 'undefined' && globalThis instanceof SharedWorkerGlobalScope;\n\nexport const isServiceWorker = typeof ServiceWorkerGlobalScope !== 'undefined' && globalThis instanceof ServiceWorkerGlobalScope;\n\n// Note: I'm intentionally not DRYing up the other variables to keep them \"lazy\".\nconst platform = globalThis.navigator?.userAgentData?.platform;\n\nexport const isMacOs = platform === 'macOS'\n\t|| globalThis.navigator?.platform === 'MacIntel' // Even on Apple silicon Macs.\n\t|| globalThis.navigator?.userAgent?.includes(' Mac ') === true\n\t|| globalThis.process?.platform === 'darwin';\n\nexport const isWindows = platform === 'Windows'\n\t|| globalThis.navigator?.platform === 'Win32'\n\t|| globalThis.process?.platform === 'win32';\n\nexport const isLinux = platform === 'Linux'\n\t|| globalThis.navigator?.platform?.startsWith('Linux') === true\n\t|| globalThis.navigator?.userAgent?.includes(' Linux ') === true\n\t|| globalThis.process?.platform === 'linux';\n\nexport const isIos = platform === 'iOS'\n\t|| (globalThis.navigator?.platform === 'MacIntel' && globalThis.navigator?.maxTouchPoints > 1)\n\t|| /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);\n\nexport const isAndroid = platform === 'Android'\n\t|| globalThis.navigator?.platform === 'Android'\n\t|| globalThis.navigator?.userAgent?.includes(' Android ') === true\n\t|| globalThis.process?.platform === 'android';\n"],
5
- "mappings": "iQAAAA,ICAAC,IAAA,OAAOC,OAAS,WAChB,OAAOC,OAAQ,UAEf,IAAMC,EAAN,cAAqB,KAAM,CAC1B,YAAYC,EAAM,CACjB,MAAM,GAAGA,CAAI,YAAY,CAC1B,CACD,EAEMC,EAAc,CACnB,IAAK,IAAI,IACT,MAAO,IAAI,G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AC3BU,EAAY,aAAa,IAAI,UAAW,OAAO,EAC/CJ,EAAOY,CAAc,CACvB,QAAE,CACAT,EAAI,UAAU,IAAK,CAAE,SAAUC,EAAY,SAAS,CAAE,CAAC,EACvDD,EAAI,IAAI,CACV,CACF,CAAC,EAEDT,EAAI,IAAI,KAAK,wBAAyB,CAAE,KAAAE,CAAK,CAAC,EAC9CD,EAAO,OAAOC,CAAI,CACpB,CAAC,EAKKiB,EAAM,IAAI,IAAI,WAAWR,EAAO,QAAQ,QAAQ,aAAa,EACnEQ,EAAI,aAAa,IAAI,WAAY,WAAWR,EAAO,QAAQ,QAAQ,2BAA2BT,CAAI,EAAE,EAEpG,GAAI,CACFF,EAAI,IAAI,KAAK,kBAAmB,CAAE,IAAKmB,EAAI,SAAS,CAAE,CAAC,EACvD,MAAMC,GAAKD,EAAI,SAAS,CAAC,EACzBF,EAAQ,CACN,qBAAsB,GACtB,QAASnB;AAAA;AAAA;AAAA;AAAA,SAKX,CAAC,CACH,OAASoB,EAAO,CACdlB,EAAI,IAAI,MAAM,yBAA0B,CAAE,MAAAkB,CAAM,CAAC,EACjDD,EAAQ,CACN,qBAAsB,GACtB,QAASnB;AAAA;AAAA;AAAA,oBAGGqB,EAAI,SAAS,CAAC;AAAA;AAAA;AAAA,SAI5B,CAAC,CACH,CAEA,MAAMf,CACR,QAAE,CACAH,GAAQ,MAAM,CAChB,CACF,EAGaoB,GAAQtB",
4
+ "sourcesContent": ["import getPort from \"get-port\";\nimport assert from \"node:assert\";\nimport http, { type Server } from \"node:http\";\nimport open from \"open\";\nimport type { Run, Usage } from \"../services/command/command.js\";\nimport { config } from \"../services/config/config.js\";\nimport { println } from \"../services/output/print.js\";\nimport { sprint } from \"../services/output/sprint.js\";\nimport { writeSession } from \"../services/user/session.js\";\nimport { getUser } from \"../services/user/user.js\";\n\nexport const usage: Usage = () => sprint`\n Log in to your account.\n\n {bold Usage}\n ggt login\n`;\n\nexport const run: Run = async (ctx): Promise<void> => {\n let server: Server | undefined;\n\n try {\n const port = await getPort();\n const receiveSession = new Promise<void>((resolve, reject) => {\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n server = http.createServer(async (req, res) => {\n const landingPage = new URL(`https://${config.domains.services}/auth/cli`);\n\n try {\n assert(req.url, \"missing url\");\n const session = new URL(req.url, `http://localhost:${port}`).searchParams.get(\"session\");\n assert(session, \"missing session\");\n\n writeSession(ctx, session);\n\n const user = await getUser(ctx);\n assert(user, \"missing user after successful login\");\n\n if (user.name) {\n println({ ensureEmptyLineAbove: true, content: sprint`Hello, ${user.name} {gray (${user.email})}` });\n } else {\n println({ ensureEmptyLineAbove: true, content: `Hello, ${user.email}` });\n }\n\n landingPage.searchParams.set(\"success\", \"true\");\n resolve();\n } catch (error) {\n writeSession(ctx, undefined);\n landingPage.searchParams.set(\"success\", \"false\");\n reject(error as Error);\n } finally {\n res.writeHead(303, { Location: landingPage.toString() });\n res.end();\n }\n });\n\n ctx.log.info(\"starting login server\", { port });\n server.listen(port);\n });\n\n // open the login page in the user's default browser have it\n // redirect to the cli callback route. The cli callback route will\n // send the session to the server we just started.\n const url = new URL(`https://${config.domains.services}/auth/login`);\n url.searchParams.set(\"returnTo\", `https://${config.domains.services}/auth/cli/callback?port=${port}`);\n\n try {\n ctx.log.info(\"opening browser\", { url: url.toString() });\n await open(url.toString());\n println({\n ensureEmptyLineAbove: true,\n content: sprint`\n We've opened Gadget's login page using your default browser.\n\n Please log in and then return to this terminal.\n `,\n });\n } catch (error) {\n ctx.log.error(\"failed to open browser\", { error });\n println({\n ensureEmptyLineAbove: true,\n content: sprint`\n Please open the following URL in your browser and log in:\n\n {gray ${url.toString()}}\n\n Once logged in, return to this terminal.\n `,\n });\n }\n\n await receiveSession;\n } finally {\n server?.close();\n }\n};\n\n// alias\nexport const login = run;\n", "import net from 'node:net';\nimport os from 'node:os';\n\nclass Locked extends Error {\n\tconstructor(port) {\n\t\tsuper(`${port} is locked`);\n\t}\n}\n\nconst lockedPorts = {\n\told: new Set(),\n\tyoung: new Set(),\n};\n\n// On this interval, the old locked ports are discarded,\n// the young locked ports are moved to old locked ports,\n// and a new young set for locked ports are created.\nconst releaseOldLockedPortsIntervalMs = 1000 * 15;\n\nconst minPort = 1024;\nconst maxPort = 65_535;\n\n// Lazily create timeout on first use\nlet timeout;\n\nconst getLocalHosts = () => {\n\tconst interfaces = os.networkInterfaces();\n\n\t// Add undefined value for createServer function to use default host,\n\t// and default IPv4 host in case createServer defaults to IPv6.\n\tconst results = new Set([undefined, '0.0.0.0']);\n\n\tfor (const _interface of Object.values(interfaces)) {\n\t\tfor (const config of _interface) {\n\t\t\tresults.add(config.address);\n\t\t}\n\t}\n\n\treturn results;\n};\n\nconst checkAvailablePort = options =>\n\tnew Promise((resolve, reject) => {\n\t\tconst server = net.createServer();\n\t\tserver.unref();\n\t\tserver.on('error', reject);\n\n\t\tserver.listen(options, () => {\n\t\t\tconst {port} = server.address();\n\t\t\tserver.close(() => {\n\t\t\t\tresolve(port);\n\t\t\t});\n\t\t});\n\t});\n\nconst getAvailablePort = async (options, hosts) => {\n\tif (options.host || options.port === 0) {\n\t\treturn checkAvailablePort(options);\n\t}\n\n\tfor (const host of hosts) {\n\t\ttry {\n\t\t\tawait checkAvailablePort({port: options.port, host}); // eslint-disable-line no-await-in-loop\n\t\t} catch (error) {\n\t\t\tif (!['EADDRNOTAVAIL', 'EINVAL'].includes(error.code)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\treturn options.port;\n};\n\nconst portCheckSequence = function * (ports) {\n\tif (ports) {\n\t\tyield * ports;\n\t}\n\n\tyield 0; // Fall back to 0 if anything else failed\n};\n\nexport default async function getPorts(options) {\n\tlet ports;\n\tlet exclude = new Set();\n\n\tif (options) {\n\t\tif (options.port) {\n\t\t\tports = typeof options.port === 'number' ? [options.port] : options.port;\n\t\t}\n\n\t\tif (options.exclude) {\n\t\t\tconst excludeIterable = options.exclude;\n\n\t\t\tif (typeof excludeIterable[Symbol.iterator] !== 'function') {\n\t\t\t\tthrow new TypeError('The `exclude` option must be an iterable.');\n\t\t\t}\n\n\t\t\tfor (const element of excludeIterable) {\n\t\t\t\tif (typeof element !== 'number') {\n\t\t\t\t\tthrow new TypeError('Each item in the `exclude` option must be a number corresponding to the port you want excluded.');\n\t\t\t\t}\n\n\t\t\t\tif (!Number.isSafeInteger(element)) {\n\t\t\t\t\tthrow new TypeError(`Number ${element} in the exclude option is not a safe integer and can't be used`);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\texclude = new Set(excludeIterable);\n\t\t}\n\t}\n\n\tif (timeout === undefined) {\n\t\ttimeout = setTimeout(() => {\n\t\t\ttimeout = undefined;\n\n\t\t\tlockedPorts.old = lockedPorts.young;\n\t\t\tlockedPorts.young = new Set();\n\t\t}, releaseOldLockedPortsIntervalMs);\n\n\t\t// Does not exist in some environments (Electron, Jest jsdom env, browser, etc).\n\t\tif (timeout.unref) {\n\t\t\ttimeout.unref();\n\t\t}\n\t}\n\n\tconst hosts = getLocalHosts();\n\n\tfor (const port of portCheckSequence(ports)) {\n\t\ttry {\n\t\t\tif (exclude.has(port)) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet availablePort = await getAvailablePort({...options, port}, hosts); // eslint-disable-line no-await-in-loop\n\t\t\twhile (lockedPorts.old.has(availablePort) || lockedPorts.young.has(availablePort)) {\n\t\t\t\tif (port !== 0) {\n\t\t\t\t\tthrow new Locked(port);\n\t\t\t\t}\n\n\t\t\t\tavailablePort = await getAvailablePort({...options, port}, hosts); // eslint-disable-line no-await-in-loop\n\t\t\t}\n\n\t\t\tlockedPorts.young.add(availablePort);\n\n\t\t\treturn availablePort;\n\t\t} catch (error) {\n\t\t\tif (!['EADDRINUSE', 'EACCES'].includes(error.code) && !(error instanceof Locked)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t}\n\t}\n\n\tthrow new Error('No available ports found');\n}\n\nexport function portNumbers(from, to) {\n\tif (!Number.isInteger(from) || !Number.isInteger(to)) {\n\t\tthrow new TypeError('`from` and `to` must be integer numbers');\n\t}\n\n\tif (from < minPort || from > maxPort) {\n\t\tthrow new RangeError(`'from' must be between ${minPort} and ${maxPort}`);\n\t}\n\n\tif (to < minPort || to > maxPort) {\n\t\tthrow new RangeError(`'to' must be between ${minPort} and ${maxPort}`);\n\t}\n\n\tif (from > to) {\n\t\tthrow new RangeError('`to` must be greater than or equal to `from`');\n\t}\n\n\tconst generator = function * (from, to) {\n\t\tfor (let port = from; port <= to; port++) {\n\t\t\tyield port;\n\t\t}\n\t};\n\n\treturn generator(from, to);\n}\n\nexport function clearLockedPorts() {\n\tlockedPorts.old.clear();\n\tlockedPorts.young.clear();\n}\n", "import process from 'node:process';\nimport {Buffer} from 'node:buffer';\nimport path from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport childProcess from 'node:child_process';\nimport fs, {constants as fsConstants} from 'node:fs/promises';\nimport isWsl from 'is-wsl';\nimport defineLazyProperty from 'define-lazy-prop';\nimport defaultBrowser from 'default-browser';\nimport isInsideContainer from 'is-inside-container';\n\n// Path to included `xdg-open`.\nconst __dirname = path.dirname(fileURLToPath(import.meta.url));\nconst localXdgOpenPath = path.join(__dirname, 'xdg-open');\n\nconst {platform, arch} = process;\n\n/**\nGet the mount point for fixed drives in WSL.\n\n@inner\n@returns {string} The mount point.\n*/\nconst getWslDrivesMountPoint = (() => {\n\t// Default value for \"root\" param\n\t// according to https://docs.microsoft.com/en-us/windows/wsl/wsl-config\n\tconst defaultMountPoint = '/mnt/';\n\n\tlet mountPoint;\n\n\treturn async function () {\n\t\tif (mountPoint) {\n\t\t\t// Return memoized mount point value\n\t\t\treturn mountPoint;\n\t\t}\n\n\t\tconst configFilePath = '/etc/wsl.conf';\n\n\t\tlet isConfigFileExists = false;\n\t\ttry {\n\t\t\tawait fs.access(configFilePath, fsConstants.F_OK);\n\t\t\tisConfigFileExists = true;\n\t\t} catch {}\n\n\t\tif (!isConfigFileExists) {\n\t\t\treturn defaultMountPoint;\n\t\t}\n\n\t\tconst configContent = await fs.readFile(configFilePath, {encoding: 'utf8'});\n\t\tconst configMountPoint = /(?<!#.*)root\\s*=\\s*(?<mountPoint>.*)/g.exec(configContent);\n\n\t\tif (!configMountPoint) {\n\t\t\treturn defaultMountPoint;\n\t\t}\n\n\t\tmountPoint = configMountPoint.groups.mountPoint.trim();\n\t\tmountPoint = mountPoint.endsWith('/') ? mountPoint : `${mountPoint}/`;\n\n\t\treturn mountPoint;\n\t};\n})();\n\nconst pTryEach = async (array, mapper) => {\n\tlet latestError;\n\n\tfor (const item of array) {\n\t\ttry {\n\t\t\treturn await mapper(item); // eslint-disable-line no-await-in-loop\n\t\t} catch (error) {\n\t\t\tlatestError = error;\n\t\t}\n\t}\n\n\tthrow latestError;\n};\n\nconst baseOpen = async options => {\n\toptions = {\n\t\twait: false,\n\t\tbackground: false,\n\t\tnewInstance: false,\n\t\tallowNonzeroExitCode: false,\n\t\t...options,\n\t};\n\n\tif (Array.isArray(options.app)) {\n\t\treturn pTryEach(options.app, singleApp => baseOpen({\n\t\t\t...options,\n\t\t\tapp: singleApp,\n\t\t}));\n\t}\n\n\tlet {name: app, arguments: appArguments = []} = options.app ?? {};\n\tappArguments = [...appArguments];\n\n\tif (Array.isArray(app)) {\n\t\treturn pTryEach(app, appName => baseOpen({\n\t\t\t...options,\n\t\t\tapp: {\n\t\t\t\tname: appName,\n\t\t\t\targuments: appArguments,\n\t\t\t},\n\t\t}));\n\t}\n\n\tif (app === 'browser' || app === 'browserPrivate') {\n\t\t// IDs from default-browser for macOS and windows are the same\n\t\tconst ids = {\n\t\t\t'com.google.chrome': 'chrome',\n\t\t\t'google-chrome.desktop': 'chrome',\n\t\t\t'org.mozilla.firefox': 'firefox',\n\t\t\t'firefox.desktop': 'firefox',\n\t\t\t'com.microsoft.msedge': 'edge',\n\t\t\t'com.microsoft.edge': 'edge',\n\t\t\t'microsoft-edge.desktop': 'edge',\n\t\t};\n\n\t\t// Incognito flags for each browser in `apps`.\n\t\tconst flags = {\n\t\t\tchrome: '--incognito',\n\t\t\tfirefox: '--private-window',\n\t\t\tedge: '--inPrivate',\n\t\t};\n\n\t\tconst browser = await defaultBrowser();\n\t\tif (browser.id in ids) {\n\t\t\tconst browserName = ids[browser.id];\n\n\t\t\tif (app === 'browserPrivate') {\n\t\t\t\tappArguments.push(flags[browserName]);\n\t\t\t}\n\n\t\t\treturn baseOpen({\n\t\t\t\t...options,\n\t\t\t\tapp: {\n\t\t\t\t\tname: apps[browserName],\n\t\t\t\t\targuments: appArguments,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\n\t\tthrow new Error(`${browser.name} is not supported as a default browser`);\n\t}\n\n\tlet command;\n\tconst cliArguments = [];\n\tconst childProcessOptions = {};\n\n\tif (platform === 'darwin') {\n\t\tcommand = 'open';\n\n\t\tif (options.wait) {\n\t\t\tcliArguments.push('--wait-apps');\n\t\t}\n\n\t\tif (options.background) {\n\t\t\tcliArguments.push('--background');\n\t\t}\n\n\t\tif (options.newInstance) {\n\t\t\tcliArguments.push('--new');\n\t\t}\n\n\t\tif (app) {\n\t\t\tcliArguments.push('-a', app);\n\t\t}\n\t} else if (platform === 'win32' || (isWsl && !isInsideContainer() && !app)) {\n\t\tconst mountPoint = await getWslDrivesMountPoint();\n\n\t\tcommand = isWsl\n\t\t\t? `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`\n\t\t\t: `${process.env.SYSTEMROOT || process.env.windir || 'C:\\\\Windows'}\\\\System32\\\\WindowsPowerShell\\\\v1.0\\\\powershell`;\n\n\t\tcliArguments.push(\n\t\t\t'-NoProfile',\n\t\t\t'-NonInteractive',\n\t\t\t'-ExecutionPolicy',\n\t\t\t'Bypass',\n\t\t\t'-EncodedCommand',\n\t\t);\n\n\t\tif (!isWsl) {\n\t\t\tchildProcessOptions.windowsVerbatimArguments = true;\n\t\t}\n\n\t\tconst encodedArguments = ['Start'];\n\n\t\tif (options.wait) {\n\t\t\tencodedArguments.push('-Wait');\n\t\t}\n\n\t\tif (app) {\n\t\t\t// Double quote with double quotes to ensure the inner quotes are passed through.\n\t\t\t// Inner quotes are delimited for PowerShell interpretation with backticks.\n\t\t\tencodedArguments.push(`\"\\`\"${app}\\`\"\"`);\n\t\t\tif (options.target) {\n\t\t\t\tappArguments.push(options.target);\n\t\t\t}\n\t\t} else if (options.target) {\n\t\t\tencodedArguments.push(`\"${options.target}\"`);\n\t\t}\n\n\t\tif (appArguments.length > 0) {\n\t\t\tappArguments = appArguments.map(argument => `\"\\`\"${argument}\\`\"\"`);\n\t\t\tencodedArguments.push('-ArgumentList', appArguments.join(','));\n\t\t}\n\n\t\t// Using Base64-encoded command, accepted by PowerShell, to allow special characters.\n\t\toptions.target = Buffer.from(encodedArguments.join(' '), 'utf16le').toString('base64');\n\t} else {\n\t\tif (app) {\n\t\t\tcommand = app;\n\t\t} else {\n\t\t\t// When bundled by Webpack, there's no actual package file path and no local `xdg-open`.\n\t\t\tconst isBundled = !__dirname || __dirname === '/';\n\n\t\t\t// Check if local `xdg-open` exists and is executable.\n\t\t\tlet exeLocalXdgOpen = false;\n\t\t\ttry {\n\t\t\t\tawait fs.access(localXdgOpenPath, fsConstants.X_OK);\n\t\t\t\texeLocalXdgOpen = true;\n\t\t\t} catch {}\n\n\t\t\tconst useSystemXdgOpen = process.versions.electron\n\t\t\t\t?? (platform === 'android' || isBundled || !exeLocalXdgOpen);\n\t\t\tcommand = useSystemXdgOpen ? 'xdg-open' : localXdgOpenPath;\n\t\t}\n\n\t\tif (appArguments.length > 0) {\n\t\t\tcliArguments.push(...appArguments);\n\t\t}\n\n\t\tif (!options.wait) {\n\t\t\t// `xdg-open` will block the process unless stdio is ignored\n\t\t\t// and it's detached from the parent even if it's unref'd.\n\t\t\tchildProcessOptions.stdio = 'ignore';\n\t\t\tchildProcessOptions.detached = true;\n\t\t}\n\t}\n\n\tif (platform === 'darwin' && appArguments.length > 0) {\n\t\tcliArguments.push('--args', ...appArguments);\n\t}\n\n\t// This has to come after `--args`.\n\tif (options.target) {\n\t\tcliArguments.push(options.target);\n\t}\n\n\tconst subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);\n\n\tif (options.wait) {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tsubprocess.once('error', reject);\n\n\t\t\tsubprocess.once('close', exitCode => {\n\t\t\t\tif (!options.allowNonzeroExitCode && exitCode > 0) {\n\t\t\t\t\treject(new Error(`Exited with code ${exitCode}`));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tresolve(subprocess);\n\t\t\t});\n\t\t});\n\t}\n\n\tsubprocess.unref();\n\n\treturn subprocess;\n};\n\nconst open = (target, options) => {\n\tif (typeof target !== 'string') {\n\t\tthrow new TypeError('Expected a `target`');\n\t}\n\n\treturn baseOpen({\n\t\t...options,\n\t\ttarget,\n\t});\n};\n\nexport const openApp = (name, options) => {\n\tif (typeof name !== 'string' && !Array.isArray(name)) {\n\t\tthrow new TypeError('Expected a valid `name`');\n\t}\n\n\tconst {arguments: appArguments = []} = options ?? {};\n\tif (appArguments !== undefined && appArguments !== null && !Array.isArray(appArguments)) {\n\t\tthrow new TypeError('Expected `appArguments` as Array type');\n\t}\n\n\treturn baseOpen({\n\t\t...options,\n\t\tapp: {\n\t\t\tname,\n\t\t\targuments: appArguments,\n\t\t},\n\t});\n};\n\nfunction detectArchBinary(binary) {\n\tif (typeof binary === 'string' || Array.isArray(binary)) {\n\t\treturn binary;\n\t}\n\n\tconst {[arch]: archBinary} = binary;\n\n\tif (!archBinary) {\n\t\tthrow new Error(`${arch} is not supported`);\n\t}\n\n\treturn archBinary;\n}\n\nfunction detectPlatformBinary({[platform]: platformBinary}, {wsl}) {\n\tif (wsl && isWsl) {\n\t\treturn detectArchBinary(wsl);\n\t}\n\n\tif (!platformBinary) {\n\t\tthrow new Error(`${platform} is not supported`);\n\t}\n\n\treturn detectArchBinary(platformBinary);\n}\n\nexport const apps = {};\n\ndefineLazyProperty(apps, 'chrome', () => detectPlatformBinary({\n\tdarwin: 'google chrome',\n\twin32: 'chrome',\n\tlinux: ['google-chrome', 'google-chrome-stable', 'chromium'],\n}, {\n\twsl: {\n\t\tia32: '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe',\n\t\tx64: ['/mnt/c/Program Files/Google/Chrome/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'],\n\t},\n}));\n\ndefineLazyProperty(apps, 'firefox', () => detectPlatformBinary({\n\tdarwin: 'firefox',\n\twin32: 'C:\\\\Program Files\\\\Mozilla Firefox\\\\firefox.exe',\n\tlinux: 'firefox',\n}, {\n\twsl: '/mnt/c/Program Files/Mozilla Firefox/firefox.exe',\n}));\n\ndefineLazyProperty(apps, 'edge', () => detectPlatformBinary({\n\tdarwin: 'microsoft edge',\n\twin32: 'msedge',\n\tlinux: ['microsoft-edge', 'microsoft-edge-dev'],\n}, {\n\twsl: '/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe',\n}));\n\ndefineLazyProperty(apps, 'browser', () => 'browser');\n\ndefineLazyProperty(apps, 'browserPrivate', () => 'browserPrivate');\n\nexport default open;\n", "export default function defineLazyProperty(object, propertyName, valueGetter) {\n\tconst define = value => Object.defineProperty(object, propertyName, {value, enumerable: true, writable: true});\n\n\tObject.defineProperty(object, propertyName, {\n\t\tconfigurable: true,\n\t\tenumerable: true,\n\t\tget() {\n\t\t\tconst result = valueGetter();\n\t\t\tdefine(result);\n\t\t\treturn result;\n\t\t},\n\t\tset(value) {\n\t\t\tdefine(value);\n\t\t}\n\t});\n\n\treturn object;\n}\n", "import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\nimport defaultBrowserId from 'default-browser-id';\nimport bundleName from 'bundle-name';\nimport windows from './windows.js';\n\nconst execFileAsync = promisify(execFile);\n\n// Inlined: https://github.com/sindresorhus/titleize/blob/main/index.js\nconst titleize = string => string.toLowerCase().replaceAll(/(?:^|\\s|-)\\S/g, x => x.toUpperCase());\n\nexport default async function defaultBrowser() {\n\tif (process.platform === 'darwin') {\n\t\tconst id = await defaultBrowserId();\n\t\tconst name = await bundleName(id);\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'linux') {\n\t\tconst {stdout} = await execFileAsync('xdg-mime', ['query', 'default', 'x-scheme-handler/http']);\n\t\tconst id = stdout.trim();\n\t\tconst name = titleize(id.replace(/.desktop$/, '').replace('-', ' '));\n\t\treturn {name, id};\n\t}\n\n\tif (process.platform === 'win32') {\n\t\treturn windows();\n\t}\n\n\tthrow new Error('Only macOS, Linux, and Windows are supported');\n}\n", "import {promisify} from 'node:util';\nimport process from 'node:process';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport default async function defaultBrowserId() {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst {stdout} = await execFileAsync('defaults', ['read', 'com.apple.LaunchServices/com.apple.launchservices.secure', 'LSHandlers']);\n\n\t// `(?!-)` is to prevent matching `LSHandlerRoleAll = \"-\";`.\n\tconst match = /LSHandlerRoleAll = \"(?!-)(?<id>[^\"]+?)\";\\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);\n\n\treturn match?.groups.id ?? 'com.apple.Safari';\n}\n", "import {runAppleScript} from 'run-applescript';\n\nexport default async function bundleName(bundleId) {\n\treturn runAppleScript(`tell application \"Finder\" to set app_path to application file id \"${bundleId}\" as string\\ntell application \"System Events\" to get value of property list item \"CFBundleName\" of property list file (app_path & \":Contents:Info.plist\")`);\n}\n", "import process from 'node:process';\nimport {promisify} from 'node:util';\nimport {execFile, execFileSync} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\nexport async function runAppleScript(script, {humanReadableOutput = true} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst {stdout} = await execFileAsync('osascript', ['-e', script, outputArguments]);\n\treturn stdout.trim();\n}\n\nexport function runAppleScriptSync(script, {humanReadableOutput = true} = {}) {\n\tif (process.platform !== 'darwin') {\n\t\tthrow new Error('macOS only');\n\t}\n\n\tconst outputArguments = humanReadableOutput ? [] : ['-ss'];\n\n\tconst stdout = execFileSync('osascript', ['-e', script, ...outputArguments], {\n\t\tencoding: 'utf8',\n\t\tstdio: ['ignore', 'pipe', 'ignore'],\n\t\ttimeout: 500,\n\t});\n\n\treturn stdout.trim();\n}\n", "import {promisify} from 'node:util';\nimport {execFile} from 'node:child_process';\n\nconst execFileAsync = promisify(execFile);\n\n// Windows doesn't have browser IDs in the same way macOS/Linux does so we give fake\n// ones that look real and match the macOS/Linux versions for cross-platform apps.\nconst windowsBrowserProgIds = {\n\tAppXq0fevzme2pys62n3e0fbqa7peapykr8v: {name: 'Edge', id: 'com.microsoft.edge.old'},\n\tMSEdgeDHTML: {name: 'Edge', id: 'com.microsoft.edge'}, // On macOS, it's \"com.microsoft.edgemac\"\n\tMSEdgeHTM: {name: 'Edge', id: 'com.microsoft.edge'}, // Newer Edge/Win10 releases\n\t'IE.HTTP': {name: 'Internet Explorer', id: 'com.microsoft.ie'},\n\tFirefoxURL: {name: 'Firefox', id: 'org.mozilla.firefox'},\n\tChromeHTML: {name: 'Chrome', id: 'com.google.chrome'},\n\tBraveHTML: {name: 'Brave', id: 'com.brave.Browser'},\n\tBraveBHTML: {name: 'Brave Beta', id: 'com.brave.Browser.beta'},\n\tBraveSSHTM: {name: 'Brave Nightly', id: 'com.brave.Browser.nightly'},\n};\n\nexport class UnknownBrowserError extends Error {}\n\nexport default async function defaultBrowser(_execFileAsync = execFileAsync) {\n\tconst {stdout} = await _execFileAsync('reg', [\n\t\t'QUERY',\n\t\t' HKEY_CURRENT_USER\\\\Software\\\\Microsoft\\\\Windows\\\\Shell\\\\Associations\\\\UrlAssociations\\\\http\\\\UserChoice',\n\t\t'/v',\n\t\t'ProgId',\n\t]);\n\n\tconst match = /ProgId\\s*REG_SZ\\s*(?<id>\\S+)/.exec(stdout);\n\tif (!match) {\n\t\tthrow new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);\n\t}\n\n\tconst {id} = match.groups;\n\n\tconst browser = windowsBrowserProgIds[id];\n\tif (!browser) {\n\t\tthrow new UnknownBrowserError(`Unknown browser ID: ${id}`);\n\t}\n\n\treturn browser;\n}\n", "import assert from \"node:assert\";\nimport { z } from \"zod\";\nimport { login } from \"../../commands/login.js\";\nimport { maybeGetCurrentCommand } from \"../command/command.js\";\nimport type { Context } from \"../command/context.js\";\nimport { config } from \"../config/config.js\";\nimport { maybeLoadAuthHeaders, swallowUnauthorized } from \"../http/auth.js\";\nimport { http } from \"../http/http.js\";\nimport { confirm } from \"../output/confirm.js\";\nimport { println } from \"../output/print.js\";\n\nconst User = z.object({\n id: z.union([z.string(), z.number()]).transform(Number),\n name: z.string().nullish(),\n email: z.string(),\n});\n\nexport type User = z.infer<typeof User>;\n\nconst kUser = Symbol.for(\"user\");\n\nexport const maybeGetCurrentUser = (ctx: Context): User | undefined => {\n return ctx.get(kUser) as User | undefined;\n};\n\nexport const getCurrentUser = (ctx: Context): User => {\n const user = maybeGetCurrentUser(ctx);\n assert(user, \"missing user\");\n return user;\n};\n\nexport const setCurrentUser = (ctx: Context, user: User): void => {\n ctx.set(kUser, user);\n};\n\n/**\n * Retrieves the currently logged in user from Gadgets API.\n *\n * @returns A Promise that resolves to a User object representing the\n * current user, or undefined if the user is not authenticated.\n */\nexport const getUser = async (ctx: Context): Promise<User | undefined> => {\n let user = maybeGetCurrentUser(ctx);\n if (user) {\n return user;\n }\n\n const headers = maybeLoadAuthHeaders(ctx);\n if (!headers) {\n return undefined;\n }\n\n try {\n const json = await http({\n context: { ctx },\n url: `https://${config.domains.services}/auth/api/current-user`,\n headers,\n responseType: \"json\",\n resolveBodyOnly: true,\n });\n\n user = User.parse(json);\n ctx.set(kUser, user);\n ctx.log.info(\"loaded user\");\n\n return user;\n } catch (error) {\n swallowUnauthorized(ctx, error);\n return undefined;\n }\n};\n\n/**\n * Retrieves the current user or prompts the user to log in if not\n * already logged in.\n *\n * @param ctx - The current context.\n * @returns A Promise that resolves to the current user.\n */\nexport const getUserOrLogin = async (ctx: Context): Promise<User> => {\n let user = await getUser(ctx);\n if (user) {\n return user;\n }\n\n ctx.log.info(\"prompting user to log in\");\n println({\n ensureEmptyLineAbove: true,\n content: `You must be logged in to use \"ggt ${maybeGetCurrentCommand(ctx)}\".`,\n });\n\n await confirm({ ensureEmptyLineAbove: true, content: \"Would you like to log in?\" });\n await login(ctx);\n\n user = await getUser(ctx);\n assert(user, \"missing user after successful login\");\n\n return user;\n};\n", "import chalk from \"chalk\";\nimport process from \"node:process\";\nimport type { Promisable } from \"type-fest\";\nimport { defaults } from \"../util/object.js\";\nimport type { PartialExcept } from \"../util/types.js\";\nimport { output } from \"./output.js\";\nimport { println, type PrintOptions } from \"./print.js\";\nimport { Prompt, type StdinKey } from \"./prompt.js\";\nimport { sprintln } from \"./sprint.js\";\n\nexport type ConfirmOptions = PrintOptions & {\n /**\n * If `true`, ggt will exit if the user selects \"No\".\n *\n * @default true\n */\n exitWhenNo?: boolean;\n\n /**\n * What to do if ggt is not running in an interactive terminal.\n *\n * @default ```\n * println(options)(text);\n * println({ ensureEmptyLineAbove: true })`\n * Aborting because ggt is not running in an interactive terminal.\n * `;\n * process.exit(1);\n * ```\n */\n whenNotInteractive?: () => Promisable<void>;\n};\n\nexport type confirm = typeof confirm;\n\nexport const confirm = (contentOrOptions: string | ConfirmOptions): Promise<void> => {\n let options: ConfirmOptions;\n if (typeof contentOrOptions === \"string\") {\n options = { content: contentOrOptions };\n } else {\n options = contentOrOptions;\n }\n\n options = defaults(options, {\n ensureEmptyLineAbove: true,\n ensureNewLine: true,\n exitWhenNo: true,\n });\n\n if (!output.isInteractive) {\n const whenNotInteractive =\n options.whenNotInteractive ??\n (() => {\n println(options);\n println({ ensureEmptyLineAbove: true, content: \"Aborting because ggt is not running in an interactive terminal.\" });\n process.exit(1);\n });\n\n return Promise.resolve(whenNotInteractive());\n }\n\n return new Promise((resolve) => {\n const conf = new Confirm(options);\n conf.on(\"submit\", resolve);\n conf.on(\"exit\", () => process.exit(0));\n conf.on(\"abort\", () => process.exit(1));\n });\n};\n\n/**\n * Inspired by `prompts`:\n * https://github.com/terkelg/prompts/blob/e0519913ec4fcc6746bb3d97d8cd0960c3f3ffde/lib/elements/confirm.js\n *\n * MIT License\n *\n * Copyright (c) 2018 Terkel Gjervig Nielsen\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nexport class Confirm extends Prompt {\n override value: boolean | undefined = undefined;\n defaultValue = false;\n options;\n\n constructor(options: PartialExcept<ConfirmOptions, \"content\">) {\n super();\n\n this.options = defaults(options, {\n exitWhenNo: true,\n ensureEmptyLineAbove: true,\n });\n\n this.render();\n }\n\n reset(): void {\n this.value = this.defaultValue;\n this.fire();\n this.render();\n }\n\n exit(): void {\n this.abort();\n }\n\n abort(): void {\n this.value = false;\n this.done = this.aborted = true;\n this.fire();\n this.render(false);\n this.close();\n\n if (this.options.exitWhenNo) {\n process.exit(0);\n }\n }\n\n submit(): void {\n this.value = this.value ?? false;\n this.done = true;\n this.aborted = false;\n this.fire();\n this.render();\n this.close();\n\n if (this.options.exitWhenNo && !this.value) {\n process.exit(0);\n }\n }\n\n override _(char: string, _key: StdinKey): void {\n if (char.toLowerCase() === \"y\") {\n this.value = true;\n this.submit();\n return;\n }\n\n if (char.toLowerCase() === \"n\") {\n this.value = false;\n this.submit();\n return;\n }\n\n this.bell();\n }\n\n override render(value = this.value): void {\n super.render();\n\n if (this.done) {\n output.persistPrompt(\n sprintln({\n ...this.options,\n content: `${this.options.content} ${value ? chalk.bold.greenBright(\"Yes.\") : chalk.bold.redBright(\"No.\")}`,\n }),\n );\n return;\n }\n\n output.updatePrompt(\n sprintln({\n ...this.options,\n content: `${this.options.content} ${this.defaultValue ? chalk.blueBright(\"[Y/n] \") : chalk.blueBright(\"[y/N] \")}`,\n }),\n );\n }\n}\n", "import ansiEscapes from \"ansi-escapes\";\nimport assert from \"node:assert\";\nimport EventEmitter from \"node:events\";\nimport process from \"node:process\";\nimport readline from \"node:readline\";\nimport { output } from \"./output.js\";\n\n/**\n * Inspired by `prompts`:\n * https://github.com/terkelg/prompts/blob/e0519913ec4fcc6746bb3d97d8cd0960c3f3ffde/lib/elements/prompt.js\n *\n * MIT License\n *\n * Copyright (c) 2018 Terkel Gjervig Nielsen\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\nexport class Prompt extends EventEmitter {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [action: string]: any; // (key: StdinKey) => void;\n\n static active = false;\n\n // state\n value: unknown = undefined;\n firstRender = true;\n done = false;\n closed = false;\n aborted = false;\n exited = false;\n\n // methods that rely on constructor closure\n close: () => void;\n\n constructor() {\n super();\n assert(!Prompt.active, \"only one prompt can be active at a time\");\n Prompt.active = true;\n\n const rl = readline.createInterface({ input: process.stdin, escapeCodeTimeout: 50 });\n readline.emitKeypressEvents(process.stdin, rl);\n\n if (process.stdin.isTTY) {\n process.stdin.setRawMode(true);\n }\n\n const isSelect = [\"SelectPrompt\"].includes(this.constructor.name);\n const keypress = (str: string, key: StdinKey): void => {\n const action = getPromptAction(key, isSelect);\n if (action === false) {\n this._(str, key);\n } else if (action && typeof this[action] === \"function\") {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n this[action](key);\n } else {\n this.bell();\n }\n };\n\n this.close = () => {\n process.stdin.removeListener(\"keypress\", keypress);\n if (process.stdin.isTTY) {\n process.stdin.setRawMode(false);\n }\n\n rl.close();\n this.emit(this.aborted ? \"abort\" : this.exited ? \"exit\" : \"submit\", this.value);\n this.closed = true;\n Prompt.active = false;\n };\n\n process.stdin.on(\"keypress\", keypress);\n }\n\n _(_str: string, _key: StdinKey): void {\n // noop\n }\n\n onRender(): void {\n // noop\n }\n\n fire(): void {\n this.emit(\"state\", {\n value: this.value,\n aborted: this.aborted,\n exited: this.exited,\n });\n }\n\n bell(): void {\n output.writeStdout(ansiEscapes.beep);\n }\n\n render(): void {\n this.onRender();\n if (this.firstRender) {\n this.firstRender = false;\n }\n }\n}\n\nexport type PromptAction =\n | \"abort\"\n | \"exit\"\n | \"submit\"\n | \"next\"\n | \"nextPage\"\n | \"prevPage\"\n | \"home\"\n | \"end\"\n | \"up\"\n | \"down\"\n | \"right\"\n | \"left\"\n | \"reset\"\n | \"delete\"\n | \"deleteForward\"\n | \"first\"\n | \"last\";\n\nexport type StdinKey = {\n name: string;\n ctrl: boolean;\n meta: boolean;\n};\n\nconst getPromptAction = (key: StdinKey, isSelect: boolean): PromptAction | false | undefined => {\n if (key.meta && key.name !== \"escape\") {\n return;\n }\n\n if (key.ctrl) {\n switch (key.name) {\n case \"a\":\n return \"first\";\n case \"c\":\n case \"d\":\n return \"abort\";\n case \"e\":\n return \"last\";\n case \"g\":\n return \"reset\";\n }\n }\n\n if (isSelect) {\n if (key.name === \"j\") {\n return \"down\";\n }\n if (key.name === \"k\") {\n return \"up\";\n }\n }\n\n switch (key.name) {\n case \"return\":\n case \"enter\":\n return \"submit\";\n case \"backspace\":\n return \"delete\";\n case \"delete\":\n return \"deleteForward\";\n case \"abort\":\n return \"abort\";\n case \"escape\":\n return \"exit\";\n case \"tab\":\n return \"next\";\n case \"pagedown\":\n return \"nextPage\";\n case \"pageup\":\n return \"prevPage\";\n case \"home\":\n return \"home\";\n case \"end\":\n return \"end\";\n case \"up\":\n return \"up\";\n case \"down\":\n return \"down\";\n case \"right\":\n return \"right\";\n case \"left\":\n return \"left\";\n default:\n return false;\n }\n};\n\n/**\n * Determine what entries should be displayed on the screen, based on the\n * currently selected index and the maximum visible. Used in list-based\n * prompts like `select` and `multiselect`.\n *\n * @param cursor - the currently selected entry\n * @param total - the total entries available to display\n * @param [maxVisible] - the number of entries that can be displayed\n */\nexport const entriesToDisplay = (cursor: number, total: number, maxVisible: number): { startIndex: number; endIndex: number } => {\n maxVisible = maxVisible || total;\n\n let startIndex = Math.min(total - maxVisible, cursor - Math.floor(maxVisible / 2));\n if (startIndex < 0) {\n startIndex = 0;\n }\n\n const endIndex = Math.min(startIndex + maxVisible, total);\n\n return { startIndex, endIndex };\n};\n", "export * from './base.js';\nexport * as default from './base.js';\n", "import process from 'node:process';\nimport {isBrowser} from 'environment';\n\nconst ESC = '\\u001B[';\nconst OSC = '\\u001B]';\nconst BEL = '\\u0007';\nconst SEP = ';';\n\nconst isTerminalApp = !isBrowser && process.env.TERM_PROGRAM === 'Apple_Terminal';\nconst isWindows = !isBrowser && process.platform === 'win32';\n\nconst cwdFunction = isBrowser ? () => {\n\tthrow new Error('`process.cwd()` only works in Node.js, not the browser.');\n} : process.cwd;\n\nexport const cursorTo = (x, y) => {\n\tif (typeof x !== 'number') {\n\t\tthrow new TypeError('The `x` argument is required');\n\t}\n\n\tif (typeof y !== 'number') {\n\t\treturn ESC + (x + 1) + 'G';\n\t}\n\n\treturn ESC + (y + 1) + SEP + (x + 1) + 'H';\n};\n\nexport const cursorMove = (x, y) => {\n\tif (typeof x !== 'number') {\n\t\tthrow new TypeError('The `x` argument is required');\n\t}\n\n\tlet returnValue = '';\n\n\tif (x < 0) {\n\t\treturnValue += ESC + (-x) + 'D';\n\t} else if (x > 0) {\n\t\treturnValue += ESC + x + 'C';\n\t}\n\n\tif (y < 0) {\n\t\treturnValue += ESC + (-y) + 'A';\n\t} else if (y > 0) {\n\t\treturnValue += ESC + y + 'B';\n\t}\n\n\treturn returnValue;\n};\n\nexport const cursorUp = (count = 1) => ESC + count + 'A';\nexport const cursorDown = (count = 1) => ESC + count + 'B';\nexport const cursorForward = (count = 1) => ESC + count + 'C';\nexport const cursorBackward = (count = 1) => ESC + count + 'D';\n\nexport const cursorLeft = ESC + 'G';\nexport const cursorSavePosition = isTerminalApp ? '\\u001B7' : ESC + 's';\nexport const cursorRestorePosition = isTerminalApp ? '\\u001B8' : ESC + 'u';\nexport const cursorGetPosition = ESC + '6n';\nexport const cursorNextLine = ESC + 'E';\nexport const cursorPrevLine = ESC + 'F';\nexport const cursorHide = ESC + '?25l';\nexport const cursorShow = ESC + '?25h';\n\nexport const eraseLines = count => {\n\tlet clear = '';\n\n\tfor (let i = 0; i < count; i++) {\n\t\tclear += eraseLine + (i < count - 1 ? cursorUp() : '');\n\t}\n\n\tif (count) {\n\t\tclear += cursorLeft;\n\t}\n\n\treturn clear;\n};\n\nexport const eraseEndLine = ESC + 'K';\nexport const eraseStartLine = ESC + '1K';\nexport const eraseLine = ESC + '2K';\nexport const eraseDown = ESC + 'J';\nexport const eraseUp = ESC + '1J';\nexport const eraseScreen = ESC + '2J';\nexport const scrollUp = ESC + 'S';\nexport const scrollDown = ESC + 'T';\n\nexport const clearScreen = '\\u001Bc';\n\nexport const clearTerminal = isWindows\n\t? `${eraseScreen}${ESC}0f`\n\t// 1. Erases the screen (Only done in case `2` is not supported)\n\t// 2. Erases the whole screen including scrollback buffer\n\t// 3. Moves cursor to the top-left position\n\t// More info: https://www.real-world-systems.com/docs/ANSIcode.html\n\t:\t`${eraseScreen}${ESC}3J${ESC}H`;\n\nexport const enterAlternativeScreen = ESC + '?1049h';\nexport const exitAlternativeScreen = ESC + '?1049l';\n\nexport const beep = BEL;\n\nexport const link = (text, url) => [\n\tOSC,\n\t'8',\n\tSEP,\n\tSEP,\n\turl,\n\tBEL,\n\ttext,\n\tOSC,\n\t'8',\n\tSEP,\n\tSEP,\n\tBEL,\n].join('');\n\nexport const image = (data, options = {}) => {\n\tlet returnValue = `${OSC}1337;File=inline=1`;\n\n\tif (options.width) {\n\t\treturnValue += `;width=${options.width}`;\n\t}\n\n\tif (options.height) {\n\t\treturnValue += `;height=${options.height}`;\n\t}\n\n\tif (options.preserveAspectRatio === false) {\n\t\treturnValue += ';preserveAspectRatio=0';\n\t}\n\n\treturn returnValue + ':' + Buffer.from(data).toString('base64') + BEL;\n};\n\nexport const iTerm = {\n\tsetCwd: (cwd = cwdFunction()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,\n\n\tannotation(message, options = {}) {\n\t\tlet returnValue = `${OSC}1337;`;\n\n\t\tconst hasX = options.x !== undefined;\n\t\tconst hasY = options.y !== undefined;\n\t\tif ((hasX || hasY) && !(hasX && hasY && options.length !== undefined)) {\n\t\t\tthrow new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');\n\t\t}\n\n\t\tmessage = message.replaceAll('|', '');\n\n\t\treturnValue += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';\n\n\t\tif (options.length > 0) {\n\t\t\treturnValue += (\n\t\t\t\thasX\n\t\t\t\t\t? [message, options.length, options.x, options.y]\n\t\t\t\t\t: [options.length, message]\n\t\t\t).join('|');\n\t\t} else {\n\t\t\treturnValue += message;\n\t\t}\n\n\t\treturn returnValue + BEL;\n\t},\n};\n", "/* globals WorkerGlobalScope, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope */\n\nexport const isBrowser = globalThis.window?.document !== undefined;\n\nexport const isNode = globalThis.process?.versions?.node !== undefined;\n\nexport const isBun = globalThis.process?.versions?.bun !== undefined;\n\nexport const isDeno = globalThis.Deno?.version?.deno !== undefined;\n\nexport const isElectron = globalThis.process?.versions?.electron !== undefined;\n\nexport const isJsDom = globalThis.navigator?.userAgent?.includes('jsdom') === true;\n\nexport const isWebWorker = typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGlobalScope;\n\nexport const isDedicatedWorker = typeof DedicatedWorkerGlobalScope !== 'undefined' && globalThis instanceof DedicatedWorkerGlobalScope;\n\nexport const isSharedWorker = typeof SharedWorkerGlobalScope !== 'undefined' && globalThis instanceof SharedWorkerGlobalScope;\n\nexport const isServiceWorker = typeof ServiceWorkerGlobalScope !== 'undefined' && globalThis instanceof ServiceWorkerGlobalScope;\n\n// Note: I'm intentionally not DRYing up the other variables to keep them \"lazy\".\nconst platform = globalThis.navigator?.userAgentData?.platform;\n\nexport const isMacOs = platform === 'macOS'\n\t|| globalThis.navigator?.platform === 'MacIntel' // Even on Apple silicon Macs.\n\t|| globalThis.navigator?.userAgent?.includes(' Mac ') === true\n\t|| globalThis.process?.platform === 'darwin';\n\nexport const isWindows = platform === 'Windows'\n\t|| globalThis.navigator?.platform === 'Win32'\n\t|| globalThis.process?.platform === 'win32';\n\nexport const isLinux = platform === 'Linux'\n\t|| globalThis.navigator?.platform?.startsWith('Linux') === true\n\t|| globalThis.navigator?.userAgent?.includes(' Linux ') === true\n\t|| globalThis.process?.platform === 'linux';\n\nexport const isIos = platform === 'iOS'\n\t|| (globalThis.navigator?.platform === 'MacIntel' && globalThis.navigator?.maxTouchPoints > 1)\n\t|| /iPad|iPhone|iPod/.test(globalThis.navigator?.platform);\n\nexport const isAndroid = platform === 'Android'\n\t|| globalThis.navigator?.platform === 'Android'\n\t|| globalThis.navigator?.userAgent?.includes(' Android ') === true\n\t|| globalThis.process?.platform === 'android';\n"],
5
+ "mappings": "iQAAAA,ICAAC,IAAA,OAAOC,OAAS,WAChB,OAAOC,OAAQ,UAEf,IAAMC,EAAN,cAAqB,KAAM,CAC1B,YAAYC,EAAM,CACjB,MAAM,GAAGA,CAAI,YAAY,CAC1B,CACD,EAEMC,EAAc,CACnB,IAAK,IAAI,IACT,MAAO,IAAI,GACZ,EAKMC,GAAkC,IAAO,GAM/C,IAAIC,EAEEC,GAAgB,IAAM,CAC3B,IAAMC,EAAaC,GAAG,kBAAkB,EAIlCC,EAAU,IAAI,IAAI,CAAC,OAAW,SAAS,CAAC,EAE9C,QAAWC,KAAc,OAAO,OAAOH,CAAU,EAChD,QAAWI,KAAUD,EACpBD,EAAQ,IAAIE,EAAO,OAAO,EAI5B,OAAOF,CACR,EAEMG,GAAqBC,GAC1B,IAAI,QAAQ,CAACC,EAASC,IAAW,CAChC,IAAMC,EAASC,GAAI,aAAa,EAChCD,EAAO,MAAM,EACbA,EAAO,GAAG,QAASD,CAAM,EAEzBC,EAAO,OAAOH,EAAS,IAAM,CAC5B,GAAM,CAAC,KAAAK,CAAI,EAAIF,EAAO,QAAQ,EAC9BA,EAAO,MAAM,IAAM,CAClBF,EAAQI,CA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E,CAAC,EACvD,MAAMC,GAAKD,EAAI,SAAS,CAAC,EACzBF,EAAQ,CACN,qBAAsB,GACtB,QAASnB;AAAA;AAAA;AAAA;AAAA,SAKX,CAAC,CACH,OAASoB,EAAO,CACdlB,EAAI,IAAI,MAAM,yBAA0B,CAAE,MAAAkB,CAAM,CAAC,EACjDD,EAAQ,CACN,qBAAsB,GACtB,QAASnB;AAAA;AAAA;AAAA,oBAGGqB,EAAI,SAAS,CAAC;AAAA;AAAA;AAAA,SAI5B,CAAC,CACH,CAEA,MAAMf,CACR,QAAE,CACAH,GAAQ,MAAM,CAChB,CACF,EAGaoB,GAAQtB",
6
6
  "names": ["init_cjs", "init_cjs", "net", "os", "Locked", "port", "lockedPorts", "releaseOldLockedPortsIntervalMs", "timeout", "getLocalHosts", "interfaces", "os", "results", "_interface", "config", "checkAvailablePort", "options", "resolve", "reject", "server", "net", "port", "getAvailablePort", "hosts", "host", "error", "portCheckSequence", "ports", "getPorts", "exclude", "excludeIterable", "element", "lockedPorts", "releaseOldLockedPortsIntervalMs", "availablePort", "Locked", "assert", "http", "init_cjs", "process", "Buffer", "path", "fileURLToPath", "childProcess", "fs", "fsConstants", "init_cjs", "defineLazyProperty", "object", "propertyName", "valueGetter", "define", "value", "result", "init_cjs", "promisify", "process", "execFile", "init_cjs", "promisify", "process", "execFile", "execFileAsync", "defaultBrowserId", "stdout", "init_cjs", "init_cjs", "process", "promisify", "execFile", "execFileSync", "execFileAsync", "runAppleScript", "script", "humanReadableOutput", "outputArguments", "stdout", "bundleName", "bundleId", "runAppleScript", "init_cjs", "promisify", "execFile", "execFileAsync", "windowsBrowserProgIds", "UnknownBrowserError", "defaultBrowser", "_execFileAsync", "stdout", "match", "id", "browser", "execFileAsync", "promisify", "execFile", "titleize", "string", "x", "defaultBrowser", "process", "id", "defaultBrowserId", "bundleName", "stdout", "__dirname", "path", "fileURLToPath", "localXdgOpenPath", "platform", "arch", "process", "getWslDrivesMountPoint", "defaultMountPoint", "mountPoint", "configFilePath", "isConfigFileExists", "fs", "fsConstants", "configContent", "configMountPoint", "pTryEach", "array", "mapper", "latestError", "item", "error", "baseOpen", "options", "singleApp", "app", "appArguments", "appName", "ids", "flags", "browser", "defaultBrowser", "browserName", "apps", "command", "cliArguments", "childProcessOptions", "is_wsl_default", "isInsideContainer", "encodedArguments", "argument", "Buffer", "isBundled", "exeLocalXdgOpen", "subprocess", "childProcess", "resolve", "reject", "exitCode", "open", "target", "detectArchBinary", "binary", "arch", "archBinary", "detectPlatformBinary", "platform", "platformBinary", "wsl", "is_wsl_default", "apps", "defineLazyProperty", "open_default", "open", "init_cjs", "assert", "init_cjs", "process", "init_cjs", "init_cjs", "base_exports", "__export", "beep", "clearScreen", "clearTerminal", "cursorBackward", "cursorDown", "cursorForward", "cursorGetPosition", "cursorHide", "cursorLeft", "cursorMove", "cursorNextLine", "cursorPrevLine", "cursorRestorePosition", "cursorSavePosition", "cursorShow", "cursorTo", "cursorUp", "enterAlternativeScreen", "eraseDown", "eraseEndLine", "eraseLine", "eraseLines", "eraseScreen", "eraseStartLine", "eraseUp", "exitAlternativeScreen", "iTerm", "image", "link", "scrollDown", "scrollUp", "init_cjs", "process", "init_cjs", "isBrowser", "isNode", "isBun", "isDeno", "isElectron", "isJsDom", "isWebWorker", "isDedicatedWorker", "isSharedWorker", "isServiceWorker", "platform", "isMacOs", "isWindows", "isLinux", "isIos", "isAndroid", "ESC", "OSC", "BEL", "SEP", "isTerminalApp", "isBrowser", "process", "isWindows", "cwdFunction", "cursorTo", "x", "y", "cursorMove", "returnValue", "cursorUp", "count", "cursorDown", "cursorForward", "cursorBackward", "cursorLeft", "cursorSavePosition", "cursorRestorePosition", "cursorGetPosition", "cursorNextLine", "cursorPrevLine", "cursorHide", "cursorShow", "eraseLines", "clear", "i", "eraseLine", "eraseEndLine", "eraseStartLine", "eraseDown", "eraseUp", "eraseScreen", "scrollUp", "scrollDown", "clearScreen", "clearTerminal", "enterAlternativeScreen", "exitAlternativeScreen", "beep", "link", "text", "url", "image", "data", "options", "iTerm", "cwd", "message", "hasX", "hasY", "assert", "EventEmitter", "process", "readline", "Prompt", "_Prompt", "EventEmitter", "assert", "rl", "readline", "process", "isSelect", "keypress", "str", "key", "action", "getPromptAction", "_str", "_key", "output", "base_exports", "entriesToDisplay", "cursor", "total", "maxVisible", "startIndex", "endIndex", "confirm", "contentOrOptions", "options", "defaults", "output", "whenNotInteractive", "println", "process", "resolve", "conf", "Confirm", "Prompt", "char", "_key", "value", "sprintln", "source_default", "User", "z", "kUser", "maybeGetCurrentUser", "ctx", "getCurrentUser", "user", "assert", "setCurrentUser", "getUser", "headers", "maybeLoadAuthHeaders", "json", "http", "config", "error", "swallowUnauthorized", "getUserOrLogin", "println", "maybeGetCurrentCommand", "confirm", "login", "usage", "sprint", "run", "ctx", "server", "port", "getPorts", "receiveSession", "resolve", "reject", "http", "req", "res", "landingPage", "config", "assert", "session", "writeSession", "user", "getUser", "println", "error", "url", "open_default", "login"]
7
7
  }