@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.
package/dist/embed.cjs CHANGED
@@ -64,7 +64,7 @@ function submitAgentPanel(customerId, message, options) {
64
64
  }
65
65
 
66
66
  // src/react/components/AgentWidget/AgentWidget.tsx
67
- var import_react18 = require("react");
67
+ var import_react20 = require("react");
68
68
 
69
69
  // src/react/page-shift.ts
70
70
  var import_react = require("react");
@@ -2632,7 +2632,12 @@ function parseAgentSearchReferences(value) {
2632
2632
  const url = safeSearchUrl(action.url);
2633
2633
  cta = { label: action.label.trim(), ...url ? { url } : {} };
2634
2634
  }
2635
- return { sources, ...cta ? { cta } : {} };
2635
+ const suggestions = Array.isArray(data.suggestions) && data.suggestions.length <= 8 && data.suggestions.every((item) => text2(item)) ? [...new Set(data.suggestions.map((item) => item.trim()))] : void 0;
2636
+ return {
2637
+ sources,
2638
+ ...cta ? { cta } : {},
2639
+ ...suggestions ? { suggestions } : {}
2640
+ };
2636
2641
  }
2637
2642
  function parseAgentSearchDiscoveryOutput(value) {
2638
2643
  let decoded = value;
@@ -3214,6 +3219,7 @@ function presentVisitorToolResult(result, registry = []) {
3214
3219
  status: "completed",
3215
3220
  kind: "search",
3216
3221
  sources: search.sources,
3222
+ suggestions: search.suggestions,
3217
3223
  ...search.cta ? { cta: search.cta } : {}
3218
3224
  };
3219
3225
  }
@@ -4215,7 +4221,7 @@ function normalizeAgentPlacement(placement) {
4215
4221
  }
4216
4222
 
4217
4223
  // src/react/components/AgentRail/AgentRail.tsx
4218
- var import_react16 = require("react");
4224
+ var import_react18 = require("react");
4219
4225
 
4220
4226
  // src/react/types/conversation.ts
4221
4227
  var defaultAgentRailTheme = {
@@ -4497,25 +4503,260 @@ function AgentActivityBubble({
4497
4503
  ] });
4498
4504
  }
4499
4505
 
4500
- // src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
4506
+ // src/react/components/LearnMore/LearnMore.tsx
4507
+ var import_react7 = require("react");
4508
+ var import_jsx_runtime2 = require("react/jsx-runtime");
4509
+ function QuestionIcon() {
4510
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4511
+ "svg",
4512
+ {
4513
+ viewBox: "0 0 24 24",
4514
+ width: "18",
4515
+ height: "18",
4516
+ fill: "none",
4517
+ stroke: "currentColor",
4518
+ strokeWidth: "1.5",
4519
+ strokeLinecap: "round",
4520
+ strokeLinejoin: "round",
4521
+ "aria-hidden": "true",
4522
+ children: [
4523
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z" }),
4524
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
4525
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M12 17h.01" })
4526
+ ]
4527
+ }
4528
+ );
4529
+ }
4530
+ function LearnMore({
4531
+ results,
4532
+ disabled,
4533
+ onSelect
4534
+ }) {
4535
+ const headingId = (0, import_react7.useId)();
4536
+ const panelId = (0, import_react7.useId)();
4537
+ const [open, setOpen] = (0, import_react7.useState)(true);
4538
+ const questions = [
4539
+ ...new Set(results.flatMap((result) => result.suggestions ?? []))
4540
+ ].slice(0, 3);
4541
+ if (!questions.length) return null;
4542
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("section", { className: "learn-more", "aria-labelledby": headingId, children: [
4543
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("h3", { id: headingId, className: "learn-more__heading", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4544
+ "button",
4545
+ {
4546
+ type: "button",
4547
+ className: "learn-more__toggle",
4548
+ "aria-expanded": open,
4549
+ "aria-controls": panelId,
4550
+ onClick: () => setOpen((current) => !current),
4551
+ children: [
4552
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { children: "Learn more" }),
4553
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4554
+ "svg",
4555
+ {
4556
+ className: "learn-more__chevron",
4557
+ viewBox: "0 0 16 16",
4558
+ fill: "none",
4559
+ "aria-hidden": "true",
4560
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4561
+ "path",
4562
+ {
4563
+ d: "M4 6.5l4 4 4-4",
4564
+ stroke: "currentColor",
4565
+ strokeWidth: "1.6",
4566
+ strokeLinecap: "round",
4567
+ strokeLinejoin: "round"
4568
+ }
4569
+ )
4570
+ }
4571
+ )
4572
+ ]
4573
+ }
4574
+ ) }),
4575
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4576
+ "div",
4577
+ {
4578
+ id: panelId,
4579
+ className: `learn-more__panel${open ? " learn-more__panel--open" : ""}`,
4580
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "learn-more__panel-inner", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("ul", { className: "learn-more__questions", children: questions.map((question) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4581
+ "button",
4582
+ {
4583
+ type: "button",
4584
+ disabled,
4585
+ onClick: () => onSelect(question),
4586
+ children: [
4587
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "learn-more__question-icon", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(QuestionIcon, {}) }),
4588
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", { className: "learn-more__question-text", children: question }),
4589
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4590
+ "svg",
4591
+ {
4592
+ className: "learn-more__question-arrow",
4593
+ viewBox: "0 0 24 24",
4594
+ fill: "none",
4595
+ stroke: "currentColor",
4596
+ strokeWidth: "1.5",
4597
+ "aria-hidden": "true",
4598
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { d: "M4 12h16m-7-7 7 7-7 7" })
4599
+ }
4600
+ )
4601
+ ]
4602
+ }
4603
+ ) }, question)) }) })
4604
+ }
4605
+ )
4606
+ ] });
4607
+ }
4608
+
4609
+ // src/react/components/SearchReferences/SearchReferences.tsx
4501
4610
  var import_react8 = require("react");
4611
+ var import_jsx_runtime3 = require("react/jsx-runtime");
4612
+ function SiteIcon() {
4613
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4614
+ "svg",
4615
+ {
4616
+ viewBox: "0 0 24 24",
4617
+ width: "18",
4618
+ height: "18",
4619
+ fill: "none",
4620
+ stroke: "currentColor",
4621
+ strokeWidth: "1.5",
4622
+ "aria-hidden": "true",
4623
+ children: [
4624
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
4625
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
4626
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
4627
+ ]
4628
+ }
4629
+ );
4630
+ }
4631
+ function SourceFavicon({ url }) {
4632
+ const [failed, setFailed] = (0, import_react8.useState)(false);
4633
+ let faviconUrl = null;
4634
+ if (url) {
4635
+ try {
4636
+ faviconUrl = `${new URL(url).origin}/favicon.ico`;
4637
+ } catch {
4638
+ faviconUrl = null;
4639
+ }
4640
+ }
4641
+ if (!faviconUrl || failed) return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SiteIcon, {});
4642
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4643
+ "img",
4644
+ {
4645
+ src: faviconUrl,
4646
+ alt: "",
4647
+ loading: "lazy",
4648
+ onError: () => setFailed(true)
4649
+ }
4650
+ );
4651
+ }
4652
+ function searchSources(results) {
4653
+ const seenSources = /* @__PURE__ */ new Set();
4654
+ return results.flatMap((result) => result.sources).flatMap((source) => {
4655
+ const url = safeSearchUrl(source.url);
4656
+ const key = url ?? source.id;
4657
+ if (seenSources.has(key)) return [];
4658
+ seenSources.add(key);
4659
+ return [{ ...source, url, key }];
4660
+ });
4661
+ }
4662
+ function SearchReferences({
4663
+ results,
4664
+ mode = "default"
4665
+ }) {
4666
+ const sources = searchSources(results);
4667
+ const seenActions = /* @__PURE__ */ new Set();
4668
+ const actions = results.flatMap((result) => {
4669
+ const url = safeSearchUrl(result.cta?.url);
4670
+ if (!url || !result.cta || seenActions.has(url)) return [];
4671
+ seenActions.add(url);
4672
+ return [{ label: result.cta.label, url }];
4673
+ });
4674
+ if (!(mode !== "actions" && sources.length) && !(mode !== "sources" && actions.length))
4675
+ return null;
4676
+ const Container = mode === "default" ? "details" : "div";
4677
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "search-references", children: [
4678
+ mode !== "actions" && sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4679
+ Container,
4680
+ {
4681
+ className: "search-references__disclosure",
4682
+ "aria-label": "Sources",
4683
+ children: [
4684
+ mode === "default" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("summary", { className: "search-references__heading", children: [
4685
+ "Sources (",
4686
+ sources.length,
4687
+ ")"
4688
+ ] }) : null,
4689
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
4690
+ const content = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
4691
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SourceFavicon, { url: source.url }) }),
4692
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4693
+ "span",
4694
+ {
4695
+ className: "search-references__title",
4696
+ title: source.title,
4697
+ children: source.title
4698
+ }
4699
+ ),
4700
+ source.url ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4701
+ "svg",
4702
+ {
4703
+ className: "search-references__row-arrow",
4704
+ viewBox: "0 0 24 24",
4705
+ fill: "none",
4706
+ stroke: "currentColor",
4707
+ strokeWidth: "1.5",
4708
+ "aria-hidden": "true",
4709
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M4 12h16m-7-7 7 7-7 7" })
4710
+ }
4711
+ ) : null
4712
+ ] });
4713
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4714
+ "a",
4715
+ {
4716
+ className: "search-references__source",
4717
+ href: source.url,
4718
+ target: "_blank",
4719
+ rel: "noopener noreferrer",
4720
+ children: content
4721
+ }
4722
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
4723
+ }) })
4724
+ ]
4725
+ }
4726
+ ) : null,
4727
+ mode !== "sources" && actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4728
+ "a",
4729
+ {
4730
+ className: "search-references__cta",
4731
+ href: action.url,
4732
+ target: "_blank",
4733
+ rel: "noopener noreferrer",
4734
+ children: action.label
4735
+ },
4736
+ action.url
4737
+ )) }) : null
4738
+ ] });
4739
+ }
4740
+
4741
+ // src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
4742
+ var import_react10 = require("react");
4502
4743
  var import_react_dom = require("react-dom");
4503
4744
 
4504
4745
  // src/react/components/AgentRail/AgentRailOverlayContext.tsx
4505
- var import_react7 = require("react");
4506
- var AgentRailOverlayContext = (0, import_react7.createContext)(null);
4746
+ var import_react9 = require("react");
4747
+ var AgentRailOverlayContext = (0, import_react9.createContext)(null);
4507
4748
  function useAgentRailPortalRoots() {
4508
- return (0, import_react7.useContext)(AgentRailOverlayContext);
4749
+ return (0, import_react9.useContext)(AgentRailOverlayContext);
4509
4750
  }
4510
4751
  function useAgentRailMenuPortalRoot() {
4511
- return (0, import_react7.useContext)(AgentRailOverlayContext)?.railRef ?? null;
4752
+ return (0, import_react9.useContext)(AgentRailOverlayContext)?.railRef ?? null;
4512
4753
  }
4513
4754
 
4514
4755
  // src/react/components/AnswerReceiptDialog/AnswerReceiptDialog.tsx
4515
- var import_jsx_runtime2 = require("react/jsx-runtime");
4756
+ var import_jsx_runtime4 = require("react/jsx-runtime");
4516
4757
  var FOCUSABLE_SELECTOR = 'button:not(:disabled), a[href], textarea:not(:disabled), input:not(:disabled), [tabindex]:not([tabindex="-1"])';
4517
4758
  function CloseIcon() {
4518
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4759
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4519
4760
  "path",
4520
4761
  {
4521
4762
  d: "M4 4l8 8M12 4l-8 8",
@@ -4528,14 +4769,18 @@ function CloseIcon() {
4528
4769
  function AnswerReceiptDialog({
4529
4770
  brandLabel = "",
4530
4771
  onClose,
4531
- steps
4772
+ steps = [],
4773
+ title = "How this answer was made",
4774
+ summary,
4775
+ children
4532
4776
  }) {
4777
+ const titleId = (0, import_react10.useId)();
4533
4778
  const portalRoots = useAgentRailPortalRoots();
4534
4779
  const overlayRoot = portalRoots?.overlayRef ?? null;
4535
- const cardRef = (0, import_react8.useRef)(null);
4536
- const closeButtonRef = (0, import_react8.useRef)(null);
4537
- const previouslyFocusedRef = (0, import_react8.useRef)(null);
4538
- (0, import_react8.useEffect)(() => {
4780
+ const cardRef = (0, import_react10.useRef)(null);
4781
+ const closeButtonRef = (0, import_react10.useRef)(null);
4782
+ const previouslyFocusedRef = (0, import_react10.useRef)(null);
4783
+ (0, import_react10.useEffect)(() => {
4539
4784
  previouslyFocusedRef.current = document.activeElement instanceof HTMLElement ? document.activeElement : null;
4540
4785
  closeButtonRef.current?.focus({ preventScroll: true });
4541
4786
  const handleKeyDown = (event) => {
@@ -4546,9 +4791,7 @@ function AnswerReceiptDialog({
4546
4791
  return;
4547
4792
  }
4548
4793
  if (event.key !== "Tab" || !cardRef.current) return;
4549
- const focusable = cardRef.current.querySelectorAll(
4550
- FOCUSABLE_SELECTOR
4551
- );
4794
+ const focusable = cardRef.current.querySelectorAll(FOCUSABLE_SELECTOR);
4552
4795
  if (focusable.length === 0) return;
4553
4796
  const first = focusable.item(0);
4554
4797
  const last = focusable.item(focusable.length - 1);
@@ -4566,8 +4809,8 @@ function AnswerReceiptDialog({
4566
4809
  previouslyFocusedRef.current?.focus({ preventScroll: true });
4567
4810
  };
4568
4811
  }, [onClose]);
4569
- const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "agent-receipt-dialog", children: [
4570
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4812
+ const content = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "agent-receipt-dialog", children: [
4813
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4571
4814
  "button",
4572
4815
  {
4573
4816
  type: "button",
@@ -4577,25 +4820,18 @@ function AnswerReceiptDialog({
4577
4820
  onClick: onClose
4578
4821
  }
4579
4822
  ),
4580
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
4823
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
4581
4824
  "div",
4582
4825
  {
4583
4826
  ref: cardRef,
4584
4827
  className: "agent-receipt-dialog__card",
4585
4828
  role: "dialog",
4586
4829
  "aria-modal": "true",
4587
- "aria-labelledby": "agent-receipt-dialog-title",
4830
+ "aria-labelledby": titleId,
4588
4831
  children: [
4589
- /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: "agent-receipt-dialog__header", children: [
4590
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4591
- "p",
4592
- {
4593
- className: "agent-receipt-dialog__title",
4594
- id: "agent-receipt-dialog-title",
4595
- children: "How this answer was made"
4596
- }
4597
- ),
4598
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
4832
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "agent-receipt-dialog__header", children: [
4833
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "agent-receipt-dialog__title", id: titleId, children: title }),
4834
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
4599
4835
  "button",
4600
4836
  {
4601
4837
  ref: closeButtonRef,
@@ -4603,12 +4839,12 @@ function AnswerReceiptDialog({
4603
4839
  className: "agent-receipt-dialog__close",
4604
4840
  "aria-label": "Close",
4605
4841
  onClick: onClose,
4606
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CloseIcon, {})
4842
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CloseIcon, {})
4607
4843
  }
4608
4844
  )
4609
4845
  ] }),
4610
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("p", { className: "agent-receipt-dialog__summary", children: workSummary(steps, false, brandLabel) }),
4611
- /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "agent-receipt-dialog__body", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(AgentWorkSteps, { brandLabel, steps }) })
4846
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "agent-receipt-dialog__summary", children: summary ?? workSummary(steps, false, brandLabel) }),
4847
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "agent-receipt-dialog__body", children: children ?? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(AgentWorkSteps, { brandLabel, steps }) })
4612
4848
  ]
4613
4849
  }
4614
4850
  )
@@ -4620,11 +4856,11 @@ function AnswerReceiptDialog({
4620
4856
  }
4621
4857
 
4622
4858
  // src/react/components/Composer/Composer.tsx
4623
- var import_react9 = require("react");
4624
- var import_jsx_runtime3 = require("react/jsx-runtime");
4859
+ var import_react11 = require("react");
4860
+ var import_jsx_runtime5 = require("react/jsx-runtime");
4625
4861
  var FORM_SUBMITTED_MESSAGE = "Shared my details";
4626
4862
  function SendIcon() {
4627
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4863
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4628
4864
  "path",
4629
4865
  {
4630
4866
  d: "M8 12V4M8 4l-3 3M8 4l3 3",
@@ -4636,7 +4872,7 @@ function SendIcon() {
4636
4872
  ) });
4637
4873
  }
4638
4874
  function CheckIcon() {
4639
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4875
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 12 12", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4640
4876
  "path",
4641
4877
  {
4642
4878
  d: "M2.5 6.2l2.3 2.3 4.7-5",
@@ -4648,7 +4884,7 @@ function CheckIcon() {
4648
4884
  ) });
4649
4885
  }
