@antscorp/antsomi-genai 1.0.2 → 1.0.3-beta.2

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 (31) hide show
  1. package/dist/{Component-Cs49dUxs.mjs → Component-BBcc_iAI.mjs} +3 -3
  2. package/dist/{Component-AlrxsWOV.mjs → Component-CD3T6oEj.mjs} +3 -3
  3. package/dist/{Component-BLBfGXgH.mjs → Component-CoQduc7o.mjs} +3 -3
  4. package/dist/{Component-CTDUktmk.mjs → Component-CyeVsqmr.mjs} +3 -3
  5. package/dist/{Component-C_yePlGv.mjs → Component-DEaSSeSr.mjs} +3 -3
  6. package/dist/{Component-7IaMSMNU.mjs → Component-DU_V2aUm.mjs} +3 -3
  7. package/dist/{Component-CQ8f7I7o.mjs → Component-DkYYrSwR.mjs} +1 -1
  8. package/dist/{Component-CMY_azsY.mjs → Component-TNiNSPrF.mjs} +3 -3
  9. package/dist/{Component-D9dltOCp.mjs → Component-gmqEoQOZ.mjs} +3 -3
  10. package/dist/{Component-CJ6N0wvx.mjs → Component-s7KwDAfq.mjs} +3 -3
  11. package/dist/index-3ZhUS4oV.mjs +546 -0
  12. package/dist/{index-DR3WJnVo.mjs → index-B0svHAnH.mjs} +1 -1
  13. package/dist/{index-DItjQQc1.mjs → index-B_F8E9fu.mjs} +1 -1
  14. package/dist/index-BjktST4y.mjs +35613 -0
  15. package/dist/{index-XUBAOnkt.mjs → index-BnvRfYbP.mjs} +1 -1
  16. package/dist/{index-BbIESkTo.mjs → index-Bx0MMvIE.mjs} +18 -11
  17. package/dist/{index-oLF0HwBC.mjs → index-C0H9_4B4.mjs} +3 -3
  18. package/dist/index-C8NVg-VF.mjs +5 -0
  19. package/dist/index-CWsiVGCm.mjs +5 -0
  20. package/dist/{index-BUz5mKct.mjs → index-CpAPEJQy.mjs} +2 -2
  21. package/dist/{index-D-wAKZ6p.mjs → index-D0lUi36Y.mjs} +2 -2
  22. package/dist/{index-DTl09W6E.mjs → index-DIKo3mMi.mjs} +2 -2
  23. package/dist/{index-DtTKPdIL.mjs → index-Duemd0uq.mjs} +16 -16
  24. package/dist/index.es.js +1 -1
  25. package/dist/stats.html +1 -1
  26. package/dist/{useGetSchema-Dcu9AHpg.mjs → useGetSchema-BZyxXJ9F.mjs} +1 -1
  27. package/package.json +8 -8
  28. package/dist/index-2biZvSMb.mjs +0 -5
  29. package/dist/index-BGXxibcG.mjs +0 -537
  30. package/dist/index-ClD3nuqK.mjs +0 -28818
  31. package/dist/index-Co6djWLy.mjs +0 -5
@@ -1,11 +1,11 @@
1
1
  import { Report as ee } from "@antscorp/antsomi-charts";
2
2
  import { Spin as te } from "@antscorp/antsomi-ui";
3
- import { U as x, y as ae, b as ie, w as ne, F as se, x as re, a8 as oe } from "./index-ClD3nuqK.mjs";
3
+ import { U as x, y as ae, b as ie, w as ne, F as se, x as re, a8 as oe } from "./index-BjktST4y.mjs";
4
4
  import { useState as L, useEffect as q } from "react";
5
- import { G as le, u as me } from "./useGetSchema-Dcu9AHpg.mjs";
5
+ import { G as le, u as me } from "./useGetSchema-BZyxXJ9F.mjs";
6
6
  import "@tanstack/react-query";
7
7
  import "@antscorp/antsomi-constants";
