@codeyam/codeyam-cli 0.1.0-staging.c1c8678 → 0.1.0-staging.c276166

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 (667) 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 +22 -22
  4. package/analyzer-template/packages/ai/package.json +2 -2
  5. package/analyzer-template/packages/ai/src/lib/astScopes/astScopeAnalyzer.ts +34 -3
  6. package/analyzer-template/packages/ai/src/lib/completionCall.ts +114 -113
  7. package/analyzer-template/packages/ai/src/lib/dataStructure/ScopeDataStructure.ts +259 -5
  8. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.ts +62 -0
  9. package/analyzer-template/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.ts +35 -0
  10. package/analyzer-template/packages/ai/src/lib/dataStructureChunking.ts +15 -6
  11. package/analyzer-template/packages/ai/src/lib/generateEntityScenarioData.ts +78 -2
  12. package/analyzer-template/packages/ai/src/lib/generateExecutionFlows.ts +96 -33
  13. package/analyzer-template/packages/analyze/src/lib/ProjectAnalyzer.ts +19 -7
  14. package/analyzer-template/packages/analyze/src/lib/asts/index.ts +7 -2
  15. package/analyzer-template/packages/analyze/src/lib/asts/nodes/getNodeType.ts +1 -0
  16. package/analyzer-template/packages/analyze/src/lib/files/analyze/analyzeEntities.ts +9 -1
  17. package/analyzer-template/packages/analyze/src/lib/files/analyze/dependencyResolver.ts +0 -6
  18. package/analyzer-template/packages/analyze/src/lib/files/analyze/findOrCreateEntity.ts +12 -0
  19. package/analyzer-template/packages/analyze/src/lib/files/scenarios/TransformationTracer.ts +65 -28
  20. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateDataStructure.ts +83 -0
  21. package/analyzer-template/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.ts +0 -98
  22. package/analyzer-template/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.ts +23 -4
  23. package/analyzer-template/packages/aws/package.json +10 -10
  24. package/analyzer-template/packages/database/index.ts +1 -0
  25. package/analyzer-template/packages/database/package.json +3 -3
  26. package/analyzer-template/packages/database/src/lib/kysely/db.ts +8 -0
  27. package/analyzer-template/packages/database/src/lib/kysely/tables/editorScenariosTable.ts +138 -0
  28. package/analyzer-template/packages/database/src/lib/loadCommits.ts +31 -20
  29. package/analyzer-template/packages/database/src/lib/loadEntities.ts +0 -6
  30. package/analyzer-template/packages/database/src/lib/loadReadyToBeCapturedAnalyses.ts +0 -5
  31. package/analyzer-template/packages/database/src/lib/updateCommitMetadata.ts +94 -143
  32. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatus.ts +58 -42
  33. package/analyzer-template/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.ts +81 -65
  34. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.ts +29 -1
  35. package/analyzer-template/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.ts +33 -5
  36. package/analyzer-template/packages/github/dist/database/index.d.ts +1 -0
  37. package/analyzer-template/packages/github/dist/database/index.d.ts.map +1 -1
  38. package/analyzer-template/packages/github/dist/database/index.js +1 -0
  39. package/analyzer-template/packages/github/dist/database/index.js.map +1 -1
  40. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts +2 -0
  41. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.d.ts.map +1 -1
  42. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js +5 -0
  43. package/analyzer-template/packages/github/dist/database/src/lib/kysely/db.js.map +1 -1
  44. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts +27 -0
  45. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.d.ts.map +1 -0
  46. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js +121 -0
  47. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  48. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts +5 -0
  49. package/analyzer-template/packages/github/dist/database/src/lib/kysely/tables/scenariosTable.d.ts.map +1 -1
  50. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.d.ts.map +1 -1
  51. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js +23 -13
  52. package/analyzer-template/packages/github/dist/database/src/lib/loadCommits.js.map +1 -1
  53. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.d.ts.map +1 -1
  54. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js +0 -6
  55. package/analyzer-template/packages/github/dist/database/src/lib/loadEntities.js.map +1 -1
  56. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.d.ts.map +1 -1
  57. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  58. package/analyzer-template/packages/github/dist/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  59. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.d.ts.map +1 -1
  60. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js +76 -90
  61. package/analyzer-template/packages/github/dist/database/src/lib/updateCommitMetadata.js.map +1 -1
  62. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.d.ts.map +1 -1
  63. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  64. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  65. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.d.ts.map +1 -1
  66. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  67. package/analyzer-template/packages/github/dist/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  68. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.d.ts.map +1 -1
  69. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  70. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  71. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.d.ts.map +1 -1
  72. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  73. package/analyzer-template/packages/github/dist/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  74. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  75. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  76. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js +2 -0
  77. package/analyzer-template/packages/github/dist/types/src/enums/ProjectFramework.js.map +1 -1
  78. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  79. package/analyzer-template/packages/github/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  80. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts +10 -0
  81. package/analyzer-template/packages/github/dist/types/src/types/Scenario.d.ts.map +1 -1
  82. package/analyzer-template/packages/github/package.json +1 -1
  83. package/analyzer-template/packages/types/src/enums/ProjectFramework.ts +2 -0
  84. package/analyzer-template/packages/types/src/types/ProjectMetadata.ts +1 -0
  85. package/analyzer-template/packages/types/src/types/Scenario.ts +10 -0
  86. package/analyzer-template/packages/ui-components/package.json +1 -1
  87. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts +2 -0
  88. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.d.ts.map +1 -1
  89. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js +2 -0
  90. package/analyzer-template/packages/utils/dist/types/src/enums/ProjectFramework.js.map +1 -1
  91. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts +1 -0
  92. package/analyzer-template/packages/utils/dist/types/src/types/ProjectMetadata.d.ts.map +1 -1
  93. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts +10 -0
  94. package/analyzer-template/packages/utils/dist/types/src/types/Scenario.d.ts.map +1 -1
  95. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.d.ts.map +1 -1
  96. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js +6 -2
  97. package/analyzer-template/packages/utils/dist/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  98. package/analyzer-template/packages/utils/src/lib/fs/rsyncCopy.ts +14 -2
  99. package/analyzer-template/playwright/captureFromUrl.ts +89 -82
  100. package/analyzer-template/project/constructMockCode.ts +168 -48
  101. package/analyzer-template/project/orchestrateCapture.ts +4 -1
  102. package/analyzer-template/project/reconcileMockDataKeys.ts +19 -14
  103. package/analyzer-template/project/start.ts +3 -0
  104. package/analyzer-template/project/startScenarioCapture.ts +9 -0
  105. package/analyzer-template/project/writeClientLogRoute.ts +125 -0
  106. package/analyzer-template/project/writeMockDataTsx.ts +17 -0
  107. package/analyzer-template/project/writeScenarioComponents.ts +110 -17
  108. package/analyzer-template/tsconfig.json +13 -1
  109. package/background/src/lib/virtualized/project/constructMockCode.js +143 -39
  110. package/background/src/lib/virtualized/project/constructMockCode.js.map +1 -1
  111. package/background/src/lib/virtualized/project/orchestrateCapture.js +4 -1
  112. package/background/src/lib/virtualized/project/orchestrateCapture.js.map +1 -1
  113. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js +17 -11
  114. package/background/src/lib/virtualized/project/reconcileMockDataKeys.js.map +1 -1
  115. package/background/src/lib/virtualized/project/start.js +2 -0
  116. package/background/src/lib/virtualized/project/start.js.map +1 -1
  117. package/background/src/lib/virtualized/project/startScenarioCapture.js +5 -0
  118. package/background/src/lib/virtualized/project/startScenarioCapture.js.map +1 -1
  119. package/background/src/lib/virtualized/project/writeClientLogRoute.js +110 -0
  120. package/background/src/lib/virtualized/project/writeClientLogRoute.js.map +1 -0
  121. package/background/src/lib/virtualized/project/writeMockDataTsx.js +12 -0
  122. package/background/src/lib/virtualized/project/writeMockDataTsx.js.map +1 -1
  123. package/background/src/lib/virtualized/project/writeScenarioComponents.js +83 -12
  124. package/background/src/lib/virtualized/project/writeScenarioComponents.js.map +1 -1
  125. package/codeyam-cli/scripts/apply-setup.js +208 -11
  126. package/codeyam-cli/scripts/apply-setup.js.map +1 -1
  127. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js +196 -0
  128. package/codeyam-cli/src/__tests__/memory-scripts/filter-session.test.js.map +1 -0
  129. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js +114 -0
  130. package/codeyam-cli/src/__tests__/memory-scripts/read-json-field.test.js.map +1 -0
  131. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js +149 -0
  132. package/codeyam-cli/src/__tests__/memory-scripts/ripgrep-fallback.test.js.map +1 -0
  133. package/codeyam-cli/src/cli.js +32 -25
  134. package/codeyam-cli/src/cli.js.map +1 -1
  135. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js +45 -0
  136. package/codeyam-cli/src/commands/__tests__/editor.stepDispatch.test.js.map +1 -0
  137. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js +101 -47
  138. package/codeyam-cli/src/commands/__tests__/init.gitignore.test.js.map +1 -1
  139. package/codeyam-cli/src/commands/analyze.js +17 -7
  140. package/codeyam-cli/src/commands/analyze.js.map +1 -1
  141. package/codeyam-cli/src/commands/default.js +14 -2
  142. package/codeyam-cli/src/commands/default.js.map +1 -1
  143. package/codeyam-cli/src/commands/editor.js +3374 -0
  144. package/codeyam-cli/src/commands/editor.js.map +1 -0
  145. package/codeyam-cli/src/commands/init.js +107 -45
  146. package/codeyam-cli/src/commands/init.js.map +1 -1
  147. package/codeyam-cli/src/commands/memory.js +89 -75
  148. package/codeyam-cli/src/commands/memory.js.map +1 -1
  149. package/codeyam-cli/src/data/techStacks.js +77 -0
  150. package/codeyam-cli/src/data/techStacks.js.map +1 -0
  151. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js +173 -0
  152. package/codeyam-cli/src/utils/__tests__/analyzerFinalization.test.js.map +1 -0
  153. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js +46 -0
  154. package/codeyam-cli/src/utils/__tests__/backgroundServer.test.js.map +1 -0
  155. package/codeyam-cli/src/utils/__tests__/devServerState.test.js +134 -0
  156. package/codeyam-cli/src/utils/__tests__/devServerState.test.js.map +1 -0
  157. package/codeyam-cli/src/utils/__tests__/editorApi.test.js +127 -0
  158. package/codeyam-cli/src/utils/__tests__/editorApi.test.js.map +1 -0
  159. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js +855 -0
  160. package/codeyam-cli/src/utils/__tests__/editorAudit.test.js.map +1 -0
  161. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js +93 -0
  162. package/codeyam-cli/src/utils/__tests__/editorCapture.test.js.map +1 -0
  163. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js +304 -0
  164. package/codeyam-cli/src/utils/__tests__/editorDevServer.test.js.map +1 -0
  165. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js +121 -0
  166. package/codeyam-cli/src/utils/__tests__/editorEntityChangeStatus.test.js.map +1 -0
  167. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js +294 -0
  168. package/codeyam-cli/src/utils/__tests__/editorImageVerifier.test.js.map +1 -0
  169. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js +542 -0
  170. package/codeyam-cli/src/utils/__tests__/editorJournal.test.js.map +1 -0
  171. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js +520 -0
  172. package/codeyam-cli/src/utils/__tests__/editorLoaderHelpers.test.js.map +1 -0
  173. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js +270 -0
  174. package/codeyam-cli/src/utils/__tests__/editorMockState.test.js.map +1 -0
  175. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js +217 -0
  176. package/codeyam-cli/src/utils/__tests__/editorPreloadHelpers.test.js.map +1 -0
  177. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js +353 -0
  178. package/codeyam-cli/src/utils/__tests__/editorPreview.test.js.map +1 -0
  179. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js +153 -0
  180. package/codeyam-cli/src/utils/__tests__/editorProxySession.test.js.map +1 -0
  181. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js +139 -0
  182. package/codeyam-cli/src/utils/__tests__/editorScenarioLookup.test.js.map +1 -0
  183. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js +221 -0
  184. package/codeyam-cli/src/utils/__tests__/editorScenarioSwitch.test.js.map +1 -0
  185. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js +1029 -0
  186. package/codeyam-cli/src/utils/__tests__/editorScenarios.test.js.map +1 -0
  187. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js +213 -0
  188. package/codeyam-cli/src/utils/__tests__/editorSeedAdapter.test.js.map +1 -0
  189. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js +1742 -0
  190. package/codeyam-cli/src/utils/__tests__/entityChangeStatus.test.js.map +1 -0
  191. package/codeyam-cli/src/utils/__tests__/git.editor.test.js +134 -0
  192. package/codeyam-cli/src/utils/__tests__/git.editor.test.js.map +1 -0
  193. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js +107 -0
  194. package/codeyam-cli/src/utils/__tests__/journalCaptureStabilization.test.js.map +1 -0
  195. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js +185 -0
  196. package/codeyam-cli/src/utils/__tests__/npmVersionCheck.test.js.map +1 -0
  197. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js +129 -0
  198. package/codeyam-cli/src/utils/__tests__/parseRegisterArg.test.js.map +1 -0
  199. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js +9 -0
  200. package/codeyam-cli/src/utils/__tests__/pathIgnoring.test.js.map +1 -1
  201. package/codeyam-cli/src/utils/__tests__/project.test.js +65 -0
  202. package/codeyam-cli/src/utils/__tests__/project.test.js.map +1 -0
  203. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js +227 -0
  204. package/codeyam-cli/src/utils/__tests__/scenarioCoverage.test.js.map +1 -0
  205. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js +121 -0
  206. package/codeyam-cli/src/utils/__tests__/scenarioMarkers.test.js.map +1 -0
  207. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js +454 -0
  208. package/codeyam-cli/src/utils/__tests__/scenariosManifest.test.js.map +1 -0
  209. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js +50 -4
  210. package/codeyam-cli/src/utils/__tests__/setupClaudeCodeSettings.test.js.map +1 -1
  211. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js +51 -0
  212. package/codeyam-cli/src/utils/__tests__/templateConsistency.test.js.map +1 -0
  213. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js +142 -0
  214. package/codeyam-cli/src/utils/__tests__/webappDetection.test.js.map +1 -0
  215. package/codeyam-cli/src/utils/analyzer.js +9 -0
  216. package/codeyam-cli/src/utils/analyzer.js.map +1 -1
  217. package/codeyam-cli/src/utils/analyzerFinalization.js +100 -0
  218. package/codeyam-cli/src/utils/analyzerFinalization.js.map +1 -0
  219. package/codeyam-cli/src/utils/backgroundServer.js +104 -22
  220. package/codeyam-cli/src/utils/backgroundServer.js.map +1 -1
  221. package/codeyam-cli/src/utils/buildFlags.js +4 -0
  222. package/codeyam-cli/src/utils/buildFlags.js.map +1 -0
  223. package/codeyam-cli/src/utils/database.js +37 -2
  224. package/codeyam-cli/src/utils/database.js.map +1 -1
  225. package/codeyam-cli/src/utils/devModeEvents.js +40 -0
  226. package/codeyam-cli/src/utils/devModeEvents.js.map +1 -0
  227. package/codeyam-cli/src/utils/devServerState.js +71 -0
  228. package/codeyam-cli/src/utils/devServerState.js.map +1 -0
  229. package/codeyam-cli/src/utils/editorApi.js +73 -0
  230. package/codeyam-cli/src/utils/editorApi.js.map +1 -0
  231. package/codeyam-cli/src/utils/editorAudit.js +176 -0
  232. package/codeyam-cli/src/utils/editorAudit.js.map +1 -0
  233. package/codeyam-cli/src/utils/editorCapture.js +102 -0
  234. package/codeyam-cli/src/utils/editorCapture.js.map +1 -0
  235. package/codeyam-cli/src/utils/editorDevServer.js +197 -0
  236. package/codeyam-cli/src/utils/editorDevServer.js.map +1 -0
  237. package/codeyam-cli/src/utils/editorEntityChangeStatus.js +44 -0
  238. package/codeyam-cli/src/utils/editorEntityChangeStatus.js.map +1 -0
  239. package/codeyam-cli/src/utils/editorImageVerifier.js +155 -0
  240. package/codeyam-cli/src/utils/editorImageVerifier.js.map +1 -0
  241. package/codeyam-cli/src/utils/editorJournal.js +225 -0
  242. package/codeyam-cli/src/utils/editorJournal.js.map +1 -0
  243. package/codeyam-cli/src/utils/editorLoaderHelpers.js +113 -0
  244. package/codeyam-cli/src/utils/editorLoaderHelpers.js.map +1 -0
  245. package/codeyam-cli/src/utils/editorMockState.js +248 -0
  246. package/codeyam-cli/src/utils/editorMockState.js.map +1 -0
  247. package/codeyam-cli/src/utils/editorPreloadHelpers.js +135 -0
  248. package/codeyam-cli/src/utils/editorPreloadHelpers.js.map +1 -0
  249. package/codeyam-cli/src/utils/editorPreview.js +137 -0
  250. package/codeyam-cli/src/utils/editorPreview.js.map +1 -0
  251. package/codeyam-cli/src/utils/editorScenarioSwitch.js +112 -0
  252. package/codeyam-cli/src/utils/editorScenarioSwitch.js.map +1 -0
  253. package/codeyam-cli/src/utils/editorScenarios.js +375 -0
  254. package/codeyam-cli/src/utils/editorScenarios.js.map +1 -0
  255. package/codeyam-cli/src/utils/editorSeedAdapter.js +173 -0
  256. package/codeyam-cli/src/utils/editorSeedAdapter.js.map +1 -0
  257. package/codeyam-cli/src/utils/entityChangeStatus.js +349 -0
  258. package/codeyam-cli/src/utils/entityChangeStatus.js.map +1 -0
  259. package/codeyam-cli/src/utils/entityChangeStatus.server.js +158 -0
  260. package/codeyam-cli/src/utils/entityChangeStatus.server.js.map +1 -0
  261. package/codeyam-cli/src/utils/fileMetadata.js +5 -0
  262. package/codeyam-cli/src/utils/fileMetadata.js.map +1 -1
  263. package/codeyam-cli/src/utils/fileWatcher.js +25 -9
  264. package/codeyam-cli/src/utils/fileWatcher.js.map +1 -1
  265. package/codeyam-cli/src/utils/git.js +103 -0
  266. package/codeyam-cli/src/utils/git.js.map +1 -1
  267. package/codeyam-cli/src/utils/install-skills.js +57 -15
  268. package/codeyam-cli/src/utils/install-skills.js.map +1 -1
  269. package/codeyam-cli/src/utils/interactiveSyncWatcher.js +126 -0
  270. package/codeyam-cli/src/utils/interactiveSyncWatcher.js.map +1 -0
  271. package/codeyam-cli/src/utils/npmVersionCheck.js +76 -0
  272. package/codeyam-cli/src/utils/npmVersionCheck.js.map +1 -0
  273. package/codeyam-cli/src/utils/parseRegisterArg.js +31 -0
  274. package/codeyam-cli/src/utils/parseRegisterArg.js.map +1 -0
  275. package/codeyam-cli/src/utils/pathIgnoring.js +19 -7
  276. package/codeyam-cli/src/utils/pathIgnoring.js.map +1 -1
  277. package/codeyam-cli/src/utils/progress.js +2 -2
  278. package/codeyam-cli/src/utils/progress.js.map +1 -1
  279. package/codeyam-cli/src/utils/project.js +15 -5
  280. package/codeyam-cli/src/utils/project.js.map +1 -1
  281. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js +11 -11
  282. package/codeyam-cli/src/utils/queue/__tests__/heartbeat.test.js.map +1 -1
  283. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js +22 -0
  284. package/codeyam-cli/src/utils/queue/__tests__/manager.test.js.map +1 -1
  285. package/codeyam-cli/src/utils/queue/heartbeat.js +13 -5
  286. package/codeyam-cli/src/utils/queue/heartbeat.js.map +1 -1
  287. package/codeyam-cli/src/utils/queue/job.js +70 -1
  288. package/codeyam-cli/src/utils/queue/job.js.map +1 -1
  289. package/codeyam-cli/src/utils/queue/manager.js +7 -6
  290. package/codeyam-cli/src/utils/queue/manager.js.map +1 -1
  291. package/codeyam-cli/src/utils/requireSimulations.js +1 -1
  292. package/codeyam-cli/src/utils/requireSimulations.js.map +1 -1
  293. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js +5 -6
  294. package/codeyam-cli/src/utils/ruleReflection/__tests__/contextBuilder.test.js.map +1 -1
  295. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js +1 -1
  296. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/assertRules.js.map +1 -1
  297. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js +0 -1
  298. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/helpers/setupTempProject.js.map +1 -1
  299. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js +2 -4
  300. package/codeyam-cli/src/utils/ruleReflection/__tests__/integration/ruleReflectionE2E.test.js.map +1 -1
  301. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js +4 -6
  302. package/codeyam-cli/src/utils/ruleReflection/__tests__/promptBuilder.test.js.map +1 -1
  303. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js +1 -1
  304. package/codeyam-cli/src/utils/ruleReflection/contextBuilder.js.map +1 -1
  305. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js +83 -0
  306. package/codeyam-cli/src/utils/rules/__tests__/parser.test.js.map +1 -0
  307. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js +118 -0
  308. package/codeyam-cli/src/utils/rules/__tests__/pathMatcher.test.js.map +1 -0
  309. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js +72 -0
  310. package/codeyam-cli/src/utils/rules/__tests__/rulePlacement.test.js.map +1 -0
  311. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js +76 -0
  312. package/codeyam-cli/src/utils/rules/__tests__/sourceFiles.test.js.map +1 -0
  313. package/codeyam-cli/src/utils/rules/index.js +1 -0
  314. package/codeyam-cli/src/utils/rules/index.js.map +1 -1
  315. package/codeyam-cli/src/utils/rules/parser.js +14 -4
  316. package/codeyam-cli/src/utils/rules/parser.js.map +1 -1
  317. package/codeyam-cli/src/utils/rules/pathMatcher.js +34 -3
  318. package/codeyam-cli/src/utils/rules/pathMatcher.js.map +1 -1
  319. package/codeyam-cli/src/utils/rules/rulePlacement.js +65 -0
  320. package/codeyam-cli/src/utils/rules/rulePlacement.js.map +1 -0
  321. package/codeyam-cli/src/utils/rules/sourceFiles.js +43 -0
  322. package/codeyam-cli/src/utils/rules/sourceFiles.js.map +1 -0
  323. package/codeyam-cli/src/utils/scenarioCoverage.js +75 -0
  324. package/codeyam-cli/src/utils/scenarioCoverage.js.map +1 -0
  325. package/codeyam-cli/src/utils/scenarioMarkers.js +134 -0
  326. package/codeyam-cli/src/utils/scenarioMarkers.js.map +1 -0
  327. package/codeyam-cli/src/utils/scenariosManifest.js +241 -0
  328. package/codeyam-cli/src/utils/scenariosManifest.js.map +1 -0
  329. package/codeyam-cli/src/utils/serverState.js +57 -2
  330. package/codeyam-cli/src/utils/serverState.js.map +1 -1
  331. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js +82 -11
  332. package/codeyam-cli/src/utils/setupClaudeCodeSettings.js.map +1 -1
  333. package/codeyam-cli/src/utils/simulationGateMiddleware.js +166 -0
  334. package/codeyam-cli/src/utils/simulationGateMiddleware.js.map +1 -0
  335. package/codeyam-cli/src/utils/slugUtils.js +25 -0
  336. package/codeyam-cli/src/utils/slugUtils.js.map +1 -0
  337. package/codeyam-cli/src/utils/syncMocksMiddleware.js +7 -26
  338. package/codeyam-cli/src/utils/syncMocksMiddleware.js.map +1 -1
  339. package/codeyam-cli/src/utils/testRunner.js +158 -0
  340. package/codeyam-cli/src/utils/testRunner.js.map +1 -0
  341. package/codeyam-cli/src/utils/transcriptPruning.js +67 -0
  342. package/codeyam-cli/src/utils/transcriptPruning.js.map +1 -0
  343. package/codeyam-cli/src/utils/versionInfo.js +46 -0
  344. package/codeyam-cli/src/utils/versionInfo.js.map +1 -1
  345. package/codeyam-cli/src/utils/webappDetection.js +35 -2
  346. package/codeyam-cli/src/utils/webappDetection.js.map +1 -1
  347. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js +40 -0
  348. package/codeyam-cli/src/webserver/__tests__/clientErrors.test.js.map +1 -0
  349. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js +66 -0
  350. package/codeyam-cli/src/webserver/__tests__/dependency-smoke.test.js.map +1 -0
  351. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js +567 -0
  352. package/codeyam-cli/src/webserver/__tests__/editorProxy.test.js.map +1 -0
  353. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js +146 -0
  354. package/codeyam-cli/src/webserver/__tests__/idleDetector.test.js.map +1 -0
  355. package/codeyam-cli/src/webserver/app/lib/clientErrors.js +65 -0
  356. package/codeyam-cli/src/webserver/app/lib/clientErrors.js.map +1 -0
  357. package/codeyam-cli/src/webserver/app/lib/database.js +41 -27
  358. package/codeyam-cli/src/webserver/app/lib/database.js.map +1 -1
  359. package/codeyam-cli/src/webserver/app/lib/dbNotifier.js.map +1 -1
  360. package/codeyam-cli/src/webserver/app/lib/git.js +397 -0
  361. package/codeyam-cli/src/webserver/app/lib/git.js.map +1 -0
  362. package/codeyam-cli/src/webserver/backgroundServer.js +118 -18
  363. package/codeyam-cli/src/webserver/backgroundServer.js.map +1 -1
  364. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-BPXZwM4t.js +1 -0
  365. package/codeyam-cli/src/webserver/build/client/assets/{EntityItem-BLlhOa3C.js → EntityItem-BcgbViKV.js} +3 -3
  366. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeBadge-De5b5pC7.js → EntityTypeBadge-g3saevPb.js} +1 -1
  367. package/codeyam-cli/src/webserver/build/client/assets/{EntityTypeIcon-CzdG5I7z.js → EntityTypeIcon-CQIG2qda.js} +9 -9
  368. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bu6c6aDe.js +1 -0
  369. package/codeyam-cli/src/webserver/build/client/assets/{InteractivePreview-Ce-byqKl.js → InteractivePreview-DYFW3lDD.js} +3 -3
  370. package/codeyam-cli/src/webserver/build/client/assets/{LibraryFunctionPreview-DEMHrl7v.js → LibraryFunctionPreview-DLeucoVX.js} +1 -1
  371. package/codeyam-cli/src/webserver/build/client/assets/{LoadingDots-B1LNGboS.js → LoadingDots-BU_OAEMP.js} +1 -1
  372. package/codeyam-cli/src/webserver/build/client/assets/{LogViewer-B0Ll1DjK.js → LogViewer-ceAyBX-H.js} +1 -1
  373. package/codeyam-cli/src/webserver/build/client/assets/{ReportIssueModal-CVOvmCKb.js → ReportIssueModal-BzHcG7SE.js} +3 -3
  374. package/codeyam-cli/src/webserver/build/client/assets/{SafeScreenshot-L0DWHa_L.js → SafeScreenshot-BED4B6sP.js} +1 -1
  375. package/codeyam-cli/src/webserver/build/client/assets/{ScenarioViewer-D54Mmpwi.js → ScenarioViewer-TSD3C211.js} +3 -3
  376. package/codeyam-cli/src/webserver/build/client/assets/Spinner-Bb5uFQ5V.js +34 -0
  377. package/codeyam-cli/src/webserver/build/client/assets/{TruncatedFilePath-C7PFQfXy.js → TruncatedFilePath-C8OKAR5x.js} +1 -1
  378. package/codeyam-cli/src/webserver/build/client/assets/ViewportInspectBar-oAf2Kqsf.js +1 -0
  379. package/codeyam-cli/src/webserver/build/client/assets/{_index-CKTtYlBU.js → _index-DLxKhri3.js} +3 -3
  380. package/codeyam-cli/src/webserver/build/client/assets/{activity.(_tab)-CdziRIWU.js → activity.(_tab)-BcY3q6nt.js} +6 -6
  381. package/codeyam-cli/src/webserver/build/client/assets/addon-canvas-DpzMmAy5.js +1 -0
  382. package/codeyam-cli/src/webserver/build/client/assets/addon-fit-YJmn1quW.js +12 -0
  383. package/codeyam-cli/src/webserver/build/client/assets/addon-web-links-Duc5hnl7.js +1 -0
  384. package/codeyam-cli/src/webserver/build/client/assets/addon-webgl-DI8QOUvO.js +58 -0
  385. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-Bni3iiUj.js +22 -0
  386. package/codeyam-cli/src/webserver/build/client/assets/api.dev-mode-events-l0sNRNKZ.js +1 -0
  387. package/codeyam-cli/src/webserver/build/client/assets/api.editor-audit-l0sNRNKZ.js +1 -0
  388. package/codeyam-cli/src/webserver/build/client/assets/api.editor-capture-scenario-l0sNRNKZ.js +1 -0
  389. package/codeyam-cli/src/webserver/build/client/assets/api.editor-client-errors-l0sNRNKZ.js +1 -0
  390. package/codeyam-cli/src/webserver/build/client/assets/api.editor-commit-l0sNRNKZ.js +1 -0
  391. package/codeyam-cli/src/webserver/build/client/assets/api.editor-dev-server-l0sNRNKZ.js +1 -0
  392. package/codeyam-cli/src/webserver/build/client/assets/api.editor-entity-status-l0sNRNKZ.js +1 -0
  393. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-diff-l0sNRNKZ.js +1 -0
  394. package/codeyam-cli/src/webserver/build/client/assets/api.editor-file-l0sNRNKZ.js +1 -0
  395. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-entry-l0sNRNKZ.js +1 -0
  396. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-image._-l0sNRNKZ.js +1 -0
  397. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-l0sNRNKZ.js +1 -0
  398. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-screenshot-l0sNRNKZ.js +1 -0
  399. package/codeyam-cli/src/webserver/build/client/assets/api.editor-journal-update-l0sNRNKZ.js +1 -0
  400. package/codeyam-cli/src/webserver/build/client/assets/api.editor-load-commit-l0sNRNKZ.js +1 -0
  401. package/codeyam-cli/src/webserver/build/client/assets/api.editor-project-info-l0sNRNKZ.js +1 -0
  402. package/codeyam-cli/src/webserver/build/client/assets/api.editor-refresh-l0sNRNKZ.js +1 -0
  403. package/codeyam-cli/src/webserver/build/client/assets/api.editor-register-scenario-l0sNRNKZ.js +1 -0
  404. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-coverage-l0sNRNKZ.js +1 -0
  405. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-data-l0sNRNKZ.js +1 -0
  406. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenario-image._-l0sNRNKZ.js +1 -0
  407. package/codeyam-cli/src/webserver/build/client/assets/api.editor-scenarios-l0sNRNKZ.js +1 -0
  408. package/codeyam-cli/src/webserver/build/client/assets/api.editor-switch-scenario-l0sNRNKZ.js +1 -0
  409. package/codeyam-cli/src/webserver/build/client/assets/api.editor-test-results-l0sNRNKZ.js +1 -0
  410. package/codeyam-cli/src/webserver/build/client/assets/api.rule-path-l0sNRNKZ.js +1 -0
  411. package/codeyam-cli/src/webserver/build/client/assets/{book-open-Ch8b7GyQ.js → book-open-BYOypzCa.js} +2 -2
  412. package/codeyam-cli/src/webserver/build/client/assets/{chevron-down-vJHJExlT.js → chevron-down-C_Pmso5S.js} +2 -2
  413. package/codeyam-cli/src/webserver/build/client/assets/{chunk-JZWAC4HX-BEyX4X6_.js → chunk-JZWAC4HX-C4pqxYJB.js} +11 -11
  414. package/codeyam-cli/src/webserver/build/client/assets/{circle-check-rwynPZTW.js → circle-check-BVMi9VA5.js} +2 -2
  415. package/codeyam-cli/src/webserver/build/client/assets/{copy-BBSpeBYf.js → copy-n2FB0_Sw.js} +3 -3
  416. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-CC6AbExI.js +41 -0
  417. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-Ii3inc0_.js +1 -0
  418. package/codeyam-cli/src/webserver/build/client/assets/editor-CtRVY4nn.js +10 -0
  419. package/codeyam-cli/src/webserver/build/client/assets/editorPreview-CNB06EIa.js +41 -0
  420. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-DwCV5__E.js +23 -0
  421. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.dev-CXSi2aeZ.js +6 -0
  422. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-CHMiAog3.js +6 -0
  423. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-p9hhkjJM.js +6 -0
  424. package/codeyam-cli/src/webserver/build/client/assets/{entity._sha_.edit._scenarioId-BEqewwtZ.js → entity._sha_.edit._scenarioId-BMvVHNXU.js} +2 -2
  425. package/codeyam-cli/src/webserver/build/client/assets/{entry.client-Dxqz8ygt.js → entry.client-DTvKq3TY.js} +1 -1
  426. package/codeyam-cli/src/webserver/build/client/assets/{fileTableUtils-CYnF5KWN.js → fileTableUtils-cPo8LiG3.js} +1 -1
  427. package/codeyam-cli/src/webserver/build/client/assets/{files-B_dAq2PQ.js → files-BZrlFE1F.js} +1 -1
  428. package/codeyam-cli/src/webserver/build/client/assets/git-DdZcvjGh.js +1 -0
  429. package/codeyam-cli/src/webserver/build/client/assets/globals-DozjVXrE.css +1 -0
  430. package/codeyam-cli/src/webserver/build/client/assets/{index-viijWaN6.js → index-10oVnAAH.js} +1 -1
  431. package/codeyam-cli/src/webserver/build/client/assets/{index-DgAAopZk.js → index-BcvgDzbZ.js} +1 -1
  432. package/codeyam-cli/src/webserver/build/client/assets/index-yHOVb4rc.js +15 -0
  433. package/codeyam-cli/src/webserver/build/client/assets/labs-Zk7ryIM1.js +1 -0
  434. package/codeyam-cli/src/webserver/build/client/assets/{loader-circle-LGi2eKI5.js → loader-circle-DaAZ_H2w.js} +2 -2
  435. package/codeyam-cli/src/webserver/build/client/assets/manifest-b431cb81.js +1 -0
  436. package/codeyam-cli/src/webserver/build/client/assets/memory-9gnxSZlb.js +101 -0
  437. package/codeyam-cli/src/webserver/build/client/assets/{pause-DxJFmMsK.js → pause-f5-1lKBt.js} +3 -3
  438. package/codeyam-cli/src/webserver/build/client/assets/root-20m9-3-z.js +67 -0
  439. package/codeyam-cli/src/webserver/build/client/assets/{search-Cu3QE9E5.js → search-Di64LWVb.js} +2 -2
  440. package/codeyam-cli/src/webserver/build/client/assets/settings-0OrEMU6J.js +1 -0
  441. package/codeyam-cli/src/webserver/build/client/assets/{simulations-D9Fkx0-d.js → simulations-DWT-CvLy.js} +1 -1
  442. package/codeyam-cli/src/webserver/build/client/assets/{terminal-dAhIBEcd.js → terminal-Br7MOqts.js} +3 -3
  443. package/codeyam-cli/src/webserver/build/client/assets/{triangle-alert-C4CYTEeP.js → triangle-alert-BLdiCuG-.js} +2 -2
  444. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-C-_hOl_g.js +1 -0
  445. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-C14nCb1q.js +2 -0
  446. package/codeyam-cli/src/webserver/build/client/assets/{useReportContext-BK0S88PB.js → useReportContext-O-jkvSPx.js} +1 -1
  447. package/codeyam-cli/src/webserver/build/client/assets/{useToast-CJ-JqR0l.js → useToast-9FIWuYfK.js} +1 -1
  448. package/codeyam-cli/src/webserver/build/client/assets/xterm-BqvuqXEL.js +27 -0
  449. package/codeyam-cli/src/webserver/build/client/sound-test.html +98 -0
  450. package/codeyam-cli/src/webserver/build/server/assets/index-WJ6ysHIA.js +1 -0
  451. package/codeyam-cli/src/webserver/build/server/assets/init-3Om_In9B.js +10 -0
  452. package/codeyam-cli/src/webserver/build/server/assets/server-build-kfIP9lFK.js +439 -0
  453. package/codeyam-cli/src/webserver/build/server/index.js +1 -1
  454. package/codeyam-cli/src/webserver/build-info.json +5 -5
  455. package/codeyam-cli/src/webserver/devServer.js +39 -5
  456. package/codeyam-cli/src/webserver/devServer.js.map +1 -1
  457. package/codeyam-cli/src/webserver/editorProxy.js +877 -0
  458. package/codeyam-cli/src/webserver/editorProxy.js.map +1 -0
  459. package/codeyam-cli/src/webserver/idleDetector.js +73 -0
  460. package/codeyam-cli/src/webserver/idleDetector.js.map +1 -0
  461. package/codeyam-cli/src/webserver/public/sound-test.html +98 -0
  462. package/codeyam-cli/src/webserver/scripts/codeyam-preload.mjs +414 -0
  463. package/codeyam-cli/src/webserver/scripts/journalCapture.ts +230 -0
  464. package/codeyam-cli/src/webserver/server.js +300 -1
  465. package/codeyam-cli/src/webserver/server.js.map +1 -1
  466. package/codeyam-cli/src/webserver/terminalServer.js +735 -0
  467. package/codeyam-cli/src/webserver/terminalServer.js.map +1 -0
  468. package/codeyam-cli/templates/chrome-extension-react/EXTENSION_SETUP.md +75 -0
  469. package/codeyam-cli/templates/chrome-extension-react/README.md +46 -0
  470. package/codeyam-cli/templates/chrome-extension-react/gitignore +15 -0
  471. package/codeyam-cli/templates/chrome-extension-react/index.html +12 -0
  472. package/codeyam-cli/templates/chrome-extension-react/package.json +27 -0
  473. package/codeyam-cli/templates/chrome-extension-react/popup.html +12 -0
  474. package/codeyam-cli/templates/chrome-extension-react/public/manifest.json +15 -0
  475. package/codeyam-cli/templates/chrome-extension-react/src/background/service-worker.ts +7 -0
  476. package/codeyam-cli/templates/chrome-extension-react/src/globals.css +6 -0
  477. package/codeyam-cli/templates/chrome-extension-react/src/lib/storage.ts +37 -0
  478. package/codeyam-cli/templates/chrome-extension-react/src/popup/App.tsx +12 -0
  479. package/codeyam-cli/templates/chrome-extension-react/src/popup/main.tsx +10 -0
  480. package/codeyam-cli/templates/chrome-extension-react/tsconfig.json +24 -0
  481. package/codeyam-cli/templates/chrome-extension-react/vite.config.ts +41 -0
  482. package/codeyam-cli/templates/codeyam-editor-claude.md +147 -0
  483. package/codeyam-cli/templates/editor-step-hook.py +236 -0
  484. package/codeyam-cli/templates/expo-react-native/MOBILE_SETUP.md +89 -0
  485. package/codeyam-cli/templates/expo-react-native/README.md +41 -0
  486. package/codeyam-cli/templates/expo-react-native/app/(tabs)/_layout.tsx +33 -0
  487. package/codeyam-cli/templates/expo-react-native/app/(tabs)/index.tsx +12 -0
  488. package/codeyam-cli/templates/expo-react-native/app/(tabs)/settings.tsx +12 -0
  489. package/codeyam-cli/templates/expo-react-native/app/_layout.tsx +12 -0
  490. package/codeyam-cli/templates/expo-react-native/app.json +18 -0
  491. package/codeyam-cli/templates/expo-react-native/babel.config.js +9 -0
  492. package/codeyam-cli/templates/expo-react-native/gitignore +12 -0
  493. package/codeyam-cli/templates/expo-react-native/global.css +3 -0
  494. package/codeyam-cli/templates/expo-react-native/lib/storage.ts +32 -0
  495. package/codeyam-cli/templates/expo-react-native/metro.config.js +6 -0
  496. package/codeyam-cli/templates/expo-react-native/nativewind-env.d.ts +1 -0
  497. package/codeyam-cli/templates/expo-react-native/package.json +38 -0
  498. package/codeyam-cli/templates/expo-react-native/tailwind.config.js +10 -0
  499. package/codeyam-cli/templates/expo-react-native/tsconfig.json +10 -0
  500. package/codeyam-cli/templates/hooks/staleness-check.sh +43 -0
  501. package/codeyam-cli/templates/isolation-route/next-app.tsx.template +80 -0
  502. package/codeyam-cli/templates/isolation-route/next-pages.tsx.template +79 -0
  503. package/codeyam-cli/templates/isolation-route/vite-react.tsx.template +78 -0
  504. package/codeyam-cli/templates/msw/browser-setup.ts.template +47 -0
  505. package/codeyam-cli/templates/msw/handler-router.ts.template +47 -0
  506. package/codeyam-cli/templates/msw/server-setup.ts.template +52 -0
  507. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_PATTERNS.md +308 -0
  508. package/codeyam-cli/templates/nextjs-prisma-sqlite/AUTH_UPGRADE.md +304 -0
  509. package/codeyam-cli/templates/nextjs-prisma-sqlite/DATABASE.md +126 -0
  510. package/codeyam-cli/templates/nextjs-prisma-sqlite/FEATURE_PATTERNS.md +37 -0
  511. package/codeyam-cli/templates/nextjs-prisma-sqlite/README.md +53 -0
  512. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/api/todos/route.ts +17 -0
  513. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/codeyam-isolate/layout.tsx +12 -0
  514. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/globals.css +26 -0
  515. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/layout.tsx +34 -0
  516. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/lib/prisma.ts +24 -0
  517. package/codeyam-cli/templates/nextjs-prisma-sqlite/app/page.tsx +10 -0
  518. package/codeyam-cli/templates/nextjs-prisma-sqlite/env +4 -0
  519. package/codeyam-cli/templates/nextjs-prisma-sqlite/eslint.config.mjs +11 -0
  520. package/codeyam-cli/templates/nextjs-prisma-sqlite/gitignore +64 -0
  521. package/codeyam-cli/templates/nextjs-prisma-sqlite/next.config.ts +14 -0
  522. package/codeyam-cli/templates/nextjs-prisma-sqlite/package.json +39 -0
  523. package/codeyam-cli/templates/nextjs-prisma-sqlite/postcss.config.mjs +7 -0
  524. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/schema.prisma +27 -0
  525. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma/seed.ts +40 -0
  526. package/codeyam-cli/templates/nextjs-prisma-sqlite/prisma.config.ts +12 -0
  527. package/codeyam-cli/templates/nextjs-prisma-sqlite/seed-adapter.ts +92 -0
  528. package/codeyam-cli/templates/nextjs-prisma-sqlite/tsconfig.json +34 -0
  529. package/codeyam-cli/templates/nextjs-prisma-sqlite/vitest.config.ts +13 -0
  530. package/codeyam-cli/templates/nextjs-prisma-supabase/README.md +52 -0
  531. package/codeyam-cli/templates/nextjs-prisma-supabase/SUPABASE_SETUP.md +104 -0
  532. package/codeyam-cli/templates/nextjs-prisma-supabase/app/api/todos/route.ts +17 -0
  533. package/codeyam-cli/templates/nextjs-prisma-supabase/app/globals.css +26 -0
  534. package/codeyam-cli/templates/nextjs-prisma-supabase/app/layout.tsx +34 -0
  535. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/prisma.ts +20 -0
  536. package/codeyam-cli/templates/nextjs-prisma-supabase/app/lib/supabase.ts +12 -0
  537. package/codeyam-cli/templates/nextjs-prisma-supabase/app/page.tsx +10 -0
  538. package/codeyam-cli/templates/nextjs-prisma-supabase/env +9 -0
  539. package/codeyam-cli/templates/nextjs-prisma-supabase/eslint.config.mjs +11 -0
  540. package/codeyam-cli/templates/nextjs-prisma-supabase/gitignore +40 -0
  541. package/codeyam-cli/templates/nextjs-prisma-supabase/next.config.ts +11 -0
  542. package/codeyam-cli/templates/nextjs-prisma-supabase/package.json +37 -0
  543. package/codeyam-cli/templates/nextjs-prisma-supabase/postcss.config.mjs +7 -0
  544. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/schema.prisma +27 -0
  545. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma/seed.ts +39 -0
  546. package/codeyam-cli/templates/nextjs-prisma-supabase/prisma.config.ts +12 -0
  547. package/codeyam-cli/templates/nextjs-prisma-supabase/tsconfig.json +34 -0
  548. package/codeyam-cli/templates/prompts/conversation-guidance.txt +44 -0
  549. package/codeyam-cli/templates/prompts/conversation-prompt.txt +28 -0
  550. package/codeyam-cli/templates/prompts/interruption-prompt.txt +31 -0
  551. package/codeyam-cli/templates/prompts/stale-rules-prompt.txt +24 -0
  552. package/codeyam-cli/templates/rule-notification-hook.py +44 -17
  553. package/codeyam-cli/templates/rule-reflection-hook.py +25 -5
  554. package/codeyam-cli/templates/rules-instructions.md +34 -88
  555. package/codeyam-cli/templates/skills/codeyam-dev-mode/SKILL.md +237 -0
  556. package/codeyam-cli/templates/skills/codeyam-editor/SKILL.md +149 -0
  557. package/codeyam-cli/templates/{codeyam-memory.md → skills/codeyam-memory/SKILL.md} +215 -0
  558. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/deprecated-prompt.md +100 -0
  559. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/detect-deprecated-patterns.mjs +139 -0
  560. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/find-exports.mjs +52 -0
  561. package/codeyam-cli/templates/skills/codeyam-memory/scripts/holistic-analysis/misleading-api-prompt.md +117 -0
  562. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/read-json-field.mjs +61 -0
  563. package/codeyam-cli/templates/skills/codeyam-memory/scripts/lib/ripgrep-fallback.mjs +155 -0
  564. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/analyze-prompt.md +46 -0
  565. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/cleanup.mjs +13 -0
  566. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/filter-session.mjs +95 -0
  567. package/codeyam-cli/templates/skills/codeyam-memory/scripts/session-mining/preprocess.mjs +160 -0
  568. package/codeyam-cli/templates/{codeyam-new-rule.md → skills/codeyam-new-rule/SKILL.md} +0 -2
  569. package/package.json +21 -14
  570. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js +22 -4
  571. package/packages/ai/src/lib/astScopes/astScopeAnalyzer.js.map +1 -1
  572. package/packages/ai/src/lib/completionCall.js +10 -7
  573. package/packages/ai/src/lib/completionCall.js.map +1 -1
  574. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js +234 -3
  575. package/packages/ai/src/lib/dataStructure/ScopeDataStructure.js.map +1 -1
  576. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js +54 -0
  577. package/packages/ai/src/lib/dataStructure/helpers/coercePrimitivesToArraysBySchema.js.map +1 -0
  578. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js +34 -0
  579. package/packages/ai/src/lib/dataStructure/helpers/stripNullableMarkers.js.map +1 -0
  580. package/packages/ai/src/lib/dataStructureChunking.js +9 -5
  581. package/packages/ai/src/lib/dataStructureChunking.js.map +1 -1
  582. package/packages/ai/src/lib/generateEntityScenarioData.js +57 -2
  583. package/packages/ai/src/lib/generateEntityScenarioData.js.map +1 -1
  584. package/packages/ai/src/lib/generateExecutionFlows.js +81 -11
  585. package/packages/ai/src/lib/generateExecutionFlows.js.map +1 -1
  586. package/packages/analyze/src/lib/ProjectAnalyzer.js +13 -4
  587. package/packages/analyze/src/lib/ProjectAnalyzer.js.map +1 -1
  588. package/packages/analyze/src/lib/asts/index.js +4 -2
  589. package/packages/analyze/src/lib/asts/index.js.map +1 -1
  590. package/packages/analyze/src/lib/asts/nodes/getNodeType.js +1 -0
  591. package/packages/analyze/src/lib/asts/nodes/getNodeType.js.map +1 -1
  592. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js +8 -1
  593. package/packages/analyze/src/lib/files/analyze/analyzeEntities.js.map +1 -1
  594. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js +0 -5
  595. package/packages/analyze/src/lib/files/analyze/dependencyResolver.js.map +1 -1
  596. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js +9 -0
  597. package/packages/analyze/src/lib/files/analyze/findOrCreateEntity.js.map +1 -1
  598. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js +54 -27
  599. package/packages/analyze/src/lib/files/scenarios/TransformationTracer.js.map +1 -1
  600. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js +65 -0
  601. package/packages/analyze/src/lib/files/scenarios/generateDataStructure.js.map +1 -1
  602. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js +0 -40
  603. package/packages/analyze/src/lib/files/scenarios/generateExecutionFlows.js.map +1 -1
  604. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js +18 -4
  605. package/packages/analyze/src/lib/files/scenarios/mergeInDependentDataStructure.js.map +1 -1
  606. package/packages/database/index.js +1 -0
  607. package/packages/database/index.js.map +1 -1
  608. package/packages/database/src/lib/kysely/db.js +5 -0
  609. package/packages/database/src/lib/kysely/db.js.map +1 -1
  610. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js +121 -0
  611. package/packages/database/src/lib/kysely/tables/editorScenariosTable.js.map +1 -0
  612. package/packages/database/src/lib/loadCommits.js +23 -13
  613. package/packages/database/src/lib/loadCommits.js.map +1 -1
  614. package/packages/database/src/lib/loadEntities.js +0 -6
  615. package/packages/database/src/lib/loadEntities.js.map +1 -1
  616. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js +1 -4
  617. package/packages/database/src/lib/loadReadyToBeCapturedAnalyses.js.map +1 -1
  618. package/packages/database/src/lib/updateCommitMetadata.js +76 -90
  619. package/packages/database/src/lib/updateCommitMetadata.js.map +1 -1
  620. package/packages/database/src/lib/updateFreshAnalysisStatus.js +41 -30
  621. package/packages/database/src/lib/updateFreshAnalysisStatus.js.map +1 -1
  622. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js +68 -57
  623. package/packages/database/src/lib/updateFreshAnalysisStatusWithScenarios.js.map +1 -1
  624. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js +29 -1
  625. package/packages/generate/src/lib/componentScenarioPage/generateScenarioClientWrapper.js.map +1 -1
  626. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js +33 -5
  627. package/packages/generate/src/lib/componentScenarioPage/getIFrameMessageListenerCode.js.map +1 -1
  628. package/packages/types/src/enums/ProjectFramework.js +2 -0
  629. package/packages/types/src/enums/ProjectFramework.js.map +1 -1
  630. package/packages/utils/src/lib/fs/rsyncCopy.js +6 -2
  631. package/packages/utils/src/lib/fs/rsyncCopy.js.map +1 -1
  632. package/scripts/npm-post-install.cjs +34 -0
  633. package/codeyam-cli/src/commands/detect-universal-mocks.js +0 -120
  634. package/codeyam-cli/src/commands/detect-universal-mocks.js.map +0 -1
  635. package/codeyam-cli/src/commands/list.js +0 -31
  636. package/codeyam-cli/src/commands/list.js.map +0 -1
  637. package/codeyam-cli/src/commands/webapp-info.js +0 -146
  638. package/codeyam-cli/src/commands/webapp-info.js.map +0 -1
  639. package/codeyam-cli/src/utils/universal-mocks.js +0 -152
  640. package/codeyam-cli/src/utils/universal-mocks.js.map +0 -1
  641. package/codeyam-cli/src/webserver/build/client/assets/CopyButton-D9i_zSlY.js +0 -1
  642. package/codeyam-cli/src/webserver/build/client/assets/InlineSpinner-Bclf8Hka.js +0 -34
  643. package/codeyam-cli/src/webserver/build/client/assets/agent-transcripts-CPXtdaWm.js +0 -17
  644. package/codeyam-cli/src/webserver/build/client/assets/createLucideIcon-DHVDauuc.js +0 -21
  645. package/codeyam-cli/src/webserver/build/client/assets/dev.empty-B9_ZqelV.js +0 -1
  646. package/codeyam-cli/src/webserver/build/client/assets/entity._sha._-BOPComvD.js +0 -16
  647. package/codeyam-cli/src/webserver/build/client/assets/entity._sha.scenarios._scenarioId.fullscreen-Cfw__yQa.js +0 -6
  648. package/codeyam-cli/src/webserver/build/client/assets/entity._sha_.create-scenario-BIDUUrI3.js +0 -6
  649. package/codeyam-cli/src/webserver/build/client/assets/git-BHPqH3Ch.js +0 -15
  650. package/codeyam-cli/src/webserver/build/client/assets/globals-BJGhRykz.css +0 -1
  651. package/codeyam-cli/src/webserver/build/client/assets/labs-ChoAe3xq.js +0 -1
  652. package/codeyam-cli/src/webserver/build/client/assets/manifest-87493a32.js +0 -1
  653. package/codeyam-cli/src/webserver/build/client/assets/memory-D9eA6kTo.js +0 -78
  654. package/codeyam-cli/src/webserver/build/client/assets/root-C3r0p_7H.js +0 -62
  655. package/codeyam-cli/src/webserver/build/client/assets/settings-KH9TdArD.js +0 -1
  656. package/codeyam-cli/src/webserver/build/client/assets/useCustomSizes-CLPnITMB.js +0 -1
  657. package/codeyam-cli/src/webserver/build/client/assets/useLastLogLine-DmGI38Et.js +0 -2
  658. package/codeyam-cli/src/webserver/build/server/assets/index-CkkmL6r5.js +0 -1
  659. package/codeyam-cli/src/webserver/build/server/assets/server-build-iBGjHYtO.js +0 -259
  660. package/codeyam-cli/templates/codeyam-stop-hook.sh +0 -284
  661. package/scripts/finalize-analyzer.cjs +0 -13
  662. /package/codeyam-cli/templates/{codeyam-diagnose.md → commands/codeyam-diagnose.md} +0 -0
  663. /package/codeyam-cli/templates/{codeyam-debug.md → skills/codeyam-debug/SKILL.md} +0 -0
  664. /package/codeyam-cli/templates/{codeyam-setup.md → skills/codeyam-setup/SKILL.md} +0 -0
  665. /package/codeyam-cli/templates/{codeyam-sim.md → skills/codeyam-sim/SKILL.md} +0 -0
  666. /package/codeyam-cli/templates/{codeyam-test.md → skills/codeyam-test/SKILL.md} +0 -0
  667. /package/codeyam-cli/templates/{codeyam-verify.md → skills/codeyam-verify/SKILL.md} +0 -0
