drizzle-cube 0.6.3 → 0.6.4

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 (56) hide show
  1. package/dist/adapters/compiler-DyyBaLry.cjs +166 -0
  2. package/dist/adapters/{compiler-LKTN9PTt.js → compiler-lG6eNsoI.js} +214 -210
  3. package/dist/adapters/express/index.cjs +1 -1
  4. package/dist/adapters/express/index.js +1 -1
  5. package/dist/adapters/fastify/index.cjs +1 -1
  6. package/dist/adapters/fastify/index.js +1 -1
  7. package/dist/adapters/hono/index.cjs +1 -1
  8. package/dist/adapters/hono/index.js +1 -1
  9. package/dist/adapters/nextjs/index.cjs +1 -1
  10. package/dist/adapters/nextjs/index.d.ts +10 -0
  11. package/dist/adapters/nextjs/index.js +13 -9
  12. package/dist/cjs/adapters/nextjs/index.d.ts +10 -0
  13. package/dist/cjs/client/components/AnalysisBuilder/utils/filterUtils.d.ts +4 -10
  14. package/dist/cjs/client/components/shared/utils.d.ts +2 -1
  15. package/dist/cjs/client/shared/filters/filterOperations.d.ts +95 -0
  16. package/dist/cjs/client/shared/filters/index.d.ts +10 -0
  17. package/dist/cjs/client/shared/filters/operators.d.ts +23 -0
  18. package/dist/cjs/client/shared/index.d.ts +3 -2
  19. package/dist/cjs/client/shared/types.d.ts +3 -10
  20. package/dist/cjs/client/shared/utils.d.ts +1 -59
  21. package/dist/cjs/client/utils/filterUtils.d.ts +2 -9
  22. package/dist/cjs/server/logical-plan/logical-plan-builder.d.ts +0 -5
  23. package/dist/cjs/server/logical-plan/schema-builder.d.ts +19 -0
  24. package/dist/client/chunks/{DashboardEditModal-CWurUU2B.js → DashboardEditModal-Cs1ig1_V.js} +1520 -1119
  25. package/dist/client/chunks/DashboardEditModal-Cs1ig1_V.js.map +1 -0
  26. package/dist/client/chunks/{analysis-builder-Uj_Fxv0-.js → analysis-builder-B64yaeDe.js} +73 -73
  27. package/dist/client/chunks/{analysis-builder-Uj_Fxv0-.js.map → analysis-builder-B64yaeDe.js.map} +1 -1
  28. package/dist/client/chunks/{analysis-builder-shared-AdAYIfj_.js → analysis-builder-shared-CD0n2Nb8.js} +948 -1023
  29. package/dist/client/chunks/analysis-builder-shared-CD0n2Nb8.js.map +1 -0
  30. package/dist/client/chunks/{useDirtyStateTracking-BY_IIG1n.js → useDirtyStateTracking-BT6zqCFl.js} +249 -590
  31. package/dist/client/chunks/useDirtyStateTracking-BT6zqCFl.js.map +1 -0
  32. package/dist/client/chunks/{useExplainAI-PjMBmj2p.js → useExplainAI-Dq_meKNN.js} +2 -2
  33. package/dist/client/chunks/{useExplainAI-PjMBmj2p.js.map → useExplainAI-Dq_meKNN.js.map} +1 -1
  34. package/dist/client/components/AnalysisBuilder/utils/filterUtils.d.ts +4 -10
  35. package/dist/client/components/shared/utils.d.ts +2 -1
  36. package/dist/client/components.js +2 -2
  37. package/dist/client/hooks.js +2 -2
  38. package/dist/client/index.js +13 -13
  39. package/dist/client/index.js.map +1 -1
  40. package/dist/client/shared/filters/filterOperations.d.ts +95 -0
  41. package/dist/client/shared/filters/index.d.ts +10 -0
  42. package/dist/client/shared/filters/operators.d.ts +23 -0
  43. package/dist/client/shared/index.d.ts +3 -2
  44. package/dist/client/shared/types.d.ts +3 -10
  45. package/dist/client/shared/utils.d.ts +1 -59
  46. package/dist/client/utils/filterUtils.d.ts +2 -9
  47. package/dist/client-bundle-stats.html +1 -1
  48. package/dist/server/index.cjs +33 -33
  49. package/dist/server/index.js +1272 -1268
  50. package/dist/server/logical-plan/logical-plan-builder.d.ts +0 -5
  51. package/dist/server/logical-plan/schema-builder.d.ts +19 -0
  52. package/package.json +3 -3
  53. package/dist/adapters/compiler-ChGO4ZLU.cjs +0 -166
  54. package/dist/client/chunks/DashboardEditModal-CWurUU2B.js.map +0 -1
  55. package/dist/client/chunks/analysis-builder-shared-AdAYIfj_.js.map +0 -1
  56. package/dist/client/chunks/useDirtyStateTracking-BY_IIG1n.js.map +0 -1
@@ -1,16 +1,16 @@
1
1
  import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./vendor-D4jADu8t.js";
2
2
  import { k as s, u as c, v as l, z as u } from "./chart-data-table-D4g5_jfF.js";
3
- import { A as d, S as f, T as p, _ as m, _t as h, d as g, et as _, g as v, gt as y, l as b, u as x, v as S, x as C, y as w } from "./DashboardEditModal-CWurUU2B.js";
4
- import { a as T, s as E, t as D } from "./retention-ChW9jYdy.js";
5
- import { P as O, z as k } from "./chart-activity-grid-DX0SJbxs.js";
6
- import { A, D as ee, O as te, S as ne, T as j, a as re, d as ie, k as ae, l as M, n as N, r as oe, s as se } from "./useDirtyStateTracking-BY_IIG1n.js";
7
- import { a as P, i as ce } from "./useExplainAI-PjMBmj2p.js";
8
- import { r as F, s as I } from "./chart-funnel-CToKSBaL.js";
9
- import { n as le } from "./charts-core-DaXSt1Dd.js";
10
- import L, { createContext as ue, memo as de, useCallback as R, useContext as fe, useEffect as z, useMemo as B, useRef as V, useState as H } from "react";
11
- import { Fragment as U, jsx as W, jsxs as G } from "react/jsx-runtime";
3
+ import { C as d, E as f, S as p, _ as m, b as h, bt as g, d as _, g as v, j as y, l as b, nt as x, rt as S, tt as C, u as w, v as T, y as E, yt as D } from "./DashboardEditModal-Cs1ig1_V.js";
4
+ import { a as O, s as k, t as ee } from "./retention-ChW9jYdy.js";
5
+ import { A, D as te, F as ne, I as j, M as re, N as M, O as ie, P as ae, S as oe, T as N, a as P, d as se, j as F, k as I, l as L, n as ce, r as le, s as ue } from "./useDirtyStateTracking-BT6zqCFl.js";
6
+ import { P as R, z as de } from "./chart-activity-grid-DX0SJbxs.js";
7
+ import { a as z, i as fe } from "./useExplainAI-Dq_meKNN.js";
8
+ import { r as pe, s as me } from "./chart-funnel-CToKSBaL.js";
9
+ import { n as he } from "./charts-core-DaXSt1Dd.js";
10
+ import B, { createContext as ge, memo as _e, useCallback as V, useContext as ve, useEffect as H, useMemo as U, useRef as W, useState as G } from "react";
11
+ import { Fragment as K, jsx as q, jsxs as J } from "react/jsx-runtime";
12
12
  //#region src/shared/date-utils.ts
