@planningcenter/topbar 12.4.0 → 12.4.1-qa-959.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.
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@planningcenter/tapestry'), require('react'), require('@planningcenter/url'), require('@planningcenter/icons/paths/general'), require('@planningcenter/jolt-client'), require('use-sync-external-store/shim'), require('react/jsx-runtime'), require('@planningcenter/tapestry-react'), require('@planningcenter/add-ons'), require('@planningcenter/icons/paths/church-center'), require('@planningcenter/icons/paths/people'), require('@planningcenter/icons/paths/toolbar'), require('react-calendly'), require('algoliasearch'), require('react-instantsearch-core'), require('react-transition-group'), require('@planningcenter/datetime-fmt')) :
3
- typeof define === 'function' && define.amd ? define(['exports', '@planningcenter/tapestry', 'react', '@planningcenter/url', '@planningcenter/icons/paths/general', '@planningcenter/jolt-client', 'use-sync-external-store/shim', 'react/jsx-runtime', '@planningcenter/tapestry-react', '@planningcenter/add-ons', '@planningcenter/icons/paths/church-center', '@planningcenter/icons/paths/people', '@planningcenter/icons/paths/toolbar', 'react-calendly', 'algoliasearch', 'react-instantsearch-core', 'react-transition-group', '@planningcenter/datetime-fmt'], factory) :
4
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PLANNINGCENTER = global.PLANNINGCENTER || {}, global.PLANNINGCENTER.Topbar = {}), global.tapestry, global.react, global.pcoUrl, global.general, global.Jolt, global.shim, null, global.tapestryReact, global.addOns, global.churchCenter, global.people, global.toolbar, global.reactCalendly, global.algoliasearch, global.reactInstantsearchCore, global.reactTransitionGroup, global.datetimeFmt));
5
- })(this, (function (exports, tapestry, React, pcoUrl$1, general, Jolt, shim, jsxRuntime, tapestryReact, addOns, churchCenter, people, toolbar, reactCalendly, algoliasearch, reactInstantsearchCore, reactTransitionGroup, datetimeFmt) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@planningcenter/tapestry'), require('react'), require('@planningcenter/url'), require('@planningcenter/icons/paths/general'), require('@planningcenter/jolt-client'), require('use-sync-external-store/shim'), require('react/jsx-runtime'), require('@planningcenter/icons/paths/toolbar'), require('@planningcenter/datetime-fmt'), require('pluralize'), require('@planningcenter/icons/paths/logomark'), require('@planningcenter/tapestry-react'), require('@planningcenter/add-ons'), require('@planningcenter/icons/paths/church-center'), require('@planningcenter/icons/paths/people'), require('react-calendly'), require('algoliasearch'), require('react-instantsearch-core'), require('react-transition-group')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', '@planningcenter/tapestry', 'react', '@planningcenter/url', '@planningcenter/icons/paths/general', '@planningcenter/jolt-client', 'use-sync-external-store/shim', 'react/jsx-runtime', '@planningcenter/icons/paths/toolbar', '@planningcenter/datetime-fmt', 'pluralize', '@planningcenter/icons/paths/logomark', '@planningcenter/tapestry-react', '@planningcenter/add-ons', '@planningcenter/icons/paths/church-center', '@planningcenter/icons/paths/people', 'react-calendly', 'algoliasearch', 'react-instantsearch-core', 'react-transition-group'], factory) :
4
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PLANNINGCENTER = global.PLANNINGCENTER || {}, global.PLANNINGCENTER.Topbar = {}), global.tapestry, global.react, global.pcoUrl, global.general, global.Jolt, global.shim, null, global.toolbar, global.datetimeFmt, global.pluralize, global.logomark, global.tapestryReact, global.addOns, global.churchCenter, global.people, global.reactCalendly, global.algoliasearch, global.reactInstantsearchCore, global.reactTransitionGroup));
5
+ })(this, (function (exports, tapestry, React, pcoUrl$1, general, Jolt, shim, jsxRuntime, toolbar, datetimeFmt, pluralize, logomarks, tapestryReact, addOns, churchCenter, people, reactCalendly, algoliasearch, reactInstantsearchCore, reactTransitionGroup) { 'use strict';
6
6
 
7
7
  function _interopNamespaceDefault(e) {
8
8
  var n = Object.create(null);
@@ -23,11 +23,12 @@
23
23
 
24
24
  var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
25
25
  var general__namespace = /*#__PURE__*/_interopNamespaceDefault(general);
26
+ var toolbar__namespace = /*#__PURE__*/_interopNamespaceDefault(toolbar);
27
+ var logomarks__namespace = /*#__PURE__*/_interopNamespaceDefault(logomarks);
26
28
  var churchCenter__namespace = /*#__PURE__*/_interopNamespaceDefault(churchCenter);
27
29
  var people__namespace = /*#__PURE__*/_interopNamespaceDefault(people);
28
- var toolbar__namespace = /*#__PURE__*/_interopNamespaceDefault(toolbar);
29
30
 
30
- var styles$m = {"accessibility-toolbar":"accessibility-toolbar-jgjUG"};
31
+ var styles$u = {"accessibility-toolbar":"accessibility-toolbar-jgjUG"};
31
32
 
32
33
  const AccessibilityToolbar = ({
33
34
  children
@@ -39,7 +40,7 @@
39
40
  (_a = document.getElementById("main-content")) === null || _a === void 0 ? void 0 : _a.focus();
40
41
  };
41
42
  return /*#__PURE__*/React.createElement("div", {
42
- className: styles$m["accessibility-toolbar"]
43
+ className: styles$u["accessibility-toolbar"]
43
44
  }, /*#__PURE__*/React.createElement(tapestry.Link, {
44
45
  href: "#main-content",
45
46
  kind: "primary",
@@ -358,11 +359,11 @@
358
359
  fill: fill
359
360
  })));
360
361
 
361
- var styles$l = {"announcement":"announcement-pI5tM","announcement--platform":"announcement--platform-EcUn2","announcement--promo":"announcement--promo-FarUk","announcement-icon":"announcement-icon-Ov39-","announcement-content":"announcement-content-q2ad6","dismiss":"dismiss-wUAoU","dismiss--promo":"dismiss--promo-7zvO4"};
362
+ var styles$t = {"announcement":"announcement-pI5tM","announcement--platform":"announcement--platform-EcUn2","announcement--promo":"announcement--promo-FarUk","announcement-icon":"announcement-icon-Ov39-","announcement-content":"announcement-content-q2ad6","dismiss":"dismiss-wUAoU","dismiss--promo":"dismiss--promo-7zvO4"};
362
363
 
363
364
  function AnnouncementIcon() {
364
365
  return /*#__PURE__*/React.createElement("svg", {
365
- className: styles$l["announcement-icon"],
366
+ className: styles$t["announcement-icon"],
366
367
  width: "16",
367
368
  height: "16",
368
369
  viewBox: "0 0 16 16",
@@ -487,7 +488,7 @@
487
488
  } = this.props;
488
489
  const isPromo = variant === "promo";
489
490
  return /*#__PURE__*/React.createElement("div", {
490
- className: classnames(styles$l["announcement"], styles$l[`announcement--${variant !== null && variant !== void 0 ? variant : "platform"}`]),
491
+ className: classnames(styles$t["announcement"], styles$t[`announcement--${variant !== null && variant !== void 0 ? variant : "platform"}`]),
491
492
  "data-announcement-variant": variant !== null && variant !== void 0 ? variant : "platform",
492
493
  style: isPromo ? {
493
494
  backgroundImage: promoBackgroundUrl,
@@ -496,7 +497,7 @@
496
497
  backgroundSize: "cover"
497
498
  } : undefined
498
499
  }, !isPromo && /*#__PURE__*/React.createElement(AnnouncementIcon, null), /*#__PURE__*/React.createElement("div", {
499
- className: styles$l["announcement-content"],
500
+ className: styles$t["announcement-content"],
500
501
  style: style,
501
502
  ...platformProps
502
503
  }));
@@ -545,7 +546,7 @@
545
546
  const isPromo = variant === "promo";
546
547
  return /*#__PURE__*/React.createElement("button", {
547
548
  type: "button",
548
- className: classnames(styles$l.dismiss, isPromo && styles$l["dismiss--promo"]),
549
+ className: classnames(styles$t.dismiss, isPromo && styles$t["dismiss--promo"]),
549
550
  ...props
550
551
  }, /*#__PURE__*/React.createElement(X, {
551
552
  fill: isPromo ? "currentColor" : "white",
@@ -625,9 +626,9 @@
625
626
  ...platformProps
626
627
  } = this.props;
627
628
  return /*#__PURE__*/React.createElement("div", {
628
- className: styles$l["announcement"]
629
+ className: styles$t["announcement"]
629
630
  }, /*#__PURE__*/React.createElement(AnnouncementIcon, null), /*#__PURE__*/React.createElement("div", {
630
- className: styles$l["announcement-content"],
631
+ className: styles$t["announcement-content"],
631
632
  style: style,
632
633
  ...platformProps
633
634
  }));
@@ -638,7 +639,7 @@
638
639
  }) {
639
640
  return /*#__PURE__*/React.createElement("button", {
640
641
  type: "button",
641
- className: styles$l.dismiss,
642
+ className: styles$t.dismiss,
642
643
  ...props
643
644
  }, /*#__PURE__*/React.createElement(X, {
644
645
  fill: "white",
@@ -1760,7 +1761,7 @@
1760
1761
  })) : (/*#__PURE__*/React.createElement("div", null, "appName not supported")));
1761
1762
  }
1762
1763
 
1763
- var styles$k = {"icon-slot":"icon-slot-m3ZIk","name":"name-UNqbW"};
1764
+ var styles$s = {"icon-slot":"icon-slot-m3ZIk","name":"name-UNqbW"};
1764
1765
 
1765
1766
  const AppRow = ({
1766
1767
  appName,
@@ -1769,24 +1770,24 @@
1769
1770
  }) => {
1770
1771
  if (appName === "Accounts") {
1771
1772
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", {
1772
- className: styles$k["icon-slot"]
1773
+ className: styles$s["icon-slot"]
1773
1774
  }, /*#__PURE__*/React.createElement(MonoAppIcon, {
1774
1775
  appName: "Accounts",
1775
1776
  colors: colors,
1776
1777
  size: iconSize
1777
1778
  })), /*#__PURE__*/React.createElement("span", {
1778
- className: styles$k.name
1779
+ className: styles$s.name
1779
1780
  }, "Account settings"));
1780
1781
  }
1781
1782
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ColorAppIcon, {
1782
1783
  appName: appName.replace(/[\s-]/, ""),
1783
1784
  size: iconSize
1784
1785
  }), /*#__PURE__*/React.createElement("span", {
1785
- className: styles$k.name
1786
+ className: styles$s.name
1786
1787
  }, appName));
1787
1788
  };
1788
1789
 
1789
- var styles$j = {"button":"button-XMbeQ","label":"label-884of","chevron":"chevron-RRg9k"};
1790
+ var styles$r = {"button":"button-XMbeQ","label":"label-884of","chevron":"chevron-RRg9k"};
1790
1791
 
1791
1792
  const AppsButton = /*#__PURE__*/React.forwardRef(({
1792
1793
  appName,
@@ -1798,10 +1799,10 @@
1798
1799
  ...restProps,
1799
1800
  ref: ref,
1800
1801
  "aria-label": `App switcher: ${appName}`,
1801
- className: styles$j.button,
1802
+ className: styles$r.button,
1802
1803
  kind: "neutral-inline",
1803
1804
  label: /*#__PURE__*/React.createElement("span", {
1804
- className: styles$j.label
1805
+ className: styles$r.label
1805
1806
  }, isAccounts ? "Account settings" : appName),
1806
1807
  prefix: isAccounts ? (/*#__PURE__*/React.createElement(MonoAppIcon, {
1807
1808
  appName: "Accounts",
@@ -1812,13 +1813,13 @@
1812
1813
  size: 22
1813
1814
  })),
1814
1815
  suffix: /*#__PURE__*/React.createElement(DisclosureChevronIcon, {
1815
- className: `${styles$j.chevron} symbol`
1816
+ className: `${styles$r.chevron} symbol`
1816
1817
  })
1817
1818
  });
1818
1819
  });
1819
1820
  AppsButton.displayName = "AppsButton";
1820
1821
 
1821
- var styles$i = {"nav":"nav-y-6ML","popover-content":"popover-content-jOAAY","list":"list-jUxvp","link":"link-LMp2h","current":"current-4U4VL","accounts-item":"accounts-item-erJW0","accounts-link":"accounts-link-4jwPW"};
1822
+ var styles$q = {"nav":"nav-y-6ML","popover-content":"popover-content-jOAAY","list":"list-jUxvp","link":"link-LMp2h","current":"current-4U4VL","accounts-item":"accounts-item-erJW0","accounts-link":"accounts-link-4jwPW"};
1822
1823
 
1823
1824
  const AppsMenu = ({
1824
1825
  appName,
@@ -1839,8 +1840,8 @@
1839
1840
  }, /*#__PURE__*/React.createElement("a", {
1840
1841
  "aria-current": isCurrent ? "page" : undefined,
1841
1842
  "aria-label": name,
1842
- className: classnames(styles$i.link, {
1843
- [styles$i.current]: isCurrent
1843
+ className: classnames(styles$q.link, {
1844
+ [styles$q.current]: isCurrent
1844
1845
  }),
1845
1846
  "data-pendo": `app-switcher--change-app--${name}`,
1846
1847
  "data-turbolinks": false,
@@ -1856,22 +1857,22 @@
1856
1857
  colors: colors
1857
1858
  })), /*#__PURE__*/React.createElement(tapestry.PopoverContent, {
1858
1859
  "aria-label": "Switch app",
1859
- className: styles$i["popover-content"],
1860
+ className: styles$q["popover-content"],
1860
1861
  placement: "bottom start"
1861
1862
  }, /*#__PURE__*/React.createElement("nav", {
1862
- className: styles$i.nav,
1863
+ className: styles$q.nav,
1863
1864
  "data-pendo": "app-switcher"
1864
1865
  }, /*#__PURE__*/React.createElement("ul", {
1865
- className: styles$i.list,
1866
+ className: styles$q.list,
1866
1867
  role: "list"
1867
1868
  }, homeProduct && renderProductLink(homeProduct.name), restProducts.map(({
1868
1869
  name
1869
1870
  }) => renderProductLink(name)), accountsProduct && (/*#__PURE__*/React.createElement("li", {
1870
- className: styles$i["accounts-item"]
1871
+ className: styles$q["accounts-item"]
1871
1872
  }, /*#__PURE__*/React.createElement("a", {
1872
1873
  "aria-current": appName === accountsProduct.name ? "page" : undefined,
1873
1874
  "aria-label": "Account settings",
1874
- className: classnames(styles$i.link, styles$i["accounts-link"]),
1875
+ className: classnames(styles$q.link, styles$q["accounts-link"]),
1875
1876
  "data-pendo": "app-switcher--change-app--Accounts",
1876
1877
  "data-turbolinks": false,
1877
1878
  href: pcoUrl$1(env)("accounts") + getAppsSwitchProductPath(accountsProduct.name)
@@ -2079,7 +2080,7 @@
2079
2080
  })) : (/*#__PURE__*/React.createElement("div", null, "appName not supported"));
2080
2081
  }
2081
2082
 
2082
- var styles$h = {"unbutton":"unbutton-lEbTR"};
2083
+ var styles$p = {"unbutton":"unbutton-lEbTR"};
2083
2084
 
2084
2085
  function Unbutton({
2085
2086
  className,
@@ -2088,7 +2089,7 @@
2088
2089
  ...nativeProps
2089
2090
  }) {
2090
2091
  return /*#__PURE__*/React.createElement("button", {
2091
- className: classnames(styles$h.unbutton, className),
2092
+ className: classnames(styles$p.unbutton, className),
2092
2093
  style: {
2093
2094
  ...style
2094
2095
  },
@@ -2097,7 +2098,7 @@
2097
2098
  });
2098
2099
  }
2099
2100
 
2100
- var styles$g = {"button":"button-wsipc","button-accounts":"button-accounts-zQmBM","chevron":"chevron-obyBF","is-expanded":"is-expanded-PoCQ9"};
2101
+ var styles$o = {"button":"button-wsipc","button-accounts":"button-accounts-zQmBM","chevron":"chevron-obyBF","is-expanded":"is-expanded-PoCQ9"};
2101
2102
 
2102
2103
  const LegacyAppsButton = ({
2103
2104
  appName,
@@ -2112,8 +2113,8 @@
2112
2113
  "aria-haspopup": "true",
2113
2114
  "aria-label": `App switcher: ${appName}`,
2114
2115
  onClick: onClick,
2115
- className: classnames(styles$g.button, {
2116
- [styles$g["is-expanded"]]: expanded
2116
+ className: classnames(styles$o.button, {
2117
+ [styles$o["is-expanded"]]: expanded
2117
2118
  }),
2118
2119
  type: "button",
2119
2120
  style: style,
@@ -2122,7 +2123,7 @@
2122
2123
  appName: "Accounts",
2123
2124
  colors: colors
2124
2125
  }), /*#__PURE__*/React.createElement("div", {
2125
- className: styles$g["button-accounts"]
2126
+ className: styles$o["button-accounts"]
2126
2127
  }, "Account settings"))) : (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ColorAppIcon, {
2127
2128
  appName: appName.replace(/[\s-]/, "")
2128
2129
  }), /*#__PURE__*/React.createElement(MonoAppName, {
@@ -2130,7 +2131,7 @@
2130
2131
  key: "mono-app-name",
2131
2132
  size: 24
2132
2133
  }))), /*#__PURE__*/React.createElement(DisclosureChevronIcon, {
2133
- className: styles$g.chevron,
2134
+ className: styles$o.chevron,
2134
2135
  key: "disclosure-chevron-icon"
2135
2136
  }));
2136
2137
  };
@@ -2263,7 +2264,7 @@
2263
2264
  }
2264
2265
  }
2265
2266
 
2266
- var styles$f = {"popup-root":"popup-root-SeL5u","popup":"popup-nQXYW","is-visible":"is-visible-3DAUP"};
2267
+ var styles$n = {"popup-root":"popup-root-SeL5u","popup":"popup-nQXYW","is-visible":"is-visible-3DAUP"};
2267
2268
 
