drizzle-cube 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (25) hide show
  1. package/dist/adapters/express/index.cjs +1 -1
  2. package/dist/adapters/express/index.js +1 -1
  3. package/dist/adapters/fastify/index.cjs +1 -1
  4. package/dist/adapters/fastify/index.js +1 -1
  5. package/dist/adapters/hono/index.cjs +1 -1
  6. package/dist/adapters/hono/index.js +1 -1
  7. package/dist/adapters/{mcp-transport-Bbz3qrIy.js → mcp-transport-Dmolep14.js} +31 -26
  8. package/dist/adapters/{mcp-transport-CXF4E5QJ.cjs → mcp-transport-h__yKJm9.cjs} +3 -3
  9. package/dist/adapters/nextjs/index.cjs +1 -1
  10. package/dist/adapters/nextjs/index.js +1 -1
  11. package/dist/client/chunks/{DashboardEditModal-Bv7e3Q7O.js → DashboardEditModal-fg72EPDl.js} +14 -13
  12. package/dist/client/chunks/DashboardEditModal-fg72EPDl.js.map +1 -0
  13. package/dist/client/chunks/{analysis-builder-BfH-w92z.js → analysis-builder-C1QDrzgM.js} +101 -101
  14. package/dist/client/chunks/{analysis-builder-BfH-w92z.js.map → analysis-builder-C1QDrzgM.js.map} +1 -1
  15. package/dist/client/chunks/{analysis-builder-shared-DsbdRCzz.js → analysis-builder-shared-BkwUHObk.js} +160 -159
  16. package/dist/client/chunks/analysis-builder-shared-BkwUHObk.js.map +1 -0
  17. package/dist/client/components.js +1 -1
  18. package/dist/client/index.js +2 -2
  19. package/dist/client/utils/filterUtils.d.ts +6 -0
  20. package/dist/client-bundle-stats.html +1 -1
  21. package/dist/server/index.cjs +31 -31
  22. package/dist/server/index.js +1512 -1507
  23. package/package.json +1 -1
  24. package/dist/client/chunks/DashboardEditModal-Bv7e3Q7O.js.map +0 -1
  25. package/dist/client/chunks/analysis-builder-shared-DsbdRCzz.js.map +0 -1
@@ -1,13 +1,13 @@
1
1
  import { jsxs as t, jsx as e, Fragment as ie } from "react/jsx-runtime";
2
- import { useState as G, useCallback as F, memo as me, useEffect as Y, useRef as Z, useMemo as z, Component as fd, forwardRef as qc, useImperativeHandle as pd } from "react";
2
+ import { useState as G, useCallback as F, memo as me, useEffect as z, useRef as Z, useMemo as Y, Component as fd, forwardRef as qc, useImperativeHandle as pd } from "react";
3
3
  import { u as xd, g as bd } from "./providers-D2xswCYu.js";
4
- import { F as gd, G as Ce, E as sc, C as Ct, D as yd, H as vd, q as Nd, I as wd, u as Cd, J as Sd } from "./analysis-builder-shared-DsbdRCzz.js";
5
- import { Y as Wt, Z as Dd, f as kd, a2 as Td, a3 as jc, a4 as Qc, a5 as Gc, a6 as Ad } from "./DashboardEditModal-Bv7e3Q7O.js";
4
+ import { F as gd, G as Ce, E as sc, C as Ct, D as yd, H as vd, q as Nd, I as wd, u as Cd, J as Sd } from "./analysis-builder-shared-BkwUHObk.js";
5
+ import { Z as Wt, _ as Dd, f as kd, a3 as Td, a4 as jc, a5 as Qc, a6 as Gc, a7 as Ad } from "./DashboardEditModal-fg72EPDl.js";
6
6
  import { i as $d, L as ac } from "./charts-loader-7pEaEz-f.js";
7
7
  import { useExplainQuery as ht, useExplainAI as Id } from "../hooks.js";
8
8
  import { b as $, g as dc } from "./icons-DRreo6m8.js";
9
9
  import { S as ue } from "./charts-core-DAF1iT_h.js";
10
- import { p as Rd, q as Fd, r as Ed, D as Ut, s as ft, n as Ye, F as _c } from "./useDirtyStateTracking-CTS_m9mg.js";
10
+ import { p as Rd, q as Fd, r as Ed, D as Ut, s as ft, n as ze, F as _c } from "./useDirtyStateTracking-CTS_m9mg.js";
11
11
  import { useChartConfig as Od } from "../charts.js";
12
12
  import { AnalysisDisplayConfigPanel as St } from "../components.js";
13
13
  import { b as ic, F as oc } from "./flow-utils-CjQZG5qq.js";
