@webless/agent 0.12.1 → 0.13.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.
@@ -363,7 +363,12 @@ function parseAgentSearchReferences(value) {
363
363
  const url = safeSearchUrl(action.url);
364
364
  cta = { label: action.label.trim(), ...url ? { url } : {} };
365
365
  }
366
- return { sources, ...cta ? { cta } : {} };
366
+ const suggestions = Array.isArray(data.suggestions) && data.suggestions.length <= 8 && data.suggestions.every((item) => text(item)) ? [...new Set(data.suggestions.map((item) => item.trim()))] : void 0;
367
+ return {
368
+ sources,
369
+ ...cta ? { cta } : {},
370
+ ...suggestions ? { suggestions } : {}
371
+ };
367
372
  }
368
373
  function parseAgentSearchDiscoveryOutput(value) {
369
374
  let decoded = value;
@@ -1117,6 +1122,7 @@ function presentVisitorToolResult(result, registry = []) {
1117
1122
  status: "completed",
1118
1123
  kind: "search",
1119
1124
  sources: search.sources,
1125
+ suggestions: search.suggestions,
1120
1126
  ...search.cta ? { cta: search.cta } : {}
1121
1127
  };
1122
1128
  }
@@ -4654,7 +4660,7 @@ function MessageActions({
4654
4660
  },
4655
4661
  children: [
4656
4662
  /* @__PURE__ */ jsx(SourcesIcon, {}),
4657
- "View sources"
4663
+ "How this answer was made"
4658
4664
  ]
4659
4665
  }
4660
4666
  ) : null,
@@ -4747,7 +4753,7 @@ function MessageActions({
4747
4753
  }
4748
4754
 
4749
4755
  // src/react/components/AgentRail/AgentRail.tsx
4750
- import { useEffect as useEffect8, useRef as useRef8, useState as useState11 } from "react";
4756
+ import { useEffect as useEffect9, useRef as useRef8, useState as useState13 } from "react";
4751
4757
 
4752
4758
  // src/react/lib/agent-theme.ts
4753
4759
  function agentThemeStyle(theme, resolvedColorScheme) {
@@ -4991,13 +4997,248 @@ function AgentActivityBubble({
4991
4997
  ] });
4992
4998
  }
4993
4999
 
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
+ // 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";
5106
+ function SiteIcon() {
5107
+ return /* @__PURE__ */ jsxs4(
5108
+ "svg",
5109
+ {
5110
+ viewBox: "0 0 24 24",
5111
+ width: "18",
5112
+ height: "18",
5113
+ fill: "none",
5114
+ stroke: "currentColor",
5115
+ strokeWidth: "1.5",
5116
+ "aria-hidden": "true",
5117
+ 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" })
5121
+ ]
5122
+ }
5123
+ );
5124
+ }
5125
+ function SourceFavicon({ url }) {
5126
+ const [failed, setFailed] = useState6(false);
5127
+ let faviconUrl = null;
5128
+ if (url) {
5129
+ try {
5130
+ faviconUrl = `${new URL(url).origin}/favicon.ico`;
5131
+ } catch {
5132
+ faviconUrl = null;
5133
+ }
5134
+ }
5135
+ if (!faviconUrl || failed) return /* @__PURE__ */ jsx4(SiteIcon, {});
5136
+ return /* @__PURE__ */ jsx4(
5137
+ "img",
5138
+ {
5139
+ src: faviconUrl,
5140
+ alt: "",
5141
+ loading: "lazy",
5142
+ onError: () => setFailed(true)
5143
+ }
5144
+ );
5145
+ }
5146
+ function searchSources(results) {
5147
+ const seenSources = /* @__PURE__ */ new Set();
5148
+ return results.flatMap((result) => result.sources).flatMap((source) => {
5149
+ const url = safeSearchUrl(source.url);
5150
+ const key = url ?? source.id;
5151
+ if (seenSources.has(key)) return [];
5152
+ seenSources.add(key);
5153
+ return [{ ...source, url, key }];
5154
+ });
5155
+ }
5156
+ function SearchReferences({
5157
+ results,
5158
+ mode = "default"
5159
+ }) {
5160
+ const sources = searchSources(results);
5161
+ const seenActions = /* @__PURE__ */ new Set();
5162
+ const actions = results.flatMap((result) => {
5163
+ const url = safeSearchUrl(result.cta?.url);
5164
+ if (!url || !result.cta || seenActions.has(url)) return [];
5165
+ seenActions.add(url);
5166
+ return [{ label: result.cta.label, url }];
5167
+ });
5168
+ if (!(mode !== "actions" && sources.length) && !(mode !== "sources" && actions.length))
5169
+ return null;
5170
+ const Container = mode === "default" ? "details" : "div";
5171
+ return /* @__PURE__ */ jsxs4("div", { className: "search-references", children: [
5172
+ mode !== "actions" && sources.length > 0 ? /* @__PURE__ */ jsxs4(
5173
+ Container,
5174
+ {
5175
+ className: "search-references__disclosure",
5176
+ "aria-label": "Sources",
5177
+ children: [
5178
+ mode === "default" ? /* @__PURE__ */ jsxs4("summary", { className: "search-references__heading", children: [
5179
+ "Sources (",
5180
+ sources.length,
5181
+ ")"
5182
+ ] }) : 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(
5187
+ "span",
5188
+ {
5189
+ className: "search-references__title",
5190
+ title: source.title,
5191
+ children: source.title
5192
+ }
5193
+ ),
5194
+ source.url ? /* @__PURE__ */ jsx4(
5195
+ "svg",
5196
+ {
5197
+ className: "search-references__row-arrow",
5198
+ viewBox: "0 0 24 24",
5199
+ fill: "none",
5200
+ stroke: "currentColor",
5201
+ strokeWidth: "1.5",
5202
+ "aria-hidden": "true",
5203
+ children: /* @__PURE__ */ jsx4("path", { d: "M4 12h16m-7-7 7 7-7 7" })
5204
+ }
5205
+ ) : null
5206
+ ] });
5207
+ return /* @__PURE__ */ jsx4("li", { children: source.url ? /* @__PURE__ */ jsx4(
5208
+ "a",
5209
+ {
5210
+ className: "search-references__source",
5211
+ href: source.url,
5212
+ target: "_blank",
5213
+ rel: "noopener noreferrer",
5214
+ children: content
5215
+ }
5216
+ ) : /* @__PURE__ */ jsx4("div", { className: "search-references__source", children: content }) }, source.key);
5217
+ }) })
5218
+ ]
5219
+ }
5220
+ ) : null,
5221
+ mode !== "sources" && actions.length > 0 ? /* @__PURE__ */ jsx4("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ jsx4(
5222
+ "a",
5223
+ {
5224
+ className: "search-references__cta",
5225
+ href: action.url,
5226
+ target: "_blank",
5227
+ rel: "noopener noreferrer",
5228
+ children: action.label
5229
+ },
5230
+ action.url
5231
+ )) }) : null
5232
+ ] });
5233
+ }
5234
+
4994
5235
  // src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
4995
- import { useEffect as useEffect4, useRef as useRef4 } from "react";
5236
+ import { useEffect as useEffect4, useRef as useRef4, useId as useId2 } from "react";
4996
5237
  import { createPortal as createPortal2 } from "react-dom";
4997
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
5238
+ import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
4998
5239
  var FOCUSABLE_SELECTOR = 'button:not(:disabled), a[href], textarea:not(:disabled), input:not(:disabled), [tabindex]:not([tabindex="-1"])';
