react-semaphor 0.1.112 → 0.1.114

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 (28) hide show
  1. package/dist/chunks/{dashboard-controls-DkWaHy_5.js → dashboard-controls-BdvApPn1.js} +1 -1
  2. package/dist/chunks/{dashboard-controls-VimgiX8G.js → dashboard-controls-Dx3SP8_O.js} +3 -3
  3. package/dist/chunks/{dashboard-json-DawgqwNk.js → dashboard-json-BBUvHSx-.js} +1 -1
  4. package/dist/chunks/{dashboard-json-DNTtZ5pv.js → dashboard-json-CLmj5Xgn.js} +1 -1
  5. package/dist/chunks/edit-dashboard-visual-DYXisS8S.js +170 -0
  6. package/dist/chunks/{edit-dashboard-visual-BG7-vrl3.js → edit-dashboard-visual-F01R1pb1.js} +5061 -4662
  7. package/dist/chunks/{editor-action-buttons-B44i9J2T.js → editor-action-buttons-CCki6g0i.js} +47 -64
  8. package/dist/chunks/{editor-action-buttons-Bnm--1Q3.js → editor-action-buttons-D-aEUYpS.js} +2 -7
  9. package/dist/chunks/{index-B4KWd6kb.js → index-BB_Q9BeP.js} +18021 -16999
  10. package/dist/chunks/{index-BSu9QpLt.js → index-C2IITrDh.js} +212 -212
  11. package/dist/chunks/{resource-management-panel-CYYD4npf.js → resource-management-panel-BWpWiCnv.js} +1 -1
  12. package/dist/chunks/{resource-management-panel-BK6mk6Yh.js → resource-management-panel-C6G5vwpR.js} +49 -49
  13. package/dist/chunks/{schedule-dashboard-DY5u0lrr.js → schedule-dashboard-Bcu7Wcl2.js} +3 -3
  14. package/dist/chunks/{schedule-dashboard-BfRq8Eyv.js → schedule-dashboard-CNmepTOh.js} +1 -1
  15. package/dist/chunks/{use-visual-utils-D6mJYimZ.js → use-visual-utils-CQb_-z3Z.js} +54 -54
  16. package/dist/chunks/{use-visual-utils-BHAJGn9v.js → use-visual-utils-VFO0nbRa.js} +1 -1
  17. package/dist/dashboard/index.cjs +1 -1
  18. package/dist/dashboard/index.js +1 -1
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +22 -22
  21. package/dist/surfboard/index.cjs +1 -1
  22. package/dist/surfboard/index.js +1 -1
  23. package/dist/types/dashboard.d.ts +50 -1
  24. package/dist/types/main.d.ts +51 -2
  25. package/dist/types/surfboard.d.ts +50 -1
  26. package/dist/types/types.d.ts +50 -1
  27. package/package.json +1 -1
  28. package/dist/chunks/edit-dashboard-visual-D6fYDuaG.js +0 -170
@@ -1,6 +1,6 @@
1
1
  import { jsxs as u, jsx as y, Fragment as C } from "react/jsx-runtime";
2
- import { b as Q, ab as g, aa as t, B as S, c as b, q as k, u as D, a8 as F, ac as z, ad as I, ae as E, af as B, ag as L, X as U, ah as h } from "./index-B4KWd6kb.js";
3
- import { u as K, a as N } from "./use-visual-utils-D6mJYimZ.js";
2
+ import { b as K, e as b, f as t, B as S, c as g, C as Q, u as D, g as F, L as z, h as I, i as k, j as E, k as B, X as L, l as h } from "./index-BB_Q9BeP.js";
3
+ import { u as M, a as N } from "./use-visual-utils-CQb_-z3Z.js";
4
4
  import { useState as V } from "react";