8
- import { d as fe } from "./index-DtTKPdIL.mjs";
8
+ import { d as fe } from "./index-Duemd0uq.mjs";
9
9
  function ce(T) {
10
10
  const A = /D[0-9]+_/, O = (e) => e.aliasAggregation || e.aggregation || "", n = {
11
11
  summary: 0,
@@ -1,9 +1,9 @@
1
1
  import { getSizeOfText as ce, Report as ue } from "@antscorp/antsomi-charts";
2
2
  import { Spin as me } from "@antscorp/antsomi-ui";
3
3
  import { useState as Z, useEffect as fe, useMemo as ee } from "react";
4
- import { u as ge } from "./useGetSchema-Dcu9AHpg.mjs";
5
- import { c as he } from "./index-DtTKPdIL.mjs";
6
- import { a2 as pe, U as h, y as de, a7 as te, w as ve, F as ye, x as De } from "./index-ClD3nuqK.mjs";
4
+ import { u as ge } from "./useGetSchema-BZyxXJ9F.mjs";
5
+ import { c as he } from "./index-Duemd0uq.mjs";
6
+ import { a2 as pe, U as h, y as de, a7 as te, w as ve, F as ye, x as De } from "./index-BjktST4y.mjs";
7
7
  import { t as E } from "./toNumber-CHl49cGq.mjs";
8
8
  function W(...y) {
9
9
  return pe(y);
@@ -1,9 +1,9 @@
1
1
  import { Report as V } from "@antscorp/antsomi-charts";
2
2
  import { Spin as z } from "@antscorp/antsomi-ui";
3
3
  import { useState as T, useEffect as C, useMemo as E } from "react";
4
- import { u as D } from "./useGetSchema-Dcu9AHpg.mjs";
5
- import { h as Y } from "./index-DtTKPdIL.mjs";
6
- import { a8 as M, U as A, ad as v, af as R, w as L, F as X, x as G } from "./index-ClD3nuqK.mjs";
4
+ import { u as D } from "./useGetSchema-BZyxXJ9F.mjs";
5
+ import { h as Y } from "./index-Duemd0uq.mjs";
6
+ import { a8 as M, U as A, ad as v, af as R, w as L, F as X, x as G } from "./index-BjktST4y.mjs";
7
7
  function N(p, y, l) {
8
8
  const { rows: n = [] } = p, i = [];
9
9
  for (const o of n) {
@@ -1,10 +1,10 @@
1
1
  import { Spin as ow } from "@antscorp/antsomi-ui";
2
- import { aa as hi, L as ye, c as oe, U as gt, ab as gl, y as uw, ac as bl, a7 as sw, w as cw, F as lw, x as fw } from "./index-ClD3nuqK.mjs";
2
+ import { aa as hi, L as ye, c as oe, U as gt, ab as gl, y as uw, ac as bl, a7 as sw, w as cw, F as lw, x as fw } from "./index-BjktST4y.mjs";
3
3
  import { t as He } from "./toNumber-CHl49cGq.mjs";
4
4
  import * as qt from "react";
5
5
  import M, { isValidElement as ft, Children as Qt, PureComponent as Lt, forwardRef as Hb, useRef as Mi, useImperativeHandle as hw, useState as br, useCallback as dw, useEffect as ja, useMemo as Lf, cloneElement as Pe, createElement as Kb, useContext as jt, createContext as or, Component as Vb } from "react";
6
- import { u as pw } from "./useGetSchema-Dcu9AHpg.mjs";
7
- import { f as vw } from "./index-DtTKPdIL.mjs";
6
+ import { u as pw } from "./useGetSchema-BZyxXJ9F.mjs";
7
+ import { f as vw } from "./index-Duemd0uq.mjs";
8
8
  var fo, Kh;
9
9
  function Be() {
10
10
  if (Kh) return fo;
@@ -1,9 +1,9 @@
1
1
  import { Report as I } from "@antscorp/antsomi-charts";
2
2
  import { Spin as T } from "@antscorp/antsomi-ui";
3
3
  import { useState as u, useEffect as V, useMemo as E } from "react";
4
- import { u as R } from "./useGetSchema-Dcu9AHpg.mjs";
5
- import { k as v } from "./index-DtTKPdIL.mjs";
6
- import { w as y, F as A, x as D, U as M } from "./index-ClD3nuqK.mjs";
4
+ import { u as R } from "./useGetSchema-BZyxXJ9F.mjs";
5
+ import { k as v } from "./index-Duemd0uq.mjs";
6
+ import { w as y, F as A, x as D, U as M } from "./index-BjktST4y.mjs";
7
7
  function b(o = []) {
8
8
  let a = o[0], r;
9
9
  for (let e = 0; e < o.length; e++) {
@@ -1,9 +1,9 @@
1
1
  import { Report as L } from "@antscorp/antsomi-charts";
2
2
  import { Spin as M } from "@antscorp/antsomi-ui";
3
3
  import { useState as P, useEffect as T, useMemo as O } from "react";
4
- import { u as _ } from "./useGetSchema-Dcu9AHpg.mjs";
5
- import { g as z } from "./index-DtTKPdIL.mjs";
6
- import { ad as E, U as R, ab as F, ae as H, w as x, F as G, x as K } from "./index-ClD3nuqK.mjs";
4
+ import { u as _ } from "./useGetSchema-BZyxXJ9F.mjs";
5
+ import { g as z } from "./index-Duemd0uq.mjs";
6
+ import { ad as E, U as R, ab as F, ae as H, w as x, F as G, x as K } from "./index-BjktST4y.mjs";
7
7
  function U(c) {
8
8
  return c === null;
9
9
  }
@@ -1,4 +1,4 @@
1
- import { N as o, c, D as n } from "./index-ClD3nuqK.mjs";
1
+ import { N as o, c, D as n } from "./index-BjktST4y.mjs";
2
2
  import { useRef as d } from "react";
3
3
  const s = {
4
4
  "node-wrapper": "_node-wrapper_omxhi_1"
@@ -1,9 +1,9 @@
1
1
  import { Report as B } from "@antscorp/antsomi-charts";
2
2
  import { Spin as K } from "@antscorp/antsomi-ui";
3
3
  import { useState as z, useEffect as q, useMemo as G } from "react";
4
- import { u as J } from "./useGetSchema-Dcu9AHpg.mjs";
5
- import { e as Z } from "./index-DtTKPdIL.mjs";
6
- import { U as f, a9 as Q, t as ee, w as te, F as ae, x as ne } from "./index-ClD3nuqK.mjs";
4
+ import { u as J } from "./useGetSchema-BZyxXJ9F.mjs";
5
+ import { e as Z } from "./index-Duemd0uq.mjs";
6
+ import { U as f, a9 as Q, t as ee, w as te, F as ae, x as ne } from "./index-BjktST4y.mjs";
7
7
  function oe(l, a) {
8
8
  const n = /* @__PURE__ */ Object.create(null);
9
9
  for (let t = 0; t < l.length; t++) {
@@ -1,9 +1,9 @@
1
1
  import { Report as I } from "@antscorp/antsomi-charts";
2
2
  import { Spin as M } from "@antscorp/antsomi-ui";
3
3
  import { useState as f, useEffect as E, useMemo as V } from "react";
4
- import { u as C } from "./useGetSchema-Dcu9AHpg.mjs";
5
- import { j as D } from "./index-DtTKPdIL.mjs";
6
- import { U as h, w as N, F as R, x as b } from "./index-ClD3nuqK.mjs";
4
+ import { u as C } from "./useGetSchema-BZyxXJ9F.mjs";
5
+ import { j as D } from "./index-Duemd0uq.mjs";
6
+ import { U as h, w as N, F as R, x as b } from "./index-BjktST4y.mjs";
7
7
  const y = (o) => {
8
8
  const { data: i, settings: a } = o, s = h.helpers.safeParseListField(a.metric), n = (a.renderMetric ? h.helpers.safeParseListField(a.renderMetric) : s).at(0), u = [];
9
9
  for (const d of i.rows) {
@@ -1,9 +1,9 @@
1
1
  import { Report as N } from "@antscorp/antsomi-charts";
2
2
  import { Spin as z } from "@antscorp/antsomi-ui";
3
3
  import g, { forwardRef as C, useState as w, useEffect as b, useMemo as v } from "react";
4
- import { u as y } from "./useGetSchema-Dcu9AHpg.mjs";
5
- import { i as E } from "./index-DtTKPdIL.mjs";
6
- import { a as x, j as f, w as j, F, x as L, U as V } from "./index-ClD3nuqK.mjs";
4
+ import { u as y } from "./useGetSchema-BZyxXJ9F.mjs";
5
+ import { i as E } from "./index-Duemd0uq.mjs";
6
+ import { a as x, j as f, w as j, F, x as L, U as V } from "./index-BjktST4y.mjs";
7
7
  const S = C((a, o) => {
8
8
  const { width: s, height: e } = x(a);
9
9
  return f.jsx("svg", { viewBox: "0 0 32 32", fill: "currentColor", ...a, ref: o, width: s, height: e, children: f.jsx("g", { transform: "scale(0.03125 0.03125)", children: f.jsx("path", { d: "M389.74 204.8v80.64h270.72l-476.16 476.16 57.6 57.6 476.16-476.16v270.72h80.64v-408.96z" }) }) });
@@ -0,0 +1,546 @@
1
+ import { a as ee, j as W, i as te, U as w, M as se, c as R, b as z, d as U, e as b, f as F, g as ne, T as Q, h as re, A as ae, k as ce, l as oe, m as ie, n as le, o as ue, p as de } from "./index-BjktST4y.mjs";
2
+ import * as $ from "react";
3
+ import v, { forwardRef as V, useRef as h, useEffect as x, useMemo as me, useState as M, useCallback as I, createContext as ge, lazy as _e } from "react";
4
+ import { Typography as Y, Suspense as fe, Spin as pe, Button as he } from "@antscorp/antsomi-ui";
5
+ import "@tanstack/react-query";
6
+ import "@antscorp/antsomi-constants";
7
+ import { U as ve } from "./index-B0svHAnH.mjs";
8
+ const Ee = V((e, t) => {
9
+ const { width: s, height: r } = ee(e);
10
+ return W.jsx("svg", { viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...e, ref: t, width: s, height: r, children: W.jsx("path", { d: "M16.5938 8.57812L18 9.98438L12 15.9844L6 9.98438L7.40625 8.57812L12 13.1719L16.5938 8.57812Z", fill: "currentColor" }) });
11
+ });
12
+ function O(e) {
13
+ return e[e.length - 1];
14
+ }
15
+ function Ae(e) {
16
+ return Array.isArray(e) ? e : Array.from(e);
17
+ }
18
+ function Re(e) {
19
+ if (te(e))
20
+ return O(Ae(e));
21
+ }
22
+ const Se = v[typeof document < "u" && document.createElement !== void 0 ? "useLayoutEffect" : "useEffect"], be = (e) => {
23
+ const t = $.useRef(e);
24
+ return $.useEffect(() => {
25
+ t.current = e;
26
+ }), t;
27
+ };
28
+ function Ce() {
29
+ }
30
+ function we(e, t, s = {}) {
31
+ const r = Me(s.polyfill), n = be(t);
32
+ return Se(() => {
33
+ let a = !1;
34
+ const c = e && "current" in e ? e.current : e;
35
+ if (!c) return Ce;
36
+ function o(i, l) {
37
+ a || n.current(i, l);
38
+ }
39
+ return r.subscribe(c, o), () => {
40
+ a = !0, r.unsubscribe(c, o);
41
+ };
42
+ }, [e, r, n]), r.observer;
43
+ }
44
+ function Te(e) {
45
+ let t = !1, s = [];
46
+ const r = /* @__PURE__ */ new Map(), n = new (e || window.ResizeObserver)((a, c) => {
47
+ s = s.concat(a);
48
+ function o() {
49
+ const i = /* @__PURE__ */ new Set();
50
+ for (let l = 0; l < s.length; l++) {
51
+ if (i.has(s[l].target)) continue;
52
+ i.add(s[l].target);
53
+ const f = r.get(s[l].target);
54
+ f?.forEach((d) => d(s[l], c));
55
+ }
56
+ s = [], t = !1;
57
+ }
58
+ t || window.requestAnimationFrame(o), t = !0;
59
+ });
60
+ return {
61
+ observer: n,
62
+ subscribe(a, c) {
63
+ var o;
64
+ n.observe(a);
65
+ const i = (o = r.get(a)) !== null && o !== void 0 ? o : [];
66
+ i.push(c), r.set(a, i);
67
+ },
68
+ unsubscribe(a, c) {
69
+ var o;
70
+ const i = (o = r.get(a)) !== null && o !== void 0 ? o : [];
71
+ if (i.length === 1) {
72
+ n.unobserve(a), r.delete(a);
73
+ return;
74
+ }
75
+ const l = i.indexOf(c);
76
+ l !== -1 && i.splice(l, 1), r.set(a, i);
77
+ }
78
+ };
79
+ }
80
+ let k;
81
+ const Me = (e) => k || (k = Te(e));
82
+ function Z(e, t, s) {
83
+ var r = this, n = h(null), a = h(0), c = h(null), o = h([]), i = h(), l = h(), f = h(e), d = h(!0);
84
+ f.current = e;
85
+ var u = typeof window < "u", m = !t && t !== 0 && u;
86
+ if (typeof e != "function") throw new TypeError("Expected a function");
87
+ t = +t || 0;
88
+ var S = !!(s = s || {}).leading, E = !("trailing" in s) || !!s.trailing, A = "maxWait" in s, T = "debounceOnServer" in s && !!s.debounceOnServer, L = A ? Math.max(+s.maxWait || 0, t) : null;
89
+ x(function() {
90
+ return d.current = !0, function() {
91
+ d.current = !1;
92
+ };
93
+ }, []);
94
+ var K = me(function() {
95
+ var P = function(_) {
96
+ var p = o.current, H = i.current;
97
+ return o.current = i.current = null, a.current = _, l.current = f.current.apply(H, p);
98
+ }, y = function(_, p) {
99
+ m && cancelAnimationFrame(c.current), c.current = m ? requestAnimationFrame(_) : setTimeout(_, p);
100
+ }, j = function(_) {
101
+ if (!d.current) return !1;
102
+ var p = _ - n.current;
103
+ return !n.current || p >= t || p < 0 || A && _ - a.current >= L;
104
+ }, q = function(_) {
105
+ return c.current = null, E && o.current ? P(_) : (o.current = i.current = null, l.current);
106
+ }, D = function _() {
107
+ var p = Date.now();
108
+ if (j(p)) return q(p);
109
+ if (d.current) {
110
+ var H = t - (p - n.current), X = A ? Math.min(H, L - (p - a.current)) : H;
111
+ y(_, X);
112
+ }
113
+ }, N = function() {
114
+ if (u || T) {
115
+ var _ = Date.now(), p = j(_);
116
+ if (o.current = [].slice.call(arguments), i.current = r, n.current = _, p) {
117
+ if (!c.current && d.current) return a.current = n.current, y(D, t), S ? P(n.current) : l.current;
118
+ if (A) return y(D, t), P(n.current);
119
+ }
120
+ return c.current || y(D, t), l.current;
121
+ }
122
+ };
123
+ return N.cancel = function() {
124
+ c.current && (m ? cancelAnimationFrame(c.current) : clearTimeout(c.current)), a.current = 0, o.current = n.current = i.current = c.current = null;
125
+ }, N.isPending = function() {
126
+ return !!c.current;
127
+ }, N.flush = function() {
128
+ return c.current ? q(Date.now()) : l.current;
129
+ }, N;
130
+ }, [S, A, t, L, E, m, u, T]);
131
+ return K;
132
+ }
133
+ function xe(e, t) {
134
+ return e === t;
135
+ }
136
+ function pt(e, t, s) {
137
+ var r = xe, n = h(e), a = M({})[1], c = Z(I(function(i) {
138
+ n.current = i, a({});
139
+ }, [a]), t, s), o = h(e);
140
+ return r(o.current, e) || (c(e), o.current = e), [n.current, c];
141
+ }
142
+ function Ie(e, t, s) {
143
+ var r = {}, n = r.leading, a = r.trailing;
144
+ return Z(e, t, { maxWait: t, leading: n === void 0 || n, trailing: a === void 0 || a });
145
+ }
146
+ const G = (e) => {
147
+ const { scrollTop: t, scrollHeight: s, clientHeight: r, offset: n } = e;
148
+ return t + r + n >= s;
149
+ }, ye = (e) => {
150
+ const { enabled: t = !0, offset: s = 200 } = e || {}, r = h(!0), [n, a] = M(null), [c, o] = M(null), [i, l] = M(!0), f = Ie(
151
+ (u) => l(u),
152
+ 150
153
+ ), d = I(
154
+ (u) => {
155
+ n && (n.scrollTo({
156
+ top: n.scrollHeight,
157
+ behavior: u?.behavior || "instant"
158
+ }), r.current = !0, l(!0));
159
+ },
160
+ [n]
161
+ );
162
+ return x(() => {
163
+ if (!n) return;
164
+ const { scrollTop: u, scrollHeight: m, clientHeight: S } = n, E = G({
165
+ scrollHeight: m,
166
+ scrollTop: u,
167
+ clientHeight: S,
168
+ offset: s
169
+ });
170
+ r.current = E, l(E);
171
+ }, [n, s]), x(() => {
172
+ const u = new AbortController();
173
+ return n?.addEventListener(
174
+ "scroll",
175
+ () => {
176
+ const { scrollTop: m, scrollHeight: S, clientHeight: E } = n;
177
+ r.current = G({
178
+ scrollHeight: S,
179
+ scrollTop: m,
180
+ clientHeight: E,
181
+ offset: s
182
+ }), f(r.current);
183
+ },
184
+ {
185
+ signal: u.signal
186
+ }
187
+ ), () => u.abort();
188
+ }, [n, s, f]), we(c, (u) => {
189
+ t && c && u.target.isSameNode(c) && r.current && d();
190
+ }), Qe(() => {
191
+ n && (n.scrollTop = 0);
192
+ }), {
193
+ contentRef: o,
194
+ wrapperRef: a,
195
+ scrollToBottom: d,
196
+ isNearBottom: i
197
+ };
198
+ }, Ne = "_loading_sxdc0_9", He = "_message_sxdc0_57", Le = "_PIE_CHART_sxdc0_85", Pe = "_SUNBURST_CHART_sxdc0_86", De = "_HEAT_MAP_sxdc0_91", ke = "_BAR_CHART_sxdc0_96", Be = "_LINE_CHART_sxdc0_101", Oe = "_AREA_CHART_sxdc0_106", ze = "_TREE_MAP_sxdc0_111", Ue = "_SCATTER_CHART_sxdc0_116", je = "_SCORE_CARD_sxdc0_121", qe = "_spin_sxdc0_135", g = {
199
+ "chat-conversation": "_chat-conversation_sxdc0_1",
200
+ loading: Ne,
201
+ "list-mesage": "_list-mesage_sxdc0_14",
202
+ "chat-input-wrapper": "_chat-input-wrapper_sxdc0_18",
203
+ "chat-input": "_chat-input_sxdc0_18",
204
+ "list-message": "_list-message_sxdc0_28",
205
+ "to-bottom-btn": "_to-bottom-btn_sxdc0_34",
206
+ "list-message-overflow": "_list-message-overflow_sxdc0_46",
207
+ "list-message-content": "_list-message-content_sxdc0_51",
208
+ message: He,
209
+ "chart-wrapper": "_chart-wrapper_sxdc0_69",
210
+ "slot-right": "_slot-right_sxdc0_70",
211
+ "message-content": "_message-content_sxdc0_73",
212
+ PIE_CHART: Le,
213
+ SUNBURST_CHART: Pe,
214
+ HEAT_MAP: De,
215
+ BAR_CHART: ke,
216
+ LINE_CHART: Be,
217
+ AREA_CHART: Oe,
218
+ TREE_MAP: ze,
219
+ SCATTER_CHART: Ue,
220
+ SCORE_CARD: je,
221
+ spin: qe
222
+ }, J = (e) => {
223
+ const { messages: t } = e;
224
+ return !w.message.order(t).some(
225
+ (n) => n.content.type === se.reqDatasource && !n.content.userSelected
226
+ );
227
+ }, We = (e) => (t) => {
228
+ const s = R(g["chart-wrapper"], g[t.identifier]);
229
+ return typeof e == "string" ? R(e, s) : e && t ? R(e(t), s) : s;
230
+ }, $e = (e) => {
231
+ const { conversationId: t } = e, s = z(), [r, n] = M([]), { data: a, isLoading: c } = U.query({
232
+ auth: s,
233
+ id: t,
234
+ onSuccess: () => n(() => [])
235
+ }), o = w.message.order(a?.messages || []), { msg: i } = Fe({ conversationId: t }), { send: l, isSending: f } = ve.mutate({ auth: s }), d = J({
236
+ messages: o
237
+ }), u = I(
238
+ (m, S) => {
239
+ t && i?.agentId && (n(() => [
240
+ m,
241
+ w.message.make({
242
+ conversationId: t,
243
+ status: F.WAITING_INITIAL,
244
+ sender: b.assistant
245
+ })
246
+ ]), l(
247
+ { messages: [...o, m] },
248
+ {
249
+ onSuccess: (E) => {
250
+ const A = {
251
+ ...m,
252
+ id: E.parentId
253
+ }, T = {
254
+ ...E.message
255
+ };
256
+ n(() => [A, T]), S?.onSuccess?.({
257
+ questionMsg: A,
258
+ answerMsg: T
259
+ });
260
+ },
261
+ onError: () => {
262
+ const E = w.message.make({
263
+ agentId: i.agentId,
264
+ conversationId: t,
265
+ sender: b.assistant,
266
+ content: {
267
+ type: "helper",
268
+ status: "danger",
269
+ help: "Something went wrong. Please try again!"
270
+ }
271
+ });
272
+ n((A) => [A[0], E]);
273
+ }
274
+ }
275
+ ));
276
+ },
277
+ [i?.agentId, t, o, l]
278
+ );
279
+ return {
280
+ isLoading: c,
281
+ isSending: f,
282
+ allowSendMsg: d,
283
+ messages: ne([...o, ...r], (m) => m.id),
284
+ sendMessage: u
285
+ };
286
+ }, Ge = (e) => {
287
+ const { conversationId: t } = e, s = z(), { data: r } = U.query({
288
+ auth: s,
289
+ id: t
290
+ });
291
+ return { dataSourceIds: r ? w.conversation.getUsedDataSourceIds(r) : [] };
292
+ }, Fe = (e) => {
293
+ const { conversationId: t } = e, s = z(), { data: r } = U.query({
294
+ auth: s,
295
+ id: t
296
+ }), n = w.message.order(r?.messages || []);
297
+ return { msg: Re(n.filter((c) => c.sender === b.assistant)) };
298
+ };
299
+ function Qe(e) {
300
+ const t = h(e);
301
+ t.current = e, x(
302
+ () => () => {
303
+ t.current();
304
+ },
305
+ []
306
+ );
307
+ }
308
+ const Ve = re.div`
309
+ border: 1px solid ${Q.token?.bw3};
310
+ border-radius: 10px;
311
+ position: relative;
312
+ height: 30px;
313
+ width: 30px;
314
+ display: flex;
315
+ align-items: center;
316
+ justify-content: center;
317
+ flex-shrink: 0;
318
+ `, Ye = (e) => {
319
+ const { sender: t } = e;
320
+ let s = null;
321
+ switch (t) {
322
+ case b.assistant: {
323
+ s = /* @__PURE__ */ v.createElement(ae, { size: 24, "data-testid": "sender-icon" });
324
+ break;
325
+ }
326
+ }
327
+ return s ? /* @__PURE__ */ v.createElement(Ve, null, s) : null;
328
+ }, Ze = "_wrapper_m47z9_1", Je = "_bar_m47z9_13", B = {
329
+ wrapper: Ze,
330
+ "list-bars": "_list-bars_m47z9_7",
331
+ bar: Je
332
+ }, Ke = (e) => {
333
+ const { height: t = 20, size: s = 8, title: r } = e, n = [];
334
+ for (let a = 0; a < s; a++)
335
+ n.push(
336
+ /* @__PURE__ */ v.createElement(
337
+ "div",
338
+ {
339
+ key: a,
340
+ className: B.bar,
341
+ style: {
342
+ "--bar-color": Q.token?.colorPrimary,
343
+ "--bar-delay": +(1 / s * a).toFixed(2)
344
+ }
345
+ }
346
+ )
347
+ );
348
+ return /* @__PURE__ */ v.createElement("div", { className: B.wrapper }, /* @__PURE__ */ v.createElement("div", { style: { "--list-height": t }, className: B["list-bars"] }, n), r && /* @__PURE__ */ v.createElement(Y.Text, null, r));
349
+ }, Xe = {
350
+ dynamicContent: {
351
+ charts: {
352
+ ids: /* @__PURE__ */ new Set(),
353
+ map: /* @__PURE__ */ new Map()
354
+ }
355
+ }
356
+ }, et = (e) => {
357
+ const { message: t } = e, s = ce(
358
+ oe((r, n) => ({
359
+ ...Xe,
360
+ message: t,
361
+ updateDynamicContent: (a) => {
362
+ r((c) => {
363
+ c.dynamicContent = a;
364
+ });
365
+ },
366
+ updateDynamicCharts: (a) => {
367
+ r((c) => {
368
+ c.dynamicContent.charts = a;
369
+ });
370
+ },
371
+ setDynamicChart: (a, c) => {
372
+ const o = new Set(n().dynamicContent.charts.ids).add(a), i = new Map(n().dynamicContent.charts.map).set(a, c);
373
+ r((l) => {
374
+ l.dynamicContent.charts = {
375
+ ids: o,
376
+ map: i
377
+ };
378
+ });
379
+ }
380
+ })),
381
+ {
382
+ name: `ConversationMessageStore_${t.id}`
383
+ }
384
+ );
385
+ return ie()(s);
386
+ }, tt = ge(
387
+ void 0
388
+ ), st = (e) => {
389
+ const { children: t, message: s, chart: r } = e, n = h(
390
+ et({ message: s })
391
+ );
392
+ return x(() => {
393
+ n.current?.setState((a) => {
394
+ a.dynamicContent.charts.extra = r, a.message = s;
395
+ });
396
+ }, [r, s]), n.current ? /* @__PURE__ */ React.createElement(tt.Provider, { value: n.current }, t) : null;
397
+ }, nt = "_content_u31ju_37", C = {
398
+ "conver-message": "_conver-message_u31ju_1",
399
+ "own-message": "_own-message_u31ju_5",
400
+ "assistant-message": "_assistant-message_u31ju_15",
401
+ "waiting-init-msg": "_waiting-init-msg_u31ju_16",
402
+ "helper-text": "_helper-text_u31ju_24",
403
+ "slot-right": "_slot-right_u31ju_30",
404
+ content: nt
405
+ }, rt = _e(() => import("./index-Duemd0uq.mjs").then((e) => e.l)), at = V(
406
+ (e, t) => {
407
+ const { message: s, className: r, chartProps: n, classes: a, ...c } = e, o = s.sender === b.user, i = s.sender === b.assistant, l = () => i && s.status === F.WAITING_INITIAL ? /* @__PURE__ */ React.createElement("div", { className: C["waiting-init-msg"] }, /* @__PURE__ */ React.createElement("span", { className: C["helper-text"] }, "Please waiting..."), /* @__PURE__ */ React.createElement(Ke, { height: 16, size: 6 })) : /* @__PURE__ */ React.createElement("div", { className: R(C["slot-right"], a?.slotRight) }, s.sender === b.assistant && /* @__PURE__ */ React.createElement(Y.Text, null, le[s.agentId].name), /* @__PURE__ */ React.createElement(fe, null, /* @__PURE__ */ React.createElement(rt, { className: R(C.content, a?.content) })));
408
+ return /* @__PURE__ */ React.createElement(st, { message: s, chart: n }, /* @__PURE__ */ React.createElement(
409
+ "div",
410
+ {
411
+ ...c,
412
+ ref: t,
413
+ className: R(
414
+ C["conver-message"],
415
+ {
416
+ [C["own-message"]]: o,
417
+ [C["assistant-message"]]: i
418
+ },
419
+ r
420
+ ),
421
+ "data-testid": "conversation-message"
422
+ },
423
+ /* @__PURE__ */ React.createElement(Ye, { sender: s.sender }),
424
+ l()
425
+ ));
426
+ }
427
+ ), ct = (e) => {
428
+ const { messages: t = [], messageProps: s } = e, { chartProps: r } = s || {};
429
+ return t.map((n) => {
430
+ const { id: a } = n;
431
+ return /* @__PURE__ */ React.createElement(
432
+ at,
433
+ {
434
+ key: a,
435
+ message: n,
436
+ className: g.message,
437
+ classes: {
438
+ content: g["message-content"],
439
+ slotRight: g["slot-right"]
440
+ },
441
+ chartProps: {
442
+ ...r,
443
+ classes: {
444
+ ...r?.classes,
445
+ wrapper: We(r?.classes?.wrapper)
446
+ }
447
+ }
448
+ }
449
+ );
450
+ });
451
+ }, ot = (e) => {
452
+ const { children: t, messagesLength: s = 0, loading: r = !1, className: n = "" } = e, a = s > 0 && !r, {
453
+ wrapperRef: c,
454
+ contentRef: o,
455
+ isNearBottom: i,
456
+ scrollToBottom: l
457
+ } = ye({
458
+ enabled: a
459
+ });
460
+ return r ? /* @__PURE__ */ v.createElement(pe, { className: g.spin, indicatorSize: 20 }) : /* @__PURE__ */ v.createElement("div", { className: R(g["list-message"], n) }, /* @__PURE__ */ v.createElement("div", { className: R(g["list-message-overflow"]), ref: c }, /* @__PURE__ */ v.createElement("div", { className: g["list-message-content"], ref: o }, t)), !i && a && /* @__PURE__ */ v.createElement(
461
+ he,
462
+ {
463
+ shape: "circle",
464
+ className: g["to-bottom-btn"],
465
+ icon: /* @__PURE__ */ v.createElement(Ee, null),
466
+ onClick: () => l({ behavior: "smooth" })
467
+ }
468
+ ));
469
+ }, it = (e) => {
470
+ const { conversationId: t } = e, { messages: s, isLoading: r, isSending: n, sendMessage: a } = $e({ conversationId: t }), { dataSourceIds: c } = Ge({ conversationId: t }), o = O(s.filter((d) => d.sender === b.assistant)), i = O(c), l = J({ messages: s }), f = I(
471
+ (d, u) => {
472
+ if (!o?.agentId)
473
+ return;
474
+ const m = w.message.make({
475
+ agentId: o.agentId,
476
+ conversationId: t,
477
+ content: {
478
+ type: "text",
479
+ text: d
480
+ },
481
+ ...o.agentId === ue.chart && {
482
+ dataSourceId: i || null
483
+ }
484
+ });
485
+ a(m, {
486
+ onSuccess: u?.onSuccess
487
+ });
488
+ },
489
+ [t, o, i, a]
490
+ );
491
+ return {
492
+ isLoading: r,
493
+ isSending: n,
494
+ allowSendMsg: l,
495
+ messages: s,
496
+ sendMessage: f
497
+ };
498
+ }, lt = (e) => {
499
+ const { conversationId: t, messageProps: s, className: r } = e, { allowSendMsg: n, messages: a, isLoading: c, sendMessage: o } = it({
500
+ conversationId: t
501
+ }), i = I(
502
+ ({ text: l }) => o(l),
503
+ [o]
504
+ );
505
+ return /* @__PURE__ */ React.createElement(
506
+ "div",
507
+ {
508
+ className: R(
509
+ g["chat-conversation"],
510
+ {
511
+ [g.loading]: c
512
+ },
513
+ r
514
+ )
515
+ },
516
+ /* @__PURE__ */ React.createElement(
517
+ ot,
518
+ {
519
+ loading: c,
520
+ className: g["list-mesage"],
521
+ messagesLength: a.length
522
+ },
523
+ /* @__PURE__ */ React.createElement(ct, { messageProps: s, messages: a })
524
+ ),
525
+ /* @__PURE__ */ React.createElement("div", { className: g["chat-input-wrapper"] }, /* @__PURE__ */ React.createElement(
526
+ de,
527
+ {
528
+ className: g["chat-input"],
529
+ disabled: !n,
530
+ onSubmit: i
531
+ }
532
+ ))
533
+ );
534
+ }, ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
535
+ __proto__: null,
536
+ ChatConversation: lt
537
+ }, Symbol.toStringTag, { value: "Module" }));
538
+ export {
539
+ tt as C,
540
+ pt as a,
541
+ Qe as b,
542
+ $e as c,
543
+ Ge as d,
544
+ ht as i,
545
+ we as u
546
+ };