13
- function K(e) {
13
+ function ye(e) {
14
14
  let t = /* @__PURE__ */ new Date(), n = e.toLowerCase().trim(), r = t.getUTCFullYear(), i = t.getUTCMonth(), a = t.getUTCDate(), o = t.getUTCDay();
15
15
  if (n === "today") {
16
16
  let e = new Date(t);
@@ -123,7 +123,7 @@ function K(e) {
123
123
  }
124
124
  return null;
125
125
  }
126
- function pe(e) {
126
+ function be(e) {
127
127
  if (Array.isArray(e)) {
128
128
  if (e.length < 2) return null;
129
129
  let t = new Date(e[0]), n = new Date(e[1]);
@@ -132,12 +132,12 @@ function pe(e) {
132
132
  end: n
133
133
  });
134
134
  }
135
- return K(e);
135
+ return ye(e);
136
136
  }
137
- function q(e) {
137
+ function xe(e) {
138
138
  return e.toISOString().split("T")[0];
139
139
  }
140
- function me(e, t) {
140
+ function Se(e, t) {
141
141
  let n = t.getTime() - e.getTime(), r = Math.ceil(n / (1e3 * 60 * 60 * 24)), i = new Date(e);
142
142
  i.setUTCDate(i.getUTCDate() - 1), i.setUTCHours(23, 59, 59, 999);
143
143
  let a = new Date(i);
@@ -148,44 +148,23 @@ function me(e, t) {
148
148
  }
149
149
  //#endregion
150
150
  //#region src/client/components/AnalysisBuilder/utils/filterUtils.ts
151
- function he(e, t) {
152
- for (let n of e) if ("type" in n && "filters" in n) {
153
- let e = he(n.filters, t);
154
- if (e) return e;
155
- } else if ("member" in n) {
156
- let e = n;
157
- if (e.member === t && e.operator === "inDateRange" && e.dateRange) return { dateRange: e.dateRange };
158
- }
159
- }
160
- function ge(e, t) {
161
- let n = he(t, e);
151
+ function Ce(e, t) {
152
+ let n = F(t, e);
162
153
  if (!n?.dateRange) return;
163
- let r = pe(n.dateRange);
154
+ let r = be(n.dateRange);
164
155
  if (!r) return;
165
- let i = me(r.start, r.end);
166
- return [[q(r.start), q(r.end)], [q(i.start), q(i.end)]];
156
+ let i = Se(r.start, r.end);
157
+ return [[xe(r.start), xe(r.end)], [xe(i.start), xe(i.end)]];
167
158
  }
168
- function _e(e, t) {
169
- return e.reduce((e, n) => {
170
- if ("type" in n && "filters" in n) {
171
- let r = n, i = _e(r.filters, t);
172
- i.length > 0 && e.push({
173
- type: r.type,
174
- filters: i
175
- });
176
- } else if ("member" in n) {
177
- let r = n;
178
- r.member === t && r.operator === "inDateRange" || e.push(n);
179
- } else e.push(n);
180
- return e;
181
- }, []);
159
+ function we(e, t) {
160
+ return ne(e, t, "inDateRange");
182
161
  }
183
162
  //#endregion
184
163
  //#region src/client/components/AnalysisBuilder/utils/queryUtils.ts
185
- function ve(e, t, n, r, i = !1, a) {
164
+ function Te(e, t, n, r, i = !1, a) {
186
165
  let o = t.filter((e) => e.isTimeDimension && e.enableComparison).map((e) => e.field), s = n;
187
- if (!i) for (let e of o) s = _e(s, e);
188
- s = s.filter((e) => _(e));
166
+ if (!i) for (let e of o) s = we(s, e);
167
+ s = s.filter((e) => C(e));
189
168
  let c = {
190
169
  measures: e.map((e) => e.field),
191
170
  dimensions: t.filter((e) => !e.isTimeDimension).map((e) => e.field),
@@ -195,7 +174,7 @@ function ve(e, t, n, r, i = !1, a) {
195
174
  granularity: e.granularity || "day"
196
175
  };
197
176
  if (e.enableComparison) {
198
- let r = ge(e.field, n);
177
+ let r = Ce(e.field, n);
199
178
  r && (t.compareDateRange = r);
200
179
  }
201
180
  return t;
@@ -206,7 +185,7 @@ function ve(e, t, n, r, i = !1, a) {
206
185
  };
207
186
  return c.measures?.length === 0 && delete c.measures, c.dimensions?.length === 0 && delete c.dimensions, c.timeDimensions?.length === 0 && delete c.timeDimensions, c;
208
187
  }
209
- function J() {
188
+ function Y() {
210
189
  return {
211
190
  metrics: [],
212
191
  breakdowns: [],
@@ -219,7 +198,7 @@ function J() {
219
198
  }
220
199
  //#endregion
221
200
  //#region src/client/components/AnalysisBuilder/filterConfigModalUtils.ts
222
- function ye(e, t, n, r) {
201
+ function Ee(e, t, n, r) {
223
202
  if (!t || n === 0) return { type: "none" };
224
203
  switch (e) {
225
204
  case "ArrowDown": return {
@@ -240,60 +219,60 @@ function ye(e, t, n, r) {
240
219
  }
241
220
  //#endregion
242
221
  //#region src/client/components/AnalysisBuilder/FilterValueInput.tsx
243
- var be = l("close"), xe = l("chevronDown");
244
- function Se({ filter: e, dateRange: t }) {
245
- let { t: n } = O(), { rangeType: r, numberValue: i, label: a, isOpen: o, onToggle: s, onRangeTypeChange: c, onNumberValueChange: l, onCustomStartDate: u, onCustomEndDate: d, onOpen: f } = t;
246
- return /* @__PURE__ */ G("div", {
222
+ var De = l("close"), Oe = l("chevronDown");
223
+ function ke({ filter: e, dateRange: t }) {
224
+ let { t: n } = R(), { rangeType: r, numberValue: i, label: a, isOpen: o, onToggle: s, onRangeTypeChange: c, onNumberValueChange: l, onCustomStartDate: u, onCustomEndDate: d, onOpen: f } = t;
225
+ return /* @__PURE__ */ J("div", {
247
226
  className: "dc:space-y-2",
248
227
  children: [
249
- /* @__PURE__ */ G("div", {
228
+ /* @__PURE__ */ J("div", {
250
229
  className: "dc:relative",
251
- children: [/* @__PURE__ */ G("button", {
230
+ children: [/* @__PURE__ */ J("button", {
252
231
  onClick: () => {
253
232
  f(), s(!o);
254
233
  },
255
234
  className: "dc:w-full dc:flex dc:items-center dc:justify-between dc:text-left dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
256
- children: [/* @__PURE__ */ W("span", {
235
+ children: [/* @__PURE__ */ q("span", {
257
236
  className: "dc:truncate",
258
237
  children: a
259
- }), /* @__PURE__ */ W(xe, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${o ? "dc:rotate-180" : ""}` })]
260
- }), o && /* @__PURE__ */ W("div", {
238
+ }), /* @__PURE__ */ q(Oe, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${o ? "dc:rotate-180" : ""}` })]
239
+ }), o && /* @__PURE__ */ q("div", {
261
240
  className: "dc:absolute dc:z-[60] dc:left-0 dc:right-0 dc:mt-1 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:max-h-48 dc:overflow-y-auto",
262
- children: ae.map((e) => /* @__PURE__ */ W("button", {
241
+ children: m.map((e) => /* @__PURE__ */ q("button", {
263
242
  onClick: () => c(e.value),
264
243
  className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm hover:bg-dc-surface-hover ${e.value === r ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text"}`,
265
244
  children: n(e.label)
266
245
  }, e.value))
267
246
  })]
268
247
  }),
269
- te(r) && /* @__PURE__ */ G("div", {
248
+ te(r) && /* @__PURE__ */ J("div", {
270
249
  className: "dc:flex dc:items-center dc:gap-2",
271
- children: [/* @__PURE__ */ W("input", {
250
+ children: [/* @__PURE__ */ q("input", {
272
251
  type: "number",
273
252
  min: "1",
274
253
  max: "1000",
275
254
  value: i,
276
255
  onChange: (e) => l(Math.max(1, parseInt(e.target.value) || 1)),
277
256
  className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text dc:w-20"
278
- }), /* @__PURE__ */ W("span", {
257
+ }), /* @__PURE__ */ q("span", {
279
258
  className: "dc:text-sm text-dc-text-muted",
280
259
  children: r.replace("last_n_", "")
281
260
  })]
282
261
  }),
283
- r === "custom" && /* @__PURE__ */ G("div", {
262
+ r === "custom" && /* @__PURE__ */ J("div", {
284
263
  className: "dc:flex dc:items-center dc:gap-2",
285
264
  children: [
286
- /* @__PURE__ */ W("input", {
265
+ /* @__PURE__ */ q("input", {
287
266
  type: "date",
288
267
  value: Array.isArray(e.dateRange) ? e.dateRange[0] : "",
289
268
  onChange: u,
290
269
  className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-2 dc:py-2 bg-dc-surface text-dc-text"
291
270
  }),
292
- /* @__PURE__ */ W("span", {
271
+ /* @__PURE__ */ q("span", {
293
272
  className: "dc:text-sm text-dc-text-muted",
294
273
  children: n("filter.modal.dateTo")
295
274
  }),
296
- /* @__PURE__ */ W("input", {
275
+ /* @__PURE__ */ q("input", {
297
276
  type: "date",
298
277
  value: Array.isArray(e.dateRange) ? e.dateRange[1] : "",
299
278
  onChange: d,
@@ -304,26 +283,26 @@ function Se({ filter: e, dateRange: t }) {
304
283
  ]
305
284
  });
306
285
  }
307
- function Ce({ filter: e, combo: t }) {
308
- let { t: n } = O(), { options: r, loading: i, error: a, highlightedIndex: o, listRef: s, onSelect: c } = t;
309
- return i ? /* @__PURE__ */ W("div", {
286
+ function Ae({ filter: e, combo: t }) {
287
+ let { t: n } = R(), { options: r, loading: i, error: a, highlightedIndex: o, listRef: s, onSelect: c } = t;
288
+ return i ? /* @__PURE__ */ q("div", {
310
289
  className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text-muted",
311
290
  children: n("filter.modal.loading")
312
- }) : a ? /* @__PURE__ */ G("div", {
291
+ }) : a ? /* @__PURE__ */ J("div", {
313
292
  className: "dc:px-3 dc:py-2 dc:text-sm text-dc-error",
314
293
  children: [n("filter.modal.errorPrefix"), String(a)]
315
- }) : r.length === 0 ? /* @__PURE__ */ W("div", {
294
+ }) : r.length === 0 ? /* @__PURE__ */ q("div", {
316
295
  className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text-muted",
317
296
  children: n("filter.modal.noValues")
318
- }) : /* @__PURE__ */ W("div", {
297
+ }) : /* @__PURE__ */ q("div", {
319
298
  ref: s,
320
299
  className: "dc:max-h-40 dc:overflow-y-auto",
321
300
  children: r.map((t, n) => {
322
301
  let r = e.values?.includes(t);
323
- return /* @__PURE__ */ G("button", {
302
+ return /* @__PURE__ */ J("button", {
324
303
  onClick: (e) => c(t, e),
325
304
  className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm dc:transition-colors ${n === o ? "bg-dc-surface-hover" : ""} ${r ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text hover:bg-dc-surface-hover"}`,
326
- children: [String(t), r && /* @__PURE__ */ W("span", {
305
+ children: [String(t), r && /* @__PURE__ */ q("span", {
327
306
  className: "dc:float-right",
328
307
  children: "✓"
329
308
  })]
@@ -331,41 +310,41 @@ function Ce({ filter: e, combo: t }) {
331
310
  })
332
311
  });
333
312
  }
334
- function we({ filter: e, operatorMeta: t, combo: n }) {
335
- let { t: r } = O(), { isOpen: i, loading: a, searchText: o, onSearchTextChange: s, onHighlightedIndexChange: c, onRemove: l, onKeyDown: u, onOpen: d } = n;
336
- return /* @__PURE__ */ G("div", {
313
+ function je({ filter: e, operatorMeta: t, combo: n }) {
314
+ let { t: r } = R(), { isOpen: i, loading: a, searchText: o, onSearchTextChange: s, onHighlightedIndexChange: c, onRemove: l, onKeyDown: u, onOpen: d } = n;
315
+ return /* @__PURE__ */ J("div", {
337
316
  className: "dc:space-y-2",
338
317
  children: [
339
- e.values && e.values.length > 0 && /* @__PURE__ */ W("div", {
318
+ e.values && e.values.length > 0 && /* @__PURE__ */ q("div", {
340
319
  className: "dc:flex dc:flex-wrap dc:gap-1.5",
341
- children: e.values.map((e, t) => /* @__PURE__ */ G("span", {
320
+ children: e.values.map((e, t) => /* @__PURE__ */ J("span", {
342
321
  className: "dc:inline-flex dc:items-center dc:gap-1 bg-dc-primary/10 text-dc-primary dc:text-sm dc:px-2 dc:py-1 dc:rounded",
343
- children: [/* @__PURE__ */ W("span", {
322
+ children: [/* @__PURE__ */ q("span", {
344
323
  className: "dc:max-w-[150px] dc:truncate",
345
324
  children: String(e)
346
- }), /* @__PURE__ */ W("button", {
325
+ }), /* @__PURE__ */ q("button", {
347
326
  onClick: () => l(e),
348
327
  className: "hover:text-dc-danger",
349
- children: /* @__PURE__ */ W(be, { className: "dc:w-3.5 dc:h-3.5" })
328
+ children: /* @__PURE__ */ q(De, { className: "dc:w-3.5 dc:h-3.5" })
350
329
  })]
351
330
  }, t))
352
331
  }),
353
- /* @__PURE__ */ G("div", {
332
+ /* @__PURE__ */ J("div", {
354
333
  className: "dc:relative",
355
- children: [/* @__PURE__ */ G("button", {
334
+ children: [/* @__PURE__ */ J("button", {
356
335
  onClick: () => {
357
336
  d();
358
337
  },
359
338
  className: "dc:w-full dc:flex dc:items-center dc:justify-between dc:text-left dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
360
- children: [/* @__PURE__ */ W("span", {
339
+ children: [/* @__PURE__ */ q("span", {
361
340
  className: "text-dc-text-muted dc:truncate",
362
341
  children: r(a ? "filter.modal.loading" : "filter.modal.selectValue")
363
- }), /* @__PURE__ */ W(xe, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${i ? "dc:rotate-180" : ""}` })]
364
- }), i && /* @__PURE__ */ G("div", {
342
+ }), /* @__PURE__ */ q(Oe, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${i ? "dc:rotate-180" : ""}` })]
343
+ }), i && /* @__PURE__ */ J("div", {
365
344
  className: "dc:absolute dc:z-[60] dc:left-0 dc:right-0 dc:mt-1 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:max-h-56 dc:overflow-hidden",
366
- children: [/* @__PURE__ */ W("div", {
345
+ children: [/* @__PURE__ */ q("div", {
367
346
  className: "dc:p-2 dc:border-b border-dc-border",
368
- children: /* @__PURE__ */ W("input", {
347
+ children: /* @__PURE__ */ q("input", {
369
348
  type: "text",
370
349
  value: o,
371
350
  onChange: (e) => {
@@ -376,39 +355,39 @@ function we({ filter: e, operatorMeta: t, combo: n }) {
376
355
  className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text",
377
356
  autoFocus: !0
378
357
  })
379
- }), /* @__PURE__ */ W(Ce, {
358
+ }), /* @__PURE__ */ q(Ae, {
380
359
  filter: e,
381
360
  combo: n
382
361
  })]
383
362
  })]
384
363
  }),
385
- t?.supportsMultipleValues && /* @__PURE__ */ W("p", {
364
+ t?.supportsMultipleValues && /* @__PURE__ */ q("p", {
386
365
  className: "dc:text-xs text-dc-text-muted",
387
366
  children: r("filter.modal.multiSelectHint")
388
367
  })
389
368
  ]
390
369
  });
391
370
  }
392
- function Te({ field: e, dateRange: t, combo: n, inputs: r }) {
393
- let { t: i } = O(), { filter: a, operatorMeta: o, shouldShowDateRange: s, shouldShowComboBox: c } = e, { onBetweenStart: l, onBetweenEnd: u, onDate: d, onDirect: f } = r;
394
- return o?.requiresValues ? s ? /* @__PURE__ */ W(Se, {
371
+ function Me({ field: e, dateRange: t, combo: n, inputs: r }) {
372
+ let { t: i } = R(), { filter: a, operatorMeta: o, shouldShowDateRange: s, shouldShowComboBox: c } = e, { onBetweenStart: l, onBetweenEnd: u, onDate: d, onDirect: f } = r;
373
+ return o?.requiresValues ? s ? /* @__PURE__ */ q(ke, {
395
374
  filter: a,
396
375
  dateRange: t
397
- }) : a.operator === "between" || a.operator === "notBetween" ? /* @__PURE__ */ G("div", {
376
+ }) : a.operator === "between" || a.operator === "notBetween" ? /* @__PURE__ */ J("div", {
398
377
  className: "dc:flex dc:items-center dc:gap-2",
399
378
  children: [
400
- /* @__PURE__ */ W("input", {
379
+ /* @__PURE__ */ q("input", {
401
380
  type: "number",
402
381
  value: a.values?.[0] ?? "",
403
382
  onChange: l,
404
383
  placeholder: i("filter.modal.min"),
405
384
  className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
406
385
  }),
407
- /* @__PURE__ */ W("span", {
386
+ /* @__PURE__ */ q("span", {
408
387
  className: "dc:text-sm text-dc-text-muted",
409
388
  children: i("filter.modal.to")
410
389
  }),
411
- /* @__PURE__ */ W("input", {
390
+ /* @__PURE__ */ q("input", {
412
391
  type: "number",
413
392
  value: a.values?.[1] ?? "",
414
393
  onChange: u,
@@ -416,96 +395,96 @@ function Te({ field: e, dateRange: t, combo: n, inputs: r }) {
416
395
  className: "dc:flex-1 dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
417
396
  })
418
397
  ]
419
- }) : o?.valueType === "date" ? /* @__PURE__ */ W("input", {
398
+ }) : o?.valueType === "date" ? /* @__PURE__ */ q("input", {
420
399
  type: "date",
421
400
  value: a.values?.[0] || "",
422
401
  onChange: d,
423
402
  className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
424
- }) : o?.valueType === "number" ? /* @__PURE__ */ W("input", {
403
+ }) : o?.valueType === "number" ? /* @__PURE__ */ q("input", {
425
404
  type: "number",
426
405
  value: a.values?.[0] ?? "",
427
406
  onChange: f,
428
407
  placeholder: i("filter.modal.enterNumber"),
429
408
  className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text"
430
- }) : c ? /* @__PURE__ */ W(we, {
409
+ }) : c ? /* @__PURE__ */ q(je, {
431
410
  filter: a,
432
411
  operatorMeta: o,
433
412
  combo: n
434
- }) : /* @__PURE__ */ W("input", {
413
+ }) : /* @__PURE__ */ q("input", {
435
414
  type: "text",
436
415
  value: a.values?.[0] ?? "",
437
416
  onChange: f,
438
417
  placeholder: i("filter.modal.enterValue"),
439
418
  className: "dc:w-full dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text placeholder-dc-text-muted"
440
- }) : /* @__PURE__ */ W("div", {
419
+ }) : /* @__PURE__ */ q("div", {
441
420
  className: "dc:text-sm text-dc-text-muted dc:italic dc:py-2",
442
421
  children: i("filter.modal.noValueRequired")
443
422
  });
444
423
  }
445
424
  //#endregion
446
425
  //#region src/client/components/AnalysisBuilder/FilterConfigModal.tsx
447
- var Ee = l("close"), De = l("chevronDown"), Oe = l("dimension"), ke = l("timeDimension"), Ae = l("measure");
448
- function je({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i }) {
449
- let { t: a } = O(), [o, s] = H(e), [c, l] = H(!1), [u, d] = H(!1), [f, p] = H(!1), [m, h] = H("this_month"), [g, _] = H(1), [y, b] = H(""), [x, C] = H(null), [T, E] = H(-1), D = V(null), k = V(null), ne = N(y, 300), re = S(o.member, t), ie = re?.field.type || "string", M = ie === "time", se = re?.fieldType === "measure", P = re?.fieldType === "dimension", ce = w(o.member, t), F = A[o.operator], I = ee(ie), le = M && o.operator === "inDateRange", L = R(() => [
426
+ var Ne = l("close"), Pe = l("chevronDown"), Fe = l("dimension"), Ie = l("timeDimension"), Le = l("measure");
427
+ function Re({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i }) {
428
+ let { t: a } = R(), [o, s] = G(e), [c, l] = G(!1), [u, d] = G(!1), [f, p] = G(!1), [g, _] = G("this_month"), [y, b] = G(1), [C, w] = G(""), [T, D] = G(null), [O, k] = G(-1), ee = W(null), A = W(null), ne = ce(C, 300), j = E(o.member, t), re = j?.field.type || "string", M = re === "time", ie = j?.fieldType === "measure", ae = j?.fieldType === "dimension", oe = h(o.member, t), P = x[o.operator], se = S(re), F = M && o.operator === "inDateRange", I = V(() => [
450
429
  "equals",
451
430
  "notEquals",
452
431
  "in",
453
432
  "notIn"
454
- ].includes(o.operator) && P && !M, [
433
+ ].includes(o.operator) && ae && !M, [
455
434
  o.operator,
456
- P,
435
+ ae,
457
436
  M
458
- ])(), { values: ue, loading: de, error: fe, searchValues: K } = oe(o.member, L);
459
- z(() => {
437
+ ])(), { values: L, loading: ue, error: de, searchValues: z } = le(o.member, I);
438
+ H(() => {
460
439
  if (!i) {
461
- C(null);
440
+ D(null);
462
441
  return;
463
442
  }
464
443
  let e = i.getBoundingClientRect(), t = e.top, n = window.innerHeight - e.bottom, r = t > 500 || t > n, a = Math.max(16, Math.min(e.left, window.innerWidth - 400 - 16));
465
- C(r ? {
444
+ D(r ? {
466
445
  bottom: window.innerHeight - e.top + 8,
467
446
  left: a
468
447
  } : {
469
448
  top: e.bottom + 8,
470
449
  left: a
471
450
  });
472
- }, [i]), z(() => {
451
+ }, [i]), H(() => {
473
452
  let e = (e) => {
474
- D.current && !D.current.contains(e.target) && (l(!1), d(!1), p(!1));
453
+ ee.current && !ee.current.contains(e.target) && (l(!1), d(!1), p(!1));
475
454
  };
476
455
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
477
- }, []), z(() => {
478
- u && L && K && K("", !0), u || E(-1);
456
+ }, []), H(() => {
457
+ u && I && z && z("", !0), u || k(-1);
479
458
  }, [
480
459
  u,
481
- L,
482
- K
483
- ]), z(() => {
484
- if (T >= 0 && k.current) {
485
- let e = k.current.children[T];
460
+ I,
461
+ z
462
+ ]), H(() => {
463
+ if (O >= 0 && A.current) {
464
+ let e = A.current.children[O];
486
465
  e && e.scrollIntoView({ block: "nearest" });
487
466
  }
488
- }, [T]), z(() => {
489
- u && L && K && ne !== void 0 && K(ne);
467
+ }, [O]), H(() => {
468
+ u && I && z && ne !== void 0 && z(ne);
490
469
  }, [
491
470
  ne,
492
471
  u,
493
- L,
494
- K
495
- ]), z(() => {
496
- if (!le) return;
472
+ I,
473
+ z
474
+ ]), H(() => {
475
+ if (!F) return;
497
476
  let e = v(o.dateRange);
498
- e && (h(e.rangeType), e.numberValue !== void 0 && _(e.numberValue));
499
- }, [o.dateRange, le]);
500
- let pe = R((e) => {
477
+ e && (_(e.rangeType), e.numberValue !== void 0 && b(e.numberValue));
478
+ }, [o.dateRange, F]);
479
+ let fe = V((e) => {
501
480
  s({
502
481
  member: o.member,
503
482
  operator: e,
504
483
  values: []
505
484
  }), l(!1);
506
- }, [o.member]), q = R((e, t) => {
485
+ }, [o.member]), pe = V((e, t) => {
507
486
  let n = t?.shiftKey ?? !1, r = o.values || [];
508
- F?.supportsMultipleValues ? (r.includes(e) ? s({
487
+ P?.supportsMultipleValues ? (r.includes(e) ? s({
509
488
  ...o,
510
489
  values: r.filter((t) => t !== e)
511
490
  }) : s({
@@ -514,28 +493,28 @@ function je({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
514
493
  }), n || d(!1)) : (s({
515
494
  ...o,
516
495
  values: [e]
517
- }), d(!1)), b(""), E(-1);
518
- }, [o, F?.supportsMultipleValues]), me = R((e) => {
496
+ }), d(!1)), w(""), k(-1);
497
+ }, [o, P?.supportsMultipleValues]), me = V((e) => {
519
498
  let t = (o.values || []).filter((t) => t !== e);
520
499
  s({
521
500
  ...o,
522
501
  values: t
523
502
  });
524
- }, [o]), he = R((e) => {
525
- let t = ye(e.key, u, ue.length, T);
503
+ }, [o]), he = V((e) => {
504
+ let t = Ee(e.key, u, L.length, O);
526
505
  if (t.type !== "none") {
527
- if (e.preventDefault(), t.type === "highlight") return E(t.index);
528
- if (t.type === "select") return q(ue[t.index], { shiftKey: e.shiftKey });
529
- d(!1), E(-1);
506
+ if (e.preventDefault(), t.type === "highlight") return k(t.index);
507
+ if (t.type === "select") return pe(L[t.index], { shiftKey: e.shiftKey });
508
+ d(!1), k(-1);
530
509
  }
531
510
  }, [
532
511
  u,
533
- ue,
534
- T,
535
- q
536
- ]), ge = R((e) => {
512
+ L,
513
+ O,
514
+ pe
515
+ ]), B = V((e) => {
537
516
  let t = e.target.value;
538
- if (F?.valueType === "number") {
517
+ if (P?.valueType === "number") {
539
518
  let e = parseFloat(t);
540
519
  isNaN(e) ? (t === "" || t === "-") && s({
541
520
  ...o,
@@ -548,110 +527,110 @@ function je({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
548
527
  ...o,
549
528
  values: t ? [t] : []
550
529
  });
551
- }, [o, F?.valueType]), _e = R((e) => {
530
+ }, [o, P?.valueType]), ge = V((e) => {
552
531
  let t = parseFloat(e.target.value), n = [isNaN(t) ? "" : t, (o.values?.length >= 2 ? o.values : ["", ""])[1]].filter((e) => e !== "");
553
532
  s({
554
533
  ...o,
555
534
  values: n
556
535
  });
557
- }, [o]), ve = R((e) => {
536
+ }, [o]), _e = V((e) => {
558
537
  let t = parseFloat(e.target.value), n = [(o.values?.length >= 2 ? o.values : ["", ""])[0], isNaN(t) ? "" : t].filter((e) => e !== "");
559
538
  s({
560
539
  ...o,
561
540
  values: n
562
541
  });
563
- }, [o]), J = R((e) => {
542
+ }, [o]), ve = V((e) => {
564
543
  let t = e.target.value;
565
544
  s({
566
545
  ...o,
567
546
  values: t ? [t] : []
568
547
  });
569
- }, [o]), be = R((e) => {
570
- h(e), p(!1);
548
+ }, [o]), ye = V((e) => {
549
+ _(e), p(!1);
571
550
  let t;
572
551
  if (e === "custom") {
573
552
  let e = (/* @__PURE__ */ new Date()).toISOString().split("T")[0];
574
553
  t = [e, e];
575
- } else t = te(e) ? j(e, g) : j(e);
554
+ } else t = te(e) ? N(e, y) : N(e);
576
555
  s({
577
556
  ...o,
578
557
  dateRange: t
579
558
  });
580
- }, [o, g]), xe = R((e) => {
581
- if (_(e), te(m)) {
582
- let t = j(m, e);
559
+ }, [o, y]), be = V((e) => {
560
+ if (b(e), te(g)) {
561
+ let t = N(g, e);
583
562
  s({
584
563
  ...o,
585
564
  dateRange: t
586
565
  });
587
566
  }
588
- }, [o, m]), Se = R((e) => {
567
+ }, [o, g]), xe = V((e) => {
589
568
  let t = e.target.value, n = (Array.isArray(o.dateRange) ? o.dateRange : [o.dateRange || "", ""])[1] || t;
590
569
  s({
591
570
  ...o,
592
571
  dateRange: [t, n]
593
572
  });
594
- }, [o]), Ce = R((e) => {
573
+ }, [o]), Se = V((e) => {
595
574
  let t = e.target.value, n = (Array.isArray(o.dateRange) ? o.dateRange : ["", o.dateRange || ""])[0] || t;
596
575
  s({
597
576
  ...o,
598
577
  dateRange: [n, t]
599
578
  });
600
- }, [o]), we = a(I.find((e) => e.operator === o.operator)?.label || o.operator), je = a(ae.find((e) => e.value === m)?.label || "filter.modal.selectRange"), Me = {
579
+ }, [o]), Ce = a(se.find((e) => e.operator === o.operator)?.label || o.operator), we = a(m.find((e) => e.value === g)?.label || "filter.modal.selectRange"), Te = {
601
580
  filter: o,
602
- operatorMeta: F,
603
- shouldShowDateRange: le,
604
- shouldShowComboBox: L
605
- }, Ne = {
606
- rangeType: m,
607
- numberValue: g,
608
- label: je,
581
+ operatorMeta: P,
582
+ shouldShowDateRange: F,
583
+ shouldShowComboBox: I
584
+ }, Y = {
585
+ rangeType: g,
586
+ numberValue: y,
587
+ label: we,
609
588
  isOpen: f,
610
589
  onToggle: p,
611
- onRangeTypeChange: be,
612
- onNumberValueChange: xe,
613
- onCustomStartDate: Se,
614
- onCustomEndDate: Ce,
615
- onOpen: R(() => {
590
+ onRangeTypeChange: ye,
591
+ onNumberValueChange: be,
592
+ onCustomStartDate: xe,
593
+ onCustomEndDate: Se,
594
+ onOpen: V(() => {
616
595
  l(!1), d(!1);
617
596
  }, [])
618
- }, Pe = {
597
+ }, De = {
619
598
  isOpen: u,
620
- options: ue,
621
- loading: de,
622
- error: fe,
623
- searchText: y,
624
- highlightedIndex: T,
625
- listRef: k,
626
- onSearchTextChange: b,
627
- onHighlightedIndexChange: E,
628
- onSelect: q,
599
+ options: L,
600
+ loading: ue,
601
+ error: de,
602
+ searchText: C,
603
+ highlightedIndex: O,
604
+ listRef: A,
605
+ onSearchTextChange: w,
606
+ onHighlightedIndexChange: k,
607
+ onSelect: pe,
629
608
  onRemove: me,
630
609
  onKeyDown: he,
631
- onOpen: R(() => {
610
+ onOpen: V(() => {
632
611
  l(!1), p(!1), d((e) => !e);
633
612
  }, [])
634
- }, Fe = B(() => ({
635
- onBetweenStart: _e,
636
- onBetweenEnd: ve,
637
- onDate: J,
638
- onDirect: ge
613
+ }, Oe = U(() => ({
614
+ onBetweenStart: ge,
615
+ onBetweenEnd: _e,
616
+ onDate: ve,
617
+ onDirect: B
639
618
  }), [
619
+ ge,
640
620
  _e,
641
621
  ve,
642
- J,
643
- ge
644
- ]), Ie = M ? ke : se ? Ae : Oe;
645
- return /* @__PURE__ */ W(U, { children: /* @__PURE__ */ W("div", {
646
- className: `dc:fixed dc:inset-0 bg-dc-overlay dc:z-50 ${x ? "" : "dc:flex dc:items-center dc:justify-center dc:p-4"}`,
622
+ B
623
+ ]), ke = M ? Ie : ie ? Le : Fe;
624
+ return /* @__PURE__ */ q(K, { children: /* @__PURE__ */ q("div", {
625
+ className: `dc:fixed dc:inset-0 bg-dc-overlay dc:z-50 ${T ? "" : "dc:flex dc:items-center dc:justify-center dc:p-4"}`,
647
626
  onClick: r,
648
- children: /* @__PURE__ */ G("div", {
649
- ref: D,
650
- className: x ? "bg-dc-surface rounded-lg border border-dc-border" : "bg-dc-surface rounded-lg border border-dc-border max-w-md w-full",
627
+ children: /* @__PURE__ */ J("div", {
628
+ ref: ee,
629
+ className: T ? "bg-dc-surface rounded-lg border border-dc-border" : "bg-dc-surface rounded-lg border border-dc-border max-w-md w-full",
651
630
  style: {
652
- ...x ? {
631
+ ...T ? {
653
632
  position: "fixed",
654
- ...x,
633
+ ...T,
655
634
  maxWidth: "400px",
656
635
  width: "100%"
657
636
  } : {},
@@ -659,71 +638,71 @@ function je({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
659
638
  },
660
639
  onClick: (e) => e.stopPropagation(),
661
640
  children: [
662
- /* @__PURE__ */ G("div", {
641
+ /* @__PURE__ */ J("div", {
663
642
  className: "dc:flex dc:items-center dc:justify-between dc:p-4 dc:border-b border-dc-border",
664
- children: [/* @__PURE__ */ W("h2", {
643
+ children: [/* @__PURE__ */ q("h2", {
665
644
  className: "dc:text-lg dc:font-semibold text-dc-text",
666
645
  children: a("filter.modal.title")
667
- }), /* @__PURE__ */ W("button", {
646
+ }), /* @__PURE__ */ q("button", {
668
647
  onClick: r,
669
648
  className: "dc:p-1 text-dc-text-muted hover:text-dc-text dc:transition-colors",
670
- children: /* @__PURE__ */ W(Ee, { className: "dc:w-5 dc:h-5" })
649
+ children: /* @__PURE__ */ q(Ne, { className: "dc:w-5 dc:h-5" })
671
650
  })]
672
651
  }),
673
- /* @__PURE__ */ G("div", {
652
+ /* @__PURE__ */ J("div", {
674
653
  className: "dc:p-4 dc:space-y-4",
675
654
  children: [
676
- /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("label", {
655
+ /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("label", {
677
656
  className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
678
657
  children: a("filter.modal.fieldLabel")
679
- }), /* @__PURE__ */ G("div", {
658
+ }), /* @__PURE__ */ J("div", {
680
659
  className: "dc:flex dc:items-center dc:gap-2 dc:p-3 bg-dc-surface-secondary dc:rounded",
681
- children: [/* @__PURE__ */ W(Ie, { className: "dc:w-5 dc:h-5 text-dc-filter-text" }), /* @__PURE__ */ W("span", {
660
+ children: [/* @__PURE__ */ q(ke, { className: "dc:w-5 dc:h-5 text-dc-filter-text" }), /* @__PURE__ */ q("span", {
682
661
  className: "dc:text-sm dc:font-medium text-dc-text",
683
- children: ce
662
+ children: oe
684
663
  })]
685
664
  })] }),
686
- /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("label", {
665
+ /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("label", {
687
666
  className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
688
667
  children: a("filter.modal.operatorLabel")
689
- }), /* @__PURE__ */ G("div", {
668
+ }), /* @__PURE__ */ J("div", {
690
669
  className: "dc:relative",
691
- children: [/* @__PURE__ */ G("button", {
670
+ children: [/* @__PURE__ */ J("button", {
692
671
  onClick: () => {
693
672
  d(!1), p(!1), l(!c);
694
673
  },
695
674
  className: "dc:w-full dc:flex dc:items-center dc:justify-between dc:text-left dc:text-sm dc:border border-dc-border dc:rounded dc:px-3 dc:py-2 bg-dc-surface text-dc-text hover:bg-dc-surface-hover",
696
- children: [/* @__PURE__ */ W("span", {
675
+ children: [/* @__PURE__ */ q("span", {
697
676
  className: "dc:truncate",
698
- children: we
699
- }), /* @__PURE__ */ W(De, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${c ? "dc:rotate-180" : ""}` })]
700
- }), c && /* @__PURE__ */ W("div", {
677
+ children: Ce
678
+ }), /* @__PURE__ */ q(Pe, { className: `dc:w-4 dc:h-4 text-dc-text-muted dc:shrink-0 dc:ml-2 dc:transition-transform ${c ? "dc:rotate-180" : ""}` })]
679
+ }), c && /* @__PURE__ */ q("div", {
701
680
  className: "dc:absolute dc:z-[60] dc:left-0 dc:right-0 dc:mt-1 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:max-h-48 dc:overflow-y-auto",
702
- children: I.map((e) => /* @__PURE__ */ W("button", {
703
- onClick: () => pe(e.operator),
681
+ children: se.map((e) => /* @__PURE__ */ q("button", {
682
+ onClick: () => fe(e.operator),
704
683
  className: `dc:w-full dc:text-left dc:px-3 dc:py-2 dc:text-sm hover:bg-dc-surface-hover ${e.operator === o.operator ? "bg-dc-primary/10 text-dc-primary" : "text-dc-text"}`,
705
684
  children: a(e.label)
706
685
  }, e.operator))
707
686
  })]
708
687
  })] }),
709
- /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("label", {
688
+ /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("label", {
710
689
  className: "dc:block dc:text-sm dc:font-medium text-dc-text-secondary dc:mb-2",
711
690
  children: a("filter.modal.valueLabel")
712
- }), /* @__PURE__ */ W(Te, {
713
- field: Me,
714
- dateRange: Ne,
715
- combo: Pe,
716
- inputs: Fe
691
+ }), /* @__PURE__ */ q(Me, {
692
+ field: Te,
693
+ dateRange: Y,
694
+ combo: De,
695
+ inputs: Oe
717
696
  })] })
718
697
  ]
719
698
  }),
720
- /* @__PURE__ */ G("div", {
699
+ /* @__PURE__ */ J("div", {
721
700
  className: "dc:flex dc:items-center dc:justify-end dc:gap-2 dc:p-4 dc:border-t border-dc-border",
722
- children: [/* @__PURE__ */ W("button", {
701
+ children: [/* @__PURE__ */ q("button", {
723
702
  onClick: r,
724
703
  className: "dc:px-4 dc:py-2 dc:text-sm dc:font-medium text-dc-text-secondary hover:text-dc-text dc:transition-colors",
725
704
  children: a("common.actions.cancel")
726
- }), /* @__PURE__ */ W("button", {
705
+ }), /* @__PURE__ */ q("button", {
727
706
  onClick: () => n(o),
728
707
  className: "dc:px-4 dc:py-2 dc:text-sm dc:font-medium text-dc-primary-content bg-dc-primary hover:bg-dc-primary-hover dc:rounded dc:transition-colors",
729
708
  children: a("common.actions.save")
@@ -735,47 +714,47 @@ function je({ filter: e, schema: t, onSave: n, onCancel: r, anchorElement: i })
735
714
  }
736
715
  //#endregion
737
716
  //#region src/client/components/AnalysisBuilder/AnalysisFilterItem.tsx
738
- var Me = l("close"), Ne = l("dimension"), Pe = l("timeDimension"), Fe = l("measure");
739
- function Ie({ filter: e, schema: t, onRemove: n, onUpdate: r }) {
740
- let { t: i } = O(), [a, o] = H(!1), s = V(null), c = S(e.member, t), l = (c?.field.type || "string") === "time", u = c?.fieldType === "measure", d = w(e.member, t), f = A[e.operator], p = f?.label ? i(f.label) : e.operator, m = Le(e, f, i), h = l ? Pe : u ? Fe : Ne;
741
- return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G("div", {
717
+ var ze = l("close"), Be = l("dimension"), Ve = l("timeDimension"), He = l("measure");
718
+ function Ue({ filter: e, schema: t, onRemove: n, onUpdate: r }) {
719
+ let { t: i } = R(), [a, o] = G(!1), s = W(null), c = E(e.member, t), l = (c?.field.type || "string") === "time", u = c?.fieldType === "measure", d = h(e.member, t), f = x[e.operator], p = f?.label ? i(f.label) : e.operator, m = We(e, f, i), g = l ? Ve : u ? He : Be;
720
+ return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J("div", {
742
721
  className: "dc:flex dc:items-start dc:gap-2 dc:px-2 dc:py-1.5 bg-dc-surface-secondary dc:rounded-lg dc:group hover:bg-dc-surface-tertiary dc:transition-all dc:duration-150 dc:w-full",
743
722
  children: [
744
- /* @__PURE__ */ W("span", {
723
+ /* @__PURE__ */ q("span", {
745
724
  className: `dc:w-6 dc:h-6 dc:flex dc:items-center dc:justify-center dc:rounded ${l ? "bg-dc-time-dimension" : u ? "bg-dc-measure" : "bg-dc-dimension"} ${l ? "text-dc-time-dimension-text" : u ? "text-dc-measure-text" : "text-dc-dimension-text"} dc:flex-shrink-0 dc:mt-0.5`,
746
- children: h && /* @__PURE__ */ W(h, { className: "dc:w-4 dc:h-4" })
725
+ children: g && /* @__PURE__ */ q(g, { className: "dc:w-4 dc:h-4" })
747
726
  }),
748
- /* @__PURE__ */ W("button", {
727
+ /* @__PURE__ */ q("button", {
749
728
  ref: s,
750
729
  onClick: () => o(!0),
751
730
  className: "dc:flex-1 dc:min-w-0 dc:text-left",
752
731
  title: `${d} ${p} ${m}`,
753
- children: /* @__PURE__ */ G("div", {
732
+ children: /* @__PURE__ */ J("div", {
754
733
  className: "dc:text-sm text-dc-text dc:break-words",
755
734
  children: [
756
- /* @__PURE__ */ W("span", {
735
+ /* @__PURE__ */ q("span", {
757
736
  className: "dc:font-medium",
758
737
  children: d
759
738
  }),
760
- /* @__PURE__ */ W("span", {
739
+ /* @__PURE__ */ q("span", {
761
740
  className: "text-dc-text-muted dc:mx-1",
762
741
  children: p
763
742
  }),
764
- /* @__PURE__ */ W("span", {
743
+ /* @__PURE__ */ q("span", {
765
744
  className: "text-dc-primary",
766
745
  children: m
767
746
  })
768
747
  ]
769
748
  })
770
749
  }),
771
- /* @__PURE__ */ W("button", {
750
+ /* @__PURE__ */ q("button", {
772
751
  onClick: n,
773
752
  className: "dc:p-1 text-dc-text-muted hover:text-dc-danger dc:opacity-100 dc:sm:opacity-0 dc:sm:group-hover:opacity-100 dc:transition-opacity dc:flex-shrink-0 dc:mt-0.5",
774
753
  title: i("filter.removeButton.title"),
775
- children: Me && /* @__PURE__ */ W(Me, { className: "dc:w-4 dc:h-4" })
754
+ children: ze && /* @__PURE__ */ q(ze, { className: "dc:w-4 dc:h-4" })
776
755
  })
777
756
  ]
778
- }), a && /* @__PURE__ */ W(je, {
757
+ }), a && /* @__PURE__ */ q(Re, {
779
758
  filter: e,
780
759
  schema: t,
781
760
  onSave: (e) => {
@@ -785,7 +764,7 @@ function Ie({ filter: e, schema: t, onRemove: n, onUpdate: r }) {
785
764
  anchorElement: s.current
786
765
  })] });
787
766
  }
788
- function Le(e, t, n) {
767
+ function We(e, t, n) {
789
768
  if (!t?.requiresValues) return "";
790
769
  if (e.dateRange) return Array.isArray(e.dateRange) ? `${e.dateRange[0]} to ${e.dateRange[1]}` : e.dateRange;
791
770
  let r = e.values || [];
@@ -793,34 +772,24 @@ function Le(e, t, n) {
793
772
  }
794
773
  //#endregion
795
774
  //#region src/client/components/AnalysisBuilder/AnalysisFilterGroup.tsx
796
- var Re = l("add"), ze = l("close");
797
- function Be(e) {
798
- return "member" in e && typeof e.member == "string";
799
- }
800
- function Ve(e) {
801
- return "type" in e && (e.type === "and" || e.type === "or");
802
- }
803
- function He({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, depth: a = 0, hideRemoveButton: o = !1 }) {
804
- let { t: s } = O(), [c, l] = H(!1), u = V(null);
805
- z(() => {
775
+ var Ge = l("add"), Ke = l("close");
776
+ function qe({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, depth: a = 0, hideRemoveButton: o = !1 }) {
777
+ let { t: s } = R(), [c, l] = G(!1), u = W(null);
778
+ H(() => {
806
779
  let e = (e) => {
807
780
  u.current && !u.current.contains(e.target) && l(!1);
808
781
  };
809
782
  return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
810
783
  }, []);
811
- let d = R(() => {
812
- let t = e.type === "and" ? "or" : "and";
813
- n({
814
- ...e,
815
- type: t
816
- });
817
- }, [e, n]), f = R((t, r) => {
784
+ let d = V(() => {
785
+ n(j(e));
786
+ }, [e, n]), f = V((t, r) => {
818
787
  let i = [...e.filters];
819
788
  i[t] = r, n({
820
789
  ...e,
821
790
  filters: i
822
791
  });
823
- }, [e, n]), p = R((t) => {
792
+ }, [e, n]), p = V((t) => {
824
793
  let i = e.filters.filter((e, n) => n !== t);
825
794
  i.length === 0 ? r() : n({
826
795
  ...e,
@@ -831,7 +800,7 @@ function He({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
831
800
  n,
832
801
  r,
833
802
  a
834
- ]), m = R((t) => {
803
+ ]), m = V((t) => {
835
804
  let r = {
836
805
  type: t,
837
806
  filters: []
@@ -840,23 +809,23 @@ function He({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
840
809
  ...e,
841
810
  filters: [...e.filters, r]
842
811
  }), l(!1);
843
- }, [e, n]), h = R(() => {
812
+ }, [e, n]), h = V(() => {
844
813
  i([]), l(!1);
845
- }, [i]), g = R((e) => (t = []) => {
814
+ }, [i]), g = V((e) => (t = []) => {
846
815
  i([e, ...t]);
847
816
  }, [i]), _ = () => a % 2 == 0 ? "border-dc-border" : "border-dc-border dark:border-dc-border", v = () => e.type === "and" ? "bg-dc-info-bg/50" : "bg-dc-warning-bg/50", y = e.filters.length, b = s(y === 1 ? "filter.group.condition" : "filter.group.conditions");
848
- return /* @__PURE__ */ G("div", {
817
+ return /* @__PURE__ */ J("div", {
849
818
  className: `dc:border ${_()} dc:rounded-lg bg-dc-surface dc:w-full`,
850
- children: [/* @__PURE__ */ G("div", {
819
+ children: [/* @__PURE__ */ J("div", {
851
820
  className: `dc:flex dc:items-center dc:justify-between dc:px-2 dc:py-1.5 dc:border-b border-dc-border/50 dc:rounded-t-lg ${v()}`,
852
- children: [/* @__PURE__ */ G("div", {
821
+ children: [/* @__PURE__ */ J("div", {
853
822
  className: "dc:flex dc:items-center dc:gap-2",
854
- children: [/* @__PURE__ */ W("button", {
823
+ children: [/* @__PURE__ */ q("button", {
855
824
  onClick: d,
856
825
  className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-semibold dc:rounded dc:transition-colors ${e.type === "and" ? "bg-dc-info-bg text-dc-info dc:hover:opacity-80" : "bg-dc-warning-bg text-dc-warning dc:hover:opacity-80"}`,
857
826
  title: `Click to switch to ${e.type === "and" ? "OR" : "AND"}`,
858
827
  children: e.type.toUpperCase()
859
- }), /* @__PURE__ */ G("span", {
828
+ }), /* @__PURE__ */ J("span", {
860
829
  className: "dc:text-xs text-dc-text-muted",
861
830
  children: [
862
831
  y,
@@ -864,61 +833,61 @@ function He({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
864
833
  b
865
834
  ]
866
835
  })]
867
- }), /* @__PURE__ */ G("div", {
836
+ }), /* @__PURE__ */ J("div", {
868
837
  className: "dc:flex dc:items-center dc:gap-1",
869
- children: [/* @__PURE__ */ G("div", {
838
+ children: [/* @__PURE__ */ J("div", {
870
839
  className: "dc:relative",
871
840
  ref: u,
872
- children: [/* @__PURE__ */ W("button", {
841
+ children: [/* @__PURE__ */ q("button", {
873
842
  onClick: () => l(!c),
874
843
  className: "dc:p-1 text-dc-text-secondary hover:text-dc-primary hover:bg-dc-surface-hover dc:rounded dc:transition-colors",
875
844
  title: "Add condition",
876
- children: /* @__PURE__ */ W(Re, { className: "dc:w-4 dc:h-4" })
877
- }), c && /* @__PURE__ */ G("div", {
845
+ children: /* @__PURE__ */ q(Ge, { className: "dc:w-4 dc:h-4" })
846
+ }), c && /* @__PURE__ */ J("div", {
878
847
  className: "dc:absolute dc:right-0 dc:mt-1 dc:z-40 bg-dc-surface dc:border border-dc-border dc:rounded dc:shadow-lg dc:py-1 dc:min-w-[120px]",
879
848
  children: [
880
- /* @__PURE__ */ W("button", {
849
+ /* @__PURE__ */ q("button", {
881
850
  onClick: h,
882
851
  className: "dc:w-full dc:text-left dc:px-3 dc:py-1.5 dc:text-xs text-dc-text hover:bg-dc-surface-hover",
883
852
  children: s("filter.group.addFilter")
884
853
  }),
885
- /* @__PURE__ */ W("button", {
854
+ /* @__PURE__ */ q("button", {
886
855
  onClick: () => m("and"),
887
856
  className: "dc:w-full dc:text-left dc:px-3 dc:py-1.5 dc:text-xs text-dc-text hover:bg-dc-surface-hover",
888
857
  children: s("filter.group.addAndGroup")
889
858
  }),
890
- /* @__PURE__ */ W("button", {
859
+ /* @__PURE__ */ q("button", {
891
860
  onClick: () => m("or"),
892
861
  className: "dc:w-full dc:text-left dc:px-3 dc:py-1.5 dc:text-xs text-dc-text hover:bg-dc-surface-hover",
893
862
  children: s("filter.group.addOrGroup")
894
863
  })
895
864
  ]
896
865
  })]
897
- }), !o && /* @__PURE__ */ W("button", {
866
+ }), !o && /* @__PURE__ */ q("button", {
898
867
  onClick: r,
899
868
  className: "dc:p-1 text-dc-text-muted hover:text-dc-danger dc:transition-colors",
900
869
  title: s("filter.group.removeGroup"),
901
- children: /* @__PURE__ */ W(ze, { className: "dc:w-4 dc:h-4" })
870
+ children: /* @__PURE__ */ q(Ke, { className: "dc:w-4 dc:h-4" })
902
871
  })]
903
872
  })]
904
- }), /* @__PURE__ */ W("div", {
873
+ }), /* @__PURE__ */ q("div", {
905
874
  className: "dc:p-1.5 dc:flex dc:flex-wrap dc:gap-2",
906
- children: e.filters.length === 0 ? /* @__PURE__ */ G("div", {
875
+ children: e.filters.length === 0 ? /* @__PURE__ */ J("div", {
907
876
  className: "dc:text-center dc:py-3",
908
- children: [/* @__PURE__ */ W("p", {
877
+ children: [/* @__PURE__ */ q("p", {
909
878
  className: "dc:text-xs text-dc-text-muted dc:mb-1",
910
879
  children: s("filter.group.empty")
911
- }), /* @__PURE__ */ W("button", {
880
+ }), /* @__PURE__ */ q("button", {
912
881
  onClick: () => i([]),
913
882
  className: "dc:text-xs text-dc-primary dc:hover:underline",
914
883
  children: s("filter.group.addFilterLink")
915
884
  })]
916
- }) : e.filters.map((e, n) => Be(e) ? /* @__PURE__ */ W(Ie, {
885
+ }) : e.filters.map((e, n) => M(e) ? /* @__PURE__ */ q(Ue, {
917
886
  filter: e,
918
887
  schema: t,
919
888
  onUpdate: (e) => f(n, e),
920
889
  onRemove: () => p(n)
921
- }, `filter-${n}`) : Ve(e) ? /* @__PURE__ */ W(He, {
890
+ }, `filter-${n}`) : re(e) ? /* @__PURE__ */ q(qe, {
922
891
  group: e,
923
892
  schema: t,
924
893
  onUpdate: (e) => f(n, e),
@@ -931,178 +900,134 @@ function He({ group: e, schema: t, onUpdate: n, onRemove: r, onAddFilter: i, dep
931
900
  }
932
901
  //#endregion
933
902
  //#region src/client/components/AnalysisBuilder/AnalysisFilterSection.tsx
934
- var Ue = l("add");
935
- function We(e) {
936
- return "member" in e && typeof e.member == "string";
937
- }
938
- function Ge(e) {
939
- return "type" in e && (e.type === "and" || e.type === "or");
940
- }
941
- function Ke(e) {
942
- let t = 0;
943
- for (let n of e) We(n) ? t++ : Ge(n) && (t += Ke(n.filters));
944
- return t;
945
- }
946
- function qe(e) {
947
- let t = [];
948
- for (let n of e) We(n) ? t.push(n.member) : Ge(n) && t.push(...qe(n.filters));
949
- return t;
950
- }
951
- function Je(e, t, n) {
952
- if (t.length === 0) return e.length === 0 ? [n] : e.length === 1 && We(e[0]) ? [{
953
- type: "and",
954
- filters: [e[0], n]
955
- }] : e.length === 1 && Ge(e[0]) ? [{
956
- ...e[0],
957
- filters: [...e[0].filters, n]
958
- }] : [{
959
- type: "and",
960
- filters: [...e, n]
961
- }];
962
- let [r, ...i] = t, a = [...e], o = a[r];
963
- return Ge(o) && (i.length === 0 ? a[r] = {
964
- ...o,
965
- filters: [...o.filters, n]
966
- } : a[r] = {
967
- ...o,
968
- filters: Je(o.filters, i, n)
969
- }), a;
970
- }
903
+ var Je = l("add");
971
904
  function Ye({ filters: e, schema: t, onFiltersChange: n, onFieldDropped: r, dimensionsOnly: i = !1 }) {
972
- let { t: a } = O(), [o, s] = H(!1), [c, l] = H(!1), u = V([]), d = Ke(e), f = R((e) => {
905
+ let { t: a } = R(), [o, s] = G(!1), [c, l] = G(!1), u = W([]), d = I(e), f = V((e) => {
973
906
  e.preventDefault(), e.stopPropagation(), l(!0);
974
- }, []), p = R((e) => {
907
+ }, []), p = V((e) => {
975
908
  e.preventDefault(), e.stopPropagation(), l(!1);
976
- }, []), h = R((e) => {
909
+ }, []), m = V((e) => {
977
910
  e.preventDefault(), e.stopPropagation(), l(!1);
978
911
  try {
979
912
  let t = JSON.parse(e.dataTransfer.getData("text/plain"));
980
913
  t.field && r && r(t.field);
981
914
  } catch {}
982
- }, [r]), g = qe(e), _ = R((t, r, i) => {
915
+ }, [r]), h = A(e), g = V((t, r, i) => {
983
916
  let a = t.type === "time", o = a ? "inDateRange" : "equals", c = {
984
917
  member: t.name,
985
918
  operator: o,
986
919
  values: []
987
920
  };
988
- a && o === "inDateRange" && (c.dateRange = j("this_month")), n(Je(e, u.current, c)), s(!1), u.current = [];
989
- }, [e, n]), v = R((t, r) => {
921
+ a && o === "inDateRange" && (c.dateRange = N("this_month")), n(ie(e, u.current, c)), s(!1), u.current = [];
922
+ }, [e, n]), _ = V((t, r) => {
990
923
  let i = [...e];
991
924
  i[t] = r, n(i);
992
- }, [e, n]), y = R((t) => {
993
- let r = e.filter((e, n) => n !== t);
994
- if (r.length === 1 && Ge(r[0])) {
995
- let e = r[0];
996
- if (e.filters.length === 1) {
997
- n([e.filters[0]]);
998
- return;
999
- }
1000
- }
1001
- n(r);
1002
- }, [e, n]), b = R(() => {
925
+ }, [e, n]), v = V((t) => {
926
+ n(ae(e, t));
927
+ }, [e, n]), y = V(() => {
1003
928
  n([]);
1004
- }, [n]), x = R(() => {
929
+ }, [n]), b = V(() => {
1005
930
  u.current = [], s(!0);
1006
- }, []), S = R((e) => (t = []) => {
931
+ }, []), x = V((e) => (t = []) => {
1007
932
  u.current = [...e, ...t], s(!0);
1008
- }, []), C = (n, r, i = []) => {
933
+ }, []), S = (n, r, i = []) => {
1009
934
  let a = [...i, r];
1010
- return We(n) ? /* @__PURE__ */ W(Ie, {
935
+ return M(n) ? /* @__PURE__ */ q(Ue, {
1011
936
  filter: n,
1012
937
  schema: t,
1013
- onUpdate: (e) => v(r, e),
1014
- onRemove: () => y(r)
1015
- }, `filter-${a.join("-")}`) : Ge(n) ? /* @__PURE__ */ W(He, {
938
+ onUpdate: (e) => _(r, e),
939
+ onRemove: () => v(r)
940
+ }, `filter-${a.join("-")}`) : re(n) ? /* @__PURE__ */ q(qe, {
1016
941
  group: n,
1017
942
  schema: t,
1018
- onUpdate: (e) => v(r, e),
1019
- onRemove: () => y(r),
1020
- onAddFilter: S(a),
943
+ onUpdate: (e) => _(r, e),
944
+ onRemove: () => v(r),
945
+ onAddFilter: x(a),
1021
946
  hideRemoveButton: e.length === 1
1022
947
  }, `group-${a.join("-")}`) : null;
1023
948
  };
1024
- return /* @__PURE__ */ G("div", { children: [
1025
- /* @__PURE__ */ G("button", {
1026
- onClick: x,
949
+ return /* @__PURE__ */ J("div", { children: [
950
+ /* @__PURE__ */ J("button", {
951
+ onClick: b,
1027
952
  className: "dc:flex dc:items-center dc:justify-between dc:mb-3 dc:w-full dc:py-1 dc:px-2 dc:-ml-2 dc:rounded-lg hover:bg-dc-primary/10 dc:transition-colors dc:group",
1028
953
  title: "Add filter",
1029
- children: [/* @__PURE__ */ G(le, { children: [a("analysis.sections.filters"), d > 0 && /* @__PURE__ */ G("span", {
954
+ children: [/* @__PURE__ */ J(he, { children: [a("analysis.sections.filters"), d > 0 && /* @__PURE__ */ J("span", {
1030
955
  className: "dc:ml-1.5 dc:text-xs dc:font-normal text-dc-text-muted dc:normal-case dc:tracking-normal",
1031
956
  children: [
1032
957
  "(",
1033
958
  d,
1034
959
  ")"
1035
960
  ]
1036
- })] }), /* @__PURE__ */ G("div", {
961
+ })] }), /* @__PURE__ */ J("div", {
1037
962
  className: "dc:flex dc:items-center dc:gap-2",
1038
- children: [d > 0 && /* @__PURE__ */ W("span", {
963
+ children: [d > 0 && /* @__PURE__ */ q("span", {
1039
964
  role: "button",
1040
965
  tabIndex: 0,
1041
966
  onClick: (e) => {
1042
- e.stopPropagation(), b();
967
+ e.stopPropagation(), y();
1043
968
  },
1044
969
  onKeyDown: (e) => {
1045
- (e.key === "Enter" || e.key === " ") && (e.stopPropagation(), b());
970
+ (e.key === "Enter" || e.key === " ") && (e.stopPropagation(), y());
1046
971
  },
1047
972
  className: "dc:text-xs text-dc-text-muted hover:text-dc-error dc:underline dc:cursor-pointer",
1048
973
  children: a("filter.section.clearAll")
1049
- }), /* @__PURE__ */ W(Ue, { className: "dc:w-5 dc:h-5 text-dc-text-secondary group-hover:text-dc-primary dc:transition-colors" })]
974
+ }), /* @__PURE__ */ q(Je, { className: "dc:w-5 dc:h-5 text-dc-text-secondary group-hover:text-dc-primary dc:transition-colors" })]
1050
975
  })]
1051
976
  }),
1052
- /* @__PURE__ */ W("div", {
977
+ /* @__PURE__ */ q("div", {
1053
978
  onDragOver: r ? f : void 0,
1054
979
  onDragLeave: r ? p : void 0,
1055
- onDrop: r ? h : void 0,
980
+ onDrop: r ? m : void 0,
1056
981
  className: `dc:p-2 dc:-mx-2 dc:rounded-lg dc:border-2 dc:border-dashed dc:transition-all ${c ? "border-dc-primary bg-dc-primary/5" : "border-transparent"}`,
1057
- children: e.length === 0 ? /* @__PURE__ */ W("p", {
982
+ children: e.length === 0 ? /* @__PURE__ */ q("p", {
1058
983
  className: `dc:text-sm ${c ? "text-dc-primary dc:font-medium" : "text-dc-text-muted"}`,
1059
984
  children: a(c ? "filter.section.dropHint" : "filter.section.empty")
1060
- }) : /* @__PURE__ */ W("div", {
985
+ }) : /* @__PURE__ */ q("div", {
1061
986
  className: "dc:flex dc:flex-wrap dc:gap-2",
1062
- children: e.map((e, t) => C(e, t))
987
+ children: e.map((e, t) => S(e, t))
1063
988
  })
1064
989
  }),
1065
- /* @__PURE__ */ W(m, {
990
+ /* @__PURE__ */ q(T, {
1066
991
  isOpen: o,
1067
992
  onClose: () => {
1068
993
  s(!1), u.current = [];
1069
994
  },
1070
- onSelect: _,
995
+ onSelect: g,
1071
996
  mode: i ? "dimensionFilter" : "filter",
1072
997
  schema: t,
1073
- selectedFields: g
998
+ selectedFields: h
1074
999
  })
1075
1000
  ] });
1076
1001
  }
1077
1002
  //#endregion
1078
1003
  //#region src/client/components/AnalysisBuilder/ExplainAIPanel.tsx
1079
- function Y(e) {
1004
+ function Xe(e) {
1080
1005
  return typeof e == "string" ? e : typeof e == "object" && e ? JSON.stringify(e) : String(e ?? "");
1081
1006
  }
1082
- var Xe = {
1007
+ var Ze = {
1083
1008
  good: "bg-dc-success-bg text-dc-success border-dc-success",
1084
1009
  warning: "bg-dc-warning-bg text-dc-warning border-dc-warning",
1085
1010
  critical: "bg-dc-danger-bg text-dc-error border-dc-error"
1086
- }, Ze = {
1011
+ }, Qe = {
1087
1012
  critical: "bg-dc-danger-bg text-dc-error",
1088
1013
  warning: "bg-dc-warning-bg text-dc-warning",
1089
1014
  suggestion: "bg-dc-accent-bg text-dc-accent"
1090
- }, Qe = {
1015
+ }, $e = {
1091
1016
  high: "text-dc-error",
1092
1017
  medium: "text-dc-warning",
1093
1018
  low: "text-dc-text-muted"
1094
1019
  };
1095
- function $e({ assessment: e, reason: t }) {
1096
- let { t: n } = O(), r = {
1020
+ function et({ assessment: e, reason: t }) {
1021
+ let { t: n } = R(), r = {
1097
1022
  good: n("explainAI.assessment.good"),
1098
1023
  warning: n("explainAI.assessment.warning"),
1099
1024
  critical: n("explainAI.assessment.critical")
1100
1025
  };
1101
- return /* @__PURE__ */ G("div", {
1102
- className: `dc:p-4 dc:rounded-lg dc:border ${Xe[e]}`,
1103
- children: [/* @__PURE__ */ W("div", {
1026
+ return /* @__PURE__ */ J("div", {
1027
+ className: `dc:p-4 dc:rounded-lg dc:border ${Ze[e]}`,
1028
+ children: [/* @__PURE__ */ q("div", {
1104
1029
  className: "dc:flex dc:items-center dc:gap-2 dc:mb-1",
1105
- children: /* @__PURE__ */ G("span", {
1030
+ children: /* @__PURE__ */ J("span", {
1106
1031
  className: "dc:font-semibold dc:uppercase dc:text-base",
1107
1032
  children: [
1108
1033
  e === "good" && "✓ ",
@@ -1111,33 +1036,33 @@ function $e({ assessment: e, reason: t }) {
1111
1036
  r[e]
1112
1037
  ]
1113
1038
  })
1114
- }), /* @__PURE__ */ W("p", {
1039
+ }), /* @__PURE__ */ q("p", {
1115
1040
  className: "dc:text-sm",
1116
- children: Y(t)
1041
+ children: Xe(t)
1117
1042
  })]
1118
1043
  });
1119
1044
  }
1120
- function et({ issue: e }) {
1121
- return /* @__PURE__ */ G("div", {
1045
+ function tt({ issue: e }) {
1046
+ return /* @__PURE__ */ J("div", {
1122
1047
  className: "dc:flex dc:items-start dc:gap-2 dc:py-2",
1123
- children: [/* @__PURE__ */ G("span", {
1124
- className: `dc:text-sm ${Qe[e.severity]}`,
1048
+ children: [/* @__PURE__ */ J("span", {
1049
+ className: `dc:text-sm ${$e[e.severity]}`,
1125
1050
  children: [
1126
1051
  e.severity === "high" && "●",
1127
1052
  e.severity === "medium" && "○",
1128
1053
  e.severity === "low" && "○"
1129
1054
  ]
1130
- }), /* @__PURE__ */ W("span", {
1055
+ }), /* @__PURE__ */ q("span", {
1131
1056
  className: "dc:text-sm text-dc-text-secondary",
1132
- children: Y(e.description)
1057
+ children: Xe(e.description)
1133
1058
  })]
1134
1059
  });
1135
1060
  }
1136
- function tt({ text: e }) {
1137
- let { t } = O(), [n, r] = L.useState(!1), i = L.useRef(null);
1138
- return L.useEffect(() => () => {
1061
+ function nt({ text: e }) {
1062
+ let { t } = R(), [n, r] = B.useState(!1), i = B.useRef(null);
1063
+ return B.useEffect(() => () => {
1139
1064
  i.current && clearTimeout(i.current);
1140
- }, []), /* @__PURE__ */ W("button", {
1065
+ }, []), /* @__PURE__ */ q("button", {
1141
1066
  onClick: async () => {
1142
1067
  try {
1143
1068
  await navigator.clipboard.writeText(e), r(!0), i.current && clearTimeout(i.current), i.current = setTimeout(() => r(!1), 2e3);
@@ -1150,104 +1075,104 @@ function tt({ text: e }) {
1150
1075
  children: t(n ? "explainAI.copied" : "explainAI.copy")
1151
1076
  });
1152
1077
  }
1153
- function nt({ rec: e }) {
1154
- let { t } = O(), n = {
1078
+ function rt({ rec: e }) {
1079
+ let { t } = R(), n = {
1155
1080
  index: t("explainAI.type.index"),
1156
1081
  table: t("explainAI.type.table"),
1157
1082
  cube: t("explainAI.type.cube"),
1158
1083
  general: t("explainAI.type.general")
1159
1084
  };
1160
- return /* @__PURE__ */ G("div", {
1085
+ return /* @__PURE__ */ J("div", {
1161
1086
  className: "dc:p-4 dc:border border-dc-border dc:rounded-lg bg-dc-surface",
1162
1087
  children: [
1163
- /* @__PURE__ */ G("div", {
1088
+ /* @__PURE__ */ J("div", {
1164
1089
  className: "dc:flex dc:items-center dc:gap-2 dc:mb-2",
1165
- children: [/* @__PURE__ */ W("span", {
1166
- className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-medium dc:rounded ${Ze[e.severity]}`,
1090
+ children: [/* @__PURE__ */ q("span", {
1091
+ className: `dc:px-2 dc:py-0.5 dc:text-xs dc:font-medium dc:rounded ${Qe[e.severity]}`,
1167
1092
  children: n[e.type]
1168
- }), /* @__PURE__ */ W("h5", {
1093
+ }), /* @__PURE__ */ q("h5", {
1169
1094
  className: "dc:font-medium text-dc-text",
1170
- children: Y(e.title)
1095
+ children: Xe(e.title)
1171
1096
  })]
1172
1097
  }),
1173
- /* @__PURE__ */ W("p", {
1098
+ /* @__PURE__ */ q("p", {
1174
1099
  className: "dc:text-sm text-dc-text-secondary dc:mb-3",
1175
- children: Y(e.description)
1100
+ children: Xe(e.description)
1176
1101
  }),
1177
- e.sql && /* @__PURE__ */ W("div", {
1102
+ e.sql && /* @__PURE__ */ q("div", {
1178
1103
  className: "dc:mt-2",
1179
- children: /* @__PURE__ */ W(d, {
1104
+ children: /* @__PURE__ */ q(y, {
1180
1105
  code: e.sql,
1181
1106
  language: "sql",
1182
- headerRight: /* @__PURE__ */ W(tt, { text: e.sql })
1107
+ headerRight: /* @__PURE__ */ q(nt, { text: e.sql })
1183
1108
  })
1184
1109
  }),
1185
- e.cubeCode && /* @__PURE__ */ G("div", {
1110
+ e.cubeCode && /* @__PURE__ */ J("div", {
1186
1111
  className: "dc:mt-2",
1187
- children: [e.cubeName && /* @__PURE__ */ W("p", {
1112
+ children: [e.cubeName && /* @__PURE__ */ q("p", {
1188
1113
  className: "dc:text-xs text-dc-text-muted dc:mb-1",
1189
1114
  children: t("explainAI.addToCube", { cubeName: e.cubeName })
1190
- }), /* @__PURE__ */ G("div", {
1115
+ }), /* @__PURE__ */ J("div", {
1191
1116
  className: "dc:relative",
1192
- children: [/* @__PURE__ */ W("pre", {
1117
+ children: [/* @__PURE__ */ q("pre", {
1193
1118
  className: "dc:p-3 dc:text-xs bg-dc-surface-secondary dc:rounded dc:overflow-x-auto dc:font-mono text-dc-text",
1194
1119
  children: e.cubeCode
1195
- }), /* @__PURE__ */ W("div", {
1120
+ }), /* @__PURE__ */ q("div", {
1196
1121
  className: "dc:absolute dc:top-1 dc:right-1",
1197
- children: /* @__PURE__ */ W(tt, { text: e.cubeCode })
1122
+ children: /* @__PURE__ */ q(nt, { text: e.cubeCode })
1198
1123
  })]
1199
1124
  })]
1200
1125
  }),
1201
- e.estimatedImpact && /* @__PURE__ */ G("p", {
1126
+ e.estimatedImpact && /* @__PURE__ */ J("p", {
1202
1127
  className: "dc:text-xs text-dc-text-muted dc:mt-2",
1203
1128
  children: [
1204
- /* @__PURE__ */ W("strong", { children: t("explainAI.expectedImpact") }),
1129
+ /* @__PURE__ */ q("strong", { children: t("explainAI.expectedImpact") }),
1205
1130
  " ",
1206
- Y(e.estimatedImpact)
1131
+ Xe(e.estimatedImpact)
1207
1132
  ]
1208
1133
  })
1209
1134
  ]
1210
1135
  });
1211
1136
  }
1212
- function rt({ analysis: e, onClose: t, onClear: n }) {
1213
- let { t: r } = O(), i = t || n;
1214
- return L.useEffect(() => {
1137
+ function it({ analysis: e, onClose: t, onClear: n }) {
1138
+ let { t: r } = R(), i = t || n;
1139
+ return B.useEffect(() => {
1215
1140
  let e = (e) => {
1216
1141
  e.key === "Escape" && i && i();
1217
1142
  };
1218
1143
  return window.addEventListener("keydown", e), () => window.removeEventListener("keydown", e);
1219
- }, [i]), L.useEffect(() => (document.body.style.overflow = "hidden", () => {
1144
+ }, [i]), B.useEffect(() => (document.body.style.overflow = "hidden", () => {
1220
1145
  document.body.style.overflow = "";
1221
- }), []), /* @__PURE__ */ G("div", {
1146
+ }), []), /* @__PURE__ */ J("div", {
1222
1147
  className: "dc:fixed dc:inset-0 dc:z-50 dc:flex dc:items-center dc:justify-center dc:p-4 bg-black/50",
1223
- children: [/* @__PURE__ */ W("div", {
1148
+ children: [/* @__PURE__ */ q("div", {
1224
1149
  className: "dc:absolute dc:inset-0",
1225
1150
  onClick: i,
1226
1151
  "aria-hidden": "true"
1227
- }), /* @__PURE__ */ G("div", {
1152
+ }), /* @__PURE__ */ J("div", {
1228
1153
  className: "dc:relative dc:w-full dc:max-w-4xl dc:max-h-[90vh] bg-dc-surface dc:rounded-lg dc:shadow-xl dc:flex dc:flex-col",
1229
1154
  children: [
1230
- /* @__PURE__ */ G("div", {
1155
+ /* @__PURE__ */ J("div", {
1231
1156
  className: "dc:flex dc:items-center dc:justify-between dc:px-6 dc:py-4 dc:border-b border-dc-border dc:flex-shrink-0",
1232
- children: [/* @__PURE__ */ G("div", {
1157
+ children: [/* @__PURE__ */ J("div", {
1233
1158
  className: "dc:flex dc:items-center dc:gap-3",
1234
- children: [/* @__PURE__ */ W("span", {
1159
+ children: [/* @__PURE__ */ q("span", {
1235
1160
  className: "dc:text-lg",
1236
1161
  children: "✨"
1237
- }), /* @__PURE__ */ W("h3", {
1162
+ }), /* @__PURE__ */ q("h3", {
1238
1163
  className: "dc:text-lg dc:font-semibold text-dc-text",
1239
1164
  children: r("explainAI.title")
1240
1165
  })]
1241
- }), /* @__PURE__ */ W("button", {
1166
+ }), /* @__PURE__ */ q("button", {
1242
1167
  onClick: i,
1243
1168
  className: "dc:p-2 dc:rounded-lg hover:bg-dc-surface-hover text-dc-text-secondary hover:text-dc-text dc:transition-colors",
1244
1169
  "aria-label": "Close",
1245
- children: /* @__PURE__ */ W("svg", {
1170
+ children: /* @__PURE__ */ q("svg", {
1246
1171
  className: "dc:w-5 dc:h-5",
1247
1172
  fill: "none",
1248
1173
  stroke: "currentColor",
1249
1174
  viewBox: "0 0 24 24",
1250
- children: /* @__PURE__ */ W("path", {
1175
+ children: /* @__PURE__ */ q("path", {
1251
1176
  strokeLinecap: "round",
1252
1177
  strokeLinejoin: "round",
1253
1178
  strokeWidth: 2,
@@ -1256,50 +1181,50 @@ function rt({ analysis: e, onClose: t, onClear: n }) {
1256
1181
  })
1257
1182
  })]
1258
1183
  }),
1259
- /* @__PURE__ */ G("div", {
1184
+ /* @__PURE__ */ J("div", {
1260
1185
  className: "dc:flex-1 dc:overflow-y-auto dc:px-6 dc:py-4 dc:space-y-6",
1261
1186
  children: [
1262
- /* @__PURE__ */ W($e, {
1187
+ /* @__PURE__ */ q(et, {
1263
1188
  assessment: e.assessment,
1264
1189
  reason: e.assessmentReason
1265
1190
  }),
1266
- /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("h4", {
1191
+ /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
1267
1192
  className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
1268
1193
  children: r("explainAI.summary")
1269
- }), /* @__PURE__ */ W("p", {
1194
+ }), /* @__PURE__ */ q("p", {
1270
1195
  className: "text-dc-text",
1271
- children: Y(e.summary)
1196
+ children: Xe(e.summary)
1272
1197
  })] }),
1273
- e.queryUnderstanding && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("h4", {
1198
+ e.queryUnderstanding && /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
1274
1199
  className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
1275
1200
  children: r("explainAI.queryAnalysis")
1276
- }), /* @__PURE__ */ W("p", {
1201
+ }), /* @__PURE__ */ q("p", {
1277
1202
  className: "text-dc-text-secondary",
1278
- children: Y(e.queryUnderstanding)
1203
+ children: Xe(e.queryUnderstanding)
1279
1204
  })] }),
1280
- e.issues && e.issues.length > 0 && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("h4", {
1205
+ e.issues && e.issues.length > 0 && /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
1281
1206
  className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-2",
1282
1207
  children: r("explainAI.issuesFound", { count: e.issues.length })
1283
- }), /* @__PURE__ */ W("div", {
1208
+ }), /* @__PURE__ */ q("div", {
1284
1209
  className: "dc:space-y-1 bg-dc-surface-secondary dc:rounded-lg dc:p-3",
1285
- children: e.issues.map((e, t) => /* @__PURE__ */ W(et, { issue: e }, t))
1210
+ children: e.issues.map((e, t) => /* @__PURE__ */ q(tt, { issue: e }, t))
1286
1211
  })] }),
1287
- e.recommendations && e.recommendations.length > 0 && /* @__PURE__ */ G("div", { children: [/* @__PURE__ */ W("h4", {
1212
+ e.recommendations && e.recommendations.length > 0 && /* @__PURE__ */ J("div", { children: [/* @__PURE__ */ q("h4", {
1288
1213
  className: "dc:text-sm dc:font-semibold text-dc-text-muted dc:uppercase dc:mb-3",
1289
1214
  children: r("explainAI.recommendations", { count: e.recommendations.length })
1290
- }), /* @__PURE__ */ W("div", {
1215
+ }), /* @__PURE__ */ q("div", {
1291
1216
  className: "dc:space-y-4",
1292
- children: e.recommendations.map((e, t) => /* @__PURE__ */ W(nt, { rec: e }, t))
1217
+ children: e.recommendations.map((e, t) => /* @__PURE__ */ q(rt, { rec: e }, t))
1293
1218
  })] }),
1294
- (!e.recommendations || e.recommendations.length === 0) && /* @__PURE__ */ W("div", {
1219
+ (!e.recommendations || e.recommendations.length === 0) && /* @__PURE__ */ q("div", {
1295
1220
  className: "text-dc-text-muted dc:italic dc:p-4 bg-dc-surface-secondary dc:rounded-lg",
1296
1221
  children: r("explainAI.noRecommendations")
1297
1222
  })
1298
1223
  ]
1299
1224
  }),
1300
- /* @__PURE__ */ G("div", {
1225
+ /* @__PURE__ */ J("div", {
1301
1226
  className: "dc:flex dc:items-center dc:justify-between dc:px-6 dc:py-3 dc:border-t border-dc-border dc:flex-shrink-0 bg-dc-surface-secondary",
1302
- children: [e._meta && /* @__PURE__ */ G("div", {
1227
+ children: [e._meta && /* @__PURE__ */ J("div", {
1303
1228
  className: "dc:text-xs text-dc-text-muted",
1304
1229
  children: [
1305
1230
  r("explainAI.modelLabel"),
@@ -1307,7 +1232,7 @@ function rt({ analysis: e, onClose: t, onClear: n }) {
1307
1232
  e._meta.model,
1308
1233
  e._meta.usingUserKey && ` ${r("explainAI.usingUserKey")}`
1309
1234
  ]
1310
- }), /* @__PURE__ */ W("button", {
1235
+ }), /* @__PURE__ */ q("button", {
1311
1236
  onClick: i,
1312
1237
  className: "dc:px-4 dc:py-2 dc:text-sm dc:font-medium dc:rounded-lg bg-dc-primary text-white hover:bg-dc-primary-hover dc:transition-colors",
1313
1238
  children: r("common.actions.close")
@@ -1319,31 +1244,31 @@ function rt({ analysis: e, onClose: t, onClear: n }) {
1319
1244
  }
1320
1245
  //#endregion
1321
1246
  //#region src/client/shared/chartConfigBuilders.ts
1322
- var it = (e) => e.map((e) => e.field), at = (e) => e.length > 0 ? [e[0].field] : [];
1323
- function ot(e) {
1247
+ var at = (e) => e.map((e) => e.field), ot = (e) => e.length > 0 ? [e[0].field] : [];
1248
+ function st(e) {
1324
1249
  let { metrics: t, timeDimension: n, dimension: r, dimensions: i } = e;
1325
1250
  return {
1326
1251
  xAxis: n ? [n.field] : r ? [r.field] : [],
1327
- yAxis: it(t),
1252
+ yAxis: at(t),
1328
1253
  series: i.length > 1 ? [i[1].field] : r && n ? [r.field] : []
1329
1254
  };
1330
1255
  }
1331
- function st(e) {
1256
+ function ct(e) {
1332
1257
  let { metrics: t, timeDimension: n, dimension: r, dimensions: i } = e;
1333
1258
  return {
1334
1259
  xAxis: r ? [r.field] : n ? [n.field] : [],
1335
- yAxis: it(t),
1260
+ yAxis: at(t),
1336
1261
  series: i.length > 1 ? [i[1].field] : n && r ? [n.field] : []
1337
1262
  };
1338
1263
  }
1339
- function ct(e) {
1264
+ function lt(e) {
1340
1265
  let { metrics: t, dimension: n } = e;
1341
1266
  return {
1342
1267
  xAxis: n ? [n.field] : [],
1343
- yAxis: at(t)
1268
+ yAxis: ot(t)
1344
1269
  };
1345
1270
  }
1346
- function lt(e) {
1271
+ function ut(e) {
1347
1272
  let { metrics: t, breakdowns: n, dimension: r, dimensions: i } = e;
1348
1273
  return t.length >= 2 ? {
1349
1274
  xAxis: [t[0].field],
@@ -1351,11 +1276,11 @@ function lt(e) {
1351
1276
  series: r ? [r.field] : []
1352
1277
  } : {
1353
1278
  xAxis: n.length > 0 ? [n[0].field] : [],
1354
- yAxis: at(t),
1279
+ yAxis: ot(t),
1355
1280
  series: i.length > 1 ? [i[1].field] : []
1356
1281
  };
1357
1282
  }
1358
- function ut(e) {
1283
+ function dt(e) {
1359
1284
  let { metrics: t, timeDimension: n, dimension: r } = e;
1360
1285
  return {
1361
1286
  xAxis: t.length > 0 ? [t[0].field] : [],
@@ -1364,210 +1289,210 @@ function ut(e) {
1364
1289
  series: r ? [r.field] : n ? [n.field] : []
1365
1290
  };
1366
1291
  }
1367
- function dt(e) {
1292
+ function ft(e) {
1368
1293
  let { metrics: t, dimension: n } = e;
1369
1294
  return {
1370
1295
  xAxis: n ? [n.field] : [],
1371
- yAxis: at(t)
1296
+ yAxis: ot(t)
1372
1297
  };
1373
1298
  }
1374
- function ft(e) {
1299
+ function pt(e) {
1375
1300
  let { metrics: t, timeDimension: n } = e;
1376
1301
  return {
1377
1302
  dateField: n ? [n.field] : [],
1378
- valueField: at(t)
1303
+ valueField: ot(t)
1379
1304
  };
1380
1305
  }
1381
- function pt(e) {
1382
- return { yAxis: at(e.metrics) };
1383
- }
1384
1306
  function mt(e) {
1307
+ return { yAxis: ot(e.metrics) };
1308
+ }
1309
+ function ht(e) {
1385
1310
  let { metrics: t, breakdowns: n } = e;
1386
1311
  return { xAxis: [...n.map((e) => e.field), ...t.map((e) => e.field)] };
1387
1312
  }
1388
- function ht() {
1313
+ function gt() {
1389
1314
  return {};
1390
1315
  }
1391
- function gt(e) {
1316
+ function _t(e) {
1392
1317
  let { metrics: t, breakdowns: n } = e;
1393
1318
  return {
1394
1319
  xAxis: n.length > 0 ? [n[0].field] : [],
1395
- yAxis: it(t)
1320
+ yAxis: at(t)
1396
1321
  };
1397
1322
  }
1398
- var _t = {
1399
- line: ot,
1400
- area: ot,
1401
- bar: st,
1402
- pie: ct,
1403
- scatter: lt,
1404
- bubble: ut,
1405
- radar: dt,
1406
- radialBar: dt,
1407
- treemap: dt,
1408
- activityGrid: ft,
1409
- kpiNumber: pt,
1410
- kpiDelta: pt,
1411
- kpiText: pt,
1412
- table: mt,
1413
- markdown: ht
1323
+ var vt = {
1324
+ line: st,
1325
+ area: st,
1326
+ bar: ct,
1327
+ pie: lt,
1328
+ scatter: ut,
1329
+ bubble: dt,
1330
+ radar: ft,
1331
+ radialBar: ft,
1332
+ treemap: ft,
1333
+ activityGrid: pt,
1334
+ kpiNumber: mt,
1335
+ kpiDelta: mt,
1336
+ kpiText: mt,
1337
+ table: ht,
1338
+ markdown: gt
1414
1339
  };
1415
- function vt(e) {
1416
- return _t[e] || gt;
1340
+ function yt(e) {
1341
+ return vt[e] || _t;
1417
1342
  }
1418
1343
  //#endregion
1419
1344
  //#region src/client/shared/chartDefaults.ts
1420
- function yt(e) {
1421
- return e.isTimeDimension;
1422
- }
1423
1345
  function bt(e) {
1424
- return e.find(yt);
1346
+ return e.isTimeDimension;
1425
1347
  }
1426
1348
  function xt(e) {
1427
- return e.find((e) => !e.isTimeDimension);
1349
+ return e.find(bt);
1428
1350
  }
1429
1351
  function St(e) {
1430
- return e.filter((e) => !e.isTimeDimension);
1352
+ return e.find((e) => !e.isTimeDimension);
1431
1353
  }
1432
1354
  function Ct(e) {
1433
- return e.filter(yt);
1355
+ return e.filter((e) => !e.isTimeDimension);
1356
+ }
1357
+ function wt(e) {
1358
+ return e.filter(bt);
1434
1359
  }
1435
- function wt(e, t) {
1360
+ function Tt(e, t) {
1436
1361
  return {
1437
1362
  measureCount: e.length,
1438
1363
  dimensionCount: t.length,
1439
- timeDimensionCount: Ct(t).length
1364
+ timeDimensionCount: wt(t).length
1440
1365
  };
1441
1366
  }
1442
- function Tt(e, t, n) {
1367
+ function Et(e, t, n) {
1443
1368
  let r = c[e];
1444
- return !r || !r.isAvailable ? { available: !0 } : r.isAvailable(wt(t, n));
1369
+ return !r || !r.isAvailable ? { available: !0 } : r.isAvailable(Tt(t, n));
1445
1370
  }
1446
- function Et(e, t) {
1371
+ function Dt(e, t) {
1447
1372
  let n = Object.keys(c), r = {};
1448
- for (let i of n) r[i] = Tt(i, e, t);
1373
+ for (let i of n) r[i] = Et(i, e, t);
1449
1374
  return r;
1450
1375
  }
1451
- function Dt(e, t, n) {
1452
- if (Tt(n, e, t).available || e.length === 0 && t.length === 0) return n;
1453
- let r = Ct(t).length > 0, i = St(t).length > 0, a = e.length > 0;
1376
+ function Ot(e, t, n) {
1377
+ if (Et(n, e, t).available || e.length === 0 && t.length === 0) return n;
1378
+ let r = wt(t).length > 0, i = Ct(t).length > 0, a = e.length > 0;
1454
1379
  return r && a ? "line" : i && a ? "bar" : a && !i && !r ? "kpiNumber" : "table";
1455
1380
  }
1456
- function Ot(e, t, n) {
1457
- let r = Dt(e, t, n);
1381
+ function kt(e, t, n) {
1382
+ let r = Ot(e, t, n);
1458
1383
  return {
1459
1384
  chartType: r,
1460
- chartConfig: kt(r, e, t)
1385
+ chartConfig: At(r, e, t)
1461
1386
  };
1462
1387
  }
1463
- function kt(e, t, n) {
1464
- return vt(e)({
1388
+ function At(e, t, n) {
1389
+ return yt(e)({
1465
1390
  metrics: t,
1466
1391
  breakdowns: n,
1467
- timeDimension: bt(n),
1468
- dimension: xt(n),
1469
- dimensions: St(n)
1392
+ timeDimension: xt(n),
1393
+ dimension: St(n),
1394
+ dimensions: Ct(n)
1470
1395
  });
1471
1396
  }
1472
- function At(e, t, n, r) {
1473
- if (r && Tt(n, e, t).available) return null;
1474
- let i = Dt(e, t, n);
1397
+ function jt(e, t, n, r) {
1398
+ if (r && Et(n, e, t).available) return null;
1399
+ let i = Ot(e, t, n);
1475
1400
  return i === n ? null : i;
1476
1401
  }
1477
1402
  //#endregion
1478
1403
  //#region src/client/components/AnalysisBuilder/ExecutionPlanPanelParts.tsx
1479
- function jt({ title: e, height: t, className: n, children: r }) {
1480
- return /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("h4", {
1404
+ function Mt({ title: e, height: t, className: n, children: r }) {
1405
+ return /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("h4", {
1481
1406
  className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2",
1482
1407
  children: e
1483
- }), /* @__PURE__ */ W("div", {
1408
+ }), /* @__PURE__ */ q("div", {
1484
1409
  className: n,
1485
1410
  style: { height: t },
1486
1411
  children: r
1487
1412
  })] });
1488
1413
  }
1489
- function Mt({ sql: e, sqlLoading: t, sqlError: n, sqlPlaceholder: r, formattedSql: i, title: a, height: o, headerRight: s }) {
1490
- let { t: c } = O();
1491
- return t ? /* @__PURE__ */ W(jt, {
1414
+ function Nt({ sql: e, sqlLoading: t, sqlError: n, sqlPlaceholder: r, formattedSql: i, title: a, height: o, headerRight: s }) {
1415
+ let { t: c } = R();
1416
+ return t ? /* @__PURE__ */ q(Mt, {
1492
1417
  title: a,
1493
1418
  height: o,
1494
1419
  className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm dc:animate-pulse",
1495
1420
  children: c("results.debug.loadingSql")
1496
- }) : n ? /* @__PURE__ */ W(jt, {
1421
+ }) : n ? /* @__PURE__ */ q(Mt, {
1497
1422
  title: a,
1498
1423
  height: o,
1499
1424
  className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
1500
1425
  children: n.message
1501
- }) : e ? /* @__PURE__ */ W(d, {
1426
+ }) : e ? /* @__PURE__ */ q(y, {
1502
1427
  code: i,
1503
1428
  language: "sql",
1504
1429
  title: a,
1505
1430
  height: o,
1506
1431
  headerRight: s
1507
- }) : /* @__PURE__ */ W(jt, {
1432
+ }) : /* @__PURE__ */ q(Mt, {
1508
1433
  title: a,
1509
1434
  height: o,
1510
1435
  className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm",
1511
1436
  children: r
1512
1437
  });
1513
1438
  }
1514
- function Nt({ summary: e }) {
1515
- let { t } = O();
1516
- return /* @__PURE__ */ G("div", {
1439
+ function Pt({ summary: e }) {
1440
+ let { t } = R();
1441
+ return /* @__PURE__ */ J("div", {
1517
1442
  className: "dc:flex dc:flex-wrap dc:items-center dc:gap-2",
1518
1443
  children: [
1519
- /* @__PURE__ */ W("span", {
1444
+ /* @__PURE__ */ q("span", {
1520
1445
  className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-accent text-white dc:rounded",
1521
1446
  children: e.database.toUpperCase()
1522
1447
  }),
1523
- e.hasSequentialScans && /* @__PURE__ */ W("span", {
1448
+ e.hasSequentialScans && /* @__PURE__ */ q("span", {
1524
1449
  className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-warning-bg text-dc-warning dc:border border-dc-warning dc:rounded",
1525
1450
  children: t("debug.sequentialScans")
1526
1451
  }),
1527
- e.usedIndexes.length > 0 && /* @__PURE__ */ W("span", {
1452
+ e.usedIndexes.length > 0 && /* @__PURE__ */ q("span", {
1528
1453
  className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-success-bg text-dc-success dc:border border-dc-success dc:rounded",
1529
1454
  children: t(e.usedIndexes.length === 1 ? "debug.indexesUsed" : "debug.indexesUsedPlural", { count: e.usedIndexes.length })
1530
1455
  }),
1531
- e.executionTime !== void 0 && /* @__PURE__ */ W("span", {
1456
+ e.executionTime !== void 0 && /* @__PURE__ */ q("span", {
1532
1457
  className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-surface-secondary text-dc-text-secondary dc:border border-dc-border dc:rounded",
1533
1458
  children: t("debug.executionTime", { time: e.executionTime.toFixed(2) })
1534
1459
  }),
1535
- e.planningTime !== void 0 && /* @__PURE__ */ W("span", {
1460
+ e.planningTime !== void 0 && /* @__PURE__ */ q("span", {
1536
1461
  className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-surface-secondary text-dc-text-secondary dc:border border-dc-border dc:rounded",
1537
1462
  children: t("debug.planningTime", { time: e.planningTime.toFixed(2) })
1538
1463
  }),
1539
- e.totalCost !== void 0 && /* @__PURE__ */ W("span", {
1464
+ e.totalCost !== void 0 && /* @__PURE__ */ q("span", {
1540
1465
  className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium bg-dc-surface-secondary text-dc-text-secondary dc:border border-dc-border dc:rounded",
1541
1466
  children: t("debug.cost", { cost: e.totalCost.toFixed(2) })
1542
1467
  })
1543
1468
  ]
1544
1469
  });
1545
1470
  }
1546
- function Pt({ explainLoading: e, explainError: t, explainResult: n, useAnalyze: r, aiButton: i }) {
1547
- let { t: a } = O();
1548
- return e ? /* @__PURE__ */ W("div", {
1471
+ function Ft({ explainLoading: e, explainError: t, explainResult: n, useAnalyze: r, aiButton: i }) {
1472
+ let { t: a } = R();
1473
+ return e ? /* @__PURE__ */ q("div", {
1549
1474
  className: "bg-dc-surface-secondary dc:border border-dc-border dc:rounded dc:p-3 text-dc-text-muted dc:text-sm dc:animate-pulse",
1550
1475
  children: a(r ? "debug.explainRunningAnalyze" : "debug.explainRunningBasic")
1551
- }) : t ? /* @__PURE__ */ G("div", {
1476
+ }) : t ? /* @__PURE__ */ J("div", {
1552
1477
  className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
1553
1478
  children: [
1554
- /* @__PURE__ */ W("strong", { children: a("debug.explainError") }),
1479
+ /* @__PURE__ */ q("strong", { children: a("debug.explainError") }),
1555
1480
  " ",
1556
1481
  t.message
1557
1482
  ]
1558
- }) : n ? /* @__PURE__ */ G("div", {
1483
+ }) : n ? /* @__PURE__ */ J("div", {
1559
1484
  className: "dc:space-y-3",
1560
1485
  children: [
1561
- /* @__PURE__ */ W(Nt, { summary: n.summary }),
1562
- n.summary.usedIndexes.length > 0 && /* @__PURE__ */ G("div", {
1486
+ /* @__PURE__ */ q(Pt, { summary: n.summary }),
1487
+ n.summary.usedIndexes.length > 0 && /* @__PURE__ */ J("div", {
1563
1488
  className: "dc:text-xs text-dc-text-muted",
1564
1489
  children: [
1565
- /* @__PURE__ */ W("strong", { children: a("debug.indexes") }),
1490
+ /* @__PURE__ */ q("strong", { children: a("debug.indexes") }),
1566
1491
  " ",
1567
1492
  n.summary.usedIndexes.join(", ")
1568
1493
  ]
1569
1494
  }),
1570
- /* @__PURE__ */ W(d, {
1495
+ /* @__PURE__ */ q(y, {
1571
1496
  code: n.raw,
1572
1497
  language: "sql",
1573
1498
  title: a("debug.executionPlanTitle", { database: n.summary.database }),
@@ -1579,24 +1504,24 @@ function Pt({ explainLoading: e, explainError: t, explainResult: n, useAnalyze:
1579
1504
  }
1580
1505
  //#endregion
1581
1506
  //#region src/client/components/AnalysisBuilder/ExecutionPlanPanel.tsx
1582
- var Ft = de(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder: r = "Add metrics to generate SQL", explainResult: i, explainLoading: a = !1, explainHasRun: o = !1, explainError: s, runExplain: c, aiAnalysis: l, aiAnalysisLoading: u = !1, aiAnalysisError: d, runAIAnalysis: f, clearAIAnalysis: p, enableAI: m = !1, query: h, title: g = "Generated SQL", height: _ = "16rem" }) {
1583
- let { t: v } = O(), [y, b] = H(!1), [x, S] = H(!1), C = e ? e.sql + (e.params && e.params.length > 0 ? "\n\n-- Parameters:\n" + JSON.stringify(e.params, null, 2) : "") : "", w = () => {
1507
+ var It = _e(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder: r = "Add metrics to generate SQL", explainResult: i, explainLoading: a = !1, explainHasRun: o = !1, explainError: s, runExplain: c, aiAnalysis: l, aiAnalysisLoading: u = !1, aiAnalysisError: d, runAIAnalysis: f, clearAIAnalysis: p, enableAI: m = !1, query: h, title: g = "Generated SQL", height: _ = "16rem" }) {
1508
+ let { t: v } = R(), [y, b] = G(!1), [x, S] = G(!1), C = e ? e.sql + (e.params && e.params.length > 0 ? "\n\n-- Parameters:\n" + JSON.stringify(e.params, null, 2) : "") : "", w = () => {
1584
1509
  f && i && h && (f(i, h), S(!0));
1585
1510
  }, T = () => {
1586
1511
  S(!1);
1587
- }, E = m && i ? /* @__PURE__ */ W("button", {
1512
+ }, E = m && i ? /* @__PURE__ */ q("button", {
1588
1513
  onClick: w,
1589
1514
  disabled: u,
1590
1515
  className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium dc:rounded bg-dc-accent text-white hover:bg-dc-accent-hover dc:disabled:opacity-50 dc:disabled:cursor-not-allowed dc:flex dc:items-center dc:gap-1",
1591
- children: u ? /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ W("span", {
1516
+ children: u ? /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ q("span", {
1592
1517
  className: "dc:animate-spin",
1593
1518
  children: "⟳"
1594
- }), v("debug.aiAnalyzing")] }) : /* @__PURE__ */ W(U, { children: `✨ ${v("debug.aiAnalysis")}` })
1519
+ }), v("debug.aiAnalyzing")] }) : /* @__PURE__ */ q(K, { children: `✨ ${v("debug.aiAnalysis")}` })
1595
1520
  }) : null;
1596
- return /* @__PURE__ */ G("div", {
1521
+ return /* @__PURE__ */ J("div", {
1597
1522
  className: "dc:space-y-3",
1598
1523
  children: [
1599
- /* @__PURE__ */ W(Mt, {
1524
+ /* @__PURE__ */ q(Nt, {
1600
1525
  sql: e,
1601
1526
  sqlLoading: t,
1602
1527
  sqlError: n,
@@ -1604,37 +1529,37 @@ var Ft = de(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder:
1604
1529
  formattedSql: C,
1605
1530
  title: g,
1606
1531
  height: _,
1607
- headerRight: /* @__PURE__ */ G(U, { children: [/* @__PURE__ */ G("label", {
1532
+ headerRight: /* @__PURE__ */ J(K, { children: [/* @__PURE__ */ J("label", {
1608
1533
  className: "dc:flex dc:items-center dc:gap-1 dc:text-xs text-dc-text-secondary dc:cursor-pointer",
1609
- children: [/* @__PURE__ */ W("input", {
1534
+ children: [/* @__PURE__ */ q("input", {
1610
1535
  type: "checkbox",
1611
1536
  checked: y,
1612
1537
  onChange: (e) => b(e.target.checked),
1613
1538
  className: "dc:w-3 dc:h-3 dc:rounded border-dc-border text-dc-accent focus:ring-dc-accent"
1614
1539
  }), v("debug.explainIncludeTiming")]
1615
- }), /* @__PURE__ */ W("button", {
1540
+ }), /* @__PURE__ */ q("button", {
1616
1541
  onClick: () => c({ analyze: y }),
1617
1542
  disabled: a,
1618
1543
  className: "dc:px-2 dc:py-1 dc:text-xs dc:font-medium dc:rounded dc:border border-dc-border bg-dc-surface hover:bg-dc-surface-hover text-dc-text-secondary hover:text-dc-text dc:transition-colors dc:disabled:opacity-50 dc:disabled:cursor-not-allowed",
1619
1544
  children: v(a ? "debug.explainRunning" : "debug.explainPlan")
1620
1545
  })] })
1621
1546
  }),
1622
- o && /* @__PURE__ */ W("div", { children: /* @__PURE__ */ W(Pt, {
1547
+ o && /* @__PURE__ */ q("div", { children: /* @__PURE__ */ q(Ft, {
1623
1548
  explainLoading: a,
1624
1549
  explainError: s,
1625
1550
  explainResult: i,
1626
1551
  useAnalyze: y,
1627
1552
  aiButton: E
1628
1553
  }) }),
1629
- d && /* @__PURE__ */ G("div", {
1554
+ d && /* @__PURE__ */ J("div", {
1630
1555
  className: "text-dc-error dc:text-sm bg-dc-danger-bg dc:p-3 dc:rounded dc:border border-dc-error",
1631
1556
  children: [
1632
- /* @__PURE__ */ W("strong", { children: v("debug.aiAnalysisError") }),
1557
+ /* @__PURE__ */ q("strong", { children: v("debug.aiAnalysisError") }),
1633
1558
  " ",
1634
1559
  d.message
1635
1560
  ]
1636
1561
  }),
1637
- x && l && /* @__PURE__ */ W(rt, {
1562
+ x && l && /* @__PURE__ */ q(it, {
1638
1563
  analysis: l,
1639
1564
  onClose: T
1640
1565
  })
@@ -1643,7 +1568,7 @@ var Ft = de(function({ sql: e, sqlLoading: t = !1, sqlError: n, sqlPlaceholder:
1643
1568
  });
1644
1569
  //#endregion
1645
1570
  //#region src/client/adapters/queryModeAdapter.ts
1646
- function It() {
1571
+ function Lt() {
1647
1572
  return {
1648
1573
  metrics: [],
1649
1574
  breakdowns: [],
@@ -1654,10 +1579,10 @@ function It() {
1654
1579
  validationError: null
1655
1580
  };
1656
1581
  }
1657
- function Lt(e) {
1582
+ function Rt(e) {
1658
1583
  return e.map((e) => e.field);
1659
1584
  }
1660
- function Rt(e, t) {
1585
+ function zt(e, t) {
1661
1586
  let n = [], r = [];
1662
1587
  for (let i of e) if (i.isTimeDimension) {
1663
1588
  let e = {
@@ -1665,7 +1590,7 @@ function Rt(e, t) {
1665
1590
  granularity: i.granularity || "day"
1666
1591
  };
1667
1592
  if (i.enableComparison) {
1668
- let n = ge(i.field, t);
1593
+ let n = Ce(i.field, t);
1669
1594
  n && (e.compareDateRange = n);
1670
1595
  }
1671
1596
  r.push(e);
@@ -1675,31 +1600,31 @@ function Rt(e, t) {
1675
1600
  timeDimensions: r
1676
1601
  };
1677
1602
  }
1678
- function zt(e) {
1679
- let { dimensions: t, timeDimensions: n } = Rt(e.breakdowns, e.filters), r = {
1680
- measures: Lt(e.metrics),
1603
+ function Bt(e) {
1604
+ let { dimensions: t, timeDimensions: n } = zt(e.breakdowns, e.filters), r = {
1605
+ measures: Rt(e.metrics),
1681
1606
  dimensions: t
1682
1607
  };
1683
1608
  return n.length > 0 && (r.timeDimensions = n), e.filters.length > 0 && (r.filters = e.filters), e.order && Object.keys(e.order).length > 0 && (r.order = e.order), e.limit != null && (r.limit = e.limit), r;
1684
1609
  }
1685
- function Bt(e) {
1610
+ function Vt(e) {
1686
1611
  return e.map((e, t) => ({
1687
- id: C(),
1612
+ id: p(),
1688
1613
  field: e,
1689
- label: f(t)
1614
+ label: d(t)
1690
1615
  }));
1691
1616
  }
1692
- function Vt(e) {
1617
+ function Ht(e) {
1693
1618
  let t = [];
1694
1619
  if (e.dimensions) for (let n of e.dimensions) t.push({
1695
- id: C(),
1620
+ id: p(),
1696
1621
  field: n,
1697
1622
  isTimeDimension: !1
1698
1623
  });
1699
1624
  if (e.timeDimensions) for (let n of e.timeDimensions) {
1700
1625
  let e = !!(n.compareDateRange && n.compareDateRange.length > 0);
1701
1626
  t.push({
1702
- id: C(),
1627
+ id: p(),
1703
1628
  field: n.dimension,
1704
1629
  granularity: n.granularity,
1705
1630
  isTimeDimension: !0,
@@ -1708,10 +1633,10 @@ function Vt(e) {
1708
1633
  }
1709
1634
  return t;
1710
1635
  }
1711
- function Ht(e) {
1636
+ function Ut(e) {
1712
1637
  return {
1713
- metrics: Bt(e.measures || []),
1714
- breakdowns: Vt(e),
1638
+ metrics: Vt(e.measures || []),
1639
+ breakdowns: Ht(e),
1715
1640
  filters: e.filters || [],
1716
1641
  order: e.order,
1717
1642
  limit: e.limit,
@@ -1719,14 +1644,14 @@ function Ht(e) {
1719
1644
  validationError: null
1720
1645
  };
1721
1646
  }
1722
- function Ut(e) {
1647
+ function Wt(e) {
1723
1648
  return typeof e == "object" && !!e && "queries" in e && Array.isArray(e.queries);
1724
1649
  }
1725
1650
  var X = {
1726
1651
  type: "query",
1727
1652
  createInitial() {
1728
1653
  return {
1729
- queryStates: [It()],
1654
+ queryStates: [Lt()],
1730
1655
  activeQueryIndex: 0,
1731
1656
  mergeStrategy: "concat"
1732
1657
  };
@@ -1746,22 +1671,22 @@ var X = {
1746
1671
  load(e) {
1747
1672
  if (e.analysisType !== "query") throw Error(`Cannot load ${e.analysisType} config with query adapter`);
1748
1673
  let t = e;
1749
- if (Ut(t.query)) {
1750
- let e = t.query, n = e.queries.map(Ht);
1751
- return n.length === 0 && n.push(It()), {
1674
+ if (Wt(t.query)) {
1675
+ let e = t.query, n = e.queries.map(Ut);
1676
+ return n.length === 0 && n.push(Lt()), {
1752
1677
  queryStates: n,
1753
1678
  activeQueryIndex: 0,
1754
1679
  mergeStrategy: e.mergeStrategy || "concat"
1755
1680
  };
1756
1681
  }
1757
1682
  return {
1758
- queryStates: [Ht(t.query)],
1683
+ queryStates: [Ut(t.query)],
1759
1684
  activeQueryIndex: 0,
1760
1685
  mergeStrategy: "concat"
1761
1686
  };
1762
1687
  },
1763
1688
  save(e, t, n) {
1764
- let r = e.queryStates.map(zt), i = r.length === 1 && e.mergeStrategy === "concat" ? r[0] : {
1689
+ let r = e.queryStates.map(Bt), i = r.length === 1 && e.mergeStrategy === "concat" ? r[0] : {
1765
1690
  queries: r,
1766
1691
  mergeStrategy: e.mergeStrategy
1767
1692
  };
@@ -1802,35 +1727,35 @@ var X = {
1802
1727
  }
1803
1728
  };
1804
1729
  }
1805
- }, Z = /* @__PURE__ */ new Map(), Wt = !1;
1806
- function Gt() {
1807
- Wt ||= (Z.has("query") || Z.set("query", X), Z.has("funnel") || Z.set("funnel", g), Z.has("flow") || Z.set("flow", x), Z.has("retention") || Z.set("retention", b), !0);
1730
+ }, Z = /* @__PURE__ */ new Map(), Gt = !1;
1731
+ function Kt() {
1732
+ Gt ||= (Z.has("query") || Z.set("query", X), Z.has("funnel") || Z.set("funnel", _), Z.has("flow") || Z.set("flow", w), Z.has("retention") || Z.set("retention", b), !0);
1808
1733
  }
1809
1734
  var Q = {
1810
1735
  register(e) {
1811
1736
  Z.has(e.type) && console.warn(`[adapterRegistry] Overwriting existing adapter for type: ${e.type}`), Z.set(e.type, e);
1812
1737
  },
1813
1738
  get(e) {
1814
- Gt();
1739
+ Kt();
1815
1740
  let t = Z.get(e);
1816
1741
  if (!t) throw Error(`[adapterRegistry] No adapter registered for type: ${e}. Available types: ${Array.from(Z.keys()).join(", ") || "none"}`);
1817
1742
  return t;
1818
1743
  },
1819
1744
  has(e) {
1820
- return Gt(), Z.has(e);
1745
+ return Kt(), Z.has(e);
1821
1746
  },
1822
1747
  getRegisteredTypes() {
1823
- return Gt(), Array.from(Z.keys());
1748
+ return Kt(), Array.from(Z.keys());
1824
1749
  },
1825
1750
  clear() {
1826
- Z.clear(), Wt = !1;
1751
+ Z.clear(), Gt = !1;
1827
1752
  }
1828
- }, Kt = () => ({
1753
+ }, qt = () => ({
1829
1754
  analysisType: "query",
1830
1755
  charts: {
1831
1756
  query: X.getDefaultChartConfig(),
1832
- funnel: g.getDefaultChartConfig(),
1833
- flow: x.getDefaultChartConfig(),
1757
+ funnel: _.getDefaultChartConfig(),
1758
+ flow: w.getDefaultChartConfig(),
1834
1759
  retention: b.getDefaultChartConfig()
1835
1760
  },
1836
1761
  activeViews: {
@@ -1841,8 +1766,8 @@ var Q = {
1841
1766
  },
1842
1767
  userManuallySelectedChart: !1,
1843
1768
  localPaletteName: "default"
1844
- }), qt = (e, t, n) => ({
1845
- ...Kt(),
1769
+ }), Jt = (e, t, n) => ({
1770
+ ...qt(),
1846
1771
  setAnalysisType: (t) => {
1847
1772
  e((e) => {
1848
1773
  let n = { ...e.charts };
@@ -2055,22 +1980,22 @@ var Q = {
2055
1980
  ...u
2056
1981
  });
2057
1982
  }
2058
- }), Jt = () => ({
2059
- queryStates: [J()],
1983
+ }), Yt = () => ({
1984
+ queryStates: [Y()],
2060
1985
  activeQueryIndex: 0,
2061
1986
  mergeStrategy: "concat"
2062
- }), Yt = (e, t, n) => ({
2063
- ...Jt(),
1987
+ }), Xt = (e, t, n) => ({
1988
+ ...Yt(),
2064
1989
  setQueryStates: (t) => e({ queryStates: t }),
2065
1990
  updateQueryState: (t, n) => e((e) => {
2066
1991
  let r = [...e.queryStates];
2067
- return r[t] = n(r[t] || J()), { queryStates: r };
1992
+ return r[t] = n(r[t] || Y()), { queryStates: r };
2068
1993
  }),
2069
1994
  setActiveQueryIndex: (t) => e({ activeQueryIndex: t }),
2070
1995
  setMergeStrategy: (t) => e({ mergeStrategy: t }),
2071
1996
  addQuery: () => e((e) => {
2072
- let t = e.queryStates[e.activeQueryIndex] || J(), n = {
2073
- ...J(),
1997
+ let t = e.queryStates[e.activeQueryIndex] || Y(), n = {
1998
+ ...Y(),
2074
1999
  metrics: [...t.metrics],
2075
2000
  breakdowns: [...t.breakdowns],
2076
2001
  filters: [...t.filters]
@@ -2089,10 +2014,10 @@ var Q = {
2089
2014
  };
2090
2015
  }),
2091
2016
  addMetric: (t, n) => e((e) => {
2092
- let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || J(), o = {
2093
- id: C(),
2017
+ let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || Y(), o = {
2018
+ id: p(),
2094
2019
  field: t,
2095
- label: n || f(a.metrics.length)
2020
+ label: n || d(a.metrics.length)
2096
2021
  };
2097
2022
  return i[r] = {
2098
2023
  ...a,
@@ -2100,7 +2025,7 @@ var Q = {
2100
2025
  }, { queryStates: i };
2101
2026
  }),
2102
2027
  removeMetric: (t) => e((e) => {
2103
- let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || J(), a = i.metrics.find((e) => e.id === t)?.field, o = i.metrics.filter((e) => e.id !== t), s = i.order;
2028
+ let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || Y(), a = i.metrics.find((e) => e.id === t)?.field, o = i.metrics.filter((e) => e.id !== t), s = i.order;
2104
2029
  return a && s && s[a] && (s = { ...s }, delete s[a], Object.keys(s).length === 0 && (s = void 0)), r[n] = {
2105
2030
  ...i,
2106
2031
  metrics: o,
@@ -2108,16 +2033,16 @@ var Q = {
2108
2033
  }, { queryStates: r };
2109
2034
  }),
2110
2035
  toggleMetric: (t) => e((e) => {
2111
- let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || J(), a = i.metrics.findIndex((e) => e.field === t);
2036
+ let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || Y(), a = i.metrics.findIndex((e) => e.field === t);
2112
2037
  if (a >= 0) r[n] = {
2113
2038
  ...i,
2114
2039
  metrics: i.metrics.filter((e, t) => t !== a)
2115
2040
  };
2116
2041
  else {
2117
2042
  let e = {
2118
- id: C(),
2043
+ id: p(),
2119
2044
  field: t,
2120
- label: f(i.metrics.length)
2045
+ label: d(i.metrics.length)
2121
2046
  };
2122
2047
  r[n] = {
2123
2048
  ...i,
@@ -2127,17 +2052,17 @@ var Q = {
2127
2052
  return { queryStates: r };
2128
2053
  }),
2129
2054
  reorderMetrics: (t, n) => e((e) => {
2130
- let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || J(), o = [...a.metrics], [s] = o.splice(t, 1);
2055
+ let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || Y(), o = [...a.metrics], [s] = o.splice(t, 1);
2131
2056
  return o.splice(n, 0, s), i[r] = {
2132
2057
  ...a,
2133
2058
  metrics: o
2134
2059
  }, { queryStates: i };
2135
2060
  }),
2136
2061
  addBreakdown: (t, n, r) => e((e) => {
2137
- let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] || J();
2062
+ let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] || Y();
2138
2063
  if (n && o.breakdowns.some((e) => e.isTimeDimension)) return e;
2139
2064
  let s = {
2140
- id: C(),
2065
+ id: p(),
2141
2066
  field: t,
2142
2067
  isTimeDimension: n,
2143
2068
  granularity: n ? r || "month" : void 0
@@ -2148,7 +2073,7 @@ var Q = {
2148
2073
  }, { queryStates: a };
2149
2074
  }),
2150
2075
  removeBreakdown: (t) => e((e) => {
2151
- let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || J(), a = i.breakdowns.find((e) => e.id === t)?.field, o = i.breakdowns.filter((e) => e.id !== t), s = i.order;
2076
+ let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || Y(), a = i.breakdowns.find((e) => e.id === t)?.field, o = i.breakdowns.filter((e) => e.id !== t), s = i.order;
2152
2077
  return a && s && s[a] && (s = { ...s }, delete s[a], Object.keys(s).length === 0 && (s = void 0)), r[n] = {
2153
2078
  ...i,
2154
2079
  breakdowns: o,
@@ -2156,7 +2081,7 @@ var Q = {
2156
2081
  }, { queryStates: r };
2157
2082
  }),
2158
2083
  toggleBreakdown: (t, n, r) => e((e) => {
2159
- let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] || J(), s = o.breakdowns.findIndex((e) => e.field === t);
2084
+ let i = e.activeQueryIndex, a = [...e.queryStates], o = a[i] || Y(), s = o.breakdowns.findIndex((e) => e.field === t);
2160
2085
  if (s >= 0) a[i] = {
2161
2086
  ...o,
2162
2087
  breakdowns: o.breakdowns.filter((e, t) => t !== s)
@@ -2164,7 +2089,7 @@ var Q = {
2164
2089
  else {
2165
2090
  if (n && o.breakdowns.some((e) => e.isTimeDimension)) return e;
2166
2091
  let s = {
2167
- id: C(),
2092
+ id: p(),
2168
2093
  field: t,
2169
2094
  isTimeDimension: n,
2170
2095
  granularity: n ? r || "month" : void 0
@@ -2212,7 +2137,7 @@ var Q = {
2212
2137
  member: l.field,
2213
2138
  operator: "inDateRange",
2214
2139
  values: [],
2215
- dateRange: j("last_n_months", 3)
2140
+ dateRange: N("last_n_months", 3)
2216
2141
  };
2217
2142
  s[c] = {
2218
2143
  ...s[c],
@@ -2234,7 +2159,7 @@ var Q = {
2234
2159
  return f;
2235
2160
  }),
2236
2161
  reorderBreakdowns: (t, n) => e((e) => {
2237
- let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || J(), o = [...a.breakdowns], [s] = o.splice(t, 1);
2162
+ let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || Y(), o = [...a.breakdowns], [s] = o.splice(t, 1);
2238
2163
  return o.splice(n, 0, s), i[r] = {
2239
2164
  ...a,
2240
2165
  breakdowns: o
@@ -2248,7 +2173,7 @@ var Q = {
2248
2173
  }, { queryStates: r };
2249
2174
  }),
2250
2175
  dropFieldToFilter: (t) => e((e) => {
2251
- let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || J(), a = i.filters || [];
2176
+ let n = e.activeQueryIndex, r = [...e.queryStates], i = r[n] || Y(), a = i.filters || [];
2252
2177
  if (a.some((e) => "member" in e && e.member === t)) return e;
2253
2178
  let o = {
2254
2179
  member: t,
@@ -2272,7 +2197,7 @@ var Q = {
2272
2197
  }, { queryStates: r };
2273
2198
  }),
2274
2199
  setOrder: (t, n) => e((e) => {
2275
- let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || J(), o = { ...a.order || {} };
2200
+ let r = e.activeQueryIndex, i = [...e.queryStates], a = i[r] || Y(), o = { ...a.order || {} };
2276
2201
  return n === null ? delete o[t] : o[t] = n, i[r] = {
2277
2202
  ...a,
2278
2203
  order: Object.keys(o).length > 0 ? o : void 0
@@ -2287,7 +2212,7 @@ var Q = {
2287
2212
  }),
2288
2213
  getCurrentState: () => {
2289
2214
  let e = t();
2290
- return e.queryStates[e.activeQueryIndex] || J();
2215
+ return e.queryStates[e.activeQueryIndex] || Y();
2291
2216
  },
2292
2217
  getMergeKeys: () => {
2293
2218
  let e = t();
@@ -2300,12 +2225,12 @@ var Q = {
2300
2225
  return e.queryStates.length <= 1 ? !1 : e.queryStates.filter((e) => e.metrics.length > 0 || e.breakdowns.length > 0).length > 1;
2301
2226
  },
2302
2227
  buildCurrentQuery: () => {
2303
- let e = t(), n = e.queryStates[e.activeQueryIndex] || J();
2304
- return ve(n.metrics, n.breakdowns, n.filters, n.order, !1, n.limit);
2228
+ let e = t(), n = e.queryStates[e.activeQueryIndex] || Y();
2229
+ return Te(n.metrics, n.breakdowns, n.filters, n.order, !1, n.limit);
2305
2230
  },
2306
2231
  buildAllQueries: () => {
2307
2232
  let e = t(), n = e.queryStates[0]?.breakdowns || [];
2308
- return e.queryStates.map((t, r) => ve(t.metrics, e.mergeStrategy === "merge" && r > 0 ? n : t.breakdowns, t.filters, t.order, !1, t.limit));
2233
+ return e.queryStates.map((t, r) => Te(t.metrics, e.mergeStrategy === "merge" && r > 0 ? n : t.breakdowns, t.filters, t.order, !1, t.limit));
2309
2234
  },
2310
2235
  buildMultiQueryConfig: () => {
2311
2236
  let e = t();
@@ -2318,18 +2243,18 @@ var Q = {
2318
2243
  queryLabels: n.map((e, t) => `Q${t + 1}`)
2319
2244
  };
2320
2245
  }
2321
- }), Xt = () => ({
2246
+ }), Zt = () => ({
2322
2247
  funnelCube: null,
2323
2248
  funnelSteps: [],
2324
2249
  activeFunnelStepIndex: 0,
2325
2250
  funnelTimeDimension: null,
2326
2251
  funnelBindingKey: null,
2327
2252
  stepTimeToConvert: []
2328
- }), Zt = (e, t, n) => ({
2329
- ...Xt(),
2253
+ }), Qt = (e, t, n) => ({
2254
+ ...Zt(),
2330
2255
  addFunnelStep: () => e((e) => {
2331
2256
  let t = e.funnelSteps[e.funnelSteps.length - 1], n = {
2332
- id: C(),
2257
+ id: p(),
2333
2258
  name: `Step ${e.funnelSteps.length + 1}`,
2334
2259
  cube: e.funnelCube || "",
2335
2260
  filters: t?.filters ? JSON.parse(JSON.stringify(t.filters)) : [],
@@ -2394,7 +2319,7 @@ var Q = {
2394
2319
  let e = t();
2395
2320
  return e.analysisType !== "funnel" || !e.funnelBindingKey || !e.funnelTimeDimension || e.funnelSteps.length < 2 ? !1 : e.funnelSteps.filter((e) => e.cube && e.name).length >= 2;
2396
2321
  }
2397
- }), Qt = () => ({
2322
+ }), $t = () => ({
2398
2323
  flowCube: null,
2399
2324
  flowBindingKey: null,
2400
2325
  flowTimeDimension: null,
@@ -2406,8 +2331,8 @@ var Q = {
2406
2331
  stepsAfter: 3,
2407
2332
  eventDimension: null,
2408
2333
  joinStrategy: "auto"
2409
- }), $t = (e, t, n) => ({
2410
- ...Qt(),
2334
+ }), en = (e, t, n) => ({
2335
+ ...$t(),
2411
2336
  setFlowCube: (t) => e(() => ({
2412
2337
  flowCube: t,
2413
2338
  flowBindingKey: null,
@@ -2477,8 +2402,8 @@ var Q = {
2477
2402
  joinStrategy: e.joinStrategy
2478
2403
  } };
2479
2404
  }
2480
- }), en = () => ({ ...T }), tn = (e, t, n) => ({
2481
- ...en(),
2405
+ }), tn = () => ({ ...O }), nn = (e, t, n) => ({
2406
+ ...tn(),
2482
2407
  setRetentionCube: (t) => e(() => ({
2483
2408
  retentionCube: t,
2484
2409
  retentionTimeDimension: null,
@@ -2553,22 +2478,22 @@ var Q = {
2553
2478
  warnings: r
2554
2479
  };
2555
2480
  }
2556
- }), nn = {
2481
+ }), rn = {
2557
2482
  isOpen: !1,
2558
2483
  userPrompt: "",
2559
2484
  isGenerating: !1,
2560
2485
  error: null,
2561
2486
  hasGeneratedQuery: !1,
2562
2487
  previousState: null
2563
- }, rn = () => ({
2488
+ }, an = () => ({
2564
2489
  activeTab: "query",
2565
2490
  activeView: "chart",
2566
2491
  displayLimit: 100,
2567
2492
  showFieldModal: !1,
2568
2493
  fieldModalMode: "metrics",
2569
- aiState: nn
2570
- }), an = (e, t, n) => ({
2571
- ...rn(),
2494
+ aiState: rn
2495
+ }), on = (e, t, n) => ({
2496
+ ...an(),
2572
2497
  setActiveTab: (t) => e({ activeTab: t }),
2573
2498
  setActiveView: (t) => e((e) => ({
2574
2499
  activeView: t,
@@ -2638,7 +2563,7 @@ var Q = {
2638
2563
  if (!t) return e;
2639
2564
  let n = e.activeQueryIndex, r = [...e.queryStates];
2640
2565
  return r[n] = {
2641
- ...r[n] || J(),
2566
+ ...r[n] || Y(),
2642
2567
  metrics: t.metrics,
2643
2568
  breakdowns: t.breakdowns,
2644
2569
  filters: t.filters
@@ -2652,19 +2577,19 @@ var Q = {
2652
2577
  displayConfig: t.displayConfig
2653
2578
  }
2654
2579
  },
2655
- aiState: { ...nn }
2580
+ aiState: { ...rn }
2656
2581
  };
2657
2582
  })
2658
2583
  });
2659
2584
  //#endregion
2660
2585
  //#region src/client/stores/optionsToAnalysisConfig.ts
2661
- function on(e) {
2586
+ function sn(e) {
2662
2587
  let t = e.filters ? [...e.filters] : [], n = e.timeDimensions || [], r = [...(e.dimensions || []).map((e) => ({
2663
- id: C(),
2588
+ id: p(),
2664
2589
  field: e,
2665
2590
  isTimeDimension: !1
2666
2591
  })), ...n.map((e) => ({
2667
- id: C(),
2592
+ id: p(),
2668
2593
  field: e.dimension,
2669
2594
  granularity: e.granularity,
2670
2595
  isTimeDimension: !0,
@@ -2690,21 +2615,21 @@ function on(e) {
2690
2615
  }
2691
2616
  }
2692
2617
  return {
2693
- ...J(),
2618
+ ...Y(),
2694
2619
  metrics: (e.measures || []).map((e, t) => ({
2695
- id: C(),
2620
+ id: p(),
2696
2621
  field: e,
2697
- label: f(t)
2622
+ label: d(t)
2698
2623
  })),
2699
2624
  breakdowns: r,
2700
2625
  filters: i,
2701
2626
  order: e.order
2702
2627
  };
2703
2628
  }
2704
- function sn(e) {
2629
+ function cn(e) {
2705
2630
  return "queries" in e && Array.isArray(e.queries);
2706
2631
  }
2707
- function cn(e, t) {
2632
+ function ln(e, t) {
2708
2633
  let n = e.getDefaultChartConfig();
2709
2634
  return {
2710
2635
  chartType: t?.chartType || n.chartType,
@@ -2712,22 +2637,22 @@ function cn(e, t) {
2712
2637
  displayConfig: t?.displayConfig || n.displayConfig
2713
2638
  };
2714
2639
  }
2715
- function ln(e) {
2640
+ function un(e) {
2716
2641
  return e.initialActiveView || "chart";
2717
2642
  }
2718
- function un(e) {
2719
- let t = cn(g, e.initialChartConfig), n = e.initialFunnelState ?? {};
2720
- return g.save({
2643
+ function dn(e) {
2644
+ let t = ln(_, e.initialChartConfig), n = e.initialFunnelState ?? {};
2645
+ return _.save({
2721
2646
  funnelCube: n.funnelCube ?? null,
2722
2647
  funnelSteps: n.funnelSteps || [],
2723
2648
  activeFunnelStepIndex: 0,
2724
2649
  funnelTimeDimension: n.funnelTimeDimension ?? null,
2725
2650
  funnelBindingKey: n.funnelBindingKey ?? null
2726
- }, { funnel: t }, ln(e));
2651
+ }, { funnel: t }, un(e));
2727
2652
  }
2728
- function dn(e) {
2729
- let t = cn(x, e.initialChartConfig), n = e.initialFlowState ?? {};
2730
- return x.save({
2653
+ function fn(e) {
2654
+ let t = ln(w, e.initialChartConfig), n = e.initialFlowState ?? {};
2655
+ return w.save({
2731
2656
  flowCube: n.flowCube ?? null,
2732
2657
  flowBindingKey: n.flowBindingKey ?? null,
2733
2658
  flowTimeDimension: n.flowTimeDimension ?? null,
@@ -2739,10 +2664,10 @@ function dn(e) {
2739
2664
  stepsAfter: n.stepsAfter ?? 3,
2740
2665
  eventDimension: n.eventDimension ?? null,
2741
2666
  joinStrategy: n.joinStrategy ?? "auto"
2742
- }, { flow: t }, ln(e));
2667
+ }, { flow: t }, un(e));
2743
2668
  }
2744
- function fn(e) {
2745
- let t = cn(b, e.initialChartConfig), n = e.initialRetentionState ?? {}, r = E(D);
2669
+ function pn(e) {
2670
+ let t = ln(b, e.initialChartConfig), n = e.initialRetentionState ?? {}, r = k(ee);
2746
2671
  return b.save({
2747
2672
  retentionCube: n.retentionCube ?? null,
2748
2673
  retentionBindingKey: n.retentionBindingKey ?? null,
@@ -2754,51 +2679,51 @@ function fn(e) {
2754
2679
  retentionViewGranularity: n.retentionViewGranularity ?? "week",
2755
2680
  retentionPeriods: n.retentionPeriods ?? 12,
2756
2681
  retentionType: n.retentionType ?? "classic"
2757
- }, { retention: t }, ln(e));
2682
+ }, { retention: t }, un(e));
2758
2683
  }
2759
- function pn(e, t) {
2684
+ function mn(e, t) {
2760
2685
  let n, r = "concat";
2761
- sn(t) ? (n = t.queries.map(on), t.mergeStrategy && (r = t.mergeStrategy)) : n = [on(t)];
2762
- let i = cn(X, e.initialChartConfig);
2686
+ cn(t) ? (n = t.queries.map(sn), t.mergeStrategy && (r = t.mergeStrategy)) : n = [sn(t)];
2687
+ let i = ln(X, e.initialChartConfig);
2763
2688
  return X.save({
2764
2689
  queryStates: n,
2765
2690
  activeQueryIndex: 0,
2766
2691
  mergeStrategy: r
2767
- }, { query: i }, ln(e));
2692
+ }, { query: i }, un(e));
2768
2693
  }
2769
- function mn(e) {
2770
- let t = cn(X, e.initialChartConfig);
2694
+ function hn(e) {
2695
+ let t = ln(X, e.initialChartConfig);
2771
2696
  return X.save({
2772
- queryStates: [J()],
2697
+ queryStates: [Y()],
2773
2698
  activeQueryIndex: 0,
2774
2699
  mergeStrategy: "concat"
2775
- }, { query: t }, ln(e));
2700
+ }, { query: t }, un(e));
2776
2701
  }
2777
- function hn(e) {
2702
+ function gn(e) {
2778
2703
  return X.save({
2779
- queryStates: [J()],
2704
+ queryStates: [Y()],
2780
2705
  activeQueryIndex: 0,
2781
2706
  mergeStrategy: "concat"
2782
2707
  }, { query: X.getDefaultChartConfig() }, e.initialActiveView);
2783
2708
  }
2784
- function gn(e) {
2785
- return e.initialAnalysisType === "funnel" && e.initialFunnelState ? un(e) : e.initialAnalysisType === "flow" && e.initialFlowState ? dn(e) : e.initialAnalysisType === "retention" && e.initialRetentionState ? fn(e) : e.initialQuery ? pn(e, e.initialQuery) : e.initialChartConfig ? mn(e) : e.initialActiveView ? hn(e) : null;
2709
+ function _n(e) {
2710
+ return e.initialAnalysisType === "funnel" && e.initialFunnelState ? dn(e) : e.initialAnalysisType === "flow" && e.initialFlowState ? fn(e) : e.initialAnalysisType === "retention" && e.initialRetentionState ? pn(e) : e.initialQuery ? mn(e, e.initialQuery) : e.initialChartConfig ? hn(e) : e.initialActiveView ? gn(e) : null;
2786
2711
  }
2787
2712
  //#endregion
2788
2713
  //#region src/client/stores/analysisBuilderStore.tsx
2789
- function _n(e, t) {
2714
+ function vn(e, t) {
2790
2715
  return {
2791
2716
  reset: () => {
2792
2717
  e({
2793
- ...Kt(),
2794
- ...Jt(),
2795
- ...Xt(),
2796
- ...Qt(),
2797
- ...en(),
2718
+ ...qt(),
2719
+ ...Yt(),
2720
+ ...Zt(),
2721
+ ...$t(),
2722
+ ...tn(),
2798
2723
  charts: {
2799
2724
  query: X.getDefaultChartConfig(),
2800
- funnel: g.getDefaultChartConfig(),
2801
- flow: x.getDefaultChartConfig(),
2725
+ funnel: _.getDefaultChartConfig(),
2726
+ flow: w.getDefaultChartConfig(),
2802
2727
  retention: b.getDefaultChartConfig()
2803
2728
  },
2804
2729
  activeViews: {
@@ -2812,28 +2737,28 @@ function _n(e, t) {
2812
2737
  clearCurrentMode: () => e((e) => {
2813
2738
  switch (e.analysisType) {
2814
2739
  case "funnel": return {
2815
- ...Xt(),
2740
+ ...Zt(),
2816
2741
  charts: {
2817
2742
  ...e.charts,
2818
- funnel: g.getDefaultChartConfig()
2743
+ funnel: _.getDefaultChartConfig()
2819
2744
  }
2820
2745
  };
2821
2746
  case "flow": return {
2822
- ...Qt(),
2747
+ ...$t(),
2823
2748
  charts: {
2824
2749
  ...e.charts,
2825
- flow: x.getDefaultChartConfig()
2750
+ flow: w.getDefaultChartConfig()
2826
2751
  }
2827
2752
  };
2828
2753
  case "retention": return {
2829
- ...en(),
2754
+ ...tn(),
2830
2755
  charts: {
2831
2756
  ...e.charts,
2832
2757
  retention: b.getDefaultChartConfig()
2833
2758
  }
2834
2759
  };
2835
2760
  default: return {
2836
- ...Jt(),
2761
+ ...Yt(),
2837
2762
  userManuallySelectedChart: !1,
2838
2763
  charts: {
2839
2764
  ...e.charts,
@@ -2844,7 +2769,7 @@ function _n(e, t) {
2844
2769
  }),
2845
2770
  clearQuery: () => e((e) => {
2846
2771
  let t = [...e.queryStates];
2847
- return t[e.activeQueryIndex] = J(), {
2772
+ return t[e.activeQueryIndex] = Y(), {
2848
2773
  queryStates: t,
2849
2774
  userManuallySelectedChart: !1,
2850
2775
  charts: {
@@ -2859,15 +2784,15 @@ function _n(e, t) {
2859
2784
  }
2860
2785
  };
2861
2786
  }
2862
- function vn(n = {}) {
2863
- let r = gn(n), o = (e, t, n) => ({
2864
- ...qt(e, t, n),
2865
- ...Yt(e, t, n),
2866
- ...Zt(e, t, n),
2867
- ...$t(e, t, n),
2868
- ...tn(e, t, n),
2869
- ...an(e, t, n),
2870
- ..._n(e, t)
2787
+ function yn(n = {}) {
2788
+ let r = _n(n), o = (e, t, n) => ({
2789
+ ...Jt(e, t, n),
2790
+ ...Xt(e, t, n),
2791
+ ...Qt(e, t, n),
2792
+ ...en(e, t, n),
2793
+ ...nn(e, t, n),
2794
+ ...on(e, t, n),
2795
+ ...vn(e, t)
2871
2796
  });
2872
2797
  if (n.disableLocalStorage) {
2873
2798
  let t = a()(i(e(o), { name: "AnalysisBuilderStore (no-persist)" }));
@@ -2876,10 +2801,10 @@ function vn(n = {}) {
2876
2801
  return a()(i(e(t(o, {
2877
2802
  name: n.storageKey || "drizzle-cube-analysis-builder-v3",
2878
2803
  partialize: (e) => e.saveWorkspace(),
2879
- merge: (e, t) => e && h(e) ? {
2804
+ merge: (e, t) => e && g(e) ? {
2880
2805
  ...t,
2881
2806
  _persistedWorkspace: e
2882
- } : e && y(e) ? {
2807
+ } : e && D(e) ? {
2883
2808
  ...t,
2884
2809
  _persistedConfig: e
2885
2810
  } : r ? {
@@ -2902,10 +2827,10 @@ function vn(n = {}) {
2902
2827
  }
2903
2828
  })), { name: "AnalysisBuilderStore" }));
2904
2829
  }
2905
- var yn = ue(null);
2906
- function bn({ children: e, initialQuery: t, initialChartConfig: n, disableLocalStorage: r, storageKey: i, initialAnalysisType: a, initialFunnelState: o, initialFlowState: s, initialRetentionState: c, initialActiveView: l }) {
2907
- let u = V(null);
2908
- return u.current ||= vn({
2830
+ var bn = ge(null);
2831
+ function xn({ children: e, initialQuery: t, initialChartConfig: n, disableLocalStorage: r, storageKey: i, initialAnalysisType: a, initialFunnelState: o, initialFlowState: s, initialRetentionState: c, initialActiveView: l }) {
2832
+ let u = W(null);
2833
+ return u.current ||= yn({
2909
2834
  initialQuery: t,
2910
2835
  initialChartConfig: n,
2911
2836
  disableLocalStorage: r,
@@ -2915,22 +2840,22 @@ function bn({ children: e, initialQuery: t, initialChartConfig: n, disableLocalS
2915
2840
  initialFlowState: s,
2916
2841
  initialRetentionState: c,
2917
2842
  initialActiveView: l
2918
- }), /* @__PURE__ */ W(yn.Provider, {
2843
+ }), /* @__PURE__ */ q(bn.Provider, {
2919
2844
  value: u.current,
2920
2845
  children: e
2921
2846
  });
2922
2847
  }
2923
2848
  function $(e) {
2924
- let t = fe(yn);
2849
+ let t = ve(bn);
2925
2850
  if (!t) throw Error("useAnalysisBuilderStore must be used within AnalysisBuilderStoreProvider");
2926
2851
  return r(t, e);
2927
2852
  }
2928
- function xn() {
2929
- let e = fe(yn);
2853
+ function Sn() {
2854
+ let e = ve(bn);
2930
2855
  if (!e) throw Error("useAnalysisBuilderStoreApi must be used within AnalysisBuilderStoreProvider");
2931
2856
  return e;
2932
2857
  }
2933
- var Sn = (e) => e.queryStates[e.activeQueryIndex] || J(), Cn = (e) => Sn(e).metrics, wn = (e) => Sn(e).breakdowns, Tn = (e) => Sn(e).filters, En = (e) => {
2858
+ var Cn = (e) => e.queryStates[e.activeQueryIndex] || Y(), wn = (e) => Cn(e).metrics, Tn = (e) => Cn(e).breakdowns, En = (e) => Cn(e).filters, Dn = (e) => {
2934
2859
  let t = e.charts[e.analysisType];
2935
2860
  return t ? {
2936
2861
  chartType: t.chartType,
@@ -2945,18 +2870,18 @@ var Sn = (e) => e.queryStates[e.activeQueryIndex] || J(), Cn = (e) => Sn(e).metr
2945
2870
  showTooltip: !0
2946
2871
  }
2947
2872
  };
2948
- }, Dn = (e) => ({
2873
+ }, On = (e) => ({
2949
2874
  activeTab: e.activeTab,
2950
2875
  activeView: e.activeView,
2951
2876
  displayLimit: e.displayLimit,
2952
2877
  showFieldModal: e.showFieldModal,
2953
2878
  fieldModalMode: e.fieldModalMode
2954
- }), On = (e) => ({
2879
+ }), kn = (e) => ({
2955
2880
  queryStates: e.queryStates,
2956
2881
  activeQueryIndex: e.activeQueryIndex,
2957
2882
  mergeStrategy: e.mergeStrategy,
2958
2883
  isMultiQueryMode: e.analysisType === "query" && e.queryStates.length > 1
2959
- }), kn = (e) => ({
2884
+ }), An = (e) => ({
2960
2885
  funnelCube: e.funnelCube,
2961
2886
  funnelSteps: e.funnelSteps,
2962
2887
  activeFunnelStepIndex: e.activeFunnelStepIndex,
@@ -2967,16 +2892,16 @@ var Sn = (e) => e.queryStates[e.activeQueryIndex] || J(), Cn = (e) => Sn(e).metr
2967
2892
  });
2968
2893
  //#endregion
2969
2894
  //#region src/client/utils/multiQueryValidation.ts
2970
- function An(e) {
2895
+ function jn(e) {
2971
2896
  return e.timeDimensions || [];
2972
2897
  }
2973
- function jn(e) {
2898
+ function Mn(e) {
2974
2899
  let t = [];
2975
2900
  if (e.length < 2) return t;
2976
- let n = An(e[0]);
2901
+ let n = jn(e[0]);
2977
2902
  if (n.length === 0) return t;
2978
2903
  for (let r = 1; r < e.length; r++) {
2979
- let i = An(e[r]);
2904
+ let i = jn(e[r]);
2980
2905
  if (i.length === 0 && n.length > 0) {
2981
2906
  t.push({
2982
2907
  type: "missing_time_dimension",
@@ -3002,7 +2927,7 @@ function jn(e) {
3002
2927
  }
3003
2928
  return t;
3004
2929
  }
3005
- function Mn(e, t) {
2930
+ function Nn(e, t) {
3006
2931
  let n = [];
3007
2932
  if (e.length < 2 || t.length === 0) return n;
3008
2933
  for (let r = 0; r < e.length; r++) {
@@ -3016,7 +2941,7 @@ function Mn(e, t) {
3016
2941
  }
3017
2942
  return n;
3018
2943
  }
3019
- function Nn(e) {
2944
+ function Pn(e) {
3020
2945
  let t = [];
3021
2946
  if (e.length < 2) return t;
3022
2947
  let n = /* @__PURE__ */ new Map();
@@ -3035,7 +2960,7 @@ function Nn(e) {
3035
2960
  affectedMeasures: r
3036
2961
  }), t;
3037
2962
  }
3038
- function Pn(e) {
2963
+ function Fn(e) {
3039
2964
  let t = [];
3040
2965
  if (e.length < 2) return t;
3041
2966
  let n = e.map((e) => e.timeDimensions?.[0]?.dateRange);
@@ -3045,46 +2970,46 @@ function Pn(e) {
3045
2970
  message: "Queries have different date ranges - some data points may be missing in merged results"
3046
2971
  }), t;
3047
2972
  }
3048
- function Fn(e, t, n = []) {
2973
+ function In(e, t, n = []) {
3049
2974
  let r = [], i = [];
3050
2975
  return e.length < 2 ? {
3051
2976
  isValid: !0,
3052
2977
  errors: r,
3053
2978
  warnings: i
3054
- } : (i.push(...Nn(e)), i.push(...Pn(e)), t === "merge" && (r.push(...jn(e)), n.length > 0 && r.push(...Mn(e, n))), {
2979
+ } : (i.push(...Pn(e)), i.push(...Fn(e)), t === "merge" && (r.push(...Mn(e)), n.length > 0 && r.push(...Nn(e, n))), {
3055
2980
  isValid: r.length === 0,
3056
2981
  errors: r,
3057
2982
  warnings: i
3058
2983
  });
3059
2984
  }
3060
- function In(e) {
2985
+ function Ln(e) {
3061
2986
  return (e.measures?.length || 0) + (e.dimensions?.length || 0) + (e.timeDimensions?.length || 0);
3062
2987
  }
3063
- function Ln(e) {
3064
- return e.filter((e) => In(e) > 0).length >= 2;
2988
+ function Rn(e) {
2989
+ return e.filter((e) => Ln(e) > 0).length >= 2;
3065
2990
  }
3066
- function Rn(e, t) {
2991
+ function zn(e, t) {
3067
2992
  return `${e} ${t}${e === 1 ? "" : "s"}`;
3068
2993
  }
3069
- function zn(e) {
2994
+ function Bn(e) {
3070
2995
  if (e.isValid && e.warnings.length === 0) return "Configuration is valid";
3071
2996
  let t = [];
3072
- return e.errors.length > 0 && t.push(Rn(e.errors.length, "error")), e.warnings.length > 0 && t.push(Rn(e.warnings.length, "warning")), t.join(", ");
2997
+ return e.errors.length > 0 && t.push(zn(e.errors.length, "error")), e.warnings.length > 0 && t.push(zn(e.warnings.length, "warning")), t.join(", ");
3073
2998
  }
3074
2999
  //#endregion
3075
3000
  //#region src/client/hooks/useAnalysisState.ts
3076
- function Bn(e = {}) {
3077
- let { externalColorPalette: t } = e, r = xn(), i = $((e) => e.queryStates), a = $((e) => e.activeQueryIndex), o = $((e) => e.mergeStrategy), s = $((e) => e.setActiveQueryIndex), c = $((e) => e.setMergeStrategy), l = $((e) => e.addQuery), u = $((e) => e.removeQuery), d = $((e) => e.getCurrentState), f = $((e) => e.getMergeKeys), m = $((e) => e.isMultiQueryMode), h = d(), g = m(), _ = f(), v = B(() => {
3001
+ function Vn(e = {}) {
3002
+ let { externalColorPalette: t } = e, r = Sn(), i = $((e) => e.queryStates), a = $((e) => e.activeQueryIndex), o = $((e) => e.mergeStrategy), s = $((e) => e.setActiveQueryIndex), c = $((e) => e.setMergeStrategy), l = $((e) => e.addQuery), u = $((e) => e.removeQuery), d = $((e) => e.getCurrentState), p = $((e) => e.getMergeKeys), m = $((e) => e.isMultiQueryMode), h = d(), g = m(), _ = p(), v = U(() => {
3078
3003
  let e = i[a] || h;
3079
- return ve(e.metrics, e.breakdowns, e.filters, e.order, !1, e.limit);
3004
+ return Te(e.metrics, e.breakdowns, e.filters, e.order, !1, e.limit);
3080
3005
  }, [
3081
3006
  i,
3082
3007
  a,
3083
3008
  h
3084
- ]), y = B(() => {
3009
+ ]), y = U(() => {
3085
3010
  let e = i[0]?.breakdowns || [];
3086
- return i.map((t, n) => ve(t.metrics, o === "merge" && n > 0 ? e : t.breakdowns, t.filters, t.order, !1, t.limit));
3087
- }, [i, o]), b = B(() => {
3011
+ return i.map((t, n) => Te(t.metrics, o === "merge" && n > 0 ? e : t.breakdowns, t.filters, t.order, !1, t.limit));
3012
+ }, [i, o]), b = U(() => {
3088
3013
  if (i.length <= 1) return null;
3089
3014
  let e = y.filter((e) => e.measures && e.measures.length > 0 || e.dimensions && e.dimensions.length > 0 || e.timeDimensions && e.timeDimensions.length > 0);
3090
3015
  return e.length < 2 ? null : {
@@ -3098,12 +3023,12 @@ function Bn(e = {}) {
3098
3023
  i.length,
3099
3024
  o,
3100
3025
  _
3101
- ]), x = B(() => g ? Fn(y, o, _ || []) : null, [
3026
+ ]), x = U(() => g ? In(y, o, _ || []) : null, [
3102
3027
  g,
3103
3028
  y,
3104
3029
  o,
3105
3030
  _
3106
- ]), S = B(() => v.measures && v.measures.length > 0 || v.dimensions && v.dimensions.length > 0 || v.timeDimensions && v.timeDimensions.length > 0, [v]), C = B(() => {
3031
+ ]), S = U(() => v.measures && v.measures.length > 0 || v.dimensions && v.dimensions.length > 0 || v.timeDimensions && v.timeDimensions.length > 0, [v]), C = U(() => {
3107
3032
  if (!g) return h.metrics;
3108
3033
  let e = /* @__PURE__ */ new Set(), t = [];
3109
3034
  for (let n = 0; n < i.length; n++) {
@@ -3121,7 +3046,7 @@ function Bn(e = {}) {
3121
3046
  g,
3122
3047
  i,
3123
3048
  h.metrics
3124
- ]), w = B(() => {
3049
+ ]), w = U(() => {
3125
3050
  if (!g) return h.breakdowns;
3126
3051
  let e = /* @__PURE__ */ new Set(), t = [];
3127
3052
  for (let n of i) for (let r of n.breakdowns) e.has(r.field) || (e.add(r.field), t.push(r));
@@ -3130,98 +3055,98 @@ function Bn(e = {}) {
3130
3055
  g,
3131
3056
  i,
3132
3057
  h.breakdowns
3133
- ]), T = B(() => o === "merge" && a > 0 ? i[0]?.breakdowns || [] : h.breakdowns, [
3058
+ ]), T = U(() => o === "merge" && a > 0 ? i[0]?.breakdowns || [] : h.breakdowns, [
3134
3059
  o,
3135
3060
  a,
3136
3061
  i,
3137
3062
  h.breakdowns
3138
- ]), E = $((e) => e.analysisType), D = $((e) => e.funnelBindingKey), O = $((e) => e.funnelCube), k = $((e) => e.funnelSteps), A = $((e) => e.activeFunnelStepIndex), ee = $((e) => e.funnelTimeDimension), te = B(() => E !== "funnel" || !D?.dimension || !ee || !k || k.length < 2 ? !1 : k.every((e) => e.filters.length > 0), [
3063
+ ]), E = $((e) => e.analysisType), D = $((e) => e.funnelBindingKey), O = $((e) => e.funnelCube), k = $((e) => e.funnelSteps), ee = $((e) => e.activeFunnelStepIndex), A = $((e) => e.funnelTimeDimension), te = U(() => E !== "funnel" || !D?.dimension || !A || !k || k.length < 2 ? !1 : k.every((e) => e.filters.length > 0), [
3139
3064
  E,
3140
3065
  D,
3141
- ee,
3066
+ A,
3142
3067
  k
3143
- ]), ne = $((e) => e.charts.funnel?.chartType) || "funnel", j = $((e) => e.charts.funnel?.chartConfig), re = B(() => j || {}, [j]), ie = $((e) => e.charts.funnel?.displayConfig), ae = B(() => ie || {
3068
+ ]), ne = $((e) => e.charts.funnel?.chartType) || "funnel", j = $((e) => e.charts.funnel?.chartConfig), re = U(() => j || {}, [j]), M = $((e) => e.charts.funnel?.displayConfig), ie = U(() => M || {
3144
3069
  showLegend: !0,
3145
3070
  showGrid: !0,
3146
3071
  showTooltip: !0
3147
- }, [ie]), M = $((e) => e.flowCube), N = $((e) => e.flowBindingKey), oe = $((e) => e.flowTimeDimension), se = $((e) => e.eventDimension), P = $((e) => e.startingStep), ce = $((e) => e.stepsBefore), F = $((e) => e.stepsAfter), I = $((e) => e.joinStrategy), le = $((e) => e.charts.flow?.displayConfig), L = B(() => le || {
3072
+ }, [M]), ae = $((e) => e.flowCube), oe = $((e) => e.flowBindingKey), N = $((e) => e.flowTimeDimension), P = $((e) => e.eventDimension), se = $((e) => e.startingStep), F = $((e) => e.stepsBefore), I = $((e) => e.stepsAfter), L = $((e) => e.joinStrategy), ce = $((e) => e.charts.flow?.displayConfig), le = U(() => ce || {
3148
3073
  showLegend: !0,
3149
3074
  showGrid: !0,
3150
3075
  showTooltip: !0
3151
- }, [le]), ue = $((e) => e.charts.flow?.chartType) || "sankey", de = $((e) => e.buildFunnelQueryFromSteps), fe = B(() => E === "funnel" ? de() : null, [
3076
+ }, [ce]), ue = $((e) => e.charts.flow?.chartType) || "sankey", R = $((e) => e.buildFunnelQueryFromSteps), de = U(() => E === "funnel" ? R() : null, [
3152
3077
  E,
3153
- de,
3078
+ R,
3154
3079
  k
3155
- ]), z = $((e) => e.buildFlowQuery), V = B(() => E === "flow" ? z() : null, [
3080
+ ]), z = $((e) => e.buildFlowQuery), fe = U(() => E === "flow" ? z() : null, [
3156
3081
  E,
3157
3082
  z,
3158
- M,
3159
- N,
3083
+ ae,
3160
3084
  oe,
3161
- se,
3085
+ N,
3162
3086
  P,
3163
- ce,
3087
+ se,
3164
3088
  F,
3089
+ I,
3165
3090
  ue,
3166
- I
3167
- ]), U = $((e) => e.retentionCube), W = $((e) => e.retentionBindingKey), G = $((e) => e.retentionTimeDimension), K = $((e) => e.retentionDateRange), pe = $((e) => e.retentionCohortFilters), q = $((e) => e.retentionActivityFilters), me = $((e) => e.retentionBreakdowns), he = $((e) => e.retentionViewGranularity), ge = $((e) => e.retentionPeriods), _e = $((e) => e.retentionType), J = $((e) => e.buildRetentionQuery), ye = $((e) => e.getRetentionValidation), be = $((e) => e.charts.retention?.displayConfig), xe = B(() => E === "retention" ? J() : null, [
3091
+ L
3092
+ ]), pe = $((e) => e.retentionCube), me = $((e) => e.retentionBindingKey), he = $((e) => e.retentionTimeDimension), B = $((e) => e.retentionDateRange), ge = $((e) => e.retentionCohortFilters), _e = $((e) => e.retentionActivityFilters), ve = $((e) => e.retentionBreakdowns), H = $((e) => e.retentionViewGranularity), W = $((e) => e.retentionPeriods), K = $((e) => e.retentionType), q = $((e) => e.buildRetentionQuery), J = $((e) => e.getRetentionValidation), ye = $((e) => e.charts.retention?.displayConfig), be = U(() => E === "retention" ? q() : null, [
3168
3093
  E,
3169
- J,
3170
- U,
3171
- W,
3172
- G,
3173
- K,
3094
+ q,
3095
+ pe,
3174
3096
  me,
3175
3097
  he,
3098
+ B,
3099
+ ve,
3100
+ H,
3101
+ W,
3102
+ K,
3176
3103
  ge,
3177
- _e,
3178
- pe,
3179
- q
3180
- ]), Se = B(() => E === "retention" ? ye() : null, [
3104
+ _e
3105
+ ]), xe = U(() => E === "retention" ? J() : null, [
3181
3106
  E,
3182
- ye,
3183
- U,
3184
- W,
3185
- G,
3186
- K
3187
- ]), Ce = B(() => E === "retention" ? xe !== null : E === "flow" ? V !== null : E === "funnel" ? fe !== null : S ?? !1, [
3107
+ J,
3108
+ pe,
3109
+ me,
3110
+ he,
3111
+ B
3112
+ ]), Se = U(() => E === "retention" ? be !== null : E === "flow" ? fe !== null : E === "funnel" ? de !== null : S ?? !1, [
3188
3113
  E,
3189
- xe,
3190
- V,
3114
+ be,
3191
3115
  fe,
3116
+ de,
3192
3117
  S
3193
- ]), { chartType: we, chartConfig: Te, displayConfig: Ee } = $(n(En)), De = $((e) => e.userManuallySelectedChart), Oe = $((e) => e.localPaletteName), ke = $((e) => e.setChartTypeManual), Ae = $((e) => e.setChartConfig), je = $((e) => e.setDisplayConfig), Me = $((e) => e.setFunnelChartType), Ne = $((e) => e.setFunnelChartConfig), Pe = $((e) => e.setFunnelDisplayConfig), Fe = $((e) => e.setLocalPaletteName), Ie = $((e) => e.setUserManuallySelectedChart), Le = R((e) => {
3194
- if (E === "funnel") Me(e);
3118
+ ]), { chartType: Ce, chartConfig: we, displayConfig: Y } = $(n(Dn)), Ee = $((e) => e.userManuallySelectedChart), De = $((e) => e.localPaletteName), Oe = $((e) => e.setChartTypeManual), ke = $((e) => e.setChartConfig), Ae = $((e) => e.setDisplayConfig), je = $((e) => e.setFunnelChartType), Me = $((e) => e.setFunnelChartConfig), Ne = $((e) => e.setFunnelDisplayConfig), Pe = $((e) => e.setLocalPaletteName), Fe = $((e) => e.setUserManuallySelectedChart), Ie = V((e) => {
3119
+ if (E === "funnel") je(e);
3195
3120
  else {
3196
- ke(e);
3197
- let { chartConfig: t } = Ot(C, w, e);
3198
- Ae(t);
3121
+ Oe(e);
3122
+ let { chartConfig: t } = kt(C, w, e);
3123
+ ke(t);
3199
3124
  }
3200
3125
  }, [
3201
3126
  E,
3202
3127
  C,
3203
3128
  w,
3129
+ je,
3130
+ Oe,
3131
+ ke
3132
+ ]), Le = V((e) => {
3133
+ E === "funnel" ? Me(e) : ke(e);
3134
+ }, [
3135
+ E,
3204
3136
  Me,
3205
- ke,
3206
- Ae
3207
- ]), Re = R((e) => {
3137
+ ke
3138
+ ]), Re = V((e) => {
3208
3139
  E === "funnel" ? Ne(e) : Ae(e);
3209
3140
  }, [
3210
3141
  E,
3211
3142
  Ne,
3212
3143
  Ae
3213
- ]), ze = R((e) => {
3214
- E === "funnel" ? Pe(e) : je(e);
3215
- }, [
3216
- E,
3217
- Pe,
3218
- je
3219
- ]), Be = B(() => Et(C, w), [C, w]), Ve = B(() => t ? Array.isArray(t) && typeof t[0] == "string" ? {
3144
+ ]), ze = U(() => Dt(C, w), [C, w]), Be = U(() => t ? Array.isArray(t) && typeof t[0] == "string" ? {
3220
3145
  name: "custom",
3221
3146
  label: "Custom",
3222
3147
  colors: t,
3223
3148
  gradient: t
3224
- } : t : p(Oe), [t, Oe]), He = R((e) => {
3149
+ } : t : f(De), [t, De]), Ve = V((e) => {
3225
3150
  r.setState((t) => ({ charts: {
3226
3151
  ...t.charts,
3227
3152
  flow: {
@@ -3233,7 +3158,7 @@ function Bn(e = {}) {
3233
3158
  displayConfig: e
3234
3159
  }
3235
3160
  } }));
3236
- }, [r]), Ue = R((e) => {
3161
+ }, [r]), He = V((e) => {
3237
3162
  r.setState((t) => ({ charts: {
3238
3163
  ...t.charts,
3239
3164
  retention: {
@@ -3245,31 +3170,31 @@ function Bn(e = {}) {
3245
3170
  displayConfig: e
3246
3171
  }
3247
3172
  } }));
3248
- }, [r]), We = $((e) => e.activeTab), Ge = $((e) => e.activeView), Ke = $((e) => e.displayLimit), qe = $((e) => e.showFieldModal), Je = $((e) => e.fieldModalMode), Ye = $((e) => e.setActiveTab), Y = $((e) => e.setActiveView), Xe = $((e) => e.setDisplayLimit), Ze = $((e) => e.closeFieldModal), [Qe, $e] = H(0), et = $((e) => e.openMetricsModal), tt = $((e) => e.addMetric), nt = $((e) => e.removeMetric), rt = $((e) => e.toggleMetric), it = $((e) => e.reorderMetrics), at = $((e) => e.openBreakdownsModal), ot = $((e) => e.addBreakdown), st = $((e) => e.removeBreakdown), ct = $((e) => e.toggleBreakdown), lt = $((e) => e.setBreakdownGranularity), ut = $((e) => e.toggleBreakdownComparison), dt = $((e) => e.reorderBreakdowns), ft = $((e) => e.setFilters), pt = $((e) => e.dropFieldToFilter), mt = $((e) => e.setOrder), ht = $((e) => e.setLimit), gt = $((e) => e.clearQuery), _t = $((e) => e.clearCurrentMode), vt = $((e) => e.setFunnelBindingKey), yt = $((e) => e.setAnalysisType), bt = $((e) => e.setFunnelCube), xt = $((e) => e.addFunnelStep), St = $((e) => e.removeFunnelStep), Ct = $((e) => e.updateFunnelStep), wt = $((e) => e.setActiveFunnelStepIndex), Tt = $((e) => e.reorderFunnelSteps), Dt = $((e) => e.setFunnelTimeDimension), kt = $((e) => e.setFlowCube), At = $((e) => e.setFlowBindingKey), jt = $((e) => e.setFlowTimeDimension), Mt = $((e) => e.setEventDimension), Nt = $((e) => e.setStartingStepName), Pt = $((e) => e.setStartingStepFilters), Ft = $((e) => e.setStepsBefore), It = $((e) => e.setStepsAfter), Lt = $((e) => e.setJoinStrategy), Rt = $((e) => e.setRetentionCube), zt = $((e) => e.setRetentionBindingKey), Bt = $((e) => e.setRetentionTimeDimension), Vt = $((e) => e.setRetentionDateRange), Ht = $((e) => e.setRetentionCohortFilters), Ut = $((e) => e.setRetentionActivityFilters), X = $((e) => e.setRetentionBreakdowns), Z = $((e) => e.addRetentionBreakdown), Wt = $((e) => e.removeRetentionBreakdown), Gt = $((e) => e.setRetentionViewGranularity), Q = $((e) => e.setRetentionPeriods), Kt = $((e) => e.setRetentionType), qt = $((e) => e.getValidation), Jt = B(() => qt(), [
3173
+ }, [r]), Ue = $((e) => e.activeTab), We = $((e) => e.activeView), Ge = $((e) => e.displayLimit), Ke = $((e) => e.showFieldModal), qe = $((e) => e.fieldModalMode), Je = $((e) => e.setActiveTab), Ye = $((e) => e.setActiveView), Xe = $((e) => e.setDisplayLimit), Ze = $((e) => e.closeFieldModal), [Qe, $e] = G(0), et = $((e) => e.openMetricsModal), tt = $((e) => e.addMetric), nt = $((e) => e.removeMetric), rt = $((e) => e.toggleMetric), it = $((e) => e.reorderMetrics), at = $((e) => e.openBreakdownsModal), ot = $((e) => e.addBreakdown), st = $((e) => e.removeBreakdown), ct = $((e) => e.toggleBreakdown), lt = $((e) => e.setBreakdownGranularity), ut = $((e) => e.toggleBreakdownComparison), dt = $((e) => e.reorderBreakdowns), ft = $((e) => e.setFilters), pt = $((e) => e.dropFieldToFilter), mt = $((e) => e.setOrder), ht = $((e) => e.setLimit), gt = $((e) => e.clearQuery), _t = $((e) => e.clearCurrentMode), vt = $((e) => e.setFunnelBindingKey), yt = $((e) => e.setAnalysisType), bt = $((e) => e.setFunnelCube), xt = $((e) => e.addFunnelStep), St = $((e) => e.removeFunnelStep), Ct = $((e) => e.updateFunnelStep), wt = $((e) => e.setActiveFunnelStepIndex), Tt = $((e) => e.reorderFunnelSteps), Et = $((e) => e.setFunnelTimeDimension), Ot = $((e) => e.setFlowCube), At = $((e) => e.setFlowBindingKey), jt = $((e) => e.setFlowTimeDimension), Mt = $((e) => e.setEventDimension), Nt = $((e) => e.setStartingStepName), Pt = $((e) => e.setStartingStepFilters), Ft = $((e) => e.setStepsBefore), It = $((e) => e.setStepsAfter), Lt = $((e) => e.setJoinStrategy), Rt = $((e) => e.setRetentionCube), zt = $((e) => e.setRetentionBindingKey), Bt = $((e) => e.setRetentionTimeDimension), Vt = $((e) => e.setRetentionDateRange), Ht = $((e) => e.setRetentionCohortFilters), Ut = $((e) => e.setRetentionActivityFilters), Wt = $((e) => e.setRetentionBreakdowns), X = $((e) => e.addRetentionBreakdown), Z = $((e) => e.removeRetentionBreakdown), Gt = $((e) => e.setRetentionViewGranularity), Kt = $((e) => e.setRetentionPeriods), Q = $((e) => e.setRetentionType), qt = $((e) => e.getValidation), Jt = U(() => qt(), [
3249
3174
  qt,
3250
3175
  i,
3251
3176
  E,
3252
3177
  k,
3253
3178
  D,
3254
- ee,
3255
- M,
3256
- N,
3179
+ A,
3180
+ ae,
3257
3181
  oe,
3258
- se,
3182
+ N,
3259
3183
  P,
3260
- ce,
3184
+ se,
3261
3185
  F,
3262
- I
3263
- ]), Yt = R((e, t) => {
3264
- E === "retention" && t === "dimension" ? Z({ field: e.name }) : ct(e.name, t === "timeDimension");
3186
+ I,
3187
+ L
3188
+ ]), Yt = V((e, t) => {
3189
+ E === "retention" && t === "dimension" ? X({ field: e.name }) : ct(e.name, t === "timeDimension");
3265
3190
  }, [
3266
3191
  E,
3267
- Z,
3192
+ X,
3268
3193
  ct
3269
- ]), Xt = R((e, t, n, r) => {
3270
- Je === "metrics" && t === "measure" ? rt(e.name) : Je === "breakdown" && Yt(e, t), r || Ze();
3194
+ ]), Xt = V((e, t, n, r) => {
3195
+ qe === "metrics" && t === "measure" ? rt(e.name) : qe === "breakdown" && Yt(e, t), r || Ze();
3271
3196
  }, [
3272
- Je,
3197
+ qe,
3273
3198
  rt,
3274
3199
  Yt,
3275
3200
  Ze
@@ -3287,7 +3212,7 @@ function Bn(e = {}) {
3287
3212
  multiQueryConfig: b,
3288
3213
  multiQueryValidation: x,
3289
3214
  isValidQuery: S,
3290
- effectiveIsValidQuery: Ce,
3215
+ effectiveIsValidQuery: Se,
3291
3216
  combinedMetrics: C,
3292
3217
  combinedBreakdowns: w,
3293
3218
  effectiveBreakdowns: T,
@@ -3296,50 +3221,50 @@ function Bn(e = {}) {
3296
3221
  isFunnelModeEnabled: te,
3297
3222
  funnelCube: O,
3298
3223
  funnelSteps: k,
3299
- activeFunnelStepIndex: A,
3300
- funnelTimeDimension: ee,
3224
+ activeFunnelStepIndex: ee,
3225
+ funnelTimeDimension: A,
3301
3226
  funnelChartType: ne,
3302
3227
  funnelChartConfig: re,
3303
- funnelDisplayConfig: ae,
3304
- serverFunnelQuery: fe,
3305
- flowCube: M,
3306
- flowBindingKey: N,
3307
- flowTimeDimension: oe,
3308
- eventDimension: se,
3309
- startingStep: P,
3310
- stepsBefore: ce,
3311
- stepsAfter: F,
3312
- joinStrategy: I,
3313
- flowDisplayConfig: L,
3314
- serverFlowQuery: V,
3315
- retentionCube: U,
3316
- retentionBindingKey: W,
3317
- retentionTimeDimension: G,
3318
- retentionDateRange: K,
3319
- retentionCohortFilters: pe,
3320
- retentionActivityFilters: q,
3321
- retentionBreakdowns: me,
3322
- retentionViewGranularity: he,
3323
- retentionPeriods: ge,
3324
- retentionType: _e,
3325
- retentionDisplayConfig: be,
3326
- serverRetentionQuery: xe,
3327
- retentionValidation: Se,
3328
- chartType: we,
3329
- chartConfig: Te,
3330
- displayConfig: Ee,
3331
- colorPalette: Ve,
3332
- localPaletteName: Oe,
3333
- chartAvailability: Be,
3334
- userManuallySelectedChart: De,
3335
- activeTab: We,
3336
- activeView: Ge,
3337
- displayLimit: Ke,
3338
- showFieldModal: qe,
3339
- fieldModalMode: Je,
3228
+ funnelDisplayConfig: ie,
3229
+ serverFunnelQuery: de,
3230
+ flowCube: ae,
3231
+ flowBindingKey: oe,
3232
+ flowTimeDimension: N,
3233
+ eventDimension: P,
3234
+ startingStep: se,
3235
+ stepsBefore: F,
3236
+ stepsAfter: I,
3237
+ joinStrategy: L,
3238
+ flowDisplayConfig: le,
3239
+ serverFlowQuery: fe,
3240
+ retentionCube: pe,
3241
+ retentionBindingKey: me,
3242
+ retentionTimeDimension: he,
3243
+ retentionDateRange: B,
3244
+ retentionCohortFilters: ge,
3245
+ retentionActivityFilters: _e,
3246
+ retentionBreakdowns: ve,
3247
+ retentionViewGranularity: H,
3248
+ retentionPeriods: W,
3249
+ retentionType: K,
3250
+ retentionDisplayConfig: ye,
3251
+ serverRetentionQuery: be,
3252
+ retentionValidation: xe,
3253
+ chartType: Ce,
3254
+ chartConfig: we,
3255
+ displayConfig: Y,
3256
+ colorPalette: Be,
3257
+ localPaletteName: De,
3258
+ chartAvailability: ze,
3259
+ userManuallySelectedChart: Ee,
3260
+ activeTab: Ue,
3261
+ activeView: We,
3262
+ displayLimit: Ge,
3263
+ showFieldModal: Ke,
3264
+ fieldModalMode: qe,
3340
3265
  activeTableIndex: Qe,
3341
3266
  adapterValidation: Jt,
3342
- getQueryConfig: R(() => {
3267
+ getQueryConfig: V(() => {
3343
3268
  let e = r.getState();
3344
3269
  return e.analysisType === "funnel" ? e.buildFunnelQueryFromSteps() || e.buildCurrentQuery() : e.queryStates.length > 1 ? {
3345
3270
  queries: e.buildAllQueries(),
@@ -3350,24 +3275,24 @@ function Bn(e = {}) {
3350
3275
  stepTimeToConvert: e.stepTimeToConvert
3351
3276
  } : e.buildCurrentQuery();
3352
3277
  }, [r]),
3353
- getChartConfig: R(() => {
3278
+ getChartConfig: V(() => {
3354
3279
  let e = r.getState(), t = e.charts[e.analysisType];
3355
3280
  return t ? {
3356
3281
  chartType: t.chartType,
3357
3282
  chartConfig: t.chartConfig,
3358
3283
  displayConfig: t.displayConfig
3359
3284
  } : {
3360
- chartType: we,
3361
- chartConfig: Te,
3362
- displayConfig: Ee
3285
+ chartType: Ce,
3286
+ chartConfig: we,
3287
+ displayConfig: Y
3363
3288
  };
3364
3289
  }, [
3365
3290
  r,
3291
+ Ce,
3366
3292
  we,
3367
- Te,
3368
- Ee
3293
+ Y
3369
3294
  ]),
3370
- getAnalysisType: R(() => r.getState().analysisType, [r]),
3295
+ getAnalysisType: V(() => r.getState().analysisType, [r]),
3371
3296
  actions: {
3372
3297
  setActiveQueryIndex: s,
3373
3298
  setMergeStrategy: c,
@@ -3397,9 +3322,9 @@ function Bn(e = {}) {
3397
3322
  updateFunnelStep: Ct,
3398
3323
  setActiveFunnelStepIndex: wt,
3399
3324
  reorderFunnelSteps: Tt,
3400
- setFunnelTimeDimension: Dt,
3401
- setFunnelDisplayConfig: Pe,
3402
- setFlowCube: kt,
3325
+ setFunnelTimeDimension: Et,
3326
+ setFunnelDisplayConfig: Ne,
3327
+ setFlowCube: Ot,
3403
3328
  setFlowBindingKey: At,
3404
3329
  setFlowTimeDimension: jt,
3405
3330
  setEventDimension: Mt,
@@ -3408,27 +3333,27 @@ function Bn(e = {}) {
3408
3333
  setStepsBefore: Ft,
3409
3334
  setStepsAfter: It,
3410
3335
  setJoinStrategy: Lt,
3411
- setFlowDisplayConfig: He,
3336
+ setFlowDisplayConfig: Ve,
3412
3337
  setRetentionCube: Rt,
3413
3338
  setRetentionBindingKey: zt,
3414
3339
  setRetentionTimeDimension: Bt,
3415
3340
  setRetentionDateRange: Vt,
3416
3341
  setRetentionCohortFilters: Ht,
3417
3342
  setRetentionActivityFilters: Ut,
3418
- setRetentionBreakdowns: X,
3419
- addRetentionBreakdown: Z,
3420
- removeRetentionBreakdown: Wt,
3343
+ setRetentionBreakdowns: Wt,
3344
+ addRetentionBreakdown: X,
3345
+ removeRetentionBreakdown: Z,
3421
3346
  setRetentionViewGranularity: Gt,
3422
- setRetentionPeriods: Q,
3423
- setRetentionType: Kt,
3424
- setRetentionDisplayConfig: Ue,
3425
- setChartType: Le,
3426
- setChartConfig: Re,
3427
- setDisplayConfig: ze,
3428
- setLocalPaletteName: Fe,
3429
- setUserManuallySelectedChart: Ie,
3430
- setActiveTab: Ye,
3431
- setActiveView: Y,
3347
+ setRetentionPeriods: Kt,
3348
+ setRetentionType: Q,
3349
+ setRetentionDisplayConfig: He,
3350
+ setChartType: Ie,
3351
+ setChartConfig: Le,
3352
+ setDisplayConfig: Re,
3353
+ setLocalPaletteName: Pe,
3354
+ setUserManuallySelectedChart: Fe,
3355
+ setActiveTab: Je,
3356
+ setActiveView: Ye,
3432
3357
  setDisplayLimit: Xe,
3433
3358
  closeFieldModal: Ze,
3434
3359
  setActiveTableIndex: $e,
@@ -3440,13 +3365,13 @@ function Bn(e = {}) {
3440
3365
  }
3441
3366
  //#endregion
3442
3367
  //#region src/client/hooks/analysisQueryExecutionModes.ts
3443
- function Vn(e) {
3368
+ function Hn(e) {
3444
3369
  return e.isRetentionMode ? "retention" : e.isFlowMode ? "flow" : e.isFunnelMode ? "funnel" : e.isMultiMode ? "multi" : "single";
3445
3370
  }
3446
- function Hn(e, t) {
3371
+ function Un(e, t) {
3447
3372
  return t[e];
3448
3373
  }
3449
- function Un(e) {
3374
+ function Wn(e) {
3450
3375
  return {
3451
3376
  funnelExecutedQueries: e.isFunnelMode && e.funnelExecutedQueries && e.funnelExecutedQueries.length > 0 ? e.funnelExecutedQueries : null,
3452
3377
  funnelServerQuery: e.isFunnelMode ? e.funnelServerQuery : null,
@@ -3459,7 +3384,7 @@ function Un(e) {
3459
3384
  retentionDebugData: e.isRetentionMode ? e.retentionDebugData : null
3460
3385
  };
3461
3386
  }
3462
- function Wn(e) {
3387
+ function Gn(e) {
3463
3388
  return {
3464
3389
  single: !e.isValidQuery || !e.isSingleMode,
3465
3390
  multi: !e.hasMultiQueryConfig || !e.isMultiMode,
@@ -3469,11 +3394,11 @@ function Wn(e) {
3469
3394
  dryRun: !!(!e.isValidQuery || e.isFunnelMode || e.isFlowMode || e.isRetentionMode)
3470
3395
  };
3471
3396
  }
3472
- function Gn(e) {
3397
+ function Kn(e) {
3473
3398
  let { hasResults: t, initialData: n, isValidQuery: r, isLoading: i, isFetching: a, error: o } = e;
3474
3399
  return n && n.length > 0 && !t ? "success" : r ? i && !t ? "loading" : a && t ? "refreshing" : o ? "error" : t ? "success" : "idle" : "idle";
3475
3400
  }
3476
- function Kn(e) {
3401
+ function qn(e) {
3477
3402
  return e.isRetentionMode && e.retentionChartData ? e.retentionChartData.rows.map((e) => ({
3478
3403
  "Retention.period": `P${e.period}`,
3479
3404
  "Retention.rate": e.retentionRate,
@@ -3484,18 +3409,18 @@ function Kn(e) {
3484
3409
  }
3485
3410
  //#endregion
3486
3411
  //#region src/client/hooks/useAnalysisQuery.ts
3487
- function qn(e) {
3488
- let { currentQuery: t, allQueries: n, multiQueryConfig: r, isMultiQueryMode: i, isValidQuery: a, initialData: o, mergeStrategy: s, funnelBindingKey: c, isFunnelModeEnabled: l, analysisType: u, serverFunnelQuery: d, serverFlowQuery: f, serverRetentionQuery: p, retentionValidation: m } = e, { getFieldLabel: h } = k(), g = u === "funnel" || l, _ = u === "flow", v = u === "retention", y = u === "query" && i, b = u === "query" && !i, x = u === "funnel" && !!d, S = Vn({
3412
+ function Jn(e) {
3413
+ let { currentQuery: t, allQueries: n, multiQueryConfig: r, isMultiQueryMode: i, isValidQuery: a, initialData: o, mergeStrategy: s, funnelBindingKey: c, isFunnelModeEnabled: l, analysisType: u, serverFunnelQuery: d, serverFlowQuery: f, serverRetentionQuery: p, retentionValidation: m } = e, { getFieldLabel: h } = de(), g = u === "funnel" || l, _ = u === "flow", v = u === "retention", y = u === "query" && i, b = u === "query" && !i, x = u === "funnel" && !!d, S = Hn({
3489
3414
  isRetentionMode: v,
3490
3415
  isFlowMode: _,
3491
3416
  isFunnelMode: g,
3492
3417
  isMultiMode: y
3493
- }), C = B(() => x || !g || !c || n.length < 2 ? null : F(n, c), [
3418
+ }), C = U(() => x || !g || !c || n.length < 2 ? null : pe(n, c), [
3494
3419
  x,
3495
3420
  g,
3496
3421
  c,
3497
3422
  n
3498
- ]), w = Wn({
3423
+ ]), w = Gn({
3499
3424
  isValidQuery: a,
3500
3425
  isSingleMode: b,
3501
3426
  isMultiMode: y,
@@ -3507,49 +3432,49 @@ function qn(e) {
3507
3432
  hasServerFunnelQuery: !!d,
3508
3433
  hasServerFlowQuery: !!f,
3509
3434
  hasServerRetentionQuery: !!p
3510
- }), T = ne(t, {
3435
+ }), T = oe(t, {
3511
3436
  skip: w.single,
3512
3437
  debounceMs: 300
3513
- }), E = ie(r, {
3438
+ }), E = se(r, {
3514
3439
  skip: w.multi,
3515
3440
  debounceMs: 300
3516
- }), D = M(C, {
3441
+ }), D = L(C, {
3517
3442
  skip: w.funnel,
3518
3443
  debounceMs: 300,
3519
3444
  prebuiltServerQuery: x ? d : void 0
3520
- }), O = se(f ?? null, {
3445
+ }), O = ue(f ?? null, {
3521
3446
  skip: w.flow,
3522
3447
  debounceMs: 300
3523
- }), A = re(p ?? null, {
3448
+ }), k = P(p ?? null, {
3524
3449
  skip: w.retention,
3525
3450
  debounceMs: 300,
3526
3451
  getFieldLabel: h
3527
- }), ee = ce({
3452
+ }), ee = fe({
3528
3453
  queries: i ? n : [t],
3529
3454
  isMultiQueryMode: i,
3530
3455
  skip: w.dryRun
3531
- }), te = P(D.serverQuery, { skip: !g || !D.serverQuery }), j = P(O.serverQuery, { skip: !_ || !O.serverQuery }), ae = P(p, { skip: !v || !p }), N = Hn(S, {
3532
- retention: A.isLoading || A.isDebouncing,
3456
+ }), A = z(D.serverQuery, { skip: !g || !D.serverQuery }), te = z(O.serverQuery, { skip: !_ || !O.serverQuery }), ne = z(p, { skip: !v || !p }), j = Un(S, {
3457
+ retention: k.isLoading || k.isDebouncing,
3533
3458
  flow: O.isLoading || O.isDebouncing,
3534
3459
  funnel: D.isExecuting || D.isDebouncing,
3535
3460
  multi: E.isLoading,
3536
3461
  single: T.isLoading
3537
- }), oe = Hn(S, {
3538
- retention: A.isFetching,
3462
+ }), re = Un(S, {
3463
+ retention: k.isFetching,
3539
3464
  flow: O.isFetching,
3540
3465
  funnel: D.isExecuting,
3541
3466
  multi: E.isFetching,
3542
3467
  single: T.isFetching
3543
- }), I = Hn(S, {
3544
- retention: A.error,
3468
+ }), M = Un(S, {
3469
+ retention: k.error,
3545
3470
  flow: O.error,
3546
3471
  funnel: D.error,
3547
3472
  multi: E.error,
3548
3473
  single: T.error
3549
- }), le = !!(T.debouncedQuery || E.debouncedConfig || !D.isDebouncing || !O.isDebouncing || !A.isDebouncing), L = R((e) => {
3474
+ }), ie = !!(T.debouncedQuery || E.debouncedConfig || !D.isDebouncing || !O.isDebouncing || !k.isDebouncing), ae = V((e) => {
3550
3475
  switch (S) {
3551
3476
  case "retention":
3552
- A.execute(e);
3477
+ k.execute(e);
3553
3478
  break;
3554
3479
  case "flow":
3555
3480
  O.refetch(e);
@@ -3564,14 +3489,14 @@ function qn(e) {
3564
3489
  }
3565
3490
  }, [
3566
3491
  S,
3567
- A,
3492
+ k,
3568
3493
  O,
3569
3494
  D,
3570
3495
  E,
3571
3496
  T
3572
- ]), ue = B(() => Gn({
3573
- hasResults: Hn(S, {
3574
- retention: A.chartData,
3497
+ ]), N = U(() => Kn({
3498
+ hasResults: Un(S, {
3499
+ retention: k.chartData,
3575
3500
  flow: O.data,
3576
3501
  funnel: D.chartData,
3577
3502
  multi: E.data,
@@ -3579,27 +3504,27 @@ function qn(e) {
3579
3504
  }),
3580
3505
  initialData: o,
3581
3506
  isValidQuery: a,
3582
- isLoading: N,
3583
- isFetching: oe,
3584
- error: I
3507
+ isLoading: j,
3508
+ isFetching: re,
3509
+ error: M
3585
3510
  }), [
3586
3511
  a,
3587
- N,
3588
- oe,
3589
- I,
3512
+ j,
3513
+ re,
3514
+ M,
3590
3515
  T.rawData,
3591
3516
  E.data,
3592
3517
  D.chartData,
3593
3518
  O.data,
3594
- A.chartData,
3519
+ k.chartData,
3595
3520
  o,
3596
3521
  S
3597
- ]), de = B(() => Kn({
3522
+ ]), F = U(() => qn({
3598
3523
  isRetentionMode: v,
3599
3524
  isFlowMode: _,
3600
3525
  isFunnelMode: g,
3601
3526
  isMultiMode: y,
3602
- retentionChartData: A.chartData,
3527
+ retentionChartData: k.chartData,
3603
3528
  flowData: O.data,
3604
3529
  funnelChartData: D.chartData,
3605
3530
  multiData: E.data,
@@ -3610,107 +3535,107 @@ function qn(e) {
3610
3535
  E.data,
3611
3536
  D.chartData,
3612
3537
  O.data,
3613
- A.chartData,
3538
+ k.chartData,
3614
3539
  o,
3615
3540
  y,
3616
3541
  g,
3617
3542
  _,
3618
3543
  v
3619
- ]), fe = B(() => g && D.stepResults ? D.stepResults.map((e) => e.data) : !y || !E.perQueryData ? null : E.perQueryData, [
3544
+ ]), I = U(() => g && D.stepResults ? D.stepResults.map((e) => e.data) : !y || !E.perQueryData ? null : E.perQueryData, [
3620
3545
  y,
3621
3546
  g,
3622
3547
  E.perQueryData,
3623
3548
  D.stepResults
3624
- ]), { funnelExecutedQueries: z, funnelServerQuery: V, funnelDebugData: H, flowServerQuery: U, flowChartData: W, flowDebugData: G, retentionServerQuery: K, retentionChartData: pe, retentionDebugData: q } = Un({
3549
+ ]), { funnelExecutedQueries: ce, funnelServerQuery: le, funnelDebugData: R, flowServerQuery: me, flowChartData: he, flowDebugData: B, retentionServerQuery: ge, retentionChartData: _e, retentionDebugData: ve } = Wn({
3625
3550
  isFunnelMode: g,
3626
3551
  isFlowMode: _,
3627
3552
  isRetentionMode: v,
3628
3553
  funnelExecutedQueries: D.executedQueries,
3629
3554
  funnelServerQuery: D.serverQuery,
3630
- funnelDebugData: te.debugData,
3555
+ funnelDebugData: A.debugData,
3631
3556
  flowServerQuery: O.serverQuery,
3632
3557
  flowData: O.data,
3633
- flowDebugData: j.debugData,
3558
+ flowDebugData: te.debugData,
3634
3559
  retentionServerQuery: p ?? null,
3635
- retentionChartData: A.chartData,
3636
- retentionDebugData: ae.debugData
3637
- }), me = B(() => Hn(S, {
3638
- retention: A.needsRefresh,
3560
+ retentionChartData: k.chartData,
3561
+ retentionDebugData: ne.debugData
3562
+ }), H = U(() => Un(S, {
3563
+ retention: k.needsRefresh,
3639
3564
  flow: O.needsRefresh,
3640
3565
  funnel: D.needsRefresh,
3641
3566
  multi: !1,
3642
3567
  single: T.needsRefresh
3643
3568
  }), [
3644
3569
  S,
3645
- A.needsRefresh,
3570
+ k.needsRefresh,
3646
3571
  O.needsRefresh,
3647
3572
  D.needsRefresh,
3648
3573
  T.needsRefresh
3649
- ]), he = B(() => {
3574
+ ]), W = U(() => {
3650
3575
  if (b && T.warnings) return T.warnings;
3651
3576
  }, [b, T.warnings]);
3652
3577
  return {
3653
- executionStatus: ue,
3654
- executionResults: de,
3655
- perQueryResults: fe,
3656
- isLoading: N,
3657
- isFetching: oe,
3658
- error: I,
3578
+ executionStatus: N,
3579
+ executionResults: F,
3580
+ perQueryResults: I,
3581
+ isLoading: j,
3582
+ isFetching: re,
3583
+ error: M,
3659
3584
  debugDataPerQuery: ee.debugDataPerQuery,
3660
- hasDebounced: le,
3661
- refetch: L,
3662
- funnelExecutedQueries: z,
3663
- funnelServerQuery: V,
3664
- funnelDebugData: H,
3665
- flowServerQuery: U,
3666
- flowChartData: W,
3667
- flowDebugData: G,
3668
- retentionServerQuery: K,
3669
- retentionChartData: pe,
3670
- retentionDebugData: q,
3585
+ hasDebounced: ie,
3586
+ refetch: ae,
3587
+ funnelExecutedQueries: ce,
3588
+ funnelServerQuery: le,
3589
+ funnelDebugData: R,
3590
+ flowServerQuery: me,
3591
+ flowChartData: he,
3592
+ flowDebugData: B,
3593
+ retentionServerQuery: ge,
3594
+ retentionChartData: _e,
3595
+ retentionDebugData: ve,
3671
3596
  retentionValidation: m ?? null,
3672
- needsRefresh: me,
3673
- warnings: he
3597
+ needsRefresh: H,
3598
+ warnings: W
3674
3599
  };
3675
3600
  }
3676
3601
  //#endregion
3677
3602
  //#region src/client/utils/shareUtils.ts
3678
- var Jn = o(), Yn = 1800, Xn = "share=";
3679
- function Zn(e) {
3680
- return (0, Jn.compressToEncodedURIComponent)(JSON.stringify(e));
3681
- }
3603
+ var Yn = o(), Xn = 1800, Zn = "share=";
3682
3604
  function Qn(e) {
3605
+ return (0, Yn.compressToEncodedURIComponent)(JSON.stringify(e));
3606
+ }
3607
+ function $n(e) {
3683
3608
  try {
3684
- let t = (0, Jn.decompressFromEncodedURIComponent)(e);
3609
+ let t = (0, Yn.decompressFromEncodedURIComponent)(e);
3685
3610
  if (!t) return null;
3686
3611
  let n = JSON.parse(t);
3687
- return y(n) ? n : (console.warn("[shareUtils] Invalid AnalysisConfig in share URL"), null);
3612
+ return D(n) ? n : (console.warn("[shareUtils] Invalid AnalysisConfig in share URL"), null);
3688
3613
  } catch {
3689
3614
  return null;
3690
3615
  }
3691
3616
  }
3692
- function $n(e) {
3693
- let t = Zn(e);
3617
+ function er(e) {
3618
+ let t = Qn(e);
3694
3619
  return {
3695
- ok: t.length <= Yn,
3620
+ ok: t.length <= Xn,
3696
3621
  size: t.length,
3697
- maxSize: Yn
3622
+ maxSize: Xn
3698
3623
  };
3699
3624
  }
3700
- function er(e) {
3701
- let t = Zn(e);
3702
- if (t.length <= Yn) return {
3625
+ function tr(e) {
3626
+ let t = Qn(e);
3627
+ if (t.length <= Xn) return {
3703
3628
  encoded: t,
3704
3629
  queryOnly: !1
3705
3630
  };
3706
- let n = Zn({
3631
+ let n = Qn({
3707
3632
  version: e.version,
3708
3633
  analysisType: e.analysisType,
3709
3634
  activeView: e.activeView,
3710
3635
  charts: {},
3711
3636
  query: e.query
3712
3637
  });
3713
- return n.length <= Yn ? {
3638
+ return n.length <= Xn ? {
3714
3639
  encoded: n,
3715
3640
  queryOnly: !0
3716
3641
  } : {
@@ -3718,27 +3643,27 @@ function er(e) {
3718
3643
  queryOnly: !0
3719
3644
  };
3720
3645
  }
3721
- function tr(e) {
3722
- let { encoded: t } = er(e);
3723
- return t ? `${window.location.origin}${window.location.pathname}#${Xn}${t}` : null;
3646
+ function nr(e) {
3647
+ let { encoded: t } = tr(e);
3648
+ return t ? `${window.location.origin}${window.location.pathname}#${Zn}${t}` : null;
3724
3649
  }
3725
- function nr() {
3650
+ function rr() {
3726
3651
  if (typeof window > "u") return null;
3727
3652
  let e = window.location.hash;
3728
- return !e || !e.startsWith(`#${Xn}`) ? null : e.slice(7);
3653
+ return !e || !e.startsWith(`#${Zn}`) ? null : e.slice(7);
3729
3654
  }
3730
- function rr() {
3655
+ function ir() {
3731
3656
  if (typeof window > "u") return;
3732
3657
  let e = new URL(window.location.href);
3733
3658
  e.hash = "", window.history.replaceState(null, "", e.toString());
3734
3659
  }
3735
- function ir() {
3736
- let e = nr();
3737
- return e ? Qn(e) : null;
3660
+ function ar() {
3661
+ let e = rr();
3662
+ return e ? $n(e) : null;
3738
3663
  }
3739
3664
  //#endregion
3740
3665
  //#region src/client/components/AIAssistant/utils.ts
3741
- async function ar(e, t, n = "/api/ai/generate", r) {
3666
+ async function or(e, t, n = "/api/ai/generate", r) {
3742
3667
  let i = { text: t }, a = {
3743
3668
  "Content-Type": "application/json",
3744
3669
  ...r
@@ -3768,28 +3693,28 @@ async function ar(e, t, n = "/api/ai/generate", r) {
3768
3693
  let s = await o.json();
3769
3694
  return console.log("✅ Client: Successfully generated content"), s;
3770
3695
  }
3771
- function or(e) {
3696
+ function sr(e) {
3772
3697
  return (e.query || "").replace(/```json\s*/g, "").replace(/```\s*/g, "").replace(/^\s*```.*\n/gm, "").trim();
3773
3698
  }
3774
3699
  //#endregion
3775
3700
  //#region src/client/hooks/useAnalysisEffects.ts
3776
- function sr(e) {
3701
+ function cr(e) {
3777
3702
  return typeof e == "object" && !!e && "funnel" in e && typeof e.funnel == "object";
3778
3703
  }
3779
- function cr(e) {
3780
- let { state: t, query: n, aiEndpoint: r = "/api/ai", onQueryChange: i, onChartConfigChange: a } = e, { storeApi: o, actions: s } = t, { apiOptions: c } = u(), l = V(!1);
3781
- z(() => {
3704
+ function lr(e) {
3705
+ let { state: t, query: n, aiEndpoint: r = "/api/ai", onQueryChange: i, onChartConfigChange: a } = e, { storeApi: o, actions: s } = t, { apiOptions: c } = u(), l = W(!1);
3706
+ H(() => {
3782
3707
  if (l.current) return;
3783
3708
  l.current = !0;
3784
- let e = ir();
3785
- e && (o.getState().load(e), rr());
3786
- }, [o]), z(() => {
3709
+ let e = ar();
3710
+ e && (o.getState().load(e), ir());
3711
+ }, [o]), H(() => {
3787
3712
  i && t.isValidQuery && i(t.currentQuery);
3788
3713
  }, [
3789
3714
  t.currentQuery,
3790
3715
  t.isValidQuery,
3791
3716
  i
3792
- ]), z(() => {
3717
+ ]), H(() => {
3793
3718
  a && a({
3794
3719
  chartType: t.chartType,
3795
3720
  chartConfig: t.chartConfig,
@@ -3801,46 +3726,46 @@ function cr(e) {
3801
3726
  t.displayConfig,
3802
3727
  a
3803
3728
  ]);
3804
- let { combinedMetrics: d, combinedBreakdowns: p, chartType: m, chartConfig: h, userManuallySelectedChart: g } = t, { hasDebounced: _ } = n, { setChartType: v, setChartConfig: y } = s, b = V("");
3805
- z(() => {
3806
- if (!_ || d.length === 0 && p.length === 0) return;
3729
+ let { combinedMetrics: f, combinedBreakdowns: m, chartType: h, chartConfig: g, userManuallySelectedChart: _ } = t, { hasDebounced: v } = n, { setChartType: y, setChartConfig: b } = s, x = W("");
3730
+ H(() => {
3731
+ if (!v || f.length === 0 && m.length === 0) return;
3807
3732
  let e = JSON.stringify({
3808
- metrics: d.map((e) => e.field),
3809
- breakdowns: p.map((e) => ({
3733
+ metrics: f.map((e) => e.field),
3734
+ breakdowns: m.map((e) => ({
3810
3735
  field: e.field,
3811
3736
  isTime: e.isTimeDimension
3812
3737
  }))
3813
3738
  });
3814
- if (e === b.current) return;
3815
- b.current = e;
3816
- let t = At(d, p, m, g);
3739
+ if (e === x.current) return;
3740
+ x.current = e;
3741
+ let t = jt(f, m, h, _);
3817
3742
  if (t) {
3818
- let { chartConfig: e } = Ot(d, p, t);
3819
- v(t), y(e), s.setUserManuallySelectedChart(!1);
3820
- } else if (d.length > 0 || p.length > 0) {
3821
- if (m === "table") {
3822
- let e = [...p.map((e) => e.field), ...d.map((e) => e.field)], t = Array.isArray(h.xAxis) ? h.xAxis : [], n = e.filter((e) => !t.includes(e));
3823
- n.length > 0 && y({
3824
- ...h,
3743
+ let { chartConfig: e } = kt(f, m, t);
3744
+ y(t), b(e), s.setUserManuallySelectedChart(!1);
3745
+ } else if (f.length > 0 || m.length > 0) {
3746
+ if (h === "table") {
3747
+ let e = [...m.map((e) => e.field), ...f.map((e) => e.field)], t = Array.isArray(g.xAxis) ? g.xAxis : [], n = e.filter((e) => !t.includes(e));
3748
+ n.length > 0 && b({
3749
+ ...g,
3825
3750
  xAxis: [...t, ...n]
3826
3751
  });
3827
- } else if (!h.xAxis?.length && !h.yAxis?.length && !h.series?.length) {
3828
- let { chartConfig: e } = Ot(d, p, m);
3829
- y(e);
3752
+ } else if (!g.xAxis?.length && !g.yAxis?.length && !g.series?.length) {
3753
+ let { chartConfig: e } = kt(f, m, h);
3754
+ b(e);
3830
3755
  }
3831
3756
  }
3832
3757
  }, [
3833
- _,
3834
- d,
3835
- p,
3758
+ v,
3759
+ f,
3836
3760
  m,
3837
- g,
3838
3761
  h,
3839
- v,
3762
+ _,
3763
+ g,
3840
3764
  y,
3765
+ b,
3841
3766
  s
3842
3767
  ]);
3843
- let [x, S] = H({
3768
+ let [S, C] = G({
3844
3769
  isOpen: !1,
3845
3770
  userPrompt: "",
3846
3771
  isGenerating: !1,
@@ -3848,7 +3773,7 @@ function cr(e) {
3848
3773
  hasGeneratedQuery: !1,
3849
3774
  previousState: null,
3850
3775
  previousConfig: null
3851
- }), w = R((e) => {
3776
+ }), w = V((e) => {
3852
3777
  o.getState().updateQueryState(t.activeQueryIndex, (t) => {
3853
3778
  let n = e(t);
3854
3779
  return {
@@ -3860,7 +3785,7 @@ function cr(e) {
3860
3785
  limit: n.limit
3861
3786
  };
3862
3787
  });
3863
- }, [o, t.activeQueryIndex]), T = R((e) => {
3788
+ }, [o, t.activeQueryIndex]), T = V((e) => {
3864
3789
  let t = {
3865
3790
  version: 1,
3866
3791
  analysisType: "funnel",
@@ -3873,9 +3798,9 @@ function cr(e) {
3873
3798
  query: e
3874
3799
  };
3875
3800
  o.getState().load(t);
3876
- }, [o]), E = R(() => {
3801
+ }, [o]), E = V(() => {
3877
3802
  let e = o.getState().save();
3878
- S({
3803
+ C({
3879
3804
  isOpen: !0,
3880
3805
  userPrompt: "",
3881
3806
  isGenerating: !1,
@@ -3901,30 +3826,30 @@ function cr(e) {
3901
3826
  t.chartConfig,
3902
3827
  t.displayConfig,
3903
3828
  t.analysisType
3904
- ]), D = R(() => {
3905
- S((e) => ({
3829
+ ]), D = V(() => {
3830
+ C((e) => ({
3906
3831
  ...e,
3907
3832
  isOpen: !1,
3908
3833
  userPrompt: "",
3909
3834
  error: null,
3910
3835
  hasGeneratedQuery: !1
3911
3836
  }));
3912
- }, []), O = R((e) => {
3913
- S((t) => ({
3837
+ }, []), O = V((e) => {
3838
+ C((t) => ({
3914
3839
  ...t,
3915
3840
  userPrompt: e
3916
3841
  }));
3917
- }, []), k = R(async () => {
3918
- if (x.userPrompt.trim()) {
3919
- S((e) => ({
3842
+ }, []), k = V(async () => {
3843
+ if (S.userPrompt.trim()) {
3844
+ C((e) => ({
3920
3845
  ...e,
3921
3846
  isGenerating: !0,
3922
3847
  error: null
3923
3848
  }));
3924
3849
  try {
3925
- let e = or(await ar("", x.userPrompt, r, c?.headers)), n = JSON.parse(e), i = "query" in n && n.query ? n.query : n, a = "chartType" in n ? n.chartType : void 0, o = "chartConfig" in n ? n.chartConfig : void 0;
3926
- if (sr(i)) {
3927
- s.setAnalysisType("funnel"), T(i), s.setChartType("funnel"), o && s.setChartConfig(o), s.setActiveView("chart"), S((e) => ({
3850
+ let e = sr(await or("", S.userPrompt, r, c?.headers)), n = JSON.parse(e), i = "query" in n && n.query ? n.query : n, a = "chartType" in n ? n.chartType : void 0, o = "chartConfig" in n ? n.chartConfig : void 0;
3851
+ if (cr(i)) {
3852
+ s.setAnalysisType("funnel"), T(i), s.setChartType("funnel"), o && s.setChartConfig(o), s.setActiveView("chart"), C((e) => ({
3928
3853
  ...e,
3929
3854
  isGenerating: !1,
3930
3855
  hasGeneratedQuery: !0
@@ -3935,16 +3860,16 @@ function cr(e) {
3935
3860
  w((e) => ({
3936
3861
  ...e,
3937
3862
  metrics: (l.measures || []).map((e, t) => ({
3938
- id: C(),
3863
+ id: p(),
3939
3864
  field: e,
3940
- label: f(t)
3865
+ label: d(t)
3941
3866
  })),
3942
3867
  breakdowns: [...(l.dimensions || []).map((e) => ({
3943
- id: C(),
3868
+ id: p(),
3944
3869
  field: e,
3945
3870
  isTimeDimension: !1
3946
3871
  })), ...(l.timeDimensions || []).map((e) => ({
3947
- id: C(),
3872
+ id: p(),
3948
3873
  field: e.dimension,
3949
3874
  granularity: e.granularity,
3950
3875
  isTimeDimension: !0
@@ -3952,13 +3877,13 @@ function cr(e) {
3952
3877
  filters: l.filters || [],
3953
3878
  order: l.order || void 0,
3954
3879
  limit: l.limit ?? void 0
3955
- })), t.analysisType === "funnel" && s.setAnalysisType("query"), a && s.setChartType(a), o && s.setChartConfig(o), s.setActiveView("chart"), S((e) => ({
3880
+ })), t.analysisType === "funnel" && s.setAnalysisType("query"), a && s.setChartType(a), o && s.setChartConfig(o), s.setActiveView("chart"), C((e) => ({
3956
3881
  ...e,
3957
3882
  isGenerating: !1,
3958
3883
  hasGeneratedQuery: !0
3959
3884
  }));
3960
3885
  } catch (e) {
3961
- S((t) => ({
3886
+ C((t) => ({
3962
3887
  ...t,
3963
3888
  isGenerating: !1,
3964
3889
  error: e instanceof Error ? e.message : "Failed to generate query"
@@ -3966,15 +3891,15 @@ function cr(e) {
3966
3891
  }
3967
3892
  }
3968
3893
  }, [
3969
- x.userPrompt,
3894
+ S.userPrompt,
3970
3895
  r,
3971
3896
  c?.headers,
3972
3897
  w,
3973
3898
  T,
3974
3899
  t.analysisType,
3975
3900
  s
3976
- ]), A = R(() => {
3977
- S({
3901
+ ]), ee = V(() => {
3902
+ C({
3978
3903
  isOpen: !1,
3979
3904
  userPrompt: "",
3980
3905
  isGenerating: !1,
@@ -3983,13 +3908,13 @@ function cr(e) {
3983
3908
  previousState: null,
3984
3909
  previousConfig: null
3985
3910
  });
3986
- }, []), ee = R(() => {
3987
- x.previousConfig ? o.getState().load(x.previousConfig) : x.previousState && (w((e) => ({
3911
+ }, []), A = V(() => {
3912
+ S.previousConfig ? o.getState().load(S.previousConfig) : S.previousState && (w((e) => ({
3988
3913
  ...e,
3989
- metrics: x.previousState.metrics,
3990
- breakdowns: x.previousState.breakdowns,
3991
- filters: x.previousState.filters
3992
- })), s.setChartType(x.previousState.chartType), s.setChartConfig(x.previousState.chartConfig), s.setDisplayConfig(x.previousState.displayConfig), x.previousState.analysisType && s.setAnalysisType(x.previousState.analysisType)), S({
3914
+ metrics: S.previousState.metrics,
3915
+ breakdowns: S.previousState.breakdowns,
3916
+ filters: S.previousState.filters
3917
+ })), s.setChartType(S.previousState.chartType), s.setChartConfig(S.previousState.chartConfig), s.setDisplayConfig(S.previousState.displayConfig), S.previousState.analysisType && s.setAnalysisType(S.previousState.analysisType)), C({
3993
3918
  isOpen: !1,
3994
3919
  userPrompt: "",
3995
3920
  isGenerating: !1,
@@ -3999,24 +3924,24 @@ function cr(e) {
3999
3924
  previousConfig: null
4000
3925
  });
4001
3926
  }, [
4002
- x.previousState,
4003
- x.previousConfig,
3927
+ S.previousState,
3928
+ S.previousConfig,
4004
3929
  o,
4005
3930
  w,
4006
3931
  s
4007
- ]), [te, ne] = H("idle"), j = t.effectiveIsValidQuery;
3932
+ ]), [te, ne] = G("idle"), j = t.effectiveIsValidQuery;
4008
3933
  return {
4009
- aiState: x,
3934
+ aiState: S,
4010
3935
  openAI: E,
4011
3936
  closeAI: D,
4012
3937
  setAIPrompt: O,
4013
3938
  generateAI: k,
4014
- acceptAI: A,
4015
- cancelAI: ee,
3939
+ acceptAI: ee,
3940
+ cancelAI: A,
4016
3941
  shareButtonState: te,
4017
- share: R(async () => {
3942
+ share: V(async () => {
4018
3943
  if (!j) return;
4019
- let { encoded: e, queryOnly: t } = er(o.getState().save());
3944
+ let { encoded: e, queryOnly: t } = tr(o.getState().save());
4020
3945
  if (!e) return;
4021
3946
  let n = `${window.location.origin}${window.location.pathname}#share=${e}`;
4022
3947
  try {
@@ -4034,8 +3959,8 @@ function cr(e) {
4034
3959
  }
4035
3960
  //#endregion
4036
3961
  //#region src/client/hooks/useAnalysisBuilderHook.ts
4037
- function lr(e = {}) {
4038
- let { initialData: t, externalColorPalette: n, onQueryChange: r, onChartConfigChange: i } = e, { features: a } = s(), o = Bn({ externalColorPalette: n }), c = qn({
3962
+ function ur(e = {}) {
3963
+ let { initialData: t, externalColorPalette: n, onQueryChange: r, onChartConfigChange: i } = e, { features: a } = s(), o = Vn({ externalColorPalette: n }), c = Jn({
4039
3964
  currentQuery: o.currentQuery,
4040
3965
  allQueries: o.allQueries,
4041
3966
  multiQueryConfig: o.multiQueryConfig,
@@ -4050,7 +3975,7 @@ function lr(e = {}) {
4050
3975
  serverFlowQuery: o.serverFlowQuery,
4051
3976
  serverRetentionQuery: o.serverRetentionQuery,
4052
3977
  retentionValidation: o.retentionValidation
4053
- }), l = cr({
3978
+ }), l = lr({
4054
3979
  state: o,
4055
3980
  query: c,
4056
3981
  aiEndpoint: a?.aiEndpoint,
@@ -4225,7 +4150,7 @@ function lr(e = {}) {
4225
4150
  }
4226
4151
  //#endregion
4227
4152
  //#region src/client/utils/funnelValidation.ts
4228
- function ur(e, t) {
4153
+ function dr(e, t) {
4229
4154
  let n = [];
4230
4155
  if (!t?.cubes) return n;
4231
4156
  if (typeof e.dimension == "string") {
@@ -4249,7 +4174,7 @@ function ur(e, t) {
4249
4174
  }
4250
4175
  return n;
4251
4176
  }
4252
- function dr(e) {
4177
+ function fr(e) {
4253
4178
  let t = [];
4254
4179
  for (let n = 0; n < e.length; n++) {
4255
4180
  let r = e[n], i = r.query;
@@ -4261,17 +4186,17 @@ function dr(e) {
4261
4186
  }
4262
4187
  return t;
4263
4188
  }
4264
- function fr(e, t) {
4189
+ function pr(e, t) {
4265
4190
  if (typeof e.dimension == "string") return !0;
4266
- let n = I(t);
4191
+ let n = me(t);
4267
4192
  return n ? e.dimension.some((e) => e.cube === n) : !1;
4268
4193
  }
4269
- function pr(e, t) {
4194
+ function mr(e, t) {
4270
4195
  let n = [];
4271
4196
  for (let r = 0; r < t.length; r++) {
4272
4197
  let i = t[r];
4273
- if (!fr(e, i.query)) {
4274
- let e = I(i.query) || "unknown";
4198
+ if (!pr(e, i.query)) {
4199
+ let e = me(i.query) || "unknown";
4275
4200
  n.push({
4276
4201
  type: "cross_cube",
4277
4202
  message: `Step ${r + 1} uses cube "${e}" but no binding key mapping exists for it`,
@@ -4281,26 +4206,26 @@ function pr(e, t) {
4281
4206
  }
4282
4207
  return n;
4283
4208
  }
4284
- function mr(e) {
4209
+ function hr(e) {
4285
4210
  return e ? /^P(?:\d+Y)?(?:\d+M)?(?:\d+W)?(?:\d+D)?(?:T(?:\d+H)?(?:\d+M)?(?:\d+S)?)?$/.test(e) ? null : {
4286
4211
  type: "time_window",
4287
4212
  message: `Invalid time window format "${e}". Expected ISO 8601 duration (e.g., P7D, PT1H)`
4288
4213
  } : null;
4289
4214
  }
4290
- function hr(e, t) {
4215
+ function gr(e, t) {
4291
4216
  let n = [], r = [];
4292
4217
  e.steps.length < 2 && n.push({
4293
4218
  type: "general",
4294
4219
  message: "Funnel requires at least 2 steps"
4295
- }), e.bindingKey?.dimension ? (n.push(...ur(e.bindingKey, t)), n.push(...pr(e.bindingKey, e.steps))) : n.push({
4220
+ }), e.bindingKey?.dimension ? (n.push(...dr(e.bindingKey, t)), n.push(...mr(e.bindingKey, e.steps))) : n.push({
4296
4221
  type: "binding_key",
4297
4222
  message: "Binding key dimension is required"
4298
- }), n.push(...dr(e.steps));
4223
+ }), n.push(...fr(e.steps));
4299
4224
  for (let t = 0; t < e.steps.length; t++) {
4300
- let r = e.steps[t], i = mr(r.timeToConvert);
4225
+ let r = e.steps[t], i = hr(r.timeToConvert);
4301
4226
  i && (i.stepIndex = t, n.push(i));
4302
4227
  }
4303
- let i = mr(e.globalTimeWindow);
4228
+ let i = hr(e.globalTimeWindow);
4304
4229
  return i && n.push(i), e.steps.length > 5 && r.push({
4305
4230
  type: "general",
4306
4231
  message: "Funnels with more than 5 steps may have reduced performance"
@@ -4310,7 +4235,7 @@ function hr(e, t) {
4310
4235
  warnings: r
4311
4236
  };
4312
4237
  }
4313
- function gr(e, t) {
4238
+ function _r(e, t) {
4314
4239
  return t < 2 ? {
4315
4240
  isValid: !1,
4316
4241
  message: "Add at least 2 steps for funnel"
@@ -4319,7 +4244,7 @@ function gr(e, t) {
4319
4244
  message: "Select a binding key dimension"
4320
4245
  } : { isValid: !0 };
4321
4246
  }
4322
- function _r(e) {
4247
+ function vr(e) {
4323
4248
  if (!e?.cubes) return [];
4324
4249
  let t = [];
4325
4250
  for (let n of e.cubes) if (n.dimensions) for (let e of n.dimensions) (e.type === "string" || e.type === "number") && t.push({
@@ -4329,7 +4254,7 @@ function _r(e) {
4329
4254
  });
4330
4255
  return t;
4331
4256
  }
4332
- function vr(e) {
4257
+ function yr(e) {
4333
4258
  if (!e?.dimension) return "Select binding key...";
4334
4259
  if (typeof e.dimension == "string") return e.dimension.split(".")[1] || e.dimension;
4335
4260
  if (e.dimension.length > 0) {
@@ -4339,6 +4264,6 @@ function vr(e) {
4339
4264
  return "Select binding key...";
4340
4265
  }
4341
4266
  //#endregion
4342
- export { Dn as A, wn as C, kn as D, Tn as E, Ye as F, xn as M, Ft as N, Cn as O, rt as P, bn as S, Sn as T, zn as _, pr as a, Fn as b, lr as c, tr as d, $n as f, Nn as g, Pn as h, ur as i, $ as j, On as k, Zn as l, ir as m, vr as n, hr as o, nr as p, gr as r, dr as s, _r as t, Qn as u, Ln as v, En as w, jn as x, Mn as y };
4267
+ export { On as A, Tn as C, An as D, En as E, Ye as F, Sn as M, It as N, wn as O, it as P, xn as S, Cn as T, Bn as _, mr as a, In as b, ur as c, nr as d, er as f, Pn as g, Fn as h, dr as i, $ as j, kn as k, Qn as l, ar as m, yr as n, gr as o, rr as p, _r as r, fr as s, vr as t, $n as u, Rn as v, Dn as w, Mn as x, Nn as y };
4343
4268
 
4344
- //# sourceMappingURL=analysis-builder-shared-AdAYIfj_.js.map
4269
+ //# sourceMappingURL=analysis-builder-shared-CD0n2Nb8.js.map