2268
2269
  const Popup = ({
2269
2270
  className,
@@ -2271,8 +2272,8 @@
2271
2272
  isVisible,
2272
2273
  ...nativeProps
2273
2274
  }) => (/*#__PURE__*/React.createElement(C, {
2274
- className: classnames(styles$f.popup, {
2275
- [styles$f["is-visible"]]: isVisible
2275
+ className: classnames(styles$n.popup, {
2276
+ [styles$n["is-visible"]]: isVisible
2276
2277
  }, className),
2277
2278
  ...nativeProps
2278
2279
  }));
@@ -2280,11 +2281,11 @@
2280
2281
  const PopupRoot = ({
2281
2282
  ...nativeProps
2282
2283
  }) => (/*#__PURE__*/React.createElement("div", {
2283
- className: styles$f["popup-root"],
2284
+ className: styles$n["popup-root"],
2284
2285
  ...nativeProps
2285
2286
  }));
2286
2287
 
2287
- var styles$e = {"popup":"popup-bVhSa"};
2288
+ var styles$m = {"popup":"popup-bVhSa"};
2288
2289
 
2289
2290
  const LegacyAppsMenu = ({
2290
2291
  appName,
@@ -2322,7 +2323,7 @@
2322
2323
  cleanup: !visible,
2323
2324
  component: Outsider,
2324
2325
  onOutsideClick: toggle,
2325
- className: styles$e.popup,
2326
+ className: styles$m.popup,
2326
2327
  isVisible: visible
2327
2328
  }, /*#__PURE__*/React.createElement("menu", {
2328
2329
  ref: menuRef,
@@ -3232,34 +3233,117 @@ true;
3232
3233
  });
3233
3234
  }, []);
3234
3235
 
3236
+ const collections = {
3237
+ general: general__namespace,
3238
+ toolbar: toolbar__namespace
3239
+ };
3240
+ const paths = collections;
3241
+ function Icon({
3242
+ name,
3243
+ size = 16,
3244
+ style,
3245
+ theme,
3246
+ title,
3247
+ ...props
3248
+ }) {
3249
+ const [collection, symbol] = name.split(".");
3250
+ return /*#__PURE__*/React.createElement("svg", {
3251
+ "aria-hidden": title ? undefined : true,
3252
+ fill: "currentColor",
3253
+ height: size,
3254
+ role: title ? "img" : undefined,
3255
+ style: {
3256
+ color: theme && `var(${theme})`,
3257
+ flexShrink: 0,
3258
+ ...style
3259
+ },
3260
+ viewBox: "0 0 16 16",
3261
+ width: size,
3262
+ ...props
3263
+ }, title && /*#__PURE__*/React.createElement("title", null, title), /*#__PURE__*/React.createElement("path", {
3264
+ d: paths[collection][symbol]
3265
+ }));
3266
+ }
3267
+
3268
+ const SEARCHABLE_PRODUCTS = [{
3269
+ appName: "Calendar",
3270
+ slug: "calendar"
3271
+ }, {
3272
+ appName: "Check-Ins",
3273
+ slug: "check-ins"
3274
+ }, {
3275
+ appName: "Giving",
3276
+ slug: "giving"
3277
+ }, {
3278
+ appName: "Groups",
3279
+ slug: "groups"
3280
+ }, {
3281
+ appName: "People",
3282
+ slug: "people"
3283
+ }, {
3284
+ appName: "Publishing",
3285
+ slug: "publishing"
3286
+ }, {
3287
+ appName: "Registrations",
3288
+ slug: "registrations"
3289
+ }, {
3290
+ appName: "Services",
3291
+ slug: "services"
3292
+ }];
3293
+ const KEYBOARD_SHORTCUTS = {
3294
+ copyLink: {
3295
+ key: "c",
3296
+ label: "Copy link",
3297
+ modifierKey: true
3298
+ },
3299
+ openInNewTab: {
3300
+ label: "Open in new tab"},
3301
+ openSearch: {
3302
+ key: "k",
3303
+ label: "Open search",
3304
+ modifierKey: true
3305
+ },
3306
+ select: {
3307
+ label: "Select",
3308
+ modifierKey: false,
3309
+ next: "ArrowDown",
3310
+ previous: "ArrowUp"
3311
+ }
3312
+ };
3313
+
3235
3314
  const isMac = () => /Mac|iPhone|iPad|iPod/.test(navigator.platform);
3236
3315
  const hasCommandKey = event => isMac() ? event.metaKey : event.ctrlKey;
3237
- const commandKeyLabel = () => isMac() ? "⌘" : "Ctrl+";
3238
- const isSearchShortcut = event => event.key.toLowerCase() === "k" && !event.altKey && !event.shiftKey && hasCommandKey(event);
3316
+ const matchesShortcut = (shortcut, event) => event.key.toLowerCase() === shortcut.key && !event.altKey && !event.shiftKey && hasCommandKey(event) === shortcut.modifierKey;
3317
+ const isSearchShortcut = event => matchesShortcut(KEYBOARD_SHORTCUTS.openSearch, event);
3239
3318
  // Products opened their own search with `/` before this one replaced it.
3240
3319
  const isLegacySearchShortcut = event => event.key === "/" && !event.altKey && !event.ctrlKey && !event.metaKey && !isTypingIn(event.target);
3241
- const isCopyShortcut = event => event.key.toLowerCase() === "c" && !event.altKey && !event.shiftKey && hasCommandKey(event);
3320
+ const isCopyShortcut = event => matchesShortcut(KEYBOARD_SHORTCUTS.copyLink, event);
3242
3321
  const isTypingIn = target => target instanceof Element && target.closest('input, select, textarea, [contenteditable]:not([contenteditable="false"])') !== null;
3243
3322
  const isTypingKey = event => event.key.length === 1 && event.key !== " " && !event.altKey && !event.ctrlKey && !event.metaKey;
3244
3323
  const verticalStep = key => ({
3245
- ArrowDown: 1,
3246
- ArrowUp: -1
3324
+ [KEYBOARD_SHORTCUTS.select.next]: 1,
3325
+ [KEYBOARD_SHORTCUTS.select.previous]: -1
3247
3326
  })[key];
3248
3327
  const horizontalStep = key => ({
3249
3328
  ArrowLeft: -1,
3250
3329
  ArrowRight: 1
3251
3330
  })[key];
3252
3331
 
3332
+ var styles$l = {"searchButton":"searchButton-fYa5-"};
3333
+
3253
3334
  function SearchButton({
3335
+ mobile = false,
3254
3336
  onClick
3255
3337
  }) {
3256
3338
  return /*#__PURE__*/React.createElement("button", {
3257
- "aria-keyshortcuts": `${isMac() ? "Meta+K" : "Control+K"} /`,
3339
+ "aria-keyshortcuts": mobile ? undefined : `${isMac() ? "Meta" : "Control"}+${KEYBOARD_SHORTCUTS.openSearch.key.toUpperCase()} /`,
3258
3340
  "aria-label": "Search",
3341
+ className: styles$l.searchButton,
3259
3342
  onClick: onClick,
3260
3343
  type: "button"
3261
- }, /*#__PURE__*/React.createElement(Spyglass, {
3262
- fill: "currentColor"
3344
+ }, /*#__PURE__*/React.createElement(Icon, {
3345
+ name: "general.search",
3346
+ size: mobile ? 18 : 14
3263
3347
  }));
3264
3348
  }
3265
3349
 
@@ -3574,16 +3658,16 @@ true;
3574
3658
  const ENTRY_VERSION = 3;
3575
3659
  const MAX_ENTRIES = 50;
3576
3660
  const MAX_TEXT_LENGTH = 200;
3577
- const PRODUCTS = ["accounts", "calendar", "check-ins", "giving", "groups", "home", "login", "people", "publishing", "registrations", "services"];
3661
+ const PRODUCTS$1 = ["accounts", "calendar", "check-ins", "giving", "groups", "home", "login", "people", "publishing", "registrations", "services"];
3578
3662
  // Login has no pages worth returning to.
3579
- const APPS = PRODUCTS.filter(product => product !== "login");
3663
+ const APPS = PRODUCTS$1.filter(product => product !== "login");
3580
3664
  function isId(value) {
3581
3665
  return value !== "" && Array.from(value).every(character => character >= "0" && character <= "9");
3582
3666
  }
3583
3667
  // A PCRL looks like `<product>/v2/<resource_type>/<id>`.
3584
3668
  function isPcrl(value) {
3585
3669
  const segments = value.split("/");
3586
- return segments.length === 4 && PRODUCTS.some(product => product === segments[0]) && isId(segments[3]);
3670
+ return segments.length === 4 && PRODUCTS$1.some(product => product === segments[0]) && isId(segments[3]);
3587
3671
  }
3588
3672
  function isApp(value) {
3589
3673
  return APPS.some(app => app === value);
@@ -3982,7 +4066,13 @@ true;
3982
4066
  return selectedInField || ((_b = (_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "") !== "";
3983
4067
  }
3984
4068
 
3985
- const COPIED_FEEDBACK_MS = 1500;
4069
+ // eslint-disable-next-line sort-keys-fix/sort-keys-fix
4070
+ const COPIED_TIMING = {
4071
+ enter: 240,
4072
+ active: 1000,
4073
+ exit: 240
4074
+ };
4075
+ const COPIED_FEEDBACK_MS = COPIED_TIMING.enter + COPIED_TIMING.active + COPIED_TIMING.exit;
3986
4076
  // `copiedUrl` stays set briefly after a copy so the UI can confirm it.
3987
4077
  function useCopyLink() {
3988
4078
  const [copiedUrl, setCopiedUrl] = React.useState(null);
@@ -4006,22 +4096,27 @@ true;
4006
4096
  // Remembering which list the index belongs to puts the highlight back on the
4007
4097
  // first item whenever a new list replaces it, without an effect to reset it.
4008
4098
  // A list that grows or fills in under the same `list` keeps its highlight.
4009
- function useResultNavigation(items, list) {
4099
+ // Disabled, nothing is highlighted and the keys and pointer leave it alone.
4100
+ function useResultNavigation(items, list, enabled = true) {
4010
4101
  const [highlight, setHighlight] = React.useState({
4011
4102
  index: 0,
4012
4103
  list
4013
4104
  });
4014
4105
  const highlightedIndex = highlight.list === list ? highlight.index : 0;
4015
- const highlighted = items[highlightedIndex];
4106
+ const highlighted = enabled ? items[highlightedIndex] : undefined;
4016
4107
  const {
4017
4108
  copiedUrl,
4018
4109
  copy
4019
4110
  } = useCopyLink();
4020
- const highlightIndex = React.useCallback(index => setHighlight(current => current.list === list && current.index === index ? current : {
4021
- index,
4022
- list
4023
- }), [list]);
4111
+ const highlightIndex = React.useCallback(index => {
4112
+ if (!enabled) return;
4113
+ setHighlight(current => current.list === list && current.index === index ? current : {
4114
+ index,
4115
+ list
4116
+ });
4117
+ }, [enabled, list]);
4024
4118
  const handleKeyDown = event => {
4119
+ if (!enabled) return;
4025
4120
  const step = verticalStep(event.key);
4026
4121
  if (step && items.length > 0) {
4027
4122
  event.preventDefault();
@@ -4045,41 +4140,89 @@ true;
4045
4140
  };
4046
4141
  }
4047
4142
 
4048
- function groupSections(groups = []) {
4143
+ var styles$k = {"modal":"modal-NR3TO","visuallyHidden":"visuallyHidden-C28ju","panel":"panel-HlF7S"};
4144
+
4145
+ const FALLBACK_SLUGS = ["people", "services"];
4146
+ function defaultProduct(products, appName) {
4147
+ var _a;
4148
+ const current = products.find(product => product.appName === appName);
4149
+ const fallback = FALLBACK_SLUGS.map(slug => products.find(product => product.slug === slug)).find(Boolean);
4150
+ return (_a = current !== null && current !== void 0 ? current : fallback) !== null && _a !== void 0 ? _a : products[0];
4151
+ }
4152
+
4153
+ function groupSections(groups = [], timeZone) {
4049
4154
  return groups.map(({
4050
4155
  results,
4051
4156
  type
4052
4157
  }) => ({
4053
4158
  heading: type,
4054
- items: results.map(resultItem),
4159
+ items: results.map(result => resultItem(result, timeZone)),
4055
4160
  key: type
4056
4161
  }));
4057
4162
  }
4058
4163
  function resultItem({
4059
4164
  attributes,
4060
4165
  id
4061
- }) {
4166
+ }, timeZone) {
4062
4167
  return {
4168
+ category: attributes.category,
4169
+ imageUrl: attributes.image_url,
4063
4170
  key: id,
4064
- subtitle: summarize(attributes.metadata),
4171
+ product: attributes.product,
4172
+ subtitle: summarize(attributes, timeZone),
4065
4173
  title: attributes.title,
4066
4174
  url: attributes.url
4067
4175
  };
4068
4176
  }
4069
- function visitItem(visit) {
4177
+ function visitItem(visit, timeZone) {
4070
4178
  return {
4071
4179
  key: entryKey(visit.entry),
4072
- ...describeVisit(visit)
4180
+ ...describeVisit(visit, timeZone)
4073
4181
  };
4074
4182
  }
4075
- function summarize(metadata) {
4076
- return Object.values(metadata !== null && metadata !== void 0 ? metadata : {}).filter(value => typeof value === "string" && value !== "").join(" · ");
4183
+ const joinParts = (...parts) => parts.filter(Boolean).join(" · ");
4184
+ // Matches home-mobile's search subtitles, so a result reads the same in both.
4185
+ function summarize({
4186
+ category,
4187
+ metadata
4188
+ }, timeZone) {
4189
+ const text = key => {
4190
+ const value = metadata === null || metadata === void 0 ? void 0 : metadata[key];
4191
+ return typeof value === "string" ? value : "";
4192
+ };
4193
+ if (category === "profile") {
4194
+ return joinParts(text("phone"), text("email"));
4195
+ } else if (category === "event") {
4196
+ return eventTime(text("starts_at"), text("ends_at"), {
4197
+ recurring: (metadata === null || metadata === void 0 ? void 0 : metadata.recurring) === true,
4198
+ timeZone
4199
+ });
4200
+ } else {
4201
+ return text("details");
4202
+ }
4203
+ }
4204
+ // "Oct 25, 9–10:30am", in the organization's time zone like the rest
4205
+ // of Planning Center.
4206
+ function eventTime(startsAt, endsAt, {
4207
+ recurring,
4208
+ timeZone
4209
+ }) {
4210
+ if (startsAt === "") {
4211
+ return "";
4212
+ } else {
4213
+ const time = datetimeFmt.datetime(startsAt, endsAt || null, {
4214
+ style: "abbreviated",
4215
+ ...(timeZone && {
4216
+ timeZone
4217
+ })
4218
+ });
4219
+ return recurring ? joinParts(time, "Repeating") : time;
4220
+ }
4077
4221
  }
4078
4222
  // Unlike search results, recents come from every product, so each one names
4079
4223
  // its product and type.
4080
- function describeVisit(visit) {
4224
+ function describeVisit(visit, timeZone) {
4081
4225
  var _a, _b;
4082
- const subtitle = (...parts) => parts.filter(Boolean).join(" · ");
4083
4226
  if (visit.status === "page") {
4084
4227
  const {
4085
4228
  app,
@@ -4087,19 +4230,31 @@ true;
4087
4230
  title
4088
4231
  } = visit.entry;
4089
4232
  return {
4090
- subtitle: subtitle(productName(app), (_a = metadata === null || metadata === void 0 ? void 0 : metadata.type) !== null && _a !== void 0 ? _a : "", (_b = metadata === null || metadata === void 0 ? void 0 : metadata.details) !== null && _b !== void 0 ? _b : ""),
4233
+ category: "generic",
4234
+ imageUrl: null,
4235
+ product: app,
4236
+ subtitle: joinParts(productName(app), capitalize((_a = metadata === null || metadata === void 0 ? void 0 : metadata.type) !== null && _a !== void 0 ? _a : ""), (_b = metadata === null || metadata === void 0 ? void 0 : metadata.details) !== null && _b !== void 0 ? _b : ""),
4091
4237
  title,
4092
4238
  url: visit.url
4093
4239
  };
4094
4240
  } else {
4095
4241
  const {
4096
- metadata,
4242
+ attributes
4243
+ } = visit.result;
4244
+ const {
4245
+ category,
4246
+ image_url,
4097
4247
  product,
4098
4248
  title,
4099
4249
  type
4100
- } = visit.result.attributes;
4250
+ } = attributes;
4251
+ // Profiles and events say what they are with a phone number or a date.
4252
+ const kind = category === "generic" ? capitalize(pluralize.singular(type)) : "";
4101
4253
  return {
4102
- subtitle: subtitle(productName(product), type, summarize(metadata)),
4254
+ category,
4255
+ imageUrl: image_url,
4256
+ product,
4257
+ subtitle: joinParts(productName(product), kind, summarize(attributes, timeZone)),
4103
4258
  title,
4104
4259
  url: visit.url
4105
4260
  };
@@ -4113,39 +4268,278 @@ true;
4113
4268
  return word.charAt(0).toUpperCase() + word.slice(1);
4114
4269
  }
4115
4270
 
4116
- const STORAGE_KEY = "topbar.product_search.last_product";
4117
- function readLastProduct() {
4118
- try {
4119
- return localStorage.getItem(STORAGE_KEY);
4120
- } catch {
4121
- return null;
4122
- }
4123
- }
4124
- function saveLastProduct(slug) {
4125
- try {
4126
- localStorage.setItem(STORAGE_KEY, slug);
4127
- } catch {
4128
- // Storage can be full or blocked; search still works without it.
4271
+ var styles$j = {"container":"container-YDdM1","hint":"hint-017Rd","keycap":"keycap-ENJM2","labels":"labels-GHPqL","copied":"copied-DUFa1"};
4272
+
4273
+ const SYMBOLS = {
4274
+ command: {
4275
+ label: "⌘",
4276
+ paths: ["M7 9a2 2 0 1 1 2 -2v10a2 2 0 1 1 -2 -2h10a2 2 0 1 1 -2 2v-10a2 2 0 1 1 2 2h-10"]
4277
+ },
4278
+ down: {
4279
+ label: "↓",
4280
+ paths: ["M12 6l0 12", "M16 14l-4 4", "M8 14l4 4"]
4281
+ },
4282
+ return: {
4283
+ label: "↵",
4284
+ paths: ["M18 6v6a3 3 0 0 1 -3 3h-10l4 -4m0 8l-4 -4"]
4285
+ },
4286
+ up: {
4287
+ label: "↑",
4288
+ paths: ["M12 6l0 12", "M16 10l-4 -4", "M8 10l4 -4"]
4129
4289
  }
4290
+ };
4291
+ function Keycap(props) {
4292
+ return /*#__PURE__*/React.createElement("kbd", {
4293
+ className: styles$j.keycap
4294
+ }, "symbol" in props ? (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("svg", {
4295
+ "aria-hidden": true,
4296
+ fill: "none",
4297
+ stroke: "currentColor",
4298
+ strokeLinecap: "round",
4299
+ strokeLinejoin: "round",
4300
+ viewBox: "0 0 24 24"
4301
+ }, SYMBOLS[props.symbol].paths.map(d => (/*#__PURE__*/React.createElement("path", {
4302
+ d: d,
4303
+ key: d
4304
+ })))), /*#__PURE__*/React.createElement("span", {
4305
+ className: styles$k.visuallyHidden
4306
+ }, SYMBOLS[props.symbol].label))) : props.label);
4307
+ }
4308
+ function CommandKey() {
4309
+ return isMac() ? /*#__PURE__*/React.createElement(Keycap, {
4310
+ symbol: "command"
4311
+ }) : /*#__PURE__*/React.createElement(Keycap, {
4312
+ label: "Ctrl"
4313
+ });
4130
4314
  }
4131
- function initialProduct(products) {
4132
- var _a, _b, _c;
4133
- const lastProduct = readLastProduct();
4134
- const bySlug = slug => products.find(product => product.slug === slug);
4135
- return (_c = (_b = (_a = bySlug(lastProduct)) !== null && _a !== void 0 ? _a : bySlug("people")) !== null && _b !== void 0 ? _b : bySlug("services")) !== null && _c !== void 0 ? _c : products[0];
4315
+ function EnterKey() {
4316
+ return isMac() ? /*#__PURE__*/React.createElement(Keycap, {
4317
+ symbol: "return"
4318
+ }) : /*#__PURE__*/React.createElement(Keycap, {
4319
+ label: "Enter"
4320
+ });
4136
4321
  }
4137
-
4322
+ const {
4323
+ copyLink,
4324
+ openInNewTab,
4325
+ openSearch,
4326
+ select
4327
+ } = KEYBOARD_SHORTCUTS;
4138
4328
  function KeyboardHints({
4139
4329
  copied
4140
4330
  }) {
4141
- const command = commandKeyLabel();
4142
- return /*#__PURE__*/React.createElement("p", null, "\u2191\u2193 Select \u00B7 \u21B5 Open \u00B7 ", command, "\u21B5 Open in new tab \u00B7 ", command, "C", " ", /*#__PURE__*/React.createElement("span", {
4331
+ return /*#__PURE__*/React.createElement("ul", {
4332
+ "aria-label": "Keyboard shortcuts",
4333
+ className: styles$j.container
4334
+ }, /*#__PURE__*/React.createElement("li", {
4335
+ className: styles$j.hint
4336
+ }, /*#__PURE__*/React.createElement(tapestry.Flex, {
4337
+ gap: 0.5
4338
+ }, select.modifierKey, /*#__PURE__*/React.createElement(Keycap, {
4339
+ symbol: "up"
4340
+ }), /*#__PURE__*/React.createElement(Keycap, {
4341
+ symbol: "down"
4342
+ })), select.label), /*#__PURE__*/React.createElement("li", {
4343
+ className: styles$j.hint
4344
+ }, /*#__PURE__*/React.createElement(tapestry.Flex, {
4345
+ gap: 0.5
4346
+ }, /*#__PURE__*/React.createElement(CommandKey, null), /*#__PURE__*/React.createElement(EnterKey, null)), openInNewTab.label), /*#__PURE__*/React.createElement("li", {
4347
+ className: classnames(styles$j.hint, copied && styles$j.copied),
4348
+ style: {
4349
+ "--copied-active": `${COPIED_TIMING.active}ms`,
4350
+ "--copied-enter": `${COPIED_TIMING.enter}ms`,
4351
+ "--copied-exit": `${COPIED_TIMING.exit}ms`
4352
+ }
4353
+ }, /*#__PURE__*/React.createElement(tapestry.Flex, {
4354
+ gap: 0.5
4355
+ }, /*#__PURE__*/React.createElement(CommandKey, null), /*#__PURE__*/React.createElement(Keycap, {
4356
+ label: copyLink.key.toUpperCase()
4357
+ })), /*#__PURE__*/React.createElement("span", {
4358
+ className: styles$j.labels
4359
+ }, /*#__PURE__*/React.createElement("span", {
4360
+ "aria-hidden": copied
4361
+ }, copyLink.label), /*#__PURE__*/React.createElement("span", {
4143
4362
  role: "status"
4144
- }, copied ? "Copied!" : "Copy link"), " \u00B7 ", command, "K Open search");
4363
+ }, copied && "Copied!"))), /*#__PURE__*/React.createElement("li", {
4364
+ className: styles$j.hint
4365
+ }, /*#__PURE__*/React.createElement(tapestry.Flex, {
4366
+ gap: 0.5
4367
+ }, /*#__PURE__*/React.createElement(CommandKey, null), /*#__PURE__*/React.createElement(Keycap, {
4368
+ label: openSearch.key.toUpperCase()
4369
+ })), openSearch.label));
4145
4370
  }
4146
4371
 
4147
- var styles$d = {"tab":"tab-dz8ki"};
4372
+ var styles$i = {"icon":"icon-XKLvN","squircle":"squircle-JCHr6"};
4148
4373
 
4374
+ const PRODUCTS = {
4375
+ accounts: {
4376
+ gradient: "--t-fill-color-product-accounts-gradient-brand",
4377
+ path: logomarks__namespace.accounts
4378
+ },
4379
+ api: {
4380
+ gradient: "--t-fill-color-product-api-gradient-brand",
4381
+ path: logomarks__namespace.api
4382
+ },
4383
+ calendar: {
4384
+ gradient: "--t-fill-color-product-calendar-gradient-brand",
4385
+ path: logomarks__namespace.calendar
4386
+ },
4387
+ "check-ins": {
4388
+ gradient: "--t-fill-color-product-checkins-gradient-brand",
4389
+ path: logomarks__namespace.checkIns
4390
+ },
4391
+ "church-center": {
4392
+ gradient: "--t-fill-color-product-cc-gradient-brand",
4393
+ path: logomarks__namespace.churchCenter
4394
+ },
4395
+ giving: {
4396
+ gradient: "--t-fill-color-product-giving-gradient-brand",
4397
+ path: logomarks__namespace.giving
4398
+ },
4399
+ groups: {
4400
+ gradient: "--t-fill-color-product-groups-gradient-brand",
4401
+ path: logomarks__namespace.groups
4402
+ },
4403
+ home: {
4404
+ gradient: "--t-fill-color-product-home-gradient-brand",
4405
+ path: logomarks__namespace.home
4406
+ },
4407
+ "music-stand": {
4408
+ gradient: "--t-fill-color-product-musicstand-gradient-brand",
4409
+ path: logomarks__namespace.musicStand
4410
+ },
4411
+ people: {
4412
+ gradient: "--t-fill-color-product-people-gradient-brand",
4413
+ path: logomarks__namespace.people
4414
+ },
4415
+ publishing: {
4416
+ gradient: "--t-fill-color-product-publishing-gradient-brand",
4417
+ path: logomarks__namespace.publishing
4418
+ },
4419
+ registrations: {
4420
+ gradient: "--t-fill-color-product-registrations-gradient-brand",
4421
+ path: logomarks__namespace.registrations
4422
+ },
4423
+ services: {
4424
+ gradient: "--t-fill-color-product-services-gradient-brand",
4425
+ path: logomarks__namespace.services
4426
+ }
4427
+ };
4428
+ const isProductIconSlug = slug => Object.prototype.hasOwnProperty.call(PRODUCTS, slug);
4429
+ const maskFor = path => `url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="${path}"/></svg>`)}")`;
4430
+ function ProductIcon({
4431
+ size = 16,
4432
+ slug
4433
+ }) {
4434
+ const {
4435
+ gradient,
4436
+ path
4437
+ } = PRODUCTS[slug];
4438
+ const mask = maskFor(path);
4439
+ return /*#__PURE__*/React.createElement("span", {
4440
+ "aria-hidden": true,
4441
+ className: styles$i.icon,
4442
+ style: {
4443
+ height: size,
4444
+ width: size
4445
+ }
4446
+ }, /*#__PURE__*/React.createElement("span", {
4447
+ className: styles$i.squircle,
4448
+ style: {
4449
+ WebkitMaskImage: mask,
4450
+ background: `var(${gradient})`,
4451
+ maskImage: mask
4452
+ }
4453
+ }));
4454
+ }
4455
+
4456
+ var styles$h = {"picker":"picker-iuzzj","option":"option--7LXg"};
4457
+
4458
+ // Phones have no room for a tab per product, so they pick from a dropdown.
4459
+ // Complex mode renders each option's logomark, in the list and the trigger.
4460
+ function ProductSelect({
4461
+ children,
4462
+ onSelect,
4463
+ products,
4464
+ selected
4465
+ }) {
4466
+ const options = products.map(({
4467
+ appName,
4468
+ slug
4469
+ }) => ({
4470
+ label: (/*#__PURE__*/React.createElement("span", {
4471
+ className: styles$h.option
4472
+ }, /*#__PURE__*/React.createElement(ProductIcon, {
4473
+ slug: slug
4474
+ }), appName)),
4475
+ textValue: appName,
4476
+ value: slug
4477
+ }));
4478
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
4479
+ className: styles$h.picker
4480
+ }, /*#__PURE__*/React.createElement(tapestry.Select, {
4481
+ "aria-label": "Product",
4482
+ complex: true,
4483
+ onChange: event => onSelect(event.target.value),
4484
+ options: options,
4485
+ value: selected.slug
4486
+ })), /*#__PURE__*/React.createElement("div", {
4487
+ className: styles$k.panel
4488
+ }, children));
4489
+ }
4490
+
4491
+ // Browsers match :focus-visible on every focused text field, keyboard or not,
4492
+ // since typing follows either way. So this remembers what last moved focus,
4493
+ // shared by every field and listened for once, in the capture phase so it's
4494
+ // known before focus moves.
4495
+ let lastInteraction = "pointer";
4496
+ let listening = false;
4497
+ function listen() {
4498
+ if (listening) return;
4499
+ listening = true;
4500
+ document.addEventListener("keydown", event => {
4501
+ // Shortcuts like ⌘C don't move focus.
4502
+ if (!event.metaKey && !event.ctrlKey && !event.altKey) {
4503
+ lastInteraction = "keyboard";
4504
+ }
4505
+ }, true);
4506
+ document.addEventListener("pointerdown", () => {
4507
+ lastInteraction = "pointer";
4508
+ }, true);
4509
+ }
4510
+ /**
4511
+ * Whether a field was focused from the keyboard, as by Tab, rather than by a
4512
+ * click or tap. Spread `focusProps` onto the field, and style it by
4513
+ * `data-focus-visible`.
4514
+ */
4515
+ function useKeyboardFocus({
4516
+ onBlur,
4517
+ onFocus
4518
+ } = {}) {
4519
+ const [focusVisible, setFocusVisible] = React.useState(false);
4520
+ React.useEffect(listen, []);
4521
+ return {
4522
+ focusProps: {
4523
+ "data-focus-visible": focusVisible || undefined,
4524
+ onBlur: event => {
4525
+ setFocusVisible(false);
4526
+ onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
4527
+ },
4528
+ onFocus: event => {
4529
+ const keyboard = lastInteraction === "keyboard";
4530
+ setFocusVisible(keyboard);
4531
+ onFocus === null || onFocus === void 0 ? void 0 : onFocus(event, keyboard);
4532
+ }
4533
+ },
4534
+ focusVisible
4535
+ };
4536
+ }
4537
+
4538
+ var styles$g = {"tablist":"tablist-7ASvc","tab":"tab-dz8ki"};
4539
+
4540
+ // With this many tabs or more, only the selected tab shows its name, so they
4541
+ // all fit. Fewer always fit with their names.
4542
+ const ICON_ONLY_TAB_COUNT = 5;
4149
4543
  function ProductTabs({
4150
4544
  children,
4151
4545
  onKeyDown,
@@ -4156,6 +4550,7 @@ true;
4156
4550
  const id = useInstanceId("product-tabs");
4157
4551
  const tabId = slug => `${id}-tab-${slug}`;
4158
4552
  const tabRefs = React.useRef(new Map());
4553
+ const showAllNames = products.length < ICON_ONLY_TAB_COUNT;
4159
4554
  const handleKeyDown = event => {
4160
4555
  var _a;
4161
4556
  const offset = horizontalStep(event.key);
@@ -4170,13 +4565,14 @@ true;
4170
4565
  }
4171
4566
  };
4172
4567
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
4173
- "aria-label": "Product",
4568
+ "aria-label": "Search in",
4569
+ className: styles$g.tablist,
4174
4570
  onKeyDown: handleKeyDown,
4175
4571
  role: "tablist"
4176
- }, products.map(product => (/*#__PURE__*/React.createElement("button", {
4572
+ }, products.map(product => (/*#__PURE__*/React.createElement(Tab, {
4177
4573
  "aria-controls": `${id}-panel`,
4574
+ "aria-describedby": `${tabId(product.slug)}-description`,
4178
4575
  "aria-selected": product === selected,
4179
- className: styles$d.tab,
4180
4576
  id: tabId(product.slug),
4181
4577
  key: product.slug,
4182
4578
  onClick: () => onSelect(product.slug),
@@ -4187,15 +4583,397 @@ true;
4187
4583
  tabRefs.current.delete(product.slug);
4188
4584
  }
4189
4585
  },
4190
- role: "tab",
4191
- tabIndex: product === selected ? 0 : -1,
4192
- type: "button"
4193
- }, product.appName)))), /*#__PURE__*/React.createElement("div", {
4586
+ tabIndex: product === selected ? 0 : -1
4587
+ }, /*#__PURE__*/React.createElement(ProductIcon, {
4588
+ slug: product.slug
4589
+ }), showAllNames || product === selected ? product.appName : (/*#__PURE__*/React.createElement("span", {
4590
+ className: styles$k.visuallyHidden
4591
+ }, product.appName)))))), /*#__PURE__*/React.createElement("div", {
4592
+ className: styles$k.visuallyHidden
4593
+ }, products.map(product => (/*#__PURE__*/React.createElement("span", {
4594
+ id: `${tabId(product.slug)}-description`,
4595
+ key: product.slug
4596
+ }, "Planning Center ", product.appName)))), /*#__PURE__*/React.createElement("div", {
4194
4597
  "aria-labelledby": tabId(selected.slug),
4598
+ className: styles$k.panel,
4195
4599
  id: `${id}-panel`,
4196
4600
  role: "tabpanel"
4197
4601
  }, children));
4198
4602
  }
4603
+ // The modal's focus scope moves focus here by script when Tab is pressed, and
4604
+ // Safari doesn't match :focus-visible on focus moved by script. So the tab
4605
+ // remembers whether the keyboard brought focus, and the ring keys off that.
4606
+ const Tab = /*#__PURE__*/React.forwardRef(function Tab(props, ref) {
4607
+ const {
4608
+ focusProps
4609
+ } = useKeyboardFocus();
4610
+ return /*#__PURE__*/React.createElement("button", {
4611
+ className: styles$g.tab,
4612
+ ref: ref,
4613
+ role: "tab",
4614
+ type: "button",
4615
+ ...props,
4616
+ ...focusProps
4617
+ });
4618
+ });
4619
+
4620
+ function BlankStateRecentlyVisited(props) {
4621
+ const id = useInstanceId("blank-state-initial");
4622
+ return /*#__PURE__*/React.createElement("svg", {
4623
+ viewBox: "0 0 197 174",
4624
+ fill: "none",
4625
+ "aria-hidden": "true",
4626
+ focusable: "false",
4627
+ ...props
4628
+ }, /*#__PURE__*/React.createElement("path", {
4629
+ d: "M139.863 32.119c10.938 10.028 21.777 20.154 32.912 30.084 8.376 7.373 21.975 15.828 23.157 28.02.592 6.095-2.167 11.993-5.321 17.204-24.635 40.8-81.098 67.148-127.412 48.862-30.646-12.093-76.172-47.387-59.716-85.041 15.865-36.377 64.84-55.056 83.957-57.71 21.876-4.621 34.883 2.457 52.423 18.58Z",
4630
+ fill: "currentColor"
4631
+ }), /*#__PURE__*/React.createElement("g", {
4632
+ clipPath: `url(#${id}-a)`
4633
+ }, /*#__PURE__*/React.createElement("path", {
4634
+ d: "M115.885 109.31c-.478-.686-.01-1.845 1.046-2.589s2.3-.791 2.778-.105c.478.686.009 1.845-1.047 2.589-1.056.744-2.299.791-2.777.105Z",
4635
+ fill: "#333"
4636
+ }), /*#__PURE__*/React.createElement("path", {
4637
+ d: "M123.403 113.599c-3.456 0-6.259-2.817-6.259-6.293 0-3.475 2.803-6.293 6.259-6.293 3.457 0 6.259 2.818 6.259 6.293 0 3.476-2.802 6.293-6.259 6.293Z",
4638
+ fill: "#333"
4639
+ }), /*#__PURE__*/React.createElement("path", {
4640
+ d: "M118.853 100.968a2.85 2.85 0 0 0 2.832-2.484 2.89 2.89 0 0 0-.071-1.115c-2.638-9.955-9.668-9.687-9.964-9.665l.311 5.716h-.104c.119 0 2.853.134 4.254 5.421a2.874 2.874 0 0 0 1.013 1.53 2.846 2.846 0 0 0 1.729.597Z",
4641
+ fill: "#4D4D4D"
4642
+ }), /*#__PURE__*/React.createElement("path", {
4643
+ d: "M114.96 100.503c-.462-5.894 2.796-10.96 7.279-11.315 4.482-.356 8.491 4.134 8.953 10.027.462 5.894-2.796 10.96-7.279 11.315-4.482.356-8.491-4.134-8.953-10.027Z",
4644
+ fill: "#F2F2F2"
4645
+ }), /*#__PURE__*/React.createElement("path", {
4646
+ d: "M125.964 107.738c-4.48.354-8.489-4.135-8.953-10.026a12.893 12.893 0 0 1 1.223-6.707c-2.249 2.046-3.591 5.59-3.283 9.505.463 5.895 4.469 10.384 8.953 10.027 2.594-.205 4.765-1.986 6.055-4.591a6.682 6.682 0 0 1-3.995 1.792Z",
4647
+ fill: "#E6E6E6"
4648
+ }), /*#__PURE__*/React.createElement("path", {
4649
+ d: "M115.885 109.31c-.478-.686-.01-1.845 1.046-2.589s2.3-.791 2.778-.105c.478.686.009 1.845-1.047 2.589-1.056.744-2.299.791-2.777.105Z",
4650
+ fill: "#333"
4651
+ }), /*#__PURE__*/React.createElement("path", {
4652
+ d: "M123.403 113.599c-3.456 0-6.259-2.817-6.259-6.293 0-3.475 2.803-6.293 6.259-6.293 3.457 0 6.259 2.818 6.259 6.293 0 3.476-2.802 6.293-6.259 6.293Z",
4653
+ fill: "#333"
4654
+ }), /*#__PURE__*/React.createElement("path", {
4655
+ d: "M118.853 100.968a2.85 2.85 0 0 0 2.832-2.484 2.89 2.89 0 0 0-.071-1.115c-2.638-9.955-9.668-9.687-9.964-9.665l.311 5.716h-.104c.119 0 2.853.134 4.254 5.421a2.874 2.874 0 0 0 1.013 1.53 2.846 2.846 0 0 0 1.729.597Z",
4656
+ fill: "#4D4D4D"
4657
+ }), /*#__PURE__*/React.createElement("path", {
4658
+ d: "M114.96 100.503c-.462-5.894 2.796-10.96 7.279-11.315 4.482-.356 8.491 4.134 8.953 10.027.462 5.894-2.796 10.96-7.279 11.315-4.482.356-8.491-4.134-8.953-10.027Z",
4659
+ fill: "#F2F2F2"
4660
+ }), /*#__PURE__*/React.createElement("path", {
4661
+ d: "M125.964 107.738c-4.48.354-8.489-4.135-8.953-10.026a12.893 12.893 0 0 1 1.223-6.707c-2.249 2.046-3.591 5.59-3.283 9.505.463 5.895 4.469 10.384 8.953 10.027 2.594-.205 4.765-1.986 6.055-4.591a6.682 6.682 0 0 1-3.995 1.792Z",
4662
+ fill: "#E6E6E6"
4663
+ }), /*#__PURE__*/React.createElement("path", {
4664
+ d: "M89.317 121.331a2.836 2.836 0 0 1-1.92-.752 2.869 2.869 0 0 1-.911-1.857c-.534-5.726 3.527-13.808 3.99-14.713a2.849 2.849 0 0 1 1.666-1.413 2.835 2.835 0 0 1 2.172.185 2.86 2.86 0 0 1 1.405 1.675 2.876 2.876 0 0 1-.184 2.183c-1.46 2.843-3.669 8.492-3.383 11.551a2.868 2.868 0 0 1-1.504 2.797 2.84 2.84 0 0 1-1.064.318 1.378 1.378 0 0 1-.267.026Z",
4665
+ fill: "#4D4D4D"
4666
+ }), /*#__PURE__*/React.createElement("path", {
4667
+ d: "M92.155 112.314c3.308 0 5.989-2.696 5.989-6.021 0-3.326-2.681-6.021-5.989-6.021-3.307 0-5.988 2.695-5.988 6.021 0 3.325 2.681 6.021 5.988 6.021Z",
4668
+ fill: "gray"
4669
+ }), /*#__PURE__*/React.createElement("path", {
4670
+ d: "M80.597 128.771h11.769v3.726a1.118 1.118 0 0 1-1.112 1.118H78.57a1.118 1.118 0 0 1-1.112-1.118v-.566c0-.841.332-1.648.924-2.242a3.144 3.144 0 0 1 2.23-.929l-.015.011Z",
4671
+ fill: "#333"
4672
+ }), /*#__PURE__*/React.createElement("path", {
4673
+ d: "M89.572 132.084s8.075.119 6.3-8.268c-1.775-8.387-12.188-15.351-15.234-6.066-3.046 9.285-1.386 15.232 8.934 14.334Z",
4674
+ fill: "#F2F2F2"
4675
+ }), /*#__PURE__*/React.createElement("path", {
4676
+ d: "M106.67 121.334h-.27a2.84 2.84 0 0 1-1.925-1.025 2.872 2.872 0 0 1-.639-2.093c.285-3.059-1.92-8.708-3.38-11.551a2.873 2.873 0 0 1 1.296-3.721 2.832 2.832 0 0 1 2.102-.199 2.848 2.848 0 0 1 1.66 1.312c.463.906 4.521 8.991 3.988 14.714a2.874 2.874 0 0 1-.926 1.828 2.832 2.832 0 0 1-1.906.735Z",
4677
+ fill: "#4D4D4D"
4678
+ }), /*#__PURE__*/React.createElement("path", {
4679
+ d: "M103.835 112.314c3.307 0 5.988-2.696 5.988-6.021 0-3.326-2.681-6.021-5.988-6.021-3.307 0-5.988 2.695-5.988 6.021 0 3.325 2.681 6.021 5.988 6.021Z",
4680
+ fill: "gray"
4681
+ }), /*#__PURE__*/React.createElement("path", {
4682
+ d: "m117.408 133.652-12.674-.002c-.295 0-.577-.118-.786-.328a1.121 1.121 0 0 1-.325-.79v-3.726l11.773.002c.837 0 1.639.334 2.23.929s.923 1.401.923 2.242v.567a1.116 1.116 0 0 1-1.141 1.106Z",
4683
+ fill: "#333"
4684
+ }), /*#__PURE__*/React.createElement("path", {
4685
+ d: "M106.414 132.084s-8.075.119-6.318-8.268c1.756-8.387 12.195-15.343 15.237-6.062 3.043 9.281 1.405 15.235-8.919 14.33Z",
4686
+ fill: "#F2F2F2"
4687
+ }), /*#__PURE__*/React.createElement("path", {
4688
+ d: "M109.107 94.58a2.305 2.305 0 0 0 2.191 2.412 2.302 2.302 0 0 0 2.399-2.202l.333-7.33a2.306 2.306 0 0 0-2.191-2.412 2.303 2.303 0 0 0-2.4 2.203l-.332 7.328Z",
4689
+ fill: "gray"
4690
+ }), /*#__PURE__*/React.createElement("path", {
4691
+ d: "M80.968 109.31c.478-.686.01-1.845-1.047-2.589-1.056-.744-2.3-.791-2.777-.105-.478.686-.01 1.845 1.046 2.589s2.3.791 2.778.105Z",
4692
+ fill: "#333"
4693
+ }), /*#__PURE__*/React.createElement("path", {
4694
+ d: "M73.448 113.599c3.457 0 6.26-2.817 6.26-6.293 0-3.475-2.803-6.293-6.26-6.293-3.456 0-6.258 2.818-6.258 6.293 0 3.476 2.802 6.293 6.258 6.293Z",
4695
+ fill: "#333"
4696
+ }), /*#__PURE__*/React.createElement("path", {
4697
+ d: "M78 100.968a2.853 2.853 0 0 1-2.832-2.484 2.876 2.876 0 0 1 .07-1.115c2.639-9.955 9.669-9.687 9.965-9.665l-.311 5.716h.104c-.12 0-2.854.134-4.255 5.421a2.87 2.87 0 0 1-1.013 1.53 2.845 2.845 0 0 1-1.729.597Z",
4698
+ fill: "#4D4D4D"
4699
+ }), /*#__PURE__*/React.createElement("path", {
4700
+ d: "M87.37 88.17a2.305 2.305 0 0 0-2.19-2.413 2.302 2.302 0 0 0-2.4 2.202l-.332 7.329a2.305 2.305 0 0 0 2.19 2.413 2.302 2.302 0 0 0 2.4-2.203l.332-7.328Z",
4701
+ fill: "gray"
4702
+ }), /*#__PURE__*/React.createElement("path", {
4703
+ d: "M81.893 100.503c.462-5.894-2.797-10.96-7.28-11.315-4.482-.356-8.49 4.134-8.953 10.027-.462 5.894 2.797 10.96 7.28 11.315 4.482.356 8.49-4.134 8.953-10.027Z",
4704
+ fill: "#F2F2F2"
4705
+ }), /*#__PURE__*/React.createElement("path", {
4706
+ d: "M70.888 107.738c4.48.354 8.49-4.135 8.953-10.026a12.89 12.89 0 0 0-1.223-6.707c2.25 2.046 3.591 5.59 3.284 9.505-.464 5.895-4.47 10.384-8.953 10.027-2.594-.205-4.766-1.986-6.055-4.591a6.682 6.682 0 0 0 3.994 1.792Z",
4707
+ fill: "#E6E6E6"
4708
+ }), /*#__PURE__*/React.createElement("path", {
4709
+ d: "M112.717 94.105c-.511-9.095-7.459-11.703-15.82-11.226-8.36.477-14.97 3.856-14.451 12.951.518 9.095 7.707 16.081 16.067 15.605 8.36-.477 14.719-8.231 14.204-17.33Z",
4710
+ fill: "#F2F2F2"
4711
+ }), /*#__PURE__*/React.createElement("path", {
4712
+ d: "M112.565 92.656c-1.056 7.496-6.799 13.413-14.059 13.812-7.852.451-14.67-5.686-15.897-13.965a14.571 14.571 0 0 0-.17 3.327c.51 9.095 7.704 16.081 16.067 15.605 8.364-.477 14.723-8.235 14.211-17.33a16.83 16.83 0 0 0-.152-1.45Z",
4713
+ fill: "#E6E6E6"
4714
+ }), /*#__PURE__*/React.createElement("path", {
4715
+ d: "M103.546 90.353H91.61a.62.62 0 0 0-.619.623v1.762a.62.62 0 0 0 .62.622h11.935a.62.62 0 0 0 .619-.622v-1.762a.62.62 0 0 0-.619-.623Zm0 5.187H91.61a.62.62 0 0 0-.619.622v1.762a.62.62 0 0 0 .62.623h11.935a.62.62 0 0 0 .619-.623v-1.762a.62.62 0 0 0-.619-.622Zm-.004 5.19H91.606a.62.62 0 0 0-.619.622v1.763a.62.62 0 0 0 .62.622h11.935a.62.62 0 0 0 .619-.622v-1.763a.62.62 0 0 0-.619-.622Z",
4716
+ fill: "#3690EA"
4717
+ }), /*#__PURE__*/React.createElement("path", {
4718
+ d: "M89.317 121.331a2.836 2.836 0 0 1-1.92-.752 2.869 2.869 0 0 1-.911-1.857c-.534-5.726 3.527-13.808 3.99-14.713a2.849 2.849 0 0 1 1.666-1.413 2.835 2.835 0 0 1 2.172.185 2.86 2.86 0 0 1 1.405 1.675 2.876 2.876 0 0 1-.184 2.183c-1.46 2.843-3.669 8.492-3.383 11.551a2.868 2.868 0 0 1-1.504 2.797 2.84 2.84 0 0 1-1.064.318 1.378 1.378 0 0 1-.267.026Z",
4719
+ fill: "#4D4D4D"
4720
+ }), /*#__PURE__*/React.createElement("path", {
4721
+ d: "M92.155 112.314c3.308 0 5.989-2.696 5.989-6.021 0-3.326-2.681-6.021-5.989-6.021-3.307 0-5.988 2.695-5.988 6.021 0 3.325 2.681 6.021 5.988 6.021Z",
4722
+ fill: "gray"
4723
+ }), /*#__PURE__*/React.createElement("path", {
4724
+ d: "M80.597 128.771h11.769v3.726a1.118 1.118 0 0 1-1.112 1.118H78.57a1.118 1.118 0 0 1-1.112-1.118v-.566c0-.841.332-1.648.924-2.242a3.144 3.144 0 0 1 2.23-.929l-.015.011Z",
4725
+ fill: "#333"
4726
+ }), /*#__PURE__*/React.createElement("path", {
4727
+ d: "M89.572 132.084s8.075.119 6.3-8.268c-1.775-8.387-12.188-15.351-15.234-6.066-3.046 9.285-1.386 15.232 8.934 14.334Z",
4728
+ fill: "#F2F2F2"
4729
+ }), /*#__PURE__*/React.createElement("path", {
4730
+ d: "M106.67 121.334h-.27a2.84 2.84 0 0 1-1.925-1.025 2.872 2.872 0 0 1-.639-2.093c.285-3.059-1.92-8.708-3.38-11.551a2.873 2.873 0 0 1 1.296-3.721 2.832 2.832 0 0 1 2.102-.199 2.848 2.848 0 0 1 1.66 1.312c.463.906 4.521 8.991 3.988 14.714a2.874 2.874 0 0 1-.926 1.828 2.832 2.832 0 0 1-1.906.735Z",
4731
+ fill: "#4D4D4D"
4732
+ }), /*#__PURE__*/React.createElement("path", {
4733
+ d: "M103.835 112.314c3.307 0 5.988-2.696 5.988-6.021 0-3.326-2.681-6.021-5.988-6.021-3.307 0-5.988 2.695-5.988 6.021 0 3.325 2.681 6.021 5.988 6.021Z",
4734
+ fill: "gray"
4735
+ }), /*#__PURE__*/React.createElement("path", {
4736
+ d: "m117.408 133.652-12.674-.002c-.295 0-.577-.118-.786-.328a1.121 1.121 0 0 1-.325-.79v-3.726l11.773.002c.837 0 1.639.334 2.23.929s.923 1.401.923 2.242v.567a1.116 1.116 0 0 1-1.141 1.106Z",
4737
+ fill: "#333"
4738
+ }), /*#__PURE__*/React.createElement("path", {
4739
+ d: "M106.414 132.084s-8.075.119-6.318-8.268c1.756-8.387 12.195-15.343 15.237-6.062 3.043 9.281 1.405 15.235-8.919 14.33Z",
4740
+ fill: "#F2F2F2"
4741
+ }), /*#__PURE__*/React.createElement("path", {
4742
+ d: "M109.107 94.58a2.305 2.305 0 0 0 2.191 2.412 2.302 2.302 0 0 0 2.399-2.202l.333-7.33a2.306 2.306 0 0 0-2.191-2.412 2.303 2.303 0 0 0-2.4 2.203l-.332 7.328Z",
4743
+ fill: "gray"
4744
+ }), /*#__PURE__*/React.createElement("path", {
4745
+ d: "M80.968 109.31c.478-.686.01-1.845-1.047-2.589-1.056-.744-2.3-.791-2.777-.105-.478.686-.01 1.845 1.046 2.589s2.3.791 2.778.105Z",
4746
+ fill: "#333"
4747
+ }), /*#__PURE__*/React.createElement("path", {
4748
+ d: "M73.448 113.599c3.457 0 6.26-2.817 6.26-6.293 0-3.475-2.803-6.293-6.26-6.293-3.456 0-6.258 2.818-6.258 6.293 0 3.476 2.802 6.293 6.258 6.293Z",
4749
+ fill: "#333"
4750
+ }), /*#__PURE__*/React.createElement("path", {
4751
+ d: "M78 100.968a2.853 2.853 0 0 1-2.832-2.484 2.876 2.876 0 0 1 .07-1.115c2.639-9.955 9.669-9.687 9.965-9.665l-.311 5.716h.104c-.12 0-2.854.134-4.255 5.421a2.87 2.87 0 0 1-1.013 1.53 2.845 2.845 0 0 1-1.729.597Z",
4752
+ fill: "#4D4D4D"
4753
+ }), /*#__PURE__*/React.createElement("path", {
4754
+ d: "M87.37 88.17a2.305 2.305 0 0 0-2.19-2.413 2.302 2.302 0 0 0-2.4 2.202l-.332 7.329a2.305 2.305 0 0 0 2.19 2.413 2.302 2.302 0 0 0 2.4-2.203l.332-7.328Z",
4755
+ fill: "gray"
4756
+ }), /*#__PURE__*/React.createElement("path", {
4757
+ d: "M81.893 100.503c.462-5.894-2.797-10.96-7.28-11.315-4.482-.356-8.49 4.134-8.953 10.027-.462 5.894 2.797 10.96 7.28 11.315 4.482.356 8.49-4.134 8.953-10.027Z",
4758
+ fill: "#F2F2F2"
4759
+ }), /*#__PURE__*/React.createElement("path", {
4760
+ d: "M70.888 107.738c4.48.354 8.49-4.135 8.953-10.026a12.89 12.89 0 0 0-1.223-6.707c2.25 2.046 3.591 5.59 3.284 9.505-.464 5.895-4.47 10.384-8.953 10.027-2.594-.205-4.766-1.986-6.055-4.591a6.682 6.682 0 0 0 3.994 1.792Z",
4761
+ fill: "#E6E6E6"
4762
+ }), /*#__PURE__*/React.createElement("path", {
4763
+ d: "M112.717 94.105c-.511-9.095-7.459-11.703-15.82-11.226-8.36.477-14.97 3.856-14.451 12.951.518 9.095 7.707 16.081 16.067 15.605 8.36-.477 14.719-8.231 14.204-17.33Z",
4764
+ fill: "#F2F2F2"
4765
+ }), /*#__PURE__*/React.createElement("path", {
4766
+ d: "M112.565 92.656c-1.056 7.496-6.799 13.413-14.059 13.812-7.852.451-14.67-5.686-15.897-13.965a14.571 14.571 0 0 0-.17 3.327c.51 9.095 7.704 16.081 16.067 15.605 8.364-.477 14.723-8.235 14.211-17.33a16.83 16.83 0 0 0-.152-1.45Z",
4767
+ fill: "#E6E6E6"
4768
+ }), /*#__PURE__*/React.createElement("path", {
4769
+ d: "M94.626 78.445c-.114-.488 6.548-.927 5.815.246v.775c0 .746.033 1.49.033 2.258s.037 1.595.044 2.392c.278.593-6.473.935-5.817-.115v-.67c-.015-1.63-.06-3.257-.075-4.886Z",
4770
+ fill: "#999"
4771
+ }), /*#__PURE__*/React.createElement("path", {
4772
+ d: "M103.546 90.353H91.61a.62.62 0 0 0-.619.623v1.762a.62.62 0 0 0 .62.622h11.935a.62.62 0 0 0 .619-.622v-1.762a.62.62 0 0 0-.619-.623Zm0 5.187H91.61a.62.62 0 0 0-.619.622v1.762a.62.62 0 0 0 .62.623h11.935a.62.62 0 0 0 .619-.623v-1.762a.62.62 0 0 0-.619-.622Zm-.004 5.19H91.606a.62.62 0 0 0-.619.622v1.763a.62.62 0 0 0 .62.622h11.935a.62.62 0 0 0 .619-.622v-1.763a.62.62 0 0 0-.619-.622ZM55.773 64.004c4.349 0 7.874-5.285 7.874-11.804s-3.525-11.804-7.874-11.804-7.875 5.285-7.875 11.804c0 6.52 3.526 11.804 7.875 11.804Zm84.17.015c4.349 0 7.874-5.285 7.874-11.804 0-6.52-3.525-11.804-7.874-11.804s-7.875 5.285-7.875 11.804 3.526 11.804 7.875 11.804Z",
4773
+ fill: "#3690EA"
4774
+ }), /*#__PURE__*/React.createElement("path", {
4775
+ d: "M97.962 29.036c7.273 0 13.17-2.224 13.17-4.967 0-2.743-5.897-4.966-13.17-4.966-7.274 0-13.17 2.223-13.17 4.966 0 2.743 5.896 4.967 13.17 4.967Z",
4776
+ fill: "#B3B3B3"
4777
+ }), /*#__PURE__*/React.createElement("path", {
4778
+ d: "M97.962 16.55c4.545 0 8.23-3.705 8.23-8.275S102.507 0 97.962 0c-4.546 0-8.23 3.705-8.23 8.275s3.684 8.275 8.23 8.275Z",
4779
+ fill: "#3690EA"
4780
+ }), /*#__PURE__*/React.createElement("path", {
4781
+ d: "M141.607 59.283V45.147a19.038 19.038 0 0 0-3.687-11.301 18.872 18.872 0 0 0-9.653-6.874c-8.838-2.69-19.203-4.24-30.29-4.244-11.088-.004-21.452 1.546-30.29 4.233a18.871 18.871 0 0 0-9.668 6.866 19.041 19.041 0 0 0-3.699 11.305v14.132a19.03 19.03 0 0 0 3.685 11.303 18.86 18.86 0 0 0 9.656 6.872c8.841 2.694 19.206 4.244 30.29 4.244 11.083 0 21.452-1.542 30.294-4.233a18.858 18.858 0 0 0 9.666-6.863 19.028 19.028 0 0 0 3.696-11.304Z",
4782
+ fill: "#F2F2F2"
4783
+ }), /*#__PURE__*/React.createElement("path", {
4784
+ d: "M97.954 75.051c-10.068 0-19.88-1.371-28.381-3.957a12.353 12.353 0 0 1-6.262-4.485 12.463 12.463 0 0 1-2.41-7.34V45.131c.006-2.642.85-5.214 2.411-7.34a12.345 12.345 0 0 1 6.264-4.482c8.501-2.586 18.317-3.95 28.382-3.95 10.065 0 19.877 1.371 28.382 3.96a12.35 12.35 0 0 1 6.262 4.486 12.46 12.46 0 0 1 2.409 7.34V59.28a12.453 12.453 0 0 1-2.41 7.341 12.343 12.343 0 0 1-6.265 4.482c-8.486 2.585-18.317 3.949-28.382 3.949Z",
4785
+ fill: "#E6E6E6"
4786
+ }), /*#__PURE__*/React.createElement("path", {
4787
+ d: "M100.863 15.992h-5.81v1.293h5.81v-1.293Z",
4788
+ fill: "#F2F2F2"
4789
+ }), /*#__PURE__*/React.createElement("path", {
4790
+ d: "M76.472 66.05c4.327 0 7.834-6.2 7.834-13.846 0-7.647-3.507-13.846-7.834-13.846-4.326 0-7.833 6.2-7.833 13.846s3.507 13.845 7.833 13.845Z",
4791
+ fill: "#1A1A1A"
4792
+ }), /*#__PURE__*/React.createElement("path", {
4793
+ d: "M77.844 52.766c1.743 0 3.157-2.088 3.157-4.664 0-2.577-1.414-4.665-3.157-4.665-1.744 0-3.157 2.088-3.157 4.665 0 2.576 1.413 4.664 3.157 4.664Z",
4794
+ fill: "#fff"
4795
+ }), /*#__PURE__*/React.createElement("path", {
4796
+ d: "M118.662 66.057c4.326 0 7.834-6.2 7.834-13.846s-3.508-13.845-7.834-13.845c-4.327 0-7.834 6.199-7.834 13.845 0 7.647 3.507 13.846 7.834 13.846Z",
4797
+ fill: "#1A1A1A"
4798
+ }), /*#__PURE__*/React.createElement("path", {
4799
+ d: "M120.032 52.774c1.744 0 3.157-2.089 3.157-4.665s-1.413-4.665-3.157-4.665c-1.743 0-3.157 2.089-3.157 4.665s1.414 4.665 3.157 4.665Z",
4800
+ fill: "#fff"
4801
+ }), /*#__PURE__*/React.createElement("path", {
4802
+ d: "M92.674 63.11a10.286 10.286 0 0 0 7.949 1.095 13.2 13.2 0 0 0 2.623-1.118.738.738 0 0 1 1.035.639.748.748 0 0 1-.119.453c-2.224 2.82-6.474 3.625-9.672 2.12a7.284 7.284 0 0 1-2.75-2.12.748.748 0 0 1 .465-1.139.738.738 0 0 1 .469.054v.015Z",
4803
+ fill: "#999"
4804
+ }), /*#__PURE__*/React.createElement("path", {
4805
+ d: "M55.773 64.004c4.349 0 7.874-5.285 7.874-11.804s-3.525-11.804-7.874-11.804-7.875 5.285-7.875 11.804c0 6.52 3.526 11.804 7.875 11.804Zm84.17.015c4.349 0 7.874-5.285 7.874-11.804 0-6.52-3.525-11.804-7.874-11.804s-7.875 5.285-7.875 11.804 3.526 11.804 7.875 11.804Z",
4806
+ fill: "#3690EA"
4807
+ }), /*#__PURE__*/React.createElement("path", {
4808
+ d: "M95.008 14.315c-.115-.488 6.548-.932 5.815.246v.771c0 .745.033 1.51.037 2.262.003.752.033 1.594.04 2.392.282.592-6.474.935-5.818-.116v-.67c-.014-1.629-.055-3.257-.074-4.885Z",
4809
+ fill: "#F2F2F2"
4810
+ }), /*#__PURE__*/React.createElement("path", {
4811
+ d: "M97.962 29.036c7.273 0 13.17-2.224 13.17-4.967 0-2.743-5.897-4.966-13.17-4.966-7.274 0-13.17 2.223-13.17 4.966 0 2.743 5.896 4.967 13.17 4.967Z",
4812
+ fill: "#B3B3B3"
4813
+ }), /*#__PURE__*/React.createElement("path", {
4814
+ d: "M97.962 16.55c4.545 0 8.23-3.705 8.23-8.275S102.507 0 97.962 0c-4.546 0-8.23 3.705-8.23 8.275s3.684 8.275 8.23 8.275Z",
4815
+ fill: "#3690EA"
4816
+ }), /*#__PURE__*/React.createElement("path", {
4817
+ d: "M141.607 59.283V45.147a19.038 19.038 0 0 0-3.687-11.301 18.872 18.872 0 0 0-9.653-6.874c-8.838-2.69-19.203-4.24-30.29-4.244-11.088-.004-21.452 1.546-30.29 4.233a18.871 18.871 0 0 0-9.668 6.866 19.041 19.041 0 0 0-3.699 11.305v14.132a19.03 19.03 0 0 0 3.685 11.303 18.86 18.86 0 0 0 9.656 6.872c8.841 2.694 19.206 4.244 30.29 4.244 11.083 0 21.452-1.542 30.294-4.233a18.858 18.858 0 0 0 9.666-6.863 19.028 19.028 0 0 0 3.696-11.304Z",
4818
+ fill: "#F2F2F2"
4819
+ }), /*#__PURE__*/React.createElement("path", {
4820
+ d: "M97.954 75.051c-10.068 0-19.88-1.371-28.381-3.957a12.353 12.353 0 0 1-6.262-4.485 12.463 12.463 0 0 1-2.41-7.34V45.131c.006-2.642.85-5.214 2.411-7.34a12.345 12.345 0 0 1 6.264-4.482c8.501-2.586 18.317-3.95 28.382-3.95 10.065 0 19.877 1.371 28.382 3.96a12.35 12.35 0 0 1 6.262 4.486 12.46 12.46 0 0 1 2.409 7.34V59.28a12.453 12.453 0 0 1-2.41 7.341 12.343 12.343 0 0 1-6.265 4.482c-8.486 2.585-18.317 3.949-28.382 3.949Zm2.909-59.059h-5.81v1.293h5.81v-1.293Z",
4821
+ fill: "#E6E6E6"
4822
+ }), /*#__PURE__*/React.createElement("path", {
4823
+ d: "M76.472 66.05c4.327 0 7.834-6.2 7.834-13.846 0-7.647-3.507-13.846-7.834-13.846-4.326 0-7.833 6.2-7.833 13.846s3.507 13.845 7.833 13.845Z",
4824
+ fill: "#1A1A1A"
4825
+ }), /*#__PURE__*/React.createElement("path", {
4826
+ d: "M77.844 52.766c1.743 0 3.157-2.088 3.157-4.664 0-2.577-1.414-4.665-3.157-4.665-1.744 0-3.157 2.088-3.157 4.665 0 2.576 1.413 4.664 3.157 4.664Z",
4827
+ fill: "#fff"
4828
+ }), /*#__PURE__*/React.createElement("path", {
4829
+ d: "M118.662 66.057c4.326 0 7.834-6.2 7.834-13.846s-3.508-13.845-7.834-13.845c-4.327 0-7.834 6.199-7.834 13.845 0 7.647 3.507 13.846 7.834 13.846Z",
4830
+ fill: "#1A1A1A"
4831
+ }), /*#__PURE__*/React.createElement("path", {
4832
+ d: "M120.032 52.774c1.744 0 3.157-2.089 3.157-4.665s-1.413-4.665-3.157-4.665c-1.743 0-3.157 2.089-3.157 4.665s1.414 4.665 3.157 4.665Z",
4833
+ fill: "#fff"
4834
+ }), /*#__PURE__*/React.createElement("path", {
4835
+ d: "M92.674 63.11a10.286 10.286 0 0 0 7.949 1.095 13.2 13.2 0 0 0 2.623-1.118.738.738 0 0 1 1.035.639.748.748 0 0 1-.119.453c-2.224 2.82-6.474 3.625-9.672 2.12a7.284 7.284 0 0 1-2.75-2.12.748.748 0 0 1 .465-1.139.738.738 0 0 1 .469.054v.015Z",
4836
+ fill: "#999"
4837
+ }), /*#__PURE__*/React.createElement("path", {
4838
+ d: "M101.117 9.562a3.035 3.035 0 0 0 3.027-3.043 3.035 3.035 0 0 0-3.027-3.043A3.035 3.035 0 0 0 98.09 6.52a3.035 3.035 0 0 0 3.027 3.043ZM51.578 54.84c.801 0 1.45-1.64 1.45-3.66 0-2.023-.649-3.662-1.45-3.662-.802 0-1.451 1.64-1.451 3.661 0 2.022.65 3.66 1.45 3.66Zm93.429 0c.802 0 1.451-1.64 1.451-3.66 0-2.023-.649-3.662-1.451-3.662-.801 0-1.45 1.64-1.45 3.661 0 2.022.649 3.66 1.45 3.66Z",
4839
+ fill: "#4BAAF7"
4840
+ }), /*#__PURE__*/React.createElement("g", {
4841
+ clipPath: `url(#${id}-b)`
4842
+ }, /*#__PURE__*/React.createElement("path", {
4843
+ d: "M52.39 160.841h-2.919a1.774 1.774 0 0 1-1.766-1.782v-7.334h9.035l-2.677 7.911a1.766 1.766 0 0 1-1.671 1.206l-.001-.001Zm91.774 0h2.919c.977 0 1.767-.799 1.767-1.782v-7.334h-9.036l2.677 7.911a1.767 1.767 0 0 0 1.672 1.206l.001-.001Z",
4844
+ fill: "#6D4932"
4845
+ }), /*#__PURE__*/React.createElement("path", {
4846
+ d: "M163.181 108.015H33.375c-2.37 0-4.291 1.479-4.291 3.305v2.216c0 1.825 1.921 3.305 4.29 3.305h129.807c2.369 0 4.29-1.48 4.29-3.305v-2.216c0-1.826-1.921-3.305-4.29-3.305Z",
4847
+ fill: "#A87B5D"
4848
+ }), /*#__PURE__*/React.createElement("path", {
4849
+ d: "M38.282 116.841h119.992v33.16c0 1.648-1.554 2.985-3.469 2.985H41.752c-1.915 0-3.468-1.337-3.468-2.985v-33.16h-.002Z",
4850
+ fill: "#916A50"
4851
+ }), /*#__PURE__*/React.createElement("path", {
4852
+ opacity: ".3",
4853
+ d: "M131.002 109.794h-97.18a.996.996 0 0 0-.992 1.001c0 .552.444 1 .992 1h97.18a.996.996 0 0 0 .991-1 .996.996 0 0 0-.991-1.001Zm30.849 0h-24.24a.996.996 0 0 0-.992 1.001c0 .552.444 1 .992 1h24.24a.996.996 0 0 0 .992-1 .996.996 0 0 0-.992-1.001Z",
4854
+ fill: "#D4B097"
4855
+ })), /*#__PURE__*/React.createElement("g", {
4856
+ clipPath: `url(#${id}-c)`
4857
+ }, /*#__PURE__*/React.createElement("path", {
4858
+ d: "M151.367 97.536h2.894c1.6 0 2.895 1.307 2.895 2.913a2.906 2.906 0 0 1-2.895 2.914h-2.894v-5.827Z",
4859
+ strokeWidth: "6",
4860
+ strokeMiterlimit: "10",
4861
+ stroke: `url(#${id}-d)`
4862
+ }), /*#__PURE__*/React.createElement("path", {
4863
+ d: "M135.876 93.304h17.017a.6.6 0 0 1 .597.602v10.166c0 1.942-1.566 3.522-3.499 3.522h-11.214c-1.933 0-3.499-1.58-3.499-3.522V93.906a.6.6 0 0 1 .598-.602Z",
4864
+ fill: `url(#${id}-e)`
4865
+ })), /*#__PURE__*/React.createElement("path", {
4866
+ d: "m37.492 78.174 38.863-6.725a3.453 3.453 0 0 1 3.455 3.45v30.087H34.04V81.623a3.452 3.452 0 0 1 3.452-3.45Z",
4867
+ fill: `url(#${id}-f)`
4868
+ }), /*#__PURE__*/React.createElement("path", {
4869
+ d: "M34.1 108.015v-3.363h57.697v3.363H34.1Z",
4870
+ fill: `url(#${id}-g)`
4871
+ }), /*#__PURE__*/React.createElement("path", {
4872
+ d: "M79.673 108.015v-3.363h12.124v3.363H79.673Z",
4873
+ fill: `url(#${id}-h)`
4874
+ })), /*#__PURE__*/React.createElement("defs", null, /*#__PURE__*/React.createElement("linearGradient", {
4875
+ id: `${id}-d`,
4876
+ x1: "150.254",
4877
+ y1: "100.449",
4878
+ x2: "158.273",
4879
+ y2: "100.449",
4880
+ gradientUnits: "userSpaceOnUse"
4881
+ }, /*#__PURE__*/React.createElement("stop", {
4882
+ stopColor: "#FEFEFE"
4883
+ }), /*#__PURE__*/React.createElement("stop", {
4884
+ offset: "1",
4885
+ stopColor: "#fff"
4886
+ })), /*#__PURE__*/React.createElement("linearGradient", {
4887
+ id: `${id}-e`,
4888
+ x1: "132.629",
4889
+ y1: "100.449",
4890
+ x2: "155.32",
4891
+ y2: "100.449",
4892
+ gradientUnits: "userSpaceOnUse"
4893
+ }, /*#__PURE__*/React.createElement("stop", {
4894
+ stopColor: "#FEFEFE"
4895
+ }), /*#__PURE__*/React.createElement("stop", {
4896
+ offset: "1",
4897
+ stopColor: "#F3F3F3"
4898
+ })), /*#__PURE__*/React.createElement("linearGradient", {
4899
+ id: `${id}-f`,
4900
+ x1: "56.925",
4901
+ y1: "45.291",
4902
+ x2: "56.925",
4903
+ y2: "93.076",
4904
+ gradientUnits: "userSpaceOnUse"
4905
+ }, /*#__PURE__*/React.createElement("stop", {
4906
+ stopColor: "#FEFEFE"
4907
+ }), /*#__PURE__*/React.createElement("stop", {
4908
+ offset: "1",
4909
+ stopColor: "#D1D6E7"
4910
+ })), /*#__PURE__*/React.createElement("linearGradient", {
4911
+ id: `${id}-g`,
4912
+ x1: "62.684",
4913
+ y1: "108.015",
4914
+ x2: "62.684",
4915
+ y2: "104.85",
4916
+ gradientUnits: "userSpaceOnUse"
4917
+ }, /*#__PURE__*/React.createElement("stop", {
4918
+ stopColor: "#D2D6E8"
4919
+ }), /*#__PURE__*/React.createElement("stop", {
4920
+ offset: ".726",
4921
+ stopColor: "#D1D6E7"
4922
+ })), /*#__PURE__*/React.createElement("linearGradient", {
4923
+ id: `${id}-h`,
4924
+ x1: "85.68",
4925
+ y1: "108.015",
4926
+ x2: "85.68",
4927
+ y2: "104.85",
4928
+ gradientUnits: "userSpaceOnUse"
4929
+ }, /*#__PURE__*/React.createElement("stop", {
4930
+ stopColor: "#D8DDF1"
4931
+ }), /*#__PURE__*/React.createElement("stop", {
4932
+ offset: ".726",
4933
+ stopColor: "#E2E6F6"
4934
+ })), /*#__PURE__*/React.createElement("clipPath", {
4935
+ id: `${id}-a`
4936
+ }, /*#__PURE__*/React.createElement("path", {
4937
+ fill: "#fff",
4938
+ transform: "translate(12.006)",
4939
+ d: "M0 0h172v174H0z"
4940
+ })), /*#__PURE__*/React.createElement("clipPath", {
4941
+ id: `${id}-b`
4942
+ }, /*#__PURE__*/React.createElement("path", {
4943
+ fill: "#fff",
4944
+ transform: "translate(29.084 105.073)",
4945
+ d: "M0 0h138.387v68.927H0z"
4946
+ })), /*#__PURE__*/React.createElement("clipPath", {
4947
+ id: `${id}-c`
4948
+ }, /*#__PURE__*/React.createElement("path", {
4949
+ fill: "#fff",
4950
+ transform: "translate(135.278 93.304)",
4951
+ d: "M0 0h22.995v14.29H0z"
4952
+ }))));
4953
+ }
4954
+
4955
+ var styles$f = {"blank_state":"blank_state-wMOWN","image":"image-uy0Fd"};
4956
+
4957
+ function BlankState$1({
4958
+ image,
4959
+ role,
4960
+ subtitle,
4961
+ title
4962
+ }) {
4963
+ return /*#__PURE__*/React.createElement(tapestry.Flex, {
4964
+ role: role,
4965
+ className: styles$f.blank_state,
4966
+ direction: "column",
4967
+ align: "center",
4968
+ gap: 3
4969
+ }, /*#__PURE__*/React.createElement(tapestry.Flex, {
4970
+ className: styles$f.image
4971
+ }, image), /*#__PURE__*/React.createElement(tapestry.Flex, {
4972
+ direction: "column",
4973
+ align: "center",
4974
+ gap: 1
4975
+ }, /*#__PURE__*/React.createElement("h2", null, title), /*#__PURE__*/React.createElement("p", null, subtitle)));
4976
+ }
4199
4977
 
4200
4978
  function EndOfResultsObserver({
4201
4979
  onVisible
@@ -4215,39 +4993,98 @@ true;
4215
4993
 
4216
4994
  const resultId = (listboxId, index) => `${listboxId}-result-${index}`;
4217
4995
 
4218
- var styles$c = {"result":"result-Thq2C"};
4996
+ var styles$e = {"result":"result-Thq2C","title":"title-KYUEn","subtitle":"subtitle-R2haq","image":"image-KVDor","avatar":"avatar-6Gh62","photo":"photo-FZR3Q","badge":"badge-trUKt"};
4219
4997
 
4220
4998
  function SearchResult({
4999
+ category,
5000
+ describedBy,
4221
5001
  highlighted,
4222
5002
  id,
5003
+ imageUrl,
4223
5004
  onHighlight,
5005
+ product,
4224
5006
  subtitle,
4225
5007
  title,
4226
5008
  url
4227
5009
  }) {
4228
5010
  const ref = React.useRef(null);
5011
+ // A hovered result is already under the pointer, and scrolling it clear of
5012
+ // the panel's scroll padding would slide the list out from under the mouse.
5013
+ const highlightedByPointer = React.useRef(false);
4229
5014
  React.useEffect(() => {
4230
5015
  var _a;
4231
- if (highlighted) (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
4232
- block: "nearest"
4233
- });
5016
+ if (!highlighted) return;
5017
+ if (highlightedByPointer.current) {
5018
+ highlightedByPointer.current = false;
5019
+ } else {
5020
+ (_a = ref.current) === null || _a === void 0 ? void 0 : _a.scrollIntoView({
5021
+ block: "nearest"
5022
+ });
5023
+ }
4234
5024
  }, [highlighted]);
5025
+ const highlightFromPointer = () => {
5026
+ if (highlighted) return;
5027
+ highlightedByPointer.current = true;
5028
+ onHighlight();
5029
+ };
4235
5030
  // Focus stays in the search input, which points at the highlighted result
4236
5031
  // with aria-activedescendant, so results are kept out of the tab order.
4237
5032
  // Mouse move rather than enter: arrowing scrolls results under a resting
4238
5033
  // pointer, and that shouldn't steal the highlight.
4239
- return /*#__PURE__*/React.createElement("a", {
4240
- "aria-selected": highlighted,
4241
- className: styles$c.result,
4242
- href: url,
4243
- id: id,
4244
- onMouseMove: onHighlight,
4245
- ref: ref,
4246
- role: "option",
4247
- tabIndex: -1
4248
- }, /*#__PURE__*/React.createElement("div", null, title), /*#__PURE__*/React.createElement("div", null, subtitle));
5034
+ return (
5035
+ /*#__PURE__*/
5036
+ // Named by the title alone, so screen readers say "Ada Lovelace" rather
5037
+ // than the whole row. The section and subtitle are read after a pause.
5038
+ React.createElement("a", {
5039
+ "aria-describedby": [describedBy, subtitle && `${id}-subtitle`].filter(Boolean).join(" ") || undefined,
5040
+ "aria-labelledby": title ? `${id}-title` : undefined,
5041
+ "aria-selected": highlighted,
5042
+ className: styles$e.result,
5043
+ href: url,
5044
+ id: id,
5045
+ onMouseMove: highlightFromPointer,
5046
+ ref: ref,
5047
+ role: "option",
5048
+ tabIndex: -1
5049
+ }, /*#__PURE__*/React.createElement(ResultImage, {
5050
+ category: category,
5051
+ imageUrl: imageUrl,
5052
+ product: product
5053
+ }), /*#__PURE__*/React.createElement("span", {
5054
+ className: styles$e.title,
5055
+ id: `${id}-title`
5056
+ }, title), /*#__PURE__*/React.createElement("span", {
5057
+ className: styles$e.subtitle,
5058
+ id: `${id}-subtitle`
5059
+ }, subtitle))
5060
+ );
5061
+ }
5062
+ // A person's photo or the result's own image, badged with its product, or
5063
+ // just the product's logomark when there's no image.
5064
+ function ResultImage({
5065
+ category,
5066
+ imageUrl,
5067
+ product
5068
+ }) {
5069
+ const icon = size => isProductIconSlug(product) ? (/*#__PURE__*/React.createElement(ProductIcon, {
5070
+ size: size,
5071
+ slug: product
5072
+ })) : null;
5073
+ return /*#__PURE__*/React.createElement("span", {
5074
+ "aria-hidden": true,
5075
+ className: styles$e.image
5076
+ }, imageUrl ? (/*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("img", {
5077
+ alt: "",
5078
+ className: category === "profile" ? styles$e.avatar : styles$e.photo,
5079
+ loading: "lazy",
5080
+ src: imageUrl
5081
+ }), /*#__PURE__*/React.createElement("span", {
5082
+ className: styles$e.badge
5083
+ }, icon(16)))) : icon("100%"));
4249
5084
  }
4250
5085
 
5086
+ var styles$d = {"message":"message-1-PP-","heading":"heading-LioUF","group":"group-cKChg"};
5087
+
4251
5088
  // Sections with a heading render as labelled groups; ones without render
4252
5089
  // their items straight into the listbox. Indexes run across every section.
4253
5090
  function ResultListbox({
@@ -4260,13 +5097,19 @@ true;
4260
5097
  sections
4261
5098
  }) {
4262
5099
  let index = 0;
4263
- const renderItem = item => {
5100
+ // With aria-activedescendant, screen readers don't reliably announce the
5101
+ // group a highlighted option is in, so each option names its heading too.
5102
+ const renderItem = (item, headingId) => {
4264
5103
  const itemIndex = index++;
4265
5104
  return /*#__PURE__*/React.createElement(SearchResult, {
5105
+ category: item.category,
5106
+ describedBy: headingId,
4266
5107
  highlighted: itemIndex === highlightedIndex,
4267
5108
  id: resultId(id, itemIndex),
5109
+ imageUrl: item.imageUrl,
4268
5110
  key: item.key,
4269
5111
  onHighlight: () => onHighlight(itemIndex),
5112
+ product: item.product,
4270
5113
  subtitle: item.subtitle,
4271
5114
  title: item.title,
4272
5115
  url: item.url
@@ -4282,16 +5125,18 @@ true;
4282
5125
  if (section.heading === undefined) {
4283
5126
  return /*#__PURE__*/React.createElement(React.Fragment, {
4284
5127
  key: section.key
4285
- }, section.items.map(renderItem));
5128
+ }, section.items.map(item => renderItem(item)));
4286
5129
  }
4287
5130
  const headingId = `${id}-group-${sectionIndex}`;
4288
5131
  return /*#__PURE__*/React.createElement("div", {
4289
5132
  "aria-labelledby": headingId,
5133
+ className: styles$d.group,
4290
5134
  key: section.key,
4291
5135
  role: "group"
4292
5136
  }, /*#__PURE__*/React.createElement("div", {
5137
+ className: styles$d.heading,
4293
5138
  id: headingId
4294
- }, section.heading), section.items.map(renderItem));
5139
+ }, section.heading), section.items.map(item => renderItem(item, headingId)));
4295
5140
  }));
