react-semaphor 0.1.310 → 0.1.313

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 (51) hide show
  1. package/dist/brand-studio/index.cjs +1 -1
  2. package/dist/brand-studio/index.js +4 -4
  3. package/dist/chunks/{braces-B_1DhXjs.js → braces-NfG5hX2c.js} +1 -1
  4. package/dist/chunks/{braces-BataYVhi.js → braces-raPCNcS4.js} +1 -1
  5. package/dist/chunks/{chevrons-up-down-CfMX77Ug.js → chevrons-up-down-BYzO4q5w.js} +1 -1
  6. package/dist/chunks/{chevrons-up-down-2PuJgXa0.js → chevrons-up-down-DiWloubI.js} +1 -1
  7. package/dist/chunks/dashboard-controls-DMsmUQkB.js +2043 -0
  8. package/dist/chunks/dashboard-controls-wPVXTTiH.js +57 -0
  9. package/dist/chunks/dashboard-filter-controls-launcher-CqXgWEa1.js +1540 -0
  10. package/dist/chunks/dashboard-filter-controls-launcher-DBmNn4EY.js +11 -0
  11. package/dist/chunks/{dashboard-json-A9m16zgO.js → dashboard-json-CHoCrAp0.js} +2 -2
  12. package/dist/chunks/{dashboard-json-CUYxXIbj.js → dashboard-json-DMFZLkws.js} +1 -1
  13. package/dist/chunks/{dashboard-summary-settings-dialog-BFldiulJ.js → dashboard-summary-settings-dialog-CZkn4rtm.js} +3 -3
  14. package/dist/chunks/{dashboard-summary-settings-dialog-Dl80Vf3Y.js → dashboard-summary-settings-dialog-DoxcpXjk.js} +1 -1
  15. package/dist/chunks/{edit-dashboard-visual-C013lDvS.js → edit-dashboard-visual-B0Ae_O25.js} +7914 -7747
  16. package/dist/chunks/edit-dashboard-visual-CIP9G-Bu.js +183 -0
  17. package/dist/chunks/{index-scc12bkM.js → index-D7e2Eyp_.js} +37705 -36938
  18. package/dist/chunks/index-DjZqoaV5.js +1330 -0
  19. package/dist/chunks/{palette-DIqG9FgB.js → palette-7yJYVEvk.js} +1 -1
  20. package/dist/chunks/{palette-CuxyTPBF.js → palette-CJTdBzJB.js} +1 -1
  21. package/dist/chunks/{resource-management-panel-CkS-1IEw.js → resource-management-panel-B1mhnY97.js} +1 -1
  22. package/dist/chunks/{resource-management-panel-xJtqTzS8.js → resource-management-panel-CSkNW3es.js} +3 -3
  23. package/dist/chunks/{save-CPHrveZg.js → save-B8x5Vi0W.js} +1 -1
  24. package/dist/chunks/{save-CP9_rxYk.js → save-DDX_vrED.js} +1 -1
  25. package/dist/chunks/{switch-DXHYEa_J.js → switch-DEPWsRhf.js} +3343 -3251
  26. package/dist/chunks/switch-DPaKnsb8.js +168 -0
  27. package/dist/chunks/use-create-flow-overlay-state-7LiC_vaL.js +16 -0
  28. package/dist/chunks/{use-create-flow-overlay-state-C77yBFiq.js → use-create-flow-overlay-state-BHQjJwik.js} +511 -483
  29. package/dist/chunks/{use-visual-utils-Cm2IkP1c.js → use-visual-utils-Bz7kjSrk.js} +1 -1
  30. package/dist/chunks/{use-visual-utils-BqljNzWn.js → use-visual-utils-Dw-uLgop.js} +2 -2
  31. package/dist/dashboard/index.cjs +1 -1
  32. package/dist/dashboard/index.js +1 -1
  33. package/dist/index.cjs +1 -1
  34. package/dist/index.js +76 -74
  35. package/dist/style.css +1 -1
  36. package/dist/surfboard/index.cjs +1 -1
  37. package/dist/surfboard/index.js +2 -2
  38. package/dist/types/dashboard.d.ts +6 -3
  39. package/dist/types/main.d.ts +88 -25
  40. package/dist/types/shared.d.ts +6 -3
  41. package/dist/types/surfboard.d.ts +6 -3
  42. package/dist/types/types.d.ts +6 -3
  43. package/package.json +1 -1
  44. package/dist/chunks/dashboard-controls-CZH2CHE6.js +0 -57
  45. package/dist/chunks/dashboard-controls-DKNSTyu3.js +0 -2274
  46. package/dist/chunks/dashboard-filter-controls-button-C5FGXiyJ.js +0 -1116
  47. package/dist/chunks/dashboard-filter-controls-button-CRYFNfgr.js +0 -11
  48. package/dist/chunks/edit-dashboard-visual-Bt6wP1pc.js +0 -183
  49. package/dist/chunks/index-C_mYCH5V.js +0 -1330
  50. package/dist/chunks/switch-BFPV36rd.js +0 -168
  51. package/dist/chunks/use-create-flow-overlay-state-nhcTzyJQ.js +0 -16
@@ -1,16 +1,16 @@
1
- import { c as De, n as L, u as le, z as ft, A as ht, D as bt, a as ne, F as gt, a8 as yt, B as E, e as xt, l as Ne, X as Pe, m as Ye, f as Ge, a9 as vt, aa as Ct, ab as re, ac as Ae, ad as ze, ae as fe, af as he, ag as kt, ah as Oe, ai as Nt, aj as St, ak as se, al as Dt, am as Be, G as Me, an as Xe, ao as He, ap as Je, L as Y, I as We, g as be, h as ge, i as ye, j as xe, k as ve, aq as Ze, ar as wt, as as Vt, at as Qe, au as It, av as je, aw as Tt, ax as Ce } from "./switch-DXHYEa_J.js";
2
- import { jsx as t, jsxs as d, Fragment as K } from "react/jsx-runtime";
3
- import { a$ as et, b0 as Et, b1 as qt, b2 as Ft, b3 as _t, b4 as Lt, V as At, P as zt, q as ie, b5 as tt, s as at, b6 as rt, b7 as Ot, o as Q, b8 as Bt, b9 as Mt, ba as Re, bb as Qt, bc as jt, bd as st, be as lt, bf as Rt, bg as Ut, bh as $t, bi as Kt, bj as Pt, bk as Yt, bl as Gt, bm as Xt } from "./index-scc12bkM.js";
4
- import { useMemo as z, useState as j, useRef as ke, useCallback as B, useEffect as Se, Fragment as Ht } from "react";
5
- import { u as we } from "./use-visual-utils-BqljNzWn.js";
6
- import { S as nt } from "./save-CP9_rxYk.js";
1
+ import { c as De, n as L, l as le, u as ne, z as ft, A as ht, D as bt, a as oe, F as gt, a8 as yt, B as V, e as xt, X as Ke, m as Ye, f as Ge, a9 as vt, aa as Ct, ab as re, ac as Ae, ad as ze, ae as be, af as ge, ag as kt, ah as Oe, ai as Nt, aj as St, ak as se, al as Dt, am as Me, G as Be, an as Xe, ao as He, ap as Je, L as Y, I as We, g as ye, h as xe, i as ve, j as Ce, k as ke, aq as Ze, ar as wt, as as It, at as Qe, au as Tt, av as je, aw as Et, ax as Ne } from "./switch-DEPWsRhf.js";
2
+ import { useEffect as ie, useMemo as z, useState as j, useRef as Se, useCallback as M, Fragment as Vt } from "react";
3
+ import { a$ as qt, b0 as et, b1 as _t, b2 as Ft, b3 as Lt, b4 as At, b5 as zt, V as Ot, P as Mt, q as ce, b6 as tt, s as at, b7 as rt, b8 as Bt, o as Q, b9 as Qt, ba as jt, bb as Re, bc as Rt, bd as Ut, be as st, bf as lt, bg as Pt, bh as $t, bi as Kt, bj as Yt, bk as Gt, bl as Xt, bm as Ht, bn as Jt } from "./index-D7e2Eyp_.js";
4
+ import { jsx as t, jsxs as d, Fragment as $ } from "react/jsx-runtime";
5
+ import { u as we } from "./use-visual-utils-Dw-uLgop.js";
6
+ import { S as nt } from "./save-DDX_vrED.js";
7
7
  /**
8
8
  * @license lucide-react v0.453.0 - ISC
9
9
  *
10
10
  * This source code is licensed under the ISC license.
11
11
  * See the LICENSE file in the root directory of this source tree.
12
12
  */