4650
4886
  function CollapseIcon() {
4651
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4887
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4652
4888
  "path",
4653
4889
  {
4654
4890
  d: "M4 10l4-4 4 4",
@@ -4682,21 +4918,35 @@ function Composer({
4682
4918
  allowFormResume = true,
4683
4919
  onSubmit
4684
4920
  }) {
4685
- const [value, setValue] = (0, import_react9.useState)("");
4686
- const [draft, setDraft] = (0, import_react9.useState)(() => createDraft(form));
4687
- const inputRef = (0, import_react9.useRef)(null);
4688
- const firstFieldRef = (0, import_react9.useRef)(null);
4689
- const formRef = (0, import_react9.useRef)(null);
4690
- const formId = (0, import_react9.useId)();
4921
+ const [value, setValue] = (0, import_react11.useState)("");
4922
+ const [draft, setDraft] = (0, import_react11.useState)(() => createDraft(form));
4923
+ const [multiline, setMultiline] = (0, import_react11.useState)(false);
4924
+ const inputRef = (0, import_react11.useRef)(null);
4925
+ const firstFieldRef = (0, import_react11.useRef)(null);
4926
+ const formRef = (0, import_react11.useRef)(null);
4927
+ const formId = (0, import_react11.useId)();
4691
4928
  if (form && form.id !== draft.form?.id) setDraft(createDraft(form));
4692
4929
  const savedForm = allowFormResume && !draft.submitted ? draft.form : null;
4693
4930
  const activeForm = !disabled && draft.expanded ? savedForm : null;
4694
4931
  const canSend = !disabled && Boolean(value.trim() || activeForm);
4695
- (0, import_react9.useEffect)(() => {
4932
+ (0, import_react11.useEffect)(() => {
4696
4933
  if (activeForm) firstFieldRef.current?.focus();
4697
4934
  else if ((savedForm || draft.submitted) && !disabled)
4698
4935
  inputRef.current?.focus();
4699
4936
  }, [activeForm?.id, disabled, savedForm?.id, draft.submitted]);
4937
+ (0, import_react11.useEffect)(() => {
4938
+ const input = inputRef.current;
4939
+ if (!input) return;
4940
+ const check = () => {
4941
+ const style = window.getComputedStyle(input);
4942
+ const singleLine = (parseFloat(style.lineHeight) || 20) + parseFloat(style.paddingTop) + parseFloat(style.paddingBottom) + 2;
4943
+ setMultiline(input.offsetHeight > singleLine);
4944
+ };
4945
+ check();
4946
+ const observer = new ResizeObserver(check);
4947
+ observer.observe(input);
4948
+ return () => observer.disconnect();
4949
+ }, []);
4700
4950
  function collapseForm() {
4701
4951
  setDraft((current) => ({ ...current, expanded: false }));
4702
4952
  }
@@ -4766,8 +5016,8 @@ function Composer({
4766
5016
  submitForm();
4767
5017
  }
4768
5018
  }
4769
- const chatField = /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_jsx_runtime3.Fragment, { children: [
4770
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5019
+ const chatField = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
5020
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4771
5021
  "textarea",
4772
5022
  {
4773
5023
  ref: inputRef,
@@ -4782,18 +5032,18 @@ function Composer({
4782
5032
  onKeyDown: handleChatKeyDown
4783
5033
  }
4784
5034
  ),
4785
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5035
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4786
5036
  "button",
4787
5037
  {
4788
5038
  type: "submit",
4789
5039
  className: "composer__send",
4790
5040
  disabled: !canSend,
4791
5041
  "aria-label": "Send message",
4792
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(SendIcon, {})
5042
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SendIcon, {})
4793
5043
  }
4794
5044
  )
4795
5045
  ] });
4796
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
5046
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4797
5047
  "form",
4798
5048
  {
4799
5049
  ref: formRef,
@@ -4801,13 +5051,14 @@ function Composer({
4801
5051
  className: [
4802
5052
  "composer",
4803
5053
  variant === "dock" ? "composer--dock" : "",
4804
- activeForm ? "composer--form" : ""
5054
+ activeForm ? "composer--form" : "",
5055
+ multiline ? "composer--multiline" : ""
4805
5056
  ].filter(Boolean).join(" "),
4806
5057
  onSubmit: handleSubmit,
4807
5058
  children: [
4808
- savedForm ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "composer__resume", children: [
4809
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Share your details and we'll reach out shortly" }),
4810
- !activeForm ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5059
+ savedForm ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "composer__resume", children: [
5060
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Share your details and we'll reach out shortly" }),
5061
+ !activeForm ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4811
5062
  "button",
4812
5063
  {
4813
5064
  type: "button",
@@ -4817,17 +5068,17 @@ function Composer({
4817
5068
  }
4818
5069
  ) : null
4819
5070
  ] }) : null,
4820
- activeForm ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
5071
+ activeForm ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4821
5072
  "div",
4822
5073
  {
4823
5074
  className: "composer__sheet",
4824
5075
  role: "group",
4825
5076
  "aria-label": "Contact details",
4826
5077
  children: [
4827
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "composer__form-heading", children: [
4828
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("strong", { children: "Share your details" }),
4829
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: "Optional" }),
4830
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5078
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "composer__form-heading", children: [
5079
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("strong", { children: "Share your details" }),
5080
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Optional" }),
5081
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4831
5082
  "button",
4832
5083
  {
4833
5084
  type: "button",
@@ -4835,11 +5086,11 @@ function Composer({
4835
5086
  "aria-label": "Collapse form",
4836
5087
  disabled,
4837
5088
  onClick: collapseForm,
4838
- children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CollapseIcon, {})
5089
+ children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CollapseIcon, {})
4839
5090
  }
4840
5091
  )
4841
5092
  ] }),
4842
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "composer__fields", children: activeForm.fields.map((field, index) => {
5093
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "composer__fields", children: activeForm.fields.map((field, index) => {
4843
5094
  const fieldId = `${formId}-${field.id}`;
4844
5095
  const fieldValue = draft.values[field.id] ?? "";
4845
5096
  const invalid = draft.attempted && !isValidComposerFieldValue(field, fieldValue);
@@ -4864,7 +5115,7 @@ function Composer({
4864
5115
  },
4865
5116
  onKeyDown: handleFormKeyDown
4866
5117
  };
4867
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
5118
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4868
5119
  "div",
4869
5120
  {
4870
5121
  className: [
@@ -4872,9 +5123,9 @@ function Composer({
4872
5123
  field.kind === "textarea" ? "composer__row--area" : ""
4873
5124
  ].filter(Boolean).join(" "),
4874
5125
  children: [
4875
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "composer__line", children: [
4876
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("label", { className: "composer__label", htmlFor: fieldId, children: field.label }),
4877
- field.kind === "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5126
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "composer__line", children: [
5127
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("label", { className: "composer__label", htmlFor: fieldId, children: field.label }),
5128
+ field.kind === "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4878
5129
  "textarea",
4879
5130
  {
4880
5131
  ...controlProps,
@@ -4884,7 +5135,7 @@ function Composer({
4884
5135
  className: "composer__control composer__control--area",
4885
5136
  rows: 2
4886
5137
  }
4887
- ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
5138
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4888
5139
  "input",
4889
5140
  {
4890
5141
  ...controlProps,
@@ -4896,25 +5147,25 @@ function Composer({
4896
5147
  inputMode: field.kind === "tel" ? "tel" : void 0
4897
5148
  }
4898
5149
  ),
4899
- complete && field.kind !== "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "composer__check", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(CheckIcon, {}) }) : null
5150
+ complete && field.kind !== "textarea" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "composer__check", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(CheckIcon, {}) }) : null
4900
5151
  ] }),
4901
- invalid ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("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
5152
+ invalid ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("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
4902
5153
  ]
4903
5154
  },
4904
5155
  field.id
4905
5156
  );
4906
5157
  }) }),
4907
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "composer__field composer__field--inset", children: chatField })
5158
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "composer__field composer__field--inset", children: chatField })
4908
5159
  ]
4909
5160
  }
4910
- ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "composer__field", children: chatField })
5161
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "composer__field", children: chatField })
4911
5162
  ]
4912
5163
  }
4913
5164
  );
4914
5165
  }
4915
5166
 
4916
5167
  // src/react/components/FollowUpChips/FollowUpChips.tsx
4917
- var import_jsx_runtime4 = require("react/jsx-runtime");
5168
+ var import_jsx_runtime6 = require("react/jsx-runtime");
4918
5169
  function FollowUpChips({
4919
5170
  suggestions,
4920
5171
  disabled = false,
@@ -4924,7 +5175,7 @@ function FollowUpChips({
4924
5175
  }) {
4925
5176
  if (suggestions.length === 0) return null;
4926
5177
  if (variant === "dock") {
4927
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "followups followups--dock", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "followups__scroll", children: suggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5178
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "followups followups--dock", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "followups__scroll", children: suggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4928
5179
  "button",
4929
5180
  {
4930
5181
  type: "button",
@@ -4936,9 +5187,9 @@ function FollowUpChips({
4936
5187
  suggestion.id
4937
5188
  )) }) });
4938
5189
  }
4939
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "followups", children: [
4940
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "followups__label", children: label }),
4941
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "followups__list", children: suggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5190
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "followups", children: [
5191
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "followups__label", children: label }),
5192
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "followups__list", children: suggestions.map((suggestion) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4942
5193
  "button",
4943
5194
  {
4944
5195
  type: "button",
@@ -4953,99 +5204,11 @@ function FollowUpChips({
4953
5204
  }
4954
5205
 
4955
5206
  // src/react/components/MessageBubble/MessageBubble.tsx
4956
- var import_react11 = require("react");
4957
-
4958
- // src/react/components/SearchReferences/SearchReferences.tsx
4959
- var import_jsx_runtime5 = require("react/jsx-runtime");
4960
- function SiteIcon() {
4961
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4962
- "svg",
4963
- {
4964
- viewBox: "0 0 24 24",
4965
- width: "18",
4966
- height: "18",
4967
- fill: "none",
4968
- stroke: "currentColor",
4969
- strokeWidth: "1.5",
4970
- "aria-hidden": "true",
4971
- children: [
4972
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
4973
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
4974
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
4975
- ]
4976
- }
4977
- );
4978
- }
4979
- function SearchReferences({
4980
- results
4981
- }) {
4982
- const seenSources = /* @__PURE__ */ new Set();
4983
- const sources = results.flatMap((result) => result.sources).flatMap((source) => {
4984
- const url = safeSearchUrl(source.url);
4985
- const key = url ?? source.id;
4986
- if (seenSources.has(key)) return [];
4987
- seenSources.add(key);
4988
- return [{ ...source, url, key }];
4989
- });
4990
- const seenActions = /* @__PURE__ */ new Set();
4991
- const actions = results.flatMap((result) => {
4992
- const url = safeSearchUrl(result.cta?.url);
4993
- if (!url || !result.cta || seenActions.has(url)) return [];
4994
- seenActions.add(url);
4995
- return [{ label: result.cta.label, url }];
4996
- });
4997
- if (!sources.length && !actions.length) return null;
4998
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "search-references", children: [
4999
- sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("details", { className: "search-references__disclosure", "aria-label": "Sources", children: [
5000
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("summary", { className: "search-references__heading", children: [
5001
- "Sources (",
5002
- sources.length,
5003
- ")"
5004
- ] }),
5005
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
5006
- const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
5007
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SiteIcon, {}) }),
5008
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "search-references__copy", children: [
5009
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5010
- "span",
5011
- {
5012
- className: "search-references__title",
5013
- title: source.title,
5014
- children: source.title
5015
- }
5016
- ),
5017
- source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__domain", children: new URL(source.url).hostname.replace(/^www\./u, "") }) : null
5018
- ] })
5019
- ] });
5020
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5021
- "a",
5022
- {
5023
- className: "search-references__source",
5024
- href: source.url,
5025
- target: "_blank",
5026
- rel: "noopener noreferrer",
5027
- children: content
5028
- }
5029
- ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
5030
- }) })
5031
- ] }) : null,
5032
- actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5033
- "a",
5034
- {
5035
- className: "search-references__cta",
5036
- href: action.url,
5037
- target: "_blank",
5038
- rel: "noopener noreferrer",
5039
- children: action.label
5040
- },
5041
- action.url
5042
- )) }) : null
5043
- ] });
5044
- }
5207
+ var import_react13 = require("react");
5045
5208
 
5046
5209
  // src/react/components/BookingCard/BookingCard.tsx
5047
- var import_react10 = require("react");
5048
- var import_jsx_runtime6 = require("react/jsx-runtime");
5210
+ var import_react12 = require("react");
5211
+ var import_jsx_runtime7 = require("react/jsx-runtime");
5049
5212
  var BOOKING_STEPS = [
5050
5213
  { id: "date", label: "Date" },
5051
5214
  { id: "time", label: "Time" },
@@ -5076,22 +5239,22 @@ function calendarCells(year, month) {
5076
5239
  return cells;
5077
5240
  }
5078
5241
  function BookingCardLoader() {
5079
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
5242
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
5080
5243
  }
5081
5244
  function BookingCard(props) {
5082
- if (!props.readOnly) return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(InteractiveBookingCard, { ...props });
5083
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("section", { className: "booking-card", "aria-label": "Recorded available times", children: [
5084
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: "Available times offered" }),
5085
- props.offer.slots.length ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { children: props.offer.slots.map((slot, index) => {
5245
+ if (!props.readOnly) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(InteractiveBookingCard, { ...props });
5246
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("section", { className: "booking-card", "aria-label": "Recorded available times", children: [
5247
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__title", children: "Available times offered" }),
5248
+ props.offer.slots.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { children: props.offer.slots.map((slot, index) => {
5086
5249
  const eventType = props.offer.eventTypes.find(
5087
5250
  (item) => item.uri === slot.eventTypeUri
5088
5251
  );
5089
5252
  const label = Number.isFinite(Date.parse(slot.startTime)) ? formatSlotLabel(slot.startTime) : "Time unavailable";
5090
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("li", { children: [
5253
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("li", { children: [
5091
5254
  eventType ? `${eventType.name} \xB7 ` : "",
5092
5255
  label
5093
5256
  ] }, `${slot.eventTypeUri ?? ""}:${slot.startTime}:${index}`);
5094
- }) }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { children: "No available times were recorded." })
5257
+ }) }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: "No available times were recorded." })
5095
5258
  ] });
5096
5259
  }
5097
5260
  function InteractiveBookingCard({
@@ -5099,27 +5262,27 @@ function InteractiveBookingCard({
5099
5262
  offer,
5100
5263
  onBook
5101
5264
  }) {
5102
- const fieldId = (0, import_react10.useId)();
5265
+ const fieldId = (0, import_react12.useId)();
5103
5266
  const defaultType = offer.eventTypes[0]?.uri ?? offer.slots[0]?.eventTypeUri ?? "";
5104
- const [step, setStep] = (0, import_react10.useState)("date");
5105
- const [eventTypeUri, setEventTypeUri] = (0, import_react10.useState)(defaultType);
5106
- const [selectedDate, setSelectedDate] = (0, import_react10.useState)("");
5107
- const [startTime, setStartTime] = (0, import_react10.useState)("");
5108
- const [name, setName] = (0, import_react10.useState)("");
5109
- const [email, setEmail] = (0, import_react10.useState)("");
5110
- const activeStepRef = (0, import_react10.useRef)(null);
5111
- const previousStepRef = (0, import_react10.useRef)(step);
5267
+ const [step, setStep] = (0, import_react12.useState)("date");
5268
+ const [eventTypeUri, setEventTypeUri] = (0, import_react12.useState)(defaultType);
5269
+ const [selectedDate, setSelectedDate] = (0, import_react12.useState)("");
5270
+ const [startTime, setStartTime] = (0, import_react12.useState)("");
5271
+ const [name, setName] = (0, import_react12.useState)("");
5272
+ const [email, setEmail] = (0, import_react12.useState)("");
5273
+ const activeStepRef = (0, import_react12.useRef)(null);
5274
+ const previousStepRef = (0, import_react12.useRef)(step);
5112
5275
  const stepIndex = BOOKING_STEPS.findIndex((item) => item.id === step);
5113
- (0, import_react10.useEffect)(() => {
5276
+ (0, import_react12.useEffect)(() => {
5114
5277
  if (previousStepRef.current === step) return;
5115
5278
  previousStepRef.current = step;
5116
5279
  activeStepRef.current?.scrollIntoView({ block: "nearest" });
5117
5280
  }, [step]);
5118
- const slots = (0, import_react10.useMemo)(
5281
+ const slots = (0, import_react12.useMemo)(
5119
5282
  () => bookingSlotsForEventType(offer.slots, eventTypeUri),
5120
5283
  [eventTypeUri, offer.slots]
5121
5284
  );
5122
- const availableByDate = (0, import_react10.useMemo)(() => {
5285
+ const availableByDate = (0, import_react12.useMemo)(() => {
5123
5286
  const next = /* @__PURE__ */ new Map();
5124
5287
  for (const slot of slots) {
5125
5288
  const key = slotDateKey(slot.startTime);
@@ -5127,7 +5290,7 @@ function InteractiveBookingCard({
5127
5290
  }
5128
5291
  return next;
5129
5292
  }, [slots]);
5130
- const [visibleMonth, setVisibleMonth] = (0, import_react10.useState)(
5293
+ const [visibleMonth, setVisibleMonth] = (0, import_react12.useState)(
5131
5294
  () => firstAvailableBookingMonth(slots)
5132
5295
  );
5133
5296
  function selectEventType(nextType) {
@@ -5140,7 +5303,7 @@ function InteractiveBookingCard({
5140
5303
  )
5141
5304
  );
5142
5305
  }
5143
- const daySlots = (0, import_react10.useMemo)(
5306
+ const daySlots = (0, import_react12.useMemo)(
5144
5307
  () => slots.filter((slot) => slotDateKey(slot.startTime) === selectedDate),
5145
5308
  [selectedDate, slots]
5146
5309
  );
@@ -5149,7 +5312,7 @@ function InteractiveBookingCard({
5149
5312
  );
5150
5313
  const selectedSample = availableByDate.get(selectedDate) ?? startTime;
5151
5314
  const timeZone = formatSlotTimeZone(slots[0]?.startTime ?? selectedSample);
5152
- const weekdays = (0, import_react10.useMemo)(() => weekdayLabels(), []);
5315
+ const weekdays = (0, import_react12.useMemo)(() => weekdayLabels(), []);
5153
5316
  const cells = calendarCells(visibleMonth.year, visibleMonth.month);
5154
5317
  const canPrevMonth = [...availableByDate.keys()].some((key) => {
5155
5318
  const month = monthFromKey(key);
@@ -5191,14 +5354,14 @@ function InteractiveBookingCard({
5191
5354
  })
5192
5355
  });
5193
5356
  }
5194
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5357
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5195
5358
  "section",
5196
5359
  {
5197
5360
  className: "booking-card",
5198
5361
  "aria-busy": disabled || void 0,
5199
5362
  "aria-label": "Book a meeting",
5200
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
5201
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ol", { className: "booking-card__steps", "aria-label": "Booking steps", children: BOOKING_STEPS.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5363
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
5364
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ol", { className: "booking-card__steps", "aria-label": "Booking steps", children: BOOKING_STEPS.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5202
5365
  "li",
5203
5366
  {
5204
5367
  className: [
@@ -5208,40 +5371,40 @@ function InteractiveBookingCard({
5208
5371
  ].filter(Boolean).join(" "),
5209
5372
  "aria-current": index === stepIndex ? "step" : void 0,
5210
5373
  children: [
5211
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", children: index + 1 }),
5212
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: item.label })
5374
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", children: index + 1 }),
5375
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: item.label })
5213
5376
  ]
5214
5377
  },
5215
5378
  item.id
5216
5379
  )) }),
5217
- step === "date" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
5218
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
5219
- timeZone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "booking-card__tz", children: [
5380
+ step === "date" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
5381
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
5382
+ timeZone ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "booking-card__tz", children: [
5220
5383
  "Times in ",
5221
5384
  timeZone
5222
5385
  ] }) : null,
5223
- offer.eventTypes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5386
+ offer.eventTypes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5224
5387
  "label",
5225
5388
  {
5226
5389
  className: "booking-card__field",
5227
5390
  htmlFor: `${fieldId}-type`,
5228
5391
  children: [
5229
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Meeting" }),
5230
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5392
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Meeting" }),
5393
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5231
5394
  "select",
5232
5395
  {
5233
5396
  id: `${fieldId}-type`,
5234
5397
  value: eventTypeUri,
5235
5398
  disabled,
5236
5399
  onChange: (event) => selectEventType(event.target.value),
5237
- children: offer.eventTypes.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: item.uri, children: item.name }, item.uri))
5400
+ children: offer.eventTypes.map((item) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: item.uri, children: item.name }, item.uri))
5238
5401
  }
5239
5402
  )
5240
5403
  ]
5241
5404
  }
5242
5405
  ) : null,
5243
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__month", children: [
5244
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5406
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__month", children: [
5407
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5245
5408
  "button",
5246
5409
  {
5247
5410
  type: "button",
@@ -5252,8 +5415,8 @@ function InteractiveBookingCard({
5252
5415
  children: "\u2039"
5253
5416
  }
5254
5417
  ),
5255
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
5256
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5418
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
5419
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5257
5420
  "button",
5258
5421
  {
5259
5422
  type: "button",
@@ -5265,9 +5428,9 @@ function InteractiveBookingCard({
5265
5428
  }
5266
5429
  )
5267
5430
  ] }),
