@trilogy-data/trilogy-studio-components 0.1.25 → 0.1.27

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 (200) hide show
  1. package/dist/AssetAutoImporter-OHphsfW9.js +403 -0
  2. package/dist/ChatCreatorModal-CuXha6Dg.js +218 -0
  3. package/dist/ChatModelSelect-Cz7axWjP.js +40 -0
  4. package/dist/{CodeBlock-PT4no49I.js → CodeBlock-BBsaC6hX.js} +4 -4
  5. package/dist/{CommunityModels-D7zWnHgG.js → CommunityModels-CIQQhO-y.js} +106 -75
  6. package/dist/{ConnectionErrorPopup-FSs7U-Yl.js → ConnectionErrorPopup-7vpqgF0s.js} +1 -1
  7. package/dist/{ConnectionView-COnTTuA4.js → ConnectionView-7Jj_Ggdi.js} +49 -49
  8. package/dist/{CreateEditorFromDatasourcePopup-snOh1d5h.js → CreateEditorFromDatasourcePopup-CrVHUWFl.js} +4 -4
  9. package/dist/{Dashboard-D1ZCTw5r.js → Dashboard-DxSi9W6Q.js} +276 -280
  10. package/dist/{DashboardImportSelector-CNxibXlS.js → DashboardImportSelector-kuDRDYi8.js} +2 -2
  11. package/dist/{DashboardMobile-D_m0xv17.js → DashboardMobile-CZEgTb0R.js} +39 -39
  12. package/dist/{DrilldownPane-CBs5ZojS.js → DrilldownPane-BheRHJMs.js} +5 -7
  13. package/dist/{Editor-DhsP18KE.js → Editor-D6tdutTm.js} +106 -104
  14. package/dist/{ErrorMessage-XMn_08gJ.js → ErrorMessage-D5JeF3Iz.js} +4 -4
  15. package/dist/{GlobalChatPanel-DFx9A4yP.js → GlobalChatPanel-BXZh0sdD.js} +169 -134
  16. package/dist/{IDE-BRMLxTfP.js → IDE-T8PmyAQ_.js} +200 -203
  17. package/dist/{JobsView-C9PYS6pZ.js → JobsView-Ca97MiSd.js} +12 -13
  18. package/dist/{LLMChat-Cqg6pTgC.js → LLMChat-Cch33Yd_.js} +3 -3
  19. package/dist/{LLMView-VkJpP-49.js → LLMView-BDb6wD74.js} +26 -26
  20. package/dist/{LoadingView-s1uznGwG.js → LoadingView-B-xFwd2N.js} +2 -2
  21. package/dist/{MarkdownRenderer-BNDuEyG-.js → MarkdownRenderer-BWvdx0k3.js} +531 -430
  22. package/dist/MobileIDE-DpdEQEqc.js +783 -0
  23. package/dist/{ModelCard-D8tKkK9-.js → ModelCard-DkAMP4X9.js} +19 -20
  24. package/dist/{ModelView-rAurf9n8.js → ModelView-DomyhN8g.js} +7 -7
  25. package/dist/PageLoading-BAvKGo9h.js +5937 -0
  26. package/dist/{ResultComponent-_-1qZCfv.js → ResultComponent-zoOSoRLe.js} +8 -8
  27. package/dist/{Results-CQGpFmPQ.js → Results-dq-SlJbU.js} +17 -19
  28. package/dist/{StatusIcon-BylPx2EO.js → StatusIcon-AbxNvJ6p.js} +2 -2
  29. package/dist/{StoreTokenModal-zCSYhfrw.js → StoreTokenModal-CM8WXdu1.js} +2 -2
  30. package/dist/{SymbolsPane-BpmL___H.js → SymbolsPane-DfaxeaPS.js} +6 -3
  31. package/dist/{TrilogyEmbedProvider-WA_dlv9e.js → TrilogyEmbedProvider-D3h0gYnX.js} +9 -9
  32. package/dist/{TutorialPage-CZGBRJdq.js → TutorialPage-BtEJG7cT.js} +27 -28
  33. package/dist/{VegaLiteChart-CmkOw6yD.js → VegaLiteChart-BVyAab-o.js} +12191 -10975
  34. package/dist/{WelcomePage-CLKvAvk-.js → WelcomePage-BoqzYBLr.js} +5 -5
  35. package/dist/{embedTheme-Bub46ILG.js → _plugin-vue_export-helper-f9Rw-Il4.js} +14 -6
  36. package/dist/assets/{css.worker-9aDGcEUy.js → css.worker-niORQtzO.js} +14 -14
  37. package/dist/assets/{html.worker-D2LKDpnG.js → html.worker-CO5LvJpF.js} +17 -17
  38. package/dist/assets/json.worker-BezHzWUV.js +58 -0
  39. package/dist/assets/{ts.worker-Bz0-EaKK.js → ts.worker-CYhxGg0r.js} +107 -107
  40. package/dist/{results-DTgAKr5j.js → base-DuKnVD-A.js} +216 -45
  41. package/dist/components/AssetAutoImporter.vue.d.ts.map +1 -1
  42. package/dist/components/FeedbackBanner.vue.d.ts +4 -0
  43. package/dist/components/FeedbackBanner.vue.d.ts.map +1 -0
  44. package/dist/components/TipsCTA.vue.d.ts +1 -1
  45. package/dist/components/VegaLiteChart.vue.d.ts.map +1 -1
  46. package/dist/components/chartHelpers.d.ts +9 -1
  47. package/dist/components/chartHelpers.d.ts.map +1 -1
  48. package/dist/components/chartRenderManager.d.ts +4 -1
  49. package/dist/components/chartRenderManager.d.ts.map +1 -1
  50. package/dist/components/community/AddStoreModal.vue.d.ts +1 -1
  51. package/dist/components/community/AddStoreModal.vue.d.ts.map +1 -1
  52. package/dist/components/community/CommunityModelCard.vue.d.ts.map +1 -1
  53. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts +54 -0
  54. package/dist/components/dashboard/DashboardCreatorIcon.vue.d.ts.map +1 -0
  55. package/dist/components/dashboard/DashboardProvenance.vue.d.ts +30 -0
  56. package/dist/components/dashboard/DashboardProvenance.vue.d.ts.map +1 -0
  57. package/dist/components/dashboard/ReportLayout.vue.d.ts +19 -0
  58. package/dist/components/dashboard/ReportLayout.vue.d.ts.map +1 -0
  59. package/dist/components/editor/Editor.vue.d.ts +3 -3
  60. package/dist/components/editor/Editor.vue.d.ts.map +1 -1
  61. package/dist/components/editor/EditorCreatorIcon.vue.d.ts +62 -0
  62. package/dist/components/editor/EditorCreatorIcon.vue.d.ts.map +1 -0
  63. package/dist/components/editor/ValidationComponent.vue.d.ts +50 -0
  64. package/dist/components/editor/ValidationComponent.vue.d.ts.map +1 -0
  65. package/dist/components/jobs/JobsAddStoreModal.vue.d.ts.map +1 -1
  66. package/dist/components/llm/ChatCreatorModal.vue.d.ts +17 -1
  67. package/dist/components/llm/ChatCreatorModal.vue.d.ts.map +1 -1
  68. package/dist/components/llm/ChatModelSelect.vue.d.ts +13 -0
  69. package/dist/components/llm/ChatModelSelect.vue.d.ts.map +1 -0
  70. package/dist/components/llm/GlobalChatPanel.vue.d.ts.map +1 -1
  71. package/dist/components/model/ModelCard.vue.d.ts +3 -3
  72. package/dist/components/sidebar/CommunityModelList.vue.d.ts +33 -50
  73. package/dist/components/sidebar/CommunityModelList.vue.d.ts.map +1 -1
  74. package/dist/components/sidebar/CommunityModelListItem.vue.d.ts.map +1 -1
  75. package/dist/components/sidebar/EditorList.vue.d.ts +32 -49
  76. package/dist/components/sidebar/EditorList.vue.d.ts.map +1 -1
  77. package/dist/components/sidebar/LLMConnectionList.vue.d.ts.map +1 -1
  78. package/dist/components/sidebar/Sidebar.vue.d.ts +65 -99
  79. package/dist/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  80. package/dist/components/tutorial/TutorialPrompt.vue.d.ts +3 -3
  81. package/dist/components/tutorial/TutorialPrompt.vue.d.ts.map +1 -1
  82. package/dist/{remoteWorker-Dkv3TJ0j.js → connections-CWH3zwH2.js} +4544 -4126
  83. package/dist/connections.js +3 -4
  84. package/dist/{cssMode-D4Rzr1Cu.js → cssMode-zpO2ap2B.js} +5 -6
  85. package/dist/dashboard.js +54 -57
  86. package/dist/dashboards/layerSpec.d.ts +38 -4
  87. package/dist/dashboards/layerSpec.d.ts.map +1 -1
  88. package/dist/dashboards/lineAreaSpec.d.ts +8 -80
  89. package/dist/dashboards/lineAreaSpec.d.ts.map +1 -1
  90. package/dist/dashboards/mapSpec.d.ts +1 -0
  91. package/dist/dashboards/mapSpec.d.ts.map +1 -1
  92. package/dist/dashboards/spec.d.ts.map +1 -1
  93. package/dist/data/tutorial/documentation.d.ts.map +1 -1
  94. package/dist/data/tutorial/startupScripts.d.ts +3 -0
  95. package/dist/data/tutorial/startupScripts.d.ts.map +1 -0
  96. package/dist/{dist-CXoL8kXK.js → dist-1z5KURzS.js} +55 -50
  97. package/dist/{dist-DKkuvbPb.js → dist-Bv3D2p5A.js} +20 -18
  98. package/dist/{editor.main-Cl8i7rHY.js → editor.main-BQh6DxDB.js} +33 -33
  99. package/dist/{editorRefinementRuntime-C_YmXRy4.js → editorStore-CAlMJftt.js} +2084 -946
  100. package/dist/embed.js +2 -2
  101. package/dist/entry.dashboard.d.ts +1 -0
  102. package/dist/entry.dashboard.d.ts.map +1 -1
  103. package/dist/{freemarker2-fW5NBILf.js → freemarker2-DQBqlEXc.js} +1 -1
  104. package/dist/{globalChatRuntime-oMLiPLNC.js → globalChatRuntime-CyS7vH51.js} +18 -18
  105. package/dist/{handlebars-dG4w8UUY.js → handlebars-tgYxaM70.js} +1 -1
  106. package/dist/{helpers-DcWCa6bX.js → helpers-BbVlA3Pf.js} +39 -39
  107. package/dist/{html-1Dq70BdU.js → html-jJahD3Mi.js} +1 -1
  108. package/dist/{htmlMode--IQmLBeh.js → htmlMode-BA1-8l2e.js} +5 -6
  109. package/dist/{javascript-CTzBM4sF.js → javascript-Cypfo7va.js} +1 -1
  110. package/dist/{jsonMode-DzeJjIEH.js → jsonMode-xJye8PWS.js} +25 -25
  111. package/dist/{liquid-DlHThiki.js → liquid-BGDrv5da.js} +1 -1
  112. package/dist/llm/data/constants.d.ts +1 -1
  113. package/dist/llm/data/constants.d.ts.map +1 -1
  114. package/dist/llm/data/trilogySyntax.generated.d.ts +7 -1
  115. package/dist/llm/data/trilogySyntax.generated.d.ts.map +1 -1
  116. package/dist/llm/docsIndex.d.ts.map +1 -1
  117. package/dist/llm/openai.d.ts +2 -1
  118. package/dist/llm/openai.d.ts.map +1 -1
  119. package/dist/llm-ClU-2rgk.js +18493 -0
  120. package/dist/llm.js +2 -3
  121. package/dist/{localStorage-CSuYS7QE.js → localStorage-CGQ1iJXt.js} +39 -42
  122. package/dist/{lspLanguageFeatures-Cdfs3EKq.js → lspLanguageFeatures-V3e_p9oN.js} +32 -32
  123. package/dist/{mdx-fn3g4PH5.js → mdx-BUR1aImW.js} +1 -1
  124. package/dist/models/helpers.d.ts.map +1 -1
  125. package/dist/monaco.js +3 -3
  126. package/dist/{python-CCVj0pFt.js → python-YLkl0pc6.js} +1 -1
  127. package/dist/{razor-Cj3flYnk.js → razor-BP8TRMDY.js} +1 -1
  128. package/dist/{reconcile-Bk7M797_.js → reconcile-DXIvGwBk.js} +1 -1
  129. package/dist/{remoteStoreSync-CLvZJrTK.js → remoteStoreSync-CuQBWpWf.js} +3 -3
  130. package/dist/remotes/displayHelpers.d.ts.map +1 -1
  131. package/dist/remotes/genericStoreMetadata.d.ts +1 -0
  132. package/dist/remotes/genericStoreMetadata.d.ts.map +1 -1
  133. package/dist/remotes/models.d.ts +37 -5
  134. package/dist/remotes/models.d.ts.map +1 -1
  135. package/dist/remotes/staticStorePresets.d.ts +22 -0
  136. package/dist/remotes/staticStorePresets.d.ts.map +1 -0
  137. package/dist/remotes/storeService.d.ts +25 -4
  138. package/dist/remotes/storeService.d.ts.map +1 -1
  139. package/dist/{rolldown-runtime-Dqa2HsxW.js → rolldown-runtime-B0aSnxlc.js} +2 -2
  140. package/dist/static/test_import.vue.d.ts +4 -0
  141. package/dist/static/test_import.vue.d.ts.map +1 -0
  142. package/dist/stores/communityApiStore.d.ts +32 -60
  143. package/dist/stores/communityApiStore.d.ts.map +1 -1
  144. package/dist/stores/connectionStore.d.ts.map +1 -1
  145. package/dist/stores/resolver.d.ts +5 -0
  146. package/dist/stores/resolver.d.ts.map +1 -1
  147. package/dist/stores/urlStore.d.ts +1 -0
  148. package/dist/stores/urlStore.d.ts.map +1 -1
  149. package/dist/stores-LlyiwSbK.js +2604 -0
  150. package/dist/stores.js +4 -7
  151. package/dist/trilogy-studio-components.css +1 -1
  152. package/dist/{tsMode-GI4xMYAl.js → tsMode-BH9HS_sH.js} +64 -66
  153. package/dist/{typescript-CPibXi3J.js → typescript-BM-ynfk9.js} +1 -1
  154. package/dist/{useChatWithTools-GV1ufcqw.js → useChatWithTools-m3Jn_SV-.js} +11 -11
  155. package/dist/{useDashboard-OoBKkkuQ.js → useDashboard-BOAuvVEw.js} +1013 -1021
  156. package/dist/{tabulator_esm-CxLvGDp8.js → useGlobalChatPanel-DuP1q7_f.js} +1729 -711
  157. package/dist/{useResizableDialog-B0ePSts4.js → useResizableDialog-Cs90WJdF.js} +2 -2
  158. package/dist/views/MobileIDE.vue.d.ts.map +1 -1
  159. package/dist/views/ModelView.vue.d.ts +6 -6
  160. package/dist/views/ModelView.vue.d.ts.map +1 -1
  161. package/dist/views/TutorialPage.vue.d.ts +41 -58
  162. package/dist/views/TutorialPage.vue.d.ts.map +1 -1
  163. package/dist/views.js +193 -195
  164. package/dist/{editor.api2-ClD5pp8H.js → workers-B9Eybl-M.js} +16252 -15926
  165. package/dist/{xml-BNyphceI.js → xml-M5WFPSpA.js} +1 -1
  166. package/dist/{yaml-DE5Vz0PH.js → yaml-CEeFwjz9.js} +1 -1
  167. package/package.json +29 -20
  168. package/dist/AssetAutoImporter-DfMd_DSk.js +0 -403
  169. package/dist/ChatCreatorModal-BTqY06B6.js +0 -177
  170. package/dist/DashboardCreatorInline-LWvf--2x.js +0 -129
  171. package/dist/DataTable-DoRDynP1.js +0 -365
  172. package/dist/EditorCreatorInline-D6_y1H_h.js +0 -125
  173. package/dist/LoadingButton-OH3frQuO.js +0 -138
  174. package/dist/MobileIDE-CHGJoh05.js +0 -781
  175. package/dist/ModalDialog-D1EOG4rl.js +0 -42
  176. package/dist/ModelCreator-DrxLxeyH.js +0 -253
  177. package/dist/PageLoading-I6mr-7NB.js +0 -2666
  178. package/dist/Tooltip-Dihir4zs.js +0 -103
  179. package/dist/_plugin-vue_export-helper-B3ysoDQm.js +0 -8
  180. package/dist/assets/json.worker-CJ5MmO5Q.js +0 -58
  181. package/dist/base-C8IuZWqY.js +0 -164
  182. package/dist/connectionHistoryStorage-DKJHiKJY.js +0 -111
  183. package/dist/connectionHistoryStore-DQeBvStZ.js +0 -61
  184. package/dist/connections-CJSb1TZl.js +0 -229
  185. package/dist/constants-DgFEYN2b.js +0 -7
  186. package/dist/dashboardStore-CNkWQ4r7.js +0 -641
  187. package/dist/demoSetup-DiW3ROFQ.js +0 -2941
  188. package/dist/editorRefinementToolExecutor-mX8ClQ63.js +0 -4498
  189. package/dist/editorStore-Ch7k-gse.js +0 -972
  190. package/dist/formatting-BbJ5ICgh.js +0 -6
  191. package/dist/llm-_807I79k.js +0 -11965
  192. package/dist/llmStore-CSzM1IZd.js +0 -153
  193. package/dist/monaco.contribution-ikesdolO.js +0 -128
  194. package/dist/stores-C1wUWiFm.js +0 -1708
  195. package/dist/trilogy-BroD2Qmp.js +0 -4
  196. package/dist/urlStore-Dgmwx1YI.js +0 -54
  197. package/dist/useGlobalChatPanel-CIeUyZba.js +0 -85
  198. package/dist/useIsMobile-CNpUQAvk.js +0 -8
  199. package/dist/usePrismHighlight-DVyDiDAL.js +0 -183
  200. package/dist/workers-Br7ThUKL.js +0 -47
