@webless/agent 0.13.1 → 0.14.0

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/embed.cjs CHANGED
@@ -64,7 +64,7 @@ function submitAgentPanel(customerId, message, options) {
64
64
  }
65
65
 
66
66
  // src/react/components/AgentWidget/AgentWidget.tsx
67
- var import_react20 = require("react");
67
+ var import_react19 = require("react");
68
68
 
69
69
  // src/react/page-shift.ts
70
70
  var import_react = require("react");
@@ -4221,7 +4221,7 @@ function normalizeAgentPlacement(placement) {
4221
4221
  }
4222
4222
 
4223
4223
  // src/react/components/AgentRail/AgentRail.tsx
4224
- var import_react18 = require("react");
4224
+ var import_react17 = require("react");
4225
4225
 
4226
4226
  // src/react/types/conversation.ts
4227
4227
  var defaultAgentRailTheme = {
@@ -4233,7 +4233,7 @@ var defaultAgentRailTheme = {
4233
4233
  surfaceMuted: "#f4f6fb",
4234
4234
  text: "#171b2a",
4235
4235
  textMuted: "#5a6378",
4236
- textSubtle: "#8a94a8",
4236
+ textSubtle: "#6b7280",
4237
4237
  border: "rgb(42 51 70 / 0.1)",
4238
4238
  visitorBubble: "#f3edff",
4239
4239
  visitorText: "#171b2a",
@@ -4262,9 +4262,146 @@ var defaultDarkAgentRailTheme = {
4262
4262
  };
4263
4263
 
4264
4264
  // src/react/lib/agent-theme.ts
4265
+ var HEX_COLOR_PATTERN = /^#(?:[\dA-Fa-f]{3}|[\dA-Fa-f]{6})$/;
4266
+ var NAMED_COLOR_HEX = Object.fromEntries(
4267
+ "aliceblue:#f0f8ff,antiquewhite:#faebd7,aqua:#00ffff,aquamarine:#7fffd4,azure:#f0ffff,beige:#f5f5dc,bisque:#ffe4c4,black:#000000,blanchedalmond:#ffebcd,blue:#0000ff,blueviolet:#8a2be2,brown:#a52a2a,burlywood:#deb887,cadetblue:#5f9ea0,chartreuse:#7fff00,chocolate:#d2691e,coral:#ff7f50,cornflowerblue:#6495ed,cornsilk:#fff8dc,crimson:#dc143c,cyan:#00ffff,darkblue:#00008b,darkcyan:#008b8b,darkgoldenrod:#b8860b,darkgray:#a9a9a9,darkgreen:#006400,darkgrey:#a9a9a9,darkkhaki:#bdb76b,darkmagenta:#8b008b,darkolivegreen:#556b2f,darkorange:#ff8c00,darkorchid:#9932cc,darkred:#8b0000,darksalmon:#e9967a,darkseagreen:#8fbc8f,darkslateblue:#483d8b,darkslategray:#2f4f4f,darkslategrey:#2f4f4f,darkturquoise:#00ced1,darkviolet:#9400d3,deeppink:#ff1493,deepskyblue:#00bfff,dimgray:#696969,dimgrey:#696969,dodgerblue:#1e90ff,firebrick:#b22222,floralwhite:#fffaf0,forestgreen:#228b22,fuchsia:#ff00ff,gainsboro:#dcdcdc,ghostwhite:#f8f8ff,gold:#ffd700,goldenrod:#daa520,gray:#808080,green:#008000,greenyellow:#adff2f,grey:#808080,honeydew:#f0fff0,hotpink:#ff69b4,indianred:#cd5c5c,indigo:#4b0082,ivory:#fffff0,khaki:#f0e68c,lavender:#e6e6fa,lavenderblush:#fff0f5,lawngreen:#7cfc00,lemonchiffon:#fffacd,lightblue:#add8e6,lightcoral:#f08080,lightcyan:#e0ffff,lightgoldenrodyellow:#fafad2,lightgray:#d3d3d3,lightgreen:#90ee90,lightgrey:#d3d3d3,lightpink:#ffb6c1,lightsalmon:#ffa07a,lightseagreen:#20b2aa,lightskyblue:#87cefa,lightslategray:#778899,lightslategrey:#778899,lightsteelblue:#b0c4de,lightyellow:#ffffe0,lime:#00ff00,limegreen:#32cd32,linen:#faf0e6,magenta:#ff00ff,maroon:#800000,mediumaquamarine:#66cdaa,mediumblue:#0000cd,mediumorchid:#ba55d3,mediumpurple:#9370db,mediumseagreen:#3cb371,mediumslateblue:#7b68ee,mediumspringgreen:#00fa9a,mediumturquoise:#48d1cc,mediumvioletred:#c71585,midnightblue:#191970,mintcream:#f5fffa,mistyrose:#ffe4e1,moccasin:#ffe4b5,navajowhite:#ffdead,navy:#000080,oldlace:#fdf5e6,olive:#808000,olivedrab:#6b8e23,orange:#ffa500,orangered:#ff4500,orchid:#da70d6,palegoldenrod:#eee8aa,palegreen:#98fb98,paleturquoise:#afeeee,palevioletred:#db7093,papayawhip:#ffefd5,peachpuff:#ffdab9,peru:#cd853f,pink:#ffc0cb,plum:#dda0dd,powderblue:#b0e0e6,purple:#800080,rebeccapurple:#663399,red:#ff0000,rosybrown:#bc8f8f,royalblue:#4169e1,saddlebrown:#8b4513,salmon:#fa8072,sandybrown:#f4a460,seagreen:#2e8b57,seashell:#fff5ee,sienna:#a0522d,silver:#c0c0c0,skyblue:#87ceeb,slateblue:#6a5acd,slategray:#708090,slategrey:#708090,snow:#fffafa,springgreen:#00ff7f,steelblue:#4682b4,tan:#d2b48c,teal:#008080,thistle:#d8bfd8,tomato:#ff6347,turquoise:#40e0d0,violet:#ee82ee,wheat:#f5deb3,white:#ffffff,whitesmoke:#f5f5f5,yellow:#ffff00,yellowgreen:#9acd32".split(",").map((entry) => entry.split(":"))
4268
+ );
4269
+ function rgbLuminance(r, g, b) {
4270
+ const [lr = 0, lg = 0, lb = 0] = [r, g, b].map((channel) => {
4271
+ const normalized = channel / 255;
4272
+ return normalized <= 0.03928 ? normalized / 12.92 : Math.pow((normalized + 0.055) / 1.055, 2.4);
4273
+ });
4274
+ return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;
4275
+ }
4276
+ function hexColorLuminance(value) {
4277
+ const normalized = value.trim();
4278
+ if (!HEX_COLOR_PATTERN.test(normalized)) return null;
4279
+ const raw = normalized.slice(1);
4280
+ const full = raw.length === 3 ? raw.split("").map((channel) => channel + channel).join("") : raw;
4281
+ const [r = 0, g = 0, b = 0] = [0, 2, 4].map(
4282
+ (index) => parseInt(full.slice(index, index + 2), 16)
4283
+ );
4284
+ return rgbLuminance(r, g, b);
4285
+ }
4286
+ function splitColorBody(body) {
4287
+ let colorPart = body;
4288
+ let alphaToken;
4289
+ const slashIndex = body.lastIndexOf("/");
4290
+ if (slashIndex >= 0) {
4291
+ colorPart = body.slice(0, slashIndex);
4292
+ alphaToken = body.slice(slashIndex + 1);
4293
+ }
4294
+ const parts = colorPart.includes(",") ? colorPart.split(",") : colorPart.trim().split(/\s+/);
4295
+ if (colorPart.includes(",") && parts.length === 4) {
4296
+ alphaToken = parts.pop();
4297
+ }
4298
+ return { parts, alphaToken };
4299
+ }
4300
+ function parseAlpha(token) {
4301
+ if (token === void 0) return 1;
4302
+ const trimmed = token.trim();
4303
+ if (!trimmed) return 1;
4304
+ return trimmed.endsWith("%") ? parseFloat(trimmed) / 100 : parseFloat(trimmed);
4305
+ }
4306
+ function parseRgbChannels(value) {
4307
+ const match = /^rgba?\(\s*([^)]*?)\s*\)$/i.exec(value);
4308
+ if (!match) return null;
4309
+ const { parts, alphaToken } = splitColorBody(match[1] ?? "");
4310
+ if (parts.length < 3) return null;
4311
+ const alpha = parseAlpha(alphaToken);
4312
+ const channels = parts.slice(0, 3).map((part) => {
4313
+ const token = part.trim();
4314
+ return token.endsWith("%") ? parseFloat(token) / 100 * 255 : parseFloat(token);
4315
+ });
4316
+ if ([...channels, alpha].some((channel) => Number.isNaN(channel))) {
4317
+ return null;
4318
+ }
4319
+ return [channels[0] ?? 0, channels[1] ?? 0, channels[2] ?? 0, alpha];
4320
+ }
4321
+ function parseHslChannels(value) {
4322
+ const match = /^hsla?\(\s*([^)]*?)\s*\)$/i.exec(value);
4323
+ if (!match) return null;
4324
+ const { parts, alphaToken } = splitColorBody(match[1] ?? "");
4325
+ if (parts.length < 3) return null;
4326
+ const alpha = parseAlpha(alphaToken);
4327
+ const hueToken = (parts[0] ?? "").trim().toLowerCase();
4328
+ const hueRaw = parseFloat(hueToken);
4329
+ const saturation = parseFloat(parts[1] ?? "");
4330
+ const lightness = parseFloat(parts[2] ?? "");
4331
+ if ([hueRaw, saturation, lightness, alpha].some((n) => Number.isNaN(n))) {
4332
+ return null;
4333
+ }
4334
+ const hueDeg = hueToken.endsWith("turn") ? hueRaw * 360 : hueToken.endsWith("rad") ? hueRaw * 180 / Math.PI : hueRaw;
4335
+ const s = saturation / 100;
4336
+ const l = lightness / 100;
4337
+ const chroma = (1 - Math.abs(2 * l - 1)) * s;
4338
+ const huePrime = (hueDeg % 360 + 360) % 360 / 60;
4339
+ const x = chroma * (1 - Math.abs(huePrime % 2 - 1));
4340
+ const pairs = [
4341
+ [chroma, x, 0],
4342
+ [x, chroma, 0],
4343
+ [0, chroma, x],
4344
+ [0, x, chroma],
4345
+ [x, 0, chroma],
4346
+ [chroma, 0, x]
4347
+ ];
4348
+ const [r1 = 0, g1 = 0, b1 = 0] = pairs[Math.floor(huePrime) % 6] ?? [];
4349
+ const m = l - chroma / 2;
4350
+ return [(r1 + m) * 255, (g1 + m) * 255, (b1 + m) * 255, alpha];
4351
+ }
4352
+ var colorProbeElement = null;
4353
+ function normalizeColorWithDom(value) {
4354
+ if (typeof document === "undefined") return null;
4355
+ colorProbeElement ??= document.createElement("span");
4356
+ colorProbeElement.style.color = "";
4357
+ colorProbeElement.style.color = value;
4358
+ return colorProbeElement.style.color || null;
4359
+ }
4360
+ var LIGHT_SURFACE_LUMINANCE_THRESHOLD = 0.35;
4361
+ function channelsLuminance([r, g, b, alpha]) {
4362
+ if (alpha >= 1) return rgbLuminance(r, g, b);
4363
+ if (alpha <= 0) return null;
4364
+ const overBlack = rgbLuminance(r * alpha, g * alpha, b * alpha);
4365
+ const overWhite = rgbLuminance(
4366
+ r * alpha + (1 - alpha) * 255,
4367
+ g * alpha + (1 - alpha) * 255,
4368
+ b * alpha + (1 - alpha) * 255
4369
+ );
4370
+ const blackIsLight = overBlack > LIGHT_SURFACE_LUMINANCE_THRESHOLD;
4371
+ const whiteIsLight = overWhite > LIGHT_SURFACE_LUMINANCE_THRESHOLD;
4372
+ if (blackIsLight !== whiteIsLight) return null;
4373
+ return blackIsLight ? Math.min(overBlack, overWhite) : Math.max(overBlack, overWhite);
4374
+ }
4375
+ function cssColorLuminance(value) {
4376
+ const trimmed = value.trim();
4377
+ if (!trimmed) return null;
4378
+ const namedHex = NAMED_COLOR_HEX[trimmed.toLowerCase()];
4379
+ const hex = hexColorLuminance(namedHex ?? trimmed);
4380
+ if (hex !== null) return hex;
4381
+ const channels = parseRgbChannels(trimmed) ?? parseHslChannels(trimmed);
4382
+ if (channels) return channelsLuminance(channels);
4383
+ const normalized = normalizeColorWithDom(trimmed);
4384
+ if (!normalized || normalized === trimmed) return null;
4385
+ const normalizedHex = hexColorLuminance(normalized);
4386
+ if (normalizedHex !== null) return normalizedHex;
4387
+ const normalizedChannels = parseRgbChannels(normalized) ?? parseHslChannels(normalized);
4388
+ return normalizedChannels ? channelsLuminance(normalizedChannels) : null;
4389
+ }
4390
+ function resolveEffectiveColorScheme(theme, resolvedColorScheme) {
4391
+ if (resolvedColorScheme !== "dark") return "light";
4392
+ const surface = theme?.surface?.trim();
4393
+ if (!surface) return "dark";
4394
+ const luminance = cssColorLuminance(surface);
4395
+ if (luminance === null) return "dark";
4396
+ return luminance > LIGHT_SURFACE_LUMINANCE_THRESHOLD ? "light" : "dark";
4397
+ }
4265
4398
  function agentThemeStyle(theme, resolvedColorScheme) {
4266
4399
  const brandedTheme = { ...defaultAgentRailTheme, ...theme };
4267
- const resolvedTheme = resolvedColorScheme === "dark" ? {
4400
+ const effectiveColorScheme = resolveEffectiveColorScheme(
4401
+ theme,
4402
+ resolvedColorScheme
4403
+ );
4404
+ const resolvedTheme = effectiveColorScheme === "dark" ? {
4268
4405
  ...brandedTheme,
4269
4406
  brand: theme?.brand ?? defaultDarkAgentRailTheme.brand,
4270
4407
  brandDeep: theme?.brandDeep ?? defaultDarkAgentRailTheme.brandDeep,
@@ -4299,7 +4436,7 @@ function agentThemeStyle(theme, resolvedColorScheme) {
4299
4436
  "--as-danger": resolvedTheme.danger,
4300
4437
  "--as-font-body": resolvedTheme.fontBody,
4301
4438
  "--as-font-display": resolvedTheme.fontDisplay,
4302
- colorScheme: resolvedColorScheme
4439
+ colorScheme: effectiveColorScheme
4303
4440
  };
4304
4441
  }
4305
4442
 
@@ -4503,114 +4640,11 @@ function AgentActivityBubble({
4503
4640
  ] });
4504
4641
  }
