loki-mode 6.42.0 → 6.43.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/SKILL.md CHANGED
@@ -3,7 +3,7 @@ name: loki-mode
3
3
  description: Multi-agent autonomous startup system. Triggers on "Loki Mode". Takes PRD to deployed product with minimal human intervention. Requires --dangerously-skip-permissions flag.
4
4
  ---
5
5
 
6
- # Loki Mode v6.42.0
6
+ # Loki Mode v6.43.0
7
7
 
8
8
  **You are an autonomous agent. You make decisions. You do not ask questions. You do not stop.**
9
9
 
@@ -267,4 +267,4 @@ The following features are documented in skill modules but not yet fully automat
267
267
  | Quality gates 3-reviewer system | Implemented (v5.35.0) | 5 specialist reviewers in `skills/quality-gates.md`; execution in run.sh |
268
268
  | Benchmarks (HumanEval, SWE-bench) | Infrastructure only | Runner scripts and datasets exist in `benchmarks/`; no published results |
269
269
 
270
- **v6.42.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
270
+ **v6.43.0 | [Autonomi](https://www.autonomi.dev/) flagship product | ~260 lines core**
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.42.0
1
+ 6.43.0
@@ -7,7 +7,7 @@ Modules:
7
7
  control: Session control API (start/stop/pause/resume)
8
8
  """
9
9
 
10
- __version__ = "6.42.0"
10
+ __version__ = "6.43.0"
11
11
 
12
12
  # Expose the control app for easy import
13
13
  try:
@@ -2,7 +2,7 @@
2
2
 
3
3
  The flagship product of [Autonomi](https://www.autonomi.dev/). Complete installation instructions for all platforms and use cases.
4
4
 
5
- **Version:** v6.42.0
5
+ **Version:** v6.43.0
6
6
 
7
7
  ---
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "loki-mode",
3
- "version": "6.42.0",
3
+ "version": "6.43.0",
4
4
  "description": "Loki Mode by Autonomi - Multi-agent autonomous startup system for Claude Code, Codex CLI, and Gemini CLI",
5
5
  "keywords": [
6
6
  "agent",
@@ -1,4 +1,4 @@
1
- import{c as m,r,j as e}from"./index-ABzvlaPu.js";import{C as g,a as p}from"./clock-BZGjjvpN.js";/**
1
+ import{c as m,r,j as e}from"./index-DwD8nlZM.js";import{C as g,a as p}from"./clock-GSX6RVry.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 p,j as t}from"./index-ABzvlaPu.js";const m={primary:"bg-[#553DE9] text-white hover:bg-[#4432c4] shadow-button rounded-btn",secondary:"border border-[#553DE9] text-[#553DE9] hover:bg-[#E8E4FD] bg-transparent rounded-btn",ghost:"text-[#36342E] hover:bg-[#F8F4F0] rounded-btn",danger:"bg-[#C45B5B]/10 text-[#C45B5B] border border-[#C45B5B]/20 hover:bg-[#C45B5B]/20 rounded-btn"},b={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},u={sm:14,md:16,lg:18};function h({size:e}){return t.jsxs("svg",{className:"animate-spin",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}const B=p.forwardRef(({variant:e="primary",size:o="md",icon:n,iconRight:i,loading:r=!1,disabled:a,className:c="",children:l,...x},d)=>{const s=u[o];return t.jsxs("button",{ref:d,disabled:a||r,className:["inline-flex items-center justify-center gap-2 font-medium transition-colors",m[e],b[o],(a||r)&&"opacity-60 cursor-not-allowed",c].filter(Boolean).join(" "),...x,children:[r?t.jsx(h,{size:s}):n?t.jsx(n,{size:s}):null,l,i&&!r&&t.jsx(i,{size:s})]})});B.displayName="Button";export{B};
1
+ import{r as p,j as t}from"./index-DwD8nlZM.js";const m={primary:"bg-[#553DE9] text-white hover:bg-[#4432c4] shadow-button rounded-btn",secondary:"border border-[#553DE9] text-[#553DE9] hover:bg-[#E8E4FD] bg-transparent rounded-btn",ghost:"text-[#36342E] hover:bg-[#F8F4F0] rounded-btn",danger:"bg-[#C45B5B]/10 text-[#C45B5B] border border-[#C45B5B]/20 hover:bg-[#C45B5B]/20 rounded-btn"},b={sm:"px-3 py-1.5 text-xs",md:"px-4 py-2 text-sm",lg:"px-6 py-3 text-base"},u={sm:14,md:16,lg:18};function h({size:e}){return t.jsxs("svg",{className:"animate-spin",width:e,height:e,viewBox:"0 0 24 24",fill:"none",children:[t.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),t.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"})]})}const B=p.forwardRef(({variant:e="primary",size:o="md",icon:n,iconRight:i,loading:r=!1,disabled:a,className:c="",children:l,...x},d)=>{const s=u[o];return t.jsxs("button",{ref:d,disabled:a||r,className:["inline-flex items-center justify-center gap-2 font-medium transition-colors",m[e],b[o],(a||r)&&"opacity-60 cursor-not-allowed",c].filter(Boolean).join(" "),...x,children:[r?t.jsx(h,{size:s}):n?t.jsx(n,{size:s}):null,l,i&&!r&&t.jsx(i,{size:s})]})});B.displayName="Button";export{B};
@@ -1 +1 @@
1
- import{j as s}from"./index-ABzvlaPu.js";const n={none:"p-0",sm:"p-3",md:"p-4",lg:"p-6"};function p({hover:e=!1,padding:d="md",className:t="",children:a,onClick:r}){return s.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r,onKeyDown:r?o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),r())}:void 0,className:["bg-white border border-[#ECEAE3] rounded-[5px] shadow-card",e&&"hover:shadow-card-hover transition-shadow duration-200",r&&"cursor-pointer",n[d],t].filter(Boolean).join(" "),children:a})}export{p as C};
1
+ import{j as s}from"./index-DwD8nlZM.js";const n={none:"p-0",sm:"p-3",md:"p-4",lg:"p-6"};function p({hover:e=!1,padding:d="md",className:t="",children:a,onClick:r}){return s.jsx("div",{role:r?"button":void 0,tabIndex:r?0:void 0,onClick:r,onKeyDown:r?o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),r())}:void 0,className:["bg-white border border-[#ECEAE3] rounded-[5px] shadow-card",e&&"hover:shadow-card-hover transition-shadow duration-200",r&&"cursor-pointer",n[d],t].filter(Boolean).join(" "),children:a})}export{p as C};
@@ -0,0 +1,33 @@
1
+ import{c as Q,j as e,r,a as h,u as ge,b as je}from"./index-DwD8nlZM.js";import{u as I,B as ve}from"./Badge-hndykWrx.js";import{E,T as Ne}from"./TerminalOutput-D4fJL3KY.js";import"./clock-GSX6RVry.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 ye=[["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"}]],we=Q("pause",ye);/**
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 ke=[["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"}]],Se=Q("play",ke);/**
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 Ce=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]],Ee=Q("square",Ce);function Pe(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 _e(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}},n=l[s]||l.standard;return t<=n.opus?"Opus":t>n.total-n.haiku?"Haiku":"Sonnet"}function Fe({status:t,prdSummary:s,onStop:l,onPause:n,onResume:a,isPaused:c}){const i=t?_e(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:Pe((t==null?void 0:t.uptime)??0)}),(n||a)&&e.jsxs("button",{onClick:o?a:n,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(Se,{size:14}):e.jsx(we,{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(Ee,{size:14}),"Stop"]})]})}function Le({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 Re({plan:t,loading:s,onConfirm:l,onCancel:n}){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..."})]}):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-[10px] 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-[10px] 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-[10px] 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-[10px] 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-[10px] 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:n,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:n,onProviderChange:a,initialPrd:c}){const[i,o]=r.useState(""),[m,b]=r.useState(""),[f,y]=r.useState("claude"),[d,g]=r.useState(""),j=n??f,[v,w]=r.useState(!1),[k,$]=r.useState([]),[x,P]=r.useState(!1),[N,M]=r.useState(!1),[_,A]=r.useState(!1),[z,F]=r.useState(null),[L,T]=r.useState(!1),[O,D]=r.useState(!1);r.useEffect(()=>{h.getTemplates().then(u=>{$(u),P(!1)}).catch(()=>{$([]),P(!0)})},[]),r.useEffect(()=>{c&&o(c)},[c]),r.useEffect(()=>{if(c)return;const u=localStorage.getItem("loki-prd-draft");u&&o(u),h.getPrdPrefill().then(({content:S})=>{S&&o(S)}).catch(()=>{})},[c]),r.useEffect(()=>{i.trim()?localStorage.setItem("loki-prd-draft",i):localStorage.removeItem("loki-prd-draft")},[i]),r.useEffect(()=>{const u=S=>{i.trim()&&S.preventDefault()};return window.addEventListener("beforeunload",u),()=>window.removeEventListener("beforeunload",u)},[i]);const R=r.useCallback(async(u,S)=>{b(S),w(!1);try{const G=await h.getTemplateContent(u);o(G.content)}catch{o(`# ${S}
17
+
18
+ ## Overview
19
+
20
+ Describe your project here...
21
+
22
+ ## Features
23
+
24
+ - Feature 1
25
+ - Feature 2
26
+ - Feature 3
27
+
28
+ ## Technical Requirements
29
+
30
+ - Requirement 1
31
+ - Requirement 2
32
+ `)}},[]),q=async()=>{if(!(!i.trim()||L)){T(!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{T(!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(Re,{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-[10px] 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 Me(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 Te({currentPhase:t,iteration:s}){const l=Me(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((n,a)=>{const c=n.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:n.label[0]})]},n.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(n=>{const a=n.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:n.label}),a&&e.jsx("p",{className:"text-xs text-muted mt-0.5",children:n.description})]})]},n.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 Ie(t){if(!t)return W.default;const s=t.toLowerCase();for(const[l,n]of Object.entries(W))if(s.includes(l))return n;return W.default}function Ae({agents:t,loading:s}){const l=(t==null?void 0:t.filter(a=>a.alive))||[],n=(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(Y,{agent:a},a.id))}),n.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:[n.length," completed"]}),e.jsx("div",{className:"space-y-1.5 mt-2",children:n.slice(0,10).map(a=>e.jsx(Y,{agent:a,compact:!0},a.id))})]})]})}function Y({agent:t,compact:s}){const l=Ie(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-[10px] 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-[10px] font-mono mt-1 opacity-60",children:t.status})]}),t.pid&&e.jsxs("span",{className:"text-[10px] font-mono text-muted-accessible flex-shrink-0",children:["PID ",t.pid]})]})}const De={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 Be({item:t}){const[s,l]=r.useState(!1),n=De[t.status];return e.jsxs("div",{className:`border rounded-card overflow-hidden ${n.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 ${n.dot}`}),e.jsx("span",{className:"text-sm font-medium flex-1 truncate",children:t.label}),e.jsx("span",{className:"text-[10px] font-mono font-semibold uppercase tracking-wider flex-shrink-0",children:n.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 ze({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(n=>e.jsx(Be,{item:n},n.id))})]})]})}const Ue={".py":"bg-success",".ts":"bg-primary",".tsx":"bg-primary",".md":"bg-warning",".sh":"bg-primary"};function Oe(t){const s=t.substring(t.lastIndexOf("."));return Ue[s]||"bg-muted"}function qe(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 ee({node:t,depth:s,onSelectFile:l,selectedPath:n}){const[a,c]=r.useState(!1),[i,o]=r.useState(V),m=t.type==="directory",b=t.path===n,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 ${Oe(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-[10px] font-mono text-muted-accessible flex-shrink-0",children:qe(t.size)})]}),f.length>0&&e.jsxs("div",{children:[f.slice(0,i).map(d=>e.jsx(ee,{node:d,depth:s+1,onSelectFile:l,selectedPath:n},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 He({files:t,loading:s}){const[l,n]=r.useState(null),[a,c]=r.useState(null),[i,o]=r.useState(!1),[m,b]=r.useState(null),f=r.useCallback(async d=>{c(null),n(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=r.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(ee,{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-[10px] 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-[10px] 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 Z=5e5;function J(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:t.toString()}function Ge(t){if(!t)return"Never";try{const s=new Date(t),n=new Date().getTime()-s.getTime(),a=Math.floor(n/(1e3*60*60));return a<1?"Just now":a<24?`${a}h ago`:`${Math.floor(a/24)}d ago`}catch{return t}}function We({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"}]:[],n=t?Math.min(t.total_tokens/Z*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:Ge(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-[10px] 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:[J(t.total_tokens)," / ",J(Z)]})]}),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 ${n>80?"bg-danger":n>50?"bg-warning":"bg-info"}`,style:{width:`${n}%`}})})]}),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 Ve({visible:t}){const[s,l]=r.useState("markdown"),[n,a]=r.useState(null),[c,i]=r.useState(null),[o,m]=r.useState(!1),[b,f]=r.useState(!1),[y,d]=r.useState(null),[g,j]=r.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{}},$=()=>{if(!n)return;const x=new Blob([n.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}),n&&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 (",n.format,")"]}),e.jsx("div",{className:"flex-1"}),e.jsx("button",{onClick:()=>k(n.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:$,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:n.content||"(empty report)"})]})]})}function X({visible:t}){const s=r.useCallback(()=>h.getMetrics(),[]),{data:l,loading:n}=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"}),n&&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-[10px] 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-[10px] 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-[10px] 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-[10px] 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:n?"Loading metrics...":"No metrics available"})]}):null}function Qe(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 Ke={completed:"Completed",complete:"Completed",done:"Completed",in_progress:"In Progress",started:"Started",error:"Failed",failed:"Failed",empty:"Empty"};function Ye({onLoadSession:t}){const s=r.useCallback(()=>h.getSessionsHistory(),[]),{data:l,loading:n}=I(s,6e4,!0);return n&&!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-[10px] 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-[10px] font-mono text-muted-accessible",children:[c," files"]}),e.jsx(ve,{status:Qe(a.status),children:Ke[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-[10px] font-mono text-muted-accessible mt-0.5 truncate",children:a.path})]},a.id)})})]})}function tt(){const t=ge(),[s,l]=r.useState(null),[n,a]=r.useState(()=>sessionStorage.getItem("pl_running")==="1"),[c,i]=r.useState(!1),[o,m]=r.useState(()=>sessionStorage.getItem("pl_prd")),[b,f]=r.useState(!1),[y,d]=r.useState(!1),[g,j]=r.useState(!1),[v,w]=r.useState(()=>sessionStorage.getItem("pl_tab")||"terminal"),[k,$]=r.useState(()=>sessionStorage.getItem("pl_provider")||"claude"),[x,P]=r.useState(void 0);r.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]=r.useState(null),[_,A]=r.useState(null),[z,F]=r.useState(null),L=r.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:T,subscribe:O}=je(L),D=r.useCallback(()=>h.getStatus(),[]),{data:R}=I(D,3e4,!T);r.useEffect(()=>{N===null&&R!==null&&(a(R.running??!1),i(R.paused??!1))},[R,N]),r.useEffect(()=>{sessionStorage.setItem("pl_running",n?"1":"0"),n&&f(!0)},[n]),r.useEffect(()=>{o?sessionStorage.setItem("pl_prd",o):sessionStorage.removeItem("pl_prd")},[o]),r.useEffect(()=>{sessionStorage.setItem("pl_provider",k)},[k]),r.useEffect(()=>{sessionStorage.setItem("pl_tab",v)},[v]);const q=r.useCallback(()=>h.getMemorySummary(),[]),H=r.useCallback(()=>h.getChecklist(),[]),u=r.useCallback(()=>h.getFiles(),[]),{data:S,loading:G}=I(q,3e4,n),{data:te,loading:se}=I(H,3e4,n),{data:ae,loading:re}=I(u,3e4,n),C=N??R,ne=_,le=z,ie=_===null,ce=z===null,oe=r.useCallback(async(p,U,fe,be)=>{l(null),f(!1),d(!1),w("terminal");try{await h.startSession({prd:p,provider:U,projectDir:fe,mode:be}),m(p)}catch(K){l(K instanceof Error?K.message:"Failed to start session")}},[]),de=r.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")},[]),xe=r.useCallback(p=>{t(`/project/${p.id}`)},[t]),me=r.useCallback(p=>{$(p)},[]),ue=r.useCallback(async()=>{try{await h.pauseSession(),i(!0)}catch{}},[]),pe=r.useCallback(async()=>{try{await h.resumeSession(),i(!1)}catch{}},[]),he=o&&o.replace(/^#+\s*/gm,"").split(`
33
+ `).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:n?e.jsxs(e.Fragment,{children:[e.jsx(E,{name:"ControlBar",children:e.jsx(Fe,{status:C,prdSummary:he,onStop:de,onPause:ue,onResume:pe,isPaused:c})}),e.jsx("div",{className:"mt-4",children:e.jsx(E,{name:"StatusOverview",children:e.jsx(Le,{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(Te,{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(Ne,{logs:le,loading:ce,subscribe:O}):e.jsx(X,{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(Ae,{agents:ne,loading:ie})}),e.jsx(E,{name:"QualityGates",children:e.jsx(ze,{checklist:te,loading:se})})]})]}),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(He,{files:ae,loading:re})})}),e.jsx("div",{className:"col-span-6",children:e.jsx(E,{name:"MemoryViewer",children:e.jsx(We,{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:oe,running:n,error:s,provider:k,onProviderChange:me,initialPrd:x})}),b&&!n&&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(Ve,{visible:y}),e.jsx(X,{visible:g})]}),e.jsx("div",{className:"w-full max-w-3xl mt-4",children:e.jsx(Ye,{onLoadSession:xe})}),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 ${T?"bg-[#1FC5A8]":"bg-[#C45B5B]"}`}),T?"Connected to Purple Lab backend":"Waiting for backend connection..."]})]})})]})}export{tt as default};
@@ -0,0 +1,131 @@
1
+ var jt=e=>{throw TypeError(e)};var St=(e,t,n)=>t.has(e)||jt("Cannot "+n);var Ee=(e,t,n)=>(St(e,t,"read from private field"),n?n.call(e):t.get(e)),zt=(e,t,n)=>t.has(e)?jt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),kt=(e,t,n,r)=>(St(e,t,"write to private field"),r?r.call(e,n):t.set(e,n),n);import{c as H,r as d,W as Se,j as i,a as Y,B as Ct,d as Dn,u as $n}from"./index-DwD8nlZM.js";import{T as In,E as Tn}from"./TerminalOutput-D4fJL3KY.js";import{B as Fn}from"./Button-DL_d8JtL.js";import{C as An,a as _n}from"./clock-GSX6RVry.js";import{E as Bn}from"./external-link-gjVZ6bJU.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 Hn=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],Vn=H("arrow-left",Hn);/**
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 qn=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],Wn=H("arrow-right",qn);/**
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 Un=[["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"}]],Gn=H("bot",Un);/**
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 Kn=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Xn=H("chevron-down",Kn);/**
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 Qn=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Yn=H("chevron-right",Qn);/**
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 Jn=[["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"}]],Je=H("eye",Jn);/**
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 Zn=[["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"}]],er=H("file-braces",Zn);/**
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 tr=[["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",tr);/**
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 nr=[["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"}]],rr=H("file-code",nr);/**
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 ar=[["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"}]],or=H("file-plus",ar);/**
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 ir=[["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"}]],sr=H("file-text",ir);/**
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 lr=[["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"}]],cr=H("file-type",lr);/**
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 ur=[["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"}]],dr=H("file",ur);/**
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 fr=[["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"}]],pr=H("folder-open",fr);/**
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 hr=[["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",hr);/**
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 gr=[["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"}]],xr=H("folder",gr);/**
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 vr=[["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"}]],yr=H("message-square",vr);/**
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 br=[["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"}]],wr=H("rotate-cw",br);/**
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 jr=[["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"}]],Sr=H("send",jr);/**
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 zr=[["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"}]],kr=H("shield-check",zr);/**
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 Cr=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],Nr=H("terminal",Cr);/**
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 Mr=[["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"}]],Ze=H("test-tube-diagonal",Mr);/**
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 Pr=[["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"}]],Er=H("trash-2",Pr);/**
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 Lr=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ue=H("x",Lr);function Nt(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 Rr(e){if(Array.isArray(e))return e}function Or(e,t,n){return(t=_r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Dr(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,a,o,u,s=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,t!==0)for(;!(l=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,a=f}finally{try{if(!l&&n.return!=null&&(u=n.return(),Object(u)!==u))return}finally{if(c)throw a}}return s}}function $r(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
122
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Mt(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Pt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Mt(Object(n),!0).forEach(function(r){Or(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Mt(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Ir(e,t){if(e==null)return{};var n,r,a=Tr(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)n=o[r],t.indexOf(n)===-1&&{}.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}function Tr(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 Fr(e,t){return Rr(e)||Dr(e,t)||Br(e,t)||$r()}function Ar(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 _r(e){var t=Ar(e,"string");return typeof t=="symbol"?t:t+""}function Br(e,t){if(e){if(typeof e=="string")return Nt(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)?Nt(e,t):void 0}}function Hr(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Et(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,r)}return n}function Lt(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Et(Object(n),!0).forEach(function(r){Hr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Et(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function Vr(){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(a,o){return o(a)},r)}}function Le(e){return function t(){for(var n=this,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return a.length>=e.length?e.apply(this,a):function(){for(var u=arguments.length,s=new Array(u),l=0;l<u;l++)s[l]=arguments[l];return t.apply(n,[].concat(a,s))}}}function Ge(e){return{}.toString.call(e).includes("Object")}function qr(e){return!Object.keys(e).length}function $e(e){return typeof e=="function"}function Wr(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ur(e,t){return Ge(t)||le("changeType"),Object.keys(t).some(function(n){return!Wr(e,n)})&&le("changeField"),t}function Gr(e){$e(e)||le("selectorType")}function Kr(e){$e(e)||Ge(e)||le("handlerType"),Ge(e)&&Object.values(e).some(function(t){return!$e(t)})&&le("handlersType")}function Xr(e){e||le("initialIsRequired"),Ge(e)||le("initialType"),qr(e)&&le("initialContent")}function Qr(e,t){throw new Error(e[t]||e.default)}var Yr={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=Le(Qr)(Yr),_e={changes:Ur,selector:Gr,handler:Kr,initial:Xr};function Jr(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};_e.initial(e),_e.handler(t);var n={current:e},r=Le(ta)(n,t),a=Le(ea)(n),o=Le(_e.changes)(e),u=Le(Zr)(n);function s(){var c=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(f){return f};return _e.selector(c),c(n.current)}function l(c){Vr(r,a,o,u)(c)}return[s,l]}function Zr(e,t){return $e(t)?t(e.current):t}function ea(e,t){return e.current=Lt(Lt({},e.current),t),t}function ta(e,t,n){return $e(t)?t(e.current):Object.keys(n).forEach(function(r){var a;return(a=t[r])===null||a===void 0?void 0:a.call(t,e.current[r])}),n}var na={create:Jr},ra={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function aa(e){return function t(){for(var n=this,r=arguments.length,a=new Array(r),o=0;o<r;o++)a[o]=arguments[o];return a.length>=e.length?e.apply(this,a):function(){for(var u=arguments.length,s=new Array(u),l=0;l<u;l++)s[l]=arguments[l];return t.apply(n,[].concat(a,s))}}}function oa(e){return{}.toString.call(e).includes("Object")}function ia(e){return e||Rt("configIsRequired"),oa(e)||Rt("configType"),e.urls?(sa(),{paths:{vs:e.urls.monacoBase}}):e}function sa(){console.warn(Qt.deprecation)}function la(e,t){throw new Error(e[t]||e.default)}var Qt={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!
123
+ You are using deprecated way of configuration.
124
+
125
+ Instead of using
126
+ monaco.config({ urls: { monacoBase: '...' } })
127
+ use
128
+ monaco.config({ paths: { vs: '...' } })
129
+
130
+ For more please check the link https://github.com/suren-atoyan/monaco-loader#config
131
+ `},Rt=aa(la)(Qt),ca={config:ia},ua=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(a){return n.reduceRight(function(o,u){return u(o)},a)}};function Yt(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],Yt(e[n],t[n]))}),Pt(Pt({},e),t)}var da={type:"cancelation",msg:"operation is manually canceled"};function et(e){var t=!1,n=new Promise(function(r,a){e.then(function(o){return t?a(da):r(o)}),e.catch(a)});return n.cancel=function(){return t=!0},n}var fa=["monaco"],pa=na.create({config:ra,isInitialized:!1,resolve:null,reject:null,monaco:null}),Jt=Fr(pa,2),Te=Jt[0],Ke=Jt[1];function ha(e){var t=ca.config(e),n=t.monaco,r=Ir(t,fa);Ke(function(a){return{config:Yt(a.config,r),monaco:n}})}function ma(){var e=Te(function(t){var n=t.monaco,r=t.isInitialized,a=t.resolve;return{monaco:n,isInitialized:r,resolve:a}});if(!e.isInitialized){if(Ke({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),et(tt);if(window.monaco&&window.monaco.editor)return Zt(window.monaco),e.resolve(window.monaco),et(tt);ua(ga,va)(ya)}return et(tt)}function ga(e){return document.body.appendChild(e)}function xa(e){var t=document.createElement("script");return e&&(t.src=e),t}function va(e){var t=Te(function(r){var a=r.config,o=r.reject;return{config:a,reject:o}}),n=xa("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function ya(){var e=Te(function(n){var r=n.config,a=n.resolve,o=n.reject;return{config:r,resolve:a,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){var r=n.m||n;Zt(r),e.resolve(r)},function(n){e.reject(n)})}function Zt(e){Te().monaco||Ke({monaco:e})}function ba(){return Te(function(e){var t=e.monaco;return t})}var tt=new Promise(function(e,t){return Ke({resolve:e,reject:t})}),en={config:ha,init:ma,__getMonacoInstance:ba},wa={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},nt=wa,ja={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Sa=ja;function za({children:e}){return Se.createElement("div",{style:Sa.container},e)}var ka=za,Ca=ka;function Na({width:e,height:t,isEditorReady:n,loading:r,_ref:a,className:o,wrapperProps:u}){return Se.createElement("section",{style:{...nt.wrapper,width:e,height:t},...u},!n&&Se.createElement(Ca,null,r),Se.createElement("div",{ref:a,style:{...nt.fullWidth,...!n&&nt.hide},className:o}))}var Ma=Na,tn=d.memo(Ma);function Pa(e){d.useEffect(e,[])}var nn=Pa;function Ea(e,t,n=!0){let r=d.useRef(!0);d.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var Q=Ea;function Oe(){}function we(e,t,n,r){return La(e,r)||Ra(e,t,n,r)}function La(e,t){return e.editor.getModel(rn(e,t))}function Ra(e,t,n,r){return e.editor.createModel(t,n,r?rn(e,r):void 0)}function rn(e,t){return e.Uri.parse(t)}function Oa({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:a,originalModelPath:o,modifiedModelPath:u,keepCurrentOriginalModel:s=!1,keepCurrentModifiedModel:l=!1,theme:c="light",loading:f="Loading...",options:v={},height:m="100%",width:y="100%",className:j,wrapperProps:g={},beforeMount:w=Oe,onMount:b=Oe}){let[h,k]=d.useState(!1),[S,x]=d.useState(!0),N=d.useRef(null),C=d.useRef(null),D=d.useRef(null),_=d.useRef(b),L=d.useRef(w),M=d.useRef(!1);nn(()=>{let z=en.init();return z.then(O=>(C.current=O)&&x(!1)).catch(O=>(O==null?void 0:O.type)!=="cancelation"&&console.error("Monaco initialization: error:",O)),()=>N.current?I():z.cancel()}),Q(()=>{if(N.current&&C.current){let z=N.current.getOriginalEditor(),O=we(C.current,e||"",r||n||"text",o||"");O!==z.getModel()&&z.setModel(O)}},[o],h),Q(()=>{if(N.current&&C.current){let z=N.current.getModifiedEditor(),O=we(C.current,t||"",a||n||"text",u||"");O!==z.getModel()&&z.setModel(O)}},[u],h),Q(()=>{let z=N.current.getModifiedEditor();z.getOption(C.current.editor.EditorOption.readOnly)?z.setValue(t||""):t!==z.getValue()&&(z.executeEdits("",[{range:z.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),z.pushUndoStop())},[t],h),Q(()=>{var z,O;(O=(z=N.current)==null?void 0:z.getModel())==null||O.original.setValue(e||"")},[e],h),Q(()=>{let{original:z,modified:O}=N.current.getModel();C.current.editor.setModelLanguage(z,r||n||"text"),C.current.editor.setModelLanguage(O,a||n||"text")},[n,r,a],h),Q(()=>{var z;(z=C.current)==null||z.editor.setTheme(c)},[c],h),Q(()=>{var z;(z=N.current)==null||z.updateOptions(v)},[v],h);let E=d.useCallback(()=>{var q;if(!C.current)return;L.current(C.current);let z=we(C.current,e||"",r||n||"text",o||""),O=we(C.current,t||"",a||n||"text",u||"");(q=N.current)==null||q.setModel({original:z,modified:O})},[n,t,a,e,r,o,u]),T=d.useCallback(()=>{var z;!M.current&&D.current&&(N.current=C.current.editor.createDiffEditor(D.current,{automaticLayout:!0,...v}),E(),(z=C.current)==null||z.editor.setTheme(c),k(!0),M.current=!0)},[v,c,E]);d.useEffect(()=>{h&&_.current(N.current,C.current)},[h]),d.useEffect(()=>{!S&&!h&&T()},[S,h,T]);function I(){var O,q,J,ee;let z=(O=N.current)==null?void 0:O.getModel();s||((q=z==null?void 0:z.original)==null||q.dispose()),l||((J=z==null?void 0:z.modified)==null||J.dispose()),(ee=N.current)==null||ee.dispose()}return Se.createElement(tn,{width:y,height:m,isEditorReady:h,loading:f,_ref:D,className:j,wrapperProps:g})}var Da=Oa;d.memo(Da);function $a(e){let t=d.useRef();return d.useEffect(()=>{t.current=e},[e]),t.current}var Ia=$a,Be=new Map;function Ta({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:a,path:o,theme:u="light",line:s,loading:l="Loading...",options:c={},overrideServices:f={},saveViewState:v=!0,keepCurrentModel:m=!1,width:y="100%",height:j="100%",className:g,wrapperProps:w={},beforeMount:b=Oe,onMount:h=Oe,onChange:k,onValidate:S=Oe}){let[x,N]=d.useState(!1),[C,D]=d.useState(!0),_=d.useRef(null),L=d.useRef(null),M=d.useRef(null),E=d.useRef(h),T=d.useRef(b),I=d.useRef(),z=d.useRef(r),O=Ia(o),q=d.useRef(!1),J=d.useRef(!1);nn(()=>{let R=en.init();return R.then($=>(_.current=$)&&D(!1)).catch($=>($==null?void 0:$.type)!=="cancelation"&&console.error("Monaco initialization: error:",$)),()=>L.current?W():R.cancel()}),Q(()=>{var $,V,te,K;let R=we(_.current,e||r||"",t||a||"",o||n||"");R!==(($=L.current)==null?void 0:$.getModel())&&(v&&Be.set(O,(V=L.current)==null?void 0:V.saveViewState()),(te=L.current)==null||te.setModel(R),v&&((K=L.current)==null||K.restoreViewState(Be.get(o))))},[o],x),Q(()=>{var R;(R=L.current)==null||R.updateOptions(c)},[c],x),Q(()=>{!L.current||r===void 0||(L.current.getOption(_.current.editor.EditorOption.readOnly)?L.current.setValue(r):r!==L.current.getValue()&&(J.current=!0,L.current.executeEdits("",[{range:L.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),L.current.pushUndoStop(),J.current=!1))},[r],x),Q(()=>{var $,V;let R=($=L.current)==null?void 0:$.getModel();R&&a&&((V=_.current)==null||V.editor.setModelLanguage(R,a))},[a],x),Q(()=>{var R;s!==void 0&&((R=L.current)==null||R.revealLine(s))},[s],x),Q(()=>{var R;(R=_.current)==null||R.editor.setTheme(u)},[u],x);let ee=d.useCallback(()=>{var R;if(!(!M.current||!_.current)&&!q.current){T.current(_.current);let $=o||n,V=we(_.current,r||e||"",t||a||"",$||"");L.current=(R=_.current)==null?void 0:R.editor.create(M.current,{model:V,automaticLayout:!0,...c},f),v&&L.current.restoreViewState(Be.get($)),_.current.editor.setTheme(u),s!==void 0&&L.current.revealLine(s),N(!0),q.current=!0}},[e,t,n,r,a,o,c,f,v,u,s]);d.useEffect(()=>{x&&E.current(L.current,_.current)},[x]),d.useEffect(()=>{!C&&!x&&ee()},[C,x,ee]),z.current=r,d.useEffect(()=>{var R,$;x&&k&&((R=I.current)==null||R.dispose(),I.current=($=L.current)==null?void 0:$.onDidChangeModelContent(V=>{J.current||k(L.current.getValue(),V)}))},[x,k]),d.useEffect(()=>{if(x){let R=_.current.editor.onDidChangeMarkers($=>{var te;let V=(te=L.current.getModel())==null?void 0:te.uri;if(V&&$.find(K=>K.path===V.path)){let K=_.current.editor.getModelMarkers({resource:V});S==null||S(K)}});return()=>{R==null||R.dispose()}}return()=>{}},[x,S]);function W(){var R,$;(R=I.current)==null||R.dispose(),m?v&&Be.set(o,L.current.saveViewState()):($=L.current.getModel())==null||$.dispose(),L.current.dispose()}return Se.createElement(tn,{width:y,height:j,isEditorReady:x,loading:l,_ref:M,className:g,wrapperProps:w})}var Fa=Ta,Aa=d.memo(Fa),_a=Aa;function Ba(e,t){const n=getComputedStyle(e),r=parseFloat(n.fontSize);return t*r}function Ha(e,t){const n=getComputedStyle(e.ownerDocument.body),r=parseFloat(n.fontSize);return t*r}function Va(e){return e/100*window.innerHeight}function qa(e){return e/100*window.innerWidth}function Wa(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 Re({groupSize:e,panelElement:t,styleProp:n}){let r;const[a,o]=Wa(n);switch(o){case"%":{r=a/100*e;break}case"px":{r=a;break}case"rem":{r=Ha(t,a);break}case"em":{r=Ba(t,a);break}case"vh":{r=Va(a);break}case"vw":{r=qa(a);break}}return r}function G(e){return parseFloat(e.toFixed(3))}function Ce({group:e}){const{orientation:t,panels:n}=e;return n.reduce((r,a)=>(r+=t==="horizontal"?a.element.offsetWidth:a.element.offsetHeight,r),0)}function at(e){const{panels:t}=e,n=Ce({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:a,panelConstraints:o}=r;let u=0;if(o.collapsedSize!==void 0){const f=Re({groupSize:n,panelElement:a,styleProp:o.collapsedSize});u=G(f/n*100)}let s;if(o.defaultSize!==void 0){const f=Re({groupSize:n,panelElement:a,styleProp:o.defaultSize});s=G(f/n*100)}let l=0;if(o.minSize!==void 0){const f=Re({groupSize:n,panelElement:a,styleProp:o.minSize});l=G(f/n*100)}let c=100;if(o.maxSize!==void 0){const f=Re({groupSize:n,panelElement:a,styleProp:o.maxSize});c=G(f/n*100)}return{groupResizeBehavior:o.groupResizeBehavior,collapsedSize:u,collapsible:o.collapsible===!0,defaultSize:s,disabled:o.disabled,minSize:l,maxSize:c,panelId:r.id}})}function F(e,t="Assertion error"){if(!e)throw Error(t)}function ot(e,t){return Array.from(t).sort(e==="horizontal"?Ua:Ga)}function Ua(e,t){const n=e.element.offsetLeft-t.element.offsetLeft;return n!==0?n:e.element.offsetWidth-t.element.offsetWidth}function Ga(e,t){const n=e.element.offsetTop-t.element.offsetTop;return n!==0?n:e.element.offsetHeight-t.element.offsetHeight}function an(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.ELEMENT_NODE}function on(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 Ka({orientation:e,rects:t,targetRect:n}){const r={x:n.x+n.width/2,y:n.y+n.height/2};let a,o=Number.MAX_VALUE;for(const u of t){const{x:s,y:l}=on(r,u),c=e==="horizontal"?s:l;c<o&&(o=c,a=u)}return F(a,"No rect found"),a}let He;function Xa(){return He===void 0&&(typeof matchMedia=="function"?He=!!matchMedia("(pointer:coarse)").matches:He=!1),He}function sn(e){const{element:t,orientation:n,panels:r,separators:a}=e,o=ot(n,Array.from(t.children).filter(an).map(j=>({element:j}))).map(({element:j})=>j),u=[];let s=!1,l=!1,c=-1,f=-1,v=0,m,y=[];{let j=-1;for(const g of o)g.hasAttribute("data-panel")&&(j++,g.ariaDisabled===null&&(v++,c===-1&&(c=j),f=j))}if(v>1){let j=-1;for(const g of o)if(g.hasAttribute("data-panel")){j++;const w=r.find(b=>b.element===g);if(w){if(m){const b=m.element.getBoundingClientRect(),h=g.getBoundingClientRect();let k;if(l){const S=n==="horizontal"?new DOMRect(b.right,b.top,0,b.height):new DOMRect(b.left,b.bottom,b.width,0),x=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:{k=[S,x];break}case 1:{const N=y[0],C=Ka({orientation:n,rects:[b,h],targetRect:N.element.getBoundingClientRect()});k=[N,C===b?x:S];break}default:{k=y;break}}}else y.length?k=y:k=[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 k){let x="width"in S?S:S.element.getBoundingClientRect();const N=Xa()?e.resizeTargetMinimumSize.coarse:e.resizeTargetMinimumSize.fine;if(x.width<N){const D=N-x.width;x=new DOMRect(x.x-D/2,x.y,x.width+D,x.height)}if(x.height<N){const D=N-x.height;x=new DOMRect(x.x,x.y-D/2,x.width,x.height+D)}const C=j<=c||j>f;!s&&!C&&u.push({group:e,groupSize:Ce({group:e}),panels:[m,w],separator:"width"in S?void 0:S,rect:x}),s=!1}}l=!1,m=w,y=[]}}else if(g.hasAttribute("data-separator")){g.ariaDisabled!==null&&(s=!0);const w=a.find(b=>b.element===g);w?y.push(w):(m=void 0,y=[])}else l=!0}return u}var se;class ln{constructor(){zt(this,se,{})}addListener(t,n){const r=Ee(this,se)[t];return r===void 0?Ee(this,se)[t]=[n]:r.includes(n)||r.push(n),()=>{this.removeListener(t,n)}}emit(t,n){const r=Ee(this,se)[t];if(r!==void 0)if(r.length===1)r[0].call(null,n);else{let a=!1,o=null;const u=Array.from(r);for(let s=0;s<u.length;s++){const l=u[s];try{l.call(null,n)}catch(c){o===null&&(a=!0,o=c)}}if(a)throw o}}removeAllListeners(){kt(this,se,{})}removeListener(t,n){const r=Ee(this,se)[t];if(r!==void 0){const a=r.indexOf(n);a>=0&&r.splice(a,1)}}}se=new WeakMap;let re=new Map;const cn=new ln;function Qa(e){re=new Map(re),re.delete(e)}function Ot(e,t){for(const[n]of re)if(n.id===e)return n}function ce(e,t){for(const[n,r]of re)if(n.id===e)return r;if(t)throw Error(`Could not find data for Group with id ${e}`)}function ge(){return re}function lt(e,t){return cn.addListener("groupChange",n=>{n.group.id===e&&t(n)})}function oe(e,t){const n=re.get(e);re=new Map(re),re.set(e,t),cn.emit("groupChange",{group:e,prev:n,next:t})}function Ya(e,t,n){let r,a={x:1/0,y:1/0};for(const o of t){const u=on(n,o.rect);switch(e){case"horizontal":{u.x<=a.x&&(r=o,a=u);break}case"vertical":{u.y<=a.y&&(r=o,a=u);break}}}return r?{distance:a,hitRegion:r}:void 0}function Ja(e){return e!==null&&typeof e=="object"&&"nodeType"in e&&e.nodeType===Node.DOCUMENT_FRAGMENT_NODE}function Za(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:It(e),b:It(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)r=n.a.pop(),n.b.pop();F(r,"Stacking order can only be calculated for elements with a common ancestor");const a={a:$t(Dt(n.a)),b:$t(Dt(n.b))};if(a.a===a.b){const o=r.childNodes,u={a:n.a.at(-1),b:n.b.at(-1)};let s=o.length;for(;s--;){const l=o[s];if(l===u.a)return 1;if(l===u.b)return-1}}return Math.sign(a.a-a.b)}const eo=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function to(e){const t=getComputedStyle(un(e)??e).display;return t==="flex"||t==="inline-flex"}function no(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||to(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"||eo.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Dt(e){let t=e.length;for(;t--;){const n=e[t];if(F(n,"Missing node"),no(n))return n}return null}function $t(e){return e&&Number(getComputedStyle(e).zIndex)||0}function It(e){const t=[];for(;e;)t.push(e),e=un(e);return t}function un(e){const{parentNode:t}=e;return Ja(t)?t.host:t}function ro(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 ao({groupElement:e,hitRegion:t,pointerEventTarget:n}){if(!an(n)||n.contains(e)||e.contains(n))return!0;if(Za(n,e)>0){let r=n;for(;r;){if(r.contains(e))return!0;if(ro(r.getBoundingClientRect(),t))return!1;r=r.parentElement}}return!0}function ct(e,t){const n=[];return t.forEach((r,a)=>{if(a.disabled)return;const o=sn(a),u=Ya(a.orientation,o,{x:e.clientX,y:e.clientY});u&&u.distance.x<=0&&u.distance.y<=0&&ao({groupElement:a.element,hitRegion:u.hitRegion.rect,pointerEventTarget:e.target})&&n.push(u.hitRegion)}),n}function oo(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 U(e,t,n=0){return Math.abs(G(e)-G(t))<=n}function ne(e,t){return U(e,t)?0:e>t?1:-1}function je({overrideDisabledPanels:e,panelConstraints:t,prevSize:n,size:r}){const{collapsedSize:a=0,collapsible:o,disabled:u,maxSize:s=100,minSize:l=0}=t;if(u&&!e)return n;if(ne(r,l)<0)if(o){const c=(a+l)/2;ne(r,c)<0?r=a:r=l}else r=l;return r=Math.min(s,r),r=G(r),r}function Ie({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:a,trigger:o}){if(U(e,0))return t;const u=o==="imperative-api",s=Object.values(t),l=Object.values(a),c=[...s],[f,v]=r;F(f!=null,"Invalid first pivot index"),F(v!=null,"Invalid second pivot index");let m=0;switch(o){case"keyboard":{{const g=e<0?v:f,w=n[g];F(w,`Panel constraints not found for index ${g}`);const{collapsedSize:b=0,collapsible:h,minSize:k=0}=w;if(h){const S=s[g];if(F(S!=null,`Previous layout not found for panel index ${g}`),U(S,b)){const x=k-S;ne(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}{const g=e<0?f:v,w=n[g];F(w,`No panel constraints found for index ${g}`);const{collapsedSize:b=0,collapsible:h,minSize:k=0}=w;if(h){const S=s[g];if(F(S!=null,`Previous layout not found for panel index ${g}`),U(S,k)){const x=S-b;ne(x,Math.abs(e))>0&&(e=e<0?0-x:x)}}}break}default:{const g=e<0?v:f,w=n[g];F(w,`Panel constraints not found for index ${g}`);const b=s[g],{collapsible:h,collapsedSize:k,minSize:S}=w;if(h&&ne(b,S)<0)if(e>0){const x=S-k,N=x/2,C=b+e;ne(C,S)<0&&(e=ne(e,N)<=0?0:x)}else{const x=S-k,N=100-x/2,C=b-e;ne(C,S)<0&&(e=ne(100+e,N)>0?0:-x)}break}}{const g=e<0?1:-1;let w=e<0?v:f,b=0;for(;;){const k=s[w];F(k!=null,`Previous layout not found for panel index ${w}`);const S=je({overrideDisabledPanels:u,panelConstraints:n[w],prevSize:k,size:100})-k;if(b+=S,w+=g,w<0||w>=n.length)break}const h=Math.min(Math.abs(e),Math.abs(b));e=e<0?0-h:h}{let g=e<0?f:v;for(;g>=0&&g<n.length;){const w=Math.abs(e)-Math.abs(m),b=s[g];F(b!=null,`Previous layout not found for panel index ${g}`);const h=b-w,k=je({overrideDisabledPanels:u,panelConstraints:n[g],prevSize:b,size:h});if(!U(b,k)&&(m+=b-k,c[g]=k,m.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?g--:g++}}if(oo(l,c))return a;{const g=e<0?v:f,w=s[g];F(w!=null,`Previous layout not found for panel index ${g}`);const b=w+m,h=je({overrideDisabledPanels:u,panelConstraints:n[g],prevSize:w,size:b});if(c[g]=h,!U(h,b)){let k=b-h,S=e<0?v:f;for(;S>=0&&S<n.length;){const x=c[S];F(x!=null,`Previous layout not found for panel index ${S}`);const N=x+k,C=je({overrideDisabledPanels:u,panelConstraints:n[S],prevSize:x,size:N});if(U(x,C)||(k-=C-x,c[S]=C),U(k,0))break;e>0?S--:S++}}}const y=Object.values(c).reduce((g,w)=>w+g,0);if(!U(y,100,.1))return a;const j=Object.keys(a);return c.reduce((g,w,b)=>(g[j[b]]=w,g),{})}function pe(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(t[n]===void 0||ne(e[n],t[n])!==0)return!1;return!0}function he({layout:e,panelConstraints:t}){const n=Object.values(e),r=[...n],a=r.reduce((s,l)=>s+l,0);if(r.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${r.map(s=>`${s}%`).join(", ")}`);if(!U(a,100)&&r.length>0)for(let s=0;s<t.length;s++){const l=r[s];F(l!=null,`No layout data found for index ${s}`);const c=100/a*l;r[s]=c}let o=0;for(let s=0;s<t.length;s++){const l=n[s];F(l!=null,`No layout data found for index ${s}`);const c=r[s];F(c!=null,`No layout data found for index ${s}`);const f=je({overrideDisabledPanels:!0,panelConstraints:t[s],prevSize:l,size:c});c!=f&&(o+=c-f,r[s]=f)}if(!U(o,0))for(let s=0;s<t.length;s++){const l=r[s];F(l!=null,`No layout data found for index ${s}`);const c=l+o,f=je({overrideDisabledPanels:!0,panelConstraints:t[s],prevSize:l,size:c});if(l!==f&&(o-=f-l,r[s]=f,U(o,0)))break}const u=Object.keys(e);return r.reduce((s,l,c)=>(s[u[c]]=l,s),{})}function dn({groupId:e,panelId:t}){const n=()=>{const s=ge();for(const[l,{defaultLayoutDeferred:c,derivedPanelConstraints:f,layout:v,groupSize:m,separatorToPanels:y}]of s)if(l.id===e)return{defaultLayoutDeferred:c,derivedPanelConstraints:f,group:l,groupSize:m,layout:v,separatorToPanels:y};throw Error(`Group ${e} not found`)},r=()=>{const s=n().derivedPanelConstraints.find(l=>l.panelId===t);if(s!==void 0)return s;throw Error(`Panel constraints not found for Panel ${t}`)},a=()=>{const s=n().group.panels.find(l=>l.id===t);if(s!==void 0)return s;throw Error(`Layout not found for Panel ${t}`)},o=()=>{const s=n().layout[t];if(s!==void 0)return s;throw Error(`Layout not found for Panel ${t}`)},u=s=>{const l=o();if(s===l)return;const{defaultLayoutDeferred:c,derivedPanelConstraints:f,group:v,groupSize:m,layout:y,separatorToPanels:j}=n(),g=v.panels.findIndex(k=>k.id===t),w=g===v.panels.length-1,b=Ie({delta:w?l-s:s-l,initialLayout:y,panelConstraints:f,pivotIndices:w?[g-1,g]:[g,g+1],prevLayout:y,trigger:"imperative-api"}),h=he({layout:b,panelConstraints:f});pe(y,h)||oe(v,{defaultLayoutDeferred:c,derivedPanelConstraints:f,groupSize:m,layout:h,separatorToPanels:j})};return{collapse:()=>{const{collapsible:s,collapsedSize:l}=r(),{mutableValues:c}=a(),f=o();s&&f!==l&&(c.expandToSize=f,u(l))},expand:()=>{const{collapsible:s,collapsedSize:l,minSize:c}=r(),{mutableValues:f}=a(),v=o();if(s&&v===l){let m=f.expandToSize??c;m===0&&(m=1),u(m)}},getSize:()=>{const{group:s}=n(),l=o(),{element:c}=a(),f=s.orientation==="horizontal"?c.offsetWidth:c.offsetHeight;return{asPercentage:l,inPixels:f}},isCollapsed:()=>{const{collapsible:s,collapsedSize:l}=r(),c=o();return s&&U(l,c)},resize:s=>{const{group:l}=n(),{element:c}=a(),f=Ce({group:l}),v=Re({groupSize:f,panelElement:c,styleProp:s}),m=G(v/f*100);u(m)}}}function Tt(e){if(e.defaultPrevented)return;const t=ge();ct(e,t).forEach(n=>{if(n.separator){const r=n.panels.find(a=>a.panelConstraints.defaultSize!==void 0);if(r){const a=r.panelConstraints.defaultSize,o=dn({groupId:n.group.id,panelId:r.id});o&&a!==void 0&&(o.resize(a),e.preventDefault())}}})}function qe(e){const t=ge();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 fn({groupId:e}){const t=()=>{const n=ge();for(const[r,a]of n)if(r.id===e)return{group:r,...a};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:a,group:o,groupSize:u,layout:s,separatorToPanels:l}=t(),c=he({layout:n,panelConstraints:a});return r?s:(pe(s,c)||oe(o,{defaultLayoutDeferred:r,derivedPanelConstraints:a,groupSize:u,layout:c,separatorToPanels:l}),c)}}}function fe(e,t){const n=qe(e),r=ce(n.id,!0),a=n.separators.find(f=>f.element===e);F(a,"Matching separator not found");const o=r.separatorToPanels.get(a);F(o,"Matching panels not found");const u=o.map(f=>n.panels.indexOf(f)),s=fn({groupId:n.id}).getLayout(),l=Ie({delta:t,initialLayout:s,panelConstraints:r.derivedPanelConstraints,pivotIndices:u,prevLayout:s,trigger:"keyboard"}),c=he({layout:l,panelConstraints:r.derivedPanelConstraints});pe(s,c)||oe(n,{defaultLayoutDeferred:r.defaultLayoutDeferred,derivedPanelConstraints:r.derivedPanelConstraints,groupSize:r.groupSize,layout:c,separatorToPanels:r.separatorToPanels})}function Ft(e){if(e.defaultPrevented)return;const t=e.currentTarget,n=qe(t);if(!n.disabled)switch(e.key){case"ArrowDown":{e.preventDefault(),n.orientation==="vertical"&&fe(t,5);break}case"ArrowLeft":{e.preventDefault(),n.orientation==="horizontal"&&fe(t,-5);break}case"ArrowRight":{e.preventDefault(),n.orientation==="horizontal"&&fe(t,5);break}case"ArrowUp":{e.preventDefault(),n.orientation==="vertical"&&fe(t,-5);break}case"End":{e.preventDefault(),fe(t,100);break}case"Enter":{e.preventDefault();const r=qe(t),a=ce(r.id,!0),{derivedPanelConstraints:o,layout:u,separatorToPanels:s}=a,l=r.separators.find(m=>m.element===t);F(l,"Matching separator not found");const c=s.get(l);F(c,"Matching panels not found");const f=c[0],v=o.find(m=>m.panelId===f.id);if(F(v,"Panel metadata not found"),v.collapsible){const m=u[f.id],y=v.collapsedSize===m?r.mutableState.expandedPanelSizes[f.id]??v.minSize:v.collapsedSize;fe(t,y-m)}break}case"F6":{e.preventDefault();const r=qe(t).separators.map(u=>u.element),a=Array.from(r).findIndex(u=>u===e.currentTarget);F(a!==null,"Index not found");const o=e.shiftKey?a>0?a-1:r.length-1:a+1<r.length?a+1:0;r[o].focus({preventScroll:!0});break}case"Home":{e.preventDefault(),fe(t,-100);break}}}let ze={cursorFlags:0,state:"inactive"};const ut=new ln;function me(){return ze}function io(e){return ut.addListener("change",e)}function so(e){const t=ze,n={...ze};n.cursorFlags=e,ze=n,ut.emit("change",{prev:t,next:n})}function ke(e){const t=ze;ze=e,ut.emit("change",{prev:t,next:e})}function At(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=ge(),n=ct(e,t),r=new Map;let a=!1;n.forEach(o=>{o.separator&&(a||(a=!0,o.separator.element.focus({preventScroll:!0})));const u=t.get(o.group);u&&r.set(o.group,u.layout)}),ke({cursorFlags:0,hitRegions:n,initialLayoutMap:r,pointerDownAtPoint:{x:e.clientX,y:e.clientY},state:"active"}),n.length&&e.preventDefault()}const lo=e=>e,rt=()=>{},pn=1,hn=2,mn=4,gn=8,_t=3,Bt=12;let Ve;function Ht(){return Ve===void 0&&(Ve=!1,typeof window<"u"&&(window.navigator.userAgent.includes("Chrome")||window.navigator.userAgent.includes("Firefox"))&&(Ve=!0)),Ve}function co({cursorFlags:e,groups:t,state:n}){let r=0,a=0;switch(n){case"active":case"hover":t.forEach(o=>{if(!o.mutableState.disableCursor)switch(o.orientation){case"horizontal":{r++;break}case"vertical":{a++;break}}})}if(!(r===0&&a===0)){switch(n){case"active":{if(e&&Ht()){const o=(e&pn)!==0,u=(e&hn)!==0,s=(e&mn)!==0,l=(e&gn)!==0;if(o)return s?"se-resize":l?"ne-resize":"e-resize";if(u)return s?"sw-resize":l?"nw-resize":"w-resize";if(s)return"s-resize";if(l)return"n-resize"}break}}return Ht()?r>0&&a>0?"move":r>0?"ew-resize":"ns-resize":r>0&&a>0?"grab":r>0?"col-resize":"row-resize"}}const Vt=new WeakMap;function dt(e){if(e.defaultView===null||e.defaultView===void 0)return;let{prevStyle:t,styleSheet:n}=Vt.get(e)??{};n===void 0&&(n=new e.defaultView.CSSStyleSheet,e.adoptedStyleSheets&&e.adoptedStyleSheets.push(n));const r=me();switch(r.state){case"active":case"hover":{const a=co({cursorFlags:r.cursorFlags,groups:r.hitRegions.map(u=>u.group),state:r.state}),o=`*, *:hover {cursor: ${a} !important; }`;if(t===o)return;t=o,a?n.cssRules.length===0?n.insertRule(o):n.replaceSync(o):n.cssRules.length===1&&n.deleteRule(0);break}case"inactive":{t=void 0,n.cssRules.length===1&&n.deleteRule(0);break}}Vt.set(e,{prevStyle:t,styleSheet:n})}function xn({document:e,event:t,hitRegions:n,initialLayoutMap:r,mountedGroups:a,pointerDownAtPoint:o,prevCursorFlags:u}){let s=0;n.forEach(c=>{const{group:f,groupSize:v}=c,{orientation:m,panels:y}=f,{disableCursor:j}=f.mutableState;let g=0;o?m==="horizontal"?g=(t.clientX-o.x)/v*100:g=(t.clientY-o.y)/v*100:m==="horizontal"?g=t.clientX<0?-100:100:g=t.clientY<0?-100:100;const w=r.get(f),b=a.get(f);if(!w||!b)return;const{defaultLayoutDeferred:h,derivedPanelConstraints:k,groupSize:S,layout:x,separatorToPanels:N}=b;if(k&&x&&N){const C=Ie({delta:g,initialLayout:w,panelConstraints:k,pivotIndices:c.panels.map(D=>y.indexOf(D)),prevLayout:x,trigger:"mouse-or-touch"});if(pe(C,x)){if(g!==0&&!j)switch(m){case"horizontal":{s|=g<0?pn:hn;break}case"vertical":{s|=g<0?mn:gn;break}}}else oe(c.group,{defaultLayoutDeferred:h,derivedPanelConstraints:k,groupSize:S,layout:C,separatorToPanels:N})}});let l=0;t.movementX===0?l|=u&_t:l|=s&_t,t.movementY===0?l|=u&Bt:l|=s&Bt,so(l),dt(e)}function qt(e){const t=ge(),n=me();switch(n.state){case"active":xn({document:e.currentTarget,event:e,hitRegions:n.hitRegions,initialLayoutMap:n.initialLayoutMap,mountedGroups:t,prevCursorFlags:n.cursorFlags})}}function Wt(e){if(e.defaultPrevented)return;const t=me(),n=ge();switch(t.state){case"active":{if(e.buttons===0){ke({cursorFlags:0,state:"inactive"}),t.hitRegions.forEach(r=>{const a=ce(r.group.id,!0);oe(r.group,a)});return}xn({document:e.currentTarget,event:e,hitRegions:t.hitRegions,initialLayoutMap:t.initialLayoutMap,mountedGroups:n,pointerDownAtPoint:t.pointerDownAtPoint,prevCursorFlags:t.cursorFlags});break}default:{const r=ct(e,n);r.length===0?t.state!=="inactive"&&ke({cursorFlags:0,state:"inactive"}):ke({cursorFlags:0,hitRegions:r,state:"hover"}),dt(e.currentTarget);break}}}function Ut(e){if(e.relatedTarget instanceof HTMLIFrameElement)switch(me().state){case"hover":ke({cursorFlags:0,state:"inactive"})}}function Gt(e){if(e.defaultPrevented||e.pointerType==="mouse"&&e.button>0)return;const t=me();switch(t.state){case"active":ke({cursorFlags:0,state:"inactive"}),t.hitRegions.length>0&&(dt(e.currentTarget),t.hitRegions.forEach(n=>{const r=ce(n.group.id,!0);oe(n.group,r)}),e.preventDefault())}}function Kt(e){let t=0,n=0;const r={};for(const o of e)if(o.defaultSize!==void 0){t++;const u=G(o.defaultSize);n+=u,r[o.panelId]=u}else r[o.panelId]=void 0;const a=e.length-t;if(a!==0){const o=G((100-n)/a);for(const u of e)u.defaultSize===void 0&&(r[u.panelId]=o)}return r}function uo(e,t,n){if(!n[0])return;const r=e.panels.find(l=>l.element===t);if(!r||!r.onResize)return;const a=Ce({group:e}),o=e.orientation==="horizontal"?r.element.offsetWidth:r.element.offsetHeight,u=r.mutableValues.prevSize,s={asPercentage:G(o/a*100),inPixels:o};r.mutableValues.prevSize=s,r.onResize(s,r.id,u)}function fo(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 po({group:e,nextGroupSize:t,prevGroupSize:n,prevLayout:r}){if(n<=0||t<=0||n===t)return r;let a=0,o=0,u=!1;const s=new Map,l=[];for(const v of e.panels){const m=r[v.id]??0;switch(v.panelConstraints.groupResizeBehavior){case"preserve-pixel-size":{u=!0;const y=m/100*n,j=G(y/t*100);s.set(v.id,j),a+=j;break}case"preserve-relative-size":default:{l.push(v.id),o+=m;break}}}if(!u||l.length===0)return r;const c=100-a,f={...r};if(s.forEach((v,m)=>{f[m]=v}),o>0)for(const v of l){const m=r[v]??0;f[v]=G(m/o*c)}else{const v=G(c/l.length);for(const m of l)f[m]=v}return f}function ho(e,t){const n=e.map(a=>a.id),r=Object.keys(t);if(n.length!==r.length)return!1;for(const a of n)if(!r.includes(a))return!1;return!0}const ye=new Map;function mo(e){let t=!0;F(e.element.ownerDocument.defaultView,"Cannot register an unmounted Group");const n=e.element.ownerDocument.defaultView.ResizeObserver,r=new Set,a=new Set,o=new n(j=>{for(const g of j){const{borderBoxSize:w,target:b}=g;if(b===e.element){if(t){const h=Ce({group:e});if(h===0)return;const k=ce(e.id);if(!k)return;const S=at(e),x=k.defaultLayoutDeferred?Kt(S):k.layout,N=po({group:e,nextGroupSize:h,prevGroupSize:k.groupSize,prevLayout:x}),C=he({layout:N,panelConstraints:S});if(!k.defaultLayoutDeferred&&pe(k.layout,C)&&fo(k.derivedPanelConstraints,S)&&k.groupSize===h)return;oe(e,{defaultLayoutDeferred:!1,derivedPanelConstraints:S,groupSize:h,layout:C,separatorToPanels:k.separatorToPanels})}}else uo(e,b,w)}});o.observe(e.element),e.panels.forEach(j=>{F(!r.has(j.id),`Panel ids must be unique; id "${j.id}" was used more than once`),r.add(j.id),j.onResize&&o.observe(j.element)});const u=Ce({group:e}),s=at(e),l=e.panels.map(({id:j})=>j).join(",");let c=e.mutableState.defaultLayout;c&&(ho(e.panels,c)||(c=void 0));const f=e.mutableState.layouts[l]??c??Kt(s),v=he({layout:f,panelConstraints:s}),m=e.element.ownerDocument;ye.set(m,(ye.get(m)??0)+1);const y=new Map;return sn(e).forEach(j=>{j.separator&&y.set(j.separator,j.panels)}),oe(e,{defaultLayoutDeferred:u===0,derivedPanelConstraints:s,groupSize:u,layout:v,separatorToPanels:y}),e.separators.forEach(j=>{F(!a.has(j.id),`Separator ids must be unique; id "${j.id}" was used more than once`),a.add(j.id),j.element.addEventListener("keydown",Ft)}),ye.get(m)===1&&(m.addEventListener("dblclick",Tt,!0),m.addEventListener("pointerdown",At,!0),m.addEventListener("pointerleave",qt),m.addEventListener("pointermove",Wt),m.addEventListener("pointerout",Ut),m.addEventListener("pointerup",Gt,!0)),function(){t=!1,ye.set(m,Math.max(0,(ye.get(m)??0)-1)),Qa(e),e.separators.forEach(j=>{j.element.removeEventListener("keydown",Ft)}),ye.get(m)||(m.removeEventListener("dblclick",Tt,!0),m.removeEventListener("pointerdown",At,!0),m.removeEventListener("pointerleave",qt),m.removeEventListener("pointermove",Wt),m.removeEventListener("pointerout",Ut),m.removeEventListener("pointerup",Gt,!0)),o.disconnect()}}function go(){const[e,t]=d.useState({}),n=d.useCallback(()=>t({}),[]);return[e,n]}function ft(e){const t=d.useId();return`${e??t}`}const xe=typeof window<"u"?d.useLayoutEffect:d.useEffect;function De(e){const t=d.useRef(e);return xe(()=>{t.current=e},[e]),d.useCallback((...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[t])}function pt(...e){return De(t=>{e.forEach(n=>{if(n)switch(typeof n){case"function":{n(t);break}case"object":{n.current=t;break}}})})}function ht(e){const t=d.useRef({...e});return xe(()=>{for(const n in e)t.current[n]=e[n]},[e]),t.current}const vn=d.createContext(null);function xo(e,t){const n=d.useRef({getLayout:()=>({}),setLayout:lo});d.useImperativeHandle(t,()=>n.current,[]),xe(()=>{Object.assign(n.current,fn({groupId:e}))})}function it({children:e,className:t,defaultLayout:n,disableCursor:r,disabled:a,elementRef:o,groupRef:u,id:s,onLayoutChange:l,onLayoutChanged:c,orientation:f="horizontal",resizeTargetMinimumSize:v={coarse:20,fine:10},style:m,...y}){const j=d.useRef({onLayoutChange:{},onLayoutChanged:{}}),g=De(M=>{pe(j.current.onLayoutChange,M)||(j.current.onLayoutChange=M,l==null||l(M))}),w=De(M=>{pe(j.current.onLayoutChanged,M)||(j.current.onLayoutChanged=M,c==null||c(M))}),b=ft(s),h=d.useRef(null),[k,S]=go(),x=d.useRef({lastExpandedPanelSizes:{},layouts:{},panels:[],resizeTargetMinimumSize:v,separators:[]}),N=pt(h,o);xo(b,u);const C=De((M,E)=>{const T=me(),I=Ot(M),z=ce(M);if(z){let O=!1;switch(T.state){case"active":{O=T.hitRegions.some(q=>q.group===I);break}}return{flexGrow:z.layout[E]??1,pointerEvents:O?"none":void 0}}return{flexGrow:(n==null?void 0:n[E])??1}}),D=ht({defaultLayout:n,disableCursor:r}),_=d.useMemo(()=>({get disableCursor(){return!!D.disableCursor},getPanelStyles:C,id:b,orientation:f,registerPanel:M=>{const E=x.current;return E.panels=ot(f,[...E.panels,M]),S(),()=>{E.panels=E.panels.filter(T=>T!==M),S()}},registerSeparator:M=>{const E=x.current;return E.separators=ot(f,[...E.separators,M]),S(),()=>{E.separators=E.separators.filter(T=>T!==M),S()}},togglePanelDisabled:(M,E)=>{const T=x.current.panels.find(O=>O.id===M);T&&(T.panelConstraints.disabled=E);const I=Ot(b),z=ce(b);I&&z&&oe(I,{...z,derivedPanelConstraints:at(I)})},toggleSeparatorDisabled:(M,E)=>{const T=x.current.separators.find(I=>I.id===M);T&&(T.disabled=E)}}),[C,b,S,f,D]),L=d.useRef(null);return xe(()=>{const M=h.current;if(M===null)return;const E=x.current;let T;if(D.defaultLayout!==void 0&&Object.keys(D.defaultLayout).length===E.panels.length){T={};for(const W of E.panels){const R=D.defaultLayout[W.id];R!==void 0&&(T[W.id]=R)}}const I={disabled:!!a,element:M,id:b,mutableState:{defaultLayout:T,disableCursor:!!D.disableCursor,expandedPanelSizes:x.current.lastExpandedPanelSizes,layouts:x.current.layouts},orientation:f,panels:E.panels,resizeTargetMinimumSize:E.resizeTargetMinimumSize,separators:E.separators};L.current=I;const z=mo(I),{defaultLayoutDeferred:O,derivedPanelConstraints:q,layout:J}=ce(I.id,!0);!O&&q.length>0&&(g(J),w(J));const ee=lt(b,W=>{const{defaultLayoutDeferred:R,derivedPanelConstraints:$,layout:V}=W.next;if(R||$.length===0)return;const te=I.panels.map(({id:Z})=>Z).join(",");I.mutableState.layouts[te]=V,$.forEach(Z=>{if(Z.collapsible){const{layout:X}=W.prev??{};if(X){const Ne=U(Z.collapsedSize,V[Z.panelId]),ue=U(Z.collapsedSize,X[Z.panelId]);Ne&&!ue&&(I.mutableState.expandedPanelSizes[Z.panelId]=X[Z.panelId])}}});const K=me().state!=="active";g(V),K&&w(V)});return()=>{L.current=null,z(),ee()}},[a,b,w,g,f,k,D]),d.useEffect(()=>{const M=L.current;M&&(M.mutableState.defaultLayout=n,M.mutableState.disableCursor=!!r)}),i.jsx(vn.Provider,{value:_,children:i.jsx("div",{...y,className:t,"data-group":!0,"data-testid":b,id:b,ref:N,style:{height:"100%",width:"100%",overflow:"hidden",...m,display:"flex",flexDirection:f==="horizontal"?"row":"column",flexWrap:"nowrap",touchAction:f==="horizontal"?"pan-y":"pan-x"},children:e})})}it.displayName="Group";function mt(){const e=d.useContext(vn);return F(e,"Group Context not found; did you render a Panel or Separator outside of a Group?"),e}function vo(e,t){const{id:n}=mt(),r=d.useRef({collapse:rt,expand:rt,getSize:()=>({asPercentage:0,inPixels:0}),isCollapsed:()=>!1,resize:rt});d.useImperativeHandle(t,()=>r.current,[]),xe(()=>{Object.assign(r.current,dn({groupId:n,panelId:e}))})}function be({children:e,className:t,collapsedSize:n="0%",collapsible:r=!1,defaultSize:a,disabled:o,elementRef:u,groupResizeBehavior:s="preserve-relative-size",id:l,maxSize:c="100%",minSize:f="0%",onResize:v,panelRef:m,style:y,...j}){const g=!!l,w=ft(l),b=ht({disabled:o}),h=d.useRef(null),k=pt(h,u),{getPanelStyles:S,id:x,orientation:N,registerPanel:C,togglePanelDisabled:D}=mt(),_=v!==null,L=De((E,T,I)=>{v==null||v(E,l,I)});xe(()=>{const E=h.current;if(E!==null){const T={element:E,id:w,idIsStable:g,mutableValues:{expandToSize:void 0,prevSize:void 0},onResize:_?L:void 0,panelConstraints:{groupResizeBehavior:s,collapsedSize:n,collapsible:r,defaultSize:a,disabled:b.disabled,maxSize:c,minSize:f}};return C(T)}},[s,n,r,a,_,w,g,c,f,L,C,b]),d.useEffect(()=>{D(w,!!o)},[o,w,D]),vo(w,m);const M=d.useSyncExternalStore(E=>lt(x,E),()=>JSON.stringify(S(x,w)),()=>JSON.stringify(S(x,w)));return i.jsx("div",{...j,"aria-disabled":o||void 0,"data-panel":!0,"data-testid":w,id:w,ref:k,style:{...yo,display:"flex",flexBasis:0,flexShrink:1,overflow:"visible",...JSON.parse(M)},children:i.jsx("div",{className:t,style:{maxHeight:"100%",maxWidth:"100%",flexGrow:1,overflow:"auto",...y,touchAction:N==="horizontal"?"pan-y":"pan-x"},children:e})})}be.displayName="Panel";const yo={minHeight:0,maxHeight:"100%",height:"auto",minWidth:0,maxWidth:"100%",width:"auto",border:"none",borderWidth:0,padding:0,margin:0};function bo({layout:e,panelConstraints:t,panelId:n,panelIndex:r}){let a,o;const u=e[n],s=t.find(l=>l.panelId===n);if(s){const l=s.maxSize,c=s.collapsible?s.collapsedSize:s.minSize,f=[r,r+1];o=he({layout:Ie({delta:c-u,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e}),panelConstraints:t})[n],a=he({layout:Ie({delta:l-u,initialLayout:e,panelConstraints:t,pivotIndices:f,prevLayout:e}),panelConstraints:t})[n]}return{valueControls:n,valueMax:a,valueMin:o,valueNow:u}}function We({children:e,className:t,disabled:n,elementRef:r,id:a,style:o,...u}){const s=ft(a),l=ht({disabled:n}),[c,f]=d.useState({}),[v,m]=d.useState("inactive"),y=d.useRef(null),j=pt(y,r),{disableCursor:g,id:w,orientation:b,registerSeparator:h,toggleSeparatorDisabled:k}=mt(),S=b==="horizontal"?"vertical":"horizontal";xe(()=>{const N=y.current;if(N!==null){const C={disabled:l.disabled,element:N,id:s},D=h(C),_=io(M=>{m(M.next.state!=="inactive"&&M.next.hitRegions.some(E=>E.separator===C)?M.next.state:"inactive")}),L=lt(w,M=>{const{derivedPanelConstraints:E,layout:T,separatorToPanels:I}=M.next,z=I.get(C);if(z){const O=z[0],q=z.indexOf(O);f(bo({layout:T,panelConstraints:E,panelId:O.id,panelIndex:q}))}});return()=>{_(),L(),D()}}},[w,s,h,l]),d.useEffect(()=>{k(s,!!n)},[n,s,k]);let x;return n&&!g&&(x="not-allowed"),i.jsx("div",{...u,"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":s,id:s,ref:j,role:"separator",style:{flexBasis:"auto",cursor:x,...o,flexGrow:0,flexShrink:0,touchAction:"none"},tabIndex:n?void 0:0})}We.displayName="Separator";const wo={ghost:"hover:bg-[#F8F4F0] text-[#36342E]",subtle:"hover:bg-[#ECEAE3] text-[#6B6960]"},jo={sm:"w-7 h-7",md:"w-8 h-8"},So={sm:14,md:16};function ie({icon:e,label:t,size:n="md",variant:r="ghost",onClick:a,className:o="",disabled:u=!1,title:s}){return i.jsx("button",{type:"button","aria-label":t,title:s,disabled:u,onClick:a,className:["inline-flex items-center justify-center rounded-btn transition-colors",wo[r],jo[n],u?"opacity-40 cursor-not-allowed":"",o].filter(Boolean).join(" "),children:i.jsx(e,{size:So[n]})})}function zo({x:e,y:t,items:n,onClose:r}){const[a,o]=d.useState(0),u=d.useRef(null),s=d.useRef([]);d.useEffect(()=>{var c;(c=s.current[0])==null||c.focus()},[]),d.useEffect(()=>{const c=f=>{u.current&&!u.current.contains(f.target)&&r()};return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[r]);const l=d.useCallback(c=>{var f,v;switch(c.key){case"Escape":c.preventDefault(),r();break;case"ArrowDown":c.preventDefault(),o(m=>{var j;const y=(m+1)%n.length;return(j=s.current[y])==null||j.focus(),y});break;case"ArrowUp":c.preventDefault(),o(m=>{var j;const y=(m-1+n.length)%n.length;return(j=s.current[y])==null||j.focus(),y});break;case"Home":c.preventDefault(),o(0),(f=s.current[0])==null||f.focus();break;case"End":c.preventDefault(),o(n.length-1),(v=s.current[n.length-1])==null||v.focus();break}},[n.length,r]);return i.jsx("div",{ref:u,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,f)=>{const v=c.icon,m=c.variant==="danger";return i.jsxs("button",{ref:y=>{s.current[f]=y},role:"menuitem",tabIndex:a===f?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:[i.jsx(v,{size:14}),c.label]},c.label)})})}function ko({sessionId:e,defaultMode:t}){const[n,r]=d.useState([]),[a,o]=d.useState(""),[u,s]=d.useState(t||"quick"),[l,c]=d.useState(!1),f=d.useRef(null),v=d.useRef(null);d.useEffect(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[n]);const m=async()=>{var g;const y=a.trim();if(!y||l)return;const j={role:"user",content:y,timestamp:new Date().toISOString()};r(w=>[...w,j]),o(""),c(!0);try{const w=await Y.chatMessage(e,y,u),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),(g=v.current)==null||g.focus()}};return i.jsxs("div",{className:"flex flex-col h-full",children:[i.jsxs("div",{ref:f,className:"flex-1 overflow-y-auto p-3 space-y-3 terminal-scroll",children:[n.length===0&&i.jsx("div",{className:"text-xs text-muted text-center py-8",children:"Send a message to iterate on your project."}),n.map((y,j)=>i.jsx("div",{className:`flex ${y.role==="user"?"justify-end":"justify-start"}`,children:i.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:[i.jsx("p",{className:"whitespace-pre-wrap",children:y.content}),y.filesChanged&&y.filesChanged.length>0&&i.jsxs("div",{className:"mt-2 pt-2 border-t border-border",children:[i.jsx("span",{className:"text-[10px] text-muted font-semibold uppercase",children:"Files changed:"}),i.jsx("ul",{className:"mt-1 space-y-0.5",children:y.filesChanged.map((g,w)=>i.jsx("li",{className:"text-[10px] font-mono text-muted",children:g},w))})]})]})},j)),l&&i.jsx("div",{className:"flex justify-start",children:i.jsxs("div",{className:"bg-hover text-ink rounded-lg px-3 py-2 text-xs",children:["Building",i.jsx("span",{className:"animate-pulse",children:"..."})]})})]}),i.jsxs("div",{className:"border-t border-border p-2 flex-shrink-0",children:[i.jsx("div",{className:"flex items-center gap-1 mb-2",children:["quick","standard","max"].map(y=>i.jsx("button",{onClick:()=>s(y),className:`text-[10px] font-semibold px-2 py-0.5 rounded-btn transition-colors capitalize ${u===y?"bg-primary text-white":"text-muted hover:text-ink"}`,children:y},y))}),i.jsxs("div",{className:"flex items-center gap-2",children:[i.jsx("input",{ref:v,type:"text",value:a,onChange:y=>o(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}),i.jsx(Fn,{size:"sm",icon:Sr,onClick:m,disabled:l||!a.trim(),"aria-label":"Send message",children:"Send"})]})]})]})}const Xt=[{id:"build",label:"Build Log",icon:Nr},{id:"agents",label:"Agents",icon:Gn},{id:"quality",label:"Quality",icon:kr},{id:"chat",label:"AI Chat",icon:yr}];function Co({status:e}){switch(e){case"pass":return i.jsx(_n,{size:12,className:"text-success"});case"fail":return i.jsx(Ue,{size:12,className:"text-danger"});default:return i.jsx(An,{size:12,className:"text-muted"})}}function No({agents:e}){return!e||e.length===0?i.jsx("div",{className:"p-4 text-xs text-muted",children:"No agents running."}):i.jsx("div",{className:"p-2 space-y-1 overflow-y-auto terminal-scroll",children:e.map(t=>i.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 rounded-btn bg-hover text-xs",children:[i.jsx("span",{className:"font-semibold text-ink truncate",children:t.name}),i.jsx("span",{className:"text-[10px] font-mono text-muted-accessible px-1.5 py-0.5 rounded-btn bg-card",children:t.type}),i.jsx("span",{className:`text-[10px] font-semibold ${t.status==="running"?"text-success":"text-muted"}`,children:t.status}),i.jsx("span",{className:"ml-auto text-[10px] text-muted-accessible font-mono truncate max-w-[200px]",children:t.task})]},t.id))})}function Mo({checklist:e}){return!e||!e.items||e.items.length===0?i.jsx("div",{className:"p-4 text-xs text-muted",children:"No quality gate data available."}):i.jsxs("div",{className:"p-2 space-y-1 overflow-y-auto terminal-scroll",children:[i.jsxs("div",{className:"flex items-center gap-3 px-3 py-1 text-[10px] text-muted-accessible font-semibold uppercase",children:[i.jsx("span",{children:"Gate"}),i.jsxs("span",{className:"ml-auto",children:[e.passed,"/",e.total," passed"]})]}),e.items.map(t=>i.jsxs("div",{className:"flex items-center gap-2 px-3 py-1.5 rounded-btn hover:bg-hover text-xs",children:[i.jsx(Co,{status:t.status}),i.jsx("span",{className:"text-ink",children:t.label}),t.details&&i.jsx("span",{className:"ml-auto text-[10px] text-muted-accessible truncate max-w-[200px]",children:t.details})]},t.id))]})}function Po({logs:e,logsLoading:t,agents:n,checklist:r,sessionId:a,subscribe:o,buildMode:u}){var c;const[s,l]=d.useState("build");return i.jsxs("div",{className:"h-full flex flex-col bg-card",children:[i.jsx("div",{role:"tablist",className:"flex items-center border-b border-border px-2 flex-shrink-0",children:Xt.map(f=>{const v=f.icon,m=s===f.id;return i.jsxs("button",{role:"tab","aria-selected":m,onClick:()=>l(f.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:[i.jsx(v,{size:14}),f.label]},f.id)})}),i.jsxs("div",{role:"tabpanel","aria-label":(c=Xt.find(f=>f.id===s))==null?void 0:c.label,className:"flex-1 min-h-0 overflow-hidden",children:[s==="build"&&i.jsx(In,{logs:e,loading:t,subscribe:o}),s==="agents"&&i.jsx(No,{agents:n}),s==="quality"&&i.jsx(Mo,{checklist:r}),s==="chat"&&i.jsx(ko,{sessionId:a,defaultMode:u})]})]})}function st(e,t,n){var o;if(t==="directory")return n?i.jsx(pr,{size:14}):i.jsx(xr,{size:14});const r=((o=e.split(".").pop())==null?void 0:o.toLowerCase())||"";return{js:i.jsx(ae,{size:14,className:"text-yellow-600"}),ts:i.jsx(ae,{size:14,className:"text-blue-500"}),tsx:i.jsx(ae,{size:14,className:"text-blue-400"}),jsx:i.jsx(ae,{size:14,className:"text-yellow-500"}),py:i.jsx(ae,{size:14,className:"text-green-600"}),html:i.jsx(rr,{size:14,className:"text-orange-500"}),css:i.jsx(cr,{size:14,className:"text-purple-500"}),json:i.jsx(er,{size:14,className:"text-green-500"}),md:i.jsx(sr,{size:14,className:"text-muted"}),go:i.jsx(ae,{size:14,className:"text-cyan-600"}),rs:i.jsx(ae,{size:14,className:"text-orange-600"}),rb:i.jsx(ae,{size:14,className:"text-red-500"}),sh:i.jsx(ae,{size:14,className:"text-green-600"})}[r]||i.jsx(dr,{size:14})}function Eo(e){var a;const t=((a=e.split(".").pop())==null?void 0:a.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 yn(e){for(const t of e)if(t.type==="file"&&t.name.endsWith(".html")||t.children&&yn(t.children))return!0;return!1}function bn(e,t){for(const n of e){if(n.path===t)return n.size;if(n.children){const r=bn(n.children,t);if(r!==void 0)return r}}}function wn(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function jn({nodes:e,selectedPath:t,onSelect:n,onDelete:r,onContextMenu:a,depth:o=0}){const[u,s]=d.useState(()=>{const l=new Set;return o<2&&e.filter(c=>c.type==="directory").forEach(c=>l.add(c.path)),l});return i.jsx("div",{role:o===0?"tree":"group",children:e.map(l=>{const c=l.type==="directory",f=u.has(l.path),v=l.path===t;return i.jsxs("div",{className:"group/file",children:[i.jsxs("button",{role:"treeitem","aria-label":l.name,"aria-selected":v,...c?{"aria-expanded":f}:{},onContextMenu:m=>{m.preventDefault(),a==null||a(m,l.path,l.name,l.type)},onClick:()=>{c?s(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:`${o*14+8}px`},children:[c?i.jsx("span",{className:"w-3 flex items-center justify-center flex-shrink-0 text-muted",children:f?i.jsx(Xn,{size:12}):i.jsx(Yn,{size:12})}):i.jsx("span",{className:"w-3 flex-shrink-0"}),i.jsx("span",{className:`w-5 flex items-center justify-center flex-shrink-0 ${c?"text-primary":""}`,children:st(l.name,l.type,f)}),i.jsxs("span",{className:"truncate",children:[l.name,c?"/":""]}),!c&&l.size!=null&&l.size>0&&i.jsx("span",{className:"text-[10px] text-muted/40 ml-auto flex-shrink-0",children:wn(l.size)}),!c&&r&&i.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/30 hover:text-danger ml-1 flex-shrink-0 opacity-0 group-hover/file:opacity-100 transition-opacity cursor-pointer",title:"Delete file",children:i.jsx(Ue,{size:12})})]}),c&&f&&l.children&&i.jsx(jn,{nodes:l.children,selectedPath:t,onSelect:n,onDelete:r,onContextMenu:a,depth:o+1})]},l.path)})})}function Sn(e,t=""){const n=[];for(const r of e)r.type==="file"&&n.push({path:r.path,name:r.name}),r.children&&n.push(...Sn(r.children,r.path+"/"));return n}function Lo({session:e,onClose:t}){var wt;const[n,r]=d.useState(null),[a,o]=d.useState(""),[u,s]=d.useState(null),[l,c]=d.useState(null),[f,v]=d.useState(!1),[m,y]=d.useState(!1),[j,g]=d.useState(!1),[w,b]=d.useState(!1),[h,k]=d.useState(e),S=d.useRef(null),[x,N]=d.useState([]),[C,D]=d.useState(!1),[_,L]=d.useState(""),M=d.useRef(null),E=d.useRef(null),[T,I]=d.useState(0),[z,O]=d.useState(null),[q,J]=d.useState("standard"),[ee,W]=d.useState(null),[R,$]=d.useState(!1),V=yn(h.files),te=`/api/sessions/${encodeURIComponent(h.id)}/preview/index.html`,[K,Z]=d.useState([te]),[X,Ne]=d.useState(0),ue=K[X]||te,[gt,xt]=d.useState(ue),ve=d.useCallback(async()=>{try{const p=await Y.getSessionDetail(h.id);k(p)}catch{}},[h.id]),zn=d.useCallback((p,P,A,B)=>{p.preventDefault(),O({x:p.clientX,y:p.clientY,path:P,name:A,type:B})},[]),kn=d.useCallback(()=>{X>0&&(Ne(p=>p-1),I(p=>p+1))},[X]),Cn=d.useCallback(()=>{X<K.length-1&&(Ne(p=>p+1),I(p=>p+1))},[X,K.length]),Nn=d.useCallback(p=>{Z(P=>[...P.slice(0,X+1),p]),Ne(P=>P+1),I(P=>P+1)},[X]);d.useEffect(()=>{xt(ue)},[ue]);const Fe=d.useCallback(async()=>{$(!0);try{const p=await Y.reviewProject(h.id);W(p.output)}catch(p){W(`Error: ${p instanceof Error?p.message:"Unknown"}`)}finally{$(!1)}},[h.id]),Ae=d.useCallback(async()=>{$(!0);try{const p=await Y.testProject(h.id);W(p.output)}catch(p){W(`Error: ${p instanceof Error?p.message:"Unknown"}`)}finally{$(!1)}},[h.id]),Xe=d.useCallback(async()=>{$(!0);try{const p=await Y.explainProject(h.id);W(p.output)}catch(p){W(`Error: ${p instanceof Error?p.message:"Unknown"}`)}finally{$(!1)}},[h.id]),Qe=d.useCallback(async(p,P)=>{if(window.confirm(`Delete "${P}"?`))try{await Y.deleteSessionFile(h.id,p),n===p&&(r(null),o(""),s(null),c(null),g(!1)),await ve()}catch(B){const de=B instanceof Error?B.message:"Unknown error";window.alert(`Delete failed: ${de}`)}},[h.id,n,ve]),Mn=d.useCallback(p=>p.type==="file"?[{label:"Review",icon:Je,onClick:()=>{Fe()}},{label:"Generate Tests",icon:Ze,onClick:()=>{Ae()}},{label:"Explain",icon:Ct,onClick:()=>{Xe()}},{label:"Delete",icon:Er,onClick:()=>{Qe(p.path,p.name)},variant:"danger"}]:[{label:"Review Project",icon:Je,onClick:()=>{Fe()}},{label:"Run Tests",icon:Ze,onClick:()=>{Ae()}}],[Fe,Ae,Xe,Qe]),Me=d.useCallback(async(p,P)=>{j&&n&&l!==null&&N(B=>B.map(de=>de.path===n?{...de,content:l,modified:!0}:de));const A=x.find(B=>B.path===p);if(A){r(p),o(P),s(A.content),c(A.content),g(A.modified);return}r(p),o(P),v(!0),g(!1);try{const B=h.id?await Y.getSessionFileContent(h.id,p):await Y.getFileContent(p);s(B.content),c(B.content),N(de=>[...de,{path:p,name:P,content:B.content,modified:!1}])}catch{s("[Error loading file]"),c("[Error loading file]")}finally{v(!1)}},[h.id,j,n,l,x]),Ye=d.useCallback(async()=>{var p;if(!(!n||l===null||!h.id)){b(!0);try{await Y.saveSessionFile(h.id,n,l),s(l),g(!1),N(A=>A.map(B=>B.path===n?{...B,content:l,modified:!1}:B));const P=((p=n.split(".").pop())==null?void 0:p.toLowerCase())||"";["html","css","js","jsx","ts","tsx"].includes(P)&&I(A=>A+1)}catch(P){const A=P instanceof Error?P.message:"Unknown error";window.alert(`Save failed: ${A}`)}finally{b(!1)}}},[n,l,h.id]),vt=d.useCallback(p=>{const P=x.find(A=>A.path===p);if(!(P!=null&&P.modified&&!window.confirm("Unsaved changes. Close anyway?"))&&(N(A=>A.filter(B=>B.path!==p)),n===p)){const A=x.filter(B=>B.path!==p);if(A.length>0){const B=A[A.length-1];r(B.path),o(B.name),s(B.content),c(B.content),g(B.modified)}else r(null),o(""),s(null),c(null),g(!1)}},[x,n]);d.useEffect(()=>{const p=P=>{(P.metaKey||P.ctrlKey)&&P.key==="s"&&(P.preventDefault(),j&&n&&Ye()),(P.metaKey||P.ctrlKey)&&P.key==="p"&&(P.preventDefault(),D(A=>!A),L("")),P.key==="Escape"&&C&&D(!1)};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[j,n,Ye,C]),d.useEffect(()=>{C&&M.current&&M.current.focus()},[C]);const yt=Sn(h.files),Pe=_?yt.filter(p=>p.path.toLowerCase().includes(_.toLowerCase())):yt;d.useEffect(()=>{const p=h.files.find(P=>P.name==="index.html"&&P.type==="file");p&&(Me(p.path,p.name),y(!0))},[]);const Pn=d.useCallback(p=>{p!==void 0&&(c(p),g(p!==u))},[u]),En=d.useCallback(p=>{S.current=p},[]),Ln=d.useCallback(async()=>{const p=window.prompt("New file name (e.g. src/utils.ts):");if(!(!p||!p.trim()))try{await Y.createSessionFile(h.id,p.trim()),await ve()}catch(P){const A=P instanceof Error?P.message:"Unknown error";window.alert(`Create file failed: ${A}`)}},[h.id,ve]),Rn=d.useCallback(async()=>{const p=window.prompt("New folder name (e.g. src/components):");if(!(!p||!p.trim()))try{await Y.createSessionDirectory(h.id,p.trim()),await ve()}catch(P){const A=P instanceof Error?P.message:"Unknown error";window.alert(`Create folder failed: ${A}`)}},[h.id,ve]),bt=n?bn(h.files,n):void 0,On=((wt=a.split(".").pop())==null?void 0:wt.toUpperCase())||"";return i.jsxs("div",{className:"flex flex-col h-full relative",children:[i.jsxs("div",{className:"bg-card px-3 py-2 flex items-center gap-3 flex-shrink-0 border-b border-border",children:[i.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"}),i.jsxs("div",{className:"flex-1 min-w-0",children:[i.jsx("h2",{className:"text-sm font-bold text-ink truncate",children:h.id}),i.jsx("p",{className:"text-[10px] font-mono text-muted-accessible truncate",children:h.path})]}),i.jsx("span",{className:`text-[10px] 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}),i.jsx("div",{className:"flex rounded-btn border border-border overflow-hidden",children:["quick","standard","max"].map(p=>i.jsx("button",{onClick:()=>J(p),className:`px-3 py-1 text-xs font-medium transition-colors capitalize ${q===p?"bg-primary text-white":"text-secondary hover:bg-hover"}`,children:p},p))}),i.jsx(ie,{icon:Je,label:"Review project",size:"sm",onClick:Fe,disabled:R}),i.jsx(ie,{icon:Ze,label:"Run tests",size:"sm",onClick:Ae,disabled:R}),i.jsx(ie,{icon:Ct,label:"Explain project",size:"sm",onClick:Xe,disabled:R}),V&&i.jsx("button",{onClick:()=>y(!m),className:`text-xs font-medium px-3 py-1.5 rounded-btn border transition-colors ${m?"border-primary/40 bg-primary/10 text-primary":"border-border text-muted hover:text-ink hover:bg-hover"}`,children:m?"Hide Preview":"Preview"})]}),i.jsx("div",{className:"flex-1 min-h-0",children:i.jsxs(it,{orientation:"vertical",children:[i.jsx(be,{defaultSize:70,minSize:40,children:i.jsxs(it,{orientation:"horizontal",className:"h-full",children:[i.jsx(be,{defaultSize:20,minSize:15,children:i.jsxs("div",{className:"h-full flex flex-col border-r border-border bg-card",children:[i.jsxs("div",{className:"px-3 py-2 border-b border-border flex items-center gap-2",children:[i.jsx("span",{className:"text-[10px] text-muted-accessible uppercase tracking-wider font-semibold flex-1",children:"Files"}),i.jsxs("button",{onClick:Ln,title:"New File",className:"flex items-center gap-1 text-[10px] text-muted-accessible hover:text-primary px-1.5 py-0.5 rounded border border-border hover:border-primary/30 transition-colors",children:[i.jsx(or,{size:12})," New"]}),i.jsxs("button",{onClick:Rn,title:"New Folder",className:"flex items-center gap-1 text-[10px] text-muted-accessible hover:text-primary px-1.5 py-0.5 rounded border border-border hover:border-primary/30 transition-colors",children:[i.jsx(mr,{size:12})," New"]})]}),i.jsx("div",{className:"flex-1 overflow-y-auto terminal-scroll",children:h.files.length>0?i.jsx(jn,{nodes:h.files,selectedPath:n,onSelect:Me,onDelete:Qe,onContextMenu:zn}):i.jsx("div",{className:"p-4 text-xs text-muted",children:"No files"})})]})}),i.jsx(We,{className:"w-1 bg-border hover:bg-primary/30 transition-colors cursor-col-resize"}),i.jsx(be,{defaultSize:m?50:80,minSize:25,children:i.jsxs("div",{className:"h-full flex flex-col min-w-0",children:[x.length>0&&i.jsx("div",{className:"flex items-center border-b border-border bg-hover overflow-x-auto flex-shrink-0",children:x.map(p=>i.jsxs("button",{onClick:()=>Me(p.path,p.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 ${p.path===n?"bg-card text-ink":"text-muted hover:text-ink hover:bg-card"}`,children:[i.jsx("span",{className:"w-4 flex items-center justify-center",children:st(p.name,"file")}),p.name,p.modified&&i.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-primary"}),i.jsx("span",{role:"button",tabIndex:-1,onClick:P=>{P.stopPropagation(),vt(p.path)},onKeyDown:P=>{P.key==="Enter"&&(P.stopPropagation(),vt(p.path))},className:"text-muted/30 hover:text-danger ml-1 cursor-pointer",children:i.jsx(Ue,{size:12})})]},p.path))}),n?i.jsxs(i.Fragment,{children:[i.jsxs("div",{className:"px-4 py-1.5 border-b border-border flex items-center gap-2 flex-shrink-0 bg-hover",children:[i.jsx("span",{className:"text-xs font-mono text-ink/60 truncate",children:n}),w&&i.jsx("span",{className:"text-[10px] text-primary animate-pulse flex-shrink-0",children:"Saving..."}),i.jsx("span",{className:"ml-auto text-[10px] text-muted/50 font-mono",children:bt!=null?wn(bt):""}),i.jsx("span",{className:"text-[10px] text-muted/40 font-mono uppercase",children:On}),j&&i.jsx("button",{onClick:Ye,className:"text-[10px] 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"})]}),i.jsx("div",{className:"flex-1 min-h-0",children:f?i.jsx("div",{className:"text-muted text-xs animate-pulse p-4",children:"Loading..."}):i.jsx(_a,{value:l??"",language:Eo(a),theme:"vs",onChange:Pn,onMount:En,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}}})})]}):i.jsx("div",{className:"flex-1 flex items-center justify-center text-muted text-sm",children:"Select a file to view its contents"})]})}),m&&i.jsxs(i.Fragment,{children:[i.jsx(We,{className:"w-1 bg-border hover:bg-primary/30 transition-colors cursor-col-resize"}),i.jsx(be,{defaultSize:30,minSize:20,collapsible:!0,children:i.jsxs("div",{className:"h-full flex flex-col border-l border-border",children:[i.jsxs("div",{className:"px-3 py-1.5 border-b border-border flex items-center gap-2 bg-hover",children:[i.jsx(ie,{icon:Vn,label:"Back",size:"sm",onClick:kn,disabled:X<=0}),i.jsx(ie,{icon:Wn,label:"Forward",size:"sm",onClick:Cn,disabled:X>=K.length-1}),i.jsx(ie,{icon:wr,label:"Refresh",size:"sm",onClick:()=>I(p=>p+1)}),i.jsx("input",{value:gt,onChange:p=>xt(p.target.value),onKeyDown:p=>{p.key==="Enter"&&Nn(gt)},className:"flex-1 px-3 py-1 text-xs font-mono bg-card border border-border rounded-btn"}),i.jsx(ie,{icon:Bn,label:"Open in new tab",size:"sm",onClick:()=>window.open(ue,"_blank")})]}),i.jsx("div",{className:"flex-1 bg-white",children:i.jsx("iframe",{ref:E,src:ue,title:"Project Preview",className:"w-full h-full border-0",sandbox:"allow-scripts allow-same-origin allow-forms allow-popups"},T)})]})})]})]})}),i.jsx(We,{className:"h-1 bg-border hover:bg-primary/30 cursor-row-resize"}),i.jsx(be,{defaultSize:30,minSize:15,collapsible:!0,children:i.jsx(Po,{logs:null,logsLoading:!1,agents:null,checklist:null,sessionId:e.id,buildMode:q})})]})}),ee&&i.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:[i.jsxs("div",{className:"flex items-center justify-between mb-2",children:[i.jsx("span",{className:"text-xs font-semibold text-ink",children:"Action Output"}),i.jsx(ie,{icon:Ue,label:"Close",size:"sm",onClick:()=>W(null)})]}),i.jsx("pre",{className:"text-xs font-mono text-ink/80 whitespace-pre-wrap",children:ee})]}),z&&i.jsx(zo,{x:z.x,y:z.y,items:Mn(z),onClose:()=>O(null)}),C&&i.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:i.jsxs("div",{className:"bg-card rounded-card shadow-2xl border border-border w-full max-w-lg",onClick:p=>p.stopPropagation(),children:[i.jsx("input",{ref:M,type:"text",value:_,onChange:p=>L(p.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:p=>{p.key==="Enter"&&Pe.length>0&&(Me(Pe[0].path,Pe[0].name),D(!1)),p.key==="Escape"&&D(!1)}}),i.jsxs("div",{className:"max-h-64 overflow-y-auto",children:[Pe.slice(0,20).map(p=>i.jsxs("button",{onClick:()=>{Me(p.path,p.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:[i.jsx("span",{className:"w-5 flex items-center justify-center",children:st(p.name,"file")}),i.jsx("span",{className:"text-ink",children:p.name}),i.jsx("span",{className:"text-muted/40 ml-auto truncate text-[10px]",children:p.path})]},p.path)),Pe.length===0&&i.jsx("div",{className:"px-4 py-3 text-xs text-muted",children:"No matching files"})]})]})})]})}function Fo(){const{sessionId:e}=Dn(),t=$n(),[n,r]=d.useState(null),[a,o]=d.useState(!0),[u,s]=d.useState(null);return d.useEffect(()=>{e&&(o(!0),s(null),Y.getSessionDetail(e).then(l=>{r(l),o(!1)}).catch(l=>{s(l instanceof Error?l.message:"Failed to load session"),o(!1)}))},[e]),a?i.jsx("div",{className:"h-screen bg-background flex items-center justify-center",children:i.jsxs("div",{className:"text-center",children:[i.jsx("div",{className:"text-muted animate-pulse text-sm",children:"Loading project..."}),i.jsx("div",{className:"text-[10px] font-mono text-muted/50 mt-2",children:e})]})}):u||!n?i.jsx("div",{className:"h-screen bg-background flex items-center justify-center",children:i.jsxs("div",{className:"text-center",children:[i.jsx("p",{className:"text-danger text-sm font-medium",children:"Project not found"}),i.jsx("p",{className:"text-xs text-muted mt-1",children:u||`Session ${e} does not exist`}),i.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"})]})}):i.jsx("div",{className:"h-screen bg-background flex flex-col",children:i.jsx("div",{className:"flex-1 min-h-0",children:i.jsx(Tn,{name:"ProjectWorkspace",children:i.jsx(Lo,{session:n,onClose:()=>t("/")})})})})}export{Fo 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-ABzvlaPu.js";import{B as d}from"./Button-DjxnqObR.js";import{C as g}from"./Card-Ct8CoaX9.js";import{u as y,B as b}from"./Badge-Cv068X_w.js";import"./clock-BZGjjvpN.js";/**
1
+ import{c as m,u as f,r as l,a as j,j as e}from"./index-DwD8nlZM.js";import{B as d}from"./Button-DL_d8JtL.js";import{C as g}from"./Card-DCaMzk1D.js";import{u as y,B as b}from"./Badge-hndykWrx.js";import"./clock-GSX6RVry.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-ABzvlaPu.js";import{C as l}from"./Card-Ct8CoaX9.js";import{E as c}from"./external-link-DMhX_uRl.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
+ import{r as t,a,j as e}from"./index-DwD8nlZM.js";import{C as l}from"./Card-DCaMzk1D.js";import{E as c}from"./external-link-gjVZ6bJU.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-ABzvlaPu.js";import{C as p}from"./Card-Ct8CoaX9.js";import{u as d,B as h}from"./Badge-Cv068X_w.js";import"./clock-BZGjjvpN.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};
1
+ import{u as c,r,a as x,j as t}from"./index-DwD8nlZM.js";import{C as p}from"./Card-DCaMzk1D.js";import{u as d,B as h}from"./Badge-hndykWrx.js";import"./clock-GSX6RVry.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};
@@ -1,4 +1,4 @@
1
- import{c as f,r as c,j as e}from"./index-ABzvlaPu.js";/**
1
+ import{c as f,r as c,j as e}from"./index-DwD8nlZM.js";/**
2
2
  * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.