@@ -1,5 +1,5 @@
1
- import{c}from"./createLucideIcon-DHVDauuc.js";/**
2
- * @license lucide-react v0.556.0 - ISC
1
+ import{c}from"./createLucideIcon-CC6AbExI.js";/**
2
+ * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
@@ -1,10 +1,10 @@
1
- import{c}from"./createLucideIcon-DHVDauuc.js";/**
2
- * @license lucide-react v0.556.0 - ISC
1
+ import{c}from"./createLucideIcon-CC6AbExI.js";/**
2
+ * @license lucide-react v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
6
  */const e=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],a=c("check",e);/**
7
- * @license lucide-react v0.556.0 - ISC
7
+ * @license lucide-react v0.577.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
@@ -0,0 +1,41 @@
1
+ import{r as s}from"./chunk-JZWAC4HX-C4pqxYJB.js";/**
2
+ * @license lucide-react v0.577.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const l=(...t)=>t.filter((e,r,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===r).join(" ").trim();/**
7
+ * @license lucide-react v0.577.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const C=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
12
+ * @license lucide-react v0.577.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const f=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,r,o)=>o?o.toUpperCase():r.toLowerCase());/**
17
+ * @license lucide-react v0.577.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const i=t=>{const e=f(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
22
+ * @license lucide-react v0.577.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */var w={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
27
+ * @license lucide-react v0.577.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const h=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
32
+ * @license lucide-react v0.577.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const g=s.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:r=2,absoluteStrokeWidth:o,className:n="",children:a,iconNode:u,...c},p)=>s.createElement("svg",{ref:p,...w,width:e,height:e,stroke:t,strokeWidth:o?Number(r)*24/Number(e):r,className:l("lucide",n),...!a&&!h(c)&&{"aria-hidden":"true"},...c},[...u.map(([m,d])=>s.createElement(m,d)),...Array.isArray(a)?a:[a]]));/**
37
+ * @license lucide-react v0.577.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const b=(t,e)=>{const r=s.forwardRef(({className:o,...n},a)=>s.createElement(g,{ref:a,iconNode:e,className:l(`lucide-${C(i(t))}`,`lucide-${t}`,o),...n}));return r.displayName=i(t),r};export{b as c};
@@ -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-TSD3C211.js";import{W as n}from"./InteractivePreview-DYFW3lDD.js";import"./ViewportInspectBar-oAf2Kqsf.js";import"./useCustomSizes-C-_hOl_g.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-BzHcG7SE.js";import"./createLucideIcon-CC6AbExI.js";import"./circle-check-BVMi9VA5.js";import"./triangle-alert-BLdiCuG-.js";import"./copy-n2FB0_Sw.js";import"./scenarioStatus-B_8jpV3e.js";import"./InlineSpinner-Bu6c6aDe.js";const k=()=>[{title:"Empty State - CodeYam"},{name:"description",content:"Simulations empty state development view"}],S=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{S as default,k as meta};
@@ -0,0 +1,10 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-yHOVb4rc.js","assets/chunk-JZWAC4HX-C4pqxYJB.js"])))=>i.map(i=>d[i]);
2
+ var Mt=Object.defineProperty;var It=(t,s,a)=>s in t?Mt(t,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[s]=a;var qe=(t,s,a)=>It(t,typeof s!="symbol"?s+"":s,a);import{r as n,j as e,w as Et,u as Rt,b as $t}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{u as Tt,C as Lt}from"./useCustomSizes-C-_hOl_g.js";import{g as Bt,s as At,r as Me,b as ce,c as _t,l as Dt,d as Ot,e as Ut,f as Ft,a as zt,T as Wt,D as Ht}from"./editorPreview-CNB06EIa.js";import{C as Ee}from"./CopyButton-BPXZwM4t.js";import{_ as Gt}from"./preload-helper-ckwbz45p.js";import{c as Jt}from"./cy-logo-cli-DcX-ZS3p.js";import{u as Vt,S as Ke}from"./Spinner-Bb5uFQ5V.js";import"./copy-n2FB0_Sw.js";import"./createLucideIcon-CC6AbExI.js";import"./useLastLogLine-C14nCb1q.js";const xe=[{name:"Desktop",width:1440,height:900},{name:"Laptop",width:1024,height:768},{name:"Tablet",width:768,height:1024},{name:"Mobile",width:375,height:667}];function Yt(t){if(!t)return xe;const s=Object.entries(t).map(([i,h])=>({name:i,width:h.width,height:h.height})),a=new Set(s.map(i=>i.name));return[...s,...xe.filter(i=>!a.has(i.name))]}function Re(t){const[s,a]=n.useState(null),[i,h]=n.useState(!1),d=n.useCallback(()=>{t&&(h(!0),fetch(`/api/editor-test-results?testFile=${encodeURIComponent(t)}`).then(c=>c.json()).then(c=>{a(c),h(!1)}).catch(()=>{a({testFilePath:t,status:"error",testCases:[],errorMessage:"Failed to fetch test results"}),h(!1)}))},[t]);return n.useEffect(()=>{t&&d()},[t,d]),{results:s,isRunning:i,runTests:d}}function Q(t){if(!t||t==="/")return"Home";const s=t.split("?")[0].replace(/^\//,"");if(!s)return"Home";const a=s.split("/")[0];return a.charAt(0).toUpperCase()+a.slice(1)}function $e(t){return t?t.includes("/isolated-components"):!1}function qt(t,s){return!s||Object.keys(s).length===0?t:t.filter(a=>s[a.name])}function ne({imgSrc:t,name:s,isActive:a,onSelect:i}){return e.jsxs("button",{onClick:i,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] ${a?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:t?e.jsx("img",{src:t,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 ${a?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function Ie({testFile:t,entityName:s}){const{results:a,isRunning:i,runTests:h}=Re(t);if(i&&!a)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(!a)return null;if(a.status==="error")return e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:a.errorMessage})});const d=s?a.testCases.filter(u=>u.fullName.startsWith(s)):a.testCases,c=d.length>0?d:a.testCases;if(c.length===0)return null;const x=s?`${s} > `:"";return e.jsxs("div",{className:"px-2 pt-1 space-y-0.5",children:[c.map(u=>{var S;const k=x&&u.fullName.startsWith(x)?u.fullName.slice(x.length):u.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[u.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):u.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] ${u.status==="passed"?"text-green-400":u.status==="failed"?"text-red-400":"text-gray-500"}`,children:k})]}),u.status==="failed"&&((S=u.failureMessages)==null?void 0:S.map((N,w)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-300/70 truncate max-w-full",title:N,children:N.split(`
3
+ `)[0]},w)))]},u.fullName)}),e.jsx("button",{onClick:h,disabled:i,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#00c4ee] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:i?"Running...":"Re-run"})]})}function Y({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 px-2 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",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"})})]}),e.jsx(Ee,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function Kt({scenarios:t,projectRoot:s,activeScenarioId:a,onScenarioSelect:i,zoomComponent:h,onZoomChange:d,analyzedEntities:c=[],glossaryFunctions:x=[],activeAnalyzedScenarioId:u,onAnalyzedScenarioSelect:k,entityImports:S,pageFilePaths:N={}}){const{pageGroups:w,componentGroups:E}=n.useMemo(()=>{var m;const f=new Map,l=new Map;for(const p of t)if(p.componentName){const o=l.get(p.componentName)||[];o.push(p),l.set(p.componentName,o)}else if($e(p.url)){const o=(m=p.url)==null?void 0:m.match(/[?&]c=([^&]+)/),y=o?decodeURIComponent(o[1]):"Isolated",C=l.get(y)||[];C.push(p),l.set(y,C)}else{const o=Q(p.url),y=f.get(o)||[];y.push(p),f.set(o,y)}const j=new Map([...l.entries()].sort(([p],[o])=>p.localeCompare(o)));return{pageGroups:f,componentGroups:j}},[t]),v=n.useMemo(()=>{const f=new Set((c||[]).filter(j=>j.entityType==="visual").map(j=>j.name)),l=new Map;for(const[j,m]of E)f.has(j)||l.set(j,m);return l},[E,c]),{visualEntities:D,libraryEntities:O}=n.useMemo(()=>{const f=c.filter(j=>j.entityType==="visual").sort((j,m)=>j.name.localeCompare(m.name)),l=c.filter(j=>j.entityType==="library"||j.entityType==="functionCall").sort((j,m)=>j.name.localeCompare(m.name));return{visualEntities:f,libraryEntities:l}},[c]),R=n.useMemo(()=>{const f=new Set(O.map(l=>l.name));return x.filter(l=>!f.has(l.name)).sort((l,j)=>l.name.localeCompare(j.name))},[x,O]),F=c.some(f=>f.isAnalyzing),P=n.useRef(null),I=n.useRef(0),_=n.useCallback(()=>{P.current&&(I.current=P.current.scrollTop)},[]);if(n.useEffect(()=>{P.current&&I.current>0&&(P.current.scrollTop=I.current)}),t.length===0&&c.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(h){const f=E.get(h)||[],l=new Set((S==null?void 0:S[h])||[]),j=l.size>0,m=j?D.filter(o=>l.has(o.name)):[],p=j?O.filter(o=>l.has(o.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:()=>d(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:h})}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2",children:f.length===0?e.jsx("div",{className:"px-3 py-2 text-xs text-gray-500",children:"No scenarios for this component"}):f.map(o=>e.jsx(ne,{imgSrc:o.screenshotPath?`/api/editor-scenario-image/${o.id}.png${o.updatedAt?`?v=${encodeURIComponent(o.updatedAt)}`:""}`:null,name:o.name,isActive:o.id===a,onSelect:()=>i(o)},o.id))}),m.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"})}),m.map(o=>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:()=>d(o.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:o.name})}),e.jsx(Y,{filePath:o.filePath,projectRoot:s}),(o.scenarios.length>0||o.pendingScenarios.length>0)&&e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:o.scenarios.map(y=>e.jsx(ne,{imgSrc:y.screenshotPath?`/api/screenshot/${y.screenshotPath}`:null,name:y.name,isActive:y.id===u,onSelect:()=>k==null?void 0:k({analysisId:o.analysisId,scenarioId:y.id,scenarioName:y.name,entitySha:o.sha,entityName:o.name})},y.id))})]},o.sha))]}),p.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"})}),p.map(o=>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:o.name})}),e.jsx(Y,{filePath:o.filePath,projectRoot:s}),o.testFile&&e.jsx(Ie,{testFile:o.testFile,entityName:o.name})]},o.sha))]})]})})}return e.jsx("div",{ref:P,onScroll:_,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-3",children:[w.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"})}),[...w.entries()].sort(([f],[l])=>f==="Home"?-1:l==="Home"?1:f.localeCompare(l)).map(([f,l])=>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:f})}),N[f]&&e.jsx(Y,{filePath:N[f],projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 pt-1",children:l.map(j=>e.jsx(ne,{imgSrc:j.screenshotPath?`/api/editor-scenario-image/${j.id}.png${j.updatedAt?`?v=${encodeURIComponent(j.updatedAt)}`:""}`:null,name:j.name,isActive:j.id===a&&!u,onSelect:()=>i(j)},j.id))})]},f))]}),v.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"})}),[...v.entries()].map(([f,l])=>{var j;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:()=>d(f),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:f})}),((j=l[0])==null?void 0:j.componentPath)&&e.jsx(Y,{filePath:l[0].componentPath,projectRoot:s}),e.jsx("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:l.map(m=>e.jsx(ne,{imgSrc:m.screenshotPath?`/api/editor-scenario-image/${m.id}.png${m.updatedAt?`?v=${encodeURIComponent(m.updatedAt)}`:""}`:null,name:m.name,isActive:m.id===a&&!u,onSelect:()=>i(m)},m.id))})]},f)})]}),D.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"}),F&&t.length===0&&c.every(f=>f.scenarioCount===0)&&e.jsx("span",{className:"ml-2 text-[10px] text-gray-500",children:"— Entities are being analyzed..."})]}),D.map(f=>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:()=>d(f.name),className:"text-[11px] font-medium text-gray-400 truncate cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:f.name}),f.isAnalyzing&&f.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(Y,{filePath:f.filePath,projectRoot:s}),(f.scenarios.length>0||f.pendingScenarios.length>0)&&e.jsxs("div",{className:"flex flex-wrap gap-2 px-2 pt-1",children:[f.scenarios.map(l=>e.jsx(ne,{imgSrc:l.screenshotPath?`/api/screenshot/${l.screenshotPath}`:null,name:l.name,isActive:l.id===u,onSelect:()=>k==null?void 0:k({analysisId:f.analysisId,scenarioId:l.id,scenarioName:l.name,entitySha:f.sha,entityName:f.name})},l.id)),f.pendingScenarios.map(l=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:l,children:l},l))]})]},f.sha))]}),(O.length>0||R.length>0)&&e.jsxs("div",{className:`pt-2 mt-1 ${D.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"})}),O.map(f=>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:f.name}),f.isAnalyzing&&f.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(Y,{filePath:f.filePath,projectRoot:s}),f.testFile?e.jsx(Ie,{testFile:f.testFile,entityName:f.name}):e.jsx("div",{className:"px-2 pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},f.sha)),R.map(f=>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:f.name})}),e.jsx(Y,{filePath:f.filePath,projectRoot:s}),e.jsx(Ie,{testFile:f.testFile,entityName:f.name})]},f.name))]})]})})}function Xt(t,s,a=new Date){const i={"1d":1,"3d":3,"7d":7,"30d":30}[s],h=new Date(a);h.setDate(h.getDate()-i);const d=h.toISOString().split("T")[0],c=t.filter(N=>N.date>=d),x=new Set(c.map(N=>N.commitSha).filter(Boolean)),u=new Map;for(const N of c)if(N.scenarioScreenshots)for(const w of N.scenarioScreenshots){u.has(w.name)||u.set(w.name,[]);const E=u.get(w.name);E.some(v=>v.path===w.path)||E.push({path:w.path,time:N.time})}for(const N of u.values())N.sort((w,E)=>w.time.localeCompare(E.time));const k=[],S=new Map;for(const[N,w]of u){const E=N.indexOf(" - ");if(E!==-1){const v=N.slice(0,E);S.has(v)||S.set(v,[]),S.get(v).push({name:N,screenshots:w})}else k.push({name:N,screenshots:w})}return{commitCount:x.size,entryCount:c.length,appScenarios:k,componentGroups:S,totalScenarios:u.size}}function Qt(t){const s=new Map;for(const a of[...t].reverse()){const i=s.get(a.date)||[];i.push(a),s.set(a.date,i)}return s}function Zt(t){const s=new Map;for(const a of t){let i;if("componentName"in a&&a.componentName)i=a.componentName;else if("componentName"in a&&a.componentName===null)i="App";else{const d=a.name.indexOf(" - ");i=d!==-1?a.name.slice(0,d):"App"}const h=s.get(i)||[];h.push(a),s.set(i,h)}return[...s.entries()].sort(([a],[i])=>a==="App"?-1:i==="App"?1:a.localeCompare(i))}const Xe=120;function ot({text:t,theme:s}){const[a,i]=n.useState(!1),h=t.length>Xe,d=h&&!a?t.slice(0,Xe)+"…":t,c=s==="light";return e.jsxs("div",{className:`px-4 py-2 ${c?"border-b border-gray-200 bg-gray-50":"border-b border-[#3d3d3d] bg-[#252525]"}`,children:[e.jsx("span",{className:"text-[9px] font-semibold uppercase tracking-wider text-gray-500",children:"User Prompt"}),e.jsxs("p",{className:`text-[11px] mt-0.5 mb-0 leading-relaxed ${c?"text-gray-600":"text-gray-400"}`,children:[d,h&&e.jsx("button",{onClick:()=>i(!a),className:`ml-1 text-[11px] font-medium bg-transparent border-none p-0 cursor-pointer ${c?"text-blue-500 hover:text-blue-700":"text-[#00a0c4] hover:text-[#00c0e8]"}`,children:a?"Show less":"Read more…"})]})]})}function Qe({status:t}){const s={new:{label:"New",bg:"bg-green-900/40",text:"text-green-400",border:"border-green-700/50"},edited:{label:"Edited",bg:"bg-blue-900/40",text:"text-blue-400",border:"border-blue-700/50"},impacted:{label:"Impacted",bg:"bg-amber-900/40",text:"text-amber-400",border:"border-amber-700/50"}}[t.status];return e.jsx("span",{className:`${s.bg} ${s.text} ${s.border} border text-[8px] font-bold px-1 py-0 rounded-full uppercase tracking-wider`,children:s.label})}function es({testFile:t,entityName:s}){const{results:a,isRunning:i,runTests:h}=Re(t);if(i&&!a)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-[#00a0c4] animate-pulse"}),e.jsx("span",{className:"text-[10px] text-gray-500",children:"Running tests..."})]});if(!a)return null;if(a.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-400",children:a.errorMessage})});const d=s?a.testCases.filter(u=>u.fullName.startsWith(s)):a.testCases,c=d.length>0?d:a.testCases;if(c.length===0)return null;const x=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[c.map(u=>{var S;const k=x&&u.fullName.startsWith(x)?u.fullName.slice(x.length):u.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[u.status==="passed"?e.jsx("span",{className:"text-green-400 text-[10px]",children:"✓"}):u.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] ${u.status==="passed"?"text-green-400":u.status==="failed"?"text-red-400":"text-gray-500"}`,children:k})]}),u.status==="failed"&&((S=u.failureMessages)==null?void 0:S.map((N,w)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400/70 truncate max-w-full",title:N,children:N.split(`
4
+ `)[0]},w)))]},u.fullName)}),e.jsx("button",{onClick:h,disabled:i,className:"mt-1 text-[10px] text-[#00a0c4] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:i?"Running...":"Re-run"})]})}const ts={added:"text-green-400",untracked:"text-green-400",modified:"text-blue-400",renamed:"text-purple-400"};function ss({files:t}){return e.jsxs("div",{className:"border-t border-[#3d3d3d] pt-2 mt-1",children:[e.jsxs("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:["Modified Files (",t.length,")"]}),e.jsx("div",{className:"mt-1 space-y-0.5 max-h-[150px] overflow-auto",children:t.map(s=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold uppercase w-[14px] text-center ${ts[s.status]||"text-gray-500"}`,children:s.status==="added"||s.status==="untracked"?"A":s.status==="modified"?"M":s.status==="renamed"?"R":"?"}),e.jsx("span",{className:"text-[10px] text-gray-400 truncate font-mono",children:s.path})]},s.path))})]})}const as={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 ns(t){try{return new Date(t).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function rs(t){try{return new Date(t+"T00:00:00").toLocaleDateString([],{weekday:"long",month:"long",day:"numeric"})}catch{return t}}const is=[{value:"1d",label:"1 Day"},{value:"3d",label:"3 Days"},{value:"7d",label:"1 Week"},{value:"30d",label:"1 Month"}];function ls({entries:t,onScreenshotClick:s}){const[a,i]=n.useState(!1),[h,d]=n.useState("7d"),c=n.useMemo(()=>Xt(t,h),[t,h]);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("button",{onClick:()=>i(!a),className:"w-full flex items-center justify-between px-3 py-2.5 cursor-pointer bg-transparent border-none text-left hover:bg-[#333] transition-colors",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider",children:"Timeframe Summary"}),e.jsx("span",{className:`text-gray-500 text-[10px] transition-transform ${a?"rotate-180":""}`,children:"▼"})]}),a&&e.jsxs("div",{className:"px-3 pb-3 space-y-3 border-t border-[#3d3d3d]",children:[e.jsx("div",{className:"flex gap-1 pt-2.5",children:is.map(x=>e.jsx("button",{onClick:()=>d(x.value),className:`px-2.5 py-1 text-[10px] font-medium rounded transition-colors cursor-pointer border ${h===x.value?"bg-[#005c75] text-white border-[#005c75]":"bg-transparent text-gray-400 border-[#4d4d4d] hover:text-white hover:border-[#005c75]"}`,children:x.label},x.value))}),e.jsxs("div",{className:"flex items-center gap-3 text-[11px] text-gray-400",children:[e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:c.commitCount})," ",c.commitCount===1?"commit":"commits"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:c.totalScenarios})," ",c.totalScenarios===1?"scenario changed":"scenarios changed"]}),e.jsx("span",{className:"text-[#3d3d3d]",children:"|"}),e.jsxs("span",{children:[e.jsx("span",{className:"text-white font-medium",children:c.entryCount})," ",c.entryCount===1?"entry":"entries"]})]}),c.totalScenarios===0?e.jsx("p",{className:"text-[11px] text-gray-500 italic m-0",children:"No scenario changes in this period."}):e.jsxs("div",{className:"space-y-3",children:[c.appScenarios.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),c.appScenarios.map(x=>e.jsx(Ze,{scenario:x,onScreenshotClick:s},x.name))]}),c.componentGroups.size>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),[...c.componentGroups.entries()].sort(([x],[u])=>x.localeCompare(u)).map(([x,u])=>e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:x}),u.map(k=>e.jsx(Ze,{scenario:k,onScreenshotClick:s},k.name))]},x))]})]})]})]})}function Ze({scenario:t,onScreenshotClick:s}){const a=t.name.indexOf(" - "),i=a!==-1?t.name.slice(a+3):t.name;return e.jsxs("div",{className:"pl-2",children:[e.jsx("span",{className:"text-[10px] text-gray-500 block mb-1",children:i}),e.jsx("div",{className:"flex items-center gap-1 overflow-x-auto",children:t.screenshots.map((h,d)=>e.jsxs("div",{className:"flex items-center shrink-0",children:[d>0&&e.jsx("span",{className:"text-[8px] text-gray-600 mx-0.5",children:"→"}),e.jsx("button",{type:"button",className:"w-16 h-16 rounded overflow-hidden border border-[#3d3d3d] hover:border-[#00a0c4] bg-[#1e1e1e] shrink-0 flex items-center justify-center cursor-pointer transition-colors",title:`${t.name} (${new Date(h.time).toLocaleDateString()})`,onClick:()=>s==null?void 0:s({screenshotUrl:`/api/editor-journal-image/${h.path.replace("screenshots/","")}`,commitSha:null,commitMessage:null,scenarioName:t.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${h.path.replace("screenshots/","")}`,alt:t.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})})]},h.path))})]})}function os({isActive:t,onScreenshotClick:s,glossaryFunctions:a=[]}){const[i,h]=n.useState([]),[d,c]=n.useState(!0),[x,u]=n.useState(new Set),k=n.useCallback(w=>{u(E=>{const v=new Set(E);return v.has(w)?v.delete(w):v.add(w),v})},[]),S=n.useCallback(async()=>{try{const w=await fetch("/api/editor-journal");if(w.ok){const E=await w.json();h(E.entries||[])}}catch{}finally{c(!1)}},[]);if(n.useEffect(()=>{S()},[S]),n.useEffect(()=>{t&&S()},[t,S]),n.useEffect(()=>{if(!t)return;const w=setInterval(()=>void S(),5e3);return()=>clearInterval(w)},[t,S]),d)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 N=Qt(i);return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-3 space-y-4",children:[e.jsx(ls,{entries:i,onScreenshotClick:s}),[...N.entries()].map(([w,E])=>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:rs(w)})}),e.jsx("div",{className:"space-y-2",children:E.map((v,D)=>{const O=as[v.type]||{label:v.type,color:"bg-gray-600"},R=`${v.time}-${D}`,F=x.has(R);return e.jsxs("div",{className:"bg-[#2d2d2d] rounded-lg overflow-hidden",children:[e.jsxs("div",{className:`p-3 space-y-2 ${F?"":"max-h-[300px] overflow-y-auto"}`,children:[e.jsx("div",{className:"flex items-start gap-2 cursor-pointer",onClick:()=>k(R),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:v.title}),e.jsx("span",{className:`${O.color} text-white text-[9px] font-bold px-1.5 py-0.5 rounded uppercase tracking-wider shrink-0`,children:O.label})]}),e.jsx("span",{className:"text-[10px] text-gray-500",children:ns(v.time)}),v.featureName&&e.jsx("span",{className:"text-[10px] text-gray-500 italic truncate",title:v.featureName,children:v.featureName})]})}),v.userPrompt&&e.jsx(ot,{text:v.userPrompt,theme:"dark"}),e.jsx("p",{className:"text-xs text-gray-400 leading-relaxed",children:v.description}),v.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/${v.screenshot.replace("screenshots/","")}`,commitSha:v.commitSha,commitMessage:v.commitMessage,scenarioName:v.title}),children:e.jsx("img",{src:`/api/editor-journal-image/${v.screenshot.replace("screenshots/","")}`,alt:v.title,className:"max-w-full max-h-full object-contain",loading:"lazy"})}),v.scenarioScreenshots&&v.scenarioScreenshots.length>0&&(()=>{const P=Zt(v.scenarioScreenshots),I=v.entityChangeStatus,_=P.filter(([p])=>p==="App").flatMap(([,p])=>p),f=P.filter(([p])=>p!=="App"),l=new Map;for(const p of _){const o=Q(p.url??null),y=l.get(o)||[];y.push(p),l.set(o,y)}const j=[...l.entries()],m=p=>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/${p.path.replace("screenshots/","")}`,commitSha:v.commitSha,commitMessage:v.commitMessage,scenarioName:p.name}),children:e.jsx("img",{src:`/api/editor-journal-image/${p.path.replace("screenshots/","")}`,alt:p.name,title:p.name,className:"max-w-full max-h-full object-contain",loading:"lazy"})},p.path);return e.jsxs("div",{className:"space-y-2",children:[j.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),j.map(([p,o])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:p}),(I==null?void 0:I[p])&&e.jsx(Qe,{status:I[p]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:o.map(m)})]},p))]}),f.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),f.map(([p,o])=>e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] font-medium text-gray-400",children:p}),(I==null?void 0:I[p])&&e.jsx(Qe,{status:I[p]})]}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-0.5",children:o.map(m)})]},p))]})]})})(),a.length>0&&e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("span",{className:"text-[10px] font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),e.jsx("div",{className:"space-y-2",children:a.map(P=>e.jsxs("div",{children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-200",children:P.name}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate block",children:P.filePath}),P.testFile?e.jsx(es,{testFile:P.testFile,entityName:P.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-500",children:"No test file"})})]},P.name))})]}),v.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:v.commitSha.slice(0,7)}),e.jsx("span",{className:"text-gray-500 truncate",children:v.commitMessage})]}),F&&v.modifiedFiles&&v.modifiedFiles.length>0&&e.jsx(ss,{files:v.modifiedFiles})]}),e.jsxs("button",{onClick:()=>k(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:["——— ",F?"Collapse":"Expand"," ———"]})]},R)})})]},w))]})})}const et=()=>e.jsx("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",className:"text-gray-500 shrink-0",children:e.jsx("path",{d:"M4.5 3L7.5 6L4.5 9",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})});function cs(t,s){if(t.length<=s)return t;const a=s-2;return[t[0],"ellipsis",...t.slice(t.length-a)]}function ds({items:t,onNavigate:s}){if(t.length===0)return null;const a=cs(t,4);return e.jsx("nav",{className:"flex items-center gap-1 text-xs min-w-0",children:a.map((i,h)=>{if(i==="ellipsis")return e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(et,{}),e.jsx("span",{className:"text-gray-500",children:"..."})]},"ellipsis");const d=h===a.length-1;return e.jsxs("span",{className:"flex items-center gap-1 min-w-0",children:[h>0&&e.jsx(et,{}),d?e.jsx("span",{className:"text-white font-medium truncate",children:i.name}):e.jsx("button",{onClick:()=>s(i.componentName),className:"text-gray-400 hover:text-white transition-colors cursor-pointer bg-transparent border-none p-0 truncate",children:i.name})]},i.componentName||"app")})})}function re({imgSrc:t,name:s,isActive:a,onSelect:i}){return e.jsxs("button",{onClick:i,className:"flex flex-col items-center gap-1 cursor-pointer group w-full",title:s,children:[e.jsx("div",{className:`w-full aspect-square rounded overflow-hidden border-2 transition-all bg-[#1a1a1a] ${a?"border-[#005c75] ring-1 ring-[#005c75]":"border-transparent hover:border-[#4d4d4d]"}`,children:t?e.jsx("img",{src:t,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-full ${a?"text-white":"text-gray-500 group-hover:text-gray-300"}`,children:s})]})}function de({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-500 hover:text-gray-300 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",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"})})]}),e.jsx(Ee,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-500 hover:text-gray-300 transition-colors"})]}):null}function xs({hasProject:t,scenarios:s,analyzedEntities:a,glossaryFunctions:i=[],glossaryEntries:h=[],projectRoot:d,activeScenarioId:c,onScenarioSelect:x,onAnalyzedScenarioSelect:u,onSwitchToBuild:k,zoomComponent:S,onZoomChange:N,entityImports:w,pageFilePaths:E={},projectTitle:v,projectDescription:D,breadcrumbItems:O=[]}){const{pageGroups:R,componentGroups:F}=n.useMemo(()=>{var y;const m=new Map,p=new Map;for(const C of s)if(C.componentName){const A=p.get(C.componentName)||[];A.push(C),p.set(C.componentName,A)}else if($e(C.url)){const A=(y=C.url)==null?void 0:y.match(/[?&]c=([^&]+)/),z=A?decodeURIComponent(A[1]):"Isolated",H=p.get(z)||[];H.push(C),p.set(z,H)}else{const A=Q(C.url),z=m.get(A)||[];z.push(C),m.set(A,z)}const o=new Map([...p.entries()].sort(([C],[A])=>C.localeCompare(A)));return{pageGroups:m,componentGroups:o}},[s]),P=n.useMemo(()=>a.filter(m=>m.entityType==="visual").sort((m,p)=>m.name.localeCompare(p.name)),[a]),I=n.useMemo(()=>{const m=new Map;for(const p of i)m.set(p.name,p);return m},[i]),_=n.useRef(null),f=n.useRef(0),l=n.useCallback(()=>{_.current&&(f.current=_.current.scrollTop)},[]);if(n.useEffect(()=>{_.current&&f.current>0&&(_.current.scrollTop=f.current)}),!t)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:k,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(!(s.length>0||P.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:[v?e.jsxs(e.Fragment,{children:[e.jsx("h2",{className:"text-lg font-medium text-white font-['IBM_Plex_Sans'] m-0",children:v}),D&&e.jsx("p",{className:"text-sm text-gray-400 m-0 font-['IBM_Plex_Sans'] leading-relaxed",children:D})]}):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",children:"Describe what you want to build in the Chat and your pages and components will appear here."}),e.jsx("button",{onClick:k,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(S){const m=R.get(S)||[],p=F.get(S)||[],o=P.find(g=>g.name===S),y=I.get(S),C=[...m,...p],A=new Set((w==null?void 0:w[S])||[]),z=A.size>0,H=z?[...F.entries()].filter(([g])=>A.has(g)):[],Z=z?P.filter(g=>A.has(g.name)&&!H.some(([T])=>T===g.name)):[],q=z?h.filter(g=>A.has(g.name)&&g.returnType!=="JSX.Element"&&g.returnType!=="React.ReactNode").map(g=>({name:g.name,filePath:g.filePath,description:g.description||"",testFile:g.testFile,feature:g.feature})):[],ie=H.length>0||Z.length>0,le=q.length>0,me=ie||le;return e.jsx("div",{className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-3",children:[e.jsx(ds,{items:O,onNavigate:N}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-white m-0 font-['IBM_Plex_Sans'] uppercase tracking-wider",children:S}),(()=>{const g=(y==null?void 0:y.filePath)||(o==null?void 0:o.filePath)||E[S];return g?e.jsx(de,{filePath:g,projectRoot:d}):null})()]}),C.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2",children:C.map(g=>e.jsx(re,{imgSrc:g.screenshotPath?`/api/editor-scenario-image/${g.id}.png${g.updatedAt?`?v=${encodeURIComponent(g.updatedAt)}`:""}`:null,name:g.name,isActive:g.id===c,onSelect:()=>x(g)},g.id))}),o&&(o.scenarios.length>0||o.pendingScenarios.length>0)&&e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.scenarios.map(g=>e.jsx(re,{imgSrc:g.screenshotPath?`/api/screenshot/${g.screenshotPath}`:null,name:g.name,isActive:!1,onSelect:()=>u({analysisId:o.analysisId,scenarioId:g.id,scenarioName:g.name,entitySha:o.sha,entityName:o.name})},g.id)),o.pendingScenarios.map(g=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:g,children:g},g))]}),y&&e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:"text-[10px] text-gray-500",children:"Tests:"}),e.jsx(de,{filePath:y.testFile,projectRoot:d})]}),C.length===0&&!o&&!y&&e.jsx("div",{className:"text-xs text-gray-500",children:"No scenarios for this entity"}),me&&e.jsxs("div",{className:"pt-3 mt-2 border-t border-[#3d3d3d] space-y-3",children:[ie&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Components"}),H.map(([g,T])=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>N(g),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:g})}),T.length>0&&e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:T.map(L=>e.jsx(re,{imgSrc:L.screenshotPath?`/api/editor-scenario-image/${L.id}.png${L.updatedAt?`?v=${encodeURIComponent(L.updatedAt)}`:""}`:null,name:L.name,isActive:L.id===c,onSelect:()=>x(L)},L.id))})]},g)),Z.map(g=>e.jsxs("div",{className:"mt-3",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>N(g.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:g.name})}),(g.scenarios.length>0||g.pendingScenarios.length>0)&&e.jsxs("div",{className:"grid grid-cols-3 gap-2 pt-1",children:[g.scenarios.map(T=>e.jsx(re,{imgSrc:T.screenshotPath?`/api/screenshot/${T.screenshotPath}`:null,name:T.name,isActive:!1,onSelect:()=>u({analysisId:g.analysisId,scenarioId:T.id,scenarioName:T.name,entitySha:g.sha,entityName:g.name})},T.id)),g.pendingScenarios.map(T=>e.jsx("div",{className:"px-2.5 py-1 bg-[#2a2a2a] text-gray-400 text-[10px] rounded-full",title:T,children:T},T))]})]},g.sha))]}),le&&e.jsxs("div",{children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Functions"}),q.map(g=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>N(g.name),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:g.name})}),e.jsx(de,{filePath:g.filePath,projectRoot:d}),g.testFile&&e.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5",children:[e.jsx("span",{className:"text-[9px] text-gray-600",children:"test:"}),e.jsx("span",{className:"text-[9px] text-gray-500 truncate",children:g.testFile})]})]},g.name))]})]})]})})}return e.jsx("div",{ref:_,onScroll:l,className:"flex-1 overflow-auto",children:e.jsxs("div",{className:"p-4 space-y-4",children:[v&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-base font-semibold text-white m-0 font-['IBM_Plex_Sans']",children:v}),D&&e.jsx("p",{className:"text-xs text-gray-400 m-0 mt-1 font-['IBM_Plex_Sans'] leading-relaxed",children:D})]}),R.size>0&&e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Application"}),e.jsx("button",{onClick:k,className:"px-2.5 py-1 text-[10px] font-medium text-gray-400 bg-[#2a2a2a] border border-[#4d4d4d] rounded hover:bg-[#333] hover:text-white hover:border-[#005c75] transition-colors cursor-pointer",children:"+ New Page"})]}),e.jsxs("p",{className:"text-[11px] text-gray-500 m-0 mt-1.5 font-['IBM_Plex_Sans'] leading-relaxed",children:["Select a page scenario below and switch to"," ",e.jsx("button",{onClick:k,className:"text-[#00a0c4] hover:text-[#00c4eb] bg-transparent border-none p-0 cursor-pointer underline font-inherit text-inherit",children:"Build"})," ","to change or enhance an existing page or"," ",e.jsx("button",{onClick:k,className:"text-[#00a0c4] hover:text-[#00c4eb] bg-transparent border-none p-0 cursor-pointer underline font-inherit text-inherit",children:"create a new page"})]}),[...R.entries()].sort(([m],[p])=>m==="Home"?-1:p==="Home"?1:m.localeCompare(p)).map(([m,p])=>e.jsxs("div",{className:"mt-2",children:[e.jsx("div",{className:"py-1",children:e.jsx("button",{onClick:()=>N(m),className:"text-[11px] font-medium text-gray-400 cursor-pointer hover:text-white transition-colors bg-transparent border-none p-0",children:m})}),E[m]&&e.jsx(de,{filePath:E[m],projectRoot:d}),e.jsx("div",{className:"grid grid-cols-3 gap-2 pt-1",children:p.map(o=>e.jsx(re,{imgSrc:o.screenshotPath?`/api/editor-scenario-image/${o.id}.png${o.updatedAt?`?v=${encodeURIComponent(o.updatedAt)}`:""}`:null,name:o.name,isActive:o.id===c,onSelect:()=>x(o)},o.id))})]},m))]})]})})}const tt={new:0,edited:1,impacted:2};function st({status:t,onClick:s}){const a={new:{label:"New",bg:"bg-green-100",text:"text-green-700",border:"border-green-200"},edited:{label:"Edited",bg:"bg-blue-100",text:"text-blue-700",border:"border-blue-200"},impacted:{label:"Impacted",bg:"bg-amber-100",text:"text-amber-700",border:"border-amber-200"}}[t.status],i=s&&(t.status==="edited"||t.status==="impacted");return e.jsx("button",{onClick:i?s:void 0,className:`${a.bg} ${a.text} ${a.border} border text-[9px] font-bold px-1.5 py-0.5 rounded-full uppercase tracking-wider shrink-0 ${i?"cursor-pointer hover:opacity-80 transition-opacity":"cursor-default"}`,children:a.label})}function at({filePath:t}){const[s,a]=n.useState(null),[i,h]=n.useState(!0),[d,c]=n.useState(null);return n.useEffect(()=>{Gt(()=>import("./index-yHOVb4rc.js"),__vite__mapDeps([0,1])).then(x=>{c(()=>x.default)})},[]),n.useEffect(()=>{h(!0),fetch(`/api/editor-file-diff?path=${encodeURIComponent(t)}`).then(x=>x.json()).then(x=>{a({oldContent:x.oldContent,newContent:x.newContent})}).catch(()=>{a(null)}).finally(()=>h(!1))},[t]),i?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Loading diff..."}):!s||!d?e.jsx("div",{className:"p-2 text-[10px] text-gray-400",children:"Could not load diff"}):e.jsx("div",{className:"mt-2 border border-gray-200 rounded-lg overflow-hidden max-h-[300px] overflow-auto text-xs",children:e.jsx(d,{oldValue:s.oldContent,newValue:s.newContent,splitView:!1,useDarkTheme:!1,showDiffOnly:!0,styles:{contentText:{fontSize:"11px",lineHeight:"1.4"},line:{padding:"1px 8px",fontSize:"11px"}}})})}function nt({impactedBy:t,changedEntities:s}){return e.jsx("div",{className:"mt-2 bg-amber-50 border border-amber-200 rounded-lg p-2.5",children:t&&t.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Re-captured because these dependencies changed"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:t.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${a.changeType==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:a.changeType==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:a.name}),e.jsx("span",{className:"text-[9px] text-amber-500 truncate",children:a.filePath})]},a.filePath))})]}):s&&s.length>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-[10px] font-semibold text-amber-700 uppercase tracking-wider",children:"Unchanged — these entities were modified in this session"}),e.jsx("ul",{className:"mt-1.5 space-y-1",children:s.map(a=>e.jsxs("li",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold px-1 py-0 rounded-full uppercase tracking-wider border ${a.status==="new"?"bg-green-100 text-green-700 border-green-200":"bg-blue-100 text-blue-700 border-blue-200"}`,children:a.status==="new"?"New":"Edited"}),e.jsx("span",{className:"text-[11px] font-medium text-amber-800",children:a.name})]},a.name))})]}):e.jsx("span",{className:"text-[10px] text-amber-600",children:"This component was re-captured because a dependency changed"})})}function rt({scenarioId:t,name:s,isActive:a,onSelect:i,updatedAt:h}){const[d,c]=n.useState(!1);n.useEffect(()=>{c(!1)},[t]);const x=`/api/editor-scenario-image/${t}.png${h?`?v=${encodeURIComponent(h)}`:""}`;return e.jsxs("button",{onClick:i,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 ${a?"border-[#0ea5e9] ring-2 ring-[#0ea5e9]/40 shadow-lg shadow-[#0ea5e9]/20":"border-gray-200 hover:border-gray-400 shadow-sm"}`,children:d?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:x,alt:s,className:"w-full h-full object-contain bg-white",loading:"lazy",onError:()=>c(!0)})}),e.jsx("span",{className:`text-[11px] leading-tight text-center truncate w-32 font-medium ${a?"text-gray-900":"text-gray-600 group-hover:text-gray-900"}`,children:s})]})}function ms({filePath:t}){return t?e.jsxs("div",{className:"flex items-center gap-1 mt-0.5",children:[e.jsxs("a",{href:`/api/editor-file?path=${encodeURIComponent(t)}`,target:"_blank",rel:"noopener noreferrer",title:"Open file",className:"flex items-center gap-1 text-gray-400 hover:text-gray-600 transition-colors min-w-0",children:[e.jsx("span",{className:"text-[9px] truncate",children:t}),e.jsx("svg",{className:"shrink-0",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"})})]}),e.jsx(Ee,{content:t,icon:!0,iconSize:10,className:"shrink-0 text-gray-400 hover:text-gray-600 transition-colors"})]}):null}function ps({testFile:t,entityName:s}){const{results:a,isRunning:i,runTests:h}=Re(t);if(i&&!a)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(!a)return null;if(a.status==="error")return e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-red-500",children:a.errorMessage})});const d=s?a.testCases.filter(u=>u.fullName.startsWith(s)):a.testCases,c=d.length>0?d:a.testCases;if(c.length===0)return null;const x=s?`${s} > `:"";return e.jsxs("div",{className:"pt-1 space-y-0.5",children:[c.map(u=>{var S;const k=x&&u.fullName.startsWith(x)?u.fullName.slice(x.length):u.fullName;return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[u.status==="passed"?e.jsx("span",{className:"text-green-600 text-[10px]",children:"✓"}):u.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] ${u.status==="passed"?"text-green-600":u.status==="failed"?"text-red-500":"text-gray-400"}`,children:k})]}),u.status==="failed"&&((S=u.failureMessages)==null?void 0:S.map((N,w)=>e.jsx("div",{className:"pl-4 text-[9px] text-red-400 truncate max-w-full",title:N,children:N.split(`
5
+ `)[0]},w)))]},u.fullName)}),e.jsx("button",{onClick:h,disabled:i,className:"mt-1 text-[10px] text-[#0ea5e9] hover:text-[#38bdf8] transition-colors cursor-pointer disabled:opacity-50 bg-transparent border-none p-0",children:i?"Running...":"Re-run"})]})}function it(t){const s=t.indexOf(" - ");return s!==-1?t.slice(s+3):t}function lt(t,s){return!s||Object.keys(s).length===0?t:[...t].sort(([a],[i])=>{var x,u;const h=((x=s[a])==null?void 0:x.status)||"impacted",d=((u=s[i])==null?void 0:u.status)||"impacted",c=(tt[h]??2)-(tt[d]??2);return c!==0?c:a.localeCompare(i)})}function us({scenarios:t,allScenarios:s=[],glossaryFunctions:a=[],projectRoot:i,activeScenarioId:h,onScenarioSelect:d,onClose:c,entityChangeStatus:x={},modifiedFiles:u=[],featureName:k,userPrompt:S}){const N=n.useMemo(()=>{if(s.length===0||Object.keys(x).length===0)return t;const l=new Set(t.map(m=>m.id)),j=s.filter(m=>{var o;if(l.has(m.id))return!1;const p=m.componentName||Q(m.url);return((o=x[p])==null?void 0:o.status)==="impacted"});return j.length===0?t:[...t,...j]},[t,s,x]),w=n.useMemo(()=>Object.entries(x).filter(([,l])=>l.status==="new"||l.status==="edited").map(([l,j])=>({name:l,status:j.status})),[x]),[E,v]=n.useState(null),D=n.useCallback(l=>{v(j=>j===l?null:l)},[]),{pageGroups:O,componentGroups:R}=n.useMemo(()=>{var m;const l=new Map,j=new Map;for(const p of N)if(p.componentName){const o=j.get(p.componentName)||[];o.push(p),j.set(p.componentName,o)}else if($e(p.url)){const o=(m=p.url)==null?void 0:m.match(/[?&]c=([^&]+)/),y=o?decodeURIComponent(o[1]):"Isolated",C=j.get(y)||[];C.push(p),j.set(y,C)}else{const o=Q(p.url),y=l.get(o)||[];y.push(p),l.set(o,y)}return{pageGroups:l,componentGroups:j}},[N]),F=n.useMemo(()=>lt([...O.entries()],x),[O,x]),P=n.useMemo(()=>lt([...R.entries()],x),[R,x]),I=F,_=P,f=n.useMemo(()=>qt(a,x),[a,x]);return N.length===0&&a.length===0?e.jsxs("div",{className:"h-full bg-white flex items-center justify-center relative",children:[e.jsx("button",{onClick:c,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.jsxs("div",{className:"min-w-0",children:[e.jsx("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:"Working Session Results"}),k&&e.jsx("div",{className:"text-[11px] text-gray-400 truncate",title:k,children:k})]}),e.jsx("button",{onClick:c,className:"text-gray-400 hover:text-gray-700 text-lg leading-none cursor-pointer bg-transparent border-none shrink-0",title:"Close results",children:"×"})]}),S&&e.jsx(ot,{text:S,theme:"light"}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsxs("div",{className:"space-y-5",children:[I.length>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:I.map(([l,j])=>{var y;const m=x[l],p=E===l,o=(y=j[0])==null?void 0:y.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:l}),m&&e.jsx(st,{status:m,onClick:()=>D(l)})]}),p&&(m==null?void 0:m.status)==="edited"&&o&&e.jsx(at,{filePath:o}),p&&(m==null?void 0:m.status)==="impacted"&&e.jsx(nt,{impactedBy:m.impactedBy,changedEntities:w}),e.jsx("div",{className:"flex flex-wrap gap-3",children:j.map(C=>e.jsx(rt,{scenarioId:C.id,name:it(C.name),isActive:C.id===h,onSelect:()=>d(C),updatedAt:C.updatedAt},C.id))})]},l)})})]}),_.length>0&&e.jsxs("div",{className:I.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:"Components"})}),e.jsx("div",{className:"space-y-3 pl-1",children:_.map(([l,j])=>{var y;const m=x[l],p=E===l,o=(y=j[0])==null?void 0:y.componentPath;return e.jsxs("div",{children:[e.jsxs("div",{className:"mb-1.5 flex items-center gap-2",children:[e.jsx("span",{className:"text-[11px] font-medium text-gray-600",children:l}),m&&e.jsx(st,{status:m,onClick:()=>D(l)})]}),p&&(m==null?void 0:m.status)==="edited"&&o&&e.jsx(at,{filePath:o}),p&&(m==null?void 0:m.status)==="impacted"&&e.jsx(nt,{impactedBy:m.impactedBy,changedEntities:w}),e.jsx("div",{className:"flex flex-wrap gap-3",children:j.map(C=>e.jsx(rt,{scenarioId:C.id,name:it(C.name),isActive:C.id===h,onSelect:()=>d(C),updatedAt:C.updatedAt},C.id))})]},l)})})]}),f.length>0&&e.jsxs("div",{className:I.length>0||_.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:f.map(l=>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:l.name})}),e.jsx(ms,{filePath:l.filePath,projectRoot:i}),l.testFile?e.jsx(ps,{testFile:l.testFile,entityName:l.name}):e.jsx("div",{className:"pt-1",children:e.jsx("span",{className:"text-[10px] text-gray-400",children:"No test file"})})]},l.name))})]}),u.length>0&&e.jsxs("div",{className:I.length>0||_.length>0||f.length>0?"pt-3 border-t border-gray-200":"",children:[e.jsx("div",{className:"mb-2",children:e.jsxs("span",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider",children:["Modified Files (",u.length,")"]})}),e.jsx("div",{className:"space-y-0.5 pl-1 max-h-[200px] overflow-auto",children:u.map(l=>e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("span",{className:`text-[9px] font-bold uppercase w-[14px] text-center ${l.status==="added"||l.status==="untracked"?"text-green-600":l.status==="modified"?"text-blue-600":l.status==="renamed"?"text-purple-600":"text-gray-400"}`,children:l.status==="added"||l.status==="untracked"?"A":l.status==="modified"?"M":l.status==="renamed"?"R":"?"}),e.jsx("span",{className:"text-[10px] text-gray-500 truncate font-mono",children:l.path})]},l.path))})]})]})})]})}const hs=[{key:"app",label:"App"},{key:"build",label:"Build"},{key:"data",label:"Structure"},{key:"journal",label:"Journal"}];function fs({activeTab:t,onTabChange:s,buildIdle:a,zoomComponent:i,breadcrumbItems:h,onBreadcrumbNavigate:d,panelLayout:c,onToggleExpand:x}){return e.jsxs("div",{className:"bg-[#3d3d3d] h-10 flex items-center px-3 gap-3 shrink-0 z-20 border-b border-[#2d2d2d]",children:[e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("img",{src:Jt,alt:"CodeYam",className:"h-5 brightness-0 invert"}),e.jsx("span",{className:"text-white font-medium text-xs whitespace-nowrap",children:"Codeyam Editor"})]}),e.jsx("div",{className:"flex-1"}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("div",{className:"flex items-center gap-0.5 bg-[#4a3232] rounded-lg p-0.5",children:hs.map(u=>e.jsxs("button",{onClick:()=>s(u.key),className:`px-2.5 py-1 text-xs font-medium rounded-md transition-colors cursor-pointer ${t===u.key?"bg-[#7a4444] text-white":"text-gray-300 hover:text-white"}`,children:[u.label,u.key==="build"&&a&&t!=="build"&&e.jsx("span",{className:"ml-1 inline-block w-1.5 h-1.5 rounded-full bg-amber-400 animate-pulse"})]},u.key))}),x&&e.jsx("button",{onClick:x,className:"p-1.5 rounded text-gray-400 hover:text-white transition-colors cursor-pointer",title:c==="editor-only"?"Show preview":"Hide preview",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:c==="editor-only"?e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"}),e.jsx("path",{d:"M16 15l-3-3 3-3"})]}):e.jsxs(e.Fragment,{children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"}),e.jsx("path",{d:"M14 9l3 3-3 3"})]})})})]})]})}function gs({preview:t,onDismiss:s,onLoadCommit:a}){return 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:t.screenshotUrl,alt:t.scenarioName,className:"max-w-full h-auto block"})}),e.jsxs("div",{className:"flex items-center gap-2 text-sm text-[#666]",children:[t.commitSha&&e.jsx("span",{className:"font-mono text-xs text-[#00a0c4] bg-[#00a0c4]/15 px-2 py-0.5 rounded",children:t.commitSha.slice(0,7)}),e.jsxs("span",{className:"truncate",children:[t.scenarioName,t.commitMessage&&` — ${t.commitMessage}`]})]}),e.jsx("div",{className:"flex items-center gap-3",children:t.commitSha&&a&&e.jsx(js,{commitSha:t.commitSha,onLoadCommit:a})})]})}function js({commitSha:t,onLoadCommit:s}){const[a,i]=n.useState(!1),[h,d]=n.useState(null);return e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>{i(!0),d(null),s(t).then(c=>{c.success||d(c.error||"Failed to load commit")}).catch(c=>{d(c instanceof Error?c.message:"Network error")}).finally(()=>i(!1))},disabled:a,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:a?"Reverting...":"Revert to this code and load this version"}),h&&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:h})]})}function vs({analysisId:t,scenarioId:s,scenarioName:a,entityName:i,projectSlug:h,onStateChange:d}){const{interactiveServerUrl:c,isStarting:x,isLoading:u}=Vt({analysisId:t,scenarioId:s,scenarioName:a,entityName:i,projectSlug:h,enabled:!0});return n.useEffect(()=>{d(c,x||u)},[c,x,u,d]),null}function bs(t,s){return s.status==="error"?{url:null,proxyUrl:null,isStarting:!1,error:s.errorMessage||"Dev server crashed",canStartServer:t.canStartServer,autoStartAttempted:t.autoStartAttempted,shouldAutoStart:!1}:s.url?{url:s.url,proxyUrl:s.proxyUrl||null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:t.autoStartAttempted,shouldAutoStart:!1}:s.status==="starting"?{...t,isStarting:!0,error:null,canStartServer:!0,shouldAutoStart:!1}:s.status==="stopped"?t.url?{...t,url:null,isStarting:!1,shouldAutoStart:!1}:t.autoStartAttempted?{...t,isStarting:!1,shouldAutoStart:!1}:{...t,autoStartAttempted:!0,shouldAutoStart:!0}:{...t,shouldAutoStart:!1}}function Ns(){const[t,s]=n.useState({url:null,proxyUrl:null,isStarting:!1,error:null,canStartServer:!0,autoStartAttempted:!1}),a=n.useRef(t);a.current=t,n.useEffect(()=>{let d=!1,c=null;const x=async()=>{try{const u=await fetch("/api/editor-dev-server");if(d)return;const k=await u.json(),S=bs(a.current,k),{shouldAutoStart:N,...w}=S;if(s(w),N)try{const E=await fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})});if(d)return;E.ok?s(v=>({...v,isStarting:!0})):s(v=>({...v,canStartServer:!1}))}catch{}}catch{}};return x(),c=setInterval(()=>void x(),2e3),()=>{d=!0,c&&clearInterval(c)}},[t.url]);const i=n.useCallback(()=>{s(d=>({...d,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"restart"})}).catch(()=>{})},[]),h=n.useCallback(()=>{s(d=>({...d,error:null,isStarting:!0})),fetch("/api/editor-dev-server",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"start"})}).catch(()=>{})},[]);return{devServerUrl:t.url,proxyUrl:t.proxyUrl,isStarting:t.isStarting,error:t.error,canStartServer:t.canStartServer,retryServer:i,startServer:h}}function ys(t){const s=n.useRef(null),a=n.useRef(null);n.useEffect(()=>{if(typeof document>"u")return;a.current||(a.current=document.createElement("canvas"),a.current.width=64,a.current.height=64);const i=document.querySelector('link[rel="icon"]');if(!i)return;if(s.current||(s.current=i.href),!t){i.href=s.current;return}const h=new Image;h.crossOrigin="anonymous",h.onload=()=>{const d=a.current,c=d.getContext("2d");c.clearRect(0,0,64,64),c.drawImage(h,0,0,64,64);const x=18,u=64-x,k=x;c.beginPath(),c.arc(u,k,x+3,0,2*Math.PI),c.fillStyle="#ffffff",c.fill(),c.beginPath(),c.arc(u,k,x,0,2*Math.PI),c.fillStyle="#ef4444",c.fill(),i.href=d.toDataURL("image/png")},h.src=s.current},[t]),n.useEffect(()=>()=>{if(typeof document>"u")return;const i=document.querySelector('link[rel="icon"]');i&&s.current&&(i.href=s.current)},[])}const Bs=()=>[{title:"Editor - CodeYam"},{name:"description",content:"CodeYam Code + Data Editor"}];class ws extends n.Component{constructor(){super(...arguments);qe(this,"state",{error:null,errorInfo:null})}static getDerivedStateFromError(a){return{error:a,errorInfo:null}}componentDidCatch(a,i){console.error("[EditorErrorBoundary] Error:",a.message),console.error("[EditorErrorBoundary] Component stack:",i.componentStack),console.error("[EditorErrorBoundary] Loader snapshot:",JSON.stringify(this.props.loaderSnapshot,null,2)),this.setState({errorInfo:i})}render(){var a;return this.state.error?e.jsx("div",{className:"fixed inset-0 bg-[#1e1e1e] flex items-center justify-center p-8",children:e.jsxs("div",{className:"max-w-[600px] w-full space-y-4",children:[e.jsx("h2",{className:"text-lg font-semibold text-red-400 font-['IBM_Plex_Sans'] m-0",children:"Something went wrong"}),e.jsx("pre",{className:"text-xs text-gray-300 bg-[#2d2d2d] p-3 rounded overflow-auto max-h-[120px]",children:this.state.error.message}),((a=this.state.errorInfo)==null?void 0:a.componentStack)&&e.jsxs("details",{className:"text-xs text-gray-500",children:[e.jsx("summary",{className:"cursor-pointer hover:text-gray-300 transition-colors",children:"Component stack"}),e.jsx("pre",{className:"mt-2 bg-[#2d2d2d] p-3 rounded overflow-auto max-h-[200px] text-yellow-300",children:this.state.errorInfo.componentStack})]}),e.jsx("p",{className:"text-xs text-gray-500 m-0",children:"Full diagnostics are in the browser console."}),e.jsx("button",{onClick:()=>window.location.reload(),className:"px-4 py-2 bg-[#005c75] text-white text-sm rounded hover:bg-[#004d63] transition-colors cursor-pointer",children:"Reload"})]})}):this.props.children}}const As=Et(function(){const{projectSlug:s,projectRoot:a,hasProject:i,scenarios:h,allScenarios:d,analyzedEntities:c,glossaryFunctions:x,glossaryEntries:u,entityImports:k,pageFilePaths:S,entityChangeStatus:N,modifiedFiles:w,featureName:E,userPrompt:v,projectTitle:D,projectDescription:O,defaultScreenSize:R,screenSizes:F}=Rt(),[P,I]=$t(),_=n.useRef(null),f=n.useRef(null),l=n.useRef(null),j=P.get("zoom")||void 0,m=P.get("scenario")||void 0,[p,o]=n.useState(()=>{if(typeof window>"u")return[];const r=new URLSearchParams(window.location.search).get("zoom");return r?[r]:[]}),y=n.useRef(null),C=n.useRef([]),A=n.useRef(null);n.useEffect(()=>{var B;const r=m||((B=Bt(d))==null?void 0:B.id);if(!At(r,y.current))return;const b=d.find(V=>V.id===r);if(!b)return;y.current=r;const M=Me(b,C.current,A.current);M&&K(M);const $=ce(b.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:$,scenarioId:b.id,scenarioName:b.name,scenarioType:b.type})}).catch(()=>{})},[m,d]),n.useEffect(()=>{const r=new BroadcastChannel("codeyam-editor");return r.onmessage=b=>{var M;if(((M=b.data)==null?void 0:M.type)==="switch-scenario"&&b.data.scenarioId){const $=b.data.scenarioId,B=d.find(Pe=>Pe.id===$);if(!B)return;y.current=$;const V=new URLSearchParams(P);V.set("scenario",$),V.delete("zoom"),I(V),pe(null),oe(null),G(null),J(!0);const Pt=ce(B.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:Pt,scenarioId:$,scenarioType:B.type})}).then(()=>{te(Pe=>Pe+1)}).catch(()=>{J(!1)})}},()=>r.close()},[P,I,d]),n.useEffect(()=>{if(P.get("ref")!=="link"||!m)return;const r=new BroadcastChannel("codeyam-editor");r.postMessage({type:"switch-scenario",scenarioId:m}),r.close(),window.close()},[]);const{devServerUrl:z,proxyUrl:H,isStarting:Z,error:q,canStartServer:ie,retryServer:le,startServer:me}=Ns(),[g,T]=n.useState(!1),[L,pe]=n.useState(null),[Te,oe]=n.useState(null),[ue,Le]=n.useState(!1),[he,G]=n.useState(null),ct=n.useCallback(async r=>{const M=await(await fetch("/api/editor-load-commit",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({commitSha:r})})).json();return M.success&&(G(null),T(!1)),M},[]),dt=n.useCallback((r,b)=>{oe(M=>(r&&r!==M&&T(!1),r)),!b&&r&&T(!0),Le(b)},[]),Be=n.useCallback(r=>{G(null),pe(M=>(M&&M.analysisId===r.analysisId||(oe(null),te(B=>B+1)),r)),Le(!0),T(!1);const b=new URLSearchParams(P);b.delete("scenario"),b.delete("zoom"),I(b)},[P,I]),[U,K]=n.useState(R?{name:R.name,width:R.width,height:R.height}:{name:"Desktop",width:1440,height:900}),[Ae,_e]=n.useState(!1),De=R?{name:R.name,width:R.width,height:R.height}:null;A.current=De;const[W,fe]=n.useState("app"),xt=n.useCallback(()=>{fe("build"),ge(!0)},[]),[mt,ge]=n.useState(!1),[Oe,je]=n.useState(!1),pt=n.useCallback(r=>{je(r)},[]);ys(Oe);const[ee,Ue]=n.useState("split"),[ve,Fe]=n.useState(!1),ut=n.useCallback(()=>{Fe(!0),fe("build"),ge(!0)},[]),ze=n.useCallback(()=>{Fe(!1)},[]),ht=n.useCallback(r=>{K(r),fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultScreenSize:r,skipBroadcast:!0})})},[]),[We,He]=n.useState(_t);n.useEffect(()=>{const r=Dt();He(r),r.systemNotification&&typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission()},[]);const ft=n.useCallback(r=>{He(r),Ot(r)},[]);n.useEffect(()=>{if(W==="build"){je(!1);const r=setTimeout(()=>{var b,M;(b=_.current)==null||b.scrollToBottom(),(M=_.current)==null||M.focus()},50);return()=>clearTimeout(r)}},[W]),n.useEffect(()=>{function r(){!document.hidden&&W==="build"&&je(!1)}return document.addEventListener("visibilitychange",r),()=>document.removeEventListener("visibilitychange",r)},[W]);const[be,gt]=n.useState(null);n.useEffect(()=>{const r=l.current;if(!r)return;const b=new ResizeObserver(M=>{const $=M[0];$&&gt({width:$.contentRect.width,height:$.contentRect.height})});return b.observe(r),()=>b.disconnect()},[]);const X=n.useMemo(()=>be?Ut(be,U):1,[be,U]),[Ne,te]=n.useState(0),[Ge,ye]=n.useState(null),[Je,J]=n.useState(!1),jt=n.useCallback((r,b)=>{if(ye(r||null),b){const M=new URLSearchParams(P);M.set("scenario",b),y.current=b,I(M);const $=d.find(B=>B.id===b);if($){const B=Me($,C.current,A.current);B&&K(B)}}G(null),te(M=>M+1)},[P,I,d]),{customSizes:we,addCustomSize:vt,removeCustomSize:bt}=Tt(s),Se=n.useMemo(()=>Yt(F),[F]),ke=n.useMemo(()=>[...Se,...we],[Se,we]);C.current=ke;const Ve=n.useMemo(()=>{const r=[{name:"App"}];for(const b of p)r.push({name:b,componentName:b});return r},[p]),Ce=n.useCallback(r=>{const b=new URLSearchParams(P);if(r){b.set("zoom",r);const M=p.indexOf(r);M>=0?o(p.slice(0,M+1)):o([...p,r]);const $=d.find(B=>B.componentName===r||B.componentName===null&&Q(B.url)===r);if($){b.set("scenario",$.id),y.current=$.id,J(!0);const B=ce($.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:B,scenarioId:$.id,scenarioType:$.type})}).then(()=>{te(V=>V+1)}).catch(()=>{J(!1)})}else b.delete("scenario")}else b.delete("zoom"),b.delete("scenario"),o([]);I(b)},[P,I,d,p]),se=n.useCallback(r=>{pe(null),oe(null),G(null),ye(null);const b=Me(r,ke,De);b&&K(b),y.current=r.id;const M=new URLSearchParams(P);M.set("scenario",r.id),I(M),J(!0);const $=ce(r.name);fetch("/api/editor-switch-scenario",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({scenarioSlug:$,scenarioId:r.id,scenarioType:r.type,skipBroadcast:!0})}).then(()=>{te(B=>B+1)}).catch(()=>{J(!1)})},[P,I,ke]),Nt=n.useCallback(r=>{if(!r.commitSha){const b=d.find(M=>M.name===r.scenarioName);if(b){se(b);return}}G(r)},[d,se]),yt=r=>{const b={name:r.name,width:r.width,height:r.height};K(b),fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultScreenSize:b,skipBroadcast:!0})})},wt=(r,b,M)=>{vt(r,b,M)},St=r=>{K(r),fetch("/api/editor-project-info",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({defaultScreenSize:r,skipBroadcast:!0})})},kt=()=>{L||T(!0),J(!1)},ae=n.useMemo(()=>Ft({activeAnalyzedScenario:!!L,analyzedPreviewUrl:Te,activeScenarioId:m||null,scenarios:d,proxyUrl:H,devServerUrl:z,zoomComponent:j||null}),[H,z,j,m,d,L,Te]),Ye=n.useMemo(()=>{const r=zt(ae,Ge);if(!r)return null;const b=r.includes("?")?"&":"?";return`${r}${b}__cb=${Ne}`},[ae,Ge,Ne]),Ct=n.useMemo(()=>({projectSlug:s,hasProject:i,scenarioCount:h==null?void 0:h.length,allScenarioCount:d==null?void 0:d.length,analyzedEntityCount:c==null?void 0:c.length,glossaryFunctionCount:x==null?void 0:x.length,entityChangeStatusKeys:N?Object.keys(N):[],featureName:E}),[s,i,h,d,c,x,N,E]);return e.jsx(ws,{loaderSnapshot:Ct,children:e.jsxs("div",{className:"fixed inset-0 bg-[#2d2d2d] flex flex-col",children:[L&&e.jsx(vs,{analysisId:L.analysisId,scenarioId:L.scenarioId,scenarioName:L.scenarioName,entityName:L.entityName,projectSlug:s,onStateChange:dt},L.analysisId),e.jsxs("div",{className:"flex-1 flex min-h-0",children:[e.jsxs("div",{className:"flex-1 flex flex-col min-w-0",style:ee==="editor-only"?{display:"none"}:void 0,children:[e.jsxs("div",{className:"bg-[#2d2d2d] border-b border-[#3d3d3d] shrink-0 z-10 h-10 flex items-center px-4 gap-1",children:[e.jsx("button",{onClick:()=>Ue(r=>r==="preview-only"?"split":"preview-only"),className:"p-1.5 rounded text-gray-500 hover:text-gray-300 transition-colors cursor-pointer shrink-0",title:ee==="preview-only"?"Show sidebar":"Hide sidebar",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2"}),e.jsx("path",{d:"M9 3v18"})]})}),e.jsx("div",{className:"w-px h-4 bg-[#3d3d3d] mx-1"}),e.jsxs("div",{className:"flex-1 flex items-center justify-center gap-1",children:[xe.map(r=>e.jsxs("button",{onClick:()=>yt(r),className:`p-1.5 rounded transition-colors cursor-pointer ${U.name===r.name?"text-white bg-[#555]":"text-gray-500 hover:text-gray-300"}`,title:`${r.name} (${r.width}×${r.height})`,children:[r.name==="Desktop"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"2",y:"3",width:"20",height:"14",rx:"2"}),e.jsx("path",{d:"M8 21h8M12 17v4"})]}),r.name==="Laptop"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M4 6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8H4V6z"}),e.jsx("path",{d:"M2 18h20"})]}),r.name==="Tablet"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"5",y:"2",width:"14",height:"20",rx:"2"}),e.jsx("path",{d:"M12 18h.01"})]}),r.name==="Mobile"&&e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("rect",{x:"7",y:"2",width:"10",height:"20",rx:"2"}),e.jsx("path",{d:"M12 18h.01"})]})]},r.name)),e.jsxs("div",{className:"relative",children:[e.jsxs("button",{onClick:()=>_e(r=>!r),className:`flex items-center gap-1.5 px-2 py-1 rounded transition-colors cursor-pointer ${Ae||!xe.some(r=>r.name===U.name)?"text-white bg-[#555]":"text-gray-400 hover:text-gray-200 hover:bg-[#444]"}`,title:"Custom dimensions",children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})}),e.jsxs("span",{className:"text-xs font-mono",children:[U.width," × ",U.height??900]})]}),Ae&&e.jsx(Lt,{currentWidth:U.width,currentHeight:U.height??900,devicePresets:Se,customSizes:we,onApply:St,onSave:wt,onRemove:bt,onClose:()=>_e(!1)})]}),e.jsx("div",{className:"w-px h-4 bg-[#3d3d3d] mx-1"}),e.jsx("button",{onClick:()=>{const r=Ye||ae;r&&window.open(r,"_blank")},className:"p-1.5 rounded text-gray-500 hover:text-gray-300 transition-colors cursor-pointer",title:"Open preview in new window",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})})]})]}),e.jsx("div",{ref:l,className:"flex-1 flex items-center justify-center overflow-hidden p-8",style:he?{backgroundColor:"#f5f0e8",backgroundImage:"repeating-linear-gradient(0deg, transparent, transparent 19px, #e8e0d0 19px, #e8e0d0 20px), repeating-linear-gradient(90deg, transparent, transparent 19px, #e8e0d0 19px, #e8e0d0 20px)"}:{backgroundImage:`
6
+ linear-gradient(45deg, #333 25%, transparent 25%),
7
+ linear-gradient(-45deg, #333 25%, transparent 25%),
8
+ linear-gradient(45deg, transparent 75%, #333 75%),
9
+ linear-gradient(-45deg, transparent 75%, #333 75%)
10
+ `,backgroundSize:"16px 16px",backgroundPosition:"0 0, 0 8px, 8px -8px, -8px 0px",backgroundColor:"#2d2d2d"},children:he?e.jsx(gs,{preview:he,onDismiss:()=>G(null),onLoadCommit:ct}):ae?e.jsx("div",{style:{width:`${U.width*X}px`,height:`${(U.height??900)*X}px`},children:e.jsxs("div",{className:"relative bg-white origin-top-left",style:{width:`${U.width}px`,height:`${U.height??900}px`,transform:X<1?`scale(${X})`:void 0},children:[!g&&!Je&&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-[#2a2a2a] rounded-lg p-8 w-[500px] h-[300px]",children:[e.jsx("div",{className:"mb-4",children:e.jsx(Ke,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Loading Preview"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:"Waiting for the app to render"})]})]})}),Je&&e.jsx("div",{className:"absolute inset-0 z-20 flex items-center justify-center",style:{backgroundColor:"rgba(0, 0, 0, 0.25)",backdropFilter:"blur(1px)",transition:"opacity 200ms ease-out"},children:e.jsxs("div",{className:"flex flex-col items-center gap-3 animate-pulse",children:[e.jsx("svg",{className:"w-6 h-6 text-white/80 animate-spin",viewBox:"0 0 24 24",fill:"none",children:e.jsx("circle",{cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeDasharray:"50 100"})}),e.jsx("span",{className:"text-white/70 text-xs font-['IBM_Plex_Sans']",children:"Switching scenario"})]})}),e.jsx("iframe",{ref:f,src:Ye||ae,className:"w-full h-full border-none",title:"Editor preview",onLoad:kt,style:{opacity:g?1:0}},Ne)]})}):e.jsx("div",{className:"bg-[#2a2a2a] rounded-lg flex flex-col items-center justify-center",style:{width:`${U.width*X}px`,height:`${(U.height??900)*X}px`},children:q?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-400 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Dev Server Failed"}),e.jsx("pre",{className:"text-xs text-left bg-[#1e1e1e] text-gray-300 p-4 rounded overflow-auto max-h-[300px] w-full font-mono whitespace-pre-wrap",children:q}),e.jsx("button",{onClick:le,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"})]}):Z||ue?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mb-4",children:e.jsx(Ke,{})}),e.jsxs("div",{className:"flex flex-col gap-3 text-center",children:[e.jsx("h2",{className:"text-xl font-medium text-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:ue?"Starting Interactive Mode":"Starting Dev Server"}),e.jsx("p",{className:"text-sm text-gray-400 leading-5 m-0 font-['IBM_Plex_Sans']",children:ue?"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-gray-200 leading-[28px] m-0 font-['IBM_Plex_Sans']",children:"Live Preview"}),e.jsx("p",{className:"text-sm text-gray-500 leading-5 m-0 font-['IBM_Plex_Sans']",children:"Describe what you want to build in the Build tab"})]})})})]}),e.jsxs("aside",{className:`bg-[#1e1e1e] border-r border-[#3d3d3d] shrink-0 flex flex-col overflow-hidden order-first ${ee==="editor-only"?"w-full max-w-none min-w-0":"w-[50%] min-w-[400px] max-w-[800px]"}`,style:ee==="preview-only"?{display:"none"}:void 0,children:[e.jsx(fs,{activeTab:W,onTabChange:r=>{fe(r),r==="build"&&ge(!0)},buildIdle:Oe,zoomComponent:j,breadcrumbItems:Ve,onBreadcrumbNavigate:Ce,panelLayout:ee,onToggleExpand:()=>Ue(r=>r==="editor-only"?"split":"editor-only")}),e.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[mt&&e.jsxs("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:W==="build"?"visible":"hidden"},children:[e.jsx("div",{className:ve?"flex-1 min-h-0":"flex-1",style:ve?{flex:"1 1 50%"}:void 0,children:e.jsx(Wt,{ref:_,entityName:"Editor",projectSlug:s,entityFilePath:null,scenarioName:null,onRefreshPreview:jt,onShowResults:ut,onHideResults:ze,onSetViewport:ht,editorMode:!0,onIdleChange:pt,notificationSettings:We})}),ve&&e.jsx("div",{style:{flex:"1 1 50%"},className:"min-h-0 border-t-2 border-gray-300",children:e.jsx(us,{scenarios:h,allScenarios:d,glossaryFunctions:x,projectRoot:a,activeScenarioId:m,onScenarioSelect:se,onClose:ze,entityChangeStatus:N,modifiedFiles:w,featureName:E,userPrompt:v})})]}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:W==="app"?"visible":"hidden"},children:e.jsx(xs,{hasProject:i,scenarios:d,analyzedEntities:c,glossaryFunctions:x,glossaryEntries:u,projectRoot:a,activeScenarioId:m,onScenarioSelect:se,onAnalyzedScenarioSelect:Be,onSwitchToBuild:xt,zoomComponent:j,onZoomChange:Ce,entityImports:k,pageFilePaths:S,projectTitle:D,projectDescription:O,breadcrumbItems:Ve})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:W==="data"?"visible":"hidden"},children:e.jsx(Kt,{scenarios:d,projectRoot:a,activeScenarioId:m,onScenarioSelect:se,zoomComponent:j,onZoomChange:Ce,analyzedEntities:[],glossaryFunctions:x,activeAnalyzedScenarioId:L==null?void 0:L.scenarioId,onAnalyzedScenarioSelect:Be,entityImports:k,pageFilePaths:S})}),e.jsx("div",{className:"absolute inset-0 flex flex-col overflow-hidden",style:{visibility:W==="journal"?"visible":"hidden"},children:e.jsx(os,{isActive:W==="journal",onScreenshotClick:Nt,glossaryFunctions:x})})]}),e.jsx(Ht,{serverUrl:z,isStarting:Z,projectSlug:s,devServerError:q,onStartServer:ie?me:void 0,notificationSettings:We,onChangeNotificationSettings:ft})]})]})]})})});export{As as default,Bs as meta};
@@ -0,0 +1,41 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/addon-web-links-Duc5hnl7.js","assets/chunk-JZWAC4HX-C4pqxYJB.js"])))=>i.map(i=>d[i]);
2
+ import{r as u,j as a}from"./chunk-JZWAC4HX-C4pqxYJB.js";import{_ as B}from"./preload-helper-ckwbz45p.js";const C={sound:"soft-double-tap",systemNotification:!0},ce=[{id:"soft-double-tap",label:"Soft double tap"},{id:"gentle-chime",label:"Gentle chime"},{id:"warm-ding",label:"Warm ding"},{id:"mellow-two-tone",label:"Mellow two-tone"},{id:"triangle-bell",label:"Triangle bell"},{id:"off",label:"No sound"}],F="codeyam-editor-notifications";function pe(){try{const r=localStorage.getItem(F);if(!r)return C;const n=JSON.parse(r);return typeof n=="string"?n==="true"?C:{...C,sound:"off",systemNotification:!1}:{...C,...n}}catch{return C}}function xe(r){localStorage.setItem(F,JSON.stringify(r))}function ee(r){var n;if(r!=="off")try{const c=new AudioContext,s={"soft-double-tap":e=>{[0,.12].forEach(t=>{const o=e.createOscillator(),y=e.createGain();o.connect(y),y.connect(e.destination),o.type="sine",o.frequency.value=392,y.gain.setValueAtTime(.25,e.currentTime+t),y.gain.exponentialRampToValueAtTime(.01,e.currentTime+t+.1),o.start(e.currentTime+t),o.stop(e.currentTime+t+.1)})},"gentle-chime":e=>{const t=e.createOscillator(),o=e.createGain();t.connect(o),o.connect(e.destination),t.type="sine",t.frequency.setValueAtTime(523,e.currentTime),t.frequency.setValueAtTime(659,e.currentTime+.15),o.gain.setValueAtTime(.3,e.currentTime),o.gain.exponentialRampToValueAtTime(.01,e.currentTime+.4),t.start(),t.stop(e.currentTime+.4)},"warm-ding":e=>{const t=e.createOscillator(),o=e.createGain();t.connect(o),o.connect(e.destination),t.type="sine",t.frequency.value=330,o.gain.setValueAtTime(.35,e.currentTime),o.gain.exponentialRampToValueAtTime(.01,e.currentTime+.6),t.start(),t.stop(e.currentTime+.6)},"mellow-two-tone":e=>{const t=e.createOscillator(),o=e.createGain();t.connect(o),o.connect(e.destination),t.type="sine",t.frequency.setValueAtTime(294,e.currentTime),t.frequency.setValueAtTime(440,e.currentTime+.18),o.gain.setValueAtTime(.3,e.currentTime),o.gain.exponentialRampToValueAtTime(.01,e.currentTime+.5),t.start(),t.stop(e.currentTime+.5)},"triangle-bell":e=>{const t=e.createOscillator(),o=e.createGain();t.connect(o),o.connect(e.destination),t.type="triangle",t.frequency.value=523,o.gain.setValueAtTime(.4,e.currentTime),o.gain.exponentialRampToValueAtTime(.01,e.currentTime+.8),t.start(),t.stop(e.currentTime+.8)}};(n=s[r])==null||n.call(s,c)}catch{}}function he({serverUrl:r,isStarting:n,projectSlug:c,devServerError:s,onStartServer:e,notificationSettings:t,onChangeNotificationSettings:o}){const[y,A]=u.useState(null),[f,w]=u.useState(!1),E=u.useRef(null),_=u.useRef(null);u.useEffect(()=>{if(!c)return;const p=new EventSource("/api/dev-mode-events");return p.onmessage=v=>{try{const R=JSON.parse(v.data);R.type==="file-synced"&&(A(R.fileName),_.current&&clearTimeout(_.current),_.current=setTimeout(()=>{A(null)},5e3))}catch{}},()=>{p.close(),_.current&&clearTimeout(_.current)}},[c]),u.useEffect(()=>{if(!f)return;function p(v){E.current&&!E.current.contains(v.target)&&w(!1)}return document.addEventListener("mousedown",p),()=>document.removeEventListener("mousedown",p)},[f]);let N;s?N="error":n?N="starting":r?N="running":N="stopped";const V={starting:"bg-yellow-400",running:"bg-green-400",stopped:"bg-gray-400",error:"bg-red-400"},k={starting:"Starting...",running:r||"Running",stopped:"Stopped",error:"Error"},P=t&&(t.sound!=="off"||t.systemNotification);return a.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:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:`w-2 h-2 rounded-full ${V[N]}`}),a.jsxs("span",{className:"text-gray-400",children:["Server:"," ",a.jsx("span",{className:"text-gray-300",children:k[N]})]}),(N==="stopped"||N==="error")&&e&&a.jsx("button",{onClick:e,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"})]}),a.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"}),y&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"#4ade80",strokeWidth:"2",children:a.jsx("path",{d:"M20 6L9 17l-5-5"})}),a.jsxs("span",{className:"text-green-400",children:["Synced: ",y]})]}),a.jsx("div",{className:"w-px h-3 bg-[#3d3d3d]"})]}),a.jsx("div",{className:"flex-1"}),o&&t&&a.jsxs("div",{className:"relative",ref:E,children:[a.jsx("button",{onClick:()=>w(!f),className:`text-[11px] rounded transition-colors cursor-pointer ${P?"text-green-400 hover:text-green-300":"text-gray-500 hover:text-gray-300"}`,children:P?"Notifications On":"Notifications Off"}),f&&a.jsxs("div",{className:"absolute bottom-full right-0 mb-2 w-56 bg-[#2d2d2d] border border-[#4d4d4d] rounded-lg shadow-xl p-3 flex flex-col gap-3 z-50",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-[11px] text-gray-400 mb-1.5",children:"Notification sound"}),a.jsx("div",{className:"flex flex-col gap-0.5",children:ce.map(p=>a.jsx("button",{onClick:()=>{o({...t,sound:p.id}),p.id!=="off"&&ee(p.id)},className:`text-left text-[11px] px-2 py-1 rounded cursor-pointer transition-colors ${t.sound===p.id?"bg-[#444] text-white":"text-gray-300 hover:bg-[#3a3a3a]"}`,children:p.label},p.id))})]}),a.jsxs("div",{className:"border-t border-[#4d4d4d] pt-2",children:[a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:t.systemNotification,onChange:p=>{const v=p.target.checked;o({...t,systemNotification:v}),v&&typeof Notification<"u"&&Notification.permission==="default"&&Notification.requestPermission()},className:"accent-green-500"}),a.jsx("span",{className:"text-[11px] text-gray-300",children:"System notification"})]}),a.jsx("div",{className:"text-[10px] text-gray-500 mt-1 ml-5",children:"Shows when tab is not visible"})]})]})]})]})}async function ae(r,n){try{const{WebglAddon:s}=await B(async()=>{const{WebglAddon:t}=await import("./addon-webgl-DI8QOUvO.js").then(o=>o.a);return{WebglAddon:t}},[]),e=new s;return e.onContextLoss(()=>{n==null||n("webgl","canvas",new Error("WebGL context lost")),e.dispose(),Q(r).then(t=>{t||n==null||n("canvas","dom",new Error("Canvas fallback failed after context loss"))})}),r.loadAddon(e),{type:"webgl",dispose:()=>e.dispose()}}catch(s){n==null||n("webgl","canvas",s)}const c=await Q(r);return c||(n==null||n("canvas","dom",new Error("Canvas addon failed")),{type:"dom",dispose:()=>{}})}async function Q(r){try{const{CanvasAddon:n}=await B(async()=>{const{CanvasAddon:s}=await import("./addon-canvas-DpzMmAy5.js").then(e=>e.a);return{CanvasAddon:s}},[]),c=new n;return r.loadAddon(c),{type:"canvas",dispose:()=>c.dispose()}}catch{return null}}const le=`
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 ue(){if(document.getElementById("xterm-css"))return;const r=document.createElement("style");r.id="xterm-css",r.textContent=le,document.head.appendChild(r)}const ge=u.forwardRef(function({entityName:n,entityType:c,entitySha:s,entityFilePath:e,scenarioName:t,scenarioDescription:o,analysisId:y,projectSlug:A,onRefreshPreview:f,onShowResults:w,onHideResults:E,onSetViewport:_,editorMode:N,onIdleChange:V,notificationSettings:k},P){const p=u.useRef(null),v=u.useRef(null),R=u.useRef(null),L=u.useRef(null),$=u.useRef(null),I=u.useRef(!1),M=u.useRef(0),G=u.useRef(!1),S=u.useRef(V);S.current=V;const X=u.useRef(k);X.current=k;const O=u.useRef(null);function J(){O.current&&(O.current.close(),O.current=null)}u.useEffect(()=>{function m(){J()}function x(){document.hidden||J()}return window.addEventListener("focus",m),document.addEventListener("visibilitychange",x),()=>{window.removeEventListener("focus",m),document.removeEventListener("visibilitychange",x)}},[]);const te=u.useCallback(()=>{var m;(m=R.current)==null||m.focus()},[]);return u.useImperativeHandle(P,()=>({sendInput(m){const x=L.current;x&&x.readyState===WebSocket.OPEN&&(x.send(JSON.stringify({type:"input",data:m})),setTimeout(()=>{x.readyState===WebSocket.OPEN&&x.send(JSON.stringify({type:"input",data:"\r"}))},100))},focus(){var m;(m=R.current)==null||m.focus()},scrollToBottom(){var x;const m=(x=p.current)==null?void 0:x.querySelector(".xterm-viewport");m&&(m.scrollTop=m.scrollHeight)}})),u.useEffect(()=>{const m=p.current;if(!m)return;let x=!1;return ue(),Promise.all([B(()=>import("./xterm-BqvuqXEL.js"),[]),B(()=>import("./addon-fit-YJmn1quW.js"),[]),B(()=>import("./addon-web-links-Duc5hnl7.js").then(W=>W.a),__vite__mapDeps([0,1]))]).then(([W,re,ne])=>{if(x)return;const l=new W.Terminal({cursorBlink:!0,scrollback:5e3,fontSize:13,fontFamily:"'IBM Plex Mono', 'Menlo', 'Monaco', monospace",theme:{background:"#1e1e1e",foreground:"#d4d4d4",cursor:"#d4d4d4",selectionBackground:"#264f78"},linkHandler:{activate(d,i){try{const h=new URL(i),b=h.searchParams.get("scenario");if(b&&h.pathname==="/editor"){const T=new BroadcastChannel("codeyam-editor");T.postMessage({type:"switch-scenario",scenarioId:b}),T.close();return}}catch{}window.open(i,"_blank")}}}),q=new re.FitAddon;l.loadAddon(q),l.loadAddon(new ne.WebLinksAddon),l.open(m);let D=null;ae(l,(d,i,h)=>{console.warn(`[Terminal] Renderer fallback: ${d} → ${i}`,h)}).then(d=>{if(x){d.dispose();return}console.log(`[Terminal] Using ${d.type} renderer`),D=d.dispose}),requestAnimationFrame(()=>{try{q.fit()}catch{}}),R.current=l,l.focus(),setTimeout(()=>l.focus(),100),setTimeout(()=>l.focus(),500);const oe=window.location.protocol==="https:"?"wss:":"ws:",ie=window.location.host;function se(d){const i=new URLSearchParams;return i.set("entityName",n),c&&i.set("entityType",c),s&&i.set("entitySha",s),e&&i.set("entityFilePath",e),t&&i.set("scenarioName",t),o&&i.set("scenarioDescription",o),y&&i.set("analysisId",y),A&&i.set("projectSlug",A),N&&i.set("editorMode","true"),d&&i.set("reconnectId",d),`${oe}//${ie}/ws/terminal?${i.toString()}`}function H(d){const i=se(d),h=new WebSocket(i);L.current=h,h.onopen=()=>{M.current=0,G.current=!1,h.send(JSON.stringify({type:"resize",cols:l.cols,rows:l.rows}))},h.onmessage=b=>{var T,Y,Z;try{const g=JSON.parse(b.data);if(g.type==="session-id"){$.current=g.sessionId;return}if(g.type==="refresh-preview"){f==null||f(g.path,g.scenarioId);return}if(g.type==="show-results"){w==null||w();return}if(g.type==="hide-results"){E==null||E();return}if(g.type==="set-viewport"){_==null||_({name:g.name,width:g.width,height:g.height});return}if(g.type==="claude-idle"){(T=S.current)==null||T.call(S,!0);const j=X.current;if(j!=null&&j.sound&&j.sound!=="off"&&ee(j.sound),!document.hasFocus()&&(j!=null&&j.systemNotification)&&typeof Notification<"u"&&Notification.permission==="granted"){O.current&&O.current.close();const U=new Notification("Claude is ready for you",{body:"Claude has finished and is waiting for your input.",tag:"claude-idle"});U.onclick=()=>{window.focus(),U.close()},O.current=U}return}if(g.type==="claude-active"){(Y=S.current)==null||Y.call(S,!1),O.current&&(O.current.close(),O.current=null);return}g.type==="output"&&(l.write(g.data),(Z=S.current)==null||Z.call(S,!1))}catch{l.write(b.data)}},h.onclose=()=>{if(I.current){l.write(`\r
34
+ \x1B[90m[Terminal session ended]\x1B[0m\r
35
+ `);return}const b=M.current;if(b<5&&$.current){const T=1e3*Math.pow(2,Math.min(b,3));M.current=b+1,l.write(`\r
36
+ \x1B[33m[Reconnecting...]\x1B[0m\r
37
+ `),setTimeout(()=>{I.current||H($.current)},T)}else G.current?l.write(`\r
38
+ \x1B[90m[Terminal session ended]\x1B[0m\r
39
+ `):(G.current=!0,l.write(`\r
40
+ \x1B[33m[Starting new session...]\x1B[0m\r
41
+ `),$.current=null,M.current=0,H())},h.onerror=()=>{}}H(),l.onData(d=>{const i=L.current;i&&i.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"input",data:d})),J()});let z=null;const K=new ResizeObserver(()=>{z&&clearTimeout(z),z=setTimeout(()=>{let d;try{d=q.proposeDimensions()}catch{return}if(!d||d.cols===l.cols&&d.rows===l.rows)return;const i=m.querySelector(".xterm-viewport");let h,b=!0;i&&(h=i.scrollTop,b=i.scrollTop+i.clientHeight>=i.scrollHeight-10),q.fit(),i&&h!==void 0&&(b?i.scrollTop=i.scrollHeight:i.scrollTop=h);const T=L.current;T&&T.readyState===WebSocket.OPEN&&T.send(JSON.stringify({type:"resize",cols:l.cols,rows:l.rows}))},150)});K.observe(m),v.current=()=>{var d;z&&clearTimeout(z),K.disconnect(),I.current=!0,(d=L.current)==null||d.close(),L.current=null,D==null||D(),l.dispose(),R.current=null}}),()=>{var W;x=!0,(W=v.current)==null||W.call(v),v.current=null}},[]),a.jsx("div",{ref:p,onClick:te,className:"w-full h-full",style:{padding:"4px 0 0 8px"}})});function de(r){return r.replace(/[^a-zA-Z0-9_]+/g,"_")}function ye(r){const{activeAnalyzedScenario:n,analyzedPreviewUrl:c,activeScenarioId:s,scenarios:e,proxyUrl:t,devServerUrl:o,zoomComponent:y}=r;if(n&&c)return c;if(n&&!c)return null;if(s){const f=e.find(w=>w.id===s);if(f!=null&&f.url){const w=t||o;return w?f.url.startsWith("/")?`${w}${f.url}`:f.url:null}}const A=t||o;if(!A)return null;if(y&&s){const f=e.find(E=>E.id===s),w=f?de(f.name):"Default";return`${A}/__codeyam__/${y}/${w}`}return A}function we(r,n){if(!r||!n)return r;try{const c=new URL(r),s=n.indexOf("?");return s>=0?(c.pathname=n.slice(0,s),c.search=n.slice(s)):(c.pathname=n,c.search=""),c.href}catch{return r}}function ve(r,n){return r?r!==n:!1}function be(r){if(r.length!==0)return r.find(n=>n.type==="application")||r[0]}function Te(r,n,c){if(!r.viewportWidth||!r.viewportHeight)return c??null;const s=n.find(e=>e.width===r.viewportWidth&&e.height===r.viewportHeight);return{name:(s==null?void 0:s.name)||"Custom",width:r.viewportWidth,height:r.viewportHeight}}function Ne(r,n){const c=n.width,s=n.height??900,e=r.width,t=r.height;return c<=e&&s<=t?1:Math.min(e/c,t/s)}export{he as D,ge as T,we as a,de as b,C as c,xe as d,Ne as e,ye as f,be as g,pe as l,Te as r,ve as s};