@trilogy-data/trilogy-studio-components 0.1.28 → 0.1.30

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 (110) hide show
  1. package/README.md +1 -0
  2. package/dist/AssetAutoImporter-BA8C4p09.js +403 -0
  3. package/dist/{ChatCreatorModal-Cd40SvdM.js → ChatCreatorModal-94gZ9D-y.js} +1 -1
  4. package/dist/{CodeBlock-Dj-GfTbW.js → CodeBlock-C9o09ipr.js} +1 -1
  5. package/dist/{CommunityModels-lX2RhHCG.js → CommunityModels-D48H9Bqt.js} +6 -6
  6. package/dist/{ConnectionView-CZ06qjjE.js → ConnectionView-sEXGE8Vs.js} +5 -5
  7. package/dist/{CreateEditorFromDatasourcePopup-DwA938kf.js → CreateEditorFromDatasourcePopup-BUoegyem.js} +2 -2
  8. package/dist/{Dashboard-CQsIqWZC.js → Dashboard-C6adKZ7q.js} +202 -203
  9. package/dist/{DashboardImportSelector-CkqH52FX.js → DashboardImportSelector-CQqXshDj.js} +1 -1
  10. package/dist/{DashboardMobile-DWFlel5p.js → DashboardMobile-BU1nDLQv.js} +42 -42
  11. package/dist/{Editor-DQ66Vp6v.js → Editor-DO4VRvek.js} +9 -10
  12. package/dist/{ErrorMessage-D5JeF3Iz.js → ErrorMessage-Cz7q7vJI.js} +1 -1
  13. package/dist/{GlobalChatPanel-B_s3COHE.js → GlobalChatPanel-Ct6oSj_A.js} +20 -20
  14. package/dist/{IDE-4-Jg6gsM.js → IDE-kdaEhA4g.js} +19 -20
  15. package/dist/{JobsView-B5NWDUgP.js → JobsView-BcyWrDRf.js} +11 -11
  16. package/dist/{LLMChat-eKgEc-I3.js → LLMChat-Dg8VvTIP.js} +19 -19
  17. package/dist/{LLMView-CdTwMLVV.js → LLMView-CZNNYXC1.js} +61 -61
  18. package/dist/{LoadingView-Bu3wLJ7J.js → LoadingView-k2CIKiN7.js} +1 -1
  19. package/dist/{MarkdownRenderer-B6lqdkgc.js → MarkdownRenderer-Dlb_KGmk.js} +1 -1
  20. package/dist/{MobileIDE-CZlg20oa.js → MobileIDE-BQcdjWUT.js} +26 -27
  21. package/dist/{ModelCard-Bs_d7Jis.js → ModelCard-Dn2b5WLs.js} +5 -5
  22. package/dist/{ModelView-BP5yyecx.js → ModelView-BEi83zrX.js} +6 -6
  23. package/dist/{PageLoading-DKFeqkmK.js → PageLoading-C7H6q6U6.js} +248 -248
  24. package/dist/{ResultComponent-BaDheojB.js → ResultComponent-DW9Q9tp9.js} +5 -5
  25. package/dist/{Results-CrpHB101.js → Results-N2OttUlb.js} +19 -19
  26. package/dist/{StatusIcon-Clfyy-Yn.js → StatusIcon-B21tjIXx.js} +1 -1
  27. package/dist/{StoreTokenModal-CO5hXMs3.js → StoreTokenModal-CHgvjLGl.js} +1 -1
  28. package/dist/{SymbolsPane-XFVErDFb.js → SymbolsPane-DUrLpSSw.js} +11 -11
  29. package/dist/{TutorialPage-CMcTYDOV.js → TutorialPage-DHgPuFN0.js} +11 -11
  30. package/dist/{VegaLiteChart-DX_LbF3g.js → VegaLiteChart-BqHLSptG.js} +11116 -11067
  31. package/dist/{WelcomePage-B6E35FUa.js → WelcomePage-CN6ptsoF.js} +3 -3
  32. package/dist/agent.js +1349 -0
  33. package/dist/components/VegaLiteChart.vue.d.ts.map +1 -1
  34. package/dist/components/chartControlsManager.d.ts +0 -1
  35. package/dist/components/chartControlsManager.d.ts.map +1 -1
  36. package/dist/{cssMode-zpO2ap2B.js → cssMode-DW4OByy3.js} +2 -2
  37. package/dist/dashboard.js +63 -63
  38. package/dist/dashboards/chartTheme.d.ts +68 -0
  39. package/dist/dashboards/chartTheme.d.ts.map +1 -0
  40. package/dist/dashboards/donutSpec.d.ts +2 -1
  41. package/dist/dashboards/donutSpec.d.ts.map +1 -1
  42. package/dist/dashboards/headlineSpec.d.ts +2 -1
  43. package/dist/dashboards/headlineSpec.d.ts.map +1 -1
  44. package/dist/dashboards/helpers.d.ts +23 -0
  45. package/dist/dashboards/helpers.d.ts.map +1 -1
  46. package/dist/dashboards/index.d.ts +2 -0
  47. package/dist/dashboards/index.d.ts.map +1 -1
  48. package/dist/dashboards/layerSpec.d.ts +4 -1
  49. package/dist/dashboards/layerSpec.d.ts.map +1 -1
  50. package/dist/dashboards/pointSpec.d.ts +2 -1
  51. package/dist/dashboards/pointSpec.d.ts.map +1 -1
  52. package/dist/dashboards/spec.d.ts +8 -1
  53. package/dist/dashboards/spec.d.ts.map +1 -1
  54. package/dist/{editor.main-BQh6DxDB.js → editor.main-TuTbSVcN.js} +22 -22
  55. package/dist/{editorStore-CiWH_nGN.js → editorStore-Czhpct1j.js} +1751 -1181
  56. package/dist/entry.agent.d.ts +12 -0
  57. package/dist/entry.agent.d.ts.map +1 -0
  58. package/dist/entry.llm.d.ts +1 -1
  59. package/dist/entry.llm.d.ts.map +1 -1
  60. package/dist/{freemarker2-DQBqlEXc.js → freemarker2-ZGcKAI8o.js} +1 -1
  61. package/dist/{globalChatRuntime-DAERmOdu.js → globalChatRuntime-BnMYNYqe.js} +35 -35
  62. package/dist/{handlebars-tgYxaM70.js → handlebars-B3s0Qrrb.js} +1 -1
  63. package/dist/{helpers-C2pARJoZ.js → helpers-B3tq3RZK.js} +17 -17
  64. package/dist/{html-jJahD3Mi.js → html-DM1koKCG.js} +1 -1
  65. package/dist/{htmlMode-BA1-8l2e.js → htmlMode-CpPImbDh.js} +2 -2
  66. package/dist/{javascript-Cypfo7va.js → javascript-jClqu73w.js} +1 -1
  67. package/dist/{jsonMode-xJye8PWS.js → jsonMode-CwFYTPO9.js} +2 -2
  68. package/dist/{liquid-BGDrv5da.js → liquid-C6l-UINC.js} +1 -1
  69. package/dist/llm/chatAgentPrompt.d.ts +4 -16
  70. package/dist/llm/chatAgentPrompt.d.ts.map +1 -1
  71. package/dist/llm/dashboardAgentRuntime.d.ts +10 -10
  72. package/dist/llm/dashboardAgentTools.d.ts +10 -10
  73. package/dist/llm/data/prompts.d.ts +1 -1
  74. package/dist/llm/data/prompts.d.ts.map +1 -1
  75. package/dist/llm/data/trilogySyntax.generated.d.ts +3 -3
  76. package/dist/llm/data/trilogySyntax.generated.d.ts.map +1 -1
  77. package/dist/llm/returnToUserTool.d.ts +20 -0
  78. package/dist/llm/returnToUserTool.d.ts.map +1 -0
  79. package/dist/llm/toolLoopCore.d.ts +7 -0
  80. package/dist/llm/toolLoopCore.d.ts.map +1 -1
  81. package/dist/llm/utils.d.ts.map +1 -1
  82. package/dist/{llm-Wf4Etiu9.js → llm-Bc1CfjOE.js} +2203 -2722
  83. package/dist/llm.js +3 -3
  84. package/dist/{localStorage-C3xms-ab.js → localStorage-Cy0sHlT0.js} +19 -19
  85. package/dist/{lspLanguageFeatures-V3e_p9oN.js → lspLanguageFeatures-GDtuGOTD.js} +1 -1
  86. package/dist/{mdx-BUR1aImW.js → mdx-BQEQ0k1f.js} +1 -1
  87. package/dist/monaco.js +3 -3
  88. package/dist/{python-YLkl0pc6.js → python-USoVCfWY.js} +1 -1
  89. package/dist/{razor-BP8TRMDY.js → razor-BxmgiR-q.js} +1 -1
  90. package/dist/{reconcile-BH_ReGDR.js → reconcile-DtPcgEjQ.js} +1 -1
  91. package/dist/{remoteStoreSync-B0K8QScO.js → remoteStoreSync-CscErZ-I.js} +2 -2
  92. package/dist/{stores-DTGQZ4_B.js → stores-DgdADCiH.js} +323 -323
  93. package/dist/stores.js +3 -4
  94. package/dist/trilogy-studio-components.css +1 -1
  95. package/dist/{tsMode-BH9HS_sH.js → tsMode-BEQ7aXX4.js} +1 -1
  96. package/dist/{typescript-BM-ynfk9.js → typescript-CzBSjjfY.js} +1 -1
  97. package/dist/{useChatWithTools-BSrzJtYI.js → useChatWithTools-CMhGxdyr.js} +14 -14
  98. package/dist/{useDashboard-CGeIdDuX.js → useDashboard-CjZgjmgb.js} +553 -553
  99. package/dist/{useGlobalChatPanel-D9kMZLeF.js → useGlobalChatPanel-Doeilj18.js} +69 -70
  100. package/dist/views/LLMView.vue.d.ts +23 -23
  101. package/dist/views/TutorialPage.vue.d.ts +10 -10
  102. package/dist/views.js +147 -148
  103. package/dist/vite.agent.config.d.ts +3 -0
  104. package/dist/vite.agent.config.d.ts.map +1 -0
  105. package/dist/{workers-B9Eybl-M.js → workers-CHvkad0r.js} +2 -2
  106. package/dist/{xml-M5WFPSpA.js → xml-ODdyS0gX.js} +1 -1
  107. package/dist/{yaml-CEeFwjz9.js → yaml-PCBTA2qD.js} +1 -1
  108. package/package.json +7 -2
  109. package/dist/AssetAutoImporter-C_7Ms9xe.js +0 -403
  110. package/dist/rolldown-runtime-B0aSnxlc.js +0 -20
