loki-mode 6.42.0 → 6.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +206 -141
- package/SKILL.md +2 -2
- package/VERSION +1 -1
- package/autonomy/loki +20 -3
- package/dashboard/__init__.py +1 -1
- package/docs/INSTALLATION.md +1 -1
- package/package.json +1 -1
- package/web-app/dist/assets/{Badge-Cv068X_w.js → Badge-aPxpGmfn.js} +1 -1
- package/web-app/dist/assets/{Button-DjxnqObR.js → Button-DlY3TKRG.js} +1 -1
- package/web-app/dist/assets/{Card-Ct8CoaX9.js → Card-DvU1jTxb.js} +1 -1
- package/web-app/dist/assets/HomePage-BYOHEkPT.js +18 -0
- package/web-app/dist/assets/ProjectPage-BxnUaUte.js +141 -0
- package/web-app/dist/assets/{ProjectsPage-uAcgLclp.js → ProjectsPage-BNbxt9RO.js} +1 -1
- package/web-app/dist/assets/{SettingsPage-CD0Vmtdu.js → SettingsPage-DXhzzC5L.js} +1 -1
- package/web-app/dist/assets/{TemplatesPage-CuWAlBEX.js → TemplatesPage-DwSAg4jO.js} +1 -1
- package/web-app/dist/assets/TerminalOutput-D9l4hRcp.js +31 -0
- package/web-app/dist/assets/{clock-BZGjjvpN.js → clock-KRe2srsu.js} +1 -1
- package/web-app/dist/assets/{external-link-DMhX_uRl.js → external-link-BSjKSqVI.js} +1 -1
- package/web-app/dist/assets/{index-ABzvlaPu.js → index-DKbfn_6W.js} +2 -2
- package/web-app/dist/assets/index-Dn3MgXE4.css +1 -0
- package/web-app/dist/index.html +2 -2
- package/web-app/dist/assets/HomePage-CwHuVFzN.js +0 -33
- package/web-app/dist/assets/ProjectPage-CCzfXsfH.js +0 -116
- package/web-app/dist/assets/TerminalOutput-jc4B3JYH.js +0 -16
- package/web-app/dist/assets/index-C-IWanPu.css +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import{j as e,r as n,a as h,u as be,b as ge}from"./index-DKbfn_6W.js";import{u as I,B as je}from"./Badge-aPxpGmfn.js";import{P as ve,a as Ne,S as ye,E,T as we}from"./TerminalOutput-D9l4hRcp.js";import"./clock-KRe2srsu.js";function ke(t){if(t<60)return`${Math.round(t)}s`;if(t<3600)return`${Math.floor(t/60)}m ${Math.round(t%60)}s`;const s=Math.floor(t/3600),l=Math.floor(t%3600/60);return`${s}h ${l}m`}function Se(t,s){if(!t||t<=0)return"--";const l={simple:{opus:1,haiku:1,total:3},standard:{opus:2,haiku:2,total:5},complex:{opus:3,haiku:3,total:8}},r=l[s]||l.standard;return t<=r.opus?"Opus":t>r.total-r.haiku?"Haiku":"Sonnet"}function Ce({status:t,prdSummary:s,onStop:l,onPause:r,onResume:a,isPaused:c}){const i=t?Se(t.iteration??0,t.complexity||"standard"):"--",o=c??(t==null?void 0:t.paused)??!1;return e.jsxs("div",{className:"card px-5 py-3 flex items-center gap-6 text-sm",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Phase"}),e.jsx("span",{className:"font-mono font-semibold text-ink",children:(t==null?void 0:t.phase)||"idle"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Complexity"}),e.jsx("span",{className:`font-mono font-semibold ${(t==null?void 0:t.complexity)==="complex"?"text-warning":(t==null?void 0:t.complexity)==="simple"?"text-success":"text-ink"}`,children:(t==null?void 0:t.complexity)||"standard"})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Model"}),e.jsx("span",{className:`font-mono font-semibold px-2 py-0.5 rounded-md text-xs ${i==="Opus"?"bg-primary/10 text-primary":i==="Haiku"?"bg-success/10 text-success":"bg-primary/10 text-primary"}`,children:i})]}),e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium",children:"Tasks"}),e.jsx("span",{className:"font-mono text-ink",children:t!=null&&t.current_task?e.jsx("span",{className:"text-xs",children:t.current_task}):e.jsx("span",{className:"text-muted",children:"--"})}),((t==null?void 0:t.pending_tasks)??0)>0&&e.jsxs("span",{className:"text-xs text-primary font-mono",children:["+",t==null?void 0:t.pending_tasks," pending"]})]}),s&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-5 bg-border"}),e.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[e.jsx("span",{className:"text-xs text-muted uppercase tracking-wider font-medium flex-shrink-0",children:"Building"}),e.jsx("span",{className:"text-xs font-mono text-ink truncate max-w-[220px]",title:s,children:s.length>60?s.slice(0,60)+"...":s})]})]}),e.jsx("div",{className:"flex-1"}),((t==null?void 0:t.uptime)??0)>0&&e.jsx("span",{className:"font-mono text-xs text-muted",children:ke((t==null?void 0:t.uptime)??0)}),(r||a)&&e.jsxs("button",{onClick:o?a:r,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold border border-warning/30 text-warning hover:bg-warning/10 transition-colors",children:[o?e.jsx(ve,{size:14}):e.jsx(Ne,{size:14}),o?"Resume":"Pause"]}),l&&e.jsxs("button",{onClick:l,className:"flex items-center gap-1.5 px-4 py-1.5 rounded-btn text-xs font-semibold bg-danger/10 text-danger border border-danger/20 hover:bg-danger/20 transition-colors",children:[e.jsx(ye,{size:14}),"Stop"]})]})}function Ee({status:t}){const s=[{label:"Iteration",value:t?t.iteration.toString():"--",color:"text-primary"},{label:"Agents",value:t?t.running_agents.toString():"--",color:t&&t.running_agents>0?"text-success":"text-muted"},{label:"Pending",value:t?t.pending_tasks.toString():"--",color:t&&t.pending_tasks>0?"text-warning":"text-muted"},{label:"Provider",value:(t==null?void 0:t.provider)||"--",color:"text-primary"}];return e.jsx("div",{className:"grid grid-cols-4 gap-3",children:s.map(l=>e.jsxs("div",{className:"card p-4 text-center",children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${l.color}`,children:l.value}),e.jsx("div",{className:"text-xs text-muted font-medium mt-1 uppercase tracking-wider",children:l.label})]},l.label))})}function Pe({plan:t,loading:s,onConfirm:l,onCancel:r}){return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/30 backdrop-blur-sm",children:e.jsxs("div",{className:"card w-full max-w-lg mx-4 p-6 rounded-card shadow-card-hover",children:[e.jsx("h2",{className:"text-lg font-bold text-ink mb-4",children:"Build Estimate"}),s?e.jsxs("div",{className:"flex flex-col items-center py-8 gap-3",children:[e.jsx("div",{className:"w-8 h-8 border-2 border-primary border-t-transparent rounded-full animate-spin"}),e.jsx("p",{className:"text-sm text-muted",children:"Analyzing PRD..."}),e.jsxs("div",{className:"flex gap-3 mt-4",children:[e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:l,className:"px-4 py-2 text-sm font-medium text-primary hover:text-primary/80 transition-colors underline",children:"Skip analysis, build now"})]})]}):t?e.jsxs(e.Fragment,{children:[t.returncode!==0&&e.jsxs("div",{className:"mb-4 px-3 py-2 rounded-btn bg-warning/10 border border-warning/20 text-warning text-xs",children:["loki plan exited with code ",t.returncode," - showing partial results"]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3 mb-4",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Complexity"}),e.jsx("div",{className:"text-base font-bold text-ink capitalize",children:t.complexity})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Est. Cost"}),e.jsx("div",{className:"text-base font-bold text-ink",children:t.cost_estimate})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-base font-bold text-ink",children:t.iterations})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Phases"}),e.jsx("div",{className:"text-xs text-ink capitalize",children:t.phases.join(", ")})]})]}),t.output_text&&e.jsxs("details",{className:"mb-4",children:[e.jsx("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:"Raw output"}),e.jsx("pre",{className:"mt-2 text-xs font-mono text-muted-accessible bg-black/5 rounded-card p-3 overflow-auto max-h-40 whitespace-pre-wrap",children:t.output_text})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:r,className:"px-4 py-2 text-sm font-medium text-muted hover:text-ink transition-colors",children:"Cancel"}),e.jsx("button",{onClick:l,className:"px-5 py-2 rounded-card text-sm font-semibold bg-primary text-white hover:bg-primary/90 transition-all shadow-button",children:"Start Build"})]})]}):e.jsx("div",{className:"text-sm text-muted py-4",children:"No plan data available."})]})})}function _e({onSubmit:t,running:s,error:l,provider:r,onProviderChange:a,initialPrd:c}){const[i,o]=n.useState(""),[m,b]=n.useState(""),[f,y]=n.useState("claude"),[d,g]=n.useState(""),j=r??f,[v,w]=n.useState(!1),[k,T]=n.useState([]),[x,P]=n.useState(!1),[N,M]=n.useState(!1),[_,A]=n.useState(!1),[z,F]=n.useState(null),[L,$]=n.useState(!1),[O,D]=n.useState(!1);n.useEffect(()=>{h.getTemplates().then(u=>{T(u),P(!1)}).catch(()=>{T([]),P(!0)})},[]),n.useEffect(()=>{c&&o(c)},[c]),n.useEffect(()=>{if(c)return;const u=localStorage.getItem("loki-prd-draft");u&&o(u),h.getPrdPrefill().then(({content:S})=>{S&&o(S)}).catch(()=>{})},[c]),n.useEffect(()=>{i.trim()?localStorage.setItem("loki-prd-draft",i):localStorage.removeItem("loki-prd-draft")},[i]),n.useEffect(()=>{const u=S=>{i.trim()&&S.preventDefault()};return window.addEventListener("beforeunload",u),()=>window.removeEventListener("beforeunload",u)},[i]);const R=n.useCallback(async(u,S)=>{b(S),w(!1);try{const G=await h.getTemplateContent(u);o(G.content)}catch{o(`# ${S}
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Describe your project here...
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- Feature 1
|
|
10
|
+
- Feature 2
|
|
11
|
+
- Feature 3
|
|
12
|
+
|
|
13
|
+
## Technical Requirements
|
|
14
|
+
|
|
15
|
+
- Requirement 1
|
|
16
|
+
- Requirement 2
|
|
17
|
+
`)}},[]),q=async()=>{if(!(!i.trim()||L)){$(!0),F(null),D(!0);try{const u=await h.planSession(i,j);F(u)}catch{F({complexity:"unknown",cost_estimate:"N/A",iterations:0,phases:[],output_text:"Failed to run loki plan. The CLI may not be available.",returncode:1})}finally{$(!1)}}},H=async()=>{if(!(!i.trim()||s||N)){D(!1),M(!0);try{await t(i,j,d.trim()||void 0,_?"quick":void 0)}finally{M(!1)}}};return e.jsxs(e.Fragment,{children:[O&&e.jsx(Pe,{plan:z,loading:L,onConfirm:H,onCancel:()=>D(!1)}),e.jsxs("div",{className:"card p-6 flex flex-col",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Product Requirements"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"relative",children:[e.jsx("button",{onClick:()=>w(!v),className:"text-xs font-medium px-3 py-1.5 rounded-card border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:m||"Templates"}),v&&e.jsx("div",{className:"absolute right-0 top-full mt-1 w-56 card rounded-card overflow-hidden z-20 shadow-card-hover",children:e.jsxs("div",{className:"py-1 max-h-64 overflow-y-auto terminal-scroll",children:[x&&e.jsx("div",{className:"px-3 py-2 text-xs text-warning border-b border-warning/10",children:"Could not load templates from server. Check that the backend is running."}),!x&&k.length===0&&e.jsx("div",{className:"px-3 py-2 text-xs text-muted",children:"Loading..."}),k.map(u=>e.jsx("button",{onClick:()=>R(u.filename,u.name),className:"w-full text-left px-3 py-2 text-sm text-ink hover:bg-primary/5 transition-colors",children:u.name},u.filename))]})})]})})]}),e.jsx("textarea",{value:i,onChange:u=>o(u.target.value),placeholder:"Paste your PRD here, or select a template above to get started...",className:"flex-1 min-h-[280px] w-full bg-card rounded-card border border-border-light px-4 py-3 text-sm font-mono text-ink placeholder:text-primary/60 resize-none focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsxs("div",{className:"mt-3",children:[e.jsx("label",{className:"block text-xs text-muted font-medium mb-1 uppercase tracking-wider",children:"Project Directory"}),e.jsx("input",{type:"text",value:d,onChange:u=>g(u.target.value),placeholder:"Leave blank to auto-create, or type a path (e.g. /Users/you/my-project)",className:"w-full bg-card rounded-card border border-border-light px-4 py-2 text-sm font-mono text-ink placeholder:text-primary/60/70 focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary/30 transition-all",spellCheck:!1}),e.jsx("p",{className:"text-xs text-muted-accessible mt-1",children:"Type a path or leave blank to auto-create under ~/purple-lab-projects/"})]}),l&&e.jsx("div",{className:"mt-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs font-medium",children:l}),e.jsxs("div",{className:"flex items-center gap-3 mt-4",children:[e.jsxs("button",{onClick:()=>A(!_),title:"Quick Mode: 3 iterations max, faster builds",className:`flex items-center gap-1.5 px-3 py-1.5 rounded-card text-xs font-semibold border transition-all ${_?"bg-primary/10 border-primary/30 text-primary":"border-border-light text-muted hover:text-ink hover:bg-card"}`,children:[e.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${_?"bg-primary":"bg-muted/40"}`}),"Quick"]}),e.jsx("div",{className:"flex-1"}),e.jsxs("span",{className:"text-xs text-muted font-mono",children:[i.length.toLocaleString()," chars"]}),e.jsx("button",{onClick:q,disabled:!i.trim()||s||N||L,className:`px-6 py-2.5 rounded-card text-sm font-semibold transition-all ${!i.trim()||s||N||L?"bg-primary/10 text-muted cursor-not-allowed":"bg-primary text-white hover:bg-primary/90 shadow-button"}`,children:L?"Analyzing...":N?"Starting...":s?"Building...":"Start Build"})]})]})]})}const B=[{key:"reason",label:"Reason",description:"Analyzing task, planning approach"},{key:"act",label:"Act",description:"Implementing changes, writing code"},{key:"reflect",label:"Reflect",description:"Reviewing output, self-critique"},{key:"verify",label:"Verify",description:"Testing, validation, quality gates"}];function Fe(t){if(!t)return"reason";const s=t.toLowerCase();return s.includes("reason")||s.includes("plan")?"reason":s.includes("act")||s.includes("implement")||s.includes("code")?"act":s.includes("reflect")||s.includes("review")?"reflect":s.includes("verify")||s.includes("test")||s.includes("check")?"verify":"idle"}function Le({currentPhase:t,iteration:s}){const l=Fe(t);return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"RARV Cycle"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:["Iteration ",s]})]}),e.jsx("div",{className:"flex items-center justify-center mb-5",children:e.jsxs("svg",{viewBox:"0 0 120 120",className:"w-28 h-28",children:[B.map((r,a)=>{const c=r.key===l,i=l!=="idle"&&B.findIndex(f=>f.key===l)>a,o=(a*90-90)*(Math.PI/180),m=60+40*Math.cos(o),b=60+40*Math.sin(o);return e.jsxs("g",{children:[a<B.length-1&&e.jsx("line",{x1:m,y1:b,x2:60+40*Math.cos(((a+1)*90-90)*(Math.PI/180)),y2:60+40*Math.sin(((a+1)*90-90)*(Math.PI/180)),stroke:i?"#553DE9":"#ECEAE3",strokeWidth:i?2:1,strokeDasharray:i?"none":"4 3"}),a===B.length-1&&e.jsx("line",{x1:m,y1:b,x2:60+40*Math.cos(-90*(Math.PI/180)),y2:60+40*Math.sin(-90*(Math.PI/180)),stroke:"#ECEAE3",strokeWidth:1,strokeDasharray:"4 3"}),e.jsx("circle",{cx:m,cy:b,r:c?14:10,fill:c||i?"#553DE9":"#E8E4FD",stroke:c?"#4432c4":i?"#553DE9":"#ECEAE3",strokeWidth:c?3:1.5,className:c?"phase-active":""}),e.jsx("text",{x:m,y:b+(a===0?-20:a===2?24:0),textAnchor:"middle",className:"text-[9px] font-semibold fill-ink",dx:a===1?22:a===3?-22:0,children:r.label[0]})]},r.key)}),e.jsx("text",{x:"60",y:"64",textAnchor:"middle",className:"text-lg font-bold font-mono fill-primary",children:s})]})}),e.jsx("div",{className:"space-y-2",children:B.map(r=>{const a=r.key===l;return e.jsxs("div",{className:`flex items-center gap-3 px-3 py-2 rounded-card transition-all duration-200 ${a?"bg-primary/8 border border-primary/20":"opacity-50"}`,children:[e.jsx("div",{className:`w-2.5 h-2.5 rounded-full flex-shrink-0 ${a?"bg-primary phase-active":"bg-border"}`}),e.jsxs("div",{children:[e.jsx("span",{className:`text-sm font-semibold ${a?"text-primary":"text-muted"}`,children:r.label}),a&&e.jsx("p",{className:"text-xs text-muted mt-0.5",children:r.description})]})]},r.key)})})]})}const W={architect:"bg-primary/10 text-primary border-primary/20",developer:"bg-primary/10 text-primary border-primary/20",tester:"bg-success/10 text-success border-success/20",reviewer:"bg-warning/10 text-warning border-warning/20",planner:"bg-primary/60/20 text-ink border-primary/60/30",default:"bg-border/30 text-muted border-border/50"};function Re(t){if(!t)return W.default;const s=t.toLowerCase();for(const[l,r]of Object.entries(W))if(s.includes(l))return r;return W.default}function Te({agents:t,loading:s}){const l=(t==null?void 0:t.filter(a=>a.alive))||[],r=(t==null?void 0:t.filter(a=>!a.alive))||[];return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Agents"}),e.jsxs("span",{className:"font-mono text-xs text-muted",children:[l.length," active"]})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading agents..."}),!s&&(t==null?void 0:t.length)===0&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No agents running"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a build to spawn agents"})]}),l.length>0&&e.jsx("div",{className:"space-y-2 mb-4",children:l.map(a=>e.jsx(K,{agent:a},a.id))}),r.length>0&&e.jsxs("details",{className:"mt-3",children:[e.jsxs("summary",{className:"text-xs text-muted cursor-pointer hover:text-ink transition-colors",children:[r.length," completed"]}),e.jsx("div",{className:"space-y-1.5 mt-2",children:r.slice(0,10).map(a=>e.jsx(K,{agent:a,compact:!0},a.id))})]})]})}function K({agent:t,compact:s}){const l=Re(t.type||t.name||"");return s?e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1 rounded-btn bg-hover text-xs",children:[e.jsx("div",{className:"w-1.5 h-1.5 rounded-full bg-muted/30"}),e.jsx("span",{className:"font-medium text-muted truncate",children:t.name||t.id}),e.jsx("span",{className:"text-primary/60 ml-auto",children:t.type})]}):e.jsxs("div",{className:`flex items-start gap-3 px-3 py-2.5 rounded-card border ${l}`,children:[e.jsx("div",{className:"flex-shrink-0 mt-0.5",children:e.jsx("div",{className:`w-2.5 h-2.5 rounded-full ${t.alive?"bg-success phase-active":"bg-muted/30"}`})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-semibold truncate",children:t.name||t.id}),t.type&&e.jsx("span",{className:"text-xs font-mono font-medium opacity-70",children:t.type})]}),t.task&&e.jsx("p",{className:"text-xs opacity-70 mt-0.5 truncate",children:t.task}),t.status&&t.status!=="unknown"&&e.jsx("span",{className:"inline-block text-xs font-mono mt-1 opacity-60",children:t.status})]}),t.pid&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible flex-shrink-0",children:["PID ",t.pid]})]})}const Me={pass:{badge:"bg-success/10 text-success border-success/20",dot:"bg-success",label:"Pass"},fail:{badge:"bg-danger/10 text-danger border-danger/20",dot:"bg-danger",label:"Fail"},skip:{badge:"bg-muted/10 text-muted border-muted/20",dot:"bg-muted/40",label:"Skip"},pending:{badge:"bg-warning/10 text-warning border-warning/20",dot:"bg-warning",label:"Pending"}};function $e({item:t}){const[s,l]=n.useState(!1),r=Me[t.status];return e.jsxs("div",{className:`border rounded-card overflow-hidden ${r.badge}`,children:[e.jsxs("button",{type:"button",className:"w-full flex items-center gap-3 px-3 py-2.5 text-left",onClick:()=>t.details&&l(!s),children:[e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${r.dot}`}),e.jsx("span",{className:"text-sm font-medium flex-1 truncate",children:t.label}),e.jsx("span",{className:"text-xs font-mono font-semibold uppercase tracking-wider flex-shrink-0",children:r.label}),t.details&&e.jsx("span",{className:"text-xs text-muted/60 flex-shrink-0",children:s?"v":">"})]}),s&&t.details&&e.jsx("div",{className:"px-3 pb-2.5 pt-0",children:e.jsx("p",{className:"text-xs font-mono opacity-70 leading-relaxed",children:t.details})})]})}function Ie({checklist:t,loading:s}){const l=t&&t.total>0?t.passed/t.total*100:0;return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Quality Gates"}),t&&e.jsxs("span",{className:"font-mono text-xs text-muted",children:[t.passed,"/",t.total," passed"]})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading gates..."}),!s&&!t&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No quality gate data"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Gates run during verification phase"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-4 mb-3 text-xs",children:[e.jsxs("span",{className:"text-success font-medium",children:[t.passed," passed"]}),t.failed>0&&e.jsxs("span",{className:"text-danger font-medium",children:[t.failed," failed"]}),t.skipped>0&&e.jsxs("span",{className:"text-muted",children:[t.skipped," skipped"]}),t.pending>0&&e.jsxs("span",{className:"text-warning",children:[t.pending," pending"]})]}),e.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden mb-4",children:e.jsx("div",{className:"h-full bg-success rounded-full transition-all duration-500",style:{width:`${l}%`}})}),e.jsx("div",{className:"space-y-2 max-h-[400px] overflow-y-auto terminal-scroll",children:t.items.map(r=>e.jsx($e,{item:r},r.id))})]})]})}const Ae={".py":"bg-success",".ts":"bg-primary",".tsx":"bg-primary",".md":"bg-warning",".sh":"bg-primary"};function De(t){const s=t.substring(t.lastIndexOf("."));return Ae[s]||"bg-muted"}function Be(t){return t==null?"":t<1024?`${t}B`:t<1024*1024?`${(t/1024).toFixed(1)}KB`:`${(t/(1024*1024)).toFixed(1)}MB`}const V=100;function X({node:t,depth:s,onSelectFile:l,selectedPath:r}){const[a,c]=n.useState(!1),[i,o]=n.useState(V),m=t.type==="directory",b=t.path===r,f=m&&a?t.children??[]:[],y=f.length>i;return e.jsxs("div",{children:[e.jsxs("button",{type:"button",className:`w-full flex items-center gap-2 px-2 py-1 rounded-btn text-left text-sm transition-colors hover:bg-hover ${b?"bg-primary/10 text-primary":"text-ink"}`,style:{paddingLeft:`${s*16+8}px`},onClick:()=>{m?(c(!a),a&&o(V)):l(t.path)},children:[m?e.jsx("span",{className:"font-mono text-xs text-muted w-3 flex-shrink-0",children:a?"v":">"}):e.jsx("span",{className:`w-2 h-2 rounded-full flex-shrink-0 ${De(t.name)}`}),e.jsx("span",{className:`truncate ${m?"font-medium":"font-mono text-xs"}`,children:t.name}),!m&&t.size!==void 0&&e.jsx("span",{className:"ml-auto text-xs font-mono text-muted-accessible flex-shrink-0",children:Be(t.size)})]}),f.length>0&&e.jsxs("div",{children:[f.slice(0,i).map(d=>e.jsx(X,{node:d,depth:s+1,onSelectFile:l,selectedPath:r},d.path)),y&&e.jsxs("button",{type:"button",className:"w-full text-left text-xs text-primary hover:text-primary/80 py-1 transition-colors",style:{paddingLeft:`${(s+1)*16+8}px`},onClick:()=>o(d=>d+V),children:["Show more (",f.length-i," remaining)"]})]})]})}function ze({files:t,loading:s}){const[l,r]=n.useState(null),[a,c]=n.useState(null),[i,o]=n.useState(!1),[m,b]=n.useState(null),f=n.useCallback(async d=>{c(null),r(d),o(!0),b(null);try{const g=await h.getFileContent(d);c(g.content)}catch(g){const j=g instanceof Error?g.message:"Unknown error",v=g instanceof TypeError||j==="Request timeout",w=j.includes("404")||j.includes("not found")||j.includes("Not found");b(v?"Network error - server may be unreachable":w?"File not found - it may have been deleted or renamed":j),c(null)}finally{o(!1)}},[]),y=n.useCallback(d=>{f(d)},[f]);return e.jsxs("div",{className:"card p-6 flex flex-col",style:{minHeight:"300px"},children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"File Browser"}),e.jsx("span",{className:"font-mono text-xs text-muted",children:".loki/"})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading files..."}),!s&&(!t||t.length===0)&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No project files found"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Start a session to generate .loki/ state"})]}),t&&t.length>0&&e.jsxs("div",{className:"flex gap-4 flex-1 min-h-0",children:[e.jsx("div",{className:"w-1/2 overflow-y-auto terminal-scroll pr-2",children:t.map(d=>e.jsx(X,{node:d,depth:0,onSelectFile:y,selectedPath:l},d.path))}),e.jsxs("div",{className:"w-1/2 bg-charcoal/5 rounded-card p-3 overflow-hidden flex flex-col",children:[!l&&e.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-xs",children:"Select a file to preview"}),l&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"text-xs font-mono text-primary mb-2 truncate",children:l}),e.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:i?e.jsx("div",{className:"text-muted text-xs",children:"Loading..."}):m?e.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 py-6",children:[e.jsx("p",{className:"text-danger text-xs font-medium",children:"Failed to load file"}),e.jsx("p",{className:"text-muted-accessible text-xs text-center max-w-[200px] break-words",children:m}),e.jsx("button",{type:"button",onClick:()=>l&&f(l),className:"mt-1 px-3 py-1 text-xs font-semibold rounded-btn border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:"Retry"})]}):e.jsx("pre",{className:"text-xs font-mono text-ink whitespace-pre-wrap break-words leading-relaxed",children:a})})]})]})]})]})}const Y=5e5;function Z(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function Ue(t){if(!t)return"Never";try{const s=new Date(t),r=new Date().getTime()-s.getTime(),a=Math.floor(r/(1e3*60*60));return a<1?"Just now":a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}catch{return t}}function Oe({memory:t,loading:s}){const l=t?[{label:"Episodic",count:t.episodic_count,color:"text-primary",bg:"bg-primary/10",border:"border-primary/20"},{label:"Semantic",count:t.semantic_count,color:"text-success",bg:"bg-success/10",border:"border-success/20"},{label:"Skills",count:t.skill_count,color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"}]:[],r=t?Math.min(t.total_tokens/Y*100,100):0;return e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Memory System"}),t&&e.jsx("span",{className:"font-mono text-xs text-muted",children:Ue(t.last_consolidation)})]}),s&&!t&&e.jsx("div",{className:"text-center py-8 text-muted text-sm",children:"Loading memory..."}),!s&&!t&&e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-muted text-sm",children:"No memory data available"}),e.jsx("p",{className:"text-primary/60 text-xs mt-1",children:"Memory populates during autonomous runs"})]}),t&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:l.map(a=>e.jsxs("div",{className:`${a.bg} border ${a.border} rounded-card p-3 text-center`,children:[e.jsx("div",{className:`text-2xl font-bold font-mono ${a.color}`,children:a.count}),e.jsx("div",{className:"text-xs text-muted-accessible font-medium mt-1 uppercase tracking-wider",children:a.label})]},a.label))}),e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[e.jsx("span",{className:"text-xs text-muted font-medium",children:"Token Usage"}),e.jsxs("span",{className:"text-xs font-mono text-ink",children:[Z(t.total_tokens)," / ",Z(Y)]})]}),e.jsx("div",{className:"w-full h-2 bg-charcoal/10 rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-500 ${r>80?"bg-danger":r>50?"bg-warning":"bg-info"}`,style:{width:`${r}%`}})})]}),e.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs",children:[e.jsx("span",{className:"text-muted",children:"Last Consolidation"}),e.jsx("span",{className:"font-mono text-ink",children:t.last_consolidation?new Date(t.last_consolidation).toLocaleString():"Never"})]})]})]})}function qe({visible:t}){const[s,l]=n.useState("markdown"),[r,a]=n.useState(null),[c,i]=n.useState(null),[o,m]=n.useState(!1),[b,f]=n.useState(!1),[y,d]=n.useState(null),[g,j]=n.useState(!1);if(!t)return null;const v=async()=>{m(!0),d(null),a(null),i(null);try{const x=await h.generateReport(s);a(x)}catch(x){d(x instanceof Error?x.message:"Failed to generate report")}finally{m(!1)}},w=async()=>{f(!0),d(null);try{const x=await h.shareSession();i(x)}catch(x){d(x instanceof Error?x.message:"Failed to share session")}finally{f(!1)}},k=async x=>{try{await navigator.clipboard.writeText(x),j(!0),setTimeout(()=>j(!1),2e3)}catch{}},T=()=>{if(!r)return;const x=new Blob([r.content],{type:s==="html"?"text/html":"text/markdown"}),P=URL.createObjectURL(x),N=document.createElement("a");N.href=P,N.download=`loki-report.${s==="html"?"html":"md"}`,N.click(),URL.revokeObjectURL(P)};return e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Report"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex items-center gap-1 card rounded-card p-1",children:["markdown","html"].map(x=>e.jsx("button",{onClick:()=>l(x),className:`px-3 py-1 text-xs font-semibold rounded-btn transition-all ${s===x?"bg-primary text-white shadow-sm":"text-muted hover:text-ink hover:bg-hover"}`,children:x.toUpperCase()},x))}),e.jsx("button",{onClick:v,disabled:o,className:"px-4 py-1.5 rounded-card text-xs font-semibold bg-primary text-white hover:bg-primary/90 disabled:opacity-50 transition-all",children:o?"Generating...":"Generate Report"})]})]}),y&&e.jsx("div",{className:"mb-3 px-3 py-2 rounded-btn bg-danger/10 border border-danger/20 text-danger text-xs",children:y}),r&&e.jsxs("div",{className:"mt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsxs("span",{className:"text-xs text-muted",children:["Report generated (",r.format,")"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>k(r.content),className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:g?"Copied":"Copy"}),e.jsx("button",{onClick:T,className:"px-3 py-1 text-xs font-medium text-muted hover:text-ink border border-border-light rounded-btn hover:bg-hover transition-all",children:"Download"}),e.jsx("button",{onClick:w,disabled:b,className:"px-3 py-1 text-xs font-medium bg-primary/10 text-primary border border-primary/20 rounded-btn hover:bg-primary/20 disabled:opacity-50 transition-all",children:b?"Sharing...":"Share as Gist"})]}),c&&e.jsxs("div",{className:"mb-2 flex items-center gap-2 px-3 py-2 rounded-btn bg-success/10 border border-success/20",children:[e.jsx("span",{className:"text-xs text-success font-medium",children:"Shared:"}),c.url?e.jsx("a",{href:c.url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary underline flex-1 truncate",children:c.url}):e.jsx("span",{className:"text-xs text-muted flex-1",children:"No URL returned"}),c.url&&e.jsx("button",{onClick:()=>k(c.url),className:"text-xs text-muted hover:text-ink",children:"Copy URL"})]}),e.jsx("pre",{className:"text-[11px] font-mono text-ink bg-black/5 rounded-card p-3 overflow-auto max-h-64 whitespace-pre-wrap terminal-scroll",children:r.content||"(empty report)"})]})]})}function J({visible:t}){const s=n.useCallback(()=>h.getMetrics(),[]),{data:l,loading:r}=I(s,15e3,t);return t?e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsxs("div",{className:"flex items-center justify-between mb-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Session Metrics"}),r&&e.jsx("div",{className:"w-4 h-4 border-2 border-primary border-t-transparent rounded-full animate-spin"})]}),l?e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Iterations"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:l.iterations??0})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Gate Pass Rate"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:typeof l.quality_gate_pass_rate=="number"?`${l.quality_gate_pass_rate.toFixed(0)}%`:"N/A"})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Tokens Used"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:(l.tokens_used??0).toLocaleString()})]}),e.jsxs("div",{className:"card rounded-card p-3",children:[e.jsx("div",{className:"text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-1",children:"Time Elapsed"}),e.jsx("div",{className:"text-xl font-bold text-ink",children:l.time_elapsed||"N/A"})]})]}):e.jsx("div",{className:"text-sm text-muted py-4 text-center",children:r?"Loading metrics...":"No metrics available"})]}):null}function He(t){switch(t){case"completed":case"complete":case"done":return"completed";case"in_progress":return"running";case"started":return"started";case"error":case"failed":return"failed";default:return"empty"}}const Ge={completed:"Completed",complete:"Completed",done:"Completed",in_progress:"In Progress",started:"Started",error:"Failed",failed:"Failed",empty:"Empty"};function We({onLoadSession:t}){const s=n.useCallback(()=>h.getSessionsHistory(),[]),{data:l,loading:r}=I(s,6e4,!0);return r&&!l?e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"text-sm text-muted",children:"Loading..."})]}):!l||l.length===0?null:e.jsxs("div",{className:"card p-4 rounded-card",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider mb-3",children:"Past Builds"}),e.jsx("div",{className:"flex flex-col gap-2 max-h-64 overflow-y-auto terminal-scroll",children:l.map(a=>{const c=a.file_count;return e.jsxs("button",{onClick:()=>t==null?void 0:t(a),className:"text-left px-4 py-3 rounded-card card hover:bg-hover transition-all group cursor-pointer",children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-mono text-muted-accessible",children:a.date}),e.jsxs("div",{className:"flex items-center gap-2",children:[c!==void 0&&c>0&&e.jsxs("span",{className:"text-xs font-mono text-muted-accessible",children:[c," files"]}),e.jsx(je,{status:He(a.status),children:Ge[a.status]||a.status})]})]}),e.jsx("div",{className:"text-xs text-ink truncate group-hover:text-primary transition-colors",children:a.prd_snippet||a.id}),e.jsx("div",{className:"text-xs font-mono text-muted-accessible mt-0.5 truncate",children:a.path})]},a.id)})})]})}function Ze(){const t=be(),[s,l]=n.useState(null),[r,a]=n.useState(()=>sessionStorage.getItem("pl_running")==="1"),[c,i]=n.useState(!1),[o,m]=n.useState(()=>sessionStorage.getItem("pl_prd")),[b,f]=n.useState(!1),[y,d]=n.useState(!1),[g,j]=n.useState(!1),[v,w]=n.useState(()=>sessionStorage.getItem("pl_tab")||"terminal"),[k,T]=n.useState(()=>sessionStorage.getItem("pl_provider")||"claude"),[x,P]=n.useState(void 0);n.useEffect(()=>{const p=sessionStorage.getItem("pl_template");p&&(sessionStorage.removeItem("pl_template"),h.getTemplateContent(p).then(({content:U})=>{U&&P(U)}).catch(()=>{}))},[]);const[N,M]=n.useState(null),[_,A]=n.useState(null),[z,F]=n.useState(null),L=n.useCallback(p=>{if(!p){M(null),A(null),F(null);return}M(p.status),A(p.agents),F(p.logs),a(p.status.running??!1),i(p.status.paused??!1)},[]),{connected:$,subscribe:O}=ge(L),D=n.useCallback(()=>h.getStatus(),[]),{data:R}=I(D,3e4,!$);n.useEffect(()=>{N===null&&R!==null&&(a(R.running??!1),i(R.paused??!1))},[R,N]),n.useEffect(()=>{sessionStorage.setItem("pl_running",r?"1":"0"),r&&f(!0)},[r]),n.useEffect(()=>{o?sessionStorage.setItem("pl_prd",o):sessionStorage.removeItem("pl_prd")},[o]),n.useEffect(()=>{sessionStorage.setItem("pl_provider",k)},[k]),n.useEffect(()=>{sessionStorage.setItem("pl_tab",v)},[v]);const q=n.useCallback(()=>h.getMemorySummary(),[]),H=n.useCallback(()=>h.getChecklist(),[]),u=n.useCallback(()=>h.getFiles(),[]),{data:S,loading:G}=I(q,3e4,r),{data:ee,loading:te}=I(H,3e4,r),{data:se,loading:ae}=I(u,3e4,r),C=N??R,re=_,ne=z,le=_===null,ie=z===null,ce=n.useCallback(async(p,U,he,fe)=>{l(null),f(!1),d(!1),w("terminal");try{await h.startSession({prd:p,provider:U,projectDir:he,mode:fe}),m(p)}catch(Q){l(Q instanceof Error?Q.message:"Failed to start session")}},[]),oe=n.useCallback(async()=>{try{(await h.stopSession()).stopped&&(a(!1),i(!1),m(null),M(null),A(null),F(null))}catch{a(!1),i(!1),m(null)}sessionStorage.removeItem("pl_running"),sessionStorage.removeItem("pl_prd"),sessionStorage.removeItem("pl_tab")},[]),de=n.useCallback(p=>{t(`/project/${p.id}`)},[t]),xe=n.useCallback(p=>{T(p)},[]),me=n.useCallback(async()=>{try{await h.pauseSession(),i(!0)}catch{}},[]),ue=n.useCallback(async()=>{try{await h.resumeSession(),i(!1)}catch{}},[]),pe=o&&o.replace(/^#+\s*/gm,"").split(`
|
|
18
|
+
`).find(p=>p.trim().length>0)||null;return e.jsxs("div",{className:"min-h-screen bg-[#FAF9F6] relative",children:[e.jsx("div",{className:"pattern-nodes"}),e.jsx("div",{className:"max-w-[1920px] mx-auto px-6 py-6 relative z-10",children:r?e.jsxs(e.Fragment,{children:[e.jsx(E,{name:"ControlBar",children:e.jsx(Ce,{status:C,prdSummary:pe,onStop:oe,onPause:me,onResume:ue,isPaused:c})}),e.jsx("div",{className:"mt-4",children:e.jsx(E,{name:"StatusOverview",children:e.jsx(Ee,{status:C})})}),e.jsxs("div",{className:"mt-4 grid grid-cols-12 gap-6",style:{height:"calc(100vh - 340px)",minHeight:"400px"},children:[e.jsx("div",{className:"col-span-3 flex flex-col gap-6",children:e.jsx(E,{name:"PhaseVisualizer",children:e.jsx(Le,{currentPhase:(C==null?void 0:C.phase)||"idle",iteration:(C==null?void 0:C.iteration)||0})})}),e.jsxs("div",{className:"col-span-5 flex flex-col gap-0 min-h-0",children:[e.jsxs("div",{className:"flex items-center gap-1 mb-2 flex-shrink-0",children:[e.jsx("button",{onClick:()=>w("terminal"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${v==="terminal"?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:"Terminal"}),e.jsx("button",{onClick:()=>w("metrics"),className:`px-3 py-1.5 text-xs font-semibold rounded-lg transition-all ${v==="metrics"?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:"Metrics"})]}),e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(E,{name:"Terminal",children:v==="terminal"?e.jsx(we,{logs:ne,loading:ie,subscribe:O}):e.jsx(J,{visible:!0})})})]}),e.jsxs("div",{className:"col-span-4 flex flex-col gap-6 overflow-y-auto",children:[e.jsx(E,{name:"AgentDashboard",children:e.jsx(Te,{agents:re,loading:le})}),e.jsx(E,{name:"QualityGates",children:e.jsx(Ie,{checklist:ee,loading:te})})]})]}),e.jsxs("div",{className:"mt-6 grid grid-cols-12 gap-6",children:[e.jsx("div",{className:"col-span-6",children:e.jsx(E,{name:"FileBrowser",children:e.jsx(ze,{files:se,loading:ae})})}),e.jsx("div",{className:"col-span-6",children:e.jsx(E,{name:"MemoryViewer",children:e.jsx(Oe,{memory:S,loading:G})})})]})]}):e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"text-center mt-8 mb-8",children:[e.jsx("h2",{className:"font-heading text-h1 text-[#36342E]",children:"Describe it. Build it. Ship it."}),e.jsx("p",{className:"text-[#6B6960] mt-2 text-base max-w-lg mx-auto",children:"Paste a PRD or pick a template. Purple Lab spins up autonomous agents to build your project from scratch."})]}),e.jsx("div",{className:"w-full max-w-3xl",children:e.jsx(_e,{onSubmit:ce,running:r,error:s,provider:k,onProviderChange:xe,initialPrd:x})}),b&&!r&&e.jsxs("div",{className:"w-full max-w-3xl mt-4 flex flex-col gap-4",children:[e.jsx("button",{onClick:async()=>{try{const p=await h.getSessionsHistory();p.length>0&&t(`/project/${p[0].id}`)}catch{}},className:"w-full px-6 py-4 rounded-card text-base font-bold bg-[#553DE9] text-white hover:bg-[#553DE9]/90 transition-all shadow-lg shadow-[#553DE9]/20",children:"View Project -- Browse Files and Preview"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>d(!y),className:"px-4 py-2 rounded-card text-sm font-semibold border border-[#553DE9]/30 text-[#553DE9] hover:bg-[#553DE9]/5 transition-all",children:y?"Hide Report":"Report"}),e.jsx("button",{onClick:()=>j(!g),className:"px-4 py-2 rounded-card text-sm font-semibold border border-[#ECEAE3] text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0] transition-all",children:g?"Hide Metrics":"Metrics"})]}),e.jsx(qe,{visible:y}),e.jsx(J,{visible:g})]}),e.jsx("div",{className:"w-full max-w-3xl mt-4",children:e.jsx(We,{onLoadSession:de})}),e.jsxs("div",{className:"mt-6 text-xs text-[#6B6960] flex items-center gap-2",children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${$?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),$?"Connected to Purple Lab backend":"Waiting for backend connection..."]})]})})]})}export{Ze as default};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var Mt=e=>{throw TypeError(e)};var Pt=(e,t,n)=>t.has(e)||Mt("Cannot "+n);var Pe=(e,t,n)=>(Pt(e,t,"read from private field"),n?n.call(e):t.get(e)),Et=(e,t,n)=>t.has(e)?Mt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),Lt=(e,t,n,r)=>(Pt(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{c as H,r as u,W as we,j as a,a as W,B as Rt,S as Vn,d as qn,u as Wn}from"./index-DKbfn_6W.js";import{T as Un,P as Gn,a as Kn,S as Xn,E as Qn}from"./TerminalOutput-D9l4hRcp.js";import{B as Ue}from"./Button-DlY3TKRG.js";import{C as Yn,a as Jn}from"./clock-KRe2srsu.js";import{E as Zn}from"./external-link-BSjKSqVI.js";/**
|
|
2
|
+
* @license lucide-react v0.577.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const er=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],tr=H("arrow-left",er);/**
|
|
7
|
+
* @license lucide-react v0.577.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const nr=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],rr=H("arrow-right",nr);/**
|
|
12
|
+
* @license lucide-react v0.577.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const ar=[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]],or=H("bot",ar);/**
|
|
17
|
+
* @license lucide-react v0.577.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const sr=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ir=H("chevron-down",sr);/**
|
|
22
|
+
* @license lucide-react v0.577.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const lr=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],cr=H("chevron-right",lr);/**
|
|
27
|
+
* @license lucide-react v0.577.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const ur=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],dr=H("code-xml",ur);/**
|
|
32
|
+
* @license lucide-react v0.577.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const fr=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],Be=H("eye",fr);/**
|
|
37
|
+
* @license lucide-react v0.577.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const pr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]],hr=H("file-braces",pr);/**
|
|
42
|
+
* @license lucide-react v0.577.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const mr=[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],ae=H("file-code-corner",mr);/**
|
|
47
|
+
* @license lucide-react v0.577.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const xr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],gr=H("file-code",xr);/**
|
|
52
|
+
* @license lucide-react v0.577.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const vr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]],br=H("file-plus",vr);/**
|
|
57
|
+
* @license lucide-react v0.577.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const yr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],nn=H("file-text",yr);/**
|
|
62
|
+
* @license lucide-react v0.577.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const wr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]],jr=H("file-type",wr);/**
|
|
67
|
+
* @license lucide-react v0.577.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const Sr=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],kr=H("file",Sr);/**
|
|
72
|
+
* @license lucide-react v0.577.0 - ISC
|
|
73
|
+
*
|
|
74
|
+
* This source code is licensed under the ISC license.
|
|
75
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
76
|
+
*/const zr=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Cr=H("folder-open",zr);/**
|
|
77
|
+
* @license lucide-react v0.577.0 - ISC
|
|
78
|
+
*
|
|
79
|
+
* This source code is licensed under the ISC license.
|
|
80
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
81
|
+
*/const Nr=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Mr=H("folder-plus",Nr);/**
|
|
82
|
+
* @license lucide-react v0.577.0 - ISC
|
|
83
|
+
*
|
|
84
|
+
* This source code is licensed under the ISC license.
|
|
85
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
86
|
+
*/const Pr=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Er=H("folder",Pr);/**
|
|
87
|
+
* @license lucide-react v0.577.0 - ISC
|
|
88
|
+
*
|
|
89
|
+
* This source code is licensed under the ISC license.
|
|
90
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
91
|
+
*/const Lr=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Rr=H("key-round",Lr);/**
|
|
92
|
+
* @license lucide-react v0.577.0 - ISC
|
|
93
|
+
*
|
|
94
|
+
* This source code is licensed under the ISC license.
|
|
95
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
96
|
+
*/const Or=[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]],Dr=H("message-square",Or);/**
|
|
97
|
+
* @license lucide-react v0.577.0 - ISC
|
|
98
|
+
*
|
|
99
|
+
* This source code is licensed under the ISC license.
|
|
100
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
101
|
+
*/const $r=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Ir=H("rotate-cw",$r);/**
|
|
102
|
+
* @license lucide-react v0.577.0 - ISC
|
|
103
|
+
*
|
|
104
|
+
* This source code is licensed under the ISC license.
|
|
105
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
106
|
+
*/const Tr=[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]],Fr=H("send",Tr);/**
|
|
107
|
+
* @license lucide-react v0.577.0 - ISC
|
|
108
|
+
*
|
|
109
|
+
* This source code is licensed under the ISC license.
|
|
110
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
111
|
+
*/const Ar=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],_r=H("shield-check",Ar);/**
|
|
112
|
+
* @license lucide-react v0.577.0 - ISC
|
|
113
|
+
*
|
|
114
|
+
* This source code is licensed under the ISC license.
|
|
115
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
116
|
+
*/const Br=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Hr=H("terminal",Br);/**
|
|
117
|
+
* @license lucide-react v0.577.0 - ISC
|
|
118
|
+
*
|
|
119
|
+
* This source code is licensed under the ISC license.
|
|
120
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
121
|
+
*/const Vr=[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]],rt=H("test-tube-diagonal",Vr);/**
|
|
122
|
+
* @license lucide-react v0.577.0 - ISC
|
|
123
|
+
*
|
|
124
|
+
* This source code is licensed under the ISC license.
|
|
125
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
126
|
+
*/const qr=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],Wr=H("trash-2",qr);/**
|
|
127
|
+
* @license lucide-react v0.577.0 - ISC
|
|
128
|
+
*
|
|
129
|
+
* This source code is licensed under the ISC license.
|
|
130
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
131
|
+
*/const Ur=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ke=H("x",Ur);function Ot(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Gr(e){if(Array.isArray(e))return e}function Kr(e,t,n){return(t=ta(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Xr(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,s,d,i=[],l=!0,c=!1;try{if(s=(n=n.call(e)).next,t!==0)for(;!(l=(r=s.call(n)).done)&&(i.push(r.value),i.length!==t);l=!0);}catch(p){c=!0,o=p}finally{try{if(!l&&n.return!=null&&(d=n.return(),Object(d)!==d))return}finally{if(c)throw o}}return i}}function Qr(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
132
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Dt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function $t(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Dt(Object(n),!0).forEach(function(r){Kr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Dt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Yr(e,t){if(e==null)return{};var n,r,o=Jr(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}function Jr(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.indexOf(r)!==-1)continue;n[r]=e[r]}return n}function Zr(e,t){return Gr(e)||Xr(e,t)||na(e,t)||Qr()}function ea(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function ta(e){var t=ea(e,"string");return typeof t=="symbol"?t:t+""}function na(e,t){if(e){if(typeof e=="string")return Ot(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ot(e,t):void 0}}function ra(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function It(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Tt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?It(Object(n),!0).forEach(function(r){ra(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):It(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function aa(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,s){return s(o)},r)}}function Ee(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var d=arguments.length,i=new Array(d),l=0;l<d;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function Xe(e){return{}.toString.call(e).includes("Object")}function oa(e){return!Object.keys(e).length}function $e(e){return typeof e=="function"}function sa(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ia(e,t){return Xe(t)||le("changeType"),Object.keys(t).some(function(n){return!sa(e,n)})&&le("changeField"),t}function la(e){$e(e)||le("selectorType")}function ca(e){$e(e)||Xe(e)||le("handlerType"),Xe(e)&&Object.values(e).some(function(t){return!$e(t)})&&le("handlersType")}function ua(e){e||le("initialIsRequired"),Xe(e)||le("initialType"),oa(e)&&le("initialContent")}function da(e,t){throw new Error(e[t]||e.default)}var fa={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},le=Ee(da)(fa),He={changes:ia,selector:la,handler:ca,initial:ua};function pa(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};He.initial(e),He.handler(t);var n={current:e},r=Ee(xa)(n,t),o=Ee(ma)(n),s=Ee(He.changes)(e),d=Ee(ha)(n);function i(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(p){return p};return He.selector(c),c(n.current)}function l(c){aa(r,o,s,d)(c)}return[i,l]}function ha(e,t){return $e(t)?t(e.current):t}function ma(e,t){return e.current=Tt(Tt({},e.current),t),t}function xa(e,t,n){return $e(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var ga={create:pa},va={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function ba(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var d=arguments.length,i=new Array(d),l=0;l<d;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function ya(e){return{}.toString.call(e).includes("Object")}function wa(e){return e||Ft("configIsRequired"),ya(e)||Ft("configType"),e.urls?(ja(),{paths:{vs:e.urls.monacoBase}}):e}function ja(){console.warn(rn.deprecation)}function Sa(e,t){throw new Error(e[t]||e.default)}var rn={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
|
|
133
|
+
You are using deprecated way of configuration.
|
|
134
|
+
|
|
135
|
+
Instead of using
|
|
136
|
+
monaco.config({ urls: { monacoBase: '...' } })
|
|
137
|
+
use
|
|
138
|
+
monaco.config({ paths: { vs: '...' } })
|
|
139
|
+
|
|
140
|
+
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
141
|
+
`},Ft=ba(Sa)(rn),ka={config:wa},za=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(s,d){return d(s)},o)}};function an(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],an(e[n],t[n]))}),$t($t({},e),t)}var Ca={type:"cancelation",msg:"operation is manually canceled"};function at(e){var t=!1,n=new Promise(function(r,o){e.then(function(s){return t?o(Ca):r(s)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var Na=["monaco"],Ma=ga.create({config:va,isInitialized:!1,resolve:null,reject:null,monaco:null}),on=Zr(Ma,2),Te=on[0],Qe=on[1];function Pa(e){var t=ka.config(e),n=t.monaco,r=Yr(t,Na);Qe(function(o){return{config:an(o.config,r),monaco:n}})}function Ea(){var e=Te(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(Qe({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),at(ot);if(window.monaco&&window.monaco.editor)return sn(window.monaco),e.resolve(window.monaco),at(ot);za(La,Oa)(Da)}return at(ot)}function La(e){return document.body.appendChild(e)}function Ra(e){var t=document.createElement("script");return e&&(t.src=e),t}function Oa(e){var t=Te(function(r){var o=r.config,s=r.reject;return{config:o,reject:s}}),n=Ra("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function Da(){var e=Te(function(n){var r=n.config,o=n.resolve,s=n.reject;return{config:r,resolve:o,reject:s}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){var r=n.m||n;sn(r),e.resolve(r)},function(n){e.reject(n)})}function sn(e){Te().monaco||Qe({monaco:e})}function $a(){return Te(function(e){var t=e.monaco;return t})}var ot=new Promise(function(e,t){return Qe({resolve:e,reject:t})}),ln={config:Pa,init:Ea,__getMonacoInstance:$a},Ia={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},st=Ia,Ta={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Fa=Ta;function Aa({children:e}){return we.createElement("div",{style:Fa.container},e)}var _a=Aa,Ba=_a;function Ha({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:s,wrapperProps:d}){return we.createElement("section",{style:{...st.wrapper,width:e,height:t},...d},!n&&we.createElement(Ba,null,r),we.createElement("div",{ref:o,style:{...st.fullWidth,...!n&&st.hide},className:s}))}var Va=Ha,cn=u.memo(Va);function qa(e){u.useEffect(e,[])}var un=qa;function Wa(e,t,n=!0){let r=u.useRef(!0);u.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var Q=Wa;function Oe(){}function be(e,t,n,r){return Ua(e,r)||Ga(e,t,n,r)}function Ua(e,t){return e.editor.getModel(dn(e,t))}function Ga(e,t,n,r){return e.editor.createModel(t,n,r?dn(e,r):void 0)}function dn(e,t){return e.Uri.parse(t)}function Ka({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:s,modifiedModelPath:d,keepCurrentOriginalModel:i=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:p="Loading...",options:v={},height:m="100%",width:y="100%",className:j,wrapperProps:x={},beforeMount:w=Oe,onMount:b=Oe}){let[h,z]=u.useState(!1),[S,g]=u.useState(!0),M=u.useRef(null),C=u.useRef(null),D=u.useRef(null),_=u.useRef(b),L=u.useRef(w),P=u.useRef(!1);un(()=>{let k=ln.init();return k.then(O=>(C.current=O)&&g(!1)).catch(O=>(O==null?void 0:O.type)!=="cancelation"&&console.error("Monaco initialization: error:",O)),()=>M.current?I():k.cancel()}),Q(()=>{if(M.current&&C.current){let k=M.current.getOriginalEditor(),O=be(C.current,e||"",r||n||"text",s||"");O!==k.getModel()&&k.setModel(O)}},[s],h),Q(()=>{if(M.current&&C.current){let k=M.current.getModifiedEditor(),O=be(C.current,t||"",o||n||"text",d||"");O!==k.getModel()&&k.setModel(O)}},[d],h),Q(()=>{let k=M.current.getModifiedEditor();k.getOption(C.current.editor.EditorOption.readOnly)?k.setValue(t||""):t!==k.getValue()&&(k.executeEdits("",[{range:k.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),k.pushUndoStop())},[t],h),Q(()=>{var k,O;(O=(k=M.current)==null?void 0:k.getModel())==null||O.original.setValue(e||"")},[e],h),Q(()=>{let{original:k,modified:O}=M.current.getModel();C.current.editor.setModelLanguage(k,r||n||"text"),C.current.editor.setModelLanguage(O,o||n||"text")},[n,r,o],h),Q(()=>{var k;(k=C.current)==null||k.editor.setTheme(c)},[c],h),Q(()=>{var k;(k=M.current)==null||k.updateOptions(v)},[v],h);let E=u.useCallback(()=>{var q;if(!C.current)return;L.current(C.current);let k=be(C.current,e||"",r||n||"text",s||""),O=be(C.current,t||"",o||n||"text",d||"");(q=M.current)==null||q.setModel({original:k,modified:O})},[n,t,o,e,r,s,d]),F=u.useCallback(()=>{var k;!P.current&&D.current&&(M.current=C.current.editor.createDiffEditor(D.current,{automaticLayout:!0,...v}),E(),(k=C.current)==null||k.editor.setTheme(c),z(!0),P.current=!0)},[v,c,E]);u.useEffect(()=>{h&&_.current(M.current,C.current)},[h]),u.useEffect(()=>{!S&&!h&&F()},[S,h,F]);function I(){var O,q,Y,J;let k=(O=M.current)==null?void 0:O.getModel();i||((q=k==null?void 0:k.original)==null||q.dispose()),l||((Y=k==null?void 0:k.modified)==null||Y.dispose()),(J=M.current)==null||J.dispose()}return we.createElement(cn,{width:y,height:m,isEditorReady:h,loading:p,_ref:D,className:j,wrapperProps:x})}var Xa=Ka;u.memo(Xa);function Qa(e){let t=u.useRef();return u.useEffect(()=>{t.current=e},[e]),t.current}var Ya=Qa,Ve=new Map;function Ja({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:s,theme:d="light",line:i,loading:l="Loading...",options:c={},overrideServices:p={},saveViewState:v=!0,keepCurrentModel:m=!1,width:y="100%",height:j="100%",className:x,wrapperProps:w={},beforeMount:b=Oe,onMount:h=Oe,onChange:z,onValidate:S=Oe}){let[g,M]=u.useState(!1),[C,D]=u.useState(!0),_=u.useRef(null),L=u.useRef(null),P=u.useRef(null),E=u.useRef(h),F=u.useRef(b),I=u.useRef(),k=u.useRef(r),O=Ya(s),q=u.useRef(!1),Y=u.useRef(!1);un(()=>{let R=ln.init();return R.then($=>(_.current=$)&&D(!1)).catch($=>($==null?void 0:$.type)!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>L.current?U():R.cancel()}),Q(()=>{var $,V,Z,ee;let R=be(_.current,e||r||"",t||o||"",s||n||"");R!==(($=L.current)==null?void 0:$.getModel())&&(v&&Ve.set(O,(V=L.current)==null?void 0:V.saveViewState()),(Z=L.current)==null||Z.setModel(R),v&&((ee=L.current)==null||ee.restoreViewState(Ve.get(s))))},[s],g),Q(()=>{var R;(R=L.current)==null||R.updateOptions(c)},[c],g),Q(()=>{!L.current||r===void 0||(L.current.getOption(_.current.editor.EditorOption.readOnly)?L.current.setValue(r):r!==L.current.getValue()&&(Y.current=!0,L.current.executeEdits("",[{range:L.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),L.current.pushUndoStop(),Y.current=!1))},[r],g),Q(()=>{var $,V;let R=($=L.current)==null?void 0:$.getModel();R&&o&&((V=_.current)==null||V.editor.setModelLanguage(R,o))},[o],g),Q(()=>{var R;i!==void 0&&((R=L.current)==null||R.revealLine(i))},[i],g),Q(()=>{var R;(R=_.current)==null||R.editor.setTheme(d)},[d],g);let J=u.useCallback(()=>{var R;if(!(!P.current||!_.current)&&!q.current){F.current(_.current);let $=s||n,V=be(_.current,r||e||"",t||o||"",$||"");L.current=(R=_.current)==null?void 0:R.editor.create(P.current,{model:V,automaticLayout:!0,...c},p),v&&L.current.restoreViewState(Ve.get($)),_.current.editor.setTheme(d),i!==void 0&&L.current.revealLine(i),M(!0),q.current=!0}},[e,t,n,r,o,s,c,p,v,d,i]);u.useEffect(()=>{g&&E.current(L.current,_.current)},[g]),u.useEffect(()=>{!C&&!g&&J()},[C,g,J]),k.current=r,u.useEffect(()=>{var R,$;g&&z&&((R=I.current)==null||R.dispose(),I.current=($=L.current)==null?void 0:$.onDidChangeModelContent(V=>{Y.current||z(L.current.getValue(),V)}))},[g,z]),u.useEffect(()=>{if(g){let R=_.current.editor.onDidChangeMarkers($=>{var Z;let V=(Z=L.current.getModel())==null?void 0:Z.uri;if(V&&$.find(ee=>ee.path===V.path)){let ee=_.current.editor.getModelMarkers({resource:V});S==null||S(ee)}});return()=>{R==null||R.dispose()}}return()=>{}},[g,S]);function U(){var R,$;(R=I.current)==null||R.dispose(),m?v&&Ve.set(s,L.current.saveViewState()):($=L.current.getModel())==null||$.dispose(),L.current.dispose()}return we.createElement(cn,{width:y,height:j,isEditorReady:g,loading:l,_ref:P,className:x,wrapperProps:w})}var Za=Ja,eo=u.memo(Za),to=eo;function no(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function ro(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function ao(e){return e/100*window.innerHeight}function oo(e){return e/100*window.innerWidth}function so(e){switch(typeof e){case"number":return[e,"px"];case"string":{const t=parseFloat(e);return e.endsWith("%")?[t,"%"]:e.endsWith("px")?[t,"px"]:e.endsWith("rem")?[t,"rem"]:e.endsWith("em")?[t,"em"]:e.endsWith("vh")?[t,"vh"]:e.endsWith("vw")?[t,"vw"]:[t,"%"]}}}function Le({groupSize:e,panelElement:t,styleProp:n}){let r;const[o,s]=so(n);switch(s){case"%":{r=o/100*e;break}case"px":{r=o;break}case"rem":{r=ro(t,o);break}case"em":{r=no(t,o);break}case"vh":{r=ao(o);break}case"vw":{r=oo(o);break}}return r}function X(e){return parseFloat(e.toFixed(3))}function ke({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,o)=>(r+=t==="horizontal"?o.element.offsetWidth:o.element.offsetHeight,r),0)}function lt(e){const{panels:t}=e,n=ke({group:e});return n===0?t.map(r=>({groupResizeBehavior:r.panelConstraints.groupResizeBehavior,collapsedSize:0,collapsible:r.panelConstraints.collapsible===!0,defaultSize:void 0,disabled:r.panelConstraints.disabled,minSize:0,maxSize:100,panelId:r.id})):t.map(r=>{const{element:o,panelConstraints:s}=r;let d=0;if(s.collapsedSize!==void 0){const p=Le({groupSize:n,panelElement:o,styleProp:s.collapsedSize});d=X(p/n*100)}let i;if(s.defaultSize!==void 0){const p=Le({groupSize:n,panelElement:o,styleProp:s.defaultSize});i=X(p/n*100)}let l=0;if(s.minSize!==void 0){const p=Le({groupSize:n,panelElement:o,styleProp:s.minSize});l=X(p/n*100)}let c=100;if(s.maxSize!==void 0){const p=Le({groupSize:n,panelElement:o,styleProp:s.maxSize});c=X(p/n*100)}return{groupResizeBehavior:s.groupResizeBehavior,collapsedSize:d,collapsible:s.collapsible===!0,defaultSize:i,disabled:s.disabled,minSize:l,maxSize:c,panelId:r.id}})}function A(e,t="Assertion error"){if(!e)throw Error(t)}function ct(e,t){return Array.from(t).sort(e==="horizontal"?io:lo)}function io(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function lo(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function fn(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function pn(e,t){return{x:e.x>=t.left&&e.x<=t.right?0:Math.min(Math.abs(e.x-t.left),Math.abs(e.x-t.right)),y:e.y>=t.top&&e.y<=t.bottom?0:Math.min(Math.abs(e.y-t.top),Math.abs(e.y-t.bottom))}}function co({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let o,s=Number.MAX_VALUE;for(const d of t){const{x:i,y:l}=pn(r,d),c=e==="horizontal"?i:l;c<s&&(s=c,o=d)}return A(o,"No rect found"),o}let qe;function uo(){return qe===void 0&&(typeof matchMedia=="function"?qe=!!matchMedia("(pointer:coarse)").matches:qe=!1),qe}function hn(e){const{element:t,orientation:n,panels:r,separators:o}=e,s=ct(n,Array.from(t.children).filter(fn).map(j=>({element:j}))).map(({element:j})=>j),d=[];let i=!1,l=!1,c=-1,p=-1,v=0,m,y=[];{let j=-1;for(const x of s)x.hasAttribute("data-panel")&&(j++,x.ariaDisabled===null&&(v++,c===-1&&(c=j),p=j))}if(v>1){let j=-1;for(const x of s)if(x.hasAttribute("data-panel")){j++;const w=r.find(b=>b.element===x);if(w){if(m){const b=m.element.getBoundingClientRect(),h=x.getBoundingClientRect();let z;if(l){const S=n==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),g=n==="horizontal"?new DOMRect(h.left,h.top,0,h.height):new DOMRect(h.left,h.top,h.width,0);switch(y.length){case 0:{z=[S,g];break}case 1:{const M=y[0],C=co({orientation:n,rects:[b,h],targetRect:M.element.getBoundingClientRect()});z=[M,C===b?g:S];break}default:{z=y;break}}}else y.length?z=y:z=[n==="horizontal"?new DOMRect(b.right,h.top,h.left-b.right,h.height):new DOMRect(h.left,b.bottom,h.width,h.top-b.bottom)];for(const S of z){let g="width"in S?S:S.element.getBoundingClientRect();const M=uo()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(g.width<M){const D=M-g.width;g=new DOMRect(g.x-D/2,g.y,g.width+D,g.height)}if(g.height<M){const D=M-g.height;g=new DOMRect(g.x,g.y-D/2,g.width,g.height+D)}const C=j<=c||j>p;!i&&!C&&d.push({group:e,groupSize:ke({group:e}),panels:[m,w],separator:"width"in S?void 0:S,rect:g}),i=!1}}l=!1,m=w,y=[]}}else if(x.hasAttribute("data-separator")){x.ariaDisabled!==null&&(i=!0);const w=o.find(b=>b.element===x);w?y.push(w):(m=void 0,y=[])}else l=!0}return d}var ie;class mn{constructor(){Et(this,ie,{})}addListener(t,n){const r=Pe(this,ie)[t];return r===void 0?Pe(this,ie)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=Pe(this,ie)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let o=!1,s=null;const d=Array.from(r);for(let i=0;i<d.length;i++){const l=d[i];try{l.call(null,n)}catch(c){s===null&&(o=!0,s=c)}}if(o)throw s}}removeAllListeners(){Lt(this,ie,{})}removeListener(t,n){const r=Pe(this,ie)[t];if(r!==void 0){const o=r.indexOf(n);o>=0&&r.splice(o,1)}}}ie=new WeakMap;let ne=new Map;const xn=new mn;function fo(e){ne=new Map(ne),ne.delete(e)}function At(e,t){for(const[n]of ne)if(n.id===e)return n}function ce(e,t){for(const[n,r]of ne)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function me(){return ne}function pt(e,t){return xn.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function oe(e,t){const n=ne.get(e);ne=new Map(ne),ne.set(e,t),xn.emit("groupChange",{group:e,prev:n,next:t})}function po(e,t,n){let r,o={x:1/0,y:1/0};for(const s of t){const d=pn(n,s.rect);switch(e){case"horizontal":{d.x<=o.x&&(r=s,o=d);break}case"vertical":{d.y<=o.y&&(r=s,o=d);break}}}return r?{distance:o,hitRegion:r}:void 0}function ho(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function mo(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Ht(e),b:Ht(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();A(r,"Stacking order can only be calculated for elements with a common ancestor");const o={a:Bt(_t(n.a)),b:Bt(_t(n.b))};if(o.a===o.b){const s=r.childNodes,d={a:n.a.at(-1),b:n.b.at(-1)};let i=s.length;for(;i--;){const l=s[i];if(l===d.a)return 1;if(l===d.b)return-1}}return Math.sign(o.a-o.b)}const xo=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function go(e){const t=getComputedStyle(gn(e)??e).display;return t==="flex"||t==="inline-flex"}function vo(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||go(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||xo.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function _t(e){let t=e.length;for(;t--;){const n=e[t];if(A(n,"Missing node"),vo(n))return n}return null}function Bt(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Ht(e){const t=[];for(;e;)t.push(e),e=gn(e);return t}function gn(e){const{parentNode:t}=e;return ho(t)?t.host:t}function bo(e,t){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function yo({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!fn(n)||n.contains(e)||e.contains(n))return!0;if(mo(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(bo(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function ht(e,t){const n=[];return t.forEach((r,o)=>{if(o.disabled)return;const s=hn(o),d=po(o.orientation,s,{x:e.clientX,y:e.clientY});d&&d.distance.x<=0&&d.distance.y<=0&&yo({groupElement:o.element,hitRegion:d.hitRegion.rect,pointerEventTarget:e.target})&&n.push(d.hitRegion)}),n}function wo(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function G(e,t,n=0){return Math.abs(X(e)-X(t))<=n}function te(e,t){return G(e,t)?0:e>t?1:-1}function ye({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:o=0,collapsible:s,disabled:d,maxSize:i=100,minSize:l=0}=t;if(d&&!e)return n;if(te(r,l)<0)if(s){const c=(o+l)/2;te(r,c)<0?r=o:r=l}else r=l;return r=Math.min(i,r),r=X(r),r}function Ie({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:o,trigger:s}){if(G(e,0))return t;const d=s==="imperative-api",i=Object.values(t),l=Object.values(o),c=[...i],[p,v]=r;A(p!=null,"Invalid first pivot index"),A(v!=null,"Invalid second pivot index");let m=0;switch(s){case"keyboard":{{const x=e<0?v:p,w=n[x];A(w,`Panel constraints not found for index ${x}`);const{collapsedSize:b=0,collapsible:h,minSize:z=0}=w;if(h){const S=i[x];if(A(S!=null,`Previous layout not found for panel index ${x}`),G(S,b)){const g=z-S;te(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}{const x=e<0?p:v,w=n[x];A(w,`No panel constraints found for index ${x}`);const{collapsedSize:b=0,collapsible:h,minSize:z=0}=w;if(h){const S=i[x];if(A(S!=null,`Previous layout not found for panel index ${x}`),G(S,z)){const g=S-b;te(g,Math.abs(e))>0&&(e=e<0?0-g:g)}}}break}default:{const x=e<0?v:p,w=n[x];A(w,`Panel constraints not found for index ${x}`);const b=i[x],{collapsible:h,collapsedSize:z,minSize:S}=w;if(h&&te(b,S)<0)if(e>0){const g=S-z,M=g/2,C=b+e;te(C,S)<0&&(e=te(e,M)<=0?0:g)}else{const g=S-z,M=100-g/2,C=b-e;te(C,S)<0&&(e=te(100+e,M)>0?0:-g)}break}}{const x=e<0?1:-1;let w=e<0?v:p,b=0;for(;;){const z=i[w];A(z!=null,`Previous layout not found for panel index ${w}`);const S=ye({overrideDisabledPanels:d,panelConstraints:n[w],prevSize:z,size:100})-z;if(b+=S,w+=x,w<0||w>=n.length)break}const h=Math.min(Math.abs(e),Math.abs(b));e=e<0?0-h:h}{let x=e<0?p:v;for(;x>=0&&x<n.length;){const w=Math.abs(e)-Math.abs(m),b=i[x];A(b!=null,`Previous layout not found for panel index ${x}`);const h=b-w,z=ye({overrideDisabledPanels:d,panelConstraints:n[x],prevSize:b,size:h});if(!G(b,z)&&(m+=b-z,c[x]=z,m.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?x--:x++}}if(wo(l,c))return o;{const x=e<0?v:p,w=i[x];A(w!=null,`Previous layout not found for panel index ${x}`);const b=w+m,h=ye({overrideDisabledPanels:d,panelConstraints:n[x],prevSize:w,size:b});if(c[x]=h,!G(h,b)){let z=b-h,S=e<0?v:p;for(;S>=0&&S<n.length;){const g=c[S];A(g!=null,`Previous layout not found for panel index ${S}`);const M=g+z,C=ye({overrideDisabledPanels:d,panelConstraints:n[S],prevSize:g,size:M});if(G(g,C)||(z-=C-g,c[S]=C),G(z,0))break;e>0?S--:S++}}}const y=Object.values(c).reduce((x,w)=>w+x,0);if(!G(y,100,.1))return o;const j=Object.keys(o);return c.reduce((x,w,b)=>(x[j[b]]=w,x),{})}function fe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||te(e[n],t[n])!==0)return!1;return!0}function pe({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],o=r.reduce((i,l)=>i+l,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(i=>`${i}%`).join(", ")}`);if(!G(o,100)&&r.length>0)for(let i=0;i<t.length;i++){const l=r[i];A(l!=null,`No layout data found for index ${i}`);const c=100/o*l;r[i]=c}let s=0;for(let i=0;i<t.length;i++){const l=n[i];A(l!=null,`No layout data found for index ${i}`);const c=r[i];A(c!=null,`No layout data found for index ${i}`);const p=ye({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:l,size:c});c!=p&&(s+=c-p,r[i]=p)}if(!G(s,0))for(let i=0;i<t.length;i++){const l=r[i];A(l!=null,`No layout data found for index ${i}`);const c=l+s,p=ye({overrideDisabledPanels:!0,panelConstraints:t[i],prevSize:l,size:c});if(l!==p&&(s-=p-l,r[i]=p,G(s,0)))break}const d=Object.keys(e);return r.reduce((i,l,c)=>(i[d[c]]=l,i),{})}function vn({groupId:e,panelId:t}){const n=()=>{const i=me();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:p,layout:v,groupSize:m,separatorToPanels:y}]of i)if(l.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:p,group:l,groupSize:m,layout:v,separatorToPanels:y};throw Error(`Group ${e} not found`)},r=()=>{const i=n().derivedPanelConstraints.find(l=>l.panelId===t);if(i!==void 0)return i;throw Error(`Panel constraints not found for Panel ${t}`)},o=()=>{const i=n().group.panels.find(l=>l.id===t);if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},s=()=>{const i=n().layout[t];if(i!==void 0)return i;throw Error(`Layout not found for Panel ${t}`)},d=i=>{const l=s();if(i===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:p,group:v,groupSize:m,layout:y,separatorToPanels:j}=n(),x=v.panels.findIndex(z=>z.id===t),w=x===v.panels.length-1,b=Ie({delta:w?l-i:i-l,initialLayout:y,panelConstraints:p,pivotIndices:w?[x-1,x]:[x,x+1],prevLayout:y,trigger:"imperative-api"}),h=pe({layout:b,panelConstraints:p});fe(y,h)||oe(v,{defaultLayoutDeferred:c,derivedPanelConstraints:p,groupSize:m,layout:h,separatorToPanels:j})};return{collapse:()=>{const{collapsible:i,collapsedSize:l}=r(),{mutableValues:c}=o(),p=s();i&&p!==l&&(c.expandToSize=p,d(l))},expand:()=>{const{collapsible:i,collapsedSize:l,minSize:c}=r(),{mutableValues:p}=o(),v=s();if(i&&v===l){let m=p.expandToSize??c;m===0&&(m=1),d(m)}},getSize:()=>{const{group:i}=n(),l=s(),{element:c}=o(),p=i.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:p}},isCollapsed:()=>{const{collapsible:i,collapsedSize:l}=r(),c=s();return i&&G(l,c)},resize:i=>{const{group:l}=n(),{element:c}=o(),p=ke({group:l}),v=Le({groupSize:p,panelElement:c,styleProp:i}),m=X(v/p*100);d(m)}}}function Vt(e){if(e.defaultPrevented)return;const t=me();ht(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(o=>o.panelConstraints.defaultSize!==void 0);if(r){const o=r.panelConstraints.defaultSize,s=vn({groupId:n.group.id,panelId:r.id});s&&o!==void 0&&(s.resize(o),e.preventDefault())}}})}function Ge(e){const t=me();for(const[n]of t)if(n.separators.some(r=>r.element===e))return n;throw Error("Could not find parent Group for separator element")}function bn({groupId:e}){const t=()=>{const n=me();for(const[r,o]of n)if(r.id===e)return{group:r,...o};throw Error(`Could not find Group with id "${e}"`)};return{getLayout(){const{defaultLayoutDeferred:n,layout:r}=t();return n?{}:r},setLayout(n){const{defaultLayoutDeferred:r,derivedPanelConstraints:o,group:s,groupSize:d,layout:i,separatorToPanels:l}=t(),c=pe({layout:n,panelConstraints:o});return r?i:(fe(i,c)||oe(s,{defaultLayoutDeferred:r,derivedPanelConstraints:o,groupSize:d,layout:c,separatorToPanels:l}),c)}}}function de(e,t){const n=Ge(e),r=ce(n.id,!0),o=n.separators.find(p=>p.element===e);A(o,"Matching separator not found");const s=r.separatorToPanels.get(o);A(s,"Matching panels not found");const d=s.map(p=>n.panels.indexOf(p)),i=bn({groupId:n.id}).getLayout(),l=Ie({delta:t,initialLayout:i,panelConstraints:r.derivedPanelConstraints,pivotIndices:d,prevLayout:i,trigger:"keyboard"}),c=pe({layout:l,panelConstraints:r.derivedPanelConstraints});fe(i,c)||oe(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function qt(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=Ge(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&de(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&de(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&de(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&de(t,-5);break}case"End":{e.preventDefault(),de(t,100);break}case"Enter":{e.preventDefault();const r=Ge(t),o=ce(r.id,!0),{derivedPanelConstraints:s,layout:d,separatorToPanels:i}=o,l=r.separators.find(m=>m.element===t);A(l,"Matching separator not found");const c=i.get(l);A(c,"Matching panels not found");const p=c[0],v=s.find(m=>m.panelId===p.id);if(A(v,"Panel metadata not found"),v.collapsible){const m=d[p.id],y=v.collapsedSize===m?r.mutableState.expandedPanelSizes[p.id]??v.minSize:v.collapsedSize;de(t,y-m)}break}case"F6":{e.preventDefault();const r=Ge(t).separators.map(d=>d.element),o=Array.from(r).findIndex(d=>d===e.currentTarget);A(o!==null,"Index not found");const s=e.shiftKey?o>0?o-1:r.length-1:o+1<r.length?o+1:0;r[s].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),de(t,-100);break}}}let je={cursorFlags:0,state:"inactive"};const mt=new mn;function he(){return je}function jo(e){return mt.addListener("change",e)}function So(e){const t=je,n={...je};n.cursorFlags=e,je=n,mt.emit("change",{prev:t,next:n})}function Se(e){const t=je;je=e,mt.emit("change",{prev:t,next:e})}function Wt(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=me(),n=ht(e,t),r=new Map;let o=!1;n.forEach(s=>{s.separator&&(o||(o=!0,s.separator.element.focus({preventScroll:!0})));const d=t.get(s.group);d&&r.set(s.group,d.layout)}),Se({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const ko=e=>e,it=()=>{},yn=1,wn=2,jn=4,Sn=8,Ut=3,Gt=12;let We;function Kt(){return We===void 0&&(We=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(We=!0)),We}function zo({cursorFlags:e,groups:t,state:n}){let r=0,o=0;switch(n){case"active":case"hover":t.forEach(s=>{if(!s.mutableState.disableCursor)switch(s.orientation){case"horizontal":{r++;break}case"vertical":{o++;break}}})}if(!(r===0&&o===0)){switch(n){case"active":{if(e&&Kt()){const s=(e&yn)!==0,d=(e&wn)!==0,i=(e&jn)!==0,l=(e&Sn)!==0;if(s)return i?"se-resize":l?"ne-resize":"e-resize";if(d)return i?"sw-resize":l?"nw-resize":"w-resize";if(i)return"s-resize";if(l)return"n-resize"}break}}return Kt()?r>0&&o>0?"move":r>0?"ew-resize":"ns-resize":r>0&&o>0?"grab":r>0?"col-resize":"row-resize"}}const Xt=new WeakMap;function xt(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Xt.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=he();switch(r.state){case"active":case"hover":{const o=zo({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(d=>d.group),state:r.state}),s=`*, *:hover {cursor: ${o} !important; }`;if(t===s)return;t=s,o?n.cssRules.length===0?n.insertRule(s):n.replaceSync(s):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Xt.set(e,{prevStyle:t,styleSheet:n})}function kn({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:o,pointerDownAtPoint:s,prevCursorFlags:d}){let i=0;n.forEach(c=>{const{group:p,groupSize:v}=c,{orientation:m,panels:y}=p,{disableCursor:j}=p.mutableState;let x=0;s?m==="horizontal"?x=(t.clientX-s.x)/v*100:x=(t.clientY-s.y)/v*100:m==="horizontal"?x=t.clientX<0?-100:100:x=t.clientY<0?-100:100;const w=r.get(p),b=o.get(p);if(!w||!b)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:z,groupSize:S,layout:g,separatorToPanels:M}=b;if(z&&g&&M){const C=Ie({delta:x,initialLayout:w,panelConstraints:z,pivotIndices:c.panels.map(D=>y.indexOf(D)),prevLayout:g,trigger:"mouse-or-touch"});if(fe(C,g)){if(x!==0&&!j)switch(m){case"horizontal":{i|=x<0?yn:wn;break}case"vertical":{i|=x<0?jn:Sn;break}}}else oe(c.group,{defaultLayoutDeferred:h,derivedPanelConstraints:z,groupSize:S,layout:C,separatorToPanels:M})}});let l=0;t.movementX===0?l|=d&Ut:l|=i&Ut,t.movementY===0?l|=d&Gt:l|=i&Gt,So(l),xt(e)}function Qt(e){const t=me(),n=he();switch(n.state){case"active":kn({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Yt(e){if(e.defaultPrevented)return;const t=he(),n=me();switch(t.state){case"active":{if(e.buttons===0){Se({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const o=ce(r.group.id,!0);oe(r.group,o)});return}kn({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=ht(e,n);r.length===0?t.state!=="inactive"&&Se({cursorFlags:0,state:"inactive"}):Se({cursorFlags:0,hitRegions:r,state:"hover"}),xt(e.currentTarget);break}}}function Jt(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(he().state){case"hover":Se({cursorFlags:0,state:"inactive"})}}function Zt(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=he();switch(t.state){case"active":Se({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(xt(e.currentTarget),t.hitRegions.forEach(n=>{const r=ce(n.group.id,!0);oe(n.group,r)}),e.preventDefault())}}function en(e){let t=0,n=0;const r={};for(const s of e)if(s.defaultSize!==void 0){t++;const d=X(s.defaultSize);n+=d,r[s.panelId]=d}else r[s.panelId]=void 0;const o=e.length-t;if(o!==0){const s=X((100-n)/o);for(const d of e)d.defaultSize===void 0&&(r[d.panelId]=s)}return r}function Co(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const o=ke({group:e}),s=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,d=r.mutableValues.prevSize,i={asPercentage:X(s/o*100),inPixels:s};r.mutableValues.prevSize=i,r.onResize(i,r.id,d)}function No(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function Mo({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let o=0,s=0,d=!1;const i=new Map,l=[];for(const v of e.panels){const m=r[v.id]??0;switch(v.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{d=!0;const y=m/100*n,j=X(y/t*100);i.set(v.id,j),o+=j;break}case"preserve-relative-size":default:{l.push(v.id),s+=m;break}}}if(!d||l.length===0)return r;const c=100-o,p={...r};if(i.forEach((v,m)=>{p[m]=v}),s>0)for(const v of l){const m=r[v]??0;p[v]=X(m/s*c)}else{const v=X(c/l.length);for(const m of l)p[m]=v}return p}function Po(e,t){const n=e.map(o=>o.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n)if(!r.includes(o))return!1;return!0}const ve=new Map;function Eo(e){let t=!0;A(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,o=new Set,s=new n(j=>{for(const x of j){const{borderBoxSize:w,target:b}=x;if(b===e.element){if(t){const h=ke({group:e});if(h===0)return;const z=ce(e.id);if(!z)return;const S=lt(e),g=z.defaultLayoutDeferred?en(S):z.layout,M=Mo({group:e,nextGroupSize:h,prevGroupSize:z.groupSize,prevLayout:g}),C=pe({layout:M,panelConstraints:S});if(!z.defaultLayoutDeferred&&fe(z.layout,C)&&No(z.derivedPanelConstraints,S)&&z.groupSize===h)return;oe(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:h,layout:C,separatorToPanels:z.separatorToPanels})}}else Co(e,b,w)}});s.observe(e.element),e.panels.forEach(j=>{A(!r.has(j.id),`Panel ids must be unique; id "${j.id}" was used more than once`),r.add(j.id),j.onResize&&s.observe(j.element)});const d=ke({group:e}),i=lt(e),l=e.panels.map(({id:j})=>j).join(",");let c=e.mutableState.defaultLayout;c&&(Po(e.panels,c)||(c=void 0));const p=e.mutableState.layouts[l]??c??en(i),v=pe({layout:p,panelConstraints:i}),m=e.element.ownerDocument;ve.set(m,(ve.get(m)??0)+1);const y=new Map;return hn(e).forEach(j=>{j.separator&&y.set(j.separator,j.panels)}),oe(e,{defaultLayoutDeferred:d===0,derivedPanelConstraints:i,groupSize:d,layout:v,separatorToPanels:y}),e.separators.forEach(j=>{A(!o.has(j.id),`Separator ids must be unique; id "${j.id}" was used more than once`),o.add(j.id),j.element.addEventListener("keydown",qt)}),ve.get(m)===1&&(m.addEventListener("dblclick",Vt,!0),m.addEventListener("pointerdown",Wt,!0),m.addEventListener("pointerleave",Qt),m.addEventListener("pointermove",Yt),m.addEventListener("pointerout",Jt),m.addEventListener("pointerup",Zt,!0)),function(){t=!1,ve.set(m,Math.max(0,(ve.get(m)??0)-1)),fo(e),e.separators.forEach(j=>{j.element.removeEventListener("keydown",qt)}),ve.get(m)||(m.removeEventListener("dblclick",Vt,!0),m.removeEventListener("pointerdown",Wt,!0),m.removeEventListener("pointerleave",Qt),m.removeEventListener("pointermove",Yt),m.removeEventListener("pointerout",Jt),m.removeEventListener("pointerup",Zt,!0)),s.disconnect()}}function Lo(){const[e,t]=u.useState({}),n=u.useCallback(()=>t({}),[]);return[e,n]}function gt(e){const t=u.useId();return`${e??t}`}const xe=typeof window<"u"?u.useLayoutEffect:u.useEffect;function De(e){const t=u.useRef(e);return xe(()=>{t.current=e},[e]),u.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function vt(...e){return De(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function bt(e){const t=u.useRef({...e});return xe(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const zn=u.createContext(null);function Ro(e,t){const n=u.useRef({getLayout:()=>({}),setLayout:ko});u.useImperativeHandle(t,()=>n.current,[]),xe(()=>{Object.assign(n.current,bn({groupId:e}))})}function ut({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:o,elementRef:s,groupRef:d,id:i,onLayoutChange:l,onLayoutChanged:c,orientation:p="horizontal",resizeTargetMinimumSize:v={coarse:20,fine:10},style:m,...y}){const j=u.useRef({onLayoutChange:{},onLayoutChanged:{}}),x=De(P=>{fe(j.current.onLayoutChange,P)||(j.current.onLayoutChange=P,l==null||l(P))}),w=De(P=>{fe(j.current.onLayoutChanged,P)||(j.current.onLayoutChanged=P,c==null||c(P))}),b=gt(i),h=u.useRef(null),[z,S]=Lo(),g=u.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:v,separators:[]}),M=vt(h,s);Ro(b,d);const C=De((P,E)=>{const F=he(),I=At(P),k=ce(P);if(k){let O=!1;switch(F.state){case"active":{O=F.hitRegions.some(q=>q.group===I);break}}return{flexGrow:k.layout[E]??1,pointerEvents:O?"none":void 0}}return{flexGrow:(n==null?void 0:n[E])??1}}),D=bt({defaultLayout:n,disableCursor:r}),_=u.useMemo(()=>({get disableCursor(){return!!D.disableCursor},getPanelStyles:C,id:b,orientation:p,registerPanel:P=>{const E=g.current;return E.panels=ct(p,[...E.panels,P]),S(),()=>{E.panels=E.panels.filter(F=>F!==P),S()}},registerSeparator:P=>{const E=g.current;return E.separators=ct(p,[...E.separators,P]),S(),()=>{E.separators=E.separators.filter(F=>F!==P),S()}},togglePanelDisabled:(P,E)=>{const F=g.current.panels.find(O=>O.id===P);F&&(F.panelConstraints.disabled=E);const I=At(b),k=ce(b);I&&k&&oe(I,{...k,derivedPanelConstraints:lt(I)})},toggleSeparatorDisabled:(P,E)=>{const F=g.current.separators.find(I=>I.id===P);F&&(F.disabled=E)}}),[C,b,S,p,D]),L=u.useRef(null);return xe(()=>{const P=h.current;if(P===null)return;const E=g.current;let F;if(D.defaultLayout!==void 0&&Object.keys(D.defaultLayout).length===E.panels.length){F={};for(const U of E.panels){const R=D.defaultLayout[U.id];R!==void 0&&(F[U.id]=R)}}const I={disabled:!!o,element:P,id:b,mutableState:{defaultLayout:F,disableCursor:!!D.disableCursor,expandedPanelSizes:g.current.lastExpandedPanelSizes,layouts:g.current.layouts},orientation:p,panels:E.panels,resizeTargetMinimumSize:E.resizeTargetMinimumSize,separators:E.separators};L.current=I;const k=Eo(I),{defaultLayoutDeferred:O,derivedPanelConstraints:q,layout:Y}=ce(I.id,!0);!O&&q.length>0&&(x(Y),w(Y));const J=pt(b,U=>{const{defaultLayoutDeferred:R,derivedPanelConstraints:$,layout:V}=U.next;if(R||$.length===0)return;const Z=I.panels.map(({id:K})=>K).join(",");I.mutableState.layouts[Z]=V,$.forEach(K=>{if(K.collapsible){const{layout:ze}=U.prev??{};if(ze){const Ye=G(K.collapsedSize,V[K.panelId]),Je=G(K.collapsedSize,ze[K.panelId]);Ye&&!Je&&(I.mutableState.expandedPanelSizes[K.panelId]=ze[K.panelId])}}});const ee=he().state!=="active";x(V),ee&&w(V)});return()=>{L.current=null,k(),J()}},[o,b,w,x,p,z,D]),u.useEffect(()=>{const P=L.current;P&&(P.mutableState.defaultLayout=n,P.mutableState.disableCursor=!!r)}),a.jsx(zn.Provider,{value:_,children:a.jsx("div",{...y,className:t,"data-group":!0,"data-testid":b,id:b,ref:M,style:{height:"100%",width:"100%",overflow:"hidden",...m,display:"flex",flexDirection:p==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:p==="horizontal"?"pan-y":"pan-x"},children:e})})}ut.displayName="Group";function yt(){const e=u.useContext(zn);return A(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function Oo(e,t){const{id:n}=yt(),r=u.useRef({collapse:it,expand:it,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:it});u.useImperativeHandle(t,()=>r.current,[]),xe(()=>{Object.assign(r.current,vn({groupId:n,panelId:e}))})}function Re({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:o,disabled:s,elementRef:d,groupResizeBehavior:i="preserve-relative-size",id:l,maxSize:c="100%",minSize:p="0%",onResize:v,panelRef:m,style:y,...j}){const x=!!l,w=gt(l),b=bt({disabled:s}),h=u.useRef(null),z=vt(h,d),{getPanelStyles:S,id:g,orientation:M,registerPanel:C,togglePanelDisabled:D}=yt(),_=v!==null,L=De((E,F,I)=>{v==null||v(E,l,I)});xe(()=>{const E=h.current;if(E!==null){const F={element:E,id:w,idIsStable:x,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:_?L:void 0,panelConstraints:{groupResizeBehavior:i,collapsedSize:n,collapsible:r,defaultSize:o,disabled:b.disabled,maxSize:c,minSize:p}};return C(F)}},[i,n,r,o,_,w,x,c,p,L,C,b]),u.useEffect(()=>{D(w,!!s)},[s,w,D]),Oo(w,m);const P=u.useSyncExternalStore(E=>pt(g,E),()=>JSON.stringify(S(g,w)),()=>JSON.stringify(S(g,w)));return a.jsx("div",{...j,"aria-disabled":s||void 0,"data-panel":!0,"data-testid":w,id:w,ref:z,style:{...Do,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(P)},children:a.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...y,touchAction:M==="horizontal"?"pan-y":"pan-x"},children:e})})}Re.displayName="Panel";const Do={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function $o({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let o,s;const d=e[n],i=t.find(l=>l.panelId===n);if(i){const l=i.maxSize,c=i.collapsible?i.collapsedSize:i.minSize,p=[r,r+1];s=pe({layout:Ie({delta:c-d,initialLayout:e,panelConstraints:t,pivotIndices:p,prevLayout:e}),panelConstraints:t})[n],o=pe({layout:Ie({delta:l-d,initialLayout:e,panelConstraints:t,pivotIndices:p,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:o,valueMin:s,valueNow:d}}function dt({children:e,className:t,disabled:n,elementRef:r,id:o,style:s,...d}){const i=gt(o),l=bt({disabled:n}),[c,p]=u.useState({}),[v,m]=u.useState("inactive"),y=u.useRef(null),j=vt(y,r),{disableCursor:x,id:w,orientation:b,registerSeparator:h,toggleSeparatorDisabled:z}=yt(),S=b==="horizontal"?"vertical":"horizontal";xe(()=>{const M=y.current;if(M!==null){const C={disabled:l.disabled,element:M,id:i},D=h(C),_=jo(P=>{m(P.next.state!=="inactive"&&P.next.hitRegions.some(E=>E.separator===C)?P.next.state:"inactive")}),L=pt(w,P=>{const{derivedPanelConstraints:E,layout:F,separatorToPanels:I}=P.next,k=I.get(C);if(k){const O=k[0],q=k.indexOf(O);p($o({layout:F,panelConstraints:E,panelId:O.id,panelIndex:q}))}});return()=>{_(),L(),D()}}},[w,i,h,l]),u.useEffect(()=>{z(i,!!n)},[n,i,z]);let g;return n&&!x&&(g="not-allowed"),a.jsx("div",{...d,"aria-controls":c.valueControls,"aria-disabled":n||void 0,"aria-orientation":S,"aria-valuemax":c.valueMax,"aria-valuemin":c.valueMin,"aria-valuenow":c.valueNow,children:e,className:t,"data-separator":n?"disabled":v,"data-testid":i,id:i,ref:j,role:"separator",style:{flexBasis:"auto",cursor:g,...s,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}dt.displayName="Separator";const Io={ghost:"hover:bg-[#F8F4F0] text-[#36342E]",subtle:"hover:bg-[#ECEAE3] text-[#6B6960]"},To={sm:"w-7 h-7",md:"w-8 h-8"},Fo={sm:14,md:16};function se({icon:e,label:t,size:n="md",variant:r="ghost",onClick:o,className:s="",disabled:d=!1,title:i}){return a.jsx("button",{type:"button","aria-label":t,title:i??t,disabled:d,onClick:o,className:["inline-flex items-center justify-center rounded-btn transition-colors",Io[r],To[n],d?"opacity-40 cursor-not-allowed":"",s].filter(Boolean).join(" "),children:a.jsx(e,{size:Fo[n]})})}function Ao({x:e,y:t,items:n,onClose:r}){const[o,s]=u.useState(0),d=u.useRef(null),i=u.useRef([]);u.useEffect(()=>{var c;(c=i.current[0])==null||c.focus()},[]),u.useEffect(()=>{const c=p=>{d.current&&!d.current.contains(p.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);const l=u.useCallback(c=>{var p,v;switch(c.key){case"Escape":c.preventDefault(),r();break;case"ArrowDown":c.preventDefault(),s(m=>{var j;const y=(m+1)%n.length;return(j=i.current[y])==null||j.focus(),y});break;case"ArrowUp":c.preventDefault(),s(m=>{var j;const y=(m-1+n.length)%n.length;return(j=i.current[y])==null||j.focus(),y});break;case"Home":c.preventDefault(),s(0),(p=i.current[0])==null||p.focus();break;case"End":c.preventDefault(),s(n.length-1),(v=i.current[n.length-1])==null||v.focus();break}},[n.length,r]);return a.jsx("div",{ref:d,role:"menu",className:"bg-card border border-border rounded-card shadow-card-hover py-1 min-w-[160px]",style:{position:"fixed",left:e,top:t,zIndex:100},onKeyDown:l,children:n.map((c,p)=>{const v=c.icon,m=c.variant==="danger";return a.jsxs("button",{ref:y=>{i.current[p]=y},role:"menuitem",tabIndex:o===p?0:-1,onClick:()=>{c.onClick(),r()},className:["flex items-center gap-2 w-full text-left px-3 py-2 text-sm transition-colors",m?"text-danger hover:bg-danger/10":"text-ink hover:bg-hover"].join(" "),children:[a.jsx(v,{size:14}),c.label]},c.label)})})}function _o({sessionId:e,defaultMode:t}){const[n,r]=u.useState([]),[o,s]=u.useState(""),[d,i]=u.useState(t||"quick"),[l,c]=u.useState(!1),p=u.useRef(null),v=u.useRef(null);u.useEffect(()=>{p.current&&(p.current.scrollTop=p.current.scrollHeight)},[n]);const m=async()=>{var x;const y=o.trim();if(!y||l)return;const j={role:"user",content:y,timestamp:new Date().toISOString()};r(w=>[...w,j]),s(""),c(!0);try{const w=await W.chatMessage(e,y,d),b={role:"system",content:w.output||"Done.",timestamp:new Date().toISOString(),filesChanged:w.files_changed};r(h=>[...h,b])}catch(w){const b={role:"system",content:`Error: ${w instanceof Error?w.message:"Request failed"}`,timestamp:new Date().toISOString()};r(h=>[...h,b])}finally{c(!1),(x=v.current)==null||x.focus()}};return a.jsxs("div",{className:"flex flex-col h-full",children:[a.jsxs("div",{ref:p,className:"flex-1 overflow-y-auto p-3 space-y-3 terminal-scroll",children:[n.length===0&&a.jsx("div",{className:"text-xs text-muted text-center py-8",children:"Send a message to iterate on your project."}),n.map((y,j)=>a.jsx("div",{className:`flex ${y.role==="user"?"justify-end":"justify-start"}`,children:a.jsxs("div",{className:`max-w-[80%] rounded-lg px-3 py-2 text-xs ${y.role==="user"?"bg-primary/10 text-ink":"bg-hover text-ink"}`,children:[a.jsx("p",{className:"whitespace-pre-wrap",children:y.content}),y.filesChanged&&y.filesChanged.length>0&&a.jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[a.jsx("span",{className:"text-xs text-muted font-semibold uppercase",children:"Files changed:"}),a.jsx("ul",{className:"mt-1 space-y-0.5",children:y.filesChanged.map((x,w)=>a.jsx("li",{className:"text-xs font-mono text-muted",children:x},w))})]})]})},j)),l&&a.jsx("div",{className:"flex justify-start",children:a.jsxs("div",{className:"bg-hover text-ink rounded-lg px-3 py-2 text-xs",children:["Building",a.jsx("span",{className:"animate-pulse",children:"..."})]})})]}),a.jsxs("div",{className:"border-t border-border p-2 flex-shrink-0",children:[a.jsx("div",{className:"flex items-center gap-1 mb-2",children:["quick","standard","max"].map(y=>a.jsx("button",{onClick:()=>i(y),className:`text-xs font-semibold px-3 py-1.5 rounded-btn transition-colors capitalize ${d===y?"bg-primary text-white":"text-muted hover:text-ink"}`,children:y},y))}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{ref:v,type:"text",value:o,onChange:y=>s(y.target.value),onKeyDown:y=>{y.key==="Enter"&&!y.shiftKey&&(y.preventDefault(),m())},placeholder:"Ask AI to modify your project...",className:"flex-1 px-3 py-1.5 text-xs bg-card border border-border rounded-btn outline-none focus:border-primary transition-colors",disabled:l}),a.jsx(Ue,{size:"sm",icon:Fr,onClick:m,disabled:l||!o.trim(),"aria-label":"Send message",children:"Send"})]})]})]})}const tn=[{id:"build",label:"Build Log",icon:Hr},{id:"agents",label:"Agents",icon:or},{id:"quality",label:"Quality",icon:_r},{id:"chat",label:"AI Chat",icon:Dr}];function Bo({status:e}){switch(e){case"pass":return a.jsx(Jn,{size:14,className:"text-success"});case"fail":return a.jsx(Ke,{size:14,className:"text-danger"});default:return a.jsx(Yn,{size:14,className:"text-muted"})}}function Ho({agents:e}){return!e||e.length===0?a.jsx("div",{className:"p-4 text-xs text-muted",children:"No agents running."}):a.jsx("div",{className:"p-2 space-y-1 overflow-y-auto terminal-scroll",children:e.map(t=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-btn bg-hover text-xs",children:[a.jsx("span",{className:"font-semibold text-ink truncate",children:t.name}),a.jsx("span",{className:"text-xs font-mono text-muted-accessible px-1.5 py-0.5 rounded-btn bg-card",children:t.type}),a.jsx("span",{className:`text-xs font-semibold ${t.status==="running"?"text-success":"text-muted"}`,children:t.status}),a.jsx("span",{className:"ml-auto text-xs text-muted-accessible font-mono truncate max-w-[200px]",children:t.task})]},t.id))})}function Vo({checklist:e}){return!e||!e.items||e.items.length===0?a.jsx("div",{className:"p-4 text-xs text-muted",children:"No quality gate data available."}):a.jsxs("div",{className:"p-2 space-y-1 overflow-y-auto terminal-scroll",children:[a.jsxs("div",{className:"flex items-center gap-3 px-3 py-2 text-xs text-muted-accessible font-semibold uppercase",children:[a.jsx("span",{children:"Gate"}),a.jsxs("span",{className:"ml-auto",children:[e.passed,"/",e.total," passed"]})]}),e.items.map(t=>a.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-btn hover:bg-hover text-xs",children:[a.jsx(Bo,{status:t.status}),a.jsx("span",{className:"text-ink",children:t.label}),t.details&&a.jsx("span",{className:"ml-auto text-xs text-muted-accessible truncate max-w-[200px]",children:t.details})]},t.id))]})}function qo({logs:e,logsLoading:t,agents:n,checklist:r,sessionId:o,subscribe:s,buildMode:d}){var c;const[i,l]=u.useState("build");return a.jsxs("div",{className:"h-full flex flex-col bg-card",children:[a.jsx("div",{role:"tablist",className:"flex items-center border-b border-border px-2 flex-shrink-0",children:tn.map(p=>{const v=p.icon,m=i===p.id;return a.jsxs("button",{role:"tab","aria-selected":m,onClick:()=>l(p.id),className:`flex items-center gap-1.5 px-3 py-2 text-xs font-medium transition-colors border-b-2 ${m?"border-primary text-primary":"border-transparent text-muted hover:text-ink"}`,children:[a.jsx(v,{size:14}),p.label]},p.id)})}),a.jsxs("div",{role:"tabpanel","aria-label":(c=tn.find(p=>p.id===i))==null?void 0:c.label,className:"flex-1 min-h-0 overflow-hidden",children:[i==="build"&&a.jsx(Un,{logs:e,loading:t,subscribe:s}),i==="agents"&&a.jsx(Ho,{agents:n}),i==="quality"&&a.jsx(Vo,{checklist:r}),i==="chat"&&a.jsx(_o,{sessionId:o,defaultMode:d})]})]})}function ft(e,t,n){var s;if(t==="directory")return n?a.jsx(Cr,{size:14}):a.jsx(Er,{size:14});const r=((s=e.split(".").pop())==null?void 0:s.toLowerCase())||"";return{js:a.jsx(ae,{size:14,className:"text-yellow-600"}),ts:a.jsx(ae,{size:14,className:"text-blue-500"}),tsx:a.jsx(ae,{size:14,className:"text-blue-400"}),jsx:a.jsx(ae,{size:14,className:"text-yellow-500"}),py:a.jsx(ae,{size:14,className:"text-green-600"}),html:a.jsx(gr,{size:14,className:"text-orange-500"}),css:a.jsx(jr,{size:14,className:"text-purple-500"}),json:a.jsx(hr,{size:14,className:"text-green-500"}),md:a.jsx(nn,{size:14,className:"text-muted"}),go:a.jsx(ae,{size:14,className:"text-cyan-600"}),rs:a.jsx(ae,{size:14,className:"text-orange-600"}),rb:a.jsx(ae,{size:14,className:"text-red-500"}),sh:a.jsx(ae,{size:14,className:"text-green-600"})}[r]||a.jsx(kr,{size:14})}function Wo(e){var o;const t=((o=e.split(".").pop())==null?void 0:o.toLowerCase())||"",n={js:"javascript",jsx:"javascript",ts:"typescript",tsx:"typescript",py:"python",html:"html",htm:"html",css:"css",scss:"scss",less:"less",json:"json",md:"markdown",go:"go",rs:"rust",sh:"shell",bash:"shell",yml:"yaml",yaml:"yaml",xml:"xml",svg:"xml",sql:"sql",java:"java",kt:"kotlin",rb:"ruby",dockerfile:"dockerfile"},r=e.toLowerCase();return r==="dockerfile"?"dockerfile":r==="makefile"?"makefile":n[t]||"plaintext"}function Cn(e){for(const t of e)if(t.type==="file"&&t.name.endsWith(".html")||t.children&&Cn(t.children))return!0;return!1}function Nn(e,t){for(const n of e){if(n.path===t)return n.size;if(n.children){const r=Nn(n.children,t);if(r!==void 0)return r}}}function Mn(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Pn({nodes:e,selectedPath:t,onSelect:n,onDelete:r,onContextMenu:o,depth:s=0}){const[d,i]=u.useState(()=>{const l=new Set;return s<2&&e.filter(c=>c.type==="directory").forEach(c=>l.add(c.path)),l});return a.jsx("div",{role:s===0?"tree":"group",children:e.map(l=>{const c=l.type==="directory",p=d.has(l.path),v=l.path===t;return a.jsxs("div",{className:"group/file",children:[a.jsxs("button",{role:"treeitem","aria-label":l.name,"aria-selected":v,...c?{"aria-expanded":p}:{},onContextMenu:m=>{m.preventDefault(),o==null||o(m,l.path,l.name,l.type)},onClick:()=>{c?i(m=>{const y=new Set(m);return y.has(l.path)?y.delete(l.path):y.add(l.path),y}):n(l.path,l.name)},className:`w-full text-left flex items-center gap-1.5 px-2 py-1 text-xs font-mono rounded transition-colors ${v?"bg-primary/10 text-primary":"text-ink/70 hover:bg-hover"}`,style:{paddingLeft:`${s*14+8}px`},children:[c?a.jsx("span",{className:"w-3 flex items-center justify-center flex-shrink-0 text-muted",children:p?a.jsx(ir,{size:14}):a.jsx(cr,{size:14})}):a.jsx("span",{className:"w-3 flex-shrink-0"}),a.jsx("span",{className:`w-5 flex items-center justify-center flex-shrink-0 ${c?"text-primary":""}`,children:ft(l.name,l.type,p)}),a.jsxs("span",{className:"truncate",children:[l.name,c?"/":""]}),!c&&l.size!=null&&l.size>0&&a.jsx("span",{className:"text-xs text-muted ml-auto flex-shrink-0",children:Mn(l.size)}),!c&&r&&a.jsx("span",{role:"button",tabIndex:-1,onClick:m=>{m.stopPropagation(),r(l.path,l.name)},onKeyDown:m=>{m.key==="Enter"&&(m.stopPropagation(),r(l.path,l.name))},className:"text-muted hover:text-danger ml-1 flex-shrink-0 opacity-0 group-hover/file:opacity-100 transition-opacity cursor-pointer",title:"Delete file",children:a.jsx(Ke,{size:12})})]}),c&&p&&l.children&&a.jsx(Pn,{nodes:l.children,selectedPath:t,onSelect:n,onDelete:r,onContextMenu:o,depth:s+1})]},l.path)})})}function En(e,t=""){const n=[];for(const r of e)r.type==="file"&&n.push({path:r.path,name:r.name}),r.children&&n.push(...En(r.children,r.path+"/"));return n}function Uo({session:e,onClose:t}){var Nt;const[n,r]=u.useState(null),[o,s]=u.useState(""),[d,i]=u.useState(null),[l,c]=u.useState(null),[p,v]=u.useState(!1),[m,y]=u.useState("code"),[j,x]=u.useState(!1),[w,b]=u.useState(!1),[h,z]=u.useState(e),S=u.useRef(null),[g,M]=u.useState([]),[C,D]=u.useState(!1),[_,L]=u.useState(""),P=u.useRef(null),E=u.useRef(null),[F,I]=u.useState(0),[k,O]=u.useState(null),[q,Y]=u.useState("standard"),[J,U]=u.useState(null),[R,$]=u.useState(!1),[V,Z]=u.useState(!1),[ee,K]=u.useState(!1),ze=u.useCallback(async()=>{try{await W.stopSession(),Z(!1),K(!1)}catch{}},[]),Ye=u.useCallback(async()=>{try{await W.pauseSession(),K(!0)}catch{}},[]),Je=u.useCallback(async()=>{try{await W.resumeSession(),K(!1)}catch{}},[]);u.useEffect(()=>{const f=async()=>{try{const T=await W.getStatus();Z(T.running),K(T.paused)}catch{}};f();const N=setInterval(f,1e4);return()=>clearInterval(N)},[]);const Ln=Cn(h.files),wt=`/api/sessions/${encodeURIComponent(h.id)}/preview/index.html`,[Fe,Rn]=u.useState([wt]),[re,Ze]=u.useState(0),Ce=Fe[re]||wt,[jt,St]=u.useState(Ce),ge=u.useCallback(async()=>{try{const f=await W.getSessionDetail(h.id);z(f)}catch{}},[h.id]),On=u.useCallback((f,N,T,B)=>{f.preventDefault(),O({x:f.clientX,y:f.clientY,path:N,name:T,type:B})},[]),Dn=u.useCallback(()=>{re>0&&(Ze(f=>f-1),I(f=>f+1))},[re]),$n=u.useCallback(()=>{re<Fe.length-1&&(Ze(f=>f+1),I(f=>f+1))},[re,Fe.length]),In=u.useCallback(f=>{Rn(N=>[...N.slice(0,re+1),f]),Ze(N=>N+1),I(N=>N+1)},[re]);u.useEffect(()=>{St(Ce)},[Ce]);const Ae=u.useCallback(async()=>{$(!0);try{const f=await W.reviewProject(h.id);U(f.output)}catch(f){U(`Error: ${f instanceof Error?f.message:"Unknown"}`)}finally{$(!1)}},[h.id]),_e=u.useCallback(async()=>{$(!0);try{const f=await W.testProject(h.id);U(f.output)}catch(f){U(`Error: ${f instanceof Error?f.message:"Unknown"}`)}finally{$(!1)}},[h.id]),et=u.useCallback(async()=>{$(!0);try{const f=await W.explainProject(h.id);U(f.output)}catch(f){U(`Error: ${f instanceof Error?f.message:"Unknown"}`)}finally{$(!1)}},[h.id]),tt=u.useCallback(async(f,N)=>{if(window.confirm(`Delete "${N}"?`))try{await W.deleteSessionFile(h.id,f),n===f&&(r(null),s(""),i(null),c(null),x(!1)),await ge()}catch(B){const ue=B instanceof Error?B.message:"Unknown error";window.alert(`Delete failed: ${ue}`)}},[h.id,n,ge]),Tn=u.useCallback(f=>f.type==="file"?[{label:"Review",icon:Be,onClick:()=>{Ae()}},{label:"Generate Tests",icon:rt,onClick:()=>{_e()}},{label:"Explain",icon:Rt,onClick:()=>{et()}},{label:"Delete",icon:Wr,onClick:()=>{tt(f.path,f.name)},variant:"danger"}]:[{label:"Review Project",icon:Be,onClick:()=>{Ae()}},{label:"Run Tests",icon:rt,onClick:()=>{_e()}}],[Ae,_e,et,tt]),Ne=u.useCallback(async(f,N)=>{j&&n&&l!==null&&M(B=>B.map(ue=>ue.path===n?{...ue,content:l,modified:!0}:ue));const T=g.find(B=>B.path===f);if(T){r(f),s(N),i(T.content),c(T.content),x(T.modified);return}r(f),s(N),v(!0),x(!1);try{const B=h.id?await W.getSessionFileContent(h.id,f):await W.getFileContent(f);i(B.content),c(B.content),M(ue=>[...ue,{path:f,name:N,content:B.content,modified:!1}])}catch{i("[Error loading file]"),c("[Error loading file]")}finally{v(!1)}},[h.id,j,n,l,g]),nt=u.useCallback(async()=>{var f;if(!(!n||l===null||!h.id)){b(!0);try{await W.saveSessionFile(h.id,n,l),i(l),x(!1),M(T=>T.map(B=>B.path===n?{...B,content:l,modified:!1}:B));const N=((f=n.split(".").pop())==null?void 0:f.toLowerCase())||"";["html","css","js","jsx","ts","tsx"].includes(N)&&I(T=>T+1)}catch(N){const T=N instanceof Error?N.message:"Unknown error";window.alert(`Save failed: ${T}`)}finally{b(!1)}}},[n,l,h.id]),kt=u.useCallback(f=>{const N=g.find(T=>T.path===f);if(!(N!=null&&N.modified&&!window.confirm("Unsaved changes. Close anyway?"))&&(M(T=>T.filter(B=>B.path!==f)),n===f)){const T=g.filter(B=>B.path!==f);if(T.length>0){const B=T[T.length-1];r(B.path),s(B.name),i(B.content),c(B.content),x(B.modified)}else r(null),s(""),i(null),c(null),x(!1)}},[g,n]);u.useEffect(()=>{const f=N=>{(N.metaKey||N.ctrlKey)&&N.key==="s"&&(N.preventDefault(),j&&n&&nt()),(N.metaKey||N.ctrlKey)&&N.key==="p"&&(N.preventDefault(),D(T=>!T),L("")),N.key==="Escape"&&C&&D(!1)};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[j,n,nt,C]),u.useEffect(()=>{C&&P.current&&P.current.focus()},[C]);const zt=En(h.files),Me=_?zt.filter(f=>f.path.toLowerCase().includes(_.toLowerCase())):zt;u.useEffect(()=>{const f=h.files.find(N=>N.name==="index.html"&&N.type==="file");f&&Ne(f.path,f.name)},[]);const Fn=u.useCallback(f=>{f!==void 0&&(c(f),x(f!==d))},[d]),An=u.useCallback(f=>{S.current=f},[]),_n=u.useCallback(async()=>{const f=window.prompt("New file name (e.g. src/utils.ts):");if(!(!f||!f.trim()))try{await W.createSessionFile(h.id,f.trim()),await ge()}catch(N){const T=N instanceof Error?N.message:"Unknown error";window.alert(`Create file failed: ${T}`)}},[h.id,ge]),Bn=u.useCallback(async()=>{const f=window.prompt("New folder name (e.g. src/components):");if(!(!f||!f.trim()))try{await W.createSessionDirectory(h.id,f.trim()),await ge()}catch(N){const T=N instanceof Error?N.message:"Unknown error";window.alert(`Create folder failed: ${T}`)}},[h.id,ge]),Ct=n?Nn(h.files,n):void 0,Hn=((Nt=o.split(".").pop())==null?void 0:Nt.toUpperCase())||"";return a.jsxs("div",{className:"flex flex-col h-full relative",children:[a.jsxs("div",{className:"bg-card px-3 py-2 flex items-center gap-3 flex-shrink-0 border-b border-border",children:[a.jsx("button",{onClick:()=>{j&&!window.confirm("Unsaved changes. Discard?")||t()},className:"text-xs font-medium px-3 py-1.5 rounded-btn border border-border text-muted hover:text-ink hover:bg-hover transition-colors",children:"Back"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h2",{className:"text-sm font-bold text-ink truncate",children:h.id}),a.jsx("p",{className:"text-xs font-mono text-muted-accessible truncate",children:h.path})]}),a.jsx("span",{className:`text-xs font-semibold px-2 py-0.5 rounded-full ${h.status==="completed"||h.status==="completion_promise_fulfilled"?"bg-success/10 text-success":"bg-muted/10 text-muted"}`,children:h.status}),V&&a.jsxs("div",{className:"flex items-center gap-1 border-l border-border pl-3 ml-1",children:[ee?a.jsx(Ue,{variant:"ghost",size:"sm",icon:Gn,onClick:Je,title:"Resume build",children:"Resume"}):a.jsx(Ue,{variant:"ghost",size:"sm",icon:Kn,onClick:Ye,title:"Pause build",children:"Pause"}),a.jsx(Ue,{variant:"danger",size:"sm",icon:Xn,onClick:ze,title:"Stop build",children:"Stop"})]}),a.jsx(se,{icon:Be,label:"Review project",size:"sm",onClick:Ae,disabled:R}),a.jsx(se,{icon:rt,label:"Run tests",size:"sm",onClick:_e,disabled:R}),a.jsx(se,{icon:Rt,label:"Explain project",size:"sm",onClick:et,disabled:R})]}),a.jsx("div",{className:"flex-1 min-h-0",children:a.jsxs(ut,{orientation:"vertical",children:[a.jsx(Re,{defaultSize:70,minSize:40,children:a.jsxs(ut,{orientation:"horizontal",className:"h-full",children:[a.jsx(Re,{defaultSize:20,minSize:15,children:a.jsxs("div",{className:"h-full flex flex-col border-r border-border bg-card",children:[a.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[a.jsx("span",{className:"text-xs text-muted-accessible uppercase tracking-wider font-semibold flex-1",children:"Files"}),a.jsxs("button",{onClick:_n,title:"New File",className:"flex items-center gap-1 text-xs text-muted-accessible hover:text-primary px-2.5 py-1 rounded border border-border hover:border-primary/30 transition-colors",children:[a.jsx(br,{size:12})," New"]}),a.jsxs("button",{onClick:Bn,title:"New Folder",className:"flex items-center gap-1 text-xs text-muted-accessible hover:text-primary px-2.5 py-1 rounded border border-border hover:border-primary/30 transition-colors",children:[a.jsx(Mr,{size:12})," New"]})]}),a.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:h.files.length>0?a.jsx(Pn,{nodes:h.files,selectedPath:n,onSelect:Ne,onDelete:tt,onContextMenu:On}):a.jsx("div",{className:"p-4 text-xs text-muted",children:"No files"})})]})}),a.jsx(dt,{className:"w-1 bg-border hover:bg-primary/30 transition-colors cursor-col-resize"}),a.jsx(Re,{defaultSize:80,minSize:40,children:a.jsxs("div",{className:"h-full flex flex-col min-w-0",children:[a.jsx("div",{className:"flex items-center border-b border-border bg-hover px-1 flex-shrink-0",role:"tablist",children:[{id:"code",label:"Code",icon:dr},{id:"preview",label:"Preview",icon:Be},{id:"config",label:"Config",icon:Vn},{id:"secrets",label:"Secrets",icon:Rr},{id:"prd",label:"PRD",icon:nn}].map(f=>a.jsxs("button",{role:"tab","aria-selected":m===f.id,onClick:()=>y(f.id),className:`flex items-center gap-1.5 px-4 py-2 text-xs font-medium border-b-2 transition-colors ${m===f.id?"border-primary text-primary":"border-transparent text-muted hover:text-ink hover:border-border"}`,children:[a.jsx(f.icon,{size:14}),f.label]},f.id))}),a.jsxs("div",{className:"flex-1 min-h-0",role:"tabpanel",children:[m==="code"&&a.jsxs("div",{className:"h-full flex flex-col min-w-0",children:[g.length>0&&a.jsx("div",{className:"flex items-center border-b border-border bg-hover overflow-x-auto flex-shrink-0",children:g.map(f=>a.jsxs("button",{onClick:()=>Ne(f.path,f.name),className:`flex items-center gap-1.5 px-3 py-1.5 text-[11px] font-mono border-r border-border whitespace-nowrap transition-colors ${f.path===n?"bg-card text-ink":"text-muted hover:text-ink hover:bg-card"}`,children:[a.jsx("span",{className:"w-4 flex items-center justify-center",children:ft(f.name,"file")}),f.name,f.modified&&a.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary"}),a.jsx("span",{role:"button",tabIndex:-1,title:"Close tab",onClick:N=>{N.stopPropagation(),kt(f.path)},onKeyDown:N=>{N.key==="Enter"&&(N.stopPropagation(),kt(f.path))},className:"text-muted hover:text-danger ml-1 cursor-pointer",children:a.jsx(Ke,{size:12})})]},f.path))}),n?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"px-4 py-1.5 border-b border-border flex items-center gap-2 flex-shrink-0 bg-hover",children:[a.jsx("span",{className:"text-xs font-mono text-secondary truncate",children:n}),w&&a.jsx("span",{className:"text-xs text-primary animate-pulse flex-shrink-0",children:"Saving..."}),a.jsx("span",{className:"ml-auto text-xs text-muted/50 font-mono",children:Ct!=null?Mn(Ct):""}),a.jsx("span",{className:"text-xs text-muted font-mono uppercase",children:Hn}),j&&a.jsx("button",{onClick:nt,className:"text-xs font-medium px-2 py-0.5 rounded border border-primary/40 bg-primary/10 text-primary hover:bg-primary/20 transition-colors",children:"Save"})]}),a.jsx("div",{className:"flex-1 min-h-0",children:p?a.jsx("div",{className:"text-muted text-xs animate-pulse p-4",children:"Loading..."}):a.jsx(to,{value:l??"",language:Wo(o),theme:"vs",onChange:Fn,onMount:An,options:{minimap:{enabled:!1},fontSize:13,lineNumbers:"on",wordWrap:"on",scrollBeyondLastLine:!1,automaticLayout:!0,padding:{top:8},renderLineHighlight:"line",smoothScrolling:!0,cursorBlinking:"smooth",folding:!0,bracketPairColorization:{enabled:!0}}})})]}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-sm",children:"Select a file to view its contents"})]}),m==="preview"&&a.jsxs("div",{className:"h-full flex flex-col",children:[a.jsxs("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-2 bg-hover",children:[a.jsx(se,{icon:tr,label:"Back",size:"sm",onClick:Dn,disabled:re<=0}),a.jsx(se,{icon:rr,label:"Forward",size:"sm",onClick:$n,disabled:re>=Fe.length-1}),a.jsx(se,{icon:Ir,label:"Refresh",size:"sm",onClick:()=>I(f=>f+1)}),a.jsx("input",{value:jt,onChange:f=>St(f.target.value),onKeyDown:f=>{f.key==="Enter"&&In(jt)},className:"flex-1 px-3 py-1 text-xs font-mono bg-card border border-border rounded-btn"}),a.jsx(se,{icon:Zn,label:"Open in new tab",size:"sm",onClick:()=>window.open(Ce,"_blank")})]}),Ln?a.jsx("div",{className:"flex-1 bg-white",children:a.jsx("iframe",{ref:E,src:Ce,title:"Project Preview",className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"},F)}):a.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-sm",children:"No HTML files found for preview"})]}),m==="config"&&a.jsx("div",{className:"h-full flex flex-col",children:a.jsxs("div",{className:"p-6 overflow-y-auto",children:[a.jsx("h3",{className:"text-h3 font-heading text-ink mb-4",children:"Project Configuration"}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Provider"}),a.jsx("div",{className:"flex gap-2",children:["claude","codex","gemini"].map(f=>a.jsx("button",{className:"px-4 py-2 rounded-btn text-sm font-medium border transition-colors capitalize border-border text-secondary hover:bg-hover",children:f},f))})]}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Build Mode"}),a.jsx("div",{className:"flex gap-2",children:["quick","standard","max"].map(f=>a.jsx("button",{onClick:()=>Y(f),className:`px-4 py-2 rounded-btn text-sm font-medium border transition-colors capitalize ${q===f?"border-primary bg-primary/10 text-primary":"border-border text-secondary hover:bg-hover"}`,children:f},f))})]}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Project Path"}),a.jsx("input",{value:h.path,readOnly:!0,className:"w-full px-3 py-2 text-sm font-mono bg-hover border border-border rounded-btn text-ink"})]}),a.jsxs("div",{className:"card p-4",children:[a.jsx("label",{className:"block text-xs font-semibold text-muted-accessible uppercase tracking-wider mb-2",children:"Session ID"}),a.jsx("input",{value:h.id,readOnly:!0,className:"w-full px-3 py-2 text-sm font-mono bg-hover border border-border rounded-btn text-ink"})]})]})]})}),m==="secrets"&&a.jsx("div",{className:"h-full flex flex-col",children:a.jsxs("div",{className:"p-6 overflow-y-auto",children:[a.jsx("h3",{className:"text-h3 font-heading text-ink mb-2",children:"Environment Secrets"}),a.jsx("p",{className:"text-sm text-muted mb-6",children:"Secrets are stored locally and injected as environment variables during builds. They are never committed to the project repository."}),a.jsx("div",{className:"card p-4",children:a.jsxs("div",{className:"text-sm text-muted-accessible text-center py-8",children:["Secret management coming soon.",a.jsx("br",{}),a.jsxs("span",{className:"text-xs mt-2 block",children:["For now, set environment variables before running ",a.jsx("code",{className:"font-mono bg-hover px-1.5 py-0.5 rounded text-primary",children:"loki start"})]})]})})]})}),m==="prd"&&a.jsx("div",{className:"h-full flex flex-col",children:a.jsxs("div",{className:"p-6 overflow-y-auto",children:[a.jsx("h3",{className:"text-h3 font-heading text-ink mb-4",children:"Product Requirements"}),h.prd?a.jsx("pre",{className:"text-sm font-mono text-ink whitespace-pre-wrap bg-hover border border-border rounded-card p-4 leading-relaxed",children:h.prd}):a.jsx("div",{className:"text-sm text-muted text-center py-8",children:"No PRD found for this project."})]})})]})]})})]})}),a.jsx(dt,{className:"h-1 bg-border hover:bg-primary/30 cursor-row-resize"}),a.jsx(Re,{defaultSize:30,minSize:15,collapsible:!0,children:a.jsx(qo,{logs:null,logsLoading:!1,agents:null,checklist:null,sessionId:e.id,buildMode:q})})]})}),J&&a.jsxs("div",{className:"absolute inset-x-0 bottom-0 z-20 bg-card border-t border-border p-4 max-h-64 overflow-y-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("span",{className:"text-xs font-semibold text-ink",children:"Action Output"}),a.jsx(se,{icon:Ke,label:"Close",size:"sm",onClick:()=>U(null)})]}),a.jsx("pre",{className:"text-xs font-mono text-ink whitespace-pre-wrap",children:J})]}),k&&a.jsx(Ao,{x:k.x,y:k.y,items:Tn(k),onClose:()=>O(null)}),C&&a.jsx("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",role:"dialog","aria-modal":"true","aria-label":"Quick open file search",onClick:()=>D(!1),children:a.jsxs("div",{className:"bg-card rounded-card shadow-2xl border border-border w-full max-w-lg",onClick:f=>f.stopPropagation(),children:[a.jsx("input",{ref:P,type:"text",value:_,onChange:f=>L(f.target.value),placeholder:"Search files by name...",className:"w-full px-4 py-3 text-sm font-mono border-b border-border outline-none rounded-t-card bg-transparent",onKeyDown:f=>{f.key==="Enter"&&Me.length>0&&(Ne(Me[0].path,Me[0].name),D(!1)),f.key==="Escape"&&D(!1)}}),a.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[Me.slice(0,20).map(f=>a.jsxs("button",{onClick:()=>{Ne(f.path,f.name),D(!1)},className:"w-full text-left px-4 py-2 text-xs font-mono hover:bg-primary/5 flex items-center gap-2",children:[a.jsx("span",{className:"w-5 flex items-center justify-center",children:ft(f.name,"file")}),a.jsx("span",{className:"text-ink",children:f.name}),a.jsx("span",{className:"text-muted ml-auto truncate text-xs",children:f.path})]},f.path)),Me.length===0&&a.jsx("div",{className:"px-4 py-3 text-xs text-muted",children:"No matching files"})]})]})})]})}function Zo(){const{sessionId:e}=qn(),t=Wn(),[n,r]=u.useState(null),[o,s]=u.useState(!0),[d,i]=u.useState(null);return u.useEffect(()=>{e&&(s(!0),i(null),W.getSessionDetail(e).then(l=>{r(l),s(!1)}).catch(l=>{i(l instanceof Error?l.message:"Failed to load session"),s(!1)}))},[e]),o?a.jsx("div",{className:"h-screen bg-background flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"text-muted animate-pulse text-sm",children:"Loading project..."}),a.jsx("div",{className:"text-xs font-mono text-muted/50 mt-2",children:e})]})}):d||!n?a.jsx("div",{className:"h-screen bg-background flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-danger text-sm font-medium",children:"Project not found"}),a.jsx("p",{className:"text-xs text-muted mt-1",children:d||`Session ${e} does not exist`}),a.jsx("button",{onClick:()=>t("/"),className:"mt-4 px-4 py-2 rounded-btn text-sm font-semibold border border-primary/30 text-primary hover:bg-primary/5 transition-all",children:"Back to Home"})]})}):a.jsx("div",{className:"h-screen bg-background flex flex-col",children:a.jsx("div",{className:"flex-1 min-h-0",children:a.jsx(Qn,{name:"ProjectWorkspace",children:a.jsx(Uo,{session:n,onClose:()=>t("/")})})})})}export{Zo as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as m,u as f,r as l,a as j,j as e}from"./index-
|
|
1
|
+
import{c as m,u as f,r as l,a as j,j as e}from"./index-DKbfn_6W.js";import{B as d}from"./Button-DlY3TKRG.js";import{C as g}from"./Card-DvU1jTxb.js";import{u as y,B as b}from"./Badge-aPxpGmfn.js";import"./clock-KRe2srsu.js";/**
|
|
2
2
|
* @license lucide-react v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,a,j as e}from"./index-
|
|
1
|
+
import{r as t,a,j as e}from"./index-DKbfn_6W.js";import{C as l}from"./Card-DvU1jTxb.js";import{E as c}from"./external-link-BSjKSqVI.js";const h=[{id:"claude",name:"Claude",description:"Anthropic Claude Code -- full features"},{id:"codex",name:"Codex",description:"OpenAI Codex CLI -- degraded mode"},{id:"gemini",name:"Gemini",description:"Google Gemini CLI -- degraded mode"}];function p(){const[i,n]=t.useState("claude"),[o,r]=t.useState(!1),[d,x]=t.useState("");t.useEffect(()=>{a.getCurrentProvider().then(s=>n(s.provider)).catch(()=>{}),a.getStatus().then(s=>x(s.version||"")).catch(()=>{})},[]);const m=async s=>{n(s),r(!0);try{await a.setProvider(s)}catch{}finally{r(!1)}};return e.jsxs("div",{className:"max-w-[800px] mx-auto px-6 py-8",children:[e.jsx("h1",{className:"font-heading text-h1 text-[#36342E] mb-8",children:"Settings"}),e.jsxs("section",{className:"mb-10",children:[e.jsx("h2",{className:"text-sm font-semibold text-[#36342E] uppercase tracking-wide mb-4",children:"Provider"}),e.jsx("div",{className:"flex flex-col gap-3",children:h.map(s=>e.jsx(l,{hover:!0,onClick:()=>m(s.id),className:i===s.id?"ring-2 ring-[#553DE9] border-[#553DE9]":"",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`w-4 h-4 rounded-full border-2 flex items-center justify-center flex-shrink-0 ${i===s.id?"border-[#553DE9]":"border-[#ECEAE3]"}`,children:i===s.id&&e.jsx("div",{className:"w-2 h-2 rounded-full bg-[#553DE9]"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-[#36342E]",children:s.name}),e.jsx("p",{className:"text-xs text-[#6B6960]",children:s.description})]})]})},s.id))}),o&&e.jsx("p",{className:"text-xs text-[#6B6960] mt-2",children:"Saving..."})]}),e.jsxs("section",{children:[e.jsx("h2",{className:"text-sm font-semibold text-[#36342E] uppercase tracking-wide mb-4",children:"About"}),e.jsx(l,{children:e.jsxs("div",{className:"flex flex-col gap-3",children:[d&&e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"Version"}),e.jsxs("span",{className:"text-sm font-medium text-[#36342E]",children:["v",d]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"Documentation"}),e.jsxs("a",{href:"https://www.autonomi.dev/docs",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-[#553DE9] hover:underline",children:["autonomi.dev/docs ",e.jsx(c,{size:12})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-sm text-[#6B6960]",children:"GitHub"}),e.jsxs("a",{href:"https://github.com/asklokesh/loki-mode",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-sm text-[#553DE9] hover:underline",children:["asklokesh/loki-mode ",e.jsx(c,{size:12})]})]})]})})]})]})}export{p as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as c,r,a as x,j as t}from"./index-
|
|
1
|
+
import{u as c,r,a as x,j as t}from"./index-DKbfn_6W.js";import{C as p}from"./Card-DvU1jTxb.js";import{u as d,B as h}from"./Badge-aPxpGmfn.js";import"./clock-KRe2srsu.js";const g=[{key:"all",label:"All"},{key:"website",label:"Website"},{key:"api",label:"API"},{key:"cli",label:"CLI"},{key:"bot",label:"Bot"},{key:"data",label:"Data"},{key:"other",label:"Other"}];function u(l){return l.replace(/\.md$/i,"").replace(/[-_]/g," ").replace(/\b\w/g,a=>a.toUpperCase())}function k(){const l=c(),[a,o]=r.useState("all"),n=r.useCallback(()=>x.getTemplates(),[]),{data:s}=d(n,6e4,!0),i=r.useMemo(()=>s?a==="all"?s:s.filter(e=>(e.category||"other")===a):[],[s,a]),m=e=>{sessionStorage.setItem("pl_template",e),l("/")};return t.jsxs("div",{className:"max-w-[1400px] mx-auto px-6 py-8",children:[t.jsx("h1",{className:"font-heading text-h1 text-[#36342E] mb-6",children:"Templates"}),t.jsx("div",{className:"flex items-center gap-1 mb-6",role:"tablist",children:g.map(e=>t.jsx("button",{role:"tab","aria-selected":a===e.key,onClick:()=>o(e.key),className:`px-3 py-1.5 text-xs font-semibold rounded-[3px] transition-colors ${a===e.key?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:e.label},e.key))}),s?i.length===0?t.jsx("p",{className:"text-sm text-[#6B6960] py-12 text-center",children:"No templates in this category."}):t.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:i.map(e=>t.jsxs(p,{hover:!0,onClick:()=>m(e.filename),children:[t.jsx("div",{className:"mb-2",children:t.jsx(h,{status:"version",children:e.category||"other"})}),t.jsx("h3",{className:"text-sm font-medium text-[#36342E] mb-1",children:u(e.name)}),t.jsx("p",{className:"text-xs text-[#6B6960]",children:e.filename})]},e.filename))}):t.jsx("p",{className:"text-sm text-[#6B6960]",children:"Loading templates..."})]})}export{k as default};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import{c as d,r as c,j as e}from"./index-DKbfn_6W.js";/**
|
|
2
|
+
* @license lucide-react v0.577.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const b=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],v=d("arrow-down",b);/**
|
|
7
|
+
* @license lucide-react v0.577.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const j=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],N=d("lock",j);/**
|
|
12
|
+
* @license lucide-react v0.577.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const S=[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]],M=d("pause",S);/**
|
|
17
|
+
* @license lucide-react v0.577.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const E=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],H=d("play",E);/**
|
|
22
|
+
* @license lucide-react v0.577.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const L=[["path",{d:"M16.247 7.761a6 6 0 0 1 0 8.478",key:"1fwjs5"}],["path",{d:"M19.075 4.933a10 10 0 0 1 0 14.134",key:"ehdyv1"}],["path",{d:"M4.925 19.067a10 10 0 0 1 0-14.134",key:"1q22gi"}],["path",{d:"M7.753 16.239a6 6 0 0 1 0-8.478",key:"r2q7qm"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]],_=d("radio",L);/**
|
|
27
|
+
* @license lucide-react v0.577.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const T=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],R=d("square",T);class z extends c.Component{constructor(r){super(r),this.state={hasError:!1,error:null}}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,m){console.error(`[${this.props.name||"Component"}] render error:`,r,m)}render(){var r;return this.state.hasError?this.props.fallback?this.props.fallback:e.jsxs("div",{className:"card p-4 rounded-card text-center",children:[e.jsx("p",{className:"text-sm text-danger font-medium",children:"Something went wrong"}),e.jsx("p",{className:"text-xs text-muted mt-1",children:((r=this.state.error)==null?void 0:r.message)||"Unknown error"}),e.jsx("button",{onClick:()=>this.setState({hasError:!1,error:null}),className:"mt-2 px-3 py-1 text-xs font-medium rounded-btn border border-primary/20 text-primary hover:bg-primary/5 transition-colors",children:"Retry"})]}):this.props.children}}const C={info:"text-info",error:"text-danger",warning:"text-warning",debug:"text-muted",critical:"text-danger font-bold"};function $(n){if(!n)return"";if(n.includes("T")||n.includes("-"))try{return new Date(n).toLocaleTimeString("en-US",{hour12:!1})}catch{return n}return n}function D({logs:n,loading:r,subscribe:m}){const i=c.useRef(null),[l,f]=c.useState(!1),[g,k]=c.useState([]);c.useEffect(()=>m?m("log",o=>{const a=o;a!=null&&a.line&&k(x=>{const s=[...x,{message:a.line,timestamp:a.timestamp||""}];return s.length>500?s.slice(-500):s})}):void 0,[m]);const u=(()=>{const t=g.map(s=>{let h="info";const p=s.message.toLowerCase();return p.includes("error")||p.includes("fail")?h="error":p.includes("warn")?h="warning":p.includes("debug")&&(h="debug"),{timestamp:s.timestamp,level:h,message:s.message,source:"ws"}}),o=n||[];if(t.length===0)return o;if(o.length===0)return t;const a=new Set(t.map(s=>s.message));return[...o.filter(s=>!a.has(s.message)),...t]})();c.useEffect(()=>{!l&&i.current&&(i.current.scrollTop=i.current.scrollHeight)},[u,l]);const y=()=>{if(!i.current)return;const{scrollTop:t,scrollHeight:o,clientHeight:a}=i.current,x=o-t-a<50;f(!x)},w=()=>{var t;f(!1),(t=i.current)==null||t.scrollTo({top:i.current.scrollHeight,behavior:"smooth"})};return e.jsxs("div",{className:"card p-0 overflow-hidden flex flex-col h-full",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border flex-shrink-0",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink uppercase tracking-wider",children:"Terminal"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"font-mono text-xs text-muted",children:[u.length," lines"]}),e.jsxs("button",{onClick:l?w:()=>f(!0),className:`flex items-center gap-1.5 text-xs font-medium px-3 py-1.5 rounded-lg border transition-colors ${l?"border-warning/40 text-warning bg-warning/5 hover:bg-warning/10":"border-primary/20 text-primary hover:bg-primary/5"}`,title:l?"Scroll locked -- click to resume auto-scroll":"Auto-scrolling -- click to lock",children:[l?e.jsx(N,{size:14}):e.jsx(_,{size:14}),l?"Locked":"Live"]}),l&&e.jsxs("button",{onClick:w,className:"flex items-center gap-1.5 text-xs text-primary hover:text-primary transition-colors font-medium",children:[e.jsx(v,{size:14}),"Jump to bottom"]})]})]}),e.jsxs("div",{ref:i,onScroll:y,className:"flex-1 overflow-y-auto terminal-scroll bg-ink/[0.03] p-4 font-mono text-xs leading-relaxed",children:[r&&!n&&g.length===0&&e.jsx("div",{className:"text-muted animate-pulse",children:"Connecting to log stream..."}),u.length===0&&!r&&e.jsxs("div",{className:"text-muted/60",children:[e.jsx("p",{children:"No log output yet."}),e.jsx("p",{className:"mt-1",children:"Start a build to see terminal output here."})]}),u.map((t,o)=>e.jsxs("div",{className:"flex gap-2 hover:bg-hover rounded px-1 -mx-1",children:[e.jsx("span",{className:"text-muted flex-shrink-0 select-none w-16 text-right",children:$(t.timestamp)}),e.jsx("span",{className:`flex-shrink-0 w-12 text-right uppercase text-xs font-semibold ${C[t.level]||"text-muted"}`,children:t.level}),e.jsx("span",{className:`flex-1 break-all ${t.level==="error"||t.level==="critical"?"text-danger":"text-ink"}`,children:t.message})]},o)),u.length>0&&e.jsx("div",{className:"terminal-cursor mt-1"})]})]})}export{z as E,H as P,R as S,D as T,M as a};
|