fifony 0.1.16 → 0.1.17

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.
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,h as n}from"./vendor-BoGBoEwT.js";import{t as r}from"./createLucideIcon-DtZs0TX0.js";import{i}from"./index-BRWIoM5k.js";var a=r(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),o=e(t(),1),s=n(),c=[{key:`n`,description:`Open New Issue drawer`},{key:`k`,description:`Navigate to Kanban`},{key:`i`,description:`Navigate to Issues`},{key:`a`,description:`Navigate to Agents`},{key:`t`,description:`Navigate to Analytics`},{key:`s`,description:`Navigate to Settings`},{key:`1–6`,description:`Jump to kanban column by index`},{key:`Esc`,description:`Close any open drawer / modal`},{key:`?`,description:`Show this help`}];function l({open:e,onClose:t}){let n=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let t=n.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),(0,s.jsxs)(`dialog`,{ref:n,className:`modal modal-bottom sm:modal-middle`,onClose:t,children:[(0,s.jsxs)(`div`,{className:`modal-box max-w-md`,children:[(0,s.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,s.jsxs)(`h3`,{className:`font-bold text-lg flex items-center gap-2`,children:[(0,s.jsx)(a,{className:`size-5 opacity-60`}),`Keyboard Shortcuts`]}),(0,s.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-circle`,onClick:t,children:(0,s.jsx)(i,{className:`size-4`})})]}),(0,s.jsx)(`div`,{className:`overflow-x-auto`,children:(0,s.jsxs)(`table`,{className:`table table-sm`,children:[(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{children:`Key`}),(0,s.jsx)(`th`,{children:`Action`})]})}),(0,s.jsx)(`tbody`,{children:c.map(e=>(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`td`,{children:(0,s.jsx)(`kbd`,{className:`kbd kbd-sm`,children:e.key})}),(0,s.jsx)(`td`,{children:e.description})]},e.key))})]})}),(0,s.jsx)(`div`,{className:`modal-action`,children:(0,s.jsx)(`button`,{className:`btn btn-sm`,onClick:t,children:`Close`})})]}),(0,s.jsx)(`form`,{method:`dialog`,className:`modal-backdrop`,children:(0,s.jsx)(`button`,{children:`close`})})]})}export{l as default};
1
+ import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,h as n}from"./vendor-BoGBoEwT.js";import{t as r}from"./createLucideIcon-DtZs0TX0.js";import{i}from"./index-CRG9kNAx.js";var a=r(`keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),o=e(t(),1),s=n(),c=[{key:`n`,description:`Open New Issue drawer`},{key:`k`,description:`Navigate to Kanban`},{key:`i`,description:`Navigate to Issues`},{key:`a`,description:`Navigate to Agents`},{key:`t`,description:`Navigate to Analytics`},{key:`s`,description:`Navigate to Settings`},{key:`1–6`,description:`Jump to kanban column by index`},{key:`Esc`,description:`Close any open drawer / modal`},{key:`?`,description:`Show this help`}];function l({open:e,onClose:t}){let n=(0,o.useRef)(null);return(0,o.useEffect)(()=>{let t=n.current;t&&(e&&!t.open?t.showModal():!e&&t.open&&t.close())},[e]),(0,s.jsxs)(`dialog`,{ref:n,className:`modal modal-bottom sm:modal-middle`,onClose:t,children:[(0,s.jsxs)(`div`,{className:`modal-box max-w-md`,children:[(0,s.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,s.jsxs)(`h3`,{className:`font-bold text-lg flex items-center gap-2`,children:[(0,s.jsx)(a,{className:`size-5 opacity-60`}),`Keyboard Shortcuts`]}),(0,s.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-circle`,onClick:t,children:(0,s.jsx)(i,{className:`size-4`})})]}),(0,s.jsx)(`div`,{className:`overflow-x-auto`,children:(0,s.jsxs)(`table`,{className:`table table-sm`,children:[(0,s.jsx)(`thead`,{children:(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`th`,{children:`Key`}),(0,s.jsx)(`th`,{children:`Action`})]})}),(0,s.jsx)(`tbody`,{children:c.map(e=>(0,s.jsxs)(`tr`,{children:[(0,s.jsx)(`td`,{children:(0,s.jsx)(`kbd`,{className:`kbd kbd-sm`,children:e.key})}),(0,s.jsx)(`td`,{children:e.description})]},e.key))})]})}),(0,s.jsx)(`div`,{className:`modal-action`,children:(0,s.jsx)(`button`,{className:`btn btn-sm`,onClick:t,children:`Close`})})]}),(0,s.jsx)(`form`,{method:`dialog`,className:`modal-backdrop`,children:(0,s.jsx)(`button`,{children:`close`})})]})}export{l as default};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,h as n,m as r}from"./vendor-BoGBoEwT.js";import{c as i,l as a,n as o,t as s,u as c,w as l,y as u}from"./zap-BwZ-sPG7.js";import{t as d}from"./createLucideIcon-DtZs0TX0.js";import{S as f,a as p,b as m,c as h,d as g,g as _,h as v,l as y,m as b,n as x,p as S,r as C,s as w,t as ee,u as T,x as E,y as D}from"./index-BRWIoM5k.js";var O=d(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),k=d(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),te=d(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),A=d(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),j=d(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),M=d(`folder-search`,[[`path`,{d:`M10.7 20H4a2 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.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),N=d(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),P=d(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),F=d(`shield-check`,[[`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`}]]),I=e(t(),1),L=n(),R=[`Welcome`,`Providers`,`Scan Project`,`Domains`,`Agents & Skills`,`Effort`,`Workers & Theme`,`Launch`];function ne(e){return e?[...R.slice(0,3),`Discover Issues`,...R.slice(3)]:R}function re(e){return e?9:8}var z=[{value:`low`,label:`Low`,icon:s,description:`Quick and light -- fast responses, less thorough`,color:`text-info`},{value:`medium`,label:`Medium`,icon:b,description:`Balanced -- good mix of speed and quality`,color:`text-success`},{value:`high`,label:`High`,icon:k,description:`Thorough -- deeper analysis, takes more time`,color:`text-warning`},{value:`extra-high`,label:`Extra High`,icon:j,description:`Maximum depth -- most thorough, slowest`,color:`text-error`}],B={codex:z,claude:z.filter(e=>e.value!==`extra-high`)};function V(e,t){return B[t?.[e]||`claude`]||z}var H=[{label:`Technical`,domains:[{value:`frontend`,label:`Frontend`,emoji:`🎨`},{value:`backend`,label:`Backend`,emoji:`⚙️`},{value:`mobile`,label:`Mobile`,emoji:`📱`},{value:`devops`,label:`DevOps / Infra`,emoji:`🚀`},{value:`database`,label:`Database`,emoji:`🗄️`},{value:`ai-ml`,label:`AI / ML`,emoji:`🤖`},{value:`security`,label:`Security`,emoji:`🔒`},{value:`testing`,label:`Testing / QA`,emoji:`🧪`},{value:`embedded`,label:`Embedded / IoT`,emoji:`🔌`}]},{label:`Industry`,domains:[{value:`games`,label:`Games`,emoji:`🎮`},{value:`ecommerce`,label:`E-commerce`,emoji:`🛒`},{value:`saas`,label:`SaaS`,emoji:`☁️`},{value:`fintech`,label:`Fintech`,emoji:`💰`},{value:`healthcare`,label:`Healthcare`,emoji:`🏥`},{value:`education`,label:`Education`,emoji:`📚`},{value:`blockchain`,label:`Blockchain`,emoji:`⛓️`},{value:`spatial-computing`,label:`Spatial / XR`,emoji:`🥽`}]},{label:`Role`,domains:[{value:`design`,label:`Design / UX`,emoji:`✏️`},{value:`product`,label:`Product`,emoji:`📋`},{value:`marketing`,label:`Marketing`,emoji:`📢`},{value:`data-engineering`,label:`Data Engineering`,emoji:`📊`}]}],ie=[{value:`auto`,label:`Auto`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`black`,label:`Black`},{value:`cupcake`,label:`Cupcake`},{value:`night`,label:`Night`},{value:`sunset`,label:`Sunset`}];async function U(e,t,n=`ui`){return l.post(`/settings/${encodeURIComponent(e)}`,{value:t,scope:n,source:`user`})}function W(e,t=`medium`){return z.some(t=>t.value===e)?e:t}function ae(e){return!e||typeof e!=`object`||Array.isArray(e)?{planner:`medium`,executor:`medium`,reviewer:`medium`}:{planner:W(e.planner??e.default,`medium`),executor:W(e.executor??e.default,`medium`),reviewer:W(e.reviewer??e.default,`medium`)}}function G(e,t,n={}){return{plan:{provider:e.planner||`claude`,model:n.plan||e.planner||`claude`,effort:t.planner||`medium`},execute:{provider:e.executor||`codex`,model:n.execute||e.executor||`codex`,effort:t.executor||`medium`},review:{provider:e.reviewer||`claude`,model:n.review||e.reviewer||`claude`,effort:t.reviewer||`medium`}}}var K=[`Pipeline`,`Scan`,`Domains`,`Agents`,`Effort`,`Workers & Theme`,`Launch`];function q(e){return e?[...K.slice(0,2),`Discover`,...K.slice(2)]:K}function oe({current:e,wantsDiscovery:t}){let n=q(t),r=e-1;return(0,L.jsx)(`ul`,{className:`steps steps-horizontal w-full max-w-2xl text-xs`,children:n.map((e,t)=>{let n=t<r,i=t===r;return(0,L.jsx)(`li`,{"data-content":n?`✓`:t+1,className:`step ${n||i?`step-primary`:``}`,style:{transition:`color 0.3s ease`},children:e},e)})})}function se({direction:e,stepKey:t,center:n,children:r}){return(0,L.jsx)(`div`,{className:`${e===`forward`?`animate-slide-in-right`:`animate-slide-in-left`} w-full max-w-2xl mx-auto ${n?`my-auto`:``}`,children:r},t)}function ce(){let[e,t]=(0,I.useState)(null),[n,r]=(0,I.useState)(!1),[i,a]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{l.get(`/gitignore/status`).then(t).catch(()=>t({exists:!1,hasFifony:!1}))},[]),e===null||e.hasFifony||i?i?(0,L.jsxs)(`div`,{className:`alert alert-success text-sm max-w-md animate-fade-in`,children:[(0,L.jsx)(F,{className:`size-4 shrink-0`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`code`,{children:`.fifony/`}),` added to `,(0,L.jsx)(`code`,{children:`.gitignore`})]})]}):null:(0,L.jsxs)(`div`,{className:`alert alert-warning text-sm max-w-md`,children:[(0,L.jsx)(S,{className:`size-4 shrink-0`}),(0,L.jsxs)(`div`,{className:`flex-1`,children:[(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`code`,{children:`.fifony/`}),` is not in your `,(0,L.jsx)(`code`,{children:`.gitignore`}),`.`]}),(0,L.jsx)(`span`,{className:`text-base-content/50 block text-xs mt-0.5`,children:`Fifony stores local state there — it shouldn't be committed.`})]}),(0,L.jsx)(`button`,{className:`btn btn-xs btn-warning`,onClick:async()=>{r(!0);try{await l.post(`/gitignore/add`),a(!0)}catch{}finally{r(!1)}},disabled:n,children:n?(0,L.jsx)(g,{className:`size-3 animate-spin`}):`Add it`})]})}function le({workspacePath:e,onGetStarted:t}){return(0,L.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-6 stagger-children py-4`,children:[(0,L.jsx)(`div`,{className:`text-6xl sm:text-7xl animate-bounce-in`,children:(0,L.jsx)(T,{className:`size-16 sm:size-20 text-primary mx-auto`})}),(0,L.jsxs)(`h1`,{className:`text-3xl sm:text-4xl font-bold tracking-tight`,children:[`Welcome to `,(0,L.jsx)(`span`,{className:`text-primary`,children:`Fifony`})]}),(0,L.jsx)(`p`,{className:`text-base-content/60 text-lg max-w-md`,children:`Let's set up your AI orchestration workspace in just a few steps.`}),e&&(0,L.jsxs)(`div`,{className:`badge badge-lg badge-soft badge-primary gap-2`,children:[(0,L.jsx)(w,{className:`size-3.5`}),e]}),(0,L.jsxs)(`button`,{className:`btn btn-primary btn-lg gap-2 mt-2`,onClick:t,children:[`Get Started `,(0,L.jsx)(A,{className:`size-5`})]})]})}var ue=[{role:`planner`,label:`Planner`,description:`Scopes the issue, breaks it into steps, and decides the approach`,icon:k,color:`text-info`},{role:`executor`,label:`Executor`,description:`Implements the plan — writes code, edits files, runs commands`,icon:s,color:`text-primary`},{role:`reviewer`,label:`Reviewer`,description:`Validates the result — checks correctness, scope, and quality`,icon:h,color:`text-secondary`}];function de({providers:e,providersLoading:t,pipeline:n,setPipeline:r}){let i=Array.isArray(e)?e:[],a=i.filter(e=>e.available!==!1);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(P,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Agent Pipeline`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose which CLI runs each stage of the pipeline`})]}),t?(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8`,children:[(0,L.jsx)(g,{className:`size-8 text-primary animate-spin`}),(0,L.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Detecting available CLIs...`})]}):a.length===0?(0,L.jsx)(`div`,{className:`alert alert-warning text-sm`,children:`No providers detected. Make sure claude or codex CLI is installed.`}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:i.map(e=>{let t=e.id||e.name||e,n=e.available!==!1;return(0,L.jsxs)(`span`,{className:`badge badge-lg gap-2 ${n?`badge-success`:`badge-ghost opacity-50`}`,children:[n?(0,L.jsx)(m,{className:`size-3.5`}):(0,L.jsx)(D,{className:`size-3.5`}),t,e.path&&(0,L.jsx)(`span`,{className:`font-mono text-[10px] opacity-60 hidden sm:inline`,children:e.path})]},t)})}),(0,L.jsx)(`div`,{className:`flex flex-col items-center gap-2`,children:ue.map((e,t)=>{let i=e.icon,o=n[e.role]||a[0]?.name||``;return(0,L.jsxs)(`div`,{className:`w-full`,children:[t>0&&(0,L.jsx)(`div`,{className:`flex justify-center py-1`,children:(0,L.jsx)(A,{className:`size-5 rotate-90 opacity-30`})}),(0,L.jsx)(`div`,{className:`card bg-base-200`,children:(0,L.jsxs)(`div`,{className:`card-body p-4 flex-row items-center gap-4`,children:[(0,L.jsx)(`div`,{className:`size-10 rounded-full flex items-center justify-center bg-base-300 ${e.color}`,children:(0,L.jsx)(i,{className:`size-5`})}),(0,L.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-semibold`,children:e.label}),(0,L.jsx)(`p`,{className:`text-xs text-base-content/50`,children:e.description})]}),(0,L.jsx)(`select`,{className:`select select-bordered select-sm w-32`,value:o,onChange:t=>r(n=>({...n,[e.role]:t.target.value})),children:a.map(e=>{let t=e.id||e.name||e;return(0,L.jsx)(`option`,{value:t,children:t},t)})})]})})]},e.role)})}),(0,L.jsx)(`p`,{className:`text-xs text-base-content/40 text-center max-w-md mx-auto`,children:`Each stage can use a different CLI. The pipeline flows top to bottom: plan, then execute, then review.`})]})]})}function fe({scanResult:e,setScanResult:t,projectDescription:n,setProjectDescription:r,analysisResult:i,setAnalysisResult:a,selectedProvider:o,analyzing:s,setAnalyzing:c}){let[u,d]=(0,I.useState)(!1),[p,h]=(0,I.useState)(null),[_,y]=(0,I.useState)(null),b=(0,I.useRef)(!1);(0,I.useEffect)(()=>{b.current||e||(b.current=!0,d(!0),h(null),l.get(`/scan/project`).then(e=>{if(t(e),!n){let t=e?.packageDescription||e?.packageInfo?.description||e?.readmeExcerpt||``;t&&r(t)}o&&!i&&(c(!0),l.post(`/scan/analyze`,{provider:o}).then(e=>{a(e),e.description&&r(e.description)}).catch(()=>{}).finally(()=>c(!1)))}).catch(e=>h(e.message||`Failed to scan project`)).finally(()=>d(!1)))},[]);let x=(0,I.useCallback)(async()=>{c(!0),y(null);try{let e=await l.post(`/scan/analyze`,{provider:o||`claude`});a(e),e.description&&r(e.description)}catch(e){y(e.message||`Analysis failed`)}finally{c(!1)}},[o,c,a,r]),S={claudeMd:`CLAUDE.md`,claudeDir:`.claude/`,codexDir:`.codex/`,readmeMd:`README.md`,packageJson:`package.json`,cargoToml:`Cargo.toml`,pyprojectToml:`pyproject.toml`,goMod:`go.mod`,buildGradle:`build.gradle`,gemfile:`Gemfile`,dockerfile:`Dockerfile`,workflowMd:`WORKFLOW.md`,agentsMd:`AGENTS.md`,claudeAgentsDir:`.claude/agents/`,claudeSkillsDir:`.claude/skills/`,codexAgentsDir:`.codex/agents/`,codexSkillsDir:`.codex/skills/`},C=e?.files||{},ee=Object.entries(C).map(([e,t])=>({path:S[e]||e,exists:!!t})),T=(e?.existingAgents||[]).map(e=>typeof e==`string`?{name:e}:e),E=(e?.existingSkills||[]).map(e=>typeof e==`string`?{name:e}:e),k=i?.stack||[];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(M,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Scan Project`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`We'll analyze your workspace to suggest the best setup`})]}),u&&(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6`,children:[(0,L.jsx)(g,{className:`size-8 text-primary animate-spin`}),(0,L.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Scanning project files...`})]}),p&&(0,L.jsx)(`div`,{className:`alert alert-warning text-sm`,children:p}),e&&!u&&(0,L.jsx)(`div`,{className:`card bg-base-200`,children:(0,L.jsxs)(`div`,{className:`card-body p-4 gap-3`,children:[(0,L.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,L.jsx)(v,{className:`size-4 opacity-50`}),`Project Files`]}),(0,L.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-1.5`,children:ee.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[e.exists?(0,L.jsx)(m,{className:`size-4 text-success shrink-0`}):(0,L.jsx)(D,{className:`size-4 text-base-content/30 shrink-0`}),(0,L.jsx)(`span`,{className:`font-mono text-xs truncate ${e.exists?``:`text-base-content/40`}`,children:e.path})]},e.path))}),(T.length>0||E.length>0)&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[T.length>0&&(0,L.jsxs)(`span`,{className:`badge badge-sm badge-info gap-1`,children:[(0,L.jsx)(f,{className:`size-3`}),T.length,` agent`,T.length===1?``:`s`,` found`]}),E.length>0&&(0,L.jsxs)(`span`,{className:`badge badge-sm badge-secondary gap-1`,children:[(0,L.jsx)(O,{className:`size-3`}),E.length,` skill`,E.length===1?``:`s`,` found`]})]})]})]})}),!s&&!i&&(0,L.jsxs)(`button`,{className:`btn btn-primary btn-lg gap-2 mx-auto`,onClick:x,disabled:u,children:[(0,L.jsx)(w,{className:`size-5`}),`Analyze with AI`]}),s&&(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-4`,children:[(0,L.jsx)(g,{className:`size-8 text-primary animate-spin`}),(0,L.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`AI is analyzing your project...`})]}),_&&(0,L.jsx)(`div`,{className:`alert alert-warning text-sm`,children:`Analysis failed. You can describe your project manually below.`}),k.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:k.map(e=>(0,L.jsx)(`span`,{className:`badge badge-sm badge-soft badge-primary`,children:e},e))}),(e||i||_)&&!u&&!s&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:`label text-sm font-medium`,children:`Project Description`}),(0,L.jsx)(`textarea`,{className:`textarea textarea-bordered w-full h-24 text-sm`,placeholder:`Describe your project so we can suggest the right agents and domains...`,value:n,onChange:e=>r(e.target.value)})]})]})}function pe({selectedDomains:e,setSelectedDomains:t,analysisResult:n}){let r=(0,I.useRef)(!1);(0,I.useEffect)(()=>{r.current||!n?.domains?.length||e.length>0||(r.current=!0,t(n.domains))},[n]);let i=(0,I.useCallback)(e=>{t(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[t]);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(N,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Domains`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Select the domains relevant to your project`})]}),H.map(t=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wider text-base-content/40 mb-2`,children:t.label}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.domains.map(t=>(0,L.jsxs)(`button`,{className:`btn btn-sm gap-1.5 ${e.includes(t.value)?`btn-primary`:`btn-soft`}`,onClick:()=>i(t.value),children:[(0,L.jsx)(`span`,{children:t.emoji}),t.label]},t.value))})]},t.label))]})}function me({selectedDomains:e,selectedAgents:t,setSelectedAgents:n,selectedSkills:r,setSelectedSkills:i,existingAgents:a,existingSkills:o}){let[s,c]=(0,I.useState)([]),[u,d]=(0,I.useState)([]),[p,m]=(0,I.useState)(!1),h=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(h.current)return;h.current=!0,m(!0);let s=e.length>0?`?domains=${e.join(`,`)}`:``;Promise.all([l.get(`/catalog/agents${s}`).catch(()=>({agents:[]})),l.get(`/catalog/skills`).catch(()=>({skills:[]}))]).then(([e,s])=>{let l=e?.agents||[],u=s?.skills||[];c(l),d(u);let f=new Set((a||[]).map(e=>e.name)),p=l.filter(e=>!f.has(e.name)).map(e=>e.name);p.length>0&&t.length===0&&n(p);let m=new Set((o||[]).map(e=>e.name)),h=u.filter(e=>!m.has(e.name)).map(e=>e.name);h.length>0&&r.length===0&&i(h)}).finally(()=>m(!1))},[]);let _=new Set((a||[]).map(e=>e.name)),v=new Set((o||[]).map(e=>e.name)),y=(0,I.useCallback)(e=>{n(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[n]),b=(0,I.useCallback)(e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[i]),x=(0,I.useCallback)(()=>{n(s.filter(e=>!_.has(e.name)).map(e=>e.name))},[s,_,n]),S=(0,I.useCallback)(()=>n([]),[n]),C=(0,I.useCallback)(()=>{i(u.filter(e=>!v.has(e.name)).map(e=>e.name))},[u,v,i]),w=(0,I.useCallback)(()=>i([]),[i]);return p?(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12`,children:[(0,L.jsx)(g,{className:`size-8 text-primary animate-spin`}),(0,L.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Loading catalog...`})]}):(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(f,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Agents & Skills`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose which agents and skills to install`})]}),s.length>0&&(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,L.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,L.jsx)(f,{className:`size-4 opacity-50`}),`Agents (`,s.length,`)`]}),(0,L.jsxs)(`div`,{className:`flex gap-1`,children:[(0,L.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:x,children:`Select All`}),(0,L.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:S,children:`None`})]})]}),(0,L.jsx)(`div`,{className:`grid gap-2`,children:s.map(e=>{let n=_.has(e.name),r=n||t.includes(e.name);return(0,L.jsx)(`button`,{className:`card bg-base-200 cursor-pointer transition-all text-left ${r?`ring-2 ring-primary ring-offset-1 ring-offset-base-100`:``} ${n?`opacity-60`:``}`,onClick:()=>!n&&y(e.name),disabled:n,children:(0,L.jsxs)(`div`,{className:`card-body p-3 flex-row items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`text-xl shrink-0`,children:e.emoji||`🤖`}),(0,L.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:e.displayName||e.name}),e.description&&(0,L.jsx)(`p`,{className:`text-xs text-base-content/50 truncate`,children:e.description})]}),n?(0,L.jsxs)(`span`,{className:`badge badge-sm badge-success gap-1`,children:[(0,L.jsx)(E,{className:`size-3`}),` Installed`]}):(0,L.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-primary checkbox-sm`,checked:r,readOnly:!0,tabIndex:-1})]})},e.name)})})]}),u.length>0&&(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,L.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,L.jsx)(O,{className:`size-4 opacity-50`}),`Skills (`,u.length,`)`]}),(0,L.jsxs)(`div`,{className:`flex gap-1`,children:[(0,L.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:C,children:`Select All`}),(0,L.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:w,children:`None`})]})]}),(0,L.jsx)(`div`,{className:`grid gap-2`,children:u.map(e=>{let t=v.has(e.name),n=t||r.includes(e.name);return(0,L.jsx)(`button`,{className:`card bg-base-200 cursor-pointer transition-all text-left ${n?`ring-2 ring-primary ring-offset-1 ring-offset-base-100`:``} ${t?`opacity-60`:``}`,onClick:()=>!t&&b(e.name),disabled:t,children:(0,L.jsxs)(`div`,{className:`card-body p-3 flex-row items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`text-xl shrink-0`,children:e.emoji||`🧩`}),(0,L.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:e.displayName||e.name}),e.description&&(0,L.jsx)(`p`,{className:`text-xs text-base-content/50 truncate`,children:e.description})]}),t?(0,L.jsxs)(`span`,{className:`badge badge-sm badge-success gap-1`,children:[(0,L.jsx)(E,{className:`size-3`}),` Installed`]}):(0,L.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-primary checkbox-sm`,checked:n,readOnly:!0,tabIndex:-1})]})},e.name)})})]}),s.length===0&&u.length===0&&(0,L.jsx)(`div`,{className:`alert alert-info text-sm`,children:`No agents or skills found in the catalog. You can add them later from the settings page.`})]})}function J({role:e,title:t,description:n,providerName:r,value:i,onChange:a,options:o,model:s,onModelChange:c,availableModels:l}){let u=Math.max(0,o.findIndex(e=>e.value===i)),d=o[u]||o[0],f=d.icon;return(0,L.jsx)(`div`,{className:`card bg-base-200`,children:(0,L.jsxs)(`div`,{className:`card-body p-5 gap-4`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`font-semibold`,children:t}),(0,L.jsx)(`p`,{className:`text-xs text-base-content/60 mt-0.5`,children:n})]}),r&&(0,L.jsx)(`span`,{className:`badge badge-sm badge-soft badge-primary capitalize`,children:r})]}),l&&l.length>0&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`label`,{className:`text-xs text-base-content/50`,children:`Model`}),(0,L.jsx)(`select`,{className:`select select-sm select-bordered w-full`,value:s||``,onChange:e=>c?.(e.target.value),children:l.map(e=>(0,L.jsx)(`option`,{value:e.id,children:e.label||e.id},e.id))})]}),(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-bold ${d.color}`,children:[(0,L.jsx)(f,{className:`size-6`}),d.label]}),(0,L.jsx)(`p`,{className:`text-xs text-base-content/50 text-center max-w-xs`,children:d.description})]}),(0,L.jsxs)(`div`,{className:`px-1`,children:[(0,L.jsx)(`input`,{type:`range`,min:0,max:o.length-1,value:u,onChange:e=>a(o[Number(e.target.value)].value),className:`range range-primary range-sm w-full`,step:1}),(0,L.jsx)(`div`,{className:`flex justify-between mt-1 px-0.5`,children:o.map(t=>(0,L.jsx)(`span`,{className:`text-[10px] ${t.value===d.value?d.color+` font-semibold`:`text-base-content/30`}`,children:t.label},`${e}-tick-${t.value}`))})]})]})})}function he({efforts:e,setEfforts:t,pipeline:n,models:r,setModels:i,modelsByProvider:a}){(0,I.useEffect)(()=>{for(let r of[`planner`,`executor`,`reviewer`]){let i=V(r,n),a=e[r];a&&!i.some(e=>e.value===a)&&t(e=>({...e,[r]:`high`}))}},[n,e,t]);let o=a?.[n?.planner]||[],s=a?.[n?.executor]||[],c=a?.[n?.reviewer]||[];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(b,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Models & Reasoning Effort`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose the model and reasoning depth for each pipeline stage.`})]}),(0,L.jsx)(J,{role:`planner`,title:`Planning`,description:`Scopes the issue and decides the overall approach.`,providerName:n?.planner,value:e.planner,onChange:e=>t(t=>({...t,planner:e})),options:V(`planner`,n),model:r?.plan,onModelChange:e=>i(t=>({...t,plan:e})),availableModels:o}),(0,L.jsx)(J,{role:`executor`,title:`Execution`,description:`Implements the plan — writes code, edits files.`,providerName:n?.executor,value:e.executor,onChange:e=>t(t=>({...t,executor:e})),options:V(`executor`,n),model:r?.execute,onModelChange:e=>i(t=>({...t,execute:e})),availableModels:s}),(0,L.jsx)(J,{role:`reviewer`,title:`Review`,description:`Validates the result before approving.`,providerName:n?.reviewer,value:e.reviewer,onChange:e=>t(t=>({...t,reviewer:e})),options:V(`reviewer`,n),model:r?.review,onModelChange:e=>i(t=>({...t,review:e})),availableModels:c})]})}function ge({concurrency:e,setConcurrency:t,selectedTheme:n,setSelectedTheme:r}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,L.jsx)(p,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Workers & Theme`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Configure parallel workers and visual theme`})]}),(0,L.jsx)(`div`,{className:`card bg-base-200`,children:(0,L.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,L.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,L.jsx)(p,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,L.jsxs)(`p`,{className:`text-xs text-base-content/60`,children:[`How many agents can work in parallel (`,e,` worker`,e===1?``:`s`,`)`]}),(0,L.jsx)(`input`,{type:`range`,min:1,max:16,value:e,onChange:e=>t(Number(e.target.value)),className:`range range-primary range-sm`}),(0,L.jsxs)(`div`,{className:`flex justify-between text-xs text-base-content/40 px-1`,children:[(0,L.jsx)(`span`,{children:`1`}),(0,L.jsx)(`span`,{children:`4`}),(0,L.jsx)(`span`,{children:`8`}),(0,L.jsx)(`span`,{children:`12`}),(0,L.jsx)(`span`,{children:`16`})]})]})})]}),(0,L.jsx)(`div`,{className:`card bg-base-200`,children:(0,L.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,L.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,L.jsx)(y,{className:`size-4 opacity-50`}),`Theme`]}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ie.map(e=>(0,L.jsx)(`button`,{className:`btn btn-sm ${n===e.value?`btn-primary`:`btn-soft`}`,onClick:()=>r(e.value),children:e.label},e.value))})]})})]})}function _e({config:e,launching:t}){return(0,L.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-6 stagger-children py-4`,children:[(0,L.jsx)(`div`,{className:`animate-bounce-in`,children:(0,L.jsx)(P,{className:`size-16 sm:size-20 text-primary mx-auto`})}),(0,L.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-bold`,children:`You're All Set!`}),(0,L.jsx)(`p`,{className:`text-base-content/60 max-w-md`,children:`Here's a summary of your configuration. Hit launch when you're ready.`}),(0,L.jsx)(`div`,{className:`card bg-base-200 w-full max-w-sm`,children:(0,L.jsxs)(`div`,{className:`card-body p-4 gap-2 text-sm text-left`,children:[(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Pipeline`}),(0,L.jsxs)(`span`,{className:`font-semibold capitalize text-xs font-mono`,children:[e.pipeline?.planner||`?`,` → `,e.pipeline?.executor||`?`,` → `,e.pipeline?.reviewer||`?`]})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Domains`}),(0,L.jsx)(`span`,{className:`font-semibold`,children:e.domains?.length>0?e.domains.length+` selected`:`none`})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Agents`}),(0,L.jsxs)(`span`,{className:`font-semibold`,children:[e.agents?.length||0,` to install`]})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Skills`}),(0,L.jsxs)(`span`,{className:`font-semibold`,children:[e.skills?.length||0,` to install`]})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Plan`}),(0,L.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.planner})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Execute`}),(0,L.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.executor})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Review`}),(0,L.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.reviewer})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Workers`}),(0,L.jsx)(`span`,{className:`font-semibold`,children:e.concurrency})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Theme`}),(0,L.jsx)(`span`,{className:`font-semibold capitalize`,children:e.theme})]})]})}),t&&(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-base-content/50`,children:[(0,L.jsx)(g,{className:`size-4 animate-spin`}),`Saving configuration & installing agents...`]})]})}function ve({onComplete:e}){let t=r(),n=u(),s=a(n.data),[d,f]=(0,I.useState)(0),[p,m]=(0,I.useState)(`forward`),[h,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(null),S=(0,I.useRef)(!1),[w,T]=(0,I.useState)(``),[E,D]=(0,I.useState)({planner:``,executor:``,reviewer:``}),[O,k]=(0,I.useState)(()=>ae(null)),[j,M]=(0,I.useState)(2),[N,F]=(0,I.useState)(`auto`),[R,z]=(0,I.useState)(null),[B,V]=(0,I.useState)(null),[H,ie]=(0,I.useState)(``),[W,K]=(0,I.useState)([]),[q,ue]=(0,I.useState)([]),[J,ve]=(0,I.useState)([]),[ye,be]=(0,I.useState)(!1),[Y,xe]=(0,I.useState)(!1),X=re(Y),Z=ne(Y)[d]||``,[Se,Ce]=(0,I.useState)(null),[we,Te]=(0,I.useState)(!1),[Ee,De]=(0,I.useState)({}),[Q,Oe]=(0,I.useState)({plan:``,execute:``,review:``}),[ke,Ae]=(0,I.useState)(``);(0,I.useEffect)(()=>{l.get(`/state`).then(e=>{Ae(e?.sourceRepoUrl||e?.config?.sourceRepo||``)}).catch(()=>{})},[]),(0,I.useEffect)(()=>{if(S.current||n.isLoading)return;S.current=!0;let e=i(s,`runtime.agentProvider`,``),t=i(s,`runtime.defaultEffort`,null),r=i(s,`ui.theme`,`auto`),a=i(s,`runtime.workerConcurrency`,2);typeof e==`string`&&e.trim()&&T(e),k(ae(t)),typeof r==`string`&&r.trim()&&F(r);let o=Number.parseInt(String(a??2),10);Number.isFinite(o)&&M(Math.min(16,Math.max(1,o)))},[s,n.isLoading]),(0,I.useEffect)(()=>{d===1&&Se===null&&(Te(!0),Promise.all([l.get(`/providers`),l.get(`/config/workflow?details=1`).catch(()=>null)]).then(([e,t])=>{let n=Array.isArray(e)?e:e?.providers||[];Ce(n);let r=t?.models||{};De(r);let i=n.filter(e=>e.available!==!1),a=i[0]?.id||i[0]?.name||``;a&&!w&&T(a);let o=i.find(e=>(e.id||e.name)===`claude`),s=a,c=o?`claude`:s,l={planner:c,executor:s,reviewer:c};D(e=>({planner:e.planner||l.planner,executor:e.executor||l.executor,reviewer:e.reviewer||l.reviewer})),Oe(e=>({plan:e.plan||r[c]?.[0]?.id||``,execute:e.execute||r[s]?.[0]?.id||``,review:e.review||r[c]?.[0]?.id||``}))}).catch(()=>{Ce([])}).finally(()=>{Te(!1)}))},[d]),(0,I.useEffect)(()=>{let e=N===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:N;document.documentElement.setAttribute(`data-theme`,e)},[N]),(0,I.useEffect)(()=>{E.executor&&E.executor!==w&&T(E.executor)},[E.executor]);let je=(0,I.useCallback)(e=>{if(e===`Providers`){let e=[{provider:E.planner,role:`planner`},{provider:E.executor,role:`executor`},{provider:E.reviewer,role:`reviewer`}];U(`runtime.agentProvider`,E.executor,`runtime`).catch(()=>{}),U(`runtime.pipeline`,e,`runtime`).catch(()=>{}),U(`runtime.workflowConfig`,G(E,O,Q),`runtime`).catch(()=>{})}else e===`Effort`?(U(`runtime.defaultEffort`,O,`runtime`).catch(()=>{}),U(`runtime.workflowConfig`,G(E,O,Q),`runtime`).catch(()=>{})):e===`Workers & Theme`&&(U(`ui.theme`,N,`ui`).catch(()=>{}),l.post(`/config/concurrency`,{concurrency:j}).catch(()=>{}))},[E,O,Q,j,N]),$=(0,I.useCallback)(()=>{d<X-1&&(je(Z),m(`forward`),f(e=>e+1))},[d,X,Z,je]),Me=(0,I.useCallback)(()=>{d>0&&(m(`backward`),f(e=>e-1))},[d]),Ne=(0,I.useCallback)(async()=>{v(!0);try{let n=[U(`ui.theme`,N,`ui`),U(`ui.onboarding.completed`,!0,`ui`)],r=[{provider:E.planner,role:`planner`},{provider:E.executor,role:`executor`},{provider:E.reviewer,role:`reviewer`}];n.push(U(`runtime.agentProvider`,E.executor,`runtime`)),n.push(U(`runtime.pipeline`,r,`runtime`)),n.push(U(`runtime.workflowConfig`,G(E,O),`runtime`)),n.push(U(`runtime.defaultEffort`,O,`runtime`)),n.push(U(`runtime.workflowConfig`,G(E,O,Q),`runtime`)),n.push(l.post(`/config/concurrency`,{concurrency:j})),q.length>0&&n.push(l.post(`/install/agents`,{agents:q})),J.length>0&&n.push(l.post(`/install/skills`,{skills:J})),await Promise.allSettled(n),t.setQueryData(o,e=>c(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!0,source:`user`,updatedAt:new Date().toISOString()})),b({x:window.innerWidth/2,y:window.innerHeight/3}),setTimeout(()=>{t.invalidateQueries({queryKey:o}),e?.()},1200)}catch{t.setQueryData(o,e=>c(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!0,source:`user`,updatedAt:new Date().toISOString()})),await U(`ui.onboarding.completed`,!0,`ui`).catch(()=>{}),t.invalidateQueries({queryKey:o}),e?.()}},[E,w,O,Q,j,N,q,J,t,e]),Pe=Z===`Welcome`||Z===`Providers`&&(E.executor||we)||Z===`Scan Project`||Z===`Discover Issues`||Z===`Domains`||Z===`Agents & Skills`||Z===`Effort`||Z===`Workers & Theme`||Z===`Launch`,Fe=(R?.existingAgents||[]).map(e=>typeof e==`string`?{name:e}:e),Ie=(R?.existingSkills||[]).map(e=>typeof e==`string`?{name:e}:e),Le={pipeline:E,efforts:O,concurrency:j,theme:N,domains:W,agents:q,skills:J};return(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-base-100 flex flex-col overflow-hidden`,children:[(0,L.jsx)(x,{}),y&&(0,L.jsx)(C,{x:y.x,y:y.y,active:!0,onDone:()=>b(null)}),d>0&&(0,L.jsx)(`div`,{className:`relative z-10 pt-6 pb-2 px-4 flex justify-center`,children:(0,L.jsx)(oe,{current:d,wantsDiscovery:Y})}),(0,L.jsx)(`div`,{className:`relative z-10 flex-1 flex flex-col items-center justify-start px-4 py-6 overflow-y-auto`,children:(0,L.jsxs)(se,{direction:p,stepKey:d,center:Z===`Welcome`||Z===`Providers`||Z===`Launch`,children:[Z===`Welcome`&&(0,L.jsx)(le,{workspacePath:ke,onGetStarted:$}),Z===`Providers`&&(0,L.jsx)(de,{providers:Se||[],providersLoading:we,pipeline:E,setPipeline:D}),Z===`Scan Project`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(fe,{scanResult:R,setScanResult:z,projectDescription:H,setProjectDescription:ie,analysisResult:B,setAnalysisResult:V,selectedProvider:w,analyzing:ye,setAnalyzing:be}),(0,L.jsx)(`div`,{className:`mt-4 w-full max-w-lg`,children:(0,L.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer p-3 rounded-lg bg-base-200/50 border border-base-300/50 hover:border-primary/30 transition-colors`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-primary toggle-sm`,checked:Y,onChange:e=>xe(e.target.checked)}),(0,L.jsxs)(`div`,{className:`flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(_,{className:`size-4 text-primary`}),(0,L.jsx)(`span`,{className:`text-sm font-medium`,children:`Discover existing issues`})]}),(0,L.jsx)(`p`,{className:`text-xs text-base-content/50 mt-0.5`,children:`Scan for TODOs, FIXMEs, and GitHub issues to import`})]})]})}),(0,L.jsx)(`div`,{className:`mt-3 w-full max-w-lg`,children:(0,L.jsx)(ce,{})})]}),Z===`Discover Issues`&&(0,L.jsx)(ee,{}),Z===`Domains`&&(0,L.jsx)(pe,{selectedDomains:W,setSelectedDomains:K,analysisResult:B}),Z===`Agents & Skills`&&(0,L.jsx)(me,{selectedDomains:W,selectedAgents:q,setSelectedAgents:ue,selectedSkills:J,setSelectedSkills:ve,existingAgents:Fe,existingSkills:Ie}),Z===`Effort`&&(0,L.jsx)(he,{efforts:O,setEfforts:k,pipeline:E,models:Q,setModels:Oe,modelsByProvider:Ee}),Z===`Workers & Theme`&&(0,L.jsx)(ge,{concurrency:j,setConcurrency:M,selectedTheme:N,setSelectedTheme:F}),Z===`Launch`&&(0,L.jsx)(_e,{config:Le,launching:h})]})}),d>0&&(0,L.jsxs)(`div`,{className:`relative z-10 p-4 pb-6 flex items-center max-w-2xl mx-auto w-full justify-between`,children:[d>0&&(0,L.jsxs)(`button`,{className:`btn btn-ghost gap-1`,onClick:Me,disabled:h,children:[(0,L.jsx)(te,{className:`size-4`}),` Back`]}),d<X-1?(0,L.jsxs)(`button`,{className:`btn btn-primary gap-1`,onClick:$,disabled:!Pe,children:[Z===`Discover Issues`?`Continue`:`Next`,` `,(0,L.jsx)(A,{className:`size-4`})]}):(0,L.jsx)(`button`,{className:`btn btn-primary btn-lg gap-2 animate-pulse-soft`,onClick:Ne,disabled:h,children:h?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(g,{className:`size-5 animate-spin`}),` Launching...`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(P,{className:`size-5`}),` Launch Fifony`]})})]})]})}export{ve as default};
1
+ import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,h as n,m as r}from"./vendor-BoGBoEwT.js";import{c as i,l as a,n as o,t as s,u as c,w as l,y as u}from"./zap-BwZ-sPG7.js";import{t as d}from"./createLucideIcon-DtZs0TX0.js";import{S as f,a as p,b as m,c as h,d as g,g as _,h as v,l as y,m as b,n as x,p as S,r as C,s as w,t as ee,u as T,x as E,y as D}from"./index-CRG9kNAx.js";var O=d(`boxes`,[[`path`,{d:`M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z`,key:`lc1i9w`}],[`path`,{d:`m7 16.5-4.74-2.85`,key:`1o9zyk`}],[`path`,{d:`m7 16.5 5-3`,key:`va8pkn`}],[`path`,{d:`M7 16.5v5.17`,key:`jnp8gn`}],[`path`,{d:`M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z`,key:`8zsnat`}],[`path`,{d:`m17 16.5-5-3`,key:`8arw3v`}],[`path`,{d:`m17 16.5 4.74-2.85`,key:`8rfmw`}],[`path`,{d:`M17 16.5v5.17`,key:`k6z78m`}],[`path`,{d:`M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z`,key:`1xygjf`}],[`path`,{d:`M12 8 7.26 5.15`,key:`1vbdud`}],[`path`,{d:`m12 8 4.74-2.85`,key:`3rx089`}],[`path`,{d:`M12 13.5V8`,key:`1io7kd`}]]),k=d(`brain`,[[`path`,{d:`M12 18V5`,key:`adv99a`}],[`path`,{d:`M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4`,key:`1e3is1`}],[`path`,{d:`M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5`,key:`1gqd8o`}],[`path`,{d:`M17.997 5.125a4 4 0 0 1 2.526 5.77`,key:`iwvgf7`}],[`path`,{d:`M18 18a4 4 0 0 0 2-7.464`,key:`efp6ie`}],[`path`,{d:`M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517`,key:`1gq6am`}],[`path`,{d:`M6 18a4 4 0 0 1-2-7.464`,key:`k1g0md`}],[`path`,{d:`M6.003 5.125a4 4 0 0 0-2.526 5.77`,key:`q97ue3`}]]),te=d(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),A=d(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),j=d(`flame`,[[`path`,{d:`M12 3q1 4 4 6.5t3 5.5a1 1 0 0 1-14 0 5 5 0 0 1 1-3 1 1 0 0 0 5 0c0-2-1.5-3-1.5-5q0-2 2.5-4`,key:`1slcih`}]]),M=d(`folder-search`,[[`path`,{d:`M10.7 20H4a2 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.9H20a2 2 0 0 1 2 2v4.1`,key:`1bw5m7`}],[`path`,{d:`m21 21-1.9-1.9`,key:`1g2n9r`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}]]),N=d(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]),P=d(`rocket`,[[`path`,{d:`M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5`,key:`qeys4`}],[`path`,{d:`M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09`,key:`u4xsad`}],[`path`,{d:`M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z`,key:`676m9`}],[`path`,{d:`M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05`,key:`92ym6u`}]]),F=d(`shield-check`,[[`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`}]]),I=e(t(),1),L=n(),R=[`Welcome`,`Providers`,`Scan Project`,`Domains`,`Agents & Skills`,`Effort`,`Workers & Theme`,`Launch`];function ne(e){return e?[...R.slice(0,3),`Discover Issues`,...R.slice(3)]:R}function re(e){return e?9:8}var z=[{value:`low`,label:`Low`,icon:s,description:`Quick and light -- fast responses, less thorough`,color:`text-info`},{value:`medium`,label:`Medium`,icon:b,description:`Balanced -- good mix of speed and quality`,color:`text-success`},{value:`high`,label:`High`,icon:k,description:`Thorough -- deeper analysis, takes more time`,color:`text-warning`},{value:`extra-high`,label:`Extra High`,icon:j,description:`Maximum depth -- most thorough, slowest`,color:`text-error`}],B={codex:z,claude:z.filter(e=>e.value!==`extra-high`)};function V(e,t){return B[t?.[e]||`claude`]||z}var H=[{label:`Technical`,domains:[{value:`frontend`,label:`Frontend`,emoji:`🎨`},{value:`backend`,label:`Backend`,emoji:`⚙️`},{value:`mobile`,label:`Mobile`,emoji:`📱`},{value:`devops`,label:`DevOps / Infra`,emoji:`🚀`},{value:`database`,label:`Database`,emoji:`🗄️`},{value:`ai-ml`,label:`AI / ML`,emoji:`🤖`},{value:`security`,label:`Security`,emoji:`🔒`},{value:`testing`,label:`Testing / QA`,emoji:`🧪`},{value:`embedded`,label:`Embedded / IoT`,emoji:`🔌`}]},{label:`Industry`,domains:[{value:`games`,label:`Games`,emoji:`🎮`},{value:`ecommerce`,label:`E-commerce`,emoji:`🛒`},{value:`saas`,label:`SaaS`,emoji:`☁️`},{value:`fintech`,label:`Fintech`,emoji:`💰`},{value:`healthcare`,label:`Healthcare`,emoji:`🏥`},{value:`education`,label:`Education`,emoji:`📚`},{value:`blockchain`,label:`Blockchain`,emoji:`⛓️`},{value:`spatial-computing`,label:`Spatial / XR`,emoji:`🥽`}]},{label:`Role`,domains:[{value:`design`,label:`Design / UX`,emoji:`✏️`},{value:`product`,label:`Product`,emoji:`📋`},{value:`marketing`,label:`Marketing`,emoji:`📢`},{value:`data-engineering`,label:`Data Engineering`,emoji:`📊`}]}],ie=[{value:`auto`,label:`Auto`},{value:`light`,label:`Light`},{value:`dark`,label:`Dark`},{value:`black`,label:`Black`},{value:`cupcake`,label:`Cupcake`},{value:`night`,label:`Night`},{value:`sunset`,label:`Sunset`}];async function U(e,t,n=`ui`){return l.post(`/settings/${encodeURIComponent(e)}`,{value:t,scope:n,source:`user`})}function W(e,t=`medium`){return z.some(t=>t.value===e)?e:t}function ae(e){return!e||typeof e!=`object`||Array.isArray(e)?{planner:`medium`,executor:`medium`,reviewer:`medium`}:{planner:W(e.planner??e.default,`medium`),executor:W(e.executor??e.default,`medium`),reviewer:W(e.reviewer??e.default,`medium`)}}function G(e,t,n={}){return{plan:{provider:e.planner||`claude`,model:n.plan||e.planner||`claude`,effort:t.planner||`medium`},execute:{provider:e.executor||`codex`,model:n.execute||e.executor||`codex`,effort:t.executor||`medium`},review:{provider:e.reviewer||`claude`,model:n.review||e.reviewer||`claude`,effort:t.reviewer||`medium`}}}var K=[`Pipeline`,`Scan`,`Domains`,`Agents`,`Effort`,`Workers & Theme`,`Launch`];function q(e){return e?[...K.slice(0,2),`Discover`,...K.slice(2)]:K}function oe({current:e,wantsDiscovery:t}){let n=q(t),r=e-1;return(0,L.jsx)(`ul`,{className:`steps steps-horizontal w-full max-w-2xl text-xs`,children:n.map((e,t)=>{let n=t<r,i=t===r;return(0,L.jsx)(`li`,{"data-content":n?`✓`:t+1,className:`step ${n||i?`step-primary`:``}`,style:{transition:`color 0.3s ease`},children:e},e)})})}function se({direction:e,stepKey:t,center:n,children:r}){return(0,L.jsx)(`div`,{className:`${e===`forward`?`animate-slide-in-right`:`animate-slide-in-left`} w-full max-w-2xl mx-auto ${n?`my-auto`:``}`,children:r},t)}function ce(){let[e,t]=(0,I.useState)(null),[n,r]=(0,I.useState)(!1),[i,a]=(0,I.useState)(!1);return(0,I.useEffect)(()=>{l.get(`/gitignore/status`).then(t).catch(()=>t({exists:!1,hasFifony:!1}))},[]),e===null||e.hasFifony||i?i?(0,L.jsxs)(`div`,{className:`alert alert-success text-sm max-w-md animate-fade-in`,children:[(0,L.jsx)(F,{className:`size-4 shrink-0`}),(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`code`,{children:`.fifony/`}),` added to `,(0,L.jsx)(`code`,{children:`.gitignore`})]})]}):null:(0,L.jsxs)(`div`,{className:`alert alert-warning text-sm max-w-md`,children:[(0,L.jsx)(S,{className:`size-4 shrink-0`}),(0,L.jsxs)(`div`,{className:`flex-1`,children:[(0,L.jsxs)(`span`,{children:[(0,L.jsx)(`code`,{children:`.fifony/`}),` is not in your `,(0,L.jsx)(`code`,{children:`.gitignore`}),`.`]}),(0,L.jsx)(`span`,{className:`text-base-content/50 block text-xs mt-0.5`,children:`Fifony stores local state there — it shouldn't be committed.`})]}),(0,L.jsx)(`button`,{className:`btn btn-xs btn-warning`,onClick:async()=>{r(!0);try{await l.post(`/gitignore/add`),a(!0)}catch{}finally{r(!1)}},disabled:n,children:n?(0,L.jsx)(g,{className:`size-3 animate-spin`}):`Add it`})]})}function le({workspacePath:e,onGetStarted:t}){return(0,L.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-6 stagger-children py-4`,children:[(0,L.jsx)(`div`,{className:`text-6xl sm:text-7xl animate-bounce-in`,children:(0,L.jsx)(T,{className:`size-16 sm:size-20 text-primary mx-auto`})}),(0,L.jsxs)(`h1`,{className:`text-3xl sm:text-4xl font-bold tracking-tight`,children:[`Welcome to `,(0,L.jsx)(`span`,{className:`text-primary`,children:`Fifony`})]}),(0,L.jsx)(`p`,{className:`text-base-content/60 text-lg max-w-md`,children:`Let's set up your AI orchestration workspace in just a few steps.`}),e&&(0,L.jsxs)(`div`,{className:`badge badge-lg badge-soft badge-primary gap-2`,children:[(0,L.jsx)(w,{className:`size-3.5`}),e]}),(0,L.jsxs)(`button`,{className:`btn btn-primary btn-lg gap-2 mt-2`,onClick:t,children:[`Get Started `,(0,L.jsx)(A,{className:`size-5`})]})]})}var ue=[{role:`planner`,label:`Planner`,description:`Scopes the issue, breaks it into steps, and decides the approach`,icon:k,color:`text-info`},{role:`executor`,label:`Executor`,description:`Implements the plan — writes code, edits files, runs commands`,icon:s,color:`text-primary`},{role:`reviewer`,label:`Reviewer`,description:`Validates the result — checks correctness, scope, and quality`,icon:h,color:`text-secondary`}];function de({providers:e,providersLoading:t,pipeline:n,setPipeline:r}){let i=Array.isArray(e)?e:[],a=i.filter(e=>e.available!==!1);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(P,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Agent Pipeline`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose which CLI runs each stage of the pipeline`})]}),t?(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-8`,children:[(0,L.jsx)(g,{className:`size-8 text-primary animate-spin`}),(0,L.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Detecting available CLIs...`})]}):a.length===0?(0,L.jsx)(`div`,{className:`alert alert-warning text-sm`,children:`No providers detected. Make sure claude or codex CLI is installed.`}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:i.map(e=>{let t=e.id||e.name||e,n=e.available!==!1;return(0,L.jsxs)(`span`,{className:`badge badge-lg gap-2 ${n?`badge-success`:`badge-ghost opacity-50`}`,children:[n?(0,L.jsx)(m,{className:`size-3.5`}):(0,L.jsx)(D,{className:`size-3.5`}),t,e.path&&(0,L.jsx)(`span`,{className:`font-mono text-[10px] opacity-60 hidden sm:inline`,children:e.path})]},t)})}),(0,L.jsx)(`div`,{className:`flex flex-col items-center gap-2`,children:ue.map((e,t)=>{let i=e.icon,o=n[e.role]||a[0]?.name||``;return(0,L.jsxs)(`div`,{className:`w-full`,children:[t>0&&(0,L.jsx)(`div`,{className:`flex justify-center py-1`,children:(0,L.jsx)(A,{className:`size-5 rotate-90 opacity-30`})}),(0,L.jsx)(`div`,{className:`card bg-base-200`,children:(0,L.jsxs)(`div`,{className:`card-body p-4 flex-row items-center gap-4`,children:[(0,L.jsx)(`div`,{className:`size-10 rounded-full flex items-center justify-center bg-base-300 ${e.color}`,children:(0,L.jsx)(i,{className:`size-5`})}),(0,L.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-semibold`,children:e.label}),(0,L.jsx)(`p`,{className:`text-xs text-base-content/50`,children:e.description})]}),(0,L.jsx)(`select`,{className:`select select-bordered select-sm w-32`,value:o,onChange:t=>r(n=>({...n,[e.role]:t.target.value})),children:a.map(e=>{let t=e.id||e.name||e;return(0,L.jsx)(`option`,{value:t,children:t},t)})})]})})]},e.role)})}),(0,L.jsx)(`p`,{className:`text-xs text-base-content/40 text-center max-w-md mx-auto`,children:`Each stage can use a different CLI. The pipeline flows top to bottom: plan, then execute, then review.`})]})]})}function fe({scanResult:e,setScanResult:t,projectDescription:n,setProjectDescription:r,analysisResult:i,setAnalysisResult:a,selectedProvider:o,analyzing:s,setAnalyzing:c}){let[u,d]=(0,I.useState)(!1),[p,h]=(0,I.useState)(null),[_,y]=(0,I.useState)(null),b=(0,I.useRef)(!1);(0,I.useEffect)(()=>{b.current||e||(b.current=!0,d(!0),h(null),l.get(`/scan/project`).then(e=>{if(t(e),!n){let t=e?.packageDescription||e?.packageInfo?.description||e?.readmeExcerpt||``;t&&r(t)}o&&!i&&(c(!0),l.post(`/scan/analyze`,{provider:o}).then(e=>{a(e),e.description&&r(e.description)}).catch(()=>{}).finally(()=>c(!1)))}).catch(e=>h(e.message||`Failed to scan project`)).finally(()=>d(!1)))},[]);let x=(0,I.useCallback)(async()=>{c(!0),y(null);try{let e=await l.post(`/scan/analyze`,{provider:o||`claude`});a(e),e.description&&r(e.description)}catch(e){y(e.message||`Analysis failed`)}finally{c(!1)}},[o,c,a,r]),S={claudeMd:`CLAUDE.md`,claudeDir:`.claude/`,codexDir:`.codex/`,readmeMd:`README.md`,packageJson:`package.json`,cargoToml:`Cargo.toml`,pyprojectToml:`pyproject.toml`,goMod:`go.mod`,buildGradle:`build.gradle`,gemfile:`Gemfile`,dockerfile:`Dockerfile`,workflowMd:`WORKFLOW.md`,agentsMd:`AGENTS.md`,claudeAgentsDir:`.claude/agents/`,claudeSkillsDir:`.claude/skills/`,codexAgentsDir:`.codex/agents/`,codexSkillsDir:`.codex/skills/`},C=e?.files||{},ee=Object.entries(C).map(([e,t])=>({path:S[e]||e,exists:!!t})),T=(e?.existingAgents||[]).map(e=>typeof e==`string`?{name:e}:e),E=(e?.existingSkills||[]).map(e=>typeof e==`string`?{name:e}:e),k=i?.stack||[];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(M,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Scan Project`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`We'll analyze your workspace to suggest the best setup`})]}),u&&(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6`,children:[(0,L.jsx)(g,{className:`size-8 text-primary animate-spin`}),(0,L.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Scanning project files...`})]}),p&&(0,L.jsx)(`div`,{className:`alert alert-warning text-sm`,children:p}),e&&!u&&(0,L.jsx)(`div`,{className:`card bg-base-200`,children:(0,L.jsxs)(`div`,{className:`card-body p-4 gap-3`,children:[(0,L.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,L.jsx)(v,{className:`size-4 opacity-50`}),`Project Files`]}),(0,L.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-1.5`,children:ee.map(e=>(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[e.exists?(0,L.jsx)(m,{className:`size-4 text-success shrink-0`}):(0,L.jsx)(D,{className:`size-4 text-base-content/30 shrink-0`}),(0,L.jsx)(`span`,{className:`font-mono text-xs truncate ${e.exists?``:`text-base-content/40`}`,children:e.path})]},e.path))}),(T.length>0||E.length>0)&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[T.length>0&&(0,L.jsxs)(`span`,{className:`badge badge-sm badge-info gap-1`,children:[(0,L.jsx)(f,{className:`size-3`}),T.length,` agent`,T.length===1?``:`s`,` found`]}),E.length>0&&(0,L.jsxs)(`span`,{className:`badge badge-sm badge-secondary gap-1`,children:[(0,L.jsx)(O,{className:`size-3`}),E.length,` skill`,E.length===1?``:`s`,` found`]})]})]})]})}),!s&&!i&&(0,L.jsxs)(`button`,{className:`btn btn-primary btn-lg gap-2 mx-auto`,onClick:x,disabled:u,children:[(0,L.jsx)(w,{className:`size-5`}),`Analyze with AI`]}),s&&(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-4`,children:[(0,L.jsx)(g,{className:`size-8 text-primary animate-spin`}),(0,L.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`AI is analyzing your project...`})]}),_&&(0,L.jsx)(`div`,{className:`alert alert-warning text-sm`,children:`Analysis failed. You can describe your project manually below.`}),k.length>0&&(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2 justify-center`,children:k.map(e=>(0,L.jsx)(`span`,{className:`badge badge-sm badge-soft badge-primary`,children:e},e))}),(e||i||_)&&!u&&!s&&(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`label`,{className:`label text-sm font-medium`,children:`Project Description`}),(0,L.jsx)(`textarea`,{className:`textarea textarea-bordered w-full h-24 text-sm`,placeholder:`Describe your project so we can suggest the right agents and domains...`,value:n,onChange:e=>r(e.target.value)})]})]})}function pe({selectedDomains:e,setSelectedDomains:t,analysisResult:n}){let r=(0,I.useRef)(!1);(0,I.useEffect)(()=>{r.current||!n?.domains?.length||e.length>0||(r.current=!0,t(n.domains))},[n]);let i=(0,I.useCallback)(e=>{t(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[t]);return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(N,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Domains`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Select the domains relevant to your project`})]}),H.map(t=>(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-wider text-base-content/40 mb-2`,children:t.label}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:t.domains.map(t=>(0,L.jsxs)(`button`,{className:`btn btn-sm gap-1.5 ${e.includes(t.value)?`btn-primary`:`btn-soft`}`,onClick:()=>i(t.value),children:[(0,L.jsx)(`span`,{children:t.emoji}),t.label]},t.value))})]},t.label))]})}function me({selectedDomains:e,selectedAgents:t,setSelectedAgents:n,selectedSkills:r,setSelectedSkills:i,existingAgents:a,existingSkills:o}){let[s,c]=(0,I.useState)([]),[u,d]=(0,I.useState)([]),[p,m]=(0,I.useState)(!1),h=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(h.current)return;h.current=!0,m(!0);let s=e.length>0?`?domains=${e.join(`,`)}`:``;Promise.all([l.get(`/catalog/agents${s}`).catch(()=>({agents:[]})),l.get(`/catalog/skills`).catch(()=>({skills:[]}))]).then(([e,s])=>{let l=e?.agents||[],u=s?.skills||[];c(l),d(u);let f=new Set((a||[]).map(e=>e.name)),p=l.filter(e=>!f.has(e.name)).map(e=>e.name);p.length>0&&t.length===0&&n(p);let m=new Set((o||[]).map(e=>e.name)),h=u.filter(e=>!m.has(e.name)).map(e=>e.name);h.length>0&&r.length===0&&i(h)}).finally(()=>m(!1))},[]);let _=new Set((a||[]).map(e=>e.name)),v=new Set((o||[]).map(e=>e.name)),y=(0,I.useCallback)(e=>{n(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[n]),b=(0,I.useCallback)(e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[i]),x=(0,I.useCallback)(()=>{n(s.filter(e=>!_.has(e.name)).map(e=>e.name))},[s,_,n]),S=(0,I.useCallback)(()=>n([]),[n]),C=(0,I.useCallback)(()=>{i(u.filter(e=>!v.has(e.name)).map(e=>e.name))},[u,v,i]),w=(0,I.useCallback)(()=>i([]),[i]);return p?(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-12`,children:[(0,L.jsx)(g,{className:`size-8 text-primary animate-spin`}),(0,L.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Loading catalog...`})]}):(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(f,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Agents & Skills`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose which agents and skills to install`})]}),s.length>0&&(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,L.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,L.jsx)(f,{className:`size-4 opacity-50`}),`Agents (`,s.length,`)`]}),(0,L.jsxs)(`div`,{className:`flex gap-1`,children:[(0,L.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:x,children:`Select All`}),(0,L.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:S,children:`None`})]})]}),(0,L.jsx)(`div`,{className:`grid gap-2`,children:s.map(e=>{let n=_.has(e.name),r=n||t.includes(e.name);return(0,L.jsx)(`button`,{className:`card bg-base-200 cursor-pointer transition-all text-left ${r?`ring-2 ring-primary ring-offset-1 ring-offset-base-100`:``} ${n?`opacity-60`:``}`,onClick:()=>!n&&y(e.name),disabled:n,children:(0,L.jsxs)(`div`,{className:`card-body p-3 flex-row items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`text-xl shrink-0`,children:e.emoji||`🤖`}),(0,L.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:e.displayName||e.name}),e.description&&(0,L.jsx)(`p`,{className:`text-xs text-base-content/50 truncate`,children:e.description})]}),n?(0,L.jsxs)(`span`,{className:`badge badge-sm badge-success gap-1`,children:[(0,L.jsx)(E,{className:`size-3`}),` Installed`]}):(0,L.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-primary checkbox-sm`,checked:r,readOnly:!0,tabIndex:-1})]})},e.name)})})]}),u.length>0&&(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[(0,L.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,L.jsx)(O,{className:`size-4 opacity-50`}),`Skills (`,u.length,`)`]}),(0,L.jsxs)(`div`,{className:`flex gap-1`,children:[(0,L.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:C,children:`Select All`}),(0,L.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:w,children:`None`})]})]}),(0,L.jsx)(`div`,{className:`grid gap-2`,children:u.map(e=>{let t=v.has(e.name),n=t||r.includes(e.name);return(0,L.jsx)(`button`,{className:`card bg-base-200 cursor-pointer transition-all text-left ${n?`ring-2 ring-primary ring-offset-1 ring-offset-base-100`:``} ${t?`opacity-60`:``}`,onClick:()=>!t&&b(e.name),disabled:t,children:(0,L.jsxs)(`div`,{className:`card-body p-3 flex-row items-center gap-3`,children:[(0,L.jsx)(`div`,{className:`text-xl shrink-0`,children:e.emoji||`🧩`}),(0,L.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,L.jsx)(`div`,{className:`font-semibold text-sm truncate`,children:e.displayName||e.name}),e.description&&(0,L.jsx)(`p`,{className:`text-xs text-base-content/50 truncate`,children:e.description})]}),t?(0,L.jsxs)(`span`,{className:`badge badge-sm badge-success gap-1`,children:[(0,L.jsx)(E,{className:`size-3`}),` Installed`]}):(0,L.jsx)(`input`,{type:`checkbox`,className:`checkbox checkbox-primary checkbox-sm`,checked:n,readOnly:!0,tabIndex:-1})]})},e.name)})})]}),s.length===0&&u.length===0&&(0,L.jsx)(`div`,{className:`alert alert-info text-sm`,children:`No agents or skills found in the catalog. You can add them later from the settings page.`})]})}function J({role:e,title:t,description:n,providerName:r,value:i,onChange:a,options:o,model:s,onModelChange:c,availableModels:l}){let u=Math.max(0,o.findIndex(e=>e.value===i)),d=o[u]||o[0],f=d.icon;return(0,L.jsx)(`div`,{className:`card bg-base-200`,children:(0,L.jsxs)(`div`,{className:`card-body p-5 gap-4`,children:[(0,L.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsx)(`h3`,{className:`font-semibold`,children:t}),(0,L.jsx)(`p`,{className:`text-xs text-base-content/60 mt-0.5`,children:n})]}),r&&(0,L.jsx)(`span`,{className:`badge badge-sm badge-soft badge-primary capitalize`,children:r})]}),l&&l.length>0&&(0,L.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,L.jsx)(`label`,{className:`text-xs text-base-content/50`,children:`Model`}),(0,L.jsx)(`select`,{className:`select select-sm select-bordered w-full`,value:s||``,onChange:e=>c?.(e.target.value),children:l.map(e=>(0,L.jsx)(`option`,{value:e.id,children:e.label||e.id},e.id))})]}),(0,L.jsxs)(`div`,{className:`flex flex-col items-center gap-2 py-2`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-lg font-bold ${d.color}`,children:[(0,L.jsx)(f,{className:`size-6`}),d.label]}),(0,L.jsx)(`p`,{className:`text-xs text-base-content/50 text-center max-w-xs`,children:d.description})]}),(0,L.jsxs)(`div`,{className:`px-1`,children:[(0,L.jsx)(`input`,{type:`range`,min:0,max:o.length-1,value:u,onChange:e=>a(o[Number(e.target.value)].value),className:`range range-primary range-sm w-full`,step:1}),(0,L.jsx)(`div`,{className:`flex justify-between mt-1 px-0.5`,children:o.map(t=>(0,L.jsx)(`span`,{className:`text-[10px] ${t.value===d.value?d.color+` font-semibold`:`text-base-content/30`}`,children:t.label},`${e}-tick-${t.value}`))})]})]})})}function he({efforts:e,setEfforts:t,pipeline:n,models:r,setModels:i,modelsByProvider:a}){(0,I.useEffect)(()=>{for(let r of[`planner`,`executor`,`reviewer`]){let i=V(r,n),a=e[r];a&&!i.some(e=>e.value===a)&&t(e=>({...e,[r]:`high`}))}},[n,e,t]);let o=a?.[n?.planner]||[],s=a?.[n?.executor]||[],c=a?.[n?.reviewer]||[];return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{className:`text-center`,children:[(0,L.jsx)(b,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Models & Reasoning Effort`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Choose the model and reasoning depth for each pipeline stage.`})]}),(0,L.jsx)(J,{role:`planner`,title:`Planning`,description:`Scopes the issue and decides the overall approach.`,providerName:n?.planner,value:e.planner,onChange:e=>t(t=>({...t,planner:e})),options:V(`planner`,n),model:r?.plan,onModelChange:e=>i(t=>({...t,plan:e})),availableModels:o}),(0,L.jsx)(J,{role:`executor`,title:`Execution`,description:`Implements the plan — writes code, edits files.`,providerName:n?.executor,value:e.executor,onChange:e=>t(t=>({...t,executor:e})),options:V(`executor`,n),model:r?.execute,onModelChange:e=>i(t=>({...t,execute:e})),availableModels:s}),(0,L.jsx)(J,{role:`reviewer`,title:`Review`,description:`Validates the result before approving.`,providerName:n?.reviewer,value:e.reviewer,onChange:e=>t(t=>({...t,reviewer:e})),options:V(`reviewer`,n),model:r?.review,onModelChange:e=>i(t=>({...t,review:e})),availableModels:c})]})}function ge({concurrency:e,setConcurrency:t,selectedTheme:n,setSelectedTheme:r}){return(0,L.jsxs)(`div`,{className:`flex flex-col gap-6 stagger-children`,children:[(0,L.jsxs)(`div`,{children:[(0,L.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,L.jsx)(p,{className:`size-10 text-primary mx-auto mb-3`}),(0,L.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Workers & Theme`}),(0,L.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`Configure parallel workers and visual theme`})]}),(0,L.jsx)(`div`,{className:`card bg-base-200`,children:(0,L.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,L.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,L.jsx)(p,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,L.jsxs)(`p`,{className:`text-xs text-base-content/60`,children:[`How many agents can work in parallel (`,e,` worker`,e===1?``:`s`,`)`]}),(0,L.jsx)(`input`,{type:`range`,min:1,max:16,value:e,onChange:e=>t(Number(e.target.value)),className:`range range-primary range-sm`}),(0,L.jsxs)(`div`,{className:`flex justify-between text-xs text-base-content/40 px-1`,children:[(0,L.jsx)(`span`,{children:`1`}),(0,L.jsx)(`span`,{children:`4`}),(0,L.jsx)(`span`,{children:`8`}),(0,L.jsx)(`span`,{children:`12`}),(0,L.jsx)(`span`,{children:`16`})]})]})})]}),(0,L.jsx)(`div`,{className:`card bg-base-200`,children:(0,L.jsxs)(`div`,{className:`card-body p-5 gap-3`,children:[(0,L.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-2`,children:[(0,L.jsx)(y,{className:`size-4 opacity-50`}),`Theme`]}),(0,L.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:ie.map(e=>(0,L.jsx)(`button`,{className:`btn btn-sm ${n===e.value?`btn-primary`:`btn-soft`}`,onClick:()=>r(e.value),children:e.label},e.value))})]})})]})}function _e({config:e,launching:t}){return(0,L.jsxs)(`div`,{className:`flex flex-col items-center text-center gap-6 stagger-children py-4`,children:[(0,L.jsx)(`div`,{className:`animate-bounce-in`,children:(0,L.jsx)(P,{className:`size-16 sm:size-20 text-primary mx-auto`})}),(0,L.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-bold`,children:`You're All Set!`}),(0,L.jsx)(`p`,{className:`text-base-content/60 max-w-md`,children:`Here's a summary of your configuration. Hit launch when you're ready.`}),(0,L.jsx)(`div`,{className:`card bg-base-200 w-full max-w-sm`,children:(0,L.jsxs)(`div`,{className:`card-body p-4 gap-2 text-sm text-left`,children:[(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Pipeline`}),(0,L.jsxs)(`span`,{className:`font-semibold capitalize text-xs font-mono`,children:[e.pipeline?.planner||`?`,` → `,e.pipeline?.executor||`?`,` → `,e.pipeline?.reviewer||`?`]})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Domains`}),(0,L.jsx)(`span`,{className:`font-semibold`,children:e.domains?.length>0?e.domains.length+` selected`:`none`})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Agents`}),(0,L.jsxs)(`span`,{className:`font-semibold`,children:[e.agents?.length||0,` to install`]})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Skills`}),(0,L.jsxs)(`span`,{className:`font-semibold`,children:[e.skills?.length||0,` to install`]})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Plan`}),(0,L.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.planner})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Execute`}),(0,L.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.executor})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Review`}),(0,L.jsx)(`span`,{className:`font-semibold capitalize`,children:e.efforts.reviewer})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Workers`}),(0,L.jsx)(`span`,{className:`font-semibold`,children:e.concurrency})]}),(0,L.jsx)(`div`,{className:`divider my-0`}),(0,L.jsxs)(`div`,{className:`flex justify-between`,children:[(0,L.jsx)(`span`,{className:`text-base-content/60`,children:`Theme`}),(0,L.jsx)(`span`,{className:`font-semibold capitalize`,children:e.theme})]})]})}),t&&(0,L.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-base-content/50`,children:[(0,L.jsx)(g,{className:`size-4 animate-spin`}),`Saving configuration & installing agents...`]})]})}function ve({onComplete:e}){let t=r(),n=u(),s=a(n.data),[d,f]=(0,I.useState)(0),[p,m]=(0,I.useState)(`forward`),[h,v]=(0,I.useState)(!1),[y,b]=(0,I.useState)(null),S=(0,I.useRef)(!1),[w,T]=(0,I.useState)(``),[E,D]=(0,I.useState)({planner:``,executor:``,reviewer:``}),[O,k]=(0,I.useState)(()=>ae(null)),[j,M]=(0,I.useState)(2),[N,F]=(0,I.useState)(`auto`),[R,z]=(0,I.useState)(null),[B,V]=(0,I.useState)(null),[H,ie]=(0,I.useState)(``),[W,K]=(0,I.useState)([]),[q,ue]=(0,I.useState)([]),[J,ve]=(0,I.useState)([]),[ye,be]=(0,I.useState)(!1),[Y,xe]=(0,I.useState)(!1),X=re(Y),Z=ne(Y)[d]||``,[Se,Ce]=(0,I.useState)(null),[we,Te]=(0,I.useState)(!1),[Ee,De]=(0,I.useState)({}),[Q,Oe]=(0,I.useState)({plan:``,execute:``,review:``}),[ke,Ae]=(0,I.useState)(``);(0,I.useEffect)(()=>{l.get(`/state`).then(e=>{Ae(e?.sourceRepoUrl||e?.config?.sourceRepo||``)}).catch(()=>{})},[]),(0,I.useEffect)(()=>{if(S.current||n.isLoading)return;S.current=!0;let e=i(s,`runtime.agentProvider`,``),t=i(s,`runtime.defaultEffort`,null),r=i(s,`ui.theme`,`auto`),a=i(s,`runtime.workerConcurrency`,2);typeof e==`string`&&e.trim()&&T(e),k(ae(t)),typeof r==`string`&&r.trim()&&F(r);let o=Number.parseInt(String(a??2),10);Number.isFinite(o)&&M(Math.min(16,Math.max(1,o)))},[s,n.isLoading]),(0,I.useEffect)(()=>{d===1&&Se===null&&(Te(!0),Promise.all([l.get(`/providers`),l.get(`/config/workflow?details=1`).catch(()=>null)]).then(([e,t])=>{let n=Array.isArray(e)?e:e?.providers||[];Ce(n);let r=t?.models||{};De(r);let i=n.filter(e=>e.available!==!1),a=i[0]?.id||i[0]?.name||``;a&&!w&&T(a);let o=i.find(e=>(e.id||e.name)===`claude`),s=a,c=o?`claude`:s,l={planner:c,executor:s,reviewer:c};D(e=>({planner:e.planner||l.planner,executor:e.executor||l.executor,reviewer:e.reviewer||l.reviewer})),Oe(e=>({plan:e.plan||r[c]?.[0]?.id||``,execute:e.execute||r[s]?.[0]?.id||``,review:e.review||r[c]?.[0]?.id||``}))}).catch(()=>{Ce([])}).finally(()=>{Te(!1)}))},[d]),(0,I.useEffect)(()=>{let e=N===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:N;document.documentElement.setAttribute(`data-theme`,e)},[N]),(0,I.useEffect)(()=>{E.executor&&E.executor!==w&&T(E.executor)},[E.executor]);let je=(0,I.useCallback)(e=>{if(e===`Providers`){let e=[{provider:E.planner,role:`planner`},{provider:E.executor,role:`executor`},{provider:E.reviewer,role:`reviewer`}];U(`runtime.agentProvider`,E.executor,`runtime`).catch(()=>{}),U(`runtime.pipeline`,e,`runtime`).catch(()=>{}),U(`runtime.workflowConfig`,G(E,O,Q),`runtime`).catch(()=>{})}else e===`Effort`?(U(`runtime.defaultEffort`,O,`runtime`).catch(()=>{}),U(`runtime.workflowConfig`,G(E,O,Q),`runtime`).catch(()=>{})):e===`Workers & Theme`&&(U(`ui.theme`,N,`ui`).catch(()=>{}),l.post(`/config/concurrency`,{concurrency:j}).catch(()=>{}))},[E,O,Q,j,N]),$=(0,I.useCallback)(()=>{d<X-1&&(je(Z),m(`forward`),f(e=>e+1))},[d,X,Z,je]),Me=(0,I.useCallback)(()=>{d>0&&(m(`backward`),f(e=>e-1))},[d]),Ne=(0,I.useCallback)(async()=>{v(!0);try{let n=[U(`ui.theme`,N,`ui`),U(`ui.onboarding.completed`,!0,`ui`)],r=[{provider:E.planner,role:`planner`},{provider:E.executor,role:`executor`},{provider:E.reviewer,role:`reviewer`}];n.push(U(`runtime.agentProvider`,E.executor,`runtime`)),n.push(U(`runtime.pipeline`,r,`runtime`)),n.push(U(`runtime.workflowConfig`,G(E,O),`runtime`)),n.push(U(`runtime.defaultEffort`,O,`runtime`)),n.push(U(`runtime.workflowConfig`,G(E,O,Q),`runtime`)),n.push(l.post(`/config/concurrency`,{concurrency:j})),q.length>0&&n.push(l.post(`/install/agents`,{agents:q})),J.length>0&&n.push(l.post(`/install/skills`,{skills:J})),await Promise.allSettled(n),t.setQueryData(o,e=>c(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!0,source:`user`,updatedAt:new Date().toISOString()})),b({x:window.innerWidth/2,y:window.innerHeight/3}),setTimeout(()=>{t.invalidateQueries({queryKey:o}),e?.()},1200)}catch{t.setQueryData(o,e=>c(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!0,source:`user`,updatedAt:new Date().toISOString()})),await U(`ui.onboarding.completed`,!0,`ui`).catch(()=>{}),t.invalidateQueries({queryKey:o}),e?.()}},[E,w,O,Q,j,N,q,J,t,e]),Pe=Z===`Welcome`||Z===`Providers`&&(E.executor||we)||Z===`Scan Project`||Z===`Discover Issues`||Z===`Domains`||Z===`Agents & Skills`||Z===`Effort`||Z===`Workers & Theme`||Z===`Launch`,Fe=(R?.existingAgents||[]).map(e=>typeof e==`string`?{name:e}:e),Ie=(R?.existingSkills||[]).map(e=>typeof e==`string`?{name:e}:e),Le={pipeline:E,efforts:O,concurrency:j,theme:N,domains:W,agents:q,skills:J};return(0,L.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-base-100 flex flex-col overflow-hidden`,children:[(0,L.jsx)(x,{}),y&&(0,L.jsx)(C,{x:y.x,y:y.y,active:!0,onDone:()=>b(null)}),d>0&&(0,L.jsx)(`div`,{className:`relative z-10 pt-6 pb-2 px-4 flex justify-center`,children:(0,L.jsx)(oe,{current:d,wantsDiscovery:Y})}),(0,L.jsx)(`div`,{className:`relative z-10 flex-1 flex flex-col items-center justify-start px-4 py-6 overflow-y-auto`,children:(0,L.jsxs)(se,{direction:p,stepKey:d,center:Z===`Welcome`||Z===`Providers`||Z===`Launch`,children:[Z===`Welcome`&&(0,L.jsx)(le,{workspacePath:ke,onGetStarted:$}),Z===`Providers`&&(0,L.jsx)(de,{providers:Se||[],providersLoading:we,pipeline:E,setPipeline:D}),Z===`Scan Project`&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(fe,{scanResult:R,setScanResult:z,projectDescription:H,setProjectDescription:ie,analysisResult:B,setAnalysisResult:V,selectedProvider:w,analyzing:ye,setAnalyzing:be}),(0,L.jsx)(`div`,{className:`mt-4 w-full max-w-lg`,children:(0,L.jsxs)(`label`,{className:`flex items-center gap-3 cursor-pointer p-3 rounded-lg bg-base-200/50 border border-base-300/50 hover:border-primary/30 transition-colors`,children:[(0,L.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-primary toggle-sm`,checked:Y,onChange:e=>xe(e.target.checked)}),(0,L.jsxs)(`div`,{className:`flex-1`,children:[(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsx)(_,{className:`size-4 text-primary`}),(0,L.jsx)(`span`,{className:`text-sm font-medium`,children:`Discover existing issues`})]}),(0,L.jsx)(`p`,{className:`text-xs text-base-content/50 mt-0.5`,children:`Scan for TODOs, FIXMEs, and GitHub issues to import`})]})]})}),(0,L.jsx)(`div`,{className:`mt-3 w-full max-w-lg`,children:(0,L.jsx)(ce,{})})]}),Z===`Discover Issues`&&(0,L.jsx)(ee,{}),Z===`Domains`&&(0,L.jsx)(pe,{selectedDomains:W,setSelectedDomains:K,analysisResult:B}),Z===`Agents & Skills`&&(0,L.jsx)(me,{selectedDomains:W,selectedAgents:q,setSelectedAgents:ue,selectedSkills:J,setSelectedSkills:ve,existingAgents:Fe,existingSkills:Ie}),Z===`Effort`&&(0,L.jsx)(he,{efforts:O,setEfforts:k,pipeline:E,models:Q,setModels:Oe,modelsByProvider:Ee}),Z===`Workers & Theme`&&(0,L.jsx)(ge,{concurrency:j,setConcurrency:M,selectedTheme:N,setSelectedTheme:F}),Z===`Launch`&&(0,L.jsx)(_e,{config:Le,launching:h})]})}),d>0&&(0,L.jsxs)(`div`,{className:`relative z-10 p-4 pb-6 flex items-center max-w-2xl mx-auto w-full justify-between`,children:[d>0&&(0,L.jsxs)(`button`,{className:`btn btn-ghost gap-1`,onClick:Me,disabled:h,children:[(0,L.jsx)(te,{className:`size-4`}),` Back`]}),d<X-1?(0,L.jsxs)(`button`,{className:`btn btn-primary gap-1`,onClick:$,disabled:!Pe,children:[Z===`Discover Issues`?`Continue`:`Next`,` `,(0,L.jsx)(A,{className:`size-4`})]}):(0,L.jsx)(`button`,{className:`btn btn-primary btn-lg gap-2 animate-pulse-soft`,onClick:Ne,disabled:h,children:h?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(g,{className:`size-5 animate-spin`}),` Launching...`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(P,{className:`size-5`}),` Launch Fifony`]})})]})]})}export{ve as default};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,a as n,h as r}from"./vendor-BoGBoEwT.js";import{d as i,t as a,x as o}from"./zap-BwZ-sPG7.js";import{C as s,_ as c,f as l,o as u,v as d}from"./index-BRWIoM5k.js";var f=e(t(),1),p=r();function m(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function h(e){return!e||e===0?`0`:e.toLocaleString()}function g({value:e,format:t=m,className:n=``}){let[r,i]=(0,f.useState)(()=>t(e)),a=(0,f.useRef)(e),o=(0,f.useRef)(null);return(0,f.useEffect)(()=>{let n=a.current||0,r=e||0;if(a.current=r,n===r){i(t(r));return}let s=performance.now(),c=e=>{let a=e-s,l=Math.min(a/600,1),u=1-(1-l)**3,d=n+(r-n)*u;i(t(Math.round(d))),l<1&&(o.current=requestAnimationFrame(c))};return cancelAnimationFrame(o.current),o.current=requestAnimationFrame(c),()=>cancelAnimationFrame(o.current)},[e,t]),(0,p.jsx)(`span`,{className:`${n} inline-block tabular-nums`,children:r})}var _=[{key:`planner`,label:`Plan`,color:`bg-info`,textColor:`text-info`},{key:`executor`,label:`Execute`,color:`bg-primary`,textColor:`text-primary`},{key:`reviewer`,label:`Review`,color:`bg-secondary`,textColor:`text-secondary`}];function v({byPhase:e}){if(!e)return null;let t=_.reduce((t,n)=>t+(e[n.key]?.totalTokens||0),0);return t===0?null:(0,p.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,p.jsx)(`div`,{className:`flex h-4 rounded-full overflow-hidden bg-base-300 w-full`,children:_.map(n=>{let r=e[n.key]?.totalTokens||0,i=r/t*100;return i===0?null:(0,p.jsx)(`div`,{className:`${n.color} opacity-80 transition-all duration-500`,style:{width:`${i}%`},title:`${n.label}: ${h(r)} (${Math.round(i)}%)`},n.key)})}),(0,p.jsx)(`div`,{className:`flex items-center gap-4 flex-wrap`,children:_.map(n=>{let r=e[n.key]?.totalTokens||0,i=t>0?Math.round(r/t*100):0;return r===0?null:(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,p.jsx)(`span`,{className:`inline-block w-3 h-3 rounded-full ${n.color} shrink-0`}),(0,p.jsx)(`span`,{className:`opacity-60`,children:n.label}),(0,p.jsx)(`span`,{className:`font-mono font-semibold`,children:m(r)}),(0,p.jsxs)(`span`,{className:`opacity-40`,children:[`(`,i,`%)`]})]},n.key)})})]})}function y({data:e,height:t=160}){if(!e||e.length===0)return null;let n=Math.max(...e.map(e=>e.totalTokens||0),1);return(0,p.jsx)(`div`,{className:`flex items-end gap-2 w-full`,style:{height:t},children:e.map((e,r)=>{let i=e.totalTokens||0,a=Math.max(2,Math.round(i/n*t)),o=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`}):`Day ${r+1}`,s=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`}):`${r+1}`;return(0,p.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-1.5 group`,children:[(0,p.jsx)(`span`,{className:`text-[10px] font-mono opacity-0 group-hover:opacity-70 transition-opacity`,children:m(i)}),(0,p.jsx)(`div`,{className:`w-full bg-primary rounded-t-md opacity-70 hover:opacity-100 transition-all duration-300 cursor-default`,style:{height:a},title:`${o}: ${h(i)} tokens`}),(0,p.jsx)(`span`,{className:`text-[10px] opacity-50`,children:s})]},e.date||r)})})}function b({data:e,valueKey:t=`totalTokens`,height:n=60,color:r=`stroke-primary`,label:i}){if(!e||e.length===0)return null;let a=e.map(e=>e[t]||e.count||0),o=Math.max(...a,1),s=a.map((e,t)=>`${t/Math.max(a.length-1,1)*200},${n-e/o*(n-4)-2}`).join(` `),c=a.reduce((e,t)=>e+t,0),l=a.length>0?Math.round(c/a.length):0,u=Math.max(...a);return(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 flex-1 min-w-0`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-xs font-medium opacity-60`,children:i}),(0,p.jsxs)(`span`,{className:`flex items-center gap-3 text-[10px] opacity-50`,children:[(0,p.jsxs)(`span`,{children:[`avg: `,(0,p.jsxs)(`span`,{className:`font-mono`,children:[m(l),`/h`]})]}),(0,p.jsxs)(`span`,{children:[`peak: `,(0,p.jsxs)(`span`,{className:`font-mono`,children:[m(u),`/h`]})]})]})]}),(0,p.jsxs)(`svg`,{viewBox:`0 0 200 ${n}`,className:`w-full`,style:{height:n},preserveAspectRatio:`none`,children:[(0,p.jsx)(`polyline`,{points:`0,${n} ${s} 200,${n}`,fill:`currentColor`,className:r.replace(`stroke-`,`text-`),opacity:`0.08`}),(0,p.jsx)(`polyline`,{points:s,fill:`none`,className:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`})]})]})}function x({byModel:e}){if(!e)return null;let t=Object.entries(e).map(([e,t])=>({model:e,inputTokens:t?.inputTokens||0,outputTokens:t?.outputTokens||0,totalTokens:t?.totalTokens||0})).sort((e,t)=>t.totalTokens-e.totalTokens);if(t.length===0)return null;let n=t.reduce((e,t)=>e+t.totalTokens,0);return(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`table table-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{children:`Model`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Input`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Output`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Total`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Share`})]})}),(0,p.jsx)(`tbody`,{children:t.map(e=>{let t=n>0?Math.round(e.totalTokens/n*100):0,r=e.model.includes(`claude`)?`bg-primary`:e.model.includes(`codex`)?`bg-secondary`:`bg-accent`;return(0,p.jsxs)(`tr`,{children:[(0,p.jsxs)(`td`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full ${r} shrink-0`}),(0,p.jsx)(`span`,{className:`font-mono text-xs`,children:e.model})]}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs`,children:m(e.inputTokens)}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs`,children:m(e.outputTokens)}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs font-semibold`,children:m(e.totalTokens)}),(0,p.jsx)(`td`,{className:`text-right`,children:(0,p.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,p.jsx)(`div`,{className:`w-12 h-1.5 bg-base-300 rounded-full overflow-hidden`,children:(0,p.jsx)(`div`,{className:`h-full ${r} rounded-full`,style:{width:`${t}%`}})}),(0,p.jsxs)(`span`,{className:`text-xs opacity-60 w-8 text-right`,children:[t,`%`]})]})})]},e.model)})})]})})}function S({topIssues:e}){return!e||e.length===0?null:(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`table table-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{className:`w-20`,children:`Issue`}),(0,p.jsx)(`th`,{children:`Title`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Tokens`}),(0,p.jsx)(`th`,{className:`hidden sm:table-cell`,children:`Phase Split`})]})}),(0,p.jsx)(`tbody`,{children:e.slice(0,10).map(e=>{let t=e.byPhase,n=e.totalTokens||0;return(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`td`,{className:`font-mono text-xs font-semibold text-primary`,children:e.identifier}),(0,p.jsx)(`td`,{className:`max-w-[200px] truncate text-sm`,title:e.title,children:e.title||`-`}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs font-semibold`,children:m(n)}),(0,p.jsx)(`td`,{className:`hidden sm:table-cell`,children:t?(0,p.jsx)(`div`,{className:`flex h-1.5 rounded-full overflow-hidden bg-base-300 w-24`,children:_.map(e=>{let r=t[e.key]?.totalTokens||0,i=n>0?r/n*100:0;return i===0?null:(0,p.jsx)(`div`,{className:`${e.color} opacity-80`,style:{width:`${i}%`},title:`${e.label}: ${m(r)}`},e.key)})}):(0,p.jsx)(`span`,{className:`opacity-30 text-xs`,children:`-`})})]},e.id||e.identifier)})})]})})}function C(){return(0,p.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3`,children:(0,p.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto space-y-6`,children:[(0,p.jsx)(`div`,{className:`skeleton-line h-8 w-48`}),(0,p.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:[...[,,,]].map((e,t)=>(0,p.jsx)(`div`,{className:`skeleton-card h-28`,style:{animationDelay:`${t*80}ms`}},t))}),(0,p.jsx)(`div`,{className:`skeleton-card h-52`}),(0,p.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,p.jsx)(`div`,{className:`skeleton-card h-32`}),(0,p.jsx)(`div`,{className:`skeleton-card h-32`})]}),(0,p.jsx)(`div`,{className:`skeleton-card h-64`})]})})}function w(){return(0,p.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-4 px-4 pb-20 animate-fade-in`,children:[(0,p.jsx)(u,{className:`size-16 opacity-15`}),(0,p.jsx)(`h2`,{className:`text-lg font-semibold opacity-60`,children:`No analytics data yet`}),(0,p.jsx)(`p`,{className:`text-sm opacity-40 text-center max-w-md`,children:`Token usage and pipeline metrics will appear here once issues start processing.`})]})}var T=n(`/analytics`)({component:E});function E(){let{data:e,isLoading:t}=o(),{data:n,isLoading:r}=i(24);if(t&&!e)return(0,p.jsx)(C,{});let f=e?.overall?.totalTokens||0,_=e?.byPhase||null,T=e?.byModel||{},E=e?.daily||[],D=e?.topIssues||[],O=n?.tokensPerHour||[],k=n?.eventsPerHour||[],A=new Date().toISOString().slice(0,10),j=E.find(e=>e.date===A)?.totalTokens||0,M=E.reduce((e,t)=>e+(t.totalTokens||0),0);return f===0&&E.length===0&&D.length===0?(0,p.jsx)(w,{}):(0,p.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3 overflow-y-auto`,children:(0,p.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto space-y-6 stagger-children`,children:[(0,p.jsx)(`section`,{children:(0,p.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:[(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-primary`,children:(0,p.jsx)(a,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Total Tokens`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,p.jsx)(g,{value:f})}),(0,p.jsx)(`div`,{className:`stat-desc font-mono`,children:h(f)})]}),(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-accent`,children:(0,p.jsx)(d,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Today`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,p.jsx)(g,{value:j})}),(0,p.jsxs)(`div`,{className:`stat-desc`,children:[`This week: `,m(M)]})]}),(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-info`,children:(0,p.jsx)(l,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Phase Split`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl p-0`,children:_?(0,p.jsx)(v,{byPhase:_}):(0,p.jsx)(`span`,{className:`opacity-30`,children:`-`})})]})]})}),E.length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,p.jsx)(u,{className:`size-4 text-primary`}),`Daily Token Usage`]}),(0,p.jsxs)(`span`,{className:`text-xs opacity-40`,children:[`Last `,E.length,` days`]})]}),(0,p.jsx)(y,{data:E,height:160})]}),(O.length>0||k.length>0)&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(s,{className:`size-4 text-secondary`}),`Hourly Activity (last 24h)`]}),(0,p.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[O.length>0&&(0,p.jsx)(b,{data:O,valueKey:`totalTokens`,height:60,color:`stroke-primary`,label:`Tokens / hour`}),k.length>0&&(0,p.jsx)(b,{data:k,valueKey:`count`,height:60,color:`stroke-secondary`,label:`Events / hour`})]})]}),D.length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(a,{className:`size-4 text-accent`}),`Top Issues by Token Usage`]}),(0,p.jsx)(S,{topIssues:D})]}),Object.keys(T).length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(c,{className:`size-4 text-info`}),`Model Breakdown`]}),(0,p.jsx)(x,{byModel:T})]})]})})}export{T as Route};
1
+ import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{I as t,a as n,h as r}from"./vendor-BoGBoEwT.js";import{d as i,t as a,x as o}from"./zap-BwZ-sPG7.js";import{C as s,_ as c,f as l,o as u,v as d}from"./index-CRG9kNAx.js";var f=e(t(),1),p=r();function m(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function h(e){return!e||e===0?`0`:e.toLocaleString()}function g({value:e,format:t=m,className:n=``}){let[r,i]=(0,f.useState)(()=>t(e)),a=(0,f.useRef)(e),o=(0,f.useRef)(null);return(0,f.useEffect)(()=>{let n=a.current||0,r=e||0;if(a.current=r,n===r){i(t(r));return}let s=performance.now(),c=e=>{let a=e-s,l=Math.min(a/600,1),u=1-(1-l)**3,d=n+(r-n)*u;i(t(Math.round(d))),l<1&&(o.current=requestAnimationFrame(c))};return cancelAnimationFrame(o.current),o.current=requestAnimationFrame(c),()=>cancelAnimationFrame(o.current)},[e,t]),(0,p.jsx)(`span`,{className:`${n} inline-block tabular-nums`,children:r})}var _=[{key:`planner`,label:`Plan`,color:`bg-info`,textColor:`text-info`},{key:`executor`,label:`Execute`,color:`bg-primary`,textColor:`text-primary`},{key:`reviewer`,label:`Review`,color:`bg-secondary`,textColor:`text-secondary`}];function v({byPhase:e}){if(!e)return null;let t=_.reduce((t,n)=>t+(e[n.key]?.totalTokens||0),0);return t===0?null:(0,p.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,p.jsx)(`div`,{className:`flex h-4 rounded-full overflow-hidden bg-base-300 w-full`,children:_.map(n=>{let r=e[n.key]?.totalTokens||0,i=r/t*100;return i===0?null:(0,p.jsx)(`div`,{className:`${n.color} opacity-80 transition-all duration-500`,style:{width:`${i}%`},title:`${n.label}: ${h(r)} (${Math.round(i)}%)`},n.key)})}),(0,p.jsx)(`div`,{className:`flex items-center gap-4 flex-wrap`,children:_.map(n=>{let r=e[n.key]?.totalTokens||0,i=t>0?Math.round(r/t*100):0;return r===0?null:(0,p.jsxs)(`span`,{className:`flex items-center gap-1.5 text-sm`,children:[(0,p.jsx)(`span`,{className:`inline-block w-3 h-3 rounded-full ${n.color} shrink-0`}),(0,p.jsx)(`span`,{className:`opacity-60`,children:n.label}),(0,p.jsx)(`span`,{className:`font-mono font-semibold`,children:m(r)}),(0,p.jsxs)(`span`,{className:`opacity-40`,children:[`(`,i,`%)`]})]},n.key)})})]})}function y({data:e,height:t=160}){if(!e||e.length===0)return null;let n=Math.max(...e.map(e=>e.totalTokens||0),1);return(0,p.jsx)(`div`,{className:`flex items-end gap-2 w-full`,style:{height:t},children:e.map((e,r)=>{let i=e.totalTokens||0,a=Math.max(2,Math.round(i/n*t)),o=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`}):`Day ${r+1}`,s=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`}):`${r+1}`;return(0,p.jsxs)(`div`,{className:`flex-1 flex flex-col items-center gap-1.5 group`,children:[(0,p.jsx)(`span`,{className:`text-[10px] font-mono opacity-0 group-hover:opacity-70 transition-opacity`,children:m(i)}),(0,p.jsx)(`div`,{className:`w-full bg-primary rounded-t-md opacity-70 hover:opacity-100 transition-all duration-300 cursor-default`,style:{height:a},title:`${o}: ${h(i)} tokens`}),(0,p.jsx)(`span`,{className:`text-[10px] opacity-50`,children:s})]},e.date||r)})})}function b({data:e,valueKey:t=`totalTokens`,height:n=60,color:r=`stroke-primary`,label:i}){if(!e||e.length===0)return null;let a=e.map(e=>e[t]||e.count||0),o=Math.max(...a,1),s=a.map((e,t)=>`${t/Math.max(a.length-1,1)*200},${n-e/o*(n-4)-2}`).join(` `),c=a.reduce((e,t)=>e+t,0),l=a.length>0?Math.round(c/a.length):0,u=Math.max(...a);return(0,p.jsxs)(`div`,{className:`flex flex-col gap-2 flex-1 min-w-0`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,p.jsx)(`span`,{className:`text-xs font-medium opacity-60`,children:i}),(0,p.jsxs)(`span`,{className:`flex items-center gap-3 text-[10px] opacity-50`,children:[(0,p.jsxs)(`span`,{children:[`avg: `,(0,p.jsxs)(`span`,{className:`font-mono`,children:[m(l),`/h`]})]}),(0,p.jsxs)(`span`,{children:[`peak: `,(0,p.jsxs)(`span`,{className:`font-mono`,children:[m(u),`/h`]})]})]})]}),(0,p.jsxs)(`svg`,{viewBox:`0 0 200 ${n}`,className:`w-full`,style:{height:n},preserveAspectRatio:`none`,children:[(0,p.jsx)(`polyline`,{points:`0,${n} ${s} 200,${n}`,fill:`currentColor`,className:r.replace(`stroke-`,`text-`),opacity:`0.08`}),(0,p.jsx)(`polyline`,{points:s,fill:`none`,className:r,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`})]})]})}function x({byModel:e}){if(!e)return null;let t=Object.entries(e).map(([e,t])=>({model:e,inputTokens:t?.inputTokens||0,outputTokens:t?.outputTokens||0,totalTokens:t?.totalTokens||0})).sort((e,t)=>t.totalTokens-e.totalTokens);if(t.length===0)return null;let n=t.reduce((e,t)=>e+t.totalTokens,0);return(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`table table-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{children:`Model`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Input`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Output`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Total`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Share`})]})}),(0,p.jsx)(`tbody`,{children:t.map(e=>{let t=n>0?Math.round(e.totalTokens/n*100):0,r=e.model.includes(`claude`)?`bg-primary`:e.model.includes(`codex`)?`bg-secondary`:`bg-accent`;return(0,p.jsxs)(`tr`,{children:[(0,p.jsxs)(`td`,{className:`flex items-center gap-2`,children:[(0,p.jsx)(`span`,{className:`inline-block w-2.5 h-2.5 rounded-full ${r} shrink-0`}),(0,p.jsx)(`span`,{className:`font-mono text-xs`,children:e.model})]}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs`,children:m(e.inputTokens)}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs`,children:m(e.outputTokens)}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs font-semibold`,children:m(e.totalTokens)}),(0,p.jsx)(`td`,{className:`text-right`,children:(0,p.jsxs)(`div`,{className:`flex items-center justify-end gap-1.5`,children:[(0,p.jsx)(`div`,{className:`w-12 h-1.5 bg-base-300 rounded-full overflow-hidden`,children:(0,p.jsx)(`div`,{className:`h-full ${r} rounded-full`,style:{width:`${t}%`}})}),(0,p.jsxs)(`span`,{className:`text-xs opacity-60 w-8 text-right`,children:[t,`%`]})]})})]},e.model)})})]})})}function S({topIssues:e}){return!e||e.length===0?null:(0,p.jsx)(`div`,{className:`overflow-x-auto`,children:(0,p.jsxs)(`table`,{className:`table table-sm`,children:[(0,p.jsx)(`thead`,{children:(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`th`,{className:`w-20`,children:`Issue`}),(0,p.jsx)(`th`,{children:`Title`}),(0,p.jsx)(`th`,{className:`text-right`,children:`Tokens`}),(0,p.jsx)(`th`,{className:`hidden sm:table-cell`,children:`Phase Split`})]})}),(0,p.jsx)(`tbody`,{children:e.slice(0,10).map(e=>{let t=e.byPhase,n=e.totalTokens||0;return(0,p.jsxs)(`tr`,{children:[(0,p.jsx)(`td`,{className:`font-mono text-xs font-semibold text-primary`,children:e.identifier}),(0,p.jsx)(`td`,{className:`max-w-[200px] truncate text-sm`,title:e.title,children:e.title||`-`}),(0,p.jsx)(`td`,{className:`text-right font-mono text-xs font-semibold`,children:m(n)}),(0,p.jsx)(`td`,{className:`hidden sm:table-cell`,children:t?(0,p.jsx)(`div`,{className:`flex h-1.5 rounded-full overflow-hidden bg-base-300 w-24`,children:_.map(e=>{let r=t[e.key]?.totalTokens||0,i=n>0?r/n*100:0;return i===0?null:(0,p.jsx)(`div`,{className:`${e.color} opacity-80`,style:{width:`${i}%`},title:`${e.label}: ${m(r)}`},e.key)})}):(0,p.jsx)(`span`,{className:`opacity-30 text-xs`,children:`-`})})]},e.id||e.identifier)})})]})})}function C(){return(0,p.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3`,children:(0,p.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto space-y-6`,children:[(0,p.jsx)(`div`,{className:`skeleton-line h-8 w-48`}),(0,p.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:[...[,,,]].map((e,t)=>(0,p.jsx)(`div`,{className:`skeleton-card h-28`,style:{animationDelay:`${t*80}ms`}},t))}),(0,p.jsx)(`div`,{className:`skeleton-card h-52`}),(0,p.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,p.jsx)(`div`,{className:`skeleton-card h-32`}),(0,p.jsx)(`div`,{className:`skeleton-card h-32`})]}),(0,p.jsx)(`div`,{className:`skeleton-card h-64`})]})})}function w(){return(0,p.jsxs)(`div`,{className:`flex-1 flex flex-col items-center justify-center gap-4 px-4 pb-20 animate-fade-in`,children:[(0,p.jsx)(u,{className:`size-16 opacity-15`}),(0,p.jsx)(`h2`,{className:`text-lg font-semibold opacity-60`,children:`No analytics data yet`}),(0,p.jsx)(`p`,{className:`text-sm opacity-40 text-center max-w-md`,children:`Token usage and pipeline metrics will appear here once issues start processing.`})]})}var T=n(`/analytics`)({component:E});function E(){let{data:e,isLoading:t}=o(),{data:n,isLoading:r}=i(24);if(t&&!e)return(0,p.jsx)(C,{});let f=e?.overall?.totalTokens||0,_=e?.byPhase||null,T=e?.byModel||{},E=e?.daily||[],D=e?.topIssues||[],O=n?.tokensPerHour||[],k=n?.eventsPerHour||[],A=new Date().toISOString().slice(0,10),j=E.find(e=>e.date===A)?.totalTokens||0,M=E.reduce((e,t)=>e+(t.totalTokens||0),0);return f===0&&E.length===0&&D.length===0?(0,p.jsx)(w,{}):(0,p.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3 overflow-y-auto`,children:(0,p.jsxs)(`div`,{className:`max-w-6xl w-full mx-auto space-y-6 stagger-children`,children:[(0,p.jsx)(`section`,{children:(0,p.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4`,children:[(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-primary`,children:(0,p.jsx)(a,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Total Tokens`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,p.jsx)(g,{value:f})}),(0,p.jsx)(`div`,{className:`stat-desc font-mono`,children:h(f)})]}),(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-accent`,children:(0,p.jsx)(d,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Today`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl`,children:(0,p.jsx)(g,{value:j})}),(0,p.jsxs)(`div`,{className:`stat-desc`,children:[`This week: `,m(M)]})]}),(0,p.jsxs)(`div`,{className:`stat bg-base-200 rounded-box`,children:[(0,p.jsx)(`div`,{className:`stat-figure text-info`,children:(0,p.jsx)(l,{className:`size-6`})}),(0,p.jsx)(`div`,{className:`stat-title`,children:`Phase Split`}),(0,p.jsx)(`div`,{className:`stat-value text-2xl p-0`,children:_?(0,p.jsx)(v,{byPhase:_}):(0,p.jsx)(`span`,{className:`opacity-30`,children:`-`})})]})]})}),E.length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2`,children:[(0,p.jsx)(u,{className:`size-4 text-primary`}),`Daily Token Usage`]}),(0,p.jsxs)(`span`,{className:`text-xs opacity-40`,children:[`Last `,E.length,` days`]})]}),(0,p.jsx)(y,{data:E,height:160})]}),(O.length>0||k.length>0)&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(s,{className:`size-4 text-secondary`}),`Hourly Activity (last 24h)`]}),(0,p.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[O.length>0&&(0,p.jsx)(b,{data:O,valueKey:`totalTokens`,height:60,color:`stroke-primary`,label:`Tokens / hour`}),k.length>0&&(0,p.jsx)(b,{data:k,valueKey:`count`,height:60,color:`stroke-secondary`,label:`Events / hour`})]})]}),D.length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(a,{className:`size-4 text-accent`}),`Top Issues by Token Usage`]}),(0,p.jsx)(S,{topIssues:D})]}),Object.keys(T).length>0&&(0,p.jsxs)(`section`,{className:`bg-base-200 rounded-box p-5`,children:[(0,p.jsxs)(`h2`,{className:`text-sm font-semibold flex items-center gap-2 mb-4`,children:[(0,p.jsx)(c,{className:`size-4 text-info`}),`Model Breakdown`]}),(0,p.jsx)(x,{byModel:T})]})]})})}export{T as Route};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KeyboardShortcutsHelp-CQA1n6E2.js","assets/rolldown-runtime-DF2fYuay.js","assets/vendor-BoGBoEwT.js","assets/createLucideIcon-DtZs0TX0.js","assets/OnboardingWizard-YrKTjlqQ.js","assets/zap-BwZ-sPG7.js","assets/analytics.lazy-BfFHdeTO.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/KeyboardShortcutsHelp-sSYMdYqB.js","assets/rolldown-runtime-DF2fYuay.js","assets/vendor-BoGBoEwT.js","assets/createLucideIcon-DtZs0TX0.js","assets/OnboardingWizard-G9YyAfeX.js","assets/zap-BwZ-sPG7.js","assets/analytics.lazy-_g7IhcIB.js"])))=>i.map(i=>d[i]);
2
2
  import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{A as t,C as n,D as r,E as i,F as a,I as o,M as s,N as c,O as l,P as u,S as d,T as f,_ as p,b as m,c as h,d as g,f as _,g as v,h as y,i as b,j as x,k as S,l as C,m as w,n as T,o as E,p as ee,r as D,s as O,t as k,u as te,v as ne,w as re,x as ie,y as A}from"./vendor-BoGBoEwT.js";import{A as j,C as ae,D as M,E as oe,O as N,S as se,T as ce,_ as le,a as ue,b as de,c as fe,d as P,f as pe,g as me,h as he,i as ge,k as F,l as _e,m as ve,n as ye,o as be,p as xe,r as Se,s as Ce,t as I,u as we,v as Te,w as L,x as Ee,y as De}from"./zap-BwZ-sPG7.js";import{t as R}from"./createLucideIcon-DtZs0TX0.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function Oe(e){return{onFetch:(t,r)=>{let i=t.options,a=t.fetchOptions?.meta?.fetchMore?.direction,o=t.state.data?.pages||[],s=t.state.data?.pageParams||[],c={pages:[],pageParams:[]},l=0,u=async()=>{let r=!1,u=e=>{ie(e,()=>t.signal,()=>r=!0)},f=re(t.options,t.fetchOptions),p=async(e,i,a)=>{if(r)return Promise.reject();if(i==null&&e.pages.length)return Promise.resolve(e);let o=await f((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:i,direction:a?`backward`:`forward`,meta:t.options.meta};return u(e),e})()),{maxPages:s}=t.options,c=a?n:d;return{pages:c(e.pages,o,s),pageParams:c(e.pageParams,i,s)}};if(a&&o.length){let e=a===`backward`,t=e?ke:z,n={pages:o,pageParams:s};c=await p(n,t(i,n),e)}else{let t=e??o.length;do{let e=l===0?s[0]??i.initialPageParam:z(i,c);if(l>0&&e==null)break;c=await p(c,e),l++}while(l<t)}return c};t.options.persister?t.fetchFn=()=>t.options.persister?.(u,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},r):t.fetchFn=u}}}function z(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function ke(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var Ae=class extends u{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new v({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=je(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=je(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=je(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=je(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){A.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>l(t,e))}findAll(e={}){return this.getAll().filter(t=>l(e,t))}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return A.batch(()=>Promise.all(e.map(e=>e.continue().catch(t))))}};function je(e){return e.options.scope?.id}var Me=class extends u{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let i=t.queryKey,a=t.queryHash??r(i,t),o=this.get(a);return o||(o=new p({client:e,queryKey:i,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(i)}),this.add(o)),o}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){A.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>S(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>S(e,t)):t}notify(e){A.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){A.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){A.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},Ne=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new Me,this.#t=e.mutationCache||new Ae,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=m.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=ne.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(s(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=f(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return A.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;A.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return A.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,n={}){let r={revert:!0,...n},i=A.batch(()=>this.#e.findAll(e).map(e=>e.cancel(r)));return Promise.all(i).then(t).catch(t)}invalidateQueries(e,t={}){return A.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,n={}){let r={...n,cancelRefetch:n.cancelRefetch??!0},i=A.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let n=e.fetch(void 0,r);return r.throwOnError||(n=n.catch(t)),e.state.fetchStatus===`paused`?Promise.resolve():n}));return Promise.all(i).then(t)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(s(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(t).catch(t)}fetchInfiniteQuery(e){return e.behavior=Oe(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(t).catch(t)}ensureInfiniteQueryData(e){return e.behavior=Oe(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return ne.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(i(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{x(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(i(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{x(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=r(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===c&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Pe=a(),B=e(o(),1),Fe={Running:{title:`Agent started`,icon:`play`,tag:`running`},Queued:{title:`Issue queued`,icon:`clock`,tag:`queued`},"In Review":{title:`Review needed`,icon:`eye`,tag:`review`},Done:{title:`Issue completed`,icon:`check`,tag:`done`,sound:!0},Blocked:{title:`Issue blocked`,icon:`alert`,tag:`blocked`,sound:!0},Cancelled:{title:`Issue cancelled`,icon:`x`,tag:`cancelled`},Interrupted:{title:`Agent interrupted`,icon:`pause`,tag:`interrupted`}},Ie=[1e4,5e4,1e5,5e5,1e6];function Le(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(0)}K`:String(e)}function Re(){return`Notification`in window?Notification.permission:`unsupported`}function ze(e,t,n){if(Re()===`granted`)try{new Notification(e,{body:t,tag:`fifony-${n}`,icon:`/icon.svg`,badge:`/icon.svg`,silent:!1})}catch{}}var Be=null;function Ve(){if(!Be)try{Be=new(window.AudioContext||window.webkitAudioContext)}catch{return null}return Be}var He=typeof window<`u`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches;function Ue(e){if(!e||He)return;let t=Ve();if(!t)return;let n=t.currentTime,r=.08,i=t.createOscillator(),a=t.createGain();i.type=`sine`,i.frequency.value=880,a.gain.setValueAtTime(r,n),a.gain.exponentialRampToValueAtTime(.001,n+.06),i.connect(a),a.connect(t.destination),i.start(n),i.stop(n+.06);let o=t.createOscillator(),s=t.createGain();o.type=`sine`,o.frequency.value=1100,s.gain.setValueAtTime(0,n),s.gain.setValueAtTime(r,n+.07),s.gain.exponentialRampToValueAtTime(.001,n+.15),o.connect(s),s.connect(t.destination),o.start(n+.07),o.stop(n+.15)}var We=0;function Ge(e){let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)(0),a=(0,B.useCallback)(e=>{let t=++We,r={id:t,...e,timestamp:Date.now(),read:!1};return n(e=>[r,...e].slice(0,30)),i(e=>e+1),t},[]),o=(0,B.useCallback)(e=>{n(t=>{let n=t.find(t=>t.id===e);return n&&!n.read&&i(e=>Math.max(0,e-1)),t.filter(t=>t.id!==e)})},[]),s=(0,B.useCallback)(()=>{n(e=>e.map(e=>e.read?e:{...e,read:!0})),i(0)},[]);return(0,B.useEffect)(()=>{let e=setInterval(()=>{let e=Date.now()-300*1e3;n(t=>t.filter(t=>!t.read||t.timestamp>e))},3e4);return()=>clearInterval(e)},[]),{notifications:t,unreadCount:r,addNotification:a,dismissNotification:o,markAllRead:s}}function Ke(e){let[t,n]=se(),[r,i]=(0,B.useState)(Re),a=(0,B.useRef)(new Map),o=(0,B.useRef)(new Map),s=Ge(e),c=(0,B.useCallback)(e=>{n(e)},[]),l=(0,B.useCallback)(async()=>{if(!(`Notification`in window))return`unsupported`;let e=await Notification.requestPermission();return i(e),e===`granted`&&c(!0),e},[c]);return(0,B.useEffect)(()=>{if(!t||r!==`granted`||!Array.isArray(e))return;let n=a.current,i=new Map;for(let r of e){i.set(r.id,r.state);let e=n.get(r.id);if(e&&e!==r.state){let e=Fe[r.state];if(e){let n=`${e.title}: ${r.identifier}`,i=r.title;ze(n,i,`${e.tag}-${r.id}`),s.addNotification({title:n,body:i,state:r.state,icon:e.icon,issueId:r.id}),e.sound&&Ue(t)}}let a=r.tokenUsage?.totalTokens;if(typeof a==`number`&&a>0){o.current.has(r.id)||o.current.set(r.id,new Set);let e=o.current.get(r.id);for(let t of Ie)if(a>=t&&!e.has(t)&&(e.add(t),n.size>0)){let e=Le(t),n=`Token milestone: ${e}`,i=`${r.identifier} has used ${e} tokens`;ze(n,i,`tokens-${t}-${r.id}`),s.addNotification({title:n,body:i,state:`token-milestone`,icon:`zap`,issueId:r.id})}}}a.current=i},[e,t,r,s.addNotification]),{enabled:t,setEnabled:c,permission:r,supported:`Notification`in window,requestPermission:l,...s}}var V=y(),qe=(0,B.createContext)(null),Je=[`all`,`info`,`state`,`progress`,`error`,`manual`,`runner`],Ye=new Set([`recent`,`all`]);function Xe(){let e=(0,B.useContext)(qe);if(!e)throw Error(`useDashboard must be used within DashboardProvider`);return e}function Ze({children:e}){let[t,n]=de(),[r,i]=ae(Ce,`all`,{normalize:e=>e===`all`||oe.includes(e)?e:`all`}),[a,o]=ae(ue,`all`,{normalize:e=>typeof e==`string`&&e.trim()?e:`all`}),[s,c]=ae(be,`recent`,{normalize:e=>Ye.has(e)?e:`recent`}),[l,u]=(0,B.useState)(``),[d,f]=ae(ge,`all`,{normalize:e=>Je.includes(e)?e:`all`}),[p,m]=ae(Se,`all`,{normalize:e=>typeof e==`string`&&e.trim()?e:`all`}),[h,_]=(0,B.useState)(`2`),[v,y]=(0,B.useState)(null),[b,x]=(0,B.useState)(!1),[S,C]=(0,B.useState)(null),[T,E]=(0,B.useState)(!1),[ee,D]=(0,B.useState)(null),[O,k]=(0,B.useState)(!1),[te,ne]=(0,B.useState)([]),re=he(),ie=w(),A=Te((0,B.useCallback)(e=>{Array.isArray(e?.events)&&ne(e.events)},[])),j=A===`connected`,M=le({pollInterval:j?1e4:3e3,showAll:s===`all`}),N=me(d,p,j?1e4:2500),se=xe(),ce=pe(),fe=ve(),P=M.data||{},F=Array.isArray(P.issues)?P.issues:[],_e=P.metrics||{},ye=j||P.config?`ok`:`offline`,I=j?te:N.data?.events||[],we=(0,B.useMemo)(()=>ee&&F.find(e=>e.id===ee)||null,[ee,F]),Ee=(0,B.useCallback)(e=>{D(e?.id||null)},[]),De=(0,B.useMemo)(()=>{let e=l.toLowerCase();return F.filter(t=>!(r!==`all`&&t.state!==r||a!==`all`&&(t.capabilityCategory||`default`)!==a||e&&!`${t.identifier} ${t.title} ${t.description||``}`.toLowerCase().includes(e)))},[F,r,a,l]),R=(0,B.useMemo)(()=>[`all`,...[...new Set(F.map(e=>e.capabilityCategory).filter(Boolean))].sort()],[F]),Oe=(0,B.useMemo)(()=>[...new Set(F.map(e=>e.id))].sort(),[F]);(0,B.useEffect)(()=>{a!==`all`&&!R.includes(a)&&o(`all`)},[a,R,o]),(0,B.useEffect)(()=>{p!==`all`&&!Oe.includes(p)&&m(`all`)},[p,Oe,m]);let z=(0,B.useCallback)((e,t=`info`)=>{x(!1),y({message:typeof e==`string`?e:String(e),type:t}),setTimeout(()=>{x(!0),setTimeout(()=>{y(null),x(!1)},250)},3e3)},[]),ke=(0,B.useCallback)((e,t,n)=>{C({x:e??window.innerWidth/2,y:t??window.innerHeight/3,count:n??24})},[]),Ae=(0,B.useCallback)(()=>C(null),[]),je=g({mutationFn:e=>L.post(`/issues/create`,e),onSuccess:()=>{ie.invalidateQueries({queryKey:[`runtime-state`]}),E(!1),z(`Issue created`,`success`),ke()},onError:e=>z(e.message,`error`)}),Me=g({mutationFn:({id:e,state:t})=>L.post(`/issues/${encodeURIComponent(e)}/state`,{state:t}),onSuccess:()=>{ie.invalidateQueries({queryKey:[`runtime-state`]}),z(`State updated`,`success`)},onError:e=>z(e.message,`error`)}),Ne=g({mutationFn:e=>L.post(`/issues/${encodeURIComponent(e)}/retry`),onSuccess:()=>ie.invalidateQueries({queryKey:[`runtime-state`]}),onError:e=>z(e.message)}),Pe=g({mutationFn:e=>L.post(`/issues/${encodeURIComponent(e)}/cancel`),onSuccess:()=>ie.invalidateQueries({queryKey:[`runtime-state`]}),onError:e=>z(e.message)}),Fe=g({mutationFn:()=>L.post(`/refresh`,{}),onSuccess:()=>ie.invalidateQueries(),onError:e=>z(e.message)}),Ie=g({mutationFn:()=>L.post(`/config/concurrency`,{concurrency:parseInt(h,10)}),onSuccess:()=>{ie.invalidateQueries({queryKey:[`runtime-state`]}),z(`Concurrency updated`,`success`)},onError:e=>z(e.message,`error`)});(0,B.useEffect)(()=>{P.config?.workerConcurrency&&_(String(P.config.workerConcurrency))},[P.config?.workerConcurrency]);let Le=(0,B.useCallback)(()=>k(e=>!e),[]),Re=Ke(F),ze=(0,B.useRef)(new Map);(0,B.useEffect)(()=>{let e=ze.current;for(let t of F){let n=e.get(t.id);if(n&&n!==`Done`&&t.state===`Done`){let e=document.querySelector(`[data-issue-id="${t.id}"]`);if(e){let t=e.getBoundingClientRect();ke(t.left+t.width/2,t.top+t.height/2,12)}else ke(void 0,void 0,12)}}let t=new Map;for(let e of F)t.set(e.id,e.state);ze.current=t},[F,ke]);let Be=(0,B.useMemo)(()=>({theme:t,setTheme:n,status:ye,wsStatus:A,liveMode:j,data:P,issues:F,filtered:De,metrics:_e,eventsData:I,providers:se,parallelism:ce,providersUsage:fe,categoryOptions:R,issueOptions:Oe,runtime:M,query:l,setQuery:u,stateFilter:r,setStateFilter:i,categoryFilter:a,setCategoryFilter:o,completionFilter:s,setCompletionFilter:c,isEventsOpen:O,toggleEvents:Le,setIsEventsOpen:k,eventKind:d,setEventKind:f,eventIssueId:p,setEventIssueId:m,isCreateOpen:T,setIsCreateOpen:E,createIssue:je,selectedIssue:we,setSelectedIssue:Ee,updateState:(e,t)=>Me.mutate({id:e,state:t}),retryIssue:e=>Ne.mutate(e),cancelIssue:e=>Pe.mutate(e),refresh:()=>Fe.mutate(),concurrency:h,setConcurrency:_,saveConcurrency:()=>Ie.mutate(),saveConcPending:Ie.isPending,pwa:re,notifications:Re,toast:v,toastExiting:b,showToast:z,confetti:S,showConfetti:ke,clearConfetti:Ae}),[t,ye,A,j,P,F,De,_e,I,se,ce,fe,R,Oe,M,l,r,a,s,O,d,p,T,we,h,v,b,S,re,Re,n,u,i,o,c,Le,k,f,m,E,Ee,_,z,ke,Ae,je,Me,Ne,Pe,Fe,Ie]);return(0,V.jsx)(qe.Provider,{value:Be,children:e})}var Qe=R(`activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),$e=R(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),et=R(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),tt=R(`arrow-right`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),nt=R(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),rt=R(`ban`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M4.929 4.929 19.07 19.071`,key:`196cmz`}]]),it=R(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),at=R(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),ot=R(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),st=R(`bot`,[[`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`}]]),ct=R(`bug`,[[`path`,{d:`M12 20v-9`,key:`1qisl0`}],[`path`,{d:`M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z`,key:`uouzyp`}],[`path`,{d:`M14.12 3.88 16 2`,key:`qol33r`}],[`path`,{d:`M21 21a4 4 0 0 0-3.81-4`,key:`1b0z45`}],[`path`,{d:`M21 5a4 4 0 0 1-3.55 3.97`,key:`5cxbf6`}],[`path`,{d:`M22 13h-4`,key:`1jl80f`}],[`path`,{d:`M3 21a4 4 0 0 1 3.81-4`,key:`1fjd4g`}],[`path`,{d:`M3 5a4 4 0 0 0 3.55 3.97`,key:`1d7oge`}],[`path`,{d:`M6 13H2`,key:`82j7cp`}],[`path`,{d:`m8 2 1.88 1.88`,key:`fmnt4t`}],[`path`,{d:`M9 7.13V6a3 3 0 1 1 6 0v1.13`,key:`1vgav8`}]]),lt=R(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),ut=R(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),dt=R(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),ft=R(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),pt=R(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),mt=R(`circle-check-big`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),H=R(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ht=R(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),gt=R(`circle-play`,[[`path`,{d:`M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z`,key:`kmsa83`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),_t=R(`circle-user`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`10`,r:`3`,key:`ilqhr7`}],[`path`,{d:`M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662`,key:`154egf`}]]),vt=R(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),yt=R(`circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),bt=R(`clipboard-check`,[[`rect`,{width:`8`,height:`4`,x:`8`,y:`2`,rx:`1`,ry:`1`,key:`tgr4d6`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2`,key:`116196`}],[`path`,{d:`m9 14 2 2 4-4`,key:`df797q`}]]),xt=R(`clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}]]),St=R(`code`,[[`path`,{d:`m16 18 6-6-6-6`,key:`eg8j8`}],[`path`,{d:`m8 6-6 6 6 6`,key:`ppft3o`}]]),Ct=R(`coins`,[[`path`,{d:`M13.744 17.736a6 6 0 1 1-7.48-7.48`,key:`bq4yh3`}],[`path`,{d:`M15 6h1v4`,key:`11y1tn`}],[`path`,{d:`m6.134 14.768.866-.5 2 3.464`,key:`17snzx`}],[`circle`,{cx:`16`,cy:`8`,r:`6`,key:`14bfc9`}]]),wt=R(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),Tt=R(`cpu`,[[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M17 20v2`,key:`1rnc9c`}],[`path`,{d:`M17 2v2`,key:`11trls`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M2 17h2`,key:`7oei6x`}],[`path`,{d:`M2 7h2`,key:`asdhe0`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`M20 17h2`,key:`1fpfkl`}],[`path`,{d:`M20 7h2`,key:`1o8tra`}],[`path`,{d:`M7 20v2`,key:`4gnj0m`}],[`path`,{d:`M7 2v2`,key:`1i4yhu`}],[`rect`,{x:`4`,y:`4`,width:`16`,height:`16`,rx:`2`,key:`1vbyd7`}],[`rect`,{x:`8`,y:`8`,width:`8`,height:`8`,rx:`1`,key:`z9xiuo`}]]),Et=R(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),U=R(`eye`,[[`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`}]]),Dt=R(`file-code`,[[`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`}]]),Ot=R(`file-text`,[[`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`}]]),kt=R(`folder-open`,[[`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`}]]),At=R(`folder`,[[`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`}]]),jt=R(`funnel`,[[`path`,{d:`M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z`,key:`sc7q7i`}]]),Mt=R(`gauge`,[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]),Nt=R(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),Pt=R(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),Ft=R(`github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),It=R(`hash`,[[`line`,{x1:`4`,x2:`20`,y1:`9`,y2:`9`,key:`4lhtct`}],[`line`,{x1:`4`,x2:`20`,y1:`15`,y2:`15`,key:`vyu0kd`}],[`line`,{x1:`10`,x2:`8`,y1:`3`,y2:`21`,key:`1ggp8o`}],[`line`,{x1:`16`,x2:`14`,y1:`3`,y2:`21`,key:`weycgp`}]]),Lt=R(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),Rt=R(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),zt=R(`info`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 16v-4`,key:`1dtifu`}],[`path`,{d:`M12 8h.01`,key:`e9boi3`}]]),Bt=R(`kanban`,[[`path`,{d:`M5 3v14`,key:`9nsxs2`}],[`path`,{d:`M12 3v8`,key:`1h2ygw`}],[`path`,{d:`M19 3v18`,key:`1sk56x`}]]),Vt=R(`layers`,[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]]),W=R(`lightbulb`,[[`path`,{d:`M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5`,key:`1gvzjb`}],[`path`,{d:`M9 18h6`,key:`x1upvd`}],[`path`,{d:`M10 22h4`,key:`ceow96`}]]),Ht=R(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),Ut=R(`list-ordered`,[[`path`,{d:`M11 5h10`,key:`1cz7ny`}],[`path`,{d:`M11 12h10`,key:`1438ji`}],[`path`,{d:`M11 19h10`,key:`11t30w`}],[`path`,{d:`M4 4h1v5`,key:`10yrso`}],[`path`,{d:`M4 9h2`,key:`r1h2o0`}],[`path`,{d:`M6.5 20H3.4c0-1 2.6-1.925 2.6-3.5a1.5 1.5 0 0 0-2.6-1.02`,key:`xtkcd5`}]]),Wt=R(`list-todo`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`rect`,{x:`3`,y:`4`,width:`6`,height:`6`,rx:`1`,key:`cif1o7`}]]),G=R(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Gt=R(`loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Kt=R(`message-square`,[[`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`}]]),qt=R(`moon`,[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]),Jt=R(`music`,[[`path`,{d:`M9 18V5l12-2v13`,key:`1jmyc2`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`circle`,{cx:`18`,cy:`16`,r:`3`,key:`1hluhg`}]]),Yt=R(`palette`,[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`,key:`e79jfc`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`,key:`1okk4w`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`,key:`f64h9f`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`,key:`qy21gx`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`fotxhn`}]]),Xt=R(`pause`,[[`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`}]]),Zt=R(`play`,[[`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`}]]),Qt=R(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),$t=R(`radio`,[[`path`,{d:`M16.247 7.761a6 6 0 0 1 0 8.478`,key:`1fwjs5`}],[`path`,{d:`M19.075 4.933a10 10 0 0 1 0 14.134`,key:`ehdyv1`}],[`path`,{d:`M4.925 19.067a10 10 0 0 1 0-14.134`,key:`1q22gi`}],[`path`,{d:`M7.753 16.239a6 6 0 0 1 0-8.478`,key:`r2q7qm`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}]]),en=R(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),K=R(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),tn=R(`route`,[[`circle`,{cx:`6`,cy:`19`,r:`3`,key:`1kj8tv`}],[`path`,{d:`M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15`,key:`1d8sl`}],[`circle`,{cx:`18`,cy:`5`,r:`3`,key:`gq8acd`}]]),nn=R(`search`,[[`path`,{d:`m21 21-4.34-4.34`,key:`14j7rj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}]]),rn=R(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),an=R(`sliders-vertical`,[[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M12 21v-9`,key:`17s77i`}],[`path`,{d:`M12 8V3`,key:`13r4qs`}],[`path`,{d:`M17 16h4`,key:`h1uq16`}],[`path`,{d:`M19 12V3`,key:`o1uvq1`}],[`path`,{d:`M19 21v-5`,key:`qua636`}],[`path`,{d:`M3 14h4`,key:`bcjad9`}],[`path`,{d:`M5 10V3`,key:`cb8scm`}],[`path`,{d:`M5 21v-7`,key:`1w1uti`}]]),on=R(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),sn=R(`sparkles`,[[`path`,{d:`M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z`,key:`1s2grr`}],[`path`,{d:`M20 2v4`,key:`1rf3ol`}],[`path`,{d:`M22 4h-4`,key:`gwowj6`}],[`circle`,{cx:`4`,cy:`20`,r:`2`,key:`6kqj1y`}]]),cn=R(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),ln=R(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),un=R(`sun`,[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]),dn=R(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),fn=R(`terminal`,[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]),pn=R(`thumbs-down`,[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]),mn=R(`thumbs-up`,[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]),hn=R(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),gn=R(`trending-up`,[[`path`,{d:`M16 7h6v6`,key:`box55l`}],[`path`,{d:`m22 7-8.5 8.5-5-5L2 17`,key:`1t1m79`}]]),q=R(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),_n=R(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),vn=R(`wand-sparkles`,[[`path`,{d:`m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72`,key:`ul74o6`}],[`path`,{d:`m14 7 3 3`,key:`1r5n42`}],[`path`,{d:`M5 6v4`,key:`ilb8ba`}],[`path`,{d:`M19 14v4`,key:`blhpug`}],[`path`,{d:`M10 2v2`,key:`7u0qdc`}],[`path`,{d:`M7 8H3`,key:`zfb6yr`}],[`path`,{d:`M21 16h-4`,key:`1cnmox`}],[`path`,{d:`M11 3H9`,key:`1obp7u`}]]),yn=R(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),bn=R(`wifi`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M2 8.82a15 15 0 0 1 20 0`,key:`dnpr2z`}],[`path`,{d:`M5 12.859a10 10 0 0 1 14 0`,key:`1x1e6c`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}]]),xn=R(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),J=R(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),Sn={Running:Zt,Queued:xt,"In Review":U,Done:mt,Blocked:q,Cancelled:vt,Interrupted:Xt,"token-milestone":I},Cn={Running:`text-info`,Queued:`text-warning`,"In Review":`text-accent`,Done:`text-success`,Blocked:`text-error`,Cancelled:`text-base-content/40`,Interrupted:`text-warning`,"token-milestone":`text-secondary`},wn={Running:`bg-info/8`,Queued:`bg-warning/8`,"In Review":`bg-accent/8`,Done:`bg-success/8`,Blocked:`bg-error/8`,Cancelled:`bg-base-200`,Interrupted:`bg-warning/8`,"token-milestone":`bg-secondary/8`};function Tn(){let[e,t]=(0,B.useState)(()=>window.innerWidth<768);return(0,B.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function En({notif:e,onDismiss:t}){let n=Sn[e.state]||at,r=Cn[e.state]||`text-base-content`,i=e.read?``:wn[e.state]||``,a=e.title?.match(/(.*?):\s*(#\S+|[A-Z]+-\d+)$/),o=a?a[1]:e.title,s=a?a[2]:null;return(0,V.jsxs)(`li`,{className:`group relative px-3 py-2.5 transition-colors
3
3
  ${e.read?`opacity-50`:``}
4
4
  ${i}
@@ -35,8 +35,8 @@ import{n as e}from"./rolldown-runtime-DF2fYuay.js";import{A as t,C as n,D as r,E
35
35
 
36
36
  ## Why Now
37
37
 
38
- `}];function Un({open:e,onClose:t,onSubmit:n,isLoading:r,onToast:i}){let[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(`blank`),[d,f]=(0,B.useState)({title:!1,description:!1}),p=(0,B.useRef)(null),m=(0,B.useRef)(null),h=(0,B.useCallback)(e=>{let t=Hn.find(t=>t.id===e);t&&((a.trim()||s.trim())&&e!==`blank`&&!window.confirm(`Replace current content with template?`)||(u(e),o(t.title),c(t.description),setTimeout(()=>p.current?.focus(),50)))},[a,s]),{ref:g,handlers:_}=Vn({onDismiss:(0,B.useCallback)(()=>t(),[t]),direction:`right`});(0,B.useEffect)(()=>{e&&(o(``),c(``),u(`blank`),setTimeout(()=>p.current?.focus(),100))},[e]),(0,B.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]),(0,B.useEffect)(()=>{if(!e)return;history.pushState({drawer:`create-issue`},``);let n=e=>{e.state?.drawer!==`create-issue`&&t()};return window.addEventListener(`popstate`,n),()=>window.removeEventListener(`popstate`,n)},[e,t]);let v=e=>{e.preventDefault(),a.trim()&&n({title:a.trim(),description:s.trim()})},y=async e=>{if(!(!a.trim()&&e===`description`)){f(t=>({...t,[e]:!0}));try{let t=await L.post(`/issues/enhance`,{field:e,title:a.trim(),description:s.trim()});if(t.ok&&typeof t.value==`string`&&t.value.trim())e===`title`?o(t.value.trim()):c(t.value.trim()),i?.(`Enhanced ${e}`,`success`);else throw Error(t.error||`No enhanced value returned.`)}catch(e){i?.(e instanceof Error?e.message:`Enhance failed`,`error`)}finally{f(t=>({...t,[e]:!1}))}}};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-40 transition-opacity duration-200 ${e?`opacity-100`:`opacity-0 pointer-events-none`}`,onClick:t}),(0,V.jsx)(`div`,{ref:g,className:`fixed top-0 right-0 h-full z-50 bg-base-100 shadow-2xl transition-transform duration-300 ease-out
38
+ `}];function Un({open:e,onClose:t,onSubmit:n,isLoading:r,onToast:i}){let[a,o]=(0,B.useState)(``),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(`blank`),[d,f]=(0,B.useState)({title:!1,description:!1}),p=(0,B.useRef)(null),m=(0,B.useRef)(null),h=(0,B.useCallback)(e=>{let t=Hn.find(t=>t.id===e);t&&(u(e),o(t.title),c(t.description),setTimeout(()=>p.current?.focus(),50))},[]),{ref:g,handlers:_}=Vn({onDismiss:(0,B.useCallback)(()=>t(),[t]),direction:`right`});(0,B.useEffect)(()=>{e&&(o(``),c(``),u(`blank`),setTimeout(()=>p.current?.focus(),100))},[e]),(0,B.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[e,t]);let v=e=>{e.preventDefault(),a.trim()&&n({title:a.trim(),description:s.trim()})},y=async e=>{if(!(!a.trim()&&e===`description`)){f(t=>({...t,[e]:!0}));try{let t=await L.post(`/issues/enhance`,{field:e,title:a.trim(),description:s.trim()});if(t.ok&&typeof t.value==`string`&&t.value.trim())e===`title`?o(t.value.trim()):c(t.value.trim()),i?.(`Enhanced ${e}`,`success`);else throw Error(t.error||`No enhanced value returned.`)}catch(e){i?.(e instanceof Error?e.message:`Enhance failed`,`error`)}finally{f(t=>({...t,[e]:!1}))}}};return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-40 transition-opacity duration-200 ${e?`opacity-100`:`opacity-0 pointer-events-none`}`,onClick:t}),(0,V.jsx)(`div`,{ref:g,className:`fixed top-0 right-0 h-full z-50 bg-base-100 shadow-2xl transition-transform duration-300 ease-out
39
39
  w-full md:w-[480px] ${e?`translate-x-0`:`translate-x-full`}`,..._,children:(0,V.jsxs)(`form`,{onSubmit:v,className:`flex flex-col h-full`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between px-6 py-4 border-b border-base-300`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(W,{className:`size-5 opacity-60`}),(0,V.jsx)(`h2`,{className:`text-lg font-bold`,children:`New Issue`})]}),(0,V.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost btn-circle`,onClick:t,children:(0,V.jsx)(J,{className:`size-4`})})]}),(0,V.jsxs)(`div`,{ref:m,className:`flex-1 overflow-y-auto px-6 py-6 space-y-4 drawer-safe-bottom ${e?`stagger-children`:``}`,children:[(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:Hn.map(e=>{let t=e.icon;return(0,V.jsxs)(`button`,{type:`button`,className:`btn btn-xs gap-1 ${l===e.id?`btn-primary`:`btn-ghost`}`,onClick:()=>h(e.id),children:[(0,V.jsx)(t,{className:`size-3`}),e.label]},e.id)})}),(0,V.jsxs)(`div`,{className:`form-control`,children:[(0,V.jsxs)(`label`,{className:`label justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`label-text font-medium`,children:`What needs to be done?`}),(0,V.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-secondary gap-1`,onClick:()=>y(`title`),disabled:d.title||r||!a.trim(),children:[d.title?(0,V.jsx)(G,{className:`size-3 animate-spin`}):(0,V.jsx)(sn,{className:`size-3`}),`Enhance`]})]}),(0,V.jsx)(`input`,{ref:p,className:`input input-bordered w-full`,placeholder:`Fix the login redirect bug`,value:a,onChange:e=>o(e.target.value),required:!0})]}),(0,V.jsxs)(`div`,{className:`form-control`,children:[(0,V.jsxs)(`label`,{className:`label justify-between gap-2`,children:[(0,V.jsx)(`span`,{className:`label-text font-medium`,children:`Context & details`}),(0,V.jsxs)(`button`,{type:`button`,className:`btn btn-xs btn-soft btn-secondary gap-1`,onClick:()=>y(`description`),disabled:d.description||r||!a.trim(),children:[d.description?(0,V.jsx)(G,{className:`size-3 animate-spin`}):(0,V.jsx)(sn,{className:`size-3`}),`Enhance`]})]}),(0,V.jsx)(`textarea`,{className:`textarea textarea-bordered w-full min-h-32`,placeholder:`Describe the problem, expected behavior, acceptance criteria...`,value:s,onChange:e=>c(e.target.value)})]}),(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 text-xs opacity-60 space-y-1`,children:[(0,V.jsxs)(`p`,{children:[`The issue will be created in `,(0,V.jsx)(`strong`,{children:`Planning`}),` state.`]}),(0,V.jsx)(`p`,{children:`Open it to generate an AI plan, review it, then approve to start execution.`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-2 px-6 py-4 border-t border-base-300 max-sm:flex-col-reverse`,style:{paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 1rem)`},children:[(0,V.jsx)(`button`,{type:`button`,className:`btn btn-ghost max-sm:w-full`,onClick:t,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`submit`,className:`btn btn-primary gap-1.5 max-sm:w-full`,disabled:r||!a.trim(),children:[r?(0,V.jsx)(G,{className:`size-4 animate-spin`}):(0,V.jsx)(W,{className:`size-4`}),r?`Creating...`:`Create Issue`]})]})]})})]})}var Wn=`runtime.workflowConfig`;function Gn(e){return!!e&&typeof e==`object`&&typeof e.provider==`string`&&typeof e.model==`string`&&typeof e.effort==`string`}function Kn(e){let t=fe(_e(e),Wn,null);return!t||typeof t!=`object`?null:Gn(t.plan)&&Gn(t.execute)&&Gn(t.review)?t:null}function qn(){let e=Kn(De().data),t=_({queryKey:[`workflow-config`],queryFn:()=>L.get(`/config/workflow`),enabled:!e,staleTime:6e4});return{...t,data:e?{ok:!0,workflow:e,isDefault:!1}:t.data}}function Jn(e){let[t,n]=(0,B.useState)(()=>Yn(e)),r=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!e){n(null);return}let t=()=>n(Yn(e));t();let i=new Date(e).getTime(),a=()=>Date.now()-i<12e4?1e3:5e3,o=()=>{t(),clearInterval(r.current),r.current=setInterval(o,a())};return r.current=setInterval(o,a()),()=>clearInterval(r.current)},[e]),t}function Yn(e){if(!e)return null;let t=new Date(e).getTime();if(Number.isNaN(t))return null;let n=Math.max(0,Date.now()-t);return n<1e3?`0s`:n<6e4?`${Math.floor(n/1e3)}s`:n<36e5?`${Math.floor(n/6e4)}m ${Math.floor(n%6e4/1e3)}s`:`${Math.floor(n/36e5)}h ${Math.floor(n%36e5/6e4)}m`}function Xn(e){let{state:t,planningStatus:n,assignedToWorker:r,startedAt:i,tokenUsage:a,tokensByPhase:o}=e;switch(t){case`Planning`:return n===`planning`?{label:`Generating plan...`,icon:Gt,color:`text-info`,spin:!0}:n===`refining`?{label:`Refining plan...`,icon:Gt,color:`text-info`,spin:!0}:e.plan?{label:`Plan ready`,icon:W,color:`text-info`,spin:!1}:{label:`Awaiting plan`,icon:W,color:`text-info/60`,spin:!1};case`Todo`:return{label:`Ready to queue`,icon:Ut,color:`text-warning/70`,spin:!1};case`Queued`:return r?{label:`Worker assigned, starting...`,icon:Zt,color:`text-primary`,spin:!1,pulse:!0}:{label:`Waiting for worker slot...`,icon:xt,color:`text-info/70`,spin:!1};case`Running`:{let e=Zn(o),t=a?.totalTokens>0;return!t&&!i?{label:`Spawning agent...`,icon:Gt,color:`text-primary`,spin:!0}:t?e===`Reviewing`?{label:`Agent reviewing...`,icon:U,color:`text-secondary`,spin:!1,pulse:!0}:e===`Planning`?{label:`Agent planning...`,icon:W,color:`text-info`,spin:!1,pulse:!0}:{label:`Agent working...`,icon:Zt,color:`text-primary`,spin:!1,pulse:!0}:{label:`Starting agent...`,icon:Gt,color:`text-primary`,spin:!0}}case`Interrupted`:return{label:`Interrupted, will retry`,icon:Xt,color:`text-accent`,spin:!1};case`In Review`:return Zn(o)===`Reviewing`?{label:`Review in progress...`,icon:U,color:`text-secondary`,spin:!1,pulse:!0}:{label:`Awaiting review`,icon:U,color:`text-secondary/70`,spin:!1};case`Blocked`:return{label:e.lastError?`Blocked: error`:e.blockedBy?.length?`Blocked by dependency`:`Needs attention`,icon:q,color:`text-error`,spin:!1};case`Done`:return{label:`Completed`,icon:H,color:`text-success`,spin:!1};case`Cancelled`:return{label:`Cancelled`,icon:vt,color:`text-neutral`,spin:!1};default:return{label:t,icon:null,color:`opacity-50`,spin:!1}}}function Zn(e){return e?e.reviewer?.totalTokens>0?`Reviewing`:e.executor?.totalTokens>0?`Executing`:e.planner?.totalTokens>0?`Planning`:null:null}function Qn({issue:e,showElapsed:t=!0,compact:n=!1}){let r=Xn(e),i=r.icon,a=Jn([`Running`,`Queued`,`Planning`,`In Review`].includes(e.state)&&t?e.startedAt:null);return(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs ${r.color} ${n?``:`font-medium`}`,children:[i&&(0,V.jsx)(i,{size:n?10:12,className:[r.spin?`animate-spin`:``,r.pulse?`status-indicator-pulse`:``].filter(Boolean).join(` `)}),(0,V.jsx)(`span`,{className:n?`truncate max-w-[120px]`:`truncate`,children:r.label}),a&&(0,V.jsx)(`span`,{className:`font-mono opacity-60 tabular-nums shrink-0`,children:a})]})}function $n({issue:e}){let t=Xn(e),n=t.icon,r=Jn([`Running`,`Queued`,`Planning`,`In Review`].includes(e.state)?e.startedAt:null);return(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1.5 rounded-full text-sm font-medium ${t.color} bg-base-200`,children:[n&&(0,V.jsx)(n,{size:16,className:[t.spin?`animate-spin`:``,t.pulse?`status-indicator-pulse`:``].filter(Boolean).join(` `)}),(0,V.jsx)(`span`,{children:t.label}),r&&(0,V.jsxs)(`span`,{className:`font-mono text-xs opacity-60 tabular-nums`,children:[(0,V.jsx)(hn,{size:10,className:`inline mr-0.5`}),r]})]})}var er={Planning:W,Todo:yt,Queued:Ut,Running:gt,Interrupted:Xt,"In Review":U,Blocked:q,Done:H,Cancelled:vt},tr={Planning:`text-info`,Todo:`text-warning`,Queued:`text-info`,Running:`text-primary`,Interrupted:`text-accent`,"In Review":`text-secondary`,Blocked:`text-error`,Done:`text-success`,Cancelled:`text-neutral`},nr={Planning:`btn-info`,Todo:`btn-warning`,Queued:`btn-info`,Running:`btn-primary`,Interrupted:`btn-accent`,"In Review":`btn-secondary`,Blocked:`btn-error`,Done:`btn-success`,Cancelled:`btn-neutral`},rr={Planning:`badge-info`,Todo:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Interrupted:`badge-accent`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},ir={Planning:`bg-info/10 border-info/30`,Todo:`bg-warning/10 border-warning/30`,Queued:`bg-info/10 border-info/30`,Running:`bg-primary/10 border-primary/30`,Interrupted:`bg-accent/10 border-accent/30`,"In Review":`bg-secondary/10 border-secondary/30`,Blocked:`bg-error/10 border-error/30`,Done:`bg-success/10 border-success/30`,Cancelled:`bg-neutral/10 border-neutral/30`},ar=[{id:`overview`,label:`Overview`,icon:zt},{id:`execution`,label:`Execution`,icon:fn},{id:`diff`,label:`Diff`,icon:St},{id:`routing`,label:`Routing`,icon:tn},{id:`history`,label:`Events`,icon:Qe}],or={id:`planning`,label:`Plan`,icon:W},sr={id:`review`,label:`Review`,icon:bt};function cr(e){return e===`Planning`?[or,ar[0],...ar.slice(4)]:e===`In Review`||e===`Done`||e===`Blocked`?[ar[0],sr,...ar.slice(1)]:[ar[0],or,...ar.slice(1)]}function Y({title:e,icon:t,children:n,badge:r}){return(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[t&&(0,V.jsx)(t,{className:`size-4 opacity-50`}),e,r!=null&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost ml-auto`,children:r})]}),(0,V.jsx)(`div`,{children:n})]})}function X({label:e,value:t,mono:n}){return t==null||t===``?null:(0,V.jsxs)(`div`,{className:`flex justify-between items-baseline gap-4 py-0.5`,children:[(0,V.jsx)(`span`,{className:`text-xs opacity-50 shrink-0`,children:e}),(0,V.jsx)(`span`,{className:`text-sm text-right truncate ${n?`font-mono text-xs`:``}`,children:t})]})}function lr({text:e}){let[t,n]=(0,B.useState)(!1),r=(0,B.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>{n(!0),setTimeout(()=>n(!1),2e3)})},[e]);return(0,V.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1 ${t?`text-success`:``}`,onClick:r,title:`Copy to clipboard`,children:[t?(0,V.jsx)(dt,{className:`size-3 animate-bounce-in`}):(0,V.jsx)(wt,{className:`size-3`}),t?(0,V.jsx)(`span`,{className:`animate-fade-in`,children:`Copied`}):`Copy`]})}function ur({config:e}){if(!e)return null;let{provider:t,model:n,effort:r}=e;return!t&&!n&&!r?null:(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[t&&(0,V.jsxs)(`span`,{className:`badge badge-xs badge-ghost font-mono gap-1`,children:[(0,V.jsx)(fn,{className:`size-2.5`}),t]}),n&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:n}),r&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:r})]})}var dr={planner:`Plan`,executor:`Execute`,reviewer:`Review`},fr={planner:`text-info`,executor:`text-primary`,reviewer:`text-secondary`};function pr({tokensByPhase:e,tokensByModel:t}){let n=e?Object.entries(e).filter(([,e])=>e?.totalTokens>0):[],r=t?Object.entries(t).filter(([,e])=>e?.totalTokens>0):[];if(n.length===0&&r.length===0)return null;let i=e=>(e??0).toLocaleString();return(0,V.jsxs)(`div`,{className:`space-y-3`,children:[n.length>0&&(0,V.jsxs)(`div`,{className:`space-y-1`,children:[n.map(([e,t])=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,V.jsx)(`span`,{className:`w-14 shrink-0 font-medium ${fr[e]||`text-base-content`}`,children:dr[e]||e}),(0,V.jsxs)(`span`,{className:`opacity-50`,children:[i(t.totalTokens),` total`]}),(0,V.jsxs)(`span`,{className:`opacity-30 text-[10px]`,children:[i(t.inputTokens),`↑ `,i(t.outputTokens),`↓`]}),t.model&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono ml-auto`,children:t.model})]},e)),n.length>1&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs border-t border-base-300 pt-1 mt-1`,children:[(0,V.jsx)(`span`,{className:`w-14 shrink-0 font-semibold opacity-60`,children:`Total`}),(0,V.jsx)(`span`,{className:`font-semibold`,children:i(n.reduce((e,[,t])=>e+(t.totalTokens??0),0))})]})]}),r.length>0&&(0,V.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,V.jsx)(`div`,{className:`text-[10px] uppercase tracking-wider opacity-40 mb-1`,children:`by model`}),r.map(([e,t])=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,V.jsx)(`span`,{className:`font-mono opacity-70 truncate flex-1`,children:e}),(0,V.jsx)(`span`,{className:`opacity-50 shrink-0`,children:i(t.totalTokens)})]},e))]})]})}function mr(e){return{Todo:0,Queued:1,Running:2,Interrupted:2,"In Review":3,Blocked:3,Done:4,Cancelled:4}[e]??0}var hr=[{key:`plan`,label:`Plan`,icon:W,states:[`Planning`]},{key:`execute`,label:`Execute`,icon:gt,states:[`Todo`,`Queued`,`Running`,`Interrupted`]},{key:`merge`,label:`Merge`,icon:Pt,states:[]},{key:`review`,label:`Review`,icon:U,states:[`In Review`]},{key:`done`,label:`Done`,icon:H,states:[`Done`]}];function gr(e){return e.state===`Done`?4:e.state===`Cancelled`?-1:e.state===`In Review`||e.mergedAt?3:[`Running`,`Interrupted`,`Queued`,`Todo`].includes(e.state)?1:e.state===`Blocked`?e.mergedAt?3:1:(e.state,0)}function _r({issue:e}){let t=gr(e),n=!!e.mergedAt;return e.state===`Cancelled`?null:(0,V.jsx)(`div`,{className:`flex items-center gap-0 w-full py-2 px-1 overflow-x-auto scrollbar-none`,children:hr.map((r,i)=>{let a=i<t||i===t&&e.state===`Done`,o=i===t&&e.state!==`Done`,s=r.key===`merge`&&n,c=a||s,l=r.icon;return(0,V.jsxs)(B.Fragment,{children:[i>0&&(0,V.jsx)(`div`,{className:`flex-1 h-0.5 min-w-3 transition-colors duration-300 ${c||a?`bg-success`:o?`bg-primary/40`:`bg-base-300`}`}),(0,V.jsxs)(`div`,{className:`flex flex-col items-center gap-0.5 shrink-0`,title:r.label,children:[(0,V.jsx)(`div`,{className:[`size-7 rounded-full flex items-center justify-center transition-all duration-300`,c?`bg-success text-success-content`:``,o?`bg-primary text-primary-content ring-2 ring-primary/30 scale-110`:``,!c&&!o?`bg-base-300 text-base-content/40`:``].filter(Boolean).join(` `),children:c?(0,V.jsx)(H,{className:`size-3.5`}):(0,V.jsx)(l,{className:`size-3.5`})}),(0,V.jsx)(`span`,{className:`text-[10px] leading-tight ${o?`font-semibold text-primary`:c?`text-success font-medium`:`opacity-40`}`,children:r.label})]})]},r.key)})})}function vr({issue:e,onStateChange:t,onRetry:n,onCancel:r}){let i=Array.isArray(e.labels)?e.labels:[],a=Array.isArray(e.blockedBy)?e.blockedBy:[],o=F(e.state).filter(t=>t!==e.state);return(0,V.jsxs)(`div`,{className:`space-y-5`,children:[e.description&&(0,V.jsx)(`p`,{className:`text-sm opacity-70 whitespace-pre-wrap`,children:e.description}),(0,V.jsx)(Y,{title:`Actions`,icon:xn,children:(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50 mb-1.5`,children:`Move to`}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5 max-sm:flex-col`,children:o.map(n=>{let r=er[n]||yt;return(0,V.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1.5 max-sm:w-full ${nr[n]||``}`,onClick:()=>t?.(e.id,n),children:[(0,V.jsx)(r,{className:`size-3.5`}),n]},n)})})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 max-sm:flex-col`,children:[(0,V.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1 max-sm:w-full`,onClick:()=>n?.(e.id),disabled:e.state===`Running`||e.state===`In Review`,children:[(0,V.jsx)(K,{className:`size-3`}),` Retry`]}),(0,V.jsxs)(`button`,{className:`btn btn-sm btn-error btn-soft gap-1 max-sm:w-full`,onClick:()=>r?.(e.id),disabled:e.state===`Done`||e.state===`Cancelled`,children:[(0,V.jsx)(vt,{className:`size-3`}),` Cancel`]})]})]})}),(0,V.jsx)(Y,{title:`Details`,icon:Vt,children:(0,V.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,V.jsx)(X,{label:`State`,value:e.state}),(0,V.jsx)(X,{label:`Priority`,value:`P${e.priority}`}),(0,V.jsx)(X,{label:`Attempts`,value:`${e.attempts??0} / ${e.maxAttempts??0}`}),(0,V.jsx)(X,{label:`Assigned`,value:e.assignedToWorker?`Yes`:`No`}),e.assigneeId&&(0,V.jsx)(X,{label:`Assignee`,value:e.assigneeId,mono:!0}),e.branchName&&(0,V.jsx)(X,{label:`Branch`,value:e.branchName,mono:!0}),e.url&&(0,V.jsx)(X,{label:`URL`,value:e.url,mono:!0})]})}),(0,V.jsx)(Y,{title:`Timing`,icon:xt,children:(0,V.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,V.jsx)(X,{label:`Created`,value:M(e.createdAt)}),(0,V.jsx)(X,{label:`Updated`,value:M(e.updatedAt)}),e.startedAt&&(0,V.jsx)(X,{label:`Started`,value:M(e.startedAt)}),e.completedAt&&(0,V.jsx)(X,{label:`Completed`,value:M(e.completedAt)}),e.nextRetryAt&&(0,V.jsx)(X,{label:`Next retry`,value:M(e.nextRetryAt)}),(0,V.jsx)(X,{label:`Duration`,value:N(e.durationMs)}),e.tokenUsage?.totalTokens>0&&(0,V.jsx)(X,{label:`Tokens`,value:`${e.tokenUsage.totalTokens.toLocaleString()}${e.tokenUsage.costUsd?` ($${e.tokenUsage.costUsd.toFixed(4)})`:``}`}),e.tokenUsage?.model&&(0,V.jsx)(X,{label:`Model`,value:e.tokenUsage.model,mono:!0})]})}),i.length>0&&(0,V.jsx)(Y,{title:`Labels`,icon:dn,badge:i.length,children:(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:i.map(e=>(0,V.jsx)(`span`,{className:`badge badge-sm badge-outline`,children:e},e))})}),a.length>0&&(0,V.jsx)(Y,{title:`Dependencies`,icon:rt,badge:a.length,children:(0,V.jsx)(`div`,{className:`space-y-0.5`,children:a.map(e=>(0,V.jsx)(`div`,{className:`font-mono text-xs`,children:e},e))})})]})}function yr({issueId:e,running:t,startedAt:n}){let[r,i]=(0,B.useState)(null),a=(0,B.useCallback)(async()=>{try{i(await L.get(`/live/${encodeURIComponent(e)}`))}catch{}},[e]);if((0,B.useEffect)(()=>{if(!t){i(null);return}a();let e=setInterval(a,3e3);return()=>clearInterval(e)},[t,a]),!t||!r)return null;let o=Number.isFinite(Number(r.elapsed))?Number(r.elapsed):n?Math.max(Date.now()-new Date(n).getTime(),0):0,s=Math.floor(o/6e4),c=Math.floor(o%6e4/1e3),l=r.logSize?(r.logSize/1024).toFixed(1):`0`;return(0,V.jsxs)(`div`,{className:`rounded-box border border-primary/30 bg-primary/5 p-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`loading loading-spinner loading-xs text-primary`}),(0,V.jsx)(`span`,{className:`text-sm font-semibold text-primary`,children:`Agent running`}),(0,V.jsxs)(`span`,{className:`text-xs opacity-50 ml-auto`,children:[s,`m `,c,`s elapsed`]})]}),(0,V.jsxs)(`div`,{className:`flex gap-3 text-xs opacity-60`,children:[(0,V.jsxs)(`span`,{children:[`Log: `,l,` KB`]}),r.agentPid&&(0,V.jsxs)(`span`,{children:[`PID: `,r.agentPid]}),r.agentAlive===!1&&r.agentPid&&(0,V.jsx)(`span`,{className:`text-error`,children:`process dead`})]}),r.logTail&&(0,V.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-2 overflow-x-auto whitespace-pre-wrap max-h-48 overflow-y-auto font-mono opacity-80`,children:r.logTail})]})}function br({issue:e,workflowConfig:t}){let n=e.state===`Running`||e.state===`In Review`,r=t?.workflow?.execute;return(0,V.jsxs)(`div`,{className:`space-y-5`,children:[(0,V.jsx)(yr,{issueId:e.id,running:n,startedAt:e.startedAt}),r&&(0,V.jsx)(Y,{title:`Execution Config`,icon:rn,children:(0,V.jsx)(ur,{config:r})}),(0,V.jsx)(Y,{title:`Run Info`,icon:fn,children:(0,V.jsxs)(`div`,{className:`space-y-0.5`,children:[(0,V.jsx)(X,{label:`Exit code`,value:e.commandExitCode??`-`,mono:!0}),(0,V.jsx)(X,{label:`Duration`,value:N(e.durationMs)}),e.workspacePath&&(0,V.jsx)(X,{label:`Workspace`,value:e.workspacePath,mono:!0}),e.workspacePreparedAt&&(0,V.jsx)(X,{label:`Workspace ready`,value:M(e.workspacePreparedAt)})]})}),e.lastError&&(0,V.jsx)(Y,{title:`Last Error`,icon:q,children:(0,V.jsx)(`pre`,{className:`text-xs bg-error/10 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-72 overflow-y-auto`,children:e.lastError})}),e.commandOutputTail&&(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[(0,V.jsx)(fn,{className:`size-4 opacity-50`}),` Command Output`]}),(0,V.jsx)(lr,{text:e.commandOutputTail})]}),(0,V.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-[50vh] overflow-y-auto`,children:e.commandOutputTail})]}),(e.tokensByPhase||e.tokensByModel)&&(0,V.jsx)(Y,{title:`Token Usage`,icon:I,children:(0,V.jsx)(pr,{tokensByPhase:e.tokensByPhase,tokensByModel:e.tokensByModel})}),!e.lastError&&!e.commandOutputTail&&!e.tokensByPhase&&!e.tokensByModel&&(0,V.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:`No execution data yet.`})]})}var xr={added:`badge-success`,removed:`badge-error`,modified:`badge-info`};function Sr({file:e,isOpen:t,onToggle:n}){return(0,V.jsx)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:(0,V.jsxs)(`button`,{className:`w-full flex items-center gap-2 px-3 py-2 text-left hover:bg-base-200 transition-colors`,onClick:n,children:[(0,V.jsx)(`span`,{className:`text-xs opacity-40 transition-transform`,style:{transform:t?`rotate(90deg)`:``},children:`▶`}),(0,V.jsx)(`span`,{className:`badge badge-xs ${xr[e.status]||`badge-ghost`}`,children:e.status}),(0,V.jsx)(`span`,{className:`font-mono text-xs truncate flex-1`,children:e.path}),(0,V.jsxs)(`span`,{className:`text-xs text-success`,children:[`+`,e.additions]}),(0,V.jsxs)(`span`,{className:`text-xs text-error`,children:[`-`,e.deletions]})]})})}function Cr({lines:e}){return!e||e.length===0?null:(0,V.jsx)(`pre`,{className:`text-xs rounded-box p-3 overflow-x-auto max-h-[55vh] overflow-y-auto leading-relaxed bg-base-200 font-mono`,children:e.map((e,t)=>{let n=``;return e.startsWith(`+`)&&!e.startsWith(`+++`)?n=`text-success bg-success/10`:e.startsWith(`-`)&&!e.startsWith(`---`)?n=`text-error bg-error/10`:e.startsWith(`@@`)?n=`text-info opacity-60 text-[10px]`:e.startsWith(`diff `)&&(n=`font-bold opacity-70 border-t border-base-300 pt-2 mt-2`),(0,V.jsx)(`div`,{className:n,children:e||`\xA0`},t)})})}function wr({issueId:e}){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(null),l=(0,B.useCallback)(async()=>{i(!0),o(null);try{n(await L.get(`/diff/${encodeURIComponent(e)}`))}catch(e){o(e.message)}finally{i(!1)}},[e]);if((0,B.useEffect)(()=>{n(null),o(null),c(null)},[e]),(0,B.useEffect)(()=>{l()},[l]),r)return(0,V.jsxs)(`div`,{className:`flex items-center justify-center gap-2 text-sm opacity-50 py-12`,children:[(0,V.jsx)(`span`,{className:`loading loading-spinner loading-sm`}),` Loading changes...`]});if(a)return(0,V.jsx)(`div`,{className:`text-sm text-error py-4`,children:a});if(!t)return null;let{files:u=[],diff:d=``,message:f,totalAdditions:p=0,totalDeletions:m=0}=t;if(u.length===0)return(0,V.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:f||`No changes detected.`});let h={};if(d){let e=d.split(/(?=^diff --git )/m);for(let t of e){let e=t.match(/^diff --git a\/(.+?) b\//);e&&(h[e[1]]=t.split(`
40
40
  `))}}return(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,V.jsxs)(`span`,{className:`opacity-60`,children:[u.length,` file`,u.length===1?``:`s`,` changed`]}),(0,V.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,p]}),(0,V.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,m]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(lr,{text:d}),(0,V.jsxs)(`button`,{className:`btn btn-xs btn-ghost gap-1`,onClick:l,children:[(0,V.jsx)(K,{className:`size-3`}),` Refresh`]})]})]}),(0,V.jsx)(`div`,{className:`space-y-1`,children:u.map(e=>(0,V.jsx)(Sr,{file:e,isOpen:s===e.path,onToggle:()=>c(s===e.path?null:e.path)},e.path))}),s&&h[s]&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-mono opacity-50 mb-1`,children:s}),(0,V.jsx)(Cr,{lines:h[s]})]}),!s&&(0,V.jsxs)(`details`,{className:`group`,children:[(0,V.jsxs)(`summary`,{className:`text-xs opacity-50 cursor-pointer select-none list-none flex items-center gap-1`,children:[(0,V.jsx)(`span`,{className:`transition-transform group-open:rotate-90`,children:`▶`}),`Show full diff`]}),(0,V.jsx)(`div`,{className:`mt-2`,children:(0,V.jsx)(Cr,{lines:d.split(`
41
41
  `)})})]})]})}var Tr=/^(\.fifony|fifony[-_]|WORKFLOW\.local)/;function Er(e){return(Array.isArray(e)?e:[]).filter(e=>!Tr.test(e))}function Dr({issue:e}){let t=Er(e.paths),n=new Set(t),r=Er(e.inferredPaths).filter(e=>!n.has(e)),i=Array.isArray(e.capabilityOverlays)?e.capabilityOverlays:[],a=Array.isArray(e.capabilityRationale)?e.capabilityRationale:[];return(0,V.jsxs)(`div`,{className:`space-y-5`,children:[(0,V.jsx)(Y,{title:`State Machine`,icon:Nt,children:(0,V.jsx)(`div`,{className:`space-y-1`,children:oe.map(t=>{let n=t===e.state,r=er[t]||yt,i=ce[t]||[],a=mr(t)<mr(e.state);return(0,V.jsxs)(`div`,{className:`flex items-start gap-2 rounded-lg px-2 py-1.5 border text-sm ${n?ir[t]+` font-semibold`:a?`border-transparent opacity-40`:`border-transparent opacity-60`}`,children:[(0,V.jsx)(r,{className:`size-4 mt-0.5 shrink-0 ${n?tr[t]:``}`}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{children:t}),n&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-primary`,children:`current`})]}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-0.5`,children:i.map(e=>(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-xs opacity-50`,children:[(0,V.jsx)(tt,{className:`size-2.5`}),e]},e))})]})]},t)})})}),(0,V.jsx)(Y,{title:`Capability Routing`,icon:Mt,children:(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(X,{label:`Category`,value:e.capabilityCategory||`default`}),i.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50 mb-1`,children:`Overlays`}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:i.map(e=>(0,V.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:e},e))})]}),a.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50 mb-1`,children:`Rationale`}),(0,V.jsx)(`ul`,{className:`text-xs opacity-70 list-disc ml-4 space-y-0.5`,children:a.map((e,t)=>(0,V.jsx)(`li`,{children:e},t))})]})]})}),(t.length>0||r.length>0)&&(0,V.jsxs)(Y,{title:`Paths`,icon:At,badge:t.length+r.length,children:[t.length>0&&(0,V.jsxs)(`div`,{className:`mb-2`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50 mb-1`,children:`Explicit`}),(0,V.jsx)(`div`,{className:`space-y-0.5`,children:t.map(e=>(0,V.jsx)(`div`,{className:`font-mono text-xs truncate`,children:e},e))})]}),r.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50 mb-1`,children:`Inferred`}),(0,V.jsx)(`div`,{className:`space-y-0.5`,children:r.map(e=>(0,V.jsx)(`div`,{className:`font-mono text-xs truncate opacity-60`,children:e},e))})]})]})]})}var Or={trivial:`badge-ghost`,low:`badge-success`,medium:`badge-warning`,high:`badge-error`};function kr({issue:e,onStateChange:t,workflowConfig:n}){let[r,i]=(0,B.useState)(``),[a,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(0),[d,f]=(0,B.useState)(!1),p=(0,B.useRef)(null),m=e.plan,h=e.state===`Planning`,g=m?.refinements?.length||0,_=2e3,v=e.planningStatus===`planning`||s&&!m,y=e.planningStatus===`refining`,b=v||y,x=a||e.planningError;(0,B.useEffect)(()=>{e.planningError&&o(null)},[e.planningError]),(0,B.useEffect)(()=>{s&&(m||e.planningStatus===`planning`||e.planningError)&&c(!1)},[s,m,e.planningStatus,e.planningError]),(0,B.useEffect)(()=>{if(!s)return;let e=setTimeout(()=>{c(!1),o(`Plan generation timed out. The plan may still be generating in the background — check back soon.`)},300*1e3);return()=>clearTimeout(e)},[s]),(0,B.useEffect)(()=>{if(!b){u(0);return}let t=e.planningStartedAt?new Date(e.planningStartedAt).getTime():Date.now(),n=()=>u(Math.floor((Date.now()-t)/1e3));n();let r=setInterval(n,1e3);return()=>clearInterval(r)},[b,e.planningStartedAt]),(0,B.useEffect)(()=>{if(m&&h&&p.current){let e=setTimeout(()=>p.current?.focus(),300);return()=>clearTimeout(e)}},[m,h]);let S=async(t=!1)=>{o(null),c(!0);try{let n=await L.post(`/issues/${encodeURIComponent(e.id)}/plan`,{fast:t});if(!n.ok)throw Error(n.error||`Plan generation failed.`)}catch(e){o(e instanceof Error?e.message:String(e)),c(!1)}},C=async()=>{try{await L.post(`/issues/${encodeURIComponent(e.id)}/approve`)}catch(e){o(e instanceof Error?e.message:String(e))}},w=async()=>{if(r.trim()){o(null);try{let t=await L.post(`/issues/${encodeURIComponent(e.id)}/plan/refine`,{feedback:r.trim()});if(!t.ok)throw Error(t.error||`Refinement failed.`);i(``)}catch(e){o(e instanceof Error?e.message:String(e))}}};if(!m&&!v)return(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`text-center py-8 space-y-3`,children:[(0,V.jsx)(W,{className:`size-10 mx-auto opacity-20`}),(0,V.jsx)(`div`,{className:`text-sm opacity-60`,children:`No plan generated yet.`}),(0,V.jsx)(`p`,{className:`text-xs opacity-40 max-w-sm mx-auto`,children:`Generate an AI plan to break this issue into actionable steps with suggested paths, labels, and effort.`}),h&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2 justify-center max-sm:flex-col max-sm:w-full max-sm:px-4`,children:[(0,V.jsxs)(`button`,{className:`btn btn-primary gap-1.5 max-sm:w-full`,onClick:()=>S(!1),children:[(0,V.jsx)(W,{className:`size-4`}),` Generate Plan`]}),(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1 tooltip tooltip-bottom max-sm:w-full`,"data-tip":`Same model, minimal reasoning — 2-4 steps, no extras`,onClick:()=>S(!0),children:[(0,V.jsx)(I,{className:`size-3.5`}),` Fast`]})]}),n?.workflow?.plan&&(0,V.jsx)(`div`,{className:`flex items-center justify-center gap-1.5 opacity-40`,children:(0,V.jsx)(ur,{config:n.workflow.plan})})]}),x&&(0,V.jsx)(`div`,{className:`alert alert-error text-sm`,children:x})]});if(v&&!m){let e=l>0?N(l*1e3):``;return(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-4 py-12`,children:[(0,V.jsx)(Gt,{className:`size-8 animate-spin text-primary`}),(0,V.jsx)(`div`,{className:`text-sm opacity-60`,children:`Generating execution plan...`}),(0,V.jsx)(`div`,{className:`text-xs opacity-30`,children:`This may take a few minutes`}),e&&(0,V.jsxs)(`div`,{className:`text-xs font-mono opacity-40`,children:[e,` elapsed`]})]})}return(0,V.jsxs)(`div`,{className:`space-y-5`,children:[b&&(0,V.jsxs)(`div`,{className:`rounded-box border border-primary/30 bg-primary/5 p-3 flex items-center gap-3`,children:[(0,V.jsx)(Gt,{className:`size-4 animate-spin text-primary shrink-0`}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`span`,{className:`text-sm text-primary font-medium`,children:v?`Re-generating plan...`:`Refining to v${g+2}...`}),l>0&&(0,V.jsx)(`span`,{className:`text-xs text-primary/60 ml-2 font-mono`,children:N(l*1e3)})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,V.jsxs)(`span`,{className:`badge badge-sm ${Or[m.estimatedComplexity]||`badge-ghost`}`,children:[m.estimatedComplexity,` complexity`]}),g>0&&(0,V.jsxs)(`span`,{className:`badge badge-sm badge-secondary gap-1`,children:[(0,V.jsx)(K,{className:`size-2.5`}),` Refined ×`,g]})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 flex-wrap`,children:[n?.workflow?.plan&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs opacity-60`,children:[(0,V.jsx)(rn,{className:`size-3 shrink-0`}),(0,V.jsx)(ur,{config:n.workflow.plan})]}),e.tokensByPhase?.planner?.totalTokens>0&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs opacity-50`,children:[(0,V.jsx)(I,{className:`size-3`}),(0,V.jsxs)(`span`,{children:[e.tokensByPhase.planner.totalTokens.toLocaleString(),` tokens`]})]})]}),g>0&&(0,V.jsxs)(`div`,{className:`rounded-box border-l-4 border-secondary bg-secondary/5 px-4 py-3 animate-fade-in`,children:[(0,V.jsx)(`div`,{className:`text-[10px] font-semibold uppercase tracking-wider opacity-40 mb-1`,children:`Last refinement feedback`}),(0,V.jsxs)(`p`,{className:`text-sm leading-relaxed italic opacity-80`,children:[`“`,m.refinements[g-1].feedback,`”`]}),(0,V.jsxs)(`span`,{className:`text-[10px] opacity-30 mt-1 block`,children:[`v`,m.refinements[g-1].version||g+1,` · `,j(m.refinements[g-1].at)]})]}),(0,V.jsxs)(`div`,{className:`space-y-5 animate-fade-in`,children:[(0,V.jsx)(Y,{title:`Summary`,icon:zt,children:(0,V.jsx)(`p`,{className:`text-sm leading-relaxed`,children:m.summary})}),m.phases?.length>0&&(0,V.jsx)(Y,{title:`Phases (${m.phases.length})`,icon:Vt,children:(0,V.jsx)(`div`,{className:`space-y-3`,children:m.phases.map((e,t)=>(0,V.jsxs)(`div`,{className:`border border-base-300 rounded-box overflow-hidden`,children:[(0,V.jsxs)(`div`,{className:`bg-base-200 px-3 py-2 flex items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`flex items-center justify-center size-5 rounded-full bg-primary/15 text-primary text-[10px] font-bold shrink-0`,children:t+1}),(0,V.jsx)(`span`,{className:`text-sm font-semibold`,children:e.phaseName}),e.tasks?.length>0&&(0,V.jsxs)(`span`,{className:`badge badge-xs badge-ghost ml-auto`,children:[e.tasks.length,` tasks`]})]}),e.goal&&(0,V.jsx)(`div`,{className:`px-3 pt-2 text-xs opacity-60`,children:e.goal}),e.tasks?.length>0&&(0,V.jsx)(`div`,{className:`px-3 pb-2 pt-1.5 space-y-1.5`,children:e.tasks.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex gap-2 text-xs`,children:[(0,V.jsxs)(`span`,{className:`opacity-30 shrink-0 font-mono w-4`,children:[e.step,`.`]}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:e.action}),e.details&&(0,V.jsxs)(`span`,{className:`opacity-50 ml-1`,children:[`— `,e.details]})]})]},t))}),e.outputs?.length>0&&(0,V.jsx)(`div`,{className:`px-3 pb-2 flex flex-wrap gap-1`,children:e.outputs.map(e=>(0,V.jsx)(`span`,{className:`badge badge-xs badge-outline opacity-60`,children:e},e))})]},t))})}),(0,V.jsx)(Y,{title:`Steps (${m.steps.length})`,icon:Ut,children:(0,V.jsx)(`div`,{className:`space-y-2`,children:m.steps.map((e,t)=>(0,V.jsxs)(`div`,{className:`flex gap-3 p-3 bg-base-200 rounded-box`,children:[(0,V.jsx)(`div`,{className:`flex items-center justify-center size-6 rounded-full bg-primary/10 text-primary text-xs font-bold shrink-0`,children:e.step}),(0,V.jsxs)(`div`,{className:`min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:e.action}),e.details&&(0,V.jsx)(`div`,{className:`text-xs opacity-50 mt-0.5`,children:e.details}),e.files?.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-1`,children:e.files.map(e=>(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost font-mono`,children:e},e))})]})]},t))})})]},`plan-content-${g}`),m.suggestedPaths?.length>0&&(0,V.jsx)(Y,{title:`Suggested Paths`,icon:At,children:(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:m.suggestedPaths.map(e=>(0,V.jsx)(`span`,{className:`badge badge-sm badge-ghost font-mono`,children:e},e))})}),m.suggestedLabels?.length>0&&(0,V.jsx)(Y,{title:`Suggested Labels`,icon:dn,children:(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1`,children:m.suggestedLabels.map(e=>(0,V.jsx)(`span`,{className:`badge badge-sm badge-outline`,children:e},e))})}),g>0&&(0,V.jsx)(Y,{title:`Refinements (${g})`,icon:Kt,children:(0,V.jsx)(`div`,{className:`space-y-2`,children:(()=>{let e=m.refinements,t=!d&&e.length>2,n=t?e.slice(-2):e;return(0,V.jsxs)(V.Fragment,{children:[t&&(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50`,onClick:()=>f(!0),children:[(0,V.jsx)(ft,{className:`size-3`}),` Show `,e.length-2,` earlier refinement`,e.length-2>1?`s`:``]}),n.map((n,r)=>{let i=t?e.length-2+r:r;return(0,V.jsxs)(`div`,{className:`flex gap-3 p-2.5 bg-base-200 rounded-box text-sm animate-fade-in`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-center size-6 rounded-full bg-secondary/10 text-secondary text-xs font-bold shrink-0`,children:[`v`,n.version||i+2]}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`p`,{className:`text-sm leading-relaxed`,children:n.feedback}),(0,V.jsx)(`span`,{className:`text-[10px] opacity-40 mt-1 block`,children:j(n.at)})]})]},i)}),d&&e.length>2&&(0,V.jsx)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50`,onClick:()=>f(!1),children:`Show less`})]})})()})}),h&&m&&(0,V.jsxs)(`div`,{className:`border-t border-base-300 pt-4 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`text-xs font-semibold flex items-center gap-1.5 opacity-70`,children:[(0,V.jsx)(Kt,{className:`size-3.5`}),`Refine Plan`]}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`textarea`,{ref:p,className:`textarea textarea-bordered w-full text-sm pr-16`,rows:2,placeholder:`Give feedback to refine the plan... e.g. 'Use React instead of Vue for step 3'`,value:r,maxLength:_,onChange:e=>i(e.target.value),disabled:b,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&r.trim()&&(e.preventDefault(),w())}}),(0,V.jsxs)(`span`,{className:`absolute bottom-2 right-3 text-[10px] pointer-events-none ${r.length>_*.9?`text-error`:`opacity-30`}`,children:[r.length,`/`,_]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`button`,{className:`btn btn-secondary btn-sm gap-1.5`,onClick:w,disabled:b||!r.trim(),children:y?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Gt,{className:`size-3.5 animate-spin`}),` Generating v`,g+2,`...`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(K,{className:`size-3.5`}),` Refine Plan`]})}),(0,V.jsx)(`span`,{className:`text-[10px] opacity-30`,children:`Ctrl+Enter to send`})]})]}),x&&(0,V.jsx)(`div`,{className:`alert alert-error text-sm`,children:x}),h&&!b&&(0,V.jsxs)(`div`,{className:`flex items-center gap-2 pt-3 border-t border-base-300 max-sm:flex-col`,children:[(0,V.jsxs)(`button`,{className:`btn btn-primary gap-1.5 max-sm:w-full`,onClick:C,children:[(0,V.jsx)(H,{className:`size-4`}),` Approve & Start`]}),(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1 max-sm:w-full`,onClick:()=>S(!1),children:[(0,V.jsx)(K,{className:`size-3`}),` Re-plan from scratch`]})]})]})}function Ar({issue:e}){let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)(!0),a=(0,B.useRef)(null);if((0,B.useEffect)(()=>{let t=!0,r=async()=>{try{let r=await L.get(`/events/feed?issueId=${encodeURIComponent(e.id)}`);t&&Array.isArray(r?.events)&&n([...r.events].reverse())}catch{}t&&i(!1)};r();let a=setInterval(r,3e3);return()=>{t=!1,clearInterval(a)}},[e.id]),r&&t.length===0)return(0,V.jsxs)(`div`,{className:`flex items-center justify-center py-8 gap-2 opacity-40`,children:[(0,V.jsx)(`span`,{className:`loading loading-spinner loading-xs`}),(0,V.jsx)(`span`,{className:`text-sm`,children:`Loading events...`})]});if(t.length===0)return(0,V.jsx)(`div`,{className:`text-sm opacity-40 text-center py-8`,children:`No events for this issue yet.`});let o={info:{color:`text-info`,icon:zt},error:{color:`text-error`,icon:q},progress:{color:`text-primary`,icon:Qe},state:{color:`text-secondary`,icon:Nt},manual:{color:`text-warning`,icon:_t},runner:{color:`text-accent`,icon:fn},merge:{color:`text-success`,icon:Pt}};return(0,V.jsx)(`div`,{ref:a,className:`space-y-2 -mx-6 -my-4 px-6 py-4 h-full overflow-y-auto`,children:t.map((e,t)=>{let n=o[e.kind]||o.info,r=n.icon;return(0,V.jsxs)(`div`,{className:`flex gap-2.5 items-start py-1.5`,children:[(0,V.jsx)(r,{className:`size-3.5 mt-0.5 shrink-0 ${n.color}`}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-xs leading-relaxed`,children:e.message}),(0,V.jsxs)(`div`,{className:`text-[10px] font-mono opacity-30 mt-0.5`,children:[e.at?j(e.at):``,e.kind&&(0,V.jsx)(`span`,{className:`ml-2 opacity-60`,children:e.kind})]})]})]},`${e.id||e.at}-${t}`)})})}function jr({issue:e,issueId:t,onStateChange:n}){let[r,i]=(0,B.useState)(null),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(null),p=(0,B.useCallback)(async()=>{o(!0);try{i(await L.get(`/diff/${encodeURIComponent(t)}`))}catch{i(null)}finally{o(!1)}},[t]);(0,B.useEffect)(()=>{i(null),u(null),c(``),f(null)},[t]),(0,B.useEffect)(()=>{p()},[p]);let m=e.state===`In Review`,h=e.state===`Done`,g=r?.files||[],_=r?.diff||``,v={};if(_)for(let e of _.split(/(?=^diff --git )/m)){let t=e.match(/^diff --git a\/(.+?) b\//);t&&(v[t[1]]=e.split(`
42
- `))}let y=()=>{u(`approved`),n?.(e.id,`Done`)},b=()=>{u(`rework`),n?.(e.id,`Queued`)},x=()=>{u(`rejected`),n?.(e.id,`Blocked`)},S=e.mergeResult;return(0,V.jsxs)(`div`,{className:`space-y-5`,children:[!!e.mergedAt&&(0,V.jsxs)(`div`,{className:`alert border text-sm ${S?.conflicts>0?`border-warning/30 bg-warning/5`:`border-success/30 bg-success/5`}`,children:[(0,V.jsx)(Pt,{className:`size-4 shrink-0 ${S?.conflicts>0?`text-warning`:`text-success`}`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`font-semibold`,children:`Code merged to project root`}),S&&(0,V.jsxs)(`span`,{className:`opacity-70`,children:[` — `,S.copied,` file`,S.copied===1?``:`s`,` copied`,S.deleted>0?`, ${S.deleted} deleted`:``]}),S?.conflicts>0&&(0,V.jsxs)(`p`,{className:`text-xs text-warning font-medium mt-0.5`,children:[S.conflicts,` file`,S.conflicts===1?``:`s`,` conflicted with another worker and were skipped.`]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`The code is available in the project. You can run, test, and preview it before approving.`})]})]}),h&&(0,V.jsxs)(`div`,{className:`alert alert-success text-sm`,children:[(0,V.jsx)(H,{className:`size-4`}),` This issue has been approved.`]}),e.state===`Blocked`&&(0,V.jsxs)(`div`,{className:`alert alert-error text-sm`,children:[(0,V.jsx)(q,{className:`size-4`}),` Review failed. Check execution output.`]}),l===`approved`&&m&&(0,V.jsxs)(`div`,{className:`alert alert-success text-sm`,children:[(0,V.jsx)(mn,{className:`size-4`}),` Approved! Moving to Done.`]}),l===`rework`&&(0,V.jsxs)(`div`,{className:`alert alert-warning text-sm`,children:[(0,V.jsx)(K,{className:`size-4`}),` Sent back for rework.`]}),m&&!l&&(0,V.jsx)(Y,{title:`Review Checklist`,icon:bt,children:(0,V.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,V.jsx)(`p`,{className:`opacity-60`,children:`Before deciding, consider:`}),(0,V.jsxs)(`ul`,{className:`list-disc ml-5 space-y-1 opacity-80`,children:[(0,V.jsx)(`li`,{children:`Does the diff address the issue title and description?`}),(0,V.jsx)(`li`,{children:`Are there unintended side effects or regressions?`}),(0,V.jsx)(`li`,{children:`Is the scope appropriate — no unnecessary changes?`}),(0,V.jsx)(`li`,{children:`Are there files that shouldn't have been modified?`})]})]})}),(0,V.jsx)(Y,{title:`Changes`,icon:St,children:a?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm opacity-50 py-4`,children:[(0,V.jsx)(`span`,{className:`loading loading-spinner loading-xs`}),` Loading changes...`]}):g.length>0?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,V.jsxs)(`span`,{className:`opacity-60`,children:[g.length,` file`,g.length===1?``:`s`]}),(0,V.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,r?.totalAdditions||0]}),(0,V.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,r?.totalDeletions||0]})]}),(0,V.jsx)(`div`,{className:`space-y-1`,children:g.map(e=>(0,V.jsx)(Sr,{file:e,isOpen:d===e.path,onToggle:()=>f(d===e.path?null:e.path)},e.path))}),d&&v[d]&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-mono opacity-50 mb-1`,children:d}),(0,V.jsx)(Cr,{lines:v[d]})]})]}):(0,V.jsx)(`div`,{className:`text-sm opacity-40 py-4`,children:`No changes detected.`})}),(e.lastError||e.commandOutputTail)&&(0,V.jsxs)(Y,{title:`Agent Output`,icon:fn,children:[e.lastError&&(0,V.jsx)(`pre`,{className:`text-xs bg-error/10 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto mb-2`,children:e.lastError}),e.commandOutputTail&&!e.lastError&&(0,V.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto`,children:e.commandOutputTail})]}),m&&!l&&(0,V.jsx)(Y,{title:`Review Note`,icon:Kt,children:(0,V.jsx)(`textarea`,{className:`textarea textarea-bordered w-full text-sm`,rows:3,placeholder:`Optional: leave a note about your decision...`,value:s,onChange:e=>c(e.target.value)})}),m&&!l&&(0,V.jsxs)(`div`,{className:`border-t border-base-300 pt-4 space-y-3`,children:[(0,V.jsx)(`div`,{className:`text-sm font-semibold`,children:`Verdict`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsxs)(`button`,{className:`btn btn-success btn-sm gap-1.5 flex-1`,onClick:y,children:[(0,V.jsx)(mn,{className:`size-4`}),` Approve`]}),(0,V.jsxs)(`button`,{className:`btn btn-warning btn-sm gap-1.5 flex-1`,onClick:b,children:[(0,V.jsx)(K,{className:`size-4`}),` Request Rework`]}),(0,V.jsxs)(`button`,{className:`btn btn-error btn-sm gap-1.5 flex-1`,onClick:x,children:[(0,V.jsx)(pn,{className:`size-4`}),` Reject`]})]}),(0,V.jsxs)(`p`,{className:`text-xs opacity-40`,children:[(0,V.jsx)(`strong`,{children:`Approve`}),` moves to Done. `,(0,V.jsx)(`strong`,{children:`Rework`}),` sends back to executor. `,(0,V.jsx)(`strong`,{children:`Reject`}),` blocks the issue.`]})]})]})}function Mr({issue:e,onStateChange:t}){let n={paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.75rem)`},r=e.state===`Planning`,i=e.state===`Running`||e.state===`Queued`,a=e.state===`In Review`;if(r)return null;if(i)return(0,V.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 flex items-center justify-center gap-2`,style:n,children:[(0,V.jsx)(`span`,{className:`issue-phase-dot`}),(0,V.jsx)(`span`,{className:`text-sm opacity-50`,children:`Watching...`})]});if(a)return(0,V.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 flex items-center gap-2`,style:n,children:[(0,V.jsxs)(`button`,{className:`btn btn-success btn-sm gap-1.5 flex-1`,onClick:()=>t?.(e.id,`Done`),children:[(0,V.jsx)(mn,{className:`size-4`}),` Approve`]}),(0,V.jsxs)(`button`,{className:`btn btn-warning btn-sm gap-1.5 flex-1`,onClick:()=>t?.(e.id,`Queued`),children:[(0,V.jsx)(K,{className:`size-4`}),` Rework`]})]});let o=er[e.state]||yt;return(0,V.jsx)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 flex items-center justify-center`,style:n,children:(0,V.jsxs)(`span`,{className:`badge ${rr[e.state]||`badge-ghost`} gap-1.5`,children:[(0,V.jsx)(o,{className:`size-3.5`}),e.state]})})}function Nr({issue:e,onClose:t,onStateChange:n,onRetry:r,onCancel:i}){let[a,o]=(0,B.useState)(`overview`),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),d=(0,B.useRef)(null),{data:f}=qn(),p=(0,B.useCallback)(()=>{u(!0),setTimeout(()=>{c(!1),u(!1),t()},250)},[t]),{ref:m,handlers:h}=Vn({onDismiss:p,direction:`right`});return(0,B.useEffect)(()=>{o(e?.state===`Planning`?`planning`:e?.state===`In Review`?`review`:`overview`),e&&(c(!0),u(!1))},[e?.id,e?.state]),(0,B.useEffect)(()=>{if(!e||!s)return;let t=e=>{e.key===`Escape`&&p()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e?.id,s,p]),(0,B.useEffect)(()=>{d.current&&d.current.querySelector(`.tab-active`)?.scrollIntoView({behavior:`smooth`,inline:`center`,block:`nearest`})},[a]),!e&&!s?null:(0,V.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/35 ${l?`animate-toast-out`:`animate-fade-in`}`,onClick:p,style:l?{animationDuration:`0.2s`}:void 0,children:(0,V.jsxs)(`div`,{ref:m,className:`fixed top-0 right-0 z-50 h-full w-full md:w-[520px] lg:w-[600px] bg-base-100 shadow-2xl flex flex-col ${l?`animate-slide-out-right`:`animate-slide-in-right`}`,onClick:e=>e.stopPropagation(),...h,children:[(0,V.jsxs)(`div`,{className:`px-6 pt-4 pb-0 shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,V.jsx)(Ot,{className:`size-5 opacity-60 shrink-0`}),(0,V.jsx)(`span`,{className:`font-mono text-sm opacity-60`,children:e.identifier}),(0,V.jsx)(`span`,{className:`badge badge-sm ${rr[e.state]||`badge-ghost`}`,children:e.state})]}),(0,V.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost btn-circle shrink-0`,onClick:p,"aria-label":`Close`,children:(0,V.jsx)(J,{className:`size-4`})})]}),[`Planning`,`Queued`,`Running`,`In Review`,`Blocked`].includes(e.state)&&(0,V.jsx)(`div`,{className:`mb-2`,children:(0,V.jsx)($n,{issue:e})}),(0,V.jsx)(`h2`,{className:`text-lg font-bold leading-tight mb-2`,children:e.title||`-`}),(0,V.jsx)(_r,{issue:e}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{ref:d,role:`tablist`,className:`tabs tabs-lift overflow-x-auto -webkit-overflow-scrolling-touch scrollbar-none`,style:{scrollbarWidth:`none`},children:cr(e.state).map(({id:t,label:n,icon:r})=>(0,V.jsxs)(`a`,{role:`tab`,className:`tab gap-1.5 whitespace-nowrap ${a===t?`tab-active`:``} ${t===`review`?`text-secondary font-semibold`:``}`,onClick:()=>o(t),children:[(0,V.jsx)(r,{className:`size-3.5`}),n,t===`review`&&e.state===`In Review`&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-secondary`,children:`!`}),t===`planning`&&(e.planningStatus===`planning`||e.planningStatus===`refining`)&&(0,V.jsx)(`span`,{className:`loading loading-spinner loading-xs text-info`})]},t))}),(0,V.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-base-100 to-transparent pointer-events-none md:hidden`})]})]}),(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4 min-h-0 drawer-safe-bottom`,children:(0,V.jsxs)(`div`,{className:`animate-fade-in`,children:[a===`overview`&&(0,V.jsx)(vr,{issue:e,onStateChange:n,onRetry:r,onCancel:i}),a===`planning`&&(0,V.jsx)(kr,{issue:e,onStateChange:n,workflowConfig:f}),a===`review`&&(0,V.jsx)(jr,{issue:e,issueId:e.id,onStateChange:n}),a===`execution`&&(0,V.jsx)(br,{issue:e,workflowConfig:f}),a===`diff`&&(0,V.jsx)(wr,{issueId:e.id}),a===`routing`&&(0,V.jsx)(Dr,{issue:e}),a===`history`&&(0,V.jsx)(Ar,{issue:e})]},a)}),(0,V.jsx)(Mr,{issue:e,onStateChange:n})]})})}function Pr({pwa:e}){return e?e.updateAvailable?(0,V.jsxs)(`div`,{className:`alert alert-info rounded-none border-x-0`,children:[(0,V.jsx)(en,{className:`size-4`}),(0,V.jsx)(`span`,{className:`text-sm`,children:`A fresh dashboard build is ready.`}),(0,V.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:()=>e.applyUpdate(),children:`Reload app`})]}):e.isOnline?null:(0,V.jsxs)(`div`,{className:`alert alert-warning rounded-none border-x-0`,children:[(0,V.jsx)(yn,{className:`size-4`}),(0,V.jsx)(`span`,{className:`text-sm`,children:`You are offline. The app shell is available, but live runtime data may be stale.`})]}):null}var Fr=[`oklch(0.8 0.18 145)`,`oklch(0.8 0.18 250)`,`oklch(0.85 0.16 85)`,`oklch(0.75 0.18 330)`,`oklch(0.8 0.16 200)`];function Ir(e,t){return Math.random()*(t-e)+e}function Lr({color:e,style:t}){return(0,V.jsx)(`div`,{className:`absolute rounded-full pointer-events-none`,style:{width:t.size,height:t.size,backgroundColor:e,left:t.x,top:t.y,animation:`confetti-fly ${t.duration}ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards`,"--tx":t.tx,"--ty":t.ty,"--r":t.r,opacity:.9}})}function Rr({x:e=`50%`,y:t=`50%`,active:n,onDone:r,count:i=24}){let[a,o]=(0,B.useState)([]),s=(0,B.useRef)(r);(0,B.useEffect)(()=>{s.current=r},[r]);let c=(0,B.useCallback)(()=>{let e=Array.from({length:i},(e,t)=>{let n=Math.PI*2*t/i+Ir(-.3,.3),r=Ir(40,120),a=Ir(4,8);return{id:t,color:Fr[t%Fr.length],size:a,x:0,y:0,tx:`${Math.cos(n)*r}px`,ty:`${Math.sin(n)*r-Ir(20,60)}px`,r:`${Ir(-180,180)}deg`,duration:Ir(600,1e3)}});o(e);let t=Math.max(...e.map(e=>e.duration));setTimeout(()=>{o([]),s.current?.()},t+50)},[i]);return(0,B.useEffect)(()=>{n&&c()},[n,c]),a.length===0?null:(0,V.jsx)(`div`,{className:`fixed pointer-events-none z-[100]`,style:{left:e,top:t,transform:`translate(-50%, -50%)`},children:a.map(e=>(0,V.jsx)(Lr,{color:e.color,style:e},e.id))})}function zr(e){let t=(0,B.useRef)(e);t.current=e,(0,B.useEffect)(()=>{function e(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let n=e.target?.tagName;if((n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||e.target?.isContentEditable)&&e.key!==`Escape`)return;let r=t.current[e.key];r&&(e.preventDefault(),r())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Br(){let e=(0,B.useRef)(null),t=(0,B.useRef)([]),n=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let r=e.current;if(!r)return;let i=r.getContext(`2d`),a=[`♪`,`♫`,`♩`,`♬`],o=[`oklch(0.75 0.18 250)`,`oklch(0.80 0.16 200)`,`oklch(0.70 0.20 330)`,`oklch(0.85 0.14 85)`,`oklch(0.75 0.18 145)`,`oklch(0.80 0.12 280)`,`oklch(0.78 0.15 30)`],s=o.length,c=a.length,l=document.createElement(`canvas`);l.width=s*56,l.height=c*56;let u=l.getContext(`2d`);u.textAlign=`center`,u.textBaseline=`middle`,u.font=`48px serif`;let d=[];for(let e=0;e<c;e++){d[e]=[];for(let t=0;t<s;t++){let n=t*56+56/2,r=e*56+56/2;u.fillStyle=o[t],u.fillText(a[e],n,r),d[e][t]={x:t*56,y:e*56}}}let f=0,p=0,m=()=>{let e=window.devicePixelRatio||1;f=window.innerWidth,p=window.innerHeight,r.width=f*e,r.height=p*e,r.style.width=f+`px`,r.style.height=p+`px`,i.setTransform(e,0,0,e,0,0)};m();function h(){let e=f/2,t=p*.38,n=Math.random()*Math.PI*2,r=Math.random()*1.8+.4,i=Math.random()*20,a=Math.floor(Math.random()*c),o=Math.floor(Math.random()*s);return{x:e+Math.cos(n)*i,y:t+Math.sin(n)*i,vx:Math.cos(n)*r,vy:Math.sin(n)*r,gravity:.003+Math.random()*.005,scale:Math.random()*.4+.25,si:a,ci:o,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.04,life:0,maxLife:180+Math.random()*200,fadeIn:15}}let g=Math.min(Math.floor(f*p/6e3),120);t.current=[];for(let e=0;e<g;e++){let e=h(),n=Math.random()*e.maxLife*.8;e.x+=e.vx*n,e.y+=e.vy*n+.5*e.gravity*n*n,e.rotation+=e.rotationSpeed*n,e.life=n,t.current.push(e)}let _=Math.max(1,Math.floor(g/90)),v=0,y=()=>{if(i.clearRect(0,0,f,p),v++,v%2==0)for(let e=0;e<_;e++)t.current.push(h());let e=[];for(let n of t.current){if(n.life++,n.x+=n.vx,n.y+=n.vy,n.vy+=n.gravity,n.rotation+=n.rotationSpeed,n.vx*=.998,n.vy*=.998,n.life>n.maxLife||n.x<-60||n.x>f+60||n.y<-60||n.y>p+60)continue;e.push(n);let t=Math.min(1,n.life/n.fadeIn),r=n.maxLife*.6,a=t*(n.life>r?1-(n.life-r)/(n.maxLife-r):1)*.45;if(a<=.01)continue;let o=d[n.si][n.ci],s=56*n.scale,c=s/2;i.save(),i.translate(n.x,n.y),i.rotate(n.rotation),i.globalAlpha=a,i.drawImage(l,o.x,o.y,56,56,-c,-c,s,s),i.restore()}t.current=e,n.current=requestAnimationFrame(y)};return n.current=requestAnimationFrame(y),window.addEventListener(`resize`,m),()=>{cancelAnimationFrame(n.current),window.removeEventListener(`resize`,m)}},[]),(0,V.jsx)(`canvas`,{ref:e,className:`fixed inset-0 pointer-events-none`,style:{zIndex:0},"aria-hidden":`true`})}var Vr=`modulepreload`,Hr=function(e){return`/assets/`+e},Ur={},Wr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Hr(t,n),t in Ur)return;Ur[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Vr,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Gr=(0,B.lazy)(()=>Wr(()=>import(`./KeyboardShortcutsHelp-CQA1n6E2.js`),__vite__mapDeps([0,1,2,3])));function Kr({children:e}){let t=C().location.pathname;return(0,V.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 animate-view-enter`,children:e},t)}function qr(){let e=Xe(),t=h(),[n,r]=(0,B.useState)(!1),i=(0,B.useCallback)(()=>{e.setIsCreateOpen(!1),e.setSelectedIssue(null),r(!1)},[e]);if(zr((0,B.useMemo)(()=>({n:()=>e.setIsCreateOpen(!0),Escape:i,"?":()=>r(e=>!e),k:()=>t({to:`/kanban`}),i:()=>t({to:`/issues`}),a:()=>t({to:`/agents`}),t:()=>t({to:`/analytics`}),s:()=>t({to:`/settings`}),1:()=>{},2:()=>{},3:()=>{},4:()=>{},5:()=>{},6:()=>{}}),[e,t,i])),e.runtime.isLoading&&!e.runtime.data&&!e.runtime.isError)return(0,V.jsx)(Jr,{});let a=e.toast?.type||`info`,o=typeof e.toast==`string`?e.toast:e.toast?.message;return(0,V.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[e.toast&&(0,V.jsx)(`div`,{className:`toast toast-end toast-top z-50`,children:(0,V.jsxs)(`div`,{className:`alert text-sm shadow-lg ${a===`success`?`alert-success`:a===`error`?`alert-error`:`alert-info`} ${e.toastExiting?`animate-toast-out`:`animate-toast-in`}`,children:[a===`success`?(0,V.jsx)(mt,{className:`size-4`}):a===`error`?(0,V.jsx)(q,{className:`size-4`}):(0,V.jsx)(zt,{className:`size-4`}),(0,V.jsx)(`span`,{children:o}),(0,V.jsx)(`div`,{className:`toast-progress`})]})}),e.confetti&&(0,V.jsx)(Rr,{x:e.confetti.x,y:e.confetti.y,count:e.confetti.count,active:!0,onDone:()=>e.clearConfetti?.()}),(0,V.jsx)(Ln,{issueCount:e.issues.length,sourceRepo:e.data.sourceRepoUrl,updatedAt:e.data.updatedAt,wsStatus:e.wsStatus,notifications:e.notifications,issues:e.issues}),(0,V.jsx)(Pr,{pwa:e.pwa}),(0,V.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0`,children:[(0,V.jsx)(Kr,{children:(0,V.jsx)(D,{})}),e.runtime.isError&&(0,V.jsx)(`div`,{className:`px-4 pb-4`,children:(0,V.jsx)(`div`,{className:`alert alert-error`,children:String(e.runtime.error?.message||`Runtime unavailable`)})})]}),(0,V.jsx)(Rn,{onClick:()=>e.setIsCreateOpen(!0)}),(0,V.jsx)(zn,{}),(0,V.jsx)(Un,{open:e.isCreateOpen,onClose:()=>e.setIsCreateOpen(!1),onSubmit:t=>e.createIssue.mutate(t),isLoading:e.createIssue.isPending,onToast:e.showToast}),(0,V.jsx)(Nr,{issue:e.selectedIssue,onClose:()=>e.setSelectedIssue(null),onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue}),n&&(0,V.jsx)(B.Suspense,{fallback:null,children:(0,V.jsx)(Gr,{open:n,onClose:()=>r(!1)})})]})}function Jr(){return(0,V.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-base-100 flex flex-col items-center justify-center overflow-hidden`,children:[(0,V.jsx)(Br,{}),(0,V.jsxs)(`div`,{className:`relative z-10 flex flex-col items-center gap-6 animate-fade-in`,children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(Jt,{className:`size-16 sm:size-20 text-primary animate-bounce-in`}),(0,V.jsx)(`span`,{className:`absolute -bottom-1 -right-1 size-5 bg-primary rounded-full animate-ping opacity-50`})]}),(0,V.jsx)(`h1`,{className:`text-3xl sm:text-4xl font-bold tracking-tight`,children:(0,V.jsx)(`span`,{className:`text-primary`,children:`Fifony`})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3 text-base-content/50`,children:[(0,V.jsx)(`span`,{className:`loading loading-dots loading-md`}),(0,V.jsx)(`span`,{className:`text-sm`,children:`Warming up the orchestra...`})]})]})]})}function Yr({children:e}){let t=De(),n=fe(_e(t.data),`ui.onboarding.completed`,null);return t.isLoading&&!t.data?(0,V.jsx)(Jr,{}):t.isError||n===!0?e:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(Jr,{}),children:(0,V.jsx)(Xr,{})})}function Xr(){let e=h(),t=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{t.current||(t.current=!0,e({to:`/onboarding`,replace:!0}))},[e]),(0,V.jsx)(Jr,{})}function Zr(){return C().location.pathname===`/onboarding`?(0,V.jsx)(D,{}):(0,V.jsx)(Yr,{children:(0,V.jsx)(Ze,{children:(0,V.jsx)(qr,{})})})}var Z=E({component:Zr}),Qr=[{to:`/settings/general`,label:`General`,icon:Yt},{to:`/settings/workflow`,label:`Workflow`,icon:Nt},{to:`/settings/notifications`,label:`Notifications`,icon:at},{to:`/settings/providers`,label:`Providers`,icon:Tt}],$r=b(`/settings`)({component:ei});function ei(){let e=C().location.pathname;return(0,V.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3`,children:(0,V.jsxs)(`div`,{className:`max-w-5xl w-full mx-auto flex-1 flex flex-col min-h-0 gap-5`,children:[(0,V.jsx)(`div`,{role:`tablist`,className:`tabs tabs-lift`,children:Qr.map(({to:t,label:n,icon:r})=>(0,V.jsxs)(O,{to:t,role:`tab`,className:`tab gap-1.5 ${e.startsWith(t)?`tab-active`:``}`,children:[(0,V.jsx)(r,{className:`size-3.5`}),n]},t))}),(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,V.jsx)(D,{})})]})})}var ti=(0,B.lazy)(()=>Wr(()=>import(`./OnboardingWizard-YrKTjlqQ.js`),__vite__mapDeps([4,1,5,2,3])));function ni(){let e=h(),t=w();return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,V.jsx)(ti,{onComplete:()=>{t.invalidateQueries({queryKey:ye}),e({to:`/`})}})})}var ri=b(`/onboarding`)({component:ni}),ii={Planning:`badge-info`,Todo:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Interrupted:`badge-accent`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},ai={Planning:`border-l-info`,Todo:`border-l-warning`,Queued:`border-l-info`,Running:`border-l-primary`,Interrupted:`border-l-accent`,"In Review":`border-l-secondary`,Blocked:`border-l-error`,Done:`border-l-success`,Cancelled:`border-l-neutral`};function oi(e){return e==null||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function si(e){return e?e.reviewer?.totalTokens>0?`Reviewing`:e.executor?.totalTokens>0?`Executing`:e.planner?.totalTokens>0?`Planning`:null:null}function ci({issue:e,onSelect:t,dragHandlers:n,isDragging:r,isSelected:i,onToggleSelect:a,hasSelection:o}){let s=e.state===`Running`,c=e.state===`In Review`,l=e.state===`Planning`,u=e.state===`Queued`,d=e.state===`Done`,f=e.state===`Cancelled`,p=e.state===`Blocked`,m=e.planningStatus===`planning`||e.planningStatus===`refining`,h=(0,B.useRef)(e.tokenUsage?.totalTokens),[g,_]=(0,B.useState)(!1),v=(0,B.useRef)(e.state),[y,b]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let t=e.tokenUsage?.totalTokens;if(t!=null&&t!==h.current){_(!0);let e=setTimeout(()=>_(!1),300);return h.current=t,()=>clearTimeout(e)}},[e.tokenUsage?.totalTokens]),(0,B.useEffect)(()=>{if(v.current!==`Done`&&e.state===`Done`){b(!0);let t=setTimeout(()=>b(!1),800);return v.current=e.state,()=>clearTimeout(t)}v.current=e.state},[e.state]);let x=s||c?oi(e.tokenUsage?.totalTokens):null;s&&si(e.tokensByPhase);let S=!!e.mergedAt,C=n=>{if(n.shiftKey){n.preventDefault(),a?.(e.id);return}if(o){n.preventDefault(),a?.(e.id);return}t?.(e)},w=n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),n.shiftKey||o?a?.(e.id):t?.(e))};return(0,V.jsxs)(`div`,{"data-issue-id":e.id,className:[`card card-compact bg-base-100 border border-l-[3px] relative`,i?`border-primary ring-2 ring-primary/30 border-base-300`:`border-base-300`,ai[e.state]||``,l?`animate-pulse-soft-border`:``,s?`animate-pulse-border`:``,d?`opacity-80`:``,f?`opacity-60`:``,p?`issue-card-blocked`:``,!d&&!f?`card-interactive`:``,`cursor-pointer`,r?`kanban-card-source-opacity`:``,y?`issue-card-done-flash`:``].filter(Boolean).join(` `),style:{overflow:`hidden`},role:`button`,tabIndex:0,onClick:C,onKeyDown:w,"aria-label":`${i?`Deselect`:`Open`} issue ${e.identifier}`,"aria-selected":i,...n||{},children:[(i||o)&&(0,V.jsx)(`div`,{className:`absolute top-1.5 left-1.5 z-10`,children:(0,V.jsx)(`div`,{className:`size-5 rounded flex items-center justify-center transition-all ${i?`bg-primary text-primary-content`:`bg-base-300/60 border border-base-content/20`}`,children:i&&(0,V.jsx)(cn,{size:14})})}),(0,V.jsxs)(`div`,{className:`card-body gap-1 p-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 ${o?`pl-5`:``}`,children:[(0,V.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,V.jsx)(`h3`,{className:`font-semibold text-sm truncate ${f?`line-through opacity-60`:``}`,children:e.title})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[S&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-success gap-0.5`,title:`Code merged to project`,children:(0,V.jsx)(Pt,{size:9})}),(0,V.jsx)(`span`,{className:`badge badge-xs ${ii[e.state]||`badge-ghost`}`,children:e.state})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs opacity-50 truncate`,children:[(0,V.jsxs)(`span`,{className:`shrink-0`,children:[`P`,e.priority]}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`·`}),(0,V.jsx)(`span`,{className:`shrink-0`,children:j(e.updatedAt)}),e.capabilityCategory&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`·`}),(0,V.jsx)(`span`,{className:`truncate`,children:e.capabilityCategory})]})]}),(s||c||l||u||m)&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs truncate`,children:[(0,V.jsx)(Qn,{issue:e,compact:!0,showElapsed:s||c}),x&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 opacity-50 shrink-0 ml-auto ${g?`animate-count-bump`:``}`,children:[(0,V.jsx)(I,{size:10}),x]})]})]}),s&&(0,V.jsx)(`div`,{className:`issue-heartbeat-bar animate-pulse-soft`}),m&&(0,V.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-info animate-pulse-soft`})]})}function li({icon:e=Rt,title:t=`Nothing here`,description:n=``,action:r,actionLabel:i=`Action`}){return(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 px-4 opacity-60 animate-fade-in-up`,children:[(0,V.jsx)(e,{className:`size-12 mb-4 opacity-40`}),(0,V.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:t}),n&&(0,V.jsx)(`p`,{className:`text-sm opacity-70 text-center max-w-xs`,children:n}),r&&(0,V.jsx)(`button`,{className:`btn btn-sm btn-primary mt-4`,onClick:r,children:i})]})}var ui={Planning:[`Planning`],"In Progress":[`Todo`,`Queued`],"In Review":[`In Review`],Blocked:[`Blocked`],Done:[`Done`],Cancelled:[`Cancelled`]},di=new Set([`Todo`,`Queued`,`Running`,`Interrupted`]);function fi(e){return di.has(e)?`In Progress`:e}function pi(e){let t=ce[e];if(!t)return new Set;let n=new Set(t.map(e=>fi(e)));return n.delete(fi(e)),n}var mi=300,hi=5;function gi({onStateChange:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useRef)(null),i=(0,B.useRef)({pointerId:null,startX:0,startY:0,isDragging:!1,longPressTimer:null,longPressReady:!1,pointerType:null,issue:null,sourceColumn:null,didDrag:!1}),a=(0,B.useRef)(null),o=(0,B.useRef)(new Map);(0,B.useEffect)(()=>()=>{clearTimeout(i.current.longPressTimer)},[]);let s=(0,B.useCallback)((e,t)=>{let n=r.current;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)},[]),c=(0,B.useCallback)((e,t)=>{for(let[n,r]of o.current.entries()){let i=r.getBoundingClientRect();if(e>=i.left&&e<=i.right&&t>=i.top&&t<=i.bottom)return n}return null},[]),l=(0,B.useCallback)((e,t,r,a)=>{let o=pi(e.state);i.current.isDragging=!0,n({issueId:e.id,issue:e,sourceColumn:t,validColumns:o,overColumn:null}),s(r,a)},[s]),u=(0,B.useCallback)(()=>{let e=i.current.isDragging;clearTimeout(i.current.longPressTimer),i.current.isDragging=!1,i.current.longPressReady=!1,i.current.pointerId=null,i.current.issue=null,i.current.didDrag=e,e&&requestAnimationFrame(()=>{i.current.didDrag=!1}),n(null)},[]),d=(0,B.useCallback)(n=>{if(t){if(t.validColumns.has(n)){let r=ce[t.issue.state]||[],i=new Set(ui[n]||[]),a=r.find(e=>i.has(e));a&&e(t.issueId,a)}u()}},[t,e,u]),f=(0,B.useCallback)((e,t)=>{t?o.current.set(e,t):o.current.delete(e)},[]);return{dragState:t,ghostRef:r,boardRef:a,getCardHandlers:(0,B.useCallback)((e,t)=>({onPointerDown:n=>{n.button===0&&(n.target.closest(`a, button`)||(i.current.pointerId=n.pointerId,i.current.startX=n.clientX,i.current.startY=n.clientY,i.current.pointerType=n.pointerType,i.current.issue=e,i.current.sourceColumn=t,i.current.longPressReady=!1,n.pointerType===`touch`&&(i.current.longPressTimer=setTimeout(()=>{i.current.longPressReady=!0,navigator.vibrate&&navigator.vibrate(30),l(e,t,n.clientX,n.clientY)},mi))))}}),[l]),registerColumn:f,onBoardPointerMove:(0,B.useCallback)(e=>{let t=i.current;if(t.pointerId==null||e.pointerId!==t.pointerId)return;let r=e.clientX-t.startX,a=e.clientY-t.startY,o=Math.sqrt(r*r+a*a);if(!t.isDragging)if(t.pointerType===`touch`){if(o>hi&&!t.longPressReady){clearTimeout(t.longPressTimer),t.pointerId=null;return}if(!t.longPressReady)return}else{if(o<hi)return;l(t.issue,t.sourceColumn,e.clientX,e.clientY)}e.preventDefault(),s(e.clientX,e.clientY);let u=c(e.clientX,e.clientY);n(e=>!e||e.overColumn===u?e:{...e,overColumn:u})},[l,s,c]),onBoardPointerUp:(0,B.useCallback)(e=>{let t=i.current;if(t.pointerId==null||e.pointerId!==t.pointerId)return;if(clearTimeout(t.longPressTimer),!t.isDragging){t.pointerId=null;return}let n=c(e.clientX,e.clientY);n?d(n):u()},[c,d,u]),onBoardPointerCancel:(0,B.useCallback)(()=>{u()},[u]),cancelDrag:u,shouldSuppressClick:(0,B.useCallback)(()=>i.current.didDrag||i.current.isDragging,[])}}function _i({count:e,className:t}){let n=(0,B.useRef)(e),[r,i]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{if(n.current!==e){n.current=e,i(!0);let t=setTimeout(()=>i(!1),300);return()=>clearTimeout(t)}},[e]),e===0?null:(0,V.jsx)(`span`,{className:`badge badge-xs ${t} ${r?`animate-count-bump`:``}`,children:e})}var Q=[`Planning`,`In Progress`,`In Review`,`Blocked`,`Done`,`Cancelled`],vi=new Set([`Todo`,`Queued`,`Running`,`Interrupted`]),yi={Planning:`badge-info`,"In Progress":`badge-primary`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},bi={Planning:{borderTopColor:`oklch(var(--in) / 0.4)`},"In Progress":{borderTopColor:`oklch(var(--p) / 0.5)`},"In Review":{borderTopColor:`oklch(var(--s) / 0.4)`},Blocked:{borderTopColor:`oklch(var(--er) / 0.4)`},Done:{borderTopColor:`oklch(var(--su) / 0.4)`},Cancelled:{borderTopColor:`oklch(var(--bc) / 0.15)`}},xi={Planning:`oklch(var(--in))`,"In Progress":`oklch(var(--p))`,"In Review":`oklch(var(--s))`,Blocked:`oklch(var(--er))`,Done:`oklch(var(--su))`,Cancelled:void 0},Si={Planning:`oklch(var(--in))`,"In Progress":`oklch(var(--p))`,"In Review":`oklch(var(--s))`,Blocked:`oklch(var(--er))`,Done:`oklch(var(--su))`,Cancelled:`oklch(var(--bc) / 0.3)`},Ci={Planning:{icon:W,desc:`Create an issue to start planning`},"In Progress":{icon:Zt,desc:`Issues move here when agents start`},"In Review":{icon:U,desc:`Awaiting review`},Blocked:{icon:q,desc:`Needs attention`},Done:{icon:mt,desc:`Completed`},Cancelled:{icon:vt,desc:`Cancelled`}};function wi({delay:e=0}){return(0,V.jsx)(`div`,{className:`skeleton-card h-20 w-full rounded-lg`,style:{animationDelay:`${e}ms`}})}function Ti({dragState:e,ghostRef:t}){if(!e)return null;let{issue:n}=e;return(0,V.jsx)(`div`,{ref:t,className:`drag-ghost`,"aria-hidden":`true`,children:(0,V.jsxs)(`div`,{className:`card card-compact bg-base-100 border border-primary border-l-[3px] shadow-2xl p-3 w-56`,children:[(0,V.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:n.identifier}),(0,V.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:n.title})]})})}function Ei({onCreateIssue:e}){return(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 px-3 animate-fade-in-up`,children:[(0,V.jsx)(`div`,{className:`bg-primary/10 rounded-full p-4 mb-3 animate-pulse-soft`,children:(0,V.jsx)(W,{className:`size-8 text-primary`})}),(0,V.jsx)(`h3`,{className:`text-sm font-semibold mb-1`,children:`Start here`}),(0,V.jsx)(`p`,{className:`text-xs opacity-50 text-center mb-3`,children:`Create your first issue to begin`}),e&&(0,V.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:e,children:[(0,V.jsx)(Qt,{className:`size-3.5`}),`New Issue`]})]})}function Di({issue:e,onClose:t,onStateChange:n,onSelect:r}){let i=F(e.state).filter(t=>t!==e.state);return(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-50 animate-fade-in`,onClick:t}),(0,V.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 z-50 bg-base-100 rounded-t-2xl shadow-2xl animate-slide-up-sheet`,style:{paddingBottom:`env(safe-area-inset-bottom)`},onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,V.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-base-content/20`})}),(0,V.jsxs)(`div`,{className:`px-4 py-2 border-b border-base-300`,children:[(0,V.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,V.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:e.title})]}),(0,V.jsxs)(`div`,{className:`p-3 space-y-1`,children:[(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{r(e),t()},children:[(0,V.jsx)(U,{className:`size-4`}),` View Details`]}),i.length>0&&(0,V.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide opacity-40 px-3 pt-2`,children:`Move to`}),i.map(r=>(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{n(e.id,r),t()},children:[(0,V.jsx)(tt,{className:`size-4`}),` `,r]},r))]}),(0,V.jsx)(`div`,{className:`p-3 pt-0`,children:(0,V.jsx)(`button`,{className:`btn btn-ghost btn-sm w-full`,onClick:t,children:`Cancel`})})]})]})}function Oi({columns:e,activeIndex:t}){return(0,V.jsx)(`div`,{className:`kanban-dots md:hidden`,children:e.map((e,n)=>(0,V.jsx)(`div`,{className:`kanban-dot ${n===t?`active`:``}`,style:{backgroundColor:Si[e]}},e))})}var ki={Done:5,Cancelled:3};function Ai({col:e,issues:t,empty:n,badgeClass:r,dragState:i,registerColumn:a,getCardHandlers:o,onSelect:s,onCreateIssue:c,lastDroppedId:l,hasRunningAgents:u,totalIssues:d,onLongPress:f,selectedIds:p,onToggleSelect:m,hasSelection:h}){let g=(0,B.useRef)(null),[_,v]=(0,B.useState)(!1);(0,B.useEffect)(()=>(a(e,g.current),()=>a(e,null)),[e,a]);let y=i!=null,b=i?.overColumn===e,x=i?.sourceColumn===e,S=i?.validColumns?.has(e)??!1,C=y&&!S&&!x,w=t.length===0,T=w&&e!==`Planning`&&d===0,E=ki[e],ee=E!=null&&t.length>E,D=ee&&!_?t.slice(0,E):t,O=t.length-D.length,k=`kanban-column bg-base-200 rounded-box p-3 flex flex-col min-h-0 overflow-hidden`;T&&(k+=` kanban-column-collapsed`),y&&(b&&S?k+=` kanban-column-drop-valid`:b&&!S?k+=` kanban-column-drop-invalid`:C&&(k+=` kanban-column-dimmed`));let te={borderTop:`3px solid transparent`,...bi[e]||{},...T?{alignSelf:`start`}:{}};return(0,V.jsxs)(`div`,{ref:g,className:k,style:te,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,V.jsxs)(`h3`,{className:`text-xs font-semibold tracking-wide flex items-center gap-1.5`,style:{color:xi[e],fontFamily:`'Space Grotesk', system-ui, sans-serif`},children:[e,e===`In Progress`&&u&&(0,V.jsx)(`span`,{className:`issue-phase-dot`,title:`Agents working`})]}),(0,V.jsx)(_i,{count:t.length,className:r})]}),!T&&(0,V.jsx)(`div`,{className:`space-y-2 flex-1 overflow-y-auto kanban-card-list`,children:w?b&&S?(0,V.jsx)(`div`,{className:`kanban-drop-placeholder`}):e===`Planning`&&d===0?(0,V.jsx)(Ei,{onCreateIssue:c}):(0,V.jsxs)(`div`,{className:`flex flex-col items-center py-6 opacity-30`,children:[(0,V.jsx)(n.icon,{className:`size-5 mb-1`}),(0,V.jsx)(`span`,{className:`text-[10px]`,children:n.desc})]}):(0,V.jsxs)(`div`,{className:`stagger-children space-y-2`,children:[D.map(t=>{let n=i?.issueId===t.id,r=l===t.id;return(0,V.jsx)(`div`,{className:`${n?`kanban-card-dragging-source`:``} ${r?`animate-pop`:``}`,onContextMenu:e=>{`ontouchstart`in window&&(e.preventDefault(),f?.(t))},children:(0,V.jsx)(ci,{issue:t,onSelect:s,dragHandlers:o(t,e),isDragging:n,isSelected:p?.has(t.id),onToggleSelect:m,hasSelection:h})},t.id)}),ee&&(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50 hover:opacity-80`,onClick:e=>{e.stopPropagation(),v(!_)},children:[(0,V.jsx)(ft,{className:`size-3 transition-transform ${_?`rotate-180`:``}`}),_?`Show less`:`+${O} more`]}),b&&S&&(0,V.jsx)(`div`,{className:`kanban-drop-placeholder`})]})})]},e)}function ji(e,t){let n=t.filter(t=>e.has(t.id));if(n.length===0)return[];let r=n.map(e=>{let t=ce[e.state]||[];return new Set(t.filter(t=>t!==e.state))});return[...r[0]].filter(e=>r.every(t=>t.has(e)))}function Mi({count:e,transitions:t,onBulkAction:n,onClear:r}){return(0,V.jsxs)(`div`,{className:`fixed bottom-4 left-1/2 -translate-x-1/2 z-40 bg-base-100 border border-base-300 rounded-box shadow-2xl px-4 py-2.5 flex items-center gap-3 animate-slide-up-sheet`,role:`toolbar`,"aria-label":`Bulk actions`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:t.map(e=>(0,V.jsxs)(`button`,{className:`btn btn-sm btn-outline gap-1`,onClick:()=>n(e),children:[(0,V.jsx)(tt,{className:`size-3`}),e]},e))}),(0,V.jsx)(`div`,{className:`divider divider-horizontal mx-0`}),(0,V.jsxs)(`span`,{className:`text-sm font-medium whitespace-nowrap opacity-70`,children:[e,` selected`]}),(0,V.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-square`,onClick:r,"aria-label":`Clear selection`,children:(0,V.jsx)(J,{className:`size-4`})})]})}function Ni({issues:e,onStateChange:t,onRetry:n,onCancel:r,onSelect:i,onCreateIssue:a,isLoading:o}){let[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(0),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(()=>new Set),h=(0,B.useRef)(null),g=p.size>0,_=(0,B.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),v=(0,B.useCallback)(()=>{m(new Set)},[]);(0,B.useEffect)(()=>{if(!g)return;let e=e=>{e.key===`Escape`&&v()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[g,v]),(0,B.useEffect)(()=>{if(!g)return;let t=new Set(e.map(e=>e.id));m(e=>{let n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[e,g]);let y=(0,B.useMemo)(()=>ji(p,e),[p,e]),b=(0,B.useCallback)(e=>{for(let n of p)t(n,e);v()},[p,t,v]),x=(0,B.useMemo)(()=>{let t=Object.fromEntries(Q.map(e=>[e,[]]));for(let n of e)t[vi.has(n.state)?`In Progress`:t[n.state]?n.state:`Todo`].push(n);for(let e of Q)t[e].sort((e,t)=>e.priority-t.priority);return t},[e]),S=(0,B.useMemo)(()=>e.some(e=>e.state===`Running`),[e]),C=(0,B.useCallback)((e,n)=>{c(e);let r=setTimeout(()=>c(null),400);return t(e,n),()=>clearTimeout(r)},[t]),{dragState:w,ghostRef:T,getCardHandlers:E,registerColumn:ee,onBoardPointerMove:D,onBoardPointerUp:O,onBoardPointerCancel:k,shouldSuppressClick:te}=gi({onStateChange:C}),ne=(0,B.useCallback)(e=>{te()||i?.(e)},[i,te]);(0,B.useEffect)(()=>{let e=h.current;if(!e)return;let t=e.querySelector(`.grid, [class*='grid']`);if(!t)return;let n=()=>{let n=t.children;if(!n.length)return;let r=e.scrollLeft,i=e.clientWidth,a=0,o=1/0;for(let e=0;e<n.length;e++){let t=n[e],s=t.offsetLeft+t.offsetWidth/2,c=r+i/2,l=Math.abs(s-c);l<o&&(o=l,a=e)}u(a)};return e.addEventListener(`scroll`,n,{passive:!0}),()=>e.removeEventListener(`scroll`,n)},[]),(0,B.useRef)(null);let re=(0,B.useCallback)(e=>{f(e)},[]);return o?(0,V.jsx)(`div`,{className:`overflow-x-auto pb-2 flex-1 flex flex-col min-h-0`,children:(0,V.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children`,style:{gridTemplateColumns:`repeat(${Q.length}, minmax(0, 1fr))`,minWidth:`${Q.length*180}px`},children:Q.map((e,t)=>(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex flex-col gap-2`,children:[(0,V.jsx)(`div`,{className:`skeleton-line h-4 w-20 mb-2`}),(0,V.jsx)(wi,{delay:t*80}),(0,V.jsx)(wi,{delay:t*80+120}),t<2&&(0,V.jsx)(wi,{delay:t*80+240})]},e))})}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{ref:h,className:`overflow-x-auto pb-2 flex-1 flex flex-col min-h-0`,onPointerMove:D,onPointerUp:O,onPointerCancel:k,style:{touchAction:w?`none`:void 0},children:[(0,V.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children ${w?`kanban-dragging`:``}`,style:{gridTemplateColumns:`repeat(${Q.length}, minmax(0, 1fr))`,minWidth:`${Q.length*180}px`},children:Q.map(t=>(0,V.jsx)(Ai,{col:t,issues:x[t],empty:Ci[t],badgeClass:yi[t],dragState:w,registerColumn:ee,getCardHandlers:E,onSelect:ne,onCreateIssue:a,lastDroppedId:s,hasRunningAgents:S,totalIssues:e.length,onLongPress:re,selectedIds:p,onToggleSelect:_,hasSelection:g},t))}),(0,V.jsx)(Ti,{dragState:w,ghostRef:T})]}),(0,V.jsx)(Oi,{columns:Q,activeIndex:l}),d&&(0,V.jsx)(Di,{issue:d,onClose:()=>f(null),onStateChange:C,onSelect:ne}),g&&(0,V.jsx)(Mi,{count:p.size,transitions:y,onBulkAction:b,onClear:v})]})}function Pi(e){if(!e||typeof e!=`string`)return e||`unknown`;let t=e.match(/claude-(\w+)-(\d+)-(\d+)/);return t?`${t[1].charAt(0).toUpperCase()+t[1].slice(1)} ${t[2]}.${t[3]}`:e}function Fi({value:e,className:t=``}){let[n,r]=(0,B.useState)(()=>$(e)),i=(0,B.useRef)(e),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let t=i.current||0,n=e||0;if(i.current=n,t===n){r($(n));return}let o=performance.now(),s=e=>{let i=e-o,c=Math.min(i/600,1),l=1-(1-c)**3,u=t+(n-t)*l;r($(Math.round(u))),c<1&&(a.current=requestAnimationFrame(s))};return cancelAnimationFrame(a.current),a.current=requestAnimationFrame(s),()=>cancelAnimationFrame(a.current)},[e]),(0,V.jsx)(`span`,{className:`${t} inline-block tabular-nums`,children:n})}function $(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Ii({byPhase:e,compact:t=!1}){if(!e)return null;let n=[{key:`planner`,label:`Plan`,color:`bg-info`,textColor:`text-info`},{key:`executor`,label:`Exec`,color:`bg-primary`,textColor:`text-primary`},{key:`reviewer`,label:`Review`,color:`bg-secondary`,textColor:`text-secondary`}],r=n.reduce((t,n)=>t+(e[n.key]?.totalTokens||0),0);return r===0?null:(0,V.jsxs)(`div`,{className:t?`flex flex-col gap-1`:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`div`,{className:`flex h-2 rounded-full overflow-hidden bg-base-300 w-full min-w-[100px]`,children:n.map(t=>{let n=e[t.key]?.totalTokens||0,i=n/r*100;return i===0?null:(0,V.jsx)(`div`,{className:`${t.color} opacity-80 transition-all duration-500`,style:{width:`${i}%`},title:`${t.label}: ${$(n)} (${Math.round(i)}%)`},t.key)})}),(0,V.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:n.map(t=>{let n=e[t.key]?.totalTokens||0;return n===0?null:(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,children:[(0,V.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full ${t.color} shrink-0`}),(0,V.jsx)(`span`,{className:`opacity-60`,children:t.label}),(0,V.jsx)(`span`,{className:`font-mono opacity-80`,children:$(n)})]},t.key)})})]})}function Li({data:e,height:t=32,className:n=``}){if(!e||e.length===0)return null;let r=Math.max(...e.map(e=>e.totalTokens||0),1),i=Math.max(2,Math.floor(100/e.length));return(0,V.jsx)(`div`,{className:`flex items-end gap-px ${n}`,style:{height:t},children:e.map((e,n)=>{let a=Math.max(1,Math.round((e.totalTokens||0)/r*t)),o=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`}):`Day ${n+1}`;return(0,V.jsx)(`div`,{className:`bg-primary rounded-t-sm opacity-70 transition-all duration-500`,style:{width:`${i}%`,height:a},title:`${o}: ${$(e.totalTokens||0)}`},e.date||n)})})}function Ri({data:e,valueKey:t=`totalTokens`,height:n=28,color:r=`stroke-primary`,className:i=``}){if(!e||e.length===0)return null;let a=e.map(e=>e[t]||e.count||0),o=Math.max(...a,1),s=a.map((e,t)=>`${t/Math.max(a.length-1,1)*100},${n-e/o*(n-2)-1}`).join(` `),c=a[a.length-1]||0,l=a[a.length-2]||0,u=c>l?`up`:c<l?`down`:`flat`;return(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 ${i}`,children:[(0,V.jsxs)(`svg`,{viewBox:`0 0 100 ${n}`,className:`flex-1`,style:{height:n},preserveAspectRatio:`none`,children:[(0,V.jsx)(`polyline`,{points:s,fill:`none`,className:r,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`}),(0,V.jsx)(`polyline`,{points:`0,${n} ${s} 100,${n}`,fill:`currentColor`,className:r.replace(`stroke-`,`text-`),opacity:`0.08`})]}),(0,V.jsxs)(`span`,{className:`text-[9px] font-mono opacity-50 shrink-0 ${u===`up`?`text-success`:u===`down`?`text-error`:``}`,children:[$(c),`/h`]})]})}function zi({totalTokens:e,byPhase:t,tokensPerHour:n,eventsPerHour:r,hasHourlyData:i,modelEntries:a,issues:o}){let[s,c]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box animate-fade-in overflow-hidden`,children:[(0,V.jsxs)(`button`,{className:`flex items-center justify-between w-full px-4 py-2.5 text-left`,onClick:()=>c(!s),children:[(0,V.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5`,children:[(0,V.jsx)(I,{className:`size-3.5 text-primary`}),(0,V.jsx)(Fi,{value:e}),(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 font-normal ml-1`,children:`tokens`})]}),(0,V.jsx)(ft,{className:`size-4 opacity-40 transition-transform ${s?`rotate-180`:``}`})]}),s&&(0,V.jsxs)(`div`,{className:`px-4 pb-3 space-y-3 animate-fade-in border-t border-base-300 pt-3`,children:[t&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 block`,children:`Phases`}),(0,V.jsx)(Ii,{byPhase:t,compact:!0})]}),i&&n.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,V.jsx)(I,{className:`size-2.5`}),` Tokens/h`]}),(0,V.jsx)(Ri,{data:n,valueKey:`totalTokens`,height:32,color:`stroke-primary`,className:`w-full`})]}),i&&r.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,V.jsx)(Qe,{className:`size-2.5`}),` Events/h`]}),(0,V.jsx)(Ri,{data:r,valueKey:`count`,height:32,color:`stroke-secondary`,className:`w-full`})]}),a.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 block`,children:`Models`}),(0,V.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:a.slice(0,3).map(([e,t])=>{let n=e.includes(`claude`)?`bg-primary`:e.includes(`gpt`)||e.includes(`codex`)?`bg-secondary`:`bg-accent`,r=Pi(e);return(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,V.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full ${n} shrink-0`}),(0,V.jsx)(`span`,{className:`opacity-60`,children:r}),(0,V.jsx)(`span`,{className:`font-mono opacity-80`,children:$(t)})]},e)})})]}),o.length>0&&(0,V.jsxs)(`div`,{className:`text-xs opacity-40`,children:[o.length,` issues`]})]})]})}function Bi(){let[e,t]=(0,B.useState)(()=>window.innerWidth<768);return(0,B.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Vi({metrics:e,total:t,issues:n=[],compact:r=!1}){let{data:i}=Ee(),{data:a}=P(24),o=Bi(),s=i?.overall?.totalTokens||0,c=i?.byPhase||null,l=i?.daily||[],u=i?.byModel||{},d=s>0,f=a?.tokensPerHour||[],p=a?.eventsPerHour||[],m=f.some(e=>e.totalTokens>0)||p.some(e=>e.count>0),h=Object.entries(u).map(([e,t])=>[e,t?.totalTokens||0]).sort((e,t)=>t[1]-e[1]),g=(0,B.useRef)(s>0),[_,v]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{!g.current&&s>0&&(g.current=!0,v(!0))},[s]),s===0&&!m?null:o?(0,V.jsx)(zi,{totalTokens:s,byPhase:c,tokensPerHour:f,eventsPerHour:p,hasHourlyData:m,modelEntries:h,issues:n}):r?(0,V.jsxs)(`div`,{className:`flex items-stretch gap-3 bg-base-200 rounded-box overflow-hidden ${_?`animate-fade-in-up`:`animate-fade-in`}`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-5 px-4 py-2.5`,children:(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40`,children:`Tokens`}),(0,V.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5`,children:[(0,V.jsx)(I,{className:`size-3.5 text-primary`}),(0,V.jsx)(Fi,{value:s})]})]})}),c&&(0,V.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[140px]`,children:[(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1`,children:`Phases`}),(0,V.jsx)(Ii,{byPhase:c,compact:!0})]}),m&&f.some(e=>e.totalTokens>0)&&(0,V.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[140px]`,children:[(0,V.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,V.jsx)(I,{className:`size-2.5`}),` Tokens/h`]}),(0,V.jsx)(Ri,{data:f,valueKey:`totalTokens`,height:28,color:`stroke-primary`})]}),m&&p.some(e=>e.count>0)&&(0,V.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[140px]`,children:[(0,V.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,V.jsx)(Qe,{className:`size-2.5`}),` Events/h`]}),(0,V.jsx)(Ri,{data:p,valueKey:`count`,height:28,color:`stroke-secondary`})]}),h.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300`,children:[(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1`,children:`Models`}),(0,V.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:h.slice(0,3).map(([e,t])=>{let n=e.includes(`claude`)?`bg-primary`:e.includes(`gpt`)||e.includes(`codex`)?`bg-secondary`:`bg-accent`,r=Pi(e);return(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,V.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full ${n} shrink-0`}),(0,V.jsx)(`span`,{className:`opacity-60`,children:r}),(0,V.jsx)(`span`,{className:`font-mono opacity-80`,children:$(t)})]},e)})})]}),n.length>0&&(0,V.jsx)(`div`,{className:`flex items-center px-4 ml-auto`,children:(0,V.jsxs)(`span`,{className:`text-xs opacity-40`,children:[n.length,` issues`]})})]}):(0,V.jsxs)(`div`,{className:`stats stats-horizontal bg-base-200 rounded-box w-full mb-4 overflow-x-auto animate-fade-in`,children:[(0,V.jsxs)(`div`,{className:`stat`,children:[(0,V.jsx)(`div`,{className:`stat-figure text-primary hidden sm:inline`,children:(0,V.jsx)(I,{className:`size-7`})}),(0,V.jsx)(`div`,{className:`stat-title`,children:`Tokens Used`}),(0,V.jsx)(`div`,{className:`stat-value text-lg`,children:(0,V.jsx)(Fi,{value:s})}),(0,V.jsx)(`div`,{className:`stat-desc`,children:d?`${n.length} issues`:`No token data yet`})]}),(0,V.jsxs)(`div`,{className:`stat`,children:[(0,V.jsx)(`div`,{className:`stat-figure text-info hidden sm:inline`,children:(0,V.jsx)(Vt,{className:`size-7`})}),(0,V.jsx)(`div`,{className:`stat-title`,children:`Phase Split`}),(0,V.jsx)(`div`,{className:`stat-value p-0`,children:c?(0,V.jsx)(Ii,{byPhase:c}):(0,V.jsx)(`div`,{className:`text-sm opacity-30 py-1`,children:`--`})}),(0,V.jsx)(`div`,{className:`stat-desc`,children:h.length>0?h.map(([e,t])=>`${e.split(`-`).pop()}: ${$(t)}`).join(` · `):`Across all models`})]}),(0,V.jsxs)(`div`,{className:`stat`,children:[(0,V.jsx)(`div`,{className:`stat-figure text-accent hidden sm:inline`,children:(0,V.jsx)(gn,{className:`size-7`})}),(0,V.jsx)(`div`,{className:`stat-title`,children:`Last 7 days`}),(0,V.jsx)(`div`,{className:`stat-value p-0`,children:d&&l.length>0?(0,V.jsx)(Li,{data:l,height:36}):(0,V.jsx)(`div`,{className:`text-sm opacity-30 py-1`,children:`--`})}),(0,V.jsx)(`div`,{className:`stat-desc`,children:d&&h.length>0&&(0,V.jsx)(`span`,{className:`flex items-center gap-2 mt-1`,children:h.slice(0,3).map(([e])=>{let t=e.includes(`claude`)?`bg-primary`:e.includes(`gpt`)||e.includes(`codex`)?`bg-secondary`:`bg-accent`,n=Pi(e);return(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,children:[(0,V.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full ${t}`}),n]},e)})})})]})]})}var Hi=b(`/kanban`)({component:Ui});function Ui(){let e=Xe(),{data:t}=Ee();return(0,V.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 px-3 pb-2 gap-2`,children:[((t?.overall?.totalTokens||0)>0||e.issues.length>0)&&(0,V.jsx)(Vi,{metrics:e.metrics,total:e.issues.length,issues:e.issues,compact:!0}),(0,V.jsx)(Ni,{issues:e.filtered,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,onCreateIssue:()=>e.setIsCreateOpen(!0)})]})}var Wi={Planning:`badge-info`,Todo:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Interrupted:`badge-accent`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},Gi={Planning:`border-l-info`,Todo:`border-l-warning`,Queued:`border-l-info`,Running:`border-l-primary`,Interrupted:`border-l-accent`,"In Review":`border-l-secondary`,Blocked:`border-l-error`,Done:`border-l-success`,Cancelled:`border-l-neutral`};function Ki(e){return!e||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function qi({icon:e,label:t,value:n,color:r=``}){return!n&&n!==0?null:(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[10px]`,title:t,children:[(0,V.jsx)(e,{className:`size-2.5 ${r||`opacity-40`}`}),(0,V.jsx)(`span`,{className:`font-mono opacity-70`,children:n})]})}function Ji(e){let t=e.createdAt?new Date(e.createdAt).getTime():0,n=e.startedAt?new Date(e.startedAt).getTime():0,r=e.completedAt?new Date(e.completedAt).getTime():0,i=Date.now();return{leadTimeMs:r?r-t:n?i-t:0,cycleTimeMs:r&&n?r-n:n?i-n:0,waitTimeMs:n?n-t:t?i-t:0}}function Yi({issue:e,onSelect:t}){let n=e.state===`Running`,r=Ki(e.tokenUsage?.totalTokens),i=e.description||``,a=(e.labels||[]).filter(e=>!e.startsWith(`capability:`)&&!e.startsWith(`overlay:`)),{leadTimeMs:o,cycleTimeMs:s,waitTimeMs:c}=Ji(e);return e.state===`Done`||e.state,(0,V.jsx)(`div`,{className:`card bg-base-100 border border-base-300 border-l-[3px] ${Gi[e.state]||``} card-interactive cursor-pointer hover:shadow-lg transition-all ${n?`animate-pulse-border`:``}`,role:`button`,tabIndex:0,onClick:()=>t?.(e),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t?.(e))},children:(0,V.jsxs)(`div`,{className:`card-body gap-3 p-4 justify-between`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1.5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,V.jsx)(`span`,{className:`badge badge-xs ${Wi[e.state]||`badge-ghost`}`,children:e.state}),(0,V.jsxs)(`span`,{className:`text-[10px] opacity-30`,children:[`P`,e.priority]})]}),(0,V.jsx)(`span`,{className:`text-xs opacity-40 shrink-0`,children:j(e.updatedAt)})]}),(0,V.jsx)(`h3`,{className:`font-semibold text-sm leading-snug line-clamp-2`,children:e.title}),i&&(0,V.jsx)(`p`,{className:`text-xs opacity-50 leading-relaxed line-clamp-2 mt-1`,children:i})]}),(a.length>0||e.capabilityCategory)&&(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.capabilityCategory&&(0,V.jsxs)(`span`,{className:`badge badge-xs badge-outline`,children:[(0,V.jsx)(Vt,{className:`size-2.5 mr-0.5`}),e.capabilityCategory]}),a.slice(0,3).map(e=>(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e},e)),a.length>3&&(0,V.jsxs)(`span`,{className:`badge badge-xs badge-ghost opacity-40`,children:[`+`,a.length-3]})]}),[`Planning`,`Queued`,`Running`,`In Review`,`Blocked`].includes(e.state)&&(0,V.jsx)(`div`,{className:`pt-1`,children:(0,V.jsx)(Qn,{issue:e,showElapsed:!0})}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pt-2 border-t border-base-200`,children:[(0,V.jsx)(qi,{icon:Lt,label:`Wait`,value:c>0?N(c):null}),(0,V.jsx)(qi,{icon:hn,label:`Cycle`,value:s>0?N(s):null,color:`text-primary`}),(0,V.jsx)(qi,{icon:xt,label:`Lead`,value:o>0?N(o):null}),(0,V.jsx)(qi,{icon:I,label:`Tokens`,value:r,color:`text-warning`}),(0,V.jsx)(qi,{icon:Ct,label:`Cost`,value:e.tokenUsage?.costUsd?`$${e.tokenUsage.costUsd.toFixed(2)}`:null,color:`text-secondary`}),(0,V.jsx)(qi,{icon:K,label:`Attempts`,value:e.attempts>0?`${e.attempts}/${e.maxAttempts}`:null}),(0,V.jsx)(qi,{icon:Dt,label:`Files`,value:e.filesChanged||null,color:`text-info`}),e.linesAdded?(0,V.jsxs)(`span`,{className:`text-[10px] font-mono text-success`,children:[`+`,e.linesAdded]}):null,e.linesRemoved?(0,V.jsxs)(`span`,{className:`text-[10px] font-mono text-error`,children:[`-`,e.linesRemoved]}):null]})]})})}function Xi({issues:e,onStateChange:t,onRetry:n,onCancel:r,onSelect:i,expanded:a=!1}){return e.length===0?(0,V.jsx)(li,{icon:Ht,title:`No issues found`,description:`Try adjusting your search or filters, or create your first issue to get started.`}):a?(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3 stagger-children`,children:e.map(e=>(0,V.jsx)(Yi,{issue:e,onSelect:i},e.id))}):(0,V.jsx)(`div`,{className:`space-y-2 stagger-children`,children:e.map(e=>(0,V.jsx)(ci,{issue:e,onSelect:i},e.id))})}var Zi=[`Planning`,`Todo`,`Queued`,`Running`,`Interrupted`,`In Review`,`Blocked`,`Done`,`Cancelled`],Qi={Planning:`badge-info`,Todo:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Interrupted:`badge-accent`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},$i=[{value:`recent`,label:`Active + recent`},{value:`all`,label:`All issues`}],ea=b(`/issues`)({component:ta});function ta(){let e=Xe(),[t,n]=(0,B.useState)(!1),r=e.stateFilter!==`all`||e.categoryFilter!==`all`||e.completionFilter!==`recent`,i=(e.data._totalIssues??0)-(e.issues.length??0),a=(e.stateFilter===`all`?0:1)+(e.categoryFilter===`all`?0:1)+(e.completionFilter===`recent`?0:1),o={};for(let t of e.issues)o[t.state]=(o[t.state]||0)+1;let s=(0,B.useMemo)(()=>[...e.filtered].sort((e,t)=>{let n=e.updatedAt||e.createdAt||``;return(t.updatedAt||t.createdAt||``).localeCompare(n)}),[e.filtered]),c=()=>{e.setQuery(``),e.setStateFilter(`all`),e.setCategoryFilter(`all`),e.setCompletionFilter(`recent`)};return(0,V.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:[(0,V.jsxs)(`div`,{className:`sticky top-0 z-10 bg-base-100 pt-3 pb-3 border-b border-base-300 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`label`,{className:`input input-bordered input-sm flex items-center gap-2 flex-1`,children:[(0,V.jsx)(nn,{className:`size-4 opacity-40`}),(0,V.jsx)(`input`,{type:`text`,className:`grow`,placeholder:`Search by title, ID, or description...`,value:e.query,onChange:t=>e.setQuery(t.target.value)}),e.query&&(0,V.jsx)(`button`,{className:`btn btn-xs btn-ghost btn-circle`,onClick:()=>e.setQuery(``),children:(0,V.jsx)(J,{className:`size-3`})})]}),(0,V.jsx)(`button`,{className:`btn btn-sm btn-square ${t?`btn-primary`:`btn-ghost`}`,onClick:()=>n(!t),title:`Toggle filters`,children:(0,V.jsx)(rn,{className:`size-4`})}),a>0&&(0,V.jsx)(`span`,{className:`badge badge-sm badge-primary`,children:a}),(0,V.jsxs)(O,{to:`/discover`,className:`btn btn-sm btn-ghost gap-1`,title:`Discover issues from codebase`,children:[(0,V.jsx)(U,{className:`size-4`}),(0,V.jsx)(`span`,{className:`hidden sm:inline`,children:`Discover`})]}),(0,V.jsxs)(`div`,{className:`text-xs opacity-40 shrink-0`,children:[e.filtered.length,` result`,e.filtered.length===1?``:`s`,i>0&&e.completionFilter===`recent`&&(0,V.jsxs)(`span`,{children:[` · `,i,` older hidden`]})]})]}),t&&(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`State`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,V.jsx)(`button`,{className:`badge badge-sm cursor-pointer ${e.stateFilter===`all`?`badge-primary`:`badge-ghost opacity-60 hover:opacity-100`}`,onClick:()=>e.setStateFilter(`all`),children:`All`}),Zi.map(t=>{let n=o[t]||0,r=e.stateFilter===t;return(0,V.jsxs)(`button`,{className:`badge badge-sm gap-1 cursor-pointer transition-all ${r?Qi[t]:`badge-outline opacity-60 hover:opacity-100`}`,onClick:()=>e.setStateFilter(r?`all`:t),children:[t,n>0&&(0,V.jsx)(`span`,{className:`font-mono text-[10px]`,children:n})]},t)})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[e.categoryOptions.length>2&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`Capability`}),(0,V.jsx)(`select`,{className:`select select-bordered select-sm`,value:e.categoryFilter,onChange:t=>e.setCategoryFilter(t.target.value),children:e.categoryOptions.map(e=>(0,V.jsx)(`option`,{value:e,children:e===`all`?`All capabilities`:e},e))})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`Show`}),(0,V.jsx)(`select`,{className:`select select-bordered select-sm`,value:e.completionFilter,onChange:t=>e.setCompletionFilter(t.target.value),children:$i.map(e=>(0,V.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),r&&(0,V.jsx)(`div`,{className:`flex items-end`,children:(0,V.jsxs)(`button`,{className:`btn btn-sm btn-ghost gap-1`,onClick:c,children:[(0,V.jsx)(J,{className:`size-3`}),`Clear all`]})})]})]}),!t&&r&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,V.jsx)(jt,{className:`size-3 opacity-40`}),e.stateFilter!==`all`&&(0,V.jsxs)(`span`,{className:`badge badge-sm gap-1 ${Qi[e.stateFilter]}`,children:[e.stateFilter,(0,V.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setStateFilter(`all`),children:(0,V.jsx)(J,{className:`size-2.5`})})]}),e.categoryFilter!==`all`&&(0,V.jsxs)(`span`,{className:`badge badge-sm badge-outline gap-1`,children:[e.categoryFilter,(0,V.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setCategoryFilter(`all`),children:(0,V.jsx)(J,{className:`size-2.5`})})]}),e.completionFilter!==`recent`&&(0,V.jsxs)(`span`,{className:`badge badge-sm badge-ghost gap-1`,children:[`All issues`,(0,V.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setCompletionFilter(`recent`),children:(0,V.jsx)(J,{className:`size-2.5`})})]}),(0,V.jsx)(`button`,{className:`text-xs opacity-40 hover:opacity-100 underline`,onClick:c,children:`clear all`})]})]}),(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3`,children:(0,V.jsx)(Xi,{issues:s,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,expanded:!0})})]})}var na=[{id:`todos`,label:`TODOs & FIXMEs`,icon:Dt},{id:`github`,label:`GitHub Issues`,icon:Ft}],ra={todo:{label:`TODO`,class:`badge-info`},fixme:{label:`FIXME`,class:`badge-error`},hack:{label:`HACK`,class:`badge-warning`},github:{label:`GitHub`,class:`badge-neutral`}};function ia({item:e,selected:t,onToggle:n,onCreateSingle:r,creating:i}){let a=ra[e.source]||ra.todo;return(0,V.jsx)(`div`,{className:`card card-compact bg-base-200/50 border transition-all duration-150 ${t?`border-primary/40 bg-primary/5`:`border-base-300/50 hover:border-base-content/20`}`,children:(0,V.jsx)(`div`,{className:`card-body gap-2`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(`button`,{className:`mt-0.5 shrink-0 opacity-60 hover:opacity-100 transition-opacity`,onClick:()=>n(e),children:t?(0,V.jsx)(cn,{className:`size-5 text-primary`}):(0,V.jsx)(ln,{className:`size-5`})}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,V.jsx)(`span`,{className:`badge badge-xs ${a.class}`,children:a.label}),e.category&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e.category})]}),(0,V.jsx)(`p`,{className:`text-sm font-medium mt-1 leading-snug`,children:e.title}),e.file&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1.5 text-xs text-base-content/50`,children:[(0,V.jsx)(kt,{className:`size-3`}),(0,V.jsx)(`span`,{className:`truncate`,children:e.file}),e.line>0&&(0,V.jsxs)(`span`,{children:[`:`,e.line]})]}),e.suggestedLabels?.length>0&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1 mt-1.5 flex-wrap`,children:[(0,V.jsx)(dn,{className:`size-3 text-base-content/40`}),e.suggestedLabels.slice(0,4).map(e=>(0,V.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:e},e))]})]}),(0,V.jsx)(`button`,{className:`btn btn-xs btn-ghost btn-square shrink-0`,onClick:()=>r(e),disabled:i,title:`Create issue`,children:(0,V.jsx)(Qt,{className:`size-3.5`})})]})})})}function aa({embedded:e=!1,onBack:t}){let[n,r]=(0,B.useState)(`todos`),[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)([]),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(null),[f,p]=(0,B.useState)(new Set),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(0),[v,y]=(0,B.useState)(``),b=e?null:Xe(),x=n===`todos`?i:o,S=v.trim()?x.filter(e=>e.title.toLowerCase().includes(v.toLowerCase())||e.file?.toLowerCase().includes(v.toLowerCase())||e.category?.toLowerCase().includes(v.toLowerCase())):x,C=(0,B.useCallback)(async e=>{l(!0),d(null);try{let t=e===`todos`?`/scan/issues`:`/scan/github-issues`,n=(await L.get(t)).issues||[];e===`todos`?a(n):s(n)}catch(e){d(e.message||`Failed to scan`)}finally{l(!1)}},[]);(0,B.useEffect)(()=>{(n===`todos`?i:o).length===0&&C(n)},[n]);let w=(0,B.useCallback)(e=>{let t=`${e.source}:${e.file}:${e.line}:${e.title}`;p(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),T=e=>`${e.source}:${e.file}:${e.line}:${e.title}`,E=(0,B.useCallback)(()=>{p(new Set(S.map(T)))},[S]),ee=(0,B.useCallback)(()=>{p(new Set)},[]),D=(0,B.useCallback)(async e=>{let t={title:e.title,description:e.context||e.title,labels:e.suggestedLabels||[e.source],paths:e.suggestedPaths||(e.file?[e.file]:[])};await L.post(`/issues/create`,t)},[]),O=(0,B.useCallback)(async e=>{h(!0);try{await D(e),_(e=>e+1);let t=T(e);p(e=>{let n=new Set(e);return n.delete(t),n}),n===`todos`?a(e=>e.filter(e=>T(e)!==t)):s(e=>e.filter(e=>T(e)!==t)),b?.showToast?.(`Issue created`,`success`)}catch(e){b?.showToast?.(e.message||`Failed to create issue`,`error`)}finally{h(!1)}},[n,b,D]),k=(0,B.useCallback)(async()=>{if(f.size===0)return;h(!0);let e=0,t=S.filter(e=>f.has(T(e)));for(let n of t)try{await D(n),e++}catch{}_(t=>t+e);let r=new Set(t.map(T));n===`todos`?a(e=>e.filter(e=>!r.has(T(e)))):s(e=>e.filter(e=>!r.has(T(e)))),p(new Set),h(!1),b?.showToast?.(`${e} issue(s) created`,`success`)},[f,S,n,b,D]);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 ${e?``:`p-4 max-w-4xl mx-auto w-full`}`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t&&(0,V.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square`,onClick:t,children:(0,V.jsx)(et,{className:`size-4`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h2`,{className:`font-bold ${e?`text-xl`:`text-2xl`}`,children:e?`Discover Issues`:`Discover Issues in Codebase`}),!e&&(0,V.jsx)(`p`,{className:`text-sm text-base-content/60 mt-0.5`,children:`Scan your code for TODOs, FIXMEs, and import GitHub issues`})]}),g>0&&(0,V.jsxs)(`div`,{className:`badge badge-success gap-1`,children:[(0,V.jsx)(Qt,{className:`size-3`}),` `,g,` created`]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{role:`tablist`,className:`tabs tabs-boxed tabs-sm flex-1`,children:na.map(e=>{let t=e.icon,a=e.id===`todos`?i.length:o.length;return(0,V.jsxs)(`button`,{role:`tab`,className:`tab gap-1.5 ${n===e.id?`tab-active`:``}`,onClick:()=>r(e.id),children:[(0,V.jsx)(t,{className:`size-3.5`}),e.label,a>0&&(0,V.jsx)(`span`,{className:`badge badge-xs`,children:a})]},e.id)})}),(0,V.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square`,onClick:()=>C(n),disabled:c,title:`Refresh`,children:(0,V.jsx)(en,{className:`size-4 ${c?`animate-spin`:``}`})})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`label`,{className:`input input-sm input-bordered flex items-center gap-2 flex-1`,children:[(0,V.jsx)(nn,{className:`size-3.5 opacity-50`}),(0,V.jsx)(`input`,{type:`text`,className:`grow`,placeholder:`Filter by title, file, or category...`,value:v,onChange:e=>y(e.target.value)})]}),S.length>0&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(`button`,{className:`btn btn-ghost btn-xs`,onClick:E,children:`All`}),(0,V.jsx)(`button`,{className:`btn btn-ghost btn-xs`,onClick:ee,children:`None`})]}),f.size>0&&(0,V.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:k,disabled:m,children:[m?(0,V.jsx)(G,{className:`size-3.5 animate-spin`}):(0,V.jsx)(Qt,{className:`size-3.5`}),`Create `,f.size,` issue`,f.size===1?``:`s`]})]}),c&&x.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3`,children:[(0,V.jsx)(G,{className:`size-8 animate-spin text-primary`}),(0,V.jsx)(`p`,{className:`text-sm text-base-content/50`,children:n===`todos`?`Scanning codebase for TODOs...`:`Fetching GitHub issues...`})]}):u?(0,V.jsxs)(`div`,{className:`alert alert-warning`,children:[(0,V.jsx)(q,{className:`size-4`}),(0,V.jsx)(`span`,{children:u}),(0,V.jsx)(`button`,{className:`btn btn-sm btn-ghost`,onClick:()=>C(n),children:`Retry`})]}):S.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-2 opacity-50`,children:[n===`todos`?(0,V.jsx)(Dt,{className:`size-10`}):(0,V.jsx)(Ft,{className:`size-10`}),(0,V.jsx)(`p`,{className:`text-sm`,children:x.length===0?n===`todos`?`No TODOs or FIXMEs found in your codebase`:`No open GitHub issues found`:`No items match your search`})]}):(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`p`,{className:`text-xs text-base-content/40`,children:[S.length,` item`,S.length===1?``:`s`,` found`,f.size>0&&` \u00b7 ${f.size} selected`]}),S.map((e,t)=>(0,V.jsx)(ia,{item:e,selected:f.has(T(e)),onToggle:w,onCreateSingle:O,creating:m},`${e.source}-${e.file}-${e.line}-${t}`))]})]})}function oa({onIssuesCreated:e}){let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)([]),[a,o]=(0,B.useState)(`todos`),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(new Set),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)(0),h=a===`todos`?t:r,g=(0,B.useCallback)(async e=>{c(!0);try{let t=e===`todos`?`/scan/issues`:`/scan/github-issues`,r=await L.get(t);e===`todos`?n(r.issues||[]):i(r.issues||[])}catch{}finally{c(!1)}},[]);(0,B.useEffect)(()=>{g(`todos`)},[]),(0,B.useEffect)(()=>{(a===`todos`?t:r).length===0&&a===`github`&&g(`github`)},[a]);let _=e=>`${e.source}:${e.file}:${e.line}:${e.title}`,v=(0,B.useCallback)(e=>{let t=_(e);u(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),y=(0,B.useCallback)(async()=>{if(l.size===0)return;f(!0);let t=0,r=h.filter(e=>l.has(_(e)));for(let e of r)try{await L.post(`/issues/create`,{title:e.title,description:e.context||e.title,labels:e.suggestedLabels||[e.source],paths:e.suggestedPaths||(e.file?[e.file]:[])}),t++}catch{}let o=new Set(r.map(_));a===`todos`?n(e=>e.filter(e=>!o.has(_(e)))):i(e=>e.filter(e=>!o.has(_(e)))),u(new Set),f(!1),m(e=>e+t),e?.(t)},[l,h,a,e]);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 stagger-children`,children:[(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(nn,{className:`size-10 text-primary mx-auto mb-3`}),(0,V.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Discover Issues`}),(0,V.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`We found items in your codebase that could become issues`})]}),(0,V.jsx)(`div`,{role:`tablist`,className:`tabs tabs-boxed tabs-sm justify-center`,children:na.map(e=>{let n=e.icon,i=e.id===`todos`?t.length:r.length;return(0,V.jsxs)(`button`,{role:`tab`,className:`tab gap-1.5 ${a===e.id?`tab-active`:``}`,onClick:()=>o(e.id),children:[(0,V.jsx)(n,{className:`size-3.5`}),e.label,i>0&&(0,V.jsx)(`span`,{className:`badge badge-xs`,children:i})]},e.id)})}),s?(0,V.jsxs)(`div`,{className:`flex flex-col items-center py-8 gap-2`,children:[(0,V.jsx)(G,{className:`size-6 animate-spin text-primary`}),(0,V.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Scanning...`})]}):h.length===0?(0,V.jsx)(`div`,{className:`text-center py-8 opacity-50`,children:(0,V.jsx)(`p`,{className:`text-sm`,children:a===`todos`?`No TODOs or FIXMEs found`:`No open GitHub issues found`})}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 max-h-72 overflow-y-auto pr-1`,children:[h.slice(0,30).map((e,t)=>{let n=_(e),r=l.has(n),i=ra[e.source]||ra.todo;return(0,V.jsxs)(`button`,{className:`flex items-start gap-3 p-3 rounded-lg text-left transition-all duration-100 ${r?`bg-primary/10 border border-primary/30`:`bg-base-200/50 border border-transparent hover:bg-base-200`}`,onClick:()=>v(e),children:[r?(0,V.jsx)(cn,{className:`size-4 text-primary mt-0.5 shrink-0`}):(0,V.jsx)(ln,{className:`size-4 opacity-40 mt-0.5 shrink-0`}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`badge badge-xs ${i.class}`,children:i.label}),e.category&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e.category})]}),(0,V.jsx)(`p`,{className:`text-sm mt-0.5 truncate`,children:e.title}),e.file&&(0,V.jsxs)(`p`,{className:`text-xs text-base-content/40 truncate mt-0.5`,children:[e.file,`:`,e.line]})]})]},`${n}-${t}`)}),h.length>30&&(0,V.jsxs)(`p`,{className:`text-xs text-center text-base-content/40 py-2`,children:[`Showing 30 of `,h.length,` items. Open the full view in the dashboard.`]})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(`button`,{className:`btn btn-ghost btn-xs`,onClick:()=>u(new Set(h.slice(0,30).map(_))),children:`Select all`}),(0,V.jsx)(`button`,{className:`btn btn-ghost btn-xs`,onClick:()=>u(new Set),children:`Clear`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p>0&&(0,V.jsxs)(`span`,{className:`badge badge-success badge-sm gap-1`,children:[(0,V.jsx)(Qt,{className:`size-3`}),` `,p]}),l.size>0&&(0,V.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:y,disabled:d,children:[d?(0,V.jsx)(G,{className:`size-3.5 animate-spin`}):(0,V.jsx)(Qt,{className:`size-3.5`}),`Create `,l.size,` issue`,l.size===1?``:`s`]})]})]})]}),(0,V.jsx)(`p`,{className:`text-xs text-center text-base-content/40`,children:`This step is optional. You can always discover issues later from the dashboard.`})]})}var sa=b(`/discover`)({component:ca});function ca(){let e=h();return(0,V.jsx)(aa,{onBack:()=>e({to:`/issues`})})}var la=b(`/analytics`)({}),ua={Queued:`badge-info`,Running:`badge-primary`,Interrupted:`badge-accent`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},da={Queued:Ut,Running:yt,Interrupted:Xt,"In Review":yt,Blocked:q,Done:H,Cancelled:vt};function fa(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function pa({issueId:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useCallback)(async()=>{try{n(await L.get(`/live/${encodeURIComponent(e)}`))}catch{}},[e]);if((0,B.useEffect)(()=>{r();let e=setInterval(r,4e3);return()=>clearInterval(e)},[r]),!t)return null;let i=Number.isFinite(Number(t.elapsed))?Number(t.elapsed):t.startedAt?Math.max(Date.now()-new Date(t.startedAt).getTime(),0):0,a=t.logSize?(t.logSize/1024).toFixed(1):`0`;return(0,V.jsxs)(`div`,{className:`mt-2 space-y-1.5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 text-xs opacity-60`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(xt,{className:`size-3`}),N(i)]}),(0,V.jsxs)(`span`,{children:[`Log: `,a,` KB`]}),t.agentPid&&(0,V.jsxs)(`span`,{children:[`PID `,t.agentPid]}),t.agentAlive===!1&&t.agentPid&&(0,V.jsx)(`span`,{className:`text-error`,children:`dead`})]}),t.logTail&&(0,V.jsx)(`pre`,{className:`text-[11px] bg-base-300 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-48 overflow-y-auto font-mono opacity-80 leading-relaxed break-all w-full max-w-full`,children:t.logTail.slice(-2e3)})]})}function ma({index:e,issue:t,total:n}){if(!t)return(0,V.jsx)(`div`,{className:`slot-idle rounded-box p-6 flex items-center justify-center opacity-30 transition-opacity duration-300 hover:opacity-40 border-2 border-dashed border-base-300`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(yt,{className:`size-5 animate-pulse-soft`}),`Slot `,e+1,` -- idle`]})});let r=t.state===`Running`;return(0,V.jsxs)(`div`,{className:`border-2 rounded-box p-5 space-y-2 animate-fade-in-scale overflow-hidden min-w-0 ${t.state===`In Review`?`border-secondary bg-secondary/5`:`border-primary bg-primary/5`} ${r?`slot-active`:``}`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,V.jsx)(`span`,{className:`loading loading-spinner loading-sm text-primary shrink-0`}),(0,V.jsx)(`span`,{className:`font-mono text-base font-bold truncate`,children:t.identifier}),(0,V.jsx)(`span`,{className:`badge badge-sm ${ua[t.state]||`badge-ghost`} shrink-0`,children:t.state})]}),(0,V.jsxs)(`span`,{className:`text-xs font-mono opacity-50 shrink-0 bg-base-200 px-2 py-0.5 rounded`,children:[`Slot `,e+1,`/`,n]})]}),(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:t.title}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs opacity-60`,children:[t.capabilityCategory&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:t.capabilityCategory}),(0,V.jsxs)(`span`,{children:[`P`,t.priority]}),(0,V.jsxs)(`span`,{children:[`Attempt `,(t.attempts||0)+1,`/`,t.maxAttempts]}),t.startedAt&&(0,V.jsxs)(`span`,{children:[`started `,j(t.startedAt)]})]}),(0,V.jsx)(pa,{issueId:t.id})]})}function ha({issue:e}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,V.jsx)(da[e.state]||yt,{className:`size-3 opacity-40 shrink-0`}),(0,V.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,V.jsx)(`span`,{className:`truncate flex-1`,children:e.title}),(0,V.jsx)(`span`,{className:`badge badge-xs ${ua[e.state]||`badge-ghost`}`,children:e.state}),e.state===`Blocked`&&e.nextRetryAt&&(0,V.jsxs)(`span`,{className:`opacity-40 shrink-0`,children:[`retry `,j(e.nextRetryAt)]})]})}function ga({issue:e}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,V.jsx)(e.state===`Done`?H:vt,{className:`size-3 shrink-0 ${e.state===`Done`?`text-success`:`text-neutral`}`}),(0,V.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,V.jsx)(`span`,{className:`truncate flex-1 opacity-70`,children:e.title}),e.durationMs&&(0,V.jsx)(`span`,{className:`opacity-40 shrink-0`,children:N(e.durationMs)}),e.completedAt&&(0,V.jsx)(`span`,{className:`opacity-40 shrink-0`,children:j(e.completedAt)})]})}function _a({running:e,queued:t,concurrency:n,totalTokensToday:r}){return(0,V.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 pt-3`,children:[(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`bg-primary/10 rounded-btn p-2`,children:(0,V.jsx)(_n,{className:`size-5 text-primary`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`text-2xl font-bold font-mono`,children:[e.length,(0,V.jsxs)(`span`,{className:`text-sm opacity-50`,children:[`/`,n]})]}),(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Active agents`})]})]}),(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`bg-info/10 rounded-btn p-2`,children:(0,V.jsx)(Ut,{className:`size-5 text-info`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:t.length}),(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Queued`})]})]}),(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`bg-accent/10 rounded-btn p-2`,children:(0,V.jsx)(I,{className:`size-5 text-accent`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:fa(r)}),(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Tokens today`})]})]}),(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`bg-secondary/10 rounded-btn p-2`,children:(0,V.jsx)(Mt,{className:`size-5 text-secondary`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:n}),(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Max parallelism`})]})]})]})}function va({state:e,providers:t,parallelism:n,onRefresh:r,issues:i=[]}){let a=Array.isArray(e.issues)?e.issues:[],o=Number(e.config?.workerConcurrency)||2,s=a.filter(e=>e.state===`Running`||e.state===`In Review`),c=a.filter(e=>e.state===`Todo`||e.state===`Queued`||e.state===`Interrupted`||e.state===`Blocked`&&e.nextRetryAt),l=a.filter(e=>e.state===`Done`||e.state===`Cancelled`).sort((e,t)=>(t.completedAt||``).localeCompare(e.completedAt||``)).slice(0,10),u=(0,B.useMemo)(()=>{let e=new Date().toISOString().slice(0,10),t=0;for(let n of i)n.tokenUsage?.totalTokens&&(n.completedAt||n.updatedAt||``).slice(0,10)===e&&(t+=n.tokenUsage.totalTokens);return t},[i]),d=[];for(let e=0;e<o;e++)d.push(s[e]||null);return(0,V.jsxs)(`div`,{className:`space-y-5 min-w-0 overflow-hidden flex-1`,children:[(0,V.jsx)(_a,{running:s,queued:c,concurrency:o,totalTokensToday:u}),(0,V.jsxs)(`div`,{className:`space-y-3 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[(0,V.jsx)(Tt,{className:`size-4 opacity-50`}),`Active Agents`]}),(0,V.jsxs)(`span`,{className:`text-xs opacity-50`,children:[s.length,`/`,o,` slots`]})]}),(0,V.jsx)(`div`,{className:`grid gap-3 min-w-0`,style:{gridTemplateColumns:`repeat(${Math.min(o,3)}, 1fr)`},children:d.map((e,t)=>(0,V.jsx)(ma,{index:t,issue:e,total:o},t))})]}),c.length>0&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,V.jsx)(Ut,{className:`size-4 opacity-50`}),`Queue`,(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:c.length})]}),(0,V.jsxs)(`div`,{className:`space-y-1 stagger-children`,children:[c.slice(0,12).map(e=>(0,V.jsx)(ha,{issue:e},e.id)),c.length>12&&(0,V.jsxs)(`div`,{className:`text-xs opacity-40 pl-3`,children:[`+`,c.length-12,` more`]})]})]}),l.length>0&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,V.jsx)(H,{className:`size-4 opacity-50`}),`Recently Completed`,(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:l.length})]}),(0,V.jsx)(`div`,{className:`space-y-1 stagger-children`,children:l.map(e=>(0,V.jsx)(ga,{issue:e},e.id))})]}),s.length===0&&c.length===0&&l.length===0&&(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 animate-fade-in-up`,children:[(0,V.jsx)(`div`,{className:`bg-primary/10 rounded-full p-5 mb-4`,children:(0,V.jsx)(Tt,{className:`size-10 text-primary opacity-60`})}),(0,V.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:`No agents running`}),(0,V.jsx)(`p`,{className:`text-sm opacity-50 text-center max-w-xs`,children:`Approve a plan on an issue to start an agent, or create a new issue from the Kanban board.`})]})]})}var ya=b(`/agents`)({component:ba});function ba(){let e=Xe();return(0,V.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:(0,V.jsx)(va,{state:e.data,providers:e.providers.data||{},parallelism:e.parallelism.data||{},onRefresh:e.refresh,issues:e.issues})})}var xa=b(`/`)({beforeLoad:()=>{throw te({to:`/kanban`})}}),Sa=b(`/settings/`)({beforeLoad:()=>{throw te({to:`/settings/general`})}}),Ca=[{key:`plan`,label:`Plan`,icon:W,description:`Generate the execution plan`,accent:`info`},{key:`execute`,label:`Execute`,icon:Zt,description:`Implement the changes`,accent:`primary`},{key:`review`,label:`Review`,icon:U,description:`Review the implementation`,accent:`secondary`}],wa=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`extra-high`,label:`Extra High`}],Ta={info:{border:`border-info/30`,bg:`bg-info/10`,text:`text-info`,step:`step-info`,badge:`badge-info`},primary:{border:`border-primary/30`,bg:`bg-primary/10`,text:`text-primary`,step:`step-primary`,badge:`badge-primary`},secondary:{border:`border-secondary/30`,bg:`bg-secondary/10`,text:`text-secondary`,step:`step-secondary`,badge:`badge-secondary`}};function Ea({stage:e,config:t,providers:n,modelsByProvider:r,onChange:i,isLast:a,saving:o}){let s=e.icon,c=r[t.provider]||[],l=(n||[]).filter(e=>e.available),u=Ta[e.accent];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`card bg-base-200 border-l-4 ${u.border} animate-fade-in`,children:(0,V.jsxs)(`div`,{className:`card-body p-4 gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`flex items-center justify-center size-9 rounded-lg ${u.bg}`,children:(0,V.jsx)(s,{className:`size-4.5 ${u.text}`})}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-sm`,children:e.label}),(0,V.jsx)(`span`,{className:`badge badge-xs ${u.badge} badge-outline`,children:t.provider}),o===e.key&&(0,V.jsxs)(`span`,{className:`text-xs text-success flex items-center gap-1 animate-fade-in`,children:[(0,V.jsx)(dt,{className:`size-3`}),` saved`]})]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50`,children:e.description})]})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2`,children:[(0,V.jsxs)(`label`,{className:`form-control`,children:[(0,V.jsx)(`div`,{className:`label py-0.5`,children:(0,V.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Provider`})}),(0,V.jsx)(`select`,{className:`select select-bordered select-sm w-full`,value:t.provider,onChange:e=>{let n=e.target.value,a=r[n]||[],o=n!==`codex`&&t.effort===`extra-high`?`high`:t.effort;i({...t,provider:n,model:a[0]?.id||n,effort:o})},children:l.map(e=>(0,V.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),(0,V.jsxs)(`label`,{className:`form-control`,children:[(0,V.jsx)(`div`,{className:`label py-0.5`,children:(0,V.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Model`})}),(0,V.jsxs)(`select`,{className:`select select-bordered select-sm w-full`,value:t.model,onChange:e=>i({...t,model:e.target.value}),children:[c.length===0&&(0,V.jsx)(`option`,{value:t.model,children:t.model||`(detecting...)`}),c.map(e=>(0,V.jsxs)(`option`,{value:e.id,children:[e.label,e.tier?` — ${e.tier}`:``]},e.id))]})]}),(0,V.jsxs)(`label`,{className:`form-control`,children:[(0,V.jsx)(`div`,{className:`label py-0.5`,children:(0,V.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Effort`})}),(0,V.jsx)(`select`,{className:`select select-bordered select-sm w-full`,value:t.effort,onChange:e=>i({...t,effort:e.target.value}),children:wa.filter(e=>t.provider===`codex`||e.value!==`extra-high`).map(e=>(0,V.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})}),!a&&(0,V.jsx)(`div`,{className:`flex justify-center py-0.5`,children:(0,V.jsx)($e,{className:`size-4 opacity-20`})})]})}var Da=b(`/settings/workflow`)({component:Oa});function Oa(){let e=w(),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)([]),[a,o]=(0,B.useState)({}),[s,c]=(0,B.useState)(!0),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),p=(0,B.useRef)(null),m=(0,B.useCallback)(t=>{e.setQueryData(ye,e=>we(e,{id:`runtime.workflowConfig`,scope:`runtime`,value:t,source:`user`,updatedAt:new Date().toISOString()})),e.setQueryData([`workflow-config`],{ok:!0,workflow:t,isDefault:!1})},[e]),h=(0,B.useCallback)(async()=>{c(!0);try{let e=await L.get(`/config/workflow?details=1`);n(e.workflow),i(e.providers||[]),o(e.models||{})}catch{}c(!1)},[]);(0,B.useEffect)(()=>{h()},[h]);let g=(0,B.useCallback)((e,t)=>{p.current&&clearTimeout(p.current),p.current=setTimeout(async()=>{try{await L.post(`/config/workflow`,{workflow:e}),m(e),u(t),setTimeout(()=>u(null),1500)}catch{}},600)},[m]),_=(0,B.useCallback)((e,t)=>{n(n=>{let r={...n,[e]:t};return g(r,e),r})},[g]),v=(0,B.useCallback)(async()=>{f(!0);try{let e=await L.get(`/config/workflow?details=1`),t=e.providers||[],r=e.models||{};i(t),o(r);let a=t.filter(e=>e.available),s=a.some(e=>e.name===`claude`),c=a.some(e=>e.name===`codex`),l=r.claude?.[0]?.id||`claude`,d=r.codex?.[0]?.id||`codex`,f={plan:{provider:s?`claude`:`codex`,model:s?l:d,effort:`high`},execute:{provider:c?`codex`:`claude`,model:c?d:l,effort:`medium`},review:{provider:s?`claude`:`codex`,model:s?l:d,effort:`medium`}};n(f),await L.post(`/config/workflow`,{workflow:f}),m(f),u(`all`),setTimeout(()=>u(null),1500)}catch{}f(!1)},[m]);return(0,B.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]),s||!t?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,V.jsx)(G,{className:`size-6 animate-spin opacity-30`})}):(0,V.jsxs)(`div`,{className:`space-y-4 stagger-children`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Pipeline Workflow`}),(0,V.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`Changes are saved automatically.`})]}),(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1 shrink-0`,onClick:v,disabled:d,children:[d?(0,V.jsx)(G,{className:`size-3 animate-spin`}):(0,V.jsx)(K,{className:`size-3`}),`Restore defaults`]})]}),(0,V.jsx)(`ul`,{className:`steps steps-horizontal w-full text-xs`,children:Ca.map(e=>{let t=Ta[e.accent];return(0,V.jsx)(`li`,{className:`step ${t.step}`,children:e.label},e.key)})}),(0,V.jsx)(`div`,{className:`flex flex-col`,children:Ca.map((e,n)=>(0,V.jsx)(Ea,{stage:e,config:t[e.key],providers:r,modelsByProvider:a,onChange:t=>_(e.key,t),isLast:n===Ca.length-1,saving:l===e.key||l===`all`?e.key:null},e.key))})]})}function ka(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Aa(e){if(!e)return``;let t=new Date(e),n=new Date,r=t.getTime()-n.getTime();if(r<=0)return`now`;let i=Math.floor(r/(1e3*60*60)),a=Math.floor(i/24);if(a>0)return`${a}d ${i%24}h`;let o=Math.floor(r/(1e3*60)%60);return i>0?`${i}h ${o}m`:`${o}m`}function ja({label:e,period:t,icon:n}){let r=t.inputTokens>0&&t.outputTokens>0;return(0,V.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-base-100`,children:[(0,V.jsx)(`div`,{className:`p-2 rounded-lg bg-base-300`,children:(0,V.jsx)(n,{className:`size-4 opacity-70`})}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-60`,children:e}),(0,V.jsxs)(`div`,{className:`font-mono font-semibold text-sm`,children:[ka(t.tokensUsed),` tokens`]}),r&&(0,V.jsxs)(`div`,{className:`flex gap-3 mt-0.5`,children:[(0,V.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,V.jsx)($e,{className:`size-2.5`}),` `,ka(t.inputTokens)]}),(0,V.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,V.jsx)(nt,{className:`size-2.5`}),` `,ka(t.outputTokens)]})]})]}),(0,V.jsxs)(`div`,{className:`text-right`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-60`,children:`sessions`}),(0,V.jsx)(`div`,{className:`font-mono text-sm`,children:t.sessions})]})]})}function Ma({percentUsed:e,weeklyLimit:t,weeklyUsed:n}){if(e==null)return null;let r=e>=90?`progress-error`:e>=70?`progress-warning`:`progress-primary`,i=Math.max(0,100-e);return(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex justify-between text-xs mb-1`,children:[(0,V.jsx)(`span`,{className:`opacity-60`,children:`Weekly quota`}),(0,V.jsxs)(`span`,{className:`font-mono`,children:[ka(n),` / `,ka(t)]})]}),(0,V.jsx)(`progress`,{className:`progress ${r} w-full progress-animated`,value:e,max:100}),(0,V.jsxs)(`div`,{className:`flex justify-between text-[10px] mt-1`,children:[(0,V.jsxs)(`span`,{className:`opacity-50`,children:[e,`% used`]}),(0,V.jsxs)(`span`,{className:`font-semibold ${i<=10?`text-error`:i<=30?`text-warning`:`text-success`}`,children:[i,`% available`]})]})]})}function Na({nextResetAt:e,resetInfo:t}){let n=Aa(e),r=e?new Date(e):null,i=r?r.toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`}):``;return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs bg-base-100 rounded-lg px-3 py-2`,children:[(0,V.jsx)(lt,{className:`size-3.5 opacity-50 shrink-0`}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`div`,{className:`opacity-50`,children:t}),e&&(0,V.jsxs)(`div`,{className:`font-mono font-medium mt-0.5`,children:[`Resets in `,(0,V.jsx)(`span`,{className:`text-primary`,children:n}),(0,V.jsxs)(`span`,{className:`opacity-40`,children:[` — `,i]})]})]})]})}function Pa({models:e,currentModel:t}){let[n,r]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`space-y-1`,children:(n?e:e.slice(0,4)).map(e=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${e.slug===t?`bg-primary/10 border border-primary/30`:`bg-base-100`}`,children:[(0,V.jsx)(ht,{className:`size-3 ${e.slug===t?`text-primary`:`opacity-30`}`}),(0,V.jsx)(`span`,{className:`font-mono text-xs flex-1 truncate`,children:e.displayName||e.slug}),e.slug===t&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-primary`,children:`active`})]},e.slug))}),e.length>4&&(0,V.jsxs)(`button`,{className:`btn btn-xs btn-ghost mt-1 w-full gap-1`,onClick:()=>r(!n),children:[n?(0,V.jsx)(pt,{className:`size-3`}):(0,V.jsx)(ft,{className:`size-3`}),n?`Show less`:`+${e.length-4} more`]})]})}function Fa({provider:e}){let{name:t,available:n,models:r,currentModel:i,usage:a,resetInfo:o,nextResetAt:s,weeklyLimitEstimate:c,percentUsed:l}=e;return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Tt,{className:`size-5 ${t===`claude`?`text-warning`:`text-info`}`}),(0,V.jsx)(`h3`,{className:`card-title text-sm`,children:t===`claude`?`Claude Code`:t===`codex`?`Codex CLI`:t})]}),(0,V.jsx)(`span`,{className:`badge badge-sm ${n?`badge-success`:`badge-error`}`,children:n?`available`:`not found`})]}),i&&(0,V.jsxs)(`div`,{className:`text-xs opacity-60`,children:[`Active model: `,(0,V.jsx)(`span`,{className:`font-mono font-medium opacity-100`,children:i})]}),(0,V.jsx)(Ma,{percentUsed:l,weeklyLimit:c,weeklyUsed:a.thisWeek.tokensUsed}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50`,children:`Token usage`}),(0,V.jsx)(ja,{label:`Today`,period:a.today,icon:I}),(0,V.jsx)(ja,{label:`This week`,period:a.thisWeek,icon:It}),(0,V.jsx)(ja,{label:`All time`,period:a.allTime,icon:xt})]}),(0,V.jsx)(Na,{nextResetAt:s,resetInfo:o}),r.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50 mb-2`,children:[`Available Models (`,r.length,`)`]}),(0,V.jsx)(Pa,{models:r,currentModel:i})]})]})})}function Ia({providersUsage:e}){let t=e?.data,n=t?.providers||[];return e?.isLoading&&!t?(0,V.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[...[,,]].map((e,t)=>(0,V.jsx)(`div`,{className:`skeleton-card h-72`,style:{animationDelay:`${t*100}ms`}},t))}):n.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-2 opacity-50 animate-fade-in-up`,children:[(0,V.jsx)(Tt,{className:`size-8`}),(0,V.jsx)(`p`,{className:`text-sm`,children:`No providers detected`})]}):(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 stagger-children`,children:n.map(e=>(0,V.jsx)(Fa,{provider:e},e.name))}),t?.collectedAt&&(0,V.jsxs)(`p`,{className:`text-xs opacity-40 text-center`,children:[`Last collected: `,new Date(t.collectedAt).toLocaleTimeString()]})]})}var La=b(`/settings/providers`)({component:Ra});function Ra(){return(0,V.jsx)(Ia,{providersUsage:Xe().providersUsage})}var za=(0,B.lazy)(()=>Wr(()=>import(`./OnboardingWizard-YrKTjlqQ.js`),__vite__mapDeps([4,1,5,2,3]))),Ba=[`auto`,`light`,`dark`],Va=`cupcake.bumblebee.emerald.corporate.synthwave.retro.cyberpunk.valentine.halloween.garden.forest.aqua.lofi.pastel.fantasy.wireframe.black.luxury.dracula.cmyk.autumn.business.acid.lemonade.night.coffee.winter.dim.nord.sunset.caramellatte.abyss.silk`.split(`.`),Ha=[...Ba,...Va];function Ua(e){return e===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function Wa({theme:e,onThemeChange:t}){let n=Ua(e),r=[`dark`,`night`,`sunset`,`black`,`synthwave`,`halloween`,`forest`,`luxury`,`dracula`,`business`,`coffee`,`dim`,`abyss`].includes(n);return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(Yt,{className:`size-4 opacity-50`}),`Theme`]}),(0,V.jsxs)(`p`,{className:`text-xs opacity-50`,children:[`Current: `,(0,V.jsx)(`span`,{className:`font-semibold`,children:e}),e===`auto`&&(0,V.jsxs)(`span`,{children:[` (resolved to `,n,`)`]}),r?(0,V.jsx)(qt,{className:`inline size-3 ml-1`}):(0,V.jsx)(un,{className:`inline size-3 ml-1`})]}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ha.map(n=>(0,V.jsx)(`button`,{className:`btn btn-sm ${e===n?`btn-primary`:`btn-soft`}`,onClick:()=>t(n),children:n.charAt(0).toUpperCase()+n.slice(1)},n))})]})})}function Ga({concurrency:e,setConcurrency:t,saveConcurrency:n,savePending:r}){return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(Tt,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50`,children:`Number of parallel workers executing issues simultaneously (1–16).`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`input`,{className:`input input-bordered input-sm w-20`,type:`number`,min:1,max:16,value:e,onChange:e=>t(e.target.value)}),(0,V.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:n,disabled:r,children:r?(0,V.jsx)(`span`,{className:`loading loading-spinner loading-xs`}):`Save`})]})]})})}function Ka({status:e,wsStatus:t}){let n=e===`ok`,r=t===`connected`,i=n?`text-success`:`text-warning`,a=n?`Connected`:e===`offline`?`Offline`:`Degraded`,o={connected:`text-success`,connecting:`text-info`,disconnected:`text-warning`,error:`text-error`}[t]||`text-warning`,s=t.charAt(0).toUpperCase()+t.slice(1);return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)($t,{className:`size-4 opacity-50`}),`Connection Status`]}),(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,V.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[n&&(0,V.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),(0,V.jsx)(ht,{className:`size-5 ${i} relative`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:`API`}),(0,V.jsx)(`div`,{className:`text-xs ${i}`,children:a})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,V.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[r&&(0,V.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),r?(0,V.jsx)(bn,{className:`size-5 ${o} relative`}):(0,V.jsx)(yn,{className:`size-5 ${o} relative`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:`WebSocket`}),(0,V.jsx)(`div`,{className:`text-xs ${o}`,children:s})]})]})]})]})})}function qa({pwa:e}){let t=e?.isInstalled?`Installed`:e?.canInstall?`Installable`:`Browser-managed`;return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(on,{className:`size-4 opacity-50`}),`Progressive Web App`]}),(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,V.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Service worker`}),(0,V.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:e?.serviceWorkerSupported?`Supported`:`Unavailable`})]}),(0,V.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Install status`}),(0,V.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:t})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:()=>e.installApp(),disabled:!e?.canInstall,children:[(0,V.jsx)(Et,{className:`size-3.5`}),` Install`]}),(0,V.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1`,onClick:()=>e.applyUpdate(),disabled:!e?.updateAvailable,children:[(0,V.jsx)(en,{className:`size-3.5`}),` Apply update`]})]})]})})}function Ja({notifications:e}){if(!e?.supported)return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(it,{className:`size-4 opacity-50`}),`Notifications`]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50`,children:`Desktop notifications are not supported in this browser.`})]})});let t=e.permission===`denied`,n=e.permission===`granted`;return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(at,{className:`size-4 opacity-50`}),`Desktop Notifications`]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50`,children:`Get notified when issues change state — reviews needed, agents blocked, work completed.`}),(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,V.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Permission`}),(0,V.jsx)(`div`,{className:`text-sm font-medium mt-1 ${n?`text-success`:t?`text-error`:`text-warning`}`,children:e.permission===`default`?`Not asked yet`:e.permission})]}),(0,V.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Status`}),(0,V.jsx)(`div`,{className:`text-sm font-medium mt-1 ${e.enabled?`text-success`:``}`,children:e.enabled?`Enabled`:`Disabled`})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!n&&!t&&(0,V.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:e.requestPermission,children:[(0,V.jsx)(at,{className:`size-3.5`}),` Enable notifications`]}),n&&(0,V.jsxs)(`label`,{className:`label cursor-pointer gap-2`,children:[(0,V.jsx)(`span`,{className:`text-sm`,children:`Notify on state changes`}),(0,V.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:e.enabled,onChange:t=>e.setEnabled(t.target.checked)})]}),t&&(0,V.jsx)(`p`,{className:`text-xs text-error`,children:`Notifications were denied. Reset permission in your browser settings to re-enable.`}),n&&e.enabled&&(0,V.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:()=>new Notification(`Fifony`,{body:`Notifications are working!`,icon:`/icon.svg`}),children:`Send test`})]})]})})}function Ya(){let[e,t]=(0,B.useState)(!1),n=w();return e?(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,V.jsx)(za,{onComplete:()=>{t(!1),n.invalidateQueries({queryKey:ye})}})}):(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(vn,{className:`size-4 opacity-50`}),`Setup Wizard`]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50`,children:`Re-run the initial setup wizard to reconfigure providers, effort level, concurrency, and theme.`}),(0,V.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1 w-fit`,onClick:async()=>{try{await L.post(`/settings/ui.onboarding.completed`,{scope:`ui`,value:!1,source:`user`}),n.setQueryData(ye,e=>we(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!1,source:`user`,updatedAt:new Date().toISOString()}))}catch{}t(!0)},children:[(0,V.jsx)(vn,{className:`size-3.5`}),` Re-run Setup Wizard`]})]})})}var Xa=b(`/settings/notifications`)({component:Za});function Za(){return(0,V.jsx)(`div`,{className:`space-y-5`,children:(0,V.jsx)(Ja,{notifications:Xe().notifications})})}var Qa=b(`/settings/general`)({component:$a});function $a(){let e=Xe();return(0,V.jsxs)(`div`,{className:`space-y-5`,children:[(0,V.jsx)(Ka,{status:e.status,wsStatus:e.wsStatus}),(0,V.jsx)(Ga,{concurrency:e.concurrency,setConcurrency:e.setConcurrency,saveConcurrency:e.saveConcurrency,savePending:e.saveConcPending}),(0,V.jsx)(qa,{pwa:e.pwa}),(0,V.jsx)(Ya,{}),(0,V.jsx)(Wa,{theme:e.theme,onThemeChange:e.setTheme})]})}var eo=$r.update({id:`/settings`,path:`/settings`,getParentRoute:()=>Z}),to=ri.update({id:`/onboarding`,path:`/onboarding`,getParentRoute:()=>Z}),no=Hi.update({id:`/kanban`,path:`/kanban`,getParentRoute:()=>Z}),ro=ea.update({id:`/issues`,path:`/issues`,getParentRoute:()=>Z}),io=sa.update({id:`/discover`,path:`/discover`,getParentRoute:()=>Z}),ao=la.update({id:`/analytics`,path:`/analytics`,getParentRoute:()=>Z}).lazy(()=>Wr(()=>import(`./analytics.lazy-BfFHdeTO.js`).then(e=>e.Route),__vite__mapDeps([6,1,5,2,3]))),oo=ya.update({id:`/agents`,path:`/agents`,getParentRoute:()=>Z}),so=xa.update({id:`/`,path:`/`,getParentRoute:()=>Z}),co=Sa.update({id:`/`,path:`/`,getParentRoute:()=>eo}),lo=Da.update({id:`/workflow`,path:`/workflow`,getParentRoute:()=>eo}),uo=La.update({id:`/providers`,path:`/providers`,getParentRoute:()=>eo}),fo=Xa.update({id:`/notifications`,path:`/notifications`,getParentRoute:()=>eo}),po={SettingsGeneralRoute:Qa.update({id:`/general`,path:`/general`,getParentRoute:()=>eo}),SettingsNotificationsRoute:fo,SettingsProvidersRoute:uo,SettingsWorkflowRoute:lo,SettingsIndexRoute:co},mo={IndexRoute:so,AgentsRoute:oo,AnalyticsRoute:ao,DiscoverRoute:io,IssuesRoute:ro,KanbanRoute:no,OnboardingRoute:to,SettingsRoute:eo._addFileChildren(po)},ho=Z._addFileChildren(mo)._addFileTypes();window.__fifonyInstallPrompt=null,window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),window.__fifonyInstallPrompt=e});var go=new Ne({defaultOptions:{queries:{staleTime:2e3,retry:1,refetchOnWindowFocus:!1}}}),_o=T({routeTree:ho,basepath:`/`,defaultPreload:`intent`});(0,Pe.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(ee,{client:go,children:(0,V.jsx)(k,{router:_o})})})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/service-worker.js`,{scope:`/`}).catch(()=>{})});export{Qe as C,st as S,Tt as _,_n as a,H as b,nn as c,G as d,Vt as f,U as g,Ot as h,J as i,Yt as l,Mt as m,Br as n,gn as o,Nt as p,Rr as r,sn as s,oa as t,Jt as u,xt as v,dt as x,vt as y};
42
+ `))}let y=()=>{u(`approved`),n?.(e.id,`Done`)},b=()=>{u(`rework`),n?.(e.id,`Queued`)},x=()=>{u(`rejected`),n?.(e.id,`Blocked`)},S=e.mergeResult;return(0,V.jsxs)(`div`,{className:`space-y-5`,children:[!!e.mergedAt&&(0,V.jsxs)(`div`,{className:`alert border text-sm ${S?.conflicts>0?`border-warning/30 bg-warning/5`:`border-success/30 bg-success/5`}`,children:[(0,V.jsx)(Pt,{className:`size-4 shrink-0 ${S?.conflicts>0?`text-warning`:`text-success`}`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`font-semibold`,children:`Code merged to project root`}),S&&(0,V.jsxs)(`span`,{className:`opacity-70`,children:[` — `,S.copied,` file`,S.copied===1?``:`s`,` copied`,S.deleted>0?`, ${S.deleted} deleted`:``]}),S?.conflicts>0&&(0,V.jsxs)(`p`,{className:`text-xs text-warning font-medium mt-0.5`,children:[S.conflicts,` file`,S.conflicts===1?``:`s`,` conflicted with another worker and were skipped.`]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`The code is available in the project. You can run, test, and preview it before approving.`})]})]}),h&&(0,V.jsxs)(`div`,{className:`alert alert-success text-sm`,children:[(0,V.jsx)(H,{className:`size-4`}),` This issue has been approved.`]}),e.state===`Blocked`&&(0,V.jsxs)(`div`,{className:`alert alert-error text-sm`,children:[(0,V.jsx)(q,{className:`size-4`}),` Review failed. Check execution output.`]}),l===`approved`&&m&&(0,V.jsxs)(`div`,{className:`alert alert-success text-sm`,children:[(0,V.jsx)(mn,{className:`size-4`}),` Approved! Moving to Done.`]}),l===`rework`&&(0,V.jsxs)(`div`,{className:`alert alert-warning text-sm`,children:[(0,V.jsx)(K,{className:`size-4`}),` Sent back for rework.`]}),m&&!l&&(0,V.jsx)(Y,{title:`Review Checklist`,icon:bt,children:(0,V.jsxs)(`div`,{className:`space-y-2 text-sm`,children:[(0,V.jsx)(`p`,{className:`opacity-60`,children:`Before deciding, consider:`}),(0,V.jsxs)(`ul`,{className:`list-disc ml-5 space-y-1 opacity-80`,children:[(0,V.jsx)(`li`,{children:`Does the diff address the issue title and description?`}),(0,V.jsx)(`li`,{children:`Are there unintended side effects or regressions?`}),(0,V.jsx)(`li`,{children:`Is the scope appropriate — no unnecessary changes?`}),(0,V.jsx)(`li`,{children:`Are there files that shouldn't have been modified?`})]})]})}),(0,V.jsx)(Y,{title:`Changes`,icon:St,children:a?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm opacity-50 py-4`,children:[(0,V.jsx)(`span`,{className:`loading loading-spinner loading-xs`}),` Loading changes...`]}):g.length>0?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 text-sm`,children:[(0,V.jsxs)(`span`,{className:`opacity-60`,children:[g.length,` file`,g.length===1?``:`s`]}),(0,V.jsxs)(`span`,{className:`text-success font-mono text-xs`,children:[`+`,r?.totalAdditions||0]}),(0,V.jsxs)(`span`,{className:`text-error font-mono text-xs`,children:[`-`,r?.totalDeletions||0]})]}),(0,V.jsx)(`div`,{className:`space-y-1`,children:g.map(e=>(0,V.jsx)(Sr,{file:e,isOpen:d===e.path,onToggle:()=>f(d===e.path?null:e.path)},e.path))}),d&&v[d]&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-mono opacity-50 mb-1`,children:d}),(0,V.jsx)(Cr,{lines:v[d]})]})]}):(0,V.jsx)(`div`,{className:`text-sm opacity-40 py-4`,children:`No changes detected.`})}),(e.lastError||e.commandOutputTail)&&(0,V.jsxs)(Y,{title:`Agent Output`,icon:fn,children:[e.lastError&&(0,V.jsx)(`pre`,{className:`text-xs bg-error/10 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto mb-2`,children:e.lastError}),e.commandOutputTail&&!e.lastError&&(0,V.jsx)(`pre`,{className:`text-xs bg-base-200 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-40 overflow-y-auto`,children:e.commandOutputTail})]}),m&&!l&&(0,V.jsx)(Y,{title:`Review Note`,icon:Kt,children:(0,V.jsx)(`textarea`,{className:`textarea textarea-bordered w-full text-sm`,rows:3,placeholder:`Optional: leave a note about your decision...`,value:s,onChange:e=>c(e.target.value)})}),m&&!l&&(0,V.jsxs)(`div`,{className:`border-t border-base-300 pt-4 space-y-3`,children:[(0,V.jsx)(`div`,{className:`text-sm font-semibold`,children:`Verdict`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsxs)(`button`,{className:`btn btn-success btn-sm gap-1.5 flex-1`,onClick:y,children:[(0,V.jsx)(mn,{className:`size-4`}),` Approve`]}),(0,V.jsxs)(`button`,{className:`btn btn-warning btn-sm gap-1.5 flex-1`,onClick:b,children:[(0,V.jsx)(K,{className:`size-4`}),` Request Rework`]}),(0,V.jsxs)(`button`,{className:`btn btn-error btn-sm gap-1.5 flex-1`,onClick:x,children:[(0,V.jsx)(pn,{className:`size-4`}),` Reject`]})]}),(0,V.jsxs)(`p`,{className:`text-xs opacity-40`,children:[(0,V.jsx)(`strong`,{children:`Approve`}),` moves to Done. `,(0,V.jsx)(`strong`,{children:`Rework`}),` sends back to executor. `,(0,V.jsx)(`strong`,{children:`Reject`}),` blocks the issue.`]})]})]})}function Mr({issue:e,onStateChange:t}){let n={paddingBottom:`calc(env(safe-area-inset-bottom, 0px) + 0.75rem)`},r=e.state===`Planning`,i=e.state===`Running`||e.state===`Queued`,a=e.state===`In Review`;if(r)return null;if(i)return(0,V.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 flex items-center justify-center gap-2`,style:n,children:[(0,V.jsx)(`span`,{className:`issue-phase-dot`}),(0,V.jsx)(`span`,{className:`text-sm opacity-50`,children:`Watching...`})]});if(a)return(0,V.jsxs)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 flex items-center gap-2`,style:n,children:[(0,V.jsxs)(`button`,{className:`btn btn-success btn-sm gap-1.5 flex-1`,onClick:()=>t?.(e.id,`Done`),children:[(0,V.jsx)(mn,{className:`size-4`}),` Approve`]}),(0,V.jsxs)(`button`,{className:`btn btn-warning btn-sm gap-1.5 flex-1`,onClick:()=>t?.(e.id,`Queued`),children:[(0,V.jsx)(K,{className:`size-4`}),` Rework`]})]});let o=er[e.state]||yt;return(0,V.jsx)(`div`,{className:`px-6 py-3 border-t border-base-300 shrink-0 flex items-center justify-center`,style:n,children:(0,V.jsxs)(`span`,{className:`badge ${rr[e.state]||`badge-ghost`} gap-1.5`,children:[(0,V.jsx)(o,{className:`size-3.5`}),e.state]})})}function Nr({issue:e,onClose:t,onStateChange:n,onRetry:r,onCancel:i}){let[a,o]=(0,B.useState)(`overview`),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(!1),d=(0,B.useRef)(null),{data:f}=qn(),p=(0,B.useCallback)(()=>{u(!0),setTimeout(()=>{c(!1),u(!1),t()},250)},[t]),{ref:m,handlers:h}=Vn({onDismiss:p,direction:`right`});return(0,B.useEffect)(()=>{o(e?.state===`Planning`?`planning`:e?.state===`In Review`?`review`:`overview`),e&&(c(!0),u(!1))},[e?.id,e?.state]),(0,B.useEffect)(()=>{if(!e||!s)return;let t=e=>{e.key===`Escape`&&p()};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e?.id,s,p]),(0,B.useEffect)(()=>{d.current&&d.current.querySelector(`.tab-active`)?.scrollIntoView({behavior:`smooth`,inline:`center`,block:`nearest`})},[a]),!e&&!s?null:(0,V.jsx)(`div`,{className:`fixed inset-0 z-40 bg-black/35 ${l?`animate-toast-out`:`animate-fade-in`}`,onClick:p,style:l?{animationDuration:`0.2s`}:void 0,children:(0,V.jsxs)(`div`,{ref:m,className:`fixed top-0 right-0 z-50 h-full w-full md:w-[520px] lg:w-[600px] bg-base-100 shadow-2xl flex flex-col ${l?`animate-slide-out-right`:`animate-slide-in-right`}`,onClick:e=>e.stopPropagation(),...h,children:[(0,V.jsxs)(`div`,{className:`px-6 pt-4 pb-0 shrink-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,V.jsx)(Ot,{className:`size-5 opacity-60 shrink-0`}),(0,V.jsx)(`span`,{className:`font-mono text-sm opacity-60`,children:e.identifier}),(0,V.jsx)(`span`,{className:`badge badge-sm ${rr[e.state]||`badge-ghost`}`,children:e.state})]}),(0,V.jsx)(`button`,{type:`button`,className:`btn btn-sm btn-ghost btn-circle shrink-0`,onClick:p,"aria-label":`Close`,children:(0,V.jsx)(J,{className:`size-4`})})]}),[`Planning`,`Queued`,`Running`,`In Review`,`Blocked`].includes(e.state)&&(0,V.jsx)(`div`,{className:`mb-2`,children:(0,V.jsx)($n,{issue:e})}),(0,V.jsx)(`h2`,{className:`text-lg font-bold leading-tight mb-2`,children:e.title||`-`}),(0,V.jsx)(_r,{issue:e}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{ref:d,role:`tablist`,className:`tabs tabs-lift overflow-x-auto -webkit-overflow-scrolling-touch scrollbar-none`,style:{scrollbarWidth:`none`},children:cr(e.state).map(({id:t,label:n,icon:r})=>(0,V.jsxs)(`a`,{role:`tab`,className:`tab gap-1.5 whitespace-nowrap ${a===t?`tab-active`:``} ${t===`review`?`text-secondary font-semibold`:``}`,onClick:()=>o(t),children:[(0,V.jsx)(r,{className:`size-3.5`}),n,t===`review`&&e.state===`In Review`&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-secondary`,children:`!`}),t===`planning`&&(e.planningStatus===`planning`||e.planningStatus===`refining`)&&(0,V.jsx)(`span`,{className:`loading loading-spinner loading-xs text-info`})]},t))}),(0,V.jsx)(`div`,{className:`absolute right-0 top-0 bottom-0 w-6 bg-gradient-to-l from-base-100 to-transparent pointer-events-none md:hidden`})]})]}),(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4 min-h-0 drawer-safe-bottom`,children:(0,V.jsxs)(`div`,{className:`animate-fade-in`,children:[a===`overview`&&(0,V.jsx)(vr,{issue:e,onStateChange:n,onRetry:r,onCancel:i}),a===`planning`&&(0,V.jsx)(kr,{issue:e,onStateChange:n,workflowConfig:f}),a===`review`&&(0,V.jsx)(jr,{issue:e,issueId:e.id,onStateChange:n}),a===`execution`&&(0,V.jsx)(br,{issue:e,workflowConfig:f}),a===`diff`&&(0,V.jsx)(wr,{issueId:e.id}),a===`routing`&&(0,V.jsx)(Dr,{issue:e}),a===`history`&&(0,V.jsx)(Ar,{issue:e})]},a)}),(0,V.jsx)(Mr,{issue:e,onStateChange:n})]})})}function Pr({pwa:e}){return e?e.updateAvailable?(0,V.jsxs)(`div`,{className:`alert alert-info rounded-none border-x-0`,children:[(0,V.jsx)(en,{className:`size-4`}),(0,V.jsx)(`span`,{className:`text-sm`,children:`A fresh dashboard build is ready.`}),(0,V.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:()=>e.applyUpdate(),children:`Reload app`})]}):e.isOnline?null:(0,V.jsxs)(`div`,{className:`alert alert-warning rounded-none border-x-0`,children:[(0,V.jsx)(yn,{className:`size-4`}),(0,V.jsx)(`span`,{className:`text-sm`,children:`You are offline. The app shell is available, but live runtime data may be stale.`})]}):null}var Fr=[`oklch(0.8 0.18 145)`,`oklch(0.8 0.18 250)`,`oklch(0.85 0.16 85)`,`oklch(0.75 0.18 330)`,`oklch(0.8 0.16 200)`];function Ir(e,t){return Math.random()*(t-e)+e}function Lr({color:e,style:t}){return(0,V.jsx)(`div`,{className:`absolute rounded-full pointer-events-none`,style:{width:t.size,height:t.size,backgroundColor:e,left:t.x,top:t.y,animation:`confetti-fly ${t.duration}ms cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards`,"--tx":t.tx,"--ty":t.ty,"--r":t.r,opacity:.9}})}function Rr({x:e=`50%`,y:t=`50%`,active:n,onDone:r,count:i=24}){let[a,o]=(0,B.useState)([]),s=(0,B.useRef)(r);(0,B.useEffect)(()=>{s.current=r},[r]);let c=(0,B.useCallback)(()=>{let e=Array.from({length:i},(e,t)=>{let n=Math.PI*2*t/i+Ir(-.3,.3),r=Ir(40,120),a=Ir(4,8);return{id:t,color:Fr[t%Fr.length],size:a,x:0,y:0,tx:`${Math.cos(n)*r}px`,ty:`${Math.sin(n)*r-Ir(20,60)}px`,r:`${Ir(-180,180)}deg`,duration:Ir(600,1e3)}});o(e);let t=Math.max(...e.map(e=>e.duration));setTimeout(()=>{o([]),s.current?.()},t+50)},[i]);return(0,B.useEffect)(()=>{n&&c()},[n,c]),a.length===0?null:(0,V.jsx)(`div`,{className:`fixed pointer-events-none z-[100]`,style:{left:e,top:t,transform:`translate(-50%, -50%)`},children:a.map(e=>(0,V.jsx)(Lr,{color:e.color,style:e},e.id))})}function zr(e){let t=(0,B.useRef)(e);t.current=e,(0,B.useEffect)(()=>{function e(e){if(e.ctrlKey||e.metaKey||e.altKey)return;let n=e.target?.tagName;if((n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||e.target?.isContentEditable)&&e.key!==`Escape`)return;let r=t.current[e.key];r&&(e.preventDefault(),r())}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[])}function Br(){let e=(0,B.useRef)(null),t=(0,B.useRef)([]),n=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let r=e.current;if(!r)return;let i=r.getContext(`2d`),a=[`♪`,`♫`,`♩`,`♬`],o=[`oklch(0.75 0.18 250)`,`oklch(0.80 0.16 200)`,`oklch(0.70 0.20 330)`,`oklch(0.85 0.14 85)`,`oklch(0.75 0.18 145)`,`oklch(0.80 0.12 280)`,`oklch(0.78 0.15 30)`],s=o.length,c=a.length,l=document.createElement(`canvas`);l.width=s*56,l.height=c*56;let u=l.getContext(`2d`);u.textAlign=`center`,u.textBaseline=`middle`,u.font=`48px serif`;let d=[];for(let e=0;e<c;e++){d[e]=[];for(let t=0;t<s;t++){let n=t*56+56/2,r=e*56+56/2;u.fillStyle=o[t],u.fillText(a[e],n,r),d[e][t]={x:t*56,y:e*56}}}let f=0,p=0,m=()=>{let e=window.devicePixelRatio||1;f=window.innerWidth,p=window.innerHeight,r.width=f*e,r.height=p*e,r.style.width=f+`px`,r.style.height=p+`px`,i.setTransform(e,0,0,e,0,0)};m();function h(){let e=f/2,t=p*.38,n=Math.random()*Math.PI*2,r=Math.random()*1.8+.4,i=Math.random()*20,a=Math.floor(Math.random()*c),o=Math.floor(Math.random()*s);return{x:e+Math.cos(n)*i,y:t+Math.sin(n)*i,vx:Math.cos(n)*r,vy:Math.sin(n)*r,gravity:.003+Math.random()*.005,scale:Math.random()*.4+.25,si:a,ci:o,rotation:Math.random()*Math.PI*2,rotationSpeed:(Math.random()-.5)*.04,life:0,maxLife:180+Math.random()*200,fadeIn:15}}let g=Math.min(Math.floor(f*p/6e3),120);t.current=[];for(let e=0;e<g;e++){let e=h(),n=Math.random()*e.maxLife*.8;e.x+=e.vx*n,e.y+=e.vy*n+.5*e.gravity*n*n,e.rotation+=e.rotationSpeed*n,e.life=n,t.current.push(e)}let _=Math.max(1,Math.floor(g/90)),v=0,y=()=>{if(i.clearRect(0,0,f,p),v++,v%2==0)for(let e=0;e<_;e++)t.current.push(h());let e=[];for(let n of t.current){if(n.life++,n.x+=n.vx,n.y+=n.vy,n.vy+=n.gravity,n.rotation+=n.rotationSpeed,n.vx*=.998,n.vy*=.998,n.life>n.maxLife||n.x<-60||n.x>f+60||n.y<-60||n.y>p+60)continue;e.push(n);let t=Math.min(1,n.life/n.fadeIn),r=n.maxLife*.6,a=t*(n.life>r?1-(n.life-r)/(n.maxLife-r):1)*.45;if(a<=.01)continue;let o=d[n.si][n.ci],s=56*n.scale,c=s/2;i.save(),i.translate(n.x,n.y),i.rotate(n.rotation),i.globalAlpha=a,i.drawImage(l,o.x,o.y,56,56,-c,-c,s,s),i.restore()}t.current=e,n.current=requestAnimationFrame(y)};return n.current=requestAnimationFrame(y),window.addEventListener(`resize`,m),()=>{cancelAnimationFrame(n.current),window.removeEventListener(`resize`,m)}},[]),(0,V.jsx)(`canvas`,{ref:e,className:`fixed inset-0 pointer-events-none`,style:{zIndex:0},"aria-hidden":`true`})}var Vr=`modulepreload`,Hr=function(e){return`/assets/`+e},Ur={},Wr=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}r=o(t.map(t=>{if(t=Hr(t,n),t in Ur)return;Ur[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Vr,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Gr=(0,B.lazy)(()=>Wr(()=>import(`./KeyboardShortcutsHelp-sSYMdYqB.js`),__vite__mapDeps([0,1,2,3])));function Kr({children:e}){let t=C().location.pathname;return(0,V.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 animate-view-enter`,children:e},t)}function qr(){let e=Xe(),t=h(),[n,r]=(0,B.useState)(!1),i=(0,B.useCallback)(()=>{e.setIsCreateOpen(!1),e.setSelectedIssue(null),r(!1)},[e]);if(zr((0,B.useMemo)(()=>({n:()=>e.setIsCreateOpen(!0),Escape:i,"?":()=>r(e=>!e),k:()=>t({to:`/kanban`}),i:()=>t({to:`/issues`}),a:()=>t({to:`/agents`}),t:()=>t({to:`/analytics`}),s:()=>t({to:`/settings`}),1:()=>{},2:()=>{},3:()=>{},4:()=>{},5:()=>{},6:()=>{}}),[e,t,i])),e.runtime.isLoading&&!e.runtime.data&&!e.runtime.isError)return(0,V.jsx)(Jr,{});let a=e.toast?.type||`info`,o=typeof e.toast==`string`?e.toast:e.toast?.message;return(0,V.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[e.toast&&(0,V.jsx)(`div`,{className:`toast toast-end toast-top z-50`,children:(0,V.jsxs)(`div`,{className:`alert text-sm shadow-lg ${a===`success`?`alert-success`:a===`error`?`alert-error`:`alert-info`} ${e.toastExiting?`animate-toast-out`:`animate-toast-in`}`,children:[a===`success`?(0,V.jsx)(mt,{className:`size-4`}):a===`error`?(0,V.jsx)(q,{className:`size-4`}):(0,V.jsx)(zt,{className:`size-4`}),(0,V.jsx)(`span`,{children:o}),(0,V.jsx)(`div`,{className:`toast-progress`})]})}),e.confetti&&(0,V.jsx)(Rr,{x:e.confetti.x,y:e.confetti.y,count:e.confetti.count,active:!0,onDone:()=>e.clearConfetti?.()}),(0,V.jsx)(Ln,{issueCount:e.issues.length,sourceRepo:e.data.sourceRepoUrl,updatedAt:e.data.updatedAt,wsStatus:e.wsStatus,notifications:e.notifications,issues:e.issues}),(0,V.jsx)(Pr,{pwa:e.pwa}),(0,V.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0`,children:[(0,V.jsx)(Kr,{children:(0,V.jsx)(D,{})}),e.runtime.isError&&(0,V.jsx)(`div`,{className:`px-4 pb-4`,children:(0,V.jsx)(`div`,{className:`alert alert-error`,children:String(e.runtime.error?.message||`Runtime unavailable`)})})]}),(0,V.jsx)(Rn,{onClick:()=>e.setIsCreateOpen(!0)}),(0,V.jsx)(zn,{}),(0,V.jsx)(Un,{open:e.isCreateOpen,onClose:()=>e.setIsCreateOpen(!1),onSubmit:t=>e.createIssue.mutate(t),isLoading:e.createIssue.isPending,onToast:e.showToast}),(0,V.jsx)(Nr,{issue:e.selectedIssue,onClose:()=>e.setSelectedIssue(null),onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue}),n&&(0,V.jsx)(B.Suspense,{fallback:null,children:(0,V.jsx)(Gr,{open:n,onClose:()=>r(!1)})})]})}function Jr(){return(0,V.jsxs)(`div`,{className:`fixed inset-0 z-50 bg-base-100 flex flex-col items-center justify-center overflow-hidden`,children:[(0,V.jsx)(Br,{}),(0,V.jsxs)(`div`,{className:`relative z-10 flex flex-col items-center gap-6 animate-fade-in`,children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(Jt,{className:`size-16 sm:size-20 text-primary animate-bounce-in`}),(0,V.jsx)(`span`,{className:`absolute -bottom-1 -right-1 size-5 bg-primary rounded-full animate-ping opacity-50`})]}),(0,V.jsx)(`h1`,{className:`text-3xl sm:text-4xl font-bold tracking-tight`,children:(0,V.jsx)(`span`,{className:`text-primary`,children:`Fifony`})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3 text-base-content/50`,children:[(0,V.jsx)(`span`,{className:`loading loading-dots loading-md`}),(0,V.jsx)(`span`,{className:`text-sm`,children:`Warming up the orchestra...`})]})]})]})}function Yr({children:e}){let t=De(),n=fe(_e(t.data),`ui.onboarding.completed`,null);return t.isLoading&&!t.data?(0,V.jsx)(Jr,{}):t.isError||n===!0?e:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(Jr,{}),children:(0,V.jsx)(Xr,{})})}function Xr(){let e=h(),t=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{t.current||(t.current=!0,e({to:`/onboarding`,replace:!0}))},[e]),(0,V.jsx)(Jr,{})}function Zr(){return C().location.pathname===`/onboarding`?(0,V.jsx)(D,{}):(0,V.jsx)(Yr,{children:(0,V.jsx)(Ze,{children:(0,V.jsx)(qr,{})})})}var Z=E({component:Zr}),Qr=[{to:`/settings/general`,label:`General`,icon:Yt},{to:`/settings/workflow`,label:`Workflow`,icon:Nt},{to:`/settings/notifications`,label:`Notifications`,icon:at},{to:`/settings/providers`,label:`Providers`,icon:Tt}],$r=b(`/settings`)({component:ei});function ei(){let e=C().location.pathname;return(0,V.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4 pt-3`,children:(0,V.jsxs)(`div`,{className:`max-w-5xl w-full mx-auto flex-1 flex flex-col min-h-0 gap-5`,children:[(0,V.jsx)(`div`,{role:`tablist`,className:`tabs tabs-lift`,children:Qr.map(({to:t,label:n,icon:r})=>(0,V.jsxs)(O,{to:t,role:`tab`,className:`tab gap-1.5 ${e.startsWith(t)?`tab-active`:``}`,children:[(0,V.jsx)(r,{className:`size-3.5`}),n]},t))}),(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto`,children:(0,V.jsx)(D,{})})]})})}var ti=(0,B.lazy)(()=>Wr(()=>import(`./OnboardingWizard-G9YyAfeX.js`),__vite__mapDeps([4,1,5,2,3])));function ni(){let e=h(),t=w();return(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,V.jsx)(ti,{onComplete:()=>{t.invalidateQueries({queryKey:ye}),e({to:`/`})}})})}var ri=b(`/onboarding`)({component:ni}),ii={Planning:`badge-info`,Todo:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Interrupted:`badge-accent`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},ai={Planning:`border-l-info`,Todo:`border-l-warning`,Queued:`border-l-info`,Running:`border-l-primary`,Interrupted:`border-l-accent`,"In Review":`border-l-secondary`,Blocked:`border-l-error`,Done:`border-l-success`,Cancelled:`border-l-neutral`};function oi(e){return e==null||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function si(e){return e?e.reviewer?.totalTokens>0?`Reviewing`:e.executor?.totalTokens>0?`Executing`:e.planner?.totalTokens>0?`Planning`:null:null}function ci({issue:e,onSelect:t,dragHandlers:n,isDragging:r,isSelected:i,onToggleSelect:a,hasSelection:o}){let s=e.state===`Running`,c=e.state===`In Review`,l=e.state===`Planning`,u=e.state===`Queued`,d=e.state===`Done`,f=e.state===`Cancelled`,p=e.state===`Blocked`,m=e.planningStatus===`planning`||e.planningStatus===`refining`,h=(0,B.useRef)(e.tokenUsage?.totalTokens),[g,_]=(0,B.useState)(!1),v=(0,B.useRef)(e.state),[y,b]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let t=e.tokenUsage?.totalTokens;if(t!=null&&t!==h.current){_(!0);let e=setTimeout(()=>_(!1),300);return h.current=t,()=>clearTimeout(e)}},[e.tokenUsage?.totalTokens]),(0,B.useEffect)(()=>{if(v.current!==`Done`&&e.state===`Done`){b(!0);let t=setTimeout(()=>b(!1),800);return v.current=e.state,()=>clearTimeout(t)}v.current=e.state},[e.state]);let x=s||c?oi(e.tokenUsage?.totalTokens):null;s&&si(e.tokensByPhase);let S=!!e.mergedAt,C=n=>{if(n.shiftKey){n.preventDefault(),a?.(e.id);return}if(o){n.preventDefault(),a?.(e.id);return}t?.(e)},w=n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),n.shiftKey||o?a?.(e.id):t?.(e))};return(0,V.jsxs)(`div`,{"data-issue-id":e.id,className:[`card card-compact bg-base-100 border border-l-[3px] relative`,i?`border-primary ring-2 ring-primary/30 border-base-300`:`border-base-300`,ai[e.state]||``,l?`animate-pulse-soft-border`:``,s?`animate-pulse-border`:``,d?`opacity-80`:``,f?`opacity-60`:``,p?`issue-card-blocked`:``,!d&&!f?`card-interactive`:``,`cursor-pointer`,r?`kanban-card-source-opacity`:``,y?`issue-card-done-flash`:``].filter(Boolean).join(` `),style:{overflow:`hidden`},role:`button`,tabIndex:0,onClick:C,onKeyDown:w,"aria-label":`${i?`Deselect`:`Open`} issue ${e.identifier}`,"aria-selected":i,...n||{},children:[(i||o)&&(0,V.jsx)(`div`,{className:`absolute top-1.5 left-1.5 z-10`,children:(0,V.jsx)(`div`,{className:`size-5 rounded flex items-center justify-center transition-all ${i?`bg-primary text-primary-content`:`bg-base-300/60 border border-base-content/20`}`,children:i&&(0,V.jsx)(cn,{size:14})})}),(0,V.jsxs)(`div`,{className:`card-body gap-1 p-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 ${o?`pl-5`:``}`,children:[(0,V.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,V.jsx)(`h3`,{className:`font-semibold text-sm truncate ${f?`line-through opacity-60`:``}`,children:e.title})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[S&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-success gap-0.5`,title:`Code merged to project`,children:(0,V.jsx)(Pt,{size:9})}),(0,V.jsx)(`span`,{className:`badge badge-xs ${ii[e.state]||`badge-ghost`}`,children:e.state})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs opacity-50 truncate`,children:[(0,V.jsxs)(`span`,{className:`shrink-0`,children:[`P`,e.priority]}),(0,V.jsx)(`span`,{className:`shrink-0`,children:`·`}),(0,V.jsx)(`span`,{className:`shrink-0`,children:j(e.updatedAt)}),e.capabilityCategory&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`shrink-0`,children:`·`}),(0,V.jsx)(`span`,{className:`truncate`,children:e.capabilityCategory})]})]}),(s||c||l||u||m)&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs truncate`,children:[(0,V.jsx)(Qn,{issue:e,compact:!0,showElapsed:s||c}),x&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 opacity-50 shrink-0 ml-auto ${g?`animate-count-bump`:``}`,children:[(0,V.jsx)(I,{size:10}),x]})]})]}),s&&(0,V.jsx)(`div`,{className:`issue-heartbeat-bar animate-pulse-soft`}),m&&(0,V.jsx)(`div`,{className:`h-[3px] rounded-b-[var(--rounded-box,1rem)] bg-info animate-pulse-soft`})]})}function li({icon:e=Rt,title:t=`Nothing here`,description:n=``,action:r,actionLabel:i=`Action`}){return(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 px-4 opacity-60 animate-fade-in-up`,children:[(0,V.jsx)(e,{className:`size-12 mb-4 opacity-40`}),(0,V.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:t}),n&&(0,V.jsx)(`p`,{className:`text-sm opacity-70 text-center max-w-xs`,children:n}),r&&(0,V.jsx)(`button`,{className:`btn btn-sm btn-primary mt-4`,onClick:r,children:i})]})}var ui={Planning:[`Planning`],"In Progress":[`Todo`,`Queued`],"In Review":[`In Review`],Blocked:[`Blocked`],Done:[`Done`],Cancelled:[`Cancelled`]},di=new Set([`Todo`,`Queued`,`Running`,`Interrupted`]);function fi(e){return di.has(e)?`In Progress`:e}function pi(e){let t=ce[e];if(!t)return new Set;let n=new Set(t.map(e=>fi(e)));return n.delete(fi(e)),n}var mi=300,hi=5;function gi({onStateChange:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useRef)(null),i=(0,B.useRef)({pointerId:null,startX:0,startY:0,isDragging:!1,longPressTimer:null,longPressReady:!1,pointerType:null,issue:null,sourceColumn:null,didDrag:!1}),a=(0,B.useRef)(null),o=(0,B.useRef)(new Map);(0,B.useEffect)(()=>()=>{clearTimeout(i.current.longPressTimer)},[]);let s=(0,B.useCallback)((e,t)=>{let n=r.current;n&&(n.style.left=`${e}px`,n.style.top=`${t}px`)},[]),c=(0,B.useCallback)((e,t)=>{for(let[n,r]of o.current.entries()){let i=r.getBoundingClientRect();if(e>=i.left&&e<=i.right&&t>=i.top&&t<=i.bottom)return n}return null},[]),l=(0,B.useCallback)((e,t,r,a)=>{let o=pi(e.state);i.current.isDragging=!0,n({issueId:e.id,issue:e,sourceColumn:t,validColumns:o,overColumn:null}),s(r,a)},[s]),u=(0,B.useCallback)(()=>{let e=i.current.isDragging;clearTimeout(i.current.longPressTimer),i.current.isDragging=!1,i.current.longPressReady=!1,i.current.pointerId=null,i.current.issue=null,i.current.didDrag=e,e&&requestAnimationFrame(()=>{i.current.didDrag=!1}),n(null)},[]),d=(0,B.useCallback)(n=>{if(t){if(t.validColumns.has(n)){let r=ce[t.issue.state]||[],i=new Set(ui[n]||[]),a=r.find(e=>i.has(e));a&&e(t.issueId,a)}u()}},[t,e,u]),f=(0,B.useCallback)((e,t)=>{t?o.current.set(e,t):o.current.delete(e)},[]);return{dragState:t,ghostRef:r,boardRef:a,getCardHandlers:(0,B.useCallback)((e,t)=>({onPointerDown:n=>{n.button===0&&(n.target.closest(`a, button`)||(i.current.pointerId=n.pointerId,i.current.startX=n.clientX,i.current.startY=n.clientY,i.current.pointerType=n.pointerType,i.current.issue=e,i.current.sourceColumn=t,i.current.longPressReady=!1,n.pointerType===`touch`&&(i.current.longPressTimer=setTimeout(()=>{i.current.longPressReady=!0,navigator.vibrate&&navigator.vibrate(30),l(e,t,n.clientX,n.clientY)},mi))))}}),[l]),registerColumn:f,onBoardPointerMove:(0,B.useCallback)(e=>{let t=i.current;if(t.pointerId==null||e.pointerId!==t.pointerId)return;let r=e.clientX-t.startX,a=e.clientY-t.startY,o=Math.sqrt(r*r+a*a);if(!t.isDragging)if(t.pointerType===`touch`){if(o>hi&&!t.longPressReady){clearTimeout(t.longPressTimer),t.pointerId=null;return}if(!t.longPressReady)return}else{if(o<hi)return;l(t.issue,t.sourceColumn,e.clientX,e.clientY)}e.preventDefault(),s(e.clientX,e.clientY);let u=c(e.clientX,e.clientY);n(e=>!e||e.overColumn===u?e:{...e,overColumn:u})},[l,s,c]),onBoardPointerUp:(0,B.useCallback)(e=>{let t=i.current;if(t.pointerId==null||e.pointerId!==t.pointerId)return;if(clearTimeout(t.longPressTimer),!t.isDragging){t.pointerId=null;return}let n=c(e.clientX,e.clientY);n?d(n):u()},[c,d,u]),onBoardPointerCancel:(0,B.useCallback)(()=>{u()},[u]),cancelDrag:u,shouldSuppressClick:(0,B.useCallback)(()=>i.current.didDrag||i.current.isDragging,[])}}function _i({count:e,className:t}){let n=(0,B.useRef)(e),[r,i]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{if(n.current!==e){n.current=e,i(!0);let t=setTimeout(()=>i(!1),300);return()=>clearTimeout(t)}},[e]),e===0?null:(0,V.jsx)(`span`,{className:`badge badge-xs ${t} ${r?`animate-count-bump`:``}`,children:e})}var Q=[`Planning`,`In Progress`,`In Review`,`Blocked`,`Done`,`Cancelled`],vi=new Set([`Todo`,`Queued`,`Running`,`Interrupted`]),yi={Planning:`badge-info`,"In Progress":`badge-primary`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},bi={Planning:{borderTopColor:`oklch(var(--in) / 0.4)`},"In Progress":{borderTopColor:`oklch(var(--p) / 0.5)`},"In Review":{borderTopColor:`oklch(var(--s) / 0.4)`},Blocked:{borderTopColor:`oklch(var(--er) / 0.4)`},Done:{borderTopColor:`oklch(var(--su) / 0.4)`},Cancelled:{borderTopColor:`oklch(var(--bc) / 0.15)`}},xi={Planning:`oklch(var(--in))`,"In Progress":`oklch(var(--p))`,"In Review":`oklch(var(--s))`,Blocked:`oklch(var(--er))`,Done:`oklch(var(--su))`,Cancelled:void 0},Si={Planning:`oklch(var(--in))`,"In Progress":`oklch(var(--p))`,"In Review":`oklch(var(--s))`,Blocked:`oklch(var(--er))`,Done:`oklch(var(--su))`,Cancelled:`oklch(var(--bc) / 0.3)`},Ci={Planning:{icon:W,desc:`Create an issue to start planning`},"In Progress":{icon:Zt,desc:`Issues move here when agents start`},"In Review":{icon:U,desc:`Awaiting review`},Blocked:{icon:q,desc:`Needs attention`},Done:{icon:mt,desc:`Completed`},Cancelled:{icon:vt,desc:`Cancelled`}};function wi({delay:e=0}){return(0,V.jsx)(`div`,{className:`skeleton-card h-20 w-full rounded-lg`,style:{animationDelay:`${e}ms`}})}function Ti({dragState:e,ghostRef:t}){if(!e)return null;let{issue:n}=e;return(0,V.jsx)(`div`,{ref:t,className:`drag-ghost`,"aria-hidden":`true`,children:(0,V.jsxs)(`div`,{className:`card card-compact bg-base-100 border border-primary border-l-[3px] shadow-2xl p-3 w-56`,children:[(0,V.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:n.identifier}),(0,V.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:n.title})]})})}function Ei({onCreateIssue:e}){return(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-8 px-3 animate-fade-in-up`,children:[(0,V.jsx)(`div`,{className:`bg-primary/10 rounded-full p-4 mb-3 animate-pulse-soft`,children:(0,V.jsx)(W,{className:`size-8 text-primary`})}),(0,V.jsx)(`h3`,{className:`text-sm font-semibold mb-1`,children:`Start here`}),(0,V.jsx)(`p`,{className:`text-xs opacity-50 text-center mb-3`,children:`Create your first issue to begin`}),e&&(0,V.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:e,children:[(0,V.jsx)(Qt,{className:`size-3.5`}),`New Issue`]})]})}function Di({issue:e,onClose:t,onStateChange:n,onSelect:r}){let i=F(e.state).filter(t=>t!==e.state);return(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&t()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[t]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`fixed inset-0 bg-black/30 z-50 animate-fade-in`,onClick:t}),(0,V.jsxs)(`div`,{className:`fixed bottom-0 left-0 right-0 z-50 bg-base-100 rounded-t-2xl shadow-2xl animate-slide-up-sheet`,style:{paddingBottom:`env(safe-area-inset-bottom)`},onClick:e=>e.stopPropagation(),children:[(0,V.jsx)(`div`,{className:`flex justify-center pt-3 pb-1`,children:(0,V.jsx)(`div`,{className:`w-10 h-1 rounded-full bg-base-content/20`})}),(0,V.jsxs)(`div`,{className:`px-4 py-2 border-b border-base-300`,children:[(0,V.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,V.jsx)(`h3`,{className:`font-semibold text-sm truncate`,children:e.title})]}),(0,V.jsxs)(`div`,{className:`p-3 space-y-1`,children:[(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{r(e),t()},children:[(0,V.jsx)(U,{className:`size-4`}),` View Details`]}),i.length>0&&(0,V.jsx)(`div`,{className:`text-[10px] uppercase tracking-wide opacity-40 px-3 pt-2`,children:`Move to`}),i.map(r=>(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-sm w-full justify-start gap-2`,onClick:()=>{n(e.id,r),t()},children:[(0,V.jsx)(tt,{className:`size-4`}),` `,r]},r))]}),(0,V.jsx)(`div`,{className:`p-3 pt-0`,children:(0,V.jsx)(`button`,{className:`btn btn-ghost btn-sm w-full`,onClick:t,children:`Cancel`})})]})]})}function Oi({columns:e,activeIndex:t}){return(0,V.jsx)(`div`,{className:`kanban-dots md:hidden`,children:e.map((e,n)=>(0,V.jsx)(`div`,{className:`kanban-dot ${n===t?`active`:``}`,style:{backgroundColor:Si[e]}},e))})}var ki={Done:5,Cancelled:3};function Ai({col:e,issues:t,empty:n,badgeClass:r,dragState:i,registerColumn:a,getCardHandlers:o,onSelect:s,onCreateIssue:c,lastDroppedId:l,hasRunningAgents:u,totalIssues:d,onLongPress:f,selectedIds:p,onToggleSelect:m,hasSelection:h}){let g=(0,B.useRef)(null),[_,v]=(0,B.useState)(!1);(0,B.useEffect)(()=>(a(e,g.current),()=>a(e,null)),[e,a]);let y=i!=null,b=i?.overColumn===e,x=i?.sourceColumn===e,S=i?.validColumns?.has(e)??!1,C=y&&!S&&!x,w=t.length===0,T=w&&e!==`Planning`&&d===0,E=ki[e],ee=E!=null&&t.length>E,D=ee&&!_?t.slice(0,E):t,O=t.length-D.length,k=`kanban-column bg-base-200 rounded-box p-3 flex flex-col min-h-0 overflow-hidden`;T&&(k+=` kanban-column-collapsed`),y&&(b&&S?k+=` kanban-column-drop-valid`:b&&!S?k+=` kanban-column-drop-invalid`:C&&(k+=` kanban-column-dimmed`));let te={borderTop:`3px solid transparent`,...bi[e]||{},...T?{alignSelf:`start`}:{}};return(0,V.jsxs)(`div`,{ref:g,className:k,style:te,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-3`,children:[(0,V.jsxs)(`h3`,{className:`text-xs font-semibold tracking-wide flex items-center gap-1.5`,style:{color:xi[e],fontFamily:`'Space Grotesk', system-ui, sans-serif`},children:[e,e===`In Progress`&&u&&(0,V.jsx)(`span`,{className:`issue-phase-dot`,title:`Agents working`})]}),(0,V.jsx)(_i,{count:t.length,className:r})]}),!T&&(0,V.jsx)(`div`,{className:`space-y-2 flex-1 overflow-y-auto kanban-card-list`,children:w?b&&S?(0,V.jsx)(`div`,{className:`kanban-drop-placeholder`}):e===`Planning`&&d===0?(0,V.jsx)(Ei,{onCreateIssue:c}):(0,V.jsxs)(`div`,{className:`flex flex-col items-center py-6 opacity-30`,children:[(0,V.jsx)(n.icon,{className:`size-5 mb-1`}),(0,V.jsx)(`span`,{className:`text-[10px]`,children:n.desc})]}):(0,V.jsxs)(`div`,{className:`stagger-children space-y-2`,children:[D.map(t=>{let n=i?.issueId===t.id,r=l===t.id;return(0,V.jsx)(`div`,{className:`${n?`kanban-card-dragging-source`:``} ${r?`animate-pop`:``}`,onContextMenu:e=>{`ontouchstart`in window&&(e.preventDefault(),f?.(t))},children:(0,V.jsx)(ci,{issue:t,onSelect:s,dragHandlers:o(t,e),isDragging:n,isSelected:p?.has(t.id),onToggleSelect:m,hasSelection:h})},t.id)}),ee&&(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-xs w-full gap-1 opacity-50 hover:opacity-80`,onClick:e=>{e.stopPropagation(),v(!_)},children:[(0,V.jsx)(ft,{className:`size-3 transition-transform ${_?`rotate-180`:``}`}),_?`Show less`:`+${O} more`]}),b&&S&&(0,V.jsx)(`div`,{className:`kanban-drop-placeholder`})]})})]},e)}function ji(e,t){let n=t.filter(t=>e.has(t.id));if(n.length===0)return[];let r=n.map(e=>{let t=ce[e.state]||[];return new Set(t.filter(t=>t!==e.state))});return[...r[0]].filter(e=>r.every(t=>t.has(e)))}function Mi({count:e,transitions:t,onBulkAction:n,onClear:r}){return(0,V.jsxs)(`div`,{className:`fixed bottom-4 left-1/2 -translate-x-1/2 z-40 bg-base-100 border border-base-300 rounded-box shadow-2xl px-4 py-2.5 flex items-center gap-3 animate-slide-up-sheet`,role:`toolbar`,"aria-label":`Bulk actions`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:t.map(e=>(0,V.jsxs)(`button`,{className:`btn btn-sm btn-outline gap-1`,onClick:()=>n(e),children:[(0,V.jsx)(tt,{className:`size-3`}),e]},e))}),(0,V.jsx)(`div`,{className:`divider divider-horizontal mx-0`}),(0,V.jsxs)(`span`,{className:`text-sm font-medium whitespace-nowrap opacity-70`,children:[e,` selected`]}),(0,V.jsx)(`button`,{className:`btn btn-sm btn-ghost btn-square`,onClick:r,"aria-label":`Clear selection`,children:(0,V.jsx)(J,{className:`size-4`})})]})}function Ni({issues:e,onStateChange:t,onRetry:n,onCancel:r,onSelect:i,onCreateIssue:a,isLoading:o}){let[s,c]=(0,B.useState)(null),[l,u]=(0,B.useState)(0),[d,f]=(0,B.useState)(null),[p,m]=(0,B.useState)(()=>new Set),h=(0,B.useRef)(null),g=p.size>0,_=(0,B.useCallback)(e=>{m(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),v=(0,B.useCallback)(()=>{m(new Set)},[]);(0,B.useEffect)(()=>{if(!g)return;let e=e=>{e.key===`Escape`&&v()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[g,v]),(0,B.useEffect)(()=>{if(!g)return;let t=new Set(e.map(e=>e.id));m(e=>{let n=new Set([...e].filter(e=>t.has(e)));return n.size===e.size?e:n})},[e,g]);let y=(0,B.useMemo)(()=>ji(p,e),[p,e]),b=(0,B.useCallback)(e=>{for(let n of p)t(n,e);v()},[p,t,v]),x=(0,B.useMemo)(()=>{let t=Object.fromEntries(Q.map(e=>[e,[]]));for(let n of e)t[vi.has(n.state)?`In Progress`:t[n.state]?n.state:`Todo`].push(n);for(let e of Q)t[e].sort((e,t)=>e.priority-t.priority);return t},[e]),S=(0,B.useMemo)(()=>e.some(e=>e.state===`Running`),[e]),C=(0,B.useCallback)((e,n)=>{c(e);let r=setTimeout(()=>c(null),400);return t(e,n),()=>clearTimeout(r)},[t]),{dragState:w,ghostRef:T,getCardHandlers:E,registerColumn:ee,onBoardPointerMove:D,onBoardPointerUp:O,onBoardPointerCancel:k,shouldSuppressClick:te}=gi({onStateChange:C}),ne=(0,B.useCallback)(e=>{te()||i?.(e)},[i,te]);(0,B.useEffect)(()=>{let e=h.current;if(!e)return;let t=e.querySelector(`.grid, [class*='grid']`);if(!t)return;let n=()=>{let n=t.children;if(!n.length)return;let r=e.scrollLeft,i=e.clientWidth,a=0,o=1/0;for(let e=0;e<n.length;e++){let t=n[e],s=t.offsetLeft+t.offsetWidth/2,c=r+i/2,l=Math.abs(s-c);l<o&&(o=l,a=e)}u(a)};return e.addEventListener(`scroll`,n,{passive:!0}),()=>e.removeEventListener(`scroll`,n)},[]),(0,B.useRef)(null);let re=(0,B.useCallback)(e=>{f(e)},[]);return o?(0,V.jsx)(`div`,{className:`overflow-x-auto pb-2 flex-1 flex flex-col min-h-0`,children:(0,V.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children`,style:{gridTemplateColumns:`repeat(${Q.length}, minmax(0, 1fr))`,minWidth:`${Q.length*180}px`},children:Q.map((e,t)=>(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex flex-col gap-2`,children:[(0,V.jsx)(`div`,{className:`skeleton-line h-4 w-20 mb-2`}),(0,V.jsx)(wi,{delay:t*80}),(0,V.jsx)(wi,{delay:t*80+120}),t<2&&(0,V.jsx)(wi,{delay:t*80+240})]},e))})}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{ref:h,className:`overflow-x-auto pb-2 flex-1 flex flex-col min-h-0`,onPointerMove:D,onPointerUp:O,onPointerCancel:k,style:{touchAction:w?`none`:void 0},children:[(0,V.jsx)(`div`,{className:`grid gap-3 flex-1 stagger-children ${w?`kanban-dragging`:``}`,style:{gridTemplateColumns:`repeat(${Q.length}, minmax(0, 1fr))`,minWidth:`${Q.length*180}px`},children:Q.map(t=>(0,V.jsx)(Ai,{col:t,issues:x[t],empty:Ci[t],badgeClass:yi[t],dragState:w,registerColumn:ee,getCardHandlers:E,onSelect:ne,onCreateIssue:a,lastDroppedId:s,hasRunningAgents:S,totalIssues:e.length,onLongPress:re,selectedIds:p,onToggleSelect:_,hasSelection:g},t))}),(0,V.jsx)(Ti,{dragState:w,ghostRef:T})]}),(0,V.jsx)(Oi,{columns:Q,activeIndex:l}),d&&(0,V.jsx)(Di,{issue:d,onClose:()=>f(null),onStateChange:C,onSelect:ne}),g&&(0,V.jsx)(Mi,{count:p.size,transitions:y,onBulkAction:b,onClear:v})]})}function Pi(e){if(!e||typeof e!=`string`)return e||`unknown`;let t=e.match(/claude-(\w+)-(\d+)-(\d+)/);return t?`${t[1].charAt(0).toUpperCase()+t[1].slice(1)} ${t[2]}.${t[3]}`:e}function Fi({value:e,className:t=``}){let[n,r]=(0,B.useState)(()=>$(e)),i=(0,B.useRef)(e),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let t=i.current||0,n=e||0;if(i.current=n,t===n){r($(n));return}let o=performance.now(),s=e=>{let i=e-o,c=Math.min(i/600,1),l=1-(1-c)**3,u=t+(n-t)*l;r($(Math.round(u))),c<1&&(a.current=requestAnimationFrame(s))};return cancelAnimationFrame(a.current),a.current=requestAnimationFrame(s),()=>cancelAnimationFrame(a.current)},[e]),(0,V.jsx)(`span`,{className:`${t} inline-block tabular-nums`,children:n})}function $(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Ii({byPhase:e,compact:t=!1}){if(!e)return null;let n=[{key:`planner`,label:`Plan`,color:`bg-info`,textColor:`text-info`},{key:`executor`,label:`Exec`,color:`bg-primary`,textColor:`text-primary`},{key:`reviewer`,label:`Review`,color:`bg-secondary`,textColor:`text-secondary`}],r=n.reduce((t,n)=>t+(e[n.key]?.totalTokens||0),0);return r===0?null:(0,V.jsxs)(`div`,{className:t?`flex flex-col gap-1`:`flex flex-col gap-1.5`,children:[(0,V.jsx)(`div`,{className:`flex h-2 rounded-full overflow-hidden bg-base-300 w-full min-w-[100px]`,children:n.map(t=>{let n=e[t.key]?.totalTokens||0,i=n/r*100;return i===0?null:(0,V.jsx)(`div`,{className:`${t.color} opacity-80 transition-all duration-500`,style:{width:`${i}%`},title:`${t.label}: ${$(n)} (${Math.round(i)}%)`},t.key)})}),(0,V.jsx)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:n.map(t=>{let n=e[t.key]?.totalTokens||0;return n===0?null:(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,children:[(0,V.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full ${t.color} shrink-0`}),(0,V.jsx)(`span`,{className:`opacity-60`,children:t.label}),(0,V.jsx)(`span`,{className:`font-mono opacity-80`,children:$(n)})]},t.key)})})]})}function Li({data:e,height:t=32,className:n=``}){if(!e||e.length===0)return null;let r=Math.max(...e.map(e=>e.totalTokens||0),1),i=Math.max(2,Math.floor(100/e.length));return(0,V.jsx)(`div`,{className:`flex items-end gap-px ${n}`,style:{height:t},children:e.map((e,n)=>{let a=Math.max(1,Math.round((e.totalTokens||0)/r*t)),o=e.date?new Date(e.date+`T00:00:00`).toLocaleDateString(void 0,{weekday:`short`}):`Day ${n+1}`;return(0,V.jsx)(`div`,{className:`bg-primary rounded-t-sm opacity-70 transition-all duration-500`,style:{width:`${i}%`,height:a},title:`${o}: ${$(e.totalTokens||0)}`},e.date||n)})})}function Ri({data:e,valueKey:t=`totalTokens`,height:n=28,color:r=`stroke-primary`,className:i=``}){if(!e||e.length===0)return null;let a=e.map(e=>e[t]||e.count||0),o=Math.max(...a,1),s=a.map((e,t)=>`${t/Math.max(a.length-1,1)*100},${n-e/o*(n-2)-1}`).join(` `),c=a[a.length-1]||0,l=a[a.length-2]||0,u=c>l?`up`:c<l?`down`:`flat`;return(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 ${i}`,children:[(0,V.jsxs)(`svg`,{viewBox:`0 0 100 ${n}`,className:`flex-1`,style:{height:n},preserveAspectRatio:`none`,children:[(0,V.jsx)(`polyline`,{points:s,fill:`none`,className:r,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,vectorEffect:`non-scaling-stroke`}),(0,V.jsx)(`polyline`,{points:`0,${n} ${s} 100,${n}`,fill:`currentColor`,className:r.replace(`stroke-`,`text-`),opacity:`0.08`})]}),(0,V.jsxs)(`span`,{className:`text-[9px] font-mono opacity-50 shrink-0 ${u===`up`?`text-success`:u===`down`?`text-error`:``}`,children:[$(c),`/h`]})]})}function zi({totalTokens:e,byPhase:t,tokensPerHour:n,eventsPerHour:r,hasHourlyData:i,modelEntries:a,issues:o}){let[s,c]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box animate-fade-in overflow-hidden`,children:[(0,V.jsxs)(`button`,{className:`flex items-center justify-between w-full px-4 py-2.5 text-left`,onClick:()=>c(!s),children:[(0,V.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5`,children:[(0,V.jsx)(I,{className:`size-3.5 text-primary`}),(0,V.jsx)(Fi,{value:e}),(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 font-normal ml-1`,children:`tokens`})]}),(0,V.jsx)(ft,{className:`size-4 opacity-40 transition-transform ${s?`rotate-180`:``}`})]}),s&&(0,V.jsxs)(`div`,{className:`px-4 pb-3 space-y-3 animate-fade-in border-t border-base-300 pt-3`,children:[t&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 block`,children:`Phases`}),(0,V.jsx)(Ii,{byPhase:t,compact:!0})]}),i&&n.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,V.jsx)(I,{className:`size-2.5`}),` Tokens/h`]}),(0,V.jsx)(Ri,{data:n,valueKey:`totalTokens`,height:32,color:`stroke-primary`,className:`w-full`})]}),i&&r.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,V.jsx)(Qe,{className:`size-2.5`}),` Events/h`]}),(0,V.jsx)(Ri,{data:r,valueKey:`count`,height:32,color:`stroke-secondary`,className:`w-full`})]}),a.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 block`,children:`Models`}),(0,V.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:a.slice(0,3).map(([e,t])=>{let n=e.includes(`claude`)?`bg-primary`:e.includes(`gpt`)||e.includes(`codex`)?`bg-secondary`:`bg-accent`,r=Pi(e);return(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,V.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full ${n} shrink-0`}),(0,V.jsx)(`span`,{className:`opacity-60`,children:r}),(0,V.jsx)(`span`,{className:`font-mono opacity-80`,children:$(t)})]},e)})})]}),o.length>0&&(0,V.jsxs)(`div`,{className:`text-xs opacity-40`,children:[o.length,` issues`]})]})]})}function Bi(){let[e,t]=(0,B.useState)(()=>window.innerWidth<768);return(0,B.useEffect)(()=>{let e=window.matchMedia(`(max-width: 767px)`),n=e=>t(e.matches);return e.addEventListener(`change`,n),()=>e.removeEventListener(`change`,n)},[]),e}function Vi({metrics:e,total:t,issues:n=[],compact:r=!1}){let{data:i}=Ee(),{data:a}=P(24),o=Bi(),s=i?.overall?.totalTokens||0,c=i?.byPhase||null,l=i?.daily||[],u=i?.byModel||{},d=s>0,f=a?.tokensPerHour||[],p=a?.eventsPerHour||[],m=f.some(e=>e.totalTokens>0)||p.some(e=>e.count>0),h=Object.entries(u).map(([e,t])=>[e,t?.totalTokens||0]).sort((e,t)=>t[1]-e[1]),g=(0,B.useRef)(s>0),[_,v]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{!g.current&&s>0&&(g.current=!0,v(!0))},[s]),s===0&&!m?null:o?(0,V.jsx)(zi,{totalTokens:s,byPhase:c,tokensPerHour:f,eventsPerHour:p,hasHourlyData:m,modelEntries:h,issues:n}):r?(0,V.jsxs)(`div`,{className:`flex items-stretch gap-3 bg-base-200 rounded-box overflow-hidden ${_?`animate-fade-in-up`:`animate-fade-in`}`,children:[(0,V.jsx)(`div`,{className:`flex items-center gap-5 px-4 py-2.5`,children:(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40`,children:`Tokens`}),(0,V.jsxs)(`span`,{className:`text-base font-bold font-mono leading-tight flex items-center gap-1.5`,children:[(0,V.jsx)(I,{className:`size-3.5 text-primary`}),(0,V.jsx)(Fi,{value:s})]})]})}),c&&(0,V.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[140px]`,children:[(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1`,children:`Phases`}),(0,V.jsx)(Ii,{byPhase:c,compact:!0})]}),m&&f.some(e=>e.totalTokens>0)&&(0,V.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[140px]`,children:[(0,V.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,V.jsx)(I,{className:`size-2.5`}),` Tokens/h`]}),(0,V.jsx)(Ri,{data:f,valueKey:`totalTokens`,height:28,color:`stroke-primary`})]}),m&&p.some(e=>e.count>0)&&(0,V.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300 min-w-[140px]`,children:[(0,V.jsxs)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1 flex items-center gap-1`,children:[(0,V.jsx)(Qe,{className:`size-2.5`}),` Events/h`]}),(0,V.jsx)(Ri,{data:p,valueKey:`count`,height:28,color:`stroke-secondary`})]}),h.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col justify-center py-2 px-3 border-l border-base-300`,children:[(0,V.jsx)(`span`,{className:`text-[10px] uppercase tracking-wide opacity-40 mb-1`,children:`Models`}),(0,V.jsx)(`div`,{className:`flex flex-col gap-0.5`,children:h.slice(0,3).map(([e,t])=>{let n=e.includes(`claude`)?`bg-primary`:e.includes(`gpt`)||e.includes(`codex`)?`bg-secondary`:`bg-accent`,r=Pi(e);return(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-xs`,children:[(0,V.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full ${n} shrink-0`}),(0,V.jsx)(`span`,{className:`opacity-60`,children:r}),(0,V.jsx)(`span`,{className:`font-mono opacity-80`,children:$(t)})]},e)})})]}),n.length>0&&(0,V.jsx)(`div`,{className:`flex items-center px-4 ml-auto`,children:(0,V.jsxs)(`span`,{className:`text-xs opacity-40`,children:[n.length,` issues`]})})]}):(0,V.jsxs)(`div`,{className:`stats stats-horizontal bg-base-200 rounded-box w-full mb-4 overflow-x-auto animate-fade-in`,children:[(0,V.jsxs)(`div`,{className:`stat`,children:[(0,V.jsx)(`div`,{className:`stat-figure text-primary hidden sm:inline`,children:(0,V.jsx)(I,{className:`size-7`})}),(0,V.jsx)(`div`,{className:`stat-title`,children:`Tokens Used`}),(0,V.jsx)(`div`,{className:`stat-value text-lg`,children:(0,V.jsx)(Fi,{value:s})}),(0,V.jsx)(`div`,{className:`stat-desc`,children:d?`${n.length} issues`:`No token data yet`})]}),(0,V.jsxs)(`div`,{className:`stat`,children:[(0,V.jsx)(`div`,{className:`stat-figure text-info hidden sm:inline`,children:(0,V.jsx)(Vt,{className:`size-7`})}),(0,V.jsx)(`div`,{className:`stat-title`,children:`Phase Split`}),(0,V.jsx)(`div`,{className:`stat-value p-0`,children:c?(0,V.jsx)(Ii,{byPhase:c}):(0,V.jsx)(`div`,{className:`text-sm opacity-30 py-1`,children:`--`})}),(0,V.jsx)(`div`,{className:`stat-desc`,children:h.length>0?h.map(([e,t])=>`${e.split(`-`).pop()}: ${$(t)}`).join(` · `):`Across all models`})]}),(0,V.jsxs)(`div`,{className:`stat`,children:[(0,V.jsx)(`div`,{className:`stat-figure text-accent hidden sm:inline`,children:(0,V.jsx)(gn,{className:`size-7`})}),(0,V.jsx)(`div`,{className:`stat-title`,children:`Last 7 days`}),(0,V.jsx)(`div`,{className:`stat-value p-0`,children:d&&l.length>0?(0,V.jsx)(Li,{data:l,height:36}):(0,V.jsx)(`div`,{className:`text-sm opacity-30 py-1`,children:`--`})}),(0,V.jsx)(`div`,{className:`stat-desc`,children:d&&h.length>0&&(0,V.jsx)(`span`,{className:`flex items-center gap-2 mt-1`,children:h.slice(0,3).map(([e])=>{let t=e.includes(`claude`)?`bg-primary`:e.includes(`gpt`)||e.includes(`codex`)?`bg-secondary`:`bg-accent`,n=Pi(e);return(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px]`,children:[(0,V.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full ${t}`}),n]},e)})})})]})]})}var Hi=b(`/kanban`)({component:Ui});function Ui(){let e=Xe(),{data:t}=Ee();return(0,V.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 px-3 pb-2 gap-2`,children:[((t?.overall?.totalTokens||0)>0||e.issues.length>0)&&(0,V.jsx)(Vi,{metrics:e.metrics,total:e.issues.length,issues:e.issues,compact:!0}),(0,V.jsx)(Ni,{issues:e.filtered,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,onCreateIssue:()=>e.setIsCreateOpen(!0)})]})}var Wi={Planning:`badge-info`,Todo:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Interrupted:`badge-accent`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},Gi={Planning:`border-l-info`,Todo:`border-l-warning`,Queued:`border-l-info`,Running:`border-l-primary`,Interrupted:`border-l-accent`,"In Review":`border-l-secondary`,Blocked:`border-l-error`,Done:`border-l-success`,Cancelled:`border-l-neutral`};function Ki(e){return!e||e===0?null:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function qi({icon:e,label:t,value:n,color:r=``}){return!n&&n!==0?null:(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-0.5 text-[10px]`,title:t,children:[(0,V.jsx)(e,{className:`size-2.5 ${r||`opacity-40`}`}),(0,V.jsx)(`span`,{className:`font-mono opacity-70`,children:n})]})}function Ji(e){let t=e.createdAt?new Date(e.createdAt).getTime():0,n=e.startedAt?new Date(e.startedAt).getTime():0,r=e.completedAt?new Date(e.completedAt).getTime():0,i=Date.now();return{leadTimeMs:r?r-t:n?i-t:0,cycleTimeMs:r&&n?r-n:n?i-n:0,waitTimeMs:n?n-t:t?i-t:0}}function Yi({issue:e,onSelect:t}){let n=e.state===`Running`,r=Ki(e.tokenUsage?.totalTokens),i=e.description||``,a=(e.labels||[]).filter(e=>!e.startsWith(`capability:`)&&!e.startsWith(`overlay:`)),{leadTimeMs:o,cycleTimeMs:s,waitTimeMs:c}=Ji(e);return e.state===`Done`||e.state,(0,V.jsx)(`div`,{className:`card bg-base-100 border border-base-300 border-l-[3px] ${Gi[e.state]||``} card-interactive cursor-pointer hover:shadow-lg transition-all ${n?`animate-pulse-border`:``}`,role:`button`,tabIndex:0,onClick:()=>t?.(e),onKeyDown:n=>{(n.key===`Enter`||n.key===` `)&&(n.preventDefault(),t?.(e))},children:(0,V.jsxs)(`div`,{className:`card-body gap-3 p-4 justify-between`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-1.5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`font-mono text-xs opacity-50`,children:e.identifier}),(0,V.jsx)(`span`,{className:`badge badge-xs ${Wi[e.state]||`badge-ghost`}`,children:e.state}),(0,V.jsxs)(`span`,{className:`text-[10px] opacity-30`,children:[`P`,e.priority]})]}),(0,V.jsx)(`span`,{className:`text-xs opacity-40 shrink-0`,children:j(e.updatedAt)})]}),(0,V.jsx)(`h3`,{className:`font-semibold text-sm leading-snug line-clamp-2`,children:e.title}),i&&(0,V.jsx)(`p`,{className:`text-xs opacity-50 leading-relaxed line-clamp-2 mt-1`,children:i})]}),(a.length>0||e.capabilityCategory)&&(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-1`,children:[e.capabilityCategory&&(0,V.jsxs)(`span`,{className:`badge badge-xs badge-outline`,children:[(0,V.jsx)(Vt,{className:`size-2.5 mr-0.5`}),e.capabilityCategory]}),a.slice(0,3).map(e=>(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e},e)),a.length>3&&(0,V.jsxs)(`span`,{className:`badge badge-xs badge-ghost opacity-40`,children:[`+`,a.length-3]})]}),[`Planning`,`Queued`,`Running`,`In Review`,`Blocked`].includes(e.state)&&(0,V.jsx)(`div`,{className:`pt-1`,children:(0,V.jsx)(Qn,{issue:e,showElapsed:!0})}),(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pt-2 border-t border-base-200`,children:[(0,V.jsx)(qi,{icon:Lt,label:`Wait`,value:c>0?N(c):null}),(0,V.jsx)(qi,{icon:hn,label:`Cycle`,value:s>0?N(s):null,color:`text-primary`}),(0,V.jsx)(qi,{icon:xt,label:`Lead`,value:o>0?N(o):null}),(0,V.jsx)(qi,{icon:I,label:`Tokens`,value:r,color:`text-warning`}),(0,V.jsx)(qi,{icon:Ct,label:`Cost`,value:e.tokenUsage?.costUsd?`$${e.tokenUsage.costUsd.toFixed(2)}`:null,color:`text-secondary`}),(0,V.jsx)(qi,{icon:K,label:`Attempts`,value:e.attempts>0?`${e.attempts}/${e.maxAttempts}`:null}),(0,V.jsx)(qi,{icon:Dt,label:`Files`,value:e.filesChanged||null,color:`text-info`}),e.linesAdded?(0,V.jsxs)(`span`,{className:`text-[10px] font-mono text-success`,children:[`+`,e.linesAdded]}):null,e.linesRemoved?(0,V.jsxs)(`span`,{className:`text-[10px] font-mono text-error`,children:[`-`,e.linesRemoved]}):null]})]})})}function Xi({issues:e,onStateChange:t,onRetry:n,onCancel:r,onSelect:i,expanded:a=!1}){return e.length===0?(0,V.jsx)(li,{icon:Ht,title:`No issues found`,description:`Try adjusting your search or filters, or create your first issue to get started.`}):a?(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 xl:grid-cols-3 gap-3 stagger-children`,children:e.map(e=>(0,V.jsx)(Yi,{issue:e,onSelect:i},e.id))}):(0,V.jsx)(`div`,{className:`space-y-2 stagger-children`,children:e.map(e=>(0,V.jsx)(ci,{issue:e,onSelect:i},e.id))})}var Zi=[`Planning`,`Todo`,`Queued`,`Running`,`Interrupted`,`In Review`,`Blocked`,`Done`,`Cancelled`],Qi={Planning:`badge-info`,Todo:`badge-warning`,Queued:`badge-info`,Running:`badge-primary`,Interrupted:`badge-accent`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},$i=[{value:`recent`,label:`Active + recent`},{value:`all`,label:`All issues`}],ea=b(`/issues`)({component:ta});function ta(){let e=Xe(),[t,n]=(0,B.useState)(!1),r=e.stateFilter!==`all`||e.categoryFilter!==`all`||e.completionFilter!==`recent`,i=(e.data._totalIssues??0)-(e.issues.length??0),a=(e.stateFilter===`all`?0:1)+(e.categoryFilter===`all`?0:1)+(e.completionFilter===`recent`?0:1),o={};for(let t of e.issues)o[t.state]=(o[t.state]||0)+1;let s=(0,B.useMemo)(()=>[...e.filtered].sort((e,t)=>{let n=e.updatedAt||e.createdAt||``;return(t.updatedAt||t.createdAt||``).localeCompare(n)}),[e.filtered]),c=()=>{e.setQuery(``),e.setStateFilter(`all`),e.setCategoryFilter(`all`),e.setCompletionFilter(`recent`)};return(0,V.jsxs)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:[(0,V.jsxs)(`div`,{className:`sticky top-0 z-10 bg-base-100 pt-3 pb-3 border-b border-base-300 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`label`,{className:`input input-bordered input-sm flex items-center gap-2 flex-1`,children:[(0,V.jsx)(nn,{className:`size-4 opacity-40`}),(0,V.jsx)(`input`,{type:`text`,className:`grow`,placeholder:`Search by title, ID, or description...`,value:e.query,onChange:t=>e.setQuery(t.target.value)}),e.query&&(0,V.jsx)(`button`,{className:`btn btn-xs btn-ghost btn-circle`,onClick:()=>e.setQuery(``),children:(0,V.jsx)(J,{className:`size-3`})})]}),(0,V.jsx)(`button`,{className:`btn btn-sm btn-square ${t?`btn-primary`:`btn-ghost`}`,onClick:()=>n(!t),title:`Toggle filters`,children:(0,V.jsx)(rn,{className:`size-4`})}),a>0&&(0,V.jsx)(`span`,{className:`badge badge-sm badge-primary`,children:a}),(0,V.jsxs)(O,{to:`/discover`,className:`btn btn-sm btn-ghost gap-1`,title:`Discover issues from codebase`,children:[(0,V.jsx)(U,{className:`size-4`}),(0,V.jsx)(`span`,{className:`hidden sm:inline`,children:`Discover`})]}),(0,V.jsxs)(`div`,{className:`text-xs opacity-40 shrink-0`,children:[e.filtered.length,` result`,e.filtered.length===1?``:`s`,i>0&&e.completionFilter===`recent`&&(0,V.jsxs)(`span`,{children:[` · `,i,` older hidden`]})]})]}),t&&(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`State`}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,V.jsx)(`button`,{className:`badge badge-sm cursor-pointer ${e.stateFilter===`all`?`badge-primary`:`badge-ghost opacity-60 hover:opacity-100`}`,onClick:()=>e.setStateFilter(`all`),children:`All`}),Zi.map(t=>{let n=o[t]||0,r=e.stateFilter===t;return(0,V.jsxs)(`button`,{className:`badge badge-sm gap-1 cursor-pointer transition-all ${r?Qi[t]:`badge-outline opacity-60 hover:opacity-100`}`,onClick:()=>e.setStateFilter(r?`all`:t),children:[t,n>0&&(0,V.jsx)(`span`,{className:`font-mono text-[10px]`,children:n})]},t)})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-4`,children:[e.categoryOptions.length>2&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`Capability`}),(0,V.jsx)(`select`,{className:`select select-bordered select-sm`,value:e.categoryFilter,onChange:t=>e.setCategoryFilter(t.target.value),children:e.categoryOptions.map(e=>(0,V.jsx)(`option`,{value:e,children:e===`all`?`All capabilities`:e},e))})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-xs font-semibold opacity-50 mb-1.5`,children:`Show`}),(0,V.jsx)(`select`,{className:`select select-bordered select-sm`,value:e.completionFilter,onChange:t=>e.setCompletionFilter(t.target.value),children:$i.map(e=>(0,V.jsx)(`option`,{value:e.value,children:e.label},e.value))})]}),r&&(0,V.jsx)(`div`,{className:`flex items-end`,children:(0,V.jsxs)(`button`,{className:`btn btn-sm btn-ghost gap-1`,onClick:c,children:[(0,V.jsx)(J,{className:`size-3`}),`Clear all`]})})]})]}),!t&&r&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap`,children:[(0,V.jsx)(jt,{className:`size-3 opacity-40`}),e.stateFilter!==`all`&&(0,V.jsxs)(`span`,{className:`badge badge-sm gap-1 ${Qi[e.stateFilter]}`,children:[e.stateFilter,(0,V.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setStateFilter(`all`),children:(0,V.jsx)(J,{className:`size-2.5`})})]}),e.categoryFilter!==`all`&&(0,V.jsxs)(`span`,{className:`badge badge-sm badge-outline gap-1`,children:[e.categoryFilter,(0,V.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setCategoryFilter(`all`),children:(0,V.jsx)(J,{className:`size-2.5`})})]}),e.completionFilter!==`recent`&&(0,V.jsxs)(`span`,{className:`badge badge-sm badge-ghost gap-1`,children:[`All issues`,(0,V.jsx)(`button`,{className:`ml-0.5`,onClick:()=>e.setCompletionFilter(`recent`),children:(0,V.jsx)(J,{className:`size-2.5`})})]}),(0,V.jsx)(`button`,{className:`text-xs opacity-40 hover:opacity-100 underline`,onClick:c,children:`clear all`})]})]}),(0,V.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3`,children:(0,V.jsx)(Xi,{issues:s,onStateChange:e.updateState,onRetry:e.retryIssue,onCancel:e.cancelIssue,onSelect:e.setSelectedIssue,expanded:!0})})]})}var na=[{id:`todos`,label:`TODOs & FIXMEs`,icon:Dt},{id:`github`,label:`GitHub Issues`,icon:Ft}],ra={todo:{label:`TODO`,class:`badge-info`},fixme:{label:`FIXME`,class:`badge-error`},hack:{label:`HACK`,class:`badge-warning`},github:{label:`GitHub`,class:`badge-neutral`}};function ia({item:e,selected:t,onToggle:n,onCreateSingle:r,creating:i}){let a=ra[e.source]||ra.todo;return(0,V.jsx)(`div`,{className:`card card-compact bg-base-200/50 border transition-all duration-150 ${t?`border-primary/40 bg-primary/5`:`border-base-300/50 hover:border-base-content/20`}`,children:(0,V.jsx)(`div`,{className:`card-body gap-2`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(`button`,{className:`mt-0.5 shrink-0 opacity-60 hover:opacity-100 transition-opacity`,onClick:()=>n(e),children:t?(0,V.jsx)(cn,{className:`size-5 text-primary`}):(0,V.jsx)(ln,{className:`size-5`})}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,V.jsx)(`span`,{className:`badge badge-xs ${a.class}`,children:a.label}),e.category&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e.category})]}),(0,V.jsx)(`p`,{className:`text-sm font-medium mt-1 leading-snug`,children:e.title}),e.file&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 mt-1.5 text-xs text-base-content/50`,children:[(0,V.jsx)(kt,{className:`size-3`}),(0,V.jsx)(`span`,{className:`truncate`,children:e.file}),e.line>0&&(0,V.jsxs)(`span`,{children:[`:`,e.line]})]}),e.suggestedLabels?.length>0&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1 mt-1.5 flex-wrap`,children:[(0,V.jsx)(dn,{className:`size-3 text-base-content/40`}),e.suggestedLabels.slice(0,4).map(e=>(0,V.jsx)(`span`,{className:`badge badge-xs badge-outline`,children:e},e))]})]}),(0,V.jsx)(`button`,{className:`btn btn-xs btn-ghost btn-square shrink-0`,onClick:()=>r(e),disabled:i,title:`Create issue`,children:(0,V.jsx)(Qt,{className:`size-3.5`})})]})})})}function aa({embedded:e=!1,onBack:t}){let[n,r]=(0,B.useState)(`todos`),[i,a]=(0,B.useState)([]),[o,s]=(0,B.useState)([]),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(null),[f,p]=(0,B.useState)(new Set),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(0),[v,y]=(0,B.useState)(``),b=e?null:Xe(),x=n===`todos`?i:o,S=v.trim()?x.filter(e=>e.title.toLowerCase().includes(v.toLowerCase())||e.file?.toLowerCase().includes(v.toLowerCase())||e.category?.toLowerCase().includes(v.toLowerCase())):x,C=(0,B.useCallback)(async e=>{l(!0),d(null);try{let t=e===`todos`?`/scan/issues`:`/scan/github-issues`,n=(await L.get(t)).issues||[];e===`todos`?a(n):s(n)}catch(e){d(e.message||`Failed to scan`)}finally{l(!1)}},[]);(0,B.useEffect)(()=>{(n===`todos`?i:o).length===0&&C(n)},[n]);let w=(0,B.useCallback)(e=>{let t=`${e.source}:${e.file}:${e.line}:${e.title}`;p(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),T=e=>`${e.source}:${e.file}:${e.line}:${e.title}`,E=(0,B.useCallback)(()=>{p(new Set(S.map(T)))},[S]),ee=(0,B.useCallback)(()=>{p(new Set)},[]),D=(0,B.useCallback)(async e=>{let t={title:e.title,description:e.context||e.title,labels:e.suggestedLabels||[e.source],paths:e.suggestedPaths||(e.file?[e.file]:[])};await L.post(`/issues/create`,t)},[]),O=(0,B.useCallback)(async e=>{h(!0);try{await D(e),_(e=>e+1);let t=T(e);p(e=>{let n=new Set(e);return n.delete(t),n}),n===`todos`?a(e=>e.filter(e=>T(e)!==t)):s(e=>e.filter(e=>T(e)!==t)),b?.showToast?.(`Issue created`,`success`)}catch(e){b?.showToast?.(e.message||`Failed to create issue`,`error`)}finally{h(!1)}},[n,b,D]),k=(0,B.useCallback)(async()=>{if(f.size===0)return;h(!0);let e=0,t=S.filter(e=>f.has(T(e)));for(let n of t)try{await D(n),e++}catch{}_(t=>t+e);let r=new Set(t.map(T));n===`todos`?a(e=>e.filter(e=>!r.has(T(e)))):s(e=>e.filter(e=>!r.has(T(e)))),p(new Set),h(!1),b?.showToast?.(`${e} issue(s) created`,`success`)},[f,S,n,b,D]);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 ${e?``:`p-4 max-w-4xl mx-auto w-full`}`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[t&&(0,V.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square`,onClick:t,children:(0,V.jsx)(et,{className:`size-4`})}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h2`,{className:`font-bold ${e?`text-xl`:`text-2xl`}`,children:e?`Discover Issues`:`Discover Issues in Codebase`}),!e&&(0,V.jsx)(`p`,{className:`text-sm text-base-content/60 mt-0.5`,children:`Scan your code for TODOs, FIXMEs, and import GitHub issues`})]}),g>0&&(0,V.jsxs)(`div`,{className:`badge badge-success gap-1`,children:[(0,V.jsx)(Qt,{className:`size-3`}),` `,g,` created`]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{role:`tablist`,className:`tabs tabs-boxed tabs-sm flex-1`,children:na.map(e=>{let t=e.icon,a=e.id===`todos`?i.length:o.length;return(0,V.jsxs)(`button`,{role:`tab`,className:`tab gap-1.5 ${n===e.id?`tab-active`:``}`,onClick:()=>r(e.id),children:[(0,V.jsx)(t,{className:`size-3.5`}),e.label,a>0&&(0,V.jsx)(`span`,{className:`badge badge-xs`,children:a})]},e.id)})}),(0,V.jsx)(`button`,{className:`btn btn-ghost btn-sm btn-square`,onClick:()=>C(n),disabled:c,title:`Refresh`,children:(0,V.jsx)(en,{className:`size-4 ${c?`animate-spin`:``}`})})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`label`,{className:`input input-sm input-bordered flex items-center gap-2 flex-1`,children:[(0,V.jsx)(nn,{className:`size-3.5 opacity-50`}),(0,V.jsx)(`input`,{type:`text`,className:`grow`,placeholder:`Filter by title, file, or category...`,value:v,onChange:e=>y(e.target.value)})]}),S.length>0&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(`button`,{className:`btn btn-ghost btn-xs`,onClick:E,children:`All`}),(0,V.jsx)(`button`,{className:`btn btn-ghost btn-xs`,onClick:ee,children:`None`})]}),f.size>0&&(0,V.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:k,disabled:m,children:[m?(0,V.jsx)(G,{className:`size-3.5 animate-spin`}):(0,V.jsx)(Qt,{className:`size-3.5`}),`Create `,f.size,` issue`,f.size===1?``:`s`]})]}),c&&x.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-3`,children:[(0,V.jsx)(G,{className:`size-8 animate-spin text-primary`}),(0,V.jsx)(`p`,{className:`text-sm text-base-content/50`,children:n===`todos`?`Scanning codebase for TODOs...`:`Fetching GitHub issues...`})]}):u?(0,V.jsxs)(`div`,{className:`alert alert-warning`,children:[(0,V.jsx)(q,{className:`size-4`}),(0,V.jsx)(`span`,{children:u}),(0,V.jsx)(`button`,{className:`btn btn-sm btn-ghost`,onClick:()=>C(n),children:`Retry`})]}):S.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 gap-2 opacity-50`,children:[n===`todos`?(0,V.jsx)(Dt,{className:`size-10`}):(0,V.jsx)(Ft,{className:`size-10`}),(0,V.jsx)(`p`,{className:`text-sm`,children:x.length===0?n===`todos`?`No TODOs or FIXMEs found in your codebase`:`No open GitHub issues found`:`No items match your search`})]}):(0,V.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,V.jsxs)(`p`,{className:`text-xs text-base-content/40`,children:[S.length,` item`,S.length===1?``:`s`,` found`,f.size>0&&` \u00b7 ${f.size} selected`]}),S.map((e,t)=>(0,V.jsx)(ia,{item:e,selected:f.has(T(e)),onToggle:w,onCreateSingle:O,creating:m},`${e.source}-${e.file}-${e.line}-${t}`))]})]})}function oa({onIssuesCreated:e}){let[t,n]=(0,B.useState)([]),[r,i]=(0,B.useState)([]),[a,o]=(0,B.useState)(`todos`),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(new Set),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)(0),h=a===`todos`?t:r,g=(0,B.useCallback)(async e=>{c(!0);try{let t=e===`todos`?`/scan/issues`:`/scan/github-issues`,r=await L.get(t);e===`todos`?n(r.issues||[]):i(r.issues||[])}catch{}finally{c(!1)}},[]);(0,B.useEffect)(()=>{g(`todos`)},[]),(0,B.useEffect)(()=>{(a===`todos`?t:r).length===0&&a===`github`&&g(`github`)},[a]);let _=e=>`${e.source}:${e.file}:${e.line}:${e.title}`,v=(0,B.useCallback)(e=>{let t=_(e);u(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),y=(0,B.useCallback)(async()=>{if(l.size===0)return;f(!0);let t=0,r=h.filter(e=>l.has(_(e)));for(let e of r)try{await L.post(`/issues/create`,{title:e.title,description:e.context||e.title,labels:e.suggestedLabels||[e.source],paths:e.suggestedPaths||(e.file?[e.file]:[])}),t++}catch{}let o=new Set(r.map(_));a===`todos`?n(e=>e.filter(e=>!o.has(_(e)))):i(e=>e.filter(e=>!o.has(_(e)))),u(new Set),f(!1),m(e=>e+t),e?.(t)},[l,h,a,e]);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-4 stagger-children`,children:[(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(nn,{className:`size-10 text-primary mx-auto mb-3`}),(0,V.jsx)(`h2`,{className:`text-2xl font-bold`,children:`Discover Issues`}),(0,V.jsx)(`p`,{className:`text-base-content/60 mt-1`,children:`We found items in your codebase that could become issues`})]}),(0,V.jsx)(`div`,{role:`tablist`,className:`tabs tabs-boxed tabs-sm justify-center`,children:na.map(e=>{let n=e.icon,i=e.id===`todos`?t.length:r.length;return(0,V.jsxs)(`button`,{role:`tab`,className:`tab gap-1.5 ${a===e.id?`tab-active`:``}`,onClick:()=>o(e.id),children:[(0,V.jsx)(n,{className:`size-3.5`}),e.label,i>0&&(0,V.jsx)(`span`,{className:`badge badge-xs`,children:i})]},e.id)})}),s?(0,V.jsxs)(`div`,{className:`flex flex-col items-center py-8 gap-2`,children:[(0,V.jsx)(G,{className:`size-6 animate-spin text-primary`}),(0,V.jsx)(`p`,{className:`text-sm text-base-content/50`,children:`Scanning...`})]}):h.length===0?(0,V.jsx)(`div`,{className:`text-center py-8 opacity-50`,children:(0,V.jsx)(`p`,{className:`text-sm`,children:a===`todos`?`No TODOs or FIXMEs found`:`No open GitHub issues found`})}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`flex flex-col gap-2 max-h-72 overflow-y-auto pr-1`,children:[h.slice(0,30).map((e,t)=>{let n=_(e),r=l.has(n),i=ra[e.source]||ra.todo;return(0,V.jsxs)(`button`,{className:`flex items-start gap-3 p-3 rounded-lg text-left transition-all duration-100 ${r?`bg-primary/10 border border-primary/30`:`bg-base-200/50 border border-transparent hover:bg-base-200`}`,onClick:()=>v(e),children:[r?(0,V.jsx)(cn,{className:`size-4 text-primary mt-0.5 shrink-0`}):(0,V.jsx)(ln,{className:`size-4 opacity-40 mt-0.5 shrink-0`}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,V.jsx)(`span`,{className:`badge badge-xs ${i.class}`,children:i.label}),e.category&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:e.category})]}),(0,V.jsx)(`p`,{className:`text-sm mt-0.5 truncate`,children:e.title}),e.file&&(0,V.jsxs)(`p`,{className:`text-xs text-base-content/40 truncate mt-0.5`,children:[e.file,`:`,e.line]})]})]},`${n}-${t}`)}),h.length>30&&(0,V.jsxs)(`p`,{className:`text-xs text-center text-base-content/40 py-2`,children:[`Showing 30 of `,h.length,` items. Open the full view in the dashboard.`]})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(`button`,{className:`btn btn-ghost btn-xs`,onClick:()=>u(new Set(h.slice(0,30).map(_))),children:`Select all`}),(0,V.jsx)(`button`,{className:`btn btn-ghost btn-xs`,onClick:()=>u(new Set),children:`Clear`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[p>0&&(0,V.jsxs)(`span`,{className:`badge badge-success badge-sm gap-1`,children:[(0,V.jsx)(Qt,{className:`size-3`}),` `,p]}),l.size>0&&(0,V.jsxs)(`button`,{className:`btn btn-primary btn-sm gap-1`,onClick:y,disabled:d,children:[d?(0,V.jsx)(G,{className:`size-3.5 animate-spin`}):(0,V.jsx)(Qt,{className:`size-3.5`}),`Create `,l.size,` issue`,l.size===1?``:`s`]})]})]})]}),(0,V.jsx)(`p`,{className:`text-xs text-center text-base-content/40`,children:`This step is optional. You can always discover issues later from the dashboard.`})]})}var sa=b(`/discover`)({component:ca});function ca(){let e=h();return(0,V.jsx)(aa,{onBack:()=>e({to:`/issues`})})}var la=b(`/analytics`)({}),ua={Queued:`badge-info`,Running:`badge-primary`,Interrupted:`badge-accent`,"In Review":`badge-secondary`,Blocked:`badge-error`,Done:`badge-success`,Cancelled:`badge-neutral`},da={Queued:Ut,Running:yt,Interrupted:Xt,"In Review":yt,Blocked:q,Done:H,Cancelled:vt};function fa(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function pa({issueId:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useCallback)(async()=>{try{n(await L.get(`/live/${encodeURIComponent(e)}`))}catch{}},[e]);if((0,B.useEffect)(()=>{r();let e=setInterval(r,4e3);return()=>clearInterval(e)},[r]),!t)return null;let i=Number.isFinite(Number(t.elapsed))?Number(t.elapsed):t.startedAt?Math.max(Date.now()-new Date(t.startedAt).getTime(),0):0,a=t.logSize?(t.logSize/1024).toFixed(1):`0`;return(0,V.jsxs)(`div`,{className:`mt-2 space-y-1.5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 text-xs opacity-60`,children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(xt,{className:`size-3`}),N(i)]}),(0,V.jsxs)(`span`,{children:[`Log: `,a,` KB`]}),t.agentPid&&(0,V.jsxs)(`span`,{children:[`PID `,t.agentPid]}),t.agentAlive===!1&&t.agentPid&&(0,V.jsx)(`span`,{className:`text-error`,children:`dead`})]}),t.logTail&&(0,V.jsx)(`pre`,{className:`text-[11px] bg-base-300 rounded-box p-3 overflow-x-auto whitespace-pre-wrap max-h-48 overflow-y-auto font-mono opacity-80 leading-relaxed break-all w-full max-w-full`,children:t.logTail.slice(-2e3)})]})}function ma({index:e,issue:t,total:n}){if(!t)return(0,V.jsx)(`div`,{className:`slot-idle rounded-box p-6 flex items-center justify-center opacity-30 transition-opacity duration-300 hover:opacity-40 border-2 border-dashed border-base-300`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(yt,{className:`size-5 animate-pulse-soft`}),`Slot `,e+1,` -- idle`]})});let r=t.state===`Running`;return(0,V.jsxs)(`div`,{className:`border-2 rounded-box p-5 space-y-2 animate-fade-in-scale overflow-hidden min-w-0 ${t.state===`In Review`?`border-secondary bg-secondary/5`:`border-primary bg-primary/5`} ${r?`slot-active`:``}`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,V.jsx)(`span`,{className:`loading loading-spinner loading-sm text-primary shrink-0`}),(0,V.jsx)(`span`,{className:`font-mono text-base font-bold truncate`,children:t.identifier}),(0,V.jsx)(`span`,{className:`badge badge-sm ${ua[t.state]||`badge-ghost`} shrink-0`,children:t.state})]}),(0,V.jsxs)(`span`,{className:`text-xs font-mono opacity-50 shrink-0 bg-base-200 px-2 py-0.5 rounded`,children:[`Slot `,e+1,`/`,n]})]}),(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:t.title}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs opacity-60`,children:[t.capabilityCategory&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:t.capabilityCategory}),(0,V.jsxs)(`span`,{children:[`P`,t.priority]}),(0,V.jsxs)(`span`,{children:[`Attempt `,(t.attempts||0)+1,`/`,t.maxAttempts]}),t.startedAt&&(0,V.jsxs)(`span`,{children:[`started `,j(t.startedAt)]})]}),(0,V.jsx)(pa,{issueId:t.id})]})}function ha({issue:e}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,V.jsx)(da[e.state]||yt,{className:`size-3 opacity-40 shrink-0`}),(0,V.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,V.jsx)(`span`,{className:`truncate flex-1`,children:e.title}),(0,V.jsx)(`span`,{className:`badge badge-xs ${ua[e.state]||`badge-ghost`}`,children:e.state}),e.state===`Blocked`&&e.nextRetryAt&&(0,V.jsxs)(`span`,{className:`opacity-40 shrink-0`,children:[`retry `,j(e.nextRetryAt)]})]})}function ga({issue:e}){return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs py-1.5 px-3 rounded-lg bg-base-200`,children:[(0,V.jsx)(e.state===`Done`?H:vt,{className:`size-3 shrink-0 ${e.state===`Done`?`text-success`:`text-neutral`}`}),(0,V.jsx)(`span`,{className:`font-mono opacity-60 shrink-0`,children:e.identifier}),(0,V.jsx)(`span`,{className:`truncate flex-1 opacity-70`,children:e.title}),e.durationMs&&(0,V.jsx)(`span`,{className:`opacity-40 shrink-0`,children:N(e.durationMs)}),e.completedAt&&(0,V.jsx)(`span`,{className:`opacity-40 shrink-0`,children:j(e.completedAt)})]})}function _a({running:e,queued:t,concurrency:n,totalTokensToday:r}){return(0,V.jsxs)(`div`,{className:`grid grid-cols-2 sm:grid-cols-4 gap-3 pt-3`,children:[(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`bg-primary/10 rounded-btn p-2`,children:(0,V.jsx)(_n,{className:`size-5 text-primary`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`text-2xl font-bold font-mono`,children:[e.length,(0,V.jsxs)(`span`,{className:`text-sm opacity-50`,children:[`/`,n]})]}),(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Active agents`})]})]}),(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`bg-info/10 rounded-btn p-2`,children:(0,V.jsx)(Ut,{className:`size-5 text-info`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:t.length}),(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Queued`})]})]}),(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`bg-accent/10 rounded-btn p-2`,children:(0,V.jsx)(I,{className:`size-5 text-accent`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:fa(r)}),(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Tokens today`})]})]}),(0,V.jsxs)(`div`,{className:`bg-base-200 rounded-box p-3 flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`bg-secondary/10 rounded-btn p-2`,children:(0,V.jsx)(Mt,{className:`size-5 text-secondary`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-2xl font-bold font-mono`,children:n}),(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Max parallelism`})]})]})]})}function va({state:e,providers:t,parallelism:n,onRefresh:r,issues:i=[]}){let a=Array.isArray(e.issues)?e.issues:[],o=Number(e.config?.workerConcurrency)||2,s=a.filter(e=>e.state===`Running`||e.state===`In Review`),c=a.filter(e=>e.state===`Todo`||e.state===`Queued`||e.state===`Interrupted`||e.state===`Blocked`&&e.nextRetryAt),l=a.filter(e=>e.state===`Done`||e.state===`Cancelled`).sort((e,t)=>(t.completedAt||``).localeCompare(e.completedAt||``)).slice(0,10),u=(0,B.useMemo)(()=>{let e=new Date().toISOString().slice(0,10),t=0;for(let n of i)n.tokenUsage?.totalTokens&&(n.completedAt||n.updatedAt||``).slice(0,10)===e&&(t+=n.tokenUsage.totalTokens);return t},[i]),d=[];for(let e=0;e<o;e++)d.push(s[e]||null);return(0,V.jsxs)(`div`,{className:`space-y-5 min-w-0 overflow-hidden flex-1`,children:[(0,V.jsx)(_a,{running:s,queued:c,concurrency:o,totalTokensToday:u}),(0,V.jsxs)(`div`,{className:`space-y-3 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`h3`,{className:`font-semibold text-sm flex items-center gap-1.5`,children:[(0,V.jsx)(Tt,{className:`size-4 opacity-50`}),`Active Agents`]}),(0,V.jsxs)(`span`,{className:`text-xs opacity-50`,children:[s.length,`/`,o,` slots`]})]}),(0,V.jsx)(`div`,{className:`grid gap-3 min-w-0`,style:{gridTemplateColumns:`repeat(${Math.min(o,3)}, 1fr)`},children:d.map((e,t)=>(0,V.jsx)(ma,{index:t,issue:e,total:o},t))})]}),c.length>0&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,V.jsx)(Ut,{className:`size-4 opacity-50`}),`Queue`,(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:c.length})]}),(0,V.jsxs)(`div`,{className:`space-y-1 stagger-children`,children:[c.slice(0,12).map(e=>(0,V.jsx)(ha,{issue:e},e.id)),c.length>12&&(0,V.jsxs)(`div`,{className:`text-xs opacity-40 pl-3`,children:[`+`,c.length-12,` more`]})]})]}),l.length>0&&(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`h3`,{className:`font-semibold text-sm opacity-70 flex items-center gap-1.5`,children:[(0,V.jsx)(H,{className:`size-4 opacity-50`}),`Recently Completed`,(0,V.jsx)(`span`,{className:`badge badge-xs badge-ghost`,children:l.length})]}),(0,V.jsx)(`div`,{className:`space-y-1 stagger-children`,children:l.map(e=>(0,V.jsx)(ga,{issue:e},e.id))})]}),s.length===0&&c.length===0&&l.length===0&&(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-16 animate-fade-in-up`,children:[(0,V.jsx)(`div`,{className:`bg-primary/10 rounded-full p-5 mb-4`,children:(0,V.jsx)(Tt,{className:`size-10 text-primary opacity-60`})}),(0,V.jsx)(`h3`,{className:`text-base font-semibold mb-1`,children:`No agents running`}),(0,V.jsx)(`p`,{className:`text-sm opacity-50 text-center max-w-xs`,children:`Approve a plan on an issue to start an agent, or create a new issue from the Kanban board.`})]})]})}var ya=b(`/agents`)({component:ba});function ba(){let e=Xe();return(0,V.jsx)(`div`,{className:`flex-1 flex flex-col min-h-0 px-4 pb-4`,children:(0,V.jsx)(va,{state:e.data,providers:e.providers.data||{},parallelism:e.parallelism.data||{},onRefresh:e.refresh,issues:e.issues})})}var xa=b(`/`)({beforeLoad:()=>{throw te({to:`/kanban`})}}),Sa=b(`/settings/`)({beforeLoad:()=>{throw te({to:`/settings/general`})}}),Ca=[{key:`plan`,label:`Plan`,icon:W,description:`Generate the execution plan`,accent:`info`},{key:`execute`,label:`Execute`,icon:Zt,description:`Implement the changes`,accent:`primary`},{key:`review`,label:`Review`,icon:U,description:`Review the implementation`,accent:`secondary`}],wa=[{value:`low`,label:`Low`},{value:`medium`,label:`Medium`},{value:`high`,label:`High`},{value:`extra-high`,label:`Extra High`}],Ta={info:{border:`border-info/30`,bg:`bg-info/10`,text:`text-info`,step:`step-info`,badge:`badge-info`},primary:{border:`border-primary/30`,bg:`bg-primary/10`,text:`text-primary`,step:`step-primary`,badge:`badge-primary`},secondary:{border:`border-secondary/30`,bg:`bg-secondary/10`,text:`text-secondary`,step:`step-secondary`,badge:`badge-secondary`}};function Ea({stage:e,config:t,providers:n,modelsByProvider:r,onChange:i,isLast:a,saving:o}){let s=e.icon,c=r[t.provider]||[],l=(n||[]).filter(e=>e.available),u=Ta[e.accent];return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`card bg-base-200 border-l-4 ${u.border} animate-fade-in`,children:(0,V.jsxs)(`div`,{className:`card-body p-4 gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`flex items-center justify-center size-9 rounded-lg ${u.bg}`,children:(0,V.jsx)(s,{className:`size-4.5 ${u.text}`})}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-sm`,children:e.label}),(0,V.jsx)(`span`,{className:`badge badge-xs ${u.badge} badge-outline`,children:t.provider}),o===e.key&&(0,V.jsxs)(`span`,{className:`text-xs text-success flex items-center gap-1 animate-fade-in`,children:[(0,V.jsx)(dt,{className:`size-3`}),` saved`]})]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50`,children:e.description})]})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-2`,children:[(0,V.jsxs)(`label`,{className:`form-control`,children:[(0,V.jsx)(`div`,{className:`label py-0.5`,children:(0,V.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Provider`})}),(0,V.jsx)(`select`,{className:`select select-bordered select-sm w-full`,value:t.provider,onChange:e=>{let n=e.target.value,a=r[n]||[],o=n!==`codex`&&t.effort===`extra-high`?`high`:t.effort;i({...t,provider:n,model:a[0]?.id||n,effort:o})},children:l.map(e=>(0,V.jsx)(`option`,{value:e.name,children:e.name},e.name))})]}),(0,V.jsxs)(`label`,{className:`form-control`,children:[(0,V.jsx)(`div`,{className:`label py-0.5`,children:(0,V.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Model`})}),(0,V.jsxs)(`select`,{className:`select select-bordered select-sm w-full`,value:t.model,onChange:e=>i({...t,model:e.target.value}),children:[c.length===0&&(0,V.jsx)(`option`,{value:t.model,children:t.model||`(detecting...)`}),c.map(e=>(0,V.jsxs)(`option`,{value:e.id,children:[e.label,e.tier?` — ${e.tier}`:``]},e.id))]})]}),(0,V.jsxs)(`label`,{className:`form-control`,children:[(0,V.jsx)(`div`,{className:`label py-0.5`,children:(0,V.jsx)(`span`,{className:`label-text text-xs opacity-60`,children:`Effort`})}),(0,V.jsx)(`select`,{className:`select select-bordered select-sm w-full`,value:t.effort,onChange:e=>i({...t,effort:e.target.value}),children:wa.filter(e=>t.provider===`codex`||e.value!==`extra-high`).map(e=>(0,V.jsx)(`option`,{value:e.value,children:e.label},e.value))})]})]})]})}),!a&&(0,V.jsx)(`div`,{className:`flex justify-center py-0.5`,children:(0,V.jsx)($e,{className:`size-4 opacity-20`})})]})}var Da=b(`/settings/workflow`)({component:Oa});function Oa(){let e=w(),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)([]),[a,o]=(0,B.useState)({}),[s,c]=(0,B.useState)(!0),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),p=(0,B.useRef)(null),m=(0,B.useCallback)(t=>{e.setQueryData(ye,e=>we(e,{id:`runtime.workflowConfig`,scope:`runtime`,value:t,source:`user`,updatedAt:new Date().toISOString()})),e.setQueryData([`workflow-config`],{ok:!0,workflow:t,isDefault:!1})},[e]),h=(0,B.useCallback)(async()=>{c(!0);try{let e=await L.get(`/config/workflow?details=1`);n(e.workflow),i(e.providers||[]),o(e.models||{})}catch{}c(!1)},[]);(0,B.useEffect)(()=>{h()},[h]);let g=(0,B.useCallback)((e,t)=>{p.current&&clearTimeout(p.current),p.current=setTimeout(async()=>{try{await L.post(`/config/workflow`,{workflow:e}),m(e),u(t),setTimeout(()=>u(null),1500)}catch{}},600)},[m]),_=(0,B.useCallback)((e,t)=>{n(n=>{let r={...n,[e]:t};return g(r,e),r})},[g]),v=(0,B.useCallback)(async()=>{f(!0);try{let e=await L.get(`/config/workflow?details=1`),t=e.providers||[],r=e.models||{};i(t),o(r);let a=t.filter(e=>e.available),s=a.some(e=>e.name===`claude`),c=a.some(e=>e.name===`codex`),l=r.claude?.[0]?.id||`claude`,d=r.codex?.[0]?.id||`codex`,f={plan:{provider:s?`claude`:`codex`,model:s?l:d,effort:`high`},execute:{provider:c?`codex`:`claude`,model:c?d:l,effort:`medium`},review:{provider:s?`claude`:`codex`,model:s?l:d,effort:`medium`}};n(f),await L.post(`/config/workflow`,{workflow:f}),m(f),u(`all`),setTimeout(()=>u(null),1500)}catch{}f(!1)},[m]);return(0,B.useEffect)(()=>()=>{p.current&&clearTimeout(p.current)},[]),s||!t?(0,V.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,V.jsx)(G,{className:`size-6 animate-spin opacity-30`})}):(0,V.jsxs)(`div`,{className:`space-y-4 stagger-children`,children:[(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-center gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`h2`,{className:`text-sm font-semibold`,children:`Pipeline Workflow`}),(0,V.jsx)(`p`,{className:`text-xs opacity-50 mt-0.5`,children:`Changes are saved automatically.`})]}),(0,V.jsxs)(`button`,{className:`btn btn-ghost btn-sm gap-1 shrink-0`,onClick:v,disabled:d,children:[d?(0,V.jsx)(G,{className:`size-3 animate-spin`}):(0,V.jsx)(K,{className:`size-3`}),`Restore defaults`]})]}),(0,V.jsx)(`ul`,{className:`steps steps-horizontal w-full text-xs`,children:Ca.map(e=>{let t=Ta[e.accent];return(0,V.jsx)(`li`,{className:`step ${t.step}`,children:e.label},e.key)})}),(0,V.jsx)(`div`,{className:`flex flex-col`,children:Ca.map((e,n)=>(0,V.jsx)(Ea,{stage:e,config:t[e.key],providers:r,modelsByProvider:a,onChange:t=>_(e.key,t),isLast:n===Ca.length-1,saving:l===e.key||l===`all`?e.key:null},e.key))})]})}function ka(e){return!e||e===0?`0`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function Aa(e){if(!e)return``;let t=new Date(e),n=new Date,r=t.getTime()-n.getTime();if(r<=0)return`now`;let i=Math.floor(r/(1e3*60*60)),a=Math.floor(i/24);if(a>0)return`${a}d ${i%24}h`;let o=Math.floor(r/(1e3*60)%60);return i>0?`${i}h ${o}m`:`${o}m`}function ja({label:e,period:t,icon:n}){let r=t.inputTokens>0&&t.outputTokens>0;return(0,V.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-lg bg-base-100`,children:[(0,V.jsx)(`div`,{className:`p-2 rounded-lg bg-base-300`,children:(0,V.jsx)(n,{className:`size-4 opacity-70`})}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-60`,children:e}),(0,V.jsxs)(`div`,{className:`font-mono font-semibold text-sm`,children:[ka(t.tokensUsed),` tokens`]}),r&&(0,V.jsxs)(`div`,{className:`flex gap-3 mt-0.5`,children:[(0,V.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,V.jsx)($e,{className:`size-2.5`}),` `,ka(t.inputTokens)]}),(0,V.jsxs)(`span`,{className:`text-[10px] opacity-50 flex items-center gap-0.5`,children:[(0,V.jsx)(nt,{className:`size-2.5`}),` `,ka(t.outputTokens)]})]})]}),(0,V.jsxs)(`div`,{className:`text-right`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-60`,children:`sessions`}),(0,V.jsx)(`div`,{className:`font-mono text-sm`,children:t.sessions})]})]})}function Ma({percentUsed:e,weeklyLimit:t,weeklyUsed:n}){if(e==null)return null;let r=e>=90?`progress-error`:e>=70?`progress-warning`:`progress-primary`,i=Math.max(0,100-e);return(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex justify-between text-xs mb-1`,children:[(0,V.jsx)(`span`,{className:`opacity-60`,children:`Weekly quota`}),(0,V.jsxs)(`span`,{className:`font-mono`,children:[ka(n),` / `,ka(t)]})]}),(0,V.jsx)(`progress`,{className:`progress ${r} w-full progress-animated`,value:e,max:100}),(0,V.jsxs)(`div`,{className:`flex justify-between text-[10px] mt-1`,children:[(0,V.jsxs)(`span`,{className:`opacity-50`,children:[e,`% used`]}),(0,V.jsxs)(`span`,{className:`font-semibold ${i<=10?`text-error`:i<=30?`text-warning`:`text-success`}`,children:[i,`% available`]})]})]})}function Na({nextResetAt:e,resetInfo:t}){let n=Aa(e),r=e?new Date(e):null,i=r?r.toLocaleDateString(void 0,{weekday:`long`,month:`short`,day:`numeric`}):``;return(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-xs bg-base-100 rounded-lg px-3 py-2`,children:[(0,V.jsx)(lt,{className:`size-3.5 opacity-50 shrink-0`}),(0,V.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,V.jsx)(`div`,{className:`opacity-50`,children:t}),e&&(0,V.jsxs)(`div`,{className:`font-mono font-medium mt-0.5`,children:[`Resets in `,(0,V.jsx)(`span`,{className:`text-primary`,children:n}),(0,V.jsxs)(`span`,{className:`opacity-40`,children:[` — `,i]})]})]})]})}function Pa({models:e,currentModel:t}){let[n,r]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`space-y-1`,children:(n?e:e.slice(0,4)).map(e=>(0,V.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-lg text-sm ${e.slug===t?`bg-primary/10 border border-primary/30`:`bg-base-100`}`,children:[(0,V.jsx)(ht,{className:`size-3 ${e.slug===t?`text-primary`:`opacity-30`}`}),(0,V.jsx)(`span`,{className:`font-mono text-xs flex-1 truncate`,children:e.displayName||e.slug}),e.slug===t&&(0,V.jsx)(`span`,{className:`badge badge-xs badge-primary`,children:`active`})]},e.slug))}),e.length>4&&(0,V.jsxs)(`button`,{className:`btn btn-xs btn-ghost mt-1 w-full gap-1`,onClick:()=>r(!n),children:[n?(0,V.jsx)(pt,{className:`size-3`}):(0,V.jsx)(ft,{className:`size-3`}),n?`Show less`:`+${e.length-4} more`]})]})}function Fa({provider:e}){let{name:t,available:n,models:r,currentModel:i,usage:a,resetInfo:o,nextResetAt:s,weeklyLimitEstimate:c,percentUsed:l}=e;return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Tt,{className:`size-5 ${t===`claude`?`text-warning`:`text-info`}`}),(0,V.jsx)(`h3`,{className:`card-title text-sm`,children:t===`claude`?`Claude Code`:t===`codex`?`Codex CLI`:t})]}),(0,V.jsx)(`span`,{className:`badge badge-sm ${n?`badge-success`:`badge-error`}`,children:n?`available`:`not found`})]}),i&&(0,V.jsxs)(`div`,{className:`text-xs opacity-60`,children:[`Active model: `,(0,V.jsx)(`span`,{className:`font-mono font-medium opacity-100`,children:i})]}),(0,V.jsx)(Ma,{percentUsed:l,weeklyLimit:c,weeklyUsed:a.thisWeek.tokensUsed}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50`,children:`Token usage`}),(0,V.jsx)(ja,{label:`Today`,period:a.today,icon:I}),(0,V.jsx)(ja,{label:`This week`,period:a.thisWeek,icon:It}),(0,V.jsx)(ja,{label:`All time`,period:a.allTime,icon:xt})]}),(0,V.jsx)(Na,{nextResetAt:s,resetInfo:o}),r.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wide opacity-50 mb-2`,children:[`Available Models (`,r.length,`)`]}),(0,V.jsx)(Pa,{models:r,currentModel:i})]})]})})}function Ia({providersUsage:e}){let t=e?.data,n=t?.providers||[];return e?.isLoading&&!t?(0,V.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[...[,,]].map((e,t)=>(0,V.jsx)(`div`,{className:`skeleton-card h-72`,style:{animationDelay:`${t*100}ms`}},t))}):n.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 gap-2 opacity-50 animate-fade-in-up`,children:[(0,V.jsx)(Tt,{className:`size-8`}),(0,V.jsx)(`p`,{className:`text-sm`,children:`No providers detected`})]}):(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`div`,{className:`grid gap-4 md:grid-cols-2 stagger-children`,children:n.map(e=>(0,V.jsx)(Fa,{provider:e},e.name))}),t?.collectedAt&&(0,V.jsxs)(`p`,{className:`text-xs opacity-40 text-center`,children:[`Last collected: `,new Date(t.collectedAt).toLocaleTimeString()]})]})}var La=b(`/settings/providers`)({component:Ra});function Ra(){return(0,V.jsx)(Ia,{providersUsage:Xe().providersUsage})}var za=(0,B.lazy)(()=>Wr(()=>import(`./OnboardingWizard-G9YyAfeX.js`),__vite__mapDeps([4,1,5,2,3]))),Ba=[`auto`,`light`,`dark`],Va=`cupcake.bumblebee.emerald.corporate.synthwave.retro.cyberpunk.valentine.halloween.garden.forest.aqua.lofi.pastel.fantasy.wireframe.black.luxury.dracula.cmyk.autumn.business.acid.lemonade.night.coffee.winter.dim.nord.sunset.caramellatte.abyss.silk`.split(`.`),Ha=[...Ba,...Va];function Ua(e){return e===`auto`?window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:e}function Wa({theme:e,onThemeChange:t}){let n=Ua(e),r=[`dark`,`night`,`sunset`,`black`,`synthwave`,`halloween`,`forest`,`luxury`,`dracula`,`business`,`coffee`,`dim`,`abyss`].includes(n);return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(Yt,{className:`size-4 opacity-50`}),`Theme`]}),(0,V.jsxs)(`p`,{className:`text-xs opacity-50`,children:[`Current: `,(0,V.jsx)(`span`,{className:`font-semibold`,children:e}),e===`auto`&&(0,V.jsxs)(`span`,{children:[` (resolved to `,n,`)`]}),r?(0,V.jsx)(qt,{className:`inline size-3 ml-1`}):(0,V.jsx)(un,{className:`inline size-3 ml-1`})]}),(0,V.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:Ha.map(n=>(0,V.jsx)(`button`,{className:`btn btn-sm ${e===n?`btn-primary`:`btn-soft`}`,onClick:()=>t(n),children:n.charAt(0).toUpperCase()+n.slice(1)},n))})]})})}function Ga({concurrency:e,setConcurrency:t,saveConcurrency:n,savePending:r}){return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(Tt,{className:`size-4 opacity-50`}),`Worker Concurrency`]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50`,children:`Number of parallel workers executing issues simultaneously (1–16).`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`input`,{className:`input input-bordered input-sm w-20`,type:`number`,min:1,max:16,value:e,onChange:e=>t(e.target.value)}),(0,V.jsx)(`button`,{className:`btn btn-sm btn-primary`,onClick:n,disabled:r,children:r?(0,V.jsx)(`span`,{className:`loading loading-spinner loading-xs`}):`Save`})]})]})})}function Ka({status:e,wsStatus:t}){let n=e===`ok`,r=t===`connected`,i=n?`text-success`:`text-warning`,a=n?`Connected`:e===`offline`?`Offline`:`Degraded`,o={connected:`text-success`,connecting:`text-info`,disconnected:`text-warning`,error:`text-error`}[t]||`text-warning`,s=t.charAt(0).toUpperCase()+t.slice(1);return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)($t,{className:`size-4 opacity-50`}),`Connection Status`]}),(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,V.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[n&&(0,V.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),(0,V.jsx)(ht,{className:`size-5 ${i} relative`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:`API`}),(0,V.jsx)(`div`,{className:`text-xs ${i}`,children:a})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3 p-3 rounded-box bg-base-300`,children:[(0,V.jsxs)(`span`,{className:`relative flex size-5 items-center justify-center`,children:[r&&(0,V.jsx)(`span`,{className:`animate-ping absolute inline-flex size-3 rounded-full bg-success opacity-30`}),r?(0,V.jsx)(bn,{className:`size-5 ${o} relative`}):(0,V.jsx)(yn,{className:`size-5 ${o} relative`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-sm font-medium`,children:`WebSocket`}),(0,V.jsx)(`div`,{className:`text-xs ${o}`,children:s})]})]})]})]})})}function qa({pwa:e}){let t=e?.isInstalled?`Installed`:e?.canInstall?`Installable`:`Browser-managed`;return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(on,{className:`size-4 opacity-50`}),`Progressive Web App`]}),(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,V.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Service worker`}),(0,V.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:e?.serviceWorkerSupported?`Supported`:`Unavailable`})]}),(0,V.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Install status`}),(0,V.jsx)(`div`,{className:`text-sm font-medium mt-1`,children:t})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:()=>e.installApp(),disabled:!e?.canInstall,children:[(0,V.jsx)(Et,{className:`size-3.5`}),` Install`]}),(0,V.jsxs)(`button`,{className:`btn btn-sm btn-soft gap-1`,onClick:()=>e.applyUpdate(),disabled:!e?.updateAvailable,children:[(0,V.jsx)(en,{className:`size-3.5`}),` Apply update`]})]})]})})}function Ja({notifications:e}){if(!e?.supported)return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(it,{className:`size-4 opacity-50`}),`Notifications`]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50`,children:`Desktop notifications are not supported in this browser.`})]})});let t=e.permission===`denied`,n=e.permission===`granted`;return(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(at,{className:`size-4 opacity-50`}),`Desktop Notifications`]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50`,children:`Get notified when issues change state — reviews needed, agents blocked, work completed.`}),(0,V.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,V.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Permission`}),(0,V.jsx)(`div`,{className:`text-sm font-medium mt-1 ${n?`text-success`:t?`text-error`:`text-warning`}`,children:e.permission===`default`?`Not asked yet`:e.permission})]}),(0,V.jsxs)(`div`,{className:`rounded-box bg-base-300 p-3`,children:[(0,V.jsx)(`div`,{className:`text-xs opacity-50`,children:`Status`}),(0,V.jsx)(`div`,{className:`text-sm font-medium mt-1 ${e.enabled?`text-success`:``}`,children:e.enabled?`Enabled`:`Disabled`})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[!n&&!t&&(0,V.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1`,onClick:e.requestPermission,children:[(0,V.jsx)(at,{className:`size-3.5`}),` Enable notifications`]}),n&&(0,V.jsxs)(`label`,{className:`label cursor-pointer gap-2`,children:[(0,V.jsx)(`span`,{className:`text-sm`,children:`Notify on state changes`}),(0,V.jsx)(`input`,{type:`checkbox`,className:`toggle toggle-sm toggle-primary`,checked:e.enabled,onChange:t=>e.setEnabled(t.target.checked)})]}),t&&(0,V.jsx)(`p`,{className:`text-xs text-error`,children:`Notifications were denied. Reset permission in your browser settings to re-enable.`}),n&&e.enabled&&(0,V.jsx)(`button`,{className:`btn btn-xs btn-ghost`,onClick:()=>new Notification(`Fifony`,{body:`Notifications are working!`,icon:`/icon.svg`}),children:`Send test`})]})]})})}function Ya(){let[e,t]=(0,B.useState)(!1),n=w();return e?(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`loading loading-spinner loading-lg`})}),children:(0,V.jsx)(za,{onComplete:()=>{t(!1),n.invalidateQueries({queryKey:ye})}})}):(0,V.jsx)(`div`,{className:`card bg-base-200`,children:(0,V.jsxs)(`div`,{className:`card-body gap-4 p-6`,children:[(0,V.jsxs)(`h3`,{className:`card-title text-sm flex items-center gap-2`,children:[(0,V.jsx)(vn,{className:`size-4 opacity-50`}),`Setup Wizard`]}),(0,V.jsx)(`p`,{className:`text-xs opacity-50`,children:`Re-run the initial setup wizard to reconfigure providers, effort level, concurrency, and theme.`}),(0,V.jsxs)(`button`,{className:`btn btn-sm btn-primary gap-1 w-fit`,onClick:async()=>{try{await L.post(`/settings/ui.onboarding.completed`,{scope:`ui`,value:!1,source:`user`}),n.setQueryData(ye,e=>we(e,{id:`ui.onboarding.completed`,scope:`ui`,value:!1,source:`user`,updatedAt:new Date().toISOString()}))}catch{}t(!0)},children:[(0,V.jsx)(vn,{className:`size-3.5`}),` Re-run Setup Wizard`]})]})})}var Xa=b(`/settings/notifications`)({component:Za});function Za(){return(0,V.jsx)(`div`,{className:`space-y-5`,children:(0,V.jsx)(Ja,{notifications:Xe().notifications})})}var Qa=b(`/settings/general`)({component:$a});function $a(){let e=Xe();return(0,V.jsxs)(`div`,{className:`space-y-5`,children:[(0,V.jsx)(Ka,{status:e.status,wsStatus:e.wsStatus}),(0,V.jsx)(Ga,{concurrency:e.concurrency,setConcurrency:e.setConcurrency,saveConcurrency:e.saveConcurrency,savePending:e.saveConcPending}),(0,V.jsx)(qa,{pwa:e.pwa}),(0,V.jsx)(Ya,{}),(0,V.jsx)(Wa,{theme:e.theme,onThemeChange:e.setTheme})]})}var eo=$r.update({id:`/settings`,path:`/settings`,getParentRoute:()=>Z}),to=ri.update({id:`/onboarding`,path:`/onboarding`,getParentRoute:()=>Z}),no=Hi.update({id:`/kanban`,path:`/kanban`,getParentRoute:()=>Z}),ro=ea.update({id:`/issues`,path:`/issues`,getParentRoute:()=>Z}),io=sa.update({id:`/discover`,path:`/discover`,getParentRoute:()=>Z}),ao=la.update({id:`/analytics`,path:`/analytics`,getParentRoute:()=>Z}).lazy(()=>Wr(()=>import(`./analytics.lazy-_g7IhcIB.js`).then(e=>e.Route),__vite__mapDeps([6,1,5,2,3]))),oo=ya.update({id:`/agents`,path:`/agents`,getParentRoute:()=>Z}),so=xa.update({id:`/`,path:`/`,getParentRoute:()=>Z}),co=Sa.update({id:`/`,path:`/`,getParentRoute:()=>eo}),lo=Da.update({id:`/workflow`,path:`/workflow`,getParentRoute:()=>eo}),uo=La.update({id:`/providers`,path:`/providers`,getParentRoute:()=>eo}),fo=Xa.update({id:`/notifications`,path:`/notifications`,getParentRoute:()=>eo}),po={SettingsGeneralRoute:Qa.update({id:`/general`,path:`/general`,getParentRoute:()=>eo}),SettingsNotificationsRoute:fo,SettingsProvidersRoute:uo,SettingsWorkflowRoute:lo,SettingsIndexRoute:co},mo={IndexRoute:so,AgentsRoute:oo,AnalyticsRoute:ao,DiscoverRoute:io,IssuesRoute:ro,KanbanRoute:no,OnboardingRoute:to,SettingsRoute:eo._addFileChildren(po)},ho=Z._addFileChildren(mo)._addFileTypes();window.__fifonyInstallPrompt=null,window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),window.__fifonyInstallPrompt=e});var go=new Ne({defaultOptions:{queries:{staleTime:2e3,retry:1,refetchOnWindowFocus:!1}}}),_o=T({routeTree:ho,basepath:`/`,defaultPreload:`intent`});(0,Pe.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(B.StrictMode,{children:(0,V.jsx)(ee,{client:go,children:(0,V.jsx)(k,{router:_o})})})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/service-worker.js`,{scope:`/`}).catch(()=>{})});export{Qe as C,st as S,Tt as _,_n as a,H as b,nn as c,G as d,Vt as f,U as g,Ot as h,J as i,Yt as l,Mt as m,Br as n,gn as o,Nt as p,Rr as r,sn as s,oa as t,Jt as u,xt as v,dt as x,vt as y};
@@ -13,7 +13,7 @@
13
13
  <link rel="manifest" href="/assets/manifest.webmanifest" />
14
14
  <link rel="icon" href="/assets/icon.svg" type="image/svg+xml" />
15
15
  <link rel="apple-touch-icon" href="/assets/icon.svg" />
16
- <script type="module" crossorigin src="/assets/assets/index-BRWIoM5k.js"></script>
16
+ <script type="module" crossorigin src="/assets/assets/index-CRG9kNAx.js"></script>
17
17
  <link rel="modulepreload" crossorigin href="/assets/assets/rolldown-runtime-DF2fYuay.js">
18
18
  <link rel="modulepreload" crossorigin href="/assets/assets/vendor-BoGBoEwT.js">
19
19
  <link rel="modulepreload" crossorigin href="/assets/assets/createLucideIcon-DtZs0TX0.js">
@@ -1,4 +1,4 @@
1
- const CACHE_VERSION = "1773791661163";
1
+ const CACHE_VERSION = "1773792388112";
2
2
  const CORE_CACHE = `fifony-core-${CACHE_VERSION}`;
3
3
  const ASSET_CACHE = `fifony-assets-${CACHE_VERSION}`;
4
4
  const APP_SHELL_ROUTES = ["/kanban", "/issues", "/agents", "/settings", "/onboarding"];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fifony",
3
- "version": "0.1.16",
3
+ "version": "0.1.17",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Filesystem-backed local Fifony orchestrator with a TypeScript CLI, MCP mode, and multi-agent Codex or Claude workflows.",