@webless/agent 0.7.4 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/react.cjs CHANGED
@@ -24,6 +24,7 @@ __export(react_exports, {
24
24
  AGENT_STRUCTURED_TOOL_INPUT_HEADER: () => AGENT_STRUCTURED_TOOL_INPUT_HEADER,
25
25
  AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION: () => AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION,
26
26
  AgentRail: () => AgentRail,
27
+ AgentTranscript: () => AgentTranscript,
27
28
  AgentWidget: () => AgentWidget,
28
29
  AssistEdgeTab: () => AssistEdgeTab,
29
30
  DEFAULT_AGENT_PLACEMENT: () => DEFAULT_AGENT_PLACEMENT,
@@ -1357,10 +1358,10 @@ var AgentSession = class {
1357
1358
  }
1358
1359
  this.session = session;
1359
1360
  const inputResponses = responses.map(
1360
- ({ requestId, optionId, text }) => ({
1361
+ ({ requestId, optionId, text: text2 }) => ({
1361
1362
  requestId,
1362
1363
  ...optionId ? { optionId } : {},
1363
- ...text ? { text } : {}
1364
+ ...text2 ? { text: text2 } : {}
1364
1365
  })
1365
1366
  );
1366
1367
  const response = await withCapabilityRefresh(
@@ -1588,19 +1589,19 @@ function parseVisitorFormFields(value) {
1588
1589
  const fields = [];
1589
1590
  const seen = /* @__PURE__ */ new Set();
1590
1591
  for (const item of value) {
1591
- const record = asRecord(item);
1592
- const id = asString(record?.id).toLowerCase().replace(/[^a-z0-9_-]/g, "");
1593
- const kind = asString(record?.kind);
1594
- if (!record || !id || seen.has(id) || !isFieldKind2(kind)) continue;
1592
+ const record2 = asRecord(item);
1593
+ const id = asString(record2?.id).toLowerCase().replace(/[^a-z0-9_-]/g, "");
1594
+ const kind = asString(record2?.kind);
1595
+ if (!record2 || !id || seen.has(id) || !isFieldKind2(kind)) continue;
1595
1596
  seen.add(id);
1596
- const label = asString(record.label) || id;
1597
+ const label = asString(record2.label) || id;
1597
1598
  fields.push({
1598
1599
  id,
1599
1600
  kind,
1600
1601
  label,
1601
- placeholder: asString(record.placeholder) || label,
1602
- required: record.required !== false,
1603
- ...asString(record.autocomplete) ? { autocomplete: asString(record.autocomplete) } : {}
1602
+ placeholder: asString(record2.placeholder) || label,
1603
+ required: record2.required !== false,
1604
+ ...asString(record2.autocomplete) ? { autocomplete: asString(record2.autocomplete) } : {}
1604
1605
  });
1605
1606
  if (fields.length >= MAX_FORM_FIELDS) break;
1606
1607
  }
@@ -1631,52 +1632,52 @@ function formatComposerFormMessage(form, values) {
1631
1632
  return value ? `${field.label}: ${value}` : "";
1632
1633
  }).filter(Boolean).join("\n");
1633
1634
  }
1634
- function looksLikeFieldCollection(text) {
1635
+ function looksLikeFieldCollection(text2) {
1635
1636
  return /\b(please|need|send|share|enter|provide|add|collect|what|which|use)\b/i.test(
1636
- text
1637
- ) || /:\s*$/m.test(text) || /^[-*•]\s+/m.test(text);
1637
+ text2
1638
+ ) || /:\s*$/m.test(text2) || /^[-*•]\s+/m.test(text2);
1638
1639
  }
1639
- function looksLikeBookingCopy(text) {
1640
+ function looksLikeBookingCopy(text2) {
1640
1641
  return /book(ing)? (card|a demo|this time)|pick a (date|time)|available (times|slots)|calendly/i.test(
1641
- text
1642
+ text2
1642
1643
  );
1643
1644
  }
1644
- function echoedLabeledFieldIds(text) {
1645
+ function echoedLabeledFieldIds(text2) {
1645
1646
  const ids = /* @__PURE__ */ new Set();
1646
- if (/\bname\s*:\s+\S+/i.test(text)) ids.add("name");
1647
- if (/\be-?mail\s*:\s+\S+/i.test(text)) ids.add("email");
1648
- if (/\bphone\s*:\s+\S+/i.test(text)) ids.add("phone");
1649
- if (/\bcompany\s*:\s+\S+/i.test(text)) ids.add("company");
1647
+ if (/\bname\s*:\s+\S+/i.test(text2)) ids.add("name");
1648
+ if (/\be-?mail\s*:\s+\S+/i.test(text2)) ids.add("email");
1649
+ if (/\bphone\s*:\s+\S+/i.test(text2)) ids.add("phone");
1650
+ if (/\bcompany\s*:\s+\S+/i.test(text2)) ids.add("company");
1650
1651
  return ids;
1651
1652
  }
1652
- function matchLibraryFields(text) {
1653
+ function matchLibraryFields(text2) {
1653
1654
  return FIELD_LIBRARY.flatMap((field) => {
1654
- if (field.exclude?.test(text)) {
1655
- const leftover = text.replace(field.exclude, " ");
1655
+ if (field.exclude?.test(text2)) {
1656
+ const leftover = text2.replace(field.exclude, " ");
1656
1657
  if (!field.patterns.some((pattern) => pattern.test(leftover))) return [];
1657
- } else if (!field.patterns.some((pattern) => pattern.test(text))) {
1658
+ } else if (!field.patterns.some((pattern) => pattern.test(text2))) {
1658
1659
  return [];
1659
1660
  }
1660
1661
  const { patterns: _patterns, exclude: _exclude, ...next } = field;
1661
1662
  return [next];
1662
1663
  }).slice(0, MAX_FORM_FIELDS);
1663
1664
  }
1664
- function looksLikeCompletedActionRecap(text) {
1665
- const confirmingCreate = /\bshould i create this\b/i.test(text);
1666
- const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(text) && /[^\s@]+@[^\s@]+\.[^\s@]+/i.test(text);
1665
+ function looksLikeCompletedActionRecap(text2) {
1666
+ const confirmingCreate = /\bshould i create this\b/i.test(text2);
1667
+ const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(text2) && /[^\s@]+@[^\s@]+\.[^\s@]+/i.test(text2);
1667
1668
  if (echoingFilledFields) {
1668
- if (looksLikeFieldCollection(text)) {
1669
- const echoed = echoedLabeledFieldIds(text);
1670
- if (matchLibraryFields(text).some((field) => !echoed.has(field.id))) {
1669
+ if (looksLikeFieldCollection(text2)) {
1670
+ const echoed = echoedLabeledFieldIds(text2);
1671
+ if (matchLibraryFields(text2).some((field) => !echoed.has(field.id))) {
1671
1672
  return false;
1672
1673
  }
1673
1674
  }
1674
1675
  return true;
1675
1676
  }
1676
- return confirmingCreate && !looksLikeFieldCollection(text);
1677
+ return confirmingCreate && !looksLikeFieldCollection(text2);
1677
1678
  }
1678
- function inferComposerForm(text) {
1679
- const cleaned = text.trim();
1679
+ function inferComposerForm(text2) {
1680
+ const cleaned = text2.trim();
1680
1681
  if (!cleaned || looksLikeBookingCopy(cleaned) || looksLikeCompletedActionRecap(cleaned) || !looksLikeFieldCollection(cleaned)) {
1681
1682
  return null;
1682
1683
  }
@@ -1691,8 +1692,8 @@ function resolveComposerForm(input) {
1691
1692
  if (input.enabled === false || input.hasBookingOffer || input.hasPendingConfirmation) {
1692
1693
  return null;
1693
1694
  }
1694
- const text = input.agentText.trim();
1695
- if (!text) return null;
1695
+ const text2 = input.agentText.trim();
1696
+ if (!text2) return null;
1696
1697
  const card = input.cards?.find((item) => item.type === "visitor_form");
1697
1698
  if (card?.fields && card.fields.length >= MIN_FORM_FIELDS) {
1698
1699
  return {
@@ -1700,7 +1701,7 @@ function resolveComposerForm(input) {
1700
1701
  fields: card.fields.slice(0, MAX_FORM_FIELDS)
1701
1702
  };
1702
1703
  }
1703
- return inferComposerForm(text);
1704
+ return inferComposerForm(text2);
1704
1705
  }
1705
1706
 
1706
1707
  // src/react/lib/tool-card.ts
@@ -1714,9 +1715,9 @@ function preferBookingOffer(current, next) {
1714
1715
  }
1715
1716
  return next;
1716
1717
  }
1717
- function looksLikeBookingReady(text) {
1718
+ function looksLikeBookingReady(text2) {
1718
1719
  return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|\bschedule\b/i.test(
1719
- text
1720
+ text2
1720
1721
  );
1721
1722
  }
1722
1723
  function bookingOfferIdentityKey(offer) {
@@ -1740,19 +1741,19 @@ function isEventTypeUri(value) {
1740
1741
  return /^https:\/\/api\.calendly\.com\/event_types\/[^/]+$/i.test(value);
1741
1742
  }
1742
1743
  function parseToolCard(value) {
1743
- const record = asRecord2(value);
1744
- if (!record) return null;
1745
- if (record.booking_offer && asString2(record.type) !== "booking_offer") {
1746
- const nested = parseToolCard(record.booking_offer);
1744
+ const record2 = asRecord2(value);
1745
+ if (!record2) return null;
1746
+ if (record2.booking_offer && asString2(record2.type) !== "booking_offer") {
1747
+ const nested = parseToolCard(record2.booking_offer);
1747
1748
  if (nested) return nested;
1748
1749
  }
1749
- if (record.visitor_booking && asString2(record.type) !== "booking_confirmed") {
1750
- const nested = parseToolCard(record.visitor_booking);
1750
+ if (record2.visitor_booking && asString2(record2.type) !== "booking_confirmed") {
1751
+ const nested = parseToolCard(record2.visitor_booking);
1751
1752
  if (nested) return nested;
1752
1753
  }
1753
- const type = asString2(record.type);
1754
+ const type = asString2(record2.type);
1754
1755
  if (type === "booking_offer") {
1755
- const eventTypes = Array.isArray(record.eventTypes) ? record.eventTypes.flatMap((item) => {
1756
+ const eventTypes = Array.isArray(record2.eventTypes) ? record2.eventTypes.flatMap((item) => {
1756
1757
  const entry = asRecord2(item);
1757
1758
  const uri = asString2(entry?.uri);
1758
1759
  if (!entry || !uri) return [];
@@ -1769,7 +1770,7 @@ function parseToolCard(value) {
1769
1770
  }
1770
1771
  ];
1771
1772
  }) : [];
1772
- const slots = Array.isArray(record.slots) ? record.slots.flatMap((item) => {
1773
+ const slots = Array.isArray(record2.slots) ? record2.slots.flatMap((item) => {
1773
1774
  const entry = asRecord2(item);
1774
1775
  const startTime = asString2(entry?.startTime);
1775
1776
  if (!entry || !startTime) return [];
@@ -1785,11 +1786,11 @@ function parseToolCard(value) {
1785
1786
  return { type: "booking_offer", eventTypes, slots };
1786
1787
  }
1787
1788
  if (type === "booking_confirmed") {
1788
- const eventUri = asString2(record.eventUri);
1789
+ const eventUri = asString2(record2.eventUri);
1789
1790
  if (!isEventUri(eventUri)) return null;
1790
- const inviteeUri = asString2(record.inviteeUri);
1791
- const inviteeEmail = asString2(record.inviteeEmail);
1792
- const startTime = asString2(record.startTime);
1791
+ const inviteeUri = asString2(record2.inviteeUri);
1792
+ const inviteeEmail = asString2(record2.inviteeEmail);
1793
+ const startTime = asString2(record2.startTime);
1793
1794
  return {
1794
1795
  type: "booking_confirmed",
1795
1796
  eventUri,
@@ -1799,12 +1800,12 @@ function parseToolCard(value) {
1799
1800
  };
1800
1801
  }
1801
1802
  if (type === "booking_canceled") {
1802
- const eventUri = asString2(record.eventUri);
1803
+ const eventUri = asString2(record2.eventUri);
1803
1804
  if (!isEventUri(eventUri)) return null;
1804
1805
  return { type: "booking_canceled", eventUri };
1805
1806
  }
1806
1807
  if (type === "visitor_form") {
1807
- const fields = parseVisitorFormFields(record.fields);
1808
+ const fields = parseVisitorFormFields(record2.fields);
1808
1809
  if (fields.length < 2) return null;
1809
1810
  return { type: "visitor_form", fields };
1810
1811
  }
@@ -1822,33 +1823,33 @@ function formatBookingOfferFence(offer) {
1822
1823
  ].join("\n");
1823
1824
  }
1824
1825
  function bookingCardFromActionOutput(output) {
1825
- const record = asRecord2(output);
1826
- const data = asRecord2(record?.output) ?? asRecord2(record?.data) ?? record;
1826
+ const record2 = asRecord2(output);
1827
+ const data = asRecord2(record2?.output) ?? asRecord2(record2?.data) ?? record2;
1827
1828
  return parseToolCard(data);
1828
1829
  }
1829
- function ensureBookingOfferText(text, offer) {
1830
- if (!offer) return text;
1831
- if (extractToolCards(text).some((card) => card.type === "booking_offer")) {
1832
- return text;
1830
+ function ensureBookingOfferText(text2, offer) {
1831
+ if (!offer) return text2;
1832
+ if (extractToolCards(text2).some((card) => card.type === "booking_offer")) {
1833
+ return text2;
1833
1834
  }
1834
- const visible = stripToolCards(text).trim() || text.trim();
1835
+ const visible = stripToolCards(text2).trim() || text2.trim();
1835
1836
  return `${visible}
1836
1837
 
1837
1838
  ${formatBookingOfferFence(offer)}`;
1838
1839
  }
1839
- function hideToolCardFences(text) {
1840
- return text.replace(/```(?:webless-tool-card|json)\s*[\s\S]*?```/gi, "").replace(/```(?:webless-tool-card|json)[\s\S]*$/i, "").replace(/\n{3,}/g, "\n\n").trim();
1840
+ function hideToolCardFences(text2) {
1841
+ return text2.replace(/```(?:webless-tool-card|json)\s*[\s\S]*?```/gi, "").replace(/```(?:webless-tool-card|json)[\s\S]*$/i, "").replace(/\n{3,}/g, "\n\n").trim();
1841
1842
  }
1842
1843
  var BOOKING_CARD_FALLBACK = "Pick a date and time that works for you.";
1843
- function looksLikeBookingAvailabilityDump(text) {
1844
- const cleaned = text.trim();
1844
+ function looksLikeBookingAvailabilityDump(text2) {
1845
+ const cleaned = text2.trim();
1845
1846
  if (!cleaned) return false;
1846
1847
  const isoCount = (cleaned.match(/\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/g) ?? []).length;
1847
1848
  const utcCount = (cleaned.match(/\bUTC\b/g) ?? []).length;
1848
1849
  return isoCount >= 2 || utcCount >= 2 || /api\.calendly\.com|calendly\.com\//i.test(cleaned) || /webless-tool-card/i.test(cleaned);
1849
1850
  }
1850
- function sanitizeBookingOfferCopy(text) {
1851
- const cleaned = hideToolCardFences(text);
1851
+ function sanitizeBookingOfferCopy(text2) {
1852
+ const cleaned = hideToolCardFences(text2);
1852
1853
  if (!cleaned || looksLikeBookingAvailabilityDump(cleaned)) {
1853
1854
  return BOOKING_CARD_FALLBACK;
1854
1855
  }
@@ -1861,9 +1862,9 @@ function visitorTimeZone() {
1861
1862
  return "UTC";
1862
1863
  }
1863
1864
  }
1864
- function extractToolCards(text) {
1865
+ function extractToolCards(text2) {
1865
1866
  const cards = [];
1866
- for (const match of text.matchAll(FENCE_PATTERN)) {
1867
+ for (const match of text2.matchAll(FENCE_PATTERN)) {
1867
1868
  try {
1868
1869
  const card = parseToolCard(JSON.parse(match[1] ?? ""));
1869
1870
  if (card) cards.push(card);
@@ -1872,8 +1873,8 @@ function extractToolCards(text) {
1872
1873
  }
1873
1874
  return cards;
1874
1875
  }
1875
- function stripToolCards(text) {
1876
- return text.replace(FENCE_PATTERN, "").replace(/\n{3,}/g, "\n\n").trim();
1876
+ function stripToolCards(text2) {
1877
+ return text2.replace(FENCE_PATTERN, "").replace(/\n{3,}/g, "\n\n").trim();
1877
1878
  }
1878
1879
  function localDateKey(date) {
1879
1880
  if (Number.isNaN(date.getTime())) return "";
@@ -1982,6 +1983,72 @@ function visitorBookingPrefix(booking) {
1982
1983
  ].join("\n");
1983
1984
  }
1984
1985
 
1986
+ // src/runtime/search-discovery.ts
1987
+ function record(value) {
1988
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
1989
+ }
1990
+ function text(value, max = 500) {
1991
+ return typeof value === "string" && value.trim().length > 0 && value.trim().length <= max;
1992
+ }
1993
+ function safeSearchUrl(value) {
1994
+ if (typeof value !== "string") return void 0;
1995
+ try {
1996
+ const url = new URL(value);
1997
+ return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password ? url.href : void 0;
1998
+ } catch {
1999
+ return void 0;
2000
+ }
2001
+ }
2002
+ function parseAgentSearchReferences(value) {
2003
+ const data = record(value);
2004
+ if (!data || !Array.isArray(data.sources) || data.sources.length > 20)
2005
+ return null;
2006
+ const sources = [];
2007
+ for (const value2 of data.sources) {
2008
+ const source = record(value2);
2009
+ if (!source || Object.keys(source).some(
2010
+ (key) => !["id", "title", "url"].includes(key)
2011
+ ) || !text(source.id, Infinity) || !text(source.title) || source.url !== void 0 && typeof source.url !== "string")
2012
+ return null;
2013
+ const url = safeSearchUrl(source.url);
2014
+ sources.push({
2015
+ id: source.id.trim(),
2016
+ title: source.title.trim(),
2017
+ ...url ? { url } : {}
2018
+ });
2019
+ }
2020
+ let cta;
2021
+ if (data.cta !== void 0) {
2022
+ const action = record(data.cta);
2023
+ if (!action || Object.keys(action).some((key) => !["label", "url"].includes(key)) || !text(action.label) || action.url !== void 0 && typeof action.url !== "string")
2024
+ return null;
2025
+ const url = safeSearchUrl(action.url);
2026
+ cta = { label: action.label.trim(), ...url ? { url } : {} };
2027
+ }
2028
+ return { sources, ...cta ? { cta } : {} };
2029
+ }
2030
+ function parseAgentSearchDiscoveryOutput(value) {
2031
+ let decoded = value;
2032
+ if (typeof value === "string") {
2033
+ try {
2034
+ decoded = JSON.parse(value);
2035
+ } catch {
2036
+ return null;
2037
+ }
2038
+ }
2039
+ const data = record(decoded);
2040
+ if (!data || Object.keys(data).some(
2041
+ (key) => !["answer", "sources", "cta", "suggestions"].includes(key)
2042
+ ) || !text(data.answer, 5e4) || !Array.isArray(data.suggestions) || data.suggestions.length > 8 || !data.suggestions.every((item) => text(item)))
2043
+ return null;
2044
+ const references = parseAgentSearchReferences(data);
2045
+ return references ? {
2046
+ ...references,
2047
+ answer: data.answer.trim(),
2048
+ suggestions: data.suggestions.map((item) => item.trim())
2049
+ } : null;
2050
+ }
2051
+
1985
2052
  // src/react/persisted-conversation.ts
1986
2053
  var CONVERSATION_VERSION = 3;
1987
2054
  function conversationKey(storageKeyPrefix, visitorSessionId) {
@@ -1989,82 +2056,87 @@ function conversationKey(storageKeyPrefix, visitorSessionId) {
1989
2056
  }
1990
2057
  function parseMessage(value) {
1991
2058
  if (typeof value !== "object" || value === null) return null;
1992
- const record = value;
1993
- if (typeof record.id !== "string" || record.role !== "agent" && record.role !== "visitor" || typeof record.text !== "string" || typeof record.createdAt !== "number" || !Number.isFinite(record.createdAt)) {
2059
+ const record2 = value;
2060
+ if (typeof record2.id !== "string" || record2.role !== "agent" && record2.role !== "visitor" || typeof record2.text !== "string" || typeof record2.createdAt !== "number" || !Number.isFinite(record2.createdAt)) {
1994
2061
  return null;
1995
2062
  }
1996
- if (record.role === "visitor") {
2063
+ if (record2.role === "visitor") {
1997
2064
  return {
1998
- id: record.id,
2065
+ id: record2.id,
1999
2066
  role: "visitor",
2000
- text: record.text,
2001
- createdAt: record.createdAt,
2002
- ...typeof record.runtimeText === "string" && record.runtimeText ? { runtimeText: record.runtimeText } : {}
2067
+ text: record2.text,
2068
+ createdAt: record2.createdAt,
2069
+ ...typeof record2.runtimeText === "string" && record2.runtimeText ? { runtimeText: record2.runtimeText } : {}
2003
2070
  };
2004
2071
  }
2072
+ const searchResults = Array.isArray(record2.searchResults) ? record2.searchResults.flatMap((value2) => {
2073
+ const result = parseToolResult(value2);
2074
+ return result?.kind === "search" ? [result] : [];
2075
+ }) : [];
2005
2076
  return {
2006
- id: record.id,
2077
+ id: record2.id,
2007
2078
  role: "agent",
2008
- text: record.text,
2009
- createdAt: record.createdAt
2079
+ ...searchResults.length ? { searchResults } : {},
2080
+ text: record2.text,
2081
+ createdAt: record2.createdAt
2010
2082
  };
2011
2083
  }
2012
2084
  function parseToolStep(value) {
2013
2085
  if (typeof value !== "object" || value === null) return null;
2014
- const record = value;
2015
- if (typeof record.id !== "string" || record.kind !== "planning" && record.kind !== "search" && record.kind !== "specialist" || typeof record.label !== "string" || record.state !== "completed" && record.state !== "active" && record.state !== "pending" && record.state !== "error") {
2086
+ const record2 = value;
2087
+ if (typeof record2.id !== "string" || record2.kind !== "planning" && record2.kind !== "search" && record2.kind !== "specialist" || typeof record2.label !== "string" || record2.state !== "completed" && record2.state !== "active" && record2.state !== "pending" && record2.state !== "error") {
2016
2088
  return null;
2017
2089
  }
2018
2090
  return {
2019
- id: record.id,
2020
- kind: record.kind,
2021
- label: record.label,
2022
- state: record.state,
2023
- ...typeof record.detail === "string" && record.detail ? { detail: record.detail } : {}
2091
+ id: record2.id,
2092
+ kind: record2.kind,
2093
+ label: record2.label,
2094
+ state: record2.state,
2095
+ ...typeof record2.detail === "string" && record2.detail ? { detail: record2.detail } : {}
2024
2096
  };
2025
2097
  }
2026
2098
  function parseInputOption(value) {
2027
2099
  if (typeof value !== "object" || value === null) return null;
2028
- const record = value;
2029
- if (typeof record.id !== "string" || typeof record.label !== "string") {
2100
+ const record2 = value;
2101
+ if (typeof record2.id !== "string" || typeof record2.label !== "string") {
2030
2102
  return null;
2031
2103
  }
2032
2104
  return {
2033
- id: record.id,
2034
- label: record.label,
2035
- ...typeof record.description === "string" ? { description: record.description } : {},
2036
- ...record.style === "default" || record.style === "primary" || record.style === "danger" ? { style: record.style } : {}
2105
+ id: record2.id,
2106
+ label: record2.label,
2107
+ ...typeof record2.description === "string" ? { description: record2.description } : {},
2108
+ ...record2.style === "default" || record2.style === "primary" || record2.style === "danger" ? { style: record2.style } : {}
2037
2109
  };
2038
2110
  }
2039
2111
  function parseInputRequest(value) {
2040
2112
  if (typeof value !== "object" || value === null) return null;
2041
- const record = value;
2042
- if (typeof record.requestId !== "string" || record.kind !== "question" && record.kind !== "session-limit" && record.kind !== "tool-approval" || typeof record.prompt !== "string") {
2113
+ const record2 = value;
2114
+ if (typeof record2.requestId !== "string" || record2.kind !== "question" && record2.kind !== "session-limit" && record2.kind !== "tool-approval" || typeof record2.prompt !== "string") {
2043
2115
  return null;
2044
2116
  }
2045
- const action = record.action;
2117
+ const action = record2.action;
2046
2118
  if (typeof action !== "object" || action === null) return null;
2047
2119
  const actionRecord = action;
2048
2120
  if (typeof actionRecord.callId !== "string" || actionRecord.kind !== "tool-call" || typeof actionRecord.toolName !== "string") {
2049
2121
  return null;
2050
2122
  }
2051
- const options = Array.isArray(record.options) ? record.options.map(parseInputOption) : void 0;
2052
- if (Array.isArray(record.options) && options?.some((option) => option === null)) {
2123
+ const options = Array.isArray(record2.options) ? record2.options.map(parseInputOption) : void 0;
2124
+ if (Array.isArray(record2.options) && options?.some((option) => option === null)) {
2053
2125
  return null;
2054
2126
  }
2055
- const ui = record.ui ? parseAgentToolUiSurface(record.ui) : void 0;
2056
- if (record.ui && !ui) return null;
2127
+ const ui = record2.ui ? parseAgentToolUiSurface(record2.ui) : void 0;
2128
+ if (record2.ui && !ui) return null;
2057
2129
  return {
2058
- requestId: record.requestId,
2059
- kind: record.kind,
2060
- prompt: record.prompt,
2130
+ requestId: record2.requestId,
2131
+ kind: record2.kind,
2132
+ prompt: record2.prompt,
2061
2133
  action: {
2062
2134
  callId: actionRecord.callId,
2063
2135
  kind: "tool-call",
2064
2136
  toolName: actionRecord.toolName
2065
2137
  },
2066
- ...record.display === "confirmation" || record.display === "select" || record.display === "text" ? { display: record.display } : {},
2067
- ...record.allowFreeform === true ? { allowFreeform: true } : {},
2138
+ ...record2.display === "confirmation" || record2.display === "select" || record2.display === "text" ? { display: record2.display } : {},
2139
+ ...record2.allowFreeform === true ? { allowFreeform: true } : {},
2068
2140
  ...options && options.length > 0 ? {
2069
2141
  options: options.filter(
2070
2142
  (option) => option !== null
@@ -2075,40 +2147,50 @@ function parseInputRequest(value) {
2075
2147
  }
2076
2148
  function parseToolResult(value) {
2077
2149
  if (typeof value !== "object" || value === null) return null;
2078
- const record = value;
2079
- if (typeof record.id !== "string" || typeof record.toolName !== "string" || record.status !== "completed" && record.status !== "failed" && record.status !== "rejected") {
2150
+ const record2 = value;
2151
+ if (typeof record2.id !== "string" || typeof record2.toolName !== "string" || record2.status !== "completed" && record2.status !== "failed" && record2.status !== "rejected") {
2080
2152
  return null;
2081
2153
  }
2082
- if (record.kind === "input") {
2154
+ if (record2.kind === "search" && record2.toolName === "search_discovery" && record2.status === "completed") {
2155
+ const references = parseAgentSearchReferences(record2);
2156
+ return references ? {
2157
+ id: record2.id,
2158
+ toolName: "search_discovery",
2159
+ status: "completed",
2160
+ kind: "search",
2161
+ ...references
2162
+ } : null;
2163
+ }
2164
+ if (record2.kind === "input") {
2083
2165
  const surface = parseAgentToolUiSurface(
2084
- record.surface
2166
+ record2.surface
2085
2167
  );
2086
2168
  return surface ? {
2087
- id: record.id,
2088
- toolName: record.toolName,
2089
- status: record.status,
2169
+ id: record2.id,
2170
+ toolName: record2.toolName,
2171
+ status: record2.status,
2090
2172
  kind: "input",
2091
2173
  surface
2092
2174
  } : null;
2093
2175
  }
2094
- if (record.kind === "entity" && typeof record.title === "string") {
2176
+ if (record2.kind === "entity" && typeof record2.title === "string") {
2095
2177
  return {
2096
- id: record.id,
2097
- toolName: record.toolName,
2098
- status: record.status,
2178
+ id: record2.id,
2179
+ toolName: record2.toolName,
2180
+ status: record2.status,
2099
2181
  kind: "entity",
2100
- title: record.title,
2101
- ...typeof record.description === "string" ? { description: record.description } : {}
2182
+ title: record2.title,
2183
+ ...typeof record2.description === "string" ? { description: record2.description } : {}
2102
2184
  };
2103
2185
  }
2104
- if (record.kind === "collection" && typeof record.title === "string" && Array.isArray(record.items)) {
2186
+ if (record2.kind === "collection" && typeof record2.title === "string" && Array.isArray(record2.items)) {
2105
2187
  return {
2106
- id: record.id,
2107
- toolName: record.toolName,
2108
- status: record.status,
2188
+ id: record2.id,
2189
+ toolName: record2.toolName,
2190
+ status: record2.status,
2109
2191
  kind: "collection",
2110
- title: record.title,
2111
- items: record.items.flatMap((item) => {
2192
+ title: record2.title,
2193
+ items: record2.items.flatMap((item) => {
2112
2194
  if (typeof item !== "object" || item === null) return [];
2113
2195
  const entry = item;
2114
2196
  if (typeof entry.title !== "string") return [];
@@ -2122,26 +2204,26 @@ function parseToolResult(value) {
2122
2204
  })
2123
2205
  };
2124
2206
  }
2125
- if (record.kind === "signature" && typeof record.title === "string") {
2207
+ if (record2.kind === "signature" && typeof record2.title === "string") {
2126
2208
  return {
2127
- id: record.id,
2128
- toolName: record.toolName,
2129
- status: record.status,
2209
+ id: record2.id,
2210
+ toolName: record2.toolName,
2211
+ status: record2.status,
2130
2212
  kind: "signature",
2131
- title: record.title,
2132
- ...typeof record.description === "string" ? { description: record.description } : {},
2133
- ...typeof record.statusLabel === "string" ? { statusLabel: record.statusLabel } : {}
2213
+ title: record2.title,
2214
+ ...typeof record2.description === "string" ? { description: record2.description } : {},
2215
+ ...typeof record2.statusLabel === "string" ? { statusLabel: record2.statusLabel } : {}
2134
2216
  };
2135
2217
  }
2136
- if (record.kind !== "summary" || typeof record.title !== "string")
2218
+ if (record2.kind !== "summary" || typeof record2.title !== "string")
2137
2219
  return null;
2138
2220
  return {
2139
- id: record.id,
2140
- toolName: record.toolName,
2141
- status: record.status,
2221
+ id: record2.id,
2222
+ toolName: record2.toolName,
2223
+ status: record2.status,
2142
2224
  kind: "summary",
2143
- title: record.title,
2144
- ...typeof record.description === "string" ? { description: record.description } : {}
2225
+ title: record2.title,
2226
+ ...typeof record2.description === "string" ? { description: record2.description } : {}
2145
2227
  };
2146
2228
  }
2147
2229
  function visitorTurnText(message) {
@@ -2156,29 +2238,29 @@ function loadPersistedAgentConversation(storageKeyPrefix, visitorSessionId) {
2156
2238
  try {
2157
2239
  const value = JSON.parse(raw);
2158
2240
  if (typeof value !== "object" || value === null) return null;
2159
- const record = value;
2160
- if (record.version !== 1 && record.version !== 2 && record.version !== CONVERSATION_VERSION || !Array.isArray(record.messages) || typeof record.pending !== "boolean" || typeof record.streamingText !== "string" || record.version === CONVERSATION_VERSION && !Array.isArray(record.toolSteps)) {
2241
+ const record2 = value;
2242
+ if (record2.version !== 1 && record2.version !== 2 && record2.version !== CONVERSATION_VERSION || !Array.isArray(record2.messages) || typeof record2.pending !== "boolean" || typeof record2.streamingText !== "string" || record2.version === CONVERSATION_VERSION && !Array.isArray(record2.toolSteps)) {
2161
2243
  return null;
2162
2244
  }
2163
- const messages = record.messages.map(parseMessage);
2245
+ const messages = record2.messages.map(parseMessage);
2164
2246
  if (messages.some((message) => message === null)) return null;
2165
- const storedToolSteps = (record.version === 2 || record.version === CONVERSATION_VERSION) && Array.isArray(record.toolSteps) ? record.toolSteps : [];
2247
+ const storedToolSteps = (record2.version === 2 || record2.version === CONVERSATION_VERSION) && Array.isArray(record2.toolSteps) ? record2.toolSteps : [];
2166
2248
  const toolSteps = storedToolSteps.map(parseToolStep);
2167
2249
  if (toolSteps.some((step) => step === null)) return null;
2168
- const storedToolResults = record.version === CONVERSATION_VERSION && Array.isArray(record.toolResults) ? record.toolResults : [];
2250
+ const storedToolResults = record2.version === CONVERSATION_VERSION && Array.isArray(record2.toolResults) ? record2.toolResults : [];
2169
2251
  const toolResults = storedToolResults.map(parseToolResult);
2170
2252
  if (toolResults.some((result) => result === null)) return null;
2171
- const storedPendingInputs = Array.isArray(record.pendingInputs) ? record.pendingInputs : [];
2253
+ const storedPendingInputs = Array.isArray(record2.pendingInputs) ? record2.pendingInputs : [];
2172
2254
  const pendingInputs = storedPendingInputs.map(parseInputRequest);
2173
2255
  if (pendingInputs.some((request) => request === null)) return null;
2174
2256
  return {
2175
2257
  messages: messages.filter(
2176
2258
  (message) => message !== null
2177
2259
  ),
2178
- pending: record.pending,
2179
- streamingText: record.streamingText,
2260
+ pending: record2.pending,
2261
+ streamingText: record2.streamingText,
2180
2262
  toolSteps: toolSteps.filter((step) => step !== null),
2181
- ...Array.isArray(record.toolResults) ? {
2263
+ ...Array.isArray(record2.toolResults) ? {
2182
2264
  toolResults: toolResults.filter(
2183
2265
  (result) => result !== null
2184
2266
  )
@@ -2219,13 +2301,13 @@ function loadPendingWidgetBooking(storageKeyPrefix, visitorSessionId) {
2219
2301
  try {
2220
2302
  const value = JSON.parse(raw);
2221
2303
  if (typeof value !== "object" || value === null) return null;
2222
- const record = value;
2223
- if (typeof record.eventUri !== "string" || !record.eventUri) return null;
2304
+ const record2 = value;
2305
+ if (typeof record2.eventUri !== "string" || !record2.eventUri) return null;
2224
2306
  return {
2225
- eventUri: record.eventUri,
2226
- ...typeof record.inviteeUri === "string" && record.inviteeUri ? { inviteeUri: record.inviteeUri } : {},
2227
- ...typeof record.inviteeEmail === "string" && record.inviteeEmail ? { inviteeEmail: record.inviteeEmail } : {},
2228
- ...typeof record.startTime === "string" && record.startTime ? { startTime: record.startTime } : {}
2307
+ eventUri: record2.eventUri,
2308
+ ...typeof record2.inviteeUri === "string" && record2.inviteeUri ? { inviteeUri: record2.inviteeUri } : {},
2309
+ ...typeof record2.inviteeEmail === "string" && record2.inviteeEmail ? { inviteeEmail: record2.inviteeEmail } : {},
2310
+ ...typeof record2.startTime === "string" && record2.startTime ? { startTime: record2.startTime } : {}
2229
2311
  };
2230
2312
  } catch {
2231
2313
  return null;
@@ -2313,10 +2395,10 @@ function safeText(value) {
2313
2395
  return value.trim().slice(0, MAX_TEXT_LENGTH);
2314
2396
  }
2315
2397
  function safeHref(value) {
2316
- const text = safeText(value);
2317
- if (!text) return "";
2398
+ const text2 = safeText(value);
2399
+ if (!text2) return "";
2318
2400
  try {
2319
- const url = new URL(text);
2401
+ const url = new URL(text2);
2320
2402
  return url.protocol === "https:" ? url.toString() : "";
2321
2403
  } catch {
2322
2404
  return "";
@@ -2536,6 +2618,22 @@ function finalizeSummaryPresentation(result, proposed) {
2536
2618
  };
2537
2619
  }
2538
2620
  function presentVisitorToolResult(result, registry = []) {
2621
+ if (result.toolName === "search_discovery" && result.status === "completed") {
2622
+ const envelope2 = parseAgentToolResultEnvelope(result.output);
2623
+ const search = parseAgentSearchDiscoveryOutput(
2624
+ envelope2?.output ?? result.output
2625
+ );
2626
+ if (search) {
2627
+ return {
2628
+ id: result.callId,
2629
+ toolName: "search_discovery",
2630
+ status: "completed",
2631
+ kind: "search",
2632
+ sources: search.sources,
2633
+ ...search.cta ? { cta: search.cta } : {}
2634
+ };
2635
+ }
2636
+ }
2539
2637
  const envelope = parseAgentToolResultEnvelope(result.output) ?? providerErrorEnvelope(result.output) ?? legacyBookingEnvelope(result.output);
2540
2638
  const proposed = envelope ? resolvePresenterOutput(result, envelope, registry) : null;
2541
2639
  if (proposed?.kind === "booking") {
@@ -2600,8 +2698,8 @@ function presentVisitorToolResult(result, registry = []) {
2600
2698
  return finalizeSummaryPresentation(result, proposed);
2601
2699
  }
2602
2700
  function providerErrorEnvelope(output) {
2603
- const record = asRecord3(output);
2604
- const providerError = asRecord3(record?.providerError);
2701
+ const record2 = asRecord3(output);
2702
+ const providerError = asRecord3(record2?.providerError);
2605
2703
  const message = safeText(providerError?.message);
2606
2704
  const action = safeText(providerError?.action);
2607
2705
  if (!message || !action) return null;
@@ -2657,15 +2755,15 @@ function appendChatCollectiblePrompts(messages, requests) {
2657
2755
  }
2658
2756
  return next;
2659
2757
  }
2660
- function chatInputResponseForText(requests, text) {
2661
- const trimmed = text.trim();
2758
+ function chatInputResponseForText(requests, text2) {
2759
+ const trimmed = text2.trim();
2662
2760
  if (!trimmed) return null;
2663
2761
  const pending = requests.find(isChatCollectibleInputRequest);
2664
2762
  if (!pending) return null;
2665
2763
  return { requestId: pending.requestId, text: trimmed };
2666
2764
  }
2667
- function normalizeAssistantDedupeKey(text) {
2668
- return text.trim().replace(/\s+/g, " ").toLowerCase();
2765
+ function normalizeAssistantDedupeKey(text2) {
2766
+ return text2.trim().replace(/\s+/g, " ").toLowerCase();
2669
2767
  }
2670
2768
  function isNearDuplicateAssistantText(left, right) {
2671
2769
  const a = normalizeAssistantDedupeKey(left);
@@ -2679,13 +2777,14 @@ function isNearDuplicateAssistantText(left, right) {
2679
2777
  shorter.slice(0, Math.floor(shorter.length * 0.85))
2680
2778
  );
2681
2779
  }
2682
- function appendAgentTurnMessage(messages, displayText) {
2780
+ function appendAgentTurnMessage(messages, displayText, searchResults = []) {
2683
2781
  const trimmed = displayText.trim();
2684
- if (!trimmed) return [...messages];
2782
+ if (!trimmed && searchResults.length === 0) return [...messages];
2685
2783
  const agentMessage = {
2686
2784
  id: `agent-${Date.now()}`,
2687
2785
  role: "agent",
2688
2786
  text: trimmed,
2787
+ ...searchResults.length ? { searchResults } : {},
2689
2788
  createdAt: Date.now()
2690
2789
  };
2691
2790
  const last = messages.at(-1);
@@ -3064,7 +3163,14 @@ function useAgentChat({
3064
3163
  setState((prev) => ({
3065
3164
  ...prev,
3066
3165
  phase: (prev.pendingInputs ?? []).some(shouldRenderVisitorInputCard) ? "waiting-input" : "complete",
3067
- messages: appendAgentTurnMessage(prev.messages, displayText),
3166
+ messages: appendAgentTurnMessage(
3167
+ prev.messages,
3168
+ displayText,
3169
+ (prev.toolResults ?? []).filter((result) => result.kind === "search")
3170
+ ),
3171
+ toolResults: (prev.toolResults ?? []).filter(
3172
+ (result) => result.kind !== "search"
3173
+ ),
3068
3174
  toolSteps: completeActivePlanning(prev.toolSteps),
3069
3175
  streamingText: "",
3070
3176
  pendingOffer: bookingConfirmed ? null : capturedOffers.at(-1) ?? prev.pendingOffer,
@@ -3472,6 +3578,48 @@ var defaultDarkAgentRailTheme = {
3472
3578
  danger: "#ff8da1"
3473
3579
  };
3474
3580
 
3581
+ // src/react/lib/agent-theme.ts
3582
+ function agentThemeStyle(theme, resolvedColorScheme) {
3583
+ const brandedTheme = { ...defaultAgentRailTheme, ...theme };
3584
+ const resolvedTheme = resolvedColorScheme === "dark" ? {
3585
+ ...brandedTheme,
3586
+ brand: theme?.brand ?? defaultDarkAgentRailTheme.brand,
3587
+ brandDeep: theme?.brandDeep ?? defaultDarkAgentRailTheme.brandDeep,
3588
+ brandSoft: theme?.brandSoft ?? `color-mix(in srgb, ${theme?.brand ?? defaultDarkAgentRailTheme.brand} 18%, ${defaultDarkAgentRailTheme.surface})`,
3589
+ border: theme?.border ?? defaultDarkAgentRailTheme.border,
3590
+ danger: theme?.danger ?? defaultDarkAgentRailTheme.danger,
3591
+ onBrand: theme?.onBrand ?? defaultDarkAgentRailTheme.onBrand,
3592
+ success: theme?.success ?? defaultDarkAgentRailTheme.success,
3593
+ surface: theme?.surface ?? defaultDarkAgentRailTheme.surface,
3594
+ surfaceMuted: theme?.surfaceMuted ?? defaultDarkAgentRailTheme.surfaceMuted,
3595
+ text: theme?.text ?? defaultDarkAgentRailTheme.text,
3596
+ textMuted: theme?.textMuted ?? defaultDarkAgentRailTheme.textMuted,
3597
+ textSubtle: theme?.textSubtle ?? defaultDarkAgentRailTheme.textSubtle,
3598
+ visitorBubble: theme?.visitorBubble ?? theme?.brand ?? defaultDarkAgentRailTheme.visitorBubble
3599
+ } : brandedTheme;
3600
+ return {
3601
+ "--rail-width": resolvedTheme.railMaxWidth,
3602
+ "--as-rail-max-width": resolvedTheme.railMaxWidth,
3603
+ "--as-brand": resolvedTheme.brand,
3604
+ "--as-brand-soft": resolvedTheme.brandSoft,
3605
+ "--as-brand-deep": resolvedTheme.brandDeep,
3606
+ "--as-surface": resolvedTheme.surface,
3607
+ "--as-surface-muted": resolvedTheme.surfaceMuted,
3608
+ "--as-text": resolvedTheme.text,
3609
+ "--as-text-muted": resolvedTheme.textMuted,
3610
+ "--as-text-subtle": resolvedTheme.textSubtle,
3611
+ "--as-border": resolvedTheme.border,
3612
+ "--as-visitor-bubble": resolvedTheme.visitorBubble,
3613
+ "--as-visitor-text": resolvedTheme.visitorText,
3614
+ "--as-on-brand": resolvedTheme.onBrand,
3615
+ "--as-success": resolvedTheme.success,
3616
+ "--as-danger": resolvedTheme.danger,
3617
+ "--as-font-body": resolvedTheme.fontBody,
3618
+ "--as-font-display": resolvedTheme.fontDisplay,
3619
+ colorScheme: resolvedColorScheme
3620
+ };
3621
+ }
3622
+
3475
3623
  // src/react/hooks/useAgentColorScheme.ts
3476
3624
  var import_react4 = require("react");
3477
3625
  var DARK_MODE_QUERY = "(prefers-color-scheme: dark)";
@@ -4082,9 +4230,111 @@ function FollowUpChips({
4082
4230
  // src/react/components/MessageBubble/MessageBubble.tsx
4083
4231
  var import_react10 = require("react");
4084
4232
 
4233
+ // src/react/components/SearchReferences/SearchReferences.tsx
4234
+ var import_jsx_runtime5 = require("react/jsx-runtime");
4235
+ function SiteIcon() {
4236
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4237
+ "svg",
4238
+ {
4239
+ viewBox: "0 0 24 24",
4240
+ width: "18",
4241
+ height: "18",
4242
+ fill: "none",
4243
+ stroke: "currentColor",
4244
+ strokeWidth: "1.5",
4245
+ "aria-hidden": "true",
4246
+ children: [
4247
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
4248
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
4249
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
4250
+ ]
4251
+ }
4252
+ );
4253
+ }
4254
+ function SearchReferences({
4255
+ results
4256
+ }) {
4257
+ const seenSources = /* @__PURE__ */ new Set();
4258
+ const sources = results.flatMap((result) => result.sources).flatMap((source) => {
4259
+ const url = safeSearchUrl(source.url);
4260
+ const key = url ?? source.id;
4261
+ if (seenSources.has(key)) return [];
4262
+ seenSources.add(key);
4263
+ return [{ ...source, url, key }];
4264
+ });
4265
+ const seenActions = /* @__PURE__ */ new Set();
4266
+ const actions = results.flatMap((result) => {
4267
+ const url = safeSearchUrl(result.cta?.url);
4268
+ if (!url || !result.cta || seenActions.has(url)) return [];
4269
+ seenActions.add(url);
4270
+ return [{ label: result.cta.label, url }];
4271
+ });
4272
+ if (!sources.length && !actions.length) return null;
4273
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "search-references", children: [
4274
+ sources.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { "aria-label": "Sources", children: [
4275
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("h3", { className: "search-references__heading", children: [
4276
+ "Sources",
4277
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { title: "Pages used by Search & Discovery", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4278
+ "svg",
4279
+ {
4280
+ viewBox: "0 0 24 24",
4281
+ width: "14",
4282
+ height: "14",
4283
+ fill: "none",
4284
+ stroke: "currentColor",
4285
+ strokeWidth: "1.75",
4286
+ "aria-hidden": "true",
4287
+ children: [
4288
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("circle", { cx: "12", cy: "12", r: "9" }),
4289
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("path", { d: "M12 11v6M12 7v1" })
4290
+ ]
4291
+ }
4292
+ ) })
4293
+ ] }),
4294
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ul", { className: "search-references__list", children: sources.map((source) => {
4295
+ const content = /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
4296
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__icon", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(SiteIcon, {}) }),
4297
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("span", { className: "search-references__copy", children: [
4298
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4299
+ "span",
4300
+ {
4301
+ className: "search-references__title",
4302
+ title: source.title,
4303
+ children: source.title
4304
+ }
4305
+ ),
4306
+ source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "search-references__domain", children: new URL(source.url).hostname.replace(/^www\./u, "") }) : null
4307
+ ] })
4308
+ ] });
4309
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("li", { children: source.url ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4310
+ "a",
4311
+ {
4312
+ className: "search-references__source",
4313
+ href: source.url,
4314
+ target: "_blank",
4315
+ rel: "noopener noreferrer",
4316
+ children: content
4317
+ }
4318
+ ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__source", children: content }) }, source.key);
4319
+ }) })
4320
+ ] }) : null,
4321
+ actions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4322
+ "a",
4323
+ {
4324
+ className: "search-references__cta",
4325
+ href: action.url,
4326
+ target: "_blank",
4327
+ rel: "noopener noreferrer",
4328
+ children: action.label
4329
+ },
4330
+ action.url
4331
+ )) }) : null
4332
+ ] });
4333
+ }
4334
+
4085
4335
  // src/react/components/BookingCard/BookingCard.tsx
4086
4336
  var import_react9 = require("react");
4087
- var import_jsx_runtime5 = require("react/jsx-runtime");
4337
+ var import_jsx_runtime6 = require("react/jsx-runtime");
4088
4338
  var BOOKING_STEPS = [
4089
4339
  { id: "date", label: "Date" },
4090
4340
  { id: "time", label: "Time" },
@@ -4115,7 +4365,7 @@ function calendarCells(year, month) {
4115
4365
  return cells;
4116
4366
  }
4117
4367
  function BookingCardLoader() {
4118
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
4368
+ 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" }) });
4119
4369
  }
4120
4370
  function BookingCard({
4121
4371
  disabled = false,
@@ -4214,14 +4464,14 @@ function BookingCard({
4214
4464
  })
4215
4465
  });
4216
4466
  }
4217
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4467
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4218
4468
  "section",
4219
4469
  {
4220
4470
  className: "booking-card",
4221
4471
  "aria-busy": disabled || void 0,
4222
4472
  "aria-label": "Book a meeting",
4223
- children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
4224
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("ol", { className: "booking-card__steps", "aria-label": "Booking steps", children: BOOKING_STEPS.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4473
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
4474
+ /* @__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)(
4225
4475
  "li",
4226
4476
  {
4227
4477
  className: [
@@ -4231,40 +4481,40 @@ function BookingCard({
4231
4481
  ].filter(Boolean).join(" "),
4232
4482
  "aria-current": index === stepIndex ? "step" : void 0,
4233
4483
  children: [
4234
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { "aria-hidden": "true", children: index + 1 }),
4235
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: item.label })
4484
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { "aria-hidden": "true", children: index + 1 }),
4485
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: item.label })
4236
4486
  ]
4237
4487
  },
4238
4488
  item.id
4239
4489
  )) }),
4240
- step === "date" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
4241
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
4242
- timeZone ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "booking-card__tz", children: [
4490
+ step === "date" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
4491
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
4492
+ timeZone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "booking-card__tz", children: [
4243
4493
  "Times in ",
4244
4494
  timeZone
4245
4495
  ] }) : null,
4246
- offer.eventTypes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4496
+ offer.eventTypes.length > 1 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
4247
4497
  "label",
4248
4498
  {
4249
4499
  className: "booking-card__field",
4250
4500
  htmlFor: `${fieldId}-type`,
4251
4501
  children: [
4252
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Meeting" }),
4253
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4502
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Meeting" }),
4503
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4254
4504
  "select",
4255
4505
  {
4256
4506
  id: `${fieldId}-type`,
4257
4507
  value: eventTypeUri,
4258
4508
  disabled,
4259
4509
  onChange: (event) => selectEventType(event.target.value),
4260
- children: offer.eventTypes.map((item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: item.uri, children: item.name }, item.uri))
4510
+ children: offer.eventTypes.map((item) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("option", { value: item.uri, children: item.name }, item.uri))
4261
4511
  }
4262
4512
  )
4263
4513
  ]
4264
4514
  }
4265
4515
  ) : null,
4266
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "booking-card__month", children: [
4267
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4516
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__month", children: [
4517
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4268
4518
  "button",
4269
4519
  {
4270
4520
  type: "button",
@@ -4275,8 +4525,8 @@ function BookingCard({
4275
4525
  children: "\u2039"
4276
4526
  }
4277
4527
  ),
4278
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
4279
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4528
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
4529
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4280
4530
  "button",
4281
4531
  {
4282
4532
  type: "button",
@@ -4288,9 +4538,9 @@ function BookingCard({
4288
4538
  }
4289
4539
  )
4290
4540
  ] }),
4291
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "booking-card__weekdays", children: weekdays.map((label) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: label }, label)) }),
4292
- offer.slots.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
4293
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4541
+ /* @__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)) }),
4542
+ offer.slots.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
4543
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4294
4544
  "div",
4295
4545
  {
4296
4546
  className: "booking-card__calendar",
@@ -4298,7 +4548,7 @@ function BookingCard({
4298
4548
  "aria-label": "Available dates",
4299
4549
  children: cells.map((cell, index) => {
4300
4550
  if (!cell) {
4301
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4551
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4302
4552
  "span",
4303
4553
  {
4304
4554
  className: "booking-card__day"
@@ -4308,7 +4558,7 @@ function BookingCard({
4308
4558
  }
4309
4559
  const available = availableByDate.has(cell.key);
4310
4560
  const selected = cell.key === selectedDate;
4311
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4561
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4312
4562
  "button",
4313
4563
  {
4314
4564
  type: "button",
@@ -4328,9 +4578,9 @@ function BookingCard({
4328
4578
  }
4329
4579
  )
4330
4580
  ] }, "date") : null,
4331
- step === "time" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
4332
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "booking-card__step-bar", children: [
4333
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4581
+ step === "time" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
4582
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step-bar", children: [
4583
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4334
4584
  "button",
4335
4585
  {
4336
4586
  type: "button",
@@ -4341,15 +4591,15 @@ function BookingCard({
4341
4591
  children: "\u2039"
4342
4592
  }
4343
4593
  ),
4344
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
4345
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
4346
- timeZone ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { className: "booking-card__tz", children: [
4594
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
4595
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
4596
+ timeZone ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("p", { className: "booking-card__tz", children: [
4347
4597
  "Times in ",
4348
4598
  timeZone
4349
4599
  ] }) : null
4350
4600
  ] })
4351
4601
  ] }),
4352
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4602
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4353
4603
  "button",
4354
4604
  {
4355
4605
  type: "button",
@@ -4361,9 +4611,9 @@ function BookingCard({
4361
4611
  slot.startTime
4362
4612
  )) })
4363
4613
  ] }, "time") : null,
4364
- step === "details" ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
4365
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "booking-card__step-bar", children: [
4366
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4614
+ step === "details" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step", ref: activeStepRef, children: [
4615
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__step-bar", children: [
4616
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4367
4617
  "button",
4368
4618
  {
4369
4619
  type: "button",
@@ -4374,21 +4624,21 @@ function BookingCard({
4374
4624
  children: "\u2039"
4375
4625
  }
4376
4626
  ),
4377
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { children: [
4378
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "booking-card__title", children: "Enter details" }),
4379
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
4380
- selectedType?.location ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "booking-card__tz", children: selectedType.location }) : null
4627
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
4628
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__title", children: "Enter details" }),
4629
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
4630
+ selectedType?.location ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "booking-card__tz", children: selectedType.location }) : null
4381
4631
  ] })
4382
4632
  ] }),
4383
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "booking-card__identity", children: [
4384
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4633
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "booking-card__identity", children: [
4634
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
4385
4635
  "label",
4386
4636
  {
4387
4637
  className: "booking-card__field",
4388
4638
  htmlFor: `${fieldId}-name`,
4389
4639
  children: [
4390
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Name" }),
4391
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4640
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Name" }),
4641
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4392
4642
  "input",
4393
4643
  {
4394
4644
  id: `${fieldId}-name`,
@@ -4402,14 +4652,14 @@ function BookingCard({
4402
4652
  ]
4403
4653
  }
4404
4654
  ),
4405
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
4655
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
4406
4656
  "label",
4407
4657
  {
4408
4658
  className: "booking-card__field",
4409
4659
  htmlFor: `${fieldId}-email`,
4410
4660
  children: [
4411
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: "Email" }),
4412
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4661
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: "Email" }),
4662
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4413
4663
  "input",
4414
4664
  {
4415
4665
  id: `${fieldId}-email`,
@@ -4425,7 +4675,7 @@ function BookingCard({
4425
4675
  }
4426
4676
  )
4427
4677
  ] }),
4428
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4678
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4429
4679
  "button",
4430
4680
  {
4431
4681
  type: "submit",
@@ -4443,9 +4693,9 @@ function BookingCard({
4443
4693
  // src/react/components/MessageBubble/MessageBubble.tsx
4444
4694
  var import_streamdown = require("streamdown");
4445
4695
  var import_styles = require("streamdown/styles.css");
4446
- var import_jsx_runtime6 = require("react/jsx-runtime");
4447
- function normalizeDedupeText(text) {
4448
- return text.trim().replace(/\s+/g, " ").toLowerCase();
4696
+ var import_jsx_runtime7 = require("react/jsx-runtime");
4697
+ function normalizeDedupeText(text2) {
4698
+ return text2.trim().replace(/\s+/g, " ").toLowerCase();
4449
4699
  }
4450
4700
  function paragraphsAreNearDuplicates(first, second) {
4451
4701
  const left = normalizeDedupeText(first);
@@ -4461,8 +4711,8 @@ function paragraphsShareOpening(first, second) {
4461
4711
  if (!opening || opening.length < 20) return false;
4462
4712
  return second.trim().startsWith(opening);
4463
4713
  }
4464
- function collapseRepeatedText(text) {
4465
- const trimmed = text.trim();
4714
+ function collapseRepeatedText(text2) {
4715
+ const trimmed = text2.trim();
4466
4716
  if (trimmed.length < 40) return trimmed;
4467
4717
  const paragraphs = trimmed.split(/\n{2,}/u).map((part) => part.trim()).filter(Boolean);
4468
4718
  if (paragraphs.length === 2 && (paragraphsAreNearDuplicates(paragraphs[0], paragraphs[1]) || paragraphsShareOpening(paragraphs[0], paragraphs[1]))) {
@@ -4500,11 +4750,11 @@ function MessageBubble({
4500
4750
  offers.length > 0 ? sanitizeBookingOfferCopy(visibleText) : looksLikeBookingAvailabilityDump(visibleText) ? sanitizeBookingOfferCopy(visibleText) : visibleText || (isStreaming ? "" : message.text)
4501
4751
  );
4502
4752
  if (message.role === "visitor") {
4503
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("article", { className: "message-bubble message-bubble--visitor", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "message-bubble__text", children: message.text }) });
4753
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("article", { className: "message-bubble message-bubble--visitor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "message-bubble__text", children: message.text }) });
4504
4754
  }
4505
4755
  const citations = message.citations ?? [];
4506
- const agentText = /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "message-bubble__text", children: [
4507
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4756
+ const agentText = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__text", children: [
4757
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4508
4758
  import_streamdown.Streamdown,
4509
4759
  {
4510
4760
  animated: isStreaming,
@@ -4518,8 +4768,9 @@ function MessageBubble({
4518
4768
  children: displayText
4519
4769
  }
4520
4770
  ),
4521
- citations.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("ul", { className: "message-bubble__sources", "aria-label": "Sources", children: citations.map((citation) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("a", { href: citation.url, target: "_blank", rel: "noreferrer", children: [
4522
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4771
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SearchReferences, { results: message.searchResults ?? [] }),
4772
+ 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: [
4773
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4523
4774
  "span",
4524
4775
  {
4525
4776
  className: "message-bubble__source-icon",
@@ -4527,12 +4778,12 @@ function MessageBubble({
4527
4778
  children: "\u25A6"
4528
4779
  }
4529
4780
  ),
4530
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { children: citation.label })
4781
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: citation.label })
4531
4782
  ] }) }, citation.id)) }) : null
4532
4783
  ] });
4533
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("article", { className: "message-bubble message-bubble--agent", children: [
4534
- displayText ? showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "message-bubble__agent-row", children: [
4535
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4784
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("article", { className: "message-bubble message-bubble--agent", children: [
4785
+ displayText || message.searchResults?.length ? showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "message-bubble__agent-row", children: [
4786
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4536
4787
  "img",
4537
4788
  {
4538
4789
  src: resolvedLogoUrl,
@@ -4544,7 +4795,7 @@ function MessageBubble({
4544
4795
  ) }),
4545
4796
  agentText
4546
4797
  ] }) : agentText : null,
4547
- offers.map((nextOffer, index) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
4798
+ offers.map((nextOffer, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4548
4799
  BookingCard,
4549
4800
  {
4550
4801
  disabled: bookingDisabled,
@@ -4561,8 +4812,8 @@ var import_react11 = require("react");
4561
4812
  var import_react_dom2 = require("react-dom");
4562
4813
 
4563
4814
  // src/react/lib/speech.ts
4564
- function toSpeechText(text) {
4565
- let out = hideToolCardFences(text);
4815
+ function toSpeechText(text2) {
4816
+ let out = hideToolCardFences(text2);
4566
4817
  out = out.replace(/```[\s\S]*?```/g, " ");
4567
4818
  out = out.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
4568
4819
  out = out.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1");
@@ -4705,10 +4956,10 @@ function subscribeSpeechInterrupts(onInterrupt) {
4705
4956
  }
4706
4957
 
4707
4958
  // src/react/components/MessageActions/MessageActions.tsx
4708
- var import_jsx_runtime7 = require("react/jsx-runtime");
4959
+ var import_jsx_runtime8 = require("react/jsx-runtime");
4709
4960
  function CopyIcon() {
4710
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
4711
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4961
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
4962
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4712
4963
  "rect",
4713
4964
  {
4714
4965
  x: "5.75",
@@ -4720,7 +4971,7 @@ function CopyIcon() {
4720
4971
  strokeWidth: "1.5"
4721
4972
  }
4722
4973
  ),
4723
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4974
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4724
4975
  "path",
4725
4976
  {
4726
4977
  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",
@@ -4731,7 +4982,7 @@ function CopyIcon() {
4731
4982
  ] });
4732
4983
  }
4733
4984
  function CheckIcon() {
4734
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4985
+ 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)(
4735
4986
  "path",
4736
4987
  {
4737
4988
  d: "M3.5 8.5l3 3 6-7",
@@ -4743,8 +4994,8 @@ function CheckIcon() {
4743
4994
  ) });
4744
4995
  }
4745
4996
  function ThumbUpIcon() {
4746
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
4747
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4997
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
4998
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4748
4999
  "path",
4749
5000
  {
4750
5001
  d: "M4.67 6.67v8",
@@ -4753,7 +5004,7 @@ function ThumbUpIcon() {
4753
5004
  strokeLinecap: "round"
4754
5005
  }
4755
5006
  ),
4756
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5007
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4757
5008
  "path",
4758
5009
  {
4759
5010
  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",
@@ -4766,8 +5017,8 @@ function ThumbUpIcon() {
4766
5017
  ] });
4767
5018
  }
4768
5019
  function ThumbDownIcon() {
4769
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("g", { transform: "rotate(180 8 8)", children: [
4770
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5020
+ 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: [
5021
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4771
5022
  "path",
4772
5023
  {
4773
5024
  d: "M4.67 6.67v8",
@@ -4776,7 +5027,7 @@ function ThumbDownIcon() {
4776
5027
  strokeLinecap: "round"
4777
5028
  }
4778
5029
  ),
4779
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5030
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4780
5031
  "path",
4781
5032
  {
4782
5033
  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",
@@ -4789,8 +5040,8 @@ function ThumbDownIcon() {
4789
5040
  ] }) });
4790
5041
  }
4791
5042
  function RegenerateIcon() {
4792
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
4793
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5043
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5044
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4794
5045
  "path",
4795
5046
  {
4796
5047
  d: "M2 8a6 6 0 0 1 6-6 6.5 6.5 0 0 1 4.5 1.83L14 5.33",
@@ -4799,7 +5050,7 @@ function RegenerateIcon() {
4799
5050
  strokeLinecap: "round"
4800
5051
  }
4801
5052
  ),
4802
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5053
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4803
5054
  "path",
4804
5055
  {
4805
5056
  d: "M14 2v3.33h-3.33",
@@ -4809,7 +5060,7 @@ function RegenerateIcon() {
4809
5060
  strokeLinejoin: "round"
4810
5061
  }
4811
5062
  ),
4812
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5063
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4813
5064
  "path",
4814
5065
  {
4815
5066
  d: "M14 8a6 6 0 0 1-6 6 6.5 6.5 0 0 1-4.5-1.83L2 10.67",
@@ -4818,7 +5069,7 @@ function RegenerateIcon() {
4818
5069
  strokeLinecap: "round"
4819
5070
  }
4820
5071
  ),
4821
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5072
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4822
5073
  "path",
4823
5074
  {
4824
5075
  d: "M5.33 10.67H2V14",
@@ -4831,15 +5082,15 @@ function RegenerateIcon() {
4831
5082
  ] });
4832
5083
  }
4833
5084
  function MoreIcon() {
4834
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
4835
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "3.5", cy: "8", r: "1.15", fill: "currentColor" }),
4836
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "8", cy: "8", r: "1.15", fill: "currentColor" }),
4837
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("circle", { cx: "12.5", cy: "8", r: "1.15", fill: "currentColor" })
5085
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5086
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "3.5", cy: "8", r: "1.15", fill: "currentColor" }),
5087
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "8", cy: "8", r: "1.15", fill: "currentColor" }),
5088
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("circle", { cx: "12.5", cy: "8", r: "1.15", fill: "currentColor" })
4838
5089
  ] });
4839
5090
  }
4840
5091
  function SourcesIcon() {
4841
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
4842
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5092
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5093
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4843
5094
  "path",
4844
5095
  {
4845
5096
  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",
@@ -4849,7 +5100,7 @@ function SourcesIcon() {
4849
5100
  strokeLinejoin: "round"
4850
5101
  }
4851
5102
  ),
4852
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5103
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4853
5104
  "path",
4854
5105
  {
4855
5106
  d: "M8 4.5v9",
@@ -4861,8 +5112,8 @@ function SourcesIcon() {
4861
5112
  ] });
4862
5113
  }
4863
5114
  function ReadAloudIcon() {
4864
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
4865
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5115
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: [
5116
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4866
5117
  "path",
4867
5118
  {
4868
5119
  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",
@@ -4872,7 +5123,7 @@ function ReadAloudIcon() {
4872
5123
  strokeLinejoin: "round"
4873
5124
  }
4874
5125
  ),
4875
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5126
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4876
5127
  "path",
4877
5128
  {
4878
5129
  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",
@@ -4884,7 +5135,7 @@ function ReadAloudIcon() {
4884
5135
  ] });
4885
5136
  }
4886
5137
  function StopIcon() {
4887
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5138
+ 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)(
4888
5139
  "rect",
4889
5140
  {
4890
5141
  x: "4",
@@ -4897,12 +5148,12 @@ function StopIcon() {
4897
5148
  }
4898
5149
  ) });
4899
5150
  }
4900
- async function writeToClipboard(text) {
5151
+ async function writeToClipboard(text2) {
4901
5152
  try {
4902
- await navigator.clipboard.writeText(text);
5153
+ await navigator.clipboard.writeText(text2);
4903
5154
  } catch {
4904
5155
  const textarea = document.createElement("textarea");
4905
- textarea.value = text;
5156
+ textarea.value = text2;
4906
5157
  textarea.style.position = "fixed";
4907
5158
  textarea.style.opacity = "0";
4908
5159
  document.body.appendChild(textarea);
@@ -5048,7 +5299,7 @@ function MessageActions({
5048
5299
  window.speechSynthesis.speak(utterance);
5049
5300
  setSpeaking(true);
5050
5301
  }
5051
- const menu = menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5302
+ const menu = menuOpen ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
5052
5303
  "div",
5053
5304
  {
5054
5305
  className: "agent-message-actions__menu agent-message-actions__menu--portal",
@@ -5059,11 +5310,11 @@ function MessageActions({
5059
5310
  top: `${menuPosition.top}px`
5060
5311
  } : { visibility: "hidden" },
5061
5312
  children: [
5062
- answeredLabel ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("p", { className: "agent-message-actions__menu-meta", children: [
5313
+ answeredLabel ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("p", { className: "agent-message-actions__menu-meta", children: [
5063
5314
  "Answered ",
5064
5315
  answeredLabel
5065
5316
  ] }) : null,
5066
- canOpenReceipt ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5317
+ canOpenReceipt ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
5067
5318
  "button",
5068
5319
  {
5069
5320
  type: "button",
@@ -5074,12 +5325,12 @@ function MessageActions({
5074
5325
  onOpenReceipt?.();
5075
5326
  },
5076
5327
  children: [
5077
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(SourcesIcon, {}),
5328
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(SourcesIcon, {}),
5078
5329
  "View sources"
5079
5330
  ]
5080
5331
  }
5081
5332
  ) : null,
5082
- canReadAloud ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
5333
+ canReadAloud ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
5083
5334
  "button",
5084
5335
  {
5085
5336
  type: "button",
@@ -5087,7 +5338,7 @@ function MessageActions({
5087
5338
  role: "menuitem",
5088
5339
  onClick: handleReadAloud,
5089
5340
  children: [
5090
- speaking ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ReadAloudIcon, {}),
5341
+ speaking ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(StopIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ReadAloudIcon, {}),
5091
5342
  speaking ? "Stop reading" : "Read aloud"
5092
5343
  ]
5093
5344
  }
@@ -5095,8 +5346,8 @@ function MessageActions({
5095
5346
  ]
5096
5347
  }
5097
5348
  ) : null;
5098
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "agent-message-actions", "aria-label": "Answer actions", children: [
5099
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5349
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "agent-message-actions", "aria-label": "Answer actions", children: [
5350
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5100
5351
  "button",
5101
5352
  {
5102
5353
  type: "button",
@@ -5105,10 +5356,10 @@ function MessageActions({
5105
5356
  title: copied ? "Copied" : "Copy answer",
5106
5357
  disabled,
5107
5358
  onClick: handleCopy,
5108
- children: copied ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopyIcon, {})
5359
+ children: copied ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CheckIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(CopyIcon, {})
5109
5360
  }
5110
5361
  ),
5111
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5362
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5112
5363
  "button",
5113
5364
  {
5114
5365
  type: "button",
@@ -5118,10 +5369,10 @@ function MessageActions({
5118
5369
  title: "Good answer",
5119
5370
  disabled,
5120
5371
  onClick: () => handleFeedback("positive"),
5121
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ThumbUpIcon, {})
5372
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ThumbUpIcon, {})
5122
5373
  }
5123
5374
  ),
5124
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5375
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5125
5376
  "button",
5126
5377
  {
5127
5378
  type: "button",
@@ -5131,10 +5382,10 @@ function MessageActions({
5131
5382
  title: "Bad answer",
5132
5383
  disabled,
5133
5384
  onClick: () => handleFeedback("negative"),
5134
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ThumbDownIcon, {})
5385
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ThumbDownIcon, {})
5135
5386
  }
5136
5387
  ),
5137
- onRegenerate ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5388
+ onRegenerate ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5138
5389
  "button",
5139
5390
  {
5140
5391
  type: "button",
@@ -5143,11 +5394,11 @@ function MessageActions({
5143
5394
  title: "Regenerate answer",
5144
5395
  disabled,
5145
5396
  onClick: onRegenerate,
5146
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(RegenerateIcon, {})
5397
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(RegenerateIcon, {})
5147
5398
  }
5148
5399
  ) : null,
5149
- showMenu ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "agent-message-actions__more", ref: menuRef, children: [
5150
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5400
+ showMenu ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "agent-message-actions__more", ref: menuRef, children: [
5401
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5151
5402
  "button",
5152
5403
  {
5153
5404
  ref: moreButtonRef,
@@ -5159,7 +5410,7 @@ function MessageActions({
5159
5410
  title: "More actions",
5160
5411
  disabled,
5161
5412
  onClick: () => setMenuOpen((open) => !open),
5162
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(MoreIcon, {})
5413
+ children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MoreIcon, {})
5163
5414
  }
5164
5415
  ),
5165
5416
  menuPortalRoot?.current && menu ? (0, import_react_dom2.createPortal)(menu, menuPortalRoot.current) : menu
@@ -5171,7 +5422,7 @@ function MessageActions({
5171
5422
  var import_react13 = require("react");
5172
5423
 
5173
5424
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
5174
- var import_jsx_runtime8 = require("react/jsx-runtime");
5425
+ var import_jsx_runtime9 = require("react/jsx-runtime");
5175
5426
  function ConfirmationCard({
5176
5427
  disabled = false,
5177
5428
  request,
@@ -5180,17 +5431,17 @@ function ConfirmationCard({
5180
5431
  const options = request.options ?? [];
5181
5432
  const heading = request.kind === "tool-approval" ? "Confirm this action" : request.prompt;
5182
5433
  const prompt = request.kind === "tool-approval" ? request.prompt : void 0;
5183
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
5434
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
5184
5435
  "section",
5185
5436
  {
5186
5437
  className: "confirmation-card",
5187
5438
  "aria-labelledby": `confirmation-${request.requestId}`,
5188
5439
  children: [
5189
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "confirmation-card__heading", children: [
5190
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { id: `confirmation-${request.requestId}`, children: heading }),
5191
- prompt ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: prompt }) : null
5440
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "confirmation-card__heading", children: [
5441
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { id: `confirmation-${request.requestId}`, children: heading }),
5442
+ prompt ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: prompt }) : null
5192
5443
  ] }),
5193
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5444
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5194
5445
  "button",
5195
5446
  {
5196
5447
  type: "button",
@@ -5211,7 +5462,7 @@ function ConfirmationCard({
5211
5462
 
5212
5463
  // src/react/components/ToolInputCard/ToolInputCard.tsx
5213
5464
  var import_react12 = require("react");
5214
- var import_jsx_runtime9 = require("react/jsx-runtime");
5465
+ var import_jsx_runtime10 = require("react/jsx-runtime");
5215
5466
  function isRecord5(value) {
5216
5467
  return value !== null && typeof value === "object" && !Array.isArray(value);
5217
5468
  }
@@ -5335,7 +5586,7 @@ function FieldDescription({
5335
5586
  field,
5336
5587
  id
5337
5588
  }) {
5338
- return field.description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { id, className: "tool-input-card__description", children: field.description }) : null;
5589
+ return field.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id, className: "tool-input-card__description", children: field.description }) : null;
5339
5590
  }
5340
5591
  function ChoiceField({
5341
5592
  field,
@@ -5354,7 +5605,7 @@ function ChoiceField({
5354
5605
  const selectedIndex = options.findIndex(
5355
5606
  (option) => valuesMatch(option.value, value)
5356
5607
  );
5357
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
5608
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
5358
5609
  "select",
5359
5610
  {
5360
5611
  id,
@@ -5369,13 +5620,13 @@ function ChoiceField({
5369
5620
  if (option) onChange(option.value);
5370
5621
  },
5371
5622
  children: [
5372
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: "", disabled: field.required, children: "Choose an option" }),
5373
- options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("option", { value: index, children: option.label }, optionKey(option)))
5623
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: "", disabled: field.required, children: "Choose an option" }),
5624
+ options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("option", { value: index, children: option.label }, optionKey(option)))
5374
5625
  ]
5375
5626
  }
5376
5627
  );
5377
5628
  }
5378
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5629
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5379
5630
  "div",
5380
5631
  {
5381
5632
  className: "tool-input-card__choices",
@@ -5386,8 +5637,8 @@ function ChoiceField({
5386
5637
  "aria-required": field.required,
5387
5638
  children: options.map((option, index) => {
5388
5639
  const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
5389
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "tool-input-card__choice", children: [
5390
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5640
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "tool-input-card__choice", children: [
5641
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5391
5642
  "input",
5392
5643
  {
5393
5644
  type: multiple ? "checkbox" : "radio",
@@ -5409,7 +5660,7 @@ function ChoiceField({
5409
5660
  }
5410
5661
  }
5411
5662
  ),
5412
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { children: option.label })
5663
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { children: option.label })
5413
5664
  ] }, optionKey(option));
5414
5665
  })
5415
5666
  }
@@ -5429,9 +5680,9 @@ function ToolField({
5429
5680
  error ? `${id}-error` : ""
5430
5681
  ].filter(Boolean).join(" ");
5431
5682
  if (field.kind === "checkbox" || field.kind === "confirmation") {
5432
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tool-input-card__field", children: [
5433
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { className: "tool-input-card__check", htmlFor: id, children: [
5434
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5683
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__field", children: [
5684
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { className: "tool-input-card__check", htmlFor: id, children: [
5685
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5435
5686
  "input",
5436
5687
  {
5437
5688
  id,
@@ -5444,17 +5695,17 @@ function ToolField({
5444
5695
  onChange: (event) => onChange(event.target.checked)
5445
5696
  }
5446
5697
  ),
5447
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("span", { children: [
5448
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: field.label }),
5449
- field.description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { id: `${id}-description`, children: field.description }) : null
5698
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { children: [
5699
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: field.label }),
5700
+ field.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-description`, children: field.description }) : null
5450
5701
  ] })
5451
5702
  ] }),
5452
- error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
5703
+ error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
5453
5704
  ] });
5454
5705
  }
5455
- const label = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("label", { id: `${id}-label`, htmlFor: id, children: [
5706
+ const label = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("label", { id: `${id}-label`, htmlFor: id, children: [
5456
5707
  field.label,
5457
- field.required ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-hidden": "true", children: " *" }) : null
5708
+ field.required ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: " *" }) : null
5458
5709
  ] });
5459
5710
  const common = {
5460
5711
  id,
@@ -5466,7 +5717,7 @@ function ToolField({
5466
5717
  };
5467
5718
  let control;
5468
5719
  if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
5469
- control = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5720
+ control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5470
5721
  ChoiceField,
5471
5722
  {
5472
5723
  field,
@@ -5480,7 +5731,7 @@ function ToolField({
5480
5731
  }
5481
5732
  );
5482
5733
  } else if (field.kind === "textarea" || field.kind === "json") {
5483
- control = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5734
+ control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5484
5735
  "textarea",
5485
5736
  {
5486
5737
  ...common,
@@ -5494,8 +5745,8 @@ function ToolField({
5494
5745
  );
5495
5746
  } else if (field.kind === "range") {
5496
5747
  const numericValue = typeof value === "number" ? value : field.min ?? 0;
5497
- control = /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tool-input-card__range", children: [
5498
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5748
+ control = /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__range", children: [
5749
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5499
5750
  "input",
5500
5751
  {
5501
5752
  ...common,
@@ -5507,11 +5758,11 @@ function ToolField({
5507
5758
  onChange: (event) => onChange(Number(event.target.value))
5508
5759
  }
5509
5760
  ),
5510
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("output", { htmlFor: id, children: numericValue })
5761
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("output", { htmlFor: id, children: numericValue })
5511
5762
  ] });
5512
5763
  } else {
5513
5764
  const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
5514
- control = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5765
+ control = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5515
5766
  "input",
5516
5767
  {
5517
5768
  ...common,
@@ -5529,11 +5780,11 @@ function ToolField({
5529
5780
  }
5530
5781
  );
5531
5782
  }
5532
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tool-input-card__field", children: [
5783
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__field", children: [
5533
5784
  label,
5534
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(FieldDescription, { field, id: `${id}-description` }),
5785
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(FieldDescription, { field, id: `${id}-description` }),
5535
5786
  control,
5536
- error ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
5787
+ error ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
5537
5788
  ] });
5538
5789
  }
5539
5790
  function ToolInputCard({
@@ -5570,14 +5821,14 @@ function ToolInputCard({
5570
5821
  onSubmit?.(surface, result);
5571
5822
  }
5572
5823
  if (submitted) {
5573
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
5824
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
5574
5825
  "section",
5575
5826
  {
5576
5827
  className: "tool-input-card tool-input-card--submitted",
5577
5828
  role: "status",
5578
5829
  children: [
5579
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { "aria-hidden": "true", children: "\u2713" }),
5580
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("strong", { children: [
5830
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { "aria-hidden": "true", children: "\u2713" }),
5831
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("strong", { children: [
5581
5832
  surface.title,
5582
5833
  " submitted"
5583
5834
  ] })
@@ -5585,18 +5836,18 @@ function ToolInputCard({
5585
5836
  }
5586
5837
  );
5587
5838
  }
5588
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
5839
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
5589
5840
  "section",
5590
5841
  {
5591
5842
  className: "tool-input-card",
5592
5843
  "aria-labelledby": `tool-input-${surface.id}`,
5593
5844
  children: [
5594
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tool-input-card__heading", children: [
5595
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
5596
- surface.description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: surface.description }) : null
5845
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__heading", children: [
5846
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
5847
+ surface.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: surface.description }) : null
5597
5848
  ] }),
5598
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("form", { noValidate: true, onSubmit: submit, children: [
5599
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5849
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { noValidate: true, onSubmit: submit, children: [
5850
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5600
5851
  ToolField,
5601
5852
  {
5602
5853
  disabled,
@@ -5609,8 +5860,8 @@ function ToolInputCard({
5609
5860
  },
5610
5861
  field.path
5611
5862
  )) }),
5612
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tool-input-card__actions", children: [
5613
- surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
5863
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-input-card__actions", children: [
5864
+ surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5614
5865
  "button",
5615
5866
  {
5616
5867
  type: "button",
@@ -5623,7 +5874,7 @@ function ToolInputCard({
5623
5874
  children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
5624
5875
  }
5625
5876
  ) : null,
5626
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
5877
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
5627
5878
  ] })
5628
5879
  ] })
5629
5880
  ]
@@ -5632,17 +5883,17 @@ function ToolInputCard({
5632
5883
  }
5633
5884
 
5634
5885
  // src/react/components/HumanInputCard/HumanInputCard.tsx
5635
- var import_jsx_runtime10 = require("react/jsx-runtime");
5886
+ var import_jsx_runtime11 = require("react/jsx-runtime");
5636
5887
  function HumanInputCard({
5637
5888
  disabled = false,
5638
5889
  request,
5639
5890
  onRespond
5640
5891
  }) {
5641
- const [text, setText] = (0, import_react13.useState)("");
5892
+ const [text2, setText] = (0, import_react13.useState)("");
5642
5893
  const options = request.options ?? [];
5643
5894
  const showText = request.display === "text" || request.allowFreeform && options.length === 0;
5644
5895
  if (request.ui) {
5645
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5896
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
5646
5897
  ToolInputCard,
5647
5898
  {
5648
5899
  disabled,
@@ -5652,7 +5903,7 @@ function HumanInputCard({
5652
5903
  );
5653
5904
  }
5654
5905
  if (options.length > 0) {
5655
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5906
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
5656
5907
  ConfirmationCard,
5657
5908
  {
5658
5909
  disabled,
@@ -5663,62 +5914,62 @@ function HumanInputCard({
5663
5914
  }
5664
5915
  function submitText(event) {
5665
5916
  event.preventDefault();
5666
- const value = text.trim();
5917
+ const value = text2.trim();
5667
5918
  if (!value || disabled) return;
5668
5919
  onRespond?.({ requestId: request.requestId, text: value });
5669
5920
  }
5670
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
5921
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
5671
5922
  "section",
5672
5923
  {
5673
5924
  className: "human-input-card",
5674
5925
  "aria-labelledby": `human-input-${request.requestId}`,
5675
5926
  children: [
5676
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "human-input-card__heading", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
5677
- showText ? /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("form", { onSubmit: submitText, children: [
5678
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
5679
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
5680
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5927
+ /* @__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 }) }),
5928
+ showText ? /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("form", { onSubmit: submitText, children: [
5929
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
5930
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
5931
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
5681
5932
  "input",
5682
5933
  {
5683
5934
  id: `human-input-text-${request.requestId}`,
5684
- value: text,
5935
+ value: text2,
5685
5936
  disabled,
5686
5937
  onChange: (event) => setText(event.target.value)
5687
5938
  }
5688
5939
  ),
5689
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("button", { type: "submit", disabled: disabled || !text.trim(), children: "Send" })
5940
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { type: "submit", disabled: disabled || !text2.trim(), children: "Send" })
5690
5941
  ] })
5691
5942
  ] }) : null,
5692
- !showText && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
5943
+ !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
5693
5944
  ]
5694
5945
  }
5695
5946
  );
5696
5947
  }
5697
5948
 
5698
5949
  // src/react/components/CollectionResultCard/CollectionResultCard.tsx
5699
- var import_jsx_runtime11 = require("react/jsx-runtime");
5950
+ var import_jsx_runtime12 = require("react/jsx-runtime");
5700
5951
  function CollectionResultCard({
5701
5952
  result
5702
5953
  }) {
5703
5954
  const empty = result.items.length === 0;
5704
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
5955
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5705
5956
  "section",
5706
5957
  {
5707
5958
  className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
5708
5959
  "aria-label": result.title,
5709
5960
  children: [
5710
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-result-card__heading", children: [
5711
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5712
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: result.title })
5961
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tool-result-card__heading", children: [
5962
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5963
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: result.title })
5713
5964
  ] }),
5714
- empty ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("li", { children: [
5715
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
5716
- item.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: item.description }) : null,
5717
- item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
5718
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { children: detail.label }),
5719
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { children: detail.value })
5965
+ empty ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("li", { children: [
5966
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
5967
+ item.description ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: item.description }) : null,
5968
+ item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
5969
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: detail.label }),
5970
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: detail.value })
5720
5971
  ] }, `${detail.label}:${detail.value}`)) }) : null,
5721
- item.href ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
5972
+ item.href ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
5722
5973
  ] }, item.title)) })
5723
5974
  ]
5724
5975
  }
@@ -5726,26 +5977,26 @@ function CollectionResultCard({
5726
5977
  }
5727
5978
 
5728
5979
  // src/react/components/EntityResultCard/EntityResultCard.tsx
5729
- var import_jsx_runtime12 = require("react/jsx-runtime");
5980
+ var import_jsx_runtime13 = require("react/jsx-runtime");
5730
5981
  function EntityResultCard({
5731
5982
  result
5732
5983
  }) {
5733
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
5984
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
5734
5985
  "section",
5735
5986
  {
5736
5987
  className: `entity-result-card tool-result-card tool-result-card--${result.status}`,
5737
5988
  "aria-label": result.title,
5738
5989
  children: [
5739
- /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tool-result-card__heading", children: [
5740
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5741
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: result.title })
5990
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "tool-result-card__heading", children: [
5991
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5992
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: result.title })
5742
5993
  ] }),
5743
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: result.description }) : null,
5744
- result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
5745
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: detail.label }),
5746
- /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: detail.value })
5994
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: result.description }) : null,
5995
+ result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
5996
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dt", { children: detail.label }),
5997
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("dd", { children: detail.value })
5747
5998
  ] }, `${detail.label}:${detail.value}`)) }) : null,
5748
- result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
5999
+ result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5749
6000
  "a",
5750
6001
  {
5751
6002
  href: link.href,
@@ -5761,24 +6012,24 @@ function EntityResultCard({
5761
6012
  }
5762
6013
 
5763
6014
  // src/react/components/SignatureResultCard/SignatureResultCard.tsx
5764
- var import_jsx_runtime13 = require("react/jsx-runtime");
6015
+ var import_jsx_runtime14 = require("react/jsx-runtime");
5765
6016
  function SignatureResultCard({
5766
6017
  result
5767
6018
  }) {
5768
6019
  const primaryLink = result.links?.[0];
5769
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
6020
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5770
6021
  "section",
5771
6022
  {
5772
6023
  className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
5773
6024
  "aria-label": result.title,
5774
6025
  children: [
5775
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "tool-result-card__heading", children: [
5776
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5777
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: result.title })
6026
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "tool-result-card__heading", children: [
6027
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6028
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: result.title })
5778
6029
  ] }),
5779
- result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
5780
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: result.description }) : null,
5781
- primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
6030
+ result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
6031
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: result.description }) : null,
6032
+ primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5782
6033
  "a",
5783
6034
  {
5784
6035
  className: "signature-result-card__cta",
@@ -5794,26 +6045,26 @@ function SignatureResultCard({
5794
6045
  }
5795
6046
 
5796
6047
  // src/react/components/ToolResultCard/ToolResultCard.tsx
5797
- var import_jsx_runtime14 = require("react/jsx-runtime");
6048
+ var import_jsx_runtime15 = require("react/jsx-runtime");
5798
6049
  function ToolResultCard({
5799
6050
  result
5800
6051
  }) {
5801
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
6052
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
5802
6053
  "section",
5803
6054
  {
5804
6055
  className: `tool-result-card tool-result-card--${result.status}`,
5805
6056
  "aria-label": result.title,
5806
6057
  children: [
5807
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "tool-result-card__heading", children: [
5808
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5809
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: result.title })
6058
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "tool-result-card__heading", children: [
6059
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6060
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("strong", { children: result.title })
5810
6061
  ] }),
5811
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: result.description }) : null,
5812
- result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
5813
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dt", { children: detail.label }),
5814
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("dd", { children: detail.value })
6062
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("p", { children: result.description }) : null,
6063
+ result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { children: [
6064
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dt", { children: detail.label }),
6065
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("dd", { children: detail.value })
5815
6066
  ] }, `${detail.label}:${detail.value}`)) }) : null,
5816
- 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)(
6067
+ 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)(
5817
6068
  "a",
5818
6069
  {
5819
6070
  href: link.href,
@@ -5829,14 +6080,14 @@ function ToolResultCard({
5829
6080
  }
5830
6081
 
5831
6082
  // src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
5832
- var import_jsx_runtime15 = require("react/jsx-runtime");
6083
+ var import_jsx_runtime16 = require("react/jsx-runtime");
5833
6084
  function VisitorToolResultView({
5834
6085
  disabled = false,
5835
6086
  onToolInput,
5836
6087
  result
5837
6088
  }) {
5838
6089
  if (result.kind === "input") {
5839
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6090
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5840
6091
  ToolInputCard,
5841
6092
  {
5842
6093
  disabled,
@@ -5846,16 +6097,16 @@ function VisitorToolResultView({
5846
6097
  );
5847
6098
  }
5848
6099
  if (result.kind === "entity") {
5849
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(EntityResultCard, { result });
6100
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EntityResultCard, { result });
5850
6101
  }
5851
6102
  if (result.kind === "collection") {
5852
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CollectionResultCard, { result });
6103
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CollectionResultCard, { result });
5853
6104
  }
5854
6105
  if (result.kind === "signature") {
5855
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SignatureResultCard, { result });
6106
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SignatureResultCard, { result });
5856
6107
  }
5857
6108
  if (result.kind === "summary") {
5858
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ToolResultCard, { result });
6109
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ToolResultCard, { result });
5859
6110
  }
5860
6111
  return null;
5861
6112
  }
@@ -5864,9 +6115,9 @@ function isRenderableVisitorToolResult(result) {
5864
6115
  }
5865
6116
 
5866
6117
  // src/react/components/AgentRail/AgentRail.tsx
5867
- var import_jsx_runtime16 = require("react/jsx-runtime");
6118
+ var import_jsx_runtime17 = require("react/jsx-runtime");
5868
6119
  function MinimizeIcon() {
5869
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6120
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5870
6121
  "path",
5871
6122
  {
5872
6123
  d: "M3.5 8h9",
@@ -5877,7 +6128,7 @@ function MinimizeIcon() {
5877
6128
  ) });
5878
6129
  }
5879
6130
  function CloseIcon2() {
5880
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6131
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5881
6132
  "path",
5882
6133
  {
5883
6134
  d: "M4 4l8 8M12 4l-8 8",
@@ -5888,7 +6139,7 @@ function CloseIcon2() {
5888
6139
  ) });
5889
6140
  }
5890
6141
  function NewChatIcon() {
5891
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6142
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5892
6143
  "path",
5893
6144
  {
5894
6145
  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",
@@ -5900,7 +6151,7 @@ function NewChatIcon() {
5900
6151
  ) });
5901
6152
  }
5902
6153
  function ExpandIcon() {
5903
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6154
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5904
6155
  "path",
5905
6156
  {
5906
6157
  d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
@@ -5912,7 +6163,7 @@ function ExpandIcon() {
5912
6163
  ) });
5913
6164
  }
5914
6165
  function RestoreIcon() {
5915
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6166
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5916
6167
  "path",
5917
6168
  {
5918
6169
  d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
@@ -5924,7 +6175,7 @@ function RestoreIcon() {
5924
6175
  ) });
5925
6176
  }
5926
6177
  function ChevronDownIcon() {
5927
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6178
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
5928
6179
  "path",
5929
6180
  {
5930
6181
  d: "M4 6.5l4 4 4-4",
@@ -5977,44 +6228,7 @@ function AgentRail({
5977
6228
  const [failedLogoUrl, setFailedLogoUrl] = (0, import_react14.useState)(null);
5978
6229
  const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
5979
6230
  const resolvedColorScheme = useAgentColorScheme(colorScheme);
5980
- const brandedTheme = { ...defaultAgentRailTheme, ...theme };
5981
- const resolvedTheme = resolvedColorScheme === "dark" ? {
5982
- ...brandedTheme,
5983
- brand: theme?.brand ?? defaultDarkAgentRailTheme.brand,
5984
- brandDeep: theme?.brandDeep ?? defaultDarkAgentRailTheme.brandDeep,
5985
- brandSoft: theme?.brandSoft ?? `color-mix(in srgb, ${theme?.brand ?? defaultDarkAgentRailTheme.brand} 18%, ${defaultDarkAgentRailTheme.surface})`,
5986
- border: theme?.border ?? defaultDarkAgentRailTheme.border,
5987
- danger: theme?.danger ?? defaultDarkAgentRailTheme.danger,
5988
- onBrand: theme?.onBrand ?? defaultDarkAgentRailTheme.onBrand,
5989
- success: theme?.success ?? defaultDarkAgentRailTheme.success,
5990
- surface: theme?.surface ?? defaultDarkAgentRailTheme.surface,
5991
- surfaceMuted: theme?.surfaceMuted ?? defaultDarkAgentRailTheme.surfaceMuted,
5992
- text: theme?.text ?? defaultDarkAgentRailTheme.text,
5993
- textMuted: theme?.textMuted ?? defaultDarkAgentRailTheme.textMuted,
5994
- textSubtle: theme?.textSubtle ?? defaultDarkAgentRailTheme.textSubtle,
5995
- visitorBubble: theme?.visitorBubble ?? theme?.brand ?? defaultDarkAgentRailTheme.visitorBubble
5996
- } : brandedTheme;
5997
- const railStyle = {
5998
- "--rail-width": resolvedTheme.railMaxWidth,
5999
- "--as-rail-max-width": resolvedTheme.railMaxWidth,
6000
- "--as-brand": resolvedTheme.brand,
6001
- "--as-brand-soft": resolvedTheme.brandSoft,
6002
- "--as-brand-deep": resolvedTheme.brandDeep,
6003
- "--as-surface": resolvedTheme.surface,
6004
- "--as-surface-muted": resolvedTheme.surfaceMuted,
6005
- "--as-text": resolvedTheme.text,
6006
- "--as-text-muted": resolvedTheme.textMuted,
6007
- "--as-text-subtle": resolvedTheme.textSubtle,
6008
- "--as-border": resolvedTheme.border,
6009
- "--as-visitor-bubble": resolvedTheme.visitorBubble,
6010
- "--as-visitor-text": resolvedTheme.visitorText,
6011
- "--as-on-brand": resolvedTheme.onBrand,
6012
- "--as-success": resolvedTheme.success,
6013
- "--as-danger": resolvedTheme.danger,
6014
- "--as-font-body": resolvedTheme.fontBody,
6015
- "--as-font-display": resolvedTheme.fontDisplay,
6016
- colorScheme: resolvedColorScheme
6017
- };
6231
+ const railStyle = agentThemeStyle(theme, resolvedColorScheme);
6018
6232
  const pendingInputRequests = (state.pendingInputs ?? []).filter(
6019
6233
  (request) => shouldRenderVisitorInputCard(request) && (!state.pendingOffer || request.kind === "tool-approval")
6020
6234
  );
@@ -6061,7 +6275,10 @@ function AgentRail({
6061
6275
  id: "streaming-response",
6062
6276
  role: "agent",
6063
6277
  streaming: true,
6064
- text: state.streamingText
6278
+ text: state.streamingText,
6279
+ searchResults: (state.toolResults ?? []).filter(
6280
+ (result) => result.kind === "search"
6281
+ )
6065
6282
  } : state.pendingOffer && !lastIsAgent ? {
6066
6283
  createdAt: 0,
6067
6284
  id: "pending-booking",
@@ -6183,7 +6400,7 @@ function AgentRail({
6183
6400
  window.setTimeout(settle, 900);
6184
6401
  node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
6185
6402
  }
6186
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6403
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6187
6404
  "aside",
6188
6405
  {
6189
6406
  ref: railRef,
@@ -6197,34 +6414,34 @@ function AgentRail({
6197
6414
  autoFocus: mobileFullscreen || expanded,
6198
6415
  role: mobileFullscreen || expanded ? "dialog" : void 0,
6199
6416
  tabIndex: mobileFullscreen || expanded ? -1 : void 0,
6200
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
6417
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6201
6418
  AgentRailOverlayContext.Provider,
6202
6419
  {
6203
6420
  value: { railRef, overlayRef },
6204
6421
  children: [
6205
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
6206
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("header", { className: "agent-rail__header", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "agent-rail__brand-row", children: [
6207
- onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6422
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
6423
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("header", { className: "agent-rail__header", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__brand-row", children: [
6424
+ onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6208
6425
  "button",
6209
6426
  {
6210
6427
  type: "button",
6211
6428
  className: "agent-rail__collapse",
6212
6429
  "aria-label": "Collapse assist",
6213
6430
  onClick: onCollapse,
6214
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MinimizeIcon, {})
6431
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(MinimizeIcon, {})
6215
6432
  }
6216
- ) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6433
+ ) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6217
6434
  "button",
6218
6435
  {
6219
6436
  type: "button",
6220
6437
  className: "agent-rail__close",
6221
6438
  "aria-label": "Close agent",
6222
6439
  onClick: onClose,
6223
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CloseIcon2, {})
6440
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CloseIcon2, {})
6224
6441
  }
6225
- ) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
6226
- resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "agent-rail__identity", children: [
6227
- showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6442
+ ) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
6443
+ resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "agent-rail__identity", children: [
6444
+ showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6228
6445
  "img",
6229
6446
  {
6230
6447
  className: "agent-rail__brand-logo",
@@ -6235,10 +6452,10 @@ function AgentRail({
6235
6452
  }
6236
6453
  }
6237
6454
  ) }) : null,
6238
- resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
6455
+ resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
6239
6456
  ] }) : null,
6240
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { className: "agent-rail__actions", children: [
6241
- onReset ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6457
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "agent-rail__actions", children: [
6458
+ onReset ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6242
6459
  "button",
6243
6460
  {
6244
6461
  type: "button",
@@ -6246,24 +6463,24 @@ function AgentRail({
6246
6463
  "aria-label": "Start a new conversation",
6247
6464
  disabled: !hasVisitorMessages2,
6248
6465
  onClick: handleReset,
6249
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(NewChatIcon, {})
6466
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(NewChatIcon, {})
6250
6467
  }
6251
6468
  ) : null,
6252
- onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6469
+ onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6253
6470
  "button",
6254
6471
  {
6255
6472
  type: "button",
6256
6473
  className: "agent-rail__expand",
6257
6474
  "aria-label": expanded ? "Exit full screen" : "Open full screen",
6258
6475
  onClick: onExpandToggle,
6259
- children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ExpandIcon, {})
6476
+ children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ExpandIcon, {})
6260
6477
  }
6261
6478
  ) : null
6262
6479
  ] })
6263
6480
  ] }) }),
6264
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "agent-rail__thread", children: [
6265
- !hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
6266
- greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6481
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__thread", children: [
6482
+ !hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
6483
+ greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6267
6484
  MessageBubble,
6268
6485
  {
6269
6486
  message: greeting,
@@ -6272,7 +6489,7 @@ function AgentRail({
6272
6489
  onBook
6273
6490
  }
6274
6491
  ) : null,
6275
- showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6492
+ showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6276
6493
  FollowUpChips,
6277
6494
  {
6278
6495
  suggestions: state.followUps,
@@ -6281,7 +6498,7 @@ function AgentRail({
6281
6498
  onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
6282
6499
  }
6283
6500
  ) }) : null,
6284
- showActivity ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6501
+ showActivity ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6285
6502
  AgentActivityBubble,
6286
6503
  {
6287
6504
  brandLabel: resolvedBrandLabel,
@@ -6290,7 +6507,7 @@ function AgentRail({
6290
6507
  steps: state.toolSteps
6291
6508
  }
6292
6509
  ) : null,
6293
- visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6510
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6294
6511
  VisitorToolResultView,
6295
6512
  {
6296
6513
  result,
@@ -6299,7 +6516,7 @@ function AgentRail({
6299
6516
  },
6300
6517
  result.id
6301
6518
  )),
6302
- pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6519
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6303
6520
  HumanInputCard,
6304
6521
  {
6305
6522
  request,
@@ -6308,8 +6525,8 @@ function AgentRail({
6308
6525
  request.requestId
6309
6526
  ))
6310
6527
  ] }) : null,
6311
- visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "agent-rail__turn-block", children: [
6312
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6528
+ visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__turn-block", children: [
6529
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6313
6530
  MessageBubble,
6314
6531
  {
6315
6532
  message,
@@ -6319,7 +6536,7 @@ function AgentRail({
6319
6536
  onBook
6320
6537
  }
6321
6538
  ),
6322
- index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6539
+ index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6323
6540
  MessageActions,
6324
6541
  {
6325
6542
  answeredAt: message.createdAt,
@@ -6331,8 +6548,8 @@ function AgentRail({
6331
6548
  onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
6332
6549
  }
6333
6550
  ) : null,
6334
- index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
6335
- showActivity ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6551
+ index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
6552
+ showActivity ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6336
6553
  AgentActivityBubble,
6337
6554
  {
6338
6555
  brandLabel: resolvedBrandLabel,
@@ -6341,7 +6558,7 @@ function AgentRail({
6341
6558
  steps: state.toolSteps
6342
6559
  }
6343
6560
  ) : null,
6344
- visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6561
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6345
6562
  VisitorToolResultView,
6346
6563
  {
6347
6564
  result,
@@ -6350,7 +6567,7 @@ function AgentRail({
6350
6567
  },
6351
6568
  result.id
6352
6569
  )),
6353
- pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6570
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6354
6571
  HumanInputCard,
6355
6572
  {
6356
6573
  request,
@@ -6360,7 +6577,7 @@ function AgentRail({
6360
6577
  ))
6361
6578
  ] }) : null
6362
6579
  ] }, message.id)),
6363
- streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6580
+ streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6364
6581
  MessageBubble,
6365
6582
  {
6366
6583
  message: streamingMessage,
@@ -6370,16 +6587,16 @@ function AgentRail({
6370
6587
  onBook
6371
6588
  }
6372
6589
  ) : null,
6373
- waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BookingCardLoader, {}) : null,
6374
- state.error ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
6375
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { children: [
6376
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("strong", { children: "Something went wrong" }),
6377
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: state.error })
6590
+ waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BookingCardLoader, {}) : null,
6591
+ state.error ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
6592
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { children: [
6593
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("strong", { children: "Something went wrong" }),
6594
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: state.error })
6378
6595
  ] }),
6379
- onRetry ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
6596
+ onRetry ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
6380
6597
  ] }) : null
6381
6598
  ] }) }),
6382
- showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6599
+ showDisclaimerLabel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: disclaimerLink ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6383
6600
  "a",
6384
6601
  {
6385
6602
  href: disclaimerLink,
@@ -6388,8 +6605,8 @@ function AgentRail({
6388
6605
  children: resolvedDisclaimerLabel
6389
6606
  }
6390
6607
  ) : resolvedDisclaimerLabel }) }) : null,
6391
- /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
6392
- showJumpToLatest ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6608
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
6609
+ showJumpToLatest ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6393
6610
  "button",
6394
6611
  {
6395
6612
  type: "button",
@@ -6397,10 +6614,10 @@ function AgentRail({
6397
6614
  "aria-label": "Jump to the latest message",
6398
6615
  title: "Jump to the latest message",
6399
6616
  onClick: scrollToLatest,
6400
- children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ChevronDownIcon, {})
6617
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDownIcon, {})
6401
6618
  }
6402
6619
  ) : null,
6403
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6620
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6404
6621
  Composer,
6405
6622
  {
6406
6623
  variant: expanded || mobileFullscreen ? "dock" : "default",
@@ -6412,11 +6629,11 @@ function AgentRail({
6412
6629
  },
6413
6630
  state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
6414
6631
  ),
6415
- poweredByLabel ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { children: poweredByLabel }) }) }) : null
6632
+ poweredByLabel ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: poweredByLabel }) }) }) : null
6416
6633
  ] })
6417
6634
  ] }),
6418
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { ref: overlayRef, className: "agent-rail__overlay" }),
6419
- receiptOpen && receiptSteps ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
6635
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { ref: overlayRef, className: "agent-rail__overlay" }),
6636
+ receiptOpen && receiptSteps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6420
6637
  AnswerReceiptDialog,
6421
6638
  {
6422
6639
  brandLabel: resolvedBrandLabel,
@@ -6432,9 +6649,9 @@ function AgentRail({
6432
6649
  }
6433
6650
 
6434
6651
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
6435
- var import_jsx_runtime17 = require("react/jsx-runtime");
6652
+ var import_jsx_runtime18 = require("react/jsx-runtime");
6436
6653
  function SparklesIcon() {
6437
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6654
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
6438
6655
  "svg",
6439
6656
  {
6440
6657
  className: "assist-edge-tab__sparkles",
@@ -6442,21 +6659,21 @@ function SparklesIcon() {
6442
6659
  fill: "none",
6443
6660
  "aria-hidden": "true",
6444
6661
  children: [
6445
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6662
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6446
6663
  "path",
6447
6664
  {
6448
6665
  d: "M8 1.2l.95 2.7 2.85.05-2.25 1.75.8 2.75L8 6.7 5.65 8.45l.8-2.75L4.2 3.95l2.85-.05L8 1.2z",
6449
6666
  fill: "currentColor"
6450
6667
  }
6451
6668
  ),
6452
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6669
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6453
6670
  "path",
6454
6671
  {
6455
6672
  d: "M14.2 6.4l.55 1.55 1.65.03-1.3 1 .46 1.58-1.36-1-1.36 1 .46-1.58-1.3-1 1.65-.03.55-1.55z",
6456
6673
  fill: "currentColor"
6457
6674
  }
6458
6675
  ),
6459
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6676
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6460
6677
  "path",
6461
6678
  {
6462
6679
  d: "M3.1 9.1l.4 1.15 1.22.02-.96.74.34 1.17-1-.74-1 .74.34-1.17-.96-.74 1.22-.02.4-1.15z",
@@ -6470,7 +6687,7 @@ function SparklesIcon() {
6470
6687
  function TabMarkIcon({ customIconUrl }) {
6471
6688
  const url = customIconUrl?.trim();
6472
6689
  if (url) {
6473
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6690
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6474
6691
  "img",
6475
6692
  {
6476
6693
  alt: "",
@@ -6480,10 +6697,10 @@ function TabMarkIcon({ customIconUrl }) {
6480
6697
  }
6481
6698
  );
6482
6699
  }
6483
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SparklesIcon, {});
6700
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SparklesIcon, {});
6484
6701
  }
6485
6702
  function ChevronLeftIcon() {
6486
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6703
+ 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)(
6487
6704
  "path",
6488
6705
  {
6489
6706
  d: "M10 4L6 8l4 4",
@@ -6495,7 +6712,7 @@ function ChevronLeftIcon() {
6495
6712
  ) });
6496
6713
  }
6497
6714
  function ChevronDownIcon2() {
6498
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6715
+ 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)(
6499
6716
  "path",
6500
6717
  {
6501
6718
  d: "M4 6l4 4 4-4",
@@ -6507,7 +6724,7 @@ function ChevronDownIcon2() {
6507
6724
  ) });
6508
6725
  }
6509
6726
  function DragDots() {
6510
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("i", {}, index)) });
6727
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("i", {}, index)) });
6511
6728
  }
6512
6729
  var VARIANT_COPY = {
6513
6730
  outline: { label: "Ask anything", aria: "Ask anything" },
@@ -6553,7 +6770,7 @@ function AssistEdgeTab({
6553
6770
  ...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
6554
6771
  colorScheme: resolvedColorScheme
6555
6772
  };
6556
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6773
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
6557
6774
  "button",
6558
6775
  {
6559
6776
  type: "button",
@@ -6565,15 +6782,15 @@ function AssistEdgeTab({
6565
6782
  tabIndex: visible ? 0 : -1,
6566
6783
  onClick: onOpen,
6567
6784
  children: [
6568
- mobile ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
6569
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
6785
+ mobile ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
6786
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
6570
6787
  "span",
6571
6788
  {
6572
6789
  className: "assist-edge-tab__mark assist-edge-tab__mark--mobile",
6573
6790
  "aria-hidden": "true",
6574
6791
  children: [
6575
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TabMarkIcon, { customIconUrl }),
6576
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6792
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
6793
+ showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6577
6794
  "img",
6578
6795
  {
6579
6796
  className: "assist-edge-tab__logo",
@@ -6587,11 +6804,11 @@ function AssistEdgeTab({
6587
6804
  ]
6588
6805
  }
6589
6806
  ),
6590
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel })
6591
- ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
6592
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
6593
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TabMarkIcon, { customIconUrl }),
6594
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6807
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel })
6808
+ ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
6809
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
6810
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
6811
+ showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6595
6812
  "img",
6596
6813
  {
6597
6814
  className: "assist-edge-tab__logo",
@@ -6603,18 +6820,18 @@ function AssistEdgeTab({
6603
6820
  }
6604
6821
  ) : null
6605
6822
  ] }),
6606
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6607
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronDownIcon2, {})
6823
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6824
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronDownIcon2, {})
6608
6825
  ] }) : null,
6609
- variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
6610
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronLeftIcon, {}),
6611
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6612
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DragDots, {})
6826
+ variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
6827
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronLeftIcon, {}),
6828
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6829
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DragDots, {})
6613
6830
  ] }) : null,
6614
- variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
6615
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
6616
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(TabMarkIcon, { customIconUrl }),
6617
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
6831
+ variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
6832
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
6833
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(TabMarkIcon, { customIconUrl }),
6834
+ showLogo ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
6618
6835
  "img",
6619
6836
  {
6620
6837
  className: "assist-edge-tab__logo",
@@ -6626,8 +6843,8 @@ function AssistEdgeTab({
6626
6843
  }
6627
6844
  ) : null
6628
6845
  ] }),
6629
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6630
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ChevronLeftIcon, {})
6846
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6847
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ChevronLeftIcon, {})
6631
6848
  ] }) : null
6632
6849
  ]
6633
6850
  }
@@ -6649,8 +6866,8 @@ function findPrecedingVisitorText(messages, agentMessageId) {
6649
6866
  }
6650
6867
  return void 0;
6651
6868
  }
6652
- function normalizeAgentFeedbackAnswerText(text) {
6653
- const normalized = text.replace(/\s+/g, " ").trim();
6869
+ function normalizeAgentFeedbackAnswerText(text2) {
6870
+ const normalized = text2.replace(/\s+/g, " ").trim();
6654
6871
  if (!normalized) return void 0;
6655
6872
  return normalized.length > 4e3 ? `${normalized.slice(0, 3997)}...` : normalized;
6656
6873
  }
@@ -6691,7 +6908,7 @@ function sendAgentAnswerFeedback(eventUrl, event) {
6691
6908
  }
6692
6909
 
6693
6910
  // src/react/components/AgentWidget/AgentWidget.tsx
6694
- var import_jsx_runtime18 = require("react/jsx-runtime");
6911
+ var import_jsx_runtime19 = require("react/jsx-runtime");
6695
6912
  function AgentWidget({
6696
6913
  indexId,
6697
6914
  customerId,
@@ -6834,19 +7051,19 @@ function AgentWidget({
6834
7051
  window.addEventListener("keydown", handleKeyDown);
6835
7052
  return () => window.removeEventListener("keydown", handleKeyDown);
6836
7053
  }, [isMobile, railCollapsed, railExpanded]);
6837
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "webless-agent-root", children: [
6838
- /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7054
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "webless-agent-root", children: [
7055
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
6839
7056
  "div",
6840
7057
  {
6841
7058
  className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
6842
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7059
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
6843
7060
  "div",
6844
7061
  {
6845
7062
  ref: railSlotRef,
6846
7063
  className: "webless-agent-root__rail-slot",
6847
7064
  inert: railCollapsed || void 0,
6848
7065
  "aria-hidden": railCollapsed,
6849
- children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7066
+ children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
6850
7067
  AgentRail,
6851
7068
  {
6852
7069
  theme,
@@ -6883,7 +7100,7 @@ function AgentWidget({
6883
7100
  )
6884
7101
  }
6885
7102
  ),
6886
- railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
7103
+ railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
6887
7104
  AssistEdgeTab,
6888
7105
  {
6889
7106
  variant: placement.variant,
@@ -6907,12 +7124,71 @@ function AgentWidget({
6907
7124
  ) : null
6908
7125
  ] });
6909
7126
  }
7127
+
7128
+ // src/react/components/AgentTranscript/AgentTranscript.tsx
7129
+ var import_jsx_runtime20 = require("react/jsx-runtime");
7130
+ var timestampFormat = new Intl.DateTimeFormat("en-US", {
7131
+ month: "short",
7132
+ day: "numeric",
7133
+ hour: "numeric",
7134
+ minute: "2-digit",
7135
+ timeZone: "UTC"
7136
+ });
7137
+ function defaultTimestamp(createdAt) {
7138
+ return `${timestampFormat.format(createdAt)} UTC`;
7139
+ }
7140
+ function AgentTranscript({
7141
+ messages,
7142
+ theme,
7143
+ colorScheme,
7144
+ agentLabel = "Agent",
7145
+ visitorLabel = "Visitor",
7146
+ label = "Conversation transcript",
7147
+ formatTimestamp = defaultTimestamp
7148
+ }) {
7149
+ const scheme = useAgentColorScheme(colorScheme);
7150
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7151
+ "ol",
7152
+ {
7153
+ className: "webless-agent-root agent-transcript not-typeset",
7154
+ "data-not-typeset": "",
7155
+ "data-color-scheme": scheme,
7156
+ "aria-label": label,
7157
+ style: agentThemeStyle(theme, scheme),
7158
+ children: messages.map((message) => {
7159
+ const date = new Date(message.createdAt);
7160
+ const validTimestamp = Number.isFinite(date.getTime());
7161
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
7162
+ "li",
7163
+ {
7164
+ className: `agent-transcript__message agent-transcript__message--${message.role}`,
7165
+ children: [
7166
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "agent-transcript__meta", children: [
7167
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { children: message.role === "visitor" ? visitorLabel : agentLabel }),
7168
+ validTimestamp ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("time", { dateTime: date.toISOString(), children: formatTimestamp(message.createdAt) }) : null
7169
+ ] }),
7170
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7171
+ MessageBubble,
7172
+ {
7173
+ message: message.role === "agent" ? { ...message, streaming: false } : message,
7174
+ bookingDisabled: true
7175
+ }
7176
+ )
7177
+ ]
7178
+ },
7179
+ message.id
7180
+ );
7181
+ })
7182
+ }
7183
+ );
7184
+ }
6910
7185
  // Annotate the CommonJS export names for ESM import in node:
6911
7186
  0 && (module.exports = {
6912
7187
  AGENT_ANSWER_FEEDBACK_EVENT_TYPE,
6913
7188
  AGENT_STRUCTURED_TOOL_INPUT_HEADER,
6914
7189
  AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION,
6915
7190
  AgentRail,
7191
+ AgentTranscript,
6916
7192
  AgentWidget,
6917
7193
  AssistEdgeTab,
6918
7194
  DEFAULT_AGENT_PLACEMENT,