5268
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "booking-card__weekdays", children: weekdays.map((label) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: label }, label)) }),
5269
- offer.slots.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
5270
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5431
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "booking-card__weekdays", children: weekdays.map((label) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: label }, label)) }),
5432
+ offer.slots.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
5433
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5271
5434
  "div",
5272
5435
  {
5273
5436
  className: "booking-card__calendar",
@@ -5275,7 +5438,7 @@ function InteractiveBookingCard({
5275
5438
  "aria-label": "Available dates",
5276
5439
  children: cells.map((cell, index) => {
5277
5440
  if (!cell) {
5278
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5441
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5279
5442
  "span",
5280
5443
  {
5281
5444
  className: "booking-card__day"
@@ -5285,7 +5448,7 @@ function InteractiveBookingCard({
5285
5448
  }
5286
5449
  const available = availableByDate.has(cell.key);
5287
5450
  const selected = cell.key === selectedDate;
5288
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5451
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5289
5452
  "button",
5290
5453
  {
5291
5454
  type: "button",
@@ -5305,9 +5468,9 @@ function InteractiveBookingCard({
5305
5468
  }
5306
5469
  )
5307
5470
  ] }, "date") : null,
5308
- step === "time" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
5309
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step-bar", children: [
5310
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5471
+ step === "time" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
5472
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__step-bar", children: [
5473
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5311
5474
  "button",
5312
5475
  {
5313
5476
  type: "button",
@@ -5318,15 +5481,15 @@ function InteractiveBookingCard({
5318
5481
  children: "\u2039"
5319
5482
  }
5320
5483
  ),
5321
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
5322
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
5323
- timeZone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "booking-card__tz", children: [
5484
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
5485
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
5486
+ timeZone ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "booking-card__tz", children: [
5324
5487
  "Times in ",
5325
5488
  timeZone
5326
5489
  ] }) : null
5327
5490
  ] })
5328
5491
  ] }),
5329
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5492
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5330
5493
  "button",
5331
5494
  {
5332
5495
  type: "button",
@@ -5338,9 +5501,9 @@ function InteractiveBookingCard({
5338
5501
  slot.startTime
5339
5502
  )) })
5340
5503
  ] }, "time") : null,
5341
- step === "details" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
5342
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step-bar", children: [
5343
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5504
+ step === "details" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
5505
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__step-bar", children: [
5506
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5344
5507
  "button",
5345
5508
  {
5346
5509
  type: "button",
@@ -5351,21 +5514,21 @@ function InteractiveBookingCard({
5351
5514
  children: "\u2039"
5352
5515
  }
5353
5516
  ),
5354
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
5355
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: "Enter details" }),
5356
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
5357
- selectedType?.location ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__tz", children: selectedType.location }) : null
5517
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
5518
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__title", children: "Enter details" }),
5519
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
5520
+ selectedType?.location ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "booking-card__tz", children: selectedType.location }) : null
5358
5521
  ] })
5359
5522
  ] }),
5360
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__identity", children: [
5361
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5523
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "booking-card__identity", children: [
5524
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5362
5525
  "label",
5363
5526
  {
5364
5527
  className: "booking-card__field",
5365
5528
  htmlFor: `${fieldId}-name`,
5366
5529
  children: [
5367
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Name" }),
5368
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5530
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Name" }),
5531
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5369
5532
  "input",
5370
5533
  {
5371
5534
  id: `${fieldId}-name`,
@@ -5379,14 +5542,14 @@ function InteractiveBookingCard({
5379
5542
  ]
5380
5543
  }
5381
5544
  ),
5382
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5545
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5383
5546
  "label",
5384
5547
  {
5385
5548
  className: "booking-card__field",
5386
5549
  htmlFor: `${fieldId}-email`,
5387
5550
  children: [
5388
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Email" }),
5389
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5551
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Email" }),
5552
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5390
5553
  "input",
5391
5554
  {
5392
5555
  id: `${fieldId}-email`,
@@ -5402,7 +5565,7 @@ function InteractiveBookingCard({
5402
5565
  }
5403
5566
  )
5404
5567
  ] }),
5405
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5568
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5406
5569
  "button",
5407
5570
  {
5408
5571
  type: "submit",
@@ -5420,6 +5583,37 @@ function InteractiveBookingCard({
5420
5583
  // src/react/components/MessageBubble/MessageBubble.tsx
5421
5584
  var import_streamdown = require("streamdown");
5422
5585
 
5586
+ // src/react/lib/brand-logo-display.ts
5587
+ var BRAND_LOGO_LAYOUT = {
5588
+ header: { maxHeight: 20, maxWidth: 96, square: 24 },
5589
+ message: { maxHeight: 18, maxWidth: 80, square: 22 },
5590
+ /** Bottom/mobile launcher pill orb — keep in sync with AssistEdgeTab chip CSS. */
5591
+ launcher: { maxHeight: 24, maxWidth: 104, square: 38 }
5592
+ };
5593
+ function isWideBrandLogo(naturalWidth, naturalHeight) {
5594
+ return naturalWidth > naturalHeight * 1.4;
5595
+ }
5596
+ function snapBrandLogoDisplaySize(input) {
5597
+ const { maxHeight, maxWidth } = BRAND_LOGO_LAYOUT[input.surface];
5598
+ const { naturalWidth, naturalHeight } = input;
5599
+ if (naturalWidth <= 0 || naturalHeight <= 0) {
5600
+ return { width: maxWidth, height: maxHeight, wide: false };
5601
+ }
5602
+ const wide = isWideBrandLogo(naturalWidth, naturalHeight);
5603
+ if (!wide) {
5604
+ const size = BRAND_LOGO_LAYOUT[input.surface].square;
5605
+ return { width: size, height: size, wide: false };
5606
+ }
5607
+ const scale = Math.min(
5608
+ maxHeight / naturalHeight,
5609
+ maxWidth / naturalWidth,
5610
+ 1
5611
+ );
5612
+ const height = Math.max(1, Math.round(naturalHeight * scale));
5613
+ const width = Math.max(1, Math.round(naturalWidth * scale));
5614
+ return { width, height, wide: true };
5615
+ }
5616
+
5423
5617
  // src/react/lib/resolve-message-url.ts
5424
5618
  function resolveMessageUrl(safeUrl, baseUrl) {
5425
5619
  if (!safeUrl || !baseUrl) return safeUrl;
@@ -5434,7 +5628,7 @@ function resolveMessageUrl(safeUrl, baseUrl) {
5434
5628
 
5435
5629
  // src/react/components/MessageBubble/MessageBubble.tsx
5436
5630
  var import_styles = require("streamdown/styles.css");
5437
- var import_jsx_runtime7 = require("react/jsx-runtime");
5631
+ var import_jsx_runtime8 = require("react/jsx-runtime");
5438
5632
  function normalizeDedupeText(text3) {
5439
5633
  return text3.trim().replace(/\s+/g, " ").toLowerCase();
5440
5634
  }
@@ -5475,13 +5669,21 @@ function MessageBubble({
5475
5669
  brandLogoUrl,
5476
5670
  bookingDisabled = false,
5477
5671
  showProvenance = false,
5672
+ showSearchReferences = true,
5478
5673
  bookingReadOnly = false,
5479
5674
  linkBaseUrl,
5480
5675
  offer,
5481
5676
  onBook
5482
5677
  }) {
5483
5678
  const resolvedLogoUrl = brandLogoUrl?.trim();
5484
- const [failedLogoUrl, setFailedLogoUrl] = (0, import_react11.useState)(null);
5679
+ const [failedLogoUrl, setFailedLogoUrl] = (0, import_react13.useState)(null);
5680
+ const [logoDisplay, setLogoDisplay] = (0, import_react13.useState)(null);
5681
+ (0, import_react13.useEffect)(() => {
5682
+ setFailedLogoUrl(null);
5683
+ }, [resolvedLogoUrl]);
5684
+ const activeLogoDisplay = logoDisplay?.url === resolvedLogoUrl ? logoDisplay : null;
5685
+ const wideLogo = activeLogoDisplay?.wide ?? false;
5686
+ const logoDisplaySize = activeLogoDisplay ? { height: activeLogoDisplay.height, width: activeLogoDisplay.width } : null;
5485
5687
  const showBrandLogo = Boolean(resolvedLogoUrl) && failedLogoUrl !== resolvedLogoUrl;
5486
5688
  const cards = message.role === "agent" ? extractToolCards(message.text) : [];
5487
5689
  const extractedOffers = cards.filter(
@@ -5496,38 +5698,38 @@ function MessageBubble({
5496
5698
  if (message.role === "visitor") {
5497
5699
  const visitorText = visitorMessageDisplayText(message).trim();
5498
5700
  if (!visitorText) return null;
5499
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5701
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
5500
5702
  "article",
5501
5703
  {
5502
5704
  className: "message-bubble message-bubble--visitor",
5503
5705
  "aria-label": "Message from visitor",
5504
5706
  children: [
5505
- showProvenance ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "message-bubble__speaker", children: "You \xB7 Visitor" }) : null,
5506
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "message-bubble__text", children: visitorText })
5707
+ showProvenance ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "message-bubble__speaker", children: "You" }) : null,
5708
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "message-bubble__text", children: visitorText })
5507
5709
  ]
5508
5710
  }
5509
5711
  );
5510
5712
  }
5511
5713
  if (message.role === "human") {
5512
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5714
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
5513
5715
  "article",
5514
5716
  {
5515
5717
  className: "message-bubble message-bubble--human",
5516
5718
  "aria-label": `Message from ${message.representative.name}`,
5517
5719
  children: [
5518
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("strong", { className: "message-bubble__representative", children: [
5720
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("strong", { className: "message-bubble__representative", children: [
5519
5721
  message.representative.name,
5520
5722
  " ",
5521
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: "Human representative" })
5723
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: "Human representative" })
5522
5724
  ] }),
5523
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "message-bubble__text", children: message.text })
5725
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "message-bubble__text", children: message.text })
5524
5726
  ]
5525
5727
  }
5526
5728
  );
5527
5729
  }
5528
5730
  const citations = message.citations ?? [];
5529
- const agentText = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__text", children: [
5530
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5731
+ const agentText = /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "message-bubble__text", children: [
5732
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5531
5733
  import_streamdown.Streamdown,
5532
5734
  {
5533
5735
  animated: false,
@@ -5545,9 +5747,9 @@ function MessageBubble({
5545
5747
  children: displayText
5546
5748
  }
5547
5749
  ),
5548
- !isStreaming ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchReferences, { results: message.searchResults ?? [] }) : null,
5549
- !isStreaming && citations.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: "message-bubble__sources", "aria-label": "Sources", children: citations.map((citation) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("a", { href: citation.url, target: "_blank", rel: "noreferrer", children: [
5550
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5750
+ !isStreaming && showSearchReferences ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SearchReferences, { results: message.searchResults ?? [] }) : null,
5751
+ !isStreaming && citations.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "message-bubble__sources", "aria-label": "Sources", children: citations.map((citation) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("a", { href: citation.url, target: "_blank", rel: "noreferrer", children: [
5752
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5551
5753
  "span",
5552
5754
  {
5553
5755
  className: "message-bubble__source-icon",
@@ -5555,32 +5757,63 @@ function MessageBubble({
5555
5757
  children: "\u25A6"
5556
5758
  }
5557
5759
  ),
5558
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: citation.label })
5760
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { children: citation.label })
5559
5761
  ] }) }, citation.id)) }) : null
5560
5762
  ] });
5561
5763
  if (!displayText && !message.searchResults?.length && offers.length === 0)
5562
5764
  return null;
5563
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5765
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
5564
5766
  "article",
5565
5767
  {
5566
5768
  className: "message-bubble message-bubble--agent",
5567
5769
  "aria-label": "Message from AI assistant",
5568
5770
  children: [
5569
- showProvenance ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "message-bubble__speaker", children: "AI assistant" }) : null,
5570
- displayText || message.searchResults?.length ? showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__agent-row", children: [
5571
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5572
- "img",
5573
- {
5574
- src: resolvedLogoUrl,
5575
- alt: "",
5576
- onError: () => {
5577
- setFailedLogoUrl(resolvedLogoUrl ?? null);
5771
+ displayText || message.searchResults?.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "message-bubble__agent-stack", children: [
5772
+ showProvenance || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "message-bubble__agent-header", children: [
5773
+ showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5774
+ "span",
5775
+ {
5776
+ className: `message-bubble__agent-avatar${wideLogo ? " message-bubble__agent-avatar--wide" : ""}`,
5777
+ "aria-hidden": "true",
5778
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5779
+ "img",
5780
+ {
5781
+ className: "as-brand-logo-img",
5782
+ src: resolvedLogoUrl,
5783
+ alt: "",
5784
+ decoding: "async",
5785
+ ...logoDisplaySize ? {
5786
+ height: logoDisplaySize.height,
5787
+ width: logoDisplaySize.width
5788
+ } : {},
5789
+ onLoad: (event) => {
5790
+ const img = event.currentTarget;
5791
+ const display = snapBrandLogoDisplaySize({
5792
+ naturalHeight: img.naturalHeight,
5793
+ naturalWidth: img.naturalWidth,
5794
+ surface: "message"
5795
+ });
5796
+ if (!resolvedLogoUrl) return;
5797
+ setLogoDisplay({
5798
+ height: display.height,
5799
+ url: resolvedLogoUrl,
5800
+ wide: display.wide,
5801
+ width: display.width
5802
+ });
5803
+ },
5804
+ onError: () => {
5805
+ setFailedLogoUrl(resolvedLogoUrl ?? null);
5806
+ }
5807
+ },
5808
+ resolvedLogoUrl
5809
+ )
5578
5810
  }
5579
- }
5580
- ) }),
5811
+ ) : null,
5812
+ showProvenance ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "message-bubble__speaker", children: "AI assistant" }) : null
5813
+ ] }) : null,
5581
5814
  agentText
