flowdit-chatbot-library 1.3.2 → 1.3.3
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/ChatContainer/ChatContainer.d.ts +2 -1
- package/dist/components/ChatLauncher/ChatLauncher.d.ts +2 -1
- package/dist/components/Composer/Composer.d.ts +2 -1
- package/dist/components/ComposerMenu/ComposerMenu.d.ts +2 -1
- package/dist/components/ConfirmButtons/ConfirmButtons.d.ts +2 -1
- package/dist/components/MessageBubble/MessageBubble.d.ts +2 -1
- package/dist/components/NavigationSidebar/NavigationSidebar.d.ts +2 -1
- package/dist/components/PendingMessageList/PendingMessageList.d.ts +2 -1
- package/dist/components/ThinkingIndicator/ThinkingIndicator.d.ts +2 -1
- package/dist/components/ToolInvocation/ToolInvocation.d.ts +2 -1
- package/dist/components/WelcomeScreen/WelcomeScreen.d.ts +2 -1
- package/dist/index.mjs +138 -139
- package/dist/index.umd.js +20 -20
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var F = (a, s, i) =>
|
|
4
|
-
import
|
|
5
|
-
import Ye from "react";
|
|
1
|
+
var yt = Object.defineProperty;
|
|
2
|
+
var wt = (a, s, i) => s in a ? yt(a, s, { enumerable: !0, configurable: !0, writable: !0, value: i }) : a[s] = i;
|
|
3
|
+
var F = (a, s, i) => wt(a, typeof s != "symbol" ? s + "" : s, i);
|
|
4
|
+
import W from "react";
|
|
6
5
|
var xe = { exports: {} }, H = {};
|
|
7
6
|
/**
|
|
8
7
|
* @license React
|
|
@@ -14,10 +13,10 @@ var xe = { exports: {} }, H = {};
|
|
|
14
13
|
* LICENSE file in the root directory of this source tree.
|
|
15
14
|
*/
|
|
16
15
|
var We;
|
|
17
|
-
function
|
|
16
|
+
function kt() {
|
|
18
17
|
if (We) return H;
|
|
19
18
|
We = 1;
|
|
20
|
-
var a =
|
|
19
|
+
var a = W, s = Symbol.for("react.element"), i = Symbol.for("react.fragment"), c = Object.prototype.hasOwnProperty, n = a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, u = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
21
20
|
function m(h, f, w) {
|
|
22
21
|
var p, y = {}, v = null, o = null;
|
|
23
22
|
w !== void 0 && (v = "" + w), f.key !== void 0 && (v = "" + f.key), f.ref !== void 0 && (o = f.ref);
|
|
@@ -38,9 +37,9 @@ var K = {};
|
|
|
38
37
|
* LICENSE file in the root directory of this source tree.
|
|
39
38
|
*/
|
|
40
39
|
var De;
|
|
41
|
-
function
|
|
40
|
+
function Nt() {
|
|
42
41
|
return De || (De = 1, process.env.NODE_ENV !== "production" && function() {
|
|
43
|
-
var a =
|
|
42
|
+
var a = W, s = Symbol.for("react.element"), i = Symbol.for("react.portal"), c = Symbol.for("react.fragment"), n = Symbol.for("react.strict_mode"), u = Symbol.for("react.profiler"), m = Symbol.for("react.provider"), h = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), w = Symbol.for("react.suspense"), p = Symbol.for("react.suspense_list"), y = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), o = Symbol.for("react.offscreen"), d = Symbol.iterator, C = "@@iterator";
|
|
44
43
|
function g(t) {
|
|
45
44
|
if (t === null || typeof t != "object")
|
|
46
45
|
return null;
|
|
@@ -129,11 +128,11 @@ function Ct() {
|
|
|
129
128
|
}
|
|
130
129
|
return null;
|
|
131
130
|
}
|
|
132
|
-
var
|
|
131
|
+
var D = Object.assign, q = 0, ve, ge, pe, je, be, ye, we;
|
|
133
132
|
function ke() {
|
|
134
133
|
}
|
|
135
134
|
ke.__reactDisabledLog = !0;
|
|
136
|
-
function
|
|
135
|
+
function He() {
|
|
137
136
|
{
|
|
138
137
|
if (q === 0) {
|
|
139
138
|
ve = console.log, ge = console.info, pe = console.warn, je = console.error, be = console.group, ye = console.groupCollapsed, we = console.groupEnd;
|
|
@@ -156,7 +155,7 @@ function Ct() {
|
|
|
156
155
|
q++;
|
|
157
156
|
}
|
|
158
157
|
}
|
|
159
|
-
function
|
|
158
|
+
function Ke() {
|
|
160
159
|
{
|
|
161
160
|
if (q--, q === 0) {
|
|
162
161
|
var t = {
|
|
@@ -165,25 +164,25 @@ function Ct() {
|
|
|
165
164
|
writable: !0
|
|
166
165
|
};
|
|
167
166
|
Object.defineProperties(console, {
|
|
168
|
-
log:
|
|
167
|
+
log: D({}, t, {
|
|
169
168
|
value: ve
|
|
170
169
|
}),
|
|
171
|
-
info:
|
|
170
|
+
info: D({}, t, {
|
|
172
171
|
value: ge
|
|
173
172
|
}),
|
|
174
|
-
warn:
|
|
173
|
+
warn: D({}, t, {
|
|
175
174
|
value: pe
|
|
176
175
|
}),
|
|
177
|
-
error:
|
|
176
|
+
error: D({}, t, {
|
|
178
177
|
value: je
|
|
179
178
|
}),
|
|
180
|
-
group:
|
|
179
|
+
group: D({}, t, {
|
|
181
180
|
value: be
|
|
182
181
|
}),
|
|
183
|
-
groupCollapsed:
|
|
182
|
+
groupCollapsed: D({}, t, {
|
|
184
183
|
value: ye
|
|
185
184
|
}),
|
|
186
|
-
groupEnd:
|
|
185
|
+
groupEnd: D({}, t, {
|
|
187
186
|
value: we
|
|
188
187
|
})
|
|
189
188
|
});
|
|
@@ -207,8 +206,8 @@ function Ct() {
|
|
|
207
206
|
}
|
|
208
207
|
var oe = !1, X;
|
|
209
208
|
{
|
|
210
|
-
var
|
|
211
|
-
X = new
|
|
209
|
+
var Ge = typeof WeakMap == "function" ? WeakMap : Map;
|
|
210
|
+
X = new Ge();
|
|
212
211
|
}
|
|
213
212
|
function Ne(t, r) {
|
|
214
213
|
if (!t || oe)
|
|
@@ -223,7 +222,7 @@ function Ct() {
|
|
|
223
222
|
var k = Error.prepareStackTrace;
|
|
224
223
|
Error.prepareStackTrace = void 0;
|
|
225
224
|
var T;
|
|
226
|
-
T = ie.current, ie.current = null,
|
|
225
|
+
T = ie.current, ie.current = null, He();
|
|
227
226
|
try {
|
|
228
227
|
if (r) {
|
|
229
228
|
var b = function() {
|
|
@@ -260,31 +259,31 @@ function Ct() {
|
|
|
260
259
|
if ($ && x && typeof $.stack == "string") {
|
|
261
260
|
for (var j = $.stack.split(`
|
|
262
261
|
`), S = x.stack.split(`
|
|
263
|
-
`),
|
|
264
|
-
|
|
265
|
-
for (;
|
|
266
|
-
if (j[
|
|
267
|
-
if (
|
|
262
|
+
`), R = j.length - 1, _ = S.length - 1; R >= 1 && _ >= 0 && j[R] !== S[_]; )
|
|
263
|
+
_--;
|
|
264
|
+
for (; R >= 1 && _ >= 0; R--, _--)
|
|
265
|
+
if (j[R] !== S[_]) {
|
|
266
|
+
if (R !== 1 || _ !== 1)
|
|
268
267
|
do
|
|
269
|
-
if (
|
|
268
|
+
if (R--, _--, _ < 0 || j[R] !== S[_]) {
|
|
270
269
|
var A = `
|
|
271
|
-
` + j[
|
|
270
|
+
` + j[R].replace(" at new ", " at ");
|
|
272
271
|
return t.displayName && A.includes("<anonymous>") && (A = A.replace("<anonymous>", t.displayName)), typeof t == "function" && X.set(t, A), A;
|
|
273
272
|
}
|
|
274
|
-
while (
|
|
273
|
+
while (R >= 1 && _ >= 0);
|
|
275
274
|
break;
|
|
276
275
|
}
|
|
277
276
|
}
|
|
278
277
|
} finally {
|
|
279
|
-
oe = !1, ie.current = T,
|
|
278
|
+
oe = !1, ie.current = T, Ke(), Error.prepareStackTrace = k;
|
|
280
279
|
}
|
|
281
|
-
var
|
|
282
|
-
return typeof t == "function" && X.set(t,
|
|
280
|
+
var z = t ? t.displayName || t.name : "", L = z ? G(z) : "";
|
|
281
|
+
return typeof t == "function" && X.set(t, L), L;
|
|
283
282
|
}
|
|
284
|
-
function
|
|
283
|
+
function Xe(t, r, l) {
|
|
285
284
|
return Ne(t, !1);
|
|
286
285
|
}
|
|
287
|
-
function
|
|
286
|
+
function Ze(t) {
|
|
288
287
|
var r = t.prototype;
|
|
289
288
|
return !!(r && r.isReactComponent);
|
|
290
289
|
}
|
|
@@ -292,7 +291,7 @@ function Ct() {
|
|
|
292
291
|
if (t == null)
|
|
293
292
|
return "";
|
|
294
293
|
if (typeof t == "function")
|
|
295
|
-
return Ne(t,
|
|
294
|
+
return Ne(t, Ze(t));
|
|
296
295
|
if (typeof t == "string")
|
|
297
296
|
return G(t);
|
|
298
297
|
switch (t) {
|
|
@@ -304,7 +303,7 @@ function Ct() {
|
|
|
304
303
|
if (typeof t == "object")
|
|
305
304
|
switch (t.$$typeof) {
|
|
306
305
|
case f:
|
|
307
|
-
return
|
|
306
|
+
return Xe(t.render);
|
|
308
307
|
case y:
|
|
309
308
|
return Z(t.type, r, l);
|
|
310
309
|
case v: {
|
|
@@ -325,7 +324,7 @@ function Ct() {
|
|
|
325
324
|
} else
|
|
326
325
|
Te.setExtraStackFrame(null);
|
|
327
326
|
}
|
|
328
|
-
function
|
|
327
|
+
function Qe(t, r, l, x, k) {
|
|
329
328
|
{
|
|
330
329
|
var T = Function.call.bind(U);
|
|
331
330
|
for (var b in t)
|
|
@@ -337,24 +336,24 @@ function Ct() {
|
|
|
337
336
|
throw S.name = "Invariant Violation", S;
|
|
338
337
|
}
|
|
339
338
|
j = t[b](r, b, x, l, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
340
|
-
} catch (
|
|
341
|
-
j =
|
|
339
|
+
} catch (R) {
|
|
340
|
+
j = R;
|
|
342
341
|
}
|
|
343
342
|
j && !(j instanceof Error) && (Q(k), N("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", x || "React class", l, b, typeof j), Q(null)), j instanceof Error && !(j.message in Ce) && (Ce[j.message] = !0, Q(k), N("Failed %s type: %s", l, j.message), Q(null));
|
|
344
343
|
}
|
|
345
344
|
}
|
|
346
345
|
}
|
|
347
|
-
var
|
|
346
|
+
var et = Array.isArray;
|
|
348
347
|
function ce(t) {
|
|
349
|
-
return
|
|
348
|
+
return et(t);
|
|
350
349
|
}
|
|
351
|
-
function
|
|
350
|
+
function tt(t) {
|
|
352
351
|
{
|
|
353
352
|
var r = typeof Symbol == "function" && Symbol.toStringTag, l = r && t[Symbol.toStringTag] || t.constructor.name || "Object";
|
|
354
353
|
return l;
|
|
355
354
|
}
|
|
356
355
|
}
|
|
357
|
-
function
|
|
356
|
+
function st(t) {
|
|
358
357
|
try {
|
|
359
358
|
return Ee(t), !1;
|
|
360
359
|
} catch {
|
|
@@ -364,17 +363,17 @@ function Ct() {
|
|
|
364
363
|
function Ee(t) {
|
|
365
364
|
return "" + t;
|
|
366
365
|
}
|
|
367
|
-
function
|
|
368
|
-
if (
|
|
369
|
-
return N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
366
|
+
function Re(t) {
|
|
367
|
+
if (st(t))
|
|
368
|
+
return N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", tt(t)), Ee(t);
|
|
370
369
|
}
|
|
371
|
-
var
|
|
370
|
+
var _e = E.ReactCurrentOwner, nt = {
|
|
372
371
|
key: !0,
|
|
373
372
|
ref: !0,
|
|
374
373
|
__self: !0,
|
|
375
374
|
__source: !0
|
|
376
375
|
}, Se, Oe;
|
|
377
|
-
function
|
|
376
|
+
function rt(t) {
|
|
378
377
|
if (U.call(t, "ref")) {
|
|
379
378
|
var r = Object.getOwnPropertyDescriptor(t, "ref").get;
|
|
380
379
|
if (r && r.isReactWarning)
|
|
@@ -382,7 +381,7 @@ function Ct() {
|
|
|
382
381
|
}
|
|
383
382
|
return t.ref !== void 0;
|
|
384
383
|
}
|
|
385
|
-
function
|
|
384
|
+
function it(t) {
|
|
386
385
|
if (U.call(t, "key")) {
|
|
387
386
|
var r = Object.getOwnPropertyDescriptor(t, "key").get;
|
|
388
387
|
if (r && r.isReactWarning)
|
|
@@ -390,10 +389,10 @@ function Ct() {
|
|
|
390
389
|
}
|
|
391
390
|
return t.key !== void 0;
|
|
392
391
|
}
|
|
393
|
-
function
|
|
394
|
-
typeof t.ref == "string" &&
|
|
392
|
+
function at(t, r) {
|
|
393
|
+
typeof t.ref == "string" && _e.current;
|
|
395
394
|
}
|
|
396
|
-
function
|
|
395
|
+
function ot(t, r) {
|
|
397
396
|
{
|
|
398
397
|
var l = function() {
|
|
399
398
|
Se || (Se = !0, N("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
@@ -404,7 +403,7 @@ function Ct() {
|
|
|
404
403
|
});
|
|
405
404
|
}
|
|
406
405
|
}
|
|
407
|
-
function
|
|
406
|
+
function ct(t, r) {
|
|
408
407
|
{
|
|
409
408
|
var l = function() {
|
|
410
409
|
Oe || (Oe = !0, N("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", r));
|
|
@@ -415,7 +414,7 @@ function Ct() {
|
|
|
415
414
|
});
|
|
416
415
|
}
|
|
417
416
|
}
|
|
418
|
-
var
|
|
417
|
+
var lt = function(t, r, l, x, k, T, b) {
|
|
419
418
|
var j = {
|
|
420
419
|
// This tag allows us to uniquely identify this as a React Element
|
|
421
420
|
$$typeof: s,
|
|
@@ -444,26 +443,26 @@ function Ct() {
|
|
|
444
443
|
value: k
|
|
445
444
|
}), Object.freeze && (Object.freeze(j.props), Object.freeze(j)), j;
|
|
446
445
|
};
|
|
447
|
-
function
|
|
446
|
+
function dt(t, r, l, x, k) {
|
|
448
447
|
{
|
|
449
448
|
var T, b = {}, j = null, S = null;
|
|
450
|
-
l !== void 0 && (
|
|
449
|
+
l !== void 0 && (Re(l), j = "" + l), it(r) && (Re(r.key), j = "" + r.key), rt(r) && (S = r.ref, at(r, k));
|
|
451
450
|
for (T in r)
|
|
452
|
-
U.call(r, T) && !
|
|
451
|
+
U.call(r, T) && !nt.hasOwnProperty(T) && (b[T] = r[T]);
|
|
453
452
|
if (t && t.defaultProps) {
|
|
454
|
-
var
|
|
455
|
-
for (T in
|
|
456
|
-
b[T] === void 0 && (b[T] =
|
|
453
|
+
var R = t.defaultProps;
|
|
454
|
+
for (T in R)
|
|
455
|
+
b[T] === void 0 && (b[T] = R[T]);
|
|
457
456
|
}
|
|
458
457
|
if (j || S) {
|
|
459
|
-
var
|
|
460
|
-
j &&
|
|
458
|
+
var _ = typeof t == "function" ? t.displayName || t.name || "Unknown" : t;
|
|
459
|
+
j && ot(b, _), S && ct(b, _);
|
|
461
460
|
}
|
|
462
|
-
return
|
|
461
|
+
return lt(t, j, S, k, x, _e.current, b);
|
|
463
462
|
}
|
|
464
463
|
}
|
|
465
464
|
var le = E.ReactCurrentOwner, $e = E.ReactDebugCurrentFrame;
|
|
466
|
-
function
|
|
465
|
+
function J(t) {
|
|
467
466
|
if (t) {
|
|
468
467
|
var r = t._owner, l = Z(t.type, t._source, r ? r.type : null);
|
|
469
468
|
$e.setExtraStackFrame(l);
|
|
@@ -487,11 +486,11 @@ Check the render method of \`` + t + "`.";
|
|
|
487
486
|
return "";
|
|
488
487
|
}
|
|
489
488
|
}
|
|
490
|
-
function
|
|
489
|
+
function ut(t) {
|
|
491
490
|
return "";
|
|
492
491
|
}
|
|
493
492
|
var Pe = {};
|
|
494
|
-
function
|
|
493
|
+
function ht(t) {
|
|
495
494
|
{
|
|
496
495
|
var r = Ae();
|
|
497
496
|
if (!r) {
|
|
@@ -508,12 +507,12 @@ Check the top-level render call using <` + l + ">.");
|
|
|
508
507
|
if (!t._store || t._store.validated || t.key != null)
|
|
509
508
|
return;
|
|
510
509
|
t._store.validated = !0;
|
|
511
|
-
var l =
|
|
510
|
+
var l = ht(r);
|
|
512
511
|
if (Pe[l])
|
|
513
512
|
return;
|
|
514
513
|
Pe[l] = !0;
|
|
515
514
|
var x = "";
|
|
516
|
-
t && t._owner && t._owner !== le.current && (x = " It was passed a child from " + I(t._owner.type) + "."),
|
|
515
|
+
t && t._owner && t._owner !== le.current && (x = " It was passed a child from " + I(t._owner.type) + "."), J(t), N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', l, x), J(null);
|
|
517
516
|
}
|
|
518
517
|
}
|
|
519
518
|
function Me(t, r) {
|
|
@@ -535,7 +534,7 @@ Check the top-level render call using <` + l + ">.");
|
|
|
535
534
|
}
|
|
536
535
|
}
|
|
537
536
|
}
|
|
538
|
-
function
|
|
537
|
+
function ft(t) {
|
|
539
538
|
{
|
|
540
539
|
var r = t.type;
|
|
541
540
|
if (r == null || typeof r == "string")
|
|
@@ -551,7 +550,7 @@ Check the top-level render call using <` + l + ">.");
|
|
|
551
550
|
return;
|
|
552
551
|
if (l) {
|
|
553
552
|
var x = I(r);
|
|
554
|
-
|
|
553
|
+
Qe(l, t.props, "prop", x, t);
|
|
555
554
|
} else if (r.PropTypes !== void 0 && !de) {
|
|
556
555
|
de = !0;
|
|
557
556
|
var k = I(r);
|
|
@@ -560,16 +559,16 @@ Check the top-level render call using <` + l + ">.");
|
|
|
560
559
|
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
561
560
|
}
|
|
562
561
|
}
|
|
563
|
-
function
|
|
562
|
+
function xt(t) {
|
|
564
563
|
{
|
|
565
564
|
for (var r = Object.keys(t.props), l = 0; l < r.length; l++) {
|
|
566
565
|
var x = r[l];
|
|
567
566
|
if (x !== "children" && x !== "key") {
|
|
568
|
-
|
|
567
|
+
J(t), N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", x), J(null);
|
|
569
568
|
break;
|
|
570
569
|
}
|
|
571
570
|
}
|
|
572
|
-
t.ref !== null && (
|
|
571
|
+
t.ref !== null && (J(t), N("Invalid attribute `ref` supplied to `React.Fragment`."), J(null));
|
|
573
572
|
}
|
|
574
573
|
}
|
|
575
574
|
var Ie = {};
|
|
@@ -579,21 +578,21 @@ Check the top-level render call using <` + l + ">.");
|
|
|
579
578
|
if (!b) {
|
|
580
579
|
var j = "";
|
|
581
580
|
(t === void 0 || typeof t == "object" && t !== null && Object.keys(t).length === 0) && (j += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
582
|
-
var S =
|
|
581
|
+
var S = ut();
|
|
583
582
|
S ? j += S : j += Ae();
|
|
584
|
-
var
|
|
585
|
-
t === null ?
|
|
583
|
+
var R;
|
|
584
|
+
t === null ? R = "null" : ce(t) ? R = "array" : t !== void 0 && t.$$typeof === s ? (R = "<" + (I(t.type) || "Unknown") + " />", j = " Did you accidentally export a JSX literal instead of a component?") : R = typeof t, N("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", R, j);
|
|
586
585
|
}
|
|
587
|
-
var
|
|
588
|
-
if (
|
|
589
|
-
return
|
|
586
|
+
var _ = dt(t, r, l, k, T);
|
|
587
|
+
if (_ == null)
|
|
588
|
+
return _;
|
|
590
589
|
if (b) {
|
|
591
590
|
var A = r.children;
|
|
592
591
|
if (A !== void 0)
|
|
593
592
|
if (x)
|
|
594
593
|
if (ce(A)) {
|
|
595
|
-
for (var
|
|
596
|
-
Me(A[
|
|
594
|
+
for (var z = 0; z < A.length; z++)
|
|
595
|
+
Me(A[z], t);
|
|
597
596
|
Object.freeze && Object.freeze(A);
|
|
598
597
|
} else
|
|
599
598
|
N("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
@@ -601,35 +600,35 @@ Check the top-level render call using <` + l + ">.");
|
|
|
601
600
|
Me(A, t);
|
|
602
601
|
}
|
|
603
602
|
if (U.call(r, "key")) {
|
|
604
|
-
var
|
|
605
|
-
return
|
|
603
|
+
var L = I(t), $ = Object.keys(r).filter(function(bt) {
|
|
604
|
+
return bt !== "key";
|
|
606
605
|
}), he = $.length > 0 ? "{key: someKey, " + $.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
607
|
-
if (!Ie[
|
|
608
|
-
var
|
|
606
|
+
if (!Ie[L + he]) {
|
|
607
|
+
var jt = $.length > 0 ? "{" + $.join(": ..., ") + ": ...}" : "{}";
|
|
609
608
|
N(`A props object containing a "key" prop is being spread into JSX:
|
|
610
609
|
let props = %s;
|
|
611
610
|
<%s {...props} />
|
|
612
611
|
React keys must be passed directly to JSX without using spread:
|
|
613
612
|
let props = %s;
|
|
614
|
-
<%s key={someKey} {...props} />`, he,
|
|
613
|
+
<%s key={someKey} {...props} />`, he, L, jt, L), Ie[L + he] = !0;
|
|
615
614
|
}
|
|
616
615
|
}
|
|
617
|
-
return t === c ?
|
|
616
|
+
return t === c ? xt(_) : ft(_), _;
|
|
618
617
|
}
|
|
619
618
|
}
|
|
620
|
-
function
|
|
619
|
+
function mt(t, r, l) {
|
|
621
620
|
return Fe(t, r, l, !0);
|
|
622
621
|
}
|
|
623
|
-
function
|
|
622
|
+
function vt(t, r, l) {
|
|
624
623
|
return Fe(t, r, l, !1);
|
|
625
624
|
}
|
|
626
|
-
var
|
|
627
|
-
K.Fragment = c, K.jsx =
|
|
625
|
+
var gt = vt, pt = mt;
|
|
626
|
+
K.Fragment = c, K.jsx = gt, K.jsxs = pt;
|
|
628
627
|
}()), K;
|
|
629
628
|
}
|
|
630
|
-
process.env.NODE_ENV === "production" ? xe.exports =
|
|
629
|
+
process.env.NODE_ENV === "production" ? xe.exports = kt() : xe.exports = Nt();
|
|
631
630
|
var e = xe.exports;
|
|
632
|
-
const
|
|
631
|
+
const Ct = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-chat-launcher", onClick: a, children: /* @__PURE__ */ e.jsx("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e.jsx("path", { d: "M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z" }) }) }), { useState: ee, useEffect: Tt, useRef: Le, useLayoutEffect: Je } = W, Dt = ({
|
|
633
632
|
mode: a = "floating",
|
|
634
633
|
isOpen: s = !0,
|
|
635
634
|
embedded: i = !1,
|
|
@@ -644,7 +643,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
644
643
|
const [p, y] = ee(!1), [v, o] = ee(!1), d = f !== void 0 ? f : v, C = (M) => {
|
|
645
644
|
o(M), w == null || w(M);
|
|
646
645
|
}, [g, E] = ee(!1), N = Le(null), [O, B] = ee(!0);
|
|
647
|
-
|
|
646
|
+
Tt(() => {
|
|
648
647
|
y(!0);
|
|
649
648
|
}, []);
|
|
650
649
|
const P = () => {
|
|
@@ -664,7 +663,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
664
663
|
return M.observe(V.current), () => M.disconnect();
|
|
665
664
|
}, [O]), !p) return null;
|
|
666
665
|
if (!s && a === "floating" && !i)
|
|
667
|
-
return /* @__PURE__ */ e.jsx(
|
|
666
|
+
return /* @__PURE__ */ e.jsx(Ct, { onClick: () => n == null ? void 0 : n() });
|
|
668
667
|
const se = [
|
|
669
668
|
"cb-chat-container",
|
|
670
669
|
`cb-mode-${a}`,
|
|
@@ -712,7 +711,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
712
711
|
] })
|
|
713
712
|
] })
|
|
714
713
|
] });
|
|
715
|
-
}, { useState: ze } =
|
|
714
|
+
}, { useState: ze } = W, Et = ({
|
|
716
715
|
onClose: a,
|
|
717
716
|
webSearchEnabled: s = !1,
|
|
718
717
|
onWebSearchChange: i,
|
|
@@ -842,7 +841,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
842
841
|
] }),
|
|
843
842
|
/* @__PURE__ */ e.jsx("span", { className: "cb-menu-title", children: "More formatting" })
|
|
844
843
|
] })
|
|
845
|
-
] }) }) }), { useState: Ve, useRef:
|
|
844
|
+
] }) }) }), { useState: Ve, useRef: _t, useEffect: St } = W, Lt = ({
|
|
846
845
|
onSend: a,
|
|
847
846
|
disabled: s = !1,
|
|
848
847
|
placeholder: i = "Ask, @mention, or / for actions",
|
|
@@ -851,8 +850,8 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
851
850
|
pageContextEnabled: u = !1,
|
|
852
851
|
onPageContextChange: m
|
|
853
852
|
}) => {
|
|
854
|
-
const [h, f] = Ve(""), [w, p] = Ve(null), y =
|
|
855
|
-
|
|
853
|
+
const [h, f] = Ve(""), [w, p] = Ve(null), y = _t(null);
|
|
854
|
+
St(() => {
|
|
856
855
|
const d = (C) => {
|
|
857
856
|
y.current && !y.current.contains(C.target) && p(null);
|
|
858
857
|
};
|
|
@@ -865,7 +864,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
865
864
|
};
|
|
866
865
|
return /* @__PURE__ */ e.jsxs("div", { className: "cb-composer", ref: y, children: [
|
|
867
866
|
w === "reasoning" && /* @__PURE__ */ e.jsx(
|
|
868
|
-
|
|
867
|
+
Et,
|
|
869
868
|
{
|
|
870
869
|
onClose: () => p(null),
|
|
871
870
|
webSearchEnabled: c,
|
|
@@ -944,13 +943,13 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
944
943
|
] }),
|
|
945
944
|
/* @__PURE__ */ e.jsx("div", { className: "cb-composer-footer", children: /* @__PURE__ */ e.jsx("span", { children: "Uses AI. Verify results." }) })
|
|
946
945
|
] });
|
|
947
|
-
}, { useState:
|
|
946
|
+
}, { useState: Ot } = W, Ye = ({
|
|
948
947
|
toolName: a,
|
|
949
948
|
status: s,
|
|
950
949
|
args: i,
|
|
951
950
|
result: c
|
|
952
951
|
}) => {
|
|
953
|
-
const [n, u] =
|
|
952
|
+
const [n, u] = Ot(!1), m = a === "web_search" || a === "search_web";
|
|
954
953
|
return /* @__PURE__ */ e.jsxs("div", { className: `cb-tool-invocation ${s}`, children: [
|
|
955
954
|
/* @__PURE__ */ e.jsxs("div", { className: "cb-tool-header", onClick: () => u(!n), children: [
|
|
956
955
|
/* @__PURE__ */ e.jsx("div", { className: "cb-tool-icon", children: s === "running" ? /* @__PURE__ */ e.jsx("div", { className: "cb-spinner-sm" }) : /* @__PURE__ */ e.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", className: "cb-icon-check", children: /* @__PURE__ */ e.jsx("polyline", { points: "20 6 9 17 4 12" }) }) }),
|
|
@@ -984,7 +983,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
984
983
|
] })
|
|
985
984
|
] }) })
|
|
986
985
|
] });
|
|
987
|
-
},
|
|
986
|
+
}, $t = ({
|
|
988
987
|
toolCallId: a,
|
|
989
988
|
label: s,
|
|
990
989
|
description: i,
|
|
@@ -1044,7 +1043,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1044
1043
|
}
|
|
1045
1044
|
)
|
|
1046
1045
|
] })
|
|
1047
|
-
] }), { useState: me, useEffect:
|
|
1046
|
+
] }), { useState: me, useEffect: qe, useRef: Ue } = W, Jt = (a) => {
|
|
1048
1047
|
const {
|
|
1049
1048
|
role: s,
|
|
1050
1049
|
steps: i,
|
|
@@ -1062,13 +1061,13 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1062
1061
|
/* @__PURE__ */ e.jsx("div", { className: "cb-steps-container", children: i.map((n, u) => {
|
|
1063
1062
|
const m = u === i.length - 1;
|
|
1064
1063
|
return n.type === "thinking" ? /* @__PURE__ */ e.jsx(
|
|
1065
|
-
|
|
1064
|
+
At,
|
|
1066
1065
|
{
|
|
1067
1066
|
step: n
|
|
1068
1067
|
},
|
|
1069
1068
|
n.id
|
|
1070
1069
|
) : n.type === "tool-call" ? /* @__PURE__ */ e.jsx("div", { className: "cb-step-tool", style: { marginBottom: 8 }, children: /* @__PURE__ */ e.jsx(
|
|
1071
|
-
|
|
1070
|
+
Ye,
|
|
1072
1071
|
{
|
|
1073
1072
|
toolName: n.toolName || "Tool",
|
|
1074
1073
|
args: n.toolArgs,
|
|
@@ -1076,7 +1075,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1076
1075
|
result: n.toolResult
|
|
1077
1076
|
}
|
|
1078
1077
|
) }, n.id) : n.type === "confirm-request" ? /* @__PURE__ */ e.jsx("div", { className: "cb-step-confirm", style: { marginBottom: 8 }, children: /* @__PURE__ */ e.jsx(
|
|
1079
|
-
|
|
1078
|
+
$t,
|
|
1080
1079
|
{
|
|
1081
1080
|
toolCallId: n.toolCallId || n.id,
|
|
1082
1081
|
toolName: n.toolName || "Tool",
|
|
@@ -1089,7 +1088,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1089
1088
|
})
|
|
1090
1089
|
}
|
|
1091
1090
|
) }, n.id) : n.type === "text" ? /* @__PURE__ */ e.jsx("div", { className: `cb-message-bubble ${s}`, style: { marginBottom: 8, maxWidth: "100%" }, children: /* @__PURE__ */ e.jsx(
|
|
1092
|
-
|
|
1091
|
+
Pt,
|
|
1093
1092
|
{
|
|
1094
1093
|
content: n.content || "",
|
|
1095
1094
|
shouldAnimate: c && m,
|
|
@@ -1098,8 +1097,8 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1098
1097
|
) }, n.id) : null;
|
|
1099
1098
|
}) })
|
|
1100
1099
|
] })
|
|
1101
|
-
] }) : /* @__PURE__ */ e.jsx(
|
|
1102
|
-
},
|
|
1100
|
+
] }) : /* @__PURE__ */ e.jsx(Bt, { ...a });
|
|
1101
|
+
}, At = ({ step: a }) => {
|
|
1103
1102
|
const [s, i] = me(!1), c = a.isFinished;
|
|
1104
1103
|
return /* @__PURE__ */ e.jsxs("div", { className: "cb-step-thinking-block", style: { marginBottom: 8, border: "1px solid rgba(255,255,255,0.1)", borderRadius: 8, overflow: "hidden" }, children: [
|
|
1105
1104
|
/* @__PURE__ */ e.jsxs(
|
|
@@ -1145,9 +1144,9 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1145
1144
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
1146
1145
|
` })
|
|
1147
1146
|
] });
|
|
1148
|
-
},
|
|
1149
|
-
const [c, n] = me(s ? "" : a), u =
|
|
1150
|
-
return
|
|
1147
|
+
}, Pt = ({ content: a, shouldAnimate: s, onComplete: i }) => {
|
|
1148
|
+
const [c, n] = me(s ? "" : a), u = Ue(!1);
|
|
1149
|
+
return qe(() => {
|
|
1151
1150
|
if (u.current = !1, !s || !a) {
|
|
1152
1151
|
n(a), u.current || (u.current = !0, i == null || i());
|
|
1153
1152
|
return;
|
|
@@ -1166,15 +1165,15 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1166
1165
|
c,
|
|
1167
1166
|
s && a && c.length < a.length && /* @__PURE__ */ e.jsx("span", { className: "cb-cursor", children: "|" })
|
|
1168
1167
|
] });
|
|
1169
|
-
},
|
|
1168
|
+
}, Bt = (a) => {
|
|
1170
1169
|
const {
|
|
1171
1170
|
role: s,
|
|
1172
1171
|
content: i,
|
|
1173
1172
|
attachments: c,
|
|
1174
1173
|
toolInvocation: n,
|
|
1175
1174
|
shouldAnimate: u = !0
|
|
1176
|
-
} = a, [m, h] = me(""), f =
|
|
1177
|
-
return
|
|
1175
|
+
} = a, [m, h] = me(""), f = Ue(!1);
|
|
1176
|
+
return qe(() => {
|
|
1178
1177
|
var C;
|
|
1179
1178
|
if (f.current = !1, s !== "assistant" || !i || !u) {
|
|
1180
1179
|
h(i || ""), f.current || (f.current = !0, (C = a.onAnimationComplete) == null || C.call(a));
|
|
@@ -1195,7 +1194,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1195
1194
|
}, [i, s, u]), n ? /* @__PURE__ */ e.jsxs("div", { className: "cb-message-row cb-row-assistant", style: { marginBottom: "8px" }, children: [
|
|
1196
1195
|
/* @__PURE__ */ e.jsx("div", { className: "cb-avatar-container", children: /* @__PURE__ */ e.jsx("div", { className: "cb-avatar-assistant", style: { background: "#333" }, children: /* @__PURE__ */ e.jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ e.jsx("path", { d: "M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z" }) }) }) }),
|
|
1197
1196
|
/* @__PURE__ */ e.jsx("div", { className: "cb-message-content-wrapper", children: /* @__PURE__ */ e.jsx(
|
|
1198
|
-
|
|
1197
|
+
Ye,
|
|
1199
1198
|
{
|
|
1200
1199
|
toolName: n.toolName,
|
|
1201
1200
|
args: n.args,
|
|
@@ -1221,14 +1220,14 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1221
1220
|
] })
|
|
1222
1221
|
] })
|
|
1223
1222
|
] });
|
|
1224
|
-
},
|
|
1223
|
+
}, zt = () => /* @__PURE__ */ e.jsxs("div", { className: "cb-thinking-container", children: [
|
|
1225
1224
|
/* @__PURE__ */ e.jsxs("div", { className: "cb-thinking-dots", children: [
|
|
1226
1225
|
/* @__PURE__ */ e.jsx("div", { className: "cb-dot" }),
|
|
1227
1226
|
/* @__PURE__ */ e.jsx("div", { className: "cb-dot" }),
|
|
1228
1227
|
/* @__PURE__ */ e.jsx("div", { className: "cb-dot" })
|
|
1229
1228
|
] }),
|
|
1230
1229
|
/* @__PURE__ */ e.jsx("span", { className: "cb-thinking-text", children: "Thinking..." })
|
|
1231
|
-
] }),
|
|
1230
|
+
] }), Vt = ({
|
|
1232
1231
|
userName: a = "User",
|
|
1233
1232
|
actions: s = []
|
|
1234
1233
|
}) => /* @__PURE__ */ e.jsxs("div", { className: "cb-welcome-container", children: [
|
|
@@ -1247,7 +1246,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1247
1246
|
/* @__PURE__ */ e.jsx("div", { className: "cb-action-icon", children: i.icon }),
|
|
1248
1247
|
/* @__PURE__ */ e.jsx("span", { className: "cb-action-label", children: i.label })
|
|
1249
1248
|
] }, i.id)) })
|
|
1250
|
-
] }),
|
|
1249
|
+
] }), Yt = ({
|
|
1251
1250
|
onNewChat: a,
|
|
1252
1251
|
agents: s,
|
|
1253
1252
|
chatHistory: i
|
|
@@ -1289,8 +1288,8 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1289
1288
|
/* @__PURE__ */ e.jsx("span", { className: "cb-item-label", children: "View all conversations" })
|
|
1290
1289
|
] })
|
|
1291
1290
|
] })
|
|
1292
|
-
] }), { useState:
|
|
1293
|
-
const [i, c] =
|
|
1291
|
+
] }), { useState: Mt } = W, qt = ({ queue: a, onDelete: s }) => {
|
|
1292
|
+
const [i, c] = Mt(!1);
|
|
1294
1293
|
if (a.length === 0) return null;
|
|
1295
1294
|
const n = () => c(!i);
|
|
1296
1295
|
return /* @__PURE__ */ e.jsxs("div", { className: `cb-pending-messages ${i ? "expanded" : "collapsed"}`, children: [
|
|
@@ -1323,7 +1322,7 @@ const Tt = ({ onClick: a }) => /* @__PURE__ */ e.jsx("button", { className: "cb-
|
|
|
1323
1322
|
] }, m)) })
|
|
1324
1323
|
] });
|
|
1325
1324
|
}, fe = "http://localhost:8000/api";
|
|
1326
|
-
class
|
|
1325
|
+
class Ut {
|
|
1327
1326
|
constructor(s) {
|
|
1328
1327
|
F(this, "accessToken", null);
|
|
1329
1328
|
F(this, "messages", []);
|
|
@@ -1720,14 +1719,14 @@ class Ht {
|
|
|
1720
1719
|
}), n);
|
|
1721
1720
|
}
|
|
1722
1721
|
}
|
|
1723
|
-
const
|
|
1724
|
-
class
|
|
1722
|
+
const It = "http://localhost:11700";
|
|
1723
|
+
class Ht {
|
|
1725
1724
|
/**
|
|
1726
1725
|
* Fetches a new access token from the auth broker.
|
|
1727
1726
|
*/
|
|
1728
1727
|
static async getInitialToken() {
|
|
1729
1728
|
try {
|
|
1730
|
-
const s = await fetch(`${
|
|
1729
|
+
const s = await fetch(`${It}/request-token`, {
|
|
1731
1730
|
method: "POST",
|
|
1732
1731
|
headers: {
|
|
1733
1732
|
"Content-Type": "application/json"
|
|
@@ -1751,16 +1750,16 @@ class Kt {
|
|
|
1751
1750
|
}
|
|
1752
1751
|
}
|
|
1753
1752
|
export {
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1753
|
+
Ht as AuthClient,
|
|
1754
|
+
Dt as ChatContainer,
|
|
1755
|
+
Ct as ChatLauncher,
|
|
1756
|
+
Lt as Composer,
|
|
1757
|
+
$t as ConfirmButtons,
|
|
1758
|
+
Jt as MessageBubble,
|
|
1759
|
+
Yt as NavigationSidebar,
|
|
1760
|
+
qt as PendingMessageList,
|
|
1761
|
+
Ut as RealChatClient,
|
|
1762
|
+
zt as ThinkingIndicator,
|
|
1763
|
+
Ye as ToolInvocation,
|
|
1764
|
+
Vt as WelcomeScreen
|
|
1766
1765
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(_,
|
|
1
|
+
(function(_,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],S):(_=typeof globalThis<"u"?globalThis:_||self,S(_.ChatbotUI={},_.React))})(this,function(_,S){"use strict";var qt=Object.defineProperty;var Ut=(_,S,F)=>S in _?qt(_,S,{enumerable:!0,configurable:!0,writable:!0,value:F}):_[S]=F;var L=(_,S,F)=>Ut(_,typeof S!="symbol"?S+"":S,F);var F={exports:{}},q={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var pe;function Xe(){if(pe)return q;pe=1;var o=S,s=Symbol.for("react.element"),i=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,n=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,u={key:!0,ref:!0,__self:!0,__source:!0};function m(h,f,w){var p,y={},v=null,a=null;w!==void 0&&(v=""+w),f.key!==void 0&&(v=""+f.key),f.ref!==void 0&&(a=f.ref);for(p in f)c.call(f,p)&&!u.hasOwnProperty(p)&&(y[p]=f[p]);if(h&&h.defaultProps)for(p in f=h.defaultProps,f)y[p]===void 0&&(y[p]=f[p]);return{$$typeof:s,type:h,key:v,ref:a,props:y,_owner:n.current}}return q.Fragment=i,q.jsx=m,q.jsxs=m,q}var U={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,22 +14,22 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+
|
|
17
|
+
*/var je;function Ze(){return je||(je=1,process.env.NODE_ENV!=="production"&&function(){var o=S,s=Symbol.for("react.element"),i=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),m=Symbol.for("react.provider"),h=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),y=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),a=Symbol.for("react.offscreen"),d=Symbol.iterator,C="@@iterator";function g(t){if(t===null||typeof t!="object")return null;var r=d&&t[d]||t[C];return typeof r=="function"?r:null}var E=o.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function N(t){{for(var r=arguments.length,l=new Array(r>1?r-1:0),x=1;x<r;x++)l[x-1]=arguments[x];A("error",t,l)}}function A(t,r,l){{var x=E.ReactDebugCurrentFrame,k=x.getStackAddendum();k!==""&&(r+="%s",l=l.concat([k]));var T=l.map(function(b){return String(b)});T.unshift("Warning: "+r),Function.prototype.apply.call(console[t],console,T)}}var I=!1,M=!1,ae=!1,H=!1,oe=!1,W;W=Symbol.for("react.module.reference");function ce(t){return!!(typeof t=="string"||typeof t=="function"||t===c||t===u||oe||t===n||t===w||t===p||H||t===a||I||M||ae||typeof t=="object"&&t!==null&&(t.$$typeof===v||t.$$typeof===y||t.$$typeof===m||t.$$typeof===h||t.$$typeof===f||t.$$typeof===W||t.getModuleId!==void 0))}function le(t,r,l){var x=t.displayName;if(x)return x;var k=r.displayName||r.name||"";return k!==""?l+"("+k+")":l}function K(t){return t.displayName||"Context"}function D(t){if(t==null)return null;if(typeof t.tag=="number"&&N("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case c:return"Fragment";case i:return"Portal";case u:return"Profiler";case n:return"StrictMode";case w:return"Suspense";case p:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case h:var r=t;return K(r)+".Consumer";case m:var l=t;return K(l._context)+".Provider";case f:return le(t,t.render,"ForwardRef");case y:var x=t.displayName||null;return x!==null?x:D(t.type)||"Memo";case v:{var k=t,T=k._payload,b=k._init;try{return D(b(T))}catch{return null}}}return null}var J=Object.assign,G=0,_e,Re,Se,Oe,$e,Ae,Pe;function Be(){}Be.__reactDisabledLog=!0;function jt(){{if(G===0){_e=console.log,Re=console.info,Se=console.warn,Oe=console.error,$e=console.group,Ae=console.groupCollapsed,Pe=console.groupEnd;var t={configurable:!0,enumerable:!0,value:Be,writable:!0};Object.defineProperties(console,{info:t,log:t,warn:t,error:t,group:t,groupCollapsed:t,groupEnd:t})}G++}}function bt(){{if(G--,G===0){var t={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:J({},t,{value:_e}),info:J({},t,{value:Re}),warn:J({},t,{value:Se}),error:J({},t,{value:Oe}),group:J({},t,{value:$e}),groupCollapsed:J({},t,{value:Ae}),groupEnd:J({},t,{value:Pe})})}G<0&&N("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var de=E.ReactCurrentDispatcher,ue;function Q(t,r,l){{if(ue===void 0)try{throw Error()}catch(k){var x=k.stack.trim().match(/\n( *(at )?)/);ue=x&&x[1]||""}return`
|
|
18
|
+
`+ue+t}}var he=!1,ee;{var yt=typeof WeakMap=="function"?WeakMap:Map;ee=new yt}function Me(t,r){if(!t||he)return"";{var l=ee.get(t);if(l!==void 0)return l}var x;he=!0;var k=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var T;T=de.current,de.current=null,jt();try{if(r){var b=function(){throw Error()};if(Object.defineProperty(b.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(b,[])}catch(P){x=P}Reflect.construct(t,[],b)}else{try{b.call()}catch(P){x=P}t.call(b.prototype)}}else{try{throw Error()}catch(P){x=P}t()}}catch(P){if(P&&x&&typeof P.stack=="string"){for(var j=P.stack.split(`
|
|
19
19
|
`),$=x.stack.split(`
|
|
20
|
-
`),R=
|
|
21
|
-
`+
|
|
20
|
+
`),R=j.length-1,O=$.length-1;R>=1&&O>=0&&j[R]!==$[O];)O--;for(;R>=1&&O>=0;R--,O--)if(j[R]!==$[O]){if(R!==1||O!==1)do if(R--,O--,O<0||j[R]!==$[O]){var B=`
|
|
21
|
+
`+j[R].replace(" at new "," at ");return t.displayName&&B.includes("<anonymous>")&&(B=B.replace("<anonymous>",t.displayName)),typeof t=="function"&&ee.set(t,B),B}while(R>=1&&O>=0);break}}}finally{he=!1,de.current=T,bt(),Error.prepareStackTrace=k}var Y=t?t.displayName||t.name:"",z=Y?Q(Y):"";return typeof t=="function"&&ee.set(t,z),z}function wt(t,r,l){return Me(t,!1)}function kt(t){var r=t.prototype;return!!(r&&r.isReactComponent)}function te(t,r,l){if(t==null)return"";if(typeof t=="function")return Me(t,kt(t));if(typeof t=="string")return Q(t);switch(t){case w:return Q("Suspense");case p:return Q("SuspenseList")}if(typeof t=="object")switch(t.$$typeof){case f:return wt(t.render);case y:return te(t.type,r,l);case v:{var x=t,k=x._payload,T=x._init;try{return te(T(k),r,l)}catch{}}}return""}var X=Object.prototype.hasOwnProperty,Ie={},We=E.ReactDebugCurrentFrame;function se(t){if(t){var r=t._owner,l=te(t.type,t._source,r?r.type:null);We.setExtraStackFrame(l)}else We.setExtraStackFrame(null)}function Nt(t,r,l,x,k){{var T=Function.call.bind(X);for(var b in t)if(T(t,b)){var j=void 0;try{if(typeof t[b]!="function"){var $=Error((x||"React class")+": "+l+" type `"+b+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof t[b]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw $.name="Invariant Violation",$}j=t[b](r,b,x,l,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(R){j=R}j&&!(j instanceof Error)&&(se(k),N("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",x||"React class",l,b,typeof j),se(null)),j instanceof Error&&!(j.message in Ie)&&(Ie[j.message]=!0,se(k),N("Failed %s type: %s",l,j.message),se(null))}}}var Ct=Array.isArray;function fe(t){return Ct(t)}function Tt(t){{var r=typeof Symbol=="function"&&Symbol.toStringTag,l=r&&t[Symbol.toStringTag]||t.constructor.name||"Object";return l}}function Et(t){try{return Fe(t),!1}catch{return!0}}function Fe(t){return""+t}function De(t){if(Et(t))return N("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",Tt(t)),Fe(t)}var Le=E.ReactCurrentOwner,_t={key:!0,ref:!0,__self:!0,__source:!0},Je,ze;function Rt(t){if(X.call(t,"ref")){var r=Object.getOwnPropertyDescriptor(t,"ref").get;if(r&&r.isReactWarning)return!1}return t.ref!==void 0}function St(t){if(X.call(t,"key")){var r=Object.getOwnPropertyDescriptor(t,"key").get;if(r&&r.isReactWarning)return!1}return t.key!==void 0}function Ot(t,r){typeof t.ref=="string"&&Le.current}function $t(t,r){{var l=function(){Je||(Je=!0,N("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};l.isReactWarning=!0,Object.defineProperty(t,"key",{get:l,configurable:!0})}}function At(t,r){{var l=function(){ze||(ze=!0,N("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};l.isReactWarning=!0,Object.defineProperty(t,"ref",{get:l,configurable:!0})}}var Pt=function(t,r,l,x,k,T,b){var j={$$typeof:s,type:t,key:r,ref:l,props:b,_owner:T};return j._store={},Object.defineProperty(j._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(j,"_self",{configurable:!1,enumerable:!1,writable:!1,value:x}),Object.defineProperty(j,"_source",{configurable:!1,enumerable:!1,writable:!1,value:k}),Object.freeze&&(Object.freeze(j.props),Object.freeze(j)),j};function Bt(t,r,l,x,k){{var T,b={},j=null,$=null;l!==void 0&&(De(l),j=""+l),St(r)&&(De(r.key),j=""+r.key),Rt(r)&&($=r.ref,Ot(r,k));for(T in r)X.call(r,T)&&!_t.hasOwnProperty(T)&&(b[T]=r[T]);if(t&&t.defaultProps){var R=t.defaultProps;for(T in R)b[T]===void 0&&(b[T]=R[T])}if(j||$){var O=typeof t=="function"?t.displayName||t.name||"Unknown":t;j&&$t(b,O),$&&At(b,O)}return Pt(t,j,$,k,x,Le.current,b)}}var xe=E.ReactCurrentOwner,Ve=E.ReactDebugCurrentFrame;function V(t){if(t){var r=t._owner,l=te(t.type,t._source,r?r.type:null);Ve.setExtraStackFrame(l)}else Ve.setExtraStackFrame(null)}var me;me=!1;function ve(t){return typeof t=="object"&&t!==null&&t.$$typeof===s}function Ye(){{if(xe.current){var t=D(xe.current.type);if(t)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+t+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+t+"`."}return""}}function Mt(t){return""}var qe={};function It(t){{var r=Ye();if(!r){var l=typeof t=="string"?t:t.displayName||t.name;l&&(r=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+l+">.")}return r}}function
|
|
25
|
+
Check the top-level render call using <`+l+">.")}return r}}function Ue(t,r){{if(!t._store||t._store.validated||t.key!=null)return;t._store.validated=!0;var l=It(r);if(qe[l])return;qe[l]=!0;var x="";t&&t._owner&&t._owner!==xe.current&&(x=" It was passed a child from "+D(t._owner.type)+"."),V(t),N('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',l,x),V(null)}}function He(t,r){{if(typeof t!="object")return;if(fe(t))for(var l=0;l<t.length;l++){var x=t[l];ve(x)&&Ue(x,r)}else if(ve(t))t._store&&(t._store.validated=!0);else if(t){var k=g(t);if(typeof k=="function"&&k!==t.entries)for(var T=k.call(t),b;!(b=T.next()).done;)ve(b.value)&&Ue(b.value,r)}}}function Wt(t){{var r=t.type;if(r==null||typeof r=="string")return;var l;if(typeof r=="function")l=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===f||r.$$typeof===y))l=r.propTypes;else return;if(l){var x=D(r);Nt(l,t.props,"prop",x,t)}else if(r.PropTypes!==void 0&&!me){me=!0;var k=D(r);N("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",k||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&N("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Ft(t){{for(var r=Object.keys(t.props),l=0;l<r.length;l++){var x=r[l];if(x!=="children"&&x!=="key"){V(t),N("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",x),V(null);break}}t.ref!==null&&(V(t),N("Invalid attribute `ref` supplied to `React.Fragment`."),V(null))}}var Ke={};function Ge(t,r,l,x,k,T){{var b=ce(t);if(!b){var j="";(t===void 0||typeof t=="object"&&t!==null&&Object.keys(t).length===0)&&(j+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var $=Mt();$?j+=$:j+=Ye();var R;t===null?R="null":fe(t)?R="array":t!==void 0&&t.$$typeof===s?(R="<"+(D(t.type)||"Unknown")+" />",j=" Did you accidentally export a JSX literal instead of a component?"):R=typeof t,N("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",R,j)}var O=Bt(t,r,l,k,T);if(O==null)return O;if(b){var B=r.children;if(B!==void 0)if(x)if(fe(B)){for(var Y=0;Y<B.length;Y++)He(B[Y],t);Object.freeze&&Object.freeze(B)}else N("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else He(B,t)}if(X.call(r,"key")){var z=D(t),P=Object.keys(r).filter(function(Yt){return Yt!=="key"}),ge=P.length>0?"{key: someKey, "+P.join(": ..., ")+": ...}":"{key: someKey}";if(!Ke[z+ge]){var Vt=P.length>0?"{"+P.join(": ..., ")+": ...}":"{}";N(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,be,J,qt,J),Xe[J+be]=!0}}return t===o?Lt(S):Dt(S),S}}function Jt(t,r,l){return Ze(t,r,l,!0)}function zt(t,r,l){return Ze(t,r,l,!1)}var Vt=zt,Yt=Jt;H.Fragment=o,H.jsx=Vt,H.jsxs=Yt}()),H}process.env.NODE_ENV==="production"?re.exports=Qe():re.exports=et();var e=re.exports;const we=({onClick:a})=>e.jsx("button",{className:"cb-chat-launcher",onClick:a,children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),{useState:Q,useEffect:tt,useRef:ke,useLayoutEffect:Ne}=V,st=({mode:a="floating",isOpen:s=!0,embedded:i=!1,onClose:o,onOpen:n,children:u,drawerContent:m,footer:h,isDrawerOpen:f,onDrawerOpenChange:w})=>{const[p,y]=Q(!1),[v,c]=Q(!1),d=f!==void 0?f:v,C=W=>{c(W),w==null||w(W)},[g,E]=Q(!1),N=ke(null),[A,I]=Q(!0);tt(()=>{y(!0)},[]);const M=()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)},ce=()=>{if(!N.current)return;const{scrollTop:W,scrollHeight:de,clientHeight:ue}=N.current,G=de-W-ue;E(G>100),I(G<50)},K=ke(null);if(Ne(()=>{A&&M()},[u,A]),Ne(()=>{if(!K.current)return;const W=new ResizeObserver(()=>{A&&M()});return W.observe(K.current),()=>W.disconnect()},[A]),!p)return null;if(!s&&a==="floating"&&!i)return e.jsx(we,{onClick:()=>n==null?void 0:n()});const le=["cb-chat-container",`cb-mode-${a}`,s?"cb-open":"cb-closed",i?"cb-embedded":null].filter(Boolean).join(" ");return e.jsxs("div",{className:le,children:[e.jsxs("div",{className:"cb-chat-header",children:[e.jsxs("div",{className:"cb-header-left",children:[e.jsx("button",{className:"cb-header-btn",onClick:()=>C(!d),children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),e.jsx("span",{className:"cb-brand",children:"AI Assistant"})]}),e.jsx("div",{className:"cb-actions",children:e.jsx("button",{className:"cb-minimize-btn",onClick:o,children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})})]}),e.jsxs("div",{className:"cb-chat-body-wrapper",children:[e.jsxs("div",{className:`cb-drawer-wrapper ${d?"open":""}`,children:[e.jsx("div",{className:"cb-drawer-content",children:m}),e.jsx("div",{className:"cb-drawer-backdrop",onClick:()=>C(!1)})]}),e.jsxs("div",{className:"cb-chat-content",children:[e.jsxs("div",{className:"cb-messages-area",children:[e.jsx("div",{className:"cb-scroll-view",ref:N,onScroll:ce,children:e.jsx("div",{ref:K,children:u})}),e.jsx("button",{className:`cb-scroll-bottom-btn ${g?"visible":""}`,onClick:M,children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 5v14M19 12l-7 7-7-7"})})})]}),h&&e.jsx("div",{className:"cb-chat-footer",children:h})]})]})]})},{useState:Ce}=V,nt=({onClose:a,webSearchEnabled:s=!1,onWebSearchChange:i,pageContextEnabled:o=!1,onPageContextChange:n})=>{const[u,m]=Ce("rovo"),[h,f]=Ce({knowledge:!0,autoApply:!0}),w=v=>{f(c=>({...c,[v]:!c[v]}))},p=()=>{i==null||i(!s)},y=()=>{n==null||n(!o)};return e.jsx("div",{className:"cb-menu-overlay",onClick:a,children:e.jsxs("div",{className:"cb-menu-content reasoning",onClick:v=>v.stopPropagation(),children:[e.jsx("div",{className:"cb-menu-header",children:e.jsx("span",{children:"Reasoning"})}),e.jsxs("div",{className:"cb-menu-section",children:[e.jsxs("div",{className:`cb-menu-item ${u==="rovo"?"active":""}`,onClick:()=>m("rovo"),children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z"})})}),e.jsxs("div",{className:"cb-menu-info",children:[e.jsx("span",{className:"cb-menu-title",children:"Let Rovo decide"}),e.jsx("span",{className:"cb-menu-desc",children:"Rovo picks the best reasoning"})]}),u==="rovo"&&e.jsx("div",{className:"cb-check",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]}),e.jsxs("div",{className:`cb-menu-item ${u==="deep"?"active":""}`,onClick:()=>m("deep"),children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsxs("div",{className:"cb-menu-info",children:[e.jsx("span",{className:"cb-menu-title",children:"Think deeper"}),e.jsx("span",{className:"cb-menu-desc",children:"Longer thinking for robust responses"})]}),u==="deep"&&e.jsx("div",{className:"cb-check",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]}),e.jsxs("div",{className:`cb-menu-item ${u==="research"?"active":""}`,onClick:()=>m("research"),children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M16.2 7.8l-2 6.3-6.4 2.1 2-6.3z"})]})}),e.jsxs("div",{className:"cb-menu-info",children:[e.jsx("span",{className:"cb-menu-title",children:"Deep research"}),e.jsx("span",{className:"cb-menu-desc",children:"Synthesize insights and create reports"})]}),u==="research"&&e.jsx("div",{className:"cb-check",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]})]}),e.jsx("div",{className:"cb-menu-header",children:e.jsx("span",{children:"Sources"})}),e.jsxs("div",{className:"cb-menu-section",children:[e.jsxs("div",{className:"cb-menu-toggle-item",onClick:p,children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}),e.jsx("span",{children:"Include web results"}),e.jsx("div",{className:`cb-toggle ${s?"on":"off"}`})]}),e.jsxs("div",{className:"cb-menu-toggle-item",onClick:y,children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),e.jsx("line",{x1:"10",y1:"9",x2:"8",y2:"9"})]})}),e.jsx("span",{children:"Read page content"}),e.jsx("div",{className:`cb-toggle ${o?"on":"off"}`})]}),e.jsxs("div",{className:"cb-menu-toggle-item",onClick:()=>w("knowledge"),children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",ry:"2"}),e.jsx("line",{x1:"9",y1:"22",x2:"9",y2:"22"}),e.jsx("line",{x1:"15",y1:"22",x2:"15",y2:"22"}),e.jsx("line",{x1:"9",y1:"6",x2:"9",y2:"6"}),e.jsx("line",{x1:"15",y1:"6",x2:"15",y2:"6"}),e.jsx("line",{x1:"9",y1:"10",x2:"9",y2:"10"}),e.jsx("line",{x1:"15",y1:"10",x2:"15",y2:"10"}),e.jsx("line",{x1:"9",y1:"14",x2:"9",y2:"14"}),e.jsx("line",{x1:"15",y1:"14",x2:"15",y2:"14"}),e.jsx("line",{x1:"9",y1:"18",x2:"9",y2:"18"})]})}),e.jsx("span",{children:"Search company knowledge"}),e.jsx("div",{className:`cb-toggle ${h.knowledge?"on":"off"}`})]}),e.jsxs("div",{className:"cb-menu-toggle-item",onClick:()=>w("autoApply"),children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),e.jsx("span",{children:"Auto-apply AI writing changes"}),e.jsx("div",{className:`cb-toggle ${h.autoApply?"on":"off"}`})]})]})]})})},rt=({onClose:a})=>e.jsx("div",{className:"cb-menu-overlay",onClick:a,children:e.jsx("div",{className:"cb-menu-content plus-menu",onClick:s=>s.stopPropagation(),children:e.jsxs("div",{className:"cb-menu-section compact",children:[e.jsxs("div",{className:"cb-menu-item",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),e.jsx("span",{className:"cb-menu-title",children:"Upload file"})]}),e.jsxs("div",{className:"cb-menu-item",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),e.jsx("span",{className:"cb-menu-title",children:"Add a link"})]}),e.jsxs("div",{className:"cb-menu-item",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"8.5",cy:"7",r:"4"}),e.jsx("polyline",{points:"17 11 19 13 23 9"})]}),e.jsx("span",{className:"cb-menu-title",children:"Mention someone"})]}),e.jsxs("div",{className:"cb-menu-item",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),e.jsx("span",{className:"cb-menu-title",children:"More formatting"})]})]})})}),{useState:Te,useRef:it,useEffect:at}=V,ot=({onSend:a,disabled:s=!1,placeholder:i="Ask, @mention, or / for actions",webSearchEnabled:o=!1,onWebSearchChange:n,pageContextEnabled:u=!1,onPageContextChange:m})=>{const[h,f]=Te(""),[w,p]=Te(null),y=it(null);at(()=>{const d=C=>{y.current&&!y.current.contains(C.target)&&p(null)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]);const v=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),h.trim()&&!s&&(a==null||a(h),f("")))},c=d=>{p(w===d?null:d)};return e.jsxs("div",{className:"cb-composer",ref:y,children:[w==="reasoning"&&e.jsx(nt,{onClose:()=>p(null),webSearchEnabled:o,onWebSearchChange:n,pageContextEnabled:u,onPageContextChange:m}),w==="plus"&&e.jsx(rt,{onClose:()=>p(null)}),e.jsxs("div",{className:"cb-composer-input-wrapper",children:[e.jsx("textarea",{className:"cb-composer-textarea",value:h,onChange:d=>f(d.target.value),onKeyDown:v,onFocus:()=>p(null),placeholder:i,disabled:s,rows:1}),e.jsxs("div",{className:"cb-composer-actions",children:[e.jsxs("div",{className:"cb-actions-left",children:[e.jsx("button",{className:`cb-action-btn circle ${w==="plus"?"active-state":""}`,onClick:()=>c("plus"),title:"Add...",children:w==="plus"?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),e.jsx("button",{className:`cb-action-btn ${w==="reasoning"?"active-icon":""}`,onClick:()=>c("reasoning"),title:"Reasoning",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),e.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),e.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),e.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),e.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),e.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),e.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]})})]}),e.jsx("button",{className:`cb-send-btn ${h.trim()?"active":""}`,onClick:()=>{h.trim()&&!s&&(a==null||a(h),f(""))},disabled:!h.trim()||s,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),e.jsx("polyline",{points:"5 12 12 5 19 12"})]})})]})]}),e.jsx("div",{className:"cb-composer-footer",children:e.jsx("span",{children:"Uses AI. Verify results."})})]})},{useState:ct}=V,ie=({toolName:a,status:s,args:i,result:o})=>{const[n,u]=ct(!1),m=a==="web_search"||a==="search_web";return e.jsxs("div",{className:`cb-tool-invocation ${s}`,children:[e.jsxs("div",{className:"cb-tool-header",onClick:()=>u(!n),children:[e.jsx("div",{className:"cb-tool-icon",children:s==="running"?e.jsx("div",{className:"cb-spinner-sm"}):e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"cb-icon-check",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsxs("span",{className:"cb-tool-name",children:[e.jsx("span",{style:{opacity:.7},children:s==="running"?"Calling":"Used tool"}),e.jsx("strong",{children:a})]}),e.jsx("span",{className:"cb-tool-chevron",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:n?"rotate(180deg)":"rotate(0)"},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})})]}),n&&e.jsx("div",{className:"cb-tool-details",children:m&&o?e.jsxs("div",{className:"cb-web-search-results",children:[e.jsx("div",{style:{marginBottom:"8px",opacity:.8,fontSize:"12px"},children:"Search Results:"}),e.jsx("div",{className:"cb-markdown-content",style:{fontSize:"13px",lineHeight:"1.6"},children:typeof o=="string"?o:JSON.stringify(o,null,2)})]}):e.jsxs("div",{className:"cb-code-block",children:[e.jsx("div",{style:{marginBottom:"4px",opacity:.5},children:"Arguments:"}),JSON.stringify(i,null,2),o&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{marginTop:"8px",marginBottom:"4px",opacity:.5},children:"Result:"}),JSON.stringify(o,null,2)]})]})})]})},Ee=({toolCallId:a,label:s,description:i,status:o,onConfirm:n,onReject:u})=>o!=="pending"?e.jsxs("div",{className:"cb-confirm-status",children:[o==="confirmed"&&e.jsxs("div",{className:"cb-confirm-status-confirmed",children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),e.jsx("span",{children:"Confirmed - executing..."})]}),o==="executing"&&e.jsxs("div",{className:"cb-confirm-status-executing",children:[e.jsx("div",{className:"cb-confirm-spinner"}),e.jsxs("span",{children:["Executing ",s,"..."]})]}),o==="rejected"&&e.jsxs("div",{className:"cb-confirm-status-rejected",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),e.jsx("span",{children:"Cancelled"})]})]}):e.jsxs("div",{className:"cb-confirm-buttons",children:[e.jsxs("div",{className:"cb-confirm-header",children:[e.jsx("svg",{className:"cb-tool-icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),e.jsx("span",{className:"cb-tool-label",children:s})]}),i&&e.jsx("p",{className:"cb-confirm-description",children:i}),e.jsxs("div",{className:"cb-confirm-actions",children:[e.jsxs("button",{className:"cb-btn-confirm",onClick:()=>n(a),children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Confirm"]}),e.jsxs("button",{className:"cb-btn-reject",onClick:()=>u(a),children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),"Cancel"]})]})]}),{useState:ae,useEffect:_e,useRef:Re}=V,lt=a=>{const{role:s,steps:i,shouldAnimate:o=!0}=a;return i&&i.length>0?e.jsxs("div",{className:`cb-message-row ${s==="user"?"cb-row-user":"cb-row-assistant"}`,children:[s==="assistant"&&e.jsx("div",{className:"cb-avatar-container",children:e.jsx("div",{className:"cb-avatar-assistant",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10c0 5.524-4.476 10-10 10S2 17.524 2 12 6.476 2 12 2z"}),e.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),e.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),e.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})}),e.jsxs("div",{className:"cb-message-content-wrapper",style:{width:"100%"},children:[s==="user"?null:e.jsx("div",{className:"cb-sender-name",children:"Assistant"}),e.jsx("div",{className:"cb-steps-container",children:i.map((n,u)=>{const m=u===i.length-1;return n.type==="thinking"?e.jsx(dt,{step:n},n.id):n.type==="tool-call"?e.jsx("div",{className:"cb-step-tool",style:{marginBottom:8},children:e.jsx(ie,{toolName:n.toolName||"Tool",args:n.toolArgs,status:n.toolStatus,result:n.toolResult})},n.id):n.type==="confirm-request"?e.jsx("div",{className:"cb-step-confirm",style:{marginBottom:8},children:e.jsx(Ee,{toolCallId:n.toolCallId||n.id,toolName:n.toolName||"Tool",label:n.confirmLabel||n.toolName||"Confirm Action",description:n.confirmDescription,status:n.confirmStatus||"pending",onConfirm:a.onConfirm||(()=>{}),onReject:a.onReject||(()=>{})})},n.id):n.type==="text"?e.jsx("div",{className:`cb-message-bubble ${s}`,style:{marginBottom:8,maxWidth:"100%"},children:e.jsx(ut,{content:n.content||"",shouldAnimate:o&&m,onComplete:m?a.onAnimationComplete:void 0})},n.id):null})})]})]}):e.jsx(ht,{...a})},dt=({step:a})=>{const[s,i]=ae(!1),o=a.isFinished;return e.jsxs("div",{className:"cb-step-thinking-block",style:{marginBottom:8,border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,overflow:"hidden"},children:[e.jsxs("div",{className:"cb-thinking-header",onClick:()=>i(!s),style:{padding:"8px 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",background:"rgba(255,255,255,0.02)",fontSize:"13px",color:o?"rgba(255,255,255,0.6)":"rgba(255,255,255,0.9)"},children:[o?e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):e.jsx("div",{className:"cb-thinking-spinner",style:{width:14,height:14,border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"white",borderRadius:"50%",animation:"spin 1s linear infinite"}}),e.jsx("span",{style:{flex:1},children:a.content||"Thinking Process"}),a.thoughts&&a.thoughts.length>0&&e.jsxs("span",{style:{fontSize:"11px",opacity:.5},children:[a.thoughts.length," logs"]}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),s&&a.thoughts&&a.thoughts.length>0&&e.jsx("div",{className:"cb-thinking-logs",style:{padding:"8px 12px",background:"rgba(0,0,0,0.2)",borderTop:"1px solid rgba(255,255,255,0.05)"},children:a.thoughts.map((n,u)=>e.jsx("div",{style:{fontSize:"12px",fontFamily:"monospace",color:"rgba(255,255,255,0.5)",marginBottom:4},children:n},u))}),e.jsx("style",{children:`
|
|
30
|
+
<%s key={someKey} {...props} />`,ge,z,Vt,z),Ke[z+ge]=!0}}return t===c?Ft(O):Wt(O),O}}function Dt(t,r,l){return Ge(t,r,l,!0)}function Lt(t,r,l){return Ge(t,r,l,!1)}var Jt=Lt,zt=Dt;U.Fragment=c,U.jsx=Jt,U.jsxs=zt}()),U}process.env.NODE_ENV==="production"?F.exports=Xe():F.exports=Ze();var e=F.exports;const be=({onClick:o})=>e.jsx("button",{className:"cb-chat-launcher",onClick:o,children:e.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})})}),{useState:Z,useEffect:Qe,useRef:ye,useLayoutEffect:we}=S,et=({mode:o="floating",isOpen:s=!0,embedded:i=!1,onClose:c,onOpen:n,children:u,drawerContent:m,footer:h,isDrawerOpen:f,onDrawerOpenChange:w})=>{const[p,y]=Z(!1),[v,a]=Z(!1),d=f!==void 0?f:v,C=W=>{a(W),w==null||w(W)},[g,E]=Z(!1),N=ye(null),[A,I]=Z(!0);Qe(()=>{y(!0)},[]);const M=()=>{N.current&&(N.current.scrollTop=N.current.scrollHeight)},ae=()=>{if(!N.current)return;const{scrollTop:W,scrollHeight:ce,clientHeight:le}=N.current,K=ce-W-le;E(K>100),I(K<50)},H=ye(null);if(we(()=>{A&&M()},[u,A]),we(()=>{if(!H.current)return;const W=new ResizeObserver(()=>{A&&M()});return W.observe(H.current),()=>W.disconnect()},[A]),!p)return null;if(!s&&o==="floating"&&!i)return e.jsx(be,{onClick:()=>n==null?void 0:n()});const oe=["cb-chat-container",`cb-mode-${o}`,s?"cb-open":"cb-closed",i?"cb-embedded":null].filter(Boolean).join(" ");return e.jsxs("div",{className:oe,children:[e.jsxs("div",{className:"cb-chat-header",children:[e.jsxs("div",{className:"cb-header-left",children:[e.jsx("button",{className:"cb-header-btn",onClick:()=>C(!d),children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]})}),e.jsx("span",{className:"cb-brand",children:"AI Assistant"})]}),e.jsx("div",{className:"cb-actions",children:e.jsx("button",{className:"cb-minimize-btn",onClick:c,children:e.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M18 6L6 18M6 6l12 12"})})})})]}),e.jsxs("div",{className:"cb-chat-body-wrapper",children:[e.jsxs("div",{className:`cb-drawer-wrapper ${d?"open":""}`,children:[e.jsx("div",{className:"cb-drawer-content",children:m}),e.jsx("div",{className:"cb-drawer-backdrop",onClick:()=>C(!1)})]}),e.jsxs("div",{className:"cb-chat-content",children:[e.jsxs("div",{className:"cb-messages-area",children:[e.jsx("div",{className:"cb-scroll-view",ref:N,onScroll:ae,children:e.jsx("div",{ref:H,children:u})}),e.jsx("button",{className:`cb-scroll-bottom-btn ${g?"visible":""}`,onClick:M,children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 5v14M19 12l-7 7-7-7"})})})]}),h&&e.jsx("div",{className:"cb-chat-footer",children:h})]})]})]})},{useState:ke}=S,tt=({onClose:o,webSearchEnabled:s=!1,onWebSearchChange:i,pageContextEnabled:c=!1,onPageContextChange:n})=>{const[u,m]=ke("rovo"),[h,f]=ke({knowledge:!0,autoApply:!0}),w=v=>{f(a=>({...a,[v]:!a[v]}))},p=()=>{i==null||i(!s)},y=()=>{n==null||n(!c)};return e.jsx("div",{className:"cb-menu-overlay",onClick:o,children:e.jsxs("div",{className:"cb-menu-content reasoning",onClick:v=>v.stopPropagation(),children:[e.jsx("div",{className:"cb-menu-header",children:e.jsx("span",{children:"Reasoning"})}),e.jsxs("div",{className:"cb-menu-section",children:[e.jsxs("div",{className:`cb-menu-item ${u==="rovo"?"active":""}`,onClick:()=>m("rovo"),children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M13 2L3 14h9l-1 8 10-12h-9l1-8z"})})}),e.jsxs("div",{className:"cb-menu-info",children:[e.jsx("span",{className:"cb-menu-title",children:"Let Rovo decide"}),e.jsx("span",{className:"cb-menu-desc",children:"Rovo picks the best reasoning"})]}),u==="rovo"&&e.jsx("div",{className:"cb-check",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]}),e.jsxs("div",{className:`cb-menu-item ${u==="deep"?"active":""}`,onClick:()=>m("deep"),children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]})}),e.jsxs("div",{className:"cb-menu-info",children:[e.jsx("span",{className:"cb-menu-title",children:"Think deeper"}),e.jsx("span",{className:"cb-menu-desc",children:"Longer thinking for robust responses"})]}),u==="deep"&&e.jsx("div",{className:"cb-check",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]}),e.jsxs("div",{className:`cb-menu-item ${u==="research"?"active":""}`,onClick:()=>m("research"),children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M16.2 7.8l-2 6.3-6.4 2.1 2-6.3z"})]})}),e.jsxs("div",{className:"cb-menu-info",children:[e.jsx("span",{className:"cb-menu-title",children:"Deep research"}),e.jsx("span",{className:"cb-menu-desc",children:"Synthesize insights and create reports"})]}),u==="research"&&e.jsx("div",{className:"cb-check",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})})]})]}),e.jsx("div",{className:"cb-menu-header",children:e.jsx("span",{children:"Sources"})}),e.jsxs("div",{className:"cb-menu-section",children:[e.jsxs("div",{className:"cb-menu-toggle-item",onClick:p,children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("line",{x1:"2",y1:"12",x2:"22",y2:"12"}),e.jsx("path",{d:"M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"})]})}),e.jsx("span",{children:"Include web results"}),e.jsx("div",{className:`cb-toggle ${s?"on":"off"}`})]}),e.jsxs("div",{className:"cb-menu-toggle-item",onClick:y,children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),e.jsx("polyline",{points:"14 2 14 8 20 8"}),e.jsx("line",{x1:"16",y1:"13",x2:"8",y2:"13"}),e.jsx("line",{x1:"16",y1:"17",x2:"8",y2:"17"}),e.jsx("line",{x1:"10",y1:"9",x2:"8",y2:"9"})]})}),e.jsx("span",{children:"Read page content"}),e.jsx("div",{className:`cb-toggle ${c?"on":"off"}`})]}),e.jsxs("div",{className:"cb-menu-toggle-item",onClick:()=>w("knowledge"),children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",ry:"2"}),e.jsx("line",{x1:"9",y1:"22",x2:"9",y2:"22"}),e.jsx("line",{x1:"15",y1:"22",x2:"15",y2:"22"}),e.jsx("line",{x1:"9",y1:"6",x2:"9",y2:"6"}),e.jsx("line",{x1:"15",y1:"6",x2:"15",y2:"6"}),e.jsx("line",{x1:"9",y1:"10",x2:"9",y2:"10"}),e.jsx("line",{x1:"15",y1:"10",x2:"15",y2:"10"}),e.jsx("line",{x1:"9",y1:"14",x2:"9",y2:"14"}),e.jsx("line",{x1:"15",y1:"14",x2:"15",y2:"14"}),e.jsx("line",{x1:"9",y1:"18",x2:"9",y2:"18"})]})}),e.jsx("span",{children:"Search company knowledge"}),e.jsx("div",{className:`cb-toggle ${h.knowledge?"on":"off"}`})]}),e.jsxs("div",{className:"cb-menu-toggle-item",onClick:()=>w("autoApply"),children:[e.jsx("div",{className:"cb-menu-icon-circle",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 20h9"}),e.jsx("path",{d:"M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4L16.5 3.5z"})]})}),e.jsx("span",{children:"Auto-apply AI writing changes"}),e.jsx("div",{className:`cb-toggle ${h.autoApply?"on":"off"}`})]})]})]})})},st=({onClose:o})=>e.jsx("div",{className:"cb-menu-overlay",onClick:o,children:e.jsx("div",{className:"cb-menu-content plus-menu",onClick:s=>s.stopPropagation(),children:e.jsxs("div",{className:"cb-menu-section compact",children:[e.jsxs("div",{className:"cb-menu-item",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),e.jsx("polyline",{points:"17 8 12 3 7 8"}),e.jsx("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),e.jsx("span",{className:"cb-menu-title",children:"Upload file"})]}),e.jsxs("div",{className:"cb-menu-item",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),e.jsx("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),e.jsx("span",{className:"cb-menu-title",children:"Add a link"})]}),e.jsxs("div",{className:"cb-menu-item",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M16 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.jsx("circle",{cx:"8.5",cy:"7",r:"4"}),e.jsx("polyline",{points:"17 11 19 13 23 9"})]}),e.jsx("span",{className:"cb-menu-title",children:"Mention someone"})]}),e.jsxs("div",{className:"cb-menu-item",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),e.jsx("span",{className:"cb-menu-title",children:"More formatting"})]})]})})}),{useState:Ne,useRef:nt,useEffect:rt}=S,it=({onSend:o,disabled:s=!1,placeholder:i="Ask, @mention, or / for actions",webSearchEnabled:c=!1,onWebSearchChange:n,pageContextEnabled:u=!1,onPageContextChange:m})=>{const[h,f]=Ne(""),[w,p]=Ne(null),y=nt(null);rt(()=>{const d=C=>{y.current&&!y.current.contains(C.target)&&p(null)};return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[]);const v=d=>{d.key==="Enter"&&!d.shiftKey&&(d.preventDefault(),h.trim()&&!s&&(o==null||o(h),f("")))},a=d=>{p(w===d?null:d)};return e.jsxs("div",{className:"cb-composer",ref:y,children:[w==="reasoning"&&e.jsx(tt,{onClose:()=>p(null),webSearchEnabled:c,onWebSearchChange:n,pageContextEnabled:u,onPageContextChange:m}),w==="plus"&&e.jsx(st,{onClose:()=>p(null)}),e.jsxs("div",{className:"cb-composer-input-wrapper",children:[e.jsx("textarea",{className:"cb-composer-textarea",value:h,onChange:d=>f(d.target.value),onKeyDown:v,onFocus:()=>p(null),placeholder:i,disabled:s,rows:1}),e.jsxs("div",{className:"cb-composer-actions",children:[e.jsxs("div",{className:"cb-actions-left",children:[e.jsx("button",{className:`cb-action-btn circle ${w==="plus"?"active-state":""}`,onClick:()=>a("plus"),title:"Add...",children:w==="plus"?e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}):e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),e.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]})}),e.jsx("button",{className:`cb-action-btn ${w==="reasoning"?"active-icon":""}`,onClick:()=>a("reasoning"),title:"Reasoning",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"4",y1:"21",x2:"4",y2:"14"}),e.jsx("line",{x1:"4",y1:"10",x2:"4",y2:"3"}),e.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"12"}),e.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"3"}),e.jsx("line",{x1:"20",y1:"21",x2:"20",y2:"16"}),e.jsx("line",{x1:"20",y1:"12",x2:"20",y2:"3"}),e.jsx("line",{x1:"1",y1:"14",x2:"7",y2:"14"}),e.jsx("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),e.jsx("line",{x1:"17",y1:"16",x2:"23",y2:"16"})]})})]}),e.jsx("button",{className:`cb-send-btn ${h.trim()?"active":""}`,onClick:()=>{h.trim()&&!s&&(o==null||o(h),f(""))},disabled:!h.trim()||s,children:e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"12",y1:"19",x2:"12",y2:"5"}),e.jsx("polyline",{points:"5 12 12 5 19 12"})]})})]})]}),e.jsx("div",{className:"cb-composer-footer",children:e.jsx("span",{children:"Uses AI. Verify results."})})]})},{useState:at}=S,ne=({toolName:o,status:s,args:i,result:c})=>{const[n,u]=at(!1),m=o==="web_search"||o==="search_web";return e.jsxs("div",{className:`cb-tool-invocation ${s}`,children:[e.jsxs("div",{className:"cb-tool-header",onClick:()=>u(!n),children:[e.jsx("div",{className:"cb-tool-icon",children:s==="running"?e.jsx("div",{className:"cb-spinner-sm"}):e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",className:"cb-icon-check",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})})}),e.jsxs("span",{className:"cb-tool-name",children:[e.jsx("span",{style:{opacity:.7},children:s==="running"?"Calling":"Used tool"}),e.jsx("strong",{children:o})]}),e.jsx("span",{className:"cb-tool-chevron",children:e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:n?"rotate(180deg)":"rotate(0)"},children:e.jsx("path",{d:"M6 9l6 6 6-6"})})})]}),n&&e.jsx("div",{className:"cb-tool-details",children:m&&c?e.jsxs("div",{className:"cb-web-search-results",children:[e.jsx("div",{style:{marginBottom:"8px",opacity:.8,fontSize:"12px"},children:"Search Results:"}),e.jsx("div",{className:"cb-markdown-content",style:{fontSize:"13px",lineHeight:"1.6"},children:typeof c=="string"?c:JSON.stringify(c,null,2)})]}):e.jsxs("div",{className:"cb-code-block",children:[e.jsx("div",{style:{marginBottom:"4px",opacity:.5},children:"Arguments:"}),JSON.stringify(i,null,2),c&&e.jsxs(e.Fragment,{children:[e.jsx("div",{style:{marginTop:"8px",marginBottom:"4px",opacity:.5},children:"Result:"}),JSON.stringify(c,null,2)]})]})})]})},Ce=({toolCallId:o,label:s,description:i,status:c,onConfirm:n,onReject:u})=>c!=="pending"?e.jsxs("div",{className:"cb-confirm-status",children:[c==="confirmed"&&e.jsxs("div",{className:"cb-confirm-status-confirmed",children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),e.jsx("span",{children:"Confirmed - executing..."})]}),c==="executing"&&e.jsxs("div",{className:"cb-confirm-status-executing",children:[e.jsx("div",{className:"cb-confirm-spinner"}),e.jsxs("span",{children:["Executing ",s,"..."]})]}),c==="rejected"&&e.jsxs("div",{className:"cb-confirm-status-rejected",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),e.jsx("span",{children:"Cancelled"})]})]}):e.jsxs("div",{className:"cb-confirm-buttons",children:[e.jsxs("div",{className:"cb-confirm-header",children:[e.jsx("svg",{className:"cb-tool-icon",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})}),e.jsx("span",{className:"cb-tool-label",children:s})]}),i&&e.jsx("p",{className:"cb-confirm-description",children:i}),e.jsxs("div",{className:"cb-confirm-actions",children:[e.jsxs("button",{className:"cb-btn-confirm",onClick:()=>n(o),children:[e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}),"Confirm"]}),e.jsxs("button",{className:"cb-btn-reject",onClick:()=>u(o),children:[e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),"Cancel"]})]})]}),{useState:re,useEffect:Te,useRef:Ee}=S,ot=o=>{const{role:s,steps:i,shouldAnimate:c=!0}=o;return i&&i.length>0?e.jsxs("div",{className:`cb-message-row ${s==="user"?"cb-row-user":"cb-row-assistant"}`,children:[s==="assistant"&&e.jsx("div",{className:"cb-avatar-container",children:e.jsx("div",{className:"cb-avatar-assistant",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10c0 5.524-4.476 10-10 10S2 17.524 2 12 6.476 2 12 2z"}),e.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),e.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),e.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})}),e.jsxs("div",{className:"cb-message-content-wrapper",style:{width:"100%"},children:[s==="user"?null:e.jsx("div",{className:"cb-sender-name",children:"Assistant"}),e.jsx("div",{className:"cb-steps-container",children:i.map((n,u)=>{const m=u===i.length-1;return n.type==="thinking"?e.jsx(ct,{step:n},n.id):n.type==="tool-call"?e.jsx("div",{className:"cb-step-tool",style:{marginBottom:8},children:e.jsx(ne,{toolName:n.toolName||"Tool",args:n.toolArgs,status:n.toolStatus,result:n.toolResult})},n.id):n.type==="confirm-request"?e.jsx("div",{className:"cb-step-confirm",style:{marginBottom:8},children:e.jsx(Ce,{toolCallId:n.toolCallId||n.id,toolName:n.toolName||"Tool",label:n.confirmLabel||n.toolName||"Confirm Action",description:n.confirmDescription,status:n.confirmStatus||"pending",onConfirm:o.onConfirm||(()=>{}),onReject:o.onReject||(()=>{})})},n.id):n.type==="text"?e.jsx("div",{className:`cb-message-bubble ${s}`,style:{marginBottom:8,maxWidth:"100%"},children:e.jsx(lt,{content:n.content||"",shouldAnimate:c&&m,onComplete:m?o.onAnimationComplete:void 0})},n.id):null})})]})]}):e.jsx(dt,{...o})},ct=({step:o})=>{const[s,i]=re(!1),c=o.isFinished;return e.jsxs("div",{className:"cb-step-thinking-block",style:{marginBottom:8,border:"1px solid rgba(255,255,255,0.1)",borderRadius:8,overflow:"hidden"},children:[e.jsxs("div",{className:"cb-thinking-header",onClick:()=>i(!s),style:{padding:"8px 12px",display:"flex",alignItems:"center",gap:8,cursor:"pointer",background:"rgba(255,255,255,0.02)",fontSize:"13px",color:c?"rgba(255,255,255,0.6)":"rgba(255,255,255,0.9)"},children:[c?e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("polyline",{points:"20 6 9 17 4 12"})}):e.jsx("div",{className:"cb-thinking-spinner",style:{width:14,height:14,border:"2px solid rgba(255,255,255,0.3)",borderTopColor:"white",borderRadius:"50%",animation:"spin 1s linear infinite"}}),e.jsx("span",{style:{flex:1},children:o.content||"Thinking Process"}),o.thoughts&&o.thoughts.length>0&&e.jsxs("span",{style:{fontSize:"11px",opacity:.5},children:[o.thoughts.length," logs"]}),e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:s?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s"},children:e.jsx("polyline",{points:"6 9 12 15 18 9"})})]}),s&&o.thoughts&&o.thoughts.length>0&&e.jsx("div",{className:"cb-thinking-logs",style:{padding:"8px 12px",background:"rgba(0,0,0,0.2)",borderTop:"1px solid rgba(255,255,255,0.05)"},children:o.thoughts.map((n,u)=>e.jsx("div",{style:{fontSize:"12px",fontFamily:"monospace",color:"rgba(255,255,255,0.5)",marginBottom:4},children:n},u))}),e.jsx("style",{children:`
|
|
31
31
|
@keyframes spin { to { transform: rotate(360deg); } }
|
|
32
|
-
`})]})},ut=({content:a,shouldAnimate:s,onComplete:i})=>{const[o,n]=ae(s?"":a),u=Re(!1);return _e(()=>{if(u.current=!1,!s||!a){n(a),u.current||(u.current=!0,i==null||i());return}let m,h;const f=Date.now(),w=15,p=a.length*w,y=()=>{const c=Date.now()-f,d=Math.floor(c/w);d<a.length?(n(a.substring(0,d+1)),m=requestAnimationFrame(y)):(n(a),u.current||(u.current=!0,i==null||i()))};return m=requestAnimationFrame(y),h=setTimeout(()=>{u.current||(n(a),u.current=!0,i==null||i())},p+100),()=>{cancelAnimationFrame(m),clearTimeout(h)}},[a,s]),e.jsxs("div",{className:"cb-markdown-content",children:[o,s&&a&&o.length<a.length&&e.jsx("span",{className:"cb-cursor",children:"|"})]})},ht=a=>{const{role:s,content:i,attachments:o,toolInvocation:n,shouldAnimate:u=!0}=a,[m,h]=ae(""),f=Re(!1);return _e(()=>{var C;if(f.current=!1,s!=="assistant"||!i||!u){h(i||""),f.current||(f.current=!0,(C=a.onAnimationComplete)==null||C.call(a));return}let w,p;const y=Date.now(),v=15,c=i.length*v,d=()=>{var A;const E=Date.now()-y,N=Math.floor(E/v);N<i.length?(h(i.substring(0,N+1)),w=requestAnimationFrame(d)):(h(i),f.current||(f.current=!0,(A=a.onAnimationComplete)==null||A.call(a)))};return w=requestAnimationFrame(d),p=setTimeout(()=>{var g;f.current||(h(i),f.current=!0,(g=a.onAnimationComplete)==null||g.call(a))},c+100),()=>{cancelAnimationFrame(w),clearTimeout(p)}},[i,s,u]),n?e.jsxs("div",{className:"cb-message-row cb-row-assistant",style:{marginBottom:"8px"},children:[e.jsx("div",{className:"cb-avatar-container",children:e.jsx("div",{className:"cb-avatar-assistant",style:{background:"#333"},children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})})})}),e.jsx("div",{className:"cb-message-content-wrapper",children:e.jsx(ie,{toolName:n.toolName,args:n.args,status:n.status,result:n.result})})]}):e.jsxs("div",{className:`cb-message-row ${s==="user"?"cb-row-user":"cb-row-assistant"}`,children:[s==="assistant"&&e.jsx("div",{className:"cb-avatar-container",children:e.jsx("div",{className:"cb-avatar-assistant",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10c0 5.524-4.476 10-10 10S2 17.524 2 12 6.476 2 12 2z"}),e.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),e.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),e.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})}),e.jsxs("div",{className:"cb-message-content-wrapper",children:[s==="user"?null:e.jsx("div",{className:"cb-sender-name",children:"Assistant"}),e.jsxs("div",{className:`cb-message-bubble ${s}`,children:[e.jsxs("div",{className:"cb-markdown-content",children:[m,s==="assistant"&&u&&i&&m.length<i.length&&e.jsx("span",{className:"cb-cursor",children:"|"})]}),o&&o.length>0&&e.jsx("div",{className:"cb-attachments-grid"})]})]})]})},ft=()=>e.jsxs("div",{className:"cb-thinking-container",children:[e.jsxs("div",{className:"cb-thinking-dots",children:[e.jsx("div",{className:"cb-dot"}),e.jsx("div",{className:"cb-dot"}),e.jsx("div",{className:"cb-dot"})]}),e.jsx("span",{className:"cb-thinking-text",children:"Thinking..."})]}),xt=({userName:a="User",actions:s=[]})=>e.jsxs("div",{className:"cb-welcome-container",children:[e.jsx("div",{className:"cb-welcome-logo",children:e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),e.jsx("path",{d:"M8 10h.01"}),e.jsx("path",{d:"M12 10h.01"}),e.jsx("path",{d:"M16 10h.01"})]})}),e.jsxs("h2",{className:"cb-welcome-title",children:["How can I help, ",a,"?"]}),e.jsx("div",{className:"cb-quick-actions-grid",children:s.map(i=>e.jsxs("button",{className:"cb-quick-action-card",onClick:i.onClick,children:[e.jsx("div",{className:"cb-action-icon",children:i.icon}),e.jsx("span",{className:"cb-action-label",children:i.label})]},i.id))})]}),mt=({onNewChat:a,agents:s,chatHistory:i})=>e.jsxs("div",{className:"cb-nav-sidebar",children:[e.jsx("div",{className:"cb-nav-header",children:e.jsxs("button",{className:"cb-new-chat-btn",onClick:a,children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),e.jsx("span",{children:"New chat"})]})}),e.jsxs("div",{className:"cb-nav-section",children:[e.jsx("h3",{className:"cb-nav-title",children:"Agents"}),s.map(o=>e.jsxs("div",{className:`cb-nav-item ${o.active?"active":""}`,onClick:o.onClick,children:[e.jsx("span",{className:"cb-item-icon",children:o.icon}),e.jsx("span",{className:"cb-item-label",children:o.label})]},o.id)),e.jsxs("div",{className:"cb-nav-item action",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),e.jsx("span",{className:"cb-item-label",children:"View all agents"})]})]}),e.jsxs("div",{className:"cb-nav-section",children:[e.jsx("h3",{className:"cb-nav-title",children:"Chats"}),i.map(o=>e.jsxs("div",{className:`cb-nav-item ${o.active?"active":""}`,onClick:o.onClick,children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"cb-item-icon",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),e.jsx("span",{className:"cb-item-label",children:o.label})]},o.id)),e.jsxs("div",{className:"cb-nav-item action",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),e.jsx("span",{className:"cb-item-label",children:"View all conversations"})]})]})]}),{useState:vt}=V,gt=({queue:a,onDelete:s})=>{const[i,o]=vt(!1);if(a.length===0)return null;const n=()=>o(!i);return e.jsxs("div",{className:`cb-pending-messages ${i?"expanded":"collapsed"}`,children:[e.jsxs("div",{className:"cb-pending-header",onClick:n,children:[e.jsx("div",{className:"cb-pending-toggle-icon",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})}),e.jsxs("div",{className:"cb-pending-preview",children:[e.jsx("span",{className:"cb-pending-badge",children:a.length}),e.jsx("span",{className:"cb-pending-preview-text",children:i?"Pending Messages":a[0]})]})]}),i&&e.jsx("div",{className:"cb-pending-list",children:a.map((u,m)=>e.jsxs("div",{className:"cb-pending-item",children:[e.jsxs("div",{className:"cb-pending-content",children:[e.jsx("span",{className:"cb-status-label",children:m===0?"NEXT":"WAIT"}),e.jsx("span",{className:"cb-pending-text",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u})]}),s&&e.jsx("button",{className:"cb-pending-remove",onClick:h=>{h.stopPropagation(),s(m)},title:"Remove",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},m))})]})},oe="http://localhost:8000/api";class pt{constructor(s){D(this,"accessToken",null);D(this,"messages",[]);D(this,"currentModel",null);D(this,"currentProvider",null);D(this,"enabledTools",[]);D(this,"currentJobId",null);D(this,"pageReadingCallback",null);this.accessToken=s}setToken(s){this.accessToken=s}setModel(s){s==="auto"||!s?(this.currentModel=null,this.currentProvider=null):(this.currentModel=s,this.currentProvider=s.startsWith("gpt")?"openai":"anthropic")}setEnabledTools(s){this.enabledTools=s}setPageReadingCallback(s){this.pageReadingCallback=s}async sendMessage(s,i){if(!this.accessToken){console.error("No access token available");return}const o={id:Date.now().toString(),role:"user",content:s};this.messages=[...this.messages,o],i({messages:this.messages,isThinking:!0});try{const n=this.messages.map(v=>({role:v.role,content:v.content})),u=await fetch(`${oe}/v1/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.accessToken}`},body:JSON.stringify({messages:n,model:this.currentModel,provider:this.currentProvider,stream:!0,metadata:{enabled_tools:this.enabledTools}})});if(!u.ok){let v=u.statusText;try{const c=await u.json();v=JSON.stringify(c)}catch{}throw new Error(`Gateway Request Failed: ${u.status} - ${v}`)}const{stream_url:m,job_id:h}=await u.json();if(this.currentJobId=h,!m)throw new Error("No stream URL received from gateway");const f=(Date.now()+1).toString(),w={id:f,role:"assistant",content:""};this.messages=[...this.messages,w],i({messages:this.messages,isThinking:!0});const p=new EventSource(m);let y="";p.addEventListener("delta",v=>{try{const c=JSON.parse(v.data);c.content&&(y+=c.content,this.messages=this.messages.map(d=>{if(d.id===f){let C={...d,content:y};if(d.steps&&d.steps.length>0){const g=[...d.steps],E=g[g.length-1];E&&E.type==="text"?g[g.length-1]={...E,content:(E.content||"")+c.content}:g.push({id:`text-${Date.now()}`,type:"text",content:c.content}),C.steps=g}return C}return d}),i({messages:this.messages,isThinking:!0}))}catch(c){console.warn("Failed to parse delta event data",c)}}),p.addEventListener("tool_call",v=>{try{const c=JSON.parse(v.data);console.log("Tool call received:",c),this.messages=this.messages.map(d=>{if(d.id===f){let C=d.steps?[...d.steps]:[];C.length===0&&y&&C.push({id:`text-pre-${Date.now()}`,type:"text",content:y});const g={id:c.id||`tool-${Date.now()}`,type:"tool-call",toolName:c.name||c.tool_name,toolArgs:c.arguments,toolStatus:"running"};return{...d,steps:[...C,g]}}return d}),i({messages:this.messages,isThinking:!0})}catch(c){console.warn("Failed to parse tool_call event data",c)}}),p.addEventListener("tool_result",v=>{try{const c=JSON.parse(v.data);console.log("Tool result received:",c),this.messages=this.messages.map(d=>{if(d.id===f&&d.steps){const C=d.steps.map(g=>g.type==="tool-call"&&(g.id===c.tool_call_id||g.toolName===c.tool_name)?{...g,toolStatus:"completed",toolResult:c.result}:g);return{...d,steps:C}}return d}),i({messages:this.messages,isThinking:!0})}catch(c){console.warn("Failed to parse tool_result event data",c)}}),p.addEventListener("confirm_request",v=>{try{const c=JSON.parse(v.data);console.log("Confirm request received:",c),this.messages=this.messages.map(d=>{if(d.id===f){let C=d.steps?[...d.steps]:[];return C.length===0&&y&&C.push({id:`text-pre-${Date.now()}`,type:"text",content:y}),C.push({id:c.tool_call_id,type:"confirm-request",toolCallId:c.tool_call_id,toolName:c.tool_name,confirmLabel:c.label,confirmDescription:c.description,confirmStatus:"pending"}),{...d,steps:C}}return d}),i({messages:this.messages,isThinking:!0})}catch(c){console.warn("Failed to parse confirm_request event data",c)}}),p.addEventListener("confirm_response",v=>{try{const c=JSON.parse(v.data);console.log("Confirm response received:",c),this.messages=this.messages.map(d=>{if(d.id===f&&d.steps){const C=d.steps.map(g=>g.type==="confirm-request"&&g.toolCallId===c.tool_call_id?{...g,confirmStatus:c.confirmed?"confirmed":"rejected"}:g);return{...d,steps:C}}return d}),i({messages:this.messages,isThinking:c.confirmed})}catch(c){console.warn("Failed to parse confirm_response event data",c)}}),p.addEventListener("client_tool_call",v=>{try{const c=JSON.parse(v.data);console.log("Client tool call received:",c),this.executeClientTool(c.tool_call_id,c.tool_name,c.arguments).then(()=>{console.log("Client tool executed successfully:",c.tool_name)}).catch(d=>{console.error("Client tool execution failed:",d)})}catch(c){console.warn("Failed to parse client_tool_call event data",c)}}),p.addEventListener("suspended",v=>{try{const c=JSON.parse(v.data);console.log("Job suspended, waiting for tools:",c.pending_tools)}catch(c){console.warn("Failed to parse suspended event data",c)}}),p.addEventListener("complete",()=>{p.close(),i({messages:this.messages,isThinking:!1})}),p.onerror=v=>{console.error("EventSource failed:",v),p.close(),y.length===0&&(this.messages=this.messages.map(c=>c.id===f?{...c,content:"Error: Connection to stream failed."}:c)),i({messages:this.messages,isThinking:!1})}}catch(n){console.error("RealChatClient Error:",n);const u={id:(Date.now()+1).toString(),role:"assistant",content:`Error: ${n.message||"Unknown error occurred."}`};this.messages=[...this.messages,u],i({messages:this.messages,isThinking:!1})}}reset(s){this.messages=[],this.currentJobId=null,s({messages:[],isThinking:!1})}async sendConfirmResponse(s,i){if(!this.accessToken||!this.currentJobId){console.error("No access token or job ID available");return}try{const o=await fetch(`${oe}/v1/confirm-response`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.accessToken}`},body:JSON.stringify({job_id:this.currentJobId,tool_call_id:s,confirmed:i})});if(!o.ok)throw new Error(`Confirm response failed: ${o.status}`);console.log("Confirm response sent:",{toolCallId:s,confirmed:i})}catch(o){console.error("Failed to send confirm response:",o)}}async executeClientTool(s,i,o){console.log("Executing client tool:",i,o);let n;try{switch(i){case"fetch_dom_context":this.pageReadingCallback&&this.pageReadingCallback(!0),n=await this.executeFetchDomContext(o);break;default:n=JSON.stringify({error:"unknown_tool",message:`Client-side tool '${i}' is not implemented`})}await this.submitToolResult(s,i,n)}catch(u){console.error("Client tool execution error:",u),await this.submitToolResult(s,i,JSON.stringify({error:"execution_failed",message:u.message||"Unknown error"}))}finally{i==="fetch_dom_context"&&this.pageReadingCallback&&this.pageReadingCallback(!1)}}async submitToolResult(s,i,o){if(!this.accessToken||!this.currentJobId){console.error("No access token or job ID available");return}try{const n=await fetch(`${oe}/v1/tools/jobs/${this.currentJobId}/tool-results`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.accessToken}`},body:JSON.stringify({tool_call_id:s,tool_name:i,result:o})});if(!n.ok)throw new Error(`Tool result submission failed: ${n.status}`);console.log("Tool result submitted:",{toolCallId:s,toolName:i})}catch(n){console.error("Failed to submit tool result:",n)}}async executeFetchDomContext(s){const{selector:i="body",include_metadata:o=!0,max_length:n=5e4}=s;try{const u=document.querySelector(i);if(!u)return JSON.stringify({error:"element_not_found",message:`No element found for selector: ${i}`});let m="";return o&&(m+=`URL: ${window.location.href}
|
|
32
|
+
`})]})},lt=({content:o,shouldAnimate:s,onComplete:i})=>{const[c,n]=re(s?"":o),u=Ee(!1);return Te(()=>{if(u.current=!1,!s||!o){n(o),u.current||(u.current=!0,i==null||i());return}let m,h;const f=Date.now(),w=15,p=o.length*w,y=()=>{const a=Date.now()-f,d=Math.floor(a/w);d<o.length?(n(o.substring(0,d+1)),m=requestAnimationFrame(y)):(n(o),u.current||(u.current=!0,i==null||i()))};return m=requestAnimationFrame(y),h=setTimeout(()=>{u.current||(n(o),u.current=!0,i==null||i())},p+100),()=>{cancelAnimationFrame(m),clearTimeout(h)}},[o,s]),e.jsxs("div",{className:"cb-markdown-content",children:[c,s&&o&&c.length<o.length&&e.jsx("span",{className:"cb-cursor",children:"|"})]})},dt=o=>{const{role:s,content:i,attachments:c,toolInvocation:n,shouldAnimate:u=!0}=o,[m,h]=re(""),f=Ee(!1);return Te(()=>{var C;if(f.current=!1,s!=="assistant"||!i||!u){h(i||""),f.current||(f.current=!0,(C=o.onAnimationComplete)==null||C.call(o));return}let w,p;const y=Date.now(),v=15,a=i.length*v,d=()=>{var A;const E=Date.now()-y,N=Math.floor(E/v);N<i.length?(h(i.substring(0,N+1)),w=requestAnimationFrame(d)):(h(i),f.current||(f.current=!0,(A=o.onAnimationComplete)==null||A.call(o)))};return w=requestAnimationFrame(d),p=setTimeout(()=>{var g;f.current||(h(i),f.current=!0,(g=o.onAnimationComplete)==null||g.call(o))},a+100),()=>{cancelAnimationFrame(w),clearTimeout(p)}},[i,s,u]),n?e.jsxs("div",{className:"cb-message-row cb-row-assistant",style:{marginBottom:"8px"},children:[e.jsx("div",{className:"cb-avatar-container",children:e.jsx("div",{className:"cb-avatar-assistant",style:{background:"#333"},children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"})})})}),e.jsx("div",{className:"cb-message-content-wrapper",children:e.jsx(ne,{toolName:n.toolName,args:n.args,status:n.status,result:n.result})})]}):e.jsxs("div",{className:`cb-message-row ${s==="user"?"cb-row-user":"cb-row-assistant"}`,children:[s==="assistant"&&e.jsx("div",{className:"cb-avatar-container",children:e.jsx("div",{className:"cb-avatar-assistant",children:e.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 2a10 10 0 0 1 10 10c0 5.524-4.476 10-10 10S2 17.524 2 12 6.476 2 12 2z"}),e.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),e.jsx("line",{x1:"9",y1:"9",x2:"9.01",y2:"9"}),e.jsx("line",{x1:"15",y1:"9",x2:"15.01",y2:"9"})]})})}),e.jsxs("div",{className:"cb-message-content-wrapper",children:[s==="user"?null:e.jsx("div",{className:"cb-sender-name",children:"Assistant"}),e.jsxs("div",{className:`cb-message-bubble ${s}`,children:[e.jsxs("div",{className:"cb-markdown-content",children:[m,s==="assistant"&&u&&i&&m.length<i.length&&e.jsx("span",{className:"cb-cursor",children:"|"})]}),c&&c.length>0&&e.jsx("div",{className:"cb-attachments-grid"})]})]})]})},ut=()=>e.jsxs("div",{className:"cb-thinking-container",children:[e.jsxs("div",{className:"cb-thinking-dots",children:[e.jsx("div",{className:"cb-dot"}),e.jsx("div",{className:"cb-dot"}),e.jsx("div",{className:"cb-dot"})]}),e.jsx("span",{className:"cb-thinking-text",children:"Thinking..."})]}),ht=({userName:o="User",actions:s=[]})=>e.jsxs("div",{className:"cb-welcome-container",children:[e.jsx("div",{className:"cb-welcome-logo",children:e.jsxs("svg",{width:"48",height:"48",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"}),e.jsx("path",{d:"M8 10h.01"}),e.jsx("path",{d:"M12 10h.01"}),e.jsx("path",{d:"M16 10h.01"})]})}),e.jsxs("h2",{className:"cb-welcome-title",children:["How can I help, ",o,"?"]}),e.jsx("div",{className:"cb-quick-actions-grid",children:s.map(i=>e.jsxs("button",{className:"cb-quick-action-card",onClick:i.onClick,children:[e.jsx("div",{className:"cb-action-icon",children:i.icon}),e.jsx("span",{className:"cb-action-label",children:i.label})]},i.id))})]}),ft=({onNewChat:o,agents:s,chatHistory:i})=>e.jsxs("div",{className:"cb-nav-sidebar",children:[e.jsx("div",{className:"cb-nav-header",children:e.jsxs("button",{className:"cb-new-chat-btn",onClick:o,children:[e.jsxs("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),e.jsx("span",{children:"New chat"})]})}),e.jsxs("div",{className:"cb-nav-section",children:[e.jsx("h3",{className:"cb-nav-title",children:"Agents"}),s.map(c=>e.jsxs("div",{className:`cb-nav-item ${c.active?"active":""}`,onClick:c.onClick,children:[e.jsx("span",{className:"cb-item-icon",children:c.icon}),e.jsx("span",{className:"cb-item-label",children:c.label})]},c.id)),e.jsxs("div",{className:"cb-nav-item action",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),e.jsx("span",{className:"cb-item-label",children:"View all agents"})]})]}),e.jsxs("div",{className:"cb-nav-section",children:[e.jsx("h3",{className:"cb-nav-title",children:"Chats"}),i.map(c=>e.jsxs("div",{className:`cb-nav-item ${c.active?"active":""}`,onClick:c.onClick,children:[e.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"cb-item-icon",children:e.jsx("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"})}),e.jsx("span",{className:"cb-item-label",children:c.label})]},c.id)),e.jsxs("div",{className:"cb-nav-item action",children:[e.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),e.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),e.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),e.jsx("span",{className:"cb-item-label",children:"View all conversations"})]})]})]}),{useState:xt}=S,mt=({queue:o,onDelete:s})=>{const[i,c]=xt(!1);if(o.length===0)return null;const n=()=>c(!i);return e.jsxs("div",{className:`cb-pending-messages ${i?"expanded":"collapsed"}`,children:[e.jsxs("div",{className:"cb-pending-header",onClick:n,children:[e.jsx("div",{className:"cb-pending-toggle-icon",children:e.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})})}),e.jsxs("div",{className:"cb-pending-preview",children:[e.jsx("span",{className:"cb-pending-badge",children:o.length}),e.jsx("span",{className:"cb-pending-preview-text",children:i?"Pending Messages":o[0]})]})]}),i&&e.jsx("div",{className:"cb-pending-list",children:o.map((u,m)=>e.jsxs("div",{className:"cb-pending-item",children:[e.jsxs("div",{className:"cb-pending-content",children:[e.jsx("span",{className:"cb-status-label",children:m===0?"NEXT":"WAIT"}),e.jsx("span",{className:"cb-pending-text",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:u})]}),s&&e.jsx("button",{className:"cb-pending-remove",onClick:h=>{h.stopPropagation(),s(m)},title:"Remove",children:e.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},m))})]})},ie="http://localhost:8000/api";class vt{constructor(s){L(this,"accessToken",null);L(this,"messages",[]);L(this,"currentModel",null);L(this,"currentProvider",null);L(this,"enabledTools",[]);L(this,"currentJobId",null);L(this,"pageReadingCallback",null);this.accessToken=s}setToken(s){this.accessToken=s}setModel(s){s==="auto"||!s?(this.currentModel=null,this.currentProvider=null):(this.currentModel=s,this.currentProvider=s.startsWith("gpt")?"openai":"anthropic")}setEnabledTools(s){this.enabledTools=s}setPageReadingCallback(s){this.pageReadingCallback=s}async sendMessage(s,i){if(!this.accessToken){console.error("No access token available");return}const c={id:Date.now().toString(),role:"user",content:s};this.messages=[...this.messages,c],i({messages:this.messages,isThinking:!0});try{const n=this.messages.map(v=>({role:v.role,content:v.content})),u=await fetch(`${ie}/v1/chat/completions`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.accessToken}`},body:JSON.stringify({messages:n,model:this.currentModel,provider:this.currentProvider,stream:!0,metadata:{enabled_tools:this.enabledTools}})});if(!u.ok){let v=u.statusText;try{const a=await u.json();v=JSON.stringify(a)}catch{}throw new Error(`Gateway Request Failed: ${u.status} - ${v}`)}const{stream_url:m,job_id:h}=await u.json();if(this.currentJobId=h,!m)throw new Error("No stream URL received from gateway");const f=(Date.now()+1).toString(),w={id:f,role:"assistant",content:""};this.messages=[...this.messages,w],i({messages:this.messages,isThinking:!0});const p=new EventSource(m);let y="";p.addEventListener("delta",v=>{try{const a=JSON.parse(v.data);a.content&&(y+=a.content,this.messages=this.messages.map(d=>{if(d.id===f){let C={...d,content:y};if(d.steps&&d.steps.length>0){const g=[...d.steps],E=g[g.length-1];E&&E.type==="text"?g[g.length-1]={...E,content:(E.content||"")+a.content}:g.push({id:`text-${Date.now()}`,type:"text",content:a.content}),C.steps=g}return C}return d}),i({messages:this.messages,isThinking:!0}))}catch(a){console.warn("Failed to parse delta event data",a)}}),p.addEventListener("tool_call",v=>{try{const a=JSON.parse(v.data);console.log("Tool call received:",a),this.messages=this.messages.map(d=>{if(d.id===f){let C=d.steps?[...d.steps]:[];C.length===0&&y&&C.push({id:`text-pre-${Date.now()}`,type:"text",content:y});const g={id:a.id||`tool-${Date.now()}`,type:"tool-call",toolName:a.name||a.tool_name,toolArgs:a.arguments,toolStatus:"running"};return{...d,steps:[...C,g]}}return d}),i({messages:this.messages,isThinking:!0})}catch(a){console.warn("Failed to parse tool_call event data",a)}}),p.addEventListener("tool_result",v=>{try{const a=JSON.parse(v.data);console.log("Tool result received:",a),this.messages=this.messages.map(d=>{if(d.id===f&&d.steps){const C=d.steps.map(g=>g.type==="tool-call"&&(g.id===a.tool_call_id||g.toolName===a.tool_name)?{...g,toolStatus:"completed",toolResult:a.result}:g);return{...d,steps:C}}return d}),i({messages:this.messages,isThinking:!0})}catch(a){console.warn("Failed to parse tool_result event data",a)}}),p.addEventListener("confirm_request",v=>{try{const a=JSON.parse(v.data);console.log("Confirm request received:",a),this.messages=this.messages.map(d=>{if(d.id===f){let C=d.steps?[...d.steps]:[];return C.length===0&&y&&C.push({id:`text-pre-${Date.now()}`,type:"text",content:y}),C.push({id:a.tool_call_id,type:"confirm-request",toolCallId:a.tool_call_id,toolName:a.tool_name,confirmLabel:a.label,confirmDescription:a.description,confirmStatus:"pending"}),{...d,steps:C}}return d}),i({messages:this.messages,isThinking:!0})}catch(a){console.warn("Failed to parse confirm_request event data",a)}}),p.addEventListener("confirm_response",v=>{try{const a=JSON.parse(v.data);console.log("Confirm response received:",a),this.messages=this.messages.map(d=>{if(d.id===f&&d.steps){const C=d.steps.map(g=>g.type==="confirm-request"&&g.toolCallId===a.tool_call_id?{...g,confirmStatus:a.confirmed?"confirmed":"rejected"}:g);return{...d,steps:C}}return d}),i({messages:this.messages,isThinking:a.confirmed})}catch(a){console.warn("Failed to parse confirm_response event data",a)}}),p.addEventListener("client_tool_call",v=>{try{const a=JSON.parse(v.data);console.log("Client tool call received:",a),this.executeClientTool(a.tool_call_id,a.tool_name,a.arguments).then(()=>{console.log("Client tool executed successfully:",a.tool_name)}).catch(d=>{console.error("Client tool execution failed:",d)})}catch(a){console.warn("Failed to parse client_tool_call event data",a)}}),p.addEventListener("suspended",v=>{try{const a=JSON.parse(v.data);console.log("Job suspended, waiting for tools:",a.pending_tools)}catch(a){console.warn("Failed to parse suspended event data",a)}}),p.addEventListener("complete",()=>{p.close(),i({messages:this.messages,isThinking:!1})}),p.onerror=v=>{console.error("EventSource failed:",v),p.close(),y.length===0&&(this.messages=this.messages.map(a=>a.id===f?{...a,content:"Error: Connection to stream failed."}:a)),i({messages:this.messages,isThinking:!1})}}catch(n){console.error("RealChatClient Error:",n);const u={id:(Date.now()+1).toString(),role:"assistant",content:`Error: ${n.message||"Unknown error occurred."}`};this.messages=[...this.messages,u],i({messages:this.messages,isThinking:!1})}}reset(s){this.messages=[],this.currentJobId=null,s({messages:[],isThinking:!1})}async sendConfirmResponse(s,i){if(!this.accessToken||!this.currentJobId){console.error("No access token or job ID available");return}try{const c=await fetch(`${ie}/v1/confirm-response`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.accessToken}`},body:JSON.stringify({job_id:this.currentJobId,tool_call_id:s,confirmed:i})});if(!c.ok)throw new Error(`Confirm response failed: ${c.status}`);console.log("Confirm response sent:",{toolCallId:s,confirmed:i})}catch(c){console.error("Failed to send confirm response:",c)}}async executeClientTool(s,i,c){console.log("Executing client tool:",i,c);let n;try{switch(i){case"fetch_dom_context":this.pageReadingCallback&&this.pageReadingCallback(!0),n=await this.executeFetchDomContext(c);break;default:n=JSON.stringify({error:"unknown_tool",message:`Client-side tool '${i}' is not implemented`})}await this.submitToolResult(s,i,n)}catch(u){console.error("Client tool execution error:",u),await this.submitToolResult(s,i,JSON.stringify({error:"execution_failed",message:u.message||"Unknown error"}))}finally{i==="fetch_dom_context"&&this.pageReadingCallback&&this.pageReadingCallback(!1)}}async submitToolResult(s,i,c){if(!this.accessToken||!this.currentJobId){console.error("No access token or job ID available");return}try{const n=await fetch(`${ie}/v1/tools/jobs/${this.currentJobId}/tool-results`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.accessToken}`},body:JSON.stringify({tool_call_id:s,tool_name:i,result:c})});if(!n.ok)throw new Error(`Tool result submission failed: ${n.status}`);console.log("Tool result submitted:",{toolCallId:s,toolName:i})}catch(n){console.error("Failed to submit tool result:",n)}}async executeFetchDomContext(s){const{selector:i="body",include_metadata:c=!0,max_length:n=5e4}=s;try{const u=document.querySelector(i);if(!u)return JSON.stringify({error:"element_not_found",message:`No element found for selector: ${i}`});let m="";return c&&(m+=`URL: ${window.location.href}
|
|
33
33
|
`,m+=`Title: ${document.title}
|
|
34
34
|
`,m+=`Timestamp: ${new Date().toISOString()}
|
|
35
35
|
|
|
@@ -37,18 +37,18 @@ React keys must be passed directly to JSX without using spread:
|
|
|
37
37
|
|
|
38
38
|
`),m+=this.extractElementContent(u,0),m.length>n&&(m=m.substring(0,n)+`
|
|
39
39
|
|
|
40
|
-
[Content truncated]`),JSON.stringify({success:!0,content:m,length:m.length,truncated:m.length>n})}catch(u){return JSON.stringify({error:"extraction_failed",message:u.message||"Unknown error during DOM extraction"})}}extractElementContent(s,i){var p,y,v,
|
|
40
|
+
[Content truncated]`),JSON.stringify({success:!0,content:m,length:m.length,truncated:m.length>n})}catch(u){return JSON.stringify({error:"extraction_failed",message:u.message||"Unknown error during DOM extraction"})}}extractElementContent(s,i){var p,y,v,a,d,C;const c=" ".repeat(i);let n="";const u=window.getComputedStyle(s);if(u.display==="none"||u.visibility==="hidden"||u.opacity==="0"||["SCRIPT","STYLE","NOSCRIPT","SVG","IFRAME"].includes(s.tagName))return"";const h=s.tagName;if(/^H[1-6]$/.test(h)){const g=parseInt(h[1]),E=(p=s.textContent)==null?void 0:p.trim();return E&&(n+=`${c}${"#".repeat(g)} ${E}
|
|
41
41
|
|
|
42
|
-
`),n}if(h==="P"){const g=(y=s.textContent)==null?void 0:y.trim();return g&&(n+=`${
|
|
42
|
+
`),n}if(h==="P"){const g=(y=s.textContent)==null?void 0:y.trim();return g&&(n+=`${c}${g}
|
|
43
43
|
|
|
44
|
-
`),n}if(h==="UL"||h==="OL")return s.querySelectorAll(":scope > li").forEach((E,N)=>{var M;const A=h==="OL"?`${N+1}.`:"-",I=(M=E.textContent)==null?void 0:M.trim();I&&(n+=`${
|
|
44
|
+
`),n}if(h==="UL"||h==="OL")return s.querySelectorAll(":scope > li").forEach((E,N)=>{var M;const A=h==="OL"?`${N+1}.`:"-",I=(M=E.textContent)==null?void 0:M.trim();I&&(n+=`${c}${A} ${I}
|
|
45
45
|
`)}),n+=`
|
|
46
|
-
`,n;if(h==="TABLE")return n+=`${
|
|
47
|
-
`,s.querySelectorAll("tr").forEach(E=>{const N=E.querySelectorAll("td, th"),A=Array.from(N).map(I=>{var M;return(M=I.textContent)==null?void 0:M.trim()}).filter(I=>I).join(" | ");A&&(n+=`${
|
|
46
|
+
`,n;if(h==="TABLE")return n+=`${c}[Table]
|
|
47
|
+
`,s.querySelectorAll("tr").forEach(E=>{const N=E.querySelectorAll("td, th"),A=Array.from(N).map(I=>{var M;return(M=I.textContent)==null?void 0:M.trim()}).filter(I=>I).join(" | ");A&&(n+=`${c} ${A}
|
|
48
48
|
`)}),n+=`
|
|
49
|
-
`,n;if(["HEADER","NAV","MAIN","ARTICLE","SECTION","ASIDE","FOOTER"].includes(h))return n+=`${
|
|
49
|
+
`,n;if(["HEADER","NAV","MAIN","ARTICLE","SECTION","ASIDE","FOOTER"].includes(h))return n+=`${c}[${h}]
|
|
50
50
|
`,Array.from(s.children).forEach(g=>{n+=this.extractElementContent(g,i+1)}),n+=`
|
|
51
|
-
`,n;if(h==="A"){const g=(v=s.textContent)==null?void 0:v.trim(),E=s.getAttribute("href");return g&&E&&(n+=`${
|
|
52
|
-
`),n}if(["BUTTON","INPUT","SELECT","TEXTAREA"].includes(h)){const g=((
|
|
53
|
-
`),n}const f=s.children.length>0,w=f?"":(C=s.textContent)==null?void 0:C.trim();return!f&&w?(n+=`${
|
|
54
|
-
`,n):(f&&Array.from(s.children).forEach(g=>{n+=this.extractElementContent(g,i)}),n)}}const
|
|
51
|
+
`,n;if(h==="A"){const g=(v=s.textContent)==null?void 0:v.trim(),E=s.getAttribute("href");return g&&E&&(n+=`${c}[${g}](${E})
|
|
52
|
+
`),n}if(["BUTTON","INPUT","SELECT","TEXTAREA"].includes(h)){const g=((a=s.textContent)==null?void 0:a.trim())||((d=s.value)==null?void 0:d.trim());return g&&(n+=`${c}[${h}] ${g}
|
|
53
|
+
`),n}const f=s.children.length>0,w=f?"":(C=s.textContent)==null?void 0:C.trim();return!f&&w?(n+=`${c}${w}
|
|
54
|
+
`,n):(f&&Array.from(s.children).forEach(g=>{n+=this.extractElementContent(g,i)}),n)}}const gt="http://localhost:11700";class pt{static async getInitialToken(){try{const s=await fetch(`${gt}/request-token`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!s.ok){const c=await s.text();throw new Error(`Failed to fetch token: ${s.status} ${c}`)}return(await s.json()).access_token}catch(s){throw console.error("Error fetching initial token:",s),s}}static async refreshToken(){return console.log("Refreshing token via broker..."),this.getInitialToken()}}_.AuthClient=pt,_.ChatContainer=et,_.ChatLauncher=be,_.Composer=it,_.ConfirmButtons=Ce,_.MessageBubble=ot,_.NavigationSidebar=ft,_.PendingMessageList=mt,_.RealChatClient=vt,_.ThinkingIndicator=ut,_.ToolInvocation=ne,_.WelcomeScreen=ht,Object.defineProperty(_,Symbol.toStringTag,{value:"Module"})});
|