@e2b/cli 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Devbook CLI
1
+ # e2b CLI
2
2
  CLI for managing Devbook environments.
3
3
 
4
4
  An environment is a virtual machine image that you can customize through our CLI. You can add files, install dependencies, and set env vars in the environment. Then with Devbook, every user visiting your website will get a new copy of the environment they can use.
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ tell application "System Events" to get value of property list item "CFBundleNam
82
82
  ${e}`,bI=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),_I=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),EI=(t,e,r)=>{let n=r===""?"":`with ${r.trim()}() `,i=yI.bind(null,n,e.toString());Object.defineProperty(i,"name",_I),Object.defineProperty(t,"toString",{...bI,value:i})};function Bf(t,e,{ignoreNonConfigurable:r=!1}={}){let{name:n}=t;for(let i of Reflect.ownKeys(e))DI(t,e,i,r);return gI(t,e),EI(t,e,n),t}var Mu=new WeakMap,Bb=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let r,n=0,i=t.displayName||t.name||"<anonymous>",s=function(...a){if(Mu.set(s,++n),n===1)r=t.apply(this,a),t=null;else if(e.throw===!0)throw new Error(`Function \`${i}\` can only be called once`);return r};return Bf(s,t),Mu.set(s,n),s};Bb.callCount=t=>{if(!Mu.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return Mu.get(t)};var Ib=Bb;u();var Hb=M(require("process"),1);u();var Mb=require("os");u();var Pb=()=>{let t=kb-Lb+1;return Array.from({length:t},CI)},CI=(t,e)=>({name:`SIGRT${e+1}`,number:Lb+e,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}),Lb=34,kb=64;u();var qb=require("os");u();var Nb=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:!0},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:!0},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:!0},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];var If=()=>{let t=Pb();return[...Nb,...t].map(FI)},FI=({name:t,number:e,description:r,action:n,forced:i=!1,standard:s})=>{let{signals:{[t]:a}}=qb.constants,f=a!==void 0;return{name:t,number:f?a:e,description:r,supported:f,action:n,forced:i,standard:s}};var SI=()=>{let t=If();return Object.fromEntries(t.map(xI))},xI=({name:t,number:e,description:r,supported:n,action:i,forced:s,standard:a})=>[t,{name:t,number:e,description:r,supported:n,action:i,forced:s,standard:a}],$b=SI(),wI=()=>{let t=If(),e=64+1,r=Array.from({length:e},(n,i)=>AI(i,t));return Object.assign({},...r)},AI=(t,e)=>{let r=vI(t,e);if(r===void 0)return{};let{name:n,description:i,supported:s,action:a,forced:f,standard:c}=r;return{[t]:{name:n,number:t,description:i,supported:s,action:a,forced:f,standard:c}}},vI=(t,e)=>{let r=e.find(({name:n})=>Mb.constants.signals[n]===t);return r!==void 0?r:e.find(n=>n.number===t)},cZ=wI();var TI=({timedOut:t,timeout:e,errorCode:r,signal:n,signalDescription:i,exitCode:s,isCanceled:a})=>t?`timed out after ${e} milliseconds`:a?"was canceled":r!==void 0?`failed with ${r}`:n!==void 0?`was killed with ${n} (${i})`:s!==void 0?`failed with exit code ${s}`:"failed",Fs=({stdout:t,stderr:e,all:r,error:n,signal:i,exitCode:s,command:a,escapedCommand:f,timedOut:c,isCanceled:h,killed:D,parsed:{options:{timeout:y,cwd:_=Hb.default.cwd()}}})=>{s=s===null?void 0:s,i=i===null?void 0:i;let F=i===void 0?void 0:$b[i].description,C=n&&n.code,P=`Command ${TI({timedOut:c,timeout:y,errorCode:C,signal:i,signalDescription:F,exitCode:s,isCanceled:h})}: ${a}`,q=Object.prototype.toString.call(n)==="[object Error]",H=q?`${P}
83
83
  ${n.message}`:P,j=[H,e,t].filter(Boolean).join(`
84
84
  `);return q?(n.originalMessage=n.message,n.message=j):n=new Error(j),n.shortMessage=H,n.command=a,n.escapedCommand=f,n.exitCode=s,n.signal=i,n.signalDescription=F,n.stdout=t,n.stderr=e,n.cwd=_,r!==void 0&&(n.all=r),"bufferedData"in n&&delete n.bufferedData,n.failed=!0,n.timedOut=!!c,n.isCanceled=h,n.killed=D&&!c,n};u();var $u=["stdin","stdout","stderr"],RI=t=>$u.some(e=>t[e]!==void 0),Ub=t=>{if(!t)return;let{stdio:e}=t;if(e===void 0)return $u.map(n=>t[n]);if(RI(t))throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${$u.map(n=>`\`${n}\``).join(", ")}`);if(typeof e=="string")return e;if(!Array.isArray(e))throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof e}\``);let r=Math.max(e.length,$u.length);return Array.from({length:r},(n,i)=>e[i])};u();var jb=M(require("os"),1),Wb=M(Cf(),1),OI=1e3*5,zb=(t,e="SIGTERM",r={})=>{let n=t(e);return BI(t,e,r,n),n},BI=(t,e,r,n)=>{if(!II(e,r,n))return;let i=LI(r),s=setTimeout(()=>{t("SIGKILL")},i);s.unref&&s.unref()},II=(t,{forceKillAfterTimeout:e},r)=>PI(t)&&e!==!1&&r,PI=t=>t===jb.default.constants.signals.SIGTERM||typeof t=="string"&&t.toUpperCase()==="SIGTERM",LI=({forceKillAfterTimeout:t=!0})=>{if(t===!0)return OI;if(!Number.isFinite(t)||t<0)throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`);return t},Gb=(t,e)=>{t.kill()&&(e.isCanceled=!0)},kI=(t,e,r)=>{t.kill(e),r(Object.assign(new Error("Timed out"),{timedOut:!0,signal:e}))},Vb=(t,{timeout:e,killSignal:r="SIGTERM"},n)=>{if(e===0||e===void 0)return n;let i,s=new Promise((f,c)=>{i=setTimeout(()=>{kI(t,r,c)},e)}),a=n.finally(()=>{clearTimeout(i)});return Promise.race([s,a])},Yb=({timeout:t})=>{if(t!==void 0&&(!Number.isFinite(t)||t<0))throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)},Kb=async(t,{cleanup:e,detached:r},n)=>{if(!e||r)return n;let i=(0,Wb.default)(()=>{t.kill()});return n.finally(()=>{i()})};u();var Qb=require("fs"),Zb=require("child_process");u();function Hu(t){return t!==null&&typeof t=="object"&&typeof t.pipe=="function"}function Pf(t){return Hu(t)&&t.writable!==!1&&typeof t._write=="function"&&typeof t._writableState=="object"}var NI=t=>t instanceof Zb.ChildProcess&&typeof t.then=="function",Lf=(t,e,r)=>{if(typeof r=="string")return t[e].pipe((0,Qb.createWriteStream)(r)),t;if(Pf(r))return t[e].pipe(r),t;if(!NI(r))throw new TypeError("The second argument must be a string, a stream or an Execa child process.");if(!Pf(r.stdin))throw new TypeError("The target child process's stdin must be available.");return t[e].pipe(r.stdin),r},Xb=t=>{t.stdout!==null&&(t.pipeStdout=Lf.bind(void 0,t,"stdout")),t.stderr!==null&&(t.pipeStderr=Lf.bind(void 0,t,"stderr")),t.all!==void 0&&(t.pipeAll=Lf.bind(void 0,t,"all"))};u();var Uu=require("fs");var qf=M(Sf(),1),Jb=M(xf(),1),e_=t=>{if(t!==void 0)throw new TypeError("The `input` and `inputFile` options cannot be both set.")},qI=({input:t,inputFile:e})=>typeof e!="string"?t:(e_(t),(0,Uu.readFileSync)(e)),t_=t=>{let e=qI(t);if(Hu(e))throw new TypeError("The `input` option cannot be a stream in sync mode");return e},MI=({input:t,inputFile:e})=>typeof e!="string"?t:(e_(t),(0,Uu.createReadStream)(e)),r_=(t,e)=>{let r=MI(e);r!==void 0&&(Hu(r)?r.pipe(t.stdin):t.stdin.end(r))},n_=(t,{all:e})=>{if(!e||!t.stdout&&!t.stderr)return;let r=(0,Jb.default)();return t.stdout&&r.add(t.stdout),t.stderr&&r.add(t.stderr),r},kf=async(t,e)=>{if(!(!t||e===void 0)){t.destroy();try{return await e}catch(r){return r.bufferedData}}},Nf=(t,{encoding:e,buffer:r,maxBuffer:n})=>{if(!(!t||!r))return e?(0,qf.default)(t,{encoding:e,maxBuffer:n}):qf.default.buffer(t,{maxBuffer:n})},i_=async({stdout:t,stderr:e,all:r},{encoding:n,buffer:i,maxBuffer:s},a)=>{let f=Nf(t,{encoding:n,buffer:i,maxBuffer:s}),c=Nf(e,{encoding:n,buffer:i,maxBuffer:s}),h=Nf(r,{encoding:n,buffer:i,maxBuffer:s*2});try{return await Promise.all([a,f,c,h])}catch(D){return Promise.all([{error:D,signal:D.signal,timedOut:D.timedOut},kf(t,f),kf(e,c),kf(r,h)])}};u();var $I=(async()=>{})().constructor.prototype,HI=["then","catch","finally"].map(t=>[t,Reflect.getOwnPropertyDescriptor($I,t)]),Mf=(t,e)=>{for(let[r,n]of HI){let i=typeof e=="function"?(...s)=>Reflect.apply(n.value,e(),s):n.value.bind(e);Reflect.defineProperty(t,r,{...n,value:i})}},s_=t=>new Promise((e,r)=>{t.on("exit",(n,i)=>{e({exitCode:n,signal:i})}),t.on("error",n=>{r(n)}),t.stdin&&t.stdin.on("error",n=>{r(n)})});u();var a_=require("buffer"),l_=require("child_process"),c_=(t,e=[])=>Array.isArray(e)?[t,...e]:[t],UI=/^[\w.-]+$/,jI=/"/g,WI=t=>typeof t!="string"||UI.test(t)?t:`"${t.replace(jI,'\\"')}"`,$f=(t,e)=>c_(t,e).join(" "),Hf=(t,e)=>c_(t,e).map(r=>WI(r)).join(" "),zI=/ +/g;var o_=t=>{let e=typeof t;if(e==="string")return t;if(e==="number")return String(t);if(e==="object"&&t!==null&&!(t instanceof l_.ChildProcess)&&"stdout"in t){let r=typeof t.stdout;if(r==="string")return t.stdout;if(a_.Buffer.isBuffer(t.stdout))return t.stdout.toString();throw new TypeError(`Unexpected "${r}" stdout in template expression`)}throw new TypeError(`Unexpected "${e}" in template expression`)},u_=(t,e,r)=>r||t.length===0||e.length===0?[...t,...e]:[...t.slice(0,-1),`${t[t.length-1]}${e[0]}`,...e.slice(1)],GI=({templates:t,expressions:e,tokens:r,index:n,template:i})=>{let s=i??t.raw[n],a=s.split(zI).filter(Boolean),f=u_(r,a,s.startsWith(" "));if(n===e.length)return f;let c=e[n],h=Array.isArray(c)?c.map(D=>o_(D)):[o_(c)];return u_(f,h,s.endsWith(" "))},Uf=(t,e)=>{let r=[];for(let[n,i]of t.entries())r=GI({templates:t,expressions:e,tokens:r,index:n,template:i});return r};u();var f_=require("util"),h_=M(require("process"),1),d_=(0,f_.debuglog)("execa").enabled,ju=(t,e)=>String(t).padStart(e,"0"),VI=()=>{let t=new Date;return`${ju(t.getHours(),2)}:${ju(t.getMinutes(),2)}:${ju(t.getSeconds(),2)}.${ju(t.getMilliseconds(),3)}`},jf=(t,{verbose:e})=>{e&&h_.default.stderr.write(`[${VI()}] ${t}
85
- `)};var YI=1e3*1e3*100,KI=({env:t,extendEnv:e,preferLocal:r,localDir:n,execPath:i})=>{let s=e?{...Ss.default.env,...t}:t;return r?Ob({env:s,cwd:n,execPath:i}):s},y_=(t,e,r={})=>{let n=g_.default._parse(t,e,r);return t=n.command,e=n.args,r=n.options,r={maxBuffer:YI,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||Ss.default.cwd(),execPath:Ss.default.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:d_,...r},r.env=KI(r),r.stdio=Ub(r),Ss.default.platform==="win32"&&m_.default.basename(t,".exe")==="cmd"&&e.unshift("/q"),{file:t,args:e,options:r,parsed:n}},xs=(t,e,r)=>typeof e!="string"&&!D_.Buffer.isBuffer(e)?r===void 0?void 0:"":t.stripFinalNewline?Of(e):e;function ws(t,e,r){let n=y_(t,e,r),i=$f(t,e),s=Hf(t,e);jf(s,n.options),Yb(n.options);let a;try{a=Wu.default.spawn(n.file,n.args,n.options)}catch(F){let C=new Wu.default.ChildProcess,R=Promise.reject(Fs({error:F,stdout:"",stderr:"",all:"",command:i,escapedCommand:s,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return Mf(C,R),C}let f=s_(a),c=Vb(a,n.options,f),h=Kb(a,n.options,c),D={isCanceled:!1};a.kill=zb.bind(null,a.kill.bind(a)),a.cancel=Gb.bind(null,a,D);let _=Ib(async()=>{let[{error:F,exitCode:C,signal:R,timedOut:P},q,H,j]=await i_(a,n.options,h),v=xs(n.options,q),N=xs(n.options,H),T=xs(n.options,j);if(F||C!==0||R!==null){let $=Fs({error:F,exitCode:C,signal:R,stdout:v,stderr:N,all:T,command:i,escapedCommand:s,parsed:n,timedOut:P,isCanceled:D.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:a.killed});if(!n.options.reject)return $;throw $}return{command:i,escapedCommand:s,exitCode:0,stdout:v,stderr:N,all:T,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return r_(a,n.options),a.all=n_(a,n.options),Xb(a),Mf(a,_),a}function QI(t,e,r){let n=y_(t,e,r),i=$f(t,e),s=Hf(t,e);jf(s,n.options);let a=t_(n.options),f;try{f=Wu.default.spawnSync(n.file,n.args,{...n.options,input:a})}catch(D){throw Fs({error:D,stdout:"",stderr:"",all:"",command:i,escapedCommand:s,parsed:n,timedOut:!1,isCanceled:!1,killed:!1})}let c=xs(n.options,f.stdout,f.error),h=xs(n.options,f.stderr,f.error);if(f.error||f.status!==0||f.signal!==null){let D=Fs({stdout:c,stderr:h,error:f.error,signal:f.signal,exitCode:f.status,command:i,escapedCommand:s,parsed:n,timedOut:f.error&&f.error.code==="ETIMEDOUT",isCanceled:!1,killed:f.signal!==null});if(!n.options.reject)return D;throw D}return{command:i,escapedCommand:s,exitCode:0,stdout:c,stderr:h,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}var ZI=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},p_=(t={})=>({preferLocal:!0,...ZI(t),...t});function b_(t){function e(r,...n){if(!Array.isArray(r))return b_({...t,...r});let[i,...s]=Uf(r,n);return ws(i,s,p_(t))}return e.sync=(r,...n)=>{if(!Array.isArray(r))throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");let[i,...s]=Uf(r,n);return QI(i,s,p_(t))},e}var VZ=b_();u();var XI={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"}},zu=class extends Error{};async function Wf(t=ws){let e=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e.stdout);if(!r)throw new zu(`Cannot find Windows browser in stdout: ${JSON.stringify(e.stdout)}`);let{id:n}=r.groups,i=XI[n];if(!i)throw new zu(`Unknown browser ID: ${n}`);return i}async function zf(){if(Gu.default.platform==="linux"){let{stdout:t}=await ws("xdg-mime",["query","default","x-scheme-handler/http"]);return{name:Rf(t.trim().replace(/.desktop$/,"").replace("-"," ")),id:t}}if(Gu.default.platform==="darwin"){let t=await sf();return{name:await Tf(t),id:t}}if(Gu.default.platform==="win32")return Wf();throw new Error("Only macOS, Linux, and Windows are supported")}u();var __=M(require("fs"),1);u();var Vf=M(require("fs"),1),Gf;function JI(){try{return Vf.default.statSync("/.dockerenv"),!0}catch{return!1}}function e6(){try{return Vf.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Yf(){return Gf===void 0&&(Gf=JI()||e6()),Gf}var Kf,t6=()=>{try{return __.default.statSync("/run/.containerenv"),!0}catch{return!1}};function Qf(){return Kf===void 0&&(Kf=t6()||Yf()),Kf}var Zf=Xf.default.dirname((0,w_.fileURLToPath)(importMetaUrl)),E_=Xf.default.join(Zf,"xdg-open"),{platform:Zn,arch:C_}=Yu.default,r6=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Ku.default.access(r,Jf.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await Ku.default.readFile(r,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return s?(e=s.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),F_=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},Vu=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return F_(t.app,f=>Vu({...t,app:f}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return F_(e,f=>Vu({...t,app:{name:f,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let f={"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"},h=await zf();if(h.id in f){let D=f[h.id];return e==="browserPrivate"&&r.push(c[D]),Vu({...t,app:{name:Xn[D],arguments:r}})}throw new Error(`${h.name} is not supported as a default browser`)}let n,i=[],s={};if(Zn==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(Zn==="win32"||As.default&&!Qf()&&!e){let f=await r6();n=As.default?`${f}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${Yu.default.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),As.default||(s.windowsVerbatimArguments=!0);let c=["Start"];t.wait&&c.push("-Wait"),e?(c.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&c.push(`"${t.target}"`),r.length>0&&(r=r.map(h=>`"\`"${h}\`""`),c.push("-ArgumentList",r.join(","))),t.target=x_.Buffer.from(c.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let f=!Zf||Zf==="/",c=!1;try{await Ku.default.access(E_,Jf.constants.X_OK),c=!0}catch{}n=Yu.default.versions.electron??(Zn==="android"||f||!c)?"xdg-open":E_}r.length>0&&i.push(...r),t.wait||(s.stdio="ignore",s.detached=!0)}t.target&&i.push(t.target),Zn==="darwin"&&r.length>0&&i.push("--args",...r);let a=A_.default.spawn(n,i,s);return t.wait?new Promise((f,c)=>{a.once("error",c),a.once("close",h=>{if(!t.allowNonzeroExitCode&&h>0){c(new Error(`Exited with code ${h}`));return}f(a)})}):(a.unref(),a)},n6=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Vu({...e,target:t})};function S_(t){if(typeof t=="string"||Array.isArray(t))return t;let{[C_]:e}=t;if(!e)throw new Error(`${C_} is not supported`);return e}function eh({[Zn]:t},{wsl:e}){if(e&&As.default)return S_(e);if(!t)throw new Error(`${Zn} is not supported`);return S_(t)}var Xn={};Yr(Xn,"chrome",()=>eh({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"]}}));Yr(Xn,"firefox",()=>eh({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Yr(Xn,"edge",()=>eh({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Yr(Xn,"browser",()=>"browser");Yr(Xn,"browserPrivate",()=>"browserPrivate");var v_=n6;var B_=M(R_());var ih=M(require("path")),I_=M(require("os")),Zr=M(require("fs")),P_=M(require("http"));var th={};np(th,{author:()=>d6,bin:()=>E6,bugs:()=>p6,default:()=>nh,dependencies:()=>C6,description:()=>c6,devDependencies:()=>b6,engines:()=>F6,files:()=>_6,homepage:()=>f6,license:()=>h6,name:()=>l6,publishConfig:()=>m6,repository:()=>D6,scripts:()=>y6,sideEffects:()=>g6,version:()=>rh});var l6="@e2b/cli",rh="0.0.1",c6="CLI for managing e2b environments",f6="https://usedevbook.com",h6="SEE LICENSE IN LICENSE",d6={name:"FoundryLabs, Inc.",email:"hello@e2b.dev",url:"https://e2b.dev"},p6="https://github.com/e2b-dev/e2b/issues",D6={type:"git",url:"https://github.com/e2b-dev/e2b/tree/main/packages/cli"},m6={access:"public"},g6=!1,y6={prepublishOnly:"pnpm build",build:"rm -rf ./dist && tsup --minify",dev:"tsup --watch",fix:"npx eslint **/src/**/*.{ts,js} --fix",format:"prettier --check --ignore-path .gitignore .","format:fix":"prettier --write --ignore-path .gitignore ."},b6={"@trivago/prettier-plugin-sort-imports":"^3.3.0","@types/common-tags":"^1.8.2","@types/inquirer":"^8.0.0","@types/node":"16.11","@types/node-fetch":"^2.6.5","@types/parse-gitignore":"^1.0.0","@types/update-notifier":"5.1.0","@typescript-eslint/eslint-plugin":"^5.38.1","@typescript-eslint/parser":"^5.38.1",eslint:"^8.24.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-unused-imports":"^2.0.0",prettier:"^2.7.1",tsup:"^6.5.0",typescript:"^4.9.3"},_6=["dist","LICENSE","README","package.json"],E6={e2b:"dist/index.js"},C6={"@devbookhq/sdk":"^2.6.88","@e2b/sdk":"file:../js-sdk/dist","@iarna/toml":"^2.2.5","@nodelib/fs.walk":"^1.2.8","@types/tar-fs":"^2.0.2","@zeit/dockerignore":"^0.0.5","async-listen":"^3.0.1",boxen:"^7.0.0",chalk:"^5.1.2",chokidar:"^3.5.3",commander:"^9.4.1","common-tags":"^1.8.2","docker-names":"^1.2.1","get-port":"^7.0.0",ignore:"^5.2.4",inquirer:"^8.0.0","node-fetch":"^3.3.2",open:"^9.1.0","parse-gitignore":"^2.0.0","tar-fs":"^3.0.4","update-notifier":"5.1.0",yup:"^0.32.11"},F6={node:">=16"},nh={name:l6,version:rh,description:c6,homepage:f6,license:h6,author:d6,bugs:p6,repository:D6,publishConfig:m6,sideEffects:g6,scripts:y6,devDependencies:b6,files:_6,bin:E6,dependencies:C6,engines:F6};var Jn=ih.default.join(I_.homedir(),".e2b","config.json"),O_=process.env.E2B_DOCS_BASE||"https://e2b.dev/docs",L_=new yt("login").description("Login to e2b").action(async()=>{let t;try{t=sh()}catch(e){console.error(Hn("Failed to read user config",e))}if(t){console.log(`Already logged in as ${Vt(t.email)}, if you want to login as a different user, logout first.`);return}else if(!t){if(console.log("Attempting to login..."),t=await S6(),!t){console.info("Login aborted");return}Zr.default.mkdirSync(ih.default.dirname(Jn),{recursive:!0}),Zr.default.writeFileSync(Jn,JSON.stringify(t,null,2))}console.log(`Logged in as ${Vt(t.email)}`),process.exit(0)}),k_=new yt("logout").description("Logout of e2b").action(()=>{Zr.default.existsSync(Jn)?(Zr.default.unlinkSync(Jn),console.log("Logged out.")):console.log("Not logged in, nothing to do")});function sh(){return Zr.default.existsSync(Jn)?JSON.parse(Zr.default.readFileSync(Jn,"utf8")):null}async function S6(){let t=P_.default.createServer(),{port:e}=await(0,B_.listen)(t,0,"127.0.0.1"),r=new URL(`${O_}/api/cli`);return r.searchParams.set("next",`http://localhost:${e}`),r.searchParams.set("cliVersion",nh.version),new Promise((n,i)=>(t.once("request",(s,a)=>{a.setHeader("connection","close");let f=new URL(`${O_}/api/cli`),c=new URL(s.url||"/","http://localhost").searchParams,h=Object.fromEntries(c.entries()),{error:D}=h;D?(i(new Error(D)),f.searchParams.set("state","error"),f.searchParams.set("error",D)):(n(h),f.searchParams.set("state","success"),f.searchParams.set("email",h.email)),a.statusCode=302,a.setHeader("location",f.href),a.end()}),v_(r.toString())))}var Ts=process.env.E2B_API_BASE??"http://localhost:3003",xX=process.env.E2B_API_KEY,Qu=process.env.E2B_ACCESS_TOKEN,x6=Ol(`You must be logged in to use this command. Run ${Vt("e2b login")}.`,{width:70,float:"center",padding:.5,margin:1,borderStyle:"round",borderColor:"redBright"});function Zu(){if(!Qu){let t=sh();Qu=t==null?void 0:t.accessToken}if(!Qu)console.error(x6),process.exit(1);else return Qu}u();u();u();u();u();var oh;try{oh=Map}catch{}var uh;try{uh=Set}catch{}function N_(t,e,r){if(!t||typeof t!="object"||typeof t=="function")return t;if(t.nodeType&&"cloneNode"in t)return t.cloneNode(!0);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);if(Array.isArray(t))return t.map(Rs);if(oh&&t instanceof oh)return new Map(Array.from(t.entries()));if(uh&&t instanceof uh)return new Set(Array.from(t.values()));if(t instanceof Object){e.push(t);var n=Object.create(t);r.push(n);for(var i in t){var s=e.findIndex(function(a){return a===t[i]});n[i]=s>-1?r[s]:N_(t[i],e,r)}return n}return t}function Rs(t){return N_(t,[],[])}u();u();var w6=Object.prototype.toString,A6=Error.prototype.toString,v6=RegExp.prototype.toString,T6=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",R6=/^Symbol\((.*)\)(.*)$/;function O6(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function q_(t,e=!1){if(t==null||t===!0||t===!1)return""+t;let r=typeof t;if(r==="number")return O6(t);if(r==="string")return e?`"${t}"`:t;if(r==="function")return"[Function "+(t.name||"anonymous")+"]";if(r==="symbol")return T6.call(t).replace(R6,"Symbol($1)");let n=w6.call(t).slice(8,-1);return n==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):n==="Error"||t instanceof Error?"["+A6.call(t)+"]":n==="RegExp"?v6.call(t):null}function St(t,e){let r=q_(t,e);return r!==null?r:JSON.stringify(t,function(n,i){let s=q_(this[n],e);return s!==null?s:i},2)}var _r={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:r,originalValue:n})=>{let i=n!=null&&n!==r,s=`${t} must be a \`${e}\` type, but the final value was: \`${St(r,!0)}\``+(i?` (cast from the value \`${St(n,!0)}\`).`:".");return r===null&&(s+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),s},defined:"${path} must be defined"},ht={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Yt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Xu={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Ju={isValue:"${path} field must be ${value}"},ea={noUnknown:"${path} field has unspecified keys: ${unknown}"},Os={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},B6=Object.assign(Object.create(null),{mixed:_r,string:ht,number:Yt,date:Xu,object:ea,array:Os,boolean:Ju});u();var BC=M(ua());u();var $k=t=>t&&t.__isYupSchema__,Cr=$k;var yh=class{constructor(e,r){if(this.fn=void 0,this.refs=e,this.refs=e,typeof r=="function"){this.fn=r;return}if(!(0,BC.default)(r,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:i,otherwise:s}=r,a=typeof n=="function"?n:(...f)=>f.every(c=>c===n);this.fn=function(...f){let c=f.pop(),h=f.pop(),D=a(...f)?i:s;if(D)return typeof D=="function"?D(h):h.concat(D.resolve(c))}}resolve(e,r){let n=this.refs.map(s=>s.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),i=this.fn.apply(e,n.concat(e,r));if(i===void 0||i===e)return e;if(!Cr(i))throw new TypeError("conditions must return a schema object");return i.resolve(r)}},IC=yh;u();u();u();function Ms(t){return t==null?[]:[].concat(t)}function bh(){return bh=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},bh.apply(this,arguments)}var Hk=/\$\{\s*(\w+)\s*\}/g,Se=class extends Error{static formatError(e,r){let n=r.label||r.path||"this";return n!==r.path&&(r=bh({},r,{path:n})),typeof e=="string"?e.replace(Hk,(i,s)=>St(r[s])):typeof e=="function"?e(r):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,r,n,i){super(),this.value=void 0,this.path=void 0,this.type=void 0,this.errors=void 0,this.params=void 0,this.inner=void 0,this.name="ValidationError",this.value=r,this.path=n,this.type=i,this.errors=[],this.inner=[],Ms(e).forEach(s=>{Se.isError(s)?(this.errors.push(...s.errors),this.inner=this.inner.concat(s.inner.length?s.inner:s)):this.errors.push(s)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,Se)}};var Uk=t=>{let e=!1;return(...r)=>{e||(e=!0,t(...r))}};function Fr(t,e){let{endEarly:r,tests:n,args:i,value:s,errors:a,sort:f,path:c}=t,h=Uk(e),D=n.length,y=[];if(a=a||[],!D)return a.length?h(new Se(a,s,c)):h(null,s);for(let _=0;_<n.length;_++){let F=n[_];F(i,function(R){if(R){if(!Se.isError(R))return h(R,s);if(r)return R.value=s,h(R,s);y.push(R)}if(--D<=0){if(y.length&&(f&&y.sort(f),a.length&&y.push(...a),a=y),a.length){h(new Se(a,s,c),s);return}h(null,s)}})}}u();var bx=M(Mh());u();var yx=M(js()),fa={context:"$",value:"."};var $e=class{constructor(e,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===fa.context,this.isValue=this.key[0]===fa.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?fa.context:this.isValue?fa.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&(0,yx.getter)(this.path,!0),this.map=r.map}getValue(e,r,n){let i=this.isContext?n:this.isValue?e:r;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(e,r){return this.getValue(e,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}};$e.prototype.__isYupRef=!0;function ha(){return ha=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ha.apply(this,arguments)}function aM(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function ci(t){function e(r,n){let{value:i,path:s="",label:a,options:f,originalValue:c,sync:h}=r,D=aM(r,["value","path","label","options","originalValue","sync"]),{name:y,test:_,params:F,message:C}=t,{parent:R,context:P}=f;function q(T){return $e.isRef(T)?T.getValue(i,R,P):T}function H(T={}){let $=(0,bx.default)(ha({value:i,originalValue:c,label:a,path:T.path||s},F,T.params),q),re=new Se(Se.formatError(T.message||C,$),i,$.path,T.type||y);return re.params=$,re}let j=ha({path:s,parent:R,type:y,createError:H,resolve:q,options:f,originalValue:c},D);if(!h){try{Promise.resolve(_.call(j,i,j)).then(T=>{Se.isError(T)?n(T):T?n(null,T):n(H())}).catch(n)}catch(T){n(T)}return}let v;try{var N;if(v=_.call(j,i,j),typeof((N=v)==null?void 0:N.then)=="function")throw new Error(`Validation test of type: "${j.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(T){n(T);return}Se.isError(v)?n(v):v?n(null,v):n(H())}return e.OPTIONS=t,e}u();var _x=M(js()),lM=t=>t.substr(0,t.length-1).substr(1);function Ex(t,e,r,n=r){let i,s,a;return e?((0,_x.forEach)(e,(f,c,h)=>{let D=c?lM(f):f;if(t=t.resolve({context:n,parent:i,value:r}),t.innerType){let y=h?parseInt(D,10):0;if(r&&y>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${f}, in the path: ${e}. because there is no value at that index. `);i=r,r=r&&r[y],t=t.innerType}if(!h){if(!t.fields||!t.fields[D])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${a} which is a type: "${t._type}")`);i=r,r=r&&r[D],t=t.fields[D]}s=D,a=c?"["+f+"]":"."+f}),{schema:t,parent:i,parentPath:s}):{parent:i,parentPath:e,schema:t}}u();var Sr=class{constructor(){this.list=void 0,this.refs=void 0,this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){let e=[];for(let r of this.list)e.push(r);for(let[,r]of this.refs)e.push(r.describe());return e}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}resolveAll(e){return this.toArray().reduce((r,n)=>r.concat($e.isRef(n)?e(n):n),[])}add(e){$e.isRef(e)?this.refs.set(e.key,e):this.list.add(e)}delete(e){$e.isRef(e)?this.refs.delete(e.key):this.list.delete(e)}clone(){let e=new Sr;return e.list=new Set(this.list),e.refs=new Map(this.refs),e}merge(e,r){let n=this.clone();return e.list.forEach(i=>n.add(i)),e.refs.forEach(i=>n.add(i)),r.list.forEach(i=>n.delete(i)),r.refs.forEach(i=>n.delete(i)),n}};function dt(){return dt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},dt.apply(this,arguments)}var fe=class{constructor(e){this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this._typeError=void 0,this._whitelist=new Sr,this._blacklist=new Sr,this.exclusiveTests=Object.create(null),this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(_r.notType)}),this.type=(e==null?void 0:e.type)||"mixed",this.spec=dt({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},e==null?void 0:e.spec)}get _type(){return this.type}_typeCheck(e){return!0}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;let r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeError=this._typeError,r._whitelistError=this._whitelistError,r._blacklistError=this._blacklistError,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.exclusiveTests=dt({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=Rs(dt({},this.spec,e)),r}label(e){let r=this.clone();return r.spec.label=e,r}meta(...e){if(e.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},e[0]),r}withMutation(e){let r=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=r,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let r=this,n=e.clone(),i=dt({},r.spec,n.spec);return n.spec=i,n._typeError||(n._typeError=r._typeError),n._whitelistError||(n._whitelistError=r._whitelistError),n._blacklistError||(n._blacklistError=r._blacklistError),n._whitelist=r._whitelist.merge(e._whitelist,e._blacklist),n._blacklist=r._blacklist.merge(e._blacklist,e._whitelist),n.tests=r.tests,n.exclusiveTests=r.exclusiveTests,n.withMutation(s=>{e.tests.forEach(a=>{s.test(a.OPTIONS)})}),n.transforms=[...r.transforms,...n.transforms],n}isType(e){return this.spec.nullable&&e===null?!0:this._typeCheck(e)}resolve(e){let r=this;if(r.conditions.length){let n=r.conditions;r=r.clone(),r.conditions=[],r=n.reduce((i,s)=>s.resolve(i,e),r),r=r.resolve(e)}return r}cast(e,r={}){let n=this.resolve(dt({value:e},r)),i=n._cast(e,r);if(e!==void 0&&r.assert!==!1&&n.isType(i)!==!0){let s=St(e),a=St(i);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n._type}".
85
+ `)};var YI=1e3*1e3*100,KI=({env:t,extendEnv:e,preferLocal:r,localDir:n,execPath:i})=>{let s=e?{...Ss.default.env,...t}:t;return r?Ob({env:s,cwd:n,execPath:i}):s},y_=(t,e,r={})=>{let n=g_.default._parse(t,e,r);return t=n.command,e=n.args,r=n.options,r={maxBuffer:YI,buffer:!0,stripFinalNewline:!0,extendEnv:!0,preferLocal:!1,localDir:r.cwd||Ss.default.cwd(),execPath:Ss.default.execPath,encoding:"utf8",reject:!0,cleanup:!0,all:!1,windowsHide:!0,verbose:d_,...r},r.env=KI(r),r.stdio=Ub(r),Ss.default.platform==="win32"&&m_.default.basename(t,".exe")==="cmd"&&e.unshift("/q"),{file:t,args:e,options:r,parsed:n}},xs=(t,e,r)=>typeof e!="string"&&!D_.Buffer.isBuffer(e)?r===void 0?void 0:"":t.stripFinalNewline?Of(e):e;function ws(t,e,r){let n=y_(t,e,r),i=$f(t,e),s=Hf(t,e);jf(s,n.options),Yb(n.options);let a;try{a=Wu.default.spawn(n.file,n.args,n.options)}catch(F){let C=new Wu.default.ChildProcess,R=Promise.reject(Fs({error:F,stdout:"",stderr:"",all:"",command:i,escapedCommand:s,parsed:n,timedOut:!1,isCanceled:!1,killed:!1}));return Mf(C,R),C}let f=s_(a),c=Vb(a,n.options,f),h=Kb(a,n.options,c),D={isCanceled:!1};a.kill=zb.bind(null,a.kill.bind(a)),a.cancel=Gb.bind(null,a,D);let _=Ib(async()=>{let[{error:F,exitCode:C,signal:R,timedOut:P},q,H,j]=await i_(a,n.options,h),v=xs(n.options,q),N=xs(n.options,H),T=xs(n.options,j);if(F||C!==0||R!==null){let $=Fs({error:F,exitCode:C,signal:R,stdout:v,stderr:N,all:T,command:i,escapedCommand:s,parsed:n,timedOut:P,isCanceled:D.isCanceled||(n.options.signal?n.options.signal.aborted:!1),killed:a.killed});if(!n.options.reject)return $;throw $}return{command:i,escapedCommand:s,exitCode:0,stdout:v,stderr:N,all:T,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}});return r_(a,n.options),a.all=n_(a,n.options),Xb(a),Mf(a,_),a}function QI(t,e,r){let n=y_(t,e,r),i=$f(t,e),s=Hf(t,e);jf(s,n.options);let a=t_(n.options),f;try{f=Wu.default.spawnSync(n.file,n.args,{...n.options,input:a})}catch(D){throw Fs({error:D,stdout:"",stderr:"",all:"",command:i,escapedCommand:s,parsed:n,timedOut:!1,isCanceled:!1,killed:!1})}let c=xs(n.options,f.stdout,f.error),h=xs(n.options,f.stderr,f.error);if(f.error||f.status!==0||f.signal!==null){let D=Fs({stdout:c,stderr:h,error:f.error,signal:f.signal,exitCode:f.status,command:i,escapedCommand:s,parsed:n,timedOut:f.error&&f.error.code==="ETIMEDOUT",isCanceled:!1,killed:f.signal!==null});if(!n.options.reject)return D;throw D}return{command:i,escapedCommand:s,exitCode:0,stdout:c,stderr:h,failed:!1,timedOut:!1,isCanceled:!1,killed:!1}}var ZI=({input:t,inputFile:e,stdio:r})=>t===void 0&&e===void 0&&r===void 0?{stdin:"inherit"}:{},p_=(t={})=>({preferLocal:!0,...ZI(t),...t});function b_(t){function e(r,...n){if(!Array.isArray(r))return b_({...t,...r});let[i,...s]=Uf(r,n);return ws(i,s,p_(t))}return e.sync=(r,...n)=>{if(!Array.isArray(r))throw new TypeError("Please use $(options).sync`command` instead of $.sync(options)`command`.");let[i,...s]=Uf(r,n);return QI(i,s,p_(t))},e}var VZ=b_();u();var XI={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"}},zu=class extends Error{};async function Wf(t=ws){let e=await t("reg",["QUERY"," HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice","/v","ProgId"]),r=/ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(e.stdout);if(!r)throw new zu(`Cannot find Windows browser in stdout: ${JSON.stringify(e.stdout)}`);let{id:n}=r.groups,i=XI[n];if(!i)throw new zu(`Unknown browser ID: ${n}`);return i}async function zf(){if(Gu.default.platform==="linux"){let{stdout:t}=await ws("xdg-mime",["query","default","x-scheme-handler/http"]);return{name:Rf(t.trim().replace(/.desktop$/,"").replace("-"," ")),id:t}}if(Gu.default.platform==="darwin"){let t=await sf();return{name:await Tf(t),id:t}}if(Gu.default.platform==="win32")return Wf();throw new Error("Only macOS, Linux, and Windows are supported")}u();var __=M(require("fs"),1);u();var Vf=M(require("fs"),1),Gf;function JI(){try{return Vf.default.statSync("/.dockerenv"),!0}catch{return!1}}function e6(){try{return Vf.default.readFileSync("/proc/self/cgroup","utf8").includes("docker")}catch{return!1}}function Yf(){return Gf===void 0&&(Gf=JI()||e6()),Gf}var Kf,t6=()=>{try{return __.default.statSync("/run/.containerenv"),!0}catch{return!1}};function Qf(){return Kf===void 0&&(Kf=t6()||Yf()),Kf}var Zf=Xf.default.dirname((0,w_.fileURLToPath)(importMetaUrl)),E_=Xf.default.join(Zf,"xdg-open"),{platform:Zn,arch:C_}=Yu.default,r6=(()=>{let t="/mnt/",e;return async function(){if(e)return e;let r="/etc/wsl.conf",n=!1;try{await Ku.default.access(r,Jf.constants.F_OK),n=!0}catch{}if(!n)return t;let i=await Ku.default.readFile(r,{encoding:"utf8"}),s=/(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(i);return s?(e=s.groups.mountPoint.trim(),e=e.endsWith("/")?e:`${e}/`,e):t}})(),F_=async(t,e)=>{let r;for(let n of t)try{return await e(n)}catch(i){r=i}throw r},Vu=async t=>{if(t={wait:!1,background:!1,newInstance:!1,allowNonzeroExitCode:!1,...t},Array.isArray(t.app))return F_(t.app,f=>Vu({...t,app:f}));let{name:e,arguments:r=[]}=t.app??{};if(r=[...r],Array.isArray(e))return F_(e,f=>Vu({...t,app:{name:f,arguments:r}}));if(e==="browser"||e==="browserPrivate"){let f={"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"},h=await zf();if(h.id in f){let D=f[h.id];return e==="browserPrivate"&&r.push(c[D]),Vu({...t,app:{name:Xn[D],arguments:r}})}throw new Error(`${h.name} is not supported as a default browser`)}let n,i=[],s={};if(Zn==="darwin")n="open",t.wait&&i.push("--wait-apps"),t.background&&i.push("--background"),t.newInstance&&i.push("--new"),e&&i.push("-a",e);else if(Zn==="win32"||As.default&&!Qf()&&!e){let f=await r6();n=As.default?`${f}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`:`${Yu.default.env.SYSTEMROOT}\\System32\\WindowsPowerShell\\v1.0\\powershell`,i.push("-NoProfile","-NonInteractive","-ExecutionPolicy","Bypass","-EncodedCommand"),As.default||(s.windowsVerbatimArguments=!0);let c=["Start"];t.wait&&c.push("-Wait"),e?(c.push(`"\`"${e}\`""`),t.target&&r.push(t.target)):t.target&&c.push(`"${t.target}"`),r.length>0&&(r=r.map(h=>`"\`"${h}\`""`),c.push("-ArgumentList",r.join(","))),t.target=x_.Buffer.from(c.join(" "),"utf16le").toString("base64")}else{if(e)n=e;else{let f=!Zf||Zf==="/",c=!1;try{await Ku.default.access(E_,Jf.constants.X_OK),c=!0}catch{}n=Yu.default.versions.electron??(Zn==="android"||f||!c)?"xdg-open":E_}r.length>0&&i.push(...r),t.wait||(s.stdio="ignore",s.detached=!0)}t.target&&i.push(t.target),Zn==="darwin"&&r.length>0&&i.push("--args",...r);let a=A_.default.spawn(n,i,s);return t.wait?new Promise((f,c)=>{a.once("error",c),a.once("close",h=>{if(!t.allowNonzeroExitCode&&h>0){c(new Error(`Exited with code ${h}`));return}f(a)})}):(a.unref(),a)},n6=(t,e)=>{if(typeof t!="string")throw new TypeError("Expected a `target`");return Vu({...e,target:t})};function S_(t){if(typeof t=="string"||Array.isArray(t))return t;let{[C_]:e}=t;if(!e)throw new Error(`${C_} is not supported`);return e}function eh({[Zn]:t},{wsl:e}){if(e&&As.default)return S_(e);if(!t)throw new Error(`${Zn} is not supported`);return S_(t)}var Xn={};Yr(Xn,"chrome",()=>eh({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"]}}));Yr(Xn,"firefox",()=>eh({darwin:"firefox",win32:"C:\\Program Files\\Mozilla Firefox\\firefox.exe",linux:"firefox"},{wsl:"/mnt/c/Program Files/Mozilla Firefox/firefox.exe"}));Yr(Xn,"edge",()=>eh({darwin:"microsoft edge",win32:"msedge",linux:["microsoft-edge","microsoft-edge-dev"]},{wsl:"/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"}));Yr(Xn,"browser",()=>"browser");Yr(Xn,"browserPrivate",()=>"browserPrivate");var v_=n6;var B_=M(R_());var ih=M(require("path")),I_=M(require("os")),Zr=M(require("fs")),P_=M(require("http"));var th={};np(th,{author:()=>d6,bin:()=>E6,bugs:()=>p6,default:()=>nh,dependencies:()=>C6,description:()=>c6,devDependencies:()=>b6,engines:()=>F6,files:()=>_6,homepage:()=>f6,license:()=>h6,name:()=>l6,publishConfig:()=>m6,repository:()=>D6,scripts:()=>y6,sideEffects:()=>g6,version:()=>rh});var l6="@e2b/cli",rh="0.0.2",c6="CLI for managing e2b environments",f6="https://usedevbook.com",h6="SEE LICENSE IN LICENSE",d6={name:"FoundryLabs, Inc.",email:"hello@e2b.dev",url:"https://e2b.dev"},p6="https://github.com/e2b-dev/e2b/issues",D6={type:"git",url:"https://github.com/e2b-dev/e2b/tree/main/packages/cli"},m6={access:"public"},g6=!1,y6={prepublishOnly:"pnpm build",build:"rm -rf ./dist && tsup --minify",dev:"tsup --watch",fix:"npx eslint **/src/**/*.{ts,js} --fix",format:"prettier --check --ignore-path .gitignore .","format:fix":"prettier --write --ignore-path .gitignore ."},b6={"@trivago/prettier-plugin-sort-imports":"^3.3.0","@types/common-tags":"^1.8.2","@types/inquirer":"^8.0.0","@types/node":"16.11","@types/node-fetch":"^2.6.5","@types/parse-gitignore":"^1.0.0","@types/update-notifier":"5.1.0","@typescript-eslint/eslint-plugin":"^5.38.1","@typescript-eslint/parser":"^5.38.1",eslint:"^8.24.0","eslint-config-prettier":"^8.5.0","eslint-plugin-prettier":"^4.2.1","eslint-plugin-unused-imports":"^2.0.0",prettier:"^2.7.1",tsup:"^6.5.0",typescript:"^4.9.3"},_6=["dist","LICENSE","README","package.json"],E6={e2b:"dist/index.js"},C6={"@devbookhq/sdk":"^2.6.88","@e2b/sdk":"file:../js-sdk/dist","@iarna/toml":"^2.2.5","@nodelib/fs.walk":"^1.2.8","@types/tar-fs":"^2.0.2","@zeit/dockerignore":"^0.0.5","async-listen":"^3.0.1",boxen:"^7.0.0",chalk:"^5.1.2",chokidar:"^3.5.3",commander:"^9.4.1","common-tags":"^1.8.2","docker-names":"^1.2.1","get-port":"^7.0.0",ignore:"^5.2.4",inquirer:"^8.0.0","node-fetch":"^3.3.2",open:"^9.1.0","parse-gitignore":"^2.0.0","tar-fs":"^3.0.4","update-notifier":"5.1.0",yup:"^0.32.11"},F6={node:">=16"},nh={name:l6,version:rh,description:c6,homepage:f6,license:h6,author:d6,bugs:p6,repository:D6,publishConfig:m6,sideEffects:g6,scripts:y6,devDependencies:b6,files:_6,bin:E6,dependencies:C6,engines:F6};var Jn=ih.default.join(I_.homedir(),".e2b","config.json"),O_=process.env.E2B_DOCS_BASE||"https://e2b.dev/docs",L_=new yt("login").description("Login to e2b").action(async()=>{let t;try{t=sh()}catch(e){console.error(Hn("Failed to read user config",e))}if(t){console.log(`Already logged in as ${Vt(t.email)}, if you want to login as a different user, logout first.`);return}else if(!t){if(console.log("Attempting to login..."),t=await S6(),!t){console.info("Login aborted");return}Zr.default.mkdirSync(ih.default.dirname(Jn),{recursive:!0}),Zr.default.writeFileSync(Jn,JSON.stringify(t,null,2))}console.log(`Logged in as ${Vt(t.email)}`),process.exit(0)}),k_=new yt("logout").description("Logout of e2b").action(()=>{Zr.default.existsSync(Jn)?(Zr.default.unlinkSync(Jn),console.log("Logged out.")):console.log("Not logged in, nothing to do")});function sh(){return Zr.default.existsSync(Jn)?JSON.parse(Zr.default.readFileSync(Jn,"utf8")):null}async function S6(){let t=P_.default.createServer(),{port:e}=await(0,B_.listen)(t,0,"127.0.0.1"),r=new URL(`${O_}/api/cli`);return r.searchParams.set("next",`http://localhost:${e}`),r.searchParams.set("cliVersion",nh.version),new Promise((n,i)=>(t.once("request",(s,a)=>{a.setHeader("connection","close");let f=new URL(`${O_}/api/cli`),c=new URL(s.url||"/","http://localhost").searchParams,h=Object.fromEntries(c.entries()),{error:D}=h;D?(i(new Error(D)),f.searchParams.set("state","error"),f.searchParams.set("error",D)):(n(h),f.searchParams.set("state","success"),f.searchParams.set("email",h.email)),a.statusCode=302,a.setHeader("location",f.href),a.end()}),v_(r.toString())))}var Ts=process.env.E2B_API_BASE??"http://localhost:3003",xX=process.env.E2B_API_KEY,Qu=process.env.E2B_ACCESS_TOKEN,x6=Ol(`You must be logged in to use this command. Run ${Vt("e2b login")}.`,{width:70,float:"center",padding:.5,margin:1,borderStyle:"round",borderColor:"redBright"});function Zu(){if(!Qu){let t=sh();Qu=t==null?void 0:t.accessToken}if(!Qu)console.error(x6),process.exit(1);else return Qu}u();u();u();u();u();var oh;try{oh=Map}catch{}var uh;try{uh=Set}catch{}function N_(t,e,r){if(!t||typeof t!="object"||typeof t=="function")return t;if(t.nodeType&&"cloneNode"in t)return t.cloneNode(!0);if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp)return new RegExp(t);if(Array.isArray(t))return t.map(Rs);if(oh&&t instanceof oh)return new Map(Array.from(t.entries()));if(uh&&t instanceof uh)return new Set(Array.from(t.values()));if(t instanceof Object){e.push(t);var n=Object.create(t);r.push(n);for(var i in t){var s=e.findIndex(function(a){return a===t[i]});n[i]=s>-1?r[s]:N_(t[i],e,r)}return n}return t}function Rs(t){return N_(t,[],[])}u();u();var w6=Object.prototype.toString,A6=Error.prototype.toString,v6=RegExp.prototype.toString,T6=typeof Symbol<"u"?Symbol.prototype.toString:()=>"",R6=/^Symbol\((.*)\)(.*)$/;function O6(t){return t!=+t?"NaN":t===0&&1/t<0?"-0":""+t}function q_(t,e=!1){if(t==null||t===!0||t===!1)return""+t;let r=typeof t;if(r==="number")return O6(t);if(r==="string")return e?`"${t}"`:t;if(r==="function")return"[Function "+(t.name||"anonymous")+"]";if(r==="symbol")return T6.call(t).replace(R6,"Symbol($1)");let n=w6.call(t).slice(8,-1);return n==="Date"?isNaN(t.getTime())?""+t:t.toISOString(t):n==="Error"||t instanceof Error?"["+A6.call(t)+"]":n==="RegExp"?v6.call(t):null}function St(t,e){let r=q_(t,e);return r!==null?r:JSON.stringify(t,function(n,i){let s=q_(this[n],e);return s!==null?s:i},2)}var _r={default:"${path} is invalid",required:"${path} is a required field",oneOf:"${path} must be one of the following values: ${values}",notOneOf:"${path} must not be one of the following values: ${values}",notType:({path:t,type:e,value:r,originalValue:n})=>{let i=n!=null&&n!==r,s=`${t} must be a \`${e}\` type, but the final value was: \`${St(r,!0)}\``+(i?` (cast from the value \`${St(n,!0)}\`).`:".");return r===null&&(s+='\n If "null" is intended as an empty value be sure to mark the schema as `.nullable()`'),s},defined:"${path} must be defined"},ht={length:"${path} must be exactly ${length} characters",min:"${path} must be at least ${min} characters",max:"${path} must be at most ${max} characters",matches:'${path} must match the following: "${regex}"',email:"${path} must be a valid email",url:"${path} must be a valid URL",uuid:"${path} must be a valid UUID",trim:"${path} must be a trimmed string",lowercase:"${path} must be a lowercase string",uppercase:"${path} must be a upper case string"},Yt={min:"${path} must be greater than or equal to ${min}",max:"${path} must be less than or equal to ${max}",lessThan:"${path} must be less than ${less}",moreThan:"${path} must be greater than ${more}",positive:"${path} must be a positive number",negative:"${path} must be a negative number",integer:"${path} must be an integer"},Xu={min:"${path} field must be later than ${min}",max:"${path} field must be at earlier than ${max}"},Ju={isValue:"${path} field must be ${value}"},ea={noUnknown:"${path} field has unspecified keys: ${unknown}"},Os={min:"${path} field must have at least ${min} items",max:"${path} field must have less than or equal to ${max} items",length:"${path} must have ${length} items"},B6=Object.assign(Object.create(null),{mixed:_r,string:ht,number:Yt,date:Xu,object:ea,array:Os,boolean:Ju});u();var BC=M(ua());u();var $k=t=>t&&t.__isYupSchema__,Cr=$k;var yh=class{constructor(e,r){if(this.fn=void 0,this.refs=e,this.refs=e,typeof r=="function"){this.fn=r;return}if(!(0,BC.default)(r,"is"))throw new TypeError("`is:` is required for `when()` conditions");if(!r.then&&!r.otherwise)throw new TypeError("either `then:` or `otherwise:` is required for `when()` conditions");let{is:n,then:i,otherwise:s}=r,a=typeof n=="function"?n:(...f)=>f.every(c=>c===n);this.fn=function(...f){let c=f.pop(),h=f.pop(),D=a(...f)?i:s;if(D)return typeof D=="function"?D(h):h.concat(D.resolve(c))}}resolve(e,r){let n=this.refs.map(s=>s.getValue(r==null?void 0:r.value,r==null?void 0:r.parent,r==null?void 0:r.context)),i=this.fn.apply(e,n.concat(e,r));if(i===void 0||i===e)return e;if(!Cr(i))throw new TypeError("conditions must return a schema object");return i.resolve(r)}},IC=yh;u();u();u();function Ms(t){return t==null?[]:[].concat(t)}function bh(){return bh=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},bh.apply(this,arguments)}var Hk=/\$\{\s*(\w+)\s*\}/g,Se=class extends Error{static formatError(e,r){let n=r.label||r.path||"this";return n!==r.path&&(r=bh({},r,{path:n})),typeof e=="string"?e.replace(Hk,(i,s)=>St(r[s])):typeof e=="function"?e(r):e}static isError(e){return e&&e.name==="ValidationError"}constructor(e,r,n,i){super(),this.value=void 0,this.path=void 0,this.type=void 0,this.errors=void 0,this.params=void 0,this.inner=void 0,this.name="ValidationError",this.value=r,this.path=n,this.type=i,this.errors=[],this.inner=[],Ms(e).forEach(s=>{Se.isError(s)?(this.errors.push(...s.errors),this.inner=this.inner.concat(s.inner.length?s.inner:s)):this.errors.push(s)}),this.message=this.errors.length>1?`${this.errors.length} errors occurred`:this.errors[0],Error.captureStackTrace&&Error.captureStackTrace(this,Se)}};var Uk=t=>{let e=!1;return(...r)=>{e||(e=!0,t(...r))}};function Fr(t,e){let{endEarly:r,tests:n,args:i,value:s,errors:a,sort:f,path:c}=t,h=Uk(e),D=n.length,y=[];if(a=a||[],!D)return a.length?h(new Se(a,s,c)):h(null,s);for(let _=0;_<n.length;_++){let F=n[_];F(i,function(R){if(R){if(!Se.isError(R))return h(R,s);if(r)return R.value=s,h(R,s);y.push(R)}if(--D<=0){if(y.length&&(f&&y.sort(f),a.length&&y.push(...a),a=y),a.length){h(new Se(a,s,c),s);return}h(null,s)}})}}u();var bx=M(Mh());u();var yx=M(js()),fa={context:"$",value:"."};var $e=class{constructor(e,r={}){if(this.key=void 0,this.isContext=void 0,this.isValue=void 0,this.isSibling=void 0,this.path=void 0,this.getter=void 0,this.map=void 0,typeof e!="string")throw new TypeError("ref must be a string, got: "+e);if(this.key=e.trim(),e==="")throw new TypeError("ref must be a non-empty string");this.isContext=this.key[0]===fa.context,this.isValue=this.key[0]===fa.value,this.isSibling=!this.isContext&&!this.isValue;let n=this.isContext?fa.context:this.isValue?fa.value:"";this.path=this.key.slice(n.length),this.getter=this.path&&(0,yx.getter)(this.path,!0),this.map=r.map}getValue(e,r,n){let i=this.isContext?n:this.isValue?e:r;return this.getter&&(i=this.getter(i||{})),this.map&&(i=this.map(i)),i}cast(e,r){return this.getValue(e,r==null?void 0:r.parent,r==null?void 0:r.context)}resolve(){return this}describe(){return{type:"ref",key:this.key}}toString(){return`Ref(${this.key})`}static isRef(e){return e&&e.__isYupRef}};$e.prototype.__isYupRef=!0;function ha(){return ha=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},ha.apply(this,arguments)}function aM(t,e){if(t==null)return{};var r={},n=Object.keys(t),i,s;for(s=0;s<n.length;s++)i=n[s],!(e.indexOf(i)>=0)&&(r[i]=t[i]);return r}function ci(t){function e(r,n){let{value:i,path:s="",label:a,options:f,originalValue:c,sync:h}=r,D=aM(r,["value","path","label","options","originalValue","sync"]),{name:y,test:_,params:F,message:C}=t,{parent:R,context:P}=f;function q(T){return $e.isRef(T)?T.getValue(i,R,P):T}function H(T={}){let $=(0,bx.default)(ha({value:i,originalValue:c,label:a,path:T.path||s},F,T.params),q),re=new Se(Se.formatError(T.message||C,$),i,$.path,T.type||y);return re.params=$,re}let j=ha({path:s,parent:R,type:y,createError:H,resolve:q,options:f,originalValue:c},D);if(!h){try{Promise.resolve(_.call(j,i,j)).then(T=>{Se.isError(T)?n(T):T?n(null,T):n(H())}).catch(n)}catch(T){n(T)}return}let v;try{var N;if(v=_.call(j,i,j),typeof((N=v)==null?void 0:N.then)=="function")throw new Error(`Validation test of type: "${j.type}" returned a Promise during a synchronous validate. This test will finish after the validate call has returned`)}catch(T){n(T);return}Se.isError(v)?n(v):v?n(null,v):n(H())}return e.OPTIONS=t,e}u();var _x=M(js()),lM=t=>t.substr(0,t.length-1).substr(1);function Ex(t,e,r,n=r){let i,s,a;return e?((0,_x.forEach)(e,(f,c,h)=>{let D=c?lM(f):f;if(t=t.resolve({context:n,parent:i,value:r}),t.innerType){let y=h?parseInt(D,10):0;if(r&&y>=r.length)throw new Error(`Yup.reach cannot resolve an array item at index: ${f}, in the path: ${e}. because there is no value at that index. `);i=r,r=r&&r[y],t=t.innerType}if(!h){if(!t.fields||!t.fields[D])throw new Error(`The schema does not contain the path: ${e}. (failed at: ${a} which is a type: "${t._type}")`);i=r,r=r&&r[D],t=t.fields[D]}s=D,a=c?"["+f+"]":"."+f}),{schema:t,parent:i,parentPath:s}):{parent:i,parentPath:e,schema:t}}u();var Sr=class{constructor(){this.list=void 0,this.refs=void 0,this.list=new Set,this.refs=new Map}get size(){return this.list.size+this.refs.size}describe(){let e=[];for(let r of this.list)e.push(r);for(let[,r]of this.refs)e.push(r.describe());return e}toArray(){return Array.from(this.list).concat(Array.from(this.refs.values()))}resolveAll(e){return this.toArray().reduce((r,n)=>r.concat($e.isRef(n)?e(n):n),[])}add(e){$e.isRef(e)?this.refs.set(e.key,e):this.list.add(e)}delete(e){$e.isRef(e)?this.refs.delete(e.key):this.list.delete(e)}clone(){let e=new Sr;return e.list=new Set(this.list),e.refs=new Map(this.refs),e}merge(e,r){let n=this.clone();return e.list.forEach(i=>n.add(i)),e.refs.forEach(i=>n.add(i)),r.list.forEach(i=>n.delete(i)),r.refs.forEach(i=>n.delete(i)),n}};function dt(){return dt=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},dt.apply(this,arguments)}var fe=class{constructor(e){this.deps=[],this.tests=void 0,this.transforms=void 0,this.conditions=[],this._mutate=void 0,this._typeError=void 0,this._whitelist=new Sr,this._blacklist=new Sr,this.exclusiveTests=Object.create(null),this.spec=void 0,this.tests=[],this.transforms=[],this.withMutation(()=>{this.typeError(_r.notType)}),this.type=(e==null?void 0:e.type)||"mixed",this.spec=dt({strip:!1,strict:!1,abortEarly:!0,recursive:!0,nullable:!1,presence:"optional"},e==null?void 0:e.spec)}get _type(){return this.type}_typeCheck(e){return!0}clone(e){if(this._mutate)return e&&Object.assign(this.spec,e),this;let r=Object.create(Object.getPrototypeOf(this));return r.type=this.type,r._typeError=this._typeError,r._whitelistError=this._whitelistError,r._blacklistError=this._blacklistError,r._whitelist=this._whitelist.clone(),r._blacklist=this._blacklist.clone(),r.exclusiveTests=dt({},this.exclusiveTests),r.deps=[...this.deps],r.conditions=[...this.conditions],r.tests=[...this.tests],r.transforms=[...this.transforms],r.spec=Rs(dt({},this.spec,e)),r}label(e){let r=this.clone();return r.spec.label=e,r}meta(...e){if(e.length===0)return this.spec.meta;let r=this.clone();return r.spec.meta=Object.assign(r.spec.meta||{},e[0]),r}withMutation(e){let r=this._mutate;this._mutate=!0;let n=e(this);return this._mutate=r,n}concat(e){if(!e||e===this)return this;if(e.type!==this.type&&this.type!=="mixed")throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${e.type}`);let r=this,n=e.clone(),i=dt({},r.spec,n.spec);return n.spec=i,n._typeError||(n._typeError=r._typeError),n._whitelistError||(n._whitelistError=r._whitelistError),n._blacklistError||(n._blacklistError=r._blacklistError),n._whitelist=r._whitelist.merge(e._whitelist,e._blacklist),n._blacklist=r._blacklist.merge(e._blacklist,e._whitelist),n.tests=r.tests,n.exclusiveTests=r.exclusiveTests,n.withMutation(s=>{e.tests.forEach(a=>{s.test(a.OPTIONS)})}),n.transforms=[...r.transforms,...n.transforms],n}isType(e){return this.spec.nullable&&e===null?!0:this._typeCheck(e)}resolve(e){let r=this;if(r.conditions.length){let n=r.conditions;r=r.clone(),r.conditions=[],r=n.reduce((i,s)=>s.resolve(i,e),r),r=r.resolve(e)}return r}cast(e,r={}){let n=this.resolve(dt({value:e},r)),i=n._cast(e,r);if(e!==void 0&&r.assert!==!1&&n.isType(i)!==!0){let s=St(e),a=St(i);throw new TypeError(`The value of ${r.path||"field"} could not be cast to a value that satisfies the schema type: "${n._type}".
86
86
 
87
87
  attempted value: ${s}
88
88
  `+(a!==s?`result of cast: ${a}`:""))}return i}_cast(e,r){let n=e===void 0?e:this.transforms.reduce((i,s)=>s.call(this,i,e,this),e);return n===void 0&&(n=this.getDefault()),n}_validate(e,r={},n){let{sync:i,path:s,from:a=[],originalValue:f=e,strict:c=this.spec.strict,abortEarly:h=this.spec.abortEarly}=r,D=e;c||(D=this._cast(D,dt({assert:!1},r)));let y={value:D,path:s,options:r,originalValue:f,schema:this,label:this.spec.label,sync:i,from:a},_=[];this._typeError&&_.push(this._typeError);let F=[];this._whitelistError&&F.push(this._whitelistError),this._blacklistError&&F.push(this._blacklistError),Fr({args:y,value:D,path:s,sync:i,tests:_,endEarly:h},C=>{if(C)return void n(C,D);Fr({tests:this.tests.concat(F),args:y,path:s,sync:i,value:D,endEarly:h},n)})}validate(e,r,n){let i=this.resolve(dt({},r,{value:e}));return typeof n=="function"?i._validate(e,r,n):new Promise((s,a)=>i._validate(e,r,(f,c)=>{f?a(f):s(c)}))}validateSync(e,r){let n=this.resolve(dt({},r,{value:e})),i;return n._validate(e,dt({},r,{sync:!0}),(s,a)=>{if(s)throw s;i=a}),i}isValid(e,r){return this.validate(e,r).then(()=>!0,n=>{if(Se.isError(n))return!1;throw n})}isValidSync(e,r){try{return this.validateSync(e,r),!0}catch(n){if(Se.isError(n))return!1;throw n}}_getDefault(){let e=this.spec.default;return e==null?e:typeof e=="function"?e.call(this):Rs(e)}getDefault(e){return this.resolve(e||{})._getDefault()}default(e){return arguments.length===0?this._getDefault():this.clone({default:e})}strict(e=!0){let r=this.clone();return r.spec.strict=e,r}_isPresent(e){return e!=null}defined(e=_r.defined){return this.test({message:e,name:"defined",exclusive:!0,test(r){return r!==void 0}})}required(e=_r.required){return this.clone({presence:"required"}).withMutation(r=>r.test({message:e,name:"required",exclusive:!0,test(n){return this.schema._isPresent(n)}}))}notRequired(){let e=this.clone({presence:"optional"});return e.tests=e.tests.filter(r=>r.OPTIONS.name!=="required"),e}nullable(e=!0){return this.clone({nullable:e!==!1})}transform(e){let r=this.clone();return r.transforms.push(e),r}test(...e){let r;if(e.length===1?typeof e[0]=="function"?r={test:e[0]}:r=e[0]:e.length===2?r={name:e[0],test:e[1]}:r={name:e[0],message:e[1],test:e[2]},r.message===void 0&&(r.message=_r.default),typeof r.test!="function")throw new TypeError("`test` is a required parameters");let n=this.clone(),i=ci(r),s=r.exclusive||r.name&&n.exclusiveTests[r.name]===!0;if(r.exclusive&&!r.name)throw new TypeError("Exclusive tests must provide a unique `name` identifying the test");return r.name&&(n.exclusiveTests[r.name]=!!r.exclusive),n.tests=n.tests.filter(a=>!(a.OPTIONS.name===r.name&&(s||a.OPTIONS.test===i.OPTIONS.test))),n.tests.push(i),n}when(e,r){!Array.isArray(e)&&typeof e!="string"&&(r=e,e=".");let n=this.clone(),i=Ms(e).map(s=>new $e(s));return i.forEach(s=>{s.isSibling&&n.deps.push(s.key)}),n.conditions.push(new IC(i,r)),n}typeError(e){let r=this.clone();return r._typeError=ci({message:e,name:"typeError",test(n){return n!==void 0&&!this.schema.isType(n)?this.createError({params:{type:this.schema._type}}):!0}}),r}oneOf(e,r=_r.oneOf){let n=this.clone();return e.forEach(i=>{n._whitelist.add(i),n._blacklist.delete(i)}),n._whitelistError=ci({message:r,name:"oneOf",test(i){if(i===void 0)return!0;let s=this.schema._whitelist,a=s.resolveAll(this.resolve);return a.includes(i)?!0:this.createError({params:{values:s.toArray().join(", "),resolved:a}})}}),n}notOneOf(e,r=_r.notOneOf){let n=this.clone();return e.forEach(i=>{n._blacklist.add(i),n._whitelist.delete(i)}),n._blacklistError=ci({message:r,name:"notOneOf",test(i){let s=this.schema._blacklist,a=s.resolveAll(this.resolve);return a.includes(i)?this.createError({params:{values:s.toArray().join(", "),resolved:a}}):!0}}),n}strip(e=!0){let r=this.clone();return r.spec.strip=e,r}describe(){let e=this.clone(),{label:r,meta:n}=e.spec;return{meta:n,label:r,type:e.type,oneOf:e._whitelist.describe(),notOneOf:e._blacklist.describe(),tests:e.tests.map(s=>({name:s.OPTIONS.name,params:s.OPTIONS.params})).filter((s,a,f)=>f.findIndex(c=>c.name===s.name)===a)}}};fe.prototype.__isYupSchema__=!0;for(let t of["validate","validateSync"])fe.prototype[`${t}At`]=function(e,r,n={}){let{parent:i,parentPath:s,schema:a}=Ex(this,e,r,n.context);return a[t](i&&i[s],dt({},n,{parent:i,path:e}))};for(let t of["equals","is"])fe.prototype[t]=fe.prototype.oneOf;for(let t of["not","nope"])fe.prototype[t]=fe.prototype.notOneOf;fe.prototype.optional=fe.prototype.notRequired;var Cx=fe;function Fx(){return new Cx}Fx.prototype=Cx.prototype;u();u();var cM=t=>t==null,he=cM;function Sx(){return new fi}var fi=class extends fe{constructor(){super({type:"boolean"}),this.withMutation(()=>{this.transform(function(e){if(!this.isType(e)){if(/^(true|1)$/i.test(String(e)))return!0;if(/^(false|0)$/i.test(String(e)))return!1}return e})})}_typeCheck(e){return e instanceof Boolean&&(e=e.valueOf()),typeof e=="boolean"}isTrue(e=Ju.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"true"},test(r){return he(r)||r===!0}})}isFalse(e=Ju.isValue){return this.test({message:e,name:"is-value",exclusive:!0,params:{value:"false"},test(r){return he(r)||r===!1}})}};Sx.prototype=fi.prototype;u();var fM=/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i,hM=/^((https?|ftp):)?\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i,dM=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,pM=t=>he(t)||t===t.trim(),DM={}.toString();function Pt(){return new hi}var hi=class extends fe{constructor(){super({type:"string"}),this.withMutation(()=>{this.transform(function(e){if(this.isType(e)||Array.isArray(e))return e;let r=e!=null&&e.toString?e.toString():e;return r===DM?e:r})})}_typeCheck(e){return e instanceof String&&(e=e.valueOf()),typeof e=="string"}_isPresent(e){return super._isPresent(e)&&!!e.length}length(e,r=ht.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:e},test(n){return he(n)||n.length===this.resolve(e)}})}min(e,r=ht.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:e},test(n){return he(n)||n.length>=this.resolve(e)}})}max(e,r=ht.max){return this.test({name:"max",exclusive:!0,message:r,params:{max:e},test(n){return he(n)||n.length<=this.resolve(e)}})}matches(e,r){let n=!1,i,s;return r&&(typeof r=="object"?{excludeEmptyString:n=!1,message:i,name:s}=r:i=r),this.test({name:s||"matches",message:i||ht.matches,params:{regex:e},test:a=>he(a)||a===""&&n||a.search(e)!==-1})}email(e=ht.email){return this.matches(fM,{name:"email",message:e,excludeEmptyString:!0})}url(e=ht.url){return this.matches(hM,{name:"url",message:e,excludeEmptyString:!0})}uuid(e=ht.uuid){return this.matches(dM,{name:"uuid",message:e,excludeEmptyString:!1})}ensure(){return this.default("").transform(e=>e===null?"":e)}trim(e=ht.trim){return this.transform(r=>r!=null?r.trim():r).test({message:e,name:"trim",test:pM})}lowercase(e=ht.lowercase){return this.transform(r=>he(r)?r:r.toLowerCase()).test({message:e,name:"string_case",exclusive:!0,test:r=>he(r)||r===r.toLowerCase()})}uppercase(e=ht.uppercase){return this.transform(r=>he(r)?r:r.toUpperCase()).test({message:e,name:"string_case",exclusive:!0,test:r=>he(r)||r===r.toUpperCase()})}};Pt.prototype=hi.prototype;u();var mM=t=>t!=+t;function xx(){return new di}var di=class extends fe{constructor(){super({type:"number"}),this.withMutation(()=>{this.transform(function(e){let r=e;if(typeof r=="string"){if(r=r.replace(/\s/g,""),r==="")return NaN;r=+r}return this.isType(r)?r:parseFloat(r)})})}_typeCheck(e){return e instanceof Number&&(e=e.valueOf()),typeof e=="number"&&!mM(e)}min(e,r=Yt.min){return this.test({message:r,name:"min",exclusive:!0,params:{min:e},test(n){return he(n)||n>=this.resolve(e)}})}max(e,r=Yt.max){return this.test({message:r,name:"max",exclusive:!0,params:{max:e},test(n){return he(n)||n<=this.resolve(e)}})}lessThan(e,r=Yt.lessThan){return this.test({message:r,name:"max",exclusive:!0,params:{less:e},test(n){return he(n)||n<this.resolve(e)}})}moreThan(e,r=Yt.moreThan){return this.test({message:r,name:"min",exclusive:!0,params:{more:e},test(n){return he(n)||n>this.resolve(e)}})}positive(e=Yt.positive){return this.moreThan(0,e)}negative(e=Yt.negative){return this.lessThan(0,e)}integer(e=Yt.integer){return this.test({name:"integer",message:e,test:r=>he(r)||Number.isInteger(r)})}truncate(){return this.transform(e=>he(e)?e:e|0)}round(e){var r;let n=["ceil","floor","round","trunc"];if(e=((r=e)==null?void 0:r.toLowerCase())||"round",e==="trunc")return this.truncate();if(n.indexOf(e.toLowerCase())===-1)throw new TypeError("Only valid options for round() are: "+n.join(", "));return this.transform(i=>he(i)?i:Math[e](i))}};xx.prototype=di.prototype;u();u();var gM=/^(\d{4}|[+\-]\d{6})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:[ T]?(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;function Wh(t){var e=[1,4,5,6,7,10,11],r=0,n,i;if(i=gM.exec(t)){for(var s=0,a;a=e[s];++s)i[a]=+i[a]||0;i[2]=(+i[2]||1)-1,i[3]=+i[3]||1,i[7]=i[7]?String(i[7]).substr(0,3):0,(i[8]===void 0||i[8]==="")&&(i[9]===void 0||i[9]==="")?n=+new Date(i[1],i[2],i[3],i[4],i[5],i[6],i[7]):(i[8]!=="Z"&&i[9]!==void 0&&(r=i[10]*60+i[11],i[9]==="+"&&(r=0-r)),n=Date.UTC(i[1],i[2],i[3],i[4],i[5]+r,i[6],i[7]))}else n=Date.parse?Date.parse(t):NaN;return n}var zh=new Date(""),yM=t=>Object.prototype.toString.call(t)==="[object Date]";function Gh(){return new en}var en=class extends fe{constructor(){super({type:"date"}),this.withMutation(()=>{this.transform(function(e){return this.isType(e)?e:(e=Wh(e),isNaN(e)?zh:new Date(e))})})}_typeCheck(e){return yM(e)&&!isNaN(e.getTime())}prepareParam(e,r){let n;if($e.isRef(e))n=e;else{let i=this.cast(e);if(!this._typeCheck(i))throw new TypeError(`\`${r}\` must be a Date or a value that can be \`cast()\` to a Date`);n=i}return n}min(e,r=Xu.min){let n=this.prepareParam(e,"min");return this.test({message:r,name:"min",exclusive:!0,params:{min:e},test(i){return he(i)||i>=this.resolve(n)}})}max(e,r=Xu.max){let n=this.prepareParam(e,"max");return this.test({message:r,name:"max",exclusive:!0,params:{max:e},test(i){return he(i)||i<=this.resolve(n)}})}};en.INVALID_DATE=zh;Gh.prototype=en.prototype;Gh.INVALID_DATE=zh;u();var Jh=M(ua()),ed=M(uw()),Uw=M(Bw()),jw=M(Pw()),Ww=M(Mh()),zw=M(js());u();var Nw=M(ua()),qw=M(kw()),Mw=M(js());function Xh(t,e=[]){let r=[],n=new Set,i=new Set(e.map(([a,f])=>`${a}-${f}`));function s(a,f){let c=(0,Mw.split)(a)[0];n.add(c),i.has(`${f}-${c}`)||r.push([f,c])}for(let a in t)if((0,Nw.default)(t,a)){let f=t[a];n.add(a),$e.isRef(f)&&f.isSibling?s(f.path,a):Cr(f)&&"deps"in f&&f.deps.forEach(c=>s(c,a))}return qw.default.array(Array.from(n),r).reverse()}u();function $w(t,e){let r=1/0;return t.some((n,i)=>{var s;if(((s=e.path)==null?void 0:s.indexOf(n))!==-1)return r=i,!0}),r}function da(t){return(e,r)=>$w(t,e)-$w(t,r)}function Di(){return Di=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},Di.apply(this,arguments)}var Hw=t=>Object.prototype.toString.call(t)==="[object Object]";function m$(t,e){let r=Object.keys(t.fields);return Object.keys(e).filter(n=>r.indexOf(n)===-1)}var g$=da([]),mi=class extends fe{constructor(e){super({type:"object"}),this.fields=Object.create(null),this._sortErrors=g$,this._nodes=[],this._excludedEdges=[],this.withMutation(()=>{this.transform(function(n){if(typeof n=="string")try{n=JSON.parse(n)}catch{n=null}return this.isType(n)?n:null}),e&&this.shape(e)})}_typeCheck(e){return Hw(e)||typeof e=="function"}_cast(e,r={}){var n;let i=super._cast(e,r);if(i===void 0)return this.getDefault();if(!this._typeCheck(i))return i;let s=this.fields,a=(n=r.stripUnknown)!=null?n:this.spec.noUnknown,f=this._nodes.concat(Object.keys(i).filter(y=>this._nodes.indexOf(y)===-1)),c={},h=Di({},r,{parent:c,__validating:r.__validating||!1}),D=!1;for(let y of f){let _=s[y],F=(0,Jh.default)(i,y);if(_){let C,R=i[y];h.path=(r.path?`${r.path}.`:"")+y,_=_.resolve({value:R,context:r.context,parent:c});let P="spec"in _?_.spec:void 0,q=P==null?void 0:P.strict;if(P!=null&&P.strip){D=D||y in i;continue}C=!r.__validating||!q?_.cast(i[y],h):i[y],C!==void 0&&(c[y]=C)}else F&&!a&&(c[y]=i[y]);c[y]!==i[y]&&(D=!0)}return D?c:i}_validate(e,r={},n){let i=[],{sync:s,from:a=[],originalValue:f=e,abortEarly:c=this.spec.abortEarly,recursive:h=this.spec.recursive}=r;a=[{schema:this,value:f},...a],r.__validating=!0,r.originalValue=f,r.from=a,super._validate(e,r,(D,y)=>{if(D){if(!Se.isError(D)||c)return void n(D,y);i.push(D)}if(!h||!Hw(y)){n(i[0]||null,y);return}f=f||y;let _=this._nodes.map(F=>(C,R)=>{let P=F.indexOf(".")===-1?(r.path?`${r.path}.`:"")+F:`${r.path||""}["${F}"]`,q=this.fields[F];if(q&&"validate"in q){q.validate(y[F],Di({},r,{path:P,from:a,strict:!0,parent:y,originalValue:f[F]}),R);return}R(null)});Fr({sync:s,tests:_,value:y,errors:i,endEarly:c,sort:this._sortErrors,path:r.path},n)})}clone(e){let r=super.clone(e);return r.fields=Di({},this.fields),r._nodes=this._nodes,r._excludedEdges=this._excludedEdges,r._sortErrors=this._sortErrors,r}concat(e){let r=super.concat(e),n=r.fields;for(let[i,s]of Object.entries(this.fields)){let a=n[i];a===void 0?n[i]=s:a instanceof fe&&s instanceof fe&&(n[i]=s.concat(a))}return r.withMutation(()=>r.shape(n,this._excludedEdges))}getDefaultFromShape(){let e={};return this._nodes.forEach(r=>{let n=this.fields[r];e[r]="default"in n?n.getDefault():void 0}),e}_getDefault(){if("default"in this.spec)return super._getDefault();if(this._nodes.length)return this.getDefaultFromShape()}shape(e,r=[]){let n=this.clone(),i=Object.assign(n.fields,e);return n.fields=i,n._sortErrors=da(Object.keys(i)),r.length&&(Array.isArray(r[0])||(r=[r]),n._excludedEdges=[...n._excludedEdges,...r]),n._nodes=Xh(i,n._excludedEdges),n}pick(e){let r={};for(let n of e)this.fields[n]&&(r[n]=this.fields[n]);return this.clone().withMutation(n=>(n.fields={},n.shape(r)))}omit(e){let r=this.clone(),n=r.fields;r.fields={};for(let i of e)delete n[i];return r.withMutation(()=>r.shape(n))}from(e,r,n){let i=(0,zw.getter)(e,!0);return this.transform(s=>{if(s==null)return s;let a=s;return(0,Jh.default)(s,e)&&(a=Di({},s),n||delete a[e],a[r]=i(s)),a})}noUnknown(e=!0,r=ea.noUnknown){typeof e=="string"&&(r=e,e=!0);let n=this.test({name:"noUnknown",exclusive:!0,message:r,test(i){if(i==null)return!0;let s=m$(this.schema,i);return!e||s.length===0||this.createError({params:{unknown:s.join(", ")}})}});return n.spec.noUnknown=e,n}unknown(e=!0,r=ea.noUnknown){return this.noUnknown(!e,r)}transformKeys(e){return this.transform(r=>r&&(0,jw.default)(r,(n,i)=>e(i)))}camelCase(){return this.transformKeys(Uw.default)}snakeCase(){return this.transformKeys(ed.default)}constantCase(){return this.transformKeys(e=>(0,ed.default)(e).toUpperCase())}describe(){let e=super.describe();return e.fields=(0,Ww.default)(this.fields,r=>r.describe()),e}};function tn(t){return new mi(t)}tn.prototype=mi.prototype;u();function pa(){return pa=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},pa.apply(this,arguments)}function Gw(t){return new gi(t)}var gi=class extends fe{constructor(e){super({type:"array"}),this.innerType=void 0,this.innerType=e,this.withMutation(()=>{this.transform(function(r){if(typeof r=="string")try{r=JSON.parse(r)}catch{r=null}return this.isType(r)?r:null})})}_typeCheck(e){return Array.isArray(e)}get _subType(){return this.innerType}_cast(e,r){let n=super._cast(e,r);if(!this._typeCheck(n)||!this.innerType)return n;let i=!1,s=n.map((a,f)=>{let c=this.innerType.cast(a,pa({},r,{path:`${r.path||""}[${f}]`}));return c!==a&&(i=!0),c});return i?s:n}_validate(e,r={},n){var i,s;let a=[],f=r.sync,c=r.path,h=this.innerType,D=(i=r.abortEarly)!=null?i:this.spec.abortEarly,y=(s=r.recursive)!=null?s:this.spec.recursive,_=r.originalValue!=null?r.originalValue:e;super._validate(e,r,(F,C)=>{if(F){if(!Se.isError(F)||D)return void n(F,C);a.push(F)}if(!y||!h||!this._typeCheck(C)){n(a[0]||null,C);return}_=_||C;let R=new Array(C.length);for(let P=0;P<C.length;P++){let q=C[P],H=`${r.path||""}[${P}]`,j=pa({},r,{path:H,strict:!0,parent:C,index:P,originalValue:_[P]});R[P]=(v,N)=>h.validate(q,j,N)}Fr({sync:f,path:c,value:C,errors:a,endEarly:D,tests:R},n)})}clone(e){let r=super.clone(e);return r.innerType=this.innerType,r}concat(e){let r=super.concat(e);return r.innerType=this.innerType,e.innerType&&(r.innerType=r.innerType?r.innerType.concat(e.innerType):e.innerType),r}of(e){let r=this.clone();if(!Cr(e))throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: "+St(e));return r.innerType=e,r}length(e,r=Os.length){return this.test({message:r,name:"length",exclusive:!0,params:{length:e},test(n){return he(n)||n.length===this.resolve(e)}})}min(e,r){return r=r||Os.min,this.test({message:r,name:"min",exclusive:!0,params:{min:e},test(n){return he(n)||n.length>=this.resolve(e)}})}max(e,r){return r=r||Os.max,this.test({message:r,name:"max",exclusive:!0,params:{max:e},test(n){return he(n)||n.length<=this.resolve(e)}})}ensure(){return this.default(()=>[]).transform((e,r)=>this._typeCheck(e)?e:r==null?[]:[].concat(r))}compact(e){let r=e?(n,i,s)=>!e(n,i,s):n=>!!n;return this.transform(n=>n!=null?n.filter(r):n)}describe(){let e=super.describe();return this.innerType&&(e.innerType=this.innerType.describe()),e}nullable(e=!0){return super.nullable(e)}defined(){return super.defined()}required(e){return super.required(e)}};Gw.prototype=gi.prototype;u();u();var TA=M(SA());var z$=vA(),RA="e2b.json";function G$(){return z$.getRandomName().replace("_","-")}var koe=tn({id:Pt().required(),template:Pt().required(),title:Pt().default(G$),filesystem:tn({change_hash:Pt(),local_root:Pt().required().default("./files")})});u();var Hoe=new Ni("-a, --all","Call this command in all subdirectories"),Uoe=new Ni("-s, --select","Select environment from interactive list"),joe=new Ni("-s, --select","Select environments from interactive list"),OA=new Ni("-p, --path <path>",`Call this command in ${Vt("<path>")} directory`);var BA=new yt("create").description(`Create new environment and ${Fu(RA)} config`).option("-id, --id <id>",`Use ${Vt("<id>")} to override already existing environment, otherwise new environment will be created`).option("--respect-gitignore","Respect .gitignore file in the root directory",!0).option("--respect-dockerignore","Respect .dockerignore file in the root directory",!0).addOption(OA).alias("cr").action(async t=>{try{let e=Zu();process.stdout.write(`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@e2b/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "CLI for managing e2b environments",
5
5
  "homepage": "https://usedevbook.com",
6
6
  "license": "SEE LICENSE IN LICENSE",