@codeyam/codeyam-cli 0.1.0-staging.1 → 0.1.0-staging.8aea589

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 (111) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +51 -107
  4. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +36 -183
  5. package/analyzer-template/packages/analyze/src/lib/FileAnalyzer.ts +34 -0
  6. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.ts +238 -0
  7. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.ts +25 -0
  8. package/analyzer-template/packages/analyze/src/lib/asts/sourceFiles/index.ts +2 -0
  9. package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
  10. package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js +3 -2
  11. package/analyzer-template/packages/github/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
  12. package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.d.ts.map +1 -1
  13. package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js +3 -2
  14. package/analyzer-template/packages/utils/dist/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
  15. package/analyzer-template/packages/utils/src/lib/frameworks/getNextRoutePath.ts +6 -2
  16. package/analyzer-template/project/writeUniversalMocks.ts +6 -2
  17. package/background/src/lib/virtualized/project/writeUniversalMocks.js +3 -2
  18. package/background/src/lib/virtualized/project/writeUniversalMocks.js.map +1 -1
  19. package/codeyam-cli/scripts/apply-setup.js +288 -0
  20. package/codeyam-cli/scripts/apply-setup.js.map +1 -0
  21. package/codeyam-cli/scripts/extract-setup.js +130 -0
  22. package/codeyam-cli/scripts/extract-setup.js.map +1 -0
  23. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +238 -0
  24. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +1 -0
  25. package/codeyam-cli/src/utils/analysisRunner.js +4 -3
  26. package/codeyam-cli/src/utils/analysisRunner.js.map +1 -1
  27. package/codeyam-cli/src/utils/backgroundServer.js +25 -5
  28. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  29. package/codeyam-cli/src/utils/fileWatcher.js +75 -5
  30. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  31. package/codeyam-cli/src/utils/queue/job.js +3 -2
  32. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  33. package/codeyam-cli/src/webserver/app/lib/database.js +13 -0
  34. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  35. package/codeyam-cli/src/webserver/backgroundServer.js +15 -35
  36. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  37. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-rqv54FUY.js +1 -0
  38. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-Dh-FldQK.js → InteractivePreview-B0oiPem-.js} +1 -1
  39. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-DqXXjAJ7.js +3 -0
  40. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-Dp6DC845.js → LogViewer-BKKG1s2B.js} +1 -1
  41. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-xwuhwsZH.js → SafeScreenshot-DU_jxCPD.js} +1 -1
  42. package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-5DY-YIxu.js +6 -0
  43. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-M2QuSHKC.js → ScenarioViewer-DmjXUj6m.js} +2 -2
  44. package/codeyam-cli/src/webserver/build/client/assets/_index-DvSrcxsk.js +1 -0
  45. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CsaMd9mb.js +10 -0
  46. package/codeyam-cli/src/webserver/build/client/assets/chart-column-VXBS6qOn.js +1 -0
  47. package/codeyam-cli/src/webserver/build/client/assets/circle-alert-n5GUC2AS.js +1 -0
  48. package/codeyam-cli/src/webserver/build/client/assets/clock-DKqtX8js.js +1 -0
  49. package/codeyam-cli/src/webserver/build/client/assets/{components-CAx5ONX_.js → components-Dj-Ggnl2.js} +1 -1
  50. package/codeyam-cli/src/webserver/build/client/assets/{dev.empty-DGy3zrli.js → dev.empty-BbR3FwNc.js} +1 -1
  51. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-1Z6D0fLM.js → entity._sha._-BHiWkb_W.js} +7 -7
  52. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.create-scenario-ChAdTrrU.js → entity._sha_.create-scenario-L7M9Vr5z.js} +1 -1
  53. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-D9L7267w.js → entity._sha_.edit._scenarioId-C9w-q7P3.js} +1 -1
  54. package/codeyam-cli/src/webserver/build/client/assets/{entityVersioning-DO2gCvXv.js → entityVersioning-Bk_YB1jM.js} +1 -1
  55. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-C6FRgjPr.js → entry.client-CdGoUs8A.js} +1 -1
  56. package/codeyam-cli/src/webserver/build/client/assets/file-text-B6Er7j5k.js +1 -0
  57. package/codeyam-cli/src/webserver/build/client/assets/files-KcDVw1FY.js +1 -0
  58. package/codeyam-cli/src/webserver/build/client/assets/git-B9uZ8eSJ.js +12 -0
  59. package/codeyam-cli/src/webserver/build/client/assets/globals-B0f88RTV.css +1 -0
  60. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-v3c6DFp4.js +1 -0
  61. package/codeyam-cli/src/webserver/build/client/assets/manifest-fca08d7e.js +1 -0
  62. package/codeyam-cli/src/webserver/build/client/assets/root-Cf8VBqIb.js +16 -0
  63. package/codeyam-cli/src/webserver/build/client/assets/search-DA14wXpu.js +1 -0
  64. package/codeyam-cli/src/webserver/build/client/assets/settings-COJUrwGu.js +1 -0
  65. package/codeyam-cli/src/webserver/build/client/assets/{settings-Hbf8b7J_.js → settings-NU_ZquhK.js} +1 -1
  66. package/codeyam-cli/src/webserver/build/client/assets/simulations-CNaMJ-nR.js +1 -0
  67. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-BBlyqxij.js → useLastLogLine-Lumm1t01.js} +1 -1
  68. package/codeyam-cli/src/webserver/build/client/assets/useToast-BRShB17p.js +1 -0
  69. package/codeyam-cli/src/webserver/build/client/assets/zap-BvukH0eN.js +1 -0
  70. package/codeyam-cli/src/webserver/build/client/favicon.svg +13 -0
  71. package/codeyam-cli/src/webserver/build/server/assets/{index-eAULANMV.js → index-DHr4rT4u.js} +1 -1
  72. package/codeyam-cli/src/webserver/build/server/assets/server-build-Bi1mj14J.js +166 -0
  73. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  74. package/codeyam-cli/src/webserver/build-info.json +5 -5
  75. package/codeyam-cli/src/webserver/public/favicon.svg +13 -0
  76. package/codeyam-cli/templates/codeyam-setup-skill.md +24 -18
  77. package/package.json +1 -1
  78. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +51 -107
  79. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
  80. package/packages/ai/src/lib/generateEntityKeyAttributes.js +36 -183
  81. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
  82. package/packages/analyze/src/lib/FileAnalyzer.js +28 -0
  83. package/packages/analyze/src/lib/FileAnalyzer.js.map +1 -1
  84. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js +191 -0
  85. package/packages/analyze/src/lib/asts/sourceFiles/getAllDeclaredEntityNodes.js.map +1 -0
  86. package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js +16 -0
  87. package/packages/analyze/src/lib/asts/sourceFiles/getDeclaredEntityNode.js.map +1 -0
  88. package/packages/analyze/src/lib/asts/sourceFiles/index.js +2 -0
  89. package/packages/analyze/src/lib/asts/sourceFiles/index.js.map +1 -1
  90. package/packages/utils/src/lib/frameworks/getNextRoutePath.js +3 -2
  91. package/packages/utils/src/lib/frameworks/getNextRoutePath.js.map +1 -1
  92. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-GqWwt5wG.js +0 -1
  93. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-p0fuyqGQ.js +0 -3
  94. package/codeyam-cli/src/webserver/build/client/assets/ScenarioPreview-Bl2IRh55.js +0 -1
  95. package/codeyam-cli/src/webserver/build/client/assets/_index-CAVtep9Q.js +0 -1
  96. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CLmzsLsT.js +0 -10
  97. package/codeyam-cli/src/webserver/build/client/assets/chart-column-B2I7jQx2.js +0 -1
  98. package/codeyam-cli/src/webserver/build/client/assets/circle-alert-GwwOAbhw.js +0 -1
  99. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgyOwWip.js +0 -1
  100. package/codeyam-cli/src/webserver/build/client/assets/files-C3-cQjgv.js +0 -1
  101. package/codeyam-cli/src/webserver/build/client/assets/git-Dp4EB9nv.js +0 -12
  102. package/codeyam-cli/src/webserver/build/client/assets/globals-Da3jt49-.css +0 -1
  103. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-DN7Vr40D.js +0 -1
  104. package/codeyam-cli/src/webserver/build/client/assets/manifest-172a4629.js +0 -1
  105. package/codeyam-cli/src/webserver/build/client/assets/root-COyVTsPq.js +0 -16
  106. package/codeyam-cli/src/webserver/build/client/assets/search-CvyP_1Lo.js +0 -1
  107. package/codeyam-cli/src/webserver/build/client/assets/settings-MZc4XdmE.js +0 -1
  108. package/codeyam-cli/src/webserver/build/client/assets/simulations-BMBi0VzO.js +0 -1
  109. package/codeyam-cli/src/webserver/build/client/assets/useToast-C_VxoXTh.js +0 -1
  110. package/codeyam-cli/src/webserver/build/client/assets/zap-B4gsLUZQ.js +0 -1
  111. package/codeyam-cli/src/webserver/build/server/assets/server-build-lutv16q5.js +0 -161