4505
4642
 
4506
- // src/react/components/LearnMore/LearnMore.tsx
4643
+ // src/react/components/SearchReferences/SearchReferences.tsx
4507
4644
  var import_react7 = require("react");
4508
4645
  var import_jsx_runtime2 = require("react/jsx-runtime");
4509
- function QuestionIcon() {
4510
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4511
- "svg",
4512
- {
4513
- viewBox: "0 0 24 24",
4514
- width: "18",
4515
- height: "18",
4516
- fill: "none",
4517
- stroke: "currentColor",
4518
- strokeWidth: "1.5",
4519
- strokeLinecap: "round",
4520
- strokeLinejoin: "round",
4521
- "aria-hidden": "true",
4522
- children: [
4523
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
4524
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
4525
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 17h.01" })
4526
- ]
4527
- }
4528
- );
4529
- }
4530
- function LearnMore({
4531
- results,
4532
- disabled,
4533
- onSelect
4534
- }) {
4535
- const headingId = (0, import_react7.useId)();
4536
- const panelId = (0, import_react7.useId)();
4537
- const [open, setOpen] = (0, import_react7.useState)(true);
4538
- const questions = [
4539
- ...new Set(results.flatMap((result) => result.suggestions ?? []))
4540
- ].slice(0, 3);
4541
- if (!questions.length) return null;
4542
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "learn-more", "aria-labelledby": headingId, children: [
4543
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { id: headingId, className: "learn-more__heading", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4544
- "button",
4545
- {
4546
- type: "button",
4547
- className: "learn-more__toggle",
4548
- "aria-expanded": open,
4549
- "aria-controls": panelId,
4550
- onClick: () => setOpen((current) => !current),
4551
- children: [
4552
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Learn more" }),
4553
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4554
- "svg",
4555
- {
4556
- className: "learn-more__chevron",
4557
- viewBox: "0 0 16 16",
4558
- fill: "none",
4559
- "aria-hidden": "true",
4560
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4561
- "path",
4562
- {
4563
- d: "M4 6.5l4 4 4-4",
4564
- stroke: "currentColor",
4565
- strokeWidth: "1.6",
4566
- strokeLinecap: "round",
4567
- strokeLinejoin: "round"
4568
- }
4569
- )
4570
- }
4571
- )
4572
- ]
4573
- }
4574
- ) }),
4575
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4576
- "div",
4577
- {
4578
- id: panelId,
4579
- className: `learn-more__panel${open ? " learn-more__panel--open" : ""}`,
4580
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "learn-more__panel-inner", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "learn-more__questions", children: questions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4581
- "button",
4582
- {
4583
- type: "button",
4584
- disabled,
4585
- onClick: () => onSelect(question),
4586
- children: [
4587
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "learn-more__question-icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(QuestionIcon, {}) }),
4588
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "learn-more__question-text", children: question }),
4589
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4590
- "svg",
4591
- {
4592
- className: "learn-more__question-arrow",
4593
- viewBox: "0 0 24 24",
4594
- fill: "none",
4595
- stroke: "currentColor",
4596
- strokeWidth: "1.5",
4597
- "aria-hidden": "true",
4598
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4 12h16m-7-7 7 7-7 7" })
4599
- }
4600
- )
4601
- ]
4602
- }
4603
- ) }, question)) }) })
4604
- }
4605
- )
4606
- ] });
4607
- }
4608
-
4609
- // src/react/components/SearchReferences/SearchReferences.tsx
4610
- var import_react8 = require("react");
4611
- var import_jsx_runtime3 = require("react/jsx-runtime");
4612
4646
  function SiteIcon() {
4613
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4647
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4614
4648
  "svg",
4615
4649
  {
4616
4650
  viewBox: "0 0 24 24",
@@ -4621,15 +4655,15 @@ function SiteIcon() {
4621
4655
  strokeWidth: "1.5",
4622
4656
  "aria-hidden": "true",
4623
4657
  children: [
4624
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
4625
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
4626
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
4658
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
4659
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
4660
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
4627
4661
  ]
4628
4662
  }
4629
4663
  );
4630
4664
  }