@@ -1,8 +1,8 @@
1
- import { c as e, u as t } from "./base-DuKnVD-A.js";
2
- import { Ct as n, Dt as r, Et as i, Ft as a, Gt as o, It as s, Ot as c, Tt as l, _t as u, bt as d, fn as f, gt as p, kt as m, vt as h, wt as g } from "./llm-Wf4Etiu9.js";
3
- import { C as _, F as v, H as y, I as b, L as x, N as S, P as C, R as ee, S as te, i as ne, it as w, q as re, s as ie, t as ae, z as T } from "./editorStore-CiWH_nGN.js";
4
- import { t as oe } from "./connections-CWH3zwH2.js";
5
- import { n as se, t as E } from "./chatHelpers-F_woEbYF.js";
1
+ import { At as e, Dt as t, Et as n, Lt as r, Ot as i, Rt as a, St as o, Tt as s, bt as c, jt as l, kt as u, qt as d, vt as f, yt as p } from "./llm-Bc1CfjOE.js";
2
+ import { c as m, u as h } from "./base-DuKnVD-A.js";
3
+ import { C as g, F as _, H as v, I as y, L as b, N as x, P as S, R as C, S as ee, i as te, it as w, pt as ne, q as re, s as ie, t as ae, z as T } from "./editorStore-Czhpct1j.js";
4
+ import { t as E } from "./connections-CWH3zwH2.js";
5
+ import { n as oe, t as se } from "./chatHelpers-F_woEbYF.js";
6
6
  import { computed as D, ref as O } from "vue";
7
7
  import { defineStore as k } from "pinia";
8
8
  //#region data/tips.ts
@@ -267,30 +267,30 @@ var A = class e {
267
267
  let t = e;
268
268
  return t.error ? "failed" : t.running ? "running" : t.connected ? "connected" : "disabled";
269
269
  },
