@automattic/agenttic-ui 0.1.75 → 0.1.76
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/DiffCard-eat_q_SY.js +1305 -0
- package/dist/DiffCard.css +1 -1
- package/dist/components/EmbeddedAgentUI.d.ts +2 -1
- package/dist/components/EmbeddedAgentUI.d.ts.map +1 -1
- package/dist/components/chat/ChatFooter.d.ts +2 -1
- package/dist/components/chat/ChatFooter.d.ts.map +1 -1
- package/dist/components/composable/AgentUIFooter.d.ts +6 -1
- package/dist/components/composable/AgentUIFooter.d.ts.map +1 -1
- package/dist/components/composable/AgentUIFooter.test.d.ts +2 -0
- package/dist/components/composable/AgentUIFooter.test.d.ts.map +1 -0
- package/dist/embedded-agent-ui.js +124 -120
- package/dist/global.css +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +2330 -3319
- package/dist/markdown-extensions/charts/index.d.ts +15 -15
- package/dist/utils/constants.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/DiffCard-CVeqjQhl.js +0 -242
|
@@ -0,0 +1,1305 @@
|
|
|
1
|
+
import { jsx as e, jsxs as h, Fragment as X } from "react/jsx-runtime";
|
|
2
|
+
import { __ as w } from "@wordpress/i18n";
|
|
3
|
+
import * as at from "react";
|
|
4
|
+
import L, { createContext as mt, useContext as ht, useState as pt, useEffect as z, useId as ft, useCallback as tt, useRef as gt, useMemo as it } from "react";
|
|
5
|
+
import { AnimatePresence as st, motion as M } from "framer-motion";
|
|
6
|
+
import { Slot as bt } from "@radix-ui/react-slot";
|
|
7
|
+
import * as W from "@radix-ui/react-popover";
|
|
8
|
+
import Ct from "react-markdown";
|
|
9
|
+
import './DiffCard.css';function v(...t) {
|
|
10
|
+
return t.flat().filter(Boolean).map((n) => typeof n == "string" ? n : typeof n == "object" && !Array.isArray(n) && n !== null ? Object.entries(n).filter(([o, a]) => a).map(([o]) => o).join(" ") : "").join(" ").trim();
|
|
11
|
+
}
|
|
12
|
+
const Y = {
|
|
13
|
+
type: "spring",
|
|
14
|
+
stiffness: 300,
|
|
15
|
+
damping: 30
|
|
16
|
+
}, U = {
|
|
17
|
+
type: "spring",
|
|
18
|
+
damping: 40,
|
|
19
|
+
stiffness: 500,
|
|
20
|
+
mass: 0.8
|
|
21
|
+
}, Q = {
|
|
22
|
+
...U,
|
|
23
|
+
stiffness: 1e3,
|
|
24
|
+
damping: 90
|
|
25
|
+
}, vt = {
|
|
26
|
+
type: "spring",
|
|
27
|
+
damping: 40,
|
|
28
|
+
stiffness: 500,
|
|
29
|
+
mass: 0.8
|
|
30
|
+
}, wt = {
|
|
31
|
+
hidden: {
|
|
32
|
+
opacity: 0
|
|
33
|
+
},
|
|
34
|
+
visible: {
|
|
35
|
+
opacity: 1,
|
|
36
|
+
transition: Y
|
|
37
|
+
},
|
|
38
|
+
exit: {
|
|
39
|
+
opacity: 0,
|
|
40
|
+
transition: { ...Y, duration: 0.1 }
|
|
41
|
+
}
|
|
42
|
+
}, yt = () => {
|
|
43
|
+
if (typeof window > "u")
|
|
44
|
+
return { left: 0, right: 0, top: 0, bottom: 0 };
|
|
45
|
+
const t = 20;
|
|
46
|
+
return {
|
|
47
|
+
left: t,
|
|
48
|
+
right: window.innerWidth - 400 - t,
|
|
49
|
+
// Assuming max width of 400px
|
|
50
|
+
top: t,
|
|
51
|
+
bottom: window.innerHeight - 60 - t
|
|
52
|
+
// Assuming collapsed height of 60px
|
|
53
|
+
};
|
|
54
|
+
}, _t = {
|
|
55
|
+
"0%": { backgroundPosition: "-200% 0" },
|
|
56
|
+
"100%": { backgroundPosition: "200% 0" }
|
|
57
|
+
}, bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
58
|
+
__proto__: null,
|
|
59
|
+
fadeVariants: wt,
|
|
60
|
+
fastSpring: U,
|
|
61
|
+
fastSpringWithDelay: Q,
|
|
62
|
+
getDragConstraints: yt,
|
|
63
|
+
morphSpring: vt,
|
|
64
|
+
springConfig: Y,
|
|
65
|
+
thinkingGradientKeyframes: _t
|
|
66
|
+
}, Symbol.toStringTag, { value: "Module" })), lt = mt(null);
|
|
67
|
+
function T() {
|
|
68
|
+
const t = ht(lt);
|
|
69
|
+
if (!t)
|
|
70
|
+
throw new Error(
|
|
71
|
+
"useAgentUIContext must be used within an AgentUIContainer"
|
|
72
|
+
);
|
|
73
|
+
return t;
|
|
74
|
+
}
|
|
75
|
+
function Cn({ children: t, value: n }) {
|
|
76
|
+
return /* @__PURE__ */ e(lt.Provider, { value: n, children: t });
|
|
77
|
+
}
|
|
78
|
+
const Nt = "button-module_button", xt = "button-module_pressed", St = "button-module_primary", It = "button-module_ghost", $t = "button-module_outline", Lt = "button-module_transparent", kt = "button-module_link", At = "button-module_icon", Dt = "button-module_sm", Rt = "button-module_lg", Bt = "button-module_withTextAndIcon", H = {
|
|
79
|
+
button: Nt,
|
|
80
|
+
pressed: xt,
|
|
81
|
+
primary: St,
|
|
82
|
+
ghost: It,
|
|
83
|
+
outline: $t,
|
|
84
|
+
transparent: Lt,
|
|
85
|
+
link: kt,
|
|
86
|
+
icon: At,
|
|
87
|
+
sm: Dt,
|
|
88
|
+
lg: Rt,
|
|
89
|
+
withTextAndIcon: Bt
|
|
90
|
+
}, k = at.forwardRef(
|
|
91
|
+
function({
|
|
92
|
+
className: n,
|
|
93
|
+
variant: o = "primary",
|
|
94
|
+
size: a,
|
|
95
|
+
icon: i,
|
|
96
|
+
children: l,
|
|
97
|
+
asChild: s = !1,
|
|
98
|
+
pressed: b,
|
|
99
|
+
...f
|
|
100
|
+
}, d) {
|
|
101
|
+
const u = s ? bt : "button", r = !!i, p = a || (r && !l ? "icon" : void 0);
|
|
102
|
+
return /* @__PURE__ */ h(
|
|
103
|
+
u,
|
|
104
|
+
{
|
|
105
|
+
ref: d,
|
|
106
|
+
"data-slot": "button",
|
|
107
|
+
className: v(
|
|
108
|
+
H.button,
|
|
109
|
+
H[o],
|
|
110
|
+
p && H[p],
|
|
111
|
+
r && l ? H.withTextAndIcon : void 0,
|
|
112
|
+
b ? H.pressed : void 0,
|
|
113
|
+
n
|
|
114
|
+
),
|
|
115
|
+
"aria-pressed": b,
|
|
116
|
+
...f,
|
|
117
|
+
children: [
|
|
118
|
+
i,
|
|
119
|
+
l
|
|
120
|
+
]
|
|
121
|
+
}
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
);
|
|
125
|
+
k.displayName = "Button";
|
|
126
|
+
const Mt = "Textarea-module_textarea", jt = {
|
|
127
|
+
textarea: Mt
|
|
128
|
+
}, rt = at.forwardRef(
|
|
129
|
+
({ className: t, ...n }, o) => /* @__PURE__ */ e(
|
|
130
|
+
"textarea",
|
|
131
|
+
{
|
|
132
|
+
"data-slot": "textarea",
|
|
133
|
+
className: jt.textarea,
|
|
134
|
+
ref: o,
|
|
135
|
+
...n
|
|
136
|
+
}
|
|
137
|
+
)
|
|
138
|
+
);
|
|
139
|
+
rt.displayName = "Textarea";
|
|
140
|
+
function Et({ className: t, size: n = 24 }) {
|
|
141
|
+
return /* @__PURE__ */ e(
|
|
142
|
+
"svg",
|
|
143
|
+
{
|
|
144
|
+
width: n,
|
|
145
|
+
height: n,
|
|
146
|
+
viewBox: "0 0 24 24",
|
|
147
|
+
fill: "none",
|
|
148
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
149
|
+
className: t,
|
|
150
|
+
children: /* @__PURE__ */ e(
|
|
151
|
+
"path",
|
|
152
|
+
{
|
|
153
|
+
d: "M12.2197 5C12.4186 5 12.6094 5.07902 12.75 5.21967L17 9.46967C17.2929 9.76256 17.2929 10.2374 17 10.5303C16.7071 10.8232 16.2322 10.8232 15.9393 10.5303L12.9697 7.56067V18.25C12.9697 18.6642 12.6339 19 12.2197 19C11.8055 19 11.4697 18.6642 11.4697 18.25V7.56065L8.5 10.5303C8.2071 10.8232 7.73223 10.8232 7.43934 10.5303C7.14644 10.2374 7.14645 9.76256 7.43934 9.46967L11.6894 5.21967C11.83 5.07902 12.0208 5 12.2197 5Z",
|
|
154
|
+
fill: "currentColor"
|
|
155
|
+
}
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
function Pt({ className: t, size: n = 24 }) {
|
|
161
|
+
return /* @__PURE__ */ e(
|
|
162
|
+
"svg",
|
|
163
|
+
{
|
|
164
|
+
width: n,
|
|
165
|
+
height: n,
|
|
166
|
+
viewBox: "0 0 24 24",
|
|
167
|
+
fill: "none",
|
|
168
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
169
|
+
className: t,
|
|
170
|
+
children: /* @__PURE__ */ e(
|
|
171
|
+
"rect",
|
|
172
|
+
{
|
|
173
|
+
x: "7",
|
|
174
|
+
y: "7",
|
|
175
|
+
width: "10",
|
|
176
|
+
height: "10",
|
|
177
|
+
rx: "2",
|
|
178
|
+
fill: "currentColor"
|
|
179
|
+
}
|
|
180
|
+
)
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
const Vt = "ChatInput-module_container", Ht = "ChatInput-module_textareaContainer", Ut = "ChatInput-module_actions", Tt = "ChatInput-module_containerStacked", Zt = "ChatInput-module_button", R = {
|
|
185
|
+
container: Vt,
|
|
186
|
+
textareaContainer: Ht,
|
|
187
|
+
actions: Ut,
|
|
188
|
+
containerStacked: Tt,
|
|
189
|
+
button: Zt
|
|
190
|
+
};
|
|
191
|
+
function Ot({ className: t, size: n = 24 }) {
|
|
192
|
+
return /* @__PURE__ */ e(
|
|
193
|
+
"svg",
|
|
194
|
+
{
|
|
195
|
+
className: t,
|
|
196
|
+
width: n,
|
|
197
|
+
height: n,
|
|
198
|
+
viewBox: "0 0 24 24",
|
|
199
|
+
fill: "none",
|
|
200
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
201
|
+
children: /* @__PURE__ */ e(
|
|
202
|
+
"path",
|
|
203
|
+
{
|
|
204
|
+
fillRule: "evenodd",
|
|
205
|
+
clipRule: "evenodd",
|
|
206
|
+
d: "M18.0045 13.4451L12 7.9864L5.9955 13.4451L7.00451 14.5549L12 10.0136L16.9955 14.5549L18.0045 13.4451Z",
|
|
207
|
+
fill: "currentColor"
|
|
208
|
+
}
|
|
209
|
+
)
|
|
210
|
+
}
|
|
211
|
+
);
|
|
212
|
+
}
|
|
213
|
+
const Wt = "AnimatedPlaceholder-module_container", Qt = {
|
|
214
|
+
container: Wt
|
|
215
|
+
};
|
|
216
|
+
function Ft({
|
|
217
|
+
texts: t,
|
|
218
|
+
interval: n = 3e3,
|
|
219
|
+
className: o = ""
|
|
220
|
+
}) {
|
|
221
|
+
const [a, i] = pt(0);
|
|
222
|
+
return z(() => {
|
|
223
|
+
const l = setInterval(() => {
|
|
224
|
+
i(
|
|
225
|
+
(s) => (s + 1) % t.length
|
|
226
|
+
);
|
|
227
|
+
}, n);
|
|
228
|
+
return () => clearInterval(l);
|
|
229
|
+
}, [t.length, n]), /* @__PURE__ */ e(st, { mode: "wait", children: /* @__PURE__ */ e(
|
|
230
|
+
M.span,
|
|
231
|
+
{
|
|
232
|
+
"data-slot": "animated-placeholder",
|
|
233
|
+
className: v(Qt.container, o),
|
|
234
|
+
initial: { opacity: 0, y: 8 },
|
|
235
|
+
animate: { opacity: 1, y: 0 },
|
|
236
|
+
exit: { opacity: 0, y: -8 },
|
|
237
|
+
transition: {
|
|
238
|
+
duration: 0.3,
|
|
239
|
+
ease: [0.4, 0, 0.2, 1]
|
|
240
|
+
// Matches --transition-colors cubic-bezier
|
|
241
|
+
},
|
|
242
|
+
children: t[a]
|
|
243
|
+
},
|
|
244
|
+
a
|
|
245
|
+
) });
|
|
246
|
+
}
|
|
247
|
+
function Gt({
|
|
248
|
+
value: t,
|
|
249
|
+
onChange: n,
|
|
250
|
+
onSubmit: o,
|
|
251
|
+
onKeyDown: a,
|
|
252
|
+
textareaRef: i,
|
|
253
|
+
placeholder: l = w("Ask anything", "a8c-agenttic"),
|
|
254
|
+
isProcessing: s,
|
|
255
|
+
onBlur: b,
|
|
256
|
+
onFocus: f,
|
|
257
|
+
onClick: d,
|
|
258
|
+
fromCompact: u = !1,
|
|
259
|
+
onExpand: r,
|
|
260
|
+
showExpandButton: p = !0,
|
|
261
|
+
focusOnMount: m = !1,
|
|
262
|
+
customActions: N = [],
|
|
263
|
+
actionOrder: y = "before-submit",
|
|
264
|
+
onStop: x,
|
|
265
|
+
disabled: A,
|
|
266
|
+
onMouseEnter: g,
|
|
267
|
+
onMouseLeave: D,
|
|
268
|
+
expandOnClick: I = !1,
|
|
269
|
+
layout: P = "inline"
|
|
270
|
+
}) {
|
|
271
|
+
const F = ft(), { variant: et, floatingChatState: j, isInputOverLimit: Z } = T(), G = (
|
|
272
|
+
// If the consumer actively sets `disabled` to `false` (vs undefined), that takes precedence.
|
|
273
|
+
A !== void 0 ? !A : (t.trim() || s) && !Z
|
|
274
|
+
), ct = tt(
|
|
275
|
+
(c) => {
|
|
276
|
+
const O = c.key.toLowerCase();
|
|
277
|
+
if (O === "enter" && !c.shiftKey && (c.nativeEvent.isComposing || c.keyCode === 229)) {
|
|
278
|
+
c.preventDefault();
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
if (O === "enter" && !c.shiftKey && !G) {
|
|
282
|
+
c.preventDefault();
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
((c.metaKey || c.ctrlKey) && O === "z" || c.ctrlKey && O === "y") && c.stopPropagation(), a(c);
|
|
286
|
+
},
|
|
287
|
+
[G, a]
|
|
288
|
+
), nt = (c) => c.endsWith("…") ? c : `${c}…`, q = Array.isArray(l);
|
|
289
|
+
let V;
|
|
290
|
+
q ? V = l.map(nt) : l ? V = nt(l) : V = "";
|
|
291
|
+
const K = gt(m);
|
|
292
|
+
z(() => {
|
|
293
|
+
K.current && i.current && i.current.focus(), K.current = !1;
|
|
294
|
+
}, [K, i]);
|
|
295
|
+
const ot = () => N.map((c) => /* @__PURE__ */ e(
|
|
296
|
+
k,
|
|
297
|
+
{
|
|
298
|
+
className: c.className || R.button,
|
|
299
|
+
onClick: c.onClick,
|
|
300
|
+
disabled: c.disabled,
|
|
301
|
+
variant: c.variant || "ghost",
|
|
302
|
+
icon: c.icon,
|
|
303
|
+
"aria-label": c["aria-label"]
|
|
304
|
+
},
|
|
305
|
+
c.id
|
|
306
|
+
)), dt = () => et === "embedded" || j === "expanded" || I ? null : p && r ? /* @__PURE__ */ e(
|
|
307
|
+
k,
|
|
308
|
+
{
|
|
309
|
+
className: R.button,
|
|
310
|
+
onClick: r,
|
|
311
|
+
variant: "ghost",
|
|
312
|
+
icon: /* @__PURE__ */ e(Ot, {}),
|
|
313
|
+
"aria-label": w("Expand conversation", "a8c-agenttic")
|
|
314
|
+
}
|
|
315
|
+
) : null, ut = () => {
|
|
316
|
+
if (s && !x)
|
|
317
|
+
return null;
|
|
318
|
+
const c = () => {
|
|
319
|
+
s && x ? x() : o();
|
|
320
|
+
};
|
|
321
|
+
return /* @__PURE__ */ e(
|
|
322
|
+
k,
|
|
323
|
+
{
|
|
324
|
+
className: R.button,
|
|
325
|
+
onClick: c,
|
|
326
|
+
disabled: !G,
|
|
327
|
+
variant: "primary",
|
|
328
|
+
icon: s ? /* @__PURE__ */ e(Pt, {}) : /* @__PURE__ */ e(Et, {}),
|
|
329
|
+
"aria-label": s ? w("Stop processing", "a8c-agenttic") : w("Send message", "a8c-agenttic")
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
};
|
|
333
|
+
return /* @__PURE__ */ h(
|
|
334
|
+
"div",
|
|
335
|
+
{
|
|
336
|
+
"data-slot": "chat-input",
|
|
337
|
+
className: `${R.container}${P === "stacked" ? ` ${R.containerStacked}` : ""}`,
|
|
338
|
+
onMouseEnter: g,
|
|
339
|
+
onMouseLeave: D,
|
|
340
|
+
children: [
|
|
341
|
+
/* @__PURE__ */ h(
|
|
342
|
+
M.div,
|
|
343
|
+
{
|
|
344
|
+
className: R.textareaContainer,
|
|
345
|
+
initial: {
|
|
346
|
+
opacity: 0
|
|
347
|
+
},
|
|
348
|
+
animate: {
|
|
349
|
+
opacity: 1,
|
|
350
|
+
scale: 1,
|
|
351
|
+
transition: t.trim() ? { duration: 0 } : Q
|
|
352
|
+
},
|
|
353
|
+
children: [
|
|
354
|
+
!t && q && /* @__PURE__ */ e(
|
|
355
|
+
Ft,
|
|
356
|
+
{
|
|
357
|
+
texts: V
|
|
358
|
+
}
|
|
359
|
+
),
|
|
360
|
+
/* @__PURE__ */ e(
|
|
361
|
+
rt,
|
|
362
|
+
{
|
|
363
|
+
id: F,
|
|
364
|
+
ref: i,
|
|
365
|
+
value: t,
|
|
366
|
+
onChange: (c) => n(c.target.value),
|
|
367
|
+
onKeyDown: ct,
|
|
368
|
+
onBlur: b,
|
|
369
|
+
onFocus: f,
|
|
370
|
+
onClick: d,
|
|
371
|
+
placeholder: q ? "" : V,
|
|
372
|
+
rows: 1,
|
|
373
|
+
"aria-label": w("Chat input", "a8c-agenttic")
|
|
374
|
+
}
|
|
375
|
+
)
|
|
376
|
+
]
|
|
377
|
+
}
|
|
378
|
+
),
|
|
379
|
+
/* @__PURE__ */ h(
|
|
380
|
+
M.div,
|
|
381
|
+
{
|
|
382
|
+
className: R.actions,
|
|
383
|
+
initial: {
|
|
384
|
+
opacity: u ? 1 : 0,
|
|
385
|
+
scale: u ? 1 : 0.5
|
|
386
|
+
},
|
|
387
|
+
animate: {
|
|
388
|
+
opacity: 1,
|
|
389
|
+
scale: 1,
|
|
390
|
+
transition: t.trim() ? { duration: 0 } : U
|
|
391
|
+
},
|
|
392
|
+
children: [
|
|
393
|
+
dt(),
|
|
394
|
+
y === "before-submit" && ot(),
|
|
395
|
+
ut(),
|
|
396
|
+
y === "after-submit" && ot()
|
|
397
|
+
]
|
|
398
|
+
}
|
|
399
|
+
)
|
|
400
|
+
]
|
|
401
|
+
}
|
|
402
|
+
);
|
|
403
|
+
}
|
|
404
|
+
function qt({ className: t, size: n = 24 }) {
|
|
405
|
+
return /* @__PURE__ */ e(
|
|
406
|
+
"svg",
|
|
407
|
+
{
|
|
408
|
+
className: t,
|
|
409
|
+
width: n,
|
|
410
|
+
height: n,
|
|
411
|
+
viewBox: "0 0 24 24",
|
|
412
|
+
fill: "none",
|
|
413
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
414
|
+
children: /* @__PURE__ */ e(
|
|
415
|
+
"path",
|
|
416
|
+
{
|
|
417
|
+
fillRule: "evenodd",
|
|
418
|
+
clipRule: "evenodd",
|
|
419
|
+
d: "M18.0045 10.5549L12 16.0136L5.9955 10.5549L7.00451 9.44504L12 13.9864L16.9955 9.44504L18.0045 10.5549Z",
|
|
420
|
+
fill: "currentColor"
|
|
421
|
+
}
|
|
422
|
+
)
|
|
423
|
+
}
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
const Kt = "SuggestionDropdown-module_container", Xt = "SuggestionDropdown-module_labelRow", Yt = "SuggestionDropdown-module_chevron", Jt = "SuggestionDropdown-module_chevronOpen", zt = "SuggestionDropdown-module_dropdown", te = "SuggestionDropdown-module_option", E = {
|
|
427
|
+
container: Kt,
|
|
428
|
+
labelRow: Xt,
|
|
429
|
+
chevron: Yt,
|
|
430
|
+
chevronOpen: Jt,
|
|
431
|
+
dropdown: zt,
|
|
432
|
+
option: te
|
|
433
|
+
}, ee = "Suggestions-module_container", ne = "Suggestions-module_vertical", oe = "Suggestions-module_button", ae = "Suggestions-module_label", ie = "Suggestions-module_description", se = "Suggestions-module_floating", _ = {
|
|
434
|
+
container: ee,
|
|
435
|
+
vertical: ne,
|
|
436
|
+
button: oe,
|
|
437
|
+
"suggestion-content--with-description": "Suggestions-module_suggestion-content--with-description",
|
|
438
|
+
label: ae,
|
|
439
|
+
description: ie,
|
|
440
|
+
floating: se
|
|
441
|
+
}, le = (t, n) => !t || !n ? `${t}${n}` : /\s$/.test(t) || /^\s/.test(n) ? `${t}${n}` : `${t} ${n}`, re = ({
|
|
442
|
+
suggestion: t,
|
|
443
|
+
onSelect: n,
|
|
444
|
+
availableSuggestions: o,
|
|
445
|
+
onOpenChange: a,
|
|
446
|
+
showDescription: i
|
|
447
|
+
}) => {
|
|
448
|
+
var A;
|
|
449
|
+
const [l, s] = L.useState(!1), b = L.useRef(null), [f, d] = L.useState(null), [u, r] = L.useState(null), [p, m] = L.useState(void 0), N = L.useCallback(
|
|
450
|
+
(g) => {
|
|
451
|
+
if (b.current = g, !g) {
|
|
452
|
+
d(null), r(null);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
d(
|
|
456
|
+
g.closest(".agenttic") ?? g
|
|
457
|
+
), r(
|
|
458
|
+
g.closest(
|
|
459
|
+
'[data-slot="conversation-view"]'
|
|
460
|
+
) ?? null
|
|
461
|
+
);
|
|
462
|
+
},
|
|
463
|
+
[]
|
|
464
|
+
), y = L.useCallback(
|
|
465
|
+
(g) => {
|
|
466
|
+
var D;
|
|
467
|
+
if (g) {
|
|
468
|
+
const I = (D = b.current) == null ? void 0 : D.closest(
|
|
469
|
+
'[data-slot="suggestions"]'
|
|
470
|
+
);
|
|
471
|
+
I && m(I.clientWidth * 0.9);
|
|
472
|
+
}
|
|
473
|
+
s(g), a == null || a(g);
|
|
474
|
+
},
|
|
475
|
+
[a]
|
|
476
|
+
), x = (g) => {
|
|
477
|
+
const { options: D, ...I } = t, P = {
|
|
478
|
+
...I,
|
|
479
|
+
prompt: le(
|
|
480
|
+
t.prompt ?? t.label,
|
|
481
|
+
g.value
|
|
482
|
+
),
|
|
483
|
+
label: `${t.label} ${g.label}`
|
|
484
|
+
};
|
|
485
|
+
n == null || n(P, o), y(!1);
|
|
486
|
+
};
|
|
487
|
+
return /* @__PURE__ */ e("div", { ref: N, className: E.container, children: /* @__PURE__ */ h(W.Root, { open: l, onOpenChange: y, children: [
|
|
488
|
+
/* @__PURE__ */ e(W.Trigger, { asChild: !0, children: /* @__PURE__ */ e(
|
|
489
|
+
k,
|
|
490
|
+
{
|
|
491
|
+
variant: "outline",
|
|
492
|
+
className: _.button,
|
|
493
|
+
children: /* @__PURE__ */ h(
|
|
494
|
+
"div",
|
|
495
|
+
{
|
|
496
|
+
className: v(
|
|
497
|
+
_["suggestion-content"],
|
|
498
|
+
i ? _["suggestion-content--with-description"] : ""
|
|
499
|
+
),
|
|
500
|
+
children: [
|
|
501
|
+
/* @__PURE__ */ h("span", { className: E.labelRow, children: [
|
|
502
|
+
/* @__PURE__ */ e("span", { className: _.label, children: t.label }),
|
|
503
|
+
/* @__PURE__ */ e(
|
|
504
|
+
qt,
|
|
505
|
+
{
|
|
506
|
+
size: 14,
|
|
507
|
+
className: `${E.chevron} ${l ? E.chevronOpen : ""}`
|
|
508
|
+
}
|
|
509
|
+
)
|
|
510
|
+
] }),
|
|
511
|
+
i && t.description && /* @__PURE__ */ e(
|
|
512
|
+
"span",
|
|
513
|
+
{
|
|
514
|
+
className: _.description,
|
|
515
|
+
children: t.description
|
|
516
|
+
}
|
|
517
|
+
)
|
|
518
|
+
]
|
|
519
|
+
}
|
|
520
|
+
)
|
|
521
|
+
}
|
|
522
|
+
) }),
|
|
523
|
+
f && /* @__PURE__ */ e(W.Portal, { container: f, children: /* @__PURE__ */ e(
|
|
524
|
+
W.Content,
|
|
525
|
+
{
|
|
526
|
+
className: E.dropdown,
|
|
527
|
+
side: "top",
|
|
528
|
+
align: "start",
|
|
529
|
+
sideOffset: 4,
|
|
530
|
+
collisionBoundary: u,
|
|
531
|
+
"aria-label": t.label,
|
|
532
|
+
style: p ? { width: p } : void 0,
|
|
533
|
+
children: (A = t.options) == null ? void 0 : A.map((g) => /* @__PURE__ */ e(
|
|
534
|
+
"button",
|
|
535
|
+
{
|
|
536
|
+
type: "button",
|
|
537
|
+
"data-slot": "suggestion-option",
|
|
538
|
+
className: E.option,
|
|
539
|
+
onClick: () => x(g),
|
|
540
|
+
children: g.label
|
|
541
|
+
},
|
|
542
|
+
g.id
|
|
543
|
+
))
|
|
544
|
+
}
|
|
545
|
+
) })
|
|
546
|
+
] }) });
|
|
547
|
+
}, ce = ({
|
|
548
|
+
className: t,
|
|
549
|
+
suggestions: n,
|
|
550
|
+
onSubmit: o,
|
|
551
|
+
layout: a = "horizontal",
|
|
552
|
+
visible: i = !0,
|
|
553
|
+
onMouseEnter: l,
|
|
554
|
+
onMouseLeave: s,
|
|
555
|
+
onDropdownOpenChange: b,
|
|
556
|
+
translateY: f = "-100%"
|
|
557
|
+
}) => {
|
|
558
|
+
const { variant: d, reportSuggestionsRendered: u } = T(), r = it(
|
|
559
|
+
() => d === "floating" ? n == null ? void 0 : n.slice(0, 3) : n,
|
|
560
|
+
[n, d]
|
|
561
|
+
);
|
|
562
|
+
z(() => {
|
|
563
|
+
i && (r != null && r.length) && (u == null || u(r));
|
|
564
|
+
}, [i, r, u]);
|
|
565
|
+
const p = async (m, N) => {
|
|
566
|
+
let y = !0;
|
|
567
|
+
m.action && (y = await m.action()), y && o && m.prompt && o(m, N);
|
|
568
|
+
};
|
|
569
|
+
return !r || r.length === 0 ? null : /* @__PURE__ */ e(st, { children: i && /* @__PURE__ */ e(
|
|
570
|
+
M.div,
|
|
571
|
+
{
|
|
572
|
+
"data-slot": "suggestions",
|
|
573
|
+
className: v(
|
|
574
|
+
_.container,
|
|
575
|
+
a === "vertical" ? _.vertical : a === "floating" ? _.floating : "",
|
|
576
|
+
t
|
|
577
|
+
),
|
|
578
|
+
initial: { opacity: 0, y: "-80%" },
|
|
579
|
+
animate: { opacity: 1, y: f },
|
|
580
|
+
exit: { opacity: 0, y: "-80%" },
|
|
581
|
+
transition: Q,
|
|
582
|
+
onMouseEnter: l,
|
|
583
|
+
onMouseLeave: s,
|
|
584
|
+
children: r.map(
|
|
585
|
+
(m, N) => {
|
|
586
|
+
const y = !!m.description && a !== "horizontal";
|
|
587
|
+
return /* @__PURE__ */ e(
|
|
588
|
+
M.div,
|
|
589
|
+
{
|
|
590
|
+
initial: { opacity: 0, y: 10 },
|
|
591
|
+
animate: { opacity: 1, y: 0 },
|
|
592
|
+
exit: { opacity: 0, y: 10 },
|
|
593
|
+
transition: {
|
|
594
|
+
...Q,
|
|
595
|
+
delay: N * 0.05
|
|
596
|
+
},
|
|
597
|
+
children: m.options && m.options.length > 0 ? /* @__PURE__ */ e(
|
|
598
|
+
re,
|
|
599
|
+
{
|
|
600
|
+
suggestion: m,
|
|
601
|
+
onSelect: p,
|
|
602
|
+
availableSuggestions: r,
|
|
603
|
+
onOpenChange: b,
|
|
604
|
+
showDescription: y
|
|
605
|
+
}
|
|
606
|
+
) : /* @__PURE__ */ e(
|
|
607
|
+
k,
|
|
608
|
+
{
|
|
609
|
+
onClick: (x) => {
|
|
610
|
+
x.stopPropagation(), p(
|
|
611
|
+
m,
|
|
612
|
+
r
|
|
613
|
+
);
|
|
614
|
+
},
|
|
615
|
+
variant: "outline",
|
|
616
|
+
className: _.button,
|
|
617
|
+
children: /* @__PURE__ */ h(
|
|
618
|
+
"div",
|
|
619
|
+
{
|
|
620
|
+
className: v(
|
|
621
|
+
_["suggestion-content"],
|
|
622
|
+
y ? _["suggestion-content--with-description"] : ""
|
|
623
|
+
),
|
|
624
|
+
children: [
|
|
625
|
+
/* @__PURE__ */ e(
|
|
626
|
+
"span",
|
|
627
|
+
{
|
|
628
|
+
className: _.label,
|
|
629
|
+
children: m.label
|
|
630
|
+
}
|
|
631
|
+
),
|
|
632
|
+
y && /* @__PURE__ */ e(
|
|
633
|
+
"span",
|
|
634
|
+
{
|
|
635
|
+
className: _.description,
|
|
636
|
+
children: m.description
|
|
637
|
+
}
|
|
638
|
+
)
|
|
639
|
+
]
|
|
640
|
+
}
|
|
641
|
+
)
|
|
642
|
+
}
|
|
643
|
+
)
|
|
644
|
+
},
|
|
645
|
+
m.id
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
)
|
|
649
|
+
}
|
|
650
|
+
) });
|
|
651
|
+
};
|
|
652
|
+
function de({ className: t, size: n = 24 }) {
|
|
653
|
+
return /* @__PURE__ */ e(
|
|
654
|
+
"svg",
|
|
655
|
+
{
|
|
656
|
+
className: t,
|
|
657
|
+
width: n,
|
|
658
|
+
height: n,
|
|
659
|
+
viewBox: "0 0 24 24",
|
|
660
|
+
fill: "none",
|
|
661
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
662
|
+
children: /* @__PURE__ */ e(
|
|
663
|
+
"path",
|
|
664
|
+
{
|
|
665
|
+
d: "M12.0001 13.0607L16.4697 17.5304L17.5304 16.4697L13.0607 12.0001L17.5304 7.53039L16.4697 6.46973L12.0001 10.9394L7.5304 6.46973L6.46973 7.53039L10.9394 12.0001L6.46974 16.4697L7.5304 17.5304L12.0001 13.0607Z",
|
|
666
|
+
fill: "currentColor"
|
|
667
|
+
}
|
|
668
|
+
)
|
|
669
|
+
}
|
|
670
|
+
);
|
|
671
|
+
}
|
|
672
|
+
const ue = "SourcesCard-module_card", me = "SourcesCard-module_heading", he = "SourcesCard-module_list", pe = "SourcesCard-module_item", fe = "SourcesCard-module_title", ge = "SourcesCard-module_label", B = {
|
|
673
|
+
card: ue,
|
|
674
|
+
heading: me,
|
|
675
|
+
list: he,
|
|
676
|
+
item: pe,
|
|
677
|
+
title: fe,
|
|
678
|
+
label: ge
|
|
679
|
+
};
|
|
680
|
+
function vn({ sources: t, className: n }) {
|
|
681
|
+
return t != null && t.length ? /* @__PURE__ */ h(
|
|
682
|
+
"section",
|
|
683
|
+
{
|
|
684
|
+
className: v(B.card, n),
|
|
685
|
+
"data-agenttic-sources-card": !0,
|
|
686
|
+
"data-slot": "sources",
|
|
687
|
+
children: [
|
|
688
|
+
/* @__PURE__ */ e("p", { className: B.heading, "data-slot": "heading", children: w("Sources", "a8c-agenttic") }),
|
|
689
|
+
/* @__PURE__ */ e("ul", { className: B.list, "data-slot": "list", children: t.map((o, a) => {
|
|
690
|
+
const i = o.title || o.url || o.label || w("Untitled source", "a8c-agenttic"), l = o.id || o.url || `${i}-${a}`;
|
|
691
|
+
return /* @__PURE__ */ h(
|
|
692
|
+
"li",
|
|
693
|
+
{
|
|
694
|
+
className: B.item,
|
|
695
|
+
"data-slot": "source",
|
|
696
|
+
children: [
|
|
697
|
+
o.url ? /* @__PURE__ */ e(
|
|
698
|
+
"a",
|
|
699
|
+
{
|
|
700
|
+
className: B.title,
|
|
701
|
+
"data-slot": "title",
|
|
702
|
+
href: o.url,
|
|
703
|
+
target: "_blank",
|
|
704
|
+
rel: "noopener noreferrer",
|
|
705
|
+
children: i
|
|
706
|
+
}
|
|
707
|
+
) : /* @__PURE__ */ e(
|
|
708
|
+
"span",
|
|
709
|
+
{
|
|
710
|
+
className: B.title,
|
|
711
|
+
"data-slot": "title",
|
|
712
|
+
children: i
|
|
713
|
+
}
|
|
714
|
+
),
|
|
715
|
+
o.label ? /* @__PURE__ */ e(
|
|
716
|
+
"span",
|
|
717
|
+
{
|
|
718
|
+
className: B.label,
|
|
719
|
+
"data-slot": "label",
|
|
720
|
+
children: o.label
|
|
721
|
+
}
|
|
722
|
+
) : null
|
|
723
|
+
]
|
|
724
|
+
},
|
|
725
|
+
l
|
|
726
|
+
);
|
|
727
|
+
}) })
|
|
728
|
+
]
|
|
729
|
+
}
|
|
730
|
+
) : null;
|
|
731
|
+
}
|
|
732
|
+
function be({ className: t, size: n = 24 }) {
|
|
733
|
+
return /* @__PURE__ */ e(
|
|
734
|
+
"svg",
|
|
735
|
+
{
|
|
736
|
+
width: n,
|
|
737
|
+
height: n,
|
|
738
|
+
viewBox: "0 0 24 24",
|
|
739
|
+
fill: "none",
|
|
740
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
741
|
+
className: t,
|
|
742
|
+
children: /* @__PURE__ */ e(
|
|
743
|
+
"path",
|
|
744
|
+
{
|
|
745
|
+
d: "M12 5C12.4142 5 12.75 5.33579 12.75 5.75V11.25H18.25C18.6642 11.25 19 11.5858 19 12C19 12.4142 18.6642 12.75 18.25 12.75H12.75V18.25C12.75 18.6642 12.4142 19 12 19C11.5858 19 11.25 18.6642 11.25 18.25V12.75H5.75C5.33579 12.75 5 12.4142 5 12C5 11.5858 5.33579 11.25 5.75 11.25H11.25V5.75C11.25 5.33579 11.5858 5 12 5Z",
|
|
746
|
+
fill: "currentColor"
|
|
747
|
+
}
|
|
748
|
+
)
|
|
749
|
+
}
|
|
750
|
+
);
|
|
751
|
+
}
|
|
752
|
+
function Ce({
|
|
753
|
+
className: t,
|
|
754
|
+
disabled: n,
|
|
755
|
+
customActions: o,
|
|
756
|
+
actionOrder: a,
|
|
757
|
+
onKeyDown: i,
|
|
758
|
+
layout: l,
|
|
759
|
+
imageUploaderRef: s
|
|
760
|
+
} = {}) {
|
|
761
|
+
const {
|
|
762
|
+
inputValue: b,
|
|
763
|
+
setInputValue: f,
|
|
764
|
+
handleSubmit: d,
|
|
765
|
+
handleKeyDown: u,
|
|
766
|
+
textareaRef: r,
|
|
767
|
+
placeholder: p,
|
|
768
|
+
isProcessing: m,
|
|
769
|
+
onStop: N,
|
|
770
|
+
fromCompact: y,
|
|
771
|
+
onExpand: x,
|
|
772
|
+
showExpandButton: A,
|
|
773
|
+
focusOnMount: g,
|
|
774
|
+
onInputFocus: D,
|
|
775
|
+
onInputBlur: I
|
|
776
|
+
} = T(), P = (j) => {
|
|
777
|
+
i == null || i(j), !j.defaultPrevented && u(j);
|
|
778
|
+
}, F = it(() => s ? [{
|
|
779
|
+
id: "image-upload",
|
|
780
|
+
icon: /* @__PURE__ */ e(be, {}),
|
|
781
|
+
onClick: () => {
|
|
782
|
+
var Z;
|
|
783
|
+
return (Z = s.current) == null ? void 0 : Z.openFileDialog();
|
|
784
|
+
},
|
|
785
|
+
variant: "ghost",
|
|
786
|
+
"aria-label": w("Upload image", "a8c-agenttic")
|
|
787
|
+
}, ...o || []] : o, [s, o]);
|
|
788
|
+
return /* @__PURE__ */ e(
|
|
789
|
+
Gt,
|
|
790
|
+
{
|
|
791
|
+
value: b,
|
|
792
|
+
onChange: f,
|
|
793
|
+
onSubmit: d,
|
|
794
|
+
onKeyDown: P,
|
|
795
|
+
onFocus: D,
|
|
796
|
+
onBlur: I,
|
|
797
|
+
textareaRef: r,
|
|
798
|
+
placeholder: p,
|
|
799
|
+
isProcessing: m,
|
|
800
|
+
onStop: N,
|
|
801
|
+
fromCompact: y,
|
|
802
|
+
onExpand: x,
|
|
803
|
+
showExpandButton: A,
|
|
804
|
+
focusOnMount: g,
|
|
805
|
+
disabled: n,
|
|
806
|
+
customActions: F,
|
|
807
|
+
actionOrder: a,
|
|
808
|
+
className: t,
|
|
809
|
+
layout: l ?? (s ? "stacked" : "inline")
|
|
810
|
+
}
|
|
811
|
+
);
|
|
812
|
+
}
|
|
813
|
+
function ve({
|
|
814
|
+
className: t,
|
|
815
|
+
showSuggestions: n,
|
|
816
|
+
onSelect: o
|
|
817
|
+
} = {}) {
|
|
818
|
+
const {
|
|
819
|
+
suggestions: a,
|
|
820
|
+
handleSuggestionSubmit: i,
|
|
821
|
+
inputValue: l,
|
|
822
|
+
messages: s,
|
|
823
|
+
variant: b,
|
|
824
|
+
emptyView: f
|
|
825
|
+
} = T(), d = tt(
|
|
826
|
+
(u, r) => {
|
|
827
|
+
try {
|
|
828
|
+
const p = u.prompt ?? u.label;
|
|
829
|
+
o == null || o(p);
|
|
830
|
+
} catch (p) {
|
|
831
|
+
console.warn("Suggestions onSelect callback failed:", p);
|
|
832
|
+
}
|
|
833
|
+
i(u, r);
|
|
834
|
+
},
|
|
835
|
+
[o, i]
|
|
836
|
+
);
|
|
837
|
+
return l && !n || f && ["floating", "embedded"].includes(b) && s.length === 0 && !l ? null : /* @__PURE__ */ e(
|
|
838
|
+
ce,
|
|
839
|
+
{
|
|
840
|
+
suggestions: a,
|
|
841
|
+
onSubmit: d,
|
|
842
|
+
className: t
|
|
843
|
+
}
|
|
844
|
+
);
|
|
845
|
+
}
|
|
846
|
+
function we({ className: t, size: n = 18 }) {
|
|
847
|
+
return /* @__PURE__ */ h(
|
|
848
|
+
"svg",
|
|
849
|
+
{
|
|
850
|
+
width: n,
|
|
851
|
+
height: n,
|
|
852
|
+
viewBox: "0 0 18 18",
|
|
853
|
+
fill: "none",
|
|
854
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
855
|
+
className: t,
|
|
856
|
+
role: "img",
|
|
857
|
+
"aria-label": "Alert",
|
|
858
|
+
children: [
|
|
859
|
+
/* @__PURE__ */ e("path", { d: "M8.4375 12V10.875H9.5625V12H8.4375Z", fill: "currentColor" }),
|
|
860
|
+
/* @__PURE__ */ e(
|
|
861
|
+
"path",
|
|
862
|
+
{
|
|
863
|
+
d: "M8.4375 6L8.4375 9.75H9.5625V6L8.4375 6Z",
|
|
864
|
+
fill: "currentColor"
|
|
865
|
+
}
|
|
866
|
+
),
|
|
867
|
+
/* @__PURE__ */ e(
|
|
868
|
+
"path",
|
|
869
|
+
{
|
|
870
|
+
fillRule: "evenodd",
|
|
871
|
+
clipRule: "evenodd",
|
|
872
|
+
d: "M9 3C5.68629 3 3 5.68629 3 9C3 12.3137 5.68629 15 9 15C12.3137 15 15 12.3137 15 9C15 5.68629 12.3137 3 9 3ZM4.125 9C4.125 11.6924 6.30761 13.875 9 13.875C11.6924 13.875 13.875 11.6924 13.875 9C13.875 6.30761 11.6924 4.125 9 4.125C6.30761 4.125 4.125 6.30761 4.125 9Z",
|
|
873
|
+
fill: "currentColor"
|
|
874
|
+
}
|
|
875
|
+
)
|
|
876
|
+
]
|
|
877
|
+
}
|
|
878
|
+
);
|
|
879
|
+
}
|
|
880
|
+
function ye({ className: t, size: n = 18 }) {
|
|
881
|
+
return /* @__PURE__ */ h(
|
|
882
|
+
"svg",
|
|
883
|
+
{
|
|
884
|
+
width: n,
|
|
885
|
+
height: n,
|
|
886
|
+
viewBox: "0 0 18 18",
|
|
887
|
+
fill: "none",
|
|
888
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
889
|
+
className: t,
|
|
890
|
+
role: "img",
|
|
891
|
+
"aria-label": "Alert",
|
|
892
|
+
children: [
|
|
893
|
+
/* @__PURE__ */ e(
|
|
894
|
+
"path",
|
|
895
|
+
{
|
|
896
|
+
d: "M9.56279 13.0952H8.43779V11.9702H9.56279V13.0952Z",
|
|
897
|
+
fill: "currentColor"
|
|
898
|
+
}
|
|
899
|
+
),
|
|
900
|
+
/* @__PURE__ */ e(
|
|
901
|
+
"path",
|
|
902
|
+
{
|
|
903
|
+
d: "M8.43779 10.8452H9.56279V7.0952L8.43779 7.0952V10.8452Z",
|
|
904
|
+
fill: "currentColor"
|
|
905
|
+
}
|
|
906
|
+
),
|
|
907
|
+
/* @__PURE__ */ e(
|
|
908
|
+
"path",
|
|
909
|
+
{
|
|
910
|
+
fillRule: "evenodd",
|
|
911
|
+
clipRule: "evenodd",
|
|
912
|
+
d: "M7.85634 3.48153C8.35812 2.58949 9.64245 2.58949 10.1442 3.48153L15.6118 13.2017C16.104 14.0767 15.4717 15.1577 14.4679 15.1577H3.53267C2.52884 15.1577 1.89659 14.0767 2.38873 13.2017L7.85634 3.48153ZM9.16371 4.03308C9.09203 3.90564 8.90855 3.90564 8.83686 4.03308L3.36925 13.7533C3.29895 13.8783 3.38927 14.0327 3.53267 14.0327H14.4679C14.6113 14.0327 14.7016 13.8783 14.6313 13.7533L9.16371 4.03308Z",
|
|
913
|
+
fill: "currentColor"
|
|
914
|
+
}
|
|
915
|
+
)
|
|
916
|
+
]
|
|
917
|
+
}
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
const _e = "Notice-module_container", Ne = "Notice-module_isSuccess", xe = "Notice-module_icon", Se = "Notice-module_isWarning", Ie = "Notice-module_isError", $e = "Notice-module_content", Le = "Notice-module_actions", ke = "Notice-module_action", Ae = "Notice-module_dismissible", S = {
|
|
921
|
+
container: _e,
|
|
922
|
+
isSuccess: Ne,
|
|
923
|
+
icon: xe,
|
|
924
|
+
isWarning: Se,
|
|
925
|
+
isError: Ie,
|
|
926
|
+
content: $e,
|
|
927
|
+
actions: Le,
|
|
928
|
+
action: ke,
|
|
929
|
+
dismissible: Ae
|
|
930
|
+
};
|
|
931
|
+
function De({
|
|
932
|
+
icon: t,
|
|
933
|
+
message: n,
|
|
934
|
+
action: o,
|
|
935
|
+
dismissible: a = !0,
|
|
936
|
+
onDismiss: i,
|
|
937
|
+
className: l,
|
|
938
|
+
status: s
|
|
939
|
+
}) {
|
|
940
|
+
const f = tt(() => {
|
|
941
|
+
if (L.isValidElement(t))
|
|
942
|
+
return t;
|
|
943
|
+
if (t === !1 || t === null)
|
|
944
|
+
return null;
|
|
945
|
+
switch (s) {
|
|
946
|
+
case "warning":
|
|
947
|
+
return /* @__PURE__ */ e(we, {});
|
|
948
|
+
case "error":
|
|
949
|
+
return /* @__PURE__ */ e(ye, {});
|
|
950
|
+
default:
|
|
951
|
+
return null;
|
|
952
|
+
}
|
|
953
|
+
}, [t, s])();
|
|
954
|
+
return /* @__PURE__ */ h(
|
|
955
|
+
"div",
|
|
956
|
+
{
|
|
957
|
+
"data-slot": "notice",
|
|
958
|
+
className: v(
|
|
959
|
+
S.container,
|
|
960
|
+
{
|
|
961
|
+
[S.isSuccess]: s === "success",
|
|
962
|
+
[S.isWarning]: s === "warning",
|
|
963
|
+
[S.isError]: s === "error"
|
|
964
|
+
},
|
|
965
|
+
l
|
|
966
|
+
),
|
|
967
|
+
children: [
|
|
968
|
+
/* @__PURE__ */ h("div", { className: S.content, children: [
|
|
969
|
+
f && /* @__PURE__ */ e("div", { className: S.icon, children: f }),
|
|
970
|
+
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
971
|
+
Ct,
|
|
972
|
+
{
|
|
973
|
+
allowedElements: ["p", "strong", "em", "a", "br"],
|
|
974
|
+
unwrapDisallowed: !0,
|
|
975
|
+
components: {
|
|
976
|
+
a: ({ node: d, ...u }) => /* @__PURE__ */ e(
|
|
977
|
+
"a",
|
|
978
|
+
{
|
|
979
|
+
...u,
|
|
980
|
+
target: "_blank",
|
|
981
|
+
rel: "noopener noreferrer",
|
|
982
|
+
children: u.children
|
|
983
|
+
}
|
|
984
|
+
)
|
|
985
|
+
},
|
|
986
|
+
children: n
|
|
987
|
+
}
|
|
988
|
+
) })
|
|
989
|
+
] }),
|
|
990
|
+
/* @__PURE__ */ h("div", { className: S.actions, children: [
|
|
991
|
+
o && /* @__PURE__ */ e(
|
|
992
|
+
k,
|
|
993
|
+
{
|
|
994
|
+
className: S.action,
|
|
995
|
+
onClick: o.onClick,
|
|
996
|
+
variant: "link",
|
|
997
|
+
children: o.label
|
|
998
|
+
}
|
|
999
|
+
),
|
|
1000
|
+
a && i && /* @__PURE__ */ e(
|
|
1001
|
+
k,
|
|
1002
|
+
{
|
|
1003
|
+
className: S.dismissible,
|
|
1004
|
+
onClick: i,
|
|
1005
|
+
variant: "ghost",
|
|
1006
|
+
size: "sm",
|
|
1007
|
+
icon: /* @__PURE__ */ e(de, {})
|
|
1008
|
+
}
|
|
1009
|
+
)
|
|
1010
|
+
] })
|
|
1011
|
+
]
|
|
1012
|
+
}
|
|
1013
|
+
);
|
|
1014
|
+
}
|
|
1015
|
+
function Re({ className: t } = {}) {
|
|
1016
|
+
const { notice: n } = T();
|
|
1017
|
+
return n ? /* @__PURE__ */ e(
|
|
1018
|
+
De,
|
|
1019
|
+
{
|
|
1020
|
+
icon: n.icon,
|
|
1021
|
+
message: n.message,
|
|
1022
|
+
action: n.action,
|
|
1023
|
+
dismissible: n.dismissible,
|
|
1024
|
+
onDismiss: n.onDismiss,
|
|
1025
|
+
className: t,
|
|
1026
|
+
status: n.status
|
|
1027
|
+
}
|
|
1028
|
+
) : null;
|
|
1029
|
+
}
|
|
1030
|
+
const Be = "ChatFooter-module_container", Me = "ChatFooter-module_disclosure", J = {
|
|
1031
|
+
container: Be,
|
|
1032
|
+
disclosure: Me
|
|
1033
|
+
}, je = "https://automattic.com/ai-guidelines/";
|
|
1034
|
+
function Ee() {
|
|
1035
|
+
const t = (
|
|
1036
|
+
/* translators: %s: the linked label "Guidelines" (links to Automattic's AI guidelines). */
|
|
1037
|
+
w("You’re chatting with AI. %s.", "a8c-agenttic")
|
|
1038
|
+
), [n, o] = t.split("%s");
|
|
1039
|
+
return /* @__PURE__ */ h(X, { children: [
|
|
1040
|
+
n,
|
|
1041
|
+
/* @__PURE__ */ e(
|
|
1042
|
+
"a",
|
|
1043
|
+
{
|
|
1044
|
+
href: je,
|
|
1045
|
+
target: "_blank",
|
|
1046
|
+
rel: "noopener noreferrer",
|
|
1047
|
+
"aria-label": w(
|
|
1048
|
+
"Guidelines (opens in a new tab)",
|
|
1049
|
+
"a8c-agenttic"
|
|
1050
|
+
),
|
|
1051
|
+
children: w("Guidelines", "a8c-agenttic")
|
|
1052
|
+
}
|
|
1053
|
+
),
|
|
1054
|
+
o
|
|
1055
|
+
] });
|
|
1056
|
+
}
|
|
1057
|
+
function Pe({
|
|
1058
|
+
children: t
|
|
1059
|
+
}) {
|
|
1060
|
+
return t === !1 || t === null || t === void 0 ? null : /* @__PURE__ */ e(
|
|
1061
|
+
"div",
|
|
1062
|
+
{
|
|
1063
|
+
"data-slot": "chat-compliance-disclosure",
|
|
1064
|
+
className: J.disclosure,
|
|
1065
|
+
children: t
|
|
1066
|
+
}
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
function wn({
|
|
1070
|
+
children: t,
|
|
1071
|
+
className: n,
|
|
1072
|
+
complianceDisclosure: o = /* @__PURE__ */ e(Ee, {})
|
|
1073
|
+
} = {}) {
|
|
1074
|
+
const a = /* @__PURE__ */ e(Pe, { children: o });
|
|
1075
|
+
return t ? /* @__PURE__ */ h(X, { children: [
|
|
1076
|
+
/* @__PURE__ */ e(
|
|
1077
|
+
M.div,
|
|
1078
|
+
{
|
|
1079
|
+
"data-slot": "chat-footer",
|
|
1080
|
+
className: v(J.container, n),
|
|
1081
|
+
initial: { opacity: 0, scale: 1 },
|
|
1082
|
+
animate: { opacity: 1, scale: 1 },
|
|
1083
|
+
transition: { ...U },
|
|
1084
|
+
children: t
|
|
1085
|
+
}
|
|
1086
|
+
),
|
|
1087
|
+
a
|
|
1088
|
+
] }) : /* @__PURE__ */ h(X, { children: [
|
|
1089
|
+
/* @__PURE__ */ h(
|
|
1090
|
+
M.div,
|
|
1091
|
+
{
|
|
1092
|
+
"data-slot": "chat-footer",
|
|
1093
|
+
className: v(J.container, n),
|
|
1094
|
+
initial: { opacity: 0, scale: 1 },
|
|
1095
|
+
animate: { opacity: 1, scale: 1 },
|
|
1096
|
+
transition: { ...U },
|
|
1097
|
+
children: [
|
|
1098
|
+
/* @__PURE__ */ e(ve, {}),
|
|
1099
|
+
/* @__PURE__ */ e(Re, {}),
|
|
1100
|
+
/* @__PURE__ */ e(Ce, {})
|
|
1101
|
+
]
|
|
1102
|
+
}
|
|
1103
|
+
),
|
|
1104
|
+
a
|
|
1105
|
+
] });
|
|
1106
|
+
}
|
|
1107
|
+
const Ve = "QuestionCard-module_card", He = "QuestionCard-module_question", Ue = "QuestionCard-module_choices", Te = "QuestionCard-module_choicesGrid", Ze = "QuestionCard-module_choice", Oe = "QuestionCard-module_answered", We = "QuestionCard-module_label", Qe = "QuestionCard-module_description", $ = {
|
|
1108
|
+
card: Ve,
|
|
1109
|
+
question: He,
|
|
1110
|
+
choices: Ue,
|
|
1111
|
+
choicesGrid: Te,
|
|
1112
|
+
choice: Ze,
|
|
1113
|
+
answered: Oe,
|
|
1114
|
+
label: We,
|
|
1115
|
+
description: Qe
|
|
1116
|
+
};
|
|
1117
|
+
function yn({
|
|
1118
|
+
prompt: t,
|
|
1119
|
+
onAnswer: n,
|
|
1120
|
+
disabled: o = !1,
|
|
1121
|
+
answered: a = !1,
|
|
1122
|
+
answeredChoice: i,
|
|
1123
|
+
className: l,
|
|
1124
|
+
renderChoiceContent: s
|
|
1125
|
+
}) {
|
|
1126
|
+
const b = o || a, f = t.choices.slice(0, 4);
|
|
1127
|
+
return /* @__PURE__ */ h(
|
|
1128
|
+
"section",
|
|
1129
|
+
{
|
|
1130
|
+
className: v($.card, l),
|
|
1131
|
+
"data-agenttic-question-card": !0,
|
|
1132
|
+
"data-slot": "card",
|
|
1133
|
+
children: [
|
|
1134
|
+
/* @__PURE__ */ e("p", { className: $.question, "data-slot": "question", children: t.question }),
|
|
1135
|
+
/* @__PURE__ */ e(
|
|
1136
|
+
"div",
|
|
1137
|
+
{
|
|
1138
|
+
className: v(
|
|
1139
|
+
$.choices,
|
|
1140
|
+
f.length === 4 ? $.choicesGrid : void 0
|
|
1141
|
+
),
|
|
1142
|
+
"data-slot": "choices",
|
|
1143
|
+
children: f.map((d, u) => {
|
|
1144
|
+
const r = d.message ?? d.label, p = i === r;
|
|
1145
|
+
return /* @__PURE__ */ h(
|
|
1146
|
+
"button",
|
|
1147
|
+
{
|
|
1148
|
+
type: "button",
|
|
1149
|
+
"data-slot": "choice",
|
|
1150
|
+
className: v(
|
|
1151
|
+
$.choice,
|
|
1152
|
+
p ? $.answered : void 0
|
|
1153
|
+
),
|
|
1154
|
+
disabled: b,
|
|
1155
|
+
"aria-pressed": p || void 0,
|
|
1156
|
+
onClick: () => n(r, d),
|
|
1157
|
+
children: [
|
|
1158
|
+
/* @__PURE__ */ e("span", { className: $.label, "data-slot": "label", children: d.label }),
|
|
1159
|
+
d.description ? /* @__PURE__ */ e(
|
|
1160
|
+
"span",
|
|
1161
|
+
{
|
|
1162
|
+
className: $.description,
|
|
1163
|
+
"data-slot": "description",
|
|
1164
|
+
children: d.description
|
|
1165
|
+
}
|
|
1166
|
+
) : null,
|
|
1167
|
+
s == null ? void 0 : s(d)
|
|
1168
|
+
]
|
|
1169
|
+
},
|
|
1170
|
+
`${d.label}-${u}`
|
|
1171
|
+
);
|
|
1172
|
+
})
|
|
1173
|
+
}
|
|
1174
|
+
)
|
|
1175
|
+
]
|
|
1176
|
+
}
|
|
1177
|
+
);
|
|
1178
|
+
}
|
|
1179
|
+
const Fe = "DiffCard-module_card", Ge = "DiffCard-module_isResolved", qe = "DiffCard-module_title", Ke = "DiffCard-module_summary", Xe = "DiffCard-module_body", Ye = "DiffCard-module_change", Je = "DiffCard-module_changeLabel", ze = "DiffCard-module_diff", tn = "DiffCard-module_removed", en = "DiffCard-module_added", nn = "DiffCard-module_resolution", on = "DiffCard-module_actions", an = "DiffCard-module_action", sn = "DiffCard-module_accept", ln = "DiffCard-module_reject", C = {
|
|
1180
|
+
card: Fe,
|
|
1181
|
+
isResolved: Ge,
|
|
1182
|
+
title: qe,
|
|
1183
|
+
summary: Ke,
|
|
1184
|
+
body: Xe,
|
|
1185
|
+
change: Ye,
|
|
1186
|
+
changeLabel: Je,
|
|
1187
|
+
diff: ze,
|
|
1188
|
+
removed: tn,
|
|
1189
|
+
added: en,
|
|
1190
|
+
resolution: nn,
|
|
1191
|
+
actions: on,
|
|
1192
|
+
action: an,
|
|
1193
|
+
accept: sn,
|
|
1194
|
+
reject: ln
|
|
1195
|
+
};
|
|
1196
|
+
function rn(t) {
|
|
1197
|
+
return typeof t == "string" ? [] : Array.isArray(t) ? t : [t];
|
|
1198
|
+
}
|
|
1199
|
+
function cn(t, n) {
|
|
1200
|
+
const o = typeof t.original == "string" && t.original.length > 0, a = typeof t.replacement == "string" && t.replacement.length > 0;
|
|
1201
|
+
return /* @__PURE__ */ h("div", { className: C.change, "data-slot": "change", children: [
|
|
1202
|
+
t.label ? /* @__PURE__ */ e("span", { className: C.changeLabel, "data-slot": "change-label", children: t.label }) : null,
|
|
1203
|
+
o ? /* @__PURE__ */ e(
|
|
1204
|
+
"pre",
|
|
1205
|
+
{
|
|
1206
|
+
className: v(C.diff, C.removed),
|
|
1207
|
+
"data-slot": "original",
|
|
1208
|
+
children: t.original
|
|
1209
|
+
}
|
|
1210
|
+
) : null,
|
|
1211
|
+
a ? /* @__PURE__ */ e(
|
|
1212
|
+
"pre",
|
|
1213
|
+
{
|
|
1214
|
+
className: v(C.diff, C.added),
|
|
1215
|
+
"data-slot": "replacement",
|
|
1216
|
+
children: t.replacement
|
|
1217
|
+
}
|
|
1218
|
+
) : null
|
|
1219
|
+
] }, n);
|
|
1220
|
+
}
|
|
1221
|
+
function _n({
|
|
1222
|
+
diff: t,
|
|
1223
|
+
title: n,
|
|
1224
|
+
summary: o,
|
|
1225
|
+
onResolve: a,
|
|
1226
|
+
disabled: i = !1,
|
|
1227
|
+
resolved: l,
|
|
1228
|
+
acceptLabel: s,
|
|
1229
|
+
rejectLabel: b,
|
|
1230
|
+
className: f,
|
|
1231
|
+
renderDiff: d
|
|
1232
|
+
}) {
|
|
1233
|
+
const u = !!l, r = i || u, p = rn(t);
|
|
1234
|
+
let m;
|
|
1235
|
+
return d ? m = d(t) : typeof t == "string" ? m = /* @__PURE__ */ e("pre", { className: C.diff, "data-slot": "diff", children: t }) : m = p.map(cn), /* @__PURE__ */ h(
|
|
1236
|
+
"section",
|
|
1237
|
+
{
|
|
1238
|
+
className: v(
|
|
1239
|
+
C.card,
|
|
1240
|
+
u ? C.isResolved : void 0,
|
|
1241
|
+
f
|
|
1242
|
+
),
|
|
1243
|
+
"data-agenttic-diff-card": !0,
|
|
1244
|
+
"data-slot": "card",
|
|
1245
|
+
children: [
|
|
1246
|
+
n ? /* @__PURE__ */ e("p", { className: C.title, "data-slot": "title", children: n }) : null,
|
|
1247
|
+
o ? /* @__PURE__ */ e("p", { className: C.summary, "data-slot": "summary", children: o }) : null,
|
|
1248
|
+
/* @__PURE__ */ e("div", { className: C.body, "data-slot": "body", children: m }),
|
|
1249
|
+
u ? /* @__PURE__ */ e("p", { className: C.resolution, "data-slot": "resolution", children: l === "accepted" ? w("Accepted", "a8c-agenttic") : w("Rejected", "a8c-agenttic") }) : /* @__PURE__ */ h("div", { className: C.actions, "data-slot": "actions", children: [
|
|
1250
|
+
/* @__PURE__ */ e(
|
|
1251
|
+
"button",
|
|
1252
|
+
{
|
|
1253
|
+
type: "button",
|
|
1254
|
+
"data-slot": "accept",
|
|
1255
|
+
className: v(C.action, C.accept),
|
|
1256
|
+
disabled: r,
|
|
1257
|
+
onClick: () => a("accepted"),
|
|
1258
|
+
children: s ?? w("Accept", "a8c-agenttic")
|
|
1259
|
+
}
|
|
1260
|
+
),
|
|
1261
|
+
/* @__PURE__ */ e(
|
|
1262
|
+
"button",
|
|
1263
|
+
{
|
|
1264
|
+
type: "button",
|
|
1265
|
+
"data-slot": "reject",
|
|
1266
|
+
className: v(C.action, C.reject),
|
|
1267
|
+
disabled: r,
|
|
1268
|
+
onClick: () => a("rejected"),
|
|
1269
|
+
children: b ?? w("Reject", "a8c-agenttic")
|
|
1270
|
+
}
|
|
1271
|
+
)
|
|
1272
|
+
] })
|
|
1273
|
+
]
|
|
1274
|
+
}
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1277
|
+
export {
|
|
1278
|
+
Cn as A,
|
|
1279
|
+
k as B,
|
|
1280
|
+
Gt as C,
|
|
1281
|
+
Ee as D,
|
|
1282
|
+
De as N,
|
|
1283
|
+
be as P,
|
|
1284
|
+
yn as Q,
|
|
1285
|
+
ce as S,
|
|
1286
|
+
de as X,
|
|
1287
|
+
Ot as a,
|
|
1288
|
+
wt as b,
|
|
1289
|
+
v as c,
|
|
1290
|
+
vn as d,
|
|
1291
|
+
wn as e,
|
|
1292
|
+
U as f,
|
|
1293
|
+
Re as g,
|
|
1294
|
+
ve as h,
|
|
1295
|
+
Ce as i,
|
|
1296
|
+
Pe as j,
|
|
1297
|
+
Ft as k,
|
|
1298
|
+
_n as l,
|
|
1299
|
+
vt as m,
|
|
1300
|
+
bn as n,
|
|
1301
|
+
Pt as o,
|
|
1302
|
+
Et as p,
|
|
1303
|
+
J as s,
|
|
1304
|
+
T as u
|
|
1305
|
+
};
|