4296
5141
  }
4297
5142
 
@@ -4305,9 +5150,14 @@ true;
4305
5150
  }) {
4306
5151
  const headingId = `${navigation.id}-heading`;
4307
5152
  if (items.length === 0 && !hasMore && !loading) {
4308
- return /*#__PURE__*/React.createElement("p", null, "Pages you visit will show up here.");
5153
+ return /*#__PURE__*/React.createElement(BlankState$1, {
5154
+ image: /*#__PURE__*/React.createElement(BlankStateRecentlyVisited, null),
5155
+ subtitle: "Pages you visit will show up here.",
5156
+ title: "Recently visited"
5157
+ });
4309
5158
  } else {
4310
5159
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
5160
+ className: styles$d.heading,
4311
5161
  id: headingId
4312
5162
  }, "Recently visited"), /*#__PURE__*/React.createElement(ResultListbox, {
4313
5163
  labelledBy: headingId,
@@ -4323,6 +5173,8 @@ true;
4323
5173
  }
4324
5174
  }
4325
5175
 
5176
+ var styles$c = {"row":"row-5P7UQ","header":"header-sXEyG","closeButton":"closeButton-rPJJV","input":"input-YQkTC","clearButton":"clearButton-9Yh9w"};
5177
+
4326
5178
  // A combobox: focus stays here while aria-activedescendant points screen
