react-semaphor 0.0.323 → 0.0.324

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.
@@ -1,4 +1,4 @@
1
- import { c as V, p as Os, u as O, n as zs, o as ke, q as e, r as Fs, s as Is, t as z, j as Ds, v as Ts, w as Ls, x as Ms, y as Es, L as R, z as le, A as la, E as ra, H as ia, J as oa, K as st, M as at, N as tt, O as Js, Q as W, R as Qe, h as nt, V as m, W as lt, F as ca, Y as Je, Z as Ke, _ as da, $ as rt, a0 as ua, a1 as me, a2 as he, a3 as xe, a4 as pe, a5 as Se, a6 as fe, a7 as J, T as As, a8 as Vs, a9 as qs, aa as Rs, ab as ma, ac as ha, ad as de, ae as it, af as ot, ag as xa, ah as ct, C as dt, ai as ut, aj as pa, B as mt, ak as We, al as ht, am as Ks, an as fa, ao as ys, ap as Ne, aq as Fe, ar as ge, as as ga, at as xt, au as pt, av as ft, aw as gt, I as jt, ax as bt, ay as yt, az as vt, aA as qe, aB as vs, aC as Ct, a as Nt, aD as Ue, aE as Cs, aF as Ae, aG as Ns, aH as St, aI as wt, aJ as kt, aK as Ot, aL as zt, aM as Ft, aN as bs, aO as It, aP as Ws, aQ as Dt, aR as Ys, aS as Tt, aT as Lt, aU as Mt, aV as Et, aW as ja, aX as re, aY as _s, aZ as ba, a_ as At, a$ as Vt, b0 as ls, b1 as qt, b2 as Rt, b3 as _t, b4 as Ht, b5 as $t, b6 as Pt, b7 as Bt, l as Ut, b8 as us, b9 as ya, ba as va, bb as Ca, bc as rs, bd as Na, be as is, bf as Xs, bg as Gt, bh as Qt, bi as ms, bj as hs, bk as xs, bl as Jt, X as Sa, bm as Kt, bn as Wt, bo as Yt, bp as ps, bq as Ie, f as Xt, br as Be, bs as Hs, bt as wa, bu as Zt, bv as en, bw as os, bx as sn, by as an, bz as tn, bA as Zs, bB as nn, bC as ln, bD as rn, bE as on, bF as cn, bG as dn, bH as un, bI as mn, bJ as De, bK as B, bL as U, bM as $s, bN as G, bO as hn, bP as ka, bQ as xn, bR as pn, bS as fn, bT as gn, bU as jn, bV as bn, bW as yn, bX as vn, bY as Cn } from "./index-Csp8aNd_.js";
1
+ import { c as V, p as Os, u as O, n as zs, o as Ie, q as e, r as Fs, s as Is, t as z, j as Ts, v as Ds, w as Ms, x as Ls, y as Es, z as R, A as le, E as la, H as ra, J as ia, K as oa, M as st, N as at, O as tt, Q as Js, R as W, V as Ge, W as m, Y as nt, Z as lt, F as ca, _ as Qe, $ as Je, a0 as da, a1 as rt, a2 as ua, a3 as me, a4 as he, a5 as xe, a6 as pe, a7 as Se, a8 as fe, a9 as J, T as As, aa as Vs, ab as qs, ac as Rs, ad as ma, ae as ha, af as de, ag as it, ah as ot, ai as xa, aj as ct, C as dt, ak as ut, al as pa, B as mt, L as Ke, am as We, an as ht, ao as Ks, ap as fa, aq as ys, ar as Ne, as as ze, at as ge, au as ga, av as xt, aw as pt, ax as ft, ay as gt, I as jt, az as bt, aA as yt, aB as vt, aC as Ve, aD as vs, aE as Ct, a as Nt, aF as Be, aG as Cs, aH as Ae, aI as Ns, aJ as St, aK as wt, aL as kt, aM as Ot, aN as zt, aO as Ft, aP as bs, aQ as It, aR as Ws, aS as Tt, aT as Ys, aU as Dt, aV as Mt, aW as Lt, aX as Et, aY as ja, aZ as re, a_ as _s, a$ as ba, b0 as At, b1 as Vt, b2 as ls, b3 as qt, b4 as Rt, b5 as _t, b6 as Ht, b7 as $t, b8 as Pt, b9 as Bt, l as Ut, ba as us, bb as ya, bc as va, bd as Ca, be as rs, bf as Na, bg as is, bh as Xs, bi as Gt, bj as Qt, bk as ms, bl as hs, bm as xs, bn as Jt, X as Sa, bo as Kt, bp as Wt, bq as Yt, br as ps, bs as Fe, f as Xt, bt as Pe, bu as Hs, bv as wa, bw as Zt, bx as en, by as os, bz as sn, bA as an, bB as tn, bC as Zs, bD as nn, bE as ln, bF as rn, bG as on, bH as cn, bI as dn, bJ as un, bK as mn, bL as Te, bM as B, bN as U, bO as $s, bP as G, bQ as hn, bR as ka, bS as xn, bT as pn, bU as fn, bV as gn, bW as jn, bX as bn, bY as yn, bZ as vn, b_ as Cn } from "./index-B8TJTP6w.js";
2
2
  import * as ea from "react";
3
3
  import we, { useState as q, useMemo as Ss, useEffect as Z, useRef as ws, Suspense as Nn } from "react";
4
4
  import "react-dom";