5
5
  /**
6
6
  * @license lucide-react v0.453.0 - ISC
@@ -8,24 +8,7 @@ import { useState as V } from "react";
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 T = Q("Eraser", [
12
- [
13
- "path",
14
- {
15
- d: "m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",
16
- key: "182aya"
17
- }
18
- ],
19
- ["path", { d: "M22 21H7", key: "t4ddhn" }],
20
- ["path", { d: "m5 11 9 9", key: "1mo9qw" }]
21
- ]);
22
- /**
23
- * @license lucide-react v0.453.0 - ISC
24
- *
25
- * This source code is licensed under the ISC license.
26
- * See the LICENSE file in the root directory of this source tree.
27
- */
28
- const M = Q("Save", [
11
+ const U = K("Save", [
29
12
  [
30
13
  "path",
31
14
  {
@@ -38,13 +21,13 @@ const M = Q("Save", [
38
21
  ]);
39
22
  function O({
40
23
  className: d,
41
- variant: c = "outline"
24
+ variant: i = "outline"
42
25
  }) {
43
26
  var m;
44
- const { setCardSql: o } = g();
27
+ const { setCardSql: o } = b();
45
28
  t((e) => e.frame);
46
29
  const l = t((e) => e.card);
47
- K(
30
+ M(
48
31
  ((m = l.customCardPreferences) == null ? void 0 : m.url) || ""
49
32
  ), t(
50
33
  (e) => e.selectedSchemaName
@@ -56,31 +39,31 @@ function O({
56
39
  (e) => e.selectedConnectionId
57
40
  ), t((e) => e.isShowingVisual), l.sql;
58
41
  const a = t((e) => e.onSave), { getUpdatedFrame: n } = N();
59
- function i() {
42
+ function c() {
60
43
  const e = n();
61
44
  a == null || a(e);
62
45
  }
63
46
  return /* @__PURE__ */ u(
64
47
  S,
65
48
  {
66
- onClick: i,
67
- className: b("h-8", d),
49
+ onClick: c,
50
+ className: g("h-8", d),
68
51
  size: "sm",
69
- variant: c,
52
+ variant: i,
70
53
  children: [
71
- /* @__PURE__ */ y(k, { className: "mr-2 size-4 font-bold" }),
54
+ /* @__PURE__ */ y(Q, { className: "mr-2 size-4 font-bold" }),
72
55
  "Accept"
73
56
  ]
74
57
  }
75
58
  );
76
59
  }
77
- function H({
60
+ function w({
78
61
  className: d,
79
- variant: c = "default"
62
+ variant: i = "default"
80
63
  }) {
81
64
  const o = I(), [l, a] = V(!1), n = D(
82
65
  (r) => r.actions.setIsDashboardPanelOpen
83
- ), { setIsVisualEditing: i } = F(), { getUpdatedFrame: m } = N(), e = E(), s = t((r) => r.frame), f = B();
66
+ ), { setIsVisualEditing: c } = F(), { getUpdatedFrame: m } = N(), e = k(), s = t((r) => r.frame), f = E();
84
67
  return /* @__PURE__ */ u(
85
68
  S,
86
69
  {
@@ -110,16 +93,16 @@ function H({
110
93
  }
111
94
  );
112
95
  },
113
- className: b("h-8", d),
96
+ className: g("h-8", d),
114
97
  size: "sm",
115
- variant: c,
98
+ variant: i,
116
99
  children: [
117
100
  l && /* @__PURE__ */ u(C, { children: [
118
101
  /* @__PURE__ */ y(z, { className: "mr-2 size-4 animate-spin font-bold" }),
119
102
  " Saving"
120
103
  ] }),
121
104
  !l && /* @__PURE__ */ u(C, { children: [
122
- /* @__PURE__ */ y(M, { className: "mr-2 size-4 font-bold" }),
105
+ /* @__PURE__ */ y(U, { className: "mr-2 size-4 font-bold" }),
123
106
  "Save to Library"
124
107
  ] })
125
108
  ]
@@ -129,12 +112,12 @@ function H({
129
112
  function G({
130
113
  className: d
131
114
  }) {
132
- const c = I(), [o, l] = V(!1), a = E(), n = t((r) => r.frame), i = D((r) => r.selectedSheetId), { updateFrame: m, setIsVisualEditing: e } = F(), { getUpdatedFrame: s } = N(), f = B();
115
+ const i = I(), [o, l] = V(!1), a = k(), n = t((r) => r.frame), c = D((r) => r.selectedSheetId), { updateFrame: m, setIsVisualEditing: e } = F(), { getUpdatedFrame: s } = N(), f = E();
133
116
  return /* @__PURE__ */ y(
134
117
  S,
135
118
  {
136
119
  onClick: async () => {
137
- if (!i) {
120
+ if (!c) {
138
121
  h.error("No sheet selected");
139
122
  return;
140
123
  }
@@ -157,7 +140,7 @@ function G({
157
140
  visualId: r
158
141
  // Keep the link to library visual
159
142
  };
160
- m(i, A), c.invalidateQueries({ queryKey: ["visuals"] }), c.invalidateQueries({ queryKey: ["visual", r] }), h.success("Saved to library and applied locally"), setTimeout(() => {
143
+ m(c, A), i.invalidateQueries({ queryKey: ["visuals"] }), i.invalidateQueries({ queryKey: ["visual", r] }), h.success("Saved to library and applied locally"), setTimeout(() => {
161
144
  e(!1);
162
145
  }, 300);
163
146
  } catch (p) {
@@ -166,7 +149,7 @@ function G({
166
149
  l(!1);
167
150
  }
168
151
  },
169
- className: b("h-8", d),
152
+ className: g("h-8", d),
170
153
  size: "sm",
171
154
  variant: "default",
172
155
  disabled: o,
@@ -174,16 +157,16 @@ function G({
174
157
  /* @__PURE__ */ y(z, { className: "mr-2 size-4 animate-spin font-bold" }),
175
158
  " Saving..."
176
159
  ] }) : /* @__PURE__ */ u(C, { children: [
177
- /* @__PURE__ */ y(M, { className: "mr-2 size-4 font-bold" }),
160
+ /* @__PURE__ */ y(U, { className: "mr-2 size-4 font-bold" }),
178
161
  "Save & Apply"
179
162
  ] })
180
163
  }
181
164
  );
182
165
  }
183
- function R({ className: d }) {
184
- const { getUpdatedFrame: c } = N();
166
+ function H({ className: d }) {
167
+ const { getUpdatedFrame: i } = N();
185
168
  t((e) => e.frame);
186
- const o = D((e) => e.selectedSheetId), { updateFrame: l, setIsVisualEditing: a } = F(), [n, i] = V(!1);
169
+ const o = D((e) => e.selectedSheetId), { updateFrame: l, setIsVisualEditing: a } = F(), [n, c] = V(!1);
187
170
  return /* @__PURE__ */ u(
188
171
  S,
189
172
  {
@@ -192,17 +175,17 @@ function R({ className: d }) {
192
175
  h.error("No sheet selected");
193
176
  return;
194
177
  }
195
- i(!0);
178
+ c(!0);
196
179
  const s = {
197
- ...c(),
180
+ ...i(),
198
181
  visualId: void 0
199
182
  // Remove the link to library visual
200
183
  };
201
184
  l(o, s), setTimeout(() => {
202
- i(!1), h.success("Changes applied. Visual is now local to this dashboard"), a(!1);
185
+ c(!1), h.success("Changes applied. Visual is now local to this dashboard"), a(!1);
203
186
  }, 300);
204
187
  },
205
- className: b("h-8", d),
188
+ className: g("h-8", d),
206
189
  size: "sm",
207
190
  variant: "outline",
208
191
  children: [
@@ -211,15 +194,15 @@ function R({ className: d }) {
211
194
  " Applying"
212
195
  ] }),
213
196
  !n && /* @__PURE__ */ u(C, { children: [
214
- /* @__PURE__ */ y(k, { className: "mr-2 size-4 font-bold" }),
197
+ /* @__PURE__ */ y(Q, { className: "mr-2 size-4 font-bold" }),
215
198
  "Apply Locally"
216
199
  ] })
217
200
  ]
218
201
  }
219
202
  );
220
203
  }
221
- function X({ className: d }) {
222
- const { setTempQueryData: c, setSqlGen: o } = g(), l = I(), a = t((s) => s.tempQueryData), n = t((s) => s.onClose), i = t((s) => s.card), { queryKey: m } = L(i);
204
+ function R({ className: d }) {
205
+ const { setTempQueryData: i, setSqlGen: o } = b(), l = I(), a = t((s) => s.tempQueryData), n = t((s) => s.onClose), c = t((s) => s.card), { queryKey: m } = B(c);
223
206
  function e() {
224
207
  if (a) {
225
208
  const { queryKey: s, queryData: f } = a;
@@ -231,22 +214,22 @@ function X({ className: d }) {
231
214
  S,
232
215
  {
233
216
  onClick: e,
234
- className: b("h-8", d),
217
+ className: g("h-8", d),
235
218
  size: "sm",
236
219
  variant: "outline",
237
220
  children: [
238
- /* @__PURE__ */ y(U, { className: "mr-2 size-4" }),
221
+ /* @__PURE__ */ y(L, { className: "mr-2 size-4" }),
239
222
  "Close"
240
223
  ]
241
224
  }
242
225
  );
243
226
  }
244
- function J() {
245
- const { setTempQueryData: d } = g(), c = I();
227
+ function X() {
228
+ const { setTempQueryData: d } = b(), i = I();
246
229
  t((v) => v.isDevMode);
247
- const o = t((v) => v.tempQueryData), l = t((v) => v.card), { queryKey: a } = L(l), {
230
+ const o = t((v) => v.tempQueryData), l = t((v) => v.card), { queryKey: a } = B(l), {
248
231
  setCardSql: n,
249
- setSqlGen: i,
232
+ setSqlGen: c,
250
233
  setCardPython: m,
251
234
  setCardCustomCfg: e,
252
235
  setCardPreferences: s,
@@ -254,13 +237,13 @@ function J() {
254
237
  clearQueryConfig: q,
255
238
  setCardConfig: r,
256
239
  setCardType: p
257
- } = g();
240
+ } = b();
258
241
  function A() {
259
- const v = c.getQueryData(a);
242
+ const v = i.getQueryData(a);
260
243
  o != null && o.queryData || d({
261
244
  queryKey: a,
262
245
  queryData: v
263
- }), c.setQueryData(a, null), c.removeQueries({ queryKey: a, exact: !0 }), n(""), i({}), q(), r(void 0), m(""), e(""), s({}), p("bar");
246
+ }), i.setQueryData(a, null), i.removeQueries({ queryKey: a, exact: !0 }), n(""), c({}), q(), r(void 0), m(""), e(""), s({}), p("bar");
264
247
  }
265
248
  return /* @__PURE__ */ u(
266
249
  S,
@@ -270,7 +253,7 @@ function J() {
270
253
  size: "sm",
271
254
  variant: "secondary",
272
255
  children: [
273
- /* @__PURE__ */ y(T, { className: "mr-2 size-4" }),
256
+ /* @__PURE__ */ y(L, { className: "mr-2 size-3.5" }),
274
257
  "Clear"
275
258
  ]
276
259
  }
@@ -278,10 +261,10 @@ function J() {
278
261
  }
279
262
  export {
280
263
  O as E,
281
- M as S,
282
- R as V,
283
- H as a,
264
+ U as S,
265
+ H as V,
266
+ w as a,
284
267
  G as b,
285
- X as c,
286
- J as d
268
+ R as c,
269
+ X as d
287
270
  };
@@ -1,11 +1,6 @@
1
- "use strict";const s=require("react/jsx-runtime"),e=require("./index-BSu9QpLt.js"),v=require("./use-visual-utils-BHAJGn9v.js"),C=require("react");/**
1
+ "use strict";const s=require("react/jsx-runtime"),e=require("./index-C2IITrDh.js"),v=require("./use-visual-utils-VFO0nbRa.js"),C=require("react");/**
2
2
  * @license lucide-react v0.453.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const g=e.createLucideIcon("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/**
7
- * @license lucide-react v0.453.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const E=e.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function b({className:d,variant:c="outline"}){var m;const{setCardSql:i}=e.useEditorActions();e.useEditorStore(t=>t.frame);const u=e.useEditorStore(t=>t.card);v.useRemoteChartStore(((m=u.customCardPreferences)==null?void 0:m.url)||""),e.useEditorStore(t=>t.selectedSchemaName),e.useEditorStore(t=>t.selectedDatamodelId),e.useEditorStore(t=>t.selectedDatabaseName),e.useEditorStore(t=>t.selectedTableName),e.useEditorStore(t=>t.selectedConnectionId),e.useEditorStore(t=>t.isShowingVisual),u.sql;const a=e.useEditorStore(t=>t.onSave),{getUpdatedFrame:o}=v.useVisualUtils();function l(){const t=o();a==null||a(t)}return s.jsxs(e.Button,{onClick:l,className:e.cn("h-8",d),size:"sm",variant:c,children:[s.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Accept"]})}function x({className:d,variant:c="default"}){const i=e.useQueryClient(),[u,a]=C.useState(!1),o=e.useDashboardStore(n=>n.actions.setIsDashboardPanelOpen),{setIsVisualEditing:l}=e.useDashboardActions(),{getUpdatedFrame:m}=v.useVisualUtils(),t=e.useSelectedVisual(),r=e.useEditorStore(n=>n.frame),y=e.useUpdateVisualMutation(),S=()=>{const n=m(),p=(r==null?void 0:r.visualId)||(t==null?void 0:t.id);if(!p){e.ue.error("No visual to save");return}a(!0),y.mutate({visualId:p,data:{frameObject:n}},{onSuccess:()=>{a(!1),o(!0),e.ue.success("Visual updated successfully"),i.invalidateQueries({queryKey:["resource-by-id","visual",p],exact:!0})},onError:()=>{a(!1),e.ue.error("Failed to update visual")}})};return s.jsxs(e.Button,{onClick:S,className:e.cn("h-8",d),size:"sm",variant:c,children:[u&&s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving"]}),!u&&s.jsxs(s.Fragment,{children:[s.jsx(E,{className:"mr-2 size-4 font-bold"}),"Save to Library"]})]})}function A({className:d}){const c=e.useQueryClient(),[i,u]=C.useState(!1),a=e.useSelectedVisual(),o=e.useEditorStore(n=>n.frame),l=e.useDashboardStore(n=>n.selectedSheetId),{updateFrame:m,setIsVisualEditing:t}=e.useDashboardActions(),{getUpdatedFrame:r}=v.useVisualUtils(),y=e.useUpdateVisualMutation(),S=async()=>{if(!l){e.ue.error("No sheet selected");return}const n=(o==null?void 0:o.visualId)||(a==null?void 0:a.id);if(!n){e.ue.error("No visual to update");return}u(!0);try{const p=r();await y.mutateAsync({visualId:n,data:{frameObject:p}});const f={...p,visualId:n};m(l,f),c.invalidateQueries({queryKey:["visuals"]}),c.invalidateQueries({queryKey:["visual",n]}),e.ue.success("Saved to library and applied locally"),setTimeout(()=>{t(!1)},300)}catch(p){console.error("Failed to save and apply:",p),e.ue.error("Failed to save and apply changes")}finally{u(!1)}};return s.jsx(e.Button,{onClick:S,className:e.cn("h-8",d),size:"sm",variant:"default",disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving..."]}):s.jsxs(s.Fragment,{children:[s.jsx(E,{className:"mr-2 size-4 font-bold"}),"Save & Apply"]})})}function j({className:d}){const{getUpdatedFrame:c}=v.useVisualUtils();e.useEditorStore(t=>t.frame);const i=e.useDashboardStore(t=>t.selectedSheetId),{updateFrame:u,setIsVisualEditing:a}=e.useDashboardActions(),[o,l]=C.useState(!1),m=()=>{if(!i){e.ue.error("No sheet selected");return}l(!0);const r={...c(),visualId:void 0};u(i,r),setTimeout(()=>{l(!1),e.ue.success("Changes applied. Visual is now local to this dashboard"),a(!1)},300)};return s.jsxs(e.Button,{onClick:m,className:e.cn("h-8",d),size:"sm",variant:"outline",children:[o&&s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Applying"]}),!o&&s.jsxs(s.Fragment,{children:[s.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Apply Locally"]})]})}function q({className:d}){const{setTempQueryData:c,setSqlGen:i}=e.useEditorActions(),u=e.useQueryClient(),a=e.useEditorStore(r=>r.tempQueryData),o=e.useEditorStore(r=>r.onClose),l=e.useEditorStore(r=>r.card),{queryKey:m}=e.useDashboardCardQuery(l);function t(){if(a){const{queryKey:r,queryData:y}=a;r&&y&&u.setQueryData(r,y)}i({}),o==null||o()}return s.jsxs(e.Button,{onClick:t,className:e.cn("h-8",d),size:"sm",variant:"outline",children:[s.jsx(e.X,{className:"mr-2 size-4"}),"Close"]})}function D(){const{setTempQueryData:d}=e.useEditorActions(),c=e.useQueryClient();e.useEditorStore(h=>h.isDevMode);const i=e.useEditorStore(h=>h.tempQueryData),u=e.useEditorStore(h=>h.card),{queryKey:a}=e.useDashboardCardQuery(u),{setCardSql:o,setSqlGen:l,setCardPython:m,setCardCustomCfg:t,setCardPreferences:r,updateDataSource:y,clearQueryConfig:S,setCardConfig:n,setCardType:p}=e.useEditorActions();function f(){const h=c.getQueryData(a);i!=null&&i.queryData||d({queryKey:a,queryData:h}),c.setQueryData(a,null),c.removeQueries({queryKey:a,exact:!0}),o(""),l({}),S(),n(void 0),m(""),t(""),r({}),p("bar")}return s.jsxs(e.Button,{onClick:f,className:"h-8",size:"sm",variant:"secondary",children:[s.jsx(g,{className:"mr-2 size-4"}),"Clear"]})}exports.EditorAcceptButton=b;exports.EditorCancelButton=q;exports.EditorClearButton=D;exports.Save=E;exports.VisualApplyLocalButton=j;exports.VisualSaveAndApplyButton=A;exports.VisualSaveButton=x;
6
+ */const E=e.createLucideIcon("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);function g({className:d,variant:l="outline"}){var m;const{setCardSql:i}=e.useEditorActions();e.useEditorStore(t=>t.frame);const u=e.useEditorStore(t=>t.card);v.useRemoteChartStore(((m=u.customCardPreferences)==null?void 0:m.url)||""),e.useEditorStore(t=>t.selectedSchemaName),e.useEditorStore(t=>t.selectedDatamodelId),e.useEditorStore(t=>t.selectedDatabaseName),e.useEditorStore(t=>t.selectedTableName),e.useEditorStore(t=>t.selectedConnectionId),e.useEditorStore(t=>t.isShowingVisual),u.sql;const a=e.useEditorStore(t=>t.onSave),{getUpdatedFrame:o}=v.useVisualUtils();function c(){const t=o();a==null||a(t)}return s.jsxs(e.Button,{onClick:c,className:e.cn("h-8",d),size:"sm",variant:l,children:[s.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Accept"]})}function b({className:d,variant:l="default"}){const i=e.useQueryClient(),[u,a]=C.useState(!1),o=e.useDashboardStore(n=>n.actions.setIsDashboardPanelOpen),{setIsVisualEditing:c}=e.useDashboardActions(),{getUpdatedFrame:m}=v.useVisualUtils(),t=e.useSelectedVisual(),r=e.useEditorStore(n=>n.frame),y=e.useUpdateVisualMutation(),h=()=>{const n=m(),p=(r==null?void 0:r.visualId)||(t==null?void 0:t.id);if(!p){e.ue.error("No visual to save");return}a(!0),y.mutate({visualId:p,data:{frameObject:n}},{onSuccess:()=>{a(!1),o(!0),e.ue.success("Visual updated successfully"),i.invalidateQueries({queryKey:["resource-by-id","visual",p],exact:!0})},onError:()=>{a(!1),e.ue.error("Failed to update visual")}})};return s.jsxs(e.Button,{onClick:h,className:e.cn("h-8",d),size:"sm",variant:l,children:[u&&s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving"]}),!u&&s.jsxs(s.Fragment,{children:[s.jsx(E,{className:"mr-2 size-4 font-bold"}),"Save to Library"]})]})}function x({className:d}){const l=e.useQueryClient(),[i,u]=C.useState(!1),a=e.useSelectedVisual(),o=e.useEditorStore(n=>n.frame),c=e.useDashboardStore(n=>n.selectedSheetId),{updateFrame:m,setIsVisualEditing:t}=e.useDashboardActions(),{getUpdatedFrame:r}=v.useVisualUtils(),y=e.useUpdateVisualMutation(),h=async()=>{if(!c){e.ue.error("No sheet selected");return}const n=(o==null?void 0:o.visualId)||(a==null?void 0:a.id);if(!n){e.ue.error("No visual to update");return}u(!0);try{const p=r();await y.mutateAsync({visualId:n,data:{frameObject:p}});const f={...p,visualId:n};m(c,f),l.invalidateQueries({queryKey:["visuals"]}),l.invalidateQueries({queryKey:["visual",n]}),e.ue.success("Saved to library and applied locally"),setTimeout(()=>{t(!1)},300)}catch(p){console.error("Failed to save and apply:",p),e.ue.error("Failed to save and apply changes")}finally{u(!1)}};return s.jsx(e.Button,{onClick:h,className:e.cn("h-8",d),size:"sm",variant:"default",disabled:i,children:i?s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Saving..."]}):s.jsxs(s.Fragment,{children:[s.jsx(E,{className:"mr-2 size-4 font-bold"}),"Save & Apply"]})})}function A({className:d}){const{getUpdatedFrame:l}=v.useVisualUtils();e.useEditorStore(t=>t.frame);const i=e.useDashboardStore(t=>t.selectedSheetId),{updateFrame:u,setIsVisualEditing:a}=e.useDashboardActions(),[o,c]=C.useState(!1),m=()=>{if(!i){e.ue.error("No sheet selected");return}c(!0);const r={...l(),visualId:void 0};u(i,r),setTimeout(()=>{c(!1),e.ue.success("Changes applied. Visual is now local to this dashboard"),a(!1)},300)};return s.jsxs(e.Button,{onClick:m,className:e.cn("h-8",d),size:"sm",variant:"outline",children:[o&&s.jsxs(s.Fragment,{children:[s.jsx(e.LoaderCircle,{className:"mr-2 size-4 animate-spin font-bold"})," Applying"]}),!o&&s.jsxs(s.Fragment,{children:[s.jsx(e.Check,{className:"mr-2 size-4 font-bold"}),"Apply Locally"]})]})}function j({className:d}){const{setTempQueryData:l,setSqlGen:i}=e.useEditorActions(),u=e.useQueryClient(),a=e.useEditorStore(r=>r.tempQueryData),o=e.useEditorStore(r=>r.onClose),c=e.useEditorStore(r=>r.card),{queryKey:m}=e.useDashboardCardQuery(c);function t(){if(a){const{queryKey:r,queryData:y}=a;r&&y&&u.setQueryData(r,y)}i({}),o==null||o()}return s.jsxs(e.Button,{onClick:t,className:e.cn("h-8",d),size:"sm",variant:"outline",children:[s.jsx(e.X,{className:"mr-2 size-4"}),"Close"]})}function D(){const{setTempQueryData:d}=e.useEditorActions(),l=e.useQueryClient();e.useEditorStore(S=>S.isDevMode);const i=e.useEditorStore(S=>S.tempQueryData),u=e.useEditorStore(S=>S.card),{queryKey:a}=e.useDashboardCardQuery(u),{setCardSql:o,setSqlGen:c,setCardPython:m,setCardCustomCfg:t,setCardPreferences:r,updateDataSource:y,clearQueryConfig:h,setCardConfig:n,setCardType:p}=e.useEditorActions();function f(){const S=l.getQueryData(a);i!=null&&i.queryData||d({queryKey:a,queryData:S}),l.setQueryData(a,null),l.removeQueries({queryKey:a,exact:!0}),o(""),c({}),h(),n(void 0),m(""),t(""),r({}),p("bar")}return s.jsxs(e.Button,{onClick:f,className:"h-8",size:"sm",variant:"secondary",children:[s.jsx(e.X,{className:"mr-2 size-3.5"}),"Clear"]})}exports.EditorAcceptButton=g;exports.EditorCancelButton=j;exports.EditorClearButton=D;exports.Save=E;exports.VisualApplyLocalButton=A;exports.VisualSaveAndApplyButton=x;exports.VisualSaveButton=b;