4631
4665
  function SourceFavicon({ url }) {
4632
- const [failed, setFailed] = (0, import_react8.useState)(false);
4666
+ const [failed, setFailed] = (0, import_react7.useState)(false);
4633
4667
  let faviconUrl = null;
4634
4668
  if (url) {
4635
4669
  try {
@@ -4638,8 +4672,8 @@ function SourceFavicon({ url }) {
4638
4672
  faviconUrl = null;
4639
4673
  }
4640
4674
  }
4641
- if (!faviconUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SiteIcon, {});
4642
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4675
+ if (!faviconUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SiteIcon, {});
4676
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4643
4677
  "img",
4644
4678
  {
4645
4679
  src: faviconUrl,
@@ -4659,37 +4693,53 @@ function searchSources(results) {
4659
4693
  return [{ ...source, url, key }];
4660
4694
  });
4661
4695
  }
4662
- function SearchReferences({
4663
- results,
4664
- mode = "default"
4665
- }) {
4666
- const sources = searchSources(results);
4696
+ function searchActions(results) {
4667
4697
  const seenActions = /* @__PURE__ */ new Set();
4668
- const actions = results.flatMap((result) => {
4698
+ return results.flatMap((result) => {
4669
4699
  const url = safeSearchUrl(result.cta?.url);
4670
4700
  if (!url || !result.cta || seenActions.has(url)) return [];
4671
4701
  seenActions.add(url);
4672
4702
  return [{ label: result.cta.label, url }];
4673
4703
  });
4704
+ }
4705
+ function searchSuggestions(results) {
4706
+ return [
4707
+ ...new Set(results.flatMap((result) => result.suggestions ?? []))
4708
+ ].slice(0, 3);
4709
+ }
4710
+ function searchActionLinkTitle(url) {
4711
+ try {
4712
+ const hostname = new URL(url).hostname.replace(/^www\./, "");
4713
+ return hostname ? `Opens ${hostname} in a new tab` : "Opens in a new tab";
4714
+ } catch {
4715
+ return "Opens in a new tab";
4716
+ }
4717
+ }
4718
+ function SearchReferences({
4719
+ results,
4720
+ mode = "default"
4721
+ }) {
4722
+ const sources = searchSources(results);
4723
+ const actions = searchActions(results);
4674
4724
  if (!(mode !== "actions" && sources.length) && !(mode !== "sources" && actions.length))
4675
4725
  return null;
4676
4726
  const Container = mode === "default" ? "details" : "div";
4677
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "search-references", children: [
4678
- mode !== "actions" && sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4727
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "search-references", children: [
4728
+ mode !== "actions" && sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4679
4729
  Container,
4680
4730
  {
4681
4731
  className: "search-references__disclosure",
4682
4732
  "aria-label": "Sources",
4683
4733
  children: [
4684
- mode === "default" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("summary", { className: "search-references__heading", children: [
4734
+ mode === "default" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("summary", { className: "search-references__heading", children: [
4685
4735
  "Sources (",
4686
4736
  sources.length,
4687
4737
  ")"
4688
4738
  ] }) : null,
4689
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
4690
- const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
4691
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SourceFavicon, { url: source.url }) }),
4692
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4739
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
4740
+ const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_jsx_runtime2.Fragment, { children: [
4741
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(SourceFavicon, { url: source.url }) }),
4742
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4693
4743
  "span",
4694
4744
  {
4695
4745
  className: "search-references__title",
@@ -4697,7 +4747,7 @@ function SearchReferences({
4697
4747
  children: source.title
4698
4748
  }
4699
4749
  ),
4700
- source.url ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4750
+ source.url ? /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4701
4751
  "svg",
4702
4752
  {
4703
4753
  className: "search-references__row-arrow",
@@ -4705,12 +4755,17 @@ function SearchReferences({
4705
4755
  fill: "none",
4706
4756
  stroke: "currentColor",
4707
4757
  strokeWidth: "1.5",
4758
+ strokeLinecap: "round",
4759
+ strokeLinejoin: "round",
4708
4760
  "aria-hidden": "true",
4709
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 12h16m-7-7 7 7-7 7" })
4761
+ children: [
4762
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7 17 17 7" }),
4763
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M8 7h9v9" })
4764
+ ]
4710
4765
  }
4711
4766
  ) : null
4712
4767
  ] });
4713
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4768
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4714
4769
  "a",
4715
4770
  {
4716
4771
  className: "search-references__source",
@@ -4719,12 +4774,12 @@ function SearchReferences({
4719
4774
  rel: "noopener noreferrer",
4720
4775
  children: content
4721
4776
  }
4722
- ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
4777
+ ) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
4723
4778
  }) })
4724
4779
  ]
4725
4780
  }
4726
4781
  ) : null,
4727
- mode !== "sources" && actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4782
+ mode !== "sources" && actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4728
4783
  "a",
4729
4784
  {
4730
4785
  className: "search-references__cta",
@@ -4738,18 +4793,91 @@ function SearchReferences({
4738
4793
  ] });
4739
4794
  }
4740
4795
 
4796
+ // src/react/components/ExploreMore/ExploreMore.tsx
4797
+ var import_jsx_runtime3 = require("react/jsx-runtime");
4798
+ function QuestionIcon() {
4799
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4800
+ "svg",
4801
+ {
4802
+ viewBox: "0 0 24 24",
4803
+ width: "18",
4804
+ height: "18",
4805
+ fill: "none",
4806
+ stroke: "currentColor",
4807
+ strokeWidth: "1.5",
4808
+ strokeLinecap: "round",
4809
+ strokeLinejoin: "round",
4810
+ "aria-hidden": "true",
4811
+ children: [
4812
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
4813
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
4814
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 17h.01" })
4815
+ ]
4816
+ }
4817
+ );
4818
+ }
4819
+ function ExploreMore({
4820
+ results,
4821
+ disabled,
4822
+ onSelectQuestion,
4823
+ showLearnMore = true,
4824
+ showSources = true
4825
+ }) {
4826
+ const sources = showSources ? searchSources(results) : [];
4827
+ const questions = showLearnMore ? searchSuggestions(results) : [];
4828
+ if (!sources.length && !questions.length) return null;
4829
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "explore-more", children: [
4830
+ sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "explore-more__section", children: [
4831
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "explore-more__label", children: [
4832
+ "Based on ",
4833
+ sources.length,
4834
+ " ",
4835
+ sources.length === 1 ? "page" : "pages"
4836
+ ] }),
4837
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SearchReferences, { results, mode: "sources" })
4838
+ ] }) : null,
4839
+ questions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "explore-more__section", children: [
4840
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("p", { className: "explore-more__label", children: "Learn more" }),
4841
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "explore-more__questions", children: questions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4842
+ "button",
4843
+ {
4844
+ type: "button",
4845
+ disabled,
4846
+ onClick: () => onSelectQuestion(question),
4847
+ children: [
4848
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "explore-more__question-icon", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(QuestionIcon, {}) }),
4849
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "explore-more__question-text", children: question }),
4850
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4851
+ "svg",
4852
+ {
4853
+ className: "explore-more__question-arrow",
4854
+ viewBox: "0 0 24 24",
4855
+ fill: "none",
4856
+ stroke: "currentColor",
4857
+ strokeWidth: "1.5",
4858
+ "aria-hidden": "true",
4859
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 12h16m-7-7 7 7-7 7" })
4860
+ }
4861
+ )
4862
+ ]
4863
+ }
4864
+ ) }, question)) })
4865
+ ] }) : null
4866
+ ] });
4867
+ }
4868
+
4741
4869
  // src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
