react-semaphor 0.1.294 → 0.1.296

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