"use strict";exports.id=48899,exports.ids=[48899],exports.modules={348899:(a,b,c)=>{c.a(a,async(a,d)=>{try{c.d(b,{startTerminalServer:()=>function a(b){l||(k.__terminalWss=l=new e.WebSocketServer({port:b,host:"127.0.0.1"}),l.on("connection",i),l.on("listening",()=>{k.__terminalPort=b}),l.on("error",c=>{"EADDRINUSE"===c.code&&(console.warn(`[terminal] Port ${b} in use, retrying on ${b+1}`),l=null,k.__terminalWss=void 0,a(b+1))}))}});var e=c(156220),f=c(176760),g=c(973024),h=a([e]);e=(h.then?(await h)():h)[0];let j=new Map,k=globalThis,l=k.__terminalWss??null,m=k.__terminalDidFixSpawnHelper??!1;function i(a,b){a.on("message",b=>{!function(a,b){let d;try{d=JSON.parse(b)}catch{return}let e=j.get(a);switch(d.type){case"spawn":e&&(e.pty.kill(),j.delete(a)),function(a,b,d,e){let h,i;if(!m&&"win32"!==process.platform){m=!0,k.__terminalDidFixSpawnHelper=!0;try{let a=(0,f.dirname)(858428);for(let b of[(0,f.join)(a,"build","Release","spawn-helper"),(0,f.join)(a,"build","Debug","spawn-helper"),(0,f.join)(a,"prebuilds",`${process.platform}-${process.arch}`,"spawn-helper")])(0,g.existsSync)(b)&&(0,g.chmodSync)(b,493)}catch{}}try{h=c(314566)}catch{a.send(JSON.stringify({type:"exit",exitCode:1,signal:null}));return}let l="win32"===process.platform?process.env.ComSpec??"cmd.exe":process.env.SHELL??"/bin/zsh",n=e||process.env.HOME||process.cwd();try{i=h.spawn(l,function(a){let b=a.split("/").pop()?.toLowerCase()??"";return"win32"!==process.platform&&"zsh"===b?["-o","nopromptsp"]:[]}(l),{name:"xterm-256color",cols:b,rows:d,cwd:n,env:Object.fromEntries(Object.entries(process.env).filter(([,a])=>void 0!==a))})}catch{a.send(JSON.stringify({type:"exit",exitCode:1,signal:null}));return}let o={pty:i,ws:a};j.set(a,o),i.onData(b=>{a.readyState===a.OPEN&&a.send(JSON.stringify({type:"output",data:b}))}),i.onExit(({exitCode:b,signal:c})=>{a.readyState===a.OPEN&&a.send(JSON.stringify({type:"exit",exitCode:b,signal:c})),j.delete(a)}),a.send(JSON.stringify({type:"ready",pid:i.pid}))}(a,d.cols??80,d.rows??24,d.cwd);break;case"input":e&&d.data&&e.pty.write(d.data);break;case"resize":e&&d.cols&&d.rows&&e.pty.resize(d.cols,d.rows)}}(a,b.toString())}),a.on("close",()=>{let b=j.get(a);b&&(b.pty.kill(),j.delete(a))}),a.on("error",()=>{let b=j.get(a);b&&(b.pty.kill(),j.delete(a))})}d()}catch(a){d(a)}})},858428:a=>{a.exports={}}};