5582
- ] }) : agentText : null,
5583
- offers.map((nextOffer, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5815
+ ] }) : null,
5816
+ offers.map((nextOffer, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5584
5817
  BookingCard,
5585
5818
  {
5586
5819
  disabled: bookingDisabled,
@@ -5596,7 +5829,7 @@ function MessageBubble({
5596
5829
  }
5597
5830
 
5598
5831
  // src/react/components/MessageActions/MessageActions.tsx
5599
- var import_react12 = require("react");
5832
+ var import_react14 = require("react");
5600
5833
  var import_react_dom2 = require("react-dom");
5601
5834
 
5602
5835
  // src/react/lib/speech.ts
@@ -5744,10 +5977,10 @@ function subscribeSpeechInterrupts(onInterrupt) {
5744
5977
  }
5745
5978
 
5746
5979
  // src/react/components/MessageActions/MessageActions.tsx
5747
- var import_jsx_runtime8 = require("react/jsx-runtime");
5980
+ var import_jsx_runtime9 = require("react/jsx-runtime");
5748
5981
  function CopyIcon() {
5749
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5750
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5982
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5983
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5751
5984
  "rect",
5752
5985
  {
5753
5986
  x: "5.75",
@@ -5759,7 +5992,7 @@ function CopyIcon() {
5759
5992
  strokeWidth: "1.5"
5760
5993
  }
5761
5994
  ),
5762
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5995
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5763
5996
  "path",
5764
5997
  {
5765
5998
  d: "M10.25 5.25V4.5a1.75 1.75 0 0 0-1.75-1.75h-4A1.75 1.75 0 0 0 2.75 4.5v4c0 .97.78 1.75 1.75 1.75h.75",
@@ -5770,7 +6003,7 @@ function CopyIcon() {
5770
6003
  ] });
5771
6004
  }
5772
6005
  function CheckIcon2() {
5773
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6006
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5774
6007
  "path",
5775
6008
  {
5776
6009
  d: "M3.5 8.5l3 3 6-7",
@@ -5782,8 +6015,8 @@ function CheckIcon2() {
5782
6015
  ) });
5783
6016
  }
5784
6017
  function ThumbUpIcon() {
5785
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5786
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6018
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
6019
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5787
6020
  "path",
5788
6021
  {
5789
6022
  d: "M4.67 6.67v8",
@@ -5792,7 +6025,7 @@ function ThumbUpIcon() {
5792
6025
  strokeLinecap: "round"
5793
6026
  }
5794
6027
  ),
5795
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6028
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5796
6029
  "path",
5797
6030
  {
5798
6031
  d: "M10 3.92 9.33 6.67h3.89a1.33 1.33 0 0 1 1.28 1.7l-1.55 5.33a1.33 1.33 0 0 1-1.28.97H2.67a1.33 1.33 0 0 1-1.34-1.34V8a1.33 1.33 0 0 1 1.34-1.33h1.84a1.33 1.33 0 0 0 1.19-.74L8 1.33a2.09 2.09 0 0 1 2 2.59Z",
@@ -5805,8 +6038,8 @@ function ThumbUpIcon() {
5805
6038
  ] });
5806
6039
  }
5807
6040
  function ThumbDownIcon() {
5808
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("g", { transform: "rotate(180 8 8)", children: [
5809
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6041
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("g", { transform: "rotate(180 8 8)", children: [
6042
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5810
6043
  "path",
5811
6044
  {
5812
6045
  d: "M4.67 6.67v8",
@@ -5815,7 +6048,7 @@ function ThumbDownIcon() {
5815
6048
  strokeLinecap: "round"
5816
6049
  }
5817
6050
  ),
5818
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6051
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5819
6052
  "path",
5820
6053
  {
5821
6054
  d: "M10 3.92 9.33 6.67h3.89a1.33 1.33 0 0 1 1.28 1.7l-1.55 5.33a1.33 1.33 0 0 1-1.28.97H2.67a1.33 1.33 0 0 1-1.34-1.34V8a1.33 1.33 0 0 1 1.34-1.33h1.84a1.33 1.33 0 0 0 1.19-.74L8 1.33a2.09 2.09 0 0 1 2 2.59Z",
@@ -5828,8 +6061,8 @@ function ThumbDownIcon() {
5828
6061
  ] }) });
5829
6062
  }
5830
6063
  function RegenerateIcon() {
5831
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5832
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6064
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
6065
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5833
6066
  "path",
5834
6067
  {
5835
6068
  d: "M2 8a6 6 0 0 1 6-6 6.5 6.5 0 0 1 4.5 1.83L14 5.33",
@@ -5838,7 +6071,7 @@ function RegenerateIcon() {
5838
6071
  strokeLinecap: "round"
5839
6072
  }
5840
6073
  ),
5841
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6074
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5842
6075
  "path",
5843
6076
  {
5844
6077
  d: "M14 2v3.33h-3.33",
@@ -5848,7 +6081,7 @@ function RegenerateIcon() {
5848
6081
  strokeLinejoin: "round"
5849
6082
  }
5850
6083
  ),
5851
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6084
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5852
6085
  "path",
5853
6086
  {
5854
6087
  d: "M14 8a6 6 0 0 1-6 6 6.5 6.5 0 0 1-4.5-1.83L2 10.67",
@@ -5857,7 +6090,7 @@ function RegenerateIcon() {
5857
6090
  strokeLinecap: "round"
5858
6091
  }
5859
6092
  ),
5860
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6093
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5861
6094
  "path",
5862
6095
  {
5863
6096
  d: "M5.33 10.67H2V14",
@@ -5870,15 +6103,15 @@ function RegenerateIcon() {
5870
6103
  ] });
5871
6104
  }
5872
6105
  function MoreIcon() {
5873
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5874
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "3.5", cy: "8", r: "1.15", fill: "currentColor" }),
5875
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "8", cy: "8", r: "1.15", fill: "currentColor" }),
5876
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "12.5", cy: "8", r: "1.15", fill: "currentColor" })
6106
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
6107
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "3.5", cy: "8", r: "1.15", fill: "currentColor" }),
6108
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "8", cy: "8", r: "1.15", fill: "currentColor" }),
6109
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("circle", { cx: "12.5", cy: "8", r: "1.15", fill: "currentColor" })
5877
6110
  ] });
5878
6111
  }
5879
6112
  function SourcesIcon() {
5880
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5881
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6113
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
6114
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5882
6115
  "path",
5883
6116
  {
5884
6117
  d: "M8 4.5C6.9 3.4 5.3 3 3.5 3c-.4 0-.8 0-1.2.1-.3 0-.5.3-.5.6v8.1c0 .4.4.7.8.6.3-.1.7-.1 1.1-.1 1.6 0 3.2.4 4.3 1.3 1.1-.9 2.7-1.3 4.3-1.3.4 0 .8 0 1.1.1.4.1.8-.2.8-.6V3.7c0-.3-.2-.6-.5-.6-.4-.1-.8-.1-1.2-.1-1.8 0-3.4.4-4.5 1.5Z",
@@ -5888,7 +6121,7 @@ function SourcesIcon() {
5888
6121
  strokeLinejoin: "round"
5889
6122
  }
5890
6123
  ),
5891
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6124
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5892
6125
  "path",
5893
6126
  {
5894
6127
  d: "M8 4.5v9",
@@ -5900,8 +6133,8 @@ function SourcesIcon() {
5900
6133
  ] });
5901
6134
  }
5902
6135
  function ReadAloudIcon() {
5903
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5904
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6136
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
6137
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5905
6138
  "path",
5906
6139
  {
5907
6140
  d: "M8.5 3.8 5.8 6H3.5c-.6 0-1 .4-1 1v2c0 .6.4 1 1 1h2.3l2.7 2.2c.4.3 1 0 1-.5V4.3c0-.5-.6-.8-1-.5Z",
@@ -5911,7 +6144,7 @@ function ReadAloudIcon() {
5911
6144
  strokeLinejoin: "round"
5912
6145
  }
5913
6146
  ),
5914
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6147
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5915
6148
  "path",
5916
6149
  {
5917
6150
  d: "M11 6.2c.5.5.8 1.1.8 1.8s-.3 1.3-.8 1.8M12.8 4.5c.9.8 1.4 2 1.4 3.5s-.5 2.7-1.4 3.5",
@@ -5923,7 +6156,7 @@ function ReadAloudIcon() {
5923
6156
  ] });
5924
6157
  }
