loki-mode 7.5.28 → 7.5.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/SKILL.md +2 -2
  2. package/VERSION +1 -1
  3. package/autonomy/loki +3 -3
  4. package/dashboard/__init__.py +1 -1
  5. package/docs/INSTALLATION.md +1 -1
  6. package/docs/MERGE-DEDUP-MAP.md +420 -0
  7. package/docs/MERGE-ROUTE-MAP.md +139 -0
  8. package/docs/MERGE3-PLAN.md +119 -0
  9. package/loki-ts/dist/loki.js +2 -2
  10. package/mcp/__init__.py +1 -1
  11. package/package.json +2 -2
  12. package/web-app/dist/assets/{AdminPage-DwVUK4v9.js → AdminPage-CKUOsWZW.js} +3 -3
  13. package/web-app/dist/assets/{Avatar-B7gqhcg3.js → Avatar-CL9Id9Hi.js} +1 -1
  14. package/web-app/dist/assets/{Badge-DA3xNJAS.js → Badge-B12zwlD7.js} +1 -1
  15. package/web-app/dist/assets/{Button-BPXURLaK.js → Button-CFLVoduT.js} +1 -1
  16. package/web-app/dist/assets/{ComparePage-B0JQMhKG.js → ComparePage-Dg0UdZAk.js} +1 -1
  17. package/web-app/dist/assets/{GitHubIssuesPanel-D38-fy29.js → GitHubIssuesPanel-CSitxtAX.js} +2 -2
  18. package/web-app/dist/assets/{GitHubPRsPanel-DLPcW3N0.js → GitHubPRsPanel-BIT06FRo.js} +1 -1
  19. package/web-app/dist/assets/HomePage-pU_0fGny.js +28 -0
  20. package/web-app/dist/assets/{LoginPage-DqCzxsfx.js → LoginPage-DTZtt2Yb.js} +1 -1
  21. package/web-app/dist/assets/MagicPage-10zfra8o.js +31 -0
  22. package/web-app/dist/assets/{MetricsPage-CPYQR0zr.js → MetricsPage-C-wiKUkv.js} +1 -1
  23. package/web-app/dist/assets/NotFoundPage-BDkcmhYe.js +1 -0
  24. package/web-app/dist/assets/{ProjectPage-DNujSl6j.js → ProjectPage-CiCavQ8n.js} +71 -71
  25. package/web-app/dist/assets/ProjectsPage-BLCXQwwC.js +6 -0
  26. package/web-app/dist/assets/{SettingsPage-BaQJbOgL.js → SettingsPage-PkxtaMyg.js} +3 -3
  27. package/web-app/dist/assets/{ShowcasePage-DQR_e-kg.js → ShowcasePage-iECp8Tha.js} +1 -1
  28. package/web-app/dist/assets/SystemSettingsPage-DS6Anno1.js +6 -0
  29. package/web-app/dist/assets/{TeamsPage-DOFErDqX.js → TeamsPage-ls6h6bNL.js} +1 -1
  30. package/web-app/dist/assets/{TemplatesPage-Ty72hILN.js → TemplatesPage-Bk0QzlPt.js} +3 -3
  31. package/web-app/dist/assets/{TerminalOutput-DqOVnR1p.js → TerminalOutput-4-1hWCtZ.js} +1 -1
  32. package/web-app/dist/assets/{activity-BgBZ4s4c.js → activity-DH3ih2nS.js} +1 -1
  33. package/web-app/dist/assets/{bell-C-UezVWi.js → bell-Gn17S6uv.js} +1 -1
  34. package/web-app/dist/assets/{bot-D70fEnm5.js → bot-Cbycc3VE.js} +1 -1
  35. package/web-app/dist/assets/{check-CBohulxQ.js → check-nIAqa-kf.js} +1 -1
  36. package/web-app/dist/assets/{chevron-left-C-emzUhB.js → chevron-left-D2jcWDll.js} +1 -1
  37. package/web-app/dist/assets/{circle-alert-8SRY0_GX.js → circle-alert-CpL4Bhvt.js} +1 -1
  38. package/web-app/dist/assets/{clock-mfq4XnPQ.js → clock-IW4Wq86N.js} +1 -1
  39. package/web-app/dist/assets/{cloud-DpRM7T8t.js → cloud-Cn8nNuH2.js} +1 -1
  40. package/web-app/dist/assets/{code-xml-1N2Ui-4c.js → code-xml-BiJBteXf.js} +1 -1
  41. package/web-app/dist/assets/{copy-LXquTgzI.js → copy-CnqkyNsi.js} +1 -1
  42. package/web-app/dist/assets/{database-S1dyXnuT.js → database-CKSReqa5.js} +1 -1
  43. package/web-app/dist/assets/{dollar-sign-CRqk0dW5.js → dollar-sign-CDzDY64R.js} +1 -1
  44. package/web-app/dist/assets/{file-code-corner-B99CwY_6.js → file-code-corner-Box4IwG1.js} +1 -1
  45. package/web-app/dist/assets/{file-plus-DZ5qnz5b.js → file-plus-DpGqlXF8.js} +1 -1
  46. package/web-app/dist/assets/{folder-open-DBCm7yuF.js → folder-open-B57dAoBv.js} +1 -1
  47. package/web-app/dist/assets/{git-commit-horizontal-DM1ERuNd.js → git-commit-horizontal-BVbucmO5.js} +1 -1
  48. package/web-app/dist/assets/{globe-B7xEJSL_.js → globe-BkOnKl4x.js} +1 -1
  49. package/web-app/dist/assets/{hammer-Cgi3LTuS.js → hammer-DRbIQ4QU.js} +1 -1
  50. package/web-app/dist/assets/{index-BN52-GQT.js → index-CM_b_EhP.js} +77 -77
  51. package/web-app/dist/assets/{layers-Bi8RPIBC.js → layers-B78BiFiU.js} +1 -1
  52. package/web-app/dist/assets/{lightbulb-Doc_n8JX.js → lightbulb-B-Itbm9g.js} +1 -1
  53. package/web-app/dist/assets/{loader-circle-BB932A7A.js → loader-circle-Oq6NQhW2.js} +1 -1
  54. package/web-app/dist/assets/{lock-Bt6gpMrs.js → lock-DbJ9zxbw.js} +1 -1
  55. package/web-app/dist/assets/{mail-BuzAu1IP.js → mail-CzMRod6m.js} +1 -1
  56. package/web-app/dist/assets/{package-BE5FHxQ8.js → package-WZ5osvej.js} +1 -1
  57. package/web-app/dist/assets/{plus-CNqABexN.js → plus-j08lFR-K.js} +1 -1
  58. package/web-app/dist/assets/{refresh-cw-34B13ztx.js → refresh-cw-CIr7E-g2.js} +1 -1
  59. package/web-app/dist/assets/{rotate-ccw-CrD2QB29.js → rotate-ccw-gwoXxDeE.js} +1 -1
  60. package/web-app/dist/assets/{save-DsJcqdnI.js → save-B8fV_ZpE.js} +1 -1
  61. package/web-app/dist/assets/{server-BcgRMArA.js → server-D5dO1paz.js} +1 -1
  62. package/web-app/dist/assets/{shield-alert-DLYLdVJ0.js → shield-alert-Du08zhdg.js} +1 -1
  63. package/web-app/dist/assets/{trash-2-Cc-VTvzt.js → trash-2-DEKSVae5.js} +1 -1
  64. package/web-app/dist/assets/{trending-down-CrDpO2a_.js → trending-down-DBiXUtxJ.js} +1 -1
  65. package/web-app/dist/assets/{trending-up-CNVsmM3G.js → trending-up-BgmK_tHq.js} +1 -1
  66. package/web-app/dist/assets/{upload-LuDuB7Wc.js → upload-IaViyeVD.js} +1 -1
  67. package/web-app/dist/assets/{usePolling-C8rvc-CG.js → usePolling-PiRLqNu6.js} +1 -1
  68. package/web-app/dist/assets/{user-BT79cI-o.js → user-BB5J8wAF.js} +1 -1
  69. package/web-app/dist/index.html +2 -3
  70. package/web-app/server.py +45 -7
  71. package/web-app/dist/assets/HomePage-CzeoS2V_.js +0 -28
  72. package/web-app/dist/assets/MagicPage-CBLqpa55.js +0 -31
  73. package/web-app/dist/assets/NotFoundPage-B62u4iCs.js +0 -1
  74. package/web-app/dist/assets/ProjectsPage-uHG7kxB-.js +0 -6
  75. package/web-app/dist/assets/SystemSettingsPage-C_Q_1WK4.js +0 -6
