react-semaphor 0.0.270 → 0.0.271

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 { J as O, L as Ue, b as z, c as Ns, u as je, j as e, M as Cs, O as Ss, P as F, Q as ws, R as ks, U as zs, V as Fs, W as Ls, X as H, Y as Ce, Z as aa, _ as Ga, $ as Ka, a0 as Wa, a1 as Qa, a2 as Ja, a3 as Ya, a4 as Ps, f as X, a5 as He, a6 as Xa, a7 as ta, a8 as $e, a9 as ss, T as Ts, e as na, g as Is, aa as he, ab as me, ac as xe, ad as pe, ae as Se, af as fe, ag as Q, ah as Ds, G as c, ai as Ms, aj as Os, ak as As, w as la, v as ia, t as ue, al as Za, r as et, N as ra, s as st, am as at, B as tt, an as oa, ao as nt, S as Es, z as lt, n as Us, A as ca, ap as fs, aq as re, ar as Ne, as as Me, at as ls, au as da, av as it, aw as rt, ax as ua, ay as ot, az as ct, aA as dt, aB as ut, aC as ht, aD as gs, aE as mt, aF as xt, aG as _e, aH as js, aI as De, aJ as bs, aK as Gs, aL as pt, aM as ft, aN as gt, aO as jt, aP as bt, aQ as ps, aR as yt, aS as Ks, aT as vt, aU as Ws, aV as Nt, aW as Ct, aX as St, aY as ha, H as we, aZ as ma, l as wt, C as kt, E as Xe, d as zt, h as Ft, a_ as Lt, i as Tt, o as It, a$ as Dt, m as Mt, b0 as Ot, b1 as xa, b2 as pa, b3 as Ze, b4 as fa, b5 as es, b6 as Qs, b7 as At, b8 as Et, b9 as is, ba as rs, bb as os, bc as ga, K as Vt, bd as qt, be as Rt, bf as cs, bg as Le, bh as _t, bi as ja, bj as Ht, bk as $t, bl as as, bm as Bt, bn as Pt, bo as Ut, bp as Js, bq as Gt, br as Kt, bs as Wt, bt as Qt, bu as Jt, bv as Yt, bw as Xt, bx as Zt, by as Te, bz as P, bA as U, bB as Vs, bC as G, bD as en, bE as ba, bF as ya, bG as sn, bH as an, bI as tn, bJ as nn, bK as ln, bL as rn, bM as on, bN as cn, bO as dn } from "./index-aHW1mk38.js";
1
+ import { J as O, L as Ue, b as z, c as Cs, u as je, j as e, M as Ns, O as Ss, P as F, Q as ws, R as ks, U as zs, V as Fs, W as Ts, X as H, Y as Ne, Z as aa, _ as Ga, $ as Ka, a0 as Wa, a1 as Qa, a2 as Ja, a3 as Ya, a4 as Ps, f as X, a5 as He, a6 as Xa, a7 as ta, a8 as $e, a9 as ss, T as Ls, e as na, g as Is, aa as he, ab as me, ac as xe, ad as pe, ae as Se, af as fe, ag as Q, ah as Ds, G as c, ai as Ms, aj as Os, ak as As, w as la, v as ia, t as ue, al as Za, r as et, N as ra, s as st, am as at, B as tt, an as oa, ao as nt, S as Es, z as lt, n as Us, A as ca, ap as fs, aq as re, ar as Ce, as as Me, at as ls, au as da, av as it, aw as rt, ax as ua, ay as ot, az as ct, aA as dt, aB as ut, aC as ht, aD as gs, aE as mt, aF as xt, aG as _e, aH as js, aI as De, aJ as bs, aK as Gs, aL as pt, aM as ft, aN as gt, aO as jt, aP as bt, aQ as ps, aR as yt, aS as Ks, aT as vt, aU as Ws, aV as Ct, aW as Nt, aX as St, aY as ha, H as we, aZ as ma, l as wt, C as kt, E as Xe, d as zt, h as Ft, a_ as Tt, i as Lt, o as It, a$ as Dt, m as Mt, b0 as Ot, b1 as xa, b2 as pa, b3 as Ze, b4 as fa, b5 as es, b6 as Qs, b7 as At, b8 as Et, b9 as is, ba as rs, bb as os, bc as ga, K as Vt, bd as qt, be as Rt, bf as cs, bg as Te, bh as _t, bi as ja, bj as Ht, bk as $t, bl as as, bm as Bt, bn as Pt, bo as Ut, bp as Js, bq as Gt, br as Kt, bs as Wt, bt as Qt, bu as Jt, bv as Yt, bw as Xt, bx as Zt, by as Le, bz as P, bA as U, bB as Vs, bC as G, bD as en, bE as ba, bF as ya, bG as sn, bH as an, bI as tn, bJ as nn, bK as ln, bL as rn, bM as on, bN as cn, bO as dn } from "./index-8G7rNzmx.js";
2
2
  import * as Ys from "react";
3
3
  import ge, { useState as E, useMemo as ys, useEffect as Y, useRef as Be, Suspense as un } from "react";
4
4
  import "react-dom";
