@codeyam/codeyam-cli 0.1.7 → 0.1.8

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 (382) 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 +6 -6
  4. package/analyzer-template/packages/ai/package.json +1 -1
  5. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
  6. package/analyzer-template/packages/ai/src/lib/completionCall.ts +14 -2
  7. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +27 -0
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  9. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +78 -2
  10. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +6 -0
  11. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +9 -1
  12. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
  13. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  14. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +65 -28
  15. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +83 -0
  16. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +23 -4
  17. package/analyzer-template/packages/aws/package.json +1 -1
  18. package/analyzer-template/packages/database/index.ts +1 -0
  19. package/analyzer-template/packages/database/package.json +3 -3
  20. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -0
  21. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +62 -0
  22. package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
  23. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
  24. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +151 -135
  25. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  26. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  27. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  28. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  29. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  30. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  31. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  32. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  33. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
  34. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  35. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +5 -0
  36. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  37. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +20 -0
  38. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  39. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +45 -0
  40. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  41. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
  42. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  43. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  44. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +23 -13
  45. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  46. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  47. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  48. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  49. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  50. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +100 -89
  51. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  52. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  53. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  54. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  55. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  56. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  57. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  58. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  59. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  60. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  61. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  62. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  63. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  64. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  65. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  66. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
  67. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  68. package/analyzer-template/packages/github/package.json +1 -1
  69. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  70. package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
  71. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  72. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  73. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
  74. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  75. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  76. package/analyzer-template/project/constructMockCode.ts +136 -43
  77. package/analyzer-template/project/reconcileMockDataKeys.ts +19 -14
  78. package/analyzer-template/project/start.ts +3 -0
  79. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  80. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  81. package/analyzer-template/project/writeMockDataTsx.ts +17 -0
  82. package/analyzer-template/project/writeScenarioComponents.ts +36 -7
  83. package/analyzer-template/tsconfig.json +13 -1
  84. package/background/src/lib/virtualized/project/constructMockCode.js +115 -34
  85. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  86. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +17 -11
  87. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  88. package/background/src/lib/virtualized/project/start.js +2 -0
  89. package/background/src/lib/virtualized/project/start.js.map +1 -1
  90. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  91. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  92. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  93. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  94. package/background/src/lib/virtualized/project/writeMockDataTsx.js +12 -0
  95. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  96. package/background/src/lib/virtualized/project/writeScenarioComponents.js +29 -7
  97. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  98. package/codeyam-cli/scripts/apply-setup.js +208 -11
  99. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  100. package/codeyam-cli/src/cli.js +2 -0
  101. package/codeyam-cli/src/cli.js.map +1 -1
  102. package/codeyam-cli/src/commands/analyze.js +17 -7
  103. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  104. package/codeyam-cli/src/commands/default.js +58 -3
  105. package/codeyam-cli/src/commands/default.js.map +1 -1
  106. package/codeyam-cli/src/commands/editor.js +1839 -0
  107. package/codeyam-cli/src/commands/editor.js.map +1 -0
  108. package/codeyam-cli/src/commands/init.js +40 -11
  109. package/codeyam-cli/src/commands/init.js.map +1 -1
  110. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +246 -0
  111. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  112. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +126 -0
  113. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  114. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +295 -0
  115. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  116. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  117. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  118. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +100 -0
  119. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  120. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +147 -0
  121. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  122. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +76 -0
  123. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  124. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  125. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  126. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  127. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  128. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  129. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  130. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  131. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  132. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +26 -0
  133. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  134. package/codeyam-cli/src/utils/backgroundServer.js +19 -3
  135. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  136. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  137. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  138. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  139. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  140. package/codeyam-cli/src/utils/editorAudit.js +82 -0
  141. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  142. package/codeyam-cli/src/utils/editorDevServer.js +98 -0
  143. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  144. package/codeyam-cli/src/utils/editorJournal.js +137 -0
  145. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  146. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  147. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  148. package/codeyam-cli/src/utils/editorPreloadHelpers.js +64 -0
  149. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  150. package/codeyam-cli/src/utils/editorPreview.js +66 -0
  151. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  152. package/codeyam-cli/src/utils/editorScenarios.js +56 -0
  153. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  154. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  155. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  156. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  157. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  158. package/codeyam-cli/src/utils/git.js +103 -0
  159. package/codeyam-cli/src/utils/git.js.map +1 -1
  160. package/codeyam-cli/src/utils/install-skills.js +55 -13
  161. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  162. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  163. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  164. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  165. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  166. package/codeyam-cli/src/utils/project.js +15 -5
  167. package/codeyam-cli/src/utils/project.js.map +1 -1
  168. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  169. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  170. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  171. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  172. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  173. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  174. package/codeyam-cli/src/utils/queue/job.js +70 -1
  175. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  176. package/codeyam-cli/src/utils/queue/manager.js +7 -6
  177. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  178. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  179. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  180. package/codeyam-cli/src/utils/serverState.js +27 -2
  181. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  182. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +45 -4
  183. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  184. package/codeyam-cli/src/utils/testRunner.js +158 -0
  185. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  186. package/codeyam-cli/src/utils/webappDetection.js +14 -2
  187. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  188. package/codeyam-cli/src/webserver/app/lib/database.js +41 -27
  189. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  190. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  191. package/codeyam-cli/src/webserver/backgroundServer.js +108 -18
  192. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  193. package/codeyam-cli/src/webserver/build/client/assets/{CopyButton-CtmbP4Gl.js → CopyButton-DmJveP3T.js} +1 -1
  194. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-DlMph_Hm.js → EntityItem-C76mRRiF.js} +1 -1
  195. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-B-0PjGOU.js → EntityTypeBadge-g3saevPb.js} +1 -1
  196. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-DN9eiJAO.js → EntityTypeIcon-CobE682z.js} +1 -1
  197. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  198. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-rE_fI2h2.js → InteractivePreview-DYFW3lDD.js} +3 -3
  199. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-CnatsCw2.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
  200. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-CSP6DZrh.js → LoadingDots-BU_OAEMP.js} +1 -1
  201. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-CMK8Q7yk.js → LogViewer-ceAyBX-H.js} +1 -1
  202. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-TCV_HBjy.js → ReportIssueModal-djPLI-WV.js} +1 -1
  203. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-CG2uh31y.js → SafeScreenshot-BED4B6sP.js} +1 -1
  204. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-CU_TDYd8.js → ScenarioViewer-B76aig_2.js} +1 -1
  205. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  206. package/codeyam-cli/src/webserver/build/client/assets/Terminal-Dnj5CY9R.js +41 -0
  207. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-D7IoaWUW.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  208. package/codeyam-cli/src/webserver/build/client/assets/{_index-B8z7mjR-.js → _index-C96V0n15.js} +1 -1
  209. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-DZu78RI1.js → activity.(_tab)-BpKzcsJz.js} +1 -1
  210. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-CUXOrorO.js +1 -0
  211. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  212. package/codeyam-cli/src/webserver/build/client/assets/{agent-transcripts-Dm5RS9il.js → agent-transcripts-D9hemwl6.js} +1 -1
  213. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  214. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  215. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  216. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  217. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  218. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  219. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  220. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  221. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  222. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  223. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  224. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  225. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  226. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  227. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  228. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  229. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  230. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  231. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  232. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  233. package/codeyam-cli/src/webserver/build/client/assets/{book-open-Bp5FLkd4.js → book-open-D_nMCFmP.js} +1 -1
  234. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-DQJA9f4o.js → chevron-down-BH2h1Ea2.js} +1 -1
  235. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-7VptmeIr.js → chunk-JZWAC4HX-C4pqxYJB.js} +1 -1
  236. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-B6C4LY9o.js → circle-check-DyIKORY6.js} +1 -1
  237. package/codeyam-cli/src/webserver/build/client/assets/{copy-6nzYCu0G.js → copy-NDbZjXao.js} +1 -1
  238. package/codeyam-cli/src/webserver/build/client/assets/{createLucideIcon-D-QUFOwe.js → createLucideIcon-CMT1jU2q.js} +1 -1
  239. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-BiM6z3Do.js +1 -0
  240. package/codeyam-cli/src/webserver/build/client/assets/editor-D1DAKXtT.js +8 -0
  241. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha._-C6PQhwY5.js → entity._sha._-CrjR3zZW.js} +8 -8
  242. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-DkzqFzFj.js +6 -0
  243. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-C28BiQzt.js +6 -0
  244. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  245. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-C7ysA4Jq.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
  246. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-CU6EUArK.js → entry.client-DTvKq3TY.js} +1 -1
  247. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-EWpfFU4X.js → fileTableUtils-cPo8LiG3.js} +1 -1
  248. package/codeyam-cli/src/webserver/build/client/assets/{files-CrxAoWIL.js → files-DO4CZ16O.js} +1 -1
  249. package/codeyam-cli/src/webserver/build/client/assets/{git-BldHtKeW.js → git-CFCTYk9I.js} +1 -1
  250. package/codeyam-cli/src/webserver/build/client/assets/globals-B17TBSS6.css +1 -0
  251. package/codeyam-cli/src/webserver/build/client/assets/{index-7-1FmlHo.js → index-10oVnAAH.js} +1 -1
  252. package/codeyam-cli/src/webserver/build/client/assets/{index-DuYcwYp_.js → index-BcvgDzbZ.js} +1 -1
  253. package/codeyam-cli/src/webserver/build/client/assets/{labs-CPPVOSWB.js → labs-Zk7ryIM1.js} +1 -1
  254. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-BnDcD54R.js → loader-circle-BAXYRVEO.js} +1 -1
  255. package/codeyam-cli/src/webserver/build/client/assets/manifest-a632de18.js +1 -0
  256. package/codeyam-cli/src/webserver/build/client/assets/{memory-0wMU4KXe.js → memory-Dg0mvYrI.js} +5 -2
  257. package/codeyam-cli/src/webserver/build/client/assets/{pause-DhQX2g22.js → pause-DTAcYxBt.js} +1 -1
  258. package/codeyam-cli/src/webserver/build/client/assets/root-DUKqhFlb.js +67 -0
  259. package/codeyam-cli/src/webserver/build/client/assets/{search-DborVoKD.js → search-fKo7v0Zo.js} +1 -1
  260. package/codeyam-cli/src/webserver/build/client/assets/{settings-BWunYSXt.js → settings-DfuTtcJP.js} +1 -1
  261. package/codeyam-cli/src/webserver/build/client/assets/{simulations-BtrtCYJg.js → simulations-B3aOzpCZ.js} +1 -1
  262. package/codeyam-cli/src/webserver/build/client/assets/{terminal-Bs4NC-VZ.js → terminal-BG4heKCG.js} +1 -1
  263. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-DTf3Jojp.js → triangle-alert-DtSmdtM4.js} +1 -1
  264. package/codeyam-cli/src/webserver/build/client/assets/{useCustomSizes-D_bDZyDU.js → useCustomSizes-ByhSyh0W.js} +1 -1
  265. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  266. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-BsQb6rFd.js → useReportContext-O-jkvSPx.js} +1 -1
  267. package/codeyam-cli/src/webserver/build/client/assets/{useToast-BOur3mUv.js → useToast-9FIWuYfK.js} +1 -1
  268. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  269. package/codeyam-cli/src/webserver/build/server/assets/index-HfLydfDq.js +1 -0
  270. package/codeyam-cli/src/webserver/build/server/assets/server-build-CUu_F-oo.js +366 -0
  271. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  272. package/codeyam-cli/src/webserver/build-info.json +5 -5
  273. package/codeyam-cli/src/webserver/devServer.js +39 -5
  274. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  275. package/codeyam-cli/src/webserver/editorProxy.js +440 -0
  276. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  277. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +175 -0
  278. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +140 -0
  279. package/codeyam-cli/src/webserver/server.js +226 -1
  280. package/codeyam-cli/src/webserver/server.js.map +1 -1
  281. package/codeyam-cli/src/webserver/terminalServer.js +698 -0
  282. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  283. package/codeyam-cli/templates/codeyam-editor-claude.md +68 -0
  284. package/codeyam-cli/templates/editor-step-hook.py +147 -0
  285. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  286. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  287. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  288. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  289. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  290. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  291. package/codeyam-cli/templates/nextjs-prisma-sqlite/PRISMA_SETUP.md +84 -0
  292. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  293. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  294. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  295. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +19 -0
  296. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  297. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  298. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +43 -0
  299. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  300. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +35 -0
  301. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  302. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  303. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +37 -0
  304. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  305. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  306. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  307. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +69 -0
  308. package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
  309. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  310. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.sh +108 -0
  311. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.sh +69 -0
  312. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  313. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  314. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.sh +12 -0
  315. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter.jq +45 -0
  316. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.sh +139 -0
  317. package/package.json +4 -2
  318. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +22 -4
  319. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  320. package/packages/ai/src/lib/completionCall.js +10 -2
  321. package/packages/ai/src/lib/completionCall.js.map +1 -1
  322. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +21 -0
  323. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  324. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  325. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  326. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  327. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  328. package/packages/ai/src/lib/generateEntityScenarioData.js +57 -2
  329. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  330. package/packages/analyze/src/lib/ProjectAnalyzer.js +3 -0
  331. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  332. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +8 -1
  333. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  334. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +0 -5
  335. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  336. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  337. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  338. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +54 -27
  339. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -1
  340. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +65 -0
  341. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  342. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +18 -4
  343. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  344. package/packages/database/index.js +1 -0
  345. package/packages/database/index.js.map +1 -1
  346. package/packages/database/src/lib/kysely/db.js +5 -0
  347. package/packages/database/src/lib/kysely/db.js.map +1 -1
  348. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +45 -0
  349. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  350. package/packages/database/src/lib/loadCommits.js +23 -13
  351. package/packages/database/src/lib/loadCommits.js.map +1 -1
  352. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  353. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  354. package/packages/database/src/lib/updateCommitMetadata.js +100 -89
  355. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  356. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  357. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  358. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  359. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  360. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  361. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  362. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  363. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  364. package/scripts/npm-post-install.cjs +34 -0
  365. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-C1rIyZdV.js +0 -34
  366. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-DmzSmblj.js +0 -1
  367. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-DVTcUnur.js +0 -6
  368. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-BVgNO76F.js +0 -6
  369. package/codeyam-cli/src/webserver/build/client/assets/globals-CLmFdUae.css +0 -1
  370. package/codeyam-cli/src/webserver/build/client/assets/manifest-717e346a.js +0 -1
  371. package/codeyam-cli/src/webserver/build/client/assets/root-DqfSDjyQ.js +0 -62
  372. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-DZp6rrQD.js +0 -2
  373. package/codeyam-cli/src/webserver/build/server/assets/index-B8jmgmn2.js +0 -1
  374. package/codeyam-cli/src/webserver/build/server/assets/server-build-9OU4lmvL.js +0 -285
  375. package/scripts/finalize-analyzer.cjs +0 -13
  376. /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
  377. /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
  378. /package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -0
  379. /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
  380. /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
  381. /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
  382. /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
