react-semaphor 0.1.568 → 0.1.569

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/README.md +0 -7
  2. package/dist/analytics-protocol/index.js +434 -454
  3. package/dist/assistant-context/index.js +1 -1
  4. package/dist/brand-studio/index.js +10 -12
  5. package/dist/briefings/index.js +4 -4
  6. package/dist/chunks/{_commonjsHelpers-DimLPMtv.js → _commonjsHelpers-Bid1ZNYj.js} +271 -222
  7. package/dist/chunks/{assistant-chat-BN5I8KuN.js → assistant-chat-Dzf2Mbph.js} +107 -109
  8. package/dist/chunks/{bookmark-impact-CJ-65omV.js → bookmark-impact-Czg6FGt5.js} +2 -2
  9. package/dist/chunks/{bookmark-state-Du3s13_V.js → bookmark-state-CflS88gq.js} +251 -250
  10. package/dist/chunks/{card-filter-builder-BBuB99GZ.js → card-filter-builder-BS982X7x.js} +986 -985
  11. package/dist/chunks/{code-editor-DJNOsgJH.js → code-editor-BsxHzm9u.js} +43 -45
  12. package/dist/chunks/{comparison-window-caption-CMLb3mut.js → comparison-window-caption-lLTgzOkM.js} +252 -253
  13. package/dist/chunks/{dashboard-YnWZC4dK.js → dashboard-BiYSbxZv.js} +1 -1
  14. package/dist/chunks/{dashboard-briefing-launcher-BF89TU2h.js → dashboard-briefing-launcher-Bdj7luOr.js} +158 -159
  15. package/dist/chunks/{dashboard-controls-atHc1EjP.js → dashboard-controls-TViDsnb8.js} +17 -19
  16. package/dist/chunks/dashboard-json-Dg9dQd9U.js +66 -0
  17. package/dist/chunks/{dates-CKO05ino.js → dates-BsPrWZIP.js} +8 -8
  18. package/dist/chunks/{edit-dashboard-visual-DdmTfn-J.js → edit-dashboard-visual-C6hoIeEJ.js} +20 -21
  19. package/dist/chunks/{filter-reach-copy-jZGzK_IH.js → filter-reach-copy-hcQ4os0u.js} +695 -699
  20. package/dist/chunks/filter-value-text-CVxEEDVl.js +146 -0
  21. package/dist/chunks/{index-CPNZW0mu.js → index-G4q89J6O.js} +74 -76
  22. package/dist/chunks/{layout-grid-0hIlqEtk.js → layout-grid-BIcoFfdS.js} +1 -1
  23. package/dist/chunks/{list-filter-DkgoCeBm.js → list-filter-C6tYkHyv.js} +1 -1
  24. package/dist/chunks/matrix-analytical-definition-dkS8szLM.js +1253 -0
  25. package/dist/chunks/matrix-member-presentation-DRa-9e6Q.js +169 -0
  26. package/dist/chunks/{matrix-operation-contract-Eb6elidS.js → matrix-operation-contract-DCVinw1o.js} +122 -122
  27. package/dist/chunks/{metric-comparison-ChXUFaZu.js → metric-comparison-n9NsIa-2.js} +175 -128
  28. package/dist/chunks/{palette-4vf2BEEg.js → palette-NjHOE_6B.js} +1 -1
  29. package/dist/chunks/pivot-result-contract-expectations-DkmueDTW.js +55 -0
  30. package/dist/chunks/{pivot-result-identity-BlbLrqaC.js → pivot-result-identity-B89X5xjb.js} +1 -1
  31. package/dist/chunks/raw-temporal-value-DdT0s47W.js +159 -0
  32. package/dist/chunks/{report-preferences-dialog-Mbd-I0wV.js → report-preferences-dialog-Xc8_GFju.js} +26 -28
  33. package/dist/chunks/{report-runtime-context-DnA_PiKo.js → report-runtime-context-BhPzLTbS.js} +1 -1
  34. package/dist/chunks/{resolve-dashboard-input-context-Du0fjN3h.js → resolve-dashboard-input-context-KqvcLcTM.js} +4784 -4764
  35. package/dist/chunks/{save-D6pHmSSP.js → save-C6VmEJTA.js} +1 -1
  36. package/dist/chunks/{saved-dashboard-context-y8N6RvjS.js → saved-dashboard-context-BeXXyoD4.js} +6 -6
  37. package/dist/chunks/{semaphor-ready-indicator-BSEdUq40.js → semaphor-ready-indicator-BNkaANsG.js} +28395 -28384
  38. package/dist/chunks/{shelf-drop-preview-context-D7QqPl36.js → shelf-drop-preview-context-C_issPBA.js} +18 -20
  39. package/dist/chunks/{stored-dashboard-d3xQYxBD.js → stored-dashboard-B6_StAty.js} +263 -265
  40. package/dist/chunks/{table-export-sheet--DUKWk6o.js → table-export-sheet-BWP2joD1.js} +1 -1
  41. package/dist/chunks/{temporal-input-presentation--2r9BLr0.js → temporal-input-presentation-scSWQXAB.js} +4 -4
  42. package/dist/chunks/{token-types-C8JymO8s.js → token-types-iKMplaBL.js} +1 -1
  43. package/dist/chunks/{upload-Cf3wXZT8.js → upload-BRW4Mwrd.js} +1 -1
  44. package/dist/chunks/validators-B8fpdinG.js +3651 -0
  45. package/dist/chunks/{variable-draft-DOX03R4A.js → variable-draft-BQ3OMjvy.js} +4 -4
  46. package/dist/dashboard/index.js +2 -2
  47. package/dist/dashboard-authoring/index.js +1527 -1517
  48. package/dist/format-utils/index.js +230 -231
  49. package/dist/index.js +236 -237
  50. package/dist/report-runtime-context/index.js +1 -1
  51. package/dist/style.css +1 -1
  52. package/dist/surfboard/index.js +2 -2
  53. package/dist/types/components/surfboard/filter/types.d.ts +5 -4
  54. package/dist/types/components/ui-custom/date-range-presets.d.ts +1 -17
  55. package/dist/types/index.js +9 -9
  56. package/dist/types/lib/hooks/use-date-filter.d.ts +3 -3
  57. package/dist/types/lib/matrix-table/matrix-card-adapter.d.ts +1 -1
  58. package/dist/types/lib/types/explorer-types.d.ts +2 -2
  59. package/dist/types/lib/types/index.d.ts +1 -1
  60. package/dist/types/lib/utils/card-definition.d.ts +7 -7
  61. package/dist/types/shared/analytics-protocol/agent-time-window.d.ts +84 -0
  62. package/dist/types/shared/analytics-protocol/applied-constraints.d.ts +2 -2
  63. package/dist/types/shared/analytics-protocol/contracts.d.ts +8 -17
  64. package/dist/types/shared/analytics-protocol/fixtures.d.ts +3 -2
  65. package/dist/types/shared/analytics-protocol/index.d.ts +2 -4
  66. package/dist/types/shared/analytics-protocol/matrix-definition-contract.d.ts +4 -4
  67. package/dist/types/shared/analytics-protocol/relative-date/describe.d.ts +18 -0
  68. package/dist/types/shared/analytics-protocol/relative-date/index.d.ts +7 -0
  69. package/dist/types/shared/analytics-protocol/relative-date/limits.d.ts +3 -0
  70. package/dist/types/shared/analytics-protocol/relative-date/presets.d.ts +11 -0
  71. package/dist/types/shared/analytics-protocol/relative-date/resolve.d.ts +49 -0
  72. package/dist/types/shared/analytics-protocol/relative-date/schemas.d.ts +76 -0
  73. package/dist/types/shared/analytics-protocol/relative-date/traits.d.ts +51 -0
  74. package/dist/types/shared/analytics-protocol/relative-date/window.d.ts +111 -0
  75. package/dist/types/shared/analytics-protocol/selection-contract.d.ts +1 -1
  76. package/dist/types/shared/assistant-protocol/context.d.ts +12 -12
  77. package/dist/types/shared/dashboard-authoring/changes/card-query-part.d.ts +0 -2
  78. package/dist/types/shared/dashboard-authoring/changes/dashboard-change.d.ts +155 -1753
  79. package/dist/types/shared/dashboard-authoring/changes/read-card-query.d.ts +8 -4
  80. package/dist/types/shared/dashboard-authoring/conditional-formatting/schema.d.ts +74 -74
  81. package/dist/types/shared/dashboard-authoring/control-execution-contract.d.ts +20 -20
  82. package/dist/types/shared/dashboard-authoring/outline/outline-dashboard.d.ts +3 -0
  83. package/dist/types/shared/dashboard-authoring/outline/outline-filters.d.ts +10 -2
  84. package/dist/types/shared/format-utils/filter-detail.d.ts +2 -8
  85. package/dist/types/shared/format-utils/filter-line.d.ts +2 -2
  86. package/dist/types/shared/format-utils/matrix-continuation.d.ts +3 -3
  87. package/dist/types/shared/temporal/index.d.ts +0 -2
  88. package/dist/types/shared/temporal/temporal-parity-fixtures.d.ts +2 -2
  89. package/package.json +2 -24
  90. package/DATA_APP_SDK.md +0 -339
  91. package/dist/chunks/dashboard-json-Cxp3inxd.js +0 -68
  92. package/dist/chunks/filter-value-text-7zhmth1S.js +0 -163
  93. package/dist/chunks/index-CuHybtft.js +0 -51
  94. package/dist/chunks/matrix-analytical-definition-C9xB_T84.js +0 -717
  95. package/dist/chunks/matrix-card-BSUeSXpD.js +0 -42
  96. package/dist/chunks/matrix-member-presentation-DZNgQpUq.js +0 -105
  97. package/dist/chunks/operators-B3zZoskU.js +0 -66
  98. package/dist/chunks/pivot-result-contract-expectations-Ddh1rNz5.js +0 -56
  99. package/dist/chunks/raw-temporal-value-Bqz8wc7L.js +0 -242
  100. package/dist/chunks/selection-reducer-OaJ-N5uN.js +0 -46
  101. package/dist/chunks/source-entity-resolution-DF6GulDn.js +0 -607
  102. package/dist/chunks/validators-wtjw0aw6.js +0 -3332
  103. package/dist/data-app-sdk/index.js +0 -1412
  104. package/dist/data-app-sdk-adapters/index.js +0 -361
  105. package/dist/data-app-sdk-validation/index.js +0 -1031
  106. package/dist/types/data-app-sdk/adapters.d.ts +0 -35
  107. package/dist/types/data-app-sdk/builders.d.ts +0 -62
  108. package/dist/types/data-app-sdk/contracts.d.ts +0 -419
  109. package/dist/types/data-app-sdk/executor.d.ts +0 -5
  110. package/dist/types/data-app-sdk/field-catalog-validation.d.ts +0 -29
  111. package/dist/types/data-app-sdk/hooks.d.ts +0 -11
  112. package/dist/types/data-app-sdk/index.d.ts +0 -9
  113. package/dist/types/data-app-sdk/provider.d.ts +0 -8
  114. package/dist/types/data-app-sdk/relationship-aware-field-policy.d.ts +0 -21
  115. package/dist/types/data-app-sdk/selection.d.ts +0 -2
  116. package/dist/types/data-app-sdk/validation.d.ts +0 -58
  117. package/dist/types/data-app-sdk-adapters.d.ts +0 -2
  118. package/dist/types/data-app-sdk-validation.d.ts +0 -2
  119. package/dist/types/data-app-sdk.d.ts +0 -2
  120. package/dist/types/shared/analytics-protocol/relative-date-filter.d.ts +0 -68
  121. package/dist/types/shared/analytics-protocol/relative-date-label.d.ts +0 -20
  122. package/dist/types/shared/analytics-protocol/time-window-schema.d.ts +0 -314
  123. package/dist/types/shared/analytics-protocol/time-window.d.ts +0 -52
  124. package/dist/types/shared/temporal/relative-date.d.ts +0 -21
  125. package/dist/types/shared/temporal/time-window-periods.d.ts +0 -21
  126. package/src/data-app-sdk/README.md +0 -402
@@ -1,26 +1,25 @@
1
- import { c as Ue, B as j, X as ce, s as Ne, l as un, a3 as mn, o as at, p as rt, q as st, r as ot, a4 as Ot, z as Oe, n as le, t as xe, u as ge, v as be, w as ve, x as re, P as it, a as lt, d as dt, L as pn, y as fn } from "./code-editor-DJNOsgJH.js";
1
+ import { c as Ue, B as G, X as ce, s as Ne, l as mn, a3 as pn, o as at, p as rt, q as st, r as ot, a4 as Ot, z as Oe, n as le, t as xe, u as ge, v as be, w as ve, x as re, P as it, a as lt, d as dt, L as fn, y as hn } from "./code-editor-BsxHzm9u.js";
2
2
  import { jsx as t, jsxs as l, Fragment as fe } from "react/jsx-runtime";
3
3
  import * as _e from "react";
4
- import vt, { useMemo as Q, useState as H, useRef as Ae, useCallback as ne, useEffect as de, forwardRef as hn, Fragment as xn } from "react";
5
- import { aU as ct, u as ut, a6 as se, bX as _t, cs as X, ct as gn, bT as Ie, cu as Ge, cv as Vt, cw as bn, bN as Ve, cx as vn, a7 as Rt, bu as yn, bv as Nn, bx as Cn, bn as wn, cy as kn, i as Sn, cz as Dn, cA as yt, bM as Et, cB as In, cC as Mt, cD as zt, cE as Tn, cF as Ln, cG as An, cH as $n, cI as Fn, cJ as On, cK as _n, bo as Vn, cL as Nt, cM as qt, cN as Rn, br as En, cO as Mn, cP as zn, cQ as qn, cR as ye, cS as jt, cT as jn, cU as Un, cV as Gn, cW as Bn, cX as Wn, cY as Kn, cZ as Ze, c_ as he, c$ as et, d0 as tt, d1 as nt, d2 as Qn, d3 as Re, d4 as Ee, d5 as Me, d6 as ze, d7 as Ut, d8 as Gt, d9 as Bt } from "./semaphor-ready-indicator-BSEdUq40.js";
6
- import { D as Hn } from "./token-types-C8JymO8s.js";
7
- import { f0 as Wt, f1 as Pn, f2 as Yn, f3 as Xn, f4 as Jn, f5 as Zn, f6 as $e, f7 as Ct, f8 as wt, f9 as Qe, fa as He, fb as ea, fc as ta, fd as kt, fe as na, ff as aa, fg as Fe, fh as ra, fi as St, fj as Kt, fk as Qt, fl as Ht, fm as Pt, fn as sa, fo as oa, fp as Dt, fq as ia, fr as It, fs as la, ft as da, fu as ca, fv as ua, fw as Pe, a as qe, fx as Ye, fy as ma, fz as pa, fA as fa, fB as ha } from "./resolve-dashboard-input-context-Du0fjN3h.js";
8
- import "./index-CuHybtft.js";
9
- import { u as Yt } from "./validators-wtjw0aw6.js";
10
- import "./matrix-operation-contract-Eb6elidS.js";
4
+ import vt, { useMemo as Q, useState as H, useRef as Ae, useCallback as ne, useEffect as de, forwardRef as xn, Fragment as gn } from "react";
5
+ import { aU as ct, u as ut, a6 as se, bX as _t, cs as X, ct as bn, bT as Ie, cu as Ge, cv as Vt, cw as vn, bN as Ve, cx as yn, a7 as Rt, bu as Nn, bv as Cn, bx as wn, bn as kn, cy as Sn, i as Dn, cz as In, cA as yt, bM as Et, cB as Tn, cC as Mt, cD as zt, cE as Ln, cF as An, cG as $n, cH as Fn, cI as On, cJ as _n, cK as Vn, bo as Rn, cL as Nt, cM as qt, cN as En, br as Mn, cO as zn, cP as qn, cQ as jn, cR as ye, cS as jt, cT as Un, cU as Gn, cV as Bn, cW as Wn, cX as Kn, cY as Ze, cZ as he, c_ as et, c$ as tt, d0 as nt, d1 as Qn, d2 as Re, d3 as Ee, d4 as Me, d5 as ze, d6 as Ut, d7 as Gt, d8 as Bt } from "./semaphor-ready-indicator-BNkaANsG.js";
6
+ import { D as Hn } from "./token-types-iKMplaBL.js";
7
+ import { f4 as Wt, f5 as Pn, f6 as Yn, f7 as Xn, f8 as Jn, f9 as Zn, fa as $e, fb as Ct, fc as wt, fd as Qe, fe as He, ff as ea, fg as ta, fh as kt, fi as na, fj as aa, fk as Fe, fl as ra, fm as St, fn as Kt, fo as Qt, fp as Ht, fq as Pt, fr as sa, fs as oa, ft as Dt, fu as ia, fv as It, fw as la, fx as da, fy as ca, fz as ua, fA as Pe, a as qe, fB as Ye, b9 as ma, fC as pa, fD as fa, fE as ha, fF as xa } from "./resolve-dashboard-input-context-KqvcLcTM.js";
8
+ import { c as z } from "./_commonjsHelpers-Bid1ZNYj.js";
9
+ import { r as Yt } from "./validators-B8fpdinG.js";
10
+ import "./matrix-operation-contract-DCVinw1o.js";
11
11
  import "./analytics-base-schemas-BaIQrEzX.js";
12
- import "zod";
13
12
  import "../value-format-preferences/index.js";
14
- import { c as M } from "./_commonjsHelpers-DimLPMtv.js";
15
- import { U as xa } from "./upload-Cf3wXZT8.js";
16
- import { P as Xt } from "./filter-reach-copy-jZGzK_IH.js";
13
+ import { U as ga } from "./upload-BRW4Mwrd.js";
14
+ import { a as Xt } from "./metric-comparison-n9NsIa-2.js";
15
+ import { P as Jt } from "./filter-reach-copy-hcQ4os0u.js";
17
16
  /**
18
17
  * @license lucide-react v0.453.0 - ISC
19
18
  *
20
19
  * This source code is licensed under the ISC license.
21
20
  * See the LICENSE file in the root directory of this source tree.
22
21
  */