4327
5179
  // readers at the highlighted result in the listbox it controls.
4328
5180
  function SearchInput({
@@ -4331,29 +5183,267 @@ true;
4331
5183
  inputRef,
4332
5184
  listboxId,
4333
5185
  onChange,
5186
+ onClose,
4334
5187
  onFocus,
4335
5188
  onKeyDown,
4336
5189
  value
4337
5190
  }) {
4338
- return /*#__PURE__*/React.createElement("input", {
5191
+ const {
5192
+ focusProps
5193
+ } = useKeyboardFocus({
5194
+ onFocus: (event, keyboard) => {
5195
+ // Tabbing in selects the whole term, which the next keystroke would
5196
+ // replace. Put the cursor after it instead, to keep typing. The
5197
+ // browser selects after the focus event, so this waits a frame and
5198
+ // only undoes that select-all: typing on the tabs moves focus here by
5199
+ // script, which keeps the cursor, and the keystroke may already be in.
5200
+ if (keyboard) {
5201
+ const input = event.currentTarget;
5202
+ requestAnimationFrame(() => {
5203
+ const length = input.value.length;
5204
+ const selectedAll = length > 0 && input.selectionStart === 0 && input.selectionEnd === length;
5205
+ if (document.activeElement !== input || !selectedAll) return;
5206
+ input.setSelectionRange(length, length);
5207
+ });
5208
+ }
5209
+ onFocus();
5210
+ }
5211
+ });
5212
+ return /*#__PURE__*/React.createElement("div", {
5213
+ className: styles$c.row
5214
+ }, /*#__PURE__*/React.createElement("label", {
5215
+ className: styles$c.header
5216
+ }, /*#__PURE__*/React.createElement(Icon, {
5217
+ name: "general.search",
5218
+ size: 20,
5219
+ theme: "--t-icon-color-dim"
5220
+ }), /*#__PURE__*/React.createElement("input", {
4339
5221
  "aria-activedescendant": highlightedIndex === null ? undefined : resultId(listboxId, highlightedIndex),
4340
5222
  "aria-autocomplete": "list",
4341
5223
  "aria-controls": expanded ? listboxId : undefined,
4342
5224
  "aria-expanded": expanded,
4343
5225
  "aria-label": "Search",
4344
5226
  autoFocus: true,
5227
+ className: styles$c.input,
5228
+ id: "product_search",
4345
5229
  onChange: event => onChange(event.target.value),
4346
- onFocus: onFocus,
4347
5230
  onKeyDown: onKeyDown,
4348
5231
  placeholder: "Search",
4349
5232
  ref: inputRef,
4350
5233
  role: "combobox",
4351
5234
  type: "search",
4352
- value: value
4353
- });
5235
+ value: value,
5236
+ ...focusProps
5237
+ }), !onClose && value !== "" && (/*#__PURE__*/React.createElement("button", {
5238
+ "aria-label": "Clear search",
5239
+ className: styles$c.clearButton,
5240
+ onClick: () => {
5241
+ var _a;
5242
+ onChange("");
5243
+ (_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
5244
+ },
5245
+ tabIndex: -1,
5246
+ type: "button"
5247
+ }, /*#__PURE__*/React.createElement(Icon, {
5248
+ name: "general.smallX"
5249
+ })))), onClose && (/*#__PURE__*/React.createElement(tapestry.IconButton, {
5250
+ "aria-label": "Close search",
5251
+ className: styles$c.closeButton,
5252
+ icon: /*#__PURE__*/React.createElement(Icon, {
5253
+ name: "general.x",
5254
+ theme: "--t-icon-color-dim"
5255
+ }),
5256
+ kind: "ghost",
5257
+ onClick: onClose,
5258
+ size: "md"
5259
+ })));
5260
+ }
5261
+
5262
+ function BlankStateNoResults(props) {
5263
+ const id = useInstanceId("blank-state-no-results");
5264
+ return /*#__PURE__*/React.createElement("svg", {
5265
+ viewBox: "0 0 197 152",
5266
+ fill: "none",
5267
+ "aria-hidden": "true",
5268
+ focusable: "false",
5269
+ ...props
5270
+ }, /*#__PURE__*/React.createElement("path", {
5271
+ d: "M139.863 19.971C150.801 30 161.64 40.126 172.775 50.055c8.376 7.374 21.975 15.829 23.157 28.02.592 6.095-2.167 11.994-5.321 17.205-24.635 40.8-81.098 67.148-127.412 48.862C32.553 132.049-12.973 96.754 3.483 59.1 19.348 22.724 68.323 4.044 87.44 1.39c21.876-4.62 34.883 2.458 52.423 18.581Z",
5272
+ fill: "currentColor"
5273
+ }), /*#__PURE__*/React.createElement("path", {
5274
+ d: "M94.382 27.326c4.859 0 8.797-3.932 8.797-8.783 0-4.85-3.938-8.783-8.797-8.783-4.858 0-8.796 3.933-8.796 8.783 0 4.851 3.938 8.783 8.796 8.783Z",
5275
+ fill: "#3690EA"
5276
+ }), /*#__PURE__*/React.createElement("path", {
5277
+ d: "M97.481 19.861a3.22 3.22 0 0 0 3.222-3.217 3.22 3.22 0 0 0-3.222-3.217 3.22 3.22 0 0 0-3.222 3.217 3.22 3.22 0 0 0 3.222 3.217Z",
5278
+ fill: "#4BAAF7"
5279
+ }), /*#__PURE__*/React.createElement("path", {
5280
+ d: "M97.564 26.688h-6.248v3.565h6.248v-3.565Z",
5281
+ fill: "#F2F2F2"
5282
+ }), /*#__PURE__*/React.createElement("path", {
5283
+ d: "M49.297 77.706c4.649 0 8.417-5.61 8.417-12.53 0-6.921-3.768-12.531-8.417-12.531s-8.417 5.61-8.417 12.53c0 6.92 3.768 12.531 8.417 12.531Zm89.958 0c4.649 0 8.417-5.61 8.417-12.53 0-6.921-3.768-12.531-8.417-12.531s-8.417 5.61-8.417 12.53c0 6.92 3.768 12.531 8.417 12.531Z",
5284
+ fill: "#3690EA"
5285
+ }), /*#__PURE__*/React.createElement("path", {
5286
+ d: "M94.379 40.574c7.774 0 14.076-2.36 14.076-5.271 0-2.912-6.302-5.272-14.076-5.272-7.774 0-14.076 2.36-14.076 5.272 0 2.911 6.302 5.271 14.076 5.271Z",
5287
+ fill: "#B3B3B3"
5288
+ }), /*#__PURE__*/React.createElement("path", {
5289
+ d: "M141.036 72.671V57.672a20.118 20.118 0 0 0-3.949-12 20.166 20.166 0 0 0-10.333-7.29c-9.448-2.852-20.529-4.497-32.379-4.497-11.849 0-22.926 1.645-32.374 4.497a20.167 20.167 0 0 0-10.331 7.29 20.117 20.117 0 0 0-3.95 12v15a20.112 20.112 0 0 0 3.949 12A20.163 20.163 0 0 0 62 91.962c9.448 2.856 20.53 4.496 32.375 4.496 11.844 0 22.93-1.64 32.378-4.496a20.153 20.153 0 0 0 10.333-7.289 20.107 20.107 0 0 0 3.949-12.002Z",
5290
+ fill: "#F2F2F2"
5291
+ }), /*#__PURE__*/React.createElement("path", {
5292
+ d: "M94.387 89.422c-10.76 0-21.248-1.448-30.348-4.193a13.19 13.19 0 0 1-6.698-4.759 13.159 13.159 0 0 1-2.576-7.794v-15a13.163 13.163 0 0 1 2.577-7.793 13.196 13.196 0 0 1 6.697-4.76c9.082-2.744 19.574-4.193 30.348-4.193 10.773 0 21.248 1.449 30.348 4.194a13.2 13.2 0 0 1 6.701 4.757 13.17 13.17 0 0 1 2.582 7.795v15a13.164 13.164 0 0 1-2.577 7.794 13.195 13.195 0 0 1-6.697 4.759c-9.109 2.727-19.597 4.193-30.357 4.193Z",
5293
+ fill: "#E6E6E6"
5294
+ }), /*#__PURE__*/React.createElement("path", {
5295
+ d: "M71.426 79.868c4.624 0 8.373-6.58 8.373-14.696s-3.749-14.696-8.373-14.696c-4.624 0-8.372 6.58-8.372 14.696 0 8.117 3.748 14.697 8.372 14.697Z",
5296
+ fill: "#1A1A1A"
5297
+ }), /*#__PURE__*/React.createElement("path", {
5298
+ d: "M72.894 65.765c1.863 0 3.373-2.217 3.373-4.95 0-2.735-1.51-4.952-3.373-4.952-1.864 0-3.375 2.217-3.375 4.951 0 2.734 1.511 4.95 3.374 4.95Z",
5299
+ fill: "#fff"
5300
+ }), /*#__PURE__*/React.createElement("path", {
5301
+ d: "M116.517 79.868c4.624 0 8.373-6.58 8.373-14.696s-3.749-14.696-8.373-14.696c-4.624 0-8.372 6.58-8.372 14.696 0 8.117 3.748 14.697 8.372 14.697Z",
5302
+ fill: "#1A1A1A"
5303
+ }), /*#__PURE__*/React.createElement("path", {
5304
+ d: "M117.981 65.765c1.864 0 3.374-2.217 3.374-4.95 0-2.735-1.51-4.952-3.374-4.952-1.863 0-3.374 2.217-3.374 4.951 0 2.734 1.511 4.95 3.374 4.95Z",
5305
+ fill: "#fff"
5306
+ }), /*#__PURE__*/React.createElement("path", {
5307
+ d: "M100.012 80.196a14.156 14.156 0 0 0-2.785-1.159 10.598 10.598 0 0 0-5.713 0 14.09 14.09 0 0 0-2.78 1.159h-.027a.773.773 0 0 1-.973-1.159 8.74 8.74 0 0 1 6.639-3.049 8.754 8.754 0 0 1 6.638 3.05.773.773 0 0 1-.977 1.158h-.022Z",
5308
+ fill: "#999"
5309
+ }), /*#__PURE__*/React.createElement("path", {
5310
+ d: "M44.788 67.69c.853 0 1.545-1.731 1.545-3.867 0-2.137-.692-3.868-1.545-3.868-.852 0-1.544 1.731-1.544 3.867 0 2.137.691 3.868 1.544 3.868Zm99.38 0c.853 0 1.544-1.731 1.544-3.867 0-2.137-.691-3.868-1.544-3.868-.853 0-1.544 1.731-1.544 3.867 0 2.137.691 3.868 1.544 3.868Z",
5311
+ fill: "#4BAAF7"
5312
+ }), /*#__PURE__*/React.createElement("path", {
5313
+ d: "M79.596 106.857s-13.835 0-13.835-18.752",
5314
+ strokeWidth: "13.63",
5315
+ strokeMiterlimit: "10",
5316
+ strokeLinecap: "round",
5317
+ stroke: "#4D4D4D"
5318
+ }), /*#__PURE__*/React.createElement("path", {
5319
+ d: "M79.295 99.708h-.004a2.453 2.453 0 0 0-2.34 2.56l.353 7.781a2.453 2.453 0 0 0 2.564 2.337h.004a2.452 2.452 0 0 0 2.34-2.559l-.353-7.782a2.453 2.453 0 0 0-2.564-2.337Z",
5320
+ fill: "gray"
5321
+ }), /*#__PURE__*/React.createElement("path", {
5322
+ d: "M109.137 104.385s3.851 3.681 10.947-1.181",
5323
+ strokeWidth: "13.63",
5324
+ strokeMiterlimit: "10",
5325
+ strokeLinecap: "round",
5326
+ stroke: "#4D4D4D"
5327
+ }), /*#__PURE__*/React.createElement("path", {
5328
+ d: "m107.907 112.125.004.001a2.455 2.455 0 0 0 2.859-1.966l1.414-7.661a2.451 2.451 0 0 0-1.97-2.854h-.004a2.455 2.455 0 0 0-2.859 1.965l-1.413 7.661a2.45 2.45 0 0 0 1.969 2.854Z",
5329
+ fill: "gray"
5330
+ }), /*#__PURE__*/React.createElement("path", {
5331
+ d: "M89.494 121.176s-4.44 8.569-3.936 13.934",
5332
+ strokeWidth: "13.63",
5333
+ strokeMiterlimit: "10",
5334
+ strokeLinecap: "round",
5335
+ stroke: "#4D4D4D"
5336
+ }), /*#__PURE__*/React.createElement("path", {
5337
+ d: "M88.59 128.571c3.535 0 6.4-2.861 6.4-6.39a6.395 6.395 0 0 0-6.4-6.39 6.395 6.395 0 0 0-6.4 6.39 6.395 6.395 0 0 0 6.4 6.39Z",
5338
+ fill: "gray"
5339
+ }), /*#__PURE__*/React.createElement("path", {
5340
+ d: "M76.233 146.043h12.585v3.966a1.205 1.205 0 0 1-1.205 1.204H74.068a1.205 1.205 0 0 1-1.205-1.204v-.601a3.367 3.367 0 0 1 .989-2.378 3.38 3.38 0 0 1 2.38-.987Z",
5341
+ fill: "#333"
5342
+ }), /*#__PURE__*/React.createElement("path", {
5343
+ d: "M85.808 149.557s8.631.125 6.752-8.774c-1.878-8.899-13-16.291-16.263-6.434-3.262 9.857-1.499 16.166 9.511 15.208Z",
5344
+ fill: "#F2F2F2"
5345
+ }), /*#__PURE__*/React.createElement("path", {
5346
+ d: "M100.159 121.176s4.463 8.569 3.937 13.934",
5347
+ strokeWidth: "13.63",
5348
+ strokeMiterlimit: "10",
5349
+ strokeLinecap: "round",
5350
+ stroke: "#4D4D4D"
5351
+ }), /*#__PURE__*/React.createElement("path", {
5352
+ d: "M101.064 128.571c3.534 0 6.4-2.861 6.4-6.39 0-3.529-2.866-6.39-6.4-6.39a6.395 6.395 0 0 0-6.4 6.39 6.395 6.395 0 0 0 6.4 6.39Z",
5353
+ fill: "gray"
5354
+ }), /*#__PURE__*/React.createElement("path", {
5355
+ d: "M115.584 151.216h-13.545a1.206 1.206 0 0 1-1.205-1.203v-3.98h12.586a3.37 3.37 0 0 1 3.374 3.369v.602a1.21 1.21 0 0 1-.745 1.121 1.23 1.23 0 0 1-.465.091Z",
5356
+ fill: "#333"
5357
+ }), /*#__PURE__*/React.createElement("path", {
5358
+ d: "M103.838 149.557s-8.632.125-6.757-8.774c1.874-8.899 13.036-16.291 16.285-6.434 3.249 9.857 1.5 16.166-9.528 15.208Zm6.725-40.315c-.549-9.652-7.975-12.415-16.91-11.907-8.935.508-16.004 4.091-15.455 13.748.549 9.656 8.243 17.067 17.178 16.559 8.935-.508 15.736-8.743 15.187-18.4Z",
5359
+ fill: "#F2F2F2"
5360
+ }), /*#__PURE__*/React.createElement("path", {
5361
+ d: "M110.402 107.707c-1.129 7.958-7.271 14.228-15.027 14.665-8.39.477-15.683-6.034-16.995-14.821a15.77 15.77 0 0 0-.183 3.533c.549 9.652 8.239 17.067 17.178 16.559 8.939-.508 15.736-8.742 15.174-18.399a14.03 14.03 0 0 0-.147-1.537Z",
5362
+ fill: "#E6E6E6"
5363
+ }), /*#__PURE__*/React.createElement("path", {
5364
+ d: "M100.76 105.262H88a.66.66 0 0 0-.66.66v1.871c0 .365.296.66.66.66h12.76a.66.66 0 0 0 .66-.66v-1.871a.66.66 0 0 0-.66-.66Zm0 5.512H88a.66.66 0 0 0-.66.66v1.871c0 .364.296.66.66.66h12.76a.66.66 0 0 0 .66-.66v-1.871a.66.66 0 0 0-.66-.66Zm0 5.505H88a.66.66 0 0 0-.66.66v1.871c0 .364.296.66.66.66h12.76a.66.66 0 0 0 .66-.66v-1.871a.66.66 0 0 0-.66-.66Z",
5365
+ fill: "#3690EA"
5366
+ }), /*#__PURE__*/React.createElement("path", {
5367
+ d: "M133.43 107.146c5.688-4.463 7.529-11.6 4.111-15.943-3.417-4.343-10.799-4.245-16.487.218-5.688 4.463-7.529 11.601-4.111 15.943 3.417 4.343 10.799 4.245 16.487-.218Z",
5368
+ fill: "#F2F2F2"
5369
+ }), /*#__PURE__*/React.createElement("path", {
5370
+ d: "M136.74 95.34c-3.418-4.344-10.8-4.246-16.486.22a15.744 15.744 0 0 0-5.034 6.683c-.031-3.725 2.035-7.87 5.802-10.837 5.69-4.456 13.072-4.559 16.491-.218 1.972 2.508 2.182 5.953.919 9.273a8.246 8.246 0 0 0-1.692-5.12Z",
5371
+ fill: "#E6E6E6"
5372
+ }), /*#__PURE__*/React.createElement("path", {
5373
+ d: "M127.405 89.78c1.87.546 3.824.751 5.766.605v0a16.153 16.153 0 0 0 9.056-3.631",
5374
+ strokeWidth: "13.63",
5375
+ strokeMiterlimit: "10",
5376
+ strokeLinecap: "round",
5377
+ stroke: "#333"
5378
+ }), /*#__PURE__*/React.createElement("path", {
5379
+ d: "M79.875 85.766c2.25-7.476-.567-14.93-6.293-16.649-5.727-1.718-12.194 2.949-14.444 10.425-2.251 7.476.567 14.93 6.293 16.648 5.727 1.719 12.194-2.948 14.444-10.424Z",
5380
+ fill: "#F2F2F2"
5381
+ }), /*#__PURE__*/React.createElement("path", {
5382
+ d: "M69.713 71.558c5.726 1.72 8.542 9.175 6.293 16.652a16.978 16.978 0 0 1-4.74 7.687c3.767-1.435 7.141-5.151 8.627-10.12 2.232-7.477-.567-14.932-6.293-16.648-3.311-.993-6.863.152-9.706 2.736 1.85-.75 3.9-.858 5.82-.307Z",
5383
+ fill: "#E6E6E6"
5384
+ }), /*#__PURE__*/React.createElement("path", {
5385
+ d: "M77.006 68.04a6.195 6.195 0 0 1-4.269-1.866 6.176 6.176 0 0 1 0-8.623 6.195 6.195 0 0 1 4.27-1.867",
5386
+ strokeWidth: "13.63",
5387
+ strokeMiterlimit: "10",
5388
+ strokeLinecap: "round",
5389
+ stroke: "#333"
5390
+ }), /*#__PURE__*/React.createElement("path", {
5391
+ d: "M81.567 54.262c-.103.03-.205.07-.303.106l-.304.112-.303.111-.3.112-.303.111c-.103.031-.2.071-.303.111-.103.04-.201.072-.304.108l-.299.11-.303.112-.304.112c-.102.03-.2.071-.303.111l-.3.107-.303.111-.303.112-.304.111c-.098.031-.2.072-.299.112-.098.04-.205.07-.303.111-.099.04-.201.071-.304.107l-.299.111-.303.112a5.63 5.63 0 0 0-3.824 4.578 5.62 5.62 0 0 0 1.101 4.178 5.578 5.578 0 0 0 2.754 1.956l.303.112.304.111.308.112.303.11.304.112.303.112.304.111.303.112.308.111.304.111.303.112.304.111c.102.036.2.076.303.107l.308.116c.098.036.2.076.303.107.103.031.201.08.304.111.103.031.2.08.303.112.103.03.201.08.304.111.103.031.2.08.303.111.103.032.206.08.308.112a8.12 8.12 0 0 0 10.027-3.863 8.087 8.087 0 0 0-2.619-10.407 8.117 8.117 0 0 0-7.479-.88v.004Z",
5392
+ fill: "#2278D6"
5393
+ }), /*#__PURE__*/React.createElement("path", {
5394
+ d: "M97.105 47.237c-.192.062-.389.138-.58.21-.193.07-.393.142-.585.213-.192.072-.389.138-.585.214-.196.076-.388.138-.58.214-.192.076-.393.138-.585.214-.192.076-.388.138-.584.214-.197.076-.389.138-.585.214-.197.075-.388.138-.58.214-.192.075-.389.138-.585.213-.196.076-.388.139-.585.21-.196.071-.388.143-.58.214-.192.071-.392.138-.584.214-.192.075-.389.138-.585.214-.196.075-.388.138-.585.213-.196.076-.388.139-.58.214-.192.076-.393.139-.585.214-.191.076-.388.138-.584.214-.197.076-.389.138-.585.214-.196.076-.388.134-.58.21-.192.075-.388.138-.585.213a10.762 10.762 0 0 0-3.146 1.65 10.844 10.844 0 0 0-1.674 15.763 10.879 10.879 0 0 0 4.883 3.233c.196.075.388.151.589.213.2.063.388.152.585.214.196.063.392.152.589.219.196.067.388.147.584.214l.59.213c.196.076.388.152.589.214.2.063.388.152.584.214.197.063.388.152.59.214.2.063.388.152.584.219.196.066.388.147.59.213.2.067.387.148.584.214.196.067.388.147.589.214.2.067.388.152.584.214.197.063.393.152.59.214.196.062.388.151.584.218l.59.214c.196.072.388.147.584.214.196.067.393.147.59.214.196.067.387.151.588.214.201.062.388.151.585.214a15.669 15.669 0 0 0 14.439-1.806 15.624 15.624 0 0 0 6.706-12.895 15.597 15.597 0 0 0-1.829-7.256 15.659 15.659 0 0 0-19.454-7.244Z",
5395
+ fill: "#3690EA"
5396
+ }), /*#__PURE__*/React.createElement("path", {
5397
+ d: "M119.065 37.388a25.93 25.93 0 0 0-.978.356c-.326.125-.651.232-.977.357-.326.125-.652.232-.978.356-.325.125-.651.232-.977.361-.326.13-.652.232-.977.357-.326.125-.652.232-.978.356-.326.125-.656.232-.977.357-.322.125-.656.232-.978.36-.321.13-.651.228-.977.357-.326.13-.656.232-.977.357-.322.124-.656.231-.978.356-.321.125-.656.232-.977.357-.321.125-.656.231-.977.36-.322.13-.657.228-.978.357-.321.13-.656.232-.977.357-.322.124-.656.231-.978.356-.321.125-.656.232-.982.361-.325.13-.651.227-.977.357-.326.129-.651.227-.973.356-.321.13-.656.232-.982.357a18.217 18.217 0 0 0-7.281 4.523A18.158 18.158 0 0 0 90.716 72.8a18.097 18.097 0 0 0 8.926 6.314c.326.13.651.254.986.361.335.107.652.254.982.361.33.107.652.25.986.36.335.112.647.25.982.357.335.107.652.254.982.361.33.107.652.25.986.361.335.112.652.25.982.357.33.107.652.254.986.36.335.108.648.25.982.362.335.111.652.25.982.356.33.107.652.254.986.361.335.107.652.25.982.361.331.111.652.25.982.357.33.106.656.253.986.36.331.107.652.254.982.361.331.107.652.25.987.361.334.112.651.25.981.357.331.107.652.254.987.36.334.108.647.25.982.362.334.111.651.25.981.356a26.26 26.26 0 0 0 24.2-3.02 26.2 26.2 0 0 0 8.29-9.42 26.147 26.147 0 0 0-.114-24.35 26.194 26.194 0 0 0-8.377-9.343 26.244 26.244 0 0 0-24.226-2.795l-.022.009Z",
5398
+ fill: "#50B0FF"
5399
+ }), /*#__PURE__*/React.createElement("path", {
5400
+ d: "M128.994 80.692a18.926 18.926 0 0 1-11.736-4.091 18.853 18.853 0 0 1-5.352-22.825 18.889 18.889 0 0 1 8.696-8.867 18.93 18.93 0 0 1 22.967 4.864 18.856 18.856 0 0 1 .514 23.437 18.738 18.738 0 0 1-6.655 5.529 18.772 18.772 0 0 1-8.434 1.953Z",
5401
+ fill: "#D6DEE5"
5402
+ }), /*#__PURE__*/React.createElement("path", {
5403
+ d: "M129.021 45.14a16.719 16.719 0 0 1 10.373 3.604 16.67 16.67 0 0 1 5.887 9.258 16.65 16.65 0 0 1-1.144 10.906 16.687 16.687 0 0 1-7.681 7.838 16.724 16.724 0 0 1-10.896 1.38 16.704 16.704 0 0 1-9.398-5.675 16.657 16.657 0 0 1-.449-20.708 16.64 16.64 0 0 1 13.322-6.604h-.014Zm.014-4.417a21.143 21.143 0 0 0-13.684 5.01 21.066 21.066 0 0 0-4.43 26.958 21.12 21.12 0 0 0 11.363 9.113 21.153 21.153 0 0 0 14.569-.404 21.113 21.113 0 0 0 10.84-9.728 21.063 21.063 0 0 0 1.948-14.422 21.086 21.086 0 0 0-7.869-12.249 20.973 20.973 0 0 0-12.737-4.278Z",
5404
+ fill: "#1B64CE"
5405
+ }), /*#__PURE__*/React.createElement("path", {
5406
+ d: "M131.495 67.397c4.287 0 7.762-3.47 7.762-7.749 0-4.28-3.475-7.75-7.762-7.75-4.286 0-7.761 3.47-7.761 7.75 0 4.28 3.475 7.75 7.761 7.75Z",
5407
+ fill: "#fff"
5408
+ }), /*#__PURE__*/React.createElement("path", {
5409
+ d: "M137.039 56.638a3.996 3.996 0 0 0 3.999-3.993 3.996 3.996 0 0 0-3.999-3.992 3.996 3.996 0 0 0-3.999 3.992 3.996 3.996 0 0 0 3.999 3.993Z",
5410
+ fill: "#fff"
5411
+ }), /*#__PURE__*/React.createElement("mask", {
5412
+ id: `${id}-a`,
5413
+ style: {
5414
+ maskType: "alpha"
5415
+ },
5416
+ maskUnits: "userSpaceOnUse",
5417
+ x: "90",
5418
+ y: "96",
5419
+ width: "9",
5420
+ height: "4"
5421
+ }, /*#__PURE__*/React.createElement("path", {
5422
+ d: "M94.651 96.461c-1.785 0-3.26-.038-3.78-.038v2.897h7.14v-2.897c-.371 0-1.574.038-3.36.038Z",
5423
+ fill: "#000"
5424
+ })), /*#__PURE__*/React.createElement("g", {
5425
+ mask: `url(#${id}-a)`
5426
+ }, /*#__PURE__*/React.createElement("path", {
5427
+ d: "M94.51 95.545c-1.732.049-3.124.25-3.124.494v2.617c0 .245 1.392.446 3.124.495 1.731.049 3.124-.138 3.124-.384v-2.839c0-.245-1.393-.432-3.124-.383Z",
5428
+ fill: "#999"
5429
+ })));
4354
5430
  }
4355
5431
 
4356
- var styles$b = {"visuallyHidden":"visuallyHidden-S9VG5"};
5432
+ var styles$b = {"spinner":"spinner-b5tlz"};
5433
+
5434
+ function LoadingSpinner({
5435
+ size = 48,
5436
+ trackWidth = 6
5437
+ }) {
5438
+ return /*#__PURE__*/React.createElement("span", {
5439
+ "aria-hidden": "true",
5440
+ className: styles$b.spinner,
5441
+ style: {
5442
+ "--spinner-size": `${size}px`,
5443
+ "--spinner-track-width": `${trackWidth}px`
5444
+ }
5445
+ });
5446
+ }
4357
5447
 
4358
5448
  function SearchResults({
4359
5449
  label,
@@ -4374,18 +5464,33 @@ true;
4374
5464
  ...navigation
4375
5465
  });
4376
5466
  }
