@webless/agent 0.13.2 → 0.14.1

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.
@@ -4103,7 +4103,7 @@ var defaultAgentRailTheme = {
4103
4103
  surfaceMuted: "#f4f6fb",
4104
4104
  text: "#171b2a",
4105
4105
  textMuted: "#5a6378",
4106
- textSubtle: "#8a94a8",
4106
+ textSubtle: "#6b7280",
4107
4107
  border: "rgb(42 51 70 / 0.1)",
4108
4108
  visitorBubble: "#f3edff",
4109
4109
  visitorText: "#171b2a",
@@ -4753,12 +4753,149 @@ function MessageActions({
4753
4753
  }
4754
4754
 
4755
4755
  // src/react/components/AgentRail/AgentRail.tsx
4756
- import { useEffect as useEffect9, useRef as useRef8, useState as useState13 } from "react";
4756
+ import { useEffect as useEffect9, useRef as useRef8, useState as useState12 } from "react";
4757
4757
 
4758
4758
  // src/react/lib/agent-theme.ts
4759
+ var HEX_COLOR_PATTERN = /^#(?:[\dA-Fa-f]{3}|[\dA-Fa-f]{6})$/;
4760
+ var NAMED_COLOR_HEX = Object.fromEntries(
4761
+ "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(":"))
4762
+ );
4763
+ function rgbLuminance(r, g, b) {
4764
+ const [lr = 0, lg = 0, lb = 0] = [r, g, b].map((channel) => {
4765
+ const normalized = channel / 255;
4766
+ return normalized <= 0.03928 ? normalized / 12.92 : Math.pow((normalized + 0.055) / 1.055, 2.4);
4767
+ });
4768
+ return 0.2126 * lr + 0.7152 * lg + 0.0722 * lb;
4769
+ }
4770
+ function hexColorLuminance(value) {
4771
+ const normalized = value.trim();
4772
+ if (!HEX_COLOR_PATTERN.test(normalized)) return null;
4773
+ const raw = normalized.slice(1);
4774
+ const full = raw.length === 3 ? raw.split("").map((channel) => channel + channel).join("") : raw;
4775
+ const [r = 0, g = 0, b = 0] = [0, 2, 4].map(
4776
+ (index) => parseInt(full.slice(index, index + 2), 16)
4777
+ );
4778
+ return rgbLuminance(r, g, b);
4779
+ }
4780
+ function splitColorBody(body) {
4781
+ let colorPart = body;
4782
+ let alphaToken;
4783
+ const slashIndex = body.lastIndexOf("/");
4784
+ if (slashIndex >= 0) {
4785
+ colorPart = body.slice(0, slashIndex);
4786
+ alphaToken = body.slice(slashIndex + 1);
4787
+ }
4788
+ const parts = colorPart.includes(",") ? colorPart.split(",") : colorPart.trim().split(/\s+/);
4789
+ if (colorPart.includes(",") && parts.length === 4) {
4790
+ alphaToken = parts.pop();
4791
+ }
4792
+ return { parts, alphaToken };
4793
+ }
4794
+ function parseAlpha(token) {
4795
+ if (token === void 0) return 1;
4796
+ const trimmed = token.trim();
4797
+ if (!trimmed) return 1;
4798
+ return trimmed.endsWith("%") ? parseFloat(trimmed) / 100 : parseFloat(trimmed);
4799
+ }
4800
+ function parseRgbChannels(value) {
4801
+ const match = /^rgba?\(\s*([^)]*?)\s*\)$/i.exec(value);
4802
+ if (!match) return null;
4803
+ const { parts, alphaToken } = splitColorBody(match[1] ?? "");
4804
+ if (parts.length < 3) return null;
4805
+ const alpha = parseAlpha(alphaToken);
4806
+ const channels = parts.slice(0, 3).map((part) => {
4807
+ const token = part.trim();
4808
+ return token.endsWith("%") ? parseFloat(token) / 100 * 255 : parseFloat(token);
4809
+ });
4810
+ if ([...channels, alpha].some((channel) => Number.isNaN(channel))) {
4811
+ return null;
4812
+ }
4813
+ return [channels[0] ?? 0, channels[1] ?? 0, channels[2] ?? 0, alpha];
4814
+ }
4815
+ function parseHslChannels(value) {
4816
+ const match = /^hsla?\(\s*([^)]*?)\s*\)$/i.exec(value);
4817
+ if (!match) return null;
4818
+ const { parts, alphaToken } = splitColorBody(match[1] ?? "");
4819
+ if (parts.length < 3) return null;
4820
+ const alpha = parseAlpha(alphaToken);
4821
+ const hueToken = (parts[0] ?? "").trim().toLowerCase();
4822
+ const hueRaw = parseFloat(hueToken);
4823
+ const saturation = parseFloat(parts[1] ?? "");
4824
+ const lightness = parseFloat(parts[2] ?? "");
4825
+ if ([hueRaw, saturation, lightness, alpha].some((n) => Number.isNaN(n))) {
4826
+ return null;
4827
+ }
4828
+ const hueDeg = hueToken.endsWith("turn") ? hueRaw * 360 : hueToken.endsWith("rad") ? hueRaw * 180 / Math.PI : hueRaw;
4829
+ const s = saturation / 100;
4830
+ const l = lightness / 100;
4831
+ const chroma = (1 - Math.abs(2 * l - 1)) * s;
4832
+ const huePrime = (hueDeg % 360 + 360) % 360 / 60;
4833
+ const x = chroma * (1 - Math.abs(huePrime % 2 - 1));
4834
+ const pairs = [
4835
+ [chroma, x, 0],
4836
+ [x, chroma, 0],
4837
+ [0, chroma, x],
4838
+ [0, x, chroma],
4839
+ [x, 0, chroma],
4840
+ [chroma, 0, x]
4841
+ ];
4842
+ const [r1 = 0, g1 = 0, b1 = 0] = pairs[Math.floor(huePrime) % 6] ?? [];
4843
+ const m = l - chroma / 2;
4844
+ return [(r1 + m) * 255, (g1 + m) * 255, (b1 + m) * 255, alpha];
4845
+ }
4846
+ var colorProbeElement = null;
4847
+ function normalizeColorWithDom(value) {
4848
+ if (typeof document === "undefined") return null;
4849
+ colorProbeElement ??= document.createElement("span");
4850
+ colorProbeElement.style.color = "";
4851
+ colorProbeElement.style.color = value;
4852
+ return colorProbeElement.style.color || null;
4853
+ }
4854
+ var LIGHT_SURFACE_LUMINANCE_THRESHOLD = 0.35;
4855
+ function channelsLuminance([r, g, b, alpha]) {
4856
+ if (alpha >= 1) return rgbLuminance(r, g, b);
4857
+ if (alpha <= 0) return null;
4858
+ const overBlack = rgbLuminance(r * alpha, g * alpha, b * alpha);
4859
+ const overWhite = rgbLuminance(
4860
+ r * alpha + (1 - alpha) * 255,
4861
+ g * alpha + (1 - alpha) * 255,
4862
+ b * alpha + (1 - alpha) * 255
4863
+ );
4864
+ const blackIsLight = overBlack > LIGHT_SURFACE_LUMINANCE_THRESHOLD;
4865
+ const whiteIsLight = overWhite > LIGHT_SURFACE_LUMINANCE_THRESHOLD;
4866
+ if (blackIsLight !== whiteIsLight) return null;
4867
+ return blackIsLight ? Math.min(overBlack, overWhite) : Math.max(overBlack, overWhite);
4868
+ }
4869
+ function cssColorLuminance(value) {
4870
+ const trimmed = value.trim();
4871
+ if (!trimmed) return null;
4872
+ const namedHex = NAMED_COLOR_HEX[trimmed.toLowerCase()];
4873
+ const hex = hexColorLuminance(namedHex ?? trimmed);
4874
+ if (hex !== null) return hex;
4875
+ const channels = parseRgbChannels(trimmed) ?? parseHslChannels(trimmed);
4876
+ if (channels) return channelsLuminance(channels);
4877
+ const normalized = normalizeColorWithDom(trimmed);
4878
+ if (!normalized || normalized === trimmed) return null;
4879
+ const normalizedHex = hexColorLuminance(normalized);
4880
+ if (normalizedHex !== null) return normalizedHex;
4881
+ const normalizedChannels = parseRgbChannels(normalized) ?? parseHslChannels(normalized);
4882
+ return normalizedChannels ? channelsLuminance(normalizedChannels) : null;
4883
+ }
4884
+ function resolveEffectiveColorScheme(theme, resolvedColorScheme) {
4885
+ if (resolvedColorScheme !== "dark") return "light";
4886
+ const surface = theme?.surface?.trim();
4887
+ if (!surface) return "dark";
4888
+ const luminance = cssColorLuminance(surface);
4889
+ if (luminance === null) return "dark";
4890
+ return luminance > LIGHT_SURFACE_LUMINANCE_THRESHOLD ? "light" : "dark";
4891
+ }
4759
4892
  function agentThemeStyle(theme, resolvedColorScheme) {
4760
4893
  const brandedTheme = { ...defaultAgentRailTheme, ...theme };
4761
- const resolvedTheme = resolvedColorScheme === "dark" ? {
4894
+ const effectiveColorScheme = resolveEffectiveColorScheme(
4895
+ theme,
4896
+ resolvedColorScheme
4897
+ );
4898
+ const resolvedTheme = effectiveColorScheme === "dark" ? {
4762
4899
  ...brandedTheme,
4763
4900
  brand: theme?.brand ?? defaultDarkAgentRailTheme.brand,
4764
4901
  brandDeep: theme?.brandDeep ?? defaultDarkAgentRailTheme.brandDeep,
@@ -4793,7 +4930,7 @@ function agentThemeStyle(theme, resolvedColorScheme) {
4793
4930
  "--as-danger": resolvedTheme.danger,
4794
4931
  "--as-font-body": resolvedTheme.fontBody,
4795
4932
  "--as-font-display": resolvedTheme.fontDisplay,
4796
- colorScheme: resolvedColorScheme
4933
+ colorScheme: effectiveColorScheme
4797
4934
  };
4798
4935
  }
4799
4936
 
@@ -4997,114 +5134,11 @@ function AgentActivityBubble({
4997
5134
  ] });
4998
5135
  }