4742
- var import_react10 = require("react");
4870
+ var import_react9 = require("react");
4743
4871
  var import_react_dom = require("react-dom");
4744
4872
 
4745
4873
  // src/react/components/AgentRail/AgentRailOverlayContext.tsx
4746
- var import_react9 = require("react");
4747
- var AgentRailOverlayContext = (0, import_react9.createContext)(null);
4874
+ var import_react8 = require("react");
4875
+ var AgentRailOverlayContext = (0, import_react8.createContext)(null);
4748
4876
  function useAgentRailPortalRoots() {
4749
- return (0, import_react9.useContext)(AgentRailOverlayContext);
4877
+ return (0, import_react8.useContext)(AgentRailOverlayContext);
4750
4878
  }
4751
4879
  function useAgentRailMenuPortalRoot() {
4752
- return (0, import_react9.useContext)(AgentRailOverlayContext)?.railRef ?? null;
4880
+ return (0, import_react8.useContext)(AgentRailOverlayContext)?.railRef ?? null;
4753
4881
  }
4754
4882
 
4755
4883
  // src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
@@ -4774,13 +4902,13 @@ function AnswerReceiptDialog({
4774
4902
  summary,
4775
4903
  children
4776
4904
  }) {
4777
- const titleId = (0, import_react10.useId)();
4905
+ const titleId = (0, import_react9.useId)();
4778
4906
  const portalRoots = useAgentRailPortalRoots();
4779
4907
  const overlayRoot = portalRoots?.overlayRef ?? null;
4780
- const cardRef = (0, import_react10.useRef)(null);
4781
- const closeButtonRef = (0, import_react10.useRef)(null);
4782
- const previouslyFocusedRef = (0, import_react10.useRef)(null);
4783
- (0, import_react10.useEffect)(() => {
4908
+ const cardRef = (0, import_react9.useRef)(null);
4909
+ const closeButtonRef = (0, import_react9.useRef)(null);
4910
+ const previouslyFocusedRef = (0, import_react9.useRef)(null);
4911
+ (0, import_react9.useEffect)(() => {
4784
4912
  previouslyFocusedRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
4785
4913
  closeButtonRef.current?.focus({ preventScroll: true });
4786
4914
  const handleKeyDown = (event) => {
@@ -4856,7 +4984,7 @@ function AnswerReceiptDialog({
4856
4984
  }
4857
4985
 
4858
4986
  // src/react/components/Composer/Composer.tsx
4859
- var import_react11 = require("react");
4987
+ var import_react10 = require("react");
4860
4988
  var import_jsx_runtime5 = require("react/jsx-runtime");
4861
4989
  var FORM_SUBMITTED_MESSAGE = "Shared my details";
4862
4990
  function SendIcon() {
@@ -4911,6 +5039,7 @@ function createDraft(form) {
4911
5039
  };
4912
5040
  }
4913
5041
  function Composer({
5042
+ actions,
4914
5043
  disabled = false,
4915
5044
  placeholder = "Ask anything\u2026",
4916
5045
  variant = "default",
@@ -4918,23 +5047,24 @@ function Composer({
4918
5047
  allowFormResume = true,
4919
5048
  onSubmit
4920
5049
  }) {
4921
- const [value, setValue] = (0, import_react11.useState)("");
4922
- const [draft, setDraft] = (0, import_react11.useState)(() => createDraft(form));
4923
- const [multiline, setMultiline] = (0, import_react11.useState)(false);
4924
- const inputRef = (0, import_react11.useRef)(null);
4925
- const firstFieldRef = (0, import_react11.useRef)(null);
4926
- const formRef = (0, import_react11.useRef)(null);
4927
- const formId = (0, import_react11.useId)();
5050
+ const [value, setValue] = (0, import_react10.useState)("");
5051
+ const [draft, setDraft] = (0, import_react10.useState)(() => createDraft(form));
5052
+ const [multiline, setMultiline] = (0, import_react10.useState)(false);
5053
+ const inputRef = (0, import_react10.useRef)(null);
5054
+ const firstFieldRef = (0, import_react10.useRef)(null);
5055
+ const formRef = (0, import_react10.useRef)(null);
5056
+ const formId = (0, import_react10.useId)();
4928
5057
  if (form && form.id !== draft.form?.id) setDraft(createDraft(form));
4929
5058
  const savedForm = allowFormResume && !draft.submitted ? draft.form : null;
4930
5059
  const activeForm = !disabled && draft.expanded ? savedForm : null;
5060
+ const showResumeBadge = Boolean(savedForm) && !activeForm;
4931
5061
  const canSend = !disabled && Boolean(value.trim() || activeForm);
4932
- (0, import_react11.useEffect)(() => {
5062
+ (0, import_react10.useEffect)(() => {
4933
5063
  if (activeForm) firstFieldRef.current?.focus();
4934
5064
  else if ((savedForm || draft.submitted) && !disabled)
4935
5065
  inputRef.current?.focus();
4936
5066
  }, [activeForm?.id, disabled, savedForm?.id, draft.submitted]);
4937
- (0, import_react11.useEffect)(() => {
5067
+ (0, import_react10.useEffect)(() => {
4938
5068
  const input = inputRef.current;
4939
5069
  if (!input) return;
4940
5070
  const check = () => {
@@ -5056,15 +5186,17 @@ function Composer({
5056
5186
  ].filter(Boolean).join(" "),
5057
5187
  onSubmit: handleSubmit,
5058
5188
  children: [
5059
- savedForm ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "composer__resume", children: [
5060
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Share your details and we'll reach out shortly" }),
5061
- !activeForm ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5189
+ actions || showResumeBadge ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "composer__actions", children: [
5190
+ actions,
5191
+ showResumeBadge ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5062
5192
  "button",
5063
5193
  {
5064
5194
  type: "button",
5195
+ className: "composer__action-badge",
5065
5196
  disabled,
5197
+ title: "Share your details and we'll reach out shortly",
5066
5198
  onClick: () => setDraft((current) => ({ ...current, expanded: true })),
5067
- children: "Request follow-up"
5199
+ children: "Review follow-up"
5068
5200
  }
5069
5201
  ) : null
5070
5202
  ] }) : null,
@@ -5204,10 +5336,10 @@ function FollowUpChips({
5204
5336
  }
5205
5337
 
5206
5338
  // src/react/components/MessageBubble/MessageBubble.tsx
5207
- var import_react13 = require("react");
5339
+ var import_react12 = require("react");
5208
5340
 
5209
5341
  // src/react/components/BookingCard/BookingCard.tsx
5210
- var import_react12 = require("react");
5342
+ var import_react11 = require("react");
5211
5343
  var import_jsx_runtime7 = require("react/jsx-runtime");
5212
5344
  var BOOKING_STEPS = [
5213
5345
  { id: "date", label: "Date" },
@@ -5262,27 +5394,27 @@ function InteractiveBookingCard({
5262
5394
  offer,
5263
5395
  onBook
5264
5396
  }) {
5265
- const fieldId = (0, import_react12.useId)();
5397
+ const fieldId = (0, import_react11.useId)();
5266
5398
  const defaultType = offer.eventTypes[0]?.uri ?? offer.slots[0]?.eventTypeUri ?? "";
5267
- const [step, setStep] = (0, import_react12.useState)("date");
5268
- const [eventTypeUri, setEventTypeUri] = (0, import_react12.useState)(defaultType);
5269
- const [selectedDate, setSelectedDate] = (0, import_react12.useState)("");
5270
- const [startTime, setStartTime] = (0, import_react12.useState)("");
5271
- const [name, setName] = (0, import_react12.useState)("");
5272
- const [email, setEmail] = (0, import_react12.useState)("");
5273
- const activeStepRef = (0, import_react12.useRef)(null);
5274
- const previousStepRef = (0, import_react12.useRef)(step);
5399
+ const [step, setStep] = (0, import_react11.useState)("date");
5400
+ const [eventTypeUri, setEventTypeUri] = (0, import_react11.useState)(defaultType);
5401
+ const [selectedDate, setSelectedDate] = (0, import_react11.useState)("");
5402
+ const [startTime, setStartTime] = (0, import_react11.useState)("");
5403
+ const [name, setName] = (0, import_react11.useState)("");
5404
+ const [email, setEmail] = (0, import_react11.useState)("");
5405
+ const activeStepRef = (0, import_react11.useRef)(null);
5406
+ const previousStepRef = (0, import_react11.useRef)(step);
5275
5407
  const stepIndex = BOOKING_STEPS.findIndex((item) => item.id === step);
5276
- (0, import_react12.useEffect)(() => {
5408
+ (0, import_react11.useEffect)(() => {
5277
5409
  if (previousStepRef.current === step) return;
5278
5410
  previousStepRef.current = step;
5279
5411
  activeStepRef.current?.scrollIntoView({ block: "nearest" });
5280
5412
  }, [step]);
5281
- const slots = (0, import_react12.useMemo)(
5413
+ const slots = (0, import_react11.useMemo)(
5282
5414
  () => bookingSlotsForEventType(offer.slots, eventTypeUri),
5283
5415
  [eventTypeUri, offer.slots]
5284
5416
  );
5285
- const availableByDate = (0, import_react12.useMemo)(() => {
5417
+ const availableByDate = (0, import_react11.useMemo)(() => {
5286
5418
  const next = /* @__PURE__ */ new Map();
5287
5419
  for (const slot of slots) {
5288
5420
  const key = slotDateKey(slot.startTime);
@@ -5290,7 +5422,7 @@ function InteractiveBookingCard({
5290
5422
  }
5291
5423
  return next;
5292
5424
  }, [slots]);
5293
- const [visibleMonth, setVisibleMonth] = (0, import_react12.useState)(
5425
+ const [visibleMonth, setVisibleMonth] = (0, import_react11.useState)(
5294
5426
  () => firstAvailableBookingMonth(slots)
5295
5427
  );
5296
5428
  function selectEventType(nextType) {
@@ -5303,7 +5435,7 @@ function InteractiveBookingCard({
5303
5435
  )
5304
5436
  );
5305
5437
  }
5306
- const daySlots = (0, import_react12.useMemo)(
5438
+ const daySlots = (0, import_react11.useMemo)(
5307
5439
  () => slots.filter((slot) => slotDateKey(slot.startTime) === selectedDate),
5308
5440
  [selectedDate, slots]
5309
5441
  );
@@ -5312,7 +5444,7 @@ function InteractiveBookingCard({
5312
5444
  );
5313
5445
  const selectedSample = availableByDate.get(selectedDate) ?? startTime;
5314
5446
  const timeZone = formatSlotTimeZone(slots[0]?.startTime ?? selectedSample);
5315
- const weekdays = (0, import_react12.useMemo)(() => weekdayLabels(), []);
5447
+ const weekdays = (0, import_react11.useMemo)(() => weekdayLabels(), []);
5316
5448
  const cells = calendarCells(visibleMonth.year, visibleMonth.month);
5317
5449
  const canPrevMonth = [...availableByDate.keys()].some((key) => {
5318
5450
  const month = monthFromKey(key);
@@ -5676,9 +5808,9 @@ function MessageBubble({
5676
5808
  onBook
5677
5809
  }) {
5678
5810
  const resolvedLogoUrl = brandLogoUrl?.trim();
5679
- const [failedLogoUrl, setFailedLogoUrl] = (0, import_react13.useState)(null);
5680
- const [logoDisplay, setLogoDisplay] = (0, import_react13.useState)(null);
5681
- (0, import_react13.useEffect)(() => {
5811
+ const [failedLogoUrl, setFailedLogoUrl] = (0, import_react12.useState)(null);
5812
+ const [logoDisplay, setLogoDisplay] = (0, import_react12.useState)(null);
5813
+ (0, import_react12.useEffect)(() => {
5682
5814
  setFailedLogoUrl(null);
5683
5815
  }, [resolvedLogoUrl]);
5684
5816
  const activeLogoDisplay = logoDisplay?.url === resolvedLogoUrl ? logoDisplay : null;
@@ -5829,7 +5961,7 @@ function MessageBubble({
5829
5961
  }
5830
5962
 
5831
5963
  // src/react/components/MessageActions/MessageActions.tsx
5832
- var import_react14 = require("react");
5964
+ var import_react13 = require("react");
5833
5965
  var import_react_dom2 = require("react-dom");
5834
5966
 
5835
5967
  // src/react/lib/speech.ts
@@ -6225,26 +6357,26 @@ function MessageActions({
6225
6357
  speechText
6226
6358
  }) {
6227
6359
  const menuPortalRoot = useAgentRailMenuPortalRoot();
6228
- const [copied, setCopied] = (0, import_react14.useState)(false);
6229
- const [rating, setRating] = (0, import_react14.useState)(null);
6230
- const [menuOpen, setMenuOpen] = (0, import_react14.useState)(false);
6231
- const [menuPosition, setMenuPosition] = (0, import_react14.useState)(null);
6232
- const [speaking, setSpeaking] = (0, import_react14.useState)(false);
6233
- const [speechSupported, setSpeechSupported] = (0, import_react14.useState)(null);
6234
- const copyTimerRef = (0, import_react14.useRef)(null);
6235
- const menuRef = (0, import_react14.useRef)(null);
6236
- const portaledMenuRef = (0, import_react14.useRef)(null);
6237
- const moreButtonRef = (0, import_react14.useRef)(null);
6360
+ const [copied, setCopied] = (0, import_react13.useState)(false);
6361
+ const [rating, setRating] = (0, import_react13.useState)(null);
6362
+ const [menuOpen, setMenuOpen] = (0, import_react13.useState)(false);
6363
+ const [menuPosition, setMenuPosition] = (0, import_react13.useState)(null);
6364
+ const [speaking, setSpeaking] = (0, import_react13.useState)(false);
6365
+ const [speechSupported, setSpeechSupported] = (0, import_react13.useState)(null);
6366
+ const copyTimerRef = (0, import_react13.useRef)(null);
6367
+ const menuRef = (0, import_react13.useRef)(null);
6368
+ const portaledMenuRef = (0, import_react13.useRef)(null);
6369
+ const moreButtonRef = (0, import_react13.useRef)(null);
6238
6370
  const answeredLabel = formatAnsweredAt(answeredAt ?? 0);
6239
6371
  const resolvedSpeechText = speechText ?? toSpeechText(copyText);
6240
6372
  const canOpenReceipt = Boolean(receiptSteps) && Boolean(onOpenReceipt);
6241
6373
  const readAloudEligible = Boolean(readAloud && resolvedSpeechText);
6242
6374
  const canReadAloud = readAloudEligible && speechSupported === true;
6243
6375
  const showMenu = canOpenReceipt || (speechSupported === null ? readAloudEligible : canReadAloud);
6244
- (0, import_react14.useLayoutEffect)(() => {
6376
+ (0, import_react13.useLayoutEffect)(() => {
6245
6377
  setSpeechSupported(isSpeechSupported());
6246
6378
  }, []);
6247
- (0, import_react14.useLayoutEffect)(() => {
6379
+ (0, import_react13.useLayoutEffect)(() => {
6248
6380
  if (!menuOpen || !moreButtonRef.current || !portaledMenuRef.current) {
6249
6381
  setMenuPosition(null);
6250
6382
  return;
@@ -6261,7 +6393,7 @@ function MessageActions({
6261
6393
  })
6262
6394
  );
6263
6395
  }, [menuOpen, menuPortalRoot]);
6264
- (0, import_react14.useEffect)(() => {
6396
+ (0, import_react13.useEffect)(() => {
6265
6397
  const unsubscribe = subscribeSpeechInterrupts(() => setSpeaking(false));
6266
6398
  return () => {
6267
6399
  unsubscribe();
@@ -6271,7 +6403,7 @@ function MessageActions({
6271
6403
  stopSpeech();
6272
6404
  };
6273
6405
  }, []);
6274
- (0, import_react14.useEffect)(() => {
6406
+ (0, import_react13.useEffect)(() => {
6275
6407
  if (!menuOpen) return;
6276
6408
  const handlePointerDown = (event) => {
6277
6409
  const target = event.target;
@@ -6440,7 +6572,7 @@ function MessageActions({
6440
6572
  }
6441
6573
 
6442
6574
  // src/react/components/HumanInputCard/HumanInputCard.tsx
6443
- var import_react16 = require("react");
6575
+ var import_react15 = require("react");
6444
6576
 
6445
6577
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
6446
6578
  var import_jsx_runtime10 = require("react/jsx-runtime");
@@ -6482,7 +6614,7 @@ function ConfirmationCard({
6482
6614
  }
6483
6615
 
6484
6616
  // src/react/components/ToolInputCard/ToolInputCard.tsx
6485
- var import_react15 = require("react");
6617
+ var import_react14 = require("react");
6486
6618
  var import_jsx_runtime11 = require("react/jsx-runtime");
6487
6619
  function isRecord5(value) {
6488
6620
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -6813,11 +6945,11 @@ function ToolInputCard({
6813
6945
  surface,
6814
6946
  onSubmit
6815
6947
  }) {
6816
- const [values, setValues] = (0, import_react15.useState)(
6948
+ const [values, setValues] = (0, import_react14.useState)(
6817
6949
  () => initialValues(surface)
6818
6950
  );
6819
- const [touched, setTouched] = (0, import_react15.useState)(() => /* @__PURE__ */ new Set());
6820
- const [submitted, setSubmitted] = (0, import_react15.useState)(false);
6951
+ const [touched, setTouched] = (0, import_react14.useState)(() => /* @__PURE__ */ new Set());
6952
+ const [submitted, setSubmitted] = (0, import_react14.useState)(false);
6821
6953
  const errors = Object.fromEntries(
6822
6954
  surface.fields.map((field) => [
6823
6955
  field.path,
@@ -6910,7 +7042,7 @@ function HumanInputCard({
6910
7042
  request,
6911
7043
  onRespond
6912
7044
  }) {
6913
- const [text3, setText] = (0, import_react16.useState)("");
7045
+ const [text3, setText] = (0, import_react15.useState)("");
6914
7046
  const options = request.options ?? [];
6915
7047
  const showText = request.display === "text" || request.allowFreeform && options.length === 0;
6916
7048
  if (request.ui) {
@@ -6968,7 +7100,7 @@ function HumanInputCard({
6968
7100
  }
6969
7101
 
6970
7102
  // src/react/components/LocationConsent/LocationConsent.tsx
6971
- var import_react17 = require("react");
7103
+ var import_react16 = require("react");
6972
7104
 
6973
7105
  // src/runtime/location-consent.ts
6974
7106
  function isLocationConsentRequest(request) {
@@ -7016,16 +7148,16 @@ function LocationConsent({
7016
7148
  request,
7017
7149
  onRespond
7018
7150
  }) {
7019
- const [preference, setPreference] = (0, import_react17.useState)("unset");
7020
- const [locating, setLocating] = (0, import_react17.useState)(false);
7021
- const [error, setError] = (0, import_react17.useState)(null);
7022
- const respond = (0, import_react17.useRef)(onRespond);
7023
- const answered = (0, import_react17.useRef)(null);
7151
+ const [preference, setPreference] = (0, import_react16.useState)("unset");
7152
+ const [locating, setLocating] = (0, import_react16.useState)(false);
7153
+ const [error, setError] = (0, import_react16.useState)(null);
7154
+ const respond = (0, import_react16.useRef)(onRespond);
7155
+ const answered = (0, import_react16.useRef)(null);
7024
7156
  const requestId = request?.requestId;
7025
- (0, import_react17.useEffect)(() => {
7157
+ (0, import_react16.useEffect)(() => {
7026
7158
  respond.current = onRespond;
7027
7159
  }, [onRespond]);
7028
- (0, import_react17.useEffect)(() => {
7160
+ (0, import_react16.useEffect)(() => {
7029
7161
  if (!requestId || preference === "unset" || answered.current === requestId || !respond.current)
7030
7162
  return;
7031
7163
  if (preference === "off") {
@@ -7407,24 +7539,24 @@ function AgentRail({
7407
7539
  onInputResponse,
7408
7540
  onToolInput
7409
7541
  }) {
7410
- const railRef = (0, import_react18.useRef)(null);
7411
- const overlayRef = (0, import_react18.useRef)(null);
7412
- const transcriptRef = (0, import_react18.useRef)(null);
7413
- const responseRef = (0, import_react18.useRef)(null);
7414
- const threadRef = (0, import_react18.useRef)(null);
7415
- const lastScrolledVisitorIdRef = (0, import_react18.useRef)(void 0);
7416
- const pinnedToBottomRef = (0, import_react18.useRef)(true);
7417
- const smoothScrollToLatestRef = (0, import_react18.useRef)(false);
7418
- const lockedTranscriptScrollTopRef = (0, import_react18.useRef)(null);
7419
- const [showJumpToLatest, setShowJumpToLatest] = (0, import_react18.useState)(false);
7420
- const [receiptOpen, setReceiptOpen] = (0, import_react18.useState)(false);
7421
- const [expandedSourcesMessageId, setExpandedSourcesMessageId] = (0, import_react18.useState)(null);
7542
+ const railRef = (0, import_react17.useRef)(null);
7543
+ const overlayRef = (0, import_react17.useRef)(null);
7544
+ const transcriptRef = (0, import_react17.useRef)(null);
7545
+ const responseRef = (0, import_react17.useRef)(null);
7546
+ const threadRef = (0, import_react17.useRef)(null);
7547
+ const lastScrolledVisitorIdRef = (0, import_react17.useRef)(void 0);
7548
+ const pinnedToBottomRef = (0, import_react17.useRef)(true);
7549
+ const smoothScrollToLatestRef = (0, import_react17.useRef)(false);
7550
+ const lockedTranscriptScrollTopRef = (0, import_react17.useRef)(null);
7551
+ const [showJumpToLatest, setShowJumpToLatest] = (0, import_react17.useState)(false);
7552
+ const [receiptOpen, setReceiptOpen] = (0, import_react17.useState)(false);
7553
+ const [expandedSourcesMessageId, setExpandedSourcesMessageId] = (0, import_react17.useState)(null);
7422
7554
  const resolvedBrandLabel = brandLabel.trim();
7423
7555
  const resolvedBrandLogoUrl = brandLogoUrl?.trim();
7424
7556
  const resolvedDisclaimerLabel = disclaimerLabel === void 0 ? DEFAULT_DISCLAIMER_LABEL : disclaimerLabel;
7425
- const [failedLogoUrl, setFailedLogoUrl] = (0, import_react18.useState)(null);
7426
- const [brandLogoDisplay, setBrandLogoDisplay] = (0, import_react18.useState)(null);
7427
- (0, import_react18.useEffect)(() => {
7557
+ const [failedLogoUrl, setFailedLogoUrl] = (0, import_react17.useState)(null);
7558
+ const [brandLogoDisplay, setBrandLogoDisplay] = (0, import_react17.useState)(null);
7559
+ (0, import_react17.useEffect)(() => {
7428
7560
  setFailedLogoUrl(null);
7429
7561
  }, [resolvedBrandLogoUrl]);
7430
7562
  const activeBrandLogoDisplay = brandLogoDisplay?.url === resolvedBrandLogoUrl ? brandLogoDisplay : null;
@@ -7533,12 +7665,40 @@ function AgentRail({
7533
7665
  ...visibleVisitorToolResults
7534
7666
  ].reverse().find((result) => result.kind !== "input")?.id;
7535
7667
  const receiptSteps = answerReceipt && state.toolSteps.length > 0 ? state.toolSteps : void 0;
7536
- (0, import_react18.useEffect)(() => {
7668
+ const latestAgentMessage = lastAgentIndex >= 0 ? visibleMessages[lastAgentIndex] : void 0;
7669
+ const composerCtaActions = !handoffActive && state.phase === "complete" && latestAgentMessage?.role === "agent" && !latestAgentMessage.streaming ? searchActions(latestAgentMessage.searchResults ?? []) : [];
7670
+ const showHandoffAction = Boolean(handoff?.page?.enabled) && handoffStatus === "ai";
7671
+ const composerActions = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
7672
+ composerCtaActions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7673
+ "a",
7674
+ {
7675
+ className: "composer__action-badge",
7676
+ href: action.url,
7677
+ target: "_blank",
7678
+ rel: "noopener noreferrer",
7679
+ title: searchActionLinkTitle(action.url),
7680
+ children: action.label
7681
+ },
7682
+ action.url
7683
+ )),
7684
+ showHandoffAction && handoff ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7685
+ "button",
7686
+ {
7687
+ type: "button",
7688
+ className: "composer__action-badge",
7689
+ disabled: handoff.busy || handoff.hasPending || isBusy,
7690
+ title: "Chat with a human representative",
7691
+ onClick: () => void handoff.start(),
7692
+ children: "Talk to a person"
7693
+ }
7694
+ ) : null
7695
+ ] });
7696
+ (0, import_react17.useEffect)(() => {
7537
7697
  if (state.phase !== "complete") {
7538
7698
  setReceiptOpen(false);
7539
7699
  }
7540
7700
  }, [state.phase]);
7541
- (0, import_react18.useEffect)(() => {
7701
+ (0, import_react17.useEffect)(() => {
7542
7702
  if (state.phase !== "complete" || !showSources) {
7543
7703
  setExpandedSourcesMessageId(null);
7544
7704
  }
@@ -7565,7 +7725,7 @@ function AgentRail({
7565
7725
  else onSubmit?.(label);
7566
7726
  }
7567
7727
  const latestVisitorId = visibleMessages[lastVisitorIndex]?.id;
7568
- (0, import_react18.useEffect)(() => {
7728
+ (0, import_react17.useEffect)(() => {
7569
7729
  const node = transcriptRef.current;
7570
7730
  if (!node) return;
7571
7731
  if (latestVisitorId !== lastScrolledVisitorIdRef.current) {
@@ -7595,7 +7755,7 @@ function AgentRail({
7595
7755
  state.followUps,
7596
7756
  state.journey
7597
7757
  ]);
7598
- (0, import_react18.useEffect)(() => {
7758
+ (0, import_react17.useEffect)(() => {
7599
7759
  const node = transcriptRef.current;
7600
7760
  if (!node) return;
7601
7761
  const handleScroll = () => {
@@ -7609,7 +7769,7 @@ function AgentRail({
7609
7769
  handleScroll();
7610
7770
  return () => node.removeEventListener("scroll", handleScroll);
7611
7771
  }, []);
7612
- (0, import_react18.useEffect)(() => {
7772
+ (0, import_react17.useEffect)(() => {
7613
7773
  if (!receiptOpen) {
7614
7774
  lockedTranscriptScrollTopRef.current = null;
7615
7775
  return;
@@ -7798,9 +7958,11 @@ function AgentRail({
7798
7958
  ))
7799
7959
  ] }) : null,
7800
7960
  transcriptMessages.map((message, index) => {
7801
- const messageSourceCount = message.role === "agent" ? searchSources(message.searchResults ?? []).length : 0;
7961
+ const messageResults = message.role === "agent" ? message.searchResults ?? [] : [];
7962
+ const messageSourceCount = showSources ? searchSources(messageResults).length : 0;
7963
+ const messageQuestionCount = index === lastAgentIndex && showLearnMore && !handoffActive ? searchSuggestions(messageResults).length : 0;
7802
7964
  const showAnswerActions = message.role === "agent" && index === lastAgentIndex && showMessageActions;
7803
- const showSourcesToggle = message.role === "agent" && showSources && state.phase === "complete" && !message.streaming && messageSourceCount > 0;
7965
+ const showExploreToggle = message.role === "agent" && state.phase === "complete" && !message.streaming && (messageSourceCount > 0 || messageQuestionCount > 0);
7804
7966
  return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7805
7967
  "div",
7806
7968
  {
@@ -7826,7 +7988,7 @@ function AgentRail({
7826
7988
  onBook
7827
7989
  }
7828
7990
  ),
7829
- showAnswerActions || showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__answer-footer", children: [
7991
+ showAnswerActions || showExploreToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__answer-footer", children: [
7830
7992
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__answer-actions", children: [
7831
7993
  showAnswerActions ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7832
7994
  MessageActions,
@@ -7840,7 +8002,7 @@ function AgentRail({
7840
8002
  onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
7841
8003
  }
7842
8004
  ) : null,
7843
- showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
8005
+ showExploreToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7844
8006
  "button",
7845
8007
  {
7846
8008
  className: "agent-rail__sources-button",
@@ -7851,7 +8013,7 @@ function AgentRail({
7851
8013
  (current) => current === message.id ? null : message.id
7852
8014
  ),
7853
8015
  children: [
7854
- "Explore More",
8016
+ "Explore more",
7855
8017
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7856
8018
  "span",
7857
8019
  {
@@ -7864,38 +8026,26 @@ function AgentRail({
7864
8026
  }
7865
8027
  ) : null
7866
8028
  ] }),
7867
- showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8029
+ showExploreToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7868
8030
  "div",
7869
8031
  {
7870
8032
  id: `agent-rail-sources-${message.id}`,
7871
8033
  className: `agent-rail__sources-panel${expandedSourcesMessageId === message.id ? " agent-rail__sources-panel--open" : ""}`,
7872
8034
  role: "region",
7873
- "aria-label": "Explore More",
8035
+ "aria-label": "Explore more",
7874
8036
  children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__sources-panel-inner", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7875
- SearchReferences,
8037
+ ExploreMore,
7876
8038
  {
7877
8039
  results: message.searchResults ?? [],
7878
- mode: "sources"
8040
+ disabled: isBusy || !(onFollowUpSelect || onSubmit),
8041
+ showLearnMore: showLearnMore && index === lastAgentIndex && !handoffActive,
8042
+ showSources,
8043
+ onSelectQuestion: handleFollowUpSelect
7879
8044
  }
7880
8045
  ) })
7881
8046
  }
7882
8047
  ) : null
7883
8048
  ] }) : null,
7884
- message.role === "agent" && !message.streaming ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7885
- SearchReferences,
7886
- {
7887
- results: message.searchResults ?? [],
7888
- mode: "actions"
7889
- }
7890
- ) : null,
7891
- showAnswerActions && !handoffActive && showLearnMore ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7892
- LearnMore,
7893
- {
7894
- results: message.searchResults ?? [],
7895
- disabled: isBusy || !(onFollowUpSelect || onSubmit),
7896
- onSelect: handleFollowUpSelect
7897
- }
7898
- ) : null,
7899
8049
  index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
7900
8050
  showActivity ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7901
8051
  AgentActivityBubble,
@@ -7938,7 +8088,7 @@ function AgentRail({
7938
8088
  onRetry ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
7939
8089
  ] }) : null
7940
8090
  ] }) }),
7941
- handoff && (handoff.page?.enabled || handoffActive) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__handoff", children: [
8091
+ handoff && (handoff.page?.enabled || handoffActive) && handoffStatus !== "ai" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__handoff", children: [
7942
8092
  handoffStatus === "human" || handoffStatus === "queued" || handoffStatus === "requesting" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "agent-rail__handoff-dot", "aria-hidden": "true" }) : null,
7943
8093
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7944
8094
  "p",
@@ -7949,16 +8099,6 @@ function AgentRail({
7949
8099
  children: !handoff.page ? "Checking conversation\u2026" : handoffStatus === "human" ? "Connected with support" : handoffStatus === "queued" ? "Waiting for a representative" : handoffStatus === "requesting" ? "Connecting you to support\u2026" : handoffStatus === "resolved" ? "Your conversation with support has ended" : handoffStatus === "failed" ? "We couldn\u2019t connect you to support" : "Need a person?"
7950
8100
  }
7951
8101
  ),
7952
- handoffStatus === "ai" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7953
- "button",
7954
- {
7955
- type: "button",
7956
- className: "agent-rail__handoff-cta",
7957
- disabled: handoff.busy || handoff.hasPending || isBusy,
7958
- onClick: () => void handoff.start(),
7959
- children: "Talk to a person"
7960
- }
7961
- ) : null,
7962
8102
  handoffStatus === "resolved" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7963
8103
  "button",
7964
8104
  {
@@ -7993,15 +8133,6 @@ function AgentRail({
7993
8133
  )
7994
8134
  ] }) : null
7995
8135
  ] }) : null,
7996
- showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7997
- "a",
7998
- {
7999
- href: disclaimerLink,
8000
- rel: "noopener noreferrer",
8001
- target: "_blank",
8002
- children: resolvedDisclaimerLabel
8003
- }
8004
- ) : resolvedDisclaimerLabel }) }) : null,
8005
8136
  /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
8006
8137
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8007
8138
  LocationConsent,
@@ -8025,6 +8156,7 @@ function AgentRail({
8025
8156
  /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8026
8157
  Composer,
8027
8158
  {
8159
+ actions: composerCtaActions.length > 0 || showHandoffAction ? composerActions : void 0,
8028
8160
  variant: expanded || mobileFullscreen ? "dock" : "default",
8029
8161
  disabled: isBusy || Boolean(handoff?.busy || handoff?.hasPending) || handoffActive && !["requesting", "queued", "human"].includes(
8030
8162
  handoffStatus ?? ""
@@ -8039,6 +8171,15 @@ function AgentRail({
8039
8171
  },
8040
8172
  `${state.messages.find((message) => message.role === "visitor")?.id ?? "empty"}:${latestResultId ?? ""}`
8041
8173
  ),
8174
+ showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8175
+ "a",
8176
+ {
8177
+ href: disclaimerLink,
8178
+ rel: "noopener noreferrer",
8179
+ target: "_blank",
8180
+ children: resolvedDisclaimerLabel
8181
+ }
8182
+ ) : resolvedDisclaimerLabel }) }) : null,
8042
8183
  poweredByLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: poweredByLabel }) }) }) : null
8043
8184
  ] })
8044
8185
  ] }),
@@ -8057,7 +8198,7 @@ function AgentRail({
8057
8198
  }
8058
8199
 
8059
8200
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
8060
- var import_react19 = require("react");
8201
+ var import_react18 = require("react");
8061
8202
  var import_jsx_runtime20 = require("react/jsx-runtime");
8062
8203
  function ChatSparkIcon() {
8063
8204
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
@@ -8139,9 +8280,9 @@ function TabMarkIcon({
8139
8280
  }) {
8140
8281
  const custom = customIconUrl?.trim();
8141
8282
  const logo = logoUrl?.trim();
8142
- const [customFailed, setCustomFailed] = (0, import_react19.useState)(false);
8143
- const [logoFailed, setLogoFailed] = (0, import_react19.useState)(false);
8144
- const [markDisplay, setMarkDisplay] = (0, import_react19.useState)(null);
8283
+ const [customFailed, setCustomFailed] = (0, import_react18.useState)(false);
8284
+ const [logoFailed, setLogoFailed] = (0, import_react18.useState)(false);
8285
+ const [markDisplay, setMarkDisplay] = (0, import_react18.useState)(null);
8145
8286
  function applyLauncherLogoSize(img, sourceUrl) {
8146
8287
  if (!chip) return;
8147
8288
  const display = snapBrandLogoDisplaySize({
@@ -8425,9 +8566,9 @@ function AgentWidget({
8425
8566
  }) {
8426
8567
  const isMobile = useIsMobile();
8427
8568
  const placement = normalizeAgentPlacement(placementInput);
8428
- const railSlotRef = (0, import_react20.useRef)(null);
8429
- const [railCollapsed, setRailCollapsed] = (0, import_react20.useState)(defaultCollapsed);
8430
- const [railExpanded, setRailExpanded] = (0, import_react20.useState)(false);
8569
+ const railSlotRef = (0, import_react19.useRef)(null);
8570
+ const [railCollapsed, setRailCollapsed] = (0, import_react19.useState)(defaultCollapsed);
8571
+ const [railExpanded, setRailExpanded] = (0, import_react19.useState)(false);
8431
8572
  const pageShiftActive = shouldApplyPageShift({
8432
8573
  pageShift,
8433
8574
  isMobile,
@@ -8482,7 +8623,7 @@ function AgentWidget({
8482
8623
  } : {},
8483
8624
  ...branding?.colors?.border ? { border: branding.colors.border } : {}
8484
8625
  };
8485
- (0, import_react20.useEffect)(() => {
8626
+ (0, import_react19.useEffect)(() => {
8486
8627
  if (!registerPanelController) return;
8487
8628
  registerAgentPanelController(customerId, {
8488
8629
  open: () => setRailCollapsed(false),
@@ -8517,7 +8658,7 @@ function AgentWidget({
8517
8658
  })
8518
8659
  );
8519
8660
  }
8520
- (0, import_react20.useEffect)(() => {
8661
+ (0, import_react19.useEffect)(() => {
8521
8662
  if (railCollapsed) return;
8522
8663
  const handleKeyDown = (event) => {
8523
8664
  if (event.key === "Tab" && (isMobile || railExpanded)) {
@@ -8615,9 +8756,9 @@ function AgentWidget({
8615
8756
  subLabel: branding?.tabSubLabel,
8616
8757
  customIconUrl: branding?.tabIconUrl,
8617
8758
  logoUrl: branding?.logoUrl,
8618
- brandColor: branding?.colors?.primary,
8619
- brandForeground: branding?.colors?.primaryForeground,
8620
- borderColor: branding?.colors?.border,
8759
+ brandColor: branding?.colors?.launcherPrimary ?? branding?.colors?.primary,
8760
+ brandForeground: branding?.colors?.launcherPrimaryForeground ?? branding?.colors?.primaryForeground,
8761
+ borderColor: branding?.colors?.launcherBorder ?? branding?.colors?.border,
8621
8762
  fontFamily: branding?.fontFamily,
8622
8763
  mobile: isMobile,
8623
8764
  surfaceColor: branding?.colors?.surface,