4377
- return /*#__PURE__*/React.createElement("p", {
4378
- role: "status"
4379
- }, "Searching\u2026");
5467
+ return /*#__PURE__*/React.createElement(tapestry.Flex, {
5468
+ role: "status",
5469
+ justify: "center",
5470
+ align: "center",
5471
+ gap: 1,
5472
+ style: {
5473
+ color: "var(--t-text-color-placeholder)",
5474
+ fontSize: "var(--t-font-size-md)",
5475
+ marginTop: "var(--t-spacing-5)"
5476
+ }
5477
+ }, /*#__PURE__*/React.createElement(LoadingSpinner, {
5478
+ size: 28,
5479
+ trackWidth: 4
5480
+ }), "Searching\u2026");
4380
5481
  case "error":
4381
5482
  return /*#__PURE__*/React.createElement("p", {
5483
+ className: styles$d.message,
4382
5484
  role: "alert"
4383
5485
  }, "Search isn\u2019t working right now. Try again.");
4384
5486
  case "done":
4385
5487
  if (sections.length === 0) {
4386
- return /*#__PURE__*/React.createElement("p", {
4387
- role: "status"
4388
- }, "No results for \u201C", term.trim(), "\u201D");
5488
+ return /*#__PURE__*/React.createElement(BlankState$1, {
5489
+ image: /*#__PURE__*/React.createElement(BlankStateNoResults, null),
5490
+ role: "status",
5491
+ subtitle: "Clear search and try again.",
5492
+ title: `No results for “${term.trim()}”`
5493
+ });
4389
5494
  }