270
- async newConnection(e, t, a) {
271
- if (this.connections[e]) throw Error(`LLM connection with name "${e}" already exists.`);
272
- let o;
273
- if (t === "demo") o = new r(e, a.model);
274
- else if (t === "anthropic") o = new l(e, a.apiKey, a.model, a.saveCredential);
275
- else if (t === "openai") o = new i(e, a.apiKey, a.model, a.saveCredential);
276
- else if (t === "google") o = new g(e, a.apiKey, a.model, a.saveCredential);
277
- else if (t === "openrouter") o = new c(e, a.apiKey, a.model, a.saveCredential, void 0, {
278
- httpReferer: a.httpReferer,
279
- appTitle: a.appTitle
270
+ async newConnection(r, a, o) {
271
+ if (this.connections[r]) throw Error(`LLM connection with name "${r}" already exists.`);
272
+ let c;
273
+ if (a === "demo") c = new u(r, o.model);
274
+ else if (a === "anthropic") c = new t(r, o.apiKey, o.model, o.saveCredential);
275
+ else if (a === "openai") c = new i(r, o.apiKey, o.model, o.saveCredential);
276
+ else if (a === "google") c = new n(r, o.apiKey, o.model, o.saveCredential);
277
+ else if (a === "openrouter") c = new e(r, o.apiKey, o.model, o.saveCredential, void 0, {
278
+ httpReferer: o.httpReferer,
279
+ appTitle: o.appTitle
280
280
  });
281
- else if (t === "deepseek") o = new n(e, a.apiKey, a.model, a.saveCredential);
282
- else throw Error(`LLM provider type "${t}" not found.`);
283
- return this.addConnection(o), this.resetConnectionInBackground(e), o;
284
- },
285
- async fetchModelsForProvider(e, t) {
286
- let r, a = `__temp_${e}_${Date.now()}`;
287
- if (e === "anthropic") r = new l(a, t, "", !1);
288
- else if (e === "openai") r = new i(a, t, "", !1);
289
- else if (e === "google") r = new g(a, t, "", !1);
290
- else if (e === "openrouter") r = new c(a, t, "", !1);
291
- else if (e === "deepseek") r = new n(a, t, "", !1);
292
- else throw Error(`LLM provider type "${e}" not found.`);
293
- return await r.reset(), r.models;
281
+ else if (a === "deepseek") c = new s(r, o.apiKey, o.model, o.saveCredential);
282
+ else throw Error(`LLM provider type "${a}" not found.`);
283
+ return this.addConnection(c), this.resetConnectionInBackground(r), c;
284
+ },
285
+ async fetchModelsForProvider(r, a) {
286
+ let o, c = `__temp_${r}_${Date.now()}`;
287
+ if (r === "anthropic") o = new t(c, a, "", !1);
288
+ else if (r === "openai") o = new i(c, a, "", !1);
289
+ else if (r === "google") o = new n(c, a, "", !1);
290
+ else if (r === "openrouter") o = new e(c, a, "", !1);
291
+ else if (r === "deepseek") o = new s(c, a, "", !1);
292
+ else throw Error(`LLM provider type "${r}" not found.`);
293
+ return await o.reset(), o.models;
294
294
  },
295
295
  async generateValidatedCompletion(e, t = null, n = 3, r = null, i = null, a = !0) {
296
296
  let o = r || this.activeConnection || "", s = i || [];
@@ -331,11 +331,11 @@ var A = class e {
331
331
  };
332
332
  },
333
333
  async generateDashboardCompletion(e, t = null, n = [], r = 3) {
334
- let i = p(e, n);
334
+ let i = f(e, n);
335
335
  return this.generateValidatedCompletion(i, t, r).then((e) => e.content);
336
336
  },
337
337
  async generateQueryCompletion(e, t, n = null, r = 3, i = null) {
338
- let a = h(e, t);
338
+ let a = c(e, t);
339
339
  return this.generateValidatedCompletion(a, n, r, i);
340
340
  },
341
341
  async generateSQLQueryCompletion(e) {
@@ -348,13 +348,13 @@ var A = class e {
348
348
  }));
349
349
  },
350
350
  async generateFilterQuery(e, t, n = null, r = 3) {
351
- let i = u(e, t);
351
+ let i = p(e, t);
352
352
  return this.generateValidatedCompletion(i, n, r).then((e) => e.content);
353
353
  },
354
354
  async generateChatName(e, t) {
355
355
  let n = this.connections[e];
356
356
  if (!n) throw Error(`LLM connection with name "${e}" not found.`);
357
- let r = E(t), i = n.model, a = n.getFastModel();
357
+ let r = se(t), i = n.model, a = n.getFastModel();
358
358
  try {
359
359
  a !== i && (n.model = a);
360
360
  let e = await n.generateCompletion({
@@ -362,7 +362,7 @@ var A = class e {
362
362
  maxTokens: 50,
363
363
  temperature: .7
364
364
  }, null);
365
- return se(e.text);
365
+ return oe(e.text);
366
366
  } finally {
367
367
  a !== i && (n.model = i);
368
368
  }
@@ -657,7 +657,7 @@ var M = class {
657
657
  }, N = (e) => e.replace(/\s+/g, "");
658
658
  function P(e) {
659
659
  if (!e) return;
660
- let t = te();
660
+ let t = ee();
661
661
  return t.connections[e] || t.connectionByName(e);
662
662
  }
663
663
  var F = k("dashboards", {
@@ -711,7 +711,7 @@ var F = k("dashboards", {
711
711
  newDashboard(e, t) {
712
712
  let n = e;
713
713
  if (Object.values(this.dashboards).some((t) => t.name === e)) throw Error(`A dashboard with name ${e} already exists.`);
714
- let r = P(t), i = new s({
714
+ let r = P(t), i = new a({
715
715
  id: n,
716
716
  name: e,
717
717
  connection: r?.name || t,
@@ -730,7 +730,7 @@ var F = k("dashboards", {
730
730
  if (!t) throw Error(`Dashboard with ID "${e}" not found.`);
731
731
  let n = `${t.name} (copy)`, r = 1;
732
732
  for (; Object.values(this.dashboards).some((e) => e.name === n);) n = `${t.name} (copy ${r})`, r++;
733
- let i = new s({
733
+ let i = new a({
734
734
  id: n,
735
735
  name: n,
736
736
  connection: t.connection,
@@ -750,7 +750,7 @@ var F = k("dashboards", {
750
750
  if (!n) throw Error(`Dashboard with ID "${e}" not found.`);
751
751
  let r = `${n.name} / ${t}`, i = 1;
752
752
  for (; this.dashboards[r];) r = `${n.name} / ${t} (${i})`, i++;
753
- let a = new s({
753
+ let o = new a({
754
754
  id: r,
755
755
  name: r,
756
756
  connection: n.connection,
@@ -762,12 +762,12 @@ var F = k("dashboards", {
762
762
  investigationCreatedFrom: { timestamp: /* @__PURE__ */ new Date() },
763
763
  description: n.description
764
764
  });
765
- return a.gridItems = Object.fromEntries(Object.entries(n.gridItems).map(([e, t]) => [e, {
765
+ return o.gridItems = Object.fromEntries(Object.entries(n.gridItems).map(([e, t]) => [e, {
766
766
  ...t,
767
767
  chartFilters: [],
768
768
  conceptFilters: [],
769
769
  filters: []
770
- }])), a.layout = n.layout.map((e) => ({ ...e })), a.imports = n.imports.map((e) => ({ ...e })), a.filter = n.filter, a.nextId = n.nextId, a.changed = !0, n.children ||= [], n.children.push(r), n.changed = !0, this.addDashboard(a), this.activeDashboardId = r, a;
770
+ }])), o.layout = n.layout.map((e) => ({ ...e })), o.imports = n.imports.map((e) => ({ ...e })), o.filter = n.filter, o.nextId = n.nextId, o.changed = !0, n.children ||= [], n.children.push(r), n.changed = !0, this.addDashboard(o), this.activeDashboardId = r, o;
771
771
  },
772
772
  promoteDashboard(e) {
773
773
  let t = this.dashboards[e];
@@ -789,7 +789,7 @@ var F = k("dashboards", {
789
789
  },
790
790
  loadDashboards(e) {
791
791
  Object.entries(e).forEach(([e, t]) => {
792
- this.dashboards[e] = s.fromSerialized(t);
792
+ this.dashboards[e] = a.fromSerialized(t);
793
793
  });
794
794
  },
795
795
  removeAllFilters(e) {
@@ -954,15 +954,15 @@ var F = k("dashboards", {
954
954
  }), e;
955
955
  },
956
956
  async warmDashboardQueries(e, t, n) {
957
- let r = this.dashboards[e];
958
- if (r) {
959
- for (let e of Object.values(r.gridItems)) if (e.type === a.CHART || e.type === a.TABLE) {
960
- let i = typeof e.content == "string" ? e.content : e.content?.query || "";
961
- await t?.generateQuery(r.connectionId || r.connection, {
962
- text: i,
957
+ let i = this.dashboards[e];
958
+ if (i) {
959
+ for (let e of Object.values(i.gridItems)) if (e.type === r.CHART || e.type === r.TABLE) {
960
+ let r = typeof e.content == "string" ? e.content : e.content?.query || "";
961
+ await t?.generateQuery(i.connectionId || i.connection, {
962
+ text: r,
963
963
  editorType: "trilogy",
964
- imports: r.imports,
965
- extraContent: r.imports.map((e) => ({
964
+ imports: i.imports,
965
+ extraContent: i.imports.map((e) => ({
966
966
  alias: e.name,
967
967
  contents: n.editors[e.id]?.contents || n.editors[e.name]?.contents || ""
968
968
  }))
@@ -989,18 +989,18 @@ var F = k("dashboards", {
989
989
  async populateAIConcepts(e, t, n) {
990
990
  let r = await this.populateCompletion(e, t, n);
991
991
  if (!r) throw Error(`No completion items found for dashboard ID "${e}".`);
992
- return m(r);
992
+ return l(r);
993
993
  },
994
994
  async generatePromptSpec(e, t, n, r) {
995
- let i = await this.populateAIConcepts(this.activeDashboardId, n, r), a = await t.generateDashboardCompletion(e, d, i, 3);
995
+ let i = await this.populateAIConcepts(this.activeDashboardId, n, r), a = await t.generateDashboardCompletion(e, o, i, 3);
996
996
  if (!a) throw Error("No response from LLM");
997
- return d(a);
997
+ return o(a);
998
998
  },
999
- async populateFromPromptSpec(e, t, n, r, i) {
999
+ async populateFromPromptSpec(e, t, n, i, a) {
1000
1000
  let o = this.dashboards[e];
1001
1001
  if (!o) throw Error(`Dashboard with ID "${e}" not found.`);
1002
1002
  o.name = t.name, o.description = t.description;
1003
- let s = await this.populateAIConcepts(e, r, i);
1003
+ let s = await this.populateAIConcepts(e, i, a);
1004
1004
  if (!s) throw Error(`No completion items found for dashboard ID "${e}".`);
1005
1005
  let c = async (e) => {
1006
1006
  let t = {
@@ -1009,25 +1009,25 @@ var F = k("dashboards", {
1009
1009
  imports: o.imports,
1010
1010
  extraContent: o.imports.map((e) => ({
1011
1011
  alias: e.name,
1012
- contents: i.editors[e.id]?.contents || i.editors[e.name]?.contents || ""
1012
+ contents: a.editors[e.id]?.contents || a.editors[e.name]?.contents || ""
1013
1013
  }))
1014
1014
  };
1015
- return await (await r.executeQuery(o.connectionId || o.connection, t, () => {}, () => {}, (e) => {
1015
+ return await (await i.executeQuery(o.connectionId || o.connection, t, () => {}, () => {}, (e) => {
1016
1016
  throw e;
1017
1017
  }, () => !0, !0)).resultPromise, !0;
1018
1018
  }, l = /* @__PURE__ */ new Map();
1019
1019
  for (let n of t.layout) {
1020
- let r = t.gridItems[n.id], i = r.content, o = r.type.toLowerCase();
1021
- [a.CHART, a.TABLE].includes(o) && (i = `Placeholder, prompt: ${i}`);
1022
- let s = this.addItemToDashboard(e, "markdown", n.x, n.y, n.w, n.h, i, r.name);
1020
+ let i = t.gridItems[n.id], a = i.content, o = i.type.toLowerCase();
1021
+ [r.CHART, r.TABLE].includes(o) && (a = `Placeholder, prompt: ${a}`);
1022
+ let s = this.addItemToDashboard(e, "markdown", n.x, n.y, n.w, n.h, a, i.name);
1023
1023
  l.set(s, {
1024
1024
  type: o,
1025
- content: i
1025
+ content: a
1026
1026
  });
1027
1027
  }
1028
1028
  for (let t of l) {
1029
- let r = t[0], i = t[1], o = i.content;
1030
- [a.CHART, a.TABLE].includes(i.type) && (o = (await n.generateQueryCompletion(i.content, s, c)).content || "No query could be generated"), await this.updateItemContent(e, r, o), await this.updateItemType(e, r, i.type);
1029
+ let i = t[0], a = t[1], o = a.content;
1030
+ [r.CHART, r.TABLE].includes(a.type) && (o = (await n.generateQueryCompletion(a.content, s, c)).content || "No query could be generated"), await this.updateItemContent(e, i, o), await this.updateItemType(e, i, a.type);
1031
1031
  }
1032
1032
  }
1033
1033
  }
@@ -1040,7 +1040,7 @@ var F = k("dashboards", {
1040
1040
  };
1041
1041
  }, ge = (e) => {
1042
1042
  let t = e instanceof Error ? e.message : "Failed to fetch state";
1043
- return e instanceof S ? e.status === 401 ? "Authentication required. Set this store’s token to read state." : e.status === 400 && /directory/i.test(t) ? `${t} Directory state requires a Trilogy server on 0.3.306 or newer.` : t : t;
1043
+ return e instanceof x ? e.status === 401 ? "Authentication required. Set this store’s token to read state." : e.status === 400 && /directory/i.test(t) ? `${t} Directory state requires a Trilogy server on 0.3.306 or newer.` : t : t;
1044
1044
  }, B = (e) => [...e].sort((e, t) => t.submittedAt - e.submittedAt), _e = k("jobsApi", {
1045
1045
  state: () => ({
1046
1046
  filesByStore: {},
@@ -1057,11 +1057,11 @@ var F = k("dashboards", {
1057
1057
  }),
1058
1058
  actions: {
1059
1059
  getGenericStore(e) {
1060
- let t = _().stores.find((t) => t.id === e);
1060
+ let t = g().stores.find((t) => t.id === e);
1061
1061
  return !t || t.type !== "generic" ? null : t;
1062
1062
  },
1063
1063
  getGenericStores() {
1064
- return _().stores.filter((e) => e.type === "generic");
1064
+ return g().stores.filter((e) => e.type === "generic");
1065
1065
  },
1066
1066
  getStoreJobs(e) {
1067
1067
  return B(this.jobsByStore[e] || []);
@@ -1107,7 +1107,7 @@ var F = k("dashboards", {
1107
1107
  }), delete this.filesByStore[e], delete this.jobsByStore[e], delete this.errors[e], delete this.storeStatus[e], delete this.loadingByStore[e], this.clearStateForStore(e), this.saveJobsToStorage();
1108
1108
  },
1109
1109
  clearStateForStore(e) {
1110
- let t = (t) => y(t)?.storeId === e, n = (e) => {
1110
+ let t = (t) => v(t)?.storeId === e, n = (e) => {
1111
1111
  Object.keys(e).filter(t).forEach((t) => delete e[t]);
1112
1112
  };
1113
1113
  n(this.stateByTarget), n(this.stateLoadingByTarget), n(this.stateErrorsByTarget);
@@ -1117,7 +1117,7 @@ var F = k("dashboards", {
1117
1117
  },
1118
1118
  refreshLoadedStateForTarget(e, t) {
1119
1119
  Object.keys(this.stateByTarget).forEach((n) => {
1120
- let r = y(n);
1120
+ let r = v(n);
1121
1121
  r && r.storeId === e && re(r.target, t) && this.fetchStateForTarget(e, r.target);
1122
1122
  });
1123
1123
  },
@@ -1128,7 +1128,7 @@ var F = k("dashboards", {
1128
1128
  if (!this.stateLoadingByTarget[i]) {
1129
1129
  this.stateLoadingByTarget[i] = !0, delete this.stateErrorsByTarget[i];
1130
1130
  try {
1131
- let e = await x(r, t, n);
1131
+ let e = await b(r, t, n);
1132
1132
  this.stateByTarget[i] = {
1133
1133
  snapshot: e.snapshot,
1134
1134
  cached: e.cached,
@@ -1142,7 +1142,7 @@ var F = k("dashboards", {
1142
1142
  }
1143
1143
  },
1144
1144
  async initialize() {
1145
- _().loadStoresFromStorage(), this.loadJobsFromStorage(), this.resumePolling(), await this.refreshAllStores();
1145
+ g().loadStoresFromStorage(), this.loadJobsFromStorage(), this.resumePolling(), await this.refreshAllStores();
1146
1146
  },
1147
1147
  saveJobsToStorage() {
1148
1148
  try {
@@ -1189,7 +1189,7 @@ var F = k("dashboards", {
1189
1189
  if (t) {
1190
1190
  this.loadingByStore[e] = !0, this.storeStatus[e] = "idle";
1191
1191
  try {
1192
- this.filesByStore[e] = await v(t), delete this.errors[e], this.storeStatus[e] = "connected";
1192
+ this.filesByStore[e] = await _(t), delete this.errors[e], this.storeStatus[e] = "connected";
1193
1193
  } catch (t) {
1194
1194
  let n = t instanceof Error ? t.message : "Failed to fetch files";
1195
1195
  this.errors[e] = n, this.storeStatus[e] = "failed";
@@ -1261,7 +1261,7 @@ var F = k("dashboards", {
1261
1261
  let i = R(e, t, n);
1262
1262
  this.submittingByTarget[i] = !0;
1263
1263
  try {
1264
- let i = await ee(r, n, t), a = this.buildLocalJob(e, t, n, i);
1264
+ let i = await C(r, n, t), a = this.buildLocalJob(e, t, n, i);
1265
1265
  return this.upsertJob(e, a), delete this.errors[e], this.storeStatus[e] = "connected", a.status === "running" && this.startPolling(e, a.job_id), a;
1266
1266
  } catch (r) {
1267
1267
  let i = r instanceof Error ? r.message : `Failed to ${n} ${t}`;
@@ -1280,11 +1280,11 @@ var F = k("dashboards", {
1280
1280
  return;
1281
1281
  }
1282
1282
  try {
1283
- let n = await b(r, t), a = this.buildLocalJob(e, i.target, i.operation, n, i.submittedAt);
1283
+ let n = await y(r, t), a = this.buildLocalJob(e, i.target, i.operation, n, i.submittedAt);
1284
1284
  this.upsertJob(e, a), a.status !== "running" && (this.stopPolling(e, t), this.fetchFilesForStore(e), this.refreshLoadedStateForTarget(e, a.target));
1285
1285
  } catch (n) {
1286
1286
  let r = n instanceof Error ? n.message : `Failed to poll job ${t}`;
1287
- n instanceof S && n.status === 401 ? this.pauseJobPolling(e, t, "auth-paused", "Polling paused: authentication required. Update the store token to resume tracking.") : n instanceof S && n.status === 404 ? this.pauseJobPolling(e, t, "not-found", "Polling stopped: job was not found on the server.") : this.pauseJobPolling(e, t, "stopped", `Polling stopped locally. ${r}`);
1287
+ n instanceof x && n.status === 401 ? this.pauseJobPolling(e, t, "auth-paused", "Polling paused: authentication required. Update the store token to resume tracking.") : n instanceof x && n.status === 404 ? this.pauseJobPolling(e, t, "not-found", "Polling stopped: job was not found on the server.") : this.pauseJobPolling(e, t, "stopped", `Polling stopped locally. ${r}`);
1288
1288
  } finally {
1289
1289
  delete this.pollingByJob[n];
1290
1290
  }
@@ -1299,7 +1299,7 @@ var F = k("dashboards", {
1299
1299
  }
1300
1300
  this.stoppingByJob[n] = !0, this.stopPolling(e, t), delete this.pollingByJob[n];
1301
1301
  try {
1302
- let n = await C(r, t), a = this.buildLocalJob(e, i.target, i.operation, n, i.submittedAt);
1302
+ let n = await S(r, t), a = this.buildLocalJob(e, i.target, i.operation, n, i.submittedAt);
1303
1303
  a.status === "running" && (a.pollingState = "stopped", a.pollingError = "Cancel requested. Polling stopped locally."), this.upsertJob(e, a);
1304
1304
  } catch (n) {
1305
1305
  let r = n instanceof Error ? n.message : `Failed to cancel job ${t}`, a = {
@@ -1446,7 +1446,7 @@ function ye(e) {
1446
1446
  //#endregion
1447
1447
  //#region stores/useScreenNavigation.ts
1448
1448
  var be = () => {
1449
- let e = F(), t = ae(), n = f(), r = _(), i = ne(), a = null, o = {
1449
+ let e = F(), t = ae(), n = ne(), r = g(), i = te(), a = null, o = {
1450
1450
  activeScreen: O(H(V.SCREEN, "")),
1451
1451
  activeSidebarScreen: O(H(V.SIDEBAR_SCREEN, "editors")),
1452
1452
  activeEditor: O(H(V.EDITORS, "")),
@@ -1515,29 +1515,29 @@ var be = () => {
1515
1515
  return e[e.length - 1] || n;
1516
1516
  }
1517
1517
  }
1518
- return oe(o, null);
1518
+ return E(o, null);
1519
1519
  }, d = (e, t, n) => {
1520
1520
  let r = o.tabs.value.find((t) => t.screen === e && t.address === n);
1521
1521
  r && (r.title = u(e, t, n));
1522
- }, p = (e, t, n, r = !1) => {
1522
+ }, f = (e, t, n, r = !1) => {
1523
1523
  let i = o.tabs.value.find((t) => t.screen === e && t.address === n);
1524
1524
  if (i) {
1525
- y(i.id, r);
1525
+ v(i.id, r);
1526
1526
  return;
1527
1527
  }
1528
1528
  let a = o.tabs.value.reduce((e, t) => {
1529
1529
  let n = parseInt(t.id.replace("tab-", ""));
1530
1530
  return isNaN(n) ? e : Math.max(e, n);
1531
1531
  }, 0);
1532
- r || b(e);
1532
+ r || y(e);
1533
1533
  let s = u(e, t, n), c = {
1534
1534
  id: `tab-${++a}`,
1535
1535
  title: s,
1536
1536
  screen: e,
1537
1537
  address: n
1538
1538
  };
1539
- o.tabs.value.push(c), y(c.id, r);
1540
- }, m = (e, t = null) => {
1539
+ o.tabs.value.push(c), v(c.id, r);
1540
+ }, p = (e, t = null) => {
1541
1541
  if (!e && !t) return;
1542
1542
  if (!e && t) {
1543
1543
  let n = o.tabs.value.find((e) => e.address === t);
@@ -1550,28 +1550,28 @@ var be = () => {
1550
1550
  if (o.tabs.value.splice(n, 1), t) {
1551
1551
  if (o.tabs.value.length > 0) {
1552
1552
  let e = n > 0 ? n - 1 : 0;
1553
- y(o.tabs.value[e].id);
1554
- } else p("welcome", "Welcome", "welcome");
1553
+ v(o.tabs.value[e].id);
1554
+ } else f("welcome", "Welcome", "welcome");
1555
1555
  }
1556
1556
  }
1557
- g();
1558
- }, h = (e) => {
1557
+ h();
1558
+ }, m = (e) => {
1559
1559
  let t = o.activeTab.value === e;
1560
- o.tabs.value = o.tabs.value.filter((t) => t.id === e), t || (o.tabs.value.length > 0 ? y(o.tabs.value[0].id) : p("welcome", "Welcome", "welcome")), g();
1561
- }, g = () => {
1560
+ o.tabs.value = o.tabs.value.filter((t) => t.id === e), t || (o.tabs.value.length > 0 ? v(o.tabs.value[0].id) : f("welcome", "Welcome", "welcome")), h();
1561
+ }, h = () => {
1562
1562
  let e = o.tabs.value.map((e) => e.screen), t = [];
1563
1563
  e.includes("editors") || (o.activeEditor.value = "", t.push(V.EDITORS), t.push(V.ACTIVE_EDITOR_TAB)), e.includes("dashboard") || (o.activeDashboard.value = "", t.push(V.DASHBOARD)), e.includes("connections") || (o.activeConnectionKey.value = "", t.push(V.CONNECTIONS)), e.includes("models") || (o.activeModelKey.value = "", t.push(V.MODELS)), e.includes("community-models") || (o.activeCommunityModelKey.value = "", t.push(V.COMMUNITY_MODELS)), e.includes("jobs") || (o.activeJobsKey.value = "", t.push(V.JOBS)), e.includes("tutorial") || (o.activeDocumentationKey.value = "", t.push(V.TUTORIAL)), e.includes("llms") || (o.activeLLMConnectionKey.value = "", t.push(V.LLMS)), e.includes("settings") || t.push(V.SETTINGS), e.includes("profile") || t.push(V.PROFILE), e.includes("welcome") || t.push(V.WELCOME), ye(t);
1564
- }, v = (e) => {
1564
+ }, _ = (e) => {
1565
1565
  let t = o.tabs.value.findIndex((t) => t.id === e);
1566
1566
  if (t !== -1) {
1567
1567
  let e = o.tabs.value.findIndex((e) => e.id === o.activeTab.value) > t;
1568
- o.tabs.value.splice(t + 1), e && (o.tabs.value.length > 0 ? y(o.tabs.value[o.tabs.value.length - 1].id) : p("welcome", "Welcome", "welcome"));
1568
+ o.tabs.value.splice(t + 1), e && (o.tabs.value.length > 0 ? v(o.tabs.value[o.tabs.value.length - 1].id) : f("welcome", "Welcome", "welcome"));
1569
1569
  }
1570
- g();
1571
- }, y = (r, a = !1) => {
1570
+ h();
1571
+ }, v = (r, a = !1) => {
1572
1572
  let s = o.tabs.value.find((e) => e.id === r);
1573
1573
  if (s) {
1574
- o.activeTab.value = r, b(s.screen), l(s.screen, a);
1574
+ o.activeTab.value = r, y(s.screen), l(s.screen, a);
1575
1575
  let c = n.getUnreadTips(ce);
1576
1576
  if (s.screen === "editors") o.activeEditor.value = s.address, t.activeEditorId = s.address, c = c.concat(n.getUnreadTips(le));
1577
1577
  else if (s.screen === "dashboard") o.activeDashboard.value = s.address, e.activeDashboardId = s.address, c = o.fullScreen.value ? [] : c.concat(n.getUnreadTips(ue));
@@ -1586,10 +1586,10 @@ var be = () => {
1586
1586
  } else s.screen === "tutorial" ? o.activeDocumentationKey.value = s.address : s.screen === "models" ? o.activeModelKey.value = s.address : s.screen === "dashboard-import" || s.screen === "asset-import" ? c = [] : s.screen === "community-models" ? (o.activeCommunityModelKey.value = s.address, c = c.concat(n.getUnreadTips(de))) : s.screen === "jobs" && (o.activeJobsKey.value = s.address);
1587
1587
  o.mobileMenuOpen.value = !1, o.displayedTips.value = c, o.showTipModal.value = c.length > 0, s.address && !a && U(s.screen, s.address);
1588
1588
  }
1589
- }, b = (e) => {
1589
+ }, y = (e) => {
1590
1590
  o.activeScreen.value !== e && (o.activeScreen.value = e, U(V.SCREEN, e));
1591
- }, x = (e) => {
1592
- c(e), e == "settings" ? p("settings", "Settings", "settings") : e == "profile" && p("profile", "Profile", "profile");
1591
+ }, b = (e) => {
1592
+ c(e), e == "settings" ? f("settings", "Settings", "settings") : e == "profile" && f("profile", "Profile", "profile");
1593
1593
  };
1594
1594
  return {
1595
1595
  get activeScreen() {
@@ -1649,28 +1649,28 @@ var be = () => {
1649
1649
  get fullScreen() {
1650
1650
  return o.fullScreen;
1651
1651
  },
1652
- setActiveScreen: b,
1653
- setActiveSidebarScreen: x,
1652
+ setActiveScreen: y,
1653
+ setActiveSidebarScreen: b,
1654
1654
  setActiveEditor: (e) => {
1655
1655
  if (e === null) {
1656
1656
  W(V.EDITORS), o.activeEditor.value = "";
1657
1657
  return;
1658
1658
  }
1659
- p("editors", null, e);
1659
+ f("editors", null, e);
1660
1660
  },
1661
1661
  setActiveDashboard: (e) => {
1662
1662
  if (e === null) {
1663
1663
  W(V.DASHBOARD), o.activeDashboard.value = "";
1664
1664
  return;
1665
1665
  }
1666
- p("dashboard", null, e);
1666
+ f("dashboard", null, e);
1667
1667
  },
1668
1668
  setActiveConnectionKey: (e) => {
1669
1669
  if (e === null) {
1670
1670
  W(V.CONNECTIONS), o.activeConnectionKey.value = "";
1671
1671
  return;
1672
1672
  }
1673
- p("connections", null, e);
1673
+ f("connections", null, e);
1674
1674
  },
1675
1675
  setActiveDocumentationKey: (e) => {
1676
1676
  if (e === null) {
@@ -1678,28 +1678,28 @@ var be = () => {
1678
1678
  return;
1679
1679
  }
1680
1680
  let t = e.split("+");
1681
- p("tutorial", t[t.length - 1], e);
1681
+ f("tutorial", t[t.length - 1], e);
1682
1682
  },
1683
1683
  setActiveLLMConnectionKey: (e) => {
1684
1684
  if (e === null) {
1685
1685
  W(V.LLMS), o.activeLLMConnectionKey.value = "";
1686
1686
  return;
1687
1687
  }
1688
- p("llms", null, e);
1688
+ f("llms", null, e);
1689
1689
  },
1690
1690
  setActiveCommunityModelKey: (e) => {
1691
1691
  if (e === null) {
1692
1692
  W(V.COMMUNITY_MODELS), o.activeCommunityModelKey.value = "";
1693
1693
  return;
1694
1694
  }
1695
- o.activeCommunityModelKey.value = e, p("community-models", null, e);
1695
+ o.activeCommunityModelKey.value = e, f("community-models", null, e);
1696
1696
  },
1697
1697
  setActiveJobsKey: (e) => {
1698
1698
  if (e === null) {
1699
1699
  W(V.JOBS), o.activeJobsKey.value = "";
1700
1700
  return;
1701
1701
  }
1702
- o.activeJobsKey.value = e, p("jobs", null, e);
1702
+ o.activeJobsKey.value = e, f("jobs", null, e);
1703
1703
  },
1704
1704
  toggleMobileMenu: () => {
1705
1705
  o.mobileMenuOpen.value = !o.mobileMenuOpen.value;
@@ -1711,12 +1711,12 @@ var be = () => {
1711
1711
  }
1712
1712
  U(V.MODELS, e), o.activeModelKey.value = e;
1713
1713
  },
1714
- setActiveTab: y,
1715
- openTab: p,
1714
+ setActiveTab: v,
1715
+ openTab: f,
1716
1716
  updateTabName: d,
1717
- closeTab: m,
1718
- closeOtherTabsExcept: h,
1719
- closeTabsToRightOf: v,
1717
+ closeTab: p,
1718
+ closeOtherTabsExcept: m,
1719
+ closeTabsToRightOf: _,
1720
1720
  onInitialLoad: () => {
1721
1721
  let e = o.modelImport.value, t = o.connectionImport.value, r = "editors", i = !1;
1722
1722
  H(V.SKIP_TIPS, "") === "true" && n.updateSetting("skipAllTips", !0);
@@ -1725,61 +1725,61 @@ var be = () => {
1725
1725
  "1",
1726
1726
  "yes"
1727
1727
  ].includes(H(V.REMOTE, "").toLowerCase()) && !!H(V.STORE, "") && !!(s || c);
1728
- (e && t || l) && (a && s ? p("asset-import", null, "asset-import") : p("dashboard-import", null, "dashboard-import"), i = !0);
1729
- let u = o.activeScreen.value, d = o.activeSidebarScreen.value, f = [];
1730
- o.activeEditor.value && !i && f.push({
1728
+ (e && t || l) && (a && s ? f("asset-import", null, "asset-import") : f("dashboard-import", null, "dashboard-import"), i = !0);
1729
+ let u = o.activeScreen.value, d = o.activeSidebarScreen.value, p = [];
1730
+ o.activeEditor.value && !i && p.push({
1731
1731
  screen: "editors",
1732
1732
  title: null,
1733
1733
  key: o.activeEditor.value,
1734
1734
  isActive: u === "editors"
1735
- }), o.activeDashboard.value && !i && f.push({
1735
+ }), o.activeDashboard.value && !i && p.push({
1736
1736
  screen: "dashboard",
1737
1737
  title: null,
1738
1738
  key: o.activeDashboard.value,
1739
1739
  isActive: u === "dashboard"
1740
- }), o.activeConnectionKey.value && !i && f.push({
1740
+ }), o.activeConnectionKey.value && !i && p.push({
1741
1741
  screen: "connections",
1742
1742
  title: null,
1743
1743
  key: o.activeConnectionKey.value,
1744
1744
  isActive: u === "connections"
1745
- }), o.activeModelKey.value && !i && f.push({
1745
+ }), o.activeModelKey.value && !i && p.push({
1746
1746
  screen: "models",
1747
1747
  title: null,
1748
1748
  key: o.activeModelKey.value,
1749
1749
  isActive: u === "models"
1750
- }), o.activeCommunityModelKey.value && !i && f.push({
1750
+ }), o.activeCommunityModelKey.value && !i && p.push({
1751
1751
  screen: "community-models",
1752
1752
  title: null,
1753
1753
  key: o.activeCommunityModelKey.value,
1754
1754
  isActive: u === "community-models"
1755
- }), o.activeJobsKey.value && !i && f.push({
1755
+ }), o.activeJobsKey.value && !i && p.push({
1756
1756
  screen: "jobs",
1757
1757
  title: null,
1758
1758
  key: o.activeJobsKey.value,
1759
1759
  isActive: u === "jobs"
1760
- }), o.activeDocumentationKey.value && !i && f.push({
1760
+ }), o.activeDocumentationKey.value && !i && p.push({
1761
1761
  screen: "tutorial",
1762
1762
  title: null,
1763
1763
  key: o.activeDocumentationKey.value,
1764
1764
  isActive: u === "tutorial"
1765
- }), o.activeLLMConnectionKey.value && !i && f.push({
1765
+ }), o.activeLLMConnectionKey.value && !i && p.push({
1766
1766
  screen: "llms",
1767
1767
  title: null,
1768
1768
  key: o.activeLLMConnectionKey.value,
1769
1769
  isActive: u === "llms"
1770
- }), o.activeSidebarScreen.value === "settings" && f.push({
1770
+ }), o.activeSidebarScreen.value === "settings" && p.push({
1771
1771
  screen: "settings",
1772
1772
  title: "Settings",
1773
1773
  key: "settings",
1774
1774
  isActive: u === "settings"
1775
- }), o.activeSidebarScreen.value === "profile" && f.push({
1775
+ }), o.activeSidebarScreen.value === "profile" && p.push({
1776
1776
  screen: "profile",
1777
1777
  title: "Profile",
1778
1778
  key: "profile",
1779
1779
  isActive: u === "profile"
1780
- }), f.sort((e, t) => e.isActive ? 1 : t.isActive ? -1 : 0), f.forEach((e) => {
1781
- p(e.screen, e.title, e.key, !0);
1782
- }), b(u), !d && f.length > 0 ? r = f[f.length - 1].screen : d && (r = d), x(r);
1780
+ }), p.sort((e, t) => e.isActive ? 1 : t.isActive ? -1 : 0), p.forEach((e) => {
1781
+ f(e.screen, e.title, e.key, !0);
1782
+ }), y(u), !d && p.length > 0 ? r = p[p.length - 1].screen : d && (r = d), b(r);
1783
1783
  },
1784
1784
  toggleFullScreen: (e) => {
1785
1785
  o.fullScreen.value = e;
@@ -1787,8 +1787,8 @@ var be = () => {
1787
1787
  addBackListeners: () => {
1788
1788
  a ||= window.addEventListener("hashchange", () => {
1789
1789
  let e = H(V.EDITORS, ""), t = H(V.DASHBOARD, ""), n = H(V.CONNECTIONS, ""), r = H(V.MODELS, ""), i = H(V.COMMUNITY_MODELS, ""), a = H(V.JOBS, ""), s = H(V.TUTORIAL, ""), c = H(V.LLMS, ""), l = H(V.SCREEN, ""), u = H(V.SIDEBAR_SCREEN, ""), d = !1;
1790
- u !== o.activeSidebarScreen.value && x(u), l !== o.activeScreen.value && (o.activeScreen.value = l, d = !0);
1791
- let f = [
1790
+ u !== o.activeSidebarScreen.value && b(u), l !== o.activeScreen.value && (o.activeScreen.value = l, d = !0);
1791
+ let p = [
1792
1792
  {
1793
1793
  hash: e,
1794
1794
  screen: "editors",
@@ -1830,14 +1830,14 @@ var be = () => {
1830
1830
  current: o.activeLLMConnectionKey.value
1831
1831
  }
1832
1832
  ];
1833
- for (let { hash: e, screen: t, current: n } of f) if (e && e !== n || t === l && d) {
1833
+ for (let { hash: e, screen: t, current: n } of p) if (e && e !== n || t === l && d) {
1834
1834
  let n = o.tabs.value.find((n) => n.screen === t && n.screen === l && n.address === e);
1835
1835
  if (n && n.id !== o.activeTab.value) {
1836
- y(n.id, !0);
1836
+ v(n.id, !0);
1837
1837
  break;
1838
1838
  }
1839
1839
  if (!n && e) {
1840
- p(t, null, e);
1840
+ f(t, null, e);
1841
1841
  break;
1842
1842
  }
1843
1843
  }
@@ -2141,163 +2141,163 @@ var je = class {
2141
2141
  resultPromise: this.executeQueriesBatchInternal(e, t, n, r, i || [], a, f, p, o, s, c, l, u, d)
2142
2142
  };
2143
2143
  }
2144
- async executeQueriesBatchInternal(e, n, r, i = [], a, o = {}, s, c, l, u, d, f, p = !1, m) {
2145
- l && l();
2146
- let h = this.connectionProvider.getConnection(e);
2147
- if (!h) return {
2144
+ async executeQueriesBatchInternal(e, t, n, r = [], i, a = {}, o, s, c, l, u, d, f = !1, p) {
2145
+ c && c();
2146
+ let m = this.connectionProvider.getConnection(e);
2147
+ if (!m) return {
2148
2148
  success: !1,
2149
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
2150
- results: n.map((n) => ({
2149
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
2150
+ results: t.map((t) => ({
2151
2151
  success: !1,
2152
2152
  generated_sql: "",
2153
2153
  columns: [],
2154
2154
  error: `Connection ${e} not found.`,
2155
2155
  executionTime: 0,
2156
- results: new t(/* @__PURE__ */ new Map(), []),
2156
+ results: new h(/* @__PURE__ */ new Map(), []),
2157
2157
  resultSize: 0,
2158
2158
  columnCount: 0
2159
2159
  }))
2160
2160
  };
2161
- if (p) return {
2161
+ if (f) return {
2162
2162
  success: !0,
2163
- results: n.map((e) => ({
2163
+ results: t.map((e) => ({
2164
2164
  success: !0,
2165
2165
  generated_sql: e.query,
2166
2166
  columns: [],
2167
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
2168
- results: new t(/* @__PURE__ */ new Map(), []),
2167
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
2168
+ results: new h(/* @__PURE__ */ new Map(), []),
2169
2169
  resultSize: 0,
2170
2170
  columnCount: 0
2171
2171
  })),
2172
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s
2172
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o
2173
2173
  };
2174
- if (!h.isConnected()) try {
2175
- u && u({
2174
+ if (!m.isConnected()) try {
2175
+ l && l({
2176
2176
  message: "Connection is not active... Attempting to automatically reconnect.",
2177
2177
  error: !0
2178
- }), await this.connectionProvider.ensureConnected(e), u && u({
2178
+ }), await this.connectionProvider.ensureConnected(e), l && l({
2179
2179
  message: "Reconnect Successful",
2180
2180
  running: !0
2181
2181
  });
2182
2182
  } catch {
2183
- return d && Object.values(d).forEach((e) => e({
2183
+ return u && Object.values(u).forEach((e) => e({
2184
2184
  message: "Connection failed to reconnect.",
2185
2185
  error: !0,
2186
2186
  running: !1
2187
2187
  })), {
2188
2188
  success: !1,
2189
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
2190
- results: n.map((n) => ({
2189
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
2190
+ results: t.map((t) => ({
2191
2191
  success: !1,
2192
2192
  generated_sql: "",
2193
2193
  columns: [],
2194
2194
  error: `Connection ${e} not active, failed to reconnect.`,
2195
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
2196
- results: new t(/* @__PURE__ */ new Map(), []),
2195
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
2196
+ results: new h(/* @__PURE__ */ new Map(), []),
2197
2197
  columnCount: 0,
2198
2198
  resultSize: 0
2199
2199
  }))
2200
2200
  };
2201
2201
  }
2202
2202
  let g = this.connectionProvider.getConnectionSources(e);
2203
- m && (g = g.concat(m));
2204
- let _ = this.resolveRegisteredFiles(e, h), v = this.connectionProvider.getConnectionWorkingPath?.(e) ?? null;
2203
+ p && (g = g.concat(p));
2204
+ let _ = this.resolveRegisteredFiles(e, m), v = this.connectionProvider.getConnectionWorkingPath?.(e) ?? null;
2205
2205
  try {
2206
- let o = await Promise.race([this.trilogyResolver.resolve_queries_batch(n, h.queryType, g, i, a, null, _.length > 0 ? _ : null, v), new Promise((e, t) => {
2207
- c.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query batch cancelled by user")));
2208
- })]), l = [];
2209
- if (o && Array.isArray(o.data.queries)) for (let i = 0; i < o.data.queries.length; i++) {
2210
- let u = o.data.queries[i];
2211
- if (u.generated_sql) {
2212
- let o = {
2213
- ...n[i]?.parameters || {},
2214
- ...u.parameters || {}
2215
- }, p = Object.keys(o).length ? o : null;
2206
+ let a = await Promise.race([this.trilogyResolver.resolve_queries_batch(t, m.queryType, g, r, i, null, _.length > 0 ? _ : null, v), new Promise((e, t) => {
2207
+ s.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query batch cancelled by user")));
2208
+ })]), c = [];
2209
+ if (a && Array.isArray(a.data.queries)) for (let r = 0; r < a.data.queries.length; r++) {
2210
+ let l = a.data.queries[r];
2211
+ if (l.generated_sql) {
2212
+ let a = {
2213
+ ...t[r]?.parameters || {},
2214
+ ...l.parameters || {}
2215
+ }, f = Object.keys(a).length ? a : null;
2216
2216
  try {
2217
- let t = await Promise.race([h.executeSql(u.generated_sql, p), new Promise((e, t) => {
2218
- c.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query execution cancelled by user")));
2217
+ let u = await Promise.race([m.executeSql(l.generated_sql, f), new Promise((e, t) => {
2218
+ s.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query execution cancelled by user")));
2219
2219
  })]);
2220
- w(r) && this.enrichTrilogyColumns(u.columns || [], t);
2221
- let d = Y(u.chart), m = await this.executeChartLayers(h, u.chart, t, o, c, r), g = {
2220
+ w(n) && this.enrichTrilogyColumns(l.columns || [], u);
2221
+ let p = Y(l.chart), h = await this.executeChartLayers(m, l.chart, u, a, s, n), g = {
2222
2222
  success: !0,
2223
- generatedSql: u.generated_sql,
2224
- results: t,
2225
- resultSize: t.data.length,
2226
- columnCount: t.headers.size,
2227
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
2228
- chartConfig: d?.config,
2229
- chartWarnings: d?.warnings.length ? d.warnings : void 0,
2230
- layers: m
2223
+ generatedSql: l.generated_sql,
2224
+ results: u,
2225
+ resultSize: u.data.length,
2226
+ columnCount: u.headers.size,
2227
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
2228
+ chartConfig: p?.config,
2229
+ chartWarnings: p?.warnings.length ? p.warnings : void 0,
2230
+ layers: h
2231
2231
  };
2232
- f && u.label && f[u.label] && f[u.label](g), l.push(g), this.storeHistory && Q(e).recordQuery({
2233
- query: n[i].query,
2234
- generatedQuery: u.generated_sql,
2235
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
2232
+ d && l.label && d[l.label] && d[l.label](g), c.push(g), this.storeHistory && Q(e).recordQuery({
2233
+ query: t[r].query,
2234
+ generatedQuery: l.generated_sql,
2235
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
2236
2236
  status: "success",
2237
- resultSize: t.data.length,
2238
- resultColumns: t.headers.size,
2237
+ resultSize: u.data.length,
2238
+ resultColumns: u.headers.size,
2239
2239
  errorMessage: null,
2240
- extraFilters: a
2240
+ extraFilters: i
2241
2241
  });
2242
- } catch (r) {
2243
- let o = c.signal.aborted ? "Query execution cancelled by user" : r instanceof Error ? r.message : "Unknown error occurred during execution", f = {
2242
+ } catch (n) {
2243
+ let a = s.signal.aborted ? "Query execution cancelled by user" : n instanceof Error ? n.message : "Unknown error occurred during execution", d = {
2244
2244
  success: !1,
2245
- error: o,
2246
- generatedSql: u.generated_sql,
2247
- results: new t(/* @__PURE__ */ new Map(), []),
2245
+ error: a,
2246
+ generatedSql: l.generated_sql,
2247
+ results: new h(/* @__PURE__ */ new Map(), []),
2248
2248
  resultSize: 0,
2249
2249
  columnCount: 0,
2250
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s
2250
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o
2251
2251
  };
2252
- l.push(f), console.error("Error callback for ", u.label, d), console.error("Error details:", r), d && u.label && d[u.label] && d[u.label](f), this.storeHistory && Q(e).recordQuery({
2253
- query: n[i].query,
2254
- generatedQuery: u.generated_sql,
2255
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
2252
+ c.push(d), console.error("Error callback for ", l.label, u), console.error("Error details:", n), u && l.label && u[l.label] && u[l.label](d), this.storeHistory && Q(e).recordQuery({
2253
+ query: t[r].query,
2254
+ generatedQuery: l.generated_sql,
2255
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
2256
2256
  status: "error",
2257
2257
  resultSize: 0,
2258
2258
  resultColumns: 0,
2259
- errorMessage: o,
2260
- extraFilters: a
2259
+ errorMessage: a,
2260
+ extraFilters: i
2261
2261
  });
2262
2262
  }
2263
- } else if (u.error) {
2263
+ } else if (l.error) {
2264
2264
  let e = {
2265
2265
  success: !1,
2266
- error: u.error,
2266
+ error: l.error,
2267
2267
  generatedSql: "",
2268
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
2269
- results: new t(/* @__PURE__ */ new Map(), []),
2268
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
2269
+ results: new h(/* @__PURE__ */ new Map(), []),
2270
2270
  resultSize: 0,
2271
2271
  columnCount: 0
2272
2272
  };
2273
- d && u.label && d[u.label] && d[u.label](e), l.push(e);
2273
+ u && l.label && u[l.label] && u[l.label](e), c.push(e);
2274
2274
  } else {
2275
2275
  let e = {
2276
2276
  success: !1,
2277
2277
  error: "No SQL was generated for this query",
2278
2278
  generatedSql: "",
2279
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
2280
- results: new t(/* @__PURE__ */ new Map(), []),
2279
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
2280
+ results: new h(/* @__PURE__ */ new Map(), []),
2281
2281
  resultSize: 0,
2282
2282
  columnCount: 0
2283
2283
  };
2284
- l.push(e), d && u.label && d[u.label] && d[u.label](e);
2284
+ c.push(e), u && l.label && u[l.label] && u[l.label](e);
2285
2285
  }
2286
2286
  }
2287
2287
  return {
2288
2288
  success: !0,
2289
- results: l,
2290
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s
2289
+ results: c,
2290
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o
2291
2291
  };
2292
2292
  } catch (e) {
2293
- let t = c.signal.aborted ? "Query batch cancelled by user" : e instanceof Error ? e.message : "Unknown error occurred";
2294
- return d && Object.values(d).forEach((e) => e({
2293
+ let t = s.signal.aborted ? "Query batch cancelled by user" : e instanceof Error ? e.message : "Unknown error occurred";
2294
+ return u && Object.values(u).forEach((e) => e({
2295
2295
  message: t,
2296
2296
  error: !0,
2297
2297
  running: !1
2298
2298
  })), {
2299
2299
  success: !1,
2300
- executionTime: (/* @__PURE__ */ new Date()).getTime() - s,
2300
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - o,
2301
2301
  results: []
2302
2302
  };
2303
2303
  }
@@ -2349,24 +2349,24 @@ var je = class {
2349
2349
  async getEligibleCrossFilterFields(e, t = {}) {
2350
2350
  let n = this.connectionProvider.getConnection(e);
2351
2351
  if (!n) throw Error(`Connection ${e} not found.`);
2352
- let r = t.imports ?? [], i = t.extraFilters ?? [], a = t.extraContent ?? [], s = this.connectionProvider.getConnectionSources(e).concat(a), c = JSON.stringify({
2352
+ let r = t.imports ?? [], i = t.extraFilters ?? [], a = t.extraContent ?? [], o = this.connectionProvider.getConnectionSources(e).concat(a), s = JSON.stringify({
2353
2353
  connectionId: e,
2354
2354
  queryType: n.queryType,
2355
2355
  imports: r,
2356
2356
  extraFilters: i,
2357
- sources: s,
2357
+ sources: o,
2358
2358
  currentFilename: t.currentFilename ?? null
2359
- }), l = this.eligibleCrossFilterFieldsCache.get(c);
2360
- if (l) return [...l];
2361
- let u = await this.validateQuery(e, {
2359
+ }), c = this.eligibleCrossFilterFieldsCache.get(s);
2360
+ if (c) return [...c];
2361
+ let l = await this.validateQuery(e, {
2362
2362
  text: "select 1 as cross_filter_probe;",
2363
2363
  editorType: "trilogy",
2364
2364
  imports: r,
2365
2365
  extraFilters: i,
2366
2366
  extraContent: a,
2367
2367
  currentFilename: t.currentFilename
2368
- }, !1), d = o(u?.data.completion_items ?? []);
2369
- return this.eligibleCrossFilterFieldsCache.set(c, d), [...d];
2368
+ }, !1), u = d(l?.data.completion_items ?? []);
2369
+ return this.eligibleCrossFilterFieldsCache.set(s, u), [...u];
2370
2370
  }
2371
2371
  clearEligibleCrossFilterFieldsCache() {
2372
2372
  this.eligibleCrossFilterFieldsCache.clear();
@@ -2381,11 +2381,11 @@ var je = class {
2381
2381
  resultPromise: this.executeQueryInternal(e, t, s, c, n, r, i, a, o)
2382
2382
  };
2383
2383
  }
2384
- async executeQueryInternal(n, r, i, a, o, s, c, l, u = !1) {
2385
- let d = 0, f = 0, p = "";
2386
- if (r.editorType === "python") {
2384
+ async executeQueryInternal(e, t, n, r, i, a, o, s, c = !1) {
2385
+ let l = 0, u = 0, d = "";
2386
+ if (t.editorType === "python") {
2387
2387
  let e = "Python files are editable but cannot be run locally.";
2388
- return c && c({
2388
+ return o && o({
2389
2389
  message: e,
2390
2390
  error: !0,
2391
2391
  running: !1
@@ -2397,29 +2397,29 @@ var je = class {
2397
2397
  columnCount: 0
2398
2398
  };
2399
2399
  }
2400
- o && o();
2401
- let m = this.connectionProvider.getConnection(n);
2402
- if (!m) return c && c({
2403
- message: `Connection ${n} not found.`,
2400
+ i && i();
2401
+ let f = this.connectionProvider.getConnection(e);
2402
+ if (!f) return o && o({
2403
+ message: `Connection ${e} not found.`,
2404
2404
  error: !0,
2405
2405
  running: !1
2406
2406
  }), {
2407
2407
  success: !1,
2408
- error: `Connection ${n} not found.`,
2408
+ error: `Connection ${e} not found.`,
2409
2409
  executionTime: 0,
2410
2410
  resultSize: 0,
2411
2411
  columnCount: 0
2412
2412
  };
2413
- if (!m.isConnected() && !u) try {
2414
- s && s({
2413
+ if (!f.isConnected() && !c) try {
2414
+ a && a({
2415
2415
  message: "Connection is not active... Attempting to automatically reconnect.",
2416
2416
  error: !0
2417
- }), await this.connectionProvider.ensureConnected(n), s && s({
2417
+ }), await this.connectionProvider.ensureConnected(e), a && a({
2418
2418
  message: "Reconnect Successful",
2419
2419
  running: !0
2420
2420
  });
2421
2421
  } catch {
2422
- return c && c({
2422
+ return o && o({
2423
2423
  message: "Connection failed to reconnect.",
2424
2424
  error: !0,
2425
2425
  running: !1
@@ -2431,175 +2431,175 @@ var je = class {
2431
2431
  columnCount: 0
2432
2432
  };
2433
2433
  }
2434
- if (r.editorType === "sql") try {
2435
- let e = Oe(r.text);
2436
- if (e.length === 0) {
2434
+ if (t.editorType === "sql") try {
2435
+ let i = Oe(t.text);
2436
+ if (i.length === 0) {
2437
2437
  let e = {
2438
2438
  success: !0,
2439
- generatedSql: r.text,
2440
- results: new t(/* @__PURE__ */ new Map(), []),
2441
- executionTime: (/* @__PURE__ */ new Date()).getTime() - i,
2439
+ generatedSql: t.text,
2440
+ results: new h(/* @__PURE__ */ new Map(), []),
2441
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
2442
2442
  resultSize: 0,
2443
2443
  columnCount: 0
2444
2444
  };
2445
- return l && l(e), e;
2445
+ return s && s(e), e;
2446
2446
  }
2447
- if (e.length > 1) {
2448
- let t = e.slice(0, -1).join(";\n") + ";";
2449
- await Promise.race([m.runScript(t), new Promise((e, t) => {
2450
- a.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2447
+ if (i.length > 1) {
2448
+ let e = i.slice(0, -1).join(";\n") + ";";
2449
+ await Promise.race([f.runScript(e), new Promise((e, t) => {
2450
+ r.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2451
2451
  })]);
2452
2452
  }
2453
- let o = e[e.length - 1], s;
2454
- ke(o) ? (await Promise.race([m.runScript(o), new Promise((e, t) => {
2455
- a.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2456
- })]), s = new t(/* @__PURE__ */ new Map(), [])) : s = await Promise.race([m.executeSql(o, r.parameters ?? null), new Promise((e, t) => {
2457
- a.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2453
+ let a = i[i.length - 1], o;
2454
+ ke(a) ? (await Promise.race([f.runScript(a), new Promise((e, t) => {
2455
+ r.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2456
+ })]), o = new h(/* @__PURE__ */ new Map(), [])) : o = await Promise.race([f.executeSql(a, t.parameters ?? null), new Promise((e, t) => {
2457
+ r.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2458
2458
  })]);
2459
2459
  let c = {
2460
2460
  success: !0,
2461
- generatedSql: r.text,
2462
- results: s,
2463
- executionTime: (/* @__PURE__ */ new Date()).getTime() - i,
2464
- resultSize: s.data.length,
2465
- columnCount: s.headers.size
2461
+ generatedSql: t.text,
2462
+ results: o,
2463
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
2464
+ resultSize: o.data.length,
2465
+ columnCount: o.headers.size
2466
2466
  };
2467
- return this.storeHistory && Q(n).recordQuery({
2468
- query: r.text,
2469
- generatedQuery: r.text,
2467
+ return this.storeHistory && Q(e).recordQuery({
2468
+ query: t.text,
2469
+ generatedQuery: t.text,
2470
2470
  executionTime: c.executionTime,
2471
2471
  status: "success",
2472
2472
  resultSize: c.resultSize,
2473
2473
  resultColumns: c.columnCount,
2474
2474
  errorMessage: null,
2475
- extraFilters: r.extraFilters
2476
- }), l && l(c), c;
2475
+ extraFilters: t.extraFilters
2476
+ }), s && s(c), c;
2477
2477
  } catch (e) {
2478
2478
  let t = e instanceof Error ? e.message : String(e);
2479
- return c && c({
2479
+ return o && o({
2480
2480
  message: t,
2481
2481
  error: !0,
2482
2482
  running: !1
2483
2483
  }), {
2484
2484
  success: !1,
2485
2485
  error: t,
2486
- executionTime: (/* @__PURE__ */ new Date()).getTime() - i,
2486
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
2487
2487
  resultSize: 0,
2488
2488
  columnCount: 0
2489
2489
  };
2490
2490
  }
2491
- let h = this.connectionProvider.getConnectionSources(n);
2492
- r.extraContent && (h = h.concat(r.extraContent));
2493
- let g = this.resolveRegisteredFiles(n, m), _ = this.connectionProvider.getConnectionWorkingPath?.(n) ?? null, v = null;
2491
+ let p = this.connectionProvider.getConnectionSources(e);
2492
+ t.extraContent && (p = p.concat(t.extraContent));
2493
+ let g = this.resolveRegisteredFiles(e, f), _ = this.connectionProvider.getConnectionWorkingPath?.(e) ?? null, v = null;
2494
2494
  try {
2495
- if (v = await Promise.race([this.trilogyResolver.resolve_query(r.text, m.queryType, r.editorType, h, r.imports, r.extraFilters, r.parameters, r.currentFilename || null, g.length > 0 ? g : null, _), new Promise((e, t) => {
2496
- a.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2495
+ if (v = await Promise.race([this.trilogyResolver.resolve_query(t.text, f.queryType, t.editorType, p, t.imports, t.extraFilters, t.parameters, t.currentFilename || null, g.length > 0 ? g : null, _), new Promise((e, t) => {
2496
+ r.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2497
2497
  })]), v && v.data.generated_output) {
2498
- let n = v.data.columns || [], r = {
2498
+ let e = v.data.columns || [], t = {
2499
2499
  success: !0,
2500
2500
  generatedSql: v.data.generated_sql,
2501
- results: new t(new Map(n.map((t) => [t.name, {
2502
- name: t.name,
2503
- type: e.STRING,
2504
- purpose: t.purpose
2501
+ results: new h(new Map(e.map((e) => [e.name, {
2502
+ name: e.name,
2503
+ type: m.STRING,
2504
+ purpose: e.purpose
2505
2505
  }])), v.data.generated_output),
2506
- executionTime: (/* @__PURE__ */ new Date()).getTime() - i,
2506
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
2507
2507
  resultSize: v.data.generated_output.length,
2508
- columnCount: n.length,
2508
+ columnCount: e.length,
2509
2509
  selectCount: v.data.select_count
2510
2510
  };
2511
- return console.log(r), l && l(r), r;
2511
+ return console.log(t), s && s(t), t;
2512
2512
  }
2513
- if (!v || !v.data.generated_sql || u) {
2513
+ if (!v || !v.data.generated_sql || c) {
2514
2514
  let e = {
2515
2515
  success: !0,
2516
- results: new t(/* @__PURE__ */ new Map(), []),
2517
- executionTime: (/* @__PURE__ */ new Date()).getTime() - i,
2516
+ results: new h(/* @__PURE__ */ new Map(), []),
2517
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
2518
2518
  resultSize: 0,
2519
2519
  columnCount: 0
2520
2520
  };
2521
- return l && l(e), e;
2521
+ return s && s(e), e;
2522
2522
  }
2523
- p = v.data.generated_sql;
2524
- let o = Y(v.data.chart), s = v.data.columns, c = {
2525
- ...r.parameters || {},
2523
+ d = v.data.generated_sql;
2524
+ let i = Y(v.data.chart), a = v.data.columns, o = {
2525
+ ...t.parameters || {},
2526
2526
  ...v.data.parameters || {}
2527
- }, y = Object.keys(c).length ? c : null, b = await Promise.race([m.executeSql(p, y), new Promise((e, t) => {
2528
- a.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2527
+ }, y = Object.keys(o).length ? o : null, b = await Promise.race([f.executeSql(d, y), new Promise((e, t) => {
2528
+ r.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2529
2529
  })]);
2530
- w(r.editorType) && this.enrichTrilogyColumns(s, b), d = b.data.length, f = b.headers.size, this.storeHistory && Q(n).recordQuery({
2531
- query: r.text,
2532
- generatedQuery: p,
2533
- executionTime: (/* @__PURE__ */ new Date()).getTime() - i,
2530
+ w(t.editorType) && this.enrichTrilogyColumns(a, b), l = b.data.length, u = b.headers.size, this.storeHistory && Q(e).recordQuery({
2531
+ query: t.text,
2532
+ generatedQuery: d,
2533
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
2534
2534
  status: "success",
2535
- resultSize: d,
2536
- resultColumns: f,
2535
+ resultSize: l,
2536
+ resultColumns: u,
2537
2537
  errorMessage: null,
2538
- extraFilters: r.extraFilters
2538
+ extraFilters: t.extraFilters
2539
2539
  });
2540
- let x = await this.executeChartLayers(m, v.data.chart, b, c, a, r.editorType), S = v?.data.select_count, C = {
2540
+ let x = await this.executeChartLayers(f, v.data.chart, b, o, r, t.editorType), S = v?.data.select_count, C = {
2541
2541
  success: !0,
2542
- generatedSql: p,
2542
+ generatedSql: d,
2543
2543
  results: b,
2544
- executionTime: (/* @__PURE__ */ new Date()).getTime() - i,
2545
- resultSize: d,
2546
- columnCount: f,
2544
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
2545
+ resultSize: l,
2546
+ columnCount: u,
2547
2547
  selectCount: S,
2548
- chartConfig: o?.config,
2549
- chartWarnings: o?.warnings.length ? o.warnings : void 0,
2548
+ chartConfig: i?.config,
2549
+ chartWarnings: i?.warnings.length ? i.warnings : void 0,
2550
2550
  layers: x
2551
2551
  };
2552
- return l && l(C), C;
2553
- } catch (e) {
2554
- console.error("[query catch] raw error:", e, "type:", typeof e, "ctor:", e?.constructor?.name);
2555
- let t = a.signal.aborted ? "Query cancelled by user" : e instanceof Error ? e.message : typeof e == "string" ? e : (() => {
2552
+ return s && s(C), C;
2553
+ } catch (i) {
2554
+ console.error("[query catch] raw error:", i, "type:", typeof i, "ctor:", i?.constructor?.name);
2555
+ let a = r.signal.aborted ? "Query cancelled by user" : i instanceof Error ? i.message : typeof i == "string" ? i : (() => {
2556
2556
  try {
2557
- return `Unknown error: ${JSON.stringify(e)}`;
2557
+ return `Unknown error: ${JSON.stringify(i)}`;
2558
2558
  } catch {
2559
- return `Unknown error: ${String(e)}`;
2559
+ return `Unknown error: ${String(i)}`;
2560
2560
  }
2561
2561
  })();
2562
- return this.storeHistory && Q(n).recordQuery({
2563
- query: r.text,
2564
- generatedQuery: p,
2565
- executionTime: (/* @__PURE__ */ new Date()).getTime() - i,
2562
+ return this.storeHistory && Q(e).recordQuery({
2563
+ query: t.text,
2564
+ generatedQuery: d,
2565
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
2566
2566
  status: "error",
2567
- resultSize: d,
2568
- resultColumns: f,
2569
- errorMessage: t
2570
- }), c && c({
2571
- message: t,
2567
+ resultSize: l,
2568
+ resultColumns: u,
2569
+ errorMessage: a
2570
+ }), o && o({
2571
+ message: a,
2572
2572
  error: !0,
2573
2573
  running: !1,
2574
- generatedSql: p
2574
+ generatedSql: d
2575
2575
  }), {
2576
2576
  success: !1,
2577
- error: t,
2578
- executionTime: (/* @__PURE__ */ new Date()).getTime() - i,
2579
- resultSize: d,
2580
- columnCount: f
2577
+ error: a,
2578
+ executionTime: (/* @__PURE__ */ new Date()).getTime() - n,
2579
+ resultSize: l,
2580
+ columnCount: u
2581
2581
  };
2582
2582
  }
2583
2583
  }
2584
- async executeChartLayers(e, n, r, i, a, o) {
2585
- let s = n?.layers;
2586
- if (!s || s.length < 2) return;
2587
- let c = [r];
2588
- for (let n = 1; n < s.length; n++) {
2589
- let r = s[n];
2590
- if (!r.generated_sql) {
2591
- c.push(new t(/* @__PURE__ */ new Map(), []));
2584
+ async executeChartLayers(e, t, n, r, i, a) {
2585
+ let o = t?.layers;
2586
+ if (!o || o.length < 2) return;
2587
+ let s = [n];
2588
+ for (let t = 1; t < o.length; t++) {
2589
+ let n = o[t];
2590
+ if (!n.generated_sql) {
2591
+ s.push(new h(/* @__PURE__ */ new Map(), []));
2592
2592
  continue;
2593
2593
  }
2594
- let l = {
2595
- ...i,
2596
- ...r.parameters || {}
2597
- }, u = await Promise.race([e.executeSql(r.generated_sql, Object.keys(l).length ? l : null), new Promise((e, t) => {
2598
- a.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2594
+ let c = {
2595
+ ...r,
2596
+ ...n.parameters || {}
2597
+ }, l = await Promise.race([e.executeSql(n.generated_sql, Object.keys(c).length ? c : null), new Promise((e, t) => {
2598
+ i.signal.addEventListener("abort", () => t(/* @__PURE__ */ Error("Query cancelled by user")));
2599
2599
  })]);
2600
- w(o) && this.enrichTrilogyColumns(r.columns || [], u), c.push(u);
2600
+ w(a) && this.enrichTrilogyColumns(n.columns || [], l), s.push(l);
2601
2601
  }
2602
- return c;
2602
+ return s;
2603
2603
  }
2604
2604
  enrichTrilogyColumns(e, t) {
2605
2605
  for (let n = 0; n < e.length; n++) {