5925
6158
  function StopIcon() {
5926
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6159
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5927
6160
  "rect",
5928
6161
  {
5929
6162
  x: "4",
@@ -5992,26 +6225,26 @@ function MessageActions({
5992
6225
  speechText
5993
6226
  }) {
5994
6227
  const menuPortalRoot = useAgentRailMenuPortalRoot();
5995
- const [copied, setCopied] = (0, import_react12.useState)(false);
5996
- const [rating, setRating] = (0, import_react12.useState)(null);
5997
- const [menuOpen, setMenuOpen] = (0, import_react12.useState)(false);
5998
- const [menuPosition, setMenuPosition] = (0, import_react12.useState)(null);
5999
- const [speaking, setSpeaking] = (0, import_react12.useState)(false);
6000
- const [speechSupported, setSpeechSupported] = (0, import_react12.useState)(null);
6001
- const copyTimerRef = (0, import_react12.useRef)(null);
6002
- const menuRef = (0, import_react12.useRef)(null);
6003
- const portaledMenuRef = (0, import_react12.useRef)(null);
6004
- const moreButtonRef = (0, import_react12.useRef)(null);
6228
+ const [copied, setCopied] = (0, import_react14.useState)(false);
6229
+ const [rating, setRating] = (0, import_react14.useState)(null);
6230
+ const [menuOpen, setMenuOpen] = (0, import_react14.useState)(false);
6231
+ const [menuPosition, setMenuPosition] = (0, import_react14.useState)(null);
6232
+ const [speaking, setSpeaking] = (0, import_react14.useState)(false);
6233
+ const [speechSupported, setSpeechSupported] = (0, import_react14.useState)(null);
6234
+ const copyTimerRef = (0, import_react14.useRef)(null);
6235
+ const menuRef = (0, import_react14.useRef)(null);
6236
+ const portaledMenuRef = (0, import_react14.useRef)(null);
6237
+ const moreButtonRef = (0, import_react14.useRef)(null);
6005
6238
  const answeredLabel = formatAnsweredAt(answeredAt ?? 0);
6006
6239
  const resolvedSpeechText = speechText ?? toSpeechText(copyText);
6007
6240
  const canOpenReceipt = Boolean(receiptSteps) && Boolean(onOpenReceipt);
6008
6241
  const readAloudEligible = Boolean(readAloud && resolvedSpeechText);
6009
6242
  const canReadAloud = readAloudEligible && speechSupported === true;
6010
6243
  const showMenu = canOpenReceipt || (speechSupported === null ? readAloudEligible : canReadAloud);
6011
- (0, import_react12.useLayoutEffect)(() => {
6244
+ (0, import_react14.useLayoutEffect)(() => {
6012
6245
  setSpeechSupported(isSpeechSupported());
6013
6246
  }, []);
6014
- (0, import_react12.useLayoutEffect)(() => {
6247
+ (0, import_react14.useLayoutEffect)(() => {
6015
6248
  if (!menuOpen || !moreButtonRef.current || !portaledMenuRef.current) {
6016
6249
  setMenuPosition(null);
6017
6250
  return;
@@ -6028,7 +6261,7 @@ function MessageActions({
6028
6261
  })
6029
6262
  );
6030
6263
  }, [menuOpen, menuPortalRoot]);
6031
- (0, import_react12.useEffect)(() => {
6264
+ (0, import_react14.useEffect)(() => {
6032
6265
  const unsubscribe = subscribeSpeechInterrupts(() => setSpeaking(false));
6033
6266
  return () => {
6034
6267
  unsubscribe();
@@ -6038,7 +6271,7 @@ function MessageActions({
6038
6271
  stopSpeech();
6039
6272
  };
6040
6273
  }, []);
6041
- (0, import_react12.useEffect)(() => {
6274
+ (0, import_react14.useEffect)(() => {
6042
6275
  if (!menuOpen) return;
6043
6276
  const handlePointerDown = (event) => {
6044
6277
  const target = event.target;
@@ -6087,7 +6320,7 @@ function MessageActions({
6087
6320
  window.speechSynthesis.speak(utterance);
6088
6321
  setSpeaking(true);
6089
6322
  }
6090
- const menu = menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
6323
+ const menu = menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
6091
6324
  "div",
6092
6325
  {
6093
6326
  className: "agent-message-actions__menu agent-message-actions__menu--portal",
@@ -6098,11 +6331,11 @@ function MessageActions({
6098
6331
  top: `${menuPosition.top}px`
6099
6332
  } : { visibility: "hidden" },
6100
6333
  children: [
6101
- answeredLabel ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "agent-message-actions__menu-meta", children: [
6334
+ answeredLabel ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("p", { className: "agent-message-actions__menu-meta", children: [
6102
6335
  "Answered ",
6103
6336
  answeredLabel
6104
6337
  ] }) : null,
6105
- canOpenReceipt ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
6338
+ canOpenReceipt ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
6106
6339
  "button",
6107
6340
  {
6108
6341
  type: "button",
@@ -6113,12 +6346,12 @@ function MessageActions({
6113
6346
  onOpenReceipt?.();
6114
6347
  },
6115
6348
  children: [
6116
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SourcesIcon, {}),
6117
- "View sources"
6349
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(SourcesIcon, {}),
6350
+ "How this answer was made"
6118
6351
  ]
6119
6352
  }
6120
6353
  ) : null,
6121
- canReadAloud ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
6354
+ canReadAloud ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
6122
6355
  "button",
6123
6356
  {
6124
6357
  type: "button",
@@ -6126,7 +6359,7 @@ function MessageActions({
6126
6359
  role: "menuitem",
6127
6360
  onClick: handleReadAloud,
6128
6361
  children: [
6129
- speaking ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ReadAloudIcon, {}),
6362
+ speaking ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ReadAloudIcon, {}),
6130
6363
  speaking ? "Stop reading" : "Read aloud"
6131
6364
  ]
6132
6365
  }
@@ -6134,8 +6367,8 @@ function MessageActions({
6134
6367
  ]
6135
6368
  }
6136
6369
  ) : null;
6137
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "agent-message-actions", "aria-label": "Answer actions", children: [
6138
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6370
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "agent-message-actions", "aria-label": "Answer actions", children: [
6371
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6139
6372
  "button",
6140
6373
  {
6141
6374
  type: "button",
@@ -6144,10 +6377,10 @@ function MessageActions({
6144
6377
  title: copied ? "Copied" : "Copy answer",
6145
6378
  disabled,
6146
6379
  onClick: handleCopy,
6147
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckIcon2, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CopyIcon, {})
6380
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CheckIcon2, {}) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(CopyIcon, {})
6148
6381
  }
6149
6382
  ),
6150
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6383
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6151
6384
  "button",
6152
6385
  {
6153
6386
  type: "button",
@@ -6157,10 +6390,10 @@ function MessageActions({
6157
6390
  title: "Good answer",
6158
6391
  disabled,
6159
6392
  onClick: () => handleFeedback("positive"),
6160
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ThumbUpIcon, {})
6393
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ThumbUpIcon, {})
6161
6394
  }
6162
6395
  ),
6163
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6396
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6164
6397
  "button",
6165
6398
  {
6166
6399
  type: "button",
@@ -6170,10 +6403,10 @@ function MessageActions({
6170
6403
  title: "Bad answer",
6171
6404
  disabled,
6172
6405
  onClick: () => handleFeedback("negative"),
6173
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ThumbDownIcon, {})
6406
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ThumbDownIcon, {})
6174
6407
  }
6175
6408
  ),
6176
- onRegenerate ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6409
+ onRegenerate ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6177
6410
  "button",
6178
6411
  {
6179
6412
  type: "button",
@@ -6182,11 +6415,11 @@ function MessageActions({
6182
6415
  title: "Regenerate answer",
6183
6416
  disabled,
6184
6417
  onClick: onRegenerate,
6185
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RegenerateIcon, {})
6418
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(RegenerateIcon, {})
6186
6419
  }
6187
6420
  ) : null,
6188
- showMenu ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "agent-message-actions__more", ref: menuRef, children: [
6189
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
6421
+ showMenu ? /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "agent-message-actions__more", ref: menuRef, children: [
6422
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6190
6423
  "button",
6191
6424
  {
6192
6425
  ref: moreButtonRef,
@@ -6198,7 +6431,7 @@ function MessageActions({
6198
6431
  title: "More actions",
6199
6432
  disabled,
6200
6433
  onClick: () => setMenuOpen((open) => !open),
6201
- children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MoreIcon, {})
6434
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(MoreIcon, {})
6202
6435
  }
6203
6436
  ),
6204
6437
  menuPortalRoot?.current && menu ? (0, import_react_dom2.createPortal)(menu, menuPortalRoot.current) : menu
@@ -6207,10 +6440,10 @@ function MessageActions({
6207
6440
  }
6208
6441
 
6209
6442
  // src/react/components/HumanInputCard/HumanInputCard.tsx
6210
- var import_react14 = require("react");
6443
+ var import_react16 = require("react");
6211
6444
 
6212
6445
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
6213
- var import_jsx_runtime9 = require("react/jsx-runtime");
6446
+ var import_jsx_runtime10 = require("react/jsx-runtime");
6214
6447
  function ConfirmationCard({
6215
6448
  disabled = false,
6216
6449
  request,
@@ -6219,17 +6452,17 @@ function ConfirmationCard({
6219
6452
  const options = request.options ?? [];
6220
6453
  const heading = request.kind === "tool-approval" ? "Confirm this action" : request.prompt;
6221
6454
  const prompt = request.kind === "tool-approval" ? request.prompt : void 0;
6222
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
6455
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6223
6456
  "section",
6224
6457
  {
6225
6458
  className: "confirmation-card",
6226
6459
  "aria-labelledby": `confirmation-${request.requestId}`,
6227
6460
  children: [
6228
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "confirmation-card__heading", children: [
6229
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { id: `confirmation-${request.requestId}`, children: heading }),
6230
- prompt ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: prompt }) : null
6461
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "confirmation-card__heading", children: [
6462
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { id: `confirmation-${request.requestId}`, children: heading }),
6463
+ prompt ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: prompt }) : null
6231
6464
  ] }),
6232
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
6465
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6233
6466
  "button",
6234
6467
  {
6235
6468
  type: "button",
@@ -6249,8 +6482,8 @@ function ConfirmationCard({
6249
6482
  }
6250
6483
 
6251
6484
  // src/react/components/ToolInputCard/ToolInputCard.tsx
6252
- var import_react13 = require("react");
6253
- var import_jsx_runtime10 = require("react/jsx-runtime");
6485
+ var import_react15 = require("react");
6486
+ var import_jsx_runtime11 = require("react/jsx-runtime");
6254
6487
  function isRecord5(value) {
6255
6488
  return value !== null && typeof value === "object" && !Array.isArray(value);
6256
6489
  }
@@ -6374,7 +6607,7 @@ function FieldDescription({
6374
6607
  field,
6375
6608
  id: id2
6376
6609
  }) {
6377
- return field.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: id2, className: "tool-input-card__description", children: field.description }) : null;
6610
+ return field.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { id: id2, className: "tool-input-card__description", children: field.description }) : null;
6378
6611
  }
6379
6612
  function ChoiceField({
6380
6613
  field,
@@ -6393,7 +6626,7 @@ function ChoiceField({
6393
6626
  const selectedIndex = options.findIndex(
6394
6627
  (option) => valuesMatch(option.value, value)
6395
6628
  );
6396
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6629
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
6397
6630
  "select",
6398
6631
  {
6399
6632
  id: id2,
@@ -6408,13 +6641,13 @@ function ChoiceField({
6408
6641
  if (option) onChange(option.value);
6409
6642
  },
6410
6643
  children: [
6411
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", disabled: field.required, children: "Choose an option" }),
6412
- options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: index, children: option.label }, optionKey(option)))
6644
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: "", disabled: field.required, children: "Choose an option" }),
6645
+ options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("option", { value: index, children: option.label }, optionKey(option)))
6413
6646
  ]
6414
6647
  }
6415
6648
  );
6416
6649
  }
6417
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6650
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6418
6651
  "div",
6419
6652
  {
6420
6653
  className: "tool-input-card__choices",
@@ -6425,8 +6658,8 @@ function ChoiceField({
6425
6658
  "aria-required": field.required,
6426
6659
  children: options.map((option, index) => {
6427
6660
  const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
6428
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "tool-input-card__choice", children: [
6429
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6661
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "tool-input-card__choice", children: [
6662
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6430
6663
  "input",
6431
6664
  {
6432
6665
  type: multiple ? "checkbox" : "radio",
@@ -6448,7 +6681,7 @@ function ChoiceField({
6448
6681
  }
6449
6682
  }
6450
6683
  ),
6451
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: option.label })
6684
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { children: option.label })
6452
6685
  ] }, optionKey(option));
6453
6686
  })
6454
6687
  }
@@ -6468,9 +6701,9 @@ function ToolField({
6468
6701
  error ? `${id2}-error` : ""
6469
6702
  ].filter(Boolean).join(" ");
6470
6703
  if (field.kind === "checkbox" || field.kind === "confirmation") {
6471
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__field", children: [
6472
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "tool-input-card__check", htmlFor: id2, children: [
6473
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6704
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-input-card__field", children: [
6705
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { className: "tool-input-card__check", htmlFor: id2, children: [
6706
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6474
6707
  "input",
6475
6708
  {
6476
6709
  id: id2,
@@ -6483,17 +6716,17 @@ function ToolField({
6483
6716
  onChange: (event) => onChange(event.target.checked)
6484
6717
  }
6485
6718
  ),
6486
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
6487
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: field.label }),
6488
- field.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id2}-description`, children: field.description }) : null
6719
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("span", { children: [
6720
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: field.label }),
6721
+ field.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { id: `${id2}-description`, children: field.description }) : null
6489
6722
  ] })
6490
6723
  ] }),
6491
- error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id2}-error`, className: "tool-input-card__error", children: error }) : null
6724
+ error ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { id: `${id2}-error`, className: "tool-input-card__error", children: error }) : null
6492
6725
  ] });
6493
6726
  }
6494
- const label = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { id: `${id2}-label`, htmlFor: id2, children: [
6727
+ const label = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("label", { id: `${id2}-label`, htmlFor: id2, children: [
6495
6728
  field.label,
6496
- field.required ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: " *" }) : null
6729
+ field.required ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", children: " *" }) : null
6497
6730
  ] });
6498
6731
  const common = {
6499
6732
  id: id2,
@@ -6505,7 +6738,7 @@ function ToolField({
6505
6738
  };
6506
6739
  let control;
6507
6740
  if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
6508
- control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6741
+ control = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6509
6742
  ChoiceField,
6510
6743
  {
6511
6744
  field,
@@ -6519,7 +6752,7 @@ function ToolField({
6519
6752
  }
6520
6753
  );
6521
6754
  } else if (field.kind === "textarea" || field.kind === "json") {
6522
- control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6755
+ control = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6523
6756
  "textarea",
6524
6757
  {
6525
6758
  ...common,
@@ -6533,8 +6766,8 @@ function ToolField({
6533
6766
  );
6534
6767
  } else if (field.kind === "range") {
6535
6768
  const numericValue = typeof value === "number" ? value : field.min ?? 0;
6536
- control = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__range", children: [
6537
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6769
+ control = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-input-card__range", children: [
6770
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6538
6771
  "input",
6539
6772
  {
6540
6773
  ...common,
@@ -6546,11 +6779,11 @@ function ToolField({
6546
6779
  onChange: (event) => onChange(Number(event.target.value))
6547
6780
  }
6548
6781
  ),
6549
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("output", { htmlFor: id2, children: numericValue })
6782
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("output", { htmlFor: id2, children: numericValue })
6550
6783
  ] });
6551
6784
  } else {
6552
6785
  const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
6553
- control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6786
+ control = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6554
6787
  "input",
6555
6788
  {
6556
6789
  ...common,
@@ -6568,11 +6801,11 @@ function ToolField({
6568
6801
  }
6569
6802
  );
6570
6803
  }
6571
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__field", children: [
6804
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-input-card__field", children: [
6572
6805
  label,
6573
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FieldDescription, { field, id: `${id2}-description` }),
6806
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(FieldDescription, { field, id: `${id2}-description` }),
6574
6807
  control,
6575
- error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id2}-error`, className: "tool-input-card__error", children: error }) : null
6808
+ error ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { id: `${id2}-error`, className: "tool-input-card__error", children: error }) : null
6576
6809
  ] });
6577
6810
  }
6578
6811
  function ToolInputCard({
@@ -6580,11 +6813,11 @@ function ToolInputCard({
6580
6813
  surface,
6581
6814
  onSubmit
6582
6815
  }) {
6583
- const [values, setValues] = (0, import_react13.useState)(
6816
+ const [values, setValues] = (0, import_react15.useState)(
6584
6817
  () => initialValues(surface)
6585
6818
  );
6586
- const [touched, setTouched] = (0, import_react13.useState)(() => /* @__PURE__ */ new Set());
6587
- const [submitted, setSubmitted] = (0, import_react13.useState)(false);
6819
+ const [touched, setTouched] = (0, import_react15.useState)(() => /* @__PURE__ */ new Set());
6820
+ const [submitted, setSubmitted] = (0, import_react15.useState)(false);
6588
6821
  const errors = Object.fromEntries(
6589
6822
  surface.fields.map((field) => [
6590
6823
  field.path,
@@ -6609,14 +6842,14 @@ function ToolInputCard({
6609
6842
  onSubmit?.(surface, result);
6610
6843
  }
6611
6844
  if (submitted) {
6612
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6845
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
6613
6846
  "section",
6614
6847
  {
6615
6848
  className: "tool-input-card tool-input-card--submitted",
6616
6849
  role: "status",
6617
6850
  children: [
6618
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u2713" }),
6619
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("strong", { children: [
6851
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { "aria-hidden": "true", children: "\u2713" }),
6852
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("strong", { children: [
6620
6853
  surface.title,
6621
6854
  " submitted"
6622
6855
  ] })
@@ -6624,18 +6857,18 @@ function ToolInputCard({
6624
6857
  }
6625
6858
  );
6626
6859
  }
6627
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
6860
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
6628
6861
  "section",
6629
6862
  {
6630
6863
  className: "tool-input-card",
6631
6864
  "aria-labelledby": `tool-input-${surface.id}`,
6632
6865
  children: [
6633
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__heading", children: [
6634
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
6635
- surface.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: surface.description }) : null
6866
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-input-card__heading", children: [
6867
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
6868
+ surface.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: surface.description }) : null
6636
6869
  ] }),
6637
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { noValidate: true, onSubmit: submit, children: [
6638
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6870
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { noValidate: true, onSubmit: submit, children: [
6871
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6639
6872
  ToolField,
6640
6873
  {
6641
6874
  disabled,
@@ -6648,8 +6881,8 @@ function ToolInputCard({
6648
6881
  },
6649
6882
  field.path
6650
6883
  )) }),
6651
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__actions", children: [
6652
- surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
6884
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-input-card__actions", children: [
6885
+ surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6653
6886
  "button",
6654
6887
  {
6655
6888
  type: "button",
@@ -6662,7 +6895,7 @@ function ToolInputCard({
6662
6895
  children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
6663
6896
  }
6664
6897
  ) : null,
6665
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
6898
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
6666
6899
  ] })
6667
6900
  ] })
6668
6901
  ]
@@ -6671,17 +6904,17 @@ function ToolInputCard({
6671
6904
  }
6672
6905
 
6673
6906
  // src/react/components/HumanInputCard/HumanInputCard.tsx
6674
- var import_jsx_runtime11 = require("react/jsx-runtime");
6907
+ var import_jsx_runtime12 = require("react/jsx-runtime");
6675
6908
  function HumanInputCard({
6676
6909
  disabled = false,
6677
6910
  request,
6678
6911
  onRespond
6679
6912
  }) {
6680
- const [text3, setText] = (0, import_react14.useState)("");
6913
+ const [text3, setText] = (0, import_react16.useState)("");
6681
6914
  const options = request.options ?? [];
6682
6915
  const showText = request.display === "text" || request.allowFreeform && options.length === 0;
6683
6916
  if (request.ui) {
6684
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6917
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
6685
6918
  ToolInputCard,
6686
6919
  {
6687
6920
  disabled,
@@ -6691,7 +6924,7 @@ function HumanInputCard({
6691
6924
  );
6692
6925
  }
6693
6926
  if (options.length > 0) {
6694
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6927
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
6695
6928
  ConfirmationCard,
6696
6929
  {
6697
6930
  disabled,
@@ -6706,17 +6939,17 @@ function HumanInputCard({
6706
6939
  if (!value || disabled) return;
6707
6940
  onRespond?.({ requestId: request.requestId, text: value });
6708
6941
  }
6709
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
6942
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
6710
6943
  "section",
6711
6944
  {
6712
6945
  className: "human-input-card",
6713
6946
  "aria-labelledby": `human-input-${request.requestId}`,
6714
6947
  children: [
6715
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "human-input-card__heading", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
6716
- showText ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { onSubmit: submitText, children: [
6717
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
6718
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
6719
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
6948
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "human-input-card__heading", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
6949
+ showText ? /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("form", { onSubmit: submitText, children: [
6950
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
6951
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
6952
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
6720
6953
  "input",
6721
6954
  {
6722
6955
  id: `human-input-text-${request.requestId}`,
@@ -6725,17 +6958,17 @@ function HumanInputCard({
6725
6958
  onChange: (event) => setText(event.target.value)
6726
6959
  }
6727
6960
  ),
6728
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "submit", disabled: disabled || !text3.trim(), children: "Send" })
6961
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("button", { type: "submit", disabled: disabled || !text3.trim(), children: "Send" })
6729
6962
  ] })
6730
6963
  ] }) : null,
6731
- !showText && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
6964
+ !showText && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
6732
6965
  ]
6733
6966
  }
6734
6967
  );
6735
6968
  }
6736
6969
 
6737
6970
  // src/react/components/LocationConsent/LocationConsent.tsx
6738
- var import_react15 = require("react");
6971
+ var import_react17 = require("react");
6739
6972
 
6740
6973
  // src/runtime/location-consent.ts
6741
6974
  function isLocationConsentRequest(request) {
@@ -6778,21 +7011,21 @@ function getPreciseLocation(geolocation) {
6778
7011
  }
6779
7012
 
6780
7013
  // src/react/components/LocationConsent/LocationConsent.tsx
6781
- var import_jsx_runtime12 = require("react/jsx-runtime");
7014
+ var import_jsx_runtime13 = require("react/jsx-runtime");
6782
7015
  function LocationConsent({
6783
7016
  request,
6784
7017
  onRespond
6785
7018
  }) {
6786
- const [preference, setPreference] = (0, import_react15.useState)("unset");
6787
- const [locating, setLocating] = (0, import_react15.useState)(false);
6788
- const [error, setError] = (0, import_react15.useState)(null);
6789
- const respond = (0, import_react15.useRef)(onRespond);
6790
- const answered = (0, import_react15.useRef)(null);
7019
+ const [preference, setPreference] = (0, import_react17.useState)("unset");
7020
+ const [locating, setLocating] = (0, import_react17.useState)(false);
7021
+ const [error, setError] = (0, import_react17.useState)(null);
7022
+ const respond = (0, import_react17.useRef)(onRespond);
7023
+ const answered = (0, import_react17.useRef)(null);
6791
7024
  const requestId = request?.requestId;
6792
- (0, import_react15.useEffect)(() => {
7025
+ (0, import_react17.useEffect)(() => {
6793
7026
  respond.current = onRespond;
6794
7027
  }, [onRespond]);
6795
- (0, import_react15.useEffect)(() => {
7028
+ (0, import_react17.useEffect)(() => {
6796
7029
  if (!requestId || preference === "unset" || answered.current === requestId || !respond.current)
6797
7030
  return;
6798
7031
  if (preference === "off") {
@@ -6835,13 +7068,13 @@ function LocationConsent({
6835
7068
  }, [requestId, preference]);
6836
7069
  const isLocating = Boolean(requestId) && preference === "on" && locating;
6837
7070
  if (!request && preference === "unset") return null;
6838
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("section", { className: "location-consent", "aria-label": "Location sharing", children: [
6839
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "location-consent__copy", children: [
6840
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: isLocating ? "Getting your location\u2026" : request ? "Get better results" : "Precise location" }),
6841
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("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" })
7071
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "location-consent", "aria-label": "Location sharing", children: [
7072
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "location-consent__copy", children: [
7073
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: isLocating ? "Getting your location\u2026" : request ? "Get better results" : "Precise location" }),
7074
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("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" })
6842
7075
  ] }),
6843
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "location-consent__actions", children: [
6844
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
7076
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "location-consent__actions", children: [
7077
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
6845
7078
  "button",
6846
7079
  {
6847
7080
  type: "button",
@@ -6855,10 +7088,10 @@ function LocationConsent({
6855
7088
  setError(null);
6856
7089
  setPreference(preference === "on" ? "off" : "on");
6857
7090
  },
6858
- children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", {})
7091
+ children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", {})
6859
7092
  }
6860
7093
  ),
6861
- request && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
7094
+ request && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
6862
7095
  "button",
6863
7096
  {
6864
7097
  type: "button",
@@ -6872,35 +7105,35 @@ function LocationConsent({
6872
7105
  }
6873
7106
  )
6874
7107
  ] }),
6875
- error && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { role: "alert", className: "location-consent__error", children: error })
7108
+ error && /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { role: "alert", className: "location-consent__error", children: error })
6876
7109
  ] });
6877
7110
  }
6878
7111
 
6879
7112
  // src/react/components/CollectionResultCard/CollectionResultCard.tsx
6880
- var import_jsx_runtime13 = require("react/jsx-runtime");
7113
+ var import_jsx_runtime14 = require("react/jsx-runtime");
6881
7114
  function CollectionResultCard({
6882
7115
  result
6883
7116
  }) {
6884
7117
  const empty = result.items.length === 0;
6885
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
7118
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
6886
7119
  "section",
6887
7120
  {
6888
7121
  className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
6889
7122
  "aria-label": result.title,
6890
7123
  role: result.status === "completed" ? "status" : "alert",
6891
7124
  children: [
6892
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "tool-result-card__heading", children: [
6893
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6894
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: result.title })
7125
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "tool-result-card__heading", children: [
7126
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
7127
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: result.title })
6895
7128
  ] }),
6896
- empty ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("li", { children: [
6897
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
6898
- item.description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: item.description }) : null,
6899
- item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
6900
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dt", { children: detail.label }),
6901
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { children: detail.value })
7129
+ empty ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("li", { children: [
7130
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
7131
+ item.description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: item.description }) : null,
7132
+ item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
7133
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dt", { children: detail.label }),
7134
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dd", { children: detail.value })
6902
7135
  ] }, `${detail.label}:${detail.value}`)) }) : null,
6903
- item.href ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
7136
+ item.href ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
6904
7137
  ] }, item.title)) })
6905
7138
  ]
6906
7139
  }
@@ -6908,23 +7141,23 @@ function CollectionResultCard({
6908
7141
  }
6909
7142
 
6910
7143
  // src/react/components/EntityResultCard/EntityResultCard.tsx
6911
- var import_jsx_runtime14 = require("react/jsx-runtime");
7144
+ var import_jsx_runtime15 = require("react/jsx-runtime");
6912
7145
  function EntityResultCard({
6913
7146
  result
6914
7147
  }) {
6915
7148
  const compact = !result.description && !result.details?.length && !result.links?.length;
6916
7149
  const collapsible = result.status === "completed" && Boolean(result.details?.length) && !result.links?.length;
6917
- const heading = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "tool-result-card__heading", children: [
6918
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6919
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: result.title })
7150
+ const heading = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "tool-result-card__heading", children: [
7151
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
7152
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: result.title })
6920
7153
  ] });
6921
- const content = /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
6922
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: result.description }) : null,
6923
- result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
6924
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dt", { children: detail.label }),
6925
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dd", { children: detail.value })
7154
+ const content = /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
7155
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: result.description }) : null,
7156
+ result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
7157
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dt", { children: detail.label }),
7158
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dd", { children: detail.value })
6926
7159
  ] }, `${detail.label}:${detail.value}`)) }) : null,
6927
- result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
7160
+ result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6928
7161
  "a",
6929
7162
  {
6930
7163
  href: link.href,
@@ -6936,12 +7169,12 @@ function EntityResultCard({
6936
7169
  )) }) : null
6937
7170
  ] });
6938
7171
  if (collapsible) {
6939
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("details", { className: "entity-result-card tool-result-card entity-result-card--disclosure", children: [
6940
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("summary", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { role: "status", children: heading }) }),
7172
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("details", { className: "entity-result-card tool-result-card entity-result-card--disclosure", children: [
7173
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("summary", { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { role: "status", children: heading }) }),
6941
7174
  content
6942
7175
  ] });
6943
7176
  }
6944
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
7177
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
6945
7178
  "section",
6946
7179
  {
6947
7180
  className: `entity-result-card tool-result-card tool-result-card--${result.status}${compact ? " entity-result-card--compact" : ""}`,
@@ -6956,24 +7189,24 @@ function EntityResultCard({
6956
7189
  }
6957
7190
 
6958
7191
  // src/react/components/SignatureResultCard/SignatureResultCard.tsx
6959
- var import_jsx_runtime15 = require("react/jsx-runtime");
7192
+ var import_jsx_runtime16 = require("react/jsx-runtime");
6960
7193
  function SignatureResultCard({
6961
7194
  result
6962
7195
  }) {
6963
7196
  const primaryLink = result.links?.[0];
6964
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
7197
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6965
7198
  "section",
6966
7199
  {
6967
7200
  className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
6968
7201
  "aria-label": result.title,
6969
7202
  children: [
6970
- /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "tool-result-card__heading", children: [
6971
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6972
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: result.title })
7203
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tool-result-card__heading", children: [
7204
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
7205
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("strong", { children: result.title })
6973
7206
  ] }),
6974
- result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
6975
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: result.description }) : null,
6976
- primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
7207
+ result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
7208
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: result.description }) : null,
7209
+ primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6977
7210
  "a",
6978
7211
  {
6979
7212
  className: "signature-result-card__cta",
@@ -6989,27 +7222,27 @@ function SignatureResultCard({
6989
7222
  }
6990
7223
 
6991
7224
  // src/react/components/ToolResultCard/ToolResultCard.tsx
6992
- var import_jsx_runtime16 = require("react/jsx-runtime");
7225
+ var import_jsx_runtime17 = require("react/jsx-runtime");
6993
7226
  function ToolResultCard({
6994
7227
  result
6995
7228
  }) {
6996
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
7229
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6997
7230
  "section",
6998
7231
  {
6999
7232
  className: `tool-result-card tool-result-card--${result.status}`,
7000
7233
  "aria-label": result.title,
7001
7234
  role: result.status === "completed" ? "status" : "alert",
7002
7235
  children: [
7003
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "tool-result-card__heading", children: [
7004
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
7005
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("strong", { children: result.title })
7236
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "tool-result-card__heading", children: [
7237
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
7238
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("strong", { children: result.title })
7006
7239
  ] }),
7007
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: result.description }) : null,
7008
- result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
7009
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dt", { children: detail.label }),
7010
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("dd", { children: detail.value })
7240
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: result.description }) : null,
7241
+ result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
7242
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dt", { children: detail.label }),
7243
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("dd", { children: detail.value })
7011
7244
  ] }, `${detail.label}:${detail.value}`)) }) : null,
7012
- result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
7245
+ result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7013
7246
  "a",
7014
7247
  {
7015
7248
  href: link.href,
@@ -7025,14 +7258,14 @@ function ToolResultCard({
7025
7258
  }
7026
7259
 
7027
7260
  // src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
7028
- var import_jsx_runtime17 = require("react/jsx-runtime");
7261
+ var import_jsx_runtime18 = require("react/jsx-runtime");
7029
7262
  function VisitorToolResultView({
7030
7263
  disabled = false,
7031
7264
  onToolInput,
7032
7265
  result
7033
7266
  }) {
7034
7267
  if (result.kind === "input") {
7035
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
7268
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7036
7269
  ToolInputCard,
7037
7270
  {
7038
7271
  disabled,
@@ -7042,16 +7275,16 @@ function VisitorToolResultView({
7042
7275
  );
7043
7276
  }
7044
7277
  if (result.kind === "entity") {
7045
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(EntityResultCard, { result });
7278
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EntityResultCard, { result });
7046
7279
  }
7047
7280
  if (result.kind === "collection") {
7048
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CollectionResultCard, { result });
7281
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CollectionResultCard, { result });
7049
7282
  }
7050
7283
  if (result.kind === "signature") {
7051
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SignatureResultCard, { result });
7284
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SignatureResultCard, { result });
7052
7285
  }
7053
7286
  if (result.kind === "summary") {
7054
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ToolResultCard, { result });
7287
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ToolResultCard, { result });
7055
7288
  }
7056
7289
  return null;
7057
7290
  }
@@ -7060,9 +7293,9 @@ function isRenderableVisitorToolResult(result) {
7060
7293
  }
7061
7294
 
7062
7295
  // src/react/components/AgentRail/AgentRail.tsx
7063
- var import_jsx_runtime18 = require("react/jsx-runtime");
7296
+ var import_jsx_runtime19 = require("react/jsx-runtime");
7064
7297
  function MinimizeIcon() {
7065
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7298
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7066
7299
  "path",
7067
7300
  {
7068
7301
  d: "M3.5 8h9",
@@ -7073,7 +7306,7 @@ function MinimizeIcon() {
7073
7306
  ) });
7074
7307
  }
7075
7308
  function CloseIcon2() {
7076
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7309
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7077
7310
  "path",
7078
7311
  {
7079
7312
  d: "M4 4l8 8M12 4l-8 8",
@@ -7084,19 +7317,31 @@ function CloseIcon2() {
7084
7317
  ) });
7085
7318
  }
7086
7319
  function NewChatIcon() {
7087
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7088
- "path",
7089
- {
7090
- 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",
7091
- stroke: "currentColor",
7092
- strokeWidth: "1.4",
7093
- strokeLinecap: "round",
7094
- strokeLinejoin: "round"
7095
- }
7096
- ) });
7320
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("svg", { viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [
7321
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7322
+ "path",
7323
+ {
7324
+ d: "M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.86L21 8",
7325
+ stroke: "currentColor",
7326
+ strokeWidth: "2",
7327
+ strokeLinecap: "round",
7328
+ strokeLinejoin: "round"
7329
+ }
7330
+ ),
7331
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7332
+ "path",
7333
+ {
7334
+ d: "M21 3v5h-5",
7335
+ stroke: "currentColor",
7336
+ strokeWidth: "2",
7337
+ strokeLinecap: "round",
7338
+ strokeLinejoin: "round"
7339
+ }
7340
+ )
7341
+ ] });
7097
7342
  }
7098
7343
  function ExpandIcon() {
7099
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7344
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7100
7345
  "path",
7101
7346
  {
7102
7347
  d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
@@ -7108,7 +7353,7 @@ function ExpandIcon() {
7108
7353
  ) });
7109
7354
  }
7110
7355
  function RestoreIcon() {
7111
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7356
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7112
7357
  "path",
7113
7358
  {
7114
7359
  d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
@@ -7120,7 +7365,7 @@ function RestoreIcon() {
7120
7365
  ) });
7121
7366
  }
7122
7367
  function ChevronDownIcon() {
7123
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7368
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7124
7369
  "path",
7125
7370
  {
7126
7371
  d: "M4 6.5l4 4 4-4",
@@ -7144,6 +7389,8 @@ function AgentRail({
7144
7389
  disclaimerLink,
7145
7390
  answerReceipt = false,
7146
7391
  readAloud = false,
7392
+ showLearnMore = true,
7393
+ showSources = true,
7147
7394
  composerPlaceholder = "Ask anything\u2026",
7148
7395
  mobileFullscreen = false,
7149
7396
  expanded = false,
@@ -7160,21 +7407,32 @@ function AgentRail({
7160
7407
  onInputResponse,
7161
7408
  onToolInput
7162
7409
  }) {
7163
- const railRef = (0, import_react16.useRef)(null);
7164
- const overlayRef = (0, import_react16.useRef)(null);
7165
- const transcriptRef = (0, import_react16.useRef)(null);
7166
- const responseRef = (0, import_react16.useRef)(null);
7167
- const threadRef = (0, import_react16.useRef)(null);
7168
- const lastScrolledVisitorIdRef = (0, import_react16.useRef)(void 0);
7169
- const pinnedToBottomRef = (0, import_react16.useRef)(true);
7170
- const smoothScrollToLatestRef = (0, import_react16.useRef)(false);
7171
- const lockedTranscriptScrollTopRef = (0, import_react16.useRef)(null);
7172
- const [showJumpToLatest, setShowJumpToLatest] = (0, import_react16.useState)(false);
7173
- const [receiptOpen, setReceiptOpen] = (0, import_react16.useState)(false);
7410
+ const railRef = (0, import_react18.useRef)(null);
7411
+ const overlayRef = (0, import_react18.useRef)(null);
7412
+ const transcriptRef = (0, import_react18.useRef)(null);
7413
+ const responseRef = (0, import_react18.useRef)(null);
7414
+ const threadRef = (0, import_react18.useRef)(null);
7415
+ const lastScrolledVisitorIdRef = (0, import_react18.useRef)(void 0);
7416
+ const pinnedToBottomRef = (0, import_react18.useRef)(true);
7417
+ const smoothScrollToLatestRef = (0, import_react18.useRef)(false);
7418
+ const lockedTranscriptScrollTopRef = (0, import_react18.useRef)(null);
7419
+ const [showJumpToLatest, setShowJumpToLatest] = (0, import_react18.useState)(false);
7420
+ const [receiptOpen, setReceiptOpen] = (0, import_react18.useState)(false);
7421
+ const [expandedSourcesMessageId, setExpandedSourcesMessageId] = (0, import_react18.useState)(null);
7174
7422
  const resolvedBrandLabel = brandLabel.trim();
7175
7423
  const resolvedBrandLogoUrl = brandLogoUrl?.trim();
7176
7424
  const resolvedDisclaimerLabel = disclaimerLabel === void 0 ? DEFAULT_DISCLAIMER_LABEL : disclaimerLabel;
7177
- const [failedLogoUrl, setFailedLogoUrl] = (0, import_react16.useState)(null);
7425
+ const [failedLogoUrl, setFailedLogoUrl] = (0, import_react18.useState)(null);
7426
+ const [brandLogoDisplay, setBrandLogoDisplay] = (0, import_react18.useState)(null);
7427
+ (0, import_react18.useEffect)(() => {
7428
+ setFailedLogoUrl(null);
7429
+ }, [resolvedBrandLogoUrl]);
7430
+ const activeBrandLogoDisplay = brandLogoDisplay?.url === resolvedBrandLogoUrl ? brandLogoDisplay : null;
7431
+ const wideBrandLogo = activeBrandLogoDisplay?.wide ?? false;
7432
+ const brandLogoDisplaySize = activeBrandLogoDisplay ? {
7433
+ height: activeBrandLogoDisplay.height,
7434
+ width: activeBrandLogoDisplay.width
7435
+ } : null;
7178
7436
  const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
7179
7437
  const resolvedColorScheme = useAgentColorScheme(colorScheme);
7180
7438
  const railStyle = agentThemeStyle(theme, resolvedColorScheme);
@@ -7275,29 +7533,39 @@ function AgentRail({
7275
7533
  ...visibleVisitorToolResults
7276
7534
  ].reverse().find((result) => result.kind !== "input")?.id;
7277
7535
  const receiptSteps = answerReceipt && state.toolSteps.length > 0 ? state.toolSteps : void 0;
7278
- (0, import_react16.useEffect)(() => {
7536
+ (0, import_react18.useEffect)(() => {
7279
7537
  if (state.phase !== "complete") {
7280
7538
  setReceiptOpen(false);
7281
7539
  }
7282
7540
  }, [state.phase]);
7541
+ (0, import_react18.useEffect)(() => {
7542
+ if (state.phase !== "complete" || !showSources) {
7543
+ setExpandedSourcesMessageId(null);
7544
+ }
7545
+ }, [state.phase, showSources]);
7283
7546
  function handleSubmit(message, options) {
7284
7547
  setReceiptOpen(false);
7548
+ setExpandedSourcesMessageId(null);
7285
7549
  onSubmit?.(message, options);
7286
7550
  }
7287
7551
  function handleRegenerate() {
7288
7552
  setReceiptOpen(false);
7553
+ setExpandedSourcesMessageId(null);
7289
7554
  onRegenerate?.();
7290
7555
  }
7291
7556
  function handleReset() {
7292
7557
  setReceiptOpen(false);
7558
+ setExpandedSourcesMessageId(null);
7293
7559
  onReset?.();
7294
7560
  }
7295
7561
  function handleFollowUpSelect(label) {
7296
7562
  setReceiptOpen(false);
7297
- onFollowUpSelect?.(label);
7563
+ setExpandedSourcesMessageId(null);
7564
+ if (onFollowUpSelect) onFollowUpSelect(label);
7565
+ else onSubmit?.(label);
7298
7566
  }
7299
7567
  const latestVisitorId = visibleMessages[lastVisitorIndex]?.id;
7300
- (0, import_react16.useEffect)(() => {
7568
+ (0, import_react18.useEffect)(() => {
7301
7569
  const node = transcriptRef.current;
7302
7570
  if (!node) return;
7303
7571
  if (latestVisitorId !== lastScrolledVisitorIdRef.current) {
@@ -7327,7 +7595,7 @@ function AgentRail({
7327
7595
  state.followUps,
7328
7596
  state.journey
7329
7597
  ]);
7330
- (0, import_react16.useEffect)(() => {
7598
+ (0, import_react18.useEffect)(() => {
7331
7599
  const node = transcriptRef.current;
7332
7600
  if (!node) return;
7333
7601
  const handleScroll = () => {
@@ -7341,7 +7609,7 @@ function AgentRail({
7341
7609
  handleScroll();
7342
7610
  return () => node.removeEventListener("scroll", handleScroll);
7343
7611
  }, []);
7344
- (0, import_react16.useEffect)(() => {
7612
+ (0, import_react18.useEffect)(() => {
7345
7613
  if (!receiptOpen) {
7346
7614
  lockedTranscriptScrollTopRef.current = null;
7347
7615
  return;
@@ -7379,7 +7647,7 @@ function AgentRail({
7379
7647
  window.setTimeout(settle, 900);
7380
7648
  node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
7381
7649
  }
7382
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7650
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7383
7651
  "aside",
7384
7652
  {
7385
7653
  ref: railRef,
@@ -7393,44 +7661,72 @@ function AgentRail({
7393
7661
  autoFocus: mobileFullscreen || expanded,
7394
7662
  role: mobileFullscreen || expanded ? "dialog" : void 0,
7395
7663
  tabIndex: mobileFullscreen || expanded ? -1 : void 0,
7396
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AgentRailOverlayContext.Provider, { value: { railRef, overlayRef }, children: [
7397
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
7398
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("header", { className: "agent-rail__header", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "agent-rail__brand-row", children: [
7399
- onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7664
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(AgentRailOverlayContext.Provider, { value: { railRef, overlayRef }, children: [
7665
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
7666
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("header", { className: "agent-rail__header", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__brand-row", children: [
7667
+ onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7400
7668
  "button",
7401
7669
  {
7402
7670
  type: "button",
7403
7671
  className: "agent-rail__collapse",
7404
7672
  "aria-label": "Collapse assist",
7405
7673
  onClick: onCollapse,
7406
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(MinimizeIcon, {})
7674
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(MinimizeIcon, {})
7407
7675
  }
7408
- ) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7676
+ ) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7409
7677
  "button",
7410
7678
  {
7411
7679
  type: "button",
7412
7680
  className: "agent-rail__close",
7413
7681
  "aria-label": "Close agent",
7414
7682
  onClick: onClose,
7415
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(CloseIcon2, {})
7683
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(CloseIcon2, {})
7416
7684
  }
7417
- ) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
7418
- resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "agent-rail__identity", children: [
7419
- showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7420
- "img",
7685
+ ) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
7686
+ resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "agent-rail__identity", children: [
7687
+ showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7688
+ "span",
7421
7689
  {
7422
- className: "agent-rail__brand-logo",
7423
- src: resolvedBrandLogoUrl,
7424
- alt: "",
7425
- onError: () => {
7426
- setFailedLogoUrl(resolvedBrandLogoUrl ?? null);
7427
- }
7690
+ className: `agent-rail__brand-mark${wideBrandLogo ? " agent-rail__brand-mark--wide" : ""}`,
7691
+ "aria-hidden": "true",
7692
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7693
+ "img",
7694
+ {
7695
+ className: "agent-rail__brand-logo as-brand-logo-img",
7696
+ src: resolvedBrandLogoUrl,
7697
+ alt: "",
7698
+ decoding: "async",
7699
+ ...brandLogoDisplaySize ? {
7700
+ height: brandLogoDisplaySize.height,
7701
+ width: brandLogoDisplaySize.width
7702
+ } : {},
7703
+ onLoad: (event) => {
7704
+ const img = event.currentTarget;
7705
+ const display = snapBrandLogoDisplaySize({
7706
+ naturalHeight: img.naturalHeight,
7707
+ naturalWidth: img.naturalWidth,
7708
+ surface: "header"
7709
+ });
7710
+ if (!resolvedBrandLogoUrl) return;
7711
+ setBrandLogoDisplay({
7712
+ height: display.height,
7713
+ url: resolvedBrandLogoUrl,
7714
+ wide: display.wide,
7715
+ width: display.width
7716
+ });
7717
+ },
7718
+ onError: () => {
7719
+ setFailedLogoUrl(resolvedBrandLogoUrl ?? null);
7720
+ }
7721
+ },
7722
+ resolvedBrandLogoUrl
7723
+ )
7428
7724
  }
7429
- ) }) : null,
7430
- resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
7725
+ ) : null,
7726
+ resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
7431
7727
  ] }) : null,
7432
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "agent-rail__actions", children: [
7433
- onReset ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7728
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "agent-rail__actions", children: [
7729
+ onReset ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7434
7730
  "button",
7435
7731
  {
7436
7732
  type: "button",
@@ -7438,36 +7734,34 @@ function AgentRail({
7438
7734
  "aria-label": "Start a new conversation",
7439
7735
  disabled: !hasVisitorMessages2 || handoffActive && !handoff?.canReset,
7440
7736
  onClick: handleReset,
7441
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(NewChatIcon, {})
7737
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(NewChatIcon, {})
7442
7738
  }
7443
7739
  ) : null,
7444
- onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7740
+ onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7445
7741
  "button",
7446
7742
  {
7447
7743
  type: "button",
7448
7744
  className: "agent-rail__expand",
7449
7745
  "aria-label": expanded ? "Exit full screen" : "Open full screen",
7450
7746
  onClick: onExpandToggle,
7451
- children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ExpandIcon, {})
7747
+ children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ExpandIcon, {})
7452
7748
  }
7453
7749
  ) : null
7454
7750
  ] })
7455
7751
  ] }) }),
7456
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: threadRef, className: "agent-rail__thread", children: [
7457
- !hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
7458
- greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7752
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { ref: threadRef, className: "agent-rail__thread", children: [
7753
+ !hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
7754
+ greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7459
7755
  MessageBubble,
7460
7756
  {
7461
- showProvenance: Boolean(
7462
- handoff?.page?.enabled || handoffActive
7463
- ),
7757
+ showProvenance: true,
7464
7758
  message: greeting,
7465
7759
  bookingDisabled: isBusy || handoffActive,
7466
7760
  brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
7467
7761
  onBook
7468
7762
  }
7469
7763
  ) : null,
7470
- showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7764
+ showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7471
7765
  FollowUpChips,
7472
7766
  {
7473
7767
  suggestions: state.followUps,
@@ -7476,7 +7770,7 @@ function AgentRail({
7476
7770
  onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
7477
7771
  }
7478
7772
  ) }) : null,
7479
- showActivity ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7773
+ showActivity ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7480
7774
  AgentActivityBubble,
7481
7775
  {
7482
7776
  brandLabel: resolvedBrandLabel,
@@ -7485,7 +7779,7 @@ function AgentRail({
7485
7779
  steps: activitySteps
7486
7780
  }
7487
7781
  ) : null,
7488
- visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7782
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7489
7783
  VisitorToolResultView,
7490
7784
  {
7491
7785
  result,
@@ -7494,7 +7788,7 @@ function AgentRail({
7494
7788
  },
7495
7789
  result.id
7496
7790
  )),
7497
- pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7791
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7498
7792
  HumanInputCard,
7499
7793
  {
7500
7794
  request,
@@ -7503,129 +7797,195 @@ function AgentRail({
7503
7797
  request.requestId
7504
7798
  ))
7505
7799
  ] }) : null,
7506
- transcriptMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
7507
- "div",
7508
- {
7509
- ref: index === lastVisitorIndex + 1 ? responseRef : void 0,
7510
- className: "agent-rail__turn-block",
7511
- children: [
7512
- message.role === "agent" ? message.toolResults?.map((result) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7513
- VisitorToolResultView,
7514
- {
7515
- result
7516
- },
7517
- result.id
7518
- )) : null,
7519
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7520
- MessageBubble,
7521
- {
7522
- showProvenance: Boolean(
7523
- handoff?.page?.enabled || handoffActive
7524
- ),
7525
- message,
7526
- bookingDisabled: isBusy || handoffActive,
7527
- brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
7528
- offer: index === transcriptMessages.length - 1 ? state.pendingOffer : void 0,
7529
- onBook
7530
- }
7531
- ),
7532
- index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7533
- MessageActions,
7534
- {
7535
- answeredAt: message.createdAt,
7536
- copyText: hideToolCardFences(message.text).trim() || message.text,
7537
- readAloud,
7538
- receiptSteps,
7539
- onOpenReceipt: receiptSteps ? openReceipt : void 0,
7540
- onRegenerate: onRegenerate ? handleRegenerate : void 0,
7541
- onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
7542
- }
7543
- ) : null,
7544
- index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
7545
- showActivity ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7546
- AgentActivityBubble,
7547
- {
7548
- brandLabel: resolvedBrandLabel,
7549
- brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
7550
- failed: state.phase === "error",
7551
- steps: activitySteps
7552
- }
7553
- ) : null,
7554
- visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7800
+ transcriptMessages.map((message, index) => {
7801
+ const messageSourceCount = message.role === "agent" ? searchSources(message.searchResults ?? []).length : 0;
7802
+ const showAnswerActions = message.role === "agent" && index === lastAgentIndex && showMessageActions;
7803
+ const showSourcesToggle = message.role === "agent" && showSources && state.phase === "complete" && !message.streaming && messageSourceCount > 0;
7804
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7805
+ "div",
7806
+ {
7807
+ ref: index === lastVisitorIndex + 1 ? responseRef : void 0,
7808
+ className: "agent-rail__turn-block",
7809
+ children: [
7810
+ message.role === "agent" ? message.toolResults?.map((result) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7555
7811
  VisitorToolResultView,
7556
7812
  {
7557
- result,
7558
- disabled: semanticSurfaceDisabled,
7559
- onToolInput
7813
+ result
7560
7814
  },
7561
7815
  result.id
7562
- )),
7563
- pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7564
- HumanInputCard,
7816
+ )) : null,
7817
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7818
+ MessageBubble,
7565
7819
  {
7566
- request,
7567
- onRespond: onInputResponse
7568
- },
7569
- request.requestId
7570
- ))
7571
- ] }) : null
7572
- ]
7573
- },
7574
- message.role === "agent" && transcriptMessages[index - 1]?.role === "visitor" ? `answer-${transcriptMessages[index - 1]?.id}` : message.id
7575
- )),
7576
- waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(BookingCardLoader, {}) : null,
7577
- state.error ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
7578
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
7579
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("strong", { children: "Something went wrong" }),
7580
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: state.error })
7820
+ showProvenance: true,
7821
+ message,
7822
+ showSearchReferences: false,
7823
+ bookingDisabled: isBusy || handoffActive,
7824
+ brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
7825
+ offer: index === transcriptMessages.length - 1 ? state.pendingOffer : void 0,
7826
+ onBook
7827
+ }
7828
+ ),
7829
+ showAnswerActions || showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__answer-footer", children: [
7830
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__answer-actions", children: [
7831
+ showAnswerActions ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7832
+ MessageActions,
7833
+ {
7834
+ answeredAt: message.createdAt,
7835
+ copyText: hideToolCardFences(message.text).trim() || message.text,
7836
+ readAloud,
7837
+ receiptSteps,
7838
+ onOpenReceipt: receiptSteps ? () => openReceipt() : void 0,
7839
+ onRegenerate: onRegenerate ? handleRegenerate : void 0,
7840
+ onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
7841
+ }
7842
+ ) : null,
7843
+ showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
7844
+ "button",
7845
+ {
7846
+ className: "agent-rail__sources-button",
7847
+ type: "button",
7848
+ "aria-expanded": expandedSourcesMessageId === message.id,
7849
+ "aria-controls": `agent-rail-sources-${message.id}`,
7850
+ onClick: () => setExpandedSourcesMessageId(
7851
+ (current) => current === message.id ? null : message.id
7852
+ ),
7853
+ children: [
7854
+ "Explore More",
7855
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7856
+ "span",
7857
+ {
7858
+ className: "agent-rail__sources-button-chevron",
7859
+ "aria-hidden": "true",
7860
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronDownIcon, {})
7861
+ }
7862
+ )
7863
+ ]
7864
+ }
7865
+ ) : null
7866
+ ] }),
7867
+ showSourcesToggle ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7868
+ "div",
7869
+ {
7870
+ id: `agent-rail-sources-${message.id}`,
7871
+ className: `agent-rail__sources-panel${expandedSourcesMessageId === message.id ? " agent-rail__sources-panel--open" : ""}`,
7872
+ role: "region",
7873
+ "aria-label": "Explore More",
7874
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__sources-panel-inner", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7875
+ SearchReferences,
7876
+ {
7877
+ results: message.searchResults ?? [],
7878
+ mode: "sources"
7879
+ }
7880
+ ) })
7881
+ }
7882
+ ) : null
7883
+ ] }) : null,
7884
+ message.role === "agent" && !message.streaming ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7885
+ SearchReferences,
7886
+ {
7887
+ results: message.searchResults ?? [],
7888
+ mode: "actions"
7889
+ }
7890
+ ) : null,
7891
+ showAnswerActions && !handoffActive && showLearnMore ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7892
+ LearnMore,
7893
+ {
7894
+ results: message.searchResults ?? [],
7895
+ disabled: isBusy || !(onFollowUpSelect || onSubmit),
7896
+ onSelect: handleFollowUpSelect
7897
+ }
7898
+ ) : null,
7899
+ index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
7900
+ showActivity ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7901
+ AgentActivityBubble,
7902
+ {
7903
+ brandLabel: resolvedBrandLabel,
7904
+ brandLogoUrl: showBrandLogo ? resolvedBrandLogoUrl : void 0,
7905
+ failed: state.phase === "error",
7906
+ steps: activitySteps
7907
+ }
7908
+ ) : null,
7909
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7910
+ VisitorToolResultView,
7911
+ {
7912
+ result,
7913
+ disabled: semanticSurfaceDisabled,
7914
+ onToolInput
7915
+ },
7916
+ result.id
7917
+ )),
7918
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7919
+ HumanInputCard,
7920
+ {
7921
+ request,
7922
+ onRespond: onInputResponse
7923
+ },
7924
+ request.requestId
7925
+ ))
7926
+ ] }) : null
7927
+ ]
7928
+ },
7929
+ message.role === "agent" && transcriptMessages[index - 1]?.role === "visitor" ? `answer-${transcriptMessages[index - 1]?.id}` : message.id
7930
+ );
7931
+ }),
7932
+ waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BookingCardLoader, {}) : null,
7933
+ state.error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
7934
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
7935
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("strong", { children: "Something went wrong" }),
7936
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: state.error })
7581
7937
  ] }),
7582
- onRetry ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
7938
+ onRetry ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
7583
7939
  ] }) : null
7584
7940
  ] }) }),
7585
- showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7586
- "a",
7587
- {
7588
- href: disclaimerLink,
7589
- rel: "noopener noreferrer",
7590
- target: "_blank",
7591
- children: resolvedDisclaimerLabel
7592
- }
7593
- ) : resolvedDisclaimerLabel }) }) : null,
7594
- handoff && (handoff.page?.enabled || handoffActive) ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "agent-rail__handoff", children: [
7595
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("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?" }),
7596
- handoffStatus === "ai" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7941
+ handoff && (handoff.page?.enabled || handoffActive) ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__handoff", children: [
7942
+ handoffStatus === "human" || handoffStatus === "queued" || handoffStatus === "requesting" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "agent-rail__handoff-dot", "aria-hidden": "true" }) : null,
7943
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7944
+ "p",
7945
+ {
7946
+ className: "agent-rail__handoff-status",
7947
+ role: "status",
7948
+ "aria-live": "polite",
7949
+ children: !handoff.page ? "Checking conversation\u2026" : handoffStatus === "human" ? "Connected with support" : handoffStatus === "queued" ? "Waiting for a representative" : handoffStatus === "requesting" ? "Connecting you to support\u2026" : handoffStatus === "resolved" ? "Your conversation with support has ended" : handoffStatus === "failed" ? "We couldn\u2019t connect you to support" : "Need a person?"
7950
+ }
7951
+ ),
7952
+ handoffStatus === "ai" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7597
7953
  "button",
7598
7954
  {
7599
7955
  type: "button",
7956
+ className: "agent-rail__handoff-cta",
7600
7957
  disabled: handoff.busy || handoff.hasPending || isBusy,
7601
7958
  onClick: () => void handoff.start(),
7602
7959
  children: "Talk to a person"
7603
7960
  }
7604
7961
  ) : null,
7605
- handoffStatus === "resolved" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7962
+ handoffStatus === "resolved" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7606
7963
  "button",
7607
7964
  {
7608
7965
  type: "button",
7966
+ className: "agent-rail__handoff-action",
7609
7967
  disabled: handoff.busy || handoff.hasPending,
7610
7968
  onClick: () => void handoff.returnToAI(),
7611
7969
  children: "Return to AI"
7612
7970
  }
7613
7971
  ) : null,
7614
- handoffStatus === "failed" && onReset ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7972
+ handoffStatus === "failed" && onReset ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7615
7973
  "button",
7616
7974
  {
7617
7975
  type: "button",
7976
+ className: "agent-rail__handoff-action",
7618
7977
  disabled: !handoff.canReset,
7619
7978
  onClick: handleReset,
7620
7979
  children: "Start a new conversation"
7621
7980
  }
7622
7981
  ) : null,
7623
- handoff.error ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { role: "alert", children: [
7624
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: handoff.error }),
7625
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7982
+ handoff.error ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "agent-rail__handoff-error", role: "alert", children: [
7983
+ handoff.error,
7984
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7626
7985
  "button",
7627
7986
  {
7628
7987
  type: "button",
7988
+ className: "agent-rail__handoff-action",
7629
7989
  disabled: handoff.busy,
7630
7990
  onClick: () => void handoff.retry(),
7631
7991
  children: "Retry"
@@ -7633,8 +7993,17 @@ function AgentRail({
7633
7993
  )
7634
7994
  ] }) : null
7635
7995
  ] }) : null,
7636
- /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
7637
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7996
+ showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7997
+ "a",
7998
+ {
7999
+ href: disclaimerLink,
8000
+ rel: "noopener noreferrer",
8001
+ target: "_blank",
8002
+ children: resolvedDisclaimerLabel
8003
+ }
8004
+ ) : resolvedDisclaimerLabel }) }) : null,
8005
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
8006
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7638
8007
  LocationConsent,
7639
8008
  {
7640
8009
  request: locationRequest,
@@ -7642,7 +8011,7 @@ function AgentRail({
7642
8011
  },
7643
8012
  state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
7644
8013
  ),
7645
- showJumpToLatest ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8014
+ showJumpToLatest ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7646
8015
  "button",
7647
8016
  {
7648
8017
  type: "button",
@@ -7650,10 +8019,10 @@ function AgentRail({
7650
8019
  "aria-label": "Jump to the latest message",
7651
8020
  title: "Jump to the latest message",
7652
8021
  onClick: scrollToLatest,
7653
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDownIcon, {})
8022
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronDownIcon, {})
7654
8023
  }
7655
8024
  ) : null,
7656
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8025
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7657
8026
  Composer,
7658
8027
  {
7659
8028
  variant: expanded || mobileFullscreen ? "dock" : "default",
@@ -7670,11 +8039,11 @@ function AgentRail({
7670
8039
  },
7671
8040
  `${state.messages.find((message) => message.role === "visitor")?.id ?? "empty"}:${latestResultId ?? ""}`
7672
8041
  ),
7673
- poweredByLabel ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: poweredByLabel }) }) }) : null
8042
+ poweredByLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: poweredByLabel }) }) }) : null
7674
8043
  ] })
7675
8044
  ] }),
7676
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { ref: overlayRef, className: "agent-rail__overlay" }),
7677
- receiptOpen && receiptSteps ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
8045
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { ref: overlayRef, className: "agent-rail__overlay" }),
8046
+ receiptOpen && receiptSteps ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
7678
8047
  AnswerReceiptDialog,
7679
8048
  {
7680
8049
  brandLabel: resolvedBrandLabel,
@@ -7688,10 +8057,10 @@ function AgentRail({
7688
8057
  }
7689
8058
 
7690
8059
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
7691
- var import_react17 = require("react");
7692
- var import_jsx_runtime19 = require("react/jsx-runtime");
8060
+ var import_react19 = require("react");
8061
+ var import_jsx_runtime20 = require("react/jsx-runtime");
7693
8062
  function ChatSparkIcon() {
7694
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
8063
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
7695
8064
  "svg",
7696
8065
  {
7697
8066
  className: "assist-edge-tab__chat-spark",
@@ -7699,7 +8068,7 @@ function ChatSparkIcon() {
7699
8068
  fill: "none",
7700
8069
  "aria-hidden": "true",
7701
8070
  children: [
7702
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8071
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7703
8072
  "path",
7704
8073
  {
7705
8074
  className: "assist-edge-tab__spark assist-edge-tab__spark--a",
@@ -7707,7 +8076,7 @@ function ChatSparkIcon() {
7707
8076
  fill: "currentColor"
7708
8077
  }
7709
8078
  ),
7710
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8079
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7711
8080
  "path",
7712
8081
  {
7713
8082
  className: "assist-edge-tab__spark assist-edge-tab__spark--b",
@@ -7715,8 +8084,8 @@ function ChatSparkIcon() {
7715
8084
  fill: "currentColor"
7716
8085
  }
7717
8086
  ),
7718
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("g", { className: "assist-edge-tab__bot", children: [
7719
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8087
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("g", { className: "assist-edge-tab__bot", children: [
8088
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7720
8089
  "path",
7721
8090
  {
7722
8091
  d: "M11.15 5.2V3.05",
@@ -7725,8 +8094,8 @@ function ChatSparkIcon() {
7725
8094
  strokeLinecap: "round"
7726
8095
  }
7727
8096
  ),
7728
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("circle", { cx: "11.15", cy: "2.45", r: "0.85", fill: "currentColor" }),
7729
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8097
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("circle", { cx: "11.15", cy: "2.45", r: "0.85", fill: "currentColor" }),
8098
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7730
8099
  "rect",
7731
8100
  {
7732
8101
  x: "3.55",
@@ -7738,7 +8107,7 @@ function ChatSparkIcon() {
7738
8107
  strokeWidth: "1.9"
7739
8108
  }
7740
8109
  ),
7741
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8110
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7742
8111
  "circle",
7743
8112
  {
7744
8113
  className: "assist-edge-tab__eye",
@@ -7748,7 +8117,7 @@ function ChatSparkIcon() {
7748
8117
  fill: "currentColor"
7749
8118
  }
7750
8119
  ),
7751
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8120
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7752
8121
  "circle",
7753
8122
  {
7754
8123
  className: "assist-edge-tab__eye assist-edge-tab__eye--r",
@@ -7765,40 +8134,72 @@ function ChatSparkIcon() {
7765
8134
  }
7766
8135
  function TabMarkIcon({
7767
8136
  customIconUrl,
7768
- logoUrl
8137
+ logoUrl,
8138
+ chip = false
7769
8139
  }) {
7770
8140
  const custom = customIconUrl?.trim();
7771
8141
  const logo = logoUrl?.trim();
7772
- const [customFailed, setCustomFailed] = (0, import_react17.useState)(false);
7773
- const [logoFailed, setLogoFailed] = (0, import_react17.useState)(false);
8142
+ const [customFailed, setCustomFailed] = (0, import_react19.useState)(false);
8143
+ const [logoFailed, setLogoFailed] = (0, import_react19.useState)(false);
8144
+ const [markDisplay, setMarkDisplay] = (0, import_react19.useState)(null);
8145
+ function applyLauncherLogoSize(img, sourceUrl) {
8146
+ if (!chip) return;
8147
+ const display = snapBrandLogoDisplaySize({
8148
+ naturalHeight: img.naturalHeight,
8149
+ naturalWidth: img.naturalWidth,
8150
+ surface: "launcher"
8151
+ });
8152
+ setMarkDisplay({
8153
+ url: sourceUrl,
8154
+ width: display.width,
8155
+ height: display.height,
8156
+ wide: display.wide
8157
+ });
8158
+ }
8159
+ const chipMarkStyle = chip && markDisplay ? {
8160
+ width: `${markDisplay.width}px`,
8161
+ height: `${markDisplay.height}px`
8162
+ } : void 0;
7774
8163
  if (custom && !customFailed) {
7775
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8164
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7776
8165
  "img",
7777
8166
  {
7778
8167
  alt: "",
7779
8168
  "aria-hidden": true,
7780
- className: "assist-edge-tab__custom-icon",
8169
+ className: `assist-edge-tab__custom-icon as-brand-logo-img${chip ? " assist-edge-tab__custom-icon--chip" : ""}`,
7781
8170
  src: custom,
8171
+ decoding: "async",
8172
+ style: markDisplay?.url === custom ? chipMarkStyle : void 0,
8173
+ onLoad: (event) => {
8174
+ if (chip) {
8175
+ applyLauncherLogoSize(event.currentTarget, custom);
8176
+ }
8177
+ },
7782
8178
  onError: () => setCustomFailed(true)
7783
8179
  }
7784
8180
  );
7785
8181
  }
7786
8182
  if (logo && !logoFailed) {
7787
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8183
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7788
8184
  "img",
7789
8185
  {
7790
8186
  alt: "",
7791
8187
  "aria-hidden": true,
7792
- className: "assist-edge-tab__logo",
8188
+ 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" : ""}`,
7793
8189
  src: logo,
8190
+ decoding: "async",
8191
+ style: markDisplay?.url === logo ? chipMarkStyle : void 0,
8192
+ onLoad: (event) => {
8193
+ applyLauncherLogoSize(event.currentTarget, logo);
8194
+ },
7794
8195
  onError: () => setLogoFailed(true)
7795
8196
  }
7796
8197
  );
7797
8198
  }
7798
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChatSparkIcon, {});
8199
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChatSparkIcon, {});
7799
8200
  }
7800
8201
  function ChevronLeftIcon() {
7801
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8202
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7802
8203
  "path",
7803
8204
  {
7804
8205
  d: "M10 4L6 8l4 4",
@@ -7810,7 +8211,7 @@ function ChevronLeftIcon() {
7810
8211
  ) });
7811
8212
  }
7812
8213
  function ChevronDownIcon2() {
7813
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8214
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7814
8215
  "path",
7815
8216
  {
7816
8217
  d: "M4 6l4 4 4-4",
@@ -7822,7 +8223,7 @@ function ChevronDownIcon2() {
7822
8223
  ) });
7823
8224
  }
7824
8225
  function DragDots() {
7825
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("i", {}, index)) });
8226
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("i", {}, index)) });
7826
8227
  }