@@ -179,7 +179,7 @@ const In = V("EyeClosed", [
179
179
  * This source code is licensed under the ISC license.
180
180
  * See the LICENSE file in the root directory of this source tree.
181
181
  */
182
- const Dn = V("Eye", [
182
+ const Tn = V("Eye", [
183
183
  [
184
184
  "path",
185
185
  {
@@ -195,7 +195,7 @@ const Dn = V("Eye", [
195
195
  * This source code is licensed under the ISC license.
196
196
  * See the LICENSE file in the root directory of this source tree.
197
197
  */
198
- const Tn = V("Glasses", [
198
+ const Dn = V("Glasses", [
199
199
  ["circle", { cx: "6", cy: "15", r: "4", key: "vux9w4" }],
200
200
  ["circle", { cx: "18", cy: "15", r: "4", key: "18o8ve" }],
201
201
  ["path", { d: "M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2", key: "1ag4bs" }],
@@ -208,7 +208,7 @@ const Tn = V("Glasses", [
208
208
  * This source code is licensed under the ISC license.
209
209
  * See the LICENSE file in the root directory of this source tree.
210
210
  */
211
- const Ln = V("Hammer", [
211
+ const Mn = V("Hammer", [
212
212
  ["path", { d: "m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9", key: "eefl8a" }],
213
213
  ["path", { d: "m18 15 4-4", key: "16gjal" }],
214
214
  [
@@ -225,7 +225,7 @@ const Ln = V("Hammer", [
225
225
  * This source code is licensed under the ISC license.
226
226
  * See the LICENSE file in the root directory of this source tree.
227
227
  */
228
- const Mn = V("Hash", [
228
+ const Ln = V("Hash", [
229
229
  ["line", { x1: "4", x2: "20", y1: "9", y2: "9", key: "4lhtct" }],
230
230
  ["line", { x1: "4", x2: "20", y1: "15", y2: "15", key: "vyu0kd" }],
231
231
  ["line", { x1: "10", x2: "8", y1: "3", y2: "21", key: "1ggp8o" }],
@@ -305,16 +305,7 @@ const Rn = V("ListX", [
305
305
  * This source code is licensed under the ISC license.
306
306
  * See the LICENSE file in the root directory of this source tree.
307
307
  */
308
- const Ve = V("LoaderCircle", [
309
- ["path", { d: "M21 12a9 9 0 1 1-6.219-8.56", key: "13zald" }]
310
- ]);
311
- /**
312
- * @license lucide-react v0.453.0 - ISC
313
- *
314
- * This source code is licensed under the ISC license.
315
- * See the LICENSE file in the root directory of this source tree.
316
- */
317
- const Da = V("Map", [
308
+ const Ta = V("Map", [
318
309
  [
319
310
  "path",
320
311
  {
@@ -356,7 +347,7 @@ const Hn = V("Network", [
356
347
  * This source code is licensed under the ISC license.
357
348
  * See the LICENSE file in the root directory of this source tree.
358
349
  */
359
- const Ta = V("Pencil", [
350
+ const Da = V("Pencil", [
360
351
  [
361
352
  "path",
362
353
  {
@@ -411,7 +402,7 @@ const Bn = V("Save", [
411
402
  * This source code is licensed under the ISC license.
412
403
  * See the LICENSE file in the root directory of this source tree.
413
404
  */
414
- const La = V("Shapes", [
405
+ const Ma = V("Shapes", [
415
406
  [
416
407
  "path",
417
408
  {
@@ -519,7 +510,7 @@ const Wn = V("User", [
519
510
  ["path", { d: "M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2", key: "975kel" }],
520
511
  ["circle", { cx: "12", cy: "7", r: "4", key: "17ys0d" }]
521
512
  ]);
522
- function Ma(s) {
513
+ function La(s) {
523
514
  var t;
524
515
  return {
525
516
  ...s,
@@ -531,7 +522,7 @@ function Ma(s) {
531
522
  var o;
532
523
  return {
533
524
  ...l,
534
- cards: (o = l.cards) == null ? void 0 : o.map((r) => Yn(r))
525
+ cards: (o = l.cards) == null ? void 0 : o.map((i) => Yn(i))
535
526
  };
536
527
  })
537
528
  };
@@ -586,13 +577,13 @@ async function Zn(s, t, a, n) {
586
577
  async function ks(s, t) {
587
578
  if (!t)
588
579
  return null;
589
- const { id: a, template: n, filterValues: l, isDefault: o, shared: r } = s;
580
+ const { id: a, template: n, filterValues: l, isDefault: o, shared: i } = s;
590
581
  return await Os("https://semaphor.cloud/api/v1/lens", t, {
591
582
  lensId: a,
592
583
  template: n,
593
584
  filterValues: l,
594
585
  isDefault: o,
595
- shared: r,
586
+ shared: i,
596
587
  operation: "update"
597
588
  });
598
589
  }
@@ -603,10 +594,10 @@ async function el(s, t) {
603
594
  }) : null;
604
595
  }
605
596
  function sl() {
606
- const [s, t] = q(""), [a, n] = q(!1), l = O((b) => b.lenses), { setLenses: o, setSelectedLensId: r } = zs(), [c, d] = q(!1), [p, u] = q(!1), y = O((b) => b.dashboard), g = O((b) => b.filterValues), { authToken: x } = ke();
597
+ const [s, t] = q(""), [a, n] = q(!1), l = O((b) => b.lenses), { setLenses: o, setSelectedLensId: i } = zs(), [c, d] = q(!1), [p, u] = q(!1), y = O((b) => b.dashboard), g = O((b) => b.filterValues), { authToken: x } = Ie();
607
598
  async function j() {
608
599
  d(!0);
609
- const b = Ma(
600
+ const b = La(
610
601
  y
611
602
  ), I = await Zn(
612
603
  s,
@@ -614,7 +605,7 @@ function sl() {
614
605
  g,
615
606
  x == null ? void 0 : x.accessToken
616
607
  );
617
- I && (o([...l || [], I]), r(I.id), u(!1)), d(!1);
608
+ I && (o([...l || [], I]), i(I.id), u(!1)), d(!1);
618
609
  }
619
610
  return /* @__PURE__ */ e.jsxs(Fs, { open: p, onOpenChange: u, children: [
620
611
  /* @__PURE__ */ e.jsx(Is, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
@@ -624,14 +615,14 @@ function sl() {
624
615
  className: "h-7 p-2",
625
616
  size: "sm",
626
617
  children: [
627
- /* @__PURE__ */ e.jsx(Ds, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
618
+ /* @__PURE__ */ e.jsx(Ts, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
628
619
  "Lens"
629
620
  ]
630
621
  }
631
622
  ) }),
632
- /* @__PURE__ */ e.jsxs(Ts, { className: "sm:max-w-[425px]", children: [
633
- /* @__PURE__ */ e.jsxs(Ls, { children: [
634
- /* @__PURE__ */ e.jsx(Ms, { children: "Create Lens" }),
623
+ /* @__PURE__ */ e.jsxs(Ds, { className: "sm:max-w-[425px]", children: [
624
+ /* @__PURE__ */ e.jsxs(Ms, { children: [
625
+ /* @__PURE__ */ e.jsx(Ls, { children: "Create Lens" }),
635
626
  /* @__PURE__ */ e.jsx(Es, { children: "Lenses are private by default and are only visible to you." })
636
627
  ] }),
637
628
  /* @__PURE__ */ e.jsx("div", { className: "grid gap-4 py-4", children: /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-8 items-center gap-4", children: [
@@ -664,12 +655,12 @@ function sl() {
664
655
  ] });
665
656
  }
666
657
  function al() {
667
- const [s, t] = q(!1), a = O((u) => u.lenses), n = O((u) => u.selectedLensId), { setLenses: l, setSelectedLensId: o } = zs(), { authToken: r } = ke();
658
+ const [s, t] = q(!1), a = O((u) => u.lenses), n = O((u) => u.selectedLensId), { setLenses: l, setSelectedLensId: o } = zs(), { authToken: i } = Ie();
668
659
  async function c(u) {
669
660
  o(u);
670
661
  }
671
662
  async function d(u) {
672
- if (await el(u, r == null ? void 0 : r.accessToken)) {
663
+ if (await el(u, i == null ? void 0 : i.accessToken)) {
673
664
  const g = a == null ? void 0 : a.filter((x) => x.id !== u);
674
665
  l(g || []), o("original");
675
666
  }
@@ -687,18 +678,18 @@ function al() {
687
678
  ...u,
688
679
  isDefault: !u.isDefault
689
680
  };
690
- await ks(g, r == null ? void 0 : r.accessToken);
681
+ await ks(g, i == null ? void 0 : i.accessToken);
691
682
  const x = a == null ? void 0 : a.find((j) => j.isDefault);
692
683
  if (x && x.id !== u.id) {
693
684
  const j = {
694
685
  ...x,
695
686
  isDefault: !1
696
687
  };
697
- await ks(j, r == null ? void 0 : r.accessToken);
688
+ await ks(j, i == null ? void 0 : i.accessToken);
698
689
  }
699
690
  }
700
691
  return /* @__PURE__ */ e.jsxs(ra, { open: s, onOpenChange: t, children: [
701
- /* @__PURE__ */ e.jsx(ia, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { variant: "ghost", className: "h-7 p-2", children: /* @__PURE__ */ e.jsx(Tn, { className: "h-4 w-4", strokeWidth: 1.5 }) }) }),
692
+ /* @__PURE__ */ e.jsx(ia, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { variant: "ghost", className: "h-7 p-2", children: /* @__PURE__ */ e.jsx(Dn, { className: "h-4 w-4", strokeWidth: 1.5 }) }) }),
702
693
  /* @__PURE__ */ e.jsxs(oa, { align: "end", className: "w-60", children: [
703
694
  /* @__PURE__ */ e.jsx(st, { className: "px-3", children: "Lenses" }),
704
695
  /* @__PURE__ */ e.jsx(at, {}),
@@ -734,7 +725,7 @@ function al() {
734
725
  }
735
726
  ),
736
727
  /* @__PURE__ */ e.jsx(
737
- Qe,
728
+ Ge,
738
729
  {
739
730
  onClick: (y) => {
740
731
  y.preventDefault(), d(u.id);
@@ -755,41 +746,14 @@ function al() {
755
746
  ] });
756
747
  }
757
748
  function tl() {
758
- const [s, t] = q(!1), { authToken: a } = ke(), n = O((r) => r.theme), l = O((r) => r.filterValues);
759
- async function o() {
760
- {
761
- t(!0);
762
- const r = new URLSearchParams();
763
- r.set("token", (a == null ? void 0 : a.accessToken) || ""), r.set("theme", n || "light"), r.set("filterValues", JSON.stringify(l));
764
- const c = `https://semaphor.cloud/api/v1/generate-pdf?params=${encodeURIComponent(r.toString())}`, p = await (await fetch(c, {
765
- method: "GET",
766
- headers: {
767
- Authorization: `Bearer ${a == null ? void 0 : a.accessToken}`
768
- }
769
- })).blob(), u = URL.createObjectURL(p);
770
- window.open(u, "_blank"), t(!1);
771
- }
772
- }
773
- return /* @__PURE__ */ e.jsx(
774
- z,
775
- {
776
- variant: "ghost",
777
- className: "h-7 p-2",
778
- size: "sm",
779
- onClick: o,
780
- children: s ? /* @__PURE__ */ e.jsx(Ve, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ e.jsx(nt, { className: "h-4 w-4", strokeWidth: 1.5 })
781
- }
782
- );
783
- }
784
- function nl() {
785
749
  q(!1);
786
- const { authToken: s } = ke();
750
+ const { authToken: s } = Ie();
787
751
  O((f) => f.theme);
788
752
  const t = O((f) => f.lenses), a = O((f) => f.selectedLensId), n = t == null ? void 0 : t.find((f) => f.id === a), l = O((f) => f.dashboard);
789
753
  O((f) => f.selectedSheetId);
790
754
  const o = O(
791
755
  (f) => f.isDashboardEditing
792
- ), r = m(
756
+ ), i = m(
793
757
  (f) => f.selectedConnectionId
794
758
  ), [c, d] = q(!1), p = O((f) => f.filterValues), u = O((f) => f.isVisualEditing), y = O((f) => f.showFilters);
795
759
  O(
@@ -799,14 +763,14 @@ function nl() {
799
763
  (f) => f.actions.setShowFilters
800
764
  ), { addFrame: j, setSelectedFrameId: b } = O(
801
765
  (f) => f.actions
802
- ), { getSelectedSheet: I, setIsDashboardEditing: C, setShowDashboardJSON: T } = O((f) => f.actions), F = I(), { tenantId: A, endUserId: N } = Ss(
803
- () => lt(s == null ? void 0 : s.accessToken),
766
+ ), { getSelectedSheet: I, setIsDashboardEditing: C, setShowDashboardJSON: D } = O((f) => f.actions), F = I(), { tenantId: A, endUserId: N } = Ss(
767
+ () => nt(s == null ? void 0 : s.accessToken),
804
768
  [s == null ? void 0 : s.accessToken]
805
- ), S = Ss(() => A || N, [A, N]), L = () => {
769
+ ), S = Ss(() => A || N, [A, N]), M = () => {
806
770
  if (!o || !F) return;
807
771
  const f = {
808
- connectionId: r,
809
- id: Je(),
772
+ connectionId: i,
773
+ id: Qe(),
810
774
  title: "Title",
811
775
  description: "Description",
812
776
  preferences: {
@@ -821,7 +785,7 @@ function nl() {
821
785
  sql: "select COUNT(*) from YOUR_TABLE",
822
786
  data: []
823
787
  }, k = {
824
- id: Je(),
788
+ id: Qe(),
825
789
  cards: [f],
826
790
  activeCardId: f.id
827
791
  };
@@ -831,14 +795,14 @@ function nl() {
831
795
  };
832
796
  async function v() {
833
797
  if (d(!0), !a || !n) return;
834
- const f = Ma(
798
+ const f = La(
835
799
  l
836
- ), k = JSON.stringify(f), M = {
800
+ ), k = JSON.stringify(f), L = {
837
801
  ...n,
838
802
  template: k,
839
803
  filterValues: p
840
804
  };
841
- await ks(M, s == null ? void 0 : s.accessToken), Ke.success("Lens saved"), g == null || g(f), d(!1);
805
+ await ks(L, s == null ? void 0 : s.accessToken), Je.success("Lens saved"), g == null || g(f), d(!1);
842
806
  }
843
807
  return u ? null : /* @__PURE__ */ e.jsxs(
844
808
  "div",
@@ -848,7 +812,7 @@ function nl() {
848
812
  children: [
849
813
  !u && /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-3", children: /* @__PURE__ */ e.jsx(R, { children: n == null ? void 0 : n.name }) }),
850
814
  /* @__PURE__ */ e.jsxs("div", { className: "flex gap-2", children: [
851
- /* @__PURE__ */ e.jsx(tl, {}),
815
+ /* @__PURE__ */ e.jsx(lt, {}),
852
816
  o && !u && S && /* @__PURE__ */ e.jsx(sl, {}),
853
817
  !u && S && /* @__PURE__ */ e.jsx(al, {}),
854
818
  o && !u && /* @__PURE__ */ e.jsxs(
@@ -858,9 +822,9 @@ function nl() {
858
822
  className: "h-7 p-2",
859
823
  size: "sm",
860
824
  disabled: !o,
861
- onClick: L,
825
+ onClick: M,
862
826
  children: [
863
- /* @__PURE__ */ e.jsx(Ds, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
827
+ /* @__PURE__ */ e.jsx(Ts, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
864
828
  "Frame"
865
829
  ]
866
830
  }
@@ -872,7 +836,7 @@ function nl() {
872
836
  className: "h-7 p-2",
873
837
  onClick: h,
874
838
  size: "sm",
875
- children: /* @__PURE__ */ e.jsx(Ta, { className: "h-4 w-4", strokeWidth: 1.5 })
839
+ children: /* @__PURE__ */ e.jsx(Da, { className: "h-4 w-4", strokeWidth: 1.5 })
876
840
  }
877
841
  ),
878
842
  o && !u && /* @__PURE__ */ e.jsx(
@@ -882,10 +846,10 @@ function nl() {
882
846
  role: "close",
883
847
  className: "h-7 p-2",
884
848
  onClick: () => {
885
- C(!1), T(!1);
849
+ C(!1), D(!1);
886
850
  },
887
851
  size: "sm",
888
- children: /* @__PURE__ */ e.jsx(Qe, { className: "h-4 w-4", strokeWidth: 1.5 })
852
+ children: /* @__PURE__ */ e.jsx(Ge, { className: "h-4 w-4", strokeWidth: 1.5 })
889
853
  }
890
854
  ),
891
855
  o && !u && S && /* @__PURE__ */ e.jsx(
@@ -916,14 +880,14 @@ function nl() {
916
880
  }
917
881
  );
918
882
  }
919
- function Pe({
883
+ function $e({
920
884
  title: s,
921
885
  items: t,
922
886
  value: a,
923
887
  isLoading: n,
924
888
  isError: l,
925
889
  connectionTooltip: o,
926
- onChange: r,
890
+ onChange: i,
927
891
  showNone: c = !1,
928
892
  className: d,
929
893
  showIcon: p = !0,
@@ -947,7 +911,7 @@ function Pe({
947
911
  /* @__PURE__ */ e.jsx(rt, { children: g() }),
948
912
  /* @__PURE__ */ e.jsx(ua, { className: "text-xs", align: "start", children: o })
949
913
  ] }) : g() }),
950
- /* @__PURE__ */ e.jsxs(me, { disabled: u, value: y, onValueChange: r, children: [
914
+ /* @__PURE__ */ e.jsxs(me, { disabled: u, value: y, onValueChange: i, children: [
951
915
  /* @__PURE__ */ e.jsx(
952
916
  he,
953
917
  {
@@ -974,17 +938,17 @@ function Pe({
974
938
  ] })
975
939
  ] });
976
940
  }
977
- function ll({ column: s }) {
941
+ function nl({ column: s }) {
978
942
  const [t, a] = q(!1), n = m((x) => x.selectedTableName), l = m(
979
943
  (x) => x.selectedSchemaName
980
944
  ), o = m(
981
945
  (x) => x.selectedDatamodelId
982
- ), r = m((x) => x.sqlGen), { modelItems: c } = Re(), d = m((x) => x.actions.setSqlGen), p = m((x) => x.actions.setCardSql), u = m((x) => x.actions.setRunSql);
946
+ ), i = m((x) => x.sqlGen), { modelItems: c } = qe(), d = m((x) => x.actions.setSqlGen), p = m((x) => x.actions.setCardSql), u = m((x) => x.actions.setRunSql);
983
947
  function y(x, j) {
984
- var T;
985
- const b = ma(x, r, j), I = (T = c == null ? void 0 : c.find(
948
+ var D;
949
+ const b = ma(x, i, j), I = (D = c == null ? void 0 : c.find(
986
950
  (F) => F.id === o
987
- )) == null ? void 0 : T.name;
951
+ )) == null ? void 0 : D.name;
988
952
  d(b);
989
953
  const C = ha(
990
954
  b,
@@ -1057,12 +1021,12 @@ function Ea({ column: s }) {
1057
1021
  /* @__PURE__ */ e.jsx(Us, { className: "size-3" })
1058
1022
  ) : xa.includes(s.data_type.toLowerCase()) ? (
1059
1023
  //
1060
- /* @__PURE__ */ e.jsx(Mn, { className: "size-3" })
1024
+ /* @__PURE__ */ e.jsx(Ln, { className: "size-3" })
1061
1025
  ) : ct.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(dt, { className: "size-3" }) : ut.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(Kn, { className: "size-3" }) : /* @__PURE__ */ e.jsx(Un, { className: "size-3" }) }),
1062
1026
  /* @__PURE__ */ e.jsx(ua, { children: /* @__PURE__ */ e.jsx("p", { className: "font-mono text-xs", children: s.data_type }) })
1063
1027
  ] });
1064
1028
  }
1065
- function rl({
1029
+ function ll({
1066
1030
  schemaName: s,
1067
1031
  tableName: t,
1068
1032
  columns: a,
@@ -1070,7 +1034,7 @@ function rl({
1070
1034
  }) {
1071
1035
  const l = m((h) => h.sqlGen), o = m(
1072
1036
  (h) => h.selectedConnectionId
1073
- ), r = m(
1037
+ ), i = m(
1074
1038
  (h) => h.selectedDatabaseName
1075
1039
  ), c = m(
1076
1040
  (h) => h.selectedSchemaName
@@ -1080,14 +1044,14 @@ function rl({
1080
1044
  (h) => h.dashboard.aiScopeTables
1081
1045
  ), { setAIScopeTables: y } = O((h) => h.actions), g = m((h) => h.actions.setRunSql), x = m((h) => h.actions.setSqlGen), j = m(
1082
1046
  (h) => h.actions.setIsShowingVisual
1083
- ), b = m((h) => h.actions.setCardSql), { connectionType: I, modelItems: C } = Re();
1084
- function T(h) {
1085
- var M;
1047
+ ), b = m((h) => h.actions.setCardSql), { connectionType: I, modelItems: C } = qe();
1048
+ function D(h) {
1049
+ var L;
1086
1050
  const v = ma(h, l);
1087
1051
  x(v);
1088
- const f = (M = C == null ? void 0 : C.find(
1052
+ const f = (L = C == null ? void 0 : C.find(
1089
1053
  (H) => H.id === p
1090
- )) == null ? void 0 : M.name, k = ha(v, de(s), de(t), f);
1054
+ )) == null ? void 0 : L.name, k = ha(v, de(s), de(t), f);
1091
1055
  k && (b(k), g(!0));
1092
1056
  }
1093
1057
  function F() {
@@ -1100,15 +1064,15 @@ function rl({
1100
1064
  const v = {
1101
1065
  connectinonId: o,
1102
1066
  connectionType: I,
1103
- databaseName: r,
1067
+ databaseName: i,
1104
1068
  schemaName: c,
1105
1069
  tableName: d
1106
1070
  }, k = [...u || [], v].filter(
1107
- (M, H, P) => P.findIndex(
1108
- (Y) => Y.connectinonId === M.connectinonId && Y.tableName === M.tableName
1071
+ (L, H, P) => P.findIndex(
1072
+ (Y) => Y.connectinonId === L.connectinonId && Y.tableName === L.tableName
1109
1073
  ) === H
1110
1074
  );
1111
- y(k), Ke.success(`Added '${d}' to AI Scope`, {
1075
+ y(k), Je.success(`Added '${d}' to AI Scope`, {
1112
1076
  position: "top-right",
1113
1077
  duration: 2500,
1114
1078
  richColors: !0
@@ -1117,7 +1081,7 @@ function rl({
1117
1081
  const v = (u || []).filter(
1118
1082
  (f) => f.connectinonId !== o && f.tableName !== d
1119
1083
  );
1120
- y(v), Ke(`Removed '${d}' from AI Scope`, {
1084
+ y(v), Je(`Removed '${d}' from AI Scope`, {
1121
1085
  position: "top-right",
1122
1086
  duration: 2e3,
1123
1087
  richColors: !0
@@ -1125,11 +1089,11 @@ function rl({
1125
1089
  }
1126
1090
  }
1127
1091
  function N() {
1128
- var M;
1092
+ var L;
1129
1093
  let h = fa(s, t);
1130
- const v = (M = C == null ? void 0 : C.find(
1094
+ const v = (L = C == null ? void 0 : C.find(
1131
1095
  (H) => H.id === p
1132
- )) == null ? void 0 : M.name;
1096
+ )) == null ? void 0 : L.name;
1133
1097
  console.log("modelName", v), p && p !== "none" && (h = `${ys}.${v}`);
1134
1098
  let f = h;
1135
1099
  return ((H) => /[A-Z]/.test(H))(t) && (f = f.split(".").map((P) => `"${P}"`).join(".")), f;
@@ -1140,7 +1104,7 @@ function rl({
1140
1104
  const v = I === "MSSQL" ? `SELECT top 10 * FROM ${h}` : `SELECT * FROM ${h} LIMIT 10`;
1141
1105
  b(v), g(!0);
1142
1106
  }
1143
- function L() {
1107
+ function M() {
1144
1108
  const h = N();
1145
1109
  b(`SELECT COUNT(*) as count FROM ${h}`), g(!0);
1146
1110
  }
@@ -1174,7 +1138,7 @@ function rl({
1174
1138
  variant: "secondary",
1175
1139
  className: "flex",
1176
1140
  children: [
1177
- n !== "Success" ? /* @__PURE__ */ e.jsx(Ve, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(Qn, { className: "mr-2 size-4" }),
1141
+ n !== "Success" ? /* @__PURE__ */ e.jsx(Ke, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(Qn, { className: "mr-2 size-4" }),
1178
1142
  "Top 10"
1179
1143
  ]
1180
1144
  }
@@ -1183,12 +1147,12 @@ function rl({
1183
1147
  z,
1184
1148
  {
1185
1149
  disabled: n !== "Success",
1186
- onClick: L,
1150
+ onClick: M,
1187
1151
  size: "sm",
1188
1152
  variant: "secondary",
1189
1153
  className: "flex",
1190
1154
  children: [
1191
- n !== "Success" ? /* @__PURE__ */ e.jsx(Ve, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(Gn, { className: "mr-2 size-4" }),
1155
+ n !== "Success" ? /* @__PURE__ */ e.jsx(Ke, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx(Gn, { className: "mr-2 size-4" }),
1192
1156
  "Count"
1193
1157
  ]
1194
1158
  }
@@ -1202,7 +1166,7 @@ function rl({
1202
1166
  a == null ? void 0 : a.map((h) => /* @__PURE__ */ e.jsxs(
1203
1167
  "div",
1204
1168
  {
1205
- onClick: () => T(h),
1169
+ onClick: () => D(h),
1206
1170
  className: W(
1207
1171
  "group mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-[6px] text-sm transition-colors hover:bg-muted/50",
1208
1172
  {
@@ -1219,7 +1183,7 @@ function rl({
1219
1183
  {
1220
1184
  onClick: (v) => v.stopPropagation(),
1221
1185
  className: "flex items-center justify-end",
1222
- children: xa.includes(h.data_type) && /* @__PURE__ */ e.jsx(ll, { column: h })
1186
+ children: xa.includes(h.data_type) && /* @__PURE__ */ e.jsx(nl, { column: h })
1223
1187
  }
1224
1188
  )
1225
1189
  ]
@@ -1233,38 +1197,38 @@ function rl({
1233
1197
  )
1234
1198
  ] });
1235
1199
  }
1236
- function Re(s, t) {
1200
+ function qe(s, t) {
1237
1201
  var Xe, Ze, es, ss, as;
1238
1202
  let a = Ss(() => [], []);
1239
- const n = ke().authToken || s, l = m(
1240
- (i) => i.selectedConnectionId
1203
+ const n = Ie().authToken || s, l = m(
1204
+ (r) => r.selectedConnectionId
1241
1205
  ), o = m(
1242
- (i) => i.selectedDatamodelId
1243
- ), r = m(
1244
- (i) => i.selectedDatabaseName
1206
+ (r) => r.selectedDatamodelId
1207
+ ), i = m(
1208
+ (r) => r.selectedDatabaseName
1245
1209
  ), c = m(
1246
- (i) => i.selectedSchemaName
1247
- ), d = m((i) => i.selectedTableName), p = m(
1248
- (i) => i.actions.setCurrentColumns
1210
+ (r) => r.selectedSchemaName
1211
+ ), d = m((r) => r.selectedTableName), p = m(
1212
+ (r) => r.actions.setCurrentColumns
1249
1213
  ), u = m(
1250
- (i) => i.actions.setSelectedConnectionId
1214
+ (r) => r.actions.setSelectedConnectionId
1251
1215
  ), y = m(
1252
- (i) => i.actions.setSelectedDatamodelId
1216
+ (r) => r.actions.setSelectedDatamodelId
1253
1217
  ), g = m(
1254
- (i) => i.actions.setSelectedDatabaseName
1218
+ (r) => r.actions.setSelectedDatabaseName
1255
1219
  ), x = m(
1256
- (i) => i.actions.setSelectedSchemaName
1220
+ (r) => r.actions.setSelectedSchemaName
1257
1221
  ), j = m(
1258
- (i) => i.actions.setSelectedTableName
1259
- ), b = m((i) => i.actions.setCardSql);
1260
- function I(i) {
1261
- return l && r && c && r !== "NA" ? !0 : l && i === "API" ? !1 : !!(l && i === "S3");
1222
+ (r) => r.actions.setSelectedTableName
1223
+ ), b = m((r) => r.actions.setCardSql);
1224
+ function I(r) {
1225
+ return l && i && c && i !== "NA" ? !0 : l && r === "API" ? !1 : !!(l && r === "S3");
1262
1226
  }
1263
- function C(i) {
1264
- return !!(l && r && r !== "NA" && c && d || l && (i === "S3" || i === "API") || o && o);
1227
+ function C(r) {
1228
+ return !!(l && i && i !== "NA" && c && d || l && (r === "S3" || r === "API") || o && o);
1265
1229
  }
1266
- function T(i) {
1267
- return l && i ? !(i === "API" || i === "S3") : !1;
1230
+ function D(r) {
1231
+ return l && r ? !(r === "API" || r === "S3") : !1;
1268
1232
  }
1269
1233
  const {
1270
1234
  data: F,
@@ -1272,7 +1236,7 @@ function Re(s, t) {
1272
1236
  isError: N
1273
1237
  } = Ne({
1274
1238
  queryKey: ["connections"],
1275
- queryFn: () => Fe(
1239
+ queryFn: () => ze(
1276
1240
  "https://semaphor.cloud/api/v1/connections",
1277
1241
  (n == null ? void 0 : n.accessToken) || ""
1278
1242
  ),
@@ -1280,11 +1244,11 @@ function Re(s, t) {
1280
1244
  // Only fetch if authToken is present
1281
1245
  }), {
1282
1246
  data: S,
1283
- isLoading: L,
1247
+ isLoading: M,
1284
1248
  isError: h
1285
1249
  } = Ne({
1286
1250
  queryKey: ["models", l],
1287
- queryFn: () => Fe(
1251
+ queryFn: () => ze(
1288
1252
  "https://semaphor.cloud/api/v1/datamodels",
1289
1253
  (n == null ? void 0 : n.accessToken) || "",
1290
1254
  {
@@ -1294,23 +1258,23 @@ function Re(s, t) {
1294
1258
  enabled: !!(n != null && n.accessToken) && !!l
1295
1259
  // Only fetch if authToken is present
1296
1260
  }), v = F == null ? void 0 : F.connections.find(
1297
- (i) => i.id === l
1261
+ (r) => r.id === l
1298
1262
  ), f = v == null ? void 0 : v.type, k = (v == null ? void 0 : v.type) === "API" || (v == null ? void 0 : v.type) === "S3", {
1299
- data: M,
1263
+ data: L,
1300
1264
  isLoading: H,
1301
1265
  isFetching: P,
1302
1266
  isError: Y,
1303
1267
  refetch: ie
1304
1268
  } = Ne({
1305
1269
  queryKey: ["databases", l],
1306
- queryFn: () => Fe(
1270
+ queryFn: () => ze(
1307
1271
  "https://semaphor.cloud/api/v1/databases",
1308
1272
  (n == null ? void 0 : n.accessToken) || "",
1309
1273
  {
1310
1274
  connection_id: l
1311
1275
  }
1312
1276
  ),
1313
- enabled: T(f)
1277
+ enabled: D(f)
1314
1278
  // !!selectedConnectionId && !isNonDbConnection, //currentConnection?.type !== 'API', // Only fetch if connectionId is present
1315
1279
  }), {
1316
1280
  data: K,
@@ -1319,20 +1283,20 @@ function Re(s, t) {
1319
1283
  isError: _,
1320
1284
  refetch: ee
1321
1285
  } = Ne({
1322
- queryKey: ["schemas", l, r],
1323
- queryFn: () => Fe(
1286
+ queryKey: ["schemas", l, i],
1287
+ queryFn: () => ze(
1324
1288
  "https://semaphor.cloud/api/v1/schemas",
1325
1289
  (n == null ? void 0 : n.accessToken) || "",
1326
1290
  {
1327
1291
  connection_id: l,
1328
- database_name: r
1292
+ database_name: i
1329
1293
  }
1330
1294
  ),
1331
- enabled: !!l && !!r && !k && r !== "NA"
1295
+ enabled: !!l && !!i && !k && i !== "NA"
1332
1296
  //currentConnection?.type !== 'API', // Only fetch if connectionId and database is present
1333
1297
  }), {
1334
1298
  data: E,
1335
- isLoading: D,
1299
+ isLoading: T,
1336
1300
  isFetching: se,
1337
1301
  isError: $,
1338
1302
  refetch: X
@@ -1340,41 +1304,41 @@ function Re(s, t) {
1340
1304
  queryKey: [
1341
1305
  "tables",
1342
1306
  l,
1343
- r,
1307
+ i,
1344
1308
  c
1345
1309
  ],
1346
- queryFn: () => Fe(
1310
+ queryFn: () => ze(
1347
1311
  "https://semaphor.cloud/api/v1/tables",
1348
1312
  (n == null ? void 0 : n.accessToken) || "",
1349
1313
  {
1350
1314
  connection_id: l,
1351
- database_name: r,
1315
+ database_name: i,
1352
1316
  schema_name: c
1353
1317
  }
1354
1318
  ),
1355
1319
  enabled: I(f)
1356
1320
  }), {
1357
1321
  data: te,
1358
- isLoading: Le,
1359
- isFetching: Oe,
1322
+ isLoading: Me,
1323
+ isFetching: ke,
1360
1324
  isError: be
1361
1325
  } = Ne({
1362
1326
  queryKey: [
1363
1327
  "columns",
1364
1328
  l,
1365
- r,
1329
+ i,
1366
1330
  o,
1367
1331
  c,
1368
1332
  d
1369
1333
  ],
1370
- queryFn: () => Fe(
1334
+ queryFn: () => ze(
1371
1335
  "https://semaphor.cloud/api/v1/columns",
1372
1336
  (n == null ? void 0 : n.accessToken) || "",
1373
1337
  {
1374
1338
  connection_id: l,
1375
1339
  datamodel_id: o || "",
1376
1340
  // don't pass undefined. Pass empty string
1377
- database_name: r,
1341
+ database_name: i,
1378
1342
  schema_name: c,
1379
1343
  table_name: d
1380
1344
  }
@@ -1400,47 +1364,47 @@ function Re(s, t) {
1400
1364
  v
1401
1365
  ]);
1402
1366
  const ye = (v == null ? void 0 : v.type) === "API" ? (Xe = v == null ? void 0 : v.type) == null ? void 0 : Xe.toLowerCase() : d || "", Q = k ? "" : c || "";
1403
- function oe(i) {
1404
- x(i), j("");
1367
+ function oe(r) {
1368
+ x(r), j("");
1405
1369
  }
1406
- function ce(i) {
1407
- g(i === "none" ? "" : i), x(""), j(""), i !== "none" && i !== "" && y("");
1370
+ function ce(r) {
1371
+ g(r === "none" ? "" : r), x(""), j(""), r !== "none" && r !== "" && y("");
1408
1372
  }
1409
- function ze(i) {
1410
- u(i);
1373
+ function Oe(r) {
1374
+ u(r);
1411
1375
  }
1412
- function Me(i) {
1413
- y(i === "none" ? "" : i), i !== "none" && i !== "" && g("");
1376
+ function Le(r) {
1377
+ y(r === "none" ? "" : r), r !== "none" && r !== "" && g("");
1414
1378
  }
1415
- M && ((Ze = M == null ? void 0 : M.databases) == null ? void 0 : Ze.length) > 0, K && ((es = K == null ? void 0 : K.schemas) == null ? void 0 : es.length) > 0, te && ((ss = te == null ? void 0 : te.columns) == null ? void 0 : ss.length) > 0 && (a = te.columns.map((i) => ({
1416
- ...i,
1417
- data_type: i.data_type.toLowerCase()
1379
+ L && ((Ze = L == null ? void 0 : L.databases) == null ? void 0 : Ze.length) > 0, K && ((es = K == null ? void 0 : K.schemas) == null ? void 0 : es.length) > 0, te && ((ss = te == null ? void 0 : te.columns) == null ? void 0 : ss.length) > 0 && (a = te.columns.map((r) => ({
1380
+ ...r,
1381
+ data_type: r.data_type.toLowerCase()
1418
1382
  }))), Y && (a = []), (be || N) && (a = []);
1419
- const He = F == null ? void 0 : F.connections.map(
1420
- (i) => ({
1421
- id: i.id,
1422
- name: i.name,
1423
- type: i.type
1383
+ const _e = F == null ? void 0 : F.connections.map(
1384
+ (r) => ({
1385
+ id: r.id,
1386
+ name: r.name,
1387
+ type: r.type
1424
1388
  })
1425
- ), $e = (as = S == null ? void 0 : S.datamodels) == null ? void 0 : as.map((i) => ({
1426
- id: i.id,
1427
- name: i.name
1428
- })), Ee = M == null ? void 0 : M.databases.map((i) => ({
1429
- id: i.database_name,
1430
- name: i.database_name
1431
- })), gs = K == null ? void 0 : K.schemas.map((i) => ({
1432
- id: i.schema_name,
1433
- name: i.schema_name
1434
- })), Ye = E == null ? void 0 : E.tables.map((i) => ({
1435
- id: i.table_name,
1436
- name: i.table_name
1389
+ ), He = (as = S == null ? void 0 : S.datamodels) == null ? void 0 : as.map((r) => ({
1390
+ id: r.id,
1391
+ name: r.name
1392
+ })), Ee = L == null ? void 0 : L.databases.map((r) => ({
1393
+ id: r.database_name,
1394
+ name: r.database_name
1395
+ })), gs = K == null ? void 0 : K.schemas.map((r) => ({
1396
+ id: r.schema_name,
1397
+ name: r.schema_name
1398
+ })), Ye = E == null ? void 0 : E.tables.map((r) => ({
1399
+ id: r.table_name,
1400
+ name: r.table_name
1437
1401
  }));
1438
1402
  return {
1439
- connectionItems: He,
1403
+ connectionItems: _e,
1440
1404
  isConnectionsLoading: A,
1441
1405
  isConnectionsError: N,
1442
- modelItems: $e,
1443
- isModelsLoading: L,
1406
+ modelItems: He,
1407
+ isModelsLoading: M,
1444
1408
  isModelsError: h,
1445
1409
  databaseItems: Ee,
1446
1410
  isDatabasesLoadingOrFetching: H || P,
@@ -1449,17 +1413,17 @@ function Re(s, t) {
1449
1413
  isSchemaLoadingOrFetching: ae || w,
1450
1414
  isSchemaError: _,
1451
1415
  tableItems: Ye,
1452
- isTableLoadingOrFetching: D || se,
1416
+ isTableLoadingOrFetching: T || se,
1453
1417
  isTableError: $,
1454
1418
  columns: a,
1455
- isColumnsLoadingOrFetching: Le || Oe,
1419
+ isColumnsLoadingOrFetching: Me || ke,
1456
1420
  isColumnsError: be,
1457
1421
  isNonDbConnection: k,
1458
1422
  connectionType: f,
1459
1423
  tableName: ye,
1460
1424
  schemaName: Q,
1461
- handleConnectionChange: ze,
1462
- handleDatamodelChange: Me,
1425
+ handleConnectionChange: Oe,
1426
+ handleDatamodelChange: Le,
1463
1427
  handleDatabaseChange: ce,
1464
1428
  handleSchemaChange: oe
1465
1429
  };
@@ -1476,7 +1440,7 @@ function Aa({
1476
1440
  ($) => $.selectedDatabaseName
1477
1441
  ), l = m(
1478
1442
  ($) => $.selectedSchemaName
1479
- ), o = m(($) => $.selectedTableName), r = m(
1443
+ ), o = m(($) => $.selectedTableName), i = m(
1480
1444
  ($) => $.actions.setSelectedTableName
1481
1445
  ), {
1482
1446
  connectionItems: c,
@@ -1490,25 +1454,25 @@ function Aa({
1490
1454
  isConnectionsError: b,
1491
1455
  isModelsError: I,
1492
1456
  isDatabasesLoadingOrFetching: C,
1493
- isDatabaseError: T,
1457
+ isDatabaseError: D,
1494
1458
  isSchemaLoadingOrFetching: F,
1495
1459
  isSchemaError: A,
1496
1460
  isColumnsError: N,
1497
1461
  isColumnsLoadingOrFetching: S,
1498
- isTableLoadingOrFetching: L,
1462
+ isTableLoadingOrFetching: M,
1499
1463
  isTableError: h,
1500
1464
  connectionType: v,
1501
1465
  isNonDbConnection: f,
1502
1466
  handleConnectionChange: k,
1503
- handleDatabaseChange: M,
1467
+ handleDatabaseChange: L,
1504
1468
  handleSchemaChange: H,
1505
1469
  handleDatamodelChange: P,
1506
1470
  tableName: Y,
1507
1471
  schemaName: ie
1508
- } = Re();
1472
+ } = qe();
1509
1473
  function K() {
1510
1474
  return s ? s(ie, Y, g) : /* @__PURE__ */ e.jsx(
1511
- rl,
1475
+ ll,
1512
1476
  {
1513
1477
  schemaName: ie,
1514
1478
  tableName: Y,
@@ -1524,11 +1488,11 @@ function Aa({
1524
1488
  if (!t || v === "S3" || v === "API") return null;
1525
1489
  if (!a || a === "none")
1526
1490
  return /* @__PURE__ */ e.jsx(
1527
- Pe,
1491
+ $e,
1528
1492
  {
1529
1493
  showNone: !0,
1530
- onChange: M,
1531
- isError: T,
1494
+ onChange: L,
1495
+ isError: D,
1532
1496
  isLoading: C,
1533
1497
  items: u,
1534
1498
  value: n || "",
@@ -1548,7 +1512,7 @@ function Aa({
1548
1512
  if (!t || v === "S3" || v === "API") return null;
1549
1513
  if (!n || n === "none")
1550
1514
  return /* @__PURE__ */ e.jsx(
1551
- Pe,
1515
+ $e,
1552
1516
  {
1553
1517
  showNone: !0,
1554
1518
  onChange: P,
@@ -1562,7 +1526,7 @@ function Aa({
1562
1526
  }
1563
1527
  function E() {
1564
1528
  return !t || v === "S3" || v === "API" || !n || n === "none" ? null : /* @__PURE__ */ e.jsx(
1565
- Pe,
1529
+ $e,
1566
1530
  {
1567
1531
  onChange: H,
1568
1532
  isError: A,
@@ -1573,18 +1537,18 @@ function Aa({
1573
1537
  }
1574
1538
  );
1575
1539
  }
1576
- function D() {
1540
+ function T() {
1577
1541
  function $() {
1578
1542
  let X = !1;
1579
1543
  return v === "API" ? (X = !1, X) : ((v === "S3" || t && n && n !== "none" && l) && (X = !0), X);
1580
1544
  }
1581
1545
  return $() ? /* @__PURE__ */ e.jsx(
1582
- Pe,
1546
+ $e,
1583
1547
  {
1584
- onChange: r,
1548
+ onChange: i,
1585
1549
  isError: h,
1586
1550
  items: y,
1587
- isLoading: L,
1551
+ isLoading: M,
1588
1552
  value: o || "",
1589
1553
  title: "Table"
1590
1554
  }
@@ -1593,7 +1557,7 @@ function Aa({
1593
1557
  return /* @__PURE__ */ e.jsxs("aside", { className: "xbg-red-100 flex grow flex-col justify-between", children: [
1594
1558
  /* @__PURE__ */ e.jsxs("section", { className: "space-y-3 px-6 py-4", children: [
1595
1559
  /* @__PURE__ */ e.jsx(
1596
- Pe,
1560
+ $e,
1597
1561
  {
1598
1562
  items: c,
1599
1563
  title: "Connection",
@@ -1610,7 +1574,7 @@ function Aa({
1610
1574
  _(),
1611
1575
  w(),
1612
1576
  E(),
1613
- D()
1577
+ T()
1614
1578
  ] }),
1615
1579
  K(),
1616
1580
  /* @__PURE__ */ e.jsx("div", { className: "flex items-end justify-center gap-2 px-6 py-4", children: /* @__PURE__ */ e.jsxs(
@@ -1628,23 +1592,23 @@ function Aa({
1628
1592
  ) })
1629
1593
  ] });
1630
1594
  }
1631
- function il(s) {
1595
+ function rl(s) {
1632
1596
  const t = s.toUpperCase().indexOf("WHERE"), a = s.toUpperCase().indexOf("GROUP BY"), n = s.toUpperCase().indexOf("LIMIT"), l = s.toUpperCase().indexOf("ORDER BY");
1633
1597
  let o = s.length;
1634
1598
  if (l !== -1 && (o = l), n !== -1 && n < o && (o = n), t !== -1) {
1635
- const r = s.substring(0, t), c = s.substring(t);
1636
- return `${r} {{ filters | where }} AND ${c.substring(
1599
+ const i = s.substring(0, t), c = s.substring(t);
1600
+ return `${i} {{ filters | where }} AND ${c.substring(
1637
1601
  6
1638
1602
  )}`;
1639
1603
  } else if (a !== -1) {
1640
- const r = s.substring(0, a), c = s.substring(a);
1641
- return `${r} {{ filters | where }} ${c}`;
1604
+ const i = s.substring(0, a), c = s.substring(a);
1605
+ return `${i} {{ filters | where }} ${c}`;
1642
1606
  } else {
1643
- const r = s.substring(0, o), c = s.substring(o);
1644
- return `${r} {{ filters | where }} ${c}`;
1607
+ const i = s.substring(0, o), c = s.substring(o);
1608
+ return `${i} {{ filters | where }} ${c}`;
1645
1609
  }
1646
1610
  }
1647
- function ol({
1611
+ function il({
1648
1612
  error: s,
1649
1613
  setShowAIDialog: t,
1650
1614
  setUserInputforAI: a,
@@ -1668,7 +1632,7 @@ function ol({
1668
1632
  size: "sm",
1669
1633
  variant: "outline",
1670
1634
  children: [
1671
- /* @__PURE__ */ e.jsx(Ln, { className: "mr-2 h-4 w-4" }),
1635
+ /* @__PURE__ */ e.jsx(Mn, { className: "mr-2 h-4 w-4" }),
1672
1636
  "Debug with AI"
1673
1637
  ]
1674
1638
  }
@@ -1678,7 +1642,7 @@ function ol({
1678
1642
  )
1679
1643
  ] });
1680
1644
  }
1681
- const cl = `
1645
+ const ol = `
1682
1646
 
1683
1647
  Use the following syntax to create a chart query. Please replace the x-axis, y-axis, stack-by, label, and measure with the actual column names of the table.
1684
1648
 
@@ -1725,7 +1689,7 @@ SELECT label, measure FROM table
1725
1689
  - Label - Category
1726
1690
  - Measure - Number
1727
1691
  `;
1728
- function dl({
1692
+ function cl({
1729
1693
  open: s,
1730
1694
  setOpen: t,
1731
1695
  userInput: a,
@@ -1733,17 +1697,17 @@ function dl({
1733
1697
  triggerAIRun: l,
1734
1698
  setTriggerAIRun: o
1735
1699
  }) {
1736
- const r = ws(null), c = ws(null), { authToken: d } = ke(), [p, u] = q(!1), y = m((w) => w.actions.setCardSql), g = O((w) => w.dashboard.baseQueries), x = m((w) => w.actions.setRunSql), j = m((w) => w.actions.setCardType), [b, I] = q([]), C = m((w) => w.currentColumns), T = m((w) => w.card.sql), F = m((w) => w.selectedTableName), A = `
1700
+ const i = ws(null), c = ws(null), { authToken: d } = Ie(), [p, u] = q(!1), y = m((w) => w.actions.setCardSql), g = O((w) => w.dashboard.baseQueries), x = m((w) => w.actions.setRunSql), j = m((w) => w.actions.setCardType), [b, I] = q([]), C = m((w) => w.currentColumns), D = m((w) => w.card.sql), F = m((w) => w.selectedTableName), A = `
1737
1701
  ${a}
1738
1702
 
1739
1703
  Database Query Dialect: ${F === "api" || F === "s3" ? "DuckDb" : ""}
1740
1704
  Table Name: ${F}
1741
1705
  Table Columns: ${C == null ? void 0 : C.map((w) => `${w.column_name} | ${w.data_type}`).join(", ")}
1742
- User SQL: ${T}
1706
+ User SQL: ${D}
1743
1707
  ${g && `Base Queries: ${JSON.stringify(g)} `}`, N = ` When the user asks for a specific chart please use the following query structure to generate the chart query. Do not make up the column names. Use only the table columns provided above for the query. Replace x-axis, y-axis, and lables with the appropriate column names.
1744
- Visual Query Syntax: ${cl}`, { data: S, isLoading: L, isFetching: h, isError: v, refetch: f } = Ne({
1708
+ Visual Query Syntax: ${ol}`, { data: S, isLoading: M, isFetching: h, isError: v, refetch: f } = Ne({
1745
1709
  queryKey: ["ai-query"],
1746
- queryFn: () => Fe(
1710
+ queryFn: () => ze(
1747
1711
  "https://semaphor.cloud/api/v1/ai",
1748
1712
  (d == null ? void 0 : d.accessToken) || "",
1749
1713
  {
@@ -1782,15 +1746,15 @@ function dl({
1782
1746
  c.current && (c.current.scroll({
1783
1747
  top: c.current.scrollHeight,
1784
1748
  behavior: "smooth"
1785
- }), (_ = r.current) == null || _.focus());
1749
+ }), (_ = i.current) == null || _.focus());
1786
1750
  }, 100);
1787
1751
  return () => clearTimeout(w);
1788
1752
  }, [b]);
1789
- function M() {
1753
+ function L() {
1790
1754
  a && (I((w) => [...w, { role: "user", content: a }]), k(a) && u(!0), n(""), f());
1791
1755
  }
1792
1756
  Z(() => {
1793
- l && (M(), o(!1));
1757
+ l && (L(), o(!1));
1794
1758
  }, [l, o]);
1795
1759
  const H = {
1796
1760
  //seleect a darker color
@@ -1880,12 +1844,12 @@ function dl({
1880
1844
  }
1881
1845
  ) }),
1882
1846
  /* @__PURE__ */ e.jsxs(
1883
- Ts,
1847
+ Ds,
1884
1848
  {
1885
1849
  className: "flex flex-col justify-between overflow-auto sm:max-w-[425px] md:max-h-[625px] md:min-w-[625px]",
1886
1850
  children: [
1887
- /* @__PURE__ */ e.jsxs(Ls, { children: [
1888
- /* @__PURE__ */ e.jsx(Ms, { children: "Assistant" }),
1851
+ /* @__PURE__ */ e.jsxs(Ms, { children: [
1852
+ /* @__PURE__ */ e.jsx(Ls, { children: "Assistant" }),
1889
1853
  /* @__PURE__ */ e.jsx(Es, { children: "What can I help you with?" })
1890
1854
  ] }),
1891
1855
  /* @__PURE__ */ e.jsx(
@@ -1904,9 +1868,9 @@ function dl({
1904
1868
  ga,
1905
1869
  {
1906
1870
  autoFocus: !0,
1907
- ref: r,
1871
+ ref: i,
1908
1872
  onKeyDown: (w) => {
1909
- w.key === "Enter" && !w.shiftKey && (w.preventDefault(), n(""), M());
1873
+ w.key === "Enter" && !w.shiftKey && (w.preventDefault(), n(""), L());
1910
1874
  },
1911
1875
  placeholder: "Type your question here...",
1912
1876
  onFocus: (w) => {
@@ -1916,7 +1880,7 @@ function dl({
1916
1880
  className: W(
1917
1881
  "max-h-10 min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
1918
1882
  ),
1919
- disabled: L || h,
1883
+ disabled: M || h,
1920
1884
  value: a,
1921
1885
  onChange: (w) => n(w.target.value)
1922
1886
  }
@@ -1928,8 +1892,8 @@ function dl({
1928
1892
  className: "h-8",
1929
1893
  size: "sm",
1930
1894
  variant: "ghost",
1931
- onClick: M,
1932
- children: !L && !h ? /* @__PURE__ */ e.jsx(xt, {}) : /* @__PURE__ */ e.jsx(Ve, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" })
1895
+ onClick: L,
1896
+ children: !M && !h ? /* @__PURE__ */ e.jsx(xt, {}) : /* @__PURE__ */ e.jsx(Ke, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" })
1933
1897
  }
1934
1898
  )
1935
1899
  ] })
@@ -1946,10 +1910,10 @@ var Va = {
1946
1910
  className: void 0,
1947
1911
  style: void 0,
1948
1912
  attr: void 0
1949
- }, sa = we.createContext && /* @__PURE__ */ we.createContext(Va), ul = ["attr", "size", "title"];
1950
- function ml(s, t) {
1913
+ }, sa = we.createContext && /* @__PURE__ */ we.createContext(Va), dl = ["attr", "size", "title"];
1914
+ function ul(s, t) {
1951
1915
  if (s == null) return {};
1952
- var a = hl(s, t), n, l;
1916
+ var a = ml(s, t), n, l;
1953
1917
  if (Object.getOwnPropertySymbols) {
1954
1918
  var o = Object.getOwnPropertySymbols(s);
1955
1919
  for (l = 0; l < o.length; l++)
@@ -1957,7 +1921,7 @@ function ml(s, t) {
1957
1921
  }
1958
1922
  return a;
1959
1923
  }
1960
- function hl(s, t) {
1924
+ function ml(s, t) {
1961
1925
  if (s == null) return {};
1962
1926
  var a = {};
1963
1927
  for (var n in s)
@@ -1991,21 +1955,21 @@ function ds(s) {
1991
1955
  for (var t = 1; t < arguments.length; t++) {
1992
1956
  var a = arguments[t] != null ? arguments[t] : {};
1993
1957
  t % 2 ? aa(Object(a), !0).forEach(function(n) {
1994
- xl(s, n, a[n]);
1958
+ hl(s, n, a[n]);
1995
1959
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(s, Object.getOwnPropertyDescriptors(a)) : aa(Object(a)).forEach(function(n) {
1996
1960
  Object.defineProperty(s, n, Object.getOwnPropertyDescriptor(a, n));
1997
1961
  });
1998
1962
  }
1999
1963
  return s;
2000
1964
  }
2001
- function xl(s, t, a) {
2002
- return t = pl(t), t in s ? Object.defineProperty(s, t, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : s[t] = a, s;
1965
+ function hl(s, t, a) {
1966
+ return t = xl(t), t in s ? Object.defineProperty(s, t, { value: a, enumerable: !0, configurable: !0, writable: !0 }) : s[t] = a, s;
2003
1967
  }
2004
- function pl(s) {
2005
- var t = fl(s, "string");
1968
+ function xl(s) {
1969
+ var t = pl(s, "string");
2006
1970
  return typeof t == "symbol" ? t : t + "";
2007
1971
  }
2008
- function fl(s, t) {
1972
+ function pl(s, t) {
2009
1973
  if (typeof s != "object" || !s) return s;
2010
1974
  var a = s[Symbol.toPrimitive];
2011
1975
  if (a !== void 0) {
@@ -2021,22 +1985,22 @@ function qa(s) {
2021
1985
  }, t.attr), qa(t.child)));
2022
1986
  }
2023
1987
  function je(s) {
2024
- return (t) => /* @__PURE__ */ we.createElement(gl, cs({
1988
+ return (t) => /* @__PURE__ */ we.createElement(fl, cs({
2025
1989
  attr: ds({}, s.attr)
2026
1990
  }, t), qa(s.child));
2027
1991
  }
2028
- function gl(s) {
1992
+ function fl(s) {
2029
1993
  var t = (a) => {
2030
1994
  var {
2031
1995
  attr: n,
2032
1996
  size: l,
2033
1997
  title: o
2034
- } = s, r = ml(s, ul), c = l || a.size || "1em", d;
1998
+ } = s, i = ul(s, dl), c = l || a.size || "1em", d;
2035
1999
  return a.className && (d = a.className), s.className && (d = (d ? d + " " : "") + s.className), /* @__PURE__ */ we.createElement("svg", cs({
2036
2000
  stroke: "currentColor",
2037
2001
  fill: "currentColor",
2038
2002
  strokeWidth: "0"
2039
- }, a.attr, n, r, {
2003
+ }, a.attr, n, i, {
2040
2004
  className: d,
2041
2005
  style: ds(ds({
2042
2006
  color: s.color || a.color
@@ -2048,10 +2012,10 @@ function gl(s) {
2048
2012
  };
2049
2013
  return sa !== void 0 ? /* @__PURE__ */ we.createElement(sa.Consumer, null, (a) => t(a)) : t(Va);
2050
2014
  }
2051
- function jl(s) {
2015
+ function gl(s) {
2052
2016
  return je({ tag: "svg", attr: { viewBox: "0 0 448 512" }, child: [{ tag: "path", attr: { d: "M439.8 200.5c-7.7-30.9-22.3-54.2-53.4-54.2h-40.1v47.4c0 36.8-31.2 67.8-66.8 67.8H172.7c-29.2 0-53.4 25-53.4 54.3v101.8c0 29 25.2 46 53.4 54.3 33.8 9.9 66.3 11.7 106.8 0 26.9-7.8 53.4-23.5 53.4-54.3v-40.7H226.2v-13.6h160.2c31.1 0 42.6-21.7 53.4-54.2 11.2-33.5 10.7-65.7 0-108.6zM286.2 404c11.1 0 20.1 9.1 20.1 20.3 0 11.3-9 20.4-20.1 20.4-11 0-20.1-9.2-20.1-20.4.1-11.3 9.1-20.3 20.1-20.3zM167.8 248.1h106.8c29.7 0 53.4-24.5 53.4-54.3V91.9c0-29-24.4-50.7-53.4-55.6-35.8-5.9-74.7-5.6-106.8.1-45.2 8-53.4 24.7-53.4 55.6v40.7h106.9v13.6h-147c-31.1 0-58.3 18.7-66.8 54.2-9.8 40.7-10.2 66.1 0 108.6 7.6 31.6 25.7 54.2 56.8 54.2H101v-48.8c0-35.3 30.5-66.4 66.8-66.4zm-6.7-142.6c-11.1 0-20.1-9.1-20.1-20.3.1-11.3 9-20.4 20.1-20.4 11 0 20.1 9.2 20.1 20.4s-9 20.3-20.1 20.3z" }, child: [] }] })(s);
2053
2017
  }
2054
- function bl({ sql: s }) {
2018
+ function jl({ sql: s }) {
2055
2019
  return /* @__PURE__ */ e.jsxs(Vs, { children: [
2056
2020
  /* @__PURE__ */ e.jsx(qs, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { variant: "link", className: "h-5 p-0", children: /* @__PURE__ */ e.jsx(jt, { className: "h-4 w-4 text-muted-foreground" }) }) }),
2057
2021
  /* @__PURE__ */ e.jsx(
@@ -2067,65 +2031,65 @@ function bl({ sql: s }) {
2067
2031
  )
2068
2032
  ] });
2069
2033
  }
2070
- function yl() {
2034
+ function bl() {
2071
2035
  const [s, t] = q({
2072
2036
  queryKey: [],
2073
2037
  queryData: null
2074
- }), { theme: a } = bt(), n = yt(), l = ws(), o = vt(), [r, c] = q(!1), [d, p] = q(!1), [u, y] = q(!1), [g, x] = q(""), [j, b] = q(!1), I = O((i) => i.selectedSheetId);
2075
- O((i) => i.dashboard.baseQueries);
2076
- const C = m((i) => i.card), T = O((i) => i.theme), F = m((i) => i.isShowingVisual);
2077
- O((i) => i.onAcceptChanges);
2038
+ }), { theme: a } = bt(), n = yt(), l = ws(), o = vt(), [i, c] = q(!1), [d, p] = q(!1), [u, y] = q(!1), [g, x] = q(""), [j, b] = q(!1), I = O((r) => r.selectedSheetId);
2039
+ O((r) => r.dashboard.baseQueries);
2040
+ const C = m((r) => r.card), D = O((r) => r.theme), F = m((r) => r.isShowingVisual);
2041
+ O((r) => r.onAcceptChanges);
2078
2042
  const A = m(
2079
- (i) => i.selectedConnectionId
2043
+ (r) => r.selectedConnectionId
2080
2044
  ), N = m(
2081
- (i) => i.selectedDatabaseName
2045
+ (r) => r.selectedDatabaseName
2082
2046
  ), S = m(
2083
- (i) => i.selectedDatamodelId
2084
- ), L = m(
2085
- (i) => i.selectedSchemaName
2047
+ (r) => r.selectedDatamodelId
2048
+ ), M = m(
2049
+ (r) => r.selectedSchemaName
2086
2050
  );
2087
2051
  O(
2088
- (i) => i.actions.updateFrameCard
2052
+ (r) => r.actions.updateFrameCard
2089
2053
  );
2090
- const h = m((i) => i.selectedTableName), v = m((i) => i.card.sql), f = m((i) => i.card.python), k = m((i) => i.frame), M = O((i) => i.dashboard.filters), H = O((i) => i.filterValues), P = M == null ? void 0 : M.filter(
2091
- (i) => i.sheetId === I || !i.sheetId
2054
+ const h = m((r) => r.selectedTableName), v = m((r) => r.card.sql), f = m((r) => r.card.python), k = m((r) => r.frame), L = O((r) => r.dashboard.filters), H = O((r) => r.filterValues), P = L == null ? void 0 : L.filter(
2055
+ (r) => r.sheetId === I || !r.sheetId
2092
2056
  ), Y = H == null ? void 0 : H.filter(
2093
- (i) => (P == null ? void 0 : P.some((ne) => ne.id === i.filterId)) || i.filterId.endsWith(I)
2094
- ), ie = m((i) => i.applyFilters), {
2057
+ (r) => (P == null ? void 0 : P.some((ne) => ne.id === r.filterId)) || r.filterId.endsWith(I)
2058
+ ), ie = m((r) => r.applyFilters), {
2095
2059
  setCardCustomCfg: K,
2096
2060
  setQueryResultColumns: ae,
2097
2061
  setFilterValues: w,
2098
2062
  setCardSql: _,
2099
2063
  setCard: ee,
2100
2064
  setCardPython: E,
2101
- setQueryError: D,
2065
+ setQueryError: T,
2102
2066
  setPythonStdOut: se,
2103
2067
  setCardPreferences: $
2104
- } = m((i) => i.actions), X = m((i) => i.onSave);
2068
+ } = m((r) => r.actions), X = m((r) => r.onSave);
2105
2069
  m(
2106
- (i) => i.actions.setApplyFilters
2070
+ (r) => r.actions.setApplyFilters
2107
2071
  );
2108
- const te = m((i) => i.onClose), Le = m((i) => i.actions.setSqlGen), Oe = m((i) => i.runSql), be = m((i) => i.actions.setRunSql);
2109
- m((i) => i.actions.setCardCfg);
2072
+ const te = m((r) => r.onClose), Me = m((r) => r.actions.setSqlGen), ke = m((r) => r.runSql), be = m((r) => r.actions.setRunSql);
2073
+ m((r) => r.actions.setCardCfg);
2110
2074
  const ye = m(
2111
- (i) => i.actions.setIsSqlRunning
2075
+ (r) => r.actions.setIsSqlRunning
2112
2076
  ), {
2113
2077
  data: Q,
2114
2078
  isLoading: oe,
2115
2079
  isFetching: ce,
2116
- isSuccess: ze,
2117
- isError: Me,
2118
- error: He,
2119
- queryKey: $e,
2080
+ isSuccess: Oe,
2081
+ isError: Le,
2082
+ error: _e,
2083
+ queryKey: He,
2120
2084
  refetch: Ee
2121
- } = qe(C);
2085
+ } = Ve(C);
2122
2086
  Z(() => {
2123
- if (Q && (Q.rowLimitExceeded && Ke.error("Row limit (10,000) exceeded. Refine your query.", {
2087
+ if (Q && (Q.rowLimitExceeded && Je.error("Row limit (10,000) exceeded. Refine your query.", {
2124
2088
  position: "top-center",
2125
2089
  richColors: !0
2126
2090
  }), se((Q == null ? void 0 : Q.output) || ""), Q.records.length > 0)) {
2127
- const { dimensionKeys: i } = vs(Q.records);
2128
- ae(i);
2091
+ const { dimensionKeys: r } = vs(Q.records);
2092
+ ae(r);
2129
2093
  }
2130
2094
  }, [
2131
2095
  Q,
@@ -2133,63 +2097,63 @@ function yl() {
2133
2097
  ae,
2134
2098
  se
2135
2099
  ]), Z(() => {
2136
- (oe || ce) && ye(!0), (Me || ze) && ye(!1), Me ? (D(He.message), ae([]), se("")) : D("");
2100
+ (oe || ce) && ye(!0), (Le || Oe) && ye(!1), Le ? (T(_e.message), ae([]), se("")) : T("");
2137
2101
  }, [
2138
2102
  oe,
2139
2103
  ce,
2140
2104
  Q,
2141
2105
  se,
2142
- Me,
2143
- ze,
2106
+ Le,
2107
+ Oe,
2144
2108
  ye,
2145
2109
  ae,
2146
- D,
2147
- He
2110
+ T,
2111
+ _e
2148
2112
  ]), Z(() => {
2149
- Oe && (Ee(), be(!1));
2150
- }, [Oe, Ee, be]);
2113
+ ke && (Ee(), be(!1));
2114
+ }, [ke, Ee, be]);
2151
2115
  function gs() {
2152
- const i = n.getQueryData($e);
2116
+ const r = n.getQueryData(He);
2153
2117
  s.queryData || t({
2154
- queryKey: $e,
2155
- queryData: i
2156
- }), n.setQueryData($e, null), _(""), Le({}), K(""), $({});
2118
+ queryKey: He,
2119
+ queryData: r
2120
+ }), n.setQueryData(He, null), _(""), Me({}), K(""), $({});
2157
2121
  }
2158
- const Ye = (i) => {
2159
- l.current = i;
2122
+ const Ye = (r) => {
2123
+ l.current = r;
2160
2124
  };
2161
- function Xe(i, ne) {
2162
- if (i.length === 0)
2125
+ function Xe(r, ne) {
2126
+ if (r.length === 0)
2163
2127
  return "";
2164
2128
  if (ne) {
2165
- const ve = i.find((Ce) => Ce.id === ne);
2129
+ const ve = r.find((Ce) => Ce.id === ne);
2166
2130
  if (ve) {
2167
2131
  const Ce = ve.tabTitle;
2168
2132
  if (Ce == "All__Header")
2169
- return i[0].id;
2133
+ return r[0].id;
2170
2134
  if (Ce && Ce.endsWith("__Header")) {
2171
- const Za = Ce.split("__")[0], Qs = i.find(
2135
+ const Za = Ce.split("__")[0], Qs = r.find(
2172
2136
  (et) => et.tabTitle === Za
2173
2137
  );
2174
- return Qs ? Qs.id : i[0].id;
2138
+ return Qs ? Qs.id : r[0].id;
2175
2139
  }
2176
2140
  return ne;
2177
2141
  }
2178
2142
  }
2179
- return i[0].id;
2143
+ return r[0].id;
2180
2144
  }
2181
2145
  function Ze() {
2182
- let i = v;
2183
- v && !v.includes("{{") && (i = il(v), _(i));
2146
+ let r = v;
2147
+ v && !v.includes("{{") && (r = rl(v), _(r));
2184
2148
  const ne = {
2185
2149
  ...C,
2186
- lastSelectedSchema: L,
2150
+ lastSelectedSchema: M,
2187
2151
  lastSelectedDatamodelId: S,
2188
2152
  lastSelectedDatabase: N,
2189
2153
  lastSelectedTable: h,
2190
2154
  connectionId: A,
2191
2155
  type: F ? C.type : "table",
2192
- sql: i,
2156
+ sql: r,
2193
2157
  customCfg: F ? C.customCfg : null
2194
2158
  }, ve = k.cards.map(
2195
2159
  (js) => js.id === C.id ? ne : js
@@ -2201,12 +2165,12 @@ function yl() {
2201
2165
  X == null || X(Ce);
2202
2166
  }
2203
2167
  function es() {
2204
- const { queryKey: i, queryData: ne } = s;
2205
- i && ne && n.setQueryData(i, ne), te == null || te();
2168
+ const { queryKey: r, queryData: ne } = s;
2169
+ r && ne && n.setQueryData(r, ne), te == null || te();
2206
2170
  }
2207
2171
  Z(() => {
2208
2172
  if (!o) return;
2209
- const i = l.current, ne = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", ve = T === "system" ? ne : T;
2173
+ const r = l.current, ne = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", ve = D === "system" ? ne : D;
2210
2174
  return o.editor.defineTheme("default", {
2211
2175
  // base: theme === 'light' ? 'hc-light' : 'vs-dark',
2212
2176
  base: ve === "light" ? "vs" : "vs-dark",
@@ -2219,14 +2183,14 @@ function yl() {
2219
2183
  // ? '#ffffff'
2220
2184
  // : getCssVariableValue('--semaphor-background'),
2221
2185
  }
2222
- }), o.editor.setTheme("default"), i && o && i.addCommand(
2186
+ }), o.editor.setTheme("default"), r && o && r.addCommand(
2223
2187
  o.KeyMod.Shift | o.KeyCode.Enter,
2224
2188
  function() {
2225
2189
  return Ee(), !1;
2226
2190
  }
2227
2191
  ), () => {
2228
2192
  };
2229
- }, [a, T, o]);
2193
+ }, [a, D, o]);
2230
2194
  function ss() {
2231
2195
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2232
2196
  d && /* @__PURE__ */ e.jsx(
@@ -2238,7 +2202,7 @@ function yl() {
2238
2202
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2 pt-3", children: [
2239
2203
  /* @__PURE__ */ e.jsx(R, { className: "ml-6 text-xs font-semibold", children: "Filters" }),
2240
2204
  Y && d && /* @__PURE__ */ e.jsx(
2241
- Qe,
2205
+ Ge,
2242
2206
  {
2243
2207
  onClick: () => p(!1),
2244
2208
  className: "bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"
@@ -2246,13 +2210,13 @@ function yl() {
2246
2210
  )
2247
2211
  ] }),
2248
2212
  /* @__PURE__ */ e.jsx(
2249
- Ue,
2213
+ Be,
2250
2214
  {
2251
2215
  theme: "default",
2252
- onChange: (i) => {
2253
- if (i)
2216
+ onChange: (r) => {
2217
+ if (r)
2254
2218
  try {
2255
- JSON.parse(i), w(JSON.parse(i));
2219
+ JSON.parse(r), w(JSON.parse(r));
2256
2220
  } catch {
2257
2221
  }
2258
2222
  },
@@ -2275,7 +2239,7 @@ function yl() {
2275
2239
  renderLineHighlight: "none"
2276
2240
  }
2277
2241
  },
2278
- T
2242
+ D
2279
2243
  )
2280
2244
  ] })
2281
2245
  }
@@ -2307,7 +2271,7 @@ function yl() {
2307
2271
  {
2308
2272
  id: "1",
2309
2273
  order: 1,
2310
- defaultSize: r ? 20 : 100,
2274
+ defaultSize: i ? 20 : 100,
2311
2275
  className: "relative flex grow",
2312
2276
  children: [
2313
2277
  /* @__PURE__ */ e.jsx(
@@ -2316,12 +2280,12 @@ function yl() {
2316
2280
  role: "sql-container",
2317
2281
  className: "relative flex w-[99%]",
2318
2282
  children: /* @__PURE__ */ e.jsx(
2319
- Ue,
2283
+ Be,
2320
2284
  {
2321
2285
  theme: "default",
2322
2286
  className: "pt-3",
2323
- onChange: (i) => {
2324
- _(i);
2287
+ onChange: (r) => {
2288
+ _(r);
2325
2289
  },
2326
2290
  value: v,
2327
2291
  options: {
@@ -2342,11 +2306,11 @@ function yl() {
2342
2306
  )
2343
2307
  }
2344
2308
  ),
2345
- r && /* @__PURE__ */ e.jsx("code", { className: "absolute right-6 top-3 text-sm text-muted-foreground/70", children: "sql" })
2309
+ i && /* @__PURE__ */ e.jsx("code", { className: "absolute right-6 top-3 text-sm text-muted-foreground/70", children: "sql" })
2346
2310
  ]
2347
2311
  }
2348
2312
  ),
2349
- r && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2313
+ i && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2350
2314
  /* @__PURE__ */ e.jsx(Ns, { withHandle: !0, className: "border" }),
2351
2315
  /* @__PURE__ */ e.jsxs(
2352
2316
  Ae,
@@ -2362,12 +2326,12 @@ function yl() {
2362
2326
  role: "python-container",
2363
2327
  className: "relative flex w-[99%] pt-0",
2364
2328
  children: /* @__PURE__ */ e.jsx(
2365
- Ue,
2329
+ Be,
2366
2330
  {
2367
2331
  className: "pt-3",
2368
2332
  theme: "default",
2369
- onChange: (i) => {
2370
- E(i && i.trim() || "");
2333
+ onChange: (r) => {
2334
+ E(r && r.trim() || "");
2371
2335
  },
2372
2336
  value: f || St,
2373
2337
  options: {
@@ -2435,15 +2399,15 @@ function yl() {
2435
2399
  size: "sm",
2436
2400
  variant: "outline",
2437
2401
  children: [
2438
- oe || ce ? /* @__PURE__ */ e.jsx(Ve, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx($n, { className: "mr-2 h-4 w-4" }),
2402
+ oe || ce ? /* @__PURE__ */ e.jsx(Ke, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" }) : /* @__PURE__ */ e.jsx($n, { className: "mr-2 h-4 w-4" }),
2439
2403
  "Run"
2440
2404
  ]
2441
2405
  }
2442
2406
  ),
2443
- Me && /* @__PURE__ */ e.jsx(
2444
- ol,
2407
+ Le && /* @__PURE__ */ e.jsx(
2408
+ il,
2445
2409
  {
2446
- error: He.message,
2410
+ error: _e.message,
2447
2411
  setShowAIDialog: y,
2448
2412
  setTriggerAIRun: b,
2449
2413
  setUserInputforAI: x
@@ -2465,28 +2429,28 @@ function yl() {
2465
2429
  /* @__PURE__ */ e.jsx(
2466
2430
  pa,
2467
2431
  {
2468
- pressed: r,
2469
- onPressedChange: (i) => c(i),
2432
+ pressed: i,
2433
+ onPressedChange: (r) => c(r),
2470
2434
  className: "",
2471
2435
  size: "sm",
2472
2436
  variant: "outline",
2473
- children: /* @__PURE__ */ e.jsx(jl, { className: "size-4 text-foreground/70" })
2437
+ children: /* @__PURE__ */ e.jsx(gl, { className: "size-4 text-foreground/70" })
2474
2438
  }
2475
2439
  ),
2476
2440
  /* @__PURE__ */ e.jsx(
2477
- dl,
2441
+ cl,
2478
2442
  {
2479
2443
  open: u,
2480
2444
  setOpen: y,
2481
2445
  userInput: g,
2482
2446
  triggerAIRun: j,
2483
2447
  setTriggerAIRun: b,
2484
- setUserInput: (i) => x(i)
2448
+ setUserInput: (r) => x(r)
2485
2449
  }
2486
2450
  )
2487
2451
  ] }),
2488
2452
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
2489
- (Q == null ? void 0 : Q.sql) && /* @__PURE__ */ e.jsx(bl, { sql: Q.sql }),
2453
+ (Q == null ? void 0 : Q.sql) && /* @__PURE__ */ e.jsx(jl, { sql: Q.sql }),
2490
2454
  /* @__PURE__ */ e.jsxs(
2491
2455
  z,
2492
2456
  {
@@ -2495,7 +2459,7 @@ function yl() {
2495
2459
  size: "sm",
2496
2460
  variant: "outline",
2497
2461
  children: [
2498
- /* @__PURE__ */ e.jsx(Qe, { className: "mr-2 size-4" }),
2462
+ /* @__PURE__ */ e.jsx(Ge, { className: "mr-2 size-4" }),
2499
2463
  "Close"
2500
2464
  ]
2501
2465
  }
@@ -2521,8 +2485,8 @@ function yl() {
2521
2485
  )
2522
2486
  );
2523
2487
  }
2524
- function vl({ data: s }) {
2525
- var r;
2488
+ function yl({ data: s }) {
2489
+ var i;
2526
2490
  const [t, a] = we.useState([]), l = Object.keys(s[0]).map((c) => ({
2527
2491
  // header: key,
2528
2492
  accessorKey: c,
@@ -2543,10 +2507,10 @@ function vl({ data: s }) {
2543
2507
  })), o = Ot({
2544
2508
  data: s,
2545
2509
  columns: l,
2546
- getCoreRowModel: Tt(),
2547
- getPaginationRowModel: Lt(),
2510
+ getCoreRowModel: Dt(),
2511
+ getPaginationRowModel: Mt(),
2548
2512
  onSortingChange: a,
2549
- getSortedRowModel: Mt(),
2513
+ getSortedRowModel: Lt(),
2550
2514
  manualPagination: !0,
2551
2515
  state: {
2552
2516
  sorting: t
@@ -2557,7 +2521,7 @@ function vl({ data: s }) {
2557
2521
  d.column.columnDef.header,
2558
2522
  d.getContext()
2559
2523
  ) }, d.id)) }, c.id)) }),
2560
- /* @__PURE__ */ e.jsx(Dt, { children: (r = o.getRowModel().rows) != null && r.length ? o.getRowModel().rows.map((c) => /* @__PURE__ */ e.jsx(
2524
+ /* @__PURE__ */ e.jsx(Tt, { children: (i = o.getRowModel().rows) != null && i.length ? o.getRowModel().rows.map((c) => /* @__PURE__ */ e.jsx(
2561
2525
  bs,
2562
2526
  {
2563
2527
  className: "whitespace-nowrap py-2",
@@ -2568,26 +2532,26 @@ function vl({ data: s }) {
2568
2532
  )) : /* @__PURE__ */ e.jsx(bs, { children: /* @__PURE__ */ e.jsx(Ys, { colSpan: l.length, className: "h-24 text-center", children: "No results." }) }) })
2569
2533
  ] });
2570
2534
  }
2571
- function Cl({ card: s }) {
2572
- var g, x, j, b, I, C, T, F, A, N;
2573
- const { authToken: t } = ke(), a = Et(t == null ? void 0 : t.accessToken), n = O((S) => S.themeStyle), l = {
2535
+ function vl({ card: s }) {
2536
+ var g, x, j, b, I, C, D, F, A, N;
2537
+ const { authToken: t } = Ie(), a = Et(t == null ? void 0 : t.accessToken), n = O((S) => S.themeStyle), l = {
2574
2538
  colors: ((x = (g = n == null ? void 0 : n.chart) == null ? void 0 : g.dataset) == null ? void 0 : x.backgroundColor) || []
2575
2539
  };
2576
2540
  (j = s.customCardPreferences) != null && j.inputData;
2577
- const { getCard: o } = ja(((b = s.customCardPreferences) == null ? void 0 : b.url) || ""), r = ((I = s.customCardPreferences) == null ? void 0 : I.visualType) || "single", c = m((S) => S.frame);
2541
+ const { getCard: o } = ja(((b = s.customCardPreferences) == null ? void 0 : b.url) || ""), i = ((I = s.customCardPreferences) == null ? void 0 : I.visualType) || "single", c = m((S) => S.frame);
2578
2542
  re();
2579
- const { data: d } = qe(s);
2543
+ const { data: d } = Ve(s);
2580
2544
  if (!((C = s.customCardPreferences) != null && C.componentName))
2581
2545
  return null;
2582
2546
  const p = o(
2583
- (T = s.customCardPreferences) == null ? void 0 : T.componentName
2547
+ (D = s.customCardPreferences) == null ? void 0 : D.componentName
2584
2548
  ), u = (S) => {
2585
2549
  console.log("data", S), s.customCardPreferences;
2586
2550
  }, y = Object.keys(
2587
2551
  ((F = s.customCardPreferences) == null ? void 0 : F.dataInputCardIds) || {}
2588
2552
  ).map((S) => {
2589
2553
  var v, f, k;
2590
- const L = (f = (v = s.customCardPreferences) == null ? void 0 : v.dataInputCardIds) == null ? void 0 : f[S].cardId, h = (k = c == null ? void 0 : c.cards) == null ? void 0 : k.find((M) => M.id === L);
2554
+ const M = (f = (v = s.customCardPreferences) == null ? void 0 : v.dataInputCardIds) == null ? void 0 : f[S].cardId, h = (k = c == null ? void 0 : c.cards) == null ? void 0 : k.find((L) => L.id === M);
2591
2555
  return h || null;
2592
2556
  });
2593
2557
  return /* @__PURE__ */ e.jsx("div", { className: "semaphor-custom mb-3 flex grow basis-0 flex-col space-y-2 overflow-y-auto", children: /* @__PURE__ */ e.jsxs(
@@ -2595,7 +2559,7 @@ function Cl({ card: s }) {
2595
2559
  {
2596
2560
  fallback: /* @__PURE__ */ e.jsx(e.Fragment, {}),
2597
2561
  children: [
2598
- p && r === "single" && /* @__PURE__ */ e.jsx(
2562
+ p && i === "single" && /* @__PURE__ */ e.jsx(
2599
2563
  p,
2600
2564
  {
2601
2565
  params: a,
@@ -2605,15 +2569,15 @@ function Cl({ card: s }) {
2605
2569
  data: (d == null ? void 0 : d.records) || []
2606
2570
  }
2607
2571
  ),
2608
- p && r === "multiple" && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e.jsx(
2572
+ p && i === "multiple" && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e.jsx(
2609
2573
  p,
2610
2574
  {
2611
2575
  theme: l,
2612
2576
  onDataChange: u,
2613
2577
  settings: y.map(
2614
2578
  (S) => {
2615
- var L;
2616
- return (L = S == null ? void 0 : S.customCardPreferences) == null ? void 0 : L.settings;
2579
+ var M;
2580
+ return (M = S == null ? void 0 : S.customCardPreferences) == null ? void 0 : M.settings;
2617
2581
  }
2618
2582
  ),
2619
2583
  data: y.map((S) => (S == null ? void 0 : S.data) || [])
@@ -2633,7 +2597,7 @@ function Ra({
2633
2597
  var x, j;
2634
2598
  const a = m((b) => b.card), n = ((x = a.customCardPreferences) == null ? void 0 : x.showCardHeader) ?? !0, l = m((b) => b.frame), o = O((b) => b.dashboard.filters);
2635
2599
  m((b) => b.actions.setRunSql);
2636
- const { updateFilter: r } = zs(), c = o == null ? void 0 : o.find((b) => b.id === l.filterId), { data: d } = qe(a), { setCard: p } = re(), { data: u } = _s(a);
2600
+ const { updateFilter: i } = zs(), c = o == null ? void 0 : o.find((b) => b.id === l.filterId), { data: d } = Ve(a), { setCard: p } = re(), { data: u } = _s(a);
2637
2601
  if (!a.id) return null;
2638
2602
  let y;
2639
2603
  d != null && d.records && (d == null ? void 0 : d.records.length) > 0 && (y = ba({
@@ -2645,7 +2609,7 @@ function Ra({
2645
2609
  topoJson: u
2646
2610
  }));
2647
2611
  function g(b) {
2648
- return /* @__PURE__ */ e.jsx(Cl, { card: b });
2612
+ return /* @__PURE__ */ e.jsx(vl, { card: b });
2649
2613
  }
2650
2614
  return /* @__PURE__ */ e.jsxs(
2651
2615
  At,
@@ -2681,7 +2645,7 @@ function Ra({
2681
2645
  {
2682
2646
  className: "my-1",
2683
2647
  text: c.title || c.column,
2684
- onSave: (b) => r({ ...c, title: b }),
2648
+ onSave: (b) => i({ ...c, title: b }),
2685
2649
  children: /* @__PURE__ */ e.jsx(R, { children: c.title })
2686
2650
  }
2687
2651
  ),
@@ -2705,10 +2669,10 @@ function Ra({
2705
2669
  }
2706
2670
  );
2707
2671
  }
2708
- function Nl() {
2709
- const [s, t] = q(!1), [a, n] = q(""), [l, o] = q(""), [r, c] = q(""), [d, p] = q(""), u = m((N) => N.card), y = m(
2672
+ function Cl() {
2673
+ const [s, t] = q(!1), [a, n] = q(""), [l, o] = q(""), [i, c] = q(""), [d, p] = q(""), u = m((N) => N.card), y = m(
2710
2674
  (N) => N.card.customCfg
2711
- ), { data: g } = qe(u), { data: x } = _s(u), { setCardCustomCfg: j, setCustomVisualCode: b } = re();
2675
+ ), { data: g } = Ve(u), { data: x } = _s(u), { setCardCustomCfg: j, setCustomVisualCode: b } = re();
2712
2676
  function I(N) {
2713
2677
  var h, v;
2714
2678
  const S = {
@@ -2724,7 +2688,7 @@ function Nl() {
2724
2688
  return JSON.stringify(S, null, 1);
2725
2689
  }
2726
2690
  function C() {
2727
- var S, L;
2691
+ var S, M;
2728
2692
  if (!(g != null && g.records) || (g == null ? void 0 : g.records.length) === 0) return;
2729
2693
  const N = ba({
2730
2694
  data: g == null ? void 0 : g.records,
@@ -2733,10 +2697,10 @@ function Nl() {
2733
2697
  preferences: u.preferences,
2734
2698
  topoJson: x
2735
2699
  });
2736
- N && (n(JSON.stringify(N, null, 1)), (S = u == null ? void 0 : u.preferences) != null && S.customVisualCode && c((L = u == null ? void 0 : u.preferences) == null ? void 0 : L.customVisualCode), y && o(JSON.stringify(y, null, 1)));
2700
+ N && (n(JSON.stringify(N, null, 1)), (S = u == null ? void 0 : u.preferences) != null && S.customVisualCode && c((M = u == null ? void 0 : u.preferences) == null ? void 0 : M.customVisualCode), y && o(JSON.stringify(y, null, 1)));
2737
2701
  }
2738
- function T() {
2739
- if (r && b(r), !!l)
2702
+ function D() {
2703
+ if (i && b(i), !!l)
2740
2704
  try {
2741
2705
  const N = JSON.parse(l);
2742
2706
  return N ? (j(N), p(""), o(""), N) : void 0;
@@ -2750,8 +2714,8 @@ function Nl() {
2750
2714
  function A() {
2751
2715
  let N;
2752
2716
  if (y) {
2753
- const S = Xs.cloneDeep(u.cfg), L = Xs.merge(S, y);
2754
- return N = I(L), N;
2717
+ const S = Xs.cloneDeep(u.cfg), M = Xs.merge(S, y);
2718
+ return N = I(M), N;
2755
2719
  }
2756
2720
  return a ? (N = I(JSON.parse(a)), N) : "";
2757
2721
  }
@@ -2767,12 +2731,12 @@ function Nl() {
2767
2731
  }
2768
2732
  ) }),
2769
2733
  /* @__PURE__ */ e.jsxs(
2770
- Ts,
2734
+ Ds,
2771
2735
  {
2772
2736
  className: "max-h-[70vh] min-h-[70vh] overflow-auto sm:min-w-[900px] lg:min-w-[1200px]",
2773
2737
  children: [
2774
- /* @__PURE__ */ e.jsxs(Ls, { className: "", children: [
2775
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx(Ms, { children: "Customize Card" }) }),
2738
+ /* @__PURE__ */ e.jsxs(Ms, { className: "", children: [
2739
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx(Ls, { children: "Customize Card" }) }),
2776
2740
  /* @__PURE__ */ e.jsxs(Es, { children: [
2777
2741
  "See the configuration options and documentation",
2778
2742
  /* @__PURE__ */ e.jsx(
@@ -2818,7 +2782,7 @@ function Nl() {
2818
2782
  className: "mt-0 grow rounded-b border border-t-0",
2819
2783
  value: "custom-config",
2820
2784
  children: /* @__PURE__ */ e.jsx(
2821
- Ue,
2785
+ Be,
2822
2786
  {
2823
2787
  className: "h-full w-full overflow-hidden",
2824
2788
  theme: "default",
@@ -2847,7 +2811,7 @@ function Nl() {
2847
2811
  className: "mt-0 grow rounded-b border border-t-0",
2848
2812
  value: "custom-code",
2849
2813
  children: /* @__PURE__ */ e.jsx(
2850
- Ue,
2814
+ Be,
2851
2815
  {
2852
2816
  className: "h-full w-full overflow-hidden",
2853
2817
  theme: "default",
@@ -2864,7 +2828,7 @@ function Nl() {
2864
2828
  renderLineHighlight: "none"
2865
2829
  },
2866
2830
  defaultLanguage: "javascript",
2867
- value: r,
2831
+ value: i,
2868
2832
  onChange: (N) => c(N || "")
2869
2833
  }
2870
2834
  )
@@ -2883,7 +2847,7 @@ function Nl() {
2883
2847
  children: "Reset"
2884
2848
  }
2885
2849
  ),
2886
- /* @__PURE__ */ e.jsx(z, { onClick: T, variant: "outline", children: "Apply" }),
2850
+ /* @__PURE__ */ e.jsx(z, { onClick: D, variant: "outline", children: "Apply" }),
2887
2851
  /* @__PURE__ */ e.jsx(z, { onClick: () => t(!1), variant: "outline", children: "Close" })
2888
2852
  ] })
2889
2853
  ]
@@ -2919,20 +2883,20 @@ function Ja(s) {
2919
2883
  const [t, a] = q(null);
2920
2884
  return Z(() => {
2921
2885
  s && (async () => {
2922
- const o = (await import("./lucide-react-DzVyq6Fk.js"))[s];
2886
+ const o = (await import("./lucide-react-QRCXH2cF.js"))[s];
2923
2887
  a(o);
2924
2888
  })();
2925
2889
  }, [s]), t;
2926
2890
  }
2927
2891
  function Ka() {
2928
- const { authToken: s } = ke(), { data: t, isLoading: a, isFetching: n, isError: l } = Ne({
2892
+ const { authToken: s } = Ie(), { data: t, isLoading: a, isFetching: n, isError: l } = Ne({
2929
2893
  queryKey: ["plugins", s == null ? void 0 : s.accessToken],
2930
2894
  queryFn: () => Gt(s == null ? void 0 : s.accessToken)
2931
2895
  // staleTime: Infinity,
2932
2896
  });
2933
2897
  return { data: t, isLoading: a, isFetching: n, isError: l };
2934
2898
  }
2935
- function Sl({
2899
+ function Nl({
2936
2900
  onChartTypeChange: s
2937
2901
  }) {
2938
2902
  const [t, a] = q([]), { data: n } = Ka();
@@ -2953,7 +2917,7 @@ function Sl({
2953
2917
  }, [n]), t.length === 0 ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2954
2918
  /* @__PURE__ */ e.jsx(ge, { className: "my-2" }),
2955
2919
  /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 place-items-center", children: t.map((l, o) => /* @__PURE__ */ e.jsx(
2956
- wl,
2920
+ Sl,
2957
2921
  {
2958
2922
  text: l.name,
2959
2923
  onClick: () => s("custom", l),
@@ -2963,7 +2927,7 @@ function Sl({
2963
2927
  )) })
2964
2928
  ] });
2965
2929
  }
2966
- const wl = ({
2930
+ const Sl = ({
2967
2931
  text: s,
2968
2932
  icon: t,
2969
2933
  onClick: a
@@ -2971,9 +2935,9 @@ const wl = ({
2971
2935
  const n = Ja(t || ""), l = s.charAt(0).toUpperCase();
2972
2936
  return /* @__PURE__ */ e.jsx(z, { onClick: a, title: s, variant: "ghost", children: n ? /* @__PURE__ */ e.jsx(n, { className: "h-4 w-4" }) : l });
2973
2937
  };
2974
- function kl() {
2938
+ function wl() {
2975
2939
  var u, y;
2976
- const [s, t] = q(!1), a = m((g) => g.card), n = a.type, { setCardType: l, setCardPreferences: o, setChartOrientation: r } = m((g) => g.actions), { setCardCustomCfg: c, setCustomCardPreferences: d } = re();
2940
+ const [s, t] = q(!1), a = m((g) => g.card), n = a.type, { setCardType: l, setCardPreferences: o, setChartOrientation: i } = m((g) => g.actions), { setCardCustomCfg: c, setCustomCardPreferences: d } = re();
2977
2941
  function p(g, x) {
2978
2942
  c(null), o({}), l(g), x && d({
2979
2943
  type: "component",
@@ -2985,7 +2949,7 @@ function kl() {
2985
2949
  }
2986
2950
  return /* @__PURE__ */ e.jsxs(ms, { open: s, onOpenChange: t, children: [
2987
2951
  /* @__PURE__ */ e.jsx(hs, { asChild: !0, children: /* @__PURE__ */ e.jsx(z, { size: "sm", variant: "outline", children: /* @__PURE__ */ e.jsx(
2988
- Ol,
2952
+ kl,
2989
2953
  {
2990
2954
  className: "h-4 w-4",
2991
2955
  chartType: n,
@@ -3127,7 +3091,7 @@ function kl() {
3127
3091
  {
3128
3092
  onClick: () => p("map"),
3129
3093
  variant: "ghost",
3130
- children: /* @__PURE__ */ e.jsx(Da, { className: "size-4" })
3094
+ children: /* @__PURE__ */ e.jsx(Ta, { className: "size-4" })
3131
3095
  }
3132
3096
  ),
3133
3097
  /* @__PURE__ */ e.jsx(
@@ -3135,15 +3099,15 @@ function kl() {
3135
3099
  {
3136
3100
  onClick: () => p("custom"),
3137
3101
  variant: "ghost",
3138
- children: /* @__PURE__ */ e.jsx(La, { className: "size-4" })
3102
+ children: /* @__PURE__ */ e.jsx(Ma, { className: "size-4" })
3139
3103
  }
3140
3104
  )
3141
3105
  ] }),
3142
- /* @__PURE__ */ e.jsx(Sl, { onChartTypeChange: p })
3106
+ /* @__PURE__ */ e.jsx(Nl, { onChartTypeChange: p })
3143
3107
  ] })
3144
3108
  ] });
3145
3109
  }
3146
- function Ol({
3110
+ function kl({
3147
3111
  chartType: s,
3148
3112
  className: t,
3149
3113
  customIcon: a,
@@ -3180,14 +3144,14 @@ function Ol({
3180
3144
  case "text":
3181
3145
  return /* @__PURE__ */ e.jsx(Us, { className: t });
3182
3146
  case "map":
3183
- return /* @__PURE__ */ e.jsx(Da, { className: t });
3147
+ return /* @__PURE__ */ e.jsx(Ta, { className: t });
3184
3148
  case "custom":
3185
- return a && l ? /* @__PURE__ */ e.jsx(l, { className: t }) : n ? n == null ? void 0 : n.charAt(0).toUpperCase() : /* @__PURE__ */ e.jsx(La, { className: t });
3149
+ return a && l ? /* @__PURE__ */ e.jsx(l, { className: t }) : n ? n == null ? void 0 : n.charAt(0).toUpperCase() : /* @__PURE__ */ e.jsx(Ma, { className: t });
3186
3150
  default:
3187
3151
  return /* @__PURE__ */ e.jsx(As, { className: t });
3188
3152
  }
3189
3153
  }
3190
- function zl() {
3154
+ function Ol() {
3191
3155
  var t;
3192
3156
  const s = m((a) => a.card);
3193
3157
  return (t = s.customCardPreferences) == null || t.showCardHeader, re(), /* @__PURE__ */ e.jsxs(ra, { children: [
@@ -3196,7 +3160,7 @@ function zl() {
3196
3160
  Jt,
3197
3161
  {
3198
3162
  onClick: () => {
3199
- navigator.clipboard.writeText(s.id), Ke.success("Card ID copied to clipboard");
3163
+ navigator.clipboard.writeText(s.id), Je.success("Card ID copied to clipboard");
3200
3164
  },
3201
3165
  className: "cursor-pointer space-x-2",
3202
3166
  children: [
@@ -3208,14 +3172,14 @@ function zl() {
3208
3172
  ] });
3209
3173
  }
3210
3174
  function ta() {
3211
- const s = m((h) => h.frame), t = m((h) => h.card), a = m((h) => h.isShowingVisual), n = m((h) => h.isSqlRunning), l = m((h) => h.queryError), o = m((h) => h.pythonStdOut), r = m((h) => h.actions.setRunSql);
3175
+ const s = m((h) => h.frame), t = m((h) => h.card), a = m((h) => h.isShowingVisual), n = m((h) => h.isSqlRunning), l = m((h) => h.queryError), o = m((h) => h.pythonStdOut), i = m((h) => h.actions.setRunSql);
3212
3176
  m((h) => h.onSave), m((h) => h.onClose), m((h) => h.actions.setCardSql), m((h) => h.actions.setCardType), m((h) => h.actions.setSqlGen);
3213
- const { setFrame: c, setCard: d, updateCardInFrame: p } = re(), { data: u, isLoading: y, isFetching: g } = qe(t);
3177
+ const { setFrame: c, setCard: d, updateCardInFrame: p } = re(), { data: u, isLoading: y, isFetching: g } = Ve(t);
3214
3178
  if (!t) return /* @__PURE__ */ e.jsx(e.Fragment, { children: "No Active Card" });
3215
3179
  function x() {
3216
3180
  const h = {
3217
3181
  connectionId: t.connectionId,
3218
- id: Je(),
3182
+ id: Qe(),
3219
3183
  title: "Title",
3220
3184
  description: "Description",
3221
3185
  preferences: {
@@ -3243,14 +3207,14 @@ function ta() {
3243
3207
  function b() {
3244
3208
  const h = {
3245
3209
  ...t,
3246
- id: Je(),
3210
+ id: Qe(),
3247
3211
  title: `${t.title} Copy`,
3248
3212
  tabTitle: `${t.tabTitle} Copy`
3249
3213
  };
3250
3214
  j(h);
3251
3215
  }
3252
3216
  function I(h) {
3253
- const v = s.cards.filter((M) => M.id !== h), f = v[0], k = {
3217
+ const v = s.cards.filter((L) => L.id !== h), f = v[0], k = {
3254
3218
  ...s,
3255
3219
  cards: v,
3256
3220
  // update the active card to the first card in the frame
@@ -3266,17 +3230,17 @@ function ta() {
3266
3230
  };
3267
3231
  c(v);
3268
3232
  const f = v.cards.find((k) => k.id === h);
3269
- f.sql && r(!0), d(f);
3233
+ f.sql && i(!0), d(f);
3270
3234
  }
3271
- const T = (h, v) => {
3235
+ const D = (h, v) => {
3272
3236
  console.log("handleDragStart", v), h.dataTransfer.setData("tabIndex", v.toString());
3273
3237
  }, F = (h) => {
3274
3238
  h.preventDefault();
3275
3239
  }, A = (h, v) => {
3276
3240
  const f = h.dataTransfer.getData("tabIndex");
3277
3241
  if (f === v.toString()) return;
3278
- const k = Array.from(s.cards), [M] = k.splice(parseInt(f), 1);
3279
- k.splice(v, 0, M), c({ ...s, cards: k });
3242
+ const k = Array.from(s.cards), [L] = k.splice(parseInt(f), 1);
3243
+ k.splice(v, 0, L), c({ ...s, cards: k });
3280
3244
  };
3281
3245
  function N(h, v) {
3282
3246
  return h.cards.length === 1 && (v.displayTab === !0 || v.displayTab === void 0) || h.activeCardId !== v.id && (v.displayTab === !0 || v.displayTab === void 0) ? null : /* @__PURE__ */ e.jsx(
@@ -3289,7 +3253,7 @@ function ta() {
3289
3253
  displayTab: f
3290
3254
  });
3291
3255
  },
3292
- children: v.displayTab === !0 || v.displayTab === void 0 ? /* @__PURE__ */ e.jsx(Dn, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" }) : /* @__PURE__ */ e.jsx(In, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" })
3256
+ children: v.displayTab === !0 || v.displayTab === void 0 ? /* @__PURE__ */ e.jsx(Tn, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" }) : /* @__PURE__ */ e.jsx(In, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" })
3293
3257
  }
3294
3258
  );
3295
3259
  }
@@ -3301,7 +3265,7 @@ function ta() {
3301
3265
  value: s.activeCardId,
3302
3266
  className: "flex grow flex-col",
3303
3267
  children: [
3304
- s.cards.map((h) => /* @__PURE__ */ e.jsx(is, { className: "mt-0 grow", value: h.id, children: L() }, h.id)),
3268
+ s.cards.map((h) => /* @__PURE__ */ e.jsx(is, { className: "mt-0 grow", value: h.id, children: M() }, h.id)),
3305
3269
  /* @__PURE__ */ e.jsx(Ca, { className: "group mx-6 justify-between", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
3306
3270
  s.cards.map((h, v) => /* @__PURE__ */ e.jsx(
3307
3271
  ls,
@@ -3314,7 +3278,7 @@ function ta() {
3314
3278
  rs,
3315
3279
  {
3316
3280
  draggable: !0,
3317
- onDragStart: (f) => T(f, v),
3281
+ onDragStart: (f) => D(f, v),
3318
3282
  onDragOver: F,
3319
3283
  onDrop: (f) => A(f, v),
3320
3284
  className: "",
@@ -3341,7 +3305,7 @@ function ta() {
3341
3305
  className: "ml-1 h-8 px-2 hover:bg-muted-foreground/50",
3342
3306
  variant: "outline",
3343
3307
  onClick: x,
3344
- children: /* @__PURE__ */ e.jsx(Ds, { className: "h-4 w-4" })
3308
+ children: /* @__PURE__ */ e.jsx(Ts, { className: "h-4 w-4" })
3345
3309
  }
3346
3310
  ),
3347
3311
  /* @__PURE__ */ e.jsx(
@@ -3358,7 +3322,7 @@ function ta() {
3358
3322
  }
3359
3323
  );
3360
3324
  }
3361
- function L() {
3325
+ function M() {
3362
3326
  return t.type === "kpi" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(Kt, { card: t, data: u == null ? void 0 : u.records }) }) }) : t.type === "text" ? /* @__PURE__ */ e.jsx("div", { className: "flex h-full items-center justify-center", children: /* @__PURE__ */ e.jsx("div", { className: "w-1/2 rounded-md border", children: /* @__PURE__ */ e.jsx(We, { className: "mx-3 my-6 h-[300px] overflow-y-auto break-words px-3", children: /* @__PURE__ */ e.jsx(
3363
3327
  Wt,
3364
3328
  {
@@ -3369,23 +3333,23 @@ function ta() {
3369
3333
  ) }) }) }) : /* @__PURE__ */ e.jsx(us, { FallbackComponent: ya, children: /* @__PURE__ */ e.jsx(Ra, { className: "grow border-none shadow-none" }) });
3370
3334
  }
3371
3335
  return /* @__PURE__ */ e.jsxs("div", { className: "relative flex h-full flex-col py-3", children: [
3372
- (y || g) && /* @__PURE__ */ e.jsx(Ve, { className: "absolute bottom-0 left-0 right-0 top-0 z-50 m-auto h-10 w-10 animate-spin text-foreground/10" }),
3336
+ (y || g) && /* @__PURE__ */ e.jsx(Ke, { className: "absolute bottom-0 left-0 right-0 top-0 z-50 m-auto h-10 w-10 animate-spin text-foreground/10" }),
3373
3337
  /* @__PURE__ */ e.jsxs("div", { className: "mb-0 flex min-h-10 items-center justify-end gap-2 px-6", children: [
3374
3338
  a && /* @__PURE__ */ e.jsxs("div", { className: "flex grow items-center gap-2", children: [
3375
- /* @__PURE__ */ e.jsx(kl, {}),
3376
- !["table", "custom"].includes(t.type) && /* @__PURE__ */ e.jsx(Nl, {}),
3377
- /* @__PURE__ */ e.jsx(zl, {})
3339
+ /* @__PURE__ */ e.jsx(wl, {}),
3340
+ !["table", "custom"].includes(t.type) && /* @__PURE__ */ e.jsx(Cl, {}),
3341
+ /* @__PURE__ */ e.jsx(Ol, {})
3378
3342
  ] }),
3379
- /* @__PURE__ */ e.jsx(Il, {})
3343
+ /* @__PURE__ */ e.jsx(Fl, {})
3380
3344
  ] }),
3381
3345
  a ? S() : /* @__PURE__ */ e.jsxs("div", { className: "flex min-h-0 w-full flex-1 grow basis-0 px-6", children: [
3382
- o && /* @__PURE__ */ e.jsx(Fl, {}),
3383
- (u == null ? void 0 : u.records) && (u == null ? void 0 : u.records.length) > 0 && /* @__PURE__ */ e.jsx(vl, { data: (u == null ? void 0 : u.records) || [] }),
3346
+ o && /* @__PURE__ */ e.jsx(zl, {}),
3347
+ (u == null ? void 0 : u.records) && (u == null ? void 0 : u.records.length) > 0 && /* @__PURE__ */ e.jsx(yl, { data: (u == null ? void 0 : u.records) || [] }),
3384
3348
  l && /* @__PURE__ */ e.jsx("span", { className: "font-mono text-sm", children: l })
3385
3349
  ] })
3386
3350
  ] });
3387
3351
  }
3388
- function Fl() {
3352
+ function zl() {
3389
3353
  const s = m((a) => a.pythonStdOut);
3390
3354
  if (!s) return null;
3391
3355
  const t = s.replace(/\n/g, "<br>");
@@ -3401,7 +3365,7 @@ function Fl() {
3401
3365
  /* @__PURE__ */ e.jsx(ge, { className: "mb-2" })
3402
3366
  ] });
3403
3367
  }
3404
- function Il() {
3368
+ function Fl() {
3405
3369
  const s = m((a) => a.isShowingVisual), t = m(
3406
3370
  (a) => a.actions.setIsShowingVisual
3407
3371
  );
@@ -3418,7 +3382,7 @@ function Il() {
3418
3382
  )
3419
3383
  ] });
3420
3384
  }
3421
- function Dl({
3385
+ function Il({
3422
3386
  options: s,
3423
3387
  value: t,
3424
3388
  onValueChange: a
@@ -3431,7 +3395,7 @@ function Dl({
3431
3395
  className: "flex gap-4",
3432
3396
  defaultValue: s[0].value,
3433
3397
  children: s.map((n) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3434
- /* @__PURE__ */ e.jsx(Ie, { value: n.value, id: n.value }),
3398
+ /* @__PURE__ */ e.jsx(Fe, { value: n.value, id: n.value }),
3435
3399
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: n.value, children: n.label })
3436
3400
  ] }, n.value))
3437
3401
  }
@@ -3458,7 +3422,7 @@ function ue({
3458
3422
  ] }) })
3459
3423
  ] });
3460
3424
  }
3461
- function Ge({
3425
+ function Ue({
3462
3426
  children: s,
3463
3427
  summary: t,
3464
3428
  open: a,
@@ -3483,28 +3447,28 @@ function Tl() {
3483
3447
  var b, I;
3484
3448
  const s = m(
3485
3449
  (C) => C.card.customCardPreferences
3486
- ), { data: t } = Ka(), a = (t == null ? void 0 : t.plugins) || [], n = m((C) => C.card), l = m((C) => C.frame), o = (s == null ? void 0 : s.visualType) || "single", { setCustomCardPreferences: r } = re(), { components: c, manifest: d } = ja(
3450
+ ), { data: t } = Ka(), a = (t == null ? void 0 : t.plugins) || [], n = m((C) => C.card), l = m((C) => C.frame), o = (s == null ? void 0 : s.visualType) || "single", { setCustomCardPreferences: i } = re(), { components: c, manifest: d } = ja(
3487
3451
  (s == null ? void 0 : s.url) || ""
3488
3452
  ), p = (b = d == null ? void 0 : d.visuals) == null ? void 0 : b.find(
3489
3453
  (C) => C.name === (s == null ? void 0 : s.componentName)
3490
3454
  );
3491
- function u(C, T) {
3455
+ function u(C, D) {
3492
3456
  if (!s) return;
3493
3457
  const A = {
3494
3458
  ...(s == null ? void 0 : s.dataInputCardIds) || {},
3495
3459
  [C]: {
3496
- cardId: T,
3460
+ cardId: D,
3497
3461
  hookRef: null
3498
3462
  }
3499
3463
  };
3500
- r({
3464
+ i({
3501
3465
  ...s,
3502
3466
  dataInputCardIds: A
3503
3467
  });
3504
3468
  }
3505
3469
  function y(C) {
3506
3470
  var F, A;
3507
- const T = (F = l == null ? void 0 : l.cards) == null ? void 0 : F.filter((N) => {
3471
+ const D = (F = l == null ? void 0 : l.cards) == null ? void 0 : F.filter((N) => {
3508
3472
  var S;
3509
3473
  return ((S = N == null ? void 0 : N.customCardPreferences) == null ? void 0 : S.visualType) !== "multiple";
3510
3474
  }).map((N) => ({
@@ -3512,7 +3476,7 @@ function Tl() {
3512
3476
  label: N.tabTitle || N.title
3513
3477
  }));
3514
3478
  return /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: (A = C == null ? void 0 : C.dataInputs) == null ? void 0 : A.map((N, S) => {
3515
- var L, h;
3479
+ var M, h;
3516
3480
  return /* @__PURE__ */ e.jsxs(
3517
3481
  "div",
3518
3482
  {
@@ -3524,8 +3488,8 @@ function Tl() {
3524
3488
  {
3525
3489
  className: "col-span-6 h-8 w-full justify-between",
3526
3490
  label: "",
3527
- options: T || [],
3528
- value: ((h = (L = s == null ? void 0 : s.dataInputCardIds) == null ? void 0 : L[S]) == null ? void 0 : h.cardId) || "",
3491
+ options: D || [],
3492
+ value: ((h = (M = s == null ? void 0 : s.dataInputCardIds) == null ? void 0 : M[S]) == null ? void 0 : h.cardId) || "",
3529
3493
  onValueChange: (v) => u(S, v)
3530
3494
  }
3531
3495
  )
@@ -3535,43 +3499,43 @@ function Tl() {
3535
3499
  );
3536
3500
  }) });
3537
3501
  }
3538
- function g(C, T, F = []) {
3502
+ function g(C, D, F = []) {
3539
3503
  var A, N;
3540
3504
  return s ? C === "input" ? /* @__PURE__ */ e.jsx(
3541
3505
  le,
3542
3506
  {
3543
- className: `h-8 w-full ${Be}`,
3544
- value: ((A = s == null ? void 0 : s.settings) == null ? void 0 : A[T]) || "",
3507
+ className: `h-8 w-full ${Pe}`,
3508
+ value: ((A = s == null ? void 0 : s.settings) == null ? void 0 : A[D]) || "",
3545
3509
  onChange: (S) => {
3546
- r({
3510
+ i({
3547
3511
  ...s,
3548
3512
  settings: {
3549
3513
  ...s == null ? void 0 : s.settings,
3550
- [T]: S.target.value
3514
+ [D]: S.target.value
3551
3515
  }
3552
3516
  });
3553
3517
  }
3554
3518
  },
3555
- T
3519
+ D
3556
3520
  ) : C === "select" ? /* @__PURE__ */ e.jsx(
3557
3521
  ue,
3558
3522
  {
3559
3523
  className: "h-8 w-full",
3560
3524
  label: "",
3561
3525
  options: F,
3562
- value: ((N = s == null ? void 0 : s.settings) == null ? void 0 : N[T]) || "",
3526
+ value: ((N = s == null ? void 0 : s.settings) == null ? void 0 : N[D]) || "",
3563
3527
  onValueChange: (S) => {
3564
- r({
3528
+ i({
3565
3529
  ...s,
3566
- settings: { ...s == null ? void 0 : s.settings, [T]: S }
3530
+ settings: { ...s == null ? void 0 : s.settings, [D]: S }
3567
3531
  });
3568
3532
  }
3569
3533
  }
3570
3534
  ) : null : null;
3571
3535
  }
3572
3536
  function x(C) {
3573
- const T = Object.entries((C == null ? void 0 : C.settings) || {});
3574
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: T.map(([F, A]) => /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3537
+ const D = Object.entries((C == null ? void 0 : C.settings) || {});
3538
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: D.map(([F, A]) => /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3575
3539
  /* @__PURE__ */ e.jsx(R, { children: A.title }),
3576
3540
  g(
3577
3541
  A.ui,
@@ -3581,7 +3545,7 @@ function Tl() {
3581
3545
  ] }, F)) });
3582
3546
  }
3583
3547
  function j(C) {
3584
- s && r({
3548
+ s && i({
3585
3549
  ...s,
3586
3550
  visualType: C,
3587
3551
  componentName: ""
@@ -3592,7 +3556,7 @@ function Tl() {
3592
3556
  {
3593
3557
  className: "p-6",
3594
3558
  children: [
3595
- /* @__PURE__ */ e.jsx(Ge, { summary: "Plugin Settings", children: /* @__PURE__ */ e.jsx("div", { className: "space-y-4 text-sm", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 text-sm", children: [
3559
+ /* @__PURE__ */ e.jsx(Ue, { summary: "Plugin Settings", children: /* @__PURE__ */ e.jsx("div", { className: "space-y-4 text-sm", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 text-sm", children: [
3596
3560
  /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: /* @__PURE__ */ e.jsx("div", { className: "px-2", children: /* @__PURE__ */ e.jsx(
3597
3561
  ue,
3598
3562
  {
@@ -3600,7 +3564,7 @@ function Tl() {
3600
3564
  label: "",
3601
3565
  options: a,
3602
3566
  value: (s == null ? void 0 : s.url) || "",
3603
- onValueChange: (C) => r({
3567
+ onValueChange: (C) => i({
3604
3568
  ...s || {
3605
3569
  url: "",
3606
3570
  componentName: ""
@@ -3610,7 +3574,7 @@ function Tl() {
3610
3574
  }
3611
3575
  ) }) }),
3612
3576
  ((s == null ? void 0 : s.type) === "component" || (s == null ? void 0 : s.type) === void 0) && /* @__PURE__ */ e.jsx(
3613
- Dl,
3577
+ Il,
3614
3578
  {
3615
3579
  options: [
3616
3580
  { value: "single", label: "Single Visual" },
@@ -3635,7 +3599,7 @@ function Tl() {
3635
3599
  }))) || [],
3636
3600
  value: s.componentName,
3637
3601
  onValueChange: (C) => {
3638
- console.log("changing value", C), r({
3602
+ console.log("changing value", C), i({
3639
3603
  ...s,
3640
3604
  componentName: C
3641
3605
  });
@@ -3645,7 +3609,7 @@ function Tl() {
3645
3609
  ] }) })
3646
3610
  ] }) }) }),
3647
3611
  /* @__PURE__ */ e.jsx(ge, { className: "my-4" }),
3648
- ((I = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : I.componentName) && /* @__PURE__ */ e.jsxs(Ge, { summary: "Component Settings", children: [
3612
+ ((I = n == null ? void 0 : n.customCardPreferences) == null ? void 0 : I.componentName) && /* @__PURE__ */ e.jsxs(Ue, { summary: "Component Settings", children: [
3649
3613
  p && p.dataInputs && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3650
3614
  /* @__PURE__ */ e.jsx(R, { children: "Input Mapping" }),
3651
3615
  /* @__PURE__ */ e.jsx("div", { className: "px-2", children: y(p) })
@@ -3656,12 +3620,12 @@ function Tl() {
3656
3620
  }
3657
3621
  );
3658
3622
  }
3659
- function Te() {
3623
+ function De() {
3660
3624
  const [s, t] = q([]);
3661
3625
  m(
3662
3626
  (u) => u.card.cfg
3663
3627
  );
3664
- const a = m((u) => u.card.preferences), { setCardCfg: n, setFilterOnClickColumnIndex: l, setCardPreferences: o } = m((u) => u.actions), r = m(
3628
+ const a = m((u) => u.card.preferences), { setCardCfg: n, setFilterOnClickColumnIndex: l, setCardPreferences: o } = m((u) => u.actions), i = m(
3665
3629
  (u) => u.queryResultColumns
3666
3630
  );
3667
3631
  m(
@@ -3670,8 +3634,8 @@ function Te() {
3670
3634
  return (y = u.card.preferences) == null ? void 0 : y.filterOnClickColumnIndex;
3671
3635
  }
3672
3636
  ), Z(() => {
3673
- r && t(new Array(r.length).fill(!1));
3674
- }, [r]);
3637
+ i && t(new Array(i.length).fill(!1));
3638
+ }, [i]);
3675
3639
  function c(u, y) {
3676
3640
  var g, x;
3677
3641
  y ? a != null && a.onClickFilter && ((g = a == null ? void 0 : a.onClickFilter) == null ? void 0 : g.length) > 0 ? o({
@@ -3728,7 +3692,7 @@ function Te() {
3728
3692
  }
3729
3693
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3730
3694
  /* @__PURE__ */ e.jsx(R, { children: "On Click" }),
3731
- r == null ? void 0 : r.map((u, y) => {
3695
+ i == null ? void 0 : i.map((u, y) => {
3732
3696
  var g, x;
3733
3697
  return /* @__PURE__ */ e.jsx(
3734
3698
  "div",
@@ -3755,7 +3719,7 @@ function Te() {
3755
3719
  /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: ((x = a == null ? void 0 : a.onClickFilter) == null ? void 0 : x.find(
3756
3720
  (j) => j.columnIndex === y
3757
3721
  )) && /* @__PURE__ */ e.jsx(
3758
- Ta,
3722
+ Da,
3759
3723
  {
3760
3724
  onClick: () => {
3761
3725
  t((j) => {
@@ -3776,11 +3740,11 @@ function Te() {
3776
3740
  ] });
3777
3741
  }
3778
3742
  function fs() {
3779
- var r, c, d;
3743
+ var i, c, d;
3780
3744
  const s = m((p) => p.card.preferences), t = m(
3781
3745
  (p) => p.card.cfg
3782
3746
  ), { setCardCfg: a, setCardPreferences: n, setChartOrientation: l } = m((p) => p.actions);
3783
- (r = t == null ? void 0 : t.options) != null && r.indexAxis;
3747
+ (i = t == null ? void 0 : t.options) != null && i.indexAxis;
3784
3748
  function o(p) {
3785
3749
  l(p);
3786
3750
  }
@@ -3793,11 +3757,11 @@ function fs() {
3793
3757
  defaultValue: "x",
3794
3758
  children: [
3795
3759
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3796
- /* @__PURE__ */ e.jsx(Ie, { value: "x", id: "r1" }),
3760
+ /* @__PURE__ */ e.jsx(Fe, { value: "x", id: "r1" }),
3797
3761
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Vertical" })
3798
3762
  ] }),
3799
3763
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3800
- /* @__PURE__ */ e.jsx(Ie, { value: "y", id: "r2" }),
3764
+ /* @__PURE__ */ e.jsx(Fe, { value: "y", id: "r2" }),
3801
3765
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Horizontal" })
3802
3766
  ] })
3803
3767
  ]
@@ -3813,37 +3777,37 @@ function na(s, t) {
3813
3777
  function Wa() {
3814
3778
  var ie, K, ae, w, _, ee;
3815
3779
  const [s, t] = q(!1), a = m((E) => {
3816
- var D;
3817
- return (D = E.card) == null ? void 0 : D.preferences;
3780
+ var T;
3781
+ return (T = E.card) == null ? void 0 : T.preferences;
3818
3782
  }), n = m((E) => {
3819
- var D;
3820
- return (D = E.card) == null ? void 0 : D.cfg;
3821
- }), l = wa(a, n), [o, r] = q(
3783
+ var T;
3784
+ return (T = E.card) == null ? void 0 : T.cfg;
3785
+ }), l = wa(a, n), [o, i] = q(
3822
3786
  na(a)
3823
3787
  ), [c, d] = q(
3824
3788
  ((ae = (K = (ie = a == null ? void 0 : a.chartOptions) == null ? void 0 : ie.scales) == null ? void 0 : K[l]) == null ? void 0 : ae.min) || ""
3825
3789
  ), [p, u] = q(
3826
3790
  ((ee = (_ = (w = a == null ? void 0 : a.chartOptions) == null ? void 0 : w.scales) == null ? void 0 : _[l]) == null ? void 0 : ee.max) || ""
3827
- ), [y, g] = q(c || p ? "custom" : "auto"), [x, j] = q(""), [b, I] = q(0), [C, T] = q(""), [F, A] = q(""), [N, S] = q(""), L = m(
3791
+ ), [y, g] = q(c || p ? "custom" : "auto"), [x, j] = q(""), [b, I] = q(0), [C, D] = q(""), [F, A] = q(""), [N, S] = q(""), M = m(
3828
3792
  (E) => E.actions.setCardPreferences
3829
3793
  ), { updateCardInFrame: h } = re(), v = m((E) => E.card), f = m((E) => {
3830
- var D;
3831
- return (D = E.card) == null ? void 0 : D.type;
3794
+ var T;
3795
+ return (T = E.card) == null ? void 0 : T.type;
3832
3796
  }), k = ["pie", "doughnut", "polarArea"].includes(f);
3833
3797
  Z(() => {
3834
- var E, D, se, $, X, te, Le, Oe, be, ye, Q, oe, ce, ze;
3835
- r(na(a)), d(
3836
- ((se = (D = (E = a == null ? void 0 : a.chartOptions) == null ? void 0 : E.scales) == null ? void 0 : D[l]) == null ? void 0 : se.min) === 0 ? 0 : ""
3798
+ var E, T, se, $, X, te, Me, ke, be, ye, Q, oe, ce, Oe;
3799
+ i(na(a)), d(
3800
+ ((se = (T = (E = a == null ? void 0 : a.chartOptions) == null ? void 0 : E.scales) == null ? void 0 : T[l]) == null ? void 0 : se.min) === 0 ? 0 : ""
3837
3801
  ), u(((te = (X = ($ = a == null ? void 0 : a.chartOptions) == null ? void 0 : $.scales) == null ? void 0 : X[l]) == null ? void 0 : te.max) || ""), j(
3838
- ((ye = (be = (Oe = (Le = a == null ? void 0 : a.chartOptions) == null ? void 0 : Le.scales) == null ? void 0 : Oe[l]) == null ? void 0 : be.ticks) == null ? void 0 : ye.stepSize) || ""
3839
- ), I(((Q = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Q.decimalPlaces) || 0), T(((oe = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : oe.suffix) || ""), A(((ce = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ce.currency) || ""), S(((ze = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ze.locale) || "");
3802
+ ((ye = (be = (ke = (Me = a == null ? void 0 : a.chartOptions) == null ? void 0 : Me.scales) == null ? void 0 : ke[l]) == null ? void 0 : be.ticks) == null ? void 0 : ye.stepSize) || ""
3803
+ ), I(((Q = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Q.decimalPlaces) || 0), D(((oe = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : oe.suffix) || ""), A(((ce = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ce.currency) || ""), S(((Oe = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : Oe.locale) || "");
3840
3804
  }, [s, a, l]);
3841
- function M(E, D) {
3842
- return D === "" || /^[0-9\b]+$/.test(D) ? Number(D) : Number(E);
3805
+ function L(E, T) {
3806
+ return T === "" || /^[0-9\b]+$/.test(T) ? Number(T) : Number(E);
3843
3807
  }
3844
3808
  function H() {
3845
3809
  const E = [
3846
- ...new Set(os.map((D) => D.currency))
3810
+ ...new Set(os.map((T) => T.currency))
3847
3811
  ];
3848
3812
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3849
3813
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-6 items-center gap-2", children: [
@@ -3866,18 +3830,18 @@ function Wa() {
3866
3830
  me,
3867
3831
  {
3868
3832
  value: F || "none",
3869
- onValueChange: (D) => A(D === "none" ? "" : D),
3833
+ onValueChange: (T) => A(T === "none" ? "" : T),
3870
3834
  children: [
3871
3835
  /* @__PURE__ */ e.jsx(he, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(xe, {}) }),
3872
3836
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
3873
3837
  /* @__PURE__ */ e.jsx(fe, { children: "Currency" }),
3874
3838
  /* @__PURE__ */ e.jsx(J, { value: "none", children: "None" }),
3875
- E.map((D) => /* @__PURE__ */ e.jsx(J, { value: D, children: D }, D))
3839
+ E.map((T) => /* @__PURE__ */ e.jsx(J, { value: T, children: T }, T))
3876
3840
  ] }) })
3877
3841
  ]
3878
3842
  }
3879
3843
  ),
3880
- /* @__PURE__ */ e.jsxs(me, { value: N, onValueChange: (D) => S(D), children: [
3844
+ /* @__PURE__ */ e.jsxs(me, { value: N, onValueChange: (T) => S(T), children: [
3881
3845
  /* @__PURE__ */ e.jsx(
3882
3846
  he,
3883
3847
  {
@@ -3887,7 +3851,7 @@ function Wa() {
3887
3851
  ),
3888
3852
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
3889
3853
  /* @__PURE__ */ e.jsx(fe, { children: "Locale" }),
3890
- os.map((D) => /* @__PURE__ */ e.jsx(J, { value: D.locale, children: D.locale }, D.locale))
3854
+ os.map((T) => /* @__PURE__ */ e.jsx(J, { value: T.locale, children: T.locale }, T.locale))
3891
3855
  ] }) })
3892
3856
  ] })
3893
3857
  ] }),
@@ -3897,7 +3861,7 @@ function Wa() {
3897
3861
  le,
3898
3862
  {
3899
3863
  value: b,
3900
- onChange: (D) => I(Number(D.target.value)),
3864
+ onChange: (T) => I(Number(T.target.value)),
3901
3865
  id: "format",
3902
3866
  className: `col-span-6 h-8 w-full tracking-wide ${ts}`
3903
3867
  }
@@ -3914,7 +3878,7 @@ function Wa() {
3914
3878
  {
3915
3879
  id: "min",
3916
3880
  value: c,
3917
- onChange: (E) => d((D) => M(D, E.target.value)),
3881
+ onChange: (E) => d((T) => L(T, E.target.value)),
3918
3882
  className: `col-span-1 h-8 w-full ${ts}`
3919
3883
  }
3920
3884
  ),
@@ -3922,7 +3886,7 @@ function Wa() {
3922
3886
  le,
3923
3887
  {
3924
3888
  value: p,
3925
- onChange: (E) => u((D) => M(D, E.target.value)),
3889
+ onChange: (E) => u((T) => L(T, E.target.value)),
3926
3890
  id: "max",
3927
3891
  className: `col-span-1 h-8 w-full ${ts}`
3928
3892
  }
@@ -3934,7 +3898,7 @@ function Wa() {
3934
3898
  le,
3935
3899
  {
3936
3900
  value: x,
3937
- onChange: (E) => j((D) => M(D, E.target.value)),
3901
+ onChange: (E) => j((T) => L(T, E.target.value)),
3938
3902
  id: "step-size",
3939
3903
  className: `col-span-1 h-8 w-full ${ts}`
3940
3904
  }
@@ -3952,7 +3916,7 @@ function Wa() {
3952
3916
  stepSize: x
3953
3917
  }
3954
3918
  });
3955
- const D = {
3919
+ const T = {
3956
3920
  ...a || {},
3957
3921
  chartOptions: {
3958
3922
  ...a == null ? void 0 : a.chartOptions,
@@ -3972,10 +3936,10 @@ function Wa() {
3972
3936
  locale: N
3973
3937
  }
3974
3938
  };
3975
- console.log(D), L(D);
3939
+ console.log(T), M(T);
3976
3940
  const se = {
3977
3941
  ...v,
3978
- preferences: D
3942
+ preferences: T
3979
3943
  };
3980
3944
  h(se);
3981
3945
  }
@@ -3994,7 +3958,7 @@ function Wa() {
3994
3958
  {
3995
3959
  disabled: k,
3996
3960
  value: o,
3997
- onValueChange: (E) => r(E),
3961
+ onValueChange: (E) => i(E),
3998
3962
  children: [
3999
3963
  /* @__PURE__ */ e.jsx(he, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(xe, {}) }),
4000
3964
  /* @__PURE__ */ e.jsx(pe, { id: "type", children: /* @__PURE__ */ e.jsxs(Se, { children: [
@@ -4019,11 +3983,11 @@ function Wa() {
4019
3983
  defaultValue: "x",
4020
3984
  children: [
4021
3985
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
4022
- /* @__PURE__ */ e.jsx(Ie, { value: "auto", id: "r1" }),
3986
+ /* @__PURE__ */ e.jsx(Fe, { value: "auto", id: "r1" }),
4023
3987
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Auto" })
4024
3988
  ] }),
4025
3989
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
4026
- /* @__PURE__ */ e.jsx(Ie, { value: "custom", id: "r2" }),
3990
+ /* @__PURE__ */ e.jsx(Fe, { value: "custom", id: "r2" }),
4027
3991
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Custom" })
4028
3992
  ] })
4029
3993
  ]
@@ -4046,7 +4010,7 @@ function Wa() {
4046
4010
  ] }) })
4047
4011
  ] });
4048
4012
  }
4049
- function Ll({ idx: s }) {
4013
+ function Dl({ idx: s }) {
4050
4014
  var c;
4051
4015
  const t = m((d) => {
4052
4016
  var p;
@@ -4059,7 +4023,7 @@ function Ll({ idx: s }) {
4059
4023
  ), n = m(
4060
4024
  (d) => d.actions.setCardPreferences
4061
4025
  ), l = (c = t == null ? void 0 : t.chartOptions) == null ? void 0 : c.indexAxis, o = a == null ? void 0 : a.find((d) => d.idx === s);
4062
- function r(d, p) {
4026
+ function i(d, p) {
4063
4027
  (d === "end" || d === "start") && sn(an());
4064
4028
  const u = {
4065
4029
  display: d !== "none",
@@ -4096,7 +4060,7 @@ function Ll({ idx: s }) {
4096
4060
  /* @__PURE__ */ e.jsx(
4097
4061
  z,
4098
4062
  {
4099
- onClick: () => r("none", s),
4063
+ onClick: () => i("none", s),
4100
4064
  size: "sm",
4101
4065
  variant: "secondary",
4102
4066
  className: "h-7 p-1 text-xs font-normal",
@@ -4106,7 +4070,7 @@ function Ll({ idx: s }) {
4106
4070
  /* @__PURE__ */ e.jsx(
4107
4071
  z,
4108
4072
  {
4109
- onClick: () => r("start", s),
4073
+ onClick: () => i("start", s),
4110
4074
  size: "sm",
4111
4075
  variant: "secondary",
4112
4076
  className: "h-7 p-1 text-xs font-normal",
@@ -4123,7 +4087,7 @@ function Ll({ idx: s }) {
4123
4087
  /* @__PURE__ */ e.jsx(
4124
4088
  z,
4125
4089
  {
4126
- onClick: () => r("center", s),
4090
+ onClick: () => i("center", s),
4127
4091
  size: "sm",
4128
4092
  variant: "secondary",
4129
4093
  className: "h-7 p-1 text-xs font-normal",
@@ -4140,7 +4104,7 @@ function Ll({ idx: s }) {
4140
4104
  /* @__PURE__ */ e.jsx(
4141
4105
  z,
4142
4106
  {
4143
- onClick: () => r("end", s),
4107
+ onClick: () => i("end", s),
4144
4108
  size: "sm",
4145
4109
  variant: "secondary",
4146
4110
  className: "h-7 p-1 text-xs font-normal",
@@ -4163,12 +4127,12 @@ function Ya() {
4163
4127
  var u, y, g;
4164
4128
  return (g = (y = (u = p == null ? void 0 : p.card) == null ? void 0 : u.preferences) == null ? void 0 : y.chartOptions) == null ? void 0 : g.indexAxis;
4165
4129
  }
4166
- ), { data: a } = qe(s), n = t === "y" ? "Y axis" : "X axis", l = t === "y" ? "X axis" : "Y axis", {
4130
+ ), { data: a } = Ve(s), n = t === "y" ? "Y axis" : "X axis", l = t === "y" ? "X axis" : "Y axis", {
4167
4131
  keys: o,
4168
- metricKeys: r,
4132
+ metricKeys: i,
4169
4133
  dimensionKeys: c
4170
4134
  } = vs((a == null ? void 0 : a.records) || []);
4171
- let d = r;
4135
+ let d = i;
4172
4136
  if (["stackedBar", "stackedLine"].includes(s.type)) {
4173
4137
  const p = tn({
4174
4138
  dataArray: (a == null ? void 0 : a.records) || [],
@@ -4202,7 +4166,7 @@ function Ml({ col: s, idx: t }) {
4202
4166
  return (d = c.card.preferences) == null ? void 0 : d.datasetOptions;
4203
4167
  }
4204
4168
  ), l = n == null ? void 0 : n.find((c) => c.idx === t), { setCardPreferences: o } = m((c) => c.actions);
4205
- function r(c) {
4169
+ function i(c) {
4206
4170
  if (!l)
4207
4171
  o({
4208
4172
  ...a,
@@ -4233,53 +4197,53 @@ function Ml({ col: s, idx: t }) {
4233
4197
  /* @__PURE__ */ e.jsx(
4234
4198
  Ps,
4235
4199
  {
4236
- onClick: () => r("bar"),
4200
+ onClick: () => i("bar"),
4237
4201
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4238
4202
  }
4239
4203
  ),
4240
4204
  /* @__PURE__ */ e.jsx(
4241
4205
  Bs,
4242
4206
  {
4243
- onClick: () => r("line"),
4207
+ onClick: () => i("line"),
4244
4208
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4245
4209
  }
4246
4210
  ),
4247
4211
  /* @__PURE__ */ e.jsx(
4248
4212
  wn,
4249
4213
  {
4250
- onClick: () => r("area"),
4214
+ onClick: () => i("area"),
4251
4215
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4252
4216
  }
4253
4217
  ),
4254
- /* @__PURE__ */ e.jsx(Ll, { idx: t })
4218
+ /* @__PURE__ */ e.jsx(Dl, { idx: t })
4255
4219
  ] })
4256
4220
  ] });
4257
4221
  }
4258
4222
  function Xa() {
4259
- const s = m((g) => g.selectedConnectionId), t = m((g) => g.selectedDatamodelId), a = m((g) => g.selectedDatabaseName), n = m((g) => g.selectedSchemaName), l = m((g) => g.selectedTableName), o = O((g) => g.dashboard.filters) || [], r = O((g) => g.actions.addFilter), c = O((g) => g.actions.removeFilter), d = O(
4223
+ const s = m((g) => g.selectedConnectionId), t = m((g) => g.selectedDatamodelId), a = m((g) => g.selectedDatabaseName), n = m((g) => g.selectedSchemaName), l = m((g) => g.selectedTableName), o = O((g) => g.dashboard.filters) || [], i = O((g) => g.actions.addFilter), c = O((g) => g.actions.removeFilter), d = O(
4260
4224
  (g) => g.actions.removeFilterValue
4261
- ), { modelItems: p, tableName: u } = Re();
4225
+ ), { modelItems: p, tableName: u } = qe();
4262
4226
  function y(g, x = "dashboard") {
4263
4227
  var S;
4264
4228
  const j = de(g.column_name), b = de(a || ""), I = de(n || ""), C = de(u);
4265
- let T = fa(
4229
+ let D = fa(
4266
4230
  I,
4267
4231
  C
4268
- ), F = `${T}.${j}`;
4232
+ ), F = `${D}.${j}`;
4269
4233
  const A = (S = p == null ? void 0 : p.find(
4270
- (L) => L.id === t
4234
+ (M) => M.id === t
4271
4235
  )) == null ? void 0 : S.name;
4272
- t && t !== "none" && (F = `${ys}.${A}.${j}`, T = `${ys}.${A}`);
4236
+ t && t !== "none" && (F = `${ys}.${A}.${j}`, D = `${ys}.${A}`);
4273
4237
  const N = o == null ? void 0 : o.find(
4274
- (L) => L.column === F && L.table === C && (L.database === b || L.database === a)
4238
+ (M) => M.column === F && M.table === C && (M.database === b || M.database === a)
4275
4239
  );
4276
4240
  if (N)
4277
4241
  d(N.id), c(N.id);
4278
4242
  else {
4279
- const L = Je();
4280
- return u === "api" && s ? (r({
4243
+ const M = Qe();
4244
+ return u === "api" && s ? (i({
4281
4245
  location: x,
4282
- id: L,
4246
+ id: M,
4283
4247
  //uuidv4(),
4284
4248
  column: F,
4285
4249
  title: g.column_name,
@@ -4291,12 +4255,12 @@ function Xa() {
4291
4255
  operation: "in",
4292
4256
  sql: Zs(
4293
4257
  g.data_type,
4294
- T,
4258
+ D,
4295
4259
  j
4296
4260
  )
4297
4261
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
4298
- }), L) : (r({
4299
- id: L,
4262
+ }), M) : (i({
4263
+ id: M,
4300
4264
  //uuidv4(),
4301
4265
  location: x,
4302
4266
  column: F,
@@ -4309,35 +4273,35 @@ function Xa() {
4309
4273
  operation: "in",
4310
4274
  sql: Zs(
4311
4275
  g.data_type,
4312
- T,
4276
+ D,
4313
4277
  j
4314
4278
  )
4315
4279
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
4316
- }), L);
4280
+ }), M);
4317
4281
  }
4318
4282
  }
4319
4283
  return { assignFilter: y };
4320
4284
  }
4321
- function _e() {
4285
+ function Re() {
4322
4286
  const s = O(
4323
4287
  (c) => c.dashboard.filters
4324
- ), t = m((c) => c.frame), { setFrame: a } = re(), { columns: n } = Re(), { assignFilter: l } = Xa();
4288
+ ), t = m((c) => c.frame), { setFrame: a } = re(), { columns: n } = qe(), { assignFilter: l } = Xa();
4325
4289
  function o(c) {
4326
4290
  const d = l(c, "frame");
4327
4291
  a({ ...t, filterId: d });
4328
4292
  }
4329
- const r = s == null ? void 0 : s.find((c) => c.id === t.filterId);
4293
+ const i = s == null ? void 0 : s.find((c) => c.id === t.filterId);
4330
4294
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
4331
4295
  /* @__PURE__ */ e.jsx(R, { children: "Card Filter" }),
4332
- /* @__PURE__ */ e.jsx(El, { onSelect: o, columns: n }),
4333
- r && /* @__PURE__ */ e.jsx(nn, { filter: r })
4296
+ /* @__PURE__ */ e.jsx(Ll, { onSelect: o, columns: n }),
4297
+ i && /* @__PURE__ */ e.jsx(nn, { filter: i })
4334
4298
  ] });
4335
4299
  }
4336
- function El({
4300
+ function Ll({
4337
4301
  columns: s,
4338
4302
  onSelect: t
4339
4303
  }) {
4340
- var r;
4304
+ var i;
4341
4305
  const [a, n] = ea.useState(!1), [l, o] = ea.useState("");
4342
4306
  return /* @__PURE__ */ e.jsxs(ms, { open: a, onOpenChange: n, children: [
4343
4307
  /* @__PURE__ */ e.jsx(hs, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
@@ -4349,7 +4313,7 @@ function El({
4349
4313
  "aria-expanded": a,
4350
4314
  className: "w-full justify-between font-normal",
4351
4315
  children: [
4352
- l ? (r = s.find((c) => c.column_name === l)) == null ? void 0 : r.column_name : "Select Column...",
4316
+ l ? (i = s.find((c) => c.column_name === l)) == null ? void 0 : i.column_name : "Select Column...",
4353
4317
  /* @__PURE__ */ e.jsx(ln, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
4354
4318
  ]
4355
4319
  }
@@ -4385,10 +4349,10 @@ function El({
4385
4349
  ] }) })
4386
4350
  ] });
4387
4351
  }
4388
- function Al({
4352
+ function El({
4389
4353
  cardType: s
4390
4354
  }) {
4391
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(De, { defaultValue: ["item-2"], type: "multiple", children: [
4355
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
4392
4356
  /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
4393
4357
  /* @__PURE__ */ e.jsx(U, { children: `${$s(s)} Chart` }),
4394
4358
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 font-mono text-xs", children: [
@@ -4424,14 +4388,14 @@ function Al({
4424
4388
  /* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
4425
4389
  /* @__PURE__ */ e.jsx(U, { children: "Filters" }),
4426
4390
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 px-2", children: [
4427
- /* @__PURE__ */ e.jsx(Te, {}),
4428
- /* @__PURE__ */ e.jsx(_e, {})
4391
+ /* @__PURE__ */ e.jsx(De, {}),
4392
+ /* @__PURE__ */ e.jsx(Re, {})
4429
4393
  ] })
4430
4394
  ] })
4431
4395
  ] }) });
4432
4396
  }
4433
4397
  function Gs() {
4434
- var l, o, r;
4398
+ var l, o, i;
4435
4399
  const s = m(
4436
4400
  (c) => c.card.cfg
4437
4401
  ), t = m((c) => c.actions.setCardCfg), a = m((c) => c.card.type);
@@ -4464,7 +4428,7 @@ function Gs() {
4464
4428
  /* @__PURE__ */ e.jsxs(
4465
4429
  me,
4466
4430
  {
4467
- value: (r = (o = (l = s == null ? void 0 : s.options) == null ? void 0 : l.plugins) == null ? void 0 : o.datalabels) == null ? void 0 : r.anchor,
4431
+ value: (i = (o = (l = s == null ? void 0 : s.options) == null ? void 0 : l.plugins) == null ? void 0 : o.datalabels) == null ? void 0 : i.anchor,
4468
4432
  onValueChange: n,
4469
4433
  defaultValue: "none",
4470
4434
  children: [
@@ -4481,7 +4445,7 @@ function Gs() {
4481
4445
  )
4482
4446
  ] });
4483
4447
  }
4484
- function Vl({
4448
+ function Al({
4485
4449
  cardType: s
4486
4450
  }) {
4487
4451
  function t(a) {
@@ -4510,7 +4474,7 @@ function Vl({
4510
4474
  ] })
4511
4475
  ] });
4512
4476
  }
4513
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(De, { defaultValue: ["item-2"], type: "multiple", children: [
4477
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
4514
4478
  /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
4515
4479
  /* @__PURE__ */ e.jsx(U, { children: `${$s(s)} Chart` }),
4516
4480
  /* @__PURE__ */ e.jsx(G, { className: "space-y-4 font-mono text-xs", children: t(s) })
@@ -4522,13 +4486,13 @@ function Vl({
4522
4486
  /* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
4523
4487
  /* @__PURE__ */ e.jsx(U, { children: "Filters" }),
4524
4488
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 px-2", children: [
4525
- /* @__PURE__ */ e.jsx(Te, {}),
4526
- /* @__PURE__ */ e.jsx(_e, {})
4489
+ /* @__PURE__ */ e.jsx(De, {}),
4490
+ /* @__PURE__ */ e.jsx(Re, {})
4527
4491
  ] })
4528
4492
  ] })
4529
4493
  ] }) });
4530
4494
  }
4531
- const ql = {
4495
+ const Vl = {
4532
4496
  datasets: [
4533
4497
  {
4534
4498
  type: "line",
@@ -4541,7 +4505,7 @@ const ql = {
4541
4505
  data: []
4542
4506
  }
4543
4507
  ]
4544
- }, Rl = {
4508
+ }, ql = {
4545
4509
  datasets: [
4546
4510
  {
4547
4511
  fill: "origin",
@@ -4551,27 +4515,27 @@ const ql = {
4551
4515
  }
4552
4516
  ]
4553
4517
  };
4554
- function _l() {
4518
+ function Rl() {
4555
4519
  const s = m((t) => t.card.type);
4556
4520
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 p-6", children: [
4557
4521
  /* @__PURE__ */ e.jsx(
4558
- De,
4522
+ Te,
4559
4523
  {
4560
4524
  className: " ",
4561
4525
  type: "single",
4562
4526
  collapsible: !0,
4563
- children: Hl(s)
4527
+ children: _l(s)
4564
4528
  }
4565
4529
  ),
4566
4530
  /* @__PURE__ */ e.jsx("section", { className: "", children: ["line", "bar"].includes(s) && /* @__PURE__ */ e.jsx(fs, {}) }),
4567
4531
  !["kpi"].includes(s) && /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
4568
4532
  /* @__PURE__ */ e.jsx(Gs, {}),
4569
- /* @__PURE__ */ e.jsx(Te, {}),
4570
- /* @__PURE__ */ e.jsx(_e, {})
4533
+ /* @__PURE__ */ e.jsx(De, {}),
4534
+ /* @__PURE__ */ e.jsx(Re, {})
4571
4535
  ] })
4572
4536
  ] });
4573
4537
  }
4574
- function Hl(s) {
4538
+ function _l(s) {
4575
4539
  if (["line", "bar"].includes(s))
4576
4540
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
4577
4541
  /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
@@ -4592,7 +4556,7 @@ function Hl(s) {
4592
4556
  /* @__PURE__ */ e.jsx("b", { children: "Customize" }),
4593
4557
  " and change the `type` property in the dataset."
4594
4558
  ] }),
4595
- /* @__PURE__ */ e.jsx("pre", { children: JSON.stringify(ql, null, 2) })
4559
+ /* @__PURE__ */ e.jsx("pre", { children: JSON.stringify(Vl, null, 2) })
4596
4560
  ] })
4597
4561
  ] }),
4598
4562
  /* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
@@ -4613,7 +4577,7 @@ function Hl(s) {
4613
4577
  ),
4614
4578
  "for more options."
4615
4579
  ] }),
4616
- /* @__PURE__ */ e.jsx("pre", { children: JSON.stringify(Rl, null, 2) })
4580
+ /* @__PURE__ */ e.jsx("pre", { children: JSON.stringify(ql, null, 2) })
4617
4581
  ] })
4618
4582
  ] })
4619
4583
  ] });
@@ -4668,7 +4632,7 @@ function Hl(s) {
4668
4632
  ] })
4669
4633
  ] }) });
4670
4634
  }
4671
- function $l() {
4635
+ function Hl() {
4672
4636
  var d, p, u, y, g;
4673
4637
  const s = m((x) => x.card.preferences), t = m(
4674
4638
  (x) => x.actions.setCardPreferences
@@ -4700,7 +4664,7 @@ function $l() {
4700
4664
  var j, b;
4701
4665
  return (b = (j = x.card.preferences) == null ? void 0 : j.formatNumber) == null ? void 0 : b.colorRanges;
4702
4666
  }
4703
- ) || [], r = m(
4667
+ ) || [], i = m(
4704
4668
  (x) => x.actions.setColorRanges
4705
4669
  ), c = [...new Set(os.map((x) => x.currency))];
4706
4670
  return /* @__PURE__ */ e.jsxs("div", { children: [
@@ -4828,15 +4792,15 @@ function $l() {
4828
4792
  hn,
4829
4793
  {
4830
4794
  colorRanges: o,
4831
- setColorRanges: r
4795
+ setColorRanges: i
4832
4796
  }
4833
4797
  )
4834
4798
  ] })
4835
4799
  ] });
4836
4800
  }
4837
- function Pl() {
4801
+ function $l() {
4838
4802
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
4839
- /* @__PURE__ */ e.jsx(De, { type: "single", collapsible: !0, children: /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
4803
+ /* @__PURE__ */ e.jsx(Te, { type: "single", collapsible: !0, children: /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
4840
4804
  /* @__PURE__ */ e.jsx(U, { className: "", children: "KPI Query" }),
4841
4805
  /* @__PURE__ */ e.jsxs(G, { className: "font-mono", children: [
4842
4806
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs", children: "SELECT current, previous FROM table" }),
@@ -4860,12 +4824,12 @@ function Pl() {
4860
4824
  ] })
4861
4825
  ] })
4862
4826
  ] }) }),
4863
- /* @__PURE__ */ e.jsx("section", { className: "", children: /* @__PURE__ */ e.jsx($l, {}) }),
4827
+ /* @__PURE__ */ e.jsx("section", { className: "", children: /* @__PURE__ */ e.jsx(Hl, {}) }),
4864
4828
  /* @__PURE__ */ e.jsx("div", {}),
4865
4829
  /* @__PURE__ */ e.jsx("div", {})
4866
4830
  ] });
4867
4831
  }
4868
- const Bl = [
4832
+ const Pl = [
4869
4833
  {
4870
4834
  label: "Mercator",
4871
4835
  value: "mercator"
@@ -4922,7 +4886,7 @@ const Bl = [
4922
4886
  label: "Natural Earth 1",
4923
4887
  value: "naturalEarth1"
4924
4888
  }
4925
- ], Ul = [
4889
+ ], Bl = [
4926
4890
  "blues",
4927
4891
  "brBG",
4928
4892
  "buGn",
@@ -4961,15 +4925,15 @@ const Bl = [
4961
4925
  "ylGnBu",
4962
4926
  "ylOrBr",
4963
4927
  "ylOrRd"
4964
- ], Gl = Ul.map((s) => ({
4928
+ ], Ul = Bl.map((s) => ({
4965
4929
  label: s,
4966
4930
  value: s
4967
4931
  }));
4968
- function Ql() {
4969
- var d, p, u, y, g, x, j, b, I, C, T, F, A, N, S, L, h, v;
4932
+ function Gl() {
4933
+ var d, p, u, y, g, x, j, b, I, C, D, F, A, N, S, M, h, v;
4970
4934
  const s = m((f) => f.card), t = (p = (d = s == null ? void 0 : s.preferences) == null ? void 0 : d.mapVisualOptions) == null ? void 0 : p.topoJsonUrl, [a, n] = q(
4971
4935
  ((y = (u = s == null ? void 0 : s.preferences) == null ? void 0 : u.mapVisualOptions) == null ? void 0 : y.customTopoJsonUrl) || ""
4972
- ), { setCardPreferences: l } = re(), { data: o } = _s(s), r = Object.keys((o == null ? void 0 : o.objects) || {}).map((f) => ({
4936
+ ), { setCardPreferences: l } = re(), { data: o } = _s(s), i = Object.keys((o == null ? void 0 : o.objects) || {}).map((f) => ({
4973
4937
  label: f,
4974
4938
  value: f
4975
4939
  })) || [], c = [
@@ -4987,9 +4951,9 @@ function Ql() {
4987
4951
  }
4988
4952
  ];
4989
4953
  return /* @__PURE__ */ e.jsxs("div", { className: "p-6", children: [
4990
- /* @__PURE__ */ e.jsx(Ge, { summary: "Map Query", children: /* @__PURE__ */ e.jsx("p", { className: "rounded-md bg-muted p-2 font-mono text-xs", children: "SELECT country, value FROM table" }) }),
4954
+ /* @__PURE__ */ e.jsx(Ue, { summary: "Map Query", children: /* @__PURE__ */ e.jsx("p", { className: "rounded-md bg-muted p-2 font-mono text-xs", children: "SELECT country, value FROM table" }) }),
4991
4955
  /* @__PURE__ */ e.jsx(ge, { className: "my-4" }),
4992
- /* @__PURE__ */ e.jsx(Ge, { open: !0, summary: "Settings", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-3 px-2", children: [
4956
+ /* @__PURE__ */ e.jsx(Ue, { open: !0, summary: "Settings", children: /* @__PURE__ */ e.jsxs("div", { className: "space-y-3 px-2", children: [
4993
4957
  /* @__PURE__ */ e.jsx(
4994
4958
  ue,
4995
4959
  {
@@ -5025,7 +4989,7 @@ function Ql() {
5025
4989
  });
5026
4990
  },
5027
4991
  value: a,
5028
- className: `h-9 w-full ${Be}`,
4992
+ className: `h-9 w-full ${Pe}`,
5029
4993
  placeholder: "Custom URL"
5030
4994
  }
5031
4995
  ),
@@ -5036,7 +5000,7 @@ function Ql() {
5036
5000
  ue,
5037
5001
  {
5038
5002
  className: "h-9",
5039
- options: r,
5003
+ options: i,
5040
5004
  value: ((x = (g = s.preferences) == null ? void 0 : g.mapVisualOptions) == null ? void 0 : x.objectKey) || "",
5041
5005
  label: "Map Object",
5042
5006
  onValueChange: (f) => {
@@ -5058,7 +5022,7 @@ function Ql() {
5058
5022
  ue,
5059
5023
  {
5060
5024
  className: "h-9",
5061
- options: Bl,
5025
+ options: Pl,
5062
5026
  value: ((b = (j = s.preferences) == null ? void 0 : j.mapVisualOptions) == null ? void 0 : b.projection) || "",
5063
5027
  label: "Projection",
5064
5028
  onValueChange: (f) => {
@@ -5080,7 +5044,7 @@ function Ql() {
5080
5044
  ue,
5081
5045
  {
5082
5046
  className: "h-9",
5083
- options: Gl,
5047
+ options: Ul,
5084
5048
  value: ((C = (I = s.preferences) == null ? void 0 : I.mapVisualOptions) == null ? void 0 : C.colorScale) || "",
5085
5049
  label: "Select Color Scale",
5086
5050
  onValueChange: (f) => {
@@ -5099,14 +5063,14 @@ function Ql() {
5099
5063
  ] })
5100
5064
  ] }) }),
5101
5065
  /* @__PURE__ */ e.jsx(ge, { className: "my-4" }),
5102
- /* @__PURE__ */ e.jsx(Ge, { className: "", summary: "Scale Options", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
5066
+ /* @__PURE__ */ e.jsx(Ue, { className: "", summary: "Scale Options", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-3", children: [
5103
5067
  /* @__PURE__ */ e.jsx(
5104
5068
  le,
5105
5069
  {
5106
- className: `h-9 w-full ${Be}`,
5070
+ className: `h-9 w-full ${Pe}`,
5107
5071
  type: "number",
5108
5072
  step: 0.1,
5109
- value: ((F = (T = s.preferences) == null ? void 0 : T.mapVisualOptions) == null ? void 0 : F.projectionScale) || 1,
5073
+ value: ((F = (D = s.preferences) == null ? void 0 : D.mapVisualOptions) == null ? void 0 : F.projectionScale) || 1,
5110
5074
  onChange: (f) => {
5111
5075
  var k;
5112
5076
  l({
@@ -5123,19 +5087,19 @@ function Ql() {
5123
5087
  /* @__PURE__ */ e.jsx(
5124
5088
  le,
5125
5089
  {
5126
- className: `h-9 w-full ${Be}`,
5090
+ className: `h-9 w-full ${Pe}`,
5127
5091
  type: "number",
5128
5092
  step: 10,
5129
5093
  value: ((S = (N = (A = s.preferences) == null ? void 0 : A.mapVisualOptions) == null ? void 0 : N.projectionOffset) == null ? void 0 : S[0]) || 0,
5130
5094
  onChange: (f) => {
5131
- var k, M, H, P;
5095
+ var k, L, H, P;
5132
5096
  l({
5133
5097
  ...s.preferences,
5134
5098
  mapVisualOptions: {
5135
5099
  ...(k = s.preferences) == null ? void 0 : k.mapVisualOptions,
5136
5100
  projectionOffset: [
5137
5101
  Number(f.target.value),
5138
- ((P = (H = (M = s.preferences) == null ? void 0 : M.mapVisualOptions) == null ? void 0 : H.projectionOffset) == null ? void 0 : P[1]) || 0
5102
+ ((P = (H = (L = s.preferences) == null ? void 0 : L.mapVisualOptions) == null ? void 0 : H.projectionOffset) == null ? void 0 : P[1]) || 0
5139
5103
  ]
5140
5104
  }
5141
5105
  });
@@ -5146,18 +5110,18 @@ function Ql() {
5146
5110
  /* @__PURE__ */ e.jsx(
5147
5111
  le,
5148
5112
  {
5149
- className: `h-9 w-full ${Be}`,
5113
+ className: `h-9 w-full ${Pe}`,
5150
5114
  type: "number",
5151
5115
  step: 10,
5152
- value: ((v = (h = (L = s.preferences) == null ? void 0 : L.mapVisualOptions) == null ? void 0 : h.projectionOffset) == null ? void 0 : v[1]) || 0,
5116
+ value: ((v = (h = (M = s.preferences) == null ? void 0 : M.mapVisualOptions) == null ? void 0 : h.projectionOffset) == null ? void 0 : v[1]) || 0,
5153
5117
  onChange: (f) => {
5154
- var k, M, H, P;
5118
+ var k, L, H, P;
5155
5119
  l({
5156
5120
  ...s.preferences,
5157
5121
  mapVisualOptions: {
5158
5122
  ...(k = s.preferences) == null ? void 0 : k.mapVisualOptions,
5159
5123
  projectionOffset: [
5160
- ((P = (H = (M = s.preferences) == null ? void 0 : M.mapVisualOptions) == null ? void 0 : H.projectionOffset) == null ? void 0 : P[0]) || 0,
5124
+ ((P = (H = (L = s.preferences) == null ? void 0 : L.mapVisualOptions) == null ? void 0 : H.projectionOffset) == null ? void 0 : P[0]) || 0,
5161
5125
  Number(f.target.value)
5162
5126
  ]
5163
5127
  }
@@ -5167,10 +5131,10 @@ function Ql() {
5167
5131
  )
5168
5132
  ] }) }),
5169
5133
  /* @__PURE__ */ e.jsx(ge, { className: "my-4" }),
5170
- /* @__PURE__ */ e.jsx(Te, {})
5134
+ /* @__PURE__ */ e.jsx(De, {})
5171
5135
  ] });
5172
5136
  }
5173
- function Jl() {
5137
+ function Ql() {
5174
5138
  var n;
5175
5139
  const s = m((l) => l.card.preferences), { setCardPreferences: t } = m((l) => l.actions);
5176
5140
  function a(l) {
@@ -5191,11 +5155,11 @@ function Jl() {
5191
5155
  defaultValue: "x",
5192
5156
  children: [
5193
5157
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
5194
- /* @__PURE__ */ e.jsx(Ie, { value: "static", id: "r1" }),
5158
+ /* @__PURE__ */ e.jsx(Fe, { value: "static", id: "r1" }),
5195
5159
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Static" })
5196
5160
  ] }),
5197
5161
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
5198
- /* @__PURE__ */ e.jsx(Ie, { value: "dynamic", id: "r2" }),
5162
+ /* @__PURE__ */ e.jsx(Fe, { value: "dynamic", id: "r2" }),
5199
5163
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Dynamic" })
5200
5164
  ] })
5201
5165
  ]
@@ -5208,7 +5172,7 @@ function ns({
5208
5172
  suffix: a = "Chart"
5209
5173
  }) {
5210
5174
  let n = "pie-chart";
5211
- return s === "radar" && (n = "radar-chart"), /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(De, { defaultValue: ["item-2"], type: "multiple", children: [
5175
+ return s === "radar" && (n = "radar-chart"), /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
5212
5176
  /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
5213
5177
  /* @__PURE__ */ e.jsx(U, { children: `${$s(s)} ${a}` }),
5214
5178
  /* @__PURE__ */ e.jsx(G, { children: t || /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
@@ -5238,19 +5202,19 @@ function ns({
5238
5202
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 px-2", children: [
5239
5203
  s === "range" && /* @__PURE__ */ e.jsx(fs, {}),
5240
5204
  s !== "text" && /* @__PURE__ */ e.jsx(Gs, {}),
5241
- s === "text" && /* @__PURE__ */ e.jsx(Jl, {})
5205
+ s === "text" && /* @__PURE__ */ e.jsx(Ql, {})
5242
5206
  ] })
5243
5207
  ] }),
5244
5208
  !["range", "text"].includes(s) && /* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
5245
5209
  /* @__PURE__ */ e.jsx(U, { children: "Filters" }),
5246
5210
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 px-2", children: [
5247
- /* @__PURE__ */ e.jsx(Te, {}),
5248
- /* @__PURE__ */ e.jsx(_e, {})
5211
+ /* @__PURE__ */ e.jsx(De, {}),
5212
+ /* @__PURE__ */ e.jsx(Re, {})
5249
5213
  ] })
5250
5214
  ] })
5251
5215
  ] }) });
5252
5216
  }
5253
- function Kl() {
5217
+ function Jl() {
5254
5218
  const s = m(
5255
5219
  (n) => {
5256
5220
  var l, o;
@@ -5287,7 +5251,7 @@ function Kl() {
5287
5251
  )
5288
5252
  ] });
5289
5253
  }
5290
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(De, { defaultValue: ["item-2"], type: "multiple", children: [
5254
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
5291
5255
  /* @__PURE__ */ e.jsxs(B, { value: "item-1", children: [
5292
5256
  /* @__PURE__ */ e.jsx(U, { children: "Stacked Chart" }),
5293
5257
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 font-mono text-xs", children: [
@@ -5324,13 +5288,13 @@ function Kl() {
5324
5288
  /* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
5325
5289
  /* @__PURE__ */ e.jsx(U, { children: "Filters" }),
5326
5290
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 px-2", children: [
5327
- /* @__PURE__ */ e.jsx(Te, {}),
5328
- /* @__PURE__ */ e.jsx(_e, {})
5291
+ /* @__PURE__ */ e.jsx(De, {}),
5292
+ /* @__PURE__ */ e.jsx(Re, {})
5329
5293
  ] })
5330
5294
  ] })
5331
5295
  ] }) });
5332
5296
  }
5333
- function Wl({}) {
5297
+ function Kl({}) {
5334
5298
  const s = m((n) => {
5335
5299
  var l;
5336
5300
  return (l = n.card) == null ? void 0 : l.preferences;
@@ -5343,11 +5307,11 @@ function Wl({}) {
5343
5307
  });
5344
5308
  };
5345
5309
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
5346
- /* @__PURE__ */ e.jsx(De, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
5310
+ /* @__PURE__ */ e.jsx(Te, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ e.jsxs(B, { value: "item-3", children: [
5347
5311
  /* @__PURE__ */ e.jsx(U, { children: "Filters" }),
5348
5312
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 px-2", children: [
5349
- /* @__PURE__ */ e.jsx(Te, {}),
5350
- /* @__PURE__ */ e.jsx(_e, {})
5313
+ /* @__PURE__ */ e.jsx(De, {}),
5314
+ /* @__PURE__ */ e.jsx(Re, {})
5351
5315
  ] })
5352
5316
  ] }) }),
5353
5317
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
@@ -5363,7 +5327,7 @@ function Wl({}) {
5363
5327
  ] })
5364
5328
  ] });
5365
5329
  }
5366
- const Yl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
5330
+ const Wl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
5367
5331
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT dimension, cohort, metric FROM table" }),
5368
5332
  /* @__PURE__ */ e.jsxs("div", { children: [
5369
5333
  "See ",
@@ -5379,7 +5343,7 @@ const Yl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-
5379
5343
  ),
5380
5344
  " in the docs."
5381
5345
  ] })
5382
- ] }), Xl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
5346
+ ] }), Yl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
5383
5347
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT y-axis, label, range-from, range-to, range-value FROM table" }),
5384
5348
  /* @__PURE__ */ e.jsxs("div", { children: [
5385
5349
  "See ",
@@ -5395,7 +5359,7 @@ const Yl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-
5395
5359
  ),
5396
5360
  " in the docs."
5397
5361
  ] })
5398
- ] }), Zl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
5362
+ ] }), Xl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
5399
5363
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 text-xs", children: "SELECT text FROM table limit 1" }),
5400
5364
  /* @__PURE__ */ e.jsxs("div", { children: [
5401
5365
  "See ",
@@ -5412,22 +5376,22 @@ const Yl = /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-
5412
5376
  " in the docs."
5413
5377
  ] })
5414
5378
  ] });
5415
- function er() {
5379
+ function Zl() {
5416
5380
  const s = m((a) => a.card.type);
5417
5381
  function t(a) {
5418
5382
  switch (a) {
5419
5383
  case "stackedBar":
5420
5384
  case "stackedLine":
5421
- return /* @__PURE__ */ e.jsx(Kl, {});
5385
+ return /* @__PURE__ */ e.jsx(Jl, {});
5422
5386
  case "pyramid":
5423
- return /* @__PURE__ */ e.jsx(ns, { docContent: Yl, cardType: a });
5387
+ return /* @__PURE__ */ e.jsx(ns, { docContent: Wl, cardType: a });
5424
5388
  case "kpi":
5425
- return /* @__PURE__ */ e.jsx(Pl, {});
5389
+ return /* @__PURE__ */ e.jsx($l, {});
5426
5390
  case "line":
5427
5391
  case "bar":
5428
- return /* @__PURE__ */ e.jsx(Al, { cardType: a });
5392
+ return /* @__PURE__ */ e.jsx(El, { cardType: a });
5429
5393
  case "range":
5430
- return /* @__PURE__ */ e.jsx(ns, { docContent: Xl, cardType: a });
5394
+ return /* @__PURE__ */ e.jsx(ns, { docContent: Yl, cardType: a });
5431
5395
  case "pie":
5432
5396
  case "doughnut":
5433
5397
  case "polarArea":
@@ -5435,29 +5399,29 @@ function er() {
5435
5399
  return /* @__PURE__ */ e.jsx(ns, { cardType: a });
5436
5400
  case "bubble":
5437
5401
  case "scatter":
5438
- return /* @__PURE__ */ e.jsx(Vl, { cardType: a });
5402
+ return /* @__PURE__ */ e.jsx(Al, { cardType: a });
5439
5403
  case "table":
5440
- return /* @__PURE__ */ e.jsx(Wl, { cardType: a });
5404
+ return /* @__PURE__ */ e.jsx(Kl, { cardType: a });
5441
5405
  case "text":
5442
5406
  return /* @__PURE__ */ e.jsx(
5443
5407
  ns,
5444
5408
  {
5445
- docContent: Zl,
5409
+ docContent: Xl,
5446
5410
  cardType: a,
5447
5411
  suffix: "Visual"
5448
5412
  }
5449
5413
  );
5450
5414
  case "map":
5451
- return /* @__PURE__ */ e.jsx(Ql, {});
5415
+ return /* @__PURE__ */ e.jsx(Gl, {});
5452
5416
  case "custom":
5453
5417
  return /* @__PURE__ */ e.jsx(Tl, {});
5454
5418
  default:
5455
- return /* @__PURE__ */ e.jsx(_l, {});
5419
+ return /* @__PURE__ */ e.jsx(Rl, {});
5456
5420
  }
5457
5421
  }
5458
5422
  return /* @__PURE__ */ e.jsx(We, { className: "h-full w-full text-sm", children: t(s) });
5459
5423
  }
5460
- function sr() {
5424
+ function er() {
5461
5425
  const s = m((t) => t.isShowingVisual);
5462
5426
  return /* @__PURE__ */ e.jsxs(
5463
5427
  Cs,
@@ -5472,7 +5436,7 @@ function sr() {
5472
5436
  className: "flex",
5473
5437
  minSize: 20,
5474
5438
  defaultSize: 40,
5475
- children: /* @__PURE__ */ e.jsx(yl, {})
5439
+ children: /* @__PURE__ */ e.jsx(bl, {})
5476
5440
  }
5477
5441
  ),
5478
5442
  /* @__PURE__ */ e.jsx(Ns, { withHandle: !0, className: "border" }),
@@ -5491,7 +5455,7 @@ function sr() {
5491
5455
  minSize: 20,
5492
5456
  defaultSize: 25,
5493
5457
  maxSize: 30,
5494
- children: /* @__PURE__ */ e.jsx(er, {})
5458
+ children: /* @__PURE__ */ e.jsx(Zl, {})
5495
5459
  }
5496
5460
  ) }),
5497
5461
  /* @__PURE__ */ e.jsx(Ns, { className: "border" }),
@@ -5503,9 +5467,9 @@ function sr() {
5503
5467
  }
5504
5468
  );
5505
5469
  }
5506
- function ar({ authToken: s, onSave: t, onClose: a }) {
5507
- O((r) => r.themeStyle);
5508
- const n = m((r) => r.actions.setOnSave), l = m((r) => r.actions.setOnClose), o = O((r) => r.actions.setAuthToken);
5470
+ function sr({ authToken: s, onSave: t, onClose: a }) {
5471
+ O((i) => i.themeStyle);
5472
+ const n = m((i) => i.actions.setOnSave), l = m((i) => i.actions.setOnClose), o = O((i) => i.actions.setAuthToken);
5509
5473
  return Z(() => {
5510
5474
  t && n(t), a && l(a);
5511
5475
  }, [t, n, a, l]), Z(() => {
@@ -5521,16 +5485,16 @@ function ar({ authToken: s, onSave: t, onClose: a }) {
5521
5485
  role: "editor-panel",
5522
5486
  children: [
5523
5487
  /* @__PURE__ */ e.jsx(pn, { className: "rounded-none border-r-[1.5px]", children: /* @__PURE__ */ e.jsx(Aa, {}) }),
5524
- /* @__PURE__ */ e.jsx(fn, { children: /* @__PURE__ */ e.jsx(sr, {}) })
5488
+ /* @__PURE__ */ e.jsx(fn, { children: /* @__PURE__ */ e.jsx(er, {}) })
5525
5489
  ]
5526
5490
  }
5527
5491
  ) });
5528
5492
  }
5529
- function tr() {
5530
- O((r) => r.selectedCardId);
5531
- const s = O((r) => r.selectedSheetId), { setIsVisualEditing: t } = O((r) => r.actions), a = O((r) => r.isVisualEditing), n = O((r) => r.actions.updateFrame);
5532
- function l(r) {
5533
- s && (n(s, r), t(!1));
5493
+ function ar() {
5494
+ O((i) => i.selectedCardId);
5495
+ const s = O((i) => i.selectedSheetId), { setIsVisualEditing: t } = O((i) => i.actions), a = O((i) => i.isVisualEditing), n = O((i) => i.actions.updateFrame);
5496
+ function l(i) {
5497
+ s && (n(s, i), t(!1));
5534
5498
  }
5535
5499
  function o() {
5536
5500
  t(!1);
@@ -5542,27 +5506,27 @@ function tr() {
5542
5506
  className: W("flex grow", {
5543
5507
  "max-h-0 overflow-hidden": !a
5544
5508
  }),
5545
- children: /* @__PURE__ */ e.jsx(ar, { onSave: l, onClose: o })
5509
+ children: /* @__PURE__ */ e.jsx(sr, { onSave: l, onClose: o })
5546
5510
  }
5547
5511
  );
5548
5512
  }
5549
- function nr() {
5550
- m((r) => r.selectedConnectionId), m((r) => r.selectedDatamodelId);
5551
- const s = m((r) => r.selectedDatabaseName);
5552
- m((r) => r.selectedSchemaName);
5553
- const t = m((r) => r.selectedTableName), a = O((r) => r.dashboard.filters) || [];
5554
- O((r) => r.actions.addFilter), O((r) => r.actions.removeFilter), O(
5555
- (r) => r.actions.removeFilterValue
5513
+ function tr() {
5514
+ m((i) => i.selectedConnectionId), m((i) => i.selectedDatamodelId);
5515
+ const s = m((i) => i.selectedDatabaseName);
5516
+ m((i) => i.selectedSchemaName);
5517
+ const t = m((i) => i.selectedTableName), a = O((i) => i.dashboard.filters) || [];
5518
+ O((i) => i.actions.addFilter), O((i) => i.actions.removeFilter), O(
5519
+ (i) => i.actions.removeFilterValue
5556
5520
  );
5557
- const { modelItems: n, columns: l } = Re(), { assignFilter: o } = Xa();
5558
- return /* @__PURE__ */ e.jsx("div", { className: "xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3", children: l == null ? void 0 : l.map((r) => {
5521
+ const { modelItems: n, columns: l } = qe(), { assignFilter: o } = Xa();
5522
+ return /* @__PURE__ */ e.jsx("div", { className: "xbg-red-100 flex-1 basis-0 flex-col overflow-scroll px-3", children: l == null ? void 0 : l.map((i) => {
5559
5523
  const c = a == null ? void 0 : a.find(
5560
- (d) => d.column === de(r.column_name) && d.table === t && d.database === s
5524
+ (d) => d.column === de(i.column_name) && d.table === t && d.database === s
5561
5525
  );
5562
5526
  return /* @__PURE__ */ e.jsx(
5563
5527
  "div",
5564
5528
  {
5565
- onClick: () => o(r),
5529
+ onClick: () => o(i),
5566
5530
  className: W(
5567
5531
  "group flex cursor-pointer items-center justify-between border border-dashed border-background px-3 py-[6px] text-sm transition-colors hover:bg-muted/50",
5568
5532
  {
@@ -5570,15 +5534,15 @@ function nr() {
5570
5534
  }
5571
5535
  ),
5572
5536
  children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
5573
- /* @__PURE__ */ e.jsx(Ea, { column: r }),
5574
- /* @__PURE__ */ e.jsx("span", { children: r.column_name })
5537
+ /* @__PURE__ */ e.jsx(Ea, { column: i }),
5538
+ /* @__PURE__ */ e.jsx("span", { children: i.column_name })
5575
5539
  ] })
5576
5540
  },
5577
- r.column_name
5541
+ i.column_name
5578
5542
  );
5579
5543
  }) });
5580
5544
  }
5581
- function lr() {
5545
+ function nr() {
5582
5546
  O((t) => t.showFilters);
5583
5547
  const s = O(
5584
5548
  (t) => t.actions.setShowFilters
@@ -5592,7 +5556,7 @@ function lr() {
5592
5556
  onClick: () => s(!1),
5593
5557
  className: "h-7 w-7 p-0",
5594
5558
  variant: "ghost",
5595
- children: /* @__PURE__ */ e.jsx(Qe, {})
5559
+ children: /* @__PURE__ */ e.jsx(Ge, {})
5596
5560
  }
5597
5561
  )
5598
5562
  ] }),
@@ -5602,7 +5566,7 @@ function lr() {
5602
5566
  ColumnsComponent: () => (
5603
5567
  // schemaName, tableName, columns
5604
5568
  /* @__PURE__ */ e.jsx(
5605
- nr,
5569
+ tr,
5606
5570
  {}
5607
5571
  )
5608
5572
  )
@@ -5610,7 +5574,7 @@ function lr() {
5610
5574
  ) })
5611
5575
  ] });
5612
5576
  }
5613
- function rr() {
5577
+ function lr() {
5614
5578
  const s = O((a) => a.showFilters), t = O((a) => a.isVisualEditing);
5615
5579
  return /* @__PURE__ */ e.jsxs(
5616
5580
  "div",
@@ -5622,12 +5586,12 @@ function rr() {
5622
5586
  }),
5623
5587
  children: [
5624
5588
  /* @__PURE__ */ e.jsx(gn, {}),
5625
- s && /* @__PURE__ */ e.jsx("div", { role: "filter-aside-container", className: "flex", children: /* @__PURE__ */ e.jsx(lr, {}) })
5589
+ s && /* @__PURE__ */ e.jsx("div", { role: "filter-aside-container", className: "flex", children: /* @__PURE__ */ e.jsx(nr, {}) })
5626
5590
  ]
5627
5591
  }
5628
5592
  );
5629
5593
  }
5630
- function ir() {
5594
+ function rr() {
5631
5595
  const s = O((n) => n.dashboard), t = O((n) => n.actions.setDashboard), a = O(
5632
5596
  (n) => n.showDashboardJSON
5633
5597
  );
@@ -5671,7 +5635,7 @@ function ir() {
5671
5635
  }
5672
5636
  );
5673
5637
  }
5674
- function ur({
5638
+ function dr({
5675
5639
  showControls: s = !1,
5676
5640
  showFooter: t = !0,
5677
5641
  ...a
@@ -5679,30 +5643,29 @@ function ur({
5679
5643
  return /* @__PURE__ */ e.jsx(us, { FallbackComponent: ka, children: /* @__PURE__ */ e.jsxs(bn, { dashboardProps: a, children: [
5680
5644
  /* @__PURE__ */ e.jsx(yn, {}),
5681
5645
  /* @__PURE__ */ e.jsxs(vn, { children: [
5682
- /* @__PURE__ */ e.jsx(ir, {}),
5646
+ /* @__PURE__ */ e.jsx(rr, {}),
5683
5647
  /* @__PURE__ */ e.jsxs(Cn, { ...a, children: [
5684
- s && /* @__PURE__ */ e.jsx(nl, {}),
5685
- /* @__PURE__ */ e.jsx(tr, {}),
5686
- /* @__PURE__ */ e.jsx(rr, {})
5648
+ s && /* @__PURE__ */ e.jsx(tl, {}),
5649
+ /* @__PURE__ */ e.jsx(ar, {}),
5650
+ /* @__PURE__ */ e.jsx(lr, {})
5687
5651
  ] })
5688
5652
  ] })
5689
5653
  ] }) });
5690
5654
  }
5691
5655
  export {
5692
- Pe as A,
5656
+ La as A,
5693
5657
  Sn as B,
5694
5658
  wn as C,
5695
- ur as D,
5659
+ dr as D,
5696
5660
  Ia as E,
5697
- Ma as F,
5698
- Tn as G,
5699
- Ln as H,
5661
+ Yn as F,
5662
+ Dn as G,
5663
+ Mn as H,
5700
5664
  An as I,
5701
- Yn as J,
5702
5665
  Vn as L,
5703
- Da as M,
5666
+ Ta as M,
5704
5667
  Hn as N,
5705
- Ta as P,
5668
+ Da as P,
5706
5669
  Bn as S,
5707
5670
  Jn as T,
5708
5671
  Wn as U,
@@ -5715,21 +5678,21 @@ export {
5715
5678
  On as g,
5716
5679
  zn as h,
5717
5680
  Fn as i,
5718
- Dn as j,
5681
+ Tn as j,
5719
5682
  In as k,
5720
- Mn as l,
5683
+ Ln as l,
5721
5684
  En as m,
5722
5685
  qn as n,
5723
5686
  Rn as o,
5724
- Ve as p,
5725
- _n as q,
5726
- $n as r,
5727
- Pn as s,
5728
- La as t,
5729
- Un as u,
5730
- Gn as v,
5731
- Qn as w,
5732
- Kn as x,
5733
- Us as y,
5734
- Re as z
5687
+ _n as p,
5688
+ $n as q,
5689
+ Pn as r,
5690
+ Ma as s,
5691
+ Un as t,
5692
+ Gn as u,
5693
+ Qn as v,
5694
+ Kn as w,
5695
+ Us as x,
5696
+ qe as y,
5697
+ $e as z
5735
5698
  };