4390
5495
  return /*#__PURE__*/React.createElement(ResultListbox, {
4391
5496
  busy: false,
@@ -4400,27 +5505,37 @@ true;
4400
5505
  // stays put as more recents load and as their lookups answer.
4401
5506
  const RECENTS = "recents";
4402
5507
  function SearchPanel({
5508
+ appName,
5509
+ mobile = false,
4403
5510
  env,
5511
+ onClose,
4404
5512
  products
4405
5513
  }) {
4406
5514
  var _a, _b;
4407
5515
  const listboxId = useInstanceId("product-search-results");
4408
5516
  const [term, setTerm] = React.useState("");
4409
- const [selectedSlug, setSelectedSlug] = React.useState(() => initialProduct(products).slug);
5517
+ const [selectedSlug, setSelectedSlug] = React.useState(() => defaultProduct(products, appName).slug);
4410
5518
  const product = (_a = products.find(({
4411
5519
  slug
4412
5520
  }) => slug === selectedSlug)) !== null && _a !== void 0 ? _a : products[0];
4413
5521
  const hasTerm = term.trim() !== "";
4414
5522
  const search = useProductSearch(product.slug, term);
4415
5523
  const groups = "groups" in search ? search.groups : undefined;
4416
- const sections = React.useMemo(() => groupSections(groups), [groups]);
5524
+ const {
5525
+ organizationTimeZone
5526
+ } = useStore();
5527
+ const sections = React.useMemo(() => groupSections(groups, organizationTimeZone), [groups, organizationTimeZone]);
4417
5528
  const {
4418
5529
  visits,
4419
5530
  ...recents
4420
5531
  } = useRecentVisits(env);
4421
- const recentItems = visits.map(visitItem);
5532
+ const recentItems = visits.map(visit => visitItem(visit, organizationTimeZone));
4422
5533
  const items = hasTerm ? sections.flatMap(section => section.items) : recentItems;
4423
- const navigation = useResultNavigation(items, hasTerm ? sections : RECENTS);
5534
+ // Phones open results by tapping them, with no highlight to arrow through.
5535
+ // A narrow window with a keyboard and mouse keeps both, as does the desktop
5536
+ // layout on a touch device, whose keyboard hints still advertise them.
5537
+ const touchOnly = useMediaQuery("(hover: none) and (pointer: coarse)");
5538
+ const navigation = useResultNavigation(items, hasTerm ? sections : RECENTS, !(mobile && touchOnly));
4424
5539
  const {
4425
5540
  highlightedIndex
4426
5541
  } = navigation;
@@ -4440,41 +5555,48 @@ true;
4440
5555
  navigation.handleKeyDown(event);
4441
5556
  }
4442
5557
  };
4443
- React.useEffect(() => {
4444
- if (hasTerm) saveLastProduct(product.slug);
4445
- }, [hasTerm, product.slug]);
5558
+ const results = hasTerm ? (/*#__PURE__*/React.createElement(SearchResults, {
5559
+ highlightedIndex: highlightedIndex,
5560
+ id: listboxId,
5561
+ label: `Results from Planning Center ${product.appName}`,
5562
+ onHighlight: navigation.highlightIndex,
5563
+ sections: sections,
5564
+ status: search.status,
5565
+ term: term
5566
+ })) : (/*#__PURE__*/React.createElement(RecentlyVisited, {
5567
+ highlightedIndex: highlightedIndex,
5568
+ id: listboxId,
5569
+ items: recentItems,
5570
+ onHighlight: navigation.highlightIndex,
5571
+ ...recents
5572
+ }));
4446
5573
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchInput, {
4447
5574
  expanded: items.length > 0,
4448
5575
  highlightedIndex: highlightedIndex,
4449
5576
  inputRef: inputRef,
4450
5577
  listboxId: listboxId,
4451
5578
  onChange: setTerm,
5579
+ onClose: onClose,
4452
5580
  onFocus: () => setAnnounceHighlight(false),
4453
5581
  onKeyDown: navigation.handleKeyDown,
4454
5582
  value: term
4455
- }), /*#__PURE__*/React.createElement(ProductTabs, {
5583
+ }), mobile ? (/*#__PURE__*/React.createElement(ProductSelect, {
5584
+ onSelect: setSelectedSlug,
5585
+ products: products,
5586
+ selected: product
5587
+ }, results)) : (/*#__PURE__*/React.createElement(ProductTabs, {
4456
5588
  onKeyDown: handleTabsKeyDown,
4457
5589
  onSelect: setSelectedSlug,
4458
5590
  products: products,
4459
5591
  selected: product
4460
- }, hasTerm ? (/*#__PURE__*/React.createElement(SearchResults, {
4461
- highlightedIndex: highlightedIndex,
4462
- id: listboxId,
4463
- label: `${product.appName} results`,
4464
- onHighlight: navigation.highlightIndex,
4465
- sections: sections,
4466
- status: search.status,
4467
- term: term
4468
- })) : (/*#__PURE__*/React.createElement(RecentlyVisited, {
4469
- highlightedIndex: highlightedIndex,
4470
- id: listboxId,
4471
- items: recentItems,
4472
- onHighlight: navigation.highlightIndex,
4473
- ...recents
4474
- }))), /*#__PURE__*/React.createElement("div", {
5592
+ }, results)), /*#__PURE__*/React.createElement("div", {
5593
+ "aria-live": "polite",
5594
+ className: styles$k.visuallyHidden
5595
+ }, announceHighlight ? (_b = navigation.highlighted) === null || _b === void 0 ? void 0 : _b.title : null), /*#__PURE__*/React.createElement("div", {
4475
5596
  "aria-live": "polite",
4476
- className: styles$b.visuallyHidden
4477
- }, announceHighlight ? (_b = navigation.highlighted) === null || _b === void 0 ? void 0 : _b.title : null), /*#__PURE__*/React.createElement(KeyboardHints, {
5597
+ className: styles$k.visuallyHidden,
5598
+ "data-testid": "result-count"
5599
+ }, hasTerm && search.status === "done" && items.length > 0 ? `${items.length} ${items.length === 1 ? "result" : "results"} for “${term.trim()}” in ${product.appName}` : null), mobile ? null : /*#__PURE__*/React.createElement(KeyboardHints, {
4478
5600
  copied: navigation.copied
4479
5601
  }));
