upfynai-code 3.0.2 → 3.0.4

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 (42) hide show
  1. package/client/dist/api-docs.html +838 -838
  2. package/client/dist/assets/{AppContent-Bvg0CPCO.js → AppContent-CwrTP6TW.js} +43 -43
  3. package/client/dist/assets/BrowserPanel-0TLEl-IC.js +2 -0
  4. package/client/dist/assets/{CanvasFullScreen-BdiJ35aq.js → CanvasFullScreen-D1GWQsGL.js} +1 -1
  5. package/client/dist/assets/{CanvasWorkspace-Bk9R9_e0.js → CanvasWorkspace-D7ORj358.js} +1 -1
  6. package/client/dist/assets/DashboardPanel-BV7ybUDe.js +1 -0
  7. package/client/dist/assets/FileTree-5qfhBqdE.js +1 -0
  8. package/client/dist/assets/{GitPanel-RtyZUIWS.js → GitPanel-C_xFM-N2.js} +1 -1
  9. package/client/dist/assets/{LoginModal-BWep8a6g.js → LoginModal-CImJHRjX.js} +3 -3
  10. package/client/dist/assets/{MarkdownPreview-DHmk3qzu.js → MarkdownPreview-CESjI261.js} +1 -1
  11. package/client/dist/assets/{MermaidBlock-BuBc_G-F.js → MermaidBlock-BFM21cwe.js} +2 -2
  12. package/client/dist/assets/Onboarding-B3cteLu2.js +1 -0
  13. package/client/dist/assets/SetupForm-P6dsYgHO.js +1 -0
  14. package/client/dist/assets/WorkflowsPanel-CBoN80kc.js +1 -0
  15. package/client/dist/assets/index-46kkVu2i.css +1 -0
  16. package/client/dist/assets/{index-C5ptjuTl.js → index-HaY-3pK1.js} +20 -20
  17. package/client/dist/assets/{vendor-canvas-D39yWul6.js → vendor-canvas-DvHJ_Pn2.js} +1 -1
  18. package/client/dist/assets/{vendor-codemirror-CbtmxxaB.js → vendor-codemirror-D2ALgpaX.js} +1 -1
  19. package/client/dist/assets/{vendor-icons-BaD0x9SL.js → vendor-icons-GyYE35HP.js} +178 -138
  20. package/client/dist/assets/{vendor-mermaid-CH7SGc99.js → vendor-mermaid-DucWyDEe.js} +3 -3
  21. package/client/dist/assets/{vendor-syntax-DuHI9Ok6.js → vendor-syntax-LS_Nt30I.js} +1 -1
  22. package/client/dist/clear-cache.html +85 -85
  23. package/client/dist/index.html +17 -17
  24. package/client/dist/manifest.json +3 -3
  25. package/client/dist/mcp-docs.html +108 -108
  26. package/client/dist/offline.html +84 -84
  27. package/client/dist/sw.js +82 -82
  28. package/package.json +136 -136
  29. package/server/browser.js +131 -0
  30. package/server/database/db.js +108 -10
  31. package/server/index.js +27 -28
  32. package/server/middleware/auth.js +5 -2
  33. package/server/routes/browser.js +419 -0
  34. package/server/routes/projects.js +118 -19
  35. package/server/routes/vapi-chat.js +1 -1
  36. package/server/services/browser-ai.js +154 -0
  37. package/client/dist/assets/DashboardPanel-CblJfTGi.js +0 -1
  38. package/client/dist/assets/FileTree-BDUnBheV.js +0 -1
  39. package/client/dist/assets/Onboarding-Drnlt75a.js +0 -1
  40. package/client/dist/assets/SetupForm-CtCKitZG.js +0 -1
  41. package/client/dist/assets/WorkflowsPanel-B2mIXDvD.js +0 -1
  42. package/client/dist/assets/index-BFuqS0tY.css +0 -1
