@trilogy-data/trilogy-studio-components 0.1.0

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 (581) hide show
  1. package/README.md +6 -0
  2. package/dist/ChatCreatorModal-DTcvWDQi.js +192 -0
  3. package/dist/Dashboard-C8re96eZ.js +5104 -0
  4. package/dist/DashboardCreatorInline-Do-CDJgS.js +150 -0
  5. package/dist/DashboardMobile-BOrq0rBy.js +310 -0
  6. package/dist/LLMConnectionList-DVM5t-P2.js +4692 -0
  7. package/dist/LLMView-lUTKOMbr.js +558 -0
  8. package/dist/Manager-CXJNoqU2.js +4 -0
  9. package/dist/ResultComponent-C4EGIBY0.js +155 -0
  10. package/dist/Sidebar-BGKtM2n0.js +1841 -0
  11. package/dist/TutorialPage-CGjDXmYk.js +482 -0
  12. package/dist/WelcomePage-C6obXIyG.js +75 -0
  13. package/dist/abap-D0Neqhq6.js +1404 -0
  14. package/dist/apex-B5LhxkeG.js +332 -0
  15. package/dist/azcli-BrBH0QTU.js +74 -0
  16. package/dist/bat-BfzAov64.js +106 -0
  17. package/dist/bicep-C3bCSWel.js +108 -0
  18. package/dist/cameligo-sFL5plcd.js +180 -0
  19. package/dist/chats/chat.d.ts +63 -0
  20. package/dist/chats/chat.d.ts.map +1 -0
  21. package/dist/chats/index.d.ts +3 -0
  22. package/dist/chats/index.d.ts.map +1 -0
  23. package/dist/clojure-CfeExRz0.js +767 -0
  24. package/dist/coffee-Xws5K0WL.js +238 -0
  25. package/dist/components/AssetAutoImporter.vue.d.ts +10 -0
  26. package/dist/components/AssetAutoImporter.vue.d.ts.map +1 -0
  27. package/dist/components/ChartControlPanel.vue.d.ts +54 -0
  28. package/dist/components/ChartControlPanel.vue.d.ts.map +1 -0
  29. package/dist/components/CodeBlock.vue.d.ts +39 -0
  30. package/dist/components/CodeBlock.vue.d.ts.map +1 -0
  31. package/dist/components/ConceptTable.vue.d.ts +16 -0
  32. package/dist/components/ConceptTable.vue.d.ts.map +1 -0
  33. package/dist/components/ContextMenu.vue.d.ts +67 -0
  34. package/dist/components/ContextMenu.vue.d.ts.map +1 -0
  35. package/dist/components/DataTable.vue.d.ts +204 -0
  36. package/dist/components/DataTable.vue.d.ts.map +1 -0
  37. package/dist/components/DrilldownPane.vue.d.ts +94 -0
  38. package/dist/components/DrilldownPane.vue.d.ts.map +1 -0
  39. package/dist/components/EditableTitle.vue.d.ts +32 -0
  40. package/dist/components/EditableTitle.vue.d.ts.map +1 -0
  41. package/dist/components/ErrorMessage.vue.d.ts +20 -0
  42. package/dist/components/ErrorMessage.vue.d.ts.map +1 -0
  43. package/dist/components/HighlightComponent.vue.d.ts +21 -0
  44. package/dist/components/HighlightComponent.vue.d.ts.map +1 -0
  45. package/dist/components/HintComponent.vue.d.ts +12 -0
  46. package/dist/components/HintComponent.vue.d.ts.map +1 -0
  47. package/dist/components/InlineErrorMessage.vue.d.ts +3 -0
  48. package/dist/components/InlineErrorMessage.vue.d.ts.map +1 -0
  49. package/dist/components/LoadingButton.vue.d.ts +121 -0
  50. package/dist/components/LoadingButton.vue.d.ts.map +1 -0
  51. package/dist/components/LoadingView.vue.d.ts +21 -0
  52. package/dist/components/LoadingView.vue.d.ts.map +1 -0
  53. package/dist/components/MarkdownRenderer.vue.d.ts +39 -0
  54. package/dist/components/MarkdownRenderer.vue.d.ts.map +1 -0
  55. package/dist/components/PopupModal.vue.d.ts +50 -0
  56. package/dist/components/PopupModal.vue.d.ts.map +1 -0
  57. package/dist/components/SimpleEditor.vue.d.ts +246 -0
  58. package/dist/components/SimpleEditor.vue.d.ts.map +1 -0
  59. package/dist/components/StatusIcon.vue.d.ts +9 -0
  60. package/dist/components/StatusIcon.vue.d.ts.map +1 -0
  61. package/dist/components/SymbolsPane.vue.d.ts +96 -0
  62. package/dist/components/SymbolsPane.vue.d.ts.map +1 -0
  63. package/dist/components/Tooltip.vue.d.ts +40 -0
  64. package/dist/components/Tooltip.vue.d.ts.map +1 -0
  65. package/dist/components/VegaLiteChart.vue.d.ts +183 -0
  66. package/dist/components/VegaLiteChart.vue.d.ts.map +1 -0
  67. package/dist/components/chartControlsManager.d.ts +50 -0
  68. package/dist/components/chartControlsManager.d.ts.map +1 -0
  69. package/dist/components/chartHelpers.d.ts +51 -0
  70. package/dist/components/chartHelpers.d.ts.map +1 -0
  71. package/dist/components/chartOperationsManager.d.ts +10 -0
  72. package/dist/components/chartOperationsManager.d.ts.map +1 -0
  73. package/dist/components/chartRenderManager.d.ts +26 -0
  74. package/dist/components/chartRenderManager.d.ts.map +1 -0
  75. package/dist/components/community/AddStoreModal.vue.d.ts +35 -0
  76. package/dist/components/community/AddStoreModal.vue.d.ts.map +1 -0
  77. package/dist/components/community/CommunityModelCard.vue.d.ts +33 -0
  78. package/dist/components/community/CommunityModelCard.vue.d.ts.map +1 -0
  79. package/dist/components/community/CommunityModelHeader.vue.d.ts +22 -0
  80. package/dist/components/community/CommunityModelHeader.vue.d.ts.map +1 -0
  81. package/dist/components/community/CommunityModels.vue.d.ts +19 -0
  82. package/dist/components/community/CommunityModels.vue.d.ts.map +1 -0
  83. package/dist/components/community/CommunityRemote.vue.d.ts +33 -0
  84. package/dist/components/community/CommunityRemote.vue.d.ts.map +1 -0
  85. package/dist/components/connection/ConnectionDatabase.vue.d.ts +153 -0
  86. package/dist/components/connection/ConnectionDatabase.vue.d.ts.map +1 -0
  87. package/dist/components/connection/ConnectionHistory.vue.d.ts +13 -0
  88. package/dist/components/connection/ConnectionHistory.vue.d.ts.map +1 -0
  89. package/dist/components/connection/ConnectionSchema.vue.d.ts +35 -0
  90. package/dist/components/connection/ConnectionSchema.vue.d.ts.map +1 -0
  91. package/dist/components/connection/ConnectionTable.vue.d.ts +251 -0
  92. package/dist/components/connection/ConnectionTable.vue.d.ts.map +1 -0
  93. package/dist/components/connection/DatasourceTable.vue.d.ts +16 -0
  94. package/dist/components/connection/DatasourceTable.vue.d.ts.map +1 -0
  95. package/dist/components/dashboard/Dashboard.vue.d.ts +13 -0
  96. package/dist/components/dashboard/Dashboard.vue.d.ts.map +1 -0
  97. package/dist/components/dashboard/DashboardAddItemModal.vue.d.ts +13 -0
  98. package/dist/components/dashboard/DashboardAddItemModal.vue.d.ts.map +1 -0
  99. package/dist/components/dashboard/DashboardCTA.vue.d.ts +12 -0
  100. package/dist/components/dashboard/DashboardCTA.vue.d.ts.map +1 -0
  101. package/dist/components/dashboard/DashboardChart.vue.d.ts +427 -0
  102. package/dist/components/dashboard/DashboardChart.vue.d.ts.map +1 -0
  103. package/dist/components/dashboard/DashboardChartEditor.vue.d.ts +325 -0
  104. package/dist/components/dashboard/DashboardChartEditor.vue.d.ts.map +1 -0
  105. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts +52 -0
  106. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts.map +1 -0
  107. package/dist/components/dashboard/DashboardCreatorInline.vue.d.ts +36 -0
  108. package/dist/components/dashboard/DashboardCreatorInline.vue.d.ts.map +1 -0
  109. package/dist/components/dashboard/DashboardDataSelector.vue.d.ts +221 -0
  110. package/dist/components/dashboard/DashboardDataSelector.vue.d.ts.map +1 -0
  111. package/dist/components/dashboard/DashboardFilter.vue.d.ts +346 -0
  112. package/dist/components/dashboard/DashboardFilter.vue.d.ts.map +1 -0
  113. package/dist/components/dashboard/DashboardFilterAutocomplete.vue.d.ts +38 -0
  114. package/dist/components/dashboard/DashboardFilterAutocomplete.vue.d.ts.map +1 -0
  115. package/dist/components/dashboard/DashboardGridItem.vue.d.ts +31 -0
  116. package/dist/components/dashboard/DashboardGridItem.vue.d.ts.map +1 -0
  117. package/dist/components/dashboard/DashboardHeader.vue.d.ts +71 -0
  118. package/dist/components/dashboard/DashboardHeader.vue.d.ts.map +1 -0
  119. package/dist/components/dashboard/DashboardHeaderFilterInput.vue.d.ts +50 -0
  120. package/dist/components/dashboard/DashboardHeaderFilterInput.vue.d.ts.map +1 -0
  121. package/dist/components/dashboard/DashboardImportPopup.vue.d.ts +12 -0
  122. package/dist/components/dashboard/DashboardImportPopup.vue.d.ts.map +1 -0
  123. package/dist/components/dashboard/DashboardImportSelector.vue.d.ts +14 -0
  124. package/dist/components/dashboard/DashboardImportSelector.vue.d.ts.map +1 -0
  125. package/dist/components/dashboard/DashboardMarkdown.vue.d.ts +175 -0
  126. package/dist/components/dashboard/DashboardMarkdown.vue.d.ts.map +1 -0
  127. package/dist/components/dashboard/DashboardMarkdownEditor.vue.d.ts +325 -0
  128. package/dist/components/dashboard/DashboardMarkdownEditor.vue.d.ts.map +1 -0
  129. package/dist/components/dashboard/DashboardMobile.vue.d.ts +8 -0
  130. package/dist/components/dashboard/DashboardMobile.vue.d.ts.map +1 -0
  131. package/dist/components/dashboard/DashboardSharePopup.vue.d.ts +14 -0
  132. package/dist/components/dashboard/DashboardSharePopup.vue.d.ts.map +1 -0
  133. package/dist/components/dashboard/DashboardTable.vue.d.ts +332 -0
  134. package/dist/components/dashboard/DashboardTable.vue.d.ts.map +1 -0
  135. package/dist/components/dashboard/useDashboard.d.ts +96 -0
  136. package/dist/components/dashboard/useDashboard.d.ts.map +1 -0
  137. package/dist/components/editor/Editor.vue.d.ts +816 -0
  138. package/dist/components/editor/Editor.vue.d.ts.map +1 -0
  139. package/dist/components/editor/EditorCode.vue.d.ts +49 -0
  140. package/dist/components/editor/EditorCode.vue.d.ts.map +1 -0
  141. package/dist/components/editor/EditorCreatorIcon.vue.d.ts +61 -0
  142. package/dist/components/editor/EditorCreatorIcon.vue.d.ts.map +1 -0
  143. package/dist/components/editor/EditorCreatorInline.vue.d.ts +95 -0
  144. package/dist/components/editor/EditorCreatorInline.vue.d.ts.map +1 -0
  145. package/dist/components/editor/EditorHeader.vue.d.ts +185 -0
  146. package/dist/components/editor/EditorHeader.vue.d.ts.map +1 -0
  147. package/dist/components/editor/ResultComponent.vue.d.ts +1095 -0
  148. package/dist/components/editor/ResultComponent.vue.d.ts.map +1 -0
  149. package/dist/components/editor/Results.vue.d.ts +755 -0
  150. package/dist/components/editor/Results.vue.d.ts.map +1 -0
  151. package/dist/components/editor/editorHelpers.d.ts +45 -0
  152. package/dist/components/editor/editorHelpers.d.ts.map +1 -0
  153. package/dist/components/editor/events.d.ts +4 -0
  154. package/dist/components/editor/events.d.ts.map +1 -0
  155. package/dist/components/index.d.ts +2 -0
  156. package/dist/components/index.d.ts.map +1 -0
  157. package/dist/components/layout/MobileSidebarLayout.vue.d.ts +48 -0
  158. package/dist/components/layout/MobileSidebarLayout.vue.d.ts.map +1 -0
  159. package/dist/components/layout/SidebarLayout.vue.d.ts +20 -0
  160. package/dist/components/layout/SidebarLayout.vue.d.ts.map +1 -0
  161. package/dist/components/layout/TabDropdownItem.vue.d.ts +73 -0
  162. package/dist/components/layout/TabDropdownItem.vue.d.ts.map +1 -0
  163. package/dist/components/layout/TabbedBrowser.vue.d.ts +42 -0
  164. package/dist/components/layout/TabbedBrowser.vue.d.ts.map +1 -0
  165. package/dist/components/layout/TabbedLayout.vue.d.ts +5 -0
  166. package/dist/components/layout/TabbedLayout.vue.d.ts.map +1 -0
  167. package/dist/components/layout/VerticalSplitLayout.vue.d.ts +13 -0
  168. package/dist/components/layout/VerticalSplitLayout.vue.d.ts.map +1 -0
  169. package/dist/components/llm/ChatArtifact.vue.d.ts +470 -0
  170. package/dist/components/llm/ChatArtifact.vue.d.ts.map +1 -0
  171. package/dist/components/llm/ChatCreatorModal.vue.d.ts +87 -0
  172. package/dist/components/llm/ChatCreatorModal.vue.d.ts.map +1 -0
  173. package/dist/components/llm/LLMChat.vue.d.ts +260 -0
  174. package/dist/components/llm/LLMChat.vue.d.ts.map +1 -0
  175. package/dist/components/llm/LLMChatRefinement.vue.d.ts +135 -0
  176. package/dist/components/llm/LLMChatRefinement.vue.d.ts.map +1 -0
  177. package/dist/components/llm/LLMChatSplitView.vue.d.ts +2029 -0
  178. package/dist/components/llm/LLMChatSplitView.vue.d.ts.map +1 -0
  179. package/dist/components/llm/LLMValidationView.vue.d.ts +106 -0
  180. package/dist/components/llm/LLMValidationView.vue.d.ts.map +1 -0
  181. package/dist/components/llm/index.d.ts +6 -0
  182. package/dist/components/llm/index.d.ts.map +1 -0
  183. package/dist/components/model/ModelCard.vue.d.ts +1113 -0
  184. package/dist/components/model/ModelCard.vue.d.ts.map +1 -0
  185. package/dist/components/model/ModelConcept.vue.d.ts +14 -0
  186. package/dist/components/model/ModelConcept.vue.d.ts.map +1 -0
  187. package/dist/components/model/ModelCreator.vue.d.ts +241 -0
  188. package/dist/components/model/ModelCreator.vue.d.ts.map +1 -0
  189. package/dist/components/model/ModelSelector.vue.d.ts +9 -0
  190. package/dist/components/model/ModelSelector.vue.d.ts.map +1 -0
  191. package/dist/components/sidebar/CommunityModelListItem.vue.d.ts +26 -0
  192. package/dist/components/sidebar/CommunityModelListItem.vue.d.ts.map +1 -0
  193. package/dist/components/sidebar/ConnectionCreatorInline.vue.d.ts +68 -0
  194. package/dist/components/sidebar/ConnectionCreatorInline.vue.d.ts.map +1 -0
  195. package/dist/components/sidebar/ConnectionIcon.vue.d.ts +6 -0
  196. package/dist/components/sidebar/ConnectionIcon.vue.d.ts.map +1 -0
  197. package/dist/components/sidebar/ConnectionList.vue.d.ts +714 -0
  198. package/dist/components/sidebar/ConnectionList.vue.d.ts.map +1 -0
  199. package/dist/components/sidebar/ConnectionListItem.vue.d.ts +317 -0
  200. package/dist/components/sidebar/ConnectionListItem.vue.d.ts.map +1 -0
  201. package/dist/components/sidebar/ConnectionRefresh.vue.d.ts +15 -0
  202. package/dist/components/sidebar/ConnectionRefresh.vue.d.ts.map +1 -0
  203. package/dist/components/sidebar/ConnectionStatusIcon.vue.d.ts +11 -0
  204. package/dist/components/sidebar/ConnectionStatusIcon.vue.d.ts.map +1 -0
  205. package/dist/components/sidebar/CreateEditorFromDatasourcePopup.vue.d.ts +15 -0
  206. package/dist/components/sidebar/CreateEditorFromDatasourcePopup.vue.d.ts.map +1 -0
  207. package/dist/components/sidebar/DashboardList.vue.d.ts +684 -0
  208. package/dist/components/sidebar/DashboardList.vue.d.ts.map +1 -0
  209. package/dist/components/sidebar/DashboardListItem.vue.d.ts +343 -0
  210. package/dist/components/sidebar/DashboardListItem.vue.d.ts.map +1 -0
  211. package/dist/components/sidebar/DuckDBImporter.vue.d.ts +24 -0
  212. package/dist/components/sidebar/DuckDBImporter.vue.d.ts.map +1 -0
  213. package/dist/components/sidebar/EditorList.vue.d.ts +590 -0
  214. package/dist/components/sidebar/EditorList.vue.d.ts.map +1 -0
  215. package/dist/components/sidebar/EditorListItem.vue.d.ts +260 -0
  216. package/dist/components/sidebar/EditorListItem.vue.d.ts.map +1 -0
  217. package/dist/components/sidebar/GenericSidebarItem.vue.d.ts +91 -0
  218. package/dist/components/sidebar/GenericSidebarItem.vue.d.ts.map +1 -0
  219. package/dist/components/sidebar/LLMConnectionCreator.vue.d.ts +178 -0
  220. package/dist/components/sidebar/LLMConnectionCreator.vue.d.ts.map +1 -0
  221. package/dist/components/sidebar/LLMConnectionList.vue.d.ts +978 -0
  222. package/dist/components/sidebar/LLMConnectionList.vue.d.ts.map +1 -0
  223. package/dist/components/sidebar/LLMConnectionListItem.vue.d.ts +404 -0
  224. package/dist/components/sidebar/LLMConnectionListItem.vue.d.ts.map +1 -0
  225. package/dist/components/sidebar/LLMProviderIcon.vue.d.ts +13 -0
  226. package/dist/components/sidebar/LLMProviderIcon.vue.d.ts.map +1 -0
  227. package/dist/components/sidebar/ModelSidebar.vue.d.ts +558 -0
  228. package/dist/components/sidebar/ModelSidebar.vue.d.ts.map +1 -0
  229. package/dist/components/sidebar/SidebarList.vue.d.ts +16 -0
  230. package/dist/components/sidebar/SidebarList.vue.d.ts.map +1 -0
  231. package/dist/components/sidebar/TutorialSidebar.vue.d.ts +134 -0
  232. package/dist/components/sidebar/TutorialSidebar.vue.d.ts.map +1 -0
  233. package/dist/components/tutorial/TutorialFunction.vue.d.ts +38 -0
  234. package/dist/components/tutorial/TutorialFunction.vue.d.ts.map +1 -0
  235. package/dist/components/tutorial/TutorialPrompt.vue.d.ts +2002 -0
  236. package/dist/components/tutorial/TutorialPrompt.vue.d.ts.map +1 -0
  237. package/dist/components/user/UserProfile.vue.d.ts +11 -0
  238. package/dist/components/user/UserProfile.vue.d.ts.map +1 -0
  239. package/dist/components/user/UserSettings.vue.d.ts +129 -0
  240. package/dist/components/user/UserSettings.vue.d.ts.map +1 -0
  241. package/dist/composables/ResizeHandles.vue.d.ts +6 -0
  242. package/dist/composables/ResizeHandles.vue.d.ts.map +1 -0
  243. package/dist/composables/useChatWithTools.d.ts +62 -0
  244. package/dist/composables/useChatWithTools.d.ts.map +1 -0
  245. package/dist/composables/useResizableDialog.d.ts +30 -0
  246. package/dist/composables/useResizableDialog.d.ts.map +1 -0
  247. package/dist/composables/useTrilogyChat.d.ts +61 -0
  248. package/dist/composables/useTrilogyChat.d.ts.map +1 -0
  249. package/dist/composables/useTrilogyCore.d.ts +51 -0
  250. package/dist/composables/useTrilogyCore.d.ts.map +1 -0
  251. package/dist/connections/base.d.ts +86 -0
  252. package/dist/connections/base.d.ts.map +1 -0
  253. package/dist/connections/bigquery_oauth.d.ts +35 -0
  254. package/dist/connections/bigquery_oauth.d.ts.map +1 -0
  255. package/dist/connections/bigquery_sa.d.ts +2 -0
  256. package/dist/connections/bigquery_sa.d.ts.map +1 -0
  257. package/dist/connections/constants.d.ts +2 -0
  258. package/dist/connections/constants.d.ts.map +1 -0
  259. package/dist/connections/duckdb.d.ts +43 -0
  260. package/dist/connections/duckdb.d.ts.map +1 -0
  261. package/dist/connections/helpers.d.ts +30 -0
  262. package/dist/connections/helpers.d.ts.map +1 -0
  263. package/dist/connections/index.d.ts +7 -0
  264. package/dist/connections/index.d.ts.map +1 -0
  265. package/dist/connections/motherduck.d.ts +19 -0
  266. package/dist/connections/motherduck.d.ts.map +1 -0
  267. package/dist/connections/snowflake.d.ts +94 -0
  268. package/dist/connections/snowflake.d.ts.map +1 -0
  269. package/dist/connections/sql_server.d.ts +2 -0
  270. package/dist/connections/sql_server.d.ts.map +1 -0
  271. package/dist/cpp-CqOUEpxN.js +395 -0
  272. package/dist/csharp-DVLiBOZb.js +332 -0
  273. package/dist/csp-DVFp9bw5.js +59 -0
  274. package/dist/css-DwARn2R6.js +193 -0
  275. package/dist/cssMode-Cr0iq_nL.js +1577 -0
  276. package/dist/cypher-uY0Mffat.js +269 -0
  277. package/dist/dart-D27H-mX_.js +287 -0
  278. package/dist/dashboards/barChartSpec.d.ts +28 -0
  279. package/dist/dashboards/barChartSpec.d.ts.map +1 -0
  280. package/dist/dashboards/barHChartSpec.d.ts +28 -0
  281. package/dist/dashboards/barHChartSpec.d.ts.map +1 -0
  282. package/dist/dashboards/base.d.ts +176 -0
  283. package/dist/dashboards/base.d.ts.map +1 -0
  284. package/dist/dashboards/beeSwarmSpec.d.ts +150 -0
  285. package/dist/dashboards/beeSwarmSpec.d.ts.map +1 -0
  286. package/dist/dashboards/conditions.d.ts +8 -0
  287. package/dist/dashboards/conditions.d.ts.map +1 -0
  288. package/dist/dashboards/conditionsParameters.d.ts +11 -0
  289. package/dist/dashboards/conditionsParameters.d.ts.map +1 -0
  290. package/dist/dashboards/constants.d.ts +22 -0
  291. package/dist/dashboards/constants.d.ts.map +1 -0
  292. package/dist/dashboards/countryLookup.d.ts +15 -0
  293. package/dist/dashboards/countryLookup.d.ts.map +1 -0
  294. package/dist/dashboards/d3utility.d.ts +7 -0
  295. package/dist/dashboards/d3utility.d.ts.map +1 -0
  296. package/dist/dashboards/dashboardQueryExecutor.d.ts +142 -0
  297. package/dist/dashboards/dashboardQueryExecutor.d.ts.map +1 -0
  298. package/dist/dashboards/donutSpec.d.ts +74 -0
  299. package/dist/dashboards/donutSpec.d.ts.map +1 -0
  300. package/dist/dashboards/formatting.d.ts +11 -0
  301. package/dist/dashboards/formatting.d.ts.map +1 -0
  302. package/dist/dashboards/headlineSpec.d.ts +23 -0
  303. package/dist/dashboards/headlineSpec.d.ts.map +1 -0
  304. package/dist/dashboards/heatmapSpec.d.ts +30 -0
  305. package/dist/dashboards/heatmapSpec.d.ts.map +1 -0
  306. package/dist/dashboards/helpers.d.ts +73 -0
  307. package/dist/dashboards/helpers.d.ts.map +1 -0
  308. package/dist/dashboards/index.d.ts +3 -0
  309. package/dist/dashboards/index.d.ts.map +1 -0
  310. package/dist/dashboards/lineAreaSpec.d.ts +177 -0
  311. package/dist/dashboards/lineAreaSpec.d.ts.map +1 -0
  312. package/dist/dashboards/mapSpec.d.ts +431 -0
  313. package/dist/dashboards/mapSpec.d.ts.map +1 -0
  314. package/dist/dashboards/pointSpec.d.ts +27 -0
  315. package/dist/dashboards/pointSpec.d.ts.map +1 -0
  316. package/dist/dashboards/prompts.d.ts +31 -0
  317. package/dist/dashboards/prompts.d.ts.map +1 -0
  318. package/dist/dashboards/spec.d.ts +19 -0
  319. package/dist/dashboards/spec.d.ts.map +1 -0
  320. package/dist/dashboards/treeSpec.d.ts +3 -0
  321. package/dist/dashboards/treeSpec.d.ts.map +1 -0
  322. package/dist/dashboards/types.d.ts +70 -0
  323. package/dist/dashboards/types.d.ts.map +1 -0
  324. package/dist/data/connectionHistoryStorage.d.ts +25 -0
  325. package/dist/data/connectionHistoryStorage.d.ts.map +1 -0
  326. package/dist/data/constants.d.ts +4 -0
  327. package/dist/data/constants.d.ts.map +1 -0
  328. package/dist/data/credentialHelpers.d.ts +30 -0
  329. package/dist/data/credentialHelpers.d.ts.map +1 -0
  330. package/dist/data/credentialService.d.ts +80 -0
  331. package/dist/data/credentialService.d.ts.map +1 -0
  332. package/dist/data/githubStorage.d.ts +54 -0
  333. package/dist/data/githubStorage.d.ts.map +1 -0
  334. package/dist/data/index.d.ts +3 -0
  335. package/dist/data/index.d.ts.map +1 -0
  336. package/dist/data/localStorage.d.ts +48 -0
  337. package/dist/data/localStorage.d.ts.map +1 -0
  338. package/dist/data/storage.d.ts +33 -0
  339. package/dist/data/storage.d.ts.map +1 -0
  340. package/dist/data/tips.d.ts +12 -0
  341. package/dist/data/tips.d.ts.map +1 -0
  342. package/dist/data/tutorial/builtinFunctions.d.ts +3 -0
  343. package/dist/data/tutorial/builtinFunctions.d.ts.map +1 -0
  344. package/dist/data/tutorial/dashboardTutorial.d.ts +3 -0
  345. package/dist/data/tutorial/dashboardTutorial.d.ts.map +1 -0
  346. package/dist/data/tutorial/demoSetup.d.ts +6 -0
  347. package/dist/data/tutorial/demoSetup.d.ts.map +1 -0
  348. package/dist/data/tutorial/docTypes.d.ts +37 -0
  349. package/dist/data/tutorial/docTypes.d.ts.map +1 -0
  350. package/dist/data/tutorial/documentation.d.ts +3 -0
  351. package/dist/data/tutorial/documentation.d.ts.map +1 -0
  352. package/dist/data/tutorial/functionsReference.d.ts +3 -0
  353. package/dist/data/tutorial/functionsReference.d.ts.map +1 -0
  354. package/dist/data/tutorial/introTutorial.d.ts +3 -0
  355. package/dist/data/tutorial/introTutorial.d.ts.map +1 -0
  356. package/dist/data/tutorial/llmTutorial.d.ts +3 -0
  357. package/dist/data/tutorial/llmTutorial.d.ts.map +1 -0
  358. package/dist/data/tutorial/modelReference.d.ts +3 -0
  359. package/dist/data/tutorial/modelReference.d.ts.map +1 -0
  360. package/dist/data/tutorial/modelTutorial.d.ts +3 -0
  361. package/dist/data/tutorial/modelTutorial.d.ts.map +1 -0
  362. package/dist/data/tutorial/reference.d.ts +3 -0
  363. package/dist/data/tutorial/reference.d.ts.map +1 -0
  364. package/dist/data/tutorial/terms_of_service.d.ts +3 -0
  365. package/dist/data/tutorial/terms_of_service.d.ts.map +1 -0
  366. package/dist/data/tutorial/windowFunctionsReference.d.ts +3 -0
  367. package/dist/data/tutorial/windowFunctionsReference.d.ts.map +1 -0
  368. package/dist/dockerfile-CmV85WZK.js +136 -0
  369. package/dist/ecl--fKn7yzB.js +462 -0
  370. package/dist/editors/editor.d.ts +82 -0
  371. package/dist/editors/editor.d.ts.map +1 -0
  372. package/dist/editors/helpers.d.ts +12 -0
  373. package/dist/editors/helpers.d.ts.map +1 -0
  374. package/dist/editors/index.d.ts +3 -0
  375. package/dist/editors/index.d.ts.map +1 -0
  376. package/dist/editors/results.d.ts +61 -0
  377. package/dist/editors/results.d.ts.map +1 -0
  378. package/dist/elixir-DUhH17ON.js +575 -0
  379. package/dist/events/display.d.ts +9 -0
  380. package/dist/events/display.d.ts.map +1 -0
  381. package/dist/flow9-B3Dx2LLe.js +148 -0
  382. package/dist/freemarker2-de_cA50e.js +995 -0
  383. package/dist/fsharp-SyqBfUAR.js +223 -0
  384. package/dist/go-BbMR2tdT.js +224 -0
  385. package/dist/graphql-DDJE6tIl.js +157 -0
  386. package/dist/handlebars-C8f44E5O.js +425 -0
  387. package/dist/hcl-YBvpaUqf.js +189 -0
  388. package/dist/html-qaggIh0W.js +314 -0
  389. package/dist/html2canvas.esm-dgT_1dIT.js +4871 -0
  390. package/dist/htmlMode-xYurYOLw.js +1587 -0
  391. package/dist/ini-Ct73dBtM.js +77 -0
  392. package/dist/java-C_jlkwoG.js +238 -0
  393. package/dist/javascript-DeLkSgQX.js +76 -0
  394. package/dist/jsonMode-BM-L8w8F.js +2002 -0
  395. package/dist/julia-D8WE5U1e.js +517 -0
  396. package/dist/kotlin-Zy9aq5yB.js +259 -0
  397. package/dist/language/constants.d.ts +6 -0
  398. package/dist/language/constants.d.ts.map +1 -0
  399. package/dist/language/index.d.ts +2 -0
  400. package/dist/language/index.d.ts.map +1 -0
  401. package/dist/less-sZ0iHtE8.js +168 -0
  402. package/dist/lexon-CsdNL29A.js +163 -0
  403. package/dist/liquid-DLNUrc5y.js +246 -0
  404. package/dist/llm/anthropic.d.ts +13 -0
  405. package/dist/llm/anthropic.d.ts.map +1 -0
  406. package/dist/llm/base.d.ts +63 -0
  407. package/dist/llm/base.d.ts.map +1 -0
  408. package/dist/llm/chatAgentPrompt.d.ts +166 -0
  409. package/dist/llm/chatAgentPrompt.d.ts.map +1 -0
  410. package/dist/llm/chatHelpers.d.ts +23 -0
  411. package/dist/llm/chatHelpers.d.ts.map +1 -0
  412. package/dist/llm/chatToolExecutor.d.ts +39 -0
  413. package/dist/llm/chatToolExecutor.d.ts.map +1 -0
  414. package/dist/llm/consts.d.ts +3 -0
  415. package/dist/llm/consts.d.ts.map +1 -0
  416. package/dist/llm/data/constants.d.ts +5 -0
  417. package/dist/llm/data/constants.d.ts.map +1 -0
  418. package/dist/llm/data/models.d.ts +8 -0
  419. package/dist/llm/data/models.d.ts.map +1 -0
  420. package/dist/llm/data/prompts.d.ts +7 -0
  421. package/dist/llm/data/prompts.d.ts.map +1 -0
  422. package/dist/llm/data/testCases.d.ts +13 -0
  423. package/dist/llm/data/testCases.d.ts.map +1 -0
  424. package/dist/llm/googlev2.d.ts +15 -0
  425. package/dist/llm/googlev2.d.ts.map +1 -0
  426. package/dist/llm/index.d.ts +11 -0
  427. package/dist/llm/index.d.ts.map +1 -0
  428. package/dist/llm/mistral.d.ts +11 -0
  429. package/dist/llm/mistral.d.ts.map +1 -0
  430. package/dist/llm/models.d.ts +8 -0
  431. package/dist/llm/models.d.ts.map +1 -0
  432. package/dist/llm/openAI.d.ts +13 -0
  433. package/dist/llm/openAI.d.ts.map +1 -0
  434. package/dist/llm/utils.d.ts +50 -0
  435. package/dist/llm/utils.d.ts.map +1 -0
  436. package/dist/lua-C2YJo0zw.js +168 -0
  437. package/dist/m3-CPLP40SG.js +216 -0
  438. package/dist/main-oVvKtGNk.js +203688 -0
  439. package/dist/main.css +1 -0
  440. package/dist/main.d.ts +23 -0
  441. package/dist/main.d.ts.map +1 -0
  442. package/dist/main.js +22 -0
  443. package/dist/main.umd.cjs +2885 -0
  444. package/dist/markdown-B1mf5e0R.js +235 -0
  445. package/dist/mdx-BmG1effK.js +171 -0
  446. package/dist/mips-DA33BZX1.js +204 -0
  447. package/dist/models/helpers.d.ts +59 -0
  448. package/dist/models/helpers.d.ts.map +1 -0
  449. package/dist/models/import.d.ts +18 -0
  450. package/dist/models/import.d.ts.map +1 -0
  451. package/dist/models/index.d.ts +3 -0
  452. package/dist/models/index.d.ts.map +1 -0
  453. package/dist/models/model.d.ts +241 -0
  454. package/dist/models/model.d.ts.map +1 -0
  455. package/dist/monaco/editorHelpers.d.ts +32 -0
  456. package/dist/monaco/editorHelpers.d.ts.map +1 -0
  457. package/dist/monaco/index.d.ts +2 -0
  458. package/dist/monaco/index.d.ts.map +1 -0
  459. package/dist/monaco/setup.d.ts +2 -0
  460. package/dist/monaco/setup.d.ts.map +1 -0
  461. package/dist/msdax-CCYFIQsP.js +381 -0
  462. package/dist/mysql-hjmIjL-D.js +884 -0
  463. package/dist/objective-c-RRCpEmqC.js +189 -0
  464. package/dist/pascal-CeV8XfxB.js +257 -0
  465. package/dist/pascaligo-IEEGVJAJ.js +170 -0
  466. package/dist/perl-B5-QbHq_.js +632 -0
  467. package/dist/pgsql-s6kqEJmi.js +857 -0
  468. package/dist/php-CWWqzOo8.js +506 -0
  469. package/dist/pla-FSvb_YP_.js +143 -0
  470. package/dist/postiats-DQdscQXO.js +913 -0
  471. package/dist/powerquery-CtA5JA1I.js +896 -0
  472. package/dist/powershell-DglEq96N.js +245 -0
  473. package/dist/prism-sql-8Y2-THrf.js +33 -0
  474. package/dist/protobuf-BSepub3e.js +426 -0
  475. package/dist/pug-B1847F4G.js +408 -0
  476. package/dist/python-BLXKu9hO.js +307 -0
  477. package/dist/qsharp-D4i0Nqg9.js +307 -0
  478. package/dist/r-cdRigKxa.js +249 -0
  479. package/dist/razor-DSEd6veI.js +556 -0
  480. package/dist/redis-D9MFxvE8.js +308 -0
  481. package/dist/redshift-CmCnsvL-.js +815 -0
  482. package/dist/remotes/constants.d.ts +2 -0
  483. package/dist/remotes/constants.d.ts.map +1 -0
  484. package/dist/remotes/displayHelpers.d.ts +67 -0
  485. package/dist/remotes/displayHelpers.d.ts.map +1 -0
  486. package/dist/remotes/modelApiService.d.ts +38 -0
  487. package/dist/remotes/modelApiService.d.ts.map +1 -0
  488. package/dist/remotes/models.d.ts +48 -0
  489. package/dist/remotes/models.d.ts.map +1 -0
  490. package/dist/remotes/storeService.d.ts +42 -0
  491. package/dist/remotes/storeService.d.ts.map +1 -0
  492. package/dist/restructuredtext-CWy8J51t.js +180 -0
  493. package/dist/ruby-WP-c36m5.js +517 -0
  494. package/dist/rust-Q9FLdYpu.js +349 -0
  495. package/dist/sb-C54-JBGT.js +121 -0
  496. package/dist/scala-CzbFImc5.js +376 -0
  497. package/dist/scheme-BhfDmYN3.js +114 -0
  498. package/dist/scss-CEmiBXpS.js +268 -0
  499. package/dist/shell-Bmc1VhG0.js +227 -0
  500. package/dist/solidity-C9Q2I8Hh.js +1373 -0
  501. package/dist/sophia-jWa1UyKz.js +205 -0
  502. package/dist/sparql-CM7jctbc.js +207 -0
  503. package/dist/sql-WzihTkbg.js +859 -0
  504. package/dist/st-6y7_3aup.js +422 -0
  505. package/dist/stores/CredentialManager.vue.d.ts +50 -0
  506. package/dist/stores/CredentialManager.vue.d.ts.map +1 -0
  507. package/dist/stores/Manager.vue.d.ts +100 -0
  508. package/dist/stores/Manager.vue.d.ts.map +1 -0
  509. package/dist/stores/analyticsStore.d.ts +42 -0
  510. package/dist/stores/analyticsStore.d.ts.map +1 -0
  511. package/dist/stores/chatStore.d.ts +153 -0
  512. package/dist/stores/chatStore.d.ts.map +1 -0
  513. package/dist/stores/communityApiStore.d.ts +206 -0
  514. package/dist/stores/communityApiStore.d.ts.map +1 -0
  515. package/dist/stores/connectionHistoryStore.d.ts +24 -0
  516. package/dist/stores/connectionHistoryStore.d.ts.map +1 -0
  517. package/dist/stores/connectionStore.d.ts +31 -0
  518. package/dist/stores/connectionStore.d.ts.map +1 -0
  519. package/dist/stores/dashboardStore.d.ts +122 -0
  520. package/dist/stores/dashboardStore.d.ts.map +1 -0
  521. package/dist/stores/editorStore.d.ts +44 -0
  522. package/dist/stores/editorStore.d.ts.map +1 -0
  523. package/dist/stores/index.d.ts +14 -0
  524. package/dist/stores/index.d.ts.map +1 -0
  525. package/dist/stores/llmStore.d.ts +90 -0
  526. package/dist/stores/llmStore.d.ts.map +1 -0
  527. package/dist/stores/modelStore.d.ts +29 -0
  528. package/dist/stores/modelStore.d.ts.map +1 -0
  529. package/dist/stores/queryExecutionService.d.ts +60 -0
  530. package/dist/stores/queryExecutionService.d.ts.map +1 -0
  531. package/dist/stores/resolver.d.ts +91 -0
  532. package/dist/stores/resolver.d.ts.map +1 -0
  533. package/dist/stores/urlStore.d.ts +6 -0
  534. package/dist/stores/urlStore.d.ts.map +1 -0
  535. package/dist/stores/useScreenNavigation.d.ts +53 -0
  536. package/dist/stores/useScreenNavigation.d.ts.map +1 -0
  537. package/dist/stores/userSettingsStore.d.ts +133 -0
  538. package/dist/stores/userSettingsStore.d.ts.map +1 -0
  539. package/dist/swift-k-0zxG_D.js +318 -0
  540. package/dist/systemverilog-Pnr5_rIP.js +582 -0
  541. package/dist/tcl-fNPXval8.js +238 -0
  542. package/dist/tsMode-CdypNzs1.js +895 -0
  543. package/dist/twig-L2MkztkV.js +398 -0
  544. package/dist/typescript-DZ5G39rT.js +349 -0
  545. package/dist/typespec-Cqqo-3Pt.js +123 -0
  546. package/dist/useDashboard-CPI83oAm.js +3352 -0
  547. package/dist/utility/debounce.d.ts +12 -0
  548. package/dist/utility/debounce.d.ts.map +1 -0
  549. package/dist/utility/markdownRenderer.d.ts +34 -0
  550. package/dist/utility/markdownRenderer.d.ts.map +1 -0
  551. package/dist/utility/testHelpers.d.ts +2 -0
  552. package/dist/utility/testHelpers.d.ts.map +1 -0
  553. package/dist/vb-B5YC2xN9.js +378 -0
  554. package/dist/views/ConnectionView.vue.d.ts +522 -0
  555. package/dist/views/ConnectionView.vue.d.ts.map +1 -0
  556. package/dist/views/CredentialBackgroundPage.vue.d.ts +3 -0
  557. package/dist/views/CredentialBackgroundPage.vue.d.ts.map +1 -0
  558. package/dist/views/IDEPlaceholder.vue.d.ts +3 -0
  559. package/dist/views/IDEPlaceholder.vue.d.ts.map +1 -0
  560. package/dist/views/LLMView.vue.d.ts +7758 -0
  561. package/dist/views/LLMView.vue.d.ts.map +1 -0
  562. package/dist/views/MobileIDEPlaceholder.vue.d.ts +3 -0
  563. package/dist/views/MobileIDEPlaceholder.vue.d.ts.map +1 -0
  564. package/dist/views/ModelView.vue.d.ts +2170 -0
  565. package/dist/views/ModelView.vue.d.ts.map +1 -0
  566. package/dist/views/ResponsiveIDE.vue.d.ts +3 -0
  567. package/dist/views/ResponsiveIDE.vue.d.ts.map +1 -0
  568. package/dist/views/TutorialPage.vue.d.ts +7835 -0
  569. package/dist/views/TutorialPage.vue.d.ts.map +1 -0
  570. package/dist/views/WelcomePage.vue.d.ts +13 -0
  571. package/dist/views/WelcomePage.vue.d.ts.map +1 -0
  572. package/dist/views/index.d.ts +3 -0
  573. package/dist/views/index.d.ts.map +1 -0
  574. package/dist/vite.config.d.ts +3 -0
  575. package/dist/vite.config.d.ts.map +1 -0
  576. package/dist/vitest.config.d.ts +3 -0
  577. package/dist/vitest.config.d.ts.map +1 -0
  578. package/dist/wgsl-B-_uRex7.js +445 -0
  579. package/dist/xml-DsUsyRQY.js +101 -0
  580. package/dist/yaml-BpA1BNpS.js +212 -0
  581. package/package.json +55 -0