7827
8228
  var VARIANT_COPY = {
7828
8229
  outline: { label: "Ask anything", aria: "Ask anything" },
@@ -7866,6 +8267,7 @@ function AssistEdgeTab({
7866
8267
  "--tab-along": `${along}%`,
7867
8268
  "--tab-inset": `${inset}px`,
7868
8269
  ...resolvedBrandColor ? { "--as-brand": resolvedBrandColor } : {},
8270
+ ...pill && resolvedBrandColor ? { "--pill-logo-surface": resolvedBrandColor } : {},
7869
8271
  ...brandForeground ? { "--as-visitor-text": brandForeground } : {},
7870
8272
  ...resolvedBorderColor ? { "--as-border": resolvedBorderColor } : {},
7871
8273
  ...fontFamily ? { "--as-font-display": fontFamily } : {},
@@ -7877,7 +8279,7 @@ function AssistEdgeTab({
7877
8279
  ...!pill && resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
7878
8280
  colorScheme: chromeScheme
7879
8281
  };
7880
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
8282
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
7881
8283
  "button",
7882
8284
  {
7883
8285
  type: "button",
@@ -7889,15 +8291,16 @@ function AssistEdgeTab({
7889
8291
  tabIndex: visible ? 0 : -1,
7890
8292
  onClick: onOpen,
7891
8293
  children: [
7892
- pill ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
7893
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8294
+ pill ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
8295
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7894
8296
  "span",
7895
8297
  {
7896
8298
  className: `assist-edge-tab__mark assist-edge-tab__mark--chip${mobile ? " assist-edge-tab__mark--mobile" : ""}`,
7897
8299
  "aria-hidden": "true",
7898
- children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8300
+ children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7899
8301
  TabMarkIcon,
7900
8302
  {
8303
+ chip: true,
7901
8304
  customIconUrl,
7902
8305
  logoUrl
7903
8306
  },
@@ -7905,38 +8308,40 @@ function AssistEdgeTab({
7905
8308
  )
7906
8309
  }
7907
8310
  ),
7908
- /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "assist-edge-tab__text", children: [
7909
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7910
- visibleSubLabel ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__sublabel", children: visibleSubLabel }) : null
8311
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { className: "assist-edge-tab__text", children: [
8312
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
8313
+ visibleSubLabel ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__sublabel", children: visibleSubLabel }) : null
7911
8314
  ] })
7912
- ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
7913
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8315
+ ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
8316
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7914
8317
  TabMarkIcon,
7915
8318
  {
8319
+ chip: true,
7916
8320
  customIconUrl,
7917
8321
  logoUrl
7918
8322
  },
7919
8323
  markSourceKey
7920
8324
  ) }),
7921
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7922
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronDownIcon2, {})
8325
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
8326
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChevronDownIcon2, {})
7923
8327
  ] }) : null,
