@nongt/visql 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,28 +1,28 @@
1
1
  import { jsx as o, Fragment as Me, jsxs as C } from "react/jsx-runtime";
2
- import { createContext as _e, useContext as Re, forwardRef as So, useMemo as we, useState as Se, useCallback as M, Fragment as Qa, useRef as X, useEffect as He, useLayoutEffect as br, useId as cd, cloneElement as ld, useImperativeHandle as dd } from "react";
2
+ import { createContext as _e, useContext as Re, forwardRef as So, useMemo as we, useState as Se, useCallback as M, Fragment as Qa, useRef as X, useEffect as He, useLayoutEffect as br, useId as ld, cloneElement as dd, useImperativeHandle as ud } from "react";
3
3
  import Y from "clsx";
4
- import { NavArrowDownSolid as Nt, Trash as ft, Plus as Gn, DatabaseScript as Co, EditPencil as ud, Xmark as To, Expand as $n, NavArrowUpSolid as kt, NetworkLeft as Eo, MinusSquare as gs, PlusCircleSolid as jt, CheckSquareSolid as Va, Square as Wa, WarningTriangle as ko, KeyframesPlus as hd, Collapse as pd, MinusSquareDashed as fd, Search as md, XmarkCircleSolid as Ka, DashboardSpeed as Bo, Play as gd } from "iconoir-react";
5
- import { useNodeId as bd, useStore as ns, Position as Te, Handle as Ee, useReactFlow as wr, useUpdateNodeInternals as Oo, useStoreApi as yd, useInternalNode as xd, ViewportPortal as vd, Background as wd, BackgroundVariant as zs, useNodesState as Ya, useEdgesState as Ja, applyNodeChanges as Xa, ReactFlow as Za, Controls as ec, ReactFlowProvider as tc } from "@xyflow/react";
6
- import { V as Nd, C as gt, W as io, X as nc, Y as rc, Z as sc, _ as oc, $ as bs, D as ic, S as Id, T as Sd, a0 as Cd, a1 as Td, a2 as Ed, A as kd, B as Li, a3 as Bd, a4 as Od, a5 as Ad, a6 as qd, b as Dd, a as Ao, R as Rd, a7 as Fd, M as Ld, x as ac, a8 as Pd, a9 as Mr, aa as cc, ab as Pi, H as Md, ac as _d, ad as jd, c as Us, t as $d, ae as it, af as zd, F as cr, ag as Ud, ah as Mi, ai as Gd, aj as Hd, ak as Qd, al as _i, am as ji, an as lc, o as Vd, m as Wd, ao as $i, E as zi, e as Ui, s as Kd, f as Yd, n as Jd, l as Gi, h as Xd, u as Zd, i as eu, g as tu, ap as Hi, aq as Gs, ar as Hs, as as Qi, at as nu, d as ru } from "./params-MMOdKWnW.js";
7
- import { t as su, d as dc, a as ou, s as uc, i as hc, b as iu } from "./calendarDate-CYlr9TvX.js";
8
- import { t as rs, R as pc, a as au, D as Vi, r as cu, d as lu } from "./tokens-DV5rTGMj.js";
9
- import { D as Hn, H as Qt, F as ys, t as Tt, k as Ve, K as fc, E as mc, c as du, R as uu, S as hu, n as Jt, y as In, T as pu, M as Nr, p as gc, U as bc, N as fu, O as mu, V as yc, i as ao, q as Wr, u as gu, W as xc, o as vc, r as bu, a as yu, f as xu, z as vu, v as wu, h as ss, X as Wi, Y as Nu, C as Iu, b as Su } from "./schema-dP_ISylQ.js";
10
- import { o as Ki, p as wc, k as Yi, q as Cu, t as Tu, n as Nc, v as Eu, e as ku, d as Bu, a as Ou, u as Au, r as qu, c as Du, b as Ru, m as Fu, j as Lu } from "./issueLocation-BOSdd1JX.js";
4
+ import { NavArrowDownSolid as Nt, Trash as ft, Plus as Gn, DatabaseScript as Co, EditPencil as hd, Xmark as To, Expand as $n, NavArrowUpSolid as kt, NetworkLeft as Eo, MinusSquare as gs, PlusCircleSolid as jt, CheckSquareSolid as Va, Square as Wa, WarningTriangle as ko, KeyframesPlus as pd, Collapse as fd, MinusSquareDashed as md, Search as gd, XmarkCircleSolid as Ka, DashboardSpeed as Bo, Play as bd } from "iconoir-react";
5
+ import { useNodeId as yd, useStore as ns, Position as Te, Handle as Ee, useReactFlow as wr, useUpdateNodeInternals as Oo, useStoreApi as xd, useInternalNode as vd, ViewportPortal as wd, Background as Nd, BackgroundVariant as zs, useNodesState as Ya, useEdgesState as Ja, applyNodeChanges as Xa, ReactFlow as Za, Controls as ec, ReactFlowProvider as tc } from "@xyflow/react";
6
+ import { V as Id, C as gt, W as io, X as nc, Y as rc, Z as sc, _ as oc, $ as bs, D as ic, S as Sd, T as Cd, a0 as Td, a1 as Ed, a2 as kd, z as Bd, A as Li, a3 as Od, a4 as Ad, a5 as qd, a6 as Dd, b as Rd, a as Ao, R as Fd, a7 as Ld, M as Pd, w as ac, a8 as Md, a9 as Mr, aa as cc, ab as Pi, H as _d, ac as jd, ad as $d, c as Us, p as zd, ae as it, af as Ud, F as cr, ag as Gd, ah as Mi, ai as Hd, aj as Qd, ak as Vd, al as _i, am as ji, an as lc, n as Wd, m as Kd, ao as $i, E as zi, e as Ui, s as Yd, f as Jd, l as Xd, j as Gi, h as Zd, u as eu, r as tu, g as nu, ap as Hi, aq as Gs, ar as Hs, as as Qi, at as ru, d as su } from "./params-kc6eNrpu.js";
7
+ import { t as ou, d as dc, a as iu, s as uc, i as hc, b as au } from "./calendarDate-CYlr9TvX.js";
8
+ import { t as rs, R as pc, a as cu, D as Vi, r as lu, d as du } from "./tokens-DV5rTGMj.js";
9
+ import { D as Hn, I as Qt, G as ys, t as Tt, j as Ve, L as fc, r as mc, E as gc, c as uu, S as hu, T as pu, l as Jt, z as In, U as fu, M as Nr, p as bc, V as yc, O as mu, W as xc, i as ao, q as Wr, u as gu, X as vc, n as wc, o as bu, y as yu, f as xu, A as vu, v as wu, h as ss, Y as Wi, Z as Nu, F as Iu, b as Su } from "./schema-KDJ1rpG5.js";
10
+ import { o as Ki, p as Nc, k as Yi, q as Cu, t as Tu, n as Ic, v as Eu, e as ku, d as Bu, a as Ou, u as Au, r as qu, c as Du, b as Ru, m as Fu, j as Lu } from "./issueLocation-Y1iaP_Cs.js";
11
11
  import { createPortal as Pu } from "react-dom";
12
12
  const qo = _e(!1);
13
13
  function We() {
14
14
  return Re(qo);
15
15
  }
16
- const Ic = _e(null);
16
+ const Sc = _e(null);
17
17
  function Bt() {
18
- const e = Re(Ic);
18
+ const e = Re(Sc);
19
19
  if (!e)
20
20
  throw new Error(
21
21
  "Query builder UI components are missing: render editor components inside PipelineEditor, or provide a UI kit through UIContext."
22
22
  );
23
23
  return e;
24
24
  }
25
- const Sc = { "data-qb-edit": "" }, Tn = (e) => ["nodrag nopan", e].filter(Boolean).join(" "), Z = (e) => {
25
+ const Cc = { "data-qb-edit": "" }, Tn = (e) => ["nodrag nopan", e].filter(Boolean).join(" "), Z = (e) => {
26
26
  const { Tooltip: t } = Bt();
27
27
  return /* @__PURE__ */ o(t, { ...e });
28
28
  }, U = So(
@@ -34,14 +34,14 @@ const Sc = { "data-qb-edit": "" }, Tn = (e) => ["nodrag nopan", e].filter(Boolea
34
34
  ...t,
35
35
  ref: n,
36
36
  className: Tn(t.className),
37
- ...e ? {} : Sc
37
+ ...e ? {} : Cc
38
38
  }
39
39
  );
40
40
  }
41
41
  ), vt = So(
42
42
  ({ showsValue: e, pressed: t, ...n }, r) => {
43
43
  const { Button: s } = Bt(), i = { ...n, ref: r, className: Tn(n.className) }, a = t === void 0 ? i : { ...i, "aria-pressed": t }, c = We();
44
- if (!e) return /* @__PURE__ */ o(s, { ...a, ...Sc });
44
+ if (!e) return /* @__PURE__ */ o(s, { ...a, ...Cc });
45
45
  if (!c) return /* @__PURE__ */ o(s, { ...a });
46
46
  const l = [a.className, "pointer-events-none"].filter(Boolean).join(" ");
47
47
  return /* @__PURE__ */ o(s, { ...a, onClick: void 0, className: l });
@@ -59,7 +59,7 @@ function hn(e) {
59
59
  t,
60
60
  {
61
61
  ...e,
62
- maxLength: e.maxLength ?? Nd,
62
+ maxLength: e.maxLength ?? Id,
63
63
  className: Tn(e.className),
64
64
  disabled: e.disabled || n
65
65
  }
@@ -83,7 +83,7 @@ const zn = (e) => {
83
83
  value: e.value ? dc(e.value) : "",
84
84
  onChange: (i) => {
85
85
  var a;
86
- return (a = e.onChange) == null ? void 0 : a.call(e, ou(i));
86
+ return (a = e.onChange) == null ? void 0 : a.call(e, iu(i));
87
87
  }
88
88
  }
89
89
  );
@@ -100,7 +100,7 @@ const zn = (e) => {
100
100
  value: ((i = e.value) == null ? void 0 : i.replace(/:00$/, "")) ?? "",
101
101
  onChange: (a) => {
102
102
  var c;
103
- return (c = e.onChange) == null ? void 0 : c.call(e, su(a));
103
+ return (c = e.onChange) == null ? void 0 : c.call(e, ou(a));
104
104
  }
105
105
  }
106
106
  );
@@ -231,17 +231,17 @@ function ut(e, t, n) {
231
231
  return e;
232
232
  }
233
233
  }
234
- function Cc(e, t) {
234
+ function Tc(e, t) {
235
235
  if (typeof e == "number" || typeof t == "number") return e === t;
236
236
  if (e.kind !== t.kind) return !1;
237
237
  const n = "index" in e ? e.index : void 0, r = "index" in t ? t.index : void 0;
238
238
  return n === r;
239
239
  }
240
240
  function Dn(e, t) {
241
- return e.length === t.length && e.every((n, r) => Cc(n, t[r]));
241
+ return e.length === t.length && e.every((n, r) => Tc(n, t[r]));
242
242
  }
243
243
  function _r(e, t) {
244
- return t.length < e.length ? !1 : e.every((n, r) => Cc(n, t[r]));
244
+ return t.length < e.length ? !1 : e.every((n, r) => Tc(n, t[r]));
245
245
  }
246
246
  function lr(e, t, n) {
247
247
  const r = Ct(e, t);
@@ -338,7 +338,7 @@ function jr(e, t) {
338
338
  }), n;
339
339
  }
340
340
  const Fo = (e, t) => JSON.stringify(e ?? []) === JSON.stringify(t ?? []);
