@automattic/agenttic-ui 0.1.70 → 0.1.72
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.
- package/dist/components/chat/Chat.d.ts +1 -1
- package/dist/components/chat/Chat.d.ts.map +1 -1
- package/dist/components/chat/Messages.d.ts.map +1 -1
- package/dist/components/chat/Suggestions.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +1244 -1210
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import './global.css';import './index.css';/* empty css */
|
|
2
|
-
import { jsx as a, jsxs as
|
|
2
|
+
import { jsx as a, jsxs as C, Fragment as Ke } from "react/jsx-runtime";
|
|
3
3
|
import * as Yt from "react";
|
|
4
|
-
import
|
|
5
|
-
import { c as
|
|
6
|
-
import { Q as
|
|
7
|
-
import { motion as se, AnimatePresence as
|
|
8
|
-
import { setLocaleData as Ht, __ as E, sprintf as
|
|
4
|
+
import ne, { useState as Y, useEffect as L, useCallback as w, useRef as O, createContext as On, useContext as Ln, useId as Nn, useMemo as ot, memo as Kt, forwardRef as Jt, useImperativeHandle as xn, Component as Dn } from "react";
|
|
5
|
+
import { c as de } from "./QuestionCard-KolZKB58.js";
|
|
6
|
+
import { Q as Fc } from "./QuestionCard-KolZKB58.js";
|
|
7
|
+
import { motion as se, AnimatePresence as ct, useMotionValue as pt, useDragControls as qt, animate as ye } from "framer-motion";
|
|
8
|
+
import { setLocaleData as Ht, __ as E, sprintf as je } from "@wordpress/i18n";
|
|
9
9
|
import { Slot as En } from "@radix-ui/react-slot";
|
|
10
|
-
import * as
|
|
10
|
+
import * as Ue from "@radix-ui/react-popover";
|
|
11
11
|
import At from "react-markdown";
|
|
12
12
|
import { useDebounce as Rn } from "use-debounce";
|
|
13
13
|
import Pn from "remark-gfm";
|
|
14
14
|
import { defaultTheme as $n, ThemeProvider as Fn, BarChart as jn, LineChart as Un } from "@automattic/charts";
|
|
15
|
-
const
|
|
15
|
+
const b = {
|
|
16
16
|
COLLAPSED_SIZE: 56,
|
|
17
17
|
COMPACT_WIDTH: 372,
|
|
18
18
|
EXPANDED_HEIGHT: 520,
|
|
@@ -1710,15 +1710,15 @@ function _i(t = "en", e = {}) {
|
|
|
1710
1710
|
return !1;
|
|
1711
1711
|
}
|
|
1712
1712
|
function Za(t) {
|
|
1713
|
-
const e = t || "collapsed", [i, n] =
|
|
1714
|
-
|
|
1713
|
+
const e = t || "collapsed", [i, n] = Y(e);
|
|
1714
|
+
L(() => {
|
|
1715
1715
|
t !== void 0 && n(t);
|
|
1716
1716
|
}, [t]);
|
|
1717
|
-
const o = i === "expanded", c =
|
|
1717
|
+
const o = i === "expanded", c = w(() => {
|
|
1718
1718
|
n("expanded");
|
|
1719
|
-
}, []), r =
|
|
1719
|
+
}, []), r = w(() => {
|
|
1720
1720
|
n(e);
|
|
1721
|
-
}, [e]), s =
|
|
1721
|
+
}, [e]), s = w(() => {
|
|
1722
1722
|
n(
|
|
1723
1723
|
(l) => l === "collapsed" ? "compact" : "collapsed"
|
|
1724
1724
|
);
|
|
@@ -1742,28 +1742,28 @@ function Ya({
|
|
|
1742
1742
|
floatingChatState: c,
|
|
1743
1743
|
disabled: r = !1
|
|
1744
1744
|
}) {
|
|
1745
|
-
const s =
|
|
1745
|
+
const s = O(null), l = w(() => {
|
|
1746
1746
|
e(""), s.current && (s.current.style.height = "auto", setTimeout(() => {
|
|
1747
1747
|
var u;
|
|
1748
1748
|
(u = s.current) == null || u.focus();
|
|
1749
1749
|
}, 100));
|
|
1750
|
-
}, [e]), g =
|
|
1750
|
+
}, [e]), g = w(() => {
|
|
1751
1751
|
const u = s.current;
|
|
1752
1752
|
if (!u)
|
|
1753
1753
|
return;
|
|
1754
1754
|
u.style.height = "auto";
|
|
1755
|
-
const h = u.scrollHeight,
|
|
1755
|
+
const h = u.scrollHeight, A = 40, x = 200;
|
|
1756
1756
|
u.style.height = `${Math.min(
|
|
1757
|
-
Math.max(h,
|
|
1757
|
+
Math.max(h, A),
|
|
1758
1758
|
x
|
|
1759
1759
|
)}px`;
|
|
1760
|
-
}, []), d =
|
|
1760
|
+
}, []), d = w(
|
|
1761
1761
|
(u) => {
|
|
1762
1762
|
u.key === "Enter" && !u.shiftKey && !n && !o && !r && (u.preventDefault(), i(t.trim()), l());
|
|
1763
1763
|
},
|
|
1764
1764
|
[t, n, o, i, l, r]
|
|
1765
1765
|
);
|
|
1766
|
-
return
|
|
1766
|
+
return L(() => {
|
|
1767
1767
|
g();
|
|
1768
1768
|
}, [t, c, g]), {
|
|
1769
1769
|
value: t,
|
|
@@ -1775,8 +1775,8 @@ function Ya({
|
|
|
1775
1775
|
};
|
|
1776
1776
|
}
|
|
1777
1777
|
function Ti() {
|
|
1778
|
-
const [t, e] =
|
|
1779
|
-
return
|
|
1778
|
+
const [t, e] = Y(!0);
|
|
1779
|
+
return L(() => {
|
|
1780
1780
|
const i = () => e(!0), n = () => e(!1);
|
|
1781
1781
|
return window.addEventListener("focus", i), window.addEventListener("blur", n), () => {
|
|
1782
1782
|
window.removeEventListener("focus", i), window.removeEventListener("blur", n);
|
|
@@ -1798,7 +1798,7 @@ function Ja(t = "left") {
|
|
|
1798
1798
|
return t;
|
|
1799
1799
|
}
|
|
1800
1800
|
function Ot({ x: t, y: e }, i, n) {
|
|
1801
|
-
const o = window.innerWidth - i -
|
|
1801
|
+
const o = window.innerWidth - i - b.VIEWPORT_OFFSET * 2, c = 2 * b.VIEWPORT_OFFSET + n - window.innerHeight;
|
|
1802
1802
|
return {
|
|
1803
1803
|
x: Math.max(0, Math.min(t, o)),
|
|
1804
1804
|
y: Math.max(c, Math.min(e, 0))
|
|
@@ -1809,11 +1809,11 @@ function qa({
|
|
|
1809
1809
|
initialFreeDragPosition: e,
|
|
1810
1810
|
side: i
|
|
1811
1811
|
}) {
|
|
1812
|
-
const n = i === "right" ? window.innerWidth -
|
|
1812
|
+
const n = i === "right" ? window.innerWidth - b.COMPACT_WIDTH - b.VIEWPORT_OFFSET * 2 : 0;
|
|
1813
1813
|
return !t || e === void 0 ? { x: n, y: 0 } : Ot(
|
|
1814
1814
|
e,
|
|
1815
|
-
|
|
1816
|
-
|
|
1815
|
+
b.COMPACT_WIDTH,
|
|
1816
|
+
b.EXPANDED_HEIGHT
|
|
1817
1817
|
);
|
|
1818
1818
|
}
|
|
1819
1819
|
function ht(t) {
|
|
@@ -1827,16 +1827,16 @@ const It = {
|
|
|
1827
1827
|
type: "spring",
|
|
1828
1828
|
stiffness: 300,
|
|
1829
1829
|
damping: 30
|
|
1830
|
-
},
|
|
1830
|
+
}, Be = {
|
|
1831
1831
|
type: "spring",
|
|
1832
1832
|
damping: 40,
|
|
1833
1833
|
stiffness: 500,
|
|
1834
1834
|
mass: 0.8
|
|
1835
1835
|
}, ft = {
|
|
1836
|
-
...
|
|
1836
|
+
...Be,
|
|
1837
1837
|
stiffness: 1e3,
|
|
1838
1838
|
damping: 90
|
|
1839
|
-
},
|
|
1839
|
+
}, He = {
|
|
1840
1840
|
type: "spring",
|
|
1841
1841
|
damping: 40,
|
|
1842
1842
|
stiffness: 500,
|
|
@@ -1868,17 +1868,17 @@ const It = {
|
|
|
1868
1868
|
}, Si = {
|
|
1869
1869
|
"0%": { backgroundPosition: "-200% 0" },
|
|
1870
1870
|
"100%": { backgroundPosition: "200% 0" }
|
|
1871
|
-
},
|
|
1871
|
+
}, vc = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1872
1872
|
__proto__: null,
|
|
1873
1873
|
fadeVariants: Xa,
|
|
1874
|
-
fastSpring:
|
|
1874
|
+
fastSpring: Be,
|
|
1875
1875
|
fastSpringWithDelay: ft,
|
|
1876
1876
|
getDragConstraints: Ii,
|
|
1877
|
-
morphSpring:
|
|
1877
|
+
morphSpring: He,
|
|
1878
1878
|
springConfig: It,
|
|
1879
1879
|
thinkingGradientKeyframes: Si
|
|
1880
1880
|
}, Symbol.toStringTag, { value: "Module" })), Qa = On(null);
|
|
1881
|
-
function
|
|
1881
|
+
function Ne() {
|
|
1882
1882
|
const t = Ln(Qa);
|
|
1883
1883
|
if (!t)
|
|
1884
1884
|
throw new Error(
|
|
@@ -1889,7 +1889,7 @@ function Oe() {
|
|
|
1889
1889
|
function Vt({ children: t, value: e }) {
|
|
1890
1890
|
return /* @__PURE__ */ a(Qa.Provider, { value: e, children: t });
|
|
1891
1891
|
}
|
|
1892
|
-
const ki = "button-module_button", Mi = "button-module_pressed", Ai = "button-module_primary", Oi = "button-module_ghost", Li = "button-module_outline", Ni = "button-module_transparent", xi = "button-module_link", Di = "button-module_icon", Ei = "button-module_sm", Ri = "button-module_lg", Pi = "button-module_withTextAndIcon",
|
|
1892
|
+
const ki = "button-module_button", Mi = "button-module_pressed", Ai = "button-module_primary", Oi = "button-module_ghost", Li = "button-module_outline", Ni = "button-module_transparent", xi = "button-module_link", Di = "button-module_icon", Ei = "button-module_sm", Ri = "button-module_lg", Pi = "button-module_withTextAndIcon", et = {
|
|
1893
1893
|
button: ki,
|
|
1894
1894
|
pressed: Mi,
|
|
1895
1895
|
primary: Ai,
|
|
@@ -1913,17 +1913,17 @@ const ki = "button-module_button", Mi = "button-module_pressed", Ai = "button-mo
|
|
|
1913
1913
|
...l
|
|
1914
1914
|
}, g) {
|
|
1915
1915
|
const d = r ? En : "button", u = !!o, h = n || (u && !c ? "icon" : void 0);
|
|
1916
|
-
return /* @__PURE__ */
|
|
1916
|
+
return /* @__PURE__ */ C(
|
|
1917
1917
|
d,
|
|
1918
1918
|
{
|
|
1919
1919
|
ref: g,
|
|
1920
1920
|
"data-slot": "button",
|
|
1921
|
-
className:
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
h &&
|
|
1925
|
-
u && c ?
|
|
1926
|
-
s ?
|
|
1921
|
+
className: de(
|
|
1922
|
+
et.button,
|
|
1923
|
+
et[i],
|
|
1924
|
+
h && et[h],
|
|
1925
|
+
u && c ? et.withTextAndIcon : void 0,
|
|
1926
|
+
s ? et.pressed : void 0,
|
|
1927
1927
|
e
|
|
1928
1928
|
),
|
|
1929
1929
|
"aria-pressed": s,
|
|
@@ -1966,8 +1966,8 @@ function en({
|
|
|
1966
1966
|
onHover: i,
|
|
1967
1967
|
focusOnMount: n = !1
|
|
1968
1968
|
}) {
|
|
1969
|
-
const o =
|
|
1970
|
-
return
|
|
1969
|
+
const o = O(null), c = O(n);
|
|
1970
|
+
return L(() => {
|
|
1971
1971
|
c.current && o.current && o.current.focus(), c.current = !1;
|
|
1972
1972
|
}, [c, o]), /* @__PURE__ */ a(
|
|
1973
1973
|
se.div,
|
|
@@ -1983,7 +1983,7 @@ function en({
|
|
|
1983
1983
|
opacity: 1,
|
|
1984
1984
|
scale: 1,
|
|
1985
1985
|
transition: {
|
|
1986
|
-
...
|
|
1986
|
+
...He,
|
|
1987
1987
|
delay: 0.2
|
|
1988
1988
|
}
|
|
1989
1989
|
},
|
|
@@ -2067,7 +2067,7 @@ function Hi({ className: t, size: e = 24 }) {
|
|
|
2067
2067
|
}
|
|
2068
2068
|
);
|
|
2069
2069
|
}
|
|
2070
|
-
const Vi = "ChatInput-module_container", Wi = "ChatInput-module_textareaContainer", zi = "ChatInput-module_actions", Gi = "ChatInput-module_containerStacked", Zi = "ChatInput-module_button",
|
|
2070
|
+
const Vi = "ChatInput-module_container", Wi = "ChatInput-module_textareaContainer", zi = "ChatInput-module_actions", Gi = "ChatInput-module_containerStacked", Zi = "ChatInput-module_button", Fe = {
|
|
2071
2071
|
container: Vi,
|
|
2072
2072
|
textareaContainer: Wi,
|
|
2073
2073
|
actions: zi,
|
|
@@ -2104,19 +2104,19 @@ function Ji({
|
|
|
2104
2104
|
interval: e = 3e3,
|
|
2105
2105
|
className: i = ""
|
|
2106
2106
|
}) {
|
|
2107
|
-
const [n, o] =
|
|
2108
|
-
return
|
|
2107
|
+
const [n, o] = Y(0);
|
|
2108
|
+
return L(() => {
|
|
2109
2109
|
const c = setInterval(() => {
|
|
2110
2110
|
o(
|
|
2111
2111
|
(r) => (r + 1) % t.length
|
|
2112
2112
|
);
|
|
2113
2113
|
}, e);
|
|
2114
2114
|
return () => clearInterval(c);
|
|
2115
|
-
}, [t.length, e]), /* @__PURE__ */ a(
|
|
2115
|
+
}, [t.length, e]), /* @__PURE__ */ a(ct, { mode: "wait", children: /* @__PURE__ */ a(
|
|
2116
2116
|
se.span,
|
|
2117
2117
|
{
|
|
2118
2118
|
"data-slot": "animated-placeholder",
|
|
2119
|
-
className:
|
|
2119
|
+
className: de(Ki.container, i),
|
|
2120
2120
|
initial: { opacity: 0, y: 8 },
|
|
2121
2121
|
animate: { opacity: 1, y: 0 },
|
|
2122
2122
|
exit: { opacity: 0, y: -8 },
|
|
@@ -2144,90 +2144,90 @@ function Nt({
|
|
|
2144
2144
|
fromCompact: d = !1,
|
|
2145
2145
|
onExpand: u,
|
|
2146
2146
|
showExpandButton: h = !0,
|
|
2147
|
-
focusOnMount:
|
|
2147
|
+
focusOnMount: A = !1,
|
|
2148
2148
|
customActions: x = [],
|
|
2149
2149
|
actionOrder: N = "before-submit",
|
|
2150
|
-
onStop:
|
|
2151
|
-
disabled:
|
|
2152
|
-
onMouseEnter:
|
|
2153
|
-
onMouseLeave:
|
|
2150
|
+
onStop: $,
|
|
2151
|
+
disabled: f,
|
|
2152
|
+
onMouseEnter: T,
|
|
2153
|
+
onMouseLeave: M,
|
|
2154
2154
|
expandOnClick: D = !1,
|
|
2155
|
-
layout:
|
|
2155
|
+
layout: _ = "inline"
|
|
2156
2156
|
}) {
|
|
2157
|
-
const
|
|
2157
|
+
const j = Nn(), { variant: K, floatingChatState: H, isInputOverLimit: I } = Ne(), V = (
|
|
2158
2158
|
// If the consumer actively sets `disabled` to `false` (vs undefined), that takes precedence.
|
|
2159
|
-
|
|
2160
|
-
),
|
|
2161
|
-
(
|
|
2162
|
-
const
|
|
2163
|
-
if (
|
|
2164
|
-
|
|
2159
|
+
f !== void 0 ? !f : (t.trim() || r) && !I
|
|
2160
|
+
), m = w(
|
|
2161
|
+
(v) => {
|
|
2162
|
+
const _e = v.key.toLowerCase();
|
|
2163
|
+
if (_e === "enter" && !v.shiftKey && (v.nativeEvent.isComposing || v.keyCode === 229)) {
|
|
2164
|
+
v.preventDefault();
|
|
2165
2165
|
return;
|
|
2166
2166
|
}
|
|
2167
|
-
if (
|
|
2168
|
-
|
|
2167
|
+
if (_e === "enter" && !v.shiftKey && !V) {
|
|
2168
|
+
v.preventDefault();
|
|
2169
2169
|
return;
|
|
2170
2170
|
}
|
|
2171
|
-
((
|
|
2171
|
+
((v.metaKey || v.ctrlKey) && _e === "z" || v.ctrlKey && _e === "y") && v.stopPropagation(), n(v);
|
|
2172
2172
|
},
|
|
2173
|
-
[
|
|
2174
|
-
),
|
|
2175
|
-
let
|
|
2176
|
-
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2179
|
-
|
|
2180
|
-
}, [
|
|
2181
|
-
const
|
|
2173
|
+
[V, n]
|
|
2174
|
+
), z = (v) => v.endsWith("…") ? v : `${v}…`, ie = Array.isArray(c);
|
|
2175
|
+
let W;
|
|
2176
|
+
ie ? W = c.map(z) : c ? W = z(c) : W = "";
|
|
2177
|
+
const Se = O(A);
|
|
2178
|
+
L(() => {
|
|
2179
|
+
Se.current && o.current && o.current.focus(), Se.current = !1;
|
|
2180
|
+
}, [Se, o]);
|
|
2181
|
+
const ge = () => x.map((v) => /* @__PURE__ */ a(
|
|
2182
2182
|
we,
|
|
2183
2183
|
{
|
|
2184
|
-
className:
|
|
2185
|
-
onClick:
|
|
2186
|
-
disabled:
|
|
2187
|
-
variant:
|
|
2188
|
-
icon:
|
|
2189
|
-
"aria-label":
|
|
2184
|
+
className: v.className || Fe.button,
|
|
2185
|
+
onClick: v.onClick,
|
|
2186
|
+
disabled: v.disabled,
|
|
2187
|
+
variant: v.variant || "ghost",
|
|
2188
|
+
icon: v.icon,
|
|
2189
|
+
"aria-label": v["aria-label"]
|
|
2190
2190
|
},
|
|
2191
|
-
|
|
2192
|
-
)),
|
|
2191
|
+
v.id
|
|
2192
|
+
)), J = () => K === "embedded" || H === "expanded" || D ? null : h && u ? /* @__PURE__ */ a(
|
|
2193
2193
|
we,
|
|
2194
2194
|
{
|
|
2195
|
-
className:
|
|
2195
|
+
className: Fe.button,
|
|
2196
2196
|
onClick: u,
|
|
2197
2197
|
variant: "ghost",
|
|
2198
2198
|
icon: /* @__PURE__ */ a(an, {}),
|
|
2199
2199
|
"aria-label": E("Expand conversation", "a8c-agenttic")
|
|
2200
2200
|
}
|
|
2201
|
-
) : null,
|
|
2202
|
-
if (r &&
|
|
2201
|
+
) : null, Ce = () => {
|
|
2202
|
+
if (r && !$)
|
|
2203
2203
|
return null;
|
|
2204
|
-
const
|
|
2205
|
-
r &&
|
|
2204
|
+
const v = () => {
|
|
2205
|
+
r && $ ? $() : i();
|
|
2206
2206
|
};
|
|
2207
2207
|
return /* @__PURE__ */ a(
|
|
2208
2208
|
we,
|
|
2209
2209
|
{
|
|
2210
|
-
className:
|
|
2211
|
-
onClick:
|
|
2212
|
-
disabled: !
|
|
2210
|
+
className: Fe.button,
|
|
2211
|
+
onClick: v,
|
|
2212
|
+
disabled: !V,
|
|
2213
2213
|
variant: "primary",
|
|
2214
2214
|
icon: r ? /* @__PURE__ */ a(Hi, {}) : /* @__PURE__ */ a(Bi, {}),
|
|
2215
2215
|
"aria-label": r ? E("Stop processing", "a8c-agenttic") : E("Send message", "a8c-agenttic")
|
|
2216
2216
|
}
|
|
2217
2217
|
);
|
|
2218
2218
|
};
|
|
2219
|
-
return /* @__PURE__ */
|
|
2219
|
+
return /* @__PURE__ */ C(
|
|
2220
2220
|
"div",
|
|
2221
2221
|
{
|
|
2222
2222
|
"data-slot": "chat-input",
|
|
2223
|
-
className: `${
|
|
2224
|
-
onMouseEnter:
|
|
2225
|
-
onMouseLeave:
|
|
2223
|
+
className: `${Fe.container}${_ === "stacked" ? ` ${Fe.containerStacked}` : ""}`,
|
|
2224
|
+
onMouseEnter: T,
|
|
2225
|
+
onMouseLeave: M,
|
|
2226
2226
|
children: [
|
|
2227
|
-
/* @__PURE__ */
|
|
2227
|
+
/* @__PURE__ */ C(
|
|
2228
2228
|
se.div,
|
|
2229
2229
|
{
|
|
2230
|
-
className:
|
|
2230
|
+
className: Fe.textareaContainer,
|
|
2231
2231
|
initial: {
|
|
2232
2232
|
opacity: 0
|
|
2233
2233
|
},
|
|
@@ -2237,24 +2237,24 @@ function Nt({
|
|
|
2237
2237
|
transition: t.trim() ? { duration: 0 } : ft
|
|
2238
2238
|
},
|
|
2239
2239
|
children: [
|
|
2240
|
-
!t &&
|
|
2240
|
+
!t && ie && /* @__PURE__ */ a(
|
|
2241
2241
|
Ji,
|
|
2242
2242
|
{
|
|
2243
|
-
texts:
|
|
2243
|
+
texts: W
|
|
2244
2244
|
}
|
|
2245
2245
|
),
|
|
2246
2246
|
/* @__PURE__ */ a(
|
|
2247
2247
|
tn,
|
|
2248
2248
|
{
|
|
2249
|
-
id:
|
|
2249
|
+
id: j,
|
|
2250
2250
|
ref: o,
|
|
2251
2251
|
value: t,
|
|
2252
|
-
onChange: (
|
|
2253
|
-
onKeyDown:
|
|
2252
|
+
onChange: (v) => e(v.target.value),
|
|
2253
|
+
onKeyDown: m,
|
|
2254
2254
|
onBlur: s,
|
|
2255
2255
|
onFocus: l,
|
|
2256
2256
|
onClick: g,
|
|
2257
|
-
placeholder:
|
|
2257
|
+
placeholder: ie ? "" : W,
|
|
2258
2258
|
rows: 1,
|
|
2259
2259
|
"aria-label": E("Chat input", "a8c-agenttic")
|
|
2260
2260
|
}
|
|
@@ -2262,10 +2262,10 @@ function Nt({
|
|
|
2262
2262
|
]
|
|
2263
2263
|
}
|
|
2264
2264
|
),
|
|
2265
|
-
/* @__PURE__ */
|
|
2265
|
+
/* @__PURE__ */ C(
|
|
2266
2266
|
se.div,
|
|
2267
2267
|
{
|
|
2268
|
-
className:
|
|
2268
|
+
className: Fe.actions,
|
|
2269
2269
|
initial: {
|
|
2270
2270
|
opacity: d ? 1 : 0,
|
|
2271
2271
|
scale: d ? 1 : 0.5
|
|
@@ -2273,13 +2273,13 @@ function Nt({
|
|
|
2273
2273
|
animate: {
|
|
2274
2274
|
opacity: 1,
|
|
2275
2275
|
scale: 1,
|
|
2276
|
-
transition: t.trim() ? { duration: 0 } :
|
|
2276
|
+
transition: t.trim() ? { duration: 0 } : Be
|
|
2277
2277
|
},
|
|
2278
2278
|
children: [
|
|
2279
|
-
|
|
2280
|
-
N === "before-submit" &&
|
|
2281
|
-
|
|
2282
|
-
N === "after-submit" &&
|
|
2279
|
+
J(),
|
|
2280
|
+
N === "before-submit" && ge(),
|
|
2281
|
+
Ce(),
|
|
2282
|
+
N === "after-submit" && ge()
|
|
2283
2283
|
]
|
|
2284
2284
|
}
|
|
2285
2285
|
)
|
|
@@ -2309,97 +2309,100 @@ function qi({ className: t, size: e = 24 }) {
|
|
|
2309
2309
|
}
|
|
2310
2310
|
);
|
|
2311
2311
|
}
|
|
2312
|
-
const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-module_chevron", er = "SuggestionDropdown-module_chevronOpen", tr = "SuggestionDropdown-module_dropdown", ar = "SuggestionDropdown-module_option",
|
|
2312
|
+
const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-module_chevron", er = "SuggestionDropdown-module_chevronOpen", tr = "SuggestionDropdown-module_dropdown", ar = "SuggestionDropdown-module_option", tt = {
|
|
2313
2313
|
container: Xi,
|
|
2314
2314
|
chevron: Qi,
|
|
2315
2315
|
chevronOpen: er,
|
|
2316
2316
|
dropdown: tr,
|
|
2317
2317
|
option: ar
|
|
2318
|
-
}, nr = "Suggestions-module_container", ir = "Suggestions-module_vertical", rr = "Suggestions-module_button", or = "Suggestions-module_floating",
|
|
2318
|
+
}, nr = "Suggestions-module_container", ir = "Suggestions-module_vertical", rr = "Suggestions-module_button", or = "Suggestions-module_label", cr = "Suggestions-module_description", sr = "Suggestions-module_floating", Le = {
|
|
2319
2319
|
container: nr,
|
|
2320
2320
|
vertical: ir,
|
|
2321
2321
|
button: rr,
|
|
2322
|
-
|
|
2323
|
-
|
|
2322
|
+
"suggestion-content--with-description": "Suggestions-module_suggestion-content--with-description",
|
|
2323
|
+
label: or,
|
|
2324
|
+
description: cr,
|
|
2325
|
+
floating: sr
|
|
2326
|
+
}, lr = (t, e) => !t || !e ? `${t}${e}` : /\s$/.test(t) || /^\s/.test(e) ? `${t}${e}` : `${t} ${e}`, dr = ({
|
|
2324
2327
|
suggestion: t,
|
|
2325
2328
|
onSelect: e,
|
|
2326
2329
|
availableSuggestions: i,
|
|
2327
2330
|
onOpenChange: n
|
|
2328
2331
|
}) => {
|
|
2329
|
-
var
|
|
2330
|
-
const [o, c] =
|
|
2331
|
-
(
|
|
2332
|
-
if (r.current =
|
|
2332
|
+
var $;
|
|
2333
|
+
const [o, c] = ne.useState(!1), r = ne.useRef(null), [s, l] = ne.useState(null), [g, d] = ne.useState(null), [u, h] = ne.useState(void 0), A = ne.useCallback(
|
|
2334
|
+
(f) => {
|
|
2335
|
+
if (r.current = f, !f) {
|
|
2333
2336
|
l(null), d(null);
|
|
2334
2337
|
return;
|
|
2335
2338
|
}
|
|
2336
2339
|
l(
|
|
2337
|
-
|
|
2340
|
+
f.closest(".agenttic") ?? f
|
|
2338
2341
|
), d(
|
|
2339
|
-
|
|
2342
|
+
f.closest(
|
|
2340
2343
|
'[data-slot="conversation-view"]'
|
|
2341
2344
|
) ?? null
|
|
2342
2345
|
);
|
|
2343
2346
|
},
|
|
2344
2347
|
[]
|
|
2345
|
-
), x =
|
|
2346
|
-
var
|
|
2347
|
-
if (
|
|
2348
|
-
const
|
|
2348
|
+
), x = ne.useCallback((f) => {
|
|
2349
|
+
var T;
|
|
2350
|
+
if (f) {
|
|
2351
|
+
const M = (T = r.current) == null ? void 0 : T.closest(
|
|
2349
2352
|
'[data-slot="suggestions"]'
|
|
2350
2353
|
);
|
|
2351
|
-
|
|
2354
|
+
M && h(M.clientWidth * 0.9);
|
|
2352
2355
|
}
|
|
2353
|
-
c(
|
|
2354
|
-
}, [n]), N = (
|
|
2355
|
-
const { options:
|
|
2356
|
-
...
|
|
2357
|
-
prompt:
|
|
2356
|
+
c(f), n == null || n(f);
|
|
2357
|
+
}, [n]), N = (f) => {
|
|
2358
|
+
const { options: T, ...M } = t, D = {
|
|
2359
|
+
...M,
|
|
2360
|
+
prompt: lr(
|
|
2358
2361
|
t.prompt ?? t.label,
|
|
2359
|
-
|
|
2362
|
+
f.value
|
|
2360
2363
|
),
|
|
2361
|
-
label: `${t.label} ${
|
|
2364
|
+
label: `${t.label} ${f.label}`
|
|
2362
2365
|
};
|
|
2363
2366
|
e == null || e(D, i), x(!1);
|
|
2364
2367
|
};
|
|
2365
|
-
return /* @__PURE__ */ a("div", { ref:
|
|
2366
|
-
/* @__PURE__ */ a(
|
|
2368
|
+
return /* @__PURE__ */ a("div", { ref: A, className: tt.container, children: /* @__PURE__ */ C(Ue.Root, { open: o, onOpenChange: x, children: [
|
|
2369
|
+
/* @__PURE__ */ a(Ue.Trigger, { asChild: !0, children: /* @__PURE__ */ C(
|
|
2367
2370
|
we,
|
|
2368
2371
|
{
|
|
2369
2372
|
variant: "outline",
|
|
2370
|
-
className:
|
|
2373
|
+
className: Le.button,
|
|
2371
2374
|
children: [
|
|
2372
2375
|
t.label,
|
|
2373
2376
|
/* @__PURE__ */ a(
|
|
2374
2377
|
qi,
|
|
2375
2378
|
{
|
|
2376
2379
|
size: 14,
|
|
2377
|
-
className: `${
|
|
2380
|
+
className: `${tt.chevron} ${o ? tt.chevronOpen : ""}`
|
|
2378
2381
|
}
|
|
2379
2382
|
)
|
|
2380
2383
|
]
|
|
2381
2384
|
}
|
|
2382
2385
|
) }),
|
|
2383
|
-
s && /* @__PURE__ */ a(
|
|
2384
|
-
|
|
2386
|
+
s && /* @__PURE__ */ a(Ue.Portal, { container: s, children: /* @__PURE__ */ a(
|
|
2387
|
+
Ue.Content,
|
|
2385
2388
|
{
|
|
2386
|
-
className:
|
|
2389
|
+
className: tt.dropdown,
|
|
2387
2390
|
side: "top",
|
|
2388
2391
|
align: "start",
|
|
2389
2392
|
sideOffset: 4,
|
|
2390
2393
|
collisionBoundary: g,
|
|
2391
2394
|
"aria-label": t.label,
|
|
2392
2395
|
style: u ? { width: u } : void 0,
|
|
2393
|
-
children: (
|
|
2396
|
+
children: ($ = t.options) == null ? void 0 : $.map((f) => /* @__PURE__ */ a(
|
|
2394
2397
|
"button",
|
|
2395
2398
|
{
|
|
2396
2399
|
type: "button",
|
|
2397
2400
|
"data-slot": "suggestion-option",
|
|
2398
|
-
className:
|
|
2399
|
-
onClick: () => N(
|
|
2400
|
-
children:
|
|
2401
|
+
className: tt.option,
|
|
2402
|
+
onClick: () => N(f),
|
|
2403
|
+
children: f.label
|
|
2401
2404
|
},
|
|
2402
|
-
|
|
2405
|
+
f.id
|
|
2403
2406
|
))
|
|
2404
2407
|
}
|
|
2405
2408
|
) })
|
|
@@ -2415,20 +2418,20 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2415
2418
|
onDropdownOpenChange: s,
|
|
2416
2419
|
translateY: l = "-100%"
|
|
2417
2420
|
}) => {
|
|
2418
|
-
const { variant: g } =
|
|
2421
|
+
const { variant: g } = Ne(), d = ot(
|
|
2419
2422
|
() => g === "floating" ? e == null ? void 0 : e.slice(0, 3) : e,
|
|
2420
2423
|
[e, g]
|
|
2421
|
-
), u = async (h,
|
|
2424
|
+
), u = async (h, A) => {
|
|
2422
2425
|
let x = !0;
|
|
2423
|
-
h.action && (x = await h.action()), x && i && h.prompt && i(h,
|
|
2426
|
+
h.action && (x = await h.action()), x && i && h.prompt && i(h, A);
|
|
2424
2427
|
};
|
|
2425
|
-
return !d || d.length === 0 ? null : /* @__PURE__ */ a(
|
|
2428
|
+
return !d || d.length === 0 ? null : /* @__PURE__ */ a(ct, { children: o && /* @__PURE__ */ a(
|
|
2426
2429
|
se.div,
|
|
2427
2430
|
{
|
|
2428
2431
|
"data-slot": "suggestions",
|
|
2429
|
-
className:
|
|
2430
|
-
|
|
2431
|
-
n === "vertical" ?
|
|
2432
|
+
className: de(
|
|
2433
|
+
Le.container,
|
|
2434
|
+
n === "vertical" ? Le.vertical : n === "floating" ? Le.floating : "",
|
|
2432
2435
|
t
|
|
2433
2436
|
),
|
|
2434
2437
|
initial: { opacity: 0, y: "-80%" },
|
|
@@ -2438,69 +2441,96 @@ const Xi = "SuggestionDropdown-module_container", Qi = "SuggestionDropdown-modul
|
|
|
2438
2441
|
onMouseEnter: c,
|
|
2439
2442
|
onMouseLeave: r,
|
|
2440
2443
|
children: d.map(
|
|
2441
|
-
(h,
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2444
|
+
(h, A) => {
|
|
2445
|
+
const x = !!h.description && n !== "horizontal";
|
|
2446
|
+
return /* @__PURE__ */ a(
|
|
2447
|
+
se.div,
|
|
2448
|
+
{
|
|
2449
|
+
initial: { opacity: 0, y: 10 },
|
|
2450
|
+
animate: { opacity: 1, y: 0 },
|
|
2451
|
+
exit: { opacity: 0, y: 10 },
|
|
2452
|
+
transition: {
|
|
2453
|
+
...ft,
|
|
2454
|
+
delay: A * 0.05
|
|
2455
|
+
},
|
|
2456
|
+
children: h.options && h.options.length > 0 ? /* @__PURE__ */ a(
|
|
2457
|
+
dr,
|
|
2458
|
+
{
|
|
2459
|
+
suggestion: h,
|
|
2460
|
+
onSelect: u,
|
|
2461
|
+
availableSuggestions: d,
|
|
2462
|
+
onOpenChange: s
|
|
2463
|
+
}
|
|
2464
|
+
) : /* @__PURE__ */ a(
|
|
2465
|
+
we,
|
|
2466
|
+
{
|
|
2467
|
+
onClick: (N) => {
|
|
2468
|
+
N.stopPropagation(), u(
|
|
2469
|
+
h,
|
|
2470
|
+
d
|
|
2471
|
+
);
|
|
2472
|
+
},
|
|
2473
|
+
variant: "outline",
|
|
2474
|
+
className: Le.button,
|
|
2475
|
+
children: /* @__PURE__ */ C(
|
|
2476
|
+
"div",
|
|
2477
|
+
{
|
|
2478
|
+
className: de(
|
|
2479
|
+
Le["suggestion-content"],
|
|
2480
|
+
x ? Le["suggestion-content--with-description"] : ""
|
|
2481
|
+
),
|
|
2482
|
+
children: [
|
|
2483
|
+
/* @__PURE__ */ a(
|
|
2484
|
+
"span",
|
|
2485
|
+
{
|
|
2486
|
+
className: Le.label,
|
|
2487
|
+
children: h.label
|
|
2488
|
+
}
|
|
2489
|
+
),
|
|
2490
|
+
x && /* @__PURE__ */ a(
|
|
2491
|
+
"span",
|
|
2492
|
+
{
|
|
2493
|
+
className: Le.description,
|
|
2494
|
+
children: h.description
|
|
2495
|
+
}
|
|
2496
|
+
)
|
|
2497
|
+
]
|
|
2498
|
+
}
|
|
2499
|
+
)
|
|
2500
|
+
}
|
|
2501
|
+
)
|
|
2450
2502
|
},
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
suggestion: h,
|
|
2455
|
-
onSelect: u,
|
|
2456
|
-
availableSuggestions: d,
|
|
2457
|
-
onOpenChange: s
|
|
2458
|
-
}
|
|
2459
|
-
) : /* @__PURE__ */ a(
|
|
2460
|
-
we,
|
|
2461
|
-
{
|
|
2462
|
-
onClick: (x) => {
|
|
2463
|
-
x.stopPropagation(), u(
|
|
2464
|
-
h,
|
|
2465
|
-
d
|
|
2466
|
-
);
|
|
2467
|
-
},
|
|
2468
|
-
variant: "outline",
|
|
2469
|
-
className: nt.button,
|
|
2470
|
-
children: h.label
|
|
2471
|
-
}
|
|
2472
|
-
)
|
|
2473
|
-
},
|
|
2474
|
-
h.id
|
|
2475
|
-
)
|
|
2503
|
+
h.id
|
|
2504
|
+
);
|
|
2505
|
+
}
|
|
2476
2506
|
)
|
|
2477
2507
|
}
|
|
2478
2508
|
) });
|
|
2479
2509
|
};
|
|
2480
|
-
function
|
|
2481
|
-
const t =
|
|
2510
|
+
function ur() {
|
|
2511
|
+
const t = O(/* @__PURE__ */ new Map()), e = w((c) => {
|
|
2482
2512
|
const r = t.current.get(c);
|
|
2483
2513
|
r && (clearTimeout(r), t.current.delete(c));
|
|
2484
|
-
}, []), i =
|
|
2514
|
+
}, []), i = w(
|
|
2485
2515
|
(c, r, s) => {
|
|
2486
2516
|
e(c);
|
|
2487
2517
|
const l = setTimeout(r, s);
|
|
2488
2518
|
return t.current.set(c, l), l;
|
|
2489
2519
|
},
|
|
2490
2520
|
[e]
|
|
2491
|
-
), n =
|
|
2521
|
+
), n = w(() => {
|
|
2492
2522
|
t.current.forEach((c) => {
|
|
2493
2523
|
clearTimeout(c);
|
|
2494
2524
|
}), t.current.clear();
|
|
2495
|
-
}, []), o =
|
|
2496
|
-
return
|
|
2525
|
+
}, []), o = w((c) => t.current.has(c), []);
|
|
2526
|
+
return L(() => n, [n]), {
|
|
2497
2527
|
setNamedTimeout: i,
|
|
2498
2528
|
clearNamedTimeout: e,
|
|
2499
2529
|
clearAllTimeouts: n,
|
|
2500
2530
|
hasTimeout: o
|
|
2501
2531
|
};
|
|
2502
2532
|
}
|
|
2503
|
-
const
|
|
2533
|
+
const gr = 4e3;
|
|
2504
2534
|
function nn({
|
|
2505
2535
|
value: t,
|
|
2506
2536
|
onChange: e,
|
|
@@ -2515,35 +2545,35 @@ function nn({
|
|
|
2515
2545
|
showExpandButton: d = !0,
|
|
2516
2546
|
focusOnMount: u = !1,
|
|
2517
2547
|
customActions: h,
|
|
2518
|
-
actionOrder:
|
|
2548
|
+
actionOrder: A,
|
|
2519
2549
|
onStop: x,
|
|
2520
2550
|
suggestions: N,
|
|
2521
|
-
clearSuggestions:
|
|
2522
|
-
handleSuggestionSubmit:
|
|
2523
|
-
expandOnClick:
|
|
2551
|
+
clearSuggestions: $,
|
|
2552
|
+
handleSuggestionSubmit: f,
|
|
2553
|
+
expandOnClick: T = !1
|
|
2524
2554
|
}) {
|
|
2525
|
-
const [
|
|
2526
|
-
|
|
2555
|
+
const [M, D] = Y(!1), [_, j] = Y(!1), { setNamedTimeout: K, clearAllTimeouts: H } = ur(), I = w(() => {
|
|
2556
|
+
K(
|
|
2527
2557
|
"hide-suggestions",
|
|
2528
2558
|
() => {
|
|
2529
2559
|
D(!1);
|
|
2530
2560
|
},
|
|
2531
|
-
|
|
2561
|
+
gr
|
|
2532
2562
|
);
|
|
2533
|
-
}, [
|
|
2534
|
-
|
|
2535
|
-
}, [
|
|
2536
|
-
|
|
2537
|
-
}, [
|
|
2538
|
-
(
|
|
2539
|
-
|
|
2563
|
+
}, [K]), V = w(() => {
|
|
2564
|
+
_ || I();
|
|
2565
|
+
}, [_, I]), m = w(() => {
|
|
2566
|
+
H(), D(!0);
|
|
2567
|
+
}, [H]), z = w(
|
|
2568
|
+
(W) => {
|
|
2569
|
+
j(W), W ? m() : I();
|
|
2540
2570
|
},
|
|
2541
|
-
[
|
|
2542
|
-
),
|
|
2543
|
-
|
|
2544
|
-
}, [
|
|
2545
|
-
return
|
|
2546
|
-
if (
|
|
2571
|
+
[I, m]
|
|
2572
|
+
), ie = w(() => {
|
|
2573
|
+
T && g && !t && g();
|
|
2574
|
+
}, [T, g, t]);
|
|
2575
|
+
return L(() => {
|
|
2576
|
+
if (H(), t) {
|
|
2547
2577
|
D(!1);
|
|
2548
2578
|
return;
|
|
2549
2579
|
}
|
|
@@ -2551,18 +2581,18 @@ function nn({
|
|
|
2551
2581
|
D(!1);
|
|
2552
2582
|
return;
|
|
2553
2583
|
}
|
|
2554
|
-
if (
|
|
2584
|
+
if (_) {
|
|
2555
2585
|
D(!0);
|
|
2556
2586
|
return;
|
|
2557
2587
|
}
|
|
2558
|
-
D(!0),
|
|
2588
|
+
D(!0), I();
|
|
2559
2589
|
}, [
|
|
2560
2590
|
t,
|
|
2561
2591
|
N,
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
]), /* @__PURE__ */
|
|
2592
|
+
_,
|
|
2593
|
+
H,
|
|
2594
|
+
I
|
|
2595
|
+
]), /* @__PURE__ */ C(Ke, { children: [
|
|
2566
2596
|
/* @__PURE__ */ a(
|
|
2567
2597
|
Nt,
|
|
2568
2598
|
{
|
|
@@ -2575,36 +2605,36 @@ function nn({
|
|
|
2575
2605
|
isProcessing: r,
|
|
2576
2606
|
onBlur: s,
|
|
2577
2607
|
onFocus: l,
|
|
2578
|
-
onClick:
|
|
2608
|
+
onClick: ie,
|
|
2579
2609
|
onExpand: g,
|
|
2580
2610
|
showExpandButton: d,
|
|
2581
2611
|
focusOnMount: u,
|
|
2582
2612
|
customActions: h,
|
|
2583
|
-
actionOrder:
|
|
2613
|
+
actionOrder: A,
|
|
2584
2614
|
onStop: x,
|
|
2585
|
-
expandOnClick:
|
|
2586
|
-
onMouseEnter:
|
|
2587
|
-
onMouseLeave: () =>
|
|
2615
|
+
expandOnClick: T,
|
|
2616
|
+
onMouseEnter: m,
|
|
2617
|
+
onMouseLeave: () => V()
|
|
2588
2618
|
}
|
|
2589
2619
|
),
|
|
2590
2620
|
!t && /* @__PURE__ */ a(
|
|
2591
2621
|
vt,
|
|
2592
2622
|
{
|
|
2593
2623
|
suggestions: N,
|
|
2594
|
-
onSubmit:
|
|
2624
|
+
onSubmit: f,
|
|
2595
2625
|
layout: "floating",
|
|
2596
|
-
visible:
|
|
2597
|
-
onMouseEnter:
|
|
2598
|
-
onMouseLeave: () =>
|
|
2599
|
-
onDropdownOpenChange:
|
|
2626
|
+
visible: M,
|
|
2627
|
+
onMouseEnter: m,
|
|
2628
|
+
onMouseLeave: () => V(),
|
|
2629
|
+
onDropdownOpenChange: z
|
|
2600
2630
|
}
|
|
2601
2631
|
)
|
|
2602
2632
|
] });
|
|
2603
2633
|
}
|
|
2604
|
-
const
|
|
2605
|
-
button:
|
|
2606
|
-
chevron:
|
|
2607
|
-
title:
|
|
2634
|
+
const mr = "MinimizedView-module_button", pr = "MinimizedView-module_chevron", hr = "MinimizedView-module_title", _t = {
|
|
2635
|
+
button: mr,
|
|
2636
|
+
chevron: pr,
|
|
2637
|
+
title: hr
|
|
2608
2638
|
};
|
|
2609
2639
|
function rn({
|
|
2610
2640
|
icon: t = /* @__PURE__ */ a(Lt, { size: 26 }),
|
|
@@ -2612,8 +2642,8 @@ function rn({
|
|
|
2612
2642
|
onClick: i,
|
|
2613
2643
|
focusOnMount: n = !1
|
|
2614
2644
|
}) {
|
|
2615
|
-
const o =
|
|
2616
|
-
return
|
|
2645
|
+
const o = O(null), c = O(n);
|
|
2646
|
+
return L(() => {
|
|
2617
2647
|
c.current && o.current && o.current.focus(), c.current = !1;
|
|
2618
2648
|
}, [c, o]), /* @__PURE__ */ a(
|
|
2619
2649
|
se.div,
|
|
@@ -2629,7 +2659,7 @@ function rn({
|
|
|
2629
2659
|
opacity: 1,
|
|
2630
2660
|
scale: 1,
|
|
2631
2661
|
transition: {
|
|
2632
|
-
...
|
|
2662
|
+
...He,
|
|
2633
2663
|
delay: 0.2
|
|
2634
2664
|
}
|
|
2635
2665
|
},
|
|
@@ -2640,7 +2670,7 @@ function rn({
|
|
|
2640
2670
|
duration: 0.15
|
|
2641
2671
|
}
|
|
2642
2672
|
},
|
|
2643
|
-
children: /* @__PURE__ */
|
|
2673
|
+
children: /* @__PURE__ */ C(
|
|
2644
2674
|
we,
|
|
2645
2675
|
{
|
|
2646
2676
|
ref: o,
|
|
@@ -2658,14 +2688,14 @@ function rn({
|
|
|
2658
2688
|
}
|
|
2659
2689
|
);
|
|
2660
2690
|
}
|
|
2661
|
-
const
|
|
2662
|
-
container:
|
|
2663
|
-
embedded:
|
|
2664
|
-
floating:
|
|
2665
|
-
content:
|
|
2666
|
-
expanded:
|
|
2691
|
+
const fr = "Chat-module_container", vr = "Chat-module_embedded", yr = "Chat-module_floating", br = "Chat-module_content", wr = "Chat-module_expanded", be = {
|
|
2692
|
+
container: fr,
|
|
2693
|
+
embedded: vr,
|
|
2694
|
+
floating: yr,
|
|
2695
|
+
content: br,
|
|
2696
|
+
expanded: wr
|
|
2667
2697
|
};
|
|
2668
|
-
function
|
|
2698
|
+
function Cr() {
|
|
2669
2699
|
return /* @__PURE__ */ a(
|
|
2670
2700
|
"div",
|
|
2671
2701
|
{
|
|
@@ -2700,253 +2730,253 @@ function on({
|
|
|
2700
2730
|
onOpen: d,
|
|
2701
2731
|
onExpand: u,
|
|
2702
2732
|
onClose: h,
|
|
2703
|
-
onStop:
|
|
2733
|
+
onStop: A,
|
|
2704
2734
|
emptyView: x,
|
|
2705
2735
|
floatingChatState: N,
|
|
2706
|
-
suggestions:
|
|
2707
|
-
clearSuggestions:
|
|
2708
|
-
onSuggestionClick:
|
|
2709
|
-
messageRenderer:
|
|
2736
|
+
suggestions: $,
|
|
2737
|
+
clearSuggestions: f,
|
|
2738
|
+
onSuggestionClick: T,
|
|
2739
|
+
messageRenderer: M,
|
|
2710
2740
|
messagesPosition: D,
|
|
2711
|
-
showAgentIcon:
|
|
2712
|
-
className:
|
|
2713
|
-
inputValue:
|
|
2714
|
-
onInputChange:
|
|
2715
|
-
draggableStates:
|
|
2741
|
+
showAgentIcon: _,
|
|
2742
|
+
className: j,
|
|
2743
|
+
inputValue: K,
|
|
2744
|
+
onInputChange: H,
|
|
2745
|
+
draggableStates: I = ["expanded"],
|
|
2716
2746
|
// Default to only expanded for backward compatibility
|
|
2717
|
-
locale:
|
|
2718
|
-
maxInputLength:
|
|
2747
|
+
locale: V = "en",
|
|
2748
|
+
maxInputLength: m = 600,
|
|
2719
2749
|
// Default to 600 characters
|
|
2720
|
-
onInputLimitExceeded:
|
|
2721
|
-
expandOnClick:
|
|
2722
|
-
expandOnHover:
|
|
2723
|
-
thinkingMessage:
|
|
2724
|
-
initialChatPosition:
|
|
2725
|
-
onChatPositionChange:
|
|
2726
|
-
onTypingStatusChange:
|
|
2727
|
-
freeDrag:
|
|
2728
|
-
initialFreeDragPosition:
|
|
2729
|
-
onFreeDragEnd:
|
|
2750
|
+
onInputLimitExceeded: z,
|
|
2751
|
+
expandOnClick: ie,
|
|
2752
|
+
expandOnHover: W = !0,
|
|
2753
|
+
thinkingMessage: Se,
|
|
2754
|
+
initialChatPosition: ge,
|
|
2755
|
+
onChatPositionChange: J,
|
|
2756
|
+
onTypingStatusChange: Ce,
|
|
2757
|
+
freeDrag: v = !1,
|
|
2758
|
+
initialFreeDragPosition: _e,
|
|
2759
|
+
onFreeDragEnd: ke
|
|
2730
2760
|
}) {
|
|
2731
|
-
const
|
|
2732
|
-
|
|
2733
|
-
_i(
|
|
2761
|
+
const me = K !== void 0, [Ve, xe] = Y(""), pe = me ? K : Ve, he = me ? H : xe, y = Za(N), De = O(!1), te = O(!1), X = O(!1), [Ee, Re] = Y(!1), [p, R] = Y(!1), [q, U] = Y(!1), ae = Ti(), [ue, Me] = Y(!1);
|
|
2762
|
+
L(() => {
|
|
2763
|
+
_i(V, {
|
|
2734
2764
|
domain: "a8c-agenttic"
|
|
2735
2765
|
}) || console.warn(
|
|
2736
|
-
`Translations could not be loaded for locale: ${
|
|
2766
|
+
`Translations could not be loaded for locale: ${V}, defaulting to English`
|
|
2737
2767
|
);
|
|
2738
|
-
}, [
|
|
2739
|
-
const
|
|
2740
|
-
|
|
2768
|
+
}, [V]), L(() => {
|
|
2769
|
+
const k = pe.length > 0, P = q && ae && k;
|
|
2770
|
+
P !== ue && (Me(P), Ce == null || Ce(P));
|
|
2741
2771
|
}, [
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2772
|
+
q,
|
|
2773
|
+
ae,
|
|
2774
|
+
pe.length,
|
|
2775
|
+
ue,
|
|
2776
|
+
Ce
|
|
2747
2777
|
]);
|
|
2748
|
-
const
|
|
2778
|
+
const fe = w(() => {
|
|
2749
2779
|
U(!0);
|
|
2750
|
-
}, []),
|
|
2780
|
+
}, []), We = w(() => {
|
|
2751
2781
|
U(!1);
|
|
2752
|
-
}, []),
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
}, [
|
|
2756
|
-
|
|
2757
|
-
}, [
|
|
2758
|
-
const
|
|
2759
|
-
|
|
2760
|
-
clearTimeout(
|
|
2761
|
-
}),
|
|
2762
|
-
}, []),
|
|
2763
|
-
value:
|
|
2764
|
-
setValue:
|
|
2765
|
-
onSubmit: async (
|
|
2766
|
-
|
|
2782
|
+
}, []), Te = pe.length > m;
|
|
2783
|
+
L(() => {
|
|
2784
|
+
Te && (z == null || z());
|
|
2785
|
+
}, [Te, z]), L(() => {
|
|
2786
|
+
De.current = !1, te.current = !1, X.current = !1;
|
|
2787
|
+
}, [y.state]);
|
|
2788
|
+
const Ie = O(/* @__PURE__ */ new Set()), Pe = w(() => {
|
|
2789
|
+
Ie.current.forEach((k) => {
|
|
2790
|
+
clearTimeout(k);
|
|
2791
|
+
}), Ie.current.clear();
|
|
2792
|
+
}, []), F = Ya({
|
|
2793
|
+
value: pe,
|
|
2794
|
+
setValue: he,
|
|
2795
|
+
onSubmit: async (k) => {
|
|
2796
|
+
y.state !== "expanded" && (u == null || u()), y.setState("expanded"), await o(k);
|
|
2767
2797
|
},
|
|
2768
2798
|
isProcessing: i,
|
|
2769
|
-
isInputOverLimit:
|
|
2770
|
-
floatingChatState:
|
|
2771
|
-
}), [
|
|
2772
|
-
Ja(
|
|
2773
|
-
),
|
|
2774
|
-
freeDrag:
|
|
2775
|
-
initialFreeDragPosition:
|
|
2776
|
-
side:
|
|
2777
|
-
}),
|
|
2778
|
-
async (
|
|
2779
|
-
const
|
|
2780
|
-
if (
|
|
2781
|
-
|
|
2782
|
-
const Q =
|
|
2799
|
+
isInputOverLimit: Te,
|
|
2800
|
+
floatingChatState: y.state
|
|
2801
|
+
}), [Je, yt] = Y(56), [S, G] = Y(
|
|
2802
|
+
Ja(ge)
|
|
2803
|
+
), Z = O(null), oe = O(null), ve = O(null), { x: st, y: Ae } = qa({
|
|
2804
|
+
freeDrag: v,
|
|
2805
|
+
initialFreeDragPosition: _e,
|
|
2806
|
+
side: S
|
|
2807
|
+
}), ce = pt(st), le = pt(Ae), qe = qt(), bt = w(
|
|
2808
|
+
async (k, P) => {
|
|
2809
|
+
const B = k.prompt ?? k.label;
|
|
2810
|
+
if (k.autoSubmit) {
|
|
2811
|
+
f == null || f();
|
|
2812
|
+
const Q = B.trim();
|
|
2783
2813
|
Q && await o(Q);
|
|
2784
2814
|
} else {
|
|
2785
|
-
const Q =
|
|
2786
|
-
|
|
2815
|
+
const Q = B.endsWith(" ") ? B : `${B} `;
|
|
2816
|
+
F.setValue(Q), f == null || f(), F.textareaRef.current && (F.textareaRef.current.focus(), F.textareaRef.current.setSelectionRange(
|
|
2787
2817
|
Q.length,
|
|
2788
2818
|
Q.length
|
|
2789
2819
|
));
|
|
2790
2820
|
}
|
|
2791
|
-
|
|
2821
|
+
T == null || T(k, P);
|
|
2792
2822
|
},
|
|
2793
|
-
[
|
|
2794
|
-
), wt =
|
|
2795
|
-
|
|
2796
|
-
}, [
|
|
2797
|
-
var
|
|
2798
|
-
const
|
|
2799
|
-
return !(
|
|
2800
|
-
}, [
|
|
2801
|
-
(
|
|
2802
|
-
[
|
|
2803
|
-
), bn =
|
|
2804
|
-
if (
|
|
2805
|
-
const
|
|
2806
|
-
|
|
2807
|
-
},
|
|
2808
|
-
|
|
2823
|
+
[f, o, T, F]
|
|
2824
|
+
), wt = w(() => {
|
|
2825
|
+
De.current = !0, y.open(), d == null || d(), u == null || u();
|
|
2826
|
+
}, [y, d, u]), Xe = w(() => {
|
|
2827
|
+
var P, B, Q;
|
|
2828
|
+
const k = (B = (P = ve.current) == null ? void 0 : P.ownerDocument) == null ? void 0 : B.activeElement;
|
|
2829
|
+
return !(k && ((Q = ve.current) != null && Q.contains(k)) || pe.trim());
|
|
2830
|
+
}, [pe, ve]), Ct = w(
|
|
2831
|
+
(k) => k === "collapsed" || k === "minimized" ? b.COLLAPSED_SIZE : k === "compact" ? Je : b.EXPANDED_HEIGHT,
|
|
2832
|
+
[Je]
|
|
2833
|
+
), bn = w(() => {
|
|
2834
|
+
if (W && y.state === "collapsed" && (y.setState("compact"), y.initialState === "collapsed")) {
|
|
2835
|
+
const k = setTimeout(() => {
|
|
2836
|
+
y.state === "compact" && Xe() && y.setState("collapsed"), Ie.current.delete(k);
|
|
2837
|
+
}, b.AUTO_COLLAPSE_DELAY);
|
|
2838
|
+
Ie.current.add(k);
|
|
2809
2839
|
}
|
|
2810
|
-
}, [
|
|
2811
|
-
if (
|
|
2812
|
-
const
|
|
2813
|
-
|
|
2814
|
-
},
|
|
2815
|
-
|
|
2840
|
+
}, [y, Xe, W]), Dt = w(() => {
|
|
2841
|
+
if (y.initialState === "collapsed" && y.state === "compact" && Xe()) {
|
|
2842
|
+
const k = setTimeout(() => {
|
|
2843
|
+
y.state === "compact" && Xe() && y.setState("collapsed"), Ie.current.delete(k);
|
|
2844
|
+
}, b.AUTO_COLLAPSE_DELAY);
|
|
2845
|
+
Ie.current.add(k);
|
|
2816
2846
|
}
|
|
2817
|
-
}, [
|
|
2818
|
-
const
|
|
2819
|
-
|
|
2820
|
-
}, [
|
|
2821
|
-
|
|
2822
|
-
}, [u,
|
|
2823
|
-
|
|
2824
|
-
}, [
|
|
2825
|
-
(
|
|
2826
|
-
if (!
|
|
2847
|
+
}, [y, Xe]), Et = w(async () => {
|
|
2848
|
+
const k = F.value.trim();
|
|
2849
|
+
F.clear(), y.state !== "expanded" && (u == null || u()), y.setState("expanded"), await o(k);
|
|
2850
|
+
}, [F, o, y, u]), Rt = w(() => {
|
|
2851
|
+
X.current = !0, u == null || u(), y.setState("expanded");
|
|
2852
|
+
}, [u, y]), wn = w(() => {
|
|
2853
|
+
te.current = !0, F.clear(), y.close(), h && h();
|
|
2854
|
+
}, [F, y, h]), ze = w(
|
|
2855
|
+
(k) => {
|
|
2856
|
+
if (!ve.current || !oe.current)
|
|
2827
2857
|
return null;
|
|
2828
|
-
const
|
|
2858
|
+
const P = ve.current.getBoundingClientRect(), B = oe.current.getBoundingClientRect(), Q = window.getComputedStyle(ve.current), dt = new DOMMatrixReadOnly(Q.transform), Ut = P.x - dt.e, $e = P.y - dt.f, Qe = k ?? S, Bt = Ct(y.state), Mn = Qe === "left" ? B.left : B.right - b.COMPACT_WIDTH, An = y.state === "minimized" ? window.innerHeight - Bt : B.bottom - Bt;
|
|
2829
2859
|
return {
|
|
2830
2860
|
x: Mn - Ut,
|
|
2831
|
-
y: An -
|
|
2861
|
+
y: An - $e
|
|
2832
2862
|
};
|
|
2833
2863
|
},
|
|
2834
|
-
[
|
|
2835
|
-
), Cn =
|
|
2836
|
-
(
|
|
2837
|
-
const
|
|
2838
|
-
if (
|
|
2864
|
+
[S, y.state, Ct]
|
|
2865
|
+
), Cn = w(
|
|
2866
|
+
(k) => {
|
|
2867
|
+
const P = k.target;
|
|
2868
|
+
if (P.ownerDocument !== document)
|
|
2839
2869
|
return;
|
|
2840
|
-
|
|
2870
|
+
P.closest(
|
|
2841
2871
|
re.NON_DRAGGABLE_SELECTORS
|
|
2842
|
-
) || (
|
|
2872
|
+
) || (k.preventDefault(), qe.start(k.nativeEvent));
|
|
2843
2873
|
},
|
|
2844
|
-
[
|
|
2845
|
-
), _n =
|
|
2874
|
+
[qe]
|
|
2875
|
+
), _n = w(() => {
|
|
2846
2876
|
R(!0);
|
|
2847
|
-
}, []), Tn =
|
|
2848
|
-
(
|
|
2849
|
-
|
|
2850
|
-
|
|
2877
|
+
}, []), Tn = w(
|
|
2878
|
+
(k, P) => {
|
|
2879
|
+
R(!1);
|
|
2880
|
+
const B = ce.get(), Q = b.COMPACT_WIDTH, dt = (window.innerWidth - Q) / 2, $e = B < dt ? "left" : "right";
|
|
2881
|
+
if (S !== $e && (G($e), ht($e), J == null || J($e)), v) {
|
|
2882
|
+
ke == null || ke({ x: ce.get(), y: le.get() });
|
|
2851
2883
|
return;
|
|
2852
2884
|
}
|
|
2853
|
-
const
|
|
2854
|
-
|
|
2855
|
-
const Xe = ze(Pe);
|
|
2856
|
-
Xe && (ye(he, Xe.x, {
|
|
2885
|
+
const Qe = ze($e);
|
|
2886
|
+
Qe && (ye(ce, Qe.x, {
|
|
2857
2887
|
...re.SPRING_CONFIG,
|
|
2858
|
-
velocity:
|
|
2859
|
-
}), ye(
|
|
2888
|
+
velocity: P.velocity.x * re.VELOCITY_MULTIPLIER
|
|
2889
|
+
}), ye(le, Qe.y, {
|
|
2860
2890
|
...re.SPRING_CONFIG,
|
|
2861
|
-
velocity:
|
|
2891
|
+
velocity: P.velocity.y * re.VELOCITY_MULTIPLIER
|
|
2862
2892
|
}));
|
|
2863
2893
|
},
|
|
2864
2894
|
[
|
|
2865
|
-
|
|
2866
|
-
|
|
2895
|
+
ce,
|
|
2896
|
+
le,
|
|
2867
2897
|
ze,
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2898
|
+
J,
|
|
2899
|
+
S,
|
|
2900
|
+
v,
|
|
2901
|
+
ke
|
|
2872
2902
|
]
|
|
2873
|
-
), Pt =
|
|
2874
|
-
|
|
2875
|
-
const
|
|
2876
|
-
if (Pt.current =
|
|
2903
|
+
), Pt = O(v);
|
|
2904
|
+
L(() => {
|
|
2905
|
+
const k = Pt.current;
|
|
2906
|
+
if (Pt.current = v, v || !k)
|
|
2877
2907
|
return;
|
|
2878
|
-
const
|
|
2879
|
-
|
|
2880
|
-
const Q = ze(
|
|
2881
|
-
Q && (ye(
|
|
2908
|
+
const B = b.VIEWPORT_OFFSET + ce.get() + b.COMPACT_WIDTH / 2 < window.innerWidth / 2 ? "left" : "right";
|
|
2909
|
+
S !== B && (G(B), ht(B), J == null || J(B));
|
|
2910
|
+
const Q = ze(B);
|
|
2911
|
+
Q && (ye(ce, Q.x, re.SPRING_CONFIG), ye(le, Q.y, re.SPRING_CONFIG));
|
|
2882
2912
|
}, [
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2913
|
+
v,
|
|
2914
|
+
ce,
|
|
2915
|
+
le,
|
|
2886
2916
|
ze,
|
|
2887
|
-
|
|
2888
|
-
|
|
2917
|
+
J,
|
|
2918
|
+
S
|
|
2889
2919
|
]);
|
|
2890
|
-
const
|
|
2891
|
-
|
|
2892
|
-
const
|
|
2893
|
-
if ($t.current =
|
|
2920
|
+
const lt = O(null), $t = O(y.state === "minimized");
|
|
2921
|
+
L(() => {
|
|
2922
|
+
const k = $t.current, P = y.state === "minimized";
|
|
2923
|
+
if ($t.current = P, !v || P === k)
|
|
2894
2924
|
return;
|
|
2895
|
-
if (
|
|
2896
|
-
|
|
2897
|
-
const Q = ye(
|
|
2925
|
+
if (P) {
|
|
2926
|
+
lt.current = le.get();
|
|
2927
|
+
const Q = ye(le, 0, re.SPRING_CONFIG);
|
|
2898
2928
|
return () => Q.stop();
|
|
2899
2929
|
}
|
|
2900
|
-
if (
|
|
2930
|
+
if (lt.current === null)
|
|
2901
2931
|
return;
|
|
2902
|
-
const
|
|
2903
|
-
|
|
2904
|
-
|
|
2932
|
+
const B = ye(
|
|
2933
|
+
le,
|
|
2934
|
+
lt.current,
|
|
2905
2935
|
re.SPRING_CONFIG
|
|
2906
2936
|
);
|
|
2907
|
-
return
|
|
2908
|
-
}, [
|
|
2909
|
-
const Ft =
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
}, [
|
|
2913
|
-
const
|
|
2914
|
-
if (
|
|
2915
|
-
const
|
|
2916
|
-
{ x:
|
|
2917
|
-
|
|
2918
|
-
|
|
2937
|
+
return lt.current = null, () => B.stop();
|
|
2938
|
+
}, [y.state, v, le]);
|
|
2939
|
+
const Ft = O(y.state), In = Ft.current === "compact" && y.state === "expanded";
|
|
2940
|
+
L(() => {
|
|
2941
|
+
Pe(), Ft.current = y.state;
|
|
2942
|
+
}, [y.state, Pe]), L(() => {
|
|
2943
|
+
const k = () => {
|
|
2944
|
+
if (v) {
|
|
2945
|
+
const B = Ot(
|
|
2946
|
+
{ x: ce.get(), y: le.get() },
|
|
2947
|
+
b.COMPACT_WIDTH,
|
|
2948
|
+
b.EXPANDED_HEIGHT
|
|
2919
2949
|
);
|
|
2920
|
-
|
|
2950
|
+
ce.set(B.x), le.set(B.y);
|
|
2921
2951
|
return;
|
|
2922
2952
|
}
|
|
2923
|
-
const
|
|
2924
|
-
|
|
2953
|
+
const P = ze();
|
|
2954
|
+
P && (ce.set(P.x), y.state !== "minimized" && le.set(P.y));
|
|
2925
2955
|
};
|
|
2926
|
-
return window.addEventListener("resize",
|
|
2927
|
-
}, [
|
|
2928
|
-
const
|
|
2956
|
+
return window.addEventListener("resize", k), () => window.removeEventListener("resize", k);
|
|
2957
|
+
}, [y.state, ce, le, ze, v]), L(() => {
|
|
2958
|
+
const k = Ie.current;
|
|
2929
2959
|
return () => {
|
|
2930
|
-
|
|
2931
|
-
clearTimeout(
|
|
2932
|
-
}),
|
|
2960
|
+
k.forEach((P) => {
|
|
2961
|
+
clearTimeout(P);
|
|
2962
|
+
}), k.clear();
|
|
2933
2963
|
};
|
|
2934
|
-
}, []),
|
|
2935
|
-
if (
|
|
2936
|
-
const
|
|
2937
|
-
|
|
2964
|
+
}, []), L(() => {
|
|
2965
|
+
if (y.state === "compact" && Z.current) {
|
|
2966
|
+
const k = Z.current.scrollHeight + b.PADDING;
|
|
2967
|
+
yt(k);
|
|
2938
2968
|
}
|
|
2939
|
-
}, [
|
|
2940
|
-
const Sn = x && ["floating", "embedded"].includes(c) && e.length === 0 &&
|
|
2969
|
+
}, [y.state, F.value]);
|
|
2970
|
+
const Sn = x && ["floating", "embedded"].includes(c) && e.length === 0 && ne.isValidElement(x) ? ne.cloneElement(x, {
|
|
2941
2971
|
onSuggestionClick: bt
|
|
2942
|
-
}) : void 0, kn =
|
|
2943
|
-
message:
|
|
2972
|
+
}) : void 0, kn = Te ? {
|
|
2973
|
+
message: je(
|
|
2944
2974
|
/* translators: %d: maximum number of characters allowed */
|
|
2945
2975
|
E(
|
|
2946
2976
|
"Message is too long. Please keep it under %d characters.",
|
|
2947
2977
|
"a8c-agenttic"
|
|
2948
2978
|
),
|
|
2949
|
-
|
|
2979
|
+
m
|
|
2950
2980
|
),
|
|
2951
2981
|
dismissible: !1,
|
|
2952
2982
|
status: "error"
|
|
@@ -2956,103 +2986,103 @@ function on({
|
|
|
2956
2986
|
isProcessing: i,
|
|
2957
2987
|
error: n,
|
|
2958
2988
|
// Input state
|
|
2959
|
-
inputValue:
|
|
2960
|
-
setInputValue:
|
|
2961
|
-
clearInput:
|
|
2962
|
-
textareaRef:
|
|
2963
|
-
handleKeyDown:
|
|
2989
|
+
inputValue: F.value,
|
|
2990
|
+
setInputValue: F.setValue,
|
|
2991
|
+
clearInput: F.clear,
|
|
2992
|
+
textareaRef: F.textareaRef,
|
|
2993
|
+
handleKeyDown: F.handleKeyDown,
|
|
2964
2994
|
// Actions
|
|
2965
2995
|
onSubmit: o,
|
|
2966
2996
|
handleSubmit: Et,
|
|
2967
|
-
onStop:
|
|
2997
|
+
onStop: A,
|
|
2968
2998
|
// UI state
|
|
2969
2999
|
variant: c,
|
|
2970
3000
|
placeholder: l,
|
|
2971
3001
|
emptyView: Sn,
|
|
2972
|
-
messageRenderer:
|
|
3002
|
+
messageRenderer: M,
|
|
2973
3003
|
messagesPosition: D,
|
|
2974
|
-
showAgentIcon:
|
|
3004
|
+
showAgentIcon: _,
|
|
2975
3005
|
// Floating chat specific
|
|
2976
|
-
floatingChatState:
|
|
3006
|
+
floatingChatState: y.state,
|
|
2977
3007
|
triggerIcon: r,
|
|
2978
3008
|
onOpen: wt,
|
|
2979
3009
|
onExpand: Rt,
|
|
2980
3010
|
onClose: wn,
|
|
2981
3011
|
// Suggestions
|
|
2982
|
-
suggestions:
|
|
2983
|
-
clearSuggestions:
|
|
3012
|
+
suggestions: $,
|
|
3013
|
+
clearSuggestions: f,
|
|
2984
3014
|
handleSuggestionSubmit: bt,
|
|
2985
3015
|
// Notice
|
|
2986
3016
|
notice: kn,
|
|
2987
3017
|
// Thinking message
|
|
2988
|
-
thinkingMessage:
|
|
3018
|
+
thinkingMessage: Se,
|
|
2989
3019
|
// Internal state for components
|
|
2990
|
-
focusOnMount:
|
|
3020
|
+
focusOnMount: X.current,
|
|
2991
3021
|
fromCompact: In,
|
|
2992
|
-
showExpandButton: !
|
|
3022
|
+
showExpandButton: !F.value.trim(),
|
|
2993
3023
|
// Input validation
|
|
2994
|
-
isInputOverLimit:
|
|
3024
|
+
isInputOverLimit: Te,
|
|
2995
3025
|
// Focus handlers for typing status
|
|
2996
|
-
onInputFocus:
|
|
2997
|
-
onInputBlur:
|
|
3026
|
+
onInputFocus: fe,
|
|
3027
|
+
onInputBlur: We
|
|
2998
3028
|
};
|
|
2999
3029
|
return c === "embedded" ? /* @__PURE__ */ a(Vt, { value: jt, children: /* @__PURE__ */ a(
|
|
3000
3030
|
"div",
|
|
3001
3031
|
{
|
|
3002
3032
|
"data-slot": "chat-embedded",
|
|
3003
|
-
className:
|
|
3004
|
-
|
|
3033
|
+
className: de(
|
|
3034
|
+
j,
|
|
3005
3035
|
be.container,
|
|
3006
3036
|
be.embedded
|
|
3007
3037
|
),
|
|
3008
3038
|
children: t
|
|
3009
3039
|
}
|
|
3010
|
-
) }) : /* @__PURE__ */
|
|
3040
|
+
) }) : /* @__PURE__ */ C(Vt, { value: jt, children: [
|
|
3011
3041
|
/* @__PURE__ */ a(
|
|
3012
3042
|
"div",
|
|
3013
3043
|
{
|
|
3014
|
-
ref:
|
|
3044
|
+
ref: oe,
|
|
3015
3045
|
style: {
|
|
3016
3046
|
position: "fixed",
|
|
3017
|
-
top:
|
|
3018
|
-
left:
|
|
3019
|
-
right:
|
|
3020
|
-
bottom:
|
|
3047
|
+
top: b.VIEWPORT_OFFSET,
|
|
3048
|
+
left: b.VIEWPORT_OFFSET,
|
|
3049
|
+
right: b.VIEWPORT_OFFSET,
|
|
3050
|
+
bottom: b.VIEWPORT_OFFSET,
|
|
3021
3051
|
pointerEvents: "none"
|
|
3022
3052
|
}
|
|
3023
3053
|
}
|
|
3024
3054
|
),
|
|
3025
|
-
|
|
3055
|
+
p && /* @__PURE__ */ a(Cr, {}),
|
|
3026
3056
|
/* @__PURE__ */ a(
|
|
3027
3057
|
se.div,
|
|
3028
3058
|
{
|
|
3029
|
-
ref:
|
|
3059
|
+
ref: ve,
|
|
3030
3060
|
"data-slot": "chat-floating",
|
|
3031
|
-
className:
|
|
3032
|
-
[be.expanded]:
|
|
3033
|
-
animating:
|
|
3061
|
+
className: de(j, be.container, be.floating, {
|
|
3062
|
+
[be.expanded]: y.state === "expanded",
|
|
3063
|
+
animating: Ee
|
|
3034
3064
|
}),
|
|
3035
|
-
onMouseLeave:
|
|
3036
|
-
drag:
|
|
3037
|
-
dragControls:
|
|
3065
|
+
onMouseLeave: y.state === "compact" ? Dt : void 0,
|
|
3066
|
+
drag: I.includes(y.state),
|
|
3067
|
+
dragControls: qe,
|
|
3038
3068
|
dragListener: !1,
|
|
3039
|
-
dragConstraints:
|
|
3069
|
+
dragConstraints: p ? oe : !1,
|
|
3040
3070
|
dragMomentum: !1,
|
|
3041
|
-
dragElastic:
|
|
3071
|
+
dragElastic: v ? 0 : 0.1,
|
|
3042
3072
|
dragTransition: { power: 0.1, timeConstant: 100 },
|
|
3043
3073
|
onDragStart: _n,
|
|
3044
3074
|
onDragEnd: Tn,
|
|
3045
3075
|
onPointerDown: Cn,
|
|
3046
3076
|
initial: !1,
|
|
3047
3077
|
animate: {
|
|
3048
|
-
bottom:
|
|
3078
|
+
bottom: y.state === "minimized" ? 0 : b.VIEWPORT_OFFSET
|
|
3049
3079
|
},
|
|
3050
|
-
transition:
|
|
3080
|
+
transition: He,
|
|
3051
3081
|
style: {
|
|
3052
|
-
x:
|
|
3053
|
-
y:
|
|
3054
|
-
left:
|
|
3055
|
-
cursor:
|
|
3082
|
+
x: ce,
|
|
3083
|
+
y: le,
|
|
3084
|
+
left: b.VIEWPORT_OFFSET,
|
|
3085
|
+
cursor: I.includes(y.state) ? "grab" : "default"
|
|
3056
3086
|
},
|
|
3057
3087
|
children: /* @__PURE__ */ a(
|
|
3058
3088
|
se.div,
|
|
@@ -3061,64 +3091,64 @@ function on({
|
|
|
3061
3091
|
className: be.content,
|
|
3062
3092
|
initial: !1,
|
|
3063
3093
|
animate: {
|
|
3064
|
-
width:
|
|
3065
|
-
height: Ct(
|
|
3066
|
-
x:
|
|
3067
|
-
borderBottomLeftRadius:
|
|
3068
|
-
borderBottomRightRadius:
|
|
3069
|
-
transition:
|
|
3094
|
+
width: y.state === "collapsed" ? b.COLLAPSED_SIZE : b.COMPACT_WIDTH,
|
|
3095
|
+
height: Ct(y.state),
|
|
3096
|
+
x: y.state === "collapsed" && S === "right" ? b.COMPACT_WIDTH - b.COLLAPSED_SIZE : 0,
|
|
3097
|
+
borderBottomLeftRadius: y.state === "minimized" ? 0 : b.BORDER_RADIUS,
|
|
3098
|
+
borderBottomRightRadius: y.state === "minimized" ? 0 : b.BORDER_RADIUS,
|
|
3099
|
+
transition: F.value.trim() ? { duration: 0 } : He
|
|
3070
3100
|
},
|
|
3071
|
-
onAnimationStart: () =>
|
|
3072
|
-
onAnimationComplete: () =>
|
|
3101
|
+
onAnimationStart: () => Re(!0),
|
|
3102
|
+
onAnimationComplete: () => Re(!1),
|
|
3073
3103
|
style: {
|
|
3074
|
-
borderTopLeftRadius:
|
|
3075
|
-
borderTopRightRadius:
|
|
3104
|
+
borderTopLeftRadius: b.BORDER_RADIUS,
|
|
3105
|
+
borderTopRightRadius: b.BORDER_RADIUS
|
|
3076
3106
|
},
|
|
3077
|
-
children: /* @__PURE__ */
|
|
3078
|
-
|
|
3107
|
+
children: /* @__PURE__ */ C(ct, { mode: "wait", children: [
|
|
3108
|
+
y.state === "collapsed" && /* @__PURE__ */ a(
|
|
3079
3109
|
en,
|
|
3080
3110
|
{
|
|
3081
3111
|
icon: r,
|
|
3082
3112
|
onClick: wt,
|
|
3083
3113
|
onHover: bn,
|
|
3084
|
-
focusOnMount:
|
|
3114
|
+
focusOnMount: te.current
|
|
3085
3115
|
},
|
|
3086
3116
|
"collapsed"
|
|
3087
3117
|
),
|
|
3088
|
-
|
|
3118
|
+
y.state === "minimized" && /* @__PURE__ */ a(
|
|
3089
3119
|
rn,
|
|
3090
3120
|
{
|
|
3091
3121
|
icon: r,
|
|
3092
3122
|
title: s,
|
|
3093
3123
|
onClick: wt,
|
|
3094
|
-
focusOnMount:
|
|
3124
|
+
focusOnMount: te.current
|
|
3095
3125
|
},
|
|
3096
3126
|
"minimized"
|
|
3097
3127
|
),
|
|
3098
|
-
|
|
3128
|
+
y.state === "compact" && /* @__PURE__ */ a("div", { ref: Z, children: /* @__PURE__ */ a(
|
|
3099
3129
|
nn,
|
|
3100
3130
|
{
|
|
3101
|
-
value:
|
|
3102
|
-
onChange:
|
|
3131
|
+
value: F.value,
|
|
3132
|
+
onChange: F.setValue,
|
|
3103
3133
|
onSubmit: Et,
|
|
3104
|
-
onKeyDown:
|
|
3105
|
-
textareaRef:
|
|
3134
|
+
onKeyDown: F.handleKeyDown,
|
|
3135
|
+
textareaRef: F.textareaRef,
|
|
3106
3136
|
placeholder: l,
|
|
3107
3137
|
isProcessing: i,
|
|
3108
3138
|
onBlur: Dt,
|
|
3109
|
-
onFocus:
|
|
3139
|
+
onFocus: fe,
|
|
3110
3140
|
onExpand: Rt,
|
|
3111
|
-
showExpandButton: !
|
|
3112
|
-
focusOnMount:
|
|
3113
|
-
onStop:
|
|
3114
|
-
suggestions:
|
|
3115
|
-
clearSuggestions:
|
|
3141
|
+
showExpandButton: !F.value.trim(),
|
|
3142
|
+
focusOnMount: De.current,
|
|
3143
|
+
onStop: A,
|
|
3144
|
+
suggestions: $,
|
|
3145
|
+
clearSuggestions: f,
|
|
3116
3146
|
handleSuggestionSubmit: bt,
|
|
3117
|
-
expandOnClick:
|
|
3147
|
+
expandOnClick: ie
|
|
3118
3148
|
},
|
|
3119
3149
|
"compact"
|
|
3120
3150
|
) }),
|
|
3121
|
-
|
|
3151
|
+
y.state === "expanded" && t
|
|
3122
3152
|
] })
|
|
3123
3153
|
}
|
|
3124
3154
|
)
|
|
@@ -3146,8 +3176,8 @@ function cn({ className: t, size: e = 24 }) {
|
|
|
3146
3176
|
}
|
|
3147
3177
|
);
|
|
3148
3178
|
}
|
|
3149
|
-
const
|
|
3150
|
-
container:
|
|
3179
|
+
const _r = "ChatHeader-module_container", Tr = {
|
|
3180
|
+
container: _r
|
|
3151
3181
|
};
|
|
3152
3182
|
function sn({ onClose: t, className: e }) {
|
|
3153
3183
|
return /* @__PURE__ */ a(
|
|
@@ -3155,10 +3185,10 @@ function sn({ onClose: t, className: e }) {
|
|
|
3155
3185
|
{
|
|
3156
3186
|
"data-slot": "chat-header",
|
|
3157
3187
|
"data-draggable": "true",
|
|
3158
|
-
className:
|
|
3188
|
+
className: Tr.container,
|
|
3159
3189
|
initial: { opacity: 0 },
|
|
3160
3190
|
animate: { opacity: 1 },
|
|
3161
|
-
transition: { ...
|
|
3191
|
+
transition: { ...Be, delay: 0.1 },
|
|
3162
3192
|
children: t && /* @__PURE__ */ a(
|
|
3163
3193
|
we,
|
|
3164
3194
|
{
|
|
@@ -3172,17 +3202,17 @@ function sn({ onClose: t, className: e }) {
|
|
|
3172
3202
|
);
|
|
3173
3203
|
}
|
|
3174
3204
|
function St({ className: t } = {}) {
|
|
3175
|
-
const { onClose: e } =
|
|
3205
|
+
const { onClose: e } = Ne();
|
|
3176
3206
|
return /* @__PURE__ */ a(sn, { onClose: e, className: t });
|
|
3177
3207
|
}
|
|
3178
|
-
const
|
|
3179
|
-
function
|
|
3208
|
+
const Ir = 0.12, Sr = 1;
|
|
3209
|
+
function kr({
|
|
3180
3210
|
scrollAreaRef: t,
|
|
3181
3211
|
visibleMessages: e
|
|
3182
3212
|
}) {
|
|
3183
|
-
const i =
|
|
3213
|
+
const i = O(0), n = O(!0), o = O(!0), c = O(0), r = O(null), s = w(() => {
|
|
3184
3214
|
cancelAnimationFrame(c.current), c.current = 0, r.current = null;
|
|
3185
|
-
}, []), l =
|
|
3215
|
+
}, []), l = w(() => {
|
|
3186
3216
|
s();
|
|
3187
3217
|
const g = () => {
|
|
3188
3218
|
const d = t.current;
|
|
@@ -3194,21 +3224,21 @@ function Ir({
|
|
|
3194
3224
|
o.current = !1, s();
|
|
3195
3225
|
return;
|
|
3196
3226
|
}
|
|
3197
|
-
const u =
|
|
3227
|
+
const u = Mr(d);
|
|
3198
3228
|
if (u === null || d.scrollTop >= u) {
|
|
3199
3229
|
s();
|
|
3200
3230
|
return;
|
|
3201
3231
|
}
|
|
3202
3232
|
const h = u - d.scrollTop;
|
|
3203
|
-
if (h <=
|
|
3233
|
+
if (h <= Sr) {
|
|
3204
3234
|
d.scrollTop = u, s();
|
|
3205
3235
|
return;
|
|
3206
3236
|
}
|
|
3207
|
-
d.scrollTop += Math.ceil(h *
|
|
3237
|
+
d.scrollTop += Math.ceil(h * Ir), r.current = d.scrollTop, c.current = requestAnimationFrame(g);
|
|
3208
3238
|
};
|
|
3209
3239
|
c.current = requestAnimationFrame(g);
|
|
3210
3240
|
}, [t, s]);
|
|
3211
|
-
|
|
3241
|
+
L(() => {
|
|
3212
3242
|
const g = t.current;
|
|
3213
3243
|
if (!g)
|
|
3214
3244
|
return;
|
|
@@ -3222,7 +3252,7 @@ function Ir({
|
|
|
3222
3252
|
}), () => {
|
|
3223
3253
|
g.removeEventListener("wheel", d), g.removeEventListener("touchmove", d);
|
|
3224
3254
|
};
|
|
3225
|
-
}, [t, s]),
|
|
3255
|
+
}, [t, s]), L(() => s, [s]), L(() => {
|
|
3226
3256
|
const g = t.current;
|
|
3227
3257
|
if (!g || e.length === 0) {
|
|
3228
3258
|
i.current = e.length;
|
|
@@ -3248,12 +3278,12 @@ function Ir({
|
|
|
3248
3278
|
s
|
|
3249
3279
|
]);
|
|
3250
3280
|
}
|
|
3251
|
-
function
|
|
3281
|
+
function Mr(t) {
|
|
3252
3282
|
const e = t.querySelectorAll('[data-role="user"]'), i = e[e.length - 1];
|
|
3253
3283
|
return (i == null ? void 0 : i.offsetTop) ?? null;
|
|
3254
3284
|
}
|
|
3255
|
-
function
|
|
3256
|
-
return /* @__PURE__ */
|
|
3285
|
+
function Ar({ className: t, size: e = 28 }) {
|
|
3286
|
+
return /* @__PURE__ */ C(
|
|
3257
3287
|
"svg",
|
|
3258
3288
|
{
|
|
3259
3289
|
className: t,
|
|
@@ -3288,8 +3318,8 @@ function kr({ className: t, size: e = 28 }) {
|
|
|
3288
3318
|
}
|
|
3289
3319
|
);
|
|
3290
3320
|
}
|
|
3291
|
-
const
|
|
3292
|
-
container:
|
|
3321
|
+
const Or = "MessageActions-module_container", Wt = {
|
|
3322
|
+
container: Or
|
|
3293
3323
|
};
|
|
3294
3324
|
function zt({
|
|
3295
3325
|
message: t,
|
|
@@ -3338,15 +3368,15 @@ function zt({
|
|
|
3338
3368
|
}
|
|
3339
3369
|
);
|
|
3340
3370
|
}
|
|
3341
|
-
const
|
|
3342
|
-
message:
|
|
3343
|
-
user:
|
|
3344
|
-
bubble:
|
|
3345
|
-
error:
|
|
3346
|
-
icon:
|
|
3347
|
-
content:
|
|
3348
|
-
disabled:
|
|
3349
|
-
},
|
|
3371
|
+
const Lr = "Message-module_message", Nr = "Message-module_user", xr = "Message-module_bubble", Dr = "Message-module_error", Er = "Message-module_icon", Rr = "Message-module_content", Pr = "Message-module_disabled", Ge = {
|
|
3372
|
+
message: Lr,
|
|
3373
|
+
user: Nr,
|
|
3374
|
+
bubble: xr,
|
|
3375
|
+
error: Dr,
|
|
3376
|
+
icon: Er,
|
|
3377
|
+
content: Rr,
|
|
3378
|
+
disabled: Pr
|
|
3379
|
+
}, $r = ne.forwardRef(
|
|
3350
3380
|
function({
|
|
3351
3381
|
message: e,
|
|
3352
3382
|
messageRenderer: i = At,
|
|
@@ -3369,7 +3399,7 @@ const Ar = "Message-module_message", Or = "Message-module_user", Lr = "Message-m
|
|
|
3369
3399
|
}
|
|
3370
3400
|
return null;
|
|
3371
3401
|
}) });
|
|
3372
|
-
return /* @__PURE__ */
|
|
3402
|
+
return /* @__PURE__ */ C(
|
|
3373
3403
|
se.div,
|
|
3374
3404
|
{
|
|
3375
3405
|
ref: o,
|
|
@@ -3378,14 +3408,14 @@ const Ar = "Message-module_message", Or = "Message-module_user", Lr = "Message-m
|
|
|
3378
3408
|
animate: "visible",
|
|
3379
3409
|
"data-slot": "message",
|
|
3380
3410
|
"data-role": e.role,
|
|
3381
|
-
className:
|
|
3411
|
+
className: de(
|
|
3382
3412
|
Ge.message,
|
|
3383
3413
|
Ge[e.role],
|
|
3384
3414
|
e.disabled ? Ge.disabled : void 0
|
|
3385
3415
|
),
|
|
3386
3416
|
children: [
|
|
3387
|
-
r && /* @__PURE__ */ a("div", { className: Ge.icon, "aria-hidden": "true", children: /* @__PURE__ */ a(
|
|
3388
|
-
/* @__PURE__ */
|
|
3417
|
+
r && /* @__PURE__ */ a("div", { className: Ge.icon, "aria-hidden": "true", children: /* @__PURE__ */ a(Ar, { size: 28 }) }),
|
|
3418
|
+
/* @__PURE__ */ C(
|
|
3389
3419
|
"div",
|
|
3390
3420
|
{
|
|
3391
3421
|
className: Ge.content,
|
|
@@ -3404,20 +3434,20 @@ const Ar = "Message-module_message", Or = "Message-module_user", Lr = "Message-m
|
|
|
3404
3434
|
}
|
|
3405
3435
|
);
|
|
3406
3436
|
}
|
|
3407
|
-
),
|
|
3408
|
-
container: Pr,
|
|
3409
|
-
bottomMessages: $r
|
|
3410
|
-
}, Fr = "Thinking-module_container", jr = "Thinking-module_icon", Ur = "Thinking-module_content", Tt = {
|
|
3437
|
+
), Fr = "Messages-module_container", jr = "Messages-module_bottomMessages", at = {
|
|
3411
3438
|
container: Fr,
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3439
|
+
bottomMessages: jr
|
|
3440
|
+
}, Ur = "Thinking-module_container", Br = "Thinking-module_icon", Hr = "Thinking-module_content", Tt = {
|
|
3441
|
+
container: Ur,
|
|
3442
|
+
icon: Br,
|
|
3443
|
+
content: Hr
|
|
3444
|
+
}, Vr = Kt(
|
|
3445
|
+
ne.forwardRef(
|
|
3416
3446
|
function({
|
|
3417
3447
|
content: e = E("Thinking…", "a8c-agenttic")
|
|
3418
3448
|
}, i) {
|
|
3419
|
-
const n =
|
|
3420
|
-
return /* @__PURE__ */
|
|
3449
|
+
const n = ot(() => /* @__PURE__ */ a(Lt, {}), []);
|
|
3450
|
+
return /* @__PURE__ */ C(
|
|
3421
3451
|
"div",
|
|
3422
3452
|
{
|
|
3423
3453
|
ref: i,
|
|
@@ -3431,7 +3461,7 @@ const Ar = "Message-module_message", Or = "Message-module_user", Lr = "Message-m
|
|
|
3431
3461
|
);
|
|
3432
3462
|
}
|
|
3433
3463
|
)
|
|
3434
|
-
),
|
|
3464
|
+
), Wr = (t) => t.map((e) => ({
|
|
3435
3465
|
...e,
|
|
3436
3466
|
content: e.content.filter(
|
|
3437
3467
|
(i) => i.type !== "context" && i.type !== "data"
|
|
@@ -3447,23 +3477,27 @@ function ln({
|
|
|
3447
3477
|
messagesPosition: r = "top",
|
|
3448
3478
|
showAgentIcon: s
|
|
3449
3479
|
}) {
|
|
3450
|
-
const l =
|
|
3451
|
-
|
|
3452
|
-
const d =
|
|
3453
|
-
const
|
|
3480
|
+
const l = O(null), g = Wr(t);
|
|
3481
|
+
kr({ scrollAreaRef: l, visibleMessages: g });
|
|
3482
|
+
const d = ot(() => {
|
|
3483
|
+
const A = g.filter(
|
|
3454
3484
|
(N) => N.role === "agent"
|
|
3455
3485
|
);
|
|
3456
|
-
return
|
|
3486
|
+
return A.length ? A[A.length - 1].content.filter((N) => N.type === "text").map((N) => N.text).join(" ") : "";
|
|
3457
3487
|
}, [g]), [u] = Rn(d, 1e3), h = d !== u;
|
|
3458
3488
|
return g.length === 0 && !e ? n ? /* @__PURE__ */ a(
|
|
3459
3489
|
"div",
|
|
3460
3490
|
{
|
|
3461
3491
|
"data-slot": "messages",
|
|
3462
|
-
className:
|
|
3492
|
+
className: de(
|
|
3493
|
+
at.container,
|
|
3494
|
+
at.emptyState,
|
|
3495
|
+
r === "bottom" ? at.bottomMessages : ""
|
|
3496
|
+
),
|
|
3463
3497
|
ref: l,
|
|
3464
3498
|
children: n
|
|
3465
3499
|
}
|
|
3466
|
-
) : null : /* @__PURE__ */
|
|
3500
|
+
) : null : /* @__PURE__ */ C(Ke, { children: [
|
|
3467
3501
|
/* @__PURE__ */ a(
|
|
3468
3502
|
"div",
|
|
3469
3503
|
{
|
|
@@ -3483,22 +3517,22 @@ function ln({
|
|
|
3483
3517
|
"div",
|
|
3484
3518
|
{
|
|
3485
3519
|
"data-slot": "messages",
|
|
3486
|
-
className:
|
|
3487
|
-
|
|
3488
|
-
r === "bottom" ?
|
|
3520
|
+
className: de(
|
|
3521
|
+
at.container,
|
|
3522
|
+
r === "bottom" ? at.bottomMessages : ""
|
|
3489
3523
|
),
|
|
3490
3524
|
ref: l,
|
|
3491
|
-
children: /* @__PURE__ */
|
|
3492
|
-
g.map((
|
|
3493
|
-
|
|
3525
|
+
children: /* @__PURE__ */ C(ct, { mode: "popLayout", children: [
|
|
3526
|
+
g.map((A) => /* @__PURE__ */ a(
|
|
3527
|
+
$r,
|
|
3494
3528
|
{
|
|
3495
|
-
message:
|
|
3529
|
+
message: A,
|
|
3496
3530
|
messageRenderer: o,
|
|
3497
3531
|
showAgentIcon: s
|
|
3498
3532
|
},
|
|
3499
|
-
|
|
3533
|
+
A.reactKey || A.id
|
|
3500
3534
|
)),
|
|
3501
|
-
e && !h && /* @__PURE__ */ a(
|
|
3535
|
+
e && !h && /* @__PURE__ */ a(Vr, { content: c }),
|
|
3502
3536
|
i && /* @__PURE__ */ a(
|
|
3503
3537
|
"div",
|
|
3504
3538
|
{
|
|
@@ -3526,7 +3560,7 @@ function dn({ className: t } = {}) {
|
|
|
3526
3560
|
messagesPosition: r,
|
|
3527
3561
|
showAgentIcon: s,
|
|
3528
3562
|
thinkingMessage: l
|
|
3529
|
-
} =
|
|
3563
|
+
} = Ne();
|
|
3530
3564
|
return /* @__PURE__ */ a(
|
|
3531
3565
|
ln,
|
|
3532
3566
|
{
|
|
@@ -3542,7 +3576,7 @@ function dn({ className: t } = {}) {
|
|
|
3542
3576
|
}
|
|
3543
3577
|
);
|
|
3544
3578
|
}
|
|
3545
|
-
function
|
|
3579
|
+
function zr({ className: t, size: e = 24 }) {
|
|
3546
3580
|
return /* @__PURE__ */ a(
|
|
3547
3581
|
"svg",
|
|
3548
3582
|
{
|
|
@@ -3578,22 +3612,22 @@ function un({
|
|
|
3578
3612
|
handleKeyDown: d,
|
|
3579
3613
|
textareaRef: u,
|
|
3580
3614
|
placeholder: h,
|
|
3581
|
-
isProcessing:
|
|
3615
|
+
isProcessing: A,
|
|
3582
3616
|
onStop: x,
|
|
3583
3617
|
fromCompact: N,
|
|
3584
|
-
onExpand:
|
|
3585
|
-
showExpandButton:
|
|
3586
|
-
focusOnMount:
|
|
3587
|
-
onInputFocus:
|
|
3618
|
+
onExpand: $,
|
|
3619
|
+
showExpandButton: f,
|
|
3620
|
+
focusOnMount: T,
|
|
3621
|
+
onInputFocus: M,
|
|
3588
3622
|
onInputBlur: D
|
|
3589
|
-
} =
|
|
3590
|
-
o == null || o(
|
|
3591
|
-
},
|
|
3623
|
+
} = Ne(), _ = (H) => {
|
|
3624
|
+
o == null || o(H), !H.defaultPrevented && d(H);
|
|
3625
|
+
}, j = ot(() => r ? [{
|
|
3592
3626
|
id: "image-upload",
|
|
3593
|
-
icon: /* @__PURE__ */ a(
|
|
3627
|
+
icon: /* @__PURE__ */ a(zr, {}),
|
|
3594
3628
|
onClick: () => {
|
|
3595
|
-
var
|
|
3596
|
-
return (
|
|
3629
|
+
var I;
|
|
3630
|
+
return (I = r.current) == null ? void 0 : I.openFileDialog();
|
|
3597
3631
|
},
|
|
3598
3632
|
variant: "ghost",
|
|
3599
3633
|
"aria-label": E("Upload image", "a8c-agenttic")
|
|
@@ -3604,19 +3638,19 @@ function un({
|
|
|
3604
3638
|
value: s,
|
|
3605
3639
|
onChange: l,
|
|
3606
3640
|
onSubmit: g,
|
|
3607
|
-
onKeyDown:
|
|
3608
|
-
onFocus:
|
|
3641
|
+
onKeyDown: _,
|
|
3642
|
+
onFocus: M,
|
|
3609
3643
|
onBlur: D,
|
|
3610
3644
|
textareaRef: u,
|
|
3611
3645
|
placeholder: h,
|
|
3612
|
-
isProcessing:
|
|
3646
|
+
isProcessing: A,
|
|
3613
3647
|
onStop: x,
|
|
3614
3648
|
fromCompact: N,
|
|
3615
|
-
onExpand:
|
|
3616
|
-
showExpandButton:
|
|
3617
|
-
focusOnMount:
|
|
3649
|
+
onExpand: $,
|
|
3650
|
+
showExpandButton: f,
|
|
3651
|
+
focusOnMount: T,
|
|
3618
3652
|
disabled: e,
|
|
3619
|
-
customActions:
|
|
3653
|
+
customActions: j,
|
|
3620
3654
|
actionOrder: n,
|
|
3621
3655
|
className: t,
|
|
3622
3656
|
layout: c ?? (r ? "stacked" : "inline")
|
|
@@ -3635,7 +3669,7 @@ function gn({
|
|
|
3635
3669
|
messages: r,
|
|
3636
3670
|
variant: s,
|
|
3637
3671
|
emptyView: l
|
|
3638
|
-
} =
|
|
3672
|
+
} = Ne(), g = w(
|
|
3639
3673
|
(d, u) => {
|
|
3640
3674
|
try {
|
|
3641
3675
|
const h = d.prompt ?? d.label;
|
|
@@ -3656,8 +3690,8 @@ function gn({
|
|
|
3656
3690
|
}
|
|
3657
3691
|
);
|
|
3658
3692
|
}
|
|
3659
|
-
function
|
|
3660
|
-
return /* @__PURE__ */
|
|
3693
|
+
function Gr({ className: t, size: e = 18 }) {
|
|
3694
|
+
return /* @__PURE__ */ C(
|
|
3661
3695
|
"svg",
|
|
3662
3696
|
{
|
|
3663
3697
|
width: e,
|
|
@@ -3690,8 +3724,8 @@ function Wr({ className: t, size: e = 18 }) {
|
|
|
3690
3724
|
}
|
|
3691
3725
|
);
|
|
3692
3726
|
}
|
|
3693
|
-
function
|
|
3694
|
-
return /* @__PURE__ */
|
|
3727
|
+
function Zr({ className: t, size: e = 18 }) {
|
|
3728
|
+
return /* @__PURE__ */ C(
|
|
3695
3729
|
"svg",
|
|
3696
3730
|
{
|
|
3697
3731
|
width: e,
|
|
@@ -3730,16 +3764,16 @@ function zr({ className: t, size: e = 18 }) {
|
|
|
3730
3764
|
}
|
|
3731
3765
|
);
|
|
3732
3766
|
}
|
|
3733
|
-
const
|
|
3734
|
-
container:
|
|
3735
|
-
isSuccess:
|
|
3736
|
-
icon:
|
|
3737
|
-
isWarning:
|
|
3738
|
-
isError:
|
|
3739
|
-
content:
|
|
3740
|
-
actions:
|
|
3741
|
-
action:
|
|
3742
|
-
dismissible:
|
|
3767
|
+
const Yr = "Notice-module_container", Kr = "Notice-module_isSuccess", Jr = "Notice-module_icon", qr = "Notice-module_isWarning", Xr = "Notice-module_isError", Qr = "Notice-module_content", eo = "Notice-module_actions", to = "Notice-module_action", ao = "Notice-module_dismissible", Oe = {
|
|
3768
|
+
container: Yr,
|
|
3769
|
+
isSuccess: Kr,
|
|
3770
|
+
icon: Jr,
|
|
3771
|
+
isWarning: qr,
|
|
3772
|
+
isError: Xr,
|
|
3773
|
+
content: Qr,
|
|
3774
|
+
actions: eo,
|
|
3775
|
+
action: to,
|
|
3776
|
+
dismissible: ao
|
|
3743
3777
|
};
|
|
3744
3778
|
function mn({
|
|
3745
3779
|
icon: t,
|
|
@@ -3750,36 +3784,36 @@ function mn({
|
|
|
3750
3784
|
className: c,
|
|
3751
3785
|
status: r
|
|
3752
3786
|
}) {
|
|
3753
|
-
const l =
|
|
3754
|
-
if (
|
|
3787
|
+
const l = w(() => {
|
|
3788
|
+
if (ne.isValidElement(t))
|
|
3755
3789
|
return t;
|
|
3756
3790
|
if (t === !1 || t === null)
|
|
3757
3791
|
return null;
|
|
3758
3792
|
switch (r) {
|
|
3759
3793
|
case "warning":
|
|
3760
|
-
return /* @__PURE__ */ a(
|
|
3794
|
+
return /* @__PURE__ */ a(Gr, {});
|
|
3761
3795
|
case "error":
|
|
3762
|
-
return /* @__PURE__ */ a(
|
|
3796
|
+
return /* @__PURE__ */ a(Zr, {});
|
|
3763
3797
|
default:
|
|
3764
3798
|
return null;
|
|
3765
3799
|
}
|
|
3766
3800
|
}, [t, r])();
|
|
3767
|
-
return /* @__PURE__ */
|
|
3801
|
+
return /* @__PURE__ */ C(
|
|
3768
3802
|
"div",
|
|
3769
3803
|
{
|
|
3770
3804
|
"data-slot": "notice",
|
|
3771
|
-
className:
|
|
3772
|
-
|
|
3805
|
+
className: de(
|
|
3806
|
+
Oe.container,
|
|
3773
3807
|
{
|
|
3774
|
-
[
|
|
3775
|
-
[
|
|
3776
|
-
[
|
|
3808
|
+
[Oe.isSuccess]: r === "success",
|
|
3809
|
+
[Oe.isWarning]: r === "warning",
|
|
3810
|
+
[Oe.isError]: r === "error"
|
|
3777
3811
|
},
|
|
3778
3812
|
c
|
|
3779
3813
|
),
|
|
3780
3814
|
children: [
|
|
3781
|
-
/* @__PURE__ */
|
|
3782
|
-
l && /* @__PURE__ */ a("div", { className:
|
|
3815
|
+
/* @__PURE__ */ C("div", { className: Oe.content, children: [
|
|
3816
|
+
l && /* @__PURE__ */ a("div", { className: Oe.icon, children: l }),
|
|
3783
3817
|
/* @__PURE__ */ a("div", { children: /* @__PURE__ */ a(
|
|
3784
3818
|
At,
|
|
3785
3819
|
{
|
|
@@ -3800,11 +3834,11 @@ function mn({
|
|
|
3800
3834
|
}
|
|
3801
3835
|
) })
|
|
3802
3836
|
] }),
|
|
3803
|
-
/* @__PURE__ */
|
|
3837
|
+
/* @__PURE__ */ C("div", { className: Oe.actions, children: [
|
|
3804
3838
|
i && /* @__PURE__ */ a(
|
|
3805
3839
|
we,
|
|
3806
3840
|
{
|
|
3807
|
-
className:
|
|
3841
|
+
className: Oe.action,
|
|
3808
3842
|
onClick: i.onClick,
|
|
3809
3843
|
variant: "link",
|
|
3810
3844
|
children: i.label
|
|
@@ -3813,7 +3847,7 @@ function mn({
|
|
|
3813
3847
|
n && o && /* @__PURE__ */ a(
|
|
3814
3848
|
we,
|
|
3815
3849
|
{
|
|
3816
|
-
className:
|
|
3850
|
+
className: Oe.dismissible,
|
|
3817
3851
|
onClick: o,
|
|
3818
3852
|
variant: "ghost",
|
|
3819
3853
|
size: "sm",
|
|
@@ -3826,7 +3860,7 @@ function mn({
|
|
|
3826
3860
|
);
|
|
3827
3861
|
}
|
|
3828
3862
|
function pn({ className: t } = {}) {
|
|
3829
|
-
const { notice: e } =
|
|
3863
|
+
const { notice: e } = Ne();
|
|
3830
3864
|
return e ? /* @__PURE__ */ a(
|
|
3831
3865
|
mn,
|
|
3832
3866
|
{
|
|
@@ -3840,8 +3874,8 @@ function pn({ className: t } = {}) {
|
|
|
3840
3874
|
}
|
|
3841
3875
|
) : null;
|
|
3842
3876
|
}
|
|
3843
|
-
const
|
|
3844
|
-
container:
|
|
3877
|
+
const no = "ChatFooter-module_container", kt = {
|
|
3878
|
+
container: no
|
|
3845
3879
|
};
|
|
3846
3880
|
function hn({
|
|
3847
3881
|
children: t,
|
|
@@ -3851,20 +3885,20 @@ function hn({
|
|
|
3851
3885
|
se.div,
|
|
3852
3886
|
{
|
|
3853
3887
|
"data-slot": "chat-footer",
|
|
3854
|
-
className:
|
|
3888
|
+
className: de(kt.container, e),
|
|
3855
3889
|
initial: { opacity: 0, scale: 1 },
|
|
3856
3890
|
animate: { opacity: 1, scale: 1 },
|
|
3857
|
-
transition: { ...
|
|
3891
|
+
transition: { ...Be },
|
|
3858
3892
|
children: t
|
|
3859
3893
|
}
|
|
3860
|
-
) : /* @__PURE__ */
|
|
3894
|
+
) : /* @__PURE__ */ C(
|
|
3861
3895
|
se.div,
|
|
3862
3896
|
{
|
|
3863
3897
|
"data-slot": "chat-footer",
|
|
3864
|
-
className:
|
|
3898
|
+
className: de(kt.container, e),
|
|
3865
3899
|
initial: { opacity: 0, scale: 1 },
|
|
3866
3900
|
animate: { opacity: 1, scale: 1 },
|
|
3867
|
-
transition: { ...
|
|
3901
|
+
transition: { ...Be },
|
|
3868
3902
|
children: [
|
|
3869
3903
|
/* @__PURE__ */ a(gn, {}),
|
|
3870
3904
|
/* @__PURE__ */ a(pn, {}),
|
|
@@ -3873,23 +3907,23 @@ function hn({
|
|
|
3873
3907
|
}
|
|
3874
3908
|
);
|
|
3875
3909
|
}
|
|
3876
|
-
const
|
|
3877
|
-
container:
|
|
3878
|
-
withHeader:
|
|
3910
|
+
const io = "ConversationView-module_container", ro = "ConversationView-module_withHeader", Ye = {
|
|
3911
|
+
container: io,
|
|
3912
|
+
withHeader: ro
|
|
3879
3913
|
}, xt = Jt(function({
|
|
3880
3914
|
showHeader: e = !0,
|
|
3881
3915
|
children: i,
|
|
3882
3916
|
className: n
|
|
3883
3917
|
} = {}, o) {
|
|
3884
|
-
const { onClose: c } =
|
|
3885
|
-
if (
|
|
3918
|
+
const { onClose: c } = Ne();
|
|
3919
|
+
if (L(() => {
|
|
3886
3920
|
const r = (s) => {
|
|
3887
3921
|
s.key === "Escape" && c && c();
|
|
3888
3922
|
};
|
|
3889
3923
|
return document.addEventListener("keydown", r), () => document.removeEventListener("keydown", r);
|
|
3890
3924
|
}, [c]), i) {
|
|
3891
|
-
const r =
|
|
3892
|
-
(s) =>
|
|
3925
|
+
const r = ne.Children.toArray(i).some(
|
|
3926
|
+
(s) => ne.isValidElement(s) && (s.type === St || typeof s.type == "function" && s.type.name === "AgentUIHeader")
|
|
3893
3927
|
);
|
|
3894
3928
|
return /* @__PURE__ */ a(
|
|
3895
3929
|
"div",
|
|
@@ -3901,7 +3935,7 @@ const ao = "ConversationView-module_container", no = "ConversationView-module_wi
|
|
|
3901
3935
|
}
|
|
3902
3936
|
);
|
|
3903
3937
|
}
|
|
3904
|
-
return /* @__PURE__ */
|
|
3938
|
+
return /* @__PURE__ */ C(
|
|
3905
3939
|
"div",
|
|
3906
3940
|
{
|
|
3907
3941
|
ref: o,
|
|
@@ -3916,27 +3950,27 @@ const ao = "ConversationView-module_container", no = "ConversationView-module_wi
|
|
|
3916
3950
|
);
|
|
3917
3951
|
});
|
|
3918
3952
|
xt.displayName = "AgentUIConversationView";
|
|
3919
|
-
const
|
|
3920
|
-
container:
|
|
3921
|
-
button:
|
|
3922
|
-
icon:
|
|
3923
|
-
iconOpen:
|
|
3924
|
-
dropdown:
|
|
3953
|
+
const oo = "AgentUIInputToolbar-module_container", co = "AgentUIInputToolbar-module_button", so = "AgentUIInputToolbar-module_icon", lo = "AgentUIInputToolbar-module_iconOpen", uo = "AgentUIInputToolbar-module_dropdown", nt = {
|
|
3954
|
+
container: oo,
|
|
3955
|
+
button: co,
|
|
3956
|
+
icon: so,
|
|
3957
|
+
iconOpen: lo,
|
|
3958
|
+
dropdown: uo
|
|
3925
3959
|
};
|
|
3926
|
-
function
|
|
3960
|
+
function go({
|
|
3927
3961
|
children: t,
|
|
3928
3962
|
className: e,
|
|
3929
3963
|
icon: i,
|
|
3930
3964
|
label: n,
|
|
3931
3965
|
disabled: o
|
|
3932
3966
|
} = {}) {
|
|
3933
|
-
const [c, r] =
|
|
3934
|
-
return /* @__PURE__ */ a("div", { className: e, children: /* @__PURE__ */ a("div", { className:
|
|
3935
|
-
/* @__PURE__ */ a(
|
|
3967
|
+
const [c, r] = ne.useState(!1), s = n ?? "Input Toolbar";
|
|
3968
|
+
return /* @__PURE__ */ a("div", { className: e, children: /* @__PURE__ */ a("div", { className: nt.container, children: /* @__PURE__ */ C(Ue.Root, { open: c, onOpenChange: r, children: [
|
|
3969
|
+
/* @__PURE__ */ a(Ue.Trigger, { asChild: !0, children: /* @__PURE__ */ C(
|
|
3936
3970
|
"button",
|
|
3937
3971
|
{
|
|
3938
3972
|
type: "button",
|
|
3939
|
-
className:
|
|
3973
|
+
className: nt.button,
|
|
3940
3974
|
"aria-label": s,
|
|
3941
3975
|
disabled: o,
|
|
3942
3976
|
children: [
|
|
@@ -3950,7 +3984,7 @@ function lo({
|
|
|
3950
3984
|
viewBox: "0 0 24 24",
|
|
3951
3985
|
fill: "none",
|
|
3952
3986
|
"aria-hidden": "true",
|
|
3953
|
-
className: `${
|
|
3987
|
+
className: `${nt.icon} ${c ? nt.iconOpen : ""}`,
|
|
3954
3988
|
children: /* @__PURE__ */ a(
|
|
3955
3989
|
"path",
|
|
3956
3990
|
{
|
|
@@ -3966,9 +4000,9 @@ function lo({
|
|
|
3966
4000
|
}
|
|
3967
4001
|
) }),
|
|
3968
4002
|
/* @__PURE__ */ a(
|
|
3969
|
-
|
|
4003
|
+
Ue.Content,
|
|
3970
4004
|
{
|
|
3971
|
-
className:
|
|
4005
|
+
className: nt.dropdown,
|
|
3972
4006
|
side: "bottom",
|
|
3973
4007
|
align: "start",
|
|
3974
4008
|
sideOffset: 8,
|
|
@@ -3979,7 +4013,7 @@ function lo({
|
|
|
3979
4013
|
)
|
|
3980
4014
|
] }) }) });
|
|
3981
4015
|
}
|
|
3982
|
-
const
|
|
4016
|
+
const mo = {
|
|
3983
4017
|
// Core container with state management
|
|
3984
4018
|
Container: on,
|
|
3985
4019
|
// Individual composable components
|
|
@@ -3988,16 +4022,16 @@ const uo = {
|
|
|
3988
4022
|
Input: un,
|
|
3989
4023
|
Suggestions: gn,
|
|
3990
4024
|
Notice: pn,
|
|
3991
|
-
InputToolbar:
|
|
4025
|
+
InputToolbar: go,
|
|
3992
4026
|
// Convenience wrappers
|
|
3993
4027
|
Footer: hn,
|
|
3994
4028
|
ConversationView: xt
|
|
3995
|
-
},
|
|
4029
|
+
}, yc = Object.assign(
|
|
3996
4030
|
(t) => /* @__PURE__ */ a(
|
|
3997
4031
|
on,
|
|
3998
4032
|
{
|
|
3999
4033
|
...t,
|
|
4000
|
-
className:
|
|
4034
|
+
className: de("agenttic", t.className),
|
|
4001
4035
|
children: /* @__PURE__ */ a(
|
|
4002
4036
|
xt,
|
|
4003
4037
|
{
|
|
@@ -4006,9 +4040,9 @@ const uo = {
|
|
|
4006
4040
|
)
|
|
4007
4041
|
}
|
|
4008
4042
|
),
|
|
4009
|
-
|
|
4043
|
+
mo
|
|
4010
4044
|
);
|
|
4011
|
-
function
|
|
4045
|
+
function po({
|
|
4012
4046
|
inputValue: t,
|
|
4013
4047
|
onInputChange: e,
|
|
4014
4048
|
onSubmit: i,
|
|
@@ -4022,32 +4056,32 @@ function go({
|
|
|
4022
4056
|
disabled: d,
|
|
4023
4057
|
notice: u,
|
|
4024
4058
|
suggestions: h,
|
|
4025
|
-
clearSuggestions:
|
|
4059
|
+
clearSuggestions: A,
|
|
4026
4060
|
focusOnMount: x,
|
|
4027
4061
|
customActions: N,
|
|
4028
|
-
actionOrder:
|
|
4062
|
+
actionOrder: $
|
|
4029
4063
|
}) {
|
|
4030
|
-
const
|
|
4031
|
-
(
|
|
4032
|
-
const D =
|
|
4033
|
-
e(D),
|
|
4064
|
+
const f = w(
|
|
4065
|
+
(T, M) => {
|
|
4066
|
+
const D = T.prompt ?? T.label;
|
|
4067
|
+
e(D), A == null || A();
|
|
4034
4068
|
},
|
|
4035
|
-
[e,
|
|
4069
|
+
[e, A]
|
|
4036
4070
|
);
|
|
4037
|
-
return /* @__PURE__ */
|
|
4071
|
+
return /* @__PURE__ */ C(
|
|
4038
4072
|
se.div,
|
|
4039
4073
|
{
|
|
4040
4074
|
"data-slot": "chat-footer",
|
|
4041
4075
|
className: kt.container,
|
|
4042
4076
|
initial: { opacity: 0, scale: 1 },
|
|
4043
4077
|
animate: { opacity: 1, scale: 1 },
|
|
4044
|
-
transition: { ...
|
|
4078
|
+
transition: { ...Be },
|
|
4045
4079
|
children: [
|
|
4046
4080
|
!t && /* @__PURE__ */ a(
|
|
4047
4081
|
vt,
|
|
4048
4082
|
{
|
|
4049
4083
|
suggestions: h,
|
|
4050
|
-
onSubmit:
|
|
4084
|
+
onSubmit: f
|
|
4051
4085
|
}
|
|
4052
4086
|
),
|
|
4053
4087
|
u && /* @__PURE__ */ a(
|
|
@@ -4077,7 +4111,7 @@ function go({
|
|
|
4077
4111
|
showExpandButton: !1,
|
|
4078
4112
|
focusOnMount: x,
|
|
4079
4113
|
customActions: N,
|
|
4080
|
-
actionOrder:
|
|
4114
|
+
actionOrder: $,
|
|
4081
4115
|
disabled: d
|
|
4082
4116
|
}
|
|
4083
4117
|
)
|
|
@@ -4099,21 +4133,21 @@ function Gt({
|
|
|
4099
4133
|
fromCompact: d = !1,
|
|
4100
4134
|
showHeader: u = !1,
|
|
4101
4135
|
onClose: h,
|
|
4102
|
-
onExpand:
|
|
4136
|
+
onExpand: A,
|
|
4103
4137
|
notice: x,
|
|
4104
4138
|
emptyView: N,
|
|
4105
|
-
suggestions:
|
|
4106
|
-
clearSuggestions:
|
|
4107
|
-
messageRenderer:
|
|
4108
|
-
showAgentIcon:
|
|
4139
|
+
suggestions: $,
|
|
4140
|
+
clearSuggestions: f,
|
|
4141
|
+
messageRenderer: T,
|
|
4142
|
+
showAgentIcon: M,
|
|
4109
4143
|
focusOnMount: D = !1
|
|
4110
4144
|
}) {
|
|
4111
|
-
return
|
|
4112
|
-
const
|
|
4113
|
-
|
|
4145
|
+
return L(() => {
|
|
4146
|
+
const _ = (j) => {
|
|
4147
|
+
j.key === "Escape" && h && h();
|
|
4114
4148
|
};
|
|
4115
|
-
return document.addEventListener("keydown",
|
|
4116
|
-
}, [h]), /* @__PURE__ */
|
|
4149
|
+
return document.addEventListener("keydown", _), () => document.removeEventListener("keydown", _);
|
|
4150
|
+
}, [h]), /* @__PURE__ */ C(
|
|
4117
4151
|
"div",
|
|
4118
4152
|
{
|
|
4119
4153
|
"data-slot": "conversation-view",
|
|
@@ -4127,12 +4161,12 @@ function Gt({
|
|
|
4127
4161
|
isProcessing: l,
|
|
4128
4162
|
error: e,
|
|
4129
4163
|
emptyView: N,
|
|
4130
|
-
messageRenderer:
|
|
4131
|
-
showAgentIcon:
|
|
4164
|
+
messageRenderer: T,
|
|
4165
|
+
showAgentIcon: M
|
|
4132
4166
|
}
|
|
4133
4167
|
),
|
|
4134
4168
|
/* @__PURE__ */ a(
|
|
4135
|
-
|
|
4169
|
+
po,
|
|
4136
4170
|
{
|
|
4137
4171
|
inputValue: i,
|
|
4138
4172
|
onInputChange: n,
|
|
@@ -4143,10 +4177,10 @@ function Gt({
|
|
|
4143
4177
|
isProcessing: l,
|
|
4144
4178
|
onStop: g,
|
|
4145
4179
|
fromCompact: d,
|
|
4146
|
-
onExpand:
|
|
4180
|
+
onExpand: A,
|
|
4147
4181
|
notice: x,
|
|
4148
|
-
suggestions:
|
|
4149
|
-
clearSuggestions:
|
|
4182
|
+
suggestions: $,
|
|
4183
|
+
clearSuggestions: f,
|
|
4150
4184
|
focusOnMount: D
|
|
4151
4185
|
}
|
|
4152
4186
|
)
|
|
@@ -4154,7 +4188,7 @@ function Gt({
|
|
|
4154
4188
|
}
|
|
4155
4189
|
);
|
|
4156
4190
|
}
|
|
4157
|
-
function
|
|
4191
|
+
function bc({
|
|
4158
4192
|
messages: t,
|
|
4159
4193
|
isProcessing: e,
|
|
4160
4194
|
error: i,
|
|
@@ -4168,207 +4202,207 @@ function vc({
|
|
|
4168
4202
|
onExpand: d,
|
|
4169
4203
|
onClose: u,
|
|
4170
4204
|
onStop: h,
|
|
4171
|
-
emptyView:
|
|
4205
|
+
emptyView: A,
|
|
4172
4206
|
floatingChatState: x,
|
|
4173
4207
|
suggestions: N,
|
|
4174
|
-
clearSuggestions:
|
|
4175
|
-
messageRenderer:
|
|
4176
|
-
showAgentIcon:
|
|
4177
|
-
className:
|
|
4208
|
+
clearSuggestions: $,
|
|
4209
|
+
messageRenderer: f,
|
|
4210
|
+
showAgentIcon: T,
|
|
4211
|
+
className: M,
|
|
4178
4212
|
expandOnHover: D = !0,
|
|
4179
|
-
freeDrag:
|
|
4180
|
-
initialFreeDragPosition:
|
|
4181
|
-
onFreeDragEnd:
|
|
4213
|
+
freeDrag: _ = !1,
|
|
4214
|
+
initialFreeDragPosition: j,
|
|
4215
|
+
onFreeDragEnd: K,
|
|
4216
|
+
onChatPositionChange: H
|
|
4182
4217
|
}) {
|
|
4183
|
-
const [
|
|
4184
|
-
|
|
4185
|
-
|
|
4218
|
+
const [I, V] = Y(""), m = Za(x), z = O(!1), ie = O(!1), W = O(!1), [Se, ge] = Y(!1);
|
|
4219
|
+
L(() => {
|
|
4220
|
+
z.current = !1, ie.current = !1, W.current = !1;
|
|
4186
4221
|
}, [m.state]);
|
|
4187
|
-
const
|
|
4188
|
-
|
|
4189
|
-
clearTimeout(
|
|
4190
|
-
}),
|
|
4191
|
-
}, []),
|
|
4192
|
-
value:
|
|
4193
|
-
setValue:
|
|
4194
|
-
onSubmit: async (
|
|
4195
|
-
m.state !== "expanded" && (d == null || d()), m.setState("expanded"), await n(
|
|
4222
|
+
const J = O(/* @__PURE__ */ new Set()), Ce = w(() => {
|
|
4223
|
+
J.current.forEach((S) => {
|
|
4224
|
+
clearTimeout(S);
|
|
4225
|
+
}), J.current.clear();
|
|
4226
|
+
}, []), v = Ya({
|
|
4227
|
+
value: I,
|
|
4228
|
+
setValue: V,
|
|
4229
|
+
onSubmit: async (S) => {
|
|
4230
|
+
m.state !== "expanded" && (d == null || d()), m.setState("expanded"), await n(S);
|
|
4196
4231
|
},
|
|
4197
4232
|
isProcessing: e,
|
|
4198
4233
|
floatingChatState: m.state
|
|
4199
|
-
}), [
|
|
4234
|
+
}), [_e, ke] = Y(56), [me, Ve] = Y(
|
|
4200
4235
|
Ja
|
|
4201
|
-
),
|
|
4202
|
-
freeDrag:
|
|
4203
|
-
initialFreeDragPosition:
|
|
4204
|
-
side:
|
|
4205
|
-
}),
|
|
4206
|
-
|
|
4207
|
-
}, [m, g, d]),
|
|
4208
|
-
var
|
|
4209
|
-
const
|
|
4210
|
-
return !(
|
|
4211
|
-
}, [
|
|
4236
|
+
), xe = O(null), pe = O(null), he = O(null), { x: y, y: De } = qa({
|
|
4237
|
+
freeDrag: _,
|
|
4238
|
+
initialFreeDragPosition: j,
|
|
4239
|
+
side: me
|
|
4240
|
+
}), te = pt(y), X = pt(De), Ee = qt(), Re = w(() => {
|
|
4241
|
+
z.current = !0, m.open(), g == null || g(), d == null || d();
|
|
4242
|
+
}, [m, g, d]), p = w(() => {
|
|
4243
|
+
var G, Z, oe;
|
|
4244
|
+
const S = (Z = (G = he.current) == null ? void 0 : G.ownerDocument) == null ? void 0 : Z.activeElement;
|
|
4245
|
+
return !(S && ((oe = he.current) != null && oe.contains(S)) || I.trim());
|
|
4246
|
+
}, [I, he]), R = (S) => S === "collapsed" || S === "minimized" ? b.COLLAPSED_SIZE : S === "compact" ? _e : b.EXPANDED_HEIGHT, q = w(() => {
|
|
4212
4247
|
if (D && m.state === "collapsed" && (m.setState("compact"), m.initialState === "collapsed")) {
|
|
4213
|
-
const
|
|
4214
|
-
m.state === "compact" &&
|
|
4215
|
-
},
|
|
4216
|
-
|
|
4248
|
+
const S = setTimeout(() => {
|
|
4249
|
+
m.state === "compact" && p() && m.setState("collapsed"), J.current.delete(S);
|
|
4250
|
+
}, b.AUTO_COLLAPSE_DELAY);
|
|
4251
|
+
J.current.add(S);
|
|
4217
4252
|
}
|
|
4218
|
-
}, [m,
|
|
4219
|
-
if (m.initialState === "collapsed" && m.state === "compact" &&
|
|
4220
|
-
const
|
|
4221
|
-
m.state === "compact" &&
|
|
4222
|
-
},
|
|
4223
|
-
|
|
4253
|
+
}, [m, p, D]), U = w(() => {
|
|
4254
|
+
if (m.initialState === "collapsed" && m.state === "compact" && p()) {
|
|
4255
|
+
const S = setTimeout(() => {
|
|
4256
|
+
m.state === "compact" && p() && m.setState("collapsed"), J.current.delete(S);
|
|
4257
|
+
}, b.AUTO_COLLAPSE_DELAY);
|
|
4258
|
+
J.current.add(S);
|
|
4224
4259
|
}
|
|
4225
|
-
}, [m,
|
|
4226
|
-
if (
|
|
4227
|
-
const
|
|
4228
|
-
|
|
4260
|
+
}, [m, p]), ae = w(async () => {
|
|
4261
|
+
if (v.value.trim()) {
|
|
4262
|
+
const S = v.value.trim();
|
|
4263
|
+
v.clear(), m.state !== "expanded" && (d == null || d()), m.setState("expanded"), await n(S);
|
|
4229
4264
|
}
|
|
4230
|
-
}, [
|
|
4231
|
-
|
|
4232
|
-
}, [d, m]),
|
|
4233
|
-
|
|
4234
|
-
}, [
|
|
4235
|
-
(
|
|
4236
|
-
if (!
|
|
4265
|
+
}, [v, n, m, d]), ue = w(() => {
|
|
4266
|
+
W.current = !0, d == null || d(), m.setState("expanded");
|
|
4267
|
+
}, [d, m]), Me = w(() => {
|
|
4268
|
+
ie.current = !0, v.clear(), m.close(), u && u();
|
|
4269
|
+
}, [v, m, u]), fe = w(
|
|
4270
|
+
(S) => {
|
|
4271
|
+
if (!he.current || !pe.current)
|
|
4237
4272
|
return null;
|
|
4238
|
-
const
|
|
4273
|
+
const G = he.current.getBoundingClientRect(), Z = pe.current.getBoundingClientRect(), oe = window.getComputedStyle(he.current), ve = new DOMMatrixReadOnly(oe.transform), st = G.x - ve.e, Ae = G.y - ve.f, le = (S ?? me) === "left" ? Z.left : Z.right - b.COMPACT_WIDTH, qe = m.state === "minimized" ? window.innerHeight - b.COLLAPSED_SIZE : Z.bottom - b.EXPANDED_HEIGHT;
|
|
4239
4274
|
return {
|
|
4240
|
-
x:
|
|
4241
|
-
y:
|
|
4275
|
+
x: le - st,
|
|
4276
|
+
y: qe - Ae
|
|
4242
4277
|
};
|
|
4243
4278
|
},
|
|
4244
|
-
[
|
|
4245
|
-
),
|
|
4246
|
-
(
|
|
4247
|
-
|
|
4279
|
+
[me, m.state]
|
|
4280
|
+
), We = w(
|
|
4281
|
+
(S) => {
|
|
4282
|
+
S.target.closest(
|
|
4248
4283
|
re.NON_DRAGGABLE_SELECTORS
|
|
4249
|
-
) ||
|
|
4284
|
+
) || Ee.start(S.nativeEvent);
|
|
4250
4285
|
},
|
|
4251
|
-
[
|
|
4252
|
-
),
|
|
4253
|
-
(
|
|
4254
|
-
|
|
4255
|
-
|
|
4286
|
+
[Ee]
|
|
4287
|
+
), Te = w(
|
|
4288
|
+
(S, G) => {
|
|
4289
|
+
const Z = te.get(), oe = b.COMPACT_WIDTH, ve = (window.innerWidth - oe) / 2, Ae = Z < ve ? "left" : "right";
|
|
4290
|
+
if (me === Ae && (Ve(Ae), ht(Ae), H == null || H(Ae)), _) {
|
|
4291
|
+
K == null || K({ x: te.get(), y: X.get() });
|
|
4256
4292
|
return;
|
|
4257
4293
|
}
|
|
4258
|
-
const
|
|
4259
|
-
|
|
4260
|
-
const We = me(Re);
|
|
4261
|
-
We && (ye(ce, We.x, {
|
|
4294
|
+
const ce = fe(Ae);
|
|
4295
|
+
ce && (ye(te, ce.x, {
|
|
4262
4296
|
...re.SPRING_CONFIG,
|
|
4263
|
-
velocity:
|
|
4264
|
-
}), ye(X,
|
|
4297
|
+
velocity: G.velocity.x * re.VELOCITY_MULTIPLIER
|
|
4298
|
+
}), ye(X, ce.y, {
|
|
4265
4299
|
...re.SPRING_CONFIG,
|
|
4266
|
-
velocity:
|
|
4300
|
+
velocity: G.velocity.y * re.VELOCITY_MULTIPLIER
|
|
4267
4301
|
}));
|
|
4268
4302
|
},
|
|
4269
|
-
[
|
|
4270
|
-
),
|
|
4271
|
-
|
|
4272
|
-
const
|
|
4273
|
-
if (
|
|
4303
|
+
[te, X, fe, _, K]
|
|
4304
|
+
), Ie = O(_);
|
|
4305
|
+
L(() => {
|
|
4306
|
+
const S = Ie.current;
|
|
4307
|
+
if (Ie.current = _, _ || !S)
|
|
4274
4308
|
return;
|
|
4275
|
-
const
|
|
4276
|
-
|
|
4277
|
-
const
|
|
4278
|
-
|
|
4279
|
-
}, [
|
|
4280
|
-
const
|
|
4281
|
-
|
|
4282
|
-
const
|
|
4283
|
-
if (
|
|
4309
|
+
const Z = b.VIEWPORT_OFFSET + te.get() + b.COMPACT_WIDTH / 2 < window.innerWidth / 2 ? "left" : "right";
|
|
4310
|
+
me !== Z && (Ve(Z), ht(Z));
|
|
4311
|
+
const oe = fe(Z);
|
|
4312
|
+
oe && (ye(te, oe.x, re.SPRING_CONFIG), ye(X, oe.y, re.SPRING_CONFIG));
|
|
4313
|
+
}, [_, te, X, fe, me]);
|
|
4314
|
+
const Pe = O(null), F = O(m.state === "minimized");
|
|
4315
|
+
L(() => {
|
|
4316
|
+
const S = F.current, G = m.state === "minimized";
|
|
4317
|
+
if (F.current = G, !_ || G === S)
|
|
4284
4318
|
return;
|
|
4285
|
-
if (
|
|
4286
|
-
|
|
4287
|
-
const
|
|
4288
|
-
return () =>
|
|
4319
|
+
if (G) {
|
|
4320
|
+
Pe.current = X.get();
|
|
4321
|
+
const oe = ye(X, 0, re.SPRING_CONFIG);
|
|
4322
|
+
return () => oe.stop();
|
|
4289
4323
|
}
|
|
4290
|
-
if (
|
|
4324
|
+
if (Pe.current === null)
|
|
4291
4325
|
return;
|
|
4292
|
-
const
|
|
4326
|
+
const Z = ye(
|
|
4293
4327
|
X,
|
|
4294
|
-
|
|
4328
|
+
Pe.current,
|
|
4295
4329
|
re.SPRING_CONFIG
|
|
4296
4330
|
);
|
|
4297
|
-
return
|
|
4298
|
-
}, [m.state,
|
|
4299
|
-
const
|
|
4300
|
-
return
|
|
4301
|
-
|
|
4302
|
-
}, [m.state,
|
|
4331
|
+
return Pe.current = null, () => Z.stop();
|
|
4332
|
+
}, [m.state, _, X]);
|
|
4333
|
+
const Je = O(m.state), yt = Je.current === "compact" && m.state === "expanded";
|
|
4334
|
+
return L(() => {
|
|
4335
|
+
Ce(), Je.current = m.state;
|
|
4336
|
+
}, [m.state, Ce]), L(() => {
|
|
4303
4337
|
if (m.state !== "expanded")
|
|
4304
4338
|
return;
|
|
4305
|
-
const
|
|
4306
|
-
if (
|
|
4307
|
-
const
|
|
4308
|
-
{ x:
|
|
4309
|
-
|
|
4310
|
-
|
|
4339
|
+
const S = () => {
|
|
4340
|
+
if (_) {
|
|
4341
|
+
const Z = Ot(
|
|
4342
|
+
{ x: te.get(), y: X.get() },
|
|
4343
|
+
b.COMPACT_WIDTH,
|
|
4344
|
+
b.EXPANDED_HEIGHT
|
|
4311
4345
|
);
|
|
4312
|
-
|
|
4346
|
+
te.set(Z.x), X.set(Z.y);
|
|
4313
4347
|
return;
|
|
4314
4348
|
}
|
|
4315
|
-
const
|
|
4316
|
-
|
|
4349
|
+
const G = fe();
|
|
4350
|
+
G && (te.set(G.x), X.set(G.y));
|
|
4317
4351
|
};
|
|
4318
|
-
return window.addEventListener("resize",
|
|
4319
|
-
}, [m.state,
|
|
4320
|
-
const
|
|
4352
|
+
return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
|
|
4353
|
+
}, [m.state, te, X, fe, _]), L(() => {
|
|
4354
|
+
const S = J.current;
|
|
4321
4355
|
return () => {
|
|
4322
|
-
|
|
4323
|
-
clearTimeout(
|
|
4324
|
-
}),
|
|
4356
|
+
S.forEach((G) => {
|
|
4357
|
+
clearTimeout(G);
|
|
4358
|
+
}), S.clear();
|
|
4325
4359
|
};
|
|
4326
|
-
}, []),
|
|
4327
|
-
if (m.state === "compact" &&
|
|
4328
|
-
const
|
|
4329
|
-
|
|
4360
|
+
}, []), L(() => {
|
|
4361
|
+
if (m.state === "compact" && xe.current) {
|
|
4362
|
+
const S = xe.current.scrollHeight + b.PADDING;
|
|
4363
|
+
ke(S);
|
|
4330
4364
|
}
|
|
4331
|
-
}, [m.state,
|
|
4365
|
+
}, [m.state, v.value]), o === "embedded" ? /* @__PURE__ */ a(
|
|
4332
4366
|
"div",
|
|
4333
4367
|
{
|
|
4334
4368
|
"data-slot": "chat-embedded",
|
|
4335
|
-
className:
|
|
4369
|
+
className: de(M, be.container, be.embedded),
|
|
4336
4370
|
children: /* @__PURE__ */ a(
|
|
4337
4371
|
Gt,
|
|
4338
4372
|
{
|
|
4339
4373
|
messages: t,
|
|
4340
|
-
inputValue:
|
|
4341
|
-
onInputChange:
|
|
4342
|
-
onSubmit:
|
|
4343
|
-
onKeyDown:
|
|
4344
|
-
textareaRef:
|
|
4374
|
+
inputValue: v.value,
|
|
4375
|
+
onInputChange: v.setValue,
|
|
4376
|
+
onSubmit: ae,
|
|
4377
|
+
onKeyDown: v.handleKeyDown,
|
|
4378
|
+
textareaRef: v.textareaRef,
|
|
4345
4379
|
placeholder: s,
|
|
4346
4380
|
isProcessing: e,
|
|
4347
4381
|
onStop: h,
|
|
4348
4382
|
showHeader: !1,
|
|
4349
4383
|
notice: l,
|
|
4350
4384
|
suggestions: N,
|
|
4351
|
-
clearSuggestions:
|
|
4385
|
+
clearSuggestions: $,
|
|
4352
4386
|
error: i,
|
|
4353
|
-
emptyView:
|
|
4354
|
-
messageRenderer:
|
|
4355
|
-
showAgentIcon:
|
|
4356
|
-
onExpand:
|
|
4357
|
-
focusOnMount:
|
|
4387
|
+
emptyView: A,
|
|
4388
|
+
messageRenderer: f,
|
|
4389
|
+
showAgentIcon: T,
|
|
4390
|
+
onExpand: ue,
|
|
4391
|
+
focusOnMount: W.current
|
|
4358
4392
|
}
|
|
4359
4393
|
)
|
|
4360
4394
|
}
|
|
4361
|
-
) : /* @__PURE__ */
|
|
4395
|
+
) : /* @__PURE__ */ C(Ke, { children: [
|
|
4362
4396
|
/* @__PURE__ */ a(
|
|
4363
4397
|
"div",
|
|
4364
4398
|
{
|
|
4365
|
-
ref:
|
|
4399
|
+
ref: pe,
|
|
4366
4400
|
style: {
|
|
4367
4401
|
position: "fixed",
|
|
4368
|
-
top:
|
|
4369
|
-
left:
|
|
4370
|
-
right:
|
|
4371
|
-
bottom:
|
|
4402
|
+
top: b.VIEWPORT_OFFSET,
|
|
4403
|
+
left: b.VIEWPORT_OFFSET,
|
|
4404
|
+
right: b.VIEWPORT_OFFSET,
|
|
4405
|
+
bottom: b.VIEWPORT_OFFSET,
|
|
4372
4406
|
pointerEvents: "none"
|
|
4373
4407
|
}
|
|
4374
4408
|
}
|
|
@@ -4376,31 +4410,31 @@ function vc({
|
|
|
4376
4410
|
/* @__PURE__ */ a(
|
|
4377
4411
|
se.div,
|
|
4378
4412
|
{
|
|
4379
|
-
ref:
|
|
4413
|
+
ref: he,
|
|
4380
4414
|
"data-slot": "chat-floating",
|
|
4381
|
-
className:
|
|
4415
|
+
className: de(M, be.container, be.floating, {
|
|
4382
4416
|
[be.expanded]: m.state === "expanded",
|
|
4383
|
-
animating:
|
|
4417
|
+
animating: Se
|
|
4384
4418
|
}),
|
|
4385
|
-
onMouseLeave: m.state === "compact" ?
|
|
4419
|
+
onMouseLeave: m.state === "compact" ? U : void 0,
|
|
4386
4420
|
drag: m.state === "expanded",
|
|
4387
|
-
dragControls:
|
|
4421
|
+
dragControls: Ee,
|
|
4388
4422
|
dragListener: !1,
|
|
4389
|
-
dragConstraints:
|
|
4423
|
+
dragConstraints: pe,
|
|
4390
4424
|
dragMomentum: !1,
|
|
4391
|
-
dragElastic:
|
|
4425
|
+
dragElastic: _ ? 0 : 0.1,
|
|
4392
4426
|
dragTransition: { power: 0.1, timeConstant: 100 },
|
|
4393
|
-
onDragEnd:
|
|
4394
|
-
onPointerDown:
|
|
4427
|
+
onDragEnd: Te,
|
|
4428
|
+
onPointerDown: We,
|
|
4395
4429
|
initial: !1,
|
|
4396
4430
|
animate: {
|
|
4397
|
-
bottom: m.state === "minimized" ? 0 :
|
|
4431
|
+
bottom: m.state === "minimized" ? 0 : b.VIEWPORT_OFFSET
|
|
4398
4432
|
},
|
|
4399
|
-
transition:
|
|
4433
|
+
transition: He,
|
|
4400
4434
|
style: {
|
|
4401
|
-
x:
|
|
4435
|
+
x: te,
|
|
4402
4436
|
y: X,
|
|
4403
|
-
left:
|
|
4437
|
+
left: b.VIEWPORT_OFFSET
|
|
4404
4438
|
},
|
|
4405
4439
|
children: /* @__PURE__ */ a(
|
|
4406
4440
|
se.div,
|
|
@@ -4409,27 +4443,27 @@ function vc({
|
|
|
4409
4443
|
className: be.content,
|
|
4410
4444
|
initial: !1,
|
|
4411
4445
|
animate: {
|
|
4412
|
-
width: m.state === "collapsed" ?
|
|
4413
|
-
height:
|
|
4414
|
-
x: m.state === "collapsed" &&
|
|
4415
|
-
borderBottomLeftRadius: m.state === "minimized" ? 0 :
|
|
4416
|
-
borderBottomRightRadius: m.state === "minimized" ? 0 :
|
|
4417
|
-
transition:
|
|
4446
|
+
width: m.state === "collapsed" ? b.COLLAPSED_SIZE : b.COMPACT_WIDTH,
|
|
4447
|
+
height: R(m.state),
|
|
4448
|
+
x: m.state === "collapsed" && me === "right" ? b.COMPACT_WIDTH - b.COLLAPSED_SIZE : 0,
|
|
4449
|
+
borderBottomLeftRadius: m.state === "minimized" ? 0 : b.BORDER_RADIUS,
|
|
4450
|
+
borderBottomRightRadius: m.state === "minimized" ? 0 : b.BORDER_RADIUS,
|
|
4451
|
+
transition: v.value.trim() ? { duration: 0 } : He
|
|
4418
4452
|
},
|
|
4419
|
-
onAnimationStart: () =>
|
|
4420
|
-
onAnimationComplete: () =>
|
|
4453
|
+
onAnimationStart: () => ge(!0),
|
|
4454
|
+
onAnimationComplete: () => ge(!1),
|
|
4421
4455
|
style: {
|
|
4422
|
-
borderTopLeftRadius:
|
|
4423
|
-
borderTopRightRadius:
|
|
4456
|
+
borderTopLeftRadius: b.BORDER_RADIUS,
|
|
4457
|
+
borderTopRightRadius: b.BORDER_RADIUS
|
|
4424
4458
|
},
|
|
4425
|
-
children: /* @__PURE__ */
|
|
4459
|
+
children: /* @__PURE__ */ C(ct, { mode: "wait", children: [
|
|
4426
4460
|
m.state === "collapsed" && /* @__PURE__ */ a(
|
|
4427
4461
|
en,
|
|
4428
4462
|
{
|
|
4429
4463
|
icon: c,
|
|
4430
|
-
onClick:
|
|
4431
|
-
onHover:
|
|
4432
|
-
focusOnMount:
|
|
4464
|
+
onClick: Re,
|
|
4465
|
+
onHover: q,
|
|
4466
|
+
focusOnMount: ie.current
|
|
4433
4467
|
},
|
|
4434
4468
|
"collapsed"
|
|
4435
4469
|
),
|
|
@@ -4438,28 +4472,28 @@ function vc({
|
|
|
4438
4472
|
{
|
|
4439
4473
|
icon: c,
|
|
4440
4474
|
title: r,
|
|
4441
|
-
onClick:
|
|
4442
|
-
focusOnMount:
|
|
4475
|
+
onClick: Re,
|
|
4476
|
+
focusOnMount: ie.current
|
|
4443
4477
|
},
|
|
4444
4478
|
"minimized"
|
|
4445
4479
|
),
|
|
4446
|
-
m.state === "compact" && /* @__PURE__ */ a("div", { ref:
|
|
4480
|
+
m.state === "compact" && /* @__PURE__ */ a("div", { ref: xe, children: /* @__PURE__ */ a(
|
|
4447
4481
|
nn,
|
|
4448
4482
|
{
|
|
4449
|
-
value:
|
|
4450
|
-
onChange:
|
|
4451
|
-
onSubmit:
|
|
4452
|
-
onKeyDown:
|
|
4453
|
-
textareaRef:
|
|
4483
|
+
value: v.value,
|
|
4484
|
+
onChange: v.setValue,
|
|
4485
|
+
onSubmit: ae,
|
|
4486
|
+
onKeyDown: v.handleKeyDown,
|
|
4487
|
+
textareaRef: v.textareaRef,
|
|
4454
4488
|
placeholder: s,
|
|
4455
4489
|
isProcessing: e,
|
|
4456
|
-
onBlur:
|
|
4457
|
-
onExpand:
|
|
4458
|
-
showExpandButton: !
|
|
4459
|
-
focusOnMount:
|
|
4490
|
+
onBlur: U,
|
|
4491
|
+
onExpand: ue,
|
|
4492
|
+
showExpandButton: !v.value.trim(),
|
|
4493
|
+
focusOnMount: z.current,
|
|
4460
4494
|
onStop: h,
|
|
4461
4495
|
suggestions: N,
|
|
4462
|
-
clearSuggestions:
|
|
4496
|
+
clearSuggestions: $
|
|
4463
4497
|
},
|
|
4464
4498
|
"compact"
|
|
4465
4499
|
) }),
|
|
@@ -4467,26 +4501,26 @@ function vc({
|
|
|
4467
4501
|
Gt,
|
|
4468
4502
|
{
|
|
4469
4503
|
messages: t,
|
|
4470
|
-
inputValue:
|
|
4471
|
-
onInputChange:
|
|
4472
|
-
onSubmit:
|
|
4473
|
-
onKeyDown:
|
|
4474
|
-
textareaRef:
|
|
4504
|
+
inputValue: v.value,
|
|
4505
|
+
onInputChange: v.setValue,
|
|
4506
|
+
onSubmit: ae,
|
|
4507
|
+
onKeyDown: v.handleKeyDown,
|
|
4508
|
+
textareaRef: v.textareaRef,
|
|
4475
4509
|
placeholder: s,
|
|
4476
4510
|
isProcessing: e,
|
|
4477
4511
|
onStop: h,
|
|
4478
4512
|
showHeader: !0,
|
|
4479
|
-
onClose:
|
|
4480
|
-
fromCompact:
|
|
4513
|
+
onClose: Me,
|
|
4514
|
+
fromCompact: yt,
|
|
4481
4515
|
notice: l,
|
|
4482
4516
|
suggestions: N,
|
|
4483
|
-
clearSuggestions:
|
|
4517
|
+
clearSuggestions: $,
|
|
4484
4518
|
error: i,
|
|
4485
|
-
emptyView:
|
|
4486
|
-
messageRenderer:
|
|
4487
|
-
showAgentIcon:
|
|
4488
|
-
onExpand:
|
|
4489
|
-
focusOnMount:
|
|
4519
|
+
emptyView: A,
|
|
4520
|
+
messageRenderer: f,
|
|
4521
|
+
showAgentIcon: T,
|
|
4522
|
+
onExpand: ue,
|
|
4523
|
+
focusOnMount: W.current
|
|
4490
4524
|
},
|
|
4491
4525
|
"expanded"
|
|
4492
4526
|
)
|
|
@@ -4497,27 +4531,27 @@ function vc({
|
|
|
4497
4531
|
)
|
|
4498
4532
|
] });
|
|
4499
4533
|
}
|
|
4500
|
-
const
|
|
4501
|
-
container:
|
|
4502
|
-
active:
|
|
4503
|
-
uploader:
|
|
4504
|
-
uploading:
|
|
4505
|
-
content:
|
|
4506
|
-
hiddenInput:
|
|
4507
|
-
clickArea:
|
|
4508
|
-
draggingMessage:
|
|
4509
|
-
draggingOver:
|
|
4510
|
-
preview:
|
|
4511
|
-
previewItem:
|
|
4512
|
-
removeButton:
|
|
4513
|
-
previewImage:
|
|
4514
|
-
previewMeta:
|
|
4515
|
-
previewFilename:
|
|
4516
|
-
previewType:
|
|
4517
|
-
uploadingIndicator:
|
|
4518
|
-
spinner:
|
|
4519
|
-
invalidMessage:
|
|
4520
|
-
},
|
|
4534
|
+
const ho = "ImageUploader-module_container", fo = "ImageUploader-module_active", vo = "ImageUploader-module_uploader", yo = "ImageUploader-module_uploading", bo = "ImageUploader-module_content", wo = "ImageUploader-module_hiddenInput", Co = "ImageUploader-module_clickArea", _o = "ImageUploader-module_draggingMessage", To = "ImageUploader-module_draggingOver", Io = "ImageUploader-module_preview", So = "ImageUploader-module_previewItem", ko = "ImageUploader-module_removeButton", Mo = "ImageUploader-module_previewImage", Ao = "ImageUploader-module_previewMeta", Oo = "ImageUploader-module_previewFilename", Lo = "ImageUploader-module_previewType", No = "ImageUploader-module_uploadingIndicator", xo = "ImageUploader-module_spinner", Do = "ImageUploader-module_invalidMessage", ee = {
|
|
4535
|
+
container: ho,
|
|
4536
|
+
active: fo,
|
|
4537
|
+
uploader: vo,
|
|
4538
|
+
uploading: yo,
|
|
4539
|
+
content: bo,
|
|
4540
|
+
hiddenInput: wo,
|
|
4541
|
+
clickArea: Co,
|
|
4542
|
+
draggingMessage: _o,
|
|
4543
|
+
draggingOver: To,
|
|
4544
|
+
preview: Io,
|
|
4545
|
+
previewItem: So,
|
|
4546
|
+
removeButton: ko,
|
|
4547
|
+
previewImage: Mo,
|
|
4548
|
+
previewMeta: Ao,
|
|
4549
|
+
previewFilename: Oo,
|
|
4550
|
+
previewType: Lo,
|
|
4551
|
+
uploadingIndicator: No,
|
|
4552
|
+
spinner: xo,
|
|
4553
|
+
invalidMessage: Do
|
|
4554
|
+
}, Eo = Kt(
|
|
4521
4555
|
({
|
|
4522
4556
|
image: t,
|
|
4523
4557
|
allowDragToInsert: e,
|
|
@@ -4527,7 +4561,7 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
|
|
|
4527
4561
|
onRemove: c
|
|
4528
4562
|
}) => {
|
|
4529
4563
|
const r = t.mime_type ? t.mime_type.split("/")[1].toUpperCase() : "", s = t.title || t.name || t.url.split("/").pop() || "image";
|
|
4530
|
-
return /* @__PURE__ */
|
|
4564
|
+
return /* @__PURE__ */ C(
|
|
4531
4565
|
"div",
|
|
4532
4566
|
{
|
|
4533
4567
|
className: ee.previewItem,
|
|
@@ -4572,7 +4606,7 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
|
|
|
4572
4606
|
loading: "lazy"
|
|
4573
4607
|
}
|
|
4574
4608
|
),
|
|
4575
|
-
i && /* @__PURE__ */
|
|
4609
|
+
i && /* @__PURE__ */ C("div", { className: ee.previewMeta, children: [
|
|
4576
4610
|
/* @__PURE__ */ a(
|
|
4577
4611
|
"span",
|
|
4578
4612
|
{
|
|
@@ -4588,7 +4622,7 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
|
|
|
4588
4622
|
t.id
|
|
4589
4623
|
);
|
|
4590
4624
|
}
|
|
4591
|
-
),
|
|
4625
|
+
), wc = Jt(function({
|
|
4592
4626
|
images: e = [],
|
|
4593
4627
|
uploadingImages: i = [],
|
|
4594
4628
|
onFilesSelected: n,
|
|
@@ -4601,65 +4635,65 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
|
|
|
4601
4635
|
acceptedFileTypes: d = ["image/jpeg", "image/png"],
|
|
4602
4636
|
maxFileSize: u,
|
|
4603
4637
|
maxFiles: h,
|
|
4604
|
-
uploadingIndicator:
|
|
4638
|
+
uploadingIndicator: A,
|
|
4605
4639
|
className: x = "",
|
|
4606
4640
|
showFileMetadata: N = !0,
|
|
4607
|
-
allowDragToInsert:
|
|
4608
|
-
onError:
|
|
4609
|
-
visible:
|
|
4610
|
-
dropZoneRef:
|
|
4641
|
+
allowDragToInsert: $ = !0,
|
|
4642
|
+
onError: f,
|
|
4643
|
+
visible: T = !0,
|
|
4644
|
+
dropZoneRef: M
|
|
4611
4645
|
}, D) {
|
|
4612
|
-
const { textareaRef:
|
|
4646
|
+
const { textareaRef: _ } = Ne(), [j, K] = Y(!1), [H, I] = Y(!1), [V, m] = Y(!1), z = O(null), ie = O(null), W = O(0);
|
|
4613
4647
|
xn(D, () => ({
|
|
4614
4648
|
openFileDialog: () => {
|
|
4615
|
-
var
|
|
4616
|
-
(
|
|
4649
|
+
var p;
|
|
4650
|
+
(p = z.current) == null || p.click();
|
|
4617
4651
|
}
|
|
4618
|
-
})),
|
|
4619
|
-
const
|
|
4620
|
-
if (!
|
|
4652
|
+
})), L(() => {
|
|
4653
|
+
const p = M ? M.current : window;
|
|
4654
|
+
if (!p)
|
|
4621
4655
|
return;
|
|
4622
|
-
const R = (
|
|
4623
|
-
var
|
|
4624
|
-
(
|
|
4625
|
-
},
|
|
4626
|
-
|
|
4656
|
+
const R = (ae) => {
|
|
4657
|
+
var ue, Me;
|
|
4658
|
+
(Me = (ue = ae.dataTransfer) == null ? void 0 : ue.types) != null && Me.includes("Files") && (W.current += 1, I(!0));
|
|
4659
|
+
}, q = (ae) => {
|
|
4660
|
+
W.current -= 1, (W.current === 0 || ae.relatedTarget === null) && (W.current = 0, I(!1));
|
|
4627
4661
|
}, U = () => {
|
|
4628
|
-
|
|
4662
|
+
W.current = 0, I(!1);
|
|
4629
4663
|
};
|
|
4630
|
-
return
|
|
4664
|
+
return p.addEventListener(
|
|
4631
4665
|
"dragenter",
|
|
4632
4666
|
R
|
|
4633
|
-
),
|
|
4667
|
+
), p.addEventListener(
|
|
4634
4668
|
"dragleave",
|
|
4635
|
-
|
|
4636
|
-
),
|
|
4637
|
-
|
|
4669
|
+
q
|
|
4670
|
+
), p.addEventListener("drop", U), () => {
|
|
4671
|
+
p.removeEventListener(
|
|
4638
4672
|
"dragenter",
|
|
4639
4673
|
R
|
|
4640
|
-
),
|
|
4674
|
+
), p.removeEventListener(
|
|
4641
4675
|
"dragleave",
|
|
4642
|
-
|
|
4643
|
-
),
|
|
4676
|
+
q
|
|
4677
|
+
), p.removeEventListener("drop", U);
|
|
4644
4678
|
};
|
|
4645
|
-
}, [
|
|
4646
|
-
|
|
4679
|
+
}, [M]), L(() => () => {
|
|
4680
|
+
ie.current && clearTimeout(ie.current);
|
|
4647
4681
|
}, []);
|
|
4648
|
-
const
|
|
4649
|
-
const R = Math.min(
|
|
4650
|
-
return
|
|
4651
|
-
}, []),
|
|
4652
|
-
(
|
|
4653
|
-
if (!
|
|
4682
|
+
const Se = w((p) => {
|
|
4683
|
+
const R = Math.min(p, 10485760), q = Math.floor(R / (1024 * 1024));
|
|
4684
|
+
return q >= 1 ? `${q} MB` : `${Math.floor(R / 1024)} KB`;
|
|
4685
|
+
}, []), ge = w(
|
|
4686
|
+
(p) => {
|
|
4687
|
+
if (!p || p.length === 0)
|
|
4654
4688
|
return;
|
|
4655
|
-
const R = Array.from(
|
|
4689
|
+
const R = Array.from(p), q = R.filter(
|
|
4656
4690
|
(U) => d.includes(U.type)
|
|
4657
4691
|
);
|
|
4658
|
-
if (
|
|
4659
|
-
|
|
4660
|
-
const U = d.map((
|
|
4661
|
-
|
|
4662
|
-
|
|
4692
|
+
if (q.length < R.length) {
|
|
4693
|
+
m(!0);
|
|
4694
|
+
const U = d.map((ae) => ae.split("/")[1].toUpperCase()).join(" or ");
|
|
4695
|
+
f == null || f(
|
|
4696
|
+
je(
|
|
4663
4697
|
/* translators: %s: allowed file types (e.g., "JPEG or PNG") */
|
|
4664
4698
|
E(
|
|
4665
4699
|
"Only %s image files are allowed.",
|
|
@@ -4667,178 +4701,178 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
|
|
|
4667
4701
|
),
|
|
4668
4702
|
U
|
|
4669
4703
|
)
|
|
4670
|
-
),
|
|
4671
|
-
|
|
4704
|
+
), ie.current && clearTimeout(ie.current), ie.current = setTimeout(() => {
|
|
4705
|
+
m(!1);
|
|
4672
4706
|
}, 3e3);
|
|
4673
4707
|
}
|
|
4674
|
-
if (h &&
|
|
4675
|
-
|
|
4676
|
-
|
|
4708
|
+
if (h && q.length > h) {
|
|
4709
|
+
f == null || f(
|
|
4710
|
+
je(
|
|
4677
4711
|
/* translators: %d: maximum number of files allowed */
|
|
4678
4712
|
E("Maximum %d files allowed.", "a8c-agenttic"),
|
|
4679
4713
|
h
|
|
4680
4714
|
)
|
|
4681
4715
|
);
|
|
4682
|
-
const U =
|
|
4716
|
+
const U = q.slice(0, h);
|
|
4683
4717
|
U.length > 0 && n(U);
|
|
4684
4718
|
return;
|
|
4685
4719
|
}
|
|
4686
|
-
|
|
4720
|
+
q.length > 0 && n(q);
|
|
4687
4721
|
},
|
|
4688
|
-
[n, d, h,
|
|
4689
|
-
),
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
}, [
|
|
4693
|
-
const
|
|
4694
|
-
if (!
|
|
4722
|
+
[n, d, h, f]
|
|
4723
|
+
), J = O(ge);
|
|
4724
|
+
L(() => {
|
|
4725
|
+
J.current = ge;
|
|
4726
|
+
}, [ge]), L(() => {
|
|
4727
|
+
const p = M == null ? void 0 : M.current;
|
|
4728
|
+
if (!p)
|
|
4695
4729
|
return;
|
|
4696
4730
|
const R = (U) => {
|
|
4697
4731
|
U.preventDefault();
|
|
4698
|
-
},
|
|
4699
|
-
var
|
|
4700
|
-
U.preventDefault(),
|
|
4732
|
+
}, q = (U) => {
|
|
4733
|
+
var ae;
|
|
4734
|
+
U.preventDefault(), W.current = 0, I(!1), K(!1), (ae = U.dataTransfer) != null && ae.files && (J.current(U.dataTransfer.files), c == null || c(Array.from(U.dataTransfer.files)));
|
|
4701
4735
|
};
|
|
4702
|
-
return
|
|
4703
|
-
|
|
4736
|
+
return p.addEventListener("dragover", R), p.addEventListener("drop", q), () => {
|
|
4737
|
+
p.removeEventListener(
|
|
4704
4738
|
"dragover",
|
|
4705
4739
|
R
|
|
4706
|
-
),
|
|
4740
|
+
), p.removeEventListener("drop", q);
|
|
4707
4741
|
};
|
|
4708
|
-
}, [
|
|
4709
|
-
const
|
|
4710
|
-
var
|
|
4711
|
-
const
|
|
4712
|
-
if (!
|
|
4742
|
+
}, [M, c]), L(() => {
|
|
4743
|
+
const p = (R) => {
|
|
4744
|
+
var Me;
|
|
4745
|
+
const q = _.current && document.activeElement === _.current, U = _.current && R.target && (R.target === _.current || _.current.contains(R.target));
|
|
4746
|
+
if (!q && !U)
|
|
4713
4747
|
return;
|
|
4714
|
-
const
|
|
4715
|
-
if (!
|
|
4748
|
+
const ae = (Me = R.clipboardData) == null ? void 0 : Me.items;
|
|
4749
|
+
if (!ae)
|
|
4716
4750
|
return;
|
|
4717
|
-
const
|
|
4718
|
-
for (let
|
|
4719
|
-
const
|
|
4720
|
-
if (
|
|
4721
|
-
const
|
|
4722
|
-
|
|
4751
|
+
const ue = [];
|
|
4752
|
+
for (let fe = 0; fe < ae.length; fe++) {
|
|
4753
|
+
const We = ae[fe];
|
|
4754
|
+
if (We.type.startsWith("image/")) {
|
|
4755
|
+
const Te = We.getAsFile();
|
|
4756
|
+
Te && ue.push(Te);
|
|
4723
4757
|
}
|
|
4724
4758
|
}
|
|
4725
|
-
|
|
4759
|
+
ue.length > 0 && (R.preventDefault(), J.current(ue), r == null || r(ue));
|
|
4726
4760
|
};
|
|
4727
|
-
return window.addEventListener("paste",
|
|
4728
|
-
window.removeEventListener("paste",
|
|
4761
|
+
return window.addEventListener("paste", p), () => {
|
|
4762
|
+
window.removeEventListener("paste", p);
|
|
4729
4763
|
};
|
|
4730
4764
|
}, [r]);
|
|
4731
|
-
const
|
|
4732
|
-
|
|
4733
|
-
},
|
|
4734
|
-
|
|
4735
|
-
},
|
|
4736
|
-
if (
|
|
4737
|
-
const R = Array.from(
|
|
4738
|
-
|
|
4765
|
+
const Ce = (p) => {
|
|
4766
|
+
p.preventDefault(), p.stopPropagation(), K(!0);
|
|
4767
|
+
}, v = (p) => {
|
|
4768
|
+
p.preventDefault(), p.stopPropagation(), K(!1);
|
|
4769
|
+
}, _e = (p) => {
|
|
4770
|
+
if (p.preventDefault(), p.stopPropagation(), K(!1), W.current = 0, I(!1), p.dataTransfer.files) {
|
|
4771
|
+
const R = Array.from(p.dataTransfer.files);
|
|
4772
|
+
ge(p.dataTransfer.files), c == null || c(R);
|
|
4739
4773
|
}
|
|
4740
|
-
},
|
|
4741
|
-
if (
|
|
4742
|
-
const R = Array.from(
|
|
4743
|
-
|
|
4774
|
+
}, ke = (p) => {
|
|
4775
|
+
if (p.target.files) {
|
|
4776
|
+
const R = Array.from(p.target.files);
|
|
4777
|
+
ge(p.target.files), o == null || o(R);
|
|
4744
4778
|
}
|
|
4745
|
-
|
|
4746
|
-
},
|
|
4747
|
-
var
|
|
4748
|
-
(
|
|
4749
|
-
},
|
|
4750
|
-
(
|
|
4751
|
-
l == null || l(
|
|
4779
|
+
p.target.value = "";
|
|
4780
|
+
}, me = () => {
|
|
4781
|
+
var p;
|
|
4782
|
+
(p = z.current) == null || p.click();
|
|
4783
|
+
}, Ve = w(
|
|
4784
|
+
(p, R) => {
|
|
4785
|
+
l == null || l(p, R);
|
|
4752
4786
|
},
|
|
4753
4787
|
[l]
|
|
4754
|
-
),
|
|
4755
|
-
(
|
|
4756
|
-
g == null || g(
|
|
4788
|
+
), xe = w(
|
|
4789
|
+
(p, R) => {
|
|
4790
|
+
g == null || g(p, R);
|
|
4757
4791
|
},
|
|
4758
4792
|
[g]
|
|
4759
|
-
),
|
|
4760
|
-
(
|
|
4761
|
-
|
|
4793
|
+
), pe = w(
|
|
4794
|
+
(p, R) => {
|
|
4795
|
+
p.stopPropagation(), s(R);
|
|
4762
4796
|
},
|
|
4763
4797
|
[s]
|
|
4764
4798
|
);
|
|
4765
|
-
if (!
|
|
4799
|
+
if (!T)
|
|
4766
4800
|
return null;
|
|
4767
|
-
const
|
|
4801
|
+
const he = e.length > 0, y = i.length > 0, De = H, te = !H && (he || y), X = he || y || H || V, Ee = u ? je(
|
|
4768
4802
|
/* translators: %s: maximum file size (e.g., "5 MB") */
|
|
4769
4803
|
E("Upload image files up to %s each.", "a8c-agenttic"),
|
|
4770
|
-
|
|
4771
|
-
) : "",
|
|
4804
|
+
Se(u)
|
|
4805
|
+
) : "", Re = je(
|
|
4772
4806
|
/* translators: %s: allowed file types (e.g., "JPEG or PNG") */
|
|
4773
4807
|
E("Only %s image files are allowed.", "a8c-agenttic"),
|
|
4774
|
-
d.map((
|
|
4808
|
+
d.map((p) => p.split("/")[1].toUpperCase()).join(" or ")
|
|
4775
4809
|
);
|
|
4776
4810
|
return /* @__PURE__ */ a(
|
|
4777
4811
|
"div",
|
|
4778
4812
|
{
|
|
4779
|
-
className: `${ee.container} ${
|
|
4813
|
+
className: `${ee.container} ${X ? ee.active : ""} ${x}`,
|
|
4780
4814
|
"data-slot": "image-uploader",
|
|
4781
4815
|
children: /* @__PURE__ */ a(
|
|
4782
4816
|
"div",
|
|
4783
4817
|
{
|
|
4784
|
-
className: `${ee.uploader} ${
|
|
4785
|
-
children: /* @__PURE__ */
|
|
4786
|
-
!
|
|
4818
|
+
className: `${ee.uploader} ${y ? ee.uploading : ""} ${j ? ee.draggingOver : ""}`,
|
|
4819
|
+
children: /* @__PURE__ */ C("div", { className: ee.content, children: [
|
|
4820
|
+
!V && /* @__PURE__ */ C(Ke, { children: [
|
|
4787
4821
|
/* @__PURE__ */ a(
|
|
4788
4822
|
"input",
|
|
4789
4823
|
{
|
|
4790
|
-
ref:
|
|
4824
|
+
ref: z,
|
|
4791
4825
|
type: "file",
|
|
4792
4826
|
accept: d.join(","),
|
|
4793
4827
|
multiple: !h || h > 1,
|
|
4794
|
-
onChange:
|
|
4828
|
+
onChange: ke,
|
|
4795
4829
|
className: ee.hiddenInput
|
|
4796
4830
|
}
|
|
4797
4831
|
),
|
|
4798
|
-
/* @__PURE__ */
|
|
4832
|
+
/* @__PURE__ */ C(
|
|
4799
4833
|
"div",
|
|
4800
4834
|
{
|
|
4801
4835
|
className: ee.clickArea,
|
|
4802
|
-
onClick:
|
|
4803
|
-
onDragOver:
|
|
4804
|
-
onDragLeave:
|
|
4805
|
-
onDrop:
|
|
4836
|
+
onClick: me,
|
|
4837
|
+
onDragOver: Ce,
|
|
4838
|
+
onDragLeave: v,
|
|
4839
|
+
onDrop: _e,
|
|
4806
4840
|
role: "button",
|
|
4807
4841
|
tabIndex: 0,
|
|
4808
|
-
onKeyDown: (
|
|
4809
|
-
(
|
|
4842
|
+
onKeyDown: (p) => {
|
|
4843
|
+
(p.key === "Enter" || p.key === " ") && me();
|
|
4810
4844
|
},
|
|
4811
4845
|
"aria-label": E(
|
|
4812
4846
|
"Click to upload images or drag and drop",
|
|
4813
4847
|
"a8c-agenttic"
|
|
4814
4848
|
),
|
|
4815
4849
|
children: [
|
|
4816
|
-
|
|
4850
|
+
De && /* @__PURE__ */ a("div", { className: ee.draggingMessage, children: /* @__PURE__ */ C("p", { children: [
|
|
4817
4851
|
/* @__PURE__ */ a("strong", { children: E(
|
|
4818
4852
|
"Drop files here to use",
|
|
4819
4853
|
"a8c-agenttic"
|
|
4820
4854
|
) }),
|
|
4821
4855
|
/* @__PURE__ */ a("br", {}),
|
|
4822
|
-
u &&
|
|
4856
|
+
u && Ee
|
|
4823
4857
|
] }) }),
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4858
|
+
te && /* @__PURE__ */ C("div", { className: ee.preview, children: [
|
|
4859
|
+
he && e.map((p) => /* @__PURE__ */ a(
|
|
4860
|
+
Eo,
|
|
4827
4861
|
{
|
|
4828
|
-
image:
|
|
4829
|
-
allowDragToInsert:
|
|
4862
|
+
image: p,
|
|
4863
|
+
allowDragToInsert: $,
|
|
4830
4864
|
showFileMetadata: N,
|
|
4831
|
-
onDragStart:
|
|
4832
|
-
onDragEnd:
|
|
4833
|
-
onRemove:
|
|
4865
|
+
onDragStart: Ve,
|
|
4866
|
+
onDragEnd: xe,
|
|
4867
|
+
onRemove: pe
|
|
4834
4868
|
},
|
|
4835
|
-
|
|
4869
|
+
p.id
|
|
4836
4870
|
)),
|
|
4837
|
-
|
|
4871
|
+
y && i.map(({ id: p }) => /* @__PURE__ */ a(
|
|
4838
4872
|
"div",
|
|
4839
4873
|
{
|
|
4840
4874
|
className: ee.previewItem,
|
|
4841
|
-
children:
|
|
4875
|
+
children: A || /* @__PURE__ */ a(
|
|
4842
4876
|
"div",
|
|
4843
4877
|
{
|
|
4844
4878
|
className: ee.uploadingIndicator,
|
|
@@ -4851,40 +4885,40 @@ const mo = "ImageUploader-module_container", po = "ImageUploader-module_active",
|
|
|
4851
4885
|
}
|
|
4852
4886
|
)
|
|
4853
4887
|
},
|
|
4854
|
-
|
|
4888
|
+
p
|
|
4855
4889
|
))
|
|
4856
4890
|
] })
|
|
4857
4891
|
]
|
|
4858
4892
|
}
|
|
4859
4893
|
)
|
|
4860
4894
|
] }),
|
|
4861
|
-
|
|
4895
|
+
V && /* @__PURE__ */ a("div", { className: ee.invalidMessage, children: /* @__PURE__ */ a("p", { children: Re }) })
|
|
4862
4896
|
] })
|
|
4863
4897
|
}
|
|
4864
4898
|
)
|
|
4865
4899
|
}
|
|
4866
4900
|
);
|
|
4867
|
-
}),
|
|
4868
|
-
container:
|
|
4869
|
-
line:
|
|
4870
|
-
message:
|
|
4901
|
+
}), Ro = "MessageDivider-module_container", Po = "MessageDivider-module_line", $o = "MessageDivider-module_message", ut = {
|
|
4902
|
+
container: Ro,
|
|
4903
|
+
line: Po,
|
|
4904
|
+
message: $o
|
|
4871
4905
|
};
|
|
4872
|
-
function
|
|
4873
|
-
return /* @__PURE__ */
|
|
4906
|
+
function Cc({ message: t = "" }) {
|
|
4907
|
+
return /* @__PURE__ */ C("div", { className: ut.container, children: [
|
|
4874
4908
|
/* @__PURE__ */ a("div", { className: ut.line }),
|
|
4875
|
-
t && /* @__PURE__ */
|
|
4909
|
+
t && /* @__PURE__ */ C(Ke, { children: [
|
|
4876
4910
|
/* @__PURE__ */ a("span", { className: ut.message, children: t }),
|
|
4877
4911
|
/* @__PURE__ */ a("div", { className: ut.line })
|
|
4878
4912
|
] })
|
|
4879
4913
|
] });
|
|
4880
4914
|
}
|
|
4881
|
-
const
|
|
4882
|
-
container:
|
|
4883
|
-
icon:
|
|
4884
|
-
heading:
|
|
4885
|
-
help:
|
|
4886
|
-
suggestionsWrapper:
|
|
4887
|
-
},
|
|
4915
|
+
const Fo = "EmptyView-module_container", jo = "EmptyView-module_icon", Uo = "EmptyView-module_heading", Bo = "EmptyView-module_help", Ho = "EmptyView-module_suggestionsWrapper", it = {
|
|
4916
|
+
container: Fo,
|
|
4917
|
+
icon: jo,
|
|
4918
|
+
heading: Uo,
|
|
4919
|
+
help: Bo,
|
|
4920
|
+
suggestionsWrapper: Ho
|
|
4921
|
+
}, _c = ({
|
|
4888
4922
|
suggestions: t,
|
|
4889
4923
|
onSuggestionClick: e,
|
|
4890
4924
|
icon: i = "✨",
|
|
@@ -4893,10 +4927,10 @@ const Po = "EmptyView-module_container", $o = "EmptyView-module_icon", Fo = "Emp
|
|
|
4893
4927
|
"a8c-agenttic"
|
|
4894
4928
|
),
|
|
4895
4929
|
help: o
|
|
4896
|
-
}) => /* @__PURE__ */
|
|
4897
|
-
/* @__PURE__ */ a("div", { className:
|
|
4898
|
-
/* @__PURE__ */ a("h2", { className:
|
|
4899
|
-
t && t.length > 0 && /* @__PURE__ */ a("div", { className:
|
|
4930
|
+
}) => /* @__PURE__ */ C("div", { className: it.container, children: [
|
|
4931
|
+
/* @__PURE__ */ a("div", { className: it.icon, children: i }),
|
|
4932
|
+
/* @__PURE__ */ a("h2", { className: it.heading, children: n }),
|
|
4933
|
+
t && t.length > 0 && /* @__PURE__ */ a("div", { className: it.suggestionsWrapper, children: /* @__PURE__ */ a(
|
|
4900
4934
|
vt,
|
|
4901
4935
|
{
|
|
4902
4936
|
suggestions: t,
|
|
@@ -4905,16 +4939,16 @@ const Po = "EmptyView-module_container", $o = "EmptyView-module_icon", Fo = "Emp
|
|
|
4905
4939
|
layout: "vertical"
|
|
4906
4940
|
}
|
|
4907
4941
|
) }),
|
|
4908
|
-
o && /* @__PURE__ */ a("p", { className:
|
|
4909
|
-
] }),
|
|
4910
|
-
container:
|
|
4911
|
-
imageButton:
|
|
4912
|
-
selected:
|
|
4913
|
-
disabled:
|
|
4914
|
-
image:
|
|
4915
|
-
header:
|
|
4942
|
+
o && /* @__PURE__ */ a("p", { className: it.help, children: o })
|
|
4943
|
+
] }), Vo = "ImageRenderer-module_container", Wo = "ImageRenderer-module_imageButton", zo = "ImageRenderer-module_selected", Go = "ImageRenderer-module_disabled", Zo = "ImageRenderer-module_image", Yo = "ImageRenderer-module_header", Ze = {
|
|
4944
|
+
container: Vo,
|
|
4945
|
+
imageButton: Wo,
|
|
4946
|
+
selected: zo,
|
|
4947
|
+
disabled: Go,
|
|
4948
|
+
image: Zo,
|
|
4949
|
+
header: Yo
|
|
4916
4950
|
};
|
|
4917
|
-
function
|
|
4951
|
+
function Ko({ className: t, size: e = 24 }) {
|
|
4918
4952
|
return /* @__PURE__ */ a(
|
|
4919
4953
|
"svg",
|
|
4920
4954
|
{
|
|
@@ -4935,31 +4969,31 @@ function Zo({ className: t, size: e = 24 }) {
|
|
|
4935
4969
|
}
|
|
4936
4970
|
);
|
|
4937
4971
|
}
|
|
4938
|
-
const
|
|
4972
|
+
const Tc = ({
|
|
4939
4973
|
images: t,
|
|
4940
4974
|
onSelect: e,
|
|
4941
4975
|
header: i,
|
|
4942
4976
|
disabled: n = !1
|
|
4943
4977
|
}) => {
|
|
4944
|
-
const [o, c] =
|
|
4978
|
+
const [o, c] = Y(null), r = O(null), s = (l) => {
|
|
4945
4979
|
c(l.url), e(l);
|
|
4946
4980
|
};
|
|
4947
|
-
return
|
|
4981
|
+
return L(() => {
|
|
4948
4982
|
if (n || !o)
|
|
4949
4983
|
return;
|
|
4950
4984
|
const l = (g) => {
|
|
4951
4985
|
r.current && !r.current.contains(g.target) && (c(null), e(null));
|
|
4952
4986
|
};
|
|
4953
4987
|
return window.addEventListener("click", l, !0), () => window.removeEventListener("click", l, !0);
|
|
4954
|
-
}, [e, n, o]), /* @__PURE__ */
|
|
4955
|
-
i || /* @__PURE__ */
|
|
4956
|
-
/* @__PURE__ */ a(
|
|
4988
|
+
}, [e, n, o]), /* @__PURE__ */ C(se.div, { children: [
|
|
4989
|
+
i || /* @__PURE__ */ C("div", { className: Ze.header, children: [
|
|
4990
|
+
/* @__PURE__ */ a(Ko, {}),
|
|
4957
4991
|
" Done"
|
|
4958
4992
|
] }),
|
|
4959
4993
|
/* @__PURE__ */ a("div", { className: Ze.container, ref: r, children: t.map((l) => /* @__PURE__ */ a(
|
|
4960
4994
|
"button",
|
|
4961
4995
|
{
|
|
4962
|
-
className:
|
|
4996
|
+
className: de(
|
|
4963
4997
|
Ze.imageButton,
|
|
4964
4998
|
!n && o === l.url ? Ze.selected : "",
|
|
4965
4999
|
n ? Ze.disabled : ""
|
|
@@ -4980,7 +5014,7 @@ const Cc = ({
|
|
|
4980
5014
|
)) })
|
|
4981
5015
|
] });
|
|
4982
5016
|
};
|
|
4983
|
-
function
|
|
5017
|
+
function Ic({ className: t, size: e = 24 }) {
|
|
4984
5018
|
return /* @__PURE__ */ a(
|
|
4985
5019
|
"svg",
|
|
4986
5020
|
{
|
|
@@ -5000,7 +5034,7 @@ function _c({ className: t, size: e = 24 }) {
|
|
|
5000
5034
|
}
|
|
5001
5035
|
);
|
|
5002
5036
|
}
|
|
5003
|
-
function
|
|
5037
|
+
function Sc({ className: t, size: e = 24 }) {
|
|
5004
5038
|
return /* @__PURE__ */ a(
|
|
5005
5039
|
"svg",
|
|
5006
5040
|
{
|
|
@@ -5021,7 +5055,7 @@ function Tc({ className: t, size: e = 24 }) {
|
|
|
5021
5055
|
}
|
|
5022
5056
|
);
|
|
5023
5057
|
}
|
|
5024
|
-
function
|
|
5058
|
+
function kc({ className: t, size: e = 24 }) {
|
|
5025
5059
|
return /* @__PURE__ */ a(
|
|
5026
5060
|
"svg",
|
|
5027
5061
|
{
|
|
@@ -5042,7 +5076,7 @@ function Ic({ className: t, size: e = 24 }) {
|
|
|
5042
5076
|
}
|
|
5043
5077
|
);
|
|
5044
5078
|
}
|
|
5045
|
-
function
|
|
5079
|
+
function Mc({ className: t, size: e = 24 }) {
|
|
5046
5080
|
return /* @__PURE__ */ a(
|
|
5047
5081
|
"svg",
|
|
5048
5082
|
{
|
|
@@ -5065,7 +5099,7 @@ function Sc({ className: t, size: e = 24 }) {
|
|
|
5065
5099
|
}
|
|
5066
5100
|
);
|
|
5067
5101
|
}
|
|
5068
|
-
function
|
|
5102
|
+
function Ac({ className: t, size: e = 24 }) {
|
|
5069
5103
|
return /* @__PURE__ */ a(
|
|
5070
5104
|
"svg",
|
|
5071
5105
|
{
|
|
@@ -5087,8 +5121,8 @@ function kc({ className: t, size: e = 24 }) {
|
|
|
5087
5121
|
}
|
|
5088
5122
|
);
|
|
5089
5123
|
}
|
|
5090
|
-
function
|
|
5091
|
-
return /* @__PURE__ */
|
|
5124
|
+
function Oc({ className: t, size: e = 24 }) {
|
|
5125
|
+
return /* @__PURE__ */ C(
|
|
5092
5126
|
"svg",
|
|
5093
5127
|
{
|
|
5094
5128
|
width: e,
|
|
@@ -5118,8 +5152,8 @@ function Mc({ className: t, size: e = 24 }) {
|
|
|
5118
5152
|
}
|
|
5119
5153
|
);
|
|
5120
5154
|
}
|
|
5121
|
-
function
|
|
5122
|
-
return /* @__PURE__ */
|
|
5155
|
+
function Lc({ className: t, size: e = 24 }) {
|
|
5156
|
+
return /* @__PURE__ */ C(
|
|
5123
5157
|
"svg",
|
|
5124
5158
|
{
|
|
5125
5159
|
width: e,
|
|
@@ -5148,7 +5182,7 @@ function Ac({ className: t, size: e = 24 }) {
|
|
|
5148
5182
|
}
|
|
5149
5183
|
);
|
|
5150
5184
|
}
|
|
5151
|
-
function
|
|
5185
|
+
function Nc({ className: t, size: e = 24 }) {
|
|
5152
5186
|
return /* @__PURE__ */ a(
|
|
5153
5187
|
"svg",
|
|
5154
5188
|
{
|
|
@@ -5169,8 +5203,8 @@ function Oc({ className: t, size: e = 24 }) {
|
|
|
5169
5203
|
}
|
|
5170
5204
|
);
|
|
5171
5205
|
}
|
|
5172
|
-
function
|
|
5173
|
-
return /* @__PURE__ */
|
|
5206
|
+
function xc({ className: t, size: e = 24 }) {
|
|
5207
|
+
return /* @__PURE__ */ C(
|
|
5174
5208
|
"svg",
|
|
5175
5209
|
{
|
|
5176
5210
|
width: e,
|
|
@@ -5201,7 +5235,7 @@ function Lc({ className: t, size: e = 24 }) {
|
|
|
5201
5235
|
}
|
|
5202
5236
|
);
|
|
5203
5237
|
}
|
|
5204
|
-
function
|
|
5238
|
+
function Dc({ className: t, size: e = 24 }) {
|
|
5205
5239
|
return /* @__PURE__ */ a(
|
|
5206
5240
|
"svg",
|
|
5207
5241
|
{
|
|
@@ -5222,17 +5256,17 @@ function Nc({ className: t, size: e = 24 }) {
|
|
|
5222
5256
|
}
|
|
5223
5257
|
);
|
|
5224
5258
|
}
|
|
5225
|
-
const
|
|
5259
|
+
const Jo = (t, e = "") => {
|
|
5226
5260
|
try {
|
|
5227
5261
|
return getComputedStyle(document.documentElement).getPropertyValue(t).trim() || e;
|
|
5228
5262
|
} catch (i) {
|
|
5229
5263
|
return console.warn(`Failed to get CSS variable ${t}:`, i), e;
|
|
5230
5264
|
}
|
|
5231
|
-
},
|
|
5265
|
+
}, rt = ({ message: t, details: e }) => /* @__PURE__ */ C("div", { className: "chart-error", children: [
|
|
5232
5266
|
/* @__PURE__ */ a("strong", { children: "Chart Error:" }),
|
|
5233
5267
|
" ",
|
|
5234
5268
|
t,
|
|
5235
|
-
e && /* @__PURE__ */
|
|
5269
|
+
e && /* @__PURE__ */ C("details", { children: [
|
|
5236
5270
|
/* @__PURE__ */ a("summary", { children: "Show Details" }),
|
|
5237
5271
|
/* @__PURE__ */ a("pre", { children: e })
|
|
5238
5272
|
] })
|
|
@@ -5240,8 +5274,8 @@ const Yo = (t, e = "") => {
|
|
|
5240
5274
|
children: t,
|
|
5241
5275
|
error: e
|
|
5242
5276
|
}) => {
|
|
5243
|
-
const i =
|
|
5244
|
-
const o = [
|
|
5277
|
+
const i = ot(() => {
|
|
5278
|
+
const o = [Jo("--color-primary", "#4F46E5"), "#f0b849", "#00a32a", "#8c5e94"];
|
|
5245
5279
|
return {
|
|
5246
5280
|
...$n,
|
|
5247
5281
|
colors: o,
|
|
@@ -5259,7 +5293,7 @@ const Yo = (t, e = "") => {
|
|
|
5259
5293
|
legendGlyphSize: 12
|
|
5260
5294
|
};
|
|
5261
5295
|
}, []);
|
|
5262
|
-
return e ? /* @__PURE__ */ a(
|
|
5296
|
+
return e ? /* @__PURE__ */ a(rt, { message: e.message, details: e.details }) : /* @__PURE__ */ a("div", { className: "chart-block", children: /* @__PURE__ */ a("div", { className: "chart-container", children: /* @__PURE__ */ a(Fn, { theme: i, children: t }) }) });
|
|
5263
5297
|
}, Mt = (t = 80, e = 6, i = 25, n) => Math.max(t, (n ?? 5) * e + i), Zt = (t) => {
|
|
5264
5298
|
if (t instanceof Date)
|
|
5265
5299
|
return t;
|
|
@@ -5316,7 +5350,7 @@ const Yo = (t, e = "") => {
|
|
|
5316
5350
|
},
|
|
5317
5351
|
...t,
|
|
5318
5352
|
bottom: Mt(120)
|
|
5319
|
-
}),
|
|
5353
|
+
}), qo = (t) => {
|
|
5320
5354
|
const {
|
|
5321
5355
|
data: e,
|
|
5322
5356
|
currency: i,
|
|
@@ -5329,21 +5363,21 @@ const Yo = (t, e = "") => {
|
|
|
5329
5363
|
maxLabelLength: g = 15,
|
|
5330
5364
|
error: d,
|
|
5331
5365
|
...u
|
|
5332
|
-
} = t, h = (
|
|
5366
|
+
} = t, h = (T, M) => !l || T.length <= M ? T : T.substring(0, M - 3) + "...", A = () => {
|
|
5333
5367
|
if (s === "item-comparison" && e && e.length > 0) {
|
|
5334
|
-
let
|
|
5335
|
-
return e.forEach((
|
|
5336
|
-
|
|
5337
|
-
const
|
|
5338
|
-
|
|
5368
|
+
let T = "";
|
|
5369
|
+
return e.forEach((M) => {
|
|
5370
|
+
M != null && M.data && M.data.forEach((D) => {
|
|
5371
|
+
const _ = D.label || "", j = h(_, g);
|
|
5372
|
+
j.length > T.length && (T = j);
|
|
5339
5373
|
});
|
|
5340
|
-
}), Mt(80, 6, 25,
|
|
5374
|
+
}), Mt(80, 6, 25, T.length);
|
|
5341
5375
|
}
|
|
5342
5376
|
return Mt();
|
|
5343
5377
|
}, x = {
|
|
5344
5378
|
...yn(r),
|
|
5345
|
-
bottom:
|
|
5346
|
-
},
|
|
5379
|
+
bottom: A()
|
|
5380
|
+
}, $ = s === "item-comparison" ? {
|
|
5347
5381
|
xScale: {
|
|
5348
5382
|
type: "band",
|
|
5349
5383
|
padding: 0.2
|
|
@@ -5351,7 +5385,7 @@ const Yo = (t, e = "") => {
|
|
|
5351
5385
|
axis: {
|
|
5352
5386
|
x: {
|
|
5353
5387
|
orientation: "bottom",
|
|
5354
|
-
tickFormat: (
|
|
5388
|
+
tickFormat: (T) => h(T, g),
|
|
5355
5389
|
tickLabelProps: {
|
|
5356
5390
|
fontSize: 11,
|
|
5357
5391
|
textAnchor: "end",
|
|
@@ -5369,7 +5403,7 @@ const Yo = (t, e = "") => {
|
|
|
5369
5403
|
dy: -15
|
|
5370
5404
|
}
|
|
5371
5405
|
}
|
|
5372
|
-
},
|
|
5406
|
+
}, f = {
|
|
5373
5407
|
data: e,
|
|
5374
5408
|
withTooltips: o,
|
|
5375
5409
|
renderTooltip: c,
|
|
@@ -5381,13 +5415,13 @@ const Yo = (t, e = "") => {
|
|
|
5381
5415
|
// TODO: Fix this inconsistency that seems to be in @automattic/charts
|
|
5382
5416
|
// Item-comparison mode requires axis config wrapped in 'options' prop
|
|
5383
5417
|
// Time-comparison mode requires axis config spread directly
|
|
5384
|
-
...s === "item-comparison" ? { options:
|
|
5418
|
+
...s === "item-comparison" ? { options: $ } : $,
|
|
5385
5419
|
...i && { currency: i },
|
|
5386
5420
|
...u
|
|
5387
5421
|
};
|
|
5388
|
-
return /* @__PURE__ */ a(fn, { error: d, children: /* @__PURE__ */ a(jn, { ...
|
|
5422
|
+
return /* @__PURE__ */ a(fn, { error: d, children: /* @__PURE__ */ a(jn, { ...f }) });
|
|
5389
5423
|
};
|
|
5390
|
-
class
|
|
5424
|
+
class Xo extends Dn {
|
|
5391
5425
|
constructor(e) {
|
|
5392
5426
|
super(e), this.state = {
|
|
5393
5427
|
hasError: !1,
|
|
@@ -5424,7 +5458,7 @@ class Jo extends Dn {
|
|
|
5424
5458
|
if (this.state.hasError) {
|
|
5425
5459
|
const i = ((e = this.state.error) == null ? void 0 : e.message) || "An error occurred while rendering the chart";
|
|
5426
5460
|
return /* @__PURE__ */ a(
|
|
5427
|
-
|
|
5461
|
+
rt,
|
|
5428
5462
|
{
|
|
5429
5463
|
message: i,
|
|
5430
5464
|
details: [
|
|
@@ -5438,7 +5472,7 @@ class Jo extends Dn {
|
|
|
5438
5472
|
return this.props.children;
|
|
5439
5473
|
}
|
|
5440
5474
|
}
|
|
5441
|
-
const
|
|
5475
|
+
const Qo = (t) => {
|
|
5442
5476
|
const {
|
|
5443
5477
|
data: e,
|
|
5444
5478
|
currency: i,
|
|
@@ -5477,52 +5511,52 @@ const qo = (t) => {
|
|
|
5477
5511
|
...g
|
|
5478
5512
|
};
|
|
5479
5513
|
return /* @__PURE__ */ a(fn, { error: l, children: /* @__PURE__ */ a(Un, { ...u }) });
|
|
5480
|
-
},
|
|
5514
|
+
}, ec = ({
|
|
5481
5515
|
data: t,
|
|
5482
5516
|
className: e = "",
|
|
5483
5517
|
config: i
|
|
5484
5518
|
}) => {
|
|
5485
|
-
const [n, o] =
|
|
5519
|
+
const [n, o] = Y(null), [c, r] = Y(
|
|
5486
5520
|
null
|
|
5487
|
-
), [s, l] =
|
|
5488
|
-
(
|
|
5489
|
-
var
|
|
5490
|
-
const { tooltipData:
|
|
5491
|
-
if (!
|
|
5521
|
+
), [s, l] = Y(300), g = O(null), d = w(
|
|
5522
|
+
(f) => {
|
|
5523
|
+
var H;
|
|
5524
|
+
const { tooltipData: T } = f, M = (H = T == null ? void 0 : T.nearestDatum) == null ? void 0 : H.datum;
|
|
5525
|
+
if (!M)
|
|
5492
5526
|
return null;
|
|
5493
|
-
const D = (
|
|
5527
|
+
const D = (I) => {
|
|
5494
5528
|
if (c != null && c.currency) {
|
|
5495
|
-
const { symbol:
|
|
5496
|
-
let
|
|
5497
|
-
return
|
|
5529
|
+
const { symbol: V, symbolPosition: m } = c.currency;
|
|
5530
|
+
let z;
|
|
5531
|
+
return I >= 1e6 ? z = `${(I / 1e6).toFixed(
|
|
5498
5532
|
1
|
|
5499
|
-
)}M` :
|
|
5533
|
+
)}M` : I >= 1e3 ? z = `${(I / 1e3).toFixed(1)}K` : z = I.toLocaleString(), m === "right" ? `${z}${V}` : `${V}${z}`;
|
|
5500
5534
|
}
|
|
5501
|
-
return
|
|
5502
|
-
},
|
|
5503
|
-
const
|
|
5504
|
-
((/* @__PURE__ */ new Date()).getTime() -
|
|
5535
|
+
return I >= 1e6 ? `${(I / 1e6).toFixed(1)}M` : I >= 1e3 ? `${(I / 1e3).toFixed(1)}K` : I.toLocaleString();
|
|
5536
|
+
}, _ = (I) => {
|
|
5537
|
+
const m = Math.floor(
|
|
5538
|
+
((/* @__PURE__ */ new Date()).getTime() - I.getTime()) / (1e3 * 60 * 60 * 24)
|
|
5505
5539
|
);
|
|
5506
|
-
return
|
|
5540
|
+
return m === 0 ? E("Today", "a8c-agenttic") : m === 1 ? E("Yesterday", "a8c-agenttic") : m < 7 ? je(
|
|
5507
5541
|
/* translators: %d: number of days */
|
|
5508
5542
|
E("%d days ago", "a8c-agenttic"),
|
|
5509
|
-
|
|
5510
|
-
) :
|
|
5543
|
+
m
|
|
5544
|
+
) : I.toLocaleDateString("en-US", {
|
|
5511
5545
|
year: "numeric",
|
|
5512
5546
|
month: "short",
|
|
5513
5547
|
day: "numeric"
|
|
5514
5548
|
});
|
|
5515
|
-
},
|
|
5516
|
-
(
|
|
5517
|
-
).map(([
|
|
5518
|
-
const
|
|
5549
|
+
}, j = M.label, K = Object.entries(
|
|
5550
|
+
(T == null ? void 0 : T.datumByKey) || {}
|
|
5551
|
+
).map(([I, V]) => {
|
|
5552
|
+
const m = V.datum;
|
|
5519
5553
|
return {
|
|
5520
|
-
key:
|
|
5521
|
-
value:
|
|
5554
|
+
key: I,
|
|
5555
|
+
value: m.value
|
|
5522
5556
|
};
|
|
5523
|
-
}).sort((
|
|
5524
|
-
return /* @__PURE__ */
|
|
5525
|
-
|
|
5557
|
+
}).sort((I, V) => V.value - I.value);
|
|
5558
|
+
return /* @__PURE__ */ C("div", { children: [
|
|
5559
|
+
j && /* @__PURE__ */ a(
|
|
5526
5560
|
"div",
|
|
5527
5561
|
{
|
|
5528
5562
|
style: {
|
|
@@ -5533,10 +5567,10 @@ const qo = (t) => {
|
|
|
5533
5567
|
borderBottom: "1px solid #eee",
|
|
5534
5568
|
paddingBottom: "2px"
|
|
5535
5569
|
},
|
|
5536
|
-
children:
|
|
5570
|
+
children: j
|
|
5537
5571
|
}
|
|
5538
5572
|
),
|
|
5539
|
-
|
|
5573
|
+
M.date && /* @__PURE__ */ a(
|
|
5540
5574
|
"div",
|
|
5541
5575
|
{
|
|
5542
5576
|
style: {
|
|
@@ -5544,29 +5578,29 @@ const qo = (t) => {
|
|
|
5544
5578
|
opacity: 0.8,
|
|
5545
5579
|
marginBottom: "4px"
|
|
5546
5580
|
},
|
|
5547
|
-
children:
|
|
5581
|
+
children: _(M.date)
|
|
5548
5582
|
}
|
|
5549
5583
|
),
|
|
5550
|
-
|
|
5584
|
+
K.map((I) => /* @__PURE__ */ C(
|
|
5551
5585
|
"div",
|
|
5552
5586
|
{
|
|
5553
5587
|
style: { marginBottom: "2px" },
|
|
5554
5588
|
children: [
|
|
5555
|
-
/* @__PURE__ */
|
|
5556
|
-
|
|
5589
|
+
/* @__PURE__ */ C("strong", { children: [
|
|
5590
|
+
I.key,
|
|
5557
5591
|
":"
|
|
5558
5592
|
] }),
|
|
5559
5593
|
" ",
|
|
5560
|
-
D(
|
|
5594
|
+
D(I.value)
|
|
5561
5595
|
]
|
|
5562
5596
|
},
|
|
5563
|
-
|
|
5597
|
+
I.key
|
|
5564
5598
|
))
|
|
5565
5599
|
] });
|
|
5566
5600
|
},
|
|
5567
5601
|
[c == null ? void 0 : c.currency]
|
|
5568
5602
|
);
|
|
5569
|
-
|
|
5603
|
+
L(() => {
|
|
5570
5604
|
if (o(null), r(null), !t || typeof t != "string") {
|
|
5571
5605
|
o({
|
|
5572
5606
|
message: E("Invalid chart data provided", "a8c-agenttic"),
|
|
@@ -5575,8 +5609,8 @@ const qo = (t) => {
|
|
|
5575
5609
|
return;
|
|
5576
5610
|
}
|
|
5577
5611
|
try {
|
|
5578
|
-
const
|
|
5579
|
-
if (!
|
|
5612
|
+
const f = JSON.parse(t.trim());
|
|
5613
|
+
if (!f.chartType) {
|
|
5580
5614
|
o({
|
|
5581
5615
|
message: E(
|
|
5582
5616
|
"Chart data must include chartType",
|
|
@@ -5586,7 +5620,7 @@ const qo = (t) => {
|
|
|
5586
5620
|
});
|
|
5587
5621
|
return;
|
|
5588
5622
|
}
|
|
5589
|
-
if (!
|
|
5623
|
+
if (!f.data || !Array.isArray(f.data)) {
|
|
5590
5624
|
o({
|
|
5591
5625
|
message: E(
|
|
5592
5626
|
"Chart data must include a data array",
|
|
@@ -5596,7 +5630,7 @@ const qo = (t) => {
|
|
|
5596
5630
|
});
|
|
5597
5631
|
return;
|
|
5598
5632
|
}
|
|
5599
|
-
if (
|
|
5633
|
+
if (f.data.length === 0) {
|
|
5600
5634
|
o({
|
|
5601
5635
|
message: E(
|
|
5602
5636
|
"No data points found for chart",
|
|
@@ -5606,37 +5640,37 @@ const qo = (t) => {
|
|
|
5606
5640
|
});
|
|
5607
5641
|
return;
|
|
5608
5642
|
}
|
|
5609
|
-
const
|
|
5643
|
+
const T = f.data.map((D) => ({
|
|
5610
5644
|
...D,
|
|
5611
|
-
data: D.data.map((
|
|
5612
|
-
if (
|
|
5613
|
-
const
|
|
5614
|
-
return isNaN(
|
|
5615
|
-
`Invalid date string: "${
|
|
5645
|
+
data: D.data.map((_) => {
|
|
5646
|
+
if (_.date) {
|
|
5647
|
+
const j = new Date(_.date);
|
|
5648
|
+
return isNaN(j.getTime()) ? (console.warn(
|
|
5649
|
+
`Invalid date string: "${_.date}" in series "${D.label}"`
|
|
5616
5650
|
), {
|
|
5617
|
-
label:
|
|
5618
|
-
value:
|
|
5651
|
+
label: _.label,
|
|
5652
|
+
value: _.value,
|
|
5619
5653
|
date: void 0
|
|
5620
5654
|
}) : {
|
|
5621
|
-
label:
|
|
5622
|
-
value:
|
|
5623
|
-
date:
|
|
5655
|
+
label: _.label,
|
|
5656
|
+
value: _.value,
|
|
5657
|
+
date: j
|
|
5624
5658
|
};
|
|
5625
5659
|
}
|
|
5626
5660
|
return {
|
|
5627
|
-
label:
|
|
5628
|
-
value:
|
|
5661
|
+
label: _.label,
|
|
5662
|
+
value: _.value,
|
|
5629
5663
|
date: void 0
|
|
5630
5664
|
};
|
|
5631
5665
|
})
|
|
5632
|
-
})),
|
|
5633
|
-
chartType:
|
|
5634
|
-
title:
|
|
5635
|
-
data:
|
|
5636
|
-
currency:
|
|
5637
|
-
mode:
|
|
5666
|
+
})), M = {
|
|
5667
|
+
chartType: f.chartType,
|
|
5668
|
+
title: f.title,
|
|
5669
|
+
data: T,
|
|
5670
|
+
currency: f.currency,
|
|
5671
|
+
mode: f.mode || "time-comparison"
|
|
5638
5672
|
};
|
|
5639
|
-
r(
|
|
5673
|
+
r(M);
|
|
5640
5674
|
} catch {
|
|
5641
5675
|
o({
|
|
5642
5676
|
message: E(
|
|
@@ -5647,48 +5681,48 @@ const qo = (t) => {
|
|
|
5647
5681
|
});
|
|
5648
5682
|
}
|
|
5649
5683
|
}, [t]);
|
|
5650
|
-
const u =
|
|
5651
|
-
if (g.current && g.current.disconnect(),
|
|
5652
|
-
const { width:
|
|
5653
|
-
l(
|
|
5654
|
-
for (const
|
|
5655
|
-
const
|
|
5684
|
+
const u = w((f) => {
|
|
5685
|
+
if (g.current && g.current.disconnect(), f) {
|
|
5686
|
+
const { width: T } = f.getBoundingClientRect(), M = Math.max(280, T - 4);
|
|
5687
|
+
l(M), g.current = new ResizeObserver((D) => {
|
|
5688
|
+
for (const _ of D) {
|
|
5689
|
+
const j = _.contentRect.width, K = Math.max(
|
|
5656
5690
|
280,
|
|
5657
|
-
|
|
5691
|
+
j - 4
|
|
5658
5692
|
);
|
|
5659
|
-
l(
|
|
5693
|
+
l(K);
|
|
5660
5694
|
}
|
|
5661
|
-
}), g.current.observe(
|
|
5695
|
+
}), g.current.observe(f);
|
|
5662
5696
|
}
|
|
5663
5697
|
}, []);
|
|
5664
|
-
if (
|
|
5698
|
+
if (L(() => () => {
|
|
5665
5699
|
g.current && (g.current.disconnect(), g.current = null);
|
|
5666
5700
|
}, []), n)
|
|
5667
|
-
return /* @__PURE__ */ a(
|
|
5701
|
+
return /* @__PURE__ */ a(rt, { message: n.message, details: n.details });
|
|
5668
5702
|
if (!c)
|
|
5669
5703
|
return /* @__PURE__ */ a(
|
|
5670
|
-
|
|
5704
|
+
rt,
|
|
5671
5705
|
{
|
|
5672
5706
|
message: E("No chart data available", "a8c-agenttic")
|
|
5673
5707
|
}
|
|
5674
5708
|
);
|
|
5675
|
-
const
|
|
5709
|
+
const A = c.data.length > 1, x = s, N = {
|
|
5676
5710
|
data: c.data,
|
|
5677
5711
|
currency: c.currency,
|
|
5678
|
-
showLegend:
|
|
5712
|
+
showLegend: A,
|
|
5679
5713
|
withTooltips: !0,
|
|
5680
5714
|
renderTooltip: d,
|
|
5681
5715
|
error: null,
|
|
5682
5716
|
maxWidth: x,
|
|
5683
5717
|
aspectRatio: 1.2,
|
|
5684
5718
|
resizeDebounceTime: 300
|
|
5685
|
-
},
|
|
5719
|
+
}, $ = () => {
|
|
5686
5720
|
switch (c.chartType) {
|
|
5687
5721
|
case "line":
|
|
5688
|
-
return /* @__PURE__ */ a(
|
|
5722
|
+
return /* @__PURE__ */ a(Qo, { ...N });
|
|
5689
5723
|
case "bar":
|
|
5690
5724
|
return /* @__PURE__ */ a(
|
|
5691
|
-
|
|
5725
|
+
qo,
|
|
5692
5726
|
{
|
|
5693
5727
|
...N,
|
|
5694
5728
|
mode: c.mode
|
|
@@ -5696,9 +5730,9 @@ const qo = (t) => {
|
|
|
5696
5730
|
);
|
|
5697
5731
|
default:
|
|
5698
5732
|
return /* @__PURE__ */ a(
|
|
5699
|
-
|
|
5733
|
+
rt,
|
|
5700
5734
|
{
|
|
5701
|
-
message:
|
|
5735
|
+
message: je(
|
|
5702
5736
|
/* translators: %s: chart type name */
|
|
5703
5737
|
E("Unsupported chart type: %s", "a8c-agenttic"),
|
|
5704
5738
|
c.chartType
|
|
@@ -5707,48 +5741,48 @@ const qo = (t) => {
|
|
|
5707
5741
|
);
|
|
5708
5742
|
}
|
|
5709
5743
|
};
|
|
5710
|
-
return /* @__PURE__ */ a(
|
|
5744
|
+
return /* @__PURE__ */ a(Xo, { chartData: t, children: /* @__PURE__ */ C(
|
|
5711
5745
|
"div",
|
|
5712
5746
|
{
|
|
5713
5747
|
ref: u,
|
|
5714
5748
|
className: `chart-block ${e}`,
|
|
5715
5749
|
children: [
|
|
5716
5750
|
c.title && /* @__PURE__ */ a("h3", { className: "chart-block-title", children: c.title }),
|
|
5717
|
-
/* @__PURE__ */ a("div", { className: "chart-container", children:
|
|
5751
|
+
/* @__PURE__ */ a("div", { className: "chart-container", children: $() })
|
|
5718
5752
|
]
|
|
5719
5753
|
}
|
|
5720
5754
|
) });
|
|
5721
5755
|
};
|
|
5722
|
-
function
|
|
5756
|
+
function tc(t) {
|
|
5723
5757
|
return function(i) {
|
|
5724
5758
|
const { children: n, className: o, ...c } = i;
|
|
5725
5759
|
if (!(o == null ? void 0 : o.includes("language-chart")))
|
|
5726
|
-
return
|
|
5760
|
+
return ne.createElement(
|
|
5727
5761
|
"code",
|
|
5728
5762
|
{ className: o, ...c },
|
|
5729
5763
|
n
|
|
5730
5764
|
);
|
|
5731
5765
|
const s = typeof n == "string" ? n : "";
|
|
5732
|
-
return
|
|
5766
|
+
return ne.createElement(ec, {
|
|
5733
5767
|
data: s,
|
|
5734
5768
|
className: "markdown-chart",
|
|
5735
5769
|
config: t
|
|
5736
5770
|
});
|
|
5737
5771
|
};
|
|
5738
5772
|
}
|
|
5739
|
-
function
|
|
5773
|
+
function ac(t) {
|
|
5740
5774
|
var n, o;
|
|
5741
5775
|
const e = {}, i = [];
|
|
5742
|
-
return (n = t == null ? void 0 : t.charts) != null && n.enabled && (e.code =
|
|
5776
|
+
return (n = t == null ? void 0 : t.charts) != null && n.enabled && (e.code = tc(t.charts.config)), (o = t == null ? void 0 : t.gfm) != null && o.enabled && i.push(Pn), { components: e, remarkPlugins: i };
|
|
5743
5777
|
}
|
|
5744
|
-
function
|
|
5778
|
+
function nc(t, e = {}) {
|
|
5745
5779
|
return {
|
|
5746
5780
|
...t,
|
|
5747
5781
|
...e
|
|
5748
5782
|
};
|
|
5749
5783
|
}
|
|
5750
5784
|
let gt = null, mt = null;
|
|
5751
|
-
async function
|
|
5785
|
+
async function ic() {
|
|
5752
5786
|
return gt || mt || (mt = Promise.all([
|
|
5753
5787
|
import("./parseIncompleteMarkdown-Di9Hun9H.js"),
|
|
5754
5788
|
import("./parseBlocks-CiOUXvxi.js")
|
|
@@ -5757,20 +5791,20 @@ async function ac() {
|
|
|
5757
5791
|
parseMarkdownIntoBlocks: e.parseMarkdownIntoBlocks
|
|
5758
5792
|
}, gt)), mt);
|
|
5759
5793
|
}
|
|
5760
|
-
function
|
|
5794
|
+
function Ec(t = {}) {
|
|
5761
5795
|
const {
|
|
5762
5796
|
components: e = {},
|
|
5763
5797
|
extensions: i = {},
|
|
5764
5798
|
remarkPlugins: n = [],
|
|
5765
5799
|
enableStreaming: o = !1
|
|
5766
|
-
} = t, c =
|
|
5800
|
+
} = t, c = ac(i), r = nc(
|
|
5767
5801
|
c.components,
|
|
5768
5802
|
e
|
|
5769
5803
|
), s = [...c.remarkPlugins, ...n];
|
|
5770
5804
|
return function({ children: g }) {
|
|
5771
|
-
const [d, u] =
|
|
5772
|
-
return
|
|
5773
|
-
o ?
|
|
5805
|
+
const [d, u] = ne.useState(g);
|
|
5806
|
+
return ne.useEffect(() => {
|
|
5807
|
+
o ? ic().then(async (h) => {
|
|
5774
5808
|
const x = (await h.parseMarkdownIntoBlocks(g)).map((N) => h.parseIncompleteMarkdown(
|
|
5775
5809
|
N.trim()
|
|
5776
5810
|
)).join(`
|
|
@@ -5790,7 +5824,7 @@ function xc(t = {}) {
|
|
|
5790
5824
|
);
|
|
5791
5825
|
};
|
|
5792
5826
|
}
|
|
5793
|
-
const
|
|
5827
|
+
const Rc = (t) => {
|
|
5794
5828
|
const e = t.condition || (() => !0), i = {}, n = [], o = () => {
|
|
5795
5829
|
n.forEach((r) => r());
|
|
5796
5830
|
}, c = async (r, s) => {
|
|
@@ -5843,64 +5877,64 @@ const Dc = (t) => {
|
|
|
5843
5877
|
};
|
|
5844
5878
|
};
|
|
5845
5879
|
export {
|
|
5846
|
-
|
|
5880
|
+
yc as AgentUI,
|
|
5847
5881
|
on as AgentUIContainer,
|
|
5848
5882
|
xt as AgentUIConversationView,
|
|
5849
5883
|
hn as AgentUIFooter,
|
|
5850
5884
|
St as AgentUIHeader,
|
|
5851
5885
|
un as AgentUIInput,
|
|
5852
|
-
|
|
5886
|
+
go as AgentUIInputToolbar,
|
|
5853
5887
|
dn as AgentUIMessages,
|
|
5854
5888
|
pn as AgentUINotice,
|
|
5855
5889
|
Vt as AgentUIProvider,
|
|
5856
5890
|
gn as AgentUISuggestions,
|
|
5857
|
-
|
|
5891
|
+
xc as AltIcon,
|
|
5858
5892
|
Ji as AnimatedPlaceholder,
|
|
5859
5893
|
Bi as ArrowUpIcon,
|
|
5860
|
-
|
|
5861
|
-
|
|
5894
|
+
Ar as AssistantAvatarIcon,
|
|
5895
|
+
qo as BarChart,
|
|
5862
5896
|
Lt as BigSkyIcon,
|
|
5863
|
-
|
|
5864
|
-
|
|
5865
|
-
|
|
5866
|
-
|
|
5897
|
+
Dc as BlurIcon,
|
|
5898
|
+
ec as ChartBlock,
|
|
5899
|
+
bc as Chat,
|
|
5900
|
+
po as ChatFooter,
|
|
5867
5901
|
sn as ChatHeader,
|
|
5868
5902
|
Nt as ChatInput,
|
|
5869
5903
|
an as ChevronUpIcon,
|
|
5870
5904
|
en as CollapsedView,
|
|
5871
5905
|
nn as CompactView,
|
|
5872
5906
|
Gt as ConversationView,
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5878
|
-
|
|
5907
|
+
kc as CopyIcon,
|
|
5908
|
+
_c as EmptyView,
|
|
5909
|
+
Tc as ImageRenderer,
|
|
5910
|
+
wc as ImageUploader,
|
|
5911
|
+
Qo as LineChart,
|
|
5912
|
+
$r as Message,
|
|
5879
5913
|
zt as MessageActions,
|
|
5880
|
-
|
|
5914
|
+
Cc as MessageDivider,
|
|
5881
5915
|
ln as Messages,
|
|
5882
5916
|
rn as MinimizedView,
|
|
5883
5917
|
mn as Notice,
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5918
|
+
zr as PlusIcon,
|
|
5919
|
+
Fc as QuestionCard,
|
|
5920
|
+
Nc as RegenerateAltIcon,
|
|
5921
|
+
Lc as RegenerateIcon,
|
|
5888
5922
|
Hi as StopIcon,
|
|
5889
|
-
|
|
5923
|
+
Mc as StylesIcon,
|
|
5890
5924
|
vt as Suggestions,
|
|
5891
|
-
|
|
5892
|
-
|
|
5893
|
-
|
|
5925
|
+
Vr as ThinkingMessage,
|
|
5926
|
+
Sc as ThumbsDownIcon,
|
|
5927
|
+
Ic as ThumbsUpIcon,
|
|
5894
5928
|
cn as XIcon,
|
|
5895
|
-
|
|
5896
|
-
|
|
5897
|
-
|
|
5898
|
-
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
|
|
5929
|
+
Ac as ZoomIcon,
|
|
5930
|
+
Oc as ZoomIconFilled,
|
|
5931
|
+
vc as animations,
|
|
5932
|
+
de as cn,
|
|
5933
|
+
Rc as createFeedbackActions,
|
|
5934
|
+
Ec as createMessageRenderer,
|
|
5935
|
+
yc as default,
|
|
5902
5936
|
_i as loadAgentticTranslations,
|
|
5903
|
-
|
|
5937
|
+
Ne as useAgentUIContext,
|
|
5904
5938
|
Za as useChat,
|
|
5905
5939
|
Ya as useInput
|
|
5906
5940
|
};
|