4480
5602
  }
@@ -4545,32 +5667,6 @@ true;
4545
5667
  }, [enabled, open, setOpen]);
4546
5668
  }
4547
5669
 
4548
- const SEARCHABLE_PRODUCTS = [{
4549
- appName: "Calendar",
4550
- slug: "calendar"
4551
- }, {
4552
- appName: "Check-Ins",
4553
- slug: "check-ins"
4554
- }, {
4555
- appName: "Giving",
4556
- slug: "giving"
4557
- }, {
4558
- appName: "Groups",
4559
- slug: "groups"
4560
- }, {
4561
- appName: "People",
4562
- slug: "people"
4563
- }, {
4564
- appName: "Publishing",
4565
- slug: "publishing"
4566
- }, {
4567
- appName: "Registrations",
4568
- slug: "registrations"
4569
- }, {
4570
- appName: "Services",
4571
- slug: "services"
4572
- }];
4573
-
4574
5670
  const PERMISSION_CHECKS = {
4575
5671
  "check-ins": () => fetchMe("check-ins", "permission").then(({
4576
5672
  permission
@@ -4675,24 +5771,59 @@ true;
4675
5771
  return groupApps(apps).restProducts.flatMap(app => SEARCHABLE_PRODUCTS.filter(product => product.appName === app.name));
4676
5772
  }
4677
5773
 
5774
+ /**
5775
+ * Writes the height of the visible part of the page to the parent of `ref`'s
5776
+ * element as `--visual-viewport-height`. It shrinks when an on-screen keyboard
5777
+ * opens; `100dvh` doesn't, since mobile Safari draws the keyboard over it.
5778
+ */
5779
+ function useVisualViewportHeight(ref, enabled) {
5780
+ React.useEffect(() => {
5781
+ var _a;
5782
+ const viewport = window.visualViewport;
5783
+ const parent = (_a = ref.current) === null || _a === void 0 ? void 0 : _a.parentElement;
5784
+ if (!enabled || !viewport || !parent) return undefined;
5785
+ const update = () => parent.style.setProperty("--visual-viewport-height", `${viewport.height}px`);
5786
+ update();
5787
+ viewport.addEventListener("resize", update);
5788
+ return () => {
5789
+ viewport.removeEventListener("resize", update);
5790
+ parent.style.removeProperty("--visual-viewport-height");
5791
+ };
5792
+ }, [enabled, ref]);
5793
+ }
5794
+
4678
5795
  function ProductSearch({
5796
+ appName,
4679
5797
  apps,
5798
+ mobile = false,
4680
5799
  env
4681
5800
  }) {
4682
5801
  const searchable = useSearchableProducts(apps);
4683
5802
  const [open, setOpen] = React.useState(false);
5803
+ const modalRef = React.useRef(null);
5804
+ // Sizes Tapestry's modal frame, the dialog's parent, to fit above the keyboard.
5805
+ useVisualViewportHeight(modalRef, mobile && open);
4684
5806
  const available = searchable.status === "done" && searchable.products.length > 0;
4685
5807
  useSearchShortcut(available, open, setOpen);
4686
5808
  if (!available) return null;
4687
5809
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(SearchButton, {
5810
+ mobile: mobile,
4688
5811
  onClick: () => setOpen(true)
4689
5812
  }), /*#__PURE__*/React.createElement(tapestry.Modal, {
4690
5813
  "aria-label": "Search",
5814
+ className: styles$k.modal,
4691
5815
  dismissible: true,
5816
+ id: "product_search_modal",
4692
5817
  onClose: () => setOpen(false),
4693
- open: open
5818
+ open: open,
5819
+ ref: modalRef,
5820
+ size: "lg"
4694
5821
  }, /*#__PURE__*/React.createElement(SearchPanel, {
5822
+ appName: appName,
5823
+ mobile: mobile,
4695
5824
  env: env,
5825
+ // Phones have no Esc, so mobile search gets a close button.
5826
+ onClose: mobile ? () => setOpen(false) : undefined,
4696
5827
  products: searchable.products
4697
5828
  })));
4698
5829
  }
@@ -4986,6 +6117,7 @@ true;
4986
6117
  margin: "auto"
4987
6118
  }
4988
6119
  }), !notificationsEnabled && notifications(), productSearchEnabled ? (/*#__PURE__*/React.createElement(ProductSearch, {
6120
+ appName: props.appName,
4989
6121
  apps: props.apps,
4990
6122
  env: props.env
4991
6123
  })) : search({
@@ -32900,7 +34032,7 @@ true;
32900
34032
  method: "localStorage"
32901
34033
  };
32902
34034
 
32903
- var styles$6 = {"appmenu-button":"appmenu-button-b0UvT","appmenu-layer":"appmenu-layer-0IQpN","appmenu-container":"appmenu-container-gackd","appmenu-scroll":"appmenu-scroll-mPSx0","appmenu-list":"appmenu-list-h7clX","appmenu-list-a":"appmenu-list-a-rGIQN","appmenu-list-a--top":"appmenu-list-a--top-RT-2F","appmenu-list-a--bottom":"appmenu-list-a--bottom-YDeBC","appmenu-close-button":"appmenu-close-button-vv9bV","current-route":"current-route-wpJgz","is-active":"is-active-wy8Bg","routes":"routes-Nmt1S","route":"route-kkknQ","profile-button":"profile-button-a2WO2"};
34035
+ var styles$6 = {"appmenu-button":"appmenu-button-b0UvT","appmenu-layer":"appmenu-layer-0IQpN","appmenu-container":"appmenu-container-gackd","appmenu-scroll":"appmenu-scroll-mPSx0","appmenu-list":"appmenu-list-h7clX","appmenu-list-a":"appmenu-list-a-rGIQN","appmenu-list-a--top":"appmenu-list-a--top-RT-2F","appmenu-list-a--bottom":"appmenu-list-a--bottom-YDeBC","appmenu-close-button":"appmenu-close-button-vv9bV","current-route":"current-route-wpJgz","is-active":"is-active-wy8Bg","routes":"routes-Nmt1S","route":"route-kkknQ","actions":"actions-INQ7-","profile-button":"profile-button-a2WO2"};
32904
34036
 
32905
34037
  function AccountSettingsLink({
32906
34038
  env
@@ -33120,7 +34252,14 @@ true;
33120
34252
  setProductSwitcherVisible(false);
33121
34253
  setRoutesMenuVisible(visible => !visible);
33122
34254
  } : null
33123
- }, /*#__PURE__*/React.createElement(CurrentRouteComponent, null, capitalize$1(currentRouteText)), props.routes.length > 0 && /*#__PURE__*/React.createElement(DisclosureChevronIcon, null)), /*#__PURE__*/React.createElement("button", {
34255
+ }, /*#__PURE__*/React.createElement(CurrentRouteComponent, null, capitalize$1(currentRouteText)), props.routes.length > 0 && /*#__PURE__*/React.createElement(DisclosureChevronIcon, null)), /*#__PURE__*/React.createElement("div", {
34256
+ className: styles$6["actions"]
34257
+ }, productSearchEnabled && (/*#__PURE__*/React.createElement(ProductSearch, {
34258
+ appName: props.appName,
34259
+ apps: props.apps,
34260
+ mobile: true,
34261
+ env: props.env
34262
+ })), /*#__PURE__*/React.createElement("button", {
33124
34263
  type: "button",
33125
34264
  className: styles$6["profile-button"],
33126
34265
  onClick: () => {
@@ -33131,7 +34270,7 @@ true;
33131
34270
  }, /*#__PURE__*/React.createElement(Avatar, {
33132
34271
  env: props.env,
33133
34272
  url: props.userAvatarPath
33134
- })));
34273
+ }))));
33135
34274
  };