341
- function Tc(e, t) {
341
+ function Ec(e, t) {
342
342
  var r, s;
343
343
  if ("selectId" in t) {
344
344
  const i = e == null ? void 0 : e.select.find((a) => a.id === t.selectId);
@@ -351,11 +351,11 @@ function Tc(e, t) {
351
351
  const n = (s = e == null ? void 0 : e.orderBy) == null ? void 0 : s.find((i) => i.id === t.orderById);
352
352
  return n && { scopeRoot: t, expression: n.expression, label: oc() };
353
353
  }
354
- function Ec(e, t) {
354
+ function kc(e, t) {
355
355
  const n = e == null ? void 0 : e.joins.find((r) => r.id === t.joinId);
356
356
  return n && { condition: n.on, label: nc(n) };
357
357
  }
358
- function kc(e) {
358
+ function Bc(e) {
359
359
  return e.scope === "select" ? { selectId: e.selectId } : e.scope === "groupBy" ? { groupById: e.groupById } : { orderById: e.orderById };
360
360
  }
361
361
  const Qs = (e, t) => e !== void 0 && JSON.stringify(e) === JSON.stringify(t);
@@ -387,7 +387,7 @@ function Ji(e, t) {
387
387
  if (t.scope === "having")
388
388
  return jr(e == null ? void 0 : e.having, t.path).map((a) => ({ ...a, scopeRoot: { having: !0 } }));
389
389
  if (t.scope === "select" || t.scope === "orderBy" || t.scope === "groupBy") {
390
- const a = Tc(e, kc(t));
390
+ const a = Ec(e, Bc(t));
391
391
  if (!a) return [];
392
392
  const c = jr(a.expression, t.path).map((d) => ({ ...d, scopeRoot: a.scopeRoot })), { type: l } = a.expression;
393
393
  return l !== "function" && !Do.has(l) ? c : [{
@@ -397,12 +397,12 @@ function Ji(e, t) {
397
397
  mode: l === "function" ? "expression" : void 0
398
398
  }, ...c];
399
399
  }
400
- const n = { joinId: t.joinId }, r = Ec(e, n);
400
+ const n = { joinId: t.joinId }, r = kc(e, n);
401
401
  if (!r) return [];
402
402
  const s = { path: Ze, label: r.label, scopeRoot: n }, i = jr(r.condition, t.path).map((a) => ({ ...a, scopeRoot: n }));
403
403
  return [s, ...i];
404
404
  }
405
- function Bc(e, t) {
405
+ function Oc(e, t) {
406
406
  return t.flatMap((n, r) => {
407
407
  const s = gt(e, t.slice(0, r)), i = s && io(s, n);
408
408
  return i ? [{
@@ -418,14 +418,14 @@ function Xi(e, t) {
418
418
  if (n.length === 0) return Ji(e, t);
419
419
  const r = gt(e, n);
420
420
  return r ? [
421
- ...Bc(e, n),
421
+ ...Oc(e, n),
422
422
  ...Ji(r, t).map((s) => ({ ...s, queryPath: n }))
423
423
  ] : [];
424
424
  }
425
425
  function Qu(e, t) {
426
426
  if (t.scope === "structural") return !0;
427
427
  const n = e.length > 0 ? e[e.length - 1] : void 0;
428
- return t.scope === "where" ? n != null && n.scopeRoot ? !1 : _r(n ? n.path : Ze, t.path) : t.scope === "having" ? n && !Qs(n.scopeRoot, { having: !0 }) ? !1 : _r(n ? n.path : Ze, t.path) : t.scope === "select" || t.scope === "orderBy" || t.scope === "groupBy" ? n && Qs(n.scopeRoot, kc(t)) ? _r(n.path, t.path) : e.length === 0 && t.path.length === 0 : !n || !Qs(n.scopeRoot, { joinId: t.joinId }) ? !1 : _r(n.path, t.path);
428
+ return t.scope === "where" ? n != null && n.scopeRoot ? !1 : _r(n ? n.path : Ze, t.path) : t.scope === "having" ? n && !Qs(n.scopeRoot, { having: !0 }) ? !1 : _r(n ? n.path : Ze, t.path) : t.scope === "select" || t.scope === "orderBy" || t.scope === "groupBy" ? n && Qs(n.scopeRoot, Bc(t)) ? _r(n.path, t.path) : e.length === 0 && t.path.length === 0 : !n || !Qs(n.scopeRoot, { joinId: t.joinId }) ? !1 : _r(n.path, t.path);
429
429
  }
430
430
  function Vu(e, t) {
431
431
  const n = e[e.length - 1];
@@ -445,11 +445,11 @@ function Vs(e, t) {
445
445
  if (i && "having" in i)
446
446
  return !lr(s == null ? void 0 : s.having, r.path, r.mode);
447
447
  if (i && "joinId" in i) {
448
- const a = Ec(s, i);
448
+ const a = kc(s, i);
449
449
  return a ? r.path.length === 0 ? !1 : !lr(a.condition, r.path, r.mode) : !0;
450
450
  }
451
451
  if (i) {
452
- const a = Tc(s, i);
452
+ const a = Ec(s, i);
453
453
  return a ? !lr(a.expression, r.path, r.mode) : !0;
454
454
  }
455
455
  return !lr(s == null ? void 0 : s.where, r.path, r.mode);
@@ -770,7 +770,7 @@ function Kr(e, t, n, r, s, i, a = !1, c = t.length === 0) {
770
770
  draggable: t.length > 0
771
771
  }), l);
772
772
  }
773
- function Oc(e, t, n = !1, r = !1, s = Ke) {
773
+ function Ac(e, t, n = !1, r = !1, s = Ke) {
774
774
  const i = { nodes: [], edges: [] };
775
775
  return Kr(e, [], 1, t, i, n, r), { nodes: xs(i.nodes, s), edges: i.edges };
776
776
  }
@@ -980,7 +980,7 @@ function co(e, t, n, r, s, i, a = !1, c = 0) {
980
980
  );
981
981
  }));
982
982
  }
983
- function Ac(e, t, n, r = !1, s = Ke) {
983
+ function qc(e, t, n, r = !1, s = Ke) {
984
984
  const i = /* @__PURE__ */ new Map();
985
985
  t.forEach((u) => {
986
986
  var f, g;
@@ -1111,10 +1111,10 @@ function lo(e, t, n, r) {
1111
1111
  operands: e.operands.map((a, c) => c === s ? lo(a, i, n, r) : a)
1112
1112
  } : e.type === "not" && s === 0 ? { ...e, operand: lo(e.operand, i, n, r) } : e;
1113
1113
  }
1114
- function qc(e, t) {
1114
+ function Dc(e, t) {
1115
1115
  if (t.length === 0) return t;
1116
1116
  const n = xr(e, t.slice(0, -1));
1117
- return n && (n.type === "logical" && n.operands.length === 1 || n.type === "not") ? qc(e, t.slice(0, -1)) : t;
1117
+ return n && (n.type === "logical" && n.operands.length === 1 || n.type === "not") ? Dc(e, t.slice(0, -1)) : t;
1118
1118
  }
1119
1119
  function ph(e, t) {
1120
1120
  const n = t.slice(0, -1), r = t[t.length - 1];
@@ -1138,12 +1138,12 @@ function uo(e) {
1138
1138
  }
1139
1139
  return e;
1140
1140
  }
1141
- function Dc(e, t, n, r) {
1141
+ function Rc(e, t, n, r) {
1142
1142
  const s = xr(e, t);
1143
1143
  if (!s) return e;
1144
1144
  const i = xr(e, n);
1145
1145
  if (!i || i.type !== "logical") return e;
1146
- const a = qc(e, t), c = ph(n, a), l = t.slice(0, -1), h = t[t.length - 1], p = l.length === n.length && l.every((g, y) => g === n[y]) && r > h ? r - 1 : r, u = yr(e, t, void 0);
1146
+ const a = Dc(e, t), c = ph(n, a), l = t.slice(0, -1), h = t[t.length - 1], p = l.length === n.length && l.every((g, y) => g === n[y]) && r > h ? r - 1 : r, u = yr(e, t, void 0);
1147
1147
  if (!u) return e;
1148
1148
  const f = lo(u, c, p, s);
1149
1149
  return uo(f) ?? e;
@@ -1170,37 +1170,37 @@ function zt(e, t, n) {
1170
1170
  operands: e.operands.map((i, a) => a === r ? zt(i, s, n) : i)
1171
1171
  } : e.type === "not" && r === 0 ? { ...e, operand: zt(e.operand, s, n) } : e;
1172
1172
  }
1173
- function Rc(e, t) {
1173
+ function Fc(e, t) {
1174
1174
  return zt(e, t, (n) => n.type !== "case" ? n : { ...n, branches: [...n.branches, fh()] });
1175
1175
  }
1176
- function Fc(e, t, n) {
1176
+ function Lc(e, t, n) {
1177
1177
  return zt(e, t, (r) => {
1178
1178
  if (r.type !== "case") return r;
1179
1179
  const s = r.branches.filter((i, a) => a !== n);
1180
1180
  return s.length === 0 ? r : { ...r, branches: s };
1181
1181
  });
1182
1182
  }
1183
- function Lc(e, t, n, r) {
1183
+ function Pc(e, t, n, r) {
1184
1184
  return zt(e, t, (s) => {
1185
1185
  if (s.type !== "case") return s;
1186
1186
  const i = [...s.branches], a = r === "up" ? n - 1 : n + 1;
1187
1187
  return a < 0 || a >= i.length ? s : ([i[n], i[a]] = [i[a], i[n]], { ...s, branches: i });
1188
1188
  });
1189
1189
  }
1190
- function Pc(e, t, n, r) {
1190
+ function Mc(e, t, n, r) {
1191
1191
  return zt(e, t, (s) => {
1192
1192
  if (s.type !== "case") return s;
1193
1193
  const i = [...s.branches], [a] = i.splice(n, 1);
1194
1194
  return i.splice(r, 0, a), { ...s, branches: i };
1195
1195
  });
1196
1196
  }
1197
- function Mc(e, t, n, r) {
1197
+ function _c(e, t, n, r) {
1198
1198
  return zt(e, t, (s) => s.type !== "case" ? s : {
1199
1199
  ...s,
1200
1200
  branches: s.branches.map((i, a) => a === n ? r : i)
1201
1201
  });
1202
1202
  }
1203
- function _c(e, t, n) {
1203
+ function jc(e, t, n) {
1204
1204
  return zt(e, t, (r) => r.type !== "case" ? r : { ...r, else: n });
1205
1205
  }
1206
1206
  function mh(e, t, n) {
@@ -1258,19 +1258,19 @@ function ho(e, t) {
1258
1258
  case "wrapRoot":
1259
1259
  return { type: "logical", operator: "AND", operands: [e] };
1260
1260
  case "crossMove":
1261
- return Dc(e, t.sourcePath, t.targetParentPath, t.targetIndex);
1261
+ return Rc(e, t.sourcePath, t.targetParentPath, t.targetIndex);
1262
1262
  case "addBranch":
1263
- return Rc(e, t.path);
1263
+ return Fc(e, t.path);
1264
1264
  case "removeBranch":
1265
- return Fc(e, t.path, t.index);
1265
+ return Lc(e, t.path, t.index);
1266
1266
  case "reorderBranch":
1267
- return Lc(e, t.path, t.index, t.direction);
1267
+ return Pc(e, t.path, t.index, t.direction);
1268
1268
  case "moveBranch":
1269
- return Pc(e, t.casePath, t.fromIndex, t.toIndex);
1269
+ return Mc(e, t.casePath, t.fromIndex, t.toIndex);
1270
1270
  case "changeBranch":
1271
- return Mc(e, t.path, t.index, t.branch);
1271
+ return _c(e, t.path, t.index, t.branch);
1272
1272
  case "changeCaseElse":
1273
- return _c(e, t.path, t.else);
1273
+ return jc(e, t.path, t.else);
1274
1274
  case "changeIfCondition":
1275
1275
  return mh(e, t.path, t.condition);
1276
1276
  case "changeIfThen":
@@ -1396,7 +1396,7 @@ function wh(e) {
1396
1396
  return [Un(i), Ss(i)];
1397
1397
  })];
1398
1398
  }
1399
- function jc(e, t, n, r, s, i, a = Hn) {
1399
+ function $c(e, t, n, r, s, i, a = Hn) {
1400
1400
  if (e.type === "function") {
1401
1401
  const u = Un(t);
1402
1402
  r.nodes.push({
@@ -1413,7 +1413,7 @@ function jc(e, t, n, r, s, i, a = Hn) {
1413
1413
  });
1414
1414
  const f = Qt(e.name, a);
1415
1415
  return e.args.forEach((g, y) => {
1416
- const v = e.args.length, m = [...t, y], b = jc(g, m, n, r, f, v, a);
1416
+ const v = e.args.length, m = [...t, y], b = $c(g, m, n, r, f, v, a);
1417
1417
  r.edges.push({
1418
1418
  id: `${b}->${u}:arg-${y}`,
1419
1419
  source: b,
@@ -1445,7 +1445,7 @@ function jc(e, t, n, r, s, i, a = Hn) {
1445
1445
  }
1446
1446
  function Nh(e, t, n = Hn, r = Ke) {
1447
1447
  const s = { nodes: [], edges: [] };
1448
- return e.type === "function" && jc(e, [], t, s, void 0, void 0, n), { nodes: xs(s.nodes, r), edges: s.edges };
1448
+ return e.type === "function" && $c(e, [], t, s, void 0, void 0, n), { nodes: xs(s.nodes, r), edges: s.edges };
1449
1449
  }
1450
1450
  const Ih = 140, Sh = 90, Ch = 240, Th = 52;
1451
1451
  function Eh(e, t) {
@@ -1454,7 +1454,7 @@ function Eh(e, t) {
1454
1454
  function kh(e, t) {
1455
1455
  return t.get(e) ?? { width: Ch, height: Th };
1456
1456
  }
1457
- function $c(e, t, n, r = Ke) {
1457
+ function zc(e, t, n, r = Ke) {
1458
1458
  if (e.type === "function") {
1459
1459
  const a = Un(t), c = Eh(a, n);
1460
1460
  if (e.args.length === 0)
@@ -1464,7 +1464,7 @@ function $c(e, t, n, r = Ke) {
1464
1464
  nodeOffsetX: 0,
1465
1465
  nodeOffsetY: 0
1466
1466
  };
1467
- const l = e.args.map((h, d) => $c(h, [...t, d], n, r));
1467
+ const l = e.args.map((h, d) => zc(h, [...t, d], n, r));
1468
1468
  return dr(c, l, r);
1469
1469
  }
1470
1470
  const s = Ss(t), i = kh(s, n);
@@ -1475,19 +1475,19 @@ function $c(e, t, n, r = Ke) {
1475
1475
  nodeOffsetY: 0
1476
1476
  };
1477
1477
  }
1478
- function zc(e, t, n, r, s, i) {
1478
+ function Uc(e, t, n, r, s, i) {
1479
1479
  if (e.type === "function") {
1480
1480
  const c = Un(t);
1481
1481
  i.set(c, { x: r + n.nodeOffsetX, y: s + n.nodeOffsetY }), n.childBoxes && n.childOffsets && e.args.forEach((l, h) => {
1482
1482
  const d = n.childOffsets[h], p = n.childBoxes[h], u = r + d.x, f = s + d.y;
1483
- zc(l, [...t, h], p, u, f, i);
1483
+ Uc(l, [...t, h], p, u, f, i);
1484
1484
  });
1485
1485
  return;
1486
1486
  }
1487
1487
  const a = Ss(t);
1488
1488
  i.set(a, { x: r + n.nodeOffsetX, y: s + n.nodeOffsetY });
1489
1489
  }
1490
- function Uc(e, t, n, r, s, i) {
1490
+ function Gc(e, t, n, r, s, i) {
1491
1491
  if (e.type !== "function" || e.args.length === 0) return;
1492
1492
  const a = t.length;
1493
1493
  i.push({
@@ -1511,7 +1511,7 @@ function Uc(e, t, n, r, s, i) {
1511
1511
  zIndex: a - 10
1512
1512
  }), n.childBoxes && n.childOffsets && e.args.forEach((c, l) => {
1513
1513
  const h = n.childOffsets[l], d = n.childBoxes[l], p = r + h.x, u = s + h.y;
1514
- Uc(c, [...t, l], d, p, u, i);
1514
+ Gc(c, [...t, l], d, p, u, i);
1515
1515
  });
1516
1516
  }
1517
1517
  function na(e, t, n, r = Ke) {
@@ -1521,10 +1521,10 @@ function na(e, t, n, r = Ke) {
1521
1521
  var u, f;
1522
1522
  p.type !== "groupBg" && (u = p.measured) != null && u.width && (f = p.measured) != null && f.height && s.set(p.id, { width: p.measured.width, height: p.measured.height });
1523
1523
  });
1524
- const i = $c(n, [], s, r), a = /* @__PURE__ */ new Map();
1525
- zc(n, [], i, 0, 0, a);
1524
+ const i = zc(n, [], s, r), a = /* @__PURE__ */ new Map();
1525
+ Uc(n, [], i, 0, 0, a);
1526
1526
  const c = [];
1527
- Uc(n, [], i, 0, 0, c);
1527
+ Gc(n, [], i, 0, 0, c);
1528
1528
  const l = xs(c, r), h = new Map(t.filter((p) => p.type !== "groupBg").map((p) => [p.id, p])), d = e.map((p) => {
1529
1529
  const u = h.get(p.id);
1530
1530
  return {
@@ -1547,7 +1547,7 @@ function Bh(e, t) {
1547
1547
  for (; t.has(`${e}_${n}`); ) n += 1;
1548
1548
  return `${e}_${n}`;
1549
1549
  }
1550
- const Gc = (e, t, n) => {
1550
+ const Hc = (e, t, n) => {
1551
1551
  var r, s;
1552
1552
  return ((s = (r = Ve(e, t)) == null ? void 0 : r.columns.find((i) => i.name === n)) == null ? void 0 : s.label) ?? n;
1553
1553
  };
@@ -1573,7 +1573,7 @@ function sa(e, t, n = "toMany", r = []) {
1573
1573
  right: ra(Tt(d), y)
1574
1574
  }
1575
1575
  }
1576
- }), a.push(Gc(e, l.fromTable, l.fromColumn));
1576
+ }), a.push(Hc(e, l.fromTable, l.fromColumn));
1577
1577
  });
1578
1578
  });
1579
1579
  });
@@ -1594,7 +1594,7 @@ function Oh(e, t, n = []) {
1594
1594
  const u = ((g = n.find((v) => v.ref === d.table)) == null ? void 0 : g.table.name) ?? d.table, f = e.relations.find((v) => v.fromTable === p && v.fromColumn === h.column && v.toTable === u && v.toColumn === d.column) ? [p, h.column] : [u, d.column];
1595
1595
  return {
1596
1596
  table: ((y = Ve(e, u)) == null ? void 0 : y.label) ?? d.table,
1597
- via: Gc(e, f[0], f[1])
1597
+ via: Hc(e, f[0], f[1])
1598
1598
  };
1599
1599
  }
1600
1600
  function oa(e, t) {
@@ -1604,14 +1604,7 @@ function oa(e, t) {
1604
1604
  });
1605
1605
  }
1606
1606
  function Ah(e, t, n) {
1607
- const r = oa(e, [t.from, ...t.joins]), s = /* @__PURE__ */ new Set([...r.map((c) => c.table.name), ...fc(t)]), i = r.map((c) => c.table.name), a = [];
1608
- for (; i.length > 0; ) {
1609
- const c = i.shift();
1610
- e.relations.forEach((l) => {
1611
- const h = l.fromTable === c ? l.toTable : l.fromTable;
1612
- l.fromTable !== c && l.toTable !== c || s.has(h) || (s.add(h), !n.has(h) && (i.push(h), a.push(h)));
1613
- });
1614
- }
1607
+ const r = oa(e, [t.from, ...t.joins]), s = r.map((c) => c.table.name), i = /* @__PURE__ */ new Set([...n, ...fc(t)]), a = [...mc(e, s, { skip: i })].filter((c) => !s.includes(c));
1615
1608
  return [...r, ...oa(e, a.map((c) => ({ table: c })))];
1616
1609
  }
1617
1610
  function qh(e, t, n) {
@@ -1626,12 +1619,12 @@ const ds = _e(null);
1626
1619
  function Dh() {
1627
1620
  return Re(ds);
1628
1621
  }
1629
- const Hc = _e(void 0);
1622
+ const Qc = _e(void 0);
1630
1623
  function Po() {
1631
- return Re(Hc);
1624
+ return Re(Qc);
1632
1625
  }
1633
1626
  const po = _e([]);
1634
- function Qc() {
1627
+ function Vc() {
1635
1628
  return Re(po);
1636
1629
  }
1637
1630
  const fo = _e(void 0);
@@ -1643,13 +1636,13 @@ function Fh() {
1643
1636
  return Re(mo);
1644
1637
  }
1645
1638
  const Qn = _e(void 0);
1646
- function Vc(e) {
1639
+ function Wc(e) {
1647
1640
  const t = Re(Qn), { fromSelect: n } = e;
1648
1641
  if (typeof n == "string")
1649
1642
  return t == null ? void 0 : t.columns.find((r) => r.id === n);
1650
1643
  }
1651
1644
  const go = _e(void 0);
1652
- function Wc() {
1645
+ function Kc() {
1653
1646
  return Re(go);
1654
1647
  }
1655
1648
  function xt(e, t = 0) {
@@ -1755,13 +1748,13 @@ function ia(e, t) {
1755
1748
  const l = ur(c.expression, i);
1756
1749
  return n === "select" ? { scope: "select", selectId: c.id, path: l } : n === "orderBy" ? { scope: "orderBy", orderById: c.id, path: l } : { scope: "groupBy", groupById: c.id, path: l };
1757
1750
  }
1758
- function Kc(e, t) {
1751
+ function Yc(e, t) {
1759
1752
  const { queryPath: n, local: r } = Mo(e, t);
1760
1753
  return n.length === 0 ? ia(e, t) : { ...ia(gt(e, n), r), queryPath: n };
1761
1754
  }
1762
- function Yc(e, t) {
1755
+ function Jc(e, t) {
1763
1756
  if (!e || t.length === 0) return [];
1764
- const [n, ...r] = t, s = (i, a) => a ? [...i, ...Yc(a, r)] : [];
1757
+ const [n, ...r] = t, s = (i, a) => a ? [...i, ...Jc(a, r)] : [];
1765
1758
  if (typeof n == "number")
1766
1759
  return e.type === "logical" ? s(["operands", n], e.operands[n]) : e.type === "not" ? s(["operand"], e.operand) : [];
1767
1760
  switch (n.kind) {
@@ -1834,65 +1827,65 @@ function Ph(e, t) {
1834
1827
  })();
1835
1828
  if (!a || t.scope === "structural") return;
1836
1829
  const [c, l] = a;
1837
- return [...r, ...c, ...Yc(l, t.path)];
1830
+ return [...r, ...c, ...Jc(l, t.path)];
1838
1831
  }
1839
- const Jc = _e(mc);
1832
+ const Xc = _e(gc);
1840
1833
  function qt() {
1841
- return Re(Jc);
1842
- }
1843
- const Xc = _e(Ke);
1844
- function jo() {
1845
1834
  return Re(Xc);
1846
1835
  }
1847
- const Zc = _e(Lo);
1848
- function el() {
1836
+ const Zc = _e(Ke);
1837
+ function jo() {
1849
1838
  return Re(Zc);
1850
1839
  }
1851
- const tl = {
1840
+ const el = _e(Lo);
1841
+ function tl() {
1842
+ return Re(el);
1843
+ }
1844
+ const nl = {
1852
1845
  edges: "bezier",
1853
1846
  background: "dots",
1854
1847
  backgroundGap: 20,
1855
1848
  groupFrame: "box",
1856
1849
  actions: "always"
1857
- }, nl = _e(tl);
1850
+ }, rl = _e(nl);
1858
1851
  function Cs() {
1859
- return Re(nl);
1852
+ return Re(rl);
1860
1853
  }
1861
- function rl() {
1854
+ function sl() {
1862
1855
  const { edges: e } = Cs();
1863
1856
  return we(() => ({ type: e === "bezier" ? "default" : e }), [e]);
1864
1857
  }
1865
- const sl = _e({});
1858
+ const ol = _e({});
1866
1859
  function Mh() {
1867
- return Re(sl);
1860
+ return Re(ol);
1868
1861
  }
1869
- const ol = _e("never");
1862
+ const il = _e("never");
1870
1863
  function _h() {
1871
- return Re(ol);
1864
+ return Re(il);
1872
1865
  }
1873
- const il = _e(void 0);
1866
+ const al = _e(void 0);
1874
1867
  function Ts() {
1875
- return Re(il);
1868
+ return Re(al);
1876
1869
  }
1877
- const al = _e(ic);
1870
+ const cl = _e(ic);
1878
1871
  function fe() {
1879
- return Re(al);
1872
+ return Re(cl);
1880
1873
  }
1881
- const cl = _e(Hn), Vn = _e(!1);
1874
+ const ll = _e(Hn), Vn = _e(!1);
1882
1875
  function Dt() {
1883
- return Re(cl);
1876
+ return Re(ll);
1884
1877
  }
1885
1878
  function $o() {
1886
1879
  const e = Dt(), t = Re(Vn), n = Ts();
1887
1880
  return we(() => {
1888
- const r = n ? du(e, n) : e;
1889
- return t ? r : uu(r);
1881
+ const r = n ? uu(e, n) : e;
1882
+ return t ? r : hu(r);
1890
1883
  }, [e, t, n]);
1891
1884
  }
1892
- function ll() {
1885
+ function dl() {
1893
1886
  const e = $o(), t = fe();
1894
1887
  return we(() => {
1895
- const n = hu(e), r = (i) => {
1888
+ const n = pu(e), r = (i) => {
1896
1889
  var a;
1897
1890
  return [i, ...((a = e[i.toUpperCase()]) == null ? void 0 : a.aliases) ?? []].join(" ");
1898
1891
  }, s = n.filter((i) => e[i].aggregate);
@@ -1906,9 +1899,9 @@ function ll() {
1906
1899
  };
1907
1900
  }, [e, t]);
1908
1901
  }
1909
- const Es = _e(!1), dl = _e(void 0);
1910
- function ul() {
1911
- return Re(dl);
1902
+ const Es = _e(!1), ul = _e(void 0);
1903
+ function hl() {
1904
+ return Re(ul);
1912
1905
  }
1913
1906
  const jh = ["SUM", "AVG", "MIN", "MAX"], $h = ({ anchor: e, choice: t, onClose: n }) => {
1914
1907
  const r = fe(), s = qt(), [i] = Se(t.facts), [a, c] = Se(null), l = (u) => {
@@ -1965,8 +1958,8 @@ const jh = ["SUM", "AVG", "MIN", "MAX"], $h = ({ anchor: e, choice: t, onClose:
1965
1958
  }
1966
1959
  );
1967
1960
  };
1968
- function hl() {
1969
- const e = qt(), t = Po(), n = Qc();
1961
+ function pl() {
1962
+ const e = qt(), t = Po(), n = Vc();
1970
1963
  return M((r) => {
1971
1964
  var a;
1972
1965
  if ((r == null ? void 0 : r.type) !== "field" || !r.table || !r.column) return;
@@ -1974,11 +1967,11 @@ function hl() {
1974
1967
  return s && i ? { table: s, column: i } : void 0;
1975
1968
  }, [e, t, n]);
1976
1969
  }
1977
- function pl() {
1978
- const e = hl(), t = Dt();
1979
- return M((n) => Id(n, (r) => {
1970
+ function fl() {
1971
+ const e = pl(), t = Dt();
1972
+ return M((n) => Sd(n, (r) => {
1980
1973
  const s = e(r);
1981
- return s && Sd(s.column.type);
1974
+ return s && Cd(s.column.type);
1982
1975
  }, t), [e, t]);
1983
1976
  }
1984
1977
  const aa = (e) => ({
@@ -2085,13 +2078,13 @@ const Et = ({
2085
2078
  allowNull: l = !1,
2086
2079
  relativeDate: h = !1
2087
2080
  }) => {
2088
- const d = fe(), p = pl(), u = We(), [f, g] = Se(null), [y, v] = Se(null), m = Vc(e) ? "field" : Uh(e), b = u || r, N = a && m === "literal" && e.type === "literal" ? Cd(e) ?? "text" : void 0, B = {
2081
+ const d = fe(), p = fl(), u = We(), [f, g] = Se(null), [y, v] = Se(null), m = Wc(e) ? "field" : Uh(e), b = u || r, N = a && m === "literal" && e.type === "literal" ? Td(e) ?? "text" : void 0, B = {
2089
2082
  text: d.typeText,
2090
2083
  number: d.typeNumber,
2091
2084
  date: d.typeDate,
2092
2085
  boolean: d.typeBoolean
2093
2086
  }, O = (D) => {
2094
- g(null), t == null || t(Ed(e, D));
2087
+ g(null), t == null || t(kd(e, D));
2095
2088
  }, z = (D) => {
2096
2089
  g(null), D !== m && (t == null || t(Gh(e, D, p)));
2097
2090
  };
@@ -2127,7 +2120,7 @@ const Et = ({
2127
2120
  sections: [
2128
2121
  ...(c ? [{ title: d.typeMenuBasic, types: ["list"] }] : zh(d)).map(({ title: D, types: T }) => ({
2129
2122
  title: D,
2130
- items: T.filter((A) => !n.includes(A)).filter((A) => A !== "null" || l).filter((A) => A !== "relative" || h).flatMap((A) => A === "literal" && a ? Td.map((G) => ({
2123
+ items: T.filter((A) => !n.includes(A)).filter((A) => A !== "null" || l).filter((A) => A !== "relative" || h).flatMap((A) => A === "literal" && a ? Ed.map((G) => ({
2131
2124
  key: `literal:${G}`,
2132
2125
  label: B[G],
2133
2126
  selected: G === N,
@@ -2174,7 +2167,7 @@ const Et = ({
2174
2167
  }
2175
2168
  )
2176
2169
  ] });
2177
- }, fr = (e) => JSON.stringify(e), fl = (e, t) => `${fr(e)}|items[${t}]`, Wn = (e, t) => `${e}[${t}]`, Ys = (e) => e === "date" || e === "dateTime", Hh = /* @__PURE__ */ new Set(["IN", "BETWEEN", "LIKE", "REGEXP"]), Js = /* @__PURE__ */ new Set(["LIKE", "REGEXP"]), Qh = (e) => e.type === "literal" && e.value === "" && !e.empty;
2170
+ }, fr = (e) => JSON.stringify(e), ml = (e, t) => `${fr(e)}|items[${t}]`, Wn = (e, t) => `${e}[${t}]`, Ys = (e) => e === "date" || e === "dateTime", Hh = /* @__PURE__ */ new Set(["IN", "BETWEEN", "LIKE", "REGEXP"]), Js = /* @__PURE__ */ new Set(["LIKE", "REGEXP"]), Qh = (e) => e.type === "literal" && e.value === "" && !e.empty;
2178
2171
  function Vh(e, t) {
2179
2172
  const n = { type: "literal", value: "" }, r = (e == null ? void 0 : e.type) === "list" ? e.items : [e ?? n];
2180
2173
  if (t === "IN")
@@ -2185,31 +2178,31 @@ function Vh(e, t) {
2185
2178
  }
2186
2179
  return (e == null ? void 0 : e.type) === "list" ? e.items[0] ?? n : e && e.type !== "subquery" ? e : n;
2187
2180
  }
2188
- const ml = ({
2181
+ const gl = ({
2189
2182
  className: e,
2190
2183
  binary: t,
2191
2184
  onChange: n,
2192
2185
  path: r
2193
2186
  }) => {
2194
2187
  var Ne;
2195
- const s = qt(), i = Ts(), a = _h(), c = Wc(), l = hl(), h = pl(), d = (R) => R && R.type !== "literal" ? h(R) : void 0, p = (R, ne) => ne !== void 0 && Js.has(ne) ? "text" : d(R), u = (R, ne) => {
2188
+ const s = qt(), i = Ts(), a = _h(), c = Kc(), l = pl(), h = fl(), d = (R) => R && R.type !== "literal" ? h(R) : void 0, p = (R, ne) => ne !== void 0 && Js.has(ne) ? "text" : d(R), u = (R, ne) => {
2196
2189
  var de;
2197
2190
  const le = R[ne], ie = ne === "left" ? R.right : R.left;
2198
2191
  if ((le == null ? void 0 : le.type) !== "literal" && (le == null ? void 0 : le.type) !== "list") return R;
2199
- const K = R.operator !== void 0 && Js.has(R.operator) || (de = l(ie)) == null ? void 0 : de.column.options, H = p(ie, R.operator), ee = le.type === "list" ? Od(le, H, K, R.operator === "BETWEEN") : Ad(le, H, K);
2192
+ const K = R.operator !== void 0 && Js.has(R.operator) || (de = l(ie)) == null ? void 0 : de.column.options, H = p(ie, R.operator), ee = le.type === "list" ? Ad(le, H, K, R.operator === "BETWEEN") : qd(le, H, K);
2200
2193
  return ee === le ? R : { ...R, [ne]: ee };
2201
2194
  }, f = M((R) => {
2202
2195
  R && (n == null || n(u({ ...t, left: R }, "right")));
2203
2196
  }, [t, n, h, l]), g = M((R) => {
2204
2197
  R && (n == null || n(u({ ...t, right: R }, "left")));
2205
2198
  }, [t, n, h, l]), y = M((R) => {
2206
- if (kd(R)) return { ...t, operator: R, right: void 0 };
2199
+ if (Bd(R)) return { ...t, operator: R, right: void 0 };
2207
2200
  const ne = { ...t, operator: R, right: Vh(t.right, R) };
2208
2201
  return u(u(ne, "right"), "left");
2209
2202
  }, [t, h, l]), v = t.operator !== void 0 && Js.has(t.operator), m = (R) => !v && d(R) === void 0, b = d(t.left) ?? d(t.right), N = (R) => {
2210
2203
  var ne;
2211
2204
  return (ne = l(R)) == null ? void 0 : ne.column.options;
2212
- }, B = !!(N(t.left) ?? N(t.right)), O = Bd(
2205
+ }, B = !!(N(t.left) ?? N(t.right)), O = Od(
2213
2206
  b,
2214
2207
  a === "always" || a === "withoutOptions" && !B
2215
2208
  ), z = Li.filter((R) => R === t.operator || (!O || O.includes(R)) && Ki(i, R)), D = (R) => {
@@ -2307,7 +2300,7 @@ const ml = ({
2307
2300
  {
2308
2301
  className: "inline-flex items-center",
2309
2302
  "data-qb-bound": ne === 0 ? "low" : "high",
2310
- "data-qb-focus": r && fl([...r, { kind: "right" }], ne),
2303
+ "data-qb-focus": r && ml([...r, { kind: "right" }], ne),
2311
2304
  children: [
2312
2305
  /* @__PURE__ */ o(
2313
2306
  Et,
@@ -2373,7 +2366,7 @@ const ml = ({
2373
2366
  }
2374
2367
  );
2375
2368
  }, Wh = 40, ca = 3, Ce = (e, t) => ({ text: e, ...t && { role: t } }), dt = Ce(" "), Fn = Ce("…");
2376
- function gl(e) {
2369
+ function bl(e) {
2377
2370
  return e.map((t) => t.text).join("");
2378
2371
  }
2379
2372
  function zo(e, t = {}) {
@@ -2471,11 +2464,11 @@ function zo(e, t = {}) {
2471
2464
  }
2472
2465
  };
2473
2466
  let h = l(e, 0, ca);
2474
- for (let d = ca - 1; d > 0 && gl(h).length > s; d -= 1)
2467
+ for (let d = ca - 1; d > 0 && bl(h).length > s; d -= 1)
2475
2468
  h = l(e, 0, d);
2476
2469
  return h;
2477
2470
  }
2478
- const bl = {
2471
+ const yl = {
2479
2472
  column: "text-qb-field-text font-medium",
2480
2473
  value: "text-qb-field-text-muted",
2481
2474
  param: "text-qb-param",
@@ -2497,10 +2490,10 @@ const bl = {
2497
2490
  "span",
2498
2491
  {
2499
2492
  className: "text-xs font-mono text-qb-field-text-subtle truncate min-w-0",
2500
- title: t ? gl(s) : void 0,
2493
+ title: t ? bl(s) : void 0,
2501
2494
  children: s.map((i, a) => (
2502
2495
  // A formula's parts never move: their place is their key.
2503
- /* @__PURE__ */ o("span", { className: Y(i.role && bl[i.role]), children: i.text }, a)
2496
+ /* @__PURE__ */ o("span", { className: Y(i.role && yl[i.role]), children: i.text }, a)
2504
2497
  ))
2505
2498
  }
2506
2499
  );
@@ -2582,7 +2575,7 @@ const Xh = 350, Zh = 150, la = ({
2582
2575
  return document.addEventListener("keydown", b), () => document.removeEventListener("keydown", b);
2583
2576
  }, [h]);
2584
2577
  const v = h ? Jh(e, { schema: i, functions: a }) : [], m = (b, N, B = !1) => {
2585
- const O = b.parts.map((D, T) => /* @__PURE__ */ o("span", { className: Y(D.role && bl[D.role]), children: D.text }, T)), { path: z } = b;
2578
+ const O = b.parts.map((D, T) => /* @__PURE__ */ o("span", { className: Y(D.role && yl[D.role]), children: D.text }, T)), { path: z } = b;
2586
2579
  return z ? /* @__PURE__ */ o(
2587
2580
  "button",
2588
2581
  {
@@ -2669,7 +2662,7 @@ const Xh = 350, Zh = 150, la = ({
2669
2662
  typeFilter: s,
2670
2663
  columnRef: i
2671
2664
  }) => {
2672
- const a = Re(Qn), c = a == null ? void 0 : a.keys, l = Re(Es), h = fe(), d = qt(), p = Po(), u = Qc(), f = Fh(), g = Rh(), y = n.table, v = we(() => {
2665
+ const a = Re(Qn), c = a == null ? void 0 : a.keys, l = Re(Es), h = fe(), d = qt(), p = Po(), u = Vc(), f = Fh(), g = Rh(), y = n.table, v = we(() => {
2673
2666
  const T = ({ ref: ae, table: Ne }) => ({
2674
2667
  ref: ae,
2675
2668
  table: Ne,
@@ -2714,7 +2707,7 @@ const Xh = 350, Zh = 150, la = ({
2714
2707
  ) ?? null;
2715
2708
  }, [n, v, m, i]), O = M((T) => {
2716
2709
  if (Xr(T)) {
2717
- r == null || r(qd(T.select));
2710
+ r == null || r(Dd(T.select));
2718
2711
  return;
2719
2712
  }
2720
2713
  r == null || r({
@@ -2775,7 +2768,7 @@ const Xh = 350, Zh = 150, la = ({
2775
2768
  "DATETIME",
2776
2769
  "TIMESTAMP",
2777
2770
  "BOOLEAN"
2778
- ], yl = ({
2771
+ ], xl = ({
2779
2772
  argDef: e,
2780
2773
  value: t,
2781
2774
  onChange: n,
@@ -2801,7 +2794,7 @@ const Xh = 350, Zh = 150, la = ({
2801
2794
  hn,
2802
2795
  {
2803
2796
  freeSolo: !0,
2804
- maxLength: Dd,
2797
+ maxLength: Rd,
2805
2798
  className: "min-w-20",
2806
2799
  inputClassName: "min-w-12 field-sizing-content pt-0.75 pb-0.75",
2807
2800
  options: tp,
@@ -2821,7 +2814,7 @@ const Xh = 350, Zh = 150, la = ({
2821
2814
  onChange: (c) => n == null ? void 0 : n(c === "" ? { type: "literal", value: "", empty: !0 } : { type: "literal", value: c })
2822
2815
  }
2823
2816
  );
2824
- const i = pu[e.kind];
2817
+ const i = fu[e.kind];
2825
2818
  if (t.type === "field")
2826
2819
  return /* @__PURE__ */ C("div", { className: "inline-flex items-center", children: [
2827
2820
  /* @__PURE__ */ o(
@@ -2866,7 +2859,7 @@ const Xh = 350, Zh = 150, la = ({
2866
2859
  )
2867
2860
  ] });
2868
2861
  }, np = ({ fn: e, onChange: t }) => {
2869
- const n = fe(), r = Dt(), s = $o(), { names: i, groupOf: a, searchText: c } = ll(), l = Qt(e.name, r), h = (f, g) => {
2862
+ const n = fe(), r = Dt(), s = $o(), { names: i, groupOf: a, searchText: c } = dl(), l = Qt(e.name, r), h = (f, g) => {
2870
2863
  t == null || t({ ...e, args: e.args.map((y, v) => v === f ? g : y) });
2871
2864
  }, d = () => {
2872
2865
  t == null || t({ ...e, args: [...e.args, { type: "literal", value: "" }] });
@@ -2885,13 +2878,13 @@ const Xh = 350, Zh = 150, la = ({
2885
2878
  inputClassName: "min-w-8 field-sizing-content pt-0.75 pb-0.75",
2886
2879
  inputValue: e.name,
2887
2880
  onInputChange: (f) => {
2888
- const g = gc(f, s);
2881
+ const g = bc(f, s);
2889
2882
  if (g) {
2890
2883
  t == null || t({
2891
2884
  type: "function",
2892
2885
  // Typed by another name (GROUP_CONCAT): stored by its own.
2893
2886
  name: g.name === f.toUpperCase() ? f : g.name,
2894
- args: bc(g)
2887
+ args: yc(g)
2895
2888
  });
2896
2889
  return;
2897
2890
  }
@@ -2905,7 +2898,7 @@ const Xh = 350, Zh = 150, la = ({
2905
2898
  return /* @__PURE__ */ C(Qa, { children: [
2906
2899
  g > 0 && /* @__PURE__ */ o("span", { className: "text-qb-field-text-subtle text-sm mx-0.5", children: "," }),
2907
2900
  /* @__PURE__ */ o(
2908
- yl,
2901
+ xl,
2909
2902
  {
2910
2903
  argDef: y,
2911
2904
  value: f,
@@ -2920,7 +2913,7 @@ const Xh = 350, Zh = 150, la = ({
2920
2913
  /* @__PURE__ */ o("span", { className: "text-qb-field-text-muted font-mono text-sm", children: ")" })
2921
2914
  ] });
2922
2915
  }, rp = ({ node: e }) => {
2923
- const t = fe(), n = Wc(), r = xt(e);
2916
+ const t = fe(), n = Kc(), r = xt(e);
2924
2917
  return /* @__PURE__ */ C(
2925
2918
  "span",
2926
2919
  {
@@ -2945,9 +2938,9 @@ const Xh = 350, Zh = 150, la = ({
2945
2938
  ]
2946
2939
  }
2947
2940
  );
2948
- }, xl = _e(!1);
2941
+ }, vl = _e(!1);
2949
2942
  function sp() {
2950
- return Re(xl);
2943
+ return Re(vl);
2951
2944
  }
2952
2945
  const op = [
2953
2946
  { value: "true", label: "True" },
@@ -2994,10 +2987,10 @@ const op = [
2994
2987
  maxLength: Ao,
2995
2988
  onChange: r
2996
2989
  }
2997
- ) }), lp = (e, t) => e === "" || Number.isFinite(Number(e)) && Fd(e) <= Ld && (!t || Number.isInteger(Number(e))), dp = (e) => {
2990
+ ) }), lp = (e, t) => e === "" || Number.isFinite(Number(e)) && Ld(e) <= Pd && (!t || Number.isInteger(Number(e))), dp = (e) => {
2998
2991
  const t = ac(e, "boolean");
2999
2992
  return typeof t == "boolean" ? t : void 0;
3000
- }, vl = ({
2993
+ }, wl = ({
3001
2994
  className: e,
3002
2995
  grouped: t,
3003
2996
  valueType: n,
@@ -3007,7 +3000,7 @@ const op = [
3007
3000
  allowEmpty: a = !0
3008
3001
  }) => {
3009
3002
  var v;
3010
- const c = fe(), l = We(), h = ul(), d = sp(), p = n ?? Rd(r) ?? "text", u = p === "text" && !((v = i == null ? void 0 : i.column.options) != null && v.length) && r.value !== null, f = () => {
3003
+ const c = fe(), l = We(), h = hl(), d = sp(), p = n ?? Fd(r) ?? "text", u = p === "text" && !((v = i == null ? void 0 : i.column.options) != null && v.length) && r.value !== null, f = () => {
3011
3004
  const { empty: m, ...b } = r;
3012
3005
  s == null || s(m ? { ...b, value: "" } : { ...b, value: "", empty: !0 });
3013
3006
  }, g = (m) => {
@@ -3137,7 +3130,7 @@ const op = [
3137
3130
  "hover:border-qb-field-border-hover hover:bg-qb-field-control-hover-bg",
3138
3131
  "hover:text-qb-field-text"
3139
3132
  ),
3140
- children: /* @__PURE__ */ o(ud, { className: "w-3.5 h-3.5" })
3133
+ children: /* @__PURE__ */ o(hd, { className: "w-3.5 h-3.5" })
3141
3134
  }
3142
3135
  ) }),
3143
3136
  u && a && !l && /* @__PURE__ */ o(Z, { title: r.empty ? c.unmarkEmpty : c.markEmpty, children: /* @__PURE__ */ o(
@@ -3162,10 +3155,10 @@ const op = [
3162
3155
  ] })
3163
3156
  );
3164
3157
  }, da = { type: "literal", value: "" };
3165
- function wl(e, t, n) {
3158
+ function Nl(e, t, n) {
3166
3159
  var s;
3167
3160
  const r = (s = n == null ? void 0 : n.column.options) == null ? void 0 : s.find((i) => String(i.value) === String(e));
3168
- return r ? r.label : e instanceof Date ? iu(e) ? hc(e) : dc(e).replace("T", " ") : typeof e == "boolean" ? e ? "True" : "False" : t === "time" && typeof e == "string" ? e.replace(/:00$/, "") : String(e);
3161
+ return r ? r.label : e instanceof Date ? au(e) ? hc(e) : dc(e).replace("T", " ") : typeof e == "boolean" ? e ? "True" : "False" : t === "time" && typeof e == "string" ? e.replace(/:00$/, "") : String(e);
3169
3162
  }
3170
3163
  const bo = (e, t) => e instanceof Date && t instanceof Date ? e.getTime() === t.getTime() : e === t, up = {
3171
3164
  date: "YYYY-MM-DD",
@@ -3181,7 +3174,7 @@ const bo = (e, t) => e instanceof Date && t instanceof Date ? e.getTime() === t.
3181
3174
  var g;
3182
3175
  const i = fe(), a = n ?? "text", c = (g = r == null ? void 0 : r.column.options) != null && g.length ? r.column.options : a === "boolean" && hp || void 0, l = (y) => `option:${String(y)}`, h = (y) => c == null ? void 0 : c.some((v) => String(v.value) === String(y)), d = e.items.map((y, v) => ({
3183
3176
  key: y.type === "literal" && h(y.value) ? l(y.value) : `item:${v}`,
3184
- label: y.type === "literal" ? wl(y.value, a, r) : xt(y)
3177
+ label: y.type === "literal" ? Nl(y.value, a, r) : xt(y)
3185
3178
  })), p = (y) => e.items.some(
3186
3179
  (v) => v.type === "literal" && bo(v.value, y)
3187
3180
  ), u = (y) => {
@@ -3237,7 +3230,7 @@ const bo = (e, t) => e instanceof Date && t instanceof Date ? e.getTime() === t.
3237
3230
  h ? d(b) : l(b);
3238
3231
  }, f = (m) => {
3239
3232
  m.key === "Enter" && (m.preventDefault(), d(c));
3240
- }, g = (m) => m.type === "literal" ? wl(m.value, n, r) : xt(m), y = e.items.length > 0 || a;
3233
+ }, g = (m) => m.type === "literal" ? Nl(m.value, n, r) : xt(m), y = e.items.length > 0 || a;
3241
3234
  return /* @__PURE__ */ C("div", { className: "inline-flex items-center gap-1", children: [
3242
3235
  /* @__PURE__ */ C("div", { className: "inline-flex items-center", children: [
3243
3236
  y && /* @__PURE__ */ o(
@@ -3279,7 +3272,7 @@ const bo = (e, t) => e instanceof Date && t instanceof Date ? e.getTime() === t.
3279
3272
  }
3280
3273
  ),
3281
3274
  !a && /* @__PURE__ */ o("div", { className: Y(y && "-ml-[1px]"), onKeyDown: f, children: /* @__PURE__ */ o(
3282
- vl,
3275
+ wl,
3283
3276
  {
3284
3277
  literal: c,
3285
3278
  onChange: u,
@@ -3309,7 +3302,7 @@ const bo = (e, t) => e instanceof Date && t instanceof Date ? e.getTime() === t.
3309
3302
  ) })
3310
3303
  ] });
3311
3304
  }, mp = (e) => {
3312
- const t = !!Bt().ListInput, n = ul(), { column: r } = e, s = r && (n == null ? void 0 : n({
3305
+ const t = !!Bt().ListInput, n = hl(), { column: r } = e, s = r && (n == null ? void 0 : n({
3313
3306
  table: r.table,
3314
3307
  column: r.column,
3315
3308
  value: "",
@@ -3369,10 +3362,10 @@ const bo = (e, t) => e instanceof Date && t instanceof Date ? e.getTime() === t.
3369
3362
  { unit: "month", offset: -1, anchor: "start" },
3370
3363
  { unit: "year", offset: 0, anchor: "start" },
3371
3364
  { unit: "year", offset: -1, anchor: "start" }
3372
- ], Zs = "custom", ua = (e, t) => (t ? e : -e) || 0, rr = (e) => wc(e), yp = ({ param: e, onChange: t, grouped: n = !1 }) => {
3365
+ ], Zs = "custom", ua = (e, t) => (t ? e : -e) || 0, rr = (e) => Nc(e), yp = ({ param: e, onChange: t, grouped: n = !1 }) => {
3373
3366
  const r = fe(), s = We(), { relative: i } = e, a = Xs.some((g) => rr(g) === rr(i)), [c, l] = Se(!1), h = c || !a, d = Yi(i, r), p = (g) => {
3374
3367
  const y = g.unit === "day" || !g.anchor ? { unit: g.unit, offset: g.offset } : g;
3375
- t == null || t({ ...e, name: wc(y), relative: y });
3368
+ t == null || t({ ...e, name: Nc(y), relative: y });
3376
3369
  };
3377
3370
  if (s)
3378
3371
  return /* @__PURE__ */ o(
@@ -3461,7 +3454,7 @@ const bo = (e, t) => e instanceof Date && t instanceof Date ? e.getTime() === t.
3461
3454
  onChange: n,
3462
3455
  renderSubComponent: r
3463
3456
  }) => {
3464
- const s = fe(), i = X(null), a = cd(), l = t.operands.length > 1, h = (f, g) => {
3457
+ const s = fe(), i = X(null), a = ld(), l = t.operands.length > 1, h = (f, g) => {
3465
3458
  const y = t.operands.map((v, m) => m === f ? g : v).filter((v) => !!v);
3466
3459
  n == null || n({
3467
3460
  ...t,
@@ -3566,7 +3559,7 @@ const bo = (e, t) => e instanceof Date && t instanceof Date ? e.getTime() === t.
3566
3559
  allowEmpty: c,
3567
3560
  valueType: l
3568
3561
  }) => {
3569
- const h = fe(), d = Ro(), p = Vc(e);
3562
+ const h = fe(), d = Ro(), p = Wc(e);
3570
3563
  if (p)
3571
3564
  return /* @__PURE__ */ o(
3572
3565
  hs,
@@ -3654,7 +3647,7 @@ const bo = (e, t) => e instanceof Date && t instanceof Date ? e.getTime() === t.
3654
3647
  switch (e.type) {
3655
3648
  case "literal":
3656
3649
  return /* @__PURE__ */ o(
3657
- vl,
3650
+ wl,
3658
3651
  {
3659
3652
  literal: e,
3660
3653
  onChange: t,
@@ -3669,7 +3662,7 @@ const bo = (e, t) => e instanceof Date && t instanceof Date ? e.getTime() === t.
3669
3662
  case "logical":
3670
3663
  return /* @__PURE__ */ o(xp, { logical: e, onChange: t });
3671
3664
  case "binary":
3672
- return /* @__PURE__ */ o(ml, { binary: e, onChange: t });
3665
+ return /* @__PURE__ */ o(gl, { binary: e, onChange: t });
3673
3666
  case "function":
3674
3667
  return /* @__PURE__ */ o(np, { fn: e, onChange: t });
3675
3668
  case "param":
@@ -3718,7 +3711,7 @@ function nt({
3718
3711
  onClose: (h) => {
3719
3712
  i(!1), n == null || n(h);
3720
3713
  },
3721
- children: ld(a, {
3714
+ children: dd(a, {
3722
3715
  onClickCapture: (h) => {
3723
3716
  var d, p;
3724
3717
  ha.until = Date.now() + vp, i(!1), (p = (d = a.props).onClickCapture) == null || p.call(d, h);
@@ -3779,7 +3772,7 @@ const fn = ({
3779
3772
  return !!r && t >= r.left && t <= r.right && n >= r.top && n <= r.bottom;
3780
3773
  };
3781
3774
  function mn() {
3782
- const e = Cs().actions === "hover", t = bd(), n = ns((b) => {
3775
+ const e = Cs().actions === "hover", t = yd(), n = ns((b) => {
3783
3776
  var N;
3784
3777
  return ((N = b.nodeLookup.get(t)) == null ? void 0 : N.selected) === !0;
3785
3778
  }), r = ns((b) => Math.max(1, 1 / b.transform[2])), [s, i] = Se(!1), [a, c] = Se(!1), [l, h] = Se(!1), [d, p] = Se(!1), u = X(null), f = X(null);
@@ -4117,7 +4110,7 @@ const wp = ({ data: e }) => {
4117
4110
  function At(e) {
4118
4111
  return Sp(e).startsWith(ks("having")) ? "having" : "where";
4119
4112
  }
4120
- function Nl(e) {
4113
+ function Il(e) {
4121
4114
  const t = ks(At(e));
4122
4115
  return e.startsWith(un) ? un + e.slice(un.length + t.length) : e.slice(t.length);
4123
4116
  }
@@ -4139,7 +4132,7 @@ function Cp(e, t, n) {
4139
4132
  };
4140
4133
  }
4141
4134
  function Tp(e, t) {
4142
- return e === "where" ? t : t.filter((n) => At(n.id) === e).map((n) => ({ ...n, id: Nl(n.id) }));
4135
+ return e === "where" ? t : t.filter((n) => At(n.id) === e).map((n) => ({ ...n, id: Il(n.id) }));
4143
4136
  }
4144
4137
  function Ep(e, t) {
4145
4138
  const n = e === "ltr" ? Te.Left : Te.Right, r = e === "ltr" ? Te.Right : Te.Left;
@@ -4156,9 +4149,9 @@ function Ep(e, t) {
4156
4149
  };
4157
4150
  }
4158
4151
  function Zt(e) {
4159
- return Ep(e, el());
4152
+ return Ep(e, tl());
4160
4153
  }
4161
- const Il = ({
4154
+ const Sl = ({
4162
4155
  id: e,
4163
4156
  path: t,
4164
4157
  siblingCount: n,
@@ -4255,7 +4248,7 @@ const Il = ({
4255
4248
  anchor: l
4256
4249
  } = t;
4257
4250
  return /* @__PURE__ */ o(
4258
- Il,
4251
+ Sl,
4259
4252
  {
4260
4253
  id: e,
4261
4254
  path: r,
@@ -4265,7 +4258,7 @@ const Il = ({
4265
4258
  allowRootDelete: c,
4266
4259
  anchor: l,
4267
4260
  children: /* @__PURE__ */ o(
4268
- ml,
4261
+ gl,
4269
4262
  {
4270
4263
  binary: n,
4271
4264
  onChange: (h) => a({ type: "change", path: r, exp: h }),
@@ -4328,7 +4321,7 @@ const Il = ({
4328
4321
  }), s.drillDown({ path: [...s.basePath, ...l, { kind: "existsWhere" }], label: b });
4329
4322
  });
4330
4323
  return /* @__PURE__ */ o(
4331
- Il,
4324
+ Sl,
4332
4325
  {
4333
4326
  id: e,
4334
4327
  path: l,
@@ -4573,7 +4566,7 @@ function Os({
4573
4566
  over: a == null ? void 0 : a.over
4574
4567
  };
4575
4568
  }
4576
- const Sl = ({ on: e, onToggle: t, className: n }) => {
4569
+ const Cl = ({ on: e, onToggle: t, className: n }) => {
4577
4570
  const r = fe();
4578
4571
  return /* @__PURE__ */ o(
4579
4572
  vt,
@@ -4613,12 +4606,12 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
4613
4606
  // Shared queries first, a group of their own (issue 194).
4614
4607
  ...(s ?? []).map((c) => ({ shared: c })),
4615
4608
  // The tables, by group when the schema gives any (issue 245).
4616
- ...i.some((c) => a(c)) ? yc(e, a, i).flatMap(({ group: c, tables: l }) => l.map((h) => ({ table: h, group: c ?? null }))) : e.map((c) => ({ table: c })),
4609
+ ...i.some((c) => a(c)) ? xc(e, a, i).flatMap(({ group: c, tables: l }) => l.map((h) => ({ table: h, group: c ?? null }))) : e.map((c) => ({ table: c })),
4617
4610
  ...(n ?? []).map((c) => ({ table: c, union: !0 })),
4618
4611
  // The actions last, below every group of tables.
4619
4612
  ...t ? [{}] : [],
4620
4613
  ...r.map((c) => ({ action: c }))
4621
- ], xa = "rounded-qb-node bg-qb-node-bg border border-qb-node-border shadow-lg p-2", Cl = (e) => e.derivedId ? `derived:${e.derivedId}` : e.sharedId ? `shared:${e.table}` : e.table, yo = ({
4614
+ ], xa = "rounded-qb-node bg-qb-node-bg border border-qb-node-border shadow-lg p-2", Tl = (e) => e.derivedId ? `derived:${e.derivedId}` : e.sharedId ? `shared:${e.table}` : e.table, yo = ({
4622
4615
  alias: e,
4623
4616
  taken: t,
4624
4617
  onRename: n,
@@ -4689,7 +4682,7 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
4689
4682
  ] }),
4690
4683
  u && /* @__PURE__ */ o("span", { className: "text-[10px] truncate text-qb-warning", children: u })
4691
4684
  ] });
4692
- }, Tl = ({ onOpen: e }) => {
4685
+ }, El = ({ onOpen: e }) => {
4693
4686
  const t = fe(), n = We() ? t.viewSharedQuery : t.editSharedQuery;
4694
4687
  return /* @__PURE__ */ o(Z, { title: n, children: /* @__PURE__ */ o(
4695
4688
  U,
@@ -4722,7 +4715,7 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
4722
4715
  drag: y,
4723
4716
  isDragging: v
4724
4717
  }) => {
4725
- const m = fe(), b = Ts(), N = We(), B = Cl(e), O = y.ref, z = M((G) => {
4718
+ const m = fe(), b = Ts(), N = We(), B = Tl(e), O = y.ref, z = M((G) => {
4726
4719
  O(G), f(B)(G);
4727
4720
  }, [O, f, B]), D = M(() => {
4728
4721
  g(), a({ type: "reorderTables", fromIndex: e.index, toIndex: e.index - 1 });
@@ -4804,7 +4797,7 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
4804
4797
  }),
4805
4798
  onOpen: l && !e.unionBranches ? () => l(e.derivedId, e.label) : void 0,
4806
4799
  aside: (u == null ? void 0 : u.free) && e.unionAll !== void 0 && /* @__PURE__ */ o(
4807
- Sl,
4800
+ Cl,
4808
4801
  {
4809
4802
  on: !e.unionAll,
4810
4803
  onToggle: () => u.free.onSetAll(e.derivedId, !e.unionAll),
@@ -4826,7 +4819,7 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
4826
4819
  ...e.joinId && { joinId: e.joinId },
4827
4820
  alias: G
4828
4821
  }),
4829
- open: h && /* @__PURE__ */ o(Tl, { onOpen: () => h(e.sharedId, e.sharedName) })
4822
+ open: h && /* @__PURE__ */ o(El, { onOpen: () => h(e.sharedId, e.sharedName) })
4830
4823
  },
4831
4824
  e.label
4832
4825
  ),
@@ -4996,9 +4989,9 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
4996
4989
  ((V = I.table) == null ? void 0 : V.label) ?? D(I),
4997
4990
  (oe = I.table) == null ? void 0 : oe.description
4998
4991
  ].filter(Boolean).join(" ");
4999
- }, G = We(), ge = we(() => n ? fu(n) : [], [n]), ae = b.renderOption ?? b.actions ?? b.component, Ne = we(() => ae && n ? /* @__PURE__ */ new Set([
5000
- ...mu(m, ge),
5001
- ...Pd(m, n).map((I) => I.table)
4992
+ }, G = We(), ge = we(() => n ? mu(n) : [], [n]), ae = b.renderOption ?? b.actions ?? b.component, Ne = we(() => ae && n ? /* @__PURE__ */ new Set([
4993
+ ...mc(m, ge),
4994
+ ...Md(m, n).map((I) => I.table)
5002
4995
  ]) : void 0, [ae, n, m, ge]), R = (I) => ({
5003
4996
  purpose: I,
5004
4997
  existingTables: ge,
@@ -5038,7 +5031,7 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
5038
5031
  rt,
5039
5032
  {
5040
5033
  ...R(I),
5041
- groups: yc(V, N, m.tables),
5034
+ groups: xc(V, N, m.tables),
5042
5035
  actions: ht,
5043
5036
  label: Ie,
5044
5037
  onSelectTable: (ke) => {
@@ -5197,12 +5190,12 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
5197
5190
  label: j(I),
5198
5191
  joinId: I.id,
5199
5192
  joinType: I.joinType,
5200
- onCondition: _d(I.on, t),
5193
+ onCondition: jd(I.on, t),
5201
5194
  drillLabel: nc(I),
5202
5195
  canRemove: !Pi(n, I.id).has(Tt(I)),
5203
5196
  ...ce(I),
5204
5197
  ...J(I),
5205
- canJoinEveryRow: I.query !== void 0 && I.joinType !== "cross" && Md(I.query, z),
5198
+ canJoinEveryRow: I.query !== void 0 && I.joinType !== "cross" && _d(I.query, z),
5206
5199
  ...I.query && I.drillAcross ? { measureSynced: I.drillAcross.synced } : {}
5207
5200
  }))
5208
5201
  ], ue = (I) => Wr(n).some((V) => V.alias === I) ? I : _(I), E = (I) => Mr(n, I, I - 1), Q = (I) => Mr(n, I, I + 1), xe = (I) => I ? t.joinOrderConflict(_(I.table), _(I.needs)) : void 0;
@@ -5236,7 +5229,7 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
5236
5229
  drag: F.rowProps(I.index),
5237
5230
  isDragging: F.dragging === I.index
5238
5231
  },
5239
- Cl(I)
5232
+ Tl(I)
5240
5233
  )),
5241
5234
  d && /* @__PURE__ */ o(
5242
5235
  "div",
@@ -5387,7 +5380,7 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
5387
5380
  taken: [...n.filter((f) => f !== p).map((f) => f.name), ...r],
5388
5381
  takenText: t.sharedNameTaken,
5389
5382
  onRename: (f) => s(p.id, f),
5390
- open: /* @__PURE__ */ o(Tl, { onOpen: () => a(p.id, p.name) })
5383
+ open: /* @__PURE__ */ o(El, { onOpen: () => a(p.id, p.name) })
5391
5384
  },
5392
5385
  p.name
5393
5386
  ),
@@ -5421,8 +5414,8 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
5421
5414
  ]
5422
5415
  }
5423
5416
  );
5424
- }, El = _e(null), kl = ({ id: e, data: t }) => {
5425
- const n = Re(El), r = n != null && n.expandedIds.has(e) ? n.extra : 0, s = (n == null ? void 0 : n.dragging) && !n.draggedBgIds.has(e), i = Zt(t.direction), { groupFrame: a } = Cs(), c = t.direction === "ltr";
5417
+ }, kl = _e(null), Bl = ({ id: e, data: t }) => {
5418
+ const n = Re(kl), r = n != null && n.expandedIds.has(e) ? n.extra : 0, s = (n == null ? void 0 : n.dragging) && !n.draggedBgIds.has(e), i = Zt(t.direction), { groupFrame: a } = Cs(), c = t.direction === "ltr";
5426
5419
  return /* @__PURE__ */ C(
5427
5420
  "div",
5428
5421
  {
@@ -5665,7 +5658,7 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
5665
5658
  size: "small",
5666
5659
  color: "primary",
5667
5660
  onClick: n.act(() => c({ type: "addGroup", path: s })),
5668
- children: /* @__PURE__ */ o(hd, { className: "w-4 h-4" })
5661
+ children: /* @__PURE__ */ o(pd, { className: "w-4 h-4" })
5669
5662
  }
5670
5663
  ) }),
5671
5664
  /* @__PURE__ */ o(Z, { title: t.addIfExpression, placement: B, children: /* @__PURE__ */ o(
@@ -5753,7 +5746,7 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
5753
5746
  size: "small",
5754
5747
  color: "warning",
5755
5748
  onClick: n.act(() => c({ type: "unwrap", path: s })),
5756
- children: /* @__PURE__ */ o(pd, { className: "w-4 h-4" })
5749
+ children: /* @__PURE__ */ o(fd, { className: "w-4 h-4" })
5757
5750
  }
5758
5751
  ) }) }),
5759
5752
  d && h > 1 && /* @__PURE__ */ o(Z, { title: t.wrapInNewGroup, placement: n.placement, children: /* @__PURE__ */ o(
@@ -5901,7 +5894,7 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
5901
5894
  size: "small",
5902
5895
  color: "warning",
5903
5896
  onClick: n.act(() => a({ type: "unwrap", path: r })),
5904
- children: /* @__PURE__ */ o(fd, { className: "w-4 h-4" })
5897
+ children: /* @__PURE__ */ o(md, { className: "w-4 h-4" })
5905
5898
  }
5906
5899
  ) }) }),
5907
5900
  (s > 1 && !l || l && c) && /* @__PURE__ */ o(Z, { title: t.delete, placement: n.placement, children: /* @__PURE__ */ o(
@@ -5952,11 +5945,11 @@ const Sl = ({ on: e, onToggle: t, className: n }) => {
5952
5945
  className: `self-stretch ${t} border border-qb-summary-border bg-qb-summary-bg px-3 py-1 text-center text-xs font-semibold text-qb-summary-text`,
5953
5946
  children: n
5954
5947
  }
5955
- ), Bl = _e(void 0);
5948
+ ), Ol = _e(void 0);
5956
5949
  function Uo() {
5957
- return Re(Bl);
5950
+ return Re(Ol);
5958
5951
  }
5959
- const af = "rounded-qb-node bg-qb-node-bg border border-qb-node-border shadow-lg p-2", Ol = (e) => e.id, cf = ({
5952
+ const af = "rounded-qb-node bg-qb-node-bg border border-qb-node-border shadow-lg p-2", Al = (e) => e.id, cf = ({
5960
5953
  item: e,
5961
5954
  index: t,
5962
5955
  canMoveUp: n,
@@ -5970,7 +5963,7 @@ const af = "rounded-qb-node bg-qb-node-bg border border-qb-node-border shadow-lg
5970
5963
  notGrouped: d,
5971
5964
  measures: p
5972
5965
  }) => {
5973
- const u = fe(), f = Dt(), g = We(), y = Ol(e), v = l.ref, m = M((A) => {
5966
+ const u = fe(), f = Dt(), g = We(), y = Al(e), v = l.ref, m = M((A) => {
5974
5967
  v(A), a(y)(A);
5975
5968
  }, [v, a, y]), b = M(() => {
5976
5969
  c(), s({ type: "reorderSelectItems", fromIndex: t, toIndex: t - 1 });
@@ -6130,7 +6123,7 @@ const af = "rounded-qb-node bg-qb-node-bg border border-qb-node-border shadow-lg
6130
6123
  notGrouped: !m && s.includes(N.id),
6131
6124
  measures: h
6132
6125
  }
6133
- ) }, Ol(N))
6126
+ ) }, Al(N))
6134
6127
  )) }),
6135
6128
  !m && s.length > 0 && /* @__PURE__ */ o(Cn, { testId: "select-not-grouped", children: t.notPerGroup }),
6136
6129
  !m && i && /* @__PURE__ */ o(Cn, { testId: "select-needs-columns", children: t.groupedNeedsColumns }),
@@ -6154,7 +6147,7 @@ const af = "rounded-qb-node bg-qb-node-bg border border-qb-node-border shadow-lg
6154
6147
  }
6155
6148
  ) }),
6156
6149
  m ? r && /* @__PURE__ */ o(xo, { testId: "select-distinct", radius: "rounded", children: t.distinctOn }) : /* @__PURE__ */ o(
6157
- Sl,
6150
+ Cl,
6158
6151
  {
6159
6152
  on: r,
6160
6153
  onToggle: () => a({ type: "setDistinct", distinct: !r }),
@@ -6641,7 +6634,7 @@ function no(e, t, n, r = (s) => {
6641
6634
  i[a] = i[a - 1] + r(t[a - 1]) + s;
6642
6635
  return i;
6643
6636
  }
6644
- const Al = _e(!0), xf = 40, vf = 200;
6637
+ const ql = _e(!0), xf = 40, vf = 200;
6645
6638
  function wf(e, t, n, r = xf) {
6646
6639
  const s = (c, l, h) => {
6647
6640
  const d = r, p = h - r;
@@ -6670,8 +6663,8 @@ function If() {
6670
6663
  var e;
6671
6664
  return typeof window < "u" && ((e = window.matchMedia) == null ? void 0 : e.call(window, "(prefers-reduced-motion: reduce)").matches) === !0;
6672
6665
  }
6673
- function ql(e, t) {
6674
- const n = Re(Al), { getViewport: r, setViewport: s } = wr(), i = ns((h) => h.width), a = ns((h) => h.height), c = X(null), l = X(/* @__PURE__ */ new Set());
6666
+ function Dl(e, t) {
6667
+ const n = Re(ql), { getViewport: r, setViewport: s } = wr(), i = ns((h) => h.width), a = ns((h) => h.height), c = X(null), l = X(/* @__PURE__ */ new Set());
6675
6668
  He(() => {
6676
6669
  const h = new Set(e.map((f) => f.id)), d = c.current;
6677
6670
  if (c.current = h, d && d.size > 0 && h.forEach((f) => {
@@ -6689,7 +6682,7 @@ function ql(e, t) {
6689
6682
  u && s(u, { duration: If() ? 0 : vf });
6690
6683
  }, [e, n, t, i, a, r, s]);
6691
6684
  }
6692
- function Dl(e, t) {
6685
+ function Rl(e, t) {
6693
6686
  const n = Oo(), { fitView: r } = wr(), s = X(e);
6694
6687
  He(() => {
6695
6688
  s.current !== e && (s.current = e, requestAnimationFrame(() => requestAnimationFrame(() => {
@@ -6774,10 +6767,10 @@ const Ln = {
6774
6767
  value: r,
6775
6768
  table: s
6776
6769
  }) => {
6777
- const i = xd(e);
6770
+ const i = vd(e);
6778
6771
  if (!i) return null;
6779
6772
  const { x: a, y: c } = i.internals.positionAbsolute;
6780
- return /* @__PURE__ */ o(vd, { children: /* @__PURE__ */ o(
6773
+ return /* @__PURE__ */ o(wd, { children: /* @__PURE__ */ o(
6781
6774
  "div",
6782
6775
  {
6783
6776
  "data-testid": "focus-pulse",
@@ -6797,8 +6790,8 @@ const Ln = {
6797
6790
  children: /* @__PURE__ */ o("div", {})
6798
6791
  }
6799
6792
  ) });
6800
- }, Rl = ({ nodeIds: e }) => {
6801
- const t = Re(vo), { getInternalNode: n, getViewport: r, setCenter: s } = wr(), i = yd(), [a, c] = Se(null), l = (f) => {
6793
+ }, Fl = ({ nodeIds: e }) => {
6794
+ const t = Re(vo), { getInternalNode: n, getViewport: r, setCenter: s } = wr(), i = xd(), [a, c] = Se(null), l = (f) => {
6802
6795
  var g;
6803
6796
  return (g = i.getState().domNode) == null ? void 0 : g.querySelector(`.react-flow__node[data-id="${CSS.escape(f)}"]`);
6804
6797
  }, h = (f) => {
@@ -6870,10 +6863,10 @@ const Ln = {
6870
6863
  dots: zs.Dots,
6871
6864
  cross: zs.Cross
6872
6865
  };
6873
- function Fl() {
6866
+ function Ll() {
6874
6867
  const { background: e, backgroundGap: t } = Cs();
6875
6868
  return /* @__PURE__ */ o(
6876
- wd,
6869
+ Nd,
6877
6870
  {
6878
6871
  variant: e === "none" ? void 0 : Mf[e],
6879
6872
  gap: t,
@@ -6882,11 +6875,11 @@ function Fl() {
6882
6875
  }
6883
6876
  );
6884
6877
  }
6885
- const Ll = _e({});
6878
+ const Pl = _e({});
6886
6879
  function Pt(e) {
6887
6880
  const t = (n) => {
6888
6881
  var d;
6889
- const r = Re(Ll), s = Uo(), i = At(n.id), a = (d = n.data) == null ? void 0 : d.path, c = a == null ? void 0 : a[0], l = i === "where" && s !== void 0 && typeof c == "number" && c < s.whereOperands, h = i === "having" ? r.having : void 0;
6882
+ const r = Re(Pl), s = Uo(), i = At(n.id), a = (d = n.data) == null ? void 0 : d.path, c = a == null ? void 0 : a[0], l = i === "where" && s !== void 0 && typeof c == "number" && c < s.whereOperands, h = i === "having" ? r.having : void 0;
6890
6883
  return h ? /* @__PURE__ */ o(pn.Provider, { value: h, children: /* @__PURE__ */ o(Vn.Provider, { value: !0, children: /* @__PURE__ */ o(Qn.Provider, { value: r.havingPicks, children: /* @__PURE__ */ o(ds.Provider, { value: r.havingExists ?? null, children: /* @__PURE__ */ o(e, { ...n }) }) }) }) }) : /* @__PURE__ */ o(Cr, { readOnly: l, children: /* @__PURE__ */ o(e, { ...n }) });
6891
6884
  };
6892
6885
  return t.displayName = `withTreeScope(${e.displayName ?? e.name})`, t;
@@ -6899,7 +6892,7 @@ const fs = _e(null), Ba = {
6899
6892
  }, _f = /^(\w+)\[(\d+)\]$/, jf = /^(.*)\|items\[(\d+)\]$/, $f = /* @__PURE__ */ new Set(["from", "limit", "offset"]), zf = (e) => e.map(
6900
6893
  (t) => ({ kind: "arg", index: t })
6901
6894
  );
6902
- function Pl(e, t, n) {
6895
+ function Ml(e, t, n) {
6903
6896
  var h;
6904
6897
  if (!(t instanceof Element) || !(n instanceof Node) || !t.contains(n))
6905
6898
  return null;
@@ -6964,7 +6957,7 @@ const Gf = {
6964
6957
  createHavingFlow: Op,
6965
6958
  fromFlow: Yp,
6966
6959
  sharedQueriesFlow: Xp,
6967
- groupBg: Pt(kl),
6960
+ groupBg: Pt(Bl),
6968
6961
  ifFlow: Pt(tf),
6969
6962
  ifThenFlow: Pt(Zp),
6970
6963
  ifElseFlow: Pt(ef),
@@ -6982,7 +6975,7 @@ function sr(e, t) {
6982
6975
  const n = /* @__PURE__ */ new Set(), r = e.data.path ?? [], s = At(e.id);
6983
6976
  return t.forEach((i) => {
6984
6977
  if (At(i.id) !== s) return;
6985
- const a = Nl(i.id), c = a.startsWith("bg-") ? a.slice(3) : a, l = c === "root" ? [] : c.replace("node-", "").split("-").map(Number);
6978
+ const a = Il(i.id), c = a.startsWith("bg-") ? a.slice(3) : a, l = c === "root" ? [] : c.replace("node-", "").split("-").map(Number);
6986
6979
  l.length >= r.length && r.every((h, d) => h === l[d]) && n.add(i.id);
6987
6980
  }), n.add(`bg-${e.id}`), n;
6988
6981
  }
@@ -7067,13 +7060,13 @@ function cn(e, t) {
7067
7060
  const Ra = (e) => e !== void 0 && (e.list.length > 0 || e.onCreate !== void 0);
7068
7061
  function Fa(e, t, n, r, s, i, a) {
7069
7062
  var N, B;
7070
- const c = Tp(e, r), { nodes: l, edges: h } = Oc(
7063
+ const c = Tp(e, r), { nodes: l, edges: h } = Ac(
7071
7064
  t,
7072
7065
  n,
7073
7066
  s,
7074
7067
  i,
7075
7068
  a
7076
- ), d = Ac(l, c, t, i, a), p = Yu(t, i), u = Ju(p.path), f = p.exp.type === "logical" || p.exp.type === "not" || p.exp.type === "case" || p.exp.type === "if", g = f ? `bg-${u}` : u, y = d.find((O) => O.id === g), v = f ? {
7069
+ ), d = qc(l, c, t, i, a), p = Yu(t, i), u = Ju(p.path), f = p.exp.type === "logical" || p.exp.type === "not" || p.exp.type === "case" || p.exp.type === "if", g = f ? `bg-${u}` : u, y = d.find((O) => O.id === g), v = f ? {
7077
7070
  // emitGroupBgs unconditionally sets `measured` on every bg node it
7078
7071
  // creates, and `rootHasBg` true guarantees `anchorLaidOutNode` is that
7079
7072
  // exact bg-root entry — the '?? ROOT_FALLBACK' fallbacks are
@@ -7094,14 +7087,14 @@ function Fa(e, t, n, r, s, i, a) {
7094
7087
  function oo(e, t, n, r, s, i = !1, a = Ke, c = Lo) {
7095
7088
  if (!t) {
7096
7089
  if (!e) return { nodes: [], edges: [] };
7097
- const { nodes: P, edges: F } = Oc(
7090
+ const { nodes: P, edges: F } = Ac(
7098
7091
  e,
7099
7092
  n,
7100
7093
  r,
7101
7094
  i,
7102
7095
  a
7103
7096
  );
7104
- return { nodes: Ac(P, s, e, i, a), edges: F };
7097
+ return { nodes: qc(P, s, e, i, a), edges: F };
7105
7098
  }
7106
7099
  const l = _t(Pn, s, Kf), h = cn({
7107
7100
  id: Pn,
@@ -7468,9 +7461,9 @@ const tm = {
7468
7461
  v.current = h;
7469
7462
  const m = We(), b = Re(fs), N = X(m);
7470
7463
  N.current = m;
7471
- const B = jo(), O = rl(), z = X(B);
7464
+ const B = jo(), O = sl(), z = X(B);
7472
7465
  z.current = B;
7473
- const D = el(), T = X(D);
7466
+ const D = tl(), T = X(D);
7474
7467
  T.current = D;
7475
7468
  const A = X(!0);
7476
7469
  He(() => {
@@ -7483,9 +7476,9 @@ const tm = {
7483
7476
  const G = X(u);
7484
7477
  G.current = u;
7485
7478
  const ge = X(null), ae = M(() => ge.current !== null, []);
7486
- ql(h, ae);
7479
+ Dl(h, ae);
7487
7480
  const Ne = M(() => v.current.map((se) => se.id), []);
7488
- Dl(`${B} ${D}`, Ne);
7481
+ Rl(`${B} ${D}`, Ne);
7489
7482
  const R = X(null), [ne, le] = Se(null), ie = i == null ? void 0 : i.havingDispatch, L = X({
7490
7483
  where: t,
7491
7484
  having: ie
@@ -7922,11 +7915,11 @@ const tm = {
7922
7915
  () => m ? h.map((se) => ({ ...se, draggable: !1 })) : h,
7923
7916
  [h, m]
7924
7917
  );
7925
- return /* @__PURE__ */ o(Bl.Provider, { value: i == null ? void 0 : i.measureLock, children: /* @__PURE__ */ o(xl.Provider, { value: (i == null ? void 0 : i.unionBranch) ?? !1, children: /* @__PURE__ */ o(Ll.Provider, { value: Fe, children: /* @__PURE__ */ o(El.Provider, { value: _, children: /* @__PURE__ */ C(
7918
+ return /* @__PURE__ */ o(Ol.Provider, { value: i == null ? void 0 : i.measureLock, children: /* @__PURE__ */ o(vl.Provider, { value: (i == null ? void 0 : i.unionBranch) ?? !1, children: /* @__PURE__ */ o(Pl.Provider, { value: Fe, children: /* @__PURE__ */ o(kl.Provider, { value: _, children: /* @__PURE__ */ C(
7926
7919
  Za,
7927
7920
  {
7928
7921
  colorMode: "dark",
7929
- onNodeMouseMove: b ? (se, ue) => b(Pl(ue, se.currentTarget, se.target)) : void 0,
7922
+ onNodeMouseMove: b ? (se, ue) => b(Ml(ue, se.currentTarget, se.target)) : void 0,
7930
7923
  onNodeMouseLeave: b ? () => b(null) : void 0,
7931
7924
  nodes: je,
7932
7925
  edges: u,
@@ -7942,8 +7935,8 @@ const tm = {
7942
7935
  defaultEdgeOptions: O,
7943
7936
  children: [
7944
7937
  !n && /* @__PURE__ */ o(ec, { showInteractive: !1 }),
7945
- /* @__PURE__ */ o(Fl, {}),
7946
- /* @__PURE__ */ o(Rl, { nodeIds: nm })
7938
+ /* @__PURE__ */ o(Ll, {}),
7939
+ /* @__PURE__ */ o(Fl, { nodeIds: nm })
7947
7940
  ]
7948
7941
  }
7949
7942
  ) }) }) }) });
@@ -8011,7 +8004,7 @@ const tm = {
8011
8004
  children: [
8012
8005
  /* @__PURE__ */ o("span", { className: "text-qb-field-text-subtle text-xs leading-none", children: g.label }),
8013
8006
  /* @__PURE__ */ o(
8014
- yl,
8007
+ xl,
8015
8008
  {
8016
8009
  argDef: g,
8017
8010
  value: r,
@@ -8091,7 +8084,7 @@ const tm = {
8091
8084
  )
8092
8085
  ] });
8093
8086
  }, om = ({ data: e }) => {
8094
- const t = fe(), n = Dt(), r = Ts(), s = $o(), { names: i, groupOf: a, searchText: c } = ll(), {
8087
+ const t = fe(), n = Dt(), r = Ts(), s = $o(), { names: i, groupOf: a, searchText: c } = dl(), {
8095
8088
  fn: l,
8096
8089
  path: h,
8097
8090
  direction: d,
@@ -8148,14 +8141,14 @@ const tm = {
8148
8141
  searchText: c,
8149
8142
  inputValue: l.name,
8150
8143
  onInputChange: (b) => {
8151
- const N = gc(b, s);
8144
+ const N = bc(b, s);
8152
8145
  if (N) {
8153
8146
  p({
8154
8147
  type: "exprSelectFn",
8155
8148
  path: h,
8156
8149
  // Typed by another name (GROUP_CONCAT): stored by its own.
8157
8150
  name: N.name === b.toUpperCase() ? b : N.name,
8158
- args: bc(N)
8151
+ args: yc(N)
8159
8152
  });
8160
8153
  return;
8161
8154
  }
@@ -8232,7 +8225,7 @@ function La(e) {
8232
8225
  const im = {
8233
8226
  fnCallFlow: La(om),
8234
8227
  fnArgFlow: La(rm),
8235
- groupBg: kl
8228
+ groupBg: Bl
8236
8229
  };
8237
8230
  function Pa(e, t, n, r) {
8238
8231
  const s = Nh(e, t, n, r), i = (c) => c.reduce(
@@ -8240,7 +8233,7 @@ function Pa(e, t, n, r) {
8240
8233
  e
8241
8234
  ), a = s.nodes.map((c) => {
8242
8235
  const { path: l } = c.data;
8243
- return (l == null ? void 0 : l.some((d, p) => xc(i(l.slice(0, p)), n))) ? { ...c, data: { ...c.data, underAggregate: !0 } } : c;
8236
+ return (l == null ? void 0 : l.some((d, p) => vc(i(l.slice(0, p)), n))) ? { ...c, data: { ...c.data, underAggregate: !0 } } : c;
8244
8237
  });
8245
8238
  return { ...s, nodes: a };
8246
8239
  }
@@ -8280,7 +8273,7 @@ const cm = (e) => wh(e.path), lm = ({
8280
8273
  }) => {
8281
8274
  const s = Oo(), { fitView: i } = wr(), a = Dt(), c = X(a);
8282
8275
  c.current = a;
8283
- const l = jo(), h = rl(), d = X(l);
8276
+ const l = jo(), h = sl(), d = X(l);
8284
8277
  d.current = l;
8285
8278
  const p = X(!1), [u, f, g] = Ya([]), [y, v] = Ja([]), m = X(e);
8286
8279
  m.current = e;
@@ -8295,9 +8288,9 @@ const cm = (e) => wh(e.path), lm = ({
8295
8288
  s(b.current.map((ie) => ie.id));
8296
8289
  }, [r]);
8297
8290
  const O = X(!1), z = X(null), D = M(() => z.current !== null, []);
8298
- ql(u, D);
8291
+ Dl(u, D);
8299
8292
  const T = M(() => b.current.map((ie) => ie.id), []);
8300
- Dl(l, T);
8293
+ Rl(l, T);
8301
8294
  const A = M((ie) => {
8302
8295
  if (ie.type === "exprReorderArg") {
8303
8296
  const { path: L, direction: K } = ie, H = K === "up" ? L[L.length - 1] - 1 : L[L.length - 1] + 1, ee = L.slice(0, -1).join(","), de = b.current.find((P) => {
@@ -8420,7 +8413,7 @@ const cm = (e) => wh(e.path), lm = ({
8420
8413
  Za,
8421
8414
  {
8422
8415
  colorMode: "dark",
8423
- onNodeMouseMove: ne ? (ie, L) => ne(Pl(L, ie.currentTarget, ie.target)) : void 0,
8416
+ onNodeMouseMove: ne ? (ie, L) => ne(Ml(L, ie.currentTarget, ie.target)) : void 0,
8424
8417
  onNodeMouseLeave: ne ? () => ne(null) : void 0,
8425
8418
  nodes: le,
8426
8419
  edges: y,
@@ -8436,8 +8429,8 @@ const cm = (e) => wh(e.path), lm = ({
8436
8429
  defaultEdgeOptions: h,
8437
8430
  children: [
8438
8431
  !n && /* @__PURE__ */ o(ec, { showInteractive: !1 }),
8439
- /* @__PURE__ */ o(Fl, {}),
8440
- /* @__PURE__ */ o(Rl, { nodeIds: cm })
8432
+ /* @__PURE__ */ o(Ll, {}),
8433
+ /* @__PURE__ */ o(Fl, { nodeIds: cm })
8441
8434
  ]
8442
8435
  }
8443
8436
  );
@@ -8672,7 +8665,7 @@ function fm(e, { schema: t, functions: n } = {}) {
8672
8665
  function mm(e = ((t) => (t = globalThis.navigator) == null ? void 0 : t.platform)() ?? "") {
8673
8666
  return /Mac|iPhone|iPad/.test(e) ? "⌘F" : "Ctrl+F";
8674
8667
  }
8675
- function Ml(e, t) {
8668
+ function _l(e, t) {
8676
8669
  switch (e) {
8677
8670
  case "from":
8678
8671
  return t.sectionFrom;
@@ -8691,7 +8684,7 @@ function Ml(e, t) {
8691
8684
  function gm(e, t) {
8692
8685
  switch (e.kind) {
8693
8686
  case "section":
8694
- return Ml(e.section, t);
8687
+ return _l(e.section, t);
8695
8688
  case "subQuery":
8696
8689
  case "sharedQuery":
8697
8690
  case "table":
@@ -8741,7 +8734,7 @@ const bm = ({
8741
8734
  const s = fe(), i = qt(), a = Dt(), c = we(() => {
8742
8735
  if (!t) return [];
8743
8736
  const l = fm(e, { schema: i, functions: a }).map((d) => {
8744
- const p = Nc(e, d.pathSegments, { schema: i, functions: a }), u = p.slice(0, 1), f = p.slice(1), g = f.length > 0 && ts(f.slice(-1), s) === d.text;
8737
+ const p = Ic(e, d.pathSegments, { schema: i, functions: a }), u = p.slice(0, 1), f = p.slice(1), g = f.length > 0 && ts(f.slice(-1), s) === d.text;
8745
8738
  return {
8746
8739
  ...d,
8747
8740
  place: ts(u, s),
@@ -8761,7 +8754,7 @@ const bm = ({
8761
8754
  "aria-label": l,
8762
8755
  onClick: () => n(!0),
8763
8756
  className: "text-qb-text-muted hover:text-qb-text",
8764
- children: /* @__PURE__ */ o(md, { className: "w-4 h-4" })
8757
+ children: /* @__PURE__ */ o(gd, { className: "w-4 h-4" })
8765
8758
  }
8766
8759
  ) }) });
8767
8760
  }
@@ -8807,7 +8800,7 @@ const bm = ({
8807
8800
  cross: "CROSS JOIN"
8808
8801
  };
8809
8802
  function vm(e, t, n) {
8810
- const r = t.schema ?? mc, s = (u) => ({ text: u }), i = (u) => ({ text: u, role: "keyword" }), a = (u) => {
8803
+ const r = t.schema ?? gc, s = (u) => ({ text: u }), i = (u) => ({ text: u, role: "keyword" }), a = (u) => {
8811
8804
  var y;
8812
8805
  const f = u.table === void 0 || (y = Ve(r, u.table)) == null ? void 0 : y.label, g = { text: f ?? u.alias ?? u.table ?? "", role: "column" };
8813
8806
  return f !== void 0 && u.alias ? [g, s(" "), i("AS"), s(" "), { text: u.alias, role: "column" }] : [g];
@@ -8824,7 +8817,7 @@ function vm(e, t, n) {
8824
8817
  }),
8825
8818
  ...f
8826
8819
  ], l = (u) => {
8827
- const f = vc(u.query), g = { tables: c(f, r.tables) }, y = jd(r, u);
8820
+ const f = wc(u.query), g = { tables: c(f, r.tables) }, y = $d(r, u);
8828
8821
  return {
8829
8822
  ...y,
8830
8823
  columns: y.columns.map((v) => {
@@ -8884,7 +8877,7 @@ function vm(e, t, n) {
8884
8877
  ], ["select", A, "expression"]))],
8885
8878
  ["order", z]
8886
8879
  ].filter(([, T]) => T.length > 0).flatMap(([T, A]) => [
8887
- { depth: y, heading: Ml(T, n) },
8880
+ { depth: y, heading: _l(T, n) },
8888
8881
  ...A
8889
8882
  ]);
8890
8883
  }
@@ -8907,7 +8900,7 @@ function wm(e, t, n) {
8907
8900
  if (!n || !t.pathSegments) return !1;
8908
8901
  const r = n.queryPath ?? [], s = (h, d) => h.length === d.length && h.every((p, u) => p === d[u]);
8909
8902
  if (n.pipeline) return t.opens !== void 0 && s(t.opens, r);
8910
- const i = n.scopeRoot, a = Kc(e, t.pathSegments);
8903
+ const i = n.scopeRoot, a = Yc(e, t.pathSegments);
8911
8904
  if (!s(a.queryPath ?? [], r)) return !1;
8912
8905
  if (t.joinId !== void 0)
8913
8906
  return i !== void 0 && "joinId" in i && i.joinId === t.joinId;
@@ -9013,9 +9006,9 @@ const Nm = ({
9013
9006
  }
9014
9007
  );
9015
9008
  }, Im = (e, t) => t[`issue${e[0].toUpperCase()}${e.slice(1)}`];
9016
- function _l(e, t) {
9009
+ function jl(e, t) {
9017
9010
  var n;
9018
- return e.type === "function" && ((n = Qt(e.name, t)) != null && n.aggregate) ? Qt(e.name, t).name : yu(e).map((r) => _l(r, t)).find(Boolean);
9011
+ return e.type === "function" && ((n = Qt(e.name, t)) != null && n.aggregate) ? Qt(e.name, t).name : yu(e).map((r) => jl(r, t)).find(Boolean);
9019
9012
  }
9020
9013
  function ja(e, t) {
9021
9014
  return t.reduce(
@@ -9118,7 +9111,7 @@ function Sm(e, t, { schema: n, functions: r }, s) {
9118
9111
  return m ? s.issueNotGroupedNamed(m) : h;
9119
9112
  }
9120
9113
  case "misplacedAggregate": {
9121
- const m = a && _l(a, r);
9114
+ const m = a && jl(a, r);
9122
9115
  return m ? s.issueMisplacedAggregateNamed(m) : h;
9123
9116
  }
9124
9117
  default:
@@ -9166,7 +9159,7 @@ const Bm = () => /* @__PURE__ */ o(Ka, { className: "w-3.5 h-3.5" }), Om = () =>
9166
9159
  const a = fe(), c = qt(), l = Dt(), [h, d] = Se(null);
9167
9160
  if (e.length === 0 && r.length === 0) return null;
9168
9161
  const p = (O) => {
9169
- const z = t ? Nc(t, O, { schema: c, functions: l }) : [];
9162
+ const z = t ? Ic(t, O, { schema: c, functions: l }) : [];
9170
9163
  return { place: km(z), location: ts(z, a) };
9171
9164
  }, u = [
9172
9165
  ...e.map((O, z) => ({
@@ -9283,7 +9276,7 @@ const Bm = () => /* @__PURE__ */ o(Ka, { className: "w-3.5 h-3.5" }), Om = () =>
9283
9276
  s ? "opacity-50 cursor-default" : "cursor-pointer"
9284
9277
  ),
9285
9278
  children: [
9286
- /* @__PURE__ */ o(gd, { className: "w-3.5 h-3.5" }),
9279
+ /* @__PURE__ */ o(bd, { className: "w-3.5 h-3.5" }),
9287
9280
  t ? r.running : r.run
9288
9281
  ]
9289
9282
  }
@@ -9388,7 +9381,7 @@ const Lm = ({ run: e }) => {
9388
9381
  (n, r) => typeof n == "object" && n !== null ? n[r] : void 0,
9389
9382
  e
9390
9383
  ), Io = (e) => !e || e.type === "field" && !e.column || e.type === "literal" && e.value === "" && !e.empty || e.type === "list" && e.items.every(Io), jm = /* @__PURE__ */ new Set(["select", "groupBy", "orderBy", "joins", "shared"]);
9391
- function jl(e) {
9384
+ function $l(e) {
9392
9385
  return e.flatMap((t, n) => typeof t == "object" && (t.kind === "left" || t.kind === "right") ? [fr(e.slice(0, n + 1))] : []);
9393
9386
  }
9394
9387
  function za(e, t, n, r) {
@@ -9399,14 +9392,14 @@ function za(e, t, n, r) {
9399
9392
  const [p, u] = t.slice(l + 1), f = r.map((y) => typeof y == "object" && y.kind === "right").lastIndexOf(!0), g = (h == null ? void 0 : h.type) === "binary" && h.operator === "BETWEEN" && t[l] === "right" && p === "items" && typeof u == "number" && f >= 0;
9400
9393
  return [
9401
9394
  ...c,
9402
- ...jl(r),
9403
- ...g ? [fl(r.slice(0, f + 1), u)] : []
9395
+ ...$l(r),
9396
+ ...g ? [ml(r.slice(0, f + 1), u)] : []
9404
9397
  ];
9405
9398
  }
9406
- const $m = ["where", "having"], zm = {}, Vr = (e) => e.join("\0"), Um = lu(), Gm = 2500, Hm = 700;
9399
+ const $m = ["where", "having"], zm = {}, Vr = (e) => e.join("\0"), Um = du(), Gm = 2500, Hm = 700;
9407
9400
  function Qm(e, t, n, r) {
9408
9401
  var u, f;
9409
- const s = vc(n.query), i = s.groupBy ?? [], { copied: a } = n.drillAcross, c = ((u = s.where) == null ? void 0 : u.type) === "logical" && s.where.operator === "AND" ? s.where.operands : [s.where], l = (g) => {
9402
+ const s = wc(n.query), i = s.groupBy ?? [], { copied: a } = n.drillAcross, c = ((u = s.where) == null ? void 0 : u.type) === "logical" && s.where.operator === "AND" ? s.where.operands : [s.where], l = (g) => {
9410
9403
  var y, v;
9411
9404
  return g.type === "field" && g.table && g.column ? ((v = (y = Ve(e, g.table)) == null ? void 0 : y.columns.find((m) => m.name === g.column)) == null ? void 0 : v.label) ?? g.column : xt(g);
9412
9405
  }, h = r.measureFollows(i.map((g) => l(g.expression)).join(", ")), d = c.slice(0, a).map((g) => xt(g)), p = t.from.table === void 0 ? t.from.alias : ((f = Ve(e, t.from.table)) == null ? void 0 : f.label) ?? t.from.table;
@@ -9437,7 +9430,7 @@ const Ua = {
9437
9430
  right: { type: "literal", value: "" }
9438
9431
  }
9439
9432
  ]
9440
- }, $l = {
9433
+ }, zl = {
9441
9434
  type: "binary",
9442
9435
  left: { type: "field" },
9443
9436
  right: { type: "literal", value: "" }
@@ -9449,14 +9442,14 @@ const Ua = {
9449
9442
  }, Km = {
9450
9443
  type: "logical",
9451
9444
  operator: "AND",
9452
- operands: [{ ...$l }]
9445
+ operands: [{ ...zl }]
9453
9446
  };
9454
9447
  function Ym(e, t) {
9455
9448
  switch (t.type) {
9456
9449
  case "change":
9457
9450
  return t.path.length === 0 ? t.exp : yr(e, t.path, t.exp) ?? e;
9458
9451
  case "addCondition":
9459
- return Ht(e, t.path, { ...$l });
9452
+ return Ht(e, t.path, { ...zl });
9460
9453
  case "addGroup":
9461
9454
  return Ht(e, t.path, { ...Km });
9462
9455
  case "addExists":
@@ -9475,20 +9468,20 @@ function Ym(e, t) {
9475
9468
  return { type: "logical", operator: "AND", operands: [e] };
9476
9469
  case "crossMove": {
9477
9470
  const { sourcePath: n, targetParentPath: r, targetIndex: s } = t;
9478
- return Dc(e, n, r, s);
9471
+ return Rc(e, n, r, s);
9479
9472
  }
9480
9473
  case "addBranch":
9481
- return Rc(e, t.path);
9474
+ return Fc(e, t.path);
9482
9475
  case "removeBranch":
9483
- return Fc(e, t.path, t.index);
9476
+ return Lc(e, t.path, t.index);
9484
9477
  case "reorderBranch":
9485
- return Lc(e, t.path, t.index, t.direction);
9478
+ return Pc(e, t.path, t.index, t.direction);
9486
9479
  case "moveBranch":
9487
- return Pc(e, t.casePath, t.fromIndex, t.toIndex);
9480
+ return Mc(e, t.casePath, t.fromIndex, t.toIndex);
9488
9481
  case "changeBranch":
9489
- return Mc(e, t.path, t.index, t.branch);
9482
+ return _c(e, t.path, t.index, t.branch);
9490
9483
  case "changeCaseElse":
9491
- return _c(e, t.path, t.else);
9484
+ return jc(e, t.path, t.else);
9492
9485
  case "addCase":
9493
9486
  case "addIf":
9494
9487
  return ho(e, t);
@@ -9598,7 +9591,7 @@ const dg = So(({
9598
9591
  var k;
9599
9592
  K.current || (oe.current = w, I.current || de(x), (k = V.current) == null || k.call(V, x));
9600
9593
  }, []), Ie = M((x, w, k) => {
9601
- const S = $d(Q.current, se.current, x, pe.current);
9594
+ const S = zd(Q.current, se.current, x, pe.current);
9602
9595
  he(S, {
9603
9596
  kind: "edit",
9604
9597
  next: S,
@@ -9630,15 +9623,15 @@ const dg = So(({
9630
9623
  const ht = M(() => {
9631
9624
  E.current = null, je(Ws());
9632
9625
  }, []), $e = JSON.stringify(u ?? {}), ke = we(
9633
- () => ({ ...tl, ...u }),
9626
+ () => ({ ...nl, ...u }),
9634
9627
  // eslint-disable-next-line react-hooks/exhaustive-deps
9635
9628
  [$e]
9636
- ), Ye = JSON.stringify(p ?? {}), qe = we(() => au(p), [Ye]), Pe = X(null), [te, $] = Se(
9629
+ ), Ye = JSON.stringify(p ?? {}), qe = we(() => cu(p), [Ye]), Pe = X(null), [te, $] = Se(
9637
9630
  () => ({ ...Vi, ...p })
9638
9631
  );
9639
9632
  br(() => {
9640
9633
  if (!Pe.current) return;
9641
- const x = cu(Pe.current, { ...Vi, ...p });
9634
+ const x = lu(Pe.current, { ...Vi, ...p });
9642
9635
  $((w) => JSON.stringify(w) === JSON.stringify(x) ? w : x);
9643
9636
  }, [Ye]);
9644
9637
  const Be = f, { Provider: Je } = Be, Xe = we(() => wu(t), [t]), mt = Xe.map((x) => x.message).join(`
@@ -9683,7 +9676,7 @@ ${mt}`));
9683
9676
  S !== st.current && (st.current = S, (q = et.current) == null || q.call(et, k));
9684
9677
  });
9685
9678
  } : null, Qe = M((x, w = it) => {
9686
- const k = se.current, S = zd(Q.current, k, w, x);
9679
+ const k = se.current, S = Ud(Q.current, k, w, x);
9687
9680
  if (S === k) return;
9688
9681
  const q = x.type === "setSelectAlias" ? `select-alias:${[...w, x.selectId].join("/")}` : void 0;
9689
9682
  Ie(S, vn({ scope: "structural", key: q }, w), q !== void 0);
@@ -9718,7 +9711,7 @@ ${mt}`));
9718
9711
  if (pt === Le.expression || pt === void 0) return;
9719
9712
  const Gt = k ? at(ct, lt, x) : x;
9720
9713
  Ae(
9721
- Ud(Q.current, me, Le.id, pt),
9714
+ Gd(Q.current, me, Le.id, pt),
9722
9715
  { scope: "groupBy", groupById: S.groupById, path: Gt },
9723
9716
  k
9724
9717
  );
@@ -9742,7 +9735,7 @@ ${mt}`));
9742
9735
  if (pt === Le.expression || pt === void 0) return;
9743
9736
  const Gt = k ? at(ct, lt, x) : x;
9744
9737
  Ae(
9745
- Gd(Q.current, me, Le.id, pt),
9738
+ Hd(Q.current, me, Le.id, pt),
9746
9739
  { scope: "orderBy", orderById: S.orderById, path: Gt },
9747
9740
  k
9748
9741
  );
@@ -9755,7 +9748,7 @@ ${mt}`));
9755
9748
  if (pt === Le.expression || pt === void 0) return;
9756
9749
  const Gt = k ? at(ct, lt, x) : x;
9757
9750
  Ae(
9758
- Hd(Q.current, me, Le.id, pt),
9751
+ Qd(Q.current, me, Le.id, pt),
9759
9752
  { scope: "select", selectId: S.selectId, path: Gt },
9760
9753
  k
9761
9754
  );
@@ -9764,7 +9757,7 @@ ${mt}`));
9764
9757
  if (S) {
9765
9758
  const Le = me.joins.find((sn) => sn.id === S.joinId);
9766
9759
  if (!Le) return;
9767
- const ct = Ct(Le.on, x), lt = w(ct), pt = Qd(
9760
+ const ct = Ct(Le.on, x), lt = w(ct), pt = Vd(
9768
9761
  Q.current,
9769
9762
  ut(Le.on, x, lt)
9770
9763
  );
@@ -9797,7 +9790,7 @@ ${mt}`));
9797
9790
  if (Vu(J, x)) return;
9798
9791
  const w = Xi(yt(se.current), x), k = w.length > 0 ? w[w.length - 1].label : "Main";
9799
9792
  ce(w), qs.current && clearTimeout(qs.current), qs.current = setTimeout(() => As(null), Gm), As({ label: k });
9800
- }, [J]), [en, Er] = Se(null), [zl, Vo] = Se(!1), [Ul, Gl] = Se(le === "folded"), Wo = X(!1);
9793
+ }, [J]), [en, Er] = Se(null), [Ul, Vo] = Se(!1), [Gl, Hl] = Se(le === "folded"), Wo = X(!1);
9801
9794
  He(() => {
9802
9795
  const x = (w) => {
9803
9796
  var k;
@@ -9818,10 +9811,10 @@ ${mt}`));
9818
9811
  const En = X(null), kn = M((x) => {
9819
9812
  const w = yt(se.current);
9820
9813
  if (!w) return !1;
9821
- const k = Kc(w, x.pathSegments), { severity: S } = x, { local: q } = Mo(w, x.pathSegments), W = Jm[String(q[0])];
9814
+ const k = Yc(w, x.pathSegments), { severity: S } = x, { local: q } = Mo(w, x.pathSegments), W = Jm[String(q[0])];
9822
9815
  let me;
9823
9816
  if (k.scope === "structural") {
9824
- const Ae = Bc(w, k.queryPath ?? []);
9817
+ const Ae = Oc(w, k.queryPath ?? []);
9825
9818
  ce(Ae);
9826
9819
  const Ge = za(w, x.pathSegments, q, []);
9827
9820
  me = W ? {
@@ -9870,15 +9863,15 @@ ${mt}`));
9870
9863
  }
9871
9864
  }, []), Kn = M(() => {
9872
9865
  Xo();
9873
- }, [Xo]), Hl = M(() => {
9866
+ }, [Xo]), Ql = M(() => {
9874
9867
  kr.current += 1, Ds(null);
9875
9868
  }, []), Zo = X(G);
9876
9869
  Zo.current = G;
9877
- const [An, Ql] = Se(), [Vl, ei] = Se(!1), [Wl, ti] = Se(), Kl = M(async () => {
9870
+ const [An, Vl] = Se(), [Wl, ei] = Se(!1), [Kl, ti] = Se(), Yl = M(async () => {
9878
9871
  const x = yt(se.current);
9879
9872
  ei(!0), ti(void 0);
9880
9873
  try {
9881
- Ql({ query: x, findings: await Zo.current(x) });
9874
+ Vl({ query: x, findings: await Zo.current(x) });
9882
9875
  } catch (w) {
9883
9876
  ti($a(w));
9884
9877
  } finally {
@@ -9889,7 +9882,7 @@ ${mt}`));
9889
9882
  const k = Q.current, S = se.current;
9890
9883
  return (w === "base" ? !ss(S) && Ve(k, x) !== void 0 : ss(S) && cc(k, S).some((W) => W.name === x)) ? (Qe(w === "base" ? { type: "setBaseTable", table: x } : { type: "addJoin", table: x }), !0) : !1;
9891
9884
  }, [Qe]);
9892
- dd(
9885
+ ud(
9893
9886
  ie,
9894
9887
  () => ({
9895
9888
  resetHistory: ht,
@@ -9919,7 +9912,7 @@ ${mt}`));
9919
9912
  scopeRoot: x,
9920
9913
  ...w.length > 0 ? { queryPath: w } : {}
9921
9914
  }]), !k) return;
9922
- const q = jl(k);
9915
+ const q = $l(k);
9923
9916
  Er({
9924
9917
  depth: ye.current.length + 1,
9925
9918
  target: { path: k, ...q.length > 0 && { parts: q } }
@@ -9966,7 +9959,7 @@ ${mt}`));
9966
9959
  pipeline: !0,
9967
9960
  pendingSubQuery: x
9968
9961
  }]);
9969
- }, [tt.newSubQuery]), Jn = (T == null ? void 0 : T.shared) === !0, tn = we(() => _.shared ?? [], [_]), ii = we(() => ku(_), [_]), [ai, Yl] = Se(null), ci = M((x) => {
9962
+ }, [tt.newSubQuery]), Jn = (T == null ? void 0 : T.shared) === !0, tn = we(() => _.shared ?? [], [_]), ii = we(() => ku(_), [_]), [ai, Jl] = Se(null), ci = M((x) => {
9970
9963
  const w = tn.findIndex((k) => k.id === x[0]);
9971
9964
  return w < 0 ? tn : tn.slice(0, w);
9972
9965
  }, [tn]), Wt = M((x, w) => {
@@ -10010,7 +10003,7 @@ ${mt}`));
10010
10003
  }, [Ie]), ui = M((x, w) => {
10011
10004
  const k = yt(se.current);
10012
10005
  if (!k) return;
10013
- const S = cr(k, x, (q) => ru(Q.current, q, w));
10006
+ const S = cr(k, x, (q) => su(Q.current, q, w));
10014
10007
  Ie(S, vn({ scope: "structural" }, x), !1);
10015
10008
  }, [Ie]), hi = M(() => {
10016
10009
  ce((x) => x.slice(0, -1));
@@ -10105,7 +10098,7 @@ ${mt}`));
10105
10098
  onRemove: (S, q) => Wt((W) => qu(W, S, q), it),
10106
10099
  onOpen: (S, q) => qn(S, q, it),
10107
10100
  ...Jn && !m ? { onCreate: () => Fs(it, !1) } : {},
10108
- onHover: Yl
10101
+ onHover: Jl
10109
10102
  }
10110
10103
  } : {},
10111
10104
  selectsAggregate: x ? Nu(x, xe) : !0,
@@ -10113,7 +10106,7 @@ ${mt}`));
10113
10106
  aggregateColumns: x && $i(x, xe),
10114
10107
  measures: x && {
10115
10108
  grouped: (x.groupBy ?? []).length > 0,
10116
- facts: () => Wd(L, x),
10109
+ facts: () => Kd(L, x),
10117
10110
  onAdd: (S, q, W) => ui(w, {
10118
10111
  selectId: S,
10119
10112
  table: q,
@@ -10123,8 +10116,8 @@ ${mt}`));
10123
10116
  // On every query's canvas but a union's own queries' (see `panels`).
10124
10117
  // Adding a table's rows (the guided path) is the whole query's.
10125
10118
  unions: Xn ? {
10126
- tables: x && w.length === 0 ? Vd(L, x, Br).map((S) => Ve(L, S)) : [],
10127
- onAdd: (S) => nn(w, (q) => tu(
10119
+ tables: x && w.length === 0 ? Wd(L, x, Br).map((S) => Ve(L, S)) : [],
10120
+ onAdd: (S) => nn(w, (q) => nu(
10128
10121
  Q.current,
10129
10122
  q,
10130
10123
  { table: S, columns: [] },
@@ -10132,16 +10125,16 @@ ${mt}`));
10132
10125
  )),
10133
10126
  onRemove: (S, q) => nn(
10134
10127
  w,
10135
- (W) => eu(W, q, S)
10128
+ (W) => tu(W, q, S)
10136
10129
  ),
10137
- onUnwrap: (S) => nn(w, (q) => Zd(q, S)),
10130
+ onUnwrap: (S) => nn(w, (q) => eu(q, S)),
10138
10131
  free: di ? {
10139
10132
  // An empty query's: the whole query's only (a sub query always has
10140
10133
  // a table).
10141
10134
  onCreate: w.length > 0 ? void 0 : () => {
10142
10135
  const S = Jt();
10143
10136
  Zn(w, S, 0, (q) => Ie(
10144
- Xd(
10137
+ Zd(
10145
10138
  se.current.id,
10146
10139
  S,
10147
10140
  Gi(Q.current),
@@ -10155,7 +10148,7 @@ ${mt}`));
10155
10148
  const S = Jt();
10156
10149
  Zn(w, S, 1, (q) => nn(w, (W) => Ui(
10157
10150
  Q.current,
10158
- Jd(W, S, Gi(Q.current, W)),
10151
+ Xd(W, S, Gi(Q.current, W)),
10159
10152
  S,
10160
10153
  q
10161
10154
  )));
@@ -10164,10 +10157,10 @@ ${mt}`));
10164
10157
  const S = Jt();
10165
10158
  Zn(w, S, 0, (q) => nn(
10166
10159
  w,
10167
- (W) => Yd(Q.current, W, S, q)
10160
+ (W) => Jd(Q.current, W, S, q)
10168
10161
  ));
10169
10162
  },
10170
- onSetAll: (S, q) => nn(w, (W) => Kd(W, S, q)),
10163
+ onSetAll: (S, q) => nn(w, (W) => Yd(W, S, q)),
10171
10164
  // (Offered on a union's row only: the query and it are there.)
10172
10165
  onAddBranch: (S) => {
10173
10166
  const q = Su(zi(x).find((W) => W.id === S).query).length;
@@ -10214,21 +10207,21 @@ ${mt}`));
10214
10207
  ai,
10215
10208
  ii,
10216
10209
  m
10217
- ]), Jl = we(
10210
+ ]), Xl = we(
10218
10211
  () => er(j, it, Ms.having),
10219
10212
  [er, j, Ms.having]
10220
- ), Xl = we(
10213
+ ), Zl = we(
10221
10214
  () => j ? Hi(L, j, j.shared) : [],
10222
10215
  [j, L]
10223
- ), Zl = we(
10216
+ ), ed = we(
10224
10217
  () => j && Gs(L, j),
10225
10218
  [j, L]
10226
- ), ed = we(
10219
+ ), td = we(
10227
10220
  () => j && Hs(L, j),
10228
10221
  [j, L]
10229
- ), td = we(() => ({ drillDown: Yn(void 0), basePath: Ze }), [
10222
+ ), nd = we(() => ({ drillDown: Yn(void 0), basePath: Ze }), [
10230
10223
  Yn
10231
- ]), nd = we(() => J.map((x) => {
10224
+ ]), rd = we(() => J.map((x) => {
10232
10225
  var Ci, Ti, Ei, ki, Bi, Oi, Ai;
10233
10226
  const { scopeRoot: w } = x, k = x.queryPath ?? it, S = gt(j, k), q = qr(S), W = S ? Hi(L, S, tn) : [];
10234
10227
  if (x.pipeline) {
@@ -10243,7 +10236,7 @@ ${mt}`));
10243
10236
  dispatch: (Lt) => {
10244
10237
  if (Lt.type !== "setBaseTable") return;
10245
10238
  const Ri = /* @__PURE__ */ new Map();
10246
- Rs(J, k, { table: Lt.table }, Ri), ce((ad) => ad.map((Pr) => {
10239
+ Rs(J, k, { table: Lt.table }, Ri), ce((cd) => cd.map((Pr) => {
10247
10240
  const Fi = Pr.pendingSubQuery && Ri.get(Vr(Pr.queryPath));
10248
10241
  return Fi ? { ...Pr, label: Fi, pendingSubQuery: void 0 } : Pr;
10249
10242
  }));
@@ -10258,8 +10251,8 @@ ${mt}`));
10258
10251
  pendingSubQuery: "nestedBase"
10259
10252
  }])
10260
10253
  });
10261
- const Di = gt(j, k.slice(0, -1)), id = k[k.length - 1];
10262
- return De && Di && nu(Di).some((Lt) => Lt.id === id) && (De = { ...De, maxColumns: 1 }), {
10254
+ const Di = gt(j, k.slice(0, -1)), ad = k[k.length - 1];
10255
+ return De && Di && ru(Di).some((Lt) => Lt.id === ad) && (De = { ...De, maxColumns: 1 }), {
10263
10256
  ast: void 0,
10264
10257
  menu: q.where,
10265
10258
  fieldTables: void 0,
@@ -10287,7 +10280,7 @@ ${mt}`));
10287
10280
  const Ft = [De.from, ...De.joins];
10288
10281
  Ut = ot ? sa(L, Ft, Or, Ge.taken) : null;
10289
10282
  }
10290
- const Rr = [...x.path.keys(), x.path.length].map((De) => Ct(me, x.path.slice(0, De))), tr = (De) => De !== void 0 && xc(De, xe), Fr = Rr.slice(0, -1).some(tr), Le = !Ge && !Fr && w !== void 0 && ("selectId" in w || "orderById" in w || "having" in w), ct = !Ge && (Ae === "joinOn" || k.length > 0 && w !== void 0 && ("selectId" in w || "groupById" in w)), lt = Rr.some(tr), Gt = !Ge && !lt && w !== void 0 && ("orderById" in w || "having" in w) && S ? Wi(S, xe) : void 0, Kt = Gt && S && {
10283
+ const Rr = [...x.path.keys(), x.path.length].map((De) => Ct(me, x.path.slice(0, De))), tr = (De) => De !== void 0 && vc(De, xe), Fr = Rr.slice(0, -1).some(tr), Le = !Ge && !Fr && w !== void 0 && ("selectId" in w || "orderById" in w || "having" in w), ct = !Ge && (Ae === "joinOn" || k.length > 0 && w !== void 0 && ("selectId" in w || "groupById" in w)), lt = Rr.some(tr), Gt = !Ge && !lt && w !== void 0 && ("orderById" in w || "having" in w) && S ? Wi(S, xe) : void 0, Kt = Gt && S && {
10291
10284
  keys: new Set(Gt),
10292
10285
  columns: $i(S, xe)
10293
10286
  }, sn = x.path[x.path.length - 1], $s = w && "joinId" in w ? w.joinId : void 0;
@@ -10334,7 +10327,7 @@ ${mt}`));
10334
10327
  return `${S.alias}: ${((q = Ve(L, W)) == null ? void 0 : q.label) ?? W}`;
10335
10328
  }
10336
10329
  return (S == null ? void 0 : S.alias) ?? x.label;
10337
- }), [J, j, tt.subqueryLabel, L]), Dr = J.length > 0, [rd, js] = Se(!0), [sd, od] = Se(0);
10330
+ }), [J, j, tt.subqueryLabel, L]), Dr = J.length > 0, [sd, js] = Se(!0), [od, id] = Se(0);
10338
10331
  He(() => {
10339
10332
  if (Dr) {
10340
10333
  js(!1);
@@ -10342,7 +10335,7 @@ ${mt}`));
10342
10335
  }
10343
10336
  js(!1);
10344
10337
  const x = setTimeout(() => {
10345
- js(!0), od((w) => w + 1);
10338
+ js(!0), id((w) => w + 1);
10346
10339
  }, 350);
10347
10340
  return () => clearTimeout(x);
10348
10341
  }, [Dr]);
@@ -10357,7 +10350,7 @@ ${mt}`));
10357
10350
  const w = setTimeout(() => Si(x), 80);
10358
10351
  return () => clearTimeout(w);
10359
10352
  }
10360
- }, [J.length]), /* @__PURE__ */ o(Jc.Provider, { value: L, children: /* @__PURE__ */ o(qo.Provider, { value: m, children: /* @__PURE__ */ o(Xc.Provider, { value: B, children: /* @__PURE__ */ o(Zc.Provider, { value: z, children: /* @__PURE__ */ o(nl.Provider, { value: ke, children: /* @__PURE__ */ o(pn.Provider, { value: td, children: /* @__PURE__ */ o(Ic.Provider, { value: Be, children: /* @__PURE__ */ o(Al.Provider, { value: g, children: /* @__PURE__ */ o(il.Provider, { value: Ne, children: /* @__PURE__ */ o(ol.Provider, { value: R, children: /* @__PURE__ */ o(sl.Provider, { value: ne, children: /* @__PURE__ */ o(cl.Provider, { value: xe, children: /* @__PURE__ */ o(al.Provider, { value: tt, children: /* @__PURE__ */ o(dl.Provider, { value: v, children: /* @__PURE__ */ o(Je, { tokens: te, fontFamily: O, children: /* @__PURE__ */ C(
10353
+ }, [J.length]), /* @__PURE__ */ o(Xc.Provider, { value: L, children: /* @__PURE__ */ o(qo.Provider, { value: m, children: /* @__PURE__ */ o(Zc.Provider, { value: B, children: /* @__PURE__ */ o(el.Provider, { value: z, children: /* @__PURE__ */ o(rl.Provider, { value: ke, children: /* @__PURE__ */ o(pn.Provider, { value: nd, children: /* @__PURE__ */ o(Sc.Provider, { value: Be, children: /* @__PURE__ */ o(ql.Provider, { value: g, children: /* @__PURE__ */ o(al.Provider, { value: Ne, children: /* @__PURE__ */ o(il.Provider, { value: R, children: /* @__PURE__ */ o(ol.Provider, { value: ne, children: /* @__PURE__ */ o(ll.Provider, { value: xe, children: /* @__PURE__ */ o(cl.Provider, { value: tt, children: /* @__PURE__ */ o(ul.Provider, { value: v, children: /* @__PURE__ */ o(Je, { tokens: te, fontFamily: O, children: /* @__PURE__ */ C(
10361
10354
  "div",
10362
10355
  {
10363
10356
  ref: Pe,
@@ -10411,17 +10404,17 @@ ${mt}`));
10411
10404
  G && c && !m && /* @__PURE__ */ o(
10412
10405
  Mm,
10413
10406
  {
10414
- onExplain: Kl,
10415
- checking: Vl,
10407
+ onExplain: Yl,
10408
+ checking: Wl,
10416
10409
  blocked: Bn,
10417
- failed: Wl
10410
+ failed: Kl
10418
10411
  }
10419
10412
  ),
10420
10413
  j && /* @__PURE__ */ o(
10421
10414
  bm,
10422
10415
  {
10423
10416
  query: j,
10424
- open: zl,
10417
+ open: Ul,
10425
10418
  onOpenChange: Vo,
10426
10419
  onGo: (x) => kn({ pathSegments: x })
10427
10420
  }
@@ -10467,15 +10460,15 @@ ${mt}`));
10467
10460
  pointerEvents: "none"
10468
10461
  } : {}
10469
10462
  },
10470
- children: /* @__PURE__ */ o(tc, { children: /* @__PURE__ */ o(go.Provider, { value: si[0], children: /* @__PURE__ */ o(vo.Provider, { value: (en == null ? void 0 : en.depth) === 0 ? en.target : null, children: /* @__PURE__ */ o(fs.Provider, { value: ve(), children: /* @__PURE__ */ o(ds.Provider, { value: Ms.where, children: /* @__PURE__ */ o(po.Provider, { value: Xl, children: /* @__PURE__ */ o(mo.Provider, { value: Zl, children: /* @__PURE__ */ o(fo.Provider, { value: ed, children: /* @__PURE__ */ o(
10463
+ children: /* @__PURE__ */ o(tc, { children: /* @__PURE__ */ o(go.Provider, { value: si[0], children: /* @__PURE__ */ o(vo.Provider, { value: (en == null ? void 0 : en.depth) === 0 ? en.target : null, children: /* @__PURE__ */ o(fs.Provider, { value: ve(), children: /* @__PURE__ */ o(ds.Provider, { value: Ms.where, children: /* @__PURE__ */ o(po.Provider, { value: Zl, children: /* @__PURE__ */ o(mo.Provider, { value: ed, children: /* @__PURE__ */ o(fo.Provider, { value: td, children: /* @__PURE__ */ o(
10471
10464
  wo,
10472
10465
  {
10473
10466
  ast: j == null ? void 0 : j.where,
10474
10467
  dispatch: Ue,
10475
- hideChrome: !rd,
10476
- recalcRevision: sd,
10468
+ hideChrome: !sd,
10469
+ recalcRevision: od,
10477
10470
  allowRootDelete: !0,
10478
- mainPipeline: Jl
10471
+ mainPipeline: Xl
10479
10472
  }
10480
10473
  ) }) }) }) }) }) }) }) })
10481
10474
  }
@@ -10486,12 +10479,12 @@ ${mt}`));
10486
10479
  query: j,
10487
10480
  current: J[J.length - 1],
10488
10481
  onGo: (x) => kn({ pathSegments: x }),
10489
- collapsed: Ul,
10490
- onCollapsedChange: Gl
10482
+ collapsed: Gl,
10483
+ onCollapsedChange: Hl
10491
10484
  }
10492
10485
  ),
10493
10486
  J.slice(0, Ii).map((x, w) => {
10494
- const k = nd[w];
10487
+ const k = rd[w];
10495
10488
  return /* @__PURE__ */ o(
10496
10489
  pn.Provider,
10497
10490
  {
@@ -10499,7 +10492,7 @@ ${mt}`));
10499
10492
  drillDown: Yn(x.scopeRoot, x.queryPath),
10500
10493
  basePath: x.path
10501
10494
  },
10502
- children: /* @__PURE__ */ o(Vn.Provider, { value: k.aggregates, children: /* @__PURE__ */ o(Es.Provider, { value: k.joinKeys, children: /* @__PURE__ */ o(go.Provider, { value: si[w + 1], children: /* @__PURE__ */ o(Qn.Provider, { value: k.groupKeys, children: /* @__PURE__ */ o(ds.Provider, { value: k.menu, children: /* @__PURE__ */ o(Hc.Provider, { value: k.fieldTables, children: /* @__PURE__ */ o(po.Provider, { value: k.derived, children: /* @__PURE__ */ o(mo.Provider, { value: k.pickable, children: /* @__PURE__ */ o(fo.Provider, { value: k.queryTables, children: /* @__PURE__ */ o(
10495
+ children: /* @__PURE__ */ o(Vn.Provider, { value: k.aggregates, children: /* @__PURE__ */ o(Es.Provider, { value: k.joinKeys, children: /* @__PURE__ */ o(go.Provider, { value: si[w + 1], children: /* @__PURE__ */ o(Qn.Provider, { value: k.groupKeys, children: /* @__PURE__ */ o(ds.Provider, { value: k.menu, children: /* @__PURE__ */ o(Qc.Provider, { value: k.fieldTables, children: /* @__PURE__ */ o(po.Provider, { value: k.derived, children: /* @__PURE__ */ o(mo.Provider, { value: k.pickable, children: /* @__PURE__ */ o(fo.Provider, { value: k.queryTables, children: /* @__PURE__ */ o(
10503
10496
  vo.Provider,
10504
10497
  {
10505
10498
  value: (en == null ? void 0 : en.depth) === w + 1 ? en.target : null,
@@ -10529,7 +10522,7 @@ ${mt}`));
10529
10522
  {
10530
10523
  run: On,
10531
10524
  outdated: On.query !== j,
10532
- onClose: Hl
10525
+ onClose: Ql
10533
10526
  }
10534
10527
  )
10535
10528
  ]
@@ -10537,8 +10530,8 @@ ${mt}`));
10537
10530
  ) }) }) }) }) }) }) }) }) }) }) }) }) }) }) });
10538
10531
  });
10539
10532
  export {
10540
- tl as D,
10533
+ nl as D,
10541
10534
  dg as P,
10542
- gl as a,
10535
+ bl as a,
10543
10536
  zo as f
10544
10537
  };