13
- const ca = De("CircleX", [
13
+ const ua = De("CircleX", [
14
14
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
15
15
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
16
16
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
@@ -21,7 +21,7 @@ const ca = De("CircleX", [
21
21
  * This source code is licensed under the ISC license.
22
22
  * See the LICENSE file in the root directory of this source tree.
23
23
  */
24
- const Jt = De("Library", [
24
+ const Wt = De("Library", [
25
25
  ["path", { d: "m16 6 4 14", key: "ji33uf" }],
26
26
  ["path", { d: "M12 6v14", key: "1n7gus" }],
27
27
  ["path", { d: "M8 8v12", key: "1gg7y9" }],
@@ -33,78 +33,100 @@ const Jt = De("Library", [
33
33
  * This source code is licensed under the ISC license.
34
34
  * See the LICENSE file in the root directory of this source tree.
35
35
  */
36
- const Wt = De("Link2", [
36
+ const Zt = De("Link2", [
37
37
  ["path", { d: "M9 17H7A5 5 0 0 1 7 7h2", key: "8i5ue5" }],
38
38
  ["path", { d: "M15 7h2a5 5 0 1 1 0 10h-2", key: "1b9ql8" }],
39
39
  ["line", { x1: "8", x2: "16", y1: "12", y2: "12", key: "1jonct" }]
40
40
  ]);
41
+ function pa() {
42
+ const s = L((h) => h.card.dataSource), {
43
+ setSelectedConnectionId: r,
44
+ setSelectedDatabaseName: o,
45
+ setSelectedSchemaName: i,
46
+ setSelectedTableName: p,
47
+ setSelectedDatamodelId: u
48
+ } = le();
49
+ ie(() => {
50
+ var S;
51
+ if (!s) return;
52
+ const { tableName: h, schemaName: y, databaseName: b, connectionId: v } = qt(s), g = (S = s.selectedEntities) == null ? void 0 : S[0], x = (g == null ? void 0 : g.type) === "model" && "id" in g ? g.id : "";
53
+ r(v || ""), o(b || ""), i(y || ""), p(h || ""), u(x);
54
+ }, [
55
+ s,
56
+ r,
57
+ o,
58
+ i,
59
+ p,
60
+ u
61
+ ]);
62
+ }
41
63
  function ot() {
42
- var h, C;
43
- const s = L((y) => y.card), r = L((y) => y.frame), o = z(
64
+ var b, v;
65
+ const s = L((g) => g.card), r = L((g) => g.frame), o = z(
44
66
  () => et(r, s),
45
67
  [r, s]
46
- ), { manifest: i } = Et(
47
- ((h = o == null ? void 0 : o.customCardPreferences) == null ? void 0 : h.url) || ""
48
- ), f = z(
68
+ ), { manifest: i } = _t(
69
+ ((b = o == null ? void 0 : o.customCardPreferences) == null ? void 0 : b.url) || ""
70
+ ), p = z(
49
71
  () => {
50
- var y;
51
- return (y = i == null ? void 0 : i.visuals) == null ? void 0 : y.find(
72
+ var g;
73
+ return (g = i == null ? void 0 : i.visuals) == null ? void 0 : g.find(
52
74
  (m) => {
53
- var v;
54
- return m.name === ((v = o == null ? void 0 : o.customCardPreferences) == null ? void 0 : v.componentName);
75
+ var x;
76
+ return m.name === ((x = o == null ? void 0 : o.customCardPreferences) == null ? void 0 : x.componentName);
55
77
  }
56
78
  );
57
79
  },
58
- [i, (C = o == null ? void 0 : o.customCardPreferences) == null ? void 0 : C.componentName]
59
- ), u = qt(o, f), b = z(
60
- () => Ft({
80
+ [i, (v = o == null ? void 0 : o.customCardPreferences) == null ? void 0 : v.componentName]
81
+ ), u = Ft(o, p), h = z(
82
+ () => Lt({
61
83
  frame: r,
62
84
  configCard: o,
63
85
  isMultiInputVisual: u === "multiple"
64
86
  }),
65
87
  [r, o, u]
66
- ), x = z(() => {
67
- const y = b.findIndex(
88
+ ), y = z(() => {
89
+ const g = h.findIndex(
68
90
  (m) => (m == null ? void 0 : m.id) === s.id
69
91
  );
70
- return y < 0 ? -1 : _t(s, y);
71
- }, [b, s]);
72
- return z(() => !o || u !== "multiple" || x < 0 ? s.type : Lt(
92
+ return g < 0 ? -1 : At(s, g);
93
+ }, [h, s]);
94
+ return z(() => !o || u !== "multiple" || y < 0 ? s.type : zt(
73
95
  s,
74
- x,
75
- f == null ? void 0 : f.slots
76
- ) ?? s.type, [o, u, x, s, f == null ? void 0 : f.slots]);
96
+ y,
97
+ p == null ? void 0 : p.slots
98
+ ) ?? s.type, [o, u, y, s, p == null ? void 0 : p.slots]);
77
99
  }
78
- function ua({
100
+ function ma({
79
101
  type: s,
80
102
  isLinked: r,
81
103
  className: o,
82
104
  showLabel: i = !1,
83
- showLocal: f = !1
105
+ showLocal: p = !1
84
106
  }) {
85
- const u = le((N) => N.selectedFrameId), b = At((N) => N.selectedVisual), x = L((N) => N.frame);
86
- let h;
107
+ const u = ne((D) => D.selectedFrameId), h = Ot((D) => D.selectedVisual), y = L((D) => D.frame);
108
+ let b;
87
109
  if (s)
88
- h = s;
110
+ b = s;
89
111
  else if (r !== void 0)
90
- h = r ? "linked" : "library";
91
- else if (!!!(x != null && x.visualId || b != null && b.id) && u)
92
- h = "local";
93
- else if (b && !u)
94
- h = "library";
95
- else if (x != null && x.visualId && u)
96
- h = "linked";
97
- else if (b != null && b.id && u)
98
- h = "library";
112
+ b = r ? "linked" : "library";
113
+ else if (!!!(y != null && y.visualId || h != null && h.id) && u)
114
+ b = "local";
115
+ else if (h && !u)
116
+ b = "library";
117
+ else if (y != null && y.visualId && u)
118
+ b = "linked";
119
+ else if (h != null && h.id && u)
120
+ b = "library";
99
121
  else
100
122
  return null;
101
- if (h === "local" && !f)
123
+ if (b === "local" && !p)
102
124
  return null;
103
- const C = {
125
+ const v = {
104
126
  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",
105
127
  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",
106
128
  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"
107
- }, y = {
129
+ }, g = {
108
130
  local: "Local to this dashboard: Changes made here only affect this dashboard copy.",
109
131
  linked: "Linked to library: Changes made here update the library visual and all linked instances.",
110
132
  library: "Library visual: Share and reuse this visual across multiple dashboards."
@@ -112,32 +134,32 @@ function ua({
112
134
  local: "border-slate-200 bg-slate-50 text-slate-900 dark:border-slate-700 dark:bg-slate-900 dark:text-slate-100",
113
135
  linked: "border-purple-200 bg-purple-50 text-purple-900 dark:border-purple-800 dark:bg-purple-950 dark:text-purple-100",
114
136
  library: "border-blue-200 bg-blue-50 text-blue-900 dark:border-blue-800 dark:bg-blue-950 dark:text-blue-100"
115
- }, v = {
137
+ }, x = {
116
138
  local: "fill-slate-50 dark:fill-slate-900",
117
139
  linked: "fill-purple-50 dark:fill-purple-950",
118
140
  library: "fill-blue-50 dark:fill-blue-950"
119
- }, I = {
141
+ }, S = {
120
142
  local: /* @__PURE__ */ t("span", { className: "h-2 w-2 rounded-full bg-current/70" }),
121
- linked: /* @__PURE__ */ t(Wt, { className: "h-3.5 w-3.5" }),
122
- library: /* @__PURE__ */ t(Jt, { className: "h-3.5 w-3.5" })
123
- }, k = {
143
+ linked: /* @__PURE__ */ t(Zt, { className: "h-3.5 w-3.5" }),
144
+ library: /* @__PURE__ */ t(Wt, { className: "h-3.5 w-3.5" })
145
+ }, N = {
124
146
  local: "Local",
125
147
  linked: "Linked",
126
148
  library: "Library"
127
149
  };
128
150
  return /* @__PURE__ */ t(ft, { children: /* @__PURE__ */ d(ht, { delayDuration: 300, children: [
129
151
  /* @__PURE__ */ t(bt, { asChild: !0, children: /* @__PURE__ */ d(
130
- zt,
152
+ Mt,
131
153
  {
132
154
  variant: "outline",
133
- className: ne(
155
+ className: oe(
134
156
  "cursor-help select-none transition-all",
135
- C[h],
157
+ v[b],
136
158
  o
137
159
  ),
138
160
  children: [
139
- I[h],
140
- i && /* @__PURE__ */ t("span", { className: "ml-1 text-xs font-medium leading-none", children: k[h] })
161
+ S[b],
162
+ i && /* @__PURE__ */ t("span", { className: "ml-1 text-xs font-medium leading-none", children: N[b] })
141
163
  ]
142
164
  }
143
165
  ) }),
@@ -145,16 +167,16 @@ function ua({
145
167
  gt,
146
168
  {
147
169
  side: "bottom",
148
- className: ne("max-w-xs", m[h]),
170
+ className: oe("max-w-xs", m[b]),
149
171
  children: [
150
- /* @__PURE__ */ t(yt, { className: v[h] }),
151
- /* @__PURE__ */ t("p", { children: y[h] })
172
+ /* @__PURE__ */ t(yt, { className: x[b] }),
173
+ /* @__PURE__ */ t("p", { children: g[b] })
152
174
  ]
153
175
  }
154
176
  )
155
177
  ] }) });
156
178
  }
157
- function Zt(s, r) {
179
+ function ea(s, r) {
158
180
  return {
159
181
  ...s,
160
182
  sql: "",
@@ -170,23 +192,23 @@ function Zt(s, r) {
170
192
  type: r ? s.type : "bar"
171
193
  };
172
194
  }
173
- function Ve(s) {
195
+ function Ie(s) {
174
196
  const r = vt(s);
175
197
  return r ? (Q.error(r), !1) : !0;
176
198
  }
177
- function pa({
199
+ function fa({
178
200
  className: s,
179
201
  variant: r = "outline"
180
202
  }) {
181
203
  const o = L((u) => u.onSave), { getUpdatedFrame: i } = we();
182
- function f() {
204
+ function p() {
183
205
  const u = i();
184
- Ve(u) && (o == null || o(u));
206
+ Ie(u) && (o == null || o(u));
185
207
  }
186
208
  return /* @__PURE__ */ d(
187
- E,
209
+ V,
188
210
  {
189
- onClick: f,
211
+ onClick: p,
190
212
  className: s,
191
213
  size: "xs",
192
214
  variant: r,
@@ -197,41 +219,41 @@ function pa({
197
219
  }
198
220
  );
199
221
  }
200
- function ma({
222
+ function ha({
201
223
  className: s,
202
224
  variant: r = "default"
203
225
  }) {
204
- const o = ie(), [i, f] = j(!1), u = le(
205
- (v) => v.actions.setIsDashboardPanelOpen
206
- ), { setIsVisualEditing: b } = Ye(), { getUpdatedFrame: x } = we(), h = at(), C = L((v) => v.frame), y = rt();
226
+ const o = ce(), [i, p] = j(!1), u = ne(
227
+ (x) => x.actions.setIsDashboardPanelOpen
228
+ ), { setIsVisualEditing: h } = Ye(), { getUpdatedFrame: y } = we(), b = at(), v = L((x) => x.frame), g = rt();
207
229
  return /* @__PURE__ */ t(
208
- E,
230
+ V,
209
231
  {
210
232
  onClick: () => {
211
- const v = x();
212
- if (!Ve(v))
233
+ const x = y();
234
+ if (!Ie(x))
213
235
  return;
214
- const I = (C == null ? void 0 : C.visualId) || (h == null ? void 0 : h.id);
215
- if (!I) {
236
+ const S = (v == null ? void 0 : v.visualId) || (b == null ? void 0 : b.id);
237
+ if (!S) {
216
238
  Q.error("No visual to save");
217
239
  return;
218
240
  }
219
- f(!0), y.mutate(
241
+ p(!0), g.mutate(
220
242
  {
221
- visualId: I,
243
+ visualId: S,
222
244
  data: {
223
- frameObject: v
245
+ frameObject: x
224
246
  }
225
247
  },
226
248
  {
227
249
  onSuccess: () => {
228
- f(!1), u(!0), Q.success("Visual updated successfully"), o.invalidateQueries({
229
- queryKey: ["resource-by-id", "visual", I],
250
+ p(!1), u(!0), Q.success("Visual updated successfully"), o.invalidateQueries({
251
+ queryKey: ["resource-by-id", "visual", S],
230
252
  exact: !0
231
253
  });
232
254
  },
233
255
  onError: () => {
234
- f(!1), Q.error("Failed to update visual");
256
+ p(!1), Q.error("Failed to update visual");
235
257
  }
236
258
  }
237
259
  );
@@ -239,60 +261,60 @@ function ma({
239
261
  className: s,
240
262
  size: "xs",
241
263
  variant: r,
242
- children: i ? /* @__PURE__ */ d(K, { children: [
264
+ children: i ? /* @__PURE__ */ d($, { children: [
243
265
  /* @__PURE__ */ t(Ge, { className: "h-3.5 w-3.5 animate-spin" }),
244
266
  "Saving"
245
- ] }) : /* @__PURE__ */ d(K, { children: [
267
+ ] }) : /* @__PURE__ */ d($, { children: [
246
268
  /* @__PURE__ */ t(nt, { className: "h-3.5 w-3.5" }),
247
269
  "Save to Library"
248
270
  ] })
249
271
  }
250
272
  );
251
273
  }
252
- function fa({
274
+ function ba({
253
275
  className: s
254
276
  }) {
255
- const r = ie(), [o, i] = j(!1), f = at(), u = L((k) => k.frame), b = le((k) => k.selectedSheetId), x = le((k) => k.dashboard), { updateFrame: h, setIsVisualEditing: C } = Ye(), { getUpdatedFrame: y } = we(), m = rt(), v = Ot();
277
+ const r = ce(), [o, i] = j(!1), p = at(), u = L((N) => N.frame), h = ne((N) => N.selectedSheetId), y = ne((N) => N.dashboard), { updateFrame: b, setIsVisualEditing: v } = Ye(), { getUpdatedFrame: g } = we(), m = rt(), x = Bt();
256
278
  return /* @__PURE__ */ t(
257
- E,
279
+ V,
258
280
  {
259
281
  onClick: async () => {
260
- if (!b) {
282
+ if (!h) {
261
283
  Q.error("No sheet selected");
262
284
  return;
263
285
  }
264
- const k = (u == null ? void 0 : u.visualId) || (f == null ? void 0 : f.id);
265
- if (!k) {
286
+ const N = (u == null ? void 0 : u.visualId) || (p == null ? void 0 : p.id);
287
+ if (!N) {
266
288
  Q.error("No visual to update");
267
289
  return;
268
290
  }
269
291
  i(!0);
270
292
  try {
271
- const N = y();
272
- if (!Ve(N)) {
293
+ const D = g();
294
+ if (!Ie(D)) {
273
295
  i(!1);
274
296
  return;
275
297
  }
276
- const F = {
277
- ...N,
278
- visualId: k
298
+ const _ = {
299
+ ...D,
300
+ visualId: N
279
301
  // Keep the link to library visual
280
- }, G = Bt(x, F.id), X = await v(F, {
302
+ }, G = Qt(y, _.id), X = await x(_, {
281
303
  previousFrame: G
282
304
  });
283
305
  await m.mutateAsync({
284
- visualId: k,
306
+ visualId: N,
285
307
  data: {
286
- frameObject: N
308
+ frameObject: D
287
309
  }
288
- }), h(b, F, {
310
+ }), b(h, _, {
289
311
  semanticExecutionPayload: X
290
- }), r.invalidateQueries({ queryKey: ["visuals"] }), r.invalidateQueries({ queryKey: ["visual", k] }), Q.success("Saved to library and applied locally"), setTimeout(() => {
291
- C(!1);
312
+ }), r.invalidateQueries({ queryKey: ["visuals"] }), r.invalidateQueries({ queryKey: ["visual", N] }), Q.success("Saved to library and applied locally"), setTimeout(() => {
313
+ v(!1);
292
314
  }, 300);
293
- } catch (N) {
294
- console.error("Failed to save and apply:", N), Q.error(
295
- N instanceof Error ? N.message : "Failed to save and apply changes"
315
+ } catch (D) {
316
+ console.error("Failed to save and apply:", D), Q.error(
317
+ D instanceof Error ? D.message : "Failed to save and apply changes"
296
318
  );
297
319
  } finally {
298
320
  i(!1);
@@ -302,81 +324,81 @@ function fa({
302
324
  size: "xs",
303
325
  variant: "default",
304
326
  disabled: o,
305
- children: o ? /* @__PURE__ */ d(K, { children: [
327
+ children: o ? /* @__PURE__ */ d($, { children: [
306
328
  /* @__PURE__ */ t(Ge, { className: "h-3.5 w-3.5 animate-spin" }),
307
329
  "Saving..."
308
- ] }) : /* @__PURE__ */ d(K, { children: [
330
+ ] }) : /* @__PURE__ */ d($, { children: [
309
331
  /* @__PURE__ */ t(nt, { className: "h-3.5 w-3.5" }),
310
332
  "Save & Apply"
311
333
  ] })
312
334
  }
313
335
  );
314
336
  }
315
- function ha({ className: s }) {
316
- const { setTempQueryData: r, setSqlGen: o } = Ne(), i = ie(), f = L((m) => m.tempQueryData), u = L((m) => m.onClose), b = L((m) => m.card), x = ot(), h = z(() => x !== b.type ? { ...b, type: x } : b, [b, x]), { queryKey: C } = tt(h);
317
- function y() {
318
- if (f) {
319
- const { queryKey: m, queryData: v } = f;
320
- m && v && i.setQueryData(m, v);
337
+ function ga({ className: s }) {
338
+ const { setTempQueryData: r, setSqlGen: o } = le(), i = ce(), p = L((m) => m.tempQueryData), u = L((m) => m.onClose), h = L((m) => m.card), y = ot(), b = z(() => y !== h.type ? { ...h, type: y } : h, [h, y]), { queryKey: v } = tt(b);
339
+ function g() {
340
+ if (p) {
341
+ const { queryKey: m, queryData: x } = p;
342
+ m && x && i.setQueryData(m, x);
321
343
  }
322
344
  o({}), u == null || u();
323
345
  }
324
346
  return /* @__PURE__ */ d(
325
- E,
347
+ V,
326
348
  {
327
- onClick: y,
349
+ onClick: g,
328
350
  className: s,
329
351
  size: "xs",
330
352
  variant: "outline",
331
353
  children: [
332
- /* @__PURE__ */ t(Pe, { className: "h-3.5 w-3.5" }),
354
+ /* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5" }),
333
355
  "Close"
334
356
  ]
335
357
  }
336
358
  );
337
359
  }
338
- function ba({
360
+ function ya({
339
361
  label: s = "Clear",
340
362
  variant: r = "secondary",
341
363
  className: o
342
364
  } = {}) {
343
- const { setTempQueryData: i } = Ne(), f = ie(), u = L((O) => O.tempQueryData), b = L((O) => O.card), x = ot(), h = z(() => x !== b.type ? { ...b, type: x } : b, [b, x]), { queryKey: C } = tt(h), {
344
- setCardSql: y,
365
+ const { setTempQueryData: i } = le(), p = ce(), u = L((O) => O.tempQueryData), h = L((O) => O.card), y = ot(), b = z(() => y !== h.type ? { ...h, type: y } : h, [h, y]), { queryKey: v } = tt(b), {
366
+ setCardSql: g,
345
367
  setSqlGen: m,
346
- setCardPython: v,
347
- setCardCustomCfg: I,
348
- setCardPreferences: k,
349
- clearQueryConfig: N,
350
- setCardConfig: F,
368
+ setCardPython: x,
369
+ setCardCustomCfg: S,
370
+ setCardPreferences: N,
371
+ clearQueryConfig: D,
372
+ setCardConfig: _,
351
373
  setCardType: G,
352
374
  setFrame: X,
353
375
  setCard: te,
354
376
  setActiveTabCardId: H
355
- } = Ne();
356
- function de() {
377
+ } = le();
378
+ function ue() {
357
379
  var J, ae, q, W;
358
- const O = f.getQueryData(C);
380
+ const O = p.getQueryData(v);
359
381
  u != null && u.queryData || i({
360
- queryKey: C,
382
+ queryKey: v,
361
383
  queryData: O
362
- }), f.setQueryData(C, null), f.removeQueries({ queryKey: C, exact: !0 }), y(""), m({}), N(), F(void 0), v(""), I(""), k({});
363
- const a = L.getState().frame, V = L.getState().card, T = et(a, V), M = ((J = T == null ? void 0 : T.customCardPreferences) == null ? void 0 : J.visualType) === "multiple" || !!((ae = T == null ? void 0 : T.customCardPreferences) != null && ae.dataInputCardIds) || (((q = T == null ? void 0 : T.customCardPreferences) == null ? void 0 : q.minInputs) || 0) > 1 || (((W = T == null ? void 0 : T.customCardPreferences) == null ? void 0 : W.maxInputs) || 0) > 1, R = Zt(V, M);
384
+ }), p.setQueryData(v, null), p.removeQueries({ queryKey: v, exact: !0 }), g(""), m({}), D(), _(void 0), x(""), S(""), N({});
385
+ const a = L.getState().frame, T = L.getState().card, E = et(a, T), B = ((J = E == null ? void 0 : E.customCardPreferences) == null ? void 0 : J.visualType) === "multiple" || !!((ae = E == null ? void 0 : E.customCardPreferences) != null && ae.dataInputCardIds) || (((q = E == null ? void 0 : E.customCardPreferences) == null ? void 0 : q.minInputs) || 0) > 1 || (((W = E == null ? void 0 : E.customCardPreferences) == null ? void 0 : W.maxInputs) || 0) > 1, R = ea(T, B);
364
386
  X({
365
387
  ...a,
366
388
  cards: a.cards.map(
367
389
  (U) => U.id === R.id ? R : U
368
390
  )
369
- }), H(R.id), te(R), M || G("bar");
391
+ }), H(R.id), te(R), B || G("bar");
370
392
  }
371
393
  return /* @__PURE__ */ d(
372
- E,
394
+ V,
373
395
  {
374
- onClick: de,
396
+ onClick: ue,
375
397
  className: o,
376
398
  size: "xs",
377
399
  variant: r,
378
400
  children: [
379
- /* @__PURE__ */ t(Pe, { className: "h-3.5 w-3.5" }),
401
+ /* @__PURE__ */ t(Ke, { className: "h-3.5 w-3.5" }),
380
402
  s
381
403
  ]
382
404
  }
@@ -397,18 +419,18 @@ function it(s) {
397
419
  )
398
420
  ] });
399
421
  }
400
- function ea(s) {
422
+ function ta(s) {
401
423
  const { currentStep: r, labels: o } = s;
402
- 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: o.map((i, f) => {
403
- const u = f + 1, b = u === r, x = u < r;
404
- return /* @__PURE__ */ d(Ht, { children: [
424
+ 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: o.map((i, p) => {
425
+ const u = p + 1, h = u === r, y = u < r;
426
+ return /* @__PURE__ */ d(Vt, { children: [
405
427
  /* @__PURE__ */ d("div", { className: "flex items-center gap-1.5", children: [
406
428
  /* @__PURE__ */ t(
407
429
  "span",
408
430
  {
409
- className: ne(
431
+ className: oe(
410
432
  "flex h-5 w-5 items-center justify-center rounded-full border text-[10px] font-medium tabular-nums",
411
- b ? "border-foreground bg-foreground text-background" : x ? "border-foreground/30 bg-foreground/10 text-foreground" : "border-border/60 bg-background text-muted-foreground"
433
+ h ? "border-foreground bg-foreground text-background" : y ? "border-foreground/30 bg-foreground/10 text-foreground" : "border-border/60 bg-background text-muted-foreground"
412
434
  ),
413
435
  children: u
414
436
  }
@@ -416,15 +438,15 @@ function ea(s) {
416
438
  /* @__PURE__ */ t(
417
439
  "span",
418
440
  {
419
- className: ne(
441
+ className: oe(
420
442
  "text-[12px]",
421
- b ? "font-medium text-foreground" : "text-muted-foreground"
443
+ h ? "font-medium text-foreground" : "text-muted-foreground"
422
444
  ),
423
445
  children: i
424
446
  }
425
447
  )
426
448
  ] }),
427
- f < o.length - 1 ? /* @__PURE__ */ t(
449
+ p < o.length - 1 ? /* @__PURE__ */ t(
428
450
  "span",
429
451
  {
430
452
  className: "h-px w-4 bg-border/60 sm:w-6",
@@ -434,7 +456,7 @@ function ea(s) {
434
456
  ] }, i);
435
457
  }) }) });
436
458
  }
437
- function oe(s) {
459
+ function de(s) {
438
460
  const { secondary: r, tertiary: o, primary: i } = s;
439
461
  return /* @__PURE__ */ d("div", { className: "sticky bottom-0 z-10 -mx-1 flex justify-end gap-2 border-t bg-background/95 px-1 pb-1 pt-3 backdrop-blur supports-[backdrop-filter]:bg-background/85", children: [
440
462
  r,
@@ -442,10 +464,10 @@ function oe(s) {
442
464
  i
443
465
  ] });
444
466
  }
445
- function ta(s) {
467
+ function aa(s) {
446
468
  const { control: r, scope: o, detail: i } = s;
447
469
  return /* @__PURE__ */ d("div", { className: "flex items-start gap-2.5 rounded-control border border-border/60 bg-muted/30 px-3 py-2.5", children: [
448
- /* @__PURE__ */ t(Xt, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-foreground" }),
470
+ /* @__PURE__ */ t(Jt, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-foreground" }),
449
471
  /* @__PURE__ */ d("div", { className: "min-w-0 space-y-0.5", children: [
450
472
  /* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: r.label }),
451
473
  /* @__PURE__ */ d("div", { className: "text-[12px] text-muted-foreground", children: [
@@ -466,28 +488,28 @@ function Ue(s) {
466
488
  control: r,
467
489
  defaultValue: o,
468
490
  availableFieldChoices: i,
469
- availableMetricChoices: f,
491
+ availableMetricChoices: p,
470
492
  previewControlDefinitions: u,
471
- previewControlValues: b,
472
- onControlChange: x,
473
- onLabelChange: h,
474
- onDefaultValueChange: C,
475
- onBack: y,
493
+ previewControlValues: h,
494
+ onControlChange: y,
495
+ onLabelChange: b,
496
+ onDefaultValueChange: v,
497
+ onBack: g,
476
498
  onNext: m,
477
- nextDisabled: v
499
+ nextDisabled: x
478
500
  } = s;
479
501
  return /* @__PURE__ */ d("div", { className: "space-y-3", children: [
480
- /* @__PURE__ */ t(it, { control: r, onChange: h }),
502
+ /* @__PURE__ */ t(it, { control: r, onChange: b }),
481
503
  /* @__PURE__ */ t(
482
504
  st,
483
505
  {
484
506
  control: r,
485
507
  availableFieldChoices: i,
486
- availableMetricChoices: f,
508
+ availableMetricChoices: p,
487
509
  previewControlDefinitions: u,
488
- previewControlValues: b,
510
+ previewControlValues: h,
489
511
  controlLifecycle: "create",
490
- onChange: x
512
+ onChange: y
491
513
  }
492
514
  ),
493
515
  /* @__PURE__ */ t(
@@ -495,25 +517,25 @@ function Ue(s) {
495
517
  {
496
518
  control: r,
497
519
  value: o,
498
- onChange: C,
520
+ onChange: v,
499
521
  allowNoDefault: !0,
500
522
  allowCardDefault: !0,
501
523
  hint: "This is the value viewers will see first.",
502
524
  previewControlDefinitions: u,
503
- previewControlValues: b
525
+ previewControlValues: h
504
526
  }
505
527
  ),
506
528
  /* @__PURE__ */ t(
507
- oe,
529
+ de,
508
530
  {
509
- secondary: /* @__PURE__ */ t(E, { type: "button", variant: "outline", size: "xs", onClick: y, children: "Back" }),
531
+ secondary: /* @__PURE__ */ t(V, { type: "button", variant: "outline", size: "xs", onClick: g, children: "Back" }),
510
532
  primary: /* @__PURE__ */ t(
511
- E,
533
+ V,
512
534
  {
513
535
  type: "button",
514
536
  size: "xs",
515
537
  onClick: m,
516
- disabled: v,
538
+ disabled: x,
517
539
  children: "Next"
518
540
  }
519
541
  )
@@ -521,14 +543,14 @@ function Ue(s) {
521
543
  )
522
544
  ] });
523
545
  }
524
- const aa = /* @__PURE__ */ new Set([
546
+ const ra = /* @__PURE__ */ new Set([
525
547
  "grain_selector",
526
548
  "aggregation_selector",
527
549
  "field_selector",
528
550
  "metric_selector"
529
551
  ]);
530
- function $e(s) {
531
- const { text: r, ariaLabel: o } = s, [i, f] = j(!1);
552
+ function Pe(s) {
553
+ const { text: r, ariaLabel: o } = s, [i, p] = j(!1);
532
554
  return /* @__PURE__ */ d(
533
555
  "button",
534
556
  {
@@ -536,7 +558,7 @@ function $e(s) {
536
558
  "aria-label": o,
537
559
  onClick: async () => {
538
560
  try {
539
- await navigator.clipboard.writeText(r), f(!0), setTimeout(() => f(!1), 1200);
561
+ await navigator.clipboard.writeText(r), p(!0), setTimeout(() => p(!1), 1200);
540
562
  } catch (u) {
541
563
  console.error("Failed to copy", u);
542
564
  }
@@ -549,47 +571,47 @@ function $e(s) {
549
571
  }
550
572
  );
551
573
  }
552
- function Ke(s) {
574
+ function $e(s) {
553
575
  const {
554
576
  control: r,
555
577
  scope: o,
556
578
  createdReference: i,
557
- explorerContent: f,
579
+ explorerContent: p,
558
580
  sqlDescription: u,
559
- summaryDetail: b,
560
- onBack: x,
561
- onCancel: h,
562
- onDone: C
563
- } = s, y = aa.has(r.type), m = i.match(/\[\[param\.(.+?)\]\]/), v = m ? `{{ param('${m[1]}') }}` : "";
581
+ summaryDetail: h,
582
+ onBack: y,
583
+ onCancel: b,
584
+ onDone: v
585
+ } = s, g = ra.has(r.type), m = i.match(/\[\[param\.(.+?)\]\]/), x = m ? `{{ param('${m[1]}') }}` : "";
564
586
  return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
565
587
  /* @__PURE__ */ t(
566
- ta,
588
+ aa,
567
589
  {
568
590
  control: r,
569
591
  scope: o,
570
- detail: b
592
+ detail: h
571
593
  }
572
594
  ),
573
595
  /* @__PURE__ */ d("div", { className: "space-y-2", children: [
574
596
  /* @__PURE__ */ t("p", { className: "text-[13px] font-medium text-foreground", children: "How cards use this control" }),
575
597
  /* @__PURE__ */ d("div", { className: "divide-y divide-border/60 overflow-hidden rounded-control border border-border/60", children: [
576
- y ? /* @__PURE__ */ d("div", { className: "space-y-1 px-3 py-2.5", children: [
598
+ g ? /* @__PURE__ */ d("div", { className: "space-y-1 px-3 py-2.5", children: [
577
599
  /* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Explorer cards" }),
578
- /* @__PURE__ */ t("div", { className: "text-[12px] text-muted-foreground", children: f })
600
+ /* @__PURE__ */ t("div", { className: "text-[12px] text-muted-foreground", children: p })
579
601
  ] }) : null,
580
602
  /* @__PURE__ */ d("div", { className: "space-y-1.5 px-3 py-2.5", children: [
581
603
  /* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "SQL cards" }),
582
604
  /* @__PURE__ */ t(
583
- $e,
605
+ Pe,
584
606
  {
585
607
  text: i,
586
608
  ariaLabel: "Copy SQL control reference"
587
609
  }
588
610
  ),
589
- v ? /* @__PURE__ */ t(
590
- $e,
611
+ x ? /* @__PURE__ */ t(
612
+ Pe,
591
613
  {
592
- text: v,
614
+ text: x,
593
615
  ariaLabel: "Copy Jinja control reference"
594
616
  }
595
617
  ) : null,
@@ -612,35 +634,35 @@ function Ke(s) {
612
634
  ] })
613
635
  ] }),
614
636
  /* @__PURE__ */ t(
615
- oe,
637
+ de,
616
638
  {
617
- secondary: /* @__PURE__ */ t(E, { type: "button", variant: "outline", size: "xs", onClick: x, children: "Back" }),
618
- tertiary: /* @__PURE__ */ t(E, { type: "button", variant: "outline", size: "xs", onClick: h, children: "Cancel" }),
619
- primary: /* @__PURE__ */ t(E, { type: "button", size: "xs", onClick: C, children: "Done" })
639
+ secondary: /* @__PURE__ */ t(V, { type: "button", variant: "outline", size: "xs", onClick: y, children: "Back" }),
640
+ tertiary: /* @__PURE__ */ t(V, { type: "button", variant: "outline", size: "xs", onClick: b, children: "Cancel" }),
641
+ primary: /* @__PURE__ */ t(V, { type: "button", size: "xs", onClick: v, children: "Done" })
620
642
  }
621
643
  )
622
644
  ] });
623
645
  }
624
- function ra(s) {
646
+ function sa(s) {
625
647
  const r = re(
626
648
  s.scope,
627
649
  s.existingControls,
628
650
  s.reservedIds
629
651
  ), o = s.type === r.type ? {
630
652
  ...r,
631
- label: Ce[s.type]
653
+ label: Ne[s.type]
632
654
  } : {
633
655
  ...Ze({
634
656
  controls: [
635
657
  {
636
658
  ...r,
637
- label: Ce[s.type]
659
+ label: Ne[s.type]
638
660
  }
639
661
  ],
640
662
  controlId: r.id,
641
663
  nextType: s.type
642
664
  }).controls[0],
643
- label: Ce[s.type]
665
+ label: Ne[s.type]
644
666
  };
645
667
  return {
646
668
  step: 2,
@@ -648,78 +670,78 @@ function ra(s) {
648
670
  defaultValue: se(o, void 0)
649
671
  };
650
672
  }
651
- function ga({
673
+ function xa({
652
674
  scope: s,
653
675
  controls: r,
654
676
  reservedControlIds: o,
655
677
  defaultValues: i,
656
- onChange: f,
678
+ onChange: p,
657
679
  emptyMessage: u,
658
- initialCreateFlow: b = !1,
659
- usageByControlId: x,
660
- availableFieldChoices: h,
661
- availableMetricChoices: C,
662
- structuralParticipants: y,
680
+ initialCreateFlow: h = !1,
681
+ usageByControlId: y,
682
+ availableFieldChoices: b,
683
+ availableMetricChoices: v,
684
+ structuralParticipants: g,
663
685
  structuralParticipantIdsByControlId: m,
664
- card: v,
665
- allowedControlTypes: I,
666
- onCreateFlowActiveChange: k,
667
- onCreateFlowComplete: N
686
+ card: x,
687
+ allowedControlTypes: S,
688
+ onCreateFlowActiveChange: N,
689
+ onCreateFlowComplete: D
668
690
  }) {
669
- const F = z(
691
+ const _ = z(
670
692
  () => new Set(o || []),
671
693
  [o]
672
694
  ), G = wt(s), X = Ct(s), [te, H] = j(
673
695
  null
674
- ), [de, O] = j(
696
+ ), [ue, O] = j(
675
697
  null
676
- ), [a, V] = j(
677
- () => b ? {
698
+ ), [a, T] = j(
699
+ () => h ? {
678
700
  step: 1,
679
- control: re(s, r, Array.from(F))
701
+ control: re(s, r, Array.from(_))
680
702
  } : null
681
- ), T = ke({}), M = ke(void 0), R = ke(b), J = z(() => {
682
- const e = Ae({ scope: s, card: v });
683
- if (!I)
703
+ ), E = Se({}), B = Se(void 0), R = Se(h), J = z(() => {
704
+ const e = Ae({ scope: s, card: x });
705
+ if (!S)
684
706
  return e;
685
- const n = new Set(I);
707
+ const n = new Set(S);
686
708
  return e.filter((l) => n.has(l.value));
687
- }, [I, v, s]), ae = B(
709
+ }, [S, x, s]), ae = M(
688
710
  (e) => {
689
711
  const n = Ae({
690
712
  scope: s,
691
- card: v,
692
- includeType: I ? void 0 : e
713
+ card: x,
714
+ includeType: S ? void 0 : e
693
715
  });
694
- if (!I)
716
+ if (!S)
695
717
  return n;
696
- const l = new Set(I);
718
+ const l = new Set(S);
697
719
  return n.filter((c) => l.has(c.value));
698
720
  },
699
- [I, v, s]
700
- ), q = B(
721
+ [S, x, s]
722
+ ), q = M(
701
723
  (e) => s === "dashboard" && (e === "field_selector" || e === "metric_selector"),
702
724
  [s]
703
725
  ), W = z(
704
726
  () => a ? ze(
705
- y || [],
727
+ g || [],
706
728
  a.control.type
707
729
  ) : [],
708
- [a, y]
730
+ [a, g]
709
731
  ), U = z(() => {
710
732
  if (!a)
711
733
  return {
712
- fields: h || [],
713
- metrics: C || []
734
+ fields: b || [],
735
+ metrics: v || []
714
736
  };
715
737
  if (!q(a.control.type))
716
738
  return {
717
- fields: h || [],
718
- metrics: C || []
739
+ fields: b || [],
740
+ metrics: v || []
719
741
  };
720
- const e = a.selectedCardIds || [], n = fe({
742
+ const e = a.selectedCardIds || [], n = be({
721
743
  controlType: a.control.type,
722
- participants: y || [],
744
+ participants: g || [],
723
745
  selectedCardIds: e
724
746
  });
725
747
  return {
@@ -733,36 +755,36 @@ function ga({
733
755
  })) : []
734
756
  };
735
757
  }, [
736
- h,
737
- C,
758
+ b,
759
+ v,
738
760
  a,
739
761
  q,
740
- y
762
+ g
741
763
  ]);
742
- Se(() => {
743
- k == null || k(!!a);
744
- }, [a, k]), Se(() => {
745
- const e = b && !R.current;
746
- R.current = b, e && (V({
764
+ ie(() => {
765
+ N == null || N(!!a);
766
+ }, [a, N]), ie(() => {
767
+ const e = h && !R.current;
768
+ R.current = h, e && (T({
747
769
  step: 1,
748
- control: re(s, r, Array.from(F))
770
+ control: re(s, r, Array.from(_))
749
771
  }), O(null), H(null));
750
- }, [r, b, F, s]);
772
+ }, [r, h, _, s]);
751
773
  const dt = (e) => {
752
774
  if (!q(e.type))
753
775
  return {
754
- fields: h || [],
755
- metrics: C || []
776
+ fields: b || [],
777
+ metrics: v || []
756
778
  };
757
779
  const n = (m == null ? void 0 : m[e.id]) || [];
758
780
  if (n.length === 0)
759
781
  return {
760
- fields: h || [],
761
- metrics: C || []
782
+ fields: b || [],
783
+ metrics: v || []
762
784
  };
763
- const l = fe({
785
+ const l = be({
764
786
  controlType: e.type,
765
- participants: y || [],
787
+ participants: g || [],
766
788
  selectedCardIds: n
767
789
  });
768
790
  return {
@@ -775,101 +797,101 @@ function ga({
775
797
  target: l.metricTargetMap[c.value]
776
798
  })) : []
777
799
  };
778
- }, Ie = (e) => {
800
+ }, Te = (e) => {
779
801
  if (!q(e.control.type))
780
802
  return {
781
803
  nextControl: e.control,
782
804
  cardBindingsById: void 0
783
805
  };
784
- const n = (m == null ? void 0 : m[e.control.id]) || [], l = fe({
806
+ const n = (m == null ? void 0 : m[e.control.id]) || [], l = be({
785
807
  controlType: e.control.type,
786
- participants: y || [],
808
+ participants: g || [],
787
809
  selectedCardIds: e.nextSelectedCardIds
788
- }), c = Tt({
810
+ }), c = Et({
789
811
  control: e.control,
790
812
  choices: l.choices
791
- }), g = Object.fromEntries(
792
- n.filter((D) => !e.nextSelectedCardIds.includes(D)).map((D) => [D, void 0])
813
+ }), C = Object.fromEntries(
814
+ n.filter((k) => !e.nextSelectedCardIds.includes(k)).map((k) => [k, void 0])
793
815
  );
794
816
  return e.nextSelectedCardIds.length > 0 && c.source.kind === "manual" && c.source.options.length > 0 && Object.assign(
795
- g,
817
+ C,
796
818
  je({
797
819
  control: c,
798
- participants: y || [],
820
+ participants: g || [],
799
821
  selectedCardIds: e.nextSelectedCardIds
800
822
  })
801
823
  ), {
802
824
  nextControl: c,
803
- cardBindingsById: g
825
+ cardBindingsById: C
804
826
  };
805
- }, A = B(
827
+ }, A = M(
806
828
  (e, n = i, l = { type: "update" }) => {
807
- const c = e.map((g) => (he({
808
- control: g,
829
+ const c = e.map((C) => (ge({
830
+ control: C,
809
831
  defaultValues: n
810
832
  }), kt(
811
- g
833
+ C
812
834
  )));
813
- f(c, n, l);
835
+ p(c, n, l);
814
836
  },
815
- [i, f]
837
+ [i, p]
816
838
  ), Z = (e, n) => {
817
839
  const l = r.find(
818
- (w) => w.id === e
840
+ (I) => I.id === e
819
841
  );
820
- let c = r.map((w) => w.id !== e ? w : n(w));
821
- const g = c.find(
822
- (w) => w.id === e
842
+ let c = r.map((I) => I.id !== e ? I : n(I));
843
+ const C = c.find(
844
+ (I) => I.id === e
823
845
  );
824
- let D, p;
825
- if (g && s === "dashboard" && (g.type === "field_selector" || g.type === "metric_selector")) {
826
- const w = (m == null ? void 0 : m[g.id]) || [], P = Ie({
827
- control: g,
828
- nextSelectedCardIds: w
846
+ let k, f;
847
+ if (C && s === "dashboard" && (C.type === "field_selector" || C.type === "metric_selector")) {
848
+ const I = (m == null ? void 0 : m[C.id]) || [], K = Te({
849
+ control: C,
850
+ nextSelectedCardIds: I
829
851
  });
830
852
  c = c.map(
831
- ($) => $.id === e ? P.nextControl : $
832
- ), D = P.cardBindingsById, p = [g.id];
853
+ (P) => P.id === e ? K.nextControl : P
854
+ ), k = K.cardBindingsById, f = [C.id];
833
855
  } else if (l && s === "dashboard" && (l.type === "field_selector" || l.type === "metric_selector")) {
834
- const w = (m == null ? void 0 : m[l.id]) || [];
835
- D = Object.fromEntries(
836
- w.map((P) => [P, void 0])
837
- ), p = [l.id];
856
+ const I = (m == null ? void 0 : m[l.id]) || [];
857
+ k = Object.fromEntries(
858
+ I.map((K) => [K, void 0])
859
+ ), f = [l.id];
838
860
  }
839
- const S = c.find(
840
- (w) => w.id === e
861
+ const w = c.find(
862
+ (I) => I.id === e
841
863
  );
842
- let _ = i;
843
- if (l && S) {
844
- const w = he({
864
+ let F = i;
865
+ if (l && w) {
866
+ const I = ge({
845
867
  control: l,
846
868
  defaultValues: i
847
869
  });
848
- l.source.kind === "manual" && S.source.kind === "sql_query" && (T.current[e] = w);
849
- const P = w === void 0 && l.source.kind === "sql_query" && S.source.kind === "manual" ? T.current[e] : w, $ = Qe({
870
+ l.source.kind === "manual" && w.source.kind === "sql_query" && (E.current[e] = I);
871
+ const K = I === void 0 && l.source.kind === "sql_query" && w.source.kind === "manual" ? E.current[e] : I, P = Qe({
850
872
  previousControl: l,
851
- nextControl: S,
852
- currentDefaultValue: P
873
+ nextControl: w,
874
+ currentDefaultValue: K
853
875
  });
854
- S.source.kind === "manual" && (T.current[e] = $), i && (_ = { ...i }, $ === void 0 ? delete _[e] : _[e] = $), c = c.map(
855
- (Le) => Le.id === e ? { ...S, defaultValue: $ } : Le
876
+ w.source.kind === "manual" && (E.current[e] = P), i && (F = { ...i }, P === void 0 ? delete F[e] : F[e] = P), c = c.map(
877
+ (Le) => Le.id === e ? { ...w, defaultValue: P } : Le
856
878
  );
857
879
  }
858
- A(c, _, {
880
+ A(c, F, {
859
881
  type: "update",
860
- cardBindingsById: D,
861
- affectedBindingControlIds: p
882
+ cardBindingsById: k,
883
+ affectedBindingControlIds: f
862
884
  });
863
885
  }, ct = (e, n) => {
864
886
  if (!n.trim())
865
887
  return;
866
- const l = Gt(n);
867
- if (l === e || F.has(l) || r.some(
868
- (D) => D.id === l && D.id !== e
888
+ const l = Ht(n);
889
+ if (l === e || _.has(l) || r.some(
890
+ (k) => k.id === l && k.id !== e
869
891
  ))
870
892
  return;
871
893
  const c = r.map(
872
- (D) => D.id === e ? { ...D, id: l } : D
894
+ (k) => k.id === e ? { ...k, id: l } : k
873
895
  );
874
896
  if (!i) {
875
897
  A(c, void 0, {
@@ -879,8 +901,8 @@ function ga({
879
901
  });
880
902
  return;
881
903
  }
882
- const g = { ...i };
883
- Object.prototype.hasOwnProperty.call(g, e) && (g[l] = g[e], delete g[e]), A(c, g, {
904
+ const C = { ...i };
905
+ Object.prototype.hasOwnProperty.call(C, e) && (C[l] = C[e], delete C[e]), A(c, C, {
884
906
  type: "rename",
885
907
  oldId: e,
886
908
  newId: l
@@ -893,36 +915,36 @@ function ga({
893
915
  }
894
916
  const l = { ...i };
895
917
  delete l[e], A(n, l, { type: "remove", controlId: e });
896
- }, pt = B(() => {
897
- M.current = void 0, V({
918
+ }, pt = M(() => {
919
+ B.current = void 0, T({
898
920
  step: 1,
899
- control: re(s, r, Array.from(F))
921
+ control: re(s, r, Array.from(_))
900
922
  }), O(null), H(null);
901
- }, [r, F, s]), ee = (e) => {
902
- V(
923
+ }, [r, _, s]), ee = (e) => {
924
+ T(
903
925
  (n) => n && (() => {
904
926
  const l = e(n.control);
905
- n.control.source.kind === "manual" && l.source.kind === "sql_query" && (M.current = n.defaultValue);
906
- const c = n.defaultValue === void 0 && n.control.source.kind === "sql_query" && l.source.kind === "manual" ? M.current : n.defaultValue, g = Qe({
927
+ n.control.source.kind === "manual" && l.source.kind === "sql_query" && (B.current = n.defaultValue);
928
+ const c = n.defaultValue === void 0 && n.control.source.kind === "sql_query" && l.source.kind === "manual" ? B.current : n.defaultValue, C = Qe({
907
929
  previousControl: n.control,
908
930
  nextControl: l,
909
931
  currentDefaultValue: c
910
932
  });
911
- return l.source.kind === "manual" && (M.current = g), {
933
+ return l.source.kind === "manual" && (B.current = C), {
912
934
  ...n,
913
935
  control: l,
914
- defaultValue: g
936
+ defaultValue: C
915
937
  };
916
938
  })()
917
939
  );
918
- }, Te = (e) => {
919
- V(
920
- (n) => n && (n.control.source.kind === "manual" && (M.current = e), {
940
+ }, Ee = (e) => {
941
+ T(
942
+ (n) => n && (n.control.source.kind === "manual" && (B.current = e), {
921
943
  ...n,
922
944
  defaultValue: e
923
945
  })
924
946
  );
925
- }, ce = (() => {
947
+ }, pe = (() => {
926
948
  if (!a)
927
949
  return !1;
928
950
  if (a.step === 2 && q(a.control.type))
@@ -935,45 +957,45 @@ function ga({
935
957
  )))
936
958
  return !1;
937
959
  if (n.source.kind === "sql_query") {
938
- const { connectionId: l, sql: c, valueColumn: g } = n.source;
939
- return l.trim().length > 0 && c.trim().length > 0 && g.trim().length > 0;
960
+ const { connectionId: l, sql: c, valueColumn: C } = n.source;
961
+ return l.trim().length > 0 && c.trim().length > 0 && C.trim().length > 0;
940
962
  }
941
963
  return St(
942
964
  se(n, a.defaultValue)
943
965
  );
944
- })(), Ee = () => {
945
- var D;
966
+ })(), Ve = () => {
967
+ var k;
946
968
  if (!a)
947
969
  return;
948
- const e = Oe(a.control), n = It({
970
+ const e = Oe(a.control), n = Tt({
949
971
  label: e.label,
950
972
  fallbackId: e.id,
951
973
  existingControls: r,
952
- reservedIds: Array.from(F)
974
+ reservedIds: Array.from(_)
953
975
  }), l = {
954
976
  ...e,
955
977
  id: n
956
- }, c = s === "dashboard" && (l.type === "field_selector" || l.type === "metric_selector") && ((D = a.selectedCardIds) != null && D.length) ? je({
978
+ }, c = s === "dashboard" && (l.type === "field_selector" || l.type === "metric_selector") && ((k = a.selectedCardIds) != null && k.length) ? je({
957
979
  control: l,
958
- participants: y || [],
980
+ participants: g || [],
959
981
  selectedCardIds: a.selectedCardIds
960
- }) : void 0, g = se(
982
+ }) : void 0, C = se(
961
983
  l,
962
984
  a.defaultValue
963
985
  );
964
- V({
986
+ T({
965
987
  step: s === "dashboard" && (l.type === "field_selector" || l.type === "metric_selector") ? 4 : 3,
966
988
  control: l,
967
- defaultValue: g,
989
+ defaultValue: C,
968
990
  createdControlId: n,
969
991
  selectedCardIds: a.selectedCardIds,
970
992
  cardBindingsById: c
971
993
  });
972
- }, ue = B(() => {
973
- V(null);
974
- }, []), qe = B(() => {
994
+ }, me = M(() => {
995
+ T(null);
996
+ }, []), qe = M(() => {
975
997
  if (!(a != null && a.createdControlId)) {
976
- V(null);
998
+ T(null);
977
999
  return;
978
1000
  }
979
1001
  const e = a.control, n = a.createdControlId, l = se(
@@ -1011,12 +1033,12 @@ function ga({
1011
1033
  cardBindingsById: a.cardBindingsById
1012
1034
  }
1013
1035
  );
1014
- O(n), V(null), N == null || N();
1015
- }, [r, a, i, A, N]), mt = a ? q(a.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], Fe = a != null && a.createdControlId ? `[[param.${a.createdControlId}]]` : a ? `[[param.${Dt(a.control.label) || a.control.id}]]` : "", pe = Be({
1036
+ O(n), T(null), D == null || D();
1037
+ }, [r, a, i, A, D]), mt = a ? q(a.control.type) ? ["Choose type", "Select cards", "Configure", "Finish"] : ["Choose type", "Configure", "Finish"] : [], _e = a != null && a.createdControlId ? `[[param.${a.createdControlId}]]` : a ? `[[param.${Dt(a.control.label) || a.control.id}]]` : "", fe = Me({
1016
1038
  controls: r,
1017
1039
  defaultValues: i
1018
- }), me = a ? [...r, a.control] : r, _e = a ? Be({
1019
- controls: me,
1040
+ }), he = a ? [...r, a.control] : r, Fe = a ? Me({
1041
+ controls: he,
1020
1042
  defaultValues: i,
1021
1043
  overrides: [
1022
1044
  {
@@ -1024,11 +1046,11 @@ function ga({
1024
1046
  value: a.defaultValue
1025
1047
  }
1026
1048
  ]
1027
- }) : pe;
1049
+ }) : fe;
1028
1050
  return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
1029
1051
  a ? /* @__PURE__ */ d("div", { className: "space-y-4 pb-1", children: [
1030
1052
  /* @__PURE__ */ t(
1031
- ea,
1053
+ ta,
1032
1054
  {
1033
1055
  currentStep: a.step,
1034
1056
  labels: mt
@@ -1040,50 +1062,55 @@ function ga({
1040
1062
  "aggregation_selector",
1041
1063
  "field_selector",
1042
1064
  "metric_selector"
1043
- ]), n = J.filter(
1044
- (g) => !e.has(g.value)
1045
- ), l = J.filter(
1046
- (g) => e.has(g.value)
1047
- ), c = (g) => /* @__PURE__ */ d(
1065
+ ]), n = /* @__PURE__ */ new Set([
1066
+ // Temporarily hide these from the add-control dialog while
1067
+ // keeping the shared definitions for existing controls.
1068
+ "date",
1069
+ "text"
1070
+ ]), l = J.filter(
1071
+ (k) => !e.has(k.value) && !n.has(k.value)
1072
+ ), c = J.filter(
1073
+ (k) => e.has(k.value)
1074
+ ), C = (k) => /* @__PURE__ */ d(
1048
1075
  "button",
1049
1076
  {
1050
1077
  type: "button",
1051
1078
  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",
1052
- onClick: () => V(
1053
- ra({
1079
+ onClick: () => T(
1080
+ sa({
1054
1081
  scope: s,
1055
1082
  existingControls: r,
1056
- reservedIds: Array.from(F),
1057
- type: g.value
1083
+ reservedIds: Array.from(_),
1084
+ type: k.value
1058
1085
  })
1059
1086
  ),
1060
1087
  children: [
1061
- /* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: g.label }),
1062
- /* @__PURE__ */ t("p", { className: "mt-0.5 text-[12px] text-muted-foreground", children: g.description })
1088
+ /* @__PURE__ */ t("div", { className: "text-[13px] font-medium text-foreground", children: k.label }),
1089
+ /* @__PURE__ */ t("p", { className: "mt-0.5 text-[12px] text-muted-foreground", children: k.description })
1063
1090
  ]
1064
1091
  },
1065
- g.value
1092
+ k.value
1066
1093
  );
1067
1094
  return /* @__PURE__ */ d("div", { className: "space-y-4", children: [
1068
- s === "card" && (v == null ? void 0 : v.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,
1069
- n.length > 0 && /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
1095
+ s === "card" && (x == null ? void 0 : x.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,
1096
+ l.length > 0 && /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
1070
1097
  /* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Input controls" }),
1071
- /* @__PURE__ */ t("div", { className: "grid gap-1.5 sm:grid-cols-2", children: n.map(c) })
1098
+ /* @__PURE__ */ t("div", { className: "grid gap-1.5 sm:grid-cols-2", children: l.map(C) })
1072
1099
  ] }),
1073
- l.length > 0 && /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
1100
+ c.length > 0 && /* @__PURE__ */ d("div", { className: "space-y-1.5", children: [
1074
1101
  /* @__PURE__ */ t("p", { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Data-driven controls" }),
1075
- /* @__PURE__ */ t("div", { className: "grid gap-1.5 sm:grid-cols-2", children: l.map(c) })
1102
+ /* @__PURE__ */ t("div", { className: "grid gap-1.5 sm:grid-cols-2", children: c.map(C) })
1076
1103
  ] }),
1077
1104
  /* @__PURE__ */ t(
1078
- oe,
1105
+ de,
1079
1106
  {
1080
1107
  secondary: /* @__PURE__ */ t(
1081
- E,
1108
+ V,
1082
1109
  {
1083
1110
  type: "button",
1084
1111
  variant: "outline",
1085
1112
  size: "xs",
1086
- onClick: ue,
1113
+ onClick: me,
1087
1114
  children: "Back to controls"
1088
1115
  }
1089
1116
  )
@@ -1113,17 +1140,17 @@ function ga({
1113
1140
  className: "flex items-start gap-2 rounded-control px-1.5 py-1 text-[13px] hover:bg-muted/40",
1114
1141
  children: [
1115
1142
  /* @__PURE__ */ t(
1116
- Mt,
1143
+ jt,
1117
1144
  {
1118
1145
  checked: n,
1119
- onCheckedChange: (l) => V(
1146
+ onCheckedChange: (l) => T(
1120
1147
  (c) => c && {
1121
1148
  ...c,
1122
1149
  selectedCardIds: l === !0 ? [
1123
1150
  ...c.selectedCardIds || [],
1124
1151
  e.cardId
1125
1152
  ] : (c.selectedCardIds || []).filter(
1126
- (g) => g !== e.cardId
1153
+ (C) => C !== e.cardId
1127
1154
  )
1128
1155
  }
1129
1156
  )
@@ -1139,15 +1166,15 @@ function ga({
1139
1166
  );
1140
1167
  }) }),
1141
1168
  /* @__PURE__ */ t(
1142
- oe,
1169
+ de,
1143
1170
  {
1144
1171
  secondary: /* @__PURE__ */ t(
1145
- E,
1172
+ V,
1146
1173
  {
1147
1174
  type: "button",
1148
1175
  variant: "outline",
1149
1176
  size: "xs",
1150
- onClick: () => V(
1177
+ onClick: () => T(
1151
1178
  (e) => e && {
1152
1179
  ...e,
1153
1180
  step: 1,
@@ -1158,17 +1185,17 @@ function ga({
1158
1185
  }
1159
1186
  ),
1160
1187
  primary: /* @__PURE__ */ t(
1161
- E,
1188
+ V,
1162
1189
  {
1163
1190
  type: "button",
1164
1191
  size: "xs",
1165
- onClick: () => V(
1192
+ onClick: () => T(
1166
1193
  (e) => e && {
1167
1194
  ...e,
1168
1195
  step: 3
1169
1196
  }
1170
1197
  ),
1171
- disabled: !ce,
1198
+ disabled: !pe,
1172
1199
  children: "Next"
1173
1200
  }
1174
1201
  )
@@ -1182,22 +1209,22 @@ function ga({
1182
1209
  defaultValue: a.defaultValue,
1183
1210
  availableFieldChoices: U.fields,
1184
1211
  availableMetricChoices: U.metrics,
1185
- previewControlDefinitions: me,
1186
- previewControlValues: _e,
1212
+ previewControlDefinitions: he,
1213
+ previewControlValues: Fe,
1187
1214
  onControlChange: (e) => ee(() => e),
1188
1215
  onLabelChange: (e) => ee((n) => ({
1189
1216
  ...n,
1190
1217
  label: e
1191
1218
  })),
1192
- onDefaultValueChange: Te,
1193
- onBack: () => V(
1219
+ onDefaultValueChange: Ee,
1220
+ onBack: () => T(
1194
1221
  (e) => e && {
1195
1222
  ...e,
1196
1223
  step: 1
1197
1224
  }
1198
1225
  ),
1199
- onNext: Ee,
1200
- nextDisabled: !ce
1226
+ onNext: Ve,
1227
+ nextDisabled: !pe
1201
1228
  }
1202
1229
  ),
1203
1230
  a.step === 3 && q(a.control.type) && /* @__PURE__ */ t(
@@ -1207,31 +1234,31 @@ function ga({
1207
1234
  defaultValue: a.defaultValue,
1208
1235
  availableFieldChoices: U.fields,
1209
1236
  availableMetricChoices: U.metrics,
1210
- previewControlDefinitions: me,
1211
- previewControlValues: _e,
1237
+ previewControlDefinitions: he,
1238
+ previewControlValues: Fe,
1212
1239
  onControlChange: (e) => ee(() => e),
1213
1240
  onLabelChange: (e) => ee((n) => ({
1214
1241
  ...n,
1215
1242
  label: e
1216
1243
  })),
1217
- onDefaultValueChange: Te,
1218
- onBack: () => V(
1244
+ onDefaultValueChange: Ee,
1245
+ onBack: () => T(
1219
1246
  (e) => e && {
1220
1247
  ...e,
1221
1248
  step: 2
1222
1249
  }
1223
1250
  ),
1224
- onNext: Ee,
1225
- nextDisabled: !ce
1251
+ onNext: Ve,
1252
+ nextDisabled: !pe
1226
1253
  }
1227
1254
  ),
1228
1255
  a.step === 3 && !q(a.control.type) && /* @__PURE__ */ t(
1229
- Ke,
1256
+ $e,
1230
1257
  {
1231
1258
  control: a.control,
1232
1259
  scope: s,
1233
- createdReference: Fe,
1234
- explorerContent: /* @__PURE__ */ d(K, { children: [
1260
+ createdReference: _e,
1261
+ explorerContent: /* @__PURE__ */ d($, { children: [
1235
1262
  "Open the card and use",
1236
1263
  " ",
1237
1264
  /* @__PURE__ */ t("span", { className: "font-medium text-foreground", children: "Settings → Controls" }),
@@ -1239,47 +1266,47 @@ function ga({
1239
1266
  "to choose what this control changes."
1240
1267
  ] }),
1241
1268
  sqlDescription: "Reference this control directly in the SQL editor.",
1242
- onBack: () => V(
1269
+ onBack: () => T(
1243
1270
  (e) => e && {
1244
1271
  ...e,
1245
1272
  step: 2
1246
1273
  }
1247
1274
  ),
1248
- onCancel: ue,
1275
+ onCancel: me,
1249
1276
  onDone: qe
1250
1277
  }
1251
1278
  ),
1252
1279
  a.step === 4 && q(a.control.type) && /* @__PURE__ */ t(
1253
- Ke,
1280
+ $e,
1254
1281
  {
1255
1282
  control: a.control,
1256
1283
  scope: s,
1257
- createdReference: Fe,
1258
- summaryDetail: /* @__PURE__ */ d(K, { children: [
1284
+ createdReference: _e,
1285
+ summaryDetail: /* @__PURE__ */ d($, { children: [
1259
1286
  "Used by ",
1260
1287
  (a.selectedCardIds || []).length,
1261
1288
  " selected card",
1262
1289
  (a.selectedCardIds || []).length === 1 ? "" : "s"
1263
1290
  ] }),
1264
- explorerContent: /* @__PURE__ */ t(K, { children: "Selected cards have been set up to respond to this control automatically." }),
1291
+ explorerContent: /* @__PURE__ */ t($, { children: "Selected cards have been set up to respond to this control automatically." }),
1265
1292
  sqlDescription: "SQL cards can still reference this control directly in the SQL editor.",
1266
- onBack: () => V(
1293
+ onBack: () => T(
1267
1294
  (e) => e && {
1268
1295
  ...e,
1269
1296
  step: 3
1270
1297
  }
1271
1298
  ),
1272
- onCancel: ue,
1299
+ onCancel: me,
1273
1300
  onDone: qe
1274
1301
  }
1275
1302
  )
1276
1303
  ] }) : null,
1277
1304
  !a && r.length === 0 ? /* @__PURE__ */ t("div", { className: "rounded-md border border-dashed p-3 text-sm text-muted-foreground", children: u }) : null,
1278
1305
  !a && r.map((e) => {
1279
- const n = dt(e), l = x == null ? void 0 : x[e.id], c = he({
1306
+ const n = dt(e), l = y == null ? void 0 : y[e.id], c = ge({
1280
1307
  control: e,
1281
1308
  defaultValues: i
1282
- }), g = de === e.id, D = "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";
1309
+ }), C = ue === e.id, k = "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";
1283
1310
  return /* @__PURE__ */ d(
1284
1311
  "div",
1285
1312
  {
@@ -1292,15 +1319,15 @@ function ga({
1292
1319
  type: "button",
1293
1320
  className: "flex min-w-0 flex-1 items-start gap-2 rounded-control text-left focus:outline-none focus-visible:bg-muted/40",
1294
1321
  onClick: () => O(
1295
- (p) => p === e.id ? null : e.id
1322
+ (f) => f === e.id ? null : e.id
1296
1323
  ),
1297
1324
  children: [
1298
- g ? /* @__PURE__ */ t(Me, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ t(Re, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
1325
+ C ? /* @__PURE__ */ t(Be, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }) : /* @__PURE__ */ t(Re, { className: "mt-0.5 h-3.5 w-3.5 shrink-0 text-muted-foreground" }),
1299
1326
  /* @__PURE__ */ d("div", { className: "min-w-0", children: [
1300
1327
  /* @__PURE__ */ d("div", { className: "flex flex-wrap items-center gap-1.5", children: [
1301
1328
  /* @__PURE__ */ t("span", { className: "truncate text-[13px] font-medium text-foreground", children: e.label || "Untitled control" }),
1302
- /* @__PURE__ */ t("span", { className: D, children: Xe(e.type).label }),
1303
- /* @__PURE__ */ t("span", { className: D, children: He(s, e.placement) })
1329
+ /* @__PURE__ */ t("span", { className: k, children: Xe(e.type).label }),
1330
+ /* @__PURE__ */ t("span", { className: k, children: He(s, e.placement) })
1304
1331
  ] }),
1305
1332
  /* @__PURE__ */ d("div", { className: "mt-0.5 text-[12px] text-muted-foreground", children: [
1306
1333
  Je(e),
@@ -1311,7 +1338,7 @@ function ga({
1311
1338
  }
1312
1339
  ),
1313
1340
  /* @__PURE__ */ t(
1314
- E,
1341
+ V,
1315
1342
  {
1316
1343
  type: "button",
1317
1344
  size: "xs",
@@ -1319,11 +1346,11 @@ function ga({
1319
1346
  className: "h-7 w-7 shrink-0 p-0 text-muted-foreground",
1320
1347
  onClick: () => ut(e.id),
1321
1348
  "aria-label": `Remove ${e.label}`,
1322
- children: /* @__PURE__ */ t(Qt, { className: "h-3.5 w-3.5" })
1349
+ children: /* @__PURE__ */ t(Rt, { className: "h-3.5 w-3.5" })
1323
1350
  }
1324
1351
  )
1325
1352
  ] }),
1326
- g && /* @__PURE__ */ d("div", { className: "space-y-4 border-t border-border/60 px-3 py-3", children: [
1353
+ C && /* @__PURE__ */ d("div", { className: "space-y-4 border-t border-border/60 px-3 py-3", children: [
1327
1354
  /* @__PURE__ */ d("div", { className: "grid gap-3 md:grid-cols-3", children: [
1328
1355
  /* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
1329
1356
  /* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Label" }),
@@ -1333,9 +1360,9 @@ function ga({
1333
1360
  size: "xs",
1334
1361
  value: e.label,
1335
1362
  placeholder: "Control label",
1336
- onChange: (p) => Z(e.id, (S) => ({
1337
- ...S,
1338
- label: p.target.value
1363
+ onChange: (f) => Z(e.id, (w) => ({
1364
+ ...w,
1365
+ label: f.target.value
1339
1366
  }))
1340
1367
  }
1341
1368
  )
@@ -1343,28 +1370,28 @@ function ga({
1343
1370
  /* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
1344
1371
  /* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Type" }),
1345
1372
  /* @__PURE__ */ d(
1346
- be,
1373
+ ye,
1347
1374
  {
1348
1375
  value: e.type,
1349
- onValueChange: (p) => {
1350
- const S = Ze({
1376
+ onValueChange: (f) => {
1377
+ const w = Ze({
1351
1378
  controls: r,
1352
1379
  controlId: e.id,
1353
- nextType: p,
1380
+ nextType: f,
1354
1381
  defaultValues: i
1355
1382
  });
1356
- A(S.controls, S.defaultValues);
1383
+ A(w.controls, w.defaultValues);
1357
1384
  },
1358
1385
  children: [
1359
- /* @__PURE__ */ t(ge, { size: "xs", children: /* @__PURE__ */ t(ye, {}) }),
1360
- /* @__PURE__ */ t(xe, { children: ae(e.type).map(
1361
- (p) => /* @__PURE__ */ t(
1362
- ve,
1386
+ /* @__PURE__ */ t(xe, { size: "xs", children: /* @__PURE__ */ t(ve, {}) }),
1387
+ /* @__PURE__ */ t(Ce, { children: ae(e.type).map(
1388
+ (f) => /* @__PURE__ */ t(
1389
+ ke,
1363
1390
  {
1364
- value: p.value,
1365
- children: p.label
1391
+ value: f.value,
1392
+ children: f.label
1366
1393
  },
1367
- p.value
1394
+ f.value
1368
1395
  )
1369
1396
  ) })
1370
1397
  ]
@@ -1374,44 +1401,44 @@ function ga({
1374
1401
  /* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
1375
1402
  /* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Show in" }),
1376
1403
  /* @__PURE__ */ d(
1377
- be,
1404
+ ye,
1378
1405
  {
1379
1406
  value: e.placement || X,
1380
- onValueChange: (p) => Z(e.id, (S) => ({
1381
- ...S,
1382
- placement: p
1407
+ onValueChange: (f) => Z(e.id, (w) => ({
1408
+ ...w,
1409
+ placement: f
1383
1410
  })),
1384
1411
  children: [
1385
- /* @__PURE__ */ t(ge, { size: "xs", children: /* @__PURE__ */ t(ye, {}) }),
1386
- /* @__PURE__ */ t(xe, { children: G.map((p) => /* @__PURE__ */ t(ve, { value: p.value, children: p.label }, p.value)) })
1412
+ /* @__PURE__ */ t(xe, { size: "xs", children: /* @__PURE__ */ t(ve, {}) }),
1413
+ /* @__PURE__ */ t(Ce, { children: G.map((f) => /* @__PURE__ */ t(ke, { value: f.value, children: f.label }, f.value)) })
1387
1414
  ]
1388
1415
  }
1389
1416
  )
1390
1417
  ] })
1391
1418
  ] }),
1392
1419
  q(e.type) ? /* @__PURE__ */ t(
1393
- jt,
1420
+ Ut,
1394
1421
  {
1395
1422
  type: e.type,
1396
1423
  participants: ze(
1397
- y || [],
1424
+ g || [],
1398
1425
  e.type
1399
- ).map((p) => ({
1400
- cardId: p.cardId,
1401
- title: p.title,
1402
- choiceCount: e.type === "field_selector" ? p.fieldChoices.length : p.metricChoices.length
1426
+ ).map((f) => ({
1427
+ cardId: f.cardId,
1428
+ title: f.title,
1429
+ choiceCount: e.type === "field_selector" ? f.fieldChoices.length : f.metricChoices.length
1403
1430
  })),
1404
1431
  selectedCardIds: (m == null ? void 0 : m[e.id]) || [],
1405
- onChange: (p) => {
1406
- const S = Ie({
1432
+ onChange: (f) => {
1433
+ const w = Te({
1407
1434
  control: e,
1408
- nextSelectedCardIds: p
1409
- }), _ = r.map(
1410
- (w) => w.id === e.id ? S.nextControl : w
1435
+ nextSelectedCardIds: f
1436
+ }), F = r.map(
1437
+ (I) => I.id === e.id ? w.nextControl : I
1411
1438
  );
1412
- A(_, i, {
1439
+ A(F, i, {
1413
1440
  type: "update",
1414
- cardBindingsById: S.cardBindingsById
1441
+ cardBindingsById: w.cardBindingsById
1415
1442
  });
1416
1443
  }
1417
1444
  }
@@ -1423,9 +1450,9 @@ function ga({
1423
1450
  availableFieldChoices: n.fields,
1424
1451
  availableMetricChoices: n.metrics,
1425
1452
  previewControlDefinitions: r,
1426
- previewControlValues: pe,
1453
+ previewControlValues: fe,
1427
1454
  controlLifecycle: "edit",
1428
- onChange: (p) => Z(e.id, () => p)
1455
+ onChange: (f) => Z(e.id, () => f)
1429
1456
  }
1430
1457
  ),
1431
1458
  e.initialValueStrategy === "saved_default" && /* @__PURE__ */ t(
@@ -1436,48 +1463,48 @@ function ga({
1436
1463
  allowNoDefault: !0,
1437
1464
  allowCardDefault: !0,
1438
1465
  previewControlDefinitions: r,
1439
- previewControlValues: pe,
1440
- onChange: (p) => {
1441
- const S = r.map(
1442
- (_) => _.id === e.id ? { ..._, defaultValue: p } : _
1466
+ previewControlValues: fe,
1467
+ onChange: (f) => {
1468
+ const w = r.map(
1469
+ (F) => F.id === e.id ? { ...F, defaultValue: f } : F
1443
1470
  );
1444
- if (e.source.kind === "manual" && (T.current[e.id] = p), i) {
1445
- const _ = { ...i };
1446
- p === void 0 ? delete _[e.id] : _[e.id] = p, A(S, _);
1471
+ if (e.source.kind === "manual" && (E.current[e.id] = f), i) {
1472
+ const F = { ...i };
1473
+ f === void 0 ? delete F[e.id] : F[e.id] = f, A(w, F);
1447
1474
  return;
1448
1475
  }
1449
- A(S, void 0);
1476
+ A(w, void 0);
1450
1477
  }
1451
1478
  }
1452
1479
  ),
1453
1480
  /* @__PURE__ */ d(
1454
- Rt,
1481
+ Pt,
1455
1482
  {
1456
1483
  open: te === e.id,
1457
- onOpenChange: (p) => H(p ? e.id : null),
1484
+ onOpenChange: (f) => H(f ? e.id : null),
1458
1485
  children: [
1459
- /* @__PURE__ */ t(Ut, { asChild: !0, children: /* @__PURE__ */ d(
1460
- E,
1486
+ /* @__PURE__ */ t($t, { asChild: !0, children: /* @__PURE__ */ d(
1487
+ V,
1461
1488
  {
1462
1489
  type: "button",
1463
1490
  variant: "ghost",
1464
1491
  size: "xs",
1465
1492
  className: "-ml-2 gap-1 text-muted-foreground hover:text-foreground",
1466
1493
  children: [
1467
- te === e.id ? /* @__PURE__ */ t(Me, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5" }),
1494
+ te === e.id ? /* @__PURE__ */ t(Be, { className: "h-3.5 w-3.5" }) : /* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5" }),
1468
1495
  "Advanced"
1469
1496
  ]
1470
1497
  }
1471
1498
  ) }),
1472
- /* @__PURE__ */ d($t, { className: "space-y-3 pt-2", children: [
1499
+ /* @__PURE__ */ d(Kt, { className: "space-y-3 pt-2", children: [
1473
1500
  /* @__PURE__ */ d("div", { className: "grid gap-3 md:grid-cols-2", children: [
1474
1501
  /* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
1475
1502
  /* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Variable name" }),
1476
1503
  /* @__PURE__ */ t(
1477
- Kt,
1504
+ Yt,
1478
1505
  {
1479
1506
  controlId: e.id,
1480
- onCommit: (p) => ct(e.id, p)
1507
+ onCommit: (f) => ct(e.id, f)
1481
1508
  },
1482
1509
  e.id
1483
1510
  )
@@ -1485,22 +1512,22 @@ function ga({
1485
1512
  /* @__PURE__ */ d("div", { className: "flex flex-col gap-1.5", children: [
1486
1513
  /* @__PURE__ */ t(Y, { className: "text-[10px] font-medium uppercase tracking-[0.08em] text-muted-foreground", children: "Initial value" }),
1487
1514
  /* @__PURE__ */ d(
1488
- be,
1515
+ ye,
1489
1516
  {
1490
1517
  value: e.initialValueStrategy,
1491
- onValueChange: (p) => Z(e.id, (S) => ({
1492
- ...S,
1493
- initialValueStrategy: p
1518
+ onValueChange: (f) => Z(e.id, (w) => ({
1519
+ ...w,
1520
+ initialValueStrategy: f
1494
1521
  })),
1495
1522
  children: [
1496
- /* @__PURE__ */ t(ge, { size: "xs", children: /* @__PURE__ */ t(ye, {}) }),
1497
- /* @__PURE__ */ t(xe, { children: Vt.map((p) => /* @__PURE__ */ t(
1498
- ve,
1523
+ /* @__PURE__ */ t(xe, { size: "xs", children: /* @__PURE__ */ t(ve, {}) }),
1524
+ /* @__PURE__ */ t(Ce, { children: It.map((f) => /* @__PURE__ */ t(
1525
+ ke,
1499
1526
  {
1500
- value: p.value,
1501
- children: p.label
1527
+ value: f.value,
1528
+ children: f.label
1502
1529
  },
1503
- p.value
1530
+ f.value
1504
1531
  )) })
1505
1532
  ]
1506
1533
  }
@@ -1508,10 +1535,10 @@ function ga({
1508
1535
  ] })
1509
1536
  ] }),
1510
1537
  /* @__PURE__ */ t(
1511
- Pt,
1538
+ Gt,
1512
1539
  {
1513
1540
  control: e,
1514
- onChange: (p) => Z(e.id, () => p)
1541
+ onChange: (f) => Z(e.id, () => f)
1515
1542
  }
1516
1543
  )
1517
1544
  ] })
@@ -1525,65 +1552,66 @@ function ga({
1525
1552
  );
1526
1553
  }),
1527
1554
  !a && /* @__PURE__ */ d(
1528
- E,
1555
+ V,
1529
1556
  {
1530
1557
  type: "button",
1531
1558
  variant: "outline",
1532
1559
  size: "xs",
1533
1560
  onClick: pt,
1534
1561
  children: [
1535
- /* @__PURE__ */ t(Yt, { className: "h-3.5 w-3.5" }),
1562
+ /* @__PURE__ */ t(Xt, { className: "h-3.5 w-3.5" }),
1536
1563
  "Add control"
1537
1564
  ]
1538
1565
  }
1539
1566
  )
1540
1567
  ] });
1541
1568
  }
1542
- function ya(s) {
1569
+ function va(s) {
1543
1570
  const {
1544
1571
  open: r,
1545
1572
  onOpenChange: o,
1546
1573
  initialCreateFlowActive: i = !1,
1547
- dismissMode: f = "passive"
1548
- } = s, u = r !== void 0, [b, x] = j(!1), [h, C] = j(
1574
+ dismissMode: p = "passive"
1575
+ } = s, u = r !== void 0, [h, y] = j(!1), [b, v] = j(
1549
1576
  i
1550
- ), y = u ? r : b, m = B(
1551
- (k) => {
1552
- !k && h && f === "passive" || (u || x(k), k || C(!1), o == null || o(k));
1577
+ ), g = u ? r : h, m = M(
1578
+ (N) => {
1579
+ !N && b && p === "passive" || (u || y(N), N || v(!1), o == null || o(N));
1553
1580
  },
1554
- [u, h, f, o]
1555
- ), v = B(() => {
1556
- u || x(!1), C(!1), o == null || o(!1);
1581
+ [u, b, p, o]
1582
+ ), x = M(() => {
1583
+ u || y(!1), v(!1), o == null || o(!1);
1557
1584
  }, [u, o]);
1558
- Se(() => {
1559
- y || C(!1);
1560
- }, [y]);
1561
- const I = B(
1562
- (k) => {
1563
- h && k.preventDefault();
1585
+ ie(() => {
1586
+ g || v(!1);
1587
+ }, [g]);
1588
+ const S = M(
1589
+ (N) => {
1590
+ b && N.preventDefault();
1564
1591
  },
1565
- [h]
1592
+ [b]
1566
1593
  );
1567
1594
  return {
1568
- forceClose: v,
1595
+ forceClose: x,
1569
1596
  handleOpenChange: m,
1570
- isCreateFlowActive: h,
1571
- preventPassiveDismissDuringCreate: I,
1572
- resolvedOpen: y,
1573
- setIsCreateFlowActive: C
1597
+ isCreateFlowActive: b,
1598
+ preventPassiveDismissDuringCreate: S,
1599
+ resolvedOpen: g,
1600
+ setIsCreateFlowActive: v
1574
1601
  };
1575
1602
  }
1576
1603
  export {
1577
- ca as C,
1578
- pa as E,
1579
- Jt as L,
1580
- ua as V,
1581
- ha as a,
1582
- ma as b,
1583
- fa as c,
1584
- Wt as d,
1585
- ga as e,
1586
- ot as f,
1587
- ba as g,
1588
- ya as u
1604
+ ua as C,
1605
+ fa as E,
1606
+ Wt as L,
1607
+ ma as V,
1608
+ ga as a,
1609
+ ha as b,
1610
+ ba as c,
1611
+ Zt as d,
1612
+ xa as e,
1613
+ pa as f,
1614
+ ot as g,
1615
+ ya as h,
1616
+ va as u
1589
1617
  };