23
- const ga = Ue("Boxes", [
22
+ const ba = Ue("Boxes", [
24
23
  [
25
24
  "path",
26
25
  {
@@ -69,7 +68,7 @@ const Nr = Ue("FilterX", [
69
68
  * This source code is licensed under the ISC license.
70
69
  * See the LICENSE file in the root directory of this source tree.
71
70
  */
72
- const ba = Ue("Library", [
71
+ const va = Ue("Library", [
73
72
  ["path", { d: "m16 6 4 14", key: "ji33uf" }],
74
73
  ["path", { d: "M12 6v14", key: "1n7gus" }],
75
74
  ["path", { d: "M8 8v12", key: "1gg7y9" }],
@@ -81,12 +80,12 @@ const ba = Ue("Library", [
81
80
  * This source code is licensed under the ISC license.
82
81
  * See the LICENSE file in the root directory of this source tree.
83
82
  */
84
- const va = Ue("Link2", [
83
+ const ya = Ue("Link2", [
85
84
  ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
86
85
  ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
87
86
  ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
88
87
  ]);
89
- function ya(e, n, a) {
88
+ function Na(e, n, a) {
90
89
  switch (e) {
91
90
  case "none":
92
91
  return !1;
@@ -99,22 +98,22 @@ function ya(e, n, a) {
99
98
  return !0;
100
99
  }
101
100
  }
102
- function Na({
101
+ function Ca({
103
102
  mode: e,
104
103
  currentDomainId: n,
105
104
  scopedDomainIds: a,
106
105
  hasSelectedEntities: o
107
106
  }) {
108
- return e === "all" ? !1 : e === "none" ? !!n || o : n ? !ya(e, n, a) : o;
107
+ return e === "all" ? !1 : e === "none" ? !!n || o : n ? !Na(e, n, a) : o;
109
108
  }
110
- function Jt(e) {
111
- const { tokenProps: n } = ct(), a = ut((r) => r.authToken) || e;
109
+ function Zt(e) {
110
+ const { tokenProps: n } = ct(), a = ut((s) => s.authToken) || e;
112
111
  se(
113
- (r) => r.selectedConnectionId
112
+ (s) => s.selectedConnectionId
114
113
  ), se(
115
- (r) => {
116
- var p, f;
117
- return (f = (p = r == null ? void 0 : r.card) == null ? void 0 : p.dataSource) == null ? void 0 : f.connectionId;
114
+ (s) => {
115
+ var m, f;
116
+ return (f = (m = s == null ? void 0 : s.card) == null ? void 0 : m.dataSource) == null ? void 0 : f.connectionId;
118
117
  }
119
118
  );
120
119
  const {
@@ -142,7 +141,7 @@ function Jt(e) {
142
141
  refetchSemanticDomains: o
143
142
  };
144
143
  }
145
- function Zt(e) {
144
+ function en(e) {
146
145
  const n = mt(e);
147
146
  return n.size === 1 ? [...n][0] : void 0;
148
147
  }
@@ -152,7 +151,7 @@ function mt(e) {
152
151
  "domainId" in a && typeof a.domainId == "string" && a.domainId && n.add(a.domainId);
153
152
  return n;
154
153
  }
155
- function Ca(e, n) {
154
+ function wa(e, n) {
156
155
  if (e.some(
157
156
  (d) => X(d, n)
158
157
  ))
@@ -164,8 +163,8 @@ function Ca(e, n) {
164
163
  (d) => !("domainId" in d)
165
164
  ) || [...o].some((d) => d !== n.domainId) ? [n] : [...e, n];
166
165
  }
167
- function wa(e, n) {
168
- const a = Zt(n), o = mt(e), u = e.some(
166
+ function ka(e, n) {
167
+ const a = en(n), o = mt(e), u = e.some(
169
168
  (c) => !("domainId" in c)
170
169
  );
171
170
  if (a && (u || [...o].some(
@@ -177,27 +176,27 @@ function wa(e, n) {
177
176
  d.some((i) => X(i, c)) || d.push(c);
178
177
  return d;
179
178
  }
180
- function ka({
179
+ function Sa({
181
180
  domainAccess: e,
182
181
  search: n,
183
182
  scopeDomainId: a,
184
183
  selectedEntities: o,
185
184
  onSelectionChange: u
186
185
  }) {
187
- const { semanticDomains: d, isSemanticDomainsLoading: c } = Jt(), i = Q(() => Da(d, e), [d, e]), r = Q(() => a ? i.filter((f) => f.id === a) : i, [i, a]);
188
- if (c && r.length === 0)
186
+ const { semanticDomains: d, isSemanticDomainsLoading: c } = Zt(), i = Q(() => Ia(d, e), [d, e]), s = Q(() => a ? i.filter((f) => f.id === a) : i, [i, a]);
187
+ if (c && s.length === 0)
189
188
  return /* @__PURE__ */ t("div", { className: "px-3 py-4 text-[11px] text-muted-foreground", children: "Loading semantic domains…" });
190
- if (r.length === 0)
189
+ if (s.length === 0)
191
190
  return null;
192
- const p = !!a;
191
+ const m = !!a;
193
192
  return /* @__PURE__ */ l("div", { children: [
194
- /* @__PURE__ */ t(en, { label: "Semantic Domains" }),
195
- r.map((f) => /* @__PURE__ */ t(
196
- Sa,
193
+ /* @__PURE__ */ t(tn, { label: "Semantic Domains" }),
194
+ s.map((f) => /* @__PURE__ */ t(
195
+ Da,
197
196
  {
198
197
  domain: f,
199
198
  search: n,
200
- forceExpanded: p,
199
+ forceExpanded: m,
201
200
  selectedEntities: o,
202
201
  onSelectionChange: u
203
202
  },
@@ -205,36 +204,36 @@ function ka({
205
204
  ))
206
205
  ] });
207
206
  }
208
- function Sa({
207
+ function Da({
209
208
  domain: e,
210
209
  search: n,
211
210
  forceExpanded: a,
212
211
  selectedEntities: o,
213
212
  onSelectionChange: u
214
213
  }) {
215
- const [d, c] = H(!1), i = d || n.length > 0 || !!a, { datasets: r, isPending: p } = gn(
214
+ const [d, c] = H(!1), i = d || n.length > 0 || !!a, { datasets: s, isPending: m } = bn(
216
215
  i ? e.id : void 0
217
216
  ), f = Q(() => {
218
- if (!n) return r;
217
+ if (!n) return s;
219
218
  const O = n.trim().toLowerCase();
220
- return r.filter(
219
+ return s.filter(
221
220
  (T) => `${T.label ?? ""} ${T.name ?? ""} ${T.description ?? ""}`.toLowerCase().includes(O)
222
221
  );
223
- }, [r, n]), k = n.length > 0 && f.length > 0, y = d || k || !!a, h = r.length, N = Q(() => f.filter(
222
+ }, [s, n]), w = n.length > 0 && f.length > 0, y = d || w || !!a, h = s.length, N = Q(() => f.filter(
224
223
  (O) => o.some(
225
224
  (T) => X(T, Le(O))
226
225
  )
227
- ).length, [f, o]), S = Q(
226
+ ).length, [f, o]), k = Q(
228
227
  () => f.map(Le),
229
228
  [f]
230
- ), w = S.length > 0 && S.every(
229
+ ), _ = k.length > 0 && k.every(
231
230
  (O) => o.some((T) => X(T, O))
232
- ), V = () => {
233
- if (S.length !== 0) {
234
- if (w) {
231
+ ), D = () => {
232
+ if (k.length !== 0) {
233
+ if (_) {
235
234
  u(
236
235
  o.filter(
237
- (O) => !S.some(
236
+ (O) => !k.some(
238
237
  (T) => X(O, T)
239
238
  )
240
239
  )
@@ -242,22 +241,22 @@ function Sa({
242
241
  return;
243
242
  }
244
243
  u(
245
- wa(
244
+ ka(
246
245
  o,
247
- S
246
+ k
248
247
  )
249
248
  );
250
249
  }
251
- }, U = (O) => {
250
+ }, j = (O) => {
252
251
  const T = Le(O);
253
252
  u(
254
- Ca(
253
+ wa(
255
254
  o,
256
255
  T
257
256
  )
258
257
  );
259
258
  };
260
- return n.length > 0 && !k && !p ? null : /* @__PURE__ */ l("div", { children: [
259
+ return n.length > 0 && !w && !m ? null : /* @__PURE__ */ l("div", { children: [
261
260
  /* @__PURE__ */ l("div", { className: "flex items-center rounded-[4px] px-3 py-1.5 transition-colors hover:bg-muted/50", children: [
262
261
  /* @__PURE__ */ l(
263
262
  "button",
@@ -269,7 +268,7 @@ function Sa({
269
268
  /* @__PURE__ */ t(
270
269
  Ie,
271
270
  {
272
- className: M(
271
+ className: z(
273
272
  "h-3 w-3 shrink-0 text-muted-foreground transition-transform",
274
273
  y && "rotate-90"
275
274
  ),
@@ -287,18 +286,18 @@ function Sa({
287
286
  ]
288
287
  }
289
288
  ),
290
- y && !p && S.length > 0 && /* @__PURE__ */ t(
289
+ y && !m && k.length > 0 && /* @__PURE__ */ t(
291
290
  "button",
292
291
  {
293
292
  type: "button",
294
- onClick: V,
293
+ onClick: D,
295
294
  className: "ml-2 shrink-0 rounded-[3px] px-1.5 py-0.5 text-[10.5px] font-medium text-muted-foreground hover:bg-background hover:text-foreground",
296
- children: w ? "Clear" : "Select all"
295
+ children: _ ? "Clear" : "Select all"
297
296
  }
298
297
  ),
299
298
  /* @__PURE__ */ t("span", { className: "ml-auto font-mono text-[10px] tabular-nums text-muted-foreground", children: N > 0 ? N : "" })
300
299
  ] }),
301
- y && /* @__PURE__ */ t("ul", { className: "space-y-px pb-1", children: p && r.length === 0 ? /* @__PURE__ */ t("li", { className: "px-9 py-1.5 text-[11px] text-muted-foreground", children: "Loading datasets…" }) : f.length === 0 ? /* @__PURE__ */ t("li", { className: "px-9 py-1.5 text-[11px] text-muted-foreground", children: "No datasets in this domain." }) : f.map((O) => {
300
+ y && /* @__PURE__ */ t("ul", { className: "space-y-px pb-1", children: m && s.length === 0 ? /* @__PURE__ */ t("li", { className: "px-9 py-1.5 text-[11px] text-muted-foreground", children: "Loading datasets…" }) : f.length === 0 ? /* @__PURE__ */ t("li", { className: "px-9 py-1.5 text-[11px] text-muted-foreground", children: "No datasets in this domain." }) : f.map((O) => {
302
301
  const T = Le(O), P = o.some(
303
302
  (J) => X(J, T)
304
303
  );
@@ -307,7 +306,7 @@ function Sa({
307
306
  Ge,
308
307
  {
309
308
  checked: P,
310
- onCheckedChange: () => U(O),
309
+ onCheckedChange: () => j(O),
311
310
  className: "mt-[3px] h-3.5 w-3.5 shrink-0"
312
311
  }
313
312
  ),
@@ -322,10 +321,10 @@ function Sa({
322
321
  }) })
323
322
  ] });
324
323
  }
325
- function en({ label: e }) {
324
+ function tn({ label: e }) {
326
325
  return /* @__PURE__ */ t("div", { className: "px-3 pb-1.5 pt-2.5", children: /* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: e }) });
327
326
  }
328
- function Da(e, n) {
327
+ function Ia(e, n) {
329
328
  if (!n || n.mode === "all") return e;
330
329
  const a = new Set(n.domainIds ?? []);
331
330
  return n.mode === "include" ? e.filter((o) => a.has(o.id)) : n.mode === "exclude" ? e.filter((o) => !a.has(o.id)) : [];
@@ -349,34 +348,34 @@ function Le(e) {
349
348
  sql: e.sql
350
349
  };
351
350
  }
352
- function Ia({
351
+ function Ta({
353
352
  search: e,
354
353
  scopeConnectionId: n,
355
354
  selectedEntities: a,
356
355
  onSelectionChange: o
357
356
  }) {
358
- const { connections: u, isConnectionsLoading: d } = Vt(), c = Q(() => n ? u.filter((r) => r.id === n) : u, [u, n]);
357
+ const { connections: u, isConnectionsLoading: d } = Vt(), c = Q(() => n ? u.filter((s) => s.id === n) : u, [u, n]);
359
358
  if (d && c.length === 0)
360
359
  return /* @__PURE__ */ t("div", { className: "px-3 py-4 text-[11px] text-muted-foreground", children: "Loading connections…" });
361
360
  if (c.length === 0)
362
361
  return null;
363
362
  const i = !!n;
364
363
  return /* @__PURE__ */ l("div", { children: [
365
- /* @__PURE__ */ t(en, { label: "Direct Sources" }),
366
- c.map((r) => /* @__PURE__ */ t(
367
- Ta,
364
+ /* @__PURE__ */ t(tn, { label: "Direct Sources" }),
365
+ c.map((s) => /* @__PURE__ */ t(
366
+ La,
368
367
  {
369
- connection: r,
368
+ connection: s,
370
369
  search: e,
371
370
  forceExpanded: i,
372
371
  selectedEntities: a,
373
372
  onSelectionChange: o
374
373
  },
375
- r.id
374
+ s.id
376
375
  ))
377
376
  ] });
378
377
  }
379
- function Ta({
378
+ function La({
380
379
  connection: e,
381
380
  search: n,
382
381
  forceExpanded: a,
@@ -384,8 +383,8 @@ function Ta({
384
383
  onSelectionChange: u
385
384
  }) {
386
385
  var N;
387
- const [d, c] = H(!1), i = d || n.length > 0 || !!a, r = ((N = e.capabilities) == null ? void 0 : N.path) ?? [], p = r.includes("database"), f = r.includes("schema"), k = e.type === "upload", y = e.type === "url", h = Q(
388
- () => o.filter((S) => S.connectionId === e.id).length,
386
+ const [d, c] = H(!1), i = d || n.length > 0 || !!a, s = ((N = e.capabilities) == null ? void 0 : N.path) ?? [], m = s.includes("database"), f = s.includes("schema"), w = e.type === "upload", y = e.type === "url", h = Q(
387
+ () => o.filter((k) => k.connectionId === e.id).length,
389
388
  [o, e.id]
390
389
  );
391
390
  return /* @__PURE__ */ l("div", { className: "border-b border-border/60 last:border-b-0", children: [
@@ -393,13 +392,13 @@ function Ta({
393
392
  "button",
394
393
  {
395
394
  type: "button",
396
- onClick: () => c((S) => !S),
395
+ onClick: () => c((k) => !k),
397
396
  className: "flex w-full items-center gap-2 px-4 py-1.5 text-left transition-colors hover:bg-muted/40",
398
397
  children: [
399
398
  /* @__PURE__ */ t(
400
399
  Ie,
401
400
  {
402
- className: M(
401
+ className: z(
403
402
  "h-3 w-3 shrink-0 text-muted-foreground transition-transform",
404
403
  i && "rotate-90"
405
404
  ),
@@ -416,22 +415,22 @@ function Ta({
416
415
  }
417
416
  ),
418
417
  i && /* @__PURE__ */ l(fe, { children: [
419
- k ? /* @__PURE__ */ t(
420
- La,
418
+ w ? /* @__PURE__ */ t(
419
+ Aa,
421
420
  {
422
421
  connection: e,
423
422
  selectedEntities: o,
424
423
  onSelectionChange: u
425
424
  }
426
425
  ) : y ? /* @__PURE__ */ t(
427
- Aa,
426
+ $a,
428
427
  {
429
428
  connection: e,
430
429
  selectedEntities: o,
431
430
  onSelectionChange: u
432
431
  }
433
- ) : p ? /* @__PURE__ */ t(
434
- $a,
432
+ ) : m ? /* @__PURE__ */ t(
433
+ Fa,
435
434
  {
436
435
  connection: e,
437
436
  requiresSchema: f,
@@ -440,7 +439,7 @@ function Ta({
440
439
  onSelectionChange: u
441
440
  }
442
441
  ) : f ? /* @__PURE__ */ t(
443
- tn,
442
+ nn,
444
443
  {
445
444
  connection: e,
446
445
  databaseName: "",
@@ -459,8 +458,8 @@ function Ta({
459
458
  onSelectionChange: u
460
459
  }
461
460
  ),
462
- !k && !y && /* @__PURE__ */ t(
463
- Fa,
461
+ !w && !y && /* @__PURE__ */ t(
462
+ Oa,
464
463
  {
465
464
  connection: e,
466
465
  search: n,
@@ -471,7 +470,7 @@ function Ta({
471
470
  ] })
472
471
  ] });
473
472
  }
474
- function La({
473
+ function Aa({
475
474
  connection: e,
476
475
  selectedEntities: n,
477
476
  onSelectionChange: a
@@ -480,28 +479,28 @@ function La({
480
479
  (i) => i.connectionId === e.id && (i.type === "upload" || i.type === "file")
481
480
  ), d = (i) => {
482
481
  if (!(i != null && i.length)) return;
483
- const r = Array.from(i).map((p) => ({
482
+ const s = Array.from(i).map((m) => ({
484
483
  id: `file-${Date.now()}-${Math.random()}`,
485
- name: p.name,
484
+ name: m.name,
486
485
  type: "upload",
487
486
  connectionId: e.id,
488
487
  connectionType: e.type,
489
- label: p.name,
488
+ label: m.name,
490
489
  description: `Uploaded ${(/* @__PURE__ */ new Date()).toLocaleString()}`,
491
- originalName: p.name,
492
- file: p
490
+ originalName: m.name,
491
+ file: m
493
492
  }));
494
- a([...n, ...r]);
493
+ a([...n, ...s]);
495
494
  }, c = (i) => {
496
495
  a(
497
496
  n.filter(
498
- (r) => !("id" in r && r.id === i && r.connectionId === e.id && (r.type === "upload" || r.type === "file"))
497
+ (s) => !("id" in s && s.id === i && s.connectionId === e.id && (s.type === "upload" || s.type === "file"))
499
498
  )
500
499
  );
501
500
  };
502
501
  return /* @__PURE__ */ l("div", { className: "space-y-2 px-8 py-2", children: [
503
502
  /* @__PURE__ */ l("div", { className: "rounded-[6px] border border-dashed border-border bg-muted/20 p-4 text-center", children: [
504
- /* @__PURE__ */ t(xa, { className: "mx-auto mb-2 h-5 w-5 text-muted-foreground" }),
503
+ /* @__PURE__ */ t(ga, { className: "mx-auto mb-2 h-5 w-5 text-muted-foreground" }),
505
504
  /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Add CSV, JSON, or Excel files." }),
506
505
  /* @__PURE__ */ t(
507
506
  "input",
@@ -515,7 +514,7 @@ function La({
515
514
  }
516
515
  ),
517
516
  /* @__PURE__ */ t(
518
- j,
517
+ G,
519
518
  {
520
519
  type: "button",
521
520
  variant: "outline",
@@ -534,7 +533,7 @@ function La({
534
533
  {
535
534
  className: "flex items-center gap-2 rounded-[5px] border border-border bg-background px-2 py-1.5",
536
535
  children: [
537
- /* @__PURE__ */ t(bn, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
536
+ /* @__PURE__ */ t(vn, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
538
537
  /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-[12px]", children: i.originalName || i.name }),
539
538
  /* @__PURE__ */ t(
540
539
  "button",
@@ -552,12 +551,12 @@ function La({
552
551
  )) })
553
552
  ] });
554
553
  }
555
- function Aa({
554
+ function $a({
556
555
  connection: e,
557
556
  selectedEntities: n,
558
557
  onSelectionChange: a
559
558
  }) {
560
- const [o, u] = H(""), [d, c] = H(""), [i, r] = H("api"), p = n.filter(
559
+ const [o, u] = H(""), [d, c] = H(""), [i, s] = H("api"), m = n.filter(
561
560
  (y) => y.connectionId === e.id && y.type === "url"
562
561
  ), f = () => {
563
562
  const y = o.trim(), h = d.trim();
@@ -574,8 +573,8 @@ function Aa({
574
573
  url: h,
575
574
  sourceType: i
576
575
  };
577
- a([...n, N]), u(""), c(""), r("api");
578
- }, k = (y) => {
576
+ a([...n, N]), u(""), c(""), s("api");
577
+ }, w = (y) => {
579
578
  a(
580
579
  n.filter(
581
580
  (h) => !("id" in h && h.id === y && h.connectionId === e.id && h.type === "url")
@@ -607,7 +606,7 @@ function Aa({
607
606
  "select",
608
607
  {
609
608
  value: i,
610
- onChange: (y) => r(y.target.value),
609
+ onChange: (y) => s(y.target.value),
611
610
  className: "h-7 flex-1 rounded-control border border-input bg-background px-2 text-[12px]",
612
611
  children: [
613
612
  /* @__PURE__ */ t("option", { value: "api", children: "API endpoint" }),
@@ -617,7 +616,7 @@ function Aa({
617
616
  }
618
617
  ),
619
618
  /* @__PURE__ */ l(
620
- j,
619
+ G,
621
620
  {
622
621
  type: "button",
623
622
  size: "sm",
@@ -632,12 +631,12 @@ function Aa({
632
631
  )
633
632
  ] })
634
633
  ] }),
635
- p.length > 0 && /* @__PURE__ */ t("ul", { className: "space-y-1", children: p.map((y) => /* @__PURE__ */ l(
634
+ m.length > 0 && /* @__PURE__ */ t("ul", { className: "space-y-1", children: m.map((y) => /* @__PURE__ */ l(
636
635
  "li",
637
636
  {
638
637
  className: "flex items-center gap-2 rounded-[5px] border border-border bg-background px-2 py-1.5",
639
638
  children: [
640
- /* @__PURE__ */ t(vn, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
639
+ /* @__PURE__ */ t(yn, { className: "h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
641
640
  /* @__PURE__ */ l("div", { className: "min-w-0 flex-1", children: [
642
641
  /* @__PURE__ */ t("p", { className: "truncate text-[12px]", children: y.name }),
643
642
  /* @__PURE__ */ t("p", { className: "truncate text-[11px] text-muted-foreground", children: y.url })
@@ -647,7 +646,7 @@ function Aa({
647
646
  {
648
647
  type: "button",
649
648
  "aria-label": `Remove ${y.name}`,
650
- onClick: () => k(y.id),
649
+ onClick: () => w(y.id),
651
650
  className: "inline-flex h-5 w-5 shrink-0 items-center justify-center rounded-[3px] text-muted-foreground hover:bg-muted hover:text-foreground",
652
651
  children: /* @__PURE__ */ t(ce, { className: "h-3 w-3" })
653
652
  }
@@ -658,7 +657,7 @@ function Aa({
658
657
  )) })
659
658
  ] });
660
659
  }
661
- function $a({
660
+ function Fa({
662
661
  connection: e,
663
662
  requiresSchema: n,
664
663
  search: a,
@@ -673,17 +672,17 @@ function $a({
673
672
  if (d.isLoading)
674
673
  return /* @__PURE__ */ t("div", { className: "px-8 py-1.5 text-[11px] text-muted-foreground", children: "Loading databases…" });
675
674
  const c = ((i = d.data) == null ? void 0 : i.databases) ?? [];
676
- return c.length === 0 ? /* @__PURE__ */ t("div", { className: "px-8 py-1.5 text-[11px] text-muted-foreground", children: "No databases." }) : /* @__PURE__ */ t("div", { children: c.map((r) => /* @__PURE__ */ t(
677
- nn,
675
+ return c.length === 0 ? /* @__PURE__ */ t("div", { className: "px-8 py-1.5 text-[11px] text-muted-foreground", children: "No databases." }) : /* @__PURE__ */ t("div", { children: c.map((s) => /* @__PURE__ */ t(
676
+ an,
678
677
  {
679
- label: r.database_name,
678
+ label: s.database_name,
680
679
  indentLevel: 1,
681
680
  search: a,
682
- renderChildren: (p) => p && (n ? /* @__PURE__ */ t(
683
- tn,
681
+ renderChildren: (m) => m && (n ? /* @__PURE__ */ t(
682
+ nn,
684
683
  {
685
684
  connection: e,
686
- databaseName: r.database_name,
685
+ databaseName: s.database_name,
687
686
  search: a,
688
687
  selectedEntities: o,
689
688
  onSelectionChange: u
@@ -692,7 +691,7 @@ function $a({
692
691
  pt,
693
692
  {
694
693
  connection: e,
695
- databaseName: r.database_name,
694
+ databaseName: s.database_name,
696
695
  schemaName: "",
697
696
  search: a,
698
697
  selectedEntities: o,
@@ -700,10 +699,10 @@ function $a({
700
699
  }
701
700
  ))
702
701
  },
703
- r.database_name
702
+ s.database_name
704
703
  )) });
705
704
  }
706
- function tn({
705
+ function nn({
707
706
  connection: e,
708
707
  databaseName: n,
709
708
  search: a,
@@ -723,25 +722,25 @@ function tn({
723
722
  if (d.isLoading)
724
723
  return /* @__PURE__ */ t("div", { className: "px-8 py-1.5 text-[11px] text-muted-foreground", children: "Loading schemas…" });
725
724
  const c = ((i = d.data) == null ? void 0 : i.schemas) ?? [];
726
- return c.length === 0 ? /* @__PURE__ */ t("div", { className: "px-8 py-1.5 text-[11px] text-muted-foreground", children: "No schemas." }) : /* @__PURE__ */ t("div", { children: c.map((r) => /* @__PURE__ */ t(
727
- nn,
725
+ return c.length === 0 ? /* @__PURE__ */ t("div", { className: "px-8 py-1.5 text-[11px] text-muted-foreground", children: "No schemas." }) : /* @__PURE__ */ t("div", { children: c.map((s) => /* @__PURE__ */ t(
726
+ an,
728
727
  {
729
- label: r.schema_name,
728
+ label: s.schema_name,
730
729
  indentLevel: n ? 2 : 1,
731
730
  search: a,
732
- renderChildren: (p) => p && /* @__PURE__ */ t(
731
+ renderChildren: (m) => m && /* @__PURE__ */ t(
733
732
  pt,
734
733
  {
735
734
  connection: e,
736
735
  databaseName: n,
737
- schemaName: r.schema_name,
736
+ schemaName: s.schema_name,
738
737
  search: a,
739
738
  selectedEntities: o,
740
739
  onSelectionChange: u
741
740
  }
742
741
  )
743
742
  },
744
- r.schema_name
743
+ s.schema_name
745
744
  )) });
746
745
  }
747
746
  function pt({
@@ -761,12 +760,12 @@ function pt({
761
760
  },
762
761
  ["tables", e.id, n, a]
763
762
  ), i = Q(() => {
764
- var S;
765
- const h = ((S = c.data) == null ? void 0 : S.tables) ?? [];
763
+ var k;
764
+ const h = ((k = c.data) == null ? void 0 : k.tables) ?? [];
766
765
  if (!o) return h;
767
766
  const N = o.trim().toLowerCase();
768
- return h.filter((w) => w.table_name.toLowerCase().includes(N));
769
- }, [c.data, o]), r = (h, N) => ({
767
+ return h.filter((_) => _.table_name.toLowerCase().includes(N));
768
+ }, [c.data, o]), s = (h, N) => ({
770
769
  connectionId: e.id,
771
770
  connectionType: e.type,
772
771
  type: "table",
@@ -780,32 +779,32 @@ function pt({
780
779
  return /* @__PURE__ */ t("div", { className: "px-10 py-1.5 text-[11px] text-muted-foreground", children: "Loading tables…" });
781
780
  if (i.length === 0)
782
781
  return o ? null : /* @__PURE__ */ t("div", { className: "px-10 py-1.5 text-[11px] text-muted-foreground", children: "No tables." });
783
- const p = i.map(
784
- (h) => r(h.table_name, h.table_type)
785
- ), f = p.length > 0 && p.every(
782
+ const m = i.map(
783
+ (h) => s(h.table_name, h.table_type)
784
+ ), f = m.length > 0 && m.every(
786
785
  (h) => u.some((N) => X(N, h))
787
- ), k = (h, N) => {
788
- const S = r(h, N), w = u.some(
789
- (V) => X(V, S)
786
+ ), w = (h, N) => {
787
+ const k = s(h, N), _ = u.some(
788
+ (D) => X(D, k)
790
789
  );
791
790
  d(
792
- w ? u.filter((V) => !X(V, S)) : [...u, S]
791
+ _ ? u.filter((D) => !X(D, k)) : [...u, k]
793
792
  );
794
793
  }, y = () => {
795
- if (p.length === 0) return;
794
+ if (m.length === 0) return;
796
795
  if (f) {
797
796
  d(
798
797
  u.filter(
799
- (N) => !p.some(
800
- (S) => X(N, S)
798
+ (N) => !m.some(
799
+ (k) => X(N, k)
801
800
  )
802
801
  )
803
802
  );
804
803
  return;
805
804
  }
806
805
  const h = [...u];
807
- for (const N of p)
808
- h.some((S) => X(S, N)) || h.push(N);
806
+ for (const N of m)
807
+ h.some((k) => X(k, N)) || h.push(N);
809
808
  d(h);
810
809
  };
811
810
  return /* @__PURE__ */ l("ul", { children: [
@@ -826,20 +825,20 @@ function pt({
826
825
  )
827
826
  ] }),
828
827
  i.map((h) => {
829
- const N = r(h.table_name, h.table_type), S = u.some(
830
- (w) => X(w, N)
828
+ const N = s(h.table_name, h.table_type), k = u.some(
829
+ (_) => X(_, N)
831
830
  );
832
831
  return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l("label", { className: "flex cursor-pointer items-center gap-2.5 py-1.5 pl-12 pr-4 transition-colors hover:bg-muted/40", children: [
833
832
  /* @__PURE__ */ t(
834
833
  Ge,
835
834
  {
836
- checked: S,
837
- onCheckedChange: () => k(h.table_name, h.table_type),
835
+ checked: k,
836
+ onCheckedChange: () => w(h.table_name, h.table_type),
838
837
  className: "h-3.5 w-3.5 shrink-0"
839
838
  }
840
839
  ),
841
840
  /* @__PURE__ */ t(
842
- un,
841
+ mn,
843
842
  {
844
843
  className: "h-3.5 w-3.5 shrink-0 text-muted-foreground",
845
844
  strokeWidth: 1.75
@@ -853,7 +852,7 @@ function pt({
853
852
  })
854
853
  ] });
855
854
  }
856
- function Fa({
855
+ function Oa({
857
856
  connection: e,
858
857
  search: n,
859
858
  selectedEntities: a,
@@ -863,17 +862,17 @@ function Fa({
863
862
  "datamodels",
864
863
  e.id
865
864
  ]), d = Q(() => {
866
- var p;
867
- const i = ((p = u.data) == null ? void 0 : p.datamodels) ?? [];
865
+ var m;
866
+ const i = ((m = u.data) == null ? void 0 : m.datamodels) ?? [];
868
867
  if (!n) return i;
869
- const r = n.trim().toLowerCase();
868
+ const s = n.trim().toLowerCase();
870
869
  return i.filter(
871
- (f) => `${f.label ?? ""} ${f.name ?? ""} ${f.description ?? ""}`.toLowerCase().includes(r)
870
+ (f) => `${f.label ?? ""} ${f.name ?? ""} ${f.description ?? ""}`.toLowerCase().includes(s)
872
871
  );
873
872
  }, [u.data, n]);
874
873
  if (u.isLoading || d.length === 0) return null;
875
874
  const c = (i) => {
876
- const r = {
875
+ const s = {
877
876
  id: i.id,
878
877
  name: i.name,
879
878
  label: i.label || "",
@@ -884,17 +883,17 @@ function Fa({
884
883
  dialect: i.dialect ?? e.dialect,
885
884
  database: i.database || "",
886
885
  schema: i.schema || ""
887
- }, p = a.some(
888
- (f) => X(f, r)
886
+ }, m = a.some(
887
+ (f) => X(f, s)
889
888
  );
890
889
  o(
891
- p ? a.filter((f) => !X(f, r)) : [...a, r]
890
+ m ? a.filter((f) => !X(f, s)) : [...a, s]
892
891
  );
893
892
  };
894
893
  return /* @__PURE__ */ l("div", { children: [
895
894
  /* @__PURE__ */ t("div", { className: "px-8 pb-1 pt-2", children: /* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Data models" }) }),
896
895
  /* @__PURE__ */ t("ul", { children: d.map((i) => {
897
- const r = {
896
+ const s = {
898
897
  id: i.id,
899
898
  name: i.name,
900
899
  label: i.label || "",
@@ -905,20 +904,20 @@ function Fa({
905
904
  dialect: i.dialect ?? e.dialect,
906
905
  database: i.database || "",
907
906
  schema: i.schema || ""
908
- }, p = a.some(
909
- (f) => X(f, r)
907
+ }, m = a.some(
908
+ (f) => X(f, s)
910
909
  );
911
910
  return /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l("label", { className: "flex cursor-pointer items-start gap-2.5 py-1.5 pl-12 pr-4 transition-colors hover:bg-muted/40", children: [
912
911
  /* @__PURE__ */ t(
913
912
  Ge,
914
913
  {
915
- checked: p,
914
+ checked: m,
916
915
  onCheckedChange: () => c(i),
917
916
  className: "mt-[2px] h-3.5 w-3.5 shrink-0"
918
917
  }
919
918
  ),
920
919
  /* @__PURE__ */ t(
921
- ga,
920
+ ba,
922
921
  {
923
922
  className: "mt-[2px] h-3.5 w-3.5 shrink-0 text-muted-foreground",
924
923
  strokeWidth: 1.75
@@ -935,7 +934,7 @@ function Fa({
935
934
  }) })
936
935
  ] });
937
936
  }
938
- function nn({
937
+ function an({
939
938
  label: e,
940
939
  indentLevel: n,
941
940
  search: a,
@@ -947,8 +946,8 @@ function nn({
947
946
  "button",
948
947
  {
949
948
  type: "button",
950
- onClick: () => d((r) => !r),
951
- className: M(
949
+ onClick: () => d((s) => !s),
950
+ className: z(
952
951
  "flex h-6 w-full items-center gap-1.5 pr-4 text-left transition-colors hover:bg-muted/40",
953
952
  n === 1 ? "pl-8" : "pl-10"
954
953
  ),
@@ -956,7 +955,7 @@ function nn({
956
955
  /* @__PURE__ */ t(
957
956
  Ie,
958
957
  {
959
- className: M(
958
+ className: z(
960
959
  "h-2.5 w-2.5 shrink-0 text-muted-foreground transition-transform",
961
960
  c && "rotate-90"
962
961
  ),
@@ -987,20 +986,20 @@ function Be(e, n, a, o = !0) {
987
986
  enabled: o && !!(d != null && d.accessToken) && Object.values(c).every((i) => i.length > 0)
988
987
  });
989
988
  }
990
- function Oa(e) {
989
+ function _a(e) {
991
990
  return e.type === "dataset" && e.label || e.name;
992
991
  }
993
- function _a(e, n) {
992
+ function Va(e, n) {
994
993
  if (!(e.type !== "dataset" || !e.domainId || !n))
995
994
  return n.get(e.domainId);
996
995
  }
997
- function Va({
996
+ function Ra({
998
997
  selectedEntities: e,
999
998
  onDeselectEntity: n,
1000
999
  semanticDomainLabels: a
1001
1000
  }) {
1002
1001
  return e.length === 0 ? null : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: e.map((o, u) => /* @__PURE__ */ t(
1003
- Ra,
1002
+ Ea,
1004
1003
  {
1005
1004
  entity: o,
1006
1005
  semanticDomainLabels: a,
@@ -1009,12 +1008,12 @@ function Va({
1009
1008
  `${o.type}-${o.name}-${u}`
1010
1009
  )) });
1011
1010
  }
1012
- function Ra({
1011
+ function Ea({
1013
1012
  entity: e,
1014
1013
  semanticDomainLabels: n,
1015
1014
  onDeselect: a
1016
1015
  }) {
1017
- const o = Oa(e), u = _a(e, n), d = u ? `${o} from ${u}` : o;
1016
+ const o = _a(e), u = Va(e, n), d = u ? `${o} from ${u}` : o;
1018
1017
  return /* @__PURE__ */ l(
1019
1018
  "span",
1020
1019
  {
@@ -1058,11 +1057,11 @@ function Cr({
1058
1057
  onDataSourceChange: u
1059
1058
  }) {
1060
1059
  var Se, me;
1061
- const { tokenProps: d } = ct(), c = d.config, i = d.semanticDomainAccess || Hn, [r, p] = H([]), [f, k] = H(""), [y, h] = H("all"), [N, S] = H(
1060
+ const { tokenProps: d } = ct(), c = d.config, i = d.semanticDomainAccess || Hn, [s, m] = H([]), [f, w] = H(""), [y, h] = H("all"), [N, k] = H(
1062
1061
  void 0
1063
- ), w = Ae(!1), { updateDataSource: V } = Rt(), U = u ?? V, O = i.mode, T = (c == null ? void 0 : c.showDirectSource) !== !1, P = O === "include" || O === "exclude" || !T, J = O !== "all", m = T && !P, I = P ? "semanticDomain" : a.mode, A = !T, D = O === "include" && (((Se = i.domainIds) == null ? void 0 : Se.length) || 0) === 1 ? (me = i.domainIds) == null ? void 0 : me[0] : void 0, b = ne(
1062
+ ), _ = Ae(!1), { updateDataSource: D } = Rt(), j = u ?? D, O = i.mode, T = (c == null ? void 0 : c.showDirectSource) !== !1, P = O === "include" || O === "exclude" || !T, J = O !== "all", p = T && !P, I = P ? "semanticDomain" : a.mode, A = !T, S = O === "include" && (((Se = i.domainIds) == null ? void 0 : Se.length) || 0) === 1 ? (me = i.domainIds) == null ? void 0 : me[0] : void 0, v = ne(
1064
1063
  ($) => {
1065
- w.current = !0, U({
1064
+ _.current = !0, j({
1066
1065
  ...a,
1067
1066
  connectionId: (a == null ? void 0 : a.connectionId) || "",
1068
1067
  connectionType: (a == null ? void 0 : a.connectionType) || "",
@@ -1071,25 +1070,25 @@ function Cr({
1071
1070
  ...$ !== "semanticDomain" && { semanticDomainId: void 0 }
1072
1071
  });
1073
1072
  },
1074
- [a, U]
1073
+ [a, j]
1075
1074
  ), x = ne(
1076
1075
  ($) => {
1077
- U({
1076
+ j({
1078
1077
  ...a,
1079
1078
  ...$
1080
1079
  });
1081
1080
  },
1082
- [a, U]
1081
+ [a, j]
1083
1082
  );
1084
1083
  de(() => {
1085
- var v;
1084
+ var b;
1086
1085
  if (P && a.mode !== "semanticDomain") {
1087
- b("semanticDomain");
1086
+ v("semanticDomain");
1088
1087
  return;
1089
1088
  }
1090
1089
  if (!J || I !== "semanticDomain") return;
1091
- const $ = i.domainIds ?? [], ae = (((v = a.selectedEntities) == null ? void 0 : v.length) ?? 0) > 0, s = ((r == null ? void 0 : r.length) ?? 0) > 0;
1092
- Na({
1090
+ const $ = i.domainIds ?? [], ae = (((b = a.selectedEntities) == null ? void 0 : b.length) ?? 0) > 0, r = ((s == null ? void 0 : s.length) ?? 0) > 0;
1091
+ Ca({
1093
1092
  mode: O,
1094
1093
  currentDomainId: a.semanticDomainId,
1095
1094
  scopedDomainIds: $,
@@ -1097,7 +1096,7 @@ function Cr({
1097
1096
  }) && (x({
1098
1097
  semanticDomainId: void 0,
1099
1098
  selectedEntities: []
1100
- }), s && p([]));
1099
+ }), r && m([]));
1101
1100
  }, [
1102
1101
  P,
1103
1102
  J,
@@ -1105,86 +1104,86 @@ function Cr({
1105
1104
  a.mode,
1106
1105
  a.semanticDomainId,
1107
1106
  a.selectedEntities,
1108
- r,
1107
+ s,
1109
1108
  i.domainIds,
1110
1109
  O,
1111
1110
  x,
1112
- b
1111
+ v
1113
1112
  ]), de(() => {
1114
- D && !a.semanticDomainId && x({ semanticDomainId: D });
1115
- }, [D, a.semanticDomainId, x]), de(() => {
1113
+ S && !a.semanticDomainId && x({ semanticDomainId: S });
1114
+ }, [S, a.semanticDomainId, x]), de(() => {
1116
1115
  if (!e) {
1117
- w.current = !1, k(""), S(void 0), h(P ? "semantic" : "all");
1116
+ _.current = !1, w(""), k(void 0), h(P ? "semantic" : "all");
1118
1117
  return;
1119
1118
  }
1120
- w.current || (p([...o || []]), S(
1119
+ _.current || (m([...o || []]), k(
1121
1120
  Xe(o)
1122
1121
  ));
1123
1122
  }, [e, o, P]);
1124
- const z = ($) => {
1125
- w.current = !0, p(
1126
- r.filter((ae) => !X(ae, $))
1123
+ const q = ($) => {
1124
+ _.current = !0, m(
1125
+ s.filter((ae) => !X(ae, $))
1127
1126
  );
1128
1127
  }, C = ne(
1129
1128
  ($, ae) => {
1130
- w.current = !0, p($), S(
1129
+ _.current = !0, m($), k(
1131
1130
  ae ?? Xe($)
1132
1131
  );
1133
1132
  },
1134
1133
  []
1135
- ), G = () => {
1136
- var ae, s;
1137
- const $ = Xe(r) ?? N ?? I;
1134
+ ), Z = () => {
1135
+ var ae, r;
1136
+ const $ = Xe(s) ?? N ?? I;
1138
1137
  if ($ === "semanticDomain") {
1139
- const g = Zt(r) || a.semanticDomainId, v = ((ae = r == null ? void 0 : r[0]) == null ? void 0 : ae.connectionId) || a.connectionId, L = ((s = r == null ? void 0 : r[0]) == null ? void 0 : s.connectionType) || a.connectionType;
1140
- U({
1138
+ const g = en(s) || a.semanticDomainId, b = ((ae = s == null ? void 0 : s[0]) == null ? void 0 : ae.connectionId) || a.connectionId, L = ((r = s == null ? void 0 : s[0]) == null ? void 0 : r.connectionType) || a.connectionType;
1139
+ j({
1141
1140
  ...a,
1142
1141
  mode: "semanticDomain",
1143
1142
  semanticDomainId: g,
1144
- connectionId: v,
1143
+ connectionId: b,
1145
1144
  connectionType: L,
1146
- selectedEntities: r
1145
+ selectedEntities: s
1147
1146
  });
1148
1147
  } else if ($ === "upload" || $ === "url") {
1149
- const g = r == null ? void 0 : r[0];
1150
- U({
1148
+ const g = s == null ? void 0 : s[0];
1149
+ j({
1151
1150
  ...a,
1152
1151
  mode: $,
1153
1152
  semanticDomainId: void 0,
1154
1153
  connectionId: (g == null ? void 0 : g.connectionId) || a.connectionId,
1155
1154
  connectionType: (g == null ? void 0 : g.connectionType) || a.connectionType,
1156
- selectedEntities: r
1155
+ selectedEntities: s
1157
1156
  });
1158
1157
  } else {
1159
- const g = r == null ? void 0 : r[0];
1160
- U({
1158
+ const g = s == null ? void 0 : s[0];
1159
+ j({
1161
1160
  ...a,
1162
1161
  mode: "database",
1163
1162
  semanticDomainId: void 0,
1164
1163
  connectionId: (g == null ? void 0 : g.connectionId) || a.connectionId,
1165
1164
  connectionType: (g == null ? void 0 : g.connectionType) || a.connectionType,
1166
- selectedEntities: r
1165
+ selectedEntities: s
1167
1166
  });
1168
1167
  }
1169
1168
  n(!1);
1170
- }, { semanticDomains: _ } = Jt(), { connections: K } = Vt(), ee = Q(
1169
+ }, { semanticDomains: V } = Zt(), { connections: M } = Vt(), K = Q(
1171
1170
  () => new Map(
1172
- _.map(($) => [
1171
+ V.map(($) => [
1173
1172
  $.id,
1174
1173
  $.label || $.name
1175
1174
  ])
1176
1175
  ),
1177
- [_]
1178
- ), q = ($) => {
1179
- h($), $ === "semantic" || $.startsWith("domain:") ? a.mode !== "semanticDomain" && b("semanticDomain") : ($ === "direct" || $.startsWith("conn:")) && a.mode === "semanticDomain" && b("database");
1180
- }, Z = y.startsWith("domain:"), te = y.startsWith("conn:"), We = Z ? y.slice(7) : void 0, Ke = te ? y.slice(5) : void 0, oe = !m || y === "all" || y === "semantic" || Z, Te = T && !P && (y === "all" || y === "direct" || te), ue = ((o == null ? void 0 : o.length) ?? 0) > 0, Ce = r.length === 0 && !ue, we = r.length === 0 && ue ? "Clear" : "Add", ke = A ? "Select dataset" : "Add data";
1181
- return /* @__PURE__ */ t(yn, { open: e, onOpenChange: n, children: /* @__PURE__ */ l(
1182
- Nn,
1176
+ [V]
1177
+ ), U = ($) => {
1178
+ h($), $ === "semantic" || $.startsWith("domain:") ? a.mode !== "semanticDomain" && v("semanticDomain") : ($ === "direct" || $.startsWith("conn:")) && a.mode === "semanticDomain" && v("database");
1179
+ }, ee = y.startsWith("domain:"), te = y.startsWith("conn:"), We = ee ? y.slice(7) : void 0, Ke = te ? y.slice(5) : void 0, oe = !p || y === "all" || y === "semantic" || ee, Te = T && !P && (y === "all" || y === "direct" || te), ue = ((o == null ? void 0 : o.length) ?? 0) > 0, Ce = s.length === 0 && !ue, we = s.length === 0 && ue ? "Clear" : "Add", ke = A ? "Select dataset" : "Add data";
1180
+ return /* @__PURE__ */ t(Nn, { open: e, onOpenChange: n, children: /* @__PURE__ */ l(
1181
+ Cn,
1183
1182
  {
1184
1183
  showCloseButton: !1,
1185
1184
  className: "flex h-[560px] w-[620px] max-w-[620px] flex-col gap-0 overflow-hidden rounded-[6px] border border-border bg-popover p-0",
1186
1185
  children: [
1187
- /* @__PURE__ */ t(mn, { children: /* @__PURE__ */ t(Cn, { children: ke }) }),
1186
+ /* @__PURE__ */ t(pn, { children: /* @__PURE__ */ t(wn, { children: ke }) }),
1188
1187
  /* @__PURE__ */ l("div", { className: "flex items-start justify-between border-b border-border px-4 py-2.5", children: [
1189
1188
  /* @__PURE__ */ l("div", { children: [
1190
1189
  /* @__PURE__ */ t("p", { className: "text-[14px] font-semibold text-foreground", children: ke }),
@@ -1203,13 +1202,13 @@ function Cr({
1203
1202
  ] }),
1204
1203
  /* @__PURE__ */ l("div", { className: "border-b border-border px-4 py-2.5", children: [
1205
1204
  /* @__PURE__ */ l("div", { className: "flex h-7 items-center gap-1.5 rounded-control border border-input bg-background px-2 focus-within:border-ring", children: [
1206
- /* @__PURE__ */ t(wn, { className: "h-3 w-3 shrink-0 text-muted-foreground" }),
1205
+ /* @__PURE__ */ t(kn, { className: "h-3 w-3 shrink-0 text-muted-foreground" }),
1207
1206
  /* @__PURE__ */ t(
1208
1207
  "input",
1209
1208
  {
1210
1209
  type: "text",
1211
1210
  value: f,
1212
- onChange: ($) => k($.target.value),
1211
+ onChange: ($) => w($.target.value),
1213
1212
  placeholder: "Search datasets, tables, views, models",
1214
1213
  className: "h-full w-full bg-transparent text-[12px] text-foreground placeholder:text-muted-foreground/60 focus:outline-none"
1215
1214
  }
@@ -1218,14 +1217,14 @@ function Cr({
1218
1217
  "button",
1219
1218
  {
1220
1219
  type: "button",
1221
- onClick: () => k(""),
1220
+ onClick: () => w(""),
1222
1221
  "aria-label": "Clear search",
1223
1222
  className: "inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-control text-muted-foreground hover:bg-muted hover:text-foreground",
1224
1223
  children: /* @__PURE__ */ t(ce, { className: "h-3 w-3" })
1225
1224
  }
1226
1225
  )
1227
1226
  ] }),
1228
- m && // Horizontal scroll strip — chips stay on a single row
1227
+ p && // Horizontal scroll strip — chips stay on a single row
1229
1228
  // regardless of how many sources exist. Mock canon: the
1230
1229
  // chip rail never grows the picker's header height.
1231
1230
  /* @__PURE__ */ t("div", { className: "-mx-4 mt-2 overflow-x-auto px-4 [scrollbar-width:none] [&::-webkit-scrollbar]:hidden", children: /* @__PURE__ */ l("div", { className: "flex w-max items-center gap-1", children: [
@@ -1234,16 +1233,16 @@ function Cr({
1234
1233
  {
1235
1234
  label: "All",
1236
1235
  active: y === "all",
1237
- onClick: () => q("all")
1236
+ onClick: () => U("all")
1238
1237
  }
1239
1238
  ),
1240
- (_.length > 0 || K.length > 0) && /* @__PURE__ */ l(fe, { children: [
1239
+ (V.length > 0 || M.length > 0) && /* @__PURE__ */ l(fe, { children: [
1241
1240
  /* @__PURE__ */ t(
1242
1241
  De,
1243
1242
  {
1244
1243
  label: "Semantic",
1245
1244
  active: y === "semantic",
1246
- onClick: () => q("semantic")
1245
+ onClick: () => U("semantic")
1247
1246
  }
1248
1247
  ),
1249
1248
  /* @__PURE__ */ t(
@@ -1251,26 +1250,26 @@ function Cr({
1251
1250
  {
1252
1251
  label: "Direct",
1253
1252
  active: y === "direct",
1254
- onClick: () => q("direct")
1253
+ onClick: () => U("direct")
1255
1254
  }
1256
1255
  ),
1257
1256
  /* @__PURE__ */ t("span", { className: "shrink-0 px-0.5 text-muted-foreground/50", children: "·" })
1258
1257
  ] }),
1259
- _.map(($) => /* @__PURE__ */ t(
1258
+ V.map(($) => /* @__PURE__ */ t(
1260
1259
  De,
1261
1260
  {
1262
1261
  label: $.label || $.name,
1263
1262
  active: y === `domain:${$.id}`,
1264
- onClick: () => q(`domain:${$.id}`)
1263
+ onClick: () => U(`domain:${$.id}`)
1265
1264
  },
1266
1265
  `domain:${$.id}`
1267
1266
  )),
1268
- K.map(($) => /* @__PURE__ */ t(
1267
+ M.map(($) => /* @__PURE__ */ t(
1269
1268
  De,
1270
1269
  {
1271
1270
  label: $.name,
1272
1271
  active: y === `conn:${$.id}`,
1273
- onClick: () => q(`conn:${$.id}`)
1272
+ onClick: () => U(`conn:${$.id}`)
1274
1273
  },
1275
1274
  `conn:${$.id}`
1276
1275
  ))
@@ -1278,21 +1277,21 @@ function Cr({
1278
1277
  ] }),
1279
1278
  /* @__PURE__ */ l("div", { className: "flex-1 overflow-y-auto py-1", children: [
1280
1279
  oe && /* @__PURE__ */ t(
1281
- ka,
1280
+ Sa,
1282
1281
  {
1283
1282
  domainAccess: i,
1284
1283
  search: f,
1285
1284
  scopeDomainId: We,
1286
- selectedEntities: r,
1285
+ selectedEntities: s,
1287
1286
  onSelectionChange: ($) => C($, "semanticDomain")
1288
1287
  }
1289
1288
  ),
1290
1289
  Te && /* @__PURE__ */ t(
1291
- Ia,
1290
+ Ta,
1292
1291
  {
1293
1292
  search: f,
1294
1293
  scopeConnectionId: Ke,
1295
- selectedEntities: r,
1294
+ selectedEntities: s,
1296
1295
  onSelectionChange: ($) => C($)
1297
1296
  }
1298
1297
  )
@@ -1303,7 +1302,7 @@ function Cr({
1303
1302
  /* @__PURE__ */ t("span", { children: "Selected" }),
1304
1303
  /* @__PURE__ */ l("span", { className: "font-mono tabular-nums text-muted-foreground/70", children: [
1305
1304
  "· ",
1306
- r.length
1305
+ s.length
1307
1306
  ] })
1308
1307
  ] }),
1309
1308
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
@@ -1320,29 +1319,29 @@ function Cr({
1320
1319
  "button",
1321
1320
  {
1322
1321
  type: "button",
1323
- onClick: G,
1322
+ onClick: Z,
1324
1323
  disabled: Ce,
1325
- className: M(
1324
+ className: z(
1326
1325
  "inline-flex h-7 items-center gap-1.5 rounded-control bg-primary px-2.5 text-[12px] font-medium text-primary-foreground transition-colors hover:bg-primary/90",
1327
1326
  Ce && "cursor-not-allowed opacity-50 hover:bg-primary"
1328
1327
  ),
1329
1328
  children: [
1330
1329
  /* @__PURE__ */ t("span", { children: we }),
1331
- r.length > 0 && /* @__PURE__ */ l("span", { className: "font-mono tabular-nums text-primary-foreground/70", children: [
1330
+ s.length > 0 && /* @__PURE__ */ l("span", { className: "font-mono tabular-nums text-primary-foreground/70", children: [
1332
1331
  "· ",
1333
- r.length
1332
+ s.length
1334
1333
  ] })
1335
1334
  ]
1336
1335
  }
1337
1336
  )
1338
1337
  ] })
1339
1338
  ] }),
1340
- r.length > 0 && /* @__PURE__ */ t(
1341
- Va,
1339
+ s.length > 0 && /* @__PURE__ */ t(
1340
+ Ra,
1342
1341
  {
1343
- selectedEntities: r,
1344
- onDeselectEntity: z,
1345
- semanticDomainLabels: ee
1342
+ selectedEntities: s,
1343
+ onDeselectEntity: q,
1344
+ semanticDomainLabels: K
1346
1345
  }
1347
1346
  )
1348
1347
  ] })
@@ -1361,7 +1360,7 @@ function De({
1361
1360
  type: "button",
1362
1361
  onClick: a,
1363
1362
  "aria-pressed": n,
1364
- className: M(
1363
+ className: z(
1365
1364
  "inline-flex h-6 shrink-0 items-center whitespace-nowrap rounded-control px-2 text-[11px] font-medium transition-colors",
1366
1365
  n ? "bg-primary text-primary-foreground hover:bg-primary/90" : "text-muted-foreground hover:bg-muted hover:text-foreground"
1367
1366
  ),
@@ -1380,8 +1379,8 @@ function wr() {
1380
1379
  de(() => {
1381
1380
  var h;
1382
1381
  if (!e) return;
1383
- const { tableName: c, schemaName: i, databaseName: r, connectionId: p } = kn(e), f = (h = e.selectedEntities) == null ? void 0 : h[0], y = (f == null ? void 0 : f.type) === "model" && "id" in f ? f.id : "";
1384
- n(p || ""), a(r || ""), o(i || ""), u(c || ""), d(y);
1382
+ const { tableName: c, schemaName: i, databaseName: s, connectionId: m } = Sn(e), f = (h = e.selectedEntities) == null ? void 0 : h[0], y = (f == null ? void 0 : f.type) === "model" && "id" in f ? f.id : "";
1383
+ n(m || ""), a(s || ""), o(i || ""), u(c || ""), d(y);
1385
1384
  }, [
1386
1385
  e,
1387
1386
  n,
@@ -1398,25 +1397,25 @@ function kr({
1398
1397
  showLabel: o = !1,
1399
1398
  showLocal: u = !1
1400
1399
  }) {
1401
- const d = ut((S) => S.selectedFrameId), c = Sn((S) => S.selectedVisual), i = se((S) => S.frame);
1402
- let r;
1400
+ const d = ut((k) => k.selectedFrameId), c = Dn((k) => k.selectedVisual), i = se((k) => k.frame);
1401
+ let s;
1403
1402
  if (e)
1404
- r = e;
1403
+ s = e;
1405
1404
  else if (n !== void 0)
1406
- r = n ? "linked" : "library";
1405
+ s = n ? "linked" : "library";
1407
1406
  else if (!!!(i != null && i.visualId || c != null && c.id) && d)
1408
- r = "local";
1407
+ s = "local";
1409
1408
  else if (c && !d)
1410
- r = "library";
1409
+ s = "library";
1411
1410
  else if (i != null && i.visualId && d)
1412
- r = "linked";
1411
+ s = "linked";
1413
1412
  else if (c != null && c.id && d)
1414
- r = "library";
1413
+ s = "library";
1415
1414
  else
1416
1415
  return null;
1417
- if (r === "local" && !u)
1416
+ if (s === "local" && !u)
1418
1417
  return null;
1419
- const p = {
1418
+ const m = {
1420
1419
  local: "border-slate-200/70 bg-slate-50/80 text-slate-700 shadow-sm hover:bg-slate-100/80 dark:border-slate-700 dark:bg-slate-900/70 dark:text-slate-200 dark:hover:bg-slate-800/80",
1421
1420
  linked: "border-purple-200/70 bg-gradient-to-r from-purple-50/50 to-purple-100/30 text-purple-900 shadow-sm hover:from-purple-100/60 hover:to-purple-100/50 hover:shadow-md dark:border-purple-800/50 dark:from-purple-950/40 dark:to-purple-900/30 dark:text-purple-100 dark:hover:from-purple-950/60 dark:hover:to-purple-900/50",
1422
1421
  library: "border-blue-200/70 bg-gradient-to-r from-blue-50/50 to-blue-100/30 text-blue-900 shadow-sm hover:from-blue-100/60 hover:to-blue-100/50 hover:shadow-md dark:border-blue-800/50 dark:from-blue-950/40 dark:to-blue-900/30 dark:text-blue-100 dark:hover:from-blue-950/60 dark:hover:to-blue-900/50"
@@ -1424,7 +1423,7 @@ function kr({
1424
1423
  local: "Local to this dashboard: Changes made here only affect this dashboard copy.",
1425
1424
  linked: "Linked to library: Changes made here update the library visual and all linked instances.",
1426
1425
  library: "Library visual: Share and reuse this visual across multiple dashboards."
1427
- }, k = {
1426
+ }, w = {
1428
1427
  local: "border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",
1429
1428
  linked: "border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",
1430
1429
  library: "border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"
@@ -1434,8 +1433,8 @@ function kr({
1434
1433
  library: "fill-blue-50 dark:fill-blue-950"
1435
1434
  }, h = {
1436
1435
  local: /* @__PURE__ */ t("span", { className: "h-2 w-2 rounded-full bg-current/70" }),
1437
- linked: /* @__PURE__ */ t(va, { className: "h-3.5 w-3.5" }),
1438
- library: /* @__PURE__ */ t(ba, { className: "h-3.5 w-3.5" })
1436
+ linked: /* @__PURE__ */ t(ya, { className: "h-3.5 w-3.5" }),
1437
+ library: /* @__PURE__ */ t(va, { className: "h-3.5 w-3.5" })
1439
1438
  }, N = {
1440
1439
  local: "Local",
1441
1440
  linked: "Linked",
@@ -1443,17 +1442,17 @@ function kr({
1443
1442
  };
1444
1443
  return /* @__PURE__ */ t(at, { children: /* @__PURE__ */ l(rt, { delayDuration: 300, children: [
1445
1444
  /* @__PURE__ */ t(st, { asChild: !0, children: /* @__PURE__ */ l(
1446
- Dn,
1445
+ In,
1447
1446
  {
1448
1447
  variant: "outline",
1449
- className: M(
1448
+ className: z(
1450
1449
  "cursor-help select-none transition-all",
1451
- p[r],
1450
+ m[s],
1452
1451
  a
1453
1452
  ),
1454
1453
  children: [
1455
- h[r],
1456
- o && /* @__PURE__ */ t("span", { className: "ml-1 text-xs font-medium leading-none", children: N[r] })
1454
+ h[s],
1455
+ o && /* @__PURE__ */ t("span", { className: "ml-1 text-xs font-medium leading-none", children: N[s] })
1457
1456
  ]
1458
1457
  }
1459
1458
  ) }),
@@ -1461,16 +1460,16 @@ function kr({
1461
1460
  ot,
1462
1461
  {
1463
1462
  side: "bottom",
1464
- className: M("max-w-xs", k[r]),
1463
+ className: z("max-w-xs", w[s]),
1465
1464
  children: [
1466
- /* @__PURE__ */ t(Ot, { className: y[r] }),
1467
- /* @__PURE__ */ t("p", { children: f[r] })
1465
+ /* @__PURE__ */ t(Ot, { className: y[s] }),
1466
+ /* @__PURE__ */ t("p", { children: f[s] })
1468
1467
  ]
1469
1468
  }
1470
1469
  )
1471
1470
  ] }) });
1472
1471
  }
1473
- const Ea = hn(
1472
+ const Ma = xn(
1474
1473
  ({
1475
1474
  side: e = "bottom",
1476
1475
  children: n,
@@ -1480,19 +1479,19 @@ const Ea = hn(
1480
1479
  openDelay: d = 300,
1481
1480
  buttonProps: c,
1482
1481
  disabled: i,
1483
- ...r
1484
- }, p) => /* @__PURE__ */ t(at, { children: /* @__PURE__ */ l(rt, { delayDuration: d, children: [
1482
+ ...s
1483
+ }, m) => /* @__PURE__ */ t(at, { children: /* @__PURE__ */ l(rt, { delayDuration: d, children: [
1485
1484
  /* @__PURE__ */ t(st, { asChild: !0, children: /* @__PURE__ */ t(
1486
- j,
1485
+ G,
1487
1486
  {
1488
1487
  disabled: i,
1489
- ref: p,
1488
+ ref: m,
1490
1489
  size: "sm",
1491
1490
  variant: "ghost",
1492
1491
  onClick: u,
1493
- ...r,
1492
+ ...s,
1494
1493
  ...c,
1495
- className: M(`${Pn}`, a),
1494
+ className: z(`${Pn}`, a),
1496
1495
  children: n
1497
1496
  }
1498
1497
  ) }),
@@ -1501,7 +1500,7 @@ const Ea = hn(
1501
1500
  {
1502
1501
  side: e,
1503
1502
  sideOffset: 10,
1504
- className: M(
1503
+ className: z(
1505
1504
  "border-foreground/20 bg-foreground text-background"
1506
1505
  ),
1507
1506
  children: [
@@ -1512,20 +1511,20 @@ const Ea = hn(
1512
1511
  )
1513
1512
  ] }) })
1514
1513
  );
1515
- Ea.displayName = "IconButton";
1516
- function Ma(e, n) {
1517
- var r, p;
1518
- const a = e.qualifiedFieldName || e.name, o = e.qualifiedFieldName ? e.qualifiedFieldName.split(".").slice(0, -1).join(".") : e.qualifiedEntityName || e.entityName, u = n.connectionId || ((r = n.dataSource) == null ? void 0 : r.connectionId) || "", d = Yn(e), c = Xn(
1514
+ Ma.displayName = "IconButton";
1515
+ function za(e, n) {
1516
+ var s, m;
1517
+ const a = e.qualifiedFieldName || e.name, o = e.qualifiedFieldName ? e.qualifiedFieldName.split(".").slice(0, -1).join(".") : e.qualifiedEntityName || e.entityName, u = n.connectionId || ((s = n.dataSource) == null ? void 0 : s.connectionId) || "", d = Yn(e), c = Xn(
1519
1518
  n.dataSource,
1520
1519
  {
1521
1520
  connectionId: u,
1522
- connectionType: (p = n.dataSource) == null ? void 0 : p.connectionType
1521
+ connectionType: (m = n.dataSource) == null ? void 0 : m.connectionType
1523
1522
  },
1524
1523
  e
1525
1524
  ), i = Jn(n.dataSource, c, e) || "";
1526
1525
  return {
1527
1526
  column: a,
1528
- title: Xt(e),
1527
+ title: Jt(e),
1529
1528
  dataType: e.dataType,
1530
1529
  ...e.nativeDataType ? { nativeDataType: e.nativeDataType } : {},
1531
1530
  table: e.entityName || "",
@@ -1538,7 +1537,7 @@ function Ma(e, n) {
1538
1537
  semanticContext: c
1539
1538
  };
1540
1539
  }
1541
- function an(e) {
1540
+ function rn(e) {
1542
1541
  const { control: n, onChange: a } = e;
1543
1542
  return /* @__PURE__ */ l("div", { className: "flex flex-col gap-1.5", children: [
1544
1543
  /* @__PURE__ */ t(le, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Label" }),
@@ -1553,16 +1552,16 @@ function an(e) {
1553
1552
  )
1554
1553
  ] });
1555
1554
  }
1556
- function za(e) {
1555
+ function qa(e) {
1557
1556
  const { currentStep: n, labels: a } = e;
1558
1557
  return /* @__PURE__ */ t("div", { className: "sticky top-0 z-10 -mx-1 border-b border-border/60 bg-background/95 px-1 pb-2.5 pt-1 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center gap-2 sm:gap-2.5", children: a.map((o, u) => {
1559
1558
  const d = u + 1, c = d === n, i = d < n;
1560
- return /* @__PURE__ */ l(xn, { children: [
1559
+ return /* @__PURE__ */ l(gn, { children: [
1561
1560
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
1562
1561
  /* @__PURE__ */ t(
1563
1562
  "span",
1564
1563
  {
1565
- className: M(
1564
+ className: z(
1566
1565
  "flex h-5 w-5 items-center justify-center rounded-full border text-[10px] font-medium tabular-nums",
1567
1566
  c ? "border-foreground bg-foreground text-background" : i ? "border-foreground/30 bg-foreground/10 text-foreground" : "border-border/60 bg-background text-muted-foreground"
1568
1567
  ),
@@ -1572,7 +1571,7 @@ function za(e) {
1572
1571
  /* @__PURE__ */ t(
1573
1572
  "span",
1574
1573
  {
1575
- className: M(
1574
+ className: z(
1576
1575
  "text-[12px]",
1577
1576
  c ? "font-medium text-foreground" : "text-muted-foreground"
1578
1577
  ),
@@ -1598,10 +1597,10 @@ function je(e) {
1598
1597
  o
1599
1598
  ] });
1600
1599
  }
1601
- function qa(e) {
1600
+ function ja(e) {
1602
1601
  const { control: n, scope: a, detail: o } = e;
1603
1602
  return /* @__PURE__ */ l("div", { className: "flex items-start gap-2.5 rounded-control border border-border/60 bg-muted/30 px-3 py-2.5", children: [
1604
- /* @__PURE__ */ t(On, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-foreground" }),
1603
+ /* @__PURE__ */ t(_n, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-foreground" }),
1605
1604
  /* @__PURE__ */ l("div", { className: "min-w-0 space-y-0.5", children: [
1606
1605
  /* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: n.label }),
1607
1606
  /* @__PURE__ */ l("div", { className: "text-[12px] text-muted-foreground", children: [
@@ -1626,14 +1625,14 @@ function Tt(e) {
1626
1625
  previewControlDefinitions: d,
1627
1626
  previewControlValues: c,
1628
1627
  onControlChange: i,
1629
- onLabelChange: r,
1630
- onDefaultValueChange: p,
1628
+ onLabelChange: s,
1629
+ onDefaultValueChange: m,
1631
1630
  onBack: f,
1632
- onNext: k,
1631
+ onNext: w,
1633
1632
  nextDisabled: y
1634
1633
  } = e;
1635
1634
  return /* @__PURE__ */ l("div", { className: "space-y-3", children: [
1636
- /* @__PURE__ */ t(an, { control: n, onChange: r }),
1635
+ /* @__PURE__ */ t(rn, { control: n, onChange: s }),
1637
1636
  /* @__PURE__ */ t(
1638
1637
  Mt,
1639
1638
  {
@@ -1651,7 +1650,7 @@ function Tt(e) {
1651
1650
  {
1652
1651
  control: n,
1653
1652
  value: a,
1654
- onChange: p,
1653
+ onChange: m,
1655
1654
  allowNoDefault: !0,
1656
1655
  allowCardDefault: !0,
1657
1656
  hint: "This is the value viewers will see first.",
@@ -1662,13 +1661,13 @@ function Tt(e) {
1662
1661
  /* @__PURE__ */ t(
1663
1662
  je,
1664
1663
  {
1665
- secondary: /* @__PURE__ */ t(j, { type: "button", variant: "outline", size: "xs", onClick: f, children: "Back" }),
1664
+ secondary: /* @__PURE__ */ t(G, { type: "button", variant: "outline", size: "xs", onClick: f, children: "Back" }),
1666
1665
  primary: /* @__PURE__ */ t(
1667
- j,
1666
+ G,
1668
1667
  {
1669
1668
  type: "button",
1670
1669
  size: "xs",
1671
- onClick: k,
1670
+ onClick: w,
1672
1671
  disabled: y,
1673
1672
  children: "Next"
1674
1673
  }
@@ -1677,7 +1676,7 @@ function Tt(e) {
1677
1676
  )
1678
1677
  ] });
1679
1678
  }
1680
- const ja = /* @__PURE__ */ new Set([
1679
+ const Ua = /* @__PURE__ */ new Set([
1681
1680
  "grain_selector",
1682
1681
  "aggregation_selector",
1683
1682
  "field_selector",
@@ -1714,12 +1713,12 @@ function At(e) {
1714
1713
  sqlDescription: d,
1715
1714
  summaryDetail: c,
1716
1715
  onBack: i,
1717
- onCancel: r,
1718
- onDone: p
1719
- } = e, f = ja.has(n.type), k = o.match(/\[\[param\.(.+?)\]\]/), y = k ? `{{ param('${k[1]}') }}` : "";
1716
+ onCancel: s,
1717
+ onDone: m
1718
+ } = e, f = Ua.has(n.type), w = o.match(/\[\[param\.(.+?)\]\]/), y = w ? `{{ param('${w[1]}') }}` : "";
1720
1719
  return /* @__PURE__ */ l("div", { className: "space-y-4", children: [
1721
1720
  /* @__PURE__ */ t(
1722
- qa,
1721
+ ja,
1723
1722
  {
1724
1723
  control: n,
1725
1724
  scope: a,
@@ -1770,14 +1769,14 @@ function At(e) {
1770
1769
  /* @__PURE__ */ t(
1771
1770
  je,
1772
1771
  {
1773
- secondary: /* @__PURE__ */ t(j, { type: "button", variant: "outline", size: "xs", onClick: i, children: "Back" }),
1774
- tertiary: /* @__PURE__ */ t(j, { type: "button", variant: "outline", size: "xs", onClick: r, children: "Cancel" }),
1775
- primary: /* @__PURE__ */ t(j, { type: "button", size: "xs", onClick: p, children: "Done" })
1772
+ secondary: /* @__PURE__ */ t(G, { type: "button", variant: "outline", size: "xs", onClick: i, children: "Back" }),
1773
+ tertiary: /* @__PURE__ */ t(G, { type: "button", variant: "outline", size: "xs", onClick: s, children: "Cancel" }),
1774
+ primary: /* @__PURE__ */ t(G, { type: "button", size: "xs", onClick: m, children: "Done" })
1776
1775
  }
1777
1776
  )
1778
1777
  ] });
1779
1778
  }
1780
- function Ua(e) {
1779
+ function Ga(e) {
1781
1780
  const n = $e(
1782
1781
  e.scope,
1783
1782
  e.existingControls,
@@ -1813,393 +1812,393 @@ function Sr({
1813
1812
  emptyMessage: d,
1814
1813
  initialCreateFlow: c = !1,
1815
1814
  usageByControlId: i,
1816
- availableFieldChoices: r,
1817
- availableMetricChoices: p,
1815
+ availableFieldChoices: s,
1816
+ availableMetricChoices: m,
1818
1817
  structuralParticipants: f,
1819
- structuralParticipantIdsByControlId: k,
1818
+ structuralParticipantIdsByControlId: w,
1820
1819
  card: y,
1821
1820
  allowedControlTypes: h,
1822
1821
  onCreateFlowActiveChange: N,
1823
- onCreateFlowComplete: S
1822
+ onCreateFlowComplete: k
1824
1823
  }) {
1825
- const w = Q(
1824
+ const _ = Q(
1826
1825
  () => new Set(a || []),
1827
1826
  [a]
1828
- ), V = sa(e), U = Zn(e), [O, T] = H(
1827
+ ), D = sa(e), j = Zn(e), [O, T] = H(
1829
1828
  null
1830
1829
  ), [P, J] = H(
1831
1830
  null
1832
- ), [m, I] = H(
1831
+ ), [p, I] = H(
1833
1832
  () => c ? {
1834
1833
  step: 1,
1835
- control: $e(e, n, Array.from(w))
1834
+ control: $e(e, n, Array.from(_))
1836
1835
  } : null
1837
- ), A = Ae({}), D = Ae(void 0), b = Ae(c), x = Q(() => {
1838
- const s = Ct({ scope: e, card: y });
1836
+ ), A = Ae({}), S = Ae(void 0), v = Ae(c), x = Q(() => {
1837
+ const r = Ct({ scope: e, card: y });
1839
1838
  if (!h)
1840
- return s;
1839
+ return r;
1841
1840
  const g = new Set(h);
1842
- return s.filter((v) => g.has(v.value));
1843
- }, [h, y, e]), z = ne(
1844
- (s) => {
1841
+ return r.filter((b) => g.has(b.value));
1842
+ }, [h, y, e]), q = ne(
1843
+ (r) => {
1845
1844
  const g = Ct({
1846
1845
  scope: e,
1847
1846
  card: y,
1848
- includeType: h ? void 0 : s
1847
+ includeType: h ? void 0 : r
1849
1848
  });
1850
1849
  if (!h)
1851
1850
  return g;
1852
- const v = new Set(h);
1853
- return g.filter((L) => v.has(L.value));
1851
+ const b = new Set(h);
1852
+ return g.filter((L) => b.has(L.value));
1854
1853
  },
1855
1854
  [h, y, e]
1856
1855
  ), C = ne(
1857
- (s) => e === "dashboard" && (s === "field_selector" || s === "metric_selector"),
1856
+ (r) => e === "dashboard" && (r === "field_selector" || r === "metric_selector"),
1858
1857
  [e]
1859
- ), G = Q(
1860
- () => m ? wt(
1858
+ ), Z = Q(
1859
+ () => p ? wt(
1861
1860
  f || [],
1862
- m.control.type
1861
+ p.control.type
1863
1862
  ) : [],
1864
- [m, f]
1865
- ), _ = Q(() => {
1866
- if (!m)
1863
+ [p, f]
1864
+ ), V = Q(() => {
1865
+ if (!p)
1867
1866
  return {
1868
- fields: r || [],
1869
- metrics: p || []
1867
+ fields: s || [],
1868
+ metrics: m || []
1870
1869
  };
1871
- if (!C(m.control.type))
1870
+ if (!C(p.control.type))
1872
1871
  return {
1873
- fields: r || [],
1874
- metrics: p || []
1872
+ fields: s || [],
1873
+ metrics: m || []
1875
1874
  };
1876
- const s = m.selectedCardIds || [], g = Qe({
1877
- controlType: m.control.type,
1875
+ const r = p.selectedCardIds || [], g = Qe({
1876
+ controlType: p.control.type,
1878
1877
  participants: f || [],
1879
- selectedCardIds: s
1878
+ selectedCardIds: r
1880
1879
  });
1881
1880
  return {
1882
- fields: m.control.type === "field_selector" ? g.choices.map((v) => ({
1883
- option: v,
1884
- target: g.fieldTargetMap[v.value]
1881
+ fields: p.control.type === "field_selector" ? g.choices.map((b) => ({
1882
+ option: b,
1883
+ target: g.fieldTargetMap[b.value]
1885
1884
  })) : [],
1886
- metrics: m.control.type === "metric_selector" ? g.choices.map((v) => ({
1887
- option: v,
1888
- target: g.metricTargetMap[v.value]
1885
+ metrics: p.control.type === "metric_selector" ? g.choices.map((b) => ({
1886
+ option: b,
1887
+ target: g.metricTargetMap[b.value]
1889
1888
  })) : []
1890
1889
  };
1891
1890
  }, [
1892
- r,
1893
- p,
1891
+ s,
1894
1892
  m,
1893
+ p,
1895
1894
  C,
1896
1895
  f
1897
1896
  ]);
1898
1897
  de(() => {
1899
- N == null || N(!!m);
1900
- }, [m, N]), de(() => {
1901
- const s = c && !b.current;
1902
- b.current = c, s && (I({
1898
+ N == null || N(!!p);
1899
+ }, [p, N]), de(() => {
1900
+ const r = c && !v.current;
1901
+ v.current = c, r && (I({
1903
1902
  step: 1,
1904
- control: $e(e, n, Array.from(w))
1903
+ control: $e(e, n, Array.from(_))
1905
1904
  }), J(null), T(null));
1906
- }, [n, c, w, e]);
1907
- const K = (s) => {
1908
- if (!C(s.type))
1905
+ }, [n, c, _, e]);
1906
+ const M = (r) => {
1907
+ if (!C(r.type))
1909
1908
  return {
1910
- fields: r || [],
1911
- metrics: p || []
1909
+ fields: s || [],
1910
+ metrics: m || []
1912
1911
  };
1913
- const g = (k == null ? void 0 : k[s.id]) || [];
1912
+ const g = (w == null ? void 0 : w[r.id]) || [];
1914
1913
  if (g.length === 0)
1915
1914
  return {
1916
- fields: r || [],
1917
- metrics: p || []
1915
+ fields: s || [],
1916
+ metrics: m || []
1918
1917
  };
1919
- const v = Qe({
1920
- controlType: s.type,
1918
+ const b = Qe({
1919
+ controlType: r.type,
1921
1920
  participants: f || [],
1922
1921
  selectedCardIds: g
1923
1922
  });
1924
1923
  return {
1925
- fields: s.type === "field_selector" ? v.choices.map((L) => ({
1924
+ fields: r.type === "field_selector" ? b.choices.map((L) => ({
1926
1925
  option: L,
1927
- target: v.fieldTargetMap[L.value]
1926
+ target: b.fieldTargetMap[L.value]
1928
1927
  })) : [],
1929
- metrics: s.type === "metric_selector" ? v.choices.map((L) => ({
1928
+ metrics: r.type === "metric_selector" ? b.choices.map((L) => ({
1930
1929
  option: L,
1931
- target: v.metricTargetMap[L.value]
1930
+ target: b.metricTargetMap[L.value]
1932
1931
  })) : []
1933
1932
  };
1934
- }, ee = (s) => {
1935
- if (!C(s.control.type))
1933
+ }, K = (r) => {
1934
+ if (!C(r.control.type))
1936
1935
  return {
1937
- nextControl: s.control,
1936
+ nextControl: r.control,
1938
1937
  cardBindingsById: void 0
1939
1938
  };
1940
- const g = (k == null ? void 0 : k[s.control.id]) || [], v = Qe({
1941
- controlType: s.control.type,
1939
+ const g = (w == null ? void 0 : w[r.control.id]) || [], b = Qe({
1940
+ controlType: r.control.type,
1942
1941
  participants: f || [],
1943
- selectedCardIds: s.nextSelectedCardIds
1942
+ selectedCardIds: r.nextSelectedCardIds
1944
1943
  }), L = ca({
1945
- control: s.control,
1946
- choices: v.choices
1944
+ control: r.control,
1945
+ choices: b.choices
1947
1946
  }), R = Object.fromEntries(
1948
- g.filter((E) => !s.nextSelectedCardIds.includes(E)).map((E) => [E, void 0])
1947
+ g.filter((E) => !r.nextSelectedCardIds.includes(E)).map((E) => [E, void 0])
1949
1948
  );
1950
- return s.nextSelectedCardIds.length > 0 && L.source.kind === "manual" && L.source.options.length > 0 && Object.assign(
1949
+ return r.nextSelectedCardIds.length > 0 && L.source.kind === "manual" && L.source.options.length > 0 && Object.assign(
1951
1950
  R,
1952
1951
  It({
1953
1952
  control: L,
1954
1953
  participants: f || [],
1955
- selectedCardIds: s.nextSelectedCardIds,
1956
- matrixTargetIds: s.matrixTargetIds
1954
+ selectedCardIds: r.nextSelectedCardIds,
1955
+ matrixTargetIds: r.matrixTargetIds
1957
1956
  })
1958
1957
  ), {
1959
1958
  nextControl: L,
1960
1959
  cardBindingsById: R
1961
1960
  };
1962
- }, q = ne(
1963
- (s, g = o, v = { type: "update" }) => {
1964
- const L = s.map((R) => (He({
1961
+ }, U = ne(
1962
+ (r, g = o, b = { type: "update" }) => {
1963
+ const L = r.map((R) => (He({
1965
1964
  control: R,
1966
1965
  defaultValues: g
1967
1966
  }), ea(
1968
1967
  R
1969
1968
  )));
1970
- u(L, g, v);
1969
+ u(L, g, b);
1971
1970
  },
1972
1971
  [o, u]
1973
- ), Z = (s, g) => {
1974
- const v = n.find(
1975
- (W) => W.id === s
1972
+ ), ee = (r, g) => {
1973
+ const b = n.find(
1974
+ (W) => W.id === r
1976
1975
  );
1977
- let L = n.map((W) => W.id !== s ? W : g(W));
1976
+ let L = n.map((W) => W.id !== r ? W : g(W));
1978
1977
  const R = L.find(
1979
- (W) => W.id === s
1978
+ (W) => W.id === r
1980
1979
  );
1981
1980
  let E, F;
1982
- if (R && (!v || la({ control: v }, { control: R })) && e === "dashboard" && (R.type === "field_selector" || R.type === "metric_selector")) {
1983
- const W = (k == null ? void 0 : k[R.id]) || [], pe = ee({
1981
+ if (R && (!b || la({ control: b }, { control: R })) && e === "dashboard" && (R.type === "field_selector" || R.type === "metric_selector")) {
1982
+ const W = (w == null ? void 0 : w[R.id]) || [], pe = K({
1984
1983
  control: R,
1985
1984
  nextSelectedCardIds: W
1986
1985
  });
1987
1986
  L = L.map(
1988
- (ie) => ie.id === s ? pe.nextControl : ie
1987
+ (ie) => ie.id === r ? pe.nextControl : ie
1989
1988
  ), E = pe.cardBindingsById, F = [R.id];
1990
- } else if (v && (!R || !da(R.type)) && e === "dashboard" && (v.type === "field_selector" || v.type === "metric_selector")) {
1991
- const W = (k == null ? void 0 : k[v.id]) || [];
1989
+ } else if (b && (!R || !da(R.type)) && e === "dashboard" && (b.type === "field_selector" || b.type === "metric_selector")) {
1990
+ const W = (w == null ? void 0 : w[b.id]) || [];
1992
1991
  E = Object.fromEntries(
1993
1992
  W.map((pe) => [pe, void 0])
1994
- ), F = [v.id];
1993
+ ), F = [b.id];
1995
1994
  }
1996
1995
  const B = L.find(
1997
- (W) => W.id === s
1996
+ (W) => W.id === r
1998
1997
  );
1999
1998
  let Y = o;
2000
- if (v && B) {
1999
+ if (b && B) {
2001
2000
  const W = He({
2002
- control: v,
2001
+ control: b,
2003
2002
  defaultValues: o
2004
2003
  });
2005
- v.source.kind === "manual" && B.source.kind === "sql_query" && (A.current[s] = W);
2006
- const pe = W === void 0 && v.source.kind === "sql_query" && B.source.kind === "manual" ? A.current[s] : W, ie = Dt({
2007
- previousControl: v,
2004
+ b.source.kind === "manual" && B.source.kind === "sql_query" && (A.current[r] = W);
2005
+ const pe = W === void 0 && b.source.kind === "sql_query" && B.source.kind === "manual" ? A.current[r] : W, ie = Dt({
2006
+ previousControl: b,
2008
2007
  nextControl: B,
2009
2008
  currentDefaultValue: pe
2010
2009
  });
2011
- B.source.kind === "manual" && (A.current[s] = ie), o && (Y = { ...o }, ie === void 0 ? delete Y[s] : Y[s] = ie), L = L.map(
2012
- (bt) => bt.id === s ? { ...B, defaultValue: ie } : bt
2010
+ B.source.kind === "manual" && (A.current[r] = ie), o && (Y = { ...o }, ie === void 0 ? delete Y[r] : Y[r] = ie), L = L.map(
2011
+ (bt) => bt.id === r ? { ...B, defaultValue: ie } : bt
2013
2012
  );
2014
2013
  }
2015
- q(L, Y, {
2014
+ U(L, Y, {
2016
2015
  type: "update",
2017
2016
  cardBindingsById: E,
2018
2017
  affectedBindingControlIds: F
2019
2018
  });
2020
- }, te = (s, g) => {
2019
+ }, te = (r, g) => {
2021
2020
  if (!g.trim())
2022
2021
  return;
2023
- const v = ua(g);
2024
- if (v === s || w.has(v) || n.some(
2025
- (E) => E.id === v && E.id !== s
2022
+ const b = ua(g);
2023
+ if (b === r || _.has(b) || n.some(
2024
+ (E) => E.id === b && E.id !== r
2026
2025
  ))
2027
2026
  return;
2028
2027
  const L = n.map(
2029
- (E) => E.id === s ? { ...E, id: v } : E
2028
+ (E) => E.id === r ? { ...E, id: b } : E
2030
2029
  );
2031
2030
  if (!o) {
2032
- q(L, void 0, {
2031
+ U(L, void 0, {
2033
2032
  type: "rename",
2034
- oldId: s,
2035
- newId: v
2033
+ oldId: r,
2034
+ newId: b
2036
2035
  });
2037
2036
  return;
2038
2037
  }
2039
2038
  const R = { ...o };
2040
- Object.prototype.hasOwnProperty.call(R, s) && (R[v] = R[s], delete R[s]), q(L, R, {
2039
+ Object.prototype.hasOwnProperty.call(R, r) && (R[b] = R[r], delete R[r]), U(L, R, {
2041
2040
  type: "rename",
2042
- oldId: s,
2043
- newId: v
2041
+ oldId: r,
2042
+ newId: b
2044
2043
  });
2045
- }, We = (s) => {
2046
- const g = n.filter((L) => L.id !== s);
2044
+ }, We = (r) => {
2045
+ const g = n.filter((L) => L.id !== r);
2047
2046
  if (!o) {
2048
- q(g, void 0, { type: "remove", controlId: s });
2047
+ U(g, void 0, { type: "remove", controlId: r });
2049
2048
  return;
2050
2049
  }
2051
- const v = { ...o };
2052
- delete v[s], q(g, v, { type: "remove", controlId: s });
2050
+ const b = { ...o };
2051
+ delete b[r], U(g, b, { type: "remove", controlId: r });
2053
2052
  }, Ke = ne(() => {
2054
- D.current = void 0, I({
2053
+ S.current = void 0, I({
2055
2054
  step: 1,
2056
- control: $e(e, n, Array.from(w))
2055
+ control: $e(e, n, Array.from(_))
2057
2056
  }), J(null), T(null);
2058
- }, [n, w, e]), oe = (s) => {
2057
+ }, [n, _, e]), oe = (r) => {
2059
2058
  I(
2060
2059
  (g) => g && (() => {
2061
- const v = s(g.control);
2062
- g.control.source.kind === "manual" && v.source.kind === "sql_query" && (D.current = g.defaultValue);
2063
- const L = g.defaultValue === void 0 && g.control.source.kind === "sql_query" && v.source.kind === "manual" ? D.current : g.defaultValue, R = Dt({
2060
+ const b = r(g.control);
2061
+ g.control.source.kind === "manual" && b.source.kind === "sql_query" && (S.current = g.defaultValue);
2062
+ const L = g.defaultValue === void 0 && g.control.source.kind === "sql_query" && b.source.kind === "manual" ? S.current : g.defaultValue, R = Dt({
2064
2063
  previousControl: g.control,
2065
- nextControl: v,
2064
+ nextControl: b,
2066
2065
  currentDefaultValue: L
2067
2066
  });
2068
- return v.source.kind === "manual" && (D.current = R), {
2067
+ return b.source.kind === "manual" && (S.current = R), {
2069
2068
  ...g,
2070
- control: v,
2069
+ control: b,
2071
2070
  defaultValue: R
2072
2071
  };
2073
2072
  })()
2074
2073
  );
2075
- }, Te = (s) => {
2074
+ }, Te = (r) => {
2076
2075
  I(
2077
- (g) => g && (g.control.source.kind === "manual" && (D.current = s), {
2076
+ (g) => g && (g.control.source.kind === "manual" && (S.current = r), {
2078
2077
  ...g,
2079
- defaultValue: s
2078
+ defaultValue: r
2080
2079
  })
2081
2080
  );
2082
2081
  }, ue = (() => {
2083
- if (!m)
2082
+ if (!p)
2084
2083
  return !1;
2085
- if (m.step === 2 && C(m.control.type))
2086
- return (m.selectedCardIds || []).length > 0 && ta({
2084
+ if (p.step === 2 && C(p.control.type))
2085
+ return (p.selectedCardIds || []).length > 0 && ta({
2087
2086
  participants: f || [],
2088
- selectedCardIds: m.selectedCardIds || [],
2089
- control: m.control,
2090
- selected: m.matrixTargetIds
2087
+ selectedCardIds: p.selectedCardIds || [],
2088
+ control: p.control,
2089
+ selected: p.matrixTargetIds
2091
2090
  });
2092
- if (m.step !== 2 && m.step !== 3 || !m.control.label.trim())
2091
+ if (p.step !== 2 && p.step !== 3 || !p.control.label.trim())
2093
2092
  return !1;
2094
- const g = m.control.source.kind === "sql_query" ? m.control : kt(m.control);
2093
+ const g = p.control.source.kind === "sql_query" ? p.control : kt(p.control);
2095
2094
  if (g.source.kind === "manual" && (na(g) && g.source.options.length === 0 || g.source.options.some(
2096
2095
  (L) => L.label.trim().length === 0 || L.value.trim().length === 0
2097
2096
  )))
2098
2097
  return !1;
2099
2098
  if (g.source.kind === "sql_query") {
2100
- const { connectionId: v, sql: L, valueColumn: R } = g.source;
2101
- return v.trim().length > 0 && L.trim().length > 0 && R.trim().length > 0;
2099
+ const { connectionId: b, sql: L, valueColumn: R } = g.source;
2100
+ return b.trim().length > 0 && L.trim().length > 0 && R.trim().length > 0;
2102
2101
  }
2103
2102
  return aa(
2104
- Fe(g, m.defaultValue)
2103
+ Fe(g, p.defaultValue)
2105
2104
  );
2106
2105
  })(), Ce = () => {
2107
2106
  var E;
2108
- if (!m)
2107
+ if (!p)
2109
2108
  return;
2110
- const s = kt(m.control), g = ia({
2111
- label: s.label,
2112
- fallbackId: s.id,
2109
+ const r = kt(p.control), g = ia({
2110
+ label: r.label,
2111
+ fallbackId: r.id,
2113
2112
  existingControls: n,
2114
- reservedIds: Array.from(w)
2115
- }), v = {
2116
- ...s,
2113
+ reservedIds: Array.from(_)
2114
+ }), b = {
2115
+ ...r,
2117
2116
  id: g
2118
- }, L = e === "dashboard" && (v.type === "field_selector" || v.type === "metric_selector") && ((E = m.selectedCardIds) != null && E.length) ? It({
2119
- control: v,
2117
+ }, L = e === "dashboard" && (b.type === "field_selector" || b.type === "metric_selector") && ((E = p.selectedCardIds) != null && E.length) ? It({
2118
+ control: b,
2120
2119
  participants: f || [],
2121
- selectedCardIds: m.selectedCardIds,
2122
- matrixTargetIds: m.matrixTargetIds
2120
+ selectedCardIds: p.selectedCardIds,
2121
+ matrixTargetIds: p.matrixTargetIds
2123
2122
  }) : void 0, R = Fe(
2124
- v,
2125
- m.defaultValue
2123
+ b,
2124
+ p.defaultValue
2126
2125
  );
2127
2126
  I({
2128
- step: e === "dashboard" && (v.type === "field_selector" || v.type === "metric_selector") ? 4 : 3,
2129
- control: v,
2127
+ step: e === "dashboard" && (b.type === "field_selector" || b.type === "metric_selector") ? 4 : 3,
2128
+ control: b,
2130
2129
  defaultValue: R,
2131
2130
  createdControlId: g,
2132
- selectedCardIds: m.selectedCardIds,
2133
- matrixTargetIds: m.matrixTargetIds,
2131
+ selectedCardIds: p.selectedCardIds,
2132
+ matrixTargetIds: p.matrixTargetIds,
2134
2133
  cardBindingsById: L
2135
2134
  });
2136
2135
  }, we = ne(() => {
2137
2136
  I(null);
2138
2137
  }, []), ke = ne(() => {
2139
- if (!(m != null && m.createdControlId)) {
2138
+ if (!(p != null && p.createdControlId)) {
2140
2139
  I(null);
2141
2140
  return;
2142
2141
  }
2143
- const s = m.control, g = m.createdControlId, v = Fe(
2144
- s,
2145
- m.defaultValue
2142
+ const r = p.control, g = p.createdControlId, b = Fe(
2143
+ r,
2144
+ p.defaultValue
2146
2145
  );
2147
2146
  if (o) {
2148
2147
  const L = { ...o };
2149
- v === void 0 ? delete L[g] : L[g] = v, q(
2148
+ b === void 0 ? delete L[g] : L[g] = b, U(
2150
2149
  [
2151
2150
  ...n,
2152
2151
  {
2153
- ...s,
2154
- defaultValue: v
2152
+ ...r,
2153
+ defaultValue: b
2155
2154
  }
2156
2155
  ],
2157
2156
  L,
2158
2157
  {
2159
2158
  type: "add",
2160
- cardBindingsById: m.cardBindingsById
2159
+ cardBindingsById: p.cardBindingsById
2161
2160
  }
2162
2161
  );
2163
2162
  } else
2164
- q(
2163
+ U(
2165
2164
  [
2166
2165
  ...n,
2167
2166
  {
2168
- ...s,
2169
- defaultValue: v
2167
+ ...r,
2168
+ defaultValue: b
2170
2169
  }
2171
2170
  ],
2172
2171
  void 0,
2173
2172
  {
2174
2173
  type: "add",
2175
- cardBindingsById: m.cardBindingsById
2174
+ cardBindingsById: p.cardBindingsById
2176
2175
  }
2177
2176
  );
2178
- J(g), I(null), S == null || S();
2179
- }, [n, m, o, q, S]), gt = m ? C(m.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], Se = m != null && m.createdControlId ? `[[param.${m.createdControlId}]]` : m ? `[[param.${ra(m.control.label) || m.control.id}]]` : "", me = St({
2177
+ J(g), I(null), k == null || k();
2178
+ }, [n, p, o, U, k]), gt = p ? C(p.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], Se = p != null && p.createdControlId ? `[[param.${p.createdControlId}]]` : p ? `[[param.${ra(p.control.label) || p.control.id}]]` : "", me = St({
2180
2179
  controls: n,
2181
2180
  defaultValues: o
2182
- }), $ = m ? [...n, m.control] : n, ae = m ? St({
2181
+ }), $ = p ? [...n, p.control] : n, ae = p ? St({
2183
2182
  controls: $,
2184
2183
  defaultValues: o,
2185
2184
  overrides: [
2186
2185
  {
2187
- controlId: m.control.id,
2188
- value: m.defaultValue
2186
+ controlId: p.control.id,
2187
+ value: p.defaultValue
2189
2188
  }
2190
2189
  ]
2191
2190
  }) : me;
2192
2191
  return /* @__PURE__ */ l("div", { className: "space-y-4", children: [
2193
- m ? /* @__PURE__ */ l("div", { className: "space-y-4 pb-1", children: [
2192
+ p ? /* @__PURE__ */ l("div", { className: "space-y-4 pb-1", children: [
2194
2193
  /* @__PURE__ */ t(
2195
- za,
2194
+ qa,
2196
2195
  {
2197
- currentStep: m.step,
2196
+ currentStep: p.step,
2198
2197
  labels: gt
2199
2198
  }
2200
2199
  ),
2201
- m.step === 1 && (() => {
2202
- const s = /* @__PURE__ */ new Set([
2200
+ p.step === 1 && (() => {
2201
+ const r = /* @__PURE__ */ new Set([
2203
2202
  "grain_selector",
2204
2203
  "aggregation_selector",
2205
2204
  "field_selector",
@@ -2209,20 +2208,20 @@ function Sr({
2209
2208
  // keeping the shared definitions for existing controls.
2210
2209
  "date",
2211
2210
  "text"
2212
- ]), v = x.filter(
2213
- (E) => !s.has(E.value) && !g.has(E.value)
2211
+ ]), b = x.filter(
2212
+ (E) => !r.has(E.value) && !g.has(E.value)
2214
2213
  ), L = x.filter(
2215
- (E) => s.has(E.value)
2214
+ (E) => r.has(E.value)
2216
2215
  ), R = (E) => /* @__PURE__ */ l(
2217
2216
  "button",
2218
2217
  {
2219
2218
  type: "button",
2220
2219
  className: "rounded-control border border-border/60 bg-background px-3 py-2.5 text-left transition-colors hover:bg-muted/40 focus-visible:bg-muted/40 focus-visible:outline-none",
2221
2220
  onClick: () => I(
2222
- Ua({
2221
+ Ga({
2223
2222
  scope: e,
2224
2223
  existingControls: n,
2225
- reservedIds: Array.from(w),
2224
+ reservedIds: Array.from(_),
2226
2225
  type: E.value
2227
2226
  })
2228
2227
  ),
@@ -2235,9 +2234,9 @@ function Sr({
2235
2234
  );
2236
2235
  return /* @__PURE__ */ l("div", { className: "space-y-4", children: [
2237
2236
  e === "card" && (y == null ? void 0 : y.sql) == null ? /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Explorer cards support displayed metric, group by field, aggregation, and time grain controls here." }) : null,
2238
- v.length > 0 && /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
2237
+ b.length > 0 && /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
2239
2238
  /* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Input controls" }),
2240
- /* @__PURE__ */ t("div", { className: "grid gap-1.5 sm:grid-cols-2", children: v.map(R) })
2239
+ /* @__PURE__ */ t("div", { className: "grid gap-1.5 sm:grid-cols-2", children: b.map(R) })
2241
2240
  ] }),
2242
2241
  L.length > 0 && /* @__PURE__ */ l("div", { className: "space-y-1.5", children: [
2243
2242
  /* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Data-driven controls" }),
@@ -2247,7 +2246,7 @@ function Sr({
2247
2246
  je,
2248
2247
  {
2249
2248
  secondary: /* @__PURE__ */ t(
2250
- j,
2249
+ G,
2251
2250
  {
2252
2251
  type: "button",
2253
2252
  variant: "outline",
@@ -2260,22 +2259,22 @@ function Sr({
2260
2259
  )
2261
2260
  ] });
2262
2261
  })(),
2263
- m.step === 2 && C(m.control.type) && /* @__PURE__ */ l("div", { className: "space-y-3", children: [
2262
+ p.step === 2 && C(p.control.type) && /* @__PURE__ */ l("div", { className: "space-y-3", children: [
2264
2263
  /* @__PURE__ */ l("div", { className: "space-y-3", children: [
2265
2264
  /* @__PURE__ */ t(
2266
- an,
2265
+ rn,
2267
2266
  {
2268
- control: m.control,
2269
- onChange: (s) => oe((g) => ({
2267
+ control: p.control,
2268
+ onChange: (r) => oe((g) => ({
2270
2269
  ...g,
2271
- label: s
2270
+ label: r
2272
2271
  }))
2273
2272
  }
2274
2273
  ),
2275
2274
  /* @__PURE__ */ t("p", { className: "text-[12px] text-muted-foreground", children: "Choose which cards should respond to this shared control." })
2276
2275
  ] }),
2277
- G.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-control border border-border/60 bg-muted/30 px-3 py-2.5 text-[12px] text-muted-foreground", children: "No eligible cards are available yet. Add compatible metrics or group-by fields to cards first." }) : /* @__PURE__ */ t("div", { className: "space-y-1 rounded-control border border-border/60 bg-background p-2", children: G.map((s) => {
2278
- const g = (m.selectedCardIds || []).includes(s.cardId);
2276
+ Z.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-control border border-border/60 bg-muted/30 px-3 py-2.5 text-[12px] text-muted-foreground", children: "No eligible cards are available yet. Add compatible metrics or group-by fields to cards first." }) : /* @__PURE__ */ t("div", { className: "space-y-1 rounded-control border border-border/60 bg-background p-2", children: Z.map((r) => {
2277
+ const g = (p.selectedCardIds || []).includes(r.cardId);
2279
2278
  return /* @__PURE__ */ l(
2280
2279
  "label",
2281
2280
  {
@@ -2285,50 +2284,50 @@ function Sr({
2285
2284
  Ge,
2286
2285
  {
2287
2286
  checked: g,
2288
- onCheckedChange: (v) => I(
2287
+ onCheckedChange: (b) => I(
2289
2288
  (L) => L && {
2290
2289
  ...L,
2291
- selectedCardIds: v === !0 ? [
2290
+ selectedCardIds: b === !0 ? [
2292
2291
  ...L.selectedCardIds || [],
2293
- s.cardId
2292
+ r.cardId
2294
2293
  ] : (L.selectedCardIds || []).filter(
2295
- (R) => R !== s.cardId
2294
+ (R) => R !== r.cardId
2296
2295
  )
2297
2296
  }
2298
2297
  )
2299
2298
  }
2300
2299
  ),
2301
2300
  /* @__PURE__ */ l("div", { className: "min-w-0", children: [
2302
- /* @__PURE__ */ t("div", { className: "font-medium text-foreground", children: s.title }),
2303
- /* @__PURE__ */ t("div", { className: "text-[12px] text-muted-foreground", children: m.control.type === "field_selector" ? `${s.fieldChoices.length} compatible group-by fields` : `${s.metricChoices.length} compatible metrics` })
2301
+ /* @__PURE__ */ t("div", { className: "font-medium text-foreground", children: r.title }),
2302
+ /* @__PURE__ */ t("div", { className: "text-[12px] text-muted-foreground", children: p.control.type === "field_selector" ? `${r.fieldChoices.length} compatible group-by fields` : `${r.metricChoices.length} compatible metrics` })
2304
2303
  ] })
2305
2304
  ]
2306
2305
  },
2307
- s.cardId
2306
+ r.cardId
2308
2307
  );
2309
2308
  }) }),
2310
2309
  /* @__PURE__ */ t(
2311
2310
  yt,
2312
2311
  {
2313
- participants: G,
2314
- selectedCardIds: m.selectedCardIds || [],
2315
- control: m.control,
2316
- selected: m.matrixTargetIds,
2317
- onChange: (s, g) => I((v) => v && { ...v, matrixTargetIds: { ...v.matrixTargetIds, [s]: g } })
2312
+ participants: Z,
2313
+ selectedCardIds: p.selectedCardIds || [],
2314
+ control: p.control,
2315
+ selected: p.matrixTargetIds,
2316
+ onChange: (r, g) => I((b) => b && { ...b, matrixTargetIds: { ...b.matrixTargetIds, [r]: g } })
2318
2317
  }
2319
2318
  ),
2320
2319
  /* @__PURE__ */ t(
2321
2320
  je,
2322
2321
  {
2323
2322
  secondary: /* @__PURE__ */ t(
2324
- j,
2323
+ G,
2325
2324
  {
2326
2325
  type: "button",
2327
2326
  variant: "outline",
2328
2327
  size: "xs",
2329
2328
  onClick: () => I(
2330
- (s) => s && {
2331
- ...s,
2329
+ (r) => r && {
2330
+ ...r,
2332
2331
  step: 1,
2333
2332
  selectedCardIds: []
2334
2333
  }
@@ -2337,13 +2336,13 @@ function Sr({
2337
2336
  }
2338
2337
  ),
2339
2338
  primary: /* @__PURE__ */ t(
2340
- j,
2339
+ G,
2341
2340
  {
2342
2341
  type: "button",
2343
2342
  size: "xs",
2344
2343
  onClick: () => I(
2345
- (s) => s && {
2346
- ...s,
2344
+ (r) => r && {
2345
+ ...r,
2347
2346
  step: 3
2348
2347
  }
2349
2348
  ),
@@ -2354,24 +2353,24 @@ function Sr({
2354
2353
  }
2355
2354
  )
2356
2355
  ] }),
2357
- m.step === 2 && !C(m.control.type) && /* @__PURE__ */ t(
2356
+ p.step === 2 && !C(p.control.type) && /* @__PURE__ */ t(
2358
2357
  Tt,
2359
2358
  {
2360
- control: m.control,
2361
- defaultValue: m.defaultValue,
2362
- availableFieldChoices: _.fields,
2363
- availableMetricChoices: _.metrics,
2359
+ control: p.control,
2360
+ defaultValue: p.defaultValue,
2361
+ availableFieldChoices: V.fields,
2362
+ availableMetricChoices: V.metrics,
2364
2363
  previewControlDefinitions: $,
2365
2364
  previewControlValues: ae,
2366
- onControlChange: (s) => oe(() => s),
2367
- onLabelChange: (s) => oe((g) => ({
2365
+ onControlChange: (r) => oe(() => r),
2366
+ onLabelChange: (r) => oe((g) => ({
2368
2367
  ...g,
2369
- label: s
2368
+ label: r
2370
2369
  })),
2371
2370
  onDefaultValueChange: Te,
2372
2371
  onBack: () => I(
2373
- (s) => s && {
2374
- ...s,
2372
+ (r) => r && {
2373
+ ...r,
2375
2374
  step: 1
2376
2375
  }
2377
2376
  ),
@@ -2379,24 +2378,24 @@ function Sr({
2379
2378
  nextDisabled: !ue
2380
2379
  }
2381
2380
  ),
2382
- m.step === 3 && C(m.control.type) && /* @__PURE__ */ t(
2381
+ p.step === 3 && C(p.control.type) && /* @__PURE__ */ t(
2383
2382
  Tt,
2384
2383
  {
2385
- control: m.control,
2386
- defaultValue: m.defaultValue,
2387
- availableFieldChoices: _.fields,
2388
- availableMetricChoices: _.metrics,
2384
+ control: p.control,
2385
+ defaultValue: p.defaultValue,
2386
+ availableFieldChoices: V.fields,
2387
+ availableMetricChoices: V.metrics,
2389
2388
  previewControlDefinitions: $,
2390
2389
  previewControlValues: ae,
2391
- onControlChange: (s) => oe(() => s),
2392
- onLabelChange: (s) => oe((g) => ({
2390
+ onControlChange: (r) => oe(() => r),
2391
+ onLabelChange: (r) => oe((g) => ({
2393
2392
  ...g,
2394
- label: s
2393
+ label: r
2395
2394
  })),
2396
2395
  onDefaultValueChange: Te,
2397
2396
  onBack: () => I(
2398
- (s) => s && {
2399
- ...s,
2397
+ (r) => r && {
2398
+ ...r,
2400
2399
  step: 2
2401
2400
  }
2402
2401
  ),
@@ -2404,10 +2403,10 @@ function Sr({
2404
2403
  nextDisabled: !ue
2405
2404
  }
2406
2405
  ),
2407
- m.step === 3 && !C(m.control.type) && /* @__PURE__ */ t(
2406
+ p.step === 3 && !C(p.control.type) && /* @__PURE__ */ t(
2408
2407
  At,
2409
2408
  {
2410
- control: m.control,
2409
+ control: p.control,
2411
2410
  scope: e,
2412
2411
  createdReference: Se,
2413
2412
  explorerContent: /* @__PURE__ */ l(fe, { children: [
@@ -2419,8 +2418,8 @@ function Sr({
2419
2418
  ] }),
2420
2419
  sqlDescription: "Reference this control directly in the SQL editor.",
2421
2420
  onBack: () => I(
2422
- (s) => s && {
2423
- ...s,
2421
+ (r) => r && {
2422
+ ...r,
2424
2423
  step: 2
2425
2424
  }
2426
2425
  ),
@@ -2428,23 +2427,23 @@ function Sr({
2428
2427
  onDone: ke
2429
2428
  }
2430
2429
  ),
2431
- m.step === 4 && C(m.control.type) && /* @__PURE__ */ t(
2430
+ p.step === 4 && C(p.control.type) && /* @__PURE__ */ t(
2432
2431
  At,
2433
2432
  {
2434
- control: m.control,
2433
+ control: p.control,
2435
2434
  scope: e,
2436
2435
  createdReference: Se,
2437
2436
  summaryDetail: /* @__PURE__ */ l(fe, { children: [
2438
2437
  "Used by ",
2439
- (m.selectedCardIds || []).length,
2438
+ (p.selectedCardIds || []).length,
2440
2439
  " selected card",
2441
- (m.selectedCardIds || []).length === 1 ? "" : "s"
2440
+ (p.selectedCardIds || []).length === 1 ? "" : "s"
2442
2441
  ] }),
2443
2442
  explorerContent: /* @__PURE__ */ t(fe, { children: "Selected cards have been set up to respond to this control automatically." }),
2444
2443
  sqlDescription: "SQL cards can still reference this control directly in the SQL editor.",
2445
2444
  onBack: () => I(
2446
- (s) => s && {
2447
- ...s,
2445
+ (r) => r && {
2446
+ ...r,
2448
2447
  step: 3
2449
2448
  }
2450
2449
  ),
@@ -2453,12 +2452,12 @@ function Sr({
2453
2452
  }
2454
2453
  )
2455
2454
  ] }) : null,
2456
- !m && n.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-md border border-dashed p-3 text-sm text-muted-foreground", children: d }) : null,
2457
- !m && n.map((s) => {
2458
- const g = K(s), v = i == null ? void 0 : i[s.id], L = He({
2459
- control: s,
2455
+ !p && n.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-md border border-dashed p-3 text-sm text-muted-foreground", children: d }) : null,
2456
+ !p && n.map((r) => {
2457
+ const g = M(r), b = i == null ? void 0 : i[r.id], L = He({
2458
+ control: r,
2460
2459
  defaultValues: o
2461
- }), R = P === s.id, E = "inline-flex shrink-0 items-center rounded-[4px] border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground";
2460
+ }), R = P === r.id, E = "inline-flex shrink-0 items-center rounded-[4px] border border-border/60 bg-muted/40 px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground";
2462
2461
  return /* @__PURE__ */ l(
2463
2462
  "div",
2464
2463
  {
@@ -2471,33 +2470,33 @@ function Sr({
2471
2470
  type: "button",
2472
2471
  className: "flex min-w-0 flex-1 items-start gap-2 rounded-control text-left focus:outline-none focus-visible:bg-muted/40",
2473
2472
  onClick: () => J(
2474
- (F) => F === s.id ? null : s.id
2473
+ (F) => F === r.id ? null : r.id
2475
2474
  ),
2476
2475
  children: [
2477
2476
  R ? /* @__PURE__ */ t(Oe, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ t(Ie, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
2478
2477
  /* @__PURE__ */ l("div", { className: "min-w-0", children: [
2479
2478
  /* @__PURE__ */ l("div", { className: "flex flex-wrap items-center gap-1.5", children: [
2480
- /* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: s.label || "Untitled control" }),
2481
- /* @__PURE__ */ t("span", { className: E, children: Kt(s.type).label }),
2482
- /* @__PURE__ */ t("span", { className: E, children: Qt(e, s.placement) })
2479
+ /* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: r.label || "Untitled control" }),
2480
+ /* @__PURE__ */ t("span", { className: E, children: Kt(r.type).label }),
2481
+ /* @__PURE__ */ t("span", { className: E, children: Qt(e, r.placement) })
2483
2482
  ] }),
2484
2483
  /* @__PURE__ */ l("div", { className: "mt-0.5 text-[12px] text-muted-foreground", children: [
2485
- Ht(s),
2486
- v != null && v.status ? ` · ${v.status}` : ""
2484
+ Ht(r),
2485
+ b != null && b.status ? ` · ${b.status}` : ""
2487
2486
  ] })
2488
2487
  ] })
2489
2488
  ]
2490
2489
  }
2491
2490
  ),
2492
2491
  /* @__PURE__ */ t(
2493
- j,
2492
+ G,
2494
2493
  {
2495
2494
  type: "button",
2496
2495
  size: "xs",
2497
2496
  variant: "ghost",
2498
2497
  className: "h-7 w-7 shrink-0 p-0 text-muted-foreground",
2499
- onClick: () => We(s.id),
2500
- "aria-label": `Remove ${s.label}`,
2498
+ onClick: () => We(r.id),
2499
+ "aria-label": `Remove ${r.label}`,
2501
2500
  children: /* @__PURE__ */ t(Et, { className: "h-3.5 w-3.5" })
2502
2501
  }
2503
2502
  )
@@ -2510,9 +2509,9 @@ function Sr({
2510
2509
  Ne,
2511
2510
  {
2512
2511
  size: "xs",
2513
- value: s.label,
2512
+ value: r.label,
2514
2513
  placeholder: "Control label",
2515
- onChange: (F) => Z(s.id, (B) => ({
2514
+ onChange: (F) => ee(r.id, (B) => ({
2516
2515
  ...B,
2517
2516
  label: F.target.value
2518
2517
  }))
@@ -2524,19 +2523,19 @@ function Sr({
2524
2523
  /* @__PURE__ */ l(
2525
2524
  xe,
2526
2525
  {
2527
- value: s.type,
2526
+ value: r.type,
2528
2527
  onValueChange: (F) => {
2529
2528
  const B = Pt({
2530
2529
  controls: n,
2531
- controlId: s.id,
2530
+ controlId: r.id,
2532
2531
  nextType: F,
2533
2532
  defaultValues: o
2534
2533
  });
2535
- q(B.controls, B.defaultValues);
2534
+ U(B.controls, B.defaultValues);
2536
2535
  },
2537
2536
  children: [
2538
2537
  /* @__PURE__ */ t(ge, { size: "xs", children: /* @__PURE__ */ t(be, {}) }),
2539
- /* @__PURE__ */ t(ve, { children: z(s.type).map(
2538
+ /* @__PURE__ */ t(ve, { children: q(r.type).map(
2540
2539
  (F) => /* @__PURE__ */ t(
2541
2540
  re,
2542
2541
  {
@@ -2555,41 +2554,41 @@ function Sr({
2555
2554
  /* @__PURE__ */ l(
2556
2555
  xe,
2557
2556
  {
2558
- value: s.placement || U,
2559
- onValueChange: (F) => Z(s.id, (B) => ({
2557
+ value: r.placement || j,
2558
+ onValueChange: (F) => ee(r.id, (B) => ({
2560
2559
  ...B,
2561
2560
  placement: F
2562
2561
  })),
2563
2562
  children: [
2564
2563
  /* @__PURE__ */ t(ge, { size: "xs", children: /* @__PURE__ */ t(be, {}) }),
2565
- /* @__PURE__ */ t(ve, { children: V.map((F) => /* @__PURE__ */ t(re, { value: F.value, children: F.label }, F.value)) })
2564
+ /* @__PURE__ */ t(ve, { children: D.map((F) => /* @__PURE__ */ t(re, { value: F.value, children: F.label }, F.value)) })
2566
2565
  ]
2567
2566
  }
2568
2567
  )
2569
2568
  ] })
2570
2569
  ] }),
2571
- C(s.type) ? /* @__PURE__ */ l(fe, { children: [
2570
+ C(r.type) ? /* @__PURE__ */ l(fe, { children: [
2572
2571
  /* @__PURE__ */ t(
2573
- In,
2572
+ Tn,
2574
2573
  {
2575
- type: s.type,
2574
+ type: r.type,
2576
2575
  participants: wt(
2577
2576
  f || [],
2578
- s.type
2577
+ r.type
2579
2578
  ).map((F) => ({
2580
2579
  cardId: F.cardId,
2581
2580
  title: F.title,
2582
- choiceCount: s.type === "field_selector" ? F.fieldChoices.length : F.metricChoices.length
2581
+ choiceCount: r.type === "field_selector" ? F.fieldChoices.length : F.metricChoices.length
2583
2582
  })),
2584
- selectedCardIds: (k == null ? void 0 : k[s.id]) || [],
2583
+ selectedCardIds: (w == null ? void 0 : w[r.id]) || [],
2585
2584
  onChange: (F) => {
2586
- const B = ee({
2587
- control: s,
2585
+ const B = K({
2586
+ control: r,
2588
2587
  nextSelectedCardIds: F
2589
2588
  }), Y = n.map(
2590
- (W) => W.id === s.id ? B.nextControl : W
2589
+ (W) => W.id === r.id ? B.nextControl : W
2591
2590
  );
2592
- q(Y, o, {
2591
+ U(Y, o, {
2593
2592
  type: "update",
2594
2593
  cardBindingsById: B.cardBindingsById
2595
2594
  });
@@ -2600,16 +2599,16 @@ function Sr({
2600
2599
  yt,
2601
2600
  {
2602
2601
  participants: f || [],
2603
- selectedCardIds: (k == null ? void 0 : k[s.id]) || [],
2604
- control: s,
2602
+ selectedCardIds: (w == null ? void 0 : w[r.id]) || [],
2603
+ control: r,
2605
2604
  onChange: (F, B) => {
2606
- const Y = ee({
2607
- control: s,
2608
- nextSelectedCardIds: (k == null ? void 0 : k[s.id]) || [],
2605
+ const Y = K({
2606
+ control: r,
2607
+ nextSelectedCardIds: (w == null ? void 0 : w[r.id]) || [],
2609
2608
  matrixTargetIds: { [F]: B }
2610
2609
  });
2611
- q(
2612
- n.map((W) => W.id === s.id ? Y.nextControl : W),
2610
+ U(
2611
+ n.map((W) => W.id === r.id ? Y.nextControl : W),
2613
2612
  o,
2614
2613
  { type: "update", cardBindingsById: Y.cardBindingsById }
2615
2614
  );
@@ -2620,19 +2619,19 @@ function Sr({
2620
2619
  /* @__PURE__ */ t(
2621
2620
  Mt,
2622
2621
  {
2623
- control: s,
2622
+ control: r,
2624
2623
  availableFieldChoices: g.fields,
2625
2624
  availableMetricChoices: g.metrics,
2626
2625
  previewControlDefinitions: n,
2627
2626
  previewControlValues: me,
2628
2627
  controlLifecycle: "edit",
2629
- onChange: (F) => Z(s.id, () => F)
2628
+ onChange: (F) => ee(r.id, () => F)
2630
2629
  }
2631
2630
  ),
2632
- s.initialValueStrategy === "saved_default" && /* @__PURE__ */ t(
2631
+ r.initialValueStrategy === "saved_default" && /* @__PURE__ */ t(
2633
2632
  zt,
2634
2633
  {
2635
- control: s,
2634
+ control: r,
2636
2635
  value: L,
2637
2636
  allowNoDefault: !0,
2638
2637
  allowCardDefault: !0,
@@ -2640,47 +2639,47 @@ function Sr({
2640
2639
  previewControlValues: me,
2641
2640
  onChange: (F) => {
2642
2641
  const B = n.map(
2643
- (Y) => Y.id === s.id ? { ...Y, defaultValue: F } : Y
2642
+ (Y) => Y.id === r.id ? { ...Y, defaultValue: F } : Y
2644
2643
  );
2645
- if (s.source.kind === "manual" && (A.current[s.id] = F), o) {
2644
+ if (r.source.kind === "manual" && (A.current[r.id] = F), o) {
2646
2645
  const Y = { ...o };
2647
- F === void 0 ? delete Y[s.id] : Y[s.id] = F, q(B, Y);
2646
+ F === void 0 ? delete Y[r.id] : Y[r.id] = F, U(B, Y);
2648
2647
  return;
2649
2648
  }
2650
- q(B, void 0);
2649
+ U(B, void 0);
2651
2650
  }
2652
2651
  }
2653
2652
  ),
2654
2653
  /* @__PURE__ */ l(
2655
- Tn,
2654
+ Ln,
2656
2655
  {
2657
- open: O === s.id,
2658
- onOpenChange: (F) => T(F ? s.id : null),
2656
+ open: O === r.id,
2657
+ onOpenChange: (F) => T(F ? r.id : null),
2659
2658
  children: [
2660
- /* @__PURE__ */ t(Ln, { asChild: !0, children: /* @__PURE__ */ l(
2661
- j,
2659
+ /* @__PURE__ */ t(An, { asChild: !0, children: /* @__PURE__ */ l(
2660
+ G,
2662
2661
  {
2663
2662
  type: "button",
2664
2663
  variant: "ghost",
2665
2664
  size: "xs",
2666
2665
  className: "-ml-2 gap-1 text-muted-foreground hover:text-foreground",
2667
2666
  children: [
2668
- O === s.id ? /* @__PURE__ */ t(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Ie, { className: "h-3.5 w-3.5" }),
2667
+ O === r.id ? /* @__PURE__ */ t(Oe, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Ie, { className: "h-3.5 w-3.5" }),
2669
2668
  "Advanced"
2670
2669
  ]
2671
2670
  }
2672
2671
  ) }),
2673
- /* @__PURE__ */ l(An, { className: "space-y-3 pt-2", children: [
2672
+ /* @__PURE__ */ l($n, { className: "space-y-3 pt-2", children: [
2674
2673
  /* @__PURE__ */ l("div", { className: "grid gap-3 md:grid-cols-2", children: [
2675
2674
  /* @__PURE__ */ l("div", { className: "flex flex-col gap-1.5", children: [
2676
2675
  /* @__PURE__ */ t(le, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Variable name" }),
2677
2676
  /* @__PURE__ */ t(
2678
- $n,
2677
+ Fn,
2679
2678
  {
2680
- controlId: s.id,
2681
- onCommit: (F) => te(s.id, F)
2679
+ controlId: r.id,
2680
+ onCommit: (F) => te(r.id, F)
2682
2681
  },
2683
- s.id
2682
+ r.id
2684
2683
  )
2685
2684
  ] }),
2686
2685
  /* @__PURE__ */ l("div", { className: "flex flex-col gap-1.5", children: [
@@ -2688,8 +2687,8 @@ function Sr({
2688
2687
  /* @__PURE__ */ l(
2689
2688
  xe,
2690
2689
  {
2691
- value: s.initialValueStrategy,
2692
- onValueChange: (F) => Z(s.id, (B) => ({
2690
+ value: r.initialValueStrategy,
2691
+ onValueChange: (F) => ee(r.id, (B) => ({
2693
2692
  ...B,
2694
2693
  initialValueStrategy: F
2695
2694
  })),
@@ -2709,10 +2708,10 @@ function Sr({
2709
2708
  ] })
2710
2709
  ] }),
2711
2710
  /* @__PURE__ */ t(
2712
- Fn,
2711
+ On,
2713
2712
  {
2714
- control: s,
2715
- onChange: (F) => Z(s.id, () => F)
2713
+ control: r,
2714
+ onChange: (F) => ee(r.id, () => F)
2716
2715
  }
2717
2716
  )
2718
2717
  ] })
@@ -2722,11 +2721,11 @@ function Sr({
2722
2721
  ] })
2723
2722
  ]
2724
2723
  },
2725
- s.id
2724
+ r.id
2726
2725
  );
2727
2726
  }),
2728
- !m && /* @__PURE__ */ l(
2729
- j,
2727
+ !p && /* @__PURE__ */ l(
2728
+ G,
2730
2729
  {
2731
2730
  type: "button",
2732
2731
  variant: "outline",
@@ -2746,35 +2745,35 @@ function Dr(e) {
2746
2745
  onOpenChange: a,
2747
2746
  initialCreateFlowActive: o = !1,
2748
2747
  dismissMode: u = "passive"
2749
- } = e, d = n !== void 0, [c, i] = H(!1), [r, p] = H(
2748
+ } = e, d = n !== void 0, [c, i] = H(!1), [s, m] = H(
2750
2749
  o
2751
- ), f = d ? n : c, k = ne(
2750
+ ), f = d ? n : c, w = ne(
2752
2751
  (N) => {
2753
- !N && r && u === "passive" || (d || i(N), N || p(!1), a == null || a(N));
2752
+ !N && s && u === "passive" || (d || i(N), N || m(!1), a == null || a(N));
2754
2753
  },
2755
- [d, r, u, a]
2754
+ [d, s, u, a]
2756
2755
  ), y = ne(() => {
2757
- d || i(!1), p(!1), a == null || a(!1);
2756
+ d || i(!1), m(!1), a == null || a(!1);
2758
2757
  }, [d, a]);
2759
2758
  de(() => {
2760
- f || p(!1);
2759
+ f || m(!1);
2761
2760
  }, [f]);
2762
2761
  const h = ne(
2763
2762
  (N) => {
2764
- r && N.preventDefault();
2763
+ s && N.preventDefault();
2765
2764
  },
2766
- [r]
2765
+ [s]
2767
2766
  );
2768
2767
  return {
2769
2768
  forceClose: y,
2770
- handleOpenChange: k,
2771
- isCreateFlowActive: r,
2769
+ handleOpenChange: w,
2770
+ isCreateFlowActive: s,
2772
2771
  preventPassiveDismissDuringCreate: h,
2773
2772
  resolvedOpen: f,
2774
- setIsCreateFlowActive: p
2773
+ setIsCreateFlowActive: m
2775
2774
  };
2776
2775
  }
2777
- function rn(e) {
2776
+ function sn(e) {
2778
2777
  const {
2779
2778
  relativeMeta: n,
2780
2779
  latestValue: a,
@@ -2783,21 +2782,21 @@ function rn(e) {
2783
2782
  return o;
2784
2783
  }
2785
2784
  function ft(e, n) {
2786
- const a = rn(e);
2785
+ const a = sn(e);
2787
2786
  return n.relativeMeta ? { ...a, value: n.value, relativeMeta: n.relativeMeta } : { ...a, value: n.value };
2788
2787
  }
2789
- function Ga(e, n) {
2788
+ function Ba(e, n) {
2790
2789
  const a = n === "in" || n === "not in" || n === "between" || n === "not between" ? [] : n === "isNull" || n === "isNotNull" ? null : "";
2791
2790
  return ft({ ...e, operator: n }, { value: a });
2792
2791
  }
2793
- function Ba(e, n) {
2792
+ function Wa(e, n) {
2794
2793
  const a = qe(n.dataType) === "date";
2795
2794
  return ft(
2796
2795
  { ...e, field: n, operator: a ? "between" : "=" },
2797
2796
  { value: "" }
2798
2797
  );
2799
2798
  }
2800
- function Wa({
2799
+ function Ka({
2801
2800
  initialFilters: e,
2802
2801
  availableFields: n,
2803
2802
  onChange: a
@@ -2814,7 +2813,7 @@ function Wa({
2814
2813
  u(I), a == null || a(I);
2815
2814
  };
2816
2815
  se((I) => I.card.dataSource);
2817
- const { filterableFields: c, isLoading: i } = _n(), r = n || c || [], p = {
2816
+ const { filterableFields: c, isLoading: i } = Vn(), s = n || c || [], m = {
2818
2817
  id: "default",
2819
2818
  qualifiedFieldName: "default",
2820
2819
  name: "default",
@@ -2824,16 +2823,16 @@ function Wa({
2824
2823
  entityName: "Default",
2825
2824
  entityType: "table"
2826
2825
  }, f = (I) => {
2827
- const A = (D) => {
2828
- if (D.id === I) {
2829
- const b = r[0] || p, x = qe(b.dataType) === "date";
2826
+ const A = (S) => {
2827
+ if (S.id === I) {
2828
+ const v = s[0] || m, x = qe(v.dataType) === "date";
2830
2829
  return {
2831
- ...D,
2830
+ ...S,
2832
2831
  conditions: [
2833
- ...D.conditions,
2832
+ ...S.conditions,
2834
2833
  {
2835
2834
  id: `condition-${Date.now()}`,
2836
- field: b,
2835
+ field: v,
2837
2836
  operator: x ? "between" : "=",
2838
2837
  value: x ? [] : ""
2839
2838
  }
@@ -2841,19 +2840,19 @@ function Wa({
2841
2840
  };
2842
2841
  }
2843
2842
  return {
2844
- ...D,
2845
- groups: D.groups.map(A)
2843
+ ...S,
2844
+ groups: S.groups.map(A)
2846
2845
  };
2847
2846
  };
2848
2847
  d(A(o));
2849
- }, k = (I) => {
2850
- const A = (D) => {
2851
- if (D.id === I) {
2852
- const b = r[0] || p, x = qe(b.dataType) === "date";
2848
+ }, w = (I) => {
2849
+ const A = (S) => {
2850
+ if (S.id === I) {
2851
+ const v = s[0] || m, x = qe(v.dataType) === "date";
2853
2852
  return {
2854
- ...D,
2853
+ ...S,
2855
2854
  groups: [
2856
- ...D.groups,
2855
+ ...S.groups,
2857
2856
  {
2858
2857
  id: `group-${Date.now()}`,
2859
2858
  logicalOperator: "AND",
@@ -2861,7 +2860,7 @@ function Wa({
2861
2860
  conditions: [
2862
2861
  {
2863
2862
  id: `condition-${Date.now()}`,
2864
- field: b,
2863
+ field: v,
2865
2864
  operator: x ? "between" : "=",
2866
2865
  value: x ? [] : ""
2867
2866
  }
@@ -2872,117 +2871,118 @@ function Wa({
2872
2871
  };
2873
2872
  }
2874
2873
  return {
2875
- ...D,
2876
- groups: D.groups.map(A)
2874
+ ...S,
2875
+ groups: S.groups.map(A)
2877
2876
  };
2878
2877
  };
2879
2878
  d(A(o));
2880
2879
  }, y = (I, A) => {
2881
- const D = (b) => b.id === I ? {
2882
- ...b,
2883
- conditions: b.conditions.filter((x) => x.id !== A)
2880
+ const S = (v) => v.id === I ? {
2881
+ ...v,
2882
+ conditions: v.conditions.filter((x) => x.id !== A)
2884
2883
  } : {
2885
- ...b,
2886
- groups: b.groups.map(D)
2884
+ ...v,
2885
+ groups: v.groups.map(S)
2887
2886
  };
2888
- d(D(o));
2887
+ d(S(o));
2889
2888
  }, h = (I, A) => {
2890
- const D = (b) => b.id === I ? {
2891
- ...b,
2892
- groups: b.groups.filter((x) => x.id !== A)
2889
+ const S = (v) => v.id === I ? {
2890
+ ...v,
2891
+ groups: v.groups.filter((x) => x.id !== A)
2893
2892
  } : {
2894
- ...b,
2895
- groups: b.groups.map(D)
2893
+ ...v,
2894
+ groups: v.groups.map(S)
2896
2895
  };
2897
- d(D(o));
2898
- }, N = (I, A, D) => {
2899
- const b = (x) => x.id === I ? {
2896
+ d(S(o));
2897
+ }, N = (I, A, S) => {
2898
+ const v = (x) => x.id === I ? {
2900
2899
  ...x,
2901
2900
  conditions: x.conditions.map(
2902
- (z) => z.id === A ? D(z) : z
2901
+ (q) => q.id === A ? S(q) : q
2903
2902
  )
2904
2903
  } : {
2905
2904
  ...x,
2906
- groups: x.groups.map(b)
2905
+ groups: x.groups.map(v)
2907
2906
  };
2908
- d(b(o));
2909
- }, S = (I, A, D) => N(I, A, (b) => ({
2910
- ..."value" in D || "operator" in D || "field" in D ? rn(b) : b,
2911
- ...D
2912
- })), w = (I, A, D) => N(I, A, () => D), V = Vn(), U = (I, A) => {
2913
- const D = (b) => b.id === I ? {
2914
- ...b,
2907
+ d(v(o));
2908
+ }, k = (I, A, S) => N(I, A, (v) => ({
2909
+ ..."value" in S || "operator" in S || "field" in S ? sn(v) : v,
2910
+ ...S
2911
+ })), _ = (I, A, S) => N(I, A, () => S), D = Rn(), j = (I, A) => {
2912
+ const S = (v) => v.id === I ? {
2913
+ ...v,
2915
2914
  logicalOperator: A
2916
2915
  } : {
2917
- ...b,
2918
- groups: b.groups.map(D)
2916
+ ...v,
2917
+ groups: v.groups.map(S)
2919
2918
  };
2920
- d(D(o));
2919
+ d(S(o));
2921
2920
  }, O = (I, A) => {
2922
- const D = (b) => b.id === I ? {
2923
- ...b,
2921
+ const S = (v) => v.id === I ? {
2922
+ ...v,
2924
2923
  negate: A
2925
2924
  } : {
2926
- ...b,
2927
- groups: b.groups.map(D)
2925
+ ...v,
2926
+ groups: v.groups.map(S)
2928
2927
  };
2929
- d(D(o));
2930
- }, T = (I, A, D) => {
2931
- const b = (x) => x.id === I ? {
2928
+ d(S(o));
2929
+ }, T = (I, A, S) => {
2930
+ const v = (x) => x.id === I ? {
2932
2931
  ...x,
2933
- conditions: Nt(x.conditions, A, D)
2932
+ conditions: Nt(x.conditions, A, S)
2934
2933
  } : {
2935
2934
  ...x,
2936
- groups: x.groups.map(b)
2935
+ groups: x.groups.map(v)
2937
2936
  };
2938
- d(b(o));
2939
- }, P = (I, A, D) => {
2940
- const b = (x) => x.id === I ? {
2937
+ d(v(o));
2938
+ }, P = (I, A, S) => {
2939
+ const v = (x) => x.id === I ? {
2941
2940
  ...x,
2942
- groups: Nt(x.groups, A, D)
2941
+ groups: Nt(x.groups, A, S)
2943
2942
  } : {
2944
2943
  ...x,
2945
- groups: x.groups.map(b)
2944
+ groups: x.groups.map(v)
2946
2945
  };
2947
- d(b(o));
2946
+ d(v(o));
2948
2947
  }, J = (I) => {
2949
2948
  if (!I || I.conditions.length === 0 && I.groups.length === 0)
2950
2949
  return "-- No filters defined";
2951
- const A = (b) => {
2950
+ const A = (v) => {
2952
2951
  let x = "";
2953
- typeof b.field == "object" ? x = b.field.entityName ? `${b.field.entityName}.${b.field.name}` : b.field.name : x = String(b.field);
2954
- const z = b.operator;
2955
- let C = b.value;
2956
- if (b.latestValue && z === "=")
2952
+ typeof v.field == "object" ? x = v.field.entityName ? `${v.field.entityName}.${v.field.name}` : v.field.name : x = String(v.field);
2953
+ const q = v.operator;
2954
+ let C = v.value;
2955
+ if (v.latestValue && q === "=")
2957
2956
  return `${x} = ${qt} /* the latest value each time the card runs */`;
2958
- if (b.relativeMeta && (z === "between" || z === "not between")) {
2959
- const G = z === "between" ? "BETWEEN" : "NOT BETWEEN", { label: _, range: K } = Rn(b.relativeMeta, {
2960
- tz: (V == null ? void 0 : V.tz) ?? "UTC",
2961
- weekStart: (V == null ? void 0 : V.weekStart) ?? 1,
2962
- anchor: (V == null ? void 0 : V.anchor) ?? "now"
2957
+ const Z = Yt(v.relativeMeta);
2958
+ if (Z && (q === "between" || q === "not between")) {
2959
+ const V = q === "between" ? "BETWEEN" : "NOT BETWEEN", { label: M, range: K } = En(Z, {
2960
+ tz: (D == null ? void 0 : D.tz) ?? "UTC",
2961
+ weekStart: (D == null ? void 0 : D.weekStart) ?? 1,
2962
+ anchor: (D == null ? void 0 : D.anchor) ?? "now"
2963
2963
  });
2964
- return K ? `${x} ${G} '${K.start.toISOString()}' AND '${K.end.toISOString()}' /* ${_}: dates update each time the card runs */` : Yt(b.relativeMeta) ? `${x} ${G} ${_} /* dates count back from the latest data each time the card runs */` : `${x} ${G} ${_} /* dates follow your calendar each time the card runs */`;
2964
+ return K ? `${x} ${V} '${K.start.toISOString()}' AND '${K.end.toISOString()}' /* ${M}: dates update each time the card runs */` : Xt(Z).dataAnchored ? `${x} ${V} ${M} /* dates count back from the latest data each time the card runs */` : `${x} ${V} ${M} /* dates follow your calendar each time the card runs */`;
2965
2965
  }
2966
- if (b.field.dataType === "string" && !["in", "not in"].includes(b.operator))
2966
+ if (v.field.dataType === "string" && !["in", "not in"].includes(v.operator))
2967
2967
  typeof C == "string" ? C = `'${C}'` : Array.isArray(C) && (C = `'${C.join(", ")}'`);
2968
- else if (b.field.dataType === "date" || b.field.dataType === "datetime" || b.field.dataType === "timestamp")
2969
- if (b.operator === "between" && Array.isArray(C) && C.length === 2) {
2970
- const G = C[0] ? `'${C[0]}'` : "NULL", _ = C[1] ? `'${C[1]}'` : "NULL";
2971
- return `${x} BETWEEN ${G} AND ${_}`;
2972
- } else if ((b.operator === "in" || b.operator === "not in") && Array.isArray(C)) {
2973
- const G = C.map((_) => _ ? `'${_}'` : "NULL").join(", ");
2974
- return `${x} ${z} (${G})`;
2968
+ else if (v.field.dataType === "date" || v.field.dataType === "datetime" || v.field.dataType === "timestamp")
2969
+ if (v.operator === "between" && Array.isArray(C) && C.length === 2) {
2970
+ const V = C[0] ? `'${C[0]}'` : "NULL", M = C[1] ? `'${C[1]}'` : "NULL";
2971
+ return `${x} BETWEEN ${V} AND ${M}`;
2972
+ } else if ((v.operator === "in" || v.operator === "not in") && Array.isArray(C)) {
2973
+ const V = C.map((M) => M ? `'${M}'` : "NULL").join(", ");
2974
+ return `${x} ${q} (${V})`;
2975
2975
  } else typeof C == "string" || C instanceof Date ? C = `'${C}'` : Array.isArray(C) && C.length > 0 && (C = `'${C[0]}'`);
2976
- else if (["in", "not in"].includes(b.operator)) {
2977
- let G = [];
2978
- Array.isArray(C) ? G = C.map(
2979
- (_) => typeof _ == "string" ? `'${_}'` : String(_)
2980
- ) : typeof C == "string" ? G = C.split(",").map((_) => {
2981
- const K = _.trim();
2982
- return b.field.dataType === "string" ? `'${K}'` : K;
2983
- }) : typeof C == "number" && (G = [String(C)]), C = `(${G.join(", ")})`;
2976
+ else if (["in", "not in"].includes(v.operator)) {
2977
+ let V = [];
2978
+ Array.isArray(C) ? V = C.map(
2979
+ (M) => typeof M == "string" ? `'${M}'` : String(M)
2980
+ ) : typeof C == "string" ? V = C.split(",").map((M) => {
2981
+ const K = M.trim();
2982
+ return v.field.dataType === "string" ? `'${K}'` : K;
2983
+ }) : typeof C == "number" && (V = [String(C)]), C = `(${V.join(", ")})`;
2984
2984
  }
2985
- switch (z) {
2985
+ switch (q) {
2986
2986
  case "contains":
2987
2987
  return typeof C == "string" ? `${x} LIKE '%${C.replace(/'/g, "")}'` : `${x} LIKE '%${String(C)}'`;
2988
2988
  case "startsWith":
@@ -2994,38 +2994,38 @@ function Wa({
2994
2994
  case "isNotNull":
2995
2995
  return `${x} IS NOT NULL`;
2996
2996
  default:
2997
- return `${x} ${z} ${C}`;
2997
+ return `${x} ${q} ${C}`;
2998
2998
  }
2999
- }, D = (b) => {
3000
- const x = b.conditions.map(A), z = b.groups.map(
3001
- (K) => D(K)
3002
- ), C = [...x, ...z].filter(Boolean);
2999
+ }, S = (v) => {
3000
+ const x = v.conditions.map(A), q = v.groups.map(
3001
+ (M) => S(M)
3002
+ ), C = [...x, ...q].filter(Boolean);
3003
3003
  if (C.length === 0) return "";
3004
- const G = C.join(` ${b.logicalOperator} `), _ = C.length > 1 ? `(${G})` : G;
3005
- return b.negate ? `NOT ${_}` : _;
3004
+ const Z = C.join(` ${v.logicalOperator} `), V = C.length > 1 ? `(${Z})` : Z;
3005
+ return v.negate ? `NOT ${V}` : V;
3006
3006
  };
3007
- return D(I);
3008
- }, m = o.conditions.length > 0 || o.groups.length > 0;
3007
+ return S(I);
3008
+ }, p = o.conditions.length > 0 || o.groups.length > 0;
3009
3009
  return {
3010
3010
  currentFilters: o,
3011
3011
  setCurrentFilters: d,
3012
- availableFields: r,
3012
+ availableFields: s,
3013
3013
  isLoading: i,
3014
3014
  addCondition: f,
3015
- addGroup: k,
3015
+ addGroup: w,
3016
3016
  removeCondition: y,
3017
3017
  removeGroup: h,
3018
- updateConditionFields: S,
3019
- replaceCondition: w,
3020
- updateGroupOperator: U,
3018
+ updateConditionFields: k,
3019
+ replaceCondition: _,
3020
+ updateGroupOperator: j,
3021
3021
  updateGroupNegate: O,
3022
3022
  reorderConditions: T,
3023
3023
  reorderGroups: P,
3024
3024
  generateSQLPreview: J,
3025
- hasAnyFilters: m
3025
+ hasAnyFilters: p
3026
3026
  };
3027
3027
  }
3028
- function Ka({
3028
+ function Qa({
3029
3029
  children: e,
3030
3030
  className: n,
3031
3031
  delayDuration: a
@@ -3034,7 +3034,7 @@ function Ka({
3034
3034
  /* @__PURE__ */ t(st, { asChild: !0, children: /* @__PURE__ */ t(
3035
3035
  "div",
3036
3036
  {
3037
- className: M(
3037
+ className: z(
3038
3038
  "w-[200px] overflow-hidden text-ellipsis whitespace-nowrap text-sm",
3039
3039
  n
3040
3040
  ),
@@ -3044,7 +3044,7 @@ function Ka({
3044
3044
  /* @__PURE__ */ t(ot, { children: e })
3045
3045
  ] }) });
3046
3046
  }
3047
- function Qa({
3047
+ function Ha({
3048
3048
  value: e,
3049
3049
  onValueChange: n,
3050
3050
  availableFields: a,
@@ -3054,24 +3054,24 @@ function Qa({
3054
3054
  const [d, c] = vt.useState(!1), i = vt.useMemo(
3055
3055
  () => new Set(e ? [e.id] : []),
3056
3056
  [e]
3057
- ), r = e ? Xt(e) : null;
3057
+ ), s = e ? Jt(e) : null;
3058
3058
  return /* @__PURE__ */ l(it, { modal: !0, open: d, onOpenChange: c, children: [
3059
3059
  /* @__PURE__ */ t(lt, { asChild: !0, children: /* @__PURE__ */ l(
3060
- j,
3060
+ G,
3061
3061
  {
3062
3062
  variant: "outline",
3063
3063
  size: "xs",
3064
3064
  role: "combobox",
3065
3065
  "aria-expanded": d,
3066
3066
  title: e ? `${e.entityName}.${e.name}` : void 0,
3067
- className: M(
3067
+ className: z(
3068
3068
  "min-w-0 justify-between gap-1.5 font-normal",
3069
3069
  !e && "text-muted-foreground",
3070
3070
  u
3071
3071
  ),
3072
3072
  children: [
3073
- r ? /* @__PURE__ */ t(Ka, { className: "w-auto min-w-0 flex-1 text-left text-[12px]", children: r }) : /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-left", children: o }),
3074
- /* @__PURE__ */ t(En, { className: "h-3.5 w-3.5 shrink-0 opacity-50" })
3073
+ s ? /* @__PURE__ */ t(Qa, { className: "w-auto min-w-0 flex-1 text-left text-[12px]", children: s }) : /* @__PURE__ */ t("span", { className: "min-w-0 flex-1 truncate text-left", children: o }),
3074
+ /* @__PURE__ */ t(Mn, { className: "h-3.5 w-3.5 shrink-0 opacity-50" })
3075
3075
  ]
3076
3076
  }
3077
3077
  ) }),
@@ -3080,17 +3080,17 @@ function Qa({
3080
3080
  {
3081
3081
  className: "flex w-80 flex-col rounded-control p-1.5",
3082
3082
  align: "start",
3083
- onOpenAutoFocus: (p) => {
3084
- var f, k;
3085
- p.preventDefault(), (k = (f = p.currentTarget) == null ? void 0 : f.querySelector('input[type="text"]')) == null || k.focus();
3083
+ onOpenAutoFocus: (m) => {
3084
+ var f, w;
3085
+ m.preventDefault(), (w = (f = m.currentTarget) == null ? void 0 : f.querySelector('input[type="text"]')) == null || w.focus();
3086
3086
  },
3087
3087
  children: /* @__PURE__ */ t(
3088
- Mn,
3088
+ zn,
3089
3089
  {
3090
3090
  fields: a,
3091
3091
  selectedIds: i,
3092
- onSelect: (p) => {
3093
- n(p), c(!1);
3092
+ onSelect: (m) => {
3093
+ n(m), c(!1);
3094
3094
  },
3095
3095
  density: "compact",
3096
3096
  listLabel: "Fields",
@@ -3101,28 +3101,28 @@ function Qa({
3101
3101
  )
3102
3102
  ] });
3103
3103
  }
3104
- function sn(e, n) {
3105
- var p;
3104
+ function on(e, n) {
3105
+ var m;
3106
3106
  const a = se((f) => f.card.dataSource), o = se(
3107
3107
  (f) => f.card.connectionId
3108
3108
  ), u = se(
3109
3109
  (f) => f.selectedConnectionId
3110
- ), d = n ? n.dataSource : a, c = n ? n.connectionId || ((p = n.dataSource) == null ? void 0 : p.connectionId) : u || (a == null ? void 0 : a.connectionId) || o, i = Q(
3110
+ ), d = n ? n.dataSource : a, c = n ? n.connectionId || ((m = n.dataSource) == null ? void 0 : m.connectionId) : u || (a == null ? void 0 : a.connectionId) || o, i = Q(
3111
3111
  () => ({
3112
3112
  id: `card-filter-option:${e.id}`,
3113
- ...Ma(e, { dataSource: d, connectionId: c })
3113
+ ...za(e, { dataSource: d, connectionId: c })
3114
3114
  }),
3115
3115
  [c, d, e]
3116
- ), r = Q(
3117
- () => zn({ filter: i }),
3116
+ ), s = Q(
3117
+ () => qn({ filter: i }),
3118
3118
  [i]
3119
3119
  );
3120
- return qn(i, {
3121
- inputContext: r,
3120
+ return jn(i, {
3121
+ inputContext: s,
3122
3122
  currentSelectionPolicy: "exclude"
3123
3123
  });
3124
3124
  }
3125
- function Ha({
3125
+ function Pa({
3126
3126
  field: e,
3127
3127
  source: n,
3128
3128
  selected: a,
@@ -3130,20 +3130,20 @@ function Ha({
3130
3130
  placeholder: u = "Select values…",
3131
3131
  className: d
3132
3132
  }) {
3133
- const [c, i] = _e.useState(!1), r = sn(e, n), p = _e.useMemo(
3133
+ const [c, i] = _e.useState(!1), s = on(e, n), m = _e.useMemo(
3134
3134
  () => new Set(a.map((h) => ye(h))),
3135
3135
  [a]
3136
3136
  ), f = (h) => {
3137
- var N, S;
3138
- return ((S = (N = r.allRecords.find((w) => ye(w.value) === ye(h))) == null ? void 0 : N.label) == null ? void 0 : S.toString()) ?? h;
3139
- }, k = (h) => {
3137
+ var N, k;
3138
+ return ((k = (N = s.allRecords.find((_) => ye(_.value) === ye(h))) == null ? void 0 : N.label) == null ? void 0 : k.toString()) ?? h;
3139
+ }, w = (h) => {
3140
3140
  o(a.filter((N) => N !== h));
3141
3141
  }, y = (h) => {
3142
- i(h), !h && r.query && r.setQuery("");
3142
+ i(h), !h && s.query && s.setQuery("");
3143
3143
  };
3144
- return /* @__PURE__ */ t("div", { className: M("w-full", d), children: /* @__PURE__ */ l(it, { open: c, onOpenChange: y, modal: !0, children: [
3144
+ return /* @__PURE__ */ t("div", { className: z("w-full", d), children: /* @__PURE__ */ l(it, { open: c, onOpenChange: y, modal: !0, children: [
3145
3145
  /* @__PURE__ */ t(lt, { asChild: !0, children: /* @__PURE__ */ l(
3146
- j,
3146
+ G,
3147
3147
  {
3148
3148
  variant: "outline",
3149
3149
  size: "xs",
@@ -3170,14 +3170,14 @@ function Ha({
3170
3170
  tabIndex: 0,
3171
3171
  "aria-label": `Remove ${N}`,
3172
3172
  className: "shrink-0 rounded-[2px] text-muted-foreground outline-none hover:text-foreground focus-visible:ring-1 focus-visible:ring-ring",
3173
- onKeyDown: (S) => {
3174
- S.key === "Enter" && k(h);
3173
+ onKeyDown: (k) => {
3174
+ k.key === "Enter" && w(h);
3175
3175
  },
3176
- onMouseDown: (S) => {
3177
- S.preventDefault(), S.stopPropagation();
3176
+ onMouseDown: (k) => {
3177
+ k.preventDefault(), k.stopPropagation();
3178
3178
  },
3179
- onClick: (S) => {
3180
- S.stopPropagation(), k(h);
3179
+ onClick: (k) => {
3180
+ k.stopPropagation(), w(h);
3181
3181
  },
3182
3182
  children: /* @__PURE__ */ t(ce, { className: "h-3 w-3" })
3183
3183
  }
@@ -3198,19 +3198,19 @@ function Ha({
3198
3198
  className: "w-[var(--radix-popover-trigger-width)] min-w-[240px] rounded-control p-1.5",
3199
3199
  align: "start",
3200
3200
  onOpenAutoFocus: (h) => {
3201
- var N, S;
3202
- h.preventDefault(), (S = (N = h.currentTarget) == null ? void 0 : N.querySelector('input[type="text"]')) == null || S.focus();
3201
+ var N, k;
3202
+ h.preventDefault(), (k = (N = h.currentTarget) == null ? void 0 : N.querySelector('input[type="text"]')) == null || k.focus();
3203
3203
  },
3204
3204
  children: /* @__PURE__ */ t(
3205
3205
  jt,
3206
3206
  {
3207
- records: r.displayRecords,
3208
- selectedIdentities: p,
3207
+ records: s.displayRecords,
3208
+ selectedIdentities: m,
3209
3209
  onToggle: (h) => {
3210
3210
  const N = String(h.value);
3211
- a.includes(N) ? k(N) : o([...a, N]);
3211
+ a.includes(N) ? w(N) : o([...a, N]);
3212
3212
  },
3213
- browse: r,
3213
+ browse: s,
3214
3214
  searchPlaceholder: `Search ${(e.label || e.name).toLowerCase()}`,
3215
3215
  listLabel: e.label || e.name,
3216
3216
  density: "compact"
@@ -3220,7 +3220,7 @@ function Ha({
3220
3220
  )
3221
3221
  ] }) });
3222
3222
  }
3223
- function Pa({
3223
+ function Ya({
3224
3224
  field: e,
3225
3225
  source: n,
3226
3226
  value: a,
@@ -3229,23 +3229,23 @@ function Pa({
3229
3229
  className: d
3230
3230
  }) {
3231
3231
  var y, h;
3232
- const [c, i] = _e.useState(!1), r = sn(e, n), p = _e.useMemo(
3232
+ const [c, i] = _e.useState(!1), s = on(e, n), m = _e.useMemo(
3233
3233
  () => new Set(a ? [ye(a)] : []),
3234
3234
  [a]
3235
- ), f = a ? ((h = (y = r.allRecords.find(
3235
+ ), f = a ? ((h = (y = s.allRecords.find(
3236
3236
  (N) => ye(N.value) === ye(a)
3237
- )) == null ? void 0 : y.label) == null ? void 0 : h.toString()) ?? a : "", k = (N) => {
3238
- i(N), !N && r.query && r.setQuery("");
3237
+ )) == null ? void 0 : y.label) == null ? void 0 : h.toString()) ?? a : "", w = (N) => {
3238
+ i(N), !N && s.query && s.setQuery("");
3239
3239
  };
3240
- return /* @__PURE__ */ l(it, { open: c, onOpenChange: k, modal: !0, children: [
3240
+ return /* @__PURE__ */ l(it, { open: c, onOpenChange: w, modal: !0, children: [
3241
3241
  /* @__PURE__ */ t(lt, { asChild: !0, children: /* @__PURE__ */ l(
3242
- j,
3242
+ G,
3243
3243
  {
3244
3244
  variant: "outline",
3245
3245
  size: "xs",
3246
3246
  role: "combobox",
3247
3247
  "aria-expanded": c,
3248
- className: M(
3248
+ className: z(
3249
3249
  "min-w-0 flex-1 justify-between gap-1.5 px-2 font-normal",
3250
3250
  d
3251
3251
  ),
@@ -3253,7 +3253,7 @@ function Pa({
3253
3253
  /* @__PURE__ */ t(
3254
3254
  "span",
3255
3255
  {
3256
- className: M("truncate", !a && "text-muted-foreground"),
3256
+ className: z("truncate", !a && "text-muted-foreground"),
3257
3257
  children: a ? f : u
3258
3258
  }
3259
3259
  ),
@@ -3267,19 +3267,19 @@ function Pa({
3267
3267
  className: "w-[var(--radix-popover-trigger-width)] min-w-[240px] rounded-control p-1.5",
3268
3268
  align: "start",
3269
3269
  onOpenAutoFocus: (N) => {
3270
- var S, w;
3271
- N.preventDefault(), (w = (S = N.currentTarget) == null ? void 0 : S.querySelector('input[type="text"]')) == null || w.focus();
3270
+ var k, _;
3271
+ N.preventDefault(), (_ = (k = N.currentTarget) == null ? void 0 : k.querySelector('input[type="text"]')) == null || _.focus();
3272
3272
  },
3273
3273
  children: /* @__PURE__ */ t(
3274
3274
  jt,
3275
3275
  {
3276
- records: r.displayRecords,
3277
- selectedIdentities: p,
3276
+ records: s.displayRecords,
3277
+ selectedIdentities: m,
3278
3278
  onToggle: (N) => {
3279
- o(String(N.value)), k(!1);
3279
+ o(String(N.value)), w(!1);
3280
3280
  },
3281
3281
  selectionMode: "single",
3282
- browse: r,
3282
+ browse: s,
3283
3283
  searchPlaceholder: `Search ${(e.label || e.name).toLowerCase()}`,
3284
3284
  listLabel: e.label || e.name,
3285
3285
  density: "compact"
@@ -3289,93 +3289,93 @@ function Pa({
3289
3289
  )
3290
3290
  ] });
3291
3291
  }
3292
- function Ya({
3292
+ function Xa({
3293
3293
  value: e,
3294
3294
  operator: n,
3295
3295
  relativeMeta: a,
3296
3296
  latestValue: o,
3297
- onChange: u,
3298
- className: d
3297
+ field: u,
3298
+ onChange: d,
3299
+ className: c
3299
3300
  }) {
3300
- const c = jn(), i = Un(), r = n === "between" || n === "not between", p = Q(() => {
3301
- if (!r || !a) return;
3302
- const w = i(a);
3301
+ const i = Un(), s = Gn(), m = n === "between" || n === "not between", f = Q(() => {
3302
+ if (!m || !a) return;
3303
+ const D = s(a);
3303
3304
  return {
3304
- ...w,
3305
- tooltip: w.dates ? void 0 : Yt(a) ? Gn : Bn
3305
+ ...D,
3306
+ tooltip: D.dates ? void 0 : Xt(a).dataAnchored ? Bn : Wn
3306
3307
  };
3307
- }, [r, a, i]), f = Q(() => {
3308
- if (r) {
3309
- if (p) {
3310
- const { range: w } = p;
3311
- return w ? { from: w.start, to: w.end } : void 0;
3308
+ }, [m, a, s]), w = Q(() => {
3309
+ if (m) {
3310
+ if (f) {
3311
+ const { range: D } = f;
3312
+ return D ? { from: D.start, to: D.end } : void 0;
3312
3313
  }
3313
3314
  if (e && Array.isArray(e) && e.length === 2) {
3314
- const w = Ye(e[0], c, "start"), V = Ye(e[1], c, "end");
3315
- if (w && V)
3316
- return { from: w, to: V };
3315
+ const D = Ye(e[0], i, "start"), j = Ye(e[1], i, "end");
3316
+ if (D && j)
3317
+ return { from: D, to: j };
3317
3318
  }
3318
3319
  }
3319
- }, [e, r, p, c]), k = Q(() => {
3320
- if (!e || r || o) return;
3321
- const w = Array.isArray(e) ? e[0] : e;
3322
- return Ye(w, c, "start");
3323
- }, [e, r, o, c]), y = (w) => n === "<=" || n === ">" ? pa(w, c) : fa(w, c);
3320
+ }, [e, m, f, i]), y = Q(() => {
3321
+ if (!e || m || o) return;
3322
+ const D = Array.isArray(e) ? e[0] : e;
3323
+ return Ye(D, i, "start");
3324
+ }, [e, m, o, i]), h = (D) => n === "<=" || n === ">" ? fa(D, i) : ha(D, i);
3324
3325
  return /* @__PURE__ */ t(
3325
- Wn,
3326
+ Kn,
3326
3327
  {
3327
- value: r ? f : void 0,
3328
- selectionMode: r ? "range" : "single",
3329
- singleValue: r ? void 0 : k,
3330
- singleValueLabel: !r && o ? qt : void 0,
3331
- onChange: (w) => {
3332
- if (w != null && w.from && w.to) {
3333
- u({ value: [w.from.toISOString(), w.to.toISOString()] });
3328
+ value: m ? w : void 0,
3329
+ selectionMode: m ? "range" : "single",
3330
+ singleValue: m ? void 0 : y,
3331
+ singleValueLabel: !m && o ? qt : void 0,
3332
+ onChange: (D) => {
3333
+ if (D != null && D.from && D.to) {
3334
+ d({ value: [D.from.toISOString(), D.to.toISOString()] });
3334
3335
  return;
3335
3336
  }
3336
- u({ value: [] });
3337
+ d({ value: [] });
3337
3338
  },
3338
- onSingleChange: (w) => {
3339
- if (!w) {
3340
- u({ value: "" });
3339
+ onSingleChange: (D) => {
3340
+ if (!D) {
3341
+ d({ value: "" });
3341
3342
  return;
3342
3343
  }
3343
- const V = y(w), U = ma(V, n, {
3344
- timezone: c
3344
+ const j = h(D), O = pa(j, n, {
3345
+ timezone: i
3345
3346
  });
3346
- u({ value: typeof U == "string" ? U : U.toISOString() });
3347
+ d({ value: typeof O == "string" ? O : O.toISOString() });
3347
3348
  },
3348
- onRelativeSelect: r ? (w, V) => {
3349
- if (!w.from || !w.to) {
3350
- u({ value: [] });
3349
+ onRelativeSelect: m ? (D, j) => {
3350
+ if (!D.from || !D.to) {
3351
+ d({ value: [] });
3351
3352
  return;
3352
3353
  }
3353
- u({
3354
- value: [w.from.toISOString(), w.to.toISOString()],
3355
- relativeMeta: V
3354
+ d({
3355
+ value: [D.from.toISOString(), D.to.toISOString()],
3356
+ relativeMeta: j
3356
3357
  });
3357
3358
  } : void 0,
3358
- relativeValue: r ? a : void 0,
3359
- relativeSummary: p,
3360
- supplementalFooter: r ? /* @__PURE__ */ l("p", { className: "flex items-center gap-1.5 border-t border-border px-3 py-2 text-[11px] text-muted-foreground", children: [
3361
- /* @__PURE__ */ t(Kn, { className: "h-3 w-3 shrink-0", "aria-hidden": "true" }),
3362
- "Presets and Relative update each time the card runs. Static dates stay fixed."
3363
- ] }) : void 0,
3364
- timezone: c,
3365
- showRelativeTab: r,
3366
- className: M("min-w-0", d),
3359
+ relativeValue: m ? a : void 0,
3360
+ relativeSummary: f,
3361
+ supplementalFooter: m ? /* @__PURE__ */ t("p", { className: "border-t border-border px-3 py-2 text-[11px] text-muted-foreground", children: "Presets and Relative update each time the card runs. Static dates stay fixed." }) : void 0,
3362
+ timezone: i,
3363
+ enableTimePrecision: ma(u),
3364
+ staticTimeInputs: !1,
3365
+ showRelativeTab: m,
3366
+ className: z("min-w-0", c),
3367
3367
  buttonClassName: "h-7 text-[12px] [&>span]:text-[12px]",
3368
3368
  placeholder: "Select date…"
3369
3369
  }
3370
3370
  );
3371
3371
  }
3372
- const Xa = (e) => e.conditions.length > 0 || e.groups.length > 0, ht = [
3372
+ const Ja = (e) => e.conditions.length > 0 || e.groups.length > 0, ht = [
3373
3373
  "contains",
3374
3374
  "startsWith",
3375
3375
  "endsWith",
3376
3376
  "like",
3377
3377
  "not like"
3378
- ], Ja = [
3378
+ ], Za = [
3379
3379
  "=",
3380
3380
  "!=",
3381
3381
  ">",
@@ -3387,7 +3387,7 @@ const Xa = (e) => e.conditions.length > 0 || e.groups.length > 0, ht = [
3387
3387
  "not in",
3388
3388
  "isNull",
3389
3389
  "isNotNull"
3390
- ], Za = [
3390
+ ], er = [
3391
3391
  "=",
3392
3392
  "!=",
3393
3393
  ...ht,
@@ -3395,7 +3395,7 @@ const Xa = (e) => e.conditions.length > 0 || e.groups.length > 0, ht = [
3395
3395
  "not in",
3396
3396
  "isNull",
3397
3397
  "isNotNull"
3398
- ], er = [
3398
+ ], tr = [
3399
3399
  "=",
3400
3400
  "!=",
3401
3401
  ">",
@@ -3406,7 +3406,7 @@ const Xa = (e) => e.conditions.length > 0 || e.groups.length > 0, ht = [
3406
3406
  "not in",
3407
3407
  "isNull",
3408
3408
  "isNotNull"
3409
- ], tr = ["=", "!=", "isNull", "isNotNull"], nr = [
3409
+ ], nr = ["=", "!=", "isNull", "isNotNull"], ar = [
3410
3410
  "between",
3411
3411
  // Default operator for dates
3412
3412
  "=",
@@ -3417,7 +3417,7 @@ const Xa = (e) => e.conditions.length > 0 || e.groups.length > 0, ht = [
3417
3417
  ">=",
3418
3418
  "isNull",
3419
3419
  "isNotNull"
3420
- ], ar = {
3420
+ ], rr = {
3421
3421
  "=": "Equals",
3422
3422
  "!=": "Not equals",
3423
3423
  ">": "Greater than",
@@ -3437,24 +3437,24 @@ const Xa = (e) => e.conditions.length > 0 || e.groups.length > 0, ht = [
3437
3437
  "not between": "Not between"
3438
3438
  };
3439
3439
  function Je(e) {
3440
- return ar[e] || ha(e);
3440
+ return rr[e] || xa(e);
3441
3441
  }
3442
- function rr(e) {
3442
+ function sr(e) {
3443
3443
  switch (e) {
3444
3444
  case "string":
3445
- return Za;
3446
- case "number":
3447
3445
  return er;
3448
- case "boolean":
3446
+ case "number":
3449
3447
  return tr;
3450
- case "date":
3448
+ case "boolean":
3451
3449
  return nr;
3450
+ case "date":
3451
+ return ar;
3452
3452
  default:
3453
- return Ja;
3453
+ return Za;
3454
3454
  }
3455
3455
  }
3456
- const on = "w-[68px] shrink-0", $t = "group-data-[inline]/filters:w-auto group-data-[inline]/filters:min-w-0 group-data-[inline]/filters:flex-1 group-data-[inline]/filters:shrink", xt = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
3457
- function ln({
3456
+ const ln = "w-[68px] shrink-0", $t = "group-data-[inline]/filters:w-auto group-data-[inline]/filters:min-w-0 group-data-[inline]/filters:flex-1 group-data-[inline]/filters:shrink", xt = "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground";
3457
+ function dn({
3458
3458
  value: e,
3459
3459
  onValueChange: n,
3460
3460
  "aria-label": a
@@ -3470,7 +3470,7 @@ function ln({
3470
3470
  {
3471
3471
  size: "xs",
3472
3472
  "aria-label": a,
3473
- className: M(on, "font-medium"),
3473
+ className: z(ln, "font-medium"),
3474
3474
  children: /* @__PURE__ */ t(be, {})
3475
3475
  }
3476
3476
  ),
@@ -3482,7 +3482,7 @@ function ln({
3482
3482
  }
3483
3483
  );
3484
3484
  }
3485
- function dn({
3485
+ function cn({
3486
3486
  condition: e,
3487
3487
  index: n,
3488
3488
  groupId: a,
@@ -3491,28 +3491,28 @@ function dn({
3491
3491
  onUpdateGroupOperator: d,
3492
3492
  availableFields: c,
3493
3493
  source: i,
3494
- updateConditionFields: r,
3495
- replaceCondition: p
3494
+ updateConditionFields: s,
3495
+ replaceCondition: m
3496
3496
  }) {
3497
3497
  const {
3498
3498
  attributes: f,
3499
- listeners: k,
3499
+ listeners: w,
3500
3500
  setNodeRef: y,
3501
3501
  transform: h,
3502
3502
  transition: N,
3503
- isDragging: S
3504
- } = Ut({ id: e.id }), w = {
3503
+ isDragging: k
3504
+ } = Ut({ id: e.id }), _ = {
3505
3505
  transform: Gt.Transform.toString(h),
3506
3506
  transition: N
3507
- }, V = qe(e.field.dataType), U = e.operator === "isNull" || e.operator === "isNotNull", O = e.operator === "in" || e.operator === "not in";
3507
+ }, D = qe(e.field.dataType), j = e.operator === "isNull" || e.operator === "isNotNull", O = e.operator === "in" || e.operator === "not in";
3508
3508
  return /* @__PURE__ */ l(
3509
3509
  "div",
3510
3510
  {
3511
3511
  ref: y,
3512
- style: w,
3513
- className: M(
3512
+ style: _,
3513
+ className: z(
3514
3514
  "flex items-center gap-2 rounded-control px-1.5 py-1 transition-colors hover:bg-muted/40",
3515
- S && "z-50 opacity-50"
3515
+ k && "z-50 opacity-50"
3516
3516
  ),
3517
3517
  children: [
3518
3518
  /* @__PURE__ */ t(
@@ -3520,44 +3520,44 @@ function dn({
3520
3520
  {
3521
3521
  type: "button",
3522
3522
  ...f,
3523
- ...k,
3523
+ ...w,
3524
3524
  "aria-label": "Drag to reorder condition",
3525
3525
  className: "flex h-7 w-5 shrink-0 cursor-grab items-center justify-center rounded-control text-muted-foreground/60 hover:text-foreground focus-visible:outline-none active:cursor-grabbing",
3526
3526
  children: /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" })
3527
3527
  }
3528
3528
  ),
3529
3529
  n > 0 ? /* @__PURE__ */ t(
3530
- ln,
3530
+ dn,
3531
3531
  {
3532
3532
  value: o,
3533
3533
  onValueChange: (T) => d(a, T),
3534
3534
  "aria-label": "Logical operator"
3535
3535
  }
3536
- ) : /* @__PURE__ */ t("span", { className: M(on, "text-center", xt), children: "Where" }),
3536
+ ) : /* @__PURE__ */ t("span", { className: z(ln, "text-center", xt), children: "Where" }),
3537
3537
  /* @__PURE__ */ t(
3538
- Qa,
3538
+ Ha,
3539
3539
  {
3540
3540
  value: e.field,
3541
3541
  onValueChange: (T) => {
3542
- p(
3542
+ m(
3543
3543
  a,
3544
3544
  e.id,
3545
- Ba(e, T)
3545
+ Wa(e, T)
3546
3546
  );
3547
3547
  },
3548
3548
  availableFields: c,
3549
3549
  placeholder: "Select field",
3550
- className: M("w-60 shrink-0", $t)
3550
+ className: z("w-60 shrink-0", $t)
3551
3551
  }
3552
3552
  ),
3553
3553
  /* @__PURE__ */ l(
3554
3554
  xe,
3555
3555
  {
3556
3556
  value: e.operator,
3557
- onValueChange: (T) => p(
3557
+ onValueChange: (T) => m(
3558
3558
  a,
3559
3559
  e.id,
3560
- Ga(e, T)
3560
+ Ba(e, T)
3561
3561
  ),
3562
3562
  children: [
3563
3563
  /* @__PURE__ */ t(
@@ -3565,21 +3565,21 @@ function dn({
3565
3565
  {
3566
3566
  size: "xs",
3567
3567
  "aria-label": "Operator",
3568
- className: M("w-40 shrink-0", $t),
3568
+ className: z("w-40 shrink-0", $t),
3569
3569
  children: /* @__PURE__ */ t(be, { children: e.operator ? Je(e.operator) : "" })
3570
3570
  }
3571
3571
  ),
3572
- /* @__PURE__ */ t(ve, { children: rr(V).map((T) => /* @__PURE__ */ t(re, { value: T, children: Je(T) }, T)) })
3572
+ /* @__PURE__ */ t(ve, { children: sr(D).map((T) => /* @__PURE__ */ t(re, { value: T, children: Je(T) }, T)) })
3573
3573
  ]
3574
3574
  }
3575
3575
  ),
3576
- U ? /* @__PURE__ */ t("div", { className: "min-w-0 flex-1" }) : V === "string" ? O ? /* @__PURE__ */ t(
3577
- Ha,
3576
+ j ? /* @__PURE__ */ t("div", { className: "min-w-0 flex-1" }) : D === "string" ? O ? /* @__PURE__ */ t(
3577
+ Pa,
3578
3578
  {
3579
3579
  field: e.field,
3580
3580
  source: i,
3581
3581
  selected: Array.isArray(e.value) && e.value.every((T) => typeof T == "string") ? e.value : [],
3582
- onChange: (T) => r(a, e.id, {
3582
+ onChange: (T) => s(a, e.id, {
3583
3583
  value: T
3584
3584
  }),
3585
3585
  placeholder: "Select values…",
@@ -3590,27 +3590,27 @@ function dn({
3590
3590
  {
3591
3591
  size: "xs",
3592
3592
  value: typeof e.value == "string" ? e.value : "",
3593
- onChange: (T) => r(a, e.id, {
3593
+ onChange: (T) => s(a, e.id, {
3594
3594
  value: T.target.value
3595
3595
  }),
3596
3596
  className: "min-w-0 flex-1",
3597
3597
  placeholder: `${Je(e.operator)}…`
3598
3598
  }
3599
3599
  ) : /* @__PURE__ */ t(
3600
- Pa,
3600
+ Ya,
3601
3601
  {
3602
3602
  field: e.field,
3603
3603
  source: i,
3604
3604
  value: typeof e.value == "string" ? e.value : "",
3605
- onChange: (T) => r(a, e.id, { value: T }),
3605
+ onChange: (T) => s(a, e.id, { value: T }),
3606
3606
  placeholder: "Select value…",
3607
3607
  className: "min-w-0 flex-1"
3608
3608
  }
3609
- ) : V === "boolean" ? /* @__PURE__ */ l(
3609
+ ) : D === "boolean" ? /* @__PURE__ */ l(
3610
3610
  xe,
3611
3611
  {
3612
3612
  value: typeof e.value == "boolean" ? String(e.value) : "",
3613
- onValueChange: (T) => r(a, e.id, {
3613
+ onValueChange: (T) => s(a, e.id, {
3614
3614
  value: T === "true"
3615
3615
  }),
3616
3616
  children: [
@@ -3621,19 +3621,20 @@ function dn({
3621
3621
  ] })
3622
3622
  ]
3623
3623
  }
3624
- ) : V === "date" ? (
3624
+ ) : D === "date" ? (
3625
3625
  // Date fields use CardDateFilter which:
3626
3626
  // - Formats dates as ISO strings for backend compatibility
3627
3627
  // - Handles different operators (=, !=, >, <, between, in, etc.)
3628
3628
  // - Saves relative choices ("This month") with the range
3629
3629
  /* @__PURE__ */ t(
3630
- Ya,
3630
+ Xa,
3631
3631
  {
3632
3632
  value: e.value,
3633
3633
  operator: e.operator,
3634
- relativeMeta: e.relativeMeta,
3634
+ relativeMeta: Yt(e.relativeMeta),
3635
3635
  latestValue: e.latestValue === !0,
3636
- onChange: (T) => p(
3636
+ field: e.field,
3637
+ onChange: (T) => m(
3637
3638
  a,
3638
3639
  e.id,
3639
3640
  ft(e, T)
@@ -3646,7 +3647,7 @@ function dn({
3646
3647
  {
3647
3648
  size: "xs",
3648
3649
  value: typeof e.value == "string" || typeof e.value == "number" ? e.value : "",
3649
- onChange: (T) => r(a, e.id, {
3650
+ onChange: (T) => s(a, e.id, {
3650
3651
  value: T.target.value
3651
3652
  }),
3652
3653
  className: "min-w-0 flex-1",
@@ -3654,7 +3655,7 @@ function dn({
3654
3655
  }
3655
3656
  ),
3656
3657
  /* @__PURE__ */ t(
3657
- j,
3658
+ G,
3658
3659
  {
3659
3660
  variant: "ghost",
3660
3661
  size: "xs",
@@ -3669,18 +3670,18 @@ function dn({
3669
3670
  );
3670
3671
  }
3671
3672
  const Ft = "group-data-[inline]/filters:h-auto group-data-[inline]/filters:gap-1 group-data-[inline]/filters:border-0 group-data-[inline]/filters:bg-transparent group-data-[inline]/filters:px-0 group-data-[inline]/filters:py-0.5 group-data-[inline]/filters:text-[11px] group-data-[inline]/filters:font-medium group-data-[inline]/filters:text-muted-foreground group-data-[inline]/filters:shadow-none group-data-[inline]/filters:underline-offset-2 group-data-[inline]/filters:hover:bg-transparent group-data-[inline]/filters:hover:text-foreground group-data-[inline]/filters:hover:underline";
3672
- function cn({
3673
+ function un({
3673
3674
  onAddCondition: e,
3674
3675
  onAddGroup: n
3675
3676
  }) {
3676
3677
  return /* @__PURE__ */ l("div", { className: "mt-2 flex items-center gap-1.5 group-data-[inline]/filters:mt-1 group-data-[inline]/filters:gap-3", children: [
3677
3678
  /* @__PURE__ */ l(
3678
- j,
3679
+ G,
3679
3680
  {
3680
3681
  type: "button",
3681
3682
  size: "xs",
3682
3683
  variant: "outline",
3683
- className: M("gap-1.5", Ft),
3684
+ className: z("gap-1.5", Ft),
3684
3685
  onClick: e,
3685
3686
  children: [
3686
3687
  /* @__PURE__ */ t(Ve, { className: "h-3 w-3" }),
@@ -3689,12 +3690,12 @@ function cn({
3689
3690
  }
3690
3691
  ),
3691
3692
  n && /* @__PURE__ */ l(
3692
- j,
3693
+ G,
3693
3694
  {
3694
3695
  type: "button",
3695
3696
  size: "xs",
3696
3697
  variant: "ghost",
3697
- className: M("gap-1.5 text-muted-foreground hover:text-foreground", Ft),
3698
+ className: z("gap-1.5 text-muted-foreground hover:text-foreground", Ft),
3698
3699
  onClick: n,
3699
3700
  children: [
3700
3701
  /* @__PURE__ */ t(Ve, { className: "h-3 w-3" }),
@@ -3704,7 +3705,7 @@ function cn({
3704
3705
  )
3705
3706
  ] });
3706
3707
  }
3707
- function sr({
3708
+ function or({
3708
3709
  group: e,
3709
3710
  depth: n,
3710
3711
  parentGroupId: a,
@@ -3713,48 +3714,48 @@ function sr({
3713
3714
  onRemoveGroup: d,
3714
3715
  onRemoveCondition: c,
3715
3716
  onReorderConditions: i,
3716
- onReorderGroups: r,
3717
- onAddCondition: p,
3717
+ onReorderGroups: s,
3718
+ onAddCondition: m,
3718
3719
  onAddGroup: f,
3719
- availableFields: k,
3720
+ availableFields: w,
3720
3721
  source: y,
3721
3722
  renderFilterGroup: h,
3722
3723
  updateConditionFields: N,
3723
- replaceCondition: S
3724
+ replaceCondition: k
3724
3725
  }) {
3725
3726
  const {
3726
- attributes: w,
3727
- listeners: V,
3728
- setNodeRef: U,
3727
+ attributes: _,
3728
+ listeners: D,
3729
+ setNodeRef: j,
3729
3730
  transform: O,
3730
3731
  transition: T,
3731
3732
  isDragging: P
3732
3733
  } = Ut({ id: e.id }), J = {
3733
3734
  transform: Gt.Transform.toString(O),
3734
3735
  transition: T
3735
- }, m = (A) => {
3736
- const { active: D, over: b } = A;
3737
- if (b && D.id !== b.id) {
3736
+ }, p = (A) => {
3737
+ const { active: S, over: v } = A;
3738
+ if (v && S.id !== v.id) {
3738
3739
  const x = e.conditions.findIndex(
3739
- (C) => C.id === D.id
3740
- ), z = e.conditions.findIndex(
3741
- (C) => C.id === b.id
3740
+ (C) => C.id === S.id
3741
+ ), q = e.conditions.findIndex(
3742
+ (C) => C.id === v.id
3742
3743
  );
3743
- x !== -1 && z !== -1 && i(e.id, x, z);
3744
+ x !== -1 && q !== -1 && i(e.id, x, q);
3744
3745
  }
3745
3746
  }, I = (A) => {
3746
- const { active: D, over: b } = A;
3747
- if (b && D.id !== b.id && a) {
3748
- const x = e.groups.findIndex((C) => C.id === D.id), z = e.groups.findIndex((C) => C.id === b.id);
3749
- x !== -1 && z !== -1 && r(a, x, z);
3747
+ const { active: S, over: v } = A;
3748
+ if (v && S.id !== v.id && a) {
3749
+ const x = e.groups.findIndex((C) => C.id === S.id), q = e.groups.findIndex((C) => C.id === v.id);
3750
+ x !== -1 && q !== -1 && s(a, x, q);
3750
3751
  }
3751
3752
  };
3752
3753
  return /* @__PURE__ */ l(
3753
3754
  "div",
3754
3755
  {
3755
- ref: U,
3756
+ ref: j,
3756
3757
  style: J,
3757
- className: M(
3758
+ className: z(
3758
3759
  n > 0 && "mt-2 overflow-hidden rounded-[6px] border border-border/60",
3759
3760
  P && "z-50 opacity-50"
3760
3761
  ),
@@ -3765,15 +3766,15 @@ function sr({
3765
3766
  "button",
3766
3767
  {
3767
3768
  type: "button",
3768
- ...w,
3769
- ...V,
3769
+ ..._,
3770
+ ...D,
3770
3771
  "aria-label": "Drag to reorder group",
3771
3772
  className: "flex h-7 w-5 shrink-0 cursor-grab items-center justify-center rounded-control text-muted-foreground/60 hover:text-foreground focus-visible:outline-none active:cursor-grabbing",
3772
3773
  children: /* @__PURE__ */ t(Bt, { className: "h-3.5 w-3.5" })
3773
3774
  }
3774
3775
  ),
3775
3776
  /* @__PURE__ */ t(
3776
- j,
3777
+ G,
3777
3778
  {
3778
3779
  type: "button",
3779
3780
  variant: e.negate ? "default" : "outline",
@@ -3785,7 +3786,7 @@ function sr({
3785
3786
  }
3786
3787
  ),
3787
3788
  /* @__PURE__ */ t(
3788
- ln,
3789
+ dn,
3789
3790
  {
3790
3791
  value: e.logicalOperator,
3791
3792
  onValueChange: (A) => o(e.id, A),
@@ -3795,7 +3796,7 @@ function sr({
3795
3796
  /* @__PURE__ */ t("span", { className: xt, children: "Group" })
3796
3797
  ] }),
3797
3798
  /* @__PURE__ */ t(
3798
- j,
3799
+ G,
3799
3800
  {
3800
3801
  type: "button",
3801
3802
  variant: "ghost",
@@ -3807,7 +3808,7 @@ function sr({
3807
3808
  }
3808
3809
  )
3809
3810
  ] }),
3810
- /* @__PURE__ */ l("div", { className: M(n > 0 && "p-2"), children: [
3811
+ /* @__PURE__ */ l("div", { className: z(n > 0 && "p-2"), children: [
3811
3812
  /* @__PURE__ */ t(
3812
3813
  Re,
3813
3814
  {
@@ -3818,25 +3819,25 @@ function sr({
3818
3819
  })
3819
3820
  ),
3820
3821
  collisionDetection: Ee,
3821
- onDragEnd: m,
3822
+ onDragEnd: p,
3822
3823
  children: /* @__PURE__ */ t(
3823
3824
  Me,
3824
3825
  {
3825
3826
  items: e.conditions.map((A) => A.id),
3826
3827
  strategy: ze,
3827
- children: /* @__PURE__ */ t("div", { className: "space-y-0.5", children: e.conditions.map((A, D) => /* @__PURE__ */ t(
3828
- dn,
3828
+ children: /* @__PURE__ */ t("div", { className: "space-y-0.5", children: e.conditions.map((A, S) => /* @__PURE__ */ t(
3829
+ cn,
3829
3830
  {
3830
3831
  condition: A,
3831
- index: D,
3832
+ index: S,
3832
3833
  groupId: e.id,
3833
3834
  groupLogicalOperator: e.logicalOperator,
3834
3835
  onRemoveCondition: c,
3835
3836
  onUpdateGroupOperator: o,
3836
- availableFields: k,
3837
+ availableFields: w,
3837
3838
  source: y,
3838
3839
  updateConditionFields: N,
3839
- replaceCondition: S
3840
+ replaceCondition: k
3840
3841
  },
3841
3842
  A.id
3842
3843
  )) })
@@ -3869,9 +3870,9 @@ function sr({
3869
3870
  ),
3870
3871
  e.conditions.length === 0 && e.groups.length === 0 && /* @__PURE__ */ t("p", { className: "rounded-control border border-dashed border-border/60 px-3 py-2 text-center text-[11.5px] text-muted-foreground", children: "No conditions in this group." }),
3871
3872
  /* @__PURE__ */ t(
3872
- cn,
3873
+ un,
3873
3874
  {
3874
- onAddCondition: () => p(e.id),
3875
+ onAddCondition: () => m(e.id),
3875
3876
  onAddGroup: () => f(e.id)
3876
3877
  }
3877
3878
  )
@@ -3890,72 +3891,72 @@ function Ir({
3890
3891
  onChange: c
3891
3892
  }) {
3892
3893
  const i = c !== void 0, {
3893
- currentFilters: r,
3894
- availableFields: p,
3894
+ currentFilters: s,
3895
+ availableFields: m,
3895
3896
  isLoading: f,
3896
- addCondition: k,
3897
+ addCondition: w,
3897
3898
  addGroup: y,
3898
3899
  removeCondition: h,
3899
3900
  removeGroup: N,
3900
- updateConditionFields: S,
3901
- replaceCondition: w,
3902
- updateGroupOperator: V,
3903
- updateGroupNegate: U,
3901
+ updateConditionFields: k,
3902
+ replaceCondition: _,
3903
+ updateGroupOperator: D,
3904
+ updateGroupNegate: j,
3904
3905
  reorderConditions: O,
3905
3906
  reorderGroups: T,
3906
3907
  generateSQLPreview: P,
3907
3908
  hasAnyFilters: J
3908
- } = Wa({
3909
+ } = Ka({
3909
3910
  initialFilters: e,
3910
3911
  availableFields: n,
3911
3912
  ...c ? {
3912
- onChange: (x) => c(Xa(x) ? x : null)
3913
+ onChange: (x) => c(Ja(x) ? x : null)
3913
3914
  } : {}
3914
- }), m = Ze(
3915
+ }), p = Ze(
3915
3916
  he(nt),
3916
3917
  he(tt, {
3917
3918
  coordinateGetter: et
3918
3919
  })
3919
- ), [I, A] = H(!1), D = (x, z = 0, C) => {
3920
- if (z === 0) {
3921
- const G = x.conditions.length === 0 && x.groups.length === 0;
3920
+ ), [I, A] = H(!1), S = (x, q = 0, C) => {
3921
+ if (q === 0) {
3922
+ const Z = x.conditions.length === 0 && x.groups.length === 0;
3922
3923
  return /* @__PURE__ */ l("div", { children: [
3923
3924
  /* @__PURE__ */ t(
3924
3925
  Re,
3925
3926
  {
3926
- sensors: m,
3927
+ sensors: p,
3927
3928
  collisionDetection: Ee,
3928
- onDragEnd: (_) => {
3929
- const { active: K, over: ee } = _;
3930
- if (ee && K.id !== ee.id) {
3931
- const q = x.conditions.findIndex(
3929
+ onDragEnd: (V) => {
3930
+ const { active: M, over: K } = V;
3931
+ if (K && M.id !== K.id) {
3932
+ const U = x.conditions.findIndex(
3933
+ (te) => te.id === M.id
3934
+ ), ee = x.conditions.findIndex(
3932
3935
  (te) => te.id === K.id
3933
- ), Z = x.conditions.findIndex(
3934
- (te) => te.id === ee.id
3935
3936
  );
3936
- q !== -1 && Z !== -1 && O(x.id, q, Z);
3937
+ U !== -1 && ee !== -1 && O(x.id, U, ee);
3937
3938
  }
3938
3939
  },
3939
3940
  children: /* @__PURE__ */ t(
3940
3941
  Me,
3941
3942
  {
3942
- items: x.conditions.map((_) => _.id),
3943
+ items: x.conditions.map((V) => V.id),
3943
3944
  strategy: ze,
3944
- children: /* @__PURE__ */ t("div", { className: "space-y-0.5", children: x.conditions.map((_, K) => /* @__PURE__ */ t(
3945
- dn,
3945
+ children: /* @__PURE__ */ t("div", { className: "space-y-0.5", children: x.conditions.map((V, M) => /* @__PURE__ */ t(
3946
+ cn,
3946
3947
  {
3947
- condition: _,
3948
- index: K,
3948
+ condition: V,
3949
+ index: M,
3949
3950
  groupId: x.id,
3950
3951
  groupLogicalOperator: x.logicalOperator,
3951
3952
  onRemoveCondition: h,
3952
- onUpdateGroupOperator: V,
3953
- availableFields: p,
3953
+ onUpdateGroupOperator: D,
3954
+ availableFields: m,
3954
3955
  source: a,
3955
- updateConditionFields: S,
3956
- replaceCondition: w
3956
+ updateConditionFields: k,
3957
+ replaceCondition: _
3957
3958
  },
3958
- _.id
3959
+ V.id
3959
3960
  )) })
3960
3961
  }
3961
3962
  )
@@ -3964,36 +3965,36 @@ function Ir({
3964
3965
  /* @__PURE__ */ t(
3965
3966
  Re,
3966
3967
  {
3967
- sensors: m,
3968
+ sensors: p,
3968
3969
  collisionDetection: Ee,
3969
- onDragEnd: (_) => {
3970
- const { active: K, over: ee } = _;
3971
- if (ee && K.id !== ee.id) {
3972
- const q = x.groups.findIndex(
3970
+ onDragEnd: (V) => {
3971
+ const { active: M, over: K } = V;
3972
+ if (K && M.id !== K.id) {
3973
+ const U = x.groups.findIndex(
3974
+ (te) => te.id === M.id
3975
+ ), ee = x.groups.findIndex(
3973
3976
  (te) => te.id === K.id
3974
- ), Z = x.groups.findIndex(
3975
- (te) => te.id === ee.id
3976
3977
  );
3977
- q !== -1 && Z !== -1 && T(x.id, q, Z);
3978
+ U !== -1 && ee !== -1 && T(x.id, U, ee);
3978
3979
  }
3979
3980
  },
3980
3981
  children: /* @__PURE__ */ t(
3981
3982
  Me,
3982
3983
  {
3983
- items: x.groups.map((_) => _.id),
3984
+ items: x.groups.map((V) => V.id),
3984
3985
  strategy: ze,
3985
3986
  children: x.groups.map(
3986
- (_) => D(_, z + 1, x.id)
3987
+ (V) => S(V, q + 1, x.id)
3987
3988
  )
3988
3989
  }
3989
3990
  )
3990
3991
  }
3991
3992
  ),
3992
- G && !i && /* @__PURE__ */ t("p", { className: "rounded-control border border-dashed border-border/60 px-3 py-2 text-center text-[11.5px] text-muted-foreground", children: "No filters yet. Add a condition to limit the rows this card shows." }),
3993
+ Z && !i && /* @__PURE__ */ t("p", { className: "rounded-control border border-dashed border-border/60 px-3 py-2 text-center text-[11.5px] text-muted-foreground", children: "No filters yet. Add a condition to limit the rows this card shows." }),
3993
3994
  /* @__PURE__ */ t(
3994
- cn,
3995
+ un,
3995
3996
  {
3996
- onAddCondition: () => k(x.id),
3997
+ onAddCondition: () => w(x.id),
3997
3998
  onAddGroup: (
3998
3999
  // In place, grouping is offered once there are two conditions to group,
3999
4000
  // not as a mode to switch on first.
@@ -4004,37 +4005,37 @@ function Ir({
4004
4005
  ] }, x.id);
4005
4006
  }
4006
4007
  return /* @__PURE__ */ t(
4007
- sr,
4008
+ or,
4008
4009
  {
4009
4010
  group: x,
4010
- depth: z,
4011
+ depth: q,
4011
4012
  parentGroupId: C,
4012
- onUpdateGroupOperator: V,
4013
- onUpdateGroupNegate: U,
4013
+ onUpdateGroupOperator: D,
4014
+ onUpdateGroupNegate: j,
4014
4015
  onRemoveGroup: N,
4015
4016
  onRemoveCondition: h,
4016
4017
  onReorderConditions: O,
4017
4018
  onReorderGroups: T,
4018
- onAddCondition: k,
4019
+ onAddCondition: w,
4019
4020
  onAddGroup: y,
4020
- availableFields: p,
4021
+ availableFields: m,
4021
4022
  source: a,
4022
- renderFilterGroup: D,
4023
- updateConditionFields: S,
4024
- replaceCondition: w
4023
+ renderFilterGroup: S,
4024
+ updateConditionFields: k,
4025
+ replaceCondition: _
4025
4026
  },
4026
4027
  x.id
4027
4028
  );
4028
- }, b = Qn(e);
4029
- return /* @__PURE__ */ l("div", { className: M("group/filters", i ? "flex flex-col" : "flex min-h-0 flex-1 flex-col"), "data-inline": i || void 0, children: [
4029
+ }, v = Qn(e);
4030
+ return /* @__PURE__ */ l("div", { className: z("group/filters", i ? "flex flex-col" : "flex min-h-0 flex-1 flex-col"), "data-inline": i || void 0, children: [
4030
4031
  /* @__PURE__ */ l("div", { className: i ? "" : "min-h-0 flex-1 overflow-y-auto px-3 py-3", children: [
4031
4032
  f ? /* @__PURE__ */ l("div", { className: "flex items-center justify-center gap-2 py-6 text-[12px] text-muted-foreground", children: [
4032
- /* @__PURE__ */ t(pn, { className: "h-3.5 w-3.5 animate-spin" }),
4033
+ /* @__PURE__ */ t(fn, { className: "h-3.5 w-3.5 animate-spin" }),
4033
4034
  "Loading columns…"
4034
- ] }) : D(r),
4035
+ ] }) : S(s),
4035
4036
  !i && /* @__PURE__ */ l("div", { className: "mt-3 flex items-center gap-2 border-t border-border/60 pt-3", children: [
4036
4037
  /* @__PURE__ */ t(
4037
- fn,
4038
+ hn,
4038
4039
  {
4039
4040
  size: "xs",
4040
4041
  id: "advanced-mode",
@@ -4053,13 +4054,13 @@ function Ir({
4053
4054
  /* @__PURE__ */ t("span", { className: "text-[11px] text-muted-foreground", children: "Nest conditions in groups" })
4054
4055
  ] }),
4055
4056
  J && !i && /* @__PURE__ */ l("div", { className: "mt-3 border-t border-border/60 pt-3", children: [
4056
- /* @__PURE__ */ t("div", { className: M("mb-1.5", xt), children: "Where clause" }),
4057
- /* @__PURE__ */ t("pre", { className: "overflow-x-auto whitespace-pre-wrap break-words rounded-[6px] border border-border bg-muted/40 px-3 py-2 font-mono text-[12px] leading-[1.55] text-foreground", children: P(r) })
4057
+ /* @__PURE__ */ t("div", { className: z("mb-1.5", xt), children: "Where clause" }),
4058
+ /* @__PURE__ */ t("pre", { className: "overflow-x-auto whitespace-pre-wrap break-words rounded-[6px] border border-border bg-muted/40 px-3 py-2 font-mono text-[12px] leading-[1.55] text-foreground", children: P(s) })
4058
4059
  ] })
4059
4060
  ] }),
4060
4061
  i ? null : /* @__PURE__ */ l("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border px-3 py-2.5", children: [
4061
- /* @__PURE__ */ t("div", { children: b > 0 && /* @__PURE__ */ t(
4062
- j,
4062
+ /* @__PURE__ */ t("div", { children: v > 0 && /* @__PURE__ */ t(
4063
+ G,
4063
4064
  {
4064
4065
  size: "xs",
4065
4066
  variant: "ghost",
@@ -4069,12 +4070,12 @@ function Ir({
4069
4070
  }
4070
4071
  ) }),
4071
4072
  /* @__PURE__ */ l("div", { className: "flex items-center gap-1.5", children: [
4072
- /* @__PURE__ */ t(j, { size: "xs", variant: "ghost", onClick: () => d == null ? void 0 : d(), children: "Cancel" }),
4073
+ /* @__PURE__ */ t(G, { size: "xs", variant: "ghost", onClick: () => d == null ? void 0 : d(), children: "Cancel" }),
4073
4074
  /* @__PURE__ */ t(
4074
- j,
4075
+ G,
4075
4076
  {
4076
4077
  size: "xs",
4077
- onClick: () => o == null ? void 0 : o(J ? r : null),
4078
+ onClick: () => o == null ? void 0 : o(J ? s : null),
4078
4079
  children: "Apply filters"
4079
4080
  }
4080
4081
  )
@@ -4086,15 +4087,15 @@ export {
4086
4087
  Cr as A,
4087
4088
  Sr as C,
4088
4089
  Nr as F,
4089
- Ea as I,
4090
- ba as L,
4090
+ Ma as I,
4091
+ va as L,
4091
4092
  kr as V,
4092
- va as a,
4093
+ ya as a,
4093
4094
  wr as b,
4094
4095
  Ir as c,
4095
- Jt as d,
4096
- Ma as e,
4097
- _a as g,
4098
- Zt as i,
4096
+ Zt as d,
4097
+ za as e,
4098
+ Va as g,
4099
+ en as i,
4099
4100
  Dr as u
4100
4101
  };