@@ -74,7 +74,7 @@ const va = O("ChartNoAxesGantt", [
74
74
  * This source code is licensed under the ISC license.
75
75
  * See the LICENSE file in the root directory of this source tree.
76
76
  */
77
- const Na = O("ChartPie", [
77
+ const Ca = O("ChartPie", [
78
78
  [
79
79
  "path",
80
80
  {
@@ -90,7 +90,7 @@ const Na = O("ChartPie", [
90
90
  * This source code is licensed under the ISC license.
91
91
  * See the LICENSE file in the root directory of this source tree.
92
92
  */
93
- const Ca = O("ChartScatter", [
93
+ const Na = O("ChartScatter", [
94
94
  ["circle", { cx: "7.5", cy: "7.5", r: ".5", fill: "currentColor", key: "kqv944" }],
95
95
  ["circle", { cx: "18.5", cy: "5.5", r: ".5", fill: "currentColor", key: "lysivs" }],
96
96
  ["circle", { cx: "11.5", cy: "11.5", r: ".5", fill: "currentColor", key: "byv1b8" }],
@@ -208,7 +208,7 @@ const vn = O("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 Nn = O("Hammer", [
211
+ const Cn = O("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 Nn = O("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 Cn = O("Hash", [
228
+ const Nn = O("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" }],
@@ -312,7 +312,7 @@ const Pe = O("LoaderCircle", [
312
312
  * This source code is licensed under the ISC license.
313
313
  * See the LICENSE file in the root directory of this source tree.
314
314
  */
315
- const Ln = O("MessageSquareMore", [
315
+ const Tn = O("MessageSquareMore", [
316
316
  ["path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z", key: "1lielz" }],
317
317
  ["path", { d: "M8 10h.01", key: "19clt8" }],
318
318
  ["path", { d: "M12 10h.01", key: "1nrarc" }],
@@ -324,7 +324,7 @@ const Ln = O("MessageSquareMore", [
324
324
  * This source code is licensed under the ISC license.
325
325
  * See the LICENSE file in the root directory of this source tree.
326
326
  */
327
- const Tn = O("Network", [
327
+ const Ln = O("Network", [
328
328
  ["rect", { x: "16", y: "16", width: "6", height: "6", rx: "1", key: "4q2zg0" }],
329
329
  ["rect", { x: "2", y: "16", width: "6", height: "6", rx: "1", key: "8cvhb9" }],
330
330
  ["rect", { x: "9", y: "2", width: "6", height: "6", rx: "1", key: "1egb70" }],
@@ -512,7 +512,7 @@ function ka(s) {
512
512
  var o;
513
513
  return {
514
514
  ...l,
515
- cards: (o = l.cards) == null ? void 0 : o.map((r) => _n(r))
515
+ cards: (o = l.cards) == null ? void 0 : o.map((i) => _n(i))
516
516
  };
517
517
  })
518
518
  };
@@ -567,13 +567,13 @@ async function $n(s, n, a, t) {
567
567
  async function vs(s, n) {
568
568
  if (!n)
569
569
  return null;
570
- const { id: a, template: t, filterValues: l, isDefault: o, shared: r } = s;
570
+ const { id: a, template: t, filterValues: l, isDefault: o, shared: i } = s;
571
571
  return await Ue("https://semaphor.cloud/api/v1/lens", n, {
572
572
  lensId: a,
573
573
  template: t,
574
574
  filterValues: l,
575
575
  isDefault: o,
576
- shared: r,
576
+ shared: i,
577
577
  operation: "update"
578
578
  });
579
579
  }
@@ -584,20 +584,20 @@ async function Bn(s, n) {
584
584
  }) : null;
585
585
  }
586
586
  function Pn() {
587
- const [s, n] = E(""), [a, t] = E(!1), l = z((u) => u.lenses), { setLenses: o, setSelectedLensId: r } = Ns(), [d, i] = E(!1), [x, h] = E(!1), y = z((u) => u.dashboard), p = z((u) => u.filterValues), { authToken: m } = je();
587
+ const [s, n] = E(""), [a, t] = E(!1), l = z((m) => m.lenses), { setLenses: o, setSelectedLensId: i } = Cs(), [d, r] = E(!1), [x, u] = E(!1), v = z((m) => m.dashboard), p = z((m) => m.filterValues), { authToken: h } = je();
588
588
  async function f() {
589
- i(!0);
590
- const u = ka(
591
- y
589
+ r(!0);
590
+ const m = ka(
591
+ v
592
592
  ), k = await $n(
593
593
  s,
594
- u,
594
+ m,
595
595
  p,
596
- m == null ? void 0 : m.accessToken
596
+ h == null ? void 0 : h.accessToken
597
597
  );
598
- k && (o([...l || [], k]), r(k.id), h(!1)), i(!1);
598
+ k && (o([...l || [], k]), i(k.id), u(!1)), r(!1);
599
599
  }
600
- return /* @__PURE__ */ e.jsxs(Cs, { open: x, onOpenChange: h, children: [
600
+ return /* @__PURE__ */ e.jsxs(Ns, { open: x, onOpenChange: u, children: [
601
601
  /* @__PURE__ */ e.jsx(Ss, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
602
602
  F,
603
603
  {
@@ -613,16 +613,16 @@ function Pn() {
613
613
  /* @__PURE__ */ e.jsxs(ks, { className: "sm:max-w-[425px]", children: [
614
614
  /* @__PURE__ */ e.jsxs(zs, { children: [
615
615
  /* @__PURE__ */ e.jsx(Fs, { children: "Create Lens" }),
616
- /* @__PURE__ */ e.jsx(Ls, { children: "Lenses are private by default and are only visible to you." })
616
+ /* @__PURE__ */ e.jsx(Ts, { children: "Lenses are private by default and are only visible to you." })
617
617
  ] }),
618
618
  /* @__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: [
619
619
  /* @__PURE__ */ e.jsx(H, { className: "text-right", children: "Name" }),
620
620
  /* @__PURE__ */ e.jsx(
621
- Ce,
621
+ Ne,
622
622
  {
623
623
  value: s,
624
- onChange: (u) => {
625
- n(u.target.value);
624
+ onChange: (m) => {
625
+ n(m.target.value);
626
626
  },
627
627
  id: "name",
628
628
  className: "col-span-7 focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
@@ -645,37 +645,37 @@ function Pn() {
645
645
  ] });
646
646
  }
647
647
  function Un() {
648
- const [s, n] = E(!1), a = z((h) => h.lenses), t = z((h) => h.selectedLensId), { setLenses: l, setSelectedLensId: o } = Ns(), { authToken: r } = je();
649
- async function d(h) {
650
- o(h);
648
+ const [s, n] = E(!1), a = z((u) => u.lenses), t = z((u) => u.selectedLensId), { setLenses: l, setSelectedLensId: o } = Cs(), { authToken: i } = je();
649
+ async function d(u) {
650
+ o(u);
651
651
  }
652
- async function i(h) {
653
- if (await Bn(h, r == null ? void 0 : r.accessToken)) {
654
- const p = a == null ? void 0 : a.filter((m) => m.id !== h);
652
+ async function r(u) {
653
+ if (await Bn(u, i == null ? void 0 : i.accessToken)) {
654
+ const p = a == null ? void 0 : a.filter((h) => h.id !== u);
655
655
  l(p || []), o("original");
656
656
  }
657
657
  }
658
- async function x(h) {
659
- const y = a == null ? void 0 : a.map((f) => f.id === h.id ? {
658
+ async function x(u) {
659
+ const v = a == null ? void 0 : a.map((f) => f.id === u.id ? {
660
660
  ...f,
661
- isDefault: !h.isDefault
661
+ isDefault: !u.isDefault
662
662
  } : {
663
663
  ...f,
664
664
  isDefault: !1
665
665
  });
666
- l(y || []);
666
+ l(v || []);
667
667
  const p = {
668
- ...h,
669
- isDefault: !h.isDefault
668
+ ...u,
669
+ isDefault: !u.isDefault
670
670
  };
671
- await vs(p, r == null ? void 0 : r.accessToken);
672
- const m = a == null ? void 0 : a.find((f) => f.isDefault);
673
- if (m && m.id !== h.id) {
671
+ await vs(p, i == null ? void 0 : i.accessToken);
672
+ const h = a == null ? void 0 : a.find((f) => f.isDefault);
673
+ if (h && h.id !== u.id) {
674
674
  const f = {
675
- ...m,
675
+ ...h,
676
676
  isDefault: !1
677
677
  };
678
- await vs(f, r == null ? void 0 : r.accessToken);
678
+ await vs(f, i == null ? void 0 : i.accessToken);
679
679
  }
680
680
  }
681
681
  return /* @__PURE__ */ e.jsxs(Ga, { open: s, onOpenChange: n, children: [
@@ -690,25 +690,25 @@ function Un() {
690
690
  onValueChange: d,
691
691
  children: [
692
692
  /* @__PURE__ */ e.jsx(Ps, { value: "original", children: "Original" }),
693
- a == null ? void 0 : a.map((h) => /* @__PURE__ */ e.jsxs(
693
+ a == null ? void 0 : a.map((u) => /* @__PURE__ */ e.jsxs(
694
694
  Ps,
695
695
  {
696
696
  className: "group flex justify-between gap-2",
697
- value: h.id,
697
+ value: u.id,
698
698
  children: [
699
- /* @__PURE__ */ e.jsx("p", { children: h.name }),
699
+ /* @__PURE__ */ e.jsx("p", { children: u.name }),
700
700
  /* @__PURE__ */ e.jsxs("span", { className: "flex items-center gap-3", children: [
701
701
  /* @__PURE__ */ e.jsx(
702
702
  Sn,
703
703
  {
704
- onClick: (y) => {
705
- y.preventDefault(), x(h);
704
+ onClick: (v) => {
705
+ v.preventDefault(), x(u);
706
706
  },
707
707
  className: X(
708
708
  "size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
709
709
  {
710
- invisible: !h.isDefault,
711
- "text-green-500": h.isDefault
710
+ invisible: !u.isDefault,
711
+ "text-green-500": u.isDefault
712
712
  }
713
713
  ),
714
714
  strokeWidth: 1.5
@@ -717,8 +717,8 @@ function Un() {
717
717
  /* @__PURE__ */ e.jsx(
718
718
  He,
719
719
  {
720
- onClick: (y) => {
721
- y.preventDefault(), i(h.id);
720
+ onClick: (v) => {
721
+ v.preventDefault(), r(u.id);
722
722
  },
723
723
  className: "invisible size-3.5 text-muted-foreground hover:cursor-pointer hover:text-foreground group-hover:visible",
724
724
  strokeWidth: 1.5
@@ -727,7 +727,7 @@ function Un() {
727
727
  ] })
728
728
  ]
729
729
  },
730
- h.id
730
+ u.id
731
731
  ))
732
732
  ]
733
733
  }
@@ -736,25 +736,25 @@ function Un() {
736
736
  ] });
737
737
  }
738
738
  function Gn() {
739
- const { authToken: s } = je(), n = z((b) => b.lenses), a = z((b) => b.selectedLensId), t = n == null ? void 0 : n.find((b) => b.id === a), l = z((b) => b.dashboard);
740
- z((b) => b.selectedSheetId);
739
+ const { authToken: s } = je(), n = z((y) => y.lenses), a = z((y) => y.selectedLensId), t = n == null ? void 0 : n.find((y) => y.id === a), l = z((y) => y.dashboard);
740
+ z((y) => y.selectedSheetId);
741
741
  const o = z(
742
- (b) => b.isDashboardEditing
743
- ), [r, d] = E(!1), i = z((b) => b.filterValues), x = z((b) => b.isVisualEditing), h = z((b) => b.showFilters);
742
+ (y) => y.isDashboardEditing
743
+ ), [i, d] = E(!1), r = z((y) => y.filterValues), x = z((y) => y.isVisualEditing), u = z((y) => y.showFilters);
744
744
  z(
745
- (b) => b.showDashboardJSON
745
+ (y) => y.showDashboardJSON
746
746
  );
747
- const y = z((b) => b.onSaveFunction), p = z(
748
- (b) => b.actions.setShowFilters
749
- ), { addFrame: m, setSelectedFrameId: f } = z(
750
- (b) => b.actions
751
- ), { getSelectedSheet: u, setIsDashboardEditing: k, setShowDashboardJSON: I } = z((b) => b.actions), D = u(), { tenantId: N, endUserId: M } = ys(
747
+ const v = z((y) => y.onSaveFunction), p = z(
748
+ (y) => y.actions.setShowFilters
749
+ ), { addFrame: h, setSelectedFrameId: f } = z(
750
+ (y) => y.actions
751
+ ), { getSelectedSheet: m, setIsDashboardEditing: k, setShowDashboardJSON: I } = z((y) => y.actions), M = m(), { tenantId: j, endUserId: D } = ys(
752
752
  () => Xa(s == null ? void 0 : s.accessToken),
753
753
  [s == null ? void 0 : s.accessToken]
754
- ), A = ys(() => N || M, [N, M]), j = () => {
755
- if (!o || !D)
754
+ ), A = ys(() => j || D, [j, D]), g = () => {
755
+ if (!o || !M)
756
756
  return;
757
- const b = {
757
+ const y = {
758
758
  id: $e(),
759
759
  title: "Title",
760
760
  description: "Description",
@@ -771,24 +771,24 @@ function Gn() {
771
771
  data: []
772
772
  }, q = {
773
773
  id: $e(),
774
- cards: [b],
775
- activeCardId: b.id
774
+ cards: [y],
775
+ activeCardId: y.id
776
776
  };
777
- m(D.id, q), f(q.id);
777
+ h(M.id, q), f(q.id);
778
778
  }, S = () => {
779
779
  k(!0);
780
780
  };
781
- async function v() {
781
+ async function C() {
782
782
  if (d(!0), !a || !t)
783
783
  return;
784
- const b = ka(
784
+ const y = ka(
785
785
  l
786
- ), q = JSON.stringify(b), $ = {
786
+ ), q = JSON.stringify(y), $ = {
787
787
  ...t,
788
788
  template: q,
789
- filterValues: i
789
+ filterValues: r
790
790
  };
791
- await vs($, s == null ? void 0 : s.accessToken), ss.success("Lens saved"), y == null || y(b), d(!1);
791
+ await vs($, s == null ? void 0 : s.accessToken), ss.success("Lens saved"), v == null || v(y), d(!1);
792
792
  }
793
793
  return x ? null : /* @__PURE__ */ e.jsxs(
794
794
  "div",
@@ -807,7 +807,7 @@ function Gn() {
807
807
  className: "h-7 p-2",
808
808
  size: "sm",
809
809
  disabled: !o,
810
- onClick: j,
810
+ onClick: g,
811
811
  children: [
812
812
  /* @__PURE__ */ e.jsx(ws, { className: "mr-2 h-4 w-4", strokeWidth: 1.5 }),
813
813
  "Frame"
@@ -842,13 +842,13 @@ function Gn() {
842
842
  {
843
843
  className: "h-7 p-2",
844
844
  variant: "ghost",
845
- disabled: r,
846
- onClick: v,
845
+ disabled: i,
846
+ onClick: C,
847
847
  size: "sm",
848
848
  children: /* @__PURE__ */ e.jsx(Mn, { className: "h-4 w-4", strokeWidth: 1.5 })
849
849
  }
850
850
  ),
851
- !h && !x && o && /* @__PURE__ */ e.jsx(
851
+ !u && !x && o && /* @__PURE__ */ e.jsx(
852
852
  F,
853
853
  {
854
854
  className: "h-7 p-2",
@@ -872,37 +872,37 @@ function qe({
872
872
  isLoading: t,
873
873
  isError: l,
874
874
  connectionTooltip: o,
875
- onChange: r,
875
+ onChange: i,
876
876
  showNone: d = !1,
877
- className: i,
877
+ className: r,
878
878
  showIcon: x = !0,
879
- disabled: h = !1
879
+ disabled: u = !1
880
880
  }) {
881
- const y = t ? "Loading..." : l ? "Error" : a;
881
+ const v = t ? "Loading..." : l ? "Error" : a;
882
882
  function p() {
883
883
  if (s === "Connection")
884
884
  return /* @__PURE__ */ e.jsx(Dn, { className: "size-4 rotate-90" });
885
885
  if (s === "Database")
886
886
  return /* @__PURE__ */ e.jsx(fn, { className: "size-4" });
887
887
  if (s === "Schema")
888
- return /* @__PURE__ */ e.jsx(Tn, { className: "size-4" });
888
+ return /* @__PURE__ */ e.jsx(Ln, { className: "size-4" });
889
889
  if (s === "Table")
890
890
  return /* @__PURE__ */ e.jsx(Ds, { className: "size-4" });
891
891
  if (s === "Model")
892
892
  return /* @__PURE__ */ e.jsx(hn, { className: "size-4" });
893
893
  }
894
894
  return /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
895
- x && /* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: o ? /* @__PURE__ */ e.jsxs(Ts, { children: [
895
+ x && /* @__PURE__ */ e.jsx("div", { className: "shrink-0", children: o ? /* @__PURE__ */ e.jsxs(Ls, { children: [
896
896
  /* @__PURE__ */ e.jsx(na, { children: p() }),
897
897
  /* @__PURE__ */ e.jsx(Is, { className: "text-xs", align: "start", children: o })
898
898
  ] }) : p() }),
899
- /* @__PURE__ */ e.jsxs(he, { disabled: h, value: y, onValueChange: r, children: [
899
+ /* @__PURE__ */ e.jsxs(he, { disabled: u, value: v, onValueChange: i, children: [
900
900
  /* @__PURE__ */ e.jsx(
901
901
  me,
902
902
  {
903
903
  className: X(
904
904
  "h-9 w-full focus:ring-1 focus:ring-offset-0",
905
- i
905
+ r
906
906
  ),
907
907
  children: /* @__PURE__ */ e.jsx(
908
908
  xe,
@@ -916,39 +916,39 @@ function qe({
916
916
  t ? /* @__PURE__ */ e.jsx(fe, { children: "Loading..." }) : /* @__PURE__ */ e.jsx(fe, { children: s }),
917
917
  /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
918
918
  d && /* @__PURE__ */ e.jsx(Q, { value: "none", children: "None" }, "none"),
919
- n && n.map((m, f) => /* @__PURE__ */ e.jsx(Q, { value: m.id, children: m.name }, f))
919
+ n && n.map((h, f) => /* @__PURE__ */ e.jsx(Q, { value: h.id, children: h.name }, f))
920
920
  ] }),
921
- (t || l) && /* @__PURE__ */ e.jsx(Q, { value: y, children: y })
921
+ (t || l) && /* @__PURE__ */ e.jsx(Q, { value: v, children: v })
922
922
  ] }) })
923
923
  ] })
924
924
  ] });
925
925
  }
926
926
  function Kn({ column: s }) {
927
- const [n, a] = E(!1), t = c((m) => m.selectedTableName), l = c(
928
- (m) => m.selectedSchemaName
927
+ const [n, a] = E(!1), t = c((h) => h.selectedTableName), l = c(
928
+ (h) => h.selectedSchemaName
929
929
  ), o = c(
930
- (m) => m.selectedDatamodelId
931
- ), r = c((m) => m.sqlGen), { modelItems: d } = Oe(), i = c((m) => m.actions.setSqlGen), x = c((m) => m.actions.setCardSql), h = c((m) => m.actions.setRunSql);
932
- function y(m, f) {
933
- var D;
934
- const u = la(m, r, f), k = (D = d == null ? void 0 : d.find(
935
- (N) => N.id === o
936
- )) == null ? void 0 : D.name;
937
- i(u);
930
+ (h) => h.selectedDatamodelId
931
+ ), i = c((h) => h.sqlGen), { modelItems: d } = Oe(), r = c((h) => h.actions.setSqlGen), x = c((h) => h.actions.setCardSql), u = c((h) => h.actions.setRunSql);
932
+ function v(h, f) {
933
+ var M;
934
+ const m = la(h, i, f), k = (M = d == null ? void 0 : d.find(
935
+ (j) => j.id === o
936
+ )) == null ? void 0 : M.name;
937
+ r(m);
938
938
  const I = ia(
939
- u,
939
+ m,
940
940
  ue(l || ""),
941
941
  ue(t),
942
942
  k
943
943
  );
944
- I && (x(I), h(!0)), a(!1);
944
+ I && (x(I), u(!0)), a(!1);
945
945
  }
946
946
  function p() {
947
947
  return /* @__PURE__ */ e.jsxs("ul", { className: "text-xs", children: [
948
948
  /* @__PURE__ */ e.jsx(
949
949
  "li",
950
950
  {
951
- onClick: () => y(s, "COUNT"),
951
+ onClick: () => v(s, "COUNT"),
952
952
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
953
953
  children: "Count"
954
954
  }
@@ -956,7 +956,7 @@ function Kn({ column: s }) {
956
956
  /* @__PURE__ */ e.jsx(
957
957
  "li",
958
958
  {
959
- onClick: () => y(s, "AVG"),
959
+ onClick: () => v(s, "AVG"),
960
960
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
961
961
  children: "Avg"
962
962
  }
@@ -964,7 +964,7 @@ function Kn({ column: s }) {
964
964
  /* @__PURE__ */ e.jsx(
965
965
  "li",
966
966
  {
967
- onClick: () => y(s, "SUM"),
967
+ onClick: () => v(s, "SUM"),
968
968
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
969
969
  children: "Sum"
970
970
  }
@@ -972,7 +972,7 @@ function Kn({ column: s }) {
972
972
  /* @__PURE__ */ e.jsx(
973
973
  "li",
974
974
  {
975
- onClick: () => y(s, "MAX"),
975
+ onClick: () => v(s, "MAX"),
976
976
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
977
977
  children: "Max"
978
978
  }
@@ -980,7 +980,7 @@ function Kn({ column: s }) {
980
980
  /* @__PURE__ */ e.jsx(
981
981
  "li",
982
982
  {
983
- onClick: () => y(s, "MIN"),
983
+ onClick: () => v(s, "MIN"),
984
984
  className: "cursor-pointer p-1 px-3 transition-colors hover:bg-muted",
985
985
  children: "Min"
986
986
  }
@@ -1000,13 +1000,13 @@ function Kn({ column: s }) {
1000
1000
  ] });
1001
1001
  }
1002
1002
  function za({ column: s }) {
1003
- return /* @__PURE__ */ e.jsxs(Ts, { children: [
1003
+ return /* @__PURE__ */ e.jsxs(Ls, { children: [
1004
1004
  /* @__PURE__ */ e.jsx(Za, { asChild: !0, children: et.includes(s.data_type.toLowerCase()) ? (
1005
1005
  // <span className=" font-thin">T</span>
1006
1006
  /* @__PURE__ */ e.jsx(_s, { className: "size-3" })
1007
1007
  ) : ra.includes(s.data_type.toLowerCase()) ? (
1008
1008
  //
1009
- /* @__PURE__ */ e.jsx(Cn, { className: "size-3" })
1009
+ /* @__PURE__ */ e.jsx(Nn, { className: "size-3" })
1010
1010
  ) : st.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(at, { className: "size-3" }) : tt.includes(s.data_type.toLowerCase()) ? /* @__PURE__ */ e.jsx(qn, { className: "size-3" }) : /* @__PURE__ */ e.jsx(On, { className: "size-3" }) }),
1011
1011
  /* @__PURE__ */ e.jsx(Is, { children: /* @__PURE__ */ e.jsx("p", { className: "font-mono text-xs", children: s.data_type }) })
1012
1012
  ] });
@@ -1017,56 +1017,56 @@ function Wn({
1017
1017
  columns: a,
1018
1018
  status: t
1019
1019
  }) {
1020
- const l = c((v) => v.sqlGen), o = c(
1021
- (v) => v.selectedConnectionId
1022
- ), r = c(
1023
- (v) => v.selectedDatabaseName
1020
+ const l = c((C) => C.sqlGen), o = c(
1021
+ (C) => C.selectedConnectionId
1022
+ ), i = c(
1023
+ (C) => C.selectedDatabaseName
1024
1024
  ), d = c(
1025
- (v) => v.selectedSchemaName
1026
- ), i = c((v) => v.selectedTableName), x = c(
1027
- (v) => v.selectedDatamodelId
1028
- ), h = z(
1029
- (v) => v.dashboard.aiScopeTables
1030
- ), { setAIScopeTables: y } = z((v) => v.actions), p = c((v) => v.actions.setRunSql), m = c((v) => v.actions.setSqlGen), f = c(
1031
- (v) => v.actions.setIsShowingVisual
1032
- ), u = c((v) => v.actions.setCardSql), { connectionType: k, modelItems: I } = Oe();
1033
- function D(v) {
1025
+ (C) => C.selectedSchemaName
1026
+ ), r = c((C) => C.selectedTableName), x = c(
1027
+ (C) => C.selectedDatamodelId
1028
+ ), u = z(
1029
+ (C) => C.dashboard.aiScopeTables
1030
+ ), { setAIScopeTables: v } = z((C) => C.actions), p = c((C) => C.actions.setRunSql), h = c((C) => C.actions.setSqlGen), f = c(
1031
+ (C) => C.actions.setIsShowingVisual
1032
+ ), m = c((C) => C.actions.setCardSql), { connectionType: k, modelItems: I } = Oe();
1033
+ function M(C) {
1034
1034
  var R;
1035
- const b = la(v, l);
1036
- m(b);
1035
+ const y = la(C, l);
1036
+ h(y);
1037
1037
  const q = (R = I == null ? void 0 : I.find(
1038
1038
  (B) => B.id === x
1039
- )) == null ? void 0 : R.name, $ = ia(b, ue(s), ue(n), q);
1040
- $ && (u($), p(!0));
1039
+ )) == null ? void 0 : R.name, $ = ia(y, ue(s), ue(n), q);
1040
+ $ && (m($), p(!0));
1041
1041
  }
1042
- function N() {
1043
- return (h == null ? void 0 : h.find(
1044
- (v) => v.connectinonId === o && v.tableName === i
1042
+ function j() {
1043
+ return (u == null ? void 0 : u.find(
1044
+ (C) => C.connectinonId === o && C.tableName === r
1045
1045
  )) !== void 0;
1046
1046
  }
1047
- function M(v) {
1048
- if (v === !0 && i && o) {
1049
- const b = {
1047
+ function D(C) {
1048
+ if (C === !0 && r && o) {
1049
+ const y = {
1050
1050
  connectinonId: o,
1051
1051
  connectionType: k,
1052
- databaseName: r,
1052
+ databaseName: i,
1053
1053
  schemaName: d,
1054
- tableName: i
1055
- }, $ = [...h || [], b].filter(
1054
+ tableName: r
1055
+ }, $ = [...u || [], y].filter(
1056
1056
  (R, B, ee) => ee.findIndex(
1057
1057
  (W) => W.connectinonId === R.connectinonId && W.tableName === R.tableName
1058
1058
  ) === B
1059
1059
  );
1060
- y($), ss.success(`Added '${i}' to AI Scope`, {
1060
+ v($), ss.success(`Added '${r}' to AI Scope`, {
1061
1061
  position: "top-right",
1062
1062
  duration: 2500,
1063
1063
  richColors: !0
1064
1064
  });
1065
1065
  } else {
1066
- const b = (h || []).filter(
1067
- (q) => q.connectinonId !== o && q.tableName !== i
1066
+ const y = (u || []).filter(
1067
+ (q) => q.connectinonId !== o && q.tableName !== r
1068
1068
  );
1069
- y(b), ss(`Removed '${i}' from AI Scope`, {
1069
+ v(y), ss(`Removed '${r}' from AI Scope`, {
1070
1070
  position: "top-right",
1071
1071
  duration: 2e3,
1072
1072
  richColors: !0
@@ -1075,40 +1075,40 @@ function Wn({
1075
1075
  }
1076
1076
  function A() {
1077
1077
  var R;
1078
- let v = ca(s, n);
1079
- const b = (R = I == null ? void 0 : I.find(
1078
+ let C = ca(s, n);
1079
+ const y = (R = I == null ? void 0 : I.find(
1080
1080
  (B) => B.id === x
1081
1081
  )) == null ? void 0 : R.name;
1082
- console.log("modelName", b), x && x !== "none" && (v = `${fs}.${b}`);
1083
- let q = v;
1082
+ console.log("modelName", y), x && x !== "none" && (C = `${fs}.${y}`);
1083
+ let q = C;
1084
1084
  return ((B) => /[A-Z]/.test(B))(n) && (q = q.split(".").map((ee) => `"${ee}"`).join(".")), q;
1085
1085
  }
1086
- function j() {
1087
- const v = A();
1086
+ function g() {
1087
+ const C = A();
1088
1088
  f(!1);
1089
- const b = k === "MSSQL" ? `SELECT top 10 * FROM ${v}` : `SELECT * FROM ${v} LIMIT 10`;
1090
- u(b), p(!0);
1089
+ const y = k === "MSSQL" ? `SELECT top 10 * FROM ${C}` : `SELECT * FROM ${C} LIMIT 10`;
1090
+ m(y), p(!0);
1091
1091
  }
1092
1092
  function S() {
1093
- const v = A();
1094
- u(`SELECT COUNT(*) as count FROM ${v}`), p(!0);
1093
+ const C = A();
1094
+ m(`SELECT COUNT(*) as count FROM ${C}`), p(!0);
1095
1095
  }
1096
1096
  return /* @__PURE__ */ e.jsxs("div", { className: "flex grow flex-col space-y-4 px-4", children: [
1097
1097
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-center gap-1", children: [
1098
1098
  /* @__PURE__ */ e.jsx(
1099
1099
  oa,
1100
1100
  {
1101
- title: `${N() ? "Remove from" : "Add to"} AI Scope`,
1102
- pressed: N(),
1103
- onPressedChange: M,
1101
+ title: `${j() ? "Remove from" : "Add to"} AI Scope`,
1102
+ pressed: j(),
1103
+ onPressedChange: D,
1104
1104
  variant: "outline",
1105
1105
  className: "h-9 px-2",
1106
1106
  children: /* @__PURE__ */ e.jsx(
1107
1107
  nt,
1108
1108
  {
1109
1109
  className: X("size-4", {
1110
- "text-primary": N(),
1111
- "text-muted-foreground": !N()
1110
+ "text-primary": j(),
1111
+ "text-muted-foreground": !j()
1112
1112
  })
1113
1113
  }
1114
1114
  )
@@ -1118,7 +1118,7 @@ function Wn({
1118
1118
  F,
1119
1119
  {
1120
1120
  disabled: t !== "Success",
1121
- onClick: j,
1121
+ onClick: g,
1122
1122
  size: "sm",
1123
1123
  variant: "secondary",
1124
1124
  className: "flex",
@@ -1148,32 +1148,32 @@ function Wn({
1148
1148
  {
1149
1149
  className: "flex-1 basis-0 overflow-y-auto border-b border-t border-muted py-3",
1150
1150
  children: [
1151
- a == null ? void 0 : a.map((v) => /* @__PURE__ */ e.jsxs(
1151
+ a == null ? void 0 : a.map((C) => /* @__PURE__ */ e.jsxs(
1152
1152
  "div",
1153
1153
  {
1154
- onClick: () => D(v),
1154
+ onClick: () => M(C),
1155
1155
  className: X(
1156
1156
  "group mx-3 flex cursor-pointer items-center justify-between rounded px-2 py-[6px] text-sm transition-colors hover:bg-muted/50",
1157
1157
  {
1158
- "bg-muted": lt(v, l)
1158
+ "bg-muted": lt(C, l)
1159
1159
  }
1160
1160
  ),
1161
1161
  children: [
1162
1162
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
1163
- /* @__PURE__ */ e.jsx(za, { column: v }),
1164
- /* @__PURE__ */ e.jsx("span", { children: v.column_name })
1163
+ /* @__PURE__ */ e.jsx(za, { column: C }),
1164
+ /* @__PURE__ */ e.jsx("span", { children: C.column_name })
1165
1165
  ] }),
1166
1166
  /* @__PURE__ */ e.jsx(
1167
1167
  "div",
1168
1168
  {
1169
- onClick: (b) => b.stopPropagation(),
1169
+ onClick: (y) => y.stopPropagation(),
1170
1170
  className: "flex items-center justify-end",
1171
- children: ra.includes(v.data_type) && /* @__PURE__ */ e.jsx(Kn, { column: v })
1171
+ children: ra.includes(C.data_type) && /* @__PURE__ */ e.jsx(Kn, { column: C })
1172
1172
  }
1173
1173
  )
1174
1174
  ]
1175
1175
  },
1176
- v.column_name
1176
+ C.column_name
1177
1177
  )),
1178
1178
  /* @__PURE__ */ e.jsx(Us, { orientation: "vertical" }),
1179
1179
  /* @__PURE__ */ e.jsx(Us, { orientation: "horizontal" })
@@ -1183,57 +1183,57 @@ function Wn({
1183
1183
  ] });
1184
1184
  }
1185
1185
  function Oe(s, n) {
1186
- var Ke, Ve, We, Qe, g;
1186
+ var Ke, Ve, We, Qe, b;
1187
1187
  let a = ys(() => [], []);
1188
1188
  const t = je().authToken || s, l = c(
1189
- (C) => C.selectedConnectionId
1189
+ (N) => N.selectedConnectionId
1190
1190
  ), o = c(
1191
- (C) => C.selectedDatamodelId
1192
- ), r = c(
1193
- (C) => C.selectedDatabaseName
1191
+ (N) => N.selectedDatamodelId
1192
+ ), i = c(
1193
+ (N) => N.selectedDatabaseName
1194
1194
  ), d = c(
1195
- (C) => C.selectedSchemaName
1196
- ), i = c((C) => C.selectedTableName), x = c(
1197
- (C) => C.actions.setCurrentColumns
1198
- ), h = c(
1199
- (C) => C.actions.setSelectedConnectionId
1200
- ), y = c(
1201
- (C) => C.actions.setSelectedDatamodelId
1195
+ (N) => N.selectedSchemaName
1196
+ ), r = c((N) => N.selectedTableName), x = c(
1197
+ (N) => N.actions.setCurrentColumns
1198
+ ), u = c(
1199
+ (N) => N.actions.setSelectedConnectionId
1200
+ ), v = c(
1201
+ (N) => N.actions.setSelectedDatamodelId
1202
1202
  ), p = c(
1203
- (C) => C.actions.setSelectedDatabaseName
1204
- ), m = c(
1205
- (C) => C.actions.setSelectedSchemaName
1203
+ (N) => N.actions.setSelectedDatabaseName
1204
+ ), h = c(
1205
+ (N) => N.actions.setSelectedSchemaName
1206
1206
  ), f = c(
1207
- (C) => C.actions.setSelectedTableName
1208
- ), u = c((C) => C.actions.setCardSql);
1209
- function k(C) {
1210
- return l && r && d && r !== "NA" ? !0 : l && C === "API" ? !1 : !!(l && C === "S3");
1207
+ (N) => N.actions.setSelectedTableName
1208
+ ), m = c((N) => N.actions.setCardSql);
1209
+ function k(N) {
1210
+ return l && i && d && i !== "NA" ? !0 : l && N === "API" ? !1 : !!(l && N === "S3");
1211
1211
  }
1212
- function I(C) {
1213
- return !!(l && r && r !== "NA" && d && i || l && (C === "S3" || C === "API") || o && o);
1212
+ function I(N) {
1213
+ return !!(l && i && i !== "NA" && d && r || l && (N === "S3" || N === "API") || o && o);
1214
1214
  }
1215
- function D(C) {
1216
- return l && C ? !(C === "API" || C === "S3") : !1;
1215
+ function M(N) {
1216
+ return l && N ? !(N === "API" || N === "S3") : !1;
1217
1217
  }
1218
1218
  const {
1219
- data: N,
1220
- isLoading: M,
1219
+ data: j,
1220
+ isLoading: D,
1221
1221
  isError: A
1222
1222
  } = re({
1223
1223
  queryKey: ["connections"],
1224
- queryFn: () => Ne(
1224
+ queryFn: () => Ce(
1225
1225
  "https://semaphor.cloud/api/v1/connections",
1226
1226
  (t == null ? void 0 : t.accessToken) || ""
1227
1227
  ),
1228
1228
  enabled: !!(t != null && t.accessToken)
1229
1229
  // Only fetch if authToken is present
1230
1230
  }), {
1231
- data: j,
1231
+ data: g,
1232
1232
  isLoading: S,
1233
- isError: v
1233
+ isError: C
1234
1234
  } = re({
1235
1235
  queryKey: ["models", l],
1236
- queryFn: () => Ne(
1236
+ queryFn: () => Ce(
1237
1237
  "https://semaphor.cloud/api/v1/datamodels",
1238
1238
  (t == null ? void 0 : t.accessToken) || "",
1239
1239
  {
@@ -1242,9 +1242,9 @@ function Oe(s, n) {
1242
1242
  ),
1243
1243
  enabled: !!(t != null && t.accessToken) && !!l
1244
1244
  // Only fetch if authToken is present
1245
- }), b = N == null ? void 0 : N.connections.find(
1246
- (C) => C.id === l
1247
- ), q = b == null ? void 0 : b.type, $ = (b == null ? void 0 : b.type) === "API" || (b == null ? void 0 : b.type) === "S3", {
1245
+ }), y = j == null ? void 0 : j.connections.find(
1246
+ (N) => N.id === l
1247
+ ), q = y == null ? void 0 : y.type, $ = (y == null ? void 0 : y.type) === "API" || (y == null ? void 0 : y.type) === "S3", {
1248
1248
  data: R,
1249
1249
  isLoading: B,
1250
1250
  isFetching: ee,
@@ -1252,14 +1252,14 @@ function Oe(s, n) {
1252
1252
  refetch: le
1253
1253
  } = re({
1254
1254
  queryKey: ["databases", l],
1255
- queryFn: () => Ne(
1255
+ queryFn: () => Ce(
1256
1256
  "https://semaphor.cloud/api/v1/databases",
1257
1257
  (t == null ? void 0 : t.accessToken) || "",
1258
1258
  {
1259
1259
  connection_id: l
1260
1260
  }
1261
1261
  ),
1262
- enabled: D(q)
1262
+ enabled: M(q)
1263
1263
  // !!selectedConnectionId && !isNonDbConnection, //currentConnection?.type !== 'API', // Only fetch if connectionId is present
1264
1264
  }), {
1265
1265
  data: K,
@@ -1268,20 +1268,20 @@ function Oe(s, n) {
1268
1268
  isError: V,
1269
1269
  refetch: Z
1270
1270
  } = re({
1271
- queryKey: ["schemas", l, r],
1272
- queryFn: () => Ne(
1271
+ queryKey: ["schemas", l, i],
1272
+ queryFn: () => Ce(
1273
1273
  "https://semaphor.cloud/api/v1/schemas",
1274
1274
  (t == null ? void 0 : t.accessToken) || "",
1275
1275
  {
1276
1276
  connection_id: l,
1277
- database_name: r
1277
+ database_name: i
1278
1278
  }
1279
1279
  ),
1280
- enabled: !!l && !!r && !$ && r !== "NA"
1280
+ enabled: !!l && !!i && !$ && i !== "NA"
1281
1281
  //currentConnection?.type !== 'API', // Only fetch if connectionId and database is present
1282
1282
  }), {
1283
- data: T,
1284
- isLoading: L,
1283
+ data: L,
1284
+ isLoading: T,
1285
1285
  isFetching: se,
1286
1286
  isError: _,
1287
1287
  refetch: ae
@@ -1289,15 +1289,15 @@ function Oe(s, n) {
1289
1289
  queryKey: [
1290
1290
  "tables",
1291
1291
  l,
1292
- r,
1292
+ i,
1293
1293
  d
1294
1294
  ],
1295
- queryFn: () => Ne(
1295
+ queryFn: () => Ce(
1296
1296
  "https://semaphor.cloud/api/v1/tables",
1297
1297
  (t == null ? void 0 : t.accessToken) || "",
1298
1298
  {
1299
1299
  connection_id: l,
1300
- database_name: r,
1300
+ database_name: i,
1301
1301
  schema_name: d
1302
1302
  }
1303
1303
  ),
@@ -1311,21 +1311,21 @@ function Oe(s, n) {
1311
1311
  queryKey: [
1312
1312
  "columns",
1313
1313
  l,
1314
- r,
1314
+ i,
1315
1315
  o,
1316
1316
  d,
1317
- i
1317
+ r
1318
1318
  ],
1319
- queryFn: () => Ne(
1319
+ queryFn: () => Ce(
1320
1320
  "https://semaphor.cloud/api/v1/columns",
1321
1321
  (t == null ? void 0 : t.accessToken) || "",
1322
1322
  {
1323
1323
  connection_id: l,
1324
1324
  datamodel_id: o || "",
1325
1325
  // don't pass undefined. Pass empty string
1326
- database_name: r,
1326
+ database_name: i,
1327
1327
  schema_name: d,
1328
- table_name: i
1328
+ table_name: r
1329
1329
  }
1330
1330
  ),
1331
1331
  enabled: I(q)
@@ -1342,55 +1342,55 @@ function Oe(s, n) {
1342
1342
  }, [te, x, a]), Y(() => {
1343
1343
  }, [
1344
1344
  $,
1345
- u,
1346
- f,
1347
1345
  m,
1346
+ f,
1347
+ h,
1348
1348
  p,
1349
- b
1349
+ y
1350
1350
  ]);
1351
- const oe = (b == null ? void 0 : b.type) === "API" ? (Ke = b == null ? void 0 : b.type) == null ? void 0 : Ke.toLowerCase() : i || "", ce = $ ? "" : d || "";
1352
- function ze(C) {
1353
- m(C), f("");
1351
+ const oe = (y == null ? void 0 : y.type) === "API" ? (Ke = y == null ? void 0 : y.type) == null ? void 0 : Ke.toLowerCase() : r || "", ce = $ ? "" : d || "";
1352
+ function ze(N) {
1353
+ h(N), f("");
1354
1354
  }
1355
- function de(C) {
1356
- p(C === "none" ? "" : C), m(""), f(""), C !== "none" && C !== "" && y("");
1355
+ function de(N) {
1356
+ p(N === "none" ? "" : N), h(""), f(""), N !== "none" && N !== "" && v("");
1357
1357
  }
1358
- function ve(C) {
1359
- h(C);
1358
+ function ve(N) {
1359
+ u(N);
1360
1360
  }
1361
- function $s(C) {
1362
- y(C === "none" ? "" : C), C !== "none" && C !== "" && p("");
1361
+ function $s(N) {
1362
+ v(N === "none" ? "" : N), N !== "none" && N !== "" && p("");
1363
1363
  }
1364
- R && ((Ve = R == null ? void 0 : R.databases) == null ? void 0 : Ve.length) > 0, K && ((We = K == null ? void 0 : K.schemas) == null ? void 0 : We.length) > 0, te && ((Qe = te == null ? void 0 : te.columns) == null ? void 0 : Qe.length) > 0 && (a = te.columns.map((C) => ({
1365
- ...C,
1366
- data_type: C.data_type.toLowerCase()
1364
+ R && ((Ve = R == null ? void 0 : R.databases) == null ? void 0 : Ve.length) > 0, K && ((We = K == null ? void 0 : K.schemas) == null ? void 0 : We.length) > 0, te && ((Qe = te == null ? void 0 : te.columns) == null ? void 0 : Qe.length) > 0 && (a = te.columns.map((N) => ({
1365
+ ...N,
1366
+ data_type: N.data_type.toLowerCase()
1367
1367
  }))), W && (a = []), (J || A) && (a = []);
1368
- const Ie = N == null ? void 0 : N.connections.map(
1369
- (C) => ({
1370
- id: C.id,
1371
- name: C.name,
1372
- type: C.type
1368
+ const Ie = j == null ? void 0 : j.connections.map(
1369
+ (N) => ({
1370
+ id: N.id,
1371
+ name: N.name,
1372
+ type: N.type
1373
1373
  })
1374
- ), us = (g = j == null ? void 0 : j.datamodels) == null ? void 0 : g.map((C) => ({
1375
- id: C.id,
1376
- name: C.name
1377
- })), Ge = R == null ? void 0 : R.databases.map((C) => ({
1378
- id: C.database_name,
1379
- name: C.database_name
1380
- })), hs = K == null ? void 0 : K.schemas.map((C) => ({
1381
- id: C.schema_name,
1382
- name: C.schema_name
1383
- })), ms = T == null ? void 0 : T.tables.map((C) => ({
1384
- id: C.table_name,
1385
- name: C.table_name
1374
+ ), us = (b = g == null ? void 0 : g.datamodels) == null ? void 0 : b.map((N) => ({
1375
+ id: N.id,
1376
+ name: N.name
1377
+ })), Ge = R == null ? void 0 : R.databases.map((N) => ({
1378
+ id: N.database_name,
1379
+ name: N.database_name
1380
+ })), hs = K == null ? void 0 : K.schemas.map((N) => ({
1381
+ id: N.schema_name,
1382
+ name: N.schema_name
1383
+ })), ms = L == null ? void 0 : L.tables.map((N) => ({
1384
+ id: N.table_name,
1385
+ name: N.table_name
1386
1386
  }));
1387
1387
  return {
1388
1388
  connectionItems: Ie,
1389
- isConnectionsLoading: M,
1389
+ isConnectionsLoading: D,
1390
1390
  isConnectionsError: A,
1391
1391
  modelItems: us,
1392
1392
  isModelsLoading: S,
1393
- isModelsError: v,
1393
+ isModelsError: C,
1394
1394
  databaseItems: Ge,
1395
1395
  isDatabasesLoadingOrFetching: B || ee,
1396
1396
  isDatabaseError: W,
@@ -1398,7 +1398,7 @@ function Oe(s, n) {
1398
1398
  isSchemaLoadingOrFetching: ie || w,
1399
1399
  isSchemaError: V,
1400
1400
  tableItems: ms,
1401
- isTableLoadingOrFetching: L || se,
1401
+ isTableLoadingOrFetching: T || se,
1402
1402
  isTableError: _,
1403
1403
  columns: a,
1404
1404
  isColumnsLoadingOrFetching: ke || ye,
@@ -1425,28 +1425,28 @@ function Fa({
1425
1425
  (_) => _.selectedDatabaseName
1426
1426
  ), l = c(
1427
1427
  (_) => _.selectedSchemaName
1428
- ), o = c((_) => _.selectedTableName), r = c(
1428
+ ), o = c((_) => _.selectedTableName), i = c(
1429
1429
  (_) => _.actions.setSelectedTableName
1430
1430
  ), {
1431
1431
  connectionItems: d,
1432
- modelItems: i,
1432
+ modelItems: r,
1433
1433
  schemaItems: x,
1434
- databaseItems: h,
1435
- tableItems: y,
1434
+ databaseItems: u,
1435
+ tableItems: v,
1436
1436
  columns: p,
1437
- isConnectionsLoading: m,
1437
+ isConnectionsLoading: h,
1438
1438
  isModelsLoading: f,
1439
- isConnectionsError: u,
1439
+ isConnectionsError: m,
1440
1440
  isModelsError: k,
1441
1441
  isDatabasesLoadingOrFetching: I,
1442
- isDatabaseError: D,
1443
- isSchemaLoadingOrFetching: N,
1444
- isSchemaError: M,
1442
+ isDatabaseError: M,
1443
+ isSchemaLoadingOrFetching: j,
1444
+ isSchemaError: D,
1445
1445
  isColumnsError: A,
1446
- isColumnsLoadingOrFetching: j,
1446
+ isColumnsLoadingOrFetching: g,
1447
1447
  isTableLoadingOrFetching: S,
1448
- isTableError: v,
1449
- connectionType: b,
1448
+ isTableError: C,
1449
+ connectionType: y,
1450
1450
  isNonDbConnection: q,
1451
1451
  handleConnectionChange: $,
1452
1452
  handleDatabaseChange: R,
@@ -1462,7 +1462,7 @@ function Fa({
1462
1462
  schemaName: le,
1463
1463
  tableName: W,
1464
1464
  columns: p,
1465
- status: j ? "Loading..." : A ? "Error" : "Success"
1465
+ status: g ? "Loading..." : A ? "Error" : "Success"
1466
1466
  }
1467
1467
  );
1468
1468
  }
@@ -1470,7 +1470,7 @@ function Fa({
1470
1470
  window.location.href = "mailto:support@semaphor.cloud?subject=Help&body=I need help with...";
1471
1471
  }
1472
1472
  function w() {
1473
- if (!n || b === "S3" || b === "API")
1473
+ if (!n || y === "S3" || y === "API")
1474
1474
  return null;
1475
1475
  if (!a || a === "none")
1476
1476
  return /* @__PURE__ */ e.jsx(
@@ -1478,9 +1478,9 @@ function Fa({
1478
1478
  {
1479
1479
  showNone: !0,
1480
1480
  onChange: R,
1481
- isError: D,
1481
+ isError: M,
1482
1482
  isLoading: I,
1483
- items: h,
1483
+ items: u,
1484
1484
  value: t || "",
1485
1485
  title: "Database"
1486
1486
  }
@@ -1495,7 +1495,7 @@ function Fa({
1495
1495
  ] });
1496
1496
  }
1497
1497
  function Z() {
1498
- if (!n || b === "S3" || b === "API")
1498
+ if (!n || y === "S3" || y === "API")
1499
1499
  return null;
1500
1500
  if (!t || t === "none")
1501
1501
  return /* @__PURE__ */ e.jsx(
@@ -1505,36 +1505,36 @@ function Fa({
1505
1505
  onChange: ee,
1506
1506
  isError: k,
1507
1507
  isLoading: f,
1508
- items: i,
1508
+ items: r,
1509
1509
  value: a || "",
1510
1510
  title: "Model"
1511
1511
  }
1512
1512
  );
1513
1513
  }
1514
- function T() {
1515
- return !n || b === "S3" || b === "API" || !t || t === "none" ? null : /* @__PURE__ */ e.jsx(
1514
+ function L() {
1515
+ return !n || y === "S3" || y === "API" || !t || t === "none" ? null : /* @__PURE__ */ e.jsx(
1516
1516
  qe,
1517
1517
  {
1518
1518
  onChange: B,
1519
- isError: M,
1520
- isLoading: N,
1519
+ isError: D,
1520
+ isLoading: j,
1521
1521
  items: x,
1522
1522
  value: l || "",
1523
1523
  title: "Schema"
1524
1524
  }
1525
1525
  );
1526
1526
  }
1527
- function L() {
1527
+ function T() {
1528
1528
  function _() {
1529
1529
  let ae = !1;
1530
- return b === "API" ? (ae = !1, ae) : ((b === "S3" || n && t && t !== "none" && l) && (ae = !0), ae);
1530
+ return y === "API" ? (ae = !1, ae) : ((y === "S3" || n && t && t !== "none" && l) && (ae = !0), ae);
1531
1531
  }
1532
1532
  return _() ? /* @__PURE__ */ e.jsx(
1533
1533
  qe,
1534
1534
  {
1535
- onChange: r,
1536
- isError: v,
1537
- items: y,
1535
+ onChange: i,
1536
+ isError: C,
1537
+ items: v,
1538
1538
  isLoading: S,
1539
1539
  value: o || "",
1540
1540
  title: "Table"
@@ -1550,8 +1550,8 @@ function Fa({
1550
1550
  title: "Connection",
1551
1551
  value: n || "",
1552
1552
  onChange: $,
1553
- isLoading: m,
1554
- isError: u,
1553
+ isLoading: h,
1554
+ isError: m,
1555
1555
  connectionTooltip: ((se = d == null ? void 0 : d.find(
1556
1556
  (_) => _.id === n
1557
1557
  )) == null ? void 0 : se.type) || ""
@@ -1560,8 +1560,8 @@ function Fa({
1560
1560
  Z(),
1561
1561
  V(),
1562
1562
  w(),
1563
- T(),
1564
- L()
1563
+ L(),
1564
+ T()
1565
1565
  ] }),
1566
1566
  K(),
1567
1567
  /* @__PURE__ */ e.jsx("div", { className: "flex items-end justify-center gap-2 px-6 py-4", children: /* @__PURE__ */ e.jsxs(
@@ -1572,7 +1572,7 @@ function Fa({
1572
1572
  variant: "secondary",
1573
1573
  className: "w-full",
1574
1574
  children: [
1575
- /* @__PURE__ */ e.jsx(Ln, { className: "mr-2 size-4" }),
1575
+ /* @__PURE__ */ e.jsx(Tn, { className: "mr-2 size-4" }),
1576
1576
  "Help"
1577
1577
  ]
1578
1578
  }
@@ -1583,16 +1583,16 @@ function Qn(s) {
1583
1583
  const n = s.toUpperCase().indexOf("WHERE"), a = s.toUpperCase().indexOf("GROUP BY"), t = s.toUpperCase().indexOf("LIMIT"), l = s.toUpperCase().indexOf("ORDER BY");
1584
1584
  let o = s.length;
1585
1585
  if (l !== -1 && (o = l), t !== -1 && t < o && (o = t), n !== -1) {
1586
- const r = s.substring(0, n), d = s.substring(n);
1587
- return `${r} {{ filters | where }} AND ${d.substring(
1586
+ const i = s.substring(0, n), d = s.substring(n);
1587
+ return `${i} {{ filters | where }} AND ${d.substring(
1588
1588
  6
1589
1589
  )}`;
1590
1590
  } else if (a !== -1) {
1591
- const r = s.substring(0, a), d = s.substring(a);
1592
- return `${r} {{ filters | where }} ${d}`;
1591
+ const i = s.substring(0, a), d = s.substring(a);
1592
+ return `${i} {{ filters | where }} ${d}`;
1593
1593
  } else {
1594
- const r = s.substring(0, o), d = s.substring(o);
1595
- return `${r} {{ filters | where }} ${d}`;
1594
+ const i = s.substring(0, o), d = s.substring(o);
1595
+ return `${i} {{ filters | where }} ${d}`;
1596
1596
  }
1597
1597
  }
1598
1598
  function Jn({
@@ -1614,7 +1614,7 @@ function Jn({
1614
1614
  size: "sm",
1615
1615
  variant: "outline",
1616
1616
  children: [
1617
- /* @__PURE__ */ e.jsx(Nn, { className: "mr-2 h-4 w-4" }),
1617
+ /* @__PURE__ */ e.jsx(Cn, { className: "mr-2 h-4 w-4" }),
1618
1618
  "Debug with AI"
1619
1619
  ]
1620
1620
  }
@@ -1637,7 +1637,7 @@ function Xn() {
1637
1637
  (o) => o.selectedConnectionId
1638
1638
  ), { data: a } = re({
1639
1639
  queryKey: ["connections"],
1640
- queryFn: () => Ne(
1640
+ queryFn: () => Ce(
1641
1641
  "https://semaphor.cloud/api/v1/connections",
1642
1642
  (s == null ? void 0 : s.accessToken) || ""
1643
1643
  ),
@@ -1649,20 +1649,20 @@ function Xn() {
1649
1649
  return t == null ? void 0 : t.type;
1650
1650
  }
1651
1651
  function Zn() {
1652
- const { authToken: s } = je(), n = Be(null), a = c((i) => i.applyFilters), [t, l] = E(""), o = c((i) => i.filterValues), r = c((i) => i.card.sql), d = Xn();
1652
+ const { authToken: s } = je(), n = Be(null), a = c((r) => r.applyFilters), [t, l] = E(""), o = c((r) => r.filterValues), i = c((r) => r.card.sql), d = Xn();
1653
1653
  return /* @__PURE__ */ e.jsxs(
1654
1654
  Ms,
1655
1655
  {
1656
1656
  openDelay: 0,
1657
- onOpenChange: async (i) => {
1658
- if (!i)
1657
+ onOpenChange: async (r) => {
1658
+ if (!r)
1659
1659
  return;
1660
1660
  console.log("onOpenChange");
1661
1661
  const x = await Ue(
1662
1662
  "https://semaphor.cloud/api/v1/filter-sql",
1663
1663
  (s == null ? void 0 : s.accessToken) || "",
1664
1664
  {
1665
- sql: r,
1665
+ sql: i,
1666
1666
  active_filters: o,
1667
1667
  connection_type: d
1668
1668
  }
@@ -1746,21 +1746,21 @@ function sl({
1746
1746
  triggerAIRun: l,
1747
1747
  setTriggerAIRun: o
1748
1748
  }) {
1749
- const r = Be(null), d = Be(null), { authToken: i } = je(), [x, h] = E(!1), y = c((w) => w.actions.setCardSql), p = z((w) => w.dashboard.baseQueries), m = c((w) => w.actions.setRunSql), f = c((w) => w.actions.setCardType), [u, k] = E([]), I = c((w) => w.currentColumns), D = c((w) => w.card.sql), N = c((w) => w.selectedTableName), M = `
1749
+ const i = Be(null), d = Be(null), { authToken: r } = je(), [x, u] = E(!1), v = c((w) => w.actions.setCardSql), p = z((w) => w.dashboard.baseQueries), h = c((w) => w.actions.setRunSql), f = c((w) => w.actions.setCardType), [m, k] = E([]), I = c((w) => w.currentColumns), M = c((w) => w.card.sql), j = c((w) => w.selectedTableName), D = `
1750
1750
  ${a}
1751
1751
 
1752
- Database Query Dialect: ${N === "api" || N === "s3" ? "DuckDb" : ""}
1753
- Table Name: ${N}
1752
+ Database Query Dialect: ${j === "api" || j === "s3" ? "DuckDb" : ""}
1753
+ Table Name: ${j}
1754
1754
  Table Columns: ${I == null ? void 0 : I.map((w) => `${w.column_name} | ${w.data_type}`).join(", ")}
1755
- User SQL: ${D}
1755
+ User SQL: ${M}
1756
1756
  ${p && `Base Queries: ${JSON.stringify(p)} `}`, A = ` 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.
1757
- Visual Query Syntax: ${el}`, { data: j, isLoading: S, isFetching: v, isError: b, refetch: q } = re({
1757
+ Visual Query Syntax: ${el}`, { data: g, isLoading: S, isFetching: C, isError: y, refetch: q } = re({
1758
1758
  queryKey: ["ai-query"],
1759
- queryFn: () => Ne(
1759
+ queryFn: () => Ce(
1760
1760
  "https://semaphor.cloud/api/v1/ai",
1761
- (i == null ? void 0 : i.accessToken) || "",
1761
+ (r == null ? void 0 : r.accessToken) || "",
1762
1762
  {
1763
- user_content: `userContent: ${M} ${x ? A : ""}`
1763
+ user_content: `userContent: ${D} ${x ? A : ""}`
1764
1764
  }
1765
1765
  ),
1766
1766
  enabled: !1
@@ -1788,19 +1788,19 @@ function sl({
1788
1788
  return !0;
1789
1789
  }
1790
1790
  Y(() => {
1791
- j && k((w) => [...w, { role: "ai", content: j.response }]);
1792
- }, [j]), Y(() => {
1791
+ g && k((w) => [...w, { role: "ai", content: g.response }]);
1792
+ }, [g]), Y(() => {
1793
1793
  const w = setTimeout(() => {
1794
1794
  var V;
1795
1795
  d.current && (d.current.scroll({
1796
1796
  top: d.current.scrollHeight,
1797
1797
  behavior: "smooth"
1798
- }), (V = r.current) == null || V.focus());
1798
+ }), (V = i.current) == null || V.focus());
1799
1799
  }, 100);
1800
1800
  return () => clearTimeout(w);
1801
- }, [u]);
1801
+ }, [m]);
1802
1802
  function R() {
1803
- a && (k((w) => [...w, { role: "user", content: a }]), $(a) && h(!0), t(""), q());
1803
+ a && (k((w) => [...w, { role: "user", content: a }]), $(a) && u(!0), t(""), q());
1804
1804
  }
1805
1805
  Y(() => {
1806
1806
  l && (R(), o(!1));
@@ -1842,8 +1842,8 @@ function sl({
1842
1842
  F,
1843
1843
  {
1844
1844
  onClick: (Z) => {
1845
- const T = K(Z);
1846
- T && (n(!1), y(T), m(!0));
1845
+ const L = K(Z);
1846
+ L && (n(!1), v(L), h(!0));
1847
1847
  },
1848
1848
  size: "sm",
1849
1849
  variant: "outline",
@@ -1860,10 +1860,10 @@ function sl({
1860
1860
  if (!V)
1861
1861
  return;
1862
1862
  const Z = V.textContent || V.innerText;
1863
- return navigator.clipboard.writeText(Z).then(() => console.log("Text copied to clipboard")).catch((T) => console.error("Error in copying text: ", T)), Z;
1863
+ return navigator.clipboard.writeText(Z).then(() => console.log("Text copied to clipboard")).catch((L) => console.error("Error in copying text: ", L)), Z;
1864
1864
  }
1865
1865
  function ie() {
1866
- return u == null ? void 0 : u.map((w, V) => w.role === "user" ? /* @__PURE__ */ e.jsxs(
1866
+ return m == null ? void 0 : m.map((w, V) => w.role === "user" ? /* @__PURE__ */ e.jsxs(
1867
1867
  "div",
1868
1868
  {
1869
1869
  className: "flex items-start rounded-md bg-muted p-3 text-sm",
@@ -1878,12 +1878,12 @@ function sl({
1878
1878
  {
1879
1879
  className: "w-full overflow-auto py-1",
1880
1880
  components: le,
1881
- children: j == null ? void 0 : j.response.replace(/DuckDB/gi, "Semaphor")
1881
+ children: g == null ? void 0 : g.response.replace(/DuckDB/gi, "Semaphor")
1882
1882
  },
1883
1883
  V
1884
1884
  ) : /* @__PURE__ */ e.jsx("div", {}, V));
1885
1885
  }
1886
- return /* @__PURE__ */ e.jsxs(Cs, { open: s, onOpenChange: n, children: [
1886
+ return /* @__PURE__ */ e.jsxs(Ns, { open: s, onOpenChange: n, children: [
1887
1887
  /* @__PURE__ */ e.jsx(Ss, { asChild: !0, children: /* @__PURE__ */ e.jsx(
1888
1888
  F,
1889
1889
  {
@@ -1900,7 +1900,7 @@ function sl({
1900
1900
  children: [
1901
1901
  /* @__PURE__ */ e.jsxs(zs, { children: [
1902
1902
  /* @__PURE__ */ e.jsx(Fs, { children: "Assistant" }),
1903
- /* @__PURE__ */ e.jsx(Ls, { children: "What can I help you with?" })
1903
+ /* @__PURE__ */ e.jsx(Ts, { children: "What can I help you with?" })
1904
1904
  ] }),
1905
1905
  /* @__PURE__ */ e.jsx(
1906
1906
  "div",
@@ -1918,7 +1918,7 @@ function sl({
1918
1918
  ua,
1919
1919
  {
1920
1920
  autoFocus: !0,
1921
- ref: r,
1921
+ ref: i,
1922
1922
  onKeyDown: (w) => {
1923
1923
  w.key === "Enter" && !w.shiftKey && (w.preventDefault(), t(""), R());
1924
1924
  },
@@ -1930,7 +1930,7 @@ function sl({
1930
1930
  className: X(
1931
1931
  "max-h-10 min-h-7 resize-none border-none focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0"
1932
1932
  ),
1933
- disabled: S || v,
1933
+ disabled: S || C,
1934
1934
  value: a,
1935
1935
  onChange: (w) => t(w.target.value)
1936
1936
  }
@@ -1943,7 +1943,7 @@ function sl({
1943
1943
  size: "sm",
1944
1944
  variant: "ghost",
1945
1945
  onClick: R,
1946
- children: !S && !v ? /* @__PURE__ */ e.jsx(ot, {}) : /* @__PURE__ */ e.jsx(Pe, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" })
1946
+ children: !S && !C ? /* @__PURE__ */ e.jsx(ot, {}) : /* @__PURE__ */ e.jsx(Pe, { className: "mr-2 h-4 w-4 animate-spin text-foreground/50" })
1947
1947
  }
1948
1948
  )
1949
1949
  ] })
@@ -1954,13 +1954,13 @@ function sl({
1954
1954
  )
1955
1955
  ] });
1956
1956
  }
1957
- var La = {
1957
+ var Ta = {
1958
1958
  color: void 0,
1959
1959
  size: void 0,
1960
1960
  className: void 0,
1961
1961
  style: void 0,
1962
1962
  attr: void 0
1963
- }, Xs = ge.createContext && /* @__PURE__ */ ge.createContext(La), al = ["attr", "size", "title"];
1963
+ }, Xs = ge.createContext && /* @__PURE__ */ ge.createContext(Ta), al = ["attr", "size", "title"];
1964
1964
  function tl(s, n) {
1965
1965
  if (s == null)
1966
1966
  return {};
@@ -2030,15 +2030,15 @@ function rl(s, n) {
2030
2030
  }
2031
2031
  return (n === "string" ? String : Number)(s);
2032
2032
  }
2033
- function Ta(s) {
2033
+ function La(s) {
2034
2034
  return s && s.map((n, a) => /* @__PURE__ */ ge.createElement(n.tag, ns({
2035
2035
  key: a
2036
- }, n.attr), Ta(n.child)));
2036
+ }, n.attr), La(n.child)));
2037
2037
  }
2038
2038
  function be(s) {
2039
2039
  return (n) => /* @__PURE__ */ ge.createElement(ol, ts({
2040
2040
  attr: ns({}, s.attr)
2041
- }, n), Ta(s.child));
2041
+ }, n), La(s.child));
2042
2042
  }
2043
2043
  function ol(s) {
2044
2044
  var n = (a) => {
@@ -2046,13 +2046,13 @@ function ol(s) {
2046
2046
  attr: t,
2047
2047
  size: l,
2048
2048
  title: o
2049
- } = s, r = tl(s, al), d = l || a.size || "1em", i;
2050
- return a.className && (i = a.className), s.className && (i = (i ? i + " " : "") + s.className), /* @__PURE__ */ ge.createElement("svg", ts({
2049
+ } = s, i = tl(s, al), d = l || a.size || "1em", r;
2050
+ return a.className && (r = a.className), s.className && (r = (r ? r + " " : "") + s.className), /* @__PURE__ */ ge.createElement("svg", ts({
2051
2051
  stroke: "currentColor",
2052
2052
  fill: "currentColor",
2053
2053
  strokeWidth: "0"
2054
- }, a.attr, t, r, {
2055
- className: i,
2054
+ }, a.attr, t, i, {
2055
+ className: r,
2056
2056
  style: ns(ns({
2057
2057
  color: s.color || a.color
2058
2058
  }, a.style), s.style),
@@ -2061,29 +2061,29 @@ function ol(s) {
2061
2061
  xmlns: "http://www.w3.org/2000/svg"
2062
2062
  }), o && /* @__PURE__ */ ge.createElement("title", null, o), s.children);
2063
2063
  };
2064
- return Xs !== void 0 ? /* @__PURE__ */ ge.createElement(Xs.Consumer, null, (a) => n(a)) : n(La);
2064
+ return Xs !== void 0 ? /* @__PURE__ */ ge.createElement(Xs.Consumer, null, (a) => n(a)) : n(Ta);
2065
2065
  }
2066
2066
  function cl(s) {
2067
2067
  return be({ 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);
2068
2068
  }
2069
2069
  function dl() {
2070
- const { theme: s } = ut(), n = Be(), a = Be(), [t, l] = E(!1), [o, r] = E(!1), [d, i] = E(!1), [x, h] = E(""), [y, p] = E(!1), { authToken: m } = je();
2071
- z((g) => g.selectedSheetId);
2072
- const f = z((g) => g.dashboard.baseQueries), u = c((g) => g.card), k = z((g) => g.theme), I = c((g) => g.isShowingVisual);
2073
- z((g) => g.onAcceptChanges);
2074
- const D = c(
2075
- (g) => g.selectedConnectionId
2076
- ), N = c(
2077
- (g) => g.selectedDatabaseName
2078
- ), M = c(
2079
- (g) => g.selectedDatamodelId
2070
+ const { theme: s } = ut(), n = Be(), a = Be(), [t, l] = E(!1), [o, i] = E(!1), [d, r] = E(!1), [x, u] = E(""), [v, p] = E(!1), { authToken: h } = je();
2071
+ z((b) => b.selectedSheetId);
2072
+ const f = z((b) => b.dashboard.baseQueries), m = c((b) => b.card), k = z((b) => b.theme), I = c((b) => b.isShowingVisual);
2073
+ z((b) => b.onAcceptChanges);
2074
+ const M = c(
2075
+ (b) => b.selectedConnectionId
2076
+ ), j = c(
2077
+ (b) => b.selectedDatabaseName
2078
+ ), D = c(
2079
+ (b) => b.selectedDatamodelId
2080
2080
  ), A = c(
2081
- (g) => g.selectedSchemaName
2081
+ (b) => b.selectedSchemaName
2082
2082
  );
2083
2083
  z(
2084
- (g) => g.actions.updateFrameCard
2084
+ (b) => b.actions.updateFrameCard
2085
2085
  );
2086
- const j = c((g) => g.selectedTableName), S = c((g) => g.card.sql), v = c((g) => g.card.python), b = ht(S, f), q = c((g) => g.selectedConnectionId), $ = c((g) => g.frame), R = z((g) => g.filterValues), B = c((g) => g.applyFilters), {
2086
+ const g = c((b) => b.selectedTableName), S = c((b) => b.card.sql), C = c((b) => b.card.python), y = ht(S, f), q = c((b) => b.selectedConnectionId), $ = c((b) => b.frame), R = z((b) => b.filterValues), B = c((b) => b.applyFilters), {
2087
2087
  setCardCustomCfg: ee,
2088
2088
  setQueryResultColumns: W,
2089
2089
  setFilterValues: le,
@@ -2092,10 +2092,10 @@ function dl() {
2092
2092
  setQueryError: w,
2093
2093
  setPythonStdOut: V,
2094
2094
  setCardPreferences: Z
2095
- } = c((g) => g.actions), T = c((g) => g.onSave), L = c(
2096
- (g) => g.actions.setApplyFilters
2097
- ), se = c((g) => g.onClose), _ = c((g) => g.actions.setCardData), ae = c((g) => g.actions.setSqlGen), te = c((g) => g.runSql), ke = c((g) => g.actions.setRunSql), ye = c(
2098
- (g) => g.actions.setIsSqlRunning
2095
+ } = c((b) => b.actions), L = c((b) => b.onSave), T = c(
2096
+ (b) => b.actions.setApplyFilters
2097
+ ), se = c((b) => b.onClose), _ = c((b) => b.actions.setCardData), ae = c((b) => b.actions.setSqlGen), te = c((b) => b.runSql), ke = c((b) => b.actions.setRunSql), ye = c(
2098
+ (b) => b.actions.setIsSqlRunning
2099
2099
  ), {
2100
2100
  data: J,
2101
2101
  isLoading: oe,
@@ -2106,14 +2106,14 @@ function dl() {
2106
2106
  status: $s,
2107
2107
  refetch: Ie
2108
2108
  } = re({
2109
- queryKey: [b, v],
2109
+ queryKey: [y, C],
2110
2110
  queryFn: () => Ue(
2111
2111
  "https://semaphor.cloud/api/v1/query",
2112
- (m == null ? void 0 : m.accessToken) || "",
2112
+ (h == null ? void 0 : h.accessToken) || "",
2113
2113
  {
2114
2114
  connection_id: q,
2115
- sql: b,
2116
- python: v === Gs ? "" : v,
2115
+ sql: y,
2116
+ python: C === Gs ? "" : C,
2117
2117
  active_filters: B ? R : []
2118
2118
  }
2119
2119
  ),
@@ -2125,8 +2125,8 @@ function dl() {
2125
2125
  position: "top-center",
2126
2126
  richColors: !0
2127
2127
  }), V((J == null ? void 0 : J.output) || ""), J.records.length > 0)) {
2128
- const { dimensionKeys: g } = gs(J.records);
2129
- W(g);
2128
+ const { dimensionKeys: b } = gs(J.records);
2129
+ W(b);
2130
2130
  }
2131
2131
  }, [J, _, W, V]), Y(() => {
2132
2132
  te && (Ie(), ke(!1));
@@ -2148,59 +2148,59 @@ function dl() {
2148
2148
  function us() {
2149
2149
  K(""), _([]), ae({}), ee(""), Z({});
2150
2150
  }
2151
- const Ge = (g) => {
2152
- a.current = g;
2151
+ const Ge = (b) => {
2152
+ a.current = b;
2153
2153
  };
2154
- function hs(g, C) {
2155
- if (g.length === 0)
2154
+ function hs(b, N) {
2155
+ if (b.length === 0)
2156
2156
  return "";
2157
- if (C) {
2158
- const Fe = g.find((ne) => ne.id === C);
2157
+ if (N) {
2158
+ const Fe = b.find((ne) => ne.id === N);
2159
2159
  if (Fe) {
2160
2160
  const ne = Fe.tabTitle;
2161
2161
  if (ne == "All__Header")
2162
- return g[0].id;
2162
+ return b[0].id;
2163
2163
  if (ne && ne.endsWith("__Header")) {
2164
- const Pa = ne.split("__")[0], Bs = g.find(
2164
+ const Pa = ne.split("__")[0], Bs = b.find(
2165
2165
  (Ua) => Ua.tabTitle === Pa
2166
2166
  );
2167
- return Bs ? Bs.id : g[0].id;
2167
+ return Bs ? Bs.id : b[0].id;
2168
2168
  }
2169
- return C;
2169
+ return N;
2170
2170
  }
2171
2171
  }
2172
- return g[0].id;
2172
+ return b[0].id;
2173
2173
  }
2174
2174
  function ms() {
2175
- let g = S;
2176
- S && !S.includes("{{") && (g = Qn(S), K(g));
2177
- const C = {
2178
- ...u,
2175
+ let b = S;
2176
+ S && !S.includes("{{") && (b = Qn(S), K(b));
2177
+ const N = {
2178
+ ...m,
2179
2179
  lastSelectedSchema: A,
2180
- lastSelectedDatamodelId: M,
2181
- lastSelectedDatabase: N,
2182
- lastSelectedTable: j,
2183
- connectionId: D,
2184
- type: I ? u.type : "table",
2185
- sql: g,
2186
- customCfg: I ? u.customCfg : null
2180
+ lastSelectedDatamodelId: D,
2181
+ lastSelectedDatabase: j,
2182
+ lastSelectedTable: g,
2183
+ connectionId: M,
2184
+ type: I ? m.type : "table",
2185
+ sql: b,
2186
+ customCfg: I ? m.customCfg : null
2187
2187
  }, Fe = $.cards.map(
2188
- (xs) => xs.id === u.id ? C : xs
2188
+ (xs) => xs.id === m.id ? N : xs
2189
2189
  ), ne = {
2190
2190
  ...$,
2191
2191
  cards: Fe,
2192
2192
  activeCardId: hs(Fe, $.activeCardId)
2193
2193
  };
2194
- T == null || T(ne);
2194
+ L == null || L(ne);
2195
2195
  }
2196
2196
  function Ke() {
2197
2197
  se == null || se();
2198
2198
  }
2199
2199
  Y(() => {
2200
- const g = n.current, C = a.current;
2201
- if (g) {
2200
+ const b = n.current, N = a.current;
2201
+ if (b) {
2202
2202
  const Fe = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light", ne = k === "system" ? Fe : k;
2203
- g.editor.defineTheme("default", {
2203
+ b.editor.defineTheme("default", {
2204
2204
  // base: theme === 'light' ? 'hc-light' : 'vs-dark',
2205
2205
  base: ne === "light" ? "vs" : "vs-dark",
2206
2206
  inherit: !0,
@@ -2209,18 +2209,18 @@ function dl() {
2209
2209
  // 'editor.background': activeTheme === 'light' ? '#ffffff' : '#020817',
2210
2210
  "editor.background": ne === "light" ? "#ffffff" : mt("--semaphor-background")
2211
2211
  }
2212
- }), g.editor.setTheme("default");
2212
+ }), b.editor.setTheme("default");
2213
2213
  }
2214
- return C && g && C.addCommand(
2215
- g.KeyMod.Shift | g.KeyCode.Enter,
2214
+ return N && b && N.addCommand(
2215
+ b.KeyMod.Shift | b.KeyCode.Enter,
2216
2216
  function() {
2217
2217
  return console.log("Executing query..."), Ie(), !1;
2218
2218
  }
2219
2219
  ), () => {
2220
2220
  };
2221
2221
  }, [s, k, n.current]);
2222
- function Ve(g) {
2223
- n.current = g;
2222
+ function Ve(b) {
2223
+ n.current = b;
2224
2224
  }
2225
2225
  function We() {
2226
2226
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
@@ -2235,7 +2235,7 @@ function dl() {
2235
2235
  Yn,
2236
2236
  {
2237
2237
  checked: B,
2238
- onCheckedChange: () => L(!B),
2238
+ onCheckedChange: () => T(!B),
2239
2239
  text: "Apply Filters"
2240
2240
  }
2241
2241
  ),
@@ -2243,7 +2243,7 @@ function dl() {
2243
2243
  R && o && /* @__PURE__ */ e.jsx(
2244
2244
  He,
2245
2245
  {
2246
- onClick: () => r(!1),
2246
+ onClick: () => i(!1),
2247
2247
  className: "bg-background/50 text-foreground/50 hover:cursor-pointer hover:text-foreground"
2248
2248
  }
2249
2249
  )
@@ -2252,10 +2252,10 @@ function dl() {
2252
2252
  _e,
2253
2253
  {
2254
2254
  theme: "default",
2255
- onChange: (g) => {
2256
- if (g)
2255
+ onChange: (b) => {
2256
+ if (b)
2257
2257
  try {
2258
- JSON.parse(g), le(JSON.parse(g));
2258
+ JSON.parse(b), le(JSON.parse(b));
2259
2259
  } catch {
2260
2260
  }
2261
2261
  },
@@ -2285,7 +2285,7 @@ function dl() {
2285
2285
  R && !o && /* @__PURE__ */ e.jsx(
2286
2286
  ta,
2287
2287
  {
2288
- onClick: () => r(!0),
2288
+ onClick: () => i(!0),
2289
2289
  className: X(
2290
2290
  "absolute bottom-4 right-6 h-3 w-3 text-foreground/50 hover:cursor-pointer hover:text-foreground",
2291
2291
  {
@@ -2322,8 +2322,8 @@ function dl() {
2322
2322
  {
2323
2323
  theme: "default",
2324
2324
  className: "pt-3",
2325
- onChange: (g) => {
2326
- K(g);
2325
+ onChange: (b) => {
2326
+ K(b);
2327
2327
  },
2328
2328
  value: S,
2329
2329
  options: {
@@ -2369,10 +2369,10 @@ function dl() {
2369
2369
  {
2370
2370
  className: "pt-3",
2371
2371
  theme: "default",
2372
- onChange: (g) => {
2373
- ie(g && g.trim() || "");
2372
+ onChange: (b) => {
2373
+ ie(b && b.trim() || "");
2374
2374
  },
2375
- value: v || Gs,
2375
+ value: C || Gs,
2376
2376
  options: {
2377
2377
  minimap: {
2378
2378
  enabled: !1
@@ -2448,9 +2448,9 @@ function dl() {
2448
2448
  Jn,
2449
2449
  {
2450
2450
  error: ve.message,
2451
- setShowAIDialog: i,
2451
+ setShowAIDialog: r,
2452
2452
  setTriggerAIRun: p,
2453
- setUserInputforAI: h
2453
+ setUserInputforAI: u
2454
2454
  }
2455
2455
  ),
2456
2456
  /* @__PURE__ */ e.jsxs(
@@ -2470,7 +2470,7 @@ function dl() {
2470
2470
  oa,
2471
2471
  {
2472
2472
  pressed: t,
2473
- onPressedChange: (g) => l(g),
2473
+ onPressedChange: (b) => l(b),
2474
2474
  className: "",
2475
2475
  size: "sm",
2476
2476
  variant: "outline",
@@ -2481,11 +2481,11 @@ function dl() {
2481
2481
  sl,
2482
2482
  {
2483
2483
  open: d,
2484
- setOpen: i,
2484
+ setOpen: r,
2485
2485
  userInput: x,
2486
- triggerAIRun: y,
2486
+ triggerAIRun: v,
2487
2487
  setTriggerAIRun: p,
2488
- setUserInput: (g) => h(g)
2488
+ setUserInput: (b) => u(b)
2489
2489
  }
2490
2490
  )
2491
2491
  ] }),
@@ -2525,17 +2525,17 @@ function dl() {
2525
2525
  );
2526
2526
  }
2527
2527
  function ul({ data: s }) {
2528
- var r;
2528
+ var i;
2529
2529
  const [n, a] = ge.useState([]), l = Object.keys(s[0]).map((d) => ({
2530
2530
  // header: key,
2531
2531
  accessorKey: d,
2532
- header: ({ column: i }) => {
2533
- const x = i.getIsSorted();
2532
+ header: ({ column: r }) => {
2533
+ const x = r.getIsSorted();
2534
2534
  return /* @__PURE__ */ e.jsx("div", { className: "flex gap-2", children: /* @__PURE__ */ e.jsxs(
2535
2535
  "div",
2536
2536
  {
2537
2537
  className: "flex cursor-pointer items-center",
2538
- onClick: () => i.toggleSorting(i.getIsSorted() === "asc"),
2538
+ onClick: () => r.toggleSorting(r.getIsSorted() === "asc"),
2539
2539
  children: [
2540
2540
  d,
2541
2541
  x === "asc" ? /* @__PURE__ */ e.jsx(pt, { className: "ml-2 h-5 w-5" }) : x === "desc" ? /* @__PURE__ */ e.jsx(ft, { className: "ml-2 h-5 w-5" }) : null
@@ -2546,8 +2546,8 @@ function ul({ data: s }) {
2546
2546
  })), o = gt({
2547
2547
  data: s,
2548
2548
  columns: l,
2549
- getCoreRowModel: Nt(),
2550
- getPaginationRowModel: Ct(),
2549
+ getCoreRowModel: Ct(),
2550
+ getPaginationRowModel: Nt(),
2551
2551
  onSortingChange: a,
2552
2552
  getSortedRowModel: St(),
2553
2553
  manualPagination: !0,
@@ -2556,67 +2556,72 @@ function ul({ data: s }) {
2556
2556
  }
2557
2557
  });
2558
2558
  return /* @__PURE__ */ e.jsxs(jt, { children: [
2559
- /* @__PURE__ */ e.jsx(bt, { children: o.getHeaderGroups().map((d) => /* @__PURE__ */ e.jsx(ps, { children: d.headers.map((i) => /* @__PURE__ */ e.jsx(yt, { className: "sticky top-0 bg-muted", children: i.isPlaceholder ? null : Ks(
2560
- i.column.columnDef.header,
2561
- i.getContext()
2562
- ) }, i.id)) }, d.id)) }),
2563
- /* @__PURE__ */ e.jsx(vt, { children: (r = o.getRowModel().rows) != null && r.length ? o.getRowModel().rows.map((d) => /* @__PURE__ */ e.jsx(
2559
+ /* @__PURE__ */ e.jsx(bt, { children: o.getHeaderGroups().map((d) => /* @__PURE__ */ e.jsx(ps, { children: d.headers.map((r) => /* @__PURE__ */ e.jsx(yt, { className: "sticky top-0 bg-muted", children: r.isPlaceholder ? null : Ks(
2560
+ r.column.columnDef.header,
2561
+ r.getContext()
2562
+ ) }, r.id)) }, d.id)) }),
2563
+ /* @__PURE__ */ e.jsx(vt, { children: (i = o.getRowModel().rows) != null && i.length ? o.getRowModel().rows.map((d) => /* @__PURE__ */ e.jsx(
2564
2564
  ps,
2565
2565
  {
2566
2566
  className: "whitespace-nowrap py-2",
2567
2567
  "data-state": d.getIsSelected() && "selected",
2568
- children: d.getVisibleCells().map((i) => /* @__PURE__ */ e.jsx(Ws, { children: Ks(i.column.columnDef.cell, i.getContext()) }, i.id))
2568
+ children: d.getVisibleCells().map((r) => /* @__PURE__ */ e.jsx(Ws, { children: Ks(r.column.columnDef.cell, r.getContext()) }, r.id))
2569
2569
  },
2570
2570
  d.id
2571
2571
  )) : /* @__PURE__ */ e.jsx(ps, { children: /* @__PURE__ */ e.jsx(Ws, { colSpan: l.length, className: "h-24 text-center", children: "No results." }) }) })
2572
2572
  ] });
2573
2573
  }
2574
2574
  function hl({ card: s }) {
2575
- var d, i, x, h, y, p, m, f;
2576
- (d = s.customCardPreferences) != null && d.inputData;
2577
- const { getCard: n } = ha(((i = s.customCardPreferences) == null ? void 0 : i.url) || ""), a = ((x = s.customCardPreferences) == null ? void 0 : x.visualType) || "single", t = c((u) => u.frame);
2578
- if (we(), !((h = s.customCardPreferences) != null && h.componentName))
2575
+ var x, u, v, p, h, f, m, k, I, M;
2576
+ const n = z((j) => j.themeStyle), a = {
2577
+ colors: ((u = (x = n == null ? void 0 : n.chart) == null ? void 0 : x.dataset) == null ? void 0 : u.backgroundColor) || []
2578
+ };
2579
+ (v = s.customCardPreferences) != null && v.inputData;
2580
+ const { getCard: t } = ha(((p = s.customCardPreferences) == null ? void 0 : p.url) || ""), l = ((h = s.customCardPreferences) == null ? void 0 : h.visualType) || "single", o = c((j) => j.frame);
2581
+ if (we(), !((f = s.customCardPreferences) != null && f.componentName))
2579
2582
  return null;
2580
- const l = n(
2581
- (y = s.customCardPreferences) == null ? void 0 : y.componentName
2582
- ), o = (u) => {
2583
- console.log("data", u), s.customCardPreferences;
2583
+ const i = t(
2584
+ (m = s.customCardPreferences) == null ? void 0 : m.componentName
2585
+ ), d = (j) => {
2586
+ console.log("data", j), s.customCardPreferences;
2584
2587
  }, r = Object.keys(
2585
- ((p = s.customCardPreferences) == null ? void 0 : p.dataInputCardIds) || {}
2586
- ).map((u) => {
2587
- var D, N, M;
2588
- const k = (N = (D = s.customCardPreferences) == null ? void 0 : D.dataInputCardIds) == null ? void 0 : N[u].cardId, I = (M = t == null ? void 0 : t.cards) == null ? void 0 : M.find((A) => A.id === k);
2589
- return I || null;
2588
+ ((k = s.customCardPreferences) == null ? void 0 : k.dataInputCardIds) || {}
2589
+ ).map((j) => {
2590
+ var g, S, C;
2591
+ const D = (S = (g = s.customCardPreferences) == null ? void 0 : g.dataInputCardIds) == null ? void 0 : S[j].cardId, A = (C = o == null ? void 0 : o.cards) == null ? void 0 : C.find((y) => y.id === D);
2592
+ return A || null;
2590
2593
  });
2591
2594
  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(
2592
2595
  un,
2593
2596
  {
2594
2597
  fallback: /* @__PURE__ */ e.jsx(e.Fragment, {}),
2595
2598
  children: [
2596
- l && a === "single" && /* @__PURE__ */ e.jsx(
2597
- l,
2599
+ i && l === "single" && /* @__PURE__ */ e.jsx(
2600
+ i,
2598
2601
  {
2599
- settings: (m = s.customCardPreferences) == null ? void 0 : m.settings,
2600
- onDataChange: o,
2602
+ theme: a,
2603
+ settings: (I = s.customCardPreferences) == null ? void 0 : I.settings,
2604
+ onDataChange: d,
2601
2605
  data: s.data
2602
2606
  }
2603
2607
  ),
2604
- l && a === "multiple" && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e.jsx(
2605
- l,
2608
+ i && l === "multiple" && /* @__PURE__ */ e.jsx("div", { className: "flex flex-col gap-2", children: /* @__PURE__ */ e.jsx(
2609
+ i,
2606
2610
  {
2607
- onDataChange: o,
2611
+ theme: a,
2612
+ onDataChange: d,
2608
2613
  settings: r.map(
2609
- (u) => {
2610
- var k;
2611
- return (k = u == null ? void 0 : u.customCardPreferences) == null ? void 0 : k.settings;
2614
+ (j) => {
2615
+ var D;
2616
+ return (D = j == null ? void 0 : j.customCardPreferences) == null ? void 0 : D.settings;
2612
2617
  }
2613
2618
  ),
2614
- data: r.map((u) => (u == null ? void 0 : u.data) || [])
2619
+ data: r.map((j) => (j == null ? void 0 : j.data) || [])
2615
2620
  }
2616
2621
  ) })
2617
2622
  ]
2618
2623
  },
2619
- (f = s.customCardPreferences) == null ? void 0 : f.componentName
2624
+ (M = s.customCardPreferences) == null ? void 0 : M.componentName
2620
2625
  ) });
2621
2626
  }
2622
2627
  function Ia({
@@ -2625,11 +2630,11 @@ function Ia({
2625
2630
  className: s,
2626
2631
  ...n
2627
2632
  }) {
2628
- var y;
2633
+ var v;
2629
2634
  ge.useState(0);
2630
2635
  const a = z((p) => p.themeStyle), t = c((p) => p.card), l = c((p) => p.frame), o = z((p) => p.dashboard.filters);
2631
2636
  z((p) => p.filterValues), c((p) => p.actions.setRunSql);
2632
- const { updateFilter: r } = Ns(), d = o == null ? void 0 : o.find((p) => p.id === l.filterId), i = c((p) => p.actions.setCard);
2637
+ const { updateFilter: i } = Cs(), d = o == null ? void 0 : o.find((p) => p.id === l.filterId), r = c((p) => p.actions.setCard);
2633
2638
  if (Y(() => {
2634
2639
  }, [
2635
2640
  t.data,
@@ -2648,7 +2653,7 @@ function Ia({
2648
2653
  customCfg: t.customCfg,
2649
2654
  preferences: t.preferences
2650
2655
  }));
2651
- function h(p) {
2656
+ function u(p) {
2652
2657
  return /* @__PURE__ */ e.jsx(hl, { card: p });
2653
2658
  }
2654
2659
  return /* @__PURE__ */ e.jsxs(
@@ -2664,7 +2669,7 @@ function Ia({
2664
2669
  Xe,
2665
2670
  {
2666
2671
  text: t.title,
2667
- onSave: (p) => i({ ...t, title: p }),
2672
+ onSave: (p) => r({ ...t, title: p }),
2668
2673
  children: /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ e.jsx(zt, { className: "text-base", children: t.title }) })
2669
2674
  },
2670
2675
  t.title
@@ -2673,7 +2678,7 @@ function Ia({
2673
2678
  Xe,
2674
2679
  {
2675
2680
  text: t.description || "",
2676
- onSave: (p) => i({ ...t, description: p }),
2681
+ onSave: (p) => r({ ...t, description: p }),
2677
2682
  children: /* @__PURE__ */ e.jsxs(Ft, { children: [
2678
2683
  " ",
2679
2684
  t.description
@@ -2688,22 +2693,22 @@ function Ia({
2688
2693
  {
2689
2694
  className: "my-1",
2690
2695
  text: d.title || d.column,
2691
- onSave: (p) => r({ ...d, title: p }),
2696
+ onSave: (p) => i({ ...d, title: p }),
2692
2697
  children: /* @__PURE__ */ e.jsx(H, { children: d.title })
2693
2698
  }
2694
2699
  ),
2695
- Lt(d)
2700
+ Tt(d)
2696
2701
  ] })
2697
2702
  ] }),
2698
- /* @__PURE__ */ e.jsxs(Tt, { className: "flex grow flex-col", children: [
2699
- t.type === "custom" && h(t),
2703
+ /* @__PURE__ */ e.jsxs(Lt, { className: "flex grow flex-col", children: [
2704
+ t.type === "custom" && u(t),
2700
2705
  !["table", "custom"].includes(t.type) && x && // <ChartJsVisual key={visualKey} cfg={cfg} />
2701
2706
  /* @__PURE__ */ e.jsx(
2702
2707
  It,
2703
2708
  {
2704
2709
  cfg: x
2705
2710
  },
2706
- JSON.stringify(x) + JSON.stringify(t.preferences) + ((y = t == null ? void 0 : t.preferences) == null ? void 0 : y.customVisualCode)
2711
+ JSON.stringify(x) + JSON.stringify(t.preferences) + ((v = t == null ? void 0 : t.preferences) == null ? void 0 : v.customVisualCode)
2707
2712
  ),
2708
2713
  t.type === "table" && t.data && t.data.length > 0 && // All of the below css classes are #IMPORTANT for the table to scroll properly
2709
2714
  /* @__PURE__ */ e.jsx(Dt, { className: "flex min-h-0 flex-1 grow basis-0", children: /* @__PURE__ */ e.jsx(Mt, { card: t, data: t == null ? void 0 : t.data }) })
@@ -2713,61 +2718,61 @@ function Ia({
2713
2718
  );
2714
2719
  }
2715
2720
  function ml() {
2716
- const [s, n] = E(!1), [a, t] = E(""), [l, o] = E(""), [r, d] = E(""), [i, x] = E(""), h = c((N) => N.card), y = c(
2717
- (N) => N.card.customCfg
2718
- ), { setCardCustomCfg: p, setCustomVisualCode: m } = we();
2719
- function f(N) {
2720
- var j, S;
2721
- const M = {
2722
- ...N,
2721
+ const [s, n] = E(!1), [a, t] = E(""), [l, o] = E(""), [i, d] = E(""), [r, x] = E(""), u = c((j) => j.card), v = c(
2722
+ (j) => j.card.customCfg
2723
+ ), { setCardCustomCfg: p, setCustomVisualCode: h } = we();
2724
+ function f(j) {
2725
+ var g, S;
2726
+ const D = {
2727
+ ...j,
2723
2728
  data: {
2724
- ...N == null ? void 0 : N.data,
2725
- datasets: (S = (j = N == null ? void 0 : N.data) == null ? void 0 : j.datasets) == null ? void 0 : S.map((v) => ({
2726
- ...v,
2729
+ ...j == null ? void 0 : j.data,
2730
+ datasets: (S = (g = j == null ? void 0 : j.data) == null ? void 0 : g.datasets) == null ? void 0 : S.map((C) => ({
2731
+ ...C,
2727
2732
  data: []
2728
2733
  }))
2729
2734
  }
2730
2735
  };
2731
- return JSON.stringify(M, null, 1);
2736
+ return JSON.stringify(D, null, 1);
2732
2737
  }
2733
- function u() {
2734
- var M, A;
2735
- if (!h.data || h.data.length === 0)
2738
+ function m() {
2739
+ var D, A;
2740
+ if (!u.data || u.data.length === 0)
2736
2741
  return;
2737
- const N = ma({
2738
- data: h.data,
2739
- cardType: h.type,
2740
- cfg: h.cfg,
2741
- preferences: h.preferences
2742
+ const j = ma({
2743
+ data: u.data,
2744
+ cardType: u.type,
2745
+ cfg: u.cfg,
2746
+ preferences: u.preferences
2742
2747
  });
2743
- N && (t(JSON.stringify(N, null, 1)), (M = h == null ? void 0 : h.preferences) != null && M.customVisualCode && d((A = h == null ? void 0 : h.preferences) == null ? void 0 : A.customVisualCode), y && o(JSON.stringify(y, null, 1)));
2748
+ j && (t(JSON.stringify(j, null, 1)), (D = u == null ? void 0 : u.preferences) != null && D.customVisualCode && d((A = u == null ? void 0 : u.preferences) == null ? void 0 : A.customVisualCode), v && o(JSON.stringify(v, null, 1)));
2744
2749
  }
2745
2750
  function k() {
2746
- if (r && m(r), !!l)
2751
+ if (i && h(i), !!l)
2747
2752
  try {
2748
- const N = JSON.parse(l);
2749
- return N ? (p(N), x(""), o(""), N) : void 0;
2750
- } catch (N) {
2751
- console.log(N), x("Invalid JSON");
2753
+ const j = JSON.parse(l);
2754
+ return j ? (p(j), x(""), o(""), j) : void 0;
2755
+ } catch (j) {
2756
+ console.log(j), x("Invalid JSON");
2752
2757
  }
2753
2758
  }
2754
2759
  function I() {
2755
2760
  o(""), p(null);
2756
2761
  }
2757
- function D() {
2758
- let N;
2759
- if (y) {
2760
- const M = Qs.cloneDeep(h.cfg), A = Qs.merge(M, y);
2761
- return N = f(A), N;
2762
+ function M() {
2763
+ let j;
2764
+ if (v) {
2765
+ const D = Qs.cloneDeep(u.cfg), A = Qs.merge(D, v);
2766
+ return j = f(A), j;
2762
2767
  }
2763
- return a ? (N = f(JSON.parse(a)), N) : "";
2768
+ return a ? (j = f(JSON.parse(a)), j) : "";
2764
2769
  }
2765
- return /* @__PURE__ */ e.jsxs(Cs, { open: s, onOpenChange: n, children: [
2770
+ return /* @__PURE__ */ e.jsxs(Ns, { open: s, onOpenChange: n, children: [
2766
2771
  /* @__PURE__ */ e.jsx(Ss, { asChild: !0, children: /* @__PURE__ */ e.jsx(
2767
2772
  F,
2768
2773
  {
2769
- onClick: u,
2770
- className: ` ${y && "border-foreground/50 dark:border-foreground/70"}`,
2774
+ onClick: m,
2775
+ className: ` ${v && "border-foreground/50 dark:border-foreground/70"}`,
2771
2776
  size: "sm",
2772
2777
  variant: "outline",
2773
2778
  children: /* @__PURE__ */ e.jsx(Ot, { className: "h-4 w-4" })
@@ -2781,12 +2786,12 @@ function ml() {
2781
2786
  /* @__PURE__ */ e.jsxs(zs, { className: "", children: [
2782
2787
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
2783
2788
  /* @__PURE__ */ e.jsx(Fs, { children: "Customize Card" }),
2784
- /* @__PURE__ */ e.jsxs(Ts, { children: [
2789
+ /* @__PURE__ */ e.jsxs(Ls, { children: [
2785
2790
  /* @__PURE__ */ e.jsx(na, { children: /* @__PURE__ */ e.jsx(
2786
2791
  wn,
2787
2792
  {
2788
2793
  onClick: () => {
2789
- navigator.clipboard.writeText(h.id);
2794
+ navigator.clipboard.writeText(u.id);
2790
2795
  },
2791
2796
  className: "size-3 cursor-pointer text-muted-foreground/70 transition-colors hover:text-muted-foreground"
2792
2797
  }
@@ -2794,7 +2799,7 @@ function ml() {
2794
2799
  /* @__PURE__ */ e.jsx(Is, { side: "right", align: "center", children: /* @__PURE__ */ e.jsx("p", { className: "text-xs", children: "Copy Card ID" }) })
2795
2800
  ] })
2796
2801
  ] }),
2797
- /* @__PURE__ */ e.jsxs(Ls, { children: [
2802
+ /* @__PURE__ */ e.jsxs(Ts, { children: [
2798
2803
  "See the configuration options and documentation",
2799
2804
  /* @__PURE__ */ e.jsx(
2800
2805
  "a",
@@ -2812,8 +2817,8 @@ function ml() {
2812
2817
  /* @__PURE__ */ e.jsxs(xa, { defaultValue: "custom-config", className: "flex w-1/2 flex-col", children: [
2813
2818
  /* @__PURE__ */ e.jsxs(pa, { className: "justify-start rounded-sm rounded-b-none border border-b-0", children: [
2814
2819
  /* @__PURE__ */ e.jsxs(Ze, { value: "custom-config", children: [
2815
- y && /* @__PURE__ */ e.jsx(fa, { className: "mr-1 h-5 w-5 text-green-600" }),
2816
- y ? "Custom Config" : "Default Config"
2820
+ v && /* @__PURE__ */ e.jsx(fa, { className: "mr-1 h-5 w-5 text-green-600" }),
2821
+ v ? "Custom Config" : "Default Config"
2817
2822
  ] }),
2818
2823
  /* @__PURE__ */ e.jsx(Ze, { className: "", value: "output", children: "Output" }),
2819
2824
  /* @__PURE__ */ e.jsx(Ze, { className: "", value: "custom-code", children: "Custom Code" })
@@ -2856,8 +2861,8 @@ function ml() {
2856
2861
  renderLineHighlight: "none"
2857
2862
  },
2858
2863
  defaultLanguage: "json",
2859
- value: D(),
2860
- onChange: (N) => o(N)
2864
+ value: M(),
2865
+ onChange: (j) => o(j)
2861
2866
  }
2862
2867
  )
2863
2868
  }
@@ -2885,8 +2890,8 @@ function ml() {
2885
2890
  renderLineHighlight: "none"
2886
2891
  },
2887
2892
  defaultLanguage: "javascript",
2888
- value: r,
2889
- onChange: (N) => d(N || "")
2893
+ value: i,
2894
+ onChange: (j) => d(j || "")
2890
2895
  }
2891
2896
  )
2892
2897
  }
@@ -2894,11 +2899,11 @@ function ml() {
2894
2899
  ] })
2895
2900
  ] }),
2896
2901
  /* @__PURE__ */ e.jsxs(aa, { className: "flex items-center", children: [
2897
- /* @__PURE__ */ e.jsx(H, { className: "mr-2 text-red-500", children: i }),
2902
+ /* @__PURE__ */ e.jsx(H, { className: "mr-2 text-red-500", children: r }),
2898
2903
  /* @__PURE__ */ e.jsx(
2899
2904
  F,
2900
2905
  {
2901
- disabled: !y,
2906
+ disabled: !v,
2902
2907
  onClick: I,
2903
2908
  variant: "outline",
2904
2909
  children: "Reset"
@@ -2953,16 +2958,16 @@ function xl({
2953
2958
  var o;
2954
2959
  if (t) {
2955
2960
  const d = (await Promise.all(
2956
- (o = t == null ? void 0 : t.plugins) == null ? void 0 : o.map(async (i) => (await Et(i.value)).visuals.map((y) => ({
2957
- name: y.name,
2958
- icon: y.icon,
2959
- url: i.value
2961
+ (o = t == null ? void 0 : t.plugins) == null ? void 0 : o.map(async (r) => (await Et(r.value)).visuals.map((v) => ({
2962
+ name: v.name,
2963
+ icon: v.icon,
2964
+ url: r.value
2960
2965
  })))
2961
2966
  )).flat();
2962
2967
  a(d);
2963
2968
  }
2964
2969
  })();
2965
- }, [t]), /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2970
+ }, [t]), n.length === 0 ? null : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
2966
2971
  /* @__PURE__ */ e.jsx(Me, { className: "my-2" }),
2967
2972
  /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-4 place-items-center", children: n.map((l, o) => /* @__PURE__ */ e.jsx(
2968
2973
  pl,
@@ -2983,22 +2988,22 @@ const pl = ({
2983
2988
  const [t, l] = E(null);
2984
2989
  Y(() => {
2985
2990
  n && (async () => {
2986
- const i = (await import("./lucide-react-5Xr4kIU7.js"))[n];
2987
- l(i);
2991
+ const r = (await import("./lucide-react-5OzzAy3W.js"))[n];
2992
+ l(r);
2988
2993
  })();
2989
2994
  }, [n]);
2990
2995
  const o = s.charAt(0).toUpperCase();
2991
2996
  return /* @__PURE__ */ e.jsx(F, { onClick: a, title: s, variant: "ghost", children: t ? /* @__PURE__ */ e.jsx(t, { className: "h-4 w-4" }) : o });
2992
2997
  };
2993
2998
  function fl() {
2994
- const [s, n] = E(!1), a = c((x) => x.card.type), { setCardType: t, setCardPreferences: l, setChartOrientation: o } = c((x) => x.actions), { setCardCustomCfg: r, setCustomCardPreferences: d } = we();
2995
- function i(x, h) {
2996
- r(null), l({}), t(x), h && d({
2999
+ const [s, n] = E(!1), a = c((x) => x.card.type), { setCardType: t, setCardPreferences: l, setChartOrientation: o } = c((x) => x.actions), { setCardCustomCfg: i, setCustomCardPreferences: d } = we();
3000
+ function r(x, u) {
3001
+ i(null), l({}), t(x), u && d({
2997
3002
  type: "component",
2998
3003
  visualType: "single",
2999
- url: h.url,
3000
- componentName: h.name,
3001
- icon: h.icon
3004
+ url: u.url,
3005
+ componentName: u.name,
3006
+ icon: u.icon
3002
3007
  }), n(!1);
3003
3008
  }
3004
3009
  return /* @__PURE__ */ e.jsxs(is, { open: s, onOpenChange: n, children: [
@@ -3008,7 +3013,7 @@ function fl() {
3008
3013
  /* @__PURE__ */ e.jsx(
3009
3014
  F,
3010
3015
  {
3011
- onClick: () => i("bar"),
3016
+ onClick: () => r("bar"),
3012
3017
  className: "font-normal",
3013
3018
  variant: "ghost",
3014
3019
  children: /* @__PURE__ */ e.jsx(qs, { className: "size-5" })
@@ -3017,7 +3022,7 @@ function fl() {
3017
3022
  /* @__PURE__ */ e.jsx(
3018
3023
  F,
3019
3024
  {
3020
- onClick: () => i("line"),
3025
+ onClick: () => r("line"),
3021
3026
  variant: "ghost",
3022
3027
  children: /* @__PURE__ */ e.jsx(Rs, { className: "size-5" })
3023
3028
  }
@@ -3025,7 +3030,7 @@ function fl() {
3025
3030
  /* @__PURE__ */ e.jsx(
3026
3031
  F,
3027
3032
  {
3028
- onClick: () => i("stackedBar"),
3033
+ onClick: () => r("stackedBar"),
3029
3034
  variant: "ghost",
3030
3035
  children: /* @__PURE__ */ e.jsx(Va, { className: "size-5", strokeWidth: 0 })
3031
3036
  }
@@ -3033,7 +3038,7 @@ function fl() {
3033
3038
  /* @__PURE__ */ e.jsx(
3034
3039
  F,
3035
3040
  {
3036
- onClick: () => i("stackedLine"),
3041
+ onClick: () => r("stackedLine"),
3037
3042
  variant: "ghost",
3038
3043
  children: /* @__PURE__ */ e.jsx(Ea, { className: "size-5", strokeWidth: 0 })
3039
3044
  }
@@ -3041,15 +3046,15 @@ function fl() {
3041
3046
  /* @__PURE__ */ e.jsx(
3042
3047
  F,
3043
3048
  {
3044
- onClick: () => i("scatter"),
3049
+ onClick: () => r("scatter"),
3045
3050
  variant: "ghost",
3046
- children: /* @__PURE__ */ e.jsx(Ca, { className: "size-5" })
3051
+ children: /* @__PURE__ */ e.jsx(Na, { className: "size-5" })
3047
3052
  }
3048
3053
  ),
3049
3054
  /* @__PURE__ */ e.jsx(
3050
3055
  F,
3051
3056
  {
3052
- onClick: () => i("bubble"),
3057
+ onClick: () => r("bubble"),
3053
3058
  variant: "ghost",
3054
3059
  children: /* @__PURE__ */ e.jsx(Aa, { className: "size-4" })
3055
3060
  }
@@ -3057,15 +3062,15 @@ function fl() {
3057
3062
  /* @__PURE__ */ e.jsx(
3058
3063
  F,
3059
3064
  {
3060
- onClick: () => i("pie"),
3065
+ onClick: () => r("pie"),
3061
3066
  variant: "ghost",
3062
- children: /* @__PURE__ */ e.jsx(Na, { className: "size-5" })
3067
+ children: /* @__PURE__ */ e.jsx(Ca, { className: "size-5" })
3063
3068
  }
3064
3069
  ),
3065
3070
  /* @__PURE__ */ e.jsx(
3066
3071
  F,
3067
3072
  {
3068
- onClick: () => i("doughnut"),
3073
+ onClick: () => r("doughnut"),
3069
3074
  variant: "ghost",
3070
3075
  children: /* @__PURE__ */ e.jsx(Ma, { className: "size-5", strokeWidth: 1 })
3071
3076
  }
@@ -3073,7 +3078,7 @@ function fl() {
3073
3078
  /* @__PURE__ */ e.jsx(
3074
3079
  F,
3075
3080
  {
3076
- onClick: () => i("radar"),
3081
+ onClick: () => r("radar"),
3077
3082
  variant: "ghost",
3078
3083
  children: /* @__PURE__ */ e.jsx(
3079
3084
  Da,
@@ -3087,7 +3092,7 @@ function fl() {
3087
3092
  /* @__PURE__ */ e.jsx(
3088
3093
  F,
3089
3094
  {
3090
- onClick: () => i("polarArea"),
3095
+ onClick: () => r("polarArea"),
3091
3096
  variant: "ghost",
3092
3097
  children: /* @__PURE__ */ e.jsx(Oa, { className: "size-5" })
3093
3098
  }
@@ -3095,7 +3100,7 @@ function fl() {
3095
3100
  /* @__PURE__ */ e.jsx(
3096
3101
  F,
3097
3102
  {
3098
- onClick: () => i("pyramid"),
3103
+ onClick: () => r("pyramid"),
3099
3104
  variant: "ghost",
3100
3105
  children: /* @__PURE__ */ e.jsx(Ra, { className: "size-5" })
3101
3106
  }
@@ -3103,7 +3108,7 @@ function fl() {
3103
3108
  /* @__PURE__ */ e.jsx(
3104
3109
  F,
3105
3110
  {
3106
- onClick: () => i("range"),
3111
+ onClick: () => r("range"),
3107
3112
  variant: "ghost",
3108
3113
  children: /* @__PURE__ */ e.jsx(va, { className: "size-5" })
3109
3114
  }
@@ -3111,7 +3116,7 @@ function fl() {
3111
3116
  /* @__PURE__ */ e.jsx(
3112
3117
  F,
3113
3118
  {
3114
- onClick: () => i("table"),
3119
+ onClick: () => r("table"),
3115
3120
  variant: "ghost",
3116
3121
  children: /* @__PURE__ */ e.jsx(Ds, { className: "size-5" })
3117
3122
  }
@@ -3119,7 +3124,7 @@ function fl() {
3119
3124
  /* @__PURE__ */ e.jsx(
3120
3125
  F,
3121
3126
  {
3122
- onClick: () => i("kpi"),
3127
+ onClick: () => r("kpi"),
3123
3128
  variant: "ghost",
3124
3129
  children: /* @__PURE__ */ e.jsx(qa, { className: "size-6" })
3125
3130
  }
@@ -3127,7 +3132,7 @@ function fl() {
3127
3132
  /* @__PURE__ */ e.jsx(
3128
3133
  F,
3129
3134
  {
3130
- onClick: () => i("text"),
3135
+ onClick: () => r("text"),
3131
3136
  variant: "ghost",
3132
3137
  children: /* @__PURE__ */ e.jsx(_s, { className: "size-4" })
3133
3138
  }
@@ -3135,13 +3140,13 @@ function fl() {
3135
3140
  /* @__PURE__ */ e.jsx(
3136
3141
  F,
3137
3142
  {
3138
- onClick: () => i("custom"),
3143
+ onClick: () => r("custom"),
3139
3144
  variant: "ghost",
3140
3145
  children: /* @__PURE__ */ e.jsx(wa, { className: "size-4" })
3141
3146
  }
3142
3147
  )
3143
3148
  ] }),
3144
- /* @__PURE__ */ e.jsx(xl, { onChartTypeChange: i })
3149
+ /* @__PURE__ */ e.jsx(xl, { onChartTypeChange: r })
3145
3150
  ] })
3146
3151
  ] });
3147
3152
  }
@@ -3152,11 +3157,11 @@ function gl({ chartType: s, className: n }) {
3152
3157
  case "line":
3153
3158
  return /* @__PURE__ */ e.jsx(Rs, { className: n });
3154
3159
  case "pie":
3155
- return /* @__PURE__ */ e.jsx(Na, { className: n });
3160
+ return /* @__PURE__ */ e.jsx(Ca, { className: n });
3156
3161
  case "radar":
3157
3162
  return /* @__PURE__ */ e.jsx(Da, { className: n });
3158
3163
  case "scatter":
3159
- return /* @__PURE__ */ e.jsx(Ca, { className: n });
3164
+ return /* @__PURE__ */ e.jsx(Na, { className: n });
3160
3165
  case "bubble":
3161
3166
  return /* @__PURE__ */ e.jsx(Aa, { className: n });
3162
3167
  case "doughnut":
@@ -3182,13 +3187,13 @@ function gl({ chartType: s, className: n }) {
3182
3187
  }
3183
3188
  }
3184
3189
  function ea() {
3185
- const s = c((j) => j.frame), n = c((j) => j.card), a = c((j) => j.card.data), t = c((j) => j.isShowingVisual), l = c((j) => j.isSqlRunning), o = c((j) => j.queryError), r = c((j) => j.pythonStdOut), d = c((j) => j.actions.setRunSql);
3186
- c((j) => j.onSave), c((j) => j.onClose), c((j) => j.actions.setCardSql), c((j) => j.actions.setCardType), c((j) => j.actions.setSqlGen);
3187
- const { setFrame: i, setCard: x, updateCardInFrame: h } = we();
3190
+ const s = c((g) => g.frame), n = c((g) => g.card), a = c((g) => g.card.data), t = c((g) => g.isShowingVisual), l = c((g) => g.isSqlRunning), o = c((g) => g.queryError), i = c((g) => g.pythonStdOut), d = c((g) => g.actions.setRunSql);
3191
+ c((g) => g.onSave), c((g) => g.onClose), c((g) => g.actions.setCardSql), c((g) => g.actions.setCardType), c((g) => g.actions.setSqlGen);
3192
+ const { setFrame: r, setCard: x, updateCardInFrame: u } = we();
3188
3193
  if (!n)
3189
3194
  return /* @__PURE__ */ e.jsx(e.Fragment, { children: "No Active Card" });
3190
- function y() {
3191
- const j = {
3195
+ function v() {
3196
+ const g = {
3192
3197
  id: $e(),
3193
3198
  title: "Title",
3194
3199
  description: "Description",
@@ -3204,118 +3209,118 @@ function ea() {
3204
3209
  sql: "",
3205
3210
  data: []
3206
3211
  };
3207
- p(j);
3212
+ p(g);
3208
3213
  }
3209
- function p(j) {
3214
+ function p(g) {
3210
3215
  const S = {
3211
3216
  ...s,
3212
- cards: [...s.cards, j],
3213
- activeCardId: j.id
3217
+ cards: [...s.cards, g],
3218
+ activeCardId: g.id
3214
3219
  };
3215
- i(S), x(j);
3220
+ r(S), x(g);
3216
3221
  }
3217
- function m() {
3218
- const j = {
3222
+ function h() {
3223
+ const g = {
3219
3224
  ...n,
3220
3225
  id: $e(),
3221
3226
  title: `${n.title} Copy`,
3222
3227
  tabTitle: `${n.tabTitle} Copy`
3223
3228
  };
3224
- p(j);
3229
+ p(g);
3225
3230
  }
3226
- function f(j) {
3227
- const S = s.cards.filter((q) => q.id !== j), v = S[0], b = {
3231
+ function f(g) {
3232
+ const S = s.cards.filter((q) => q.id !== g), C = S[0], y = {
3228
3233
  ...s,
3229
3234
  cards: S,
3230
3235
  // update the active card to the first card in the frame
3231
- activeCardId: v.id
3236
+ activeCardId: C.id
3232
3237
  };
3233
- i(b), x(v);
3238
+ r(y), x(C);
3234
3239
  }
3235
- function u(j) {
3240
+ function m(g) {
3236
3241
  const S = {
3237
3242
  ...s,
3238
- cards: s.cards.map((b) => b.id === n.id ? n : b),
3239
- activeCardId: j
3243
+ cards: s.cards.map((y) => y.id === n.id ? n : y),
3244
+ activeCardId: g
3240
3245
  };
3241
- i(S);
3242
- const v = S.cards.find((b) => b.id === j);
3243
- x(v), v.sql && v.data && v.data.length === 0 && d(!0);
3246
+ r(S);
3247
+ const C = S.cards.find((y) => y.id === g);
3248
+ x(C), C.sql && C.data && C.data.length === 0 && d(!0);
3244
3249
  }
3245
- const k = (j, S) => {
3246
- console.log("handleDragStart", S), j.dataTransfer.setData("tabIndex", S.toString());
3247
- }, I = (j) => {
3248
- j.preventDefault();
3249
- }, D = (j, S) => {
3250
- const v = j.dataTransfer.getData("tabIndex");
3251
- if (v === S.toString())
3250
+ const k = (g, S) => {
3251
+ console.log("handleDragStart", S), g.dataTransfer.setData("tabIndex", S.toString());
3252
+ }, I = (g) => {
3253
+ g.preventDefault();
3254
+ }, M = (g, S) => {
3255
+ const C = g.dataTransfer.getData("tabIndex");
3256
+ if (C === S.toString())
3252
3257
  return;
3253
- const b = Array.from(s.cards), [q] = b.splice(parseInt(v), 1);
3254
- b.splice(S, 0, q), i({ ...s, cards: b });
3258
+ const y = Array.from(s.cards), [q] = y.splice(parseInt(C), 1);
3259
+ y.splice(S, 0, q), r({ ...s, cards: y });
3255
3260
  };
3256
- function N(j, S) {
3257
- return j.cards.length === 1 && (S.displayTab === !0 || S.displayTab === void 0) || j.activeCardId !== S.id && (S.displayTab === !0 || S.displayTab === void 0) ? null : /* @__PURE__ */ e.jsx(
3261
+ function j(g, S) {
3262
+ return g.cards.length === 1 && (S.displayTab === !0 || S.displayTab === void 0) || g.activeCardId !== S.id && (S.displayTab === !0 || S.displayTab === void 0) ? null : /* @__PURE__ */ e.jsx(
3258
3263
  "div",
3259
3264
  {
3260
3265
  onClick: () => {
3261
- const v = S.displayTab === void 0 ? !1 : !S.displayTab;
3262
- x({ ...S, displayTab: v }), h({
3266
+ const C = S.displayTab === void 0 ? !1 : !S.displayTab;
3267
+ x({ ...S, displayTab: C }), u({
3263
3268
  ...S,
3264
- displayTab: v
3269
+ displayTab: C
3265
3270
  });
3266
3271
  },
3267
3272
  children: S.displayTab === !0 || S.displayTab === void 0 ? /* @__PURE__ */ e.jsx(yn, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" }) : /* @__PURE__ */ e.jsx(bn, { className: "mr-2 size-3.5 text-muted-foreground hover:text-foreground" })
3268
3273
  }
3269
3274
  );
3270
3275
  }
3271
- function M() {
3276
+ function D() {
3272
3277
  return /* @__PURE__ */ e.jsxs(
3273
3278
  xa,
3274
3279
  {
3275
- onValueChange: u,
3280
+ onValueChange: m,
3276
3281
  value: s.activeCardId,
3277
3282
  className: "flex grow flex-col",
3278
3283
  children: [
3279
- s.cards.map((j) => /* @__PURE__ */ e.jsx(es, { className: "mt-0 grow", value: j.id, children: A() }, j.id)),
3284
+ s.cards.map((g) => /* @__PURE__ */ e.jsx(es, { className: "mt-0 grow", value: g.id, children: A() }, g.id)),
3280
3285
  /* @__PURE__ */ e.jsx(pa, { className: "group mx-6 justify-between", children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center", children: [
3281
- s.cards.map((j, S) => /* @__PURE__ */ e.jsx(
3286
+ s.cards.map((g, S) => /* @__PURE__ */ e.jsx(
3282
3287
  Xe,
3283
3288
  {
3284
- text: j.tabTitle || j.title,
3285
- onSave: (v) => {
3286
- x({ ...n, tabTitle: v }), h({ ...n, tabTitle: v });
3289
+ text: g.tabTitle || g.title,
3290
+ onSave: (C) => {
3291
+ x({ ...n, tabTitle: C }), u({ ...n, tabTitle: C });
3287
3292
  },
3288
3293
  children: /* @__PURE__ */ e.jsxs(
3289
3294
  Ze,
3290
3295
  {
3291
3296
  draggable: !0,
3292
- onDragStart: (v) => k(v, S),
3297
+ onDragStart: (C) => k(C, S),
3293
3298
  onDragOver: I,
3294
- onDrop: (v) => D(v, S),
3299
+ onDrop: (C) => M(C, S),
3295
3300
  className: "",
3296
- value: j.id,
3301
+ value: g.id,
3297
3302
  children: [
3298
- N(s, j),
3299
- j.tabTitle || j.title,
3300
- s.activeCardId === j.id && s.cards.length > 1 && /* @__PURE__ */ e.jsx(
3303
+ j(s, g),
3304
+ g.tabTitle || g.title,
3305
+ s.activeCardId === g.id && s.cards.length > 1 && /* @__PURE__ */ e.jsx(
3301
3306
  ga,
3302
3307
  {
3303
3308
  className: "ml-2 size-3.5 text-muted-foreground hover:text-foreground",
3304
- onClick: () => f(j.id)
3309
+ onClick: () => f(g.id)
3305
3310
  }
3306
3311
  )
3307
3312
  ]
3308
3313
  }
3309
3314
  )
3310
3315
  },
3311
- j.id
3316
+ g.id
3312
3317
  )),
3313
3318
  /* @__PURE__ */ e.jsx(
3314
3319
  F,
3315
3320
  {
3316
3321
  className: "ml-1 h-8 px-2 hover:bg-muted-foreground/50",
3317
3322
  variant: "outline",
3318
- onClick: y,
3323
+ onClick: v,
3319
3324
  children: /* @__PURE__ */ e.jsx(ws, { className: "h-4 w-4" })
3320
3325
  }
3321
3326
  ),
@@ -3324,7 +3329,7 @@ function ea() {
3324
3329
  {
3325
3330
  className: "invisible ml-1 h-8 px-2 hover:bg-muted-foreground/50 group-hover:visible",
3326
3331
  variant: "outline",
3327
- onClick: m,
3332
+ onClick: h,
3328
3333
  children: /* @__PURE__ */ e.jsx(pn, { className: "h-4 w-4" })
3329
3334
  }
3330
3335
  )
@@ -3345,8 +3350,8 @@ function ea() {
3345
3350
  ] }),
3346
3351
  /* @__PURE__ */ e.jsx(bl, {})
3347
3352
  ] }),
3348
- t ? M() : /* @__PURE__ */ e.jsxs("div", { className: "flex min-h-0 w-full flex-1 grow basis-0 px-6", children: [
3349
- r && /* @__PURE__ */ e.jsx(jl, {}),
3353
+ t ? D() : /* @__PURE__ */ e.jsxs("div", { className: "flex min-h-0 w-full flex-1 grow basis-0 px-6", children: [
3354
+ i && /* @__PURE__ */ e.jsx(jl, {}),
3350
3355
  n.data && n.data.length > 0 && /* @__PURE__ */ e.jsx(ul, { data: a || [] }),
3351
3356
  o && /* @__PURE__ */ e.jsx("span", { className: "font-mono text-sm", children: o })
3352
3357
  ] })
@@ -3399,7 +3404,7 @@ function yl({
3399
3404
  className: "flex gap-4",
3400
3405
  defaultValue: s[0].value,
3401
3406
  children: s.map((t) => /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3402
- /* @__PURE__ */ e.jsx(Le, { value: t.value, id: t.value }),
3407
+ /* @__PURE__ */ e.jsx(Te, { value: t.value, id: t.value }),
3403
3408
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: t.value, children: t.label })
3404
3409
  ] }, t.value))
3405
3410
  }
@@ -3429,111 +3434,111 @@ function Re({
3429
3434
  function vl() {
3430
3435
  var f;
3431
3436
  const s = c(
3432
- (u) => u.card.customCardPreferences
3437
+ (m) => m.card.customCardPreferences
3433
3438
  ), { data: n } = _a(), a = (n == null ? void 0 : n.plugins) || [];
3434
- c((u) => u.card);
3435
- const t = c((u) => u.frame), l = (s == null ? void 0 : s.visualType) || "single", { setCustomCardPreferences: o } = we(), { components: r, manifest: d } = ha(
3439
+ c((m) => m.card);
3440
+ const t = c((m) => m.frame), l = (s == null ? void 0 : s.visualType) || "single", { setCustomCardPreferences: o } = we(), { components: i, manifest: d } = ha(
3436
3441
  (s == null ? void 0 : s.url) || ""
3437
- ), i = (f = d == null ? void 0 : d.visuals) == null ? void 0 : f.find(
3438
- (u) => u.name === (s == null ? void 0 : s.componentName)
3442
+ ), r = (f = d == null ? void 0 : d.visuals) == null ? void 0 : f.find(
3443
+ (m) => m.name === (s == null ? void 0 : s.componentName)
3439
3444
  );
3440
- function x(u, k) {
3445
+ function x(m, k) {
3441
3446
  if (!s)
3442
3447
  return;
3443
- const D = {
3448
+ const M = {
3444
3449
  ...(s == null ? void 0 : s.dataInputCardIds) || {},
3445
- [u]: {
3450
+ [m]: {
3446
3451
  cardId: k,
3447
3452
  hookRef: null
3448
3453
  }
3449
3454
  };
3450
3455
  o({
3451
3456
  ...s,
3452
- dataInputCardIds: D
3457
+ dataInputCardIds: M
3453
3458
  });
3454
3459
  }
3455
- function h(u) {
3456
- var I, D;
3457
- const k = (I = t == null ? void 0 : t.cards) == null ? void 0 : I.filter((N) => {
3458
- var M;
3459
- return ((M = N == null ? void 0 : N.customCardPreferences) == null ? void 0 : M.visualType) !== "multiple";
3460
- }).map((N) => ({
3461
- value: N.id,
3462
- label: N.tabTitle || N.title
3460
+ function u(m) {
3461
+ var I, M;
3462
+ const k = (I = t == null ? void 0 : t.cards) == null ? void 0 : I.filter((j) => {
3463
+ var D;
3464
+ return ((D = j == null ? void 0 : j.customCardPreferences) == null ? void 0 : D.visualType) !== "multiple";
3465
+ }).map((j) => ({
3466
+ value: j.id,
3467
+ label: j.tabTitle || j.title
3463
3468
  }));
3464
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: (D = u == null ? void 0 : u.dataInputs) == null ? void 0 : D.map((N, M) => {
3465
- var A, j;
3469
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-2", children: (M = m == null ? void 0 : m.dataInputs) == null ? void 0 : M.map((j, D) => {
3470
+ var A, g;
3466
3471
  return /* @__PURE__ */ e.jsxs(
3467
3472
  "div",
3468
3473
  {
3469
3474
  className: "grid grid-cols-10 gap-2",
3470
3475
  children: [
3471
- /* @__PURE__ */ e.jsx("div", { className: "col-span-4 flex items-center", children: N }),
3476
+ /* @__PURE__ */ e.jsx("div", { className: "col-span-4 flex items-center", children: j }),
3472
3477
  /* @__PURE__ */ e.jsx(
3473
3478
  Re,
3474
3479
  {
3475
3480
  className: "col-span-6 h-8 w-full justify-between",
3476
3481
  label: "",
3477
3482
  options: k || [],
3478
- value: ((j = (A = s == null ? void 0 : s.dataInputCardIds) == null ? void 0 : A[M]) == null ? void 0 : j.cardId) || "",
3479
- onValueChange: (S) => x(M, S)
3483
+ value: ((g = (A = s == null ? void 0 : s.dataInputCardIds) == null ? void 0 : A[D]) == null ? void 0 : g.cardId) || "",
3484
+ onValueChange: (S) => x(D, S)
3480
3485
  }
3481
3486
  )
3482
3487
  ]
3483
3488
  },
3484
- M + Math.random()
3489
+ D + Math.random()
3485
3490
  );
3486
3491
  }) });
3487
3492
  }
3488
- function y(u, k, I = []) {
3489
- var D, N;
3490
- return s ? u === "input" ? /* @__PURE__ */ e.jsx(
3491
- Ce,
3493
+ function v(m, k, I = []) {
3494
+ var M, j;
3495
+ return s ? m === "input" ? /* @__PURE__ */ e.jsx(
3496
+ Ne,
3492
3497
  {
3493
3498
  className: `h-8 w-full ${_t}`,
3494
- value: ((D = s == null ? void 0 : s.settings) == null ? void 0 : D[k]) || "",
3495
- onChange: (M) => {
3499
+ value: ((M = s == null ? void 0 : s.settings) == null ? void 0 : M[k]) || "",
3500
+ onChange: (D) => {
3496
3501
  o({
3497
3502
  ...s,
3498
3503
  settings: {
3499
3504
  ...s == null ? void 0 : s.settings,
3500
- [k]: M.target.value
3505
+ [k]: D.target.value
3501
3506
  }
3502
3507
  });
3503
3508
  }
3504
3509
  },
3505
3510
  k
3506
- ) : u === "select" ? /* @__PURE__ */ e.jsx(
3511
+ ) : m === "select" ? /* @__PURE__ */ e.jsx(
3507
3512
  Re,
3508
3513
  {
3509
3514
  className: "h-8 w-full",
3510
3515
  label: "",
3511
3516
  options: I,
3512
- value: ((N = s == null ? void 0 : s.settings) == null ? void 0 : N[k]) || "",
3513
- onValueChange: (M) => {
3517
+ value: ((j = s == null ? void 0 : s.settings) == null ? void 0 : j[k]) || "",
3518
+ onValueChange: (D) => {
3514
3519
  o({
3515
3520
  ...s,
3516
- settings: { ...s == null ? void 0 : s.settings, [k]: M }
3521
+ settings: { ...s == null ? void 0 : s.settings, [k]: D }
3517
3522
  });
3518
3523
  }
3519
3524
  }
3520
3525
  ) : null : null;
3521
3526
  }
3522
- function p(u) {
3523
- const k = Object.entries((u == null ? void 0 : u.settings) || {});
3524
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: k.map(([I, D]) => /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3525
- /* @__PURE__ */ e.jsx(H, { children: D.title }),
3526
- y(
3527
- D.ui,
3527
+ function p(m) {
3528
+ const k = Object.entries((m == null ? void 0 : m.settings) || {});
3529
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-3", children: k.map(([I, M]) => /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3530
+ /* @__PURE__ */ e.jsx(H, { children: M.title }),
3531
+ v(
3532
+ M.ui,
3528
3533
  I,
3529
- D.options
3534
+ M.options
3530
3535
  )
3531
3536
  ] }, I)) });
3532
3537
  }
3533
- function m(u) {
3538
+ function h(m) {
3534
3539
  s && o({
3535
3540
  ...s,
3536
- visualType: u,
3541
+ visualType: m,
3537
3542
  componentName: ""
3538
3543
  });
3539
3544
  }
@@ -3547,12 +3552,12 @@ function vl() {
3547
3552
  label: "",
3548
3553
  options: a,
3549
3554
  value: (s == null ? void 0 : s.url) || "",
3550
- onValueChange: (u) => o({
3555
+ onValueChange: (m) => o({
3551
3556
  ...s || {
3552
3557
  url: "",
3553
3558
  componentName: ""
3554
3559
  },
3555
- url: u
3560
+ url: m
3556
3561
  })
3557
3562
  }
3558
3563
  ) })
@@ -3565,38 +3570,38 @@ function vl() {
3565
3570
  { value: "multiple", label: "Multi-Visual" }
3566
3571
  ],
3567
3572
  value: l,
3568
- onValueChange: m
3573
+ onValueChange: h
3569
3574
  }
3570
3575
  ),
3571
3576
  ((s == null ? void 0 : s.type) === "component" || (s == null ? void 0 : s.type) === void 0) && s && /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3572
3577
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3573
3578
  /* @__PURE__ */ e.jsx(H, { children: "Component" }),
3574
- /* @__PURE__ */ e.jsx("div", { className: "space-y-2 px-2", children: r && /* @__PURE__ */ e.jsx(
3579
+ /* @__PURE__ */ e.jsx("div", { className: "space-y-2 px-2", children: i && /* @__PURE__ */ e.jsx(
3575
3580
  Re,
3576
3581
  {
3577
3582
  className: "h-8 w-full",
3578
3583
  label: "",
3579
- options: (r == null ? void 0 : r.filter((u) => u.type === l).map((u) => ({
3580
- value: u.name,
3581
- label: u.name
3584
+ options: (i == null ? void 0 : i.filter((m) => m.type === l).map((m) => ({
3585
+ value: m.name,
3586
+ label: m.name
3582
3587
  }))) || [],
3583
3588
  value: s.componentName,
3584
- onValueChange: (u) => {
3585
- console.log("changing value", u), o({
3589
+ onValueChange: (m) => {
3590
+ console.log("changing value", m), o({
3586
3591
  ...s,
3587
- componentName: u
3592
+ componentName: m
3588
3593
  });
3589
3594
  }
3590
3595
  }
3591
3596
  ) })
3592
3597
  ] }),
3593
- i && i.dataInputs && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3598
+ r && r.dataInputs && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3594
3599
  /* @__PURE__ */ e.jsx(H, { children: "Input Mapping" }),
3595
- /* @__PURE__ */ e.jsx("div", { className: "px-2", children: h(i) })
3600
+ /* @__PURE__ */ e.jsx("div", { className: "px-2", children: u(r) })
3596
3601
  ] }),
3597
- i && i.settings && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3602
+ r && r.settings && /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
3598
3603
  /* @__PURE__ */ e.jsx(H, { children: "Settings" }),
3599
- /* @__PURE__ */ e.jsx("div", { className: "px-2", children: p(i) })
3604
+ /* @__PURE__ */ e.jsx("div", { className: "px-2", children: p(r) })
3600
3605
  ] })
3601
3606
  ] })
3602
3607
  ] });
@@ -3604,27 +3609,27 @@ function vl() {
3604
3609
  function Ae() {
3605
3610
  const [s, n] = E([]);
3606
3611
  c(
3607
- (h) => h.card.cfg
3612
+ (u) => u.card.cfg
3608
3613
  );
3609
- const a = c((h) => h.card.preferences), { setCardCfg: t, setFilterOnClickColumnIndex: l, setCardPreferences: o } = c((h) => h.actions), r = c(
3610
- (h) => h.queryResultColumns
3614
+ const a = c((u) => u.card.preferences), { setCardCfg: t, setFilterOnClickColumnIndex: l, setCardPreferences: o } = c((u) => u.actions), i = c(
3615
+ (u) => u.queryResultColumns
3611
3616
  );
3612
3617
  c(
3613
- (h) => {
3614
- var y;
3615
- return (y = h.card.preferences) == null ? void 0 : y.filterOnClickColumnIndex;
3618
+ (u) => {
3619
+ var v;
3620
+ return (v = u.card.preferences) == null ? void 0 : v.filterOnClickColumnIndex;
3616
3621
  }
3617
3622
  ), Y(() => {
3618
- r && n(new Array(r.length).fill(!1));
3619
- }, [r]);
3620
- function d(h, y) {
3621
- var p, m;
3622
- y ? a != null && a.onClickFilter && ((p = a == null ? void 0 : a.onClickFilter) == null ? void 0 : p.length) > 0 ? o({
3623
+ i && n(new Array(i.length).fill(!1));
3624
+ }, [i]);
3625
+ function d(u, v) {
3626
+ var p, h;
3627
+ v ? a != null && a.onClickFilter && ((p = a == null ? void 0 : a.onClickFilter) == null ? void 0 : p.length) > 0 ? o({
3623
3628
  ...a,
3624
3629
  onClickFilter: [
3625
3630
  ...a.onClickFilter,
3626
3631
  {
3627
- columnIndex: h,
3632
+ columnIndex: u,
3628
3633
  expression: ""
3629
3634
  }
3630
3635
  ]
@@ -3632,39 +3637,39 @@ function Ae() {
3632
3637
  ...a,
3633
3638
  onClickFilter: [
3634
3639
  {
3635
- columnIndex: h,
3640
+ columnIndex: u,
3636
3641
  expression: ""
3637
3642
  }
3638
3643
  ]
3639
3644
  }) : (o({
3640
3645
  ...a,
3641
- onClickFilter: (m = a == null ? void 0 : a.onClickFilter) == null ? void 0 : m.filter(
3642
- (f) => f.columnIndex !== h
3646
+ onClickFilter: (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.filter(
3647
+ (f) => f.columnIndex !== u
3643
3648
  )
3644
3649
  }), n((f) => {
3645
- const u = [...f];
3646
- return u[h] = !1, u;
3650
+ const m = [...f];
3651
+ return m[u] = !1, m;
3647
3652
  }));
3648
3653
  }
3649
- function i(h, y) {
3650
- var m;
3651
- const p = (m = a == null ? void 0 : a.onClickFilter) == null ? void 0 : m.map((f) => f.columnIndex === h ? {
3654
+ function r(u, v) {
3655
+ var h;
3656
+ const p = (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.map((f) => f.columnIndex === u ? {
3652
3657
  ...f,
3653
- expression: y.target.value
3658
+ expression: v.target.value
3654
3659
  } : f);
3655
3660
  o({
3656
3661
  ...a,
3657
3662
  onClickFilter: p
3658
3663
  });
3659
3664
  }
3660
- function x(h) {
3661
- var y, p, m, f;
3662
- if (s != null && s[h] || (p = (y = a == null ? void 0 : a.onClickFilter) == null ? void 0 : y.find((u) => u.columnIndex === h)) != null && p.expression)
3665
+ function x(u) {
3666
+ var v, p, h, f;
3667
+ if (s != null && s[u] || (p = (v = a == null ? void 0 : a.onClickFilter) == null ? void 0 : v.find((m) => m.columnIndex === u)) != null && p.expression)
3663
3668
  return /* @__PURE__ */ e.jsx(
3664
- Ce,
3669
+ Ne,
3665
3670
  {
3666
- value: (f = (m = a == null ? void 0 : a.onClickFilter) == null ? void 0 : m.find((u) => u.columnIndex === h)) == null ? void 0 : f.expression,
3667
- onChange: (u) => i(h, u),
3671
+ value: (f = (h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.find((m) => m.columnIndex === u)) == null ? void 0 : f.expression,
3672
+ onChange: (m) => r(u, m),
3668
3673
  type: "text",
3669
3674
  className: "h-9 w-full font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
3670
3675
  placeholder: "Expression"
@@ -3673,8 +3678,8 @@ function Ae() {
3673
3678
  }
3674
3679
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
3675
3680
  /* @__PURE__ */ e.jsx(H, { children: "On Click" }),
3676
- r == null ? void 0 : r.map((h, y) => {
3677
- var p, m;
3681
+ i == null ? void 0 : i.map((u, v) => {
3682
+ var p, h;
3678
3683
  return /* @__PURE__ */ e.jsx(
3679
3684
  "div",
3680
3685
  {
@@ -3685,64 +3690,64 @@ function Ae() {
3685
3690
  ls,
3686
3691
  {
3687
3692
  checked: !!((p = a == null ? void 0 : a.onClickFilter) != null && p.find(
3688
- (f) => f.columnIndex === y
3693
+ (f) => f.columnIndex === v
3689
3694
  )),
3690
- onCheckedChange: (f) => d(y, f)
3695
+ onCheckedChange: (f) => d(v, f)
3691
3696
  }
3692
3697
  ),
3693
3698
  /* @__PURE__ */ e.jsx(
3694
3699
  "label",
3695
3700
  {
3696
3701
  className: "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",
3697
- children: h
3702
+ children: u
3698
3703
  }
3699
3704
  ),
3700
- /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: ((m = a == null ? void 0 : a.onClickFilter) == null ? void 0 : m.find(
3701
- (f) => f.columnIndex === y
3705
+ /* @__PURE__ */ e.jsx("div", { className: "flex items-center gap-2", children: ((h = a == null ? void 0 : a.onClickFilter) == null ? void 0 : h.find(
3706
+ (f) => f.columnIndex === v
3702
3707
  )) && /* @__PURE__ */ e.jsx(
3703
3708
  Sa,
3704
3709
  {
3705
3710
  onClick: () => {
3706
3711
  n((f) => {
3707
- const u = [...f];
3708
- return u[y] = !f[y], u;
3712
+ const m = [...f];
3713
+ return m[v] = !f[v], m;
3709
3714
  });
3710
3715
  },
3711
3716
  className: "invisible size-3 cursor-pointer text-gray-400 group-hover:visible"
3712
3717
  }
3713
3718
  ) })
3714
3719
  ] }),
3715
- x(y)
3720
+ x(v)
3716
3721
  ] })
3717
3722
  },
3718
- h
3723
+ u
3719
3724
  );
3720
3725
  })
3721
3726
  ] });
3722
3727
  }
3723
3728
  function ds() {
3724
- var r, d, i;
3729
+ var i, d, r;
3725
3730
  const s = c((x) => x.card.preferences), n = c(
3726
3731
  (x) => x.card.cfg
3727
3732
  ), { setCardCfg: a, setCardPreferences: t, setChartOrientation: l } = c((x) => x.actions);
3728
- (r = n == null ? void 0 : n.options) != null && r.indexAxis;
3733
+ (i = n == null ? void 0 : n.options) != null && i.indexAxis;
3729
3734
  function o(x) {
3730
3735
  l(x);
3731
3736
  }
3732
3737
  return /* @__PURE__ */ e.jsxs(
3733
3738
  cs,
3734
3739
  {
3735
- value: ((d = s == null ? void 0 : s.chartOptions) == null ? void 0 : d.indexAxis) || ((i = n == null ? void 0 : n.options) == null ? void 0 : i.indexAxis) || "x",
3740
+ value: ((d = s == null ? void 0 : s.chartOptions) == null ? void 0 : d.indexAxis) || ((r = n == null ? void 0 : n.options) == null ? void 0 : r.indexAxis) || "x",
3736
3741
  onValueChange: o,
3737
3742
  className: "flex gap-3",
3738
3743
  defaultValue: "x",
3739
3744
  children: [
3740
3745
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3741
- /* @__PURE__ */ e.jsx(Le, { value: "x", id: "r1" }),
3746
+ /* @__PURE__ */ e.jsx(Te, { value: "x", id: "r1" }),
3742
3747
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Vertical" })
3743
3748
  ] }),
3744
3749
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3745
- /* @__PURE__ */ e.jsx(Le, { value: "y", id: "r2" }),
3750
+ /* @__PURE__ */ e.jsx(Te, { value: "y", id: "r2" }),
3746
3751
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Horizontal" })
3747
3752
  ] })
3748
3753
  ]
@@ -3757,38 +3762,38 @@ function sa(s, n) {
3757
3762
  }
3758
3763
  function Ha() {
3759
3764
  var le, K, ie, w, V, Z;
3760
- const [s, n] = E(!1), a = c((T) => {
3761
- var L;
3762
- return (L = T.card) == null ? void 0 : L.preferences;
3763
- }), t = c((T) => {
3764
- var L;
3765
- return (L = T.card) == null ? void 0 : L.cfg;
3766
- }), l = ja(a, t), [o, r] = E(
3765
+ const [s, n] = E(!1), a = c((L) => {
3766
+ var T;
3767
+ return (T = L.card) == null ? void 0 : T.preferences;
3768
+ }), t = c((L) => {
3769
+ var T;
3770
+ return (T = L.card) == null ? void 0 : T.cfg;
3771
+ }), l = ja(a, t), [o, i] = E(
3767
3772
  sa(a)
3768
- ), [d, i] = E(
3773
+ ), [d, r] = E(
3769
3774
  ((ie = (K = (le = a == null ? void 0 : a.chartOptions) == null ? void 0 : le.scales) == null ? void 0 : K[l]) == null ? void 0 : ie.min) || ""
3770
- ), [x, h] = E(
3775
+ ), [x, u] = E(
3771
3776
  ((Z = (V = (w = a == null ? void 0 : a.chartOptions) == null ? void 0 : w.scales) == null ? void 0 : V[l]) == null ? void 0 : Z.max) || ""
3772
- ), [y, p] = E(d || x ? "custom" : "auto"), [m, f] = E(""), [u, k] = E(0), [I, D] = E(""), [N, M] = E(""), [A, j] = E(""), S = c(
3773
- (T) => T.actions.setCardPreferences
3774
- ), { updateCardInFrame: v } = we(), b = c((T) => T.card), q = c((T) => {
3775
- var L;
3776
- return (L = T.card) == null ? void 0 : L.type;
3777
+ ), [v, p] = E(d || x ? "custom" : "auto"), [h, f] = E(""), [m, k] = E(0), [I, M] = E(""), [j, D] = E(""), [A, g] = E(""), S = c(
3778
+ (L) => L.actions.setCardPreferences
3779
+ ), { updateCardInFrame: C } = we(), y = c((L) => L.card), q = c((L) => {
3780
+ var T;
3781
+ return (T = L.card) == null ? void 0 : T.type;
3777
3782
  }), $ = ["pie", "doughnut", "polarArea"].includes(q);
3778
3783
  Y(() => {
3779
- var T, L, se, _, ae, te, ke, ye, J, oe, ce, ze, de, ve;
3780
- r(sa(a)), i(
3781
- ((se = (L = (T = a == null ? void 0 : a.chartOptions) == null ? void 0 : T.scales) == null ? void 0 : L[l]) == null ? void 0 : se.min) === 0 ? 0 : ""
3782
- ), h(((te = (ae = (_ = a == null ? void 0 : a.chartOptions) == null ? void 0 : _.scales) == null ? void 0 : ae[l]) == null ? void 0 : te.max) || ""), f(
3784
+ var L, T, se, _, ae, te, ke, ye, J, oe, ce, ze, de, ve;
3785
+ i(sa(a)), r(
3786
+ ((se = (T = (L = a == null ? void 0 : a.chartOptions) == null ? void 0 : L.scales) == null ? void 0 : T[l]) == null ? void 0 : se.min) === 0 ? 0 : ""
3787
+ ), u(((te = (ae = (_ = a == null ? void 0 : a.chartOptions) == null ? void 0 : _.scales) == null ? void 0 : ae[l]) == null ? void 0 : te.max) || ""), f(
3783
3788
  ((oe = (J = (ye = (ke = a == null ? void 0 : a.chartOptions) == null ? void 0 : ke.scales) == null ? void 0 : ye[l]) == null ? void 0 : J.ticks) == null ? void 0 : oe.stepSize) || ""
3784
- ), k(((ce = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ce.decimalPlaces) || 0), D(((ze = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ze.suffix) || ""), M(((de = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : de.currency) || ""), j(((ve = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ve.locale) || "");
3789
+ ), k(((ce = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ce.decimalPlaces) || 0), M(((ze = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ze.suffix) || ""), D(((de = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : de.currency) || ""), g(((ve = a == null ? void 0 : a.numberAxisFormat) == null ? void 0 : ve.locale) || "");
3785
3790
  }, [s, a, l]);
3786
- function R(T, L) {
3787
- return L === "" || /^[0-9\b]+$/.test(L) ? Number(L) : Number(T);
3791
+ function R(L, T) {
3792
+ return T === "" || /^[0-9\b]+$/.test(T) ? Number(T) : Number(L);
3788
3793
  }
3789
3794
  function B() {
3790
- const T = [
3791
- ...new Set(as.map((L) => L.currency))
3795
+ const L = [
3796
+ ...new Set(as.map((T) => T.currency))
3792
3797
  ];
3793
3798
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
3794
3799
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-6 items-center gap-2", children: [
@@ -3810,19 +3815,19 @@ function Ha() {
3810
3815
  /* @__PURE__ */ e.jsxs(
3811
3816
  he,
3812
3817
  {
3813
- value: N || "none",
3814
- onValueChange: (L) => M(L === "none" ? "" : L),
3818
+ value: j || "none",
3819
+ onValueChange: (T) => D(T === "none" ? "" : T),
3815
3820
  children: [
3816
3821
  /* @__PURE__ */ e.jsx(me, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(xe, {}) }),
3817
3822
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
3818
3823
  /* @__PURE__ */ e.jsx(fe, { children: "Currency" }),
3819
3824
  /* @__PURE__ */ e.jsx(Q, { value: "none", children: "None" }),
3820
- T.map((L) => /* @__PURE__ */ e.jsx(Q, { value: L, children: L }, L))
3825
+ L.map((T) => /* @__PURE__ */ e.jsx(Q, { value: T, children: T }, T))
3821
3826
  ] }) })
3822
3827
  ]
3823
3828
  }
3824
3829
  ),
3825
- /* @__PURE__ */ e.jsxs(he, { value: A, onValueChange: (L) => j(L), children: [
3830
+ /* @__PURE__ */ e.jsxs(he, { value: A, onValueChange: (T) => g(T), children: [
3826
3831
  /* @__PURE__ */ e.jsx(
3827
3832
  me,
3828
3833
  {
@@ -3832,17 +3837,17 @@ function Ha() {
3832
3837
  ),
3833
3838
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
3834
3839
  /* @__PURE__ */ e.jsx(fe, { children: "Locale" }),
3835
- as.map((L) => /* @__PURE__ */ e.jsx(Q, { value: L.locale, children: L.locale }, L.locale))
3840
+ as.map((T) => /* @__PURE__ */ e.jsx(Q, { value: T.locale, children: T.locale }, T.locale))
3836
3841
  ] }) })
3837
3842
  ] })
3838
3843
  ] }),
3839
3844
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-9 items-center gap-2", children: [
3840
3845
  /* @__PURE__ */ e.jsx(H, { className: "col-span-3", htmlFor: "format", children: "Decimals" }),
3841
3846
  /* @__PURE__ */ e.jsx(
3842
- Ce,
3847
+ Ne,
3843
3848
  {
3844
- value: u,
3845
- onChange: (L) => k(Number(L.target.value)),
3849
+ value: m,
3850
+ onChange: (T) => k(Number(T.target.value)),
3846
3851
  id: "format",
3847
3852
  className: `col-span-6 h-8 w-full tracking-wide ${Je}`
3848
3853
  }
@@ -3855,19 +3860,19 @@ function Ha() {
3855
3860
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2", children: [
3856
3861
  /* @__PURE__ */ e.jsx(H, { htmlFor: "range", children: "Range" }),
3857
3862
  /* @__PURE__ */ e.jsx(
3858
- Ce,
3863
+ Ne,
3859
3864
  {
3860
3865
  id: "min",
3861
3866
  value: d,
3862
- onChange: (T) => i((L) => R(L, T.target.value)),
3867
+ onChange: (L) => r((T) => R(T, L.target.value)),
3863
3868
  className: `col-span-1 h-8 w-full ${Je}`
3864
3869
  }
3865
3870
  ),
3866
3871
  /* @__PURE__ */ e.jsx(
3867
- Ce,
3872
+ Ne,
3868
3873
  {
3869
3874
  value: x,
3870
- onChange: (T) => h((L) => R(L, T.target.value)),
3875
+ onChange: (L) => u((T) => R(T, L.target.value)),
3871
3876
  id: "max",
3872
3877
  className: `col-span-1 h-8 w-full ${Je}`
3873
3878
  }
@@ -3876,10 +3881,10 @@ function Ha() {
3876
3881
  /* @__PURE__ */ e.jsxs("div", { className: "grid grid-cols-3 items-center gap-2", children: [
3877
3882
  /* @__PURE__ */ e.jsx(H, { htmlFor: "step-size", children: "Step Size" }),
3878
3883
  /* @__PURE__ */ e.jsx(
3879
- Ce,
3884
+ Ne,
3880
3885
  {
3881
- value: m,
3882
- onChange: (T) => f((L) => R(L, T.target.value)),
3886
+ value: h,
3887
+ onChange: (L) => f((T) => R(T, L.target.value)),
3883
3888
  id: "step-size",
3884
3889
  className: `col-span-1 h-8 w-full ${Je}`
3885
3890
  }
@@ -3889,15 +3894,15 @@ function Ha() {
3889
3894
  }
3890
3895
  function W() {
3891
3896
  var _;
3892
- let T = {};
3893
- y === "custom" && (T = {
3897
+ let L = {};
3898
+ v === "custom" && (L = {
3894
3899
  min: d,
3895
3900
  max: x,
3896
3901
  ticks: {
3897
- stepSize: m
3902
+ stepSize: h
3898
3903
  }
3899
3904
  });
3900
- const L = {
3905
+ const T = {
3901
3906
  ...a || {},
3902
3907
  chartOptions: {
3903
3908
  ...a == null ? void 0 : a.chartOptions,
@@ -3906,25 +3911,25 @@ function Ha() {
3906
3911
  [l]: {
3907
3912
  // ...cardPreferences?.chartOptions?.scales?.[axis],
3908
3913
  type: o,
3909
- ...o === "linear" ? T : {}
3914
+ ...o === "linear" ? L : {}
3910
3915
  }
3911
3916
  }
3912
3917
  },
3913
3918
  numberAxisFormat: {
3914
- decimalPlaces: u,
3919
+ decimalPlaces: m,
3915
3920
  suffix: I,
3916
- currency: N,
3921
+ currency: j,
3917
3922
  locale: A
3918
3923
  }
3919
3924
  };
3920
- console.log(L), S(L);
3925
+ console.log(T), S(T);
3921
3926
  const se = {
3922
- ...b,
3923
- preferences: L
3927
+ ...y,
3928
+ preferences: T
3924
3929
  };
3925
- v(se);
3930
+ C(se);
3926
3931
  }
3927
- return /* @__PURE__ */ e.jsxs(is, { onOpenChange: (T) => n(T), children: [
3932
+ return /* @__PURE__ */ e.jsxs(is, { onOpenChange: (L) => n(L), children: [
3928
3933
  /* @__PURE__ */ e.jsx(rs, { asChild: !0, children: /* @__PURE__ */ e.jsx(Ht, { className: "size-4 cursor-pointer text-muted-foreground hover:text-foreground" }) }),
3929
3934
  /* @__PURE__ */ e.jsx(os, { align: "center", className: "max-w-65", children: /* @__PURE__ */ e.jsxs("div", { className: "grid gap-4", children: [
3930
3935
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
@@ -3939,7 +3944,7 @@ function Ha() {
3939
3944
  {
3940
3945
  disabled: $,
3941
3946
  value: o,
3942
- onValueChange: (T) => r(T),
3947
+ onValueChange: (L) => i(L),
3943
3948
  children: [
3944
3949
  /* @__PURE__ */ e.jsx(me, { className: "col-span-2 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(xe, {}) }),
3945
3950
  /* @__PURE__ */ e.jsx(pe, { id: "type", children: /* @__PURE__ */ e.jsxs(Se, { children: [
@@ -3958,24 +3963,24 @@ function Ha() {
3958
3963
  {
3959
3964
  disabled: $,
3960
3965
  id: "scale-option",
3961
- value: y,
3962
- onValueChange: (T) => p(T),
3966
+ value: v,
3967
+ onValueChange: (L) => p(L),
3963
3968
  className: "col-span-2 flex gap-3",
3964
3969
  defaultValue: "x",
3965
3970
  children: [
3966
3971
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3967
- /* @__PURE__ */ e.jsx(Le, { value: "auto", id: "r1" }),
3972
+ /* @__PURE__ */ e.jsx(Te, { value: "auto", id: "r1" }),
3968
3973
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Auto" })
3969
3974
  ] }),
3970
3975
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
3971
- /* @__PURE__ */ e.jsx(Le, { value: "custom", id: "r2" }),
3976
+ /* @__PURE__ */ e.jsx(Te, { value: "custom", id: "r2" }),
3972
3977
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Custom" })
3973
3978
  ] })
3974
3979
  ]
3975
3980
  }
3976
3981
  )
3977
3982
  ] }),
3978
- y === "custom" && o == "linear" && ee(),
3983
+ v === "custom" && o == "linear" && ee(),
3979
3984
  B(),
3980
3985
  /* @__PURE__ */ e.jsx($t, {}),
3981
3986
  /* @__PURE__ */ e.jsx("div", { className: "grid grid-cols-3", children: /* @__PURE__ */ e.jsx(
@@ -3991,25 +3996,25 @@ function Ha() {
3991
3996
  ] }) })
3992
3997
  ] });
3993
3998
  }
3994
- function Nl({ idx: s }) {
3999
+ function Cl({ idx: s }) {
3995
4000
  var d;
3996
- const n = c((i) => {
4001
+ const n = c((r) => {
3997
4002
  var x;
3998
- return (x = i.card) == null ? void 0 : x.preferences;
4003
+ return (x = r.card) == null ? void 0 : x.preferences;
3999
4004
  }), a = c(
4000
- (i) => {
4005
+ (r) => {
4001
4006
  var x;
4002
- return (x = i.card.preferences) == null ? void 0 : x.datasetOptions;
4007
+ return (x = r.card.preferences) == null ? void 0 : x.datasetOptions;
4003
4008
  }
4004
4009
  ), t = c(
4005
- (i) => i.actions.setCardPreferences
4006
- ), l = (d = n == null ? void 0 : n.chartOptions) == null ? void 0 : d.indexAxis, o = a == null ? void 0 : a.find((i) => i.idx === s);
4007
- function r(i, x) {
4008
- (i === "end" || i === "start") && Bt(Pt());
4009
- const h = {
4010
- display: i !== "none",
4011
- align: i,
4012
- anchor: i,
4010
+ (r) => r.actions.setCardPreferences
4011
+ ), l = (d = n == null ? void 0 : n.chartOptions) == null ? void 0 : d.indexAxis, o = a == null ? void 0 : a.find((r) => r.idx === s);
4012
+ function i(r, x) {
4013
+ (r === "end" || r === "start") && Bt(Pt());
4014
+ const u = {
4015
+ display: r !== "none",
4016
+ align: r,
4017
+ anchor: r,
4013
4018
  clamp: !0
4014
4019
  };
4015
4020
  if (!o)
@@ -4019,15 +4024,15 @@ function Nl({ idx: s }) {
4019
4024
  ...a || [],
4020
4025
  {
4021
4026
  idx: x,
4022
- datalabels: h
4027
+ datalabels: u
4023
4028
  }
4024
4029
  ]
4025
4030
  });
4026
4031
  else {
4027
- const y = { ...o };
4028
- y.datalabels = h;
4032
+ const v = { ...o };
4033
+ v.datalabels = u;
4029
4034
  const p = a == null ? void 0 : a.map(
4030
- (m) => m.idx === x ? y : m
4035
+ (h) => h.idx === x ? v : h
4031
4036
  );
4032
4037
  t({
4033
4038
  ...n,
@@ -4041,7 +4046,7 @@ function Nl({ idx: s }) {
4041
4046
  /* @__PURE__ */ e.jsx(
4042
4047
  F,
4043
4048
  {
4044
- onClick: () => r("none", s),
4049
+ onClick: () => i("none", s),
4045
4050
  size: "sm",
4046
4051
  variant: "secondary",
4047
4052
  className: "h-7 p-1 text-xs font-normal",
@@ -4051,7 +4056,7 @@ function Nl({ idx: s }) {
4051
4056
  /* @__PURE__ */ e.jsx(
4052
4057
  F,
4053
4058
  {
4054
- onClick: () => r("start", s),
4059
+ onClick: () => i("start", s),
4055
4060
  size: "sm",
4056
4061
  variant: "secondary",
4057
4062
  className: "h-7 p-1 text-xs font-normal",
@@ -4068,7 +4073,7 @@ function Nl({ idx: s }) {
4068
4073
  /* @__PURE__ */ e.jsx(
4069
4074
  F,
4070
4075
  {
4071
- onClick: () => r("center", s),
4076
+ onClick: () => i("center", s),
4072
4077
  size: "sm",
4073
4078
  variant: "secondary",
4074
4079
  className: "h-7 p-1 text-xs font-normal",
@@ -4085,7 +4090,7 @@ function Nl({ idx: s }) {
4085
4090
  /* @__PURE__ */ e.jsx(
4086
4091
  F,
4087
4092
  {
4088
- onClick: () => r("end", s),
4093
+ onClick: () => i("end", s),
4089
4094
  size: "sm",
4090
4095
  variant: "secondary",
4091
4096
  className: "h-7 p-1 text-xs font-normal",
@@ -4103,51 +4108,51 @@ function Nl({ idx: s }) {
4103
4108
  ] });
4104
4109
  }
4105
4110
  function $a() {
4106
- const s = c((i) => i.card), n = c(
4107
- (i) => {
4108
- var x, h, y;
4109
- return (y = (h = (x = i == null ? void 0 : i.card) == null ? void 0 : x.preferences) == null ? void 0 : h.chartOptions) == null ? void 0 : y.indexAxis;
4111
+ const s = c((r) => r.card), n = c(
4112
+ (r) => {
4113
+ var x, u, v;
4114
+ return (v = (u = (x = r == null ? void 0 : r.card) == null ? void 0 : x.preferences) == null ? void 0 : u.chartOptions) == null ? void 0 : v.indexAxis;
4110
4115
  }
4111
4116
  ), a = n === "y" ? "Y axis" : "X axis", t = n === "y" ? "X axis" : "Y axis", {
4112
4117
  keys: l,
4113
4118
  metricKeys: o,
4114
- dimensionKeys: r
4119
+ dimensionKeys: i
4115
4120
  } = gs(s.data || []);
4116
4121
  let d = o;
4117
4122
  if (["stackedBar", "stackedLine"].includes(s.type)) {
4118
- const i = Ut({
4123
+ const r = Ut({
4119
4124
  dataArray: s.data || [],
4120
- groupKey: r[0],
4121
- pivotKey: r[1],
4125
+ groupKey: i[0],
4126
+ pivotKey: i[1],
4122
4127
  valueKey: d[0]
4123
- }), { metricKeys: x } = gs(i);
4128
+ }), { metricKeys: x } = gs(r);
4124
4129
  d = x;
4125
4130
  }
4126
4131
  return l.length === 0 ? null : /* @__PURE__ */ e.jsxs("div", { className: "space-y-4", children: [
4127
4132
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
4128
4133
  /* @__PURE__ */ e.jsx(H, { children: a }),
4129
- /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: /* @__PURE__ */ e.jsx("div", { className: "rounded-md bg-muted/70 px-2 py-1 hover:bg-muted", children: /* @__PURE__ */ e.jsx("p", { children: r[0] }) }) })
4134
+ /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: /* @__PURE__ */ e.jsx("div", { className: "rounded-md bg-muted/70 px-2 py-1 hover:bg-muted", children: /* @__PURE__ */ e.jsx("p", { children: i[0] }) }) })
4130
4135
  ] }),
4131
4136
  /* @__PURE__ */ e.jsxs("div", { className: "space-y-2", children: [
4132
4137
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between gap-5", children: [
4133
4138
  /* @__PURE__ */ e.jsx(H, { children: t }),
4134
4139
  /* @__PURE__ */ e.jsx(Ha, {})
4135
4140
  ] }),
4136
- /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: d.map((i, x) => /* @__PURE__ */ e.jsx(Cl, { col: i, idx: x }, i)) })
4141
+ /* @__PURE__ */ e.jsx("div", { className: "my-1 space-y-1", children: d.map((r, x) => /* @__PURE__ */ e.jsx(Nl, { col: r, idx: x }, r)) })
4137
4142
  ] })
4138
4143
  ] });
4139
4144
  }
4140
- function Cl({ col: s, idx: n }) {
4145
+ function Nl({ col: s, idx: n }) {
4141
4146
  const a = c((d) => {
4142
- var i;
4143
- return (i = d.card) == null ? void 0 : i.preferences;
4147
+ var r;
4148
+ return (r = d.card) == null ? void 0 : r.preferences;
4144
4149
  }), t = c(
4145
4150
  (d) => {
4146
- var i;
4147
- return (i = d.card.preferences) == null ? void 0 : i.datasetOptions;
4151
+ var r;
4152
+ return (r = d.card.preferences) == null ? void 0 : r.datasetOptions;
4148
4153
  }
4149
4154
  ), l = t == null ? void 0 : t.find((d) => d.idx === n), { setCardPreferences: o } = c((d) => d.actions);
4150
- function r(d) {
4155
+ function i(d) {
4151
4156
  if (!l)
4152
4157
  o({
4153
4158
  ...a,
@@ -4161,10 +4166,10 @@ function Cl({ col: s, idx: n }) {
4161
4166
  ]
4162
4167
  });
4163
4168
  else {
4164
- const i = { ...l };
4165
- i.type = d === "area" ? "line" : d, i.fill = d === "area" ? "origin" : "";
4169
+ const r = { ...l };
4170
+ r.type = d === "area" ? "line" : d, r.fill = d === "area" ? "origin" : "";
4166
4171
  const x = t == null ? void 0 : t.map(
4167
- (h) => h.idx === n ? i : h
4172
+ (u) => u.idx === n ? r : u
4168
4173
  );
4169
4174
  o({
4170
4175
  ...a,
@@ -4178,21 +4183,21 @@ function Cl({ col: s, idx: n }) {
4178
4183
  /* @__PURE__ */ e.jsx(
4179
4184
  qs,
4180
4185
  {
4181
- onClick: () => r("bar"),
4186
+ onClick: () => i("bar"),
4182
4187
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4183
4188
  }
4184
4189
  ),
4185
4190
  /* @__PURE__ */ e.jsx(
4186
4191
  Rs,
4187
4192
  {
4188
- onClick: () => r("line"),
4193
+ onClick: () => i("line"),
4189
4194
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4190
4195
  }
4191
4196
  ),
4192
4197
  /* @__PURE__ */ e.jsx(
4193
4198
  mn,
4194
4199
  {
4195
- onClick: () => r("area"),
4200
+ onClick: () => i("area"),
4196
4201
  className: "invisible size-4 cursor-pointer text-muted-foreground hover:text-foreground group-hover:visible"
4197
4202
  }
4198
4203
  ),
@@ -4203,37 +4208,37 @@ function Cl({ col: s, idx: n }) {
4203
4208
  className: "invisible size-4 cursor-pointer py-2 text-muted-foreground hover:text-foreground group-hover:visible"
4204
4209
  }
4205
4210
  ),
4206
- /* @__PURE__ */ e.jsx(Nl, { idx: n })
4211
+ /* @__PURE__ */ e.jsx(Cl, { idx: n })
4207
4212
  ] })
4208
4213
  ] });
4209
4214
  }
4210
4215
  function Ba() {
4211
- const s = c((p) => p.selectedConnectionId), n = c((p) => p.selectedDatamodelId), a = c((p) => p.selectedDatabaseName), t = c((p) => p.selectedSchemaName), l = c((p) => p.selectedTableName), o = z((p) => p.dashboard.filters) || [], r = z((p) => p.actions.addFilter), d = z((p) => p.actions.removeFilter), i = z(
4216
+ const s = c((p) => p.selectedConnectionId), n = c((p) => p.selectedDatamodelId), a = c((p) => p.selectedDatabaseName), t = c((p) => p.selectedSchemaName), l = c((p) => p.selectedTableName), o = z((p) => p.dashboard.filters) || [], i = z((p) => p.actions.addFilter), d = z((p) => p.actions.removeFilter), r = z(
4212
4217
  (p) => p.actions.removeFilterValue
4213
- ), { modelItems: x, tableName: h } = Oe();
4214
- function y(p, m = "dashboard") {
4215
- var j;
4216
- const f = ue(p.column_name), u = ue(a || ""), k = ue(t || ""), I = ue(h);
4217
- let D = ca(
4218
+ ), { modelItems: x, tableName: u } = Oe();
4219
+ function v(p, h = "dashboard") {
4220
+ var g;
4221
+ const f = ue(p.column_name), m = ue(a || ""), k = ue(t || ""), I = ue(u);
4222
+ let M = ca(
4218
4223
  k,
4219
4224
  I
4220
- ), N = `${D}.${f}`;
4221
- const M = (j = x == null ? void 0 : x.find(
4225
+ ), j = `${M}.${f}`;
4226
+ const D = (g = x == null ? void 0 : x.find(
4222
4227
  (S) => S.id === n
4223
- )) == null ? void 0 : j.name;
4224
- n && n !== "none" && (N = `${fs}.${M}.${f}`, D = `${fs}.${M}`);
4228
+ )) == null ? void 0 : g.name;
4229
+ n && n !== "none" && (j = `${fs}.${D}.${f}`, M = `${fs}.${D}`);
4225
4230
  const A = o == null ? void 0 : o.find(
4226
- (S) => S.column === N && S.table === I && (S.database === u || S.database === a)
4231
+ (S) => S.column === j && S.table === I && (S.database === m || S.database === a)
4227
4232
  );
4228
4233
  if (A)
4229
- i(A.id), d(A.id);
4234
+ r(A.id), d(A.id);
4230
4235
  else {
4231
4236
  const S = $e();
4232
- return h === "api" && s ? (r({
4233
- location: m,
4237
+ return u === "api" && s ? (i({
4238
+ location: h,
4234
4239
  id: S,
4235
4240
  //uuidv4(),
4236
- column: N,
4241
+ column: j,
4237
4242
  title: p.column_name,
4238
4243
  dataType: p.data_type,
4239
4244
  table: "api",
@@ -4243,15 +4248,15 @@ function Ba() {
4243
4248
  operation: "in",
4244
4249
  sql: Js(
4245
4250
  p.data_type,
4246
- D,
4251
+ M,
4247
4252
  f
4248
4253
  )
4249
4254
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
4250
- }), S) : (r({
4255
+ }), S) : (i({
4251
4256
  id: S,
4252
4257
  //uuidv4(),
4253
- location: m,
4254
- column: N,
4258
+ location: h,
4259
+ column: j,
4255
4260
  //columnName, //`${qualifiedTableName}.${formattedColumnName}`,
4256
4261
  title: p.column_name,
4257
4262
  dataType: p.data_type,
@@ -4261,35 +4266,35 @@ function Ba() {
4261
4266
  operation: "in",
4262
4267
  sql: Js(
4263
4268
  p.data_type,
4264
- D,
4269
+ M,
4265
4270
  f
4266
4271
  )
4267
4272
  //DATE_DATA_TYPES.includes(column.data_type) ? dateSql : sql,
4268
4273
  }), S);
4269
4274
  }
4270
4275
  }
4271
- return { assignFilter: y };
4276
+ return { assignFilter: v };
4272
4277
  }
4273
4278
  function Ee() {
4274
4279
  const s = z(
4275
4280
  (d) => d.dashboard.filters
4276
4281
  ), n = c((d) => d.frame), { setFrame: a } = we(), { columns: t } = Oe(), { assignFilter: l } = Ba();
4277
4282
  function o(d) {
4278
- const i = l(d, "frame");
4279
- a({ ...n, filterId: i });
4283
+ const r = l(d, "frame");
4284
+ a({ ...n, filterId: r });
4280
4285
  }
4281
- const r = s == null ? void 0 : s.find((d) => d.id === n.filterId);
4286
+ const i = s == null ? void 0 : s.find((d) => d.id === n.filterId);
4282
4287
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-3", children: [
4283
4288
  /* @__PURE__ */ e.jsx(H, { children: "Card Filter" }),
4284
4289
  /* @__PURE__ */ e.jsx(Sl, { onSelect: o, columns: t }),
4285
- r && /* @__PURE__ */ e.jsx(Gt, { filter: r })
4290
+ i && /* @__PURE__ */ e.jsx(Gt, { filter: i })
4286
4291
  ] });
4287
4292
  }
4288
4293
  function Sl({
4289
4294
  columns: s,
4290
4295
  onSelect: n
4291
4296
  }) {
4292
- var r;
4297
+ var i;
4293
4298
  const [a, t] = Ys.useState(!1), [l, o] = Ys.useState("");
4294
4299
  return /* @__PURE__ */ e.jsxs(is, { open: a, onOpenChange: t, children: [
4295
4300
  /* @__PURE__ */ e.jsx(rs, { asChild: !0, children: /* @__PURE__ */ e.jsxs(
@@ -4301,7 +4306,7 @@ function Sl({
4301
4306
  "aria-expanded": a,
4302
4307
  className: "w-full justify-between font-normal",
4303
4308
  children: [
4304
- l ? (r = s.find((d) => d.column_name === l)) == null ? void 0 : r.column_name : "Select Column...",
4309
+ l ? (i = s.find((d) => d.column_name === l)) == null ? void 0 : i.column_name : "Select Column...",
4305
4310
  /* @__PURE__ */ e.jsx(Kt, { className: "ml-2 h-4 w-4 shrink-0 opacity-50" })
4306
4311
  ]
4307
4312
  }
@@ -4314,8 +4319,8 @@ function Sl({
4314
4319
  Zt,
4315
4320
  {
4316
4321
  value: d.column_name,
4317
- onSelect: (i) => {
4318
- const x = i === l ? "" : i;
4322
+ onSelect: (r) => {
4323
+ const x = r === l ? "" : r;
4319
4324
  o(x), t(!1), x && n(d);
4320
4325
  },
4321
4326
  children: [
@@ -4340,7 +4345,7 @@ function Sl({
4340
4345
  function wl({
4341
4346
  cardType: s
4342
4347
  }) {
4343
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
4348
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
4344
4349
  /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4345
4350
  /* @__PURE__ */ e.jsx(U, { children: `${Vs(s)} Chart` }),
4346
4351
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 font-mono text-xs", children: [
@@ -4383,13 +4388,13 @@ function wl({
4383
4388
  ] }) });
4384
4389
  }
4385
4390
  function Hs() {
4386
- var l, o, r;
4391
+ var l, o, i;
4387
4392
  const s = c(
4388
4393
  (d) => d.card.cfg
4389
4394
  ), n = c((d) => d.actions.setCardCfg), a = c((d) => d.card.type);
4390
4395
  function t(d) {
4391
- var h;
4392
- const i = {
4396
+ var u;
4397
+ const r = {
4393
4398
  datalabels: {
4394
4399
  display: d !== "none",
4395
4400
  align: d,
@@ -4401,8 +4406,8 @@ function Hs() {
4401
4406
  options: {
4402
4407
  ...s == null ? void 0 : s.options,
4403
4408
  plugins: {
4404
- ...(h = s == null ? void 0 : s.options) == null ? void 0 : h.plugins,
4405
- ...i
4409
+ ...(u = s == null ? void 0 : s.options) == null ? void 0 : u.plugins,
4410
+ ...r
4406
4411
  }
4407
4412
  }
4408
4413
  };
@@ -4416,7 +4421,7 @@ function Hs() {
4416
4421
  /* @__PURE__ */ e.jsxs(
4417
4422
  he,
4418
4423
  {
4419
- 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,
4424
+ 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,
4420
4425
  onValueChange: t,
4421
4426
  defaultValue: "none",
4422
4427
  children: [
@@ -4463,7 +4468,7 @@ function kl({
4463
4468
  ] })
4464
4469
  ] });
4465
4470
  }
4466
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
4471
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
4467
4472
  /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4468
4473
  /* @__PURE__ */ e.jsx(U, { children: `${Vs(s)} Chart` }),
4469
4474
  /* @__PURE__ */ e.jsx(G, { className: "space-y-4 font-mono text-xs", children: n(s) })
@@ -4504,16 +4509,16 @@ const zl = {
4504
4509
  }
4505
4510
  ]
4506
4511
  };
4507
- function Ll() {
4512
+ function Tl() {
4508
4513
  const s = c((n) => n.card.type);
4509
4514
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 p-6", children: [
4510
4515
  /* @__PURE__ */ e.jsx(
4511
- Te,
4516
+ Le,
4512
4517
  {
4513
4518
  className: " ",
4514
4519
  type: "single",
4515
4520
  collapsible: !0,
4516
- children: Tl(s)
4521
+ children: Ll(s)
4517
4522
  }
4518
4523
  ),
4519
4524
  /* @__PURE__ */ e.jsx("section", { className: "", children: ["line", "bar"].includes(s) && /* @__PURE__ */ e.jsx(ds, {}) }),
@@ -4524,7 +4529,7 @@ function Ll() {
4524
4529
  ] })
4525
4530
  ] });
4526
4531
  }
4527
- function Tl(s) {
4532
+ function Ll(s) {
4528
4533
  if (["line", "bar"].includes(s))
4529
4534
  return /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
4530
4535
  /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
@@ -4622,52 +4627,52 @@ function Tl(s) {
4622
4627
  ] }) });
4623
4628
  }
4624
4629
  function Il() {
4625
- var i, x, h, y, p;
4626
- const s = c((m) => m.card.preferences), n = c(
4627
- (m) => m.actions.setCardPreferences
4630
+ var r, x, u, v, p;
4631
+ const s = c((h) => h.card.preferences), n = c(
4632
+ (h) => h.actions.setCardPreferences
4628
4633
  ), a = c(
4629
- (m) => m.actions.setNumberFormat
4634
+ (h) => h.actions.setNumberFormat
4630
4635
  );
4631
4636
  c(
4632
- (m) => {
4633
- var f, u;
4634
- return (u = (f = m.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : u.decimalPlaces;
4637
+ (h) => {
4638
+ var f, m;
4639
+ return (m = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : m.decimalPlaces;
4635
4640
  }
4636
4641
  );
4637
4642
  const t = c(
4638
- (m) => {
4639
- var f, u;
4640
- return (u = (f = m.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : u.locale;
4643
+ (h) => {
4644
+ var f, m;
4645
+ return (m = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : m.locale;
4641
4646
  }
4642
4647
  ), l = c(
4643
- (m) => {
4644
- var f, u;
4645
- return (u = (f = m.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : u.currency;
4648
+ (h) => {
4649
+ var f, m;
4650
+ return (m = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : m.currency;
4646
4651
  }
4647
4652
  );
4648
4653
  c(
4649
- (m) => m.actions.setFilterOnClickField
4654
+ (h) => h.actions.setFilterOnClickField
4650
4655
  );
4651
4656
  const o = c(
4652
- (m) => {
4653
- var f, u;
4654
- return (u = (f = m.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : u.colorRanges;
4657
+ (h) => {
4658
+ var f, m;
4659
+ return (m = (f = h.card.preferences) == null ? void 0 : f.formatNumber) == null ? void 0 : m.colorRanges;
4655
4660
  }
4656
- ) || [], r = c(
4657
- (m) => m.actions.setColorRanges
4658
- ), d = [...new Set(as.map((m) => m.currency))];
4661
+ ) || [], i = c(
4662
+ (h) => h.actions.setColorRanges
4663
+ ), d = [...new Set(as.map((h) => h.currency))];
4659
4664
  return /* @__PURE__ */ e.jsxs("div", { children: [
4660
4665
  /* @__PURE__ */ e.jsxs("div", { className: "mb-3 flex items-center gap-2", children: [
4661
4666
  /* @__PURE__ */ e.jsx(
4662
4667
  ls,
4663
4668
  {
4664
- checked: !!((i = s == null ? void 0 : s.formatNumber) != null && i.enabled),
4665
- onCheckedChange: (m) => {
4669
+ checked: !!((r = s == null ? void 0 : s.formatNumber) != null && r.enabled),
4670
+ onCheckedChange: (h) => {
4666
4671
  n({
4667
4672
  ...s,
4668
4673
  formatNumber: {
4669
4674
  ...s == null ? void 0 : s.formatNumber,
4670
- enabled: m
4675
+ enabled: h
4671
4676
  }
4672
4677
  });
4673
4678
  }
@@ -4684,12 +4689,12 @@ function Il() {
4684
4689
  he,
4685
4690
  {
4686
4691
  value: t || "en-US",
4687
- onValueChange: (m) => {
4688
- var f, u, k;
4692
+ onValueChange: (h) => {
4693
+ var f, m, k;
4689
4694
  return a(
4690
4695
  ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.decimalPlaces) || 0,
4691
- ((u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.currency) || "",
4692
- m || "en-US",
4696
+ ((m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.currency) || "",
4697
+ h || "en-US",
4693
4698
  ((k = s == null ? void 0 : s.formatNumber) == null ? void 0 : k.suffix) || ""
4694
4699
  );
4695
4700
  },
@@ -4697,7 +4702,7 @@ function Il() {
4697
4702
  /* @__PURE__ */ e.jsx(me, { className: "col-span-6 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(xe, {}) }),
4698
4703
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
4699
4704
  /* @__PURE__ */ e.jsx(fe, { children: "Format" }),
4700
- as.map((m) => /* @__PURE__ */ e.jsx(Q, { value: m.locale, children: m.locale }, m.locale))
4705
+ as.map((h) => /* @__PURE__ */ e.jsx(Q, { value: h.locale, children: h.locale }, h.locale))
4701
4706
  ] }) })
4702
4707
  ]
4703
4708
  }
@@ -4709,12 +4714,12 @@ function Il() {
4709
4714
  he,
4710
4715
  {
4711
4716
  value: l || "none",
4712
- onValueChange: (m) => {
4713
- var f, u, k;
4717
+ onValueChange: (h) => {
4718
+ var f, m, k;
4714
4719
  return a(
4715
4720
  ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.decimalPlaces) || 0,
4716
- m === "none" ? "" : m,
4717
- ((u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.locale) || "",
4721
+ h === "none" ? "" : h,
4722
+ ((m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.locale) || "",
4718
4723
  ((k = s == null ? void 0 : s.formatNumber) == null ? void 0 : k.suffix) || ""
4719
4724
  );
4720
4725
  },
@@ -4723,7 +4728,7 @@ function Il() {
4723
4728
  /* @__PURE__ */ e.jsx(pe, { children: /* @__PURE__ */ e.jsxs(Se, { children: [
4724
4729
  /* @__PURE__ */ e.jsx(fe, { children: "Currency" }),
4725
4730
  /* @__PURE__ */ e.jsx(Q, { value: "none", children: "None" }, "none"),
4726
- d.map((m) => /* @__PURE__ */ e.jsx(Q, { value: m, children: m }, m))
4731
+ d.map((h) => /* @__PURE__ */ e.jsx(Q, { value: h, children: h }, h))
4727
4732
  ] }) })
4728
4733
  ]
4729
4734
  }
@@ -4736,19 +4741,19 @@ function Il() {
4736
4741
  /* @__PURE__ */ e.jsxs(
4737
4742
  he,
4738
4743
  {
4739
- value: ((y = (h = s == null ? void 0 : s.formatNumber) == null ? void 0 : h.decimalPlaces) == null ? void 0 : y.toString()) || "0",
4740
- onValueChange: (m) => {
4741
- var f, u, k;
4744
+ value: ((v = (u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.decimalPlaces) == null ? void 0 : v.toString()) || "0",
4745
+ onValueChange: (h) => {
4746
+ var f, m, k;
4742
4747
  return a(
4743
- Number(m),
4748
+ Number(h),
4744
4749
  ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.currency) || "",
4745
- ((u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.locale) || "",
4750
+ ((m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.locale) || "",
4746
4751
  ((k = s == null ? void 0 : s.formatNumber) == null ? void 0 : k.suffix) || ""
4747
4752
  );
4748
4753
  },
4749
4754
  children: [
4750
4755
  /* @__PURE__ */ e.jsx(me, { className: "col-span-3 h-8 w-full focus:ring-1 focus:ring-offset-0", children: /* @__PURE__ */ e.jsx(xe, {}) }),
4751
- /* @__PURE__ */ e.jsx(pe, { children: ["0", "1", "2", "3", "4"].map((m) => /* @__PURE__ */ e.jsx(Q, { value: m, children: m }, m)) })
4756
+ /* @__PURE__ */ e.jsx(pe, { children: ["0", "1", "2", "3", "4"].map((h) => /* @__PURE__ */ e.jsx(Q, { value: h, children: h }, h)) })
4752
4757
  ]
4753
4758
  }
4754
4759
  )
@@ -4756,18 +4761,18 @@ function Il() {
4756
4761
  /* @__PURE__ */ e.jsxs("div", { className: "w-full space-y-1", children: [
4757
4762
  /* @__PURE__ */ e.jsx(H, { children: "Suffix" }),
4758
4763
  /* @__PURE__ */ e.jsx(
4759
- Ce,
4764
+ Ne,
4760
4765
  {
4761
4766
  value: ((p = s == null ? void 0 : s.formatNumber) == null ? void 0 : p.suffix) || "",
4762
4767
  className: "h-8 font-mono text-xs focus-visible:ring-0 focus-visible:ring-ring focus-visible:ring-offset-0",
4763
4768
  placeholder: "K, M, B, %",
4764
- onChange: (m) => {
4765
- var f, u, k;
4769
+ onChange: (h) => {
4770
+ var f, m, k;
4766
4771
  return a(
4767
4772
  ((f = s == null ? void 0 : s.formatNumber) == null ? void 0 : f.decimalPlaces) || 0,
4768
- ((u = s == null ? void 0 : s.formatNumber) == null ? void 0 : u.currency) || "",
4773
+ ((m = s == null ? void 0 : s.formatNumber) == null ? void 0 : m.currency) || "",
4769
4774
  ((k = s == null ? void 0 : s.formatNumber) == null ? void 0 : k.locale) || "",
4770
- m.target.value
4775
+ h.target.value
4771
4776
  );
4772
4777
  }
4773
4778
  }
@@ -4780,7 +4785,7 @@ function Il() {
4780
4785
  en,
4781
4786
  {
4782
4787
  colorRanges: o,
4783
- setColorRanges: r
4788
+ setColorRanges: i
4784
4789
  }
4785
4790
  )
4786
4791
  ] })
@@ -4788,7 +4793,7 @@ function Il() {
4788
4793
  }
4789
4794
  function Dl() {
4790
4795
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
4791
- /* @__PURE__ */ e.jsx(Te, { type: "single", collapsible: !0, children: /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4796
+ /* @__PURE__ */ e.jsx(Le, { type: "single", collapsible: !0, children: /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4792
4797
  /* @__PURE__ */ e.jsx(U, { className: "", children: "KPI Query" }),
4793
4798
  /* @__PURE__ */ e.jsxs(G, { className: "font-mono", children: [
4794
4799
  /* @__PURE__ */ e.jsx("div", { className: "rounded bg-muted px-2 py-1 font-mono text-xs", children: "SELECT current, previous FROM table" }),
@@ -4838,11 +4843,11 @@ function Ml() {
4838
4843
  defaultValue: "x",
4839
4844
  children: [
4840
4845
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
4841
- /* @__PURE__ */ e.jsx(Le, { value: "static", id: "r1" }),
4846
+ /* @__PURE__ */ e.jsx(Te, { value: "static", id: "r1" }),
4842
4847
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r1", children: "Static" })
4843
4848
  ] }),
4844
4849
  /* @__PURE__ */ e.jsxs("div", { className: "flex items-center space-x-2", children: [
4845
- /* @__PURE__ */ e.jsx(Le, { value: "dynamic", id: "r2" }),
4850
+ /* @__PURE__ */ e.jsx(Te, { value: "dynamic", id: "r2" }),
4846
4851
  /* @__PURE__ */ e.jsx("label", { className: "text-sm", htmlFor: "r2", children: "Dynamic" })
4847
4852
  ] })
4848
4853
  ]
@@ -4854,7 +4859,7 @@ function Ye({
4854
4859
  docContent: n,
4855
4860
  suffix: a = "Chart"
4856
4861
  }) {
4857
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
4862
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
4858
4863
  /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4859
4864
  /* @__PURE__ */ e.jsx(U, { children: `${Vs(s)} ${a}` }),
4860
4865
  /* @__PURE__ */ e.jsx(G, { children: n || /* @__PURE__ */ e.jsxs("div", { className: "space-y-4 font-mono text-xs", children: [
@@ -4933,7 +4938,7 @@ function Ol() {
4933
4938
  )
4934
4939
  ] });
4935
4940
  }
4936
- return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Te, { defaultValue: ["item-2"], type: "multiple", children: [
4941
+ return /* @__PURE__ */ e.jsx("div", { className: "space-y-6 px-6 py-2", children: /* @__PURE__ */ e.jsxs(Le, { defaultValue: ["item-2"], type: "multiple", children: [
4937
4942
  /* @__PURE__ */ e.jsxs(P, { value: "item-1", children: [
4938
4943
  /* @__PURE__ */ e.jsx(U, { children: "Stacked Chart" }),
4939
4944
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 font-mono text-xs", children: [
@@ -4989,7 +4994,7 @@ function Al({}) {
4989
4994
  });
4990
4995
  };
4991
4996
  return /* @__PURE__ */ e.jsxs("div", { className: "space-y-6 px-6 py-2", children: [
4992
- /* @__PURE__ */ e.jsx(Te, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ e.jsxs(P, { value: "item-3", children: [
4997
+ /* @__PURE__ */ e.jsx(Le, { defaultValue: ["item-3"], type: "multiple", children: /* @__PURE__ */ e.jsxs(P, { value: "item-3", children: [
4993
4998
  /* @__PURE__ */ e.jsx(U, { children: "Filters" }),
4994
4999
  /* @__PURE__ */ e.jsxs(G, { className: "space-y-4 px-2", children: [
4995
5000
  /* @__PURE__ */ e.jsx(Ae, {}),
@@ -5096,7 +5101,7 @@ function Rl() {
5096
5101
  case "custom":
5097
5102
  return /* @__PURE__ */ e.jsx(vl, {});
5098
5103
  default:
5099
- return /* @__PURE__ */ e.jsx(Ll, {});
5104
+ return /* @__PURE__ */ e.jsx(Tl, {});
5100
5105
  }
5101
5106
  }
5102
5107
  return /* @__PURE__ */ e.jsx(Es, { className: "h-full w-full text-sm", children: n(s) });
@@ -5148,7 +5153,7 @@ function _l() {
5148
5153
  );
5149
5154
  }
5150
5155
  function Hl({ authToken: s, onSave: n, onClose: a }) {
5151
- const t = c((r) => r.actions.setOnSave), l = c((r) => r.actions.setOnClose), o = z((r) => r.actions.setAuthToken);
5156
+ const t = c((i) => i.actions.setOnSave), l = c((i) => i.actions.setOnClose), o = z((i) => i.actions.setAuthToken);
5152
5157
  return Y(() => {
5153
5158
  n && t(n), a && l(a);
5154
5159
  }, [n, t, a, l]), Y(() => {
@@ -5159,10 +5164,10 @@ function Hl({ authToken: s, onSave: n, onClose: a }) {
5159
5164
  ] }) });
5160
5165
  }
5161
5166
  function $l() {
5162
- z((r) => r.selectedCardId);
5163
- const s = z((r) => r.selectedSheetId), { setIsVisualEditing: n } = z((r) => r.actions), a = z((r) => r.isVisualEditing), t = z((r) => r.actions.updateFrame);
5164
- function l(r) {
5165
- s && (t(s, r), n(!1));
5167
+ z((i) => i.selectedCardId);
5168
+ const s = z((i) => i.selectedSheetId), { setIsVisualEditing: n } = z((i) => i.actions), a = z((i) => i.isVisualEditing), t = z((i) => i.actions.updateFrame);
5169
+ function l(i) {
5170
+ s && (t(s, i), n(!1));
5166
5171
  }
5167
5172
  function o() {
5168
5173
  n(!1);
@@ -5180,22 +5185,22 @@ function $l() {
5180
5185
  );
5181
5186
  }
5182
5187
  function Bl() {
5183
- c((r) => r.selectedConnectionId), c((r) => r.selectedDatamodelId);
5184
- const s = c((r) => r.selectedDatabaseName);
5185
- c((r) => r.selectedSchemaName);
5186
- const n = c((r) => r.selectedTableName), a = z((r) => r.dashboard.filters) || [];
5187
- z((r) => r.actions.addFilter), z((r) => r.actions.removeFilter), z(
5188
- (r) => r.actions.removeFilterValue
5188
+ c((i) => i.selectedConnectionId), c((i) => i.selectedDatamodelId);
5189
+ const s = c((i) => i.selectedDatabaseName);
5190
+ c((i) => i.selectedSchemaName);
5191
+ const n = c((i) => i.selectedTableName), a = z((i) => i.dashboard.filters) || [];
5192
+ z((i) => i.actions.addFilter), z((i) => i.actions.removeFilter), z(
5193
+ (i) => i.actions.removeFilterValue
5189
5194
  );
5190
5195
  const { modelItems: t, columns: l } = Oe(), { assignFilter: o } = Ba();
5191
- 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) => {
5196
+ 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) => {
5192
5197
  const d = a == null ? void 0 : a.find(
5193
- (i) => i.column === ue(r.column_name) && i.table === n && i.database === s
5198
+ (r) => r.column === ue(i.column_name) && r.table === n && r.database === s
5194
5199
  );
5195
5200
  return /* @__PURE__ */ e.jsx(
5196
5201
  "div",
5197
5202
  {
5198
- onClick: () => o(r),
5203
+ onClick: () => o(i),
5199
5204
  className: X(
5200
5205
  "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",
5201
5206
  {
@@ -5203,11 +5208,11 @@ function Bl() {
5203
5208
  }
5204
5209
  ),
5205
5210
  children: /* @__PURE__ */ e.jsxs("div", { className: "flex items-center gap-2", children: [
5206
- /* @__PURE__ */ e.jsx(za, { column: r }),
5207
- /* @__PURE__ */ e.jsx("span", { children: r.column_name })
5211
+ /* @__PURE__ */ e.jsx(za, { column: i }),
5212
+ /* @__PURE__ */ e.jsx("span", { children: i.column_name })
5208
5213
  ] })
5209
5214
  },
5210
- r.column_name
5215
+ i.column_name
5211
5216
  );
5212
5217
  }) });
5213
5218
  }
@@ -5329,11 +5334,11 @@ export {
5329
5334
  gn as E,
5330
5335
  _s as F,
5331
5336
  vn as G,
5332
- Nn as H,
5337
+ Cn as H,
5333
5338
  wn as K,
5334
5339
  Pe as L,
5335
- Ln as M,
5336
- Tn as N,
5340
+ Tn as M,
5341
+ Ln as N,
5337
5342
  Sa as P,
5338
5343
  qe as S,
5339
5344
  Vn as T,
@@ -5342,8 +5347,8 @@ export {
5342
5347
  Rs as b,
5343
5348
  _n as c,
5344
5349
  va as d,
5345
- Na as e,
5346
- Ca as f,
5350
+ Ca as e,
5351
+ Na as f,
5347
5352
  ka as g,
5348
5353
  xn as h,
5349
5354
  pn as i,
@@ -5351,7 +5356,7 @@ export {
5351
5356
  jn as k,
5352
5357
  yn as l,
5353
5358
  bn as m,
5354
- Cn as n,
5359
+ Nn as n,
5355
5360
  Sn as o,
5356
5361
  kn as p,
5357
5362
  zn as q,