@@ -0,0 +1,2 @@
1
+ import{j as e,r as n}from"./vendor-react-96lCPsRK.js";import{b as N}from"./index-HaY-3pK1.js";import{bm as te,A as se,Z,X as z,bn as re,H as oe,V as ae,bo as ne,q as B,T as K,E as ie,a3 as le,bp as ce,L as de,a as ue,bq as me,br as xe}from"./vendor-icons-GyYE35HP.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-i18n-DCFGyhQR.js";function pe({url:u,onUrlChange:t,onNavigate:c,onRefresh:m,mode:f,onModeChange:r,hasSession:i,onNewSession:h,onCloseSession:x,isLoading:C}){const $=k=>{if(k.key==="Enter"){let p=u.trim();p&&!p.startsWith("http://")&&!p.startsWith("https://")&&(p=`https://${p}`),c(p)}};return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/30 border-b border-border/40",children:[e.jsx("div",{className:"flex items-center gap-0.5",children:e.jsx("button",{onClick:m,disabled:!i||C,className:"p-1.5 rounded-md hover:bg-muted/60 text-muted-foreground hover:text-foreground disabled:opacity-30 transition-colors",title:"Refresh",children:e.jsx(te,{className:`w-3.5 h-3.5 ${C?"animate-spin":""}`})})}),e.jsxs("div",{className:"flex-1 flex items-center gap-2 px-3 py-1.5 bg-background rounded-lg border border-border/40 focus-within:border-primary/40 transition-colors",children:[e.jsx(se,{className:"w-3.5 h-3.5 text-muted-foreground flex-shrink-0"}),e.jsx("input",{type:"text",value:u,onChange:k=>t(k.target.value),onKeyDown:$,placeholder:i?"Enter URL or search...":"Launch a browser session first",disabled:!i,className:"flex-1 text-sm bg-transparent outline-none text-foreground placeholder:text-muted-foreground/50"})]}),e.jsxs("div",{className:"flex items-center bg-muted/40 rounded-lg p-0.5",children:[e.jsx("button",{onClick:()=>r("chat"),className:`px-2.5 py-1 text-[11px] font-medium rounded-md transition-colors ${f==="chat"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:"Chat"}),e.jsxs("button",{onClick:()=>r("autonomous"),className:`px-2.5 py-1 text-[11px] font-medium rounded-md transition-colors flex items-center gap-1 ${f==="autonomous"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:[e.jsx(Z,{className:"w-3 h-3"}),"Auto"]})]}),i?e.jsx("button",{onClick:x,className:"p-1.5 rounded-md hover:bg-destructive/10 text-muted-foreground hover:text-destructive transition-colors",title:"Close browser session",children:e.jsx(z,{className:"w-3.5 h-3.5"})}):e.jsxs("button",{onClick:h,disabled:C,className:"flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:opacity-90 disabled:opacity-50 transition-opacity",children:[e.jsx(re,{className:"w-3.5 h-3.5"}),"Launch"]})]})}function fe({viewerUrl:u,hasSession:t,isLoading:c,onNewSession:m}){return t?u?e.jsx("div",{className:"flex-1 relative bg-black",children:e.jsx("iframe",{src:u,title:"Browser Session",className:"absolute inset-0 w-full h-full border-0",sandbox:"allow-same-origin allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox",allow:"clipboard-read; clipboard-write"})}):e.jsx("div",{className:"flex-1 flex items-center justify-center bg-muted/10",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-muted-foreground/30 border-t-muted-foreground rounded-full animate-spin"}),"Connecting to browser session..."]})}):e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center gap-4 bg-muted/10 text-muted-foreground",children:[e.jsx(oe,{className:"w-12 h-12 opacity-30"}),e.jsxs("div",{className:"text-center space-y-1",children:[e.jsx("p",{className:"text-sm font-medium",children:"No browser session active"}),e.jsx("p",{className:"text-xs opacity-70",children:"Launch a session to start browsing or preview your sandbox apps"})]}),e.jsx("button",{onClick:m,disabled:c,className:"px-4 py-2 text-sm font-medium bg-primary text-primary-foreground rounded-lg hover:opacity-90 disabled:opacity-50 transition-opacity",children:c?"Launching...":"Launch Browser"})]})}function he({value:u,onChange:t,onSubmit:c,onStop:m,mode:f,isRunning:r,hasSession:i}){const h=x=>{x.key==="Enter"&&!x.shiftKey&&(x.preventDefault(),u.trim()&&!r&&c())};return e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/30 border-t border-border/40",children:[e.jsxs("div",{className:"flex-1 flex items-center gap-2 px-3 py-2 bg-background rounded-lg border border-border/40 focus-within:border-primary/40 transition-colors",children:[f==="autonomous"&&e.jsx(Z,{className:"w-3.5 h-3.5 text-amber-500 flex-shrink-0"}),e.jsx("input",{type:"text",value:u,onChange:x=>t(x.target.value),onKeyDown:h,placeholder:i?f==="chat"?'Tell the AI what to do... (e.g., "Click the login button")':'Set a goal... (e.g., "Fill out the registration form")':"Launch a session first",disabled:!i||r,className:"flex-1 text-sm bg-transparent outline-none text-foreground placeholder:text-muted-foreground/50"})]}),r?e.jsx("button",{onClick:m,className:"p-2 rounded-lg bg-destructive/10 text-destructive hover:bg-destructive/20 transition-colors",title:"Stop",children:e.jsx(ae,{className:"w-4 h-4"})}):e.jsx("button",{onClick:c,disabled:!i||!u.trim(),className:"p-2 rounded-lg bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-30 transition-opacity",title:"Send",children:e.jsx(ne,{className:"w-4 h-4"})})]})}const be={act:ce,extract:le,observe:ie,navigate:B,error:K,info:B};function ge({actions:u,consoleErrors:t,isVisible:c,onClose:m,onFixError:f}){return c?e.jsxs("div",{className:"w-64 flex-shrink-0 border-l border-border/40 bg-muted/10 flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border/40",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Action Log"}),e.jsx("button",{onClick:m,className:"p-1 rounded hover:bg-muted/60 text-muted-foreground",children:e.jsx(z,{className:"w-3 h-3"})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto",children:[u.length===0&&t.length===0&&e.jsx("div",{className:"p-3 text-xs text-muted-foreground/60 text-center",children:"AI actions and console errors will appear here"}),u.map(r=>{const i=be[r.type]||B;return e.jsx("div",{className:"px-3 py-2 border-b border-border/20 hover:bg-muted/20 transition-colors",children:e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.status==="running"?e.jsx(de,{className:"w-3 h-3 text-primary animate-spin"}):r.status==="error"?e.jsx(K,{className:"w-3 h-3 text-destructive"}):e.jsx(i,{className:"w-3 h-3 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("span",{className:"text-[10px] text-muted-foreground/60 font-mono",children:["#",r.step]}),e.jsx("span",{className:"text-[10px] uppercase text-muted-foreground/60 font-medium",children:r.type})]}),e.jsx("p",{className:"text-xs text-foreground truncate",children:r.instruction}),r.result&&e.jsx("p",{className:"text-[11px] text-muted-foreground mt-0.5 line-clamp-2",children:r.result})]}),r.status==="done"&&e.jsx(ue,{className:"w-3 h-3 text-emerald-500 flex-shrink-0 mt-0.5"})]})},r.id)}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-1.5 bg-destructive/5 border-y border-destructive/10",children:e.jsxs("span",{className:"text-[10px] font-medium text-destructive uppercase tracking-wide",children:["Console Errors (",t.length,")"]})}),t.map((r,i)=>e.jsxs("div",{className:"px-3 py-2 border-b border-border/20 hover:bg-destructive/5 transition-colors",children:[e.jsxs("div",{className:"flex items-start gap-2",children:[e.jsx(K,{className:"w-3 h-3 text-destructive flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-xs text-foreground line-clamp-3 font-mono",children:r.message}),r.source&&e.jsxs("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:[r.source,r.line?`:${r.line}`:""]})]})]}),e.jsxs("button",{onClick:()=>f(r),className:"mt-1.5 flex items-center gap-1 px-2 py-1 text-[10px] font-medium text-primary bg-primary/10 rounded hover:bg-primary/20 transition-colors",children:[e.jsx(me,{className:"w-2.5 h-2.5"}),"Fix this error"]})]},`err-${i}`))]})]})]}):null}function ke({selectedProject:u}){const[t,c]=n.useState(null),[m,f]=n.useState(""),[r,i]=n.useState("chat"),[h,x]=n.useState(""),[C,$]=n.useState(!1),[k,p]=n.useState(!1),[G,D]=n.useState([]),[S,M]=n.useState([]),[P,R]=n.useState(!1),[V,v]=n.useState(null),E=n.useRef(0),F=n.useRef(null);n.useEffect(()=>{let s=!1;return(async()=>{var o;try{const a=await N.browser.listSessions();if(s)return;if(a.ok){const l=(o=(await a.json()).sessions)==null?void 0:o[0];l&&c({sessionId:l.steel_session_id||l.id,viewerUrl:l.viewer_url||l.viewerUrl||null,status:"active"})}}catch{}})(),()=>{s=!0}},[]);const W=n.useCallback(async()=>{$(!0),v(null);try{const s=await N.browser.createSession();if(!s.ok){const a=await s.json().catch(()=>({}));throw new Error(a.error||"Failed to create session")}const o=await s.json();c({sessionId:o.sessionId||o.id,viewerUrl:o.viewerUrl||o.sessionViewerUrl||null,status:"active"})}catch(s){v(s.message||"Failed to launch browser")}finally{$(!1)}},[]),H=n.useCallback(async()=>{if(t){c(s=>s?{...s,status:"closing"}:null);try{await N.browser.closeSession(t.sessionId)}catch{}c(null),f(""),D([]),M([]),E.current=0}},[t]),J=n.useCallback(async s=>{if(!(!t||!s)){f(s);try{const o=await N.browser.navigate(t.sessionId,s);if(!o.ok){const a=await o.json().catch(()=>({}));v(a.error||"Navigation failed")}}catch{v("Navigation failed")}}},[t]),X=n.useCallback(async()=>{if(!(!t||!m))try{await N.browser.navigate(t.sessionId,m)}catch{}},[t,m]),I=n.useCallback(s=>{E.current+=1;const o={...s,id:`action-${Date.now()}-${E.current}`,step:E.current};return D(a=>[...a,o]),R(!0),o.id},[]),w=n.useCallback((s,o)=>{D(a=>a.map(d=>d.id===s?{...d,...o}:d))},[]),q=n.useCallback(async()=>{if(!t||!h.trim())return;const s=h.trim();x(""),p(!0),v(null);const o=I({type:"act",instruction:s,timestamp:Date.now(),status:"running"});try{const a=await N.browser.aiAct(t.sessionId,s);if(a.ok){const d=await a.json();w(o,{status:"done",result:d.result||"Done"})}else{const d=await a.json().catch(()=>({}));w(o,{status:"error",result:d.error||"Action failed"})}}catch(a){w(o,{status:"error",result:a.message||"Action failed"})}finally{p(!1)}},[t,h,I,w]),_=n.useCallback(async()=>{var d;if(!t||!h.trim())return;const s=h.trim();x(""),p(!0),v(null);const o=new AbortController;F.current=o;const a=I({type:"info",instruction:`Goal: ${s}`,timestamp:Date.now(),status:"running"});try{const l=await fetch(`/api/browser/sessions/${t.sessionId}/ai/autonomous?goal=${encodeURIComponent(s)}&maxSteps=20`,{credentials:"include",signal:o.signal});if(!l.ok){const y=await l.json().catch(()=>({}));w(a,{status:"error",result:y.error||"Failed"});return}const A=(d=l.body)==null?void 0:d.getReader(),b=new TextDecoder;let T="";if(A)for(;;){const{done:y,value:L}=await A.read();if(y)break;T+=b.decode(L,{stream:!0});const j=T.split(`
2
+ `);T=j.pop()||"";for(const O of j){if(!O.startsWith("data: "))continue;const U=O.slice(6).trim();if(!(!U||U==="[DONE]"))try{const g=JSON.parse(U);g.type==="step"?I({type:g.actionType||"act",instruction:g.instruction||g.description||"",result:g.result,timestamp:Date.now(),status:g.status==="error"?"error":"done"}):g.type==="complete"?w(a,{status:"done",result:g.message||"Goal completed"}):g.type==="error"&&w(a,{status:"error",result:g.error||"Autonomous run failed"})}catch{}}}D(y=>{const L=y.find(j=>j.id===a);return L&&L.status==="running"?y.map(j=>j.id===a?{...j,status:"done",result:"Completed"}:j):y})}catch(l){l.name!=="AbortError"&&w(a,{status:"error",result:l.message||"Autonomous run failed"})}finally{p(!1),F.current=null}},[t,h,I,w]),Q=n.useCallback(()=>{r==="chat"?q():_()},[r,q,_]),Y=n.useCallback(()=>{var s;(s=F.current)==null||s.abort(),p(!1)},[]),ee=n.useCallback(s=>{const o=`Fix this console error: ${s.message}${s.source?` (source: ${s.source}:${s.line})`:""}`;x(o),i("chat")},[]);return n.useEffect(()=>{if(!t||t.status!=="active")return;let s=!1;const o=async()=>{var d;try{const l=await N.browser.consoleErrors(t.sessionId);if(s||!l.ok)return;const A=await l.json();(d=A.errors)!=null&&d.length&&M(A.errors.map(b=>({message:b.message||b.text||String(b),source:b.source||b.url,line:b.line||b.lineNumber,timestamp:b.timestamp||Date.now()})))}catch{}},a=setInterval(o,1e4);return o(),()=>{s=!0,clearInterval(a)}},[t]),e.jsxs("div",{className:"h-full flex flex-col bg-background",children:[e.jsx(pe,{url:m,onUrlChange:f,onNavigate:J,onRefresh:X,mode:r,onModeChange:i,hasSession:(t==null?void 0:t.status)==="active",onNewSession:W,onCloseSession:H,isLoading:C}),V&&e.jsxs("div",{className:"px-3 py-1.5 bg-destructive/10 border-b border-destructive/20 text-xs text-destructive flex items-center justify-between",children:[e.jsx("span",{children:V}),e.jsx("button",{onClick:()=>v(null),className:"text-destructive/70 hover:text-destructive",children:"Dismiss"})]}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsx(fe,{viewerUrl:(t==null?void 0:t.viewerUrl)||null,hasSession:!!t,isLoading:C,onNewSession:W}),!P&&(G.length>0||S.length>0)&&e.jsxs("button",{onClick:()=>R(!0),className:"absolute right-2 top-14 z-10 p-1.5 rounded-md bg-muted/80 border border-border/40 text-muted-foreground hover:text-foreground transition-colors",title:"Show action log",children:[e.jsx(xe,{className:"w-3.5 h-3.5"}),S.length>0&&e.jsx("span",{className:"absolute -top-1 -right-1 w-3 h-3 bg-destructive rounded-full text-[8px] text-white flex items-center justify-center",children:S.length>9?"!":S.length})]}),e.jsx(ge,{actions:G,consoleErrors:S,isVisible:P,onClose:()=>R(!1),onFixError:ee})]}),e.jsx(he,{value:h,onChange:x,onSubmit:Q,onStop:Y,mode:r,isRunning:k,hasSession:(t==null?void 0:t.status)==="active"})]})}export{ke as default};
@@ -1 +1 @@
1
- import{u as x,h as p,r as u,j as e}from"./vendor-react-96lCPsRK.js";import{u as f}from"./index-C5ptjuTl.js";import h from"./CanvasWorkspace-Bk9R9_e0.js";import"./vendor-syntax-DuHI9Ok6.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-icons-BaD0x9SL.js";import"./vendor-i18n-DCFGyhQR.js";import"./vendor-canvas-D39yWul6.js";import"./vendor-mermaid-CH7SGc99.js";function E(){const{projectName:s}=x(),r=p(),{sendMessage:l,latestMessage:m,connectionState:t}=f();if(u.useEffect(()=>{const n=o=>{var c,d;const i=(d=(c=o.target)==null?void 0:c.tagName)==null?void 0:d.toLowerCase();o.key==="Escape"&&i!=="input"&&i!=="textarea"&&r("/")};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[r]),!s)return e.jsx("div",{className:"flex items-center justify-center h-screen bg-background text-muted-foreground",children:"No project selected"});const a=decodeURIComponent(s);return e.jsxs("div",{className:"fixed inset-0 bg-background flex flex-col z-50",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border/50 bg-card/50 backdrop-blur-sm shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>r("/"),className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),"Back"]}),e.jsx("div",{className:"h-4 w-px bg-border/50"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary border border-primary/20 font-medium",children:"Canvas"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t!=="connected"&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] px-2 py-0.5 rounded-full border border-amber-500/20 bg-amber-500/5 text-amber-400",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-amber-400 rounded-full animate-pulse"}),t==="reconnecting"?"Reconnecting...":"Offline"]}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Press Esc to exit"})]})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(h,{projectName:a,sendMessage:l,latestMessage:m,isFullScreen:!0})})]})}export{E as default};
1
+ import{u as x,h as p,r as u,j as e}from"./vendor-react-96lCPsRK.js";import{u as f}from"./index-HaY-3pK1.js";import h from"./CanvasWorkspace-D7ORj358.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-icons-GyYE35HP.js";import"./vendor-i18n-DCFGyhQR.js";import"./vendor-canvas-DvHJ_Pn2.js";import"./vendor-mermaid-DucWyDEe.js";function E(){const{projectName:s}=x(),r=p(),{sendMessage:l,latestMessage:m,connectionState:t}=f();if(u.useEffect(()=>{const n=o=>{var c,d;const i=(d=(c=o.target)==null?void 0:c.tagName)==null?void 0:d.toLowerCase();o.key==="Escape"&&i!=="input"&&i!=="textarea"&&r("/")};return window.addEventListener("keydown",n),()=>window.removeEventListener("keydown",n)},[r]),!s)return e.jsx("div",{className:"flex items-center justify-center h-screen bg-background text-muted-foreground",children:"No project selected"});const a=decodeURIComponent(s);return e.jsxs("div",{className:"fixed inset-0 bg-background flex flex-col z-50",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-border/50 bg-card/50 backdrop-blur-sm shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("button",{onClick:()=>r("/"),className:"flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})}),"Back"]}),e.jsx("div",{className:"h-4 w-px bg-border/50"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 5a1 1 0 011-1h14a1 1 0 011 1v2a1 1 0 01-1 1H5a1 1 0 01-1-1V5zM4 13a1 1 0 011-1h6a1 1 0 011 1v6a1 1 0 01-1 1H5a1 1 0 01-1-1v-6zM16 13a1 1 0 011-1h2a1 1 0 011 1v6a1 1 0 01-1 1h-2a1 1 0 01-1-1v-6z"})}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:a}),e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded-full bg-primary/10 text-primary border border-primary/20 font-medium",children:"Canvas"})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[t!=="connected"&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px] px-2 py-0.5 rounded-full border border-amber-500/20 bg-amber-500/5 text-amber-400",children:[e.jsx("div",{className:"w-1.5 h-1.5 bg-amber-400 rounded-full animate-pulse"}),t==="reconnecting"?"Reconnecting...":"Offline"]}),e.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Press Esc to exit"})]})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(h,{projectName:a,sendMessage:l,latestMessage:m,isFullScreen:!0})})]})}export{E as default};
@@ -1,4 +1,4 @@
1
- import{b as Ue}from"./vendor-syntax-DuHI9Ok6.js";import{r as a,j as e,R as Ye}from"./vendor-react-96lCPsRK.js";import{P as Z,Q as q,R as Ce,S as Ke,T as Ge,U as Je,V as Xe,W as Ze,X as qe,Y as Qe,Z as et,_ as tt,$ as nt,a0 as ot}from"./vendor-canvas-D39yWul6.js";import{M as st,a as rt}from"./vendor-markdown-CimbIo6Y.js";import{b as Q,u as at}from"./index-C5ptjuTl.js";import"./vendor-mermaid-CH7SGc99.js";import"./vendor-icons-BaD0x9SL.js";import"./vendor-i18n-DCFGyhQR.js";function it({onAddNote:o,onAddPdf:c,onRun:l,onStop:t,onClearAi:x,onAutoLayout:m,onExport:i,isRunning:b}){const h=a.useRef(null),s=a.useCallback(p=>{var y;const n=(y=p.target.files)==null?void 0:y[0];n&&n.type==="application/pdf"&&c(n),h.current&&(h.current.value="")},[c]),u=[{label:"Add Note",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),onClick:o,color:"hover:bg-blue-50 hover:text-blue-600"},{label:"Add PDF",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),onClick:()=>{var p;return(p=h.current)==null?void 0:p.click()},color:"hover:bg-red-50 hover:text-red-600"},{type:"divider"},{label:b?"Stop AI":"Run AI",icon:b?e.jsx("div",{className:"w-3 h-3 bg-red-500 rounded-sm"}):e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M8 5v14l11-7z"})}),onClick:b?t:l,color:b?"bg-red-50 text-red-600 hover:bg-red-100":"hover:bg-green-50 hover:text-green-600"},{label:"Clear AI",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),onClick:x,color:"hover:bg-gray-100 hover:text-gray-600"},{type:"divider"},{label:"Auto Layout",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 10h16M4 14h16M4 18h16"})}),onClick:m,color:"hover:bg-indigo-50 hover:text-indigo-600"},{label:"Export",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),onClick:i,color:"hover:bg-emerald-50 hover:text-emerald-600"}];return e.jsxs("div",{className:"absolute top-1/2 left-3 -translate-y-1/2 z-20",children:[e.jsx("div",{className:"bg-white/90 backdrop-blur-sm border border-gray-200 rounded-xl shadow-lg p-1.5 flex flex-col gap-1",children:u.map((p,n)=>{if("type"in p&&p.type==="divider")return e.jsx("div",{className:"h-px bg-gray-200 mx-1 my-0.5"},n);const y=p;return e.jsx("button",{onClick:y.onClick,className:`w-8 h-8 rounded-lg flex items-center justify-center text-gray-500 transition-colors ${y.color}`,title:y.label,children:y.icon},y.label)})}),e.jsx("input",{ref:h,type:"file",accept:".pdf",onChange:s,className:"hidden"})]})}const lt=a.memo(it),ae={note:{bg:"bg-blue-50",border:"border-blue-300",accent:"text-blue-600",icon:"📝"},prompt:{bg:"bg-blue-50",border:"border-blue-400",accent:"text-blue-700",icon:"💬"},response:{bg:"bg-purple-50",border:"border-purple-300",accent:"text-purple-700",icon:"🤖"},research:{bg:"bg-teal-50",border:"border-teal-300",accent:"text-teal-700",icon:"🔍"},suggestion:{bg:"bg-amber-50",border:"border-amber-300",accent:"text-amber-700",icon:"💡"},pdf:{bg:"bg-red-50",border:"border-red-300",accent:"text-red-600",icon:"📄"},summary:{bg:"bg-green-50",border:"border-green-300",accent:"text-green-700",icon:"📋"},webpage:{bg:"bg-indigo-50",border:"border-indigo-300",accent:"text-indigo-700",icon:"🌐"}};function ct({id:o,nodeType:c,data:l,selected:t,children:x,actions:m}){const i=ae[c]||ae.note;if(l.compact===!0){const h=l.status==="completed"?"bg-emerald-400":l.status==="running"?"bg-amber-400 animate-pulse":"bg-gray-300";return e.jsxs("div",{className:`
1
+ import{b as Ue}from"./vendor-syntax-LS_Nt30I.js";import{r as a,j as e,R as Ye}from"./vendor-react-96lCPsRK.js";import{P as Z,Q as q,R as Ce,S as Ke,T as Ge,U as Je,V as Xe,W as Ze,X as qe,Y as Qe,Z as et,_ as tt,$ as nt,a0 as ot}from"./vendor-canvas-DvHJ_Pn2.js";import{M as st,a as rt}from"./vendor-markdown-CimbIo6Y.js";import{b as Q,u as at}from"./index-HaY-3pK1.js";import"./vendor-mermaid-DucWyDEe.js";import"./vendor-icons-GyYE35HP.js";import"./vendor-i18n-DCFGyhQR.js";function it({onAddNote:o,onAddPdf:c,onRun:l,onStop:t,onClearAi:x,onAutoLayout:m,onExport:i,isRunning:b}){const h=a.useRef(null),s=a.useCallback(p=>{var y;const n=(y=p.target.files)==null?void 0:y[0];n&&n.type==="application/pdf"&&c(n),h.current&&(h.current.value="")},[c]),u=[{label:"Add Note",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4v16m8-8H4"})}),onClick:o,color:"hover:bg-blue-50 hover:text-blue-600"},{label:"Add PDF",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M7 21h10a2 2 0 002-2V9.414a1 1 0 00-.293-.707l-5.414-5.414A1 1 0 0012.586 3H7a2 2 0 00-2 2v14a2 2 0 002 2z"})}),onClick:()=>{var p;return(p=h.current)==null?void 0:p.click()},color:"hover:bg-red-50 hover:text-red-600"},{type:"divider"},{label:b?"Stop AI":"Run AI",icon:b?e.jsx("div",{className:"w-3 h-3 bg-red-500 rounded-sm"}):e.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{d:"M8 5v14l11-7z"})}),onClick:b?t:l,color:b?"bg-red-50 text-red-600 hover:bg-red-100":"hover:bg-green-50 hover:text-green-600"},{label:"Clear AI",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})}),onClick:x,color:"hover:bg-gray-100 hover:text-gray-600"},{type:"divider"},{label:"Auto Layout",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 10h16M4 14h16M4 18h16"})}),onClick:m,color:"hover:bg-indigo-50 hover:text-indigo-600"},{label:"Export",icon:e.jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),onClick:i,color:"hover:bg-emerald-50 hover:text-emerald-600"}];return e.jsxs("div",{className:"absolute top-1/2 left-3 -translate-y-1/2 z-20",children:[e.jsx("div",{className:"bg-white/90 backdrop-blur-sm border border-gray-200 rounded-xl shadow-lg p-1.5 flex flex-col gap-1",children:u.map((p,n)=>{if("type"in p&&p.type==="divider")return e.jsx("div",{className:"h-px bg-gray-200 mx-1 my-0.5"},n);const y=p;return e.jsx("button",{onClick:y.onClick,className:`w-8 h-8 rounded-lg flex items-center justify-center text-gray-500 transition-colors ${y.color}`,title:y.label,children:y.icon},y.label)})}),e.jsx("input",{ref:h,type:"file",accept:".pdf",onChange:s,className:"hidden"})]})}const lt=a.memo(it),ae={note:{bg:"bg-blue-50",border:"border-blue-300",accent:"text-blue-600",icon:"📝"},prompt:{bg:"bg-blue-50",border:"border-blue-400",accent:"text-blue-700",icon:"💬"},response:{bg:"bg-purple-50",border:"border-purple-300",accent:"text-purple-700",icon:"🤖"},research:{bg:"bg-teal-50",border:"border-teal-300",accent:"text-teal-700",icon:"🔍"},suggestion:{bg:"bg-amber-50",border:"border-amber-300",accent:"text-amber-700",icon:"💡"},pdf:{bg:"bg-red-50",border:"border-red-300",accent:"text-red-600",icon:"📄"},summary:{bg:"bg-green-50",border:"border-green-300",accent:"text-green-700",icon:"📋"},webpage:{bg:"bg-indigo-50",border:"border-indigo-300",accent:"text-indigo-700",icon:"🌐"}};function ct({id:o,nodeType:c,data:l,selected:t,children:x,actions:m}){const i=ae[c]||ae.note;if(l.compact===!0){const h=l.status==="completed"?"bg-emerald-400":l.status==="running"?"bg-amber-400 animate-pulse":"bg-gray-300";return e.jsxs("div",{className:`
2
2
  rounded-xl border-2 shadow-sm w-[220px] transition-shadow cursor-pointer
3
3
  ${i.bg} ${i.border}
4
4
  ${t?"ring-2 ring-primary/40 shadow-md":"hover:shadow-md"}
@@ -0,0 +1 @@
1
+ import{r as l,j as e}from"./vendor-react-96lCPsRK.js";import{d as C,I as j}from"./index-HaY-3pK1.js";import{u as M,a as T}from"./AppContent-CwrTP6TW.js";import{af as $,R as A,M as L,Z as I,bb as R,h as _,bk as D,t as U,av as E,aD as V,v as F,bl as O}from"./vendor-icons-GyYE35HP.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-i18n-DCFGyhQR.js";import"./LoginModal-CImJHRjX.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-canvas-DvHJ_Pn2.js";import"./vendor-mermaid-DucWyDEe.js";import"./vendor-codemirror-D2ALgpaX.js";function Y({onRefresh:t,threshold:r=80,maxPull:i=120,enabled:s=!0}){const d=l.useRef(0),[n,c]=l.useState(0),[m,f]=l.useState(!1),u=l.useRef(!1),w=l.useCallback(o=>{!s||m||(d.current=o.touches[0].clientY,u.current=!1)},[s,m]),p=l.useCallback(o=>{if(!s||m||o.currentTarget.scrollTop>0)return;const b=o.touches[0].clientY-d.current;b>0&&(u.current=!0,c(Math.min(b*.5,i)))},[s,m,i]),x=l.useCallback(async()=>{if(u.current){if(n>=r){f(!0);try{await t()}finally{f(!1)}}c(0),u.current=!1}},[n,r,t]);return{pullDistance:n,isRefreshing:m,handlers:{onTouchStart:w,onTouchMove:p,onTouchEnd:x}}}function S({className:t}){return e.jsx("div",{className:`animate-pulse rounded-md bg-muted/60 ${t||""}`})}function ee({selectedProject:t}){var k;const[r,i]=l.useState(null),[s,d]=l.useState(null),[n,c]=l.useState(!0),[m,f]=l.useState(null),{canPrompt:u,promptInstall:w}=M(),{isMobile:p}=T({trackPWA:!1}),x=l.useCallback(async()=>{c(!0),f(null);try{const a=await C("/api/dashboard/stats");if(a.ok){const h=await a.json();i(h)}}catch{}if(j)try{const a=await C("/api/vapi/usage");if(a.ok){const h=await a.json();d(h)}}catch{}c(!1)},[]),{pullDistance:o,isRefreshing:y,handlers:b}=Y({onRefresh:x,enabled:p});return l.useEffect(()=>{x()},[x]),e.jsxs("div",{className:"h-full overflow-y-auto p-4 sm:p-6 space-y-6","data-pull-refresh":!0,...p?b:{},style:o>0?{transform:`translateY(${o*.3}px)`}:void 0,children:[p&&(o>0||y)&&e.jsx("div",{className:"flex items-center justify-center py-2 -mt-2",children:y?e.jsx("div",{className:"w-5 h-5 border-2 border-primary/30 border-t-primary rounded-full animate-spin"}):e.jsx("svg",{className:"w-5 h-5 text-muted-foreground transition-transform",style:{transform:`rotate(${Math.min(o/80*180,180)}deg)`},fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[e.jsx($,{className:"w-5 h-5 text-blue-500"}),"Dashboard"]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:t?`Project: ${t.displayName||t.name}`:"Overview"})]}),e.jsx("button",{onClick:x,disabled:n,className:"p-2 rounded-lg hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors",title:"Refresh stats",children:e.jsx(A,{className:`w-4 h-4 ${n?"animate-spin":""}`})})]}),e.jsxs("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-3",children:[e.jsx(N,{icon:L,label:"Sessions",value:(r==null?void 0:r.total)??0,subtext:r!=null&&r.today?`${r.today} today`:void 0,color:"blue",loading:n}),e.jsx(N,{icon:I,label:"AI Providers",value:r!=null&&r.providers?Object.keys(r.providers).length:0,subtext:r!=null&&r.providers?Object.keys(r.providers).join(", "):void 0,color:"purple",loading:n}),j&&e.jsxs(e.Fragment,{children:[e.jsx(N,{icon:R,label:"Voice Calls",value:((k=s==null?void 0:s.allTime)==null?void 0:k.calls)??0,subtext:s!=null&&s.today?`${s.today.calls} today`:void 0,color:"amber",loading:n}),e.jsx(N,{icon:_,label:"Call Limit",value:(s==null?void 0:s.remaining)!=null?`${s.remaining} left`:0,subtext:s!=null&&s.limit?`of ${s.limit}/day`:void 0,color:"emerald",loading:n})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider",children:"Quick Actions"}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2",children:[e.jsx(v,{label:"Install CLI",description:"npm install -g @upfynai-code/app",onClick:()=>navigator.clipboard.writeText("npm install -g @upfynai-code/app")}),e.jsx(v,{label:"Connect Machine",description:"uc connect",onClick:()=>navigator.clipboard.writeText("uc connect")}),j&&e.jsx(v,{label:"View Pricing",description:"Upgrade your plan",href:"https://cli.upfyn.com/pricing"}),u&&e.jsx(v,{label:"Install App",description:"Add Upfyn to your home screen",onClick:w})]})]}),j&&(s==null?void 0:s.recentCalls)&&s.recentCalls.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider",children:"Recent Voice Calls"}),e.jsx("div",{className:"space-y-2",children:s.recentCalls.slice(0,5).map((a,h)=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/30 border border-border/50",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx(R,{className:"w-4 h-4 text-amber-500 flex-shrink-0"}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm text-foreground truncate",children:a.summary||`Voice call — ${Math.round(a.duration_seconds||0)}s`}),e.jsx("p",{className:"text-xs text-muted-foreground",children:a.created_at?new Date(a.created_at).toLocaleString():"Unknown time"})]})]}),e.jsx("span",{className:`text-xs px-2 py-0.5 rounded-full ${a.status==="completed"?"bg-emerald-500/10 text-emerald-400":a.status==="ended"?"bg-blue-500/10 text-blue-400":"bg-muted text-muted-foreground"}`,children:a.status||"unknown"})]},a.vapi_call_id||h))})]}),t&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider",children:"Project Info"}),e.jsxs("div",{className:"rounded-lg bg-muted/30 border border-border/50 p-4 space-y-2",children:[e.jsx(g,{label:"Name",value:t.displayName||t.name}),e.jsx(g,{label:"Path",value:t.fullPath||t.path||"—"}),t.sessions&&e.jsx(g,{label:"Claude Sessions",value:String(t.sessions.length)}),t.cursorSessions&&e.jsx(g,{label:"Cursor Sessions",value:String(t.cursorSessions.length)}),t.codexSessions&&e.jsx(g,{label:"Codex Sessions",value:String(t.codexSessions.length)})]})]}),!t&&e.jsxs("div",{children:[e.jsxs("h3",{className:"text-sm font-medium text-muted-foreground mb-3 uppercase tracking-wider flex items-center gap-2",children:[e.jsx(D,{className:"w-3.5 h-3.5"}),"Getting Started"]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(U,{className:"w-4 h-4 text-blue-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"1. Install the CLI"})]}),e.jsxs("p",{className:"text-xs text-muted-foreground mb-2",children:["Install globally, then run ",e.jsx("code",{className:"bg-muted px-1 rounded",children:"uc"})," to launch."]}),e.jsx("code",{className:"text-xs bg-muted/50 px-2 py-1 rounded block text-foreground/80",children:"npm install -g @upfynai-code/app"})]}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(I,{className:"w-4 h-4 text-yellow-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"2. Connect Your Machine"})]}),e.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Bridge your local dev environment to this web UI."}),e.jsx("code",{className:"text-xs bg-muted/50 px-2 py-1 rounded block text-foreground/80",children:"uc connect --key your_relay_token"})]}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(E,{className:"w-4 h-4 text-indigo-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"3. Use the Canvas"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Switch to the Canvas tab to create visual workspaces with code blocks, diagrams, and notes."})]}),e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(V,{className:"w-4 h-4 text-emerald-500"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:"4. Chat with AI"})]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Use the Chat tab to talk to Claude, Cursor, or Codex. Bring your own API keys in Settings."})]})]})]})]})}function N({icon:t,label:r,value:i,subtext:s,color:d,loading:n}){const c={blue:"text-blue-500 bg-blue-500/10",purple:"text-purple-500 bg-purple-500/10",amber:"text-amber-500 bg-amber-500/10",emerald:"text-emerald-500 bg-emerald-500/10"};return e.jsxs("div",{className:"rounded-lg border border-border/50 bg-card/50 p-3 sm:p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("div",{className:`w-7 h-7 rounded-md flex items-center justify-center ${c[d]}`,children:e.jsx(t,{className:"w-3.5 h-3.5"})}),e.jsx("span",{className:"text-xs text-muted-foreground",children:r})]}),n?e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"h-6 w-16 mb-1"}),e.jsx(S,{className:"h-3 w-20"})]}):e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"text-xl font-semibold text-foreground",children:i}),s&&e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:s})]})]})}function v({label:t,description:r,onClick:i,href:s}){const d=s?"a":"button",n=s?{href:s,target:"_blank",rel:"noopener noreferrer"}:{onClick:i};return e.jsxs(d,{...n,className:"flex items-center justify-between p-3 rounded-lg border border-border/50 bg-card/50 hover:bg-muted/60 transition-colors text-left group",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:t}),e.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),s?e.jsx(F,{className:"w-3.5 h-3.5 text-muted-foreground group-hover:text-foreground"}):e.jsx(O,{className:"w-3.5 h-3.5 text-muted-foreground group-hover:text-foreground"})]})}function g({label:t,value:r}){return e.jsxs("div",{className:"flex items-center justify-between text-sm",children:[e.jsx("span",{className:"text-muted-foreground",children:t}),e.jsx("span",{className:"text-foreground font-mono text-xs truncate max-w-[60%] text-right",children:r})]})}export{ee as default};
@@ -0,0 +1 @@
1
+ import{r as x,j as e,R as Ee}from"./vendor-react-96lCPsRK.js";import{B as V,I as Ie,S as Fe,c as h}from"./AppContent-CwrTP6TW.js";import{d as Te,b as Le}from"./index-HaY-3pK1.js";import{X as ye,aa as Me,E as ze,ay as Ae,e as xe,n as me,q as De,m as Re,az as y,aA as U,a3 as I,aB as J,aC as Y,aD as ee,S as a,aE as $,aF as F,aG as oe,aH as T,t as j,aI as te,y as w,aJ as G,aK as je,aL as C,aM as S,aN as A,aO as D,aP as E,aQ as Be,aR as b,aS as pe,aT as Oe,aU as ue,aV as R,aW as B,A as ge,aX as Ve,aY as Ue,aZ as O,a_ as fe,a$ as $e,b0 as Ge,ai as Z}from"./vendor-icons-GyYE35HP.js";import{u as qe}from"./LoginModal-CImJHRjX.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-codemirror-D2ALgpaX.js";import"./vendor-i18n-DCFGyhQR.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-canvas-DvHJ_Pn2.js";import"./vendor-mermaid-DucWyDEe.js";function _e({file:i,onClose:u}){const d=`/api/projects/${i.projectName}/files/content?path=${encodeURIComponent(i.path)}`,[s,p]=x.useState(null),[L,q]=x.useState(null),[N,g]=x.useState(!0);return x.useEffect(()=>{let f;const M=new AbortController;return(async()=>{try{g(!0),q(null),p(null);const m=await Te(d,{signal:M.signal});if(!m.ok)throw new Error(`Request failed with status ${m.status}`);const _=await m.blob();f=URL.createObjectURL(_),p(f)}catch(m){if(m.name==="AbortError")return;console.error("Error loading image:",m),q("Unable to load image")}finally{g(!1)}})(),()=>{M.abort(),f&&URL.revokeObjectURL(f)}},[d]),e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl max-w-4xl max-h-[90vh] w-full mx-4 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:i.name}),e.jsx(V,{variant:"ghost",size:"sm",onClick:u,className:"h-8 w-8 p-0",children:e.jsx(ye,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"p-4 flex justify-center items-center bg-gray-50 dark:bg-gray-900 min-h-[400px]",children:[N&&e.jsx("div",{className:"text-center text-gray-500 dark:text-gray-400",children:e.jsx("p",{children:"Loading image…"})}),!N&&s&&e.jsx("img",{src:s,alt:i.name,className:"max-w-full max-h-[70vh] object-contain rounded-lg shadow-md"}),!N&&!s&&e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("p",{children:L||"Unable to load image"}),e.jsx("p",{className:"text-sm mt-2 break-all",children:i.path})]})]}),e.jsx("div",{className:"p-4 border-t bg-gray-50 dark:bg-gray-800",children:e.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:i.path})})]})})}const He="w-4 h-4 flex-shrink-0",he={js:{icon:R,color:"text-yellow-500"},jsx:{icon:R,color:"text-yellow-500"},mjs:{icon:R,color:"text-yellow-500"},cjs:{icon:R,color:"text-yellow-500"},ts:{icon:B,color:"text-blue-500"},tsx:{icon:B,color:"text-blue-500"},mts:{icon:B,color:"text-blue-500"},py:{icon:Z,color:"text-emerald-500"},pyw:{icon:Z,color:"text-emerald-500"},pyi:{icon:Z,color:"text-emerald-400"},ipynb:{icon:Ge,color:"text-orange-500"},rs:{icon:$,color:"text-orange-600"},toml:{icon:a,color:"text-gray-500"},go:{icon:U,color:"text-cyan-500"},rb:{icon:te,color:"text-red-500"},erb:{icon:te,color:"text-red-400"},php:{icon:$e,color:"text-violet-500"},java:{icon:fe,color:"text-red-600"},jar:{icon:fe,color:"text-red-500"},kt:{icon:U,color:"text-violet-500"},kts:{icon:U,color:"text-violet-400"},c:{icon:O,color:"text-blue-600"},h:{icon:O,color:"text-blue-400"},cpp:{icon:O,color:"text-blue-700"},hpp:{icon:O,color:"text-blue-500"},cc:{icon:O,color:"text-blue-700"},cs:{icon:U,color:"text-purple-600"},swift:{icon:oe,color:"text-orange-500"},lua:{icon:Ue,color:"text-blue-500"},r:{icon:Ve,color:"text-blue-600"},html:{icon:ge,color:"text-orange-600"},htm:{icon:ge,color:"text-orange-600"},css:{icon:F,color:"text-blue-500"},scss:{icon:F,color:"text-pink-500"},sass:{icon:F,color:"text-pink-400"},less:{icon:F,color:"text-indigo-500"},vue:{icon:B,color:"text-emerald-500"},svelte:{icon:B,color:"text-orange-500"},json:{icon:T,color:"text-yellow-600"},jsonc:{icon:T,color:"text-yellow-500"},json5:{icon:T,color:"text-yellow-500"},yaml:{icon:a,color:"text-purple-400"},yml:{icon:a,color:"text-purple-400"},xml:{icon:R,color:"text-orange-500"},csv:{icon:ue,color:"text-green-600"},tsv:{icon:ue,color:"text-green-500"},sql:{icon:Oe,color:"text-blue-500"},graphql:{icon:pe,color:"text-pink-500"},gql:{icon:pe,color:"text-pink-500"},proto:{icon:G,color:"text-green-500"},env:{icon:w,color:"text-yellow-600"},md:{icon:ee,color:"text-blue-500"},mdx:{icon:ee,color:"text-blue-400"},txt:{icon:I,color:"text-gray-500"},doc:{icon:I,color:"text-blue-600"},docx:{icon:I,color:"text-blue-600"},pdf:{icon:Y,color:"text-red-600"},rtf:{icon:I,color:"text-gray-500"},tex:{icon:J,color:"text-teal-600"},rst:{icon:I,color:"text-gray-400"},sh:{icon:j,color:"text-green-500"},bash:{icon:j,color:"text-green-500"},zsh:{icon:j,color:"text-green-400"},fish:{icon:j,color:"text-green-400"},ps1:{icon:j,color:"text-blue-400"},bat:{icon:j,color:"text-gray-500"},cmd:{icon:j,color:"text-gray-500"},png:{icon:b,color:"text-purple-500"},jpg:{icon:b,color:"text-purple-500"},jpeg:{icon:b,color:"text-purple-500"},gif:{icon:b,color:"text-purple-400"},webp:{icon:b,color:"text-purple-400"},ico:{icon:b,color:"text-purple-400"},bmp:{icon:b,color:"text-purple-400"},tiff:{icon:b,color:"text-purple-400"},svg:{icon:Be,color:"text-amber-500"},mp3:{icon:E,color:"text-pink-500"},wav:{icon:E,color:"text-pink-500"},ogg:{icon:E,color:"text-pink-400"},flac:{icon:E,color:"text-pink-400"},aac:{icon:E,color:"text-pink-400"},m4a:{icon:E,color:"text-pink-400"},mp4:{icon:D,color:"text-rose-500"},mov:{icon:D,color:"text-rose-500"},avi:{icon:D,color:"text-rose-500"},webm:{icon:D,color:"text-rose-400"},mkv:{icon:D,color:"text-rose-400"},ttf:{icon:A,color:"text-red-500"},otf:{icon:A,color:"text-red-500"},woff:{icon:A,color:"text-red-400"},woff2:{icon:A,color:"text-red-400"},eot:{icon:A,color:"text-red-400"},zip:{icon:S,color:"text-amber-600"},tar:{icon:S,color:"text-amber-600"},gz:{icon:S,color:"text-amber-600"},bz2:{icon:S,color:"text-amber-600"},rar:{icon:S,color:"text-amber-500"},"7z":{icon:S,color:"text-amber-500"},lock:{icon:y,color:"text-gray-500"},exe:{icon:C,color:"text-gray-500"},bin:{icon:C,color:"text-gray-500"},dll:{icon:C,color:"text-gray-400"},so:{icon:C,color:"text-gray-400"},dylib:{icon:C,color:"text-gray-400"},wasm:{icon:C,color:"text-purple-500"},ini:{icon:a,color:"text-gray-500"},cfg:{icon:a,color:"text-gray-500"},conf:{icon:a,color:"text-gray-500"},log:{icon:J,color:"text-gray-400"},map:{icon:je,color:"text-gray-400"}},be={Dockerfile:{icon:G,color:"text-blue-500"},"docker-compose.yml":{icon:G,color:"text-blue-500"},"docker-compose.yaml":{icon:G,color:"text-blue-500"},".dockerignore":{icon:G,color:"text-gray-500"},".gitignore":{icon:a,color:"text-gray-500"},".gitmodules":{icon:a,color:"text-gray-500"},".gitattributes":{icon:a,color:"text-gray-500"},".editorconfig":{icon:a,color:"text-gray-500"},".prettierrc":{icon:a,color:"text-pink-400"},".prettierignore":{icon:a,color:"text-gray-500"},".eslintrc":{icon:a,color:"text-violet-500"},".eslintrc.js":{icon:a,color:"text-violet-500"},".eslintrc.json":{icon:a,color:"text-violet-500"},".eslintrc.cjs":{icon:a,color:"text-violet-500"},"eslint.config.js":{icon:a,color:"text-violet-500"},"eslint.config.mjs":{icon:a,color:"text-violet-500"},".env":{icon:w,color:"text-yellow-600"},".env.local":{icon:w,color:"text-yellow-600"},".env.development":{icon:w,color:"text-yellow-500"},".env.production":{icon:w,color:"text-yellow-600"},".env.example":{icon:w,color:"text-yellow-400"},"package.json":{icon:T,color:"text-green-500"},"package-lock.json":{icon:y,color:"text-gray-500"},"yarn.lock":{icon:y,color:"text-blue-400"},"pnpm-lock.yaml":{icon:y,color:"text-orange-400"},"bun.lockb":{icon:y,color:"text-gray-400"},"Cargo.toml":{icon:$,color:"text-orange-600"},"Cargo.lock":{icon:y,color:"text-orange-400"},Gemfile:{icon:te,color:"text-red-500"},"Gemfile.lock":{icon:y,color:"text-red-400"},Makefile:{icon:j,color:"text-gray-500"},"CMakeLists.txt":{icon:$,color:"text-blue-500"},"tsconfig.json":{icon:T,color:"text-blue-500"},"jsconfig.json":{icon:T,color:"text-yellow-500"},"vite.config.ts":{icon:oe,color:"text-purple-500"},"vite.config.js":{icon:oe,color:"text-purple-500"},"webpack.config.js":{icon:$,color:"text-blue-500"},"tailwind.config.js":{icon:F,color:"text-cyan-500"},"tailwind.config.ts":{icon:F,color:"text-cyan-500"},"postcss.config.js":{icon:$,color:"text-red-400"},"babel.config.js":{icon:a,color:"text-yellow-500"},".babelrc":{icon:a,color:"text-yellow-500"},"README.md":{icon:ee,color:"text-blue-500"},LICENSE:{icon:Y,color:"text-gray-500"},"LICENSE.md":{icon:Y,color:"text-gray-500"},"CHANGELOG.md":{icon:J,color:"text-blue-400"},"requirements.txt":{icon:I,color:"text-emerald-400"},"go.mod":{icon:U,color:"text-cyan-500"},"go.sum":{icon:y,color:"text-cyan-400"}};function We(i){var d;if(be[i])return be[i];if(i.startsWith(".env"))return{icon:w,color:"text-yellow-600"};const u=(d=i.split(".").pop())==null?void 0:d.toLowerCase();return u&&he[u]?he[u]:{icon:je,color:"text-muted-foreground"}}function no({selectedProject:i,onFileOpen:u,activeFilePath:d=null}){const{t:s}=qe(),[p,L]=x.useState([]),[q,N]=x.useState(!1),[g,f]=x.useState(new Set),[M,W]=x.useState(null),[m,_]=x.useState("detailed"),[v,re]=x.useState(""),[z,ce]=x.useState([]),H=Ee.useRef(null);x.useEffect(()=>{i&&we()},[i]),x.useEffect(()=>{const t=localStorage.getItem("file-tree-view-mode");t&&["simple","detailed","compact"].includes(t)&&_(t)},[]),x.useEffect(()=>{if(!d||p.length===0)return;const t=d.replace(/\\/g,"/"),c=(r,l,n=[])=>{for(const k of r){const ie=(k.path||"").replace(/\\/g,"/");if(k.type==="directory"&&k.children){const Se=[...n,k.path];if(t.startsWith(ie+"/")){const de=c(k.children,l,Se);if(de)return de}}if(k.type!=="directory"&&ie===t)return n}return null},o=c(p,t);o&&o.length>0&&f(r=>{const l=new Set(r);return o.forEach(n=>l.add(n)),l}),requestAnimationFrame(()=>{var r;(r=H.current)==null||r.scrollIntoView({block:"nearest",behavior:"smooth"})})},[d,p]),x.useEffect(()=>{if(!v.trim())ce(p);else{const t=ne(p,v.toLowerCase());ce(t);const c=o=>{o.forEach(r=>{r.type==="directory"&&r.children&&r.children.length>0&&(f(l=>new Set(l.add(r.path))),c(r.children))})};c(t)}},[p,v]);const ne=(t,c)=>t.reduce((o,r)=>{const l=r.name.toLowerCase().includes(c);let n=[];return r.type==="directory"&&r.children&&(n=ne(r.children,c)),(l||n.length>0)&&o.push({...r,children:n}),o},[]),we=async()=>{N(!0);try{const t=await Le.getFiles(i.name);if(!t.ok){const o=await t.text();console.error("❌ File fetch failed:",t.status,o),L([]);return}const c=await t.json();L(c)}catch(t){console.error("❌ Error fetching files:",t),L([])}finally{N(!1)}},Ne=t=>{const c=new Set(g);c.has(t)?c.delete(t):c.add(t),f(c)},P=t=>{_(t),localStorage.setItem("file-tree-view-mode",t)},Q=t=>{if(!t||t===0)return"0 B";const c=1024,o=["B","KB","MB","GB"],r=Math.floor(Math.log(t)/Math.log(c));return parseFloat((t/Math.pow(c,r)).toFixed(1))+" "+o[r]},ve=t=>{if(!t)return"-";const c=new Date,o=new Date(t),r=Math.floor((c-o)/1e3);return r<60?s("fileTree.justNow"):r<3600?s("fileTree.minAgo",{count:Math.floor(r/60)}):r<86400?s("fileTree.hoursAgo",{count:Math.floor(r/3600)}):r<2592e3?s("fileTree.daysAgo",{count:Math.floor(r/86400)}):o.toLocaleDateString()},ke=t=>{var r;const c=(r=t.split(".").pop())==null?void 0:r.toLowerCase();return["png","jpg","jpeg","gif","svg","webp","ico","bmp"].includes(c)},Ce=t=>{const{icon:c,color:o}=We(t);return e.jsx(c,{className:h(He,o)})},X=t=>{t.type==="directory"?Ne(t.path):ke(t.name)?W({name:t.name,path:t.path,projectPath:i.path,projectName:i.name}):u&&u(t.path)},K=t=>{const c=t.type==="directory",o=g.has(t.path);return c?e.jsxs("span",{className:"flex items-center gap-0.5 flex-shrink-0",children:[e.jsx(De,{className:h("w-3.5 h-3.5 text-muted-foreground/70 transition-transform duration-150",o&&"rotate-90")}),o?e.jsx(Re,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}):e.jsx(me,{className:"w-4 h-4 text-muted-foreground flex-shrink-0"})]}):e.jsx("span",{className:"flex items-center flex-shrink-0 ml-[18px]",children:Ce(t.name)})},se=(t,c=0)=>t.map(o=>{const r=o.type==="directory",l=r&&g.has(o.path),n=!r&&d&&(o.path||"").replace(/\\/g,"/")===d.replace(/\\/g,"/");return e.jsxs("div",{className:"select-none",children:[e.jsxs("div",{ref:n?H:void 0,className:h("group flex items-center gap-1.5 py-[3px] pr-2 cursor-pointer rounded-sm","hover:bg-accent/60 transition-colors duration-100",n&&"bg-primary/10 border-l-2 !border-primary font-medium",!n&&r&&l&&"border-l-2 border-primary/30",!n&&r&&!l&&"border-l-2 border-transparent",!n&&!r&&"border-l-2 border-transparent"),style:{paddingLeft:`${c*16+4}px`},onClick:()=>X(o),children:[K(o),e.jsx("span",{className:h("text-[13px] leading-tight truncate",n?"font-medium text-primary":r?"font-medium text-foreground":"text-foreground/90"),children:o.name})]}),r&&l&&o.children&&o.children.length>0&&e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute top-0 bottom-0 border-l border-border/40",style:{left:`${c*16+14}px`},"aria-hidden":"true"}),se(o.children,c+1)]})]},o.path)}),le=(t,c=0)=>t.map(o=>{const r=o.type==="directory",l=r&&g.has(o.path),n=!r&&d&&(o.path||"").replace(/\\/g,"/")===d.replace(/\\/g,"/");return e.jsxs("div",{className:"select-none",children:[e.jsxs("div",{ref:n?H:void 0,className:h("group grid grid-cols-1 sm:grid-cols-12 gap-0 sm:gap-2 py-[3px] pr-2 hover:bg-accent/60 cursor-pointer items-center rounded-sm transition-colors duration-100",n&&"bg-primary/10 border-l-2 !border-primary font-medium",!n&&r&&l&&"border-l-2 border-primary/30",!n&&r&&!l&&"border-l-2 border-transparent",!n&&!r&&"border-l-2 border-transparent"),style:{paddingLeft:`${c*16+4}px`},onClick:()=>X(o),children:[e.jsxs("div",{className:"sm:col-span-5 flex items-center gap-1.5 min-w-0",children:[K(o),e.jsx("span",{className:h("text-[13px] leading-tight truncate",n?"font-medium text-primary":r?"font-medium text-foreground":"text-foreground/90"),children:o.name}),o.type==="file"&&o.size!=null&&e.jsx("span",{className:"sm:hidden text-[10px] text-muted-foreground/60 ml-auto flex-shrink-0",children:Q(o.size)})]}),e.jsx("div",{className:"hidden sm:block sm:col-span-2 text-sm text-muted-foreground tabular-nums",children:o.type==="file"?Q(o.size):""}),e.jsx("div",{className:"hidden sm:block sm:col-span-3 text-sm text-muted-foreground",children:ve(o.modified)}),e.jsx("div",{className:"hidden sm:block sm:col-span-2 text-sm text-muted-foreground font-mono",children:o.permissionsRwx||""})]}),r&&l&&o.children&&e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute top-0 bottom-0 border-l border-border/40",style:{left:`${c*16+14}px`},"aria-hidden":"true"}),le(o.children,c+1)]})]},o.path)}),ae=(t,c=0)=>t.map(o=>{const r=o.type==="directory",l=r&&g.has(o.path),n=!r&&d&&(o.path||"").replace(/\\/g,"/")===d.replace(/\\/g,"/");return e.jsxs("div",{className:"select-none",children:[e.jsxs("div",{ref:n?H:void 0,className:h("group flex items-center justify-between py-[3px] pr-2 hover:bg-accent/60 cursor-pointer rounded-sm transition-colors duration-100",n&&"bg-primary/10 border-l-2 !border-primary font-medium",!n&&r&&l&&"border-l-2 border-primary/30",!n&&r&&!l&&"border-l-2 border-transparent",!n&&!r&&"border-l-2 border-transparent"),style:{paddingLeft:`${c*16+4}px`},onClick:()=>X(o),children:[e.jsxs("div",{className:"flex items-center gap-1.5 min-w-0",children:[K(o),e.jsx("span",{className:h("text-[13px] leading-tight truncate",n?"font-medium text-primary":r?"font-medium text-foreground":"text-foreground/90"),children:o.name})]}),e.jsx("div",{className:"flex items-center gap-3 text-sm text-muted-foreground flex-shrink-0 ml-2",children:o.type==="file"&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"tabular-nums",children:Q(o.size)}),e.jsx("span",{className:"font-mono",children:o.permissionsRwx})]})})]}),r&&l&&o.children&&e.jsxs("div",{className:"relative",children:[e.jsx("span",{className:"absolute top-0 bottom-0 border-l border-border/40",style:{left:`${c*16+14}px`},"aria-hidden":"true"}),ae(o.children,c+1)]})]},o.path)});return q?e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsx("div",{className:"text-muted-foreground text-sm",children:s("fileTree.loading")})}):e.jsxs("div",{className:"h-full flex flex-col bg-background",children:[e.jsxs("div",{className:"px-3 pt-3 pb-2 border-b border-border space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:s("fileTree.files")}),e.jsxs("div",{className:"flex gap-0.5",children:[e.jsx(V,{variant:m==="simple"?"default":"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>P("simple"),title:s("fileTree.simpleView"),children:e.jsx(Me,{className:"w-3.5 h-3.5"})}),e.jsx(V,{variant:m==="compact"?"default":"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>P("compact"),title:s("fileTree.compactView"),children:e.jsx(ze,{className:"w-3.5 h-3.5"})}),e.jsx(V,{variant:m==="detailed"?"default":"ghost",size:"sm",className:"h-7 w-7 p-0",onClick:()=>P("detailed"),title:s("fileTree.detailedView"),children:e.jsx(Ae,{className:"w-3.5 h-3.5"})})]})]}),e.jsxs("div",{className:"relative",children:[e.jsx(xe,{className:"absolute left-2 top-1/2 transform -translate-y-1/2 w-3.5 h-3.5 text-muted-foreground"}),e.jsx(Ie,{type:"text",placeholder:s("fileTree.searchPlaceholder"),value:v,onChange:t=>re(t.target.value),className:"pl-8 pr-8 h-8 text-sm"}),v&&e.jsx(V,{variant:"ghost",size:"sm",className:"absolute right-0.5 top-1/2 transform -translate-y-1/2 h-5 w-5 p-0 hover:bg-accent",onClick:()=>re(""),title:s("fileTree.clearSearch"),children:e.jsx(ye,{className:"w-3 h-3"})})]})]}),m==="detailed"&&z.length>0&&e.jsx("div",{className:"px-3 pt-1.5 pb-1 border-b border-border",children:e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-12 gap-2 px-1 text-[10px] font-semibold uppercase tracking-wider text-muted-foreground/70",children:[e.jsx("div",{className:"sm:col-span-5",children:s("fileTree.name")}),e.jsx("div",{className:"hidden sm:block sm:col-span-2",children:s("fileTree.size")}),e.jsx("div",{className:"hidden sm:block sm:col-span-3",children:s("fileTree.modified")}),e.jsx("div",{className:"hidden sm:block sm:col-span-2",children:s("fileTree.permissions")})]})}),e.jsx(Fe,{className:"flex-1 px-2 py-1",children:p.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:e.jsx(me,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h4",{className:"font-medium text-foreground mb-1",children:s("fileTree.noFilesFound")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("fileTree.checkProjectPath")})]}):z.length===0&&v?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"w-12 h-12 bg-muted rounded-lg flex items-center justify-center mx-auto mb-3",children:e.jsx(xe,{className:"w-6 h-6 text-muted-foreground"})}),e.jsx("h4",{className:"font-medium text-foreground mb-1",children:s("fileTree.noMatchesFound")}),e.jsx("p",{className:"text-sm text-muted-foreground",children:s("fileTree.tryDifferentSearch")})]}):e.jsxs("div",{children:[m==="simple"&&se(z),m==="compact"&&ae(z),m==="detailed"&&le(z)]})}),M&&e.jsx(_e,{file:M,onClose:()=>W(null)})]})}export{no as default};
@@ -1,2 +1,2 @@
1
- import{j as e,r as o}from"./vendor-react-96lCPsRK.js";import{M as pr}from"./AppContent-Bvg0CPCO.js";import{a as fr,d as m}from"./index-C5ptjuTl.js";import{G as ee,l as T,j as re,P as Ue,a$ as L,af as Oe,R as N,$ as ur,b0 as ze,b1 as se,b as gr,I as br,q as te,T as yr,i as W}from"./vendor-icons-BaD0x9SL.js";import"./LoginModal-BWep8a6g.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-canvas-D39yWul6.js";import"./vendor-mermaid-CH7SGc99.js";import"./vendor-syntax-DuHI9Ok6.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-codemirror-CbtmxxaB.js";import"./vendor-i18n-DCFGyhQR.js";function Ae({diff:c,fileName:i,isMobile:v,wrapText:I}){if(!c)return e.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No diff available"});const t=(x,$)=>{const P=x.startsWith("+")&&!x.startsWith("+++"),C=x.startsWith("-")&&!x.startsWith("---"),R=x.startsWith("@@");return e.jsx("div",{className:`font-mono text-xs px-3 py-0.5 ${v&&I?"whitespace-pre-wrap break-all":"whitespace-pre overflow-x-auto"} ${P?"bg-green-50 dark:bg-green-950/50 text-green-700 dark:text-green-300":C?"bg-red-50 dark:bg-red-950/50 text-red-700 dark:text-red-300":R?"bg-primary/5 text-primary":"text-muted-foreground/70"}`,children:x},$)};return e.jsx("div",{className:"diff-viewer",children:c.split(`
1
+ import{j as e,r as o}from"./vendor-react-96lCPsRK.js";import{M as pr}from"./AppContent-CwrTP6TW.js";import{a as fr,d as m}from"./index-HaY-3pK1.js";import{G as ee,l as T,j as re,P as Ue,b1 as L,aj as Oe,R as N,a3 as ur,b2 as ze,b3 as se,b as gr,I as br,q as te,T as yr,i as W}from"./vendor-icons-GyYE35HP.js";import"./LoginModal-CImJHRjX.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-canvas-DvHJ_Pn2.js";import"./vendor-mermaid-DucWyDEe.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-codemirror-D2ALgpaX.js";import"./vendor-i18n-DCFGyhQR.js";function Ae({diff:c,fileName:i,isMobile:v,wrapText:I}){if(!c)return e.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No diff available"});const t=(x,$)=>{const P=x.startsWith("+")&&!x.startsWith("+++"),C=x.startsWith("-")&&!x.startsWith("---"),R=x.startsWith("@@");return e.jsx("div",{className:`font-mono text-xs px-3 py-0.5 ${v&&I?"whitespace-pre-wrap break-all":"whitespace-pre overflow-x-auto"} ${P?"bg-green-50 dark:bg-green-950/50 text-green-700 dark:text-green-300":C?"bg-red-50 dark:bg-red-950/50 text-red-700 dark:text-red-300":R?"bg-primary/5 text-primary":"text-muted-foreground/70"}`,children:x},$)};return e.jsx("div",{className:"diff-viewer",children:c.split(`
2
2
  `).map((x,$)=>t(x,$))})}function Ir({selectedProject:c,isMobile:i,onFileOpen:v}){var Ne,ve,Ce,ke,$e,Se,Fe,Ee,De,Te,Ie,Re;const{addToast:I}=fr(),[t,x]=o.useState(null),[$,P]=o.useState({}),[C,R]=o.useState(!1),[S,U]=o.useState(""),[O,Be]=o.useState(new Set),[h,u]=o.useState(new Set),[ae,ne]=o.useState(!1),[y,k]=o.useState(""),[Ge,z]=o.useState([]),[F,Je]=o.useState(!0),[K,Le]=o.useState(!1),[V,E]=o.useState(!1),[We,A]=o.useState(!1),[D,_]=o.useState(""),[q,oe]=o.useState(!1),[j,ie]=o.useState("changes"),[ce,Pe]=o.useState([]),[Ke,Ve]=o.useState(new Set),[le,_e]=o.useState({}),[de,me]=o.useState(!1),[a,B]=o.useState(null),[Q,xe]=o.useState(!1),[X,he]=o.useState(!1),[Y,pe]=o.useState(!1),[Z,fe]=o.useState(!1),[qe,ue]=o.useState(i),[l,g]=o.useState(null),[ge,be]=o.useState(!1),Qe=o.useRef(null),H=o.useRef(null),[Xe,Ye]=o.useState(()=>localStorage.getItem("selected-provider")||"claude");o.useEffect(()=>{const r=()=>{const s=localStorage.getItem("selected-provider")||"claude";Ye(s)};return window.addEventListener("storage",r),()=>window.removeEventListener("storage",r)},[]),o.useEffect(()=>{k(""),z([]),x(null),B(null),u(new Set),c&&(p(),M(),w())},[c]),o.useEffect(()=>{!c||j!=="history"||or()},[c,j]),o.useEffect(()=>{const r=s=>{H.current&&!H.current.contains(s.target)&&E(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]);const p=async()=>{if(c){R(!0);try{const s=await(await m(`/api/git/status?project=${encodeURIComponent(c.name)}`)).json();if(s.error)console.error("Git status error:",s.error),x({error:s.error,details:s.details}),k(""),u(new Set);else{x(s),k(s.branch||"main");const n=new Set([...s.modified||[],...s.added||[],...s.deleted||[],...s.untracked||[]]);u(n);for(const d of s.modified||[])G(d);for(const d of s.added||[])G(d);for(const d of s.deleted||[])G(d);for(const d of s.untracked||[])G(d)}}catch(r){console.error("Error fetching git status:",r),x({error:"Git operation failed",details:String(r)}),k(""),u(new Set)}finally{R(!1)}}},M=async()=>{try{const s=await(await m(`/api/git/branches?project=${encodeURIComponent(c.name)}`)).json();!s.error&&s.branches?z(s.branches):z([])}catch(r){console.error("Error fetching branches:",r),z([])}},w=async()=>{if(c)try{const s=await(await m(`/api/git/remote-status?project=${encodeURIComponent(c.name)}`)).json();s.error?B(null):B(s)}catch(r){console.error("Error fetching remote status:",r),B(null)}},Ze=async r=>{try{const n=await(await m("/api/git/checkout",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name,branch:r})})).json();n.success?(k(r),E(!1),p()):console.error("Failed to switch branch:",n.error)}catch(s){console.error("Error switching branch:",s)}},ye=async()=>{if(D.trim()){oe(!0);try{const s=await(await m("/api/git/create-branch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name,branch:D.trim()})})).json();s.success?(k(D.trim()),A(!1),E(!1),_(""),M(),p()):console.error("Failed to create branch:",s.error)}catch(r){console.error("Error creating branch:",r)}finally{oe(!1)}}},He=async()=>{xe(!0);try{const s=await(await m("/api/git/fetch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name})})).json();s.success?(p(),w()):console.error("Fetch failed:",s.error)}catch(r){console.error("Error fetching from remote:",r)}finally{xe(!1)}},Me=async()=>{he(!0);try{const s=await(await m("/api/git/pull",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name})})).json();s.success?(p(),w()):console.error("Pull failed:",s.error)}catch(r){console.error("Error pulling from remote:",r)}finally{he(!1)}},er=async()=>{pe(!0);try{const s=await(await m("/api/git/push",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name})})).json();s.success?(p(),w()):console.error("Push failed:",s.error)}catch(r){console.error("Error pushing to remote:",r)}finally{pe(!1)}},rr=async()=>{fe(!0);try{const s=await(await m("/api/git/publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name,branch:y})})).json();s.success?(p(),w()):console.error("Publish failed:",s.error)}catch(r){console.error("Error publishing branch:",r)}finally{fe(!1)}},sr=async r=>{try{const n=await(await m("/api/git/discard",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name,file:r})})).json();n.success?(u(d=>{const b=new Set(d);return b.delete(r),b}),p()):console.error("Discard failed:",n.error)}catch(s){console.error("Error discarding changes:",s)}},tr=async r=>{try{const n=await(await m("/api/git/delete-untracked",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name,file:r})})).json();n.success?(u(d=>{const b=new Set(d);return b.delete(r),b}),p()):console.error("Delete failed:",n.error)}catch(s){console.error("Error deleting untracked file:",s)}},ar=async()=>{if(!l)return;const{type:r,file:s,message:n}=l;g(null);try{switch(r){case"discard":await sr(s);break;case"delete":await tr(s);break;case"commit":await je();break;case"pull":await Me();break;case"push":await er();break;case"publish":await rr();break}}catch(d){console.error(`Error executing ${r}:`,d)}},G=async r=>{try{const n=await(await m(`/api/git/diff?project=${encodeURIComponent(c.name)}&file=${encodeURIComponent(r)}`)).json();!n.error&&n.diff&&P(d=>({...d,[r]:n.diff}))}catch(s){console.error("Error fetching file diff:",s)}},nr=async r=>{if(v)try{const n=await(await m(`/api/git/file-with-diff?project=${encodeURIComponent(c.name)}&file=${encodeURIComponent(r)}`)).json();if(n.error){console.error("Error fetching file with diff:",n.error),v(r);return}const d={old_string:n.oldContent||"",new_string:n.currentContent||""};v(r,d)}catch(s){console.error("Error opening file:",s),v(r)}},or=async()=>{try{const s=await(await m(`/api/git/commits?project=${encodeURIComponent(c.name)}&limit=10`)).json();!s.error&&s.commits&&Pe(s.commits)}catch(r){console.error("Error fetching commits:",r)}},ir=async r=>{try{const n=await(await m(`/api/git/commit-diff?project=${encodeURIComponent(c.name)}&commit=${r}`)).json();!n.error&&n.diff&&_e(d=>({...d,[r]:n.diff}))}catch(s){console.error("Error fetching commit diff:",s)}},cr=async()=>{me(!0);try{const s=await(await m("/api/git/generate-commit-message",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name,files:Array.from(h),provider:Xe})})).json();s.message?U(s.message):console.error("Failed to generate commit message:",s.error)}catch(r){console.error("Error generating commit message:",r)}finally{me(!1)}},lr=r=>{Be(s=>{const n=new Set(s);return n.has(r)?n.delete(r):n.add(r),n})},dr=r=>{Ve(s=>{const n=new Set(s);return n.has(r)?n.delete(r):(n.add(r),le[r]||ir(r)),n})},mr=r=>{u(s=>{const n=new Set(s);return n.has(r)?n.delete(r):n.add(r),n})},je=async()=>{if(!(!S.trim()||h.size===0)){ne(!0);try{const s=await(await m("/api/git/commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name,message:S,files:Array.from(h)})})).json();s.success?(U(""),u(new Set),p(),w()):console.error("Commit failed:",s.error)}catch(r){console.error("Error committing changes:",r)}finally{ne(!1)}}},xr=async()=>{be(!0);try{const s=await(await m("/api/git/initial-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({project:c.name})})).json();s.success?(p(),w()):(console.error("Initial commit failed:",s.error),I(s.error||"Failed to create initial commit","error"))}catch(r){console.error("Error creating initial commit:",r),I("Failed to create initial commit","error")}finally{be(!1)}},we=r=>{switch(r){case"M":return"Modified";case"A":return"Added";case"D":return"Deleted";case"U":return"Untracked";default:return r}},hr=r=>{const s=Ke.has(r.hash),n=le[r.hash];return e.jsxs("div",{className:"border-b border-border last:border-0",children:[e.jsxs("div",{className:"flex items-start p-3 hover:bg-accent/50 cursor-pointer transition-colors",onClick:()=>dr(r.hash),children:[e.jsx("div",{className:"mr-2 mt-1 p-0.5 hover:bg-accent rounded",children:s?e.jsx(T,{className:"w-3 h-3"}):e.jsx(te,{className:"w-3 h-3"})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"flex items-start justify-between gap-2",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:r.message}),e.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:[r.author," • ",r.date]})]}),e.jsx("span",{className:"text-sm font-mono text-muted-foreground/60 flex-shrink-0",children:r.hash.substring(0,7)})]})})]}),s&&n&&e.jsx("div",{className:"bg-muted/50",children:e.jsxs("div",{className:"max-h-96 overflow-y-auto p-2",children:[e.jsx("div",{className:"text-sm font-mono text-muted-foreground mb-2",children:r.stats}),e.jsx(Ae,{diff:n,fileName:"commit",isMobile:i,wrapText:F})]})})]},r.hash)},J=(r,s)=>{const n=O.has(r),d=h.has(r),b=$[r];return e.jsxs("div",{className:"border-b border-border last:border-0",children:[e.jsxs("div",{className:`flex items-center hover:bg-accent/50 transition-colors ${i?"px-2 py-1.5":"px-3 py-2"}`,children:[e.jsx("input",{type:"checkbox",checked:d,onChange:()=>mr(r),onClick:f=>f.stopPropagation(),className:`rounded border-border text-primary focus:ring-primary/40 bg-background checked:bg-primary ${i?"mr-1.5":"mr-2"}`}),e.jsxs("div",{className:"flex items-center flex-1",children:[e.jsx("div",{className:`p-0.5 hover:bg-accent rounded cursor-pointer ${i?"mr-1":"mr-2"}`,onClick:f=>{f.stopPropagation(),lr(r)},children:e.jsx(te,{className:`w-3 h-3 transition-transform duration-200 ease-in-out ${n?"rotate-90":"rotate-0"}`})}),e.jsx("span",{className:`flex-1 truncate ${i?"text-xs":"text-sm"} cursor-pointer hover:text-primary hover:underline`,onClick:f=>{f.stopPropagation(),nr(r)},title:"Click to open file",children:r}),e.jsxs("div",{className:"flex items-center gap-1",children:[(s==="M"||s==="D")&&e.jsxs("button",{onClick:f=>{f.stopPropagation(),g({type:"discard",file:r,message:`Discard all changes to "${r}"? This action cannot be undone.`})},className:`${i?"px-2 py-1 text-xs":"p-1"} hover:bg-destructive/10 rounded text-destructive font-medium flex items-center gap-1`,title:"Discard changes",children:[e.jsx(W,{className:"w-3 h-3"}),i&&e.jsx("span",{children:"Discard"})]}),s==="U"&&e.jsxs("button",{onClick:f=>{f.stopPropagation(),g({type:"delete",file:r,message:`Delete untracked file "${r}"? This action cannot be undone.`})},className:`${i?"px-2 py-1 text-xs":"p-1"} hover:bg-destructive/10 rounded text-destructive font-medium flex items-center gap-1`,title:"Delete untracked file",children:[e.jsx(W,{className:"w-3 h-3"}),i&&e.jsx("span",{children:"Delete"})]}),e.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-[10px] font-bold border ${s==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/40 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800/50":s==="A"?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300 border-green-200 dark:border-green-800/50":s==="D"?"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300 border-red-200 dark:border-red-800/50":"bg-muted text-muted-foreground border-border"}`,title:we(s),children:s})]})]})]}),e.jsxs("div",{className:`bg-muted/50 transition-all duration-400 ease-in-out overflow-hidden ${n&&b?"max-h-[600px] opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-1"}`,children:[e.jsxs("div",{className:"flex items-center justify-between p-2 border-b border-border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 rounded text-[10px] font-bold border ${s==="M"?"bg-yellow-100 text-yellow-700 dark:bg-yellow-900/40 dark:text-yellow-300 border-yellow-200 dark:border-yellow-800/50":s==="A"?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300 border-green-200 dark:border-green-800/50":s==="D"?"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300 border-red-200 dark:border-red-800/50":"bg-muted text-muted-foreground border-border"}`,children:s}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:we(s)})]}),i&&e.jsx("button",{onClick:f=>{f.stopPropagation(),Je(!F)},className:"text-sm text-muted-foreground hover:text-foreground transition-colors",title:F?"Switch to horizontal scroll":"Switch to text wrap",children:F?"↔️ Scroll":"↩️ Wrap"})]}),e.jsx("div",{className:"max-h-96 overflow-y-auto",children:b&&e.jsx(Ae,{diff:b,fileName:r,isMobile:i,wrapText:F})})]})]},r)};return c?e.jsxs("div",{className:"h-full flex flex-col bg-background",children:[e.jsxs("div",{className:`flex items-center justify-between border-b border-border/60 ${i?"px-3 py-2":"px-4 py-3"}`,children:[e.jsxs("div",{className:"relative",ref:H,children:[e.jsxs("button",{onClick:()=>E(!V),className:`flex items-center hover:bg-accent rounded-lg transition-colors ${i?"space-x-1 px-2 py-1":"space-x-2 px-3 py-1.5"}`,children:[e.jsx(ee,{className:`text-muted-foreground ${i?"w-3 h-3":"w-4 h-4"}`}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("span",{className:`font-medium ${i?"text-xs":"text-sm"}`,children:y}),(a==null?void 0:a.hasRemote)&&e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[a.ahead>0&&e.jsxs("span",{className:"text-green-600 dark:text-green-400",title:`${a.ahead} commit${a.ahead!==1?"s":""} ahead`,children:["↑",a.ahead]}),a.behind>0&&e.jsxs("span",{className:"text-primary",title:`${a.behind} commit${a.behind!==1?"s":""} behind`,children:["↓",a.behind]}),a.isUpToDate&&e.jsx("span",{className:"text-muted-foreground",title:"Up to date with remote",children:"✓"})]})]}),e.jsx(T,{className:`w-3 h-3 text-muted-foreground transition-transform ${V?"rotate-180":""}`})]}),V&&e.jsxs("div",{className:"absolute top-full left-0 mt-1 w-64 bg-card rounded-xl shadow-lg border border-border z-50 overflow-hidden",children:[e.jsx("div",{className:"py-1 max-h-64 overflow-y-auto",children:Ge.map(r=>e.jsx("button",{onClick:()=>Ze(r),className:`w-full text-left px-4 py-2 text-sm hover:bg-accent transition-colors ${r===y?"bg-accent/50 text-foreground":"text-muted-foreground"}`,children:e.jsxs("div",{className:"flex items-center space-x-2",children:[r===y&&e.jsx(re,{className:"w-3 h-3 text-primary"}),e.jsx("span",{className:r===y?"font-medium":"",children:r})]})},r))}),e.jsx("div",{className:"border-t border-border py-1",children:e.jsxs("button",{onClick:()=>{A(!0),E(!1)},className:"w-full text-left px-4 py-2 text-sm hover:bg-accent transition-colors flex items-center space-x-2",children:[e.jsx(Ue,{className:"w-3 h-3"}),e.jsx("span",{children:"Create new branch"})]})})]})]}),e.jsxs("div",{className:`flex items-center ${i?"gap-1":"gap-2"}`,children:[(a==null?void 0:a.hasRemote)&&e.jsxs(e.Fragment,{children:[!(a!=null&&a.hasUpstream)&&e.jsxs("button",{onClick:()=>g({type:"publish",message:`Publish branch "${y}" to ${a.remoteName}?`}),disabled:Z,className:"px-2.5 py-1 text-sm bg-purple-600 text-white rounded-lg hover:bg-purple-700 disabled:opacity-50 flex items-center gap-1 transition-colors",title:`Publish branch "${y}" to ${a.remoteName}`,children:[e.jsx(L,{className:`w-3 h-3 ${Z?"animate-pulse":""}`}),e.jsx("span",{children:Z?"Publishing...":"Publish"})]}),(a==null?void 0:a.hasUpstream)&&!(a!=null&&a.isUpToDate)&&e.jsxs(e.Fragment,{children:[a.behind>0&&e.jsxs("button",{onClick:()=>g({type:"pull",message:`Pull ${a.behind} commit${a.behind!==1?"s":""} from ${a.remoteName}?`}),disabled:X,className:"px-2.5 py-1 text-sm bg-green-600 text-white rounded-lg hover:bg-green-700 disabled:opacity-50 flex items-center gap-1 transition-colors",title:`Pull ${a.behind} commit${a.behind!==1?"s":""} from ${a.remoteName}`,children:[e.jsx(Oe,{className:`w-3 h-3 ${X?"animate-pulse":""}`}),e.jsx("span",{children:X?"Pulling...":`Pull ${a.behind}`})]}),a.ahead>0&&e.jsxs("button",{onClick:()=>g({type:"push",message:`Push ${a.ahead} commit${a.ahead!==1?"s":""} to ${a.remoteName}?`}),disabled:Y,className:"px-2.5 py-1 text-sm bg-orange-600 text-white rounded-lg hover:bg-orange-700 disabled:opacity-50 flex items-center gap-1 transition-colors",title:`Push ${a.ahead} commit${a.ahead!==1?"s":""} to ${a.remoteName}`,children:[e.jsx(L,{className:`w-3 h-3 ${Y?"animate-pulse":""}`}),e.jsx("span",{children:Y?"Pushing...":`Push ${a.ahead}`})]}),(a.ahead>0||a.behind>0&&a.ahead>0)&&e.jsxs("button",{onClick:He,disabled:Q,className:"px-2.5 py-1 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 disabled:opacity-50 flex items-center gap-1 transition-colors",title:`Fetch from ${a.remoteName}`,children:[e.jsx(N,{className:`w-3 h-3 ${Q?"animate-spin":""}`}),e.jsx("span",{children:Q?"Fetching...":"Fetch"})]})]})]}),e.jsx("button",{onClick:()=>{p(),M(),w()},disabled:C,className:`hover:bg-accent rounded-lg transition-colors ${i?"p-1":"p-1.5"}`,children:e.jsx(N,{className:`text-muted-foreground ${C?"animate-spin":""} ${i?"w-3 h-3":"w-4 h-4"}`})})]})]}),t!=null&&t.error?e.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center text-muted-foreground px-6 py-12",children:[e.jsx("div",{className:"w-16 h-16 rounded-2xl bg-muted/50 flex items-center justify-center mb-6",children:e.jsx(ee,{className:"w-8 h-8 opacity-40"})}),e.jsx("h3",{className:"text-lg font-medium mb-3 text-center text-foreground",children:t.error}),t.details&&e.jsx("p",{className:"text-sm text-center leading-relaxed mb-6 max-w-md",children:t.details}),e.jsx("div",{className:"p-4 bg-primary/5 rounded-xl border border-primary/10 max-w-md",children:e.jsxs("p",{className:"text-sm text-primary text-center",children:[e.jsx("strong",{children:"Tip:"})," Run ",e.jsx("code",{className:"bg-primary/10 px-2 py-1 rounded-md font-mono text-xs",children:"git init"})," in your project directory to initialize git source control."]})})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`flex border-b border-border/60 transition-all duration-300 ease-in-out ${O.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[e.jsx("button",{onClick:()=>ie("changes"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${j==="changes"?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(ur,{className:"w-4 h-4"}),e.jsx("span",{children:"Changes"})]})}),e.jsx("button",{onClick:()=>ie("history"),className:`flex-1 px-4 py-2 text-sm font-medium transition-colors ${j==="history"?"text-primary border-b-2 border-primary":"text-muted-foreground hover:text-foreground"}`,children:e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(ze,{className:"w-4 h-4"}),e.jsx("span",{children:"History"})]})})]}),j==="changes"&&e.jsx(e.Fragment,{children:e.jsx("div",{className:`transition-all duration-300 ease-in-out ${O.size===0?"max-h-96 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:i&&qe?e.jsx("div",{className:"px-4 py-2 border-b border-border/60",children:e.jsxs("button",{onClick:()=>ue(!1),className:"w-full flex items-center justify-center gap-2 px-3 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 transition-colors",children:[e.jsx(se,{className:"w-4 h-4"}),e.jsxs("span",{children:["Commit ",h.size," file",h.size!==1?"s":""]}),e.jsx(T,{className:"w-3 h-3"})]})}):e.jsx(e.Fragment,{children:e.jsxs("div",{className:"px-4 py-3 border-b border-border/60",children:[i&&e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("span",{className:"text-sm font-medium text-foreground",children:"Commit Changes"}),e.jsx("button",{onClick:()=>ue(!0),className:"p-1 hover:bg-accent rounded-lg transition-colors",children:e.jsx(T,{className:"w-4 h-4 rotate-180"})})]}),e.jsxs("div",{className:"relative",children:[e.jsx("textarea",{ref:Qe,value:S,onChange:r=>U(r.target.value),placeholder:"Message (Ctrl+Enter to commit)",className:"w-full px-3 py-2 text-sm border border-border rounded-xl bg-background text-foreground placeholder:text-muted-foreground resize-none pr-20 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30",rows:"3",onKeyDown:r=>{r.key==="Enter"&&(r.ctrlKey||r.metaKey)&&je()}}),e.jsxs("div",{className:"absolute right-2 top-2 flex gap-1",children:[e.jsx("button",{onClick:cr,disabled:h.size===0||de,className:"p-1.5 text-muted-foreground hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed transition-colors",title:"Generate commit message",children:de?e.jsx(N,{className:"w-4 h-4 animate-spin"}):e.jsx(gr,{className:"w-4 h-4"})}),e.jsx("div",{style:{display:"none"},children:e.jsx(pr,{onTranscript:r=>U(r),mode:"default",className:"p-1.5"})})]})]}),e.jsxs("div",{className:"flex items-center justify-between mt-2",children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h.size," file",h.size!==1?"s":""," selected"]}),e.jsxs("button",{onClick:()=>g({type:"commit",message:`Commit ${h.size} file${h.size!==1?"s":""} with message: "${S.trim()}"?`}),disabled:!S.trim()||h.size===0||ae,className:"px-3 py-1.5 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1 transition-colors",children:[e.jsx(re,{className:"w-3 h-3"}),e.jsx("span",{children:ae?"Committing...":"Commit"})]})]})]})})})}),j==="changes"&&t&&!t.error&&e.jsxs("div",{className:`border-b border-border/60 flex items-center justify-between transition-all duration-300 ease-in-out ${i?"px-3 py-1.5":"px-4 py-2"} ${O.size===0?"max-h-16 opacity-100 translate-y-0":"max-h-0 opacity-0 -translate-y-2 overflow-hidden"}`,children:[e.jsxs("span",{className:"text-sm text-muted-foreground",children:[h.size," of ",(((Ne=t==null?void 0:t.modified)==null?void 0:Ne.length)||0)+(((ve=t==null?void 0:t.added)==null?void 0:ve.length)||0)+(((Ce=t==null?void 0:t.deleted)==null?void 0:Ce.length)||0)+(((ke=t==null?void 0:t.untracked)==null?void 0:ke.length)||0)," ",i?"":"files"," selected"]}),e.jsxs("div",{className:`flex ${i?"gap-1":"gap-2"}`,children:[e.jsx("button",{onClick:()=>{const r=new Set([...(t==null?void 0:t.modified)||[],...(t==null?void 0:t.added)||[],...(t==null?void 0:t.deleted)||[],...(t==null?void 0:t.untracked)||[]]);u(r)},className:"text-sm text-primary hover:text-primary/80 transition-colors",children:i?"All":"Select All"}),e.jsx("span",{className:"text-border",children:"|"}),e.jsx("button",{onClick:()=>u(new Set),className:"text-sm text-primary hover:text-primary/80 transition-colors",children:i?"None":"Deselect All"})]})]}),!(t!=null&&t.error)&&!i&&e.jsxs("div",{className:"border-b border-border/60",children:[e.jsxs("button",{onClick:()=>Le(!K),className:"w-full px-4 py-2 bg-muted/30 hover:bg-muted/50 text-sm text-muted-foreground flex items-center justify-center gap-1 transition-colors",children:[e.jsx(br,{className:"w-3 h-3"}),e.jsx("span",{children:"File Status Guide"}),K?e.jsx(T,{className:"w-3 h-3"}):e.jsx(te,{className:"w-3 h-3"})]}),K&&e.jsx("div",{className:"px-4 py-3 bg-muted/30 text-sm",children:e.jsxs("div",{className:`${i?"grid grid-cols-2 gap-3 justify-items-center":"flex justify-center gap-6"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-yellow-100 text-yellow-700 dark:bg-yellow-900/40 dark:text-yellow-300 rounded border border-yellow-200 dark:border-yellow-800/50 font-bold text-[10px]",children:"M"}),e.jsx("span",{className:"text-muted-foreground italic",children:"Modified"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300 rounded border border-green-200 dark:border-green-800/50 font-bold text-[10px]",children:"A"}),e.jsx("span",{className:"text-muted-foreground italic",children:"Added"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300 rounded border border-red-200 dark:border-red-800/50 font-bold text-[10px]",children:"D"}),e.jsx("span",{className:"text-muted-foreground italic",children:"Deleted"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-flex items-center justify-center w-5 h-5 bg-muted text-muted-foreground rounded border border-border font-bold text-[10px]",children:"U"}),e.jsx("span",{className:"text-muted-foreground italic",children:"Untracked"})]})]})})]})]}),j==="changes"&&!(t!=null&&t.error)&&e.jsx("div",{className:`flex-1 overflow-y-auto ${i?"pb-mobile-nav":""}`,children:C?e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx(N,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):(t==null?void 0:t.hasCommits)===!1?e.jsxs("div",{className:"flex flex-col items-center justify-center p-8 text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-muted/50 flex items-center justify-center mb-4",children:e.jsx(ee,{className:"w-7 h-7 text-muted-foreground/50"})}),e.jsx("h3",{className:"text-lg font-medium mb-2 text-foreground",children:"No commits yet"}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6 max-w-md",children:"This repository doesn't have any commits yet. Create your first commit to start tracking changes."}),e.jsx("button",{onClick:xr,disabled:ge,className:"px-4 py-2 bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 transition-colors",children:ge?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-4 h-4 animate-spin"}),e.jsx("span",{children:"Creating Initial Commit..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(se,{className:"w-4 h-4"}),e.jsx("span",{children:"Create Initial Commit"})]})})]}):!t||!(($e=t.modified)!=null&&$e.length)&&!((Se=t.added)!=null&&Se.length)&&!((Fe=t.deleted)!=null&&Fe.length)&&!((Ee=t.untracked)!=null&&Ee.length)?e.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-muted-foreground",children:[e.jsx(se,{className:"w-10 h-10 mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No changes detected"})]}):e.jsxs("div",{className:i?"pb-4":"",children:[(De=t.modified)==null?void 0:De.map(r=>J(r,"M")),(Te=t.added)==null?void 0:Te.map(r=>J(r,"A")),(Ie=t.deleted)==null?void 0:Ie.map(r=>J(r,"D")),(Re=t.untracked)==null?void 0:Re.map(r=>J(r,"U"))]})}),j==="history"&&!(t!=null&&t.error)&&e.jsx("div",{className:`flex-1 overflow-y-auto ${i?"pb-mobile-nav":""}`,children:C?e.jsx("div",{className:"flex items-center justify-center h-32",children:e.jsx(N,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):ce.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center h-32 text-muted-foreground",children:[e.jsx(ze,{className:"w-10 h-10 mb-2 opacity-40"}),e.jsx("p",{className:"text-sm",children:"No commits found"})]}):e.jsx("div",{className:i?"pb-4":"",children:ce.map(r=>hr(r))})}),We&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>A(!1)}),e.jsx("div",{className:"relative bg-card border border-border rounded-xl shadow-2xl max-w-md w-full overflow-hidden",children:e.jsxs("div",{className:"p-6",children:[e.jsx("h3",{className:"text-lg font-semibold text-foreground mb-4",children:"Create New Branch"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"block text-sm font-medium text-foreground/80 mb-2",children:"Branch Name"}),e.jsx("input",{type:"text",value:D,onChange:r=>_(r.target.value),onKeyDown:r=>{r.key==="Enter"&&!q&&ye()},placeholder:"feature/new-feature",className:"w-full px-3 py-2 border border-border rounded-xl bg-background text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30",autoFocus:!0})]}),e.jsxs("div",{className:"text-sm text-muted-foreground mb-4",children:["This will create a new branch from the current branch (",y,")"]}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:()=>{A(!1),_("")},className:"px-4 py-2 text-sm text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",children:"Cancel"}),e.jsx("button",{onClick:ye,disabled:!D.trim()||q,className:"px-4 py-2 text-sm bg-primary text-primary-foreground rounded-lg hover:bg-primary/90 disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-2 transition-colors",children:q?e.jsxs(e.Fragment,{children:[e.jsx(N,{className:"w-3 h-3 animate-spin"}),e.jsx("span",{children:"Creating..."})]}):e.jsxs(e.Fragment,{children:[e.jsx(Ue,{className:"w-3 h-3"}),e.jsx("span",{children:"Create Branch"})]})})]})]})})]}),l&&e.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[e.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm",onClick:()=>g(null)}),e.jsx("div",{className:"relative bg-card border border-border rounded-xl shadow-2xl max-w-md w-full overflow-hidden",children:e.jsxs("div",{className:"p-6",children:[e.jsxs("div",{className:"flex items-center mb-4",children:[e.jsx("div",{className:`p-2 rounded-full mr-3 ${l.type==="discard"||l.type==="delete"?"bg-red-100 dark:bg-red-900/30":"bg-yellow-100 dark:bg-yellow-900/30"}`,children:e.jsx(yr,{className:`w-5 h-5 ${l.type==="discard"||l.type==="delete"?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`})}),e.jsx("h3",{className:"text-lg font-semibold text-foreground",children:l.type==="discard"?"Discard Changes":l.type==="delete"?"Delete File":l.type==="commit"?"Confirm Commit":l.type==="pull"?"Confirm Pull":l.type==="publish"?"Publish Branch":"Confirm Push"})]}),e.jsx("p",{className:"text-sm text-muted-foreground mb-6",children:l.message}),e.jsxs("div",{className:"flex justify-end space-x-3",children:[e.jsx("button",{onClick:()=>g(null),className:"px-4 py-2 text-sm text-muted-foreground hover:text-foreground hover:bg-accent rounded-lg transition-colors",children:"Cancel"}),e.jsx("button",{onClick:ar,className:`px-4 py-2 text-sm text-white rounded-lg transition-colors ${l.type==="discard"||l.type==="delete"?"bg-red-600 hover:bg-red-700":l.type==="commit"?"bg-primary hover:bg-primary/90":l.type==="pull"?"bg-green-600 hover:bg-green-700":l.type==="publish"?"bg-purple-600 hover:bg-purple-700":"bg-orange-600 hover:bg-orange-700"} flex items-center space-x-2`,children:l.type==="discard"?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4"}),e.jsx("span",{children:"Discard"})]}):l.type==="delete"?e.jsxs(e.Fragment,{children:[e.jsx(W,{className:"w-4 h-4"}),e.jsx("span",{children:"Delete"})]}):l.type==="commit"?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"w-4 h-4"}),e.jsx("span",{children:"Commit"})]}):l.type==="pull"?e.jsxs(e.Fragment,{children:[e.jsx(Oe,{className:"w-4 h-4"}),e.jsx("span",{children:"Pull"})]}):l.type==="publish"?e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-4 h-4"}),e.jsx("span",{children:"Publish"})]}):e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"w-4 h-4"}),e.jsx("span",{children:"Push"})]})})]})]})})]})]}):e.jsx("div",{className:"h-full flex items-center justify-center text-muted-foreground",children:e.jsx("p",{children:"Select a project to view source control"})})}export{Ir as default};
@@ -1,4 +1,4 @@
1
- import{r as n,j as e}from"./vendor-react-96lCPsRK.js";import{i as ge,R as ye,j as be,k as we,f as ie,W as Ne,I as je}from"./index-C5ptjuTl.js";import{x as ve,a as Ce,b as ke,c as Se}from"./vendor-xterm-CZq1hqo1.js";import{O as Le}from"./vendor-canvas-D39yWul6.js";import{X as Te}from"./vendor-icons-BaD0x9SL.js";const Re=(t,r,a,p)=>{var s,w,C,d;const g=[a,{code:r,...p||{}}];if((w=(s=t==null?void 0:t.services)==null?void 0:s.logger)!=null&&w.forward)return t.services.logger.forward(g,"warn","react-i18next::",!0);F(g[0])&&(g[0]=`react-i18next:: ${g[0]}`),(d=(C=t==null?void 0:t.services)==null?void 0:C.logger)!=null&&d.warn?t.services.logger.warn(...g):console!=null&&console.warn&&console.warn(...g)},se={},ue=(t,r,a,p)=>{F(a)&&se[a]||(F(a)&&(se[a]=new Date),Re(t,r,a,p))},de=(t,r)=>()=>{if(t.isInitialized)r();else{const a=()=>{setTimeout(()=>{t.off("initialized",a)},0),r()};t.on("initialized",a)}},Z=(t,r,a)=>{t.loadNamespaces(r,de(t,a))},le=(t,r,a,p)=>{if(F(a)&&(a=[a]),t.options.preload&&t.options.preload.indexOf(r)>-1)return Z(t,a,p);a.forEach(g=>{t.options.ns.indexOf(g)<0&&t.options.ns.push(g)}),t.loadLanguages(r,de(t,p))},Ee=(t,r,a={})=>!r.languages||!r.languages.length?(ue(r,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:r.languages}),!0):r.hasLoadedNamespace(t,{lng:a.lng,precheck:(p,g)=>{if(a.bindI18n&&a.bindI18n.indexOf("languageChanging")>-1&&p.services.backendConnector.backend&&p.isLanguageChangingTo&&!g(p.isLanguageChangingTo,t))return!1}}),F=t=>typeof t=="string",Oe=t=>typeof t=="object"&&t!==null;var Ie=Le();const Ae=(t,r)=>F(r)?r:Oe(r)&&F(r.defaultValue)?r.defaultValue:Array.isArray(t)?t[t.length-1]:t,Me={t:Ae,ready:!1},_e=()=>()=>{},Pe=(t,r={})=>{var H,i,S;const{i18n:a}=r,{i18n:p,defaultNS:g}=n.useContext(ge)||{},s=a||p||we();s&&!s.reportNamespaces&&(s.reportNamespaces=new ye),s||ue(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const w=n.useMemo(()=>{var l;return{...be(),...(l=s==null?void 0:s.options)==null?void 0:l.react,...r}},[s,r]),{useSuspense:C,keyPrefix:d}=w,L=t||g||((H=s==null?void 0:s.options)==null?void 0:H.defaultNS),c=F(L)?[L]:L||["translation"],h=n.useMemo(()=>c,c);(S=(i=s==null?void 0:s.reportNamespaces)==null?void 0:i.addUsedNamespaces)==null||S.call(i,h);const u=n.useRef(0),k=n.useCallback(l=>{if(!s)return _e;const{bindI18n:f,bindI18nStore:x}=w,m=()=>{u.current+=1,l()};return f&&s.on(f,m),x&&s.store.on(x,m),()=>{f&&f.split(" ").forEach(_=>s.off(_,m)),x&&x.split(" ").forEach(_=>s.store.off(_,m))}},[s,w]),O=n.useRef(),y=n.useCallback(()=>{if(!s)return Me;const l=!!(s.isInitialized||s.initializedStoreOnce)&&h.every(P=>Ee(P,s,w)),f=r.lng||s.language,x=u.current,m=O.current;if(m&&m.ready===l&&m.lng===f&&m.keyPrefix===d&&m.revision===x)return m;const D={t:s.getFixedT(f,w.nsMode==="fallback"?h:h[0],d),ready:l,lng:f,keyPrefix:d,revision:x};return O.current=D,D},[s,h,d,w,r.lng]),[B,M]=n.useState(0),{t:I,ready:E}=Ie.useSyncExternalStore(k,y,y);n.useEffect(()=>{if(s&&!E&&!C){const l=()=>M(f=>f+1);r.lng?le(s,r.lng,h,l):Z(s,h,l)}},[s,r.lng,h,E,C,B]);const A=s||{},v=n.useRef(null),R=n.useRef(),U=l=>{const f=Object.getOwnPropertyDescriptors(l);f.__original&&delete f.__original;const x=Object.create(Object.getPrototypeOf(l),f);if(!Object.prototype.hasOwnProperty.call(x,"__original"))try{Object.defineProperty(x,"__original",{value:l,writable:!1,enumerable:!1,configurable:!1})}catch{}return x},T=n.useMemo(()=>{const l=A,f=l==null?void 0:l.language;let x=l;l&&(v.current&&v.current.__original===l?R.current!==f?(x=U(l),v.current=x,R.current=f):x=v.current:(x=U(l),v.current=x,R.current=f));const m=[I,x,E];return m.t=I,m.i18n=x,m.ready=E,m},[I,A,E,A.resolvedLanguage,A.language,A.languages]);if(s&&C&&!E)throw new Promise(l=>{const f=()=>l();r.lng?le(s,r.lng,h,f):Z(s,h,f)});return T},$e=({className:t="w-5 h-5"})=>e.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:t}),Ke=({className:t="w-5 h-5"})=>{const{isDarkMode:r}=ie();return e.jsx("img",{src:r?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:t})},Je=({className:t="w-5 h-5"})=>{const{isDarkMode:r}=ie();return e.jsx("img",{src:r?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:t})},We=`
1
+ import{r as n,j as e}from"./vendor-react-96lCPsRK.js";import{j as ye,R as be,k as we,m as Ne,f as ue,W as se,I as je}from"./index-HaY-3pK1.js";import{x as ve,a as Ce,b as ke,c as Se}from"./vendor-xterm-CZq1hqo1.js";import{O as Le}from"./vendor-canvas-DvHJ_Pn2.js";import{X as Te}from"./vendor-icons-GyYE35HP.js";const Re=(t,r,a,p)=>{var s,N,C,d;const g=[a,{code:r,...p||{}}];if((N=(s=t==null?void 0:t.services)==null?void 0:s.logger)!=null&&N.forward)return t.services.logger.forward(g,"warn","react-i18next::",!0);F(g[0])&&(g[0]=`react-i18next:: ${g[0]}`),(d=(C=t==null?void 0:t.services)==null?void 0:C.logger)!=null&&d.warn?t.services.logger.warn(...g):console!=null&&console.warn&&console.warn(...g)},le={},de=(t,r,a,p)=>{F(a)&&le[a]||(F(a)&&(le[a]=new Date),Re(t,r,a,p))},fe=(t,r)=>()=>{if(t.isInitialized)r();else{const a=()=>{setTimeout(()=>{t.off("initialized",a)},0),r()};t.on("initialized",a)}},Z=(t,r,a)=>{t.loadNamespaces(r,fe(t,a))},ae=(t,r,a,p)=>{if(F(a)&&(a=[a]),t.options.preload&&t.options.preload.indexOf(r)>-1)return Z(t,a,p);a.forEach(g=>{t.options.ns.indexOf(g)<0&&t.options.ns.push(g)}),t.loadLanguages(r,fe(t,p))},Ee=(t,r,a={})=>!r.languages||!r.languages.length?(de(r,"NO_LANGUAGES","i18n.languages were undefined or empty",{languages:r.languages}),!0):r.hasLoadedNamespace(t,{lng:a.lng,precheck:(p,g)=>{if(a.bindI18n&&a.bindI18n.indexOf("languageChanging")>-1&&p.services.backendConnector.backend&&p.isLanguageChangingTo&&!g(p.isLanguageChangingTo,t))return!1}}),F=t=>typeof t=="string",Oe=t=>typeof t=="object"&&t!==null;var Ie=Le();const Ae=(t,r)=>F(r)?r:Oe(r)&&F(r.defaultValue)?r.defaultValue:Array.isArray(t)?t[t.length-1]:t,Me={t:Ae,ready:!1},_e=()=>()=>{},Pe=(t,r={})=>{var H,i,S;const{i18n:a}=r,{i18n:p,defaultNS:g}=n.useContext(ye)||{},s=a||p||Ne();s&&!s.reportNamespaces&&(s.reportNamespaces=new be),s||de(s,"NO_I18NEXT_INSTANCE","useTranslation: You will need to pass in an i18next instance by using initReactI18next");const N=n.useMemo(()=>{var l;return{...we(),...(l=s==null?void 0:s.options)==null?void 0:l.react,...r}},[s,r]),{useSuspense:C,keyPrefix:d}=N,L=t||g||((H=s==null?void 0:s.options)==null?void 0:H.defaultNS),c=F(L)?[L]:L||["translation"],h=n.useMemo(()=>c,c);(S=(i=s==null?void 0:s.reportNamespaces)==null?void 0:i.addUsedNamespaces)==null||S.call(i,h);const u=n.useRef(0),k=n.useCallback(l=>{if(!s)return _e;const{bindI18n:f,bindI18nStore:x}=N,m=()=>{u.current+=1,l()};return f&&s.on(f,m),x&&s.store.on(x,m),()=>{f&&f.split(" ").forEach(_=>s.off(_,m)),x&&x.split(" ").forEach(_=>s.store.off(_,m))}},[s,N]),O=n.useRef(),b=n.useCallback(()=>{if(!s)return Me;const l=!!(s.isInitialized||s.initializedStoreOnce)&&h.every(P=>Ee(P,s,N)),f=r.lng||s.language,x=u.current,m=O.current;if(m&&m.ready===l&&m.lng===f&&m.keyPrefix===d&&m.revision===x)return m;const $={t:s.getFixedT(f,N.nsMode==="fallback"?h:h[0],d),ready:l,lng:f,keyPrefix:d,revision:x};return O.current=$,$},[s,h,d,N,r.lng]),[B,M]=n.useState(0),{t:I,ready:E}=Ie.useSyncExternalStore(k,b,b);n.useEffect(()=>{if(s&&!E&&!C){const l=()=>M(f=>f+1);r.lng?ae(s,r.lng,h,l):Z(s,h,l)}},[s,r.lng,h,E,C,B]);const A=s||{},v=n.useRef(null),R=n.useRef(),U=l=>{const f=Object.getOwnPropertyDescriptors(l);f.__original&&delete f.__original;const x=Object.create(Object.getPrototypeOf(l),f);if(!Object.prototype.hasOwnProperty.call(x,"__original"))try{Object.defineProperty(x,"__original",{value:l,writable:!1,enumerable:!1,configurable:!1})}catch{}return x},T=n.useMemo(()=>{const l=A,f=l==null?void 0:l.language;let x=l;l&&(v.current&&v.current.__original===l?R.current!==f?(x=U(l),v.current=x,R.current=f):x=v.current:(x=U(l),v.current=x,R.current=f));const m=[I,x,E];return m.t=I,m.i18n=x,m.ready=E,m},[I,A,E,A.resolvedLanguage,A.language,A.languages]);if(s&&C&&!E)throw new Promise(l=>{const f=()=>l();r.lng?ae(s,r.lng,h,f):Z(s,h,f)});return T},De=({className:t="w-5 h-5"})=>e.jsx("img",{src:"/icons/claude-ai-icon.svg",alt:"Claude",className:t}),Ke=({className:t="w-5 h-5"})=>{const{isDarkMode:r}=ue();return e.jsx("img",{src:r?"/icons/cursor-white.svg":"/icons/cursor.svg",alt:"Cursor",className:t})},Je=({className:t="w-5 h-5"})=>{const{isDarkMode:r}=ue();return e.jsx("img",{src:r?"/icons/codex-white.svg":"/icons/codex.svg",alt:"Codex",className:t})},We=`
2
2
  .xterm .xterm-screen {
3
3
  outline: none !important;
4
4
  }
@@ -8,6 +8,6 @@ import{r as n,j as e}from"./vendor-react-96lCPsRK.js";import{i as ge,R as ye,j a
8
8
  .xterm-screen:focus {
9
9
  outline: none !important;
10
10
  }
11
- `;if(typeof document<"u"){const t=document.createElement("style");t.type="text/css",t.innerText=We,document.head.appendChild(t)}function Ue(t){if(!t||typeof document>"u")return!1;const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r),r.focus(),r.select();let a=!1;try{a=document.execCommand("copy")}catch{a=!1}finally{document.body.removeChild(r)}return a}const ae="https://auth.openai.com/codex/device";function oe(t){return typeof t=="string"&&/\bcodex\s+login\b/i.test(t)}function ce({selectedProject:t,selectedSession:r,initialCommand:a,isPlainShell:p=!1,onProcessComplete:g,minimal:s=!1,autoConnect:w=!1,shellType:C=null}){const{t:d}=Pe("chat"),L=n.useRef(null),c=n.useRef(null),h=n.useRef(null),u=n.useRef(null),[k,O]=n.useState(!1),[y,B]=n.useState(!1),[M,I]=n.useState(!1),[E,A]=n.useState(null),[v,R]=n.useState(!1),[U,T]=n.useState(null),[H,i]=n.useState(""),[S,l]=n.useState("idle"),[f,x]=n.useState(!1),m=n.useRef(t),_=n.useRef(r),D=n.useRef(a),P=n.useRef(p),ee=n.useRef(C),G=n.useRef(g),z=n.useRef("");n.useEffect(()=>{m.current=t,_.current=r,D.current=a,P.current=p,ee.current=C,G.current=g});const te=n.useCallback((b=z.current)=>{if(!b)return!1;const j=window.open(b,"_blank","noopener,noreferrer");if(j){try{j.opener=null}catch{}return!0}return!1},[]),X=n.useCallback(async(b=z.current)=>{var N;if(!b)return!1;let j=!1;try{typeof navigator<"u"&&((N=navigator.clipboard)!=null&&N.writeText)&&(await navigator.clipboard.writeText(b),j=!0)}catch{j=!1}return j||(j=Ue(b)),j},[]),re=n.useCallback(async()=>{if(!(v||k)){T(null);try{let b;Ne||(b=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/shell`),u.current=new WebSocket(b);const j=setTimeout(()=>{u.current&&u.current.readyState!==WebSocket.OPEN&&(u.current.close(),R(!1),T("Connection timed out. Check your relay connection (uc connect)."))},15e3);u.current.onopen=()=>{clearTimeout(j),O(!0),R(!1),T(null),z.current="",i(""),l("idle"),x(!1),setTimeout(()=>{var N,o;h.current&&c.current&&(h.current.fit(),u.current.send(JSON.stringify({type:"init",projectPath:m.current.fullPath||m.current.path,sessionId:P.current?null:(N=_.current)==null?void 0:N.id,hasSession:P.current?!1:!!_.current,provider:P.current?"plain-shell":((o=_.current)==null?void 0:o.__provider)||"claude",cols:c.current.cols,rows:c.current.rows,initialCommand:D.current,isPlainShell:P.current,shellType:ee.current})))},100)},u.current.onmessage=N=>{try{const o=JSON.parse(N.data);if(o.type==="output"){let W=o.data;if(P.current&&G.current){const K=W.replace(/\x1b\[[0-9;]*m/g,"");if(K.includes("Process exited with code 0"))G.current(0);else if(K.match(/Process exited with code (\d+)/)){const J=parseInt(K.match(/Process exited with code (\d+)/)[1]);J!==0&&G.current(J)}}c.current&&c.current.write(W)}else o.type==="error"?(T(o.message||"Connection error"),c.current&&c.current.write(`\r
11
+ `;if(typeof document<"u"){const t=document.createElement("style");t.type="text/css",t.innerText=We,document.head.appendChild(t)}function Ue(t){if(!t||typeof document>"u")return!1;const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.style.position="fixed",r.style.opacity="0",r.style.pointerEvents="none",document.body.appendChild(r),r.focus(),r.select();let a=!1;try{a=document.execCommand("copy")}catch{a=!1}finally{document.body.removeChild(r)}return a}const oe="https://auth.openai.com/codex/device";function ce(t){return typeof t=="string"&&/\bcodex\s+login\b/i.test(t)}function ie({selectedProject:t,selectedSession:r,initialCommand:a,isPlainShell:p=!1,onProcessComplete:g,minimal:s=!1,autoConnect:N=!1,shellType:C=null}){const{t:d}=Pe("chat"),L=n.useRef(null),c=n.useRef(null),h=n.useRef(null),u=n.useRef(null),[k,O]=n.useState(!1),[b,B]=n.useState(!1),[M,I]=n.useState(!1),[E,A]=n.useState(null),[v,R]=n.useState(!1),[U,T]=n.useState(null),[H,i]=n.useState(""),[S,l]=n.useState("idle"),[f,x]=n.useState(!1),m=n.useRef(t),_=n.useRef(r),$=n.useRef(a),P=n.useRef(p),ee=n.useRef(C),G=n.useRef(g),z=n.useRef("");n.useEffect(()=>{m.current=t,_.current=r,$.current=a,P.current=p,ee.current=C,G.current=g});const te=n.useCallback((y=z.current)=>{if(!y)return!1;const j=window.open(y,"_blank","noopener,noreferrer");if(j){try{j.opener=null}catch{}return!0}return!1},[]),X=n.useCallback(async(y=z.current)=>{var w;if(!y)return!1;let j=!1;try{typeof navigator<"u"&&((w=navigator.clipboard)!=null&&w.writeText)&&(await navigator.clipboard.writeText(y),j=!0)}catch{j=!1}return j||(j=Ue(y)),j},[]),re=n.useCallback(async()=>{if(!(v||k)){T(null);try{let y;se?y=`${se.replace(/^http/,"ws")}/shell`:y=`${window.location.protocol==="https:"?"wss:":"ws:"}//${window.location.host}/shell`,u.current=new WebSocket(y);const j=setTimeout(()=>{u.current&&u.current.readyState!==WebSocket.OPEN&&(u.current.close(),R(!1),T("Connection timed out. Check your relay connection (uc connect)."))},15e3);u.current.onopen=()=>{clearTimeout(j),O(!0),R(!1),T(null),z.current="",i(""),l("idle"),x(!1),setTimeout(()=>{var w,o;h.current&&c.current&&(h.current.fit(),u.current.send(JSON.stringify({type:"init",projectPath:m.current.fullPath||m.current.path,sessionId:P.current?null:(w=_.current)==null?void 0:w.id,hasSession:P.current?!1:!!_.current,provider:P.current?"plain-shell":((o=_.current)==null?void 0:o.__provider)||"claude",cols:c.current.cols,rows:c.current.rows,initialCommand:$.current,isPlainShell:P.current,shellType:ee.current})))},100)},u.current.onmessage=w=>{try{const o=JSON.parse(w.data);if(o.type==="output"){let W=o.data;if(P.current&&G.current){const K=W.replace(/\x1b\[[0-9;]*m/g,"");if(K.includes("Process exited with code 0"))G.current(0);else if(K.match(/Process exited with code (\d+)/)){const J=parseInt(K.match(/Process exited with code (\d+)/)[1]);J!==0&&G.current(J)}}c.current&&c.current.write(W)}else o.type==="error"?(T(o.message||"Connection error"),c.current&&c.current.write(`\r
12
12
  \x1B[31m${o.message||"Connection error"}\x1B[0m\r
13
- `)):(o.type==="auth_url"&&o.url||o.type==="url_open"&&o.url)&&(z.current=o.url,i(o.url),l("idle"),x(!1))}catch{}},u.current.onclose=N=>{clearTimeout(j);const o=k;O(!1),R(!1),l("idle"),x(!1),N.code===1006||N.code===4001?T("Connection lost. Your local machine may be offline."):(N.code===4003||N.code===1008)&&T("Authentication failed. Please log in again."),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H"))},u.current.onerror=()=>{clearTimeout(j),O(!1),R(!1),T("Failed to connect. Check that your relay is running (uc connect).")}}catch{O(!1),R(!1),T("Failed to establish connection.")}}},[v,k,te]),q=n.useCallback(()=>{!y||k||v||(R(!0),T(null),re())},[y,k,v,re]),V=n.useCallback(()=>{u.current&&(u.current.close(),u.current=null),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H")),O(!1),R(!1),T(null),z.current="",i(""),l("idle"),x(!1)},[]),$=n.useMemo(()=>r?r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session":null,[r]),xe=n.useMemo(()=>$?$.slice(0,30):null,[$]),he=n.useMemo(()=>$?$.slice(0,50):null,[$]),me=()=>{I(!0),u.current&&(u.current.close(),u.current=null),c.current&&(c.current.dispose(),c.current=null,h.current=null),O(!1),B(!1),z.current="",i(""),l("idle"),x(!1),setTimeout(()=>{I(!1)},200)};if(n.useEffect(()=>{const b=(r==null?void 0:r.id)||null;E!==null&&E!==b&&y&&V(),A(b)},[r==null?void 0:r.id,y,V]),n.useEffect(()=>{if(!L.current||!t||M||c.current)return;c.current=new ve.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff",extendedAnsi:["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"]}}),h.current=new Ce.FitAddon;const b=new ke.WebglAddon,j=new Se.WebLinksAddon;c.current.loadAddon(h.current),s||c.current.loadAddon(j);try{c.current.loadAddon(b)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}c.current.open(L.current),c.current.attachCustomKeyEventHandler(o=>{var K,J,ne;const W=oe(D.current)?ae:z.current;return o.type==="keydown"&&s&&P.current&&W&&!o.ctrlKey&&!o.metaKey&&!o.altKey&&((K=o.key)==null?void 0:K.toLowerCase())==="c"&&X(W).catch(()=>{}),o.type==="keydown"&&(o.ctrlKey||o.metaKey)&&((J=o.key)==null?void 0:J.toLowerCase())==="c"&&c.current.hasSelection()?(o.preventDefault(),o.stopPropagation(),document.execCommand("copy"),!1):o.type==="keydown"&&(o.ctrlKey||o.metaKey)&&((ne=o.key)==null?void 0:ne.toLowerCase())==="v"?(o.preventDefault(),o.stopPropagation(),navigator.clipboard.readText().then(pe=>{u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"input",data:pe}))}).catch(()=>{}),!1):!0}),setTimeout(()=>{h.current&&(h.current.fit(),c.current&&u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows})))},100),B(!0),c.current.onData(o=>{u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"input",data:o}))});const N=new ResizeObserver(()=>{h.current&&c.current&&setTimeout(()=>{h.current.fit(),u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows}))},50)});return L.current&&N.observe(L.current),()=>{N.disconnect(),u.current&&(u.current.readyState===WebSocket.OPEN||u.current.readyState===WebSocket.CONNECTING)&&u.current.close(),u.current=null,c.current&&(c.current.dispose(),c.current=null)}},[(t==null?void 0:t.path)||(t==null?void 0:t.fullPath),M,s,X]),n.useEffect(()=>{!w||!y||v||k||q()},[w,y,v,k,q]),!t)return e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:d("shell.selectProject.title")}),e.jsx("p",{children:d("shell.selectProject.description")})]})});if(s){const b=oe(a)?ae:H,j=!!b,N=j&&!f,o=j&&f;return e.jsxs("div",{className:"h-full w-full bg-gray-900 relative",children:[e.jsx("div",{ref:L,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),N&&e.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),e.jsx("button",{type:"button",onClick:()=>x(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),e.jsx("input",{type:"text",value:b,readOnly:!0,onClick:W=>W.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{te(b)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),e.jsx("button",{type:"button",onClick:async()=>{const W=await X(b);l(W?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:S==="copied"?"Copied":"Copy URL"})]})]})}),o&&e.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:e.jsx("button",{type:"button",onClick:()=>x(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}return e.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${k?"bg-green-500":"bg-red-500"}`}),r&&e.jsxs("span",{className:"text-xs text-blue-300",children:["(",xe,"...)"]}),!r&&e.jsx("span",{className:"text-xs text-gray-400",children:d("shell.status.newSession")}),!y&&e.jsx("span",{className:"text-xs text-yellow-400",children:d("shell.status.initializing")}),M&&e.jsx("span",{className:"text-xs text-blue-400",children:d("shell.status.restarting")})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[k&&e.jsxs("button",{onClick:V,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:d("shell.actions.disconnectTitle"),children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{children:d("shell.actions.disconnect")})]}),e.jsxs("button",{onClick:me,disabled:M||k,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:d("shell.actions.restartTitle"),children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),e.jsx("span",{children:d("shell.actions.restart")})]})]})]})}),e.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[e.jsx("div",{ref:L,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!y&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:e.jsx("div",{className:"text-white",children:d("shell.loading")})}),y&&!k&&!v&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[U&&e.jsx("div",{className:"mb-4 px-4 py-2 bg-red-900/40 border border-red-500/30 rounded-lg",children:e.jsx("p",{className:"text-red-400 text-xs",children:U})}),e.jsxs("button",{onClick:q,className:"px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",title:d("shell.actions.connectTitle"),children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),e.jsx("span",{children:U?d("shell.actions.retry","Retry"):d("shell.actions.connect")})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:p?d("shell.runCommand",{command:a||d("shell.defaultCommand"),projectName:t.displayName}):r?d("shell.resumeSession",{displayName:he}):d("shell.startSession")})]})}),v&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),e.jsx("span",{className:"text-base font-medium",children:d("shell.connecting")})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:p?d("shell.runCommand",{command:a||d("shell.defaultCommand"),projectName:t.displayName}):d("shell.startCli",{projectName:t.displayName})})]})})]})]})}let Q=0;const Y=[{value:"powershell",label:"PowerShell",icon:"PS"},{value:"cmd",label:"CMD",icon:">"},{value:"bash",label:"Bash",icon:"$"}];function fe({project:t,session:r=null,command:a=null,isPlainShell:p=null,autoConnect:g=!0,onComplete:s=null,onClose:w=null,title:C=null,className:d="",showHeader:L=!0,compact:c=!1,minimal:h=!1,multiTab:u=!1}){const[k,O]=n.useState(!1),[y,B]=n.useState(()=>[{id:++Q,shellType:"powershell",label:"PowerShell"}]),[M,I]=n.useState(()=>{var i;return(i=y[0])==null?void 0:i.id}),[E,A]=n.useState(!1),v=n.useRef(null),R=p!==null?p:a!==null,U=n.useCallback(i=>{O(!0),s&&s(i)},[s]),T=n.useCallback(i=>{const S=Y.find(f=>f.value===i)||Y[0],l=++Q;B(f=>[...f,{id:l,shellType:S.value,label:S.label}]),I(l),A(!1)},[]),H=n.useCallback(i=>{B(S=>{const l=S.filter(f=>f.id!==i);return l.length===0?[{id:++Q,shellType:"powershell",label:"PowerShell"}]:l}),I(S=>{if(S===i){const l=y.findIndex(m=>m.id===i),f=y.filter(m=>m.id!==i);if(f.length===0)return null;const x=Math.min(l,f.length-1);return f[x].id}return S})},[y]);return t?u&&!h&&!r&&!a?e.jsxs("div",{className:`h-full w-full flex flex-col ${d}`,children:[e.jsxs("div",{className:"flex-shrink-0 flex items-center bg-[#1e1e1e] border-b border-gray-700 px-1 min-h-[36px]",children:[e.jsx("div",{className:"flex items-center gap-0.5 overflow-x-auto flex-1 min-w-0",children:y.map(i=>{var S;return e.jsxs("button",{onClick:()=>I(i.id),className:`group flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-t transition-colors shrink-0 ${M===i.id?"bg-gray-800 text-gray-100 border-t-2 border-t-blue-500":"text-gray-400 hover:text-gray-200 hover:bg-gray-800/50"}`,children:[e.jsx("span",{className:"text-[10px] font-mono opacity-60",children:((S=Y.find(l=>l.value===i.shellType))==null?void 0:S.icon)||">"}),e.jsx("span",{children:i.label}),y.length>1&&e.jsx("span",{onClick:l=>{l.stopPropagation(),H(i.id)},className:"ml-1 opacity-0 group-hover:opacity-100 hover:text-red-400 transition-opacity cursor-pointer",title:"Close tab",children:"×"})]},i.id)})}),e.jsxs("div",{className:"relative ml-1 shrink-0",children:[e.jsx("button",{ref:v,onClick:()=>A(!E),className:"flex items-center justify-center w-7 h-7 text-gray-400 hover:text-gray-100 hover:bg-gray-700 rounded transition-colors text-lg",title:"New terminal",children:"+"}),E&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-50 bg-gray-800 border border-gray-600 rounded-lg shadow-xl py-1 min-w-[140px]",children:Y.map(i=>e.jsxs("button",{onClick:()=>T(i.value),className:"w-full text-left px-3 py-1.5 text-xs text-gray-200 hover:bg-gray-700 flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[10px] opacity-60 w-4",children:i.icon}),i.label]},i.value))})]})]}),e.jsx("div",{className:"flex-1 w-full min-h-0 relative",children:y.map(i=>e.jsx("div",{className:"absolute inset-0",style:{display:M===i.id?"block":"none"},children:e.jsx(ce,{selectedProject:t,isPlainShell:!0,shellType:i.shellType,autoConnect:!0,minimal:!1})},i.id))})]}):e.jsxs("div",{className:`h-full w-full flex flex-col ${d}`,children:[!h&&L&&C&&e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-200",children:C}),k&&e.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),w&&e.jsx("button",{onClick:w,className:"text-gray-400 hover:text-white",title:"Close",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),e.jsx("div",{className:"flex-1 w-full min-h-0",children:e.jsx(ce,{selectedProject:t,selectedSession:r,initialCommand:a,isPlainShell:R,onProcessComplete:U,minimal:h,autoConnect:h?!0:g})})]}):e.jsx("div",{className:`h-full flex items-center justify-center ${d}`,children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Project Selected"}),e.jsx("p",{children:"A project is required to open a shell"})]})})}const Ge=Object.freeze(Object.defineProperty({__proto__:null,default:fe},Symbol.toStringTag,{value:"Module"}));function Ye({isOpen:t,onClose:r,provider:a="claude",project:p,onComplete:g,customCommand:s,isAuthenticated:w=!1,isOnboarding:C=!1}){if(!t)return null;const d=()=>{if(s)return s;switch(a){case"claude":return w?"claude setup-token --dangerously-skip-permissions":C?"claude /exit --dangerously-skip-permissions":"claude /login --dangerously-skip-permissions";case"cursor":return"cursor-agent login";case"codex":return je?"codex login --device-auth":"codex login";default:return w?"claude setup-token --dangerously-skip-permissions":C?"claude /exit --dangerously-skip-permissions":"claude /login --dangerously-skip-permissions"}},L=()=>{switch(a){case"claude":return"Claude CLI Login";case"cursor":return"Cursor CLI Login";case"codex":return"Codex CLI Login";default:return"CLI Login"}},c=h=>{g&&g(h)};return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[9999] max-md:items-stretch max-md:justify-stretch",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:L()}),e.jsx("button",{onClick:r,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Close login modal",children:e.jsx(Te,{className:"w-6 h-6"})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(fe,{project:p,command:d(),onComplete:c,minimal:!0})})]})})}export{Ke as C,Ye as L,ce as S,Je as a,$e as b,Ge as c,Pe as u};
13
+ `)):(o.type==="auth_url"&&o.url||o.type==="url_open"&&o.url)&&(z.current=o.url,i(o.url),l("idle"),x(!1))}catch{}},u.current.onclose=w=>{clearTimeout(j);const o=k;O(!1),R(!1),l("idle"),x(!1),w.code===1006||w.code===4001?T("Connection lost. Your local machine may be offline."):(w.code===4003||w.code===1008)&&T("Authentication failed. Please log in again."),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H"))},u.current.onerror=()=>{clearTimeout(j),O(!1),R(!1),T("Failed to connect. Check that your relay is running (uc connect).")}}catch{O(!1),R(!1),T("Failed to establish connection.")}}},[v,k,te]),q=n.useCallback(()=>{!b||k||v||(R(!0),T(null),re())},[b,k,v,re]),V=n.useCallback(()=>{u.current&&(u.current.close(),u.current=null),c.current&&(c.current.clear(),c.current.write("\x1B[2J\x1B[H")),O(!1),R(!1),T(null),z.current="",i(""),l("idle"),x(!1)},[]),D=n.useMemo(()=>r?r.__provider==="cursor"?r.name||"Untitled Session":r.summary||"New Session":null,[r]),he=n.useMemo(()=>D?D.slice(0,30):null,[D]),me=n.useMemo(()=>D?D.slice(0,50):null,[D]),pe=()=>{I(!0),u.current&&(u.current.close(),u.current=null),c.current&&(c.current.dispose(),c.current=null,h.current=null),O(!1),B(!1),z.current="",i(""),l("idle"),x(!1),setTimeout(()=>{I(!1)},200)};if(n.useEffect(()=>{const y=(r==null?void 0:r.id)||null;E!==null&&E!==y&&b&&V(),A(y)},[r==null?void 0:r.id,b,V]),n.useEffect(()=>{if(!L.current||!t||M||c.current)return;c.current=new ve.Terminal({cursorBlink:!0,fontSize:14,fontFamily:'Menlo, Monaco, "Courier New", monospace',allowProposedApi:!0,allowTransparency:!1,convertEol:!0,scrollback:1e4,tabStopWidth:4,windowsMode:!1,macOptionIsMeta:!0,macOptionClickForcesSelection:!0,theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#ffffff",cursorAccent:"#1e1e1e",selection:"#264f78",selectionForeground:"#ffffff",black:"#000000",red:"#cd3131",green:"#0dbc79",yellow:"#e5e510",blue:"#2472c8",magenta:"#bc3fbc",cyan:"#11a8cd",white:"#e5e5e5",brightBlack:"#666666",brightRed:"#f14c4c",brightGreen:"#23d18b",brightYellow:"#f5f543",brightBlue:"#3b8eea",brightMagenta:"#d670d6",brightCyan:"#29b8db",brightWhite:"#ffffff",extendedAnsi:["#000000","#800000","#008000","#808000","#000080","#800080","#008080","#c0c0c0","#808080","#ff0000","#00ff00","#ffff00","#0000ff","#ff00ff","#00ffff","#ffffff"]}}),h.current=new Ce.FitAddon;const y=new ke.WebglAddon,j=new Se.WebLinksAddon;c.current.loadAddon(h.current),s||c.current.loadAddon(j);try{c.current.loadAddon(y)}catch{console.warn("[Shell] WebGL renderer unavailable, using Canvas fallback")}c.current.open(L.current),c.current.attachCustomKeyEventHandler(o=>{var K,J,ne;const W=ce($.current)?oe:z.current;return o.type==="keydown"&&s&&P.current&&W&&!o.ctrlKey&&!o.metaKey&&!o.altKey&&((K=o.key)==null?void 0:K.toLowerCase())==="c"&&X(W).catch(()=>{}),o.type==="keydown"&&(o.ctrlKey||o.metaKey)&&((J=o.key)==null?void 0:J.toLowerCase())==="c"&&c.current.hasSelection()?(o.preventDefault(),o.stopPropagation(),document.execCommand("copy"),!1):o.type==="keydown"&&(o.ctrlKey||o.metaKey)&&((ne=o.key)==null?void 0:ne.toLowerCase())==="v"?(o.preventDefault(),o.stopPropagation(),navigator.clipboard.readText().then(ge=>{u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"input",data:ge}))}).catch(()=>{}),!1):!0}),setTimeout(()=>{h.current&&(h.current.fit(),c.current&&u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows})))},100),B(!0),c.current.onData(o=>{u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"input",data:o}))});const w=new ResizeObserver(()=>{h.current&&c.current&&setTimeout(()=>{h.current.fit(),u.current&&u.current.readyState===WebSocket.OPEN&&u.current.send(JSON.stringify({type:"resize",cols:c.current.cols,rows:c.current.rows}))},50)});return L.current&&w.observe(L.current),()=>{w.disconnect(),u.current&&(u.current.readyState===WebSocket.OPEN||u.current.readyState===WebSocket.CONNECTING)&&u.current.close(),u.current=null,c.current&&(c.current.dispose(),c.current=null)}},[(t==null?void 0:t.path)||(t==null?void 0:t.fullPath),M,s,X]),n.useEffect(()=>{!N||!b||v||k||q()},[N,b,v,k,q]),!t)return e.jsx("div",{className:"h-full flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v14a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:d("shell.selectProject.title")}),e.jsx("p",{children:d("shell.selectProject.description")})]})});if(s){const y=ce(a)?oe:H,j=!!y,w=j&&!f,o=j&&f;return e.jsxs("div",{className:"h-full w-full bg-gray-900 relative",children:[e.jsx("div",{ref:L,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),w&&e.jsx("div",{className:"absolute inset-x-0 bottom-14 z-20 border-t border-gray-700/80 bg-gray-900/95 p-3 backdrop-blur-sm md:hidden",children:e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("p",{className:"text-xs text-gray-300",children:"Open or copy the login URL:"}),e.jsx("button",{type:"button",onClick:()=>x(!0),className:"rounded bg-gray-700 px-2 py-1 text-[10px] font-medium uppercase tracking-wide text-gray-100 hover:bg-gray-600",children:"Hide"})]}),e.jsx("input",{type:"text",value:y,readOnly:!0,onClick:W=>W.currentTarget.select(),className:"w-full rounded border border-gray-600 bg-gray-800 px-2 py-1 text-xs text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-500","aria-label":"Authentication URL"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",onClick:()=>{te(y)},className:"flex-1 rounded bg-blue-600 px-3 py-2 text-xs font-medium text-white hover:bg-blue-700",children:"Open URL"}),e.jsx("button",{type:"button",onClick:async()=>{const W=await X(y);l(W?"copied":"failed")},className:"flex-1 rounded bg-gray-700 px-3 py-2 text-xs font-medium text-white hover:bg-gray-600",children:S==="copied"?"Copied":"Copy URL"})]})]})}),o&&e.jsx("div",{className:"absolute bottom-14 right-3 z-20 md:hidden",children:e.jsx("button",{type:"button",onClick:()=>x(!1),className:"rounded bg-gray-800/95 px-3 py-2 text-xs font-medium text-gray-100 shadow-lg backdrop-blur-sm hover:bg-gray-700",children:"Show login URL"})})]})}return e.jsxs("div",{className:"h-full flex flex-col bg-gray-900 w-full",children:[e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${k?"bg-green-500":"bg-red-500"}`}),r&&e.jsxs("span",{className:"text-xs text-blue-300",children:["(",he,"...)"]}),!r&&e.jsx("span",{className:"text-xs text-gray-400",children:d("shell.status.newSession")}),!b&&e.jsx("span",{className:"text-xs text-yellow-400",children:d("shell.status.initializing")}),M&&e.jsx("span",{className:"text-xs text-blue-400",children:d("shell.status.restarting")})]}),e.jsxs("div",{className:"flex items-center space-x-3",children:[k&&e.jsxs("button",{onClick:V,className:"px-3 py-1 text-xs bg-red-600 text-white rounded hover:bg-red-700 flex items-center space-x-1",title:d("shell.actions.disconnectTitle"),children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})}),e.jsx("span",{children:d("shell.actions.disconnect")})]}),e.jsxs("button",{onClick:pe,disabled:M||k,className:"text-xs text-gray-400 hover:text-white disabled:opacity-50 disabled:cursor-not-allowed flex items-center space-x-1",title:d("shell.actions.restartTitle"),children:[e.jsx("svg",{className:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),e.jsx("span",{children:d("shell.actions.restart")})]})]})]})}),e.jsxs("div",{className:"flex-1 p-2 overflow-hidden relative",children:[e.jsx("div",{ref:L,className:"h-full w-full focus:outline-none",style:{outline:"none"}}),!b&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90",children:e.jsx("div",{className:"text-white",children:d("shell.loading")})}),b&&!k&&!v&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[U&&e.jsx("div",{className:"mb-4 px-4 py-2 bg-red-900/40 border border-red-500/30 rounded-lg",children:e.jsx("p",{className:"text-red-400 text-xs",children:U})}),e.jsxs("button",{onClick:q,className:"px-6 py-3 bg-green-600 text-white rounded-lg hover:bg-green-700 transition-colors flex items-center justify-center space-x-2 text-base font-medium w-full sm:w-auto",title:d("shell.actions.connectTitle"),children:[e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 10V3L4 14h7v7l9-11h-7z"})}),e.jsx("span",{children:U?d("shell.actions.retry","Retry"):d("shell.actions.connect")})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:p?d("shell.runCommand",{command:a||d("shell.defaultCommand"),projectName:t.displayName}):r?d("shell.resumeSession",{displayName:me}):d("shell.startSession")})]})}),v&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-gray-900 bg-opacity-90 p-4",children:e.jsxs("div",{className:"text-center max-w-sm w-full",children:[e.jsxs("div",{className:"flex items-center justify-center space-x-3 text-yellow-400",children:[e.jsx("div",{className:"w-6 h-6 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}),e.jsx("span",{className:"text-base font-medium",children:d("shell.connecting")})]}),e.jsx("p",{className:"text-gray-400 text-sm mt-3 px-2",children:p?d("shell.runCommand",{command:a||d("shell.defaultCommand"),projectName:t.displayName}):d("shell.startCli",{projectName:t.displayName})})]})})]})]})}let Q=0;const Y=[{value:"powershell",label:"PowerShell",icon:"PS"},{value:"cmd",label:"CMD",icon:">"},{value:"bash",label:"Bash",icon:"$"}];function xe({project:t,session:r=null,command:a=null,isPlainShell:p=null,autoConnect:g=!0,onComplete:s=null,onClose:N=null,title:C=null,className:d="",showHeader:L=!0,compact:c=!1,minimal:h=!1,multiTab:u=!1}){const[k,O]=n.useState(!1),[b,B]=n.useState(()=>[{id:++Q,shellType:"powershell",label:"PowerShell"}]),[M,I]=n.useState(()=>{var i;return(i=b[0])==null?void 0:i.id}),[E,A]=n.useState(!1),v=n.useRef(null),R=p!==null?p:a!==null,U=n.useCallback(i=>{O(!0),s&&s(i)},[s]),T=n.useCallback(i=>{const S=Y.find(f=>f.value===i)||Y[0],l=++Q;B(f=>[...f,{id:l,shellType:S.value,label:S.label}]),I(l),A(!1)},[]),H=n.useCallback(i=>{B(S=>{const l=S.filter(f=>f.id!==i);return l.length===0?[{id:++Q,shellType:"powershell",label:"PowerShell"}]:l}),I(S=>{if(S===i){const l=b.findIndex(m=>m.id===i),f=b.filter(m=>m.id!==i);if(f.length===0)return null;const x=Math.min(l,f.length-1);return f[x].id}return S})},[b]);return t?u&&!h&&!r&&!a?e.jsxs("div",{className:`h-full w-full flex flex-col ${d}`,children:[e.jsxs("div",{className:"flex-shrink-0 flex items-center bg-[#1e1e1e] border-b border-gray-700 px-1 min-h-[36px]",children:[e.jsx("div",{className:"flex items-center gap-0.5 overflow-x-auto flex-1 min-w-0",children:b.map(i=>{var S;return e.jsxs("button",{onClick:()=>I(i.id),className:`group flex items-center gap-1.5 px-3 py-1.5 text-xs font-medium rounded-t transition-colors shrink-0 ${M===i.id?"bg-gray-800 text-gray-100 border-t-2 border-t-blue-500":"text-gray-400 hover:text-gray-200 hover:bg-gray-800/50"}`,children:[e.jsx("span",{className:"text-[10px] font-mono opacity-60",children:((S=Y.find(l=>l.value===i.shellType))==null?void 0:S.icon)||">"}),e.jsx("span",{children:i.label}),b.length>1&&e.jsx("span",{onClick:l=>{l.stopPropagation(),H(i.id)},className:"ml-1 opacity-0 group-hover:opacity-100 hover:text-red-400 transition-opacity cursor-pointer",title:"Close tab",children:"×"})]},i.id)})}),e.jsxs("div",{className:"relative ml-1 shrink-0",children:[e.jsx("button",{ref:v,onClick:()=>A(!E),className:"flex items-center justify-center w-7 h-7 text-gray-400 hover:text-gray-100 hover:bg-gray-700 rounded transition-colors text-lg",title:"New terminal",children:"+"}),E&&e.jsx("div",{className:"absolute right-0 top-full mt-1 z-50 bg-gray-800 border border-gray-600 rounded-lg shadow-xl py-1 min-w-[140px]",children:Y.map(i=>e.jsxs("button",{onClick:()=>T(i.value),className:"w-full text-left px-3 py-1.5 text-xs text-gray-200 hover:bg-gray-700 flex items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[10px] opacity-60 w-4",children:i.icon}),i.label]},i.value))})]})]}),e.jsx("div",{className:"flex-1 w-full min-h-0 relative",children:b.map(i=>e.jsx("div",{className:"absolute inset-0",style:{display:M===i.id?"block":"none"},children:e.jsx(ie,{selectedProject:t,isPlainShell:!0,shellType:i.shellType,autoConnect:!0,minimal:!1})},i.id))})]}):e.jsxs("div",{className:`h-full w-full flex flex-col ${d}`,children:[!h&&L&&C&&e.jsx("div",{className:"flex-shrink-0 bg-gray-800 border-b border-gray-700 px-4 py-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h3",{className:"text-sm font-medium text-gray-200",children:C}),k&&e.jsx("span",{className:"text-xs text-green-400",children:"(Completed)"})]}),N&&e.jsx("button",{onClick:N,className:"text-gray-400 hover:text-white",title:"Close",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})}),e.jsx("div",{className:"flex-1 w-full min-h-0",children:e.jsx(ie,{selectedProject:t,selectedSession:r,initialCommand:a,isPlainShell:R,onProcessComplete:U,minimal:h,autoConnect:h?!0:g})})]}):e.jsx("div",{className:`h-full flex items-center justify-center ${d}`,children:e.jsxs("div",{className:"text-center text-gray-500 dark:text-gray-400",children:[e.jsx("div",{className:"w-16 h-16 mx-auto mb-4 bg-gray-100 dark:bg-gray-800 rounded-full flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 002 2z"})})}),e.jsx("h3",{className:"text-lg font-semibold mb-2",children:"No Project Selected"}),e.jsx("p",{children:"A project is required to open a shell"})]})})}const Ge=Object.freeze(Object.defineProperty({__proto__:null,default:xe},Symbol.toStringTag,{value:"Module"}));function Ye({isOpen:t,onClose:r,provider:a="claude",project:p,onComplete:g,customCommand:s,isAuthenticated:N=!1,isOnboarding:C=!1}){if(!t)return null;const d=()=>{if(s)return s;switch(a){case"claude":return N?"claude setup-token --dangerously-skip-permissions":C?"claude /exit --dangerously-skip-permissions":"claude /login --dangerously-skip-permissions";case"cursor":return"cursor-agent login";case"codex":return je?"codex login --device-auth":"codex login";default:return N?"claude setup-token --dangerously-skip-permissions":C?"claude /exit --dangerously-skip-permissions":"claude /login --dangerously-skip-permissions"}},L=()=>{switch(a){case"claude":return"Claude CLI Login";case"cursor":return"Cursor CLI Login";case"codex":return"Codex CLI Login";default:return"CLI Login"}},c=h=>{g&&g(h)};return e.jsx("div",{className:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[9999] max-md:items-stretch max-md:justify-stretch",children:e.jsxs("div",{className:"bg-white dark:bg-gray-800 rounded-lg shadow-xl w-full max-w-4xl h-3/4 flex flex-col md:max-w-4xl md:h-3/4 md:rounded-lg md:m-4 max-md:max-w-none max-md:h-full max-md:rounded-none max-md:m-0",children:[e.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200 dark:border-gray-700",children:[e.jsx("h3",{className:"text-lg font-semibold text-gray-900 dark:text-white",children:L()}),e.jsx("button",{onClick:r,className:"text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 transition-colors","aria-label":"Close login modal",children:e.jsx(Te,{className:"w-6 h-6"})})]}),e.jsx("div",{className:"flex-1 overflow-hidden",children:e.jsx(xe,{project:p,command:d(),onComplete:c,minimal:!0})})]})})}export{Ke as C,Ye as L,ie as S,Je as a,De as b,Ge as c,Pe as u};
@@ -1 +1 @@
1
- import{r as d,j as r}from"./vendor-react-96lCPsRK.js";import{a as p,b as x,d as y,c as b,M as u}from"./vendor-markdown-CimbIo6Y.js";import{h,p as k}from"./vendor-syntax-DuHI9Ok6.js";function f({inline:e,className:t,children:a,...m}){const[c,n]=d.useState(!1),s=Array.isArray(a)?a.join(""):String(a??""),g=/[\r\n]/.test(s);if(e||!g)return r.jsx("code",{className:`font-mono text-[0.9em] px-1.5 py-0.5 rounded-md bg-gray-100 text-gray-900 border border-gray-200 dark:bg-gray-800/60 dark:text-gray-100 dark:border-gray-700 whitespace-pre-wrap break-words ${t||""}`,...m,children:a});const l=/language-(\w+)/.exec(t||""),o=l?l[1]:"text";return r.jsxs("div",{className:"relative group my-2",children:[o&&o!=="text"&&r.jsx("div",{className:"absolute top-2 left-3 z-10 text-xs text-gray-400 font-medium uppercase",children:o}),r.jsx("button",{type:"button",onClick:()=>{var i;(i=navigator.clipboard)==null||i.writeText(s).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},className:"absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity text-xs px-2 py-1 rounded-md bg-gray-700/80 hover:bg-gray-700 text-white border border-gray-600",children:c?"Copied!":"Copy"}),r.jsx(h,{language:o,style:k,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem",padding:o&&o!=="text"?"2rem 1rem 1rem 1rem":"1rem"},children:s})]})}const j={code:f,blockquote:({children:e})=>r.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:e}),a:({href:e,children:t})=>r.jsx("a",{href:e,className:"text-blue-600 dark:text-blue-400 hover:underline",target:"_blank",rel:"noopener noreferrer",children:t}),table:({children:e})=>r.jsx("div",{className:"overflow-x-auto my-2",children:r.jsx("table",{className:"min-w-full border-collapse border border-gray-200 dark:border-gray-700",children:e})}),thead:({children:e})=>r.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:e}),th:({children:e})=>r.jsx("th",{className:"px-3 py-2 text-left text-sm font-semibold border border-gray-200 dark:border-gray-700",children:e}),td:({children:e})=>r.jsx("td",{className:"px-3 py-2 align-top text-sm border border-gray-200 dark:border-gray-700",children:e})};function C({content:e}){const t=d.useMemo(()=>[p,x],[]),a=d.useMemo(()=>[y,b],[]);return r.jsx(u,{remarkPlugins:t,rehypePlugins:a,components:j,children:e})}export{C as default};
1
+ import{r as d,j as r}from"./vendor-react-96lCPsRK.js";import{a as p,b as x,d as y,c as b,M as u}from"./vendor-markdown-CimbIo6Y.js";import{h,p as k}from"./vendor-syntax-LS_Nt30I.js";function f({inline:e,className:t,children:a,...m}){const[c,n]=d.useState(!1),s=Array.isArray(a)?a.join(""):String(a??""),g=/[\r\n]/.test(s);if(e||!g)return r.jsx("code",{className:`font-mono text-[0.9em] px-1.5 py-0.5 rounded-md bg-gray-100 text-gray-900 border border-gray-200 dark:bg-gray-800/60 dark:text-gray-100 dark:border-gray-700 whitespace-pre-wrap break-words ${t||""}`,...m,children:a});const l=/language-(\w+)/.exec(t||""),o=l?l[1]:"text";return r.jsxs("div",{className:"relative group my-2",children:[o&&o!=="text"&&r.jsx("div",{className:"absolute top-2 left-3 z-10 text-xs text-gray-400 font-medium uppercase",children:o}),r.jsx("button",{type:"button",onClick:()=>{var i;(i=navigator.clipboard)==null||i.writeText(s).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},className:"absolute top-2 right-2 z-10 opacity-0 group-hover:opacity-100 transition-opacity text-xs px-2 py-1 rounded-md bg-gray-700/80 hover:bg-gray-700 text-white border border-gray-600",children:c?"Copied!":"Copy"}),r.jsx(h,{language:o,style:k,customStyle:{margin:0,borderRadius:"0.5rem",fontSize:"0.875rem",padding:o&&o!=="text"?"2rem 1rem 1rem 1rem":"1rem"},children:s})]})}const j={code:f,blockquote:({children:e})=>r.jsx("blockquote",{className:"border-l-4 border-gray-300 dark:border-gray-600 pl-4 italic text-gray-600 dark:text-gray-400 my-2",children:e}),a:({href:e,children:t})=>r.jsx("a",{href:e,className:"text-blue-600 dark:text-blue-400 hover:underline",target:"_blank",rel:"noopener noreferrer",children:t}),table:({children:e})=>r.jsx("div",{className:"overflow-x-auto my-2",children:r.jsx("table",{className:"min-w-full border-collapse border border-gray-200 dark:border-gray-700",children:e})}),thead:({children:e})=>r.jsx("thead",{className:"bg-gray-50 dark:bg-gray-800",children:e}),th:({children:e})=>r.jsx("th",{className:"px-3 py-2 text-left text-sm font-semibold border border-gray-200 dark:border-gray-700",children:e}),td:({children:e})=>r.jsx("td",{className:"px-3 py-2 align-top text-sm border border-gray-200 dark:border-gray-700",children:e})};function C({content:e}){const t=d.useMemo(()=>[p,x],[]),a=d.useMemo(()=>[y,b],[]);return r.jsx(u,{remarkPlugins:t,rehypePlugins:a,components:j,children:e})}export{C as default};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-mermaid-CH7SGc99.js","assets/vendor-canvas-D39yWul6.js","assets/vendor-react-96lCPsRK.js","assets/vendor-canvas-BZV40eAE.css","assets/vendor-syntax-DuHI9Ok6.js","assets/vendor-markdown-CimbIo6Y.js"])))=>i.map(i=>d[i]);
2
- import{b}from"./vendor-syntax-DuHI9Ok6.js";import{r as t,j as e}from"./vendor-react-96lCPsRK.js";import"./vendor-markdown-CimbIo6Y.js";let m=!1;async function h(){const r=await b(()=>import("./vendor-mermaid-CH7SGc99.js").then(s=>s.a7),__vite__mapDeps([0,1,2,3,4,5]));return m||(r.default.initialize({startOnLoad:!1,theme:"dark",themeVariables:{darkMode:!0,background:"#1e293b",primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",primaryBorderColor:"#475569",lineColor:"#64748b",secondaryColor:"#1e40af",tertiaryColor:"#0f172a",fontFamily:"ui-sans-serif, system-ui, sans-serif",fontSize:"14px"},flowchart:{htmlLabels:!0,curve:"basis"},sequence:{mirrorActors:!1}}),m=!0),r.default}function w({code:r}){const s=t.useRef(null),o=t.useId().replace(/:/g,"-"),[i,n]=t.useState(null),[u,d]=t.useState(null),[f,c]=t.useState(!1);t.useEffect(()=>{let l=!1;return(async()=>{try{const a=await h(),{svg:x}=await a.render(`mermaid${o}`,r.trim());l||(n(x),d(null))}catch(a){l||(d((a==null?void 0:a.message)||"Failed to render diagram"),n(null))}})(),()=>{l=!0}},[r,o]);const p=()=>{navigator.clipboard.writeText(r).then(()=>{c(!0),setTimeout(()=>c(!1),1500)}).catch(()=>{})};return u?e.jsxs("div",{className:"my-2 rounded-lg border border-red-500/30 bg-red-950/20 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("svg",{className:"w-4 h-4 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),e.jsx("span",{className:"text-xs font-medium text-red-400",children:"Mermaid diagram error"})]}),e.jsx("pre",{className:"text-xs text-red-300/70 whitespace-pre-wrap font-mono",children:r})]}):e.jsxs("div",{className:"relative group my-2 rounded-lg border border-slate-700 bg-slate-900/50 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-slate-700/50 bg-slate-800/30",children:[e.jsx("span",{className:"text-xs text-slate-400 font-medium uppercase",children:"mermaid"}),e.jsx("button",{type:"button",onClick:p,className:"opacity-0 group-hover:opacity-100 transition-opacity text-xs px-2 py-0.5 rounded bg-slate-700/80 hover:bg-slate-700 text-slate-300 border border-slate-600",children:f?"Copied":"Copy source"})]}),e.jsx("div",{ref:s,className:"flex items-center justify-center p-4 min-h-[80px] overflow-x-auto [&_svg]:max-w-full",dangerouslySetInnerHTML:i?{__html:i}:void 0,children:!i&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),"Rendering diagram..."]})})]})}export{w as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-mermaid-DucWyDEe.js","assets/vendor-canvas-DvHJ_Pn2.js","assets/vendor-react-96lCPsRK.js","assets/vendor-canvas-BZV40eAE.css","assets/vendor-syntax-LS_Nt30I.js","assets/vendor-markdown-CimbIo6Y.js"])))=>i.map(i=>d[i]);
2
+ import{b}from"./vendor-syntax-LS_Nt30I.js";import{r as t,j as e}from"./vendor-react-96lCPsRK.js";import"./vendor-markdown-CimbIo6Y.js";let m=!1;async function h(){const r=await b(()=>import("./vendor-mermaid-DucWyDEe.js").then(s=>s.a7),__vite__mapDeps([0,1,2,3,4,5]));return m||(r.default.initialize({startOnLoad:!1,theme:"dark",themeVariables:{darkMode:!0,background:"#1e293b",primaryColor:"#3b82f6",primaryTextColor:"#e2e8f0",primaryBorderColor:"#475569",lineColor:"#64748b",secondaryColor:"#1e40af",tertiaryColor:"#0f172a",fontFamily:"ui-sans-serif, system-ui, sans-serif",fontSize:"14px"},flowchart:{htmlLabels:!0,curve:"basis"},sequence:{mirrorActors:!1}}),m=!0),r.default}function w({code:r}){const s=t.useRef(null),o=t.useId().replace(/:/g,"-"),[i,n]=t.useState(null),[u,d]=t.useState(null),[f,c]=t.useState(!1);t.useEffect(()=>{let l=!1;return(async()=>{try{const a=await h(),{svg:x}=await a.render(`mermaid${o}`,r.trim());l||(n(x),d(null))}catch(a){l||(d((a==null?void 0:a.message)||"Failed to render diagram"),n(null))}})(),()=>{l=!0}},[r,o]);const p=()=>{navigator.clipboard.writeText(r).then(()=>{c(!0),setTimeout(()=>c(!1),1500)}).catch(()=>{})};return u?e.jsxs("div",{className:"my-2 rounded-lg border border-red-500/30 bg-red-950/20 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx("svg",{className:"w-4 h-4 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"})}),e.jsx("span",{className:"text-xs font-medium text-red-400",children:"Mermaid diagram error"})]}),e.jsx("pre",{className:"text-xs text-red-300/70 whitespace-pre-wrap font-mono",children:r})]}):e.jsxs("div",{className:"relative group my-2 rounded-lg border border-slate-700 bg-slate-900/50 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-3 py-1.5 border-b border-slate-700/50 bg-slate-800/30",children:[e.jsx("span",{className:"text-xs text-slate-400 font-medium uppercase",children:"mermaid"}),e.jsx("button",{type:"button",onClick:p,className:"opacity-0 group-hover:opacity-100 transition-opacity text-xs px-2 py-0.5 rounded bg-slate-700/80 hover:bg-slate-700 text-slate-300 border border-slate-600",children:f?"Copied":"Copy source"})]}),e.jsx("div",{ref:s,className:"flex items-center justify-center p-4 min-h-[80px] overflow-x-auto [&_svg]:max-w-full",dangerouslySetInnerHTML:i?{__html:i}:void 0,children:!i&&e.jsxs("div",{className:"flex items-center gap-2 text-sm text-slate-500",children:[e.jsx("div",{className:"w-4 h-4 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"}),"Rendering diagram..."]})})]})}export{w as default};
@@ -0,0 +1 @@
1
+ import{r,j as e}from"./vendor-react-96lCPsRK.js";import{L as We,b as ze,C as He,a as Ve}from"./LoginModal-CImJHRjX.js";import{I as Ze,i as Qe,c as Xe,d as p,b as ue,h as L}from"./index-HaY-3pK1.js";import{b as Ke,t as et,av as tt,Z as st,G as rt,aw as at,ax as ot,F as me,w as xe,n as he,X as ge,r as pe,L as G,P as nt,j as it,a8 as fe,q as lt}from"./vendor-icons-GyYE35HP.js";import"./vendor-xterm-CZq1hqo1.js";import"./vendor-canvas-DvHJ_Pn2.js";import"./vendor-mermaid-DucWyDEe.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-i18n-DCFGyhQR.js";const jt=({onComplete:R})=>{const[o,be]=r.useState(0),[y,O]=r.useState(""),[f,q]=r.useState(""),[c,N]=r.useState(!1),[U,n]=r.useState(""),[je,_]=r.useState(!1),[ye,Ne]=r.useState("right"),[l,v]=r.useState(null),[ve]=r.useState({name:"default",fullPath:Ze?"/workspace":""}),[u,E]=r.useState([]),[M,I]=r.useState(!1),[m,we]=r.useState(""),[D,Y]=r.useState([]),[J,ke]=r.useState([]),[W,z]=r.useState(!1),[x,H]=r.useState(""),[V,Ce]=r.useState([]),[w,Z]=r.useState(""),[b,k]=r.useState(!1),[Q,C]=r.useState(""),[X,T]=r.useState({authenticated:!1,email:null,loading:!0,error:null}),[K,$]=r.useState({authenticated:!1,email:null,loading:!0,error:null}),[ee,B]=r.useState({authenticated:!1,email:null,loading:!0,error:null}),{user:S}=Qe(),{isRelayConnected:te,relayCwd:A,relayPlatform:se}=Xe(),re=r.useRef(void 0);r.useEffect(()=>{Se()},[]);const Se=async()=>{try{const t=await p("/api/user/git-config");if(t.ok){const s=await t.json();s.gitName&&O(s.gitName),s.gitEmail&&q(s.gitEmail)}}catch{}},h=r.useCallback(async t=>{z(!0);try{const a=await(await ue.browseFilesystem(t||null)).json();we(a.path||t||""),Y(a.suggestions||[]),a.drives&&ke(a.drives)}catch{Y([])}finally{z(!1)}},[]),Ae=r.useCallback(async()=>{I(!0),await h(A||"~")},[A,h]),ae=r.useCallback(async t=>{await h(t)},[h]),Fe=r.useCallback(async()=>{if(!m)return;const t=se==="win32"?"\\":"/",s=m.lastIndexOf(t);if(s<=0&&t==="/")await h("/");else if(s>=0){const a=m.substring(0,s)||(t==="/"?"/":"");await h(a)}},[m,se,h]),Pe=r.useCallback(async t=>{if(!u.some(s=>s.path===t)){k(!0);try{const s=await ue.createWorkspace({workspaceType:"existing",path:t});if(s.ok){const a=await s.json(),i=t.split(/[/\\]/).filter(Boolean).pop()||"project";E(P=>{var d;return[...P,{path:t,name:((d=a.project)==null?void 0:d.displayName)||i,type:"local"}]}),I(!1)}else{const a=await s.json();n(a.error||"Failed to add project")}}catch(s){n(s.message||"Failed to add project")}finally{k(!1)}}},[u]),Le=r.useCallback(async()=>{if(!x.trim())return;k(!0),C("Starting clone..."),n("");const t=x.trim().replace(/\.git$/,"").split("/").pop()||"repo",s=L?"":`/workspace/${t}`;try{const a=new URLSearchParams({path:s,githubUrl:x.trim()});w&&a.set("githubTokenId",w),await new Promise((i,P)=>{const d=new EventSource(`/api/projects/clone-progress?${a}`);d.onmessage=Ye=>{const g=JSON.parse(Ye.data);g.type==="progress"?C(g.message):g.type==="complete"?(d.close(),E(Je=>{var de,ce;return[...Je,{path:((de=g.project)==null?void 0:de.originalPath)||s,name:((ce=g.project)==null?void 0:ce.displayName)||t,type:"github",url:x.trim()}]}),H(""),C(""),i()):g.type==="error"&&(d.close(),P(new Error(g.message)))},d.onerror=()=>{d.close(),P(new Error("Connection lost during clone"))}})}catch(a){n(a.message||"Failed to clone repository"),C("")}finally{k(!1)}},[x,w]),Ge=r.useCallback(t=>{E(s=>s.filter((a,i)=>i!==t))},[]),Ee=r.useCallback(async()=>{try{const t=await p("/api/settings/credentials?type=github_token");if(t.ok){const s=await t.json();Ce(s.credentials||[]);const a=(s.credentials||[]).find(i=>i.is_active);a&&Z(a.id)}}catch{}},[]);r.useEffect(()=>{const t=re.current;re.current=l,(t===void 0||t!==null&&l===null)&&(oe(),ne(),ie())},[l]);const oe=async()=>{try{const t=await p("/api/cli/claude/status");if(t.ok){const s=await t.json();T({authenticated:s.authenticated,email:s.email,loading:!1,error:s.error||null})}else T({authenticated:!1,email:null,loading:!1,error:"Failed to check status"})}catch(t){T({authenticated:!1,email:null,loading:!1,error:t.message})}},ne=async()=>{try{const t=await p("/api/cli/cursor/status");if(t.ok){const s=await t.json();$({authenticated:s.authenticated,email:s.email,loading:!1,error:s.error||null})}else $({authenticated:!1,email:null,loading:!1,error:"Failed to check status"})}catch(t){$({authenticated:!1,email:null,loading:!1,error:t.message})}},ie=async()=>{try{const t=await p("/api/cli/codex/status");if(t.ok){const s=await t.json();B({authenticated:s.authenticated,email:s.email,loading:!1,error:s.error||null})}else B({authenticated:!1,email:null,loading:!1,error:"Failed to check status"})}catch(t){B({authenticated:!1,email:null,loading:!1,error:t.message})}},Ie=()=>v("claude"),Te=()=>v("cursor"),$e=()=>v("codex"),Be=t=>{t===0&&(l==="claude"?oe():l==="cursor"?ne():l==="codex"&&ie())},j=(t,s="right")=>{Ne(s),_(!0),setTimeout(()=>{be(t),_(!1)},200)},Re=async()=>{if(n(""),o===0){j(1,"right");return}if(o===1){if(!y.trim()||!f.trim()){n("Both git name and email are required");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(f)){n("Please enter a valid email address");return}N(!0);try{const s=await p("/api/user/git-config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({gitName:y,gitEmail:f})});if(!s.ok){const a=await s.json();throw new Error(a.error||"Failed to save git configuration")}Ee(),j(2,"right")}catch(s){n(s.message)}finally{N(!1)}return}if(o===2){j(3,"right");return}j(o+1,"right")},Oe=()=>{n(""),j(o-1,"left")},qe=async()=>{N(!0),n("");try{const t=await p("/api/user/complete-onboarding",{method:"POST"});if(!t.ok){const s=await t.json();throw new Error(s.error||"Failed to complete onboarding")}R&&R()}catch(t){n(t.message)}finally{N(!1)}},F=[{title:"Welcome",required:!1},{title:"Git Identity",required:!0},{title:"Projects",required:!1},{title:"Agents",required:!1}],Ue=()=>o===0?!0:o===1?y.trim()&&f.trim()&&/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(f):!0,le=[X,K,ee].filter(t=>t.authenticated).length,_e=[{icon:et,title:"AI Agents",desc:"Claude, Cursor & Codex — unified in one interface",gradient:"from-blue-500/10 to-blue-600/5",iconColor:"text-blue-500"},{icon:tt,title:"Canvas",desc:"Visual workspace with code blocks, diagrams & notes",gradient:"from-violet-500/10 to-violet-600/5",iconColor:"text-violet-500"},{icon:st,title:"Relay",desc:"Bridge your local machine to the web UI seamlessly",gradient:"from-amber-500/10 to-amber-600/5",iconColor:"text-amber-500"}],Me=[{name:"Claude Code",status:X,onLogin:Ie,logo:e.jsx(ze,{size:22}),accent:"blue"},{name:"Cursor",status:K,onLogin:Te,logo:e.jsx(He,{size:22}),accent:"violet"},{name:"OpenAI Codex",status:ee,onLogin:$e,logo:e.jsx(Ve,{className:"w-5 h-5"}),accent:"neutral"}],De=je?`opacity-0 ${ye==="right"?"translate-x-4":"-translate-x-4"}`:"opacity-100 translate-x-0";return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4 sm:p-8",children:e.jsxs("div",{className:"w-full max-w-xl",children:[e.jsxs("div",{className:"mb-10",children:[e.jsx("div",{className:"flex items-center justify-between mb-3 px-1",children:F.map((t,s)=>e.jsxs("button",{onClick:()=>{s<o&&j(s,"left")},disabled:s>o,className:`text-xs font-medium tracking-wide uppercase transition-colors duration-300 ${s===o?"text-foreground":s<o?"text-primary cursor-pointer hover:text-primary/80":"text-muted-foreground/50"}`,children:[t.title,t.required&&s===o&&e.jsx("span",{className:"text-destructive ml-1",children:"*"})]},s))}),e.jsx("div",{className:"h-1 bg-muted/60 rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full bg-primary rounded-full transition-all duration-500 ease-out",style:{width:`${o/(F.length-1)*100}%`}})})]}),e.jsxs("div",{className:"bg-card rounded-2xl border border-border/60 shadow-xl shadow-black/[0.04] dark:shadow-black/[0.2] overflow-hidden",children:[e.jsxs("div",{className:`p-8 sm:p-10 transition-all duration-200 ease-out ${De}`,children:[o===0&&e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-primary/10 text-primary text-xs font-medium mb-6",children:[e.jsx(Ke,{className:"w-3.5 h-3.5"}),"Quick setup — under a minute"]}),e.jsxs("h1",{className:"text-3xl sm:text-4xl font-bold text-foreground tracking-tight leading-tight",children:["Welcome to Upfyn",S!=null&&S.first_name?e.jsxs("span",{className:"text-primary",children:[", ",S.first_name]}):null]}),e.jsx("p",{className:"text-muted-foreground mt-3 text-base max-w-md mx-auto leading-relaxed",children:"Your visual AI coding interface. Connect your favorite agents, manage projects, and build faster."})]}),e.jsx("div",{className:"grid gap-3",children:_e.map((t,s)=>e.jsxs("div",{className:`group flex items-start gap-4 p-4 rounded-xl bg-gradient-to-r ${t.gradient} border border-border/40 hover:border-border/80 transition-all duration-200`,children:[e.jsx("div",{className:`mt-0.5 p-2 rounded-lg bg-background/80 ${t.iconColor} flex-shrink-0`,children:e.jsx(t.icon,{className:"w-5 h-5"})}),e.jsxs("div",{children:[e.jsx("p",{className:"font-semibold text-foreground text-sm",children:t.title}),e.jsx("p",{className:"text-muted-foreground text-sm mt-0.5",children:t.desc})]})]},s))})]}),o===1&&e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary/10 flex items-center justify-center mx-auto mb-5",children:e.jsx(rt,{className:"w-7 h-7 text-primary"})}),e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:"Git Identity"}),e.jsx("p",{className:"text-muted-foreground mt-2 text-sm max-w-sm mx-auto",children:"Set your name and email for commit attribution"})]}),e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"gitName",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[e.jsx(at,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Name"]}),e.jsx("input",{type:"text",id:"gitName",value:y,onChange:t=>O(t.target.value),className:"w-full px-4 py-3 border border-border/60 rounded-xl bg-background text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/40 transition-all duration-200",placeholder:"John Doe",required:!0,disabled:c})]}),e.jsxs("div",{children:[e.jsxs("label",{htmlFor:"gitEmail",className:"flex items-center gap-2 text-sm font-medium text-foreground mb-2",children:[e.jsx(ot,{className:"w-3.5 h-3.5 text-muted-foreground"}),"Email"]}),e.jsx("input",{type:"email",id:"gitEmail",value:f,onChange:t=>q(t.target.value),className:"w-full px-4 py-3 border border-border/60 rounded-xl bg-background text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/40 transition-all duration-200",placeholder:"john@example.com",required:!0,disabled:c})]}),e.jsxs("p",{className:"text-xs text-muted-foreground/70 text-center",children:["Applied as ",e.jsx("code",{className:"px-1 py-0.5 rounded bg-muted/60 text-xs",children:"git config --global"})," on your machine"]})]})]}),o===2&&e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-14 h-14 rounded-2xl bg-primary/10 flex items-center justify-center mx-auto mb-5",children:e.jsx(me,{className:"w-7 h-7 text-primary"})}),e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:"Add Projects"}),e.jsx("p",{className:"text-muted-foreground mt-2 text-sm max-w-sm mx-auto",children:L?"Select folders from your machine to work with":"Add GitHub repos or local folders as projects"})]}),u.length>0&&e.jsx("div",{className:"space-y-2",children:u.map((t,s)=>e.jsxs("div",{className:"flex items-center justify-between p-3 rounded-xl bg-primary/5 border border-primary/20",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("div",{className:"w-8 h-8 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:t.type==="github"?e.jsx(xe,{className:"w-4 h-4 text-primary"}):e.jsx(he,{className:"w-4 h-4 text-primary"})}),e.jsxs("div",{className:"min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:t.name}),e.jsx("p",{className:"text-xs text-muted-foreground truncate",children:t.url||t.path})]})]}),e.jsx("button",{onClick:()=>Ge(s),className:"p-1.5 text-muted-foreground hover:text-destructive hover:bg-destructive/10 rounded-lg transition-colors flex-shrink-0",children:e.jsx(ge,{className:"w-3.5 h-3.5"})})]},s))}),e.jsxs("div",{className:"space-y-3",children:[(L||te)&&!M&&e.jsxs("button",{onClick:Ae,disabled:b,className:"w-full flex items-center gap-3 p-4 rounded-xl border border-dashed border-border/60 hover:border-primary/40 hover:bg-primary/5 transition-all duration-200 text-left group",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-muted/60 group-hover:bg-primary/10 flex items-center justify-center flex-shrink-0 transition-colors",children:e.jsx(me,{className:"w-5 h-5 text-muted-foreground group-hover:text-primary transition-colors"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-foreground",children:"Add Local Folder"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:A?`Current: ${A}`:"Browse your filesystem"})]})]}),M&&e.jsxs("div",{className:"rounded-xl border border-border/60 bg-background overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 bg-muted/30 border-b border-border/40",children:[e.jsx("button",{onClick:Fe,disabled:W,className:"p-1 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors",title:"Go up",children:e.jsx(pe,{className:"w-4 h-4"})}),e.jsx("span",{className:"text-xs font-mono text-muted-foreground truncate flex-1",children:m}),e.jsx("button",{onClick:()=>Pe(m),disabled:b||!m,className:"px-2.5 py-1 text-xs font-medium bg-primary text-primary-foreground rounded-lg hover:opacity-90 disabled:opacity-50 transition-opacity",children:b?"Adding...":"Select This"}),e.jsx("button",{onClick:()=>I(!1),className:"p-1 rounded hover:bg-muted/60 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(ge,{className:"w-3.5 h-3.5"})})]}),J.length>0&&e.jsx("div",{className:"flex gap-1 px-3 py-1.5 border-b border-border/30 bg-muted/10",children:J.map(t=>e.jsx("button",{onClick:()=>ae(t+"\\"),className:"px-2 py-0.5 text-[11px] font-mono rounded bg-muted/40 hover:bg-muted/70 text-muted-foreground hover:text-foreground transition-colors",children:t},t))}),e.jsx("div",{className:"max-h-48 overflow-y-auto",children:W?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx(G,{className:"w-5 h-5 animate-spin text-muted-foreground"})}):D.length===0?e.jsx("p",{className:"text-center text-xs text-muted-foreground py-6",children:"No folders found"}):D.map((t,s)=>e.jsxs("button",{onClick:()=>ae(t.path),className:"w-full flex items-center gap-2 px-3 py-2 hover:bg-muted/30 transition-colors text-left",children:[e.jsx(he,{className:"w-4 h-4 text-blue-500 flex-shrink-0"}),e.jsx("span",{className:"text-sm text-foreground truncate",children:t.name})]},s))})]}),!L&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-3 p-4 rounded-xl border border-border/60 bg-card",children:[e.jsx("div",{className:"w-10 h-10 rounded-xl bg-muted/60 flex items-center justify-center flex-shrink-0",children:e.jsx(xe,{className:"w-5 h-5 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-foreground mb-2",children:"Clone GitHub Repo"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("input",{type:"text",value:x,onChange:t=>H(t.target.value),placeholder:"https://github.com/user/repo",className:"flex-1 px-3 py-1.5 text-sm border border-border/60 rounded-lg bg-background text-foreground placeholder:text-muted-foreground/50 focus:outline-none focus:ring-1 focus:ring-primary/30",disabled:b}),e.jsx("button",{onClick:Le,disabled:b||!x.trim(),className:"px-3 py-1.5 text-sm font-medium bg-foreground text-background rounded-lg hover:opacity-90 disabled:opacity-50 transition-opacity flex-shrink-0",children:b?e.jsx(G,{className:"w-4 h-4 animate-spin"}):e.jsx(nt,{className:"w-4 h-4"})})]}),V.length>0&&e.jsxs("select",{value:w,onChange:t=>Z(t.target.value),className:"mt-2 w-full px-2 py-1 text-xs border border-border/40 rounded-lg bg-background text-muted-foreground",children:[e.jsx("option",{value:"",children:"No token (public repos only)"}),V.map(t=>e.jsx("option",{value:t.id,children:t.credential_name},t.id))]}),Q&&e.jsx("p",{className:"mt-2 text-xs text-primary animate-pulse",children:Q})]})]}),!te&&e.jsxs("p",{className:"text-xs text-muted-foreground/60 text-center",children:["Connect your machine with ",e.jsx("code",{className:"px-1 py-0.5 rounded bg-muted/60 text-[11px]",children:"uc web connect"})," to add local folders"]})]})]}),e.jsx("p",{className:"text-xs text-muted-foreground/60 text-center",children:u.length===0?"You can skip this and add projects later.":`${u.length} project${u.length>1?"s":""} added`})]}),o===3&&e.jsxs("div",{className:"space-y-8",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-2xl sm:text-3xl font-bold text-foreground tracking-tight",children:"Connect Your Agents"}),e.jsxs("p",{className:"text-muted-foreground mt-2 text-sm max-w-sm mx-auto",children:["Optional — login to one or more AI assistants.",le>0&&e.jsxs("span",{className:"text-primary font-medium",children:[" ",le," connected"]})]})]}),e.jsx("div",{className:"space-y-3",children:Me.map((t,s)=>{const a=t.status.authenticated,i=t.status.loading;return e.jsxs("div",{className:`group flex items-center justify-between p-4 rounded-xl border transition-all duration-200 ${a?"bg-primary/5 border-primary/20":"bg-card border-border/50 hover:border-border"}`,children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-10 h-10 rounded-xl flex items-center justify-center flex-shrink-0 ${a?"bg-primary/10":"bg-muted/60"}`,children:t.logo}),e.jsxs("div",{children:[e.jsxs("div",{className:"font-medium text-sm text-foreground flex items-center gap-2",children:[t.name,a&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded-md bg-green-500/10 text-green-600 dark:text-green-400 text-[10px] font-semibold uppercase tracking-wider",children:[e.jsx(it,{className:"w-3 h-3"}),"Connected"]})]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:i?"Checking...":a?t.status.email||"Ready to use":"Not connected"})]})]}),!a&&!i&&e.jsx("button",{onClick:t.onLogin,className:"px-4 py-2 text-sm font-medium rounded-lg bg-foreground text-background hover:opacity-90 transition-opacity flex-shrink-0",children:"Connect"})]},s)})}),e.jsx("p",{className:"text-xs text-muted-foreground/60 text-center",children:"You can always add or change these in Settings later."})]})]}),U&&e.jsx("div",{className:"mx-8 sm:mx-10 mb-2 p-3 rounded-xl bg-destructive/10 border border-destructive/20",children:e.jsx("p",{className:"text-sm text-destructive",children:U})}),e.jsxs("div",{className:"flex items-center justify-between px-8 sm:px-10 py-5 border-t border-border/40 bg-muted/20",children:[e.jsxs("button",{onClick:Oe,disabled:o===0||c,className:"flex items-center gap-1.5 text-sm font-medium text-muted-foreground hover:text-foreground disabled:opacity-0 disabled:pointer-events-none transition-all duration-200",children:[e.jsx(pe,{className:"w-4 h-4"}),"Back"]}),o<F.length-1?e.jsx("button",{onClick:Re,disabled:!Ue()||c,className:"flex items-center gap-2 px-6 py-2.5 bg-primary text-primary-foreground font-medium text-sm rounded-xl hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 shadow-sm",children:c?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 animate-spin"}),"Saving..."]}):o===0?e.jsxs(e.Fragment,{children:["Get Started",e.jsx(fe,{className:"w-4 h-4"})]}):e.jsxs(e.Fragment,{children:["Continue",e.jsx(lt,{className:"w-4 h-4"})]})}):e.jsx("button",{onClick:qe,disabled:c,className:"flex items-center gap-2 px-6 py-2.5 bg-primary text-primary-foreground font-medium text-sm rounded-xl hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed transition-all duration-200 shadow-sm",children:c?e.jsxs(e.Fragment,{children:[e.jsx(G,{className:"w-4 h-4 animate-spin"}),"Finishing..."]}):e.jsxs(e.Fragment,{children:["Start Building",e.jsx(fe,{className:"w-4 h-4"})]})})]})]}),e.jsxs("p",{className:"text-center text-xs text-muted-foreground/50 mt-6",children:["Step ",o+1," of ",F.length]})]})}),l&&e.jsx(We,{isOpen:!!l,onClose:()=>v(null),provider:l,project:ve,onComplete:Be,isOnboarding:!0})]})};export{jt as default};
@@ -0,0 +1 @@
1
+ import{r as t,j as e}from"./vendor-react-96lCPsRK.js";import{i as y}from"./index-HaY-3pK1.js";import"./vendor-syntax-LS_Nt30I.js";import"./vendor-markdown-CimbIo6Y.js";import"./vendor-icons-GyYE35HP.js";import"./vendor-i18n-DCFGyhQR.js";const E=()=>{const[a,f]=t.useState(""),[d,p]=t.useState(""),[l,x]=t.useState(""),[n,g]=t.useState(""),[u,h]=t.useState(""),[s,i]=t.useState(!1),[c,o]=t.useState(""),{register:j}=y(),N=async r=>{if(r.preventDefault(),o(""),n!==u){o("Passwords do not match");return}if(!a.trim()||a.trim().length<2){o("Name must be at least 2 characters");return}if(!d.trim()||!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(d)){o("Please enter a valid email address");return}if(n.length<6){o("Password must be at least 6 characters");return}i(!0);const m=a.trim().split(" "),w=m[0]||a.trim(),v=m.slice(1).join(" ")||"",b=await j(w,v,n,d.trim(),l.trim()||null);b.success||o(b.error),i(!1)};return e.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg border border-border p-8 space-y-6",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("img",{src:"/logo.svg",alt:"UpfynAI",className:"w-16 h-16",onError:r=>{r.target.style.display="none"}})}),e.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Create Your Account"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Sign up to start using UpfynAI"})]}),e.jsxs("form",{onSubmit:N,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"name",className:"block text-sm font-medium text-foreground mb-1",children:"Full Name"}),e.jsx("input",{type:"text",id:"name",value:a,onChange:r=>f(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Your full name",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-foreground mb-1",children:"Email"}),e.jsx("input",{type:"email",id:"email",value:d,onChange:r=>p(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"you@example.com",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"phone",className:"block text-sm font-medium text-foreground mb-1",children:"Mobile Number"}),e.jsx("input",{type:"tel",id:"phone",value:l,onChange:r=>x(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"+91 9876543210",disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block text-sm font-medium text-foreground mb-1",children:"Password"}),e.jsx("input",{type:"password",id:"password",value:n,onChange:r=>g(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"At least 6 characters",required:!0,disabled:s})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"confirmPassword",className:"block text-sm font-medium text-foreground mb-1",children:"Confirm Password"}),e.jsx("input",{type:"password",id:"confirmPassword",value:u,onChange:r=>h(r.target.value),className:"w-full px-3 py-2 border border-border rounded-md bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",placeholder:"Confirm your password",required:!0,disabled:s})]}),c&&e.jsx("div",{className:"p-3 bg-red-100 dark:bg-red-900/20 border border-red-300 dark:border-red-800 rounded-md",children:e.jsx("p",{className:"text-sm text-red-700 dark:text-red-400",children:c})}),e.jsx("button",{type:"submit",disabled:s,className:"w-full bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium py-2 px-4 rounded-md transition-colors duration-200",children:s?"Creating account...":"Create Account"})]})]})})})};export{E as default};