drizzle-cube 0.4.16 → 0.4.18

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 (45) hide show
  1. package/dist/adapters/express/index.cjs +1 -1
  2. package/dist/adapters/express/index.js +1 -1
  3. package/dist/adapters/fastify/index.cjs +1 -1
  4. package/dist/adapters/fastify/index.js +1 -1
  5. package/dist/adapters/{handler-BmTtVoRu.js → handler-DefTXJpi.js} +442 -309
  6. package/dist/adapters/handler-hwoGzGex.cjs +33 -0
  7. package/dist/adapters/hono/index.cjs +1 -1
  8. package/dist/adapters/hono/index.js +1 -1
  9. package/dist/adapters/nextjs/index.cjs +1 -1
  10. package/dist/adapters/nextjs/index.js +1 -1
  11. package/dist/client/charts.js +2 -2
  12. package/dist/client/chunks/{analysis-builder-C5e52Z3p.js → analysis-builder-3z9fHE2F.js} +5 -5
  13. package/dist/client/chunks/{analysis-builder-C5e52Z3p.js.map → analysis-builder-3z9fHE2F.js.map} +1 -1
  14. package/dist/client/chunks/{analysis-builder-shared-EnM-8plh.js → analysis-builder-shared-Da-vlQa_.js} +2 -2
  15. package/dist/client/chunks/{analysis-builder-shared-EnM-8plh.js.map → analysis-builder-shared-Da-vlQa_.js.map} +1 -1
  16. package/dist/client/chunks/{chart-data-table-D5G8nMnb.js → chart-data-table-BsAjHe7o.js} +2 -2
  17. package/dist/client/chunks/{chart-data-table-D5G8nMnb.js.map → chart-data-table-BsAjHe7o.js.map} +1 -1
  18. package/dist/client/chunks/{chart-kpi-delta-Dgg2eYRl.js → chart-kpi-delta-DUD3f8vL.js} +3 -3
  19. package/dist/client/chunks/{chart-kpi-delta-Dgg2eYRl.js.map → chart-kpi-delta-DUD3f8vL.js.map} +1 -1
  20. package/dist/client/chunks/{chart-kpi-number-DkoO99c1.js → chart-kpi-number-iJh-PzsM.js} +2 -2
  21. package/dist/client/chunks/{chart-kpi-number-DkoO99c1.js.map → chart-kpi-number-iJh-PzsM.js.map} +1 -1
  22. package/dist/client/chunks/{chart-kpi-text-1O6_lmz7.js → chart-kpi-text-x6pV9v9Q.js} +2 -2
  23. package/dist/client/chunks/{chart-kpi-text-1O6_lmz7.js.map → chart-kpi-text-x6pV9v9Q.js.map} +1 -1
  24. package/dist/client/chunks/{charts-loader-AW3T1nv5.js → charts-loader-B3tt5oKG.js} +5 -5
  25. package/dist/client/chunks/{charts-loader-AW3T1nv5.js.map → charts-loader-B3tt5oKG.js.map} +1 -1
  26. package/dist/client/chunks/{components-BkeSy9xv.js → components-CMGGxqOB.js} +4 -4
  27. package/dist/client/chunks/{components-BkeSy9xv.js.map → components-CMGGxqOB.js.map} +1 -1
  28. package/dist/client/chunks/{icons-DAeqv1iX.js → icons-M7shurcH.js} +172 -160
  29. package/dist/client/chunks/icons-M7shurcH.js.map +1 -0
  30. package/dist/client/components/AgenticNotebook/AgentChatPanel.d.ts +6 -0
  31. package/dist/client/components/AgenticNotebook/index.d.ts +6 -0
  32. package/dist/client/components.js +1 -1
  33. package/dist/client/hooks/useAgentChat.d.ts +2 -2
  34. package/dist/client/icons/types.d.ts +2 -0
  35. package/dist/client/icons.js +1 -1
  36. package/dist/client/index.js +707 -675
  37. package/dist/client/index.js.map +1 -1
  38. package/dist/client/utils.js +3 -3
  39. package/dist/client-bundle-stats.html +1 -1
  40. package/dist/server/index.cjs +49 -41
  41. package/dist/server/index.d.ts +45 -0
  42. package/dist/server/index.js +2795 -2662
  43. package/package.json +1 -1
  44. package/dist/adapters/handler-B6yAJw_O.cjs +0 -25
  45. package/dist/client/chunks/icons-DAeqv1iX.js.map +0 -1