4999
5136
 
5000
- // src/react/components/LearnMore/LearnMore.tsx
5001
- import { useId, useState as useState5 } from "react";
5002
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
5003
- function QuestionIcon() {
5004
- return /* @__PURE__ */ jsxs3(
5005
- "svg",
5006
- {
5007
- viewBox: "0 0 24 24",
5008
- width: "18",
5009
- height: "18",
5010
- fill: "none",
5011
- stroke: "currentColor",
5012
- strokeWidth: "1.5",
5013
- strokeLinecap: "round",
5014
- strokeLinejoin: "round",
5015
- "aria-hidden": "true",
5016
- children: [
5017
- /* @__PURE__ */ jsx3("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
5018
- /* @__PURE__ */ jsx3("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
5019
- /* @__PURE__ */ jsx3("path", { d: "M12 17h.01" })
5020
- ]
5021
- }
5022
- );
5023
- }
5024
- function LearnMore({
5025
- results,
5026
- disabled,
5027
- onSelect
5028
- }) {
5029
- const headingId = useId();
5030
- const panelId = useId();
5031
- const [open, setOpen] = useState5(true);
5032
- const questions = [
5033
- ...new Set(results.flatMap((result) => result.suggestions ?? []))
5034
- ].slice(0, 3);
5035
- if (!questions.length) return null;
5036
- return /* @__PURE__ */ jsxs3("section", { className: "learn-more", "aria-labelledby": headingId, children: [
5037
- /* @__PURE__ */ jsx3("h3", { id: headingId, className: "learn-more__heading", children: /* @__PURE__ */ jsxs3(
5038
- "button",
5039
- {
5040
- type: "button",
5041
- className: "learn-more__toggle",
5042
- "aria-expanded": open,
5043
- "aria-controls": panelId,
5044
- onClick: () => setOpen((current) => !current),
5045
- children: [
5046
- /* @__PURE__ */ jsx3("span", { children: "Learn more" }),
5047
- /* @__PURE__ */ jsx3(
5048
- "svg",
5049
- {
5050
- className: "learn-more__chevron",
5051
- viewBox: "0 0 16 16",
5052
- fill: "none",
5053
- "aria-hidden": "true",
5054
- children: /* @__PURE__ */ jsx3(
5055
- "path",
5056
- {
5057
- d: "M4 6.5l4 4 4-4",
5058
- stroke: "currentColor",
5059
- strokeWidth: "1.6",
5060
- strokeLinecap: "round",
5061
- strokeLinejoin: "round"
5062
- }
5063
- )
5064
- }
5065
- )
5066
- ]
5067
- }
5068
- ) }),
5069
- /* @__PURE__ */ jsx3(
5070
- "div",
5071
- {
5072
- id: panelId,
5073
- className: `learn-more__panel${open ? " learn-more__panel--open" : ""}`,
5074
- children: /* @__PURE__ */ jsx3("div", { className: "learn-more__panel-inner", children: /* @__PURE__ */ jsx3("ul", { className: "learn-more__questions", children: questions.map((question) => /* @__PURE__ */ jsx3("li", { children: /* @__PURE__ */ jsxs3(
5075
- "button",
5076
- {
5077
- type: "button",
5078
- disabled,
5079
- onClick: () => onSelect(question),
5080
- children: [
5081
- /* @__PURE__ */ jsx3("span", { className: "learn-more__question-icon", children: /* @__PURE__ */ jsx3(QuestionIcon, {}) }),
5082
- /* @__PURE__ */ jsx3("span", { className: "learn-more__question-text", children: question }),
5083
- /* @__PURE__ */ jsx3(
5084
- "svg",
5085
- {
5086
- className: "learn-more__question-arrow",
5087
- viewBox: "0 0 24 24",
5088
- fill: "none",
5089
- stroke: "currentColor",
5090
- strokeWidth: "1.5",
5091
- "aria-hidden": "true",
5092
- children: /* @__PURE__ */ jsx3("path", { d: "M4 12h16m-7-7 7 7-7 7" })
5093
- }
5094
- )
5095
- ]
5096
- }
5097
- ) }, question)) }) })
5098
- }
5099
- )
5100
- ] });
5101
- }
5102
-
5103
5137
  // src/react/components/SearchReferences/SearchReferences.tsx
5104
- import { useState as useState6 } from "react";
5105
- import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
5138
+ import { useState as useState5 } from "react";
5139
+ import { Fragment, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
5106
5140
  function SiteIcon() {
5107
- return /* @__PURE__ */ jsxs4(
5141
+ return /* @__PURE__ */ jsxs3(
5108
5142
  "svg",
5109
5143
  {
5110
5144
  viewBox: "0 0 24 24",
@@ -5115,15 +5149,15 @@ function SiteIcon() {
5115
5149
  strokeWidth: "1.5",
5116
5150
  "aria-hidden": "true",
5117
5151
  children: [
5118
- /* @__PURE__ */ jsx4("circle", { cx: "12", cy: "12", r: "9" }),
5119
- /* @__PURE__ */ jsx4("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
5120
- /* @__PURE__ */ jsx4("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
5152
+ /* @__PURE__ */ jsx3("circle", { cx: "12", cy: "12", r: "9" }),
5153
+ /* @__PURE__ */ jsx3("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
5154
+ /* @__PURE__ */ jsx3("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
5121
5155
  ]
5122
5156
  }
5123
5157
  );
5124
5158
  }
5125
5159
  function SourceFavicon({ url }) {
5126
- const [failed, setFailed] = useState6(false);
5160
+ const [failed, setFailed] = useState5(false);
5127
5161
  let faviconUrl = null;
5128
5162
  if (url) {
5129
5163
  try {
@@ -5132,8 +5166,8 @@ function SourceFavicon({ url }) {
5132
5166
  faviconUrl = null;
5133
5167
  }
5134
5168
  }
5135
- if (!faviconUrl || failed) return /* @__PURE__ */ jsx4(SiteIcon, {});
5136
- return /* @__PURE__ */ jsx4(
5169
+ if (!faviconUrl || failed) return /* @__PURE__ */ jsx3(SiteIcon, {});
5170
+ return /* @__PURE__ */ jsx3(
5137
5171
  "img",
5138
5172
  {
5139
5173
  src: faviconUrl,
@@ -5153,37 +5187,53 @@ function searchSources(results) {
5153
5187
  return [{ ...source, url, key }];
5154
5188
  });
5155
5189
  }
5156
- function SearchReferences({
5157
- results,
5158
- mode = "default"
5159
- }) {
5160
- const sources = searchSources(results);
5190
+ function searchActions(results) {
5161
5191
  const seenActions = /* @__PURE__ */ new Set();
5162
- const actions = results.flatMap((result) => {
5192
+ return results.flatMap((result) => {
5163
5193
  const url = safeSearchUrl(result.cta?.url);
5164
5194
  if (!url || !result.cta || seenActions.has(url)) return [];
5165
5195
  seenActions.add(url);
5166
5196
  return [{ label: result.cta.label, url }];
5167
5197
  });
5198
+ }
5199
+ function searchSuggestions(results) {
5200
+ return [
5201
+ ...new Set(results.flatMap((result) => result.suggestions ?? []))
5202
+ ].slice(0, 3);
5203
+ }
5204
+ function searchActionLinkTitle(url) {
5205
+ try {
5206
+ const hostname = new URL(url).hostname.replace(/^www\./, "");
5207
+ return hostname ? `Opens ${hostname} in a new tab` : "Opens in a new tab";
5208
+ } catch {
5209
+ return "Opens in a new tab";
5210
+ }
5211
+ }
5212
+ function SearchReferences({
5213
+ results,
5214
+ mode = "default"
5215
+ }) {
5216
+ const sources = searchSources(results);
5217
+ const actions = searchActions(results);
5168
5218
  if (!(mode !== "actions" && sources.length) && !(mode !== "sources" && actions.length))
5169
5219
  return null;
5170
5220
  const Container = mode === "default" ? "details" : "div";
5171
- return /* @__PURE__ */ jsxs4("div", { className: "search-references", children: [
5172
- mode !== "actions" && sources.length > 0 ? /* @__PURE__ */ jsxs4(
5221
+ return /* @__PURE__ */ jsxs3("div", { className: "search-references", children: [
5222
+ mode !== "actions" && sources.length > 0 ? /* @__PURE__ */ jsxs3(
5173
5223
  Container,
5174
5224
  {
5175
5225
  className: "search-references__disclosure",
5176
5226
  "aria-label": "Sources",
5177
5227
  children: [
5178
- mode === "default" ? /* @__PURE__ */ jsxs4("summary", { className: "search-references__heading", children: [
5228
+ mode === "default" ? /* @__PURE__ */ jsxs3("summary", { className: "search-references__heading", children: [
5179
5229
  "Sources (",
5180
5230
  sources.length,
5181
5231
  ")"
5182
5232
  ] }) : null,
5183
- /* @__PURE__ */ jsx4("ul", { className: "search-references__list", children: sources.map((source) => {
5184
- const content = /* @__PURE__ */ jsxs4(Fragment, { children: [
5185
- /* @__PURE__ */ jsx4("span", { className: "search-references__icon", children: /* @__PURE__ */ jsx4(SourceFavicon, { url: source.url }) }),
5186
- /* @__PURE__ */ jsx4(
5233
+ /* @__PURE__ */ jsx3("ul", { className: "search-references__list", children: sources.map((source) => {
5234
+ const content = /* @__PURE__ */ jsxs3(Fragment, { children: [
5235
+ /* @__PURE__ */ jsx3("span", { className: "search-references__icon", children: /* @__PURE__ */ jsx3(SourceFavicon, { url: source.url }) }),
5236
+ /* @__PURE__ */ jsx3(
5187
5237
  "span",
5188
5238
  {
5189
5239
  className: "search-references__title",
@@ -5191,7 +5241,7 @@ function SearchReferences({
5191
5241
  children: source.title
5192
5242
  }
5193
5243
  ),
5194
- source.url ? /* @__PURE__ */ jsx4(
5244
+ source.url ? /* @__PURE__ */ jsxs3(
5195
5245
  "svg",
5196
5246
  {
5197
5247
  className: "search-references__row-arrow",
@@ -5199,12 +5249,17 @@ function SearchReferences({
5199
5249
  fill: "none",
5200
5250
  stroke: "currentColor",
5201
5251
  strokeWidth: "1.5",
5252
+ strokeLinecap: "round",
5253
+ strokeLinejoin: "round",
5202
5254
  "aria-hidden": "true",
5203
- children: /* @__PURE__ */ jsx4("path", { d: "M4 12h16m-7-7 7 7-7 7" })
5255
+ children: [
5256
+ /* @__PURE__ */ jsx3("path", { d: "M7 17 17 7" }),
5257
+ /* @__PURE__ */ jsx3("path", { d: "M8 7h9v9" })
5258
+ ]
5204
5259
  }
5205
5260
  ) : null
5206
5261
  ] });
5207
- return /* @__PURE__ */ jsx4("li", { children: source.url ? /* @__PURE__ */ jsx4(
5262
+ return /* @__PURE__ */ jsx3("li", { children: source.url ? /* @__PURE__ */ jsx3(
5208
5263
  "a",
5209
5264
  {
5210
5265
  className: "search-references__source",
@@ -5213,12 +5268,12 @@ function SearchReferences({
5213
5268
  rel: "noopener noreferrer",
5214
5269
  children: content
5215
5270
  }
5216
- ) : /* @__PURE__ */ jsx4("div", { className: "search-references__source", children: content }) }, source.key);
5271
+ ) : /* @__PURE__ */ jsx3("div", { className: "search-references__source", children: content }) }, source.key);
5217
5272
  }) })
5218
5273
  ]
5219
5274
  }
5220
5275
  ) : null,
5221
- mode !== "sources" && actions.length > 0 ? /* @__PURE__ */ jsx4("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ jsx4(
5276
+ mode !== "sources" && actions.length > 0 ? /* @__PURE__ */ jsx3("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ jsx3(
5222
5277
  "a",
5223
5278
  {
5224
5279
  className: "search-references__cta",
@@ -5232,8 +5287,81 @@ function SearchReferences({
5232
5287
  ] });
5233
5288
  }
5234
5289
 
5290
+ // src/react/components/ExploreMore/ExploreMore.tsx
5291
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
5292
+ function QuestionIcon() {
5293
+ return /* @__PURE__ */ jsxs4(
5294
+ "svg",
5295
+ {
5296
+ viewBox: "0 0 24 24",
5297
+ width: "18",
5298
+ height: "18",
5299
+ fill: "none",
5300
+ stroke: "currentColor",
5301
+ strokeWidth: "1.5",
5302
+ strokeLinecap: "round",
5303
+ strokeLinejoin: "round",
5304
+ "aria-hidden": "true",
5305
+ children: [
5306
+ /* @__PURE__ */ jsx4("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
5307
+ /* @__PURE__ */ jsx4("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
5308
+ /* @__PURE__ */ jsx4("path", { d: "M12 17h.01" })
5309
+ ]
5310
+ }
5311
+ );
5312
+ }
5313
+ function ExploreMore({
5314
+ results,
5315
+ disabled,
5316
+ onSelectQuestion,
5317
+ showLearnMore = true,
5318
+ showSources = true
5319
+ }) {
5320
+ const sources = showSources ? searchSources(results) : [];
5321
+ const questions = showLearnMore ? searchSuggestions(results) : [];
5322
+ if (!sources.length && !questions.length) return null;
5323
+ return /* @__PURE__ */ jsxs4("div", { className: "explore-more", children: [
5324
+ sources.length > 0 ? /* @__PURE__ */ jsxs4("div", { className: "explore-more__section", children: [
5325
+ /* @__PURE__ */ jsxs4("p", { className: "explore-more__label", children: [
5326
+ "Based on ",
5327
+ sources.length,
5328
+ " ",
5329
+ sources.length === 1 ? "page" : "pages"
5330
+ ] }),
5331
+ /* @__PURE__ */ jsx4(SearchReferences, { results, mode: "sources" })
5332
+ ] }) : null,
5333
+ questions.length > 0 ? /* @__PURE__ */ jsxs4("div", { className: "explore-more__section", children: [
5334
+ /* @__PURE__ */ jsx4("p", { className: "explore-more__label", children: "Learn more" }),
5335
+ /* @__PURE__ */ jsx4("ul", { className: "explore-more__questions", children: questions.map((question) => /* @__PURE__ */ jsx4("li", { children: /* @__PURE__ */ jsxs4(
5336
+ "button",
5337
+ {
5338
+ type: "button",
5339
+ disabled,
5340
+ onClick: () => onSelectQuestion(question),
5341
+ children: [
5342
+ /* @__PURE__ */ jsx4("span", { className: "explore-more__question-icon", children: /* @__PURE__ */ jsx4(QuestionIcon, {}) }),
5343
+ /* @__PURE__ */ jsx4("span", { className: "explore-more__question-text", children: question }),
5344
+ /* @__PURE__ */ jsx4(
5345
+ "svg",
5346
+ {
5347
+ className: "explore-more__question-arrow",
5348
+ viewBox: "0 0 24 24",
5349
+ fill: "none",
5350
+ stroke: "currentColor",
5351
+ strokeWidth: "1.5",
5352
+ "aria-hidden": "true",
5353
+ children: /* @__PURE__ */ jsx4("path", { d: "M4 12h16m-7-7 7 7-7 7" })
5354
+ }
5355
+ )
5356
+ ]
5357
+ }
5358
+ ) }, question)) })
5359
+ ] }) : null
5360
+ ] });
5361
+ }
5362
+
5235
5363
  // src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
5236
- import { useEffect as useEffect4, useRef as useRef4, useId as useId2 } from "react";
5364
+ import { useEffect as useEffect4, useRef as useRef4, useId } from "react";
5237
5365
  import { createPortal as createPortal2 } from "react-dom";
5238
5366
  import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
5239
5367
  var FOCUSABLE_SELECTOR = 'button:not(:disabled), a[href], textarea:not(:disabled), input:not(:disabled), [tabindex]:not([tabindex="-1"])';
@@ -5256,7 +5384,7 @@ function AnswerReceiptDialog({
5256
5384
  summary,
5257
5385
  children
5258
5386
  }) {
5259
- const titleId = useId2();
5387
+ const titleId = useId();
5260
5388
  const portalRoots = useAgentRailPortalRoots();
5261
5389
  const overlayRoot = portalRoots?.overlayRef ?? null;
5262
5390
  const cardRef = useRef4(null);
@@ -5340,9 +5468,9 @@ function AnswerReceiptDialog({
5340
5468
  // src/react/components/Composer/Composer.tsx
5341
5469
  import {
5342
5470
  useEffect as useEffect5,
5343
- useId as useId3,
5471
+ useId as useId2,
5344
5472
  useRef as useRef5,
5345
- useState as useState7
5473
+ useState as useState6
5346
5474
  } from "react";
5347
5475
  import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
5348
5476
  var FORM_SUBMITTED_MESSAGE = "Shared my details";
@@ -5398,6 +5526,7 @@ function createDraft(form) {
5398
5526
  };
5399
5527
  }
5400
5528
  function Composer({
5529
+ actions,
5401
5530
  disabled = false,
5402
5531
  placeholder = "Ask anything\u2026",
5403
5532
  variant = "default",
@@ -5405,16 +5534,17 @@ function Composer({
5405
5534
  allowFormResume = true,
5406
5535
  onSubmit
5407
5536
  }) {
5408
- const [value, setValue] = useState7("");
5409
- const [draft, setDraft] = useState7(() => createDraft(form));
5410
- const [multiline, setMultiline] = useState7(false);
5537
+ const [value, setValue] = useState6("");
5538
+ const [draft, setDraft] = useState6(() => createDraft(form));
5539
+ const [multiline, setMultiline] = useState6(false);
5411
5540
  const inputRef = useRef5(null);
5412
5541
  const firstFieldRef = useRef5(null);
5413
5542
  const formRef = useRef5(null);
5414
- const formId = useId3();
5543
+ const formId = useId2();
5415
5544
  if (form && form.id !== draft.form?.id) setDraft(createDraft(form));
5416
5545
  const savedForm = allowFormResume && !draft.submitted ? draft.form : null;
5417
5546
  const activeForm = !disabled && draft.expanded ? savedForm : null;
5547
+ const showResumeBadge = Boolean(savedForm) && !activeForm;
5418
5548
  const canSend = !disabled && Boolean(value.trim() || activeForm);
5419
5549
  useEffect5(() => {
5420
5550
  if (activeForm) firstFieldRef.current?.focus();
@@ -5543,15 +5673,17 @@ function Composer({
5543
5673
  ].filter(Boolean).join(" "),
5544
5674
  onSubmit: handleSubmit,
5545
5675
  children: [
5546
- savedForm ? /* @__PURE__ */ jsxs6("div", { className: "composer__resume", children: [
5547
- /* @__PURE__ */ jsx6("span", { children: "Share your details and we'll reach out shortly" }),
5548
- !activeForm ? /* @__PURE__ */ jsx6(
5676
+ actions || showResumeBadge ? /* @__PURE__ */ jsxs6("div", { className: "composer__actions", children: [
5677
+ actions,
5678
+ showResumeBadge ? /* @__PURE__ */ jsx6(
5549
5679
  "button",
5550
5680
  {
5551
5681
  type: "button",
5682
+ className: "composer__action-badge",
5552
5683
  disabled,
5684
+ title: "Share your details and we'll reach out shortly",
5553
5685
  onClick: () => setDraft((current) => ({ ...current, expanded: true })),
5554
- children: "Request follow-up"
5686
+ children: "Review follow-up"
5555
5687
  }
5556
5688
  ) : null
5557
5689
  ] }) : null,
@@ -5691,15 +5823,15 @@ function FollowUpChips({
5691
5823
  }
5692
5824
 
5693
5825
  // src/react/components/MessageBubble/MessageBubble.tsx
5694
- import { useEffect as useEffect7, useState as useState9 } from "react";
5826
+ import { useEffect as useEffect7, useState as useState8 } from "react";
5695
5827
 
5696
5828
  // src/react/components/BookingCard/BookingCard.tsx
5697
5829
  import {
5698
5830
  useEffect as useEffect6,
5699
- useId as useId4,
5831
+ useId as useId3,
5700
5832
  useMemo as useMemo2,
5701
5833
  useRef as useRef6,
5702
- useState as useState8
5834
+ useState as useState7
5703
5835
  } from "react";
5704
5836
  import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
5705
5837
  var BOOKING_STEPS = [
@@ -5755,14 +5887,14 @@ function InteractiveBookingCard({
5755
5887
  offer,
5756
5888
  onBook
5757
5889
  }) {
5758
- const fieldId = useId4();
5890
+ const fieldId = useId3();
5759
5891
  const defaultType = offer.eventTypes[0]?.uri ?? offer.slots[0]?.eventTypeUri ?? "";
5760
- const [step, setStep] = useState8("date");
5761
- const [eventTypeUri, setEventTypeUri] = useState8(defaultType);
5762
- const [selectedDate, setSelectedDate] = useState8("");
5763
- const [startTime, setStartTime] = useState8("");
5764
- const [name, setName] = useState8("");
5765
- const [email, setEmail] = useState8("");
5892
+ const [step, setStep] = useState7("date");
5893
+ const [eventTypeUri, setEventTypeUri] = useState7(defaultType);
5894
+ const [selectedDate, setSelectedDate] = useState7("");
5895
+ const [startTime, setStartTime] = useState7("");
5896
+ const [name, setName] = useState7("");
5897
+ const [email, setEmail] = useState7("");
5766
5898
  const activeStepRef = useRef6(null);
5767
5899
  const previousStepRef = useRef6(step);
5768
5900
  const stepIndex = BOOKING_STEPS.findIndex((item) => item.id === step);
@@ -5783,7 +5915,7 @@ function InteractiveBookingCard({
5783
5915
  }
5784
5916
  return next;
5785
5917
  }, [slots]);
5786
- const [visibleMonth, setVisibleMonth] = useState8(
5918
+ const [visibleMonth, setVisibleMonth] = useState7(
5787
5919
  () => firstAvailableBookingMonth(slots)
5788
5920
  );
5789
5921
  function selectEventType(nextType) {
@@ -6169,8 +6301,8 @@ function MessageBubble({
6169
6301
  onBook
6170
6302
  }) {
6171
6303
  const resolvedLogoUrl = brandLogoUrl?.trim();
6172
- const [failedLogoUrl, setFailedLogoUrl] = useState9(null);
6173
- const [logoDisplay, setLogoDisplay] = useState9(null);
6304
+ const [failedLogoUrl, setFailedLogoUrl] = useState8(null);
6305
+ const [logoDisplay, setLogoDisplay] = useState8(null);
6174
6306
  useEffect7(() => {
6175
6307
  setFailedLogoUrl(null);
6176
6308
  }, [resolvedLogoUrl]);
@@ -6322,7 +6454,7 @@ function MessageBubble({
6322
6454
  }
6323
6455
 
6324
6456
  // src/react/components/HumanInputCard/HumanInputCard.tsx
6325
- import { useState as useState11 } from "react";
6457
+ import { useState as useState10 } from "react";
6326
6458
 
6327
6459
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
6328
6460
  import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
@@ -6364,7 +6496,7 @@ function ConfirmationCard({
6364
6496
  }
6365
6497
 
6366
6498
  // src/react/components/ToolInputCard/ToolInputCard.tsx
6367
- import { useState as useState10 } from "react";
6499
+ import { useState as useState9 } from "react";
6368
6500
  import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
6369
6501
  function isRecord5(value) {
6370
6502
  return value !== null && typeof value === "object" && !Array.isArray(value);
@@ -6695,11 +6827,11 @@ function ToolInputCard({
6695
6827
  surface,
6696
6828
  onSubmit
6697
6829
  }) {
6698
- const [values, setValues] = useState10(
6830
+ const [values, setValues] = useState9(
6699
6831
  () => initialValues(surface)
6700
6832
  );
6701
- const [touched, setTouched] = useState10(() => /* @__PURE__ */ new Set());
6702
- const [submitted, setSubmitted] = useState10(false);
6833
+ const [touched, setTouched] = useState9(() => /* @__PURE__ */ new Set());
6834
+ const [submitted, setSubmitted] = useState9(false);
6703
6835
  const errors = Object.fromEntries(
6704
6836
  surface.fields.map((field) => [
6705
6837
  field.path,
@@ -6792,7 +6924,7 @@ function HumanInputCard({
6792
6924
  request,
6793
6925
  onRespond
6794
6926
  }) {
6795
- const [text3, setText] = useState11("");
6927
+ const [text3, setText] = useState10("");
6796
6928
  const options = request.options ?? [];
6797
6929
  const showText = request.display === "text" || request.allowFreeform && options.length === 0;
6798
6930
  if (request.ui) {
@@ -6850,7 +6982,7 @@ function HumanInputCard({
6850
6982
  }
6851
6983
 
6852
6984
  // src/react/components/LocationConsent/LocationConsent.tsx
6853
- import { useEffect as useEffect8, useRef as useRef7, useState as useState12 } from "react";
6985
+ import { useEffect as useEffect8, useRef as useRef7, useState as useState11 } from "react";
6854
6986
 
6855
6987
  // src/runtime/location-consent.ts
6856
6988
  function isLocationConsentRequest(request) {
@@ -6898,9 +7030,9 @@ function LocationConsent({
6898
7030
  request,
6899
7031
  onRespond
6900
7032
  }) {
6901
- const [preference, setPreference] = useState12("unset");
6902
- const [locating, setLocating] = useState12(false);
6903
- const [error, setError] = useState12(null);
7033
+ const [preference, setPreference] = useState11("unset");
7034
+ const [locating, setLocating] = useState11(false);
7035
+ const [error, setError] = useState11(null);
6904
7036
  const respond = useRef7(onRespond);
6905
7037
  const answered = useRef7(null);
6906
7038
  const requestId = request?.requestId;
@@ -7298,14 +7430,14 @@ function AgentRail({
7298
7430
  const pinnedToBottomRef = useRef8(true);
7299
7431
  const smoothScrollToLatestRef = useRef8(false);
7300
7432
  const lockedTranscriptScrollTopRef = useRef8(null);
7301
- const [showJumpToLatest, setShowJumpToLatest] = useState13(false);
7302
- const [receiptOpen, setReceiptOpen] = useState13(false);
7303
- const [expandedSourcesMessageId, setExpandedSourcesMessageId] = useState13(null);
7433
+ const [showJumpToLatest, setShowJumpToLatest] = useState12(false);
7434
+ const [receiptOpen, setReceiptOpen] = useState12(false);
7435
+ const [expandedSourcesMessageId, setExpandedSourcesMessageId] = useState12(null);
7304
7436
  const resolvedBrandLabel = brandLabel.trim();
7305
7437
  const resolvedBrandLogoUrl = brandLogoUrl?.trim();
7306
7438
  const resolvedDisclaimerLabel = disclaimerLabel === void 0 ? DEFAULT_DISCLAIMER_LABEL : disclaimerLabel;
7307
- const [failedLogoUrl, setFailedLogoUrl] = useState13(null);
7308
- const [brandLogoDisplay, setBrandLogoDisplay] = useState13(null);
7439
+ const [failedLogoUrl, setFailedLogoUrl] = useState12(null);
7440
+ const [brandLogoDisplay, setBrandLogoDisplay] = useState12(null);
7309
7441
  useEffect9(() => {
7310
7442
  setFailedLogoUrl(null);
7311
7443
  }, [resolvedBrandLogoUrl]);
@@ -7415,6 +7547,34 @@ function AgentRail({
7415
7547
  ...visibleVisitorToolResults
7416
7548
  ].reverse().find((result) => result.kind !== "input")?.id;
7417
7549
  const receiptSteps = answerReceipt && state.toolSteps.length > 0 ? state.toolSteps : void 0;
7550
+ const latestAgentMessage = lastAgentIndex >= 0 ? visibleMessages[lastAgentIndex] : void 0;
7551
+ const composerCtaActions = !handoffActive && state.phase === "complete" && latestAgentMessage?.role === "agent" && !latestAgentMessage.streaming ? searchActions(latestAgentMessage.searchResults ?? []) : [];
7552
+ const showHandoffAction = Boolean(handoff?.page?.enabled) && handoffStatus === "ai";
7553
+ const composerActions = /* @__PURE__ */ jsxs18(Fragment4, { children: [
7554
+ composerCtaActions.map((action) => /* @__PURE__ */ jsx19(
7555
+ "a",
7556
+ {
7557
+ className: "composer__action-badge",
7558
+ href: action.url,
7559
+ target: "_blank",
7560
+ rel: "noopener noreferrer",
7561
+ title: searchActionLinkTitle(action.url),
7562
+ children: action.label
7563
+ },
7564
+ action.url
7565
+ )),
7566
+ showHandoffAction && handoff ? /* @__PURE__ */ jsx19(
7567
+ "button",
7568
+ {
7569
+ type: "button",
7570
+ className: "composer__action-badge",
7571
+ disabled: handoff.busy || handoff.hasPending || isBusy,
7572
+ title: "Chat with a human representative",
7573
+ onClick: () => void handoff.start(),
7574
+ children: "Talk to an Expert"
7575
+ }
7576
+ ) : null
7577
+ ] });
7418
7578
  useEffect9(() => {
7419
7579
  if (state.phase !== "complete") {
7420
7580
  setReceiptOpen(false);
@@ -7680,9 +7840,11 @@ function AgentRail({
7680
7840
  ))
7681
7841
  ] }) : null,
7682
7842
  transcriptMessages.map((message, index) => {
7683
- const messageSourceCount = message.role === "agent" ? searchSources(message.searchResults ?? []).length : 0;
7843
+ const messageResults = message.role === "agent" ? message.searchResults ?? [] : [];
7844
+ const messageSourceCount = showSources ? searchSources(messageResults).length : 0;
7845
+ const messageQuestionCount = index === lastAgentIndex && showLearnMore && !handoffActive ? searchSuggestions(messageResults).length : 0;
7684
7846
  const showAnswerActions = message.role === "agent" && index === lastAgentIndex && showMessageActions;
7685
- const showSourcesToggle = message.role === "agent" && showSources && state.phase === "complete" && !message.streaming && messageSourceCount > 0;
7847
+ const showExploreToggle = message.role === "agent" && state.phase === "complete" && !message.streaming && (messageSourceCount > 0 || messageQuestionCount > 0);
7686
7848
  return /* @__PURE__ */ jsxs18(
7687
7849
  "div",
7688
7850
  {
@@ -7708,7 +7870,7 @@ function AgentRail({
7708
7870
  onBook
7709
7871
  }
7710
7872
  ),
7711
- showAnswerActions || showSourcesToggle ? /* @__PURE__ */ jsxs18("div", { className: "agent-rail__answer-footer", children: [
7873
+ showAnswerActions || showExploreToggle ? /* @__PURE__ */ jsxs18("div", { className: "agent-rail__answer-footer", children: [
7712
7874
  /* @__PURE__ */ jsxs18("div", { className: "agent-rail__answer-actions", children: [
7713
7875
  showAnswerActions ? /* @__PURE__ */ jsx19(
7714
7876
  MessageActions,
@@ -7722,7 +7884,7 @@ function AgentRail({
7722
7884
  onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
7723
7885
  }
7724
7886
  ) : null,
7725
- showSourcesToggle ? /* @__PURE__ */ jsxs18(
7887
+ showExploreToggle ? /* @__PURE__ */ jsxs18(
7726
7888
  "button",
7727
7889
  {
7728
7890
  className: "agent-rail__sources-button",
@@ -7733,7 +7895,7 @@ function AgentRail({
7733
7895
  (current) => current === message.id ? null : message.id
7734
7896
  ),
7735
7897
  children: [
7736
- "Explore More",
7898
+ "Explore more",
7737
7899
  /* @__PURE__ */ jsx19(
7738
7900
  "span",
7739
7901
  {
@@ -7746,38 +7908,26 @@ function AgentRail({
7746
7908
  }
7747
7909
  ) : null
7748
7910
  ] }),
7749
- showSourcesToggle ? /* @__PURE__ */ jsx19(
7911
+ showExploreToggle ? /* @__PURE__ */ jsx19(
7750
7912
  "div",
7751
7913
  {
7752
7914
  id: `agent-rail-sources-${message.id}`,
7753
7915
  className: `agent-rail__sources-panel${expandedSourcesMessageId === message.id ? " agent-rail__sources-panel--open" : ""}`,
7754
7916
  role: "region",
7755
- "aria-label": "Explore More",
7917
+ "aria-label": "Explore more",
7756
7918
  children: /* @__PURE__ */ jsx19("div", { className: "agent-rail__sources-panel-inner", children: /* @__PURE__ */ jsx19(
7757
- SearchReferences,
7919
+ ExploreMore,
7758
7920
  {
7759
7921
  results: message.searchResults ?? [],
7760
- mode: "sources"
7922
+ disabled: isBusy || !(onFollowUpSelect || onSubmit),
7923
+ showLearnMore: showLearnMore && index === lastAgentIndex && !handoffActive,
7924
+ showSources,
7925
+ onSelectQuestion: handleFollowUpSelect
7761
7926
  }
7762
7927
  ) })
7763
7928
  }
7764
7929
  ) : null
7765
7930
  ] }) : null,
7766
- message.role === "agent" && !message.streaming ? /* @__PURE__ */ jsx19(
7767
- SearchReferences,
7768
- {
7769
- results: message.searchResults ?? [],
7770
- mode: "actions"
7771
- }
7772
- ) : null,
7773
- showAnswerActions && !handoffActive && showLearnMore ? /* @__PURE__ */ jsx19(
7774
- LearnMore,
7775
- {
7776
- results: message.searchResults ?? [],
7777
- disabled: isBusy || !(onFollowUpSelect || onSubmit),
7778
- onSelect: handleFollowUpSelect
7779
- }
7780
- ) : null,
7781
7931
  index === lastVisitorIndex ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
7782
7932
  showActivity ? /* @__PURE__ */ jsx19(
7783
7933
  AgentActivityBubble,
@@ -7820,7 +7970,7 @@ function AgentRail({
7820
7970
  onRetry ? /* @__PURE__ */ jsx19("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
7821
7971
  ] }) : null
7822
7972
  ] }) }),
7823
- handoff && (handoff.page?.enabled || handoffActive) ? /* @__PURE__ */ jsxs18("div", { className: "agent-rail__handoff", children: [
7973
+ handoff && (handoff.page?.enabled || handoffActive) && handoffStatus !== "ai" ? /* @__PURE__ */ jsxs18("div", { className: "agent-rail__handoff", children: [
7824
7974
  handoffStatus === "human" || handoffStatus === "queued" || handoffStatus === "requesting" ? /* @__PURE__ */ jsx19("span", { className: "agent-rail__handoff-dot", "aria-hidden": "true" }) : null,
7825
7975
  /* @__PURE__ */ jsx19(
7826
7976
  "p",
@@ -7831,16 +7981,6 @@ function AgentRail({
7831
7981
  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?"
7832
7982
  }
7833
7983
  ),
7834
- handoffStatus === "ai" ? /* @__PURE__ */ jsx19(
7835
- "button",
7836
- {
7837
- type: "button",
7838
- className: "agent-rail__handoff-cta",
7839
- disabled: handoff.busy || handoff.hasPending || isBusy,
7840
- onClick: () => void handoff.start(),
7841
- children: "Talk to a person"
7842
- }
7843
- ) : null,
7844
7984
  handoffStatus === "resolved" ? /* @__PURE__ */ jsx19(
7845
7985
  "button",
7846
7986
  {
@@ -7875,15 +8015,6 @@ function AgentRail({
7875
8015
  )
7876
8016
  ] }) : null
7877
8017
  ] }) : null,
7878
- showDisclaimerLabel ? /* @__PURE__ */ jsx19("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ jsx19("p", { children: disclaimerLink ? /* @__PURE__ */ jsx19(
7879
- "a",
7880
- {
7881
- href: disclaimerLink,
7882
- rel: "noopener noreferrer",
7883
- target: "_blank",
7884
- children: resolvedDisclaimerLabel
7885
- }
7886
- ) : resolvedDisclaimerLabel }) }) : null,
7887
8018
  /* @__PURE__ */ jsxs18("div", { className: "agent-rail__composer-wrap", children: [
7888
8019
  /* @__PURE__ */ jsx19(
7889
8020
  LocationConsent,
@@ -7907,6 +8038,7 @@ function AgentRail({
7907
8038
  /* @__PURE__ */ jsx19(
7908
8039
  Composer,
7909
8040
  {
8041
+ actions: composerCtaActions.length > 0 || showHandoffAction ? composerActions : void 0,
7910
8042
  variant: expanded || mobileFullscreen ? "dock" : "default",
7911
8043
  disabled: isBusy || Boolean(handoff?.busy || handoff?.hasPending) || handoffActive && !["requesting", "queued", "human"].includes(
7912
8044
  handoffStatus ?? ""
@@ -7921,6 +8053,15 @@ function AgentRail({
7921
8053
  },
7922
8054
  `${state.messages.find((message) => message.role === "visitor")?.id ?? "empty"}:${latestResultId ?? ""}`
7923
8055
  ),
8056
+ showDisclaimerLabel ? /* @__PURE__ */ jsx19("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ jsx19("p", { children: disclaimerLink ? /* @__PURE__ */ jsx19(
8057
+ "a",
8058
+ {
8059
+ href: disclaimerLink,
8060
+ rel: "noopener noreferrer",
8061
+ target: "_blank",
8062
+ children: resolvedDisclaimerLabel
8063
+ }
8064
+ ) : resolvedDisclaimerLabel }) }) : null,
7924
8065
  poweredByLabel ? /* @__PURE__ */ jsx19("div", { className: "agent-rail__footer", children: /* @__PURE__ */ jsx19("p", { children: /* @__PURE__ */ jsx19("span", { children: poweredByLabel }) }) }) : null
7925
8066
  ] })
7926
8067
  ] }),
@@ -7939,7 +8080,7 @@ function AgentRail({
7939
8080
  }
7940
8081
 
7941
8082
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
7942
- import { useState as useState14 } from "react";
8083
+ import { useState as useState13 } from "react";
7943
8084
  import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
7944
8085
  function ChatSparkIcon() {
7945
8086
  return /* @__PURE__ */ jsxs19(
@@ -8021,9 +8162,9 @@ function TabMarkIcon({
8021
8162
  }) {
8022
8163
  const custom = customIconUrl?.trim();
8023
8164
  const logo = logoUrl?.trim();
8024
- const [customFailed, setCustomFailed] = useState14(false);
8025
- const [logoFailed, setLogoFailed] = useState14(false);
8026
- const [markDisplay, setMarkDisplay] = useState14(null);
8165
+ const [customFailed, setCustomFailed] = useState13(false);
8166
+ const [logoFailed, setLogoFailed] = useState13(false);
8167
+ const [markDisplay, setMarkDisplay] = useState13(null);
8027
8168
  function applyLauncherLogoSize(img, sourceUrl) {
8028
8169
  if (!chip) return;
8029
8170
  const display = snapBrandLogoDisplaySize({
@@ -8287,7 +8428,7 @@ function sendAgentAnswerFeedback(eventUrl, event) {
8287
8428
  }
8288
8429
 
8289
8430
  // src/react/components/AgentWidget/AgentWidget.tsx
8290
- import { useEffect as useEffect12, useRef as useRef9, useState as useState16 } from "react";
8431
+ import { useEffect as useEffect12, useRef as useRef9, useState as useState15 } from "react";
8291
8432
 
8292
8433
  // src/react/page-shift.ts
8293
8434
  import { useEffect as useEffect10 } from "react";
@@ -8370,9 +8511,9 @@ function usePageShift(input) {
8370
8511
  }
8371
8512
 
8372
8513
  // src/react/hooks/useIsMobile.ts
8373
- import { useEffect as useEffect11, useState as useState15 } from "react";
8514
+ import { useEffect as useEffect11, useState as useState14 } from "react";
8374
8515
  function useIsMobile(breakpoint = 767) {
8375
- const [isMobile, setIsMobile] = useState15(
8516
+ const [isMobile, setIsMobile] = useState14(
8376
8517
  () => typeof window !== "undefined" && window.matchMedia(`(max-width: ${breakpoint}px)`).matches
8377
8518
  );
8378
8519
  useEffect11(() => {
@@ -8407,8 +8548,8 @@ function AgentWidget({
8407
8548
  const isMobile = useIsMobile();
8408
8549
  const placement = normalizeAgentPlacement(placementInput);
8409
8550
  const railSlotRef = useRef9(null);
8410
- const [railCollapsed, setRailCollapsed] = useState16(defaultCollapsed);
8411
- const [railExpanded, setRailExpanded] = useState16(false);
8551
+ const [railCollapsed, setRailCollapsed] = useState15(defaultCollapsed);
8552
+ const [railExpanded, setRailExpanded] = useState15(false);
8412
8553
  const pageShiftActive = shouldApplyPageShift({
8413
8554
  pageShift,
8414
8555
  isMobile,
@@ -8596,9 +8737,9 @@ function AgentWidget({
8596
8737
  subLabel: branding?.tabSubLabel,
8597
8738
  customIconUrl: branding?.tabIconUrl,
8598
8739
  logoUrl: branding?.logoUrl,
8599
- brandColor: branding?.colors?.primary,
8600
- brandForeground: branding?.colors?.primaryForeground,
8601
- borderColor: branding?.colors?.border,
8740
+ brandColor: branding?.colors?.launcherPrimary ?? branding?.colors?.primary,
8741
+ brandForeground: branding?.colors?.launcherPrimaryForeground ?? branding?.colors?.primaryForeground,
8742
+ borderColor: branding?.colors?.launcherBorder ?? branding?.colors?.border,
8602
8743
  fontFamily: branding?.fontFamily,
8603
8744
  mobile: isMobile,
8604
8745
  surfaceColor: branding?.colors?.surface,
@@ -8645,4 +8786,4 @@ export {
8645
8786
  sendAgentAnswerFeedback,
8646
8787
  AgentWidget
8647
8788
  };
8648
- //# sourceMappingURL=chunk-P6ZM4BIU.js.map
8789
+ //# sourceMappingURL=chunk-ZHEXHTHJ.js.map