33136
34275
  const SmallRoute = ({
33137
34276
  active,
@@ -33621,38 +34760,6 @@ true;
33621
34760
  }));
33622
34761
  };
33623
34762
 
33624
- const collections = {
33625
- general: general__namespace,
33626
- toolbar: toolbar__namespace
33627
- };
33628
- const paths = collections;
33629
- function Icon({
33630
- name,
33631
- size = 16,
33632
- style,
33633
- theme,
33634
- title,
33635
- ...props
33636
- }) {
33637
- const [collection, symbol] = name.split(".");
33638
- return /*#__PURE__*/React.createElement("svg", {
33639
- "aria-hidden": title ? undefined : true,
33640
- fill: "currentColor",
33641
- height: size,
33642
- role: title ? "img" : undefined,
33643
- style: {
33644
- color: theme && `var(${theme})`,
33645
- flexShrink: 0,
33646
- ...style
33647
- },
33648
- viewBox: "0 0 16 16",
33649
- width: size,
33650
- ...props
33651
- }, title && /*#__PURE__*/React.createElement("title", null, title), /*#__PURE__*/React.createElement("path", {
33652
- d: paths[collection][symbol]
33653
- }));
33654
- }
33655
-
33656
34763
  var styles$3 = {"color-mode-switcher":"color-mode-switcher-JpczO","color-mode-switcher-label":"color-mode-switcher-label-3jPM2","color-mode-switcher-modes":"color-mode-switcher-modes-u-bic"};
33657
34764
 
33658
34765
  const COLOR_MODES = [{
@@ -34437,7 +35544,8 @@ true;
34437
35544
  onClick: () => onClick(),
34438
35545
  type: "button"
34439
35546
  }, /*#__PURE__*/React.createElement(SparkleIcon, {
34440
- className: styles.sparkle
35547
+ className: styles.sparkle,
35548
+ fill: "currentColor"
34441
35549
  }), /*#__PURE__*/React.createElement("span", {
34442
35550
  className: styles.label
34443
35551
  }, text));
@@ -34626,6 +35734,9 @@ true;
34626
35734
  // Contact support) and picobot's own NEW_ROUTE_RENDERED reports—so it
34627
35735
  // always reflects the live conversation. See buildPicobotSrc.
34628
35736
  const [loadedPath, setLoadedPath] = React.useState(iframePath || "");
35737
+ // Hidden until picobot paints so its blank first frame doesn't flash
35738
+ // white against the drawer in dark mode.
35739
+ const [isReady, setIsReady] = React.useState(false);
34629
35740
  const hasReportedErrorRef = React.useRef(false);
34630
35741
  const loadTimeoutRef = React.useRef();
34631
35742
  const reportLoadError = React.useCallback(() => {
@@ -34653,7 +35764,10 @@ true;
34653
35764
  setLoadedPath(reportedPath);
34654
35765
  onIframeChangePath(reportedPath);
34655
35766
  }
34656
- if (((_c = e.data) === null || _c === void 0 ? void 0 : _c.type) === "READY") clearTimeout(loadTimeoutRef.current);
35767
+ if (((_c = e.data) === null || _c === void 0 ? void 0 : _c.type) === "READY") {
35768
+ clearTimeout(loadTimeoutRef.current);
35769
+ setIsReady(true);
35770
+ }
34657
35771
  if (onMessage) onMessage(e.data);
34658
35772
  }
34659
35773
  window.addEventListener("message", handleGuestMessage);
@@ -34663,12 +35777,15 @@ true;
34663
35777
  setLoadedPath(iframePath || "");
34664
35778
  }, [iframePath]);
34665
35779
  // A one-way channel for sending messages to picobot. Topbar just
34666
- // forwards the envelope to the iframe and holds no message semantics of
34667
- // its own—the consumer decides what to send and when.
35780
+ // forwards the envelope to the iframe—the consumer decides what to send
35781
+ // and when. The one exception is PANE_VISIBLE: Safari ignores focus()
35782
+ // from inside a cross-origin iframe, so the host has to focus the iframe
35783
+ // before picobot can focus its composer.
34668
35784
  React.useImperativeHandle(ref, () => ({
34669
35785
  postMessage(message) {
34670
- var _a, _b;
34671
- (_b = (_a = iframeRef.current) === null || _a === void 0 ? void 0 : _a.contentWindow) === null || _b === void 0 ? void 0 : _b.postMessage(message, picobotOrigin);
35786
+ var _a, _b, _c;
35787
+ if (message.type === "PANE_VISIBLE") (_a = iframeRef.current) === null || _a === void 0 ? void 0 : _a.focus();
35788
+ (_c = (_b = iframeRef.current) === null || _b === void 0 ? void 0 : _b.contentWindow) === null || _c === void 0 ? void 0 : _c.postMessage(message, picobotOrigin);
34672
35789
  }
34673
35790
  }), []);
34674
35791
  const iframeSrc = buildPicobotSrc(picobotOrigin, loadedPath, {
@@ -34682,6 +35799,7 @@ true;
34682
35799
  border: 0,
34683
35800
  flex: 1,
34684
35801
  height: "100%",
35802
+ visibility: isReady ? undefined : "hidden",
34685
35803
  width: "100%"
34686
35804
  },
34687
35805
  title: "Picobot"
@@ -35410,6 +36528,7 @@ true;
35410
36528
  closeDrawer,
35411
36529
  currentPath,
35412
36530
  env,
36531
+ isOpen,
35413
36532
  onChangePath,
35414
36533
  openTool,
35415
36534
  pending
@@ -35454,6 +36573,17 @@ true;
35454
36573
  }
35455
36574
  clearPending();
35456
36575
  }, [pending, isPicobotReady, clearPending]);
36576
+ // The drawer keeps the iframe mounted while it's closed, so picobot's
36577
+ // autofocus is spent by the time the panel reopens. READY gates the signal
36578
+ // because picobot has no listener before it.
36579
+ React.useEffect(function tellPicobotThePanelIsVisible() {
36580
+ var _a;
36581
+ if (isOpen && isPicobotReady) {
36582
+ (_a = picobotRef.current) === null || _a === void 0 ? void 0 : _a.postMessage({
36583
+ type: "PANE_VISIBLE"
36584
+ });
36585
+ }
36586
+ }, [isOpen, isPicobotReady]);
35457
36587
  const [iframeErrored, setIframeErrored] = React.useState(false);
35458
36588
  const [mountKey, setMountKey] = React.useState(0);
35459
36589
  const handleRetry = React.useCallback(() => {
@@ -35970,6 +37100,11 @@ true;
35970
37100
  };
35971
37101
 
35972
37102
  const DURATION = 100;
37103
+ const TOOLBAR_DRAWER_CHANGE_EVENT = "topbar:toolbar-drawer-change";
37104
+ const CLOSED_TOOLBAR_DRAWER = {
37105
+ open: false,
37106
+ tool: null
37107
+ };
35973
37108
  // Exempt paths match regardless of query, so `email?conversationId=…` is
35974
37109
  // exempt along with `email`.
35975
37110
  function isToolPathExemptFromStorage(toolName, path) {
@@ -36083,6 +37218,27 @@ true;
36083
37218
  delete window.openHelpdesk; /* TODO: Remove when products have migrated to window.topbar.openHelpdesk */
36084
37219
  };
36085
37220
  }, [Profile, openHelpdeskAtRoot]);
37221
+ const toolbarDrawerTool = open && currentContent ? currentContent.name.toLowerCase() : null;
37222
+ const lastToolbarDrawer = React.useRef(CLOSED_TOOLBAR_DRAWER);
37223
+ React.useEffect(() => {
37224
+ const toolbarDrawer = {
37225
+ open,
37226
+ tool: toolbarDrawerTool
37227
+ };
37228
+ window.topbar = window.topbar || {};
37229
+ window.topbar.toolbarDrawer = toolbarDrawer;
37230
+ const last = lastToolbarDrawer.current;
37231
+ if (last.open !== toolbarDrawer.open || last.tool !== toolbarDrawer.tool) {
37232
+ lastToolbarDrawer.current = toolbarDrawer;
37233
+ window.dispatchEvent(new CustomEvent(TOOLBAR_DRAWER_CHANGE_EVENT, {
37234
+ detail: toolbarDrawer
37235
+ }));
37236
+ }
37237
+ return () => {
37238
+ var _a;
37239
+ (_a = window.topbar) === null || _a === void 0 ? true : delete _a.toolbarDrawer;
37240
+ };
37241
+ }, [open, toolbarDrawerTool]);
36086
37242
  const loginSettingsUrl = getLoginProfilePath({
36087
37243
  appName: appName.replace(/[\s-]/, ""),
36088
37244
  env: env,