7924
- !pill && variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
7925
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronLeftIcon, {}),
7926
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7927
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DragDots, {})
8328
+ !pill && variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
8329
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChevronLeftIcon, {}),
8330
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
8331
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DragDots, {})
7928
8332
  ] }) : null,
7929
- !pill && variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
7930
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
8333
+ !pill && variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
8334
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7931
8335
  TabMarkIcon,
7932
8336
  {
8337
+ chip: true,
7933
8338
  customIconUrl,
7934
8339
  logoUrl
7935
8340
  },
7936
8341
  markSourceKey
7937
8342
  ) }),
7938
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7939
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(ChevronLeftIcon, {})
8343
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
8344
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ChevronLeftIcon, {})
7940
8345
  ] }) : null
7941
8346
  ]
7942
8347
  }
@@ -8000,7 +8405,7 @@ function sendAgentAnswerFeedback(eventUrl, event) {
8000
8405
  }
8001
8406
 
8002
8407
  // src/react/components/AgentWidget/AgentWidget.tsx
8003
- var import_jsx_runtime20 = require("react/jsx-runtime");
8408
+ var import_jsx_runtime21 = require("react/jsx-runtime");
8004
8409
  function AgentWidget({
8005
8410
  indexId,
8006
8411
  customerId,
@@ -8020,9 +8425,9 @@ function AgentWidget({
8020
8425
  }) {
8021
8426
  const isMobile = useIsMobile();
8022
8427
  const placement = normalizeAgentPlacement(placementInput);
8023
- const railSlotRef = (0, import_react18.useRef)(null);
8024
- const [railCollapsed, setRailCollapsed] = (0, import_react18.useState)(defaultCollapsed);
8025
- const [railExpanded, setRailExpanded] = (0, import_react18.useState)(false);
8428
+ const railSlotRef = (0, import_react20.useRef)(null);
8429
+ const [railCollapsed, setRailCollapsed] = (0, import_react20.useState)(defaultCollapsed);
8430
+ const [railExpanded, setRailExpanded] = (0, import_react20.useState)(false);
8026
8431
  const pageShiftActive = shouldApplyPageShift({
8027
8432
  pageShift,
8028
8433
  isMobile,
@@ -8077,7 +8482,7 @@ function AgentWidget({
8077
8482
  } : {},
8078
8483
  ...branding?.colors?.border ? { border: branding.colors.border } : {}
8079
8484
  };
8080
- (0, import_react18.useEffect)(() => {
8485
+ (0, import_react20.useEffect)(() => {
8081
8486
  if (!registerPanelController) return;
8082
8487
  registerAgentPanelController(customerId, {
8083
8488
  open: () => setRailCollapsed(false),
@@ -8112,7 +8517,7 @@ function AgentWidget({
8112
8517
  })
8113
8518
  );
8114
8519
  }
8115
- (0, import_react18.useEffect)(() => {
8520
+ (0, import_react20.useEffect)(() => {
8116
8521
  if (railCollapsed) return;
8117
8522
  const handleKeyDown = (event) => {
8118
8523
  if (event.key === "Tab" && (isMobile || railExpanded)) {
@@ -8146,19 +8551,19 @@ function AgentWidget({
8146
8551
  window.addEventListener("keydown", handleKeyDown);
8147
8552
  return () => window.removeEventListener("keydown", handleKeyDown);
8148
8553
  }, [isMobile, railCollapsed, railExpanded]);
8149
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "webless-agent-root", children: [
8150
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8554
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "webless-agent-root", children: [
8555
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8151
8556
  "div",
8152
8557
  {
8153
8558
  className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
8154
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8559
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8155
8560
  "div",
8156
8561
  {
8157
8562
  ref: railSlotRef,
8158
8563
  className: "webless-agent-root__rail-slot",
8159
8564
  inert: railCollapsed || void 0,
8160
8565
  "aria-hidden": railCollapsed,
8161
- children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8566
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8162
8567
  AgentRail,
8163
8568
  {
8164
8569
  theme,
@@ -8171,6 +8576,8 @@ function AgentWidget({
8171
8576
  disclaimerLink: branding?.disclaimerLink,
8172
8577
  answerReceipt: branding?.answerReceipt,
8173
8578
  readAloud: branding?.readAloud,
8579
+ showLearnMore: branding?.showLearnMore,
8580
+ showSources: branding?.showSources,
8174
8581
  state,
8175
8582
  handoff,
8176
8583
  mobileFullscreen: isMobile && !railCollapsed,
@@ -8196,7 +8603,7 @@ function AgentWidget({
8196
8603
  )
8197
8604
  }
8198
8605
  ),
8199
- railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
8606
+ railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8200
8607
  AssistEdgeTab,
8201
8608
  {
8202
8609
  variant: placement.variant,
@@ -8236,12 +8643,12 @@ function readUnpublishedPreviewBuildId(href) {
8236
8643
  }
8237
8644
 
8238
8645
  // src/embed/AgentWidget.tsx
8239
- var import_jsx_runtime21 = require("react/jsx-runtime");
8646
+ var import_jsx_runtime22 = require("react/jsx-runtime");
8240
8647
  function AgentWidget2({
8241
8648
  manifest
8242
8649
  }) {
8243
8650
  const defaultCollapsed = manifest.version !== "unpublished";
8244
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8651
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
8245
8652
  AgentWidget,
8246
8653
  {
8247
8654
  indexId: manifest.indexId,
@@ -8361,6 +8768,8 @@ function normalizeAgentBranding(branding) {
8361
8768
  disclaimerLink: normalizeOptionalHttpUrl(branding.disclaimerLink),
8362
8769
  answerReceipt: branding.answerReceipt === true ? true : void 0,
8363
8770
  readAloud: branding.readAloud === true ? true : void 0,
8771
+ showLearnMore: typeof branding.showLearnMore === "boolean" ? branding.showLearnMore : void 0,
8772
+ showSources: typeof branding.showSources === "boolean" ? branding.showSources : void 0,
8364
8773
  fontFamily: normalizeOptionalValue(branding.fontFamily),
8365
8774
  colors: colors && Object.keys(colors).length > 0 ? colors : void 0
8366
8775
  };
@@ -8368,7 +8777,7 @@ function normalizeAgentBranding(branding) {
8368
8777
  }
8369
8778
 
8370
8779
  // src/embed/mount.tsx
8371
- var import_jsx_runtime22 = require("react/jsx-runtime");
8780
+ var import_jsx_runtime23 = require("react/jsx-runtime");
8372
8781
  var mountedHandles = /* @__PURE__ */ new Map();
8373
8782
  var latestCustomerId = null;
8374
8783
  function resolveMountHost(manifest, script) {
@@ -8398,7 +8807,7 @@ function mountAgent(input) {
8398
8807
  const host = createHost(manifest.customerId);
8399
8808
  mountTarget.append(host);
8400
8809
  const root = (0, import_client7.createRoot)(host);
8401
- root.render(/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AgentWidget2, { manifest }));
8810
+ root.render(/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AgentWidget2, { manifest }));
8402
8811
  const handle = {
8403
8812
  customerId: manifest.customerId,
8404
8813
  manifest,