@@ -1,4 +1,4 @@
1
- import{r as i,j as e,c as ge,L as ie}from"./chunk-JZWAC4HX-7VptmeIr.js";import{I as be}from"./InteractivePreview-rE_fI2h2.js";import{u as je,V as we,S as Ne}from"./useCustomSizes-D_bDZyDU.js";import{L as J}from"./LogViewer-CMK8Q7yk.js";import{S as ve}from"./SafeScreenshot-CG2uh31y.js";import{u as ke}from"./useLastLogLine-DZp6rrQD.js";import{u as Ce}from"./InlineSpinner-C1rIyZdV.js";import{_ as ye}from"./preload-helper-ckwbz45p.js";import{R as Ie}from"./ReportIssueModal-TCV_HBjy.js";import{C as Ee,a as Le}from"./copy-6nzYCu0G.js";import{g as Pe}from"./scenarioStatus-B_8jpV3e.js";function $e({presets:s,customSizes:t,currentWidth:n,currentHeight:o,scale:v,onSizeChange:N,onSaveCustomSize:w,onRemoveCustomSize:d,className:k=""}){const[h,x]=i.useState(!1),[g,b]=i.useState(String(n)),[m,j]=i.useState(String(o)),[C,u]=i.useState(!1),[l,R]=i.useState(!1),P=i.useRef(null);i.useEffect(()=>{C||b(String(n))},[n,C]),i.useEffect(()=>{l||j(String(o))},[o,l]),i.useEffect(()=>{const r=f=>{P.current&&!P.current.contains(f.target)&&x(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]);const $=i.useMemo(()=>{const r=s.find(c=>c.width===n&&c.height===o);if(r)return r.name;const f=t.find(c=>c.width===n&&c.height===o);return f?f.name:"Custom"},[s,t,n,o]),O=$==="Custom",S=r=>{N(r.width,r.height),x(!1)},W=r=>{const f=r.target.value;b(f);const c=parseInt(f,10);!isNaN(c)&&c>0&&N(c,o)},U=r=>{const f=r.target.value;j(f);const c=parseInt(f,10);!isNaN(c)&&c>0&&N(n,c)},A=()=>{u(!1);const r=parseInt(g,10);(isNaN(r)||r<=0)&&b(String(n))},K=()=>{R(!1);const r=parseInt(m,10);(isNaN(r)||r<=0)&&j(String(o))},D=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:P,children:[e.jsxs("button",{onClick:()=>x(!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:$}),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:()=>S(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 ${$===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,f)=>r.width-f.width).map(r=>e.jsxs("div",{className:`flex items-center gap-1 hover:bg-gray-100 ${$===r.name?"bg-[#f0f7f9] text-[#005c75]":"text-gray-700"}`,children:[e.jsxs("button",{onClick:()=>S(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]})]}),d&&e.jsx("button",{onClick:f=>{f.stopPropagation(),$===r.name&&s.length>0&&N(s[0].width,s[0].height),d(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:g,onChange:W,onFocus:()=>u(!0),onBlur:A,onKeyDown:D,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:m,onChange:U,onFocus:()=>R(!0),onBlur:K,onKeyDown:D,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),"%)"]})]}),O&&e.jsx("button",{onClick:w,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 de({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 _e({scenario:s,analysis:t,entity:n}){var w,d,k;const o=((w=s.metadata)==null?void 0:w.executionResult)||null,v=((k=(d=s.metadata)==null?void 0:d.data)==null?void 0:k.argumentsData)||[],N=h=>{var j,C,u;if(!h)return"No execution results available yet. Run the function to capture side effects including console output, file operations, and API calls.";const x=[],g=((j=h.sideEffects)==null?void 0:j.consoleOutput)||[];g.length>0&&(x.push(`Console Output: ${g.length} log ${g.length===1?"entry":"entries"} captured`),g.forEach(l=>{x.push(` [${l.level.toUpperCase()}] ${l.args.join(" ")}`)}));const b=((C=h.sideEffects)==null?void 0:C.fileWrites)||[];b.length>0&&(x.push(`
1
+ import{r as i,j as e,d as ge,L as ie}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{I as be}from"./InteractivePreview-DYFW3lDD.js";import{u as je,V as we,S as Ne}from"./useCustomSizes-ByhSyh0W.js";import{L as J}from"./LogViewer-ceAyBX-H.js";import{S as ve}from"./SafeScreenshot-BED4B6sP.js";import{u as ke}from"./useLastLogLine-C14nCb1q.js";import{u as Ce}from"./Spinner-Bb5uFQ5V.js";import{_ as ye}from"./preload-helper-ckwbz45p.js";import{R as Ie}from"./ReportIssueModal-djPLI-WV.js";import{C as Ee,a as Le}from"./copy-NDbZjXao.js";import{g as Pe}from"./scenarioStatus-B_8jpV3e.js";function $e({presets:s,customSizes:t,currentWidth:n,currentHeight:o,scale:v,onSizeChange:N,onSaveCustomSize:w,onRemoveCustomSize:d,className:k=""}){const[h,x]=i.useState(!1),[g,b]=i.useState(String(n)),[m,j]=i.useState(String(o)),[C,u]=i.useState(!1),[l,R]=i.useState(!1),P=i.useRef(null);i.useEffect(()=>{C||b(String(n))},[n,C]),i.useEffect(()=>{l||j(String(o))},[o,l]),i.useEffect(()=>{const r=f=>{P.current&&!P.current.contains(f.target)&&x(!1)};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[]);const $=i.useMemo(()=>{const r=s.find(c=>c.width===n&&c.height===o);if(r)return r.name;const f=t.find(c=>c.width===n&&c.height===o);return f?f.name:"Custom"},[s,t,n,o]),O=$==="Custom",S=r=>{N(r.width,r.height),x(!1)},W=r=>{const f=r.target.value;b(f);const c=parseInt(f,10);!isNaN(c)&&c>0&&N(c,o)},U=r=>{const f=r.target.value;j(f);const c=parseInt(f,10);!isNaN(c)&&c>0&&N(n,c)},A=()=>{u(!1);const r=parseInt(g,10);(isNaN(r)||r<=0)&&b(String(n))},K=()=>{R(!1);const r=parseInt(m,10);(isNaN(r)||r<=0)&&j(String(o))},D=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:P,children:[e.jsxs("button",{onClick:()=>x(!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:$}),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:()=>S(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 ${$===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,f)=>r.width-f.width).map(r=>e.jsxs("div",{className:`flex items-center gap-1 hover:bg-gray-100 ${$===r.name?"bg-[#f0f7f9] text-[#005c75]":"text-gray-700"}`,children:[e.jsxs("button",{onClick:()=>S(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]})]}),d&&e.jsx("button",{onClick:f=>{f.stopPropagation(),$===r.name&&s.length>0&&N(s[0].width,s[0].height),d(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:g,onChange:W,onFocus:()=>u(!0),onBlur:A,onKeyDown:D,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:m,onChange:U,onFocus:()=>R(!0),onBlur:K,onKeyDown:D,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),"%)"]})]}),O&&e.jsx("button",{onClick:w,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 de({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 _e({scenario:s,analysis:t,entity:n}){var w,d,k;const o=((w=s.metadata)==null?void 0:w.executionResult)||null,v=((k=(d=s.metadata)==null?void 0:d.data)==null?void 0:k.argumentsData)||[],N=h=>{var j,C,u;if(!h)return"No execution results available yet. Run the function to capture side effects including console output, file operations, and API calls.";const x=[],g=((j=h.sideEffects)==null?void 0:j.consoleOutput)||[];g.length>0&&(x.push(`Console Output: ${g.length} log ${g.length===1?"entry":"entries"} captured`),g.forEach(l=>{x.push(` [${l.level.toUpperCase()}] ${l.args.join(" ")}`)}));const b=((C=h.sideEffects)==null?void 0:C.fileWrites)||[];b.length>0&&(x.push(`
2
2
  File System Operations: ${b.length} ${b.length===1?"operation":"operations"} detected`),b.forEach(l=>{x.push(` ${l.operation}: ${l.path}${l.size?` (${l.size} bytes)`:""}`)}));const m=((u=h.sideEffects)==null?void 0:u.apiCalls)||[];return m.length>0&&(x.push(`
3
3
  API Calls: ${m.length} ${m.length===1?"call":"calls"} made`),m.forEach(l=>{x.push(` ${l.method} ${l.url}${l.status?` → ${l.status}`:""}${l.duration?` (${l.duration}ms)`:""}`)})),h.error&&x.push(`
4
4
  Error: ${h.error.name||"Error"}: ${h.error.message}`),x.length===0?"No side effects detected. The function executed without console output, file operations, or API calls.":x.join(`
@@ -0,0 +1,34 @@
1
+ import{d as P,r as t,j as y}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as _}from"./useLastLogLine-C14nCb1q.js";function R(s){const o=s.replace(/[^a-zA-Z0-9_]+/g,"_");return o.slice(0,1).toUpperCase()+o.slice(1)}function $({analysisId:s,scenarioId:o,scenarioName:i,entityName:c,projectSlug:m,enabled:x=!0,refreshTrigger:p=0}){const k=P(),[b,E]=t.useState(null),[q,U]=t.useState(!1),[z,u]=t.useState(!1),[A,f]=t.useState(!1),v=t.useRef(!1),I=t.useRef(null),g=t.useRef(null),h=t.useRef(null),[F,w]=t.useState(0),[j,M]=t.useState(0),r=t.useRef(null),l=t.useRef(!1),{interactiveUrl:L,resetLogs:T}=_(m,x),C=t.useRef(o),B=t.useRef(p);t.useEffect(()=>{B.current!==p&&(B.current=p,b&&(console.log("[useInteractiveMode] Manual refresh triggered"),u(!0),f(!1),w(0),M(e=>e+1),l.current=!1,r.current&&(clearTimeout(r.current),r.current=null)))},[p,b]),t.useEffect(()=>{if(C.current!==o&&(C.current=o,I.current&&g.current&&i)){let e=I.current;if(h.current&&c){const a=R(h.current),d=R(c);a!==d&&(e=e.replace(a,d),h.current=c)}const n=R(g.current),S=R(i);e=e.replace(n,S),g.current=i,E(e),u(!0),f(!1),w(0),M(a=>a+1),l.current=!1,r.current&&(clearTimeout(r.current),r.current=null);return}},[o,i,c]),t.useEffect(()=>{if(L){const e=L+"?width=600px";I.current=e,i&&(g.current=i),c&&(h.current=c),E(e),U(!1),u(!0)}},[L]),t.useEffect(()=>{const e=n=>{n.data.type==="codeyam-resize"&&(l.current||(l.current=!0,r.current&&(clearTimeout(r.current),r.current=null),w(0),f(!0),requestAnimationFrame(()=>{requestAnimationFrame(()=>{u(!1)})})))};return window.addEventListener("message",e),()=>window.removeEventListener("message",e)},[]);const D=()=>{l.current=!1,r.current&&clearTimeout(r.current);const e=300*Math.pow(2,F);r.current=setTimeout(()=>{l.current||(F<2?(w(n=>n+1),M(n=>n+1),u(!0)):(console.error("[useInteractiveMode] Interactive mode failed to load after 3 attempts - showing iframe anyway"),f(!0),u(!1)))},e)};return t.useEffect(()=>{x&&!v.current&&o&&s&&(v.current=!0,U(!0),f(!1),E(null),(async()=>{if(m)try{await fetch(`/api/logs/${m}`,{method:"DELETE"})}catch(n){console.error("[useInteractiveMode] Failed to clear log file:",n)}T(),k.submit({action:"start",analysisId:s,scenarioId:o},{method:"post",action:"/api/interactive-mode"})})())},[x,o,s,T,m]),t.useEffect(()=>{const e=s,n=()=>{if(v.current&&e){const a=new URLSearchParams({action:"stop",analysisId:e});console.log("[useInteractiveMode] Sending stop request via sendBeacon");const d=navigator.sendBeacon("/api/interactive-mode",a);console.log("[useInteractiveMode] sendBeacon result:",d),d||(console.log("[useInteractiveMode] sendBeacon failed, using fetch fallback"),fetch("/api/interactive-mode",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:a,keepalive:!0}).catch(K=>console.error("Failed to stop interactive mode:",K)))}},S=()=>{n()};return window.addEventListener("beforeunload",S),()=>{window.removeEventListener("beforeunload",S),console.log("[useInteractiveMode] Cleanup running:",{hasStarted:v.current,analysisId:e}),n()}},[s]),{interactiveServerUrl:b,isStarting:q,isLoading:z,showIframe:A,iframeKey:j,onIframeLoad:D}}function G(){return y.jsxs("div",{className:"spinner-container",children:[y.jsx("span",{className:"loader"}),y.jsx("style",{children:`
2
+ .loader {
3
+ width: 48px;
4
+ height: 48px;
5
+ border: 3px solid rgba(0, 92, 117, 0.2);
6
+ border-radius: 50%;
7
+ display: inline-block;
8
+ position: relative;
9
+ box-sizing: border-box;
10
+ animation: rotation 1s linear infinite;
11
+ }
12
+ .loader::after {
13
+ content: '';
14
+ box-sizing: border-box;
15
+ position: absolute;
16
+ left: 50%;
17
+ top: 50%;
18
+ transform: translate(-50%, -50%);
19
+ width: 56px;
20
+ height: 56px;
21
+ border-radius: 50%;
22
+ border: 3px solid;
23
+ border-color: #005c75 transparent;
24
+ }
25
+
26
+ @keyframes rotation {
27
+ 0% {
28
+ transform: rotate(0deg);
29
+ }
30
+ 100% {
31
+ transform: rotate(360deg);
32
+ }
33
+ }
34
+ `})]})}export{G as S,$ as u};
@@ -0,0 +1,41 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/addon-fit-CUXOrorO.js","assets/chunk-JZWAC4HX-C4pqxYJB.js","assets/addon-web-links-Duc5hnl7.js"])))=>i.map(i=>d[i]);
2
+ import{r as n,j as r}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{_ as P}from"./preload-helper-ckwbz45p.js";function te({serverUrl:f,isStarting:z,projectSlug:g,devServerError:E,onStartServer:y}){const[b,v]=n.useState(null),m=n.useRef(null);n.useEffect(()=>{if(!g)return;const h=new EventSource("/api/dev-mode-events");return h.onmessage=A=>{try{const T=JSON.parse(A.data);T.type==="file-synced"&&(v(T.fileName),m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{v(null)},5e3))}catch{}},()=>{h.close(),m.current&&clearTimeout(m.current)}},[g]);let a;E?a="error":z?a="starting":f?a="running":a="stopped";const N={starting:"bg-yellow-400",running:"bg-green-400",stopped:"bg-gray-400",error:"bg-red-400"},S={starting:"Starting...",running:f||"Running",stopped:"Stopped",error:"Error"};return r.jsxs("div",{className:"bg-[#1e1e1e] border-t border-[#3d3d3d] h-7 flex items-center px-4 gap-4 shrink-0 text-xs font-mono",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:`w-2 h-2 rounded-full ${N[a]}`}),r.jsxs("span",{className:"text-gray-400",children:["Server:"," ",r.jsx("span",{className:"text-gray-300",children:S[a]})]}),(a==="stopped"||a==="error")&&y&&r.jsx("button",{onClick:y,className:"ml-1 px-2.5 py-0.5 bg-[#005c75] hover:bg-[#007a9a] text-white text-[11px] font-medium rounded transition-colors cursor-pointer border-none leading-tight",children:"Start Server"})]}),r.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"}),b&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4ade80",strokeWidth:"2",children:r.jsx("path",{d:"M20 6L9 17l-5-5"})}),r.jsxs("span",{className:"text-green-400",children:["Synced: ",b]})]}),r.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"})]}),r.jsx("div",{className:"flex-1"}),r.jsx("span",{className:"text-gray-500",children:"Claude edits auto-sync to preview via HMR"})]})}const Q=`
3
+ .xterm { cursor: text; position: relative; user-select: none; -ms-user-select: none; -webkit-user-select: none; }
4
+ .xterm.focus, .xterm:focus { outline: none; }
5
+ .xterm .xterm-helpers { position: absolute; top: 0; z-index: 5; }
6
+ .xterm .xterm-helper-textarea { padding: 0; border: 0; margin: 0; position: absolute; opacity: 0; left: -9999em; top: 0; width: 0; height: 0; z-index: -5; white-space: nowrap; overflow: hidden; resize: none; }
7
+ .xterm .composition-view { background: #000; color: #FFF; display: none; position: absolute; white-space: nowrap; z-index: 1; }
8
+ .xterm .composition-view.active { display: block; }
9
+ .xterm .xterm-viewport { background-color: #000; overflow-y: scroll; cursor: default; position: absolute; right: 0; left: 0; top: 0; bottom: 0; }
10
+ .xterm .xterm-screen { position: relative; }
11
+ .xterm .xterm-screen canvas { position: absolute; left: 0; top: 0; }
12
+ .xterm .xterm-scroll-area { visibility: hidden; }
13
+ .xterm-char-measure-element { display: inline-block; visibility: hidden; position: absolute; top: 0; left: -9999em; line-height: normal; }
14
+ .xterm.enable-mouse-events { cursor: default; }
15
+ .xterm.xterm-cursor-pointer, .xterm .xterm-cursor-pointer { cursor: pointer; }
16
+ .xterm.column-select.focus { cursor: crosshair; }
17
+ .xterm .xterm-accessibility:not(.debug), .xterm .xterm-message { position: absolute; left: 0; top: 0; bottom: 0; right: 0; z-index: 10; color: transparent; pointer-events: none; }
18
+ .xterm .xterm-accessibility-tree:not(.debug) *::selection { color: transparent; }
19
+ .xterm .xterm-accessibility-tree { user-select: text; white-space: pre; }
20
+ .xterm .live-region { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
21
+ .xterm-dim { opacity: 1 !important; }
22
+ .xterm-underline-1 { text-decoration: underline; }
23
+ .xterm-underline-2 { text-decoration: double underline; }
24
+ .xterm-underline-3 { text-decoration: wavy underline; }
25
+ .xterm-underline-4 { text-decoration: dotted underline; }
26
+ .xterm-underline-5 { text-decoration: dashed underline; }
27
+ .xterm-overline { text-decoration: overline; }
28
+ .xterm-strikethrough { text-decoration: line-through; }
29
+ .xterm-screen .xterm-decoration-container .xterm-decoration { z-index: 6; position: absolute; }
30
+ .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer { z-index: 7; }
31
+ .xterm-decoration-overview-ruler { z-index: 8; position: absolute; top: 0; right: 0; pointer-events: none; }
32
+ .xterm-decoration-top { z-index: 2; position: relative; }
33
+ `;function Y(){if(document.getElementById("xterm-css"))return;const f=document.createElement("style");f.id="xterm-css",f.textContent=Q,document.head.appendChild(f)}const re=n.forwardRef(function({entityName:z,entityType:g,entitySha:E,entityFilePath:y,scenarioName:b,scenarioDescription:v,analysisId:m,projectSlug:a,onRefreshPreview:N,onShowResults:S,onHideResults:h,editorMode:A,onIdleChange:T,notificationsEnabled:D},$){const M=n.useRef(null),k=n.useRef(null),j=n.useRef(null),w=n.useRef(null),B=n.useRef(null),C=n.useRef(!1),R=n.useRef(0),L=n.useRef(!1),x=n.useRef(T);x.current=T;const W=n.useRef(D);W.current=D;const U=n.useCallback(()=>{var o;(o=j.current)==null||o.focus()},[]);return n.useImperativeHandle($,()=>({sendInput(o){const l=w.current;l&&l.readyState===WebSocket.OPEN&&(l.send(JSON.stringify({type:"input",data:o})),setTimeout(()=>{l.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:"input",data:"\r"}))},100))},focus(){var o;(o=j.current)==null||o.focus()},scrollToBottom(){var l;const o=(l=M.current)==null?void 0:l.querySelector(".xterm-viewport");o&&(o.scrollTop=o.scrollHeight)}})),n.useEffect(()=>{const o=M.current;if(!o)return;let l=!1;return Y(),Promise.all([P(()=>import("./xterm-BqvuqXEL.js"),[]),P(()=>import("./addon-fit-CUXOrorO.js").then(p=>p.a),__vite__mapDeps([0,1])),P(()=>import("./addon-web-links-Duc5hnl7.js").then(p=>p.a),__vite__mapDeps([2,1]))]).then(([p,V,q])=>{if(l)return;const t=new p.Terminal({cursorBlink:!0,fontSize:13,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"},linkHandler:{activate(s,e){try{const i=new URL(e),c=i.searchParams.get("scenario");if(c&&i.pathname==="/editor"){const d=new BroadcastChannel("codeyam-editor");d.postMessage({type:"switch-scenario",scenarioId:c}),d.close();return}}catch{}window.open(e,"_blank")}}}),O=new V.FitAddon;t.loadAddon(O),t.loadAddon(new q.WebLinksAddon),t.open(o),O.fit(),j.current=t,t.focus(),setTimeout(()=>t.focus(),100),setTimeout(()=>t.focus(),500);const X=window.location.protocol==="https:"?"wss:":"ws:",G=window.location.host;function K(s){const e=new URLSearchParams;return e.set("entityName",z),g&&e.set("entityType",g),E&&e.set("entitySha",E),y&&e.set("entityFilePath",y),b&&e.set("scenarioName",b),v&&e.set("scenarioDescription",v),m&&e.set("analysisId",m),a&&e.set("projectSlug",a),A&&e.set("editorMode","true"),s&&e.set("reconnectId",s),`${X}//${G}/ws/terminal?${e.toString()}`}function F(s){const e=K(s),i=new WebSocket(e);w.current=i,i.onopen=()=>{R.current=0,L.current=!1,i.send(JSON.stringify({type:"resize",cols:t.cols,rows:t.rows}))},i.onmessage=c=>{var d,I;try{const u=JSON.parse(c.data);if(u.type==="session-id"){B.current=u.sessionId;return}if(u.type==="refresh-preview"){N==null||N(u.path);return}if(u.type==="show-results"){S==null||S();return}if(u.type==="hide-results"){h==null||h();return}if(u.type==="claude-idle"){if(console.log("[Terminal] Received claude-idle, notifications:",W.current,"permission:",typeof Notification<"u"?Notification.permission:"N/A"),(d=x.current)==null||d.call(x,!0),W.current&&typeof Notification<"u"&&Notification.permission==="granted"){const H=new Notification("Claude is ready for you",{body:"Claude has finished and is waiting for your input.",tag:"claude-idle"});H.onclick=()=>{window.focus(),H.close()}}return}u.type==="output"&&(t.write(u.data),(I=x.current)==null||I.call(x,!1))}catch{t.write(c.data)}},i.onclose=()=>{if(C.current){t.write(`\r
34
+ \x1B[90m[Terminal session ended]\x1B[0m\r
35
+ `);return}const c=R.current;if(c<5&&B.current){const d=1e3*Math.pow(2,Math.min(c,3));R.current=c+1,t.write(`\r
36
+ \x1B[33m[Reconnecting...]\x1B[0m\r
37
+ `),setTimeout(()=>{C.current||F(B.current)},d)}else L.current?t.write(`\r
38
+ \x1B[90m[Terminal session ended]\x1B[0m\r
39
+ `):(L.current=!0,t.write(`\r
40
+ \x1B[33m[Starting new session...]\x1B[0m\r
41
+ `),B.current=null,R.current=0,F())},i.onerror=()=>{}}F(),t.onData(s=>{const e=w.current;e&&e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({type:"input",data:s}))});let _=null;const J=new ResizeObserver(()=>{_&&clearTimeout(_),_=setTimeout(()=>{const s=O.proposeDimensions();if(!s||s.cols===t.cols&&s.rows===t.rows)return;const e=o.querySelector(".xterm-viewport");let i,c=!0;e&&(i=e.scrollTop,c=e.scrollTop+e.clientHeight>=e.scrollHeight-10),O.fit(),e&&i!==void 0&&(c?e.scrollTop=e.scrollHeight:e.scrollTop=i);const d=w.current;d&&d.readyState===WebSocket.OPEN&&d.send(JSON.stringify({type:"resize",cols:t.cols,rows:t.rows}))},150)});J.observe(o),k.current=()=>{var s;_&&clearTimeout(_),J.disconnect(),C.current=!0,(s=w.current)==null||s.close(),w.current=null,t.dispose(),j.current=null}}),()=>{var p;l=!0,(p=k.current)==null||p.call(k),k.current=null}},[]),r.jsx("div",{ref:M,onClick:U,className:"w-full h-full",style:{padding:"4px 0 0 8px"}})});export{te as D,re as T};
@@ -1 +1 @@
1
- import{j as v}from"./chunk-JZWAC4HX-7VptmeIr.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-JZWAC4HX-C4pqxYJB.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,4 +1,4 @@
1
- import{r as u,j as e,L as p,w as se,u as te,c as ae,f as re}from"./chunk-JZWAC4HX-7VptmeIr.js";import{u as ne}from"./useLastLogLine-DZp6rrQD.js";import{u as le}from"./useToast-BOur3mUv.js";import{u as oe}from"./useReportContext-BsQb6rFd.js";import{L as ie}from"./LogViewer-CMK8Q7yk.js";import{I as E,C as P,E as ce}from"./EntityTypeIcon-DN9eiJAO.js";import{S as Y}from"./SafeScreenshot-CG2uh31y.js";import{g as de}from"./scenarioStatus-B_8jpV3e.js";import{c as q}from"./createLucideIcon-D-QUFOwe.js";import{C as xe}from"./circle-check-B6C4LY9o.js";import{L as S}from"./loader-circle-BnDcD54R.js";/**
1
+ import{r as u,j as e,L as p,w as se,u as te,d as ae,f as re}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as ne}from"./useLastLogLine-C14nCb1q.js";import{u as le}from"./useToast-9FIWuYfK.js";import{u as oe}from"./useReportContext-O-jkvSPx.js";import{L as ie}from"./LogViewer-ceAyBX-H.js";import{I as E,C as P,E as ce}from"./EntityTypeIcon-CobE682z.js";import{S as Y}from"./SafeScreenshot-BED4B6sP.js";import{g as de}from"./scenarioStatus-B_8jpV3e.js";import{c as q}from"./createLucideIcon-CMT1jU2q.js";import{C as xe}from"./circle-check-DyIKORY6.js";import{L as S}from"./loader-circle-BAXYRVEO.js";/**
2
2
  * @license lucide-react v0.556.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{j as e,w as se,u as te,i as re,r as f,L as b,f as R}from"./chunk-JZWAC4HX-7VptmeIr.js";import{L as oe}from"./LogViewer-CMK8Q7yk.js";import{u as ie}from"./useLastLogLine-DZp6rrQD.js";import{u as le}from"./useReportContext-BsQb6rFd.js";import{E as q}from"./EntityTypeIcon-DN9eiJAO.js";import{E as ee}from"./EntityTypeBadge-B-0PjGOU.js";import{S as Z}from"./SafeScreenshot-CG2uh31y.js";import{L as ae}from"./LoadingDots-CSP6DZrh.js";import{L as ne}from"./loader-circle-BnDcD54R.js";import{P as ce,F as de}from"./pause-DhQX2g22.js";import{c as X}from"./createLucideIcon-D-QUFOwe.js";/**
1
+ import{j as e,w as se,u as te,k as re,r as f,L as b,f as R}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{L as oe}from"./LogViewer-ceAyBX-H.js";import{u as ie}from"./useLastLogLine-C14nCb1q.js";import{u as le}from"./useReportContext-O-jkvSPx.js";import{E as q}from"./EntityTypeIcon-CobE682z.js";import{E as ee}from"./EntityTypeBadge-g3saevPb.js";import{S as Z}from"./SafeScreenshot-BED4B6sP.js";import{L as ae}from"./LoadingDots-BU_OAEMP.js";import{L as ne}from"./loader-circle-BAXYRVEO.js";import{P as ce,F as de}from"./pause-DTAcYxBt.js";import{c as X}from"./createLucideIcon-CMT1jU2q.js";/**
2
2
  * @license lucide-react v0.556.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{g}from"./chunk-JZWAC4HX-C4pqxYJB.js";function _(i,s){for(var o=0;o<s.length;o++){const t=s[o];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in i)){const r=Object.getOwnPropertyDescriptor(t,e);r&&Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}},d;function y(){return d||(d=1,(function(i,s){(function(o,t){i.exports=t()})(self,(()=>(()=>{var o={};return(()=>{var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const r=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,r=e._renderService.dimensions;if(r.css.cell.width===0||r.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),m=parseInt(l.getPropertyValue("height")),u=Math.max(0,parseInt(l.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),h=m-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),f=u-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(f/r.css.cell.width)),rows:Math.max(1,Math.floor(h/r.css.cell.height))}}}})(),o})()))})(a)),a.exports}var p=y();const w=g(p),x=_({__proto__:null,default:w},[p]);export{x as a};
@@ -0,0 +1 @@
1
+ import{g as O}from"./chunk-JZWAC4HX-C4pqxYJB.js";function j(b,k){for(var _=0;_<k.length;_++){const l=k[_];if(typeof l!="string"&&!Array.isArray(l)){for(const u in l)if(u!=="default"&&!(u in b)){const L=Object.getOwnPropertyDescriptor(l,u);L&&Object.defineProperty(b,u,L.get?L:{enumerable:!0,get:()=>l[u]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var w={exports:{}},$;function A(){return $||($=1,(function(b,k){(function(_,l){b.exports=l()})(self,(()=>(()=>{var _={6:(p,d)=>{function h(n){try{const e=new URL(n),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return n.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(d,"__esModule",{value:!0}),d.LinkComputer=d.WebLinkProvider=void 0,d.WebLinkProvider=class{constructor(n,e,t,r={}){this._terminal=n,this._regex=e,this._handler=t,this._options=r}provideLinks(n,e){const t=f.computeLink(n,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(n){return n.map((e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){const{range:c}=e;this._options.hover(t,r,c)}},e)))}};class f{static computeLink(e,t,r,c){const g=new RegExp(t.source,(t.flags||"")+"g"),[o,s]=f._getWindowedLineStrings(e-1,r),i=o.join("");let a;const x=[];for(;a=g.exec(i);){const v=a[0];if(!h(v))continue;const[m,W]=f._mapStrIdx(r,s,0,a.index),[y,P]=f._mapStrIdx(r,m,W,v.length);if(m===-1||W===-1||y===-1||P===-1)continue;const S={start:{x:W+1,y:m+1},end:{x:P,y:y+1}};x.push({range:S,text:v,activate:c})}return x}static _getWindowedLineStrings(e,t){let r,c=e,g=e,o=0,s="";const i=[];if(r=t.buffer.active.getLine(e)){const a=r.translateToString(!0);if(r.isWrapped&&a[0]!==" "){for(o=0;(r=t.buffer.active.getLine(--c))&&o<2048&&(s=r.translateToString(!0),o+=s.length,i.push(s),r.isWrapped&&s.indexOf(" ")===-1););i.reverse()}for(i.push(a),o=0;(r=t.buffer.active.getLine(++g))&&r.isWrapped&&o<2048&&(s=r.translateToString(!0),o+=s.length,i.push(s),s.indexOf(" ")===-1););}return[i,c]}static _mapStrIdx(e,t,r,c){const g=e.buffer.active,o=g.getNullCell();let s=r;for(;c;){const i=g.getLine(t);if(!i)return[-1,-1];for(let a=s;a<i.length;++a){i.getCell(a,o);const x=o.getChars();if(o.getWidth()&&(c-=x.length||1,a===i.length-1&&x==="")){const v=g.getLine(t+1);v&&v.isWrapped&&(v.getCell(0,o),o.getWidth()===2&&(c+=1))}if(c<0)return[t,a]}t++,s=0}return[t,s]}}d.LinkComputer=f}},l={};function u(p){var d=l[p];if(d!==void 0)return d.exports;var h=l[p]={exports:{}};return _[p](h,h.exports,u),h.exports}var L={};return(()=>{var p=L;Object.defineProperty(p,"__esModule",{value:!0}),p.WebLinksAddon=void 0;const d=u(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(n,e){const t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}p.WebLinksAddon=class{constructor(n=f,e={}){this._handler=n,this._options=e}activate(n){this._terminal=n;const e=this._options,t=e.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new d.WebLinkProvider(this._terminal,t,this._handler,e))}dispose(){var n;(n=this._linkProvider)==null||n.dispose()}}})(),L})()))})(w)),w.exports}var C=A();const T=O(C),E=j({__proto__:null,default:T},[C]);export{E as a};
@@ -1,4 +1,4 @@
1
- import{w as O,u as P,a as I,h as B,r as m,j as e,L as D}from"./chunk-JZWAC4HX-7VptmeIr.js";import{u as U}from"./useReportContext-BsQb6rFd.js";import{c as w}from"./createLucideIcon-D-QUFOwe.js";import{T as F,C as N}from"./terminal-Bs4NC-VZ.js";import{S as V}from"./search-DborVoKD.js";import{C as _}from"./chevron-down-DQJA9f4o.js";import{B as A}from"./book-open-Bp5FLkd4.js";import{T as H}from"./triangle-alert-DTf3Jojp.js";import{C as q,a as z}from"./copy-6nzYCu0G.js";/**
1
+ import{w as O,u as P,a as I,i as B,r as m,j as e,L as D}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as U}from"./useReportContext-O-jkvSPx.js";import{c as w}from"./createLucideIcon-CMT1jU2q.js";import{T as F,C as N}from"./terminal-BG4heKCG.js";import{S as V}from"./search-fKo7v0Zo.js";import{C as _}from"./chevron-down-BH2h1Ea2.js";import{B as A}from"./book-open-D_nMCFmP.js";import{T as H}from"./triangle-alert-DtSmdtM4.js";import{C as q,a as z}from"./copy-NDbZjXao.js";/**
2
2
  * @license lucide-react v0.556.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./createLucideIcon-D-QUFOwe.js";/**
1
+ import{c as o}from"./createLucideIcon-CMT1jU2q.js";/**
2
2
  * @license lucide-react v0.556.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c as o}from"./createLucideIcon-D-QUFOwe.js";/**
1
+ import{c as o}from"./createLucideIcon-CMT1jU2q.js";/**
2
2
  * @license lucide-react v0.556.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -48,4 +48,4 @@ import(${JSON.stringify(t.entry.module)});`:" ";return f.createElement(f.Fragmen
48
48
  console.log(
49
49
  "💿 Hey developer 👋. You can provide a way better UX than this when your app throws errors. Check out https://reactrouter.com/how-to/error-boundary for more information."
50
50
  );
51
- `}});if(Ve(e))return f.createElement(yr,{title:"Unhandled Thrown Response!"},f.createElement("h1",{style:{fontSize:"24px"}},e.status," ",e.statusText),r);let n;if(e instanceof Error)n=e;else{let a=e==null?"Unknown Error":typeof e=="object"&&"toString"in e?e.toString():JSON.stringify(e);n=new Error(a)}return f.createElement(yr,{title:"Application Error!",isOutsideRemixApp:t},f.createElement("h1",{style:{fontSize:"24px"}},"Application Error"),f.createElement("pre",{style:{padding:"2rem",background:"hsla(10, 50%, 50%, 0.1)",color:"red",overflow:"auto"}},n.stack),r)}function yr({title:e,renderScripts:t,isOutsideRemixApp:r,children:n}){var o;let{routeModules:a}=tt();return(o=a.root)!=null&&o.Layout&&!r?n:f.createElement("html",{lang:"en"},f.createElement("head",null,f.createElement("meta",{charSet:"utf-8"}),f.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),f.createElement("title",null,e)),f.createElement("body",null,f.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},n,t?f.createElement(Xl,null):null)))}var Zl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Zl&&(window.__reactRouterVersion="7.13.0")}catch{}var ba=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Sa=f.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:a,reloadDocument:o,replace:i,state:l,target:s,to:u,preventScrollReset:h,viewTransition:c,unstable_defaultShouldRevalidate:m,...g},R){let{basename:b,unstable_useTransitions:E}=f.useContext(Ee),L=typeof u=="string"&&ba.test(u),S=kn(u,b);u=S.to;let D=hi(u,{relative:a}),[A,P,_]=Yl(n,g),y=rs(u,{replace:i,state:l,target:s,preventScrollReset:h,relative:a,viewTransition:c,unstable_defaultShouldRevalidate:m,unstable_useTransitions:E});function M(J){t&&t(J),J.defaultPrevented||y(J)}let F=f.createElement("a",{...g,..._,href:S.absoluteURL||D,onClick:S.isExternal||o?t:M,ref:Ql(R,P),target:s,"data-discover":!L&&r==="render"?"true":void 0});return A&&!L?f.createElement(f.Fragment,null,F,f.createElement(Ea,{page:D})):F});Sa.displayName="Link";var es=f.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:a=!1,style:o,to:i,viewTransition:l,children:s,...u},h){let c=vt(i,{relative:u.relative}),m=Le(),g=f.useContext(et),{navigator:R,basename:b}=f.useContext(Ee),E=g!=null&&ss(c)&&l===!0,L=R.encodeLocation?R.encodeLocation(c).pathname:c.pathname,S=m.pathname,D=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;r||(S=S.toLowerCase(),D=D?D.toLowerCase():null,L=L.toLowerCase()),D&&b&&(D=be(D,b)||D);const A=L!=="/"&&L.endsWith("/")?L.length-1:L.length;let P=S===L||!a&&S.startsWith(L)&&S.charAt(A)==="/",_=D!=null&&(D===L||!a&&D.startsWith(L)&&D.charAt(L.length)==="/"),y={isActive:P,isPending:_,isTransitioning:E},M=P?t:void 0,F;typeof n=="function"?F=n(y):F=[n,P?"active":null,_?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let J=typeof o=="function"?o(y):o;return f.createElement(Sa,{...u,"aria-current":M,className:F,ref:h,style:J,to:i,viewTransition:l},typeof s=="function"?s(y):s)});es.displayName="NavLink";var xa=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:a,state:o,method:i=Ot,action:l,onSubmit:s,relative:u,preventScrollReset:h,viewTransition:c,unstable_defaultShouldRevalidate:m,...g},R)=>{let{unstable_useTransitions:b}=f.useContext(Ee),E=Pa(),L=os(l,{relative:u}),S=i.toLowerCase()==="get"?"get":"post",D=typeof l=="string"&&ba.test(l),A=P=>{if(s&&s(P),P.defaultPrevented)return;P.preventDefault();let _=P.nativeEvent.submitter,y=(_==null?void 0:_.getAttribute("formmethod"))||i,M=()=>E(_||P.currentTarget,{fetcherKey:t,method:y,navigate:r,replace:a,state:o,relative:u,preventScrollReset:h,viewTransition:c,unstable_defaultShouldRevalidate:m});b&&r!==!1?f.startTransition(()=>M()):M()};return f.createElement("form",{ref:R,method:S,action:L,onSubmit:n?s:A,...g,"data-discover":!D&&e==="render"?"true":void 0})});xa.displayName="Form";function ts({getKey:e,storageKey:t,...r}){let n=f.useContext(zt),{basename:a}=f.useContext(Ee),o=Le(),i=Tr();is({getKey:e,storageKey:t});let l=f.useMemo(()=>{if(!n||!e)return null;let u=gr(o,i,a,e);return u!==o.key?u:null},[]);if(!n||n.isSpaMode)return null;let s=((u,h)=>{if(!window.history.state||!window.history.state.key){let c=Math.random().toString(32).slice(2);window.history.replaceState({key:c},"")}try{let m=JSON.parse(sessionStorage.getItem(u)||"{}")[h||window.history.state.key];typeof m=="number"&&window.scrollTo(0,m)}catch(c){console.error(c),sessionStorage.removeItem(u)}}).toString();return f.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${s})(${mr(JSON.stringify(t||vr))}, ${mr(JSON.stringify(l))})`}})}ts.displayName="ScrollRestoration";function Ca(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Bt(e){let t=f.useContext(Je);return W(t,Ca(e)),t}function La(e){let t=f.useContext(et);return W(t,Ca(e)),t}function rs(e,{target:t,replace:r,state:n,preventScrollReset:a,relative:o,viewTransition:i,unstable_defaultShouldRevalidate:l,unstable_useTransitions:s}={}){let u=ra(),h=Le(),c=vt(e,{relative:o});return f.useCallback(m=>{if(zi(m,t)){m.preventDefault();let g=r!==void 0?r:Me(h)===Me(c),R=()=>u(e,{replace:g,state:n,preventScrollReset:a,relative:o,viewTransition:i,unstable_defaultShouldRevalidate:l});s?f.startTransition(()=>R()):R()}},[h,u,c,r,n,t,e,a,o,i,l,s])}function Ps(e){oe(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=f.useRef(fr(e)),r=f.useRef(!1),n=Le(),a=f.useMemo(()=>Bi(n.search,r.current?null:t.current),[n.search]),o=ra(),i=f.useCallback((l,s)=>{const u=fr(typeof l=="function"?l(new URLSearchParams(a)):l);r.current=!0,o("?"+u,s)},[o,a]);return[a,i]}var ns=0,as=()=>`__${String(++ns)}__`;function Pa(){let{router:e}=Bt("useSubmit"),{basename:t}=f.useContext(Ee),r=Ci(),n=e.fetch,a=e.navigate;return f.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:h,body:c}=Vi(o,t);if(i.navigate===!1){let m=i.fetcherKey||as();await n(m,r,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:c,formMethod:i.method||s,formEncType:i.encType||u,flushSync:i.flushSync})}else await a(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:c,formMethod:i.method||s,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[n,a,t,r])}function os(e,{relative:t}={}){let{basename:r}=f.useContext(Ee),n=f.useContext(Ce);W(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),o={...vt(e||".",{relative:t})},i=Le();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),s=l.getAll("index");if(s.some(h=>h==="")){l.delete("index"),s.filter(c=>c).forEach(c=>l.append("index",c));let h=l.toString();o.search=h?`?${h}`:""}}return(!e||e===".")&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:Te([r,o.pathname])),Me(o)}function Ts({key:e}={}){var P;let{router:t}=Bt("useFetcher"),r=La("useFetcher"),n=f.useContext(Cr),a=f.useContext(Ce),o=(P=a.matches[a.matches.length-1])==null?void 0:P.route.id;W(n,"useFetcher must be used inside a FetchersContext"),W(a,"useFetcher must be used inside a RouteContext"),W(o!=null,'useFetcher can only be used on routes that contain a unique "id"');let i=f.useId(),[l,s]=f.useState(e||i);e&&e!==l&&s(e);let{deleteFetcher:u,getFetcher:h,resetFetcher:c,fetch:m}=t;f.useEffect(()=>(h(l),()=>u(l)),[u,h,l]);let g=f.useCallback(async(_,y)=>{W(o,"No routeId available for fetcher.load()"),await m(l,o,_,y)},[l,o,m]),R=Pa(),b=f.useCallback(async(_,y)=>{await R(_,{...y,navigate:!1,fetcherKey:l})},[l,R]),E=f.useCallback(_=>c(l,_),[c,l]),L=f.useMemo(()=>{let _=f.forwardRef((y,M)=>f.createElement(xa,{...y,navigate:!1,fetcherKey:l,ref:M}));return _.displayName="fetcher.Form",_},[l]),S=r.fetchers.get(l)||zn,D=n.get(l);return f.useMemo(()=>({Form:L,submit:b,load:g,reset:E,...S,data:D}),[L,b,g,E,S,D])}var vr="react-router-scroll-positions",_t={};function gr(e,t,r,n){let a=null;return n&&(r!=="/"?a=n({...e,pathname:be(e.pathname,r)||e.pathname},t):a=n(e,t)),a==null&&(a=e.key),a}function is({getKey:e,storageKey:t}={}){let{router:r}=Bt("useScrollRestoration"),{restoreScrollPosition:n,preventScrollReset:a}=La("useScrollRestoration"),{basename:o}=f.useContext(Ee),i=Le(),l=Tr(),s=Li();f.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),ls(f.useCallback(()=>{if(s.state==="idle"){let u=gr(i,l,o,e);_t[u]=window.scrollY}try{sessionStorage.setItem(t||vr,JSON.stringify(_t))}catch(u){oe(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[s.state,e,o,i,l,t])),typeof document<"u"&&(f.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||vr);u&&(_t=JSON.parse(u))}catch{}},[t]),f.useLayoutEffect(()=>{let u=r==null?void 0:r.enableScrollRestoration(_t,()=>window.scrollY,e?(h,c)=>gr(h,c,o,e):void 0);return()=>u&&u()},[r,o,e]),f.useLayoutEffect(()=>{if(n!==!1){if(typeof n=="number"){window.scrollTo(0,n);return}try{if(i.hash){let u=document.getElementById(decodeURIComponent(i.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{oe(!1,`"${i.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}a!==!0&&window.scrollTo(0,0)}},[i,n,a]))}function ls(e,t){let{capture:r}={};f.useEffect(()=>{let n=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,n),()=>{window.removeEventListener("pagehide",e,n)}},[e,r])}function ss(e,{relative:t}={}){let r=f.useContext(xr);W(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=Bt("useViewTransitionState"),a=vt(e,{relative:t});if(!r.isTransitioning)return!1;let o=be(r.currentLocation.pathname,n)||r.currentLocation.pathname,i=be(r.nextLocation.pathname,n)||r.nextLocation.pathname;return Ft(a.pathname,i)!=null||Ft(a.pathname,o)!=null}export{Rs as A,ps as B,ys as C,xs as D,je as E,zt as F,Xl as G,Ya as H,us as I,Sa as L,Cs as M,vl as N,gs as O,Xa as R,ts as S,ra as a,Ps as b,Ts as c,Le as d,Ti as e,hs as f,Ka as g,ms as h,vi as i,cs as j,Ve as k,W as l,Ae as m,Ss as n,Ls as o,vs as p,Ll as q,f as r,kl as s,Dr as t,Pi as u,fs as v,ws as w,bs as x,Es as y,ds as z};
51
+ `}});if(Ve(e))return f.createElement(yr,{title:"Unhandled Thrown Response!"},f.createElement("h1",{style:{fontSize:"24px"}},e.status," ",e.statusText),r);let n;if(e instanceof Error)n=e;else{let a=e==null?"Unknown Error":typeof e=="object"&&"toString"in e?e.toString():JSON.stringify(e);n=new Error(a)}return f.createElement(yr,{title:"Application Error!",isOutsideRemixApp:t},f.createElement("h1",{style:{fontSize:"24px"}},"Application Error"),f.createElement("pre",{style:{padding:"2rem",background:"hsla(10, 50%, 50%, 0.1)",color:"red",overflow:"auto"}},n.stack),r)}function yr({title:e,renderScripts:t,isOutsideRemixApp:r,children:n}){var o;let{routeModules:a}=tt();return(o=a.root)!=null&&o.Layout&&!r?n:f.createElement("html",{lang:"en"},f.createElement("head",null,f.createElement("meta",{charSet:"utf-8"}),f.createElement("meta",{name:"viewport",content:"width=device-width,initial-scale=1,viewport-fit=cover"}),f.createElement("title",null,e)),f.createElement("body",null,f.createElement("main",{style:{fontFamily:"system-ui, sans-serif",padding:"2rem"}},n,t?f.createElement(Xl,null):null)))}var Zl=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Zl&&(window.__reactRouterVersion="7.13.0")}catch{}var ba=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Sa=f.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:a,reloadDocument:o,replace:i,state:l,target:s,to:u,preventScrollReset:h,viewTransition:c,unstable_defaultShouldRevalidate:m,...g},R){let{basename:b,unstable_useTransitions:E}=f.useContext(Ee),L=typeof u=="string"&&ba.test(u),S=kn(u,b);u=S.to;let D=hi(u,{relative:a}),[A,P,_]=Yl(n,g),y=rs(u,{replace:i,state:l,target:s,preventScrollReset:h,relative:a,viewTransition:c,unstable_defaultShouldRevalidate:m,unstable_useTransitions:E});function M(J){t&&t(J),J.defaultPrevented||y(J)}let F=f.createElement("a",{...g,..._,href:S.absoluteURL||D,onClick:S.isExternal||o?t:M,ref:Ql(R,P),target:s,"data-discover":!L&&r==="render"?"true":void 0});return A&&!L?f.createElement(f.Fragment,null,F,f.createElement(Ea,{page:D})):F});Sa.displayName="Link";var es=f.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:a=!1,style:o,to:i,viewTransition:l,children:s,...u},h){let c=vt(i,{relative:u.relative}),m=Le(),g=f.useContext(et),{navigator:R,basename:b}=f.useContext(Ee),E=g!=null&&ss(c)&&l===!0,L=R.encodeLocation?R.encodeLocation(c).pathname:c.pathname,S=m.pathname,D=g&&g.navigation&&g.navigation.location?g.navigation.location.pathname:null;r||(S=S.toLowerCase(),D=D?D.toLowerCase():null,L=L.toLowerCase()),D&&b&&(D=be(D,b)||D);const A=L!=="/"&&L.endsWith("/")?L.length-1:L.length;let P=S===L||!a&&S.startsWith(L)&&S.charAt(A)==="/",_=D!=null&&(D===L||!a&&D.startsWith(L)&&D.charAt(L.length)==="/"),y={isActive:P,isPending:_,isTransitioning:E},M=P?t:void 0,F;typeof n=="function"?F=n(y):F=[n,P?"active":null,_?"pending":null,E?"transitioning":null].filter(Boolean).join(" ");let J=typeof o=="function"?o(y):o;return f.createElement(Sa,{...u,"aria-current":M,className:F,ref:h,style:J,to:i,viewTransition:l},typeof s=="function"?s(y):s)});es.displayName="NavLink";var xa=f.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:a,state:o,method:i=Ot,action:l,onSubmit:s,relative:u,preventScrollReset:h,viewTransition:c,unstable_defaultShouldRevalidate:m,...g},R)=>{let{unstable_useTransitions:b}=f.useContext(Ee),E=Pa(),L=os(l,{relative:u}),S=i.toLowerCase()==="get"?"get":"post",D=typeof l=="string"&&ba.test(l),A=P=>{if(s&&s(P),P.defaultPrevented)return;P.preventDefault();let _=P.nativeEvent.submitter,y=(_==null?void 0:_.getAttribute("formmethod"))||i,M=()=>E(_||P.currentTarget,{fetcherKey:t,method:y,navigate:r,replace:a,state:o,relative:u,preventScrollReset:h,viewTransition:c,unstable_defaultShouldRevalidate:m});b&&r!==!1?f.startTransition(()=>M()):M()};return f.createElement("form",{ref:R,method:S,action:L,onSubmit:n?s:A,...g,"data-discover":!D&&e==="render"?"true":void 0})});xa.displayName="Form";function ts({getKey:e,storageKey:t,...r}){let n=f.useContext(zt),{basename:a}=f.useContext(Ee),o=Le(),i=Tr();is({getKey:e,storageKey:t});let l=f.useMemo(()=>{if(!n||!e)return null;let u=gr(o,i,a,e);return u!==o.key?u:null},[]);if(!n||n.isSpaMode)return null;let s=((u,h)=>{if(!window.history.state||!window.history.state.key){let c=Math.random().toString(32).slice(2);window.history.replaceState({key:c},"")}try{let m=JSON.parse(sessionStorage.getItem(u)||"{}")[h||window.history.state.key];typeof m=="number"&&window.scrollTo(0,m)}catch(c){console.error(c),sessionStorage.removeItem(u)}}).toString();return f.createElement("script",{...r,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${s})(${mr(JSON.stringify(t||vr))}, ${mr(JSON.stringify(l))})`}})}ts.displayName="ScrollRestoration";function Ca(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Bt(e){let t=f.useContext(Je);return W(t,Ca(e)),t}function La(e){let t=f.useContext(et);return W(t,Ca(e)),t}function rs(e,{target:t,replace:r,state:n,preventScrollReset:a,relative:o,viewTransition:i,unstable_defaultShouldRevalidate:l,unstable_useTransitions:s}={}){let u=ra(),h=Le(),c=vt(e,{relative:o});return f.useCallback(m=>{if(zi(m,t)){m.preventDefault();let g=r!==void 0?r:Me(h)===Me(c),R=()=>u(e,{replace:g,state:n,preventScrollReset:a,relative:o,viewTransition:i,unstable_defaultShouldRevalidate:l});s?f.startTransition(()=>R()):R()}},[h,u,c,r,n,t,e,a,o,i,l,s])}function Ps(e){oe(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let t=f.useRef(fr(e)),r=f.useRef(!1),n=Le(),a=f.useMemo(()=>Bi(n.search,r.current?null:t.current),[n.search]),o=ra(),i=f.useCallback((l,s)=>{const u=fr(typeof l=="function"?l(new URLSearchParams(a)):l);r.current=!0,o("?"+u,s)},[o,a]);return[a,i]}var ns=0,as=()=>`__${String(++ns)}__`;function Pa(){let{router:e}=Bt("useSubmit"),{basename:t}=f.useContext(Ee),r=Ci(),n=e.fetch,a=e.navigate;return f.useCallback(async(o,i={})=>{let{action:l,method:s,encType:u,formData:h,body:c}=Vi(o,t);if(i.navigate===!1){let m=i.fetcherKey||as();await n(m,r,i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:c,formMethod:i.method||s,formEncType:i.encType||u,flushSync:i.flushSync})}else await a(i.action||l,{unstable_defaultShouldRevalidate:i.unstable_defaultShouldRevalidate,preventScrollReset:i.preventScrollReset,formData:h,body:c,formMethod:i.method||s,formEncType:i.encType||u,replace:i.replace,state:i.state,fromRouteId:r,flushSync:i.flushSync,viewTransition:i.viewTransition})},[n,a,t,r])}function os(e,{relative:t}={}){let{basename:r}=f.useContext(Ee),n=f.useContext(Ce);W(n,"useFormAction must be used inside a RouteContext");let[a]=n.matches.slice(-1),o={...vt(e||".",{relative:t})},i=Le();if(e==null){o.search=i.search;let l=new URLSearchParams(o.search),s=l.getAll("index");if(s.some(h=>h==="")){l.delete("index"),s.filter(c=>c).forEach(c=>l.append("index",c));let h=l.toString();o.search=h?`?${h}`:""}}return(!e||e===".")&&a.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:Te([r,o.pathname])),Me(o)}function Ts({key:e}={}){var P;let{router:t}=Bt("useFetcher"),r=La("useFetcher"),n=f.useContext(Cr),a=f.useContext(Ce),o=(P=a.matches[a.matches.length-1])==null?void 0:P.route.id;W(n,"useFetcher must be used inside a FetchersContext"),W(a,"useFetcher must be used inside a RouteContext"),W(o!=null,'useFetcher can only be used on routes that contain a unique "id"');let i=f.useId(),[l,s]=f.useState(e||i);e&&e!==l&&s(e);let{deleteFetcher:u,getFetcher:h,resetFetcher:c,fetch:m}=t;f.useEffect(()=>(h(l),()=>u(l)),[u,h,l]);let g=f.useCallback(async(_,y)=>{W(o,"No routeId available for fetcher.load()"),await m(l,o,_,y)},[l,o,m]),R=Pa(),b=f.useCallback(async(_,y)=>{await R(_,{...y,navigate:!1,fetcherKey:l})},[l,R]),E=f.useCallback(_=>c(l,_),[c,l]),L=f.useMemo(()=>{let _=f.forwardRef((y,M)=>f.createElement(xa,{...y,navigate:!1,fetcherKey:l,ref:M}));return _.displayName="fetcher.Form",_},[l]),S=r.fetchers.get(l)||zn,D=n.get(l);return f.useMemo(()=>({Form:L,submit:b,load:g,reset:E,...S,data:D}),[L,b,g,E,S,D])}var vr="react-router-scroll-positions",_t={};function gr(e,t,r,n){let a=null;return n&&(r!=="/"?a=n({...e,pathname:be(e.pathname,r)||e.pathname},t):a=n(e,t)),a==null&&(a=e.key),a}function is({getKey:e,storageKey:t}={}){let{router:r}=Bt("useScrollRestoration"),{restoreScrollPosition:n,preventScrollReset:a}=La("useScrollRestoration"),{basename:o}=f.useContext(Ee),i=Le(),l=Tr(),s=Li();f.useEffect(()=>(window.history.scrollRestoration="manual",()=>{window.history.scrollRestoration="auto"}),[]),ls(f.useCallback(()=>{if(s.state==="idle"){let u=gr(i,l,o,e);_t[u]=window.scrollY}try{sessionStorage.setItem(t||vr,JSON.stringify(_t))}catch(u){oe(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${u}).`)}window.history.scrollRestoration="auto"},[s.state,e,o,i,l,t])),typeof document<"u"&&(f.useLayoutEffect(()=>{try{let u=sessionStorage.getItem(t||vr);u&&(_t=JSON.parse(u))}catch{}},[t]),f.useLayoutEffect(()=>{let u=r==null?void 0:r.enableScrollRestoration(_t,()=>window.scrollY,e?(h,c)=>gr(h,c,o,e):void 0);return()=>u&&u()},[r,o,e]),f.useLayoutEffect(()=>{if(n!==!1){if(typeof n=="number"){window.scrollTo(0,n);return}try{if(i.hash){let u=document.getElementById(decodeURIComponent(i.hash.slice(1)));if(u){u.scrollIntoView();return}}}catch{oe(!1,`"${i.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}a!==!0&&window.scrollTo(0,0)}},[i,n,a]))}function ls(e,t){let{capture:r}={};f.useEffect(()=>{let n=r!=null?{capture:r}:void 0;return window.addEventListener("pagehide",e,n),()=>{window.removeEventListener("pagehide",e,n)}},[e,r])}function ss(e,{relative:t}={}){let r=f.useContext(xr);W(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=Bt("useViewTransitionState"),a=vt(e,{relative:t});if(!r.isTransitioning)return!1;let o=be(r.currentLocation.pathname,n)||r.currentLocation.pathname,i=be(r.nextLocation.pathname,n)||r.nextLocation.pathname;return Ft(a.pathname,i)!=null||Ft(a.pathname,o)!=null}export{ds as A,Rs as B,ps as C,ys as D,je as E,zt as F,xs as G,Xl as H,us as I,Sa as L,Cs as M,vl as N,gs as O,Xa as R,ts as S,ra as a,Ps as b,Le as c,Ts as d,Ti as e,hs as f,Ya as g,Ka as h,ms as i,cs as j,vi as k,Ve as l,Ae as m,W as n,Ss as o,Ls as p,vs as q,f as r,kl as s,Ll as t,Pi as u,Dr as v,ws as w,fs as x,bs as y,Es as z};
@@ -1,4 +1,4 @@
1
- import{c}from"./createLucideIcon-D-QUFOwe.js";/**
1
+ import{c}from"./createLucideIcon-CMT1jU2q.js";/**
2
2
  * @license lucide-react v0.556.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{c}from"./createLucideIcon-D-QUFOwe.js";/**
1
+ import{c}from"./createLucideIcon-CMT1jU2q.js";/**
2
2
  * @license lucide-react v0.556.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{r as s}from"./chunk-JZWAC4HX-7VptmeIr.js";/**
1
+ import{r as s}from"./chunk-JZWAC4HX-C4pqxYJB.js";/**
2
2
  * @license lucide-react v0.556.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -0,0 +1 @@
1
+ import{w as t,d as r,j as e}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{S as i}from"./ScenarioViewer-B76aig_2.js";import{W as n}from"./InteractivePreview-DYFW3lDD.js";import"./useCustomSizes-ByhSyh0W.js";import"./LogViewer-ceAyBX-H.js";import"./SafeScreenshot-BED4B6sP.js";import"./useLastLogLine-C14nCb1q.js";import"./Spinner-Bb5uFQ5V.js";import"./preload-helper-ckwbz45p.js";import"./ReportIssueModal-djPLI-WV.js";import"./createLucideIcon-CMT1jU2q.js";import"./circle-check-DyIKORY6.js";import"./triangle-alert-DtSmdtM4.js";import"./copy-NDbZjXao.js";import"./scenarioStatus-B_8jpV3e.js";import"./InlineSpinner-Bu6c6aDe.js";const w=()=>[{title:"Empty State - CodeYam"},{name:"description",content:"Simulations empty state development view"}],k=t(function(){r();const s={sha:"mock-sha",name:"Dashboard",filePath:"codeyam-cli/src/webserver/app/routes/_index.tsx",entityType:"visual"};return e.jsx(n,{children:e.jsxs("div",{className:"h-screen bg-[#F8F7F6] flex flex-col overflow-hidden",children:[e.jsx("header",{className:"bg-white border-b border-gray-200 shrink-0 relative h-[54px]",children:e.jsxs("div",{className:"flex items-center h-full px-6 gap-6",children:[e.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M13 8.5H4M4 8.5L8.5 4M4 8.5L8.5 13",stroke:"#005c75",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("h1",{className:"text-lg font-semibold text-black m-0 leading-[26px] shrink-0",children:"Dashboard"}),e.jsx("span",{className:"text-xs text-[#626262] font-mono whitespace-nowrap overflow-hidden text-ellipsis min-w-0",children:"codeyam-cli/src/webserver/app/routes/_index.tsx"})]}),e.jsxs("div",{className:"flex items-center gap-3 shrink-0",children:[e.jsxs("div",{className:"flex items-center gap-2 px-[15px] py-0 h-[26px] bg-[#efefef] border border-[#e1e1e1] rounded",children:[e.jsx("div",{className:"w-2 h-2 rounded-full bg-[#626262]"}),e.jsx("span",{className:"text-xs font-semibold text-[#626262]",children:"Not analyzed"})]}),e.jsx("button",{className:"px-[15px] py-0 h-[26px] bg-[#005c75] text-white rounded text-xs font-semibold border-none cursor-pointer hover:bg-[#004a5e] transition-colors",children:"Analyze"})]}),e.jsxs("div",{className:"flex items-center gap-1 text-[10px] text-[#626262] ml-auto",children:[e.jsx("span",{className:"leading-[22px]",children:"Next Entity"}),e.jsx("svg",{width:"17",height:"17",viewBox:"0 0 17 17",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M4 8.5H13M13 8.5L8.5 4M13 8.5L8.5 13",stroke:"#005c75",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]})]})}),e.jsx("div",{className:"bg-[#efefef] border-b border-[#efefef] shrink-0",children:e.jsxs("div",{className:"flex items-center gap-3 h-11 px-[15px]",children:[e.jsxs("div",{className:"px-4 flex items-center justify-center gap-3 shrink-0 text-sm rounded bg-[#343434] text-[#efefef] font-semibold h-8",children:["Scenarios",e.jsx("span",{className:"px-2 py-0.5 rounded-[9px] text-xs font-semibold bg-[#cbf3fa] text-[#005c75] min-w-[25px] text-center",children:"0"})]}),e.jsxs("div",{className:"px-4 flex items-center justify-center gap-3 shrink-0 text-sm rounded-[9px] text-[#3e3e3e] font-normal",children:["Related Entities",e.jsx("span",{className:"px-2 py-0.5 rounded-[9px] text-xs font-semibold bg-[#e1e1e1] text-[#3e3e3e] min-w-[25px] text-center",children:"5"})]}),e.jsx("div",{className:"px-4 shrink-0 text-sm text-[#3e3e3e] font-normal",children:"Code"}),e.jsx("div",{className:"px-4 shrink-0 text-sm text-[#3e3e3e] font-normal",children:"Data Structure"}),e.jsx("div",{className:"px-4 shrink-0 text-sm text-[#3e3e3e] font-normal",children:"History"})]})}),e.jsxs("div",{className:"flex flex-1 gap-0 min-h-0",children:[e.jsx("div",{className:"w-[165px] bg-[#e1e1e1] border-r border-[#c7c7c7] flex items-center justify-center shrink-0",children:e.jsx("span",{className:"text-xs font-medium text-[#8e8e8e] leading-5",children:"No Scenarios"})}),e.jsx(i,{selectedScenario:null,analysis:void 0,entity:s,viewMode:"screenshot",cacheBuster:Date.now(),hasScenarios:!1,isAnalyzing:!1,projectSlug:null,hasAnApiKey:!0})]})]})})});export{k as default,w as meta};
@@ -0,0 +1,8 @@
1
+ import{r,j as e,w as et,u as tt,f as st,b as at}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as rt,V as nt,S as it}from"./useCustomSizes-ByhSyh0W.js";import{T as lt,D as ot}from"./Terminal-Dnj5CY9R.js";import{c as ct}from"./cy-logo-cli-DcX-ZS3p.js";import{S as Me,u as dt}from"./Spinner-Bb5uFQ5V.js";import"./preload-helper-ckwbz45p.js";import"./useLastLogLine-C14nCb1q.js";function Ee(a){const[s,i]=r.useState(null),[o,g]=r.useState(!1),N=r.useCallback(()=>{a&&(g(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(a)}`).then(v=>v.json()).then(v=>{i(v),g(!1)}).catch(()=>{i({testFilePath:a,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),g(!1)}))},[a]);return r.useEffect(()=>{a&&N()},[a,N]),{results:s,isRunning:o,runTests:N}}function Y({imgSrc:a,name:s,isActive:i,onSelect:o}){return e.jsxs("button",{onClick:o,className:"flex flex-col items-center gap-1 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${i?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:a?e.jsx("img",{src:a,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-32 ${i?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function me({testFile:a,entityName:s}){const{results:i,isRunning:o,runTests:g}=Ee(a);if(o&&!i)return e.jsxs("div",{className:"px-2 pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!i)return null;if(i.status==="error")return e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:i.errorMessage})});const N=s?i.testCases.filter(p=>{const u=`${s} > `;return p.fullName.startsWith(u)||p.fullName===s}):i.testCases;if(N.length===0)return null;const v=s?`${s} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[N.map(p=>{var l;const u=v&&p.fullName.startsWith(v)?p.fullName.slice(v.length):p.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[p.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):p.status==="failed"?e.jsx("span",{className:"text-red-400 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-500 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${p.status==="passed"?"text-green-400":p.status==="failed"?"text-red-400":"text-gray-500"}`,children:u})]}),p.status==="failed"&&((l=p.failureMessages)==null?void 0:l.map((f,b)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:f,children:f.split(`
2
+ `)[0]},b)))]},p.fullName)}),e.jsx("button",{onClick:g,disabled:o,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#00c4ee] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:o?"Running...":"Re-run"})]})}function V({filePath:a,projectRoot:s}){if(!a)return null;const o=`vscode://file/${s?`${s}/${a}`:a}`;return e.jsxs("div",{className:"flex items-center gap-1 px-2 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:a}),e.jsx("a",{href:o,title:"Open in editor",className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function xt(a){if(!a||a==="/")return"Home";const i=a.split("?")[0].replace(/^\//,"").split("/")[0];return i.charAt(0).toUpperCase()+i.slice(1)}function mt({scenarios:a,projectRoot:s,activeScenarioId:i,onScenarioSelect:o,zoomComponent:g,onZoomChange:N,analyzedEntities:v=[],glossaryFunctions:p=[],activeAnalyzedScenarioId:u,onAnalyzedScenarioSelect:l,entityImports:f}){const{pageGroups:b,componentGroups:k}=r.useMemo(()=>{const t=new Map,d=new Map;for(const S of a)if(S.componentName){const M=d.get(S.componentName)||[];M.push(S),d.set(S.componentName,M)}else{const M=xt(S.url),w=t.get(M)||[];w.push(S),t.set(M,w)}const h=new Map([...d.entries()].sort(([S],[M])=>S.localeCompare(M)));return{pageGroups:t,componentGroups:h}},[a]),j=r.useMemo(()=>{const t=new Set((v||[]).filter(h=>h.entityType==="visual").map(h=>h.name)),d=new Map;for(const[h,S]of k)t.has(h)||d.set(h,S);return d},[k,v]),{visualEntities:I,libraryEntities:$}=r.useMemo(()=>{const t=v.filter(h=>h.entityType==="visual").sort((h,S)=>h.name.localeCompare(S.name)),d=v.filter(h=>h.entityType==="library"||h.entityType==="functionCall").sort((h,S)=>h.name.localeCompare(S.name));return{visualEntities:t,libraryEntities:d}},[v]),R=r.useMemo(()=>{const t=new Set($.map(d=>d.name));return p.filter(d=>!t.has(d.name)).sort((d,h)=>d.name.localeCompare(h.name))},[p,$]),z=v.some(t=>t.isAnalyzing),B=r.useRef(null),x=r.useRef(0),y=r.useCallback(()=>{B.current&&(x.current=B.current.scrollTop)},[]);if(r.useEffect(()=>{B.current&&x.current>0&&(B.current.scrollTop=x.current)}),a.length===0&&v.length===0&&R.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No scenarios yet"}),e.jsx("p",{className:"text-xs",children:"Scenarios will appear here as Claude creates them alongside your code. Each scenario represents a different state of your app's data."})]})});if(g){const t=k.get(g)||[],d=new Set((f==null?void 0:f[g])||[]),h=d.size>0,S=h?I.filter(w=>d.has(w.name)):[],M=h?$.filter(w=>d.has(w.name)):[];return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-1",children:[e.jsxs("button",{onClick:()=>N(void 0),className:"w-full flex items-center gap-2 px-3 py-1.5 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All scenarios"]}),e.jsx("div",{className:"px-3 py-1.5",children:e.jsx("span",{className:"text-xs font-semibold text-white uppercase tracking-wider",children:g})}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2",children:t.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):t.map(w=>e.jsx(Y,{imgSrc:w.screenshotPath?`/api/editor-scenario-image/${w.id}.png`:null,name:w.name,isActive:w.id===i,onSelect:()=>o(w)},w.id))}),S.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),S.map(w=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center gap-2 px-2 py-1",children:e.jsx("button",{onClick:()=>N(w.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:w.name})}),e.jsx(V,{filePath:w.filePath,projectRoot:s}),(w.scenarios.length>0||w.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:w.scenarios.map(c=>e.jsx(Y,{imgSrc:c.screenshotPath?`/api/screenshot/${c.screenshotPath}`:null,name:c.name,isActive:c.id===u,onSelect:()=>l==null?void 0:l({analysisId:w.analysisId,scenarioId:c.id,scenarioName:c.name,entitySha:w.sha,entityName:w.name})},c.id))})]},w.sha))]}),M.length>0&&e.jsxs("div",{className:"pt-2 mt-1",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),M.map(w=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:w.name})}),e.jsx(V,{filePath:w.filePath,projectRoot:s}),w.testFile&&e.jsx(me,{testFile:w.testFile,entityName:w.name})]},w.sha))]})]})})}return e.jsx("div",{ref:B,onScroll:y,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[b.size>0&&e.jsxs("div",{children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),[...b.entries()].sort(([t],[d])=>t==="Home"?-1:d==="Home"?1:t.localeCompare(d)).map(([t,d])=>e.jsxs("div",{className:"px-2 pt-1",children:[e.jsx("div",{className:"py-0.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-400",children:t})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:d.map(h=>e.jsx(Y,{imgSrc:h.screenshotPath?`/api/editor-scenario-image/${h.id}.png`:null,name:h.name,isActive:h.id===i&&!u,onSelect:()=>o(h)},h.id))})]},t))]}),j.size>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),[...j.entries()].map(([t,d])=>{var h;return e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"flex items-center justify-between px-2 py-1",children:e.jsx("button",{onClick:()=>N(t),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:t})}),((h=d[0])==null?void 0:h.componentPath)&&e.jsx(V,{filePath:d[0].componentPath,projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:d.map(S=>e.jsx(Y,{imgSrc:S.screenshotPath?`/api/editor-scenario-image/${S.id}.png`:null,name:S.name,isActive:S.id===i&&!u,onSelect:()=>o(S)},S.id))})]},t)})]}),I.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),z&&a.length===0&&v.every(t=>t.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),I.map(t=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 px-2 py-1",children:[e.jsx("button",{onClick:()=>N(t.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:t.name}),t.isAnalyzing&&t.scenarioCount===0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(V,{filePath:t.filePath,projectRoot:s}),(t.scenarios.length>0||t.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[t.scenarios.map(d=>e.jsx(Y,{imgSrc:d.screenshotPath?`/api/screenshot/${d.screenshotPath}`:null,name:d.name,isActive:d.id===u,onSelect:()=>l==null?void 0:l({analysisId:t.analysisId,scenarioId:d.id,scenarioName:d.name,entitySha:t.sha,entityName:t.name})},d.id)),t.pendingScenarios.map(d=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:d,children:d},d))]})]},t.sha))]}),($.length>0||R.length>0)&&e.jsxs("div",{className:`pt-2 mt-1 ${I.length>0?"":"border-t border-[#3d3d3d]"}`,children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),$.map(t=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"px-2 py-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:t.name}),t.isAnalyzing&&t.scenarioCount===0&&e.jsxs("span",{className:"ml-2 inline-flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),e.jsx(V,{filePath:t.filePath,projectRoot:s}),t.testFile?e.jsx(me,{testFile:t.testFile,entityName:t.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},t.sha)),R.map(t=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"px-2 py-1",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:t.name})}),e.jsx(V,{filePath:t.filePath,projectRoot:s}),e.jsx(me,{testFile:t.testFile,entityName:t.name})]},t.name))]})]})})}function ht(a){const s=new Map;for(const i of[...a].reverse()){const o=s.get(i.date)||[];o.push(i),s.set(i.date,o)}return s}function pt(a){const s=new Map;for(const i of a){const o=i.name.indexOf(" - "),g=o!==-1?i.name.slice(0,o):"App",N=s.get(g)||[];N.push(i),s.set(g,N)}return[...s.entries()].sort(([i],[o])=>i==="App"?-1:o==="App"?1:i.localeCompare(o))}const ut={feature:{label:"Feature",color:"bg-[#005c75]"},fix:{label:"Fix",color:"bg-amber-700"},refactor:{label:"Refactor",color:"bg-purple-700"},scaffold:{label:"Scaffold",color:"bg-green-700"},data:{label:"Data",color:"bg-blue-700"},milestone:{label:"Milestone",color:"bg-yellow-600"}};function ft(a){try{return new Date(a).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function gt(a){try{return new Date(a+"T00:00:00").toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}catch{return a}}function jt({isActive:a,onScreenshotClick:s}){const[i,o]=r.useState([]),[g,N]=r.useState(!0),[v,p]=r.useState(new Set),u=r.useCallback(b=>{p(k=>{const j=new Set(k);return j.has(b)?j.delete(b):j.add(b),j})},[]),l=r.useCallback(async()=>{try{const b=await fetch("/api/editor-journal");if(b.ok){const k=await b.json();o(k.entries||[])}}catch{}finally{N(!1)}},[]);if(r.useEffect(()=>{l()},[l]),r.useEffect(()=>{a&&l()},[a,l]),r.useEffect(()=>{const b=new EventSource("/api/events");return b.addEventListener("message",k=>{try{const j=JSON.parse(k.data);j.type==="db-change"&&j.changeType==="journal"&&l()}catch{}}),()=>b.close()},[l]),g)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsx("span",{className:"text-gray-500 text-sm",children:"Loading journal..."})});if(i.length===0)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"text-center text-gray-500 px-8",children:[e.jsx("p",{className:"text-sm font-medium mb-2",children:"No journal entries yet"}),e.jsx("p",{className:"text-xs",children:"Journal entries will appear as you build. Claude records features, screenshots, and commits as the project evolves."})]})});const f=ht(i);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsx("div",{className:"p-3 space-y-4",children:[...f.entries()].map(([b,k])=>e.jsxs("div",{children:[e.jsx("div",{className:"px-3 py-1.5 sticky top-0 bg-[#1e1e1e] z-10",children:e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:gt(b)})}),e.jsx("div",{className:"space-y-2",children:k.map((j,I)=>{const $=ut[j.type]||{label:j.type,color:"bg-gray-600"},R=`${j.time}-${I}`,z=v.has(R);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:`p-3 space-y-2 ${z?"":"max-h-[300px] overflow-y-auto"}`,children:[e.jsx("div",{className:"flex items-start gap-2",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-white truncate",children:j.title}),e.jsx("span",{className:`${$.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:$.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:ft(j.time)})]})}),e.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:j.description}),j.screenshot&&e.jsx("button",{type:"button",className:"rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] flex items-center justify-center p-1 cursor-pointer transition-colors w-full",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${j.screenshot.replace("screenshots/","")}`,commitSha:j.commitSha,commitMessage:j.commitMessage,scenarioName:j.title}),children:e.jsx("img",{src:`/api/editor-journal-image/${j.screenshot.replace("screenshots/","")}`,alt:j.title,className:"max-w-full max-h-full object-contain",loading:"lazy"})}),j.scenarioScreenshots&&j.scenarioScreenshots.length>0&&(()=>{const B=pt(j.scenarioScreenshots);return e.jsx("div",{className:"space-y-1.5",children:B.map(([x,y])=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:x}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:y.map(t=>e.jsx("button",{type:"button",className:"w-[4.5rem] h-[4.5rem] rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${t.path.replace("screenshots/","")}`,commitSha:j.commitSha,commitMessage:j.commitMessage,scenarioName:t.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${t.path.replace("screenshots/","")}`,alt:t.name,title:t.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},t.path))})]},x))})})(),j.commitSha&&e.jsxs("div",{className:"flex items-center gap-1.5 text-[10px]",children:[e.jsx("span",{className:"font-mono text-[#00a0c4] bg-[#00a0c4]/10 px-1.5 py-0.5 rounded",children:j.commitSha.slice(0,7)}),e.jsx("span",{className:"text-gray-500 truncate",children:j.commitMessage})]})]}),e.jsxs("button",{onClick:()=>u(R),className:"w-full py-1.5 text-[10px] text-gray-500 hover:text-gray-300 border-t border-[#3d3d3d] transition-colors cursor-pointer",children:["——— ",z?"Collapse":"Expand"," ———"]})]},R)})})]},b))})})}function F({imgSrc:a,name:s,isActive:i,onSelect:o}){return e.jsxs("button",{onClick:o,className:"flex flex-col items-center gap-1 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-24 h-24 rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${i?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:a?e.jsx("img",{src:a,alt:s,className:"w-full h-full object-contain",loading:"lazy"}):e.jsx("div",{className:"w-full h-full bg-[#1a1a1a] flex items-center justify-center",children:e.jsx("span",{className:"text-[8px] text-gray-600",children:"No img"})})}),e.jsx("span",{className:`text-[10px] leading-tight text-center truncate w-24 ${i?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function vt({filePath:a,projectRoot:s}){if(!a)return null;const o=`vscode://file/${s?`${s}/${a}`:a}`;return e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:a}),e.jsx("a",{href:o,title:"Open in editor",className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function Nt(a){if(!a||a==="/")return"Home";const i=a.split("?")[0].replace(/^\//,"").split("/")[0];return i.charAt(0).toUpperCase()+i.slice(1)}function bt({hasProject:a,scenarios:s,analyzedEntities:i,glossaryFunctions:o=[],projectRoot:g,activeScenarioId:N,onScenarioSelect:v,onAnalyzedScenarioSelect:p,onSwitchToBuild:u,zoomComponent:l,onZoomChange:f,entityImports:b}){const{pageGroups:k,componentGroups:j}=r.useMemo(()=>{const x=new Map,y=new Map;for(const d of s)if(d.componentName){const h=y.get(d.componentName)||[];h.push(d),y.set(d.componentName,h)}else{const h=Nt(d.url),S=x.get(h)||[];S.push(d),x.set(h,S)}const t=new Map([...y.entries()].sort(([d],[h])=>d.localeCompare(h)));return{pageGroups:x,componentGroups:t}},[s]),I=r.useRef(null),$=r.useRef(0),R=r.useCallback(()=>{I.current&&($.current=I.current.scrollTop)},[]);if(r.useEffect(()=>{I.current&&$.current>0&&(I.current.scrollTop=$.current)}),!a)return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Ready to build something?"}),e.jsx("button",{onClick:u,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});const z=r.useMemo(()=>i.filter(x=>x.entityType==="visual").sort((x,y)=>x.name.localeCompare(y.name)),[i]);if(!(s.length>0||z.length>0))return e.jsx("div",{className:"flex-1 flex items-center justify-center",children:e.jsxs("div",{className:"flex flex-col items-center gap-4 px-8 text-center",children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:"Your project is ready"}),e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed max-w-[280px]",children:"Describe what you want to build in the Chat and your pages and components will appear here."}),e.jsx("button",{onClick:u,className:"px-6 py-3 bg-[#005c75] text-white text-sm font-medium rounded-lg hover:bg-[#004d63] transition-colors cursor-pointer",children:"Start Building"})]})});if(l){const x=k.get(l)||[],y=j.get(l)||[],t=z.find(c=>c.name===l),d=k.has(l),h=new Set((b==null?void 0:b[l])||[]),S=h.size>0,M=S?[...j.entries()].filter(([c])=>h.has(c)):[...j.entries()],w=S?z.filter(c=>h.has(c.name)):z;return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsxs("button",{onClick:()=>f(void 0),className:"flex items-center gap-2 text-xs text-gray-400 hover:text-white transition-colors cursor-pointer bg-transparent border-none p-0",children:[e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M7.5 9L4.5 6L7.5 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),"All"]}),e.jsx("h2",{className:"text-sm font-semibold text-white m-0 font-['IBM_Plex_Sans'] uppercase tracking-wider",children:l}),x.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:x.map(c=>e.jsx(F,{imgSrc:c.screenshotPath?`/api/editor-scenario-image/${c.id}.png`:null,name:c.name,isActive:c.id===N,onSelect:()=>v(c)},c.id))}),y.length>0&&e.jsx("div",{className:"flex flex-wrap gap-2",children:y.map(c=>e.jsx(F,{imgSrc:c.screenshotPath?`/api/editor-scenario-image/${c.id}.png`:null,name:c.name,isActive:c.id===N,onSelect:()=>v(c)},c.id))}),t&&(t.scenarios.length>0||t.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2",children:[t.scenarios.map(c=>e.jsx(F,{imgSrc:c.screenshotPath?`/api/screenshot/${c.screenshotPath}`:null,name:c.name,isActive:!1,onSelect:()=>p({analysisId:t.analysisId,scenarioId:c.id,scenarioName:c.name,entitySha:t.sha,entityName:t.name})},c.id)),t.pendingScenarios.map(c=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:c,children:c},c))]}),d&&M.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),M.map(([c,P])=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>f(c),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:c})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:P.map(_=>e.jsx(F,{imgSrc:_.screenshotPath?`/api/editor-scenario-image/${_.id}.png`:null,name:_.name,isActive:_.id===N,onSelect:()=>v(_)},_.id))})]},c))]}),d&&w.length>0&&e.jsxs("div",{className:`${M.length===0?"pt-2 mt-1 border-t border-[#3d3d3d]":"mt-2"}`,children:[M.length===0&&e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),w.map(c=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>f(c.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:c.name})}),(c.scenarios.length>0||c.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[c.scenarios.map(P=>e.jsx(F,{imgSrc:P.screenshotPath?`/api/screenshot/${P.screenshotPath}`:null,name:P.name,isActive:!1,onSelect:()=>p({analysisId:c.analysisId,scenarioId:P.id,scenarioName:P.name,entitySha:c.sha,entityName:c.name})},P.id)),c.pendingScenarios.map(P=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:P,children:P},P))]})]},c.sha))]}),x.length===0&&y.length===0&&!t&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"})]})})}return e.jsx("div",{ref:I,onScroll:R,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[e.jsx("h2",{className:"text-sm font-medium text-gray-300 m-0 font-['IBM_Plex_Sans']",children:"What do you want to work on next?"}),e.jsx("button",{onClick:u,className:"w-full py-3 border-2 border-dashed border-[#4d4d4d] rounded-lg text-sm text-gray-400 hover:border-[#005c75] hover:text-white transition-colors cursor-pointer bg-transparent",children:"+ New Page"}),k.size>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),[...k.entries()].sort(([x],[y])=>x==="Home"?-1:y==="Home"?1:x.localeCompare(y)).map(([x,y])=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>f(x),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:x})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:y.map(t=>e.jsx(F,{imgSrc:t.screenshotPath?`/api/editor-scenario-image/${t.id}.png`:null,name:t.name,isActive:t.id===N,onSelect:()=>v(t)},t.id))})]},x))]}),j.size>0&&e.jsx("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),[...j.entries()].map(([x,y])=>e.jsxs("div",{children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>f(x),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:x})}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:y.map(t=>e.jsx(F,{imgSrc:t.screenshotPath?`/api/editor-scenario-image/${t.id}.png`:null,name:t.name,isActive:t.id===N,onSelect:()=>v(t)},t.id))})]},x)),z.map(x=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2 py-1",children:[e.jsx("button",{onClick:()=>f(x.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:x.name}),x.isAnalyzing&&x.scenarioCount===0&&e.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] text-gray-400",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#005c75] animate-pulse"}),"Analyzing..."]})]}),(x.scenarios.length>0||x.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[x.scenarios.map(y=>e.jsx(F,{imgSrc:y.screenshotPath?`/api/screenshot/${y.screenshotPath}`:null,name:y.name,isActive:!1,onSelect:()=>p({analysisId:x.analysisId,scenarioId:y.id,scenarioName:y.name,entitySha:x.sha,entityName:x.name})},y.id)),x.pendingScenarios.map(y=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:y,children:y},y))]})]},x.sha)),o.length>0&&e.jsxs("div",{className:"pt-2 mt-1 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"py-1",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),o.map(x=>e.jsxs("div",{className:"mt-2",children:[e.jsxs("div",{className:"flex items-center gap-2 py-1",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-300",children:x.name}),x.testFile&&e.jsx("span",{className:"text-[9px] text-green-400 bg-green-400/10 px-1.5 py-0.5 rounded",children:"tested"})]}),x.description&&e.jsx("p",{className:"text-[10px] text-gray-500 mt-0 mb-0 leading-relaxed",children:x.description}),e.jsx(vt,{filePath:x.filePath,projectRoot:g})]},x.name))]})]})})}function wt({items:a,onNavigate:s}){return a.length===0?null:e.jsx("nav",{className:"flex items-center gap-1 text-xs",children:a.map((i,o)=>{const g=o===a.length-1;return e.jsxs("span",{className:"flex items-center gap-1",children:[o>0&&e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500",children:e.jsx("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),g?e.jsx("span",{className:"text-white font-medium",children:i.name}):e.jsx("button",{onClick:()=>s(i.componentName),className:"text-gray-400 hover:text-white transition-colors cursor-pointer",children:i.name})]},i.componentName||"app")})})}function $e({scenarioId:a,name:s,isActive:i,onSelect:o}){const[g,N]=r.useState(!1);return e.jsxs("button",{onClick:o,className:"flex flex-col items-center gap-1.5 cursor-pointer group",title:s,children:[e.jsx("div",{className:`w-32 h-32 rounded-lg overflow-hidden border-2 transition-all ${i?"border-[#0ea5e9] ring-2 ring-[#0ea5e9]/40 shadow-lg shadow-[#0ea5e9]/20":"border-gray-200 hover:border-gray-400 shadow-sm"}`,children:g?e.jsx("div",{className:"w-full h-full bg-gray-100 flex items-center justify-center",children:e.jsx("span",{className:"text-[9px] text-gray-400",children:"No preview"})}):e.jsx("img",{src:`/api/editor-scenario-image/${a}.png`,alt:s,className:"w-full h-full object-contain bg-white",loading:"lazy",onError:()=>N(!0)})}),e.jsx("span",{className:`text-[11px] leading-tight text-center truncate w-32 font-medium ${i?"text-gray-900":"text-gray-600 group-hover:text-gray-900"}`,children:s})]})}function yt({filePath:a,projectRoot:s}){if(!a)return null;const o=`vscode://file/${s?`${s}/${a}`:a}`;return e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-400 truncate",children:a}),e.jsx("a",{href:o,title:"Open in editor",className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors",children:e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",children:e.jsx("path",{d:"M4.5 1.5H2.5C1.95 1.5 1.5 1.95 1.5 2.5V9.5C1.5 10.05 1.95 10.5 2.5 10.5H9.5C10.05 10.5 10.5 10.05 10.5 9.5V7.5M7.5 1.5H10.5M10.5 1.5V4.5M10.5 1.5L5 7",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})}function St({testFile:a,entityName:s}){const{results:i,isRunning:o,runTests:g}=Ee(a);if(o&&!i)return e.jsxs("div",{className:"pt-1 flex items-center gap-1.5",children:[e.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-[#0ea5e9] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-400",children:"Running tests..."})]});if(!i)return null;if(i.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-500",children:i.errorMessage})});const N=s?i.testCases.filter(p=>{const u=`${s} > `;return p.fullName.startsWith(u)||p.fullName===s}):i.testCases;if(N.length===0)return null;const v=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[N.map(p=>{var l;const u=v&&p.fullName.startsWith(v)?p.fullName.slice(v.length):p.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[p.status==="passed"?e.jsx("span",{className:"text-green-600 text-[10px]",children:"✓"}):p.status==="failed"?e.jsx("span",{className:"text-red-500 text-[10px]",children:"✗"}):e.jsx("span",{className:"text-gray-400 text-[10px]",children:"—"}),e.jsx("span",{className:`text-[10px] ${p.status==="passed"?"text-green-600":p.status==="failed"?"text-red-500":"text-gray-400"}`,children:u})]}),p.status==="failed"&&((l=p.failureMessages)==null?void 0:l.map((f,b)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:f,children:f.split(`
3
+ `)[0]},b)))]},p.fullName)}),e.jsx("button",{onClick:g,disabled:o,className:"mt-1 text-[10px] text-[#0ea5e9] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:o?"Running...":"Re-run"})]})}function Ct(a){if(!a||a==="/")return"Home";const i=a.split("?")[0].replace(/^\//,"").split("/")[0];return i.charAt(0).toUpperCase()+i.slice(1)}function kt({scenarios:a,glossaryFunctions:s=[],projectRoot:i,activeScenarioId:o,onScenarioSelect:g,onClose:N}){const{pageGroups:v,componentGroups:p}=r.useMemo(()=>{const u=new Map,l=new Map;for(const b of a)if(b.componentName){const k=l.get(b.componentName)||[];k.push(b),l.set(b.componentName,k)}else{const k=Ct(b.url),j=u.get(k)||[];j.push(b),u.set(k,j)}const f=new Map([...l.entries()].sort(([b],[k])=>b.localeCompare(k)));return{pageGroups:u,componentGroups:f}},[a]);return a.length===0&&s.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:N,className:"absolute top-2 right-3 text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none",title:"Close results",children:"×"}),e.jsx("span",{className:"text-sm text-gray-400",children:"No scenarios registered yet"})]}):e.jsxs("div",{className:"h-full bg-white flex flex-col overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 border-b border-gray-200 shrink-0",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Working Session Results"}),e.jsx("button",{onClick:N,className:"text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none",title:"Close results",children:"×"})]}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsxs("div",{className:"space-y-5",children:[v.size>0&&e.jsxs("div",{children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"})}),e.jsx("div",{className:"space-y-3 pl-1",children:[...v.entries()].sort(([u],[l])=>u==="Home"?-1:l==="Home"?1:u.localeCompare(l)).map(([u,l])=>e.jsxs("div",{children:[e.jsx("div",{className:"mb-1.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:u})}),e.jsx("div",{className:"flex flex-wrap gap-3",children:l.map(f=>e.jsx($e,{scenarioId:f.id,name:f.name,isActive:f.id===o,onSelect:()=>g(f)},f.id))})]},u))})]}),p.size>0&&e.jsxs("div",{className:v.size>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"})}),e.jsx("div",{className:"space-y-3 pl-1",children:[...p.entries()].map(([u,l])=>e.jsxs("div",{children:[e.jsx("div",{className:"mb-1.5",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:u})}),e.jsx("div",{className:"flex flex-wrap gap-3",children:l.map(f=>e.jsx($e,{scenarioId:f.id,name:f.name,isActive:f.id===o,onSelect:()=>g(f)},f.id))})]},u))})]}),s.length>0&&e.jsxs("div",{className:a.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"})}),e.jsx("div",{className:"space-y-2 pl-1",children:s.map(u=>e.jsxs("div",{children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-[11px] font-medium text-gray-700",children:u.name})}),e.jsx(yt,{filePath:u.filePath,projectRoot:i}),u.testFile?e.jsx(St,{testFile:u.testFile,entityName:u.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-400",children:"No test file"})})]},u.name))})]})]})})]})}function K(a){return a.replace(/[^a-zA-Z0-9_]+/g,"_")}function Pt(a){const{activeAnalyzedScenario:s,analyzedPreviewUrl:i,activeScenarioId:o,scenarios:g,proxyUrl:N,devServerUrl:v,zoomComponent:p}=a;if(s&&i)return i;if(s&&!i)return null;if(o){const l=g.find(f=>f.id===o);if(l!=null&&l.url){const f=N||v;return f?l.url.startsWith("/")?`${f}${l.url}`:l.url:null}}const u=N||v;if(!u)return null;if(p&&o){const l=g.find(b=>b.id===o),f=l?K(l.name):"Default";return`${u}/__codeyam__/${p}/${f}`}return u}function Mt(a,s){const i=s.width,o=s.height??900,g=a.width,N=a.height;return i<=g&&o<=N?1:Math.min(g/i,N/o)}const Bt=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}],he=[{name:"Mobile",width:375,height:667},{name:"Tablet",width:768,height:1024},{name:"Laptop",width:1024,height:768},{name:"Desktop",width:1440,height:900}];function $t({analysisId:a,scenarioId:s,scenarioName:i,entityName:o,projectSlug:g,onStateChange:N}){const{interactiveServerUrl:v,isStarting:p,isLoading:u}=dt({analysisId:a,scenarioId:s,scenarioName:i,entityName:o,projectSlug:g,enabled:!0});return r.useEffect(()=>{N(v,p||u)},[v,p,u,N]),null}const _t=et(function(){const{projectSlug:s,projectRoot:i,hasProject:o,scenarios:g,analyzedEntities:N,glossaryFunctions:v,entityImports:p}=tt(),u=st(),[l,f]=at(),b=r.useRef(null),k=r.useRef(null),j=r.useRef(null),I=l.get("zoom")||void 0,$=l.get("scenario")||void 0;r.useEffect(()=>{if(!$)return;const n=g.find(C=>C.id===$);if(!n)return;const m=K(n.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:m,scenarioId:n.id})}).catch(()=>{})},[$,g]),r.useEffect(()=>{const n=new BroadcastChannel("codeyam-editor");return n.onmessage=m=>{var C;if(((C=m.data)==null?void 0:C.type)==="switch-scenario"&&m.data.scenarioId){const E=m.data.scenarioId,A=g.find(xe=>xe.id===E);if(!A)return;const Z=new URLSearchParams(l);Z.set("scenario",E),Z.delete("zoom"),f(Z),_(null),q(null),O(null);const Ze=K(A.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:Ze,scenarioId:E})}).then(()=>{G(xe=>xe+1),M(!1)}).catch(()=>{})}},()=>n.close()},[l,f,g]),r.useEffect(()=>{if(l.get("ref")!=="link"||!$)return;const n=new BroadcastChannel("codeyam-editor");n.postMessage({type:"switch-scenario",scenarioId:$}),n.close(),window.close()},[]);const[R,z]=r.useState(null),[B,x]=r.useState(null),[y,t]=r.useState(!1),[d,h]=r.useState(null),[S,M]=r.useState(!1),[w,c]=r.useState(!0),[P,_]=r.useState(null),[pe,q]=r.useState(null),[ee,ue]=r.useState(!1),[D,O]=r.useState(null),[fe,ge]=r.useState(!1),[je,Q]=r.useState(null),Ie=r.useCallback(n=>{O(n),Q(null)},[]),Le=r.useCallback((n,m)=>{q(C=>(n&&n!==C&&M(!1),n)),!m&&n&&M(!0),ue(m)},[]),ve=r.useCallback(n=>{O(null),_(C=>(C&&C.analysisId===n.analysisId||(q(null),G(A=>A+1)),n)),ue(!0),M(!1);const m=new URLSearchParams(l);m.delete("scenario"),m.delete("zoom"),f(m)},[l,f]),[Te,Ne]=r.useState(1440),[L,te]=r.useState({name:"Desktop",width:1440,height:900}),[Re,se]=r.useState(!1),[ae,ze]=r.useState(null),[T,H]=r.useState("app"),Ae=r.useCallback(()=>{H("build"),re(!0)},[]),[Be,re]=r.useState(!1),[_e,be]=r.useState(!1),De=r.useCallback(n=>{be(n)},[]),[ne,we]=r.useState(!1),Ue=r.useCallback(()=>{we(!0),H("build"),re(!0)},[]),ye=r.useCallback(()=>{we(!1)},[]),[W,ie]=r.useState(!1),Fe=r.useCallback(()=>{if(W){ie(!1);return}typeof Notification<"u"&&Notification.permission==="default"?Notification.requestPermission().then(n=>{n==="granted"&&ie(!0)}):ie(!0)},[W]);r.useEffect(()=>{if(T==="build"){be(!1);const n=setTimeout(()=>{var m,C;(m=b.current)==null||m.scrollToBottom(),(C=b.current)==null||C.focus()},50);return()=>clearTimeout(n)}},[T]);const[le,Oe]=r.useState(null);r.useEffect(()=>{const n=j.current;if(!n)return;const m=new ResizeObserver(C=>{const E=C[0];E&&Oe({width:E.contentRect.width,height:E.contentRect.height})});return m.observe(n),()=>m.disconnect()},[]);const J=r.useMemo(()=>le?Mt(le,L):1,[le,L]),[He,G]=r.useState(0),[oe,Se]=r.useState(null),We=r.useCallback(n=>{Se(n||null),G(m=>m+1)},[]),{customSizes:Ce,addCustomSize:Je}=rt(s),X=r.useMemo(()=>[...he,...Ce],[Ce]),ke=r.useRef(!1);r.useEffect(()=>{let n=!1,m=null;const C=async()=>{try{const E=await fetch("/api/editor-dev-server");if(n)return;const A=await E.json();if(A.status==="error")z(null),x(null),t(!1),h(A.errorMessage||"Dev server crashed");else if(A.url)z(A.url),x(A.proxyUrl||null),t(!1),h(null),c(!0);else if(A.status==="starting")t(!0),h(null),c(!0);else if(A.status==="stopped")if(R)z(null),t(!1);else if(ke.current)t(!1);else{ke.current=!0;try{(await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})})).ok?t(!0):c(!1)}catch{}}}catch{}};return C(),m=setInterval(()=>void C(),2e3),()=>{n=!0,m&&clearInterval(m)}},[R]),r.useEffect(()=>{const n=new EventSource("/api/events");let m=null;return n.addEventListener("message",C=>{try{const E=JSON.parse(C.data);(E.type==="db-change"||E.type==="unknown")&&(m&&clearTimeout(m),m=setTimeout(()=>{u.revalidate()},2e3))}catch{}}),()=>{m&&clearTimeout(m),n.close()}},[u]);const Ve=r.useMemo(()=>{const n=[{name:"App"}];return I&&n.push({name:I,componentName:I}),n},[I]),ce=r.useCallback(n=>{const m=new URLSearchParams(l);if(n){m.set("zoom",n);const C=g.find(E=>E.componentName===n||E.componentName===null&&n==="Home");if(C){m.set("scenario",C.id);const E=K(C.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:E,scenarioId:C.id})}).catch(()=>{}),G(A=>A+1),M(!1)}else m.delete("scenario")}else m.delete("zoom"),m.delete("scenario");f(m)},[l,f,g]),de=r.useCallback(n=>{_(null),q(null),O(null);const m=new URLSearchParams(l);m.set("scenario",n.id),f(m);const C=K(n.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:C,scenarioId:n.id})}).catch(()=>{}),G(E=>E+1),M(!1)},[l,f]),Ge=(n,m)=>{Ne(n);const C=X.find(E=>E.width===n&&E.height===m);te({name:(C==null?void 0:C.name)||"Custom",width:n,height:m})},Pe=n=>{Ne(n.width),te({name:n.name,width:n.width,height:n.height})},Ye=n=>{Je(n,L.width,L.height??900),se(!1),te(m=>({...m,name:n}))},Ke=()=>{P||M(!0)},qe=r.useCallback(()=>{h(null),t(!0),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).catch(()=>{})},[]),Qe=r.useCallback(()=>{h(null),t(!0),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})}).catch(()=>{})},[]),U=r.useMemo(()=>Pt({activeAnalyzedScenario:!!P,analyzedPreviewUrl:pe,activeScenarioId:$||null,scenarios:g,proxyUrl:B,devServerUrl:R,zoomComponent:I||null}),[B,R,I,$,g,P,pe]),Xe=r.useMemo(()=>{if(!U||!oe)return U;try{const n=new URL(U);return n.pathname=oe,n.href}catch{return U}},[U,oe]);return e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[P&&e.jsx($t,{analysisId:P.analysisId,scenarioId:P.scenarioId,scenarioName:P.scenarioName,entityName:P.entityName,projectSlug:s,onStateChange:Le},P.analysisId),e.jsx("div",{className:"bg-[#3d3d3d] h-12 flex items-center px-4 gap-4 shrink-0 z-20",children:e.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[e.jsx("img",{src:ct,alt:"CodeYam",className:"h-6 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-sm whitespace-nowrap",children:"Editor"}),I&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"w-px h-4 bg-gray-600"}),e.jsx(wt,{items:Ve,onNavigate:ce})]}),e.jsx("span",{className:"bg-[#005c75] text-white text-[10px] font-bold px-2 py-0.5 rounded uppercase tracking-wider ml-auto",children:"Code + Data"})]})}),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",children:[e.jsxs("div",{className:"bg-[#e5e7eb] border-b border-[rgba(0,0,0,0.1)] shrink-0 z-10 h-6 flex items-center justify-center relative",children:[e.jsx("div",{className:"absolute inset-0 flex justify-center",children:e.jsx("div",{style:{maxWidth:`${he[he.length-1].width}px`,width:"100%"},children:e.jsx(nt,{currentViewportWidth:Te,currentPresetName:L.name,onDevicePresetClick:Pe,devicePresets:X,hideLabel:!0,onHoverChange:ze,lightMode:!0})})}),e.jsxs("div",{className:"relative z-10 flex items-center gap-2",children:[e.jsxs("div",{className:"relative w-28 h-5",children:[e.jsxs("div",{className:"absolute inset-0 bg-white text-gray-900 text-xs px-2 rounded flex items-center justify-between pointer-events-none border border-gray-300",children:[e.jsx("span",{className:"leading-none",children:(ae==null?void 0:ae.name)||L.name}),e.jsx("svg",{width:"10",height:"10",viewBox:"0 0 12 12",fill:"none",className:"shrink-0",children:e.jsx("path",{d:"M3 4.5L6 7.5L9 4.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})]}),e.jsxs("select",{value:L.name,onChange:n=>{const m=X.find(C=>C.name===n.target.value);m&&Pe(m)},className:"relative w-full h-full opacity-0 cursor-pointer",children:[X.map(n=>e.jsx("option",{value:n.name,children:n.name},n.name)),L.name==="Custom"&&e.jsx("option",{value:"Custom",children:"Custom"})]})]}),e.jsx("input",{type:"number",value:L.width,onChange:n=>{const m=parseInt(n.target.value,10);!isNaN(m)&&m>0&&Ge(m,L.height??900)},className:"bg-white text-gray-900 text-xs px-1 rounded border border-gray-300 outline-none w-16 text-center h-5 leading-none",min:"200",max:"3840"}),e.jsx("span",{className:"text-gray-400 text-xs h-5 flex items-center leading-none",children:"x"}),e.jsx("span",{className:"bg-gray-100 text-gray-600 text-xs px-1 rounded w-14 text-center h-5 flex items-center justify-center leading-none",children:L.height??900}),L.name==="Custom"&&e.jsx("button",{onClick:()=>se(!0),className:"bg-white text-gray-900 text-xs px-2 rounded h-5 flex items-center leading-none border border-gray-300 hover:bg-gray-50 transition-colors",children:"Save"})]})]}),e.jsx("div",{ref:j,className:"flex-1 flex items-center justify-center overflow-hidden p-8",style:{backgroundImage:`
4
+ linear-gradient(45deg, #ebebeb 25%, transparent 25%),
5
+ linear-gradient(-45deg, #ebebeb 25%, transparent 25%),
6
+ linear-gradient(45deg, transparent 75%, #ebebeb 75%),
7
+ linear-gradient(-45deg, transparent 75%, #ebebeb 75%)
8
+ `,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:"#fafafa"},children:D?e.jsxs("div",{className:"flex flex-col items-center gap-6 max-w-[700px] w-full",children:[e.jsxs("div",{className:"text-center",children:[e.jsx("h2",{className:"text-lg font-semibold text-[#333] m-0 font-['IBM_Plex_Sans']",children:"Journal Screenshot"}),e.jsx("p",{className:"text-sm text-[#888] mt-1 m-0 font-['IBM_Plex_Sans']",children:"This is a snapshot from a previous version — not a live preview"})]}),e.jsx("div",{className:"rounded-lg overflow-hidden border-2 border-[#ccc] shadow-md max-w-full w-fit",children:e.jsx("img",{src:D.screenshotUrl,alt:D.scenarioName,className:"max-w-full h-auto block"})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[D.commitSha&&e.jsx("span",{className:"font-mono text-xs text-[#00a0c4] bg-[#00a0c4]/15 px-2 py-0.5 rounded",children:D.commitSha.slice(0,7)}),e.jsxs("span",{className:"truncate",children:[D.scenarioName,D.commitMessage&&` — ${D.commitMessage}`]})]}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{onClick:()=>O(null),className:"text-sm text-[#888] hover:text-[#333] transition-colors cursor-pointer px-3 py-1.5 rounded border border-[#ccc] hover:border-[#999] bg-white",children:"Back to live preview"}),D.commitSha&&e.jsx("button",{onClick:()=>{ge(!0),Q(null),fetch("/api/editor-load-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitSha:D.commitSha})}).then(n=>n.json()).then(n=>{n.success?(O(null),t(!0),M(!1)):Q(n.error||"Failed to load commit")}).catch(n=>{Q(n instanceof Error?n.message:"Network error")}).finally(()=>{ge(!1)})},disabled:fe,className:"bg-[#005c75] hover:bg-[#004d63] disabled:opacity-50 text-white text-sm font-medium px-4 py-1.5 rounded transition-colors cursor-pointer",children:fe?"Loading...":"Load this version"})]}),je&&e.jsx("div",{className:"bg-red-50 border border-red-200 rounded px-4 py-2 text-sm text-red-600 w-full text-center",children:je})]}):U?e.jsx("div",{style:{width:`${L.width*J}px`,height:`${(L.height??900)*J}px`},children:e.jsxs("div",{className:"relative bg-white origin-top-left",style:{width:`${L.width}px`,height:`${L.height??900}px`,transform:J<1?`scale(${J})`:void 0},children:[!S&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-10",children:e.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 bg-white rounded-lg p-8 shadow-sm w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx(Me,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Loading Preview"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Waiting for the app to render"})]})]})}),e.jsx("iframe",{ref:k,src:Xe||U,className:"w-full h-full border-none",title:"Editor preview",onLoad:Ke,style:{opacity:S?1:0}},He)]})}):e.jsx("div",{className:"bg-white rounded-lg shadow-sm flex flex-col items-center justify-center",style:{width:`${L.width*J}px`,height:`${(L.height??900)*J}px`},children:d?e.jsxs("div",{className:"flex flex-col gap-4 text-center px-8 max-w-[600px]",children:[e.jsx("h2",{className:"text-xl font-medium text-red-600 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Dev Server Failed"}),e.jsx("pre",{className:"text-xs text-left bg-gray-100 text-gray-800 p-4 rounded overflow-auto max-h-[300px] w-full font-mono whitespace-pre-wrap",children:d}),e.jsx("button",{onClick:qe,className:"mx-auto px-4 py-2 bg-[#005c75] text-white text-sm font-medium rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Retry"})]}):y||ee?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(Me,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:ee?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-[#666] leading-5 m-0 font-['IBM_Plex_Sans']",children:ee?"Loading component preview...":"Your dev server is starting up..."})]})]}):e.jsxs("div",{className:"flex flex-col gap-3 text-center px-8",children:[e.jsx("h2",{className:"text-xl font-medium text-black leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Code + Data Editor"}),e.jsx("p",{className:"text-sm text-[#888] leading-5 m-0 font-['IBM_Plex_Sans']",children:"Describe what you want to build in the chat"})]})})})]}),e.jsxs("aside",{className:"w-[50%] min-w-[400px] max-w-[800px] bg-[#1e1e1e] border-r border-[#3d3d3d] shrink-0 flex flex-col overflow-hidden order-first",children:[e.jsxs("div",{className:"border-b border-[#3d3d3d] px-4 shrink-0 flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-0",children:[e.jsxs("button",{onClick:()=>H("app"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="app"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["App",T==="app"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>{H("build"),re(!0)},className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="build"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Build",_e&&T!=="build"&&e.jsx("span",{className:"ml-1.5 inline-block w-2 h-2 rounded-full bg-amber-400 animate-pulse"}),T==="build"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>H("data"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="data"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Data",T==="data"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]}),e.jsxs("button",{onClick:()=>H("journal"),className:`px-3 py-2 text-xs font-medium transition-colors relative cursor-pointer ${T==="journal"?"text-white":"text-gray-500 hover:text-gray-300"}`,children:["Journal",T==="journal"&&e.jsx("span",{className:"absolute bottom-0 left-3 right-3 h-0.5 bg-[#005c75]"})]})]}),typeof Notification<"u"&&e.jsx("button",{onClick:Fe,className:`px-2 py-1 text-[10px] rounded transition-colors cursor-pointer ${W?"text-green-400 hover:text-green-300":"text-gray-500 hover:text-gray-300"}`,title:W?"Click to turn off notifications":"Click to get notified when Claude finishes",children:W?"Notifications On":"Notifications Off"})]}),e.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[Be&&e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="build"?"visible":"hidden"},children:[e.jsx("div",{className:ne?"flex-1 min-h-0":"flex-1",style:ne?{flex:"1 1 50%"}:void 0,children:e.jsx(lt,{ref:b,entityName:"Editor",projectSlug:s,entityFilePath:null,scenarioName:null,onRefreshPreview:We,onShowResults:Ue,onHideResults:ye,editorMode:!0,onIdleChange:De,notificationsEnabled:W})}),ne&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx(kt,{scenarios:g,glossaryFunctions:v,projectRoot:i,activeScenarioId:$,onScenarioSelect:de,onClose:ye})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="app"?"visible":"hidden"},children:e.jsx(bt,{hasProject:o,scenarios:g,analyzedEntities:[],glossaryFunctions:v,projectRoot:i,activeScenarioId:$,onScenarioSelect:de,onAnalyzedScenarioSelect:ve,onSwitchToBuild:Ae,zoomComponent:I,onZoomChange:ce,entityImports:p})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="data"?"visible":"hidden"},children:e.jsx(mt,{scenarios:g,projectRoot:i,activeScenarioId:$,onScenarioSelect:de,zoomComponent:I,onZoomChange:ce,analyzedEntities:[],glossaryFunctions:v,activeAnalyzedScenarioId:P==null?void 0:P.scenarioId,onAnalyzedScenarioSelect:ve,entityImports:p})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:T==="journal"?"visible":"hidden"},children:e.jsx(jt,{isActive:T==="journal",onScreenshotClick:Ie})})]})]})]}),e.jsx(ot,{serverUrl:R,isStarting:y,projectSlug:s,devServerError:d,onStartServer:w?Qe:void 0}),Re&&e.jsx(it,{width:L.width,height:L.height??900,onSave:Ye,onCancel:()=>se(!1)})]})});export{_t as default,Bt as meta};