@@ -1,139 +1,139 @@
1
- import { D as re, A as ae, e as ce, P as ne } from "./chunks/components-BkeSy9xv.js";
2
- import { i as ot, a as dt, C as it, h as lt, g as ut, b as mt, j as pt, f as ht, d as ft, M as gt, c as bt, n as yt, T as xt, R as vt, Q as Ct, O as kt, S as Nt, V as wt, I as St, H as Dt, K as At, W as Tt, G as Mt, J as It, X as Et, L as Rt, N as Bt, U as Lt, Y as Pt, Z as Qt, z as Ft, q as _t, x as Vt, t as jt, s as qt, w as Ut, p as Kt, v as Ot, o as $t, r as zt, y as Wt, u as Jt, k as Gt, l as Ht, m as Xt, F as Yt, E as Zt, B as es } from "./chunks/components-BkeSy9xv.js";
3
- import { jsx as r, jsxs as x, Fragment as oe } from "react/jsx-runtime";
4
- import Q, { useRef as C, createContext as de, useContext as ie, useState as j, useCallback as g, useEffect as P } from "react";
5
- import { c as le, d as ue, e as me, s as pe, f as O } from "./chunks/vendor-AVsJ2ni0.js";
6
- import { a as q } from "./chunks/icons-DAeqv1iX.js";
7
- import { D as ss, h as rs, i as as, b as cs, e as ns, f as os, g as ds, r as is, c as ls, s as us } from "./chunks/icons-DAeqv1iX.js";
8
- import { Q as he } from "./chunks/chart-markdown-Du4Z2iqK.js";
9
- import { f as fe } from "./chunks/providers-CgxXm6Ll.js";
10
- import { h as ps, a as hs, S as fs, e as gs, d as bs, i as ys, b as xs, g as vs, u as Cs, j as ks, c as Ns, w as ws } from "./chunks/providers-CgxXm6Ll.js";
11
- import { L as ge } from "./chunks/charts-core-CU9u_HtL.js";
12
- import { u as Ds } from "./chunks/charts-core-CU9u_HtL.js";
13
- import { L as Ts, g as Ms, c as Is, b as Es, i as Rs, p as Bs, a as Ls } from "./chunks/charts-loader-AW3T1nv5.js";
14
- import { E as Qs, a as Fs, p as _s, q as Vs, m as js, l as qs, r as Us, C as Ks, D as Os, o as $s, B as zs, n as Ws, w as Js, t as Gs, d as Hs, f as Xs, s as Ys, e as Zs, i as er, c as tr, h as sr, g as rr, u as ar, b as cr, y as nr, A as or, x as dr, k as ir, v as lr, z as ur, j as mr } from "./chunks/analysis-builder-shared-EnM-8plh.js";
15
- import { u as hr } from "./chunks/chart-bubble-CemotLx-.js";
16
- import { c as gr, f as br } from "./chunks/index-CApFCBF9.js";
17
- import { e as xr, c as vr, l as Cr, h as kr, k as Nr, j as wr, i as Sr, m as Dr, g as Ar, f as Tr, u as Mr, u as Ir, d as Er, b as Rr, a as Br, v as Lr } from "./chunks/useDirtyStateTracking-Cu1HSjmo.js";
18
- import { c as Qr, b as Fr, f as _r, g as Vr, a as jr, i as qr, t as Ur } from "./chunks/funnel-utils-CyonoNeC.js";
19
- import { T as Or, c as $r, g as zr, a as Wr, i as Jr, r as Gr, s as Hr, b as Xr, w as Yr } from "./chunks/theme-Dp3hFed1.js";
20
- import { createExplainQueryKey as ea, useDryRunQueries as ta, useDryRunQuery as sa, useExplainAI as ra, useExplainQuery as aa, useMultiDryRunQueries as ca } from "./hooks.js";
21
- import { i as oa, a as da } from "./chunks/flow-utils-CjQZG5qq.js";
22
- import { h as la } from "./chunks/syntaxHighlighting-BQfjio-i.js";
23
- const J = () => ({
1
+ import { D as me, A as pe, e as he, P as fe } from "./chunks/components-CMGGxqOB.js";
2
+ import { i as bt, a as yt, C as xt, h as vt, g as Ct, b as Nt, j as kt, f as wt, d as St, M as Tt, c as Dt, n as At, T as Mt, R as It, Q as Et, O as Rt, S as Bt, V as Lt, I as Pt, H as Qt, K as Ft, W as _t, G as Vt, J as jt, X as Ut, L as qt, N as Kt, U as Ot, Y as $t, Z as zt, z as Wt, q as Jt, x as Gt, t as Ht, s as Yt, w as Xt, p as Zt, v as es, o as ts, r as ss, y as rs, u as cs, k as as, l as ns, m as os, F as ds, E as is, B as ls } from "./chunks/components-CMGGxqOB.js";
3
+ import { jsx as s, jsxs as f, Fragment as te } from "react/jsx-runtime";
4
+ import V, { useRef as v, createContext as ge, useContext as be, useState as _, useCallback as h, useEffect as F } from "react";
5
+ import { c as ye, d as xe, e as ve, s as Ce, f as z } from "./chunks/vendor-AVsJ2ni0.js";
6
+ import { a as j } from "./chunks/icons-M7shurcH.js";
7
+ import { D as ms, h as ps, i as hs, b as fs, e as gs, f as bs, g as ys, r as xs, c as vs, s as Cs } from "./chunks/icons-M7shurcH.js";
8
+ import { Q as Ne } from "./chunks/chart-markdown-Du4Z2iqK.js";
9
+ import { f as ke } from "./chunks/providers-CgxXm6Ll.js";
10
+ import { h as ks, a as ws, S as Ss, e as Ts, d as Ds, i as As, b as Ms, g as Is, u as Es, j as Rs, c as Bs, w as Ls } from "./chunks/providers-CgxXm6Ll.js";
11
+ import { L as we } from "./chunks/charts-core-CU9u_HtL.js";
12
+ import { u as Qs } from "./chunks/charts-core-CU9u_HtL.js";
13
+ import { L as _s, g as Vs, c as js, b as Us, i as qs, p as Ks, a as Os } from "./chunks/charts-loader-B3tt5oKG.js";
14
+ import { E as zs, a as Ws, p as Js, q as Gs, m as Hs, l as Ys, r as Xs, C as Zs, D as er, o as tr, B as sr, n as rr, w as cr, t as ar, d as nr, f as or, s as dr, e as ir, i as lr, c as ur, h as mr, g as pr, u as hr, b as fr, y as gr, A as br, x as yr, k as xr, v as vr, z as Cr, j as Nr } from "./chunks/analysis-builder-shared-Da-vlQa_.js";
15
+ import { u as wr } from "./chunks/chart-bubble-CemotLx-.js";
16
+ import { c as Tr, f as Dr } from "./chunks/index-CApFCBF9.js";
17
+ import { e as Mr, c as Ir, l as Er, h as Rr, k as Br, j as Lr, i as Pr, m as Qr, g as Fr, f as _r, u as Vr, u as jr, d as Ur, b as qr, a as Kr, v as Or } from "./chunks/useDirtyStateTracking-Cu1HSjmo.js";
18
+ import { c as zr, b as Wr, f as Jr, g as Gr, a as Hr, i as Yr, t as Xr } from "./chunks/funnel-utils-CyonoNeC.js";
19
+ import { T as ec, c as tc, g as sc, a as rc, i as cc, r as ac, s as nc, b as oc, w as dc } from "./chunks/theme-Dp3hFed1.js";
20
+ import { createExplainQueryKey as lc, useDryRunQueries as uc, useDryRunQuery as mc, useExplainAI as pc, useExplainQuery as hc, useMultiDryRunQueries as fc } from "./hooks.js";
21
+ import { i as bc, a as yc } from "./chunks/flow-utils-CjQZG5qq.js";
22
+ import { h as vc } from "./chunks/syntaxHighlighting-BQfjio-i.js";
23
+ const se = () => ({
24
24
  blocks: [],
25
25
  messages: [],
26
26
  isStreaming: !1,
27
27
  sessionId: null,
28
28
  inputValue: ""
29
29
  });
30
- function be(e, t) {
30
+ function Se(e, t) {
31
31
  return {
32
32
  // Block actions
33
- addBlock: (s) => e((c) => ({
34
- blocks: [...c.blocks, s]
33
+ addBlock: (r) => e((n) => ({
34
+ blocks: [...n.blocks, r]
35
35
  })),
36
- removeBlock: (s) => e((c) => ({
37
- blocks: c.blocks.filter((a) => a.id !== s)
36
+ removeBlock: (r) => e((n) => ({
37
+ blocks: n.blocks.filter((c) => c.id !== r)
38
38
  })),
39
- moveBlock: (s, c) => e((a) => {
40
- const n = a.blocks.findIndex((d) => d.id === s);
41
- if (n === -1) return {};
42
- if (c === "up" && n === 0) return {};
43
- if (c === "down" && n === a.blocks.length - 1) return {};
44
- const o = [...a.blocks], l = c === "up" ? n - 1 : n + 1;
45
- return [o[n], o[l]] = [o[l], o[n]], { blocks: o };
39
+ moveBlock: (r, n) => e((c) => {
40
+ const a = c.blocks.findIndex((u) => u.id === r);
41
+ if (a === -1) return {};
42
+ if (n === "up" && a === 0) return {};
43
+ if (n === "down" && a === c.blocks.length - 1) return {};
44
+ const o = [...c.blocks], p = n === "up" ? a - 1 : a + 1;
45
+ return [o[a], o[p]] = [o[p], o[a]], { blocks: o };
46
46
  }),
47
- updateBlock: (s, c) => e((a) => ({
48
- blocks: a.blocks.map(
49
- (n) => n.id === s && n.type === "portlet" ? { ...n, ...c } : n
47
+ updateBlock: (r, n) => e((c) => ({
48
+ blocks: c.blocks.map(
49
+ (a) => a.id === r && a.type === "portlet" ? { ...a, ...n } : a
50
50
  )
51
51
  })),
52
52
  // Chat actions
53
- addMessage: (s) => e((c) => ({
54
- messages: [...c.messages, s]
53
+ addMessage: (r) => e((n) => ({
54
+ messages: [...n.messages, r]
55
55
  })),
56
- appendToLastAssistantMessage: (s) => e((c) => {
57
- const a = [...c.messages], n = a[a.length - 1];
58
- return n && n.role === "assistant" && (a[a.length - 1] = {
59
- ...n,
60
- content: n.content + s
61
- }), { messages: a };
56
+ appendToLastAssistantMessage: (r) => e((n) => {
57
+ const c = [...n.messages], a = c[c.length - 1];
58
+ return a && a.role === "assistant" && (c[c.length - 1] = {
59
+ ...a,
60
+ content: a.content + r
61
+ }), { messages: c };
62
62
  }),
63
- setLastAssistantError: (s) => e((c) => {
64
- const a = [...c.messages], n = a[a.length - 1];
65
- return n && n.role === "assistant" && (a[a.length - 1] = { ...n, error: s }), { messages: a };
63
+ setLastAssistantError: (r) => e((n) => {
64
+ const c = [...n.messages], a = c[c.length - 1];
65
+ return a && a.role === "assistant" && (c[c.length - 1] = { ...a, error: r }), { messages: c };
66
66
  }),
67
- addToolCallToLastAssistant: (s) => e((c) => {
68
- const a = [...c.messages], n = a[a.length - 1];
69
- return n && n.role === "assistant" && (a[a.length - 1] = {
70
- ...n,
71
- toolCalls: [...n.toolCalls || [], s]
72
- }), { messages: a };
67
+ addToolCallToLastAssistant: (r) => e((n) => {
68
+ const c = [...n.messages], a = c[c.length - 1];
69
+ return a && a.role === "assistant" && (c[c.length - 1] = {
70
+ ...a,
71
+ toolCalls: [...a.toolCalls || [], r]
72
+ }), { messages: c };
73
73
  }),
74
- updateLastToolCall: (s) => e((c) => {
75
- const a = [...c.messages], n = a[a.length - 1];
76
- if (n?.role === "assistant" && n.toolCalls?.length) {
77
- const o = [...n.toolCalls], l = s.id ? o.findIndex((d) => d.id === s.id) : o.length - 1;
78
- l !== -1 && (o[l] = { ...o[l], ...s }, a[a.length - 1] = { ...n, toolCalls: o });
74
+ updateLastToolCall: (r) => e((n) => {
75
+ const c = [...n.messages], a = c[c.length - 1];
76
+ if (a?.role === "assistant" && a.toolCalls?.length) {
77
+ const o = [...a.toolCalls], p = r.id ? o.findIndex((u) => u.id === r.id) : o.length - 1;
78
+ p !== -1 && (o[p] = { ...o[p], ...r }, c[c.length - 1] = { ...a, toolCalls: o });
79
79
  }
80
- return { messages: a };
80
+ return { messages: c };
81
81
  }),
82
82
  // Session/UI actions
83
- setIsStreaming: (s) => e({ isStreaming: s }),
84
- setSessionId: (s) => e({ sessionId: s }),
85
- setInputValue: (s) => e({ inputValue: s }),
83
+ setIsStreaming: (r) => e({ isStreaming: r }),
84
+ setSessionId: (r) => e({ sessionId: r }),
85
+ setInputValue: (r) => e({ inputValue: r }),
86
86
  // Persistence
87
87
  save: () => {
88
- const s = t();
88
+ const r = t();
89
89
  return {
90
- blocks: s.blocks,
91
- messages: s.messages
90
+ blocks: r.blocks,
91
+ messages: r.messages
92
92
  };
93
93
  },
94
- load: (s) => e({
95
- blocks: s.blocks || [],
96
- messages: s.messages || []
94
+ load: (r) => e({
95
+ blocks: r.blocks || [],
96
+ messages: r.messages || []
97
97
  }),
98
98
  // Reset
99
- reset: () => e(J())
99
+ reset: () => e(se())
100
100
  };
101
101
  }
102
- function ye() {
103
- const e = J();
104
- return ue()(
105
- me(
106
- pe((t, s) => ({
102
+ function Te() {
103
+ const e = se();
104
+ return xe()(
105
+ ve(
106
+ Ce((t, r) => ({
107
107
  ...e,
108
- ...be(t, s)
108
+ ...Se(t, r)
109
109
  })),
110
110
  { name: "NotebookStore" }
111
111
  )
112
112
  );
113
113
  }
114
- const G = de(null);
115
- function xe({
114
+ const re = ge(null);
115
+ function De({
116
116
  children: e,
117
117
  initialConfig: t
118
118
  }) {
119
- const s = C(null);
120
- if (!s.current) {
121
- const c = ye();
122
- t && c.getState().load(t), s.current = c;
119
+ const r = v(null);
120
+ if (!r.current) {
121
+ const n = Te();
122
+ t && n.getState().load(t), r.current = n;
123
123
  }
124
- return /* @__PURE__ */ r(G.Provider, { value: s.current, children: e });
124
+ return /* @__PURE__ */ s(re.Provider, { value: r.current, children: e });
125
125
  }
126
126
  function A(e) {
127
- const t = ie(G);
127
+ const t = be(re);
128
128
  if (!t)
129
129
  throw new Error("useNotebookStore must be used within NotebookStoreProvider");
130
- return le(t, e);
130
+ return ye(t, e);
131
131
  }
132
- const ve = (e) => e.blocks, Ye = (e) => e.messages, Ze = (e) => e.isStreaming, et = (e) => e.sessionId, tt = (e) => e.inputValue, Ce = (e) => ({
132
+ const Ae = (e) => e.blocks, dt = (e) => e.messages, it = (e) => e.isStreaming, lt = (e) => e.sessionId, ut = (e) => e.inputValue, Me = (e) => ({
133
133
  messages: e.messages,
134
134
  isStreaming: e.isStreaming,
135
135
  inputValue: e.inputValue
136
- }), ke = (e) => ({
136
+ }), Ie = (e) => ({
137
137
  addMessage: e.addMessage,
138
138
  appendToLastAssistantMessage: e.appendToLastAssistantMessage,
139
139
  setLastAssistantError: e.setLastAssistantError,
@@ -142,80 +142,80 @@ const ve = (e) => e.blocks, Ye = (e) => e.messages, Ze = (e) => e.isStreaming, e
142
142
  setIsStreaming: e.setIsStreaming,
143
143
  setInputValue: e.setInputValue,
144
144
  setSessionId: e.setSessionId
145
- }), Ne = (e) => ({
145
+ }), Ee = (e) => ({
146
146
  addBlock: e.addBlock,
147
147
  removeBlock: e.removeBlock,
148
148
  moveBlock: e.moveBlock,
149
149
  updateBlock: e.updateBlock
150
- }), K = { width: "16px", height: "16px", color: "currentColor" }, we = q("chevronUp"), Se = q("chevronDown"), De = q("edit"), Ae = q("delete"), Te = Q.memo(function({
150
+ }), O = { width: "16px", height: "16px", color: "currentColor" }, Re = j("chevronUp"), Be = j("chevronDown"), Le = j("edit"), Pe = j("delete"), Qe = V.memo(function({
151
151
  block: t,
152
- onRemove: s,
153
- onMoveUp: c,
154
- onMoveDown: a,
155
- onEdit: n,
152
+ onRemove: r,
153
+ onMoveUp: n,
154
+ onMoveDown: c,
155
+ onEdit: a,
156
156
  isFirst: o,
157
- isLast: l
157
+ isLast: p
158
158
  }) {
159
- const [d, w] = j(null), m = g((k) => {
160
- w(k);
159
+ const [u, w] = _(null), x = h((N) => {
160
+ w(N);
161
161
  }, []);
162
- return /* @__PURE__ */ x("div", { className: "dc:relative dc:mb-4 bg-dc-surface dc:border border-dc-border dc:rounded-lg dc:flex dc:flex-col", children: [
163
- /* @__PURE__ */ x("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-3 dc:py-1.5 dc:border-b border-dc-border dc:shrink-0 bg-dc-surface-secondary dc:rounded-t-lg", children: [
164
- /* @__PURE__ */ x("div", { className: "dc:flex dc:items-center dc:gap-2 dc:flex-1 dc:min-w-0", children: [
165
- /* @__PURE__ */ r("h3", { className: "dc:font-semibold dc:text-sm text-dc-text dc:truncate", children: t.title || "Untitled" }),
166
- d && /* @__PURE__ */ r(
167
- re,
162
+ return /* @__PURE__ */ f("div", { className: "dc:relative dc:mb-4 bg-dc-surface dc:border border-dc-border dc:rounded-lg dc:flex dc:flex-col", children: [
163
+ /* @__PURE__ */ f("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-3 dc:py-1.5 dc:border-b border-dc-border dc:shrink-0 bg-dc-surface-secondary dc:rounded-t-lg", children: [
164
+ /* @__PURE__ */ f("div", { className: "dc:flex dc:items-center dc:gap-2 dc:flex-1 dc:min-w-0", children: [
165
+ /* @__PURE__ */ s("h3", { className: "dc:font-semibold dc:text-sm text-dc-text dc:truncate", children: t.title || "Untitled" }),
166
+ u && /* @__PURE__ */ s(
167
+ me,
168
168
  {
169
- chartConfig: d.chartConfig,
170
- displayConfig: d.displayConfig,
171
- queryObject: d.queryObject,
172
- data: d.data,
173
- chartType: d.chartType,
174
- cacheInfo: d.cacheInfo ?? void 0
169
+ chartConfig: u.chartConfig,
170
+ displayConfig: u.displayConfig,
171
+ queryObject: u.queryObject,
172
+ data: u.data,
173
+ chartType: u.chartType,
174
+ cacheInfo: u.cacheInfo ?? void 0
175
175
  }
176
176
  )
177
177
  ] }),
178
- /* @__PURE__ */ x("div", { className: "dc:flex dc:items-center dc:gap-1 dc:shrink-0 dc:ml-4 dc:-mr-2", children: [
179
- !o && /* @__PURE__ */ r(
178
+ /* @__PURE__ */ f("div", { className: "dc:flex dc:items-center dc:gap-1 dc:shrink-0 dc:ml-4 dc:-mr-2", children: [
179
+ !o && /* @__PURE__ */ s(
180
180
  "button",
181
181
  {
182
- onClick: () => c(t.id),
182
+ onClick: () => n(t.id),
183
183
  className: "dc:p-1 dc:bg-transparent dc:border-none dc:rounded-sm text-dc-text-secondary dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
184
184
  title: "Move up",
185
- children: /* @__PURE__ */ r(we, { style: K })
185
+ children: /* @__PURE__ */ s(Re, { style: O })
186
186
  }
187
187
  ),
188
- !l && /* @__PURE__ */ r(
188
+ !p && /* @__PURE__ */ s(
189
189
  "button",
190
190
  {
191
- onClick: () => a(t.id),
191
+ onClick: () => c(t.id),
192
192
  className: "dc:p-1 dc:bg-transparent dc:border-none dc:rounded-sm text-dc-text-secondary dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
193
193
  title: "Move down",
194
- children: /* @__PURE__ */ r(Se, { style: K })
194
+ children: /* @__PURE__ */ s(Be, { style: O })
195
195
  }
196
196
  ),
197
- /* @__PURE__ */ r(
197
+ /* @__PURE__ */ s(
198
198
  "button",
199
199
  {
200
- onClick: () => n(t),
200
+ onClick: () => a(t),
201
201
  className: "dc:p-1 dc:bg-transparent dc:border-none dc:rounded-sm text-dc-text-secondary dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
202
202
  title: "Edit visualization",
203
- children: /* @__PURE__ */ r(De, { style: K })
203
+ children: /* @__PURE__ */ s(Le, { style: O })
204
204
  }
205
205
  ),
206
- /* @__PURE__ */ r(
206
+ /* @__PURE__ */ s(
207
207
  "button",
208
208
  {
209
- onClick: () => s(t.id),
209
+ onClick: () => r(t.id),
210
210
  className: "dc:p-1 dc:mr-0.5 dc:bg-transparent dc:border-none dc:rounded-sm dc:cursor-pointer dc:hover:bg-dc-danger-bg text-dc-danger dc:transition-colors",
211
211
  title: "Remove",
212
- children: /* @__PURE__ */ r(Ae, { style: K })
212
+ children: /* @__PURE__ */ s(Pe, { style: O })
213
213
  }
214
214
  )
215
215
  ] })
216
216
  ] }),
217
- /* @__PURE__ */ r("div", { className: "dc:flex-1 dc:min-h-0", children: /* @__PURE__ */ r(
218
- ae,
217
+ /* @__PURE__ */ s("div", { className: "dc:flex-1 dc:min-h-0", children: /* @__PURE__ */ s(
218
+ pe,
219
219
  {
220
220
  query: t.query,
221
221
  chartType: t.chartType,
@@ -223,11 +223,11 @@ const ve = (e) => e.blocks, Ye = (e) => e.messages, Ze = (e) => e.isStreaming, e
223
223
  displayConfig: t.displayConfig,
224
224
  height: 400,
225
225
  eagerLoad: !0,
226
- onDebugDataReady: m
226
+ onDebugDataReady: x
227
227
  }
228
228
  ) })
229
229
  ] });
230
- }), Me = {
230
+ }), Fe = {
231
231
  overrides: {
232
232
  h1: { props: { className: "dc:text-lg dc:font-bold text-dc-text dc:mb-2 dc:mt-3" } },
233
233
  h2: { props: { className: "dc:text-base dc:font-semibold text-dc-text dc:mb-2 dc:mt-3" } },
@@ -248,105 +248,105 @@ const ve = (e) => e.blocks, Ye = (e) => e.messages, Ze = (e) => e.isStreaming, e
248
248
  td: { props: { className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text border-dc-border dc:border-b" } },
249
249
  tr: { props: { className: "dc:hover:opacity-80" } }
250
250
  }
251
- }, Ie = Q.memo(function({
251
+ }, _e = V.memo(function({
252
252
  block: t,
253
- onRemove: s,
254
- onMoveUp: c,
255
- onMoveDown: a,
256
- isFirst: n,
253
+ onRemove: r,
254
+ onMoveUp: n,
255
+ onMoveDown: c,
256
+ isFirst: a,
257
257
  isLast: o
258
258
  }) {
259
- return /* @__PURE__ */ x("div", { className: "dc:group dc:relative dc:mb-4", children: [
260
- /* @__PURE__ */ x("div", { className: "dc:absolute dc:right-2 dc:top-2 dc:z-10 dc:flex dc:gap-1 dc:opacity-0 dc:group-hover:opacity-100 dc:transition-opacity", children: [
261
- !n && /* @__PURE__ */ r(
259
+ return /* @__PURE__ */ f("div", { className: "dc:group dc:relative dc:mb-4", children: [
260
+ /* @__PURE__ */ f("div", { className: "dc:absolute dc:right-2 dc:top-2 dc:z-10 dc:flex dc:gap-1 dc:opacity-0 dc:group-hover:opacity-100 dc:transition-opacity", children: [
261
+ !a && /* @__PURE__ */ s(
262
262
  "button",
263
263
  {
264
- onClick: () => c(t.id),
264
+ onClick: () => n(t.id),
265
265
  className: "dc:p-1 dc:rounded dc:text-xs bg-dc-surface text-dc-text-secondary dc:hover:opacity-80 border-dc-border dc:border",
266
266
  title: "Move up",
267
267
  children: "▲"
268
268
  }
269
269
  ),
270
- !o && /* @__PURE__ */ r(
270
+ !o && /* @__PURE__ */ s(
271
271
  "button",
272
272
  {
273
- onClick: () => a(t.id),
273
+ onClick: () => c(t.id),
274
274
  className: "dc:p-1 dc:rounded dc:text-xs bg-dc-surface text-dc-text-secondary dc:hover:opacity-80 border-dc-border dc:border",
275
275
  title: "Move down",
276
276
  children: "▼"
277
277
  }
278
278
  ),
279
- /* @__PURE__ */ r(
279
+ /* @__PURE__ */ s(
280
280
  "button",
281
281
  {
282
- onClick: () => s(t.id),
282
+ onClick: () => r(t.id),
283
283
  className: "dc:p-1 dc:rounded dc:text-xs text-dc-error dc:hover:opacity-80 bg-dc-surface border-dc-border dc:border",
284
284
  title: "Remove",
285
285
  children: "✕"
286
286
  }
287
287
  )
288
288
  ] }),
289
- t.title && /* @__PURE__ */ r("h4", { className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2 dc:px-1", children: t.title }),
290
- /* @__PURE__ */ r("div", { className: "dc:rounded-lg dc:p-4 bg-dc-surface border-dc-border dc:border", children: /* @__PURE__ */ r(he, { options: Me, children: t.content }) })
289
+ t.title && /* @__PURE__ */ s("h4", { className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2 dc:px-1", children: t.title }),
290
+ /* @__PURE__ */ s("div", { className: "dc:rounded-lg dc:p-4 bg-dc-surface border-dc-border dc:border", children: /* @__PURE__ */ s(Ne, { options: Fe, children: t.content }) })
291
291
  ] });
292
- }), Ee = Q.memo(function() {
293
- const t = A(ve), { removeBlock: s, moveBlock: c, updateBlock: a } = A(O(Ne)), n = C(null), [o, l] = j(null), d = C(t.length);
294
- P(() => {
295
- t.length > d.current && n.current?.scrollIntoView({ behavior: "smooth" }), d.current = t.length;
292
+ }), Ve = V.memo(function() {
293
+ const t = A(Ae), { removeBlock: r, moveBlock: n, updateBlock: c } = A(z(Ee)), a = v(null), [o, p] = _(null), u = v(t.length);
294
+ F(() => {
295
+ t.length > u.current && a.current?.scrollIntoView({ behavior: "smooth" }), u.current = t.length;
296
296
  }, [t.length]);
297
- const w = g((p) => s(p), [s]), m = g((p) => c(p, "up"), [c]), k = g((p) => c(p, "down"), [c]), h = g((p) => l(p), []), N = g((p) => {
297
+ const w = h((l) => r(l), [r]), x = h((l) => n(l, "up"), [n]), N = h((l) => n(l, "down"), [n]), y = h((l) => p(l), []), S = h((l) => {
298
298
  if (!o) return;
299
- const i = ce(p), { analysisConfig: f } = i;
300
- if (f) {
301
- const b = f.charts[f.analysisType];
302
- a(o.id, {
303
- title: p.title,
304
- query: JSON.stringify(f.query),
305
- chartType: b?.chartType || "bar",
306
- chartConfig: b?.chartConfig,
307
- displayConfig: b?.displayConfig
299
+ const d = he(l), { analysisConfig: i } = d;
300
+ if (i) {
301
+ const k = i.charts[i.analysisType];
302
+ c(o.id, {
303
+ title: l.title,
304
+ query: JSON.stringify(i.query),
305
+ chartType: k?.chartType || "bar",
306
+ chartConfig: k?.chartConfig,
307
+ displayConfig: k?.displayConfig
308
308
  });
309
309
  }
310
- l(null);
311
- }, [o, a]);
312
- return t.length === 0 ? /* @__PURE__ */ r("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ x("div", { className: "dc:text-center dc:max-w-sm dc:px-6", children: [
313
- /* @__PURE__ */ r("h3", { className: "dc:text-base dc:font-semibold text-dc-text dc:mb-2", children: "Your notebook is empty" }),
314
- /* @__PURE__ */ r("p", { className: "dc:text-sm text-dc-text-secondary", children: "Ask the AI assistant a question about your data. Charts and insights will appear here as the assistant analyzes your data." })
315
- ] }) }) : /* @__PURE__ */ x("div", { className: "dc:h-full dc:overflow-y-auto dc:p-4", children: [
316
- t.map((p, i) => {
317
- const f = i === 0, b = i === t.length - 1;
318
- return p.type === "portlet" ? /* @__PURE__ */ r(
319
- Te,
310
+ p(null);
311
+ }, [o, c]);
312
+ return t.length === 0 ? /* @__PURE__ */ s("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ f("div", { className: "dc:text-center dc:max-w-sm dc:px-6", children: [
313
+ /* @__PURE__ */ s("h3", { className: "dc:text-base dc:font-semibold text-dc-text dc:mb-2", children: "Your notebook is empty" }),
314
+ /* @__PURE__ */ s("p", { className: "dc:text-sm text-dc-text-secondary", children: "Ask the AI assistant a question about your data. Charts and insights will appear here as the assistant analyzes your data." })
315
+ ] }) }) : /* @__PURE__ */ f("div", { className: "dc:h-full dc:overflow-y-auto dc:p-4", children: [
316
+ t.map((l, d) => {
317
+ const i = d === 0, k = d === t.length - 1;
318
+ return l.type === "portlet" ? /* @__PURE__ */ s(
319
+ Qe,
320
320
  {
321
- block: p,
321
+ block: l,
322
322
  onRemove: w,
323
- onMoveUp: m,
324
- onMoveDown: k,
325
- onEdit: h,
326
- isFirst: f,
327
- isLast: b
323
+ onMoveUp: x,
324
+ onMoveDown: N,
325
+ onEdit: y,
326
+ isFirst: i,
327
+ isLast: k
328
328
  },
329
- p.id
330
- ) : p.type === "markdown" ? /* @__PURE__ */ r(
331
- Ie,
329
+ l.id
330
+ ) : l.type === "markdown" ? /* @__PURE__ */ s(
331
+ _e,
332
332
  {
333
- block: p,
333
+ block: l,
334
334
  onRemove: w,
335
- onMoveUp: m,
336
- onMoveDown: k,
337
- isFirst: f,
338
- isLast: b
335
+ onMoveUp: x,
336
+ onMoveDown: N,
337
+ isFirst: i,
338
+ isLast: k
339
339
  },
340
- p.id
340
+ l.id
341
341
  ) : null;
342
342
  }),
343
- /* @__PURE__ */ r("div", { ref: n }),
344
- /* @__PURE__ */ r(
345
- ne,
343
+ /* @__PURE__ */ s("div", { ref: a }),
344
+ /* @__PURE__ */ s(
345
+ fe,
346
346
  {
347
347
  isOpen: !!o,
348
- onClose: () => l(null),
349
- onSave: N,
348
+ onClose: () => p(null),
349
+ onSave: S,
350
350
  portlet: o ? {
351
351
  id: o.id,
352
352
  title: o.title,
@@ -365,16 +365,16 @@ const ve = (e) => e.blocks, Ye = (e) => e.messages, Ze = (e) => e.isStreaming, e
365
365
  )
366
366
  ] });
367
367
  });
368
- function Re(e) {
368
+ function je(e) {
369
369
  if (e.startsWith("{") || e.includes('"type":"error"'))
370
370
  try {
371
- const t = JSON.parse(e.replace(/^Error:\s*/, "")), s = t.error?.type || t.type || "";
371
+ const t = JSON.parse(e.replace(/^Error:\s*/, "")), r = t.error?.type || t.type || "";
372
372
  return {
373
373
  overloaded_error: "The AI service is temporarily busy. Please try again in a moment.",
374
374
  rate_limit_error: "Too many requests. Please wait a moment and try again.",
375
375
  api_error: "The AI service encountered an error. Please try again.",
376
376
  authentication_error: "Authentication failed. Please check your configuration."
377
- }[s] || "The AI service encountered an error. Please try again.";
377
+ }[r] || "The AI service encountered an error. Please try again.";
378
378
  } catch {
379
379
  return "The AI service encountered an error. Please try again.";
380
380
  }
@@ -384,391 +384,394 @@ function Re(e) {
384
384
  }
385
385
  return e;
386
386
  }
387
- function Be(e) {
388
- const { agentEndpoint: t, agentApiKey: s } = e, { cubeApi: c } = fe(), a = C(null), [n, o] = j(!1), l = C(e);
389
- l.current = e;
390
- const d = g(async (m, k, h) => {
391
- function N(i) {
392
- const f = l.current;
393
- switch (i.type) {
387
+ function Ue(e) {
388
+ const { agentEndpoint: t, agentApiKey: r } = e, { cubeApi: n } = ke(), c = v(null), [a, o] = _(!1), p = v(e);
389
+ p.current = e;
390
+ const u = h(async (x, N, y) => {
391
+ function S(d) {
392
+ const i = p.current;
393
+ switch (d.type) {
394
394
  case "text_delta":
395
- f.onTextDelta(i.data);
395
+ i.onTextDelta(d.data);
396
396
  break;
397
397
  case "tool_use_start":
398
- f.onToolStart(i.data.id, i.data.name, i.data.input);
398
+ i.onToolStart(d.data.id, d.data.name, d.data.input);
399
399
  break;
400
400
  case "tool_use_result":
401
- f.onToolResult(i.data.id, i.data.name, i.data.result, i.data.isError);
401
+ i.onToolResult(d.data.id, d.data.name, d.data.result, d.data.isError);
402
402
  break;
403
403
  case "add_portlet":
404
- f.onAddPortlet({
405
- ...i.data,
404
+ i.onAddPortlet({
405
+ ...d.data,
406
406
  type: "portlet"
407
407
  });
408
408
  break;
409
409
  case "add_markdown":
410
- f.onAddMarkdown({
411
- ...i.data,
410
+ i.onAddMarkdown({
411
+ ...d.data,
412
412
  type: "markdown"
413
413
  });
414
414
  break;
415
415
  case "dashboard_saved":
416
- f.onDashboardSaved?.(i.data);
416
+ i.onDashboardSaved?.(d.data);
417
417
  break;
418
418
  case "turn_complete":
419
- f.onTurnComplete?.();
419
+ i.onTurnComplete?.();
420
420
  break;
421
421
  case "done":
422
- f.onDone(i.data.sessionId);
422
+ i.onDone(d.data.sessionId, d.data.traceId);
423
423
  break;
424
424
  case "error":
425
- f.onError(i.data.message);
425
+ i.onError(d.data.message);
426
426
  break;
427
427
  }
428
428
  }
429
- a.current && a.current.abort();
430
- const p = new AbortController();
431
- a.current = p, o(!0);
429
+ c.current && c.current.abort();
430
+ const l = new AbortController();
431
+ c.current = l, o(!0);
432
432
  try {
433
- const i = c.apiUrl || "/cubejs-api/v1", f = t || `${i}/agent/chat`, b = {
433
+ const d = n.apiUrl || "/cubejs-api/v1", i = t || `${d}/agent/chat`, k = {
434
434
  "Content-Type": "application/json",
435
- ...c.headers
435
+ ...n.headers
436
436
  };
437
- s && (b["X-Agent-Api-Key"] = s);
438
- const v = await fetch(f, {
437
+ r && (k["X-Agent-Api-Key"] = r);
438
+ const b = await fetch(i, {
439
439
  method: "POST",
440
- headers: b,
441
- credentials: c.credentials ?? "include",
440
+ headers: k,
441
+ credentials: n.credentials ?? "include",
442
442
  body: JSON.stringify({
443
- message: m,
444
- ...k ? { sessionId: k } : {},
445
- ...h && h.length > 0 ? { history: h } : {}
443
+ message: x,
444
+ ...N ? { sessionId: N } : {},
445
+ ...y && y.length > 0 ? { history: y } : {}
446
446
  }),
447
- signal: p.signal
447
+ signal: l.signal
448
448
  });
449
- if (!v.ok) {
450
- const D = await v.json().catch(() => ({}));
451
- throw new Error(D.error || `Agent request failed: ${v.status}`);
449
+ if (!b.ok) {
450
+ const I = await b.json().catch(() => ({}));
451
+ throw new Error(I.error || `Agent request failed: ${b.status}`);
452
452
  }
453
- if (!v.body)
453
+ if (!b.body)
454
454
  throw new Error("No response body received");
455
- const S = v.body.getReader(), R = new TextDecoder();
456
- let T = "";
455
+ const E = b.body.getReader(), T = new TextDecoder();
456
+ let D = "";
457
457
  for (; ; ) {
458
- const { done: D, value: y } = await S.read();
459
- if (D) break;
460
- T += R.decode(y, { stream: !0 });
461
- const I = T.split(`
458
+ const { done: I, value: C } = await E.read();
459
+ if (I) break;
460
+ D += T.decode(C, { stream: !0 });
461
+ const g = D.split(`
462
462
 
463
463
  `);
464
- T = I.pop() || "";
465
- for (const L of I) {
466
- const F = L.trim().split(`
464
+ D = g.pop() || "";
465
+ for (const L of g) {
466
+ const P = L.trim().split(`
467
467
  `);
468
- for (const B of F)
469
- if (B.startsWith("data: "))
468
+ for (const R of P)
469
+ if (R.startsWith("data: "))
470
470
  try {
471
- const M = JSON.parse(B.slice(6));
472
- N(M);
471
+ const Q = JSON.parse(R.slice(6));
472
+ S(Q);
473
473
  } catch {
474
474
  }
475
475
  }
476
476
  }
477
- if (T.trim()) {
478
- const D = T.trim().split(`
477
+ if (D.trim()) {
478
+ const I = D.trim().split(`
479
479
  `);
480
- for (const y of D)
481
- if (y.startsWith("data: "))
480
+ for (const C of I)
481
+ if (C.startsWith("data: "))
482
482
  try {
483
- const I = JSON.parse(y.slice(6));
484
- N(I);
483
+ const g = JSON.parse(C.slice(6));
484
+ S(g);
485
485
  } catch {
486
486
  }
487
487
  }
488
- } catch (i) {
489
- if (i.name !== "AbortError") {
490
- const f = i instanceof Error ? i.message : "Stream failed";
491
- l.current.onError(Re(f));
488
+ } catch (d) {
489
+ if (d.name !== "AbortError") {
490
+ const i = d instanceof Error ? d.message : "Stream failed";
491
+ p.current.onError(je(i));
492
492
  }
493
493
  } finally {
494
- o(!1), a.current = null;
494
+ o(!1), c.current = null;
495
495
  }
496
- }, [c, t, s]), w = g(() => {
497
- a.current && (a.current.abort(), a.current = null, o(!1));
496
+ }, [n, t, r]), w = h(() => {
497
+ c.current && (c.current.abort(), c.current = null, o(!1));
498
498
  }, []);
499
499
  return {
500
- sendMessage: d,
501
- isStreaming: n,
500
+ sendMessage: u,
501
+ isStreaming: a,
502
502
  abort: w
503
503
  };
504
504
  }
505
- function Le(e) {
505
+ function qe(e) {
506
506
  const t = [];
507
- let s = e, c = 0;
508
- for (; s; ) {
509
- const a = s.match(/^(.*?)`([^`]+)`(.*)$/);
510
- if (a) {
511
- const [, o, l, d] = a;
512
- o && t.push(/* @__PURE__ */ r("span", { children: o }, c++)), t.push(
513
- /* @__PURE__ */ r("code", { className: "dc:px-1 dc:py-0.5 dc:rounded dc:text-xs bg-dc-surface dc:font-mono", children: l }, c++)
514
- ), s = d;
507
+ let r = e, n = 0;
508
+ for (; r; ) {
509
+ const c = r.match(/^(.*?)`([^`]+)`(.*)$/);
510
+ if (c) {
511
+ const [, o, p, u] = c;
512
+ o && t.push(/* @__PURE__ */ s("span", { children: o }, n++)), t.push(
513
+ /* @__PURE__ */ s("code", { className: "dc:px-1 dc:py-0.5 dc:rounded dc:text-xs bg-dc-surface dc:font-mono", children: p }, n++)
514
+ ), r = u;
515
515
  continue;
516
516
  }
517
- const n = s.match(/^(.*?)\*\*([^*]+)\*\*(.*)$/);
518
- if (n) {
519
- const [, o, l, d] = n;
520
- o && t.push(/* @__PURE__ */ r("span", { children: o }, c++)), t.push(/* @__PURE__ */ r("strong", { className: "dc:font-semibold", children: l }, c++)), s = d;
517
+ const a = r.match(/^(.*?)\*\*([^*]+)\*\*(.*)$/);
518
+ if (a) {
519
+ const [, o, p, u] = a;
520
+ o && t.push(/* @__PURE__ */ s("span", { children: o }, n++)), t.push(/* @__PURE__ */ s("strong", { className: "dc:font-semibold", children: p }, n++)), r = u;
521
521
  continue;
522
522
  }
523
- t.push(/* @__PURE__ */ r("span", { children: s }, c));
523
+ t.push(/* @__PURE__ */ s("span", { children: r }, n));
524
524
  break;
525
525
  }
526
526
  return t;
527
527
  }
528
- const Pe = {
528
+ const Ke = {
529
529
  discover_cubes: "Discovering cubes",
530
530
  get_cube_metadata: "Reading metadata",
531
531
  execute_query: "Executing query",
532
532
  add_portlet: "Adding visualization",
533
533
  add_markdown: "Adding explanation"
534
534
  };
535
- function Qe({ toolCall: e, loadingComponent: t }) {
536
- const [s, c] = j(!1), a = Pe[e.name] || e.name, n = e.status === "running";
537
- return /* @__PURE__ */ x("div", { className: "dc:my-1 dc:text-xs", children: [
538
- /* @__PURE__ */ x(
535
+ function Oe({ toolCall: e, loadingComponent: t }) {
536
+ const [r, n] = _(!1), c = Ke[e.name] || e.name, a = e.status === "running";
537
+ return /* @__PURE__ */ f("div", { className: "dc:my-1 dc:text-xs", children: [
538
+ /* @__PURE__ */ f(
539
539
  "button",
540
540
  {
541
- onClick: () => c(!s),
541
+ onClick: () => n(!r),
542
542
  className: "dc:flex dc:items-center dc:gap-1.5 text-dc-text-secondary dc:hover:opacity-80 dc:transition-opacity",
543
543
  children: [
544
- n ? t ? /* @__PURE__ */ r("span", { className: "dc:inline-flex dc:items-center dc:justify-center dc:h-3 dc:w-3", children: t }) : /* @__PURE__ */ r(ge, { size: "xs" }) : /* @__PURE__ */ r("span", { className: "dc:text-xs", children: e.status === "error" ? "✗" : "✓" }),
545
- /* @__PURE__ */ x("span", { children: [
546
- a,
547
- n ? "..." : ""
544
+ a ? t ? /* @__PURE__ */ s("span", { className: "dc:inline-flex dc:items-center dc:justify-center dc:h-3 dc:w-3", children: t }) : /* @__PURE__ */ s(we, { size: "xs" }) : /* @__PURE__ */ s("span", { className: "dc:text-xs", children: e.status === "error" ? "✗" : "✓" }),
545
+ /* @__PURE__ */ f("span", { children: [
546
+ c,
547
+ a ? "..." : ""
548
548
  ] }),
549
- !n && /* @__PURE__ */ r("span", { className: "dc:text-[10px] dc:opacity-60", children: s ? "▲" : "▼" })
549
+ !a && /* @__PURE__ */ s("span", { className: "dc:text-[10px] dc:opacity-60", children: r ? "▲" : "▼" })
550
550
  ]
551
551
  }
552
552
  ),
553
- s && e.result != null && /* @__PURE__ */ r("pre", { className: "dc:mt-1 dc:p-2 dc:rounded dc:text-[11px] dc:overflow-x-auto dc:max-h-32 dc:overflow-y-auto bg-dc-surface-secondary text-dc-text-secondary", children: typeof e.result == "string" ? e.result : JSON.stringify(e.result, null, 2) })
553
+ r && e.result != null && /* @__PURE__ */ s("pre", { className: "dc:mt-1 dc:p-2 dc:rounded dc:text-[11px] dc:overflow-x-auto dc:max-h-32 dc:overflow-y-auto bg-dc-surface-secondary text-dc-text-secondary", children: typeof e.result == "string" ? e.result : JSON.stringify(e.result, null, 2) })
554
554
  ] });
555
555
  }
556
- const Fe = {
556
+ const $e = {
557
557
  animation: "dc-msg-in 100ms ease-out"
558
- }, _e = Q.memo(function({ message: t, loadingComponent: s }) {
559
- const c = t.role === "user", a = !!t.content?.trim(), n = !!t.error, o = t.toolCalls && t.toolCalls.length > 0;
560
- return !c && !a && !n && !o ? null : /* @__PURE__ */ r(
558
+ }, ze = V.memo(function({ message: t, loadingComponent: r }) {
559
+ const n = t.role === "user", c = !!t.content?.trim(), a = !!t.error, o = t.toolCalls && t.toolCalls.length > 0;
560
+ return !n && !c && !a && !o ? null : /* @__PURE__ */ s(
561
561
  "div",
562
562
  {
563
- className: `dc:flex dc:mb-3 ${c ? "dc:justify-end" : "dc:justify-start"}`,
564
- style: Fe,
565
- children: /* @__PURE__ */ x(
563
+ className: `dc:flex dc:mb-3 ${n ? "dc:justify-end" : "dc:justify-start"}`,
564
+ style: $e,
565
+ children: /* @__PURE__ */ f(
566
566
  "div",
567
567
  {
568
- className: `dc:max-w-[85%] dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm ${c ? "bg-dc-accent text-dc-accent-text dc:rounded-br-sm" : n && !a ? "bg-dc-warning-bg text-dc-text dc:rounded-bl-sm" : "bg-dc-surface-secondary text-dc-text dc:rounded-bl-sm"}`,
568
+ className: `dc:max-w-[85%] dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm ${n ? "bg-dc-accent text-dc-accent-text dc:rounded-br-sm" : a && !c ? "bg-dc-warning-bg text-dc-text dc:rounded-bl-sm" : "bg-dc-surface-secondary text-dc-text dc:rounded-bl-sm"}`,
569
569
  children: [
570
- a && /* @__PURE__ */ r("div", { className: "dc:whitespace-pre-wrap dc:break-words", children: c ? t.content : Le(t.content) }),
571
- n && /* @__PURE__ */ x("div", { className: `dc:flex dc:items-start dc:gap-2 ${a ? "dc:mt-2 dc:pt-2 dc:border-t dc:border-current dc:border-opacity-10" : ""}`, children: [
572
- /* @__PURE__ */ r("span", { className: "dc:text-base dc:leading-none dc:mt-0.5 text-dc-warning dc:flex-shrink-0", children: "⚠" }),
573
- /* @__PURE__ */ r("span", { className: "text-dc-text-secondary", children: t.error })
570
+ c && /* @__PURE__ */ s("div", { className: "dc:whitespace-pre-wrap dc:break-words", children: n ? t.content : qe(t.content) }),
571
+ a && /* @__PURE__ */ f("div", { className: `dc:flex dc:items-start dc:gap-2 ${c ? "dc:mt-2 dc:pt-2 dc:border-t dc:border-current dc:border-opacity-10" : ""}`, children: [
572
+ /* @__PURE__ */ s("span", { className: "dc:text-base dc:leading-none dc:mt-0.5 text-dc-warning dc:flex-shrink-0", children: "⚠" }),
573
+ /* @__PURE__ */ s("span", { className: "text-dc-text-secondary", children: t.error })
574
574
  ] }),
575
- o && /* @__PURE__ */ r("div", { className: a || n ? "dc:mt-1 dc:border-t dc:border-current dc:border-opacity-10 dc:pt-1" : "", children: t.toolCalls.map((l, d) => /* @__PURE__ */ r(Qe, { toolCall: l, loadingComponent: s }, l.id || d)) })
575
+ o && /* @__PURE__ */ s("div", { className: c || a ? "dc:mt-1 dc:border-t dc:border-current dc:border-opacity-10 dc:pt-1" : "", children: t.toolCalls.map((p, u) => /* @__PURE__ */ s(Oe, { toolCall: p, loadingComponent: r }, p.id || u)) })
576
576
  ]
577
577
  }
578
578
  )
579
579
  }
580
580
  );
581
- }), Ve = Q.memo(function({
581
+ }), We = V.memo(function({
582
582
  value: t,
583
- onChange: s,
584
- onSend: c,
585
- onStop: a,
586
- onContinue: n,
583
+ onChange: r,
584
+ onSend: n,
585
+ onStop: c,
586
+ onContinue: a,
587
587
  isStreaming: o = !1,
588
- showContinue: l = !1,
589
- disabled: d = !1,
588
+ showContinue: p = !1,
589
+ disabled: u = !1,
590
590
  placeholder: w = "Ask about your data..."
591
591
  }) {
592
- const m = C(null);
593
- P(() => {
594
- const h = m.current;
595
- h && (h.style.height = "auto", h.style.height = `${Math.min(h.scrollHeight, 150)}px`);
592
+ const x = v(null);
593
+ F(() => {
594
+ const y = x.current;
595
+ y && (y.style.height = "auto", y.style.height = `${Math.min(y.scrollHeight, 150)}px`);
596
596
  }, [t]);
597
- const k = g(
598
- (h) => {
599
- h.key === "Enter" && !h.shiftKey && (h.preventDefault(), !d && t.trim() && c());
597
+ const N = h(
598
+ (y) => {
599
+ y.key === "Enter" && !y.shiftKey && (y.preventDefault(), !u && t.trim() && n());
600
600
  },
601
- [d, t, c]
601
+ [u, t, n]
602
602
  );
603
- return /* @__PURE__ */ x("div", { className: "dc:flex dc:gap-2 dc:items-end dc:p-3 border-dc-border dc:border-t", children: [
604
- /* @__PURE__ */ r(
603
+ return /* @__PURE__ */ f("div", { className: "dc:flex dc:gap-2 dc:items-end dc:p-3 border-dc-border dc:border-t", children: [
604
+ /* @__PURE__ */ s(
605
605
  "textarea",
606
606
  {
607
- ref: m,
607
+ ref: x,
608
608
  value: t,
609
- onChange: (h) => s(h.target.value),
610
- onKeyDown: k,
609
+ onChange: (y) => r(y.target.value),
610
+ onKeyDown: N,
611
611
  placeholder: w,
612
- disabled: d,
612
+ disabled: u,
613
613
  rows: 1,
614
614
  className: "dc:flex-1 dc:resize-none dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm bg-dc-surface-secondary text-dc-text border-dc-border dc:border dc:outline-none dc:focus:ring-1 focus:ring-dc-accent dc:disabled:opacity-50"
615
615
  }
616
616
  ),
617
- o ? /* @__PURE__ */ r(
617
+ o ? /* @__PURE__ */ s(
618
618
  "button",
619
619
  {
620
- onClick: a,
620
+ onClick: c,
621
621
  className: "dc:px-4 dc:py-2 dc:rounded-lg dc:text-sm dc:font-medium dc:transition-colors text-dc-error border-dc-border dc:border dc:hover:opacity-80 dc:shrink-0",
622
622
  children: "Stop"
623
623
  }
624
- ) : /* @__PURE__ */ x(oe, { children: [
625
- l && !t.trim() && /* @__PURE__ */ r(
624
+ ) : /* @__PURE__ */ f(te, { children: [
625
+ p && !t.trim() && /* @__PURE__ */ s(
626
626
  "button",
627
627
  {
628
628
  onClick: () => {
629
- n?.(), m.current?.focus();
629
+ a?.(), x.current?.focus();
630
630
  },
631
631
  className: "dc:px-4 dc:py-2 dc:rounded-lg dc:text-sm dc:font-medium dc:transition-colors border-dc-border dc:border text-dc-text-secondary dc:hover:opacity-80 dc:shrink-0",
632
632
  children: "Continue"
633
633
  }
634
634
  ),
635
- /* @__PURE__ */ r(
635
+ /* @__PURE__ */ s(
636
636
  "button",
637
637
  {
638
- onClick: c,
639
- disabled: d || !t.trim(),
638
+ onClick: n,
639
+ disabled: u || !t.trim(),
640
640
  className: "dc:px-4 dc:py-2 dc:rounded-lg dc:text-sm dc:font-medium dc:transition-colors bg-dc-accent text-dc-accent-text dc:hover:opacity-90 dc:disabled:opacity-40 dc:disabled:cursor-not-allowed dc:shrink-0",
641
641
  children: "Send"
642
642
  }
643
643
  )
644
644
  ] })
645
645
  ] });
646
- }), je = Q.memo(function({
646
+ }), Je = j("thumbUp"), Ge = j("thumbDown"), He = V.memo(function({
647
647
  agentEndpoint: t,
648
- agentApiKey: s,
649
- onClear: c,
650
- onDashboardSaved: a,
651
- loadingComponent: n,
652
- initialPrompt: o
648
+ agentApiKey: r,
649
+ onClear: n,
650
+ onDashboardSaved: c,
651
+ onScore: a,
652
+ loadingComponent: o,
653
+ initialPrompt: p
653
654
  }) {
654
- const l = C(null), d = C(!1), w = C(!1), { messages: m, isStreaming: k, inputValue: h } = A(O(Ce)), {
655
- addMessage: N,
656
- appendToLastAssistantMessage: p,
657
- setLastAssistantError: i,
658
- addToolCallToLastAssistant: f,
659
- updateLastToolCall: b,
660
- setIsStreaming: v,
661
- setInputValue: S,
662
- setSessionId: R
663
- } = A(O(ke)), T = A((u) => u.sessionId), D = A((u) => u.addBlock), y = A((u) => u.reset), I = A((u) => u.blocks.filter((V) => V.type === "portlet").length), L = C(m);
664
- L.current = m;
665
- const F = C(k);
666
- F.current = k;
667
- const B = C(T);
668
- B.current = T;
669
- const M = g(() => {
670
- w.current && (w.current = !1, N({
655
+ const u = v(null), w = v(!1), [x, N] = _(null), [y, S] = _(/* @__PURE__ */ new Set()), l = v(!1), { messages: d, isStreaming: i, inputValue: k } = A(z(Me)), {
656
+ addMessage: b,
657
+ appendToLastAssistantMessage: E,
658
+ setLastAssistantError: T,
659
+ addToolCallToLastAssistant: D,
660
+ updateLastToolCall: I,
661
+ setIsStreaming: C,
662
+ setInputValue: g,
663
+ setSessionId: L
664
+ } = A(z(Ie)), P = A((m) => m.sessionId), R = A((m) => m.addBlock), Q = A((m) => m.reset), $ = A((m) => m.blocks.filter((M) => M.type === "portlet").length), W = v(d);
665
+ W.current = d;
666
+ const J = v(i);
667
+ J.current = i;
668
+ const G = v(P);
669
+ G.current = P;
670
+ const U = h(() => {
671
+ l.current && (l.current = !1, b({
671
672
  id: `msg-${Date.now()}`,
672
673
  role: "assistant",
673
674
  content: "",
674
675
  toolCalls: [],
675
676
  timestamp: Date.now()
676
677
  }));
677
- }, [N]), $ = C(m.length);
678
- P(() => {
679
- m.length > $.current && l.current?.scrollIntoView({ behavior: "smooth" }), $.current = m.length;
680
- }, [m]);
681
- const { sendMessage: z, abort: U } = Be({
678
+ }, [b]), H = v(d.length);
679
+ F(() => {
680
+ d.length > H.current && u.current?.scrollIntoView({ behavior: "smooth" }), H.current = d.length;
681
+ }, [d]);
682
+ const { sendMessage: Y, abort: K } = Ue({
682
683
  agentEndpoint: t,
683
- agentApiKey: s,
684
- onTextDelta: g((u) => {
685
- M(), p(u);
686
- }, [M, p]),
687
- onToolStart: g((u, V, E) => {
688
- M(), f({ id: u, name: V, input: E, status: "running" });
689
- }, [M, f]),
690
- onToolResult: g((u, V, E, se) => {
691
- b({ id: u, status: se ? "error" : "complete", result: E });
692
- }, [b]),
693
- onAddPortlet: g((u) => {
694
- D(u);
695
- }, [D]),
696
- onAddMarkdown: g((u) => {
697
- D(u);
698
- }, [D]),
699
- onDashboardSaved: a,
700
- onTurnComplete: g(() => {
701
- w.current = !0;
684
+ agentApiKey: r,
685
+ onTextDelta: h((m) => {
686
+ U(), E(m);
687
+ }, [U, E]),
688
+ onToolStart: h((m, M, B) => {
689
+ U(), D({ id: m, name: M, input: B, status: "running" });
690
+ }, [U, D]),
691
+ onToolResult: h((m, M, B, ue) => {
692
+ I({ id: m, status: ue ? "error" : "complete", result: B });
693
+ }, [I]),
694
+ onAddPortlet: h((m) => {
695
+ R(m);
696
+ }, [R]),
697
+ onAddMarkdown: h((m) => {
698
+ R(m);
699
+ }, [R]),
700
+ onDashboardSaved: c,
701
+ onTurnComplete: h(() => {
702
+ l.current = !0;
702
703
  }, []),
703
- onDone: g((u) => {
704
- w.current = !1, R(u), v(!1);
705
- }, [R, v]),
706
- onError: g((u) => {
707
- M(), i(u), v(!1);
708
- }, [M, i, v])
709
- }), _ = g((u) => {
710
- if (!u || F.current) return;
711
- w.current = !1;
712
- const V = L.current.map((E) => ({
713
- role: E.role,
714
- content: E.content,
715
- ...E.toolCalls && E.toolCalls.length > 0 ? { toolCalls: E.toolCalls } : {}
704
+ onDone: h((m, M) => {
705
+ l.current = !1, L(m), C(!1), M && N(M);
706
+ }, [L, C]),
707
+ onError: h((m) => {
708
+ U(), T(m), C(!1);
709
+ }, [U, T, C])
710
+ }), q = h((m) => {
711
+ if (!m || J.current) return;
712
+ l.current = !1;
713
+ const M = W.current.map((B) => ({
714
+ role: B.role,
715
+ content: B.content,
716
+ ...B.toolCalls && B.toolCalls.length > 0 ? { toolCalls: B.toolCalls } : {}
716
717
  }));
717
- N({
718
+ b({
718
719
  id: `msg-${Date.now()}`,
719
720
  role: "user",
720
- content: u,
721
+ content: m,
721
722
  timestamp: Date.now()
722
- }), N({
723
+ }), b({
723
724
  id: `msg-${Date.now() + 1}`,
724
725
  role: "assistant",
725
726
  content: "",
726
727
  toolCalls: [],
727
728
  timestamp: Date.now()
728
- }), S(""), v(!0), z(u, B.current, V);
729
- }, [N, S, v, z]);
730
- P(() => {
731
- if (o && !d.current && m.length === 0) {
732
- d.current = !0;
733
- const u = setTimeout(() => _(o), 100);
729
+ }), g(""), C(!0), Y(m, G.current, M);
730
+ }, [b, g, C, Y]);
731
+ F(() => {
732
+ if (p && !w.current && d.length === 0) {
733
+ w.current = !0;
734
+ const m = setTimeout(() => q(p), 100);
734
735
  return () => {
735
- clearTimeout(u), d.current = !1;
736
+ clearTimeout(m), w.current = !1;
736
737
  };
737
738
  }
738
- }, [o, m.length, _]);
739
- const W = C(h);
740
- W.current = h;
741
- const H = g(() => {
742
- _(W.current.trim());
743
- }, [_]), X = g(() => {
744
- U(), v(!1);
745
- }, [U, v]), Y = g(() => {
746
- S("");
747
- }, [S]), Z = g(() => {
748
- U(), v(!1), y(), c?.();
749
- }, [U, v, y, c]), ee = g(() => {
750
- _(
739
+ }, [p, d.length, q]);
740
+ const X = v(k);
741
+ X.current = k;
742
+ const ce = h(() => {
743
+ q(X.current.trim());
744
+ }, [q]), ae = h(() => {
745
+ K(), C(!1);
746
+ }, [K, C]), ne = h(() => {
747
+ g("");
748
+ }, [g]), oe = h(() => {
749
+ K(), C(!1), Q(), N(null), S(/* @__PURE__ */ new Set()), n?.();
750
+ }, [K, C, Q, n]), de = h(() => {
751
+ q(
751
752
  "Save the current notebook as a dashboard with a professional layout, section headers, and appropriate filters."
752
753
  );
753
- }, [_]), te = !!a && !k && I > 0 && m.length > 0;
754
- return /* @__PURE__ */ x("div", { className: "dc:flex dc:flex-col dc:h-full bg-dc-surface", children: [
755
- /* @__PURE__ */ x("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-4 dc:py-3 border-dc-border dc:border-b", children: [
756
- /* @__PURE__ */ r("h3", { className: "dc:text-sm dc:font-semibold text-dc-text", children: "AI Assistant" }),
757
- /* @__PURE__ */ x("div", { className: "dc:flex dc:items-center dc:gap-1", children: [
758
- te && /* @__PURE__ */ r(
754
+ }, [q]), Z = h((m) => {
755
+ !x || !a || (a({ traceId: x, value: m }), S((M) => new Set(M).add(x)));
756
+ }, [x, a]), ie = !!c && !i && $ > 0 && d.length > 0, le = !!a && !i && x && d.length > 0 && !y.has(x), ee = x ? y.has(x) : !1;
757
+ return /* @__PURE__ */ f("div", { className: "dc:flex dc:flex-col dc:h-full bg-dc-surface", children: [
758
+ /* @__PURE__ */ f("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-4 dc:py-3 border-dc-border dc:border-b", children: [
759
+ /* @__PURE__ */ s("h3", { className: "dc:text-sm dc:font-semibold text-dc-text", children: "AI Assistant" }),
760
+ /* @__PURE__ */ f("div", { className: "dc:flex dc:items-center dc:gap-1", children: [
761
+ ie && /* @__PURE__ */ s(
759
762
  "button",
760
763
  {
761
- onClick: ee,
764
+ onClick: de,
762
765
  className: "dc:text-xs dc:px-2 dc:py-1 dc:rounded text-dc-accent dc:hover:opacity-80",
763
766
  title: "Save notebook as a dashboard",
764
767
  children: "Save as Dashboard"
765
768
  }
766
769
  ),
767
- m.length > 0 && /* @__PURE__ */ r(
770
+ d.length > 0 && /* @__PURE__ */ s(
768
771
  "button",
769
772
  {
770
- onClick: Z,
771
- disabled: k,
773
+ onClick: oe,
774
+ disabled: i,
772
775
  className: "dc:text-xs dc:px-2 dc:py-1 dc:rounded text-dc-text-secondary dc:hover:opacity-80 dc:disabled:opacity-40",
773
776
  title: "Clear notebook and chat",
774
777
  children: "Clear"
@@ -776,129 +779,158 @@ const Fe = {
776
779
  )
777
780
  ] })
778
781
  ] }),
779
- /* @__PURE__ */ x("div", { className: "dc:flex-1 dc:overflow-y-auto dc:px-4 dc:py-3", children: [
780
- m.length === 0 ? /* @__PURE__ */ r(qe, {}) : m.map((u) => /* @__PURE__ */ r(
781
- _e,
782
+ /* @__PURE__ */ f("div", { className: "dc:flex-1 dc:overflow-y-auto dc:px-4 dc:py-3", children: [
783
+ d.length === 0 ? /* @__PURE__ */ s(Ye, {}) : d.map((m) => /* @__PURE__ */ s(
784
+ ze,
782
785
  {
783
- message: u,
784
- loadingComponent: n
786
+ message: m,
787
+ loadingComponent: o
785
788
  },
786
- u.id
789
+ m.id
787
790
  )),
788
- /* @__PURE__ */ r("div", { ref: l })
791
+ (le || ee) && /* @__PURE__ */ s("div", { className: "dc:flex dc:items-center dc:justify-center dc:gap-3 dc:py-4 dc:mt-2", children: ee ? /* @__PURE__ */ s("span", { className: "dc:text-sm text-dc-text-secondary", children: "Thanks for your feedback!" }) : /* @__PURE__ */ f(te, { children: [
792
+ /* @__PURE__ */ s("span", { className: "dc:text-sm text-dc-text-secondary", children: "Was this helpful?" }),
793
+ /* @__PURE__ */ f("div", { className: "dc:flex dc:items-center dc:gap-2", children: [
794
+ /* @__PURE__ */ f(
795
+ "button",
796
+ {
797
+ onClick: () => Z(1),
798
+ className: "dc:flex dc:items-center dc:gap-1.5 dc:px-3 dc:py-1.5 dc:rounded-lg dc:text-sm dc:font-medium border-dc-border dc:border text-dc-success hover:bg-dc-success-bg dc:transition-colors bg-dc-surface dc:cursor-pointer",
799
+ children: [
800
+ /* @__PURE__ */ s(Je, { className: "dc:w-4 dc:h-4" }),
801
+ "Yes"
802
+ ]
803
+ }
804
+ ),
805
+ /* @__PURE__ */ f(
806
+ "button",
807
+ {
808
+ onClick: () => Z(0),
809
+ className: "dc:flex dc:items-center dc:gap-1.5 dc:px-3 dc:py-1.5 dc:rounded-lg dc:text-sm dc:font-medium border-dc-border dc:border text-dc-error hover:bg-dc-danger-bg dc:transition-colors bg-dc-surface dc:cursor-pointer",
810
+ children: [
811
+ /* @__PURE__ */ s(Ge, { className: "dc:w-4 dc:h-4" }),
812
+ "No"
813
+ ]
814
+ }
815
+ )
816
+ ] })
817
+ ] }) }),
818
+ /* @__PURE__ */ s("div", { ref: u })
789
819
  ] }),
790
- /* @__PURE__ */ r(
791
- Ve,
820
+ /* @__PURE__ */ s(
821
+ We,
792
822
  {
793
- value: h,
794
- onChange: S,
795
- onSend: H,
796
- onStop: X,
797
- onContinue: Y,
798
- isStreaming: k,
799
- showContinue: !k && m.length > 0
823
+ value: k,
824
+ onChange: g,
825
+ onSend: ce,
826
+ onStop: ae,
827
+ onContinue: ne,
828
+ isStreaming: i,
829
+ showContinue: !i && d.length > 0
800
830
  }
801
831
  )
802
832
  ] });
803
833
  });
804
- function qe() {
805
- return /* @__PURE__ */ r("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ x("div", { className: "dc:text-center dc:max-w-xs", children: [
806
- /* @__PURE__ */ r("div", { className: "dc:text-lg dc:font-semibold text-dc-text dc:mb-2", children: "Data Analysis Assistant" }),
807
- /* @__PURE__ */ r("p", { className: "dc:text-sm text-dc-text-secondary dc:mb-4", children: "Ask me about your data and I'll create visualizations and insights." }),
808
- /* @__PURE__ */ x("div", { className: "dc:space-y-2 dc:text-xs text-dc-text-muted", children: [
809
- /* @__PURE__ */ r("p", { children: '"Show me employee productivity trends"' }),
810
- /* @__PURE__ */ r("p", { children: '"What are the top departments by headcount?"' }),
811
- /* @__PURE__ */ r("p", { children: '"Compare revenue across product categories"' })
834
+ function Ye() {
835
+ return /* @__PURE__ */ s("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ f("div", { className: "dc:text-center dc:max-w-xs", children: [
836
+ /* @__PURE__ */ s("div", { className: "dc:text-lg dc:font-semibold text-dc-text dc:mb-2", children: "Data Analysis Assistant" }),
837
+ /* @__PURE__ */ s("p", { className: "dc:text-sm text-dc-text-secondary dc:mb-4", children: "Ask me about your data and I'll create visualizations and insights." }),
838
+ /* @__PURE__ */ f("div", { className: "dc:space-y-2 dc:text-xs text-dc-text-muted", children: [
839
+ /* @__PURE__ */ s("p", { children: '"Show me employee productivity trends"' }),
840
+ /* @__PURE__ */ s("p", { children: '"What are the top departments by headcount?"' }),
841
+ /* @__PURE__ */ s("p", { children: '"Compare revenue across product categories"' })
812
842
  ] })
813
843
  ] }) });
814
844
  }
815
- function Ue({
845
+ function Xe({
816
846
  agentEndpoint: e,
817
847
  agentApiKey: t,
818
- onSave: s,
819
- onDirtyStateChange: c,
820
- onDashboardSaved: a,
821
- loadingComponent: n,
822
- className: o,
823
- initialPrompt: l
848
+ onSave: r,
849
+ onDirtyStateChange: n,
850
+ onDashboardSaved: c,
851
+ onScore: a,
852
+ loadingComponent: o,
853
+ className: p,
854
+ initialPrompt: u
824
855
  }) {
825
- const [d, w] = j(60), m = C(null), k = C(!1), h = A((y) => y.blocks.length), N = A((y) => y.messages.length), p = A((y) => y.isStreaming), i = A((y) => y.save), f = C({ blockCount: h, msgCount: N });
826
- P(() => {
827
- const y = h !== f.current.blockCount || N !== f.current.msgCount;
828
- c?.(y);
829
- }, [h, N, c]);
830
- const b = C(), v = C(!1), S = C(s);
831
- S.current = s;
832
- const R = C(h > 0 || N > 0);
833
- P(() => {
834
- if ((h > 0 || N > 0) && (R.current = !0), !(!S.current || !R.current)) {
835
- if (p) {
836
- v.current = !0, b.current && clearTimeout(b.current);
856
+ const [w, x] = _(60), N = v(null), y = v(!1), S = A((g) => g.blocks.length), l = A((g) => g.messages.length), d = A((g) => g.isStreaming), i = A((g) => g.save), k = v({ blockCount: S, msgCount: l });
857
+ F(() => {
858
+ const g = S !== k.current.blockCount || l !== k.current.msgCount;
859
+ n?.(g);
860
+ }, [S, l, n]);
861
+ const b = v(), E = v(!1), T = v(r);
862
+ T.current = r;
863
+ const D = v(S > 0 || l > 0);
864
+ F(() => {
865
+ if ((S > 0 || l > 0) && (D.current = !0), !(!T.current || !D.current)) {
866
+ if (d) {
867
+ E.current = !0, b.current && clearTimeout(b.current);
837
868
  return;
838
869
  }
839
870
  return b.current && clearTimeout(b.current), b.current = setTimeout(() => {
840
- v.current = !1;
841
- const y = i();
842
- S.current?.(y);
871
+ E.current = !1;
872
+ const g = i();
873
+ T.current?.(g);
843
874
  }, 1e3), () => {
844
875
  b.current && clearTimeout(b.current);
845
876
  };
846
877
  }
847
- }, [h, N, p, i]), P(() => {
848
- !p && v.current && S.current && R.current && (b.current && clearTimeout(b.current), b.current = setTimeout(() => {
849
- v.current = !1;
850
- const y = i();
851
- S.current?.(y);
878
+ }, [S, l, d, i]), F(() => {
879
+ !d && E.current && T.current && D.current && (b.current && clearTimeout(b.current), b.current = setTimeout(() => {
880
+ E.current = !1;
881
+ const g = i();
882
+ T.current?.(g);
852
883
  }, 1e3));
853
- }, [p, i]);
854
- const T = g(() => {
855
- S.current && (b.current && clearTimeout(b.current), S.current({ blocks: [], messages: [] }));
856
- }, []), D = g((y) => {
857
- y.preventDefault(), k.current = !0;
858
- const I = (F) => {
859
- if (!k.current || !m.current) return;
860
- const B = m.current.getBoundingClientRect(), M = (F.clientX - B.left) / B.width * 100;
861
- w(Math.min(Math.max(M, 30), 80));
862
- }, L = () => {
863
- k.current = !1, document.removeEventListener("mousemove", I), document.removeEventListener("mouseup", L);
884
+ }, [d, i]);
885
+ const I = h(() => {
886
+ T.current && (b.current && clearTimeout(b.current), T.current({ blocks: [], messages: [] }));
887
+ }, []), C = h((g) => {
888
+ g.preventDefault(), y.current = !0;
889
+ const L = (R) => {
890
+ if (!y.current || !N.current) return;
891
+ const Q = N.current.getBoundingClientRect(), $ = (R.clientX - Q.left) / Q.width * 100;
892
+ x(Math.min(Math.max($, 30), 80));
893
+ }, P = () => {
894
+ y.current = !1, document.removeEventListener("mousemove", L), document.removeEventListener("mouseup", P);
864
895
  };
865
- document.addEventListener("mousemove", I), document.addEventListener("mouseup", L);
896
+ document.addEventListener("mousemove", L), document.addEventListener("mouseup", P);
866
897
  }, []);
867
- return /* @__PURE__ */ x(
898
+ return /* @__PURE__ */ f(
868
899
  "div",
869
900
  {
870
- ref: m,
871
- className: `dc:flex dc:h-full dc:w-full dc:overflow-hidden bg-dc-surface-secondary ${o || ""}`,
901
+ ref: N,
902
+ className: `dc:flex dc:h-full dc:w-full dc:overflow-hidden bg-dc-surface-secondary ${p || ""}`,
872
903
  children: [
873
- /* @__PURE__ */ r(
904
+ /* @__PURE__ */ s(
874
905
  "div",
875
906
  {
876
907
  className: "dc:h-full dc:overflow-hidden",
877
- style: { width: `${d}%` },
878
- children: /* @__PURE__ */ r(Ee, {})
908
+ style: { width: `${w}%` },
909
+ children: /* @__PURE__ */ s(Ve, {})
879
910
  }
880
911
  ),
881
- /* @__PURE__ */ r(
912
+ /* @__PURE__ */ s(
882
913
  "div",
883
914
  {
884
915
  className: "dc:w-1 dc:h-full dc:cursor-col-resize dc:flex-shrink-0 dc:transition-colors bg-dc-border dc:hover:bg-dc-accent",
885
- onMouseDown: D
916
+ onMouseDown: C
886
917
  }
887
918
  ),
888
- /* @__PURE__ */ r(
919
+ /* @__PURE__ */ s(
889
920
  "div",
890
921
  {
891
922
  className: "dc:h-full dc:overflow-hidden",
892
- style: { width: `${100 - d}%` },
893
- children: /* @__PURE__ */ r(
894
- je,
923
+ style: { width: `${100 - w}%` },
924
+ children: /* @__PURE__ */ s(
925
+ He,
895
926
  {
896
927
  agentEndpoint: e,
897
928
  agentApiKey: t,
898
- onClear: T,
899
- onDashboardSaved: a,
900
- loadingComponent: n,
901
- initialPrompt: l
929
+ onClear: I,
930
+ onDashboardSaved: c,
931
+ onScore: a,
932
+ loadingComponent: o,
933
+ initialPrompt: u
902
934
  }
903
935
  )
904
936
  }
@@ -907,208 +939,208 @@ function Ue({
907
939
  }
908
940
  );
909
941
  }
910
- const st = Q.memo(function({
942
+ const mt = V.memo(function({
911
943
  config: t,
912
- ...s
944
+ ...r
913
945
  }) {
914
- return /* @__PURE__ */ r(xe, { initialConfig: t, children: /* @__PURE__ */ r(Ue, { ...s }) });
946
+ return /* @__PURE__ */ s(De, { initialConfig: t, children: /* @__PURE__ */ s(Xe, { ...r }) });
915
947
  });
916
- function rt() {
917
- return /* @__PURE__ */ r("div", { children: "Analytics Page - Coming in Phase 4" });
948
+ function pt() {
949
+ return /* @__PURE__ */ s("div", { children: "Analytics Page - Coming in Phase 4" });
918
950
  }
919
- const Ke = q("segment");
920
- function at({
951
+ const Ze = j("segment");
952
+ function ht({
921
953
  className: e = ""
922
954
  }) {
923
- return /* @__PURE__ */ r(
955
+ return /* @__PURE__ */ s(
924
956
  "div",
925
957
  {
926
958
  className: `dc:flex dc:items-center dc:justify-center bg-dc-bg-secondary ${e}`,
927
- children: /* @__PURE__ */ x("div", { className: "dc:text-center", children: [
928
- /* @__PURE__ */ r(
929
- Ke,
959
+ children: /* @__PURE__ */ f("div", { className: "dc:text-center", children: [
960
+ /* @__PURE__ */ s(
961
+ Ze,
930
962
  {
931
963
  className: "dc:w-8 dc:h-8 dc:mx-auto dc:mb-2 text-dc-text-muted dc:opacity-50"
932
964
  }
933
965
  ),
934
- /* @__PURE__ */ r("span", { className: "dc:text-xs text-dc-text-muted", children: "No preview" })
966
+ /* @__PURE__ */ s("span", { className: "dc:text-xs text-dc-text-muted", children: "No preview" })
935
967
  ] })
936
968
  }
937
969
  );
938
970
  }
939
971
  export {
940
- st as AgenticNotebook,
941
- ot as AnalysisBuilder,
942
- dt as AnalyticsDashboard,
943
- rt as AnalyticsPage,
944
- ae as AnalyticsPortlet,
945
- it as ChartErrorBoundary,
946
- lt as ConfirmModal,
947
- ps as CubeClient,
948
- hs as CubeProvider,
949
- ss as DEFAULT_ICONS,
950
- ut as DashboardEditModal,
951
- mt as DashboardGrid,
952
- pt as DashboardStoreProvider,
953
- at as DashboardThumbnailPlaceholder,
954
- ht as DrillBreadcrumb,
955
- ft as DrillMenu,
956
- Qs as ExecutionPlanPanel,
957
- Fs as ExplainAIPanel,
958
- Ts as LazyChart,
959
- ge as LoadingIndicator,
960
- gt as Modal,
961
- xe as NotebookStoreProvider,
962
- ne as PortletAnalysisModal,
963
- bt as PortletContainer,
964
- fs as ScrollContainerProvider,
965
- Or as THEME_PRESETS,
966
- $r as applyTheme,
967
- Qr as buildFunnelConfigFromQueries,
968
- Fr as buildServerFunnelQuery,
969
- gs as captureThumbnail,
970
- _s as compressAndEncode,
971
- bs as createCubeClient,
972
- gr as createDashboardLayout,
973
- yt as createDashboardStore,
974
- xt as createDefaultConfig,
975
- vt as createDefaultFlowConfig,
976
- Ct as createDefaultFunnelConfig,
977
- kt as createDefaultQueryConfig,
978
- Nt as createDefaultRetentionConfig,
979
- wt as createDefaultWorkspace,
980
- ea as createExplainQueryKey,
981
- xr as createFlowQueryKey,
982
- vr as createFunnelQueryKey,
983
- ye as createNotebookStore,
984
- Vs as decodeAndDecompress,
985
- js as detectAsymmetricDateRanges,
986
- qs as detectMeasureCollisions,
987
- br as formatChartData,
988
- _r as formatDuration,
989
- Cr as generateQueryLabel,
990
- Us as generateShareUrl,
991
- Ks as getAvailableBindingKeyDimensions,
992
- Ms as getAvailableChartTypes,
993
- Vr as getBindingKeyField,
994
- Os as getBindingKeyLabel,
995
- rs as getChartTypeIcon,
996
- kr as getCombinedFields,
997
- jr as getCubeNameFromQuery,
998
- as as getFieldTypeIcon,
999
- q as getIcon,
1000
- cs as getIconData,
1001
- ns as getIconRegistry,
1002
- os as getIconsByCategory,
1003
- ds as getMeasureTypeIcon,
1004
- Nr as getQueryIndices,
1005
- wr as getQueryLabels,
1006
- zr as getTheme,
1007
- Wr as getThemeVariable,
1008
- Is as getUnavailableChartTypes,
1009
- $s as getValidationSummary,
1010
- la as highlightCodeBlocks,
1011
- Es as isChartTypeAvailable,
1012
- Jr as isDarkMode,
1013
- St as isFlowConfig,
1014
- Dt as isFunnelConfig,
1015
- qr as isFunnelData,
1016
- zs as isMinimumFunnelConfigValid,
1017
- At as isMultiQuery,
1018
- Tt as isMultiQueryConfig,
1019
- Sr as isMultiQueryData,
1020
- Ws as isMultiQueryValid,
1021
- Mt as isQueryConfig,
1022
- It as isRetentionConfig,
1023
- oa as isSankeyData,
1024
- da as isServerFlowQuery,
1025
- Et as isServerFunnelQuery,
1026
- Js as isShareableSize,
1027
- Rt as isSingleQuery,
1028
- ys as isThumbnailCaptureAvailable,
1029
- Bt as isValidAnalysisConfig,
1030
- Lt as isValidAnalysisWorkspace,
1031
- Rs as isValidChartType,
1032
- Dr as mergeQueryResults,
1033
- Ar as mergeResultsByKey,
1034
- Tr as mergeResultsConcat,
1035
- Pt as migrateConfig,
1036
- Qt as migrateLegacyPortlet,
1037
- Gs as parseShareUrl,
1038
- Bs as preloadChart,
1039
- Ls as preloadCharts,
1040
- is as registerIcons,
1041
- ls as resetIcons,
1042
- Gr as resetTheme,
1043
- Ft as selectAllActions,
1044
- Ne as selectBlockActions,
1045
- ve as selectBlocks,
1046
- Hs as selectBreakdowns,
1047
- Xs as selectChartConfig,
1048
- ke as selectChatActions,
1049
- Ce as selectChatState,
1050
- Ys as selectCurrentState,
1051
- _t as selectDebugData,
1052
- Vt as selectDebugDataActions,
1053
- jt as selectEditModeActions,
1054
- qt as selectEditModeState,
1055
- Zs as selectFilters,
1056
- er as selectFunnelState,
1057
- tt as selectInputValue,
1058
- Ze as selectIsStreaming,
1059
- Ut as selectLayoutActions,
1060
- Kt as selectLayoutState,
1061
- Ye as selectMessages,
1062
- tr as selectMetrics,
1063
- Ot as selectModalActions,
1064
- $t as selectModalState,
1065
- sr as selectMultiQueryState,
1066
- zt as selectPortletDebugData,
1067
- et as selectSessionId,
1068
- Wt as selectThumbnailDirty,
1069
- rr as selectUIState,
1070
- us as setIcon,
1071
- Hr as setTheme,
1072
- Xr as setThemeVariable,
1073
- Ur as transformServerFunnelResult,
1074
- Be as useAgentChat,
1075
- ar as useAnalysisBuilder,
1076
- cr as useAnalysisBuilderStore,
1077
- fe as useCubeApi,
1078
- xs as useCubeContext,
1079
- vs as useCubeFeatures,
1080
- Ds as useCubeFieldLabel,
1081
- Mr as useCubeLoadQuery,
1082
- Cs as useCubeMeta,
1083
- ks as useCubeMetaQuery,
1084
- Ir as useCubeQuery,
1085
- Jt as useDashboard,
1086
- Gt as useDashboardStore,
1087
- Ht as useDashboardStoreApi,
1088
- Xt as useDashboardStoreOptional,
1089
- Yt as useDrillInteraction,
1090
- ta as useDryRunQueries,
1091
- sa as useDryRunQuery,
1092
- Zt as useElementVisibility,
1093
- ra as useExplainAI,
1094
- aa as useExplainQuery,
1095
- Er as useFlowQuery,
1096
- Rr as useFunnelQuery,
1097
- Br as useMultiCubeLoadQuery,
1098
- ca as useMultiDryRunQueries,
972
+ mt as AgenticNotebook,
973
+ bt as AnalysisBuilder,
974
+ yt as AnalyticsDashboard,
975
+ pt as AnalyticsPage,
976
+ pe as AnalyticsPortlet,
977
+ xt as ChartErrorBoundary,
978
+ vt as ConfirmModal,
979
+ ks as CubeClient,
980
+ ws as CubeProvider,
981
+ ms as DEFAULT_ICONS,
982
+ Ct as DashboardEditModal,
983
+ Nt as DashboardGrid,
984
+ kt as DashboardStoreProvider,
985
+ ht as DashboardThumbnailPlaceholder,
986
+ wt as DrillBreadcrumb,
987
+ St as DrillMenu,
988
+ zs as ExecutionPlanPanel,
989
+ Ws as ExplainAIPanel,
990
+ _s as LazyChart,
991
+ we as LoadingIndicator,
992
+ Tt as Modal,
993
+ De as NotebookStoreProvider,
994
+ fe as PortletAnalysisModal,
995
+ Dt as PortletContainer,
996
+ Ss as ScrollContainerProvider,
997
+ ec as THEME_PRESETS,
998
+ tc as applyTheme,
999
+ zr as buildFunnelConfigFromQueries,
1000
+ Wr as buildServerFunnelQuery,
1001
+ Ts as captureThumbnail,
1002
+ Js as compressAndEncode,
1003
+ Ds as createCubeClient,
1004
+ Tr as createDashboardLayout,
1005
+ At as createDashboardStore,
1006
+ Mt as createDefaultConfig,
1007
+ It as createDefaultFlowConfig,
1008
+ Et as createDefaultFunnelConfig,
1009
+ Rt as createDefaultQueryConfig,
1010
+ Bt as createDefaultRetentionConfig,
1011
+ Lt as createDefaultWorkspace,
1012
+ lc as createExplainQueryKey,
1013
+ Mr as createFlowQueryKey,
1014
+ Ir as createFunnelQueryKey,
1015
+ Te as createNotebookStore,
1016
+ Gs as decodeAndDecompress,
1017
+ Hs as detectAsymmetricDateRanges,
1018
+ Ys as detectMeasureCollisions,
1019
+ Dr as formatChartData,
1020
+ Jr as formatDuration,
1021
+ Er as generateQueryLabel,
1022
+ Xs as generateShareUrl,
1023
+ Zs as getAvailableBindingKeyDimensions,
1024
+ Vs as getAvailableChartTypes,
1025
+ Gr as getBindingKeyField,
1026
+ er as getBindingKeyLabel,
1027
+ ps as getChartTypeIcon,
1028
+ Rr as getCombinedFields,
1029
+ Hr as getCubeNameFromQuery,
1030
+ hs as getFieldTypeIcon,
1031
+ j as getIcon,
1032
+ fs as getIconData,
1033
+ gs as getIconRegistry,
1034
+ bs as getIconsByCategory,
1035
+ ys as getMeasureTypeIcon,
1036
+ Br as getQueryIndices,
1037
+ Lr as getQueryLabels,
1038
+ sc as getTheme,
1039
+ rc as getThemeVariable,
1040
+ js as getUnavailableChartTypes,
1041
+ tr as getValidationSummary,
1042
+ vc as highlightCodeBlocks,
1043
+ Us as isChartTypeAvailable,
1044
+ cc as isDarkMode,
1045
+ Pt as isFlowConfig,
1046
+ Qt as isFunnelConfig,
1047
+ Yr as isFunnelData,
1048
+ sr as isMinimumFunnelConfigValid,
1049
+ Ft as isMultiQuery,
1050
+ _t as isMultiQueryConfig,
1051
+ Pr as isMultiQueryData,
1052
+ rr as isMultiQueryValid,
1053
+ Vt as isQueryConfig,
1054
+ jt as isRetentionConfig,
1055
+ bc as isSankeyData,
1056
+ yc as isServerFlowQuery,
1057
+ Ut as isServerFunnelQuery,
1058
+ cr as isShareableSize,
1059
+ qt as isSingleQuery,
1060
+ As as isThumbnailCaptureAvailable,
1061
+ Kt as isValidAnalysisConfig,
1062
+ Ot as isValidAnalysisWorkspace,
1063
+ qs as isValidChartType,
1064
+ Qr as mergeQueryResults,
1065
+ Fr as mergeResultsByKey,
1066
+ _r as mergeResultsConcat,
1067
+ $t as migrateConfig,
1068
+ zt as migrateLegacyPortlet,
1069
+ ar as parseShareUrl,
1070
+ Ks as preloadChart,
1071
+ Os as preloadCharts,
1072
+ xs as registerIcons,
1073
+ vs as resetIcons,
1074
+ ac as resetTheme,
1075
+ Wt as selectAllActions,
1076
+ Ee as selectBlockActions,
1077
+ Ae as selectBlocks,
1078
+ nr as selectBreakdowns,
1079
+ or as selectChartConfig,
1080
+ Ie as selectChatActions,
1081
+ Me as selectChatState,
1082
+ dr as selectCurrentState,
1083
+ Jt as selectDebugData,
1084
+ Gt as selectDebugDataActions,
1085
+ Ht as selectEditModeActions,
1086
+ Yt as selectEditModeState,
1087
+ ir as selectFilters,
1088
+ lr as selectFunnelState,
1089
+ ut as selectInputValue,
1090
+ it as selectIsStreaming,
1091
+ Xt as selectLayoutActions,
1092
+ Zt as selectLayoutState,
1093
+ dt as selectMessages,
1094
+ ur as selectMetrics,
1095
+ es as selectModalActions,
1096
+ ts as selectModalState,
1097
+ mr as selectMultiQueryState,
1098
+ ss as selectPortletDebugData,
1099
+ lt as selectSessionId,
1100
+ rs as selectThumbnailDirty,
1101
+ pr as selectUIState,
1102
+ Cs as setIcon,
1103
+ nc as setTheme,
1104
+ oc as setThemeVariable,
1105
+ Xr as transformServerFunnelResult,
1106
+ Ue as useAgentChat,
1107
+ hr as useAnalysisBuilder,
1108
+ fr as useAnalysisBuilderStore,
1109
+ ke as useCubeApi,
1110
+ Ms as useCubeContext,
1111
+ Is as useCubeFeatures,
1112
+ Qs as useCubeFieldLabel,
1113
+ Vr as useCubeLoadQuery,
1114
+ Es as useCubeMeta,
1115
+ Rs as useCubeMetaQuery,
1116
+ jr as useCubeQuery,
1117
+ cs as useDashboard,
1118
+ as as useDashboardStore,
1119
+ ns as useDashboardStoreApi,
1120
+ os as useDashboardStoreOptional,
1121
+ ds as useDrillInteraction,
1122
+ uc as useDryRunQueries,
1123
+ mc as useDryRunQuery,
1124
+ is as useElementVisibility,
1125
+ pc as useExplainAI,
1126
+ hc as useExplainQuery,
1127
+ Ur as useFlowQuery,
1128
+ qr as useFunnelQuery,
1129
+ Kr as useMultiCubeLoadQuery,
1130
+ fc as useMultiDryRunQueries,
1099
1131
  A as useNotebookStore,
1100
- Ns as useScrollContainer,
1101
- es as useScrollDetection,
1102
- hr as useTheme,
1103
- nr as validateBindingKeyExists,
1104
- or as validateBindingKeyForSteps,
1105
- dr as validateFunnelConfig,
1106
- Lr as validateMergeKey,
1107
- ir as validateMergeKeys,
1108
- lr as validateMultiQueryConfig,
1109
- ur as validateStepQueries,
1110
- mr as validateTimeDimensionAlignment,
1111
- ws as warnIfScreenshotLibMissing,
1112
- Yr as watchThemeChanges
1132
+ Bs as useScrollContainer,
1133
+ ls as useScrollDetection,
1134
+ wr as useTheme,
1135
+ gr as validateBindingKeyExists,
1136
+ br as validateBindingKeyForSteps,
1137
+ yr as validateFunnelConfig,
1138
+ Or as validateMergeKey,
1139
+ xr as validateMergeKeys,
1140
+ vr as validateMultiQueryConfig,
1141
+ Cr as validateStepQueries,
1142
+ Nr as validateTimeDimensionAlignment,
1143
+ Ls as warnIfScreenshotLibMissing,
1144
+ dc as watchThemeChanges
1113
1145
  };
1114
1146
  //# sourceMappingURL=index.js.map