@@ -1,16 +0,0 @@
1
- import{y as J,z as W,A as K,B as Q,r,_ as X,j as e,a as Z,L,M as U,C as ee,S as te,D as se,u as ne,d as ie,O as ae}from"./components-CAx5ONX_.js";import{c as S}from"./createLucideIcon-CgyOwWip.js";import{S as oe}from"./settings-MZc4XdmE.js";import{C as O,T as re,u as le}from"./useToast-C_VxoXTh.js";import{u as ce}from"./useLastLogLine-BBlyqxij.js";import{L as de}from"./LogViewer-Dp6DC845.js";let V="positions";function me({getKey:t,...o}){let{isSpaMode:l}=J(),m=W(),i=K();Q({getKey:t,storageKey:V});let a=r.useMemo(()=>{if(!t)return null;let s=t(m,i);return s!==m.key?s:null},[]);if(l)return null;let c=((s,f)=>{if(!window.history.state||!window.history.state.key){let x=Math.random().toString(32).slice(2);window.history.replaceState({key:x},"")}try{let h=JSON.parse(sessionStorage.getItem(s)||"{}")[f||window.history.state.key];typeof h=="number"&&window.scrollTo(0,h)}catch(x){console.error(x),sessionStorage.removeItem(s)}}).toString();return r.createElement("script",X({},o,{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${JSON.stringify(V)}, ${JSON.stringify(a)})`}}))}function xe({id:t,selected:o,onClick:l,icon:m,name:i}){const[a,c]=r.useState(!1);r.useEffect(()=>{c(!0)},[]);const s=r.useCallback(()=>{l?.(t)},[l,t]);return e.jsxs("button",{className:`
2
- w-full aspect-square p-3 cursor-pointer focus:outline-none
3
- flex flex-col items-center justify-center gap-1 text-[#626262]
4
- hover:bg-[#d8d8d8] text-xs font-ibmPlexSans uppercase
5
- `,onClick:s,children:[e.jsx("div",{className:`${o?"bg-primary-100 text-cygray-10":""} w-10 h-10 rounded-lg flex items-center justify-center`,children:a&&m}),e.jsx("span",{className:`${o?"text-primary-100":""} whitespace-nowrap`,children:i})]})}const he="/assets/cy-logo-cli-C1gnJVOL.svg";const ue=[["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"}]],_=S("activity",ue);const pe=[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]],fe=S("component",pe);const ge=[["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"}]],ye=S("file",ge);const je=[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]],F=S("git-commit-horizontal",je);const ve=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],be=S("house",ve);const ke=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]],we=S("panels-top-left",ke);function Ne(){const t=W(),o=Z(),[l,m]=r.useState(),i={width:"24px",height:"24px",strokeWidth:1.5},a=[{id:"dashboard",icon:e.jsx(be,{style:i}),link:"/",name:"Dashboard"},{id:"git",icon:e.jsx(F,{style:i}),link:"/git",name:"Git"},{id:"simulations",icon:e.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 18 18",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:i,children:[e.jsx("path",{d:"M9 12.75V15.75",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M6 15.75H12",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M6.75 12.7498L11.325 8.17483C11.6067 7.89873 11.9858 7.7447 12.3803 7.7461C12.7747 7.74751 13.1528 7.90423 13.4325 8.18233L16.5 11.2498",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M6 8.25C6.82843 8.25 7.5 7.57843 7.5 6.75C7.5 5.92157 6.82843 5.25 6 5.25C5.17157 5.25 4.5 5.92157 4.5 6.75C4.5 7.57843 5.17157 8.25 6 8.25Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),e.jsx("path",{d:"M15 2.25H3C2.17157 2.25 1.5 2.92157 1.5 3.75V11.25C1.5 12.0784 2.17157 12.75 3 12.75H15C15.8284 12.75 16.5 12.0784 16.5 11.25V3.75C16.5 2.92157 15.8284 2.25 15 2.25Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]}),link:"/simulations",name:"Simulations"},{id:"files",icon:e.jsx(ye,{style:i}),link:"/files",name:"Files"},{id:"activity",icon:e.jsx(_,{style:i}),link:"/activity",name:"Activity"},{id:"settings",icon:e.jsx(oe,{style:i}),link:"/settings",name:"Settings"},{id:"commits",icon:e.jsx(F,{style:i}),link:"/commits",name:"Commits",hidden:!0},{id:"pages",icon:e.jsx(we,{style:i}),link:"/pages",name:"Pages",hidden:!0},{id:"components",icon:e.jsx(fe,{style:i}),link:"/components",name:"Components",hidden:!0}],c=r.useCallback(s=>{const f=a.find(x=>x.id===s);f?.link&&o(f.link),m(x=>x===s?void 0:s)},[a,o]);return r.useEffect(()=>{const s={dashboard:["/","/home"],git:["git"],commits:["commits"],simulations:["simulations"],activity:["activity"],files:["files"],settings:["settings"],pages:["pages"],components:["components"]};for(const[f,x]of Object.entries(s))if(x.some(h=>h==="/"?t.pathname==="/":t.pathname.includes(h))){m(f);return}m(void 0)},[t]),e.jsx("div",{id:"sidebar",className:"relative w-full h-screen bg-cygray-30 flex flex-col justify-between py-3",children:e.jsxs("div",{className:"w-full h-full flex flex-col items-center",children:[e.jsx("div",{children:e.jsx(L,{to:"/",className:"flex items-center justify-center h-20",children:e.jsx("img",{src:he,alt:"CodeYam",className:"h-8"})})}),a.filter(s=>!s.hidden).map(s=>e.jsx(xe,{id:s.id,selected:s.id===l,onClick:c,icon:s.icon,name:s.name},`sidebar-button-${s.id}`))]})})}function Ce({toast:t,onClose:o}){r.useEffect(()=>{const i=t.duration||5e3;if(i>0){const a=setTimeout(()=>{o(t.id)},i);return()=>clearTimeout(a)}},[t.id,t.duration,o]);const l={success:"✅",error:"❌",info:"ℹ️",warning:"⚠️"},m={success:"bg-emerald-50 border-emerald-200 text-emerald-900",error:"bg-red-50 border-red-200 text-red-900",info:"bg-blue-50 border-blue-200 text-blue-900",warning:"bg-amber-50 border-amber-200 text-amber-900"};return e.jsxs("div",{className:`flex items-center gap-3 px-4 py-3 rounded-lg border-2 shadow-lg min-w-[320px] max-w-[500px] animate-[slideIn_0.3s_ease-out] ${m[t.type]}`,children:[e.jsx("span",{className:"text-2xl",children:l[t.type]}),e.jsx("p",{className:"flex-1 text-sm font-medium m-0",children:t.message}),e.jsx("button",{onClick:()=>o(t.id),className:"text-gray-500 hover:text-gray-700 text-xl leading-none bg-transparent border-none cursor-pointer p-0 w-6 h-6 flex items-center justify-center rounded transition-colors hover:bg-black/10",children:"×"})]})}function Ae({toasts:t,onClose:o}){return t.length===0?null:e.jsxs("div",{className:"fixed top-4 right-4 z-10000 flex flex-col gap-2",children:[e.jsx("style",{children:`
6
- @keyframes slideIn {
7
- from {
8
- transform: translateX(400px);
9
- opacity: 0;
10
- }
11
- to {
12
- transform: translateX(0);
13
- opacity: 1;
14
- }
15
- }
16
- `}),t.map(l=>e.jsx(Ce,{toast:l,onClose:o},l.id))]})}function Le({currentRun:t,projectSlug:o,currentEntities:l=[],isAnalysisStarting:m=!1,queuedJobCount:i=0,queueJobs:a=[],currentlyExecuting:c=null,historicalRuns:s=[]}){const[f,x]=r.useState(!1),[h,j]=r.useState(!1),[w,N]=r.useState(!1),[v,p]=r.useState(null),C=!!c||a.length>0,E=!!c,b=c?.entities||l,T=!!t?.analysisCompletedAt;t?.readyToBeCaptured,t?.capturesCompleted;const M=t?.currentEntityShas&&t.currentEntityShas.length>0,A=C,{lastLine:R,isCompleted:G}=ce(o,A),g=E||A&&!G&&!C,D=(()=>{if(A)return!1;const u=Date.now()-30*1e3;if(t?.createdAt&&M){const d=t.analysisCompletedAt||t.createdAt;if(new Date(d).getTime()>u)return!0}if(s.length>0){const d=s[0],y=d.analysisCompletedAt||d.archivedAt||d.createdAt;if(y&&new Date(y).getTime()>u)return!0}return!1})(),I=(()=>{const u=Date.now()-1440*60*1e3;if(t?.createdAt&&M){const d=t.analysisCompletedAt||t.createdAt;if(new Date(d).getTime()>u)return!0}if(s.length>0){const d=s[0],y=d.analysisCompletedAt||d.archivedAt||d.createdAt;if(y&&new Date(y).getTime()>u)return!0}return!1})(),$=m||g||i>0||D;r.useEffect(()=>{const n=c?.id||null;$?n!==v&&(j(!0),N(!1),v!==null&&p(null)):(v!==null&&p(null),!I&&h&&!w&&j(!1))},[$,I,h,w,v,c?.id]);const Y=()=>c?`Analyzing${a.length>0?` (+${a.length} queued)`:""}`:a.length>0?`${a.length} job${a.length>1?"s":""} queued`:g?T?"Capture in Progress":"Analysis in Progress":D?"Recently completed":"Idle",P=()=>g?"⚙️":i>0?"⏳":D?"✅":"📊",q=g;return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`fixed bottom-4 right-4 z-9998 bg-white rounded-lg shadow-lg border-2 transition-all duration-200 border-gray-300 ${h?"min-w-[400px] max-w-[600px]":"w-auto"}`,style:$?{borderColor:"#005C75"}:{},children:[!h&&e.jsxs("div",{onClick:()=>{j(!0),N(!0),p(null)},className:"flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-gray-50 transition-colors rounded-lg",title:"Click to expand",children:[e.jsx("span",{className:`${q?"animate-spin":""}`,children:P()==="📊"?e.jsx(_,{style:{width:"20px",height:"20px",strokeWidth:1.5}}):P()==="✅"?e.jsx(O,{size:20,style:{color:"#10B981",strokeWidth:1.5}}):e.jsx("span",{className:"text-lg",children:P()})}),e.jsxs("span",{className:"text-sm font-medium text-gray-700",children:["Activity: ",Y()]})]}),h&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex justify-between items-center p-3 w-full",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>{j(!1),p(c?.id||null)},className:"p-1.5 bg-gray-100 text-gray-700 rounded-md hover:bg-gray-200 transition-colors shadow-sm flex items-center justify-center",title:"Collapse","aria-label":"Collapse notification",children:e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}),e.jsx("div",{className:`${g?"animate-spin":""}`,children:g?e.jsx("span",{className:"text-2xl",children:"⚙️"}):D?e.jsx(O,{size:24,style:{color:"#10B981",strokeWidth:1.5}}):e.jsx(_,{style:{width:"24px",height:"24px",strokeWidth:1.5}})}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("h3",{className:"text-sm font-bold text-gray-900 mb-1",children:g?T?"Capture in Progress":"Analysis in Progress":D?"Analysis Complete":"Activity"})})]}),e.jsx("div",{children:e.jsx("button",{onClick:()=>x(!0),className:"px-3 py-1.5 text-white rounded-md text-xs font-semibold transition-colors whitespace-nowrap",style:{backgroundColor:"#005C75"},onMouseEnter:n=>n.currentTarget.style.backgroundColor="#004560",onMouseLeave:n=>n.currentTarget.style.backgroundColor="#005C75",title:"View full analysis logs",children:"📋 View Logs"})})]}),e.jsxs("div",{className:"px-4 pb-4 border-t border-gray-200 pt-3",children:[!$&&!I&&e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-xs text-gray-600 mb-2",children:"No recent analysis activity. Start an analysis to see progress here."}),e.jsxs("div",{className:"text-xs text-gray-500 space-y-1",children:[e.jsx("div",{children:'• Click "Analyze" on any entity in the Git or Files view'}),e.jsxs("div",{children:["• Or run"," ",e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:"codeyam analyze"})," ","from the command line"]})]})]}),g&&T&&(t?.readyToBeCaptured??0)>0&&e.jsxs("div",{className:"mb-3 border rounded-md p-2",style:{backgroundColor:"#E8F4F8",borderColor:"#B3D9E8"},children:[e.jsx("p",{className:"text-xs font-semibold mb-1",style:{color:"#003D52"},children:"Capture Progress:"}),e.jsxs("p",{className:"text-xs",style:{color:"#005C75"},children:[t?.capturesCompleted??0," of"," ",t?.readyToBeCaptured??0," entities captured"]})]}),g&&b.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("p",{className:"text-xs font-semibold text-gray-700 mb-2",children:[c?"Analyzing":T?"Capturing":"Analyzing"," ",b.length===1?"Entity":"Entities",":"]}),e.jsx("div",{className:"space-y-1 max-h-[200px] overflow-y-auto",children:b.map(n=>e.jsxs(L,{to:`/entity/${n.sha}`,className:"block text-xs font-medium truncate hover:underline",style:{color:"#005C75"},title:`${n.name} - ${n.filePath}`,children:["📄 ",n.name,e.jsxs("span",{className:"text-gray-500 ml-1",children:["(",n.filePath,")"]})]},n.sha))})]}),g&&e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-xs font-semibold text-gray-700 mb-1",children:"Current Step:"}),e.jsx("p",{className:"text-xs font-mono text-gray-600 break-words",children:R||"Starting analysis..."})]}),a.length>0&&c&&e.jsxs("div",{className:"mb-3",children:[e.jsxs("p",{className:"text-xs font-semibold text-gray-700 mb-2",children:["Queued (",a.length,"):"]}),e.jsx("div",{className:"space-y-2 max-h-[150px] overflow-y-auto",children:a.map(n=>e.jsxs("div",{className:"space-y-1",children:[n.entities.length>0?n.entities.slice(0,2).map(u=>e.jsxs(L,{to:`/entity/${u.sha}`,className:"block text-xs font-medium truncate hover:underline",style:{color:"#005C75"},title:`${u.name} - ${u.filePath}`,children:["⏳ ",u.name,e.jsxs("span",{className:"text-gray-500 ml-1",children:["(",u.filePath,")"]})]},u.sha)):e.jsxs("div",{className:"text-xs text-gray-600 truncate",children:["⏳ ",n.entities.length," ",n.entities.length===1?"entity":"entities"]}),n.entities.length>2&&e.jsxs("div",{className:"text-xs text-gray-500 italic pl-4",children:["+",n.entities.length-2," more"]})]},n.id))})]}),I&&s.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("p",{className:"text-xs font-semibold text-gray-700 mb-2",children:"Recently Completed:"}),e.jsx("div",{className:"space-y-2",children:s.slice(0,3).map((n,u)=>{const d=n.entities||[];d.length||n.currentEntityShas?.length||n.entityCount;const y=n.analysisCompletedAt||n.archivedAt||n.createdAt||"",z=(()=>{if(!y)return"";const k=Date.now()-new Date(y).getTime(),B=Math.floor(k/6e4),H=Math.floor(k/36e5);return H>0?`${H}h ago`:B>0?`${B}m ago`:"just now"})();return e.jsx("div",{className:"text-xs bg-gray-50 rounded-md p-2",children:e.jsxs("div",{className:"flex justify-between items-start mb-1",children:[e.jsx("div",{children:d.length>0&&e.jsxs("div",{className:"text-gray-600 text-[10px] space-y-0.5",children:[d.slice(0,3).map(k=>e.jsxs("div",{className:"truncate",children:[e.jsxs(L,{to:`/entity/${k.sha}`,className:"hover:underline",style:{color:"#005C75"},children:["📄 ",k.name]}),e.jsxs("span",{className:"text-gray-500 ml-1",children:["(",k.filePath,")"]})]},k.sha)),d.length>3&&e.jsxs("div",{className:"text-gray-500",children:["+",d.length-3," more"]})]})}),e.jsx("div",{className:"text-gray-500 text-[10px]",children:z})]})},u)})})]}),e.jsx("div",{className:"mt-3 pt-3 border-t border-gray-200",children:e.jsx(L,{to:"/activity",className:"text-xs font-medium hover:underline",style:{color:"#005C75"},children:"View All Activity →"})})]})]})]}),f&&o&&e.jsx(de,{projectSlug:o,onClose:()=>x(!1)})]})}const Se="/assets/globals-Da3jt49-.css";function Te({text:t,subtext:o,linkText:l,linkTo:m}){const[i,a]=r.useState(!1);return i?null:e.jsx("div",{className:"bg-blue-100 border rounded border-blue-800 shadow-sm mx-6 mt-6",children:e.jsxs("div",{className:"max-w-7xl mx-auto px-4 py-3 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{className:"shrink-0",children:e.jsx("svg",{className:"w-5 h-5 text-yellow-600",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"text-sm font-medium text-blue-900",children:t}),e.jsx("p",{className:"text-xs text-blue-700 mt-0.5",children:o})]}),e.jsx(L,{to:m,className:"shrink-0 px-4 py-2 bg-blue-600 text-white text-sm font-medium rounded hover:bg-blue-700 transition-colors",children:l})]}),e.jsx("button",{type:"button",onClick:()=>a(!0),className:"shrink-0 ml-4 p-1 rounded text-blue-600 hover:text-blue-800 hover:bg-blue-100 transition-colors","aria-label":"Dismiss banner",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{d:"M6 18L18 6M6 6l12 12"})})})]})})}const _e=()=>[{rel:"stylesheet",href:Se},{rel:"icon",href:"/cy-logo-cli.svg"}];function Me(){const{currentRun:t,projectSlug:o,currentEntities:l,availableAPIKeys:m,queuedJobCount:i,queueJobs:a,currentlyExecuting:c,historicalRuns:s}=ne(),{toasts:f,closeToast:x}=le(),h=ie(),j=r.useRef(h),w=W();r.useEffect(()=>{j.current=h},[h]);const N=w.pathname.startsWith("/entity/")&&w.pathname.includes("/edit/")||w.pathname.startsWith("/dev/");return r.useEffect(()=>{const v=new EventSource("/api/events");let p=null,C=0;const E=2e3;return v.addEventListener("message",b=>{if(JSON.parse(b.data).type==="db-change"){const M=Date.now(),A=M-C;A<E?(p&&clearTimeout(p),p=setTimeout(()=>{j.current.revalidate(),C=Date.now(),p=null},E-A)):(j.current.revalidate(),C=M)}}),v.addEventListener("error",b=>{console.error("SSE connection error:",b)}),()=>{p&&clearTimeout(p),v.close()}},[]),e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:`min-h-screen ${N?"":"grid"} bg-cygray-10`,style:N?void 0:{gridTemplateColumns:"96px minmax(900px, 1fr)"},children:[!N&&e.jsx(Ne,{}),e.jsxs("div",{className:"max-h-screen overflow-auto bg-white",children:[m.length===0&&e.jsx(Te,{text:"No AI API keys configured. Please provide an AI API key at your earliest convenience.",subtext:"An API key is required for stable, frequent use of CodeYam",linkText:"Configure API Keys",linkTo:"/settings"}),e.jsx(ae,{})]})]}),e.jsx(Ae,{toasts:f,onClose:x}),e.jsx(Le,{currentRun:t,projectSlug:o,currentEntities:l,isAnalysisStarting:!1,queuedJobCount:i,queueJobs:a,currentlyExecuting:c,historicalRuns:s})]})}function We(){return e.jsxs("html",{lang:"en",children:[e.jsxs("head",{children:[e.jsx("meta",{charSet:"utf-8"}),e.jsx("meta",{name:"viewport",content:"width=device-width,initial-scale=1"}),e.jsx(U,{}),e.jsx(ee,{})]}),e.jsxs("body",{children:[e.jsx(re,{children:e.jsx(Me,{})}),e.jsx(me,{}),e.jsx(te,{}),e.jsx(se,{})]})]})}export{We as default,_e as links};
@@ -1 +0,0 @@
1
- import{c}from"./createLucideIcon-CgyOwWip.js";const o=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],r=c("chevron-down",o);const e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],s=c("search",e);export{r as C,s as S};
@@ -1 +0,0 @@
1
- import{c}from"./createLucideIcon-CgyOwWip.js";const e=[["path",{d:"M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915",key:"1i5ecw"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],o=c("settings",e);export{o as S};
@@ -1 +0,0 @@
1
- import{j as e,u as P,r as n,L as w,a as E,b as $}from"./components-CAx5ONX_.js";import{S as A}from"./SafeScreenshot-xwuhwsZH.js";import{g as M}from"./entityVersioning-DO2gCvXv.js";import{I as F,E as D}from"./EntityTypeIcon-GqWwt5wG.js";import{C as U,S as _}from"./search-CvyP_1Lo.js";import{c as C}from"./createLucideIcon-CgyOwWip.js";import"./chart-column-B2I7jQx2.js";const R=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],O=C("chevron-left",R);const V=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],k=C("chevron-right",V);const B=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],K=C("x",B);function Q({entity:t,variant:o="default"}){const l=M(t),{badge:h,hasOutdatedSimulations:r}=l;return o==="compact"?r?e.jsx("div",{className:"bg-yellow-50 px-2 py-1 rounded text-[10px] font-medium text-yellow-700",children:"Out of date"}):e.jsxs("div",{className:"flex items-center gap-1.5 bg-green-50 px-2 py-1 rounded text-[10px] font-medium text-green-700",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-green-500"}),"Up to date"]}):e.jsxs("div",{className:`flex items-center gap-2 px-[15px] py-0 h-[26px] ${h.bgColor} rounded`,children:[e.jsx("div",{className:`w-2 h-2 rounded-full ${r?"bg-amber-500":"bg-green-500"}`}),e.jsx("span",{className:`text-xs font-semibold ${h.color}`,children:r?"Out of date":"Up to date"})]})}const se=()=>[{title:"Simulations - CodeYam"},{name:"description",content:"A visual gallery of your recently captured component screenshots"}];function ae(){const o=P().entities,[l,h]=n.useState(""),[r,p]=n.useState("visual"),[i,c]=n.useState(null),m=n.useMemo(()=>{const s=[];return o.forEach(a=>{const d=a.analyses?.[0];if(d?.scenarios){const x=d.scenarios.filter(g=>g.metadata?.screenshotPaths?.[0]).map(g=>({scenarioName:g.name,scenarioDescription:g.description||"",screenshotPath:g.metadata?.screenshotPaths?.[0]||"",scenarioId:g.id}));x.length>0&&s.push({entity:a,screenshots:x,createdAt:d.createdAt||""})}}),s.sort((a,d)=>new Date(d.createdAt).getTime()-new Date(a.createdAt).getTime()),s},[o]),y=n.useMemo(()=>o.filter(s=>!s.analyses?.[0]?.scenarios?.some(x=>x.metadata?.screenshotPaths?.[0])),[o]),f=n.useMemo(()=>m.filter(({entity:s})=>{const a=!l||s.name.toLowerCase().includes(l.toLowerCase()),d=r==="all"||s.entityType===r;return a&&d}),[m,l,r]),S=n.useMemo(()=>y.filter(s=>{const a=!l||s.name.toLowerCase().includes(l.toLowerCase()),d=r==="all"||s.entityType===r;return a&&d}),[y,l,r]),u=n.useMemo(()=>{const s=[];return f.forEach(({entity:a,screenshots:d})=>{d.forEach(x=>{s.push({entitySha:a.sha,entityName:a.name,scenarioId:x.scenarioId||"",scenarioName:x.scenarioName,scenarioDescription:x.scenarioDescription,screenshotPath:x.screenshotPath})})}),s},[f]),I=n.useCallback(s=>{h(s.target.value)},[]),L=n.useCallback(s=>{p(s.target.value)},[]),z=n.useCallback((s,a)=>{const d=u.findIndex(x=>x.entitySha===s&&x.scenarioId===a);d!==-1&&c(d)},[u]),b=n.useCallback(()=>{c(null)},[]),v=n.useCallback(()=>{c(s=>s===null||s===0?u.length-1:s-1)},[u.length]),j=n.useCallback(()=>{c(s=>s===null?0:(s+1)%u.length)},[u.length]);n.useEffect(()=>{if(i===null)return;const s=a=>{a.key==="Escape"?b():a.key==="ArrowLeft"?v():a.key==="ArrowRight"&&j()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[i,b,v,j]);const N=m.length>0,T=i!==null?u[i]:null;return e.jsxs("div",{className:"bg-[#f9f9f9] min-h-screen overflow-y-auto",children:[e.jsxs("div",{className:"px-36 py-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-bold text-gray-900 m-0",children:"Simulations"}),e.jsx("p",{className:"text-sm text-gray-600 mt-2",children:"All recently captured simulations."})]}),!N&&e.jsxs("div",{className:"rounded-lg px-5 py-6 mb-6 flex items-center gap-4",style:{backgroundColor:"#F0F5F8"},children:[e.jsx("div",{className:"w-9 h-9 rounded flex items-center justify-center shrink-0",style:{backgroundColor:"#005C75"},children:e.jsx(F,{className:"w-5 h-5 text-white"})}),e.jsxs("div",{children:[e.jsx("p",{className:"text-sm m-0 mb-1",style:{color:"#005C75"},children:"This page will display a visual gallery of your recently captured component screenshots."}),e.jsx("p",{className:"text-sm font-semibold m-0",style:{color:"#005C75"},children:"Start by analyzing your first component below."})]})]}),e.jsxs("div",{className:"bg-white border-b border-gray-200 rounded-t-lg px-5 py-4 mb-6",children:[e.jsx("div",{className:"text-[10px] text-gray-500 mb-2 uppercase",children:"Filters"}),e.jsxs("div",{className:"flex gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsxs("select",{className:"appearance-none bg-gray-50 border border-gray-200 rounded px-3 py-2 pr-8 text-sm cursor-pointer focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] hover:border-gray-300 transition-colors",value:r,onChange:L,children:[e.jsx("option",{value:"all",children:"All Types"}),e.jsx("option",{value:"visual",children:"Visual"}),e.jsx("option",{value:"library",children:"Library"})]}),e.jsx(U,{className:"absolute right-2 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-500 pointer-events-none"})]}),e.jsxs("div",{className:"flex-1 relative",children:[e.jsx(_,{className:"absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400"}),e.jsx("input",{type:"text",placeholder:"Search component",className:"w-full bg-gray-50 border border-gray-200 rounded pl-9 pr-3 py-2 text-sm placeholder:text-gray-400 focus:outline-none focus:ring-0 focus:border-2 focus:border-[#005c75] transition-colors",value:l,onChange:I})]})]})]}),e.jsxs("div",{className:"flex flex-col gap-3",children:[N&&(f.length===0?e.jsx("div",{className:"bg-white border border-gray-200 rounded-b-lg p-8 text-center text-gray-500",children:"No simulations match your filters."}):e.jsxs(e.Fragment,{children:[f.map(({entity:s,screenshots:a})=>e.jsx(q,{entity:s,screenshots:a,onScreenshotClick:z},s.sha)),e.jsx("div",{className:"bg-white border-x border-b border-gray-200 rounded-b-lg px-5 py-4 text-center",children:e.jsx(w,{to:"/files?entityType=visual",className:"text-sm text-[#005c75] hover:text-[#004a5e] hover:underline",children:"Find more entities to simulate →"})})]})),!N&&(S.length===0?e.jsx("div",{className:"bg-white border border-gray-200 rounded-b-lg p-8 text-center text-gray-500",children:"No components found matching your filters."}):S.map(s=>e.jsx(X,{entity:s},s.sha)))]})]}),T&&e.jsx(W,{screenshot:T,currentIndex:i,totalCount:u.length,onClose:b,onPrevious:v,onNext:j})]})}function W({screenshot:t,currentIndex:o,totalCount:l,onClose:h,onPrevious:r,onNext:p}){const i=E(),[c,m]=n.useState(!1),y=()=>{i(`/entity/${t.entitySha}/scenarios/${t.scenarioId}?from=simulations`)};return e.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80",onClick:h,children:e.jsxs("div",{className:"relative flex flex-col w-[90vw] h-[90vh] max-w-[1400px] bg-white rounded-lg overflow-hidden",onClick:f=>f.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-gray-200 bg-gray-50 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm text-gray-500",children:[o+1," of ",l]}),e.jsx("span",{className:"text-gray-300",children:"|"}),e.jsx("span",{className:"text-sm font-medium text-gray-700",children:t.entityName})]}),e.jsx("button",{onClick:h,className:"p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-200 rounded-full transition-colors cursor-pointer",children:e.jsx(K,{className:"w-5 h-5"})})]}),e.jsxs("div",{className:"relative flex-1 flex items-center justify-center p-6 bg-gray-100 overflow-hidden",onMouseEnter:()=>m(!0),onMouseLeave:()=>m(!1),children:[e.jsx("button",{onClick:r,className:`absolute left-4 z-10 p-3 bg-white/90 hover:bg-white rounded-full shadow-lg transition-all cursor-pointer ${c?"opacity-100":"opacity-0"}`,children:e.jsx(O,{className:"w-6 h-6 text-gray-700"})}),e.jsx("div",{className:"flex items-center justify-center w-full h-full cursor-pointer",onClick:y,children:e.jsx(A,{screenshotPath:t.screenshotPath,alt:t.scenarioName,className:"max-w-full max-h-full object-contain rounded-lg shadow-lg"})}),e.jsx("button",{onClick:p,className:`absolute right-4 z-10 p-3 bg-white/90 hover:bg-white rounded-full shadow-lg transition-all cursor-pointer ${c?"opacity-100":"opacity-0"}`,children:e.jsx(k,{className:"w-6 h-6 text-gray-700"})})]}),e.jsxs("div",{className:"px-6 py-4 border-t border-gray-200 bg-white cursor-pointer hover:bg-gray-50 transition-colors shrink-0",onClick:y,children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-lg font-semibold text-[#005c75] hover:text-[#004a5e] m-0 mb-1",children:t.scenarioName}),e.jsx("p",{className:"text-sm text-gray-600 m-0 line-clamp-2 min-h-10",children:t.scenarioDescription||" "})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-1 text-sm text-[#005c75]",children:[e.jsx("span",{children:"View details"}),e.jsx(k,{className:"w-4 h-4"})]})]}),e.jsx("p",{className:"text-xs text-gray-400 mt-2 m-0",children:"Click to view this scenario in the entity page"})]})]})})}function q({entity:t,screenshots:o,onScreenshotClick:l}){const h=E();t.entityType;const r=o.length||(t.analyses?.[0]?.scenarios?.length??0),p=i=>{h(`/entity/${t.sha}/scenarios/${i}?from=simulations`)};return e.jsx("div",{className:"bg-white border-x border-b border-gray-200 first:border-t last:rounded-b-lg hover:bg-gray-100 transition-colors",children:e.jsxs("div",{className:"px-5 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs(w,{to:`/entity/${t.sha}`,className:"flex items-center gap-2 no-underline",children:[e.jsx(D,{type:t.entityType}),e.jsxs("span",{className:"text-xs font-medium text-gray-800",children:[t.name," (",r,")"]})]}),e.jsx(Q,{entity:t,variant:"compact"})]}),e.jsx("div",{className:"flex gap-2.5 mt-3 overflow-x-auto pb-1",children:o.length>0?o.map(i=>e.jsx("button",{onClick:()=>p(i.scenarioId||""),className:"shrink-0 block cursor-pointer bg-transparent border-none p-0",children:e.jsx("div",{className:"w-36 h-24 rounded-md border border-gray-200 overflow-hidden bg-gray-100 flex items-center justify-center transition-all",style:{"--hover-border":"#005C75"},onMouseEnter:c=>{c.currentTarget.style.borderColor="#005C75",c.currentTarget.style.boxShadow="0 4px 12px rgba(0, 92, 117, 0.15)"},onMouseLeave:c=>{c.currentTarget.style.borderColor="#d1d5db",c.currentTarget.style.boxShadow="none"},children:e.jsx(A,{screenshotPath:i.screenshotPath,alt:i.scenarioName,className:"max-w-full max-h-full object-contain"})})},i.scenarioId)):e.jsx("div",{className:"text-xs text-gray-400 py-4",children:"No screenshots available"})})]})})}function X({entity:t}){const o=$(),[l,h]=n.useState(!1);t.entityType;const r=()=>{h(!0),o.submit({entitySha:t.sha,filePath:t.filePath||""},{method:"post",action:"/api/analyze"})};n.useEffect(()=>{o.state==="idle"&&l&&h(!1)},[o.state,l]);const p=i=>{if(!i)return"";const c=new Date(i),m=new Date;return c.toDateString()===m.toDateString()?`Today, ${c.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0}).toLowerCase()}`:c.toLocaleDateString("en-US",{month:"short",day:"numeric"})};return e.jsx("div",{className:"bg-white border-x border-b border-gray-200 first:border-t last:rounded-b-lg hover:bg-gray-100 transition-colors cursor-pointer",onClick:r,children:e.jsxs("div",{className:"px-5 py-4 flex items-center",children:[e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx(D,{type:t.entityType}),e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-3 mb-0.5",children:[e.jsx(w,{to:`/entity/${t.sha}`,className:"text-sm font-medium text-gray-900 no-underline",children:t.name}),e.jsx("span",{className:"text-[10px] font-semibold px-1 py-0.5 rounded",style:{color:t.entityType==="visual"?"#7c3aed":t.entityType==="library"?"#0DBFE9":t.entityType==="type"?"#dc2626":t.entityType==="data"?"#2563eb":t.entityType==="index"?"#ea580c":t.entityType==="functionCall"?"#7c3aed":t.entityType==="class"?"#059669":t.entityType==="method"?"#0891b2":"#6b7280",backgroundColor:t.entityType==="visual"?"#f3e8ff":t.entityType==="library"?"#cffafe":t.entityType==="type"?"#fee2e2":t.entityType==="data"?"#dbeafe":t.entityType==="index"?"#ffedd5":t.entityType==="functionCall"?"#f3e8ff":t.entityType==="class"?"#d1fae5":t.entityType==="method"?"#cffafe":"#f3f4f6"},children:t.entityType?t.entityType.toUpperCase():"UNKNOWN"})]}),e.jsx("div",{className:"text-xs text-gray-400 truncate",children:t.filePath})]})]}),e.jsx("div",{className:"w-32 flex justify-center",children:e.jsx("span",{className:"text-[10px] text-gray-500 bg-gray-100 px-2 py-1 rounded",children:"Not analyzed"})}),e.jsx("div",{className:"w-32 text-center text-[10px] text-gray-500",children:p(t.createdAt)}),e.jsx("div",{className:"w-24 flex justify-end",children:e.jsx("button",{onClick:r,disabled:l||o.state!=="idle",className:"bg-[#e0e9ec] text-[#005c75] px-4 py-1.5 rounded text-[10px] font-medium hover:bg-[#d0dde1] transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",children:l?"Analyzing...":"Analyze"})})]})})}export{ae as default,se as meta};
@@ -1 +0,0 @@
1
- import{c as m}from"./createLucideIcon-CgyOwWip.js";import{r as t,j as x}from"./components-CAx5ONX_.js";const T=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],k=m("circle-check",T),r=t.createContext(void 0);function p({children:o}){const[n,c]=t.useState([]),i=t.useCallback((s,e="info",a=5e3)=>{const d={id:`toast-${Date.now()}-${Math.random()}`,message:s,type:e,duration:a};c(l=>[...l,d])},[]),u=t.useCallback(s=>{c(e=>e.filter(a=>a.id!==s))},[]);return x.jsx(r.Provider,{value:{toasts:n,showToast:i,closeToast:u},children:o})}function v(){const o=t.useContext(r);if(!o)throw new Error("useToast must be used within a ToastProvider");return o}export{k as C,p as T,v as u};
@@ -1 +0,0 @@
1
- import{c as a}from"./createLucideIcon-CgyOwWip.js";const o=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],e=a("zap",o);export{e as Z};