4999
5240
  function CloseIcon() {
5000
- return /* @__PURE__ */ jsx3("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx3(
5241
+ return /* @__PURE__ */ jsx5("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx5(
5001
5242
  "path",
5002
5243
  {
5003
5244
  d: "M4 4l8 8M12 4l-8 8",
@@ -5010,8 +5251,12 @@ function CloseIcon() {
5010
5251
  function AnswerReceiptDialog({
5011
5252
  brandLabel = "",
5012
5253
  onClose,
5013
- steps
5254
+ steps = [],
5255
+ title = "How this answer was made",
5256
+ summary,
5257
+ children
5014
5258
  }) {
5259
+ const titleId = useId2();
5015
5260
  const portalRoots = useAgentRailPortalRoots();
5016
5261
  const overlayRoot = portalRoots?.overlayRef ?? null;
5017
5262
  const cardRef = useRef4(null);
@@ -5028,9 +5273,7 @@ function AnswerReceiptDialog({
5028
5273
  return;
5029
5274
  }
5030
5275
  if (event.key !== "Tab" || !cardRef.current) return;
5031
- const focusable = cardRef.current.querySelectorAll(
5032
- FOCUSABLE_SELECTOR
5033
- );
5276
+ const focusable = cardRef.current.querySelectorAll(FOCUSABLE_SELECTOR);
5034
5277
  if (focusable.length === 0) return;
5035
5278
  const first = focusable.item(0);
5036
5279
  const last = focusable.item(focusable.length - 1);
@@ -5048,8 +5291,8 @@ function AnswerReceiptDialog({
5048
5291
  previouslyFocusedRef.current?.focus({ preventScroll: true });
5049
5292
  };
5050
5293
  }, [onClose]);
5051
- const content = /* @__PURE__ */ jsxs3("div", { className: "agent-receipt-dialog", children: [
5052
- /* @__PURE__ */ jsx3(
5294
+ const content = /* @__PURE__ */ jsxs5("div", { className: "agent-receipt-dialog", children: [
5295
+ /* @__PURE__ */ jsx5(
5053
5296
  "button",
5054
5297
  {
5055
5298
  type: "button",
@@ -5059,25 +5302,18 @@ function AnswerReceiptDialog({
5059
5302
  onClick: onClose
5060
5303
  }
5061
5304
  ),
5062
- /* @__PURE__ */ jsxs3(
5305
+ /* @__PURE__ */ jsxs5(
5063
5306
  "div",
5064
5307
  {
5065
5308
  ref: cardRef,
5066
5309
  className: "agent-receipt-dialog__card",
5067
5310
  role: "dialog",
5068
5311
  "aria-modal": "true",
5069
- "aria-labelledby": "agent-receipt-dialog-title",
5312
+ "aria-labelledby": titleId,
5070
5313
  children: [
5071
- /* @__PURE__ */ jsxs3("div", { className: "agent-receipt-dialog__header", children: [
5072
- /* @__PURE__ */ jsx3(
5073
- "p",
5074
- {
5075
- className: "agent-receipt-dialog__title",
5076
- id: "agent-receipt-dialog-title",
5077
- children: "How this answer was made"
5078
- }
5079
- ),
5080
- /* @__PURE__ */ jsx3(
5314
+ /* @__PURE__ */ jsxs5("div", { className: "agent-receipt-dialog__header", children: [
5315
+ /* @__PURE__ */ jsx5("p", { className: "agent-receipt-dialog__title", id: titleId, children: title }),
5316
+ /* @__PURE__ */ jsx5(
5081
5317
  "button",
5082
5318
  {
5083
5319
  ref: closeButtonRef,
@@ -5085,12 +5321,12 @@ function AnswerReceiptDialog({
5085
5321
  className: "agent-receipt-dialog__close",
5086
5322
  "aria-label": "Close",
5087
5323
  onClick: onClose,
5088
- children: /* @__PURE__ */ jsx3(CloseIcon, {})
5324
+ children: /* @__PURE__ */ jsx5(CloseIcon, {})
5089
5325
  }
5090
5326
  )
5091
5327
  ] }),
5092
- /* @__PURE__ */ jsx3("p", { className: "agent-receipt-dialog__summary", children: workSummary(steps, false, brandLabel) }),
5093
- /* @__PURE__ */ jsx3("div", { className: "agent-receipt-dialog__body", children: /* @__PURE__ */ jsx3(AgentWorkSteps, { brandLabel, steps }) })
5328
+ /* @__PURE__ */ jsx5("p", { className: "agent-receipt-dialog__summary", children: summary ?? workSummary(steps, false, brandLabel) }),
5329
+ /* @__PURE__ */ jsx5("div", { className: "agent-receipt-dialog__body", children: children ?? /* @__PURE__ */ jsx5(AgentWorkSteps, { brandLabel, steps }) })
5094
5330
  ]
5095
5331
  }
5096
5332
  )
@@ -5104,14 +5340,14 @@ function AnswerReceiptDialog({
5104
5340
  // src/react/components/Composer/Composer.tsx
5105
5341
  import {
5106
5342
  useEffect as useEffect5,
5107
- useId,
5343
+ useId as useId3,
5108
5344
  useRef as useRef5,
5109
- useState as useState5
5345
+ useState as useState7
5110
5346
  } from "react";
5111
- import { Fragment, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
5347
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
5112
5348
  var FORM_SUBMITTED_MESSAGE = "Shared my details";
5113
5349
  function SendIcon() {
5114
- return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(
5350
+ return /* @__PURE__ */ jsx6("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(
5115
5351
  "path",
5116
5352
  {
5117
5353
  d: "M8 12V4M8 4l-3 3M8 4l3 3",
@@ -5123,7 +5359,7 @@ function SendIcon() {
5123
5359
  ) });
5124
5360
  }
5125
5361
  function CheckIcon2() {
5126
- return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(
5362
+ return /* @__PURE__ */ jsx6("svg", { viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(
5127
5363
  "path",
5128
5364
  {
5129
5365
  d: "M2.5 6.2l2.3 2.3 4.7-5",
@@ -5135,7 +5371,7 @@ function CheckIcon2() {
5135
5371
  ) });
5136
5372
  }
5137
5373
  function CollapseIcon() {
5138
- return /* @__PURE__ */ jsx4("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(
5374
+ return /* @__PURE__ */ jsx6("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(
5139
5375
  "path",
5140
5376
  {
5141
5377
  d: "M4 10l4-4 4 4",
@@ -5169,12 +5405,13 @@ function Composer({
5169
5405
  allowFormResume = true,
5170
5406
  onSubmit
5171
5407
  }) {
5172
- const [value, setValue] = useState5("");
5173
- const [draft, setDraft] = useState5(() => createDraft(form));
5408
+ const [value, setValue] = useState7("");
5409
+ const [draft, setDraft] = useState7(() => createDraft(form));
5410
+ const [multiline, setMultiline] = useState7(false);
5174
5411
  const inputRef = useRef5(null);
5175
5412
  const firstFieldRef = useRef5(null);
5176
5413
  const formRef = useRef5(null);
5177
- const formId = useId();
5414
+ const formId = useId3();
5178
5415
  if (form && form.id !== draft.form?.id) setDraft(createDraft(form));
5179
5416
  const savedForm = allowFormResume && !draft.submitted ? draft.form : null;
5180
5417
  const activeForm = !disabled && draft.expanded ? savedForm : null;
@@ -5184,6 +5421,19 @@ function Composer({
5184
5421
  else if ((savedForm || draft.submitted) && !disabled)
5185
5422
  inputRef.current?.focus();
5186
5423
  }, [activeForm?.id, disabled, savedForm?.id, draft.submitted]);
5424
+ useEffect5(() => {
5425
+ const input = inputRef.current;
5426
+ if (!input) return;
5427
+ const check = () => {
5428
+ const style = window.getComputedStyle(input);
5429
+ const singleLine = (parseFloat(style.lineHeight) || 20) + parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + 2;
5430
+ setMultiline(input.offsetHeight > singleLine);
5431
+ };
5432
+ check();
5433
+ const observer = new ResizeObserver(check);
5434
+ observer.observe(input);
5435
+ return () => observer.disconnect();
5436
+ }, []);
5187
5437
  function collapseForm() {
5188
5438
  setDraft((current) => ({ ...current, expanded: false }));
5189
5439
  }
@@ -5253,8 +5503,8 @@ function Composer({
5253
5503
  submitForm();
5254
5504
  }
5255
5505
  }
5256
- const chatField = /* @__PURE__ */ jsxs4(Fragment, { children: [
5257
- /* @__PURE__ */ jsx4(
5506
+ const chatField = /* @__PURE__ */ jsxs6(Fragment2, { children: [
5507
+ /* @__PURE__ */ jsx6(
5258
5508
  "textarea",
5259
5509
  {
5260
5510
  ref: inputRef,
@@ -5269,18 +5519,18 @@ function Composer({
5269
5519
  onKeyDown: handleChatKeyDown
5270
5520
  }
5271
5521
  ),
5272
- /* @__PURE__ */ jsx4(
5522
+ /* @__PURE__ */ jsx6(
5273
5523
  "button",
5274
5524
  {
5275
5525
  type: "submit",
5276
5526
  className: "composer__send",
5277
5527
  disabled: !canSend,
5278
5528
  "aria-label": "Send message",
5279
- children: /* @__PURE__ */ jsx4(SendIcon, {})
5529
+ children: /* @__PURE__ */ jsx6(SendIcon, {})
5280
5530
  }
5281
5531
  )
5282
5532
  ] });
5283
- return /* @__PURE__ */ jsxs4(
5533
+ return /* @__PURE__ */ jsxs6(
5284
5534
  "form",
5285
5535
  {
5286
5536
  ref: formRef,
@@ -5288,13 +5538,14 @@ function Composer({
5288
5538
  className: [
5289
5539
  "composer",
5290
5540
  variant === "dock" ? "composer--dock" : "",
5291
- activeForm ? "composer--form" : ""
5541
+ activeForm ? "composer--form" : "",
5542
+ multiline ? "composer--multiline" : ""
5292
5543
  ].filter(Boolean).join(" "),
5293
5544
  onSubmit: handleSubmit,
5294
5545
  children: [
5295
- savedForm ? /* @__PURE__ */ jsxs4("div", { className: "composer__resume", children: [
5296
- /* @__PURE__ */ jsx4("span", { children: "Share your details and we'll reach out shortly" }),
5297
- !activeForm ? /* @__PURE__ */ jsx4(
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(
5298
5549
  "button",
5299
5550
  {
5300
5551
  type: "button",
@@ -5304,17 +5555,17 @@ function Composer({
5304
5555
  }
5305
5556
  ) : null
5306
5557
  ] }) : null,
5307
- activeForm ? /* @__PURE__ */ jsxs4(
5558
+ activeForm ? /* @__PURE__ */ jsxs6(
5308
5559
  "div",
5309
5560
  {
5310
5561
  className: "composer__sheet",
5311
5562
  role: "group",
5312
5563
  "aria-label": "Contact details",
5313
5564
  children: [
5314
- /* @__PURE__ */ jsxs4("div", { className: "composer__form-heading", children: [
5315
- /* @__PURE__ */ jsx4("strong", { children: "Share your details" }),
5316
- /* @__PURE__ */ jsx4("span", { children: "Optional" }),
5317
- /* @__PURE__ */ jsx4(
5565
+ /* @__PURE__ */ jsxs6("div", { className: "composer__form-heading", children: [
5566
+ /* @__PURE__ */ jsx6("strong", { children: "Share your details" }),
5567
+ /* @__PURE__ */ jsx6("span", { children: "Optional" }),
5568
+ /* @__PURE__ */ jsx6(
5318
5569
  "button",
5319
5570
  {
5320
5571
  type: "button",
@@ -5322,11 +5573,11 @@ function Composer({
5322
5573
  "aria-label": "Collapse form",
5323
5574
  disabled,
5324
5575
  onClick: collapseForm,
5325
- children: /* @__PURE__ */ jsx4(CollapseIcon, {})
5576
+ children: /* @__PURE__ */ jsx6(CollapseIcon, {})
5326
5577
  }
5327
5578
  )
5328
5579
  ] }),
5329
- /* @__PURE__ */ jsx4("div", { className: "composer__fields", children: activeForm.fields.map((field, index) => {
5580
+ /* @__PURE__ */ jsx6("div", { className: "composer__fields", children: activeForm.fields.map((field, index) => {
5330
5581
  const fieldId = `${formId}-${field.id}`;
5331
5582
  const fieldValue = draft.values[field.id] ?? "";
5332
5583
  const invalid = draft.attempted && !isValidComposerFieldValue(field, fieldValue);
@@ -5351,7 +5602,7 @@ function Composer({
5351
5602
  },
5352
5603
  onKeyDown: handleFormKeyDown
5353
5604
  };
5354
- return /* @__PURE__ */ jsxs4(
5605
+ return /* @__PURE__ */ jsxs6(
5355
5606
  "div",
5356
5607
  {
5357
5608
  className: [
@@ -5359,9 +5610,9 @@ function Composer({
5359
5610
  field.kind === "textarea" ? "composer__row--area" : ""
5360
5611
  ].filter(Boolean).join(" "),
5361
5612
  children: [
5362
- /* @__PURE__ */ jsxs4("div", { className: "composer__line", children: [
5363
- /* @__PURE__ */ jsx4("label", { className: "composer__label", htmlFor: fieldId, children: field.label }),
5364
- field.kind === "textarea" ? /* @__PURE__ */ jsx4(
5613
+ /* @__PURE__ */ jsxs6("div", { className: "composer__line", children: [
5614
+ /* @__PURE__ */ jsx6("label", { className: "composer__label", htmlFor: fieldId, children: field.label }),
5615
+ field.kind === "textarea" ? /* @__PURE__ */ jsx6(
5365
5616
  "textarea",
5366
5617
  {
5367
5618
  ...controlProps,
@@ -5371,7 +5622,7 @@ function Composer({
5371
5622
  className: "composer__control composer__control--area",
5372
5623
  rows: 2
5373
5624
  }
5374
- ) : /* @__PURE__ */ jsx4(
5625
+ ) : /* @__PURE__ */ jsx6(
5375
5626
  "input",
5376
5627
  {
5377
5628
  ...controlProps,
@@ -5383,25 +5634,25 @@ function Composer({
5383
5634
  inputMode: field.kind === "tel" ? "tel" : void 0
5384
5635
  }
5385
5636
  ),
5386
- complete && field.kind !== "textarea" ? /* @__PURE__ */ jsx4("span", { className: "composer__check", "aria-hidden": "true", children: /* @__PURE__ */ jsx4(CheckIcon2, {}) }) : null
5637
+ complete && field.kind !== "textarea" ? /* @__PURE__ */ jsx6("span", { className: "composer__check", "aria-hidden": "true", children: /* @__PURE__ */ jsx6(CheckIcon2, {}) }) : null
5387
5638
  ] }),
5388
- invalid ? /* @__PURE__ */ jsx4("p", { className: "composer__error", id: `${fieldId}-error`, children: field.kind === "email" ? "Enter a valid email to share your details." : `Add your ${field.label.toLowerCase()} to share your details.` }) : null
5639
+ invalid ? /* @__PURE__ */ jsx6("p", { className: "composer__error", id: `${fieldId}-error`, children: field.kind === "email" ? "Enter a valid email to share your details." : `Add your ${field.label.toLowerCase()} to share your details.` }) : null
5389
5640
  ]
5390
5641
  },
5391
5642
  field.id
5392
5643
  );
5393
5644
  }) }),
5394
- /* @__PURE__ */ jsx4("div", { className: "composer__field composer__field--inset", children: chatField })
5645
+ /* @__PURE__ */ jsx6("div", { className: "composer__field composer__field--inset", children: chatField })
5395
5646
  ]
5396
5647
  }
5397
- ) : /* @__PURE__ */ jsx4("div", { className: "composer__field", children: chatField })
5648
+ ) : /* @__PURE__ */ jsx6("div", { className: "composer__field", children: chatField })
5398
5649
  ]
5399
5650
  }
5400
5651
  );
5401
5652
  }
5402
5653
 
5403
5654
  // src/react/components/FollowUpChips/FollowUpChips.tsx
5404
- import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
5655
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
5405
5656
  function FollowUpChips({
5406
5657
  suggestions,
5407
5658
  disabled = false,
@@ -5411,7 +5662,7 @@ function FollowUpChips({
5411
5662
  }) {
5412
5663
  if (suggestions.length === 0) return null;
5413
5664
  if (variant === "dock") {
5414
- return /* @__PURE__ */ jsx5("div", { className: "followups followups--dock", children: /* @__PURE__ */ jsx5("div", { className: "followups__scroll", children: suggestions.map((suggestion) => /* @__PURE__ */ jsx5(
5665
+ return /* @__PURE__ */ jsx7("div", { className: "followups followups--dock", children: /* @__PURE__ */ jsx7("div", { className: "followups__scroll", children: suggestions.map((suggestion) => /* @__PURE__ */ jsx7(
5415
5666
  "button",
5416
5667
  {
5417
5668
  type: "button",
@@ -5423,9 +5674,9 @@ function FollowUpChips({
5423
5674
  suggestion.id
5424
5675
  )) }) });
5425
5676
  }
5426
- return /* @__PURE__ */ jsxs5("div", { className: "followups", children: [
5427
- /* @__PURE__ */ jsx5("span", { className: "followups__label", children: label }),
5428
- /* @__PURE__ */ jsx5("div", { className: "followups__list", children: suggestions.map((suggestion) => /* @__PURE__ */ jsx5(
5677
+ return /* @__PURE__ */ jsxs7("div", { className: "followups", children: [
5678
+ /* @__PURE__ */ jsx7("span", { className: "followups__label", children: label }),
5679
+ /* @__PURE__ */ jsx7("div", { className: "followups__list", children: suggestions.map((suggestion) => /* @__PURE__ */ jsx7(
5429
5680
  "button",
5430
5681
  {
5431
5682
  type: "button",
@@ -5440,105 +5691,17 @@ function FollowUpChips({
5440
5691
  }
5441
5692
 
5442
5693
  // src/react/components/MessageBubble/MessageBubble.tsx
5443
- import { useState as useState7 } from "react";
5444
-
5445
- // src/react/components/SearchReferences/SearchReferences.tsx
5446
- import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
5447
- function SiteIcon() {
5448
- return /* @__PURE__ */ jsxs6(
5449
- "svg",
5450
- {
5451
- viewBox: "0 0 24 24",
5452
- width: "18",
5453
- height: "18",
5454
- fill: "none",
5455
- stroke: "currentColor",
5456
- strokeWidth: "1.5",
5457
- "aria-hidden": "true",
5458
- children: [
5459
- /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "9" }),
5460
- /* @__PURE__ */ jsx6("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
5461
- /* @__PURE__ */ jsx6("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
5462
- ]
5463
- }
5464
- );
5465
- }
5466
- function SearchReferences({
5467
- results
5468
- }) {
5469
- const seenSources = /* @__PURE__ */ new Set();
5470
- const sources = results.flatMap((result) => result.sources).flatMap((source) => {
5471
- const url = safeSearchUrl(source.url);
5472
- const key = url ?? source.id;
5473
- if (seenSources.has(key)) return [];
5474
- seenSources.add(key);
5475
- return [{ ...source, url, key }];
5476
- });
5477
- const seenActions = /* @__PURE__ */ new Set();
5478
- const actions = results.flatMap((result) => {
5479
- const url = safeSearchUrl(result.cta?.url);
5480
- if (!url || !result.cta || seenActions.has(url)) return [];
5481
- seenActions.add(url);
5482
- return [{ label: result.cta.label, url }];
5483
- });
5484
- if (!sources.length && !actions.length) return null;
5485
- return /* @__PURE__ */ jsxs6("div", { className: "search-references", children: [
5486
- sources.length > 0 ? /* @__PURE__ */ jsxs6("details", { className: "search-references__disclosure", "aria-label": "Sources", children: [
5487
- /* @__PURE__ */ jsxs6("summary", { className: "search-references__heading", children: [
5488
- "Sources (",
5489
- sources.length,
5490
- ")"
5491
- ] }),
5492
- /* @__PURE__ */ jsx6("ul", { className: "search-references__list", children: sources.map((source) => {
5493
- const content = /* @__PURE__ */ jsxs6(Fragment2, { children: [
5494
- /* @__PURE__ */ jsx6("span", { className: "search-references__icon", children: /* @__PURE__ */ jsx6(SiteIcon, {}) }),
5495
- /* @__PURE__ */ jsxs6("span", { className: "search-references__copy", children: [
5496
- /* @__PURE__ */ jsx6(
5497
- "span",
5498
- {
5499
- className: "search-references__title",
5500
- title: source.title,
5501
- children: source.title
5502
- }
5503
- ),
5504
- source.url ? /* @__PURE__ */ jsx6("span", { className: "search-references__domain", children: new URL(source.url).hostname.replace(/^www\./u, "") }) : null
5505
- ] })
5506
- ] });
5507
- return /* @__PURE__ */ jsx6("li", { children: source.url ? /* @__PURE__ */ jsx6(
5508
- "a",
5509
- {
5510
- className: "search-references__source",
5511
- href: source.url,
5512
- target: "_blank",
5513
- rel: "noopener noreferrer",
5514
- children: content
5515
- }
5516
- ) : /* @__PURE__ */ jsx6("div", { className: "search-references__source", children: content }) }, source.key);
5517
- }) })
5518
- ] }) : null,
5519
- actions.length > 0 ? /* @__PURE__ */ jsx6("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ jsx6(
5520
- "a",
5521
- {
5522
- className: "search-references__cta",
5523
- href: action.url,
5524
- target: "_blank",
5525
- rel: "noopener noreferrer",
5526
- children: action.label
5527
- },
5528
- action.url
5529
- )) }) : null
5530
- ] });
5531
- }
5694
+ import { useEffect as useEffect7, useState as useState9 } from "react";
5532
5695
 
5533
5696
  // src/react/components/BookingCard/BookingCard.tsx
5534
5697
  import {
5535
5698
  useEffect as useEffect6,
5536
- useId as useId2,
5699
+ useId as useId4,
5537
5700
  useMemo as useMemo2,
5538
5701
  useRef as useRef6,
5539
- useState as useState6
5702
+ useState as useState8
5540
5703
  } from "react";
5541
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
5704
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
5542
5705
  var BOOKING_STEPS = [
5543
5706
  { id: "date", label: "Date" },
5544
5707
  { id: "time", label: "Time" },
@@ -5569,22 +5732,22 @@ function calendarCells(year, month) {
5569
5732
  return cells;
5570
5733
  }
5571
5734
  function BookingCardLoader() {
5572
- return /* @__PURE__ */ jsx7("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ jsx7("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
5735
+ return /* @__PURE__ */ jsx8("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ jsx8("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
5573
5736
  }
5574
5737
  function BookingCard(props) {
5575
- if (!props.readOnly) return /* @__PURE__ */ jsx7(InteractiveBookingCard, { ...props });
5576
- return /* @__PURE__ */ jsxs7("section", { className: "booking-card", "aria-label": "Recorded available times", children: [
5577
- /* @__PURE__ */ jsx7("p", { className: "booking-card__title", children: "Available times offered" }),
5578
- props.offer.slots.length ? /* @__PURE__ */ jsx7("ul", { children: props.offer.slots.map((slot, index) => {
5738
+ if (!props.readOnly) return /* @__PURE__ */ jsx8(InteractiveBookingCard, { ...props });
5739
+ return /* @__PURE__ */ jsxs8("section", { className: "booking-card", "aria-label": "Recorded available times", children: [
5740
+ /* @__PURE__ */ jsx8("p", { className: "booking-card__title", children: "Available times offered" }),
5741
+ props.offer.slots.length ? /* @__PURE__ */ jsx8("ul", { children: props.offer.slots.map((slot, index) => {
5579
5742
  const eventType = props.offer.eventTypes.find(
5580
5743
  (item) => item.uri === slot.eventTypeUri
5581
5744
  );
5582
5745
  const label = Number.isFinite(Date.parse(slot.startTime)) ? formatSlotLabel(slot.startTime) : "Time unavailable";
5583
- return /* @__PURE__ */ jsxs7("li", { children: [
5746
+ return /* @__PURE__ */ jsxs8("li", { children: [
5584
5747
  eventType ? `${eventType.name} \xB7 ` : "",
5585
5748
  label
5586
5749
  ] }, `${slot.eventTypeUri ?? ""}:${slot.startTime}:${index}`);
5587
- }) }) : /* @__PURE__ */ jsx7("p", { children: "No available times were recorded." })
5750
+ }) }) : /* @__PURE__ */ jsx8("p", { children: "No available times were recorded." })
5588
5751
  ] });
5589
5752
  }
5590
5753
  function InteractiveBookingCard({
@@ -5592,14 +5755,14 @@ function InteractiveBookingCard({
5592
5755
  offer,
5593
5756
  onBook
5594
5757
  }) {
5595
- const fieldId = useId2();
5758
+ const fieldId = useId4();
5596
5759
  const defaultType = offer.eventTypes[0]?.uri ?? offer.slots[0]?.eventTypeUri ?? "";
5597
- const [step, setStep] = useState6("date");
5598
- const [eventTypeUri, setEventTypeUri] = useState6(defaultType);
5599
- const [selectedDate, setSelectedDate] = useState6("");
5600
- const [startTime, setStartTime] = useState6("");
5601
- const [name, setName] = useState6("");
5602
- const [email, setEmail] = useState6("");
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("");
5603
5766
  const activeStepRef = useRef6(null);
5604
5767
  const previousStepRef = useRef6(step);
5605
5768
  const stepIndex = BOOKING_STEPS.findIndex((item) => item.id === step);
@@ -5620,7 +5783,7 @@ function InteractiveBookingCard({
5620
5783
  }
5621
5784
  return next;
5622
5785
  }, [slots]);
5623
- const [visibleMonth, setVisibleMonth] = useState6(
5786
+ const [visibleMonth, setVisibleMonth] = useState8(
5624
5787
  () => firstAvailableBookingMonth(slots)
5625
5788
  );
5626
5789
  function selectEventType(nextType) {
@@ -5684,14 +5847,14 @@ function InteractiveBookingCard({
5684
5847
  })
5685
5848
  });
5686
5849
  }
5687
- return /* @__PURE__ */ jsx7(
5850
+ return /* @__PURE__ */ jsx8(
5688
5851
  "section",
5689
5852
  {
5690
5853
  className: "booking-card",
5691
5854
  "aria-busy": disabled || void 0,
5692
5855
  "aria-label": "Book a meeting",
5693
- children: /* @__PURE__ */ jsxs7("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
5694
- /* @__PURE__ */ jsx7("ol", { className: "booking-card__steps", "aria-label": "Booking steps", children: BOOKING_STEPS.map((item, index) => /* @__PURE__ */ jsxs7(
5856
+ children: /* @__PURE__ */ jsxs8("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
5857
+ /* @__PURE__ */ jsx8("ol", { className: "booking-card__steps", "aria-label": "Booking steps", children: BOOKING_STEPS.map((item, index) => /* @__PURE__ */ jsxs8(
5695
5858
  "li",
5696
5859
  {
5697
5860
  className: [
@@ -5701,40 +5864,40 @@ function InteractiveBookingCard({
5701
5864
  ].filter(Boolean).join(" "),
5702
5865
  "aria-current": index === stepIndex ? "step" : void 0,
5703
5866
  children: [
5704
- /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", children: index + 1 }),
5705
- /* @__PURE__ */ jsx7("span", { children: item.label })
5867
+ /* @__PURE__ */ jsx8("span", { "aria-hidden": "true", children: index + 1 }),
5868
+ /* @__PURE__ */ jsx8("span", { children: item.label })
5706
5869
  ]
5707
5870
  },
5708
5871
  item.id
5709
5872
  )) }),
5710
- step === "date" ? /* @__PURE__ */ jsxs7("div", { className: "booking-card__step", ref: activeStepRef, children: [
5711
- /* @__PURE__ */ jsx7("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
5712
- timeZone ? /* @__PURE__ */ jsxs7("p", { className: "booking-card__tz", children: [
5873
+ step === "date" ? /* @__PURE__ */ jsxs8("div", { className: "booking-card__step", ref: activeStepRef, children: [
5874
+ /* @__PURE__ */ jsx8("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
5875
+ timeZone ? /* @__PURE__ */ jsxs8("p", { className: "booking-card__tz", children: [
5713
5876
  "Times in ",
5714
5877
  timeZone
5715
5878
  ] }) : null,
5716
- offer.eventTypes.length > 1 ? /* @__PURE__ */ jsxs7(
5879
+ offer.eventTypes.length > 1 ? /* @__PURE__ */ jsxs8(
5717
5880
  "label",
5718
5881
  {
5719
5882
  className: "booking-card__field",
5720
5883
  htmlFor: `${fieldId}-type`,
5721
5884
  children: [
5722
- /* @__PURE__ */ jsx7("span", { children: "Meeting" }),
5723
- /* @__PURE__ */ jsx7(
5885
+ /* @__PURE__ */ jsx8("span", { children: "Meeting" }),
5886
+ /* @__PURE__ */ jsx8(
5724
5887
  "select",
5725
5888
  {
5726
5889
  id: `${fieldId}-type`,
5727
5890
  value: eventTypeUri,
5728
5891
  disabled,
5729
5892
  onChange: (event) => selectEventType(event.target.value),
5730
- children: offer.eventTypes.map((item) => /* @__PURE__ */ jsx7("option", { value: item.uri, children: item.name }, item.uri))
5893
+ children: offer.eventTypes.map((item) => /* @__PURE__ */ jsx8("option", { value: item.uri, children: item.name }, item.uri))
5731
5894
  }
5732
5895
  )
5733
5896
  ]
5734
5897
  }
5735
5898
  ) : null,
5736
- /* @__PURE__ */ jsxs7("div", { className: "booking-card__month", children: [
5737
- /* @__PURE__ */ jsx7(
5899
+ /* @__PURE__ */ jsxs8("div", { className: "booking-card__month", children: [
5900
+ /* @__PURE__ */ jsx8(
5738
5901
  "button",
5739
5902
  {
5740
5903
  type: "button",
@@ -5745,8 +5908,8 @@ function InteractiveBookingCard({
5745
5908
  children: "\u2039"
5746
5909
  }
5747
5910
  ),
5748
- /* @__PURE__ */ jsx7("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
5749
- /* @__PURE__ */ jsx7(
5911
+ /* @__PURE__ */ jsx8("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
5912
+ /* @__PURE__ */ jsx8(
5750
5913
  "button",
5751
5914
  {
5752
5915
  type: "button",
@@ -5758,9 +5921,9 @@ function InteractiveBookingCard({
5758
5921
  }
5759
5922
  )
5760
5923
  ] }),
5761
- /* @__PURE__ */ jsx7("div", { className: "booking-card__weekdays", children: weekdays.map((label) => /* @__PURE__ */ jsx7("span", { children: label }, label)) }),
5762
- offer.slots.length === 0 ? /* @__PURE__ */ jsx7("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
5763
- /* @__PURE__ */ jsx7(
5924
+ /* @__PURE__ */ jsx8("div", { className: "booking-card__weekdays", children: weekdays.map((label) => /* @__PURE__ */ jsx8("span", { children: label }, label)) }),
5925
+ offer.slots.length === 0 ? /* @__PURE__ */ jsx8("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
5926
+ /* @__PURE__ */ jsx8(
5764
5927
  "div",
5765
5928
  {
5766
5929
  className: "booking-card__calendar",
@@ -5768,7 +5931,7 @@ function InteractiveBookingCard({
5768
5931
  "aria-label": "Available dates",
5769
5932
  children: cells.map((cell, index) => {
5770
5933
  if (!cell) {
5771
- return /* @__PURE__ */ jsx7(
5934
+ return /* @__PURE__ */ jsx8(
5772
5935
  "span",
5773
5936
  {
5774
5937
  className: "booking-card__day"
@@ -5778,7 +5941,7 @@ function InteractiveBookingCard({
5778
5941
  }
5779
5942
  const available = availableByDate.has(cell.key);
5780
5943
  const selected = cell.key === selectedDate;
5781
- return /* @__PURE__ */ jsx7(
5944
+ return /* @__PURE__ */ jsx8(
5782
5945
  "button",
5783
5946
  {
5784
5947
  type: "button",
@@ -5798,9 +5961,9 @@ function InteractiveBookingCard({
5798
5961
  }
5799
5962
  )
5800
5963
  ] }, "date") : null,
5801
- step === "time" ? /* @__PURE__ */ jsxs7("div", { className: "booking-card__step", ref: activeStepRef, children: [
5802
- /* @__PURE__ */ jsxs7("div", { className: "booking-card__step-bar", children: [
5803
- /* @__PURE__ */ jsx7(
5964
+ step === "time" ? /* @__PURE__ */ jsxs8("div", { className: "booking-card__step", ref: activeStepRef, children: [
5965
+ /* @__PURE__ */ jsxs8("div", { className: "booking-card__step-bar", children: [
5966
+ /* @__PURE__ */ jsx8(
5804
5967
  "button",
5805
5968
  {
5806
5969
  type: "button",
@@ -5811,15 +5974,15 @@ function InteractiveBookingCard({
5811
5974
  children: "\u2039"
5812
5975
  }
5813
5976
  ),
5814
- /* @__PURE__ */ jsxs7("div", { children: [
5815
- /* @__PURE__ */ jsx7("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
5816
- timeZone ? /* @__PURE__ */ jsxs7("p", { className: "booking-card__tz", children: [
5977
+ /* @__PURE__ */ jsxs8("div", { children: [
5978
+ /* @__PURE__ */ jsx8("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
5979
+ timeZone ? /* @__PURE__ */ jsxs8("p", { className: "booking-card__tz", children: [
5817
5980
  "Times in ",
5818
5981
  timeZone
5819
5982
  ] }) : null
5820
5983
  ] })
5821
5984
  ] }),
5822
- /* @__PURE__ */ jsx7("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ jsx7(
5985
+ /* @__PURE__ */ jsx8("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ jsx8(
5823
5986
  "button",
5824
5987
  {
5825
5988
  type: "button",
@@ -5831,9 +5994,9 @@ function InteractiveBookingCard({
5831
5994
  slot.startTime
5832
5995
  )) })
5833
5996
  ] }, "time") : null,
5834
- step === "details" ? /* @__PURE__ */ jsxs7("div", { className: "booking-card__step", ref: activeStepRef, children: [
5835
- /* @__PURE__ */ jsxs7("div", { className: "booking-card__step-bar", children: [
5836
- /* @__PURE__ */ jsx7(
5997
+ step === "details" ? /* @__PURE__ */ jsxs8("div", { className: "booking-card__step", ref: activeStepRef, children: [
5998
+ /* @__PURE__ */ jsxs8("div", { className: "booking-card__step-bar", children: [
5999
+ /* @__PURE__ */ jsx8(
5837
6000
  "button",
5838
6001
  {
5839
6002
  type: "button",
@@ -5844,21 +6007,21 @@ function InteractiveBookingCard({
5844
6007
  children: "\u2039"
5845
6008
  }
5846
6009
  ),
5847
- /* @__PURE__ */ jsxs7("div", { children: [
5848
- /* @__PURE__ */ jsx7("p", { className: "booking-card__title", children: "Enter details" }),
5849
- /* @__PURE__ */ jsx7("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
5850
- selectedType?.location ? /* @__PURE__ */ jsx7("p", { className: "booking-card__tz", children: selectedType.location }) : null
6010
+ /* @__PURE__ */ jsxs8("div", { children: [
6011
+ /* @__PURE__ */ jsx8("p", { className: "booking-card__title", children: "Enter details" }),
6012
+ /* @__PURE__ */ jsx8("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
6013
+ selectedType?.location ? /* @__PURE__ */ jsx8("p", { className: "booking-card__tz", children: selectedType.location }) : null
5851
6014
  ] })
5852
6015
  ] }),
5853
- /* @__PURE__ */ jsxs7("div", { className: "booking-card__identity", children: [
5854
- /* @__PURE__ */ jsxs7(
6016
+ /* @__PURE__ */ jsxs8("div", { className: "booking-card__identity", children: [
6017
+ /* @__PURE__ */ jsxs8(
5855
6018
  "label",
5856
6019
  {
5857
6020
  className: "booking-card__field",
5858
6021
  htmlFor: `${fieldId}-name`,
5859
6022
  children: [
5860
- /* @__PURE__ */ jsx7("span", { children: "Name" }),
5861
- /* @__PURE__ */ jsx7(
6023
+ /* @__PURE__ */ jsx8("span", { children: "Name" }),
6024
+ /* @__PURE__ */ jsx8(
5862
6025
  "input",
5863
6026
  {
5864
6027
  id: `${fieldId}-name`,
@@ -5872,14 +6035,14 @@ function InteractiveBookingCard({
5872
6035
  ]
5873
6036
  }
5874
6037
  ),
5875
- /* @__PURE__ */ jsxs7(
6038
+ /* @__PURE__ */ jsxs8(
5876
6039
  "label",
5877
6040
  {
5878
6041
  className: "booking-card__field",
5879
6042
  htmlFor: `${fieldId}-email`,
5880
6043
  children: [
5881
- /* @__PURE__ */ jsx7("span", { children: "Email" }),
5882
- /* @__PURE__ */ jsx7(
6044
+ /* @__PURE__ */ jsx8("span", { children: "Email" }),
6045
+ /* @__PURE__ */ jsx8(
5883
6046
  "input",
5884
6047
  {
5885
6048
  id: `${fieldId}-email`,
@@ -5895,7 +6058,7 @@ function InteractiveBookingCard({
5895
6058
  }
5896
6059
  )
5897
6060
  ] }),
5898
- /* @__PURE__ */ jsx7(
6061
+ /* @__PURE__ */ jsx8(
5899
6062
  "button",
5900
6063
  {
5901
6064
  type: "submit",
@@ -5913,6 +6076,37 @@ function InteractiveBookingCard({
5913
6076
  // src/react/components/MessageBubble/MessageBubble.tsx
5914
6077
  import { Streamdown, defaultUrlTransform } from "streamdown";
5915
6078
 
6079
+ // src/react/lib/brand-logo-display.ts
6080
+ var BRAND_LOGO_LAYOUT = {
6081
+ header: { maxHeight: 20, maxWidth: 96, square: 24 },
6082
+ message: { maxHeight: 18, maxWidth: 80, square: 22 },
6083
+ /** Bottom/mobile launcher pill orb — keep in sync with AssistEdgeTab chip CSS. */
6084
+ launcher: { maxHeight: 24, maxWidth: 104, square: 38 }
6085
+ };
6086
+ function isWideBrandLogo(naturalWidth, naturalHeight) {
6087
+ return naturalWidth > naturalHeight * 1.4;
6088
+ }
6089
+ function snapBrandLogoDisplaySize(input) {
6090
+ const { maxHeight, maxWidth } = BRAND_LOGO_LAYOUT[input.surface];
6091
+ const { naturalWidth, naturalHeight } = input;
6092
+ if (naturalWidth <= 0 || naturalHeight <= 0) {
6093
+ return { width: maxWidth, height: maxHeight, wide: false };
6094
+ }
6095
+ const wide = isWideBrandLogo(naturalWidth, naturalHeight);
6096
+ if (!wide) {
6097
+ const size = BRAND_LOGO_LAYOUT[input.surface].square;
6098
+ return { width: size, height: size, wide: false };
6099
+ }
6100
+ const scale = Math.min(
6101
+ maxHeight / naturalHeight,
6102
+ maxWidth / naturalWidth,
6103
+ 1
6104
+ );
6105
+ const height = Math.max(1, Math.round(naturalHeight * scale));
6106
+ const width = Math.max(1, Math.round(naturalWidth * scale));
6107
+ return { width, height, wide: true };
6108
+ }
6109
+
5916
6110
  // src/react/lib/resolve-message-url.ts
5917
6111
  function resolveMessageUrl(safeUrl, baseUrl) {
5918
6112
  if (!safeUrl || !baseUrl) return safeUrl;
@@ -5927,7 +6121,7 @@ function resolveMessageUrl(safeUrl, baseUrl) {
5927
6121
 
5928
6122
  // src/react/components/MessageBubble/MessageBubble.tsx
5929
6123
  import "streamdown/styles.css";
5930
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
6124
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
5931
6125
  function normalizeDedupeText(text3) {
5932
6126
  return text3.trim().replace(/\s+/g, " ").toLowerCase();
5933
6127
  }
@@ -5968,13 +6162,21 @@ function MessageBubble({
5968
6162
  brandLogoUrl,
5969
6163
  bookingDisabled = false,
5970
6164
  showProvenance = false,
6165
+ showSearchReferences = true,
5971
6166
  bookingReadOnly = false,
5972
6167
  linkBaseUrl,
5973
6168
  offer,
5974
6169
  onBook
5975
6170
  }) {
5976
6171
  const resolvedLogoUrl = brandLogoUrl?.trim();
5977
- const [failedLogoUrl, setFailedLogoUrl] = useState7(null);
6172
+ const [failedLogoUrl, setFailedLogoUrl] = useState9(null);
6173
+ const [logoDisplay, setLogoDisplay] = useState9(null);
6174
+ useEffect7(() => {
6175
+ setFailedLogoUrl(null);
6176
+ }, [resolvedLogoUrl]);
6177
+ const activeLogoDisplay = logoDisplay?.url === resolvedLogoUrl ? logoDisplay : null;
6178
+ const wideLogo = activeLogoDisplay?.wide ?? false;
6179
+ const logoDisplaySize = activeLogoDisplay ? { height: activeLogoDisplay.height, width: activeLogoDisplay.width } : null;
5978
6180
  const showBrandLogo = Boolean(resolvedLogoUrl) && failedLogoUrl !== resolvedLogoUrl;
5979
6181
  const cards = message.role === "agent" ? extractToolCards(message.text) : [];
5980
6182
  const extractedOffers = cards.filter(
@@ -5989,38 +6191,38 @@ function MessageBubble({
5989
6191
  if (message.role === "visitor") {
5990
6192
  const visitorText = visitorMessageDisplayText(message).trim();
5991
6193
  if (!visitorText) return null;
5992
- return /* @__PURE__ */ jsxs8(
6194
+ return /* @__PURE__ */ jsxs9(
5993
6195
  "article",
5994
6196
  {
5995
6197
  className: "message-bubble message-bubble--visitor",
5996
6198
  "aria-label": "Message from visitor",
5997
6199
  children: [
5998
- showProvenance ? /* @__PURE__ */ jsx8("span", { className: "message-bubble__speaker", children: "You \xB7 Visitor" }) : null,
5999
- /* @__PURE__ */ jsx8("p", { className: "message-bubble__text", children: visitorText })
6200
+ showProvenance ? /* @__PURE__ */ jsx9("span", { className: "message-bubble__speaker", children: "You" }) : null,
6201
+ /* @__PURE__ */ jsx9("p", { className: "message-bubble__text", children: visitorText })
6000
6202
  ]
6001
6203
  }
6002
6204
  );
6003
6205
  }
6004
6206
  if (message.role === "human") {
6005
- return /* @__PURE__ */ jsxs8(
6207
+ return /* @__PURE__ */ jsxs9(
6006
6208
  "article",
6007
6209
  {
6008
6210
  className: "message-bubble message-bubble--human",
6009
6211
  "aria-label": `Message from ${message.representative.name}`,
6010
6212
  children: [
6011
- /* @__PURE__ */ jsxs8("strong", { className: "message-bubble__representative", children: [
6213
+ /* @__PURE__ */ jsxs9("strong", { className: "message-bubble__representative", children: [
6012
6214
  message.representative.name,
6013
6215
  " ",
6014
- /* @__PURE__ */ jsx8("span", { children: "Human representative" })
6216
+ /* @__PURE__ */ jsx9("span", { children: "Human representative" })
6015
6217
  ] }),
6016
- /* @__PURE__ */ jsx8("p", { className: "message-bubble__text", children: message.text })
6218
+ /* @__PURE__ */ jsx9("p", { className: "message-bubble__text", children: message.text })
6017
6219
  ]
6018
6220
  }
6019
6221
  );
6020
6222
  }
6021
6223
  const citations = message.citations ?? [];
6022
- const agentText = /* @__PURE__ */ jsxs8("div", { className: "message-bubble__text", children: [
6023
- /* @__PURE__ */ jsx8(
6224
+ const agentText = /* @__PURE__ */ jsxs9("div", { className: "message-bubble__text", children: [
6225
+ /* @__PURE__ */ jsx9(
6024
6226
  Streamdown,
6025
6227
  {
6026
6228
  animated: false,
@@ -6038,9 +6240,9 @@ function MessageBubble({
6038
6240
  children: displayText
6039
6241
  }
6040
6242
  ),
6041
- !isStreaming ? /* @__PURE__ */ jsx8(SearchReferences, { results: message.searchResults ?? [] }) : null,
6042
- !isStreaming && citations.length > 0 ? /* @__PURE__ */ jsx8("ul", { className: "message-bubble__sources", "aria-label": "Sources", children: citations.map((citation) => /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs8("a", { href: citation.url, target: "_blank", rel: "noreferrer", children: [
6043
- /* @__PURE__ */ jsx8(
6243
+ !isStreaming && showSearchReferences ? /* @__PURE__ */ jsx9(SearchReferences, { results: message.searchResults ?? [] }) : null,
6244
+ !isStreaming && citations.length > 0 ? /* @__PURE__ */ jsx9("ul", { className: "message-bubble__sources", "aria-label": "Sources", children: citations.map((citation) => /* @__PURE__ */ jsx9("li", { children: /* @__PURE__ */ jsxs9("a", { href: citation.url, target: "_blank", rel: "noreferrer", children: [
6245
+ /* @__PURE__ */ jsx9(
6044
6246
  "span",
6045
6247
  {
6046
6248
  className: "message-bubble__source-icon",
@@ -6048,32 +6250,63 @@ function MessageBubble({
6048
6250
  children: "\u25A6"
6049
6251
  }
6050
6252
  ),
6051
- /* @__PURE__ */ jsx8("span", { children: citation.label })
6253
+ /* @__PURE__ */ jsx9("span", { children: citation.label })
6052
6254
  ] }) }, citation.id)) }) : null
6053
6255
  ] });
6054
6256
  if (!displayText && !message.searchResults?.length && offers.length === 0)
6055
6257
  return null;
6056
- return /* @__PURE__ */ jsxs8(
6258
+ return /* @__PURE__ */ jsxs9(
6057
6259
  "article",
6058
6260
  {
6059
6261
  className: "message-bubble message-bubble--agent",
6060
6262
  "aria-label": "Message from AI assistant",
6061
6263
  children: [
6062
- showProvenance ? /* @__PURE__ */ jsx8("span", { className: "message-bubble__speaker", children: "AI assistant" }) : null,
6063
- displayText || message.searchResults?.length ? showBrandLogo ? /* @__PURE__ */ jsxs8("div", { className: "message-bubble__agent-row", children: [
6064
- /* @__PURE__ */ jsx8("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ jsx8(
6065
- "img",
6066
- {
6067
- src: resolvedLogoUrl,
6068
- alt: "",
6069
- onError: () => {
6070
- setFailedLogoUrl(resolvedLogoUrl ?? null);
6264
+ displayText || message.searchResults?.length ? /* @__PURE__ */ jsxs9("div", { className: "message-bubble__agent-stack", children: [
6265
+ showProvenance || showBrandLogo ? /* @__PURE__ */ jsxs9("div", { className: "message-bubble__agent-header", children: [
6266
+ showBrandLogo ? /* @__PURE__ */ jsx9(
6267
+ "span",
6268
+ {
6269
+ className: `message-bubble__agent-avatar${wideLogo ? " message-bubble__agent-avatar--wide" : ""}`,
6270
+ "aria-hidden": "true",
6271
+ children: /* @__PURE__ */ jsx9(
6272
+ "img",
6273
+ {
6274
+ className: "as-brand-logo-img",
6275
+ src: resolvedLogoUrl,
6276
+ alt: "",
6277
+ decoding: "async",
6278
+ ...logoDisplaySize ? {
6279
+ height: logoDisplaySize.height,
6280
+ width: logoDisplaySize.width
6281
+ } : {},
6282
+ onLoad: (event) => {
6283
+ const img = event.currentTarget;
6284
+ const display = snapBrandLogoDisplaySize({
6285
+ naturalHeight: img.naturalHeight,
6286
+ naturalWidth: img.naturalWidth,
6287
+ surface: "message"
6288
+ });
6289
+ if (!resolvedLogoUrl) return;
6290
+ setLogoDisplay({
6291
+ height: display.height,
6292
+ url: resolvedLogoUrl,
6293
+ wide: display.wide,
6294
+ width: display.width
6295
+ });
6296
+ },
6297
+ onError: () => {
6298
+ setFailedLogoUrl(resolvedLogoUrl ?? null);
6299
+ }
6300
+ },
6301
+ resolvedLogoUrl
6302
+ )
6071
6303
  }
6072
- }
6073
- ) }),
6304
+ ) : null,
6305
+ showProvenance ? /* @__PURE__ */ jsx9("span", { className: "message-bubble__speaker", children: "AI assistant" }) : null
6306
+ ] }) : null,
6074
6307
  agentText
6075
- ] }) : agentText : null,
6076
- offers.map((nextOffer, index) => /* @__PURE__ */ jsx8(
6308
+ ] }) : null,
6309
+ offers.map((nextOffer, index) => /* @__PURE__ */ jsx9(
6077
6310
  BookingCard,
6078
6311
  {
6079
6312
  disabled: bookingDisabled,
@@ -6089,10 +6322,10 @@ function MessageBubble({
6089
6322
  }
6090
6323
 
6091
6324
  // src/react/components/HumanInputCard/HumanInputCard.tsx
6092
- import { useState as useState9 } from "react";
6325
+ import { useState as useState11 } from "react";
6093
6326
 
6094
6327
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
6095
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
6328
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
6096
6329
  function ConfirmationCard({
6097
6330
  disabled = false,
6098
6331
  request,
@@ -6101,17 +6334,17 @@ function ConfirmationCard({
6101
6334
  const options = request.options ?? [];
6102
6335
  const heading = request.kind === "tool-approval" ? "Confirm this action" : request.prompt;
6103
6336
  const prompt = request.kind === "tool-approval" ? request.prompt : void 0;
6104
- return /* @__PURE__ */ jsxs9(
6337
+ return /* @__PURE__ */ jsxs10(
6105
6338
  "section",
6106
6339
  {
6107
6340
  className: "confirmation-card",
6108
6341
  "aria-labelledby": `confirmation-${request.requestId}`,
6109
6342
  children: [
6110
- /* @__PURE__ */ jsxs9("div", { className: "confirmation-card__heading", children: [
6111
- /* @__PURE__ */ jsx9("strong", { id: `confirmation-${request.requestId}`, children: heading }),
6112
- prompt ? /* @__PURE__ */ jsx9("p", { children: prompt }) : null
6343
+ /* @__PURE__ */ jsxs10("div", { className: "confirmation-card__heading", children: [
6344
+ /* @__PURE__ */ jsx10("strong", { id: `confirmation-${request.requestId}`, children: heading }),
6345
+ prompt ? /* @__PURE__ */ jsx10("p", { children: prompt }) : null
6113
6346
  ] }),
6114
- /* @__PURE__ */ jsx9("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ jsx9(
6347
+ /* @__PURE__ */ jsx10("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ jsx10(
6115
6348
  "button",
6116
6349
  {
6117
6350
  type: "button",
@@ -6131,8 +6364,8 @@ function ConfirmationCard({
6131
6364
  }
6132
6365
 
6133
6366
  // src/react/components/ToolInputCard/ToolInputCard.tsx
6134
- import { useState as useState8 } from "react";
6135
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
6367
+ import { useState as useState10 } from "react";
6368
+ import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
6136
6369
  function isRecord5(value) {
6137
6370
  return value !== null && typeof value === "object" && !Array.isArray(value);
6138
6371
  }
@@ -6256,7 +6489,7 @@ function FieldDescription({
6256
6489
  field,
6257
6490
  id: id2
6258
6491
  }) {
6259
- return field.description ? /* @__PURE__ */ jsx10("span", { id: id2, className: "tool-input-card__description", children: field.description }) : null;
6492
+ return field.description ? /* @__PURE__ */ jsx11("span", { id: id2, className: "tool-input-card__description", children: field.description }) : null;
6260
6493
  }
6261
6494
  function ChoiceField({
6262
6495
  field,
@@ -6275,7 +6508,7 @@ function ChoiceField({
6275
6508
  const selectedIndex = options.findIndex(
6276
6509
  (option) => valuesMatch(option.value, value)
6277
6510
  );
6278
- return /* @__PURE__ */ jsxs10(
6511
+ return /* @__PURE__ */ jsxs11(
6279
6512
  "select",
6280
6513
  {
6281
6514
  id: id2,
@@ -6290,13 +6523,13 @@ function ChoiceField({
6290
6523
  if (option) onChange(option.value);
6291
6524
  },
6292
6525
  children: [
6293
- /* @__PURE__ */ jsx10("option", { value: "", disabled: field.required, children: "Choose an option" }),
6294
- options.map((option, index) => /* @__PURE__ */ jsx10("option", { value: index, children: option.label }, optionKey(option)))
6526
+ /* @__PURE__ */ jsx11("option", { value: "", disabled: field.required, children: "Choose an option" }),
6527
+ options.map((option, index) => /* @__PURE__ */ jsx11("option", { value: index, children: option.label }, optionKey(option)))
6295
6528
  ]
6296
6529
  }
6297
6530
  );
6298
6531
  }
6299
- return /* @__PURE__ */ jsx10(
6532
+ return /* @__PURE__ */ jsx11(
6300
6533
  "div",
6301
6534
  {
6302
6535
  className: "tool-input-card__choices",
@@ -6307,8 +6540,8 @@ function ChoiceField({
6307
6540
  "aria-required": field.required,
6308
6541
  children: options.map((option, index) => {
6309
6542
  const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
6310
- return /* @__PURE__ */ jsxs10("label", { className: "tool-input-card__choice", children: [
6311
- /* @__PURE__ */ jsx10(
6543
+ return /* @__PURE__ */ jsxs11("label", { className: "tool-input-card__choice", children: [
6544
+ /* @__PURE__ */ jsx11(
6312
6545
  "input",
6313
6546
  {
6314
6547
  type: multiple ? "checkbox" : "radio",
@@ -6330,7 +6563,7 @@ function ChoiceField({
6330
6563
  }
6331
6564
  }
6332
6565
  ),
6333
- /* @__PURE__ */ jsx10("span", { children: option.label })
6566
+ /* @__PURE__ */ jsx11("span", { children: option.label })
6334
6567
  ] }, optionKey(option));
6335
6568
  })
6336
6569
  }
@@ -6350,9 +6583,9 @@ function ToolField({
6350
6583
  error ? `${id2}-error` : ""
6351
6584
  ].filter(Boolean).join(" ");
6352
6585
  if (field.kind === "checkbox" || field.kind === "confirmation") {
6353
- return /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__field", children: [
6354
- /* @__PURE__ */ jsxs10("label", { className: "tool-input-card__check", htmlFor: id2, children: [
6355
- /* @__PURE__ */ jsx10(
6586
+ return /* @__PURE__ */ jsxs11("div", { className: "tool-input-card__field", children: [
6587
+ /* @__PURE__ */ jsxs11("label", { className: "tool-input-card__check", htmlFor: id2, children: [
6588
+ /* @__PURE__ */ jsx11(
6356
6589
  "input",
6357
6590
  {
6358
6591
  id: id2,
@@ -6365,17 +6598,17 @@ function ToolField({
6365
6598
  onChange: (event) => onChange(event.target.checked)
6366
6599
  }
6367
6600
  ),
6368
- /* @__PURE__ */ jsxs10("span", { children: [
6369
- /* @__PURE__ */ jsx10("strong", { children: field.label }),
6370
- field.description ? /* @__PURE__ */ jsx10("span", { id: `${id2}-description`, children: field.description }) : null
6601
+ /* @__PURE__ */ jsxs11("span", { children: [
6602
+ /* @__PURE__ */ jsx11("strong", { children: field.label }),
6603
+ field.description ? /* @__PURE__ */ jsx11("span", { id: `${id2}-description`, children: field.description }) : null
6371
6604
  ] })
6372
6605
  ] }),
6373
- error ? /* @__PURE__ */ jsx10("span", { id: `${id2}-error`, className: "tool-input-card__error", children: error }) : null
6606
+ error ? /* @__PURE__ */ jsx11("span", { id: `${id2}-error`, className: "tool-input-card__error", children: error }) : null
6374
6607
  ] });
6375
6608
  }
6376
- const label = /* @__PURE__ */ jsxs10("label", { id: `${id2}-label`, htmlFor: id2, children: [
6609
+ const label = /* @__PURE__ */ jsxs11("label", { id: `${id2}-label`, htmlFor: id2, children: [
6377
6610
  field.label,
6378
- field.required ? /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: " *" }) : null
6611
+ field.required ? /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", children: " *" }) : null
6379
6612
  ] });
6380
6613
  const common = {
6381
6614
  id: id2,
@@ -6387,7 +6620,7 @@ function ToolField({
6387
6620
  };
6388
6621
  let control;
6389
6622
  if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
6390
- control = /* @__PURE__ */ jsx10(
6623
+ control = /* @__PURE__ */ jsx11(
6391
6624
  ChoiceField,
6392
6625
  {
6393
6626
  field,
@@ -6401,7 +6634,7 @@ function ToolField({
6401
6634
  }
6402
6635
  );
6403
6636
  } else if (field.kind === "textarea" || field.kind === "json") {
6404
- control = /* @__PURE__ */ jsx10(
6637
+ control = /* @__PURE__ */ jsx11(
6405
6638
  "textarea",
6406
6639
  {
6407
6640
  ...common,
@@ -6415,8 +6648,8 @@ function ToolField({
6415
6648
  );
6416
6649
  } else if (field.kind === "range") {
6417
6650
  const numericValue = typeof value === "number" ? value : field.min ?? 0;
6418
- control = /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__range", children: [
6419
- /* @__PURE__ */ jsx10(
6651
+ control = /* @__PURE__ */ jsxs11("div", { className: "tool-input-card__range", children: [
6652
+ /* @__PURE__ */ jsx11(
6420
6653
  "input",
6421
6654
  {
6422
6655
  ...common,
@@ -6428,11 +6661,11 @@ function ToolField({
6428
6661
  onChange: (event) => onChange(Number(event.target.value))
6429
6662
  }
6430
6663
  ),
6431
- /* @__PURE__ */ jsx10("output", { htmlFor: id2, children: numericValue })
6664
+ /* @__PURE__ */ jsx11("output", { htmlFor: id2, children: numericValue })
6432
6665
  ] });
6433
6666
  } else {
6434
6667
  const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
6435
- control = /* @__PURE__ */ jsx10(
6668
+ control = /* @__PURE__ */ jsx11(
6436
6669
  "input",
6437
6670
  {
6438
6671
  ...common,
@@ -6450,11 +6683,11 @@ function ToolField({
6450
6683
  }
6451
6684
  );
6452
6685
  }
6453
- return /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__field", children: [
6686
+ return /* @__PURE__ */ jsxs11("div", { className: "tool-input-card__field", children: [
6454
6687
  label,
6455
- /* @__PURE__ */ jsx10(FieldDescription, { field, id: `${id2}-description` }),
6688
+ /* @__PURE__ */ jsx11(FieldDescription, { field, id: `${id2}-description` }),
6456
6689
  control,
6457
- error ? /* @__PURE__ */ jsx10("span", { id: `${id2}-error`, className: "tool-input-card__error", children: error }) : null
6690
+ error ? /* @__PURE__ */ jsx11("span", { id: `${id2}-error`, className: "tool-input-card__error", children: error }) : null
6458
6691
  ] });
6459
6692
  }
6460
6693
  function ToolInputCard({
@@ -6462,11 +6695,11 @@ function ToolInputCard({
6462
6695
  surface,
6463
6696
  onSubmit
6464
6697
  }) {
6465
- const [values, setValues] = useState8(
6698
+ const [values, setValues] = useState10(
6466
6699
  () => initialValues(surface)
6467
6700
  );
6468
- const [touched, setTouched] = useState8(() => /* @__PURE__ */ new Set());
6469
- const [submitted, setSubmitted] = useState8(false);
6701
+ const [touched, setTouched] = useState10(() => /* @__PURE__ */ new Set());
6702
+ const [submitted, setSubmitted] = useState10(false);
6470
6703
  const errors = Object.fromEntries(
6471
6704
  surface.fields.map((field) => [
6472
6705
  field.path,
@@ -6491,14 +6724,14 @@ function ToolInputCard({
6491
6724
  onSubmit?.(surface, result);
6492
6725
  }
6493
6726
  if (submitted) {
6494
- return /* @__PURE__ */ jsxs10(
6727
+ return /* @__PURE__ */ jsxs11(
6495
6728
  "section",
6496
6729
  {
6497
6730
  className: "tool-input-card tool-input-card--submitted",
6498
6731
  role: "status",
6499
6732
  children: [
6500
- /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u2713" }),
6501
- /* @__PURE__ */ jsxs10("strong", { children: [
6733
+ /* @__PURE__ */ jsx11("span", { "aria-hidden": "true", children: "\u2713" }),
6734
+ /* @__PURE__ */ jsxs11("strong", { children: [
6502
6735
  surface.title,
6503
6736
  " submitted"
6504
6737
  ] })
@@ -6506,18 +6739,18 @@ function ToolInputCard({
6506
6739
  }
6507
6740
  );
6508
6741
  }
6509
- return /* @__PURE__ */ jsxs10(
6742
+ return /* @__PURE__ */ jsxs11(
6510
6743
  "section",
6511
6744
  {
6512
6745
  className: "tool-input-card",
6513
6746
  "aria-labelledby": `tool-input-${surface.id}`,
6514
6747
  children: [
6515
- /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__heading", children: [
6516
- /* @__PURE__ */ jsx10("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
6517
- surface.description ? /* @__PURE__ */ jsx10("p", { children: surface.description }) : null
6748
+ /* @__PURE__ */ jsxs11("div", { className: "tool-input-card__heading", children: [
6749
+ /* @__PURE__ */ jsx11("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
6750
+ surface.description ? /* @__PURE__ */ jsx11("p", { children: surface.description }) : null
6518
6751
  ] }),
6519
- /* @__PURE__ */ jsxs10("form", { noValidate: true, onSubmit: submit, children: [
6520
- /* @__PURE__ */ jsx10("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ jsx10(
6752
+ /* @__PURE__ */ jsxs11("form", { noValidate: true, onSubmit: submit, children: [
6753
+ /* @__PURE__ */ jsx11("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ jsx11(
6521
6754
  ToolField,
6522
6755
  {
6523
6756
  disabled,
@@ -6530,8 +6763,8 @@ function ToolInputCard({
6530
6763
  },
6531
6764
  field.path
6532
6765
  )) }),
6533
- /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__actions", children: [
6534
- surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ jsx10(
6766
+ /* @__PURE__ */ jsxs11("div", { className: "tool-input-card__actions", children: [
6767
+ surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ jsx11(
6535
6768
  "button",
6536
6769
  {
6537
6770
  type: "button",
@@ -6544,7 +6777,7 @@ function ToolInputCard({
6544
6777
  children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
6545
6778
  }
6546
6779
  ) : null,
6547
- /* @__PURE__ */ jsx10("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
6780
+ /* @__PURE__ */ jsx11("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
6548
6781
  ] })
6549
6782
  ] })
6550
6783
  ]
@@ -6553,17 +6786,17 @@ function ToolInputCard({
6553
6786
  }
6554
6787
 
6555
6788
  // src/react/components/HumanInputCard/HumanInputCard.tsx
6556
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
6789
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
6557
6790
  function HumanInputCard({
6558
6791
  disabled = false,
6559
6792
  request,
6560
6793
  onRespond
6561
6794
  }) {
6562
- const [text3, setText] = useState9("");
6795
+ const [text3, setText] = useState11("");
6563
6796
  const options = request.options ?? [];
6564
6797
  const showText = request.display === "text" || request.allowFreeform && options.length === 0;
6565
6798
  if (request.ui) {
6566
- return /* @__PURE__ */ jsx11(
6799
+ return /* @__PURE__ */ jsx12(
6567
6800
  ToolInputCard,
6568
6801
  {
6569
6802
  disabled,
@@ -6573,7 +6806,7 @@ function HumanInputCard({
6573
6806
  );
6574
6807
  }
6575
6808
  if (options.length > 0) {
6576
- return /* @__PURE__ */ jsx11(
6809
+ return /* @__PURE__ */ jsx12(
6577
6810
  ConfirmationCard,
6578
6811
  {
6579
6812
  disabled,
@@ -6588,17 +6821,17 @@ function HumanInputCard({
6588
6821
  if (!value || disabled) return;
6589
6822
  onRespond?.({ requestId: request.requestId, text: value });
6590
6823
  }
6591
- return /* @__PURE__ */ jsxs11(
6824
+ return /* @__PURE__ */ jsxs12(
6592
6825
  "section",
6593
6826
  {
6594
6827
  className: "human-input-card",
6595
6828
  "aria-labelledby": `human-input-${request.requestId}`,
6596
6829
  children: [
6597
- /* @__PURE__ */ jsx11("div", { className: "human-input-card__heading", children: /* @__PURE__ */ jsx11("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
6598
- showText ? /* @__PURE__ */ jsxs11("form", { onSubmit: submitText, children: [
6599
- /* @__PURE__ */ jsx11("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
6600
- /* @__PURE__ */ jsxs11("div", { children: [
6601
- /* @__PURE__ */ jsx11(
6830
+ /* @__PURE__ */ jsx12("div", { className: "human-input-card__heading", children: /* @__PURE__ */ jsx12("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
6831
+ showText ? /* @__PURE__ */ jsxs12("form", { onSubmit: submitText, children: [
6832
+ /* @__PURE__ */ jsx12("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
6833
+ /* @__PURE__ */ jsxs12("div", { children: [
6834
+ /* @__PURE__ */ jsx12(
6602
6835
  "input",
6603
6836
  {
6604
6837
  id: `human-input-text-${request.requestId}`,
@@ -6607,17 +6840,17 @@ function HumanInputCard({
6607
6840
  onChange: (event) => setText(event.target.value)
6608
6841
  }
6609
6842
  ),
6610
- /* @__PURE__ */ jsx11("button", { type: "submit", disabled: disabled || !text3.trim(), children: "Send" })
6843
+ /* @__PURE__ */ jsx12("button", { type: "submit", disabled: disabled || !text3.trim(), children: "Send" })
6611
6844
  ] })
6612
6845
  ] }) : null,
6613
- !showText && options.length === 0 ? /* @__PURE__ */ jsx11("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
6846
+ !showText && options.length === 0 ? /* @__PURE__ */ jsx12("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
6614
6847
  ]
6615
6848
  }
6616
6849
  );
6617
6850
  }
6618
6851
 
6619
6852
  // src/react/components/LocationConsent/LocationConsent.tsx
6620
- import { useEffect as useEffect7, useRef as useRef7, useState as useState10 } from "react";
6853
+ import { useEffect as useEffect8, useRef as useRef7, useState as useState12 } from "react";
6621
6854
 
6622
6855
  // src/runtime/location-consent.ts
6623
6856
  function isLocationConsentRequest(request) {
@@ -6660,21 +6893,21 @@ function getPreciseLocation(geolocation) {
6660
6893
  }
6661
6894
 
6662
6895
  // src/react/components/LocationConsent/LocationConsent.tsx
6663
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
6896
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
6664
6897
  function LocationConsent({
6665
6898
  request,
6666
6899
  onRespond
6667
6900
  }) {
6668
- const [preference, setPreference] = useState10("unset");
6669
- const [locating, setLocating] = useState10(false);
6670
- const [error, setError] = useState10(null);
6901
+ const [preference, setPreference] = useState12("unset");
6902
+ const [locating, setLocating] = useState12(false);
6903
+ const [error, setError] = useState12(null);
6671
6904
  const respond = useRef7(onRespond);
6672
6905
  const answered = useRef7(null);
6673
6906
  const requestId = request?.requestId;
6674
- useEffect7(() => {
6907
+ useEffect8(() => {
6675
6908
  respond.current = onRespond;
6676
6909
  }, [onRespond]);
6677
- useEffect7(() => {
6910
+ useEffect8(() => {
6678
6911
  if (!requestId || preference === "unset" || answered.current === requestId || !respond.current)
6679
6912
  return;
6680
6913
  if (preference === "off") {
@@ -6717,13 +6950,13 @@ function LocationConsent({
6717
6950
  }, [requestId, preference]);
6718
6951
  const isLocating = Boolean(requestId) && preference === "on" && locating;
6719
6952
  if (!request && preference === "unset") return null;
6720
- return /* @__PURE__ */ jsxs12("section", { className: "location-consent", "aria-label": "Location sharing", children: [
6721
- /* @__PURE__ */ jsxs12("div", { className: "location-consent__copy", children: [
6722
- /* @__PURE__ */ jsx12("strong", { children: isLocating ? "Getting your location\u2026" : request ? "Get better results" : "Precise location" }),
6723
- /* @__PURE__ */ jsx12("span", { children: isLocating ? "Allow location access in your browser." : request ? "Share your precise location" : preference === "on" ? "On for location-aware answers" : "Off for this chat" })
6953
+ return /* @__PURE__ */ jsxs13("section", { className: "location-consent", "aria-label": "Location sharing", children: [
6954
+ /* @__PURE__ */ jsxs13("div", { className: "location-consent__copy", children: [
6955
+ /* @__PURE__ */ jsx13("strong", { children: isLocating ? "Getting your location\u2026" : request ? "Get better results" : "Precise location" }),
6956
+ /* @__PURE__ */ jsx13("span", { children: isLocating ? "Allow location access in your browser." : request ? "Share your precise location" : preference === "on" ? "On for location-aware answers" : "Off for this chat" })
6724
6957
  ] }),
6725
- /* @__PURE__ */ jsxs12("div", { className: "location-consent__actions", children: [
6726
- /* @__PURE__ */ jsx12(
6958
+ /* @__PURE__ */ jsxs13("div", { className: "location-consent__actions", children: [
6959
+ /* @__PURE__ */ jsx13(
6727
6960
  "button",
6728
6961
  {
6729
6962
  type: "button",
@@ -6737,10 +6970,10 @@ function LocationConsent({
6737
6970
  setError(null);
6738
6971
  setPreference(preference === "on" ? "off" : "on");
6739
6972
  },
6740
- children: /* @__PURE__ */ jsx12("span", {})
6973
+ children: /* @__PURE__ */ jsx13("span", {})
6741
6974
  }
6742
6975
  ),
6743
- request && /* @__PURE__ */ jsx12(
6976
+ request && /* @__PURE__ */ jsx13(
6744
6977
  "button",
6745
6978
  {
6746
6979
  type: "button",
@@ -6754,35 +6987,35 @@ function LocationConsent({
6754
6987
  }
6755
6988
  )
6756
6989
  ] }),
6757
- error && /* @__PURE__ */ jsx12("p", { role: "alert", className: "location-consent__error", children: error })
6990
+ error && /* @__PURE__ */ jsx13("p", { role: "alert", className: "location-consent__error", children: error })
6758
6991
  ] });
6759
6992
  }
6760
6993
 
6761
6994
  // src/react/components/CollectionResultCard/CollectionResultCard.tsx
6762
- import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
6995
+ import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
6763
6996
  function CollectionResultCard({
6764
6997
  result
6765
6998
  }) {
6766
6999
  const empty = result.items.length === 0;
6767
- return /* @__PURE__ */ jsxs13(
7000
+ return /* @__PURE__ */ jsxs14(
6768
7001
  "section",
6769
7002
  {
6770
7003
  className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
6771
7004
  "aria-label": result.title,
6772
7005
  role: result.status === "completed" ? "status" : "alert",
6773
7006
  children: [
6774
- /* @__PURE__ */ jsxs13("div", { className: "tool-result-card__heading", children: [
6775
- /* @__PURE__ */ jsx13("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6776
- /* @__PURE__ */ jsx13("strong", { children: result.title })
7007
+ /* @__PURE__ */ jsxs14("div", { className: "tool-result-card__heading", children: [
7008
+ /* @__PURE__ */ jsx14("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
7009
+ /* @__PURE__ */ jsx14("strong", { children: result.title })
6777
7010
  ] }),
6778
- empty ? /* @__PURE__ */ jsx13("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ jsx13("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ jsxs13("li", { children: [
6779
- /* @__PURE__ */ jsx13("div", { className: "collection-result-card__item-title", children: item.title }),
6780
- item.description ? /* @__PURE__ */ jsx13("p", { children: item.description }) : null,
6781
- item.details?.length ? /* @__PURE__ */ jsx13("dl", { children: item.details.map((detail) => /* @__PURE__ */ jsxs13("div", { children: [
6782
- /* @__PURE__ */ jsx13("dt", { children: detail.label }),
6783
- /* @__PURE__ */ jsx13("dd", { children: detail.value })
7011
+ empty ? /* @__PURE__ */ jsx14("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ jsx14("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ jsxs14("li", { children: [
7012
+ /* @__PURE__ */ jsx14("div", { className: "collection-result-card__item-title", children: item.title }),
7013
+ item.description ? /* @__PURE__ */ jsx14("p", { children: item.description }) : null,
7014
+ item.details?.length ? /* @__PURE__ */ jsx14("dl", { children: item.details.map((detail) => /* @__PURE__ */ jsxs14("div", { children: [
7015
+ /* @__PURE__ */ jsx14("dt", { children: detail.label }),
7016
+ /* @__PURE__ */ jsx14("dd", { children: detail.value })
6784
7017
  ] }, `${detail.label}:${detail.value}`)) }) : null,
6785
- item.href ? /* @__PURE__ */ jsx13("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
7018
+ item.href ? /* @__PURE__ */ jsx14("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
6786
7019
  ] }, item.title)) })
6787
7020
  ]
6788
7021
  }
@@ -6790,23 +7023,23 @@ function CollectionResultCard({
6790
7023
  }
6791
7024
 
6792
7025
  // src/react/components/EntityResultCard/EntityResultCard.tsx
6793
- import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
7026
+ import { Fragment as Fragment3, jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
6794
7027
  function EntityResultCard({
6795
7028
  result
6796
7029
  }) {
6797
7030
  const compact = !result.description && !result.details?.length && !result.links?.length;
6798
7031
  const collapsible = result.status === "completed" && Boolean(result.details?.length) && !result.links?.length;
6799
- const heading = /* @__PURE__ */ jsxs14("span", { className: "tool-result-card__heading", children: [
6800
- /* @__PURE__ */ jsx14("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6801
- /* @__PURE__ */ jsx14("strong", { children: result.title })
7032
+ const heading = /* @__PURE__ */ jsxs15("span", { className: "tool-result-card__heading", children: [
7033
+ /* @__PURE__ */ jsx15("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
7034
+ /* @__PURE__ */ jsx15("strong", { children: result.title })
6802
7035
  ] });
6803
- const content = /* @__PURE__ */ jsxs14(Fragment3, { children: [
6804
- result.description ? /* @__PURE__ */ jsx14("p", { children: result.description }) : null,
6805
- result.details?.length ? /* @__PURE__ */ jsx14("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs14("div", { children: [
6806
- /* @__PURE__ */ jsx14("dt", { children: detail.label }),
6807
- /* @__PURE__ */ jsx14("dd", { children: detail.value })
7036
+ const content = /* @__PURE__ */ jsxs15(Fragment3, { children: [
7037
+ result.description ? /* @__PURE__ */ jsx15("p", { children: result.description }) : null,
7038
+ result.details?.length ? /* @__PURE__ */ jsx15("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs15("div", { children: [
7039
+ /* @__PURE__ */ jsx15("dt", { children: detail.label }),
7040
+ /* @__PURE__ */ jsx15("dd", { children: detail.value })
6808
7041
  ] }, `${detail.label}:${detail.value}`)) }) : null,
6809
- result.links?.length ? /* @__PURE__ */ jsx14("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx14(
7042
+ result.links?.length ? /* @__PURE__ */ jsx15("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx15(
6810
7043
  "a",
6811
7044
  {
6812
7045
  href: link.href,
@@ -6818,12 +7051,12 @@ function EntityResultCard({
6818
7051
  )) }) : null
6819
7052
  ] });
6820
7053
  if (collapsible) {
6821
- return /* @__PURE__ */ jsxs14("details", { className: "entity-result-card tool-result-card entity-result-card--disclosure", children: [
6822
- /* @__PURE__ */ jsx14("summary", { children: /* @__PURE__ */ jsx14("span", { role: "status", children: heading }) }),
7054
+ return /* @__PURE__ */ jsxs15("details", { className: "entity-result-card tool-result-card entity-result-card--disclosure", children: [
7055
+ /* @__PURE__ */ jsx15("summary", { children: /* @__PURE__ */ jsx15("span", { role: "status", children: heading }) }),
6823
7056
  content
6824
7057
  ] });
6825
7058
  }
6826
- return /* @__PURE__ */ jsxs14(
7059
+ return /* @__PURE__ */ jsxs15(
6827
7060
  "section",
6828
7061
  {
6829
7062
  className: `entity-result-card tool-result-card tool-result-card--${result.status}${compact ? " entity-result-card--compact" : ""}`,
@@ -6838,24 +7071,24 @@ function EntityResultCard({
6838
7071
  }
6839
7072
 
6840
7073
  // src/react/components/SignatureResultCard/SignatureResultCard.tsx
6841
- import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
7074
+ import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
6842
7075
  function SignatureResultCard({
6843
7076
  result
6844
7077
  }) {
6845
7078
  const primaryLink = result.links?.[0];
6846
- return /* @__PURE__ */ jsxs15(
7079
+ return /* @__PURE__ */ jsxs16(
6847
7080
  "section",
6848
7081
  {
6849
7082
  className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
6850
7083
  "aria-label": result.title,
6851
7084
  children: [
6852
- /* @__PURE__ */ jsxs15("div", { className: "tool-result-card__heading", children: [
6853
- /* @__PURE__ */ jsx15("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6854
- /* @__PURE__ */ jsx15("strong", { children: result.title })
7085
+ /* @__PURE__ */ jsxs16("div", { className: "tool-result-card__heading", children: [
7086
+ /* @__PURE__ */ jsx16("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
7087
+ /* @__PURE__ */ jsx16("strong", { children: result.title })
6855
7088
  ] }),
6856
- result.statusLabel ? /* @__PURE__ */ jsx15("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
6857
- result.description ? /* @__PURE__ */ jsx15("p", { children: result.description }) : null,
6858
- primaryLink ? /* @__PURE__ */ jsx15(
7089
+ result.statusLabel ? /* @__PURE__ */ jsx16("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
7090
+ result.description ? /* @__PURE__ */ jsx16("p", { children: result.description }) : null,
7091
+ primaryLink ? /* @__PURE__ */ jsx16(
6859
7092
  "a",
6860
7093
  {
6861
7094
  className: "signature-result-card__cta",
@@ -6871,27 +7104,27 @@ function SignatureResultCard({
6871
7104
  }
6872
7105
 
6873
7106
  // src/react/components/ToolResultCard/ToolResultCard.tsx
6874
- import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
7107
+ import { jsx as jsx17, jsxs as jsxs17 } from "react/jsx-runtime";
6875
7108
  function ToolResultCard({
6876
7109
  result
6877
7110
  }) {
6878
- return /* @__PURE__ */ jsxs16(
7111
+ return /* @__PURE__ */ jsxs17(
6879
7112
  "section",
6880
7113
  {
6881
7114
  className: `tool-result-card tool-result-card--${result.status}`,
6882
7115
  "aria-label": result.title,
6883
7116
  role: result.status === "completed" ? "status" : "alert",
6884
7117
  children: [
6885
- /* @__PURE__ */ jsxs16("div", { className: "tool-result-card__heading", children: [
6886
- /* @__PURE__ */ jsx16("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6887
- /* @__PURE__ */ jsx16("strong", { children: result.title })
7118
+ /* @__PURE__ */ jsxs17("div", { className: "tool-result-card__heading", children: [
7119
+ /* @__PURE__ */ jsx17("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
7120
+ /* @__PURE__ */ jsx17("strong", { children: result.title })
6888
7121
  ] }),
6889
- result.description ? /* @__PURE__ */ jsx16("p", { children: result.description }) : null,
6890
- result.details?.length ? /* @__PURE__ */ jsx16("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs16("div", { children: [
6891
- /* @__PURE__ */ jsx16("dt", { children: detail.label }),
6892
- /* @__PURE__ */ jsx16("dd", { children: detail.value })
7122
+ result.description ? /* @__PURE__ */ jsx17("p", { children: result.description }) : null,
7123
+ result.details?.length ? /* @__PURE__ */ jsx17("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs17("div", { children: [
7124
+ /* @__PURE__ */ jsx17("dt", { children: detail.label }),
7125
+ /* @__PURE__ */ jsx17("dd", { children: detail.value })
6893
7126
  ] }, `${detail.label}:${detail.value}`)) }) : null,
6894
- result.links?.length ? /* @__PURE__ */ jsx16("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx16(
7127
+ result.links?.length ? /* @__PURE__ */ jsx17("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx17(
6895
7128
  "a",
6896
7129
  {
6897
7130
  href: link.href,
@@ -6907,14 +7140,14 @@ function ToolResultCard({
6907
7140
  }
6908
7141
 
6909
7142
  // src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
6910
- import { jsx as jsx17 } from "react/jsx-runtime";
7143
+ import { jsx as jsx18 } from "react/jsx-runtime";
6911
7144
  function VisitorToolResultView({
6912
7145
  disabled = false,
6913
7146
  onToolInput,
6914
7147
  result
6915
7148
  }) {
6916
7149
  if (result.kind === "input") {
6917
- return /* @__PURE__ */ jsx17(
7150
+ return /* @__PURE__ */ jsx18(
6918
7151
  ToolInputCard,
6919
7152
  {
6920
7153
  disabled,
@@ -6924,16 +7157,16 @@ function VisitorToolResultView({
6924
7157
  );
6925
7158
  }
6926
7159
  if (result.kind === "entity") {
6927
- return /* @__PURE__ */ jsx17(EntityResultCard, { result });
7160
+ return /* @__PURE__ */ jsx18(EntityResultCard, { result });
6928
7161
  }
6929
7162
  if (result.kind === "collection") {
6930
- return /* @__PURE__ */ jsx17(CollectionResultCard, { result });
7163
+ return /* @__PURE__ */ jsx18(CollectionResultCard, { result });
6931
7164
  }
6932
7165
  if (result.kind === "signature") {
6933
- return /* @__PURE__ */ jsx17(SignatureResultCard, { result });
7166
+ return /* @__PURE__ */ jsx18(SignatureResultCard, { result });
6934
7167
  }
6935
7168
  if (result.kind === "summary") {
6936
- return /* @__PURE__ */ jsx17(ToolResultCard, { result });
7169
+ return /* @__PURE__ */ jsx18(ToolResultCard, { result });
6937
7170
  }
6938
7171
  return null;
6939
7172
  }
@@ -6942,9 +7175,9 @@ function isRenderableVisitorToolResult(result) {
6942
7175
  }
6943
7176
 
6944
7177
  // src/react/components/AgentRail/AgentRail.tsx
6945
- import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
7178
+ import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
6946
7179
  function MinimizeIcon() {
6947
- return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
7180
+ return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
6948
7181
  "path",
6949
7182
  {
6950
7183
  d: "M3.5 8h9",
@@ -6955,7 +7188,7 @@ function MinimizeIcon() {
6955
7188
  ) });
6956
7189
  }
6957
7190
  function CloseIcon2() {
6958
- return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
7191
+ return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
6959
7192
  "path",
6960
7193
  {
6961
7194
  d: "M4 4l8 8M12 4l-8 8",
@@ -6966,19 +7199,31 @@ function CloseIcon2() {
6966
7199
  ) });
6967
7200
  }
6968
7201
  function NewChatIcon() {
6969
- return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
6970
- "path",
6971
- {
6972
- d: "M9.5 3.5h3v3M12.25 3.75 8 8M7 4H4.5A1.5 1.5 0 0 0 3 5.5v6A1.5 1.5 0 0 0 4.5 13h6a1.5 1.5 0 0 0 1.5-1.5V9",
6973
- stroke: "currentColor",
6974
- strokeWidth: "1.4",
6975
- strokeLinecap: "round",
6976
- strokeLinejoin: "round"
6977
- }
6978
- ) });
7202
+ return /* @__PURE__ */ jsxs18("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
7203
+ /* @__PURE__ */ jsx19(
7204
+ "path",
7205
+ {
7206
+ d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.86L21 8",
7207
+ stroke: "currentColor",
7208
+ strokeWidth: "2",
7209
+ strokeLinecap: "round",
7210
+ strokeLinejoin: "round"
7211
+ }
7212
+ ),
7213
+ /* @__PURE__ */ jsx19(
7214
+ "path",
7215
+ {
7216
+ d: "M21 3v5h-5",
7217
+ stroke: "currentColor",
7218
+ strokeWidth: "2",
7219
+ strokeLinecap: "round",
7220
+ strokeLinejoin: "round"
7221
+ }
7222
+ )
7223
+ ] });
6979
7224
  }
6980
7225
  function ExpandIcon() {
6981
- return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
7226
+ return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
6982
7227
  "path",
6983
7228
  {
6984
7229
  d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
@@ -6990,7 +7235,7 @@ function ExpandIcon() {
6990
7235
  ) });
6991
7236
  }
6992
7237
  function RestoreIcon() {
6993
- return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
7238
+ return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
6994
7239
  "path",
6995
7240
  {
6996
7241
  d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
@@ -7002,7 +7247,7 @@ function RestoreIcon() {
7002
7247
  ) });
7003
7248
  }
7004
7249
  function ChevronDownIcon() {
7005
- return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
7250
+ return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
7006
7251
  "path",
7007
7252
  {
7008
7253
  d: "M4 6.5l4 4 4-4",
@@ -7026,6 +7271,8 @@ function AgentRail({
7026
7271
  disclaimerLink,
7027
7272
  answerReceipt = false,
7028
7273
  readAloud = false,
7274
+ showLearnMore = true,
7275
+ showSources = true,
7029
7276
  composerPlaceholder = "Ask anything\u2026",
7030
7277
  mobileFullscreen = false,
7031
7278
  expanded = false,
@@ -7051,12 +7298,23 @@ function AgentRail({
7051
7298
  const pinnedToBottomRef = useRef8(true);
7052
7299
  const smoothScrollToLatestRef = useRef8(false);
7053
7300
  const lockedTranscriptScrollTopRef = useRef8(null);
7054
- const [showJumpToLatest, setShowJumpToLatest] = useState11(false);
7055
- const [receiptOpen, setReceiptOpen] = useState11(false);
7301
+ const [showJumpToLatest, setShowJumpToLatest] = useState13(false);
7302
+ const [receiptOpen, setReceiptOpen] = useState13(false);
7303
+ const [expandedSourcesMessageId, setExpandedSourcesMessageId] = useState13(null);
7056
7304
  const resolvedBrandLabel = brandLabel.trim();
7057
7305
  const resolvedBrandLogoUrl = brandLogoUrl?.trim();
7058
7306
  const resolvedDisclaimerLabel = disclaimerLabel === void 0 ? DEFAULT_DISCLAIMER_LABEL : disclaimerLabel;
7059
- const [failedLogoUrl, setFailedLogoUrl] = useState11(null);
7307
+ const [failedLogoUrl, setFailedLogoUrl] = useState13(null);
7308
+ const [brandLogoDisplay, setBrandLogoDisplay] = useState13(null);
7309
+ useEffect9(() => {
7310
+ setFailedLogoUrl(null);
7311
+ }, [resolvedBrandLogoUrl]);
7312
+ const activeBrandLogoDisplay = brandLogoDisplay?.url === resolvedBrandLogoUrl ? brandLogoDisplay : null;
7313
+ const wideBrandLogo = activeBrandLogoDisplay?.wide ?? false;
7314
+ const brandLogoDisplaySize = activeBrandLogoDisplay ? {
7315
+ height: activeBrandLogoDisplay.height,
7316
+ width: activeBrandLogoDisplay.width
7317
+ } : null;
7060
7318
  const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
7061
7319
  const resolvedColorScheme = useAgentColorScheme(colorScheme);
7062
7320
  const railStyle = agentThemeStyle(theme, resolvedColorScheme);
@@ -7157,29 +7415,39 @@ function AgentRail({
7157
7415
  ...visibleVisitorToolResults
7158
7416
  ].reverse().find((result) => result.kind !== "input")?.id;
7159
7417
  const receiptSteps = answerReceipt && state.toolSteps.length > 0 ? state.toolSteps : void 0;
7160
- useEffect8(() => {
7418
+ useEffect9(() => {
7161
7419
  if (state.phase !== "complete") {
7162
7420
  setReceiptOpen(false);
7163
7421
  }
7164
7422
  }, [state.phase]);
7423
+ useEffect9(() => {
7424
+ if (state.phase !== "complete" || !showSources) {
7425
+ setExpandedSourcesMessageId(null);
7426
+ }
7427
+ }, [state.phase, showSources]);
7165
7428
  function handleSubmit(message, options) {
7166
7429
  setReceiptOpen(false);
7430
+ setExpandedSourcesMessageId(null);
7167
7431
  onSubmit?.(message, options);
7168
7432
  }
7169
7433
  function handleRegenerate() {
7170
7434
  setReceiptOpen(false);
7435
+ setExpandedSourcesMessageId(null);
7171
7436
  onRegenerate?.();
7172
7437
  }
7173
7438
  function handleReset() {
7174
7439
  setReceiptOpen(false);
7440
+ setExpandedSourcesMessageId(null);
7175
7441
  onReset?.();
7176
7442
  }
7177
7443
  function handleFollowUpSelect(label) {
7178
7444
  setReceiptOpen(false);
7179
- onFollowUpSelect?.(label);
7445
+ setExpandedSourcesMessageId(null);
7446
+ if (onFollowUpSelect) onFollowUpSelect(label);
7447
+ else onSubmit?.(label);
7180
7448
  }
7181
7449
  const latestVisitorId = visibleMessages[lastVisitorIndex]?.id;
7182
- useEffect8(() => {
7450
+ useEffect9(() => {
7183
7451
  const node = transcriptRef.current;
7184
7452
  if (!node) return;
7185
7453
  if (latestVisitorId !== lastScrolledVisitorIdRef.current) {
@@ -7209,7 +7477,7 @@ function AgentRail({
7209
7477
  state.followUps,
7210
7478
  state.journey
7211
7479
  ]);
7212
- useEffect8(() => {
7480
+ useEffect9(() => {
7213
7481
  const node = transcriptRef.current;
7214
7482
  if (!node) return;
7215
7483
  const handleScroll = () => {
@@ -7223,7 +7491,7 @@ function AgentRail({
7223
7491
  handleScroll();
7224
7492
  return () => node.removeEventListener("scroll", handleScroll);
7225
7493
  }, []);
7226
- useEffect8(() => {
7494
+ useEffect9(() => {
7227
7495
  if (!receiptOpen) {
7228
7496
  lockedTranscriptScrollTopRef.current = null;
7229
7497
  return;
@@ -7261,7 +7529,7 @@ function AgentRail({
7261
7529
  window.setTimeout(settle, 900);
7262
7530
  node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
7263
7531
  }
7264
- return /* @__PURE__ */ jsx18(
7532
+ return /* @__PURE__ */ jsx19(
7265
7533
  "aside",
7266
7534
  {
7267
7535
  ref: railRef,
@@ -7275,44 +7543,72 @@ function AgentRail({
7275
7543
  autoFocus: mobileFullscreen || expanded,
7276
7544
  role: mobileFullscreen || expanded ? "dialog" : void 0,
7277
7545
  tabIndex: mobileFullscreen || expanded ? -1 : void 0,
7278
- children: /* @__PURE__ */ jsxs17(AgentRailOverlayContext.Provider, { value: { railRef, overlayRef }, children: [
7279
- /* @__PURE__ */ jsxs17("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
7280
- /* @__PURE__ */ jsx18("header", { className: "agent-rail__header", children: /* @__PURE__ */ jsxs17("div", { className: "agent-rail__brand-row", children: [
7281
- onCollapse ? /* @__PURE__ */ jsx18(
7546
+ children: /* @__PURE__ */ jsxs18(AgentRailOverlayContext.Provider, { value: { railRef, overlayRef }, children: [
7547
+ /* @__PURE__ */ jsxs18("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
7548
+ /* @__PURE__ */ jsx19("header", { className: "agent-rail__header", children: /* @__PURE__ */ jsxs18("div", { className: "agent-rail__brand-row", children: [
7549
+ onCollapse ? /* @__PURE__ */ jsx19(
7282
7550
  "button",
7283
7551
  {
7284
7552
  type: "button",
7285
7553
  className: "agent-rail__collapse",
7286
7554
  "aria-label": "Collapse assist",
7287
7555
  onClick: onCollapse,
7288
- children: /* @__PURE__ */ jsx18(MinimizeIcon, {})
7556
+ children: /* @__PURE__ */ jsx19(MinimizeIcon, {})
7289
7557
  }
7290
- ) : onClose ? /* @__PURE__ */ jsx18(
7558
+ ) : onClose ? /* @__PURE__ */ jsx19(
7291
7559
  "button",
7292
7560
  {
7293
7561
  type: "button",
7294
7562
  className: "agent-rail__close",
7295
7563
  "aria-label": "Close agent",
7296
7564
  onClick: onClose,
7297
- children: /* @__PURE__ */ jsx18(CloseIcon2, {})
7565
+ children: /* @__PURE__ */ jsx19(CloseIcon2, {})
7298
7566
  }
7299
- ) : /* @__PURE__ */ jsx18("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
7300
- resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ jsxs17("span", { className: "agent-rail__identity", children: [
7301
- showBrandLogo ? /* @__PURE__ */ jsx18("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
7302
- "img",
7567
+ ) : /* @__PURE__ */ jsx19("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
7568
+ resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ jsxs18("span", { className: "agent-rail__identity", children: [
7569
+ showBrandLogo ? /* @__PURE__ */ jsx19(
7570
+ "span",
7303
7571
  {
7304
- className: "agent-rail__brand-logo",
7305
- src: resolvedBrandLogoUrl,
7306
- alt: "",
7307
- onError: () => {
7308
- setFailedLogoUrl(resolvedBrandLogoUrl ?? null);
7309
- }
7572
+ className: `agent-rail__brand-mark${wideBrandLogo ? " agent-rail__brand-mark--wide" : ""}`,
7573
+ "aria-hidden": "true",
7574
+ children: /* @__PURE__ */ jsx19(
7575
+ "img",
7576
+ {
7577
+ className: "agent-rail__brand-logo as-brand-logo-img",
7578
+ src: resolvedBrandLogoUrl,
7579
+ alt: "",
7580
+ decoding: "async",
7581
+ ...brandLogoDisplaySize ? {
7582
+ height: brandLogoDisplaySize.height,
7583
+ width: brandLogoDisplaySize.width
7584
+ } : {},
7585
+ onLoad: (event) => {
7586
+ const img = event.currentTarget;
7587
+ const display = snapBrandLogoDisplaySize({
7588
+ naturalHeight: img.naturalHeight,
7589
+ naturalWidth: img.naturalWidth,
7590
+ surface: "header"
7591
+ });
7592
+ if (!resolvedBrandLogoUrl) return;
7593
+ setBrandLogoDisplay({
7594
+ height: display.height,
7595
+ url: resolvedBrandLogoUrl,
7596
+ wide: display.wide,
7597
+ width: display.width
7598
+ });
7599
+ },
7600
+ onError: () => {
7601
+ setFailedLogoUrl(resolvedBrandLogoUrl ?? null);
7602
+ }
7603
+ },
7604
+ resolvedBrandLogoUrl
7605
+ )
7310
7606
  }
7311
- ) }) : null,
7312
- resolvedBrandLabel ? /* @__PURE__ */ jsx18("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
7607
+ ) : null,
7608
+ resolvedBrandLabel ? /* @__PURE__ */ jsx19("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
7313
7609
  ] }) : null,
7314
- /* @__PURE__ */ jsxs17("span", { className: "agent-rail__actions", children: [
7315
- onReset ? /* @__PURE__ */ jsx18(
7610
+ /* @__PURE__ */ jsxs18("span", { className: "agent-rail__actions", children: [
7611
+ onReset ? /* @__PURE__ */ jsx19(
7316
7612
  "button",
7317
7613
  {
7318
7614
  type: "button",
@@ -7320,36 +7616,34 @@ function AgentRail({
7320
7616
  "aria-label": "Start a new conversation",
7321
7617
  disabled: !hasVisitorMessages2 || handoffActive && !handoff?.canReset,
7322
7618
  onClick: handleReset,
7323
- children: /* @__PURE__ */ jsx18(NewChatIcon, {})
7619
+ children: /* @__PURE__ */ jsx19(NewChatIcon, {})
7324
7620
  }
7325
7621
  ) : null,
7326
- onExpandToggle ? /* @__PURE__ */ jsx18(
7622
+ onExpandToggle ? /* @__PURE__ */ jsx19(
7327
7623
  "button",
7328
7624
  {
7329
7625
  type: "button",
7330
7626
  className: "agent-rail__expand",
7331
7627
  "aria-label": expanded ? "Exit full screen" : "Open full screen",
7332
7628
  onClick: onExpandToggle,
7333
- children: expanded ? /* @__PURE__ */ jsx18(RestoreIcon, {}) : /* @__PURE__ */ jsx18(ExpandIcon, {})
7629
+ children: expanded ? /* @__PURE__ */ jsx19(RestoreIcon, {}) : /* @__PURE__ */ jsx19(ExpandIcon, {})
7334
7630
  }
7335
7631
  ) : null
7336
7632
  ] })
7337
7633
  ] }) }),
7338
- /* @__PURE__ */ jsx18("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ jsxs17("div", { ref: threadRef, className: "agent-rail__thread", children: [
7339
- !hasVisitorMessages2 ? /* @__PURE__ */ jsxs17("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
7340
- greeting?.role === "agent" ? /* @__PURE__ */ jsx18(
7634
+ /* @__PURE__ */ jsx19("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ jsxs18("div", { ref: threadRef, className: "agent-rail__thread", children: [
7635
+ !hasVisitorMessages2 ? /* @__PURE__ */ jsxs18("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
7636
+ greeting?.role === "agent" ? /* @__PURE__ */ jsx19(
7341
7637
  MessageBubble,
7342
7638
  {
7343
- showProvenance: Boolean(
7344
- handoff?.page?.enabled || handoffActive
7345
- ),
7639
+ showProvenance: true,
7346
7640
  message: greeting,
7347
7641
  bookingDisabled: isBusy || handoffActive,
7348
7642
  brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
7349
7643
  onBook
7350
7644
  }
7351
7645
  ) : null,
7352
- showIdleFollowUps ? /* @__PURE__ */ jsx18("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ jsx18(
7646
+ showIdleFollowUps ? /* @__PURE__ */ jsx19("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ jsx19(
7353
7647
  FollowUpChips,
7354
7648
  {
7355
7649
  suggestions: state.followUps,
@@ -7358,7 +7652,7 @@ function AgentRail({
7358
7652
  onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
7359
7653
  }
7360
7654
  ) }) : null,
7361
- showActivity ? /* @__PURE__ */ jsx18(
7655
+ showActivity ? /* @__PURE__ */ jsx19(
7362
7656
  AgentActivityBubble,
7363
7657
  {
7364
7658
  brandLabel: resolvedBrandLabel,
@@ -7367,7 +7661,7 @@ function AgentRail({
7367
7661
  steps: activitySteps
7368
7662
  }
7369
7663
  ) : null,
7370
- visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx18(
7664
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx19(
7371
7665
  VisitorToolResultView,
7372
7666
  {
7373
7667
  result,
@@ -7376,7 +7670,7 @@ function AgentRail({
7376
7670
  },
7377
7671
  result.id
7378
7672
  )),
7379
- pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx18(
7673
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx19(
7380
7674
  HumanInputCard,
7381
7675
  {
7382
7676
  request,
@@ -7385,129 +7679,195 @@ function AgentRail({
7385
7679
  request.requestId
7386
7680
  ))
7387
7681
  ] }) : null,
7388
- transcriptMessages.map((message, index) => /* @__PURE__ */ jsxs17(
7389
- "div",
7390
- {
7391
- ref: index === lastVisitorIndex + 1 ? responseRef : void 0,
7392
- className: "agent-rail__turn-block",
7393
- children: [
7394
- message.role === "agent" ? message.toolResults?.map((result) => /* @__PURE__ */ jsx18(
7395
- VisitorToolResultView,
7396
- {
7397
- result
7398
- },
7399
- result.id
7400
- )) : null,
7401
- /* @__PURE__ */ jsx18(
7402
- MessageBubble,
7403
- {
7404
- showProvenance: Boolean(
7405
- handoff?.page?.enabled || handoffActive
7406
- ),
7407
- message,
7408
- bookingDisabled: isBusy || handoffActive,
7409
- brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
7410
- offer: index === transcriptMessages.length - 1 ? state.pendingOffer : void 0,
7411
- onBook
7412
- }
7413
- ),
7414
- index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ jsx18(
7415
- MessageActions,
7416
- {
7417
- answeredAt: message.createdAt,
7418
- copyText: hideToolCardFences(message.text).trim() || message.text,
7419
- readAloud,
7420
- receiptSteps,
7421
- onOpenReceipt: receiptSteps ? openReceipt : void 0,
7422
- onRegenerate: onRegenerate ? handleRegenerate : void 0,
7423
- onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
7424
- }
7425
- ) : null,
7426
- index === lastVisitorIndex ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
7427
- showActivity ? /* @__PURE__ */ jsx18(
7428
- AgentActivityBubble,
7429
- {
7430
- brandLabel: resolvedBrandLabel,
7431
- brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
7432
- failed: state.phase === "error",
7433
- steps: activitySteps
7434
- }
7435
- ) : null,
7436
- visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx18(
7682
+ transcriptMessages.map((message, index) => {
7683
+ const messageSourceCount = message.role === "agent" ? searchSources(message.searchResults ?? []).length : 0;
7684
+ const showAnswerActions = message.role === "agent" && index === lastAgentIndex && showMessageActions;
7685
+ const showSourcesToggle = message.role === "agent" && showSources && state.phase === "complete" && !message.streaming && messageSourceCount > 0;
7686
+ return /* @__PURE__ */ jsxs18(
7687
+ "div",
7688
+ {
7689
+ ref: index === lastVisitorIndex + 1 ? responseRef : void 0,
7690
+ className: "agent-rail__turn-block",
7691
+ children: [
7692
+ message.role === "agent" ? message.toolResults?.map((result) => /* @__PURE__ */ jsx19(
7437
7693
  VisitorToolResultView,
7438
7694
  {
7439
- result,
7440
- disabled: semanticSurfaceDisabled,
7441
- onToolInput
7695
+ result
7442
7696
  },
7443
7697
  result.id
7444
- )),
7445
- pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx18(
7446
- HumanInputCard,
7698
+ )) : null,
7699
+ /* @__PURE__ */ jsx19(
7700
+ MessageBubble,
7447
7701
  {
7448
- request,
7449
- onRespond: onInputResponse
7450
- },
7451
- request.requestId
7452
- ))
7453
- ] }) : null
7454
- ]
7455
- },
7456
- message.role === "agent" && transcriptMessages[index - 1]?.role === "visitor" ? `answer-${transcriptMessages[index - 1]?.id}` : message.id
7457
- )),
7458
- waitingForBooking ? /* @__PURE__ */ jsx18(BookingCardLoader, {}) : null,
7459
- state.error ? /* @__PURE__ */ jsxs17("section", { className: "agent-rail__error", role: "alert", children: [
7460
- /* @__PURE__ */ jsxs17("div", { children: [
7461
- /* @__PURE__ */ jsx18("strong", { children: "Something went wrong" }),
7462
- /* @__PURE__ */ jsx18("p", { children: state.error })
7702
+ showProvenance: true,
7703
+ message,
7704
+ showSearchReferences: false,
7705
+ bookingDisabled: isBusy || handoffActive,
7706
+ brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
7707
+ offer: index === transcriptMessages.length - 1 ? state.pendingOffer : void 0,
7708
+ onBook
7709
+ }
7710
+ ),
7711
+ showAnswerActions || showSourcesToggle ? /* @__PURE__ */ jsxs18("div", { className: "agent-rail__answer-footer", children: [
7712
+ /* @__PURE__ */ jsxs18("div", { className: "agent-rail__answer-actions", children: [
7713
+ showAnswerActions ? /* @__PURE__ */ jsx19(
7714
+ MessageActions,
7715
+ {
7716
+ answeredAt: message.createdAt,
7717
+ copyText: hideToolCardFences(message.text).trim() || message.text,
7718
+ readAloud,
7719
+ receiptSteps,
7720
+ onOpenReceipt: receiptSteps ? () => openReceipt() : void 0,
7721
+ onRegenerate: onRegenerate ? handleRegenerate : void 0,
7722
+ onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
7723
+ }
7724
+ ) : null,
7725
+ showSourcesToggle ? /* @__PURE__ */ jsxs18(
7726
+ "button",
7727
+ {
7728
+ className: "agent-rail__sources-button",
7729
+ type: "button",
7730
+ "aria-expanded": expandedSourcesMessageId === message.id,
7731
+ "aria-controls": `agent-rail-sources-${message.id}`,
7732
+ onClick: () => setExpandedSourcesMessageId(
7733
+ (current) => current === message.id ? null : message.id
7734
+ ),
7735
+ children: [
7736
+ "Explore More",
7737
+ /* @__PURE__ */ jsx19(
7738
+ "span",
7739
+ {
7740
+ className: "agent-rail__sources-button-chevron",
7741
+ "aria-hidden": "true",
7742
+ children: /* @__PURE__ */ jsx19(ChevronDownIcon, {})
7743
+ }
7744
+ )
7745
+ ]
7746
+ }
7747
+ ) : null
7748
+ ] }),
7749
+ showSourcesToggle ? /* @__PURE__ */ jsx19(
7750
+ "div",
7751
+ {
7752
+ id: `agent-rail-sources-${message.id}`,
7753
+ className: `agent-rail__sources-panel${expandedSourcesMessageId === message.id ? " agent-rail__sources-panel--open" : ""}`,
7754
+ role: "region",
7755
+ "aria-label": "Explore More",
7756
+ children: /* @__PURE__ */ jsx19("div", { className: "agent-rail__sources-panel-inner", children: /* @__PURE__ */ jsx19(
7757
+ SearchReferences,
7758
+ {
7759
+ results: message.searchResults ?? [],
7760
+ mode: "sources"
7761
+ }
7762
+ ) })
7763
+ }
7764
+ ) : null
7765
+ ] }) : 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
+ index === lastVisitorIndex ? /* @__PURE__ */ jsxs18(Fragment4, { children: [
7782
+ showActivity ? /* @__PURE__ */ jsx19(
7783
+ AgentActivityBubble,
7784
+ {
7785
+ brandLabel: resolvedBrandLabel,
7786
+ brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
7787
+ failed: state.phase === "error",
7788
+ steps: activitySteps
7789
+ }
7790
+ ) : null,
7791
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx19(
7792
+ VisitorToolResultView,
7793
+ {
7794
+ result,
7795
+ disabled: semanticSurfaceDisabled,
7796
+ onToolInput
7797
+ },
7798
+ result.id
7799
+ )),
7800
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx19(
7801
+ HumanInputCard,
7802
+ {
7803
+ request,
7804
+ onRespond: onInputResponse
7805
+ },
7806
+ request.requestId
7807
+ ))
7808
+ ] }) : null
7809
+ ]
7810
+ },
7811
+ message.role === "agent" && transcriptMessages[index - 1]?.role === "visitor" ? `answer-${transcriptMessages[index - 1]?.id}` : message.id
7812
+ );
7813
+ }),
7814
+ waitingForBooking ? /* @__PURE__ */ jsx19(BookingCardLoader, {}) : null,
7815
+ state.error ? /* @__PURE__ */ jsxs18("section", { className: "agent-rail__error", role: "alert", children: [
7816
+ /* @__PURE__ */ jsxs18("div", { children: [
7817
+ /* @__PURE__ */ jsx19("strong", { children: "Something went wrong" }),
7818
+ /* @__PURE__ */ jsx19("p", { children: state.error })
7463
7819
  ] }),
7464
- onRetry ? /* @__PURE__ */ jsx18("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
7820
+ onRetry ? /* @__PURE__ */ jsx19("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
7465
7821
  ] }) : null
7466
7822
  ] }) }),
7467
- showDisclaimerLabel ? /* @__PURE__ */ jsx18("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ jsx18("p", { children: disclaimerLink ? /* @__PURE__ */ jsx18(
7468
- "a",
7469
- {
7470
- href: disclaimerLink,
7471
- rel: "noopener noreferrer",
7472
- target: "_blank",
7473
- children: resolvedDisclaimerLabel
7474
- }
7475
- ) : resolvedDisclaimerLabel }) }) : null,
7476
- handoff && (handoff.page?.enabled || handoffActive) ? /* @__PURE__ */ jsxs17("div", { className: "agent-rail__handoff", children: [
7477
- /* @__PURE__ */ jsx18("p", { role: "status", "aria-live": "polite", 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?" }),
7478
- handoffStatus === "ai" ? /* @__PURE__ */ jsx18(
7823
+ handoff && (handoff.page?.enabled || handoffActive) ? /* @__PURE__ */ jsxs18("div", { className: "agent-rail__handoff", children: [
7824
+ handoffStatus === "human" || handoffStatus === "queued" || handoffStatus === "requesting" ? /* @__PURE__ */ jsx19("span", { className: "agent-rail__handoff-dot", "aria-hidden": "true" }) : null,
7825
+ /* @__PURE__ */ jsx19(
7826
+ "p",
7827
+ {
7828
+ className: "agent-rail__handoff-status",
7829
+ role: "status",
7830
+ "aria-live": "polite",
7831
+ 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
+ }
7833
+ ),
7834
+ handoffStatus === "ai" ? /* @__PURE__ */ jsx19(
7479
7835
  "button",
7480
7836
  {
7481
7837
  type: "button",
7838
+ className: "agent-rail__handoff-cta",
7482
7839
  disabled: handoff.busy || handoff.hasPending || isBusy,
7483
7840
  onClick: () => void handoff.start(),
7484
7841
  children: "Talk to a person"
7485
7842
  }
7486
7843
  ) : null,
7487
- handoffStatus === "resolved" ? /* @__PURE__ */ jsx18(
7844
+ handoffStatus === "resolved" ? /* @__PURE__ */ jsx19(
7488
7845
  "button",
7489
7846
  {
7490
7847
  type: "button",
7848
+ className: "agent-rail__handoff-action",
7491
7849
  disabled: handoff.busy || handoff.hasPending,
7492
7850
  onClick: () => void handoff.returnToAI(),
7493
7851
  children: "Return to AI"
7494
7852
  }
7495
7853
  ) : null,
7496
- handoffStatus === "failed" && onReset ? /* @__PURE__ */ jsx18(
7854
+ handoffStatus === "failed" && onReset ? /* @__PURE__ */ jsx19(
7497
7855
  "button",
7498
7856
  {
7499
7857
  type: "button",
7858
+ className: "agent-rail__handoff-action",
7500
7859
  disabled: !handoff.canReset,
7501
7860
  onClick: handleReset,
7502
7861
  children: "Start a new conversation"
7503
7862
  }
7504
7863
  ) : null,
7505
- handoff.error ? /* @__PURE__ */ jsxs17("div", { role: "alert", children: [
7506
- /* @__PURE__ */ jsx18("span", { children: handoff.error }),
7507
- /* @__PURE__ */ jsx18(
7864
+ handoff.error ? /* @__PURE__ */ jsxs18("span", { className: "agent-rail__handoff-error", role: "alert", children: [
7865
+ handoff.error,
7866
+ /* @__PURE__ */ jsx19(
7508
7867
  "button",
7509
7868
  {
7510
7869
  type: "button",
7870
+ className: "agent-rail__handoff-action",
7511
7871
  disabled: handoff.busy,
7512
7872
  onClick: () => void handoff.retry(),
7513
7873
  children: "Retry"
@@ -7515,8 +7875,17 @@ function AgentRail({
7515
7875
  )
7516
7876
  ] }) : null
7517
7877
  ] }) : null,
7518
- /* @__PURE__ */ jsxs17("div", { className: "agent-rail__composer-wrap", children: [
7519
- /* @__PURE__ */ jsx18(
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
+ /* @__PURE__ */ jsxs18("div", { className: "agent-rail__composer-wrap", children: [
7888
+ /* @__PURE__ */ jsx19(
7520
7889
  LocationConsent,
7521
7890
  {
7522
7891
  request: locationRequest,
@@ -7524,7 +7893,7 @@ function AgentRail({
7524
7893
  },
7525
7894
  state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
7526
7895
  ),
7527
- showJumpToLatest ? /* @__PURE__ */ jsx18(
7896
+ showJumpToLatest ? /* @__PURE__ */ jsx19(
7528
7897
  "button",
7529
7898
  {
7530
7899
  type: "button",
@@ -7532,10 +7901,10 @@ function AgentRail({
7532
7901
  "aria-label": "Jump to the latest message",
7533
7902
  title: "Jump to the latest message",
7534
7903
  onClick: scrollToLatest,
7535
- children: /* @__PURE__ */ jsx18(ChevronDownIcon, {})
7904
+ children: /* @__PURE__ */ jsx19(ChevronDownIcon, {})
7536
7905
  }
7537
7906
  ) : null,
7538
- /* @__PURE__ */ jsx18(
7907
+ /* @__PURE__ */ jsx19(
7539
7908
  Composer,
7540
7909
  {
7541
7910
  variant: expanded || mobileFullscreen ? "dock" : "default",
@@ -7552,11 +7921,11 @@ function AgentRail({
7552
7921
  },
7553
7922
  `${state.messages.find((message) => message.role === "visitor")?.id ?? "empty"}:${latestResultId ?? ""}`
7554
7923
  ),
7555
- poweredByLabel ? /* @__PURE__ */ jsx18("div", { className: "agent-rail__footer", children: /* @__PURE__ */ jsx18("p", { children: /* @__PURE__ */ jsx18("span", { children: poweredByLabel }) }) }) : null
7924
+ poweredByLabel ? /* @__PURE__ */ jsx19("div", { className: "agent-rail__footer", children: /* @__PURE__ */ jsx19("p", { children: /* @__PURE__ */ jsx19("span", { children: poweredByLabel }) }) }) : null
7556
7925
  ] })
7557
7926
  ] }),
7558
- /* @__PURE__ */ jsx18("div", { ref: overlayRef, className: "agent-rail__overlay" }),
7559
- receiptOpen && receiptSteps ? /* @__PURE__ */ jsx18(
7927
+ /* @__PURE__ */ jsx19("div", { ref: overlayRef, className: "agent-rail__overlay" }),
7928
+ receiptOpen && receiptSteps ? /* @__PURE__ */ jsx19(
7560
7929
  AnswerReceiptDialog,
7561
7930
  {
7562
7931
  brandLabel: resolvedBrandLabel,
@@ -7570,10 +7939,10 @@ function AgentRail({
7570
7939
  }
7571
7940
 
7572
7941
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
7573
- import { useState as useState12 } from "react";
7574
- import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
7942
+ import { useState as useState14 } from "react";
7943
+ import { Fragment as Fragment5, jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
7575
7944
  function ChatSparkIcon() {
7576
- return /* @__PURE__ */ jsxs18(
7945
+ return /* @__PURE__ */ jsxs19(
7577
7946
  "svg",
7578
7947
  {
7579
7948
  className: "assist-edge-tab__chat-spark",
@@ -7581,7 +7950,7 @@ function ChatSparkIcon() {
7581
7950
  fill: "none",
7582
7951
  "aria-hidden": "true",
7583
7952
  children: [
7584
- /* @__PURE__ */ jsx19(
7953
+ /* @__PURE__ */ jsx20(
7585
7954
  "path",
7586
7955
  {
7587
7956
  className: "assist-edge-tab__spark assist-edge-tab__spark--a",
@@ -7589,7 +7958,7 @@ function ChatSparkIcon() {
7589
7958
  fill: "currentColor"
7590
7959
  }
7591
7960
  ),
7592
- /* @__PURE__ */ jsx19(
7961
+ /* @__PURE__ */ jsx20(
7593
7962
  "path",
7594
7963
  {
7595
7964
  className: "assist-edge-tab__spark assist-edge-tab__spark--b",
@@ -7597,8 +7966,8 @@ function ChatSparkIcon() {
7597
7966
  fill: "currentColor"
7598
7967
  }
7599
7968
  ),
7600
- /* @__PURE__ */ jsxs18("g", { className: "assist-edge-tab__bot", children: [
7601
- /* @__PURE__ */ jsx19(
7969
+ /* @__PURE__ */ jsxs19("g", { className: "assist-edge-tab__bot", children: [
7970
+ /* @__PURE__ */ jsx20(
7602
7971
  "path",
7603
7972
  {
7604
7973
  d: "M11.15 5.2V3.05",
@@ -7607,8 +7976,8 @@ function ChatSparkIcon() {
7607
7976
  strokeLinecap: "round"
7608
7977
  }
7609
7978
  ),
7610
- /* @__PURE__ */ jsx19("circle", { cx: "11.15", cy: "2.45", r: "0.85", fill: "currentColor" }),
7611
- /* @__PURE__ */ jsx19(
7979
+ /* @__PURE__ */ jsx20("circle", { cx: "11.15", cy: "2.45", r: "0.85", fill: "currentColor" }),
7980
+ /* @__PURE__ */ jsx20(
7612
7981
  "rect",
7613
7982
  {
7614
7983
  x: "3.55",
@@ -7620,7 +7989,7 @@ function ChatSparkIcon() {
7620
7989
  strokeWidth: "1.9"
7621
7990
  }
7622
7991
  ),
7623
- /* @__PURE__ */ jsx19(
7992
+ /* @__PURE__ */ jsx20(
7624
7993
  "circle",
7625
7994
  {
7626
7995
  className: "assist-edge-tab__eye",
@@ -7630,7 +7999,7 @@ function ChatSparkIcon() {
7630
7999
  fill: "currentColor"
7631
8000
  }
7632
8001
  ),
7633
- /* @__PURE__ */ jsx19(
8002
+ /* @__PURE__ */ jsx20(
7634
8003
  "circle",
7635
8004
  {
7636
8005
  className: "assist-edge-tab__eye assist-edge-tab__eye--r",
@@ -7647,40 +8016,72 @@ function ChatSparkIcon() {
7647
8016
  }
7648
8017
  function TabMarkIcon({
7649
8018
  customIconUrl,
7650
- logoUrl
8019
+ logoUrl,
8020
+ chip = false
7651
8021
  }) {
7652
8022
  const custom = customIconUrl?.trim();
7653
8023
  const logo = logoUrl?.trim();
7654
- const [customFailed, setCustomFailed] = useState12(false);
7655
- const [logoFailed, setLogoFailed] = useState12(false);
8024
+ const [customFailed, setCustomFailed] = useState14(false);
8025
+ const [logoFailed, setLogoFailed] = useState14(false);
8026
+ const [markDisplay, setMarkDisplay] = useState14(null);
8027
+ function applyLauncherLogoSize(img, sourceUrl) {
8028
+ if (!chip) return;
8029
+ const display = snapBrandLogoDisplaySize({
8030
+ naturalHeight: img.naturalHeight,
8031
+ naturalWidth: img.naturalWidth,
8032
+ surface: "launcher"
8033
+ });
8034
+ setMarkDisplay({
8035
+ url: sourceUrl,
8036
+ width: display.width,
8037
+ height: display.height,
8038
+ wide: display.wide
8039
+ });
8040
+ }
8041
+ const chipMarkStyle = chip && markDisplay ? {
8042
+ width: `${markDisplay.width}px`,
8043
+ height: `${markDisplay.height}px`
8044
+ } : void 0;
7656
8045
  if (custom && !customFailed) {
7657
- return /* @__PURE__ */ jsx19(
8046
+ return /* @__PURE__ */ jsx20(
7658
8047
  "img",
7659
8048
  {
7660
8049
  alt: "",
7661
8050
  "aria-hidden": true,
7662
- className: "assist-edge-tab__custom-icon",
8051
+ className: `assist-edge-tab__custom-icon as-brand-logo-img${chip ? " assist-edge-tab__custom-icon--chip" : ""}`,
7663
8052
  src: custom,
8053
+ decoding: "async",
8054
+ style: markDisplay?.url === custom ? chipMarkStyle : void 0,
8055
+ onLoad: (event) => {
8056
+ if (chip) {
8057
+ applyLauncherLogoSize(event.currentTarget, custom);
8058
+ }
8059
+ },
7664
8060
  onError: () => setCustomFailed(true)
7665
8061
  }
7666
8062
  );
7667
8063
  }
7668
8064
  if (logo && !logoFailed) {
7669
- return /* @__PURE__ */ jsx19(
8065
+ return /* @__PURE__ */ jsx20(
7670
8066
  "img",
7671
8067
  {
7672
8068
  alt: "",
7673
8069
  "aria-hidden": true,
7674
- className: "assist-edge-tab__logo",
8070
+ className: `assist-edge-tab__logo as-brand-logo-img${chip ? " assist-edge-tab__logo--chip" : ""}${chip && markDisplay?.url === logo && markDisplay.wide ? " assist-edge-tab__logo--wide" : ""}`,
7675
8071
  src: logo,
8072
+ decoding: "async",
8073
+ style: markDisplay?.url === logo ? chipMarkStyle : void 0,
8074
+ onLoad: (event) => {
8075
+ applyLauncherLogoSize(event.currentTarget, logo);
8076
+ },
7676
8077
  onError: () => setLogoFailed(true)
7677
8078
  }
7678
8079
  );
7679
8080
  }
7680
- return /* @__PURE__ */ jsx19(ChatSparkIcon, {});
8081
+ return /* @__PURE__ */ jsx20(ChatSparkIcon, {});
7681
8082
  }
7682
8083
  function ChevronLeftIcon() {
7683
- return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
8084
+ return /* @__PURE__ */ jsx20("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(
7684
8085
  "path",
7685
8086
  {
7686
8087
  d: "M10 4L6 8l4 4",
@@ -7692,7 +8093,7 @@ function ChevronLeftIcon() {
7692
8093
  ) });
7693
8094
  }
7694
8095
  function ChevronDownIcon2() {
7695
- return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
8096
+ return /* @__PURE__ */ jsx20("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(
7696
8097
  "path",
7697
8098
  {
7698
8099
  d: "M4 6l4 4 4-4",
@@ -7704,7 +8105,7 @@ function ChevronDownIcon2() {
7704
8105
  ) });
7705
8106
  }
7706
8107
  function DragDots() {
7707
- return /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx19("i", {}, index)) });
8108
+ return /* @__PURE__ */ jsx20("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx20("i", {}, index)) });
7708
8109
  }
7709
8110
  var VARIANT_COPY = {
7710
8111
  outline: { label: "Ask anything", aria: "Ask anything" },
@@ -7748,6 +8149,7 @@ function AssistEdgeTab({
7748
8149
  "--tab-along": `${along}%`,
7749
8150
  "--tab-inset": `${inset}px`,
7750
8151
  ...resolvedBrandColor ? { "--as-brand": resolvedBrandColor } : {},
8152
+ ...pill && resolvedBrandColor ? { "--pill-logo-surface": resolvedBrandColor } : {},
7751
8153
  ...brandForeground ? { "--as-visitor-text": brandForeground } : {},
7752
8154
  ...resolvedBorderColor ? { "--as-border": resolvedBorderColor } : {},
7753
8155
  ...fontFamily ? { "--as-font-display": fontFamily } : {},
@@ -7759,7 +8161,7 @@ function AssistEdgeTab({
7759
8161
  ...!pill && resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
7760
8162
  colorScheme: chromeScheme
7761
8163
  };
7762
- return /* @__PURE__ */ jsxs18(
8164
+ return /* @__PURE__ */ jsxs19(
7763
8165
  "button",
7764
8166
  {
7765
8167
  type: "button",
@@ -7771,15 +8173,16 @@ function AssistEdgeTab({
7771
8173
  tabIndex: visible ? 0 : -1,
7772
8174
  onClick: onOpen,
7773
8175
  children: [
7774
- pill ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
7775
- /* @__PURE__ */ jsx19(
8176
+ pill ? /* @__PURE__ */ jsxs19(Fragment5, { children: [
8177
+ /* @__PURE__ */ jsx20(
7776
8178
  "span",
7777
8179
  {
7778
8180
  className: `assist-edge-tab__mark assist-edge-tab__mark--chip${mobile ? " assist-edge-tab__mark--mobile" : ""}`,
7779
8181
  "aria-hidden": "true",
7780
- children: /* @__PURE__ */ jsx19(
8182
+ children: /* @__PURE__ */ jsx20(
7781
8183
  TabMarkIcon,
7782
8184
  {
8185
+ chip: true,
7783
8186
  customIconUrl,
7784
8187
  logoUrl
7785
8188
  },
@@ -7787,38 +8190,40 @@ function AssistEdgeTab({
7787
8190
  )
7788
8191
  }
7789
8192
  ),
7790
- /* @__PURE__ */ jsxs18("span", { className: "assist-edge-tab__text", children: [
7791
- /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7792
- visibleSubLabel ? /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__sublabel", children: visibleSubLabel }) : null
8193
+ /* @__PURE__ */ jsxs19("span", { className: "assist-edge-tab__text", children: [
8194
+ /* @__PURE__ */ jsx20("span", { className: "assist-edge-tab__label", children: visibleLabel }),
8195
+ visibleSubLabel ? /* @__PURE__ */ jsx20("span", { className: "assist-edge-tab__sublabel", children: visibleSubLabel }) : null
7793
8196
  ] })
7794
- ] }) : variant === "outline" ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
7795
- /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
8197
+ ] }) : variant === "outline" ? /* @__PURE__ */ jsxs19(Fragment5, { children: [
8198
+ /* @__PURE__ */ jsx20("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(
7796
8199
  TabMarkIcon,
7797
8200
  {
8201
+ chip: true,
7798
8202
  customIconUrl,
7799
8203
  logoUrl
7800
8204
  },
7801
8205
  markSourceKey
7802
8206
  ) }),
7803
- /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7804
- /* @__PURE__ */ jsx19(ChevronDownIcon2, {})
8207
+ /* @__PURE__ */ jsx20("span", { className: "assist-edge-tab__label", children: visibleLabel }),
8208
+ /* @__PURE__ */ jsx20(ChevronDownIcon2, {})
7805
8209
  ] }) : null,
7806
- !pill && variant === "ask" ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
7807
- /* @__PURE__ */ jsx19(ChevronLeftIcon, {}),
7808
- /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7809
- /* @__PURE__ */ jsx19(DragDots, {})
8210
+ !pill && variant === "ask" ? /* @__PURE__ */ jsxs19(Fragment5, { children: [
8211
+ /* @__PURE__ */ jsx20(ChevronLeftIcon, {}),
8212
+ /* @__PURE__ */ jsx20("span", { className: "assist-edge-tab__label", children: visibleLabel }),
8213
+ /* @__PURE__ */ jsx20(DragDots, {})
7810
8214
  ] }) : null,
7811
- !pill && variant === "fill" ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
7812
- /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
8215
+ !pill && variant === "fill" ? /* @__PURE__ */ jsxs19(Fragment5, { children: [
8216
+ /* @__PURE__ */ jsx20("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx20(
7813
8217
  TabMarkIcon,
7814
8218
  {
8219
+ chip: true,
7815
8220
  customIconUrl,
7816
8221
  logoUrl
7817
8222
  },
7818
8223
  markSourceKey
7819
8224
  ) }),
7820
- /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7821
- /* @__PURE__ */ jsx19(ChevronLeftIcon, {})
8225
+ /* @__PURE__ */ jsx20("span", { className: "assist-edge-tab__label", children: visibleLabel }),
8226
+ /* @__PURE__ */ jsx20(ChevronLeftIcon, {})
7822
8227
  ] }) : null
7823
8228
  ]
7824
8229
  }
@@ -7882,10 +8287,10 @@ function sendAgentAnswerFeedback(eventUrl, event) {
7882
8287
  }
7883
8288
 
7884
8289
  // src/react/components/AgentWidget/AgentWidget.tsx
7885
- import { useEffect as useEffect11, useRef as useRef9, useState as useState14 } from "react";
8290
+ import { useEffect as useEffect12, useRef as useRef9, useState as useState16 } from "react";
7886
8291
 
7887
8292
  // src/react/page-shift.ts
7888
- import { useEffect as useEffect9 } from "react";
8293
+ import { useEffect as useEffect10 } from "react";
7889
8294
  var PAGE_SHIFT_CLASS = "webless-agent-page-shift";
7890
8295
  var DEFAULT_RAIL_WIDTH_PX = 450;
7891
8296
  function shouldApplyPageShift(input) {
@@ -7937,7 +8342,7 @@ function clearPageMargin() {
7937
8342
  }
7938
8343
  function usePageShift(input) {
7939
8344
  const { active, railSlotRef } = input;
7940
- useEffect9(() => {
8345
+ useEffect10(() => {
7941
8346
  if (typeof document === "undefined") {
7942
8347
  return;
7943
8348
  }
@@ -7965,12 +8370,12 @@ function usePageShift(input) {
7965
8370
  }
7966
8371
 
7967
8372
  // src/react/hooks/useIsMobile.ts
7968
- import { useEffect as useEffect10, useState as useState13 } from "react";
8373
+ import { useEffect as useEffect11, useState as useState15 } from "react";
7969
8374
  function useIsMobile(breakpoint = 767) {
7970
- const [isMobile, setIsMobile] = useState13(
8375
+ const [isMobile, setIsMobile] = useState15(
7971
8376
  () => typeof window !== "undefined" && window.matchMedia(`(max-width: ${breakpoint}px)`).matches
7972
8377
  );
7973
- useEffect10(() => {
8378
+ useEffect11(() => {
7974
8379
  const media = window.matchMedia(`(max-width: ${breakpoint}px)`);
7975
8380
  const onChange = () => setIsMobile(media.matches);
7976
8381
  onChange();
@@ -7981,7 +8386,7 @@ function useIsMobile(breakpoint = 767) {
7981
8386
  }
7982
8387
 
7983
8388
  // src/react/components/AgentWidget/AgentWidget.tsx
7984
- import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
8389
+ import { jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
7985
8390
  function AgentWidget({
7986
8391
  indexId,
7987
8392
  customerId,
@@ -8002,8 +8407,8 @@ function AgentWidget({
8002
8407
  const isMobile = useIsMobile();
8003
8408
  const placement = normalizeAgentPlacement(placementInput);
8004
8409
  const railSlotRef = useRef9(null);
8005
- const [railCollapsed, setRailCollapsed] = useState14(defaultCollapsed);
8006
- const [railExpanded, setRailExpanded] = useState14(false);
8410
+ const [railCollapsed, setRailCollapsed] = useState16(defaultCollapsed);
8411
+ const [railExpanded, setRailExpanded] = useState16(false);
8007
8412
  const pageShiftActive = shouldApplyPageShift({
8008
8413
  pageShift,
8009
8414
  isMobile,
@@ -8058,7 +8463,7 @@ function AgentWidget({
8058
8463
  } : {},
8059
8464
  ...branding?.colors?.border ? { border: branding.colors.border } : {}
8060
8465
  };
8061
- useEffect11(() => {
8466
+ useEffect12(() => {
8062
8467
  if (!registerPanelController) return;
8063
8468
  registerAgentPanelController(customerId, {
8064
8469
  open: () => setRailCollapsed(false),
@@ -8093,7 +8498,7 @@ function AgentWidget({
8093
8498
  })
8094
8499
  );
8095
8500
  }
8096
- useEffect11(() => {
8501
+ useEffect12(() => {
8097
8502
  if (railCollapsed) return;
8098
8503
  const handleKeyDown = (event) => {
8099
8504
  if (event.key === "Tab" && (isMobile || railExpanded)) {
@@ -8127,19 +8532,19 @@ function AgentWidget({
8127
8532
  window.addEventListener("keydown", handleKeyDown);
8128
8533
  return () => window.removeEventListener("keydown", handleKeyDown);
8129
8534
  }, [isMobile, railCollapsed, railExpanded]);
8130
- return /* @__PURE__ */ jsxs19("div", { className: "webless-agent-root", children: [
8131
- /* @__PURE__ */ jsx20(
8535
+ return /* @__PURE__ */ jsxs20("div", { className: "webless-agent-root", children: [
8536
+ /* @__PURE__ */ jsx21(
8132
8537
  "div",
8133
8538
  {
8134
8539
  className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
8135
- children: /* @__PURE__ */ jsx20(
8540
+ children: /* @__PURE__ */ jsx21(
8136
8541
  "div",
8137
8542
  {
8138
8543
  ref: railSlotRef,
8139
8544
  className: "webless-agent-root__rail-slot",
8140
8545
  inert: railCollapsed || void 0,
8141
8546
  "aria-hidden": railCollapsed,
8142
- children: /* @__PURE__ */ jsx20(
8547
+ children: /* @__PURE__ */ jsx21(
8143
8548
  AgentRail,
8144
8549
  {
8145
8550
  theme,
@@ -8152,6 +8557,8 @@ function AgentWidget({
8152
8557
  disclaimerLink: branding?.disclaimerLink,
8153
8558
  answerReceipt: branding?.answerReceipt,
8154
8559
  readAloud: branding?.readAloud,
8560
+ showLearnMore: branding?.showLearnMore,
8561
+ showSources: branding?.showSources,
8155
8562
  state,
8156
8563
  handoff,
8157
8564
  mobileFullscreen: isMobile && !railCollapsed,
@@ -8177,7 +8584,7 @@ function AgentWidget({
8177
8584
  )
8178
8585
  }
8179
8586
  ),
8180
- railCollapsed ? /* @__PURE__ */ jsx20(
8587
+ railCollapsed ? /* @__PURE__ */ jsx21(
8181
8588
  AssistEdgeTab,
8182
8589
  {
8183
8590
  variant: placement.variant,
@@ -8238,4 +8645,4 @@ export {
8238
8645
  sendAgentAnswerFeedback,
8239
8646
  AgentWidget
8240
8647
  };
8241
- //# sourceMappingURL=chunk-HKQFEO6R.js.map
8648
+ //# sourceMappingURL=chunk-P6ZM4BIU.js.map