@@ -548,7 +548,7 @@ const Vd = me(function({
548
548
  warnings: we
549
549
  }) {
550
550
  const ae = ee === "funnel" || pe, fe = ee === "flow", he = ee === "retention", [be, Ie] = G(!1), [ge, $e] = G(0), [Re, Se] = G(!1), [Je, Pe] = G(!1), [O, Q] = G(!1), [J, ce] = G("idle");
551
- Y(() => {
551
+ z(() => {
552
552
  const S = (K) => {
553
553
  K.key === "Shift" && Pe(!0);
554
554
  }, H = (K) => {
@@ -559,7 +559,7 @@ const Vd = me(function({
559
559
  };
560
560
  }, []);
561
561
  const xe = Je && O;
562
- Y(() => {
562
+ z(() => {
563
563
  o.length > 0 && ge >= o.length && $e(o.length - 1);
564
564
  }, [o.length, ge]);
565
565
  const De = o[ge] || {
@@ -616,22 +616,22 @@ const Vd = me(function({
616
616
  analyze: rt,
617
617
  clearAnalysis: st
618
618
  } = Id();
619
- Y(() => {
619
+ z(() => {
620
620
  Ze();
621
- }, [ge, Ze]), Y(() => {
621
+ }, [ge, Ze]), z(() => {
622
622
  et();
623
- }, [W, et]), Y(() => {
623
+ }, [W, et]), z(() => {
624
624
  tt();
625
625
  }, [_, tt]);
626
626
  const at = Z(!0);
627
- Y(() => {
627
+ z(() => {
628
628
  if (at.current) {
629
629
  at.current = !1;
630
630
  return;
631
631
  }
632
632
  ee === "funnel" || ee === "flow" || ee === "retention" || ae || !u && C === "chart" && R("table");
633
633
  }, [u, C, R, ae, ee]);
634
- const ve = z(() => {
634
+ const ve = Y(() => {
635
635
  if (!h || h.length === 0) return;
636
636
  if (h.length === 1) return h[0];
637
637
  const S = h.flatMap((H) => H?.measures || []);
@@ -651,7 +651,7 @@ const Vd = me(function({
651
651
  /* @__PURE__ */ e("div", { className: "dc:text-xs text-dc-text-muted", children: "Running your query against the cube API" })
652
652
  ] }) }), Ne = () => /* @__PURE__ */ t("div", { className: "dc:h-full dc:flex dc:flex-col", children: [
653
653
  Jt(),
654
- /* @__PURE__ */ e("div", { className: "dc:flex-1 dc:flex dc:items-center dc:justify-center dc:p-4", children: be ? /* @__PURE__ */ e("div", { className: "dc:w-full dc:h-full dc:overflow-auto", children: zt() }) : /* @__PURE__ */ t("div", { className: "dc:text-center dc:max-w-md", children: [
654
+ /* @__PURE__ */ e("div", { className: "dc:flex-1 dc:flex dc:items-center dc:justify-center dc:p-4", children: be ? /* @__PURE__ */ e("div", { className: "dc:w-full dc:h-full dc:overflow-auto", children: Yt() }) : /* @__PURE__ */ t("div", { className: "dc:text-center dc:max-w-md", children: [
655
655
  /* @__PURE__ */ e(it, { className: "dc:w-12 dc:h-12 dc:mx-auto text-dc-error dc:mb-4" }),
656
656
  /* @__PURE__ */ e("div", { className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2", children: "Query Execution Failed" }),
657
657
  /* @__PURE__ */ e("div", { className: "dc:text-sm text-dc-text-secondary dc:mb-4", children: "There was an error executing your query. Please check the query and try again." }),
@@ -659,7 +659,7 @@ const Vd = me(function({
659
659
  ] }) })
660
660
  ] }), nc = !!h?.some(
661
661
  (S) => S?.measures && S.measures.length > 0 || S?.dimensions && S.dimensions.length > 0 || S?.timeDimensions && S.timeDimensions.length > 0
662
- ), Ht = z(() => he ? X !== null : ae ? W !== null : fe ? _ !== null : nc, [he, ae, fe, X, W, _, nc]), Xc = () => /* @__PURE__ */ e("div", { className: "dc:h-full dc:flex dc:items-center dc:justify-center", children: /* @__PURE__ */ t("div", { className: "dc:text-center", children: [
662
+ ), Ht = Y(() => he ? X !== null : ae ? W !== null : fe ? _ !== null : nc, [he, ae, fe, X, W, _, nc]), Xc = () => /* @__PURE__ */ e("div", { className: "dc:h-full dc:flex dc:items-center dc:justify-center", children: /* @__PURE__ */ t("div", { className: "dc:text-center", children: [
663
663
  /* @__PURE__ */ e(
664
664
  "div",
665
665
  {
@@ -772,7 +772,7 @@ const Vd = me(function({
772
772
  title: `Server Response (${de.rows.length} rows, ${de.periods.length} periods)`,
773
773
  maxHeight: "24rem"
774
774
  }
775
- ) : Vt() }), Yt = (S) => {
775
+ ) : Vt() }), zt = (S) => {
776
776
  const H = S.debugData?.sql, K = S.debugData?.loading || !1, se = S.debugData?.error || null;
777
777
  return /* @__PURE__ */ t("div", { className: "dc:p-4 dc:space-y-4 dc:overflow-auto dc:h-full", children: [
778
778
  /* @__PURE__ */ t("div", { className: "dc:flex dc:items-center dc:gap-2 dc:mb-4", children: [
@@ -934,7 +934,7 @@ const Vd = me(function({
934
934
  /* @__PURE__ */ e("h4", { className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2", children: "Server Response" }),
935
935
  /* @__PURE__ */ e("div", { className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm", children: "No results yet" })
936
936
  ] }) })
937
- ] }), zt = () => {
937
+ ] }), Yt = () => {
938
938
  if (ae) {
939
939
  const S = I?.modeMetadata, H = S ? /* @__PURE__ */ e("div", { className: "dc:flex dc:flex-wrap dc:gap-2", children: S.steps.map((K, se) => /* @__PURE__ */ t("div", { className: "dc:flex dc:items-center dc:gap-2 dc:px-3 dc:py-1.5 bg-dc-bg dc:border border-dc-border dc:rounded dc:text-sm", children: [
940
940
  /* @__PURE__ */ e("span", { className: "dc:w-5 dc:h-5 dc:flex dc:items-center dc:justify-center bg-dc-accent text-white dc:text-xs dc:rounded-full", children: se + 1 }),
@@ -945,7 +945,7 @@ const Vd = me(function({
945
945
  ")"
946
946
  ] })
947
947
  ] }, se)) }) : null;
948
- return Yt({
948
+ return zt({
949
949
  label: "Funnel Query",
950
950
  badgeText: S?.stepCount ? `${S.stepCount} steps` : void 0,
951
951
  serverQuery: W,
@@ -1017,7 +1017,7 @@ const Vd = me(function({
1017
1017
  ] })
1018
1018
  ] }) })
1019
1019
  ] }) : null;
1020
- return Yt({
1020
+ return zt({
1021
1021
  label: "Retention Query",
1022
1022
  badgeText: S ? `${S.segmentCount || 1} segment(s), ${S.totalUsers} users` : void 0,
1023
1023
  serverQuery: X,
@@ -1065,7 +1065,7 @@ const Vd = me(function({
1065
1065
  /* @__PURE__ */ e("span", { className: "text-dc-text", children: S.stepsAfter ?? "Not set" })
1066
1066
  ] })
1067
1067
  ] }) : null;
1068
- return Yt({
1068
+ return zt({
1069
1069
  label: "Flow Query",
1070
1070
  badgeText: S ? `${S.stepsBefore} before, ${S.stepsAfter} after` : void 0,
1071
1071
  serverQuery: _,
@@ -1341,7 +1341,7 @@ const Vd = me(function({
1341
1341
  Jt(),
1342
1342
  od(),
1343
1343
  ld(),
1344
- /* @__PURE__ */ e("div", { className: "dc:flex-1 dc:min-h-0 dc:relative dc:overflow-auto", children: be ? zt() : C === "chart" ? /* @__PURE__ */ e("div", { className: "dc:p-4 dc:h-full", children: cd() }) : fe ? /* @__PURE__ */ e("div", { className: "dc:h-full", children: ad() }, "table-flow") : ut ? /* @__PURE__ */ e("div", { className: "dc:h-full", children: rc(U) }, `table-${U}`) : /* @__PURE__ */ e("div", { className: "dc:h-full", children: rc() }, "table-single") }),
1344
+ /* @__PURE__ */ e("div", { className: "dc:flex-1 dc:min-h-0 dc:relative dc:overflow-auto", children: be ? Yt() : C === "chart" ? /* @__PURE__ */ e("div", { className: "dc:p-4 dc:h-full", children: cd() }) : fe ? /* @__PURE__ */ e("div", { className: "dc:h-full", children: ad() }, "table-flow") : ut ? /* @__PURE__ */ e("div", { className: "dc:h-full", children: rc(U) }, `table-${U}`) : /* @__PURE__ */ e("div", { className: "dc:h-full", children: rc() }, "table-single") }),
1345
1345
  !be && /* @__PURE__ */ e("div", { className: "dc:px-4 dc:py-3 dc:border-t border-dc-border bg-dc-surface dc:flex dc:justify-center dc:flex-shrink-0", children: /* @__PURE__ */ t("div", { className: "dc:flex dc:items-center bg-dc-surface-secondary dc:border border-dc-border dc:rounded-md dc:overflow-hidden", children: [
1346
1346
  /* @__PURE__ */ t(
1347
1347
  "button",
@@ -1402,8 +1402,8 @@ const Vd = me(function({
1402
1402
  ] }) })
1403
1403
  ] }) : /* @__PURE__ */ t("div", { className: "dc:h-full dc:flex dc:flex-col", children: [
1404
1404
  Jt(),
1405
- /* @__PURE__ */ e("div", { className: "dc:flex-1 dc:min-h-0 dc:relative dc:overflow-auto", children: be ? zt() : td() })
1406
- ] }), Ee = z(() => {
1405
+ /* @__PURE__ */ e("div", { className: "dc:flex-1 dc:min-h-0 dc:relative dc:overflow-auto", children: be ? Yt() : td() })
1406
+ ] }), Ee = Y(() => {
1407
1407
  if (a === null) return !1;
1408
1408
  if (!Array.isArray(a)) return !0;
1409
1409
  if (a.length === 0) return !1;
@@ -1438,7 +1438,7 @@ const Vd = me(function({
1438
1438
  }
1439
1439
  )
1440
1440
  ] });
1441
- }), Yd = me(function({
1441
+ }), zd = me(function({
1442
1442
  metric: d,
1443
1443
  fieldMeta: a,
1444
1444
  onRemove: s,
@@ -1510,7 +1510,7 @@ const Vd = me(function({
1510
1510
  ]
1511
1511
  }
1512
1512
  );
1513
- }), zd = $("add");
1513
+ }), Yd = $("add");
1514
1514
  function Jd(r, d) {
1515
1515
  if (!d?.cubes) return null;
1516
1516
  const [a] = r.split("."), s = d.cubes.find((m) => m.name === a);
@@ -1537,7 +1537,7 @@ const Ud = me(function({
1537
1537
  onOrderChange: x,
1538
1538
  onReorder: g
1539
1539
  }) {
1540
- const [i, l] = G(null), [b, c] = G(null), h = Z(null), w = Z(null), C = z(() => n ? Object.keys(n) : [], [n]), R = z(() => d.map((p, L) => {
1540
+ const [i, l] = G(null), [b, c] = G(null), h = Z(null), w = Z(null), C = Y(() => n ? Object.keys(n) : [], [n]), R = Y(() => d.map((p, L) => {
1541
1541
  const P = n?.[p.field] || null, k = P ? C.indexOf(p.field) + 1 : void 0;
1542
1542
  return {
1543
1543
  metric: p,
@@ -1604,7 +1604,7 @@ const Ud = me(function({
1604
1604
  title: "Add metric",
1605
1605
  children: [
1606
1606
  /* @__PURE__ */ e(ue, { children: "Metrics" }),
1607
- /* @__PURE__ */ e(zd, { className: "dc:w-5 dc:h-5 text-dc-text-secondary group-hover:text-dc-primary dc:transition-colors" })
1607
+ /* @__PURE__ */ e(Yd, { className: "dc:w-5 dc:h-5 text-dc-text-secondary group-hover:text-dc-primary dc:transition-colors" })
1608
1608
  ]
1609
1609
  }
1610
1610
  ),
@@ -1631,7 +1631,7 @@ const Ud = me(function({
1631
1631
  children: [
1632
1632
  E && /* @__PURE__ */ e("div", { className: "dc:absolute dc:-top-5 dc:left-0 dc:right-0 dc:flex dc:items-center dc:justify-center dc:pointer-events-none dc:z-10", children: /* @__PURE__ */ e("div", { className: "dc:h-0.5 dc:w-full bg-dc-primary dc:rounded-full" }) }),
1633
1633
  /* @__PURE__ */ e(
1634
- Yd,
1634
+ zd,
1635
1635
  {
1636
1636
  metric: p,
1637
1637
  fieldMeta: L,
@@ -1803,7 +1803,7 @@ const Hc = me(function({
1803
1803
  onOrderChange: i,
1804
1804
  onReorder: l
1805
1805
  }) {
1806
- const [b, c] = G(null), [h, w] = G(null), C = Z(null), R = Z(null), T = z(() => g ? Object.keys(g) : [], [g]), B = z(() => d.find((v) => v.isTimeDimension && v.enableComparison)?.id || null, [d]), u = z(() => d.map((k, v) => {
1806
+ const [b, c] = G(null), [h, w] = G(null), C = Z(null), R = Z(null), T = Y(() => g ? Object.keys(g) : [], [g]), B = Y(() => d.find((v) => v.isTimeDimension && v.enableComparison)?.id || null, [d]), u = Y(() => d.map((k, v) => {
1807
1807
  const A = g?.[k.field] || null, E = A ? T.indexOf(k.field) + 1 : void 0;
1808
1808
  return {
1809
1809
  breakdown: k,
@@ -1953,7 +1953,7 @@ function rn({
1953
1953
  error: W,
1954
1954
  searchValues: I
1955
1955
  } = Ed(n.member, re);
1956
- Y(() => {
1956
+ z(() => {
1957
1957
  if (!m) {
1958
1958
  f(null);
1959
1959
  return;
@@ -1966,21 +1966,21 @@ function rn({
1966
1966
  top: O.bottom + 8,
1967
1967
  left: ke
1968
1968
  });
1969
- }, [m]), Y(() => {
1969
+ }, [m]), z(() => {
1970
1970
  const O = (Q) => {
1971
1971
  D.current && !D.current.contains(Q.target) && (i(!1), b(!1), h(!1));
1972
1972
  };
1973
1973
  return document.addEventListener("mousedown", O), () => document.removeEventListener("mousedown", O);
1974
- }, []), Y(() => {
1974
+ }, []), z(() => {
1975
1975
  l && re && I && I("", !0), l || N(-1);
1976
- }, [l, re, I]), Y(() => {
1976
+ }, [l, re, I]), z(() => {
1977
1977
  if (y >= 0 && p.current) {
1978
1978
  const O = p.current.children[y];
1979
1979
  O && O.scrollIntoView({ block: "nearest" });
1980
1980
  }
1981
- }, [y]), Y(() => {
1981
+ }, [y]), z(() => {
1982
1982
  l && re && I && L !== void 0 && I(L);
1983
- }, [L, l, re, I]), Y(() => {
1983
+ }, [L, l, re, I]), z(() => {
1984
1984
  if (!(!U || !n.dateRange))
1985
1985
  if (Array.isArray(n.dateRange))
1986
1986
  C("custom");
@@ -1995,7 +1995,7 @@ function rn({
1995
1995
  } else {
1996
1996
  let J = !1;
1997
1997
  for (const ce of Ut)
1998
- if (ce.value !== "custom" && !ft(ce.value) && Ye(ce.value) === n.dateRange) {
1998
+ if (ce.value !== "custom" && !ft(ce.value) && ze(ce.value) === n.dateRange) {
1999
1999
  C(ce.value), J = !0;
2000
2000
  break;
2001
2001
  }
@@ -2057,11 +2057,11 @@ function rn({
2057
2057
  if (O === "custom") {
2058
2058
  const J = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
2059
2059
  Q = [J, J];
2060
- } else ft(O) ? Q = Ye(O, R) : Q = Ye(O);
2060
+ } else ft(O) ? Q = ze(O, R) : Q = ze(O);
2061
2061
  x({ ...n, dateRange: Q });
2062
2062
  }, [n, R]), he = F((O) => {
2063
2063
  if (T(O), ft(w)) {
2064
- const Q = Ye(w, O);
2064
+ const Q = ze(w, O);
2065
2065
  x({ ...n, dateRange: Q });
2066
2066
  }
2067
2067
  }, [n, w]), be = F((O) => {
@@ -2411,7 +2411,7 @@ function hn(r) {
2411
2411
  function fn(r) {
2412
2412
  return "type" in r && (r.type === "and" || r.type === "or");
2413
2413
  }
2414
- function Yc({
2414
+ function zc({
2415
2415
  group: r,
2416
2416
  schema: d,
2417
2417
  onUpdate: a,
@@ -2421,7 +2421,7 @@ function Yc({
2421
2421
  hideRemoveButton: x = !1
2422
2422
  }) {
2423
2423
  const [g, i] = G(!1), l = Z(null);
2424
- Y(() => {
2424
+ z(() => {
2425
2425
  const f = (y) => {
2426
2426
  l.current && !l.current.contains(y.target) && i(!1);
2427
2427
  };
@@ -2531,7 +2531,7 @@ function Yc({
2531
2531
  },
2532
2532
  `filter-${y}`
2533
2533
  ) : fn(f) ? /* @__PURE__ */ e(
2534
- Yc,
2534
+ zc,
2535
2535
  {
2536
2536
  group: f,
2537
2537
  schema: d,
@@ -2551,10 +2551,10 @@ function Dt(r) {
2551
2551
  function Le(r) {
2552
2552
  return "type" in r && (r.type === "and" || r.type === "or");
2553
2553
  }
2554
- function zc(r) {
2554
+ function Yc(r) {
2555
2555
  let d = 0;
2556
2556
  for (const a of r)
2557
- Dt(a) ? d++ : Le(a) && (d += zc(a.filters));
2557
+ Dt(a) ? d++ : Le(a) && (d += Yc(a.filters));
2558
2558
  return d;
2559
2559
  }
2560
2560
  function Jc(r) {
@@ -2578,14 +2578,14 @@ function Wc(r, d, a) {
2578
2578
  filters: Wc(x.filters, m, a)
2579
2579
  }), n;
2580
2580
  }
2581
- function ze({
2581
+ function Ye({
2582
2582
  filters: r,
2583
2583
  schema: d,
2584
2584
  onFiltersChange: a,
2585
2585
  onFieldDropped: s,
2586
2586
  dimensionsOnly: m = !1
2587
2587
  }) {
2588
- const [n, x] = G(!1), [g, i] = G(!1), l = Z([]), b = zc(r), c = F((N) => {
2588
+ const [n, x] = G(!1), [g, i] = G(!1), l = Z([]), b = Yc(r), c = F((N) => {
2589
2589
  N.preventDefault(), N.stopPropagation(), i(!0);
2590
2590
  }, []), h = F((N) => {
2591
2591
  N.preventDefault(), N.stopPropagation(), i(!1);
@@ -2603,7 +2603,7 @@ function ze({
2603
2603
  operator: P,
2604
2604
  values: []
2605
2605
  };
2606
- L && P === "inDateRange" && (k.dateRange = Ye("this_month"));
2606
+ L && P === "inDateRange" && (k.dateRange = ze("this_month"));
2607
2607
  const v = Wc(r, l.current, k);
2608
2608
  a(v), x(!1), l.current = [];
2609
2609
  },
@@ -2645,7 +2645,7 @@ function ze({
2645
2645
  },
2646
2646
  `filter-${L.join("-")}`
2647
2647
  ) : Le(N) ? /* @__PURE__ */ e(
2648
- Yc,
2648
+ zc,
2649
2649
  {
2650
2650
  group: N,
2651
2651
  schema: d,
@@ -2743,14 +2743,14 @@ function vn({
2743
2743
  let I = d.length;
2744
2744
  return i && i.fromAxis === h && (I = Math.max(0, d.length - 1)), T && I >= T;
2745
2745
  }, E = v(), M = A();
2746
- Y(() => {
2746
+ z(() => {
2747
2747
  const I = () => {
2748
2748
  o(null), k.current = null, y(!1), D(!1), p.current = null;
2749
2749
  };
2750
2750
  return document.addEventListener("dragend", I), () => {
2751
2751
  document.removeEventListener("dragend", I);
2752
2752
  };
2753
- }, []), Y(() => {
2753
+ }, []), z(() => {
2754
2754
  i ? i.fromAxis !== h ? (D(!1), o(null), k.current = null) : i.fromAxis === h && i.fromIndex !== void 0 && y(!1) : (o(null), k.current = null, y(!1), D(!1));
2755
2755
  }, [i, h]);
2756
2756
  const j = F((I, _) => {
@@ -2963,7 +2963,7 @@ function xc({
2963
2963
  excludeTypes: n = []
2964
2964
  }) {
2965
2965
  const [x, g] = G(!1), [i, l] = G(null);
2966
- Y(() => {
2966
+ z(() => {
2967
2967
  let C = !0;
2968
2968
  return import("./chartConfigRegistry-DNEbwgTc.js").then((R) => {
2969
2969
  C && l(R.chartConfigRegistry);
@@ -3057,7 +3057,7 @@ function Sn({
3057
3057
  onChartTypeChange: x,
3058
3058
  onChartConfigChange: g
3059
3059
  }) {
3060
- const [i, l] = G(null), b = z(
3060
+ const [i, l] = G(null), b = Y(
3061
3061
  () => ({
3062
3062
  measures: a.map((v) => v.field),
3063
3063
  dimensions: s.filter((v) => !v.isTimeDimension).map((v) => v.field),
@@ -3068,7 +3068,7 @@ function Sn({
3068
3068
  const A = d[v];
3069
3069
  return Array.isArray(A) ? A : typeof A == "string" ? [A] : [];
3070
3070
  }, [d]);
3071
- Y(() => {
3071
+ z(() => {
3072
3072
  if (!h) return;
3073
3073
  const v = [
3074
3074
  ...b.dimensions,
@@ -3306,12 +3306,12 @@ const bc = $("chevronDown"), gc = $("check"), yc = $("search"), Dn = me(function
3306
3306
  disabled: m = !1,
3307
3307
  className: n = ""
3308
3308
  }) {
3309
- const [x, g] = G(!1), [i, l] = G(""), b = Z(null), c = Z(null), h = z(() => Ct(s), [s]), w = z(() => {
3309
+ const [x, g] = G(!1), [i, l] = G(""), b = Z(null), c = Z(null), h = Y(() => Ct(s), [s]), w = Y(() => {
3310
3310
  const f = {};
3311
3311
  for (const y of h)
3312
3312
  f[y.cube] || (f[y.cube] = []), f[y.cube].push(y);
3313
3313
  return f;
3314
- }, [h]), C = z(() => {
3314
+ }, [h]), C = Y(() => {
3315
3315
  if (!i.trim()) return w;
3316
3316
  const f = i.toLowerCase(), y = {};
3317
3317
  for (const [N, D] of Object.entries(w)) {
@@ -3332,13 +3332,13 @@ const bc = $("chevronDown"), gc = $("check"), yc = $("search"), Dn = me(function
3332
3332
  },
3333
3333
  [a]
3334
3334
  );
3335
- Y(() => {
3335
+ z(() => {
3336
3336
  function f(y) {
3337
3337
  b.current && !b.current.contains(y.target) && (g(!1), l(""));
3338
3338
  }
3339
3339
  if (x)
3340
3340
  return document.addEventListener("mousedown", f), () => document.removeEventListener("mousedown", f);
3341
- }, [x]), Y(() => {
3341
+ }, [x]), z(() => {
3342
3342
  x && c.current && c.current.focus();
3343
3343
  }, [x]);
3344
3344
  const B = F(
@@ -3452,7 +3452,7 @@ const bc = $("chevronDown"), gc = $("check"), yc = $("search"), Dn = me(function
3452
3452
  disabled: s = !1,
3453
3453
  schema: m
3454
3454
  }) {
3455
- const n = z(() => m?.cubes?.some((g) => g.meta?.eventStream) ?? !1, [m]), x = z(() => In.filter((g) => g.type === "query" ? !0 : n), [n]);
3455
+ const n = Y(() => m?.cubes?.some((g) => g.meta?.eventStream) ?? !1, [m]), x = Y(() => In.filter((g) => g.type === "query" ? !0 : n), [n]);
3456
3456
  return /* @__PURE__ */ e("div", { className: "dc:flex dc:items-center dc:gap-0.5 dc:p-1.5 dc:border-b border-dc-border bg-dc-surface", children: x.map((g) => {
3457
3457
  const i = d === g.type, l = g.icon;
3458
3458
  return /* @__PURE__ */ t(
@@ -3506,12 +3506,12 @@ const Zt = me(function({
3506
3506
  onChange: x,
3507
3507
  helpText: g
3508
3508
  }) {
3509
- const [i, l] = G(!1), [b, c] = G(""), h = Z(null), w = Z(null), C = z(() => {
3509
+ const [i, l] = G(!1), [b, c] = G(""), h = Z(null), w = Z(null), C = Y(() => {
3510
3510
  const o = {};
3511
3511
  for (const f of n)
3512
3512
  o[f.cube] || (o[f.cube] = []), o[f.cube].push(f);
3513
3513
  return o;
3514
- }, [n]), R = z(() => {
3514
+ }, [n]), R = Y(() => {
3515
3515
  if (!b.trim()) return C;
3516
3516
  const o = b.toLowerCase(), f = {};
3517
3517
  for (const [y, N] of Object.entries(C)) {
@@ -3532,13 +3532,13 @@ const Zt = me(function({
3532
3532
  },
3533
3533
  [x]
3534
3534
  );
3535
- Y(() => {
3535
+ z(() => {
3536
3536
  function o(f) {
3537
3537
  h.current && !h.current.contains(f.target) && (l(!1), c(""));
3538
3538
  }
3539
3539
  if (i)
3540
3540
  return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
3541
- }, [i]), Y(() => {
3541
+ }, [i]), z(() => {
3542
3542
  i && w.current && w.current.focus();
3543
3543
  }, [i]);
3544
3544
  const u = d !== null;
@@ -3631,16 +3631,16 @@ const Zt = me(function({
3631
3631
  onBindingKeyChange: x,
3632
3632
  onTimeDimensionChange: g
3633
3633
  }) {
3634
- const i = z(() => Ln(m), [m]), l = z(() => {
3634
+ const i = Y(() => Ln(m), [m]), l = Y(() => {
3635
3635
  const u = Ct(m);
3636
3636
  return d ? u.filter((o) => o.cube === d) : [];
3637
- }, [m, d]), b = z(() => {
3637
+ }, [m, d]), b = Y(() => {
3638
3638
  const u = Bn(m);
3639
3639
  return d ? u.filter((o) => o.cube === d) : [];
3640
3640
  }, [m, d]), c = !!(d && a && s), [h, w] = G(!1), C = Z(!1);
3641
- Y(() => {
3641
+ z(() => {
3642
3642
  c && !C.current && (C.current = !0, w(!0));
3643
- }, [c]), Y(() => {
3643
+ }, [c]), z(() => {
3644
3644
  if (!d || !m) return;
3645
3645
  const u = m.cubes?.find((o) => o.name === d);
3646
3646
  if (u?.meta?.eventStream) {
@@ -3732,11 +3732,11 @@ const Zt = me(function({
3732
3732
  onUpdate: i
3733
3733
  }) {
3734
3734
  const [l, b] = G(!1), [c, h] = G(!1), [w, C] = G(d.name), R = Z(null), T = Z(null);
3735
- Y(() => {
3735
+ z(() => {
3736
3736
  C(d.name);
3737
- }, [d.name]), Y(() => {
3737
+ }, [d.name]), z(() => {
3738
3738
  l && R.current && (R.current.focus(), R.current.select());
3739
- }, [l]), Y(() => {
3739
+ }, [l]), z(() => {
3740
3740
  function p(L) {
3741
3741
  T.current && !T.current.contains(L.target) && h(!1);
3742
3742
  }
@@ -3766,7 +3766,7 @@ const Zt = me(function({
3766
3766
  i({ filters: p });
3767
3767
  },
3768
3768
  [i]
3769
- ), N = d.timeToConvert ? Tc.find((p) => p.value === d.timeToConvert)?.label || d.timeToConvert : "No limit", D = z(() => {
3769
+ ), N = d.timeToConvert ? Tc.find((p) => p.value === d.timeToConvert)?.label || d.timeToConvert : "No limit", D = Y(() => {
3770
3770
  if (!n) return null;
3771
3771
  const p = {
3772
3772
  cubes: n.cubes.map((L) => ({
@@ -3826,7 +3826,7 @@ const Zt = me(function({
3826
3826
  ] }),
3827
3827
  s && /* @__PURE__ */ t("div", { className: "dc:px-3 dc:py-3 dc:space-y-4", onClick: (p) => p.stopPropagation(), children: [
3828
3828
  /* @__PURE__ */ e(
3829
- ze,
3829
+ Ye,
3830
3830
  {
3831
3831
  filters: d.filters,
3832
3832
  schema: D,
@@ -4082,7 +4082,7 @@ function Vn(r) {
4082
4082
  });
4083
4083
  return d;
4084
4084
  }
4085
- function Yn(r) {
4085
+ function zn(r) {
4086
4086
  if (!r?.cubes) return [];
4087
4087
  const d = [];
4088
4088
  for (const a of r.cubes)
@@ -4103,12 +4103,12 @@ const xt = me(function({
4103
4103
  onChange: x,
4104
4104
  helpText: g
4105
4105
  }) {
4106
- const [i, l] = G(!1), [b, c] = G(""), h = Z(null), w = Z(null), C = z(() => {
4106
+ const [i, l] = G(!1), [b, c] = G(""), h = Z(null), w = Z(null), C = Y(() => {
4107
4107
  const o = {};
4108
4108
  for (const f of n)
4109
4109
  o[f.cube] || (o[f.cube] = []), o[f.cube].push(f);
4110
4110
  return o;
4111
- }, [n]), R = z(() => {
4111
+ }, [n]), R = Y(() => {
4112
4112
  if (!b.trim()) return C;
4113
4113
  const o = b.toLowerCase(), f = {};
4114
4114
  for (const [y, N] of Object.entries(C)) {
@@ -4129,13 +4129,13 @@ const xt = me(function({
4129
4129
  },
4130
4130
  [x]
4131
4131
  );
4132
- Y(() => {
4132
+ z(() => {
4133
4133
  function o(f) {
4134
4134
  h.current && !h.current.contains(f.target) && (l(!1), c(""));
4135
4135
  }
4136
4136
  if (i)
4137
4137
  return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
4138
- }, [i]), Y(() => {
4138
+ }, [i]), z(() => {
4139
4139
  i && w.current && w.current.focus();
4140
4140
  }, [i]);
4141
4141
  const u = d !== null;
@@ -4219,7 +4219,7 @@ const xt = me(function({
4219
4219
  ] })
4220
4220
  ] })
4221
4221
  ] });
4222
- }), zn = me(function({
4222
+ }), Yn = me(function({
4223
4223
  selectedCube: d,
4224
4224
  bindingKey: a,
4225
4225
  timeDimension: s,
@@ -4230,19 +4230,19 @@ const xt = me(function({
4230
4230
  onTimeDimensionChange: i,
4231
4231
  onEventDimensionChange: l
4232
4232
  }) {
4233
- const b = z(() => Hn(n), [n]), c = z(() => {
4233
+ const b = Y(() => Hn(n), [n]), c = Y(() => {
4234
4234
  const y = Ct(n);
4235
4235
  return d ? y.filter((N) => N.cube === d) : [];
4236
- }, [n, d]), h = z(() => {
4236
+ }, [n, d]), h = Y(() => {
4237
4237
  const y = Vn(n);
4238
4238
  return d ? y.filter((N) => N.cube === d) : [];
4239
- }, [n, d]), w = z(() => {
4240
- const y = Yn(n);
4239
+ }, [n, d]), w = Y(() => {
4240
+ const y = zn(n);
4241
4241
  return d ? y.filter((N) => N.cube === d) : [];
4242
4242
  }, [n, d]), C = !!(d && a && s && m), [R, T] = G(!1), B = Z(!1);
4243
- Y(() => {
4243
+ z(() => {
4244
4244
  C && !B.current && (B.current = !0, T(!0));
4245
- }, [C]), Y(() => {
4245
+ }, [C]), z(() => {
4246
4246
  if (!d || !n) return;
4247
4247
  const y = n.cubes?.find((N) => N.name === d);
4248
4248
  if (y?.meta?.eventStream) {
@@ -4379,7 +4379,7 @@ const xt = me(function({
4379
4379
  ] }),
4380
4380
  D === "config" ? /* @__PURE__ */ t("div", { className: "dc:flex dc:flex-col dc:flex-1 dc:min-h-0", children: [
4381
4381
  /* @__PURE__ */ e(
4382
- zn,
4382
+ Yn,
4383
4383
  {
4384
4384
  selectedCube: d,
4385
4385
  bindingKey: a,
@@ -4429,7 +4429,7 @@ const xt = me(function({
4429
4429
  /* @__PURE__ */ t("div", { children: [
4430
4430
  /* @__PURE__ */ e("label", { className: "dc:block dc:text-xs dc:font-medium text-dc-text-muted dc:mb-2", children: "Filter Conditions" }),
4431
4431
  /* @__PURE__ */ e(
4432
- ze,
4432
+ Ye,
4433
4433
  {
4434
4434
  filters: n.filters,
4435
4435
  schema: l,
@@ -4544,12 +4544,12 @@ const ec = me(function({
4544
4544
  onChange: x,
4545
4545
  helpText: g
4546
4546
  }) {
4547
- const [i, l] = G(!1), [b, c] = G(""), h = Z(null), w = Z(null), C = z(() => {
4547
+ const [i, l] = G(!1), [b, c] = G(""), h = Z(null), w = Z(null), C = Y(() => {
4548
4548
  const o = {};
4549
4549
  for (const f of n)
4550
4550
  o[f.cube] || (o[f.cube] = []), o[f.cube].push(f);
4551
4551
  return o;
4552
- }, [n]), R = z(() => {
4552
+ }, [n]), R = Y(() => {
4553
4553
  if (!b.trim()) return C;
4554
4554
  const o = b.toLowerCase(), f = {};
4555
4555
  for (const [y, N] of Object.entries(C)) {
@@ -4570,13 +4570,13 @@ const ec = me(function({
4570
4570
  },
4571
4571
  [x]
4572
4572
  );
4573
- Y(() => {
4573
+ z(() => {
4574
4574
  function o(f) {
4575
4575
  h.current && !h.current.contains(f.target) && (l(!1), c(""));
4576
4576
  }
4577
4577
  if (i)
4578
4578
  return document.addEventListener("mousedown", o), () => document.removeEventListener("mousedown", o);
4579
- }, [i]), Y(() => {
4579
+ }, [i]), z(() => {
4580
4580
  i && w.current && w.current.focus();
4581
4581
  }, [i]);
4582
4582
  const u = d !== null;
@@ -4667,7 +4667,7 @@ const ec = me(function({
4667
4667
  const s = d ?? { start: "", end: "" }, m = s.start ?? "", n = s.end ?? "", [x, g] = G(!1), [i, l] = G(
4668
4668
  () => m && n ? lc(s) : "last_3_months"
4669
4669
  ), [b, c] = G(m), [h, w] = G(n), C = Z(null);
4670
- Y(() => {
4670
+ z(() => {
4671
4671
  const u = d?.start ?? "", o = d?.end ?? "";
4672
4672
  c(u), w(o), u && o && l(lc({ start: u, end: o }));
4673
4673
  }, [d?.start, d?.end]);
@@ -4682,14 +4682,14 @@ const ec = me(function({
4682
4682
  ), T = F(() => {
4683
4683
  b && h && (a({ start: b, end: h }), l("custom"), g(!1));
4684
4684
  }, [b, h, a]);
4685
- Y(() => {
4685
+ z(() => {
4686
4686
  function u(o) {
4687
4687
  C.current && !C.current.contains(o.target) && g(!1);
4688
4688
  }
4689
4689
  if (x)
4690
4690
  return document.addEventListener("mousedown", u), () => document.removeEventListener("mousedown", u);
4691
4691
  }, [x]);
4692
- const B = z(() => {
4692
+ const B = Y(() => {
4693
4693
  const u = uc.find((y) => y.value === i);
4694
4694
  if (u && i !== "custom")
4695
4695
  return u.label;
@@ -4789,14 +4789,14 @@ const ec = me(function({
4789
4789
  onTimeDimensionChange: i = () => {
4790
4790
  }
4791
4791
  }) {
4792
- const l = z(() => Zn(n), [n]), b = z(() => {
4792
+ const l = Y(() => Zn(n), [n]), b = Y(() => {
4793
4793
  const f = Ct(n);
4794
4794
  return d ? f.filter((y) => y.cube === d) : [];
4795
- }, [n, d]), c = z(() => {
4795
+ }, [n, d]), c = Y(() => {
4796
4796
  const f = er(n);
4797
4797
  return d ? f.filter((y) => y.cube === d) : [];
4798
4798
  }, [n, d]), h = !!(d && a?.dimension && s && m?.start && m?.end), [w, C] = G(!1), R = Z(!1);
4799
- Y(() => {
4799
+ z(() => {
4800
4800
  h && !R.current && (R.current = !0, C(!0));
4801
4801
  }, [h]);
4802
4802
  const T = a?.dimension ? typeof a.dimension == "string" ? a.dimension : a.dimension[0]?.dimension || null : null, B = F(
@@ -4922,10 +4922,10 @@ const nr = me(function({
4922
4922
  colorPalette: v,
4923
4923
  onDisplayConfigChange: A
4924
4924
  }) {
4925
- const [E, M] = G("config"), j = k && A, q = z(() => !c || !d ? c : {
4925
+ const [E, M] = G("config"), j = k && A, q = Y(() => !c || !d ? c : {
4926
4926
  ...c,
4927
4927
  cubes: c.cubes?.filter((W) => W.name === d) || []
4928
- }, [c, d]), U = z(
4928
+ }, [c, d]), U = Y(
4929
4929
  () => dr(g),
4930
4930
  [g]
4931
4931
  ), re = F(
@@ -4988,7 +4988,7 @@ const nr = me(function({
4988
4988
  /* @__PURE__ */ e(ue, { children: "Cohort Filter" }),
4989
4989
  /* @__PURE__ */ e("p", { className: "dc:text-xs text-dc-text-muted dc:mb-3", children: "Define who enters the cohort. Users whose first event matches these filters within the date range are included." }),
4990
4990
  /* @__PURE__ */ e(
4991
- ze,
4991
+ Ye,
4992
4992
  {
4993
4993
  filters: n,
4994
4994
  schema: q,
@@ -5001,7 +5001,7 @@ const nr = me(function({
5001
5001
  /* @__PURE__ */ e(ue, { children: "Return Filter" }),
5002
5002
  /* @__PURE__ */ e("p", { className: "dc:text-xs text-dc-text-muted dc:mb-3", children: "Define what counts as a return. Events matching these filters in subsequent periods count as retention." }),
5003
5003
  /* @__PURE__ */ e(
5004
- ze,
5004
+ Ye,
5005
5005
  {
5006
5006
  filters: x,
5007
5007
  schema: q,
@@ -5209,8 +5209,8 @@ const nr = me(function({
5209
5209
  if (!m?.cubes) return null;
5210
5210
  const [ne] = V.field.split("."), Ke = m.cubes.find((Ne) => Ne.name === ne);
5211
5211
  return Ke && Ke.dimensions?.find((Ne) => Ne.name === V.field) || null;
5212
- }, [m]), ot = z(() => a.find((V) => V.isTimeDimension && V.enableComparison), [a]);
5213
- Y(() => {
5212
+ }, [m]), ot = Y(() => a.find((V) => V.isTimeDimension && V.enableComparison), [a]);
5213
+ z(() => {
5214
5214
  d.length === 0 && (n === "chart" || n === "display") && x("query");
5215
5215
  }, [d.length, n, x]);
5216
5216
  const Kt = F((V) => {
@@ -5512,7 +5512,7 @@ const nr = me(function({
5512
5512
  }
5513
5513
  ),
5514
5514
  /* @__PURE__ */ e(
5515
- ze,
5515
+ Ye,
5516
5516
  {
5517
5517
  filters: s,
5518
5518
  schema: m,
@@ -5795,7 +5795,7 @@ const Uc = qc(
5795
5795
  } = Kd({
5796
5796
  isValidQuery: c.isValidQuery,
5797
5797
  getAnalysisConfig: () => h.getState().save()
5798
- }), N = z(() => c.analysisType === "funnel" ? c.funnelSteps.length > 0 || c.funnelCube !== null || c.funnelBindingKey !== null || c.funnelTimeDimension !== null : c.queryState.metrics.length > 0 || c.queryState.breakdowns.length > 0 || c.queryState.filters.length > 0, [
5798
+ }), N = Y(() => c.analysisType === "funnel" ? c.funnelSteps.length > 0 || c.funnelCube !== null || c.funnelBindingKey !== null || c.funnelTimeDimension !== null : c.queryState.metrics.length > 0 || c.queryState.breakdowns.length > 0 || c.queryState.filters.length > 0, [
5799
5799
  c.analysisType,
5800
5800
  c.funnelSteps.length,
5801
5801
  c.funnelCube,
@@ -6146,4 +6146,4 @@ lr.displayName = "AnalysisBuilder";
6146
6146
  export {
6147
6147
  lr as default
6148
6148
  };
6149
- //# sourceMappingURL=analysis-builder-BfH-w92z.js.map
6149
+ //# sourceMappingURL=analysis-builder-C1QDrzgM.js.map