@@ -1,2666 +0,0 @@
1
- import { t as e } from "./_plugin-vue_export-helper-B3ysoDQm.js";
2
- import { Dt as t } from "./editorRefinementToolExecutor-mX8ClQ63.js";
3
- import { i as n, o as r, r as i } from "./stores-C1wUWiFm.js";
4
- import { o as a } from "./editorRefinementRuntime-C_YmXRy4.js";
5
- import { a as o, c as s, i as c, l, u } from "./editorStore-Ch7k-gse.js";
6
- import "./dashboardStore-CNkWQ4r7.js";
7
- import { n as d, t as f } from "./urlStore-Dgmwx1YI.js";
8
- import { t as p } from "./ModalDialog-D1EOG4rl.js";
9
- import { t as m } from "./Tooltip-Dihir4zs.js";
10
- import { t as h } from "./LoadingButton-OH3frQuO.js";
11
- import { t as g } from "./useIsMobile-CNpUQAvk.js";
12
- import { t as _ } from "./trilogy-BroD2Qmp.js";
13
- import { t as v } from "./DashboardCreatorInline-LWvf--2x.js";
14
- import { t as y } from "./useGlobalChatPanel-CIeUyZba.js";
15
- import { t as b } from "./localStorage-CSuYS7QE.js";
16
- import { n as x, r as S, t as C } from "./remoteStoreSync-CLvZJrTK.js";
17
- import { t as w } from "./ModelCreator-DrxLxeyH.js";
18
- import { t as T } from "./StatusIcon-BylPx2EO.js";
19
- import { a as E, c as ee, d as D, f as O, i as te, l as ne, n as re, o as k, p as A, r as ie, s as ae, u as oe } from "./demoSetup-DiW3ROFQ.js";
20
- import { Fragment as j, computed as M, createBlock as N, createCommentVNode as P, createElementBlock as F, createElementVNode as I, createStaticVNode as se, createTextVNode as L, createVNode as R, defineComponent as z, inject as B, nextTick as ce, normalizeClass as V, normalizeStyle as le, onMounted as H, openBlock as U, reactive as ue, ref as W, renderList as G, resolveComponent as K, toDisplayString as q, unref as J, vModelCheckbox as de, vModelSelect as fe, vModelText as Y, vShow as X, watch as pe, withCtx as Z, withDirectives as Q, withModifiers as $ } from "vue";
21
- import { storeToRefs as me } from "pinia";
22
- //#region components/layout/screenPresentation.ts
23
- var he = "mdi mdi-file-document-outline", ge = {
24
- editors: "mdi mdi-file-document-edit-outline",
25
- connections: "mdi mdi-database-outline",
26
- llms: "mdi mdi-creation-outline",
27
- dashboard: "mdi mdi-chart-multiple",
28
- "dashboard-import": "mdi mdi-chart-multiple",
29
- "asset-import": "mdi mdi-import",
30
- models: "mdi mdi-set-center",
31
- "community-models": "mdi mdi-library-outline",
32
- jobs: "mdi mdi-playlist-play",
33
- tutorial: "mdi mdi-help",
34
- settings: "mdi mdi-cog-outline",
35
- profile: "mdi mdi-account-outline",
36
- welcome: "mdi mdi-home-outline",
37
- "": he
38
- }, _e = { llms: "LLMs" };
39
- function ve(e) {
40
- return ge[e] || he;
41
- }
42
- function ye(e) {
43
- return _e[e] ?? e.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
44
- }
45
- //#endregion
46
- //#region components/sidebar/TutorialSidebar.vue?vue&type=script&lang.ts
47
- var be = {
48
- name: "DocumentationSidebar",
49
- props: { activeDocumentationKey: {
50
- type: String,
51
- default: "",
52
- optional: !0
53
- } },
54
- setup(e, { emit: t }) {
55
- if (!B("editorStore")) throw Error("Editor store is not provided!");
56
- let n = d(f.TUTORIAL) || "", r = g(), i = W(null), o = `documentation+${n.split("+")[1]}`, { overrides: s, isCollapsed: c, toggle: l } = A((e) => o.startsWith(e));
57
- return {
58
- documentationNodes: M(() => {
59
- let e = [];
60
- return a.forEach((t) => {
61
- let n = `documentation+${t.title}`;
62
- e.push({
63
- id: n,
64
- name: t.title,
65
- indent: 0,
66
- count: t.articles.length,
67
- type: "documentation"
68
- }), c(n) || t.articles.forEach((n) => {
69
- e.push({
70
- id: `article+${t.title}+${n.title}`,
71
- name: n.displayName || n.title,
72
- indent: 1,
73
- count: n.paragraphs.length,
74
- type: "article"
75
- });
76
- });
77
- }), e;
78
- }),
79
- toggleCollapse: l,
80
- collapsed: s,
81
- isCollapsed: c,
82
- isActiveNode: (t) => t === e.activeDocumentationKey,
83
- isMobile: r,
84
- mobileTree: i,
85
- expandMobileBranch: (e) => {
86
- c(e.id) && l(e.id);
87
- },
88
- selectMobileNode: (e) => t("documentation-key-selected", e.id)
89
- };
90
- },
91
- methods: { handleClick(e) {
92
- this.$emit("documentation-key-selected", e);
93
- } },
94
- components: {
95
- SidebarList: O,
96
- SidebarItem: D,
97
- MobileTreeList: k
98
- }
99
- };
100
- //#endregion
101
- //#region components/sidebar/TutorialSidebar.vue
102
- function xe(e, t, n, r, i, a) {
103
- let o = K("sidebar-item"), s = K("mobile-tree-list"), c = K("sidebar-list");
104
- return U(), N(c, { title: "Documentation" }, {
105
- actions: Z(() => [...t[0] ||= []]),
106
- default: Z(() => [R(s, {
107
- "list-id": "tutorial",
108
- ref: "mobileTree",
109
- items: r.documentationNodes,
110
- enabled: r.isMobile,
111
- "is-branch": (e) => e.type === "documentation",
112
- "is-direct-branch": (e) => e.type === "documentation",
113
- onExpand: r.expandMobileBranch,
114
- onSelect: r.selectMobileNode
115
- }, {
116
- item: Z(({ item: e }) => [(U(), N(o, {
117
- key: e.id,
118
- "item-id": e.id,
119
- name: e.name,
120
- indent: e.indent,
121
- "is-selected": r.isActiveNode(e.id),
122
- "is-collapsible": e.type === "documentation",
123
- "is-collapsed": r.isCollapsed(e.id),
124
- icon: e.type === "article" ? "mdi-text-box-outline" : "",
125
- "extra-info": e.type === "documentation" ? e.count : "",
126
- itemType: "documentation",
127
- onClick: (t) => r.isMobile ? r.mobileTree?.openItem(e) : a.handleClick(e.id),
128
- onToggle: r.toggleCollapse
129
- }, null, 8, [
130
- "item-id",
131
- "name",
132
- "indent",
133
- "is-selected",
134
- "is-collapsible",
135
- "is-collapsed",
136
- "icon",
137
- "extra-info",
138
- "onClick",
139
- "onToggle"
140
- ]))]),
141
- _: 1
142
- }, 8, [
143
- "items",
144
- "enabled",
145
- "is-branch",
146
- "is-direct-branch",
147
- "onExpand",
148
- "onSelect"
149
- ])]),
150
- _: 1
151
- });
152
- }
153
- var Se = /*#__PURE__*/ e(be, [["render", xe], ["__scopeId", "data-v-07263be1"]]), Ce = {
154
- name: "ModelList",
155
- props: {
156
- activeModelKey: String,
157
- testTag: {
158
- type: String,
159
- default: ""
160
- },
161
- mobileSearchQuery: {
162
- type: String,
163
- default: ""
164
- }
165
- },
166
- setup(e) {
167
- let t = B("modelStore"), r = B("saveModels"), i = B("editorStore"), a = B("trilogyResolver"), o = n(), s = g(), c = W(null), l = W(!1), u = o.activeModelKey.value || d(f.MODELS) || "", p = u.split("+")[0], m = "", h = "", _ = "", v = u.split("+");
168
- if (p === "model" ? m = v[1] : p === "source" ? (m = v[1], h = v[2]) : p === "datasource" ? (m = v[1], h = v[2], _ = v[3]) : p === "concept" && (m = v[1], h = v[2], v.length > 5 && (_ = v[3])), !t || !r || !i || !a) throw Error("Model store is not provided!");
169
- let { overrides: y, isCollapsed: b, toggle: x } = A((e) => {
170
- let [t, n, r, i] = e.split("+");
171
- return n === m ? t === "model" ? !0 : r === h ? t === "source" || t === "datasource" && i === _ : !1 : !1;
172
- }), S = M(() => e.mobileSearchQuery.trim().toLocaleLowerCase()), C = (e) => !S.value && b(e), w = M(() => {
173
- let e = [];
174
- return Object.values(t.models).sort((e, t) => e.name.localeCompare(t.name)).forEach((t) => {
175
- if (t.deleted) return;
176
- let n = ["model", t.name].join("+");
177
- e.push({
178
- id: n,
179
- name: t.name,
180
- indent: 0,
181
- count: t.sources.length,
182
- type: "model",
183
- concept: null
184
- }), C(n) || t.sources.forEach((n) => {
185
- let r = [
186
- "source",
187
- t.name,
188
- n.alias
189
- ].join("+");
190
- e.push({
191
- id: r,
192
- name: n.alias,
193
- indent: 1,
194
- count: n.concepts.length,
195
- type: "source",
196
- concept: null
197
- }), C(r) || (n.concepts.forEach((r) => {
198
- e.push({
199
- id: [
200
- "concept",
201
- t.name,
202
- n.alias,
203
- r.namespace,
204
- r.name
205
- ].join("+"),
206
- name: r.namespace === "local" ? r.name : r.namespace + "." + r.name,
207
- indent: 2,
208
- count: 0,
209
- type: "concept",
210
- concept: r
211
- });
212
- }), n.datasources.forEach((r) => {
213
- let i = [
214
- "datasource",
215
- t.name,
216
- n.alias,
217
- r.name
218
- ].join("+");
219
- e.push({
220
- id: i,
221
- name: r.name,
222
- indent: 2,
223
- count: r.concepts.length,
224
- type: "datasource",
225
- concept: null
226
- }), C(i) || r.concepts.forEach((i) => {
227
- e.push({
228
- id: [
229
- "concept",
230
- t.name,
231
- n.alias,
232
- r.name,
233
- i.namespace,
234
- i.name
235
- ].join("+"),
236
- name: i.namespace === "local" ? i.name : i.namespace + "." + i.name,
237
- indent: 3,
238
- count: 0,
239
- type: "concept",
240
- concept: i
241
- });
242
- });
243
- }));
244
- });
245
- }), S.value ? e.filter((e) => e.type === "concept" && e.name.toLocaleLowerCase().includes(S.value)) : e;
246
- }), T = (e) => a.resolveModel(e, t.models[e].sources.map((e) => ({
247
- alias: e.alias,
248
- contents: (i.editors[e.editor] || { contents: "" }).contents
249
- }))).then((n) => {
250
- t.setModelConfigParseResults(e, n);
251
- }).catch((n) => {
252
- t.setModelParseError(e, n.message), console.error("Failed to fetch parse results:", n);
253
- }), E = (e) => {
254
- let t = e.lastIndexOf("+"), n = t === -1 ? e : e.substring(t + 1);
255
- o.openTab("models", n, e);
256
- };
257
- return {
258
- creatorVisible: l,
259
- flatList: w,
260
- collapsed: y,
261
- isCollapsed: b,
262
- saveModels: r,
263
- fetchParseResults: T,
264
- trilogyIcon: oe,
265
- navigationStore: o,
266
- handleClick: E,
267
- handleToggle: x,
268
- modelStore: t,
269
- contextMenuItems: (e) => e.type === "model" ? [
270
- {
271
- id: "refresh-model",
272
- label: "Refresh model",
273
- icon: "mdi-cog-refresh-outline"
274
- },
275
- {
276
- id: "delete-separator",
277
- kind: "separator"
278
- },
279
- {
280
- id: "delete-model",
281
- label: "Delete model",
282
- icon: "mdi-trash-can-outline",
283
- danger: !0
284
- }
285
- ] : [],
286
- handleContextMenuItemClick: (e, n) => {
287
- switch (n.id) {
288
- case "refresh-model":
289
- T(e.name);
290
- break;
291
- case "delete-model":
292
- t.removeModelConfig(e.name);
293
- break;
294
- }
295
- },
296
- isMobile: s,
297
- mobileTree: c,
298
- searchQuery: S,
299
- isModelBranch: (e) => e.type === "model" || ["source", "datasource"].includes(e.type) && e.count > 0,
300
- expandMobileBranch: (e) => {
301
- b(e.id) && x(e.id);
302
- },
303
- selectMobileItem: (e) => E(e.id)
304
- };
305
- },
306
- components: {
307
- SidebarList: O,
308
- SidebarItem: D,
309
- ModelCreator: w,
310
- LoadingButton: h,
311
- Tooltip: m,
312
- SidebarOverflowMenu: ee,
313
- MobileTreeList: k
314
- }
315
- }, we = { class: "models-header" }, Te = { class: "models-header-actions" }, Ee = ["data-testid"], De = ["src"], Oe = {
316
- key: 2,
317
- class: "mdi mdi-table node-icon"
318
- }, ke = {
319
- key: 0,
320
- class: "right-container"
321
- };
322
- function Ae(e, t, n, r, i, a) {
323
- let o = K("loading-button"), s = K("model-creator"), c = K("sidebar-overflow-menu"), l = K("sidebar-item"), u = K("mobile-tree-list"), d = K("sidebar-list");
324
- return U(), N(d, { title: "Models" }, {
325
- header: Z(() => [I("div", we, [t[4] ||= I("h3", { class: "font-sans sidebar-header" }, "Models", -1), I("div", Te, [I("button", {
326
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create",
327
- onClick: t[0] ||= (e) => r.creatorVisible = !r.creatorVisible,
328
- "data-testid": n.testTag ? `model-creator-add-${n.testTag}` : "model-creator-add"
329
- }, [t[2] ||= I("i", { class: "mdi mdi-plus" }, null, -1), L(" " + q(r.creatorVisible ? "Close" : "New"), 1)], 8, Ee), R(o, {
330
- class: "sidebar-control-button sidebar-header-action",
331
- action: r.saveModels,
332
- "key-combination": ["control", "s"],
333
- "use-default-style": !1
334
- }, {
335
- default: Z(() => [...t[3] ||= [L(" Save ", -1)]]),
336
- _: 1
337
- }, 8, ["action"])])])]),
338
- actions: Z(() => [R(s, {
339
- visible: r.creatorVisible,
340
- onClose: t[1] ||= (e) => r.creatorVisible = !r.creatorVisible
341
- }, null, 8, ["visible"])]),
342
- default: Z(() => [R(u, {
343
- "list-id": "models",
344
- ref: "mobileTree",
345
- items: r.flatList,
346
- enabled: r.isMobile,
347
- flat: !!r.searchQuery,
348
- "is-branch": r.isModelBranch,
349
- "is-selectable": r.isModelBranch,
350
- onExpand: r.expandMobileBranch,
351
- onSelect: r.selectMobileItem
352
- }, {
353
- item: Z(({ item: e }) => [R(l, {
354
- "item-id": e.id,
355
- name: e.name,
356
- indent: e.indent,
357
- "is-selected": n.activeModelKey === e.id,
358
- "is-collapsible": ["model"].includes(e.type) || ["source", "datasource"].includes(e.type) && e.count > 0,
359
- "is-collapsed": r.isCollapsed(e.id),
360
- onClick: (t) => r.isMobile ? r.mobileTree?.openItem(e) : r.handleClick(e.id),
361
- onToggle: r.handleToggle
362
- }, {
363
- icon: Z(() => [e.type === "source" ? (U(), F("img", {
364
- key: 0,
365
- src: r.trilogyIcon,
366
- class: "trilogy-icon"
367
- }, null, 8, De)) : e.type === "concept" ? (U(), F("span", {
368
- key: 1,
369
- class: V(`purpose-${e.concept.purpose.toLowerCase()}`)
370
- }, q(e.concept.purpose.charAt(0).toUpperCase()), 3)) : e.type === "datasource" ? (U(), F("i", Oe)) : P("", !0)]),
371
- "extra-content": Z(() => [e.type === "model" ? (U(), F("span", ke, [R(c, {
372
- items: r.contextMenuItems(e),
373
- tooltip: "Model actions",
374
- onSelect: (t) => r.handleContextMenuItemClick(e, t)
375
- }, null, 8, ["items", "onSelect"])])) : P("", !0)]),
376
- _: 2
377
- }, 1032, [
378
- "item-id",
379
- "name",
380
- "indent",
381
- "is-selected",
382
- "is-collapsible",
383
- "is-collapsed",
384
- "onClick",
385
- "onToggle"
386
- ])]),
387
- _: 1
388
- }, 8, [
389
- "items",
390
- "enabled",
391
- "flat",
392
- "is-branch",
393
- "is-selectable",
394
- "onExpand",
395
- "onSelect"
396
- ])]),
397
- _: 1
398
- });
399
- }
400
- var je = /*#__PURE__*/ e(Ce, [["render", Ae], ["__scopeId", "data-v-ad82d845"]]), Me = {
401
- key: 0,
402
- class: "mdi mdi-server-network sidebar-icon"
403
- }, Ne = {
404
- key: 1,
405
- class: "mdi mdi-folder-outline sidebar-icon"
406
- }, Pe = {
407
- key: 2,
408
- class: "mdi mdi-file-outline sidebar-icon"
409
- }, Fe = {
410
- key: 0,
411
- class: "tag-container"
412
- }, Ie = /*#__PURE__*/ e(/* @__PURE__ */ z({
413
- __name: "JobsListItem",
414
- props: {
415
- item: {},
416
- activeJobsKey: { default: "" },
417
- isCollapsed: {
418
- type: Boolean,
419
- default: !1
420
- }
421
- },
422
- emits: [
423
- "item-click",
424
- "item-toggle",
425
- "delete-store",
426
- "refresh-store"
427
- ],
428
- setup(e, { emit: t }) {
429
- let n = e, i = t, a = r(), o = () => {
430
- i("item-click", n.item);
431
- }, s = () => {
432
- i("item-toggle", n.item);
433
- }, c = (e) => a.getStoreStatus(e), l = (e) => {
434
- let t = a.errors[e];
435
- if (t) return t;
436
- let n = a.getStoreStatus(e);
437
- if (n === "connected") return "Ready";
438
- if (n === "running") return "Polling active jobs";
439
- };
440
- return (t, n) => (U(), N(D, {
441
- "item-id": e.item.key,
442
- name: e.item.label,
443
- indent: e.item.indent,
444
- "is-selected": e.activeJobsKey === e.item.key,
445
- "is-collapsible": e.item.type === "store" || e.item.type === "directory",
446
- "is-collapsed": e.isCollapsed,
447
- itemType: "jobs",
448
- onClick: o,
449
- onToggle: s
450
- }, {
451
- icon: Z(() => [e.item.type === "store" ? (U(), F("i", Me)) : e.item.type === "directory" ? (U(), F("i", Ne)) : (U(), F("i", Pe))]),
452
- "extra-content": Z(() => [e.item.type === "store" && e.item.store ? (U(), F("span", Fe, [
453
- R(m, {
454
- content: "Remove Store",
455
- position: "left"
456
- }, {
457
- default: Z(() => [I("span", {
458
- class: "remove-btn hover-icon sidebar-icon-button danger",
459
- onClick: n[0] ||= $((t) => i("delete-store", e.item.store), ["stop"])
460
- }, [...n[2] ||= [I("i", { class: "mdi mdi-trash-can-outline" }, null, -1)]])]),
461
- _: 1
462
- }),
463
- R(m, {
464
- content: "Refresh Store",
465
- position: "left"
466
- }, {
467
- default: Z(() => [I("span", {
468
- class: "hover-icon sidebar-icon-button",
469
- onClick: n[1] ||= $((t) => i("refresh-store", e.item.store.id), ["stop"])
470
- }, [...n[3] ||= [I("i", { class: "mdi mdi-refresh" }, null, -1)]])]),
471
- _: 1
472
- }),
473
- R(T, {
474
- status: c(e.item.store.id),
475
- message: l(e.item.store.id),
476
- "test-name": e.item.store.id
477
- }, null, 8, [
478
- "status",
479
- "message",
480
- "test-name"
481
- ])
482
- ])) : P("", !0)]),
483
- _: 1
484
- }, 8, [
485
- "item-id",
486
- "name",
487
- "indent",
488
- "is-selected",
489
- "is-collapsible",
490
- "is-collapsed"
491
- ]));
492
- }
493
- }), [["__scopeId", "data-v-ace64696"]]), Le = { class: "form-group" }, Re = { class: "form-group" }, ze = { class: "form-group" }, Be = {
494
- key: 0,
495
- class: "form-error",
496
- "data-testid": "add-jobs-store-error"
497
- }, Ve = { class: "dialog-actions" }, He = ["disabled"], Ue = /*#__PURE__*/ e(/* @__PURE__ */ z({
498
- __name: "JobsAddStoreModal",
499
- props: {
500
- show: { type: Boolean },
501
- loading: { type: Boolean }
502
- },
503
- emits: ["close", "add"],
504
- setup(e, { emit: t }) {
505
- let n = e, r = t, i = W(""), a = W(""), o = W(""), c = W("");
506
- pe(() => n.show, (e) => {
507
- e && (i.value = "", a.value = "", o.value = "", c.value = "");
508
- });
509
- let d = () => {
510
- if (!a.value) {
511
- c.value = "Base URL is required.";
512
- return;
513
- }
514
- let e = u(a.value);
515
- r("add", {
516
- type: "generic",
517
- id: l(e),
518
- name: i.value || s(e),
519
- baseUrl: e,
520
- token: o.value || void 0
521
- });
522
- };
523
- return (t, n) => (U(), N(p, {
524
- show: e.show,
525
- title: "Add Jobs Store",
526
- "test-id": "add-jobs-store-modal",
527
- onClose: n[4] ||= (e) => t.$emit("close")
528
- }, {
529
- default: Z(() => [I("form", { onSubmit: $(d, ["prevent"]) }, [
530
- I("div", Le, [n[5] ||= I("label", null, "Store Name", -1), Q(I("input", {
531
- "onUpdate:modelValue": n[0] ||= (e) => i.value = e,
532
- type: "text",
533
- placeholder: "Optional, defaults to the store URL",
534
- "data-testid": "jobs-store-name-input"
535
- }, null, 512), [[Y, i.value]])]),
536
- I("div", Re, [
537
- n[6] ||= I("label", null, "Base URL", -1),
538
- Q(I("input", {
539
- "onUpdate:modelValue": n[1] ||= (e) => a.value = e,
540
- type: "url",
541
- placeholder: "e.g., http://localhost:8100",
542
- "data-testid": "jobs-store-url-input",
543
- required: ""
544
- }, null, 512), [[Y, a.value]]),
545
- n[7] ||= I("small", null, "Must expose `/index.json`, `/files`, `/run`, `/refresh`, and `/jobs/{id}`.", -1)
546
- ]),
547
- I("div", ze, [
548
- n[8] ||= I("label", null, "Token", -1),
549
- Q(I("input", {
550
- "onUpdate:modelValue": n[2] ||= (e) => o.value = e,
551
- type: "text",
552
- placeholder: "Optional X-Trilogy-Token value",
553
- "data-testid": "jobs-store-token-input"
554
- }, null, 512), [[Y, o.value]]),
555
- n[9] ||= I("small", null, "Stored in memory only. You’ll need to re-enter it after a full reload.", -1)
556
- ]),
557
- c.value ? (U(), F("div", Be, q(c.value), 1)) : P("", !0),
558
- I("div", Ve, [I("button", {
559
- type: "button",
560
- class: "cancel-btn",
561
- onClick: n[3] ||= (e) => t.$emit("close")
562
- }, "Cancel"), I("button", {
563
- type: "submit",
564
- class: "confirm-btn",
565
- disabled: e.loading
566
- }, q(e.loading ? "Adding..." : "Add Store"), 9, He)])
567
- ], 32)]),
568
- _: 1
569
- }, 8, ["show"]));
570
- }
571
- }), [["__scopeId", "data-v-b2a74918"]]), We = (e, t) => ({
572
- name: e,
573
- path: t,
574
- files: [],
575
- children: {}
576
- }), Ge = (e) => e.slice().sort((e, t) => e.localeCompare(t)), Ke = (e, t) => {
577
- if (!t) return e;
578
- let n = t.split("/").filter(Boolean), r = e, i = "";
579
- return n.forEach((e) => {
580
- i = i ? `${i}/${e}` : e, r.children[e] || (r.children[e] = We(e, i)), r = r.children[e];
581
- }), r;
582
- }, qe = (e, t) => `${e}+directory+${encodeURIComponent(t)}`, Je = (e, t) => `${e}+file+${encodeURIComponent(t)}`, Ye = (e, t, n, r, i) => {
583
- Ge(n).forEach((n) => {
584
- let a = r ? `${r}/${n}` : n;
585
- e.push({
586
- type: "file",
587
- label: n,
588
- key: Je(t, a),
589
- indent: i,
590
- storeId: t,
591
- target: a
592
- });
593
- });
594
- }, Xe = (e, t, n, r, i) => {
595
- Ye(e, t, n.files, n.path, i), Object.values(n.children).sort((e, t) => e.name.localeCompare(t.name)).forEach((n) => {
596
- let a = qe(t, n.path);
597
- e.push({
598
- type: "directory",
599
- label: n.name,
600
- key: a,
601
- indent: i,
602
- storeId: t,
603
- target: n.path
604
- }), r(a) || Xe(e, t, n, r, i + 1);
605
- });
606
- }, Ze = (e, t = [], n = {}) => {
607
- let r = [];
608
- return t.forEach((t) => {
609
- if (r.push({
610
- type: "store",
611
- label: t.name,
612
- key: t.id,
613
- indent: 0,
614
- storeId: t.id,
615
- store: t
616
- }), e(t.id)) return;
617
- let i = We("", "");
618
- (n[t.id]?.directories || []).forEach((e) => {
619
- let t = Ke(i, e.directory);
620
- t.files = Ge(e.files);
621
- }), Xe(r, t.id, i, e, 1);
622
- }), r;
623
- }, Qe = { class: "jobs-header" }, $e = {
624
- key: 0,
625
- class: "empty-state"
626
- }, et = {
627
- key: 1,
628
- class: "error-container"
629
- }, tt = { class: "error-text" }, nt = ["onClick"], rt = /*#__PURE__*/ e(/* @__PURE__ */ z({
630
- __name: "JobsList",
631
- props: { activeJobsKey: { default: "" } },
632
- emits: ["jobs-key-selected"],
633
- setup(e, { emit: t }) {
634
- let i = e, a = t, o = c(), s = r(), l = n(), u = B("storageSources", []), d = B("editorStore"), f = B("connectionStore"), p = B("modelStore"), m = W(!1), h = g(), _ = W(null), v = M(() => u.find((e) => e.type === "remote")), y = M(() => o.stores.filter((e) => e.type === "generic")), b = M(() => y.value.some((e) => !!s.errors[e.id])), w = M(() => y.value.filter((e) => !!s.errors[e.id])), T = M(() => (i.activeJobsKey || "").split("+")[0] || ""), { isCollapsed: E, toggle: ee, open: D } = A((e) => e.includes("+directory+") ? !0 : T.value ? e === T.value : y.value.length === 1 && e === y.value[0].id), te = M(() => Ze(E, y.value, s.filesByStore)), ne = async (e) => {
635
- try {
636
- await o.addStore(e), await s.fetchFilesForStore(e.id), v.value && d && f && p && await x(v.value, e.id, d, f, p), D(e.id), m.value = !1;
637
- } catch (e) {
638
- console.error("Failed to add jobs store:", e);
639
- }
640
- }, { isOpen: re, openConfirmation: ie, closeConfirmation: oe, confirm: se } = ae((e) => {
641
- d && f && p && C(e.id, d, f, p), o.removeStore(e.id), s.clearStoreData(e.id);
642
- }), z = (e) => {
643
- l.openTab("jobs", null, e.key), a("jobs-key-selected", e.key);
644
- }, ce = (e) => {
645
- ee(e.key);
646
- }, V = (e) => ["store", "directory"].includes(e.type), le = (e) => {
647
- E(e.key) && ce(e);
648
- }, ue = (e) => {
649
- h.value ? _.value?.openItem(e) : z(e);
650
- }, K = async (e) => {
651
- await s.fetchFilesForStore(e);
652
- };
653
- return H(async () => {
654
- o.loadStoresFromStorage(), await s.refreshAllStores();
655
- }), (t, n) => (U(), N(O, { title: "Jobs" }, {
656
- header: Z(() => [I("div", Qe, [n[3] ||= I("h3", { class: "font-sans sidebar-header" }, "Jobs", -1), I("button", {
657
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create",
658
- onClick: n[0] ||= (e) => m.value = !0
659
- }, [...n[2] ||= [I("i", { class: "mdi mdi-plus" }, null, -1), L(" New ", -1)]])])]),
660
- default: Z(() => [
661
- y.value.length ? P("", !0) : (U(), F("div", $e, " Add a Trilogy local server to browse files and run jobs. ")),
662
- b.value ? (U(), F("div", et, [(U(!0), F(j, null, G(w.value, (e) => (U(), F("div", {
663
- key: e.id,
664
- class: "error-item"
665
- }, [I("span", tt, q(e.name) + ": " + q(J(s).errors[e.id]), 1), I("button", {
666
- onClick: (t) => J(s).clearStoreError(e.id),
667
- class: "clear-error"
668
- }, "x", 8, nt)]))), 128))])) : P("", !0),
669
- R(k, {
670
- "list-id": "jobs",
671
- ref_key: "mobileTree",
672
- ref: _,
673
- items: te.value,
674
- "id-field": "key",
675
- "label-field": "label",
676
- enabled: J(h),
677
- "is-branch": V,
678
- "is-selectable": V,
679
- onExpand: le,
680
- onSelect: z
681
- }, {
682
- item: Z(({ item: t }) => [(U(), N(Ie, {
683
- key: t.key,
684
- item: t,
685
- "is-collapsed": J(E)(t.key),
686
- "active-jobs-key": e.activeJobsKey,
687
- onItemClick: ue,
688
- onItemToggle: ce,
689
- onDeleteStore: J(ie),
690
- onRefreshStore: K
691
- }, null, 8, [
692
- "item",
693
- "is-collapsed",
694
- "active-jobs-key",
695
- "onDeleteStore"
696
- ]))]),
697
- _: 1
698
- }, 8, ["items", "enabled"]),
699
- R(Ue, {
700
- show: m.value,
701
- onClose: n[1] ||= (e) => m.value = !1,
702
- onAdd: ne
703
- }, null, 8, ["show"]),
704
- R(S, {
705
- show: J(re),
706
- title: "Confirm Store Removal",
707
- message: "Remove this jobs store? Imported models remain untouched.",
708
- "confirm-label": "Remove",
709
- onClose: J(oe),
710
- onConfirm: J(se)
711
- }, null, 8, [
712
- "show",
713
- "onClose",
714
- "onConfirm"
715
- ])
716
- ]),
717
- _: 1
718
- }));
719
- }
720
- }), [["__scopeId", "data-v-6c9c90f4"]]), it = {
721
- class: "popup-content",
722
- "data-testid": "dashboard-import-popup"
723
- }, at = { class: "popup-header" }, ot = { class: "popup-body" }, st = { class: "import-mode-selector" }, ct = {
724
- key: 0,
725
- class: "input-group"
726
- }, lt = {
727
- key: 0,
728
- class: "error-message"
729
- }, ut = {
730
- key: 1,
731
- class: "input-group"
732
- }, dt = { class: "url-input-container" }, ft = ["disabled"], pt = {
733
- key: 0,
734
- class: "error-message"
735
- }, mt = {
736
- key: 1,
737
- class: "preview-container"
738
- }, ht = { class: "json-preview" }, gt = { class: "connection-selector" }, _t = { class: "form-row" }, vt = ["value"], yt = {
739
- key: 0,
740
- class: "form-row"
741
- }, bt = {
742
- key: 1,
743
- class: "form-row"
744
- }, xt = { class: "form-row" }, St = { class: "form-row" }, Ct = { class: "form-row" }, wt = { class: "popup-footer" }, Tt = ["disabled"], Et = /*#__PURE__*/ e(/* @__PURE__ */ z({
745
- __name: "DashboardImportPopup",
746
- props: { isOpen: { type: Boolean } },
747
- emits: ["close"],
748
- setup(e, { emit: n }) {
749
- let r = n, i = B("dashboardStore"), a = B("connectionStore"), o = B("saveDashboards"), s = B("saveAll");
750
- if (!i || !a || !o || !s) throw Error("Required stores not provided");
751
- let c = W(""), l = W(""), u = W(null), d = W(!1), f = W(""), p = W("paste"), m = W(null), h = W({
752
- mdToken: "",
753
- projectId: "",
754
- username: "",
755
- password: "",
756
- account: "",
757
- sshPrivateKey: ""
758
- }), g = W(!0);
759
- function _() {
760
- if (!l.value) {
761
- g.value = !1;
762
- return;
763
- }
764
- if (l.value === "new-motherduck" && !h.value.mdToken) {
765
- g.value = !1;
766
- return;
767
- }
768
- if (l.value === "new-bigquery-oauth" && !h.value.projectId) {
769
- g.value = !1;
770
- return;
771
- }
772
- if (l.value === "new-snowflake" && (!h.value.username || !h.value.account || !h.value.sshPrivateKey)) {
773
- g.value = !1;
774
- return;
775
- }
776
- g.value = !0;
777
- }
778
- let v = async () => {
779
- if (!f.value) {
780
- m.value = "Please enter a URL", setTimeout(() => {
781
- m.value = null;
782
- }, 3e3);
783
- return;
784
- }
785
- d.value = !0, m.value = null;
786
- try {
787
- let e = await fetch(f.value);
788
- if (!e.ok) throw Error(`HTTP error! Status: ${e.status}`);
789
- let t = await e.text();
790
- c.value = t, d.value = !1;
791
- } catch (e) {
792
- console.error("Error fetching dashboard:", e), m.value = `Failed to fetch from URL: ${e instanceof Error ? e.message : "Unknown error"}`, d.value = !1, setTimeout(() => {
793
- m.value = null;
794
- }, 5e3);
795
- }
796
- }, y = async () => {
797
- try {
798
- let e = t.fromSerialized(JSON.parse(c.value));
799
- e.storage = "local";
800
- let n = l.value;
801
- if (n.startsWith("new-")) {
802
- let t = n.replace("new-", "");
803
- n = `dashboard-${e.name || "imported"}-connection`, a.connectionByName(n) || a.newConnection(n, t, {
804
- mdToken: h.value.mdToken,
805
- projectId: h.value.projectId,
806
- username: h.value.username,
807
- password: h.value.password,
808
- account: h.value.account,
809
- privateKey: h.value.sshPrivateKey
810
- });
811
- }
812
- let o = a.connectionByName(n);
813
- e.connection = n, o && (e.connectionId = o.id), e.id = Math.random().toString(36).substring(2, 15), i.addDashboard(e), b.value = !0, c.value = "", f.value = "", h.value = {
814
- mdToken: "",
815
- projectId: "",
816
- username: "",
817
- password: "",
818
- account: "",
819
- sshPrivateKey: ""
820
- }, await s(), setTimeout(() => {
821
- b.value = !1, r("close");
822
- }, 1500);
823
- } catch {
824
- u.value = "Invalid JSON format", setTimeout(() => {
825
- u.value = null;
826
- }, 3e3);
827
- }
828
- }, b = W(!1);
829
- return _(), (t, n) => e.isOpen ? (U(), F("div", {
830
- key: 0,
831
- class: "popup-overlay",
832
- onClick: n[11] ||= $((e) => r("close"), ["self"])
833
- }, [I("div", it, [
834
- I("div", at, [n[12] ||= I("h3", null, "Import Dashboard", -1), I("button", {
835
- onClick: n[0] ||= (e) => r("close"),
836
- class: "close-button",
837
- "data-testid": "close-popup-button"
838
- }, " ✕ ")]),
839
- I("div", ot, [
840
- I("div", st, [I("button", {
841
- class: V(["mode-button", { active: p.value === "paste" }]),
842
- onClick: n[1] ||= (e) => p.value = "paste",
843
- "data-testid": "paste-mode-button"
844
- }, " Paste JSON ", 2), I("button", {
845
- class: V(["mode-button", { active: p.value === "url" }]),
846
- onClick: n[2] ||= (e) => p.value = "url",
847
- "data-testid": "url-mode-button"
848
- }, " From URL ", 2)]),
849
- p.value === "paste" ? (U(), F("div", ct, [
850
- n[13] ||= I("label", { for: "dashboard-json" }, "Paste Dashboard JSON", -1),
851
- Q(I("textarea", {
852
- id: "dashboard-json",
853
- "onUpdate:modelValue": n[3] ||= (e) => c.value = e,
854
- placeholder: "Paste your dashboard JSON here",
855
- rows: "16",
856
- class: "dashboard-textarea",
857
- "data-testid": "dashboard-json-input"
858
- }, null, 512), [[Y, c.value]]),
859
- u.value ? (U(), F("div", lt, q(u.value), 1)) : P("", !0)
860
- ])) : P("", !0),
861
- p.value === "url" ? (U(), F("div", ut, [
862
- n[15] ||= I("label", { for: "dashboard-url" }, "Dashboard URL", -1),
863
- I("div", dt, [Q(I("input", {
864
- type: "text",
865
- id: "dashboard-url",
866
- "onUpdate:modelValue": n[4] ||= (e) => f.value = e,
867
- placeholder: "https://example.com/dashboard.json",
868
- class: "url-input",
869
- "data-testid": "dashboard-url-input"
870
- }, null, 512), [[Y, f.value]]), I("button", {
871
- onClick: v,
872
- class: "fetch-button",
873
- disabled: d.value,
874
- "data-testid": "fetch-url-button"
875
- }, q(d.value ? "Loading..." : "Fetch"), 9, ft)]),
876
- m.value ? (U(), F("div", pt, q(m.value), 1)) : P("", !0),
877
- c.value && p.value === "url" ? (U(), F("div", mt, [n[14] ||= I("label", null, "Dashboard JSON Preview", -1), I("div", ht, [I("pre", null, q(c.value.length > 500 ? c.value.substring(0, 500) + "..." : c.value), 1)])])) : P("", !0)
878
- ])) : P("", !0)
879
- ]),
880
- I("div", gt, [
881
- I("div", _t, [n[21] ||= I("label", { for: "connection-select" }, "Assign To Connection", -1), Q(I("select", {
882
- id: "connection-select",
883
- "onUpdate:modelValue": n[5] ||= (e) => l.value = e,
884
- class: "connection-dropdown",
885
- "data-testid": "connection-select",
886
- onChange: _
887
- }, [
888
- n[16] ||= I("option", {
889
- value: "",
890
- disabled: ""
891
- }, "-- Select Connection --", -1),
892
- (U(!0), F(j, null, G(J(a).connections, (e) => (U(), F("option", {
893
- key: e.name,
894
- value: e.name
895
- }, q(e.name), 9, vt))), 128)),
896
- n[17] ||= I("option", { value: "new-duckdb" }, "New DuckDB", -1),
897
- n[18] ||= I("option", { value: "new-motherduck" }, "New MotherDuck", -1),
898
- n[19] ||= I("option", { value: "new-bigquery-oauth" }, "New Bigquery Oauth", -1),
899
- n[20] ||= I("option", { value: "new-snowflake" }, "New Snowflake", -1)
900
- ], 544), [[fe, l.value]])]),
901
- l.value === "new-motherduck" ? (U(), F("div", yt, [n[22] ||= I("label", { for: "md-token" }, "MotherDuck Token", -1), Q(I("input", {
902
- type: "text",
903
- "onUpdate:modelValue": n[6] ||= (e) => h.value.mdToken = e,
904
- id: "md-token",
905
- placeholder: "MotherDuck Token",
906
- class: "connection-input",
907
- onInput: _
908
- }, null, 544), [[
909
- Y,
910
- h.value.mdToken,
911
- void 0,
912
- { trim: !0 }
913
- ]])])) : P("", !0),
914
- l.value === "new-bigquery-oauth" ? (U(), F("div", bt, [n[23] ||= I("label", { for: "project-id" }, "BigQuery Project ID", -1), Q(I("input", {
915
- type: "text",
916
- "onUpdate:modelValue": n[7] ||= (e) => h.value.projectId = e,
917
- id: "project-id",
918
- placeholder: "Billing Project ID",
919
- class: "connection-input",
920
- onInput: _
921
- }, null, 544), [[
922
- Y,
923
- h.value.projectId,
924
- void 0,
925
- { trim: !0 }
926
- ]])])) : P("", !0),
927
- l.value === "new-snowflake" ? (U(), F(j, { key: 2 }, [
928
- I("div", xt, [n[24] ||= I("label", { for: "snowflake-username" }, "Username", -1), Q(I("input", {
929
- type: "text",
930
- "onUpdate:modelValue": n[8] ||= (e) => h.value.username = e,
931
- id: "snowflake-username",
932
- placeholder: "Snowflake Username",
933
- class: "connection-input",
934
- onInput: _
935
- }, null, 544), [[
936
- Y,
937
- h.value.username,
938
- void 0,
939
- { trim: !0 }
940
- ]])]),
941
- I("div", St, [n[25] ||= I("label", { for: "snowflake-account" }, "Account", -1), Q(I("input", {
942
- type: "text",
943
- "onUpdate:modelValue": n[9] ||= (e) => h.value.account = e,
944
- id: "snowflake-account",
945
- placeholder: "Snowflake Account",
946
- class: "connection-input",
947
- onInput: _
948
- }, null, 544), [[
949
- Y,
950
- h.value.account,
951
- void 0,
952
- { trim: !0 }
953
- ]])]),
954
- I("div", Ct, [n[26] ||= I("label", { for: "snowflake-ssh-private-key" }, "Private Key", -1), Q(I("input", {
955
- type: "text",
956
- "onUpdate:modelValue": n[10] ||= (e) => h.value.sshPrivateKey = e,
957
- id: "snowflake-ssh-private-key",
958
- placeholder: "Private Key",
959
- class: "connection-input",
960
- onInput: _
961
- }, null, 544), [[
962
- Y,
963
- h.value.sshPrivateKey,
964
- void 0,
965
- { trim: !0 }
966
- ]])])
967
- ], 64)) : P("", !0)
968
- ]),
969
- I("div", wt, [I("button", {
970
- onClick: y,
971
- class: "copy-button",
972
- "data-testid": "import-dashboard-button",
973
- disabled: !c.value || !l.value || d.value || !g.value
974
- }, q(b.value ? "Imported!" : "Import"), 9, Tt)])
975
- ])])) : P("", !0);
976
- }
977
- }), [["__scopeId", "data-v-3448e3ad"]]), Dt = {
978
- name: "DashboardListItem",
979
- props: {
980
- item: {
981
- type: Object,
982
- required: !0
983
- },
984
- isActive: {
985
- type: Boolean,
986
- default: !1
987
- },
988
- isCollapsed: {
989
- type: Boolean,
990
- default: !1
991
- }
992
- },
993
- emits: [
994
- "click",
995
- "delete",
996
- "clone",
997
- "toggle"
998
- ],
999
- setup(e) {
1000
- let t = B("connectionStore"), n = B("dashboardStore"), r = g();
1001
- if (!t || !n) throw Error("Connection/Dashboard stores is not provided!");
1002
- let i = M(() => e.item.type === "connection" && (e.item.connectionId && t.connections[e.item.connectionId] || t.connectionByName(e.item.label)) || null);
1003
- return {
1004
- isMobile: r,
1005
- dashboardStore: n,
1006
- connectionInfo: i,
1007
- connectionStatus: M(() => {
1008
- let e = i.value;
1009
- return e ? e.running ? "running" : e.connected ? "connected" : "disabled" : "disabled";
1010
- }),
1011
- contextMenuItems: M(() => e.item.type === "connection" ? [{
1012
- id: "new-dashboard",
1013
- label: "New dashboard",
1014
- icon: "mdi-table-plus"
1015
- }] : e.item.type === "investigation" ? [
1016
- {
1017
- id: "promote-investigation",
1018
- label: "Promote to dashboard",
1019
- icon: "mdi-arrow-up-bold"
1020
- },
1021
- {
1022
- id: "clone-dashboard",
1023
- label: "Clone",
1024
- icon: "mdi-content-copy"
1025
- },
1026
- {
1027
- id: "delete-separator",
1028
- kind: "separator"
1029
- },
1030
- {
1031
- id: "delete-dashboard",
1032
- label: "Delete investigation",
1033
- icon: "mdi-trash-can-outline",
1034
- danger: !0
1035
- }
1036
- ] : e.item.type === "dashboard" ? [
1037
- {
1038
- id: "clone-dashboard",
1039
- label: "Clone dashboard",
1040
- icon: "mdi-content-copy"
1041
- },
1042
- {
1043
- id: "delete-separator",
1044
- kind: "separator"
1045
- },
1046
- {
1047
- id: "delete-dashboard",
1048
- label: "Delete dashboard",
1049
- icon: "mdi-trash-can-outline",
1050
- danger: !0
1051
- }
1052
- ] : [])
1053
- };
1054
- },
1055
- methods: {
1056
- handleClick() {
1057
- this.$emit("click", this.item);
1058
- },
1059
- handleToggle() {
1060
- this.$emit("toggle", this.item);
1061
- },
1062
- handleDelete() {
1063
- this.$emit("delete", this.item.dashboard);
1064
- },
1065
- handleClone() {
1066
- this.dashboardStore.cloneDashboard(this.item.id);
1067
- },
1068
- handleContextMenuItemClick(e) {
1069
- switch (e.id) {
1070
- case "new-dashboard": {
1071
- let e = `${this.item.label} Dashboard ${Date.now().toString().slice(-4)}`, t = this.dashboardStore.newDashboard(e, this.item.connectionId || this.item.label);
1072
- this.dashboardStore.setActiveDashboard(t.id);
1073
- break;
1074
- }
1075
- case "clone-dashboard":
1076
- this.handleClone();
1077
- break;
1078
- case "delete-dashboard":
1079
- this.handleDelete();
1080
- break;
1081
- case "promote-investigation":
1082
- this.dashboardStore.promoteDashboard(this.item.id);
1083
- break;
1084
- }
1085
- }
1086
- },
1087
- components: {
1088
- SidebarItem: D,
1089
- Tooltip: m,
1090
- StatusIcon: T,
1091
- SidebarOverflowMenu: ee
1092
- }
1093
- }, Ot = {
1094
- key: 0,
1095
- class: "text-light connection-model"
1096
- }, kt = { class: "dashboard-actions" }, At = ["data-testid"];
1097
- function jt(e, t, n, r, i, a) {
1098
- let o = K("tooltip"), s = K("status-icon"), c = K("sidebar-overflow-menu"), l = K("sidebar-item");
1099
- return n.item.type === "creator" ? (U(), F("div", {
1100
- key: 1,
1101
- "data-testid": `dashboard-list-id-${n.item.key}`,
1102
- class: "creator-item",
1103
- onClick: t[0] ||= (...e) => a.handleClick && a.handleClick(...e)
1104
- }, q(n.item.label), 9, At)) : (U(), N(l, {
1105
- key: 0,
1106
- "item-id": n.item.key,
1107
- name: n.item.label,
1108
- indent: n.item.indent,
1109
- "is-selected": n.isActive,
1110
- "is-collapsible": ![
1111
- "dashboard",
1112
- "investigation",
1113
- "creator"
1114
- ].includes(n.item.type) || n.item.hasInvestigations,
1115
- "is-collapsed": n.isCollapsed,
1116
- itemType: "dashboard",
1117
- onClick: a.handleClick,
1118
- onToggle: a.handleToggle
1119
- }, {
1120
- icon: Z(() => [n.item.type === "investigation" ? (U(), N(o, {
1121
- key: 0,
1122
- content: "Investigation",
1123
- position: "right"
1124
- }, {
1125
- default: Z(() => [...t[1] ||= [I("i", { class: "mdi mdi-source-branch node-icon investigation-icon" }, null, -1)]]),
1126
- _: 1
1127
- })) : n.item.type === "dashboard" ? (U(), N(o, {
1128
- key: 1,
1129
- content: "Dashboard",
1130
- position: "right"
1131
- }, {
1132
- default: Z(() => [...t[2] ||= [I("i", { class: "mdi mdi-view-dashboard node-icon" }, null, -1)]]),
1133
- _: 1
1134
- })) : P("", !0)]),
1135
- name: Z(() => [L(q(n.item.label) + " ", 1), n.item.type === "connection" ? (U(), F("span", Ot, " (" + q(r.connectionInfo?.model ? r.connectionInfo?.model : "No Model Set") + ") ", 1)) : P("", !0)]),
1136
- "extra-content": Z(() => [I("div", kt, [n.item.type === "connection" ? (U(), F(j, { key: 0 }, [R(s, { status: r.connectionStatus }, null, 8, ["status"]), R(c, {
1137
- items: r.contextMenuItems,
1138
- tooltip: "Connection actions",
1139
- onSelect: a.handleContextMenuItemClick
1140
- }, null, 8, ["items", "onSelect"])], 64)) : P("", !0), n.item.type === "dashboard" || n.item.type === "investigation" ? (U(), N(c, {
1141
- key: 1,
1142
- items: r.contextMenuItems,
1143
- tooltip: n.item.type === "investigation" ? "Investigation actions" : "Dashboard actions",
1144
- onSelect: a.handleContextMenuItemClick
1145
- }, null, 8, [
1146
- "items",
1147
- "tooltip",
1148
- "onSelect"
1149
- ])) : P("", !0)])]),
1150
- _: 1
1151
- }, 8, [
1152
- "item-id",
1153
- "name",
1154
- "indent",
1155
- "is-selected",
1156
- "is-collapsible",
1157
- "is-collapsed",
1158
- "onClick",
1159
- "onToggle"
1160
- ]));
1161
- }
1162
- var Mt = /*#__PURE__*/ e(Dt, [["render", jt], ["__scopeId", "data-v-28e46aa7"]]);
1163
- //#endregion
1164
- //#region components/sidebar/DashboardList.vue?vue&type=script&lang.ts
1165
- function Nt(e, t, n) {
1166
- let r = [], i = {}, a = {};
1167
- return e.forEach((e) => {
1168
- if (e.deleted) return;
1169
- if (e.parentDashboardId) {
1170
- a[e.parentDashboardId] || (a[e.parentDashboardId] = []), a[e.parentDashboardId].push(e);
1171
- return;
1172
- }
1173
- let t = e.storage || "local";
1174
- i[t] || (i[t] = []), i[t].push(e);
1175
- }), Object.entries(i).forEach(([e, i]) => {
1176
- let o = `s-${e}`;
1177
- if (r.push({
1178
- type: "storage",
1179
- label: e === "local" ? "Browser Storage" : "Remote Storage",
1180
- key: o,
1181
- id: o,
1182
- indent: 0
1183
- }), !t(o)) {
1184
- let o = {};
1185
- i.forEach((e) => {
1186
- let t = e.connectionId || e.connection || "default";
1187
- o[t] || (o[t] = {
1188
- label: n.connections[t]?.name || e.connection || t,
1189
- dashboards: []
1190
- }), o[t].dashboards.push(e);
1191
- }), Object.entries(o).forEach(([n, i]) => {
1192
- let o = `c-${e}-${n}`;
1193
- r.push({
1194
- type: "connection",
1195
- id: o,
1196
- label: i.label,
1197
- key: o,
1198
- indent: 1,
1199
- connectionId: n
1200
- }), t(o) || i.dashboards.forEach((e) => {
1201
- let n = (a[e.id] || []).length > 0, i = `d-${e.id}`;
1202
- r.push({
1203
- type: "dashboard",
1204
- label: e.name,
1205
- id: e.id,
1206
- key: i,
1207
- indent: 2,
1208
- dashboard: e,
1209
- hasInvestigations: n
1210
- }), n && !t(i) && a[e.id].forEach((e) => {
1211
- r.push({
1212
- type: "investigation",
1213
- label: e.investigationName || e.name,
1214
- id: e.id,
1215
- key: `i-${e.id}`,
1216
- indent: 3,
1217
- dashboard: e
1218
- });
1219
- });
1220
- });
1221
- });
1222
- }
1223
- }), r;
1224
- }
1225
- var Pt = {
1226
- name: "DashboardList",
1227
- props: {
1228
- activeDashboardKey: String,
1229
- testTag: {
1230
- type: String,
1231
- default: ""
1232
- }
1233
- },
1234
- setup(e) {
1235
- let t = B("dashboardStore"), n = B("connectionStore"), r = B("chatStore", null), i = B("saveDashboards");
1236
- if (!t || !n || !i) throw Error("Dashboard or connection store is not provided!");
1237
- let a = W(!1), o = W(!1), s = g(), c = W(null), l = W(!0), u = d(f.DASHBOARD) || "", p = (e) => {
1238
- let t = e.storage || "local", n = e.connectionId || e.connection || "default";
1239
- return [`s-${t}`, `c-${t}-${n}`];
1240
- }, m = M(() => {
1241
- let n = Object.values(t.dashboards).filter((e) => !e.deleted), r = e.activeDashboardKey || u, i = r ? n.find((e) => e.id === r) : void 0;
1242
- if (i) return new Set(p(i));
1243
- let a = new Set(n.map((e) => `s-${e.storage || "local"}`));
1244
- return a.size === 1 ? a : /* @__PURE__ */ new Set();
1245
- }), { overrides: h, isCollapsed: _, toggle: v } = A((e) => e.startsWith("d-") || m.value.has(e)), y = M(() => Nt(Object.values(t.dashboards), _, n)), { isOpen: b, openConfirmation: x, closeConfirmation: S, confirm: C } = ae((e) => {
1246
- r && e.chatId && r.chats[e.chatId] && r.removeChat(e.chatId), e.delete();
1247
- });
1248
- return {
1249
- connectionStore: n,
1250
- dashboardStore: t,
1251
- contentList: y,
1252
- toggleCollapse: v,
1253
- collapsed: h,
1254
- isCollapsed: _,
1255
- creatorVisible: a,
1256
- importPopupVisible: o,
1257
- saveDashboards: i,
1258
- showDeleteConfirmationState: b,
1259
- showDeleteConfirmation: x,
1260
- cancelDelete: S,
1261
- confirmDelete: C,
1262
- isMobile: s,
1263
- mobileTree: c,
1264
- mobileTreeAtRoot: l
1265
- };
1266
- },
1267
- methods: {
1268
- dashboardCreated(e) {
1269
- console.log("Dashboard created event received:", e), this.$emit("dashboard-key-selected", e);
1270
- },
1271
- clickAction(e) {
1272
- e.type === "dashboard" || e.type === "investigation" ? this.$emit("dashboard-key-selected", e.id) : this.toggleCollapse(e.key);
1273
- },
1274
- isDashboardBranch(e) {
1275
- return ["storage", "connection"].includes(e.type) || e.type === "dashboard" && e.hasInvestigations;
1276
- },
1277
- expandMobileBranch(e) {
1278
- this.isCollapsed(e.key) && this.toggleCollapse(e.key);
1279
- },
1280
- selectMobileItem(e) {
1281
- this.clickAction(e);
1282
- },
1283
- handleDashboardTreeClick(e) {
1284
- this.isMobile ? this.$refs.mobileTree?.openItem(e) : this.clickAction(e);
1285
- },
1286
- handleDashboardTreeToggle(e) {
1287
- this.isMobile ? this.$refs.mobileTree?.openItem(e) : this.toggleCollapse(e.key);
1288
- }
1289
- },
1290
- components: {
1291
- DashboardCreatorInline: v,
1292
- DashboardImportPopup: Et,
1293
- DashboardListItem: Mt,
1294
- SidebarList: O,
1295
- LoadingButton: h,
1296
- ConfirmDialog: S,
1297
- MobileTreeList: k
1298
- }
1299
- }, Ft = { class: "dashboards-header" }, It = {
1300
- key: 0,
1301
- class: "font-sans sidebar-header"
1302
- }, Lt = ["data-testid"], Rt = {
1303
- key: 0,
1304
- class: "button-container"
1305
- };
1306
- function zt(e, t, n, r, i, a) {
1307
- let o = K("dashboard-creator-inline"), s = K("dashboard-import-popup"), c = K("dashboard-list-item"), l = K("mobile-tree-list"), u = K("ConfirmDialog"), d = K("sidebar-list");
1308
- return U(), N(d, { title: "Dashboards" }, {
1309
- header: Z(() => [I("div", Ft, [r.isMobile ? P("", !0) : (U(), F("h3", It, "Dashboards")), I("button", {
1310
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create",
1311
- onClick: t[0] ||= (e) => r.creatorVisible = !r.creatorVisible,
1312
- "data-testid": n.testTag ? `dashboard-creator-add-${n.testTag}` : "dashboard-creator-add"
1313
- }, [t[5] ||= I("i", { class: "mdi mdi-plus" }, null, -1), L(" " + q(r.creatorVisible ? "Close" : "New"), 1)], 8, Lt)])]),
1314
- actions: Z(() => [
1315
- !r.isMobile || r.mobileTreeAtRoot ? (U(), F("div", Rt, [I("button", {
1316
- class: "sidebar-control-button sidebar-header-action",
1317
- onClick: t[1] ||= (e) => r.importPopupVisible = !0,
1318
- "data-testid": "dashboard-import-button"
1319
- }, " Import ")])) : P("", !0),
1320
- R(o, {
1321
- visible: r.creatorVisible,
1322
- onClose: t[2] ||= (e) => r.creatorVisible = !r.creatorVisible,
1323
- testTag: n.testTag,
1324
- onDashboardCreated: a.dashboardCreated
1325
- }, null, 8, [
1326
- "visible",
1327
- "testTag",
1328
- "onDashboardCreated"
1329
- ]),
1330
- R(s, {
1331
- isOpen: r.importPopupVisible,
1332
- onClose: t[3] ||= (e) => r.importPopupVisible = !1
1333
- }, null, 8, ["isOpen"])
1334
- ]),
1335
- default: Z(() => [R(l, {
1336
- "list-id": "dashboards",
1337
- ref: "mobileTree",
1338
- items: r.contentList,
1339
- "id-field": "key",
1340
- "label-field": "label",
1341
- enabled: r.isMobile,
1342
- "is-branch": a.isDashboardBranch,
1343
- "is-selectable": (e) => e.type === "dashboard",
1344
- onExpand: a.expandMobileBranch,
1345
- onSelect: a.selectMobileItem,
1346
- onViewChange: t[4] ||= (e) => r.mobileTreeAtRoot = e
1347
- }, {
1348
- item: Z(({ item: e }) => [(U(), N(c, {
1349
- key: e.key,
1350
- item: e,
1351
- "is-active": n.activeDashboardKey === e.id,
1352
- "is-collapsed": r.isCollapsed(e.key),
1353
- onClick: (t) => a.handleDashboardTreeClick(e),
1354
- onToggle: (t) => a.handleDashboardTreeToggle(e),
1355
- onDelete: r.showDeleteConfirmation
1356
- }, null, 8, [
1357
- "item",
1358
- "is-active",
1359
- "is-collapsed",
1360
- "onClick",
1361
- "onToggle",
1362
- "onDelete"
1363
- ]))]),
1364
- _: 1
1365
- }, 8, [
1366
- "items",
1367
- "enabled",
1368
- "is-branch",
1369
- "is-selectable",
1370
- "onExpand",
1371
- "onSelect"
1372
- ]), R(u, {
1373
- show: r.showDeleteConfirmationState,
1374
- title: "Confirm Deletion",
1375
- message: "Are you sure you want to delete this dashboard? Contents cannot be recovered.",
1376
- "confirm-label": "Delete",
1377
- "cancel-test-id": "cancel-dashboard-deletion",
1378
- "confirm-test-id": "confirm-dashboard-deletion",
1379
- onClose: r.cancelDelete,
1380
- onConfirm: r.confirmDelete
1381
- }, null, 8, [
1382
- "show",
1383
- "onClose",
1384
- "onConfirm"
1385
- ])]),
1386
- _: 1
1387
- });
1388
- }
1389
- var Bt = /*#__PURE__*/ e(Pt, [["render", zt], ["__scopeId", "data-v-04081e74"]]), Vt = {
1390
- key: 0,
1391
- class: "mdi mdi-source-repository sidebar-icon"
1392
- }, Ht = {
1393
- key: 1,
1394
- class: "right-pad"
1395
- }, Ut = {
1396
- key: 0,
1397
- class: "tag-container"
1398
- }, Wt = {
1399
- key: 1,
1400
- class: "tag-container hover-icon"
1401
- }, Gt = {
1402
- key: 2,
1403
- class: "tag-container"
1404
- }, Kt = ["data-testid"], qt = /*#__PURE__*/ e(/* @__PURE__ */ z({
1405
- __name: "CommunityModelListItem",
1406
- props: {
1407
- item: {},
1408
- activeModel: { default: "" },
1409
- isCollapsed: {
1410
- type: Boolean,
1411
- default: !1
1412
- },
1413
- isMobile: {
1414
- type: Boolean,
1415
- default: !1
1416
- },
1417
- mobileTreeMode: {
1418
- type: Boolean,
1419
- default: !1
1420
- }
1421
- },
1422
- emits: [
1423
- "item-click",
1424
- "model-selected",
1425
- "model-details",
1426
- "item-toggle",
1427
- "delete-store",
1428
- "mobile-item-click"
1429
- ],
1430
- setup(e, { emit: t }) {
1431
- let n = e, r = t, i = c(), a = () => {
1432
- if (n.mobileTreeMode) {
1433
- r("mobile-item-click", n.item);
1434
- return;
1435
- }
1436
- n.item.type === "model" ? r("model-selected", n.item.model, n.item.key, n.item.modelRoot) : r("item-click", n.item.type, n.item.key, n.item.modelRoot);
1437
- }, s = () => {
1438
- ["model"].includes(n.item.type) || r("item-toggle", n.item.type, n.item.key, n.item.modelRoot);
1439
- }, l = () => "", u = (e) => e.id === o.id, d = (e) => i.getStoreStatus(e.id), f = (e) => {
1440
- let t = i.errors[e.id];
1441
- if (t) return `Connection failed: ${t}`;
1442
- if (i.getStoreStatus(e.id) === "connected") return "Connected";
1443
- };
1444
- return (t, n) => (U(), N(D, {
1445
- "item-id": e.item.key,
1446
- name: e.item.label,
1447
- indent: e.item.indent,
1448
- "is-selected": e.activeModel === e.item.key,
1449
- "is-collapsible": !["model"].includes(e.item.type),
1450
- "is-collapsed": e.isCollapsed,
1451
- icon: l(),
1452
- itemType: "community",
1453
- onClick: a,
1454
- onToggle: s
1455
- }, {
1456
- icon: Z(() => [e.item.type === "root" ? (U(), F("i", Vt)) : e.item.type === "engine" ? (U(), F("span", Ht, [R(te, { "connection-type": e.item.label }, null, 8, ["connection-type"])])) : P("", !0)]),
1457
- "extra-content": Z(() => [e.item.type === "model" ? (U(), F("span", Ut, [(U(!0), F(j, null, G(e.item.model?.tags || [], (e) => (U(), N(ne, {
1458
- key: e,
1459
- label: e
1460
- }, null, 8, ["label"]))), 128))])) : e.item.type === "engine" ? (U(), F("span", Wt)) : e.item.type === "root" ? (U(), F("span", Gt, [e.item.store && !u(e.item.store) ? (U(), N(m, {
1461
- key: 0,
1462
- content: "Remove Store",
1463
- position: "left"
1464
- }, {
1465
- default: Z(() => [I("span", {
1466
- class: "remove-btn hover-icon sidebar-icon-button danger",
1467
- onClick: n[0] ||= $((t) => r("delete-store", e.item.store), ["stop"]),
1468
- "data-testid": `delete-store-${e.item.store.id}`
1469
- }, [...n[1] ||= [I("i", { class: "mdi mdi-trash-can-outline" }, null, -1)]], 8, Kt)]),
1470
- _: 1
1471
- })) : P("", !0), e.item.store ? (U(), N(T, {
1472
- key: 1,
1473
- status: d(e.item.store),
1474
- message: f(e.item.store),
1475
- "test-name": e.item.store.id
1476
- }, null, 8, [
1477
- "status",
1478
- "message",
1479
- "test-name"
1480
- ])) : P("", !0)])) : P("", !0)]),
1481
- _: 1
1482
- }, 8, [
1483
- "item-id",
1484
- "name",
1485
- "indent",
1486
- "is-selected",
1487
- "is-collapsible",
1488
- "is-collapsed",
1489
- "icon"
1490
- ]));
1491
- }
1492
- }), [["__scopeId", "data-v-4383ee4e"]]), Jt = {
1493
- name: "AddStoreModal",
1494
- components: { ModalDialog: p },
1495
- props: {
1496
- show: {
1497
- type: Boolean,
1498
- required: !0
1499
- },
1500
- loading: {
1501
- type: Boolean,
1502
- default: !1
1503
- }
1504
- },
1505
- emits: ["close", "add"],
1506
- setup(e, { emit: t }) {
1507
- let n = W("generic"), r = W(""), i = W(""), a = W(""), o = W(""), c = W("main"), d = W(null), f = W(!1), p = M(() => {
1508
- let e = typeof window < "u" ? `${window.location.origin}${window.location.pathname}` : "";
1509
- return e ? `trilogy serve . --studio-url ${e}` : "trilogy serve .";
1510
- });
1511
- return pe(() => e.show, (e) => {
1512
- e && (n.value = "generic", r.value = "", i.value = "", a.value = "", o.value = "", c.value = "main", d.value = null, f.value = !1);
1513
- }), {
1514
- storeType: n,
1515
- storeName: r,
1516
- baseUrl: i,
1517
- owner: a,
1518
- repo: o,
1519
- branch: c,
1520
- error: d,
1521
- handleSubmit: async () => {
1522
- d.value = null;
1523
- try {
1524
- if (n.value === "generic") {
1525
- if (!i.value) {
1526
- d.value = "Please fill in all required fields";
1527
- return;
1528
- }
1529
- let e = u(i.value);
1530
- t("add", {
1531
- type: "generic",
1532
- id: l(e),
1533
- name: r.value || s(e),
1534
- baseUrl: e
1535
- });
1536
- } else {
1537
- if (!r.value || !a.value || !o.value || !c.value) {
1538
- d.value = "Please fill in all required fields";
1539
- return;
1540
- }
1541
- t("add", {
1542
- type: "github",
1543
- id: `${a.value}-${o.value}-${c.value}`,
1544
- name: r.value,
1545
- owner: a.value,
1546
- repo: o.value,
1547
- branch: c.value
1548
- });
1549
- }
1550
- } catch (e) {
1551
- d.value = e instanceof Error ? e.message : "Failed to add store";
1552
- }
1553
- },
1554
- serveCommand: p,
1555
- copyServeCommand: async () => {
1556
- try {
1557
- await navigator.clipboard.writeText(p.value), f.value = !0, setTimeout(() => {
1558
- f.value = !1;
1559
- }, 2e3);
1560
- } catch (e) {
1561
- console.error("Failed to copy serve command:", e);
1562
- }
1563
- },
1564
- copiedCommand: f
1565
- };
1566
- }
1567
- }, Yt = { class: "form-group" }, Xt = { class: "form-group" }, Zt = { class: "form-group" }, Qt = {
1568
- class: "cli-tip",
1569
- "data-testid": "add-store-cli-tip"
1570
- }, $t = { class: "cli-tip-command" }, en = { "data-testid": "add-store-cli-command" }, tn = ["title"], nn = { class: "form-group" }, rn = { class: "form-group" }, an = { class: "form-group" }, on = { class: "form-group" }, sn = {
1571
- key: 2,
1572
- class: "form-error",
1573
- "data-testid": "add-store-error"
1574
- }, cn = { class: "dialog-actions" }, ln = ["disabled"];
1575
- function un(e, t, n, r, i, a) {
1576
- let o = K("ModalDialog");
1577
- return U(), N(o, {
1578
- show: n.show,
1579
- title: "Add Model Store",
1580
- "test-id": "add-store-modal",
1581
- onClose: t[10] ||= (t) => e.$emit("close")
1582
- }, {
1583
- default: Z(() => [I("form", { onSubmit: t[9] ||= $((...e) => r.handleSubmit && r.handleSubmit(...e), ["prevent"]) }, [
1584
- I("div", Yt, [t[12] ||= I("label", null, [L("Store Type: "), I("span", { class: "required" }, "*")], -1), Q(I("select", {
1585
- "onUpdate:modelValue": t[0] ||= (e) => r.storeType = e,
1586
- "data-testid": "store-type-select"
1587
- }, [...t[11] ||= [I("option", { value: "generic" }, "Generic", -1), I("option", { value: "github" }, "GitHub Repository", -1)]], 512), [[fe, r.storeType]])]),
1588
- r.storeType === "generic" ? (U(), F(j, { key: 0 }, [
1589
- I("div", Xt, [t[13] ||= I("label", null, "Store Name:", -1), Q(I("input", {
1590
- "onUpdate:modelValue": t[1] ||= (e) => r.storeName = e,
1591
- type: "text",
1592
- placeholder: "Optional, defaults to the store URL",
1593
- "data-testid": "store-name-input"
1594
- }, null, 512), [[Y, r.storeName]])]),
1595
- I("div", Zt, [
1596
- t[14] ||= I("label", null, [L("Base URL: "), I("span", { class: "required" }, "*")], -1),
1597
- Q(I("input", {
1598
- "onUpdate:modelValue": t[2] ||= (e) => r.baseUrl = e,
1599
- type: "url",
1600
- placeholder: "e.g., http://localhost:8100",
1601
- "data-testid": "store-url-input",
1602
- required: ""
1603
- }, null, 512), [[Y, r.baseUrl]]),
1604
- t[15] ||= I("small", null, "URL should serve an index.json file at /index.json", -1)
1605
- ]),
1606
- I("div", Qt, [
1607
- t[16] ||= I("div", { class: "cli-tip-title" }, [I("i", { class: "mdi mdi-lightbulb-on" }), L(" Serving a local model? ")], -1),
1608
- t[17] ||= I("p", { class: "cli-tip-body" }, " Run this in your model directory. The Trilogy CLI serves it over HTTP and prints a link that opens the model back in this studio. ", -1),
1609
- I("div", $t, [I("code", en, q(r.serveCommand), 1), I("button", {
1610
- type: "button",
1611
- class: "cli-tip-copy",
1612
- title: r.copiedCommand ? "Copied" : "Copy command",
1613
- "data-testid": "add-store-cli-copy",
1614
- onClick: t[3] ||= (...e) => r.copyServeCommand && r.copyServeCommand(...e)
1615
- }, [I("i", { class: V(["mdi", r.copiedCommand ? "mdi-check" : "mdi-content-copy"]) }, null, 2)], 8, tn)]),
1616
- t[18] ||= I("small", null, "Then paste the URL it prints above, or just follow the link.", -1)
1617
- ])
1618
- ], 64)) : P("", !0),
1619
- r.storeType === "github" ? (U(), F(j, { key: 1 }, [
1620
- I("div", nn, [t[19] ||= I("label", null, [L("Display Name: "), I("span", { class: "required" }, "*")], -1), Q(I("input", {
1621
- "onUpdate:modelValue": t[4] ||= (e) => r.storeName = e,
1622
- type: "text",
1623
- placeholder: "e.g., My Custom Models",
1624
- "data-testid": "store-name-input",
1625
- required: ""
1626
- }, null, 512), [[Y, r.storeName]])]),
1627
- I("div", rn, [t[20] ||= I("label", null, [L("Repository Owner: "), I("span", { class: "required" }, "*")], -1), Q(I("input", {
1628
- "onUpdate:modelValue": t[5] ||= (e) => r.owner = e,
1629
- type: "text",
1630
- placeholder: "e.g., trilogy-data",
1631
- "data-testid": "github-owner-input",
1632
- required: ""
1633
- }, null, 512), [[Y, r.owner]])]),
1634
- I("div", an, [t[21] ||= I("label", null, [L("Repository Name: "), I("span", { class: "required" }, "*")], -1), Q(I("input", {
1635
- "onUpdate:modelValue": t[6] ||= (e) => r.repo = e,
1636
- type: "text",
1637
- placeholder: "e.g., trilogy-public-models",
1638
- "data-testid": "github-repo-input",
1639
- required: ""
1640
- }, null, 512), [[Y, r.repo]])]),
1641
- I("div", on, [t[22] ||= I("label", null, [L("Branch: "), I("span", { class: "required" }, "*")], -1), Q(I("input", {
1642
- "onUpdate:modelValue": t[7] ||= (e) => r.branch = e,
1643
- type: "text",
1644
- placeholder: "e.g., main",
1645
- "data-testid": "github-branch-input",
1646
- required: ""
1647
- }, null, 512), [[Y, r.branch]])])
1648
- ], 64)) : P("", !0),
1649
- r.error ? (U(), F("div", sn, q(r.error), 1)) : P("", !0),
1650
- I("div", cn, [I("button", {
1651
- type: "button",
1652
- class: "cancel-btn",
1653
- "data-testid": "add-store-cancel",
1654
- onClick: t[8] ||= (t) => e.$emit("close")
1655
- }, " Cancel "), I("button", {
1656
- type: "submit",
1657
- class: "confirm-btn",
1658
- "data-testid": "add-store-submit",
1659
- disabled: n.loading
1660
- }, q(n.loading ? "Adding..." : "Add Store"), 9, ln)])
1661
- ], 32)]),
1662
- _: 1
1663
- }, 8, ["show"]);
1664
- }
1665
- var dn = /*#__PURE__*/ e(Jt, [["render", un], ["__scopeId", "data-v-10959a43"]]), fn = (e, t = [], n = {}) => {
1666
- let r = [];
1667
- return t.forEach((t) => {
1668
- let i = t.id, a = t.name, o = {
1669
- owner: t.type === "github" ? t.owner : "",
1670
- repo: t.type === "github" ? t.repo : "",
1671
- branch: t.type === "github" ? t.branch : "main",
1672
- displayName: a
1673
- };
1674
- if (r.push({
1675
- type: "root",
1676
- label: a,
1677
- key: i,
1678
- indent: 0,
1679
- modelRoot: o,
1680
- store: t
1681
- }), !e(i)) {
1682
- let a = n[i] || [], s = {};
1683
- a.forEach((e) => {
1684
- s[e.engine] || (s[e.engine] = []), s[e.engine].push(e);
1685
- }), Object.keys(s).sort().forEach((n) => {
1686
- let a = `${i}+${n}`;
1687
- r.push({
1688
- type: "engine",
1689
- label: n,
1690
- key: a,
1691
- indent: 1,
1692
- modelRoot: o,
1693
- store: t
1694
- }), e(a) || s[n].forEach((e) => {
1695
- r.push({
1696
- type: "model",
1697
- label: e.name,
1698
- key: `${a}+${e.name}`,
1699
- indent: 2,
1700
- model: e,
1701
- modelRoot: o,
1702
- store: t
1703
- });
1704
- });
1705
- });
1706
- }
1707
- }), r;
1708
- }, pn = z({
1709
- name: "CommunityModelList",
1710
- setup() {
1711
- let e = c(), t = n(), r = B("editorStore"), i = B("connectionStore"), a = B("modelStore"), o = g(), s = W(null), l = t.activeCommunityModelKey.value || "", u = M(() => {
1712
- if (l) {
1713
- let [e, t] = l.split("+");
1714
- return new Set(t ? [e, `${e}+${t}`] : [e]);
1715
- }
1716
- let t = e.stores;
1717
- return t.length === 1 ? /* @__PURE__ */ new Set([t[0].id]) : /* @__PURE__ */ new Set();
1718
- }), { overrides: d, isCollapsed: f, toggle: p, open: m } = A((e) => u.value.has(e)), h = async (t) => {
1719
- try {
1720
- await e.addStore(t), e.closeAddStoreModal();
1721
- } catch (e) {
1722
- console.error("Failed to add store:", e);
1723
- }
1724
- }, { isOpen: _, openConfirmation: v, closeConfirmation: y, confirm: b } = ae((t) => {
1725
- t.type === "generic" && r && i && a && C(t.id, r, i, a), e.removeStore(t.id);
1726
- }), x = (e, n, r) => {
1727
- t.openTab("community-models", e.name, n), console.log("Selected model:", e.name, "from root:", r);
1728
- }, S = (e, n, r) => {
1729
- m(n), t.openTab("community-models", null, n);
1730
- }, w = (e, t, n) => {
1731
- p(t);
1732
- }, T = M(() => fn(f, e.stores, e.filesByStore));
1733
- return H(async () => {
1734
- await e.initialize();
1735
- }), {
1736
- communityStore: e,
1737
- navigationStore: t,
1738
- handleAddStoreSubmit: h,
1739
- showDeleteStoreConfirmation: v,
1740
- cancelDeleteStore: y,
1741
- confirmDeleteStore: b,
1742
- showDeleteConfirmationState: _,
1743
- handleModelSelected: x,
1744
- handleItemClick: S,
1745
- handleItemToggle: w,
1746
- collapsed: d,
1747
- isCollapsed: f,
1748
- displayTree: T,
1749
- isMobile: o,
1750
- mobileTree: s,
1751
- isCommunityBranch: (e) => ["root", "engine"].includes(e.type),
1752
- expandMobileBranch: (e) => {
1753
- f(e.key) && m(e.key);
1754
- },
1755
- selectMobileItem: (e) => {
1756
- e.type === "model" ? x(e.model, e.key, e.modelRoot) : S(e.type, e.key, e.modelRoot);
1757
- },
1758
- handleMobileItemClick: (e) => s.value?.openItem(e)
1759
- };
1760
- },
1761
- components: {
1762
- SidebarList: O,
1763
- CommunityModelListItem: qt,
1764
- AddStoreModal: dn,
1765
- ConfirmDialog: S,
1766
- MobileTreeList: k
1767
- }
1768
- }), mn = { class: "community-header" }, hn = { class: "button-container" }, gn = ["disabled"], _n = {
1769
- key: 0,
1770
- class: "error-container"
1771
- }, vn = { class: "error-text" }, yn = ["onClick"];
1772
- function bn(e, t, n, r, i, a) {
1773
- let o = K("CommunityModelListItem"), s = K("mobile-tree-list"), c = K("AddStoreModal"), l = K("ConfirmDialog"), u = K("sidebar-list");
1774
- return U(), N(u, { title: "External Models" }, {
1775
- header: Z(() => [I("div", mn, [t[4] ||= I("h3", { class: "font-sans sidebar-header" }, "External Models", -1), I("button", {
1776
- class: "sidebar-control-button sidebar-header-action sidebar-primary-create",
1777
- onClick: t[0] ||= (t) => e.communityStore.openAddStoreModal(),
1778
- "data-testid": "community-store-add"
1779
- }, [...t[3] ||= [I("i", { class: "mdi mdi-plus" }, null, -1), L(" New ", -1)]])])]),
1780
- actions: Z(() => [I("div", hn, [I("button", {
1781
- class: "sidebar-control-button sidebar-header-action",
1782
- onClick: t[1] ||= (t) => e.communityStore.refreshData(),
1783
- disabled: e.communityStore.loading,
1784
- "data-testid": "community-store-refresh"
1785
- }, [t[5] ||= I("i", { class: "mdi mdi-refresh" }, null, -1), L(" " + q(e.communityStore.loading ? "Refreshing" : "Refresh"), 1)], 8, gn)])]),
1786
- default: Z(() => [
1787
- e.communityStore.hasErrors ? (U(), F("div", _n, [(U(!0), F(j, null, G(e.communityStore.errorList, (t) => (U(), F("div", {
1788
- key: t.root,
1789
- class: "error-item"
1790
- }, [I("span", vn, q(t.name) + ": " + q(t.error), 1), I("button", {
1791
- onClick: (n) => e.communityStore.clearStoreError(t.root),
1792
- class: "clear-error"
1793
- }, "×", 8, yn)]))), 128))])) : P("", !0),
1794
- R(s, {
1795
- "list-id": "community",
1796
- ref: "mobileTree",
1797
- items: e.displayTree,
1798
- "id-field": "key",
1799
- "label-field": "label",
1800
- enabled: e.isMobile,
1801
- "is-branch": e.isCommunityBranch,
1802
- "is-selectable": e.isCommunityBranch,
1803
- onExpand: e.expandMobileBranch,
1804
- onSelect: e.selectMobileItem
1805
- }, {
1806
- item: Z(({ item: t }) => [(U(), N(o, {
1807
- key: t.key,
1808
- item: t,
1809
- "mobile-tree-mode": e.isMobile,
1810
- "is-collapsed": e.isCollapsed(t.key),
1811
- "active-model": e.navigationStore.activeCommunityModelKey.value,
1812
- onItemClick: e.handleItemClick,
1813
- onItemToggle: e.handleItemToggle,
1814
- onModelSelected: e.handleModelSelected,
1815
- onDeleteStore: e.showDeleteStoreConfirmation,
1816
- onMobileItemClick: e.handleMobileItemClick
1817
- }, null, 8, [
1818
- "item",
1819
- "mobile-tree-mode",
1820
- "is-collapsed",
1821
- "active-model",
1822
- "onItemClick",
1823
- "onItemToggle",
1824
- "onModelSelected",
1825
- "onDeleteStore",
1826
- "onMobileItemClick"
1827
- ]))]),
1828
- _: 1
1829
- }, 8, [
1830
- "items",
1831
- "enabled",
1832
- "is-branch",
1833
- "is-selectable",
1834
- "onExpand",
1835
- "onSelect"
1836
- ]),
1837
- R(c, {
1838
- show: e.communityStore.showAddStoreModal,
1839
- loading: e.communityStore.addingStore,
1840
- onClose: t[2] ||= (t) => e.communityStore.closeAddStoreModal(),
1841
- onAdd: e.handleAddStoreSubmit
1842
- }, null, 8, [
1843
- "show",
1844
- "loading",
1845
- "onAdd"
1846
- ]),
1847
- R(l, {
1848
- show: e.showDeleteConfirmationState,
1849
- title: "Confirm Store Removal",
1850
- message: "Are you sure you want to remove this store? This will not delete any imported models.",
1851
- "confirm-label": "Remove",
1852
- "cancel-test-id": "cancel-store-deletion",
1853
- "confirm-test-id": "confirm-store-deletion",
1854
- onClose: e.cancelDeleteStore,
1855
- onConfirm: e.confirmDeleteStore
1856
- }, null, 8, [
1857
- "show",
1858
- "onClose",
1859
- "onConfirm"
1860
- ])
1861
- ]),
1862
- _: 1
1863
- });
1864
- }
1865
- var xn = /*#__PURE__*/ e(pn, [["render", bn], ["__scopeId", "data-v-46a284c6"]]), Sn = {
1866
- editors: () => Promise.all([import("./Editor-DhsP18KE.js").then((e) => e.n), import("./ResultComponent-_-1qZCfv.js").then((e) => e.n)]),
1867
- connections: () => import("./ConnectionView-COnTTuA4.js").then((e) => e.n),
1868
- llms: () => import("./LLMView-VkJpP-49.js"),
1869
- dashboard: () => import("./Dashboard-D1ZCTw5r.js").then((e) => e.n),
1870
- models: () => import("./ModelView-rAurf9n8.js").then((e) => e.n),
1871
- "community-models": () => import("./CommunityModels-D7zWnHgG.js").then((e) => e.n),
1872
- jobs: () => import("./JobsView-C9PYS6pZ.js").then((e) => e.n),
1873
- tutorial: () => import("./TutorialPage-CZGBRJdq.js")
1874
- }, Cn = /* @__PURE__ */ new Set();
1875
- function wn(e) {
1876
- if (Cn.has(e)) return;
1877
- let t = Sn[e];
1878
- t && (Cn.add(e), t().catch(() => {
1879
- Cn.delete(e);
1880
- }));
1881
- }
1882
- function Tn(e = 3e3) {
1883
- if (typeof window > "u") return;
1884
- let t = () => Object.keys(Sn).forEach(wn);
1885
- window.setTimeout(() => {
1886
- "requestIdleCallback" in window ? window.requestIdleCallback(() => t(), { timeout: 1e4 }) : t();
1887
- }, e);
1888
- }
1889
- //#endregion
1890
- //#region components/sidebar/Sidebar.vue?vue&type=script&lang.ts
1891
- var En = z({
1892
- name: "Sidebar",
1893
- props: {
1894
- active: {
1895
- type: String,
1896
- default: ""
1897
- },
1898
- activeEditor: {
1899
- type: String,
1900
- default: ""
1901
- },
1902
- activeModelKey: {
1903
- type: String,
1904
- default: ""
1905
- },
1906
- activeDocumentationKey: {
1907
- type: String,
1908
- default: ""
1909
- },
1910
- activeConnectionKey: {
1911
- type: String,
1912
- default: ""
1913
- },
1914
- activeJobsKey: {
1915
- type: String,
1916
- default: ""
1917
- },
1918
- activeLLMKey: {
1919
- type: String,
1920
- default: ""
1921
- },
1922
- activeDashboardKey: {
1923
- type: String,
1924
- default: ""
1925
- },
1926
- containerWidth: {
1927
- type: Number,
1928
- default: 200
1929
- }
1930
- },
1931
- setup() {
1932
- let e = W(!1), t = W(null), n = g(), r = i(), a = y(), o = B("chatStore", null);
1933
- return {
1934
- llmConnectionStore: B("llmConnectionStore", null),
1935
- isSaving: e,
1936
- previousUnSaved: t,
1937
- isMobile: n,
1938
- mobileNavigation: r,
1939
- globalChatPanel: a,
1940
- chatStore: o
1941
- };
1942
- },
1943
- data() {
1944
- let e = [
1945
- {
1946
- name: "dashboard",
1947
- tooltip: "Chart",
1948
- icon: "mdi mdi-chart-multiple",
1949
- screen: "dashboard"
1950
- },
1951
- {
1952
- name: "models",
1953
- tooltip: "Model",
1954
- icon: "mdi mdi-set-center",
1955
- screen: "models",
1956
- searchLabel: "concepts"
1957
- },
1958
- {
1959
- name: "community-models",
1960
- tooltip: "Share & Explore",
1961
- icon: "mdi mdi-library-outline",
1962
- screen: "community-models"
1963
- },
1964
- {
1965
- name: "jobs",
1966
- tooltip: "Jobs",
1967
- icon: "mdi mdi-playlist-play",
1968
- screen: "jobs"
1969
- },
1970
- {
1971
- name: "help",
1972
- tooltip: "Help",
1973
- icon: "mdi mdi-help",
1974
- screen: "tutorial"
1975
- }
1976
- ], t = [
1977
- {
1978
- name: "edit",
1979
- tooltip: "Query",
1980
- icon: "mdi mdi-file-document-edit-outline",
1981
- screen: "editors",
1982
- searchLabel: "queries"
1983
- },
1984
- {
1985
- name: "database",
1986
- tooltip: "Connect",
1987
- icon: "mdi mdi-database-outline",
1988
- screen: "connections"
1989
- },
1990
- {
1991
- name: "llm",
1992
- tooltip: "AI",
1993
- icon: "mdi mdi-creation-outline",
1994
- screen: "llms"
1995
- }
1996
- ], n = B("saveAll"), r = B("unSaved") || 0;
1997
- if (!n) throw Error("saveAll is not provided");
1998
- return {
1999
- trilogyIcon: _,
2000
- sidebarItems: t,
2001
- sidebarFeatureItems: e,
2002
- unSaved: r,
2003
- saveAll: n,
2004
- contentCollapsed: !1,
2005
- mobileDetailScrollPositions: {},
2006
- mobileSearchQueries: {},
2007
- mobileSearchQuery: ""
2008
- };
2009
- },
2010
- components: {
2011
- EditorList: E,
2012
- ConnectionList: ie,
2013
- Tooltip: m,
2014
- TutorialSidebar: Se,
2015
- ModelSidebar: je,
2016
- JobsList: rt,
2017
- LLMConnectionList: re,
2018
- DashboardList: Bt,
2019
- CommunityModelList: xn
2020
- },
2021
- watch: {
2022
- contentCollapsed(e) {
2023
- this.$emit("content-collapsed", e);
2024
- },
2025
- unSaved: {
2026
- handler(e, t) {
2027
- t > 0 && e === 0 && !this.isSaving && this.triggerSaveAnimation(), this.previousUnSaved = e;
2028
- },
2029
- immediate: !0
2030
- },
2031
- mobileSearchQuery(e) {
2032
- this.mobileNavigation.searchActive.value = !!e.trim();
2033
- }
2034
- },
2035
- computed: {
2036
- activeMobileDestination() {
2037
- return [...this.sidebarItems, ...this.sidebarFeatureItems].find((e) => e.screen === this.active);
2038
- },
2039
- mobileNavigationLevel() {
2040
- return this.mobileNavigation.level.value;
2041
- },
2042
- globalChatOpen() {
2043
- return this.globalChatPanel.isOpen.value;
2044
- },
2045
- hasLLMConnections() {
2046
- return !!(this.llmConnectionStore && Object.keys(this.llmConnectionStore.connections || {}).length > 0);
2047
- },
2048
- aiChatRunning() {
2049
- let e = this.chatStore?.chatExecutions;
2050
- return e ? Object.values(e).some((e) => e?.isLoading) : !1;
2051
- }
2052
- },
2053
- methods: {
2054
- preloadScreen: wn,
2055
- toggleGlobalChat() {
2056
- this.globalChatPanel.togglePanel();
2057
- },
2058
- triggerSaveAnimation() {
2059
- this.isSaving = !0, setTimeout(() => {
2060
- this.isSaving = !1;
2061
- }, 500);
2062
- },
2063
- async handleSave() {
2064
- this.isSaving = !0, await this.saveAll(), setTimeout(() => {
2065
- this.isSaving = !1;
2066
- }, 500);
2067
- },
2068
- selectItem(e) {
2069
- if (this.isMobile) {
2070
- this.$emit("screen-selected", e);
2071
- return;
2072
- }
2073
- e === this.active ? this.contentCollapsed = !this.contentCollapsed : (this.contentCollapsed = !1, this.$emit("screen-selected", e));
2074
- },
2075
- rememberMobileDetailScroll() {
2076
- if (this.mobileNavigationLevel !== "detail") return;
2077
- let e = this.$refs.mobileDetailMenu;
2078
- e && this.active && (this.mobileDetailScrollPositions[this.active] = e.scrollTop, this.mobileSearchQueries[this.active] = this.mobileSearchQuery);
2079
- },
2080
- selectMobileDestination(e) {
2081
- this.rememberMobileDetailScroll(), this.$emit("screen-selected", e);
2082
- let t = [...this.sidebarItems, ...this.sidebarFeatureItems].find((t) => t.screen === e);
2083
- this.mobileNavigation.enterDestination(t?.tooltip || ""), this.mobileSearchQuery = this.mobileSearchQueries[e] || "", this.$nextTick(() => {
2084
- let t = this.$refs.mobileDetailMenu;
2085
- t && (t.scrollTop = this.mobileDetailScrollPositions[e] || 0);
2086
- });
2087
- },
2088
- toggleCollapse() {
2089
- this.contentCollapsed = !this.contentCollapsed;
2090
- },
2091
- editorSelected(e) {
2092
- this.$emit("editor-selected", e);
2093
- },
2094
- modelKeySelected(e) {
2095
- this.$emit("model-key-selected", e);
2096
- },
2097
- documentationKeySelected(e) {
2098
- this.$emit("documentation-key-selected", e);
2099
- },
2100
- jobsKeySelected(e) {
2101
- this.$emit("jobs-key-selected", e);
2102
- },
2103
- connectionKeySelected(e) {
2104
- this.$emit("connection-key-selected", e);
2105
- },
2106
- dashboardKeySelected(e) {
2107
- this.$emit("dashboard-key-selected", e);
2108
- },
2109
- toggleMobileMenu() {
2110
- this.$emit("toggle-mobile-menu");
2111
- },
2112
- llmKeySelected(e) {
2113
- this.$emit("llm-key-selected", e);
2114
- },
2115
- llmOpenView(e, t, n) {
2116
- this.$emit("llm-open-view", e, t, n);
2117
- },
2118
- createNewChat(e) {
2119
- this.$emit("create-new-chat", e);
2120
- },
2121
- saveEditors() {
2122
- this.$emit("save-editors");
2123
- },
2124
- saveDashboards() {
2125
- this.$emit("save-dashboards");
2126
- },
2127
- openSettings() {
2128
- console.log("Settings clicked");
2129
- },
2130
- openProfile() {
2131
- console.log("Profile clicked");
2132
- },
2133
- getUrl(e) {
2134
- let t = new URLSearchParams(window.location.search);
2135
- return t.set("sidebarScreen", e), `#${t.toString()}`;
2136
- }
2137
- }
2138
- }), Dn = {
2139
- key: 0,
2140
- class: "mobile-menu-root",
2141
- "data-testid": "mobile-menu-root"
2142
- }, On = ["aria-label"], kn = ["src"], An = { class: "mobile-menu-save-state" }, jn = {
2143
- class: "mobile-menu-destinations",
2144
- "aria-label": "Main navigation"
2145
- }, Mn = [
2146
- "aria-current",
2147
- "data-testid",
2148
- "onClick",
2149
- "onMouseenter"
2150
- ], Nn = { class: "mobile-menu-bottom" }, Pn = {
2151
- key: 1,
2152
- class: "sidebar-icons",
2153
- "data-testid": "sidebar-icons"
2154
- }, Fn = { class: "trilogy-icon" }, In = { class: "trilogy-icon-wrapper" }, Ln = ["src"], Rn = ["title"], zn = ["title"], Bn = [
2155
- "onClick",
2156
- "onMouseenter",
2157
- "data-testid"
2158
- ], Vn = [
2159
- "onClick",
2160
- "href",
2161
- "data-testid"
2162
- ], Hn = [
2163
- "onClick",
2164
- "onMouseenter",
2165
- "data-testid"
2166
- ], Un = [
2167
- "onClick",
2168
- "href",
2169
- "data-testid"
2170
- ], Wn = { class: "sidebar-bottom-icons" }, Gn = {
2171
- key: 0,
2172
- class: "ai-running-dot",
2173
- title: "An AI conversation is running"
2174
- }, Kn = {
2175
- key: 0,
2176
- class: "mobile-subsection-search"
2177
- }, qn = ["placeholder", "aria-label"];
2178
- function Jn(e, t, n, r, i, a) {
2179
- let o = K("tooltip"), s = K("EditorList"), c = K("ConnectionList"), l = K("LLMConnectionList"), u = K("ModelSidebar"), d = K("JobsList"), f = K("TutorialSidebar"), p = K("DashboardList"), m = K("CommunityModelList");
2180
- return U(), F("div", { class: V(["sidebar-container", { "mobile-navigation": e.isMobile }]) }, [
2181
- e.isMobile && e.mobileNavigationLevel === "root" ? (U(), F("div", Dn, [
2182
- I("button", {
2183
- type: "button",
2184
- class: "mobile-menu-brand",
2185
- "aria-label": e.unSaved ? `Save ${e.unSaved} unsaved changes` : "All changes saved",
2186
- onClick: t[0] ||= (...t) => e.handleSave && e.handleSave(...t)
2187
- }, [I("img", {
2188
- class: V(["mobile-menu-logo", { spinning: e.isSaving }]),
2189
- src: e.trilogyIcon,
2190
- alt: "",
2191
- "aria-hidden": "true",
2192
- "data-testid": "trilogy-icon"
2193
- }, null, 10, kn), I("div", null, [t[10] ||= I("div", { class: "mobile-menu-title" }, "Trilogy Studio", -1), I("div", An, q(e.unSaved ? `${e.unSaved} unsaved — tap to save` : "All changes saved"), 1)])], 8, On),
2194
- I("nav", jn, [(U(!0), F(j, null, G([...e.sidebarItems, ...e.sidebarFeatureItems], (n) => (U(), F("button", {
2195
- key: n.screen,
2196
- type: "button",
2197
- class: V(["mobile-menu-destination", { selected: e.active === n.screen }]),
2198
- "aria-current": e.active === n.screen ? "page" : void 0,
2199
- "data-testid": `sidebar-icon-${n.screen}`,
2200
- onClick: (t) => e.selectMobileDestination(n.screen),
2201
- onMouseenter: (t) => e.preloadScreen(n.screen)
2202
- }, [
2203
- I("i", {
2204
- class: V(n.icon),
2205
- "aria-hidden": "true"
2206
- }, null, 2),
2207
- I("span", null, q(n.tooltip), 1),
2208
- t[11] ||= I("i", {
2209
- class: "mdi mdi-chevron-right mobile-menu-chevron",
2210
- "aria-hidden": "true"
2211
- }, null, -1)
2212
- ], 42, Mn))), 128))]),
2213
- I("div", Nn, [I("button", {
2214
- type: "button",
2215
- class: "mobile-menu-destination",
2216
- "data-testid": "sidebar-icon-settings",
2217
- onClick: t[1] ||= (t) => e.selectItem("settings")
2218
- }, [...t[12] ||= [I("i", {
2219
- class: "mdi mdi-cog-outline",
2220
- "aria-hidden": "true"
2221
- }, null, -1), I("span", null, "Settings", -1)]]), I("button", {
2222
- type: "button",
2223
- class: "mobile-menu-destination",
2224
- "data-testid": "sidebar-icon-profile",
2225
- onClick: t[2] ||= (t) => e.selectItem("profile")
2226
- }, [...t[13] ||= [I("i", {
2227
- class: "mdi mdi-account-outline",
2228
- "aria-hidden": "true"
2229
- }, null, -1), I("span", null, "Profile", -1)]])])
2230
- ])) : P("", !0),
2231
- e.isMobile ? P("", !0) : (U(), F("div", Pn, [
2232
- I("div", Fn, [I("div", In, [R(o, { content: e.unSaved ? `Save ${e.unSaved} ${(e.unSaved?.valueOf() || 0) > 1 ? "changes" : "change"}` : "All changes saved!" }, {
2233
- default: Z(() => [I("img", {
2234
- class: V(["trilogy-icon", { spinning: e.isSaving }]),
2235
- onClick: t[3] ||= (...t) => e.handleSave && e.handleSave(...t),
2236
- src: e.trilogyIcon,
2237
- "data-testid": "trilogy-icon"
2238
- }, null, 10, Ln)]),
2239
- _: 1
2240
- }, 8, ["content"]), (e.unSaved?.valueOf() || 0) > 0 ? (U(), F("div", {
2241
- key: 0,
2242
- class: "unsaved-badge",
2243
- title: `${e.unSaved} unsaved ${(e.unSaved?.valueOf() || 0) > 1 ? "changes" : "change"}`
2244
- }, q(e.unSaved), 9, Rn)) : P("", !0)])]),
2245
- t[17] ||= I("div", { class: "trilogy-icon-padding" }, null, -1),
2246
- I("div", {
2247
- class: "sidebar-collapse-btn",
2248
- onClick: t[4] ||= (...t) => e.toggleCollapse && e.toggleCollapse(...t),
2249
- title: e.contentCollapsed ? "Expand sidebar" : "Collapse sidebar"
2250
- }, [I("i", { class: V(e.contentCollapsed ? "mdi mdi-chevron-right" : "mdi mdi-chevron-left") }, null, 2)], 8, zn),
2251
- t[18] ||= I("div", { class: "sidebar-divider" }, null, -1),
2252
- (U(!0), F(j, null, G(e.sidebarItems, (t, n) => (U(), F("div", {
2253
- key: t.name,
2254
- class: V(["sidebar-icon sidebar-icon-margin", { selected: e.active == t.screen }]),
2255
- onClick: (n) => e.selectItem(t.screen),
2256
- onMouseenter: (n) => e.preloadScreen(t.screen),
2257
- "data-testid": `sidebar-icon-${t.screen}`
2258
- }, [R(o, { content: t.tooltip }, {
2259
- default: Z(() => [I("a", {
2260
- onClick: $((n) => e.selectItem(t.screen), ["prevent", "stop"]),
2261
- href: e.getUrl(t.screen),
2262
- target: "_blank",
2263
- "data-testid": `sidebar-link-${t.screen}`
2264
- }, [I("i", { class: V(t.icon) }, null, 2)], 8, Vn)]),
2265
- _: 2
2266
- }, 1032, ["content"])], 42, Bn))), 128)),
2267
- t[19] ||= I("div", { class: "sidebar-divider" }, null, -1),
2268
- (U(!0), F(j, null, G(e.sidebarFeatureItems, (t, n) => (U(), F("div", {
2269
- key: t.name,
2270
- class: V(["sidebar-icon sidebar-icon-margin", { selected: e.active == t.screen }]),
2271
- onClick: (n) => e.selectItem(t.screen),
2272
- onMouseenter: (n) => e.preloadScreen(t.screen),
2273
- "data-testid": `sidebar-icon-${t.screen}`
2274
- }, [R(o, { content: t.tooltip }, {
2275
- default: Z(() => [I("a", {
2276
- onClick: $((n) => e.selectItem(t.screen), ["prevent", "stop"]),
2277
- href: e.getUrl(t.screen),
2278
- target: "_blank",
2279
- "data-testid": `sidebar-link-${t.screen}`
2280
- }, [I("i", { class: V(t.icon) }, null, 2)], 8, Un)]),
2281
- _: 2
2282
- }, 1032, ["content"])], 42, Hn))), 128)),
2283
- I("div", Wn, [
2284
- e.hasLLMConnections ? (U(), F("div", {
2285
- key: 0,
2286
- class: V(["sidebar-icon sidebar-icon-margin ai-panel-icon", { selected: e.globalChatOpen }]),
2287
- onClick: t[5] ||= (...t) => e.toggleGlobalChat && e.toggleGlobalChat(...t),
2288
- "data-testid": "sidebar-icon-ai-panel"
2289
- }, [R(o, { content: "AI Assistant (Ctrl+Shift+.)" }, {
2290
- default: Z(() => [...t[14] ||= [I("i", { class: "mdi mdi-creation" }, null, -1)]]),
2291
- _: 1
2292
- }), e.aiChatRunning ? (U(), F("span", Gn)) : P("", !0)], 2)) : P("", !0),
2293
- I("div", {
2294
- class: V(["sidebar-icon sidebar-icon-margin", { selected: e.active == "settings" }]),
2295
- onClick: t[6] ||= (t) => e.selectItem("settings"),
2296
- "data-testid": "sidebar-icon-settings"
2297
- }, [R(o, { content: "Settings" }, {
2298
- default: Z(() => [...t[15] ||= [I("i", { class: "mdi mdi-cog-outline" }, null, -1)]]),
2299
- _: 1
2300
- })], 2),
2301
- I("div", {
2302
- class: V(["sidebar-icon sidebar-icon-margin", { selected: e.active == "profile" }]),
2303
- "data-testid": "sidebar-icon-profile",
2304
- onClick: t[7] ||= (t) => e.selectItem("profile")
2305
- }, [R(o, { content: "Profile" }, {
2306
- default: Z(() => [...t[16] ||= [I("i", { class: "mdi mdi-account-outline" }, null, -1)]]),
2307
- _: 1
2308
- })], 2)
2309
- ])
2310
- ])),
2311
- Q(I("div", {
2312
- ref: "mobileDetailMenu",
2313
- class: V(["sidebar-content", { "sidebar-content-collapsed": e.contentCollapsed && !e.isMobile }]),
2314
- style: le(e.isMobile || e.contentCollapsed ? {} : { width: e.containerWidth - 40 + "px" })
2315
- }, [
2316
- e.isMobile && e.activeMobileDestination?.searchLabel ? (U(), F("label", Kn, [
2317
- t[21] ||= I("i", {
2318
- class: "mdi mdi-magnify",
2319
- "aria-hidden": "true"
2320
- }, null, -1),
2321
- Q(I("input", {
2322
- "onUpdate:modelValue": t[8] ||= (t) => e.mobileSearchQuery = t,
2323
- type: "search",
2324
- placeholder: `Search ${e.activeMobileDestination.searchLabel}`,
2325
- "aria-label": `Search ${e.activeMobileDestination.searchLabel}`,
2326
- "data-testid": "mobile-sidebar-search"
2327
- }, null, 8, qn), [[Y, e.mobileSearchQuery]]),
2328
- e.mobileSearchQuery ? (U(), F("button", {
2329
- key: 0,
2330
- type: "button",
2331
- "aria-label": "Clear search",
2332
- onClick: t[9] ||= (t) => e.mobileSearchQuery = ""
2333
- }, [...t[20] ||= [I("i", {
2334
- class: "mdi mdi-close",
2335
- "aria-hidden": "true"
2336
- }, null, -1)]])) : P("", !0)
2337
- ])) : P("", !0),
2338
- Q(R(s, {
2339
- activeEditor: e.activeEditor,
2340
- mobileSearchQuery: e.mobileSearchQuery,
2341
- onEditorSelected: e.editorSelected,
2342
- onSaveEditors: e.saveEditors
2343
- }, null, 8, [
2344
- "activeEditor",
2345
- "mobileSearchQuery",
2346
- "onEditorSelected",
2347
- "onSaveEditors"
2348
- ]), [[X, e.active === "editors"]]),
2349
- Q(R(c, {
2350
- onConnectionKeySelected: e.connectionKeySelected,
2351
- onToggleMobileMenu: e.toggleMobileMenu,
2352
- activeConnectionKey: e.activeConnectionKey
2353
- }, null, 8, [
2354
- "onConnectionKeySelected",
2355
- "onToggleMobileMenu",
2356
- "activeConnectionKey"
2357
- ]), [[X, e.active === "connections"]]),
2358
- Q(R(l, {
2359
- onLlmConnectionKeySelected: e.llmKeySelected,
2360
- onLlmOpenView: e.llmOpenView,
2361
- onCreateNewChat: e.createNewChat,
2362
- activeLLMKey: e.activeLLMKey
2363
- }, null, 8, [
2364
- "onLlmConnectionKeySelected",
2365
- "onLlmOpenView",
2366
- "onCreateNewChat",
2367
- "activeLLMKey"
2368
- ]), [[X, e.active === "llms"]]),
2369
- Q(R(u, {
2370
- onModelKeySelected: e.modelKeySelected,
2371
- activeModelKey: e.activeModelKey,
2372
- mobileSearchQuery: e.mobileSearchQuery
2373
- }, null, 8, [
2374
- "onModelKeySelected",
2375
- "activeModelKey",
2376
- "mobileSearchQuery"
2377
- ]), [[X, e.active === "models"]]),
2378
- Q(R(d, {
2379
- onJobsKeySelected: e.jobsKeySelected,
2380
- activeJobsKey: e.activeJobsKey
2381
- }, null, 8, ["onJobsKeySelected", "activeJobsKey"]), [[X, e.active === "jobs"]]),
2382
- Q(R(f, {
2383
- onDocumentationKeySelected: e.documentationKeySelected,
2384
- activeDocumentationKey: e.activeDocumentationKey
2385
- }, null, 8, ["onDocumentationKeySelected", "activeDocumentationKey"]), [[X, e.active === "tutorial"]]),
2386
- Q(R(p, {
2387
- onDashboardKeySelected: e.dashboardKeySelected,
2388
- onSaveEditors: e.saveDashboards,
2389
- activeDashboardKey: e.activeDashboardKey,
2390
- onToggleMobileMenu: e.toggleMobileMenu
2391
- }, null, 8, [
2392
- "onDashboardKeySelected",
2393
- "onSaveEditors",
2394
- "activeDashboardKey",
2395
- "onToggleMobileMenu"
2396
- ]), [[X, e.active === "dashboard"]]),
2397
- Q(R(m, null, null, 512), [[X, e.active === "community-models"]])
2398
- ], 6), [[X, !e.isMobile || e.mobileNavigationLevel === "detail"]])
2399
- ], 2);
2400
- }
2401
- var Yn = /*#__PURE__*/ e(En, [["render", Jn], ["__scopeId", "data-v-8ea26f23"]]), Xn = z({
2402
- name: "StorageManager",
2403
- setup() {
2404
- let e = (B("storageSources", []) || []).find((e) => e instanceof b), t = W([]), n = W(!1), r = W(30), i = W(""), a = M(() => t.value.reduce((e, t) => e + t.bytes, 0));
2405
- async function o() {
2406
- if (e) {
2407
- n.value = !0;
2408
- try {
2409
- t.value = await e.getStorageUsage();
2410
- } finally {
2411
- n.value = !1;
2412
- }
2413
- }
2414
- }
2415
- async function s(t, r) {
2416
- if (e && confirm(`Delete "${t}" from ${r}? This cannot be undone.`)) {
2417
- n.value = !0;
2418
- try {
2419
- await e.deleteStorageKey(t, r), await o();
2420
- } finally {
2421
- n.value = !1;
2422
- }
2423
- }
2424
- }
2425
- async function c() {
2426
- if (!e) return;
2427
- let t = /* @__PURE__ */ new Date(Date.now() - r.value * 24 * 60 * 60 * 1e3);
2428
- if (confirm(`Delete all chats last updated before ${t.toLocaleDateString()}?`)) {
2429
- n.value = !0;
2430
- try {
2431
- let n = await e.pruneChatsOlderThan(t);
2432
- i.value = n === 0 ? "No chats matched the cutoff." : `Removed ${n} chat${n === 1 ? "" : "s"}.`, await o();
2433
- } finally {
2434
- n.value = !1;
2435
- }
2436
- }
2437
- }
2438
- function l(e) {
2439
- return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / 1024 / 1024).toFixed(2)} MB`;
2440
- }
2441
- return H(o), {
2442
- rows: t,
2443
- loading: n,
2444
- pruneDays: r,
2445
- pruneMessage: i,
2446
- totalBytes: a,
2447
- refresh: o,
2448
- deleteKey: s,
2449
- pruneChats: c,
2450
- formatBytes: l
2451
- };
2452
- }
2453
- }), Zn = { class: "storage-container" }, Qn = { class: "intro" }, $n = ["disabled"], er = {
2454
- key: 0,
2455
- class: "empty"
2456
- }, tr = {
2457
- key: 1,
2458
- class: "empty"
2459
- }, nr = {
2460
- key: 2,
2461
- class: "usage-table"
2462
- }, rr = { class: "key" }, ir = { class: "numeric" }, ar = ["onClick", "disabled"], or = { class: "numeric" }, sr = { class: "section" }, cr = { class: "prune-row" }, lr = ["disabled"], ur = {
2463
- key: 0,
2464
- class: "prune-message"
2465
- };
2466
- function dr(e, t, n, r, i, a) {
2467
- return U(), F("div", Zn, [
2468
- I("div", Qn, [t[3] ||= I("p", null, " Large data (chats, editors, dashboards, model config) is stored in IndexedDB. Smaller items (connections, LLM settings, user settings, credentials) stay in localStorage. Clear individual keys or prune old chats below. ", -1), I("button", {
2469
- class: "button",
2470
- onClick: t[0] ||= (...t) => e.refresh && e.refresh(...t),
2471
- disabled: e.loading
2472
- }, "Refresh", 8, $n)]),
2473
- e.loading ? (U(), F("div", er, "Loading…")) : e.rows.length ? (U(), F("table", nr, [
2474
- t[6] ||= I("thead", null, [I("tr", null, [
2475
- I("th", null, "Key"),
2476
- I("th", null, "Backend"),
2477
- I("th", { class: "numeric" }, "Size"),
2478
- I("th")
2479
- ])], -1),
2480
- I("tbody", null, [(U(!0), F(j, null, G(e.rows, (t) => (U(), F("tr", { key: `${t.backend}:${t.key}` }, [
2481
- I("td", rr, q(t.key), 1),
2482
- I("td", null, [I("span", { class: V(["backend-badge", t.backend]) }, q(t.backend), 3)]),
2483
- I("td", ir, q(e.formatBytes(t.bytes)), 1),
2484
- I("td", null, [I("button", {
2485
- class: "button button-small",
2486
- onClick: (n) => e.deleteKey(t.key, t.backend),
2487
- disabled: e.loading
2488
- }, " Delete ", 8, ar)])
2489
- ]))), 128))]),
2490
- I("tfoot", null, [I("tr", null, [
2491
- t[4] ||= I("td", { colspan: "2" }, [I("strong", null, "Total")], -1),
2492
- I("td", or, [I("strong", null, q(e.formatBytes(e.totalBytes)), 1)]),
2493
- t[5] ||= I("td", null, null, -1)
2494
- ])])
2495
- ])) : (U(), F("div", tr, "Nothing stored.")),
2496
- I("div", sr, [
2497
- t[9] ||= I("h3", null, "Prune old chats", -1),
2498
- t[10] ||= I("p", { class: "muted" }, " Deletes chats whose last activity is older than the selected age. Artifact payloads stored in chats are the most common cause of quota errors. ", -1),
2499
- I("div", cr, [
2500
- t[8] ||= I("label", { for: "prune-days" }, "Delete chats older than", -1),
2501
- Q(I("select", {
2502
- id: "prune-days",
2503
- "onUpdate:modelValue": t[1] ||= (t) => e.pruneDays = t
2504
- }, [...t[7] ||= [
2505
- I("option", { value: 7 }, "7 days", -1),
2506
- I("option", { value: 30 }, "30 days", -1),
2507
- I("option", { value: 90 }, "90 days", -1),
2508
- I("option", { value: 180 }, "180 days", -1),
2509
- I("option", { value: 365 }, "1 year", -1)
2510
- ]], 512), [[
2511
- fe,
2512
- e.pruneDays,
2513
- void 0,
2514
- { number: !0 }
2515
- ]]),
2516
- I("button", {
2517
- class: "button",
2518
- onClick: t[2] ||= (...t) => e.pruneChats && e.pruneChats(...t),
2519
- disabled: e.loading
2520
- }, "Prune", 8, lr)
2521
- ]),
2522
- e.pruneMessage ? (U(), F("div", ur, q(e.pruneMessage), 1)) : P("", !0)
2523
- ])
2524
- ]);
2525
- }
2526
- //#endregion
2527
- //#region components/user/UserSettings.vue?vue&type=script&lang.ts
2528
- var fr = z({
2529
- name: "UserSettings",
2530
- components: { StorageManager: /* @__PURE__ */ e(Xn, [["render", dr], ["__scopeId", "data-v-e5d394da"]]) },
2531
- setup() {
2532
- let e = B("userSettingsStore");
2533
- if (!e) throw Error("User Settings Store is required");
2534
- let { settings: t, isLoading: n, hasChanges: r } = me(e), i = W("general");
2535
- return H(() => {
2536
- e.hasLoaded || e.loadSettings();
2537
- }), {
2538
- settings: t,
2539
- isLoading: n,
2540
- hasChanges: r,
2541
- activeTab: i,
2542
- clearDismissedTips: async () => {
2543
- await e.clearDismissedTips();
2544
- },
2545
- saveSettings: async () => {
2546
- await e.saveSettings() && console.log("Settings saved successfully");
2547
- },
2548
- resetToDefaults: () => {
2549
- e.resetToDefaults();
2550
- },
2551
- formatLabel: (e) => e.replace(/([A-Z])/g, " $1").replace(/^./, (e) => e.toUpperCase()),
2552
- toggleTheme: () => {
2553
- ce(() => {
2554
- e.toggleTheme();
2555
- });
2556
- },
2557
- onSettingChange: () => {
2558
- e.setHasChanges(!0);
2559
- },
2560
- onThemeChange: () => {
2561
- e.setHasChanges(!0), ce(() => {
2562
- e.toggleTheme();
2563
- });
2564
- },
2565
- userSettingsStore: e
2566
- };
2567
- }
2568
- }), pr = { class: "settings-container" }, mr = { class: "tabs" }, hr = { class: "tab-panel" }, gr = ["for"], _r = [
2569
- "id",
2570
- "onUpdate:modelValue",
2571
- "onChange"
2572
- ], vr = ["onUpdate:modelValue"], yr = { key: 2 }, br = ["disabled"], xr = [
2573
- "id",
2574
- "onUpdate:modelValue",
2575
- "data-testid"
2576
- ], Sr = { class: "actions" }, Cr = ["disabled"], wr = ["disabled"], Tr = { class: "tab-panel" };
2577
- function Er(e, t, n, r, i, a) {
2578
- let o = K("StorageManager");
2579
- return U(), F("div", pr, [
2580
- I("div", mr, [I("button", {
2581
- class: V(["tab-button", { "tab-active": e.activeTab === "general" }]),
2582
- onClick: t[0] ||= (t) => e.activeTab = "general",
2583
- "data-testid": "settings-tab-general"
2584
- }, " General ", 2), I("button", {
2585
- class: V(["tab-button", { "tab-active": e.activeTab === "storage" }]),
2586
- onClick: t[1] ||= (t) => e.activeTab = "storage",
2587
- "data-testid": "settings-tab-storage"
2588
- }, " Storage ", 2)]),
2589
- Q(I("div", hr, [
2590
- t[8] ||= I("h2", null, "Settings", -1),
2591
- (U(!0), F(j, null, G(Object.entries(e.settings), ([n, r]) => (U(), F("div", {
2592
- class: "setting",
2593
- key: n
2594
- }, [I("label", { for: n }, q(e.formatLabel(n)), 9, gr), typeof r == "boolean" ? Q((U(), F("input", {
2595
- key: 0,
2596
- type: "checkbox",
2597
- id: n,
2598
- "onUpdate:modelValue": (t) => e.settings[n] = t,
2599
- onChange: () => e.userSettingsStore.updateSetting(n, e.settings[n])
2600
- }, null, 40, _r)), [[de, e.settings[n]]]) : n === "theme" ? Q((U(), F("select", {
2601
- key: 1,
2602
- "onUpdate:modelValue": (t) => e.settings[n] = t,
2603
- onChange: t[2] ||= (...t) => e.onThemeChange && e.onThemeChange(...t)
2604
- }, [...t[7] ||= [I("option", { value: "dark" }, "Dark", -1), I("option", { value: "light" }, "Light", -1)]], 40, vr)), [[fe, e.settings[n]]]) : n === "tipsRead" ? (U(), F("div", yr, [I("button", {
2605
- class: "button",
2606
- onClick: t[3] ||= (...t) => e.clearDismissedTips && e.clearDismissedTips(...t),
2607
- disabled: e.isLoading
2608
- }, " Reshow Dismissed Popups (" + q(e.settings.tipsRead.length) + ") ", 9, br)])) : typeof r == "string" ? Q((U(), F("input", {
2609
- key: 3,
2610
- type: "text",
2611
- id: n,
2612
- "onUpdate:modelValue": (t) => e.settings[n] = t,
2613
- "data-testid": `settings-${n}`,
2614
- onInput: t[4] ||= (...t) => e.onSettingChange && e.onSettingChange(...t)
2615
- }, null, 40, xr)), [[Y, e.settings[n]]]) : P("", !0)]))), 128)),
2616
- I("div", Sr, [I("button", {
2617
- class: "button",
2618
- onClick: t[5] ||= (...t) => e.saveSettings && e.saveSettings(...t),
2619
- disabled: e.isLoading || !e.hasChanges
2620
- }, " Save ", 8, Cr), I("button", {
2621
- class: "button",
2622
- onClick: t[6] ||= (...t) => e.resetToDefaults && e.resetToDefaults(...t),
2623
- disabled: e.isLoading
2624
- }, " Reset to Defaults ", 8, wr)])
2625
- ], 512), [[X, e.activeTab === "general"]]),
2626
- Q(I("div", Tr, [R(o)], 512), [[X, e.activeTab === "storage"]])
2627
- ]);
2628
- }
2629
- var Dr = /*#__PURE__*/ e(fr, [["render", Er], ["__scopeId", "data-v-e04e640c"]]), Or = z({
2630
- name: "UserProfile",
2631
- setup() {
2632
- return {
2633
- profile: ue({
2634
- name: "Anonymous",
2635
- email: null,
2636
- organization: null
2637
- }),
2638
- editProfile: () => {
2639
- console.log("Edit profile clicked");
2640
- },
2641
- trilogyIcon: _
2642
- };
2643
- }
2644
- }), kr = { class: "profile-container" }, Ar = { class: "profile-info" }, jr = ["src"], Mr = { class: "details" }, Nr = { key: 0 }, Pr = { key: 1 };
2645
- function Fr(e, t, n, r, i, a) {
2646
- return U(), F("div", kr, [t[3] ||= I("h2", null, "Profile", -1), I("div", Ar, [I("img", {
2647
- src: e.trilogyIcon,
2648
- alt: "User Avatar",
2649
- class: "avatar"
2650
- }, null, 8, jr), I("div", Mr, [
2651
- I("p", null, [t[0] ||= I("strong", null, "User Name:", -1), L(" " + q(e.profile.name), 1)]),
2652
- e.profile.email ? (U(), F("p", Nr, [t[1] ||= I("strong", null, "Email:", -1), L(" " + q(e.profile.email), 1)])) : P("", !0),
2653
- e.profile.organization ? (U(), F("p", Pr, [t[2] ||= I("strong", null, "Organization:", -1), L(" " + q(e.profile.organization), 1)])) : P("", !0)
2654
- ])])]);
2655
- }
2656
- var Ir = /*#__PURE__*/ e(Or, [["render", Fr], ["__scopeId", "data-v-e25754ef"]]), Lr = {}, Rr = {
2657
- class: "page-loading",
2658
- role: "status",
2659
- "aria-label": "Loading page"
2660
- };
2661
- function zr(e, t) {
2662
- return U(), F("div", Rr, [...t[0] ||= [se("<div class=\"page-loading__bar\" data-v-bd8a428d><span class=\"skeleton skeleton--chip\" data-v-bd8a428d></span><span class=\"skeleton skeleton--title\" data-v-bd8a428d></span><span class=\"skeleton skeleton--chip\" data-v-bd8a428d></span></div><div class=\"page-loading__body\" data-v-bd8a428d><span class=\"skeleton skeleton--line skeleton--w60\" data-v-bd8a428d></span><span class=\"skeleton skeleton--line skeleton--w40\" data-v-bd8a428d></span><span class=\"skeleton skeleton--block\" data-v-bd8a428d></span><div class=\"page-loading__row\" data-v-bd8a428d><span class=\"skeleton skeleton--card\" data-v-bd8a428d></span><span class=\"skeleton skeleton--card\" data-v-bd8a428d></span></div></div>", 2)]]);
2663
- }
2664
- var Br = /*#__PURE__*/ e(Lr, [["render", zr], ["__scopeId", "data-v-bd8a428d"]]);
2665
- //#endregion
2666
- export { Tn as a, Yn as i, Ir as n, ye as o, Dr as r, ve as s, Br as t };