@@ -1,6 +0,0 @@
1
- import{c as $,j as e,r as u,w as D,g as P,h as R,u as z,a as E,m as L,k as M,E as A}from"./index-BN52-GQT.js";import{B as C}from"./Button-BPXURLaK.js";import{B as _}from"./Badge-DA3xNJAS.js";import{L as U}from"./lightbulb-Doc_n8JX.js";import{T as I}from"./trending-up-CNVsmM3G.js";import{T as H,M as O}from"./trending-down-CrDpO2a_.js";import{u as Y}from"./usePolling-C8rvc-CG.js";import{R as q}from"./refresh-cw-34B13ztx.js";import{P as S}from"./plus-CNqABexN.js";import{F as G}from"./folder-open-DBCm7yuF.js";import{C as K}from"./copy-LXquTgzI.js";import{T as Q}from"./trash-2-Cc-VTvzt.js";import"./clock-mfq4XnPQ.js";import"./circle-alert-8SRY0_GX.js";import"./check-CBohulxQ.js";/**
2
- * @license lucide-react v0.577.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const V=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],W=$("ellipsis-vertical",V),X={none:"p-0",sm:"p-3",md:"p-4",lg:"p-6"};function J({hover:t=!1,padding:r="md",className:n="",children:a,onClick:d}){return e.jsx("div",{role:d?"button":void 0,tabIndex:d?0:void 0,onClick:d,onKeyDown:d?l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),d())}:void 0,className:["bg-white border border-[#ECEAE3] rounded-[5px] shadow-card group",t&&"hover:shadow-card-hover transition-shadow duration-200",d&&"cursor-pointer",X[r],n].filter(Boolean).join(" "),children:a})}const y={"A+":{color:"text-success",bg:"bg-success/10",border:"border-success/20"},A:{color:"text-success",bg:"bg-success/10",border:"border-success/20"},"A-":{color:"text-success",bg:"bg-success/8",border:"border-success/15"},"B+":{color:"text-teal",bg:"bg-teal/10",border:"border-teal/20"},B:{color:"text-teal",bg:"bg-teal/8",border:"border-teal/15"},"B-":{color:"text-info",bg:"bg-info/8",border:"border-info/15"},"C+":{color:"text-warning",bg:"bg-warning/10",border:"border-warning/20"},C:{color:"text-warning",bg:"bg-warning/8",border:"border-warning/15"},"C-":{color:"text-warning",bg:"bg-warning/8",border:"border-warning/15"},D:{color:"text-danger",bg:"bg-danger/10",border:"border-danger/20"},F:{color:"text-danger",bg:"bg-danger/15",border:"border-danger/25"}};function Z(t){const r=[],n=[],a=Math.min(t.testCoverage,100);r.push({label:"Test Coverage",score:a,weight:.3,description:`${Math.round(a)}% of code covered`}),a<60&&n.push(`Add tests to increase coverage from ${Math.round(a)}% to 80%+`);const d=t.lintErrors===0?100:Math.max(0,100-t.lintErrors*5);r.push({label:"Code Quality",score:d,weight:.25,description:t.lintErrors===0?"No lint errors":`${t.lintErrors} lint error${t.lintErrors!==1?"s":""} found`}),t.lintErrors>0&&n.push(`Fix ${t.lintErrors} lint error${t.lintErrors!==1?"s":""} to improve code quality`);const l=Math.round(t.buildSuccessRate*100);r.push({label:"Build Reliability",score:l,weight:.25,description:`${l}% of recent builds succeeded`}),l<80&&n.push("Investigate build failures to improve reliability");const m=Math.max(0,100-t.codeComplexity);r.push({label:"Simplicity",score:m,weight:.2,description:m>=70?"Code is well-structured":"Some files could benefit from refactoring"}),m<50&&n.push("Refactor complex files to reduce cognitive load");const i=Math.round(r.reduce((o,x)=>o+x.score*x.weight,0));let s;if(i>=95?s="A+":i>=90?s="A":i>=85?s="A-":i>=80?s="B+":i>=75?s="B":i>=70?s="B-":i>=65?s="C+":i>=60?s="C":i>=55?s="C-":i>=40?s="D":s="F",n.length===0&&i<95){const o=r.reduce((x,f)=>f.score<x.score?f:x,r[0]);n.push(`Improve ${o.label.toLowerCase()} to reach the next grade`)}return{score:i,grade:s,factors:r,recommendations:n}}function ee({history:t}){if(t.length<2)return null;const r=t[t.length-1].score,n=t[t.length-2].score,a=r-n;return a>2?e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-success text-[11px] font-medium",children:[e.jsx(I,{size:11})," +",a]}):a<-2?e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-danger text-[11px] font-medium",children:[e.jsx(H,{size:11})," ",a]}):e.jsxs("span",{className:"inline-flex items-center gap-0.5 text-muted text-[11px]",children:[e.jsx(O,{size:11})," Stable"]})}function te({history:t}){if(t.length===0)return null;const r=100;return 100/t.length,e.jsx("div",{className:"flex items-end gap-0.5 h-8",children:t.map((n,a)=>{const d=n.score/r*100,l=y[n.grade]||y.C;return e.jsx("div",{className:`flex-1 rounded-t-sm transition-all duration-300 ${l.bg}`,style:{height:`${d}%`,minWidth:"4px"},title:`Build #${n.buildNumber}: ${n.grade} (${n.score})`},a)})})}function se(t){const[r,n]=u.useState(!1),{score:a,grade:d,factors:l,recommendations:m}=Z(t),i=y[d]||y.C,s=t.history||[];return t.badge?e.jsxs("div",{className:`inline-flex items-center gap-1.5 px-2.5 py-1 rounded-pill border text-xs font-bold ${i.color} ${i.bg} ${i.border}`,children:[e.jsx(D,{size:12}),d]}):e.jsxs("div",{className:"card overflow-hidden",children:[e.jsxs("button",{onClick:()=>n(!r),className:"w-full flex items-center justify-between px-4 py-3 hover:bg-hover/30 transition-colors",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:`flex items-center justify-center w-10 h-10 rounded-lg ${i.bg} ${i.border} border`,children:e.jsx("span",{className:`text-lg font-bold font-mono ${i.color}`,children:d})}),e.jsxs("div",{className:"text-left",children:[e.jsx("h3",{className:"text-sm font-semibold text-ink",children:"Project Health"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-xs text-muted font-mono",children:[a,"/100"]}),s.length>=2&&e.jsx(ee,{history:s})]})]})]}),e.jsx("span",{className:"text-muted",children:r?e.jsx(P,{size:16}):e.jsx(R,{size:16})})]}),r&&e.jsxs("div",{className:"px-4 pb-4 space-y-4",children:[e.jsx("div",{className:"space-y-3",children:l.map(o=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-1",children:[e.jsx("span",{className:"text-xs font-medium text-secondary",children:o.label}),e.jsxs("span",{className:`text-xs font-mono font-semibold ${o.score>=80?"text-success":o.score>=60?"text-warning":"text-danger"}`,children:[Math.round(o.score),"%"]})]}),e.jsx("div",{className:"w-full h-1.5 bg-border rounded-full overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full transition-all duration-700 ease-out ${o.score>=80?"bg-success":o.score>=60?"bg-warning":"bg-danger"}`,style:{width:`${Math.min(o.score,100)}%`}})}),e.jsx("p",{className:"text-[11px] text-muted mt-0.5",children:o.description})]},o.label))}),s.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[11px] font-semibold text-muted uppercase tracking-wider mb-2",children:"Recent Builds"}),e.jsx(te,{history:s})]}),m.length>0&&e.jsxs("div",{className:"bg-primary/5 border border-primary/10 rounded-card p-3",children:[e.jsxs("div",{className:"flex items-center gap-1.5 mb-2",children:[e.jsx(U,{size:12,className:"text-primary"}),e.jsx("span",{className:"text-[11px] font-semibold text-primary uppercase tracking-wider",children:"Recommendations"})]}),e.jsx("ul",{className:"space-y-1",children:m.map((o,x)=>e.jsxs("li",{className:"text-xs text-secondary flex items-start gap-1.5",children:[e.jsx("span",{className:"text-primary mt-0.5 flex-shrink-0",children:"--"}),o]},x))})]})]})]})}function re({onRefresh:t,threshold:r=80,enabled:n=!0}){const a=u.useRef(null),[d,l]=u.useState(!1),[m,i]=u.useState(!1),[s,o]=u.useState(0),x=u.useRef(0),f=u.useRef(!1),g=u.useCallback(p=>{if(!n||m)return;const h=a.current;h&&h.scrollTop<=0&&(x.current=p.touches[0].clientY,f.current=!0)},[n,m]),b=u.useCallback(p=>{if(!n||!f.current||m)return;const h=p.touches[0].clientY-x.current;if(h>0){const v=Math.min(h*.5,120);o(v),l(!0)}else f.current=!1,l(!1),o(0)},[n,m]),j=u.useCallback(async()=>{if(!(!n||!f.current))if(f.current=!1,s>=r){i(!0),o(0),l(!1);try{await t()}finally{i(!1)}}else o(0),l(!1)},[n,s,r,t]);return u.useEffect(()=>{const p=a.current;if(!(!p||!n))return p.addEventListener("touchstart",g,{passive:!0}),p.addEventListener("touchmove",b,{passive:!0}),p.addEventListener("touchend",j,{passive:!0}),()=>{p.removeEventListener("touchstart",g),p.removeEventListener("touchmove",b),p.removeEventListener("touchend",j)}},[n,g,b,j]),{ref:a,pulling:d,refreshing:m,pullDistance:s}}function ne(t){const r=k(t);return r==="completed"?"completed":r==="running"?"running":r==="failed"?"failed":r==="started"?"started":"empty"}const le={completed:"Completed",complete:"Completed",done:"Completed",completion_promise_fulfilled:"Completed",running:"Running",in_progress:"Running",planning:"Planning",started:"Started",error:"Failed",failed:"Failed",empty:"Empty"};function k(t){return{completion_promise_fulfilled:"completed",complete:"completed",done:"completed",in_progress:"running",planning:"running",error:"failed"}[t]||t}const ie=[{key:"all",label:"All"},{key:"running",label:"Running"},{key:"completed",label:"Completed"},{key:"failed",label:"Failed"}];function we(){const t=z(),[r,n]=u.useState(""),[a,d]=u.useState("all"),[l,m]=u.useState(null),[i,s]=u.useState(!1),[o,x]=u.useState(null),f=u.useCallback(()=>E.getSessionsHistory(),[]),{data:g,refresh:b}=Y(f,15e3,!0),{ref:j,pulling:p,refreshing:h,pullDistance:v}=re({onRefresh:async()=>{b()},enabled:!0}),w=u.useMemo(()=>{if(!g)return[];let c=g;if(a!=="all"&&(c=c.filter(N=>N.status===a)),r.trim()){const N=r.trim().toLowerCase();c=c.filter(T=>T.prd_snippet.toLowerCase().includes(N))}return c},[g,a,r]),B=c=>{navigator.clipboard.writeText(c),x("Path copied"),setTimeout(()=>x(null),2e3)},F=async()=>{if(l){s(!0);try{await E.deleteSession(l.id),m(null),x("Project deleted"),setTimeout(()=>x(null),3e3),b()}catch(c){x(`Delete failed: ${c instanceof Error?c.message:"Unknown error"}`),setTimeout(()=>x(null),5e3)}finally{s(!1)}}};return e.jsxs("div",{ref:j,className:"max-w-[1400px] mx-auto px-6 max-md:px-4 py-8 overflow-auto h-full",children:[(p||h)&&e.jsx("div",{className:"flex items-center justify-center py-3",children:h?e.jsx("div",{className:"ptr-spinner"}):e.jsx(q,{size:20,className:"text-[#553DE9] transition-transform",style:{transform:`rotate(${Math.min(v*3,360)}deg)`,opacity:Math.min(v/80,1)}})}),e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsx("h1",{className:"font-heading text-h1 max-md:text-h2 text-[#36342E]",children:"Projects"}),e.jsx(C,{icon:S,onClick:()=>t("/"),children:"New Project"})]}),e.jsxs("div",{className:"flex items-center max-md:flex-col gap-4 max-md:gap-3 mb-6",children:[e.jsxs("div",{className:"relative flex-1 max-w-sm",children:[e.jsx(L,{size:16,className:"absolute left-3 top-1/2 -translate-y-1/2 text-[#6B6960]"}),e.jsx("input",{type:"text",placeholder:"Search projects...","aria-label":"Search projects",value:r,onChange:c=>n(c.target.value),className:"w-full pl-9 pr-3 py-2 text-sm border border-[#ECEAE3] rounded-[5px] bg-white text-[#36342E] placeholder:text-[#939084] focus:outline-none focus:ring-2 focus:ring-[#553DE9]/20 focus:border-[#553DE9]"})]}),e.jsx("div",{className:"flex items-center gap-1",role:"tablist",children:ie.map(c=>e.jsx("button",{role:"tab","aria-selected":a===c.key,onClick:()=>d(c.key),className:`px-3 py-1.5 text-xs font-semibold rounded-[3px] transition-colors ${a===c.key?"bg-[#553DE9] text-white":"text-[#6B6960] hover:text-[#36342E] hover:bg-[#F8F4F0]"}`,children:c.label},c.key))})]}),w.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[e.jsx("p",{className:"text-[#6B6960] text-sm mb-4",children:"No projects yet. Start building."}),e.jsx(C,{icon:S,onClick:()=>t("/"),children:"New Project"})]}):e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:w.map(c=>e.jsx(ae,{session:c,onOpen:()=>t(`/project/${c.id}`),onDelete:()=>m(c),onCopyPath:()=>B(c.path)},c.id))}),l&&e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40",children:e.jsxs("div",{className:"bg-white rounded-lg shadow-xl max-w-md w-full mx-4 p-6",children:[e.jsxs("h2",{className:"text-base font-semibold text-[#36342E] mb-2",children:["Delete ",l.prd_snippet||"Untitled project","?"]}),e.jsx("p",{className:"text-sm text-[#6B6960] mb-6",children:"This will remove all files, dependencies, and state. This cannot be undone."}),e.jsxs("div",{className:"flex items-center justify-end gap-3",children:[e.jsx("button",{onClick:()=>m(null),disabled:i,className:"px-4 py-2 text-sm font-medium text-[#6B6960] hover:text-[#36342E] rounded-[5px] hover:bg-[#F8F4F0] transition-colors disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:F,disabled:i,className:"px-4 py-2 text-sm font-medium text-white bg-red-600 hover:bg-red-700 rounded-[5px] transition-colors disabled:opacity-50",children:i?"Deleting...":"Delete"})]})]})}),o&&e.jsxs("div",{className:"fixed bottom-6 right-6 z-50 px-4 py-3 bg-[#36342E] text-white text-sm rounded-[5px] shadow-lg flex items-center gap-2",children:[o,e.jsx("button",{onClick:()=>x(null),className:"text-white/60 hover:text-white",children:e.jsx(M,{size:14})})]})]})}function ae({session:t,onOpen:r,onDelete:n,onCopyPath:a}){const[d,l]=u.useState(!1),m=u.useRef(null);u.useEffect(()=>{if(!d)return;const s=o=>{m.current&&!m.current.contains(o.target)&&l(!1)};return document.addEventListener("mousedown",s),()=>document.removeEventListener("mousedown",s)},[d]);const i=new Date(t.date).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});return e.jsxs(J,{hover:!0,onClick:r,className:"relative",children:[e.jsxs("div",{className:"absolute top-2.5 right-2.5 z-10",ref:m,children:[e.jsx("button",{onClick:s=>{s.stopPropagation(),l(!d)},"aria-label":"Project options",className:"p-1 rounded-[3px] text-[#B8B5AD] hover:text-[#36342E] hover:bg-[#F8F4F0] transition-colors",children:e.jsx(W,{size:16})}),d&&e.jsxs("div",{className:"absolute right-0 top-8 w-44 bg-white border border-[#ECEAE3] rounded-[5px] shadow-lg py-1 z-20",children:[e.jsxs("button",{onClick:s=>{s.stopPropagation(),l(!1),r()},className:"flex items-center gap-2.5 w-full px-3 py-2 text-sm text-[#36342E] hover:bg-[#F8F4F0] transition-colors text-left",children:[e.jsx(G,{size:14,className:"text-[#6B6960]"}),"Open project"]}),e.jsxs("button",{onClick:s=>{s.stopPropagation(),l(!1),window.open(`/project/${t.id}`,"_blank")},className:"flex items-center gap-2.5 w-full px-3 py-2 text-sm text-[#36342E] hover:bg-[#F8F4F0] transition-colors text-left",children:[e.jsx(A,{size:14,className:"text-[#6B6960]"}),"Open in new tab"]}),e.jsxs("button",{onClick:s=>{s.stopPropagation(),l(!1),a()},className:"flex items-center gap-2.5 w-full px-3 py-2 text-sm text-[#36342E] hover:bg-[#F8F4F0] transition-colors text-left",children:[e.jsx(K,{size:14,className:"text-[#6B6960]"}),"Copy path"]}),e.jsx("div",{className:"border-t border-[#ECEAE3] my-1"}),e.jsxs("button",{onClick:s=>{s.stopPropagation(),l(!1),n()},className:"flex items-center gap-2.5 w-full px-3 py-2 text-sm text-red-600 hover:bg-red-50 transition-colors text-left",children:[e.jsx(Q,{size:14}),"Delete project"]})]})]}),e.jsxs("div",{className:"flex items-center justify-between mb-2 pr-6",children:[e.jsx("span",{className:"text-xs text-[#6B6960]",children:i}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(se,{testCoverage:72,lintErrors:0,buildSuccessRate:k(t.status)==="completed"?1:.8,codeComplexity:25,badge:!0}),e.jsx(_,{status:ne(t.status),children:le[t.status]||t.status})]})]}),e.jsx("h3",{className:"text-sm font-medium text-[#36342E] line-clamp-2 mb-2",children:t.prd_snippet||"Untitled project"}),e.jsx("p",{className:"text-xs text-[#6B6960] truncate",children:t.path})]})}export{we as default};
@@ -1,6 +0,0 @@
1
- import{c as M,r as o,j as e,w as C,x as S,T as D,Q as K}from"./index-BN52-GQT.js";import{B as h}from"./Button-BPXURLaK.js";import{P as L}from"./plus-CNqABexN.js";import{C as g}from"./check-CBohulxQ.js";import{C as U}from"./copy-LXquTgzI.js";import{R as q}from"./refresh-cw-34B13ztx.js";import{E as B,R as _}from"./rotate-ccw-CrD2QB29.js";import{C as $}from"./clock-mfq4XnPQ.js";import{T as G}from"./trash-2-Cc-VTvzt.js";import{S as W}from"./server-BcgRMArA.js";import{H as Y}from"./hammer-Cgi3LTuS.js";import{B as V}from"./bell-C-UezVWi.js";import{D as H}from"./database-S1dyXnuT.js";import{S as Q}from"./shield-alert-DLYLdVJ0.js";import{S as f}from"./save-DsJcqdnI.js";/**
2
- * @license lucide-react v0.577.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */const J=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],I=M("key",J),X=[{id:"key-1",name:"Production CI/CD",prefix:"pk_l",createdAt:new Date(Date.now()-45*864e5).toISOString(),lastUsed:new Date(Date.now()-36e5).toISOString(),scopes:["read","write","deploy"]},{id:"key-2",name:"Staging Environment",prefix:"pk_s",createdAt:new Date(Date.now()-120*864e5).toISOString(),lastUsed:new Date(Date.now()-864e5).toISOString(),scopes:["read","write"]},{id:"key-3",name:"Monitoring Dashboard",prefix:"pk_m",createdAt:new Date(Date.now()-10*864e5).toISOString(),lastUsed:null,scopes:["read"]}],v={read:{label:"Read",description:"View projects, status, and logs",color:"#1FC5A8"},write:{label:"Write",description:"Create and modify projects",color:"#553DE9"},admin:{label:"Admin",description:"Manage users and settings",color:"#F59E0B"},deploy:{label:"Deploy",description:"Trigger deployments",color:"#C45B5B"}};function F(s){return Math.floor((Date.now()-new Date(s).getTime())/864e5)}function w(s){if(!s)return"Never";const l=F(s);return l===0?"Today":l===1?"Yesterday":l<30?`${l}d ago`:l<365?`${Math.floor(l/30)}mo ago`:`${Math.floor(l/365)}y ago`}function Z({onSubmit:s,onCancel:l}){const[r,c]=o.useState(""),[n,x]=o.useState(new Set(["read"])),t=a=>{x(d=>{const m=new Set(d);return m.has(a)?m.delete(a):m.add(a),m})};return e.jsxs("div",{className:"border border-[#553DE9]/20 bg-[#553DE9]/5 dark:bg-[#553DE9]/10 rounded-lg p-4 space-y-4",children:[e.jsx("h4",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3]",children:"Create New API Key"}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Key Name"}),e.jsx("input",{value:r,onChange:a=>c(a.target.value),placeholder:"e.g. Production CI/CD",className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084]",autoFocus:!0})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-2",children:"Scopes"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(v).map(([a,d])=>e.jsxs("button",{type:"button",onClick:()=>t(a),className:`flex items-center gap-2 px-3 py-2 rounded-lg border text-sm text-left transition-colors ${n.has(a)?"border-[#553DE9] bg-[#553DE9]/5 dark:bg-[#553DE9]/10":"border-[#ECEAE3] dark:border-[#2A2A30] hover:bg-[#F8F4F0] dark:hover:bg-[#222228]"}`,children:[e.jsx("input",{type:"checkbox",checked:n.has(a),readOnly:!0,className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"}),e.jsxs("div",{children:[e.jsx("div",{className:"font-medium text-[#201515] dark:text-[#E8E6E3]",children:d.label}),e.jsx("div",{className:"text-xs text-[#939084]",children:d.description})]})]},a))})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{size:"sm",icon:I,onClick:()=>s(r,Array.from(n)),disabled:!r.trim()||n.size===0,children:"Generate Key"}),e.jsx(h,{size:"sm",variant:"ghost",onClick:l,children:"Cancel"})]})]})}function ee({keyName:s,onConfirm:l,onCancel:r}){return e.jsx("div",{className:"border border-[#C45B5B]/30 bg-[#C45B5B]/5 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(D,{size:18,className:"text-[#C45B5B] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:['Revoke "',s,'"?']}),e.jsx("p",{className:"text-xs text-[#939084] mt-1",children:"This action cannot be undone. Any applications using this key will immediately lose access."}),e.jsxs("div",{className:"flex items-center gap-2 mt-3",children:[e.jsx(h,{size:"sm",variant:"danger",icon:G,onClick:l,children:"Revoke Key"}),e.jsx(h,{size:"sm",variant:"ghost",onClick:r,children:"Cancel"})]})]})]})})}function te({keys:s,onCreateKey:l,onRevokeKey:r,className:c=""}){const[n,x]=o.useState(s||X),[t,a]=o.useState(!1),[d,m]=o.useState(null),[p,j]=o.useState(!1),[T,N]=o.useState(null),[A,R]=o.useState({}),O=o.useCallback(async(i,u)=>{let E;if(l)E=await l(i,u);else{const y="abcdefghijklmnopqrstuvwxyz0123456789";E=`pk_live_${Array.from({length:32},()=>y[Math.floor(Math.random()*y.length)]).join("")}`}const b={id:`key-${Date.now()}`,name:i,prefix:E.slice(0,4),createdAt:new Date().toISOString(),lastUsed:null,scopes:u};x(y=>[b,...y]),m(E),a(!1)},[l]),z=o.useCallback(async i=>{r&&await r(i),x(u=>u.filter(E=>E.id!==i)),N(null)},[r]),P=o.useCallback(async i=>{try{await navigator.clipboard.writeText(i),j(!0),setTimeout(()=>j(!1),2e3)}catch{const u=document.createElement("textarea");u.value=i,document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u),j(!0),setTimeout(()=>j(!1),2e3)}},[]);return e.jsxs("div",{className:`space-y-4 ${c}`,children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(I,{size:18,className:"text-[#553DE9]"}),e.jsx("h3",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:"API Keys"})]}),!t&&!d&&e.jsx(h,{size:"sm",variant:"secondary",icon:L,onClick:()=>a(!0),children:"New Key"})]}),d&&e.jsx("div",{className:"border border-[#1FC5A8]/30 bg-[#1FC5A8]/5 rounded-lg p-4",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(g,{size:18,className:"text-[#1FC5A8] flex-shrink-0 mt-0.5"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("p",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:"API Key Created"}),e.jsx("p",{className:"text-xs text-[#939084] mt-1",children:"Copy this key now. You will not be able to see it again."}),e.jsxs("div",{className:"flex items-center gap-2 mt-2",children:[e.jsx("code",{className:"flex-1 px-3 py-2 text-sm font-mono bg-[#36342E] text-[#1FC5A8] rounded-lg truncate",children:d}),e.jsx(h,{size:"sm",variant:"secondary",icon:p?g:U,onClick:()=>P(d),children:p?"Copied":"Copy"})]}),e.jsx("button",{onClick:()=>m(null),className:"text-xs text-[#553DE9] hover:underline mt-2",children:"I have saved this key"})]})]})}),t&&e.jsx(Z,{onSubmit:O,onCancel:()=>a(!1)}),e.jsx("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg overflow-hidden",children:e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"bg-[#F8F4F0] dark:bg-[#222228]",children:[e.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-medium text-[#6B6960]",children:"Name"}),e.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-medium text-[#6B6960]",children:"Key"}),e.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-medium text-[#6B6960]",children:"Scopes"}),e.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-medium text-[#6B6960]",children:"Created"}),e.jsx("th",{className:"text-left px-4 py-2.5 text-xs font-medium text-[#6B6960]",children:"Last Used"}),e.jsx("th",{className:"text-right px-4 py-2.5 text-xs font-medium text-[#6B6960]",children:"Actions"})]})}),e.jsxs("tbody",{children:[n.map(i=>{const u=F(i.createdAt),E=u>=90;return e.jsxs("tr",{className:"border-t border-[#ECEAE3] dark:border-[#2A2A30] hover:bg-[#F8F4F0] dark:hover:bg-[#222228] transition-colors",children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{size:14,className:"text-[#553DE9] flex-shrink-0"}),e.jsx("span",{className:"text-[#201515] dark:text-[#E8E6E3] font-medium",children:i.name}),E&&e.jsxs("span",{className:"inline-flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px] bg-[#F59E0B]/10 text-[#F59E0B]",title:"This key is over 90 days old. Consider rotating it.",children:[e.jsx(q,{size:10}),u,"d old"]})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("code",{className:"text-xs font-mono text-[#939084]",children:A[i.id]?`${i.prefix}****...`:`${i.prefix}****...`}),e.jsx("button",{onClick:()=>R(b=>({...b,[i.id]:!b[i.id]})),className:"text-[#939084] hover:text-[#36342E] dark:hover:text-[#E8E6E3]",title:A[i.id]?"Hide":"Show",children:A[i.id]?e.jsx(B,{size:12}):e.jsx(S,{size:12})})]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("div",{className:"flex flex-wrap gap-1",children:i.scopes.map(b=>e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium",style:{backgroundColor:`${v[b].color}15`,color:v[b].color},children:v[b].label},b))})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs text-[#939084]",children:[e.jsx($,{size:12}),w(i.createdAt)]})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:"text-xs text-[#939084]",children:w(i.lastUsed)})}),e.jsx("td",{className:"px-4 py-3 text-right",children:T===i.id?e.jsx(ee,{keyName:i.name,onConfirm:()=>z(i.id),onCancel:()=>N(null)}):e.jsx("button",{onClick:()=>N(i.id),className:"text-xs text-[#C45B5B] hover:underline",children:"Revoke"})})]},i.id)}),n.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"px-4 py-8 text-center text-sm text-[#939084]",children:"No API keys yet. Create one to get started."})})]})]})})]})}const se=[{id:"claude",name:"Claude",apiKeySet:!0,model:"claude-sonnet-4-20250514",fallbackOrder:1,enabled:!0},{id:"codex",name:"Codex",apiKeySet:!1,model:"gpt-5.3-codex",fallbackOrder:2,enabled:!0},{id:"gemini",name:"Gemini",apiKeySet:!1,model:"gemini-3-pro-medium",fallbackOrder:3,enabled:!1}],ae={maxIterations:25,timeoutMinutes:60,qualityGateThreshold:80,autoReview:!0,parallelAgents:3},re={sessionTimeoutMinutes:30,allowedOrigins:"*",rateLimitPerMinute:100,requireMFA:!1,ipAllowlist:""},ne={emailEnabled:!1,emailAddress:"",browserEnabled:!0,slackEnabled:!1,slackWebhookUrl:"",notifyOnBuildComplete:!0,notifyOnBuildFailure:!0,notifyOnBudgetAlert:!0,notifyOnSecurityEvent:!0},le={logRetentionDays:30,auditRetentionDays:365,sessionRetentionDays:90,autoCleanupEnabled:!0,lastCleanup:new Date(Date.now()-864e5).toISOString()};function ie(){const[s,l]=o.useState(se),[r,c]=o.useState({}),[n,x]=o.useState(!1),t=()=>{x(!0),setTimeout(()=>x(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-[#6B6960]",children:"Configure AI provider API keys, model preferences, and fallback chain."}),s.map((a,d)=>e.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg p-4 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"w-6 h-6 rounded-full bg-[#553DE9]/10 flex items-center justify-center text-xs font-bold text-[#553DE9]",children:a.fallbackOrder}),e.jsx("span",{className:"text-sm font-medium text-[#201515] dark:text-[#E8E6E3]",children:a.name}),a.apiKeySet&&e.jsx("span",{className:"px-1.5 py-0.5 rounded text-[10px] font-medium bg-[#1FC5A8]/10 text-[#1FC5A8]",children:"Configured"})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("span",{className:"text-xs text-[#939084]",children:a.enabled?"Enabled":"Disabled"}),e.jsx("input",{type:"checkbox",checked:a.enabled,onChange:m=>{const p=[...s];p[d]={...p[d],enabled:m.target.checked},l(p)},className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"})]})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"API Key"}),e.jsxs("div",{className:"relative",children:[e.jsx("input",{type:r[a.id]?"text":"password",value:a.apiKeySet?"sk-****************************":"",placeholder:"Enter API key...",className:"w-full px-3 py-2 pr-10 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084] font-mono",readOnly:!0}),e.jsx("button",{onClick:()=>c(m=>({...m,[a.id]:!m[a.id]})),className:"absolute right-3 top-1/2 -translate-y-1/2 text-[#939084] hover:text-[#36342E]",children:r[a.id]?e.jsx(B,{size:14}):e.jsx(S,{size:14})})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Model"}),e.jsx("input",{value:a.model,onChange:m=>{const p=[...s];p[d]={...p[d],model:m.target.value},l(p)},className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] font-mono"})]})]})]},a.id)),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(h,{size:"sm",icon:n?g:f,onClick:t,children:n?"Saved":"Save Provider Config"})})]})}function de(){const[s,l]=o.useState(ae),[r,c]=o.useState(!1),n=(t,a)=>{l(d=>({...d,[t]:a}))},x=()=>{c(!0),setTimeout(()=>c(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-[#6B6960]",children:"Default settings for new builds. Individual projects can override these."}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Max Iterations"}),e.jsx("input",{type:"number",value:s.maxIterations,onChange:t=>n("maxIterations",parseInt(t.target.value)||0),min:1,max:100,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Timeout (minutes)"}),e.jsx("input",{type:"number",value:s.timeoutMinutes,onChange:t=>n("timeoutMinutes",parseInt(t.target.value)||0),min:5,max:480,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Quality Gate Threshold (%)"}),e.jsx("input",{type:"number",value:s.qualityGateThreshold,onChange:t=>n("qualityGateThreshold",parseInt(t.target.value)||0),min:0,max:100,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"}),e.jsx("div",{className:"mt-1 h-1.5 bg-[#F8F4F0] dark:bg-[#1A1A1E] rounded-full overflow-hidden",children:e.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${s.qualityGateThreshold}%`,background:s.qualityGateThreshold>=80?"#1FC5A8":s.qualityGateThreshold>=60?"#F59E0B":"#C45B5B"}})})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Parallel Agents"}),e.jsx("input",{type:"number",value:s.parallelAgents,onChange:t=>n("parallelAgents",parseInt(t.target.value)||1),min:1,max:10,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.autoReview,onChange:t=>n("autoReview",t.target.checked),className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"}),e.jsx("span",{className:"text-sm text-[#201515] dark:text-[#E8E6E3]",children:"Auto-run code review after each build"})]}),e.jsx(h,{size:"sm",icon:r?g:f,onClick:x,children:r?"Saved":"Save Build Defaults"})]})}function oe(){const[s,l]=o.useState(re),[r,c]=o.useState(!1),n=(t,a)=>{l(d=>({...d,[t]:a}))},x=()=>{c(!0),setTimeout(()=>c(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-[#6B6960]",children:"Security settings for session management, rate limiting, and access control."}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Session Timeout (minutes)"}),e.jsx("input",{type:"number",value:s.sessionTimeoutMinutes,onChange:t=>n("sessionTimeoutMinutes",parseInt(t.target.value)||0),min:5,max:1440,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Rate Limit (requests/minute)"}),e.jsx("input",{type:"number",value:s.rateLimitPerMinute,onChange:t=>n("rateLimitPerMinute",parseInt(t.target.value)||0),min:10,max:1e4,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Allowed Origins"}),e.jsx("input",{type:"text",value:s.allowedOrigins,onChange:t=>n("allowedOrigins",t.target.value),placeholder:"* or comma-separated origins",className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084] font-mono"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"IP Allowlist"}),e.jsx("input",{type:"text",value:s.ipAllowlist,onChange:t=>n("ipAllowlist",t.target.value),placeholder:"Leave empty for no restriction",className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084] font-mono"})]})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.requireMFA,onChange:t=>n("requireMFA",t.target.checked),className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"}),e.jsx("span",{className:"text-sm text-[#201515] dark:text-[#E8E6E3]",children:"Require MFA for all users"}),!s.requireMFA&&e.jsxs("span",{className:"text-xs text-[#F59E0B] flex items-center gap-1",children:[e.jsx(D,{size:12}),"Not recommended for production"]})]}),e.jsx(h,{size:"sm",icon:r?g:f,onClick:x,children:r?"Saved":"Save Security Settings"})]})}function ce(){const[s,l]=o.useState(ne),[r,c]=o.useState(!1),n=(t,a)=>{l(d=>({...d,[t]:a}))},x=()=>{c(!0),setTimeout(()=>c(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-[#6B6960]",children:"Configure how and when you receive notifications about system events."}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-xs font-semibold text-[#6B6960] uppercase tracking-wider",children:"Channels"}),e.jsxs("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg divide-y divide-[#ECEAE3] dark:divide-[#2A2A30]",children:[e.jsxs("div",{className:"p-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[#201515] dark:text-[#E8E6E3]",children:"Browser Notifications"}),e.jsx("p",{className:"text-xs text-[#939084]",children:"Show desktop notifications"})]}),e.jsx("input",{type:"checkbox",checked:s.browserEnabled,onChange:t=>n("browserEnabled",t.target.checked),className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"})]}),e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[#201515] dark:text-[#E8E6E3]",children:"Email Notifications"}),e.jsx("p",{className:"text-xs text-[#939084]",children:"Send email for important events"})]}),e.jsx("input",{type:"checkbox",checked:s.emailEnabled,onChange:t=>n("emailEnabled",t.target.checked),className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"})]}),s.emailEnabled&&e.jsx("input",{type:"email",value:s.emailAddress,onChange:t=>n("emailAddress",t.target.value),placeholder:"notifications@company.com",className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084]"})]}),e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[#201515] dark:text-[#E8E6E3]",children:"Slack Webhook"}),e.jsx("p",{className:"text-xs text-[#939084]",children:"Post to a Slack channel"})]}),e.jsx("input",{type:"checkbox",checked:s.slackEnabled,onChange:t=>n("slackEnabled",t.target.checked),className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"})]}),s.slackEnabled&&e.jsx("input",{type:"url",value:s.slackWebhookUrl,onChange:t=>n("slackWebhookUrl",t.target.value),placeholder:"https://hooks.slack.com/services/...",className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3] placeholder-[#939084] font-mono"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h4",{className:"text-xs font-semibold text-[#6B6960] uppercase tracking-wider",children:"Events"}),e.jsx("div",{className:"border border-[#ECEAE3] dark:border-[#2A2A30] rounded-lg divide-y divide-[#ECEAE3] dark:divide-[#2A2A30]",children:[{key:"notifyOnBuildComplete",label:"Build Complete",desc:"When a build finishes successfully"},{key:"notifyOnBuildFailure",label:"Build Failure",desc:"When a build fails or times out"},{key:"notifyOnBudgetAlert",label:"Budget Alert",desc:"When spending approaches the limit"},{key:"notifyOnSecurityEvent",label:"Security Event",desc:"Login from new device, key rotation, etc."}].map(t=>e.jsxs("div",{className:"p-3 flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm text-[#201515] dark:text-[#E8E6E3]",children:t.label}),e.jsx("p",{className:"text-xs text-[#939084]",children:t.desc})]}),e.jsx("input",{type:"checkbox",checked:s[t.key],onChange:a=>n(t.key,a.target.checked),className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"})]},t.key))})]}),e.jsx(h,{size:"sm",icon:r?g:f,onClick:x,children:r?"Saved":"Save Notifications"})]})}function xe(){const[s,l]=o.useState(le),[r,c]=o.useState(!1),n=(t,a)=>{l(d=>({...d,[t]:a}))},x=()=>{c(!0),setTimeout(()=>c(!1),2e3)};return e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-[#6B6960]",children:"Configure how long different types of data are retained before automatic cleanup."}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Log Retention (days)"}),e.jsx("input",{type:"number",value:s.logRetentionDays,onChange:t=>n("logRetentionDays",parseInt(t.target.value)||0),min:7,max:365,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Audit Retention (days)"}),e.jsx("input",{type:"number",value:s.auditRetentionDays,onChange:t=>n("auditRetentionDays",parseInt(t.target.value)||0),min:30,max:3650,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-[#6B6960] mb-1",children:"Session Retention (days)"}),e.jsx("input",{type:"number",value:s.sessionRetentionDays,onChange:t=>n("sessionRetentionDays",parseInt(t.target.value)||0),min:7,max:365,className:"w-full px-3 py-2 text-sm rounded-lg border border-[#ECEAE3] dark:border-[#2A2A30] bg-white dark:bg-[#1A1A1E] text-[#201515] dark:text-[#E8E6E3]"})]})]}),e.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[e.jsx("input",{type:"checkbox",checked:s.autoCleanupEnabled,onChange:t=>n("autoCleanupEnabled",t.target.checked),className:"rounded border-[#ECEAE3] text-[#553DE9] focus:ring-[#553DE9]"}),e.jsx("span",{className:"text-sm text-[#201515] dark:text-[#E8E6E3]",children:"Enable automatic cleanup"})]}),s.lastCleanup&&e.jsxs("p",{className:"text-xs text-[#939084]",children:["Last cleanup: ",new Date(s.lastCleanup).toLocaleString()]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{size:"sm",icon:r?g:f,onClick:x,children:r?"Saved":"Save Retention Settings"}),e.jsx(h,{size:"sm",variant:"ghost",icon:_,children:"Run Cleanup Now"})]})]})}const k=[{id:"providers",label:"Providers",icon:W},{id:"builds",label:"Build Defaults",icon:Y},{id:"security",label:"Security",icon:C},{id:"api-keys",label:"API Keys",icon:C},{id:"notifications",label:"Notifications",icon:V},{id:"retention",label:"Data Retention",icon:H}];function me(){return e.jsxs("div",{className:"max-w-[500px] mx-auto px-6 py-20 text-center",children:[e.jsx(Q,{size:48,className:"mx-auto text-[#C45B5B] mb-4"}),e.jsx("h1",{className:"font-heading text-h1 text-[#36342E] dark:text-[#E8E6E3] mb-2",children:"Access Denied"}),e.jsx("p",{className:"text-sm text-[#6B6960]",children:"You do not have permission to access system settings. Contact your organization administrator for access."})]})}function De(){var x,t;const{user:s,isLocalMode:l}=K(),[r,c]=o.useState("providers");return l||(s==null?void 0:s.authenticated)===!0?e.jsxs("div",{className:"max-w-[1000px] mx-auto px-6 py-8",children:[e.jsx("h1",{className:"font-heading text-h1 text-[#36342E] dark:text-[#E8E6E3] mb-6",children:"System Settings"}),e.jsxs("div",{className:"flex gap-6",children:[e.jsx("nav",{className:"w-48 flex-shrink-0 space-y-1",children:k.map(a=>e.jsxs("button",{onClick:()=>c(a.id),className:`w-full flex items-center gap-2 px-3 py-2 text-sm rounded-lg text-left transition-colors ${r===a.id?"bg-[#553DE9]/8 text-[#553DE9] font-medium":"text-[#6B6960] hover:bg-[#F8F4F0] dark:hover:bg-[#222228] hover:text-[#36342E] dark:hover:text-[#E8E6E3]"}`,children:[e.jsx(a.icon,{size:16}),a.label]},a.id))}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("div",{className:"card p-6",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[((x=k.find(a=>a.id===r))==null?void 0:x.icon)&&(()=>{const a=k.find(d=>d.id===r).icon;return e.jsx(a,{size:18,className:"text-[#553DE9]"})})(),e.jsx("h2",{className:"text-sm font-semibold text-[#201515] dark:text-[#E8E6E3] uppercase tracking-wider",children:(t=k.find(a=>a.id===r))==null?void 0:t.label})]}),r==="providers"&&e.jsx(ie,{}),r==="builds"&&e.jsx(de,{}),r==="security"&&e.jsx(oe,{}),r==="api-keys"&&e.jsx(te,{}),r==="notifications"&&e.jsx(ce,{}),r==="retention"&&e.jsx(xe,{})]})})]})]}):e.jsx(me,{})}export{De as default};