@codeyam/codeyam-cli 0.1.0-staging.596f0eb → 0.1.0-staging.76566f9

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 (354) hide show
  1. package/analyzer-template/.build-info.json +7 -7
  2. package/analyzer-template/log.txt +3 -3
  3. package/analyzer-template/package.json +2 -1
  4. package/analyzer-template/packages/ai/src/lib/analyzeScope.ts +2 -0
  5. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +22 -0
  6. package/analyzer-template/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.ts +23 -1
  7. package/analyzer-template/packages/ai/src/lib/astScopes/processExpression.ts +401 -106
  8. package/analyzer-template/packages/ai/src/lib/astScopes/types.ts +60 -0
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +734 -45
  10. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.ts +2 -1
  11. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.ts +715 -0
  12. package/analyzer-template/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.ts +233 -75
  13. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.ts +19 -1
  14. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.ts +34 -1
  15. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.ts +23 -0
  16. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.ts +98 -0
  17. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.ts +34 -1
  18. package/analyzer-template/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.ts +236 -24
  19. package/analyzer-template/packages/ai/src/lib/generateChangesEntityKeyAttributes.ts +18 -1
  20. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarioData.ts +41 -0
  21. package/analyzer-template/packages/ai/src/lib/generateChangesEntityScenarios.ts +37 -4
  22. package/analyzer-template/packages/ai/src/lib/generateEntityDataStructure.ts +5 -0
  23. package/analyzer-template/packages/ai/src/lib/generateEntityKeyAttributes.ts +213 -12
  24. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +36 -25
  25. package/analyzer-template/packages/ai/src/lib/generateEntityScenarios.ts +114 -11
  26. package/analyzer-template/packages/ai/src/lib/getConditionalUsagesFromCode.ts +143 -31
  27. package/analyzer-template/packages/ai/src/lib/guessScenarioDataFromDescription.ts +8 -2
  28. package/analyzer-template/packages/ai/src/lib/promptGenerators/gatherAttributesMap.ts +7 -0
  29. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.ts +42 -2
  30. package/analyzer-template/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.ts +38 -2
  31. package/analyzer-template/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.ts +28 -2
  32. package/analyzer-template/packages/ai/src/lib/worker/SerializableDataStructure.ts +5 -0
  33. package/analyzer-template/packages/ai/src/lib/worker/analyzeScopeWorker.ts +8 -1
  34. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.ts +127 -43
  35. package/analyzer-template/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.ts +158 -0
  36. package/analyzer-template/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.ts +405 -45
  37. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.ts +1 -1
  38. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +260 -133
  39. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.ts +10 -5
  40. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarioData.ts +77 -83
  41. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateScenarios.ts +2 -5
  42. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +196 -86
  43. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts +15 -0
  44. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.d.ts.map +1 -0
  45. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js +31 -0
  46. package/analyzer-template/packages/aws/dist/src/lib/s3/checkS3ObjectExists.js.map +1 -0
  47. package/analyzer-template/packages/aws/package.json +1 -1
  48. package/analyzer-template/packages/aws/s3/index.ts +1 -0
  49. package/analyzer-template/packages/aws/src/lib/s3/checkS3ObjectExists.ts +47 -0
  50. package/analyzer-template/packages/database/src/lib/kysely/db.ts +4 -4
  51. package/analyzer-template/packages/database/src/lib/kysely/tableRelations.ts +2 -2
  52. package/analyzer-template/packages/database/src/lib/kysely/tables/debugReportsTable.ts +20 -9
  53. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +9 -4
  54. package/analyzer-template/packages/generate/src/lib/deepMerge.ts +26 -1
  55. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -2
  56. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +2 -2
  57. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tableRelations.d.ts +2 -2
  58. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts +8 -1
  59. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/analysesTable.d.ts.map +1 -1
  60. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts +14 -7
  61. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.d.ts.map +1 -1
  62. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  63. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  64. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +1 -1
  65. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  66. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  67. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  68. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  69. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.d.ts.map +1 -1
  70. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js +27 -1
  71. package/analyzer-template/packages/github/dist/generate/src/lib/deepMerge.js.map +1 -1
  72. package/analyzer-template/packages/github/dist/types/index.d.ts +4 -3
  73. package/analyzer-template/packages/github/dist/types/index.d.ts.map +1 -1
  74. package/analyzer-template/packages/github/dist/types/index.js +1 -0
  75. package/analyzer-template/packages/github/dist/types/index.js.map +1 -1
  76. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts +31 -1
  77. package/analyzer-template/packages/github/dist/types/src/types/Analysis.d.ts.map +1 -1
  78. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +51 -1
  79. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  80. package/analyzer-template/packages/github/dist/types/src/types/Scenario.js +21 -1
  81. package/analyzer-template/packages/github/dist/types/src/types/Scenario.js.map +1 -1
  82. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts +48 -0
  83. package/analyzer-template/packages/github/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  84. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  85. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  86. package/analyzer-template/packages/github/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  87. package/analyzer-template/packages/types/index.ts +8 -0
  88. package/analyzer-template/packages/types/src/types/Analysis.ts +32 -1
  89. package/analyzer-template/packages/types/src/types/Scenario.ts +75 -6
  90. package/analyzer-template/packages/types/src/types/ScenariosDataStructure.ts +49 -0
  91. package/analyzer-template/packages/ui-components/src/components/ScenarioDetailInteractiveView.tsx +23 -7
  92. package/analyzer-template/packages/utils/dist/types/index.d.ts +4 -3
  93. package/analyzer-template/packages/utils/dist/types/index.d.ts.map +1 -1
  94. package/analyzer-template/packages/utils/dist/types/index.js +1 -0
  95. package/analyzer-template/packages/utils/dist/types/index.js.map +1 -1
  96. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts +31 -1
  97. package/analyzer-template/packages/utils/dist/types/src/types/Analysis.d.ts.map +1 -1
  98. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +51 -1
  99. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  100. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js +21 -1
  101. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.js.map +1 -1
  102. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts +48 -0
  103. package/analyzer-template/packages/utils/dist/types/src/types/ScenariosDataStructure.d.ts.map +1 -1
  104. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.d.ts.map +1 -1
  105. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js +25 -0
  106. package/analyzer-template/packages/utils/dist/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  107. package/analyzer-template/packages/utils/src/lib/lightweightEntityExtractor.ts +27 -0
  108. package/analyzer-template/playwright/takeElementScreenshot.ts +26 -11
  109. package/analyzer-template/playwright/takeScreenshot.ts +9 -7
  110. package/analyzer-template/project/constructMockCode.ts +286 -84
  111. package/analyzer-template/project/orchestrateCapture/SequentialCaptureTaskRunner.ts +77 -37
  112. package/analyzer-template/project/reconcileMockDataKeys.ts +5 -2
  113. package/analyzer-template/project/runMultiScenarioServer.ts +11 -10
  114. package/analyzer-template/project/serverOnlyModules.ts +71 -23
  115. package/analyzer-template/project/start.ts +10 -0
  116. package/analyzer-template/project/startScenarioCapture.ts +73 -41
  117. package/analyzer-template/project/writeMockDataTsx.ts +115 -54
  118. package/analyzer-template/project/writeScenarioComponents.ts +571 -162
  119. package/analyzer-template/project/writeSimpleRoot.ts +11 -13
  120. package/background/src/lib/virtualized/project/constructMockCode.js +265 -75
  121. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  122. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js +67 -32
  123. package/background/src/lib/virtualized/project/orchestrateCapture/SequentialCaptureTaskRunner.js.map +1 -1
  124. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +5 -2
  125. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  126. package/background/src/lib/virtualized/project/runMultiScenarioServer.js +11 -9
  127. package/background/src/lib/virtualized/project/runMultiScenarioServer.js.map +1 -1
  128. package/background/src/lib/virtualized/project/serverOnlyModules.js +62 -25
  129. package/background/src/lib/virtualized/project/serverOnlyModules.js.map +1 -1
  130. package/background/src/lib/virtualized/project/start.js +6 -0
  131. package/background/src/lib/virtualized/project/start.js.map +1 -1
  132. package/background/src/lib/virtualized/project/startScenarioCapture.js +54 -31
  133. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  134. package/background/src/lib/virtualized/project/writeMockDataTsx.js +106 -46
  135. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  136. package/background/src/lib/virtualized/project/writeScenarioComponents.js +399 -106
  137. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  138. package/background/src/lib/virtualized/project/writeSimpleRoot.js +11 -11
  139. package/background/src/lib/virtualized/project/writeSimpleRoot.js.map +1 -1
  140. package/codeyam-cli/src/cli.js +2 -0
  141. package/codeyam-cli/src/cli.js.map +1 -1
  142. package/codeyam-cli/src/commands/debug.js +14 -2
  143. package/codeyam-cli/src/commands/debug.js.map +1 -1
  144. package/codeyam-cli/src/commands/recapture.js +215 -0
  145. package/codeyam-cli/src/commands/recapture.js.map +1 -0
  146. package/codeyam-cli/src/commands/report.js +26 -23
  147. package/codeyam-cli/src/commands/report.js.map +1 -1
  148. package/codeyam-cli/src/utils/backgroundServer.js +2 -2
  149. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  150. package/codeyam-cli/src/utils/generateReport.js +252 -106
  151. package/codeyam-cli/src/utils/generateReport.js.map +1 -1
  152. package/codeyam-cli/src/utils/install-skills.js +2 -2
  153. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  154. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +38 -0
  155. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  156. package/codeyam-cli/src/utils/queue/job.js +140 -16
  157. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  158. package/codeyam-cli/src/utils/queue/manager.js +19 -7
  159. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  160. package/codeyam-cli/src/utils/queue/persistence.js.map +1 -1
  161. package/codeyam-cli/src/webserver/app/lib/database.js +47 -0
  162. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  163. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  164. package/codeyam-cli/src/webserver/backgroundServer.js +5 -10
  165. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  166. package/codeyam-cli/src/webserver/bootstrap.js +9 -0
  167. package/codeyam-cli/src/webserver/bootstrap.js.map +1 -0
  168. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-wXL1Z2Aq.js +1 -0
  169. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-efWKDYMr.js → EntityTypeBadge-CzGX-miz.js} +1 -1
  170. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-CXFKsCOD.js +41 -0
  171. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-D-9pXIaY.js +25 -0
  172. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-CBQPrpT0.js +3 -0
  173. package/codeyam-cli/src/webserver/build/client/assets/LoadingDots-D1CdlbrV.js +6 -0
  174. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-wDPcZNKx.js +3 -0
  175. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-4lcOlid-.js +11 -0
  176. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-BfmDgXxG.js +1 -0
  177. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-CUxUNEEC.js +15 -0
  178. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-COPstp9J.js → TruncatedFilePath-6J7zDUD5.js} +1 -1
  179. package/codeyam-cli/src/webserver/build/client/assets/_index-DHImXdXq.js +11 -0
  180. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-CVP_WGQ3.js +32 -0
  181. package/codeyam-cli/src/webserver/build/client/assets/api.link-scenario-value-l0sNRNKZ.js +1 -0
  182. package/codeyam-cli/src/webserver/build/client/assets/api.update-key-attributes-l0sNRNKZ.js +1 -0
  183. package/codeyam-cli/src/webserver/build/client/assets/api.update-valid-values-l0sNRNKZ.js +1 -0
  184. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-BYimnrHg.js +6 -0
  185. package/codeyam-cli/src/webserver/build/client/assets/chunk-JMJ3UQ3L-BambyYE_.js +51 -0
  186. package/codeyam-cli/src/webserver/build/client/assets/circle-check-CaVsIRxt.js +6 -0
  187. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CgUsG7ib.js +21 -0
  188. package/codeyam-cli/src/webserver/build/client/assets/cy-logo-cli-CKnwPCDr.js +1 -0
  189. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DW_hdGUc.js +1 -0
  190. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-Dt-SjPsw.js +23 -0
  191. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DyB90fWk.js +1 -0
  192. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-D_3ero5o.js +1 -0
  193. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-CfLCUi9S.js +5 -0
  194. package/codeyam-cli/src/webserver/build/client/assets/entry.client-DKJyZfAY.js +29 -0
  195. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-DAtOlaWE.js +1 -0
  196. package/codeyam-cli/src/webserver/build/client/assets/files-ClR0d32A.js +1 -0
  197. package/codeyam-cli/src/webserver/build/client/assets/git-D62Lxxmv.js +15 -0
  198. package/codeyam-cli/src/webserver/build/client/assets/globals-C9s7Lhdl.css +1 -0
  199. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-fmIEn3Bc.js +9 -0
  200. package/codeyam-cli/src/webserver/build/client/assets/index-BosqDOlH.js +3 -0
  201. package/codeyam-cli/src/webserver/build/client/assets/index-CzNNiTkw.js +9 -0
  202. package/codeyam-cli/src/webserver/build/client/assets/keyAttributeCoverage-CTlFMihX.js +1 -0
  203. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-CNp9QFCX.js +6 -0
  204. package/codeyam-cli/src/webserver/build/client/assets/manifest-0d27da29.js +1 -0
  205. package/codeyam-cli/src/webserver/build/client/assets/preload-helper-ckwbz45p.js +1 -0
  206. package/codeyam-cli/src/webserver/build/client/assets/root-B_wIKCIf.js +56 -0
  207. package/codeyam-cli/src/webserver/build/client/assets/scenarioStatus-B_8jpV3e.js +1 -0
  208. package/codeyam-cli/src/webserver/build/client/assets/search-DDGjYAMJ.js +6 -0
  209. package/codeyam-cli/src/webserver/build/client/assets/settings-DgTyB-Wg.js +1 -0
  210. package/codeyam-cli/src/webserver/build/client/assets/simulations-CoNWGt0K.js +1 -0
  211. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-CBc5dE1s.js +6 -0
  212. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-BMIGFP-m.js +1 -0
  213. package/codeyam-cli/src/webserver/build/client/assets/useInteractiveMode-Dk_FQqWJ.js +1 -0
  214. package/codeyam-cli/src/webserver/build/client/assets/{useLastLogLine-3pmpUQB-.js → useLastLogLine-BqPPNjAl.js} +1 -1
  215. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-DsJbgMY9.js +1 -0
  216. package/codeyam-cli/src/webserver/build/client/assets/{useToast-DEyawJ8r.js → useToast-DWHcCcl1.js} +1 -1
  217. package/codeyam-cli/src/webserver/build/server/assets/index-CU58-Ttc.js +1 -0
  218. package/codeyam-cli/src/webserver/build/server/assets/server-build-D35o2uae.js +175 -0
  219. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  220. package/codeyam-cli/src/webserver/build-info.json +5 -5
  221. package/codeyam-cli/src/webserver/devServer.js +1 -3
  222. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  223. package/codeyam-cli/templates/codeyam-setup-skill.md +138 -3
  224. package/codeyam-cli/templates/debug-codeyam.md +625 -0
  225. package/package.json +14 -14
  226. package/packages/ai/src/lib/analyzeScope.js +2 -0
  227. package/packages/ai/src/lib/analyzeScope.js.map +1 -1
  228. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +16 -0
  229. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  230. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js +16 -0
  231. package/packages/ai/src/lib/astScopes/patterns/switchStatementHandler.js.map +1 -1
  232. package/packages/ai/src/lib/astScopes/processExpression.js +305 -88
  233. package/packages/ai/src/lib/astScopes/processExpression.js.map +1 -1
  234. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +582 -41
  235. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  236. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js +2 -1
  237. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/JavascriptFrameworkManager.js.map +1 -1
  238. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js +454 -0
  239. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/MuiManager.js.map +1 -0
  240. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js +173 -55
  241. package/packages/ai/src/lib/dataStructure/equivalencyManagers/frameworks/ReactFrameworkManager.js.map +1 -1
  242. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js +16 -1
  243. package/packages/ai/src/lib/dataStructure/helpers/cleanKnownObjectFunctions.js.map +1 -1
  244. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js +30 -1
  245. package/packages/ai/src/lib/dataStructure/helpers/cleanNonObjectFunctions.js.map +1 -1
  246. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js +20 -0
  247. package/packages/ai/src/lib/dataStructure/helpers/convertDotNotation.js.map +1 -1
  248. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js +86 -0
  249. package/packages/ai/src/lib/dataStructure/helpers/convertNullToUndefinedBySchema.js.map +1 -0
  250. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js +28 -2
  251. package/packages/ai/src/lib/dataStructure/helpers/fillInSchemaGapsAndUnknowns.js.map +1 -1
  252. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js +179 -17
  253. package/packages/ai/src/lib/gatherRelevantDependentKeyAttributes.js.map +1 -1
  254. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js +6 -0
  255. package/packages/ai/src/lib/generateChangesEntityKeyAttributes.js.map +1 -1
  256. package/packages/ai/src/lib/generateChangesEntityScenarioData.js +41 -0
  257. package/packages/ai/src/lib/generateChangesEntityScenarioData.js.map +1 -1
  258. package/packages/ai/src/lib/generateChangesEntityScenarios.js +37 -4
  259. package/packages/ai/src/lib/generateChangesEntityScenarios.js.map +1 -1
  260. package/packages/ai/src/lib/generateEntityDataStructure.js +4 -0
  261. package/packages/ai/src/lib/generateEntityDataStructure.js.map +1 -1
  262. package/packages/ai/src/lib/generateEntityKeyAttributes.js +176 -9
  263. package/packages/ai/src/lib/generateEntityKeyAttributes.js.map +1 -1
  264. package/packages/ai/src/lib/generateEntityScenarioData.js +29 -25
  265. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  266. package/packages/ai/src/lib/generateEntityScenarios.js +105 -9
  267. package/packages/ai/src/lib/generateEntityScenarios.js.map +1 -1
  268. package/packages/ai/src/lib/getConditionalUsagesFromCode.js +84 -14
  269. package/packages/ai/src/lib/getConditionalUsagesFromCode.js.map +1 -1
  270. package/packages/ai/src/lib/guessScenarioDataFromDescription.js +2 -1
  271. package/packages/ai/src/lib/guessScenarioDataFromDescription.js.map +1 -1
  272. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js +6 -0
  273. package/packages/ai/src/lib/promptGenerators/gatherAttributesMap.js.map +1 -1
  274. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js +38 -2
  275. package/packages/ai/src/lib/promptGenerators/generateChangesEntityScenariosGenerator.js.map +1 -1
  276. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js +38 -2
  277. package/packages/ai/src/lib/promptGenerators/generateEntityScenariosGenerator.js.map +1 -1
  278. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js +16 -3
  279. package/packages/ai/src/lib/promptGenerators/guessNewScenarioDataFromDescriptionGenerator.js.map +1 -1
  280. package/packages/ai/src/lib/worker/SerializableDataStructure.js.map +1 -1
  281. package/packages/ai/src/lib/worker/analyzeScopeWorker.js +4 -0
  282. package/packages/ai/src/lib/worker/analyzeScopeWorker.js.map +1 -1
  283. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js +100 -23
  284. package/packages/analyze/src/lib/files/analyze/analyzeEntities/prepareDataStructures.js.map +1 -1
  285. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js +125 -0
  286. package/packages/analyze/src/lib/files/scenarios/enrichArrayTypesFromChildSignatures.js.map +1 -0
  287. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js +298 -45
  288. package/packages/analyze/src/lib/files/scenarios/gatherDataForMocks.js.map +1 -1
  289. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js +1 -1
  290. package/packages/analyze/src/lib/files/scenarios/generateChangesScenarioData.js.map +1 -1
  291. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +201 -80
  292. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  293. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js +10 -5
  294. package/packages/analyze/src/lib/files/scenarios/generateKeyAttributes.js.map +1 -1
  295. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js +55 -69
  296. package/packages/analyze/src/lib/files/scenarios/generateScenarioData.js.map +1 -1
  297. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js +2 -5
  298. package/packages/analyze/src/lib/files/scenarios/generateScenarios.js.map +1 -1
  299. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +171 -81
  300. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  301. package/packages/database/src/lib/kysely/db.js +2 -2
  302. package/packages/database/src/lib/kysely/tables/debugReportsTable.js +9 -3
  303. package/packages/database/src/lib/kysely/tables/debugReportsTable.js.map +1 -1
  304. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +8 -4
  305. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  306. package/packages/generate/src/lib/deepMerge.js +27 -1
  307. package/packages/generate/src/lib/deepMerge.js.map +1 -1
  308. package/packages/types/index.js +1 -0
  309. package/packages/types/index.js.map +1 -1
  310. package/packages/types/src/types/Scenario.js +21 -1
  311. package/packages/types/src/types/Scenario.js.map +1 -1
  312. package/packages/utils/src/lib/lightweightEntityExtractor.js +25 -0
  313. package/packages/utils/src/lib/lightweightEntityExtractor.js.map +1 -1
  314. package/scripts/finalize-analyzer.cjs +3 -1
  315. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js +0 -238
  316. package/codeyam-cli/scripts/fixtures/cal.com/universal-mocks/packages/prisma/index.js.map +0 -1
  317. package/codeyam-cli/src/webserver/build/client/assets/EntityItem-CVbSvOjo.js +0 -1
  318. package/codeyam-cli/src/webserver/build/client/assets/EntityTypeIcon-DcwcHyl5.js +0 -1
  319. package/codeyam-cli/src/webserver/build/client/assets/InteractivePreview-WgwC1GfJ.js +0 -26
  320. package/codeyam-cli/src/webserver/build/client/assets/LibraryFunctionPreview-IEKom9O2.js +0 -3
  321. package/codeyam-cli/src/webserver/build/client/assets/LogViewer-BYnfxbUG.js +0 -3
  322. package/codeyam-cli/src/webserver/build/client/assets/ReportIssueModal-_lBPJCzG.js +0 -1
  323. package/codeyam-cli/src/webserver/build/client/assets/SafeScreenshot-lHVhvsu_.js +0 -1
  324. package/codeyam-cli/src/webserver/build/client/assets/ScenarioViewer-d_TBk4GQ.js +0 -5
  325. package/codeyam-cli/src/webserver/build/client/assets/_index-kGT7VUqj.js +0 -1
  326. package/codeyam-cli/src/webserver/build/client/assets/activity.(_tab)-DDGmhu7P.js +0 -7
  327. package/codeyam-cli/src/webserver/build/client/assets/chevron-down-n_HPRfM_.js +0 -1
  328. package/codeyam-cli/src/webserver/build/client/assets/chunk-WWGJGFF6-CbVoyx1U.js +0 -26
  329. package/codeyam-cli/src/webserver/build/client/assets/circle-check-D1VOYveA.js +0 -1
  330. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-YR8jjAlu.js +0 -1
  331. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-B8vP3V_s.js +0 -1
  332. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-CN6aLCT1.js +0 -16
  333. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-DA5Jeu2P.js +0 -1
  334. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.edit._scenarioId-BTeitalf.js +0 -5
  335. package/codeyam-cli/src/webserver/build/client/assets/entry.client-du6UEYD-.js +0 -13
  336. package/codeyam-cli/src/webserver/build/client/assets/fileTableUtils-BpjkhMoi.js +0 -1
  337. package/codeyam-cli/src/webserver/build/client/assets/files-BQGvk4lJ.js +0 -1
  338. package/codeyam-cli/src/webserver/build/client/assets/git-DVdYRT-I.js +0 -12
  339. package/codeyam-cli/src/webserver/build/client/assets/globals-CO-U8Bpo.css +0 -1
  340. package/codeyam-cli/src/webserver/build/client/assets/html2canvas-pro.esm-XQCGvadH.js +0 -5
  341. package/codeyam-cli/src/webserver/build/client/assets/index-DCG-vks0.js +0 -1
  342. package/codeyam-cli/src/webserver/build/client/assets/loader-circle-GazdNeLl.js +0 -1
  343. package/codeyam-cli/src/webserver/build/client/assets/manifest-0b694d28.js +0 -1
  344. package/codeyam-cli/src/webserver/build/client/assets/root-D3tQP7hx.js +0 -16
  345. package/codeyam-cli/src/webserver/build/client/assets/search-CIY6XmtE.js +0 -1
  346. package/codeyam-cli/src/webserver/build/client/assets/server-build-CMKNK2uU.css +0 -1
  347. package/codeyam-cli/src/webserver/build/client/assets/settings-CoMDgElu.js +0 -1
  348. package/codeyam-cli/src/webserver/build/client/assets/simulations-agkniXp2.js +0 -1
  349. package/codeyam-cli/src/webserver/build/client/assets/triangle-alert-B2VUcygF.js +0 -1
  350. package/codeyam-cli/src/webserver/build/client/assets/useReportContext-EvdK-zXP.js +0 -1
  351. package/codeyam-cli/src/webserver/build/server/assets/index-DGVHQEXD.js +0 -1
  352. package/codeyam-cli/src/webserver/build/server/assets/server-build-CghkTkIL.js +0 -166
  353. package/codeyam-cli/templates/debug-command.md +0 -303
  354. /package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-CMKNK2uU.css → styles-CMKNK2uU.css} +0 -0
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ // set NODE_ENV before any imports that load React/React-DOM
3
+ if (!process.env.NODE_ENV) {
4
+ process.env.NODE_ENV = 'production';
5
+ }
6
+ void (async () => {
7
+ await import('./backgroundServer.js');
8
+ })();
9
+ //# sourceMappingURL=bootstrap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../../src/webserver/bootstrap.ts"],"names":[],"mappings":";AAEA,4DAA4D;AAC5D,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC1B,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,YAAY,CAAC;AACtC,CAAC;AAED,KAAK,CAAC,KAAK,IAAI,EAAE;IACf,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;AACxC,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ import{c as C,r as u,j as e,L as N}from"./chunk-JMJ3UQ3L-BambyYE_.js";import{u as E}from"./useToast-DWHcCcl1.js";import{f as F,g as T}from"./fileTableUtils-DAtOlaWE.js";import{T as D}from"./TruncatedFilePath-6J7zDUD5.js";import{S as k}from"./SafeScreenshot-BfmDgXxG.js";import{L as P}from"./LibraryFunctionPreview-CBQPrpT0.js";import{T as B}from"./triangle-alert-CBc5dE1s.js";import{E as v}from"./EntityTypeIcon-CXFKsCOD.js";import{E as I}from"./EntityTypeBadge-CzGX-miz.js";function w(s){return`${s.filePath||""}::${s.name}`}function S(s,i){const n=C(),{showToast:d}=E(),[l,o]=u.useState(new Map);u.useEffect(()=>{if(n.state==="idle"&&n.data){const t=n.data;t!=null&&t.error&&d(`Error: ${t.error}`,"error",6e3)}},[n.state,n.data,d]),u.useEffect(()=>{var r;if(l.size===0)return;const t=new Set;(r=i==null?void 0:i.jobs)==null||r.forEach(c=>{var x;(x=c.entityShas)==null||x.forEach(m=>{l.forEach((b,j)=>{b===m&&t.add(j)})})}),s==null||s.forEach(c=>{l.forEach((x,m)=>{x===c&&t.add(m)})}),t.size>0&&o(c=>{const x=new Map(c);return t.forEach(m=>x.delete(m)),x})},[i,s,l]);const f=u.useCallback(t=>{console.log("Generate analysis clicked for entity:",t.sha,t.name);const r=w(t);o(x=>new Map(x).set(r,t.sha));const c=new FormData;c.append("entitySha",t.sha),c.append("filePath",t.filePath||""),n.submit(c,{method:"post",action:"/api/analyze"})},[n]),g=u.useCallback(t=>{const r=t.filter(m=>m.entityType==="visual"||m.entityType==="library");console.log("Generate analysis for all entities:",r.length),o(m=>{const b=new Map(m);return r.forEach(j=>b.set(w(j),j.sha)),b});const c=r.map(m=>m.sha).join(","),x=new FormData;x.append("entityShas",c),n.submit(x,{method:"post",action:"/api/analyze"})},[n]),a=u.useCallback(t=>(s==null?void 0:s.includes(t))??!1,[s]),y=u.useCallback(t=>{const r=w(t);return l.has(r)},[l]),h=u.useCallback(t=>{var r;return((r=i==null?void 0:i.jobs)==null?void 0:r.some(c=>{var x;return(x=c.entityShas)==null?void 0:x.includes(t)}))??!1},[i]),p=u.useMemo(()=>Array.from(l.keys()),[l]);return{isAnalyzing:n.state!=="idle",handleGenerateSimulation:f,handleGenerateAllSimulations:g,isEntityBeingAnalyzed:a,isEntityPending:y,isEntityInQueue:h,pendingEntityKeys:p}}function U({showActions:s=!1,sortOrder:i="desc",onSortChange:n,onAnalyzeAll:d,analyzeAllDisabled:l=!1,analyzeAllText:o="Analyze All"}){return e.jsx("div",{className:"bg-[#efefef] rounded-lg mb-2 text-[11px] font-normal leading-[16px] text-[#3e3e3e] uppercase",children:e.jsxs("div",{className:"flex justify-between items-center px-3 py-2",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx("span",{className:"w-4"}),e.jsx("span",{children:"FILE"})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("div",{className:"flex items-center justify-center h-[38px]",style:{width:"100px"},children:e.jsx("span",{children:"UNCOMMITTED"})}),e.jsx("div",{className:"flex items-center justify-center h-[38px]",style:{width:"70px"},children:e.jsx("span",{children:"SIMULATIONS"})}),e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx("span",{className:"text-center",style:{width:"70px"},children:"ENTITIES"}),e.jsxs("div",{className:"flex items-center justify-center gap-1 cursor-pointer hover:text-[#232323] transition-colors",style:{width:"116px"},onClick:n,role:"button",tabIndex:0,onKeyDown:f=>{(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),n==null||n())},children:[e.jsx("span",{children:"MODIFIED"}),e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{transform:i==="asc"?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease"},children:e.jsx("path",{d:"M3 5L6 8L9 5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),s&&e.jsx("div",{className:"text-center",style:{width:"127px"},children:d&&e.jsx("button",{onClick:d,disabled:l,className:"bg-[#005c75] text-white rounded text-[12px] font-['IBM_Plex_Sans'] font-medium hover:bg-[#004a5e] transition-colors cursor-pointer disabled:bg-gray-400 disabled:cursor-not-allowed whitespace-nowrap px-3 py-1.5 normal-case",title:l?o:"Analyze all entities",children:o})})]})]})]})})}function M({status:s,variant:i="compact"}){const n={modified:{label:"M",bgColor:"bg-[#f59e0c]"},added:{label:"A",bgColor:"bg-emerald-500"},deleted:{label:"D",bgColor:"bg-red-500",showWarning:!0},renamed:{label:"R",bgColor:"bg-indigo-500"},untracked:{label:"U",bgColor:"bg-purple-500"}},d={modified:{label:"MODIFIED",textColor:"#BB6BD9"},added:{label:"ADDED",textColor:"#F2994A"},deleted:{label:"DELETED",textColor:"#EF4444"},renamed:{label:"RENAMED",textColor:"#3B82F6"},untracked:{label:"UNTRACKED",textColor:"#6B7280"}};if(i==="full"){const o=d[s]||{label:"UNKNOWN",textColor:"#6B7280"};return e.jsx("div",{className:"bg-[#f9f9f9] inline-flex items-center justify-center px-[5px] py-0 rounded",style:{height:"22px"},children:e.jsx("span",{className:"text-[10px] font-['IBM_Plex_Sans'] font-medium leading-[22px]",style:{color:o.textColor},children:o.label})})}const l=n[s]||{label:"?",bgColor:"bg-gray-500"};return e.jsxs("div",{className:"inline-flex items-center gap-1",children:[e.jsx("span",{className:`inline-flex items-center justify-center w-5 h-5 text-[11px] font-bold text-white rounded ${l.bgColor}`,title:s,children:l.label}),l.showWarning&&e.jsx("span",{className:"inline-flex items-center justify-center w-3 h-3 text-[10px] text-amber-600",title:"Warning: File will be deleted",children:"⚠"})]})}function G({filePath:s,isExpanded:i,onToggle:n,fileStatus:d,simulationPreviews:l,entityCount:o,state:f,lastModified:g,actionButton:a,uncommittedCount:y,children:h,isNotAnalyzable:p=!1,isUncommitted:t=!1}){return e.jsxs("div",{className:"bg-white overflow-hidden",style:i?{border:"1px solid #e1e1e1",borderLeft:"4px solid #306AFF",borderRadius:"8px"}:{borderBottom:"1px solid #e1e1e1"},children:[e.jsxs("div",{className:`flex justify-between items-center p-3 cursor-pointer select-none transition-colors ${p?"opacity-50":"hover:bg-gray-200"}`,style:{outlineColor:"#005C75"},onClick:n,role:"button",tabIndex:0,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),n())},children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx("span",{className:"w-4 inline-flex items-center justify-center shrink-0",style:{transform:i?"rotate(90deg)":"none"},children:e.jsx("svg",{width:"10",height:"12",viewBox:"0 0 10 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M1.5 1.268L8.5 6L1.5 10.732V1.268Z",fill:i?"#3e3e3e":"#c7c7c7"})})}),e.jsx("img",{src:"/icons/file-icon.svg",alt:"file",className:"w-4 h-5 shrink-0"}),e.jsx(D,{filePath:s}),d&&e.jsx(M,{status:typeof d=="string"?d:d.status,variant:"full"})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("div",{className:"flex items-center justify-center h-[38px]",style:{width:"100px"},children:(t||f==="out-of-date")&&e.jsxs("div",{className:"flex gap-1.5 items-center",children:[t&&e.jsx("span",{className:"text-[11px] px-2 rounded inline-flex items-center gap-1.5 whitespace-nowrap",style:{backgroundColor:"#fff3cd",color:"#856404",height:"22px"},children:"Uncommitted"}),f==="out-of-date"&&e.jsx("span",{className:"text-[11px] px-2 rounded inline-flex items-center gap-1.5 whitespace-nowrap",style:{backgroundColor:"#fdf9c9",color:"#c69538",height:"22px"},children:"Out of date"})]})}),e.jsx("div",{className:"flex items-center justify-center h-[38px]",style:{width:"70px"},children:l}),e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx("div",{className:"flex items-center justify-center",style:{width:"70px"},children:e.jsx("div",{className:"bg-[#f9f9f9] flex items-center justify-center px-2 rounded whitespace-nowrap",style:{height:"26px"},children:e.jsxs("span",{className:"text-[13px] text-[#3e3e3e]",children:[o," ",o===1?"entity":"entities"]})})}),e.jsx("div",{className:"text-[12px] text-gray-600 text-center",style:{width:"116px"},children:F(g)}),e.jsx("div",{style:{width:"127px"},className:"flex justify-center",children:a})]})]})]}),i&&h&&e.jsx("div",{className:"bg-gray-50 py-2 rounded-bl-[4px] rounded-br-[4px] flex flex-col gap-1",children:h})]})}function H({entities:s,maxPreviews:i=3}){var d,l,o,f,g;const n=[];for(const a of s){if(n.length>=i)break;const y=((l=(d=a.analyses)==null?void 0:d[0])==null?void 0:l.scenarios)||[];if(a.entityType==="library"){const h=y.find(p=>{var t,r;return((t=p.metadata)==null?void 0:t.executionResult)||((r=p.metadata)==null?void 0:r.error)});h&&n.push({type:"library",scenario:h,entitySha:a.sha})}else if(a.entityType==="visual"){const h=y.find(p=>{var t,r;return(r=(t=p.metadata)==null?void 0:t.screenshotPaths)==null?void 0:r[0]});if(h){const p=(f=(o=h.metadata)==null?void 0:o.screenshotPaths)==null?void 0:f[0],t=!!((g=h.metadata)!=null&&g.error);p&&n.push({type:"screenshot",screenshot:p,hasError:t,scenario:h,entitySha:a.sha})}}}return n.length===0?e.jsx("span",{className:"text-gray-400 font-light text-[14px]",children:"—"}):e.jsx(e.Fragment,{children:n.map((a,y)=>{if(a.type==="screenshot"&&a.screenshot){const h=a.hasError?"border-red-400":"border-gray-200";return e.jsxs(N,{to:a.scenario?`/entity/${a.entitySha}/scenarios/${a.scenario.id}`:`/entity/${a.entitySha}`,className:`relative w-[50px] h-[38px] border ${h} rounded overflow-hidden bg-gray-50 shrink-0 flex items-center justify-center cursor-pointer transition-all hover:scale-105 hover:shadow-md`,onClick:p=>p.stopPropagation(),children:[e.jsx(k,{screenshotPath:a.screenshot,alt:`Preview ${y+1}`,className:"max-w-full max-h-full object-contain object-center"}),a.hasError&&e.jsx("div",{className:"absolute top-0 right-0 w-4 h-4 bg-red-500 text-white flex items-center justify-center text-[10px] rounded-bl",title:"Error during capture",children:e.jsx(B,{size:12,color:"white"})})]},`screenshot-${y}`)}return a.type==="library"&&a.scenario&&a.entitySha?e.jsx(P,{scenario:a.scenario,entitySha:a.entitySha,size:"small",showBorder:!0},`library-${y}`):null})})}function J({entity:s,isActivelyAnalyzing:i,isQueued:n,onGenerateSimulation:d}){var h,p;const l=i||n?[{entityShas:[s.sha]}]:[],o=T(s,l,i),f=s.entityType==="visual"||s.entityType==="library",g=f&&(o==="not-analyzed"||o==="out-of-date")&&!i&&!n,y=(((p=(h=s.analyses)==null?void 0:h[0])==null?void 0:p.scenarios)||[]).filter(t=>{var r,c;return(c=(r=t.metadata)==null?void 0:r.screenshotPaths)==null?void 0:c[0]});return e.jsxs("div",{className:"bg-white rounded-lg",children:[e.jsxs(N,{to:`/entity/${s.sha}`,className:"flex items-center justify-between p-3 transition-colors hover:bg-gray-100 cursor-pointer",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[e.jsx("span",{className:"w-4 shrink-0"}),s.entityType==="type"?e.jsx("div",{className:"bg-[#ffe1e1] inline-flex items-center justify-center px-[4px] rounded-[4px]",style:{height:"18px",width:"18px"},children:e.jsx("div",{className:"w-[10px] h-[10px] flex items-center justify-center",children:e.jsx(v,{type:"type"})})}):e.jsx(v,{type:s.entityType||"other"}),e.jsx("span",{className:`font-['IBM_Plex_Sans'] text-[14px] leading-[18px] text-black ${f?"font-medium":"font-normal"}`,children:s.name}),e.jsx(I,{type:s.entityType||"other"})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsx("div",{style:{width:"160px"}}),e.jsxs("div",{className:"flex gap-4 items-center",children:[e.jsx("div",{style:{width:"70px"}}),e.jsx("div",{style:{width:"116px"}}),e.jsx("div",{style:{width:"127px"},className:"flex justify-center items-center",children:f?o==="queued"?e.jsxs("span",{className:"text-[13px] px-2 rounded inline-flex items-center gap-1.5 whitespace-nowrap",style:{backgroundColor:"#cbf3fa",color:"#3098b4",height:"26px"},children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#3098b4",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("polyline",{points:"12,6 12,12 16,14"})]}),"Queued"]}):o==="analyzing"?e.jsxs("span",{className:"text-[13px] px-2 rounded inline-flex items-center gap-1.5 whitespace-nowrap",style:{backgroundColor:"#ffdbf6",color:"#ff2ab5",height:"26px"},children:[e.jsxs("svg",{width:"8",height:"8",viewBox:"0 0 9 9",fill:"none",className:"animate-spin",children:[e.jsx("circle",{cx:"4.5",cy:"4.5",r:"3.5",stroke:"#FFF4FC",strokeWidth:"1",fill:"none"}),e.jsx("path",{d:"M4.5 1C2.57 1 1 2.57 1 4.5C1 5.6 1.5 6.58 2.28 7.23",stroke:"#FF2AB5",strokeWidth:"1",strokeLinecap:"round",fill:"none"})]}),"Analyzing..."]}):o==="up-to-date"?e.jsx("span",{className:"text-[13px] px-2 rounded inline-flex items-center gap-1.5 whitespace-nowrap",style:{backgroundColor:"#e8ffe6",color:"#00925d",height:"26px"},children:"Up to date"}):o==="out-of-date"?e.jsx("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),d(s)},className:"bg-[#e0e9ec] text-[#005c75] rounded text-[12px] font-['IBM_Plex_Sans'] font-medium hover:bg-[#d0dfe5] transition-colors cursor-pointer px-[15px] py-0 h-[28px]",children:"Re-Analyze"}):g&&e.jsx("button",{onClick:t=>{t.preventDefault(),t.stopPropagation(),d(s)},className:"bg-[#e0e9ec] text-[#005c75] rounded text-[12px] font-['IBM_Plex_Sans'] font-medium hover:bg-[#d0dfe5] transition-colors cursor-pointer px-[15px] py-0 h-[28px]",children:"Analyze"}):e.jsx("span",{className:"text-[12px] text-gray-400",children:"Not Analyzable"})})]})]})]}),y.length>0&&e.jsx("div",{className:"px-3 pb-3 pt-0 flex items-center gap-2 pl-[52px]",children:y.map((t,r)=>{var x,m;const c=(m=(x=t.metadata)==null?void 0:x.screenshotPaths)==null?void 0:m[0];return c?e.jsx(N,{to:`/entity/${s.sha}?scenario=${t.id}`,className:"relative w-[120px] h-[90px] border border-gray-200 rounded overflow-hidden bg-gray-50 shrink-0 flex items-center justify-center hover:border-gray-400 transition-colors",onClick:b=>b.stopPropagation(),children:e.jsx(k,{screenshotPath:c,alt:t.name,className:"max-w-full max-h-full object-contain object-center"})},t.id):null})})]})}export{J as E,U as F,H as S,G as a,S as u};
@@ -1 +1 @@
1
- import{j as o}from"./chunk-WWGJGFF6-CbVoyx1U.js";const l={visual:{label:"VISUAL",bgColor:"#f9f9f9",textColor:"#9040f5"},library:{label:"LIBRARY",bgColor:"#f9f9f9",textColor:"#06b6d5"},type:{label:"TYPE",bgColor:"#ffe1e1",textColor:"#db2627"},other:{label:"OTHER",bgColor:"#f9f9f9",textColor:"#646464"}};function n({type:t,className:r=""}){const e=l[t]||l.other;return o.jsx("div",{className:`inline-flex items-center justify-center px-[4px] rounded-[4px] ${r}`,style:{backgroundColor:e.bgColor,color:e.textColor,height:"15px"},children:o.jsx("span",{className:"text-[10px] font-['IBM_Plex_Sans'] font-semibold leading-[15px] uppercase",children:e.label})})}export{n as E};
1
+ import{j as o}from"./chunk-JMJ3UQ3L-BambyYE_.js";const l={visual:{label:"VISUAL",bgColor:"#f9f9f9",textColor:"#9040f5"},library:{label:"LIBRARY",bgColor:"#f9f9f9",textColor:"#06b6d5"},type:{label:"TYPE",bgColor:"#ffe1e1",textColor:"#db2627"},other:{label:"OTHER",bgColor:"#f9f9f9",textColor:"#646464"}};function n({type:t,className:r=""}){const e=l[t]||l.other;return o.jsx("div",{className:`inline-flex items-center justify-center px-[4px] rounded-[4px] ${r}`,style:{backgroundColor:e.bgColor,color:e.textColor,height:"15px"},children:o.jsx("span",{className:"text-[10px] font-['IBM_Plex_Sans'] font-semibold leading-[15px] uppercase",children:e.label})})}export{n as E};
@@ -0,0 +1,41 @@
1
+ import{j as e}from"./chunk-JMJ3UQ3L-BambyYE_.js";import{c as r}from"./createLucideIcon-CgUsG7ib.js";/**
2
+ * @license lucide-react v0.556.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 s=[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],i=r("box",s);/**
7
+ * @license lucide-react v0.556.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const d=[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]],h=r("chart-column",d);/**
12
+ * @license lucide-react v0.556.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const g=[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]],b=r("code-xml",g);/**
17
+ * @license lucide-react v0.556.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const f=[["path",{d:"m16 18 6-6-6-6",key:"eg8j8"}],["path",{d:"m8 6-6 6 6 6",key:"ppft3o"}]],a=r("code",f);/**
22
+ * @license lucide-react v0.556.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const p=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],n=r("file-text",p);/**
27
+ * @license lucide-react v0.556.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const y=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],x=r("image",y);/**
32
+ * @license lucide-react v0.556.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const C=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],k=r("list",C);/**
37
+ * @license lucide-react v0.556.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const u=[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]],m=r("tag",u);function M({type:c}){const t={visual:{iconColor:"#7c3aed",bgColor:"bg-purple-100",bgHex:"#f3e8ff"},library:{iconColor:"#06b6d5",bgColor:"bg-[#e6fbff]",bgHex:"#e6fbff"},type:{iconColor:"#db2627",bgColor:"bg-[#ffe1e1]",bgHex:"#ffe1e1"},data:{iconColor:"#2563eb",bgColor:"bg-blue-100",bgHex:"#dbeafe"},index:{iconColor:"#ea580c",bgColor:"bg-orange-100",bgHex:"#ffedd5"},functionCall:{iconColor:"#7c3aed",bgColor:"bg-purple-100",bgHex:"#f3e8ff"},class:{iconColor:"#059669",bgColor:"bg-emerald-100",bgHex:"#d1fae5"},method:{iconColor:"#0891b2",bgColor:"bg-cyan-100",bgHex:"#cffafe"},other:{iconColor:"#6b7280",bgColor:"bg-gray-100",bgHex:"#f3f4f6"}},o=t[c]||t.other,l=()=>{switch(c){case"library":return e.jsx(b,{size:14,color:o.iconColor});case"visual":return e.jsx(x,{size:14,color:o.iconColor});case"type":return e.jsx(m,{size:14,color:o.iconColor});case"data":return e.jsx(h,{size:14,color:o.iconColor});case"index":return e.jsx(k,{size:14,color:o.iconColor});case"functionCall":return e.jsx(a,{size:14,color:o.iconColor});case"class":return e.jsx(i,{size:14,color:o.iconColor});case"method":return e.jsx(a,{size:14,color:o.iconColor});case"other":return e.jsx(n,{size:14,color:o.iconColor});default:return e.jsx(n,{size:14,color:o.iconColor})}};return e.jsx("span",{className:`flex items-center justify-center rounded ${o.bgColor}`,style:{width:"18px",height:"18px"},children:l()})}export{b as C,M as E,x as I};
@@ -0,0 +1,25 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BosqDOlH.js","assets/chunk-JMJ3UQ3L-BambyYE_.js","assets/index-CzNNiTkw.js","assets/styles-CMKNK2uU.css"])))=>i.map(i=>d[i]);
2
+ import{r as t,j as e}from"./chunk-JMJ3UQ3L-BambyYE_.js";import{_ as C}from"./preload-helper-ckwbz45p.js";import{u as J}from"./useLastLogLine-BqPPNjAl.js";const B=t.createContext({dimensions:{height:720,width:1200},updateDimensions:()=>{},iframeRef:{current:null},scale:1,updateScale:()=>{},maxWidth:1200,updateMaxWidth:()=>{}}),K=()=>{const c=t.useContext(B);if(!c)throw new Error("useWebContainer must be used within a WebContainerProvider");return c},ne=({children:c})=>{const[a,i]=t.useState({height:720,width:1200}),[d,h]=t.useState(1),[x,w]=t.useState(1200),u=t.useRef(null),m=t.useCallback(({height:o,width:y})=>{i(f=>({height:o??f.height,width:y??f.width}))},[]),j=t.useCallback(o=>{h(o)},[]),v=t.useCallback(o=>{w(o)},[]);return e.jsx(B.Provider,{value:{dimensions:a,updateDimensions:m,iframeRef:u,scale:d,updateScale:j,maxWidth:x,updateMaxWidth:v},children:c})},Q=typeof window<"u";function X(){const[c,a]=t.useState(null);return t.useEffect(()=>{C(()=>import("./index-BosqDOlH.js").then(i=>i.i),__vite__mapDeps([0,1,2])).then(i=>{a(()=>i.ResizableBox)}),C(()=>Promise.resolve({}),__vite__mapDeps([3]))},[]),c}const Z=1200,U=720,H=30,ee=({id:c,scenarioName:a,iframeUrl:i,defaultWidth:d=1440,defaultHeight:h=900,onDataOverride:x,onIframeLoad:w,onScaleChange:u,onDimensionChange:m})=>{const j=X(),[v,o]=t.useState(!1),[y,f]=t.useState(!1),[l,P]=t.useState(Z),[S,D]=t.useState(U),[N,$]=t.useState(null),[z,_]=t.useState(null),{dimensions:r,updateDimensions:k,iframeRef:p,updateScale:R,updateMaxWidth:W}=K(),M=t.useMemo(()=>Math.min(1,l/r.width),[l,r.width]),g=z!==null?z:M;t.useEffect(()=>{v||(R(g),u==null||u(g))},[g,R,u,v]),t.useEffect(()=>{W(l)},[l,W]);const A=t.useCallback(()=>{o(!0),_(M)},[M]),T=t.useCallback(()=>{o(!1),_(null)},[]),G=t.useCallback((n,s)=>{const b=z!==null?z:1,E=Math.round(s.size.width/b);k({width:E}),m==null||m(E,r.height)},[k,z,m,r.height]),O=t.useCallback(()=>{setTimeout(()=>{f(!0)},100),w&&w()},[w]);t.useEffect(()=>{const n=s=>{if(s.data.type==="codeyam-resize"){if(a&&s.data.name!==a||r.height===s.data.height||s.data.height===0)return;k({height:s.data.height})}};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[p,a,d,r,k]),t.useEffect(()=>{y&&x&&x(p.current)},[y,x,p]),t.useEffect(()=>{if(!a)return;const n=setInterval(()=>{var s,b;(b=(s=p==null?void 0:p.current)==null?void 0:s.contentWindow)==null||b.postMessage({type:"codeyam-respond",name:a},"*")},1e3);return()=>clearInterval(n)},[a,p]),t.useEffect(()=>{const n=()=>{const s=document.getElementById("scenario-container");if(!s)return;const b=s.getBoundingClientRect(),E=s.clientWidth-H*2,F=window.innerHeight-b.top-H*2,Y=Math.max(F,400),q=window.innerHeight-b.top;P(E),D(Y),$(q)};return n(),window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),t.useEffect(()=>{k({width:d,height:h})},[d,h,k]);const I=t.useMemo(()=>r.width*g,[r.width,g]),L=t.useMemo(()=>{const n=r.height,s=n*g;return n&&n!==720&&n!==900&&s<S?s:S},[r.height,S,g]),V=t.useCallback(()=>{window.history.back()},[]);return!Q||!j?e.jsx("div",{className:"relative bg-gray-100 w-full h-full flex items-center justify-center",children:e.jsx("p",{className:"text-gray-500",children:"Loading interactive view..."})}):e.jsxs("div",{id:"scenario-container",className:"relative bg-gray-100 w-full flex items-center justify-center",style:N?{height:`${N}px`}:{},children:[v&&e.jsx("div",{className:"fixed inset-0 z-50 bg-transparent"}),e.jsx("style",{children:`
3
+ .react-resizable-handle-e {
4
+ display: flex !important;
5
+ align-items: center !important;
6
+ justify-content: center !important;
7
+ width: 6px !important;
8
+ height: 48px !important;
9
+ right: -8px !important;
10
+ top: 50% !important;
11
+ transform: translateY(-50%) !important;
12
+ cursor: ew-resize !important;
13
+ background: #d1d5db !important;
14
+ border-radius: 3px !important;
15
+ opacity: 0 !important;
16
+ transition: all 0.2s ease !important;
17
+ }
18
+ .react-resizable-handle-e:hover {
19
+ opacity: 0.8 !important;
20
+ background: #9ca3af !important;
21
+ }
22
+ .react-resizable:hover .react-resizable-handle-e {
23
+ opacity: 0.4 !important;
24
+ }
25
+ `}),e.jsx(j,{width:I,height:L,minConstraints:[300,200],maxConstraints:[l,S],className:"relative bg-white rounded-lg shadow-md",resizeHandles:["e"],onResizeStart:A,onResizeStop:T,onResize:G,children:e.jsx("div",{className:"overflow-auto",style:{width:`${I}px`,height:`${L}px`},children:e.jsx("div",{style:{width:`${r.width}px`,height:`${r.height}px`,transform:`scale(${g})`,transformOrigin:"top left"},children:i?e.jsx("iframe",{ref:p,className:"w-full h-full rounded-lg",src:i,onLoad:O,sandbox:"allow-scripts allow-same-origin"}):e.jsxs("p",{className:"w-full h-full flex flex-col gap-3 items-center justify-center",children:[e.jsx("span",{className:"text-xl font-light",children:"Oops! Looks like this scenario is not available yet. Please check back later."}),e.jsx("span",{className:"text-blue-600 cursor-pointer",onClick:V,children:"Go back"})]})})})},`resizable-box-${c}`)]})};function ae({scenarioId:c,scenarioName:a,iframeUrl:i,isStarting:d,isLoading:h,showIframe:x,iframeKey:w,onIframeLoad:u,onScaleChange:m,onDimensionChange:j,projectSlug:v,defaultWidth:o=1440,defaultHeight:y=900,retryCount:f=0}){const{lastLine:l}=J(v??null,d||h);return i?e.jsxs("div",{className:"flex-1 min-h-0 relative",children:[e.jsx("div",{style:{opacity:x?1:0},children:e.jsx(ee,{id:c,scenarioName:a,iframeUrl:i,defaultWidth:o,defaultHeight:y,onIframeLoad:u,onScaleChange:m,onDimensionChange:j},w)}),!x&&(d||h)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"flex flex-col items-center gap-3",children:[e.jsx("div",{className:"w-12 h-12",children:e.jsx("svg",{className:"animate-spin",viewBox:"0 0 50 50",children:e.jsx("circle",{cx:"25",cy:"25",r:"20",fill:"none",stroke:"#005c75",strokeWidth:"4",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})})}),e.jsxs("div",{className:"text-center",children:[e.jsx("p",{className:"text-base font-semibold text-[#005c75] mb-1",children:d&&!i?"Starting interactive mode...":`Checking server stability. Attempt #${f+1}..`}),l&&!i&&e.jsx("p",{className:"text-xs font-mono text-[#666] leading-relaxed",children:l}),i&&f>0&&e.jsxs("p",{className:"text-xs font-mono text-[#666] leading-relaxed",children:["Waiting for application to initialize... (attempt"," ",f+1,")"]})]})]})})]}):e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-12 text-center bg-[#f6f9fc]",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-2xl",children:[e.jsx("div",{className:"w-12 h-12 mb-2",children:e.jsx("svg",{className:"animate-spin",viewBox:"0 0 50 50",children:e.jsx("circle",{cx:"25",cy:"25",r:"20",fill:"none",stroke:"#005c75",strokeWidth:"4",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})})}),e.jsx("h2",{className:"text-2xl font-semibold text-[#005c75] leading-[30px] m-0 font-['IBM_Plex_Sans']",children:h?"Interactive mode ready: launching...":"Starting Interactive Mode..."}),l&&e.jsx("p",{className:"text-xs font-mono text-[#005c75] text-center leading-5 m-0 max-w-xl font-['IBM_Plex_Mono']",children:l}),e.jsx("p",{className:"text-xs text-[#8e8e8e] text-center leading-5 m-0 font-['IBM_Plex_Mono']",children:h?"Loading the page in the background...":"Setting up the dev server for this scenario..."})]})})}export{ae as I,ne as W,K as u};
@@ -0,0 +1,3 @@
1
+ import{j as r,L as C}from"./chunk-JMJ3UQ3L-BambyYE_.js";import{g as L}from"./scenarioStatus-B_8jpV3e.js";function M({scenario:s,entitySha:m,size:g="medium",showBorder:j=!0,isOutdated:E=!1}){var x,h,u,p,$,f;const t=L(s,void 0,void 0,m,void 0),e=(x=s.metadata)==null?void 0:x.executionResult,o=!!e,b=(((u=(h=s.metadata)==null?void 0:h.data)==null?void 0:u.argumentsData)||[]).length,c=(e==null?void 0:e.returnValue)!==void 0&&(e==null?void 0:e.returnValue)!==null,i=(($=(p=e==null?void 0:e.sideEffects)==null?void 0:p.consoleOutput)==null?void 0:$.length)||0,d=((f=e==null?void 0:e.timing)==null?void 0:f.duration)||0;let a=0;b>0&&a++,b>2&&a++,c&&a++,i>0&&a++,a=Math.min(3,a);const l=g==="small"?{width:"w-[50px]",height:"h-[38px]",iconSize:"text-base",textSize:"text-[8px]"}:{width:"w-20",height:"h-15",iconSize:"text-xl",textSize:"text-[10px]"},n=t.hasError?{border:"border-red-400",bg:"bg-red-50",icon:"text-red-600",badge:"bg-red-100 text-red-700"}:o?E?{border:"border-amber-500",bg:"bg-amber-50",icon:"text-amber-700",badge:"bg-amber-100 text-amber-700"}:{border:"border-blue-400",bg:"bg-blue-50",icon:"text-blue-600",badge:"bg-blue-100 text-blue-700"}:{border:"border-gray-300 border-dashed",bg:"bg-gray-50",icon:"text-gray-400",badge:"bg-gray-100 text-gray-600"},w=j?`border-2 ${n.border}`:"",S=Array.from({length:3},(v,y)=>r.jsx("div",{className:`w-1 h-1 rounded-full ${y<a?n.icon.replace("text-","bg-"):"bg-gray-300"}`},y)),N=t.hasError?`Error: ${t.errorMessage||"Unknown error"}`:o?`${s.name}
2
+ ${b} args → ${c?"value":"void"}${i>0?` (${i} logs)`:""}
3
+ ${d}ms`:`Not executed: ${s.name}`;return r.jsxs(C,{to:`/entity/${m}/scenarios/${s.id}`,className:`relative ${l.width} ${l.height} ${w} rounded ${n.bg} flex flex-col items-center justify-center gap-0.5 cursor-pointer transition-all hover:scale-105 hover:shadow-md`,title:N,onClick:v=>v.stopPropagation(),children:[r.jsx("div",{className:`${n.icon} ${l.iconSize} font-mono font-bold`,children:t.hasError?"⚠":o?"ƒ":"○"}),o&&!t.hasError&&r.jsxs("div",{className:`flex items-center gap-0.5 ${l.textSize} ${n.badge} px-1 rounded`,children:[r.jsx("span",{children:b}),r.jsx("span",{children:"→"}),r.jsx("span",{children:c?"✓":"∅"})]}),o&&!t.hasError&&g==="medium"&&r.jsx("div",{className:"flex gap-0.5 mt-0.5",children:S}),o&&!t.hasError&&d>100&&g==="medium"&&r.jsx("div",{className:`absolute top-0.5 right-0.5 ${l.textSize} ${n.badge} px-1 rounded`,children:d>1e3?`${Math.round(d/1e3)}s`:`${d}ms`}),o&&!t.hasError&&i>0&&g==="medium"&&r.jsxs("div",{className:"absolute bottom-0.5 left-0.5 text-[8px] text-gray-500",children:["📝",i]})]})}export{M as L};
@@ -0,0 +1,6 @@
1
+ import{j as i}from"./chunk-JMJ3UQ3L-BambyYE_.js";let s=!1;function r(){if(s)return;const e=document.createElement("style");e.textContent=`
2
+ @keyframes strongPulse {
3
+ 0%, 100% { opacity: 0.2; }
4
+ 50% { opacity: 1; }
5
+ }
6
+ `,document.head.appendChild(e),s=!0}function c({size:e="medium",className:o=""}){typeof document<"u"&&r();const a={small:{sideDotSize:3,centerDotSize:4,gap:2},medium:{sideDotSize:4,centerDotSize:6,gap:2},large:{sideDotSize:6,centerDotSize:8,gap:3}},{sideDotSize:t,centerDotSize:n,gap:l}=a[e];return i.jsxs("div",{className:`flex items-center justify-center ${o}`,style:{gap:`${l}px`},role:"status","aria-label":"Loading",children:[i.jsx("div",{className:"rounded-full",style:{width:`${t}px`,height:`${t}px`,backgroundColor:"#005c75",animation:"strongPulse 1.5s ease-in-out infinite",animationDelay:"0s"}}),i.jsx("div",{className:"rounded-full",style:{width:`${n}px`,height:`${n}px`,backgroundColor:"#005c75",animation:"strongPulse 1.5s ease-in-out infinite",animationDelay:"0.3s"}}),i.jsx("div",{className:"rounded-full",style:{width:`${t}px`,height:`${t}px`,backgroundColor:"#005c75",animation:"strongPulse 1.5s ease-in-out infinite",animationDelay:"0.6s"}})]})}export{c as L};
@@ -0,0 +1,3 @@
1
+ import{r,j as e}from"./chunk-JMJ3UQ3L-BambyYE_.js";function w({projectSlug:x,onClose:l}){const[m,o]=r.useState("Loading logs..."),[u,g]=r.useState(!0),[d,f]=r.useState(!0),[n,b]=r.useState("all"),a=r.useRef(null);return r.useEffect(()=>{const t=async()=>{try{const s=await fetch(`/api/logs/${x}`);if(s.ok){const h=await s.text();if(n==="all")o(h);else{const c=h.trim().split(`
2
+ `).filter(i=>{if(i.length===0)return!1;const p=i.match(/^.*CodeYam Log Level (\d+):/);return!!p&&Number(p[1])<=n});o(c.map(i=>i.replace(/^.*CodeYam Log Level \d+:\s*/,"")).join(`
3
+ `))}d&&a.current&&setTimeout(()=>{var c;(c=a.current)==null||c.scrollTo({top:a.current.scrollHeight,behavior:"smooth"})},100)}else o(`Error: ${s.status} - ${await s.text()}`)}catch(s){o(`Error fetching logs: ${s.message}`)}};if(t().catch(()=>{}),u){const s=setInterval(()=>{t().catch(()=>{})},2e3);return()=>clearInterval(s)}},[x,u,d,n]),r.useEffect(()=>{const t=s=>{s.key==="Escape"&&l()};return window.addEventListener("keydown",t),()=>window.removeEventListener("keydown",t)},[l]),e.jsx("div",{className:"fixed inset-0 bg-black/70 flex items-center justify-center z-9999 p-5",onClick:l,children:e.jsxs("div",{className:"bg-[#1e1e1e] rounded-lg shadow-2xl flex flex-col max-w-[1200px] w-full max-h-[90vh] overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex justify-between items-center px-5 py-4 border-b border-[#333] bg-[#252525]",children:[e.jsxs("h3",{className:"m-0 text-lg font-semibold text-white",children:["Analysis Logs - ",x]}),e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsxs("label",{className:"flex items-center gap-2 text-sm text-[#ccc] select-none",children:[e.jsx("span",{children:"Log Level:"}),e.jsxs("select",{value:n,onChange:t=>b(t.target.value==="all"?"all":Number(t.target.value)),className:"bg-[#333] text-white border border-[#555] rounded px-2 py-1 text-sm cursor-pointer outline-none transition-all hover:border-[#777] hover:bg-[#3a3a3a] focus:border-blue-600",children:[e.jsx("option",{value:"1",children:"1"}),e.jsx("option",{value:"2",children:"2"}),e.jsx("option",{value:"3",children:"3"}),e.jsx("option",{value:"4",children:"4"}),e.jsx("option",{value:"all",children:"All"})]})]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-sm text-[#ccc] cursor-pointer select-none group",children:[e.jsx("input",{type:"checkbox",checked:u,onChange:t=>g(t.target.checked),className:"cursor-pointer"}),e.jsx("span",{className:"group-hover:text-white",children:"Auto-refresh"})]}),e.jsxs("label",{className:"flex items-center gap-1.5 text-sm text-[#ccc] cursor-pointer select-none group",children:[e.jsx("input",{type:"checkbox",checked:d,onChange:t=>f(t.target.checked),className:"cursor-pointer"}),e.jsx("span",{className:"group-hover:text-white",children:"Auto-scroll"})]}),e.jsx("button",{onClick:l,className:"bg-transparent border-none text-[#999] text-2xl cursor-pointer p-0 w-8 h-8 flex items-center justify-center rounded transition-all hover:bg-[#333] hover:text-white",title:"Close (Esc)",children:"✕"})]})]}),e.jsx("pre",{className:"flex-1 m-0 px-5 py-4 overflow-auto font-mono text-[13px] leading-relaxed text-[#d4d4d4] bg-[#1e1e1e] whitespace-pre-wrap wrap-break-word scrollbar-thin scrollbar-thumb-[#424242] scrollbar-track-[#1e1e1e] hover:scrollbar-thumb-[#4f4f4f]",ref:a,children:m})]})})}export{w as L};
@@ -0,0 +1,11 @@
1
+ import{r as t,c as D,j as e}from"./chunk-JMJ3UQ3L-BambyYE_.js";import{c as N}from"./createLucideIcon-CgUsG7ib.js";import{C as $}from"./circle-check-CaVsIRxt.js";import{T as j}from"./triangle-alert-CBc5dE1s.js";/**
2
+ * @license lucide-react v0.556.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 R=[["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M14 7a4 4 0 0 1 4 4v3a6 6 0 0 1-12 0v-3a4 4 0 0 1 4-4z",key:"uouzyp"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M21 21a4 4 0 0 0-3.81-4",key:"1b0z45"}],["path",{d:"M21 5a4 4 0 0 1-3.55 3.97",key:"5cxbf6"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M3 21a4 4 0 0 1 3.81-4",key:"1fjd4g"}],["path",{d:"M3 5a4 4 0 0 0 3.55 3.97",key:"1d7oge"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13V6a3 3 0 1 1 6 0v1.13",key:"1vgav8"}]],E=N("bug",R);/**
7
+ * @license lucide-react v0.556.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const T=[["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"}]],v=N("settings",T);function F(a){return a.scenarioId?`Scenario: ${a.scenarioId.slice(0,8)}...`:a.entitySha?`Entity: ${a.entitySha.slice(0,8)}...`:"General feedback"}function Y({isOpen:a,onClose:k,context:r,defaultEmail:w="",screenshotDataUrl:d}){const[u,h]=t.useState(""),[x,S]=t.useState(w),[m,g]=t.useState(!1),[o,y]=t.useState(!1),[C,b]=t.useState(null),[l,p]=t.useState(null),i=D(),n=i.state!=="idle";if(i.data&&!o&&!l){const s=i.data;s.success&&s.reportId?(y(!0),b(s.reportId)):s.error&&p(s.error)}const I=async()=>{p(null);const s=new FormData;if(s.append("issueType","other"),s.append("description",u),s.append("email",x),s.append("source",r.source),s.append("entitySha",r.entitySha||""),s.append("scenarioId",r.scenarioId||""),s.append("analysisId",r.analysisId||""),s.append("currentUrl",r.currentUrl),d)try{const z=await(await fetch(d)).blob();s.append("screenshot",z,"screenshot.jpg")}catch(f){console.error("Failed to convert screenshot:",f)}i.submit(s,{method:"post",action:"/api/generate-report",encType:"multipart/form-data"})},c=()=>{h(""),g(!1),y(!1),b(null),p(null),k()},M=s=>{s.key==="Escape"&&c()};return a?e.jsx("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center p-4 z-50",onKeyDown:M,children:e.jsxs("div",{className:"bg-white rounded-lg max-w-lg w-full p-6 shadow-xl",children:[e.jsxs("div",{className:"flex items-center justify-between mb-6",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[n?e.jsx("div",{className:"animate-spin",children:e.jsx(v,{size:24,style:{strokeWidth:1.5}})}):o?e.jsx($,{size:24,style:{color:"#10B981",strokeWidth:1.5}}):e.jsx(E,{size:24,style:{color:"#005C75",strokeWidth:1.5}}),e.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:o?"Report Submitted":"Report Issue"})]}),e.jsx("button",{onClick:c,className:"text-gray-400 hover:text-gray-600 transition-colors cursor-pointer","aria-label":"Close",children:e.jsx("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),o?e.jsxs("div",{children:[e.jsxs("div",{className:"mb-6 p-4 bg-green-50 rounded-lg border border-green-200",children:[e.jsx("p",{className:"text-sm text-green-800 font-medium mb-1",children:"Thank you for your feedback!"}),e.jsxs("p",{className:"text-xs text-green-700",children:["Report ID:"," ",e.jsx("code",{className:"bg-green-100 px-1 rounded",children:C})]})]}),e.jsx("p",{className:"text-sm text-gray-600 mb-6",children:"The CodeYam team will investigate and may reach out if you provided an email address."}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{onClick:c,className:"px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded-md hover:bg-[#004a5c] transition-colors cursor-pointer",children:"Done"})})]}):e.jsxs("div",{children:[e.jsxs("div",{className:"mb-4 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"text-sm font-medium text-gray-900",title:`${r.source}${r.entitySha?` • Entity: ${r.entitySha}`:""}${r.scenarioId?` • Scenario: ${r.scenarioId}`:""}${r.analysisId?` • Analysis: ${r.analysisId}`:""}`,children:F(r)}),e.jsx("button",{type:"button",onClick:()=>g(!m),className:"text-xs text-gray-500 hover:text-gray-700 underline cursor-pointer",children:m?"Hide":"Details"})]}),m&&e.jsxs("div",{className:"mt-2 pt-2 border-t border-gray-200 text-xs text-gray-600 space-y-1",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400",children:"Source:"})," ",r.source]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400",children:"URL:"})," ",r.currentUrl]}),r.entitySha&&e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400",children:"Entity:"})," ",e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:r.entitySha})]}),r.scenarioId&&e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400",children:"Scenario:"})," ",e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:r.scenarioId})]}),r.analysisId&&e.jsxs("div",{children:[e.jsx("span",{className:"text-gray-400",children:"Analysis:"})," ",e.jsx("code",{className:"bg-gray-100 px-1 rounded",children:r.analysisId})]})]})]}),d&&e.jsxs("div",{className:"mb-4 p-3 bg-gray-50 rounded-lg border border-gray-200",children:[e.jsx("div",{className:"text-xs text-gray-500 mb-2",children:"Screenshot (will be included in report)"}),e.jsx("img",{src:d,alt:"Page screenshot",className:"w-full max-h-[150px] object-contain rounded border border-gray-300"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700 mb-2",children:"What happened?"}),e.jsx("textarea",{id:"description",value:u,onChange:s=>h(s.target.value),placeholder:"Describe what you expected vs what happened...",rows:4,className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:border-[#005c75] resize-none"})]}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{htmlFor:"email",className:"block text-sm font-medium text-gray-700 mb-2",children:"Your email"}),e.jsx("input",{id:"email",type:"email",value:x,onChange:s=>S(s.target.value),placeholder:"you@example.com",className:"w-full px-3 py-2 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:border-[#005c75]"})]}),e.jsxs("div",{className:"mb-6 p-3 bg-amber-50 rounded-lg border border-amber-200 flex gap-2",children:[e.jsx(j,{size:16,className:"flex-shrink-0 mt-0.5",style:{color:"#D97706"}}),e.jsxs("div",{className:"text-xs text-amber-800",children:[e.jsx("p",{className:"font-medium mb-1",children:"Source code will be uploaded"}),e.jsx("p",{children:"This report includes your project source code, git history, and CodeYam logs. Only submit if you're comfortable sharing this with the CodeYam team."})]})]}),n&&e.jsx("div",{className:"mb-4 text-center",children:e.jsx("p",{className:"text-sm text-gray-600",children:i.formData?"Uploading report...":"Creating archive..."})}),l&&e.jsxs("div",{className:"mb-4 p-3 bg-red-50 rounded-lg border border-red-200 flex gap-2",children:[e.jsx(j,{size:16,className:"flex-shrink-0 mt-0.5",style:{color:"#DC2626"}}),e.jsxs("div",{className:"text-xs text-red-800",children:[e.jsx("p",{className:"font-medium mb-1",children:"Upload failed"}),e.jsx("p",{children:l})]})]}),e.jsxs("div",{className:"flex gap-3 justify-end",children:[e.jsx("button",{onClick:c,disabled:n,className:"px-4 py-2 bg-gray-100 text-gray-700 text-sm font-medium rounded-md hover:bg-gray-200 focus:outline-none focus:ring-2 focus:ring-gray-300 transition-colors disabled:opacity-50 cursor-pointer",children:"Cancel"}),e.jsx("button",{onClick:()=>void I(),disabled:n,className:"px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded-md hover:bg-[#004a5c] focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:ring-offset-1 transition-colors disabled:bg-gray-300 disabled:cursor-not-allowed flex items-center gap-2 cursor-pointer",children:n?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"animate-spin",children:e.jsx(v,{size:16,style:{strokeWidth:1.5}})}),"Submitting..."]}):l?"Try Again":"Submit Report"})]})]})]})}):null}export{E as B,Y as R,v as S};
@@ -0,0 +1 @@
1
+ import{r as a,j as e}from"./chunk-JMJ3UQ3L-BambyYE_.js";function j({screenshotPath:l,cacheBuster:o,alt:x,className:f="",title:n}){const[i,s]=a.useState("loading"),[c,r]=a.useState(!1),d=a.useRef(null),u=o?`/api/screenshot/${l}?cb=${o}`:`/api/screenshot/${l}`,m=()=>{s("success"),r(!0)},h=()=>{s("error"),r(!1)};return a.useEffect(()=>{s("loading"),r(!1);const t=d.current;t!=null&&t.complete&&(t.naturalHeight!==0?(s("success"),r(!0)):(s("error"),r(!1)))},[u]),l?e.jsxs("div",{className:"relative w-full h-full flex items-center justify-center",title:n,children:[e.jsx("img",{ref:d,src:u,alt:x,onLoad:m,onError:h,className:f||"max-w-full max-h-full object-contain",style:{visibility:c?"visible":"hidden",position:c?"relative":"absolute"}}),i==="loading"&&e.jsx("div",{className:"absolute inset-0 bg-gray-100 animate-pulse rounded flex items-center justify-center",children:e.jsx("svg",{className:"w-8 h-8 text-gray-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})})}),i==="error"&&e.jsxs("div",{className:"absolute inset-0 border-2 border-dashed border-gray-300 bg-gray-50 rounded flex flex-col items-center justify-center text-xs gap-1",children:[e.jsx("span",{className:"text-2xl text-gray-400",children:"📷"}),e.jsx("span",{className:"text-gray-400 whitespace-nowrap",children:"No Screenshot"})]})]}):e.jsx("div",{className:"w-full h-full border-2 border-dashed border-gray-300 bg-gray-50 rounded flex flex-col items-center justify-center text-xs gap-1",title:n,children:e.jsx("span",{className:"text-2xl text-gray-400",children:"📷"})})}export{j as S};
@@ -0,0 +1,15 @@
1
+ import{r as i,j as e,c as fe,L as oe}from"./chunk-JMJ3UQ3L-BambyYE_.js";import{I as pe}from"./InteractivePreview-D-9pXIaY.js";import{u as ge,V as be,S as je}from"./useCustomSizes-BMIGFP-m.js";import{L as we}from"./LogViewer-wDPcZNKx.js";import{S as Ne}from"./SafeScreenshot-BfmDgXxG.js";import{u as ve}from"./useLastLogLine-BqPPNjAl.js";import{u as ke}from"./useInteractiveMode-Dk_FQqWJ.js";import{_ as ye}from"./preload-helper-ckwbz45p.js";import{R as Ce}from"./ReportIssueModal-4lcOlid-.js";import{c as ie}from"./createLucideIcon-CgUsG7ib.js";import{g as Ie}from"./scenarioStatus-B_8jpV3e.js";/**
2
+ * @license lucide-react v0.556.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 Le=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Ee=ie("check",Le);/**
7
+ * @license lucide-react v0.556.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const $e=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],Pe=ie("copy",$e);function _e({presets:s,customSizes:t,currentWidth:n,currentHeight:o,scale:v,onSizeChange:j,onSaveCustomSize:g,onRemoveCustomSize:m,className:k=""}){const[h,u]=i.useState(!1),[f,w]=i.useState(String(n)),[b,c]=i.useState(String(o)),[N,y]=i.useState(!1),[l,M]=i.useState(!1),S=i.useRef(null);i.useEffect(()=>{N||w(String(n))},[n,N]),i.useEffect(()=>{l||c(String(o))},[o,l]),i.useEffect(()=>{const r=x=>{S.current&&!S.current.contains(x.target)&&u(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]);const I=i.useMemo(()=>{const r=s.find(d=>d.width===n&&d.height===o);if(r)return r.name;const x=t.find(d=>d.width===n&&d.height===o);return x?x.name:"Custom"},[s,t,n,o]),T=I==="Custom",R=r=>{j(r.width,r.height),u(!1)},B=r=>{const x=r.target.value;w(x);const d=parseInt(x,10);!isNaN(d)&&d>0&&j(d,o)},H=r=>{const x=r.target.value;c(x);const d=parseInt(x,10);!isNaN(d)&&d>0&&j(n,d)},O=()=>{y(!1);const r=parseInt(f,10);(isNaN(r)||r<=0)&&w(String(n))},W=()=>{M(!1);const r=parseInt(b,10);(isNaN(r)||r<=0)&&c(String(o))},A=r=>{(r.key==="Enter"||r.key==="Escape")&&r.target.blur()};return e.jsxs("div",{className:`flex items-center gap-3 ${k}`,children:[e.jsxs("div",{className:"relative",ref:S,children:[e.jsxs("button",{onClick:()=>u(!h),className:"flex items-center gap-2 px-3 py-1.5 bg-white border border-gray-300 rounded-md text-sm font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:ring-offset-1 min-w-[120px] justify-between",children:[e.jsx("span",{children:I}),e.jsx("svg",{className:`w-4 h-4 transition-transform ${h?"rotate-180":""}`,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),h&&e.jsx("div",{className:"absolute top-full left-0 mt-1 min-w-full bg-white border border-gray-200 rounded-md shadow-lg z-50",children:e.jsxs("div",{className:"py-1",children:[s.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"px-3 py-1 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap",children:"Presets"}),s.map(r=>e.jsxs("button",{onClick:()=>R(r),className:`w-full text-left px-3 py-2 text-sm hover:bg-gray-100 flex justify-between items-center gap-4 whitespace-nowrap ${I===r.name?"bg-[#f0f7f9] text-[#005c75]":"text-gray-700"}`,children:[e.jsx("span",{children:r.name}),e.jsxs("span",{className:"text-xs text-gray-500",children:[r.width," x ",r.height]})]},r.name))]}),t.length>0&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"border-t border-gray-100 my-1"}),e.jsx("div",{className:"px-3 py-1 text-xs font-semibold text-gray-500 uppercase tracking-wider whitespace-nowrap",children:"Custom"}),[...t].sort((r,x)=>r.width-x.width).map(r=>e.jsxs("div",{className:`flex items-center gap-1 hover:bg-gray-100 ${I===r.name?"bg-[#f0f7f9] text-[#005c75]":"text-gray-700"}`,children:[e.jsxs("button",{onClick:()=>R(r),className:"flex-1 text-left px-3 py-2 text-sm flex justify-between items-center gap-4 whitespace-nowrap cursor-pointer",children:[e.jsx("span",{children:r.name}),e.jsxs("span",{className:"text-xs text-gray-500",children:[r.width," x ",r.height]})]}),m&&e.jsx("button",{onClick:x=>{x.stopPropagation(),I===r.name&&s.length>0&&j(s[0].width,s[0].height),m(r.name)},className:"p-1.5 mr-1 text-gray-400 hover:text-red-500 hover:bg-red-50 rounded cursor-pointer transition-colors",title:"Remove custom size",children:e.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]},r.name))]})]})})]}),e.jsxs("div",{className:"flex items-center gap-1 text-sm",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{type:"text",value:f,onChange:B,onFocus:()=>y(!0),onBlur:O,onKeyDown:A,className:"w-16 px-2 py-1 text-right border border-gray-300 rounded-l-md text-sm focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:border-[#005c75]"}),e.jsx("span",{className:"px-2 py-1 bg-gray-100 border border-l-0 border-gray-300 rounded-r-md text-gray-500 text-sm",children:"px"})]}),e.jsx("span",{className:"text-gray-400 mx-1",children:"×"}),e.jsxs("div",{className:"flex items-center",children:[e.jsx("input",{type:"text",value:b,onChange:H,onFocus:()=>M(!0),onBlur:W,onKeyDown:A,className:"w-16 px-2 py-1 text-right border border-gray-300 rounded-l-md text-sm focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:border-[#005c75]"}),e.jsx("span",{className:"px-2 py-1 bg-gray-100 border border-l-0 border-gray-300 rounded-r-md text-gray-500 text-sm",children:"px"})]}),v!==void 0&&v<1&&e.jsxs("span",{className:"text-xs text-gray-500 ml-1",children:["(",Math.round(v*100),"%)"]})]}),T&&e.jsx("button",{onClick:g,className:"px-3 py-1.5 bg-[#005c75] text-white text-sm font-medium rounded-md hover:bg-[#004a5c] focus:outline-none focus:ring-2 focus:ring-[#005c75] focus:ring-offset-1 transition-colors",children:"Save Custom Size"})]})}function ae({size:s=24,className:t=""}){return e.jsxs("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":"true",children:[e.jsx("path",{d:"M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z",fill:"#ef4444",stroke:"none"}),e.jsx("line",{x1:"12",y1:"9",x2:"12",y2:"13",stroke:"#FFFFFF",strokeWidth:"2",strokeLinecap:"round"}),e.jsx("circle",{cx:"12",cy:"17",r:"1",fill:"#FFFFFF"})]})}function Se({scenario:s,analysis:t,entity:n}){var g,m,k;const o=((g=s.metadata)==null?void 0:g.executionResult)||null,v=((k=(m=s.metadata)==null?void 0:m.data)==null?void 0:k.argumentsData)||[],j=h=>{var c,N,y;if(!h)return"No execution results available yet. Run the function to capture side effects including console output, file operations, and API calls.";const u=[],f=((c=h.sideEffects)==null?void 0:c.consoleOutput)||[];f.length>0&&(u.push(`Console Output: ${f.length} log ${f.length===1?"entry":"entries"} captured`),f.forEach(l=>{u.push(` [${l.level.toUpperCase()}] ${l.args.join(" ")}`)}));const w=((N=h.sideEffects)==null?void 0:N.fileWrites)||[];w.length>0&&(u.push(`
12
+ File System Operations: ${w.length} ${w.length===1?"operation":"operations"} detected`),w.forEach(l=>{u.push(` ${l.operation}: ${l.path}${l.size?` (${l.size} bytes)`:""}`)}));const b=((y=h.sideEffects)==null?void 0:y.apiCalls)||[];return b.length>0&&(u.push(`
13
+ API Calls: ${b.length} ${b.length===1?"call":"calls"} made`),b.forEach(l=>{u.push(` ${l.method} ${l.url}${l.status?` → ${l.status}`:""}${l.duration?` (${l.duration}ms)`:""}`)})),h.error&&u.push(`
14
+ Error: ${h.error.name||"Error"}: ${h.error.message}`),u.length===0?"No side effects detected. The function executed without console output, file operations, or API calls.":u.join(`
15
+ `)};return e.jsxs("div",{className:"flex w-full h-full gap-0",children:[e.jsxs("div",{className:"flex-1 border border-gray-200 bg-white rounded flex flex-col",children:[e.jsx("div",{className:"px-4 pt-3.5 pb-2.5",children:e.jsx("h3",{className:"text-[9px] font-semibold text-[#005c75] uppercase tracking-wide text-center m-0",children:"Input Data"})}),e.jsx("div",{className:"flex-1 overflow-auto px-4 pb-0",children:e.jsx("pre",{className:"text-xs font-mono text-gray-800 whitespace-pre-wrap break-words m-0",children:JSON.stringify(v,null,2)})})]}),e.jsxs("div",{className:"flex-1 border border-gray-200 bg-white rounded flex flex-col ml-[-1px]",children:[e.jsx("div",{className:"px-4 pt-3.5 pb-2.5",children:e.jsx("h3",{className:"text-[9px] font-semibold text-[#005c75] uppercase tracking-wide text-center m-0",children:"Returned Data"})}),e.jsx("div",{className:"flex-1 overflow-auto px-4 pb-0",children:o?e.jsx("pre",{className:"text-xs font-mono text-gray-800 whitespace-pre-wrap break-words m-0",children:o.returnValue!==void 0?JSON.stringify(o.returnValue,null,2):"undefined"}):e.jsx("div",{className:"text-sm text-gray-500 italic",children:"No execution results yet"})})]}),e.jsxs("div",{className:"flex-1 border border-gray-200 bg-white rounded flex flex-col ml-[-1px]",children:[e.jsx("div",{className:"px-4 pt-3.5 pb-2.5",children:e.jsx("h3",{className:"text-[9px] font-semibold text-[#005c75] uppercase tracking-wide text-center m-0",children:"Side Effects"})}),e.jsx("div",{className:"flex-1 overflow-auto px-4 pb-4",children:e.jsx("p",{className:"text-sm text-gray-700 leading-[22px] m-0 whitespace-pre-wrap",children:j(o)})})]})]})}const _={commandBoxBg:"#f6f9fc",commandBoxBorder:"#e1e1e1",commandBoxText:"#005c75",heading:"#000",subtext:"#646464",link:"#005c75"};function D({scenarioId:s,analysisId:t}){const[n,o]=i.useState(!1),[v,j]=i.useState(!1),[g,m]=i.useState(null),[k,h]=i.useState(!1),u=s||t;if(!u)return null;const f=`/debug-codeyam ${u}`,w=async()=>{j(!0);try{const{default:c}=await ye(async()=>{const{default:l}=await import("./html2canvas-pro.esm-fmIEn3Bc.js");return{default:l}},[]),y=(await c(document.body,{scale:.5})).toDataURL("image/jpeg",.8);m(y),o(!0)}catch(c){console.error("Screenshot capture failed:",c),o(!0)}finally{j(!1)}},b=()=>{o(!1),m(null)};return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"text-center p-6 bg-cywhite-100 rounded-lg border-cygray-30 border",children:[e.jsx("h3",{className:"font-semibold font-['IBM_Plex_Sans']",style:{fontSize:"18px",lineHeight:"26px",color:_.heading},children:"Claude can help debug this error."}),e.jsx("p",{className:"m-0 mb-4 font-['IBM_Plex_Sans']",style:{fontSize:"14px",lineHeight:"18px",color:_.subtext},children:"Simply run this command in Claude Code:"}),e.jsxs("div",{className:"flex items-center justify-between rounded mx-auto mb-3 border",style:{backgroundColor:_.commandBoxBg,borderColor:_.commandBoxBorder,maxWidth:"505px",height:"35px",paddingLeft:"13px",paddingRight:"13px",paddingTop:"6px",paddingBottom:"6px"},children:[e.jsx("code",{className:"font-mono font-['IBM_Plex_Mono'] flex-1 text-left",style:{fontSize:"12px",lineHeight:"20px",color:_.commandBoxText},children:f}),e.jsx("button",{onClick:c=>{c.stopPropagation(),navigator.clipboard.writeText(f),h(!0),setTimeout(()=>h(!1),2e3)},className:"ml-3 cursor-pointer p-0 bg-transparent border-none hover:opacity-80 transition-opacity",style:{width:"14px",height:"14px",color:k?"#22c55e":_.commandBoxText},title:k?"Copied!":"Copy command","aria-label":"Copy command to clipboard",children:k?e.jsx(Ee,{size:14}):e.jsx(Pe,{size:14})})]}),e.jsxs("p",{className:"m-0 font-['IBM_Plex_Sans']",style:{fontSize:"12px",lineHeight:"15px",color:"#005c75"},children:["If Claude is unable to address this issue or suggests reporting it,"," ",e.jsx("button",{onClick:()=>void w(),disabled:v,className:"underline cursor-pointer bg-transparent border-none p-0 font-normal hover:opacity-80 disabled:opacity-50 disabled:cursor-not-allowed font-['IBM_Plex_Sans']",style:{fontSize:"12px",lineHeight:"15px",color:_.link},children:v?"capturing...":"please do so here"}),"."]})]}),e.jsx(Ce,{isOpen:n,onClose:b,context:{source:s?"scenario-page":"entity-page",entitySha:void 0,scenarioId:s,analysisId:t,currentUrl:typeof window<"u"?window.location.pathname:"/"},screenshotDataUrl:g??void 0})]})}const le=1440,V=[{name:"Mobile",width:375,height:667},{name:"Tablet",width:768,height:1024},{name:"Laptop",width:1024,height:768},{name:"Desktop",width:1440,height:900}],E={background:"#ffdcd9",border:"#fda4a4",text:"#ef4444",link:"#991b1b"};function We({selectedScenario:s,analysis:t,entity:n,viewMode:o,cacheBuster:v,hasScenarios:j,isAnalyzing:g=!1,projectSlug:m,hasAnApiKey:k=!0}){var J,Y,G,Q,X,Z,ee,te,se,re,ne;const h=fe(),[u,f]=i.useState(!1),[w,b]=i.useState(!1),[c,N]=i.useState({name:"Desktop",width:le,height:900}),[y,l]=i.useState(le),[M,S]=i.useState(1),{customSizes:I,addCustomSize:T,removeCustomSize:R}=ge(m),B=i.useMemo(()=>[...V,...I],[I]),H=(a,L)=>{l(a);const C=B.find(p=>p.width===a&&p.height===L);N({name:(C==null?void 0:C.name)||"Custom",width:a,height:L})},O=a=>{l(a.width),N({name:a.name,width:a.width,height:a.height})},W=a=>{T(a,c.width,c.height??900),b(!1),N(L=>({...L,name:a}))},A=(a,L)=>{l(a);const C=B.find(p=>p.width===a&&p.height===L);N(p=>({name:(C==null?void 0:C.name)||"Custom",width:a,height:p.height}))},r=(Y=(J=s==null?void 0:s.metadata)==null?void 0:J.screenshotPaths)==null?void 0:Y[0],x=i.useMemo(()=>s?Ie(s,t==null?void 0:t.status,void 0,n==null?void 0:n.sha,void 0):null,[s,t==null?void 0:t.status,n==null?void 0:n.sha]),d=i.useMemo(()=>{var L,C;const a=[];if((L=t==null?void 0:t.status)!=null&&L.errors&&t.status.errors.length>0)for(const p of t.status.errors)a.push({source:`${p.phase} phase`,message:p.message,stack:p.stack});if((C=t==null?void 0:t.status)!=null&&C.steps)for(const p of t.status.steps)p.error&&a.push({source:p.name,message:p.error,stack:p.errorStack});return a},[(G=t==null?void 0:t.status)==null?void 0:G.errors,(Q=t==null?void 0:t.status)==null?void 0:Q.steps]),$=(x==null?void 0:x.errorMessage)||null,U=(x==null?void 0:x.errorStack)||null,{interactiveServerUrl:K,isStarting:q,isLoading:ce,showIframe:de,iframeKey:xe,onIframeLoad:me}=ke({analysisId:t==null?void 0:t.id,scenarioId:s==null?void 0:s.id,scenarioName:s==null?void 0:s.name,projectSlug:m,enabled:o==="interactive"}),z=i.useMemo(()=>K||null,[K]),F=!g&&j&&s&&!((Z=(X=s.metadata)==null?void 0:X.screenshotPaths)!=null&&Z[0])&&((te=(ee=t==null?void 0:t.status)==null?void 0:ee.scenarios)==null?void 0:te.some(a=>a.name===s.name&&a.screenshotStartedAt&&!a.screenshotFinishedAt)),{lastLine:P}=ve(m,g||o==="interactive"||F||!1);if(!s){if(g&&n)return e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-12 text-center bg-[#f6f9fc]",children:e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-2xl",children:[e.jsx("div",{className:"w-12 h-12 mb-2",children:e.jsx("svg",{className:"animate-spin",viewBox:"0 0 50 50",children:e.jsx("circle",{cx:"25",cy:"25",r:"20",fill:"none",stroke:"#005c75",strokeWidth:"4",strokeDasharray:"31.4 31.4",strokeLinecap:"round"})})}),e.jsx("h2",{className:"text-2xl font-semibold text-[#005c75] leading-[30px] m-0 font-['IBM_Plex_Sans']",children:F?"Capturing screenshots...":"Analyzing..."}),e.jsx("p",{className:"text-xs text-[#8e8e8e] text-center leading-5 m-0 font-['IBM_Plex_Mono']",children:"This may take a few minutes."}),P&&e.jsx("p",{className:"text-xs font-mono text-[#005c75] text-center leading-5 m-0 max-w-xl",children:P}),m&&e.jsx("button",{onClick:()=>f(!0),className:"w-[148px] px-2.5 py-[5px] bg-[#005c75] text-white border-none rounded-sm text-xs font-medium cursor-pointer transition-colors hover:bg-[#004a5c] font-['IBM_Plex_Sans']",children:"View full logs"})]})});if(!j&&n&&!g){if(d.length>0){const a=d.length===1?((se=d[0])==null?void 0:se.message)||"An error occurred during analysis.":`${d.length} errors occurred during analysis.`;return e.jsx("div",{className:"flex-1 flex flex-col justify-center items-center px-5",style:{minHeight:"75vh"},children:e.jsxs("div",{className:"w-full flex flex-col gap-4",style:{maxWidth:"600px"},children:[e.jsx("div",{className:"p-4 rounded",style:{backgroundColor:E.background,border:`2px solid ${E.border}`},role:"alert",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ae,{size:24,className:"shrink-0"}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsxs("p",{className:"m-0 font-['IBM_Plex_Sans']",style:{fontSize:"14px",lineHeight:"20px",color:E.text},children:[e.jsx("span",{className:"font-semibold",children:"Analysis Error."})," ",a," ",e.jsx("button",{onClick:()=>f(!0),className:"underline cursor-pointer bg-transparent border-none p-0 font-medium hover:opacity-80",style:{color:E.link},children:"See logs"})," ","for details."]})})]})}),e.jsx("div",{className:"bg-white border rounded-lg",style:{borderColor:"#e1e1e1"},children:e.jsx(D,{analysisId:t==null?void 0:t.id})})]})})}return e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center bg-[#f6f9fc]",children:e.jsxs("div",{className:"max-w-[600px]",children:[e.jsx("h2",{className:"text-[28px] font-semibold text-[#343434] mb-4 m-0 leading-10",children:"No simulations yet"}),e.jsx("p",{className:"text-base font-normal text-[#3e3e3e] mb-8 leading-6 m-0",children:"Analyze the code to create simulations and create test scenarios automatically."}),n.filePath&&e.jsx("button",{onClick:()=>{h.submit({entitySha:n.sha,filePath:n.filePath},{method:"post",action:"/api/analyze"})},disabled:h.state!=="idle",className:"h-[54px] w-[183px] px-2.5 py-[5px] bg-[#005c75] text-white border-none rounded-lg text-base font-medium cursor-pointer transition-all hover:bg-[#004a5e] disabled:bg-gray-400 disabled:cursor-not-allowed",children:h.state!=="idle"?"Analyzing...":"Analyze"})]})})}return e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center",children:e.jsx("p",{className:"text-base text-gray-500 m-0",children:"Select a scenario to view its screenshot"})})}const he=o==="screenshot"&&(r||$)||o==="interactive"&&(z||q)||o==="data",ue=(g||F)&&!r&&!$&&o==="screenshot";return e.jsxs(e.Fragment,{children:[e.jsx("main",{className:"flex-1 bg-[#f9f9f9] overflow-auto flex flex-col min-w-0",children:ue?e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 text-center bg-linear-to-br from-blue-50 to-indigo-50",children:e.jsxs("div",{className:"max-w-2xl w-full bg-white rounded-t-2xl shadow-xl p-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("div",{className:"inline-flex items-center justify-center w-24 h-24 bg-blue-100 rounded-full mb-6",children:e.jsx("span",{className:"text-5xl animate-spin",children:"⚙️"})}),e.jsx("h2",{className:"text-3xl font-bold text-gray-900 mb-4 m-0",children:F?`Capturing ${n==null?void 0:n.name}`:`Analyzing ${n==null?void 0:n.name}`}),e.jsx("p",{className:"text-base text-gray-600 leading-relaxed m-0 mb-2",children:F?`Taking screenshots for ${((re=t==null?void 0:t.scenarios)==null?void 0:re.length)||0} scenario${((ne=t==null?void 0:t.scenarios)==null?void 0:ne.length)!==1?"s":""}...`:`Generating simulations and scenarios for this ${n==null?void 0:n.entityType} entity...`}),s&&e.jsxs("p",{className:"text-sm text-blue-600 font-semibold m-0",children:["Currently processing: ",s.name]})]}),P&&e.jsx("div",{className:"bg-[#f6f9fc] border-2 border-[#e1e1e1] rounded-lg p-6 mb-6",children:e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("span",{className:"text-xl shrink-0",children:"📝"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-xs font-semibold text-gray-700 uppercase tracking-wide mb-2 m-0",children:"Current Progress"}),e.jsx("p",{className:"text-sm text-gray-900 font-mono wrap-break-word m-0",title:P,children:P})]})]})}),m&&e.jsx("button",{onClick:()=>f(!0),className:"px-6 py-3 bg-[#005c75] text-white border-none rounded-lg text-base font-semibold cursor-pointer transition-all hover:bg-[#004a5e] hover:shadow-lg",children:"📋 View Full Logs"}),e.jsx("p",{className:"text-xs text-gray-500 mt-8 m-0",children:"Screenshots will appear here as they are captured. This may take a few minutes."})]})}):he?e.jsxs(e.Fragment,{children:[$&&!r&&e.jsx("div",{className:"flex-1 flex flex-col justify-center items-center p-6",children:e.jsxs("div",{className:"w-full flex flex-col gap-4",style:{maxWidth:"600px"},children:[e.jsx("div",{className:"p-4 rounded overflow-auto",style:{backgroundColor:E.background,border:`2px solid ${E.border}`,maxHeight:"50vh"},role:"alert",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-center gap-2 font-bold",style:{color:E.text},children:[e.jsx(ae,{size:24,className:"shrink-0"}),e.jsx("div",{children:"Capture Error"})]}),e.jsxs("div",{className:"text-center",children:[e.jsx("button",{onClick:()=>f(!0),className:"underline cursor-pointer bg-transparent border-none p-0 font-medium hover:opacity-80",style:{color:E.link},children:"See logs"})," ","for details."]}),e.jsx("div",{className:"flex-1 min-w-0",children:e.jsx("div",{className:"m-0 font-['IBM_Plex_Sans']",style:{fontSize:"14px",lineHeight:"20px",color:E.text},children:$})})]})}),e.jsx("div",{className:"bg-white border rounded-lg",style:{borderColor:"#e1e1e1"},children:e.jsx(D,{scenarioId:s==null?void 0:s.id,analysisId:t==null?void 0:t.id})})]})}),o==="interactive"?e.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[z&&e.jsxs("div",{className:"bg-gray-50 border-b border-gray-200 px-6 py-3 shrink-0 flex justify-center items-center gap-4",children:[e.jsx(_e,{presets:[...V],customSizes:I,currentWidth:c.width,currentHeight:c.height??900,scale:M,onSizeChange:H,onSaveCustomSize:()=>b(!0),onRemoveCustomSize:R}),s&&n&&e.jsxs(oe,{to:`/entity/${n.sha}/scenarios/${s.id}/fullscreen?from=${encodeURIComponent(`/entity/${n.sha}/scenarios/${s.id}/interactive`)}`,className:"flex items-center gap-2 px-4 py-2 bg-[#005c75] text-white rounded hover:bg-[#004a5c] transition-colors text-sm font-medium no-underline",title:"Open in fullscreen",children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:e.jsx("path",{d:"M2 5V2H5M11 2H14V5M14 11V14H11M5 14H2V11",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),"Fullscreen"]})]}),z&&e.jsx("div",{className:"bg-[#f6f9fc] border-b border-[rgba(0,92,117,0.25)] flex justify-center",children:e.jsx("div",{style:{maxWidth:`${V[V.length-1].width}px`,width:"100%"},children:e.jsx(be,{currentViewportWidth:y,currentPresetName:c.name,onDevicePresetClick:O,devicePresets:B})})}),e.jsx(pe,{scenarioId:s.id,scenarioName:s.name,iframeUrl:z,isStarting:q,isLoading:ce,showIframe:de,iframeKey:xe,onIframeLoad:me,onScaleChange:S,onDimensionChange:A,projectSlug:m,defaultWidth:c.width,defaultHeight:c.height})]}):o==="data"?e.jsx("div",{className:"flex-1 min-h-0",children:e.jsx(Se,{scenario:s,analysis:t,entity:n})}):e.jsx("div",{className:"flex-1 flex flex-col",children:e.jsx("div",{className:"flex-1 p-6 flex items-center justify-center",children:e.jsx("div",{className:"transition-all duration-300",style:{maxWidth:`${y}px`},children:(r||!$)&&e.jsx(Ne,{screenshotPath:r,cacheBuster:v,alt:s.name,className:"w-full rounded-lg shadow-[0_10px_25px_rgba(0,0,0,0.1)] bg-white"})})})})]}):e.jsx("div",{className:"flex-1 flex flex-col",children:e.jsx("div",{className:"flex-1 flex flex-col items-center justify-center p-6 overflow-auto w-full",children:g&&!r?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx("div",{className:"bg-blue-50 border-2 border-blue-200 rounded-lg p-8",children:e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsx("span",{className:"animate-spin text-4xl shrink-0",children:"⚙️"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-xl font-semibold text-blue-900 m-0 mb-3",children:"Capturing Screenshot"}),e.jsxs("p",{className:"text-sm text-blue-800 m-0 mb-4",children:["Analysis is in progress for"," ",e.jsx("strong",{children:s.name}),". The screenshot will appear here once capture is complete."]}),P&&e.jsxs("div",{className:"bg-white border border-blue-200 rounded p-4 mt-4",children:[e.jsx("h4",{className:"text-xs font-semibold text-blue-800 m-0 mb-2 uppercase tracking-wide",children:"Current Progress"}),e.jsx("p",{className:"text-sm text-blue-900 m-0 font-mono wrap-break-word",children:P})]}),m&&e.jsx("button",{onClick:()=>f(!0),className:"mt-4 px-4 py-2 bg-[#005c75] text-white border-none rounded-md text-sm font-semibold cursor-pointer transition-colors hover:bg-[#004a5e]",children:"📋 View Full Logs"})]})]})})}):$?e.jsxs("div",{className:"w-full h-full flex flex-col items-center justify-center overflow-auto gap-6",children:[!k&&e.jsx("div",{className:"bg-blue-50 border-2 border-blue-300 rounded-lg p-8",children:e.jsxs("div",{className:"flex-1 flex flex-col gap-4 items-center justify-center",children:[e.jsxs("div",{className:"flex items-start gap-4",children:[e.jsx("span",{className:"text-blue-600 text-2xl shrink-0",children:"🔑"}),e.jsx("h3",{className:"text-xl font-semibold text-blue-900 m-0 mb-3",children:"Improve Analysis Quality with an API Key"})]}),e.jsxs("div",{className:"bg-white border border-blue-200 rounded p-4",children:[e.jsx("h4",{className:"text-xs font-semibold text-blue-900 m-0 mb-2 uppercase tracking-wide",children:"CodeYam requires an AI API key for reliable analysis."}),e.jsxs("ul",{className:"text-sm text-blue-800 m-0 space-y-1 pl-5 list-disc",children:[e.jsx("li",{children:"You can use API keys for a variety of models"}),e.jsx("li",{children:"Faster analysis processing"}),e.jsx("li",{children:"Better handling of complex code structures"}),e.jsx("li",{children:"Improved scenario generation quality"})]})]}),e.jsx(oe,{to:"/settings",className:"inline-block px-4 py-2 bg-blue-600 text-white border-none rounded-md text-sm font-semibold cursor-pointer transition-colors hover:bg-blue-700",children:"🔐 Configure API Keys"})]})}),e.jsx("div",{className:"bg-red-50 border-2 border-red-300 rounded-lg p-8 w-full max-w-4xl my-auto",children:e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsx("span",{className:"text-red-500 text-4xl shrink-0",children:"⚠️"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("h3",{className:"text-xl font-semibold text-red-800 m-0 mb-3",children:"Capture Failed"}),e.jsx("p",{className:"text-sm text-red-700 m-0 mb-4",children:"An error occurred while capturing this scenario. No screenshot is available."}),e.jsxs("div",{className:"bg-white border border-red-200 rounded p-4",children:[e.jsx("h4",{className:"text-xs font-semibold text-red-800 m-0 mb-2 uppercase tracking-wide",children:"Error Message"}),e.jsx("div",{className:"max-h-[300px] overflow-auto",children:e.jsx("p",{className:"text-sm text-red-900 m-0 font-mono whitespace-pre-wrap wrap-break-word",children:$})})]}),U&&e.jsxs("details",{className:"mt-4",children:[e.jsx("summary",{className:"text-sm text-red-700 cursor-pointer hover:text-red-900 font-semibold",children:"📋 View full stack trace"}),e.jsx("div",{className:"mt-3 bg-white border border-red-200 rounded p-4 overflow-auto",children:e.jsx("pre",{className:"text-xs text-red-900 font-mono whitespace-pre-wrap wrap-break-word m-0",children:U})})]}),e.jsx("div",{className:"mt-4 bg-white border rounded-lg",style:{borderColor:"#e1e1e1"},children:e.jsx(D,{scenarioId:s==null?void 0:s.id,analysisId:t==null?void 0:t.id})})]})]})})]}):d.length>0?e.jsx("div",{className:"w-full h-full flex items-center justify-center overflow-auto",children:e.jsx("div",{className:"bg-red-50 border-2 border-red-300 rounded-lg p-8 w-full max-w-4xl my-auto",children:e.jsxs("div",{className:"flex items-start gap-4 mb-6",children:[e.jsx("span",{className:"text-red-500 text-4xl shrink-0",children:"⚠️"}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx(AnalysisErrorDisplay,{errors:d,title:"Analysis Error",description:d.length===1?"An error occurred during analysis. Screenshot capture was not completed.":`${d.length} errors occurred during analysis. Screenshot capture was not completed.`}),e.jsx("div",{className:"mt-4 bg-white border rounded-lg",style:{borderColor:"#e1e1e1"},children:e.jsx(D,{scenarioId:s==null?void 0:s.id,analysisId:t==null?void 0:t.id})})]})]})})}):e.jsxs("div",{className:"flex flex-col items-center gap-4 text-center",children:[e.jsx("span",{className:"text-6xl text-gray-300",children:"📷"}),e.jsx("p",{className:"text-lg text-gray-500 m-0",children:"No screenshot available for this scenario"}),e.jsx("p",{className:"text-sm text-gray-400 m-0",children:"Try recapturing or debugging this scenario"})]})})})}),u&&m&&e.jsx(we,{projectSlug:m,onClose:()=>f(!1)}),w&&e.jsx(je,{width:c.width,height:c.height??900,onSave:W,onCancel:()=>b(!1)})]})}export{D as C,ae as E,We as S};
@@ -1 +1 @@
1
- import{j as v}from"./chunk-WWGJGFF6-CbVoyx1U.js";function O({filePath:n,maxLength:x=60,className:f,style:u}){const o=((t,r)=>{if(t.length<=r)return t;const a="...",c=r-a.length,i=Math.ceil(c*.4),d=Math.floor(c*.6),e=t.slice(0,i),s=t.slice(-d),h=e.lastIndexOf("/"),l=s.indexOf("/"),g=h>i*.5?e.slice(0,h+1):e,m=l!==-1&&l<d*.5?s.slice(l):s;return`${g}${a}${m}`})(n,x),p=o!==n;return v.jsx("span",{className:f||"font-normal text-gray-900 text-[14px] select-text cursor-text",style:{...u,display:"inline-block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:p?n:void 0,children:o})}export{O as T};
1
+ import{j as v}from"./chunk-JMJ3UQ3L-BambyYE_.js";function O({filePath:n,maxLength:x=60,className:f,style:u}){const o=((t,r)=>{if(t.length<=r)return t;const a="...",c=r-a.length,i=Math.ceil(c*.4),d=Math.floor(c*.6),e=t.slice(0,i),s=t.slice(-d),h=e.lastIndexOf("/"),l=s.indexOf("/"),g=h>i*.5?e.slice(0,h+1):e,m=l!==-1&&l<d*.5?s.slice(l):s;return`${g}${a}${m}`})(n,x),p=o!==n;return v.jsx("span",{className:f||"font-normal text-gray-900 text-[14px] select-text cursor-text",style:{...u,display:"inline-block",maxWidth:"100%",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:p?n:void 0,children:o})}export{O as T};
@@ -0,0 +1,11 @@
1
+ import{w as le,u as ae,c as ne,f as re,r as d,j as e,L as h}from"./chunk-JMJ3UQ3L-BambyYE_.js";import{u as oe}from"./useLastLogLine-BqPPNjAl.js";import{u as ie}from"./useToast-DWHcCcl1.js";import{u as ce}from"./useReportContext-DsJbgMY9.js";import{L as de}from"./LogViewer-wDPcZNKx.js";import{I as j,C as R,E as xe}from"./EntityTypeIcon-CXFKsCOD.js";import{S as U}from"./SafeScreenshot-BfmDgXxG.js";import{c as Z}from"./createLucideIcon-CgUsG7ib.js";import{C as me}from"./circle-check-CaVsIRxt.js";import{L as C}from"./loader-circle-CNp9QFCX.js";/**
2
+ * @license lucide-react v0.556.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 he=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],pe=Z("folder-open",he);/**
7
+ * @license lucide-react v0.556.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const ue=[["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"}]],ge=Z("zap",ue),ye="/assets/codeyam-name-logo-CvKwUgHo.svg",Te=()=>[{title:"Dashboard - CodeYam"},{name:"description",content:"CodeYam project dashboard"}],Le=le(function(){var W,I;const{stats:v,uncommittedFiles:y,uncommittedEntitiesList:k,recentSimulations:p,visualEntitiesForSimulation:i,projectSlug:u,queueState:A,currentCommit:S}=ae(),o=ne(),q=re(),{showToast:x}=ie();ce({source:"dashboard"});const[Q,Y]=d.useState(new Set),[c,$]=d.useState(null),[O,M]=d.useState(!1),[B,E]=d.useState(!1),{lastLine:F,isCompleted:D,resetLogs:G}=oe(u,!!c),{simulatingEntity:f,scenarios:N,scenarioStatuses:K,allScenariosCaptured:T}=d.useMemo(()=>{var r,w;const s={simulatingEntity:null,scenarios:[],scenarioStatuses:[],allScenariosCaptured:!1};if(!c)return s;const t=i==null?void 0:i.find(z=>z.sha===c);if(!t)return s;const l=(r=t.analyses)==null?void 0:r[0],n=(l==null?void 0:l.scenarios)||[],a=((w=l==null?void 0:l.status)==null?void 0:w.scenarios)||[],g=a.filter(z=>z.screenshotFinishedAt).length,m=n.length>0&&g===n.length;return{simulatingEntity:t,scenarios:n,scenarioStatuses:a,allScenariosCaptured:m}},[c,i]);d.useEffect(()=>{(D||T)&&$(null)},[D,T]);const L=(W=S==null?void 0:S.metadata)==null?void 0:W.currentRun,V=new Set((L==null?void 0:L.currentEntityShas)||[]),_=new Set(A.jobs.flatMap(s=>s.entityShas||[])),H=new Set(((I=A.currentlyExecuting)==null?void 0:I.entityShas)||[]),P=k.filter(s=>s.entityType==="visual"||s.entityType==="library"),b=P.filter(s=>!V.has(s.sha)&&!_.has(s.sha)&&!H.has(s.sha)),X=()=>{if(b.length===0){x("All entities are already queued or analyzing","info",3e3);return}const s=b.map(t=>t.sha);E(!0),x(`Starting analysis for ${b.length} entities...`,"info",3e3),o.submit({entityShas:s.join(",")},{method:"post",action:"/api/analyze"})};d.useEffect(()=>{if(o.state==="idle"&&o.data){const s=o.data;s.success?(console.log("[Analyze All] Success:",s.message),x(`Analysis started for ${s.entityCount} entities in ${s.fileCount} files. Watch the logs for progress.`,"success",6e3),E(!1)):s.error&&(console.error("[Analyze All] Error:",s.error),x(`Error: ${s.error}`,"error",8e3),E(!1))}},[o.state,o.data,x]);const J=(s,t)=>{console.log("Simulating entity:",s);const l=i==null?void 0:i.find(n=>n.sha===s);$(s),G(),x(`Starting analysis for ${(l==null?void 0:l.name)||"entity"}...`,"info",3e3),o.submit({entitySha:s,filePath:t},{method:"post",action:"/api/analyze"})},ee=s=>{Y(t=>{const l=new Set(t);return l.has(s)?l.delete(s):l.add(s),l})},se=d.useMemo(()=>{const s=new Map;return p.forEach(t=>{const l=t.entitySha;s.has(l)||s.set(l,[]),s.get(l).push(t)}),Array.from(s.entries()).map(([t,l])=>({entitySha:t,entityName:l[0].entityName,scenarios:l}))},[p]),te=[{label:"Total Entities",value:v.totalEntities,iconType:"folder",link:"/files",color:"#F59E0B"},{label:"Analyzed Entities",value:v.entitiesWithAnalyses,iconType:"check",link:"/simulations",color:"#10B981"},{label:"Visual Components",value:v.visualEntities,iconType:"image",link:"/files?entityType=visual",color:"#8B5CF6"},{label:"Library Functions",value:v.libraryEntities,iconType:"code-xml",link:"/files?entityType=library",color:"#0DBFE9"}];return e.jsx("div",{className:"bg-cygray-10 min-h-screen",children:e.jsxs("div",{className:"px-20 py-12",children:[e.jsxs("header",{className:"mb-8 flex justify-between items-center",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("img",{src:ye,alt:"CodeYam",className:"h-3.5"}),e.jsx("span",{className:"text-gray-400 text-sm",children:"|"}),e.jsxs("h1",{className:"text-sm font-normal text-gray-600 m-0",children:["Overview of"," ",e.jsx("span",{className:"font-semibold",children:u?u.replace(/-/g," ").replace(/\b\w/g,s=>s.toUpperCase()):"Project"})]})]}),q.state==="loading"&&e.jsx("div",{className:"text-blue-600 text-sm font-medium animate-pulse",children:"🔄 Updating..."})]}),e.jsx("div",{className:"flex items-center justify-between gap-3",children:te.map((s,t)=>e.jsx(h,{to:s.link,className:"flex-1 bg-white rounded-xl border border-gray-200 overflow-hidden flex transition-all hover:shadow-lg hover:-translate-y-0.5 no-underline cursor-pointer",style:{borderLeft:`4px solid ${s.color}`},children:e.jsxs("div",{className:"px-6 py-4 flex flex-col gap-3 flex-1",children:[e.jsxs("div",{className:"flex md:justify-between md:items-start md:flex-row flex-col",children:[e.jsx("div",{className:"text-xs text-gray-700 font-medium",children:s.label}),e.jsx("div",{className:"text-xs font-medium transition-colors flex items-center gap-1 sm:hidden md:flex",style:{color:s.color},children:"View All →"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"rounded-lg p-2 leading-none shrink-0",style:{backgroundColor:`${s.color}15`},children:[s.iconType==="folder"&&e.jsx(pe,{size:20,style:{color:s.color}}),s.iconType==="check"&&e.jsx(me,{size:20,style:{color:s.color}}),s.iconType==="image"&&e.jsx(j,{size:20,style:{color:s.color}}),s.iconType==="code-xml"&&e.jsx(R,{size:20,style:{color:s.color}})]}),e.jsx("div",{className:"text-2xl font-bold text-gray-900 leading-none",children:s.value})]}),e.jsx("div",{className:"text-xs font-medium transition-colors flex items-center gap-1 md:hidden",style:{color:s.color},children:"View All →"})]})]})},t))}),e.jsxs("div",{className:"mt-12 grid gap-8 items-start",style:{gridTemplateColumns:"repeat(auto-fit, minmax(500px, 1fr))"},children:[e.jsxs("section",{id:"uncommitted",className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsxs("div",{className:"flex justify-between items-start mb-5",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-semibold text-gray-900 m-0 mb-1",children:"Uncommitted Changes"}),e.jsx("p",{className:"text-sm text-gray-500 m-0",children:y.length>0?`${y.length} file${y.length!==1?"s":""} with ${k.length} uncommitted entit${k.length!==1?"ies":"y"}`:"No uncommitted changes detected"})]}),P.length>0&&e.jsx("button",{onClick:X,disabled:o.state!=="idle"||B||b.length===0,className:"px-5 py-2.5 text-white border-none rounded-lg text-sm font-semibold cursor-pointer transition-all hover:-translate-y-px disabled:bg-gray-400 disabled:cursor-not-allowed disabled:translate-y-0",style:{backgroundColor:"#005C75"},onMouseEnter:s=>s.currentTarget.style.backgroundColor="#004560",onMouseLeave:s=>s.currentTarget.style.backgroundColor="#005C75",children:o.state!=="idle"||B?"Starting analysis...":b.length===0?"All Queued":"Analyze All"})]}),y.length>0?e.jsx("div",{className:"flex flex-col gap-3",children:y.map(([s,t])=>{const l=Q.has(s),n=t.editedEntities||[];return e.jsxs("div",{className:"bg-white border border-gray-200 border-l-4 rounded-lg overflow-hidden",style:{borderLeftColor:"#306AFF"},children:[e.jsx("div",{className:"p-4 cursor-pointer select-none transition-colors hover:bg-gray-50",onClick:()=>ee(s),role:"button",tabIndex:0,children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-gray-500 text-xs w-4 shrink-0",children:l?"▼":"▶"}),e.jsxs("svg",{width:"16",height:"20",viewBox:"0 0 12 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"shrink-0",children:[e.jsxs("g",{clipPath:"url(#clip0_784_10666)",children:[e.jsx("path",{d:"M0 2.55857C0 1.14551 1.14551 0 2.55857 0H8.73194L12 3.3616V13.4414C12 14.8545 10.8545 16 9.44143 16H2.55857C1.14551 16 0 14.8545 0 13.4414V2.55857Z",fill:"#DDDDFE"}),e.jsx("path",{d:"M8.72656 3.3307H11.9906L8.72656 0V3.3307Z",fill:"#306AFF"}),e.jsx("line",{x1:"1.8125",y1:"5.94825",x2:"10.0235",y2:"5.94825",stroke:"#306AFF",strokeWidth:"1.27929"}),e.jsx("line",{x1:"1.8125",y1:"8.82715",x2:"6.01207",y2:"8.82715",stroke:"#306AFF",strokeWidth:"1.27929"}),e.jsx("line",{x1:"1.8125",y1:"11.7061",x2:"10.0235",y2:"11.7061",stroke:"#306AFF",strokeWidth:"1.27929"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_784_10666",children:e.jsx("rect",{width:"12",height:"16",fill:"white"})})})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("span",{className:"font-normal text-gray-900 text-sm block truncate",children:s}),e.jsxs("span",{className:"text-xs text-gray-500",children:[n.length," entit",n.length!==1?"ies":"y"]})]})]})}),l&&e.jsx("div",{className:"border-t border-gray-200 bg-gray-50 p-3 flex flex-col gap-2",children:n.length>0?n.map(a=>{const g=V.has(a.sha),m=_.has(a.sha)||H.has(a.sha);return e.jsxs(h,{to:`/entity/${a.sha}`,className:"flex items-center gap-4 p-4 bg-white border border-gray-200 rounded-lg no-underline transition-all hover:shadow-md hover:-translate-y-0.5",style:{borderColor:"inherit"},onMouseEnter:r=>r.currentTarget.style.borderColor="#005C75",onMouseLeave:r=>r.currentTarget.style.borderColor="inherit",children:[e.jsxs("div",{className:"shrink-0 rounded-lg p-1.5 flex items-center justify-center",style:{backgroundColor:a.entityType==="visual"?"#8B5CF615":a.entityType==="library"?"#6366F1":"#EC4899"},children:[a.entityType==="visual"&&e.jsx(j,{size:16,style:{color:"#8B5CF6"}}),a.entityType==="library"&&e.jsx(R,{size:16,className:"text-white"}),a.entityType==="other"&&e.jsx(ge,{size:16,className:"text-white"})]}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-0.5",children:[e.jsx("div",{className:"font-semibold text-gray-900 text-sm",children:a.name}),a.entityType==="visual"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#8B5CF60D",color:"#8B5CF6"},children:"Visual"}),a.entityType==="library"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#0DBFE90D",color:"#0DBFE9"},children:"Library"}),a.entityType==="other"&&e.jsx("div",{className:"px-2 py-0.5 rounded-sm text-[10px] uppercase font-bold",style:{backgroundColor:"#EC48990D",color:"#EC4899"},children:"Other"})]}),a.description&&e.jsx("div",{className:"text-sm text-gray-500 mt-1 overflow-hidden text-ellipsis whitespace-nowrap",children:a.description})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[g&&e.jsxs("div",{className:"px-2 py-1 bg-pink-100 rounded text-xs text-pink-700 font-semibold flex items-center gap-1.5",children:[e.jsx(C,{size:14,className:"animate-spin"}),"Analyzing..."]}),!g&&m&&e.jsx("div",{className:"px-2 py-1 bg-purple-50 border border-purple-300 rounded text-xs text-purple-700 font-semibold",children:"⏳ Queued"}),!g&&!m&&e.jsx("button",{onClick:r=>{r.preventDefault(),r.stopPropagation(),x(`Starting analysis for ${a.name}...`,"info",3e3),o.submit({entityShas:a.sha},{method:"post",action:"/api/analyze"})},disabled:o.state!=="idle",className:"px-3 py-1.5 text-white border-none rounded text-xs font-medium cursor-pointer transition-all disabled:bg-gray-400 disabled:cursor-not-allowed",style:{backgroundColor:"#005C75"},onMouseEnter:r=>r.currentTarget.style.backgroundColor="#004560",onMouseLeave:r=>r.currentTarget.style.backgroundColor="#005C75",children:"Analyze"})]})]},a.sha)}):e.jsx("div",{className:"text-sm text-gray-500 italic p-2",children:"No entity changes detected in this file"})})]},s)})}):e.jsxs("div",{className:"py-12 px-6 text-center flex flex-col items-center bg-gray-50 rounded-lg min-h-50 justify-center",children:[e.jsxs("svg",{width:"52",height:"68",viewBox:"0 0 26 34",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"mb-4 opacity-40",children:[e.jsxs("g",{clipPath:"url(#clip0_784_10631)",children:[e.jsx("path",{d:"M0 2.55857C0 1.14551 1.14551 0 2.55857 0H18.9423L26.0318 7.14651V31.4562C26.0318 32.8693 24.8863 34.0148 23.4732 34.0148H2.55857C1.14551 34.0148 0 32.8693 0 31.4562V2.55857Z",fill:"#D9D9D9"}),e.jsx("path",{d:"M18.9453 7.08081H26.0261L18.9453 0V7.08081Z",fill:"#646464"}),e.jsx("line",{x1:"3.92188",y1:"13.3633",x2:"21.7341",y2:"13.3633",stroke:"#646464",strokeWidth:"1.27929"}),e.jsx("line",{x1:"3.92188",y1:"19.4863",x2:"13.0321",y2:"19.4863",stroke:"#646464",strokeWidth:"1.27929"}),e.jsx("line",{x1:"3.92188",y1:"25.6016",x2:"21.7341",y2:"25.6016",stroke:"#646464",strokeWidth:"1.27929"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0_784_10631",children:e.jsx("rect",{width:"26",height:"34",fill:"white"})})})]}),e.jsx("p",{className:"text-sm font-medium text-gray-400 m-0 mb-2",children:"No Uncommitted Changes."})]})]}),e.jsxs("section",{className:"bg-white border border-gray-200 rounded-xl p-6",children:[e.jsx("div",{className:"flex justify-between items-start mb-5",children:e.jsxs("div",{children:[e.jsx("h2",{className:"text-[22px] font-semibold text-gray-900 m-0 mb-1",children:"Recent Simulations"}),e.jsx("p",{className:"text-sm text-gray-500 m-0",children:p.length>0?`Latest ${p.length} captured screenshot${p.length!==1?"s":""}`:"No simulations captured yet"})]})}),p.length>0&&!c?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"space-y-6 mb-5",children:se.map(s=>e.jsxs("div",{children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2",children:[e.jsx("div",{className:"shrink-0 rounded-lg p-1.5 flex items-center justify-center bg-purple-100",children:e.jsx(j,{size:16,style:{color:"#8B5CF6"}})}),e.jsx(h,{to:`/entity/${s.entitySha}`,className:"text-sm font-semibold text-gray-900 no-underline hover:text-gray-700 transition-colors",children:s.entityName})]}),e.jsx("div",{className:"grid grid-cols-4 gap-3",children:s.scenarios.map((t,l)=>e.jsx(h,{to:t.scenarioId?`/entity/${t.entitySha}/scenarios/${t.scenarioId}`:`/entity/${t.entitySha}`,className:"aspect-4/3 border border-gray-200 rounded-lg overflow-hidden bg-gray-50 transition-all flex items-center justify-center hover:scale-105",onMouseEnter:n=>{n.currentTarget.style.borderColor="#005C75",n.currentTarget.style.boxShadow="0 4px 12px rgba(0, 92, 117, 0.2)"},onMouseLeave:n=>{n.currentTarget.style.borderColor="#E5E7EB",n.currentTarget.style.boxShadow="none"},title:`${t.scenarioName}`,children:e.jsx(U,{screenshotPath:t.screenshotPath,alt:t.scenarioName,className:"max-w-full max-h-full object-contain object-center"})},l))})]},s.entitySha))}),e.jsx(h,{to:"/simulations",className:"block text-center p-3 rounded-lg no-underline font-semibold text-sm transition-all",style:{color:"#005C75",backgroundColor:"#F6F9FC"},onMouseEnter:s=>s.currentTarget.style.backgroundColor="#EEF4F8",onMouseLeave:s=>s.currentTarget.style.backgroundColor="#F6F9FC",children:"View All Recent Simulations →"})]}):c?e.jsxs("div",{className:"p-0 bg-white rounded-lg flex flex-col gap-0",children:[f&&e.jsx("div",{className:"p-4 rounded-t-lg",style:{backgroundColor:"#F0F5F8",borderBottom:"2px solid #005C75"},children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"text-[32px] leading-none",children:e.jsx(xe,{type:"visual"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"text-base font-bold mb-1",style:{color:"#005C75"},children:["Generating Simulations for ",f.name]}),e.jsx("div",{className:"text-[13px] text-gray-500 font-mono overflow-hidden text-ellipsis whitespace-nowrap",children:f.filePath})]})]})}),T?e.jsxs("div",{className:"flex items-center gap-2 text-sm text-emerald-600 font-medium p-4 bg-emerald-50",children:[e.jsx("span",{className:"text-lg",children:"✅"}),e.jsxs("span",{children:["Complete (",N.length," scenario",N.length!==1?"s":"",")"]})]}):F?e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(C,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs",title:F,children:F}),u&&e.jsx("button",{onClick:()=>M(!0),className:"px-2 py-1.5 bg-gray-500 text-white border-none rounded-md text-[13px] font-medium cursor-pointer transition-all whitespace-nowrap self-start hover:bg-gray-600 hover:-translate-y-px",title:"View analysis logs",children:"📋 Logs"})]}):o.state!=="idle"?e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(C,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:"Initializing analysis..."})]}):e.jsxs("div",{className:"flex items-center justify-between gap-1.5 text-sm font-medium p-4 bg-gray-50",style:{color:"#005C75"},children:[e.jsx(C,{size:18,className:"animate-spin shrink-0"}),e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:"Starting analysis..."})]}),N.length>0&&e.jsx("div",{className:"flex gap-2 flex-wrap p-4 bg-white border-t border-gray-200",children:N.slice(0,8).map((s,t)=>{var m,r;const l=(r=(m=s.metadata)==null?void 0:m.screenshotPaths)==null?void 0:r[0],n=K.find(w=>w.name===s.name),a=(n==null?void 0:n.screenshotStartedAt)&&!(n!=null&&n.screenshotFinishedAt);return l?e.jsx(h,{to:`/entity/${c}`,className:"w-20 h-15 border-2 border-gray-200 rounded overflow-hidden bg-gray-50 cursor-pointer transition-all flex items-center justify-center no-underline hover:border-blue-600 hover:scale-105 hover:shadow-md",children:e.jsx(U,{screenshotPath:l,alt:s.name,title:s.name,className:"max-w-full max-h-full object-contain object-center"})},t):e.jsx("div",{className:"w-20 h-15 border-2 border-dashed border-gray-300 rounded bg-gray-50 flex items-center justify-center text-2xl",title:`Capturing ${s.name}...`,children:e.jsx("span",{className:a?"animate-pulse":"text-gray-400",children:a?"⋯":"⏹️"})},t)})})]}):e.jsxs("div",{className:"flex flex-col items-center",children:[e.jsxs("div",{className:"py-12 px-6 text-center bg-gray-50 rounded-lg w-full flex flex-col items-center justify-center min-h-50",children:[e.jsx("div",{className:"mb-4 bg-[#efefef] rounded-lg p-3",children:e.jsx(j,{size:28,style:{color:"#999999"},strokeWidth:1.5})}),e.jsx("p",{className:"text-gray-700 m-0 font-semibold",children:"Start by analyzing your first component below."})]}),((i==null?void 0:i.length)??0)>0?e.jsx(e.Fragment,{children:e.jsx("div",{className:"flex flex-col gap-3 mt-6 w-full",children:(c&&f?[f]:i||[]).map(s=>e.jsx("div",{className:"flex flex-col gap-3",children:e.jsxs("div",{className:"flex items-center gap-4 p-4 bg-white border border-gray-200 rounded-lg transition-colors",style:{borderLeft:"4px solid #8B5CF6"},onMouseEnter:t=>{t.currentTarget.style.backgroundColor="#F9FAFB"},onMouseLeave:t=>{t.currentTarget.style.backgroundColor="white"},children:[e.jsxs(h,{to:`/entity/${s.sha}`,className:"flex items-center gap-4 flex-1 min-w-0 no-underline",children:[e.jsx("div",{className:"shrink-0 rounded-lg p-1.5 flex items-center justify-center bg-purple-100",children:e.jsx(j,{size:16,style:{color:"#8B5CF6"}})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsx("div",{className:"font-semibold text-gray-900 text-sm mb-1",children:s.name}),e.jsx("div",{className:"text-xs text-gray-500 font-mono overflow-hidden text-ellipsis whitespace-nowrap",children:s.filePath})]})]}),e.jsx("button",{onClick:()=>J(s.sha,s.filePath||""),disabled:o.state!=="idle"||c!==null,className:"px-4 py-2 text-white border-none rounded text-sm font-medium cursor-pointer transition-all whitespace-nowrap shrink-0 disabled:bg-gray-400 disabled:cursor-not-allowed disabled:translate-y-0",style:{backgroundColor:"#005C75"},onMouseEnter:t=>t.currentTarget.style.backgroundColor="#004560",onMouseLeave:t=>t.currentTarget.style.backgroundColor="#005C75",title:c?"Please wait for current analysis to complete":"Analyze this entity",children:"Analyze"})]})},s.sha))})}):e.jsx("p",{className:"text-base text-gray-600 m-0 mb-6 leading-relaxed mt-6",children:"Run analysis on your visual components to create simulations and capture screenshots"})]})]})]}),O&&u&&e.jsx(de,{projectSlug:u,onClose:()=>M(!1)})]})})});export{Le as default,Te as meta};
@@ -0,0 +1,32 @@
1
+ import{j as e,w as X,u as Z,h as R,r as A,L as N,f as U}from"./chunk-JMJ3UQ3L-BambyYE_.js";import{L as ee}from"./LogViewer-wDPcZNKx.js";import{u as te}from"./useLastLogLine-BqPPNjAl.js";import{u as se}from"./useReportContext-DsJbgMY9.js";import{E as q}from"./EntityTypeIcon-CXFKsCOD.js";import{E as Q}from"./EntityTypeBadge-CzGX-miz.js";import{S as B}from"./SafeScreenshot-BfmDgXxG.js";import{L as ie}from"./LoadingDots-D1CdlbrV.js";import{L as le}from"./loader-circle-CNp9QFCX.js";import{c as K}from"./createLucideIcon-CgUsG7ib.js";/**
2
+ * @license lucide-react v0.556.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 oe=[["path",{d:"M4.929 4.929 19.07 19.071",key:"196cmz"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],ae=K("ban",oe);/**
7
+ * @license lucide-react v0.556.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const re=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],Y=K("circle-pause",re);/**
12
+ * @license lucide-react v0.556.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const ne=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]],ce=K("file-code",ne);/**
17
+ * @license lucide-react v0.556.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const de=[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]],xe=K("grip-vertical",de);/**
22
+ * @license lucide-react v0.556.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const he=[["path",{d:"M13 5h8",key:"a7qcls"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 19h8",key:"c3s6r1"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["rect",{x:"3",y:"4",width:"6",height:"6",rx:"1",key:"cif1o7"}]],pe=K("list-todo",he),fe={analyzer:{bgColor:"#e1e1e1",textColor:"#3e3e3e",borderColor:"#e1e1e1"},capture:{bgColor:"#e1e1e1",textColor:"#3e3e3e",borderColor:"#e1e1e1"},running:{bgColor:"#e8ffe6",textColor:"#00925d",borderColor:"#c3f3bf"},error:{bgColor:"#fee2e2",textColor:"#991b1b",borderColor:"#fecaca"}};function V({variant:a,pid:t,label:S,className:h=""}){const n=fe[a],l=S||(a==="analyzer"&&t?`Analyzer: ${t}`:a==="capture"&&t?`Capture: ${t}`:a==="running"?"Running":a==="error"?"Error":"");return e.jsx("div",{className:`inline-flex items-center justify-center px-[8px] rounded-[4px] ${h}`,style:{backgroundColor:n.bgColor,borderWidth:"1px",borderStyle:"solid",borderColor:n.borderColor,height:"20px"},children:e.jsx("span",{className:"font-['IBM_Plex_Sans']",style:{fontSize:"10px",fontWeight:400,lineHeight:"15px",color:n.textColor},children:l})})}function ge({activeTab:a,hasCurrentActivity:t,queuedCount:S,historicCount:h}){const n=[{id:"current",label:"Current Activity",hasContent:t,count:t?1:null},{id:"queued",label:"Queued Activity",hasContent:S>0,count:S},{id:"historic",label:"Historic Activity",hasContent:h>0,count:h}];return e.jsx("div",{className:"border-b border-gray-200 mb-6",children:e.jsx("nav",{className:"flex gap-8",children:n.map(l=>{const r=a===l.id;return e.jsx(N,{to:l.id==="current"?"/activity":`/activity/${l.id}`,className:`
27
+ relative pb-4 px-2 text-sm font-medium transition-colors cursor-pointer
28
+ ${r?"border-b-2":"text-gray-500 hover:text-gray-700"}
29
+ `,style:r?{color:"#005C75",borderColor:"#005C75"}:{},children:e.jsxs("span",{className:"flex items-center gap-2",children:[l.label,l.count!==null&&l.count>0&&e.jsx("span",{className:`inline-flex items-center justify-center px-2 py-0.5 text-xs font-semibold rounded-full ${r?"bg-[#cbf3fa] text-[#005c75]":"bg-[#e1e1e1] text-[#3e3e3e]"}`,children:l.count}),l.count===null&&l.hasContent&&e.jsx("span",{className:`
30
+ inline-block w-2 h-2 rounded-full
31
+ ${r?"":"bg-gray-400"}
32
+ `,style:r?{backgroundColor:"#005C75"}:{}})]})},l.id)})})})}function me({currentlyExecuting:a,currentRun:t,state:S,projectSlug:h,commitSha:n,onShowLogs:l,recentCompletedEntities:r,hasMoreCompletedRuns:d,currentEntityScenarios:v,currentEntityForScenarios:g,currentAnalysisStatus:m}){var D,_,z,J;const[j,b]=A.useState({}),[L,$]=A.useState({isKilling:!1,current:0,total:0}),W=U(),E=!!a,k=(a==null?void 0:a.entities)||[],s=!!(t!=null&&t.analysisCompletedAt),c=s&&!!(t!=null&&t.capturePid),f=!s,M=E,C=v||[],{lastLine:y}=te(h,M);A.useEffect(()=>{if(!t)return;const i=[t.analyzerPid,t.capturePid].filter(o=>!!o);if(i.length===0)return;let p=!0;const w=async()=>{try{const P=await(await fetch(`/api/process-status?pids=${i.join(",")}`)).json();if(P.processes&&p){const T={};P.processes.forEach(H=>{T[H.pid]={isRunning:H.isRunning,processName:H.processName}}),b(T)}}catch(o){p&&console.error("Failed to fetch process statuses:",o)}};w();const x=setInterval(()=>void w(),5e3);return()=>{p=!1,clearInterval(x)}},[t==null?void 0:t.analyzerPid,t==null?void 0:t.capturePid]);const u=k==null?void 0:k[0];return e.jsxs("div",{className:"flex flex-col gap-[45px]",children:[M?e.jsxs("div",{className:"rounded-[10px] p-[15px]",style:{backgroundColor:"#f6f9fc",border:"2px solid #e0e9ec"},children:[e.jsxs("div",{className:"flex items-center gap-2 mb-[15px]",children:[e.jsx(le,{size:14,strokeWidth:2.5,className:"animate-spin",style:{color:"#005c75"}}),e.jsx("span",{className:"font-medium",style:{fontSize:"14px",lineHeight:"18px",color:"#005c75"},children:c?"Capturing...":"Analyzing..."})]}),u&&e.jsxs("div",{className:"bg-white border border-[#e1e1e1] rounded-[4px] mb-[15px]",style:{height:"60px",padding:"0 15px",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs("div",{className:"inline-grid place-items-start relative",style:{gridTemplateColumns:"max-content",gridTemplateRows:"max-content",lineHeight:0},children:[e.jsx("div",{className:"relative",style:{gridArea:"1 / 1",marginLeft:"10px",marginTop:"8.97px"},children:e.jsx("div",{style:{transform:"scale(1.33)"},children:e.jsx(q,{type:u.entityType||"other"})})}),e.jsxs("div",{className:"flex flex-col gap-[1px] relative",style:{gridArea:"1 / 1",marginLeft:"49px",marginTop:"0"},children:[e.jsxs("div",{className:"flex items-center gap-[14px]",children:[e.jsx(N,{to:`/entity/${u.sha}`,className:"hover:underline cursor-pointer",style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#000"},children:u.name}),u.entityType&&e.jsx(Q,{type:u.entityType})]}),e.jsx("div",{className:"truncate",style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e",width:"422px"},title:u.filePath,children:u.filePath})]})]}),e.jsx("button",{onClick:l,className:"px-[10px] rounded-[4px] transition-colors whitespace-nowrap cursor-pointer",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",lineHeight:"22px",fontWeight:600},children:"View Logs"})]}),c&&C&&C.length>0&&g&&e.jsx("div",{className:"flex gap-[10px] overflow-x-auto mb-[15px]",children:C.map(i=>{var H,I,O,F;if(!i.id)return null;const p=(I=(H=i.metadata)==null?void 0:H.screenshotPaths)==null?void 0:I[0],w=(O=i.metadata)==null?void 0:O.noScreenshotSaved,x=p&&!w,o=(F=m==null?void 0:m.scenarios)==null?void 0:F.find(G=>G.name===i.name),T=o&&o.screenshotStartedAt&&!o.screenshotFinishedAt||!x&&!w;return e.jsx(N,{to:`/entity/${g.sha}/scenarios/${i.id}`,className:"border border-solid rounded-[6px] overflow-hidden flex-shrink-0 cursor-pointer",style:{width:"160px",height:"90px",backgroundColor:T?"#f9f9f9":void 0,borderColor:T?"#efefef":"#ccc"},children:x?e.jsx(B,{screenshotPath:p,alt:i.name,className:"w-full h-full object-contain bg-gray-100"}):T?e.jsx("div",{className:"w-full h-full flex items-center justify-center",children:e.jsx(ie,{size:"medium"})}):e.jsx("div",{className:"w-full h-full bg-gray-100 flex items-center justify-center text-xs text-gray-400",children:"No preview"})},i.id)})}),y&&e.jsx("div",{className:"mb-[15px] font-['IBM_Plex_Mono']",style:{fontSize:"12px",lineHeight:"20px",fontWeight:500,color:"#005c75"},children:y}),e.jsx("div",{className:"mb-[15px]",style:{height:"1px",backgroundColor:"#e0e9ec"}}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{style:{fontSize:"12px",lineHeight:"15px",fontWeight:400,color:"#000"},children:["Running Processes:"," "]}),(t==null?void 0:t.analyzerPid)&&e.jsx(V,{variant:"analyzer",pid:t.analyzerPid}),(t==null?void 0:t.analyzerPid)&&(f||((D=j[t.analyzerPid])==null?void 0:D.isRunning))&&e.jsx(V,{variant:"running"}),(t==null?void 0:t.capturePid)&&e.jsx(V,{variant:"capture",pid:t.capturePid}),(t==null?void 0:t.capturePid)&&(c||((_=j[t.capturePid])==null?void 0:_.isRunning))&&e.jsx(V,{variant:"running"})]}),(((z=j[t==null?void 0:t.analyzerPid])==null?void 0:z.isRunning)||((J=j[t==null?void 0:t.capturePid])==null?void 0:J.isRunning))&&e.jsx("button",{onClick:()=>{const i=[t==null?void 0:t.analyzerPid,t==null?void 0:t.capturePid].filter(x=>{var o;return!!x&&((o=j[x])==null?void 0:o.isRunning)});if(i.length===0)return;const p=i.join(", ");if(!confirm(`Are you sure you want to kill all running processes (${p})?`))return;$({isKilling:!0,current:1,total:i.length}),(async()=>{for(let x=0;x<i.length;x++){const o=i[x];try{await fetch("/api/kill-process",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({pid:o,commitSha:n||""})})}catch(P){console.error(`Failed to kill process ${o}:`,P)}x<i.length-1&&$({isKilling:!0,current:x+2,total:i.length})}$({isKilling:!1,current:0,total:0}),W.revalidate()})()},disabled:L.isKilling,className:"px-[8px] rounded-[4px] transition-colors whitespace-nowrap cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",style:{backgroundColor:"#991b1b",color:"white",fontSize:"12px",lineHeight:"15px",fontWeight:500,height:"27px",width:"114px"},children:L.isKilling?"Killing...":"Kill All Processes"})]})]}):e.jsxs("div",{className:"bg-[#efefef] rounded-xl p-8 text-center",children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("div",{className:"p-[10px] bg-gray-200 rounded",children:e.jsx(Y,{size:24,className:"text-gray-600"})})}),e.jsx("h3",{className:"font-semibold text-gray-700 mb-2",style:{fontSize:"16px",lineHeight:"24px"},children:"No Current Activity"}),e.jsxs("p",{className:"text-gray-500",style:{fontSize:"14px",lineHeight:"18px"},children:["There are no analyses currently running. Trigger an analysis from the"," ",e.jsx(N,{to:"/git",className:"text-[#005C75] underline hover:text-[#004a5e] font-medium cursor-pointer",children:"Git"})," ","or"," ",e.jsx(N,{to:"/files",className:"text-[#005C75] underline hover:text-[#004a5e] font-medium cursor-pointer",children:"Files"})," ","page."]})]}),r&&r.length>0&&e.jsxs("div",{children:[e.jsx("h3",{className:"font-semibold",style:{fontSize:"16px",lineHeight:"24px",color:"#343434",marginBottom:"16px"},children:"Recently Completed Analyses"}),e.jsx("div",{className:"flex flex-col gap-4",children:r.map(i=>{var x;const p=(x=i.analyses)==null?void 0:x[0],w=(p==null?void 0:p.scenarios)||[];return p==null||p.status,e.jsx("div",{className:"rounded-[8px] p-[15px]",style:{backgroundColor:"#f2fcf9",border:"2px solid #aff1a9"},children:e.jsxs("div",{className:"flex flex-col gap-[15px]",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("div",{className:"flex-shrink-0",style:{transform:"scale(1.33)",marginLeft:"10px"},children:e.jsx(q,{type:i.entityType||"other"})}),e.jsxs("div",{className:"flex flex-col flex-shrink-0",style:{marginLeft:"15px",gap:"4px"},children:[e.jsxs("div",{className:"flex items-center gap-[5px]",children:[e.jsx(N,{to:`/entity/${i.sha}`,className:"hover:underline cursor-pointer",title:i.name,style:{fontSize:"14px",lineHeight:"18px",color:"#343434",fontWeight:500},children:i.name}),e.jsx("div",{className:"flex items-center justify-center px-2 rounded",style:{height:"20px",backgroundColor:"#e8ffe6",color:"#00925d",fontSize:"12px",lineHeight:"16px",fontWeight:400},children:i.isUncommitted?"Modified":"Up to date"})]}),e.jsx("div",{style:{fontSize:"13px",lineHeight:"18px",color:"#646464",fontWeight:400,width:"422px"},className:"truncate",title:i.filePath,children:i.filePath})]}),e.jsx("div",{className:"flex-1"}),e.jsx("div",{className:"flex-shrink-0",children:e.jsx("button",{onClick:l,className:"px-[10px] rounded transition-colors whitespace-nowrap",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",lineHeight:"22px",fontWeight:600},onMouseEnter:o=>{o.currentTarget.style.backgroundColor="#d0dfe3"},onMouseLeave:o=>{o.currentTarget.style.backgroundColor="#e0e9ec"},children:"View Logs"})})]}),w.length>0?e.jsx("div",{className:"flex gap-[10px] overflow-x-auto",children:w.map(o=>{var I,O,F;if(!o.id)return null;const P=(O=(I=o.metadata)==null?void 0:I.screenshotPaths)==null?void 0:O[0],T=(F=o.metadata)==null?void 0:F.noScreenshotSaved,H=P&&!T;return e.jsx(N,{to:`/entity/${i.sha}/scenarios/${o.id}`,className:"border border-[#ccc] border-solid rounded-[6px] overflow-hidden flex-shrink-0 cursor-pointer",style:{width:"144px",height:"96px"},children:H?e.jsx(B,{screenshotPath:P,alt:o.name,className:"w-full h-full object-contain bg-gray-100"}):e.jsx("div",{className:"w-full h-full bg-gray-100 flex items-center justify-center text-xs text-gray-400",children:"No preview"})},o.id)})}):e.jsx("div",{className:"italic",style:{fontSize:"12px",color:"#646464"},children:"No scenarios available"})]})},i.sha)})})]})]})}function ye({queueJobs:a,state:t,currentRun:S}){if(!a||a.length===0)return e.jsxs("div",{className:"rounded-xl p-12 text-center",style:{backgroundColor:"#f3f3f3"},children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx("div",{className:"p-[10px] rounded",style:{backgroundColor:"#e5e5e5"},children:e.jsx(pe,{size:24,style:{color:"#646464"}})})}),e.jsx("h3",{className:"font-semibold mb-2",style:{fontSize:"16px",lineHeight:"24px",color:"#343434"},children:"No Queued Jobs"}),e.jsx("p",{style:{fontSize:"14px",lineHeight:"18px",color:"#646464"},children:"Analysis jobs will appear here when they are queued but not yet started."})]});const[h,n]=A.useState(null),[l,r]=A.useState(null),[d,v]=A.useState(null),[g,m]=A.useState(!1),j=U(),b=s=>{n(s)},L=(s,c)=>{s.preventDefault(),r(c)},$=async(s,c)=>{if(s.preventDefault(),!h){r(null);return}const f=a.findIndex(y=>y.id===h);if(f===-1){n(null),r(null);return}if(f===c){n(null),r(null);return}const M=f<c?"down":"up",C=Math.abs(c-f);m(!0);try{for(let y=0;y<C;y++)await fetch("/api/queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"reorder",jobId:h,direction:M})});j.revalidate()}catch(y){console.error("Failed to reorder job:",y)}finally{m(!1),n(null),r(null)}},W=()=>{g||(n(null),r(null))},E=async s=>{if(confirm("Are you sure you want to cancel this job?"))try{await fetch("/api/queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"remove",jobId:s})}),window.location.reload()}catch(c){console.error("Failed to cancel job:",c)}},k=async()=>{if(confirm(`Are you sure you want to cancel all ${a.length} queued jobs?`))try{await fetch("/api/queue",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"clear"})}),window.location.reload()}catch(s){console.error("Failed to cancel jobs:",s)}};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between mb-4",children:[e.jsxs("h3",{className:"font-semibold",style:{fontSize:"16px",lineHeight:"24px",color:"#343434"},children:[a.length," Queued Job",a.length!==1?"s":""]}),a.length>0&&e.jsx("button",{onClick:()=>void k(),className:"px-[10px] py-0 rounded transition-colors cursor-pointer hover:bg-red-300",style:{backgroundColor:"#ffdcd9",color:"#ef4444",fontSize:"12px",fontWeight:500,height:"29px"},children:"Cancel All"})]}),e.jsx("div",{className:"flex flex-col gap-3",children:a.map((s,c)=>{var u,D,_;const f=(u=s.entities)==null?void 0:u[0],M=d===c,C=h===s.id,y=l===c;return e.jsxs("div",{className:"rounded-lg p-4 relative",style:{backgroundColor:"#f6f9fc",border:"2px solid #005C75",opacity:C||g?.5:1,transform:y&&h!==null&&!C?"translateY(-2px)":"translateY(0)",transition:"transform 0.2s ease, opacity 0.2s ease",cursor:g?"not-allowed":C?"grabbing":"grab"},onMouseEnter:()=>v(c),onMouseLeave:()=>v(null),draggable:!g,onDragStart:z=>{b(s.id),z.dataTransfer.effectAllowed="move"},onDragOver:z=>L(z,c),onDrop:z=>void $(z,c),onDragEnd:W,children:[e.jsxs("div",{className:"absolute left-4 top-4 flex items-center gap-1.5 flex-shrink-0",children:[e.jsx(Y,{size:16,style:{color:"#005C75"}}),e.jsxs("span",{style:{fontSize:"14px",fontWeight:500,lineHeight:"18px",color:"#005C75"},children:["Job ",c+1]})]}),e.jsx("div",{className:"bg-white rounded mt-8",style:{border:"1px solid #e1e1e1",height:"60px"},children:e.jsxs("div",{className:"flex items-center justify-between h-full px-[15px]",children:[f?e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{style:{transform:"scale(1.0)"},children:e.jsx(q,{type:f.entityType||"other"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(N,{to:`/entity/${f.sha}`,className:"hover:underline cursor-pointer",style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#000"},children:f.name}),f.entityType&&e.jsx(Q,{type:f.entityType})]}),e.jsx("div",{style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e"},children:f.filePath})]})]}):e.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[e.jsx("div",{style:{transform:"scale(1.0)"},children:e.jsx(ce,{size:18,style:{color:"#8e8e8e"}})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#000"},children:((D=s.entityNames)==null?void 0:D[0])||(s.type==="analysis"?"Analysis Job":s.type==="recapture"?"Recapture Job":s.type==="debug-setup"?"Debug Setup":s.type.charAt(0).toUpperCase()+s.type.slice(1))}),e.jsx("div",{style:{fontSize:"12px",lineHeight:"15px",color:"#8e8e8e"},children:((_=s.filePaths)==null?void 0:_[0])||(s.filePaths&&s.filePaths.length>1?`${s.filePaths.length} files`:s.entityShas&&s.entityShas.length>0?`${s.entityShas.length} ${s.entityShas.length===1?"entity":"entities"}`:"Queued for processing")})]})]}),M&&e.jsx("div",{className:"mr-2 cursor-grab active:cursor-grabbing",style:{color:"#8e8e8e"},title:"Drag to reorder",children:e.jsx(xe,{size:20})}),e.jsx("button",{onClick:()=>void E(s.id),className:"transition-colors cursor-pointer hover:bg-red-100 rounded flex items-center justify-center",style:{fontSize:"10px",fontWeight:600,lineHeight:"22px",color:"#ef4444",backgroundColor:"#fef6f6",padding:"0 10px",height:"22px"},children:"Cancel"})]})})]},s.id)})})]})}function ue({historicalRuns:a,totalHistoricalRuns:t,currentPage:S,totalPages:h,tab:n,onShowLogs:l}){if(t===0)return e.jsxs("div",{className:"rounded-xl p-12 text-center",style:{backgroundColor:"#EFEFEF"},children:[e.jsx("div",{className:"flex justify-center mb-4",children:e.jsx(ae,{size:24,style:{color:"#646464"}})}),e.jsx("h3",{className:"font-semibold mb-2",style:{fontSize:"16px",lineHeight:"24px",color:"#343434"},children:"No Historic Activity"}),e.jsx("p",{style:{fontSize:"14px",lineHeight:"18px",color:"#646464"},children:"Completed analyses will appear here for historical reference."})]});const r=[];return a.forEach(d=>{d.entities&&d.entities.length>0&&d.entities.forEach(v=>{r.push({...v,runCreatedAt:d.createdAt})})}),e.jsx("div",{className:"flex flex-col gap-4",children:r.slice(0,20).map(d=>{var j;const v=(j=d.analyses)==null?void 0:j[0],g=(v==null?void 0:v.scenarios)||[],m=!d.isUncommitted;return e.jsxs("div",{className:"rounded-lg p-4",style:{backgroundColor:m?"#f2fcf9":"#fef9e7",border:"2px solid",borderColor:m?"#aff1a9":"#f9d689"},children:[e.jsxs("div",{className:"flex items-start justify-between mb-3",children:[e.jsxs("div",{className:"flex items-start gap-3 flex-1",children:[e.jsx("div",{style:{transform:"scale(1.0)",marginTop:"2px"},children:e.jsx(q,{type:d.entityType||"other"})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsx(N,{to:`/entity/${d.sha}`,className:"hover:underline cursor-pointer",style:{fontSize:"14px",lineHeight:"18px",fontWeight:500,color:"#343434"},children:d.name}),e.jsx("div",{className:"px-2 py-0.5 rounded",style:{backgroundColor:m?"#e8ffe6":"#fef3cd",color:m?"#00925d":"#a16207",fontSize:"12px",fontWeight:400},children:m?"Up to date":"Out of date"})]}),e.jsx("div",{style:{fontSize:"12px",lineHeight:"15px",color:"#646464"},children:d.filePath})]})]}),e.jsx("button",{onClick:l,className:"px-3 py-1 rounded transition-colors whitespace-nowrap cursor-pointer",style:{backgroundColor:"#e0e9ec",color:"#005c75",fontSize:"10px",fontWeight:600},children:"View Logs"})]}),g.length>0&&e.jsxs("div",{className:"flex gap-2 overflow-x-auto",children:[g.slice(0,8).map(b=>{var E,k,s;if(!b.id)return null;const L=(k=(E=b.metadata)==null?void 0:E.screenshotPaths)==null?void 0:k[0],$=(s=b.metadata)==null?void 0:s.noScreenshotSaved,W=L&&!$;return e.jsx(N,{to:`/entity/${d.sha}/scenarios/${b.id}`,className:"border border-gray-300 rounded overflow-hidden flex-shrink-0 cursor-pointer",style:{width:"120px",height:"80px"},children:W?e.jsx(B,{screenshotPath:L,alt:b.name,className:"w-full h-full object-cover bg-gray-100"}):e.jsx("div",{className:"w-full h-full bg-gray-100 flex items-center justify-center text-xs text-gray-400",children:"No preview"})},b.id)}),g.length>8&&e.jsxs("div",{className:"flex items-center justify-center flex-shrink-0",style:{width:"120px",height:"80px",fontSize:"12px",color:"#646464"},children:["+",g.length-8," more"]})]})]},`${d.sha}-${d.runCreatedAt}`)})})}const Te=X(function(){const t=Z(),S=R(),[h,n]=A.useState(!1);se({source:"activity-page"});const l=S.tab||"current";return t?e.jsxs("div",{className:"px-20 py-12",children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h1",{className:"text-3xl font-semibold text-gray-900 mb-2",children:"Activity"}),e.jsx("p",{className:"text-gray-600",children:"View queued, current, and historical analysis activity."})]}),e.jsx(ge,{activeTab:l,hasCurrentActivity:t.hasCurrentActivity,queuedCount:t.queuedCount,historicCount:t.totalHistoricalRuns}),l==="current"&&e.jsx(me,{currentlyExecuting:t.currentlyExecuting,currentRun:t.currentRun,state:t.state,projectSlug:t.projectSlug,commitSha:t.commitSha,onShowLogs:()=>n(!0),recentCompletedEntities:t.recentCompletedEntities||[],hasMoreCompletedRuns:t.hasMoreCompletedRuns||!1,currentEntityScenarios:t.currentEntityScenarios||[],currentEntityForScenarios:t.currentEntityForScenarios,currentAnalysisStatus:t.currentAnalysisStatus}),l==="queued"&&e.jsx(ye,{queueJobs:t.queueJobs,state:t.state,currentRun:t.currentRun}),l==="historic"&&e.jsx(ue,{historicalRuns:t.historicalRuns,totalHistoricalRuns:t.totalHistoricalRuns,currentPage:t.currentPage,totalPages:t.totalPages,tab:l,onShowLogs:()=>n(!0)}),h&&t.projectSlug&&e.jsx(ee,{projectSlug:t.projectSlug,onClose:()=>n(!1)})]}):e.jsx("div",{className:"px-20 py-12",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{className:"text-gray-600",children:"Loading..."})})})});export{Te as default};
@@ -0,0 +1,6 @@
1
+ import{c as o}from"./createLucideIcon-CgUsG7ib.js";/**
2
+ * @license lucide-react v0.556.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 n=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],e=o("chevron-down",n);export{e as C};