@@ -0,0 +1,3352 @@
1
+ import { defineComponent as X, ref as b, watch as ne, createElementBlock as p, createCommentVNode as R, openBlock as m, createElementVNode as t, toDisplayString as N, computed as C, onMounted as pe, onBeforeUnmount as We, normalizeStyle as Ie, Fragment as ce, renderList as we, normalizeClass as H, createTextVNode as G, createBlock as Z, unref as Y, createVNode as z, withCtx as ie, withDirectives as te, withKeys as Ce, vModelText as ye, onUnmounted as $e, inject as j, resolveComponent as J, Teleport as Ue, withModifiers as Pe, createStaticVNode as rt, resolveDynamicComponent as lt, nextTick as Ae, vModelRadio as Te, vShow as at } from "vue";
2
+ import { a as ee, N as st, T as ke, P as je, Q as ze, u as Ge, B as ut, L as dt, U as ct, x as De, w as Le, V as mt, W as ht, M as ft, X as vt, Y as de, J as $, Z as Ee, $ as ae, a0 as ve, a1 as yt, a2 as pt, a3 as Ne, a4 as gt, a5 as Ye, a6 as Je, r as bt, a7 as Ke } from "./main-oVvKtGNk.js";
3
+ const Ct = { class: "popup-header" }, wt = { class: "popup-body" }, kt = { class: "json-container" }, It = { "data-testid": "dashboard-json" }, Dt = { class: "popup-footer" }, St = /* @__PURE__ */ X({
4
+ __name: "DashboardSharePopup",
5
+ props: {
6
+ dashboard: {},
7
+ isOpen: { type: Boolean }
8
+ },
9
+ emits: ["close"],
10
+ setup(e, { emit: o }) {
11
+ const n = e, a = o, i = b(""), l = (y) => {
12
+ if (!y) return null;
13
+ const g = JSON.parse(JSON.stringify(y));
14
+ if (delete g.id, delete g.connection, delete g.storage, delete g.changed, delete g.deleted, g.layout && Array.isArray(g.layout) && (g.layout = g.layout.map((k) => {
15
+ const T = { ...k };
16
+ return delete T.static, delete T.moved, delete T.state, T;
17
+ })), g.gridItems && typeof g.gridItems == "object")
18
+ for (const [k, T] of Object.entries(g.gridItems)) {
19
+ const F = { ...T };
20
+ delete F.results, delete F.loading, delete F.loadStartTime, delete F.error, F.filters || delete F.filters, F.crossFilters || delete F.crossFilters, F.chartFilters || delete F.chartFilters, F.conceptFilters || delete F.conceptFilters, F.chartConfig && delete F.chartConfig.showDebug, g.gridItems[k] = F;
21
+ }
22
+ return g.imports && Array.isArray(g.imports) && (g.imports = g.imports.map((k) => {
23
+ const T = { ...k };
24
+ return delete T.id, T;
25
+ })), g;
26
+ };
27
+ ne(
28
+ [() => n.dashboard, () => n.isOpen],
29
+ ([y, g]) => {
30
+ if (g && y) {
31
+ const k = l(y);
32
+ i.value = JSON.stringify(k, null, 2);
33
+ } else g || (i.value = "");
34
+ },
35
+ { immediate: !0 }
36
+ );
37
+ const r = b(!1), h = () => {
38
+ navigator.clipboard.writeText(i.value).then(() => {
39
+ r.value = !0, setTimeout(() => {
40
+ r.value = !1;
41
+ }, 2e3);
42
+ }).catch((y) => {
43
+ console.error("Could not copy text: ", y);
44
+ });
45
+ }, f = b(null), v = (y) => {
46
+ f.value && !f.value.contains(y.target) && a("close");
47
+ };
48
+ return (y, g) => e.isOpen ? (m(), p("div", {
49
+ key: 0,
50
+ class: "popup-overlay",
51
+ onClick: v
52
+ }, [
53
+ t("div", {
54
+ class: "popup-content",
55
+ ref_key: "popupContent",
56
+ ref: f,
57
+ "data-testid": "dashboard-share-popup"
58
+ }, [
59
+ t("div", Ct, [
60
+ g[1] || (g[1] = t("h3", null, "Definition", -1)),
61
+ t("button", {
62
+ onClick: g[0] || (g[0] = (k) => a("close")),
63
+ class: "close-button",
64
+ "data-testid": "close-popup-button"
65
+ }, " ✕ ")
66
+ ]),
67
+ t("div", wt, [
68
+ t("div", kt, [
69
+ t("pre", It, N(i.value), 1)
70
+ ])
71
+ ]),
72
+ t("div", Dt, [
73
+ t("button", {
74
+ onClick: h,
75
+ class: "dashboard-copy-button",
76
+ "data-testid": "copy-json-button"
77
+ }, N(r.value ? "Copied!" : "Copy"), 1)
78
+ ])
79
+ ], 512)
80
+ ])) : R("", !0);
81
+ }
82
+ }), Tt = /* @__PURE__ */ ee(St, [["__scopeId", "data-v-e0f711ae"]]), Et = ["onClick"], $t = { class: "completion-details" }, Lt = { class: "completion-label" }, Mt = { class: "completion-description" }, qt = /* @__PURE__ */ X({
83
+ __name: "DashboardFilterAutocomplete",
84
+ props: {
85
+ inputValue: {
86
+ type: String,
87
+ required: !0
88
+ },
89
+ completionItems: {
90
+ type: Array,
91
+ required: !0
92
+ },
93
+ inputElement: {
94
+ type: Object,
95
+ default: null
96
+ }
97
+ },
98
+ emits: ["select-completion"],
99
+ setup(e, { emit: o }) {
100
+ const n = e, a = o, i = b(!1), l = b(0), r = b(0), h = b(""), f = b(0), v = b(null), y = C(() => {
101
+ if (!n.inputElement) return {};
102
+ const E = n.inputElement.getBoundingClientRect();
103
+ return {
104
+ top: `${E.bottom + 50}px`,
105
+ left: `${E.left}px`,
106
+ width: `${E.width}px`,
107
+ maxHeight: "200px"
108
+ };
109
+ }), g = () => {
110
+ if (!n.inputElement) return;
111
+ r.value = n.inputElement.selectionStart || 0;
112
+ const E = n.inputValue;
113
+ let M = r.value;
114
+ for (; M > 0 && !/\s/.test(E.charAt(M - 1)); )
115
+ M--;
116
+ let I = r.value;
117
+ for (; I < E.length && !/\s/.test(E.charAt(I)); )
118
+ I++;
119
+ f.value = M, h.value = E.substring(M, I);
120
+ }, k = C(() => {
121
+ if (!h.value.trim()) return [];
122
+ const E = h.value.toLowerCase();
123
+ return n.completionItems.filter((M) => M.label.toLowerCase().includes(E)).sort((M, I) => {
124
+ const B = M.label.toLowerCase().startsWith(E), x = I.label.toLowerCase().startsWith(E);
125
+ return B && !x ? -1 : !B && x ? 1 : M.label.localeCompare(I.label);
126
+ }).slice(0, 10);
127
+ });
128
+ ne(k, (E) => {
129
+ i.value = E.length > 0, l.value = 0;
130
+ });
131
+ const T = (E) => {
132
+ const M = n.inputValue.substring(0, f.value), I = n.inputValue.substring(r.value);
133
+ a("select-completion", {
134
+ text: M + E.label + I,
135
+ cursorPosition: f.value + E.label.length
136
+ }), i.value = !1;
137
+ }, F = (E) => {
138
+ v.value && !v.value.contains(E.target) && n.inputElement !== E.target && (i.value = !1);
139
+ }, _ = (E) => E.trilogySubType ? E.trilogySubType.toLowerCase() : E.type.toLowerCase();
140
+ return ne(
141
+ () => n.inputValue,
142
+ () => {
143
+ g();
144
+ }
145
+ ), pe(() => {
146
+ document.addEventListener("mousedown", F), n.inputElement;
147
+ }), We(() => {
148
+ document.removeEventListener("mousedown", F), n.inputElement;
149
+ }), g(), (E, M) => i.value ? (m(), p("div", {
150
+ key: 0,
151
+ ref_key: "dropdown",
152
+ ref: v,
153
+ class: "autocomplete-dropdown",
154
+ style: Ie(y.value)
155
+ }, [
156
+ (m(!0), p(ce, null, we(k.value, (I, B) => (m(), p("div", {
157
+ key: B,
158
+ class: H(["completion-item", { selected: B === l.value }]),
159
+ onClick: (x) => T(I)
160
+ }, [
161
+ t("div", {
162
+ class: H(["symbol-icon", _(I)])
163
+ }, [
164
+ I.trilogySubType ? (m(), p("i", {
165
+ key: 0,
166
+ class: H(`mdi ${I.trilogySubType === "key" ? "mdi-key-outline" : I.trilogySubType === "property" ? "mdi-tag-outline" : "mdi-cube-outline"}`)
167
+ }, null, 2)) : (m(), p(ce, { key: 1 }, [
168
+ G(N(I.type === "function" ? "ƒ" : I.type === "variable" ? "V" : I.type === "class" ? "C" : I.type === "interface" ? "I" : I.type === "method" ? "M" : I.type === "property" ? "P" : I.type === "field" ? "F" : I.type === "constant" ? "K" : I.type === "enum" ? "E" : I.type === "keyword" ? "K" : "S"), 1)
169
+ ], 64))
170
+ ], 2),
171
+ t("div", $t, [
172
+ t("div", Lt, N(I.label), 1),
173
+ t("div", Mt, N(I.description), 1)
174
+ ])
175
+ ], 10, Et))), 128))
176
+ ], 4)) : R("", !0);
177
+ }
178
+ }), At = /* @__PURE__ */ ee(qt, [["__scopeId", "data-v-71bf654b"]]), Rt = { class: "filter-container" }, Ft = { class: "filter-input-wrapper" }, xt = ["value", "disabled"], Qt = {
179
+ key: 0,
180
+ class: "filter-dropdown"
181
+ }, Vt = ["value", "placeholder", "disabled"], Bt = {
182
+ key: 0,
183
+ class: "dropdown-error-message",
184
+ "data-testid": "dropdown-error-message"
185
+ }, Ot = { class: "dropdown-actions" }, Ht = ["disabled"], Pt = ["disabled"], Nt = {
186
+ key: 0,
187
+ class: "loader-container"
188
+ }, Kt = ["disabled"], _t = ["disabled"], Wt = { class: "button-content" }, Ut = ["disabled"], jt = { class: "button-content" }, zt = {
189
+ key: 0,
190
+ class: "loader-container"
191
+ }, Gt = ["disabled"], Yt = { class: "button-content" }, Jt = {
192
+ key: 4,
193
+ class: "filter-validation-icon"
194
+ }, Zt = {
195
+ key: 0,
196
+ class: "filter-icon error",
197
+ "data-testid": "filter-error-icon"
198
+ }, Xt = {
199
+ key: 1,
200
+ class: "filter-icon valid",
201
+ "data-testid": "filter-valid-icon"
202
+ }, en = /* @__PURE__ */ X({
203
+ __name: "DashboardHeaderFilterInput",
204
+ props: {
205
+ filterValue: {
206
+ type: String,
207
+ default: ""
208
+ },
209
+ filterError: String,
210
+ isLoading: Boolean,
211
+ globalCompletion: {
212
+ type: Array,
213
+ default: () => []
214
+ },
215
+ validateFilter: {
216
+ type: Function,
217
+ default: () => !0
218
+ }
219
+ },
220
+ emits: ["filter-change", "filter-apply", "clear-filter"],
221
+ setup(e, { emit: o }) {
222
+ const n = e, a = o, i = st(), l = b(n.isLoading), r = b(null), h = b(null), f = b(n.filterValue || ""), v = b(!1), y = b(!1), g = C(() => f.value.replace(/\n/g, " ")), k = C(() => !0);
223
+ function T() {
224
+ a("filter-apply", f.value), v.value = !1, M();
225
+ }
226
+ function F() {
227
+ f.value = "", v.value = !0, a("filter-change", ""), a("filter-apply", ""), a("clear-filter", ""), setTimeout(() => {
228
+ h.value && h.value.focus();
229
+ }, 0);
230
+ }
231
+ function _(w) {
232
+ const u = w.target;
233
+ f.value = u.value, v.value = !0, a("filter-change", f.value);
234
+ }
235
+ function E() {
236
+ y.value = !0, setTimeout(() => {
237
+ if (h.value) {
238
+ h.value.focus();
239
+ const w = f.value.length;
240
+ h.value.setSelectionRange(w, w);
241
+ }
242
+ }, 0);
243
+ }
244
+ function M() {
245
+ y.value = !1;
246
+ }
247
+ function I(w) {
248
+ const u = w.target, d = document.querySelector(".filter-dropdown"), S = r.value;
249
+ d && !d.contains(u) && u !== S && M();
250
+ }
251
+ const B = () => {
252
+ l.value = !0;
253
+ let w = n.globalCompletion.map((u) => ({
254
+ name: u.label,
255
+ type: u.datatype,
256
+ description: u.description
257
+ }));
258
+ i.generateFilterQuery(f.value, w, n.validateFilter).then((u) => {
259
+ u && u.length > 0 && (f.value = u.replace(/^\s*where\s+/i, ""), v.value = !0, a("filter-apply", f.value)), l.value = !1;
260
+ }).catch(() => {
261
+ l.value = !1;
262
+ });
263
+ };
264
+ function x(w) {
265
+ w.key === "Enter" && !w.shiftKey && !w.ctrlKey && !w.altKey ? y.value || (w.preventDefault(), T()) : (w.ctrlKey || w.metaKey) && w.shiftKey && w.key === "Enter" ? (w.preventDefault(), B()) : w.key === "Escape" && y.value && (w.preventDefault(), M());
266
+ }
267
+ function A(w) {
268
+ (w.ctrlKey || w.metaKey) && w.key === "Enter" && !w.shiftKey ? (w.preventDefault(), T()) : (w.ctrlKey || w.metaKey) && w.shiftKey && w.key === "Enter" ? (w.preventDefault(), B()) : w.key === "Escape" && (w.preventDefault(), M());
269
+ }
270
+ const D = C(() => (n.filterError || "").length > 0 ? "error" : f.value ? "valid" : "neutral");
271
+ function U(w) {
272
+ f.value = w.text, v.value = !0, a("filter-change", f.value);
273
+ const u = y.value ? h.value : r.value;
274
+ u && (u.focus(), u.setSelectionRange(w.cursorPosition, w.cursorPosition));
275
+ }
276
+ return ne(
277
+ () => n.filterValue,
278
+ (w) => {
279
+ w !== f.value && (f.value = w || "", v.value = !1);
280
+ }
281
+ ), ne(
282
+ () => n.isLoading,
283
+ (w) => {
284
+ l.value = w;
285
+ }
286
+ ), ne(y, (w) => {
287
+ w ? document.addEventListener("click", I) : document.removeEventListener("click", I);
288
+ }), (w, u) => (m(), p("div", Rt, [
289
+ t("div", Ft, [
290
+ t("input", {
291
+ id: "filter",
292
+ "data-testid": "filter-input",
293
+ type: "text",
294
+ value: g.value,
295
+ onInput: _,
296
+ onKeydown: x,
297
+ onFocus: E,
298
+ placeholder: "Add a global filter...",
299
+ class: H({ "filter-error": D.value === "error" }),
300
+ disabled: l.value,
301
+ ref_key: "filterInputRef",
302
+ ref: r
303
+ }, null, 42, xt),
304
+ y.value ? (m(), p("div", Qt, [
305
+ t("div", { class: "dropdown-header" }, [
306
+ u[1] || (u[1] = t("span", null, "Global Filters", -1)),
307
+ t("button", {
308
+ onClick: M,
309
+ class: "close-button",
310
+ title: "Close (Esc)"
311
+ }, [...u[0] || (u[0] = [
312
+ t("i", { class: "mdi mdi-close" }, null, -1)
313
+ ])])
314
+ ]),
315
+ t("textarea", {
316
+ ref_key: "filterTextareaRef",
317
+ ref: h,
318
+ class: H(["filter-textarea", { "filter-error": D.value === "error" }]),
319
+ value: f.value,
320
+ onInput: _,
321
+ onKeydown: A,
322
+ placeholder: Y(i).hasActiveDefaultConnection ? `Use a SQL condition (ex color='blue' or color='red') or text to filter.
323
+ Use Ctrl+Enter to apply, Ctrl+Shift+Enter for text to SQL` : `Use a SQL condition (ex color='blue') to filter.
324
+ Use Ctrl+Enter to apply`,
325
+ disabled: l.value,
326
+ rows: "4"
327
+ }, null, 42, Vt),
328
+ e.filterError ? (m(), p("div", Bt, [
329
+ u[2] || (u[2] = t("i", { class: "mdi mdi-alert-circle" }, null, -1)),
330
+ t("span", null, N(e.filterError), 1)
331
+ ])) : R("", !0),
332
+ t("div", Ot, [
333
+ t("button", {
334
+ onClick: T,
335
+ class: H(["apply-button", { "has-changes": v.value }]),
336
+ disabled: l.value,
337
+ title: "Apply filter (Ctrl+Enter)"
338
+ }, [...u[3] || (u[3] = [
339
+ t("i", { class: "mdi mdi-check" }, null, -1),
340
+ G(" Apply ", -1)
341
+ ])], 10, Ht),
342
+ Y(i).hasActiveDefaultConnection ? (m(), p("button", {
343
+ key: 0,
344
+ onClick: B,
345
+ class: "llm-button",
346
+ disabled: l.value,
347
+ title: "Text to filter (Ctrl+Shift+Enter)"
348
+ }, [
349
+ t("i", {
350
+ class: H(["mdi mdi-creation", { hidden: l.value }])
351
+ }, null, 2),
352
+ l.value ? (m(), p("div", Nt, [...u[4] || (u[4] = [
353
+ t("div", { class: "loader" }, null, -1)
354
+ ])])) : R("", !0),
355
+ u[5] || (u[5] = G(" Text to Filter ", -1))
356
+ ], 8, Pt)) : R("", !0),
357
+ t("button", {
358
+ onClick: F,
359
+ class: "clear-button",
360
+ disabled: l.value,
361
+ title: "Clear filter"
362
+ }, [...u[6] || (u[6] = [
363
+ t("i", { class: "mdi mdi-close-circle-outline" }, null, -1),
364
+ G(" Clear ", -1)
365
+ ])], 8, Kt)
366
+ ])
367
+ ])) : R("", !0),
368
+ (y.value ? h.value : r.value) ? (m(), Z(At, {
369
+ key: 1,
370
+ "input-value": f.value,
371
+ "completion-items": e.globalCompletion,
372
+ "input-element": y.value ? h.value : r.value,
373
+ onSelectCompletion: U
374
+ }, null, 8, ["input-value", "completion-items", "input-element"])) : R("", !0),
375
+ t("button", {
376
+ onClick: T,
377
+ class: H(["search-button", { "has-changes": v.value }]),
378
+ "data-testid": "filter-search-button",
379
+ disabled: l.value,
380
+ title: "Apply filter (Enter)"
381
+ }, [
382
+ t("div", Wt, [
383
+ u[8] || (u[8] = t("i", { class: "mdi mdi-magnify" }, null, -1)),
384
+ z(ke, {
385
+ content: v.value ? "Apply changes (Enter)" : "Search (Enter)",
386
+ position: "top"
387
+ }, {
388
+ default: ie(() => [...u[7] || (u[7] = [
389
+ t("span", { class: "tooltip-trigger" }, null, -1)
390
+ ])]),
391
+ _: 1
392
+ }, 8, ["content"])
393
+ ])
394
+ ], 10, _t),
395
+ Y(i).hasActiveDefaultConnection ? (m(), p("button", {
396
+ key: 2,
397
+ onClick: B,
398
+ class: "sparkle-button",
399
+ "data-testid": "filter-llm-button",
400
+ disabled: l.value,
401
+ title: "Transform text to filter if you have a configured LLM connection"
402
+ }, [
403
+ t("div", jt, [
404
+ t("i", {
405
+ class: H(["mdi mdi-creation", { hidden: l.value }])
406
+ }, null, 2),
407
+ l.value ? (m(), p("div", zt, [...u[9] || (u[9] = [
408
+ t("div", { class: "loader" }, null, -1)
409
+ ])])) : R("", !0),
410
+ z(ke, {
411
+ content: l.value ? "Processing..." : "Text to filter (Ctrl+Shift+Enter)",
412
+ position: "top"
413
+ }, {
414
+ default: ie(() => [...u[10] || (u[10] = [
415
+ t("span", { class: "tooltip-trigger" }, null, -1)
416
+ ])]),
417
+ _: 1
418
+ }, 8, ["content"])
419
+ ])
420
+ ], 8, Ut)) : R("", !0),
421
+ k.value ? (m(), p("button", {
422
+ key: 3,
423
+ onClick: F,
424
+ class: "clear-filters-button",
425
+ "data-testid": "clear-filters-button",
426
+ disabled: l.value,
427
+ title: "Clear all filters"
428
+ }, [
429
+ t("div", Yt, [
430
+ u[12] || (u[12] = t("i", { class: "mdi mdi-close" }, null, -1)),
431
+ z(ke, {
432
+ content: "Clear all filters",
433
+ position: "top"
434
+ }, {
435
+ default: ie(() => [...u[11] || (u[11] = [
436
+ t("span", { class: "tooltip-trigger" }, null, -1)
437
+ ])]),
438
+ _: 1
439
+ })
440
+ ])
441
+ ], 8, Gt)) : R("", !0),
442
+ D.value !== "neutral" ? (m(), p("div", Jt, [
443
+ D.value === "error" ? (m(), p("div", Zt, [
444
+ u[14] || (u[14] = t("span", { class: "icon-x" }, "✕", -1)),
445
+ z(ke, {
446
+ content: e.filterError || "Unknown Error",
447
+ position: "bottom"
448
+ }, {
449
+ default: ie(() => [...u[13] || (u[13] = [
450
+ t("span", {
451
+ class: "tooltip-trigger",
452
+ "data-testid": "filter-error-tooltip-trigger"
453
+ }, null, -1)
454
+ ])]),
455
+ _: 1
456
+ }, 8, ["content"])
457
+ ])) : D.value === "valid" ? (m(), p("div", Xt, [
458
+ z(ke, {
459
+ content: "This is a syntactically correct filter.",
460
+ position: "top"
461
+ }, {
462
+ default: ie(() => [...u[15] || (u[15] = [
463
+ t("span", {
464
+ class: "icon-check",
465
+ "data-testid": "filter-valid-tooltip-trigger"
466
+ }, "✓", -1)
467
+ ])]),
468
+ _: 1
469
+ })
470
+ ])) : R("", !0)
471
+ ])) : R("", !0)
472
+ ])
473
+ ]));
474
+ }
475
+ }), tn = /* @__PURE__ */ ee(en, [["__scopeId", "data-v-b8827229"]]), nn = {
476
+ class: "dashboard-controls",
477
+ "data-testid": "dashboard-controls"
478
+ }, on = {
479
+ key: 0,
480
+ class: "controls-row title-row"
481
+ }, rn = {
482
+ key: 0,
483
+ class: "editable-text"
484
+ }, ln = {
485
+ key: 0,
486
+ class: "edit-indicator",
487
+ "data-testid": "edit-dashboard-title"
488
+ }, an = { class: "dashboard-right-controls" }, sn = {
489
+ class: "connection-selector",
490
+ "data-testid": "connection-selector-wrapper"
491
+ }, un = { class: "select-wrapper" }, dn = ["value"], cn = ["value"], mn = { class: "grid-actions" }, hn = {
492
+ key: 1,
493
+ class: "controls-row title-only-row"
494
+ }, fn = {
495
+ key: 0,
496
+ class: "editable-text"
497
+ }, vn = { class: "controls-row filter-row" }, yn = { class: "grid-actions" }, pn = {
498
+ class: "mode-selector",
499
+ "data-testid": "mode-selector-wrapper"
500
+ }, gn = { class: "select-wrapper" }, bn = ["value", "disabled"], Cn = /* @__PURE__ */ X({
501
+ __name: "DashboardHeader",
502
+ props: {
503
+ dashboard: {
504
+ type: Object,
505
+ required: !0
506
+ },
507
+ editsLocked: Boolean,
508
+ selectedConnection: {
509
+ type: String,
510
+ required: !0
511
+ },
512
+ filterError: String,
513
+ globalCompletion: {
514
+ type: Array,
515
+ default: () => []
516
+ },
517
+ validateFilter: {
518
+ type: Function,
519
+ default: () => !0
520
+ }
521
+ },
522
+ emits: [
523
+ "connection-change",
524
+ "filter-change",
525
+ "import-change",
526
+ "add-item",
527
+ "clear-items",
528
+ "clear-filter",
529
+ "mode-change",
530
+ "refresh",
531
+ "title-update",
532
+ "export-image"
533
+ ],
534
+ setup(e, { emit: o }) {
535
+ const n = e, a = o, i = je(), l = ze(), r = Ge(), h = b(!1), f = b(!1), v = b(!1), y = b(""), g = b(null);
536
+ function k() {
537
+ f.value = !f.value;
538
+ }
539
+ function T() {
540
+ f.value = !1;
541
+ }
542
+ function F(u) {
543
+ a("filter-change", u);
544
+ }
545
+ async function _() {
546
+ return a("export-image"), await new Promise((u) => setTimeout(u, 5e3)), Promise.resolve();
547
+ }
548
+ function E(u) {
549
+ const d = u.target;
550
+ a("mode-change", d.value);
551
+ }
552
+ function M() {
553
+ var u;
554
+ n.editsLocked || (v.value = !0, y.value = ((u = n.dashboard) == null ? void 0 : u.name) || "Untitled Dashboard", setTimeout(() => {
555
+ var d;
556
+ (d = g.value) == null || d.focus();
557
+ }, 0));
558
+ }
559
+ function I() {
560
+ v.value = !1, a("title-update", y.value);
561
+ }
562
+ function B() {
563
+ var u;
564
+ v.value = !1, y.value = ((u = n.dashboard) == null ? void 0 : u.name) || "Untitled Dashboard";
565
+ }
566
+ const x = C(() => Object.values(l.editors).filter((d) => d.connection === n.selectedConnection).sort((d, S) => d.name.localeCompare(S.name)).map((d) => ({
567
+ id: d.id,
568
+ // Convert folder path separators (/) to Python import syntax (.)
569
+ name: d.name.replace(/\//g, "."),
570
+ alias: ""
571
+ }))), A = C(() => {
572
+ var u;
573
+ return ((u = n.dashboard) == null ? void 0 : u.imports) || [];
574
+ });
575
+ function D(u) {
576
+ a("import-change", u);
577
+ }
578
+ function U() {
579
+ a("refresh");
580
+ }
581
+ const w = C(() => {
582
+ var u;
583
+ switch ((u = n.dashboard) == null ? void 0 : u.state) {
584
+ case "editing":
585
+ return "mdi mdi-pencil-outline";
586
+ case "published":
587
+ return "mdi mdi-eye-outline";
588
+ case "fullscreen":
589
+ return "mdi mdi-fullscreen";
590
+ default:
591
+ return "mdi mdi-eye-outline";
592
+ }
593
+ });
594
+ return (u, d) => {
595
+ var S, L, Q;
596
+ return m(), p("div", nn, [
597
+ e.dashboard.state === "editing" ? (m(), p("div", on, [
598
+ t("div", {
599
+ class: "dashboard-title",
600
+ onClick: M
601
+ }, [
602
+ v.value ? te((m(), p("input", {
603
+ key: 1,
604
+ ref_key: "titleInput",
605
+ ref: g,
606
+ "data-testid": "dashboard-title-input",
607
+ "onUpdate:modelValue": d[0] || (d[0] = (K) => y.value = K),
608
+ onBlur: I,
609
+ onKeyup: [
610
+ Ce(I, ["enter"]),
611
+ Ce(B, ["esc"])
612
+ ],
613
+ class: "title-input",
614
+ type: "text"
615
+ }, null, 544)), [
616
+ [ye, y.value]
617
+ ]) : (m(), p("span", rn, [
618
+ G(N(((S = e.dashboard) == null ? void 0 : S.name) || "Untitled Dashboard") + " ", 1),
619
+ e.editsLocked ? R("", !0) : (m(), p("span", ln, " ✎ "))
620
+ ]))
621
+ ]),
622
+ t("div", an, [
623
+ t("div", sn, [
624
+ t("div", un, [
625
+ d[7] || (d[7] = t("i", { class: "mdi mdi-database-outline select-icon" }, null, -1)),
626
+ t("select", {
627
+ id: "connection",
628
+ "data-testid": "connection-selector",
629
+ onChange: d[1] || (d[1] = (K) => u.$emit("connection-change", K)),
630
+ value: e.selectedConnection
631
+ }, [
632
+ (m(!0), p(ce, null, we(Object.values(Y(i).connections).filter(
633
+ (K) => K.model
634
+ ), (K) => (m(), p("option", {
635
+ key: K.name,
636
+ value: K.name
637
+ }, N(K.name), 9, cn))), 128))
638
+ ], 40, dn)
639
+ ])
640
+ ]),
641
+ z(ut, {
642
+ "available-imports": x.value,
643
+ "active-imports": A.value,
644
+ "onUpdate:imports": D,
645
+ onExplore: d[2] || (d[2] = (K) => Y(r).openTab("editors", null, K.id))
646
+ }, null, 8, ["available-imports", "active-imports"]),
647
+ t("div", mn, [
648
+ t("button", {
649
+ onClick: d[3] || (d[3] = (K) => u.$emit("add-item")),
650
+ class: "btn btn-success",
651
+ "data-testid": "add-item-button"
652
+ }, " Add Item "),
653
+ t("button", {
654
+ onClick: d[4] || (d[4] = (K) => u.$emit("clear-items")),
655
+ class: "btn btn-danger",
656
+ "data-testid": "clear-items-button"
657
+ }, " Clear All ")
658
+ ])
659
+ ])
660
+ ])) : (m(), p("div", hn, [
661
+ t("div", {
662
+ class: "dashboard-title",
663
+ onClick: M
664
+ }, [
665
+ v.value ? te((m(), p("input", {
666
+ key: 1,
667
+ ref_key: "titleInput",
668
+ ref: g,
669
+ "data-testid": "dashboard-title-input",
670
+ "onUpdate:modelValue": d[5] || (d[5] = (K) => y.value = K),
671
+ onBlur: I,
672
+ onKeyup: [
673
+ Ce(I, ["enter"]),
674
+ Ce(B, ["esc"])
675
+ ],
676
+ class: "title-input",
677
+ type: "text"
678
+ }, null, 544)), [
679
+ [ye, y.value]
680
+ ]) : (m(), p("span", fn, N(((L = e.dashboard) == null ? void 0 : L.name) || "Untitled Dashboard"), 1))
681
+ ])
682
+ ])),
683
+ t("div", vn, [
684
+ z(tn, {
685
+ "filter-value": ((Q = e.dashboard) == null ? void 0 : Q.filter) || "",
686
+ "filter-error": e.filterError,
687
+ "is-loading": h.value,
688
+ "global-completion": e.globalCompletion,
689
+ "validate-filter": e.validateFilter,
690
+ onFilterApply: F,
691
+ onClearFilter: d[6] || (d[6] = (K) => u.$emit("clear-filter", ""))
692
+ }, null, 8, ["filter-value", "filter-error", "is-loading", "global-completion", "validate-filter"]),
693
+ t("div", yn, [
694
+ z(dt, {
695
+ action: _,
696
+ "use-default-style": !1,
697
+ class: "btn btn-secondary",
698
+ "data-testid": "download-button",
699
+ "test-id": "download-button"
700
+ }, {
701
+ default: ie(() => [...d[8] || (d[8] = [
702
+ G(" Download ", -1)
703
+ ])]),
704
+ _: 1
705
+ }),
706
+ t("button", {
707
+ onClick: k,
708
+ class: "btn btn-secondary",
709
+ "data-testid": "share-dashboard-button"
710
+ }, " Export "),
711
+ t("button", {
712
+ onClick: U,
713
+ class: "btn btn-primary",
714
+ "data-testid": "refresh-button"
715
+ }, " ⟳ Refresh "),
716
+ t("div", pn, [
717
+ t("div", gn, [
718
+ t("i", {
719
+ class: H(w.value + " select-icon")
720
+ }, null, 2),
721
+ t("select", {
722
+ id: "viewMode",
723
+ "data-testid": "mode-selector",
724
+ onChange: E,
725
+ value: e.dashboard.state,
726
+ disabled: e.editsLocked,
727
+ class: "mode-select"
728
+ }, [...d[9] || (d[9] = [
729
+ t("option", {
730
+ value: "editing",
731
+ "data-testid": "edit-mode-option"
732
+ }, "Edit", -1),
733
+ t("option", {
734
+ value: "published",
735
+ "data-testid": "view-mode-option"
736
+ }, "View", -1),
737
+ t("option", {
738
+ value: "fullscreen",
739
+ "data-testid": "fullscreen-mode-option"
740
+ }, "Fullscreen", -1)
741
+ ])], 40, bn)
742
+ ])
743
+ ])
744
+ ])
745
+ ]),
746
+ z(Tt, {
747
+ dashboard: e.dashboard,
748
+ "is-open": f.value,
749
+ onClose: T
750
+ }, null, 8, ["dashboard", "is-open"])
751
+ ]);
752
+ };
753
+ }
754
+ }), pi = /* @__PURE__ */ ee(Cn, [["__scopeId", "data-v-47b2477d"]]), wn = X({
755
+ name: "DashboardChart",
756
+ components: {
757
+ VegaLiteChart: mt,
758
+ ErrorMessage: Le,
759
+ LoadingView: De,
760
+ DrilldownPane: ct
761
+ },
762
+ props: {
763
+ dashboardId: {
764
+ type: String,
765
+ required: !0
766
+ },
767
+ itemId: {
768
+ type: String,
769
+ required: !0
770
+ },
771
+ getItemData: {
772
+ type: Function,
773
+ required: !0,
774
+ default: () => ({ type: "CHART", content: "" })
775
+ },
776
+ setItemData: {
777
+ type: Function,
778
+ required: !0,
779
+ default: () => ({ type: "CHART", content: "" })
780
+ },
781
+ editMode: {
782
+ type: Boolean,
783
+ required: !0
784
+ },
785
+ symbols: {
786
+ type: Array,
787
+ required: !0
788
+ },
789
+ getDashboardQueryExecutor: {
790
+ type: Function,
791
+ required: !0
792
+ }
793
+ },
794
+ setup(e, { emit: o }) {
795
+ const n = b(!1), a = b(null), i = b(null), l = b(!1), r = b(null), h = b(null), f = C(() => e.getItemData(e.itemId, e.dashboardId)), v = () => {
796
+ if (!a.value) return 0;
797
+ const W = a.value.getBoundingClientRect(), oe = window.scrollY || document.documentElement.scrollTop, se = W.top + oe, fe = Math.floor(se / 200) * 10;
798
+ return Math.min(fe, 100);
799
+ };
800
+ pe(() => {
801
+ setTimeout(() => {
802
+ const W = v();
803
+ g.value ? setTimeout(() => {
804
+ n.value = !0;
805
+ }, W) : n.value = !0;
806
+ }, 0);
807
+ }), $e(() => {
808
+ r.value && (clearTimeout(r.value), r.value = null);
809
+ });
810
+ const y = C(() => f.value.structured_content.query), g = C(() => f.value.results || null), k = C(() => f.value.name || ""), T = C(() => (f.value.height || 300) - 75), F = C(() => f.value.width || 300), _ = C(() => f.value.chartConfig || null), E = C(() => f.value.loading || !1), M = C(() => f.value.error || null), I = C(() => f.value.loadStartTime || null), B = C(() => (f.value.chartFilters || []).map((W) => W.value)), x = C(() => f.value.hasDrilldown), A = C(() => f.value.onRefresh || null);
811
+ ne(
812
+ E,
813
+ (W, oe) => {
814
+ r.value && (clearTimeout(r.value), r.value = null), W ? r.value = setTimeout(() => {
815
+ l.value = !0, r.value = null;
816
+ }, 250) : l.value = !1;
817
+ },
818
+ { immediate: !0 }
819
+ );
820
+ const D = j("connectionStore"), U = j(
821
+ "analyticsStore",
822
+ null
823
+ ), w = (W) => {
824
+ if (x.value) {
825
+ e.setItemData(e.itemId, e.dashboardId, { drilldownChartConfig: W });
826
+ return;
827
+ }
828
+ e.setItemData(e.itemId, e.dashboardId, { chartConfig: W });
829
+ };
830
+ if (!D)
831
+ throw new Error("Connection store not found!");
832
+ const u = async () => {
833
+ if (!y.value) return;
834
+ const W = e.getDashboardQueryExecutor(e.dashboardId);
835
+ if (!W)
836
+ throw new Error("Dashboard query executor not found!");
837
+ try {
838
+ U && U.log("dashboard-chart-execution", "CHART", !0), i.value && W.cancelQuery(i.value);
839
+ let oe = await W.runSingle(e.itemId);
840
+ await W.waitForQuery(oe);
841
+ } catch (oe) {
842
+ console.error("Error setting up query:", oe), i.value = null;
843
+ }
844
+ }, d = () => {
845
+ A.value ? A.value(e.itemId) : u();
846
+ }, S = (W) => {
847
+ o("dimension-click", {
848
+ source: e.itemId,
849
+ filters: W.filters,
850
+ chart: W.chart,
851
+ append: W.append
852
+ });
853
+ }, L = () => {
854
+ o("background-click");
855
+ }, Q = (W) => {
856
+ let oe = W.filters, se = Object.keys(oe)[0], fe = ht(W.filters);
857
+ se && (h.value = { remove: se, filter: fe });
858
+ }, K = async () => {
859
+ e.setItemData(e.itemId, e.dashboardId, {
860
+ drilldown: null,
861
+ drilldownChartConfig: null,
862
+ loading: !0
863
+ }), await u();
864
+ }, me = async (W) => {
865
+ let se = await e.getDashboardQueryExecutor(e.dashboardId).createDrilldownQuery(
866
+ y.value,
867
+ W,
868
+ h.value.remove,
869
+ h.value.filter
870
+ );
871
+ e.setItemData(e.itemId, e.dashboardId, {
872
+ drilldown: se,
873
+ drilldownChartConfig: null,
874
+ loading: !0
875
+ }), n.value = !1, l.value = !0, h.value = null, await u().then(() => {
876
+ n.value = !0;
877
+ }).catch((fe) => {
878
+ console.error("Error executing drilldown query:", fe), n.value = !0;
879
+ }).finally(() => {
880
+ l.value = !1;
881
+ });
882
+ }, he = b(!1);
883
+ return {
884
+ chartContainer: a,
885
+ results: g,
886
+ ready: n,
887
+ loading: E,
888
+ showLoading: l,
889
+ error: M,
890
+ query: y,
891
+ chartHeight: T,
892
+ chartWidth: F,
893
+ chartConfig: _,
894
+ chartTitle: k,
895
+ onChartConfigChange: w,
896
+ onRefresh: A,
897
+ handleLocalRefresh: d,
898
+ chartSelection: B,
899
+ startTime: I,
900
+ handleDimensionClick: S,
901
+ handleBackgroundClick: L,
902
+ activeDrilldown: h,
903
+ activateDrilldown: Q,
904
+ submitDrilldown: me,
905
+ controlsVisible: he,
906
+ onChartMouseEnter: () => {
907
+ he.value = !0;
908
+ },
909
+ onChartMouseLeave: () => {
910
+ he.value = !1;
911
+ },
912
+ revertDrilldown: K,
913
+ hasDrilldown: x
914
+ };
915
+ }
916
+ }), kn = {
917
+ key: 3,
918
+ class: "loading-overlay"
919
+ };
920
+ function In(e, o, n, a, i, l) {
921
+ const r = J("drilldown-pane"), h = J("ErrorMessage"), f = J("VegaLiteChart"), v = J("LoadingView");
922
+ return m(), p("div", {
923
+ ref: "chartContainer",
924
+ class: H(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
925
+ onMouseenter: o[3] || (o[3] = (...y) => e.onChartMouseEnter && e.onChartMouseEnter(...y)),
926
+ onMouseleave: o[4] || (o[4] = (...y) => e.onChartMouseLeave && e.onChartMouseLeave(...y))
927
+ }, [
928
+ e.activeDrilldown ? (m(), Z(r, {
929
+ key: 0,
930
+ "drilldown-remove": e.activeDrilldown.remove,
931
+ "drilldown-filter": e.activeDrilldown.filter,
932
+ onClose: o[0] || (o[0] = (y) => e.activeDrilldown = null),
933
+ symbols: e.symbols,
934
+ onSubmit: e.submitDrilldown
935
+ }, null, 8, ["drilldown-remove", "drilldown-filter", "symbols", "onSubmit"])) : e.error && !e.loading ? (m(), Z(h, {
936
+ key: 1,
937
+ class: "chart-placeholder"
938
+ }, {
939
+ default: ie(() => [
940
+ G(N(e.error), 1)
941
+ ]),
942
+ _: 1
943
+ })) : e.results && e.ready && !e.loading ? (m(), Z(f, {
944
+ key: 2,
945
+ id: `${e.itemId}-${e.dashboardId}`,
946
+ columns: e.results.headers,
947
+ data: e.results.data,
948
+ showControls: e.editMode,
949
+ initialConfig: e.chartConfig || void 0,
950
+ containerHeight: e.chartHeight,
951
+ "container-width": e.chartWidth,
952
+ onChartConfigChange: e.onChartConfigChange,
953
+ chartSelection: e.chartSelection,
954
+ chartTitle: e.chartTitle,
955
+ "drilldown-active": e.hasDrilldown,
956
+ onDimensionClick: e.handleDimensionClick,
957
+ onBackgroundClick: e.handleBackgroundClick,
958
+ onRefreshClick: e.handleLocalRefresh,
959
+ onDrilldownClick: e.activateDrilldown,
960
+ onRevertDrilldown: e.revertDrilldown
961
+ }, null, 8, ["id", "columns", "data", "showControls", "initialConfig", "containerHeight", "container-width", "onChartConfigChange", "chartSelection", "chartTitle", "drilldown-active", "onDimensionClick", "onBackgroundClick", "onRefreshClick", "onDrilldownClick", "onRevertDrilldown"])) : R("", !0),
962
+ e.loading && e.showLoading ? (m(), p("div", kn, [
963
+ z(v, {
964
+ startTime: e.startTime,
965
+ text: "Loading"
966
+ }, null, 8, ["startTime"])
967
+ ])) : R("", !0),
968
+ !e.editMode || !(e.results && e.ready) ? (m(), p("div", {
969
+ key: 4,
970
+ class: H(["controls-toggle", { "controls-visible": e.controlsVisible }])
971
+ }, [
972
+ t("button", {
973
+ onClick: o[1] || (o[1] = (...y) => e.handleLocalRefresh && e.handleLocalRefresh(...y)),
974
+ class: "control-btn",
975
+ "data-testid": "refresh-chart-btn",
976
+ title: "Refresh table"
977
+ }, [...o[5] || (o[5] = [
978
+ t("i", { class: "mdi mdi-refresh icon" }, null, -1)
979
+ ])]),
980
+ t("button", {
981
+ onClick: o[2] || (o[2] = (...y) => e.revertDrilldown && e.revertDrilldown(...y)),
982
+ class: "control-btn",
983
+ "data-testid": "refresh-chart-btn",
984
+ title: "Clear Drilldown"
985
+ }, [...o[6] || (o[6] = [
986
+ t("i", { class: "mdi mdi-undo icon" }, null, -1)
987
+ ])])
988
+ ], 2)) : R("", !0)
989
+ ], 34);
990
+ }
991
+ const Dn = /* @__PURE__ */ ee(wn, [["render", In], ["__scopeId", "data-v-973d4802"]]), Sn = X({
992
+ name: "DynamicMarkdownChart",
993
+ components: {
994
+ ErrorMessage: Le,
995
+ LoadingView: De,
996
+ MarkdownRenderer: ft
997
+ },
998
+ props: {
999
+ dashboardId: {
1000
+ type: String,
1001
+ required: !0
1002
+ },
1003
+ itemId: {
1004
+ type: String,
1005
+ required: !0
1006
+ },
1007
+ getItemData: {
1008
+ type: Function,
1009
+ required: !0,
1010
+ default: () => ({ type: "MARKDOWN", content: { markdown: "", query: "" } })
1011
+ },
1012
+ setItemData: {
1013
+ type: Function,
1014
+ required: !0,
1015
+ default: () => ({ type: "MARKDOWN", content: { markdown: "", query: "" } })
1016
+ },
1017
+ editMode: {
1018
+ type: Boolean,
1019
+ required: !0
1020
+ },
1021
+ getDashboardQueryExecutor: {
1022
+ type: Function,
1023
+ required: !0
1024
+ }
1025
+ },
1026
+ setup(e) {
1027
+ const o = b(!1), n = b(null), a = b(null), i = b(!1), l = () => {
1028
+ i.value = !0;
1029
+ }, r = () => {
1030
+ i.value = !1;
1031
+ }, h = () => {
1032
+ if (!n.value) return 0;
1033
+ const x = n.value.getBoundingClientRect(), A = window.scrollY || document.documentElement.scrollTop, D = x.top + A, U = Math.floor(D / 200) * 10;
1034
+ return Math.min(U, 100);
1035
+ };
1036
+ pe(() => {
1037
+ setTimeout(() => {
1038
+ const x = h();
1039
+ g.value ? setTimeout(() => {
1040
+ o.value = !0;
1041
+ }, x) : o.value = !0;
1042
+ }, 0);
1043
+ });
1044
+ const f = C(() => e.getItemData(e.itemId, e.dashboardId).structured_content || { markdown: "", query: "" }), v = C(() => f.value.markdown || ""), y = C(() => f.value.query || ""), g = C(() => e.getItemData(e.itemId, e.dashboardId).results || null), k = C(() => e.getItemData(e.itemId, e.dashboardId).loading || !1), T = C(() => e.getItemData(e.itemId, e.dashboardId).error || null), F = C(() => e.getItemData(e.itemId, e.dashboardId).loadStartTime || null), _ = C(() => e.getItemData(e.itemId, e.dashboardId).onRefresh || null), E = j("connectionStore"), M = j("analyticsStore");
1045
+ if (!E)
1046
+ throw new Error("Connection store not found!");
1047
+ const I = async () => {
1048
+ if (!y.value)
1049
+ return;
1050
+ const x = e.getDashboardQueryExecutor(e.dashboardId);
1051
+ if (!x)
1052
+ throw new Error("Dashboard query executor not found!");
1053
+ try {
1054
+ M && M.log("dashboard-markdown-execution", "MARKDOWN", !0), a.value && x.cancelQuery(a.value);
1055
+ let A = await x.runSingle(e.itemId);
1056
+ await x.waitForQuery(A);
1057
+ } catch (A) {
1058
+ console.error("Error setting up query:", A), a.value = null;
1059
+ }
1060
+ };
1061
+ return {
1062
+ chartContainer: n,
1063
+ results: g,
1064
+ ready: o,
1065
+ loading: k,
1066
+ error: T,
1067
+ query: y,
1068
+ markdown: v,
1069
+ onRefresh: _,
1070
+ handleLocalRefresh: () => {
1071
+ _.value ? _.value(e.itemId) : I();
1072
+ },
1073
+ startTime: F,
1074
+ controlsVisible: i,
1075
+ onChartMouseEnter: l,
1076
+ onChartMouseLeave: r
1077
+ };
1078
+ }
1079
+ });
1080
+ function Tn(e, o, n, a, i, l) {
1081
+ const r = J("ErrorMessage"), h = J("MarkdownRenderer");
1082
+ return m(), p("div", {
1083
+ ref: "chartContainer",
1084
+ class: H(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
1085
+ onMouseenter: o[1] || (o[1] = (...f) => e.onChartMouseEnter && e.onChartMouseEnter(...f)),
1086
+ onMouseleave: o[2] || (o[2] = (...f) => e.onChartMouseLeave && e.onChartMouseLeave(...f))
1087
+ }, [
1088
+ e.error && !e.loading ? (m(), Z(r, {
1089
+ key: 0,
1090
+ class: "chart-placeholder"
1091
+ }, {
1092
+ default: ie(() => [
1093
+ G(N(e.error), 1)
1094
+ ]),
1095
+ _: 1
1096
+ })) : e.ready ? (m(), Z(h, {
1097
+ key: 1,
1098
+ markdown: e.markdown,
1099
+ results: e.results,
1100
+ loading: e.loading
1101
+ }, null, 8, ["markdown", "results", "loading"])) : R("", !0),
1102
+ !e.loading && e.editMode ? (m(), p("div", {
1103
+ key: 2,
1104
+ class: H(["controls-toggle", { "controls-visible": e.controlsVisible }])
1105
+ }, [
1106
+ t("button", {
1107
+ onClick: o[0] || (o[0] = (...f) => e.handleLocalRefresh && e.handleLocalRefresh(...f)),
1108
+ class: "control-btn",
1109
+ "data-testid": "refresh-chart-btn",
1110
+ title: "Refresh text"
1111
+ }, [...o[3] || (o[3] = [
1112
+ t("i", { class: "mdi mdi-refresh icon" }, null, -1)
1113
+ ])])
1114
+ ], 2)) : R("", !0)
1115
+ ], 34);
1116
+ }
1117
+ const En = /* @__PURE__ */ ee(Sn, [["render", Tn], ["__scopeId", "data-v-b4abaf19"]]), $n = X({
1118
+ name: "DashboardChart",
1119
+ components: {
1120
+ DataTable: vt,
1121
+ ErrorMessage: Le,
1122
+ LoadingView: De
1123
+ },
1124
+ props: {
1125
+ dashboardId: {
1126
+ type: String,
1127
+ required: !0
1128
+ },
1129
+ itemId: {
1130
+ type: String,
1131
+ required: !0
1132
+ },
1133
+ getItemData: {
1134
+ type: Function,
1135
+ required: !0,
1136
+ default: () => ({ type: "CHART", content: "" })
1137
+ },
1138
+ setItemData: {
1139
+ type: Function,
1140
+ required: !0,
1141
+ default: () => ({ type: "CHART", content: "" })
1142
+ },
1143
+ editMode: {
1144
+ type: Boolean,
1145
+ required: !0
1146
+ },
1147
+ getDashboardQueryExecutor: {
1148
+ type: Function,
1149
+ required: !0
1150
+ }
1151
+ },
1152
+ setup(e, { emit: o }) {
1153
+ const n = b(!1), a = b(null), i = b(null), l = b(!1), r = b(null), h = b(!1), f = () => {
1154
+ h.value = !0;
1155
+ }, v = () => {
1156
+ h.value = !1;
1157
+ }, y = () => {
1158
+ if (!a.value) return 0;
1159
+ const d = a.value.getBoundingClientRect(), S = window.scrollY || document.documentElement.scrollTop, L = d.top + S, Q = Math.floor(L / 200) * 10;
1160
+ return Math.min(Q, 100);
1161
+ };
1162
+ pe(() => {
1163
+ setTimeout(() => {
1164
+ const d = y();
1165
+ k.value ? setTimeout(() => {
1166
+ n.value = !0;
1167
+ }, d) : n.value = !0;
1168
+ }, 0);
1169
+ }), $e(() => {
1170
+ r.value && (clearTimeout(r.value), r.value = null);
1171
+ });
1172
+ const g = C(() => e.getItemData(e.itemId, e.dashboardId).content), k = C(() => e.getItemData(e.itemId, e.dashboardId).results || null), T = C(() => e.getItemData(e.itemId, e.dashboardId).loading || !1), F = C(() => e.getItemData(e.itemId, e.dashboardId).error || null), _ = C(() => e.getItemData(e.itemId, e.dashboardId).loadStartTime || null), E = C(() => (e.getItemData(e.itemId, e.dashboardId).height || 300) - 75), M = C(() => (e.getItemData(e.itemId, e.dashboardId).width || 300) - 100), I = C(() => e.getItemData(e.itemId, e.dashboardId).chartConfig || null), B = C(() => e.getItemData(e.itemId, e.dashboardId).onRefresh || null);
1173
+ ne(
1174
+ T,
1175
+ (d, S) => {
1176
+ r.value && (clearTimeout(r.value), r.value = null), d ? r.value = setTimeout(() => {
1177
+ l.value = !0, r.value = null;
1178
+ }, 150) : l.value = !1;
1179
+ },
1180
+ { immediate: !0 }
1181
+ );
1182
+ const x = j("connectionStore"), A = j("analyticsStore");
1183
+ if (!x)
1184
+ throw new Error("Connection store not found!");
1185
+ const D = async () => {
1186
+ if (!g.value) return;
1187
+ const d = e.getDashboardQueryExecutor(e.dashboardId);
1188
+ if (!d)
1189
+ throw new Error("Dashboard query executor not found!");
1190
+ try {
1191
+ A && A.log("dashboard-table-execution", "TABLE", !0), i.value && d.cancelQuery(i.value);
1192
+ let S = await d.runSingle(e.itemId);
1193
+ await d.waitForQuery(S);
1194
+ } catch (S) {
1195
+ console.error("Error setting up query:", S), i.value = null;
1196
+ }
1197
+ };
1198
+ return {
1199
+ chartContainer: a,
1200
+ results: k,
1201
+ ready: n,
1202
+ loading: T,
1203
+ showLoading: l,
1204
+ error: F,
1205
+ query: g,
1206
+ chartHeight: E,
1207
+ chartWidth: M,
1208
+ chartConfig: I,
1209
+ onRefresh: B,
1210
+ handleLocalRefresh: () => {
1211
+ B.value ? B.value(e.itemId) : D();
1212
+ },
1213
+ startTime: _,
1214
+ handleDimensionClick: (d) => {
1215
+ o("dimension-click", {
1216
+ source: e.itemId,
1217
+ filters: d.filters,
1218
+ chart: d.chart,
1219
+ append: d.append
1220
+ });
1221
+ },
1222
+ handleBackgroundClick: () => {
1223
+ o("background-click");
1224
+ },
1225
+ controlsVisible: h,
1226
+ onChartMouseEnter: f,
1227
+ onChartMouseLeave: v
1228
+ };
1229
+ }
1230
+ }), Ln = {
1231
+ key: 2,
1232
+ class: "loading-overlay"
1233
+ };
1234
+ function Mn(e, o, n, a, i, l) {
1235
+ const r = J("ErrorMessage"), h = J("data-table"), f = J("LoadingView");
1236
+ return m(), p("div", {
1237
+ ref: "chartContainer",
1238
+ class: H(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
1239
+ onMouseenter: o[1] || (o[1] = (...v) => e.onChartMouseEnter && e.onChartMouseEnter(...v)),
1240
+ onMouseleave: o[2] || (o[2] = (...v) => e.onChartMouseLeave && e.onChartMouseLeave(...v))
1241
+ }, [
1242
+ e.error && !e.loading ? (m(), Z(r, {
1243
+ key: 0,
1244
+ class: "chart-placeholder"
1245
+ }, {
1246
+ default: ie(() => [
1247
+ G(N(e.error), 1)
1248
+ ]),
1249
+ _: 1
1250
+ })) : e.ready && e.results ? (m(), Z(h, {
1251
+ key: 1,
1252
+ id: `${e.itemId}-${e.dashboardId}`,
1253
+ headers: e.results.headers,
1254
+ results: e.results.data,
1255
+ containerHeight: e.chartHeight,
1256
+ prettyPrint: !0,
1257
+ fitParent: !0,
1258
+ onCellClick: e.handleDimensionClick,
1259
+ onBackgroundClick: e.handleBackgroundClick
1260
+ }, null, 8, ["id", "headers", "results", "containerHeight", "onCellClick", "onBackgroundClick"])) : R("", !0),
1261
+ e.loading && e.showLoading ? (m(), p("div", Ln, [
1262
+ z(f, {
1263
+ startTime: e.startTime,
1264
+ text: "Loading"
1265
+ }, null, 8, ["startTime"])
1266
+ ])) : R("", !0),
1267
+ !e.loading && e.editMode ? (m(), p("div", {
1268
+ key: 3,
1269
+ class: H(["controls-toggle", { "controls-visible": e.controlsVisible }])
1270
+ }, [
1271
+ t("button", {
1272
+ onClick: o[0] || (o[0] = (...v) => e.handleLocalRefresh && e.handleLocalRefresh(...v)),
1273
+ class: "control-btn",
1274
+ "data-testid": "refresh-chart-btn",
1275
+ title: "Refresh table"
1276
+ }, [...o[3] || (o[3] = [
1277
+ t("i", { class: "mdi mdi-refresh icon" }, null, -1)
1278
+ ])])
1279
+ ], 2)) : R("", !0)
1280
+ ], 34);
1281
+ }
1282
+ const qn = /* @__PURE__ */ ee($n, [["render", Mn], ["__scopeId", "data-v-fcabd793"]]), An = {
1283
+ data() {
1284
+ return {
1285
+ selectedValue: "",
1286
+ selectedLabel: "",
1287
+ searchText: "",
1288
+ showDropdown: !1,
1289
+ inputElement: null
1290
+ };
1291
+ },
1292
+ props: {
1293
+ headers: {
1294
+ type: Map,
1295
+ required: !0
1296
+ },
1297
+ results: {
1298
+ type: Array,
1299
+ required: !0
1300
+ },
1301
+ containerHeight: Number,
1302
+ cellClick: {
1303
+ type: Function,
1304
+ default: () => {
1305
+ }
1306
+ },
1307
+ backgroundClick: {
1308
+ type: Function,
1309
+ default: () => {
1310
+ }
1311
+ },
1312
+ prettyPrint: {
1313
+ type: Boolean,
1314
+ default: !1
1315
+ },
1316
+ fitParent: {
1317
+ type: Boolean,
1318
+ default: !1
1319
+ }
1320
+ },
1321
+ setup() {
1322
+ const e = j("userSettingsStore");
1323
+ if (!e)
1324
+ throw new Error("userSettingsStore not provided");
1325
+ const o = C(() => e.settings.theme);
1326
+ return {
1327
+ settingsStore: e,
1328
+ currentTheme: o
1329
+ };
1330
+ },
1331
+ computed: {
1332
+ headersArray() {
1333
+ return Array.from(this.headers.values());
1334
+ },
1335
+ firstColumn() {
1336
+ return this.headersArray[0] || null;
1337
+ },
1338
+ secondColumn() {
1339
+ return this.headersArray[1] || null;
1340
+ },
1341
+ displayColumn() {
1342
+ return this.firstColumn;
1343
+ },
1344
+ valueColumn() {
1345
+ return this.secondColumn || this.firstColumn;
1346
+ },
1347
+ selectOptions() {
1348
+ if (!this.displayColumn || !this.valueColumn || !this.results || this.results.length === 0)
1349
+ return [];
1350
+ const e = this.displayColumn.name, o = this.valueColumn.name, n = [];
1351
+ return this.results.forEach((a) => {
1352
+ const i = a[e], l = a[o];
1353
+ if (i != null && l !== null && l !== void 0) {
1354
+ const r = this.formatValue(i, this.displayColumn);
1355
+ n.push({
1356
+ label: r,
1357
+ value: l
1358
+ });
1359
+ }
1360
+ }), n;
1361
+ },
1362
+ filteredOptions() {
1363
+ if (!this.searchText)
1364
+ return this.selectOptions;
1365
+ const e = this.searchText.toLowerCase();
1366
+ return this.selectOptions.filter((o) => o.label.toLowerCase().includes(e));
1367
+ },
1368
+ placeholderText() {
1369
+ var e;
1370
+ return this.hasSelection ? this.selectedLabel || "Type to search..." : !this.selectOptions || this.selectOptions.length === 0 ? "No data available" : this.firstColumn ? `Select ${(e = this.firstColumn) == null ? void 0 : e.name}` : "Select an option";
1371
+ },
1372
+ hasSelection() {
1373
+ return !!(this.selectedLabel && this.selectedValue);
1374
+ },
1375
+ fieldLabel() {
1376
+ var e;
1377
+ return ((e = this.firstColumn) == null ? void 0 : e.name) || "Field";
1378
+ },
1379
+ dropdownStyle() {
1380
+ if (!this.inputElement)
1381
+ return {};
1382
+ const e = this.inputElement.getBoundingClientRect();
1383
+ return {
1384
+ position: "fixed",
1385
+ top: `${e.bottom}px`,
1386
+ left: `${e.left}px`,
1387
+ width: `${e.width}px`
1388
+ };
1389
+ }
1390
+ },
1391
+ mounted() {
1392
+ this.selectedLabel && !this.searchText && (this.searchText = this.selectedLabel);
1393
+ },
1394
+ watch: {
1395
+ // Watch for external changes to selectedLabel and update searchText accordingly
1396
+ selectedLabel(e) {
1397
+ e && !this.showDropdown && (this.searchText = e);
1398
+ }
1399
+ },
1400
+ methods: {
1401
+ formatValue(e, o) {
1402
+ var n, a;
1403
+ switch (o.type) {
1404
+ case de.FLOAT:
1405
+ return (n = o.traits) != null && n.includes("usd") ? `$${Number(e).toFixed(o.scale || 2)}` : (a = o.traits) != null && a.includes("percent") ? `${(Number(e) * 100).toFixed(2)}%` : Number(e).toFixed(o.scale || 2);
1406
+ case de.DATETIME:
1407
+ case de.TIMESTAMP:
1408
+ case de.DATE:
1409
+ case de.TIME:
1410
+ return e instanceof Date ? e.toLocaleString() : String(e);
1411
+ case de.BOOLEAN:
1412
+ return e ? "✓" : "✗";
1413
+ case de.ARRAY:
1414
+ case de.STRUCT:
1415
+ return JSON.stringify(e);
1416
+ default:
1417
+ return String(e);
1418
+ }
1419
+ },
1420
+ highlightMatch(e) {
1421
+ if (!this.searchText)
1422
+ return e;
1423
+ const o = this.searchText.toLowerCase(), a = e.toLowerCase().indexOf(o);
1424
+ if (a === -1)
1425
+ return e;
1426
+ const i = e.slice(0, a), l = e.slice(a, a + this.searchText.length), r = e.slice(a + this.searchText.length);
1427
+ return `${i}<mark>${l}</mark>${r}`;
1428
+ },
1429
+ selectOption(e) {
1430
+ this.selectedValue = e.value, this.selectedLabel = e.label, this.searchText = e.label, this.showDropdown = !1, this.handleSelection();
1431
+ },
1432
+ selectAll() {
1433
+ this.selectedValue = "", this.selectedLabel = "", this.searchText = "", this.showDropdown = !1, this.$emit("background-click"), this.backgroundClick();
1434
+ },
1435
+ onSearchInput() {
1436
+ this.searchText !== this.selectedLabel && this.selectedLabel && (this.selectedValue = "", this.selectedLabel = ""), this.showDropdown = !0, this.updateInputElement();
1437
+ },
1438
+ handleFocus() {
1439
+ this.searchText = "", this.showDropdown = !0, this.updateInputElement();
1440
+ },
1441
+ updateInputElement() {
1442
+ this.inputElement = this.$refs.searchInput;
1443
+ },
1444
+ handleBlur() {
1445
+ setTimeout(() => {
1446
+ this.showDropdown = !1, this.selectedLabel && !this.searchText && (this.searchText = this.selectedLabel);
1447
+ }, 200);
1448
+ },
1449
+ handleSelection() {
1450
+ if (!this.valueColumn || !this.selectedValue)
1451
+ return;
1452
+ const e = this.valueColumn.address || this.valueColumn.name;
1453
+ this.$emit("cell-click", {
1454
+ filters: { [e]: this.selectedValue },
1455
+ append: !1
1456
+ });
1457
+ }
1458
+ }
1459
+ }, Rn = { class: "result-select row pa-0 ba-0" }, Fn = { class: "select-container" }, xn = { class: "search-input-wrapper" }, Qn = {
1460
+ key: 0,
1461
+ class: "inline-label"
1462
+ }, Vn = ["placeholder", "disabled"], Bn = ["onMousedown", "innerHTML"];
1463
+ function On(e, o, n, a, i, l) {
1464
+ return m(), p("div", Rn, [
1465
+ t("div", Fn, [
1466
+ t("div", xn, [
1467
+ l.hasSelection ? (m(), p("span", Qn, N(l.fieldLabel) + ": ", 1)) : R("", !0),
1468
+ te(t("input", {
1469
+ ref: "searchInput",
1470
+ "onUpdate:modelValue": o[0] || (o[0] = (r) => i.searchText = r),
1471
+ type: "text",
1472
+ class: H(["search-input", { "has-inline-label": l.hasSelection }]),
1473
+ placeholder: l.placeholderText,
1474
+ disabled: !l.selectOptions || l.selectOptions.length === 0,
1475
+ onFocus: o[1] || (o[1] = (...r) => l.handleFocus && l.handleFocus(...r)),
1476
+ onInput: o[2] || (o[2] = (...r) => l.onSearchInput && l.onSearchInput(...r)),
1477
+ onBlur: o[3] || (o[3] = (...r) => l.handleBlur && l.handleBlur(...r))
1478
+ }, null, 42, Vn), [
1479
+ [ye, i.searchText]
1480
+ ]),
1481
+ o[5] || (o[5] = t("span", { class: "search-icon" }, [
1482
+ t("svg", {
1483
+ xmlns: "http://www.w3.org/2000/svg",
1484
+ viewBox: "0 0 24 24",
1485
+ fill: "none",
1486
+ stroke: "currentColor",
1487
+ "stroke-width": "2",
1488
+ "stroke-linecap": "round",
1489
+ "stroke-linejoin": "round"
1490
+ }, [
1491
+ t("circle", {
1492
+ cx: "11",
1493
+ cy: "11",
1494
+ r: "8"
1495
+ }),
1496
+ t("path", { d: "m21 21-4.35-4.35" })
1497
+ ])
1498
+ ], -1))
1499
+ ]),
1500
+ (m(), Z(Ue, { to: "body" }, [
1501
+ i.showDropdown && l.filteredOptions.length > 0 ? (m(), p("div", {
1502
+ key: 0,
1503
+ class: "dropdown-list",
1504
+ style: Ie(l.dropdownStyle)
1505
+ }, [
1506
+ t("div", {
1507
+ class: H(["dropdown-item select-all", { selected: !i.selectedValue }]),
1508
+ onMousedown: o[4] || (o[4] = Pe((...r) => l.selectAll && l.selectAll(...r), ["prevent"]))
1509
+ }, " Select All ", 34),
1510
+ (m(!0), p(ce, null, we(l.filteredOptions, (r, h) => (m(), p("div", {
1511
+ key: h,
1512
+ class: H(["dropdown-item", { selected: i.selectedValue === r.value }]),
1513
+ onMousedown: Pe((f) => l.selectOption(r), ["prevent"]),
1514
+ innerHTML: l.highlightMatch(r.label)
1515
+ }, null, 42, Bn))), 128))
1516
+ ], 4)) : R("", !0),
1517
+ i.showDropdown && i.searchText && l.filteredOptions.length === 0 ? (m(), p("div", {
1518
+ key: 1,
1519
+ class: "dropdown-list",
1520
+ style: Ie(l.dropdownStyle)
1521
+ }, [...o[6] || (o[6] = [
1522
+ t("div", { class: "dropdown-item no-results" }, "No matches found", -1)
1523
+ ])], 4)) : R("", !0)
1524
+ ]))
1525
+ ])
1526
+ ]);
1527
+ }
1528
+ const Hn = /* @__PURE__ */ ee(An, [["render", On], ["__scopeId", "data-v-db5bbc35"]]), Pn = X({
1529
+ name: "DashboardChart",
1530
+ components: {
1531
+ DashboardDataSelector: Hn,
1532
+ ErrorMessage: Le,
1533
+ LoadingView: De
1534
+ },
1535
+ props: {
1536
+ dashboardId: {
1537
+ type: String,
1538
+ required: !0
1539
+ },
1540
+ itemId: {
1541
+ type: String,
1542
+ required: !0
1543
+ },
1544
+ getItemData: {
1545
+ type: Function,
1546
+ required: !0,
1547
+ default: () => ({ type: "CHART", content: "" })
1548
+ },
1549
+ setItemData: {
1550
+ type: Function,
1551
+ required: !0,
1552
+ default: () => ({ type: "CHART", content: "" })
1553
+ },
1554
+ editMode: {
1555
+ type: Boolean,
1556
+ required: !0
1557
+ },
1558
+ getDashboardQueryExecutor: {
1559
+ type: Function,
1560
+ required: !0
1561
+ }
1562
+ },
1563
+ setup(e, { emit: o }) {
1564
+ const n = b(!1), a = b(null), i = b(null), l = b(!1), r = b(null), h = b(!1), f = () => {
1565
+ h.value = !0;
1566
+ }, v = () => {
1567
+ h.value = !1;
1568
+ }, y = () => {
1569
+ if (!a.value) return 0;
1570
+ const d = a.value.getBoundingClientRect(), S = window.scrollY || document.documentElement.scrollTop, L = d.top + S, Q = Math.floor(L / 200) * 10;
1571
+ return Math.min(Q, 100);
1572
+ };
1573
+ pe(() => {
1574
+ setTimeout(() => {
1575
+ const d = y();
1576
+ k.value ? setTimeout(() => {
1577
+ n.value = !0;
1578
+ }, d) : n.value = !0;
1579
+ }, 0);
1580
+ }), $e(() => {
1581
+ r.value && (clearTimeout(r.value), r.value = null);
1582
+ });
1583
+ const g = C(() => e.getItemData(e.itemId, e.dashboardId).content), k = C(() => e.getItemData(e.itemId, e.dashboardId).results || null), T = C(() => e.getItemData(e.itemId, e.dashboardId).loading || !1), F = C(() => e.getItemData(e.itemId, e.dashboardId).error || null), _ = C(() => e.getItemData(e.itemId, e.dashboardId).loadStartTime || null), E = C(() => (e.getItemData(e.itemId, e.dashboardId).height || 300) - 75), M = C(() => (e.getItemData(e.itemId, e.dashboardId).width || 300) - 100), I = C(() => e.getItemData(e.itemId, e.dashboardId).chartConfig || null), B = C(() => e.getItemData(e.itemId, e.dashboardId).onRefresh || null);
1584
+ ne(
1585
+ T,
1586
+ (d, S) => {
1587
+ r.value && (clearTimeout(r.value), r.value = null), d ? r.value = setTimeout(() => {
1588
+ l.value = !0, r.value = null;
1589
+ }, 150) : l.value = !1;
1590
+ },
1591
+ { immediate: !0 }
1592
+ );
1593
+ const x = j("connectionStore"), A = j("analyticsStore");
1594
+ if (!x)
1595
+ throw new Error("Connection store not found!");
1596
+ const D = async () => {
1597
+ if (!g.value) return;
1598
+ const d = e.getDashboardQueryExecutor(e.dashboardId);
1599
+ if (!d)
1600
+ throw new Error("Dashboard query executor not found!");
1601
+ try {
1602
+ A && A.log("dashboard-table-execution", "TABLE", !0), i.value && d.cancelQuery(i.value);
1603
+ let S = await d.runSingle(e.itemId);
1604
+ await d.waitForQuery(S);
1605
+ } catch (S) {
1606
+ console.error("Error setting up query:", S), i.value = null;
1607
+ }
1608
+ };
1609
+ return {
1610
+ chartContainer: a,
1611
+ results: k,
1612
+ ready: n,
1613
+ loading: T,
1614
+ showLoading: l,
1615
+ error: F,
1616
+ query: g,
1617
+ chartHeight: E,
1618
+ chartWidth: M,
1619
+ chartConfig: I,
1620
+ onRefresh: B,
1621
+ handleLocalRefresh: () => {
1622
+ B.value ? B.value(e.itemId) : D();
1623
+ },
1624
+ startTime: _,
1625
+ handleDimensionClick: (d) => {
1626
+ o("dimension-click", {
1627
+ source: e.itemId,
1628
+ filters: d.filters,
1629
+ chart: d.chart,
1630
+ append: d.append
1631
+ });
1632
+ },
1633
+ handleBackgroundClick: () => {
1634
+ o("background-click");
1635
+ },
1636
+ controlsVisible: h,
1637
+ onChartMouseEnter: f,
1638
+ onChartMouseLeave: v
1639
+ };
1640
+ }
1641
+ }), Nn = {
1642
+ key: 2,
1643
+ class: "loading-overlay"
1644
+ };
1645
+ function Kn(e, o, n, a, i, l) {
1646
+ const r = J("ErrorMessage"), h = J("dashboard-data-selector"), f = J("LoadingView");
1647
+ return m(), p("div", {
1648
+ ref: "chartContainer",
1649
+ class: H(["chart-placeholder no-drag", { "chart-placeholder-edit-mode": e.editMode }]),
1650
+ onMouseenter: o[0] || (o[0] = (...v) => e.onChartMouseEnter && e.onChartMouseEnter(...v)),
1651
+ onMouseleave: o[1] || (o[1] = (...v) => e.onChartMouseLeave && e.onChartMouseLeave(...v))
1652
+ }, [
1653
+ e.error && !e.loading ? (m(), Z(r, {
1654
+ key: 0,
1655
+ class: "chart-placeholder"
1656
+ }, {
1657
+ default: ie(() => [
1658
+ G(N(e.error), 1)
1659
+ ]),
1660
+ _: 1
1661
+ })) : e.ready && e.results ? (m(), Z(h, {
1662
+ key: 1,
1663
+ id: `${e.itemId}-${e.dashboardId}`,
1664
+ headers: e.results.headers,
1665
+ results: e.results.data,
1666
+ containerHeight: e.chartHeight,
1667
+ prettyPrint: !0,
1668
+ fitParent: !0,
1669
+ onCellClick: e.handleDimensionClick,
1670
+ onBackgroundClick: e.handleBackgroundClick
1671
+ }, null, 8, ["id", "headers", "results", "containerHeight", "onCellClick", "onBackgroundClick"])) : R("", !0),
1672
+ e.loading && e.showLoading ? (m(), p("div", Nn, [
1673
+ z(f, {
1674
+ startTime: e.startTime,
1675
+ text: "Loading"
1676
+ }, null, 8, ["startTime"])
1677
+ ])) : R("", !0)
1678
+ ], 34);
1679
+ }
1680
+ const _n = /* @__PURE__ */ ee(Pn, [["render", Kn], ["__scopeId", "data-v-2e938e5d"]]), Wn = ["data-testid"], Un = ["data-testid"], jn = ["data-testid"], zn = ["data-testid"], Gn = ["data-testid", "title"], Yn = {
1681
+ key: 0,
1682
+ class: "mdi mdi-filter-remove-outline icon"
1683
+ }, Jn = {
1684
+ key: 1,
1685
+ class: "mdi mdi-filter-outline icon"
1686
+ }, Zn = ["data-testid"], Xn = ["data-testid"], eo = { class: "item-title-container no-drag" }, to = ["id", "placeholder"], no = { class: "content-area" }, oo = {
1687
+ key: 2,
1688
+ class: "filters-overlay"
1689
+ }, io = {
1690
+ key: 0,
1691
+ class: "filters-container edit-mode"
1692
+ }, ro = ["title"], lo = { class: "filter-content" }, ao = { class: "filter-source" }, so = { class: "filter-value" }, uo = ["onClick"], co = {
1693
+ key: 0,
1694
+ class: "filters-container view-mode"
1695
+ }, mo = {
1696
+ key: 0,
1697
+ class: "filter-summary"
1698
+ }, ho = {
1699
+ key: 1,
1700
+ class: "filter-details"
1701
+ }, fo = ["title"], vo = { class: "filter-content" }, yo = { class: "filter-source" }, po = { class: "filter-value" }, go = ["onClick", "title"], bo = /* @__PURE__ */ X({
1702
+ __name: "DashboardGridItem",
1703
+ props: {
1704
+ dashboardId: {},
1705
+ item: {},
1706
+ editMode: { type: Boolean },
1707
+ symbols: {},
1708
+ getItemData: { type: Function },
1709
+ getDashboardQueryExecutor: { type: Function },
1710
+ setItemData: { type: Function }
1711
+ },
1712
+ emits: ["edit-content", "update-dimensions", "dimension-click", "background-click", "remove-filter", "remove-item", "copy-item"],
1713
+ setup(e, { emit: o }) {
1714
+ const n = e, a = o, i = b(!1), l = b(""), r = b(!1), h = b(!1);
1715
+ function f(S) {
1716
+ return S.replace(/'''/g, "'").replace("local.", "");
1717
+ }
1718
+ function v(S, L = 1e3) {
1719
+ const Q = f(S);
1720
+ return Q.length <= L ? Q : Q.substring(0, L) + "...";
1721
+ }
1722
+ function y() {
1723
+ if (!n.editMode) return;
1724
+ const S = n.getItemData(n.item.i, n.dashboardId);
1725
+ i.value = !0, l.value = S.name, setTimeout(() => {
1726
+ const L = document.getElementById(`title-input-${n.item.i}`);
1727
+ L && L.focus();
1728
+ }, 0);
1729
+ }
1730
+ function g() {
1731
+ if (i.value) {
1732
+ const S = n.getItemData(n.item.i, n.dashboardId), L = l.value.trim() || S.name;
1733
+ n.setItemData(n.item.i, n.dashboardId, { name: L }), i.value = !1;
1734
+ }
1735
+ }
1736
+ function k() {
1737
+ const L = !n.getItemData(n.item.i, n.dashboardId).allowCrossFilter;
1738
+ n.setItemData(n.item.i, n.dashboardId, {
1739
+ allowCrossFilter: L
1740
+ });
1741
+ }
1742
+ function T() {
1743
+ const S = n.item.h + 1;
1744
+ n.setItemData(n.item.i, n.dashboardId, {
1745
+ dimensions: {
1746
+ width: n.item.w,
1747
+ height: S
1748
+ }
1749
+ });
1750
+ }
1751
+ function F() {
1752
+ const S = Math.max(1, n.item.h - 1);
1753
+ n.setItemData(n.item.i, n.dashboardId, {
1754
+ dimensions: {
1755
+ width: n.item.w,
1756
+ height: S
1757
+ }
1758
+ });
1759
+ }
1760
+ function _() {
1761
+ i.value = !1;
1762
+ }
1763
+ function E() {
1764
+ a("edit-content", n.item);
1765
+ }
1766
+ function M() {
1767
+ confirm(`Are you sure you want to remove "${D.value.name}"?`) && a("remove-item", n.item.i);
1768
+ }
1769
+ function I() {
1770
+ a("copy-item", n.item.i);
1771
+ }
1772
+ function B(S) {
1773
+ a("dimension-click", S);
1774
+ }
1775
+ function x() {
1776
+ a("background-click", n.item.i);
1777
+ }
1778
+ function A(S) {
1779
+ a("remove-filter", n.item.i, S);
1780
+ }
1781
+ const D = C(() => n.getItemData(n.item.i, n.dashboardId)), U = C(() => {
1782
+ switch (D.value.type) {
1783
+ case $.CHART:
1784
+ return Dn;
1785
+ case $.TABLE:
1786
+ return qn;
1787
+ case $.FILTER:
1788
+ return _n;
1789
+ case $.MARKDOWN:
1790
+ default:
1791
+ return En;
1792
+ }
1793
+ }), w = C(() => {
1794
+ switch (D.value.type) {
1795
+ case $.CHART:
1796
+ return "Chart Name";
1797
+ case $.TABLE:
1798
+ return "Table Name";
1799
+ case $.FILTER:
1800
+ return "Filter Name";
1801
+ case $.MARKDOWN:
1802
+ default:
1803
+ return "Note Name";
1804
+ }
1805
+ }), u = C(() => [$.CHART, $.TABLE, $.MARKDOWN].includes(D.value.type)), d = C(() => D.value.filters ? D.value.filters.length : 0);
1806
+ return (S, L) => (m(), p("div", {
1807
+ class: H(["grid-item-content", {
1808
+ "grid-item-chart-style": [Y($).CHART, Y($).TABLE, Y($).FILTER].includes(
1809
+ //@ts-ignore
1810
+ D.value.type
1811
+ ),
1812
+ "grid-item-edit-style": e.editMode
1813
+ }]),
1814
+ "data-testid": `dashboard-component-${e.item.i}`,
1815
+ onMouseenter: L[1] || (L[1] = () => {
1816
+ r.value = !0, h.value = !0;
1817
+ }),
1818
+ onMouseleave: L[2] || (L[2] = () => {
1819
+ r.value = !1, h.value = !1;
1820
+ })
1821
+ }, [
1822
+ e.editMode ? (m(), p("div", {
1823
+ key: 0,
1824
+ class: H(["header-controls", { "header-visible": r.value || i.value }]),
1825
+ "data-testid": "dashboard-item-header-controls"
1826
+ }, [
1827
+ t("button", {
1828
+ onClick: T,
1829
+ class: "control-btn",
1830
+ "data-testid": `increase-height-item-${e.item.i}`,
1831
+ title: "Increase height"
1832
+ }, [...L[3] || (L[3] = [
1833
+ t("i", { class: "mdi mdi-plus icon" }, null, -1)
1834
+ ])], 8, Un),
1835
+ t("button", {
1836
+ onClick: F,
1837
+ class: "control-btn",
1838
+ "data-testid": `decrease-height-item-${e.item.i}`,
1839
+ title: "Decrease height"
1840
+ }, [...L[4] || (L[4] = [
1841
+ t("i", { class: "mdi mdi-minus icon" }, null, -1)
1842
+ ])], 8, jn),
1843
+ t("button", {
1844
+ onClick: E,
1845
+ class: "control-btn",
1846
+ "data-testid": `edit-dashboard-item-content-${e.item.i}`,
1847
+ title: "Edit data"
1848
+ }, [...L[5] || (L[5] = [
1849
+ t("i", { class: "mdi mdi-database-edit-outline icon" }, null, -1)
1850
+ ])], 8, zn),
1851
+ t("button", {
1852
+ onClick: k,
1853
+ class: "control-btn",
1854
+ "data-testid": `toggle-crossfilter-item-content-${e.item.i}`,
1855
+ title: D.value.allowCrossFilter ? "Toggle cross-filtering OFF" : "Toggle cross-filtering ON"
1856
+ }, [
1857
+ D.value.allowCrossFilter ? (m(), p("i", Yn)) : (m(), p("i", Jn))
1858
+ ], 8, Gn),
1859
+ t("button", {
1860
+ onClick: I,
1861
+ class: "control-btn",
1862
+ "data-testid": `copy-dashboard-item-${e.item.i}`,
1863
+ title: "Copy item"
1864
+ }, [...L[6] || (L[6] = [
1865
+ t("i", { class: "mdi mdi-content-copy icon" }, null, -1)
1866
+ ])], 8, Zn),
1867
+ t("button", {
1868
+ onClick: M,
1869
+ class: "control-btn remove-btn",
1870
+ "data-testid": `remove-dashboard-item-${e.item.i}`,
1871
+ title: "Remove item"
1872
+ }, [...L[7] || (L[7] = [
1873
+ t("i", { class: "mdi mdi-delete-outline icon" }, null, -1)
1874
+ ])], 8, Xn)
1875
+ ], 2)) : R("", !0),
1876
+ e.editMode ? (m(), p("div", {
1877
+ key: 1,
1878
+ class: H(["grid-item-header overlay-header", { "header-visible": r.value || i.value }])
1879
+ }, [
1880
+ L[9] || (L[9] = rt('<div class="drag-handle-icon grid-item-drag-handle" data-v-b6ccdc8d><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="drag-handle-svg" data-v-b6ccdc8d><line x1="3" y1="12" x2="21" y2="12" data-v-b6ccdc8d></line><line x1="3" y1="6" x2="21" y2="6" data-v-b6ccdc8d></line><line x1="3" y1="18" x2="21" y2="18" data-v-b6ccdc8d></line></svg></div>', 1)),
1881
+ t("div", eo, [
1882
+ i.value ? te((m(), p("input", {
1883
+ key: 1,
1884
+ id: `title-input-${e.item.i}`,
1885
+ "onUpdate:modelValue": L[0] || (L[0] = (Q) => l.value = Q),
1886
+ onBlur: g,
1887
+ onKeyup: [
1888
+ Ce(g, ["enter"]),
1889
+ Ce(_, ["esc"])
1890
+ ],
1891
+ class: "title-input",
1892
+ type: "text",
1893
+ placeholder: w.value
1894
+ }, null, 40, to)), [
1895
+ [ye, l.value]
1896
+ ]) : (m(), p("div", {
1897
+ key: 0,
1898
+ class: "item-title editable-title",
1899
+ onClick: y
1900
+ }, [
1901
+ G(N(D.value.name) + " ", 1),
1902
+ L[8] || (L[8] = t("span", { class: "edit-indicator" }, "✎", -1))
1903
+ ]))
1904
+ ])
1905
+ ], 2)) : R("", !0),
1906
+ t("div", no, [
1907
+ (m(), Z(lt(U.value), {
1908
+ dashboardId: n.dashboardId,
1909
+ itemId: e.item.i,
1910
+ setItemData: e.setItemData,
1911
+ getItemData: e.getItemData,
1912
+ getDashboardQueryExecutor: e.getDashboardQueryExecutor,
1913
+ editMode: e.editMode,
1914
+ symbols: n.symbols || [],
1915
+ onDimensionClick: B,
1916
+ onBackgroundClick: x
1917
+ }, null, 40, ["dashboardId", "itemId", "setItemData", "getItemData", "getDashboardQueryExecutor", "editMode", "symbols"]))
1918
+ ]),
1919
+ u.value ? (m(), p("div", oo, [
1920
+ e.editMode ? (m(), p("div", io, [
1921
+ (m(!0), p(ce, null, we(D.value.filters, (Q, K) => (m(), p("div", {
1922
+ class: "filter-tag",
1923
+ key: `${Q.source}-${Q.value}-${K}`,
1924
+ title: f(Q.value)
1925
+ }, [
1926
+ t("span", lo, [
1927
+ t("span", ao, N(Q.source === "global" ? Q.source : "cross") + ": ", 1),
1928
+ t("span", so, N(v(Q.value)), 1)
1929
+ ]),
1930
+ Q.source !== "global" ? (m(), p("button", {
1931
+ key: 0,
1932
+ class: "filter-remove-btn",
1933
+ onClick: (me) => A(Q.source),
1934
+ title: "Remove filter"
1935
+ }, " × ", 8, uo)) : R("", !0)
1936
+ ], 8, ro))), 128))
1937
+ ])) : (m(), p(ce, { key: 1 }, [
1938
+ d.value > 0 ? (m(), p("div", co, [
1939
+ h.value ? R("", !0) : (m(), p("div", mo, [...L[10] || (L[10] = [
1940
+ t("i", { class: "mdi mdi-filter-outline filter-icon" }, null, -1)
1941
+ ])])),
1942
+ h.value ? (m(), p("div", ho, [
1943
+ (m(!0), p(ce, null, we(D.value.filters, (Q, K) => (m(), p("div", {
1944
+ class: "filter-tag",
1945
+ key: `${Q.source}-${Q.value}-${K}`,
1946
+ title: f(Q.value)
1947
+ }, [
1948
+ t("span", vo, [
1949
+ t("span", yo, N(Q.source === "global" ? Q.source : "cross") + ": ", 1),
1950
+ t("span", po, N(v(Q.value)), 1)
1951
+ ]),
1952
+ Q.source !== "global" ? (m(), p("button", {
1953
+ key: 0,
1954
+ class: "filter-remove-btn",
1955
+ onClick: (me) => A(Q.source),
1956
+ title: `Remove ${Q.source} filter`
1957
+ }, " × ", 8, go)) : R("", !0)
1958
+ ], 8, fo))), 128))
1959
+ ])) : R("", !0)
1960
+ ])) : R("", !0)
1961
+ ], 64))
1962
+ ])) : R("", !0)
1963
+ ], 42, Wn));
1964
+ }
1965
+ }), gi = /* @__PURE__ */ ee(bo, [["__scopeId", "data-v-b6ccdc8d"]]), Co = { class: "editor-overlay" }, wo = { class: "add-item-modal" }, ko = { class: "item-type-selector" }, Io = ["value"], Do = ["value"], So = ["value"], To = ["value"], Eo = /* @__PURE__ */ X({
1966
+ __name: "DashboardAddItemModal",
1967
+ props: {
1968
+ show: { type: Boolean }
1969
+ },
1970
+ emits: ["add", "close"],
1971
+ setup(e, { emit: o }) {
1972
+ const n = e, a = o, i = b($.CHART);
1973
+ function l() {
1974
+ a("add", i.value);
1975
+ }
1976
+ function r() {
1977
+ a("close");
1978
+ }
1979
+ function h(f) {
1980
+ const v = document.querySelector(".content-editor");
1981
+ v && !v.contains(f.target) && n.show && a("close");
1982
+ }
1983
+ return pe(() => {
1984
+ Ae(() => {
1985
+ document.addEventListener("click", h);
1986
+ });
1987
+ }), $e(() => {
1988
+ document.removeEventListener("click", h);
1989
+ }), (f, v) => e.show ? (m(), Z(Ue, {
1990
+ key: 0,
1991
+ to: "body"
1992
+ }, [
1993
+ t("div", Co, [
1994
+ t("div", wo, [
1995
+ v[8] || (v[8] = t("h3", null, "Add New Item", -1)),
1996
+ t("div", ko, [
1997
+ t("label", null, [
1998
+ te(t("input", {
1999
+ type: "radio",
2000
+ "onUpdate:modelValue": v[0] || (v[0] = (y) => i.value = y),
2001
+ value: Y($).CHART,
2002
+ "data-testid": "dashboard-add-item-type-chart"
2003
+ }, null, 8, Io), [
2004
+ [Te, i.value]
2005
+ ]),
2006
+ v[4] || (v[4] = G(" Chart ", -1))
2007
+ ]),
2008
+ t("label", null, [
2009
+ te(t("input", {
2010
+ type: "radio",
2011
+ "onUpdate:modelValue": v[1] || (v[1] = (y) => i.value = y),
2012
+ value: Y($).TABLE,
2013
+ "data-testid": "dashboard-add-item-type-table"
2014
+ }, null, 8, Do), [
2015
+ [Te, i.value]
2016
+ ]),
2017
+ v[5] || (v[5] = G(" Table ", -1))
2018
+ ]),
2019
+ t("label", null, [
2020
+ te(t("input", {
2021
+ type: "radio",
2022
+ "onUpdate:modelValue": v[2] || (v[2] = (y) => i.value = y),
2023
+ value: Y($).MARKDOWN,
2024
+ "data-testid": "dashboard-add-item-type-markdown"
2025
+ }, null, 8, So), [
2026
+ [Te, i.value]
2027
+ ]),
2028
+ v[6] || (v[6] = G(" Markdown ", -1))
2029
+ ]),
2030
+ t("label", null, [
2031
+ te(t("input", {
2032
+ type: "radio",
2033
+ "onUpdate:modelValue": v[3] || (v[3] = (y) => i.value = y),
2034
+ value: Y($).FILTER,
2035
+ "data-testid": "dashboard-add-item-type-filter"
2036
+ }, null, 8, To), [
2037
+ [Te, i.value]
2038
+ ]),
2039
+ v[7] || (v[7] = G(" Filter ", -1))
2040
+ ])
2041
+ ]),
2042
+ t("div", { class: "editor-actions" }, [
2043
+ t("button", {
2044
+ onClick: l,
2045
+ class: "add-button",
2046
+ "data-testid": "dashboard-add-item-confirm"
2047
+ }, " Add "),
2048
+ t("button", {
2049
+ onClick: r,
2050
+ class: "cancel-button"
2051
+ }, "Cancel")
2052
+ ])
2053
+ ])
2054
+ ])
2055
+ ])) : R("", !0);
2056
+ }
2057
+ }), bi = /* @__PURE__ */ ee(Eo, [["__scopeId", "data-v-440a3716"]]);
2058
+ function $o(e = "dark") {
2059
+ Ee.defineTheme("trilogyStudio", {
2060
+ base: e === "light" ? "vs" : "vs-dark",
2061
+ inherit: !0,
2062
+ rules: [
2063
+ { token: "comment", foreground: "#6A9955", fontStyle: "italic" },
2064
+ { token: "keyword", foreground: "#569CD6", fontStyle: "bold" },
2065
+ { token: "definition", foreground: "#E5C07B", fontStyle: "bold" },
2066
+ { token: "type", foreground: "#4EC9B0", fontStyle: "bold" },
2067
+ { token: "string", foreground: "#CE9178" },
2068
+ { token: "number", foreground: "#B5CEA8" },
2069
+ { token: "operator", foreground: "#D4D4D4" },
2070
+ { token: "delimiter", foreground: "#D4D4D4" },
2071
+ { token: "function", foreground: "#C586C0", fontStyle: "bold" },
2072
+ { token: "hidden", foreground: "#D6D6C8", fontStyle: "italic" },
2073
+ { token: "property", foreground: "#BFBFBF" }
2074
+ ],
2075
+ colors: {
2076
+ "editorCursor.foreground": e === "light" ? "#333333" : "#ffffff",
2077
+ "editorCursor.background": e === "light" ? "#ffffff" : "#000000"
2078
+ }
2079
+ }), Ee.setTheme("trilogyStudio");
2080
+ }
2081
+ function Lo(e, o = {}) {
2082
+ const a = { ...{
2083
+ automaticLayout: !0,
2084
+ autoClosingBrackets: "always",
2085
+ autoClosingOvertype: "always",
2086
+ autoClosingQuotes: "always",
2087
+ acceptSuggestionOnEnter: "off",
2088
+ tabCompletion: "on",
2089
+ theme: "trilogyStudio"
2090
+ }, ...o };
2091
+ return Ee.create(e, a);
2092
+ }
2093
+ function _e(e, o = "") {
2094
+ var i;
2095
+ if (!e) return o;
2096
+ const n = e.getSelection();
2097
+ let a = n && !(n.startColumn === n.endColumn && n.startLineNumber === n.endLineNumber) ? ((i = e.getModel()) == null ? void 0 : i.getValueInRange(n)) || "" : e.getValue();
2098
+ return a || (a = o), a;
2099
+ }
2100
+ function Mo(e, o = {}) {
2101
+ const { onValidate: n, onRun: a, onSave: i } = o;
2102
+ if (n && e.addCommand(ae.CtrlCmd | ae.Shift | ve.KeyV, n), a && e.addCommand(ae.CtrlCmd | ve.Enter, a), i && e.addCommand(ae.CtrlCmd | ve.KeyS, i), e.addCommand(ae.CtrlCmd | ve.KeyZ, () => {
2103
+ e.trigger("ide", "undo", {});
2104
+ }), o.onContentChange) {
2105
+ let l = null;
2106
+ e.onDidChangeModelContent(() => {
2107
+ var r;
2108
+ (r = o.onContentChange) == null || r.call(o, e.getValue()), l && clearTimeout(l), l = setTimeout(() => {
2109
+ var h;
2110
+ e.hasTextFocus() && !((h = e.getSelection()) != null && h.isEmpty()) && e.trigger("completion", "editor.action.triggerSuggest", { auto: !0 });
2111
+ }, 200);
2112
+ });
2113
+ }
2114
+ }
2115
+ let V = null;
2116
+ const qo = X({
2117
+ name: "EnhancedEditor",
2118
+ components: {
2119
+ SymbolsPane: yt,
2120
+ LoadingView: De
2121
+ },
2122
+ props: {
2123
+ onSave: {
2124
+ type: null,
2125
+ required: !1,
2126
+ default: null
2127
+ },
2128
+ theme: {
2129
+ type: String,
2130
+ default: "vs-dark"
2131
+ },
2132
+ initContent: {
2133
+ type: String,
2134
+ required: !1,
2135
+ default: ""
2136
+ },
2137
+ connectionName: {
2138
+ type: String,
2139
+ required: !0
2140
+ },
2141
+ imports: {
2142
+ type: Array,
2143
+ required: !1,
2144
+ default: () => []
2145
+ },
2146
+ rootContent: {
2147
+ type: Array,
2148
+ required: !1,
2149
+ default: () => []
2150
+ }
2151
+ },
2152
+ emits: ["query-started", "format-query"],
2153
+ data() {
2154
+ return {
2155
+ lastOperation: null,
2156
+ editor: new pt({
2157
+ id: "simple-editor",
2158
+ name: "My Query",
2159
+ type: "trilogy",
2160
+ connection: this.connectionName,
2161
+ storage: "local",
2162
+ contents: this.initContent
2163
+ }),
2164
+ // New properties for collapsible sidebar
2165
+ activePanel: "symbols",
2166
+ isPanelVisible: !1
2167
+ };
2168
+ },
2169
+ setup() {
2170
+ const e = j("queryExecutionService"), o = j("connectionStore"), n = j("isMobile"), a = j("llmConnectionStore"), i = j("analyticsStore");
2171
+ return {
2172
+ queryExecutionService: e,
2173
+ connectionStore: o,
2174
+ isMobile: n,
2175
+ llmConnectionStore: a,
2176
+ analyticsStore: i
2177
+ };
2178
+ },
2179
+ created() {
2180
+ this.isPanelVisible = !this.isMobile;
2181
+ },
2182
+ mounted() {
2183
+ this.$nextTick(() => {
2184
+ this.createEditor(), document.addEventListener("keydown", this.handleKeyboardShortcuts), this.validateQuery();
2185
+ });
2186
+ },
2187
+ beforeUnmount() {
2188
+ V && V.dispose(), document.removeEventListener("keydown", this.handleKeyboardShortcuts);
2189
+ },
2190
+ methods: {
2191
+ // New methods for panel management
2192
+ togglePanel(e) {
2193
+ this.activePanel === e && this.isPanelVisible ? this.isPanelVisible = !1 : (this.activePanel = e, this.isPanelVisible = !0, e === "symbols" && this.$refs.symbolsPane && this.$nextTick(() => {
2194
+ this.focusSymbolSearch();
2195
+ })), V && this.$nextTick(() => {
2196
+ V == null || V.layout();
2197
+ });
2198
+ },
2199
+ closePanel() {
2200
+ this.isPanelVisible = !1, V && this.$nextTick(() => {
2201
+ V == null || V.layout();
2202
+ });
2203
+ },
2204
+ getPanelTitle() {
2205
+ switch (this.activePanel) {
2206
+ case "symbols":
2207
+ return "Symbols";
2208
+ default:
2209
+ return "";
2210
+ }
2211
+ },
2212
+ createEditor() {
2213
+ $o(this.theme === "vs-dark" ? "dark" : "light"), V = Lo(this.$refs.editorElement, {
2214
+ value: this.editor.contents || "",
2215
+ language: this.editor.type === "sql" ? "sql" : "trilogy"
2216
+ }), Mo(V, {
2217
+ onValidate: () => this.validateQuery(),
2218
+ onRun: () => this.runQuery(),
2219
+ onGenerateLLM: () => this.generateLLMQuery()
2220
+ // Add LLM generation shortcut
2221
+ }), V.addCommand(ae.CtrlCmd | ve.Space, () => {
2222
+ this.togglePanel("symbols");
2223
+ }), V.addCommand(ae.CtrlCmd | ae.Shift | ve.Enter, () => {
2224
+ this.generateLLMQuery();
2225
+ }), this.editor.type !== "sql" && V.addCommand(ae.CtrlCmd | ve.KeyK, () => {
2226
+ this.formatQuery();
2227
+ });
2228
+ },
2229
+ handleKeyboardShortcuts(e) {
2230
+ e.ctrlKey && e.shiftKey && e.key === "O" && (this.togglePanel("symbols"), e.preventDefault()), e.ctrlKey && e.shiftKey && e.key === "Enter" && (this.generateLLMQuery(), e.preventDefault()), e.ctrlKey && e.key === "k" && this.editor.type !== "sql" && (this.formatQuery(), e.preventDefault());
2231
+ },
2232
+ focusSymbolSearch() {
2233
+ const e = this.$refs.symbolsPane;
2234
+ e && "focusSearch" in e && e.focusSearch();
2235
+ },
2236
+ insertSymbol(e) {
2237
+ if (!V) return;
2238
+ const o = V.getPosition();
2239
+ o && e.insertText && (V.executeEdits("", [
2240
+ {
2241
+ range: new gt(
2242
+ o.lineNumber,
2243
+ o.column,
2244
+ o.lineNumber,
2245
+ o.column
2246
+ ),
2247
+ text: e.insertText
2248
+ }
2249
+ ]), V.focus(), this.isMobile && this.closePanel());
2250
+ },
2251
+ async validateQuery(e = !0) {
2252
+ if (!V) return [];
2253
+ const o = this.connectionStore, n = this.queryExecutionService;
2254
+ try {
2255
+ this.editor.setError(null);
2256
+ const a = V.getValue(), i = o.connections[this.editor.connection], l = {
2257
+ text: a,
2258
+ queryType: i ? i.query_type : "trilogy",
2259
+ editorType: this.editor.type,
2260
+ sources: [],
2261
+ imports: this.imports,
2262
+ extraContent: this.rootContent
2263
+ }, r = await n.validateQuery(
2264
+ this.editor.connection,
2265
+ l
2266
+ );
2267
+ if (r && e) {
2268
+ const h = V.getModel();
2269
+ h && Ee.setModelMarkers(h, "owner", r.data.items || []), r.data.completion_items && (this.editor.completionSymbols = r.data.completion_items);
2270
+ }
2271
+ return r ? r.data.imports : [];
2272
+ } catch (a) {
2273
+ return a instanceof Error ? this.editor.setError(a.message || "Validation failed") : this.editor.setError("Validation failed"), [];
2274
+ }
2275
+ },
2276
+ async formatQuery() {
2277
+ var i;
2278
+ const e = V, o = _e(e, this.editor.contents);
2279
+ if (!o || !e) return;
2280
+ let n = (i = this.connectionStore) == null ? void 0 : i.connections[this.editor.connection], a = this.queryExecutionService;
2281
+ if (a)
2282
+ try {
2283
+ const l = await a.formatQuery(
2284
+ o,
2285
+ n ? n.query_type : "",
2286
+ this.editor.type,
2287
+ this.imports,
2288
+ this.rootContent
2289
+ );
2290
+ l && e.setValue(l);
2291
+ } catch (l) {
2292
+ console.error("Error formatting query:", l);
2293
+ }
2294
+ },
2295
+ async cancelQuery() {
2296
+ this.editor.cancelCallback && await this.editor.cancelCallback(), this.editor.loading = !1;
2297
+ },
2298
+ async runQuery() {
2299
+ var i, l, r;
2300
+ this.$emit("query-started"), this.editor.setError(null);
2301
+ let e = !1;
2302
+ const o = this.connectionStore, n = this.queryExecutionService, a = V;
2303
+ if (!(this.editor.loading || !a))
2304
+ try {
2305
+ this.analyticsStore && this.analyticsStore.log("studio-query-execution", this.editor.type, !0), this.editor.loading = !0, this.lastOperation = null, this.editor.startTime = Date.now();
2306
+ const h = o.connections[this.editor.connection], f = _e(a, this.editor.contents);
2307
+ if (!f) {
2308
+ this.editor.results = new Ne(/* @__PURE__ */ new Map(), []), this.editor.loading = !1;
2309
+ return;
2310
+ }
2311
+ const v = {
2312
+ text: f,
2313
+ queryType: h ? h.query_type : "",
2314
+ editorType: this.editor.type,
2315
+ imports: this.imports,
2316
+ extraContent: this.rootContent
2317
+ }, { resultPromise: y, cancellation: g } = await n.executeQuery(
2318
+ this.editor.connection,
2319
+ v,
2320
+ // Progress callback for connection issues
2321
+ () => {
2322
+ },
2323
+ (T) => {
2324
+ !e && T.error && (this.editor.loading = !1, T.message && this.editor.setError(T.message)), !e && T.running && (this.editor.error = null, this.editor.loading = !0);
2325
+ }
2326
+ );
2327
+ this.editor.cancelCallback = () => {
2328
+ g.isActive() && g.cancel(), this.editor.loading = !1, this.editor.cancelCallback = null;
2329
+ };
2330
+ const k = await y;
2331
+ e = !0, this.lastOperation = {
2332
+ success: k.success,
2333
+ duration: k.executionTime,
2334
+ rows: (i = k.results) != null && i.data ? (r = (l = k.results) == null ? void 0 : l.data) == null ? void 0 : r.length : void 0,
2335
+ type: this.editor.type
2336
+ }, k.success ? (k.generatedSql && (this.editor.generated_sql = k.generatedSql), k.results && (this.editor.results = k.results, this.editor.duration = k.executionTime)) : k.error && this.editor.setError(k.error);
2337
+ } catch (h) {
2338
+ h instanceof Error && this.editor.setError(h.message || "Query execution failed"), this.lastOperation = {
2339
+ success: !1,
2340
+ duration: 0,
2341
+ type: this.editor.type
2342
+ };
2343
+ } finally {
2344
+ this.editor.loading = !1, this.editor.cancelCallback = null, V && V.layout();
2345
+ }
2346
+ },
2347
+ // Add the LLM query generation method
2348
+ async generateLLMQuery() {
2349
+ if (this.editor.loading || !V) return;
2350
+ const e = this.llmConnectionStore, o = this.queryExecutionService, n = this.connectionStore;
2351
+ if (!e) {
2352
+ this.editor.setError("LLM connection store not available");
2353
+ return;
2354
+ }
2355
+ try {
2356
+ this.analyticsStore && this.analyticsStore.log("studio-llm-generation", this.editor.type, !0), this.editor.loading = !0, this.editor.startTime = Date.now(), this.editor.results = new Ne(/* @__PURE__ */ new Map(), []), this.editor.setError(null);
2357
+ const a = V.getValue();
2358
+ if (await this.validateQuery(!1), !this.editor.completionSymbols || this.editor.completionSymbols.length === 0)
2359
+ throw new Error("There are no imported concepts for LLM generation");
2360
+ const i = this.editor.completionSymbols.map((h) => ({
2361
+ name: h.label,
2362
+ type: h.datatype,
2363
+ description: h.description,
2364
+ calculation: h.calculation
2365
+ })), l = async (h) => {
2366
+ const f = n.connections[this.editor.connection], v = {
2367
+ text: h,
2368
+ queryType: f ? f.query_type : "",
2369
+ editorType: this.editor.type,
2370
+ imports: this.imports,
2371
+ extraContent: this.rootContent
2372
+ };
2373
+ try {
2374
+ const { resultPromise: y } = await o.executeQuery(
2375
+ this.editor.connection,
2376
+ v,
2377
+ () => {
2378
+ },
2379
+ () => {
2380
+ },
2381
+ (g) => {
2382
+ throw g;
2383
+ },
2384
+ () => !0,
2385
+ !0
2386
+ // Explain mode
2387
+ );
2388
+ return await y, !0;
2389
+ } catch (y) {
2390
+ throw y;
2391
+ }
2392
+ }, r = await e.generateQueryCompletion(a, i, l);
2393
+ if (r)
2394
+ V.setValue(r.content), this.editor.contents = V.getValue(), this.lastOperation = {
2395
+ success: !0,
2396
+ duration: Date.now() - (this.editor.startTime || 0),
2397
+ type: "LLM Generation"
2398
+ };
2399
+ else
2400
+ throw new Error("LLM could not successfully generate query");
2401
+ } catch (a) {
2402
+ if (a instanceof Error)
2403
+ throw this.editor.setError(a.message), a;
2404
+ this.editor.setError("Unknown error occurred during LLM generation"), this.lastOperation = {
2405
+ success: !1,
2406
+ duration: 0,
2407
+ type: "LLM Generation"
2408
+ };
2409
+ } finally {
2410
+ this.editor.loading = !1, V && V.layout();
2411
+ }
2412
+ },
2413
+ getContent() {
2414
+ return V ? V.getValue() : this.editor.contents || "";
2415
+ }
2416
+ }
2417
+ }), Ao = { class: "editor-container" }, Ro = { class: "menu-bar" }, Fo = { class: "menu-actions" }, xo = { class: "editor-content" }, Qo = { class: "sidebar-panel" }, Vo = { class: "be-sidebar-container" }, Bo = { class: "be-sidebar-icons" }, Oo = { class: "result-wrapper" }, Ho = {
2418
+ key: 1,
2419
+ class: "error-message"
2420
+ }, Po = {
2421
+ key: 2,
2422
+ class: "results-summary",
2423
+ "data-testid": "simple-editor-results"
2424
+ }, No = { class: "results-details" }, Ko = {
2425
+ key: 0,
2426
+ class: "timing"
2427
+ }, _o = {
2428
+ key: 1,
2429
+ class: "row-count"
2430
+ }, Wo = {
2431
+ key: 2,
2432
+ class: "operation-type"
2433
+ };
2434
+ function Uo(e, o, n, a, i, l) {
2435
+ const r = J("SymbolsPane"), h = J("loading-view");
2436
+ return m(), p("div", Ao, [
2437
+ t("div", Ro, [
2438
+ t("div", Fo, [
2439
+ t("button", {
2440
+ class: "action-item",
2441
+ onClick: o[0] || (o[0] = (...f) => e.generateLLMQuery && e.generateLLMQuery(...f)),
2442
+ title: "Generate query using AI",
2443
+ "data-testid": "editor-generate-button"
2444
+ }, " Generate "),
2445
+ e.editor.type !== "sql" ? (m(), p("button", {
2446
+ key: 0,
2447
+ class: "action-item",
2448
+ onClick: o[1] || (o[1] = () => e.validateQuery())
2449
+ }, " Parse ")) : R("", !0),
2450
+ e.editor.type !== "sql" ? (m(), p("button", {
2451
+ key: 1,
2452
+ class: "action-item",
2453
+ onClick: o[2] || (o[2] = (...f) => e.formatQuery && e.formatQuery(...f)),
2454
+ title: "Format query"
2455
+ }, " Format ")) : R("", !0),
2456
+ t("button", {
2457
+ onClick: o[3] || (o[3] = (f) => e.editor.loading ? e.cancelQuery() : e.runQuery()),
2458
+ class: H(["action-item", { "button-cancel": e.editor.loading }]),
2459
+ "data-testid": "editor-run-button"
2460
+ }, N(e.editor.loading ? "Cancel" : "Test"), 3)
2461
+ ])
2462
+ ]),
2463
+ t("div", xo, [
2464
+ t("div", {
2465
+ ref: "editorElement",
2466
+ class: H(["editor-obj", {
2467
+ "monaco-width-with-panel": e.isPanelVisible,
2468
+ "monaco-width-no-panel": !e.isPanelVisible
2469
+ }]),
2470
+ "data-testid": "simple-editor-content"
2471
+ }, null, 2),
2472
+ te(t("div", Qo, [
2473
+ z(r, {
2474
+ symbols: e.editor.completionSymbols || [],
2475
+ onSelectSymbol: e.insertSymbol,
2476
+ ref: "symbolsPane"
2477
+ }, null, 8, ["symbols", "onSelectSymbol"])
2478
+ ], 512), [
2479
+ [at, e.isPanelVisible]
2480
+ ]),
2481
+ t("div", Vo, [
2482
+ t("div", Bo, [
2483
+ t("button", {
2484
+ class: H(["sidebar-icon-button", { active: e.isPanelVisible }]),
2485
+ onClick: o[4] || (o[4] = (f) => e.togglePanel("symbols")),
2486
+ title: "Symbols"
2487
+ }, [...o[5] || (o[5] = [
2488
+ t("i", { class: "mdi mdi-tag-search-outline" }, null, -1)
2489
+ ])], 2)
2490
+ ])
2491
+ ])
2492
+ ]),
2493
+ t("div", Oo, [
2494
+ e.editor.loading ? (m(), Z(h, {
2495
+ key: 0,
2496
+ class: "loading-view",
2497
+ text: "Loading...",
2498
+ startTime: e.editor.startTime
2499
+ }, null, 8, ["startTime"])) : e.editor.error ? (m(), p("div", Ho, N(e.editor.error), 1)) : e.lastOperation ? (m(), p("div", Po, [
2500
+ t("div", {
2501
+ class: H(["status-badge", e.lastOperation.success ? "success" : "error"])
2502
+ }, N(e.lastOperation.success ? "SUCCESS" : "FAILED"), 3),
2503
+ t("div", No, [
2504
+ e.lastOperation.duration ? (m(), p("div", Ko, N(e.lastOperation.duration) + "ms", 1)) : R("", !0),
2505
+ e.lastOperation.rows !== void 0 ? (m(), p("div", _o, N(e.lastOperation.rows) + " " + N(e.lastOperation.rows === 1 ? "row" : "rows"), 1)) : R("", !0),
2506
+ e.lastOperation.type ? (m(), p("div", Wo, N(e.lastOperation.type), 1)) : R("", !0)
2507
+ ])
2508
+ ])) : R("", !0)
2509
+ ])
2510
+ ]);
2511
+ }
2512
+ const Ze = /* @__PURE__ */ ee(qo, [["render", Uo], ["__scopeId", "data-v-0acd56f6"]]), jo = { class: "editor-overlay" }, zo = { class: "editor-body" }, Go = /* @__PURE__ */ X({
2513
+ __name: "DashboardChartEditor",
2514
+ props: {
2515
+ content: {},
2516
+ connectionName: {},
2517
+ imports: {},
2518
+ rootContent: {},
2519
+ showing: { type: Boolean },
2520
+ initialWidth: {},
2521
+ initialHeight: {}
2522
+ },
2523
+ emits: ["save", "cancel"],
2524
+ setup(e, { emit: o }) {
2525
+ const n = e, a = o, i = b(n.content), l = b(n.imports), r = b(null), { editorElement: h, dialogStyle: f, startResize: v } = Ye(() => a("cancel"), {
2526
+ initialWidth: n.initialWidth,
2527
+ initialHeight: n.initialHeight
2528
+ });
2529
+ function y() {
2530
+ if (r.value) {
2531
+ const k = r.value.getContent();
2532
+ a("save", k);
2533
+ }
2534
+ }
2535
+ function g() {
2536
+ a("cancel");
2537
+ }
2538
+ return (k, T) => (m(), p("div", jo, [
2539
+ t("div", {
2540
+ class: "content-editor",
2541
+ ref_key: "editorElement",
2542
+ ref: h,
2543
+ style: Ie(Y(f))
2544
+ }, [
2545
+ t("div", zo, [
2546
+ z(Ze, {
2547
+ class: "editor-content",
2548
+ initContent: i.value,
2549
+ connectionName: e.connectionName,
2550
+ imports: l.value,
2551
+ rootContent: e.rootContent,
2552
+ ref_key: "editor",
2553
+ ref: r
2554
+ }, null, 8, ["initContent", "connectionName", "imports", "rootContent"])
2555
+ ]),
2556
+ t("div", { class: "editor-actions" }, [
2557
+ t("button", {
2558
+ onClick: y,
2559
+ class: "save-button",
2560
+ "data-testid": "save-dashboard-chart"
2561
+ }, " Save Query "),
2562
+ t("button", {
2563
+ onClick: g,
2564
+ class: "cancel-button"
2565
+ }, "Cancel")
2566
+ ]),
2567
+ z(Je, { onStartResize: Y(v) }, null, 8, ["onStartResize"])
2568
+ ], 4)
2569
+ ]));
2570
+ }
2571
+ }), Ci = /* @__PURE__ */ ee(Go, [["__scopeId", "data-v-b0e7bd68"]]), Yo = { class: "editor-overlay" }, Jo = { class: "tab-header" }, Zo = { class: "editor-body" }, Xo = {
2572
+ key: 0,
2573
+ class: "tab-content"
2574
+ }, ei = {
2575
+ key: 1,
2576
+ class: "tab-content"
2577
+ }, ti = /* @__PURE__ */ X({
2578
+ __name: "DashboardMarkdownEditor",
2579
+ props: {
2580
+ content: {},
2581
+ connectionName: {},
2582
+ imports: {},
2583
+ rootContent: {},
2584
+ initialWidth: {},
2585
+ initialHeight: {}
2586
+ },
2587
+ emits: ["save", "cancel"],
2588
+ setup(e, { emit: o }) {
2589
+ const n = e, a = o, i = C(() => typeof n.content == "string" ? { markdown: n.content, query: "" } : { markdown: n.content.markdown || "", query: n.content.query || "" }), l = b(i.value.markdown), r = b(i.value.query), h = b(i.value.query), f = b(n.imports), v = b(null), y = b("markdown"), { editorElement: g, dialogStyle: k, startResize: T } = Ye(() => a("cancel"), {
2590
+ initialWidth: n.initialWidth,
2591
+ initialHeight: n.initialHeight
2592
+ });
2593
+ ne(
2594
+ () => n.content,
2595
+ (u) => {
2596
+ const d = typeof u == "string" ? { markdown: u, query: "" } : { markdown: u.markdown || "", query: u.query || "" };
2597
+ l.value = d.markdown, r.value = d.query, h.value = d.query;
2598
+ }
2599
+ ), ne(y, (u, d) => {
2600
+ d === "query" && v.value && (h.value = v.value.getContent());
2601
+ });
2602
+ function F() {
2603
+ y.value === "query" && v.value && (h.value = v.value.getContent());
2604
+ const u = {
2605
+ markdown: l.value,
2606
+ query: h.value
2607
+ };
2608
+ a("save", u);
2609
+ }
2610
+ function _() {
2611
+ a("cancel");
2612
+ }
2613
+ function E(u) {
2614
+ y.value === "query" && v.value && (h.value = v.value.getContent()), y.value = u;
2615
+ }
2616
+ function M(u, d = "") {
2617
+ const S = document.querySelector(".markdown-editor");
2618
+ if (!S) return;
2619
+ const L = S.selectionStart, Q = S.selectionEnd, K = l.value.substring(L, Q), me = l.value.substring(0, L), he = l.value.substring(Q);
2620
+ l.value = me + u + K + d + he, setTimeout(() => {
2621
+ S.focus(), S.setSelectionRange(L + u.length, L + u.length + K.length);
2622
+ }, 0);
2623
+ }
2624
+ function I() {
2625
+ M("**", "**");
2626
+ }
2627
+ function B() {
2628
+ M("*", "*");
2629
+ }
2630
+ function x() {
2631
+ M("## ");
2632
+ }
2633
+ function A() {
2634
+ M("- ");
2635
+ }
2636
+ function D() {
2637
+ M("[", "](url)");
2638
+ }
2639
+ function U() {
2640
+ M("{data[0].field_name}");
2641
+ }
2642
+ function w() {
2643
+ M(`{{#each data}}
2644
+ - {{field_name}}
2645
+ {{/each}}`);
2646
+ }
2647
+ return (u, d) => (m(), p("div", Yo, [
2648
+ t("div", {
2649
+ class: "content-editor",
2650
+ ref_key: "editorElement",
2651
+ ref: g,
2652
+ style: Ie(Y(k))
2653
+ }, [
2654
+ t("div", Jo, [
2655
+ t("button", {
2656
+ onClick: d[0] || (d[0] = (S) => E("markdown")),
2657
+ class: H([{ active: y.value === "markdown" }, "tab-button"])
2658
+ }, " 📝 Markdown Template ", 2),
2659
+ t("button", {
2660
+ onClick: d[1] || (d[1] = (S) => E("query")),
2661
+ class: H([{ active: y.value === "query" }, "tab-button"])
2662
+ }, " 🔍 Data Query ", 2)
2663
+ ]),
2664
+ t("div", Zo, [
2665
+ y.value === "markdown" ? (m(), p("div", Xo, [
2666
+ t("div", { class: "markdown-toolbar" }, [
2667
+ t("button", {
2668
+ onClick: I,
2669
+ title: "Bold"
2670
+ }, [...d[3] || (d[3] = [
2671
+ t("strong", null, "B", -1)
2672
+ ])]),
2673
+ t("button", {
2674
+ onClick: B,
2675
+ title: "Italic"
2676
+ }, [...d[4] || (d[4] = [
2677
+ t("em", null, "I", -1)
2678
+ ])]),
2679
+ t("button", {
2680
+ onClick: x,
2681
+ title: "Heading"
2682
+ }, "H"),
2683
+ t("button", {
2684
+ onClick: A,
2685
+ title: "List"
2686
+ }, "•"),
2687
+ t("button", {
2688
+ onClick: D,
2689
+ title: "Link"
2690
+ }, "🔗"),
2691
+ d[5] || (d[5] = t("div", { class: "toolbar-separator" }, null, -1)),
2692
+ t("button", {
2693
+ onClick: U,
2694
+ title: "Insert data reference",
2695
+ class: "data-button"
2696
+ }, " {} "),
2697
+ t("button", {
2698
+ onClick: w,
2699
+ title: "Insert loop",
2700
+ class: "data-button"
2701
+ }, "↻")
2702
+ ]),
2703
+ te(t("textarea", {
2704
+ "onUpdate:modelValue": d[2] || (d[2] = (S) => l.value = S),
2705
+ placeholder: `Enter markdown content here...\r
2706
+ \r
2707
+ Template examples:\r
2708
+ - {field_name} - First row value\r
2709
+ - {data[0].field_name} - Specific row\r
2710
+ - {data.length} - Total rows\r
2711
+ - {{#each data}} {{field_name}} {{/each}} - Loop all\r
2712
+ - {{#each data limit=5}} {{field_name}} {{/each}} - Loop first 5`,
2713
+ class: "markdown-editor"
2714
+ }, null, 512), [
2715
+ [ye, l.value]
2716
+ ])
2717
+ ])) : R("", !0),
2718
+ y.value === "query" ? (m(), p("div", ei, [
2719
+ d[6] || (d[6] = t("div", { class: "query-help" }, [
2720
+ t("p", null, " Write a query to fetch data for your markdown template. Leave empty if no data is needed. ")
2721
+ ], -1)),
2722
+ z(Ze, {
2723
+ class: "editor-content",
2724
+ initContent: h.value,
2725
+ connectionName: e.connectionName,
2726
+ imports: f.value,
2727
+ rootContent: e.rootContent,
2728
+ ref_key: "editor",
2729
+ ref: v
2730
+ }, null, 8, ["initContent", "connectionName", "imports", "rootContent"])
2731
+ ])) : R("", !0)
2732
+ ]),
2733
+ t("div", { class: "editor-actions" }, [
2734
+ t("button", {
2735
+ onClick: F,
2736
+ class: "save-button",
2737
+ "data-testid": "save-dashboard-markdown"
2738
+ }, " Save Content "),
2739
+ t("button", {
2740
+ onClick: _,
2741
+ class: "cancel-button"
2742
+ }, "Cancel")
2743
+ ]),
2744
+ z(Je, { onStartResize: Y(T) }, null, 8, ["onStartResize"])
2745
+ ], 4)
2746
+ ]));
2747
+ }
2748
+ }), wi = /* @__PURE__ */ ee(ti, [["__scopeId", "data-v-048afde5"]]), ni = { class: "dashboard-setup" }, oi = { class: "setup-section" }, ii = {
2749
+ key: 0,
2750
+ class: "setup-section"
2751
+ }, ri = { class: "action-row" }, li = ["disabled"], ai = {
2752
+ key: 0,
2753
+ class: "error-message"
2754
+ }, si = { class: "setup-section" }, ui = { class: "templates-grid" }, di = ["onClick", "data-testid"], ci = { class: "template-icon" }, mi = { class: "template-info" }, hi = { class: "template-title" }, fi = { class: "template-desc" }, P = 20, ki = /* @__PURE__ */ X({
2755
+ __name: "DashboardCTA",
2756
+ props: {
2757
+ dashboardId: {}
2758
+ },
2759
+ emits: ["template-selected", "description-updated"],
2760
+ setup(e, { emit: o }) {
2761
+ const n = j("dashboardStore"), a = j("editorStore"), i = j("llmConnectionStore"), l = j(
2762
+ "queryExecutionService"
2763
+ ), r = j("saveDashboards");
2764
+ if (!n || !i || !l || !r)
2765
+ throw new Error("DashboardStore, LLMConnectionStore, or QueryExecutionService not provided");
2766
+ const h = e, f = C(() => i.activeConnection), v = o, y = b(""), g = b(""), k = b(!1), T = b(""), F = b(null), _ = P / 4, E = [
2767
+ {
2768
+ id: "summary",
2769
+ name: "Summary Dashboard",
2770
+ description: "High-level metrics and KPIs with key visualizations",
2771
+ icon: "mdi-view-dashboard",
2772
+ layout: [
2773
+ { i: "title", x: 0, y: 0, w: P, h: 3, type: $.MARKDOWN },
2774
+ { i: "kpi1", x: 0, y: 3, w: P / 4, h: 4, type: $.CHART },
2775
+ { i: "kpi2", x: _, y: 3, w: P / 4, h: 4, type: $.CHART },
2776
+ { i: "kpi3", x: _ * 2, y: 3, w: P / 4, h: 4, type: $.CHART },
2777
+ { i: "kpi4", x: _ * 3, y: 3, w: P / 4, h: 4, type: $.CHART },
2778
+ { i: "trend", x: 0, y: 7, w: P / 2, h: 8, type: $.CHART },
2779
+ { i: "breakdown", x: P / 2, y: 7, w: P / 2, h: 8, type: $.CHART }
2780
+ ]
2781
+ },
2782
+ {
2783
+ id: "drilldown",
2784
+ name: "Drill-Down Analysis",
2785
+ description: "Hierarchical data exploration with filtering capabilities",
2786
+ icon: "mdi-magnify-expand",
2787
+ layout: [
2788
+ { i: "filters", x: 0, y: 0, w: P, h: 3, type: $.MARKDOWN },
2789
+ { i: "overview", x: 0, y: 3, w: P, h: 5, type: $.CHART },
2790
+ { i: "detail1", x: 0, y: 8, w: P / 2, h: 8, type: $.CHART },
2791
+ { i: "detail2", x: P / 2, y: 10, w: P / 2, h: 8, type: $.CHART },
2792
+ { i: "datatable", x: 0, y: 20, w: P, h: 8, type: $.TABLE }
2793
+ ]
2794
+ },
2795
+ {
2796
+ id: "comparison",
2797
+ name: "Comparison Dashboard",
2798
+ description: "Side-by-side comparisons of metrics across dimensions",
2799
+ icon: "mdi-compare",
2800
+ layout: [
2801
+ { i: "title", x: 0, y: 0, w: P, h: 3, type: $.MARKDOWN },
2802
+ { i: "compare1", x: 0, y: 3, w: P / 2, h: 6, type: $.CHART },
2803
+ { i: "compare2", x: P / 2, y: 3, w: P / 2, h: 6, type: $.CHART },
2804
+ { i: "compare3", x: 0, y: 9, w: P / 2, h: 6, type: $.CHART },
2805
+ { i: "compare4", x: P / 2, y: 9, w: P / 2, h: 6, type: $.CHART },
2806
+ { i: "summary", x: 0, y: 15, w: P, h: 5, type: $.MARKDOWN }
2807
+ ]
2808
+ },
2809
+ {
2810
+ id: "trends",
2811
+ name: "Time Series Analysis",
2812
+ description: "Visualization of trends and patterns over time",
2813
+ icon: "mdi-chart-timeline-variant",
2814
+ layout: [
2815
+ { i: "headline", x: 0, y: 0, w: P, h: 3, type: $.MARKDOWN },
2816
+ { i: "maintrend", x: 0, y: 3, w: P, h: 8, type: $.CHART },
2817
+ { i: "breakdown1", x: 0, y: 11, w: P / 3, h: 6, type: $.CHART },
2818
+ { i: "breakdown2", x: P / 3, y: 11, w: P / 3, h: 6, type: $.CHART },
2819
+ { i: "breakdown3", x: P / 3 * 2, y: 11, w: P / 3, h: 6, type: $.CHART },
2820
+ { i: "forecast", x: 0, y: 17, w: P, h: 6, type: $.CHART }
2821
+ ]
2822
+ }
2823
+ // {
2824
+ // id: 'custom',
2825
+ // name: 'Start from Scratch',
2826
+ // description: 'Build your dashboard completely from scratch',
2827
+ // icon: 'mdi-pencil-outline',
2828
+ // layout: []
2829
+ // }
2830
+ ];
2831
+ function M(x) {
2832
+ F.value = x;
2833
+ const A = E.find((D) => D.id === x);
2834
+ if (A && h.dashboardId) {
2835
+ for (const D of A.layout)
2836
+ n.addItemToDashboard(
2837
+ h.dashboardId,
2838
+ D.type,
2839
+ D.x,
2840
+ D.y,
2841
+ D.w,
2842
+ D.h
2843
+ );
2844
+ v("template-selected", x);
2845
+ }
2846
+ }
2847
+ function I() {
2848
+ h.dashboardId && y.value && (n.updateDashboardDescription(h.dashboardId, y.value), v("description-updated", y.value));
2849
+ }
2850
+ async function B() {
2851
+ if (!g.value.trim()) {
2852
+ T.value = "Please provide a prompt for the dashboard generation.";
2853
+ return;
2854
+ }
2855
+ try {
2856
+ k.value = !0, T.value = "";
2857
+ const x = await n.generatePromptSpec(
2858
+ g.value,
2859
+ i,
2860
+ l,
2861
+ a
2862
+ );
2863
+ console.log("Prompt spec generated:", x), x ? (await n.populateFromPromptSpec(
2864
+ h.dashboardId,
2865
+ x,
2866
+ i,
2867
+ l,
2868
+ a
2869
+ ), !y.value && x.description && (y.value = x.description, I()), r()) : T.value = "Failed to generate dashboard specification.";
2870
+ } catch (x) {
2871
+ console.error("Error generating dashboard with LLM:", x), T.value = "An error occurred while generating the dashboard.";
2872
+ } finally {
2873
+ k.value = !1;
2874
+ }
2875
+ }
2876
+ return (x, A) => (m(), p("div", ni, [
2877
+ A[7] || (A[7] = t("div", { class: "setup-header" }, [
2878
+ t("h2", { class: "setup-title" }, "An Empty Dashboard"),
2879
+ t("p", { class: "setup-subtitle" }, " Choose a template or start from scratch by using the 'add item' button to add charts, tables, and more. ")
2880
+ ], -1)),
2881
+ t("div", oi, [
2882
+ A[3] || (A[3] = t("h3", { class: "section-title" }, "Description", -1)),
2883
+ te(t("textarea", {
2884
+ "onUpdate:modelValue": A[0] || (A[0] = (D) => y.value = D),
2885
+ placeholder: "What is this dashboard for? Add context to help viewers understand the data...",
2886
+ rows: "3",
2887
+ class: "description-input"
2888
+ }, null, 512), [
2889
+ [ye, y.value]
2890
+ ]),
2891
+ t("button", {
2892
+ onClick: I,
2893
+ class: "action-button save-button",
2894
+ "data-testid": "dashboard-description-save"
2895
+ }, [...A[2] || (A[2] = [
2896
+ t("i", { class: "mdi mdi-content-save" }, null, -1),
2897
+ G(" Save ", -1)
2898
+ ])])
2899
+ ]),
2900
+ f.value ? (m(), p("div", ii, [
2901
+ A[4] || (A[4] = t("h3", { class: "section-title" }, "AI Copilot", -1)),
2902
+ A[5] || (A[5] = t("p", { class: "section-desc" }, " Let AI help build your dashboard based on your data and description ", -1)),
2903
+ te(t("textarea", {
2904
+ "onUpdate:modelValue": A[1] || (A[1] = (D) => g.value = D),
2905
+ placeholder: "Describe the dashboard you want to create. For example: 'Create a sales performance dashboard with monthly trends, regional breakdown, and top product metrics.'",
2906
+ rows: "4",
2907
+ class: "description-input",
2908
+ "data-testid": "dashboard-prompt-input"
2909
+ }, null, 512), [
2910
+ [ye, g.value]
2911
+ ]),
2912
+ t("div", ri, [
2913
+ t("button", {
2914
+ onClick: B,
2915
+ class: "action-button llm-button",
2916
+ disabled: k.value || !g.value.trim(),
2917
+ "data-testid": "generate-with-llm-button"
2918
+ }, [
2919
+ t("i", {
2920
+ class: H(["mdi", k.value ? "mdi-loading mdi-spin" : "mdi-creation"])
2921
+ }, null, 2),
2922
+ G(" " + N(k.value ? "Generating..." : "Generate with AI"), 1)
2923
+ ], 8, li),
2924
+ T.value ? (m(), p("div", ai, N(T.value), 1)) : R("", !0)
2925
+ ])
2926
+ ])) : R("", !0),
2927
+ t("div", si, [
2928
+ A[6] || (A[6] = t("h3", { class: "section-title" }, "Templates", -1)),
2929
+ t("div", ui, [
2930
+ (m(), p(ce, null, we(E, (D) => t("div", {
2931
+ key: D.id,
2932
+ class: H(["template-card", { selected: F.value === D.id }]),
2933
+ onClick: (U) => M(D.id),
2934
+ "data-testid": `template-card-${D.id}`
2935
+ }, [
2936
+ t("div", ci, [
2937
+ t("i", {
2938
+ class: H(["mdi", D.icon])
2939
+ }, null, 2)
2940
+ ]),
2941
+ t("div", mi, [
2942
+ t("h4", hi, N(D.name), 1),
2943
+ t("p", fi, N(D.description), 1)
2944
+ ])
2945
+ ], 10, di)), 64))
2946
+ ])
2947
+ ])
2948
+ ]));
2949
+ }
2950
+ });
2951
+ function Ii(e, o, n, a) {
2952
+ if (!e.value)
2953
+ throw new Error("Dashboard computed reference is required");
2954
+ const i = bt(), l = ze();
2955
+ let r = j("queryExecutionService");
2956
+ const h = je(), { setActiveDashboard: f } = Ge();
2957
+ if (!r)
2958
+ throw new Error("QueryExecutionService not provided");
2959
+ const v = b(""), y = b(""), g = b(""), k = b(null), T = b(null), F = b(!1), _ = b(!1), E = b(!1), M = b([]), I = C(() => o.maxWidth || "100vw"), B = C(() => e.value ? e.value.layout : []), x = C(() => e.value ? [...e.value.layout].sort((c, q) => (c.y + c.y + c.h) / 2 - (q.y + q.y + q.h) / 2) : []), A = C(() => e.value ? e.value.connection : ""), D = C(() => o.viewMode ? !1 : e.value ? e.value.state === "editing" : !1), U = C(() => e.value ? e.value.imports.map((c) => {
2960
+ var q, s;
2961
+ return {
2962
+ alias: c.name,
2963
+ // legacy handling
2964
+ contents: ((q = l.editors[c.id]) == null ? void 0 : q.contents) || ((s = l.editors[c.name]) == null ? void 0 : s.contents) || ""
2965
+ };
2966
+ }) : []);
2967
+ function w(c) {
2968
+ if (!(c != null && c.id)) return;
2969
+ c.state === "fullscreen" && n.fullScreen(!0), i.setActiveDashboard(c.id), g.value = "", v.value = "", y.value = "", M.value = [], c.filter && (v.value = c.filter, y.value = c.filter);
2970
+ const q = qe(c.id), s = Object.keys(c.gridItems).filter(
2971
+ (O) => !c.gridItems[O].results
2972
+ );
2973
+ q == null || q.runBatch(s), L();
2974
+ }
2975
+ ne(
2976
+ () => {
2977
+ var c;
2978
+ return (c = e.value) == null ? void 0 : c.id;
2979
+ },
2980
+ (c, q) => {
2981
+ c && c !== q && e.value && w(e.value);
2982
+ }
2983
+ ), pe(() => {
2984
+ e.value && w(e.value);
2985
+ const c = new ResizeObserver(() => {
2986
+ n.triggerResize();
2987
+ }), q = o.isMobile ? ".mobile-container" : ".grid-container", s = document.querySelector(q);
2988
+ s && c.observe(s);
2989
+ }), We(() => {
2990
+ k.value !== null && clearTimeout(k.value);
2991
+ });
2992
+ async function u() {
2993
+ var c;
2994
+ if (e.value && e.value.id) {
2995
+ v.value = "", y.value = "", g.value = "";
2996
+ let q = i.removeAllFilters(e.value.id);
2997
+ await ((c = i.getQueryExecutor(e.value.id)) == null ? void 0 : c.runBatch(q));
2998
+ }
2999
+ }
3000
+ async function d(c) {
3001
+ var q;
3002
+ if (!c || Ke(c) === "") {
3003
+ if (g.value = "", e.value && e.value.id) {
3004
+ let s = i.updateDashboardFilter(
3005
+ e.value.id,
3006
+ Ke(c)
3007
+ );
3008
+ await ((q = i.getQueryExecutor(e.value.id)) == null ? void 0 : q.runBatch(s));
3009
+ }
3010
+ return;
3011
+ }
3012
+ e.value && e.value.id && (v.value = c, await (r == null ? void 0 : r.generateQuery(e.value.connection, {
3013
+ text: "select 1 as test;",
3014
+ editorType: "trilogy",
3015
+ extraFilters: [c],
3016
+ imports: e.value.imports,
3017
+ extraContent: U.value
3018
+ }).then(() => {
3019
+ var s;
3020
+ if (g.value = "", e.value && e.value.id) {
3021
+ let O = i.updateDashboardFilter(e.value.id, c);
3022
+ (s = i.getQueryExecutor(e.value.id)) == null || s.runBatch(O);
3023
+ }
3024
+ }).catch((s) => (g.value = s.message, !1))));
3025
+ }
3026
+ const S = async (c) => {
3027
+ let q = c.replace(/^\s*where\s+/i, "");
3028
+ if (e.value && e.value.id) {
3029
+ let s = await (r == null ? void 0 : r.executeQuery(
3030
+ e.value.connection,
3031
+ {
3032
+ text: "select 1 as test;",
3033
+ editorType: "trilogy",
3034
+ imports: e.value.imports,
3035
+ extraFilters: [q],
3036
+ extraContent: U.value
3037
+ },
3038
+ () => {
3039
+ },
3040
+ () => {
3041
+ },
3042
+ () => {
3043
+ },
3044
+ () => {
3045
+ },
3046
+ !0
3047
+ ));
3048
+ if (!s)
3049
+ throw new Error("No promises returned from query execution service");
3050
+ let O = await s.resultPromise;
3051
+ if (!O.success)
3052
+ throw new Error(
3053
+ `Validation of "select 1 as test ${q}" resulted in ${O.error}`
3054
+ );
3055
+ } else
3056
+ throw new Error("Dashboard not found");
3057
+ };
3058
+ async function L() {
3059
+ if (e.value && e.value.id && r) {
3060
+ let c = await i.populateCompletion(
3061
+ e.value.id,
3062
+ r,
3063
+ l
3064
+ );
3065
+ c && (M.value = c), g.value = "";
3066
+ }
3067
+ }
3068
+ async function Q(c) {
3069
+ e.value && e.value.id && (i.updateDashboardImports(e.value.id, c), await L());
3070
+ }
3071
+ const K = (c) => {
3072
+ e.value && (i.setState(e.value.id, c), Ae(() => {
3073
+ n.triggerResize();
3074
+ }));
3075
+ }, me = (c) => {
3076
+ e.value && e.value.id && i.updateDashboardLayout(e.value.id, c);
3077
+ };
3078
+ function he() {
3079
+ E.value = !0;
3080
+ }
3081
+ function Re(c = $.CHART) {
3082
+ if (!e.value || !e.value.id) return;
3083
+ const q = i.addItemToDashboard(e.value.id, c);
3084
+ E.value = !1, Ae(() => {
3085
+ n.dimensionsUpdate(q);
3086
+ });
3087
+ }
3088
+ function Fe(c) {
3089
+ !e.value || !e.value.id || i.updateDashboardTitle(e.value.id, c);
3090
+ }
3091
+ function W() {
3092
+ !e.value || !e.value.id || i.clearDashboardItems(e.value.id);
3093
+ }
3094
+ function oe(c) {
3095
+ !e.value || !e.value.id || i.removeItemFromDashboard(e.value.id, c);
3096
+ }
3097
+ function se(c) {
3098
+ !e.value || !e.value.id || i.copyItemInDashboard(e.value.id, c);
3099
+ }
3100
+ function fe() {
3101
+ E.value = !1;
3102
+ }
3103
+ function xe(c) {
3104
+ if (T.value = c, !e.value || !e.value.id) return;
3105
+ const s = e.value.gridItems[c.i];
3106
+ s && (s.type === $.CHART ? F.value = !0 : s.type === $.MARKDOWN ? _.value = !0 : (s.type === $.TABLE || s.type === $.FILTER) && (F.value = !0));
3107
+ }
3108
+ function Xe(c) {
3109
+ if (!e.value || !e.value.id || !T.value) return;
3110
+ const q = T.value.i;
3111
+ Me(q, e.value.id, { content: c }), Qe();
3112
+ }
3113
+ function Qe() {
3114
+ F.value = !1, _.value = !1, T.value = null;
3115
+ }
3116
+ function Ve(c, q) {
3117
+ if (q && e.value && e.value.id !== q)
3118
+ return {
3119
+ type: $.CHART,
3120
+ content: "",
3121
+ structured_content: { markdown: "", query: "" },
3122
+ name: `Item ${c}`,
3123
+ allowCrossFilter: !0,
3124
+ width: 0,
3125
+ height: 0,
3126
+ imports: [],
3127
+ filters: [],
3128
+ rootContent: [],
3129
+ hasDrilldown: !1
3130
+ };
3131
+ if (!e.value)
3132
+ return {
3133
+ type: $.CHART,
3134
+ content: "",
3135
+ structured_content: { markdown: "", query: "" },
3136
+ name: `Item ${c}`,
3137
+ allowCrossFilter: !0,
3138
+ width: 0,
3139
+ height: 0,
3140
+ imports: [],
3141
+ filters: [],
3142
+ rootContent: [],
3143
+ hasDrilldown: !1
3144
+ };
3145
+ const s = e.value.gridItems[c];
3146
+ if (!s)
3147
+ return {
3148
+ type: $.CHART,
3149
+ content: "",
3150
+ structured_content: { markdown: "", query: "" },
3151
+ name: `Item ${c}`,
3152
+ allowCrossFilter: !0,
3153
+ width: 0,
3154
+ height: 0,
3155
+ imports: e.value.imports,
3156
+ filters: [],
3157
+ rootContent: [],
3158
+ connectionName: e.value.connection || "",
3159
+ hasDrilldown: !1
3160
+ };
3161
+ const O = s.filters || [];
3162
+ let re = O;
3163
+ e.value.filter && (O.some(
3164
+ (Oe) => {
3165
+ var He;
3166
+ return Oe.source === "global" && Oe.value === ((He = e.value) == null ? void 0 : He.filter);
3167
+ }
3168
+ ) || (re = [{ value: e.value.filter, source: "global" }, ...O]));
3169
+ function ue(le) {
3170
+ return le && typeof le == "object" && typeof le.markdown == "string" && typeof le.query == "string";
3171
+ }
3172
+ let ge = !1, Se = ue(s.content) ? s.content : {
3173
+ markdown: s.type === "markdown" ? s.content : "",
3174
+ query: s.type !== "markdown" ? s.content : ""
3175
+ };
3176
+ s.drilldown && (ge = !0, Se = ue(s.drilldown) ? s.drilldown : {
3177
+ markdown: s.type === "markdown" ? s.drilldown : "",
3178
+ query: s.type !== "markdown" ? s.drilldown : ""
3179
+ });
3180
+ let be = s.chartConfig;
3181
+ return ge && (be = s.drilldownChartConfig || void 0), {
3182
+ type: s.type,
3183
+ // check if it's MarkdownData, and if so, extract markdown
3184
+ //
3185
+ content: ue(s.content) ? s.content.markdown : s.content || "",
3186
+ // display the drilldown of set
3187
+ structured_content: Se,
3188
+ name: s.name,
3189
+ allowCrossFilter: s.allowCrossFilter !== !1,
3190
+ // Default to true if not explicitly false
3191
+ width: s.width || 0,
3192
+ height: s.height || 0,
3193
+ chartConfig: be,
3194
+ filters: re,
3195
+ chartFilters: s.chartFilters || [],
3196
+ conceptFilters: s.conceptFilters || [],
3197
+ parameters: s.parameters || {},
3198
+ onRefresh: Be,
3199
+ rootContent: U.value,
3200
+ results: s.results || null,
3201
+ connectionName: e.value.connection || "",
3202
+ imports: e.value.imports,
3203
+ error: s.error || "",
3204
+ loading: s.loading || !1,
3205
+ loadStartTime: s.loadStartTime || null,
3206
+ // Include load start time if available
3207
+ hasDrilldown: ge
3208
+ };
3209
+ }
3210
+ function Me(c, q, s) {
3211
+ if (!e.value || !e.value.id) return;
3212
+ if (!q || e.value.id !== q) {
3213
+ console.warn(
3214
+ "Dashboard ID mismatch. Cannot set item data. Given:",
3215
+ q,
3216
+ "Expected:",
3217
+ e.value.id
3218
+ );
3219
+ return;
3220
+ }
3221
+ const O = {};
3222
+ if (s.name && (O.name = s.name), s.chartConfig && (O.chartConfig = s.chartConfig), s.content && (O.content = s.content), s.dimensions && (O.layoutDimensions = {
3223
+ w: s.dimensions.width,
3224
+ h: s.dimensions.height
3225
+ }), s.width && s.height && (O.width = s.width, O.height = s.height), s.loading !== void 0 && (O.loading = s.loading), s.results !== void 0 && (O.results = s.results), s.error !== void 0 && (O.error = s.error), s.drilldown !== void 0 && (O.drilldown = s.drilldown), s.drilldownChartConfig !== void 0 && (O.drilldownChartConfig = s.drilldownChartConfig), s.allowCrossFilter !== void 0 && (O.allowCrossFilter = s.allowCrossFilter), Object.keys(O).length > 0 && i.updateMultipleItemProperties(e.value.id, c, O), s.content) {
3226
+ let re = qe(e.value.id);
3227
+ re == null || re.runSingle(c);
3228
+ }
3229
+ }
3230
+ function qe(c) {
3231
+ if (!e.value || !e.value.id)
3232
+ throw new Error("Dashboard not found or not initialized");
3233
+ if (!r) throw new Error("Query execution service not found");
3234
+ if (!h) throw new Error("Connection store not found");
3235
+ let q = i.dashboards[c];
3236
+ const s = i.getOrCreateQueryExecutor(c, {
3237
+ queryExecutionService: r,
3238
+ connectionStore: h,
3239
+ editorStore: l,
3240
+ connectionName: q.connection,
3241
+ dashboardId: c,
3242
+ getDashboardData: (O) => i.dashboards[O],
3243
+ getItemData: Ve,
3244
+ setItemData: Me
3245
+ });
3246
+ return s || console.warn("No query executor found for dashboard:", e.value.id), s;
3247
+ }
3248
+ function et(c) {
3249
+ var O;
3250
+ const s = c.target.value;
3251
+ e.value && e.value.id && (i.updateDashboardConnection(e.value.id, s), (O = i.getQueryExecutor(e.value.id)) == null || O.setConnection(s));
3252
+ }
3253
+ function Be(c) {
3254
+ var q, s;
3255
+ if (e.value) {
3256
+ if (c) {
3257
+ (q = i.getQueryExecutor(e.value.id)) == null || q.runSingle(c), n.dimensionsUpdate(c);
3258
+ return;
3259
+ }
3260
+ (s = i.getQueryExecutor(e.value.id)) == null || s.runBatch(Object.keys(e.value.gridItems));
3261
+ }
3262
+ }
3263
+ function tt(c) {
3264
+ var re;
3265
+ if (!e.value || !e.value.id) return;
3266
+ let q = M.value.map((ue) => ue.label);
3267
+ const s = Object.entries(c.filters).reduce(
3268
+ (ue, [ge, Se]) => {
3269
+ let be = ge, le = null;
3270
+ return be.startsWith("local.") && (le = be.replace("local.", "")), (q.includes(be) || le && q.includes(le)) && (ue[ge] = Se), ue;
3271
+ },
3272
+ {}
3273
+ );
3274
+ if (!s || Object.keys(s).length === 0) {
3275
+ console.log("No valid filters to apply from cross-filter event, given ", c.filters);
3276
+ return;
3277
+ }
3278
+ let O = i.updateItemCrossFilters(
3279
+ e.value.id,
3280
+ c.source,
3281
+ s,
3282
+ c.chart,
3283
+ c.append ? "append" : "add"
3284
+ );
3285
+ (re = i.getQueryExecutor(e.value.id)) == null || re.runBatch(O);
3286
+ }
3287
+ function nt(c, q) {
3288
+ var s;
3289
+ !e.value || !e.value.id || (i.removeItemCrossFilter(e.value.id, c, q), (s = i.getQueryExecutor(e.value.id)) == null || s.runSingle(c));
3290
+ }
3291
+ function ot(c) {
3292
+ var s;
3293
+ if (!e.value || !e.value.id) return;
3294
+ let q = i.removeItemCrossFilterSource(e.value.id, c);
3295
+ (s = i.getQueryExecutor(e.value.id)) == null || s.runBatch(q);
3296
+ }
3297
+ function it(c) {
3298
+ f(c);
3299
+ }
3300
+ return {
3301
+ // State
3302
+ dashboard: e,
3303
+ layout: B,
3304
+ sortedLayout: x,
3305
+ editMode: D,
3306
+ selectedConnection: A,
3307
+ filter: v,
3308
+ filterError: g,
3309
+ globalCompletion: M,
3310
+ showAddItemModal: E,
3311
+ showQueryEditor: F,
3312
+ showMarkdownEditor: _,
3313
+ editingItem: T,
3314
+ dashboardMaxWidth: I,
3315
+ rootContent: U,
3316
+ // Methods
3317
+ handleFilterChange: d,
3318
+ handleFilterClear: u,
3319
+ handleImportChange: Q,
3320
+ validateFilter: S,
3321
+ onConnectionChange: et,
3322
+ toggleMode: K,
3323
+ onLayoutUpdated: me,
3324
+ openAddItemModal: he,
3325
+ addItem: Re,
3326
+ clearItems: W,
3327
+ removeItem: oe,
3328
+ copyItem: se,
3329
+ closeAddModal: fe,
3330
+ openEditor: xe,
3331
+ saveContent: Xe,
3332
+ closeEditors: Qe,
3333
+ getDashboardQueryExecutor: qe,
3334
+ getItemData: Ve,
3335
+ setItemData: Me,
3336
+ handleRefresh: Be,
3337
+ setCrossFilter: tt,
3338
+ removeFilter: nt,
3339
+ unSelect: ot,
3340
+ dashboardCreated: it,
3341
+ updateTitle: Fe
3342
+ };
3343
+ }
3344
+ export {
3345
+ Ci as C,
3346
+ pi as D,
3347
+ wi as M,
3348
+ ki as _,
3349
+ gi as a,
3350
+ bi as b,
3351
+ Ii as u
3352
+ };